logic.h File Reference

Header file for logic.cc. More...

#include "arts.h"
#include "matpackVII.h"

Include dependency graph for logic.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

bool is_bool (const Index &x)
 Checks if a variable equals 0 or 1.
bool is_multiple (const Index &x, const Index &y)
 Checks if an integer is a multiple of another integer.
bool is_size (ConstVectorView x, const Index &l)
 Verifies that the size of x is l.
bool is_size (ConstMatrixView x, const Index &r, const Index &c)
 Verifies that the size of x is r by c.
bool is_size (ConstTensor3View x, const Index &p, const Index &r, const Index &c)
 Verifies that the size of x is [p,r,c].
bool is_size (ConstTensor4View x, const Index &b, const Index &p, const Index &r, const Index &c)
 Verifies that the size of x is [b,p,r,c].
bool is_size (ConstTensor5View x, const Index &s, const Index &b, const Index &p, const Index &r, const Index &c)
 Verifies that the size of x is [s,b,p,r,c].
bool is_size (ConstTensor6View x, const Index &v, const Index &s, const Index &b, const Index &p, const Index &r, const Index &c)
 Verifies that the size of x is [v,s,b,p,r,c].
bool is_size (ConstTensor7View x, const Index &l, const Index &v, const Index &s, const Index &b, const Index &p, const Index &r, const Index &c)
 Verifies that the size of x is [l,v,s,b,p,r,c].
bool is_sorted (ConstVectorView x)
 Checks if a vector is sorted in ascending order.
bool is_increasing (ConstVectorView x)
 Checks if a vector is sorted and strictly increasing.
bool is_increasing (const ArrayOfIndex &x)
 Checks if an ArrayOfIndex is sorted and strictly increasing.
bool is_decreasing (ConstVectorView x)
 Checks if a vector is sorted in reversed order and is strictly decreasing.
bool is_unique (const ArrayOfIndex &x)
 Checks if an ArrayOfIndex is unique, i.e., has no duplicate values.
bool is_singular (ConstMatrixView A)
 Checks if a square matrix is singular.
bool is_diagonal (ConstMatrixView A)
 Checks if a square matrix is diagonal.
bool is_same_within_epsilon (const Numeric &a, const Numeric &b, const Numeric &epsilon)
 Check, if two numbers agree within a given epsilon.
template<class T>
bool is_size (const Array< T > &x, const Index &n)
 Verifies that the size of x is n.


Detailed Description

Header file for logic.cc.

Author:
Stefan Buehler <sbuehler@ltu.se>
Date:
Fri May 3 19:10:04 2002

Definition in file logic.h.


Function Documentation

bool is_bool ( const Index x  ) 

Checks if a variable equals 0 or 1.

Returns:
True if the variable is 0 or 1. Otherwise false.
Parameters:
x A variable of type Index.

Definition at line 53 of file logic.cc.

Referenced by chk_if_bool(), and gridpos2gridrange().

bool is_decreasing ( ConstVectorView  x  ) 

Checks if a vector is sorted in reversed order and is strictly decreasing.

Duplicated values are not allowed.

Returns:
True if strictly decreasing, otherwise false.
Parameters:
x A vector.

Definition at line 303 of file logic.cc.

References ConstVectorView::nelem().

Referenced by check_retrieval_grids(), chk_if_decreasing(), chk_interpolation_grids(), get_perturbation_limit(), gridpos(), ppath_start_1d(), ppath_start_2d(), ppath_start_3d(), sensor_integration_vector(), sensor_responseInit(), and VectorInsertGridPoints().

bool is_diagonal ( ConstMatrixView  A  ) 

Checks if a square matrix is diagonal.

If one off diagonal element is nonzero the function returns false.

Due to numerical inaccuracies the values can deviate from 0. The value for the precision is defined in the file *logic.cc*.

Returns:
True if matrix is diagonal.
Parameters:
A A square matrix.

Definition at line 387 of file logic.cc.

References ConstMatrixView::ncols(), ConstMatrixView::nrows(), and precision.

Referenced by interpTArray(), mcPathTrace(), mcPathTraceGeneral(), mcPathTraceIPA(), rte_step_std(), and TArrayCalc().

bool is_increasing ( const ArrayOfIndex x  ) 

Checks if an ArrayOfIndex is sorted and strictly increasing.

Duplicated values are not allowed. Clone of the similar funciton for vectors.

Returns:
True if strictly increasing, otherwise false.
Parameters:
x An ArrayOfIndex.
Author:
Stefan Buehler
Date:
2007-05-18

Definition at line 283 of file logic.cc.

References Array< base >::nelem().

bool is_increasing ( ConstVectorView  x  ) 

Checks if a vector is sorted and strictly increasing.

Duplicated values are not allowed.

Returns:
True if strictly increasing, otherwise false.
Parameters:
x A vector.

Definition at line 258 of file logic.cc.

References ConstVectorView::nelem().

Referenced by check_retrieval_grids(), chk_if_increasing(), chk_interpolation_grids(), f_gridFromSensorHIRS(), gridpos(), ppath_start_1d(), ppath_start_2d(), ppath_start_3d(), sensor_integration_vector(), sensor_responseBackend(), sensor_responseInit(), sensor_responseMixer(), and VectorInsertGridPoints().

bool is_multiple ( const Index x,
const Index y 
)

Checks if an integer is a multiple of another integer.

The function returns true if y * n = x, where n is an integer.

The choice of y = 0 is not allowed.

Returns:
True if x is a multiple of y.
Parameters:
x Nominator of the integer division.
y Denominator of the integer division.
Author:
Patrick Eriksson
Date:
2002-08-11

Definition at line 73 of file logic.cc.

Referenced by integer_div().

bool is_same_within_epsilon ( const Numeric a,
const Numeric b,
const Numeric epsilon 
)

Check, if two numbers agree within a given epsilon.

This logical function verifies if two numbers are the same for the desired number of digits. The comparison statement comes from Oliver: ( abs(a-b) <= epsilon * max(a,b) )

I only modified it to make sure that the right side also is positive. (Both a and b could be negative.)

The variable epsilon gives the number of digits used for the comparison. (epsilon = 0.0001 for a comparison up to the 5th digit)

Parameters:
a A number.
b Another number.
epsilon The epsilon of the required agreement.
Returns:
True if the two numbers are the same.

Definition at line 421 of file logic.cc.

References abs, and max.

Referenced by interp().

bool is_singular ( ConstMatrixView  A  ) 

Checks if a square matrix is singular.

If one row of a matrix has only 0 values the matrix is singular.

Due to numerical inaccuracies the values can deviate from 0. The value for the precision is defined in the file *logic.cc*.

Returns:
True if matrix is singular.
Parameters:
A A square matrix.

Definition at line 353 of file logic.cc.

References ConstMatrixView::ncols(), ConstMatrixView::nrows(), precision, and temp.

Referenced by cloud_ppath_update1D_planeparallel(), cloud_RT_no_background(), and rte_step_std().

template<class T>
bool is_size ( const Array< T > &  x,
const Index n 
) [inline]

Verifies that the size of x is n.

This function is supposed to be used together with assert like this: assert(is_size(x,n)). It works for any array type.

Parameters:
x The Array to check.
n The desired length.
Returns:
True if the size of x is n.

Definition at line 111 of file logic.h.

References Array< base >::nelem().

bool is_size ( ConstTensor7View  x,
const Index l,
const Index v,
const Index s,
const Index b,
const Index p,
const Index r,
const Index c 
)

Verifies that the size of x is [l,v,s,b,p,r,c].

Parameters:
x The Tensor to check.
l The desired number of libraries.
v The desired number of vitrines.
s The desired number of shelves.
b The desired number of books.
p The desired number of pages.
r The desired number of rows.
c The desired number of columns.
Returns:
True if the size of x is correct.

Definition at line 213 of file logic.cc.

References ConstTensor7View::nbooks(), ConstTensor7View::ncols(), ConstTensor7View::nlibraries(), ConstTensor7View::npages(), ConstTensor7View::nrows(), ConstTensor7View::nshelves(), and ConstTensor7View::nvitrines().

bool is_size ( ConstTensor6View  x,
const Index v,
const Index s,
const Index b,
const Index p,
const Index r,
const Index c 
)

Verifies that the size of x is [v,s,b,p,r,c].

Parameters:
x The Tensor to check.
v The desired number of vitrines.
s The desired number of shelves.
b The desired number of books.
p The desired number of pages.
r The desired number of rows.
c The desired number of columns.
Returns:
True if the size of x is correct.

Definition at line 185 of file logic.cc.

References ConstTensor6View::nbooks(), ConstTensor6View::ncols(), ConstTensor6View::npages(), ConstTensor6View::nrows(), ConstTensor6View::nshelves(), and ConstTensor6View::nvitrines().

bool is_size ( ConstTensor5View  x,
const Index s,
const Index b,
const Index p,
const Index r,
const Index c 
)

Verifies that the size of x is [s,b,p,r,c].

Parameters:
x The Tensor to check.
s The desired number of shelves.
b The desired number of books.
p The desired number of pages.
r The desired number of rows.
c The desired number of columns.
Returns:
True if the size of x is correct.

Definition at line 160 of file logic.cc.

References ConstTensor5View::nbooks(), ConstTensor5View::ncols(), ConstTensor5View::npages(), ConstTensor5View::nrows(), and ConstTensor5View::nshelves().

bool is_size ( ConstTensor4View  x,
const Index b,
const Index p,
const Index r,
const Index c 
)

Verifies that the size of x is [b,p,r,c].

Parameters:
x The Tensor to check.
b The desired number of books.
p The desired number of pages.
r The desired number of rows.
c The desired number of columns.
Returns:
True if the size of x is correct.

Definition at line 138 of file logic.cc.

References ConstTensor4View::nbooks(), ConstTensor4View::ncols(), ConstTensor4View::npages(), and ConstTensor4View::nrows().

bool is_size ( ConstTensor3View  x,
const Index p,
const Index r,
const Index c 
)

Verifies that the size of x is [p,r,c].

Parameters:
x The Tensor to check.
p The desired number of pages.
r The desired number of rows.
c The desired number of columns.
Returns:
True if the size of x is correct.

Definition at line 119 of file logic.cc.

References ConstTensor3View::ncols(), ConstTensor3View::npages(), and ConstTensor3View::nrows().

bool is_size ( ConstMatrixView  x,
const Index r,
const Index c 
)

Verifies that the size of x is r by c.

Parameters:
x The Matrix to check.
r The desired number of rows.
c The desired number of columns.
Returns:
True if the size of x is r x c.

Definition at line 103 of file logic.cc.

References ConstMatrixView::ncols(), and ConstMatrixView::nrows().

bool is_size ( ConstVectorView  x,
const Index n 
)

bool is_sorted ( ConstVectorView  x  ) 

Checks if a vector is sorted in ascending order.

Duplicated values are allowed.

Parameters:
x A vector.
Returns:
True if sorted.

Definition at line 238 of file logic.cc.

References ConstVectorView::nelem().

Referenced by xsec_species().

bool is_unique ( const ArrayOfIndex x  ) 

Checks if an ArrayOfIndex is unique, i.e., has no duplicate values.

This only returns true if the array does not contain any duplicate values.

Returns:
True if unique, otherwise false.
Parameters:
x An ArrayOfIndex.
Author:
Stefan Buehler
Date:
2008-08-24

Definition at line 330 of file logic.cc.

References Array< base >::nelem().

Referenced by abs_lookupCreate(), and GasAbsLookup::Adapt().


Generated on Mon Mar 23 14:06:38 2009 for ARTS by  doxygen 1.5.6