On 04/06/2012 13:51, inge...@ragnemalm.se wrote:

I am writing a unit for dealing with matrix algebra with arbitrary sized
matrices (as opposed to the FPC unit that deals with a few fixed size
ones).

If you are writing that for your fun and to learn, go ahead, if what you really want is to have a unit to deal with arbitrary sized matrices, just go to:
http://wiki.freepascal.org/5dpo
and install the SdpoDynmatrix package.
There you have automatically ref counted arbitrary sized matrices with overloaded operators to add, subtract, multiply and invert them.

As for the initialization of a matrix you can do the, somewhat ugly but effective, trick of creating a function like:

// Converts a String representation to a TDMatrix
// a11 a12 a13; a12 a22 a23;
function StringToDMatrix(str: string): TDMatrix;

and then write:

A := StringToDMatrix('1 2 3; 4 5 6;');

Paulo Costa
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to