コード例 #1
0
        private bool extractSeparate(int numCols)
        {
            if (!computeEigenValues())
            {
                return(false);
            }

            // ---- set up the helper to decompose the same tridiagonal matrix
            // swap arrays instead of copying them to make it slightly faster
            helper.reset(numCols);
            diagSaved = helper.swapDiag(diagSaved);
            offSaved  = helper.swapOff(offSaved);

            // extract the orthogonal from the similar transform
            V = decomp.getQ(V, true);

            // tell eigenvector algorithm to update this matrix as it computes the rotators
            vector.setQ(V);

            // extract eigenvectors
            if (!vector.process(-1, null, null, values))
            {
                return(false);
            }

            // the ordering of the eigenvalues might have changed
            values = helper.copyEigenvalues(values);
            // the V matrix contains the eigenvectors.  Convert those into column vectors
            eigenvectors = CommonOps_DDRM.rowsToVector(V, eigenvectors);

            return(true);
        }
コード例 #2
0
        private bool extractTogether()
        {
            // extract the orthogonal from the similar transform
            V = decomp.getQ(V, true);

            // tell eigenvector algorithm to update this matrix as it computes the rotators
            helper.setQ(V);

            vector.setFastEigenvalues(false);

            // extract the eigenvalues
            if (!vector.process(-1, null, null))
            {
                return(false);
            }

            // the V matrix contains the eigenvectors.  Convert those into column vectors
            eigenvectors = CommonOps_DDRM.rowsToVector(V, eigenvectors);

            // save a copy of them since this data structure will be recycled next
            values = helper.copyEigenvalues(values);

            return(true);
        }