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";
98 for (
Index i=0; i<
M.nrows(); ++i)
99 for (
Index j=0; j<
M.ncols(); ++j)
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";
161 cout <<
"a = \n" << a <<
"\n";
162 cout <<
"b = \n" << b <<
"\n";
163 cout <<
"a*b \n= " << a*b <<
"\n";
175 cout <<
"\nB*C =\n" << A <<
"\n";
189 cout <<
"b = \n" << b <<
"\n";
190 cout <<
"M =\n" <<
M <<
"\n";
193 cout <<
"\na = M*b = \n" << a <<
"\n";
208 cout <<
"Transforming.\n";
212 for (
Index i=0; i<1000; ++i)
228 cout <<
"min(sin(x)), max(sin(x)) = " <<
min(y) <<
", " <<
max(y) <<
"\n";
236 cout <<
"Done." <<
"\n";
244 cout <<
"B = " << B <<
"\n";
255 cout <<
"M = " <<
M <<
"\n";
267 cout <<
"M = " <<
M <<
"\n";
281 cout <<
"sb = \n" << sb <<
"\n";
285 cout <<
"sc = \n" << sc <<
"\n";
297 cout <<
"M = \n" <<
M <<
"\n";
305 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);
306 cout <<
"a = \n" << a <<
"\n";
307 cout <<
"b = \n" << b <<
"\n";
308 cout <<
"c = \n" << c <<
"\n";
314 String a =
"Nur ein Test.";
315 cout <<
"a = " << a <<
"\n";
317 cout <<
"b = " << b <<
"\n";
338 cout <<
"a.sum() = " << a.
sum() <<
"\n";
346 cout <<
"a *= a =\n" << a <<
"\n";
357 cout <<
"a =\n" << a <<
"\n";
358 cout <<
"b =\n" << b <<
"\n";
365 cout <<
"a =\n" << a <<
"\n";
372 cout <<
"By reference:\n";
373 for (
Index i=0; i<1e8; ++i )
378 cout <<
"s = " << s <<
"\n";
385 cout <<
"By value:\n";
386 for (
Index i=0; i<1e8; ++i )
391 cout <<
"s = " << s <<
"\n";
398 cout <<
"a =\n" << a <<
"\n";
400 cout <<
"b =\n" << b <<
"\n";
409 cout <<
"a*=b =\n" << a <<
"\n";
411 cout <<
"a/=b =\n" << a <<
"\n";
413 cout <<
"a+=b =\n" << a <<
"\n";
415 cout <<
"a-=b =\n" << a <<
"\n";
421 MakeArray<Index> a(1,2,3,4,5,6,5,4,3,2,1);
422 cout <<
"min/max of a = " <<
min(a) <<
"/" <<
max(a) <<
"\n";
427 cout <<
"Test filling constructor for Array:\n";
429 cout <<
"a =\n" << a <<
"\n";
434 cout <<
"Test Arrays of Vectors:\n";
437 a.push_back(
Vector(1.0,10,1.0));
438 cout <<
"a =\n" << a <<
"\n";
443 cout <<
"Test default constructor for Matrix:\n";
446 cout <<
"b =\n" << b <<
"\n";
451 cout <<
"Test Arrays of Matrix:\n";
471 cout <<
"a =\n" << a <<
"\n";
476 cout <<
"Test Matrices of size 0:\n";
481 cout <<
"a =\n" << a <<
"\n";
487 cout <<
"b =\n" << b <<
"\n";
493 cout <<
"c =\n" << c <<
"\n";
498 cout <<
"Test Tensor3:\n";
510 cout <<
"a =\n" << a <<
"\n";
512 cout <<
"Taking out first row of first page:\n"
515 cout <<
"Taking out last column of second page:\n"
518 cout <<
"Taking out the first letter on every page:\n"
521 cout <<
"Taking out first page:\n"
524 cout <<
"Taking out last row of all pages:\n"
527 cout <<
"Taking out second column of all pages:\n"
532 cout <<
"After element-vise multiplication with 2:\n"
537 cout <<
"After taking the square-root:\n"
541 cout <<
"Let's allocate a large tensor, "
542 << (
Numeric)(s*s*s*8)/1024./1024.
547 cout <<
"Set it to 1...\n";
551 cout <<
"a(900,900,900) = " << a(90,90,90) <<
"\n";
555 cout <<
"Fill with running numbers, using for loops...\n";
556 for (
Index i=0; i<a.npages(); ++i )
557 for (
Index j=0; j<a.nrows(); ++j )
558 for (
Index k=0; k<a.ncols(); ++k )
561 cout <<
"Max(a) = ...\n";
563 cout <<
max(a) <<
"\n";
569 cout <<
"Test von X = A*X:\n";
570 Matrix X(3,3),A(3,3),B(3,3);
572 for (
Index j=0; j<A.nrows(); ++j )
573 for (
Index k=0; k<A.ncols(); ++k )
578 cout <<
"A:\n" << A <<
"\n";
579 cout <<
"X:\n" << X <<
"\n";
582 cout <<
"B = A*X:\n" << B <<
"\n";
584 cout <<
"X = A*X:\n" << X <<
"\n";
586 cout <<
"This is not the same, and should not be, because you\n"
587 <<
"are not allowed to use the same matrix as input and output\n"
593 cout <<
"Making things look bigger than they are...\n";
596 cout <<
"1. Make a scalar look like a vector:\n";
599 cout <<
"a, viewed as a vector: " << av <<
"\n";
600 cout <<
"Describe a: " <<
describe(a) <<
"\n";
602 cout <<
"a, after the first element\n"
603 <<
"of the vector has been increased by 1: " << a <<
"\n";
607 cout <<
"\n2. Make a vector look like a matrix:\n"
608 <<
"This is an exception, because the new dimension is added at the end.\n";
611 cout <<
"a, viewed as a matrix:\n" << am <<
"\n";
612 cout <<
"Trasnpose view:\n" <<
transpose(am) <<
"\n";
615 cout <<
"\n3. Make a matrix look like a tensor3:\n";
617 cout <<
"at3 = \n" << at3 <<
"\n";
618 cout <<
"Describe at3: " <<
describe(at3) <<
"\n";
620 cout <<
"a after Increasing element at3(0,2,0) by 1: \n" << a <<
"\n\n";
623 cout <<
"at4 = \n" << at4 <<
"\n";
624 cout <<
"Describe at4: " <<
describe(at4) <<
"\n";
627 cout <<
"at5 = \n" << at5 <<
"\n";
628 cout <<
"Describe at5: " <<
describe(at5) <<
"\n";
631 cout <<
"at6 = \n" << at6 <<
"\n";
632 cout <<
"Describe at6: " <<
describe(at6) <<
"\n";
635 cout <<
"at7 = \n" << at7 <<
"\n";
636 cout <<
"Describe at7: " <<
describe(at7) <<
"\n";
638 at7(0,0,0,0,0,2,0) -=1 ;
640 cout <<
"After subtracting 1 from at7(0,0,0,0,0,2,0)\n"
641 <<
"a = " << a <<
"\n";
643 cout <<
"\nAll in one go:\n";
657 cout <<
"bt7:\n" << bt7 <<
"\n";
658 cout <<
"Describe bt7: " <<
describe(bt7) <<
"\n";
664 cout <<
"Describe a: " <<
describe(a) <<
"\n";
669 cout <<
"Describe a: " <<
describe(a) <<
"\n";
674 cout <<
"Test, if dimension expansion works implicitly.\n";
685 cout <<
"Test the new copy semantics.\n";
690 cout <<
"b = " << b <<
"\n";
695 cout <<
"b = " << b <<
"\n";
700 cout <<
"b = " << b <<
"\n";
705 cout <<
"Test using naked joker on Vector.\n";
708 cout <<
"a = " << a <<
"\n";
709 cout <<
"b = " << b <<
"\n";
714 Vector v1(5e-15, 10, 0.42e-15/11);
736 cout << endl <<
"========================" << endl << endl;
744 cout << endl <<
"========================" << endl << endl;
783 cout <<
"Vector: " << v1 << endl;
784 cout <<
"VectorView: " << vv << endl;
788 }
catch (runtime_error e) {
789 cerr << e.what() << endl;
793 cout <<
"VectorView: " << vv << endl;
794 cout <<
"Vector: " << v1 << endl;
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...
The declarations of all the exception classes.
Header file for describe.cc.
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.
Index npages() const
Returns the number of pages.
void mult(VectorView y, const ConstMatrixView &M, const ConstVectorView &x)
Matrix Vector multiplication.
string describe(ConstTensor7View x)
Describe Tensor7.
Index ncols() const
Returns the number of columns.
The implementation for String, the ARTS string class.
Index nelem() const
Returns the number of elements.
Numeric sum() const
The sum of all elements of a Vector.
NUMERIC Numeric
The type to use for all floating point numbers.
void junk2(ConstVectorView a)
Implements the class MakeArray, which is a derived class of Array, allowing explicit initialization.
ConstMatrixView transpose(ConstMatrixView m)
Const version of transpose.
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.
void junk4(Tensor4View a)
Index ncols() const
Returns the number of columns.
Header file for sparse matrices.
Explicit construction of Arrays.
void fill_with_junk(VectorView x)
INDEX Index
The type to use for all integer numbers and indices.
const Numeric * get_c_array() const
Conversion to plain C-array.
void test37(const Index &i)
Numeric by_value(Numeric x)
const Numeric * get_c_array() const
Conversion to plain C-array.
A constant view of a Vector.
Index nelem() const
Number of elements.
const Numeric * get_c_array() const
Conversion to plain C-array.
This file contains the definition of String, the ARTS string class.