ARTS  2.3.1285(git:92a29ea9-dirty)
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 bool is_bool(const Index& x);
33 
34 bool is_multiple(const Index& x, const Index& y);
35 
36 bool is_size(ConstVectorView x, const Index& l);
37 
38 bool is_size(ConstMatrixView x, const Index& r, const Index& c);
39 
41  const Index& p,
42  const Index& r,
43  const Index& c);
44 
46  const Index& b,
47  const Index& p,
48  const Index& r,
49  const Index& c);
50 
52  const Index& s,
53  const Index& b,
54  const Index& p,
55  const Index& r,
56  const Index& c);
57 
59  const Index& v,
60  const Index& s,
61  const Index& b,
62  const Index& p,
63  const Index& r,
64  const Index& c);
65 
67  const Index& l,
68  const Index& v,
69  const Index& s,
70  const Index& b,
71  const Index& p,
72  const Index& r,
73  const Index& c);
74 
76 
78 
79 bool is_increasing(const ArrayOfIndex& x);
80 
82 
83 bool is_unique(const ArrayOfIndex& x);
84 
86 
88 
89 bool is_same_within_epsilon(const Numeric& a,
90  const Numeric& b,
91  const Numeric& epsilon);
92 
93 bool is_lon_cyclic(ConstVectorView grid, const Numeric& epsilon = 0.001);
94 
96 // Template functions (have to be here in the .h file).
98 
100 
108 template <class T>
109 bool is_size(const Array<T>& x, const Index& n) {
110  return (n == x.nelem());
111 }
112 
113 #endif // logic_h
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:39
Index nelem() const
Number of elements.
Definition: array.h:195
bool is_bool(const Index &x)
Checks if a variable equals 0 or 1.
Definition: logic.cc:50
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:351
A constant view of a Tensor7.
Definition: matpackVII.h:147
bool is_diagonal(ConstMatrixView A)
Checks if a square matrix is diagonal.
Definition: logic.cc:323
A constant view of a Tensor6.
Definition: matpackVI.h:149
bool is_unique(const ArrayOfIndex &x)
Checks if an ArrayOfIndex is unique, i.e., has no duplicate values.
Definition: logic.cc:274
bool is_sorted(ConstVectorView x)
Checks if a vector is sorted in ascending order.
Definition: logic.cc:199
bool is_decreasing(ConstVectorView x)
Checks if a vector is sorted in reversed order and is strictly decreasing.
Definition: logic.cc:252
A constant view of a Tensor4.
Definition: matpackIV.h:133
The global header file for ARTS.
A constant view of a Tensor5.
Definition: matpackV.h:143
NUMERIC Numeric
The type to use for all floating point numbers.
Definition: matpack.h:33
bool is_increasing(ConstVectorView x)
Checks if a vector is sorted and strictly increasing.
Definition: logic.cc:215
bool is_size(ConstVectorView x, const Index &l)
Verifies that the size of x is l.
Definition: logic.cc:79
This can be used to make arrays out of anything.
Definition: array.h:40
A constant view of a Tensor3.
Definition: matpackIII.h:132
A constant view of a Vector.
Definition: matpackI.h:476
A constant view of a Matrix.
Definition: matpackI.h:982
bool is_multiple(const Index &x, const Index &y)
Checks if an integer is a multiple of another integer.
Definition: logic.cc:65
bool is_lon_cyclic(ConstVectorView grid, const Numeric &epsilon=0.001)
Check if the given longitude grid is cyclic.
Definition: logic.cc:369
bool is_singular(ConstMatrixView A)
Checks if a square matrix is singular.
Definition: logic.cc:295