#include <Vec_Type.h>
Inheritance diagram for Vec(Type)::

Public Methods | |
| Vec(Type) () | |
| Vec(Type) (int length) | |
| Vec(Type) (Type *a, int n, int base=0) | |
| Vec(Type) (const Vec(Type) &X) | |
| Vec(Type) (const Vector(prm_Type) &pm) | |
| virtual | ~Vec(Type) () |
| virtual int | getNoEntries () const |
| virtual real | getStorage () const |
| virtual bool | makeItSimilar (Handle(Vector(Type)) &v) const |
| virtual bool | redim (const Vector(prm_Type) &pm) |
| bool | redim (int n) |
| bool | redim (Type *a, int n, int base=0) |
| virtual void | fill (const Vector(Type) &X) |
| virtual void | fill (const Type &a) |
| Vec(Type)& | operator= (const Vec(Type) &X) |
| Vec(Type)& | operator= (const Type &a) |
| void | fill (Type start, Type stop) |
| virtual void | assemble (const Vec(Type) &ev, const VecSimple(int) &idx_trans, int elm_no) |
| virtual void | add (const Vector(Type) &yb, const Vector(Type) &zb) |
| virtual void | add (const Vector(Type) &yb, char s, const Vector(Type) &zb) |
| virtual void | add (const Vector(Type) &yb, Type b, const Vector(Type) &zb) |
| virtual void | add (Type a, const Vector(Type) &yb, Type b, const Vector(Type) &zb) |
| virtual void | add (const Vector(Type) &y, int power, Type front_factor) |
| virtual void | add (Type value) |
| virtual void | mult (Type value) |
| virtual void | apply (Func(Type) f) |
| virtual real | norm (Norm_type lp=l2) const |
| virtual real | normDiff (const Vector(Type) &y, Norm_type lp=l2) const |
| virtual Type | inner (const Vector(Type) &yb) const |
| virtual void | randomize (real low=-1, real high=1, real seed=1) |
| virtual void | print (Os os, const char *header=NULL, int nentries_per_line=3) const |
| virtual void | printAscii (Os os, const char *header=NULL) const |
| virtual void | scan (Is is) |
| virtual void | save (const char *filename, const char *name="X") const |
| virtual void | load (const char *filename, const char *name="X") |
Friends | |
| Os& | operator<< (Os &os, const Vec(Type) &x) |
| Is& | operator>> (Is &is, Vec(Type) &x) |
NAME: Vec(Type) - one-dimensional vector with arithmetic operations (base=1)
DESCRIPTION:
The class is derived from "VecSort(Type)" and "Vector(Type)". Additional functions perform various arithmetic operations such as calculating vector norms, inner products, sum of vectors etc. For the class to have meaning, "Type" must define basic arithmetic operations such as "*", "/", "+" and "-". In addition the operators ">", "<", "==" and "!=" must be defined. If a general base is desired for the subscripting operator, the class "ArrayGen(Type)" can be used (that class can also take more than one subscript).
Since the class is also derived from "Vector(Type)", it is part of a class hierarchy of vectors. The virtual functions of this class can hence be accessed by a "Vector(Type)" pointer, or better, by a "Handle(Vector)" or "LinEqVector" object/pointer. "Vector" and "LinEqVector" are shell classes for the matrix hiearchy. Other classes in the hierarchy implement vectors represented as arbitrary-dimensional arrays, see "ArrayGen(Type)".
|
|
In addition to the standad constructor taking an integer "length" argument (see documentation of class "VecSimple(Type)"), there is a copy constructor. Moreover, the constructor accepting a "Vector_prm(Type)" object is in common for all classes derived from "Vector(Type)". |
|
|
See documentation of one of the overloaded constructor. |
|
|
See documentation of one of the overloaded constructor. |
|
|
See documentation of one of the overloaded constructor. |
|
|
See documentation of one of the overloaded constructor. |
|
|
|
|
|
See documentation of one of the overloaded functions. Reimplemented in ArrayGenSel(Type). |
|
|
See documentation of one of the overloaded functions. Reimplemented in ArrayGenSel(Type). |
|
|
See documentation of one of the overloaded functions. Reimplemented from Vector(Type). Reimplemented in ArrayGenSel(Type). |
|
|
See documentation of one of the overloaded functions. Reimplemented from Vector(Type). Reimplemented in ArrayGenSel(Type). |
|
|
See documentation of one of the overloaded functions. Reimplemented from Vector(Type). Reimplemented in ArrayGenSel(Type). |
|
|
computes a sum of vectors. Some of the vectors can be multiplied by a scalar. There are several overloaded instances (see example below). Some of the "add" functions take "Vec(Type)" objects as arguments while others, that are virtual, take "Vector(Type)" objects as arguments. The latter "add" instances are convenient in the "Vector(Type)" hierarchy of vectors. There are also global "add" functions that are not members of any class, for example one can call "add(x,y,''-'',z)", where "x", "y", "z" are "Vec(Type)", which sets "x" equal to the difference of "y" and "z". This function is defined as "x.add(y,''-'',z)". Another "add" function takes a vector `$`y`$` and an integer power "p" as argument. The numerical operation is to add "y(i)^p" to each entry in the class vector. Reimplemented from Vector(Type). Reimplemented in ArrayGenSel(Type). |
|
|
given a function pointer "f", this transformation is applied to every entry of the vector object. Reimplemented in ArrayGenSel(Type). |
|
|
adds a small vector to a large, global vector. The contributions from element "elm_no" are assembled according to the index transformation vector. The routine is useful when programming finite element methods. Reimplemented from Vector(Type). |
|
|
See documentation of one of the overloaded functions. Reimplemented in ArrayGen(Type), and ArrayGenSel(Type). |
|
|
See documentation of one of the overloaded functions. Reimplemented from Vector(Type). Reimplemented in ArrayGen(Type), and ArrayGenSel(Type). |
|
|
the version with one argument (inherited from class "VecSimple") fills all array entries with the argument value. The version with two arguments, "start" and "stop", fills the vector with values that are uniformly distributed in the closed interval from "start" to "stop" (in ascending order). Reimplemented from Vector(Type). Reimplemented in ArrayGen(Type), and ArrayGenSel(Type). |
|
|
Reimplemented in ArrayGenSel(Type). |
|
|
as a companion to the inherited function "getWork", this functions returns the storage cost of the current vector measured in Mb. Reimplemented from Vector(Type). |
|
|
computes the inner product of two vectors. If both vectors contain complex values, the complex conjugate of the first vector is used. Reimplemented from Vector(Type). Reimplemented in ArrayGenSel(Type). |
|
|
quite similar to "save", this function permits Matlab data files to be entered into the current vector object. If available, the binary format is used, otherwise it reads plain ASCII files. Reimplemented from Vector(Type). |
|
|
the "Vector(Type)" object given as input is initialized to be an imprint of the current object. This implies that the input handle "v" should be empty or refer to a vector of type "Vec(Type)". In cases where the input handle is empty, a new "Vec(Type): object is allocated and rebound to "v". Please note that this function does not copy the actual vector entries. Reimplemented from Vector(Type). Reimplemented in ArrayGen(Type), and ArrayGenSel(Type). |
|
|
all vector entries are multiplied with a given constant "value". Reimplemented from Vector(Type). Reimplemented in ArrayGenSel(Type). |
|
|
computes the norm of the vector. There are several norms available (see "enum" "Norm_type"): "l1" is the discrete
`$`L`_`1`$ norm (`$\`sum`_{`i=1`}^`n ``v`_`i`|$`), "L1" is the
(`$`(1/n)`\`sum`_{`i=1`}^`n``v`_`i`|$`), "l2" is the discrete
``v`_`i`|$`).
Reimplemented from Vector(Type). Reimplemented in ArrayGenSel(Type). |
|
|
similar to "norm", but computes the norm of the vector difference between the current object and the argument vector. Reimplemented from Vector(Type). Reimplemented in ArrayGenSel(Type). |
|
|
the version that takes another "VecSimple(Type)" as argument makes the object a copy of the vector argument, that is, the object is redimensioned according to the dimensions of "X" and thereafter each entry is set equal to the corresponding entry in "X". The version that takes a "Type" value as argument sets all the entries in the vector to have this value. Reimplemented from VecSort(Type). Reimplemented in ArrayGen(Type), and ArrayGenSel(Type). |
|
|
|
|
|
prints the contents of the vector to an "Os", see the documentation for the functions "VecSimple scan" and "VecSimple print". The specialized version "printAscii" forces ASCII output format. Reimplemented from Vector(Type). Reimplemented in ArrayGen(Type), and ArrayGenSel(Type). |
|
|
Reimplemented from Vector(Type). Reimplemented in ArrayGen(Type). |
|
|
fills the vector with random values in the closed interval from "low" to "high". Two sequences of same length will be identical if they are based on the same "seed" value. Reimplemented from Vector(Type). |
|
|
See documentation of one of the overloaded functions. Reimplemented from VecSimplest(Type). Reimplemented in ArrayGen(Type), and ArrayGenSel(Type). |
|
|
See documentation of one of the overloaded functions. Reimplemented from VecSimplest(Type). Reimplemented in ArrayGen(Type), and ArrayGenSel(Type). |
|
|
one "redim" function is inherited from class "VecSimplest" and redimensions the internal array. The other "redim" function takes a "Vector_prm(Type)" argument and is used in conjuction with a baseclass pointer to "Vector". The function enables redimensioning of any object in the "Vector" hierarchy and is typically used by equation solvers and equation system objects to redimension a vector of unknown class type. A similar function in the "Matrix" hierarchy is easier to understand. Reimplemented from Vector(Type). Reimplemented in ArrayGen(Type), and ArrayGenSel(Type). |
|
|
saves the current vector object in a file that is readable for Matlab. If available, the utilities for Matlab's internal binary data file format is used. Otherwise, the output is given as a plain ASCII file that can be loaded in Matlab. Reimplemented from Vector(Type). |
|
|
reads the contents of the vector from an "Is". The format is documented in "VecSimple scan". Reimplemented from Vector(Type). Reimplemented in ArrayGen(Type), and ArrayGenSel(Type). |
|
|
calls the function "print". Reimplemented in ArrayGenSel(Type). |
|
|
calls the function "scan". Reimplemented in ArrayGenSel(Type). |