22 #ifndef fixed_symmetric_matrix_h
23 #define fixed_symmetric_matrix_h
51 typedef AT AtomicType;
63 Matrix(
Init ini=INIT,
const AT &a=0) { init(a); }
64 Matrix(
Eye ini,
const AT &a=1) { init(ini,a); }
66 Matrix(
int m,
int n,
Init ini,
const AT &a=0) { init(a); }
67 Matrix(
int m,
int n,
Eye ini,
const AT &a=1) { init(ini,a); }
76 #ifndef FMATVEC_NO_SIZE_CHECK
77 assert(A.size() == M);
83 template<
class Type,
class Row,
class Col>
86 #ifndef FMATVEC_NO_SIZE_CHECK
87 assert(A.
rows() == M);
88 assert(A.
cols() == M);
98 throw std::runtime_error(
"A fixed symmetric matrix cannot be resized.");
118 #ifndef FMATVEC_NO_BOUNDS_CHECK
133 #ifndef FMATVEC_NO_BOUNDS_CHECK
143 AT& ei(
int i,
int j) {
147 const AT& ei(
int i,
int j)
const {
151 AT& ej(
int i,
int j) {
155 const AT& ej(
int i,
int j)
const {
159 AT& e(
int i,
int j) {
160 return j > i ? ej(i,j) : ei(i,j);
163 const AT& e(
int i,
int j)
const {
164 return j > i ? ej(i,j) : ei(i,j);
212 return CblasColMajor;
235 inline Matrix<Symmetric,Fixed<M>,Fixed<M>,AT>& init(Eye,
const AT &a=1);
236 inline Matrix<Symmetric,Fixed<M>,Fixed<M>,AT>& init(Noinit,
const AT &a=0) {
return *
this; }
242 inline operator std::vector<std::vector<AT> >();
245 template <
int M,
class AT>
248 for(
int i=0; i<M; i++)
249 for(
int j=i; j<M; j++)
255 template <
int M,
class AT>
258 for(
int i=0; i<size(); i++) {
260 for(
int j=i+1; j<size(); j++) {
267 template <
int M,
class AT>
269 std::vector<std::vector<AT> > ret(rows());
270 for(
int r=0; r<rows(); r++) {
271 ret[r].resize(cols());
272 for(
int c=0; c<cols(); c++)
273 ret[r][c]=
operator()(r,c);
280 template <
int M,
class AT>
template <
class Type,
class Row,
class Col>
282 for(
int i=0; i<M; i++)
283 for(
int j=i; j<M; j++)
287 template <
int M,
class AT>
template <
class Row>
288 inline void Matrix<Symmetric,Fixed<M>,Fixed<M>,AT>::deepCopy(
const Matrix<Symmetric,Row,Row,AT> &A) {
289 for(
int i=0; i<M; i++)
290 for(
int j=i; j<M; j++)
void resize(int n, int m)
Definition: fixed_symmetric_matrix.h:96
This is the basic matrix class for arbitrary matrices.
Definition: fmatvec.h:41
Shape class for symmetric matrices.
Definition: types.h:116
int rows() const
Number of rows.
Definition: fixed_symmetric_matrix.h:190
const CBLAS_UPLO blasUplo() const
Symmetry convention.
Definition: fixed_symmetric_matrix.h:222
int rows() const
Number of rows.
const AT * operator()() const
Pointer operator.
Definition: fixed_symmetric_matrix.h:178
const AT & operator()(int i, int j) const
Element operator.
Definition: fixed_symmetric_matrix.h:132
int cols() const
Number of columns.
const CBLAS_ORDER blasOrder() const
Storage convention.
Definition: fixed_symmetric_matrix.h:211
int ldim() const
Leading dimension.
Definition: fixed_symmetric_matrix.h:202
AT * operator()()
Pointer operator.
Definition: fixed_symmetric_matrix.h:172
int cols() const
Number of columns.
Definition: fixed_symmetric_matrix.h:196
Basic shape class for matrices.
Definition: types.h:100
int size() const
Size.
Definition: fixed_symmetric_matrix.h:184
AT & operator()(int i, int j)
Element operator.
Definition: fixed_symmetric_matrix.h:117