/usr/include/mia-2.4/mia/core/fastica_nonlinearity.hh is in libmia-2.4-dev 2.4.3-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | /* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
* Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with MIA; if not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef mia_core_fastica_nonlinearity_hh
#define mia_core_fastica_nonlinearity_hh
#include <mia/core/gsl_vector.hh>
#include <mia/core/gsl_matrix.hh>
#include <mia/core/factory.hh>
namespace mia {
class EXPORT_CORE CFastICANonlinearityBase : public CProductBase {
public:
/// helper typedef for plugin handling
typedef CFastICANonlinearityBase plugin_data;
static const char *data_descr;
CFastICANonlinearityBase();
void set_signal(const gsl::Matrix *signal);
void set_mu(double m);
protected:
double get_sample_scale() const {return m_sample_scale;}
double get_mu() const { return m_mu;};
const gsl::Matrix& get_signal() const;
private:
virtual void post_set_signal() = 0;
double m_mu;
double m_sample_scale;
const gsl::Matrix *m_signal;
};
/**
\brief This is the base clase for non-linearities used in deflation based ICA
This class defines the interface of the nonlinearity g for deflation based FastICA. In order to
implement the a real non-linearity the method get_correction_and_scale must be overwritten.
If the factor \f$\mu\f$ defined in the parent class is \f$\ge 1.0\f$, than the normal implementation
will be used, if the value is positive but \f$\le 1.0\f$ then the stabelized variant of the algorithm
is used.
*/
class EXPORT_CORE CFastICADeflNonlinearity : public CFastICANonlinearityBase {
public:
/// helper typedef for plugin handling
typedef CFastICADeflNonlinearity plugin_type;
static const char *type_descr;
void apply(gsl::Vector& w);
void apply(gsl::Matrix& W);
std::vector<double> get_saddle_test_table(const gsl::Matrix& ics) const;
double get_saddle_test_value(const gsl::Vector& ic) const;
protected:
virtual void post_set_signal();
private:
/**
Key worker function of the class that needs to be overwritten. Given the signal X and the
input vector \a w passed to \a apply the parameters are to interpreted as follows:
\param XTw the vector resulting from the multiplication of $X^T w$. This vector will be overwritten.
\param correction [in,out] a vector of the same size like \a w. On output it must contain the
correction $X g(X^T w)$
*/
virtual double get_correction_and_scale(gsl::Vector& XTw, gsl::Vector& correction) = 0;
/**
This function evaluates the SIR quantity needed for the saddle test
\param ic independet component to evaluate the SIR from
*/
virtual double do_get_saddle_test_value(const gsl::Vector& ic) const = 0;
void sum_final(gsl::Vector& w, double scale);
void sum_final_stabelized(gsl::Vector& w, double scale);
gsl::Vector m_XTw;
gsl::Vector m_workspace;
};
typedef std::shared_ptr<CFastICADeflNonlinearity> PFastICADeflNonlinearity;
EXPORT_CORE PFastICADeflNonlinearity produce_fastica_nonlinearity(const std::string& descr);
typedef TFactory<CFastICADeflNonlinearity> CFastICADeflNonlinearityPlugin;
/**
\ingroup interpol
Plugin handler for the creation of deflation FastICA nonlinearities
*/
typedef THandlerSingleton<TFactoryPluginHandler<CFastICADeflNonlinearityPlugin> > CFastICADeflNonlinearityPluginHandler;
}
#endif
|