Name

inverse - return the inverse matrix of a matrix

Synopsis

float4x4 inverse(float4x4 A)
float3x3 inverse(float3x3 A)
float2x2 inverse(float2x2 A)

Parameters

A
Matrix to invert.

Description

Returns the inverse of the matrix A.

Reference Implementation

inverse for a float2x2 matrix can be implemented like this:

float2x2 inverse(float2x2 A)
{
  float2x2 C;

  float det = determinant(A);
  C[0] = A._m11;
  C[1] = -A._m01;
  C[2] = -A._m10;
  C[3] = A._m00;

  return C / det;
}

Profile Support

inverse is supported in all profiles except fp20, vs_1_1, ps_1_1, ps_1_2 and ps_1_3.

See Also

determinant