fmatvec  0.0.0
var_general_matrix.h
1/* Copyright (C) 2003-2012 Martin Förg
2
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public
5 * License as published by the Free Software Foundation; either
6 * version 2.1 of the License, or (at your option) any later version.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16 *
17 * Contact:
18 * martin.o.foerg@googlemail.com
19 *
20 */
21
22#ifndef var_general_matrix_h
23#define var_general_matrix_h
24
25#include "types.h"
26#include "range.h"
27#include "indices.h"
28#include <cstdlib>
29#include <stdexcept>
30
31namespace fmatvec {
32
41 template <class AT> class Matrix<General,Var,Var,AT> {
42
43 public:
44 static constexpr bool isVector {false};
45 using value_type = AT;
46 using shape_type = General;
47
49
50 protected:
51
52 int M{0};
53 int N{0};
54
55 AT *ele;
56
57 template <class Type, class Row, class Col> inline Matrix<General,Var,Var,AT>& copy(const Matrix<Type,Row,Col,AT> &A);
58
60
61 public:
62
67 explicit Matrix() : ele(nullptr) { }
68
69// Works with -std=gnu++0x only
70// template<class Ini=All<AT>>
71// Matrix(int m, int n, Ini ini=All<AT>()) : M(m), N(n), ele(new AT[M*N]) {
72// init(ini);
73// }
74
75 explicit Matrix(int m, int n, Noinit) : M(m), N(n), ele(new AT[M*N]) { }
76 explicit Matrix(int m, int n, Init ini=INIT, const AT &a=AT()) : M(m), N(n), ele(new AT[M*N]) { init(a); }
77 explicit Matrix(int m, int n, Eye ini, const AT &a=1) : M(m), N(n), ele(new AT[M*N]) { init(ini,a); }
78
79 // move
80 Matrix(Matrix<General,Var,Var,AT> &&src) noexcept {
81 M=src.M;
82 src.M=0;
83 N=src.N;
84 src.N=0;
85 ele=src.ele;
86 src.ele=nullptr;
87 }
88 Matrix<General,Var,Var,AT>& operator=(Matrix<General,Var,Var,AT> &&src) noexcept {
89 FMATVEC_ASSERT(M == src.rows(), AT);
90 FMATVEC_ASSERT(N == src.cols(), AT);
91 src.M=0;
92 src.N=0;
93 delete[]ele;
94 ele=src.ele;
95 src.ele=nullptr;
96 return *this;
97 }
98
104 Matrix(const Matrix<General,Var,Var,AT> &A) : M(A.M), N(A.N), ele(new AT[M*N]) {
105 copy(A);
106 }
107
113 template<class Row, class Col>
114 Matrix(const Matrix<General,Row,Col,AT> &A) : M(A.rows()), N(A.cols()), ele(new AT[M*N]) {
115 copy(A);
116 }
117
123 template<class Type, class Row, class Col>
124 explicit Matrix(const Matrix<Type,Row,Col,AT> &A) : M(A.rows()), N(A.cols()), ele(new AT[M*N]) {
125 copy(A);
126 }
127
140 Matrix(const std::string &strs);
141 Matrix(const char *strs);
142
146 delete[] ele;
147 }
148
149 using iterator = AT *;
150 using const_iterator = const AT *;
151 iterator begin() { return &ele[0]; }
152 iterator end() { return &ele[M*N]; }
153 const_iterator begin() const { return &ele[0]; }
154 const_iterator end() const { return &ele[M*N]; }
155
156 Matrix<General,Var,Var,AT>& resize(int m, int n, Noinit) {
157 delete[] ele;
158 M = m;
159 N = n;
160 ele = new AT[M*N];
161 return *this;
162 }
163
164 Matrix<General,Var,Var,AT>& resize(int m, int n, Init ini=INIT, const AT &a=AT()) { return resize(m,n,Noinit()).init(a); }
165
166 Matrix<General,Var,Var,AT>& resize(int m, int n, Eye ini, const AT &a=1) { return resize(m,n,Noinit()).init(ini,a); }
167
175 FMATVEC_ASSERT(M == A.rows(), AT);
176 FMATVEC_ASSERT(N == A.cols(), AT);
177 return copy(A);
178 }
179
186 template <class Type, class Row, class Col>
188 FMATVEC_ASSERT(M == A.rows(), AT);
189 FMATVEC_ASSERT(N == A.cols(), AT);
190 return copy(A);
191 }
192
199 template<class Type, class Row, class Col>
200 inline Matrix<General,Var,Var,AT>& operator<<=(const Matrix<Type,Row,Col,AT> &A) {
201 if(M!=A.rows() || N!=A.cols()) resize(A.rows(),A.cols(),NONINIT);
202 return copy(A);
203 }
204 // move
205 inline Matrix<General,Var,Var,AT>& operator<<=(Matrix<General,Var,Var,AT> &&src) {
206 M=src.M;
207 src.M=0;
208 N=src.N;
209 src.N=0;
210 delete[]ele;
211 ele=src.ele;
212 src.ele=nullptr;
213 return *this;
214 }
215
216 template <class AT2>
217 operator Matrix<General,Var,Var,AT2>() const {
218 Matrix<General,Var,Var,AT2> ret(rows(), cols());
219 for(size_t r=0; r<rows(); ++r)
220 for(size_t c=0; c<cols(); ++c)
221 ret(r,c) = (*this)(r,c);
222 return ret;
223 }
224
234 AT& operator()(int i, int j) {
235 FMATVEC_ASSERT(i>=0, AT);
236 FMATVEC_ASSERT(j>=0, AT);
237 FMATVEC_ASSERT(i<M, AT);
238 FMATVEC_ASSERT(j<N, AT);
239
240 return e(i,j);
241 }
242
247 const AT& operator()(int i, int j) const {
248 FMATVEC_ASSERT(i>=0, AT);
249 FMATVEC_ASSERT(j>=0, AT);
250 FMATVEC_ASSERT(i<M, AT);
251 FMATVEC_ASSERT(j<N, AT);
252
253 return e(i,j);
254 }
255
256 AT& e(int i, int j) {
257 return ele[i*N+j];
258 }
259
264 const AT& e(int i, int j) const {
265 return ele[i*N+j];
266 }
267
268 AT& e(int i) {
269 return ele[i];
270 }
271
276 const AT& e(int i) const {
277 return ele[i];
278 }
279
285 AT* operator()() {return ele;}
286
291 const AT* operator()() const {return ele;}
292
297 constexpr int rows() const {return M;}
298
303 constexpr int cols() const {return N;}
304
309 int ldim() const {return N;}
310
317 CBLAS_TRANSPOSE blasTrans() const {
318 return CblasNoTrans;
319 }
320
328 CBLAS_ORDER blasOrder() const {
329 return CblasRowMajor;
330 }
331
336 inline const Matrix<General,Var,Var,AT> operator()(const Range<Var,Var> &I, const Range<Var,Var> &J) const;
337
338 template <int M1, int M2, int N1, int N2>
339 inline const Matrix<General,Fixed<M2-M1+1>,Fixed<N2-N1+1>,AT> operator()(const Range<Fixed<M1>,Fixed<M2>> &I, const Range<Fixed<N1>,Fixed<N2>> &J) const;
340
341 template <int M1, int M2>
342 inline const Matrix<General,Fixed<M2-M1+1>,Var,AT> operator()(const Range<Fixed<M1>,Fixed<M2>> &I, const Range<Var,Var > &J) const;
343
344 template <int N1, int N2>
345 inline const Matrix<General,Var,Fixed<N2-N1+1>,AT> operator()(const Range<Var,Var> &I, const Range<Fixed<N1>,Fixed<N2>> &J) const;
346
347 inline const RowVector<Var,AT> row(int i) const;
348 inline const Vector<Var,AT> col(int j) const;
349
357 inline Matrix<General,Var,Var,AT>& init(const AT &val=AT());
358 inline Matrix<General,Var,Var,AT>& init(Init all, const AT &a=AT()) { return init(a); }
359 inline Matrix<General,Var,Var,AT>& init(Eye eye, const AT &val=1);
360 inline Matrix<General,Var,Var,AT>& init(Noinit, const AT &a=AT()) { return *this; }
361
366 explicit inline operator std::vector<std::vector<AT>>() const;
367
373 explicit inline Matrix(const std::vector<std::vector<AT>> &m);
374
375// /*! \brief Cast to AT.
376// *
377// * \return The AT representation of the matrix
378// * */
379// explicit operator AT() const {
380// FMATVEC_ASSERT(M==1, AT);
381// FMATVEC_ASSERT(N==1, AT);
382// return ele[0];
383// }
384//
385// /*! \brief AT Constructor.
386// * Constructs and initializes a matrix with a AT object.
387// * \param x The AT the matrix will be initialized with.
388// * */
389// explicit Matrix(const AT &x) : M(1), N(1), ele(new AT[1]) { ele[0] = x; }
390
391 inline const Matrix<General,Var,Var,AT> T() const;
392
393 template<class Row> inline void set(int j, const Vector<Row,AT> &x);
394
395 template<class Col> inline void set(int i, const RowVector<Col,AT> &x);
396
397 template<class Type, class Row, class Col> inline void set(const Range<Var,Var> &I, const Range<Var,Var> &J, const Matrix<Type,Row,Col,AT> &A);
398
399 template<class Row> inline void add(int j, const Vector<Row,AT> &x);
400
401 template<class Col> inline void add(int i, const RowVector<Col,AT> &x);
402
403 template<class Type, class Row, class Col> inline void add(const Range<Var,Var> &I, const Range<Var,Var> &J, const Matrix<Type,Row,Col,AT> &A);
404
405 inline const Matrix<General,Var,Var,AT> operator()(const Indices &I, const Indices &J) const;
406
407 inline const Matrix<General,Var,Var,AT> operator()(const Range<Var,Var> &I, const Indices &J) const;
408
409 inline const Matrix<General,Var,Var,AT> operator()(const Indices &I, const Range<Var,Var> &J) const;
410
411 template<class Row> inline void set(const Indices &I, int j, const Vector<Row,AT> &x);
412
413 template<class Type, class Row, class Col> inline void set(const Indices &I, const Indices &J, const Matrix<Type,Row,Col,AT> &A);
414
415 template<class Type, class Row, class Col> inline void set(const Range<Var,Var> &I, const Indices &J, const Matrix<Type,Row,Col,AT> &A);
416
417 template<class Type, class Row, class Col> inline void set(const Indices &I, const Range<Var,Var> &J, const Matrix<Type,Row,Col,AT> &A);
418 };
419
420 template <class AT>
421 Matrix<General,Var,Var,AT>::Matrix(const std::string &strs) : ele(nullptr) {
422 std::istringstream iss(strs);
423 iss>>*this;
424
425 // check end of stream
426 iss>>std::ws;
427 if(!iss.eof())
428 throw std::runtime_error("Input not fully read.");
429 }
430 template <class AT> Matrix<General,Var,Var,AT>::Matrix(const char *strs) : Matrix<General,Var,Var,AT>::Matrix(std::string(strs)) {}
431
432 template <class AT>
434 #if __GNUC__ >= 10
435 // gcc >= 11 triggers a false positive on this code due to init(val) calls from ctor setting M=0
436 #pragma GCC diagnostic push
437 #pragma GCC diagnostic ignored "-Warray-bounds"
438 #pragma GCC diagnostic ignored "-Wstringop-overflow"
439 #endif
440 for(int i=0; i<M*N; i++)
441 e(i) = val;
442 #if __GNUC__ >= 10
443 #pragma GCC diagnostic pop
444 #endif
445 return *this;
446 }
447
448 template <class AT>
450 for(int i=0; i<M; i++)
451 for(int j=0; j<N; j++)
452 e(i,j) = (i==j) ? val : 0;
453 return *this;
454 }
455
456 template <class AT>
458 FMATVEC_ASSERT(I.end()<M, AT);
459 FMATVEC_ASSERT(J.end()<N, AT);
460 Matrix<General,Var,Var,AT> A(I.size(),J.size(),NONINIT);
461
462 for(int i=0; i<A.rows(); i++)
463 for(int j=0; j<A.cols(); j++)
464 A.e(i,j) = e(I.start()+i,J.start()+j);
465
466 return A;
467 }
468
469 template <class AT> template <int M1, int M2, int N1, int N2>
470 inline const Matrix<General,Fixed<M2-M1+1>,Fixed<N2-N1+1>,AT> Matrix<General,Var,Var,AT>::operator()(const Range<Fixed<M1>,Fixed<M2>> &I, const Range<Fixed<N1>,Fixed<N2>> &J) const {
471 FMATVEC_ASSERT(M2<M, AT);
472 FMATVEC_ASSERT(N2<N, AT);
473 Matrix<General,Fixed<M2-M1+1>,Fixed<N2-N1+1>,AT> A(NONINIT);
474
475 for(int i=0; i<A.rows(); i++)
476 for(int j=0; j<A.cols(); j++)
477 A.e(i,j) = e(I.start()+i,J.start()+j);
478
479 return A;
480 }
481
482 template <class AT> template <int M1, int M2>
483 inline const Matrix<General,Fixed<M2-M1+1>,Var,AT> Matrix<General,Var,Var,AT>::operator()(const Range<Fixed<M1>,Fixed<M2>> &I, const Range<Var,Var> &J) const {
484 FMATVEC_ASSERT(M2<M, AT);
485 FMATVEC_ASSERT(J.end()<N, AT);
486 Matrix<General,Fixed<M2-M1+1>,Var,AT> A(J.size(),NONINIT);
487
488 for(int i=0; i<A.rows(); i++)
489 for(int j=0; j<A.cols(); j++)
490 A.e(i,j) = e(I.start()+i,J.start()+j);
491
492 return A;
493 }
494
495 template <class AT> template <int N1, int N2>
496 inline const Matrix<General,Var,Fixed<N2-N1+1>,AT> Matrix<General,Var,Var,AT>::operator()(const Range<Var,Var> &I, const Range<Fixed<N1>,Fixed<N2>> &J) const {
497 FMATVEC_ASSERT(I.end()<M, AT);
498 FMATVEC_ASSERT(N2<N, AT);
499 Matrix<General,Var,Fixed<N2-N1+1>,AT> A(I.size(),NONINIT);
500
501 for(int i=0; i<A.rows(); i++)
502 for(int j=0; j<A.cols(); j++)
503 A.e(i,j) = e(I.start()+i,J.start()+j);
504
505 return A;
506 }
507
508 template <class AT>
509 inline const RowVector<Var,AT> Matrix<General,Var,Var,AT>::row(int i) const {
510
511 FMATVEC_ASSERT(i>=0, AT);
512 FMATVEC_ASSERT(i<M, AT);
513
514 RowVector<Var,AT> x(N,NONINIT);
515
516 for(int j=0; j<N; j++)
517 x.e(j) = e(i,j);
518
519 return x;
520 }
521
522 template <class AT>
523 inline const Vector<Var,AT> Matrix<General,Var,Var,AT>::col(int j) const {
524
525 FMATVEC_ASSERT(j>=0, AT);
526 FMATVEC_ASSERT(j<N, AT);
527
528 Vector<Var,AT> x(M,NONINIT);
529
530 for(int i=0; i<M; i++)
531 x.e(i) = e(i,j);
532
533 return x;
534 }
535
536 template <class AT>
537 inline const Matrix<General,Var,Var,AT> Matrix<General,Var,Var,AT>::T() const {
538 Matrix<General,Var,Var,AT> A(N,M,NONINIT);
539 for(int i=0; i<N; i++)
540 for(int j=0; j<M; j++)
541 A.e(i,j) = e(j,i);
542 return A;
543 }
544
545 template <class AT> template <class Row>
546 inline void Matrix<General,Var,Var,AT>::set(int j, const Vector<Row,AT> &x) {
547 FMATVEC_ASSERT(j<cols(), AT);
548 FMATVEC_ASSERT(rows()==x.size(), AT);
549 for(int i=0; i<rows(); i++)
550 e(i,j) = x.e(i);
551 }
552
553 template <class AT> template <class Col>
554 inline void Matrix<General,Var,Var,AT>::set(int i, const RowVector<Col,AT> &x) {
555 FMATVEC_ASSERT(i<rows(), AT);
556 FMATVEC_ASSERT(cols()==x.size(), AT);
557 for(int j=0; j<cols(); j++)
558 e(i,j) = x.e(j);
559 }
560
561 template <class AT> template<class Type, class Row, class Col>
562 inline void Matrix<General,Var,Var,AT>::set(const Range<Var,Var> &I, const Range<Var,Var> &J, const Matrix<Type,Row,Col,AT> &A) {
563
564 FMATVEC_ASSERT(I.end()<rows(), AT);
565 FMATVEC_ASSERT(J.end()<cols(), AT);
566 FMATVEC_ASSERT(I.size()==A.rows(), AT);
567 FMATVEC_ASSERT(J.size()==A.cols(), AT);
568
569 for(int i=I.start(), ii=0; i<=I.end(); i++, ii++)
570 for(int j=J.start(), jj=0; j<=J.end(); j++, jj++)
571 e(i,j) = A.e(ii,jj);
572 }
573
574 template <class AT> template <class Row>
575 inline void Matrix<General,Var,Var,AT>::add(int j, const Vector<Row,AT> &x) {
576 FMATVEC_ASSERT(j<cols(), AT);
577 FMATVEC_ASSERT(rows()==x.size(), AT);
578 for(int i=0; i<rows(); i++)
579 e(i,j) += x.e(i);
580 }
581
582 template <class AT> template <class Col>
583 inline void Matrix<General,Var,Var,AT>::add(int i, const RowVector<Col,AT> &x) {
584 FMATVEC_ASSERT(i<rows(), AT);
585 FMATVEC_ASSERT(cols()==x.size(), AT);
586 for(int j=0; j<cols(); j++)
587 e(i,j) += x.e(j);
588 }
589
590 template <class AT> template<class Type, class Row, class Col>
591 inline void Matrix<General,Var,Var,AT>::add(const Range<Var,Var> &I, const Range<Var,Var> &J, const Matrix<Type,Row,Col,AT> &A) {
592
593 FMATVEC_ASSERT(I.end()<rows(), AT);
594 FMATVEC_ASSERT(J.end()<cols(), AT);
595 FMATVEC_ASSERT(I.size()==A.rows(), AT);
596 FMATVEC_ASSERT(J.size()==A.cols(), AT);
597
598 for(int i=I.start(), ii=0; i<=I.end(); i++, ii++)
599 for(int j=J.start(), jj=0; j<=J.end(); j++, jj++)
600 e(i,j) += A.e(ii,jj);
601 }
602
603 template <class AT>
604 inline const Matrix<General,Var,Var,AT> Matrix<General,Var,Var,AT>::operator()(const Indices &I, const Indices &J) const {
605 FMATVEC_ASSERT(I.max()<rows(), AT);
606 FMATVEC_ASSERT(J.max()<cols(), AT);
607
608 Matrix<General,Var,Var,AT> A(I.size(),J.size(),NONINIT);
609
610 for(int i=0; i<A.rows(); i++)
611 for(int j=0; j<A.cols(); j++)
612 A.e(i,j) = e(I[i],J[j]);
613
614 return A;
615 }
616
617 template <class AT>
618 inline const Matrix<General,Var,Var,AT> Matrix<General,Var,Var,AT>::operator()(const Range<Var,Var> &I, const Indices &J) const {
619 FMATVEC_ASSERT(I.end()<M, AT);
620 FMATVEC_ASSERT(J.max()<cols(), AT);
621
622 Matrix<General,Var,Var,AT> A(I.size(),J.size(),NONINIT);
623
624 for(int i=0; i<A.rows(); i++)
625 for(int j=0; j<A.cols(); j++)
626 A.e(i,j) = e(I.start()+i,J[j]);
627
628 return A;
629 }
630
631 template <class AT>
632 inline const Matrix<General,Var,Var,AT> Matrix<General,Var,Var,AT>::operator()(const Indices &I, const Range<Var,Var> &J) const {
633 FMATVEC_ASSERT(I.max()<rows(), AT);
634 FMATVEC_ASSERT(J.end()<N, AT);
635
636 Matrix<General,Var,Var,AT> A(I.size(),J.size(),NONINIT);
637
638 for(int i=0; i<A.rows(); i++)
639 for(int j=0; j<A.cols(); j++)
640 A.e(i,j) = e(I[i],J.start()+j);
641
642 return A;
643 }
644
645 template <class AT> template<class Row>
646 inline void Matrix<General,Var,Var,AT>::set(const Indices &I, int j, const Vector<Row,AT> &x) {
647 FMATVEC_ASSERT(I.max()<rows(), AT);
648 FMATVEC_ASSERT(j<cols(), AT);
649 FMATVEC_ASSERT(I.size()==x.size(), AT);
650 for(int i=0; i<I.size(); i++)
651 e(I[i],j) = x.e(i);
652 }
653
654 template <class AT> template <class Type, class Row, class Col>
655 inline void Matrix<General,Var,Var,AT>::set(const Indices &I, const Indices &J, const Matrix<Type,Row,Col,AT> &A) {
656 FMATVEC_ASSERT(I.max()<rows(), AT);
657 FMATVEC_ASSERT(J.max()<cols(), AT);
658 FMATVEC_ASSERT(I.size()==A.rows(), AT);
659 FMATVEC_ASSERT(J.size()==A.cols(), AT);
660 for(int i=0; i<I.size(); i++)
661 for(int j=0; j<J.size(); j++)
662 e(I[i],J[j]) = A.e(i,j);
663 }
664
665 template <class AT> template <class Type, class Row, class Col>
666 inline void Matrix<General,Var,Var,AT>::set(const Range<Var,Var> &I, const Indices &J, const Matrix<Type,Row,Col,AT> &A) {
667 FMATVEC_ASSERT(I.end()<rows(), AT);
668 FMATVEC_ASSERT(J.max()<cols(), AT);
669 FMATVEC_ASSERT(I.size()==A.rows(), AT);
670 FMATVEC_ASSERT(J.size()==A.cols(), AT);
671 for(int i=I.start(), ii=0; i<=I.end(); i++, ii++)
672 for(int j=0; j<J.size(); j++)
673 e(i,J[j]) = A.e(ii,j);
674 }
675
676 template <class AT> template <class Type, class Row, class Col>
677 inline void Matrix<General,Var,Var,AT>::set(const Indices &I, const Range<Var,Var> &J, const Matrix<Type,Row,Col,AT> &A) {
678 FMATVEC_ASSERT(I.max()<rows(), AT);
679 FMATVEC_ASSERT(J.end()<cols(), AT);
680 FMATVEC_ASSERT(I.size()==A.rows(), AT);
681 FMATVEC_ASSERT(J.size()==A.cols(), AT);
682 for(int i=0; i<I.size(); i++)
683 for(int j=J.start(), jj=0; j<=J.end(); j++, jj++)
684 e(I[i],j) = A.e(i,jj);
685 }
686
687 template <class AT>
688 inline Matrix<General,Var,Var,AT>::operator std::vector<std::vector<AT>>() const {
689 std::vector<std::vector<AT>> ret(rows(),std::vector<AT>(cols()));
690 for(int r=0; r<rows(); r++) {
691 for(int c=0; c<cols(); c++)
692 ret[r][c]=e(r,c);
693 }
694 return ret;
695 }
696
697 template <class AT>
698 inline Matrix<General,Var,Var,AT>::Matrix(const std::vector<std::vector<AT>> &m) : M(static_cast<int>(m.size())), N(static_cast<int>(m.empty()?0:m[0].size())), ele(new AT[M*N]) {
699 for(int r=0; r<rows(); r++) {
700 if(static_cast<int>(m[r].size())!=cols())
701 throw std::runtime_error("The rows of the input have different length.");
702 for(int c=0; c<cols(); c++)
703 e(r,c)=m[r][c];
704 }
705 }
706
708
709 template <class AT> template <class Type, class Row, class Col>
711 for(int i=0; i<M; i++)
712 for(int j=0; j<N; j++)
713 e(i,j) = A.e(i,j);
714 return *this;
715 }
716
718
719}
720
721#endif
Definition: types.h:94
Definition: types.h:108
Shape class for general matrices.
Definition: types.h:116
Definition: types.h:93
This is a matrix class for general matrices.
Definition: var_general_matrix.h:41
int ldim() const
Leading dimension.
Definition: var_general_matrix.h:309
const AT & operator()(int i, int j) const
Element operator.
Definition: var_general_matrix.h:247
Matrix()
Standard constructor.
Definition: var_general_matrix.h:67
AT & operator()(int i, int j)
Element operator.
Definition: var_general_matrix.h:234
Matrix(const Matrix< General, Var, Var, AT > &A)
Copy Constructor.
Definition: var_general_matrix.h:104
const AT & e(int i, int j) const
Element operator.
Definition: var_general_matrix.h:264
Matrix(const Matrix< General, Row, Col, AT > &A)
Copy Constructor.
Definition: var_general_matrix.h:114
Matrix< General, Var, Var, AT > & operator=(const Matrix< General, Var, Var, AT > &A)
Assignment operator.
Definition: var_general_matrix.h:174
const AT & e(int i) const
Element operator.
Definition: var_general_matrix.h:276
Matrix(const Matrix< Type, Row, Col, AT > &A)
Copy Constructor.
Definition: var_general_matrix.h:124
constexpr int cols() const
Number of columns.
Definition: var_general_matrix.h:303
CBLAS_TRANSPOSE blasTrans() const
Transposed status.
Definition: var_general_matrix.h:317
AT * operator()()
Pointer operator.
Definition: var_general_matrix.h:285
CBLAS_ORDER blasOrder() const
Storage convention.
Definition: var_general_matrix.h:328
constexpr int rows() const
Number of rows.
Definition: var_general_matrix.h:297
~Matrix()
Destructor.
Definition: var_general_matrix.h:145
const AT * operator()() const
Pointer operator.
Definition: var_general_matrix.h:291
This is the basic matrix class for arbitrary matrices.
Definition: matrix.h:52
int rows() const
Number of rows.
int cols() const
Number of columns.
AT & operator()(int i, int j)
Standard constructor.
Definition: matrix.h:84
Definition: types.h:92
This is an index class for creating submatrices.
Definition: range.h:44
int end() const
Last element.
Definition: range.h:91
int size() const
Size.
Definition: range.h:97
int start() const
First element.
Definition: range.h:85
This is an index class for creating submatrices.
Definition: range.h:35
This is a vector class of general shape in dense storage format.
Definition: var_row_vector.h:39
Definition: types.h:105
This is a vector class of general shape in dense storage format.
Definition: var_vector.h:39
Namespace fmatvec.
Definition: _memory.cc:28