public static FMatrixRMaj checkZeros(FMatrixRMaj A, int numRows, int numCols) { if (A == null) { return(new FMatrixRMaj(numRows, numCols)); } else if (numRows != A.numRows || numCols != A.numCols) { throw new ArgumentException("Input is not " + numRows + " x " + numCols + " matrix"); } else { A.zero(); } return(A); }
private void solveEigenvectorDuplicateEigenvalue(float real, int first, bool isTriangle) { float scale = Math.Abs(real); if (scale == 0) { scale = 1; } eigenvectorTemp.reshape(N, 1, false); eigenvectorTemp.zero(); if (first > 0) { if (isTriangle) { solveUsingTriangle(real, first, eigenvectorTemp); } else { solveWithLU(real, first, eigenvectorTemp); } } eigenvectorTemp.reshape(N, 1, false); for (int i = first; i < N; i++) { Complex_F32 c = _implicit.eigenvalues[N - i - 1]; if (c.isReal() && Math.Abs(c.real - real) / scale < 100.0f * UtilEjml.F_EPS) { eigenvectorTemp.data[i] = 1; FMatrixRMaj v = new FMatrixRMaj(N, 1); CommonOps_FDRM.multTransA(Q, eigenvectorTemp, v); eigenvectors[N - i - 1] = v; NormOps_FDRM.normalizeF(v); eigenvectorTemp.data[i] = 0; } } }