PCA EEG_to_PCA (EEG me, double startTime, double endTime, const wchar_t *channelRanges, int fromCorrelation) { try { autoCovariance cov = EEG_to_Covariance (me, startTime, endTime, channelRanges); if (fromCorrelation) { autoCorrelation cor = SSCP_to_Correlation (cov.peek()); autoPCA him = SSCP_to_PCA (cor.peek()); return him.transfer(); } else { autoPCA him = SSCP_to_PCA (cov.peek()); return him.transfer(); } } catch (MelderError) { Melder_throw (me, ": no PCA calculated."); } }
autoPCA EEG_to_PCA (EEG me, double startTime, double endTime, const char32 *channelRanges, int fromCorrelation) { try { autoCovariance cov = EEG_to_Covariance (me, startTime, endTime, channelRanges); autoPCA him; if (fromCorrelation) { autoCorrelation cor = SSCP_to_Correlation (cov.get()); him = SSCP_to_PCA (cor.get()); } else { him = SSCP_to_PCA (cov.get()); } return him; } catch (MelderError) { Melder_throw (me, U": no PCA calculated."); } }
autoSound Sound_and_Covariance_whitenChannels (Sound me, Covariance thee, double varianceFraction) { try { autoPCA pca = SSCP_to_PCA (thee); long numberOfComponents = Eigen_getDimensionOfFraction (pca.peek(), varianceFraction); autoSound him = Sound_and_PCA_whitenChannels (me, pca.peek(), numberOfComponents); return him; } catch (MelderError) { Melder_throw (me, U": not whitened from ", thee); } }