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

Cross type copy constructor.

The type conversion copy constructor takes a reference to an existing matrix containing elements of a different type than the constructed matrix and creates a copy. This constructor will only work if it is possible to cast elements from the copied matrix to the type of elements in the constructed matrix.

This constructor always creates a deep copy of the existing matrix, even if the constructed matrix is a view. It is impossible for a matrix view with one element type to reference the data block of a matrix containing elements of a different type.

Parameters:
MThe Matrix to copy.
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<T_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 ()
{
  // Construct a matrix of ints and copy its values into a matrix of
  // doubles
  Matrix<int> A(3, 3, true, 1);
  Matrix<> B(A);

  // Prints without decimal places
  std::cout << A;

  // Prints with decimal places
  std::cout << B;

  return 0;
}