5 Sep
2008
5 Sep
'08
5:09 p.m.
The examples I've seen construct matrices using for loops, like: matrix<double> m (3, 3); for (unsigned i = 0; i < m.size1 (); ++ i) for (unsigned j = 0; j < m.size2 (); ++ j) m (i, j) = 3 * i + j; but that's inconvenient. I have a matrix in mind, say: double foo[3][3] = { { 1.0, 2.0, 3.0 }, { 2.0, 9.3, 8.1 }, { 3.0, 5.0, 2.3 } }; Is it possible to initialize a matrix<double> from a double[][]? How does one create a matrix without resorting to for loops or via n^2 assignments in the code? Thanks!