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 
401  Numeric& get(Index n)
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:
418  VectorView& operator=(const ConstVectorView& v);
419  VectorView& operator=(const VectorView& v);
420  VectorView& operator=(const Vector& v);
421  VectorView& operator=(const Array<Numeric>& v);
422  VectorView& operator=(Numeric x);
423 
424  // Other operators:
425  VectorView operator*=(Numeric x);
426  VectorView operator/=(Numeric x);
427  VectorView operator+=(Numeric x);
428  VectorView operator-=(Numeric x);
429 
430  VectorView operator*=(const ConstVectorView& x);
431  VectorView operator/=(const ConstVectorView& x);
432  VectorView operator+=(const ConstVectorView& x);
433  VectorView operator-=(const ConstVectorView& x);
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);
570  Vector& operator=(Numeric x);
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 
710  Numeric& get(Index r, Index c)
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:
731  MatrixView& operator=(const ConstMatrixView& v);
732  MatrixView& operator=(const MatrixView& v);
733  MatrixView& operator=(const Matrix& v);
734  MatrixView& operator=(const ConstVectorView& v);
735  MatrixView& operator=(Numeric x);
736 
737  // Other operators:
738  MatrixView& operator*=(Numeric x);
739  MatrixView& operator/=(Numeric x);
740  MatrixView& operator+=(Numeric x);
741  MatrixView& operator-=(Numeric x);
742 
743  MatrixView& operator*=(const ConstMatrixView& x);
744  MatrixView& operator/=(const ConstMatrixView& x);
745  MatrixView& operator+=(const ConstMatrixView& x);
746  MatrixView& operator-=(const ConstMatrixView& x);
747 
748  MatrixView& operator*=(const ConstVectorView& x);
749  MatrixView& operator/=(const ConstVectorView& x);
750  MatrixView& operator+=(const ConstVectorView& x);
751  MatrixView& operator-=(const ConstVectorView& x);
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);
799  Matrix& operator=(Numeric 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
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:35
Index get_start() const
Returns the start index of the range.
Definition: matpackI.h:196
Numeric & operator*() const
Dereferencing.
Definition: matpackI.h:230
const Numeric * mx
Current position.
Definition: matpackI.h:276
Iterator1D & operator++()
Prefix increment operator.
Definition: matpackI.h:226
void swap(Vector &v1, Vector &v2)
Swaps two objects.
Definition: matpackI.cc:813
The VectorView class.
Definition: matpackI.h:372
bool operator!=(const Iterator1D &other) const
Not equal operator, needed for algorithms like copy.
Definition: matpackI.h:233
Index mstride
The stride.
Definition: matpackI.h:209
The outermost iterator class for rank 6 tensors.
Definition: matpackVI.h:38
The Tensor4View class.
Definition: matpackIV.h:243
#define C(a, b)
Definition: Faddeeva.cc:254
#define M
Definition: rng.cc:196
Const version of Iterator4D.
Definition: matpackIV.h:80
Iterator2D()
Default constructor.
Definition: matpackI.h:472
A constant view of a Tensor7.
Definition: matpackVII.h:162
virtual ~MatrixView()
Destructor.
Definition: matpackI.h:758
VectorView * operator->()
The -> operator is needed, so that we can write i->begin() to get the 1D iterators.
Definition: matpackI.h:493
The Tensor7View class.
Definition: matpackVII.h:780
Index mstart
The start index.
Definition: matpackI.h:204
Numeric * mdata
Pointer to the plain C array that holds the data.
Definition: matpackI.h:667
ConstIterator1D()
Default constructor.
Definition: matpackI.h:252
The Vector class.
Definition: matpackI.h:556
The MatrixView class.
Definition: matpackI.h:679
Implementation of Tensors of Rank 4.
Definition: matpackIV.h:38
A constant view of a Tensor6.
Definition: matpackVI.h:159
ConstMatrixView transpose(ConstMatrixView m)
Const version of transpose.
Definition: matpackI.cc:1799
Numeric operator()(Index r, Index c) const
Plain const index operator.
Definition: matpackI.h:687
virtual ~ConstVectorView()
Destructor.
Definition: matpackI.h:329
The Sparse class.
Definition: matpackII.h:55
VectorView msv
Current position.
Definition: matpackI.h:500
The Tensor4 class.
Definition: matpackIV.h:383
The range class.
Definition: matpackI.h:148
Numeric & operator[](Index n)
Plain Index operator.
Definition: matpackI.h:393
Const version of Iterator6D.
Definition: matpackVI.h:90
std::ostream & operator<<(std::ostream &os, const ConstVectorView &v)
Output operator.
Definition: matpackI.cc:285
Numeric get(Index r, Index c) const
Get element implementation without assertions.
Definition: matpackI.h:618
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
ConstVectorView msv
Current position.
Definition: matpackI.h:541
Index mstride
Stride.
Definition: matpackI.h:278
The Tensor6View class.
Definition: matpackVI.h:449
The row iterator class for sub matrices.
Definition: matpackI.h:468
The Tensor7 class.
Definition: matpackVII.h:1931
virtual ~VectorView()
Destructor.
Definition: matpackI.h:442
bool operator!=(const ConstIterator2D &other) const
Not equal operator, needed for algorithms like copy.
Definition: matpackI.h:524
const ConstVectorView * operator->() const
The -> operator is needed, so that we can write i->begin() to get the 1D iterators.
Definition: matpackI.h:534
A constant view of a Tensor4.
Definition: matpackIV.h:141
Numeric operator[](Index n) const
Plain const index operator.
Definition: matpackI.h:383
const Joker joker
Iterator1D()
Default constructor.
Definition: matpackI.h:217
This file contains the definition of Array.
Iterator1D(Numeric *x, Index stride)
Explicit constructor.
Definition: matpackI.h:220
The const row iterator class for sub matrices.
Definition: matpackI.h:508
The Tensor3 class.
Definition: matpackIII.h:348
Range mrr
The row range of mdata that is actually used.
Definition: matpackI.h:663
The Joker class.
Definition: matpackI.h:114
const Numeric & operator*() const
Dereferencing.
Definition: matpackI.h:265
Iterator2D(const VectorView &x, Index stride)
Explicit constructor.
Definition: matpackI.h:475
The Tensor3View class.
Definition: matpackIII.h:232
Numeric debug_matrixview_get_elem(MatrixView &mv, Index r, Index c)
Helper function to access matrix elements.
Definition: matpackI.cc:2054
Numeric get(Index n) const
Get element implementation without assertions.
Definition: matpackI.h:311
bool operator!=(const Iterator2D &other) const
Not equal operator, needed for algorithms like copy.
Definition: matpackI.h:483
void cross3(VectorView c, const ConstVectorView &a, const ConstVectorView &b)
cross3
Definition: matpackI.cc:1743
Numeric operator[](Index n) const
Plain const index operator.
Definition: matpackI.h:303
Numeric operator()(Index r, Index c) const
Plain const index operator.
Definition: matpackI.h:607
ConstIterator2D()
Default constructor.
Definition: matpackI.h:512
A constant view of a Tensor5.
Definition: matpackV.h:152
NUMERIC Numeric
The type to use for all floating point numbers.
Definition: matpack.h:29
The Matrix class.
Definition: matpackI.h:788
Implementation of Tensors of Rank 7.
Definition: matpackVII.h:36
Index get_stride() const
Returns the stride of the range.
Definition: matpackI.h:200
Range mcr
The column range of mdata that is actually used.
Definition: matpackI.h:665
ConstIterator2D(const ConstVectorView &x, Index stride)
Explicit constructor.
Definition: matpackI.h:515
Index mextent
The number of elements.
Definition: matpackI.h:207
Const version of Iterator5D.
Definition: matpackV.h:88
The Tensor5View class.
Definition: matpackV.h:276
Numeric mean(const ConstVectorView &x)
Mean function, vector version.
Definition: matpackI.cc:1972
Iterator2D & operator++()
Prefix increment operator.
Definition: matpackI.h:480
ConstIterator1D & operator++()
Prefix increment operator.
Definition: matpackI.h:261
Implementation of Tensors of Rank 5.
Definition: matpackV.h:38
VectorView & operator*()
Dereferencing.
Definition: matpackI.h:496
Numeric operator*(const ConstVectorView &a, const ConstVectorView &b)
Scalar product.
Definition: matpackI.cc:1623
ConstIterator2D const_iterator
Definition: matpackI.h:599
Const version of Iterator7D.
Definition: matpackVII.h:90
Index mstride
Row stride.
Definition: matpackI.h:502
A constant view of a Tensor3.
Definition: matpackIII.h:139
The Tensor6 class.
Definition: matpackVI.h:950
A constant view of a Vector.
Definition: matpackI.h:292
const ConstVectorView & operator*() const
Dereferencing.
Definition: matpackI.h:537
Binary output file stream class.
Definition: bofstream.h:44
Numeric * mdata
Pointer to the plain C array that holds the data.
Definition: matpackI.h:358
A constant view of a Matrix.
Definition: matpackI.h:596
Implementation of Tensors of Rank 3.
Definition: matpackIII.h:34
ConstIterator1D(Numeric *x, Index stride)
Explicit constructor.
Definition: matpackI.h:256
Numeric max(const ConstVectorView &x)
Max function, vector version.
Definition: matpackI.cc:1892
Index mstride
Row stride.
Definition: matpackI.h:543
Numeric * mx
Current position.
Definition: matpackI.h:242
Range mrange
The range of mdata that is actually used.
Definition: matpackI.h:356
The constant iterator class for sub vectors.
Definition: matpackI.h:249
void mult(VectorView y, const ConstMatrixView &M, const ConstVectorView &x)
Matrix Vector multiplication.
Definition: matpackI.cc:1648
Iterator2D iterator
Definition: matpackI.h:682
Numeric min(const ConstVectorView &x)
Min function, vector version.
Definition: matpackI.cc:1932
Index get_extent() const
Returns the extent of the range.
Definition: matpackI.h:198
Numeric vector_angle(ConstVectorView a, ConstVectorView b)
Definition: matpackI.cc:1763
bool operator!=(const ConstIterator1D &other) const
Not equal operator, needed for algorithms like copy.
Definition: matpackI.h:268
Index mstride
Stride.
Definition: matpackI.h:244
Iterator1D iterator
Definition: matpackI.h:378
The iterator class for sub vectors.
Definition: matpackI.h:214
int poly_root_solve(Matrix &roots, Vector &coeffs)
Definition: poly_roots.cc:100
void copy(ConstIterator1D origin, const ConstIterator1D &end, Iterator1D target)
Copy data between begin and end to target.
Definition: matpackI.cc:612
Numeric & operator()(Index r, Index c)
Plain index operator.
Definition: matpackI.h:699
virtual ~ConstMatrixView()
Destructor.
Definition: matpackI.h:636
Const version of Iterator3D.
Definition: matpackIII.h:78
ConstIterator1D const_iterator
Definition: matpackI.h:295
Numeric * get_raw_data()
Definition: matpackI.h:811
The Tensor5 class.
Definition: matpackV.h:451
void proj(Vector &c, ConstVectorView a, ConstVectorView b)
Definition: matpackI.cc:1787
ConstIterator2D & operator++()
Prefix increment operator.
Definition: matpackI.h:521