src/Matrix/matrix.cc
/* Aside for providing basic tests as to whether to matrics are equvalent or
   not, these operators are necessary in any STL container classes are to
   be used based on matrices (e.g. list<matrix> or std::vector<matrix>)           */
Aside for providing basic tests as to whether to matrics are equvalent or
not, these operators are necessary in any STL container classes are to
be used based on matrices
Aside for providing basic tests as to whether to matrics are equvalent or not these operators are necessary in any STL container classes are to be used based on matrices
bool matrix::operator== (const matrix& mx2) const
 {
 if(same_reference_as(mx2)) return true;		
 if(rows()!=mx2.rows())     return false;		
 if(cols()!=mx2.cols())	    return false;		
 matrix_type mt1 =     (*m).stored_type();		
 matrix_type mt2 = (*(mx2.m)).stored_type();		
 if(mt1 == i_matrix_type) return m->is_equal(mx2.m);	
 if(mt2 == i_matrix_type) return mx2.m->is_equal(m);    
 if(mt1 == d_matrix_type) return m->is_equal(mx2.m);	
 if(mt2 == d_matrix_type) return mx2.m->is_equal(m);    
 if(mt1 == h_matrix_type) return m->is_equal(mx2.m);	
 if(mt2 == h_matrix_type) return mx2.m->is_equal(m);    
 if(mt1 == n_matrix_type) return m->is_equal(mx2.m);	
 if(mt2 == n_matrix_type) return mx2.m->is_equal(m);    
 bool flag=true;					
 int r, c;						
 for(r=rows()-1; (r>=0)&&flag; r--)			
   for(c=cols()-1; (c>=0)&&flag; c--)			
     flag=(get(r,c)==mx2.get(r,c));
 return flag;
 }
bool matrix :: operator == ( const matrix & mx2 ) const { if ( same_reference_as ( mx2 ) ) return true ; if ( rows ( ) != mx2 . rows ( ) ) return false ; if ( cols ( ) != mx2 . cols ( ) ) return false ; matrix_type mt1 = ( * m ) . stored_type ( ) ; matrix_type mt2 = ( * ( mx2 . m ) ) . stored_type ( ) ; if ( mt1 == i_matrix_type ) return m -> is_equal ( mx2 . m ) ; if ( mt2 == i_matrix_type ) return mx2 . m -> is_equal ( m ) ; if ( mt1 == d_matrix_type ) return m -> is_equal ( mx2 . m ) ; if ( mt2 == d_matrix_type ) return mx2 . m -> is_equal ( m ) ; if ( mt1 == h_matrix_type ) return m -> is_equal ( mx2 . m ) ; if ( mt2 == h_matrix_type ) return mx2 . m -> is_equal ( m ) ; if ( mt1 == n_matrix_type ) return m -> is_equal ( mx2 . m ) ; if ( mt2 == n_matrix_type ) return mx2 . m -> is_equal ( m ) ; bool flag = true ; int r , c ; for ( r = rows ( ) - 1 ; ( r >= 0 ) && flag ; r -- ) for ( c = cols ( ) - 1 ; ( c >= 0 ) && flag ; c -- ) flag = ( get ( r , c ) == mx2 . get ( r , c ) ) ; return flag ; }
Aside for providing basic tests as to whether to matrics are equvalent or
not, these operators are necessary in any STL container classes are to
be used based on matrices (e.g.
Aside for providing basic tests as to whether to matrics are equvalent or not these operators are necessary in any STL container classes are to be used based on matrices ( e . g .
// Try for easy + test! // Try for easy - test! // Try for easy - test! //       Not Clearly Equal Or Unequal, We're Forced To Element Compare // Get 1st array type // Get 2nd array type // Easy if array imx  // Easy if array imx // Easy if array dmx  // Easy if array dmx // Harder if array hmx  // Harder if array hmx // Hardest if array nmx  // Hardest if array nmx // If we just don't // know either matrix // type we do a brute // force comparison