Navigation

Operators and Keywords

Function List:

C++ API

MSparse.cc File Reference

#include "quit.h"
#include "lo-error.h"
#include "MArray.h"
#include "Array-util.h"
#include "MSparse.h"
#include "MSparse-defs.h"
Include dependency graph for MSparse.cc:
This graph shows which files directly or indirectly include this file:

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 Documentation

#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> \
  MArray<T> \
  operator OP (const MSparse<T>& a, const T& s) \
  { \
    octave_idx_type nr = a.rows (); \
    octave_idx_type nc = a.cols (); \
 \
    MArray<T> r (dim_vector (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> \
  MArray<T> \
  operator OP (const T& s, const MSparse<T>& a) \
  { \
    octave_idx_type nr = a.rows (); \
    octave_idx_type nc = a.cols (); \
 \
    MArray<T> r (dim_vector (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; \
  }

Function Documentation

template<class T >
MSparse<T> operator+ ( const MSparse< T > &  a  ) 
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-= ( MSparse< T > &  a,
const MSparse< T > &  b 
)
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines