#include <matpackI.h>
A VectorView consists of the data, which is stored in a continuous piece of memory, and a selection, specified by start, extend, and stride. A Vector is a VectorView which also allocates its memory automatically.
VectorViews can not be generated directly, they only result from operations on Vectors, such as using the index operator with a Range object. However, you can store them, like:
VectorView A = B[Range(0,3)]
A VectorView acts like a reference to the selected region in the parent matrix. Functions that operate on an existing matrix (i.e., they do not use resize) should take VectorView x as arguement, rather than Vector& x. That has the advantage that they can be called either with a VectorView or Vector. E.g., if you have:
void fill_with_junk(VectorView x); Vector v;
then you can call the function in these two ways:
fill_with_junk(v); fill_with_junk(v[Range(1,3)])
Assignment (=) copies the data from one Vector or VectorView to another one. Dimensions must agree. Only exceptions are the copy constructors which automatically set the dimensions to match.
Things work in the same way for the type Matrix.
There exist operators *=, /=, +=, and -= to multiply (divide,...) by a scalar. Plain operators *,... do not exist, because they would result in the creation of temporaries and therefor be inefficient.
However, you can use * to compute the scalar product. This is efficient, since the return value is just a scalar.
There is a constructor for vector filling it with a sequence of values.
Matrices:
You can extract sub matrices (MatrixView) using Range objects. You can also extract rows and columns this way.
transpose(A) Returns a special MatrixView that is the transpose of the original. The original is not changed by this!
mult(A,B,C) computes A = B*C Note that the order is different from MTL (output first)!
A VectorView or Vector can be taken in the place of a nx1 matrix. That means, Vectors are interpreted as column vectors. Hence, you can compute:
Vector a(10),b(20); Matrix M(10,20);
mult(a,M,b); // a = M*b
but also, by using transpose:
mult(transpose(b),transpose(a),M); // b^t = a^t * M
See the section about Matrices and Vectors in the ARTS user guide for more details.
This class has no members. We just need a special type to indicate the joker. There is a global joker object defined somewhere:
Joker joker;
Definition at line 111 of file matpackI.h.