#ifndef INCLUDE_QMATRIX #define INCLUDE_QMATRIX #include #include #include "quaternion.h" using namespace std; class Qmatrix{ private: int M,N ; vector ele; public: Qmatrix( int m , int n ) : M(m) , N(n), ele(m*n , 0){ } Qmatrix( int m , int n , const Quaternion *d ); Qmatrix( int m , int n , const vector v ); Qmatrix & operator=( const Qmatrix & mat ) ; Qmatrix & operator+=( const Qmatrix & mat ) ; Qmatrix & operator-=( const Qmatrix & mat ) ; int getm( ) const { return M ; } int getn( ) const { return N ; } Quaternion get( int i , int j ) const { return ele[ i * N + j ] ; } void set( int i , int j , Quaternion a ) { ele[ i * N + j ] = a ; } Qmatrix operator + ( ) const { return *this ; } Qmatrix operator + ( Qmatrix mat ) const ; Qmatrix operator - ( ) const ; Qmatrix operator - ( Qmatrix mat ) const ; Qmatrix operator * ( Qmatrix mat ) const ; Qmatrix inv( ) const ; Qmatrix trans( ) const ; Qmatrix Htrans( ) const ; Qmatrix conj( ) const ; }; std::ostream &operator<<(std::ostream & , const Qmatrix & ); Qmatrix operator*( Quaternion a , Qmatrix mat ); #endif