theplu::yat::utility Namespace Reference

Miscellaneous functionality. More...


Classes

class  ColumnStream
class  CommandLine
 Class for parsing the command line. More...
class  Container2DIterator
 Iterator for a Container2D. More...
class  DataIterator
 DataIterator. More...
class  DataWeight
 Holds a pair of data and associated weight. More...
class  DataWeightProxy
 Proxy class for DataWeight. More...
class  cmd_error
 Class used for error reported from Commandline or Option. More...
class  GSL_error
 Class for errors reported from underlying GSL calls. More...
class  IO_error
 Class to report errors associated with IO operations. More...
class  FileUtil
 Checking file/directory existence and access permissions. More...
class  Index
 Class for storing indices of, e.g., a MatrixLookup. More...
struct  unweighted_iterator_tag
struct  weighted_iterator_tag
struct  weighted_iterator_traits
struct  weighted_if_any2
struct  weighted_if_any3
struct  iterator_traits
class  kNNI
 kNNimpute More...
class  Matrix
 Interface to GSL matrix. More...
class  MatrixWeighted
 Weighted Matrix. More...
class  NNI
 Interface class for nearest neighbour imputation (NNI) algorithms. More...
class  Option
 Container of variables for an option. More...
class  OptionArg
 Option with argument. More...
class  OptionFile
 Class for file related options. More...
class  OptionHelp
 Class for help option. More...
class  OptionInFile
 Class for file related options. More...
class  OptionOutFile
 Class for file related options. More...
class  OptionSwitch
 Class for switch option. More...
class  PCA
 Principal Component Analysis. More...
class  Range
 A class for storing a shallow copy of a Range. More...
class  SmartPtr
struct  abs
class  compose_f_gx_hy
struct  Exp
class  Log
struct  pair_value_compare
 Functor comparing pairs using second. More...
struct  PairFirst
 Functor that return std::pair.first. More...
struct  PairSecond
 Functor that return std::pair.second. More...
struct  theplu::yat::utility::weighted_iterator_traits< StrideIterator< Iter > >
struct  theplu::yat::utility::iterator_traits< StrideIterator< Iter > >
class  StrideIterator
 Adaptor using a stride on underlying iterator. More...
class  SVD
 Singular Value Decomposition. More...
class  TypeInfo
 Wrapper class for storing std::type_info. More...
class  Vector
 This is the yat interface to GSL vector. More...
class  VectorBase
 This is the yat interface to GSL vector. More...
class  VectorConstView
 Read-only view. More...
class  VectorMutable
 This is the mutable interface to GSL vector. More...
class  VectorView
 This is the yat interface to gsl_vector_view. More...
class  WeightedIterator
 WeightedIterator. More...
struct  theplu::yat::utility::weighted_iterator_traits< WeightedIterator< DataIterator, WeightIterator > >
struct  theplu::yat::utility::iterator_traits< WeightedIterator< DataIterator, WeightIterator > >
class  WeightIterator
 WeightIterator. More...
class  WeNNI
 Weighted Nearest Neighbour Imputation. More...

Functions

double NeedlemanWunsch (const utility::Matrix &s, std::vector< std::pair< size_t, size_t > > &path, const double gap)
double SmithWaterman (const utility::Matrix &s, double gap, double open_gap)
 Local alignment following the Smith-Waterman algorithm.
double ssearch (std::string first, std::string second, double gap, double open_gap)
template<typename T>
ColumnStreamoperator<< (ColumnStream &s, const T &rhs)
 ColumnStream output operator.
std::ostream & operator<< (std::ostream &, const CommandLine &)
 CommandLine output operator.
template<typename Base>
DataIterator< Base > data_iterator (Base base)
 convenient function to create DataIterator
bool operator== (const DataWeight &lhs, const DataWeight &rhs)
 equality operator
bool operator!= (const DataWeight &, const DataWeight &)
 inequality operator
bool operator< (const DataWeight &, const DataWeight &)
 comparison operator
bool operator> (const DataWeight &, const DataWeight &)
 comparison operator
bool operator<= (const DataWeight &, const DataWeight &)
 comparison operator
bool operator>= (const DataWeight &, const DataWeight &)
 comparison operator
template<typename DataIterator, typename WeightIterator>
bool operator== (const DataWeightProxy< DataIterator, WeightIterator > &lhs, const DataWeightProxy< DataIterator, WeightIterator > &rhs)
 equality operator
template<class Iter>
void check_iterator_is_unweighted (Iter iter)
 check (at compile time) that iterator is unweighted.
bool isnull (const Matrix &)
 Check if all elements of the Matrix are zero.
double max (const Matrix &)
 Get the maximum value of the Matrix.
double min (const Matrix &)
 Get the minimum value of the Matrix.
void minmax_index (const Matrix &, std::pair< size_t, size_t > &min, std::pair< size_t, size_t > &max)
 Locate the maximum and minimum element in the Matrix.
bool nan (const Matrix &templat, Matrix &flag)
 Create a Matrix flag indicating NaN's in another Matrix templat.
void swap (Matrix &, Matrix &)
 Exchange all elements between the matrices by copying.
std::ostream & operator<< (std::ostream &s, const Matrix &)
 The output operator for the Matrix class.
Vector operator* (const Matrix &, const VectorBase &)
 Vector Matrix multiplication.
Vector operator* (const VectorBase &, const Matrix &)
 Matrix Vector multiplication.
void swap (MatrixWeighted &, MatrixWeighted &)
 Exchange all elements.
template<typename T1, typename T2>
bool operator== (const Range< T1 > &, const Range< T2 > &)
 Equality comparison.
template<typename T1, typename T2>
bool operator!= (const Range< T1 > &, const Range< T2 > &)
 Based on operator==.
template<typename T1, typename T2>
bool operator< (const Range< T1 > &lhs, const Range< T2 > &rhs)
 Ordering relation.
template<typename T1, typename T2>
bool operator<= (const Range< T1 > &lhs, const Range< T2 > &rhs)
template<typename T1, typename T2>
bool operator> (const Range< T1 > &, const Range< T2 > &)
template<typename T1, typename T2>
bool operator>= (const Range< T1 > &, const Range< T2 > &)
template<typename ForwardIterator>
void sort_index (ForwardIterator first, ForwardIterator last, std::vector< size_t > &sort_index)
void sort_index (StrideIterator< double * > first, StrideIterator< double * > last, std::vector< size_t > &sort_index)
void sort_index (StrideIterator< const double * > first, StrideIterator< const double * > last, std::vector< size_t > &sort_index)
void sort_index (std::vector< double >::iterator first, std::vector< double >::iterator last, std::vector< size_t > &sort_index)
void sort_index (std::vector< double >::const_iterator first, std::vector< double >::const_iterator last, std::vector< size_t > &sort_index)
template<class F, class G, class H>
compose_f_gx_hy< F, G, H > make_compose_f_gx_hy (F f, G g, H h)
template<typename InputIterator, typename Key>
void inverse (InputIterator first, InputIterator last, std::map< Key, std::vector< size_t > > &m)
template<typename Key, typename InputIterator>
void inverse (InputIterator first, InputIterator last, std::multimap< Key, size_t > &m)
template<typename T>
max (const T &a, const T &b, const T &c)
template<typename T>
max (const T &a, const T &b, const T &c, const T &d)
template<typename T>
max (const T &a, const T &b, const T &c, const T &d, const T &e)
template<typename T>
max (const T &a, const T &b, const T &c, const T &d, const T &e, const T &f)
template<class Iter>
boost::transform_iterator
< PairFirst< typename
std::iterator_traits< Iter >
::value_type >, Iter > 
pair_first_iterator (Iter i)
template<class Iter>
boost::transform_iterator
< PairSecond< typename
std::iterator_traits< Iter >
::value_type >, Iter > 
pair_second_iterator (Iter i)
std::string & to_lower (std::string &s)
 Function converting a string to lower case.
std::string & to_upper (std::string &s)
 Function converting a string to upper case.
bool operator== (const TypeInfo &, const TypeInfo &)
 Equality comparison.
bool operator!= (const TypeInfo &, const TypeInfo &)
 Based on operator==.
bool operator< (const TypeInfo &lhs, const TypeInfo &rhs)
 Ordering relation.
bool operator<= (const TypeInfo &, const TypeInfo &)
 Based on operators == and <.
bool operator> (const TypeInfo &, const TypeInfo &)
 Based on operator <.
bool operator>= (const TypeInfo &, const TypeInfo &)
 Based on operator <=.
template<typename InputIterator, typename OutputIterator>
bool binary_weight (InputIterator first, InputIterator last, OutputIterator result)
template<typename T>
convert (const std::string &s)
 convert string to (numerical) type
template<typename T>
bool is (const std::string &s)
 check if string is convertible to (numerical) type
bool is_double (const std::string &) YAT_DEPRECATE
bool is_equal (std::string s, std::string other)
bool is_float (const std::string &) YAT_DEPRECATE
bool is_int (const std::string &) YAT_DEPRECATE
bool is_nan (const std::string &s)
void swap (Vector &, Vector &)
 Swap Vector elements by copying.
bool isnull (const VectorBase &)
 Check if all elements of the VectorBase are zero.
double max (const VectorBase &)
 Get the maximum value of the VectorBase.
size_t max_index (const VectorBase &)
 Locate the maximum value in the VectorBase.
double min (const VectorBase &)
 Get the minimum value of the VectorBase.
size_t min_index (const VectorBase &)
 Locate the minimum value in the VectorBase.
bool nan (const VectorBase &templat, Vector &flag)
 Create a VectorBase flag indicating NaN's in another VectorBase templat.
void sort_index (std::vector< size_t > &sort_index, const VectorBase &invec)
void sort_smallest_index (std::vector< size_t > &sort_index, size_t k, const VectorBase &invec)
void sort_largest_index (std::vector< size_t > &sort_index, size_t k, const VectorBase &invec)
double sum (const VectorBase &)
 Calculate the sum of all VectorBase elements.
std::ostream & operator<< (std::ostream &s, const VectorBase &v)
 The output operator for the VectorBase class.
void shuffle (VectorMutable &invec)
void sort (VectorMutable &vec)
unsigned int major_version (void)
unsigned int minor_version (void)
unsigned int patch_version (void)
std::string version (void)
template<typename DataIterator, typename WeightIterator>
WeightedIterator< DataIterator,
WeightIterator
weighted_iterator (DataIterator data, WeightIterator weight)
 convenient function to create WeightedIterator
template<typename Base>
WeightIterator< Base > weight_iterator (Base base)
 convenient function to create WeightIterator
template<class X>
void yat_assert (bool assertion, std::string msg="")
 yat_assert is similar to assert in std.


Detailed Description

Miscellaneous functionality.

Needed yat functionality that we don't know where to put usually ends up in the utility namespace until we figure out their proper namespace location.


Function Documentation

template<typename InputIterator, typename OutputIterator>
bool theplu::yat::utility::binary_weight ( InputIterator  first,
InputIterator  last,
OutputIterator  result 
) [inline]

For each element in resulting range assign it to 0.0 if corresponding element in input range is NaN else assign it to 1.0.

Returns:
true if there is at least one NaN in input range [first, last).
Since:
New in yat 0.5

template<class Iter>
void theplu::yat::utility::check_iterator_is_unweighted ( Iter  iter  )  [inline]

check (at compile time) that iterator is unweighted.

This function only compiles if iterator iter is unweighted.

template<typename T>
T theplu::yat::utility::convert ( const std::string &  s  )  [inline]

convert string to (numerical) type

Exceptions:
runtime_error if conversion fails

template<typename Base>
DataIterator<Base> theplu::yat::utility::data_iterator ( Base  base  )  [inline]

convenient function to create DataIterator

Convenient function in same fashion as std::make_pair.

template<typename Key, typename InputIterator>
void theplu::yat::utility::inverse ( InputIterator  first,
InputIterator  last,
std::multimap< Key, size_t > &  m 
) [inline]

In the created multimap each element e will fulfill: $ *(first + e->second) == e->first $

Requirement: InputIterator's value type is assignable to Key

Since:
New in yat 0.5

template<typename InputIterator, typename Key>
void theplu::yat::utility::inverse ( InputIterator  first,
InputIterator  last,
std::map< Key, std::vector< size_t > > &  m 
) [inline]

Creating a map from a range [first, last) such that m[key] returns a vector with indices of which element in [first, last) that is equal to key, or more technically: m[element].size() returns number of elements equal to element, and m[*element][i] = distance(first, element) for every element in [first, last) and i smaller than m[element].size().

Requirement: InputIterator's value type is assignable to Key

Since:
New in yat 0.5

template<typename T>
bool theplu::yat::utility::is ( const std::string &  s  )  [inline]

check if string is convertible to (numerical) type

Since:
New in yat 0.5

bool theplu::yat::utility::is_double ( const std::string &   ) 

Returns:
true if string is a double
Deprecated:
Provided for backward compatibility with the 0.4 API. Use is<double>(const std::string&)

bool theplu::yat::utility::is_equal ( std::string  s,
std::string  other 
)

Returns:
true if string s fulfills regular expression
		 ^\w* 
other
\w*$ 
(case insensitive)

bool theplu::yat::utility::is_float ( const std::string &   ) 

Returns:
true if string is a float
Deprecated:
Provided for backward compatibility with the 0.4 API. Use is<float>(const std::string&)

bool theplu::yat::utility::is_int ( const std::string &   ) 

Returns:
true if string is an int
Deprecated:
Provided for backward compatibility with the 0.4 API. Use is<int>(const std::string&)

bool theplu::yat::utility::is_nan ( const std::string &  s  ) 

Returns:
true if string is "nan" (case-insensitive)

bool theplu::yat::utility::isnull ( const VectorBase &   ) 

Check if all elements of the VectorBase are zero.

Returns:
True if all elements in the VectorBase is zero, false othwerwise.

bool theplu::yat::utility::isnull ( const Matrix &   ) 

Check if all elements of the Matrix are zero.

Returns:
True if all elements in the Matrix is zero, false otherwise.

unsigned int theplu::yat::utility::major_version ( void   ) 

Returns:
major version number of compiled yat library
Since:
New in yat 0.5

template<class F, class G, class H>
compose_f_gx_hy<F, G, H> theplu::yat::utility::make_compose_f_gx_hy ( f,
g,
h 
) [inline]

Convenient function to create a compose_f_gx_hy.

See also:
std::make_pair

double theplu::yat::utility::max ( const VectorBase &   ) 

Get the maximum value of the VectorBase.

Returns:
The maximum value of the VectorBase.

template<typename T>
T theplu::yat::utility::max ( const T &  a,
const T &  b,
const T &  c,
const T &  d,
const T &  e,
const T &  f 
) [inline]

Returns:
max of values

template<typename T>
T theplu::yat::utility::max ( const T &  a,
const T &  b,
const T &  c,
const T &  d,
const T &  e 
) [inline]

Returns:
max of values

template<typename T>
T theplu::yat::utility::max ( const T &  a,
const T &  b,
const T &  c,
const T &  d 
) [inline]

Returns:
max of values

template<typename T>
T theplu::yat::utility::max ( const T &  a,
const T &  b,
const T &  c 
) [inline]

Returns:
max of values

double theplu::yat::utility::max ( const Matrix &   ) 

Get the maximum value of the Matrix.

Returns:
The maximum value of the Matrix.

size_t theplu::yat::utility::max_index ( const VectorBase &   ) 

Locate the maximum value in the VectorBase.

Returns:
The index to the maximum value of the VectorBase.
Note:
Lower index has precedence.

double theplu::yat::utility::min ( const VectorBase &   ) 

Get the minimum value of the VectorBase.

Returns:
The minimum value of the VectorBase.

double theplu::yat::utility::min ( const Matrix &   ) 

Get the minimum value of the Matrix.

Returns:
The minimum value of the Matrix.

size_t theplu::yat::utility::min_index ( const VectorBase &   ) 

Locate the minimum value in the VectorBase.

Returns:
The index to the minimum value of the VectorBase.
Note:
Lower index has precedence.

void theplu::yat::utility::minmax_index ( const Matrix &  ,
std::pair< size_t, size_t > &  min,
std::pair< size_t, size_t > &  max 
)

Locate the maximum and minimum element in the Matrix.

Returns:
The indices to the element with the minimum and maximum values of the Matrix, respectively.
Note:
Lower index has precedence (searching in row-major order).

unsigned int theplu::yat::utility::minor_version ( void   ) 

Returns:
minor version number of compiled yat library
Since:
New in yat 0.5

bool theplu::yat::utility::nan ( const VectorBase &  templat,
Vector &  flag 
)

Create a VectorBase flag indicating NaN's in another VectorBase templat.

The flag VectorBase is changed to contain 1's and 0's only. A 1 means that the corresponding element in the templat VectorBase is valid and a zero means that the corresponding element is a NaN.

Note:
Space for vector flag is reallocated to fit the size of VectorBase templat if sizes mismatch.
Returns:
True if the templat VectorBase contains at least one NaN.

bool theplu::yat::utility::nan ( const Matrix &  templat,
Matrix &  flag 
)

Create a Matrix flag indicating NaN's in another Matrix templat.

The flag Matrix is changed to contain 1's and 0's only. A 1 means that the corresponding element in the templat Matrix is valid and a zero means that the corresponding element is a NaN.

Note:
Space for Matrix flag is reallocated to fit the size of Matrix templat if sizes mismatch.
Returns:
True if the templat Matrix contains at least one NaN.

double theplu::yat::utility::NeedlemanWunsch ( const utility::Matrix &  s,
std::vector< std::pair< size_t, size_t > > &  path,
const double  gap 
)

Function performing alignment following the Needleman-Wunch algorithm. The algorithm starts from the dot-matrix, s, where $ s_{ij} $ describes how well element $ i $ in the first sequence match to element $ j $ in the second sequence. A path through this matrix corresponds to an alignment of the two sequences, in which a diagonal step over a matrix element corresponds to a match between the corresponding sequnce elements and a vertical or a horizontal step corresponds to inserting a gap in one of the sequnces. The function maximizes $ \sum s_{ij}-n $ gap, where the first sum goes over all matches and the second term is a penalty term for inserting $ /// n $ gaps. Default is to have the gap cost set to zero. The vector path contains information about which elements that were matched. If the first element in the first sequence was matched to the first element in the second sequence, the last element in path is pair(0,0).

Returns:
the global maximum alignment score.

template<typename T1, typename T2>
bool theplu::yat::utility::operator!= ( const Range< T1 > &  lhs,
const Range< T2 > &  rhs 
) [inline]

Based on operator==.

Since:
New in yat 0.5

bool theplu::yat::utility::operator!= ( const DataWeight &  ,
const DataWeight &   
)

inequality operator

Returns:
true if lhs.data() != rhs.data()

bool theplu::yat::utility::operator< ( const TypeInfo &  lhs,
const TypeInfo &  rhs 
)

Ordering relation.

Returns:
true iff underlying lhs.get()<rhs.get()

template<typename T1, typename T2>
bool theplu::yat::utility::operator< ( const Range< T1 > &  lhs,
const Range< T2 > &  rhs 
) [inline]

Ordering relation.

Using std::lexicographical_compare

Returns:
true if lhs < rhs
Since:
New in yat 0.5

bool theplu::yat::utility::operator< ( const DataWeight &  ,
const DataWeight &   
)

comparison operator

Returns:
true if lhs data is less than rhs data

std::ostream& theplu::yat::utility::operator<< ( std::ostream &  s,
const VectorBase &  v 
)

The output operator for the VectorBase class.

Elements in VectorBase v are sent to ostream s and separated with the fill character of stream s, s.fill(). If you, for example, want to print the VectorBase v with the elements separated by a ':', you do so by:

		 s << setfill(':') << v; 
		 

std::ostream& theplu::yat::utility::operator<< ( std::ostream &  ,
const CommandLine &   
)

CommandLine output operator.

A typical output may look like this

		 Available options are:
		 -h, --help      display this help and exit
		 -v, --verbose   explain what is being done
		 
The output starts with a descriptive line such as "Available options are:" (default) that can be set in constructor. Then follows the options described in the order they were added to Commandline. Each Option is described according to Option::print(void) function.
See also:
OptionHelp

template<typename T>
ColumnStream& theplu::yat::utility::operator<< ( ColumnStream &  s,
const T &  rhs 
) [inline]

ColumnStream output operator.

Requirement: T should have operator operator<<(ostream&, const T&)

template<typename T1, typename T2>
bool theplu::yat::utility::operator<= ( const Range< T1 > &  lhs,
const Range< T2 > &  rhs 
) [inline]

Returns:
! (rhs < lhs )
Since:
New in yat 0.5

bool theplu::yat::utility::operator<= ( const DataWeight &  ,
const DataWeight &   
)

comparison operator

Returns:
true if lhs.data() <= rhs.data()

bool theplu::yat::utility::operator== ( const TypeInfo &  ,
const TypeInfo &   
)

Equality comparison.

Returns:
true iff underlying std::type_info are equal

template<typename T1, typename T2>
bool theplu::yat::utility::operator== ( const Range< T1 > &  lhs,
const Range< T2 > &  rhs 
) [inline]

Equality comparison.

Returns:
true iff underlying elements are equal
Since:
New in yat 0.5

bool theplu::yat::utility::operator== ( const DataWeight &  lhs,
const DataWeight &  rhs 
)

equality operator

Returns:
true if lhs.data() == rhs.data()

template<typename T1, typename T2>
bool theplu::yat::utility::operator> ( const Range< T1 > &  lhs,
const Range< T2 > &  rhs 
) [inline]

Returns:
rhs < lhs
Since:
New in yat 0.5

bool theplu::yat::utility::operator> ( const DataWeight &  ,
const DataWeight &   
)

comparison operator

Returns:
true if lhs data is greater than rhs data

template<typename T1, typename T2>
bool theplu::yat::utility::operator>= ( const Range< T1 > &  lhs,
const Range< T2 > &  rhs 
) [inline]

Returns:
! (lhs < rhs )
Since:
New in yat 0.5

bool theplu::yat::utility::operator>= ( const DataWeight &  ,
const DataWeight &   
)

comparison operator

Returns:
true if lhs.data() >= rhs.data()

template<class Iter>
boost::transform_iterator< PairFirst<typename std::iterator_traits<Iter>::value_type>, Iter> theplu::yat::utility::pair_first_iterator ( Iter  i  )  [inline]

Creates a transform_iterator that transforms an iterator with value type std::pair to an iterator with value type std::pair::first_type. This can be used, for example, to communicate between a std::map and std::vector

     std::map<std::string, int> map;
     ...
     std::vector<std::string> vec;
     vec.resize(map.size());
     std::copy(pair_first_iterator(map.begin()), pair_first_iterator(map.end()),
               vec.begin());

Since:
New in yat 0.5

template<class Iter>
boost::transform_iterator< PairSecond<typename std::iterator_traits<Iter>::value_type>, Iter> theplu::yat::utility::pair_second_iterator ( Iter  i  )  [inline]

Creates a transform_iterator that transforms an iterator with value type std::pair to an iterator with value type std::pair::second_type. This can be used, for example, to communicate between a std::map and std::vector

     std::map<std::string, int> map;
     ...
     std::vector<int> vec(map.size(),0);
     std::copy(vec.begin(), vec.end(), pair_second_iterator(map.begin()));

Since:
New in yat 0.5

unsigned int theplu::yat::utility::patch_version ( void   ) 

Returns:
patch version number of compiled yat library
Since:
New in yat 0.5

void theplu::yat::utility::shuffle ( VectorMutable &  invec  ) 

Randomly shuffles the elements in VectorMutable invec

double theplu::yat::utility::SmithWaterman ( const utility::Matrix &  s,
double  gap,
double  open_gap 
)

Local alignment following the Smith-Waterman algorithm.

The original paper can be found here: http://gel.ym.edu.tw/~chc/AB_papers/03.pdf

Instead of looking at each sequence in its entirety the S-W algorithm compares segment of all possible lengths (LOCAL alignment) and chooses whichever maximises the similarity measure.

Parameters:
s score matrix in which element $(i,j)$ is the score between element $i$ in first sequence vs element $j$ in second sequence.
gap cost for having a gap (insertion or deletion)
open_gap cost for open up a gap in sequence, in other words, for a gap of length $l$ the total cost is $open_gap + l*gap$.

void theplu::yat::utility::sort ( VectorMutable &  vec  ) 

Sort the elements in the VectorMutable vec

NaNs are treated as infinity

void theplu::yat::utility::sort_index ( std::vector< size_t > &  sort_index,
const VectorBase &  invec 
)

Create a vector sort_index containing the indeces of elements in a another VectorBase invec. The elements of sort_index give the index of the VectorBase element which would have been stored in that position if the VectorBase had been sorted in place. The first element of sort_index gives the index of the least element in invec, and the last element of sort_index gives the index of the greatest element in invec . The VectorBase invec is not changed.

void theplu::yat::utility::sort_index ( std::vector< double >::const_iterator  first,
std::vector< double >::const_iterator  last,
std::vector< size_t > &  sort_index 
)

Specialization for std::vector<double>::const_iterator

Since:
New in yat 0.5

void theplu::yat::utility::sort_index ( std::vector< double >::iterator  first,
std::vector< double >::iterator  last,
std::vector< size_t > &  sort_index 
)

Specialization for std::vector<double>::iterator

Since:
New in yat 0.5

void theplu::yat::utility::sort_index ( StrideIterator< const double * >  first,
StrideIterator< const double * >  last,
std::vector< size_t > &  sort_index 
)

Specialization for StrideIterator<const double*>

Since:
New in yat 0.5

void theplu::yat::utility::sort_index ( StrideIterator< double * >  first,
StrideIterator< double * >  last,
std::vector< size_t > &  sort_index 
)

Specialization for StrideIterator<double*>

Since:
New in yat 0.5

template<typename ForwardIterator>
void theplu::yat::utility::sort_index ( ForwardIterator  first,
ForwardIterator  last,
std::vector< size_t > &  sort_index 
) [inline]

Create a vector sort_index containing the indeces of elements in a range [first, last). The elements of sort_index give the index of the range element which would have been stored in that position if the range had been sorted in place. The first element of sort_index gives the index of the least element in the range, and the last element of sort_index gives the index of the greatest element in the range. The function will not affect the range, i.e., ForwardIterator can be read-only.

Since:
New in yat 0.5

void theplu::yat::utility::sort_largest_index ( std::vector< size_t > &  sort_index,
size_t  k,
const VectorBase &  invec 
)

Similar to sort_index but creates a VectorBase with indices to the k largest elements in invec.

void theplu::yat::utility::sort_smallest_index ( std::vector< size_t > &  sort_index,
size_t  k,
const VectorBase &  invec 
)

Similar to sort_index but creates a VectorBase with indices to the k smallest elements in invec.

double theplu::yat::utility::ssearch ( std::string  first,
std::string  second,
double  gap,
double  open_gap 
)

SSearch does a rigorous Smith-Waterman search for similarity between sequnces. For long sequences this may be very expensive (both in time and space) and BLAST or FASTA is preferable.

Returns:
score

double theplu::yat::utility::sum ( const VectorBase &   ) 

Calculate the sum of all VectorBase elements.

Returns:
The sum.

void theplu::yat::utility::swap ( Vector &  ,
Vector &   
)

Swap Vector elements by copying.

The two Vectors must have the same length.

Exceptions:
GSL_error if Vector lengths differs.

void theplu::yat::utility::swap ( MatrixWeighted &  ,
MatrixWeighted &   
)

Exchange all elements.

Takes constant time.

See also:
MatrixWeighted::swap(MatrixWeighted&)

void theplu::yat::utility::swap ( Matrix &  ,
Matrix &   
)

Exchange all elements between the matrices by copying.

The two matrices must have the same size.

Exceptions:
GSL_error if sizes are not equal.

std::string theplu::yat::utility::version ( void   ) 

Returns:
version number of compiled yat library
Since:
New in yat 0.5

template<typename Base>
WeightIterator<Base> theplu::yat::utility::weight_iterator ( Base  base  )  [inline]

convenient function to create WeightIterator

Convenient function in same fashion as std::make_pair.

template<typename DataIterator, typename WeightIterator>
WeightedIterator<DataIterator, WeightIterator> theplu::yat::utility::weighted_iterator ( DataIterator  data,
WeightIterator  weight 
) [inline]

convenient function to create WeightedIterator

Convenient function in same fashion as std::make_pair.

template<class X>
void theplu::yat::utility::yat_assert ( bool  assertion,
std::string  msg = "" 
) [inline]

yat_assert is similar to assert in std.

For internal use only.

If YAT_DEBUG is enabled and assertion is false, and exception X is thrown using constructor X(msg ).


Generated on Tue Jan 18 02:20:11 2011 for yat by  doxygen 1.5.5