Class Equation

    • Field Detail

      • index

        public final int index
        The row index of the original body matrix, [A].
      • myBody

        private final BasicArray<?> myBody
        The (nonzero) elements of this equation/row
      • myPivot

        private double myPivot
      • myRHS

        private double myRHS
    • Constructor Detail

      • Equation

        Equation​(BasicArray<?> body,
                 int pivot,
                 double rhs)
    • Method Detail

      • dense

        public static Equation dense​(int pivot,
                                     int cols)
      • dense

        public static <N extends java.lang.Comparable<N>> Equation dense​(int pivot,
                                                                         int cols,
                                                                         DenseArray.Factory<N> factory)
      • denseSystem

        public static java.util.List<Equation> denseSystem​(int rows,
                                                           int cols)
      • denseSystem

        public static <N extends java.lang.Comparable<N>> java.util.List<Equation> denseSystem​(int rows,
                                                                                               int cols,
                                                                                               DenseArray.Factory<N> factory)
      • of

        public static Equation of​(double rhs,
                                  int pivot,
                                  double... body)
      • sparse

        public static Equation sparse​(int pivot,
                                      int cols)
      • sparse

        public static <N extends java.lang.Comparable<N>> Equation sparse​(int pivot,
                                                                          int cols,
                                                                          DenseArray.Factory<N> factory)
      • sparse

        public static <N extends java.lang.Comparable<N>> Equation sparse​(int pivot,
                                                                          int cols,
                                                                          DenseArray.Factory<N> factory,
                                                                          int numberOfNonzeros)
      • sparse

        public static Equation sparse​(int pivot,
                                      int cols,
                                      int numberOfNonzeros)
      • sparseSystem

        public static java.util.List<Equation> sparseSystem​(int rows,
                                                            int cols)
      • sparseSystem

        public static <N extends java.lang.Comparable<N>> java.util.List<Equation> sparseSystem​(int rows,
                                                                                                int cols,
                                                                                                DenseArray.Factory<N> factory)
      • sparseSystem

        public static <N extends java.lang.Comparable<N>> java.util.List<Equation> sparseSystem​(int rows,
                                                                                                int cols,
                                                                                                DenseArray.Factory<N> factory,
                                                                                                int numberOfNonzeros)
      • sparseSystem

        public static java.util.List<Equation> sparseSystem​(int rows,
                                                            int cols,
                                                            int numberOfNonzeros)
      • add

        public void add​(long ind,
                        java.lang.Comparable<?> addend)
        Specified by:
        add in interface Mutate1D.Modifiable<java.lang.Double>
      • add

        public void add​(long ind,
                        double addend)
        Specified by:
        add in interface Mutate1D.Modifiable<java.lang.Double>
      • adjust

        public <T extends Access1D<java.lang.Double> & Mutate1D.Modifiable<java.lang.Double>> double adjust​(T x,
                                                                                                            double relaxation)
        Will perform a (relaxed) GaussSeidel update.
        Parameters:
        x - The current solution (one element will be updated)
        relaxation - Typically 1.0 but could be anything (Most likely should be between 0.0 and 2.0).
        Returns:
        The error in this equation
      • compareTo

        public int compareTo​(Equation other)
        Specified by:
        compareTo in interface java.lang.Comparable<Equation>
      • count

        public long count()
        Description copied from interface: Structure1D
        The total number of elements in this structure.

        You only need to implement this method if the structure can contain more than Integer.MAX_VALUE elements.

        Specified by:
        count in interface Structure1D
      • dot

        public double dot​(Access1D<?> vector)
        Description copied from interface: Access1D
        Will calculate and return the dot product of this 1D-structure and another input 1D-vector.
        Specified by:
        dot in interface Access1D<java.lang.Double>
        Parameters:
        vector - Another 1D-structure
        Returns:
        The dot product
      • doubleValue

        public double doubleValue​(int ind)
        Specified by:
        doubleValue in interface Access1D<java.lang.Double>
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • get

        public java.lang.Double get​(long ind)
        Specified by:
        get in interface Access1D<java.lang.Double>
      • getCoefficients

        public double[] getCoefficients()
      • getPivot

        public double getPivot()
        Returns:
        The element at index
      • getRHS

        public double getRHS()
        Returns:
        The equation RHS
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • set

        public void set​(long ind,
                        java.lang.Comparable<?> value)
      • set

        public void set​(long ind,
                        double value)
      • setRHS

        public void setRHS​(double rhs)
      • size

        public int size()
        Description copied from interface: Structure1D
        The total number of elements in this structure.
        Specified by:
        size in interface Structure1D
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • calculate

        private <T extends Access1D<java.lang.Double> & Mutate1D.Modifiable<java.lang.Double>> double calculate​(T x,
                                                                                                                double rhs,
                                                                                                                double relaxation)