imate
C++/CUDA Reference
Loading...
Searching...
No Matches
c_csr_matrix.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: Copyright 2021, Siavash Ameli <sameli@berkeley.edu>
3 * SPDX-License-Identifier: BSD-3-Clause
4 * SPDX-FileType: SOURCE
5 *
6 * This program is free software: you can redistribute it and/or modify it
7 * under the terms of the license found in the LICENSE.txt file in the root
8 * directory of this source tree.
9 */
10
11
12#ifndef _C_LINEAR_OPERATOR_C_CSR_MATRIX_H_
13#define _C_LINEAR_OPERATOR_C_CSR_MATRIX_H_
14
15
16// =======
17// Headers
18// =======
19
20#include "../_definitions/types.h" // FlagType, LongIndexType
21#include "./c_matrix.h" // cMatrix
22
23
24// ============
25// c CSR Matrix
26// ============
27
41
42template <typename DataType>
43class cCSRMatrix : public cMatrix<DataType>
44{
45 public:
46
47 // Member methods
48 cCSRMatrix();
49
51 const DataType* A_data_,
52 const LongIndexType* A_indices_,
53 const LongIndexType* A_index_pointer_,
54 const LongIndexType num_rows_,
55 const LongIndexType num_columns_,
57
58 virtual ~cCSRMatrix();
59
60 virtual FlagType is_identity_matrix() const;
61
62 LongIndexType get_nnz() const;
63
64 virtual void dot(
65 const DataType* vector,
66 DataType* product);
67
68 virtual void dot_plus(
69 const DataType* vector,
70 const DataType alpha,
71 DataType* product);
72
73 virtual void transpose_dot(
74 const DataType* vector,
75 DataType* product);
76
77 virtual void transpose_dot_plus(
78 const DataType* vector,
79 const DataType alpha,
80 DataType* product);
81
82 protected:
83
84 // Member data
85 const DataType* A_data;
88};
89
90#endif // _C_LINEAR_OPERATOR_C_CSR_MATRIX_H_
Container for CSR matrices.
virtual void transpose_dot_plus(const DataType *vector, const DataType alpha, DataType *product)
Transposed-matrix vector product written in place.
const LongIndexType * A_index_pointer
virtual void transpose_dot(const DataType *vector, DataType *product)
Transposed-matrix vector product.
virtual void dot(const DataType *vector, DataType *product)
Matrix vector product.
LongIndexType get_nnz() const
Returns the number of non-zero elements of the sparse matrix.
const DataType * A_data
virtual FlagType is_identity_matrix() const
Checks whether the matrix is identity.
virtual ~cCSRMatrix()
Destructor.
const LongIndexType * A_indices
cCSRMatrix()
Default constructor.
virtual void dot_plus(const DataType *vector, const DataType alpha, DataType *product)
Matrix vector product written in place.
Base class for constant matrices.
Definition c_matrix.h:45
FlagType A_is_symmetric
Definition c_matrix.h:77
int LongIndexType
Definition types.h:60
int FlagType
Definition types.h:68