Boost logo

Boost :

Subject: [boost] Interested in a generic safe n-dimensional matrix/vector library?
From: Тимофей Игнатьич (fhq_at_[hidden])
Date: 2011-02-21 15:19:42

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.


Boost list run by bdawes at, gregod at, cpdaniel at, john at