Java Matrix Invert invertSymmetric2x2(final double[][] m, final double[][] inverse)

Here you can find the source of invertSymmetric2x2(final double[][] m, final double[][] inverse)

Description

Inverts a (invertible) symmetric 2x2 matrix.

License

Open Source License

Parameter

Parameter Description
m symmetric matrix to invert.
inverse inverse of m is stored here.

Declaration

public static void invertSymmetric2x2(final double[][] m, final double[][] inverse) 

Method Source Code

//package com.java2s;

public class Main {
    /**/*w  w  w .j  a  v  a  2 s  . c om*/
     * Inverts a (invertible) symmetric 2x2 matrix.
     *
     * @param m
     *            symmetric matrix to invert.
     * @param inverse
     *            inverse of {@code m} is stored here.
     */
    public static void invertSymmetric2x2(final double[][] m, final double[][] inverse) {
        final double Dinv = 1.0 / (m[0][0] * m[1][1] - m[1][0] * m[1][0]);
        inverse[0][0] = m[1][1] * Dinv;
        inverse[1][0] = inverse[0][1] = -m[1][0] * Dinv;
        inverse[1][1] = m[0][0] * Dinv;
    }
}

Related

  1. invertDataSet(double[][] dataSet)
  2. invertMatrix(int[][] matrix)
  3. invertMatrix3x3(float[] result, float[] m)
  4. invertMatrix4x4(double[][] A)
  5. invertRegions(int[][] image)
  6. invertSymmetric3x3(final double[][] m, final double[][] inverse)
  7. invertUpperTriangular(double[][] r)