Scythe-1.0.3
template<typename T_type = double, matrix_order ORDER = Col, matrix_style STYLE = Concrete>
template<matrix_order O, matrix_style S>
scythe::Matrix< T_type, ORDER, STYLE >::Matrix ( const Matrix< T_type, O, S > &  M) [inline]

Cross order and/or style copy constructor.

Copy constructing a concrete Matrix makes an exact copy of M in a new data block. On the other hand, copy constructing a view Matrix generates a new Matrix object that references (or views) M's existing data block.

This version of the copy constructor extends Matrix(const Matrix &) by allowing the user to make concrete copies and views of matrices that have matrix_order or matrix_style that does not match that of the constructed Matrix. That is, this constructor makes it possible to create views of concrete matrices and concrete copies of views, row-major copies of col-major matrices, and so on.

Parameters:
MThe Matrix to copy or make a view of.
See also:
Matrix()
Matrix(T_type)
Matrix(uint, uint, bool, T_type)
Matrix(uint, uint, T_iterator)
Matrix(const std::string&)
Matrix(const Matrix&)
Matrix(const Matrix<S_type, O, S> &)
Matrix(const Matrix<T_type, O, S>&, uint, uint, uint, uint)
copy()
copy(const Matrix<T_type, O, S> &)
reference(const Matrix<T_type, O, S> &)
Exceptions:
scythe_alloc_error(Level 1)

Example:

#include <iostream>
#include <scythestat/matrix.h>
using namespace scythe;

int main ()
{
  // Construct a 4x4 matrix of 1s using the standard constructor.
  Matrix<> A(4, 5, true, 1);

  // Create a copy of this matrix in row-major order.
  Matrix<double, Row> B(A);

  // Create a row-major view of A.
  Matrix<double, Row, View> C(A);

  C[2] = 34.333;

  // Prints true (1)
  std::cout << A.equals(C) << "\n";

  // Prints false (0)
  std::cout << A.equals(B) << "\n";

  return 0;
}