Here you can find the source of invertSymmetric2x2(final double[][] m, final double[][] inverse)
Parameter | Description |
---|---|
m | symmetric matrix to invert. |
inverse | inverse of m is stored here. |
public static void invertSymmetric2x2(final double[][] m, final double[][] inverse)
//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; } }