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

Create a copy of this matrix.

Creates a deep copy of this Matrix. The returned concrete matrix references a newly created DataBlock that contains values that are identical to, but distinct from, the values contained in the original Matrix.

See also:
Matrix(const Matrix&)
Matrix(const Matrix<T_type, O, S> &)
Matrix(const Matrix<S_type, O, S> &)
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 distinct 10x10 matrices of 1s, one a view.
  Matrix<> A(10, 10, true, 1);
  Matrix<double,Col,View> B = A.copy();

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

  A[3] = 22;

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

  return 0;
}

Referenced by scythe::Matrix< T_type, M_ORDER, M_STYLE >::copy(), and scythe::Matrix< T_type, M_ORDER, M_STYLE >::Matrix().