Pregunta

Why does this work? It's not in the documentation anywhere...

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

int main()
{

boost::numeric::ublas::matrix<double> twoByTwoMat(2,2,-2);

std::cout << "This is the matrix: " << twoByTwoMat << std::endl;

return 0;
}

Output:

This is the matrix: [2,2]((-2,-2),(-2,-2))
¿Fue útil?

Solución

It is defined in the <boost/numeric/ublas/matrix.hpp> header file.

matrix (size_type size1, size_type size2, const value_type &init):
        matrix_container<self_type> (),
        size1_ (size1), size2_ (size2), data_ (layout_type::storage_size (size1, size2), init) {
    }
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top