SenK
SenK is a C++ library for high-performance linear solvers.
senk::utils Namespace Reference

Contains utility functions. More...

Functions

template<typename T >
T * SafeMalloc (int size)
 Allocate memory. More...
 
template<typename T >
T * SafeCalloc (int size)
 Allocate memory and clear it. More...
 
template<typename T >
T * SafeRealloc (T *old, int size)
 Reallocate memory. More...
 
template<typename T >
void SafeFree (T **ptr)
 Free allocated memory. More...
 
template<typename T >
void Copy (T *in, T *out, int size)
 Copy in to out. More...
 
template<typename T >
void Set (T val, T *out, int size)
 Set values of out to val. More...
 
template<typename T1 , typename T2 >
void Convert (T1 *in, T2 *out, int size)
 Convert type of arrays. More...
 

Detailed Description

Contains utility functions.

Function Documentation

◆ Convert()

template<typename T1 , typename T2 >
void senk::utils::Convert ( T1 *  in,
T2 *  out,
int  size 
)

Convert type of arrays.

Template Parameters
T1The type of the original array.
T2The type of the converted array.
Parameters
inThe input array.
outThe output array.
sizeThe size of the array.

Definition at line 104 of file senk_utils.hpp.

◆ Copy()

template<typename T >
void senk::utils::Copy ( T *  in,
T *  out,
int  size 
)

Copy in to out.

Template Parameters
TThe type of in and out.
Parameters
inThe input array.
outThe output array.
sizeThe size of the arrays.

Definition at line 73 of file senk_utils.hpp.

◆ SafeCalloc()

template<typename T >
T * senk::utils::SafeCalloc ( int  size)

Allocate memory and clear it.

Template Parameters
Anunit type
Parameters
sizeThe size of memory to be allocated.

Definition at line 35 of file senk_utils.hpp.

◆ SafeFree()

template<typename T >
void senk::utils::SafeFree ( T **  ptr)

Free allocated memory.

Template Parameters
TAn unit type
Parameters
ptrThe pointer to the memory to be freed.

Definition at line 60 of file senk_utils.hpp.

◆ SafeMalloc()

template<typename T >
T * senk::utils::SafeMalloc ( int  size)

Allocate memory.

Template Parameters
Anunit type
Parameters
sizeThe size of memory to be allocated.

Definition at line 23 of file senk_utils.hpp.

◆ SafeRealloc()

template<typename T >
T * senk::utils::SafeRealloc ( T *  old,
int  size 
)

Reallocate memory.

Template Parameters
Anunit type
Parameters
oldThe pointer to the memory to be reallocated.
sizeThe size of memory to be allocated.

Definition at line 48 of file senk_utils.hpp.

◆ Set()

template<typename T >
void senk::utils::Set ( val,
T *  out,
int  size 
)

Set values of out to val.

Template Parameters
TThe type of the value.
Parameters
valThe input value.
outThe output array.
sizeThe size of the array.

Definition at line 88 of file senk_utils.hpp.