22 #ifndef fixed_symmetric_matrix_h
23 #define fixed_symmetric_matrix_h
62 Matrix(
Init ini=INIT,
const AT &a=0) { init(a); }
63 Matrix(
Eye ini,
const AT &a=1) { init(ini,a); }
65 Matrix(
int m,
int n,
Init ini,
const AT &a=0) { init(a); }
66 Matrix(
int m,
int n,
Eye ini,
const AT &a=1) { init(ini,a); }
75 #ifndef FMATVEC_NO_SIZE_CHECK
76 assert(A.size() == M);
82 template<
class Type,
class Row,
class Col>
85 #ifndef FMATVEC_NO_SIZE_CHECK
86 assert(A.
rows() == M);
87 assert(A.
cols() == M);
105 #ifndef FMATVEC_NO_BOUNDS_CHECK
120 #ifndef FMATVEC_NO_BOUNDS_CHECK
130 AT& ei(
int i,
int j) {
134 const AT& ei(
int i,
int j)
const {
138 AT& ej(
int i,
int j) {
142 const AT& ej(
int i,
int j)
const {
146 AT& e(
int i,
int j) {
147 return j > i ? ej(i,j) : ei(i,j);
150 const AT& e(
int i,
int j)
const {
151 return j > i ? ej(i,j) : ei(i,j);
199 return CblasColMajor;
222 inline Matrix<Symmetric,Fixed<M>,Fixed<M>,AT>& init(Eye,
const AT &a=1);
223 inline Matrix<Symmetric,Fixed<M>,Fixed<M>,AT>& init(Noinit,
const AT &a=0) {
return *
this; }
229 inline operator std::vector<std::vector<AT> >();
232 template <
int M,
class AT>
235 for(
int i=0; i<M; i++)
236 for(
int j=i; j<M; j++)
242 template <
int M,
class AT>
245 for(
int i=0; i<size(); i++) {
247 for(
int j=i+1; j<size(); j++) {
254 template <
int M,
class AT>
256 std::vector<std::vector<AT> > ret(rows());
257 for(
int r=0; r<rows(); r++) {
258 ret[r].resize(cols());
259 for(
int c=0; c<cols(); c++)
260 ret[r][c]=
operator()(r,c);
267 template <
int M,
class AT>
template <
class Type,
class Row,
class Col>
269 for(
int i=0; i<M; i++)
270 for(
int j=i; j<M; j++)
274 template <
int M,
class AT>
template <
class Row>
275 inline void Matrix<Symmetric,Fixed<M>,Fixed<M>,AT>::deepCopy(
const Matrix<Symmetric,Row,Row,AT> &A) {
276 for(
int i=0; i<M; i++)
277 for(
int j=i; j<M; j++)
This is the basic matrix class for arbitrary matrices.
Definition: matrix.h:56
Shape class for symmetric matrices.
Definition: types.h:116
int rows() const
Number of rows.
Definition: fixed_symmetric_matrix.h:177
const CBLAS_UPLO blasUplo() const
Symmetry convention.
Definition: fixed_symmetric_matrix.h:209
int rows() const
Number of rows.
const AT * operator()() const
Pointer operator.
Definition: fixed_symmetric_matrix.h:165
const AT & operator()(int i, int j) const
Element operator.
Definition: fixed_symmetric_matrix.h:119
int cols() const
Number of columns.
const CBLAS_ORDER blasOrder() const
Storage convention.
Definition: fixed_symmetric_matrix.h:198
int ldim() const
Leading dimension.
Definition: fixed_symmetric_matrix.h:189
AT * operator()()
Pointer operator.
Definition: fixed_symmetric_matrix.h:159
int cols() const
Number of columns.
Definition: fixed_symmetric_matrix.h:183
Basic shape class for matrices.
Definition: types.h:100
int size() const
Size.
Definition: fixed_symmetric_matrix.h:171
AT & operator()(int i, int j)
Element operator.
Definition: fixed_symmetric_matrix.h:104