36#ifndef MAT_UTILS_HEADER
37#define MAT_UTILS_HEADER
43 template<
class RandomIt>
50 std::random_device rng;
51 std::mt19937 urng(rng());
52 std::shuffle(first, last, urng);
55 std::random_shuffle(first, last);
59 template<
typename Tmatrix,
typename Treal>
66 assert(
A.get_nrows() ==
B.get_nrows() );
70 return Tmatrix::frob_diff(
A,
B);
73 Treal & euclUpperBound)
const {
74 Treal frobTmp =
frob();
76 euclUpperBound = frobTmp;
83 template<
typename Tvector>
86 tmp = (Treal)-1.0 *
B * x;
87 y = (Treal)1.0 *
A * x;
88 y += (Treal)1.0 * tmp;
94 template<
typename Tmatrix,
typename Treal>
104 Treal & euclUpperBound)
const {
105 Treal frobA =
A.frob();
107 euclUpperBound = frobA * frobA;
111 template<
typename Tvector>
122 template<
typename Tmatrix,
typename Tmatrix2,
typename Treal>
129 assert(
A.get_nrows() ==
Z.get_nrows() );
130 return A.get_nrows();
133 Treal & euclUpperBound)
const {
134 Treal frobA =
A.frob();
135 Treal frobZ =
Z.frob();
137 euclUpperBound = frobA * frobZ * frobZ;
147 y = (Treal)1.0 *
A * tmp;
153 template<
typename Tmatrix,
typename Tmatrix2,
typename Treal>
160 return E.get_ncols();
163 Treal & euclUpperBound)
const {
164 Treal frobA =
A.frob();
165 Treal frobZ =
Zt.frob();
166 Treal frobE =
E.frob();
168 euclUpperBound = frobA * frobE * frobE + 2 * frobA * frobE * frobZ;
178 :
A(A_),
Zt(Z_),
E(E_) {}
183 y = (Treal)-1.0 *
A * tmp;
189 tmp1 = (Treal)1.0 *
A * tmp;
191 y += (Treal)1.0 * tmp1;
195 tmp1 = (Treal)1.0 *
A * tmp;
197 y += (Treal)1.0 * tmp1;
Describes dimensions of matrix and its blocks on all levels.
Definition SizesAndBlocks.h:45
Proxy structs used by the matrix API.
Definition allocate.cc:39
static void random_shuffle(RandomIt first, RandomIt last)
Definition mat_utils.h:45
Xtrans< TX > transpose(TX const &A)
Transposition.
Definition matrix_proxy.h:131
Definition mat_utils.h:95
Tmatrix const & A
Definition mat_utils.h:97
int get_nrows() const
Definition mat_utils.h:118
void matVecProd(Tvector &y, Tvector const &x) const
Definition mat_utils.h:112
ATAMatrix(Tmatrix const &A_)
Definition mat_utils.h:98
Tmatrix::VectorType VectorType
Definition mat_utils.h:96
void quickEuclBounds(Treal &euclLowerBound, Treal &euclUpperBound) const
Definition mat_utils.h:103
void getCols(SizesAndBlocks &colsCopy) const
Definition mat_utils.h:100
Definition mat_utils.h:154
void getCols(SizesAndBlocks &colsCopy) const
Definition mat_utils.h:156
Tmatrix2 const & Zt
Definition mat_utils.h:172
Tmatrix const & A
Definition mat_utils.h:171
Tmatrix2 const & E
Definition mat_utils.h:173
void quickEuclBounds(Treal &euclLowerBound, Treal &euclUpperBound) const
Definition mat_utils.h:162
Tmatrix::VectorType VectorType
Definition mat_utils.h:155
int get_nrows() const
Definition mat_utils.h:159
CongrTransErrorMatrix(Tmatrix const &A_, Tmatrix2 const &Z_, Tmatrix2 const &E_)
Definition mat_utils.h:175
void matVecProd(VectorType &y, VectorType const &x) const
Definition mat_utils.h:179
Definition mat_utils.h:60
Treal frob() const
Definition mat_utils.h:69
DiffMatrix(Tmatrix const &A_, Tmatrix const &B_)
Definition mat_utils.h:81
Tmatrix const & A
Definition mat_utils.h:79
void getCols(SizesAndBlocks &colsCopy) const
Definition mat_utils.h:62
Tmatrix const & B
Definition mat_utils.h:80
Tmatrix::VectorType VectorType
Definition mat_utils.h:61
int get_nrows() const
Definition mat_utils.h:65
void quickEuclBounds(Treal &euclLowerBound, Treal &euclUpperBound) const
Definition mat_utils.h:72
void matVecProd(Tvector &y, Tvector const &x) const
Definition mat_utils.h:84
Definition mat_utils.h:123
void getCols(SizesAndBlocks &colsCopy) const
Definition mat_utils.h:125
TripleMatrix(Tmatrix const &A_, Tmatrix2 const &Z_)
Definition mat_utils.h:142
Tmatrix const & A
Definition mat_utils.h:140
void matVecProd(VectorType &y, VectorType const &x) const
Definition mat_utils.h:144
int get_nrows() const
Definition mat_utils.h:128
void quickEuclBounds(Treal &euclLowerBound, Treal &euclUpperBound) const
Definition mat_utils.h:132
Tmatrix::VectorType VectorType
Definition mat_utils.h:124
Tmatrix2 const & Z
Definition mat_utils.h:141
Treal template_blas_sqrt(Treal x)