vec(3)

NAME

vec - dense vector

DESCRIPTION

The class implements an array.
A declaration whithout any parametrers correspond to an array with a
null size:

vec<Float> x;
Here, a Float array is specified.
Note that the Float depends upon the configuration
(see . Installing}').
The constructor can be invocated whith a size parameter:

vec<Float> x(n);
Notes that the constructor can be invocated with an initializer:

vec<Float> y = x;
or

Float lambda = 1.3;
vec<Float> y = lambda;
Assignments are

x = y;
or

x = lambda;
Linear combinations are x+y, x-y, x*lambda, lambda*x, x/lambda.
Others combinations are x*y, x/y, lambda/x.
The euclidian norm is norm(x)
while dot(x,y)
denotes the euclidian scalar product,
Input/output routines overload "<<" and ">>" operators:

cin >> x;
and

cout << x;
See iorheo(3).

NOTE

Since the vec<T> class derives from the
Array<T> class, the vec class
present also a STL-like container interface.

Actually, the vec<T> implementation uses a STL
vector<T> class.

IMPLEMENTATION

template <class T>
class vec : public Array<T>
{
public:
typedef T element_type;
typedef typename Array<T>::size_type size_type;
// cstor, assignment
explicit vec (unsigned int n = 0, const T& init_value = std::numeric_limits<T>::max())
: Array<T>(n, init_value) {}
vec<T> operator = (T lambda);
// accessors
unsigned int size () const { return Array<T>::size(); }
unsigned int n () const { return size(); }
#ifdef _RHEOLEF_HAVE_EXPRESSION_TEMPLATE

template <class X>
vec(const VExpr<X>& x) : Array<T>(x.size()) { assign (*this, x); }
template <class X>
vec<T>& operator = (const VExpr<X>& x)
{ logmodif(*this); return assign (*this, x); }
#endif // _RHEOLEF_HAVE_EXPRESSION_TEMPLATE
};
// io routines
template <class T> std::istream& operator >> (std::istream&, vec<T>&);
template <class T> std::ostream& operator << (std::ostream&, const vec<T>&);

SEE ALSO

iorheo(3)
Copyright © 2010-2025 Platon Technologies, s.r.o.           Home | Man pages | tLDP | Documents | Utilities | About
Design by styleshout