Subject: Re: [boost] Interested in a generic safe n-dimensional matrix/vector library?
From: Gregory Crosswhite (gcross_at_[hidden])
Date: 2011-02-21 16:03:03
Cool! :-) Have you looked at Blitz++? You might find it easier to start
with the code that they have there and modify it to take advantage of
c++0x features than to start from scratch.
On 2/21/11 12:19 PM, Ð¢Ð¸Ð¼Ð¾ÑÐµÐ¹ ÐÐ³Ð½Ð°ÑÑÐ¸Ñ wrote:
> c++0x features allow us to implement some nice stuff:
> - Safe variadic functions with parameter count checking. For example consider a constructor of the N dimensional vector of T takes only N farameters that are convertable to T and fails othervise:
> vector<T, N> v(/*...N parameters convertable to T...*/);
> vector<float, 3> v(1,2,3); // good
> vector<float, 4> v(1.f,2.f); //fails
> vector<int, 3> v(1,2,3,4); //fails
> vector<int, 4> v(1,2,3,4); //good
> or an N dimensional cross product function that takes exactly N-1 vectors of dimension N:
> cross(v1,v2,v3,/*...*/, vn-1);
> Please note that N is arbitrary positive integer and is only restricted by compiler's template recursion depth.
> - Same type comversion as for fundamental types. This means that char multiplied by int gives int result and int multiplied by float gives float result. vectors work exactly the same:
> vector<float, 3> vf;
> vector<int, 3> vl;
> vector<short, 3> vs;
> vector<double, 3> vd;
> vi*vf; //returns vector<float, 3>
> vf*vd; //returns vector<double, 3>
> vs*vi; //returns vector<int, 3>
> Among other notable features are matrix matrix and vector matrix multiplications, component vise addition/substraction/multiplication/division, dot product, matrix inversion, matrix determinant calculation, etc.
> I want to know if there is any interest in such a library in boost community, and if so to make it available for public inspecion and criticism.
> Unsubscribe& other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Boost list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk