24 #if ! defined (octave_MSparse_h) 25 #define octave_MSparse_h 1 27 #include "octave-config.h" 62 :
Sparse<T> (
a, r,
c, nr, nc, sum_terms, nzm) { }
111 template <
typename U>
116 template <
typename U>
126 #define SPARSE_OP_ASSIGN_DECL(T, OP, API) \ 127 template API MSparse<T>& \ 128 operator OP (MSparse<T>&, const MSparse<T>&) 131 #define SPARSE_UNOP_DECL(T, OP, API) \ 132 template API MSparse<T> \ 133 operator OP (const MSparse<T>&) 136 #define SPARSE_BINOP_DECL(A_T, T, F, API, X_T, Y_T) \ 137 template API A_T<T> \ 138 F (const X_T&, const Y_T&) 142 #define SPARSE_OP_ASSIGN_FWD_FCN(R, F, T, C_X, X_T, C_Y, Y_T) \ 144 F (X_T& x, const Y_T& y) \ 146 return R (F (C_X (x), C_Y (y))); \ 151 #define SPARSE_UNOP_FWD_FCN(R, F, T, C_X, X_T) \ 155 return R (F (C_X (x))); \ 160 #define SPARSE_BINOP_FWD_FCN(R, F, T, C_X, X_T, C_Y, Y_T) \ 162 F (const X_T& x, const Y_T& y) \ 164 return R (F (C_X (x), C_Y (y))); \ 168 #define INSTANTIATE_SPARSE_FRIENDS(T, API) \ 169 SPARSE_OP_ASSIGN_DECL (T, +=, API); \ 170 SPARSE_OP_ASSIGN_DECL (T, -=, API); \ 171 SPARSE_UNOP_DECL (T, +, API); \ 172 SPARSE_UNOP_DECL (T, -, API); \ 173 SPARSE_BINOP_DECL (MArray, T, operator +, API, MSparse<T>, T); \ 174 SPARSE_BINOP_DECL (MArray, T, operator -, API, MSparse<T>, T); \ 175 SPARSE_BINOP_DECL (MSparse, T, operator *, API, MSparse<T>, T); \ 176 SPARSE_BINOP_DECL (MSparse, T, operator /, API, MSparse<T>, T); \ 177 SPARSE_BINOP_DECL (MArray, T, operator +, API, T, MSparse<T>); \ 178 SPARSE_BINOP_DECL (MArray, T, operator -, API, T, MSparse<T>); \ 179 SPARSE_BINOP_DECL (MSparse, T, operator *, API, T, MSparse<T>); \ 180 SPARSE_BINOP_DECL (MSparse, T, operator /, API, T, MSparse<T>); \ 181 SPARSE_BINOP_DECL (MSparse, T, operator +, API, MSparse<T>, MSparse<T>); \ 182 SPARSE_BINOP_DECL (MSparse, T, operator -, API, MSparse<T>, MSparse<T>); \ 183 SPARSE_BINOP_DECL (MSparse, T, quotient, API, MSparse<T>, MSparse<T>); \ 184 SPARSE_BINOP_DECL (MSparse, T, product, API, MSparse<T>, MSparse<T>); 188 #define SPARSE_FORWARD_DEFS(B, R, F, T) \ 189 SPARSE_OP_ASSIGN_FWD_FCN (R, operator +=, T, dynamic_cast<B<T>&>, \ 190 R, dynamic_cast<const B<T>&>, R) \ 191 SPARSE_OP_ASSIGN_FWD_FCN (R, operator -=, T, dynamic_cast<B<T>&>, \ 192 R, dynamic_cast<const B<T>&>, R) \ 193 SPARSE_UNOP_FWD_FCN (R, operator +, T, dynamic_cast<const B<T>&>, R) \ 194 SPARSE_UNOP_FWD_FCN (R, operator -, T, dynamic_cast<const B<T>&>, R) \ 195 SPARSE_BINOP_FWD_FCN (F, operator +, T, dynamic_cast<const B<T>&>, R, , T) \ 196 SPARSE_BINOP_FWD_FCN (F, operator -, T, dynamic_cast<const B<T>&>, R, , T) \ 197 SPARSE_BINOP_FWD_FCN (R, operator *, T, dynamic_cast<const B<T>&>, R, , T) \ 198 SPARSE_BINOP_FWD_FCN (R, operator /, T, dynamic_cast<const B<T>&>, R, , T) \ 199 SPARSE_BINOP_FWD_FCN (F, operator +, T, , T, dynamic_cast<const B<T>&>, R) \ 200 SPARSE_BINOP_FWD_FCN (F, operator -, T, , T, dynamic_cast<const B<T>&>, R) \ 201 SPARSE_BINOP_FWD_FCN (R, operator *, T, , T, dynamic_cast<const B<T>&>, R) \ 202 SPARSE_BINOP_FWD_FCN (R, operator /, T, , T, dynamic_cast<const B<T>&>, R) \ 203 SPARSE_BINOP_FWD_FCN (R, operator +, T, dynamic_cast<const B<T>&>, \ 204 R, dynamic_cast<const B<T>&>, R) \ 205 SPARSE_BINOP_FWD_FCN (R, operator -, T, dynamic_cast<const B<T>&>, \ 206 R, dynamic_cast<const B<T>&>, R) \ 207 SPARSE_BINOP_FWD_FCN (R, product, T, dynamic_cast<const B<T>&>, \ 208 R, dynamic_cast<const B<T>&>, R) \ 209 SPARSE_BINOP_FWD_FCN (R, quotient, T, dynamic_cast<const B<T>&>, \ 210 R, dynamic_cast<const B<T>&>, R) MSparse(const Array< T > &a, const idx_vector &r, const idx_vector &c, octave_idx_type nr=-1, octave_idx_type nc=-1, bool sum_terms=true, octave_idx_type nzm=-1)
MSparse< T > & insert(const Sparse< T > &a, const Array< octave_idx_type > &indx)
Sparse< T > permute(const Array< octave_idx_type > &vec, bool inv=false) const
MSparse< T > & insert(const Sparse< T > &a, octave_idx_type r, octave_idx_type c)
MSparse(const Sparse< U > &a)
MSparse(const PermMatrix &a)
identity matrix If supplied two scalar respectively For allows like xample val
MSparse(octave_idx_type r, octave_idx_type c, octave_idx_type num_nz)
Sparse< T > diag(octave_idx_type k=0) const
Sparse< T > transpose(void) const
MSparse< U > map(U(&fcn)(const T &)) const
MSparse< T > diag(octave_idx_type k=0) const
nd example oindent opens the file binary numeric values will be read assuming they are stored in IEEE format with the least significant bit and then converted to the native representation Opening a file that is already open simply opens it again and returns a separate file id It is not an error to open a file several though writing to the same file through several different file ids may produce unexpected results The possible values of text mode reading and writing automatically converts linefeeds to the appropriate line end character for the you may append a you must also open the file in binary mode The parameter conversions are currently only supported for and permissions will be set to and then everything is written in a single operation This is very efficient and improves performance c
MSparse< T > reshape(const dim_vector &new_dims) const
calling an anonymous function involves an overhead quite comparable to the overhead of an m file function Passing a handle to a built in function is because the interpreter is not involved in the internal loop For a
MSparse< U > map(U(&fcn)(T)) const
MSparse(const MSparse< T > &a, const dim_vector &dv)
MSparse< T > squeeze(void) const
MSparse(const Sparse< T > &a)
MSparse< T > transpose(void) const
MSparse(const MSparse< T > &a)
MSparse(const dim_vector &dv, octave_idx_type nz=0)
Sparse< T > & operator=(const Sparse< T > &a)
MSparse(octave_idx_type r, octave_idx_type c, T val)
MDiagArray2< T > & operator=(const MDiagArray2< T > &a)
MSparse< T > permute(const Array< octave_idx_type > &vec, bool inv=false) const
N Dimensional Array with copy-on-write semantics.
MSparse(octave_idx_type n, octave_idx_type m)
Sparse< T > squeeze(void) const
Sparse< T > & insert(const Sparse< T > &a, octave_idx_type r, octave_idx_type c)
Sparse< T > reshape(const dim_vector &new_dims) const
Sparse< T > ipermute(const Array< octave_idx_type > &vec) const
MSparse< T > ipermute(const Array< octave_idx_type > &vec) const
Vector representing the dimensions (size) of an Array.