paso::util Namespace Reference

## Functions

int | comparIndex (const void *index1, const void *index2)
| this int-comparison function is used by qsort/bsearch in various places More...
bool | isAny (dim_t N, const index_t *array, index_t value)
| returns true if array contains value More...
dim_t | numPositives (dim_t N, const double *x, escript::JMPI mpiInfo)
| returns the number of positive values in x More...
index_t | iMax (dim_t N, const index_t *array)
| returns the maximum value in integer array More...
index_t | cumsum (dim_t N, index_t *array)
| calculates the cumulative sum in array and returns the total sum More...
index_t | cumsum_maskedTrue (dim_t N, index_t *array, int *mask)
index_t | cumsum_maskedFalse (dim_t N, index_t *array, int *mask)
index_t | arg_max (dim_t N, dim_t *lambda)
| returns the index to the largest entry in lambda More...
void | zeroes (dim_t N, double *x)
| fills array x with zeroes More...
void | update (dim_t n, double a, double *x, double b, const double *y)
void | linearCombination (dim_t n, double *z, double a, const double *x, double b, const double *y)
double | innerProduct (dim_t N, const double *x, const double *y, escript::JMPI mpiInfo)
| returns the inner product of global arrays x and y More...
double | lsup (dim_t N, const double *x, escript::JMPI mpiInfo)
| returns the global Lsup of x More...
double | l2 (dim_t N, const double *x, escript::JMPI mpiInfo)
| returns the global L2 norm of x More...
void | applyGivensRotations (dim_t n, double *v, const double *c, const double *s)
void | copy (dim_t N, double *out, const double *in)
| out = in More...
void | scale (dim_t N, double *x, double a)
| x = a*x More...
void | AXPY (dim_t N, double *x, double a, const double *y)
| x = x+a*y More...
bool | samesign (double a, double b)
| returns true if both arguments have the same sign, false otherwise More...

## Function Documentation

## applyGivensRotations()

void paso::util::applyGivensRotations | ( | dim_t | N,
|  | double * | v,
|  | const double * | c,
|  | const double * | s
| ) |  |

Applies a sequence of N-1 Givens rotations (c,s) to v of length N which is assumed to be small.

## arg_max()

index_t paso::util::arg_max | ( | dim_t | n,
|  | dim_t * | lambda
| ) |  |

returns the index to the largest entry in lambda

## AXPY()

void paso::util::AXPY | ( | dim_t | N,
|  | double * | x,
|  | double | a,
|  | const double * | y
| ) |  |

inline

x = x+a*y

Referenced by paso::Preconditioner_LocalSmoother_solve().

## comparIndex()

int paso::util::comparIndex | ( | const void * | index1,
|  | const void * | index2
| ) |  |

this int-comparison function is used by qsort/bsearch in various places

Referenced by paso::Pattern::borrowMainDiagonalPointer(), paso::Pattern::Pattern(), paso::Solver_updateIncompleteSchurComplement(), paso::SparseMatrix_MatrixMatrix_BB(), paso::SparseMatrix_MatrixMatrix_BD(), paso::SparseMatrix_MatrixMatrix_DB(), and paso::SparseMatrix::unroll().

## copy()

void paso::util::copy | ( | dim_t | N,
|  | double * | out,
|  | const double * | in
| ) |  |

inline

out = in

Referenced by weipa::FinleyElements::buildReducedElements(), ripley::RipleyDomain::copyData(), weipa::DataVar::DataVar(), ripley::RipleyDomain::dofToNodes(), weipa::FinleyNodes::FinleyNodes(), weipa::DataVar::getDataFlat(), weipa::DataVar::initFromEscript(), ripley::RipleyDomain::interpolateOnDomain(), paso::LinearSystem::LinearSystem(), ripley::Brick::nodesToDOF(), ripley::Rectangle::nodesToDOF(), escript::patternFillArray(), paso::Preconditioner_LocalSmoother_solve(), weipa::SpeckleyElements::reorderArray(), weipa::RipleyElements::reorderArray(), weipa::FinleyElements::reorderArray(), weipa::DataVar::reorderSamples(), weipa::RipleyNodes::RipleyNodes(), speckley::SpeckleyDomain::setNewX(), weipa::SpeckleyNodes::SpeckleyNodes(), and paso::FCT_Solver::updateNL().

## cumsum()

index_t paso::util::cumsum | ( | dim_t | N,
|  | index_t * | array
| ) |  |

calculates the cumulative sum in array and returns the total sum

Referenced by paso::Pattern::getSubpattern().

## cumsum_maskedFalse()

index_t paso::util::cumsum_maskedFalse | ( | dim_t | N,
|  | index_t * | array,
|  | int * | mask
| ) |  |

## cumsum_maskedTrue()

index_t paso::util::cumsum_maskedTrue | ( | dim_t | N,
|  | index_t * | array,
|  | int * | mask
| ) |  |

## iMax()

index_t paso::util::iMax | ( | dim_t | N,
|  | const index_t * | array
| ) |  |

returns the maximum value in integer array

References paso::N.

## innerProduct()

double paso::util::innerProduct | ( | dim_t | n,
|  | const double * | x,
|  | const double * | y,
|  | escript::JMPI | mpiinfo
| ) |  |

returns the inner product of global arrays x and y

References MPI_DOUBLE, and MPI_SUM.

## isAny()

bool paso::util::isAny | ( | dim_t | N,
|  | const index_t * | array,
|  | index_t | value
| ) |  |

returns true if array contains value

Referenced by paso::Pattern::borrowColoringPointer().

## l2()

double paso::util::l2 | ( | dim_t | n,
|  | const double * | x,
|  | escript::JMPI | mpiinfo
| ) |  |

returns the global L2 norm of x

Referenced by speckley::_brick(), ripley::_brick(), ripley::_multibrick(), ripley::Brick::Brick(), speckley::Brick::Brick(), dudley::brick(), finley::brick(), dudley::DudleyDomain::create3D(), finley::FinleyDomain::createHex20(), finley::FinleyDomain::createHex8(), and paso::FCT_Solver::updateNL().

## linearCombination()

void paso::util::linearCombination | ( | dim_t | N,
|  | double * | z,
|  | double | a,
|  | const double * | x,
|  | double | b,
|  | const double * | y
| ) |  |

Performs an update of the form z = a*x+b*y where y and x are long vectors. If a=0, x is not used; if b=0, y is not used.

## lsup()

double paso::util::lsup | ( | dim_t | n,
|  | const double * | x,
|  | escript::JMPI | mpiinfo
| ) |  |

returns the global Lsup of x

Referenced by paso::FCT_Solver::updateLCN(), and paso::FCT_Solver::updateNL().

## numPositives()

dim_t paso::util::numPositives | ( | dim_t | N,
|  | const double * | x,
|  | escript::JMPI | mpiInfo
| ) |  |

returns the number of positive values in x

## samesign()

bool paso::util::samesign | ( | double | a,
|  | double | b
| ) |  |

inline

returns true if both arguments have the same sign, false otherwise

## scale()

void paso::util::scale | ( | dim_t | N,
|  | double * | x,
|  | double | a
| ) |  |

inline

x = a*x

Referenced by escript::eigenvalues_and_eigenvectors2(), and paso::FCT_Solver::updateLCN().

## update()

void paso::util::update | ( | dim_t | N,
|  | double | a,
|  | double * | x,
|  | double | b,
|  | const double * | y
| ) |  |

Performs an update of the form x = a*x+b*y where y and x are long vectors. If b=0, y is not used.

Referenced by paso::FCT_Solver::updateLCN(), and paso::FCT_Solver::updateNL().

## zeroes()

void paso::util::zeroes | ( | dim_t | n,
|  | double * | x
| ) |  |

fills array x with zeroes

Referenced by paso::TransportProblem::resetTransport(), and paso::FCT_Solver::updateNL().