@Override public SimpleMatrix apply(DenseMatrix64F matrix) { return SimpleMatrix.wrap(matrix); } };
/** * Computes the null space from an SVD. For more information see {@link SingularOps#nullSpace}. * @return Null space vector. */ public SimpleMatrix nullSpace() { // TODO take advantage of the singular values being ordered already return SimpleMatrix.wrap(SingularOps.nullSpace(svd,null,UtilEjml.EPS)); }
/** * <p>Converts the block matrix into a SimpleMatrix.</p> * * @param A Block matrix that is being converted. Not modified. * @return Equivalent SimpleMatrix. */ public static SimpleMatrix convertSimple( BlockMatrix64F A ) { DenseMatrix64F B = ConvertMatrixType.convert(A, null); return SimpleMatrix.wrap(B); } }
/** * Computes the null space from an SVD. For more information see {@link SingularOps#nullSpace}. * @return Null space vector. */ public SimpleMatrix nullSpace() { // TODO take advantage of the singular values being ordered already return SimpleMatrix.wrap(SingularOps.nullSpace(svd,null,UtilEjml.EPS)); }
/** * <p> * Used to retrieve real valued eigenvectors. If an eigenvector is associated with a complex eigenvalue * then null is returned instead. * </p> * * @param index Index of the eigenvalue eigenvector pair. * @return If the associated eigenvalue is real then an eigenvector is returned, null otherwise. */ public T getEigenVector( int index ) { return (T)SimpleMatrix.wrap(eig.getEigenVector(index)); }
/** * Computes the null space from an SVD. For more information see {@link SingularOps#nullSpace}. * @return Null space vector. */ public SimpleMatrix nullSpace() { // TODO take advantage of the singular values being ordered already return SimpleMatrix.wrap(SingularOps.nullSpace(svd,null,tol)); }
/** * <p> * Used to retrieve real valued eigenvectors. If an eigenvector is associated with a complex eigenvalue * then null is returned instead. * </p> * * @param index Index of the eigenvalue eigenvector pair. * @return If the associated eigenvalue is real then an eigenvector is returned, null otherwise. */ public T getEigenVector( int index ) { return (T)SimpleMatrix.wrap(eig.getEigenVector(index)); }
/** * <p>Converts the block matrix into a SimpleMatrix.</p> * * @param A Block matrix that is being converted. Not modified. * @return Equivalent SimpleMatrix. */ public static SimpleMatrix convertSimple( BlockMatrix64F A ) { DenseMatrix64F B = convert(A,null); return SimpleMatrix.wrap(B); }
/** * <p> * Used to retrieve real valued eigenvectors. If an eigenvector is associated with a complex eigenvalue * then null is returned instead. * </p> * * @param index Index of the eigenvalue eigenvector pair. * @return If the associated eigenvalue is real then an eigenvector is returned, null otherwise. */ public T getEigenVector( int index ) { return (T)SimpleMatrix.wrap(eig.getEigenVector(index)); }
/** * <p>Converts the block matrix into a SimpleMatrix.</p> * * @param A Block matrix that is being converted. Not modified. * @return Equivalent SimpleMatrix. */ public static SimpleMatrix convertSimple( BlockMatrix64F A ) { DenseMatrix64F B = convert(A,null); return SimpleMatrix.wrap(B); }
public static double quality( DenseMatrix64F orig , DenseMatrix64F U , DenseMatrix64F W , DenseMatrix64F Vt ) { SimpleMatrix _U = SimpleMatrix.wrap(U); SimpleMatrix _W = SimpleMatrix.wrap(W); SimpleMatrix _Vt = SimpleMatrix.wrap(Vt); SimpleMatrix foundA = _U.mult(_W).mult(_Vt); return SpecializedOps.diffNormF(orig,foundA.getMatrix())/foundA.normF(); }
/** * Undoes normalization for a homography matrix. */ protected void undoNormalizationH(DenseMatrix64F M, DenseMatrix64F N1, DenseMatrix64F N2) { SimpleMatrix a = SimpleMatrix.wrap(M); SimpleMatrix b = SimpleMatrix.wrap(N1); SimpleMatrix c = SimpleMatrix.wrap(N2); SimpleMatrix result = c.invert().mult(a).mult(b); M.set(result.getMatrix()); }
public SimpleSVD( DenseMatrix64F mat , boolean compact ) { this.mat = mat; svd = DecompositionFactory.svd(mat.numRows,mat.numCols,true,true,compact); if( !svd.decompose(mat) ) throw new RuntimeException("Decomposition failed"); U = (T)SimpleMatrix.wrap(svd.getU(null,false)); W = (T)SimpleMatrix.wrap(svd.getW(null)); V = (T)SimpleMatrix.wrap(svd.getV(null,false)); // order singular values from largest to smallest SingularOps.descendingOrder(U.getMatrix(),false,W.getMatrix(),V.getMatrix(),false); }
public SimpleSVD( DenseMatrix64F mat , boolean compact ) { this.mat = mat; svd = DecompositionFactory.svd(mat.numRows,mat.numCols,true,true,compact); if( !svd.decompose(mat) ) throw new RuntimeException("Decomposition failed"); U = (T)SimpleMatrix.wrap(svd.getU(null,false)); W = (T)SimpleMatrix.wrap(svd.getW(null)); V = (T)SimpleMatrix.wrap(svd.getV(null,false)); // order singular values from largest to smallest SingularOps.descendingOrder(U.getMatrix(),false,W.getMatrix(),V.getMatrix(),false); }
public SimpleSVD( DenseMatrix64F mat , boolean compact ) { this.mat = mat; svd = DecompositionFactory.svd(mat.numRows,mat.numCols,true,true,compact); if( !svd.decompose(mat) ) throw new RuntimeException("Decomposition failed"); U = (T)SimpleMatrix.wrap(svd.getU(null,false)); W = (T)SimpleMatrix.wrap(svd.getW(null)); V = (T)SimpleMatrix.wrap(svd.getV(null,false)); // order singular values from largest to smallest SingularOps.descendingOrder(U.getMatrix(),false,W.getMatrix(),V.getMatrix(),false); tol = SingularOps.singularThreshold(svd); }
protected double computeKineticEnergy(ArrayList<RevoluteJoint> joints, DenseMatrix64F massMatrix) { SimpleMatrix jointVelocities = new SimpleMatrix(joints.size(), 1); for (int i = 0; i < joints.size(); i++) { jointVelocities.set(i, 0, joints.get(i).getQd()); } SimpleMatrix massMatrix_ = SimpleMatrix.wrap(massMatrix); SimpleMatrix kineticEnergy = jointVelocities.transpose().mult(massMatrix_).mult(jointVelocities); return 0.5 * kineticEnergy.get(0, 0); }
/** * H0 = H*M * P=[M|m] from canonical camera */ private SimpleMatrix computeHZero( DMatrixRMaj F , Point3D_F64 e2 , SimpleMatrix H ) { Vector3D_F64 v = new Vector3D_F64(.1,0.5,.2); // need to make sure M is not singular for this technique to work SimpleMatrix P = SimpleMatrix.wrap(MultiViewOps.fundamentalToProjective(F, e2, v, 1)); SimpleMatrix M = P.extractMatrix(0, 3, 0, 3); return H.mult(M); }
/** * H0 = H*M * P=[M|m] from canonical camera */ private SimpleMatrix computeHZero( DenseMatrix64F F , Point3D_F64 e2 , SimpleMatrix H ) { Vector3D_F64 v = new Vector3D_F64(.1,0.5,.2); // need to make sure M is not singular for this technique to work SimpleMatrix P = SimpleMatrix.wrap(MultiViewOps.canonicalCamera(F, e2, v, 1)); SimpleMatrix M = P.extractMatrix(0, 3, 0, 3); return H.mult(M); }
public void predict(DenseMatrix64F uDense) { // x = F x + G u SimpleMatrix u = SimpleMatrix.wrap(uDense); x = (F.mult(x)).plus((G.mult(u))); // P = F P F' + Q P = F.mult(P).mult(F.transpose()).plus(Q); }
public void predict(DenseMatrix64F uDense) { // x = F x + G u SimpleMatrix u = SimpleMatrix.wrap(uDense); x = (F.mult(x)).plus((G.mult(u))); // P = F P F' + Q P = F.mult(P).mult(F.transpose()).plus(Q); }