Cantera  2.4.0
Classes | Namespaces | Functions
utilities.h File Reference

Various templated functions that carry out common vector operations (see Templated Utility Functions). More...

#include "ct_defs.h"
#include "global.h"
#include <stdexcept>
#include <numeric>
Include dependency graph for utilities.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  timesConstant< T >
 Unary operator to multiply the argument by a constant. More...
 

Namespaces

 Cantera
 Namespace for the Cantera kernel.
 

Functions

template<class V >
doublereal dot4 (const V &x, const V &y)
 Templated Inner product of two vectors of length 4. More...
 
template<class V >
doublereal dot5 (const V &x, const V &y)
 Templated Inner product of two vectors of length 5. More...
 
template<class InputIter , class InputIter2 >
doublereal dot (InputIter x_begin, InputIter x_end, InputIter2 y_begin)
 Function that calculates a templated inner product. More...
 
template<class InputIter , class OutputIter , class S >
void scale (InputIter begin, InputIter end, OutputIter out, S scale_factor)
 Multiply elements of an array by a scale factor. More...
 
template<class InputIter , class OutputIter >
void multiply_each (OutputIter x_begin, OutputIter x_end, InputIter y_begin)
 Multiply each entry in x by the corresponding entry in y. More...
 
template<class InputIter >
doublereal absmax (InputIter begin, InputIter end)
 The maximum absolute value (templated version) More...
 
template<class InputIter , class OutputIter >
void normalize (InputIter begin, InputIter end, OutputIter out)
 Normalize the values in a sequence, such that they sum to 1.0 (templated version) More...
 
template<class InputIter , class OutputIter >
void divide_each (OutputIter x_begin, OutputIter x_end, InputIter y_begin)
 Templated divide of each element of x by the corresponding element of y. More...
 
template<class InputIter , class OutputIter >
void sum_each (OutputIter x_begin, OutputIter x_end, InputIter y_begin)
 Increment each entry in x by the corresponding entry in y. More...
 
template<class InputIter , class OutputIter , class IndexIter >
void scatter_copy (InputIter begin, InputIter end, OutputIter result, IndexIter index)
 Copies a contiguous range in a sequence to indexed positions in another sequence. More...
 
template<class InputIter , class RandAccessIter , class IndexIter >
void scatter_mult (InputIter mult_begin, InputIter mult_end, RandAccessIter data, IndexIter index)
 Multiply selected elements in an array by a contiguous sequence of multipliers. More...
 
template<class InputIter >
doublereal sum_xlogx (InputIter begin, InputIter end)
 Compute

\[ \sum_k x_k \log x_k. \]

. More...

 
template<class InputIter1 , class InputIter2 >
doublereal sum_xlogQ (InputIter1 begin, InputIter1 end, InputIter2 Q_begin)
 Compute

\[ \sum_k x_k \log Q_k. \]

. More...

 
template<class D , class R >
poly6 (D x, R *c)
 Templated evaluation of a polynomial of order 6. More...
 
template<class D , class R >
poly8 (D x, R *c)
 Templated evaluation of a polynomial of order 8. More...
 
template<class D , class R >
poly5 (D x, R *c)
 Templated evaluation of a polynomial of order 5. More...
 
template<class D , class R >
poly4 (D x, R *c)
 Evaluates a polynomial of order 4. More...
 
template<class D , class R >
poly3 (D x, R *c)
 Templated evaluation of a polynomial of order 3. More...
 
void checkFinite (const double tmp)
 Check to see that a number is finite (not NaN, +Inf or -Inf) More...
 
void checkFinite (const std::string &name, double *values, size_t N)
 Check to see that all elements in an array are finite. More...
 
template<class T , class U >
const U & getValue (const std::map< T, U > &m, const T &key, const U &default_val)
 Const accessor for a value in a std::map. More...
 

Detailed Description

Various templated functions that carry out common vector operations (see Templated Utility Functions).

Definition in file utilities.h.