34 #ifndef __H__UG__SMALL_ALGEBRA__BLOCK_DENSE__
35 #define __H__UG__SMALL_ALGEBRA__BLOCK_DENSE__
47 for(
size_t r=0; r < mat.num_rows(); r++)
48 for(
size_t c=0; c < mat.num_cols(); c++)
59 for(
size_t i=0; i < v.size(); i++)
70 for(
size_t i=0; i < v.size(); i++)
84 template<
typename A,
typename B,
typename C>
87 UG_ASSERT(mat.num_cols() == vec.size(),
"");
88 dest.resize(mat.num_rows());
89 for(
size_t r=0; r < mat.num_rows(); r++)
92 for(
size_t c=1; c < mat.num_cols(); c++)
93 AddMult(dest(r), mat(r, c), vec(c));
97 template<
typename A,
typename B,
typename C>
100 UG_ASSERT(mA.num_cols() == mB.num_rows(),
"");
101 dest.resize(mA.num_rows(), mB.num_cols());
102 for(
size_t r=0; r < mA.num_rows(); r++)
103 for(
size_t c=0; c < mB.num_cols(); c++)
106 for(
size_t k=1; k < mB.num_rows(); k++)
107 AddMult(dest(r, c), mA(r, k), mB(k, c));
112 template<
typename A,
typename B,
typename C>
115 UG_ASSERT(mat.num_cols() == vec.size(),
"");
116 dest.resize(mat.num_rows());
117 for(
size_t r=0; r < mat.num_rows(); r++)
119 for(
size_t c=0; c < mat.num_cols(); c++)
120 AddMult(dest(r), mat(r, c), vec(c));
126 template<
typename A,
typename B,
typename C>
129 UG_ASSERT(mA.num_cols() == mB.num_rows(),
"");
130 UG_ASSERT(dest.num_rows()==mA.num_rows() && dest.num_cols()==mB.num_cols(),
"");
131 for(
size_t r=0; r < mA.num_rows(); r++)
132 for(
size_t c=0; c < mB.num_cols(); c++)
134 for(
size_t k=0; k < mB.num_rows(); k++)
135 AddMult(dest(r, c), mA(r, k), mB(k, c));
142 template<
typename A,
typename B,
typename C>
145 UG_ASSERT(mat.num_cols() == vec.size(),
"");
146 dest.resize(mat.num_rows());
147 for(
size_t r=0; r < mat.num_rows(); r++)
149 for(
size_t c=0; c < mat.num_cols(); c++)
150 SubMult(dest(r), mat(r, c), vec(c));
158 template<
typename A,
typename B>
161 dest.resize(mat.num_rows(), mat.num_cols());
162 for(
size_t r=0; r < mat.num_rows(); r++)
164 for(
size_t c=0; c < mat.num_cols(); c++)
169 template<
typename A,
typename B>
172 dest.resize(mat.num_rows(), mat.num_cols());
173 for(
size_t r=0; r < mat.num_rows(); r++)
175 for(
size_t c=0; c < mat.num_cols(); c++)
180 template<
typename A,
typename B>
183 dest.resize(mat.num_rows(), mat.num_cols());
184 for(
size_t r=0; r < mat.num_rows(); r++)
186 for(
size_t c=0; c < mat.num_cols(); c++)
195 template<
typename A,
typename B>
198 dest.resize(vec.size());
199 for(
size_t i=0; i<vec.size(); i++)
204 template<
typename A,
typename B>
207 dest.resize(vec.size());
208 for(
size_t i=0; i<vec.size(); i++)
213 template<
typename A,
typename B>
216 dest.resize(vec.size());
217 for(
size_t i=0; i<vec.size(); i++)
222 template<
typename A>
inline void AssignMult(A &dest,
const A &vec,
const double &b)
227 template<
typename A>
inline void AddMult(A &dest,
const A &vec,
const double &b)
232 template<
typename A>
inline void SubMult(A &dest,
const A &vec,
const double &b)
293 template<
typename T1,
typename T2>
294 struct block_multiply_traits;
296 template<
typename T1,
typename T2>
309 template<eMatrixOrdering TOrdering>
312 enum { ordering = TOrdering };
314 enum { static_num_rows = 0};
315 enum { static_num_cols = 0};
322 template<
size_t TBlockSize, eMatrixOrdering TOrdering>
325 enum { ordering = TOrdering };
327 enum { static_num_rows = TBlockSize};
328 enum { static_num_cols = TBlockSize};
336 template<
typename TValue, eMatrixOrdering TOrdering>
339 enum { ordering = TOrdering };
341 enum { static_num_rows = 0};
342 enum { static_num_cols = 0};
348 template<
typename TValue,
size_t TBlockSize, eMatrixOrdering TOrdering>
351 enum { ordering = TOrdering };
353 enum { static_num_rows = 0};
354 enum { static_num_cols = 0};
362 template<eMatrixOrdering TOrdering>
367 enum { static_num_rows = 1};
368 enum { static_num_cols = 1};
373 template<eMatrixOrdering TOrdering>
378 enum { static_num_rows = 2};
379 enum { static_num_cols = 2};
384 template<eMatrixOrdering TOrdering>
389 enum { static_num_rows = 3};
390 enum { static_num_cols = 3};
Definition: densematrix.h:57
Definition: lapack_densematrix_inverse.h:51
Definition: densevector.h:101
Definition: fixed_array.h:135
Definition: variable_array.h:139
#define UG_ASSERT(expr, msg)
Definition: assert.h:70
double number
Definition: types.h:124
size_t GetCols(const T &t)
void AssignMult(A &dest, const B &b, const C &vec)
void SubMult(A &dest, const B &b, const C &vec)
void SetSize(T &t, size_t a, size_t b)
size_t GetRows(const T &t)
number BlockMaxNorm(const T &t)
double BlockNorm2(const TYPE &v)
Definition: blocks.h:51
void AddMult(A &dest, const B &b, const C &vec)
size_t GetSize(const T &t)
DenseVector< T2 > ReturnType
Definition: block_dense.h:299
DenseMatrix< T > ReturnType
Definition: block_dense.h:398
Definition: smallalgebra_interface.h:42
DenseMatrixInverse< VariableArray2< number, TOrdering > > inverse_type
Definition: block_dense.h:357
DenseMatrix< FixedArray2< number, 1, 1, TOrdering > > inverse_type
Definition: block_dense.h:370
DenseMatrix< FixedArray2< number, 2, 2, TOrdering > > inverse_type
Definition: block_dense.h:381
DenseMatrix< FixedArray2< number, 3, 3, TOrdering > > inverse_type
Definition: block_dense.h:392
DenseMatrixInverse< FixedArray2< number, TBlockSize, TBlockSize, TOrdering > > inverse_type
Definition: block_dense.h:331
DenseMatrixInverse< VariableArray2< number, TOrdering > > inverse_type
Definition: block_dense.h:345
DenseMatrixInverse< VariableArray2< number, TOrdering > > inverse_type
Definition: block_dense.h:318
Definition: communication_policies.h:58
@ is_static
Definition: communication_policies.h:60