Gareth Charnock:

>http://github.com/gcharnock/phoboslinalgebra

I think that a single module is better. If seen fitting, some functionality can 
be moved inside other already present modules of Phobos.
The module will need a good amount of unit tests.

In the code I see no point in calling functions like:
CTFENextToken
Just call them:
nextToken
Note: functions, template functions, and ctfe functions, start with a lower 
case letter (and templates generally with with an upper case).

Don't call this module and its contents matrix or vector or Vector, etc. Call 
them SmallVector, or SmallVec, SmallMat, ecc, because this lib is not designed 
to be a general purpose matrix or vector lib, it's designed for small number of 
items.
You can call this module std.tinyarray :-)


> alias Matrix!(float,3) matrix_t;

To define the sizes of a matrix you need two numbers:
alias Matrix!(float, 3, 5) Matrix35;


> //Very natural initialisation
> auto m=matrix_t(1,2,0,0,1,0,0,3,1);

A 1D initialization of a matrix is not so natural :-)


> //No matter how big N, elements always have a canonical name (probably 
> more important for matrices where the letters of the alphabet run out 
> faster although I've only done this for vectors so far)

What's the point of giving names to matrix elements?


> 2) Set a bool. Switch between two element iteration schemes for nearly 
> every operation (with suitable use of templates this might not be as 
> painful as it sounds.)

The point of a transposition is sometimes to actually have data in a different 
position. With cache effects the position of data can be quite important (a 
matrix multiplication can be 2 or 3 times faster if you transpose. This is true 
for larger matrices).


> Transposed:
> 1) makes a new matrix
> 2) creates a transposed image which is forever linked to the original 
> matrix: A=B.Transpose() => Changes to A affect B

The semantics of transpose/transposed can be like in Python: the transpose 
works in-place, transposed creates a new matrix.

Methods and properties like transpose have to start with a lowercase:
auto A = B.transposed;

Bye,
bearophile

Reply via email to