{
  "id": "fn-matrix-subtract",
  "dataComponent": "matrix",
  "heading": {
    "title": "subtract",
    "badges": [
      "Matrix",
      "PARTIAL"
    ]
  },
  "synopsis": "Performs elementwise subtraction of two 2D arrays. If you only supply one argument, partial usage is applied.",
  "codeBlocks": [
    "extend(\"matrix\")\n\n# 1) Basic usage\nA = [[1,2],[3,4]]\nB = [[5,6],[7,8]]\nres = matrix:subtract(A,B)\n# => [[-4,-4],[-4,-4]]\nsput(res)\n\n# 2) Partial usage => fix the first argument\nsubFromA = matrix:subtract(A)\nresultB = subFromA(B)\n# => [[-4,-4],[-4,-4]]\n\n# 3) Placeholder => known second array B, missing A\npartialSub = matrix:subtract(_, B)\nout = partialSub(A)\n# => [[-4,-4],[-4,-4]]\n\n# 4) Raises an error if shapes differ or if either argument is not int2d_array or float2d_array.\n"
  ],
  "notes": [
    "Takes two arguments (A, B). If only one is provided, returns a function needing the missing array.",
    "Subtracts elementwise => (A[i][j] - B[i][j]). If shape mismatch, an error is raised.",
    "Supports int2d_array and float2d_array. If mixing int2d + float2d, upcast to float2d occurs (depending on bridging)."
  ]
}
