IT++ Logo
Functions
Conversion Functions
Base Module

Functions

template<class T >
bvec itpp::to_bvec (const Vec< T > &v)
 Converts a Vec<T> to bvec.
 
template<class T >
svec itpp::to_svec (const Vec< T > &v)
 Converts a Vec<T> to svec.
 
template<class T >
ivec itpp::to_ivec (const Vec< T > &v)
 Converts a Vec<T> to ivec.
 
template<class T >
vec itpp::to_vec (const Vec< T > &v)
 Converts a Vec<T> to vec.
 
template<class T >
cvec itpp::to_cvec (const Vec< T > &v)
 Converts a Vec<T> to cvec.
 
template<class T >
cvec itpp::to_cvec (const Vec< T > &real, const Vec< T > &imag)
 Converts real and imaginary Vec<T> to cvec.
 
ivec itpp::to_ivec (int s)
 Converts an int to ivec.
 
vec itpp::to_vec (double s)
 Converts an double to vec.
 
cvec itpp::to_cvec (double real, double imag)
 Converts real and imaginary double to cvec.
 
template<class T >
bmat itpp::to_bmat (const Mat< T > &m)
 Converts a Mat<T> to bmat.
 
template<class T >
smat itpp::to_smat (const Mat< T > &m)
 Converts a Mat<T> to smat.
 
template<class T >
imat itpp::to_imat (const Mat< T > &m)
 Converts a Mat<T> to imat.
 
template<class T >
mat itpp::to_mat (const Mat< T > &m)
 Converts a Mat<T> to mat.
 
template<class T >
cmat itpp::to_cmat (const Mat< T > &m)
 Converts a Mat<T> to cmat.
 
template<class T >
cmat itpp::to_cmat (const Mat< T > &real, const Mat< T > &imag)
 Converts real and imaginary Mat<T> to cmat.
 
ITPP_EXPORT bvec itpp::dec2bin (int length, int index)
 Convert a decimal int index to bvec using length bits in the representation.
 
ITPP_EXPORT void itpp::dec2bin (int index, bvec &v)
 Convert a decimal int index to bvec. Value returned in v.
 
ITPP_EXPORT bvec itpp::dec2bin (int index, bool msb_first=true)
 Convert a decimal int index to bvec with the first bit as MSB if msb_first == true.
 
ITPP_EXPORT int itpp::bin2dec (const bvec &inbvec, bool msb_first=true)
 Convert a bvec to decimal int with the first bit as MSB if msb_first == true.
 
ITPP_EXPORT bvec itpp::oct2bin (const ivec &octalindex, short keepzeros=0)
 Convert ivec of octal form to bvec.
 
ITPP_EXPORT ivec itpp::bin2oct (const bvec &inbits)
 Convert bvec to octal ivec.
 
ITPP_EXPORT ivec itpp::bin2pol (const bvec &inbvec)
 Convert bvec to polar binary representation as ivec.
 
ITPP_EXPORT bvec itpp::pol2bin (const ivec &inpol)
 Convert binary polar ivec to bvec.
 
double itpp::rad_to_deg (double x)
 Convert radians to degrees.
 
double itpp::deg_to_rad (double x)
 Convert degrees to radians.
 
ITPP_EXPORT double itpp::round (double x)
 Round to nearest integer, return result in double.
 
ITPP_EXPORT vec itpp::round (const vec &x)
 Round to nearest integer.
 
ITPP_EXPORT mat itpp::round (const mat &x)
 Round to nearest integer.
 
ITPP_EXPORT int itpp::round_i (double x)
 Round to nearest integer.
 
ITPP_EXPORT ivec itpp::round_i (const vec &x)
 Round to nearest integer and return ivec.
 
ITPP_EXPORT imat itpp::round_i (const mat &x)
 Round to nearest integer and return imat.
 
vec itpp::ceil (const vec &x)
 Round to nearest upper integer.
 
mat itpp::ceil (const mat &x)
 Round to nearest upper integer.
 
int itpp::ceil_i (double x)
 The nearest larger integer.
 
ITPP_EXPORT ivec itpp::ceil_i (const vec &x)
 Round to nearest upper integer.
 
ITPP_EXPORT imat itpp::ceil_i (const mat &x)
 Round to nearest upper integer.
 
vec itpp::floor (const vec &x)
 Round to nearest lower integer.
 
mat itpp::floor (const mat &x)
 Round to nearest lower integer.
 
int itpp::floor_i (double x)
 The nearest smaller integer.
 
ITPP_EXPORT ivec itpp::floor_i (const vec &x)
 Round to nearest lower integer.
 
ITPP_EXPORT imat itpp::floor_i (const mat &x)
 Round to nearest lower integer.
 
double itpp::round_to_zero (double x, double threshold=1e-14)
 Round x to zero if abs(x) is smaller than threshold.
 
std::complex< double > itpp::round_to_zero (const std::complex< double > &x, double threshold=1e-14)
 Round each part of x smaller than threshold to zero.
 
vec itpp::round_to_zero (const vec &x, double threshold=1e-14)
 Round each element to zero if element < threshold.
 
mat itpp::round_to_zero (const mat &x, double threshold=1e-14)
 Round each element to zero if element < threshold.
 
ITPP_EXPORT cvec itpp::round_to_zero (const cvec &x, double threshold=1e-14)
 Round each element to zero if element < threshold.
 
ITPP_EXPORT cmat itpp::round_to_zero (const cmat &x, double threshold=1e-14)
 Round each element to zero if element < threshold.
 
double itpp::round_to_infty (const double in, const double threshold=1e9)
 Remove trailing digits, found after the decimal point, for numbers greater than threshold.
 
std::complex< double > itpp::round_to_infty (const std::complex< double > &in, const double threshold=1e9)
 Remove trailing digits, found after the decimal point, for complex numbers whose real and imaginary parts are greater than threshold.
 
vec itpp::round_to_infty (const vec &in, const double threshold=1e9)
 Remove trailing digits, found after the decimal point, for vectors greater than threshold.
 
mat itpp::round_to_infty (const mat &in, const double threshold=1e9)
 Remove trailing digits, found after the decimal point, for matrices greater than threshold.
 
ITPP_EXPORT cvec itpp::round_to_infty (const cvec &in, const double threshold=1e9)
 Remove trailing digits, found after the decimal point, for complex vectors greater than threshold.
 
ITPP_EXPORT cmat itpp::round_to_infty (const cmat &in, const double threshold=1e9)
 Remove trailing digits, found after the decimal point, for complex matrices greater than threshold.
 
int itpp::gray_code (int x)
 Convert to Gray Code.
 
template<typename T >
std::string itpp::to_str (const T &i)
 Convert anything to string.
 
ITPP_EXPORT std::string itpp::to_str (const double &i, const int precision)
 Convert double to string.
 
template<class T >
bvec to_bvec (const Vec< T > &v)
 Converts a Vec<T> to bvec.
 
template<class T >
svec to_svec (const Vec< T > &v)
 Converts a Vec<T> to svec.
 
template<class T >
ivec to_ivec (const Vec< T > &v)
 Converts a Vec<T> to ivec.
 
template<class T >
vec to_vec (const Vec< T > &v)
 Converts a Vec<T> to vec.
 
template<class T >
cvec to_cvec (const Vec< T > &v)
 Converts a Vec<T> to cvec.
 
template<class T >
cvec to_cvec (const Vec< T > &real, const Vec< T > &imag)
 Converts real and imaginary Vec<T> to cvec.
 
ivec to_ivec (int s)
 Converts an int to ivec.
 
vec to_vec (double s)
 Converts an double to vec.
 
cvec to_cvec (double real, double imag)
 Converts real and imaginary double to cvec.
 
template<class T >
bmat to_bmat (const Mat< T > &m)
 Converts a Mat<T> to bmat.
 
template<class T >
smat to_smat (const Mat< T > &m)
 Converts a Mat<T> to smat.
 
template<class T >
imat to_imat (const Mat< T > &m)
 Converts a Mat<T> to imat.
 
template<class T >
mat to_mat (const Mat< T > &m)
 Converts a Mat<T> to mat.
 
template<class T >
cmat to_cmat (const Mat< T > &m)
 Converts a Mat<T> to cmat.
 
template<class T >
cmat to_cmat (const Mat< T > &real, const Mat< T > &imag)
 Converts real and imaginary Mat<T> to cmat.
 

Detailed Description

Function Documentation

ITPP_EXPORT bvec itpp::oct2bin ( const ivec &  octalindex,
short  keepzeros = 0 
)

Convert ivec of octal form to bvec.

Converts from ivec containing {0,1,2,...,7} to bvec containing {0,1}. Removes zeros to the left if keepzeros = 0 (default). Example: oct2bin("3 5 5 1") returns {1 1 1 0 1 1 0 1 0 0 1}.

Referenced by itpp::BCH::BCH(), itpp::LFSR::set_connections(), and itpp::LFSR::set_state().

ITPP_EXPORT ivec itpp::bin2oct ( const bvec &  inbits)

Convert bvec to octal ivec.

Converts from bvec containing {0,1} to ivec containing {0,1,2,...,7}. Adds zeros to the left if inbits.length() is not a factor of 3. Example: bin2oct("1 1 1 0 1 1 0 1 0 0 1") returns {3 5 5 1}.

template<typename T >
std::string itpp::to_str ( const T &  i)

Convert anything to string.

Parameters
i(Input) The value to be converted to a string

Definition at line 444 of file converters.h.

Referenced by itpp::assert_fixshift(), itpp::TCP_Segment::set_begin(), and itpp::TCP_Segment::set_end().

ITPP_EXPORT std::string itpp::to_str ( const double &  i,
const int  precision 
)

Convert double to string.

Parameters
[in]iThe value to be converted to a string
[in]precisionThe number of digits used to represent the fractional part
SourceForge Logo

Generated on Sat Jul 6 2013 10:54:28 for IT++ by Doxygen 1.8.2