ARTS  2.2.66
logic.h
Go to the documentation of this file.
1 /* Copyright (C) 2002-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 
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  const Numeric& epsilon = 0.001 );
99 
100 
102 // Template functions (have to be here in the .h file).
104 
106 
114 template< class T >
115 bool is_size( const Array<T>& x,
116  const Index& n )
117 {
118  return( n == x.nelem() );
119 }
120 
121 #endif // logic_h
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:35
Index nelem() const
Number of elements.
Definition: array.h:176
bool is_bool(const Index &x)
Checks if a variable equals 0 or 1.
Definition: logic.cc:54
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:446
A constant view of a Tensor7.
Definition: matpackVII.h:162
bool is_diagonal(ConstMatrixView A)
Checks if a square matrix is diagonal.
Definition: logic.cc:411
A constant view of a Tensor6.
Definition: matpackVI.h:159
bool is_unique(const ArrayOfIndex &x)
Checks if an ArrayOfIndex is unique, i.e., has no duplicate values.
Definition: logic.cc:352
bool is_sorted(ConstVectorView x)
Checks if a vector is sorted in ascending order.
Definition: logic.cc:253
bool is_decreasing(ConstVectorView x)
Checks if a vector is sorted in reversed order and is strictly decreasing.
Definition: logic.cc:324
A constant view of a Tensor4.
Definition: matpackIV.h:141
The global header file for ARTS.
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
bool is_increasing(ConstVectorView x)
Checks if a vector is sorted and strictly increasing.
Definition: logic.cc:275
bool is_size(ConstVectorView x, const Index &l)
Verifies that the size of x is l.
Definition: logic.cc:91
This can be used to make arrays out of anything.
Definition: array.h:40
A constant view of a Tensor3.
Definition: matpackIII.h:139
A constant view of a Vector.
Definition: matpackI.h:292
A constant view of a Matrix.
Definition: matpackI.h:596
bool is_multiple(const Index &x, const Index &y)
Checks if an integer is a multiple of another integer.
Definition: logic.cc:74
bool is_lon_cyclic(ConstVectorView grid, const Numeric &epsilon=0.001)
Check if the given longitude grid is cyclic.
Definition: logic.cc:466
bool is_singular(ConstMatrixView A)
Checks if a square matrix is singular.
Definition: logic.cc:377