예제 #1
0
        /**
         * Used internally to find the solution to a single column vector.
         */
        private void solveInternalL()
        {
            // This takes advantage of the diagonal elements always being real numbers

            // solve L*y=b storing y in x
            TriangularSolver_CDRM.solveL_diagReal(t, vv, n);

            // solve L^T*x=y
            TriangularSolver_CDRM.solveConjTranL_diagReal(t, vv, n);
        }
예제 #2
0
 /**
  * Sets the matrix to the inverse using a lower triangular matrix.
  */
 public void setToInverseL(float[] a)
 {
     // the more direct method which takes full advantage of the sparsity of the data structures proved to
     // be difficult to get right due to the conjugates and reordering.
     // See comparable real number code for an example.
     for (int col = 0; col < n; col++)
     {
         //Arrays.fill(vv, 0);
         Array.Clear(vv, 0, vv.Length);
         vv[col * 2] = 1;
         TriangularSolver_CDRM.solveL_diagReal(t, vv, n);
         TriangularSolver_CDRM.solveConjTranL_diagReal(t, vv, n);
         for (int i = 0; i < n; i++)
         {
             a[(i * numCols + col) * 2]     = vv[i * 2];
             a[(i * numCols + col) * 2 + 1] = vv[i * 2 + 1];
         }
     }
     // NOTE: If you want to make inverse faster take advantage of the sparsity
 }