metreex-analysis.js
/**
 * * Component of Principal Component Analysis *
 * Sorts eigenvalues and record original vector index so that the top two can be used for projection
 * @param eigenVals
 * @returns {Array}
 */
Component of Principal Component Analysis
Sorts eigenvalues and record original vector index so that the top two can be used for projection
@param eigenVals
@returns {Array}
Component of Principal Component Analysis Sorts eigenvalues and record original vector index so that the top two can be used for projection @param eigenVals @returns { Array }
function sortEigenvals(eigenVals) {
    var eigPairs = [];
    eigenVals.forEach(function(elem, index){
        eigPairs.push({
            val: elem,
            vecIndex: index
        });
    });
    eigPairs.sort(function(a,b){
        return b.val - a.val;
    });
    return eigPairs;
}
function sortEigenvals ( eigenVals ) { var eigPairs = [ ] ; eigenVals . forEach ( function ( elem , index ) { eigPairs . push ( { val : elem , vecIndex : index } ) ; } ) ; eigPairs . sort ( function ( a , b ) { return b . val - a . val ; } ) ; return eigPairs ; }
* Component of Principal Component Analysis
 Sorts eigenvalues and record original vector index so that the top two can be used for projection
 @param eigenVals
 @returns {Array}
* Component of Principal Component Analysis Sorts eigenvalues and record original vector index so that the top two can be used for projection @param eigenVals @returns { Array }