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

Default 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.

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<T_type, O, S> &)
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 two 10x10 matrices of 1s.  Creates two distinct copies.
  Matrix<> A(10, 10, true, 1);
  Matrix<> B(A);

  // Construct two 2x4 matrix views, both viewing the same block of 4s.
  Matrix<double, Col, View> C(2, 4, true, 4);
  Matrix<double, Col, View> D(C);

  // Construct a 10x10 view of a concrete matrix.
  Matrix<double, Col, View> E(B);

  B[2] = 23.2;
  C[2] = 12.34;

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

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

  // Prints false (0)
  std::cout << A.equals(E) << "\n";
  
  // Prints true (1)
  std::cout << B.equals(E) << "\n";
  
  return 0;
}