Matrix Class
pedro ferreira
saqa at asdf.cas
Thu Dec 6 06:03:01 PST 2007
Bill Baxter Wrote:
> Pedro Ferreira wrote:
> > This is a templatized matrix class coded for the lastest DMD (using const correctness). Everytime I used a Phobos functions I enclosed it with version(Phobos), so adding support for another library (read: Tango) shouldn't be too difficult.
> > There are a few edges left to be tackled, but this class was meant to be an exercise of D templates and operator overloading (there was a thread in which I talked about this class).
> > Not too long ago, I found out that there was already a Matrix class available, but this one is not based on such other class. I don't really care which you prefer.
> > The class was coded using D standards with some changes to suit my own prefereces (tabs instead of spaces, opening bracket on new line, single space seperating functions...).
> > This class does not rely on automatic garbage collection (except the right shift operator), so you'll see some scope(failure) to prevent action from the GC. This is, again, personal preference (I like to clean up after myself).
> > It is heavily documented and uses no "language arcana" (quoting Mr. Bright) or obscure tricks, so even though I did not make as many comments as one would like, it is still readable.
> > It is still incomplete. There are loads of functions I wanted to add, namely matrix reduction (.reduce()), equation solving (from previous function), derivated triangle matrix class (speedup on certain functions, such as .determinant()), different storage schemes, Hamming Matrix calculus, rank() (from Gaussian Elimination), rowReduce() (usefull to invert matrices), characteristic polynomial... Some may be partially implemented by the time I submit this message (I don't have permanent internet access). I will also write some guidelines on how to derivate the class (which methods should be overloaded, standards and so on).
> > This class should compile without warnings (-w flag).
> > No testing has been done with complex types (several warnings and errors show up).
> > Matrix multiplication used to work. Now, it seems that "static if( is(T : Matrix) )" no longer works.
> >
> > On a side note, I am not an experienced programmer, so you may think "why the heck he did this that way?!". If so, let me know :D Also, I am not english, so spelling mistakes are probable as well as some comments/var names written in portuguese.
> >
> > The class itself features some bugs from DMD (just search for "bug" on the file).
> > Speaking of bugs, on std.math, the documentation isn't complete for bool approxEqual(T,U)(T lhs, U rhs); It just reads "Returns ."
> > I am forced to use offline documentation (c:\dmd\html\index.html). Usually, the docs appear fine, but when I go to the Phobos section, it gets weird, in the sense that I no longer have an index on the left. Just open it offline to see what I mean.
>
> I seem to remember reading that inversion by cofactors was much inferior
> to using an LU decomposition / Gauss-elimination approach.
>
> --bb
Yeap, as I said, other algorithms will be implemented. By the time I finished the inversion method, I hadn't finished my algorithm for gaussian elimination (echelon row reduce).
More information about the Digitalmars-d-announce
mailing list