Boost logo

Ublas :

From: aychy_at_[hidden]
Date: 2005-08-08 04:49:17


#include <boost/numeric/ublas/matrix_sparse.hpp>
#include <boost/numeric/ublas/io.hpp>

int main () {
    using namespace boost::numeric::ublas;

    sparse_matrix<std::complex<double> > m (3, 3);
 
    for (unsigned i = 0; i < m.size1 (); ++ i) {
        for (unsigned j = 0; j < i; ++ j)
            m (i, j) = std::complex<double> (3 * i + j, 3 * i + j);
                        m (i, i) = std::complex<double> (4 * i, 0);
        }
    }
        std::cout <<(m(0,0)).real()<< std::endl;
}
  
   Best!
                                                Yong Chen