comparison liboctave/array/Sparse.h @ 19415:af41e41ad28e

replace oct-mem.h inline indirections by standard function calls. * Array.h: replaced copy_or_memcpy, fill_or_memset, and no_ctor_new * Array.cc: replaced copy_or_memcpy, and fill_or_memset * idx-vector.h: replaced copy_or_memcpy, and fill_or_memset * idx-vector.cc: replaced copy_or_memcpy * boolSparse.cc: replaced copy_or_memcpy, and fill_or_memset * Sparse.h: replaced copy_or_memcpy * Sparse.cc: replaced copy_or_memcpy, and fill_or_memset * oct-binmap.h: replaced copy_or_memcpy * mx-inlines.cc: new standard header dependency * module.mk: removed header entry * oct-mem.h: removed unused header
author Kai T. Ohlhus <k.ohlhus@gmail.com>
date Fri, 05 Dec 2014 13:08:36 +0100
parents 9ac2357f19bc
children 4197fc428c7d
comparison
equal deleted inserted replaced
19414:5db5619fe54e 19415:af41e41ad28e
36 #include "dim-vector.h" 36 #include "dim-vector.h"
37 #include "lo-error.h" 37 #include "lo-error.h"
38 #include "lo-utils.h" 38 #include "lo-utils.h"
39 39
40 #include "oct-sort.h" 40 #include "oct-sort.h"
41 #include "oct-mem.h"
42 41
43 class idx_vector; 42 class idx_vector;
44 class PermMatrix; 43 class PermMatrix;
45 44
46 // Two dimensional sparse class. Handles the reference counting for 45 // Two dimensional sparse class. Handles the reference counting for
100 : d (new T [a.nzmx]), r (new octave_idx_type [a.nzmx]), 99 : d (new T [a.nzmx]), r (new octave_idx_type [a.nzmx]),
101 c (new octave_idx_type [a.ncols + 1]), 100 c (new octave_idx_type [a.ncols + 1]),
102 nzmx (a.nzmx), nrows (a.nrows), ncols (a.ncols), count (1) 101 nzmx (a.nzmx), nrows (a.nrows), ncols (a.ncols), count (1)
103 { 102 {
104 octave_idx_type nz = a.nnz (); 103 octave_idx_type nz = a.nnz ();
105 copy_or_memcpy (nz, a.d, d); 104 std::copy (a.d, a.d + nz, d);
106 copy_or_memcpy (nz, a.r, r); 105 std::copy (a.r, a.r + nz, r);
107 copy_or_memcpy (ncols + 1, a.c, c); 106 std::copy (a.c, a.c + ncols + 1, c);
108 } 107 }
109 108
110 ~SparseRep (void) { delete [] d; delete [] r; delete [] c; } 109 ~SparseRep (void) { delete [] d; delete [] r; delete [] c; }
111 110
112 octave_idx_type length (void) const { return nzmx; } 111 octave_idx_type length (void) const { return nzmx; }
211 a.rep->nzmx)), 210 a.rep->nzmx)),
212 dimensions (a.dimensions) 211 dimensions (a.dimensions)
213 { 212 {
214 octave_idx_type nz = a.nnz (); 213 octave_idx_type nz = a.nnz ();
215 std::copy (a.rep->d, a.rep->d + nz, rep->d); 214 std::copy (a.rep->d, a.rep->d + nz, rep->d);
216 copy_or_memcpy (nz, a.rep->r, rep->r); 215 std::copy (a.rep->r, a.rep->r + nz, rep->r);
217 copy_or_memcpy (rep->ncols + 1, a.rep->c, rep->c); 216 std::copy (a.rep->c, a.rep->c + rep->ncols + 1, rep->c);
218 } 217 }
219 218
220 // No type conversion case. 219 // No type conversion case.
221 Sparse (const Sparse<T>& a) 220 Sparse (const Sparse<T>& a)
222 : rep (a.rep), dimensions (a.dimensions) 221 : rep (a.rep), dimensions (a.dimensions)