Exemple #1
0
        /// <summary>
        /// Convert index pairing to Sorted 1 to 1 pairing.
        /// </summary>
        /// <param name="i_sourceMapping"></param>
        /// <param name="i_targetMapping"></param>
        /// <param name="i_matches"></param>
        /// <returns></returns>
        private Pair <DoubleMatrix, DoubleMatrix> buildMappingByIndex(Point[] i_sourceMapping, Point[] i_targetMapping, int[] i_matches)
        {
            Pair <DoubleMatrix, DoubleMatrix> retMapping = new Pair <DoubleMatrix, DoubleMatrix>();

            retMapping.Element1 = LiniarAlgebraFunctions.PointArrayToMatrix(i_sourceMapping, sr_NoMapping);
            retMapping.Element2 = LiniarAlgebraFunctions.PointArrayToMatrix(i_targetMapping, i_matches);
            return(retMapping);
        }
        /// <summary>
        /// Calculating a PCA transformation based on point set that given as DoubleMatrix in the c'tor
        /// </summary>
        /// <returns>An M x M matrix representing the main axises of the data deviation</returns>
        public DoubleMatrix Calculate()
        {
            m_DimsAvg        = new DoubleMatrix(m_PointsMatrix.SumRows() / m_PointsMatrix.ColumnsCount);
            m_CenteredPoints = new DoubleMatrix(m_PointsMatrix);
            Utils.SubstractScalarsByDims(ref m_CenteredPoints, m_DimsAvg);
            DoubleMatrix covMatrix = new DoubleMatrix(LiniarAlgebraFunctions.Covarience <double>(m_CenteredPoints));

            m_EigenVectors = LiniarAlgebraFunctions.EigenMatrix(covMatrix, out m_EigenValues);
            return(m_EigenVectors);
        }