Scythe-1.0.3
|
template<typename T_type = double, matrix_order ORDER = Col, matrix_style STYLE = Concrete>
template<typename T_iterator >
Iterator constructor. Creates a rows X cols matrix, filling it sequentially (based on this template's matrix_order) with values referenced by the input iterator it. Pointers are a form of input iterator, so one can use this constructor to initialize a matrix object from a c-style array. The caller is responsible for supplying an iterator that won't be exhausted too soon.
Example: #include <scythestat/matrix.h> using namespace scythe; int main () { double vals[16] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; // Construct a 4x4 matrix from an array of length 16 Matrix<> A(4, 4, vals); // Construct a 4x4 matrix containing A's elements in reverse order Matrix<> B(4, 4, A.rbegin()); // Construct the transpose of A in row-major order Matrix<double, Row> C(4, 4, A.begin()); return 0; } |