Boost logo

Ublas :

From: will_at_[hidden]
Date: 2005-03-13 15:31:22


Friends:
1) Does ublas support complex numbers?
2) The program below is a mixture of examples that compiles fine. I tried
to use complex numbers with many combinations of changing vector <double>
v (3); to vector <complex<double> >.... or vector complex<double>... None
work. If I try to add using namespace std; above main, it won't compile.
Therefore I am kind of stuck on what to try next.

Any direction would be appreciated.

Thanks,
Will

#include <boost/numeric/ublas/vector.hpp>
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/io.hpp>

int main () {
    using namespace boost::numeric::ublas;
    vector <double> v (3);
    vector <double> g (3);
    matrix <double> m (3, 3);
    for (unsigned i = 0; i < v.size (); ++ i)
        v (i) = i;
    for (unsigned i = 0; i < m.size1 (); ++ i)
        for (unsigned j = 0; j < m.size2 (); ++ j)
            m (i, j) = 3 * i + j;
    g=prod(m,v);
    std::cout << v << std::endl;
    std::cout << m << std::endl;
    std::cout << g << std::endl;
}