digitalmars.D.announce - Matrix Class
- Pedro Ferreira (14/14) Dec 04 2007 This is a templatized matrix class coded for the lastest DMD (using cons...
- Pedro Ferreira (2/2) Dec 04 2007 i dont know why this didn't go through:
- BCS (3/7) Dec 04 2007 If you have a dsource account, I'd be willing to let you put this in scr...
- Pedro Ferreira (2/13) Dec 04 2007 My username in dsource is QueChatosComRegistos
- BCS (2/4) Dec 04 2007
- pedro ferreira (3/11) Dec 06 2007 Sorry, missed an "s":
- BCS (2/4) Dec 06 2007 your in
- Bruno Medeiros (5/7) Dec 05 2007 Where are you from Pedro Ferreira? From Portugal perhaps?
- Extrawurst (17/32) Dec 04 2007 Line 84:
- Bill Baxter (4/20) Dec 04 2007 I seem to remember reading that inversion by cofactors was much inferior...
- pedro ferreira (2/24) Dec 06 2007 Yeap, as I said, other algorithms will be implemented. By the time I fin...
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.
Dec 04 2007
i dont know why this didn't go through: http://dpaste.com/hold/26749/
Dec 04 2007
Reply to Pedro,i dont know why this didn't go through: http://dpaste.com/hold/26749/If you have a dsource account, I'd be willing to let you put this in scrapple. All I'd need is your user name.
Dec 04 2007
BCS Wrote:Reply to Pedro,My username in dsource is QueChatosComRegistosi dont know why this didn't go through: http://dpaste.com/hold/26749/If you have a dsource account, I'd be willing to let you put this in scrapple. All I'd need is your user name.
Dec 04 2007
Reply to Pedro, that doesn't seem to work.QueChatosComRegisto
Dec 04 2007
BCS Wrote:Reply to Pedro, that doesn't seem to work.Sorry, missed an "s": "QueChatosComRegistos"QueChatosComRegisto
Dec 06 2007
Pedro Ferreira wrote:My username in dsource is QueChatosComRegistosWhere are you from Pedro Ferreira? From Portugal perhaps? -- Bruno Medeiros - MSc in CS/E student http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D
Dec 05 2007
Pedro Ferreira schrieb: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.Line 84: /+DMD BUG: Altough it is documented at www.digitalmars.com/d/arrays.html under "Array Setting" neither of the following lines work: (at leat the first one should) * foreach(ref Type[] row; data) row=fill; * data[][]=fill; +/ possibility one is actually working as it is documented: void main() { byte[][] arr; arr = new byte[][](2,2); foreach(ref e; arr) e[] = 1; } ~Extrawurst
Dec 04 2007
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
Dec 04 2007
Bill Baxter Wrote:Pedro Ferreira wrote: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).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
Dec 06 2007