ARTS  1.0.222
math_funcs.h
Go to the documentation of this file.
1 /* Copyright (C) 2000, 2001 Patrick Eriksson <patrick@rss.chalmers.se>
2  Stefan Buehler <sbuehler@uni-bremen.de>
3 
4  This program is free software; you can redistribute it and/or modify it
5  under the terms of the GNU General Public License as published by the
6  Free Software Foundation; either version 2, or (at your option) any
7  later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program; if not, write to the Free Software
16  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
17  USA. */
18 
19 
20 
22 // File description
24 
45 #ifndef math_funcs_h
46 #define math_funcs_h
47 
48 #include "matpackI.h"
49 #include "mystring.h"
50 
51 
52 
56 
58 
60 
61 
62 
66 
67 bool any( const ArrayOfIndex& x );
68 
69 
70 
72 // Functions to generate vectors
74 
75 void linspace(
76  Vector& x,
77  const Numeric start,
78  const Numeric stop,
79  const Numeric step );
80 
82  const Numeric start,
83  const Numeric stop,
84  const Numeric step );
85 
86 void nlinspace(
87  Vector& x,
88  const Numeric start,
89  const Numeric stop,
90  const Index n );
91 
93  const Numeric start,
94  const Numeric stop,
95  const Index n );
96 
97 void nlogspace(
98  Vector& x,
99  const Numeric start,
100  const Numeric stop,
101  const Index n );
102 
104  const Numeric start,
105  const Numeric stop,
106  const Index n );
107 
108 
109 
111 // Interpolation routines
113 
115  ConstVectorView x,
116  ConstVectorView y,
117  ConstVectorView xi );
118 
119 void interp_lin_matrix(
120  MatrixView Yi,
121  ConstVectorView x,
122  ConstMatrixView Y,
123  ConstVectorView xi );
124 
126  ConstVectorView x,
127  ConstVectorView y,
128  const Numeric xi );
129 
130 
131 
133 // Check of function input
135 
136 void check_if_bool( const Index& x, const String& x_name );
137 
138 void check_if_in_range(
139  const Numeric& x_low,
140  const Numeric& x_high,
141  const Numeric& x,
142  const String& x_name );
143 
144 void check_lengths( const Vector& x1, const String& x1_name,
145  const Vector& x2, const String& x2_name );
146 
147 void check_length_nrow( const Vector& x, const String& x_name,
148  const Matrix& A, const String& A_name );
149 
150 void check_length_ncol( const Vector& x, const String& x_name,
151  const Matrix& A, const String& A_name );
152 
153 void check_ncol_nrow( const Matrix& A, const String& A_name,
154  const Matrix& B, const String& B_name );
155 
156 #endif // math_funcs_h
first
Numeric first(ConstVectorView x)
Gives the first value of a vector.
Definition: math_funcs.cc:70
Matrix
The Matrix class.
Definition: matpackI.h:544
MatrixView
The MatrixView class.
Definition: matpackI.h:476
interp_lin_vector
void interp_lin_vector(VectorView yi, ConstVectorView x, ConstVectorView y, ConstVectorView xi)
Multiple linear interpolation of a vector.
Definition: math_funcs.cc:329
nlinspace
void nlinspace(Vector &x, const Numeric start, const Numeric stop, const Index n)
Linearly spaced vector with specified length.
Definition: math_funcs.cc:168
check_length_ncol
void check_length_ncol(const Vector &x, const String &x_name, const Matrix &A, const String &A_name)
Checkss that the length of a vector and the number of columns of a matrix match.
Definition: math_funcs.cc:592
nlogspace
void nlogspace(Vector &x, const Numeric start, const Numeric stop, const Index n)
Logarithmically spaced vector with specified length.
Definition: math_funcs.cc:198
check_length_nrow
void check_length_nrow(const Vector &x, const String &x_name, const Matrix &A, const String &A_name)
Checks that the length of a vector and the number of rows of a matrix match.
Definition: math_funcs.cc:559
check_ncol_nrow
void check_ncol_nrow(const Matrix &A, const String &A_name, const Matrix &B, const String &B_name)
Checks that the number of columns of the first matrix is the same as the number of rows of the second...
Definition: math_funcs.cc:622
check_lengths
void check_lengths(const Vector &x1, const String &x1_name, const Vector &x2, const String &x2_name)
Checks that two vectors have the same length.
Definition: math_funcs.cc:527
any
bool any(const ArrayOfIndex &x)
True if any element of a boolean vector, b, is not 0.
Definition: math_funcs.cc:104
matpackI.h
Array< Index >
check_if_bool
void check_if_bool(const Index &x, const String &x_name)
Checks if an integer is 0 or 1.
Definition: math_funcs.cc:468
my_basic_string< char >
Numeric
NUMERIC Numeric
The type to use for all floating point numbers.
Definition: arts.h:147
VectorView
The VectorView class.
Definition: matpackI.h:281
last
Numeric last(ConstVectorView x)
Gives the last value of a vector.
Definition: math_funcs.cc:83
interp_lin_matrix
void interp_lin_matrix(MatrixView Yi, ConstVectorView x, ConstMatrixView Y, ConstVectorView xi)
Multiple linear interpolation of matrix rows.
Definition: math_funcs.cc:383
ConstMatrixView
A constant view of a Matrix.
Definition: matpackI.h:426
linspace
void linspace(Vector &x, const Numeric start, const Numeric stop, const Numeric step)
Linearly spaced vector with specified spacing.
Definition: math_funcs.cc:139
Index
INDEX Index
The type to use for all integer numbers and indices.
Definition: arts.h:153
check_if_in_range
void check_if_in_range(const Numeric &x_low, const Numeric &x_high, const Numeric &x, const String &x_name)
Checks if a numeric variable is inside a specified range.
Definition: math_funcs.cc:495
Vector
The Vector class.
Definition: matpackI.h:389
interp_lin
Numeric interp_lin(ConstVectorView x, ConstVectorView y, const Numeric xi)
Single linear interpolation of a vector (return version).
Definition: math_funcs.cc:435
ConstVectorView
A constant view of a Vector.
Definition: matpackI.h:232
mystring.h
This file contains the definition of String, the ARTS string class.