Mercurial > octave-nkf
comparison liboctave/MArrayN.cc @ 4645:bd2067547b40
[project @ 2003-11-23 08:07:52 by jwe]
author | jwe |
---|---|
date | Sun, 23 Nov 2003 08:07:53 +0000 |
parents | 79df15d4470c |
children | eff8f977508c |
comparison
equal
deleted
inserted
replaced
4644:3b74f1a86750 | 4645:bd2067547b40 |
---|---|
59 template <class T> | 59 template <class T> |
60 MArrayN<T>& | 60 MArrayN<T>& |
61 operator += (MArrayN<T>& a, const MArrayN<T>& b) | 61 operator += (MArrayN<T>& a, const MArrayN<T>& b) |
62 { | 62 { |
63 int l = a.length (); | 63 int l = a.length (); |
64 | |
64 if (l > 0) | 65 if (l > 0) |
65 { | 66 { |
66 int bl = b.length (); | 67 dim_vector a_dims = a.dims (); |
67 if (l != bl) | 68 dim_vector b_dims = b.dims (); |
68 gripe_nonconformant ("operator +=", l, bl); | 69 |
70 if (a_dims != b_dims) | |
71 gripe_nonconformant ("operator +=", a_dims, b_dims); | |
69 else | 72 else |
70 DO_VV_OP2 (+=); | 73 DO_VV_OP2 (+=); |
71 } | 74 } |
75 | |
72 return a; | 76 return a; |
73 } | 77 } |
74 | 78 |
75 template <class T> | 79 template <class T> |
76 MArrayN<T>& | 80 MArrayN<T>& |
77 operator -= (MArrayN<T>& a, const MArrayN<T>& b) | 81 operator -= (MArrayN<T>& a, const MArrayN<T>& b) |
78 { | 82 { |
79 int l = a.length (); | 83 int l = a.length (); |
84 | |
80 if (l > 0) | 85 if (l > 0) |
81 { | 86 { |
82 int bl = b.length (); | 87 dim_vector a_dims = a.dims (); |
83 if (l != bl) | 88 dim_vector b_dims = b.dims (); |
84 gripe_nonconformant ("operator -=", l, bl); | 89 |
90 if (a_dims != b_dims) | |
91 gripe_nonconformant ("operator -=", a_dims, b_dims); | |
85 else | 92 else |
86 DO_VV_OP2 (-=); | 93 DO_VV_OP2 (-=); |
87 } | 94 } |
88 return a; | 95 return a; |
89 } | 96 } |