36 #ifndef MAT_VECTORGENERAL 37 #define MAT_VECTORGENERAL 45 template<
typename Treal,
typename Tvector>
46 class VectorGeneral :
public FileWritable {
62 if (other.vectorPtr.haveDataStructureGet()) {
69 (std::vector<Treal>
const & fullVector,
72 this->
vectorPtr->assignFromFull(fullVector);
74 inline void fullvector(std::vector<Treal> & fullVector)
const {
79 if (other.vectorPtr.haveDataStructureGet()) {
101 template<
typename Tmatrix>
108 template<
typename Tmatrix>
111 MatrixGeneral<Treal, Tmatrix>,
114 template<
typename Tmatrix>
117 MatrixGeneral<Treal, Tmatrix>,
120 VectorGeneral<Treal, Tvector> >& smvpsv);
123 template<
typename Tmatrix>
124 VectorGeneral<Treal, Tvector>&
operator=
126 VectorGeneral<Treal, Tvector> >& mv) {
128 return this->
operator=(
XYZ<Treal, MatrixGeneral<Treal, Tmatrix>,
129 VectorGeneral<Treal, Tvector> >(ONE, mv.A, mv.B,
130 false, mv.tA, mv.tB));
135 template<
typename Tmatrix>
136 VectorGeneral<Treal, Tvector>&
operator=
139 VectorGeneral<Treal, Tvector> >& smv);
141 template<
typename Tmatrix>
142 VectorGeneral<Treal, Tvector>&
operator+=
144 MatrixSymmetric<Treal, Tmatrix>,
145 VectorGeneral<Treal, Tvector> >& smv);
147 template<
typename Tmatrix>
148 VectorGeneral<Treal, Tvector>&
operator=
150 MatrixSymmetric<Treal, Tmatrix>,
151 VectorGeneral<Treal, Tvector>,
153 VectorGeneral<Treal, Tvector> >& smvpsv);
157 template<
typename Tmatrix>
158 VectorGeneral<Treal, Tvector>&
operator=
160 VectorGeneral<Treal, Tvector> >& mv);
168 inline VectorGeneral<Treal, Tvector>&
174 inline VectorGeneral<Treal, Tvector>&
181 VectorGeneral<Treal, Tvector>&
operator+=
195 vectorPtr->writeToFile(file);
201 vectorPtr->readFromFile(file);
216 template<
typename Treal,
typename Tvector>
217 template<
typename Tmatrix>
225 if (
this == &smv.C ) {
238 template<
typename Treal,
typename Tvector>
239 template<
typename Tmatrix>
241 VectorGeneral<Treal, Tvector>::operator+=
243 MatrixGeneral<Treal, Tmatrix>,
246 assert(
this != &smv.C);
254 template<
typename Treal,
typename Tvector>
255 template<
typename Tmatrix>
257 VectorGeneral<Treal, Tvector>::operator=
259 MatrixGeneral<Treal, Tmatrix>,
262 VectorGeneral<Treal, Tvector> >& smvpsv) {
263 assert(!smvpsv.tC && !smvpsv.tE);
264 assert(
this != &smvpsv.C);
265 if (
this == &smvpsv.E)
267 *smvpsv.C.vectorPtr, smvpsv.D, *this->
vectorPtr);
269 throw Failure(
"VectorGeneral<Treal, Tvector>::operator=" 270 "(const XYZpUV<Treal, " 271 "MatrixGeneral<Treal, Tmatrix>, " 272 "VectorGeneral<Treal, Tvector>, " 274 "VectorGeneral<Treal, Tvector> >&) : " 275 "y = alpha * op(A) * x + beta * z " 276 "not supported for z != y");
283 template<
typename Treal,
typename Tvector>
284 template<
typename Tmatrix>
285 VectorGeneral<Treal, Tvector>&
286 VectorGeneral<Treal, Tvector>::operator=
289 VectorGeneral<Treal, Tvector> >& smv) {
291 assert(
this != &smv.C);
300 template<
typename Treal,
typename Tvector>
301 template<
typename Tmatrix>
302 VectorGeneral<Treal, Tvector>&
303 VectorGeneral<Treal, Tvector>::operator+=
305 MatrixSymmetric<Treal, Tmatrix>,
306 VectorGeneral<Treal, Tvector> >& smv) {
308 assert(
this != &smv.C);
315 template<
typename Treal,
typename Tvector>
316 template<
typename Tmatrix>
317 VectorGeneral<Treal, Tvector>&
318 VectorGeneral<Treal, Tvector>::operator=
320 MatrixSymmetric<Treal, Tmatrix>,
321 VectorGeneral<Treal, Tvector>,
323 VectorGeneral<Treal, Tvector> >& smvpsv) {
324 assert(!smvpsv.tC && !smvpsv.tE);
325 assert(
this != &smvpsv.C);
326 if (
this == &smvpsv.E)
328 *smvpsv.C.vectorPtr, smvpsv.D, *this->
vectorPtr);
330 throw Failure(
"VectorGeneral<Treal, Tvector>::operator=" 331 "(const XYZpUV<Treal, " 332 "MatrixSymmetric<Treal, Tmatrix>, " 333 "VectorGeneral<Treal, Tvector>, " 335 "VectorGeneral<Treal, Tvector> >&) : " 336 "y = alpha * A * x + beta * z " 337 "not supported for z != y");
344 template<
typename Treal,
typename Tvector>
345 template<
typename Tmatrix>
346 VectorGeneral<Treal, Tvector>&
347 VectorGeneral<Treal, Tvector>::operator=
349 VectorGeneral<Treal, Tvector> >& mv) {
352 throw Failure(
"y = A * x not supported for y != x ");
362 template<
typename Treal,
typename Tvector>
363 VectorGeneral<Treal, Tvector>&
364 VectorGeneral<Treal, Tvector>::operator+=
367 assert(
this != &sv.B);
378 template<
typename Treal,
typename Tvector>
380 VectorGeneral<Treal, Tvector>
const & y) {
383 "Xtrans<VectorGeneral<Treal, Tvector> > const &," 384 " VectorGeneral<Treal, Tvector> const &): " 385 "Dimension mismatch in vector operation");
void assign_from_full(std::vector< Treal > const &fullVector, SizesAndBlocks const &newRows)
Definition: VectorGeneral.h:69
VectorGeneral()
Definition: VectorGeneral.h:59
Normal matrix.
Definition: MatrixBase.h:47
ValidPtr< Tvector > vectorPtr
Definition: VectorGeneral.h:189
Proxy structs used by the matrix API.
void readFromFileProt(std::ifstream &file)
Read object from file.
Definition: VectorGeneral.h:197
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:407
Definition: MatrixBase.h:53
bool is_empty() const
Definition: VectorGeneral.h:54
Definition: allocate.cc:30
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:155
Describes dimensions of matrix and its blocks on all levels.
Definition: SizesAndBlocks.h:37
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:204
static T dot(const int *n, const T *dx, const int *incx, const T *dy, const int *incy)
Definition: mat_gblas.h:423
VectorGeneral< Treal, Tvector > & operator=(int const k)
Definition: VectorGeneral.h:175
Smart pointer class to control access to object.
Tvector const & getVector() const
Definition: VectorGeneral.h:185
This proxy expresses the result of multiplication of three objects, of possibly different types...
Definition: matrix_proxy.h:65
void writeToFileProt(std::ofstream &file) const
Write object to file.
Definition: VectorGeneral.h:191
This proxy expresses the result of transposition of an object of type TX.
Definition: matrix_proxy.h:116
static void axpy(const int *n, const T *da, const T *dx, const int *incx, T *dy, const int *incy)
Definition: mat_gblas.h:429
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:398
void rand()
Definition: VectorGeneral.h:94
void clear()
Release memory for the information written to file.
Definition: VectorGeneral.h:86
void resetSizesAndBlocks(SizesAndBlocks const &newRows)
Definition: VectorGeneral.h:49
Write and read objects to/from file.
Definition: FileWritable.h:54
VectorGeneral< Treal, Tvector > & operator=(const VectorGeneral< Treal, Tvector > &other)
Definition: VectorGeneral.h:78
VectorGeneral(const VectorGeneral< Treal, Tvector > &other)
Definition: VectorGeneral.h:60
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:389
VectorGeneral< Treal, Tvector > & operator*=(Treal const alpha)
Definition: VectorGeneral.h:169
Treal eucl() const
Definition: VectorGeneral.h:164
This proxy expresses the result of multiplication of two objects, of possibly different types...
Definition: matrix_proxy.h:49
std::string obj_type_id() const
Definition: VectorGeneral.h:187
void haveDataStructureSet(bool val)
Definition: ValidPtr.h:97
void fullvector(std::vector< Treal > &fullVector) const
Definition: VectorGeneral.h:74
Abstract class for simple writing and reading of objects to/from file.
bool haveDataStructureGet() const
Definition: ValidPtr.h:100
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
void inMemorySet(bool val)
Definition: ValidPtr.h:91