ARTS  2.0.49
logic.h
Go to the documentation of this file.
1 /* Copyright (C) 2002-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 
26 #ifndef logic_h
27 #define logic_h
28 
29 #include "arts.h"
30 #include "matpackVII.h"
31 
32 
33 bool is_bool( const Index& x );
34 
35 bool is_multiple( const Index& x, const Index& y );
36 
37 bool is_size( ConstVectorView x,
38  const Index& l );
39 
40 bool is_size( ConstMatrixView x,
41  const Index& r,
42  const Index& c );
43 
45  const Index& p,
46  const Index& r,
47  const Index& c );
48 
50  const Index& b,
51  const Index& p,
52  const Index& r,
53  const Index& c );
54 
56  const Index& s,
57  const Index& b,
58  const Index& p,
59  const Index& r,
60  const Index& c );
61 
63  const Index& v,
64  const Index& s,
65  const Index& b,
66  const Index& p,
67  const Index& r,
68  const Index& c );
69 
71  const Index& l,
72  const Index& v,
73  const Index& s,
74  const Index& b,
75  const Index& p,
76  const Index& r,
77  const Index& c );
78 
79 bool is_sorted( ConstVectorView x );
80 
82 
83 bool is_increasing( const ArrayOfIndex& x );
84 
86 
87 bool is_unique( const ArrayOfIndex& x );
88 
90 
92 
93 bool is_same_within_epsilon( const Numeric& a,
94  const Numeric& b,
95  const Numeric& epsilon );
96 
98 // Template functions (have to be here in the .h file).
100 
102 
110 template< class T >
111 bool is_size( const Array<T>& x,
112  const Index& n )
113 {
114  return( n == x.nelem() );
115 }
116 
117 #endif // logic_h
is_decreasing
bool is_decreasing(ConstVectorView x)
Checks if a vector is sorted in reversed order and is strictly decreasing.
Definition: logic.cc:303
is_same_within_epsilon
bool is_same_within_epsilon(const Numeric &a, const Numeric &b, const Numeric &epsilon)
Check, if two numbers agree within a given epsilon.
Definition: logic.cc:421
ConstTensor7View
A constant view of a Tensor7.
Definition: matpackVII.h:169
ConstTensor4View
A constant view of a Tensor4.
Definition: matpackIV.h:149
Array< Index >
is_size
bool is_size(ConstVectorView x, const Index &l)
Verifies that the size of x is l.
Definition: logic.cc:90
is_singular
bool is_singular(ConstMatrixView A)
Checks if a square matrix is singular.
Definition: logic.cc:353
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
is_bool
bool is_bool(const Index &x)
Checks if a variable equals 0 or 1.
Definition: logic.cc:53
is_multiple
bool is_multiple(const Index &x, const Index &y)
Checks if an integer is a multiple of another integer.
Definition: logic.cc:73
is_sorted
bool is_sorted(ConstVectorView x)
Checks if a vector is sorted in ascending order.
Definition: logic.cc:238
ConstMatrixView
A constant view of a Matrix.
Definition: matpackI.h:591
is_diagonal
bool is_diagonal(ConstMatrixView A)
Checks if a square matrix is diagonal.
Definition: logic.cc:387
is_increasing
bool is_increasing(ConstVectorView x)
Checks if a vector is sorted and strictly increasing.
Definition: logic.cc:258
ConstTensor3View
A constant view of a Tensor3.
Definition: matpackIII.h:147
Index
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:39
is_unique
bool is_unique(const ArrayOfIndex &x)
Checks if an ArrayOfIndex is unique, i.e., has no duplicate values.
Definition: logic.cc:330
ConstVectorView
A constant view of a Vector.
Definition: matpackI.h:300
Array::nelem
Index nelem() const
Number of elements.
Definition: array.h:172
ConstTensor5View
A constant view of a Tensor5.
Definition: matpackV.h:160
matpackVII.h
arts.h
The global header file for ARTS.