ARTS 2.5.10 (git: 2f1c442c)
|
Contains the rational class definition. More...
#include "array.h"
#include "bifstream.h"
#include "bofstream.h"
#include "math_funcs.h"
#include "matpack.h"
#include <numeric>
#include <ostream>
Go to the source code of this file.
Classes | |
struct | Rational |
Implements rational numbers to work with other ARTS types. More... | |
Macros | |
#define | RATIONAL_UNDEFINED Rational(0, 0) |
Typedefs | |
using | ArrayOfRational = Array< Rational > |
Functions | |
constexpr Rational | reduce_by_gcd (Rational a) noexcept |
Returns the rational reduced by the greates. | |
constexpr Rational | numeric2rational (Numeric x, size_t maxdec=4) noexcept |
Rational from Numeric. | |
constexpr Rational | operator- (const Rational a) noexcept |
Negative. | |
constexpr Rational | operator+ (const Rational a) noexcept |
Positive. | |
constexpr Rational | operator+ (const Rational a, const Rational b) noexcept |
Addition. | |
constexpr Rational | operator+ (const Rational a, Index b) noexcept |
Addition. | |
constexpr Rational | operator+ (const Rational a, int b) noexcept |
Addition. | |
constexpr Rational | operator+ (Index b, const Rational a) noexcept |
Addition. | |
constexpr Rational | operator+ (int b, const Rational a) noexcept |
Addition. | |
constexpr Rational | operator- (const Rational a, const Rational b) noexcept |
Subtraction. | |
constexpr Rational | operator- (const Rational a, Index b) noexcept |
Subtraction. | |
constexpr Rational | operator- (const Rational a, int b) noexcept |
Subtraction. | |
constexpr Rational | operator- (Index b, const Rational a) noexcept |
Subtraction. | |
constexpr Rational | operator- (int b, const Rational a) noexcept |
Subtraction. | |
constexpr Rational | operator/ (const Rational a, const Rational b) noexcept |
Division. | |
constexpr Rational | operator/ (const Rational a, Index b) noexcept |
Division. | |
constexpr Rational | operator/ (const Rational a, int b) noexcept |
Division. | |
constexpr Rational | operator/ (Index b, const Rational a) noexcept |
Division. | |
constexpr Rational | operator/ (int b, const Rational a) noexcept |
Division. | |
constexpr Rational | operator* (const Rational a, const Rational b) noexcept |
Multiplication. | |
constexpr Rational | operator* (const Rational a, Index b) noexcept |
Multiplication. | |
constexpr Rational | operator* (const Rational a, int b) noexcept |
Multiplication. | |
constexpr Rational | operator* (Index b, const Rational a) noexcept |
Multiplication. | |
constexpr Rational | operator* (int b, const Rational a) noexcept |
Multiplication. | |
constexpr Rational | operator% (const Rational a, const Rational b) noexcept |
Remainder. | |
constexpr Rational | operator% (const Rational a, Index b) noexcept |
Remainder. | |
constexpr Rational | operator% (const Rational a, int b) noexcept |
Remainder. | |
constexpr Rational | operator% (Index b, const Rational a) noexcept |
Remainder. | |
constexpr Rational | operator% (int b, const Rational a) noexcept |
Remainder. | |
constexpr bool | operator== (const Rational a, const Rational b) noexcept |
Equality. | |
constexpr bool | operator!= (const Rational a, const Rational b) noexcept |
Inequality. | |
constexpr bool | operator< (const Rational a, const Rational b) noexcept |
Less than. | |
constexpr bool | operator> (const Rational a, const Rational b) noexcept |
More than. | |
constexpr bool | operator<= (const Rational a, const Rational b) noexcept |
Less than or equal to. | |
constexpr bool | operator>= (const Rational a, const Rational b) noexcept |
More than or equal to. | |
constexpr bool | operator! (const Rational a) noexcept |
Not. | |
Numeric | sqrt (const Rational r) |
Square root. | |
Numeric | pow (const Rational base, Numeric exp) |
Power of. | |
Numeric | pow (Numeric base, const Rational exp) |
Power of. | |
Numeric | pow (const Rational base, const Rational exp) |
Power of. | |
constexpr bool | operator< (const Index a, const Rational b) noexcept |
less | |
constexpr bool | operator< (const int a, const Rational b) noexcept |
less | |
constexpr bool | operator< (const Rational a, const Index b) noexcept |
less | |
constexpr bool | operator< (const Rational a, const int b) noexcept |
less | |
constexpr bool | operator> (const Index a, const Rational b) noexcept |
more | |
constexpr bool | operator> (const int a, const Rational b) noexcept |
more | |
constexpr bool | operator> (const Rational a, const Index b) noexcept |
more | |
constexpr bool | operator> (const Rational a, const int b) noexcept |
more | |
constexpr bool | operator== (const Rational a, const Index b) noexcept |
equal | |
constexpr bool | operator== (const Rational a, const int b) noexcept |
equal | |
constexpr bool | operator!= (const Rational a, const Index b) noexcept |
not equal | |
constexpr bool | operator!= (const Rational a, const int b) noexcept |
not equal | |
constexpr Rational | abs (const Rational a) noexcept |
Absolute. | |
constexpr Rational | max (const Rational a, const Rational b) noexcept |
Maximum. | |
constexpr Rational | min (const Rational a, const Rational b) noexcept |
Minimum. | |
constexpr Rational | operator""_2 (unsigned long long int n) noexcept |
Returns common operator n/2. | |
constexpr bool | iseven (const Rational r) noexcept |
Returns true if even integer. | |
constexpr Numeric | operator* (Rational y, Numeric x) noexcept |
Multiplication with numeric. | |
constexpr Numeric | operator* (Numeric x, Rational y) noexcept |
constexpr Numeric | operator/ (Rational y, Numeric x) noexcept |
Division with numeric. | |
constexpr Numeric | operator/ (Numeric x, Rational y) noexcept |
constexpr Numeric | operator+ (Rational y, Numeric x) noexcept |
Addition with numeric. | |
constexpr Numeric | operator+ (Numeric x, Rational y) noexcept |
constexpr Numeric | operator- (Rational y, Numeric x) noexcept |
Subtraction with numeric. | |
constexpr Numeric | operator- (Numeric x, Rational y) noexcept |
#define RATIONAL_UNDEFINED Rational(0, 0) |
Definition at line 357 of file rational.h.
using ArrayOfRational = Array<Rational> |
Definition at line 886 of file rational.h.
|
constexprnoexcept |
Returns true if even integer.
[in] | r | Any rational |
Definition at line 902 of file rational.h.
Referenced by Absorption::LineMixing::Makarov2020etal::reduced_dipole(), Absorption::reduced_magnetic_quadrapole(), Absorption::reduced_rovibrational_dipole(), Absorption::LineMixing::Makarov2020etal::relaxation_matrix_offdiagonal(), and Absorption::LineMixing::LinearRovibErrorCorrectedSudden::relaxation_matrix_offdiagonal().
Rational from Numeric.
Performs basic rounding
[in] | x | Numeric value |
[in] | maxdec | Maximum number of decimals |
Definition at line 329 of file rational.h.
Referenced by Rational::Rational(), and test_numeric2rational().
|
constexprnoexcept |
Not.
Definition at line 698 of file rational.h.
References a.
Inequality.
Definition at line 645 of file rational.h.
Referenced by Species::ENUMCLASS().
|
constexprnoexcept |
Returns common operator n/2.
[in] | n | Any positive integer |
Definition at line 893 of file rational.h.
Multiplication.
Definition at line 533 of file rational.h.
Referenced by operator*().
Multiplication.
Definition at line 563 of file rational.h.
References a, b, and operator*().
Multiplication.
Definition at line 571 of file rational.h.
References a, b, and operator*().
Definition at line 908 of file rational.h.
References Rational::toNumeric().
Multiplication with numeric.
Definition at line 907 of file rational.h.
References Rational::toNumeric().
Positive.
Definition at line 373 of file rational.h.
References a.
Referenced by operator+().
Addition.
Definition at line 414 of file rational.h.
References a, b, and operator+().
Addition.
Definition at line 422 of file rational.h.
References a, b, and operator+().
Definition at line 916 of file rational.h.
References Rational::toNumeric().
Definition at line 920 of file rational.h.
References Rational::toNumeric().
Subtraction with numeric.
Definition at line 919 of file rational.h.
References Rational::toNumeric().
Definition at line 912 of file rational.h.
References Rational::toNumeric().
|
constexprnoexcept |
|
constexprnoexcept |
Less than.
Definition at line 656 of file rational.h.
Referenced by operator>(), and operator>=().
Less than or equal to.
Definition at line 677 of file rational.h.
References a, b, and operator>().
|
constexprnoexcept |
Equality.
Definition at line 633 of file rational.h.
Referenced by Species::ENUMCLASS().
|
constexprnoexcept |
|
constexprnoexcept |
More than.
Definition at line 668 of file rational.h.
References a, b, and operator<().
Referenced by operator<=().
More than or equal to.
Definition at line 688 of file rational.h.
References a, b, and operator<().
Power of.
Definition at line 733 of file rational.h.
References pow(), and Rational::toNumeric().
Power of.
Definition at line 713 of file rational.h.
References Rational::toNumeric().
Referenced by LineShape::ModelParameters::at(), cart2poslos(), delanoe_shape_with_derivative(), diameter_maxFromDiameter_volume_equ(), diameter_volume_equFromDiameter_max(), dm_from_iwc_n0(), doit_conv_flagLsq(), LineShape::ModelParameters::dT(), LineShape::ModelParameters::dT0(), LineShape::ModelParameters::dX0(), LineShape::ModelParameters::dX1(), LineShape::ModelParameters::dX2(), LineShape::ModelParameters::dX3(), TelsemAtlas::emis_interp(), g0Earth(), get_ppath_cloudvars(), IntersectionGeometricalWithAltitude(), iyIndependentBeamApproximation(), matrix_exp(), MatrixGaussian(), mgd(), mgd_with_derivatives(), mod_gamma_dist(), n0_from_iwc_dm(), particle_bulkpropRadarOnionPeeling(), PFromZSimple(), polynomial_basis_func(), pow(), psd_cloudice_MH97(), psd_mgd_mass_and_something(), psd_mgd_smm_common(), psd_MY05(), psd_rain_W16(), psd_SB06(), psd_snow_F07(), psdModifiedGammaMass(), Absorption::LineMixing::SpeciesErrorCorrectedSuddenData::Q(), Absorption::ReadFromArtscat3Stream(), Absorption::ReadFromJplStream(), refellipsoidForAzimuth(), refellipsoidOrbitPlane(), rtmethods_jacobian_finalisation(), surface_specular_R_and_b(), surfaceMapToLinearPolarisation(), test01(), transform_jacobian(), transform_x_back(), VectorGaussian(), yCalc(), and yRadar().
Power of.
Definition at line 723 of file rational.h.
References Rational::toNumeric().
Returns the rational reduced by the greates.
Definition at line 315 of file rational.h.
References a.
Referenced by Rational::simplify_in_place(), Quantum::Number::Value::Value(), and Quantum::Number::value_holder().
Square root.
Definition at line 705 of file rational.h.
References Rational::toNumeric().
Referenced by cart2geodetic(), cart2pol(), cart2poslos(), cart2sph(), cart2sph_plain(), cart2zaaa(), case_b_g_coefficient_o2(), chk_atm_vecfield_lat90(), complex_n_ice_matzler06(), complex_n_water_liebe93(), compute_transmission_matrix(), compute_transmission_matrix_and_derivative(), compute_transmission_matrix_from_averaged_matrix_at_frequency(), covmat_sxExtractSqrtDiagonal(), distance2D(), distance3D(), dlosGauss(), doit_conv_flagLsq(), dotprod_with_los(), MCAntenna::draw_los(), geodetic2cart(), geodeticposlos2cart(), geompath_l_at_r(), geompath_r_at_l(), geompath_tanpos_3d(), get_sun_radiation(), IntersectionGeometricalWithAltitude(), line_circle_intersect(), line_refellipsoid_intersect(), line_sphere_intersect(), los2xyz(), MatrixGaussian(), MCGeneral(), MCRadar(), psd_cloudice_MH97(), r_crossing_3d(), IGRF::radius(), ran_gaussian(), Absorption::LineMixing::Makarov2020etal::reduced_dipole(), Absorption::reduced_magnetic_quadrapole(), Absorption::reduced_rovibrational_dipole(), refell2r(), refellipsoidForAzimuth(), refellipsoidOrbitPlane(), refr_index_airFreeElectrons(), refr_index_airInfraredEarth(), refractive_index_water_and_steam_VisNIR(), Absorption::LineMixing::Makarov2020etal::relaxation_matrix_offdiagonal(), Absorption::LineMixing::LinearRovibErrorCorrectedSudden::relaxation_matrix_offdiagonal(), retrievalErrorsExtract(), rotationmat3D(), Legendre::schmidt(), sphdist(), test2(), test31(), test_matrix_buildup(), test_oem_gauss_newton(), test_oem_levenberg_marquardt(), test_oem_linear(), Legendre::to_geodetic(), unitl(), vector_angle(), VectorGaussian(), and yCalc().