adding 2x2 matrix inverse code
adding dimension-aware jacobian inverse