Skip to content

Commit

Permalink
Added doxygen comments to icaseparator.h and nonlnearities.h.
Browse files Browse the repository at this point in the history
  • Loading branch information
Aulos committed Jan 24, 2012
1 parent 88944e6 commit 36b8543
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 2 deletions.
47 changes: 45 additions & 2 deletions include/icaseparator.h
Original file line number Diff line number Diff line change
@@ -1,20 +1,63 @@
/**
* @file
* @author Pawel Zubrycki <[email protected]>
* @author Stanisław Janikowski <[email protected]>
*
* @section DESCRIPTION
*
* Class that provides easy way to count independent components.
**/

#ifndef ICASEPARATOR_H
#define ICASEPARATOR_H

#include <armadillo>

namespace mbica {
/**
* Class that provides easy way to count independent components.
**/
class ICASeparator
{
public:
/**
* Constructor.
*
* @param A Mixing matrix.
* @param W Unmixing matrix.
**/
ICASeparator(arma::mat A, arma::mat W)
: A_(A), W_(W) {A.save("A.mat", arma::arma_ascii); W.save("W.mat", arma::arma_ascii);}
: A_(A), W_(W) {
A.save("A.mat", arma::arma_ascii);
W.save("W.mat", arma::arma_ascii);
}

/**
* Method that unmix given signal.
*
* @param X Matrix with mixed signal.
* @return Matrix with unmixed signal.
**/
arma::mat operator()(arma::mat X) {
return W_ * X;
}

arma::mat operator()(arma::mat X);
/**
* Method that mixes given signals
*
* @param S Matrix to be mixed.
* @return Matrix with mixed data.
*/
arma::mat mixSignals(arma::mat S) {
return A_ * S;
}

/// Getter of mixing matrix.
const arma::mat &getA() const {
return A_;
}

/// Getter of unmixing matrix.
const arma::mat &getW() const {
return W_;
}
Expand Down
42 changes: 42 additions & 0 deletions include/nonlinearities.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
/**
* @file
* @author Pawel Zubrycki <[email protected]>
* @author Stanisław Janikowski <[email protected]>
*
* @section DESCRIPTION
*
* File with preimplemented nonlinearities used in FastICA algorithm.
*
* @note New nonlinearites don't have to inherit from Nonlinearity class.
* They just have to provide G() and dG() methods.
**/

#ifndef NONLINEARITIES_H
#define NONLINEARITIES_H

Expand All @@ -6,19 +19,30 @@
namespace mbica {
namespace nonlinearities {

/**
* Base class for preimplemented nonlinearities.
*/
class Nonlinearity {
public:
/// Method returning value of function.
arma::mat G() { return g_; }
/// Method returning value of derivative of function.
arma::mat dG() { return dg_; }

protected:
/// Protected constructor to prevent from creating Nonlinearity objects.
Nonlinearity(){}

protected:
arma::mat g_;
arma::mat dg_;
};

/**
* Class implementing power function on matrix elements.
*
* @param a Exponent.
**/
template<int a=3>
class Pow: public Nonlinearity{
public:
Expand All @@ -28,6 +52,15 @@ class Pow: public Nonlinearity{
}
};


/**
* Class implementing tanh nonlinearity.
*
* @note Class uses fraction a/b as a parameter.
*
* @param a Numerator of parameter.
* @param b Denominator of parameter.
**/
template<int a=1, int b=1>
class TanH: public Nonlinearity{
public:
Expand All @@ -38,6 +71,14 @@ class TanH: public Nonlinearity{
}
};

/**
* Class implementing gauss nonlinearity.
*
* @note Class uses fraction a/b as a parameter.
*
* @param a Numerator of parameter.
* @param b Denominator of parameter.
**/
template<int a=1, int b=1>
class Gauss: public Nonlinearity{
public:
Expand All @@ -49,6 +90,7 @@ class Gauss: public Nonlinearity{
}
};

/// Typedef to provide compatibility with Octave packet.
typedef Pow<2> Skew;
}
}
Expand Down

0 comments on commit 36b8543

Please sign in to comment.