ARTS  2.0.49
matpackI.h
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 
94 #ifndef matpackI_h
95 #define matpackI_h
96 
97 #include "matpack.h"
98 #include <cassert>
99 #include "array.h"
100 
101 // Declare existance of some classes
102 class bofstream;
103 
114 class Joker {
115  // Nothing here.
116 };
117 
118 // Declare existence of the global joker object:
119 extern const Joker joker;
120 
121 // Declare the existence of class ConstMatrixView:
122 class ConstIterator1D;
123 
124 // Declare the existence of class VectorView:
125 class VectorView;
126 
127 // Declare the existence of class ConstVectorView:
128 class ConstVectorView;
129 
130 // Declare the existence of class ConstMatrixView:
131 class ConstMatrixView;
132 
148 class Range{
149 public:
150  // Constructors:
151  Range(Index start, Index extent, Index stride=1);
152  Range(Index start, Joker j, Index stride=1);
153  Range(Joker j, Index stride=1);
154  Range(Index max_size, const Range& r);
155  Range(const Range& p, const Range& n);
156 
157  // Friends:
158  friend class ConstVectorView;
159  friend class VectorView;
160  friend class Vector;
161  friend class ConstMatrixView;
162  friend class MatrixView;
163  friend class Matrix;
164  friend class Iterator2D;
165  friend class Iterator3D;
166  friend class Iterator4D;
167  friend class Iterator5D;
168  friend class Iterator6D;
169  friend class Iterator7D;
170  friend class ConstIterator2D;
171  friend class ConstIterator3D;
172  friend class ConstIterator4D;
173  friend class ConstIterator5D;
174  friend class ConstIterator6D;
175  friend class ConstIterator7D;
176  friend class ConstTensor3View;
177  friend class Tensor3View;
178  friend class Tensor3;
179  friend class ConstTensor4View;
180  friend class Tensor4View;
181  friend class Tensor4;
182  friend class ConstTensor5View;
183  friend class Tensor5View;
184  friend class Tensor5;
185  friend class ConstTensor6View;
186  friend class Tensor6View;
187  friend class Tensor6;
188  friend class ConstTensor7View;
189  friend class Tensor7View;
190  friend class Tensor7;
191  friend class Sparse;
192  friend void mult (VectorView, const ConstMatrixView&,
193  const ConstVectorView&);
194 
196  Index get_start () const { return mstart; }
198  Index get_extent () const { return mextent; }
200  Index get_stride () const { return mstride; }
201 
202 private:
210 };
211 
214 class Iterator1D {
215 public:
217  Iterator1D() : mx(NULL), mstride(0) { /* Nothing to do here. */ }
218 
221  { /* Nothing to do here. */ }
222 
224  Iterator1D(Numeric *x, Index stride) : mx(x), mstride(stride)
225  { /* Nothing to do here. */ }
226 
227  // Operators:
228 
231  { mx += mstride; return *this; }
232 
234  Numeric& operator*() const { return *mx; }
235 
237  bool operator!=(const Iterator1D& other) const
238  { if (mx != other.mx) return true; else return false; }
239 
240  friend void copy(ConstIterator1D origin,
241  const ConstIterator1D& end,
242  Iterator1D target);
243 
244 private:
249 };
250 
254 public:
256  ConstIterator1D() : mx(NULL), mstride(0)
257  { /* Nothing to do here. */ }
258 
261  { /* Nothing to do here. */ }
262 
264  ConstIterator1D(Numeric *x, Index stride) : mx(x), mstride(stride)
265  { /* Nothing to do here. */ }
266 
267  // Operators:
270  { mx += mstride; return *this; }
271 
273  const Numeric& operator*() const { return *mx; }
274 
276  bool operator!=(const ConstIterator1D& other) const
277  { if (mx != other.mx) return true; else return false; }
278 
279  friend void copy(ConstIterator1D origin,
280  const ConstIterator1D& end,
281  Iterator1D target);
282 private:
284  const Numeric *mx;
287 };
288 
289 // Declare the vector class:
290 class Vector;
291 
292 // Declare the MatrixView class
293 class MatrixView;
294 
301 public:
302  // Typedef for compatibility with STL
304 
305  // Member functions:
306  Index nelem() const;
307  Numeric sum() const;
308 
309  // Const index operators:
312  { // Check if index is valid:
313  assert( 0<=n );
314  assert( n<mrange.mextent );
315  return *( mdata +
316  mrange.mstart +
317  n*mrange.mstride );
318  }
319 
320  ConstVectorView operator[](const Range& r) const;
321 
322  // Functions returning iterators:
323  ConstIterator1D begin() const;
324  ConstIterator1D end() const;
325 
326  // Conversion to 1 column matrix:
327  operator ConstMatrixView() const;
328 
330  virtual ~ConstVectorView() {}
331 
332  // Friends:
333  friend class VectorView;
334  friend class ConstIterator2D;
335  friend class ConstMatrixView;
336  friend class ConstTensor3View;
337  friend class ConstTensor4View;
338  friend class ConstTensor5View;
339  friend class ConstTensor6View;
340  friend class ConstTensor7View;
341  friend int poly_root_solve (Matrix& roots, Vector& coeffs);
342  friend void mult (VectorView, const ConstMatrixView&,
343  const ConstVectorView&);
344 
345  // A special constructor, that allows to make a ConstVectorView of a scalar.
346  ConstVectorView(const Numeric& a);
347 
348 protected:
349  // Constructors:
350  ConstVectorView();
351  ConstVectorView(Numeric *data, const Range& range);
352  ConstVectorView(Numeric *data, const Range& p, const Range& n);
353 
354  // Data members:
355  // -------------
360 };
361 
373 class VectorView : public ConstVectorView {
374 public:
375  VectorView (const Vector&);
376  VectorView (Vector& v);
377 
378  // Typedef for compatibility with STL
380 
381  // Const index operators:
385  { return ConstVectorView::operator[](n); }
386 
387  ConstVectorView operator[](const Range& r) const;
388 
391  { // Check if index is valid:
392  assert( 0<=n );
393  assert( n<mrange.mextent );
394  return *( mdata +
395  mrange.mstart +
396  n*mrange.mstride );
397  }
398 
399  VectorView operator[](const Range& r);
400 
401  // Constant iterators:
402  ConstIterator1D begin() const;
403  ConstIterator1D end() const;
404  // Iterators:
405  Iterator1D begin();
406  Iterator1D end();
407 
408  // Assignment operators:
410  VectorView& operator=(const VectorView& v);
411  VectorView& operator=(const Vector& v);
412  VectorView& operator=(const Array<Numeric>& v);
414 
415  // Other operators:
420 
425 
426  // Conversion to 1 column matrix:
427  operator MatrixView();
428  // Conversion to a plain C-array
429  const Numeric *get_c_array() const;
430  Numeric *get_c_array();
431 
433  virtual ~VectorView() {}
434 
435  // Friends:
436  friend class ConstIterator2D;
437  friend class Iterator2D;
438  friend class MatrixView;
439  friend class Tensor3View;
440  friend class Tensor4View;
441  friend class Tensor5View;
442  friend class Tensor6View;
443  friend class Tensor7View;
444 
445  // A special constructor, that allows to make a VectorView of a scalar.
446  VectorView(Numeric& a);
447 
448 
449 protected:
450  // Constructors:
451  VectorView();
452  VectorView(Numeric *data, const Range& range);
453  VectorView(Numeric *data, const Range& p, const Range& n);
454 };
455 
459 class Iterator2D {
460 public:
461  // Constructors:
463  Iterator2D() : msv(), mstride(0) { /* Nothing to do here. */ }
464 
467  { /* Nothing to do here. */ }
468 
470  Iterator2D(const VectorView& x, Index stride) : msv(x), mstride(stride)
471  { /* Nothing to do here. */ }
472 
473  // Operators:
475  Iterator2D& operator++() { msv.mdata += mstride; return *this; }
476 
478  bool operator!=(const Iterator2D& other) const
479  { if ( msv.mdata + msv.mrange.mstart !=
480  other.msv.mdata + other.msv.mrange.mstart )
481  return true;
482  else
483  return false;
484  }
485 
488  VectorView * operator->() { return &msv; }
489 
491  VectorView& operator*() { return msv; }
492 
493 private:
498 };
499 
504 public:
505  // Constructors:
507  ConstIterator2D() : msv(), mstride(0) { /* Nothing to do here. */ }
508 
511  { /* Nothing to do here. */ }
512 
515  : msv(x), mstride(stride)
516  { /* Nothing to do here. */ }
517 
518  // Operators:
520  ConstIterator2D& operator++() { msv.mdata += mstride; return *this; }
521 
523  bool operator!=(const ConstIterator2D& other) const
524  { if ( msv.mdata + msv.mrange.mstart !=
525  other.msv.mdata + other.msv.mrange.mstart )
526  return true;
527  else
528  return false;
529  }
530 
533  const ConstVectorView* operator->() const { return &msv; }
534 
536  const ConstVectorView& operator*() const { return msv; }
537 
538 private:
543 };
544 
555 class Vector : public VectorView {
556 public:
557  // Constructors:
558  Vector();
559  explicit Vector(Index n);
560  Vector(Index n, Numeric fill);
561  Vector(Numeric start, Index extent, Numeric stride);
562  Vector(const ConstVectorView& v);
563  Vector(const Vector& v);
564 
565  // Assignment operators:
566  Vector& operator=(const Vector& v);
567  Vector& operator=(const Array<Numeric>& v);
569 
570  // Resize function:
571  void resize(Index n);
572 
573  // Destructor:
574  virtual ~Vector();
575 };
576 
577 // Declare class Matrix:
578 class Matrix;
579 
580 
592 public:
593  // Typedef for compatibility with STL
595 
596  // Member functions:
597  Index nrows() const;
598  Index ncols() const;
599 
600  // Const index operators:
603  { // Check if indices are valid:
604  assert( 0<=r );
605  assert( 0<=c );
606  assert( r<mrr.mextent );
607  assert( c<mcr.mextent );
608 
609  return *( mdata +
610  mrr.mstart +
611  r*mrr.mstride +
612  mcr.mstart +
613  c*mcr.mstride );
614  }
615 
616  ConstMatrixView operator()(const Range& r, const Range& c) const;
617  ConstVectorView operator()(const Range& r, Index c) const;
618  ConstVectorView operator()(Index r, const Range& c) const;
619 
620  // Functions returning iterators:
621  ConstIterator2D begin() const;
622  ConstIterator2D end() const;
623 
625  virtual ~ConstMatrixView() {}
626 
627  // Friends:
628  friend class MatrixView;
629  friend class ConstIterator3D;
630  friend class ConstVectorView;
631  friend class ConstTensor3View;
632  friend class ConstTensor4View;
633  friend class ConstTensor5View;
634  friend class ConstTensor6View;
635  friend class ConstTensor7View;
637  friend int poly_root_solve (Matrix& roots, Vector& coeffs);
638  friend void mult (VectorView, const ConstMatrixView&,
639  const ConstVectorView&);
640 
641 protected:
642  // Constructors:
643  ConstMatrixView();
644  ConstMatrixView(Numeric *data, const Range& r, const Range& c);
645  ConstMatrixView(Numeric *data,
646  const Range& pr, const Range& pc,
647  const Range& nr, const Range& nc);
648 
649  // Data members:
650  // -------------
657 };
658 
668 class MatrixView : public ConstMatrixView {
669 public:
670  // Typedef for compatibility with STL
672 
673  // Const index operators:
677  { return ConstMatrixView::operator()(r,c); }
678 
679  ConstMatrixView operator()(const Range& r, const Range& c) const;
680  ConstVectorView operator()(const Range& r, Index c) const;
681  ConstVectorView operator()(Index r, const Range& c) const;
682  // Index Operators:
685  { // Check if indices are valid:
686  assert( 0<=r );
687  assert( 0<=c );
688  assert( r<mrr.mextent );
689  assert( c<mcr.mextent );
690 
691  return *( mdata +
692  mrr.mstart +
693  r*mrr.mstride +
694  mcr.mstart +
695  c*mcr.mstride );
696  }
697 
698  MatrixView operator()(const Range& r, const Range& c);
699  VectorView operator()(const Range& r, Index c);
700  VectorView operator()(Index r, const Range& c);
701 
702  // Functions returning const iterators:
703  ConstIterator2D begin() const;
704  ConstIterator2D end() const;
705  // Functions returning iterators:
706  Iterator2D begin();
707  Iterator2D end();
708 
709  // Assignment operators:
711  MatrixView& operator=(const MatrixView& v);
712  MatrixView& operator=(const Matrix& v);
715 
716  // Other operators:
721 
726 
731 
732  // Conversion to a plain C-array
733  const Numeric *get_c_array() const;
734  Numeric *get_c_array();
735 
737  virtual ~MatrixView() {}
738 
739  // Friends:
740  friend class VectorView;
741  friend class Iterator3D;
742  friend class Tensor3View;
743  friend class Tensor4View;
744  friend class Tensor5View;
745  friend class Tensor6View;
746  friend class Tensor7View;
748  friend MatrixView transpose(MatrixView m);
749 
750 protected:
751  // Constructors:
752  MatrixView();
753  MatrixView(Numeric *data, const Range& r, const Range& c);
754  MatrixView(Numeric *data,
755  const Range& pr, const Range& pc,
756  const Range& nr, const Range& nc);
757 };
758 
767 class Matrix : public MatrixView {
768 public:
769  // Constructors:
770  Matrix();
771  Matrix(Index r, Index c);
772  Matrix(Index r, Index c, Numeric fill);
773  Matrix(const ConstMatrixView& v);
774  Matrix(const Matrix& v);
775 
776  // Assignment operators:
777  Matrix& operator=(const Matrix& x);
779  Matrix& operator=(const ConstVectorView& v);
780 
781  // Resize function:
782  void resize(Index r, Index c);
783 
784  // Destructor:
785  virtual ~Matrix();
786 
787  Numeric *get_raw_data() { return mdata; }
788 };
789 
790 // Function declarations:
791 // ----------------------
792 
793 void copy(ConstIterator1D origin,
794  const ConstIterator1D& end,
795  Iterator1D target);
796 
797 void copy(Numeric x,
798  Iterator1D target,
799  const Iterator1D& end);
800 
801 void copy(ConstIterator2D origin,
802  const ConstIterator2D& end,
803  Iterator2D target);
804 
805 void copy(Numeric x,
806  Iterator2D target,
807  const Iterator2D& end);
808 
809 void mult( VectorView y,
810  const ConstMatrixView& M,
811  const ConstVectorView& x );
812 
813 void mult( MatrixView A,
814  const ConstMatrixView& B,
815  const ConstMatrixView& C );
816 
818 
820 
821 void transform( VectorView y,
822  double (&my_func)(double),
823  ConstVectorView x );
824 
825 void transform( MatrixView y,
826  double (&my_func)(double),
827  ConstMatrixView x );
828 
829 Numeric max(const ConstVectorView& x);
830 
831 Numeric max(const ConstMatrixView& x);
832 
833 Numeric min(const ConstVectorView& x);
834 
835 Numeric min(const ConstMatrixView& x);
836 
837 Numeric mean(const ConstVectorView& x);
838 
839 Numeric mean(const ConstMatrixView& x);
840 
842 
843 ostream& operator<<(ostream& os, const ConstVectorView& v);
844 
845 ostream& operator<<(ostream& os, const ConstMatrixView& v);
846 
848 // Helper function for debugging
849 #ifndef NDEBUG
850 
852 
853 #endif
854 
856 #endif // matpackI_h
Matrix
The Matrix class.
Definition: matpackI.h:767
ConstIterator7D
Const version of Iterator7D.
Definition: matpackVII.h:93
MatrixView::operator()
Numeric operator()(Index r, Index c) const
Plain const index operator.
Definition: matpackI.h:676
Tensor7View
The Tensor7View class.
Definition: matpackVII.h:779
Iterator1D::mx
Numeric * mx
Current position.
Definition: matpackI.h:246
ConstIterator1D::copy
friend void copy(ConstIterator1D origin, const ConstIterator1D &end, Iterator1D target)
Copy data between begin and end to target.
Definition: matpackI.cc:597
ConstIterator1D::operator++
ConstIterator1D & operator++()
Prefix increment operator.
Definition: matpackI.h:269
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
Range::get_extent
Index get_extent() const
Returns the extent of the range.
Definition: matpackI.h:198
MatrixView
The MatrixView class.
Definition: matpackI.h:668
VectorView::VectorView
VectorView()
Default constructor.
Definition: matpackI.cc:560
Iterator2D::operator!=
bool operator!=(const Iterator2D &other) const
Not equal operator, needed for algorithms like copy.
Definition: matpackI.h:478
matpack.h
ConstIterator2D::msv
ConstVectorView msv
Current position.
Definition: matpackI.h:540
Iterator1D::Iterator1D
Iterator1D(const Iterator1D &o)
Copy constructor.
Definition: matpackI.h:220
Iterator2D::operator++
Iterator2D & operator++()
Prefix increment operator.
Definition: matpackI.h:475
MatrixView::operator=
MatrixView & operator=(const ConstMatrixView &v)
Assignment operator.
Definition: matpackI.cc:1059
ConstIterator2D::operator*
const ConstVectorView & operator*() const
Dereferencing.
Definition: matpackI.h:536
Vector::Vector
Vector()
Default constructor.
Definition: matpackI.cc:624
Tensor3
The Tensor3 class.
Definition: matpackIII.h:340
ConstIterator1D
The constant iterator class for sub vectors.
Definition: matpackI.h:253
ConstMatrixView::poly_root_solve
friend int poly_root_solve(Matrix &roots, Vector &coeffs)
Definition: poly_roots.cc:100
Iterator1D::Iterator1D
Iterator1D(Numeric *x, Index stride)
Explicit constructor.
Definition: matpackI.h:224
transpose
ConstMatrixView transpose(ConstMatrixView m)
Const version of transpose.
Definition: matpackI.cc:1689
MatrixView::MatrixView
MatrixView()
Default constructor.
Definition: matpackI.cc:1344
ConstTensor7View
A constant view of a Tensor7.
Definition: matpackVII.h:169
Matrix::get_raw_data
Numeric * get_raw_data()
Definition: matpackI.h:787
MatrixView::iterator
Iterator2D iterator
Definition: matpackI.h:671
ConstMatrixView::const_iterator
ConstIterator2D const_iterator
Definition: matpackI.h:594
Iterator2D::mstride
Index mstride
Row stride.
Definition: matpackI.h:497
mean
Numeric mean(const ConstVectorView &x)
Mean function, vector version.
Definition: matpackI.cc:1862
MatrixView::transpose
friend ConstMatrixView transpose(ConstMatrixView m)
Const version of transpose.
Definition: matpackI.cc:1689
Iterator7D
Implementation of Tensors of Rank 7.
Definition: matpackVII.h:35
ConstIterator1D::mstride
Index mstride
Stride.
Definition: matpackI.h:286
ConstIterator3D
Const version of Iterator3D.
Definition: matpackIII.h:82
ConstMatrixView::mdata
Numeric * mdata
Pointer to the plain C array that holds the data.
Definition: matpackI.h:656
Sparse
The Sparse class.
Definition: matpackII.h:55
Iterator1D::copy
friend void copy(ConstIterator1D origin, const ConstIterator1D &end, Iterator1D target)
Copy data between begin and end to target.
Definition: matpackI.cc:597
ConstIterator1D::ConstIterator1D
ConstIterator1D()
Default constructor.
Definition: matpackI.h:256
ConstIterator2D::ConstIterator2D
ConstIterator2D(const ConstIterator2D &o)
Copy constructor.
Definition: matpackI.h:510
Iterator2D::Iterator2D
Iterator2D(const VectorView &x, Index stride)
Explicit constructor.
Definition: matpackI.h:470
Vector::resize
void resize(Index n)
Resize function.
Definition: matpackI.cc:771
ConstVectorView::ConstVectorView
ConstVectorView()
Default constructor.
Definition: matpackI.cc:237
MatrixView::operator+=
MatrixView & operator+=(Numeric x)
Addition of scalar.
Definition: matpackI.cc:1147
VectorView::iterator
Iterator1D iterator
Definition: matpackI.h:379
Range::mult
friend void mult(VectorView, const ConstMatrixView &, const ConstVectorView &)
Matrix Vector multiplication.
Definition: matpackI.cc:1607
ConstMatrixView::nrows
Index nrows() const
Returns the number of rows.
Definition: matpackI.cc:796
copy
void copy(ConstIterator1D origin, const ConstIterator1D &end, Iterator1D target)
Copy data between begin and end to target.
Definition: matpackI.cc:597
ConstIterator2D::ConstIterator2D
ConstIterator2D()
Default constructor.
Definition: matpackI.h:507
ConstVectorView::mrange
Range mrange
The range of mdata that is actually used.
Definition: matpackI.h:357
Range::mstart
Index mstart
The start index.
Definition: matpackI.h:204
Iterator5D
Implementation of Tensors of Rank 5.
Definition: matpackV.h:38
MatrixView::operator-=
MatrixView & operator-=(Numeric x)
Subtraction of scalar.
Definition: matpackI.cc:1160
MatrixView::operator/=
MatrixView & operator/=(Numeric x)
Division by scalar.
Definition: matpackI.cc:1134
ConstMatrixView::transpose
friend ConstMatrixView transpose(ConstMatrixView m)
Const version of transpose.
Definition: matpackI.cc:1689
ConstVectorView::poly_root_solve
friend int poly_root_solve(Matrix &roots, Vector &coeffs)
Definition: poly_roots.cc:100
Tensor4
The Tensor4 class.
Definition: matpackIV.h:375
array.h
This file contains the definition of Array.
mult
void mult(VectorView y, const ConstMatrixView &M, const ConstVectorView &x)
Matrix Vector multiplication.
Definition: matpackI.cc:1607
ConstMatrixView::mcr
Range mcr
The column range of mdata that is actually used.
Definition: matpackI.h:654
VectorView::operator=
VectorView & operator=(const ConstVectorView &v)
Assignment operator.
Definition: matpackI.cc:368
VectorView::operator/=
VectorView operator/=(Numeric x)
Division by scalar.
Definition: matpackI.cc:429
ConstVectorView::~ConstVectorView
virtual ~ConstVectorView()
Destructor.
Definition: matpackI.h:330
ConstMatrixView::mrr
Range mrr
The row range of mdata that is actually used.
Definition: matpackI.h:652
ConstIterator4D
Const version of Iterator4D.
Definition: matpackIV.h:84
ConstTensor4View
A constant view of a Tensor4.
Definition: matpackIV.h:149
Tensor3View
The Tensor3View class.
Definition: matpackIII.h:234
Array< Numeric >
Iterator3D
Implementation of Tensors of Rank 3.
Definition: matpackIII.h:34
ConstVectorView::mult
friend void mult(VectorView, const ConstMatrixView &, const ConstVectorView &)
Matrix Vector multiplication.
Definition: matpackI.cc:1607
ConstMatrixView::~ConstMatrixView
virtual ~ConstMatrixView()
Destructor.
Definition: matpackI.h:625
ConstVectorView::end
ConstIterator1D end() const
Return const iterator behind last element.
Definition: matpackI.cc:208
MatrixView::begin
ConstIterator2D begin() const
Return const iterator to first row.
Definition: matpackI.cc:1029
ConstMatrixView::end
ConstIterator2D end() const
Return const iterator behind last row.
Definition: matpackI.cc:855
debug_matrixview_get_elem
Numeric debug_matrixview_get_elem(MatrixView &mv, Index r, Index c)
Helper function to access matrix elements.
Definition: matpackI.cc:1944
Matrix::~Matrix
virtual ~Matrix()
Destructor for Matrix.
Definition: matpackI.cc:1571
Vector::operator=
Vector & operator=(const Vector &v)
Assignment from another Vector.
Definition: matpackI.cc:718
ConstIterator6D
Const version of Iterator6D.
Definition: matpackVI.h:94
ConstMatrixView::ncols
Index ncols() const
Returns the number of columns.
Definition: matpackI.cc:802
max
Numeric max(const ConstVectorView &x)
Max function, vector version.
Definition: matpackI.cc:1782
ConstIterator1D::ConstIterator1D
ConstIterator1D(Numeric *x, Index stride)
Explicit constructor.
Definition: matpackI.h:264
Iterator1D
The iterator class for sub vectors.
Definition: matpackI.h:214
ConstIterator2D::operator!=
bool operator!=(const ConstIterator2D &other) const
Not equal operator, needed for algorithms like copy.
Definition: matpackI.h:523
ConstVectorView::nelem
Index nelem() const
Returns the number of elements.
Definition: matpackI.cc:175
Vector::~Vector
virtual ~Vector()
Destructor for Vector.
Definition: matpackI.cc:786
VectorView
The VectorView class.
Definition: matpackI.h:373
ConstIterator1D::operator*
const Numeric & operator*() const
Dereferencing.
Definition: matpackI.h:273
ConstVectorView::begin
ConstIterator1D begin() const
Return const iterator to first element.
Definition: matpackI.cc:202
Range::Range
Range(Index start, Index extent, Index stride=1)
Definition: matpackI.cc:47
ConstVectorView::sum
Numeric sum() const
The sum of all elements of a Vector.
Definition: matpackI.cc:181
ConstTensor6View
A constant view of a Tensor6.
Definition: matpackVI.h:167
Numeric
NUMERIC Numeric
The type to use for all floating point numbers.
Definition: matpack.h:33
Tensor5View
The Tensor5View class.
Definition: matpackV.h:278
Iterator1D::operator*
Numeric & operator*() const
Dereferencing.
Definition: matpackI.h:234
ConstIterator2D::mstride
Index mstride
Row stride.
Definition: matpackI.h:542
Iterator2D::Iterator2D
Iterator2D(const Iterator2D &o)
Copy constructor.
Definition: matpackI.h:466
Iterator2D::operator*
VectorView & operator*()
Dereferencing.
Definition: matpackI.h:491
ConstIterator2D::ConstIterator2D
ConstIterator2D(const ConstVectorView &x, Index stride)
Explicit constructor.
Definition: matpackI.h:514
MatrixView::operator()
Numeric & operator()(Index r, Index c)
Plain index operator.
Definition: matpackI.h:684
ConstVectorView::mdata
Numeric * mdata
Pointer to the plain C array that holds the data.
Definition: matpackI.h:359
ConstVectorView::operator[]
Numeric operator[](Index n) const
Plain const index operator.
Definition: matpackI.h:311
min
Numeric min(const ConstVectorView &x)
Min function, vector version.
Definition: matpackI.cc:1822
ConstMatrixView::operator()
Numeric operator()(Index r, Index c) const
Plain const index operator.
Definition: matpackI.h:602
Matrix::resize
void resize(Index r, Index c)
Resize function.
Definition: matpackI.cc:1549
ConstIterator1D::operator!=
bool operator!=(const ConstIterator1D &other) const
Not equal operator, needed for algorithms like copy.
Definition: matpackI.h:276
ConstMatrixView::mult
friend void mult(VectorView, const ConstMatrixView &, const ConstVectorView &)
Matrix Vector multiplication.
Definition: matpackI.cc:1607
VectorView::begin
ConstIterator1D begin() const
Return const iterator to first element.
Definition: matpackI.cc:336
Iterator6D
The outermost iterator class for rank 6 tensors.
Definition: matpackVI.h:38
Iterator2D::Iterator2D
Iterator2D()
Default constructor.
Definition: matpackI.h:463
ConstIterator2D
The const row iterator class for sub matrices.
Definition: matpackI.h:503
ConstMatrixView
A constant view of a Matrix.
Definition: matpackI.h:591
Tensor5
The Tensor5 class.
Definition: matpackV.h:443
Iterator1D::operator++
Iterator1D & operator++()
Prefix increment operator.
Definition: matpackI.h:230
Range::get_stride
Index get_stride() const
Returns the stride of the range.
Definition: matpackI.h:200
operator<<
ostream & operator<<(ostream &os, const ConstVectorView &v)
Output operator.
Definition: matpackI.cc:275
Range
The range class.
Definition: matpackI.h:148
Range::mextent
Index mextent
The number of elements.
Definition: matpackI.h:207
MatrixView::end
ConstIterator2D end() const
Return const iterator behind last row.
Definition: matpackI.cc:1035
Iterator2D::msv
VectorView msv
Current position.
Definition: matpackI.h:495
Matrix::Matrix
Matrix()
Default constructor.
Definition: matpackI.cc:1425
VectorView::operator*=
VectorView operator*=(Numeric x)
Multiplication by scalar.
Definition: matpackI.cc:420
VectorView::operator[]
Numeric & operator[](Index n)
Plain Index operator.
Definition: matpackI.h:390
Iterator4D
Implementation of Tensors of Rank 4.
Definition: matpackIV.h:38
VectorView::operator-=
VectorView operator-=(Numeric x)
Subtraction of scalar.
Definition: matpackI.cc:447
Joker
The Joker class.
Definition: matpackI.h:114
Iterator1D::mstride
Index mstride
Stride.
Definition: matpackI.h:248
ConstMatrixView::ConstMatrixView
ConstMatrixView()
Default constructor.
Definition: matpackI.cc:864
ConstTensor3View
A constant view of a Tensor3.
Definition: matpackIII.h:147
Tensor4View
The Tensor4View class.
Definition: matpackIV.h:245
ConstMatrixView::begin
ConstIterator2D begin() const
Return const iterator to first row.
Definition: matpackI.cc:847
VectorView::~VectorView
virtual ~VectorView()
Destructor.
Definition: matpackI.h:433
VectorView::MatrixView
friend class MatrixView
Definition: matpackI.h:438
Matrix::operator=
Matrix & operator=(const Matrix &x)
Assignment operator from another matrix.
Definition: matpackI.cc:1506
VectorView::end
ConstIterator1D end() const
Return const iterator behind last element.
Definition: matpackI.cc:344
Iterator2D
The row iterator class for sub matrices.
Definition: matpackI.h:459
Range::get_start
Index get_start() const
Returns the start index of the range.
Definition: matpackI.h:196
joker
const Joker joker
ConstIterator2D::operator++
ConstIterator2D & operator++()
Prefix increment operator.
Definition: matpackI.h:520
ConstIterator2D::operator->
const ConstVectorView * operator->() const
The -> operator is needed, so that we can write i->begin() to get the 1D iterators.
Definition: matpackI.h:533
Index
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:39
MatrixView::operator*=
MatrixView & operator*=(Numeric x)
Multiplication by scalar.
Definition: matpackI.cc:1121
ConstVectorView::const_iterator
ConstIterator1D const_iterator
Definition: matpackI.h:303
Tensor6
The Tensor6 class.
Definition: matpackVI.h:937
operator*
Numeric operator*(const ConstVectorView &a, const ConstVectorView &b)
Scalar product.
Definition: matpackI.cc:1582
MatrixView::get_c_array
const Numeric * get_c_array() const
Conversion to plain C-array.
Definition: matpackI.cc:1178
Iterator1D::operator!=
bool operator!=(const Iterator1D &other) const
Not equal operator, needed for algorithms like copy.
Definition: matpackI.h:237
M
#define M
Definition: rng.cc:196
Iterator1D::Iterator1D
Iterator1D()
Default constructor.
Definition: matpackI.h:217
ConstIterator1D::ConstIterator1D
ConstIterator1D(const ConstIterator1D &o)
Copy constructor.
Definition: matpackI.h:260
Vector
The Vector class.
Definition: matpackI.h:555
ConstIterator5D
Const version of Iterator5D.
Definition: matpackV.h:92
Range::mstride
Index mstride
The stride.
Definition: matpackI.h:209
ConstVectorView
A constant view of a Vector.
Definition: matpackI.h:300
VectorView::operator+=
VectorView operator+=(Numeric x)
Addition of scalar.
Definition: matpackI.cc:438
ConstVectorView::ConstMatrixView
friend class ConstMatrixView
Definition: matpackI.h:335
ConstIterator1D::mx
const Numeric * mx
Current position.
Definition: matpackI.h:284
MatrixView::~MatrixView
virtual ~MatrixView()
Destructor.
Definition: matpackI.h:737
ConstTensor5View
A constant view of a Tensor5.
Definition: matpackV.h:160
VectorView::get_c_array
const Numeric * get_c_array() const
Conversion to plain C-array.
Definition: matpackI.cc:527
Tensor7
The Tensor7 class.
Definition: matpackVII.h:1912
Tensor6View
The Tensor6View class.
Definition: matpackVI.h:450
bofstream
Binary output file stream class.
Definition: bofstream.h:45
Iterator2D::operator->
VectorView * operator->()
The -> operator is needed, so that we can write i->begin() to get the 1D iterators.
Definition: matpackI.h:488
VectorView::operator[]
Numeric operator[](Index n) const
Plain const index operator.
Definition: matpackI.h:384