{
  "id": "fn-gpu-inverse",
  "dataComponent": "gpu",
  "heading": {
    "title": "inverse",
    "badges": ["GPU"]
  },
  "synopsis": "Computes the matrix inverse of a (2×2) tensor on the GPU. In many builds, real GPU code is not implemented yet, so it may fallback to CPU.",
  "codeBlocks": [
    "extend(\"gpu\")\\n\\n# 1) Invert a 2×2 matrix => shape [2,2]\\nM = gpu:to_tensor([[1,2],[3,4]])\\ninvM = gpu:inverse(M)\\nslog(gpu:to_array(invM))\\n# => e.g. [[-2.0,1.0],[1.5,-0.5]]\\n\\n# 2) If determinant is near zero => bridging raises an error.\\n# 3) Some builds have no real GPU kernel => logs fallback CPU.\\n"
  ],
  "notes": [
    "gpu:inverse => only supports 2×2. If shape is not [2,2], bridging raises an error. If the matrix is nearly singular, it errors with 'cannot invert'.",
    "Often used as a minimal demonstration. For bigger NxN, see advanced GPU solvers or third-party libraries.",
    "No partial usage by default; expects exactly 1 argument."
  ]
}
