ViennaCL - The Vienna Computing Library  1.7.0
Free open-source GPU-accelerated linear algebra and solver library.
viennacl::tools Namespace Reference

Namespace for various tools used within ViennaCL. More...

Namespaces

 detail
 Contains implementation details for the tools. Usually not of interest for the library user.
 

Classes

struct  CHECK_SCALAR_TEMPLATE_ARGUMENT
 A guard that checks whether the floating point type of GPU types is either float or double. More...
 
struct  CONST_REMOVER
 Removes the const qualifier from a type. More...
 
class  const_sparse_matrix_adapted_iterator
 A const iterator for sparse matrices of type std::vector<std::map<SizeT, NumericT> > More...
 
class  const_sparse_matrix_adapter
 Adapts a constant sparse matrix type made up from std::vector<std::map<SizeT, NumericT> > to basic ublas-compatibility. More...
 
struct  CPU_SCALAR_TYPE_DEDUCER
 Obtain the cpu scalar type from a type, including a GPU type like viennacl::scalar<T> More...
 
struct  MATRIX_ITERATOR_INCREMENTER
 Helper class for incrementing an iterator in a dense matrix. More...
 
struct  MATRIX_SIZE_DEDUCER
 Deduces the size of the resulting vector represented by a vector_expression from the operands. More...
 
class  normal_random_numbers
 Random number generator for returning normally distributed values. More...
 
class  shared_ptr
 A shared pointer class similar to boost::shared_ptr. Reimplemented in order to avoid a Boost-dependency. Will be replaced by std::shared_ptr as soon as C++11 is widely available. More...
 
class  sparse_matrix_adapted_iterator
 A non-const iterator for sparse matrices of type std::vector<std::map<SizeT, NumericT> > More...
 
class  sparse_matrix_adapter
 Adapts a non-const sparse matrix type made up from std::vector<std::map<SizeT, NumericT> > to basic ublas-compatibility. More...
 
class  timer
 Simple timer class based on gettimeofday (POSIX) or QueryPerformanceCounter (Windows). More...
 
class  uniform_random_numbers
 Random number generator for returning uniformly distributed values in the closed interval [0, 1]. More...
 

Typedefs

typedef signed char int8_t
 
typedef unsigned char uint8_t
 
typedef short int16_t
 
typedef unsigned short uint16_t
 
typedef int int32_t
 
typedef unsigned int uint32_t
 

Functions

template<typename MatrixType >
void generate_fdm_laplace (MatrixType &A, vcl_size_t points_x, vcl_size_t points_y)
 Generates a sparse matrix obtained from a simple finite-difference discretization of the Laplace equation on the unit square (2d). More...
 
template<typename NumericT >
void generate_fdm_laplace (viennacl::compressed_matrix< NumericT > &A, vcl_size_t points_x, vcl_size_t points_y)
 
template<typename NumericT >
void generate_fdm_laplace (viennacl::coordinate_matrix< NumericT > &A, vcl_size_t points_x, vcl_size_t points_y)
 
template<typename NumericT >
void generate_fdm_laplace (viennacl::ell_matrix< NumericT > &A, vcl_size_t points_x, vcl_size_t points_y)
 
template<typename NumericT >
void generate_fdm_laplace (viennacl::sliced_ell_matrix< NumericT > &A, vcl_size_t points_x, vcl_size_t points_y)
 
template<typename NumericT >
void generate_fdm_laplace (viennacl::hyb_matrix< NumericT > &A, vcl_size_t points_x, vcl_size_t points_y)
 
std::string sha1 (std::string const &src)
 
std::string read_text_from_file (const std::string &filename)
 Reads a text from a file into a std::string. More...
 
std::string str_replace (const std::string &text, std::string to_search, std::string to_replace)
 Replaces all occurances of a substring by another stringstream. More...
 
template<class INT_TYPE >
INT_TYPE align_to_multiple (INT_TYPE to_reach, INT_TYPE base)
 Rounds an integer to the next multiple of another integer. More...
 
template<class INT_TYPE >
INT_TYPE round_down_to_prevous_multiple (INT_TYPE to_reach, INT_TYPE base)
 Rounds an integer to the previous multiple of another integer. More...
 
int find_and_replace (std::string &source, std::string const &find, std::string const &replace)
 Replace in a source string a pattern by another. More...
 
template<class InputIterator , class UnaryPredicate >
bool any_of (InputIterator first, InputIterator last, UnaryPredicate pred)
 Returns true if pred returns true for any of the elements in the range [first,last), and false otherwise. More...
 
std::string make_double_kernel (std::string const &source, std::string const &fp_extension)
 Create a double precision kernel out of a single precision kernel. More...
 
template<typename HostScalarType >
viennacl::scalar< HostScalarType > const & promote_if_host_scalar (viennacl::scalar< HostScalarType > const &s)
 
template<typename HostScalarType >
viennacl::scalar_expression< const viennacl::scalar< HostScalarType >, const viennacl::scalar< HostScalarType >, viennacl::op_flip_sign > const & promote_if_host_scalar (viennacl::scalar_expression< const viennacl::scalar< HostScalarType >, const viennacl::scalar< HostScalarType >, viennacl::op_flip_sign > const &s)
 
template<typename HostScalarType >
HostScalarType promote_if_host_scalar (float s)
 
template<typename HostScalarType >
HostScalarType promote_if_host_scalar (double s)
 
template<typename HostScalarType >
HostScalarType promote_if_host_scalar (long s)
 
template<typename HostScalarType >
HostScalarType promote_if_host_scalar (unsigned long s)
 
template<typename HostScalarType >
HostScalarType promote_if_host_scalar (int s)
 
template<typename HostScalarType >
HostScalarType promote_if_host_scalar (unsigned int s)
 
template<class T >
std::string to_string (T const t)
 

Detailed Description

Namespace for various tools used within ViennaCL.

Typedef Documentation

typedef short viennacl::tools::int16_t

Definition at line 39 of file sha1.hpp.

Definition at line 45 of file sha1.hpp.

typedef signed char viennacl::tools::int8_t

Definition at line 37 of file sha1.hpp.

typedef unsigned short viennacl::tools::uint16_t

Definition at line 40 of file sha1.hpp.

typedef unsigned int viennacl::tools::uint32_t

Definition at line 46 of file sha1.hpp.

typedef unsigned char viennacl::tools::uint8_t

Definition at line 38 of file sha1.hpp.

Function Documentation

template<class INT_TYPE >
INT_TYPE viennacl::tools::align_to_multiple ( INT_TYPE  to_reach,
INT_TYPE  base 
)

Rounds an integer to the next multiple of another integer.

Template Parameters
INT_TYPEThe integer type
Parameters
to_reachThe integer to be rounded up (ceil operation)
baseThe base
Returns
The smallest multiple of 'base' such that to_reach <= base

Definition at line 133 of file tools.hpp.

template<class InputIterator , class UnaryPredicate >
bool viennacl::tools::any_of ( InputIterator  first,
InputIterator  last,
UnaryPredicate  pred 
)

Returns true if pred returns true for any of the elements in the range [first,last), and false otherwise.

Definition at line 175 of file tools.hpp.

int viennacl::tools::find_and_replace ( std::string &  source,
std::string const &  find,
std::string const &  replace 
)
inline

Replace in a source string a pattern by another.

Parameters
sourceThe source string
findString to find
replaceString to replace

Definition at line 160 of file tools.hpp.

template<typename MatrixType >
void viennacl::tools::generate_fdm_laplace ( MatrixType &  A,
vcl_size_t  points_x,
vcl_size_t  points_y 
)

Generates a sparse matrix obtained from a simple finite-difference discretization of the Laplace equation on the unit square (2d).

Template Parameters
MatrixTypeAn uBLAS-compatible matrix type supporting .clear(), .resize(), and operator()-access
Parameters
AA sparse matrix object from ViennaCL, total number of unknowns will be points_x*points_y
points_xNumber of points in x-direction
points_yNumber of points in y-direction

Definition at line 48 of file matrix_generation.hpp.

template<typename NumericT >
void viennacl::tools::generate_fdm_laplace ( viennacl::compressed_matrix< NumericT > &  A,
vcl_size_t  points_x,
vcl_size_t  points_y 
)

Definition at line 94 of file matrix_generation.hpp.

template<typename NumericT >
void viennacl::tools::generate_fdm_laplace ( viennacl::coordinate_matrix< NumericT > &  A,
vcl_size_t  points_x,
vcl_size_t  points_y 
)

Definition at line 104 of file matrix_generation.hpp.

template<typename NumericT >
void viennacl::tools::generate_fdm_laplace ( viennacl::ell_matrix< NumericT > &  A,
vcl_size_t  points_x,
vcl_size_t  points_y 
)

Definition at line 114 of file matrix_generation.hpp.

template<typename NumericT >
void viennacl::tools::generate_fdm_laplace ( viennacl::sliced_ell_matrix< NumericT > &  A,
vcl_size_t  points_x,
vcl_size_t  points_y 
)

Definition at line 124 of file matrix_generation.hpp.

template<typename NumericT >
void viennacl::tools::generate_fdm_laplace ( viennacl::hyb_matrix< NumericT > &  A,
vcl_size_t  points_x,
vcl_size_t  points_y 
)

Definition at line 134 of file matrix_generation.hpp.

std::string viennacl::tools::make_double_kernel ( std::string const &  source,
std::string const &  fp_extension 
)
inline

Create a double precision kernel out of a single precision kernel.

Parameters
sourceThe source string
fp_extensionAn info string that specifies the OpenCL double precision extension
Returns
The double precision kernel

Definition at line 191 of file tools.hpp.

template<typename HostScalarType >
viennacl::scalar<HostScalarType> const& viennacl::tools::promote_if_host_scalar ( viennacl::scalar< HostScalarType > const &  s)

Definition at line 275 of file tools.hpp.

template<typename HostScalarType >
viennacl::scalar_expression<const viennacl::scalar<HostScalarType>,const viennacl::scalar<HostScalarType>,viennacl::op_flip_sign> const& viennacl::tools::promote_if_host_scalar ( viennacl::scalar_expression< const viennacl::scalar< HostScalarType >, const viennacl::scalar< HostScalarType >, viennacl::op_flip_sign > const &  s)

Definition at line 281 of file tools.hpp.

template<typename HostScalarType >
HostScalarType viennacl::tools::promote_if_host_scalar ( float  s)

Definition at line 286 of file tools.hpp.

template<typename HostScalarType >
HostScalarType viennacl::tools::promote_if_host_scalar ( double  s)

Definition at line 289 of file tools.hpp.

template<typename HostScalarType >
HostScalarType viennacl::tools::promote_if_host_scalar ( long  s)

Definition at line 292 of file tools.hpp.

template<typename HostScalarType >
HostScalarType viennacl::tools::promote_if_host_scalar ( unsigned long  s)

Definition at line 295 of file tools.hpp.

template<typename HostScalarType >
HostScalarType viennacl::tools::promote_if_host_scalar ( int  s)

Definition at line 298 of file tools.hpp.

template<typename HostScalarType >
HostScalarType viennacl::tools::promote_if_host_scalar ( unsigned int  s)

Definition at line 301 of file tools.hpp.

std::string viennacl::tools::read_text_from_file ( const std::string &  filename)
inline

Reads a text from a file into a std::string.

Parameters
filenameThe filename
Returns
The text read from the file

Definition at line 89 of file tools.hpp.

template<class INT_TYPE >
INT_TYPE viennacl::tools::round_down_to_prevous_multiple ( INT_TYPE  to_reach,
INT_TYPE  base 
)

Rounds an integer to the previous multiple of another integer.

Template Parameters
INT_TYPEThe integer type
Parameters
to_reachThe integer to be rounded down (floor operation)
baseThe base
Returns
The biggest multiple of 'base' such that to_reach >= base

Definition at line 148 of file tools.hpp.

std::string viennacl::tools::sha1 ( std::string const &  src)
inline

Definition at line 220 of file sha1.hpp.

std::string viennacl::tools::str_replace ( const std::string &  text,
std::string  to_search,
std::string  to_replace 
)
inline

Replaces all occurances of a substring by another stringstream.

Parameters
textThe string to search in
to_searchThe substring to search for
to_replaceThe replacement for found substrings
Returns
The resulting string

Definition at line 109 of file tools.hpp.

template<class T >
std::string viennacl::tools::to_string ( T const  t)
inline

Definition at line 304 of file tools.hpp.