#include "quit.h"
#include "lo-error.h"
#include "MArray2.h"
#include "Array-util.h"
#include "MSparse.h"
#include "MSparse-defs.h"
Defines | |
#define | SPARSE_A2S_OP_1(OP) |
#define | SPARSE_A2S_OP_2(OP) |
#define | SPARSE_SA2_OP_1(OP) |
#define | SPARSE_SA2_OP_2(OP) |
#define | SPARSE_A2A2_OP(OP) |
#define | SPARSE_A2A2_FCN_1(FCN, OP) |
#define | SPARSE_A2A2_FCN_2(FCN, OP) |
Functions | |
template<class T > | |
MSparse< T > & | operator+= (MSparse< T > &a, const MSparse< T > &b) |
template<class T > | |
MSparse< T > & | operator-= (MSparse< T > &a, const MSparse< T > &b) |
template<class T > | |
MSparse< T > | operator+ (const MSparse< T > &a) |
template<class T > | |
MSparse< T > | operator- (const MSparse< T > &a) |
#define SPARSE_A2A2_FCN_1 | ( | FCN, | |||
OP | ) |
#define SPARSE_A2A2_FCN_2 | ( | FCN, | |||
OP | ) |
#define SPARSE_A2A2_OP | ( | OP | ) |
#define SPARSE_A2S_OP_1 | ( | OP | ) |
Value:
template <class T> \ MArray2<T> \ operator OP (const MSparse<T>& a, const T& s) \ { \ octave_idx_type nr = a.rows (); \ octave_idx_type nc = a.cols (); \ \ MArray2<T> r (nr, nc, (0.0 OP s)); \ \ for (octave_idx_type j = 0; j < nc; j++) \ for (octave_idx_type i = a.cidx(j); i < a.cidx(j+1); i++) \ r.elem (a.ridx (i), j) = a.data (i) OP s; \ return r; \ }
#define SPARSE_A2S_OP_2 | ( | OP | ) |
Value:
template <class T> \ MSparse<T> \ operator OP (const MSparse<T>& a, const T& s) \ { \ octave_idx_type nr = a.rows (); \ octave_idx_type nc = a.cols (); \ octave_idx_type nz = a.nnz (); \ \ MSparse<T> r (nr, nc, nz); \ \ for (octave_idx_type i = 0; i < nz; i++) \ { \ r.data(i) = a.data(i) OP s; \ r.ridx(i) = a.ridx(i); \ } \ for (octave_idx_type i = 0; i < nc + 1; i++) \ r.cidx(i) = a.cidx(i); \ r.maybe_compress (true); \ return r; \ }
#define SPARSE_SA2_OP_1 | ( | OP | ) |
Value:
template <class T> \ MArray2<T> \ operator OP (const T& s, const MSparse<T>& a) \ { \ octave_idx_type nr = a.rows (); \ octave_idx_type nc = a.cols (); \ \ MArray2<T> r (nr, nc, (s OP 0.0)); \ \ for (octave_idx_type j = 0; j < nc; j++) \ for (octave_idx_type i = a.cidx(j); i < a.cidx(j+1); i++) \ r.elem (a.ridx (i), j) = s OP a.data (i); \ return r; \ }
#define SPARSE_SA2_OP_2 | ( | OP | ) |
Value:
template <class T> \ MSparse<T> \ operator OP (const T& s, const MSparse<T>& a) \ { \ octave_idx_type nr = a.rows (); \ octave_idx_type nc = a.cols (); \ octave_idx_type nz = a.nnz (); \ \ MSparse<T> r (nr, nc, nz); \ \ for (octave_idx_type i = 0; i < nz; i++) \ { \ r.data(i) = s OP a.data(i); \ r.ridx(i) = a.ridx(i); \ } \ for (octave_idx_type i = 0; i < nc + 1; i++) \ r.cidx(i) = a.cidx(i); \ r.maybe_compress (true); \ return r; \ }