Advanced Multi-Physics (AMP)
On-Line Documentation
Public Types | Static Public Member Functions | Private Member Functions | List of all members
AMP::FunctionTable< TYPE > Class Template Reference

#include <FunctionTable.h>

Public Types

template<class TYPE2 >
using cloneTo = FunctionTable< TYPE2 >
 
typedef TYPE value_type
 

Static Public Member Functions

static void axpby (TYPE alpha, size_t N, const TYPE *x, TYPE beta, TYPE *y)
 
static void axpy (TYPE alpha, size_t N, const TYPE *x, TYPE *y)
 
static bool equals (size_t N, const TYPE *A, const TYPE *B, TYPE tol)
 
static void gemm (TYPE alpha, const ArraySize &sa, const TYPE *A, const ArraySize &sb, const TYPE *B, TYPE beta, const ArraySize &sc, TYPE *C)
 
static TYPE max (size_t N, const TYPE *x)
 
static TYPE min (size_t N, const TYPE *x)
 
static void multiply (const ArraySize &sa, const TYPE *a, const ArraySize &sb, const TYPE *b, const ArraySize &sc, TYPE *c)
 
static void mx (size_t N, const TYPE *x, TYPE *y)
 
static void mx (size_t N, TYPE x, TYPE *y)
 
static void px (size_t N, const TYPE *x, TYPE *y)
 
static void px (size_t N, TYPE x, TYPE *y)
 
static void rand (size_t N, TYPE *x)
 
template<typename LAMBDA >
static TYPE reduce (LAMBDA op, size_t N, const TYPE *A, const TYPE *B, TYPE initialValue)
 
template<typename LAMBDA >
static TYPE reduce (LAMBDA op, size_t N, const TYPE *A, TYPE initialValue)
 
static void scale (size_t N, TYPE x, TYPE *y)
 
static TYPE sum (size_t N, const TYPE *x)
 
template<typename LAMBDA >
static void transform (LAMBDA fun, size_t N, const TYPE *x, const TYPE *y, TYPE *z)
 
template<typename LAMBDA >
static void transform (LAMBDA fun, size_t N, const TYPE *x, TYPE *y)
 
static void transformAbs (size_t N, const TYPE *A, TYPE *B)
 
static void transformHardTanh (size_t N, const TYPE *A, TYPE *B)
 
static void transformReLU (size_t N, const TYPE *A, TYPE *B)
 
static void transformSigmoid (size_t N, const TYPE *A, TYPE *B)
 
static void transformSoftPlus (size_t N, const TYPE *A, TYPE *B)
 
static void transformTanh (size_t N, const TYPE *A, TYPE *B)
 

Private Member Functions

 FunctionTable ()=delete
 

Detailed Description

template<class TYPE>
class AMP::FunctionTable< TYPE >

Class FunctionTable is a serial function table class that defines a series of operations that can be performed on the Array class. Users can implement additional versions of the function table that match the interface to change the behavior of the array class.

Definition at line 20 of file FunctionTable.h.

Member Typedef Documentation

◆ cloneTo

template<class TYPE >
template<class TYPE2 >
using AMP::FunctionTable< TYPE >::cloneTo = FunctionTable<TYPE2>

Definition at line 25 of file FunctionTable.h.

◆ value_type

template<class TYPE >
typedef TYPE AMP::FunctionTable< TYPE >::value_type

Definition at line 23 of file FunctionTable.h.

Constructor & Destructor Documentation

◆ FunctionTable()

template<class TYPE >
AMP::FunctionTable< TYPE >::FunctionTable ( )
privatedelete

Member Function Documentation

◆ axpby()

template<class TYPE >
static void AMP::FunctionTable< TYPE >::axpby ( TYPE  alpha,
size_t  N,
const TYPE *  x,
TYPE  beta,
TYPE *  y 
)
static

Perform axpby equavalent operation ( y = alpha*x + beta*y )

Parameters
[in]alphaThe scalar value alpha
[in]NThe length of the array
[in]xThe input array x
[in]betaThe scalar value alpha
[in,out]yThe output array y

◆ axpy()

template<class TYPE >
static void AMP::FunctionTable< TYPE >::axpy ( TYPE  alpha,
size_t  N,
const TYPE *  x,
TYPE *  y 
)
static

Perform axpy equavalent operation ( y = alpha*x + y )

Parameters
[in]alphaThe scalar value alpha
[in]NThe length of the array
[in]xThe input array x
[in,out]yThe output array y

◆ equals()

template<class TYPE >
static bool AMP::FunctionTable< TYPE >::equals ( size_t  N,
const TYPE *  A,
const TYPE *  B,
TYPE  tol 
)
static

Check if two arrays are approximately equal

Parameters
[in]NThe length of the array
[in]AThe first array
[in]BThe second array
[in]tolThe tolerance

◆ gemm()

template<class TYPE >
static void AMP::FunctionTable< TYPE >::gemm ( TYPE  alpha,
const ArraySize sa,
const TYPE *  A,
const ArraySize sb,
const TYPE *  B,
TYPE  beta,
const ArraySize sc,
TYPE *  C 
)
static

Perform dgemv/dgemm equavalent operation ( C = alpha*A*B + beta*C )

Parameters
[in]alphaThe scalar value alpha
[in]saThe size of the A array
[in]AThe first array
[in]sbThe size of the B array
[in]BThe second array
[in]betaThe scalar value alpha
[in]scThe size of the C array
[in,out]CThe output array C

◆ max()

template<class TYPE >
static TYPE AMP::FunctionTable< TYPE >::max ( size_t  N,
const TYPE *  x 
)
static

Return the maximum value

Parameters
[in]NThe length of the array
[in]xThe first array

◆ min()

template<class TYPE >
static TYPE AMP::FunctionTable< TYPE >::min ( size_t  N,
const TYPE *  x 
)
static

Return the minimum value

Parameters
[in]NThe length of the array
[in]xThe first array

◆ multiply()

template<class TYPE >
static void AMP::FunctionTable< TYPE >::multiply ( const ArraySize sa,
const TYPE *  a,
const ArraySize sb,
const TYPE *  b,
const ArraySize sc,
TYPE *  c 
)
static

Multiply two arrays

Parameters
[in]saThe size of the a array
[in]aThe first array
[in]sbThe size of the b array
[in]bThe second array
[in]scThe size of the c array
[out]cThe output array

◆ mx() [1/2]

template<class TYPE >
static void AMP::FunctionTable< TYPE >::mx ( size_t  N,
const TYPE *  x,
TYPE *  y 
)
static

Perform subtraction operation ( y -= x )

Parameters
[in]xThe scalar value alpha
[in]NThe length of the array
[in,out]yThe output array y

◆ mx() [2/2]

template<class TYPE >
static void AMP::FunctionTable< TYPE >::mx ( size_t  N,
TYPE  x,
TYPE *  y 
)
static

Perform subtraction operation ( y -= x )

Parameters
[in]NThe length of the array
[in]xThe scalar value alpha
[in,out]yThe output array y

◆ px() [1/2]

template<class TYPE >
static void AMP::FunctionTable< TYPE >::px ( size_t  N,
const TYPE *  x,
TYPE *  y 
)
static

Perform addition operation ( y += x )

Parameters
[in]NThe length of the array
[in]xThe scalar value alpha
[in,out]yThe output array y

◆ px() [2/2]

template<class TYPE >
static void AMP::FunctionTable< TYPE >::px ( size_t  N,
TYPE  x,
TYPE *  y 
)
static

Perform addition operation ( y += x )

Parameters
[in]NThe length of the array
[in]xThe scalar value alpha
[in,out]yThe output array y

◆ rand()

template<class TYPE >
static void AMP::FunctionTable< TYPE >::rand ( size_t  N,
TYPE *  x 
)
static

Initialize the array with random values

Parameters
[in]NThe length of the array
[in]xThe array to operate on

◆ reduce() [1/2]

template<class TYPE >
template<typename LAMBDA >
static TYPE AMP::FunctionTable< TYPE >::reduce ( LAMBDA  op,
size_t  N,
const TYPE *  A,
const TYPE *  B,
TYPE  initialValue 
)
static

Perform a reduce operator z = f(x,y)

Parameters
[in]opThe function operation Note: the operator is a template parameter to improve performance
[in]NThe length of the array
[in]AThe first array to operate on
[in]BThe second array to operate on
[in]initialValueThe initial value for the reduction (0 for sum, +/- inf for min/max)
Returns
The reduction

◆ reduce() [2/2]

template<class TYPE >
template<typename LAMBDA >
static TYPE AMP::FunctionTable< TYPE >::reduce ( LAMBDA  op,
size_t  N,
const TYPE *  A,
TYPE  initialValue 
)
static

Perform a reduce operator y = f(x)

Parameters
[in]opThe function operation Note: the operator is a template parameter to improve performance
[in]NThe length of the array
[in]AThe array to operate on
[in]initialValueThe initial value for the reduction (0 for sum, +/- inf for min/max)
Returns
The reduction

◆ scale()

template<class TYPE >
static void AMP::FunctionTable< TYPE >::scale ( size_t  N,
TYPE  x,
TYPE *  y 
)
static

Perform addition operation ( y *= x )

Parameters
[in]NThe length of the array
[in]xThe scalar value alpha
[in,out]yThe output array y

◆ sum()

template<class TYPE >
static TYPE AMP::FunctionTable< TYPE >::sum ( size_t  N,
const TYPE *  x 
)
static

Return the sum

Parameters
[in]NThe length of the array
[in]xThe first array

◆ transform() [1/2]

template<class TYPE >
template<typename LAMBDA >
static void AMP::FunctionTable< TYPE >::transform ( LAMBDA  fun,
size_t  N,
const TYPE *  x,
const TYPE *  y,
TYPE *  z 
)
static

Perform a element-wise operation z = f(x,y)

Parameters
[in]funThe function operation Note: the function is a template parameter to improve performance
[in]NThe length of the array
[in]xThe first array
[in]yThe second array
[out]zThe output array

◆ transform() [2/2]

template<class TYPE >
template<typename LAMBDA >
static void AMP::FunctionTable< TYPE >::transform ( LAMBDA  fun,
size_t  N,
const TYPE *  x,
TYPE *  y 
)
static

Perform a element-wise operation y = f(x)

Parameters
[in]funThe function operation Note: the function is a template parameter to improve performance
[in]NThe length of the array
[in,out]xThe array to operate on
[out]yThe output array

◆ transformAbs()

template<class TYPE >
static void AMP::FunctionTable< TYPE >::transformAbs ( size_t  N,
const TYPE *  A,
TYPE *  B 
)
static

Perform a element-wise operation B = |A|

Parameters
[in]NThe length of the array
[in]AThe array to operate on
[out]BThe output array

◆ transformHardTanh()

template<class TYPE >
static void AMP::FunctionTable< TYPE >::transformHardTanh ( size_t  N,
const TYPE *  A,
TYPE *  B 
)
static

Perform a element-wise operation B = max(-1 , min(1 , A) )

Parameters
[in]NThe length of the array
[in]AThe array to operate on
[out]BThe output array

◆ transformReLU()

template<class TYPE >
static void AMP::FunctionTable< TYPE >::transformReLU ( size_t  N,
const TYPE *  A,
TYPE *  B 
)
static

Perform a element-wise operation y = max(x , 0)

Parameters
[in]NThe length of the array
[in]AThe input array
[out]BThe output array

◆ transformSigmoid()

template<class TYPE >
static void AMP::FunctionTable< TYPE >::transformSigmoid ( size_t  N,
const TYPE *  A,
TYPE *  B 
)
static

Perform a element-wise operation B = 1 / (1 + exp(-A))

Parameters
[in]NThe length of the array
[in]AThe array to operate on
[out]BThe output array

◆ transformSoftPlus()

template<class TYPE >
static void AMP::FunctionTable< TYPE >::transformSoftPlus ( size_t  N,
const TYPE *  A,
TYPE *  B 
)
static

Perform a element-wise operation B = log(exp(A) + 1)

Parameters
[in]NThe length of the array
[in]AThe array to operate on
[out]BThe output array

◆ transformTanh()

template<class TYPE >
static void AMP::FunctionTable< TYPE >::transformTanh ( size_t  N,
const TYPE *  A,
TYPE *  B 
)
static

Perform a element-wise operation B = tanh(A)

Parameters
[in]NThe length of the array
[in]AThe array to operate on
[out]BThe output array

The documentation for this class was generated from the following files:



Advanced Multi-Physics (AMP)
Oak Ridge National Laboratory
Idaho National Laboratory
Los Alamos National Laboratory
This page automatically produced from the
source code by doxygen
Last updated: Tue Mar 10 2026 13:06:42.
Comments on this page