Go to the documentation of this file.
85 return x[x.
nelem()-1];
145 Index n = (
Index) floor( (stop-start)/step ) + 1;
149 for (
Index i=0; i<n; i++ )
150 x[i] = start + (
Numeric)i*step;
177 for (
Index i=0; i<n; i++ )
178 x[i] = start + (
Numeric)i*step;
214 for (
Index i=1; i<n-1; i++ )
215 x[i] = exp(a + (
Numeric)i*step);
272 throw runtime_error(
"Vector length for interpolation must be >= 2.");
275 throw runtime_error(
"Sizes of input data to interpolation do not match.");
279 const Numeric lower_bound = x[0] - 0.5*(x[1]-x[0]);
280 const Numeric upper_bound = x[n-1] + 0.5*(x[n-1]-x[n-2]);
286 os <<
"Interpolation points must be not more than\n"
287 <<
"half a grid spacing outside the original range.\n"
288 <<
"Int.: xi[0] = " << xi[0] <<
", xi[ni-1] = " << xi[ni-1] <<
'\n'
289 <<
"Orig.: x[0] = " << x[0] <<
", x[n-1] = " << x[n-1];
290 throw runtime_error(os.str());
293 for (
Index i=0; i<n-1; i++ )
296 throw runtime_error(
"Original interpolation grid must be ordered");
299 for (
Index i=0; i<ni-1; i++ )
302 throw runtime_error(
"Interpolation points must be ordered");
343 assert( n==yi.
nelem() );
345 for ( i=0; i<n; i++ )
357 assert( x[j+1]!=x[j] );
358 w = (xi[i]-x[j]) / (x[j+1]-x[j]);
362 yi[i] = y[j] + w * (y[j+1]-y[j]);
396 assert( nrow == Yi.
nrows() );
397 assert( n == Yi.
ncols() );
399 for (
Index i=0; i<n; i++ )
411 assert( x[j+1]!=x[j] );
412 w = (xi[i]-x[j]) / (x[j+1]-x[j]);
416 for(
Index k=0; k<nrow; k++ )
418 Yi(k,i) = Y(k,j) + w * (Y(k,j+1)-Y(k,j));
470 if ( !(x==0 || x==1) )
473 os <<
"The boolean *" << x_name <<
"* must either be 0 or 1.\n"
474 <<
"The present value of *"<< x_name <<
"* is " << x <<
".";
475 throw runtime_error( os.str() );
501 if ( (x<x_low) || (x>x_high) )
504 os <<
"The variable *" << x_name <<
"* must fulfill:\n"
505 <<
" " << x_low <<
" <= " << x_name <<
" <= " << x_high <<
"\n"
506 <<
"The present value of *"<< x_name <<
"* is " << x <<
".";
507 throw runtime_error( os.str() );
533 os <<
"The vectors *" << x1_name <<
"* and *" << x2_name <<
"*\n"
534 <<
"must have the same lengths. \nThe lengths are: \n"
535 << x1_name <<
": " << x1.
nelem() <<
"\n"
536 << x2_name <<
": " << x2.
nelem();
537 throw runtime_error( os.str() );
565 os <<
"The length of vector *" << x_name <<
"* must be the\n"
566 <<
"same as the number of rows of *" << A_name <<
"*.\n"
567 <<
"The length of *" << x_name <<
"* is " << x.
nelem() <<
".\n"
568 <<
"The number of rows of *" << A_name <<
"* is " << A.
nrows()
570 throw runtime_error( os.str() );
598 os <<
"The length of vector *" << x_name <<
"* must be the\n"
599 <<
"same as the number of columns of *" << A_name <<
"*.\n"
600 <<
"The length of *" << x_name <<
"* is " << x.
nelem() <<
".\n"
601 <<
"The number of columns of *" << A_name <<
"* is " << A.
ncols()
603 throw runtime_error( os.str() );
628 os <<
"The number of columns of *" << A_name <<
"* must be the\n"
629 <<
"same as the number of rows of *" << B_name <<
"*."
630 <<
"The number of columns of *" << A_name <<
"* is " << A.
ncols()
632 <<
"The number of rows of *" << B_name <<
"* is " << B.
nrows()
634 throw runtime_error( os.str() );
Index interp_check(ConstVectorView x, ConstVectorView xi, const Index n_y)
Local help function to check input grids.
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...
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.
Numeric last(ConstVectorView x)
Gives the last value of a vector.
Numeric first(ConstVectorView x)
Gives the first value of a vector.
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.
void resize(Index n)
Resize function.
Index nrows() const
Returns the number of rows.
This file contains the definition of Array.
void nlogspace(Vector &x, const Numeric start, const Numeric stop, const Index n)
Logarithmically spaced vector with specified length.
This can be used to make arrays out of anything.
void check_if_bool(const Index &x, const String &x_name)
Checks if an integer is 0 or 1.
Index ncols() const
Returns the number of columns.
The implementation for String, the ARTS string class.
NUMERIC Numeric
The type to use for all floating point numbers.
Index nelem() const
Returns the number of elements.
Numeric interp_lin(ConstVectorView x, ConstVectorView y, const Numeric xi)
Single linear interpolation of a vector (return version).
Contains declerations of basic mathematical and vector/matrix functions.
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.
The class MakeVector is a special kind of Vector that can be initialized explicitly from one or more ...
void nlinspace(Vector &x, const Numeric start, const Numeric stop, const Index n)
Linearly spaced vector with specified length.
A constant view of a Matrix.
void interp_lin_vector(VectorView yi, ConstVectorView x, ConstVectorView y, ConstVectorView xi)
Multiple linear interpolation of a vector.
INDEX Index
The type to use for all integer numbers and indices.
bool any(const ArrayOfIndex &x)
True if any element of a boolean vector, b, is not 0.
void interp_lin_matrix(MatrixView Yi, ConstVectorView x, ConstMatrixView Y, ConstVectorView xi)
Multiple linear interpolation of matrix rows.
void linspace(Vector &x, const Numeric start, const Numeric stop, const Numeric step)
Linearly spaced vector with specified spacing.
A constant view of a Vector.
Index nelem() const
Number of elements.
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.
The global header file for ARTS.