Mercurial > hg > octave-lyh
diff liboctave/MArray-defs.h @ 3504:5eef8a2294bd
[project @ 2000-02-01 10:06:51 by jwe]
author | jwe |
---|---|
date | Tue, 01 Feb 2000 10:07:26 +0000 |
parents | dd00769643ae |
children | 6ae6f1180e62 |
line wrap: on
line diff
--- a/liboctave/MArray-defs.h +++ b/liboctave/MArray-defs.h @@ -2,48 +2,32 @@ // have been nice to do this with template functions but as of 2.5.x, // g++ seems to fail to resolve them properly. -#define DO_VS_OP(OP) \ - int l = a.length (); \ - T *result = 0; \ +#define DO_VS_OP(r, l, v, OP, s) \ if (l > 0) \ { \ - result = new T [l]; \ - const T *x = a.data (); \ for (int i = 0; i < l; i++) \ - result[i] = x[i] OP s; \ + r[i] = v[i] OP s; \ } -#define DO_SV_OP(OP) \ - int l = a.length (); \ - T *result = 0; \ +#define DO_SV_OP(r, l, s, OP, v) \ if (l > 0) \ { \ - result = new T [l]; \ - const T *x = a.data (); \ for (int i = 0; i < l; i++) \ - result[i] = s OP x[i]; \ + r[i] = s OP v[i]; \ } -#define DO_VV_OP(OP) \ - T *result = 0; \ +#define DO_VV_OP(r, l, x, OP, y) \ if (l > 0) \ { \ - result = new T [l]; \ - const T *x = a.data (); \ - const T *y = b.data (); \ for (int i = 0; i < l; i++) \ - result[i] = x[i] OP y[i]; \ + r[i] = x[i] OP y[i]; \ } -#define NEG_V \ - int l = a.length (); \ - T *result = 0; \ +#define NEG_V(r, l, x) \ if (l > 0) \ { \ - result = new T [l]; \ - const T *x = a.data (); \ for (int i = 0; i < l; i++) \ - result[i] = -x[i]; \ + r[i] = -x[i]; \ } #define DO_VS_OP2(OP) \