ARTS  2.2.66
matpackI.h
Go to the documentation of this file.
1 /* Copyright (C) 2001-2012 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 
220  Iterator1D(Numeric *x, Index stride) : mx(x), mstride(stride)
221  { /* Nothing to do here. */ }
222 
223  // Operators:
224 
227  { mx += mstride; return *this; }
228 
230  Numeric& operator*() const { return *mx; }
231 
233  bool operator!=(const Iterator1D& other) const
234  { if (mx != other.mx) return true; else return false; }
235 
236  friend void copy(ConstIterator1D origin,
237  const ConstIterator1D& end,
238  Iterator1D target);
239 
240 private:
245 };
246 
250 public:
252  ConstIterator1D() : mx(NULL), mstride(0)
253  { /* Nothing to do here. */ }
254 
256  ConstIterator1D(Numeric *x, Index stride) : mx(x), mstride(stride)
257  { /* Nothing to do here. */ }
258 
259  // Operators:
262  { mx += mstride; return *this; }
263 
265  const Numeric& operator*() const { return *mx; }
266 
268  bool operator!=(const ConstIterator1D& other) const
269  { if (mx != other.mx) return true; else return false; }
270 
271  friend void copy(ConstIterator1D origin,
272  const ConstIterator1D& end,
273  Iterator1D target);
274 private:
276  const Numeric *mx;
279 };
280 
281 // Declare the vector class:
282 class Vector;
283 
284 // Declare the MatrixView class
285 class MatrixView;
286 
293 public:
294  // Typedef for compatibility with STL
296 
297  // Member functions:
298  Index nelem() const;
299  Numeric sum() const;
300 
301  // Const index operators:
304  { // Check if index is valid:
305  assert( 0<=n );
306  assert( n<mrange.mextent );
307  return get(n);
308  }
309 
311  Numeric get(Index n) const
312  {
313  return *( mdata +
314  mrange.mstart +
315  n*mrange.mstride );
316  }
317 
318  ConstVectorView operator[](const Range& r) const;
319  friend Numeric operator*(const ConstVectorView& a, const ConstVectorView& b);
320 
321  // Functions returning iterators:
322  ConstIterator1D begin() const;
323  ConstIterator1D end() const;
324 
325  // Conversion to 1 column matrix:
326  operator ConstMatrixView() const;
327 
329  virtual ~ConstVectorView() {}
330 
331  // Friends:
332  friend class VectorView;
333  friend class ConstIterator2D;
334  friend class ConstMatrixView;
335  friend class ConstTensor3View;
336  friend class ConstTensor4View;
337  friend class ConstTensor5View;
338  friend class ConstTensor6View;
339  friend class ConstTensor7View;
340  friend int poly_root_solve (Matrix& roots, Vector& coeffs);
341  friend void mult (VectorView, const ConstMatrixView&,
342  const ConstVectorView&);
343 
344  // A special constructor, that allows to make a ConstVectorView of a scalar.
345  ConstVectorView(const Numeric& a);
346 
347 protected:
348  // Constructors:
349  ConstVectorView();
350  ConstVectorView(Numeric *data, const Range& range);
351  ConstVectorView(Numeric *data, const Range& p, const Range& n);
352 
353  // Data members:
354  // -------------
359 };
360 
372 class VectorView : public ConstVectorView {
373 public:
374  VectorView (const Vector&);
375  VectorView (Vector& v);
376 
377  // Typedef for compatibility with STL
379 
380  // Const index operators:
384  { return ConstVectorView::operator[](n); }
385 
387  Numeric get(Index n) const
388  { return ConstVectorView::get(n); }
389 
390  ConstVectorView operator[](const Range& r) const;
391 
394  { // Check if index is valid:
395  assert( 0<=n );
396  assert( n<mrange.mextent );
397  return get(n);
398  }
399 
402  {
403  return *( mdata +
404  mrange.mstart +
405  n*mrange.mstride );
406  }
407 
408  VectorView operator[](const Range& r);
409 
410  // Constant iterators:
411  ConstIterator1D begin() const;
412  ConstIterator1D end() const;
413  // Iterators:
414  Iterator1D begin();
415  Iterator1D end();
416 
417  // Assignment operators:
419  VectorView& operator=(const VectorView& v);
420  VectorView& operator=(const Vector& v);
421  VectorView& operator=(const Array<Numeric>& v);
423 
424  // Other operators:
429 
434 
435  // Conversion to 1 column matrix:
436  operator MatrixView();
437  // Conversion to a plain C-array
438  const Numeric *get_c_array() const;
439  Numeric *get_c_array();
440 
442  virtual ~VectorView() {}
443 
444  // Friends:
445  friend class ConstIterator2D;
446  friend class Iterator2D;
447  friend class MatrixView;
448  friend class Tensor3View;
449  friend class Tensor4View;
450  friend class Tensor5View;
451  friend class Tensor6View;
452  friend class Tensor7View;
453 
454  // A special constructor, that allows to make a VectorView of a scalar.
455  VectorView(Numeric& a);
456 
457 
458 protected:
459  // Constructors:
460  VectorView();
461  VectorView(Numeric *data, const Range& range);
462  VectorView(Numeric *data, const Range& p, const Range& n);
463 };
464 
468 class Iterator2D {
469 public:
470  // Constructors:
472  Iterator2D() : msv(), mstride(0) { /* Nothing to do here. */ }
473 
475  Iterator2D(const VectorView& x, Index stride) : msv(x), mstride(stride)
476  { /* Nothing to do here. */ }
477 
478  // Operators:
480  Iterator2D& operator++() { msv.mdata += mstride; return *this; }
481 
483  bool operator!=(const Iterator2D& other) const
484  { if ( msv.mdata + msv.mrange.mstart !=
485  other.msv.mdata + other.msv.mrange.mstart )
486  return true;
487  else
488  return false;
489  }
490 
493  VectorView * operator->() { return &msv; }
494 
496  VectorView& operator*() { return msv; }
497 
498 private:
503 };
504 
509 public:
510  // Constructors:
512  ConstIterator2D() : msv(), mstride(0) { /* Nothing to do here. */ }
513 
516  : msv(x), mstride(stride)
517  { /* Nothing to do here. */ }
518 
519  // Operators:
521  ConstIterator2D& operator++() { msv.mdata += mstride; return *this; }
522 
524  bool operator!=(const ConstIterator2D& other) const
525  { if ( msv.mdata + msv.mrange.mstart !=
526  other.msv.mdata + other.msv.mrange.mstart )
527  return true;
528  else
529  return false;
530  }
531 
534  const ConstVectorView* operator->() const { return &msv; }
535 
537  const ConstVectorView& operator*() const { return msv; }
538 
539 private:
544 };
545 
556 class Vector : public VectorView {
557 public:
558  // Constructors:
559  Vector();
560  explicit Vector(Index n);
561  Vector(Index n, Numeric fill);
562  Vector(Numeric start, Index extent, Numeric stride);
563  Vector(const ConstVectorView& v);
564  Vector(const Vector& v);
565  Vector(const std::vector<Numeric>&);
566 
567  // Assignment operators:
568  Vector& operator=(Vector v);
569  Vector& operator=(const Array<Numeric>& v);
571 
572  // Resize function:
573  void resize(Index n);
574 
575  // Swap function:
576  friend void swap(Vector& v1, Vector& v2);
577 
578  // Destructor:
579  virtual ~Vector();
580 };
581 
582 // Declare class Matrix:
583 class Matrix;
584 
585 
597 public:
598  // Typedef for compatibility with STL
600 
601  // Member functions:
602  Index nrows() const;
603  Index ncols() const;
604 
605  // Const index operators:
608  { // Check if indices are valid:
609  assert( 0<=r );
610  assert( 0<=c );
611  assert( r<mrr.mextent );
612  assert( c<mcr.mextent );
613 
614  return get(r, c);
615  }
616 
618  Numeric get(Index r, Index c) const
619  {
620  return *( mdata +
621  mrr.mstart +
622  r*mrr.mstride +
623  mcr.mstart +
624  c*mcr.mstride );
625  }
626 
627  ConstMatrixView operator()(const Range& r, const Range& c) const;
628  ConstVectorView operator()(const Range& r, Index c) const;
629  ConstVectorView operator()(Index r, const Range& c) const;
630 
631  // Functions returning iterators:
632  ConstIterator2D begin() const;
633  ConstIterator2D end() const;
634 
636  virtual ~ConstMatrixView() {}
637 
638  // Friends:
639  friend class MatrixView;
640  friend class ConstIterator3D;
641  friend class ConstVectorView;
642  friend class ConstTensor3View;
643  friend class ConstTensor4View;
644  friend class ConstTensor5View;
645  friend class ConstTensor6View;
646  friend class ConstTensor7View;
648  friend int poly_root_solve (Matrix& roots, Vector& coeffs);
649  friend void mult (VectorView, const ConstMatrixView&,
650  const ConstVectorView&);
651 
652 protected:
653  // Constructors:
654  ConstMatrixView();
655  ConstMatrixView(Numeric *data, const Range& r, const Range& c);
656  ConstMatrixView(Numeric *data,
657  const Range& pr, const Range& pc,
658  const Range& nr, const Range& nc);
659 
660  // Data members:
661  // -------------
668 };
669 
679 class MatrixView : public ConstMatrixView {
680 public:
681  // Typedef for compatibility with STL
683 
684  // Const index operators:
688  { return ConstMatrixView::operator()(r,c); }
689 
691  Numeric get(Index r, Index c) const
692  { return ConstMatrixView::get(r,c); }
693 
694  ConstMatrixView operator()(const Range& r, const Range& c) const;
695  ConstVectorView operator()(const Range& r, Index c) const;
696  ConstVectorView operator()(Index r, const Range& c) const;
697  // Index Operators:
700  { // Check if indices are valid:
701  assert( 0<=r );
702  assert( 0<=c );
703  assert( r<mrr.mextent );
704  assert( c<mcr.mextent );
705 
706  return get(r, c);
707  }
708 
711  {
712  return *( mdata +
713  mrr.mstart +
714  r*mrr.mstride +
715  mcr.mstart +
716  c*mcr.mstride );
717  }
718 
719  MatrixView operator()(const Range& r, const Range& c);
720  VectorView operator()(const Range& r, Index c);
721  VectorView operator()(Index r, const Range& c);
722 
723  // Functions returning const iterators:
724  ConstIterator2D begin() const;
725  ConstIterator2D end() const;
726  // Functions returning iterators:
727  Iterator2D begin();
728  Iterator2D end();
729 
730  // Assignment operators:
732  MatrixView& operator=(const MatrixView& v);
733  MatrixView& operator=(const Matrix& v);
736 
737  // Other operators:
742 
747 
752 
753  // Conversion to a plain C-array
754  const Numeric *get_c_array() const;
755  Numeric *get_c_array();
756 
758  virtual ~MatrixView() {}
759 
760  // Friends:
761  friend class VectorView;
762  friend class Iterator3D;
763  friend class Tensor3View;
764  friend class Tensor4View;
765  friend class Tensor5View;
766  friend class Tensor6View;
767  friend class Tensor7View;
769  friend MatrixView transpose(MatrixView m);
770 
771 protected:
772  // Constructors:
773  MatrixView();
774  MatrixView(Numeric *data, const Range& r, const Range& c);
775  MatrixView(Numeric *data,
776  const Range& pr, const Range& pc,
777  const Range& nr, const Range& nc);
778 };
779 
788 class Matrix : public MatrixView {
789 public:
790  // Constructors:
791  Matrix();
792  Matrix(Index r, Index c);
793  Matrix(Index r, Index c, Numeric fill);
794  Matrix(const ConstMatrixView& v);
795  Matrix(const Matrix& v);
796 
797  // Assignment operators:
798  Matrix& operator=(Matrix x);
800  Matrix& operator=(const ConstVectorView& v);
801 
802  // Resize function:
803  void resize(Index r, Index c);
804 
805  // Swap function:
806  friend void swap(Matrix& m1, Matrix& m2);
807 
808  // Destructor:
809  virtual ~Matrix();
810 
811  Numeric *get_raw_data() { return mdata; }
812 };
813 
814 // Function declarations:
815 // ----------------------
816 
817 void copy(ConstIterator1D origin,
818  const ConstIterator1D& end,
819  Iterator1D target);
820 
821 void copy(Numeric x,
822  Iterator1D target,
823  const Iterator1D& end);
824 
825 void copy(ConstIterator2D origin,
826  const ConstIterator2D& end,
827  Iterator2D target);
828 
829 void copy(Numeric x,
830  Iterator2D target,
831  const Iterator2D& end);
832 
833 void mult( VectorView y,
834  const ConstMatrixView& M,
835  const ConstVectorView& x );
836 
837 void mult( MatrixView A,
838  const ConstMatrixView& B,
839  const ConstMatrixView& C );
840 
841 void cross3(VectorView c,
842  const ConstVectorView& a,
843  const ConstVectorView& b);
844 
846 
848 
850 
852 
853 void transform( VectorView y,
854  double (&my_func)(double),
855  ConstVectorView x );
856 
857 void transform( MatrixView y,
858  double (&my_func)(double),
859  ConstMatrixView x );
860 
861 Numeric max(const ConstVectorView& x);
862 
863 Numeric max(const ConstMatrixView& x);
864 
865 Numeric min(const ConstVectorView& x);
866 
867 Numeric min(const ConstMatrixView& x);
868 
869 Numeric mean(const ConstVectorView& x);
870 
871 Numeric mean(const ConstMatrixView& x);
872 
874 
875 std::ostream& operator<<(std::ostream& os, const ConstVectorView& v);
876 
877 std::ostream& operator<<(std::ostream& os, const ConstMatrixView& v);
878 
880 // Helper function for debugging
881 #ifndef NDEBUG
882 
884 
885 #endif
886 
888 #endif // matpackI_h
Matrix
The Matrix class.
Definition: matpackI.h:788
ConstIterator7D
Const version of Iterator7D.
Definition: matpackVII.h:90
MatrixView::operator()
Numeric operator()(Index r, Index c) const
Plain const index operator.
Definition: matpackI.h:687
Tensor7View
The Tensor7View class.
Definition: matpackVII.h:780
Iterator1D::mx
Numeric * mx
Current position.
Definition: matpackI.h:242
ConstIterator1D::copy
friend void copy(ConstIterator1D origin, const ConstIterator1D &end, Iterator1D target)
Copy data between begin and end to target.
Definition: matpackI.cc:612
ConstIterator1D::operator++
ConstIterator1D & operator++()
Prefix increment operator.
Definition: matpackI.h:261
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:1838
Range::get_extent
Index get_extent() const
Returns the extent of the range.
Definition: matpackI.h:198
ConstVectorView::operator*
friend Numeric operator*(const ConstVectorView &a, const ConstVectorView &b)
Scalar product.
Definition: matpackI.cc:1623
Matrix::operator=
Matrix & operator=(Matrix x)
Assignment operator from another matrix.
Definition: matpackI.cc:1542
MatrixView
The MatrixView class.
Definition: matpackI.h:679
VectorView::VectorView
VectorView()
Default constructor.
Definition: matpackI.cc:575
Iterator2D::operator!=
bool operator!=(const Iterator2D &other) const
Not equal operator, needed for algorithms like copy.
Definition: matpackI.h:483
matpack.h
ConstIterator2D::msv
ConstVectorView msv
Current position.
Definition: matpackI.h:541
Iterator2D::operator++
Iterator2D & operator++()
Prefix increment operator.
Definition: matpackI.h:480
MatrixView::operator=
MatrixView & operator=(const ConstMatrixView &v)
Assignment operator.
Definition: matpackI.cc:1095
ConstIterator2D::operator*
const ConstVectorView & operator*() const
Dereferencing.
Definition: matpackI.h:537
Vector::Vector
Vector()
Default constructor.
Definition: matpackI.cc:639
Tensor3
The Tensor3 class.
Definition: matpackIII.h:348
ConstIterator1D
The constant iterator class for sub vectors.
Definition: matpackI.h:249
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:220
transpose
ConstMatrixView transpose(ConstMatrixView m)
Const version of transpose.
Definition: matpackI.cc:1799
MatrixView::MatrixView
MatrixView()
Default constructor.
Definition: matpackI.cc:1380
ConstTensor7View
A constant view of a Tensor7.
Definition: matpackVII.h:162
Matrix::get_raw_data
Numeric * get_raw_data()
Definition: matpackI.h:811
MatrixView::iterator
Iterator2D iterator
Definition: matpackI.h:682
ConstMatrixView::const_iterator
ConstIterator2D const_iterator
Definition: matpackI.h:599
Iterator2D::mstride
Index mstride
Row stride.
Definition: matpackI.h:502
mean
Numeric mean(const ConstVectorView &x)
Mean function, vector version.
Definition: matpackI.cc:1972
MatrixView::transpose
friend ConstMatrixView transpose(ConstMatrixView m)
Const version of transpose.
Definition: matpackI.cc:1799
Iterator7D
Implementation of Tensors of Rank 7.
Definition: matpackVII.h:36
ConstIterator1D::mstride
Index mstride
Stride.
Definition: matpackI.h:278
ConstIterator3D
Const version of Iterator3D.
Definition: matpackIII.h:78
Vector::operator=
Vector & operator=(Vector v)
Assignment from another Vector.
Definition: matpackI.cc:746
vector_angle
Numeric vector_angle(ConstVectorView a, ConstVectorView b)
Definition: matpackI.cc:1763
ConstMatrixView::mdata
Numeric * mdata
Pointer to the plain C array that holds the data.
Definition: matpackI.h:667
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:612
ConstIterator1D::ConstIterator1D
ConstIterator1D()
Default constructor.
Definition: matpackI.h:252
Iterator2D::Iterator2D
Iterator2D(const VectorView &x, Index stride)
Explicit constructor.
Definition: matpackI.h:475
Vector::resize
void resize(Index n)
Resize function.
Definition: matpackI.cc:798
ConstVectorView::ConstVectorView
ConstVectorView()
Default constructor.
Definition: matpackI.cc:247
MatrixView::operator+=
MatrixView & operator+=(Numeric x)
Addition of scalar.
Definition: matpackI.cc:1183
ConstVectorView::get
Numeric get(Index n) const
Get element implementation without assertions.
Definition: matpackI.h:311
VectorView::iterator
Iterator1D iterator
Definition: matpackI.h:378
Range::mult
friend void mult(VectorView, const ConstMatrixView &, const ConstVectorView &)
Matrix Vector multiplication.
Definition: matpackI.cc:1648
ConstMatrixView::nrows
Index nrows() const
Returns the number of rows.
Definition: matpackI.cc:832
copy
void copy(ConstIterator1D origin, const ConstIterator1D &end, Iterator1D target)
Copy data between begin and end to target.
Definition: matpackI.cc:612
Matrix::swap
friend void swap(Matrix &m1, Matrix &m2)
Swaps two objects.
Definition: matpackI.cc:1602
ConstIterator2D::ConstIterator2D
ConstIterator2D()
Default constructor.
Definition: matpackI.h:512
ConstVectorView::mrange
Range mrange
The range of mdata that is actually used.
Definition: matpackI.h:356
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:1196
ConstMatrixView::get
Numeric get(Index r, Index c) const
Get element implementation without assertions.
Definition: matpackI.h:618
MatrixView::operator/=
MatrixView & operator/=(Numeric x)
Division by scalar.
Definition: matpackI.cc:1170
VectorView::get
Numeric get(Index n) const
Get element implementation without assertions.
Definition: matpackI.h:387
ConstMatrixView::transpose
friend ConstMatrixView transpose(ConstMatrixView m)
Const version of transpose.
Definition: matpackI.cc:1799
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:383
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:1648
MatrixView::get
Numeric & get(Index r, Index c)
Get element implementation without assertions.
Definition: matpackI.h:710
ConstMatrixView::mcr
Range mcr
The column range of mdata that is actually used.
Definition: matpackI.h:665
VectorView::operator=
VectorView & operator=(const ConstVectorView &v)
Assignment operator.
Definition: matpackI.cc:378
VectorView::operator/=
VectorView operator/=(Numeric x)
Division by scalar.
Definition: matpackI.cc:439
ConstVectorView::~ConstVectorView
virtual ~ConstVectorView()
Destructor.
Definition: matpackI.h:329
ConstMatrixView::mrr
Range mrr
The row range of mdata that is actually used.
Definition: matpackI.h:663
ConstIterator4D
Const version of Iterator4D.
Definition: matpackIV.h:80
ConstTensor4View
A constant view of a Tensor4.
Definition: matpackIV.h:141
Tensor3View
The Tensor3View class.
Definition: matpackIII.h:232
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:1648
ConstMatrixView::~ConstMatrixView
virtual ~ConstMatrixView()
Destructor.
Definition: matpackI.h:636
ConstVectorView::end
ConstIterator1D end() const
Return const iterator behind last element.
Definition: matpackI.cc:213
MatrixView::begin
ConstIterator2D begin() const
Return const iterator to first row.
Definition: matpackI.cc:1065
ConstMatrixView::end
ConstIterator2D end() const
Return const iterator behind last row.
Definition: matpackI.cc:891
debug_matrixview_get_elem
Numeric debug_matrixview_get_elem(MatrixView &mv, Index r, Index c)
Helper function to access matrix elements.
Definition: matpackI.cc:2054
Matrix::~Matrix
virtual ~Matrix()
Destructor for Matrix.
Definition: matpackI.cc:1612
operator<<
std::ostream & operator<<(std::ostream &os, const ConstVectorView &v)
Output operator.
Definition: matpackI.cc:285
ConstIterator6D
Const version of Iterator6D.
Definition: matpackVI.h:90
ConstMatrixView::ncols
Index ncols() const
Returns the number of columns.
Definition: matpackI.cc:838
max
Numeric max(const ConstVectorView &x)
Max function, vector version.
Definition: matpackI.cc:1892
ConstIterator1D::ConstIterator1D
ConstIterator1D(Numeric *x, Index stride)
Explicit constructor.
Definition: matpackI.h:256
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:524
ConstVectorView::nelem
Index nelem() const
Returns the number of elements.
Definition: matpackI.cc:180
Vector::~Vector
virtual ~Vector()
Destructor for Vector.
Definition: matpackI.cc:822
VectorView
The VectorView class.
Definition: matpackI.h:372
ConstIterator1D::operator*
const Numeric & operator*() const
Dereferencing.
Definition: matpackI.h:265
ConstVectorView::begin
ConstIterator1D begin() const
Return const iterator to first element.
Definition: matpackI.cc:207
Range::Range
Range(Index start, Index extent, Index stride=1)
Definition: matpackI.cc:52
ConstVectorView::sum
Numeric sum() const
The sum of all elements of a Vector.
Definition: matpackI.cc:186
ConstTensor6View
A constant view of a Tensor6.
Definition: matpackVI.h:159
Numeric
NUMERIC Numeric
The type to use for all floating point numbers.
Definition: matpack.h:29
Tensor5View
The Tensor5View class.
Definition: matpackV.h:276
Iterator1D::operator*
Numeric & operator*() const
Dereferencing.
Definition: matpackI.h:230
ConstIterator2D::mstride
Index mstride
Row stride.
Definition: matpackI.h:543
C
#define C(a, b)
Definition: Faddeeva.cc:254
Iterator2D::operator*
VectorView & operator*()
Dereferencing.
Definition: matpackI.h:496
Vector::swap
friend void swap(Vector &v1, Vector &v2)
Swaps two objects.
Definition: matpackI.cc:813
ConstIterator2D::ConstIterator2D
ConstIterator2D(const ConstVectorView &x, Index stride)
Explicit constructor.
Definition: matpackI.h:515
MatrixView::operator()
Numeric & operator()(Index r, Index c)
Plain index operator.
Definition: matpackI.h:699
ConstVectorView::mdata
Numeric * mdata
Pointer to the plain C array that holds the data.
Definition: matpackI.h:358
ConstVectorView::operator[]
Numeric operator[](Index n) const
Plain const index operator.
Definition: matpackI.h:303
min
Numeric min(const ConstVectorView &x)
Min function, vector version.
Definition: matpackI.cc:1932
ConstMatrixView::operator()
Numeric operator()(Index r, Index c) const
Plain const index operator.
Definition: matpackI.h:607
Matrix::resize
void resize(Index r, Index c)
Resize function.
Definition: matpackI.cc:1580
ConstIterator1D::operator!=
bool operator!=(const ConstIterator1D &other) const
Not equal operator, needed for algorithms like copy.
Definition: matpackI.h:268
ConstMatrixView::mult
friend void mult(VectorView, const ConstMatrixView &, const ConstVectorView &)
Matrix Vector multiplication.
Definition: matpackI.cc:1648
MatrixView::get
Numeric get(Index r, Index c) const
Get element implementation without assertions.
Definition: matpackI.h:691
VectorView::begin
ConstIterator1D begin() const
Return const iterator to first element.
Definition: matpackI.cc:346
Iterator6D
The outermost iterator class for rank 6 tensors.
Definition: matpackVI.h:38
Iterator2D::Iterator2D
Iterator2D()
Default constructor.
Definition: matpackI.h:472
ConstIterator2D
The const row iterator class for sub matrices.
Definition: matpackI.h:508
ConstMatrixView
A constant view of a Matrix.
Definition: matpackI.h:596
cross3
void cross3(VectorView c, const ConstVectorView &a, const ConstVectorView &b)
cross3
Definition: matpackI.cc:1743
Tensor5
The Tensor5 class.
Definition: matpackV.h:451
Iterator1D::operator++
Iterator1D & operator++()
Prefix increment operator.
Definition: matpackI.h:226
Range::get_stride
Index get_stride() const
Returns the stride of the range.
Definition: matpackI.h:200
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:1071
Iterator2D::msv
VectorView msv
Current position.
Definition: matpackI.h:500
Matrix::Matrix
Matrix()
Default constructor.
Definition: matpackI.cc:1461
VectorView::operator*=
VectorView operator*=(Numeric x)
Multiplication by scalar.
Definition: matpackI.cc:430
VectorView::operator[]
Numeric & operator[](Index n)
Plain Index operator.
Definition: matpackI.h:393
Iterator4D
Implementation of Tensors of Rank 4.
Definition: matpackIV.h:38
VectorView::operator-=
VectorView operator-=(Numeric x)
Subtraction of scalar.
Definition: matpackI.cc:457
Joker
The Joker class.
Definition: matpackI.h:114
Iterator1D::mstride
Index mstride
Stride.
Definition: matpackI.h:244
ConstMatrixView::ConstMatrixView
ConstMatrixView()
Default constructor.
Definition: matpackI.cc:900
ConstTensor3View
A constant view of a Tensor3.
Definition: matpackIII.h:139
Tensor4View
The Tensor4View class.
Definition: matpackIV.h:243
VectorView::get
Numeric & get(Index n)
Get element implementation without assertions.
Definition: matpackI.h:401
ConstMatrixView::begin
ConstIterator2D begin() const
Return const iterator to first row.
Definition: matpackI.cc:883
VectorView::~VectorView
virtual ~VectorView()
Destructor.
Definition: matpackI.h:442
VectorView::MatrixView
friend class MatrixView
Definition: matpackI.h:447
VectorView::end
ConstIterator1D end() const
Return const iterator behind last element.
Definition: matpackI.cc:354
Iterator2D
The row iterator class for sub matrices.
Definition: matpackI.h:468
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:521
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:534
Index
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:35
MatrixView::operator*=
MatrixView & operator*=(Numeric x)
Multiplication by scalar.
Definition: matpackI.cc:1157
ConstVectorView::const_iterator
ConstIterator1D const_iterator
Definition: matpackI.h:295
Tensor6
The Tensor6 class.
Definition: matpackVI.h:950
operator*
Numeric operator*(const ConstVectorView &a, const ConstVectorView &b)
Scalar product.
Definition: matpackI.cc:1623
MatrixView::get_c_array
const Numeric * get_c_array() const
Conversion to plain C-array.
Definition: matpackI.cc:1214
Iterator1D::operator!=
bool operator!=(const Iterator1D &other) const
Not equal operator, needed for algorithms like copy.
Definition: matpackI.h:233
M
#define M
Definition: rng.cc:196
Iterator1D::Iterator1D
Iterator1D()
Default constructor.
Definition: matpackI.h:217
Vector
The Vector class.
Definition: matpackI.h:556
ConstIterator5D
Const version of Iterator5D.
Definition: matpackV.h:88
Range::mstride
Index mstride
The stride.
Definition: matpackI.h:209
proj
void proj(Vector &c, ConstVectorView a, ConstVectorView b)
Definition: matpackI.cc:1787
ConstVectorView
A constant view of a Vector.
Definition: matpackI.h:292
VectorView::operator+=
VectorView operator+=(Numeric x)
Addition of scalar.
Definition: matpackI.cc:448
ConstVectorView::ConstMatrixView
friend class ConstMatrixView
Definition: matpackI.h:334
ConstIterator1D::mx
const Numeric * mx
Current position.
Definition: matpackI.h:276
MatrixView::~MatrixView
virtual ~MatrixView()
Destructor.
Definition: matpackI.h:758
ConstTensor5View
A constant view of a Tensor5.
Definition: matpackV.h:152
VectorView::get_c_array
const Numeric * get_c_array() const
Conversion to plain C-array.
Definition: matpackI.cc:542
Tensor7
The Tensor7 class.
Definition: matpackVII.h:1931
Tensor6View
The Tensor6View class.
Definition: matpackVI.h:449
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:493
VectorView::operator[]
Numeric operator[](Index n) const
Plain const index operator.
Definition: matpackI.h:383