ccgsl 2.7.2
C++wrappersforGnuScientificLibrary
gsl::spmatrix Class Reference

This class handles sparse matrix objects as shared handles. More...

#include <spmatrix.hpp>

Collaboration diagram for gsl::spmatrix:
Collaboration graph

Public Types

enum  {
  COO = GSL_SPMATRIX_COO , CSC = GSL_SPMATRIX_CSC , CSR = GSL_SPMATRIX_CSR , TRIPLET = GSL_SPMATRIX_TRIPLET ,
  CCS = GSL_SPMATRIX_CCS , CRS = GSL_SPMATRIX_CRS
}
 Reference to GSL_SPMATRIX constants. More...
 

Public Member Functions

 spmatrix ()
 The default constructor is only really useful for assigning to. More...
 
 spmatrix (size_t const n1, size_t const n2)
 This constructor creates a new matrix with n1 rows and n2 columns. More...
 
 spmatrix (size_t const n1, size_t const n2, size_t nzmax, size_t sptype)
 This constructor creates a new matrix with n1 rows and n2 columns. More...
 
 spmatrix (gsl_spmatrix *v)
 Could construct from a gsl_spmatrix. More...
 
 spmatrix (std::initializer_list< std::initializer_list< double > > initializer_list)
 Could construct from a std::initializer_list in C++11 and later. More...
 
 spmatrix (spmatrix const &v)
 The copy constructor. More...
 
spmatrixoperator= (spmatrix const &v)
 The assignment operator. More...
 
spmatrix clone () const
 The clone function. More...
 
 ~spmatrix ()
 The destructor only deletes the pointers if count reaches zero. More...
 
void wrap_gsl_spmatrix_without_ownership (gsl_spmatrix *v)
 This function is intended mainly for internal use. More...
 
void reset ()
 Stop sharing ownership of the shared pointer. More...
 
 spmatrix (spmatrix &&v)
 Move constructor. More...
 
spmatrixoperator= (spmatrix &&v)
 Move operator. More...
 
size_t size1 () const
 The number of rows of the matrix. More...
 
size_t size2 () const
 The number of columns of the matrix. More...
 
size_t nzmax () const
 The maximum number of nonzero elements. More...
 
int sptype () const
 The type of the spmatrix. More...
 
double * data ()
 Give access to the data block. More...
 
double const * data () const
 Give access to the data block. More...
 
void swap (spmatrix &m)
 Swap two spmatrix objects. More...
 
int realloc (size_t const nzmax)
 C++ version of gsl_spmatrix_realloc(). More...
 
size_t nnz () const
 C++ version of gsl_spmatrix_nnz(). More...
 
char const * type () const
 C++ version of gsl_spmatrix_type(). More...
 
int set_zero ()
 C++ version of gsl_spmatrix_set_zero(). More...
 
int tree_rebuild ()
 C++ version of gsl_spmatrix_tree_rebuild(). More...
 
spmatrix csc () const
 C++ version of gsl_spmatrix_csc(). More...
 
spmatrix csr () const
 C++ version of gsl_spmatrix_csr(). More...
 
spmatrix compress (int const sptype) const
 C++ version of gsl_spmatrix_compress(). More...
 
spmatrix compcol () const
 C++ version of gsl_spmatrix_compcol(). More...
 
spmatrix ccs () const
 C++ version of gsl_spmatrix_ccs(). More...
 
spmatrix crs () const
 C++ version of gsl_spmatrix_crs(). More...
 
int memcpy (spmatrix &dest) const
 C++ version of gsl_spmatrix_memcpy(). More...
 
int fprintf (FILE *stream, char const *format) const
 C++ version of gsl_spmatrix_fprintf(). More...
 
int fwrite (FILE *stream) const
 C++ version of gsl_spmatrix_fwrite(). More...
 
int fread (FILE *stream)
 C++ version of gsl_spmatrix_fread(). More...
 
double get (size_t const i, size_t const j) const
 C++ version of gsl_spmatrix_get(). More...
 
int set (size_t const i, size_t const j, double const x)
 C++ version of gsl_spmatrix_set(). More...
 
double * ptr (size_t const i, size_t const j) const
 C++ version of gsl_spmatrix_ptr(). More...
 
int minmax (double &min_out, double &max_out) const
 C++ version of gsl_spmatrix_minmax(). More...
 
int min_index (size_t &imin_out, size_t &jmin_out) const
 C++ version of gsl_spmatrix_min_index(). More...
 
int scale (double const x)
 C++ version of gsl_spmatrix_scale(). More...
 
int scale_columns (gsl::vector const &x)
 C++ version of gsl_spmatrix_scale_columns(). More...
 
int scale_rows (gsl::vector const &x)
 C++ version of gsl_spmatrix_scale_rows(). More...
 
int equal (spmatrix const &b) const
 C++ version of gsl_spmatrix_equal(). More...
 
int transpose ()
 C++ version of gsl_spmatrix_transpose(). More...
 
int transpose2 ()
 C++ version of gsl_spmatrix_transpose2(). More...
 
gsl_spmatrix * get ()
 Get the gsl_spmatrix. More...
 
gsl_spmatrix const * get () const
 Get the gsl_spmatrix. More...
 
bool unique () const
 Find if this is the only object sharing the gsl_spmatrix. More...
 
size_t use_count () const
 Find how many spmatrix objects share this pointer. More...
 
 operator bool () const
 Allow conversion to bool. More...
 

Static Public Member Functions

static int realloc (size_t const nzmax, gsl::spmatrix &spMatrix)
 C++ version of gsl_spmatrix_realloc(): matches a function in gsl that is intended for internal use. More...
 
static size_t nnz (spmatrix const &spMatrix)
 C++ version of gsl_spmatrix_nnz(). More...
 
static char const * type (spmatrix const &spMatrix)
 C++ version of gsl_spmatrix_type(). More...
 
static int set_zero (spmatrix &spMatrix)
 C++ version of gsl_spmatrix_set_zero(). More...
 
static int tree_rebuild (spmatrix &spMatrix)
 C++ version of gsl_spmatrix_tree_rebuild(). More...
 
static spmatrix csc (spmatrix const &spMatrix)
 C++ version of gsl_spmatrix_csc(). More...
 
static spmatrix csr (spmatrix const &spMatrix)
 C++ version of gsl_spmatrix_csr(). More...
 
static spmatrix compress (spmatrix const &spMatrix, int const sptype)
 C++ version of gsl_spmatrix_compress(). More...
 
static spmatrix compcol (spmatrix const &spMatrix)
 C++ version of gsl_spmatrix_compcol(). More...
 
static spmatrix ccs (spmatrix const &spMatrix)
 C++ version of gsl_spmatrix_ccs(). More...
 
static spmatrix crs (spmatrix const &spMatrix)
 C++ version of gsl_spmatrix_crs(). More...
 
static int memcpy (spmatrix &dest, spmatrix const &src)
 C++ version of gsl_spmatrix_memcpy(). More...
 
static int fprintf (FILE *stream, spmatrix const &spMatrix, char const *format)
 C++ version of gsl_spmatrix_fprintf(). More...
 
static spmatrix fscanf (FILE *stream)
 C++ version of gsl_spmatrix_fscanf(). More...
 
static int fwrite (FILE *stream, spmatrix &spMatrix)
 C++ version of gsl_spmatrix_fwrite(). More...
 
static int fread (FILE *stream, spmatrix &spMatrix)
 C++ version of gsl_spmatrix_fread(). More...
 
static int add (spmatrix &c, spmatrix const &a, spmatrix const &b)
 C++ version of gsl_spmatrix_add(). More...
 
static spmatrix add (spmatrix const &a, spmatrix const &b)
 C++ version of gsl_spmatrix_add(). More...
 
static int add_to_dense (gsl::matrix &a, spmatrix const &b)
 C++ version of gsl_spmatrix_add_to_dense(). More...
 
static int dense_add (gsl::matrix &a, spmatrix const &b)
 C++ version of gsl_spmatrix_dense_add(). More...
 
static int dense_sub (gsl::matrix &a, spmatrix const &b)
 C++ version of gsl_spmatrix_dense_sub(). More...
 
static double norm1 (gsl::spmatrix const &a)
 C++ version of gsl_spmatrix_norm1(). More...
 
static int d2sp (gsl::spmatrix &S, gsl::matrix const &A)
 C++ version of gsl_spmatrix_d2sp(). More...
 
static int sp2d (gsl::matrix &A, spmatrix const &S)
 C++ version of gsl_spmatrix_sp2d(). More...
 
static int equal (spmatrix const &a, spmatrix const &b)
 C++ version of gsl_spmatrix_equal(). More...
 
static int transpose (spmatrix &a)
 C++ version of gsl_spmatrix_transpose(). More...
 
static int transpose2 (spmatrix &a)
 C++ version of gsl_spmatrix_transpose2(). More...
 
static int transpose_memcpy (spmatrix &dest, spmatrix const &src)
 C++ version of gsl_spmatrix_transpose_memcpy(). More...
 

Private Attributes

gsl_spmatrix * ccgsl_pointer
 The shared pointer. More...
 
size_t * count
 The shared reference count. More...
 

Detailed Description

This class handles sparse matrix objects as shared handles.

It models a random access container so that STL functions work with matrix.

Definition at line 38 of file spmatrix.hpp.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Reference to GSL_SPMATRIX constants.

Enumerator
COO 

GSL_SPMATRIX_COO.

CSC 

GSL_SPMATRIX_CSC.

CSR 

GSL_SPMATRIX_CSR.

TRIPLET 

GSL_SPMATRIX_TRIPLET.

CCS 

GSL_SPMATRIX_CCS.

CRS 

GSL_SPMATRIX_CRS.

Definition at line 43 of file spmatrix.hpp.

Constructor & Destructor Documentation

◆ spmatrix() [1/7]

gsl::spmatrix::spmatrix ( )
inline

The default constructor is only really useful for assigning to.

Definition at line 60 of file spmatrix.hpp.

References ccgsl_pointer, and count.

Referenced by operator=(), and reset().

◆ spmatrix() [2/7]

gsl::spmatrix::spmatrix ( size_t const  n1,
size_t const  n2 
)
inlineexplicit

This constructor creates a new matrix with n1 rows and n2 columns.

Parameters
n1The number of rows in the matrix
n2The number of columns in the matrix

Definition at line 71 of file spmatrix.hpp.

References ccgsl_pointer, and count.

◆ spmatrix() [3/7]

gsl::spmatrix::spmatrix ( size_t const  n1,
size_t const  n2,
size_t  nzmax,
size_t  sptype 
)
inlineexplicit

This constructor creates a new matrix with n1 rows and n2 columns.

Parameters
n1The number of rows in the matrix
n2The number of columns in the matrix
nzmaxThe maximum number of nonzero elements that will be added to the matrix
sptypeThe storage format of the sparse matrix: one of gsl::spmatrix::COO, gsl::spmatrix::CSC or gsl::spmatrix::CSR

Definition at line 92 of file spmatrix.hpp.

References ccgsl_pointer, count, nzmax(), and sptype().

◆ spmatrix() [4/7]

gsl::spmatrix::spmatrix ( gsl_spmatrix *  v)
inlineexplicit

Could construct from a gsl_spmatrix.

This is not usually a good idea. In this case you should not use gsl_spmatrix_free() to deallocate the memory.

Parameters
vThe matrix

Definition at line 111 of file spmatrix.hpp.

References ccgsl_pointer, and count.

◆ spmatrix() [5/7]

gsl::spmatrix::spmatrix ( std::initializer_list< std::initializer_list< double > >  initializer_list)
inline

Could construct from a std::initializer_list in C++11 and later.

Parameters
initializer_listThe initializer_list.

Definition at line 122 of file spmatrix.hpp.

References ccgsl_pointer, count, gsl::exception::GSL_EBADLEN, and set().

◆ spmatrix() [6/7]

gsl::spmatrix::spmatrix ( spmatrix const &  v)
inline

The copy constructor.

This shares the matrix. Use clone() if you want a full copy.

Parameters
vThe spmatrix to copy.

Definition at line 155 of file spmatrix.hpp.

References count.

◆ ~spmatrix()

gsl::spmatrix::~spmatrix ( )
inline

The destructor only deletes the pointers if count reaches zero.

Definition at line 194 of file spmatrix.hpp.

References ccgsl_pointer, and count.

◆ spmatrix() [7/7]

gsl::spmatrix::spmatrix ( spmatrix &&  v)
inline

Move constructor.

Parameters
vThe spmatrix to move.

Definition at line 234 of file spmatrix.hpp.

References count.

Member Function Documentation

◆ add() [1/2]

static int gsl::spmatrix::add ( spmatrix c,
spmatrix const &  a,
spmatrix const &  b 
)
inlinestatic

C++ version of gsl_spmatrix_add().

Parameters
cAn spmatrix object
aAn spmatrix object
bAn spmatrix object
Returns
Error code on failure

Definition at line 613 of file spmatrix.hpp.

References gsl::sf::mathieu::a(), gsl::sf::mathieu::b(), and get().

◆ add() [2/2]

static spmatrix gsl::spmatrix::add ( spmatrix const &  a,
spmatrix const &  b 
)
inlinestatic

C++ version of gsl_spmatrix_add().

Parameters
aAn spmatrix object
bAn spmatrix object
Returns
The sum of a and b

Definition at line 621 of file spmatrix.hpp.

References gsl::sf::mathieu::a(), and gsl::sf::mathieu::b().

◆ add_to_dense()

static int gsl::spmatrix::add_to_dense ( gsl::matrix a,
spmatrix const &  b 
)
inlinestatic

C++ version of gsl_spmatrix_add_to_dense().

Parameters
aA gsl::matrix (return value is sum)
bA gsl::spmatrix
Returns
Error code on failure

Definition at line 633 of file spmatrix.hpp.

References gsl::sf::mathieu::a(), and gsl::sf::mathieu::b().

◆ ccs() [1/2]

spmatrix gsl::spmatrix::ccs ( ) const
inline

C++ version of gsl_spmatrix_ccs().

Returns
A compressed matrix

Definition at line 358 of file spmatrix.hpp.

References get().

◆ ccs() [2/2]

static spmatrix gsl::spmatrix::ccs ( spmatrix const &  spMatrix)
inlinestatic

C++ version of gsl_spmatrix_ccs().

Parameters
spMatrixAn spmatrix object
Returns
A compressed matrix

Definition at line 555 of file spmatrix.hpp.

References get().

◆ clone()

spmatrix gsl::spmatrix::clone ( ) const
inline

The clone function.

Use this if you want a copy of the spmatrix that does not share the underlying data.

Returns
a new copy of this.

Definition at line 183 of file spmatrix.hpp.

References get(), size1(), and size2().

◆ compcol() [1/2]

spmatrix gsl::spmatrix::compcol ( ) const
inline

C++ version of gsl_spmatrix_compcol().

Returns
A compressed matrix

Definition at line 351 of file spmatrix.hpp.

References get().

◆ compcol() [2/2]

static spmatrix gsl::spmatrix::compcol ( spmatrix const &  spMatrix)
inlinestatic

C++ version of gsl_spmatrix_compcol().

Parameters
spMatrixAn spmatrix object
Returns
A compressed matrix

Definition at line 547 of file spmatrix.hpp.

References get().

◆ compress() [1/2]

spmatrix gsl::spmatrix::compress ( int const  sptype) const
inline

C++ version of gsl_spmatrix_compress().

Parameters
sptypeOne of gsl::spmatrix::COO, gsl::spmatrix::CSC or gsl::spmatrix::CSR
Returns
The compressed matrix

Definition at line 344 of file spmatrix.hpp.

References get(), and sptype().

◆ compress() [2/2]

static spmatrix gsl::spmatrix::compress ( spmatrix const &  spMatrix,
int const  sptype 
)
inlinestatic

C++ version of gsl_spmatrix_compress().

Parameters
spMatrixAn spmatrix object
sptypeOne of gsl::spmatrix::COO, gsl::spmatrix::CSC or gsl::spmatrix::CSR
Returns
The compressed matrix

Definition at line 539 of file spmatrix.hpp.

References get(), and sptype().

◆ crs() [1/2]

spmatrix gsl::spmatrix::crs ( ) const
inline

C++ version of gsl_spmatrix_crs().

Returns
A compressed matrix

Definition at line 365 of file spmatrix.hpp.

References get().

◆ crs() [2/2]

static spmatrix gsl::spmatrix::crs ( spmatrix const &  spMatrix)
inlinestatic

C++ version of gsl_spmatrix_crs().

Parameters
spMatrixAn spmatrix object
Returns
A compressed matrix

Definition at line 563 of file spmatrix.hpp.

References get().

◆ csc() [1/2]

spmatrix gsl::spmatrix::csc ( ) const
inline

C++ version of gsl_spmatrix_csc().

Returns
a sparse matrix in compressed sparse column format from this which must be in COO format

Definition at line 324 of file spmatrix.hpp.

References get(), size1(), and size2().

◆ csc() [2/2]

static spmatrix gsl::spmatrix::csc ( spmatrix const &  spMatrix)
inlinestatic

C++ version of gsl_spmatrix_csc().

Sets dest to a sparse matrix in compressed sparse column format from the input sparse matrix src, which must be in COO format

Parameters
spMatrixAn spmatrix object
Returns
Error code on failure

Definition at line 519 of file spmatrix.hpp.

References get(), size1(), and size2().

◆ csr() [1/2]

spmatrix gsl::spmatrix::csr ( ) const
inline

C++ version of gsl_spmatrix_csr().

Returns
a sparse matrix in compressed sparse row format from this which must be in COO format

Definition at line 334 of file spmatrix.hpp.

References get(), size1(), and size2().

◆ csr() [2/2]

static spmatrix gsl::spmatrix::csr ( spmatrix const &  spMatrix)
inlinestatic

C++ version of gsl_spmatrix_csr().

Sets dest to a sparse matrix in compressed sparse row format from the input sparse matrix src, which must be in COO format

Parameters
spMatrixAn spmatrix object
Returns
Error code on failure

Definition at line 529 of file spmatrix.hpp.

References get(), size1(), and size2().

◆ d2sp()

static int gsl::spmatrix::d2sp ( gsl::spmatrix S,
gsl::matrix const &  A 
)
inlinestatic

C++ version of gsl_spmatrix_d2sp().

Parameters
SA gsl::spmatrix (return value)
AA gsl::matrix
Returns
Error code on failure

Definition at line 665 of file spmatrix.hpp.

References gsl::matrix::get(), and get().

◆ data() [1/2]

double * gsl::spmatrix::data ( )
inline

Give access to the data block.

Returns
The data block.

Definition at line 274 of file spmatrix.hpp.

References ccgsl_pointer.

◆ data() [2/2]

double const * gsl::spmatrix::data ( ) const
inline

Give access to the data block.

Returns
The data block.

Definition at line 281 of file spmatrix.hpp.

References ccgsl_pointer.

◆ dense_add()

static int gsl::spmatrix::dense_add ( gsl::matrix a,
spmatrix const &  b 
)
inlinestatic

C++ version of gsl_spmatrix_dense_add().

Parameters
aA gsl::matrix (return value is sum)
bA gsl::spmatrix
Returns
Error code on failure

Definition at line 642 of file spmatrix.hpp.

References gsl::sf::mathieu::a(), and gsl::sf::mathieu::b().

◆ dense_sub()

static int gsl::spmatrix::dense_sub ( gsl::matrix a,
spmatrix const &  b 
)
inlinestatic

C++ version of gsl_spmatrix_dense_sub().

Parameters
aA gsl::matrix (return value is difference)
bA gsl::spmatrix
Returns
Error code on failure

Definition at line 650 of file spmatrix.hpp.

References gsl::sf::mathieu::a(), and gsl::sf::mathieu::b().

◆ equal() [1/2]

static int gsl::spmatrix::equal ( spmatrix const &  a,
spmatrix const &  b 
)
inlinestatic

C++ version of gsl_spmatrix_equal().

Parameters
aAn spmatrix
bAn spmatrix
Returns
1 or 0 according as a and b are equal or not

Definition at line 681 of file spmatrix.hpp.

References gsl::sf::mathieu::a(), and gsl::sf::mathieu::b().

◆ equal() [2/2]

int gsl::spmatrix::equal ( spmatrix const &  b) const
inline

C++ version of gsl_spmatrix_equal().

Parameters
bAn spmatrix
Returns
1 or 0 according as a and b are equal or not

Definition at line 464 of file spmatrix.hpp.

References gsl::sf::mathieu::b(), and get().

◆ fprintf() [1/2]

int gsl::spmatrix::fprintf ( FILE *  stream,
char const *  format 
) const
inline

C++ version of gsl_spmatrix_fprintf().

Parameters
streamA file stream
formatOne of the g, e or f formats for floating point numbers
Returns
Error code on failure

Definition at line 380 of file spmatrix.hpp.

References get().

◆ fprintf() [2/2]

static int gsl::spmatrix::fprintf ( FILE *  stream,
spmatrix const &  spMatrix,
char const *  format 
)
inlinestatic

C++ version of gsl_spmatrix_fprintf().

Parameters
streamA file stream
spMatrixAn spmatrix object
formatOne of the g, e or f formats for floating point numbers
Returns
Error code on failure

Definition at line 581 of file spmatrix.hpp.

References get().

◆ fread() [1/2]

int gsl::spmatrix::fread ( FILE *  stream)
inline

C++ version of gsl_spmatrix_fread().

Parameters
streamA file stream
Returns
Error code on failure

Definition at line 394 of file spmatrix.hpp.

References get().

◆ fread() [2/2]

static int gsl::spmatrix::fread ( FILE *  stream,
spmatrix spMatrix 
)
inlinestatic

C++ version of gsl_spmatrix_fread().

Parameters
streamA file stream
spMatrixAn spmatrix object
Returns
Error code on failure

Definition at line 604 of file spmatrix.hpp.

References get().

◆ fscanf()

static spmatrix gsl::spmatrix::fscanf ( FILE *  stream)
inlinestatic

C++ version of gsl_spmatrix_fscanf().

Parameters
streamA file stream
Returns
The spMatrix read from a file stream

Definition at line 588 of file spmatrix.hpp.

◆ fwrite() [1/2]

int gsl::spmatrix::fwrite ( FILE *  stream) const
inline

C++ version of gsl_spmatrix_fwrite().

Parameters
streamA file stream
Returns
Error code on failure

Definition at line 387 of file spmatrix.hpp.

References get().

◆ fwrite() [2/2]

static int gsl::spmatrix::fwrite ( FILE *  stream,
spmatrix spMatrix 
)
inlinestatic

C++ version of gsl_spmatrix_fwrite().

Parameters
streamA file stream
spMatrixAn spmatrix object
Returns
Error code on failure

Definition at line 596 of file spmatrix.hpp.

References get().

◆ get() [1/3]

gsl_spmatrix * gsl::spmatrix::get ( )
inline

◆ get() [2/3]

gsl_spmatrix const * gsl::spmatrix::get ( ) const
inline

Get the gsl_spmatrix.

Returns
the gsl_spmatrix

Definition at line 723 of file spmatrix.hpp.

References ccgsl_pointer.

◆ get() [3/3]

double gsl::spmatrix::get ( size_t const  i,
size_t const  j 
) const
inline

C++ version of gsl_spmatrix_get().

Parameters
iRow index
jColumn index
Returns
Value in sparse matrix

Definition at line 402 of file spmatrix.hpp.

References get().

Referenced by add(), ccs(), clone(), compcol(), compress(), crs(), csc(), csr(), d2sp(), gsl::spblas::dgemm(), gsl::spblas::dgemv(), fprintf(), fread(), fwrite(), gsl::splinalg::itersolve::itersolve_iterate(), memcpy(), nnz(), realloc(), set_zero(), sp2d(), transpose_memcpy(), tree_rebuild(), and type().

◆ memcpy() [1/2]

int gsl::spmatrix::memcpy ( spmatrix dest) const
inline

C++ version of gsl_spmatrix_memcpy().

Parameters
destThe destination spmatrix
Returns
Error code on failure

Definition at line 373 of file spmatrix.hpp.

References get().

◆ memcpy() [2/2]

static int gsl::spmatrix::memcpy ( spmatrix dest,
spmatrix const &  src 
)
inlinestatic

C++ version of gsl_spmatrix_memcpy().

Parameters
destThe destination spmatrix
srcThe source spmatrix
Returns
Error code on failure

Definition at line 572 of file spmatrix.hpp.

References get().

◆ min_index()

int gsl::spmatrix::min_index ( size_t &  imin_out,
size_t &  jmin_out 
) const
inline

C++ version of gsl_spmatrix_min_index().

Parameters
imin_outThe row index of the minimum nonzero element (by reference)
jmin_outThe column index of the minimum nonzero element (by reference)
Returns
Error code on failure

Definition at line 436 of file spmatrix.hpp.

References get().

◆ minmax()

int gsl::spmatrix::minmax ( double &  min_out,
double &  max_out 
) const
inline

C++ version of gsl_spmatrix_minmax().

Parameters
min_outThe minimum element (by reference)
max_outThe maximum element (by reference)
Returns
Error code on failure

Definition at line 428 of file spmatrix.hpp.

References get().

◆ nnz() [1/2]

size_t gsl::spmatrix::nnz ( ) const
inline

C++ version of gsl_spmatrix_nnz().

Returns
The number of nonzero elements of this

Definition at line 303 of file spmatrix.hpp.

References get().

◆ nnz() [2/2]

static size_t gsl::spmatrix::nnz ( spmatrix const &  spMatrix)
inlinestatic

C++ version of gsl_spmatrix_nnz().

Parameters
spMatrixAn spmatrix object
Returns
The number of nonzero elements of spMatrix

Definition at line 490 of file spmatrix.hpp.

References get().

◆ norm1()

static double gsl::spmatrix::norm1 ( gsl::spmatrix const &  a)
inlinestatic

C++ version of gsl_spmatrix_norm1().

Parameters
aA gsl::spmatrix
Returns
The 1-norm

Definition at line 657 of file spmatrix.hpp.

References gsl::sf::mathieu::a().

◆ nzmax()

size_t gsl::spmatrix::nzmax ( ) const
inline

The maximum number of nonzero elements.

Returns
the maximum number of nonzero elements

Definition at line 264 of file spmatrix.hpp.

References ccgsl_pointer.

Referenced by realloc(), and spmatrix().

◆ operator bool()

gsl::spmatrix::operator bool ( ) const
inlineexplicit

Allow conversion to bool.

Returns
true or false according as this contains a pointer to a gsl_spmatrix

Definition at line 743 of file spmatrix.hpp.

References ccgsl_pointer.

◆ operator=() [1/2]

spmatrix & gsl::spmatrix::operator= ( spmatrix &&  v)
inline

Move operator.

Parameters
vThe spmatrix to move.
Returns
A reference to this.

Definition at line 243 of file spmatrix.hpp.

References spmatrix().

◆ operator=() [2/2]

spmatrix & gsl::spmatrix::operator= ( spmatrix const &  v)
inline

The assignment operator.

This makes a shared copy.

Parameters
vThe matrix to copy

Definition at line 163 of file spmatrix.hpp.

References ccgsl_pointer, and count.

◆ ptr()

double * gsl::spmatrix::ptr ( size_t const  i,
size_t const  j 
) const
inline

C++ version of gsl_spmatrix_ptr().

Parameters
iRow index
jColumn index
Returns
Error code on failure

Definition at line 419 of file spmatrix.hpp.

References get().

◆ realloc() [1/2]

int gsl::spmatrix::realloc ( size_t const  nzmax)
inline

C++ version of gsl_spmatrix_realloc().

This is not usually used.

Parameters
nzmaxThe maximum number of nonzero elements
Returns
Error code on failure

Definition at line 298 of file spmatrix.hpp.

References get(), and nzmax().

◆ realloc() [2/2]

static int gsl::spmatrix::realloc ( size_t const  nzmax,
gsl::spmatrix spMatrix 
)
inlinestatic

C++ version of gsl_spmatrix_realloc(): matches a function in gsl that is intended for internal use.

Parameters
nzmaxThe maximum number of nonzero elements
spMatrixAn spmatrix object
Returns
Error code on failure

Definition at line 483 of file spmatrix.hpp.

References get(), and nzmax().

◆ reset()

void gsl::spmatrix::reset ( )
inline

Stop sharing ownership of the shared pointer.

Definition at line 228 of file spmatrix.hpp.

References spmatrix().

◆ scale()

int gsl::spmatrix::scale ( double const  x)
inline

C++ version of gsl_spmatrix_scale().

Parameters
xA scaling factor
Returns
Error code on failure

Definition at line 444 of file spmatrix.hpp.

References get().

◆ scale_columns()

int gsl::spmatrix::scale_columns ( gsl::vector const &  x)
inline

C++ version of gsl_spmatrix_scale_columns().

Parameters
xA scaling gsl::vector
Returns
Error code on failure

Definition at line 450 of file spmatrix.hpp.

References get(), and gsl::vector::get().

◆ scale_rows()

int gsl::spmatrix::scale_rows ( gsl::vector const &  x)
inline

C++ version of gsl_spmatrix_scale_rows().

Parameters
xA scaling gsl::vector
Returns
Error code on failure

Definition at line 457 of file spmatrix.hpp.

References get(), and gsl::vector::get().

◆ set()

int gsl::spmatrix::set ( size_t const  i,
size_t const  j,
double const  x 
)
inline

C++ version of gsl_spmatrix_set().

Parameters
iRow index
jColumn value
xNew matrix entry
Returns
Error code on failure

Definition at line 411 of file spmatrix.hpp.

References get().

Referenced by spmatrix().

◆ set_zero() [1/2]

int gsl::spmatrix::set_zero ( )
inline

C++ version of gsl_spmatrix_set_zero().

Reinitialise spmatrix to zeros.

Returns
Error code on failure

Definition at line 313 of file spmatrix.hpp.

References get().

◆ set_zero() [2/2]

static int gsl::spmatrix::set_zero ( spmatrix spMatrix)
inlinestatic

C++ version of gsl_spmatrix_set_zero().

Reinitialise spmatrix to zeros.

Parameters
spMatrixAn spmatrix object
Returns
Error code on failure

Definition at line 504 of file spmatrix.hpp.

References get().

◆ size1()

size_t gsl::spmatrix::size1 ( ) const
inline

The number of rows of the matrix.

Returns
The number of rows of the matrix

Definition at line 254 of file spmatrix.hpp.

References ccgsl_pointer.

Referenced by clone(), csc(), and csr().

◆ size2()

size_t gsl::spmatrix::size2 ( ) const
inline

The number of columns of the matrix.

Returns
The number of columns of the matrix

Definition at line 259 of file spmatrix.hpp.

References ccgsl_pointer.

Referenced by clone(), csc(), and csr().

◆ sp2d()

static int gsl::spmatrix::sp2d ( gsl::matrix A,
spmatrix const &  S 
)
inlinestatic

C++ version of gsl_spmatrix_sp2d().

Parameters
AA gsl::matrix (return value)
SA gsl::spmatrix
Returns
Error code on failure

Definition at line 673 of file spmatrix.hpp.

References gsl::matrix::get(), and get().

◆ sptype()

int gsl::spmatrix::sptype ( ) const
inline

The type of the spmatrix.

Returns
the type of the spmatrix

Definition at line 269 of file spmatrix.hpp.

References ccgsl_pointer.

Referenced by compress(), and spmatrix().

◆ swap()

void gsl::spmatrix::swap ( spmatrix m)
inline

Swap two spmatrix objects.

This works even if the spmatrix objects have different sizes because it swaps pointers.

Parameters
mThe spmatrix to swap with this.

Definition at line 289 of file spmatrix.hpp.

References ccgsl_pointer, and count.

◆ transpose() [1/2]

int gsl::spmatrix::transpose ( )
inline

C++ version of gsl_spmatrix_transpose().

Returns
Error code on failure

Definition at line 469 of file spmatrix.hpp.

References get().

◆ transpose() [2/2]

static int gsl::spmatrix::transpose ( spmatrix a)
inlinestatic

C++ version of gsl_spmatrix_transpose().

Parameters
aAn spmatrix
Returns
Error code on failure

Definition at line 688 of file spmatrix.hpp.

References gsl::sf::mathieu::a().

◆ transpose2() [1/2]

int gsl::spmatrix::transpose2 ( )
inline

C++ version of gsl_spmatrix_transpose2().

Returns
Error code on failure

Definition at line 474 of file spmatrix.hpp.

References get().

◆ transpose2() [2/2]

static int gsl::spmatrix::transpose2 ( spmatrix a)
inlinestatic

C++ version of gsl_spmatrix_transpose2().

Parameters
aAn spmatrix
Returns
Error code on failure

Definition at line 694 of file spmatrix.hpp.

References gsl::sf::mathieu::a().

◆ transpose_memcpy()

static int gsl::spmatrix::transpose_memcpy ( spmatrix dest,
spmatrix const &  src 
)
inlinestatic

C++ version of gsl_spmatrix_transpose_memcpy().

Parameters
destAn spmatrix (return)
srcAn spmatrix
Returns
Error code on failure

Definition at line 701 of file spmatrix.hpp.

References get().

◆ tree_rebuild() [1/2]

int gsl::spmatrix::tree_rebuild ( )
inline

C++ version of gsl_spmatrix_tree_rebuild().

Returns
Error code on failure

Definition at line 318 of file spmatrix.hpp.

References get().

◆ tree_rebuild() [2/2]

static int gsl::spmatrix::tree_rebuild ( spmatrix spMatrix)
inlinestatic

C++ version of gsl_spmatrix_tree_rebuild().

Parameters
spMatrixAn spmatrix object
Returns
Error code on failure

Definition at line 511 of file spmatrix.hpp.

References get().

◆ type() [1/2]

char const * gsl::spmatrix::type ( ) const
inline

C++ version of gsl_spmatrix_type().

Returns
A string describing the sparse matrix storage format

Definition at line 308 of file spmatrix.hpp.

References get().

◆ type() [2/2]

static char const * gsl::spmatrix::type ( spmatrix const &  spMatrix)
inlinestatic

C++ version of gsl_spmatrix_type().

Parameters
spMatrixAn spmatrix object
Returns
A string describing the sparse matrix storage format

Definition at line 497 of file spmatrix.hpp.

References get().

◆ unique()

bool gsl::spmatrix::unique ( ) const
inline

Find if this is the only object sharing the gsl_spmatrix.

Returns
true or falses according as this is the only spmatrix object sharing the gsl_spmatrix

Definition at line 729 of file spmatrix.hpp.

References count.

◆ use_count()

size_t gsl::spmatrix::use_count ( ) const
inline

Find how many spmatrix objects share this pointer.

Returns
the number of spmatrix objects that share this pointer

Definition at line 734 of file spmatrix.hpp.

References count.

◆ wrap_gsl_spmatrix_without_ownership()

void gsl::spmatrix::wrap_gsl_spmatrix_without_ownership ( gsl_spmatrix *  v)
inline

This function is intended mainly for internal use.

It allows this to point to a gsl_spmatrix without the possibility deleting it when this is no longer in scope. It is the responsibility of the programmer to delete v. The function is used internally for converting a function that takes a gsl::spmatrix* argument to one that takes a gsl_spmatrix* argument.

Parameters
vThe gsl_spmatrix

Definition at line 213 of file spmatrix.hpp.

References ccgsl_pointer, and count.

Member Data Documentation

◆ ccgsl_pointer

gsl_spmatrix* gsl::spmatrix::ccgsl_pointer
private

◆ count

size_t* gsl::spmatrix::count
private

The shared reference count.

Definition at line 711 of file spmatrix.hpp.

Referenced by operator=(), spmatrix(), swap(), unique(), use_count(), wrap_gsl_spmatrix_without_ownership(), and ~spmatrix().


The documentation for this class was generated from the following file: