imate
C++/CUDA Reference
c_linear_operator.cpp
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 // =======
13 // Headers
14 // =======
15 
16 #include "./c_linear_operator.h"
17 #include <cstddef> // NULL
18 
19 
20 // =============
21 // constructor 1
22 // =============
23 
26 
27 template <typename DataType>
29  num_rows(0),
30  num_columns(0),
31  eigenvalue_relation_known(0),
32  parameters(NULL),
33  num_parameters(0)
34 {
35 }
36 
37 
38 // =============
39 // constructor 2
40 // =============
41 
48 
49 template <typename DataType>
51  const LongIndexType num_rows_,
52  const LongIndexType num_columns_):
53 
54  // Initializer list
55  num_rows(num_rows_),
56  num_columns(num_columns_),
57  eigenvalue_relation_known(0),
58  parameters(NULL),
59  num_parameters(0)
60 {
61 }
62 
63 
64 // ==========
65 // destructor
66 // ==========
67 
68 template <typename DataType>
70 {
71 }
72 
73 
74 // ============
75 // get num rows
76 // ============
77 
78 template <typename DataType>
80 {
81  return this->num_rows;
82 }
83 
84 
85 // ===============
86 // get num columns
87 // ===============
88 
89 template <typename DataType>
91 {
92  return this->num_columns;
93 }
94 
95 
96 // ==============
97 // set parameters
98 // ==============
99 
106 
107 template <typename DataType>
108 void cLinearOperator<DataType>::set_parameters(DataType* parameters_)
109 {
110  this->parameters = parameters_;
111 }
112 
113 
114 // ==================
115 // get num parameters
116 // ==================
117 
118 template <typename DataType>
120 {
121  return this->num_parameters;
122 }
123 
124 
125 // ============================
126 // is eigenvalue relation known
127 // ============================
128 
134 
135 template <typename DataType>
137 {
138  return this->eigenvalue_relation_known;
139 }
140 
141 
142 // ===============================
143 // Explicit template instantiation
144 // ===============================
145 
146 template class cLinearOperator<float>;
147 template class cLinearOperator<double>;
148 template class cLinearOperator<long double>;
Base class for linear operators. This class serves as interface for all derived classes.
LongIndexType get_num_columns() const
virtual ~cLinearOperator()
cLinearOperator()
Default constructor.
void set_parameters(DataType *parameters_)
Sets the scalar parameter this->parameters. Parameter is initialized to NULL. However,...
LongIndexType get_num_rows() const
FlagType is_eigenvalue_relation_known() const
Returns a flag that determines whether a relation between the parameters of the operator and its eige...
IndexType get_num_parameters() const
int LongIndexType
Definition: types.h:60
int FlagType
Definition: types.h:68
int IndexType
Definition: types.h:65