18 #include "../_c_basic_algebra/c_matrix_operations.h"
25 template <
typename DataType>
38 template <
typename DataType>
40 const DataType* A_data_,
51 A_indices(A_indices_),
52 A_index_pointer(A_index_pointer_)
61 template <
typename DataType>
80 template <
typename DataType>
89 for (
LongIndexType column=0; column < this->num_columns; ++column)
91 for (index_pointer=this->A_index_pointer[column];
92 index_pointer < this->A_index_pointer[column+1];
95 row = this->A_indices[index_pointer];
97 if ((row == column) && \
98 (this->A_data[index_pointer] != 1.0))
100 matrix_is_identity = 0;
101 return matrix_is_identity;
103 else if (this->A_data[index_pointer] != 0.0)
105 matrix_is_identity = 0;
106 return matrix_is_identity;
111 return matrix_is_identity;
127 template <
typename DataType>
130 return this->A_index_pointer[this->num_columns];
138 template <
typename DataType>
140 const DataType* vector,
146 this->A_index_pointer,
158 template <
typename DataType>
160 const DataType* vector,
161 const DataType alpha,
167 this->A_index_pointer,
179 template <
typename DataType>
181 const DataType* vector,
187 this->A_index_pointer,
198 template <
typename DataType>
200 const DataType* vector,
201 const DataType alpha,
207 this->A_index_pointer,
LongIndexType get_nnz() const
Returns the number of non-zero elements of the sparse matrix.
virtual void transpose_dot(const DataType *vector, DataType *product)
virtual void dot(const DataType *vector, DataType *product)
virtual FlagType is_identity_matrix() const
Checks whether the matrix is identity.
virtual void dot_plus(const DataType *vector, const DataType alpha, DataType *product)
virtual void transpose_dot_plus(const DataType *vector, const DataType alpha, DataType *product)
Base class for linear operators. This class serves as interface for all derived classes.
static void csc_transposed_matvec_plus(const DataType *A_data, const LongIndexType *A_row_indices, const LongIndexType *A_index_pointer, const DataType *b, const DataType alpha, const LongIndexType num_columns, DataType *c)
Computes where is compressed sparse column (CSC) matrix and is a dense vector. The output is a de...
static void csc_transposed_matvec(const DataType *A_data, const LongIndexType *A_row_indices, const LongIndexType *A_index_pointer, const DataType *b, const LongIndexType num_columns, DataType *c)
Computes where is compressed sparse column (CSC) matrix and is a dense vector. The output is a de...
static void csc_matvec(const DataType *A_data, const LongIndexType *A_row_indices, const LongIndexType *A_index_pointer, const DataType *b, const LongIndexType num_rows, const LongIndexType num_columns, DataType *c)
Computes where is compressed sparse column (CSC) matrix and is a dense vector. The output is a de...
static void csc_matvec_plus(const DataType *A_data, const LongIndexType *A_row_indices, const LongIndexType *A_index_pointer, const DataType *b, const DataType alpha, const LongIndexType num_columns, DataType *c)
Computes where is compressed sparse column (CSC) matrix and is a dense vector. The output is a de...