Class EliminateLinearConstraints_HomegrownLUFactorization

java.lang.Object
com.polytechnik.utils.EliminateLinearConstraints_HomegrownLUFactorization

public class EliminateLinearConstraints_HomegrownLUFactorization extends Object
Perform simplified version of LU Factorization by checking max pivot at rows and columns. Expand m=conditions.length constraint equations, \( i=0\dots m-1 \) for \(\mathbf{x}\) vector of the dimension n=conditions[i].length=nC*nX. $$ 0=\sum\limits_{j=0}^{n-1} x[j]*\mathrm{conditions}[i][j] $$ to the form $$x[s]=\sum\limits_{j=0}^{n-1} x[j]*\mathrm{expansion}[i_s][j]$$ the \( \mathrm{expansion}[i\leq i_{s}][s]=0 \) thus the \( x[s] \) can be eliminated by consequent application of the expansion starting from the last one. This allows to build a linear expansion $$ x[j]=\sum\limits_{i=0}^{\mathrm{dimXnew}-1} M_{ji} V_i $$ of original \( \mathbf{x} \) of the dimension \(n\) via reduced size \( \mathbf{V} \) of the dimension \( n-\mathrm{rank}(\mathrm{conditions}) \). The method fromXnewToXorigAsMatrix() creates this \( M_{ji} \) matrix.
  • Field Details

    • dimXorig

      public final int dimXorig
      Original problem dimension.
    • nEliminated

      public final int nEliminated
      The number of eliminated variables, equals to the rank of conditions matrix.
    • dimXnew

      public final int dimXnew
      New problem dimension dimXnew=dimXorig-nEliminated.
    • elim

  • Constructor Details

    • EliminateLinearConstraints_HomegrownLUFactorization

      public EliminateLinearConstraints_HomegrownLUFactorization(int dimXorig, double[][] conditions, double condMaxToFail)
      Constructor.
      Parameters:
      dimXorig - Original problem dimension.
      conditions - Linear constraints, a matrix of nEq x dimXorig. Obtained nEliminated is the rank of this matrix.
      condMaxToFail - Minimal value of maximal absolute element to decide the remaining constraints are degenerated and elimintation process should be stopped, 1e-10 is a typical value.
  • Method Details

    • getByIndX

      Not a large size, does not worth a HashMap.
    • fromXorigToXnew

      public double[] fromXorigToXnew(double[] xorig)
      Discard some components.
    • fromXnewToXorig

      public double[] fromXnewToXorig(double[] xnew)
      From new to old, recover previously eliminated components based on linear constraints.
    • fromXnewToXorigAsMatrixT

      public double[] fromXnewToXorigAsMatrixT()
      A transponse of fromXnewToXorigAsMatrix().
    • fromXnewToXorigAsMatrix

      public double[] fromXnewToXorigAsMatrix()
      From new to old, recover components based on linear constraints, the result is presented as a matrix of dimXorig * dimXnew size, Xorig = M Xnew.
    • getConditionsEliminationsOrder

      public double[][] getConditionsEliminationsOrder()
      Original constraints in eliminated form. Instead of 0 = conditions Xorig for original constraints write the same 0 = CE Xorig for constraints using LU-elimintated linear combinations.
    • getOrthogonalized_GramSchmidt

      public static double[][] getOrthogonalized_GramSchmidt(double[][] conditions, double condMaxToFail)
      Orthogonalize constraints with homegrown Gram-Schmidt.
    • getOrthogonalized_EV

      public static double[][] getOrthogonalized_EV(double[][] conditions, double minEVToSelect)
      Orthogonalize constraints with eigenproblem - usual \( G^{-1/2} conditions \) regularization. We used it many time before, now it is applied to convert constraints to orthogonal from.
    • testOne

      static EliminateLinearConstraints_HomegrownLUFactorization testOne(String name, int nX, double[][] eqs, Random r, double eps)
    • getDegeneratedSample

      static double[][] getDegeneratedSample(int nEq, int nX, Random r, double[][] eqs)
    • testBasic

      static void testBasic(int nEq, int nX, Random r, double eps)
    • runMultiTest

      static void runMultiTest(String name, int nTest, Random r, double eps)
    • main

      public static void main(String[] args)
      A unit test.