6 #ifndef MYRAMATH_SPARSE_SPARSEMATRIX_H 7 #define MYRAMATH_SPARSE_SPARSEMATRIX_H 14 #include <myramath/utility/detail/LIBPUBLIC.h> 28 template<
int Arity,
class Number>
class Expression;
29 template<
class Number>
class Matrix;
30 template<
class Number>
class MatrixRange;
31 template<
class Number>
class SparseMatrix;
35 template<
class T>
class Array1;
36 template<
class T>
class Array2;
42 class permute_wrapper;
43 class horzcat_wrapper;
44 class vertcat_wrapper;
45 class bothcat_wrapper;
46 class diagcat_wrapper;
47 class transpose_wrapper;
48 class multiply_wrapper;
77 #ifdef MYRAMATH_ENABLE_CPP11 104 std::pair<int,int> size()
const;
107 int n_nonzeros()
const;
110 int n_nonzeros(
int j)
const;
113 bool test(
int i,
int j)
const;
119 std::vector<int> pattern(
int j)
const;
148 const Number* pointer(
int i,
int j)
const;
150 Number* pointer(
int i,
int j) ;
154 const Number& operator() (
int i,
int j)
const;
156 Number& operator() (
int i,
int j) ;
160 const Number& at(
int i,
int j)
const;
162 Number& at(
int i,
int j) ;
210 CPair split_top(
int i)
const;
212 Pair split_top(
int i) ;
228 CPair split_bottom(
int i)
const;
230 Pair split_bottom(
int i) ;
266 CPair split_left(
int j)
const;
268 Pair split_left(
int j) ;
284 CPair split_right(
int j)
const;
286 Pair split_right(
int j) ;
299 template<
class Functor>
void transform(
const Functor& f)
300 { this->range().transform(f); }
305 { this->range().transform_triangle(f,uplo); }
310 { this->range().transform_diagonal(f); }
316 void operator *= (Number alpha);
319 void operator /= (Number alpha);
351 static SparseMatrix<Number> swap(
int I,
int J, std::vector<int>& Ao, std::vector<int>& Ai, std::vector<Number>& Av);
363 void debug(std::ostream& out)
const;
368 int offset(
int i,
int j)
const;
381 std::vector<Number> Av;
397 {
public:
typedef Number type; };
Container of values, allows random (i,j) access.
Definition: Array2.h:30
Number random()
Generate random real/complex Numbers, uniformly distributed over [-1,1].
Reflects Number trait for a Container, containers of Numbers (Matrix's, Vector's, etc) should special...
Definition: Number.h:55
Represents a mutable SparseMatrixRange.
Definition: conjugate.h:21
Definition: bothcat.cpp:20
std::pair< CSparseMatrixRange< Number >, CSparseMatrixRange< Number > > CPair
Useful typedefs.
Definition: SparseMatrix.h:59
void transform_triangle(const Functor &f, char uplo)
Overwrites every A(i,j) in the 'U'pper or 'L'ower triangle of this SparseMatrix with f(A(i...
Definition: SparseMatrix.h:304
Tabulates an IxJ matrix. Allows random access, has column major layout to be compatible with BLAS/LAP...
Definition: bdsqr.h:20
Definition: multiply.cpp:22
void transform(const Functor &f)
Overwrites every A(i,j) in this SparseMatrix with f(A(i,j)).
Definition: SparseMatrix.h:299
An iterator over a SparseMatrixRange.
Definition: SparseMatrixRange.h:33
Represents an immutable view of a Pattern.
Definition: PatternRange.h:31
Definition: random.cpp:45
Abstraction layer, serializable objects write themselves to these.
Definition: Streams.h:39
Various utility functions/classes related to scalar Number types.
Represents a mutable MatrixRange.
Definition: conjugate.h:26
Definition: diagcat.cpp:20
void transform_diagonal(const Functor &f)
Overwrites every A(ij,ij) on the diagonal of this SparseMatrix with f(A(ij,ij)).
Definition: SparseMatrix.h:309
Represents a const SparseMatrixRange.
Definition: bothcat.h:24
Holds the nonzero pattern of a sparse matrix.
Definition: Pattern.h:55
Like SparseMatrix, but easier to populate via random access (i,j) operator.
Definition: SparseMatrix.h:32
Container of values, allows random (i) access.
Definition: Array1.h:32
An iterator over a CSparseMatrixRange.
Definition: SparseMatrixRange.h:32
Expression< 1, NumberC > make_complex(const Expression< 1, NumberS > &A)
Promotes a real Expression into a complex one.
Definition: functions_complex.cpp:122
Given an index (i,j,etc), returns a value.
Definition: arithmetic.h:19
Definition: horzcat.cpp:20
Stores an IxJ matrix A in compressed sparse column format.
Definition: bothcat.h:23
Definition: permute.cpp:29
Definition: vertcat.cpp:20
Represents a const intRange.
Definition: intRange.h:142
Range/Iterator types associated with SparseMatrix.
Definition: transpose.cpp:23
float NumberS
Useful typedefs.
Definition: Number.h:21