ARTS 2.5.4 (git: 31ce4f0e)
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
32bool is_bool(const Index& x);
33
34bool is_multiple(const Index& x, const Index& y);
35
36bool is_size(ConstVectorView x, const Index& l);
37
38bool 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
87
88bool is_increasing(const ArrayOfIndex& x);
89
91
92bool is_unique(const ArrayOfIndex& x);
93
95
97
99 const Numeric& b,
100 const Numeric& epsilon);
101
102bool is_lon_cyclic(ConstVectorView grid, const Numeric& epsilon = 0.001);
103
105// Template functions (have to be here in the .h file).
107
109
117template <class T>
118bool is_size(const Array<T>& x, const Index& n) {
119 return (n == x.nelem());
120}
121
122#endif // logic_h
The global header file for ARTS.
Index nelem() const ARTS_NOEXCEPT
Definition: array.h:92
A constant view of a Matrix.
Definition: matpackI.h:1043
A constant view of a Tensor3.
Definition: matpackIII.h:130
A constant view of a Tensor4.
Definition: matpackIV.h:131
A constant view of a Tensor5.
Definition: matpackV.h:141
A constant view of a Tensor6.
Definition: matpackVI.h:147
A constant view of a Tensor7.
Definition: matpackVII.h:145
A constant view of a Vector.
Definition: matpackI.h:512
bool is_increasing(ConstVectorView x)
Checks if a vector is sorted and strictly increasing.
Definition: logic.cc:218
bool is_regularly_increasing_within_epsilon(ConstVectorView x, const Numeric epsilon=1e-8)
Definition: logic.cc:374
bool is_sorted(ConstVectorView x)
Checks if a vector is sorted in ascending order.
Definition: logic.cc:202
bool is_bool(const Index &x)
Checks if a variable equals 0 or 1.
Definition: logic.cc:53
bool is_size(ConstVectorView x, const Index &l)
Verifies that the size of x is l.
Definition: logic.cc:82
bool is_decreasing(ConstVectorView x)
Checks if a vector is sorted in reversed order and is strictly decreasing.
Definition: logic.cc:255
bool is_diagonal(ConstMatrixView A)
Checks if a square matrix is diagonal.
Definition: logic.cc:326
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:354
bool is_multiple(const Index &x, const Index &y)
Checks if an integer is a multiple of another integer.
Definition: logic.cc:68
bool is_unique(const ArrayOfIndex &x)
Checks if an ArrayOfIndex is unique, i.e., has no duplicate values.
Definition: logic.cc:277
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:298
NUMERIC Numeric
The type to use for all floating point numbers.
Definition: matpack.h:33
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:39
constexpr Numeric e
Elementary charge convenience name [C].
constexpr Numeric l(const Index p0, const Index n, const Numeric x, const SortedVectorType &xi, const Index j, const std::pair< Numeric, Numeric > cycle={ -180, 180}) noexcept
#define v
#define a
#define c
#define b