This file is indexed.

/usr/include/mia-2.4/mia/core/fastica.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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
/* -*- 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_hh
#define mia_core_fastica_hh

#include <memory>
#include <mia/core/gsl_matrix.hh>
#include <mia/core/fastica_nonlinearity.hh>

namespace mia {

/**
   This class implements the FastICA blind source separation

   As additional feature the saddle-check [1] can be run to
   improve the obtained results.
   
   [1] Petr Tichavský, Zbynek Koldovský, and Erkki Oja
   "Performance Analysis of the FastICA Algorithm and Cramér–Rao "
   "Bounds for Linear Independent Component Analysis"
   IEEE Tran Signal Processing, 54(4), 2006, 1189-1203  

 */

class EXPORT_CORE FastICA {
public: 

	/**
	   Separation approach to be used.  
	 */
	enum EApproach {
		appr_defl, /**< Deflation approach - each component is extimated separately */ 
		appr_symm  /**< Symmetric approach thet estimates all components at the same time */
	}; 


	/**
	   Construct the FastICA algorithms with the number of expected components. 
	   \param num_ic will seperate in at most this number of components 
	*/
	FastICA(int num_ic);

	/**
	   Separate the given signal 
	   \param mix the mixed signal, each row contains a time step 
	   \returns true if the method converged 
	*/
	bool separate(const gsl::Matrix&  mix); 

	/**
	   Set the separation approach to be used. 
	   \param apr appr_delf|appr_symm 
	*/
	void set_approach(EApproach apr); 
	
	/**
	   Set the limit of the energy sum used to estimate the number of 
	   components that make sense based on the PCA 
	   \param limit energy limit, set >= 1.0 if you want to enforce the number 
	*/
	void set_component_energy_limit(double limit); 
	
	/**
	   Set the number of components to be estimated 
	   \param nrIC (maximum) number of components to be estimated 
	   
	 */
	void set_nr_of_independent_components (int nrIC); 
	
	/**
	   Set the non-linearity to be used for separation 
	 */
	void set_nonlinearity (PFastICADeflNonlinearity in_g); 
	
	/**
	   Set if fine tuning is to be applied 
	 */ 
	void set_finetune (bool in_finetune); 
		
	/**
	   Set parameter \a mu to run the iteration 
	 */ 
 	void set_mu (double mu); 
	
	/**
	   Iteration breaking condition, i.e. maximum change in mixing vector 
	*/ 
 	void set_epsilon (double epsilon); 

	/**
	   Sample size to be used (not yet implemented) 
	 */
 	void set_sample_size (double sampleSize);

	/**
	   Set if stablilization is to be used. 
	*/
 	void set_stabilization (bool in_stabilization);

	/**
	   Set maximum number of iteration to run
	 */
 	void set_max_num_iterations (int maxNumIterations);

	/**
	   Set number of additional fine-tune iterations that might be run 
	*/ 
 	void set_max_fine_tune (int maxFineTune);

	/**
	   Run only PCA (Why is this here, PCA is a aseparate class?) 
	 */
	void set_pca_only (bool in_PCAonly);
 
	/**
	   Set an initial guess (not yet used) 
	 */
	void set_init_guess (const gsl::Matrix&  ma_initGuess);
	
	/**
	   Use the saddle check in the symetric method
	*/
	void set_saddle_check(bool saddle_check); 

	/**
	   Number of iterations after a sucessful saddle check 
	*/
	void set_saddle_check_postiterations(int saddle_postiter); 

	/// \returns number of estimated independedn components 
	int  get_nr_of_independent_components () const;
	
	
	const gsl::Matrix& 	get_mixing_matrix () const;

	const gsl::Matrix& 	get_separating_matrix () const;

	const gsl::Matrix&	get_independent_components () const;



	const gsl::Matrix&	get_whitening_matrix () const;

	const gsl::Matrix&	get_dewhitening_matrix () const;
	
	const gsl::Matrix&	get_principal_eigenvectors () const; 
	
	const gsl::Matrix&	get_white_signal () const;
	
private:
	// evaluate the whitening and de-whitening matrices 
	void evaluate_whiten_matrix(const gsl::Matrix& evec, const gsl::Vector& eval); 
    bool fpica_defl_round(int component, gsl::Vector& w, gsl::Matrix& B);
	bool fpica_defl(const gsl::Matrix& X, gsl::Matrix& B); 
	double fpica_symm_step(gsl::Matrix& B, gsl::Matrix& B_old, double mu, gsl::Matrix& Workspace); 
	bool fpica_symm(const gsl::Matrix& X, gsl::Matrix& B); 
	bool run_saddlecheck(gsl::Matrix &B, const gsl::Matrix& X); 

	EApproach m_approach; 
	
	int m_numOfIC; 
	
	PFastICADeflNonlinearity m_nonlinearity; 
	
	bool m_finetune; 
	
	double m_mu; 
	
 	double m_epsilon; 
	
 	double m_sampleSize;
	
 	bool m_stabilization;
	
 	int m_maxNumIterations;
	
 	int m_maxFineTune;
	
 	int m_firstEig;
	
	int m_lastEig;
	
	bool m_PCAonly;

	double m_component_energy_limit; 
	
	bool m_with_initial_guess; 

	bool m_do_saddle_check; 

	int m_saddle_postiter; 
		
	gsl::Matrix m_initGuess;
	
	gsl::Matrix m_mixing_matrix;
	
	gsl::Matrix m_separating_matrix;
	
	gsl::Matrix	m_independent_components;
	
	gsl::Matrix	m_whitening_matrix;
	
	gsl::Matrix	m_dewhitening_matrix;

    gsl::Matrix	m_principal_eigenvectors;

    gsl::Matrix	m_white_sig;
	
};

}

#endif