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

Make this Matrix a copy of another.

Converts this Matrix into a deep copy of another Matrix. This Matrix retains its own matrix_order and matrix_style but contains copies of M's elements and becomes the same size and shape as M. Calling this method automatically detaches this Matrix from its previous DataBlock before copying.

Parameters:
MThe Matrix to copy.
See also:
Matrix(const Matrix&)
Matrix(const Matrix<T_type, O, S> &)
Matrix(const Matrix<S_type, O, S> &)
copy()
reference(const Matrix<T_type, O, S> &)
detach()
Exceptions:
scythe_alloc_error(Level 1)

Example:

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

int main ()
{
  // Construct two 10x10 matrices of 1s, one a view of the other.
  Matrix<> A(10, 10, true, 1);
  Matrix<double,Col,View> B(A);

  A[3] = 22;

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

  B.copy(A);
  A[4] = 12.4;

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

  return 0;
}