36 #ifndef MAT_MATRIXGENERAL 37 #define MAT_MATRIXGENERAL 56 template<
typename Treal,
typename Tmatrix>
57 class MatrixGeneral :
public MatrixBase<Treal, Tmatrix> {
74 template<
typename Tfull>
75 inline void assign_from_full
76 (Tfull
const*
const fullmatrix,
77 const int totnrows,
const int totncols) {
78 this->
matrixPtr->assign_from_full(fullmatrix, totnrows, totncols);
80 inline void assign_from_full
81 (Treal
const*
const fullmatrix,
82 const int totnrows,
const int totncols) {
83 this->
matrixPtr->assign_from_full(fullmatrix, totnrows, totncols);
88 (std::vector<Treal>
const & fullMat) {
93 inline void fullMatrix(std::vector<Treal> & fullMat)
const {
98 (std::vector<Treal> & fullMat,
99 std::vector<int>
const & rowInversePermutation,
100 std::vector<int>
const & colInversePermutation)
const {
101 std::vector<int> rowind;
102 std::vector<int> colind;
103 std::vector<Treal> values;
105 rowInversePermutation,
106 colInversePermutation);
108 for (
unsigned int ind = 0; ind < values.size(); ++ind)
109 fullMat[rowind[ind] + this->
get_nrows() * colind[ind]] =
120 (std::vector<int>
const & rowind,
121 std::vector<int>
const & colind,
122 std::vector<Treal>
const & values,
126 this->
matrixPtr->assignFromSparse(rowind, colind, values);
136 (std::vector<int>
const & rowind,
137 std::vector<int>
const & colind,
138 std::vector<Treal>
const & values,
139 std::vector<int>
const & rowPermutation,
140 std::vector<int>
const & colPermutation) {
141 std::vector<int> newRowind;
142 std::vector<int> newColind;
147 this->
matrixPtr->assignFromSparse(newRowind, newColind, values);
155 (std::vector<int>
const & rowind,
156 std::vector<int>
const & colind,
157 std::vector<Treal>
const & values,
160 std::vector<int>
const & rowPermutation,
161 std::vector<int>
const & colPermutation) {
164 rowPermutation, colPermutation);
171 (std::vector<int>
const & rowind,
172 std::vector<int>
const & colind,
173 std::vector<Treal> & values)
const {
174 this->
matrixPtr->getValues(rowind, colind, values);
184 (std::vector<int>
const & rowind,
185 std::vector<int>
const & colind,
186 std::vector<Treal> & values,
187 std::vector<int>
const & rowPermutation,
188 std::vector<int>
const & colPermutation)
const {
189 std::vector<int> newRowind;
190 std::vector<int> newColind;
195 this->
matrixPtr->getValues(newRowind, newColind, values);
202 (std::vector<int> & rowind,
203 std::vector<int> & colind,
204 std::vector<Treal> & values)
const {
208 this->
matrixPtr->getAllValues(rowind, colind, values);
220 (std::vector<int> & rowind,
221 std::vector<int> & colind,
222 std::vector<Treal> & values,
223 std::vector<int>
const & rowInversePermutation,
224 std::vector<int>
const & colInversePermutation)
const {
225 std::vector<int> tmpRowind;
226 std::vector<int> tmpColind;
227 tmpRowind.reserve(rowind.capacity());
228 tmpColind.reserve(colind.capacity());
230 this->
matrixPtr->getAllValues(tmpRowind, tmpColind, values);
247 inline void fullmatrix(Treal*
const full,
248 const int totnrows,
const int totncols)
const {
249 this->
matrixPtr->fullmatrix(full, totnrows, totncols);
288 return Tmatrix::frobDiff(*A.matrixPtr, *B.matrixPtr);
290 Treal
eucl(Treal
const requestedAccuracy,
291 int maxIter = -1)
const;
294 void thresh(Treal
const threshold,
308 return Tmatrix::trace_ab(*A.matrixPtr, *B.matrixPtr);
313 return Tmatrix::trace_aTb(*A.matrixPtr, *B.matrixPtr);
315 inline size_t nnz()
const {
334 MatrixGeneral<Treal, Tmatrix> >& smm);
337 MatrixGeneral<Treal, Tmatrix>&
operator=
339 MatrixGeneral<Treal, Tmatrix> >& mm);
342 MatrixGeneral<Treal, Tmatrix>&
operator+=
344 MatrixGeneral<Treal, Tmatrix>,
345 MatrixGeneral<Treal, Tmatrix> >& smm);
348 MatrixGeneral<Treal, Tmatrix>&
operator=
350 MatrixGeneral<Treal, Tmatrix>,
351 MatrixGeneral<Treal, Tmatrix>,
353 MatrixGeneral<Treal, Tmatrix> >& smmpsm);
356 MatrixGeneral<Treal, Tmatrix>&
operator=
358 MatrixGeneral<Treal, Tmatrix> >
const & mpm);
360 MatrixGeneral<Treal, Tmatrix>&
operator+=
361 (MatrixGeneral<Treal, Tmatrix>
const &
A);
362 MatrixGeneral<Treal, Tmatrix>&
operator-=
363 (MatrixGeneral<Treal, Tmatrix>
const &
A);
365 MatrixGeneral<Treal, Tmatrix>&
operator+=
371 MatrixGeneral<Treal, Tmatrix>&
operator=
374 MatrixGeneral<Treal, Tmatrix> >& smm);
376 MatrixGeneral<Treal, Tmatrix>&
operator=
378 MatrixGeneral<Treal, Tmatrix> >& mm);
380 MatrixGeneral<Treal, Tmatrix>&
operator+=
382 MatrixSymmetric<Treal, Tmatrix>,
383 MatrixGeneral<Treal, Tmatrix> >& smm);
385 MatrixGeneral<Treal, Tmatrix>&
operator=
387 MatrixSymmetric<Treal, Tmatrix>,
388 MatrixGeneral<Treal, Tmatrix>,
390 MatrixGeneral<Treal, Tmatrix> >& smmpsm);
392 MatrixGeneral<Treal, Tmatrix>&
operator=
394 MatrixGeneral<Treal, Tmatrix>,
395 MatrixSymmetric<Treal, Tmatrix> >& smm);
397 MatrixGeneral<Treal, Tmatrix>&
operator=
399 MatrixSymmetric<Treal, Tmatrix> >& mm);
401 MatrixGeneral<Treal, Tmatrix>&
operator+=
403 MatrixGeneral<Treal, Tmatrix>,
404 MatrixSymmetric<Treal, Tmatrix> >& smm);
406 MatrixGeneral<Treal, Tmatrix>&
operator=
408 MatrixGeneral<Treal, Tmatrix>,
409 MatrixSymmetric<Treal, Tmatrix>,
411 MatrixGeneral<Treal, Tmatrix> >& smmpsm);
413 MatrixGeneral<Treal, Tmatrix>&
operator=
415 MatrixSymmetric<Treal, Tmatrix>,
416 MatrixSymmetric<Treal, Tmatrix> >& smm);
418 MatrixGeneral<Treal, Tmatrix>&
operator=
420 MatrixSymmetric<Treal, Tmatrix> >& mm);
422 MatrixGeneral<Treal, Tmatrix>&
operator+=
424 MatrixSymmetric<Treal, Tmatrix>,
425 MatrixSymmetric<Treal, Tmatrix> >& smm);
427 MatrixGeneral<Treal, Tmatrix>&
operator=
429 MatrixSymmetric<Treal, Tmatrix>,
430 MatrixSymmetric<Treal, Tmatrix>,
432 MatrixGeneral<Treal, Tmatrix> >& smmpsm);
436 MatrixGeneral<Treal, Tmatrix>&
operator=
439 MatrixGeneral<Treal, Tmatrix> >& smm);
441 MatrixGeneral<Treal, Tmatrix>&
operator=
443 MatrixGeneral<Treal, Tmatrix>,
444 MatrixTriangular<Treal, Tmatrix> >& smm);
451 this->
matrixPtr->randomZeroStructure(probabilityBeingZero);
454 template<
typename TRule>
456 this->
matrixPtr->setElementsByRule(rule);
472 template<
typename Treal,
typename Tmatrix>
474 eucl(Treal
const requestedAccuracy,
486 lan(ata, guess, maxIter);
487 lan.setRelTol( 100 * std::numeric_limits<Treal>::epsilon() );
494 if ( euclInt.
low() < 0 )
496 if ( euclInt.
length() / 2.0 > requestedAccuracy ) {
497 std::cout <<
"req: " << requestedAccuracy
498 <<
" obt: " << euclInt.
length() / 2.0 << std::endl;
499 throw std::runtime_error(
"Desired accuracy not obtained in Lanczos.");
505 template<
typename Treal,
typename Tmatrix>
514 throw Failure(
"MatrixGeneral<Treal, Tmatrix>::" 515 "thresh(Treal const, " 517 "Thresholding not imlpemented for selected norm");
521 template<
typename Treal,
typename Tmatrix>
525 return TruncObj.
run( threshold );
531 template<
typename Treal,
typename Tmatrix>
536 MatrixGeneral<Treal, Tmatrix> >& smm) {
537 assert(
this != &smm.B &&
this != &smm.C);
540 *smm.B.matrixPtr, *smm.C.matrixPtr,
541 0, *this->matrixPtr);
546 template<
typename Treal,
typename Tmatrix>
547 MatrixGeneral<Treal, Tmatrix>&
548 MatrixGeneral<Treal, Tmatrix>::operator=
550 MatrixGeneral<Treal, Tmatrix> >& mm) {
551 assert(
this != &mm.A &&
this != &mm.B);
553 *mm.A.matrixPtr, *mm.B.matrixPtr,
554 0, *this->matrixPtr);
559 template<
typename Treal,
typename Tmatrix>
560 MatrixGeneral<Treal, Tmatrix>&
561 MatrixGeneral<Treal, Tmatrix>::operator+=
563 MatrixGeneral<Treal, Tmatrix>,
564 MatrixGeneral<Treal, Tmatrix> >& smm) {
565 assert(
this != &smm.B &&
this != &smm.C);
567 *smm.B.matrixPtr, *smm.C.matrixPtr,
568 1, *this->matrixPtr);
573 template<
typename Treal,
typename Tmatrix>
574 MatrixGeneral<Treal, Tmatrix>&
575 MatrixGeneral<Treal, Tmatrix>::operator=
577 MatrixGeneral<Treal, Tmatrix>,
578 MatrixGeneral<Treal, Tmatrix>,
580 MatrixGeneral<Treal, Tmatrix> >& smmpsm) {
581 assert(
this != &smmpsm.B &&
this != &smmpsm.C);
583 if (
this == &smmpsm.E)
585 *smmpsm.B.matrixPtr, *smmpsm.C.matrixPtr,
586 smmpsm.D, *this->matrixPtr);
588 throw Failure(
"MatrixGeneral<Treal, Tmatrix>::operator=" 589 "(const XYZpUV<Treal, MatrixGeneral" 590 "<Treal, Tmatrix> >&) : D = alpha " 591 "* op(A) * op(B) + beta * C not supported for C != D");
597 template<
typename Treal,
typename Tmatrix>
598 inline MatrixGeneral<Treal, Tmatrix>&
599 MatrixGeneral<Treal, Tmatrix>::operator=
601 MatrixGeneral<Treal, Tmatrix> >& mpm) {
602 assert(
this != &mpm.A);
604 Tmatrix::add(1.0, *mpm.A.matrixPtr, *this->matrixPtr);
608 template<
typename Treal,
typename Tmatrix>
609 inline MatrixGeneral<Treal, Tmatrix>&
610 MatrixGeneral<Treal, Tmatrix>::operator+=
611 (MatrixGeneral<Treal, Tmatrix>
const &
A) {
612 Tmatrix::add(1.0, *A.matrixPtr, *this->matrixPtr);
616 template<
typename Treal,
typename Tmatrix>
617 inline MatrixGeneral<Treal, Tmatrix>&
618 MatrixGeneral<Treal, Tmatrix>::operator-=
619 (MatrixGeneral<Treal, Tmatrix>
const &
A) {
620 Tmatrix::add(-1.0, *A.matrixPtr, *this->matrixPtr);
624 template<
typename Treal,
typename Tmatrix>
625 inline MatrixGeneral<Treal, Tmatrix>&
626 MatrixGeneral<Treal, Tmatrix>::operator+=
629 Tmatrix::add(sm.A, *sm.B.matrixPtr, *this->matrixPtr);
636 template<
typename Treal,
typename Tmatrix>
637 MatrixGeneral<Treal, Tmatrix>&
638 MatrixGeneral<Treal, Tmatrix>::operator=
641 MatrixGeneral<Treal, Tmatrix> >& smm) {
642 assert(
this != &smm.C);
643 assert(!smm.tB && !smm.tC);
646 *smm.B.matrixPtr, *smm.C.matrixPtr,
647 0, *this->matrixPtr);
652 template<
typename Treal,
typename Tmatrix>
653 MatrixGeneral<Treal, Tmatrix>&
654 MatrixGeneral<Treal, Tmatrix>::operator=
656 MatrixGeneral<Treal, Tmatrix> >& mm) {
657 assert(
this != &mm.B);
660 *mm.A.matrixPtr, *mm.B.matrixPtr,
661 0, *this->matrixPtr);
666 template<
typename Treal,
typename Tmatrix>
667 MatrixGeneral<Treal, Tmatrix>&
668 MatrixGeneral<Treal, Tmatrix>::operator+=
670 MatrixSymmetric<Treal, Tmatrix>,
671 MatrixGeneral<Treal, Tmatrix> >& smm) {
672 assert(
this != &smm.C);
673 assert(!smm.tB && !smm.tC);
675 *smm.B.matrixPtr, *smm.C.matrixPtr,
676 1, *this->matrixPtr);
681 template<
typename Treal,
typename Tmatrix>
682 MatrixGeneral<Treal, Tmatrix>&
683 MatrixGeneral<Treal, Tmatrix>::operator=
685 MatrixSymmetric<Treal, Tmatrix>,
686 MatrixGeneral<Treal, Tmatrix>,
688 MatrixGeneral<Treal, Tmatrix> >& smmpsm) {
689 assert(
this != &smmpsm.C);
690 assert(!smmpsm.tB && !smmpsm.tC && !smmpsm.tE);
691 if (
this == &smmpsm.E)
693 *smmpsm.B.matrixPtr, *smmpsm.C.matrixPtr,
694 smmpsm.D, *this->matrixPtr);
696 throw Failure(
"MatrixGeneral<Treal, Tmatrix>::operator=" 697 "(const XYZpUV<Treal, MatrixGeneral" 698 "<Treal, Tmatrix>, MatrixSymmetric<Treal, " 699 "Tmatrix>, Treal, MatrixGeneral" 700 "<Treal, Tmatrix> >&) " 701 ": D = alpha * A * B + beta * C (with A symmetric)" 702 " not supported for C != D");
707 template<
typename Treal,
typename Tmatrix>
708 MatrixGeneral<Treal, Tmatrix>&
709 MatrixGeneral<Treal, Tmatrix>::operator=
711 MatrixGeneral<Treal, Tmatrix>,
712 MatrixSymmetric<Treal, Tmatrix> >& smm) {
713 assert(
this != &smm.B);
714 assert(!smm.tB && !smm.tC);
717 *smm.C.matrixPtr, *smm.B.matrixPtr,
718 0, *this->matrixPtr);
723 template<
typename Treal,
typename Tmatrix>
724 MatrixGeneral<Treal, Tmatrix>&
725 MatrixGeneral<Treal, Tmatrix>::operator=
727 MatrixSymmetric<Treal, Tmatrix> >& mm) {
728 assert(
this != &mm.A);
729 assert(!mm.tA && !mm.tB);
731 *mm.B.matrixPtr, *mm.A.matrixPtr,
732 0, *this->matrixPtr);
737 template<
typename Treal,
typename Tmatrix>
738 MatrixGeneral<Treal, Tmatrix>&
739 MatrixGeneral<Treal, Tmatrix>::operator+=
741 MatrixGeneral<Treal, Tmatrix>,
742 MatrixSymmetric<Treal, Tmatrix> >& smm) {
743 assert(
this != &smm.B);
744 assert(!smm.tB && !smm.tC);
746 *smm.C.matrixPtr, *smm.B.matrixPtr,
747 1, *this->matrixPtr);
752 template<
typename Treal,
typename Tmatrix>
753 MatrixGeneral<Treal, Tmatrix>&
754 MatrixGeneral<Treal, Tmatrix>::operator=
756 MatrixGeneral<Treal, Tmatrix>,
757 MatrixSymmetric<Treal, Tmatrix>,
759 MatrixGeneral<Treal, Tmatrix> >& smmpsm) {
760 assert(
this != &smmpsm.B);
761 assert(!smmpsm.tB && !smmpsm.tC && !smmpsm.tE);
762 if (
this == &smmpsm.E)
764 *smmpsm.C.matrixPtr, *smmpsm.B.matrixPtr,
765 smmpsm.D, *this->matrixPtr);
767 throw Failure(
"MatrixGeneral<Treal, Tmatrix>::operator=" 768 "(const XYZpUV<Treal, MatrixSymmetric" 769 "<Treal, Tmatrix>, MatrixGeneral<Treal, " 770 "Tmatrix>, Treal, MatrixGeneral" 771 "<Treal, Tmatrix> >&) " 772 ": D = alpha * B * A + beta * C (with A symmetric)" 773 " not supported for C != D");
779 template<
typename Treal,
typename Tmatrix>
780 MatrixGeneral<Treal, Tmatrix>&
781 MatrixGeneral<Treal, Tmatrix>::operator=
783 MatrixSymmetric<Treal, Tmatrix>,
784 MatrixSymmetric<Treal, Tmatrix> >& smm) {
785 assert(!smm.tB && !smm.tC);
796 template<
typename Treal,
typename Tmatrix>
797 MatrixGeneral<Treal, Tmatrix>&
798 MatrixGeneral<Treal, Tmatrix>::operator=
800 MatrixSymmetric<Treal, Tmatrix> >& mm) {
811 template<
typename Treal,
typename Tmatrix>
812 MatrixGeneral<Treal, Tmatrix>&
813 MatrixGeneral<Treal, Tmatrix>::operator+=
815 MatrixSymmetric<Treal, Tmatrix>,
816 MatrixSymmetric<Treal, Tmatrix> >& smm) {
817 assert(!smm.tB && !smm.tC);
828 template<
typename Treal,
typename Tmatrix>
829 MatrixGeneral<Treal, Tmatrix>&
830 MatrixGeneral<Treal, Tmatrix>::operator=
832 MatrixSymmetric<Treal, Tmatrix>,
833 MatrixSymmetric<Treal, Tmatrix>,
835 MatrixGeneral<Treal, Tmatrix> >& smmpsm) {
836 assert(!smmpsm.tB && !smmpsm.tC && !smmpsm.tE);
837 if (
this == &smmpsm.E)
838 Tmatrix::ssmm(smmpsm.A,
844 throw Failure(
"MatrixGeneral<Treal, Tmatrix>::" 845 "operator=(const XYZpUV<" 846 "Treal, MatrixSymmetric<Treal, Tmatrix>, " 847 "MatrixSymmetric<Treal, Tmatrix>, Treal, " 848 "MatrixGeneral<Treal, Tmatrix> >&) " 849 ": D = alpha * A * B + beta * C (with A and B symmetric)" 850 " not supported for C != D");
859 template<
typename Treal,
typename Tmatrix>
860 MatrixGeneral<Treal, Tmatrix>&
861 MatrixGeneral<Treal, Tmatrix>::operator=
864 MatrixGeneral<Treal, Tmatrix> >& smm) {
868 *smm.B.matrixPtr, *this->matrixPtr);
870 throw Failure(
"MatrixGeneral<Treal, Tmatrix>::operator=" 871 "(const XYZ<Treal, MatrixTriangular" 872 "<Treal, Tmatrix>, MatrixGeneral<Treal," 873 " Tmatrix> >& : D = alpha * op(A) * B (with" 874 " A upper triangular) not supported for B != D");
880 template<
typename Treal,
typename Tmatrix>
881 MatrixGeneral<Treal, Tmatrix>&
882 MatrixGeneral<Treal, Tmatrix>::operator=
884 MatrixGeneral<Treal, Tmatrix>,
885 MatrixTriangular<Treal, Tmatrix> >& smm) {
889 *smm.C.matrixPtr, *this->matrixPtr);
891 throw Failure(
"MatrixGeneral<Treal, Tmatrix>::operator=" 892 "(const XYZ<Treal, MatrixGeneral" 893 "<Treal, Tmatrix>, MatrixTriangular<Treal," 894 " Tmatrix> >& : D = alpha * A * op(B) (with" 895 " B upper triangular) not supported for A != D");
901 template<
typename Treal,
typename Tmatrix>
903 MatrixGeneral<Treal, Tmatrix>,
904 MatrixGeneral<Treal, Tmatrix> >& smm) {
905 if ((!smm.tB && !smm.tC) || (smm.tB && smm.tC))
void gersgorin(Treal &lmin, Treal &lmax)
Definition: MatrixGeneral.h:302
Normal matrix.
Definition: MatrixBase.h:47
MatrixBase< Treal, Tmatrix > & operator=(const MatrixBase< Treal, Tmatrix > &other)
Definition: MatrixBase.h:164
Treal low() const
Definition: Interval.h:142
VectorGeneral< Treal, typename Tmatrix::VectorType > VectorType
Definition: MatrixGeneral.h:59
static Treal trace_ab(const MatrixGeneral< Treal, Tmatrix > &A, const MatrixGeneral< Treal, Tmatrix > &B)
Definition: MatrixGeneral.h:306
ValidPtr< Tmatrix > matrixPtr
Definition: MatrixBase.h:151
Treal eucl(Treal const requestedAccuracy, int maxIter=-1) const
Definition: MatrixGeneral.h:474
Definition: LanczosLargestMagnitudeEig.h:44
void read_from_buffer_base(void *buffer, const int n_bytes, const matrix_type mattype)
Definition: MatrixBase.h:279
MatrixGeneral(const MatrixGeneral< Treal, Tmatrix > &matr)
Copy constructor.
Definition: MatrixGeneral.h:63
static void symm(const char *side, const char *uplo, const int *m, const int *n, const T *alpha, const T *A, const int *lda, const T *B, const int *ldb, const T *beta, T *C, const int *ldc)
Definition: mat_gblas.h:340
static void gemm(const char *ta, const char *tb, const int *n, const int *k, const int *l, const T *alpha, const T *A, const int *lda, const T *B, const int *ldb, const T *beta, T *C, const int *ldc)
Definition: mat_gblas.h:230
MatrixGeneral< Treal, Tmatrix > & operator=(const Xtrans< MatrixGeneral< Treal, Tmatrix > > &mt)
Definition: MatrixGeneral.h:258
void assign_from_sparse(std::vector< int > const &rowind, std::vector< int > const &colind, std::vector< Treal > const &values, SizesAndBlocks const &newRows, SizesAndBlocks const &newCols)
Assign from sparse matrix given by three arrays.
Definition: MatrixGeneral.h:120
MatrixGeneral< Treal, Tmatrix > & operator=(const MatrixGeneral< Treal, Tmatrix > &mat)
Definition: MatrixGeneral.h:253
static Treal frob_diff(const MatrixGeneral< Treal, Tmatrix > &A, const MatrixGeneral< Treal, Tmatrix > &B)
Definition: MatrixGeneral.h:286
Truncation of general matrices.
Definition: truncation.h:270
This proxy expresses the result of addition of two objects, of possibly different types...
Definition: matrix_proxy.h:244
MatrixGeneral< Treal, Tmatrix > & operator=(const MatrixSymmetric< Treal, Tmatrix > &symm)
Definition: MatrixGeneral.h:267
void getCols(SizesAndBlocks &colsCopy) const
Definition: MatrixBase.h:83
Definition: MatrixBase.h:53
Definition: allocate.cc:30
Describes dimensions of matrix and its blocks on all levels.
Definition: SizesAndBlocks.h:37
Treal frob() const
Definition: MatrixGeneral.h:282
MatrixGeneral< Treal, Tmatrix > & operator=(const MatrixTriangular< Treal, Tmatrix > &triang)
Definition: MatrixGeneral.h:273
Definition: Interval.h:44
void assignFromFull(std::vector< Treal > const &fullMat)
Definition: MatrixGeneral.h:88
size_t nnz() const
Definition: MatrixGeneral.h:315
Definition: MatrixBase.h:54
void readFromFileBase(std::ifstream &file, matrix_type const mattype)
Definition: MatrixBase.h:234
MatrixGeneral(const MatrixSymmetric< Treal, Tmatrix > &symm)
Copy from symmetric matrix constructor.
Definition: MatrixGeneral.h:65
int get_ncols() const
Definition: MatrixBase.h:139
This proxy expresses the result of multiplication of three objects, of possibly different types...
Definition: matrix_proxy.h:65
void write_to_buffer_base(void *buffer, const int n_bytes, const matrix_type mattype) const
Definition: MatrixBase.h:252
Upper non-unit triangular matrix.
Definition: MatrixBase.h:51
This proxy expresses the result of transposition of an object of type TX.
Definition: matrix_proxy.h:116
Treal run(Treal const threshold)
Definition: truncation.h:78
void writeToFileBase(std::ofstream &file, matrix_type const mattype) const
Definition: MatrixBase.h:219
Treal midPoint() const
Definition: Interval.h:113
void setElementsByRule(TRule &rule)
Definition: MatrixGeneral.h:455
void thresh(Treal const threshold, normType const norm)
Definition: MatrixGeneral.h:507
void rand()
Definition: VectorGeneral.h:94
Treal trace() const
Definition: MatrixBase.h:95
size_t nvalues() const
Definition: MatrixGeneral.h:318
void resetSizesAndBlocks(SizesAndBlocks const &newRows, SizesAndBlocks const &newCols)
Definition: MatrixBase.h:74
void randomZeroStructure(Treal probabilityBeingZero)
Definition: MatrixGeneral.h:450
void get_values(std::vector< int > const &rowind, std::vector< int > const &colind, std::vector< Treal > &values) const
Get values given by row and column index lists.
Definition: MatrixGeneral.h:171
void resetSizesAndBlocks(SizesAndBlocks const &newRows)
Definition: VectorGeneral.h:49
std::string obj_type_id() const
Definition: MatrixGeneral.h:460
Definition: mat_utils.h:69
static void trmm(const char *side, const char *uplo, const char *transa, const char *diag, const int *m, const int *n, const T *alpha, const T *A, const int *lda, T *B, const int *ldb)
Definition: mat_gblas.h:279
Treal eucl_thresh(Treal const threshold)
Definition: MatrixGeneral.h:523
void random()
Definition: MatrixGeneral.h:446
Base class for matrix API.
Definition: MatrixBase.h:67
void getLargestMagnitudeEig(Treal &ev, Treal &accuracy)
Definition: LanczosLargestMagnitudeEig.h:56
void writeToFileProt(std::ofstream &file) const
Write object to file.
Definition: MatrixGeneral.h:462
Base class for matrix API.
MatrixGeneral()
Default constructor.
Definition: MatrixGeneral.h:61
Treal length() const
Returns the length of the interval.
Definition: Interval.h:107
Definition: matInclude.h:135
This proxy expresses the result of multiplication of two objects, of possibly different types...
Definition: matrix_proxy.h:49
void read_from_buffer(void *buffer, const int n_bytes)
Definition: MatrixGeneral.h:325
void haveDataStructureSet(bool val)
Definition: ValidPtr.h:97
MatrixGeneral(const MatrixTriangular< Treal, Tmatrix > &triang)
Copy from triangular matrix constructor.
Definition: MatrixGeneral.h:69
void frob_thresh(Treal threshold)
Definition: MatrixGeneral.h:297
int get_nrows() const
Definition: MatrixBase.h:136
Xtrans< TX > transpose(TX const &A)
Transposition.
Definition: matrix_proxy.h:129
void get_all_values(std::vector< int > &rowind, std::vector< int > &colind, std::vector< Treal > &values) const
Get all values and corresponding row and column index lists, in matrix.
Definition: MatrixGeneral.h:202
Symmetric matrix.
Definition: MatrixBase.h:49
This proxy expresses the result of multiplication of three objects added to two other multiplied obje...
Definition: matrix_proxy.h:86
MatrixGeneral< Treal, Tmatrix > & operator=(int const k)
Definition: MatrixGeneral.h:278
void readFromFileProt(std::ifstream &file)
Read object from file.
Definition: MatrixGeneral.h:465
static Treal trace_aTb(const MatrixGeneral< Treal, Tmatrix > &A, const MatrixGeneral< Treal, Tmatrix > &B)
Definition: MatrixGeneral.h:311
void fullMatrix(std::vector< Treal > &fullMat) const
Definition: MatrixGeneral.h:93
normType
Definition: matInclude.h:135
void write_to_buffer(void *buffer, const int n_bytes) const
Definition: MatrixGeneral.h:322
static void getPermutedIndexes(std::vector< int > const &index, std::vector< int > const &permutation, std::vector< int > &newIndex)
Definition: MatrixBase.h:203