How to compute amount of floating point operations for LU-decomposition of banded matrix?












1












$begingroup$


I want to compute the amount of floating point operations, flops, needed for the LU-decomposition/factorization of a banded matrix A consisting of 5 nonzero diagonals.



Matrix $Ainmathbb{R}^{n times n}$ has nonzero diagonals $-p, -1, 0, 1$ and $p$, thus the highest and lowest bandwidth are $p$ and finally $p$ equals $sqrt{n}$. In the literature, the amount of flops for a full matrix $A$ is determined as following:
$$
2sum^{n-1}_{k=1}(n-k)(n-k-1)=2sum^{n-1}_{l=1}l(l-1)=frac{2}{3}n^{3}+mathcal{O}(n^{2})~mbox{flops}.
$$

Here, the $n-k$ flops for all $n-1$ Gaussian transformations are summed. However, if we know that the maximum bandwidth is $p$ we can take in account only $2p$ flops for the first $n-p$ Gaussian transformations and after that $n-p-1$, $n-p-2$, $...$ flops for the last $p$ Gaussian transformations. This way the above equation can be altered into
$$
2sum^{n-p}_{k=1}(p)(n-k-1)+2sum^{p-1}_{k=1}(p-k)(p-k-1)~mbox{flops}
$$

This would equal (using the first equation for the second summation over $p$)
$$
2pbig(sum^{n-p}_{k=1}(n-1)-sum_{k=1}^{n-p}kbig)+frac{2}{3}p^{3}+mathcal{O}(p^{2})=2p(n-p)(n-1)-2p(n-p)+frac{2}{3}p^{3}+mathcal{O}(p^{2})~mbox{flops}.
$$

Now, here I get confused, because from the internet I find very simple expressions for the amount of flops for banded matrices with highest and lowest bandwidth equal to $p$, namely $np(4p+3)$ flops, which is even a linear dependency.



Finally, I use that $p=sqrt{n}$ and find an expression, which is just slightly less dependent on the size of matrix $Ainmathbb{R}^{ntimes n}$
$$
2n^{2}sqrt{n}+mathcal{O}(n^{2})~mbox{flops}.
$$

Now, the expression I find does not at all correspond to other findings on the internet, but I cannot find, where my reasoning is wrong, can anybody help me?










share|cite|improve this question











$endgroup$












  • $begingroup$
    I do not understand this. If matrix $A$ has upper and lower bandwidth $p$, which are completely filled with nonzero elements, we know that $L$ and $U$ are completely filled from the main diagonal to diagonal $p$. So, there more than 4 elements to be updated per row it seems for me. The amount of elements updated are also dependent on $n$ I thought.
    $endgroup$
    – rs4rs35
    Dec 6 '18 at 11:41
















1












$begingroup$


I want to compute the amount of floating point operations, flops, needed for the LU-decomposition/factorization of a banded matrix A consisting of 5 nonzero diagonals.



Matrix $Ainmathbb{R}^{n times n}$ has nonzero diagonals $-p, -1, 0, 1$ and $p$, thus the highest and lowest bandwidth are $p$ and finally $p$ equals $sqrt{n}$. In the literature, the amount of flops for a full matrix $A$ is determined as following:
$$
2sum^{n-1}_{k=1}(n-k)(n-k-1)=2sum^{n-1}_{l=1}l(l-1)=frac{2}{3}n^{3}+mathcal{O}(n^{2})~mbox{flops}.
$$

Here, the $n-k$ flops for all $n-1$ Gaussian transformations are summed. However, if we know that the maximum bandwidth is $p$ we can take in account only $2p$ flops for the first $n-p$ Gaussian transformations and after that $n-p-1$, $n-p-2$, $...$ flops for the last $p$ Gaussian transformations. This way the above equation can be altered into
$$
2sum^{n-p}_{k=1}(p)(n-k-1)+2sum^{p-1}_{k=1}(p-k)(p-k-1)~mbox{flops}
$$

This would equal (using the first equation for the second summation over $p$)
$$
2pbig(sum^{n-p}_{k=1}(n-1)-sum_{k=1}^{n-p}kbig)+frac{2}{3}p^{3}+mathcal{O}(p^{2})=2p(n-p)(n-1)-2p(n-p)+frac{2}{3}p^{3}+mathcal{O}(p^{2})~mbox{flops}.
$$

Now, here I get confused, because from the internet I find very simple expressions for the amount of flops for banded matrices with highest and lowest bandwidth equal to $p$, namely $np(4p+3)$ flops, which is even a linear dependency.



Finally, I use that $p=sqrt{n}$ and find an expression, which is just slightly less dependent on the size of matrix $Ainmathbb{R}^{ntimes n}$
$$
2n^{2}sqrt{n}+mathcal{O}(n^{2})~mbox{flops}.
$$

Now, the expression I find does not at all correspond to other findings on the internet, but I cannot find, where my reasoning is wrong, can anybody help me?










share|cite|improve this question











$endgroup$












  • $begingroup$
    I do not understand this. If matrix $A$ has upper and lower bandwidth $p$, which are completely filled with nonzero elements, we know that $L$ and $U$ are completely filled from the main diagonal to diagonal $p$. So, there more than 4 elements to be updated per row it seems for me. The amount of elements updated are also dependent on $n$ I thought.
    $endgroup$
    – rs4rs35
    Dec 6 '18 at 11:41














1












1








1


1



$begingroup$


I want to compute the amount of floating point operations, flops, needed for the LU-decomposition/factorization of a banded matrix A consisting of 5 nonzero diagonals.



Matrix $Ainmathbb{R}^{n times n}$ has nonzero diagonals $-p, -1, 0, 1$ and $p$, thus the highest and lowest bandwidth are $p$ and finally $p$ equals $sqrt{n}$. In the literature, the amount of flops for a full matrix $A$ is determined as following:
$$
2sum^{n-1}_{k=1}(n-k)(n-k-1)=2sum^{n-1}_{l=1}l(l-1)=frac{2}{3}n^{3}+mathcal{O}(n^{2})~mbox{flops}.
$$

Here, the $n-k$ flops for all $n-1$ Gaussian transformations are summed. However, if we know that the maximum bandwidth is $p$ we can take in account only $2p$ flops for the first $n-p$ Gaussian transformations and after that $n-p-1$, $n-p-2$, $...$ flops for the last $p$ Gaussian transformations. This way the above equation can be altered into
$$
2sum^{n-p}_{k=1}(p)(n-k-1)+2sum^{p-1}_{k=1}(p-k)(p-k-1)~mbox{flops}
$$

This would equal (using the first equation for the second summation over $p$)
$$
2pbig(sum^{n-p}_{k=1}(n-1)-sum_{k=1}^{n-p}kbig)+frac{2}{3}p^{3}+mathcal{O}(p^{2})=2p(n-p)(n-1)-2p(n-p)+frac{2}{3}p^{3}+mathcal{O}(p^{2})~mbox{flops}.
$$

Now, here I get confused, because from the internet I find very simple expressions for the amount of flops for banded matrices with highest and lowest bandwidth equal to $p$, namely $np(4p+3)$ flops, which is even a linear dependency.



Finally, I use that $p=sqrt{n}$ and find an expression, which is just slightly less dependent on the size of matrix $Ainmathbb{R}^{ntimes n}$
$$
2n^{2}sqrt{n}+mathcal{O}(n^{2})~mbox{flops}.
$$

Now, the expression I find does not at all correspond to other findings on the internet, but I cannot find, where my reasoning is wrong, can anybody help me?










share|cite|improve this question











$endgroup$




I want to compute the amount of floating point operations, flops, needed for the LU-decomposition/factorization of a banded matrix A consisting of 5 nonzero diagonals.



Matrix $Ainmathbb{R}^{n times n}$ has nonzero diagonals $-p, -1, 0, 1$ and $p$, thus the highest and lowest bandwidth are $p$ and finally $p$ equals $sqrt{n}$. In the literature, the amount of flops for a full matrix $A$ is determined as following:
$$
2sum^{n-1}_{k=1}(n-k)(n-k-1)=2sum^{n-1}_{l=1}l(l-1)=frac{2}{3}n^{3}+mathcal{O}(n^{2})~mbox{flops}.
$$

Here, the $n-k$ flops for all $n-1$ Gaussian transformations are summed. However, if we know that the maximum bandwidth is $p$ we can take in account only $2p$ flops for the first $n-p$ Gaussian transformations and after that $n-p-1$, $n-p-2$, $...$ flops for the last $p$ Gaussian transformations. This way the above equation can be altered into
$$
2sum^{n-p}_{k=1}(p)(n-k-1)+2sum^{p-1}_{k=1}(p-k)(p-k-1)~mbox{flops}
$$

This would equal (using the first equation for the second summation over $p$)
$$
2pbig(sum^{n-p}_{k=1}(n-1)-sum_{k=1}^{n-p}kbig)+frac{2}{3}p^{3}+mathcal{O}(p^{2})=2p(n-p)(n-1)-2p(n-p)+frac{2}{3}p^{3}+mathcal{O}(p^{2})~mbox{flops}.
$$

Now, here I get confused, because from the internet I find very simple expressions for the amount of flops for banded matrices with highest and lowest bandwidth equal to $p$, namely $np(4p+3)$ flops, which is even a linear dependency.



Finally, I use that $p=sqrt{n}$ and find an expression, which is just slightly less dependent on the size of matrix $Ainmathbb{R}^{ntimes n}$
$$
2n^{2}sqrt{n}+mathcal{O}(n^{2})~mbox{flops}.
$$

Now, the expression I find does not at all correspond to other findings on the internet, but I cannot find, where my reasoning is wrong, can anybody help me?







numerical-methods gaussian-elimination floating-point sparse-matrices lu-decomposition






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited Dec 6 '18 at 11:19







rs4rs35

















asked Dec 6 '18 at 10:45









rs4rs35rs4rs35

237




237












  • $begingroup$
    I do not understand this. If matrix $A$ has upper and lower bandwidth $p$, which are completely filled with nonzero elements, we know that $L$ and $U$ are completely filled from the main diagonal to diagonal $p$. So, there more than 4 elements to be updated per row it seems for me. The amount of elements updated are also dependent on $n$ I thought.
    $endgroup$
    – rs4rs35
    Dec 6 '18 at 11:41


















  • $begingroup$
    I do not understand this. If matrix $A$ has upper and lower bandwidth $p$, which are completely filled with nonzero elements, we know that $L$ and $U$ are completely filled from the main diagonal to diagonal $p$. So, there more than 4 elements to be updated per row it seems for me. The amount of elements updated are also dependent on $n$ I thought.
    $endgroup$
    – rs4rs35
    Dec 6 '18 at 11:41
















$begingroup$
I do not understand this. If matrix $A$ has upper and lower bandwidth $p$, which are completely filled with nonzero elements, we know that $L$ and $U$ are completely filled from the main diagonal to diagonal $p$. So, there more than 4 elements to be updated per row it seems for me. The amount of elements updated are also dependent on $n$ I thought.
$endgroup$
– rs4rs35
Dec 6 '18 at 11:41




$begingroup$
I do not understand this. If matrix $A$ has upper and lower bandwidth $p$, which are completely filled with nonzero elements, we know that $L$ and $U$ are completely filled from the main diagonal to diagonal $p$. So, there more than 4 elements to be updated per row it seems for me. The amount of elements updated are also dependent on $n$ I thought.
$endgroup$
– rs4rs35
Dec 6 '18 at 11:41










1 Answer
1






active

oldest

votes


















0












$begingroup$

Each pivot (except the last $p$) updates the next $p$ rows, which have lengths $p+2$ to $2p+1$, and each of these elements is updated once, so the number of flops is, for one pivot (counting only fused multiply-adds):



$$sum_{k=1}^p p+k+1=p^2+frac{p(p+1)}{2}+p=frac32p(p+1)$$



The last $k$th pivot for $kle p$ has shorter rows and less rows to update. It has precisely $k-1$ rows to update, with lengths $k$ each, so the number of flops for each of these pivots is $k(k-1)$



The total number of flops is then



$$frac23(n-p-1)p(p+1)+sum_{k=1}^{p}k(k-1)\
=frac23(n-p-1)p(p+1)+2sum_{k=1}^{p}{kchoose 2}\
=frac23(n-p-1)p(p+1)+2{p+1choose 3}\
=frac23(n-p-1)p(p+1)+frac13p(p+1)(p-1)\
=frac13p(p+1)(2n-2p-2+p-1)\
=frac13p(p+1)(2n-p-3)$$



With $p=sqrt{n}$, that's $O(n^2)$.



The exact number of flops is actually slightly smaller if you do carefully the first $p$ pivots, which have some rows with zero entries. I have also counted the elements that are zeroed by each pivot (the column below the pivot), and usually they are not computed.






share|cite|improve this answer











$endgroup$













    Your Answer





    StackExchange.ifUsing("editor", function () {
    return StackExchange.using("mathjaxEditing", function () {
    StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
    StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
    });
    });
    }, "mathjax-editing");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "69"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    noCode: true, onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3028333%2fhow-to-compute-amount-of-floating-point-operations-for-lu-decomposition-of-bande%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0












    $begingroup$

    Each pivot (except the last $p$) updates the next $p$ rows, which have lengths $p+2$ to $2p+1$, and each of these elements is updated once, so the number of flops is, for one pivot (counting only fused multiply-adds):



    $$sum_{k=1}^p p+k+1=p^2+frac{p(p+1)}{2}+p=frac32p(p+1)$$



    The last $k$th pivot for $kle p$ has shorter rows and less rows to update. It has precisely $k-1$ rows to update, with lengths $k$ each, so the number of flops for each of these pivots is $k(k-1)$



    The total number of flops is then



    $$frac23(n-p-1)p(p+1)+sum_{k=1}^{p}k(k-1)\
    =frac23(n-p-1)p(p+1)+2sum_{k=1}^{p}{kchoose 2}\
    =frac23(n-p-1)p(p+1)+2{p+1choose 3}\
    =frac23(n-p-1)p(p+1)+frac13p(p+1)(p-1)\
    =frac13p(p+1)(2n-2p-2+p-1)\
    =frac13p(p+1)(2n-p-3)$$



    With $p=sqrt{n}$, that's $O(n^2)$.



    The exact number of flops is actually slightly smaller if you do carefully the first $p$ pivots, which have some rows with zero entries. I have also counted the elements that are zeroed by each pivot (the column below the pivot), and usually they are not computed.






    share|cite|improve this answer











    $endgroup$


















      0












      $begingroup$

      Each pivot (except the last $p$) updates the next $p$ rows, which have lengths $p+2$ to $2p+1$, and each of these elements is updated once, so the number of flops is, for one pivot (counting only fused multiply-adds):



      $$sum_{k=1}^p p+k+1=p^2+frac{p(p+1)}{2}+p=frac32p(p+1)$$



      The last $k$th pivot for $kle p$ has shorter rows and less rows to update. It has precisely $k-1$ rows to update, with lengths $k$ each, so the number of flops for each of these pivots is $k(k-1)$



      The total number of flops is then



      $$frac23(n-p-1)p(p+1)+sum_{k=1}^{p}k(k-1)\
      =frac23(n-p-1)p(p+1)+2sum_{k=1}^{p}{kchoose 2}\
      =frac23(n-p-1)p(p+1)+2{p+1choose 3}\
      =frac23(n-p-1)p(p+1)+frac13p(p+1)(p-1)\
      =frac13p(p+1)(2n-2p-2+p-1)\
      =frac13p(p+1)(2n-p-3)$$



      With $p=sqrt{n}$, that's $O(n^2)$.



      The exact number of flops is actually slightly smaller if you do carefully the first $p$ pivots, which have some rows with zero entries. I have also counted the elements that are zeroed by each pivot (the column below the pivot), and usually they are not computed.






      share|cite|improve this answer











      $endgroup$
















        0












        0








        0





        $begingroup$

        Each pivot (except the last $p$) updates the next $p$ rows, which have lengths $p+2$ to $2p+1$, and each of these elements is updated once, so the number of flops is, for one pivot (counting only fused multiply-adds):



        $$sum_{k=1}^p p+k+1=p^2+frac{p(p+1)}{2}+p=frac32p(p+1)$$



        The last $k$th pivot for $kle p$ has shorter rows and less rows to update. It has precisely $k-1$ rows to update, with lengths $k$ each, so the number of flops for each of these pivots is $k(k-1)$



        The total number of flops is then



        $$frac23(n-p-1)p(p+1)+sum_{k=1}^{p}k(k-1)\
        =frac23(n-p-1)p(p+1)+2sum_{k=1}^{p}{kchoose 2}\
        =frac23(n-p-1)p(p+1)+2{p+1choose 3}\
        =frac23(n-p-1)p(p+1)+frac13p(p+1)(p-1)\
        =frac13p(p+1)(2n-2p-2+p-1)\
        =frac13p(p+1)(2n-p-3)$$



        With $p=sqrt{n}$, that's $O(n^2)$.



        The exact number of flops is actually slightly smaller if you do carefully the first $p$ pivots, which have some rows with zero entries. I have also counted the elements that are zeroed by each pivot (the column below the pivot), and usually they are not computed.






        share|cite|improve this answer











        $endgroup$



        Each pivot (except the last $p$) updates the next $p$ rows, which have lengths $p+2$ to $2p+1$, and each of these elements is updated once, so the number of flops is, for one pivot (counting only fused multiply-adds):



        $$sum_{k=1}^p p+k+1=p^2+frac{p(p+1)}{2}+p=frac32p(p+1)$$



        The last $k$th pivot for $kle p$ has shorter rows and less rows to update. It has precisely $k-1$ rows to update, with lengths $k$ each, so the number of flops for each of these pivots is $k(k-1)$



        The total number of flops is then



        $$frac23(n-p-1)p(p+1)+sum_{k=1}^{p}k(k-1)\
        =frac23(n-p-1)p(p+1)+2sum_{k=1}^{p}{kchoose 2}\
        =frac23(n-p-1)p(p+1)+2{p+1choose 3}\
        =frac23(n-p-1)p(p+1)+frac13p(p+1)(p-1)\
        =frac13p(p+1)(2n-2p-2+p-1)\
        =frac13p(p+1)(2n-p-3)$$



        With $p=sqrt{n}$, that's $O(n^2)$.



        The exact number of flops is actually slightly smaller if you do carefully the first $p$ pivots, which have some rows with zero entries. I have also counted the elements that are zeroed by each pivot (the column below the pivot), and usually they are not computed.







        share|cite|improve this answer














        share|cite|improve this answer



        share|cite|improve this answer








        edited Dec 6 '18 at 12:38

























        answered Dec 6 '18 at 11:51









        Jean-Claude ArbautJean-Claude Arbaut

        14.8k63464




        14.8k63464






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Mathematics Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            Use MathJax to format equations. MathJax reference.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3028333%2fhow-to-compute-amount-of-floating-point-operations-for-lu-decomposition-of-bande%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Plaza Victoria

            In PowerPoint, is there a keyboard shortcut for bulleted / numbered list?

            How to put 3 figures in Latex with 2 figures side by side and 1 below these side by side images but in...