Menu

#264 tcllib math::linearalgebra additions (matrix stuff)

open
math (19)
5
2007-06-13
2007-06-11
No

you can find at the bottom of this page http://wiki.tcl.tk/778 additions made by me for linearalgebra package.

I hope you can include it into the tree.

(actually only matrix rank is missing, but it would require combinatory functions; matrix determinant is computed with cofactor expansion, that -yes- is cpu expensive. I'll do a better version using Gauss-Jordan elimination in the future)

Discussion

  • Anonymous

    Anonymous - 2007-06-12

    Logged In: YES
    user_id=1628983
    Originator: YES

    sorry, Tcl Wiki is under maintenance. best to check that: http://rafb.net/p/tQ0k4t70.txt

     
  • Andreas Kupries

    Andreas Kupries - 2007-06-13
    • assigned_to: nobody --> arjenmarkus
     
  • Arjen Markus

    Arjen Markus - 2007-06-13

    Logged In: YES
    user_id=400048
    Originator: NO

    I will be looking into these shortly. I got the code from "ratfb" as a reference implementation.
    What we will need further is a few test cases and documentation. But let me study the code a bit
    first :)

     
  • Arjen Markus

    Arjen Markus - 2007-06-22

    Logged In: YES
    user_id=400048
    Originator: NO

    I have started the incorporation of the code into the linearalgebra package.
    That is: I am writing some tests to check the code (removing Tcl8.5-isms and
    one or two bugs along the way).

    Suggestion for the determinant:
    Use LU decomposition and then multiply the diagonal elements to obtain
    the determinant. (I am not familiar with cofactors, I am afraid, so I
    cannot comment on their usefulness, but this would speed up the
    computation).

     
  • Anonymous

    Anonymous - 2007-06-22

    Logged In: YES
    user_id=1628983
    Originator: YES

    hmmm....
    didn't know about LU (LDU) decomposition. I quickly read about it on wikipedia, an I see it is a slightly modified Gauss-Jordan algorithm.

    AFAIK Gauss elimination *changes* the determinant (well, it does in a predictable way). I can't find this information on the "LU decomposition" page though...
    also the Gauss algorithm has some quirks that make the code more complicated (if one wants to work with any kind of matrix), so it will require me time & knowledge (now I am a bit busy with exams)

     
  • Arjen Markus

    Arjen Markus - 2007-06-25

    Logged In: YES
    user_id=400048
    Originator: NO

    No, Gauss elimination does not change the determinant: you add a multiple of an existing row to another row and determinants are invariant under this operation. LU decomposition is indeed little
    more than Gauss elimination (I use the terms as synonyms).

    We should not be hasty - better do a good job that takes a bit longer than a sloppy one. So don't
    worry.