Invert a 3x3 matrix in a Metal compute kernel

I searched the Metal Shading Language Specification Version 3.0 document, however I cannot see any function for inverting a matrix. Is there really no function in Metal for inverting a matrix?

I often need to this in linear equations and have so far resorted to writing the necessary function each time, most of the time just copy-and-pasting code.

inverse exists in SIMD and GLSL, so why not in Metal? It seems so unexpected that this function does not exist that I am almost certain I have just overlooked something obvious. I even tried 1 / M, to no avail.

did you find a solution to this, or we should write a custom function?

Thank you

the function if somebody needs it see https://en.wikipedia.org/wiki/Invertible_matrix#Inversion_of_3_%C3%97_3_matrices

static float3x3 inverse(float3x3 const m)
{
    float const A =   m[1][1] * m[2][2] - m[2][1] * m[1][2];
    float const B = -(m[0][1] * m[2][2] - m[2][1] * m[0][2]);
    float const C =   m[0][1] * m[1][2] - m[1][1] * m[0][2];
    float const D = -(m[1][0] * m[2][2] - m[2][0] * m[1][2]);
    float const E =   m[0][0] * m[2][2] - m[2][0] * m[0][2];
    float const F = -(m[0][0] * m[1][2] - m[1][0] * m[0][2]);
    float const G =   m[1][0] * m[2][1] - m[2][0] * m[1][1];
    float const H = -(m[0][0] * m[2][1] - m[2][0] * m[0][1]);
    float const I =   m[0][0] * m[1][1] - m[1][0] * m[0][1];
        
    float const det = m[0][0] * A + m[1][0] * B + m[2][0] * C;
    float const inv_det = 1.f / det;
    return inv_det * float3x3{        
        float3{A, B, C},
        float3{D, E, F},
        float3{G, H, I}
    };
}
Invert a 3x3 matrix in a Metal compute kernel
 
 
Q