comparison liboctave/array/MSparse.cc @ 21139:538b57866b90

consistently use "typename" intead of "class" in template declarations * Object.h, QtHandlesUtils.cc, QtHandlesUtils.h, ToolBarButton.cc, ToolBarButton.h, Cell.h, __lin_interpn__.cc, bitfcns.cc, bsxfun.cc, cellfun.cc, data.cc, filter.cc, gcd.cc, graphics.cc, help.cc, kron.cc, lookup.cc, ls-mat5.cc, ls-oct-text.h, lu.cc, max.cc, mgorth.cc, oct-map.cc, oct-map.h, oct-stream.cc, oct-stream.h, octave-link.h, pr-output.cc, profiler.h, schur.cc, sparse-xdiv.cc, sparse-xpow.cc, sqrtm.cc, symtab.h, tril.cc, typecast.cc, variables.cc, xdiv.cc, zfstream.h, __init_fltk__.cc, __magick_read__.cc, chol.cc, qr.cc, ov-base-diag.cc, ov-base-diag.h, ov-base-int.cc, ov-base-int.h, ov-base-mat.cc, ov-base-mat.h, ov-base-scalar.cc, ov-base-scalar.h, ov-base-sparse.cc, ov-base-sparse.h, ov-base.h, ov-classdef.cc, ov-int-traits.h, ov-java.h, ov-usr-fcn.h, ov.cc, ov.h, op-dms-template.cc, oct-parse.in.yy, parse.h, pt-mat.cc, Array-b.cc, Array.cc, Array.h, CDiagMatrix.h, CMatrix.h, CNDArray.h, DiagArray2.cc, DiagArray2.h, MArray.cc, MArray.h, MDiagArray2.cc, MDiagArray2.h, MSparse.cc, MSparse.h, MatrixType.cc, Sparse.cc, Sparse.h, dDiagMatrix.h, dMatrix.h, dNDArray.h, fCDiagMatrix.h, fCMatrix.h, fCNDArray.h, fDiagMatrix.h, fMatrix.h, fNDArray.h, idx-vector.cc, idx-vector.h, intNDArray.cc, intNDArray.h, DET.h, base-aepbal.h, base-lu.cc, base-lu.h, base-qr.cc, base-qr.h, bsxfun-defs.cc, eigs-base.cc, lo-mappers.h, lo-specfun.cc, lo-specfun.h, oct-convn.cc, oct-fftw.cc, oct-norm.cc, sparse-base-chol.cc, sparse-base-chol.h, sparse-base-lu.cc, sparse-base-lu.h, sparse-dmsolve.cc, mx-inlines.cc, action-container.h, base-list.h, lo-traits.h, lo-utils.h, oct-base64.h, oct-binmap.h, oct-cmplx.h, oct-inttypes.cc, oct-inttypes.h, oct-locbuf.h, oct-refcount.h, oct-sort.cc, oct-sort.h: Use "typename" instead of "class" in template declarations.
author John W. Eaton <jwe@octave.org>
date Sun, 24 Jan 2016 13:50:04 -0500
parents 499b851fbfae
children 6c2fd62db1f7
comparison
equal deleted inserted replaced
21138:e2fca7d79169 21139:538b57866b90
23 23
24 // sparse array with math ops. 24 // sparse array with math ops.
25 25
26 // Element by element MSparse by MSparse ops. 26 // Element by element MSparse by MSparse ops.
27 27
28 template <class T, class OP> 28 template <typename T, typename OP>
29 MSparse<T>& 29 MSparse<T>&
30 plus_or_minus (MSparse<T>& a, const MSparse<T>& b, OP op, const char* op_name) 30 plus_or_minus (MSparse<T>& a, const MSparse<T>& b, OP op, const char* op_name)
31 { 31 {
32 MSparse<T> r; 32 MSparse<T> r;
33 33
110 } 110 }
111 111
112 112
113 // Element by element MSparse by scalar ops. 113 // Element by element MSparse by scalar ops.
114 114
115 template <class T, class OP> 115 template <typename T, typename OP>
116 MArray<T> 116 MArray<T>
117 plus_or_minus (const MSparse<T>& a, const T& s, OP op) 117 plus_or_minus (const MSparse<T>& a, const T& s, OP op)
118 { 118 {
119 octave_idx_type nr = a.rows (); 119 octave_idx_type nr = a.rows ();
120 octave_idx_type nc = a.cols (); 120 octave_idx_type nc = a.cols ();
140 { 140 {
141 return plus_or_minus (a, s, std::minus<T> ()); 141 return plus_or_minus (a, s, std::minus<T> ());
142 } 142 }
143 143
144 144
145 template <class T, class OP> 145 template <typename T, typename OP>
146 MSparse<T> 146 MSparse<T>
147 times_or_divide (const MSparse<T>& a, const T& s, OP op) 147 times_or_divide (const MSparse<T>& a, const T& s, OP op)
148 { 148 {
149 octave_idx_type nr = a.rows (); 149 octave_idx_type nr = a.rows ();
150 octave_idx_type nc = a.cols (); 150 octave_idx_type nc = a.cols ();
178 } 178 }
179 179
180 180
181 // Element by element scalar by MSparse ops. 181 // Element by element scalar by MSparse ops.
182 182
183 template <class T, class OP> 183 template <typename T, typename OP>
184 MArray<T> 184 MArray<T>
185 plus_or_minus (const T& s, const MSparse<T>& a, OP op) 185 plus_or_minus (const T& s, const MSparse<T>& a, OP op)
186 { 186 {
187 octave_idx_type nr = a.rows (); 187 octave_idx_type nr = a.rows ();
188 octave_idx_type nc = a.cols (); 188 octave_idx_type nc = a.cols ();
207 operator - (const T& s, const MSparse<T>& a) 207 operator - (const T& s, const MSparse<T>& a)
208 { 208 {
209 return plus_or_minus (s, a, std::minus<T> ()); 209 return plus_or_minus (s, a, std::minus<T> ());
210 } 210 }
211 211
212 template <class T, class OP> 212 template <typename T, typename OP>
213 MSparse<T> 213 MSparse<T>
214 times_or_divides (const T& s, const MSparse<T>& a, OP op) 214 times_or_divides (const T& s, const MSparse<T>& a, OP op)
215 { 215 {
216 octave_idx_type nr = a.rows (); 216 octave_idx_type nr = a.rows ();
217 octave_idx_type nc = a.cols (); 217 octave_idx_type nc = a.cols ();
228 r.cidx (i) = a.cidx (i); 228 r.cidx (i) = a.cidx (i);
229 r.maybe_compress (true); 229 r.maybe_compress (true);
230 return r; 230 return r;
231 } 231 }
232 232
233 template <class T> 233 template <typename T>
234 MSparse<T> 234 MSparse<T>
235 operator * (const T& s, const MSparse<T>& a) 235 operator * (const T& s, const MSparse<T>& a)
236 { 236 {
237 return times_or_divides (s, a, std::multiplies<T> ()); 237 return times_or_divides (s, a, std::multiplies<T> ());
238 } 238 }
239 239
240 template <class T> 240 template <typename T>
241 MSparse<T> 241 MSparse<T>
242 operator / (const T& s, const MSparse<T>& a) 242 operator / (const T& s, const MSparse<T>& a)
243 { 243 {
244 return times_or_divides (s, a, std::divides<T> ()); 244 return times_or_divides (s, a, std::divides<T> ());
245 } 245 }
246 246
247 247
248 // Element by element MSparse by MSparse ops. 248 // Element by element MSparse by MSparse ops.
249 249
250 template <class T, class OP> 250 template <typename T, typename OP>
251 MSparse<T> 251 MSparse<T>
252 plus_or_minus (const MSparse<T>& a, const MSparse<T>& b, OP op, 252 plus_or_minus (const MSparse<T>& a, const MSparse<T>& b, OP op,
253 const char* op_name, bool negate) 253 const char* op_name, bool negate)
254 { 254 {
255 MSparse<T> r; 255 MSparse<T> r;
364 } 364 }
365 365
366 return r; 366 return r;
367 } 367 }
368 368
369 template <class T> 369 template <typename T>
370 MSparse<T> 370 MSparse<T>
371 operator+ (const MSparse<T>& a, const MSparse<T>& b) 371 operator+ (const MSparse<T>& a, const MSparse<T>& b)
372 { 372 {
373 return plus_or_minus (a, b, std::plus<T> (), "operator +", false); 373 return plus_or_minus (a, b, std::plus<T> (), "operator +", false);
374 } 374 }
375 375
376 template <class T> 376 template <typename T>
377 MSparse<T> 377 MSparse<T>
378 operator- (const MSparse<T>& a, const MSparse<T>& b) 378 operator- (const MSparse<T>& a, const MSparse<T>& b)
379 { 379 {
380 return plus_or_minus (a, b, std::minus<T> (), "operator -", true); 380 return plus_or_minus (a, b, std::minus<T> (), "operator -", true);
381 } 381 }
382 382
383 template <class T> 383 template <typename T>
384 MSparse<T> 384 MSparse<T>
385 product (const MSparse<T>& a, const MSparse<T>& b) 385 product (const MSparse<T>& a, const MSparse<T>& b)
386 { 386 {
387 MSparse<T> r; 387 MSparse<T> r;
388 388
475 } 475 }
476 476
477 return r; 477 return r;
478 } 478 }
479 479
480 template <class T> 480 template <typename T>
481 MSparse<T> 481 MSparse<T>
482 quotient (const MSparse<T>& a, const MSparse<T>& b) 482 quotient (const MSparse<T>& a, const MSparse<T>& b)
483 { 483 {
484 MSparse<T> r; 484 MSparse<T> r;
485 T Zero = T (); 485 T Zero = T ();
593 593
594 594
595 595
596 // Unary MSparse ops. 596 // Unary MSparse ops.
597 597
598 template <class T> 598 template <typename T>
599 MSparse<T> 599 MSparse<T>
600 operator + (const MSparse<T>& a) 600 operator + (const MSparse<T>& a)
601 { 601 {
602 return a; 602 return a;
603 } 603 }
604 604
605 template <class T> 605 template <typename T>
606 MSparse<T> 606 MSparse<T>
607 operator - (const MSparse<T>& a) 607 operator - (const MSparse<T>& a)
608 { 608 {
609 MSparse<T> retval (a); 609 MSparse<T> retval (a);
610 octave_idx_type nz = a.nnz (); 610 octave_idx_type nz = a.nnz ();