[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The TinyVector
class provides a small, lightweight vector object
whose size is known at compile time. It is included via the header
<blitz/tinyvec.h>
.
Note that TinyVector
lives in the blitz
namespace, so you will
need to refer to it as blitz::TinyVector
, or use the directive
using namespace blitz;
.
The Blitz++ Array
object uses TinyVector
internally, so if you
include <blitz/array.h>
, the TinyVector
header is automatically
included. However, to use TinyVector
expressions, you will
need to include <blitz/tinyvec-et.h>
.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The TinyVector<T,N>
class has two template parameters:
T
complex<float>
, etc.;
N
Inside the TinyVector
class, these types are declared:
T_numtype
T
)
T_vector
TinyVector<T,N>
.
iterator
constIterator
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
TinyVector(); |
TinyVector(const TinyVector<T,N>& x); |
x
are copied.
TinyVector(T value); |
value
.
TinyVector(T value1, T value2, ...); |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
TinyVector<T,N>::iterator begin(); TinyVector<T,N>::const_iterator begin() const; |
TinyVector<T,N>::iterator end(); TinyVector<T,N>::const_iterator end() const; |
T_numtype* [restrict] data(); const T_numtype* [restrict] data() const; |
int length() const; |
N
).
T_numtype operator()(int i) const; T_numtype& operator()(int i); T_numtype operator[](int i) const; T_numtype& operator[](int i); |
i
th element of the vector. If the code is compiled with
debugging enabled (-DBZ_DEBUG
), bounds checking is performed.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The assignment operators =, +=, -=, *=, /=, %=, ^=, &=, |=, >>= and <<= are
all provided. The right hand side of an assignment may be a scalar of type
T_numtype
, a TinyVector
of any type but the same size, or a
vector expression.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Expressions involving tiny vectors may contain any combination of the operators
+ - * / % ^ & | >> << |
with operands of type TinyVector, scalar, or vector expressions. The usual math functions (see the Array documentation) are supported on TinyVector.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
dot(TinyVector, TinyVector); dot(vector-expr, TinyVector); dot(TinyVector, vector-expr); dot(vector-expr, vector-expr); |
TinyVector
s
(or vector expressions). The result is a scalar; the type
of the scalar follows the usual type promotion rules.
product(TinyVector); |
sum(TinyVector); |
TinyVector<T,3> cross(TinyVector<T,3> x, TinyVector<T,3> y); |
x
and y
.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
TinyVector
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
ostream& operator<<(ostream&, const TinyVector<T,N>& x); |
TinyVector
onto a stream. Here's
an illustration of the format for a length 3 vector:
[ 0.5 0.2 0.9 ] |
[ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |