Boost logo

Boost :

Subject: Re: [boost] different matrix library?
From: joel (joel.falcou_at_[hidden])
Date: 2009-08-14 12:45:57


DE wrote:
>> * prefer operator () to operator[]. operator[] is never needed and is
>> less generic
>>
> internally i alwayse use ()
> but [] are provided for users' convenience
>
It's really not needed. operator(i) is the same semantically and I don't
think any STD concept require [].
Having matrix be real function object is also a good way to use htem
more generically.
> but they are handled differently (different public interface)
> vector is modeled after std::valarray (everybody knows about valarray)
> and matrix is just a generalization of std::valarray behavior
> oh and vector is a column-vector
>
Just don't name it vector then. In lin. Alg. a vector is a matrix with
one dimension equal to 1. if not, ppl will wonder why matrix*vector
doesn't mean what they think it does.
> what do you mean by policy?
>
You should have one matrix class whose tempalte parameters allow for
customization.
Want a matrix with static data : matrix<float, settings<static_> >

> don't get it (forgive my unliteratedness)
>
NRC allocation states that a array of N dimension is stored as N array
of pointers, each pointinng to sub-element of the next one, the last one
being a large, monolithic contiguous array of data. This allow for
N-dimensionnal acces via chains of [] and ensures cache locality at the
latest level. It's easy to write, can be recursively extended for
arbitrary dimension number and ease the writings of code that requires
you to extract or work on complex sub-array. performances of access is
roughly the same that T* (within a 2% margin). this requires to have an
iterface that takes smthg lika boost::array for handling set of
dimensions and indexing.

sample 2D code here :
http://codepad.org/nDy8z2iG

of course this has to be hidden in the implementation.

> i've heard and forgotten
> i've seen and memorized
> i've done and understood
> ...or something like thi
which means ?

-- 
___________________________________________
Joel Falcou - Assistant Professor
PARALL Team - LRI - Universite Paris Sud XI
Tel : (+33)1 69 15 66 35

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk