38#ifndef MAT_VECTORGENERAL
39#define MAT_VECTORGENERAL
47 template<
typename Treal,
typename Tvector>
70#if __cplusplus >= 201103L
83 (std::vector<Treal>
const & fullVector,
86 this->
vectorPtr->assignFromFull(fullVector);
88 inline void fullvector(std::vector<Treal> & fullVector)
const {
115 template<
typename Tmatrix>
122 template<
typename Tmatrix>
128 template<
typename Tmatrix>
137 template<
typename Tmatrix>
144 false, mv.tA, mv.tB));
149 template<
typename Tmatrix>
155 template<
typename Tmatrix>
161 template<
typename Tmatrix>
171 template<
typename Tmatrix>
230 template<
typename Treal,
typename Tvector>
231 template<
typename Tmatrix>
232 VectorGeneral<Treal, Tvector>&
239 if (
this == &smv.C ) {
242 Tvector::gemv(smv.tB, smv.A, smv.B.getMatrix(),
246 Tvector::gemv(smv.tB, smv.A, smv.B.getMatrix(),
247 *smv.C.vectorPtr, 0, *this->vectorPtr);
252 template<
typename Treal,
typename Tvector>
253 template<
typename Tmatrix>
260 assert(
this != &smv.C);
261 Tvector::gemv(smv.tB, smv.A, smv.B.getMatrix(),
262 *smv.C.vectorPtr, 1, *this->vectorPtr);
268 template<
typename Treal,
typename Tvector>
269 template<
typename Tmatrix>
277 assert(!smvpsv.tC && !smvpsv.tE);
278 assert(
this != &smvpsv.C);
279 if (
this == &smvpsv.E)
280 Tvector::gemv(smvpsv.tB, smvpsv.A, smvpsv.B.getMatrix(),
281 *smvpsv.C.vectorPtr, smvpsv.D, *this->vectorPtr);
283 throw Failure(
"VectorGeneral<Treal, Tvector>::operator="
284 "(const XYZpUV<Treal, "
285 "MatrixGeneral<Treal, Tmatrix>, "
286 "VectorGeneral<Treal, Tvector>, "
288 "VectorGeneral<Treal, Tvector> >&) : "
289 "y = alpha * op(A) * x + beta * z "
290 "not supported for z != y");
297 template<
typename Treal,
typename Tvector>
298 template<
typename Tmatrix>
305 assert(
this != &smv.C);
307 Tvector::symv(
'U', smv.A, smv.B.getMatrix(),
308 *smv.C.vectorPtr, 0, *this->vectorPtr);
314 template<
typename Treal,
typename Tvector>
315 template<
typename Tmatrix>
322 assert(
this != &smv.C);
323 Tvector::symv(
'U', smv.A, smv.B.getMatrix(),
324 *smv.C.vectorPtr, 1, *this->vectorPtr);
329 template<
typename Treal,
typename Tvector>
330 template<
typename Tmatrix>
338 assert(!smvpsv.tC && !smvpsv.tE);
339 assert(
this != &smvpsv.C);
340 if (
this == &smvpsv.E)
341 Tvector::symv(
'U', smvpsv.A, smvpsv.B.getMatrix(),
342 *smvpsv.C.vectorPtr, smvpsv.D, *this->vectorPtr);
344 throw Failure(
"VectorGeneral<Treal, Tvector>::operator="
345 "(const XYZpUV<Treal, "
346 "MatrixSymmetric<Treal, Tmatrix>, "
347 "VectorGeneral<Treal, Tvector>, "
349 "VectorGeneral<Treal, Tvector> >&) : "
350 "y = alpha * A * x + beta * z "
351 "not supported for z != y");
358 template<
typename Treal,
typename Tvector>
359 template<
typename Tmatrix>
366 throw Failure(
"y = A * x not supported for y != x ");
367 Tvector::trmv(
'U', mv.tA,
376 template<
typename Treal,
typename Tvector>
381 assert(
this != &sv.B);
382 Tvector::axpy(sv.A, *sv.B.vectorPtr, *this->vectorPtr);
392 template<
typename Treal,
typename Tvector>
397 "Xtrans<VectorGeneral<Treal, Tvector> > const &,"
398 " VectorGeneral<Treal, Tvector> const &): "
399 "Dimension mismatch in vector operation");
400 return Tvector::dot(xT.A.getVector(), y.
getVector());
Abstract class for simple writing and reading of objects to/from file.
Smart pointer class to control access to object.
FileWritable()
Gives each object a unique ID-number and filename.
Definition FileWritable.cc:371
Normal matrix.
Definition MatrixGeneral.h:59
Symmetric matrix.
Definition MatrixSymmetric.h:68
Describes dimensions of matrix and its blocks on all levels.
Definition SizesAndBlocks.h:45
Smart pointer class to control access to object.
Definition ValidPtr.h:50
bool haveDataStructureGet() const
Definition ValidPtr.h:102
Definition VectorGeneral.h:48
Treal eucl() const
Definition VectorGeneral.h:178
VectorGeneral< Treal, Tvector > & operator=(const VectorGeneral< Treal, Tvector > &other)
Definition VectorGeneral.h:92
void fullvector(std::vector< Treal > &fullVector) const
Definition VectorGeneral.h:88
VectorGeneral(SizesAndBlocks const &newRows)
Definition VectorGeneral.h:64
ValidPtr< typename Tmatrix::VectorType > vectorPtr
Definition VectorGeneral.h:203
void clear_structure()
Definition VectorGeneral.h:60
VectorGeneral()
Definition VectorGeneral.h:67
void resetSizesAndBlocks(SizesAndBlocks const &newRows)
Definition VectorGeneral.h:51
void assign_from_full(std::vector< Treal > const &fullVector, SizesAndBlocks const &newRows)
Definition VectorGeneral.h:83
VectorGeneral< Treal, Tvector > & operator*=(Treal const alpha)
Definition VectorGeneral.h:183
VectorGeneral(const VectorGeneral< Treal, Tvector > &other)
Definition VectorGeneral.h:73
void readFromFileProt(std::ifstream &file)
Read object from file.
Definition VectorGeneral.h:211
bool is_empty() const
Definition VectorGeneral.h:56
void inMemorySet(bool inMem)
Make object invalid (false) via this function when object is written to file and valid (true) when ob...
Definition VectorGeneral.h:218
VectorGeneral< Treal, Tvector > & operator=(int const k)
Definition VectorGeneral.h:189
void rand()
Definition VectorGeneral.h:108
std::string obj_type_id() const
Definition VectorGeneral.h:201
void clear()
Release memory for the information written to file.
Definition VectorGeneral.h:100
Tvector const & getVector() const
Definition VectorGeneral.h:199
void writeToFileProt(std::ofstream &file) const
Write object to file.
Definition VectorGeneral.h:205
Proxy structs used by the matrix API.
Definition allocate.cc:39
const Treal Matrix< Treal >::ONE
Definition Matrix.h:3448
XY< TX, TY > operator*(Xtrans< TX > const &trAA, Xtrans< TY > const &trBB)
Multiplication of two transposition proxys holding objects of type TX and TY respectively.
Definition matrix_proxy.h:157
This proxy expresses the result of multiplication of three objects, of possibly different types,...
Definition matrix_proxy.h:67
This proxy expresses the result of multiplication of three objects added to two other multiplied obje...
Definition matrix_proxy.h:88
This proxy expresses the result of multiplication of two objects, of possibly different types,...
Definition matrix_proxy.h:51
This proxy expresses the result of transposition of an object of type TX.
Definition matrix_proxy.h:118