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>
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.
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; } |