IT++ Logo Newcom Logo

Conversion Functions


Functions

bvec itpp::dec2bin (int length, int index)
 Convert a decimal int index to bvec using length bits in the representation.
void itpp::dec2bin (int index, bvec &v)
 Convert a decimal int index to bvec. Value returned in v.
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.
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.
bvec itpp::oct2bin (const ivec &octalindex, short keepzeros=0)
 Convert ivec of octal form to bvec.
ivec itpp::bin2oct (const bvec &inbits)
 Convert bvec to octal ivec.
ivec itpp::bin2pol (const bvec &inbvec)
 Convert bvec to polar binary representation as ivec.
bvec itpp::pol2bin (const ivec &inpol)
 Convert binary polar ivec to bvec.
template<typename T>
std::string itpp::to_str (const T &i)
 Convert anything to string.
std::string itpp::to_str (const double &i, const int precision)
 Convert double to string.
bvec itpp::Vec::to_bvec (const Vec< T > &v)
 Converts a Vec<T> to bvec.
svec itpp::Vec::to_svec (const Vec< T > &v)
 Converts a Vec<T> to svec.
ivec itpp::Vec::to_ivec (const Vec< T > &v)
 Converts a Vec<T> to ivec.
vec itpp::Vec::to_vec (const Vec< T > &v)
 Converts a Vec<T> to vec.
cvec itpp::Vec::to_cvec (const Vec< T > &v)
 Converts a Vec<T> to cvec.
cvec itpp::Vec::to_cvec (const Vec< T > &real, const Vec< T > &imag)
 Converts real and imaginary Vec<T> to cvec.
ivec itpp::Vec::to_ivec (int s)
 Converts an int to ivec.
vec itpp::Vec::to_vec (double s)
 Converts an double to vec.
cvec itpp::Vec::to_cvec (double real, double imag)
 Converts real and imaginary double to cvec.
bmat itpp::Mat::to_bmat (const Mat< T > &m)
 Converts a Mat<T> to bmat.
smat itpp::Mat::to_smat (const Mat< T > &m)
 Converts a Mat<T> to smat.
imat itpp::Mat::to_imat (const Mat< T > &m)
 Converts a Mat<T> to imat.
mat itpp::Mat::to_mat (const Mat< T > &m)
 Converts a Mat<T> to mat.
cmat itpp::Mat::to_cmat (const Mat< T > &m)
 Converts a Mat<T> to cmat.
cmat itpp::Mat::to_cmat (const Mat< T > &real, const Mat< T > &imag)
 Converts real and imaginary Mat<T> to cmat.

Detailed Description


Function Documentation

bvec itpp::dec2bin ( int  length,
int  index 
)

Convert a decimal int index to bvec using length bits in the representation.

Definition at line 240 of file converters.cpp.

Referenced by itpp::Modulator_2d::calculate_softbit_matricies(), itpp::Modulator_2d::demodulate_bits(), itpp::Modulator_1d::demodulate_bits(), itpp::Gold::get_family(), itpp::GF::get_vectorspace(), and itpp::oct2bin().

void itpp::dec2bin ( int  index,
bvec v 
)

Convert a decimal int index to bvec. Value returned in v.

Definition at line 269 of file converters.cpp.

References itpp::int2bits().

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.

Definition at line 252 of file converters.cpp.

References itpp::int2bits(), itpp::length(), and itpp::reverse().

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.

Definition at line 280 of file converters.cpp.

References itpp::pow2i().

Referenced by itpp::bin2oct(), itpp::Hamming_Code::decode(), itpp::Modulator_NCD::modulate_bits(), itpp::Modulator_NRD::modulate_bits(), itpp::QAM::modulate_bits(), itpp::PSK::modulate_bits(), itpp::PAM::modulate_bits(), itpp::Modulator_2d::modulate_bits(), itpp::Modulator_1d::modulate_bits(), itpp::GF::set(), itpp::ND_UPAM::set_Gray_PAM(), itpp::ND_UPSK::set_Gray_PSK(), itpp::ND_UQAM::set_Gray_QAM(), itpp::QAM::set_M(), itpp::PSK::set_M(), and itpp::PAM::set_M().

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}.

Definition at line 296 of file converters.cpp.

References itpp::dec2bin(), and itpp::length().

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

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}.

Definition at line 317 of file converters.cpp.

References itpp::bin2dec(), and itpp::ceil().

ivec itpp::bin2pol ( const bvec inbvec  ) 

Convert bvec to polar binary representation as ivec.

Definition at line 329 of file converters.cpp.

References itpp::to_ivec().

bvec itpp::pol2bin ( const ivec inpol  ) 

Convert binary polar ivec to bvec.

Definition at line 334 of file converters.cpp.

References itpp::to_bvec().

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

Convert anything to string.

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

Definition at line 211 of file converters.h.

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

Convert double to string.

Parameters:
i (Input) The value to be converted to a string
precision (Input) The number of digits used to represent the fractional part

Definition at line 350 of file converters.cpp.

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

template<class Num_T>
bvec to_bvec ( const Vec< T > &  v  )  [related, inherited]

Converts a Vec<T> to bvec.

Definition at line 42 of file converters.cpp.

template<class Num_T>
svec to_svec ( const Vec< T > &  v  )  [related, inherited]

Converts a Vec<T> to svec.

Definition at line 53 of file converters.cpp.

template<class Num_T>
ivec to_ivec ( const Vec< T > &  v  )  [related, inherited]

Converts a Vec<T> to ivec.

Definition at line 64 of file converters.cpp.

template<class Num_T>
vec to_vec ( const Vec< T > &  v  )  [related, inherited]

Converts a Vec<T> to vec.

Definition at line 75 of file converters.cpp.

template<class Num_T>
cvec to_cvec ( const Vec< T > &  v  )  [related, inherited]

Converts a Vec<T> to cvec.

Definition at line 86 of file converters.cpp.

template<class Num_T>
cvec to_cvec ( const Vec< T > &  real,
const Vec< T > &  imag 
) [related, inherited]

Converts real and imaginary Vec<T> to cvec.

Definition at line 214 of file converters.cpp.

template<class Num_T>
ivec to_ivec ( int  s  )  [related, inherited]

Converts an int to ivec.

Definition at line 109 of file converters.cpp.

template<class Num_T>
vec to_vec ( double  s  )  [related, inherited]

Converts an double to vec.

Definition at line 111 of file converters.cpp.

template<class Num_T>
cvec to_cvec ( double  real,
double  imag 
) [related, inherited]

Converts real and imaginary double to cvec.

Definition at line 113 of file converters.cpp.

template<class Num_T>
bmat to_bmat ( const Mat< T > &  m  )  [related, inherited]

Converts a Mat<T> to bmat.

Definition at line 120 of file converters.cpp.

template<class Num_T>
smat to_smat ( const Mat< T > &  m  )  [related, inherited]

Converts a Mat<T> to smat.

Definition at line 135 of file converters.cpp.

template<class Num_T>
imat to_imat ( const Mat< T > &  m  )  [related, inherited]

Converts a Mat<T> to imat.

Definition at line 150 of file converters.cpp.

template<class Num_T>
mat to_mat ( const Mat< T > &  m  )  [related, inherited]

Converts a Mat<T> to mat.

Definition at line 165 of file converters.cpp.

template<class Num_T>
cmat to_cmat ( const Mat< T > &  m  )  [related, inherited]

Converts a Mat<T> to cmat.

Definition at line 180 of file converters.cpp.

template<class Num_T>
cmat to_cmat ( const Mat< T > &  real,
const Mat< T > &  imag 
) [related, inherited]

Converts real and imaginary Mat<T> to cmat.

Definition at line 226 of file converters.cpp.

SourceForge Logo

Generated on Sat Aug 25 23:37:29 2007 for IT++ by Doxygen 1.5.2