Go to the documentation of this file.
55 cout <<
"v.nelem() = " << v.
nelem() <<
"\n";
60 cout <<
"v.begin() = " << *v.
begin() <<
"\n";
62 cout <<
"v = \n" << v <<
"\n";
69 cout <<
"v2 = \n" << v2 <<
"\n";
71 for (
Index i=0 ; i<1000; ++i)
81 cout <<
"v = \n" << v <<
"\n";
82 cout <<
"v2 = \n" << v2 <<
"\n";
83 cout <<
"v2.nelem() = \n" << v2.
nelem() <<
"\n";
89 cout <<
"\nv3 = \n" << v3 <<
"\n";
91 cout <<
"\nv3 after junking v2 = \n" << v3 <<
"\n";
93 cout <<
"\nv3 after *2 = \n" << v3 <<
"\n";
103 cout <<
"\nM =\n" << M <<
"\n";
105 cout <<
"\nM(Range(2,4),Range(2,4)) =\n" << M(
Range(2,4),
Range(2,4)) <<
"\n";
107 cout <<
"\nM(Range(2,4),Range(2,4))(Range(1,2),Range(1,2)) =\n"
110 cout <<
"\nM(1,Range(joker)) =\n" << M(1,
Range(
joker)) <<
"\n";
112 cout <<
"\nFilling M(1,Range(1,2)) with junk.\n";
115 cout <<
"\nM(Range(0,4),Range(0,4)) =\n" << M(
Range(0,4),
Range(0,4)) <<
"\n";
117 cout <<
"\nFilling M(Range(4,2,2),Range(6,3)) with junk.\n";
122 cout <<
"\nM =\n" << M <<
"\n";
126 cout <<
"\nC(Range(3,4,2),Range(2,3,3)) =\n"
129 cout <<
"\nC(Range(3,4,2),Range(2,3,3)).transpose() =\n"
139 cout <<
"v.nelem() = " << v.
nelem() <<
"\n";
181 cout <<
"a = \n" << a <<
"\n";
182 cout <<
"b = \n" << b <<
"\n";
183 cout <<
"a*b \n= " << a*b <<
"\n";
195 cout <<
"\nB*C =\n" << A <<
"\n";
209 cout <<
"b = \n" << b <<
"\n";
210 cout <<
"M =\n" << M <<
"\n";
213 cout <<
"\na = M*b = \n" << a <<
"\n";
216 cout <<
"\nb^t = a^t * M = \n" <<
transpose(b) <<
"\n";
228 cout <<
"Transforming.\n";
232 for (
Index i=0; i<1000; ++i)
248 cout <<
"min(sin(x)), max(sin(x)) = " <<
min(y) <<
", " <<
max(y) <<
"\n";
256 cout <<
"Done." <<
"\n";
264 cout <<
"B = " << B <<
"\n";
275 cout <<
"M = " << M <<
"\n";
287 cout <<
"M = " << M <<
"\n";
301 cout <<
"sb = \n" << sb <<
"\n";
305 cout <<
"sc = \n" << sc <<
"\n";
317 cout <<
"M = \n" << M <<
"\n";
325 Array<Numeric> c =
MakeArray<Numeric>(1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0);
326 cout <<
"a = \n" << a <<
"\n";
327 cout <<
"b = \n" << b <<
"\n";
328 cout <<
"c = \n" << c <<
"\n";
334 String a =
"Nur ein Test.";
335 cout <<
"a = " << a <<
"\n";
337 cout <<
"b = " << b <<
"\n";
350 cout <<
"b =\n" << b <<
"\n";
351 cout <<
"a =\n" << a <<
"\n";
358 cout <<
"a.sum() = " << a.
sum() <<
"\n";
366 cout <<
"a *= a =\n" << a <<
"\n";
377 cout <<
"a =\n" << a <<
"\n";
378 cout <<
"b =\n" << b <<
"\n";
385 cout <<
"a =\n" << a <<
"\n";
392 cout <<
"By reference:\n";
393 for (
Index i=0; i<1e8; ++i )
398 cout <<
"s = " << s <<
"\n";
405 cout <<
"By value:\n";
406 for (
Index i=0; i<1e8; ++i )
411 cout <<
"s = " << s <<
"\n";
418 cout <<
"a =\n" << a <<
"\n";
420 cout <<
"b =\n" << b <<
"\n";
429 cout <<
"a*=b =\n" << a <<
"\n";
431 cout <<
"a/=b =\n" << a <<
"\n";
433 cout <<
"a+=b =\n" << a <<
"\n";
435 cout <<
"a-=b =\n" << a <<
"\n";
441 MakeArray<Index> a(1,2,3,4,5,6,5,4,3,2,1);
442 cout <<
"min/max of a = " <<
min(a) <<
"/" <<
max(a) <<
"\n";
447 cout <<
"Test filling constructor for Array:\n";
449 cout <<
"a =\n" << a <<
"\n";
454 cout <<
"Test Arrays of Vectors:\n";
457 a.push_back(
Vector(1.0,10,1.0));
458 cout <<
"a =\n" << a <<
"\n";
463 cout <<
"Test default constructor for Matrix:\n";
466 cout <<
"b =\n" << b <<
"\n";
471 cout <<
"Test Arrays of Matrix:\n";
491 cout <<
"a =\n" << a <<
"\n";
496 cout <<
"Test Matrices of size 0:\n";
501 cout <<
"a =\n" << a <<
"\n";
507 cout <<
"b =\n" << b <<
"\n";
513 cout <<
"c =\n" << c <<
"\n";
518 cout <<
"Test Tensor3:\n";
530 cout <<
"a =\n" << a <<
"\n";
532 cout <<
"Taking out first row of first page:\n"
535 cout <<
"Taking out last column of second page:\n"
538 cout <<
"Taking out the first letter on every page:\n"
541 cout <<
"Taking out first page:\n"
544 cout <<
"Taking out last row of all pages:\n"
547 cout <<
"Taking out second column of all pages:\n"
552 cout <<
"After element-vise multiplication with 2:\n"
557 cout <<
"After taking the square-root:\n"
561 cout <<
"Let's allocate a large tensor, "
562 << (
Numeric)(s*s*s)*8/1024./1024.
567 cout <<
"Set it to 1...\n";
571 cout <<
"a(900,900,900) = " << a(90,90,90) <<
"\n";
575 cout <<
"Fill with running numbers, using for loops...\n";
576 for (
Index i=0; i<a.npages(); ++i )
577 for (
Index j=0; j<a.nrows(); ++j )
578 for (
Index k=0; k<a.ncols(); ++k )
581 cout <<
"Max(a) = ...\n";
583 cout <<
max(a) <<
"\n";
void transform(VectorView y, double(&my_func)(double), ConstVectorView x)
A generic transform function for vectors, which can be used to implement mathematical functions opera...
ConstMatrixView transpose(ConstMatrixView m)
Const version of transpose.
void resize(Index n)
Resize function.
Numeric by_reference(const Numeric &x)
Index nrows() const
Returns the number of rows.
This file contains the definition of Array.
void mult(VectorView y, const ConstMatrixView &M, const ConstVectorView &x)
Matrix Vector multiplication.
Index npages() const
Returns the number of pages.
Joker joker
Define the global joker objekt.
Index ncols() const
Returns the number of columns.
NUMERIC Numeric
The type to use for all floating point numbers.
Index nelem() const
Returns the number of elements.
Numeric sum() const
The sum of all elements of a Vector.
Contains declerations of basic mathematical and vector/matrix functions.
Implements the class MakeArray, which is a derived class of Array, allowing explicit initialization.
The class MakeVector is a special kind of Vector that can be initialized explicitly from one or more ...
void resize(Index r, Index c)
Resize function.
ConstIterator1D begin() const
Return const iterator to first element.
Index nrows() const
Returns the number of rows.
INDEX Index
The type to use for all integer numbers and indices.
Implementation of Matrix, Vector, and such stuff.
Index ncols() const
Returns the number of columns.
Explicit construction of Arrays.
void fill_with_junk(VectorView x)
Numeric by_value(Numeric x)
Index nelem() const
Number of elements.
This file contains the definition of String, the ARTS string class.