Class Matrix

java.lang.Object
org.locationtech.jts.math.Matrix

public class Matrix extends Object
Implements some 2D matrix operations (in particular, solving systems of linear equations).
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static double[]
    solve(double[][] a, double[] b)
    Solves a system of equations using Gaussian Elimination.
    private static void
    swapRows(double[][] m, int i, int j)
     
    private static void
    swapRows(double[] m, int i, int j)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Matrix

      public Matrix()
  • Method Details

    • swapRows

      private static void swapRows(double[][] m, int i, int j)
    • swapRows

      private static void swapRows(double[] m, int i, int j)
    • solve

      public static double[] solve(double[][] a, double[] b)
      Solves a system of equations using Gaussian Elimination. In order to avoid overhead the algorithm runs in-place on A - if A should not be modified the client must supply a copy.
      Parameters:
      a - an nxn matrix in row/column order )modified by this method)
      b - a vector of length n
      Returns:
      a vector containing the solution (if any) or null if the system has no or no unique solution
      Throws:
      IllegalArgumentException - if the matrix is the wrong size