ARTS  2.0.49
test_matpack.cc
Go to the documentation of this file.
1 /* Copyright (C) 2001-2008 Stefan Buehler <sbuehler@ltu.se>
2 
3  This program is free software; you can redistribute it and/or modify it
4  under the terms of the GNU General Public License as published by the
5  Free Software Foundation; either version 2, or (at your option) any
6  later version.
7 
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with this program; if not, write to the Free Software
15  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
16  USA. */
17 
18 #include <cmath>
19 #include <iostream>
20 #include <cstdlib>
21 #include "matpackVII.h"
22 #include "exceptions.h"
23 #include "array.h"
24 #include "make_array.h"
25 #include "mystring.h"
26 #include "make_vector.h"
27 #include "math_funcs.h"
28 #include "describe.h"
29 #include "matpackII.h"
30 
32 {
33  return x+1;
34 }
35 
37 {
38  return x+1;
39 }
40 
42 {
43  x = 999;
44 }
45 
47 {
48  x = 888;
49 }
50 
51 int test1()
52 {
53  Vector v(20);
54 
55  cout << "v.nelem() = " << v.nelem() << "\n";
56 
57  for (Index i=0; i<v.nelem(); ++i )
58  v[i] = (Numeric)i;
59 
60  cout << "v.begin() = " << *v.begin() << "\n";
61 
62  cout << "v = \n" << v << "\n";
63 
64  fill_with_junk(v[Range(1,8,2)][Range(2,joker)]);
65  // fill_with_junk(v);
66 
67  Vector v2 = v[Range(2,4)];
68 
69  cout << "v2 = \n" << v2 << "\n";
70 
71  for (Index i=0 ; i<1000; ++i)
72  {
73  Vector v3(1000);
74  v3 = (Numeric)i;
75  }
76 
77  v2[Range(joker)] = 88;
78 
79  v2[Range(0,2)] = 77;
80 
81  cout << "v = \n" << v << "\n";
82  cout << "v2 = \n" << v2 << "\n";
83  cout << "v2.nelem() = \n" << v2.nelem() << "\n";
84 
85  Vector v3;
86  v3.resize(v2.nelem());
87  v3 = v2;
88 
89  cout << "\nv3 = \n" << v3 << "\n";
91  cout << "\nv3 after junking v2 = \n" << v3 << "\n";
92  v3 *= 2;
93  cout << "\nv3 after *2 = \n" << v3 << "\n";
94 
95  Matrix M(10,15);
96  {
97  Numeric n=0;
98  for (Index i=0; i<M.nrows(); ++i)
99  for (Index j=0; j<M.ncols(); ++j)
100  M(i,j) = ++n;
101  }
102 
103  cout << "\nM =\n" << M << "\n";
104 
105  cout << "\nM(Range(2,4),Range(2,4)) =\n" << M(Range(2,4),Range(2,4)) << "\n";
106 
107  cout << "\nM(Range(2,4),Range(2,4))(Range(1,2),Range(1,2)) =\n"
108  << M(Range(2,4),Range(2,4))(Range(1,2),Range(1,2)) << "\n";
109 
110  cout << "\nM(1,Range(joker)) =\n" << M(1,Range(joker)) << "\n";
111 
112  cout << "\nFilling M(1,Range(1,2)) with junk.\n";
113  fill_with_junk(M(1,Range(1,2)));
114 
115  cout << "\nM(Range(0,4),Range(0,4)) =\n" << M(Range(0,4),Range(0,4)) << "\n";
116 
117  cout << "\nFilling M(Range(4,2,2),Range(6,3)) with junk.\n";
118 
119  MatrixView s = M(Range(4,2,2),Range(6,3));
120  fill_with_junk(s);
121 
122  cout << "\nM =\n" << M << "\n";
123 
124  const Matrix C = M;
125 
126  cout << "\nC(Range(3,4,2),Range(2,3,3)) =\n"
127  << C(Range(3,4,2),Range(2,3,3)) << "\n";
128 
129  cout << "\nC(Range(3,4,2),Range(2,3,3)).transpose() =\n"
130  << transpose(C(Range(3,4,2),Range(2,3,3))) << "\n";
131 
132  return 0;
133 }
134 
135 void test2()
136 {
137  Vector v(50000000);
138 
139  cout << "v.nelem() = " << v.nelem() << "\n";
140 
141  cout << "Filling\n";
142 // for (Index i=0; i<v.nelem(); ++i )
143 // v[i] = sqrt(i);
144  v = 1.;
145  cout << "Done\n";
146 
147 }
148 
149 
150 void test4()
151 {
152  Vector a(10);
153  Vector b(a.nelem());
154 
155  for ( Index i=0; i<a.nelem(); ++i )
156  {
157  a[i] = (Numeric)(i+1);
158  b[i] = (Numeric)(a.nelem()-i);
159  }
160 
161  cout << "a = \n" << a << "\n";
162  cout << "b = \n" << b << "\n";
163  cout << "a*b \n= " << a*b << "\n";
164 
165  Matrix A(11,6);
166  Matrix B(10,20);
167  Matrix C(20,5);
168 
169  B = 2;
170  C = 3;
171  mult(A(Range(1,joker),Range(1,joker)),B,C);
172 
173  // cout << "\nB =\n" << B << "\n";
174  // cout << "\nC =\n" << C << "\n";
175  cout << "\nB*C =\n" << A << "\n";
176 
177 }
178 
179 void test5()
180 {
181  Vector a(10);
182  Vector b(20);
183  Matrix M(10,20);
184 
185  // Fill b and M with a constant number:
186  b = 1;
187  M = 2;
188 
189  cout << "b = \n" << b << "\n";
190  cout << "M =\n" << M << "\n";
191 
192  mult(a,M,b); // a = M*b
193  cout << "\na = M*b = \n" << a << "\n";
194 
195  mult(transpose((MatrixView)b),transpose((MatrixView)a),M); // b^t = a^t * M
196  cout << "\nb^t = a^t * M = \n" << transpose((MatrixView)b) << "\n";
197 
198 }
199 
200 void test6()
201 {
202  Index n = 5000;
203  Vector x(1,n,1), y(n);
204  Matrix M(n,n);
205  M = 1;
206  // cout << "x = \n" << x << "\n";
207 
208  cout << "Transforming.\n";
209  // transform(x,sin,x);
210  // transform(transpose(y),sin,transpose(x));
211  // cout << "sin(x) =\n" << y << "\n";
212  for (Index i=0; i<1000; ++i)
213  {
214  // mult(y,M,x);
215  transform(y,sin,static_cast<MatrixView>(x));
216  x+=1;
217  }
218  // cout << "y =\n" << y << "\n";
219 
220  cout << "Done.\n";
221 }
222 
223 void test7()
224 {
225  Vector x(1,20000000,1);
226  Vector y(x.nelem());
227  transform(y,sin,x);
228  cout << "min(sin(x)), max(sin(x)) = " << min(y) << ", " << max(y) << "\n";
229 }
230 
231 void test8()
232 {
233  Vector x(80000000);
234  for ( Index i=0; i<x.nelem(); ++i )
235  x[i] = (Numeric)i;
236  cout << "Done." << "\n";
237 }
238 
239 void test9()
240 {
241  // Initialization of Matrix with view of other Matrix:
242  Matrix A(4,8);
243  Matrix B(A(Range(joker),Range(0,3)));
244  cout << "B = " << B << "\n";
245 }
246 
247 void test10()
248 {
249  // Initialization of Matrix with a vector (giving a 1 column Matrix).
250 
251  // At the moment doing this with a non-const Vector will result in a
252  // warning message.
253  Vector v(1,8,1);
254  Matrix M((const Vector)v);
255  cout << "M = " << M << "\n";
256 }
257 
258 void test11()
259 {
260  // Assignment between Vector and Matrix:
261 
262  // At the moment doing this with a non-const Vector will result in a
263  // warning message.
264  Vector v(1,8,1);
265  Matrix M(v.nelem(),1);
266  M = v;
267  cout << "M = " << M << "\n";
268 }
269 
270 void test12()
271 {
272  // Copying of Arrays
273 
274  Array<String> sa(3);
275  sa[0] = "It's ";
276  sa[1] = "a ";
277  sa[2] = "test.";
278 
279  Array<String> sb(sa), sc(sa.nelem());
280 
281  cout << "sb = \n" << sb << "\n";
282 
283  sc = sa;
284 
285  cout << "sc = \n" << sc << "\n";
286 
287 }
288 
289 void test13()
290 {
291  // Mix vector and one-column matrix in += operator.
292  const Vector v(1,8,1); // The const is necessary here to
293  // avoid compiler warnings about
294  // different conversion paths.
295  Matrix M(v);
296  M += v;
297  cout << "M = \n" << M << "\n";
298 }
299 
300 void test14()
301 {
302  // Test explicit Array constructors.
303  Array<String> a = MakeArray<String>("Test");
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";
309 }
310 
311 void test15()
312 {
313  // Test String.
314  String a = "Nur ein Test.";
315  cout << "a = " << a << "\n";
316  String b(a,5,-1);
317  cout << "b = " << b << "\n";
318 }
319 
320 /*void test16()
321 {
322  // Test interaction between Array<Numeric> and Vector.
323  Vector a;
324  Array<Numeric> b;
325  b.push_back(1);
326  b.push_back(2);
327  b.push_back(3);
328  a.resize(b.nelem());
329  a = b;
330  cout << "b =\n" << b << "\n";
331  cout << "a =\n" << a << "\n";
332 }*/
333 
334 void test17()
335 {
336  // Test Sum.
337  Vector a(1,10,1);
338  cout << "a.sum() = " << a.sum() << "\n";
339 }
340 
341 void test18()
342 {
343  // Test elementvise square of a vector:
344  Vector a(1,10,1);
345  a *= a;
346  cout << "a *= a =\n" << a << "\n";
347 }
348 
349 void test19()
350 {
351  // There exists no explicit filling constructor of the form
352  // Vector a(3,1.7).
353  // But you can use the more general filling constructor with 3 arguments.
354 
355  Vector a(1,10,1);
356  Vector b(5.3,10,0);
357  cout << "a =\n" << a << "\n";
358  cout << "b =\n" << b << "\n";
359 }
360 
361 void test20()
362 {
363  // Test MakeVector:
364  MakeVector a(1,2,3,4,5,6,7,8,9,10);
365  cout << "a =\n" << a << "\n";
366 }
367 
368 void test21()
369 {
370  Numeric s=0;
371  // Test speed of call by reference:
372  cout << "By reference:\n";
373  for ( Index i=0; i<1e8; ++i )
374  {
375  s += by_reference(s);
376  s -= by_reference(s);
377  }
378  cout << "s = " << s << "\n";
379 }
380 
381 void test22()
382 {
383  Numeric s=0;
384  // Test speed of call by value:
385  cout << "By value:\n";
386  for ( Index i=0; i<1e8; ++i )
387  {
388  s += by_value(s);
389  s -= by_value(s);
390  }
391  cout << "s = " << s << "\n";
392 }
393 
394 void test23()
395 {
396  // Test constructors that fills with constant:
397  Vector a(10,3.5);
398  cout << "a =\n" << a << "\n";
399  Matrix b(10,10,4.5);
400  cout << "b =\n" << b << "\n";
401 }
402 
403 void test24()
404 {
405  // Try element-vise multiplication of Matrix and Vector:
406  Matrix a(5,1,2.5);
407  Vector b(1,5,1);
408  a *= b;
409  cout << "a*=b =\n" << a << "\n";
410  a /= b;
411  cout << "a/=b =\n" << a << "\n";
412  a += b;
413  cout << "a+=b =\n" << a << "\n";
414  a -= b;
415  cout << "a-=b =\n" << a << "\n";
416 }
417 
418 void test25()
419 {
420  // Test min and max for Array:
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";
423 }
424 
425 void test26()
426 {
427  cout << "Test filling constructor for Array:\n";
428  Array<String> a(4,"Hello");
429  cout << "a =\n" << a << "\n";
430 }
431 
432 void test27()
433 {
434  cout << "Test Arrays of Vectors:\n";
435  Array<Vector> a;
436  a.push_back(MakeVector(1.0,2.0));
437  a.push_back(Vector(1.0,10,1.0));
438  cout << "a =\n" << a << "\n";
439 }
440 
441 void test28()
442 {
443  cout << "Test default constructor for Matrix:\n";
444  Matrix a;
445  Matrix b(a);
446  cout << "b =\n" << b << "\n";
447 }
448 
449 void test29()
450 {
451  cout << "Test Arrays of Matrix:\n";
452  ArrayOfMatrix a;
453  Matrix b;
454 
455  b.resize(2,2);
456  b(0,0) = 1;
457  b(0,1) = 2;
458  b(1,0) = 3;
459  b(1,1) = 4;
460  a.push_back(b);
461  b *= 2;
462  a.push_back(b);
463 
464  a[0].resize(2,3);
465  a[0] = 4;
466 
467  a.resize(3);
468  a[2].resize(4,5);
469  a[2] = 5;
470 
471  cout << "a =\n" << a << "\n";
472 }
473 
474 void test30()
475 {
476  cout << "Test Matrices of size 0:\n";
477  Matrix a(0,0);
478  // cout << "a(0,0) =\n" << a(0,0) << "\n";
479  a.resize(2,2);
480  a = 1;
481  cout << "a =\n" << a << "\n";
482 
483  Matrix b(3,0);
484  // cout << "b(0,0) =\n" << b(0,0) << "\n";
485  b.resize(b.nrows(),b.ncols()+3);
486  b = 2;
487  cout << "b =\n" << b << "\n";
488 
489  Matrix c(0,3);
490  // cout << "c(0,0) =\n" << c(0,0) << "\n";
491  c.resize(c.nrows()+3,c.ncols());
492  c = 3;
493  cout << "c =\n" << c << "\n";
494 }
495 
496 void test31()
497 {
498  cout << "Test Tensor3:\n";
499 
500  Tensor3 a(2,3,4,1.0);
501 
502  Index fill = 0;
503 
504  // Fill with some numbers
505  for ( Index i=0; i<a.npages(); ++i )
506  for ( Index j=0; j<a.nrows(); ++j )
507  for ( Index k=0; k<a.ncols(); ++k )
508  a(i,j,k) = (Numeric)(++fill);
509 
510  cout << "a =\n" << a << "\n";
511 
512  cout << "Taking out first row of first page:\n"
513  << a(0,0,Range(joker)) << "\n";
514 
515  cout << "Taking out last column of second page:\n"
516  << a(1,Range(joker),a.ncols()-1) << "\n";
517 
518  cout << "Taking out the first letter on every page:\n"
519  << a(Range(joker),0,0) << "\n";
520 
521  cout << "Taking out first page:\n"
522  << a(0,Range(joker),Range(joker)) << "\n";
523 
524  cout << "Taking out last row of all pages:\n"
525  << a(Range(joker),a.nrows()-1,Range(joker)) << "\n";
526 
527  cout << "Taking out second column of all pages:\n"
528  << a(Range(joker),Range(joker),1) << "\n";
529 
530  a *= 2;
531 
532  cout << "After element-vise multiplication with 2:\n"
533  << a << "\n";
534 
535  transform(a,sqrt,a);
536 
537  cout << "After taking the square-root:\n"
538  << a << "\n";
539 
540  Index s = 200;
541  cout << "Let's allocate a large tensor, "
542  << (Numeric)(s*s*s*8)/1024./1024.
543  << " MB...\n";
544 
545  a.resize(s,s,s);
546 
547  cout << "Set it to 1...\n";
548 
549  a = 1;
550 
551  cout << "a(900,900,900) = " << a(90,90,90) << "\n";
552 
553  fill = 0;
554 
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 )
559  a(i,j,k) = (Numeric)(++fill);
560 
561  cout << "Max(a) = ...\n";
562 
563  cout << max(a) << "\n";
564 
565 }
566 
567 void test32()
568 {
569  cout << "Test von X = A*X:\n";
570  Matrix X(3,3),A(3,3),B(3,3);
571 
572  for ( Index j=0; j<A.nrows(); ++j )
573  for ( Index k=0; k<A.ncols(); ++k )
574  {
575  X(j,k) = 1;
576  A(j,k) = (Numeric)(j+k);
577  }
578  cout << "A:\n" << A << "\n";
579  cout << "X:\n" << X << "\n";
580 
581  mult(B,A,X);
582  cout << "B = A*X:\n" << B << "\n";
583  mult(X,A,X);
584  cout << "X = A*X:\n" << X << "\n";
585 
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"
588  << "for mult!\n";
589 }
590 
591 void test33()
592 {
593  cout << "Making things look bigger than they are...\n";
594 
595  {
596  cout << "1. Make a scalar look like a vector:\n";
597  Numeric a = 3.1415; // Just any number here.
598  VectorView av(a);
599  cout << "a, viewed as a vector: " << av << "\n";
600  cout << "Describe a: " << describe(a) << "\n";
601  av[0] += 1;
602  cout << "a, after the first element\n"
603  << "of the vector has been increased by 1: " << a << "\n";
604  }
605 
606  {
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";
609  MakeVector a(1,2,3,4,5);
610  MatrixView am = a;
611  cout << "a, viewed as a matrix:\n" << am << "\n";
612  cout << "Trasnpose view:\n" << transpose(am) << "\n";
613  cout << "Describe transpose(am): " << describe(transpose(am)) << "\n";
614 
615  cout << "\n3. Make a matrix look like a tensor3:\n";
616  Tensor3View at3 = am;
617  cout << "at3 = \n" << at3 << "\n";
618  cout << "Describe at3: " << describe(at3) << "\n";
619  at3 (0,2,0) += 1;
620  cout << "a after Increasing element at3(0,2,0) by 1: \n" << a << "\n\n";
621 
622  Tensor4View at4 = at3;
623  cout << "at4 = \n" << at4 << "\n";
624  cout << "Describe at4: " << describe(at4) << "\n";
625 
626  Tensor5View at5 = at4;
627  cout << "at5 = \n" << at5 << "\n";
628  cout << "Describe at5: " << describe(at5) << "\n";
629 
630  Tensor6View at6 = at5;
631  cout << "at6 = \n" << at6 << "\n";
632  cout << "Describe at6: " << describe(at6) << "\n";
633 
634  Tensor7View at7 = at6;
635  cout << "at7 = \n" << at7 << "\n";
636  cout << "Describe at7: " << describe(at7) << "\n";
637 
638  at7(0,0,0,0,0,2,0) -=1 ;
639 
640  cout << "After subtracting 1 from at7(0,0,0,0,0,2,0)\n"
641  << "a = " << a << "\n";
642 
643  cout << "\nAll in one go:\n";
644  Numeric b = 3.1415; // Just any number here.
645  Tensor7View bt7 =
646  Tensor6View(
647  Tensor5View(
648  Tensor4View(
649  Tensor3View(
650  MatrixView(
651  VectorView(b)
652  )
653  )
654  )
655  )
656  );
657  cout << "bt7:\n" << bt7 << "\n";
658  cout << "Describe bt7: " << describe(bt7) << "\n";
659  }
660 }
661 
663 {
664  cout << "Describe a: " << describe(a) << "\n";
665 }
666 
668 {
669  cout << "Describe a: " << describe(a) << "\n";
670 }
671 
672 void test34()
673 {
674  cout << "Test, if dimension expansion works implicitly.\n";
675 
676  Tensor3 t3(2,3,4);
677  junk4(t3);
678 
679  Numeric x;
681 }
682 
683 void test35()
684 {
685  cout << "Test the new copy semantics.\n";
686  Vector a(1,4,1);
687  Vector b;
688 
689  b = a;
690  cout << "b = " << b << "\n";
691 
692  Vector aa(1,5,1);
693  ConstVectorView c = aa;
694  b = c;
695  cout << "b = " << b << "\n";
696 
697  Vector aaa(1,6,1);
698  VectorView d = aaa;
699  b = d;
700  cout << "b = " << b << "\n";
701 }
702 
703 void test36()
704 {
705  cout << "Test using naked joker on Vector.\n";
706  Vector a(1,4,1);
707  VectorView b = a[joker];
708  cout << "a = " << a << "\n";
709  cout << "b = " << b << "\n";
710 }
711 
712 void test37(const Index& i)
713 {
714  Vector v1(5e-15, 10, 0.42e-15/11);
715  Vector v2=v1;
716  // Index i = 10000000;
717 
718  v1 /= (Numeric)i;
719  v2 /=(Numeric)i;
720  cout.precision(12);
721  // cout.setf(ios_base::scientific,ios_base::floatfield);
722  v1*=v1;
723  v2*=v2;
724 cout << v1 << endl;
725  cout << v2 << endl;
726 }
727 
728 void test38 ()
729 {
730  Vector v (5, 0.);
731  Numeric * const a = v.get_c_array();
732 
733  a[4] = 5.;
734 
735  cout << v << endl;
736  cout << endl << "========================" << endl << endl;
737 
738  Matrix m (5, 5, 0.);
739  Numeric * const b = m.get_c_array();
740 
741  b[4] = 5.;
742 
743  cout << m << endl;
744  cout << endl << "========================" << endl << endl;
745 
746  Tensor3 t3 (5, 6, 7, 0.);
747  Numeric * const c = t3.get_c_array();
748 
749  c[6] = 5.;
750 
751  cout << t3 << endl;
752 }
753 
754 void test39 ()
755 {
756  Vector v1(1,5,1),v2(5);
757 
758  v2 = v1 * 2;
759  // Unfortunately, this thing compiles, but at least it gives an
760  // assertion failure at runtime. I think what happens is that it
761  // implicitly creates a one element vector out of the "2", then
762  // tries to do a scalar product with v1.
763 
764  cout << v2 << endl;
765 
766 }
767 
768 void test40()
769 {
770  Vector v(100);
771 
772  v = 5;
773 
774  cout << v << endl;
775 }
776 
777 void test41()
778 {
779  const Vector v1(10, 1);
780 
781  ConstVectorView vv = v1[Range(0, 5)];
782 
783  cout << "Vector: " << v1 << endl;
784  cout << "VectorView: " << vv << endl;
785 
786  try {
787  vv = 2;
788  } catch (runtime_error e) {
789  cerr << e.what() << endl;
790  exit(EXIT_FAILURE);
791  }
792 
793  cout << "VectorView: " << vv << endl;
794  cout << "Vector: " << v1 << endl;
795 }
796 
797 int main()
798 {
799 // test1();
800 // test2();
801 // test3();
802 // test4();
803 // test5();
804 // test6();
805 // test7();
806 // test8();
807 // test9();
808 // test10();
809 // test11();
810 // test12();
811 // test13();
812 // test14();
813 // test15();
814 // test16();
815 // test17();
816 // test18();
817 // test19();
818 // test20();
819 // test21();
820 // test22();
821 // test23();
822 // test24();
823 // test25();
824 // test26();
825 // test27();
826 // test28();
827 // test29();
828 // test30();
829 // test31();
830 // test32();
831 // test33();
832 // test34();
833 // test35();
834 // test36();
835 // Index i = 10000000;
836 // test37(i);
837 // test38();
838 // test39();
839 // test40();
840  test41();
841 
842  return 0;
843 }
Matrix
The Matrix class.
Definition: matpackI.h:767
Tensor7View
The Tensor7View class.
Definition: matpackVII.h:779
transform
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...
Definition: matpackI.cc:1728
main
int main()
Definition: test_matpack.cc:797
test35
void test35()
Definition: test_matpack.cc:683
MatrixView
The MatrixView class.
Definition: matpackI.h:668
exceptions.h
The declarations of all the exception classes.
test13
void test13()
Definition: test_matpack.cc:289
test20
void test20()
Definition: test_matpack.cc:361
test32
void test32()
Definition: test_matpack.cc:567
Tensor3
The Tensor3 class.
Definition: matpackIII.h:340
test18
void test18()
Definition: test_matpack.cc:341
test19
void test19()
Definition: test_matpack.cc:349
test38
void test38()
Definition: test_matpack.cc:728
joker
const Joker joker
describe.h
Header file for describe.cc.
test30
void test30()
Definition: test_matpack.cc:474
Vector::resize
void resize(Index n)
Resize function.
Definition: matpackI.cc:771
by_reference
Numeric by_reference(const Numeric &x)
Definition: test_matpack.cc:31
test33
void test33()
Definition: test_matpack.cc:591
ConstMatrixView::nrows
Index nrows() const
Returns the number of rows.
Definition: matpackI.cc:796
test25
void test25()
Definition: test_matpack.cc:418
array.h
This file contains the definition of Array.
ConstTensor3View::npages
Index npages() const
Returns the number of pages.
Definition: matpackIII.h:151
test6
void test6()
Definition: test_matpack.cc:200
Tensor3View
The Tensor3View class.
Definition: matpackIII.h:234
Array< String >
test40
void test40()
Definition: test_matpack.cc:768
mult
void mult(VectorView y, const ConstMatrixView &M, const ConstVectorView &x)
Matrix Vector multiplication.
Definition: matpackI.cc:1607
describe
string describe(ConstTensor7View x)
Describe Tensor7.
Definition: describe.cc:36
test2
void test2()
Definition: test_matpack.cc:135
ConstMatrixView::ncols
Index ncols() const
Returns the number of columns.
Definition: matpackI.cc:802
test26
void test26()
Definition: test_matpack.cc:425
my_basic_string
The implementation for String, the ARTS string class.
Definition: mystring.h:62
test21
void test21()
Definition: test_matpack.cc:368
test41
void test41()
Definition: test_matpack.cc:777
test1
int test1()
Definition: test_matpack.cc:51
test22
void test22()
Definition: test_matpack.cc:381
test34
void test34()
Definition: test_matpack.cc:672
ConstVectorView::nelem
Index nelem() const
Returns the number of elements.
Definition: matpackI.cc:175
VectorView
The VectorView class.
Definition: matpackI.h:373
ConstVectorView::sum
Numeric sum() const
The sum of all elements of a Vector.
Definition: matpackI.cc:181
test10
void test10()
Definition: test_matpack.cc:247
Numeric
NUMERIC Numeric
The type to use for all floating point numbers.
Definition: matpack.h:33
test17
void test17()
Definition: test_matpack.cc:334
Tensor5View
The Tensor5View class.
Definition: matpackV.h:278
junk2
void junk2(ConstVectorView a)
Definition: test_matpack.cc:667
math_funcs.h
make_array.h
Implements the class MakeArray, which is a derived class of Array, allowing explicit initialization.
transpose
ConstMatrixView transpose(ConstMatrixView m)
Const version of transpose.
Definition: matpackI.cc:1689
make_vector.h
The class MakeVector is a special kind of Vector that can be initialized explicitly from one or more ...
Matrix::resize
void resize(Index r, Index c)
Resize function.
Definition: matpackI.cc:1549
VectorView::begin
ConstIterator1D begin() const
Return const iterator to first element.
Definition: matpackI.cc:336
ConstTensor3View::nrows
Index nrows() const
Returns the number of rows.
Definition: matpackIII.h:154
max
#define max(a, b)
Definition: continua.cc:13097
test14
void test14()
Definition: test_matpack.cc:300
test27
void test27()
Definition: test_matpack.cc:432
test29
void test29()
Definition: test_matpack.cc:449
MakeVector
Definition: make_vector.h:42
test36
void test36()
Definition: test_matpack.cc:703
Range
The range class.
Definition: matpackI.h:148
junk4
void junk4(Tensor4View a)
Definition: test_matpack.cc:662
test39
void test39()
Definition: test_matpack.cc:754
test28
void test28()
Definition: test_matpack.cc:441
ConstTensor3View::ncols
Index ncols() const
Returns the number of columns.
Definition: matpackIII.h:157
test7
void test7()
Definition: test_matpack.cc:223
min
#define min(a, b)
Definition: continua.cc:13096
test24
void test24()
Definition: test_matpack.cc:403
test9
void test9()
Definition: test_matpack.cc:239
Tensor4View
The Tensor4View class.
Definition: matpackIV.h:245
matpackII.h
Header file for sparse matrices.
test5
void test5()
Definition: test_matpack.cc:179
MakeArray
Explicit construction of Arrays.
Definition: make_array.h:52
fill_with_junk
void fill_with_junk(VectorView x)
Definition: test_matpack.cc:41
Index
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:39
MatrixView::get_c_array
const Numeric * get_c_array() const
Conversion to plain C-array.
Definition: matpackI.cc:1178
M
#define M
Definition: rng.cc:196
test31
void test31()
Definition: test_matpack.cc:496
test4
void test4()
Definition: test_matpack.cc:150
test37
void test37(const Index &i)
Definition: test_matpack.cc:712
test12
void test12()
Definition: test_matpack.cc:270
by_value
Numeric by_value(Numeric x)
Definition: test_matpack.cc:36
Tensor3View::get_c_array
const Numeric * get_c_array() const
Conversion to plain C-array.
Definition: matpackIII.cc:452
Vector
The Vector class.
Definition: matpackI.h:555
test11
void test11()
Definition: test_matpack.cc:258
ConstVectorView
A constant view of a Vector.
Definition: matpackI.h:300
test15
void test15()
Definition: test_matpack.cc:311
Array::nelem
Index nelem() const
Number of elements.
Definition: array.h:172
VectorView::get_c_array
const Numeric * get_c_array() const
Conversion to plain C-array.
Definition: matpackI.cc:527
mystring.h
This file contains the definition of String, the ARTS string class.
test8
void test8()
Definition: test_matpack.cc:231
matpackVII.h
test23
void test23()
Definition: test_matpack.cc:394
Tensor6View
The Tensor6View class.
Definition: matpackVI.h:450