Scythe-1.0.3
template<typename T_type = double, matrix_order ORDER = Col, matrix_style STYLE = Concrete>
template<typename T_iterator >
scythe::Matrix< T_type, ORDER, STYLE >::Matrix ( uint  rows,
uint  cols,
T_iterator  it 
) [inline]

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.

Parameters:
rowsThe number of rows in the Matrix.
colsThe number of columns in the Matrix.
itThe input iterator to read from.
See also:
Matrix()
Matrix(T_type)
Matrix(uint, uint, bool, T_type)
Matrix(const std::string&)
Matrix(const Matrix&)
Matrix(const Matrix<T_type, O, S> &)
Matrix(const Matrix<S_type, O, S> &)
Matrix(const Matrix<T_type, O, S>&, uint, uint, uint, uint)
Exceptions:
scythe_alloc_error(Level 1)

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;
}