38 #ifndef MAT_VECTORGENERAL 39 #define MAT_VECTORGENERAL 47 template<
typename Treal,
typename Tvector>
48 class VectorGeneral :
public FileWritable {
70 if (other.vectorPtr.haveDataStructureGet()) {
77 (std::vector<Treal>
const & fullVector,
80 this->
vectorPtr->assignFromFull(fullVector);
82 inline void fullvector(std::vector<Treal> & fullVector)
const {
87 if (other.vectorPtr.haveDataStructureGet()) {
109 template<
typename Tmatrix>
116 template<
typename Tmatrix>
119 MatrixGeneral<Treal, Tmatrix>,
122 template<
typename Tmatrix>
125 MatrixGeneral<Treal, Tmatrix>,
128 VectorGeneral<Treal, Tvector> >& smvpsv);
131 template<
typename Tmatrix>
132 VectorGeneral<Treal, Tvector>&
operator=
134 VectorGeneral<Treal, Tvector> >& mv) {
136 return this->
operator=(
XYZ<Treal, MatrixGeneral<Treal, Tmatrix>,
137 VectorGeneral<Treal, Tvector> >(ONE, mv.A, mv.B,
138 false, mv.tA, mv.tB));
143 template<
typename Tmatrix>
144 VectorGeneral<Treal, Tvector>&
operator=
147 VectorGeneral<Treal, Tvector> >& smv);
149 template<
typename Tmatrix>
150 VectorGeneral<Treal, Tvector>&
operator+=
152 MatrixSymmetric<Treal, Tmatrix>,
153 VectorGeneral<Treal, Tvector> >& smv);
155 template<
typename Tmatrix>
156 VectorGeneral<Treal, Tvector>&
operator=
158 MatrixSymmetric<Treal, Tmatrix>,
159 VectorGeneral<Treal, Tvector>,
161 VectorGeneral<Treal, Tvector> >& smvpsv);
165 template<
typename Tmatrix>
166 VectorGeneral<Treal, Tvector>&
operator=
168 VectorGeneral<Treal, Tvector> >& mv);
176 inline VectorGeneral<Treal, Tvector>&
182 inline VectorGeneral<Treal, Tvector>&
189 VectorGeneral<Treal, Tvector>&
operator+=
203 vectorPtr->writeToFile(file);
209 vectorPtr->readFromFile(file);
224 template<
typename Treal,
typename Tvector>
225 template<
typename Tmatrix>
233 if (
this == &smv.C ) {
246 template<
typename Treal,
typename Tvector>
247 template<
typename Tmatrix>
249 VectorGeneral<Treal, Tvector>::operator+=
251 MatrixGeneral<Treal, Tmatrix>,
254 assert(
this != &smv.C);
262 template<
typename Treal,
typename Tvector>
263 template<
typename Tmatrix>
265 VectorGeneral<Treal, Tvector>::operator=
267 MatrixGeneral<Treal, Tmatrix>,
270 VectorGeneral<Treal, Tvector> >& smvpsv) {
271 assert(!smvpsv.tC && !smvpsv.tE);
272 assert(
this != &smvpsv.C);
273 if (
this == &smvpsv.E)
275 *smvpsv.C.vectorPtr, smvpsv.D, *this->
vectorPtr);
277 throw Failure(
"VectorGeneral<Treal, Tvector>::operator=" 278 "(const XYZpUV<Treal, " 279 "MatrixGeneral<Treal, Tmatrix>, " 280 "VectorGeneral<Treal, Tvector>, " 282 "VectorGeneral<Treal, Tvector> >&) : " 283 "y = alpha * op(A) * x + beta * z " 284 "not supported for z != y");
291 template<
typename Treal,
typename Tvector>
292 template<
typename Tmatrix>
293 VectorGeneral<Treal, Tvector>&
294 VectorGeneral<Treal, Tvector>::operator=
297 VectorGeneral<Treal, Tvector> >& smv) {
299 assert(
this != &smv.C);
308 template<
typename Treal,
typename Tvector>
309 template<
typename Tmatrix>
310 VectorGeneral<Treal, Tvector>&
311 VectorGeneral<Treal, Tvector>::operator+=
313 MatrixSymmetric<Treal, Tmatrix>,
314 VectorGeneral<Treal, Tvector> >& smv) {
316 assert(
this != &smv.C);
323 template<
typename Treal,
typename Tvector>
324 template<
typename Tmatrix>
325 VectorGeneral<Treal, Tvector>&
326 VectorGeneral<Treal, Tvector>::operator=
328 MatrixSymmetric<Treal, Tmatrix>,
329 VectorGeneral<Treal, Tvector>,
331 VectorGeneral<Treal, Tvector> >& smvpsv) {
332 assert(!smvpsv.tC && !smvpsv.tE);
333 assert(
this != &smvpsv.C);
334 if (
this == &smvpsv.E)
336 *smvpsv.C.vectorPtr, smvpsv.D, *this->
vectorPtr);
338 throw Failure(
"VectorGeneral<Treal, Tvector>::operator=" 339 "(const XYZpUV<Treal, " 340 "MatrixSymmetric<Treal, Tmatrix>, " 341 "VectorGeneral<Treal, Tvector>, " 343 "VectorGeneral<Treal, Tvector> >&) : " 344 "y = alpha * A * x + beta * z " 345 "not supported for z != y");
352 template<
typename Treal,
typename Tvector>
353 template<
typename Tmatrix>
354 VectorGeneral<Treal, Tvector>&
355 VectorGeneral<Treal, Tvector>::operator=
357 VectorGeneral<Treal, Tvector> >& mv) {
360 throw Failure(
"y = A * x not supported for y != x ");
370 template<
typename Treal,
typename Tvector>
371 VectorGeneral<Treal, Tvector>&
372 VectorGeneral<Treal, Tvector>::operator+=
375 assert(
this != &sv.B);
386 template<
typename Treal,
typename Tvector>
388 VectorGeneral<Treal, Tvector>
const & y) {
391 "Xtrans<VectorGeneral<Treal, Tvector> > const &," 392 " VectorGeneral<Treal, Tvector> const &): " 393 "Dimension mismatch in vector operation");
void assign_from_full(std::vector< Treal > const &fullVector, SizesAndBlocks const &newRows)
Definition: VectorGeneral.h:77
VectorGeneral()
Definition: VectorGeneral.h:67
Normal matrix.
Definition: MatrixBase.h:49
std::string obj_type_id() const
Definition: VectorGeneral.h:195
ValidPtr< Tvector > vectorPtr
Definition: VectorGeneral.h:197
Proxy structs used by the matrix API.
void fullvector(std::vector< Treal > &fullVector) const
Definition: VectorGeneral.h:82
void readFromFileProt(std::ifstream &file)
Read object from file.
Definition: VectorGeneral.h:205
static void trmv(const char *uplo, const char *trans, const char *diag, const int *n, const T *A, const int *lda, T *x, const int *incx)
Definition: mat_gblas.h:409
Definition: MatrixBase.h:55
Definition: allocate.cc:39
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
Describes dimensions of matrix and its blocks on all levels.
Definition: SizesAndBlocks.h:45
void clear_structure()
Definition: VectorGeneral.h:60
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:212
static T dot(const int *n, const T *dx, const int *incx, const T *dy, const int *incy)
Definition: mat_gblas.h:425
VectorGeneral< Treal, Tvector > & operator=(int const k)
Definition: VectorGeneral.h:183
Smart pointer class to control access to object.
bool haveDataStructureGet() const
Definition: ValidPtr.h:102
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 transposition of an object of type TX.
Definition: matrix_proxy.h:118
bool is_empty() const
Definition: VectorGeneral.h:56
static void axpy(const int *n, const T *da, const T *dx, const int *incx, T *dy, const int *incy)
Definition: mat_gblas.h:431
static void symv(const char *uplo, const int *n, const T *alpha, const T *A, const int *lda, const T *x, const int *incx, const T *beta, T *y, const int *incy)
Definition: mat_gblas.h:400
void rand()
Definition: VectorGeneral.h:102
void clear()
Release memory for the information written to file.
Definition: VectorGeneral.h:94
void resetSizesAndBlocks(SizesAndBlocks const &newRows)
Definition: VectorGeneral.h:51
Write and read objects to/from file.
Definition: FileWritable.h:56
VectorGeneral< Treal, Tvector > & operator=(const VectorGeneral< Treal, Tvector > &other)
Definition: VectorGeneral.h:86
VectorGeneral(const VectorGeneral< Treal, Tvector > &other)
Definition: VectorGeneral.h:68
VectorGeneral(SizesAndBlocks const &newRows)
Definition: VectorGeneral.h:64
Treal eucl() const
Definition: VectorGeneral.h:172
static void gemv(const char *ta, const int *m, const int *n, const T *alpha, const T *A, const int *lda, const T *x, const int *incx, const T *beta, T *y, const int *incy)
Definition: mat_gblas.h:391
VectorGeneral< Treal, Tvector > & operator*=(Treal const alpha)
Definition: VectorGeneral.h:177
Tvector const & getVector() const
Definition: VectorGeneral.h:193
This proxy expresses the result of multiplication of two objects, of possibly different types...
Definition: matrix_proxy.h:51
void haveDataStructureSet(bool val)
Definition: ValidPtr.h:99
Abstract class for simple writing and reading of objects to/from file.
void writeToFileProt(std::ofstream &file) const
Write object to file.
Definition: VectorGeneral.h:199
Symmetric matrix.
Definition: MatrixBase.h:51
This proxy expresses the result of multiplication of three objects added to two other multiplied obje...
Definition: matrix_proxy.h:88
void inMemorySet(bool val)
Definition: ValidPtr.h:93