/* * File: Matrix.h * Author: Samer Afach * * Created on 01. Oktober 2016, 17:12 */ #include #include #include #include #include #include #include #include #include #include #include #include #include "LapackAdapters.h" #include "StdAdapters.h" #ifndef MATRIX_H #define MATRIX_H #define ColMaj 0 #define RowMaj 1 /** This class is an implementation of a matrix in mathematics. It can be used as a vector implementation as well. */ namespace Poly { extern std::string ComplexUnit; template class Matrix; } namespace std { template std::string to_string(std::complex value) { std::stringstream sstr; sstr << value.real(); sstr << "+"; sstr << value.imag(); sstr << Poly::ComplexUnit; return sstr.str(); } template Poly::Matrix real(const Poly::Matrix,M>& mat) { Poly::Matrix result(mat.rows(),mat.columns()); std::transform(mat.begin(),mat.end(),result.begin(),[](const std::complex& elem) -> T {return elem.real();}); } template Poly::Matrix imag(const Poly::Matrix,M>& mat) { Poly::Matrix result(mat.rows(),mat.columns()); std::transform(mat.begin(),mat.end(),result.begin(),[](const std::complex& elem) -> T {return elem.imag();}); } template void swap(Poly::Matrix&__a, Poly::Matrix&__b) { std::swap(__a._rows,__b._rows); std::swap(__a._columns,__b._columns); std::swap(__a._matEls,__b._matEls); } } namespace Poly { template struct ExtractType; template