ARTS 2.5.11 (git: 725533f0)
math_funcs.h
Go to the documentation of this file.
1/*****************************************************************************
2 *** File description
3 *****************************************************************************/
4
13#ifndef math_funcs_h
14#define math_funcs_h
15
16#include "array.h"
17#include "matpack_concepts.h"
18#include "matpack_data.h"
19#include "matpack_math.h"
20
21Numeric fac(const Index n);
22
23Index integer_div(const Index& x, const Index& y);
24
25Numeric last(ConstVectorView x);
26
27Index last(const ArrayOfIndex& x);
28
29void linspace(Vector& x,
30 const Numeric start,
31 const Numeric stop,
32 const Numeric step);
33
34void nlinspace(Vector& x,
35 const Numeric start,
36 const Numeric stop,
37 const Index n);
38
39void nlinspace(VectorView x,
40 const Numeric start,
41 const Numeric stop,
42 const Index n);
43
44void nlogspace(Vector& x,
45 const Numeric start,
46 const Numeric stop,
47 const Index n);
48
49Numeric trapz(ConstVectorView x,
50 ConstVectorView y);
51
52void cumsum(VectorView csum,
53 ConstVectorView x);
54
55Numeric AngIntegrate_trapezoid(ConstMatrixView Integrand,
56 ConstVectorView za_grid,
57 ConstVectorView aa_grid);
58
59Numeric AngIntegrate_trapezoid(ConstVectorView Integrand,
60 ConstVectorView za_grid);
61
62Numeric AngIntegrate_trapezoid_opti(ConstMatrixView Integrand,
63 ConstVectorView za_grid,
64 ConstVectorView aa_grid,
65 ConstVectorView grid_stepsize);
66
67Numeric sign(const Numeric& x);
68
69void mgd(VectorView psd,
70 const Vector& x,
71 const Numeric& n0,
72 const Numeric& mu,
73 const Numeric& la,
74 const Numeric& ga);
75
76void mgd_with_derivatives(VectorView psd,
77 MatrixView jac_data,
78 const Vector& x,
79 const Numeric& n0,
80 const Numeric& mu,
81 const Numeric& la,
82 const Numeric& ga,
83 const bool& do_n0_jac,
84 const bool& do_mu_jac,
85 const bool& do_la_jac,
86 const bool& do_ga_jac);
87
103void delanoe_shape_with_derivative(VectorView psd,
104 MatrixView jac_data,
105 const Vector& x,
106 const Numeric& alpha,
107 const Numeric& beta);
108
109Numeric mod_gamma_dist(
110 Numeric x, Numeric N0, Numeric Lambda, Numeric mu, Numeric gamma);
111
112void unitl(Vector& x);
113
114void flat(VectorView x, ConstMatrixView X);
115void flat(VectorView x, ConstTensor3View X);
116
117void reshape(MatrixView X, ConstVectorView x);
118void reshape(Tensor3View X, ConstVectorView x);
119
120void calculate_weights_linear(Vector& x, Vector& w, const Index nph);
121
127void calculate_int_weights_arbitrary_grid(Vector& w, const Vector& x);
128
129
131template <typename MatpackType>
132constexpr bool any_negative(const MatpackType& var) noexcept {
133 if (var.empty()) return false;
134 if (min(var) < 0) return true;
135 return false;
136}
137
143constexpr Index pow_negative_one(Index x) noexcept { return (x % 2) ? -1 : 1; }
144
145#endif // math_funcs_h
This file contains the definition of Array.
base min(const Array< base > &x)
Min function.
Definition array.h:144
void linspace(Vector &x, const Numeric start, const Numeric stop, const Numeric step)
linspace
void nlinspace(Vector &x, const Numeric start, const Numeric stop, const Index n)
nlinspace
void cumsum(VectorView csum, ConstVectorView x)
cumsum
void unitl(Vector &x)
unitl
void reshape(MatrixView X, ConstVectorView x)
reshape
Numeric fac(const Index n)
fac
Definition math_funcs.cc:46
constexpr Index pow_negative_one(Index x) noexcept
Computes std::pow(-1, x) without std::pow.
Definition math_funcs.h:143
void nlogspace(Vector &x, const Numeric start, const Numeric stop, const Index n)
nlogspace
constexpr bool any_negative(const MatpackType &var) noexcept
Checks for negative values.
Definition math_funcs.h:132
void mgd(VectorView psd, const Vector &x, const Numeric &n0, const Numeric &mu, const Numeric &la, const Numeric &ga)
void delanoe_shape_with_derivative(VectorView psd, MatrixView jac_data, const Vector &x, const Numeric &alpha, const Numeric &beta)
! Shape functions for normalized PSD.
void calculate_weights_linear(Vector &x, Vector &w, const Index nph)
calculate_weights_linear
Numeric trapz(ConstVectorView x, ConstVectorView y)
trapz
Numeric mod_gamma_dist(Numeric x, Numeric N0, Numeric Lambda, Numeric mu, Numeric gamma)
Generalized Modified Gamma Distribution.
void flat(VectorView x, ConstMatrixView X)
flat
Numeric last(ConstVectorView x)
last
Index integer_div(const Index &x, const Index &y)
integer_div
Definition math_funcs.cc:70
Numeric AngIntegrate_trapezoid(ConstMatrixView Integrand, ConstVectorView za_grid, ConstVectorView aa_grid)
AngIntegrate_trapezoid.
Numeric sign(const Numeric &x)
sign
void mgd_with_derivatives(VectorView psd, MatrixView jac_data, const Vector &x, const Numeric &n0, const Numeric &mu, const Numeric &la, const Numeric &ga, const bool &do_n0_jac, const bool &do_mu_jac, const bool &do_la_jac, const bool &do_ga_jac)
void calculate_int_weights_arbitrary_grid(Vector &w, const Vector &x)
Calculates trapezoidal integration weights for arbitray grid.
Numeric AngIntegrate_trapezoid_opti(ConstMatrixView Integrand, ConstVectorView za_grid, ConstVectorView aa_grid, ConstVectorView grid_stepsize)
AngIntegrate_trapezoid_opti.
#define w