comparison liboctave/CMatrix.cc @ 9550:3d6a9aea2aea

refactor binary & bool ops in liboctave
author Jaroslav Hajek <highegg@gmail.com>
date Wed, 19 Aug 2009 22:55:15 +0200
parents ec066ba012c8
children 19d298e6f7e5
comparison
equal deleted inserted replaced
9549:ed34b1da0e26 9550:3d6a9aea2aea
302 ComplexMatrix::operator == (const ComplexMatrix& a) const 302 ComplexMatrix::operator == (const ComplexMatrix& a) const
303 { 303 {
304 if (rows () != a.rows () || cols () != a.cols ()) 304 if (rows () != a.rows () || cols () != a.cols ())
305 return false; 305 return false;
306 306
307 return mx_inline_equal (data (), a.data (), length ()); 307 return mx_inline_equal (length (), data (), a.data ());
308 } 308 }
309 309
310 bool 310 bool
311 ComplexMatrix::operator != (const ComplexMatrix& a) const 311 ComplexMatrix::operator != (const ComplexMatrix& a) const
312 { 312 {
3023 if (nr == 0 || nc == 0) 3023 if (nr == 0 || nc == 0)
3024 return *this; 3024 return *this;
3025 3025
3026 Complex *d = fortran_vec (); // Ensures only one reference to my privates! 3026 Complex *d = fortran_vec (); // Ensures only one reference to my privates!
3027 3027
3028 mx_inline_add2 (d, a.data (), length ()); 3028 mx_inline_add2 (length (), d, a.data ());
3029 return *this; 3029 return *this;
3030 } 3030 }
3031 3031
3032 ComplexMatrix& 3032 ComplexMatrix&
3033 ComplexMatrix::operator -= (const Matrix& a) 3033 ComplexMatrix::operator -= (const Matrix& a)
3047 if (nr == 0 || nc == 0) 3047 if (nr == 0 || nc == 0)
3048 return *this; 3048 return *this;
3049 3049
3050 Complex *d = fortran_vec (); // Ensures only one reference to my privates! 3050 Complex *d = fortran_vec (); // Ensures only one reference to my privates!
3051 3051
3052 mx_inline_subtract2 (d, a.data (), length ()); 3052 mx_inline_sub2 (length (), d, a.data ());
3053 return *this; 3053 return *this;
3054 } 3054 }
3055 3055
3056 // unary operations 3056 // unary operations
3057 3057
4073 4073
4074 return result; 4074 return result;
4075 } 4075 }
4076 4076
4077 MS_CMP_OPS(ComplexMatrix, std::real, Complex, std::real) 4077 MS_CMP_OPS(ComplexMatrix, std::real, Complex, std::real)
4078 MS_BOOL_OPS(ComplexMatrix, Complex, 0.0) 4078 MS_BOOL_OPS (ComplexMatrix, Complex)
4079 4079
4080 SM_CMP_OPS(Complex, std::real, ComplexMatrix, std::real) 4080 SM_CMP_OPS(Complex, std::real, ComplexMatrix, std::real)
4081 SM_BOOL_OPS(Complex, ComplexMatrix, 0.0) 4081 SM_BOOL_OPS (Complex, ComplexMatrix)
4082 4082
4083 MM_CMP_OPS(ComplexMatrix, std::real, ComplexMatrix, std::real) 4083 MM_CMP_OPS(ComplexMatrix, std::real, ComplexMatrix, std::real)
4084 MM_BOOL_OPS(ComplexMatrix, ComplexMatrix, 0.0) 4084 MM_BOOL_OPS (ComplexMatrix, ComplexMatrix)
4085 4085
4086 /* 4086 /*
4087 ;;; Local Variables: *** 4087 ;;; Local Variables: ***
4088 ;;; mode: C++ *** 4088 ;;; mode: C++ ***
4089 ;;; End: *** 4089 ;;; End: ***