// ====================================================================
// This file is part of the Endmember Induction Algorithms Toolbox for MATLAB
// Copyright (C) Grupo de Inteligencia Computacional, Universidad del
// País Vasco (UPV/EHU), Spain, released under the terms of the GNU
// General Public License.
//
// Endmember Induction Algorithms Toolbox 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.
//
// Endmember Induction Algorithms Toolbox 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 Endmember Induction Algorithms Toolbox.
// If not, see .
// ====================================================================
function [vd] = EIA_HFC(data,alfa)
//// vd = EIA_HFC(data,alfa)
//
// Manuel Grana
// Miguel Angel Veganzones
// Grupo de Inteligencia Computacional (GIC), Universidad del Pais Vasco /
// Euskal Herriko Unibertsitatea (UPV/EHU)
// http://www.ehu.es/computationalintelligence
//
// Copyright (2011) Grupo de Inteligencia Computacional @ Universidad del Pais Vasco, Spain.
//
// Virtual dimensionality by HFC method
// ------------------------------------------------------------------------------
// Input: data : column data matrix [nvariables x nsamples]
// alfa : vector of %f alarm probabilities [1 x p] (default: [10^(-3) 10^(-4) 10^(-5)])
//
// Output: vd : vector of virtual dimensionality values [1 x p]
//
// Bibliographical references:
// [1] Chang, C.-I. and Du, Q., “Estimation of number of spectrally distinct signal sources in hyperspectral imagery,” Geoscience and Remote Sensing, IEEE Transactions on, vol. 42, 2004, pp. 608-619.
// [2] Wang, J. and Chang, C.-I., “Applications of Independent Component Analysis in Endmember Extraction and Abundance Quantification for Hyperspectral Imagery,” Geoscience and Remote Sensing, IEEE Transactions on, vol. 44, 2006, pp. 2601-2616.
// [3] J. Wang and Chein-I Chang, “Independent component analysis-based dimensionality reduction with applications in hyperspectral image analysis,” Geoscience and Remote Sensing, IEEE Transactions on, vol. 44, 2006, pp. 1586-1600.
//// parameters
[lhs,rhs]=argn(0);
if (lhs < 1)
error('Insufficient parameters');
end
if (lhs < 2)
alfa = [10^(-3) 10^(-4) 10^(-5)];
end
//// data size
[nvariables nsamples] = size(data);
//// Correlation and covariance matrix
//R = corr(data); -> ERROR
R = (data*data')/nsamples; // !!
K = mvvacov(data');
//// Eigenvalues
lcorr = mtlb_sort(spec(R),'r','descend');
lcov = mtlb_sort(spec(K),'r','descend');
//// Differences and variances
differences = lcorr - lcov;
variances = sqrt(2*(lcorr^2 + lcov^2)/nsamples);
//// Hypothesis Test
p = size(alfa,2);
vd = zeros(1,p);
for i=1:p
alfas = ones(nvariables,1)*alfa(i);
tau = -cdfnor("X",zeros(nvariables,1),variances,alfas,1-alfas);
vd(i) = sum(real(differences) > real(tau));
end
endfunction