comparison liboctave/fCMatrix.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
301 FloatComplexMatrix::operator == (const FloatComplexMatrix& a) const 301 FloatComplexMatrix::operator == (const FloatComplexMatrix& a) const
302 { 302 {
303 if (rows () != a.rows () || cols () != a.cols ()) 303 if (rows () != a.rows () || cols () != a.cols ())
304 return false; 304 return false;
305 305
306 return mx_inline_equal (data (), a.data (), length ()); 306 return mx_inline_equal (length (), data (), a.data ());
307 } 307 }
308 308
309 bool 309 bool
310 FloatComplexMatrix::operator != (const FloatComplexMatrix& a) const 310 FloatComplexMatrix::operator != (const FloatComplexMatrix& a) const
311 { 311 {
3016 if (nr == 0 || nc == 0) 3016 if (nr == 0 || nc == 0)
3017 return *this; 3017 return *this;
3018 3018
3019 FloatComplex *d = fortran_vec (); // Ensures only one reference to my privates! 3019 FloatComplex *d = fortran_vec (); // Ensures only one reference to my privates!
3020 3020
3021 mx_inline_add2 (d, a.data (), length ()); 3021 mx_inline_add2 (length (), d, a.data ());
3022 return *this; 3022 return *this;
3023 } 3023 }
3024 3024
3025 FloatComplexMatrix& 3025 FloatComplexMatrix&
3026 FloatComplexMatrix::operator -= (const FloatMatrix& a) 3026 FloatComplexMatrix::operator -= (const FloatMatrix& a)
3040 if (nr == 0 || nc == 0) 3040 if (nr == 0 || nc == 0)
3041 return *this; 3041 return *this;
3042 3042
3043 FloatComplex *d = fortran_vec (); // Ensures only one reference to my privates! 3043 FloatComplex *d = fortran_vec (); // Ensures only one reference to my privates!
3044 3044
3045 mx_inline_subtract2 (d, a.data (), length ()); 3045 mx_inline_sub2 (length (), d, a.data ());
3046 return *this; 3046 return *this;
3047 } 3047 }
3048 3048
3049 // unary operations 3049 // unary operations
3050 3050
4066 4066
4067 return result; 4067 return result;
4068 } 4068 }
4069 4069
4070 MS_CMP_OPS(FloatComplexMatrix, std::real, FloatComplex, std::real) 4070 MS_CMP_OPS(FloatComplexMatrix, std::real, FloatComplex, std::real)
4071 MS_BOOL_OPS(FloatComplexMatrix, FloatComplex, static_cast<float> (0.0)) 4071 MS_BOOL_OPS (FloatComplexMatrix, FloatComplex)
4072 4072
4073 SM_CMP_OPS(FloatComplex, std::real, FloatComplexMatrix, std::real) 4073 SM_CMP_OPS(FloatComplex, std::real, FloatComplexMatrix, std::real)
4074 SM_BOOL_OPS(FloatComplex, FloatComplexMatrix, static_cast<float> (0.0)) 4074 SM_BOOL_OPS (FloatComplex, FloatComplexMatrix)
4075 4075
4076 MM_CMP_OPS(FloatComplexMatrix, std::real, FloatComplexMatrix, std::real) 4076 MM_CMP_OPS(FloatComplexMatrix, std::real, FloatComplexMatrix, std::real)
4077 MM_BOOL_OPS(FloatComplexMatrix, FloatComplexMatrix, static_cast<float> (0.0)) 4077 MM_BOOL_OPS (FloatComplexMatrix, FloatComplexMatrix)
4078 4078
4079 /* 4079 /*
4080 ;;; Local Variables: *** 4080 ;;; Local Variables: ***
4081 ;;; mode: C++ *** 4081 ;;; mode: C++ ***
4082 ;;; End: *** 4082 ;;; End: ***