{
  "name": "NumPy broadcasting: shape pairs and result shapes",
  "description": "Shape pairs taken from the NumPy v2.5 broadcasting guide, with the resulting shape or whether NumPy raises a ValueError, compiled by applying the guide's right-to-left rule to each listed pair.",
  "page": "https://casrai.org/guides/numpy-cheat-sheet",
  "publisher": "CASRAI",
  "license": "https://creativecommons.org/licenses/by/4.0/",
  "dateModified": "2026-11-16T21:57:48Z",
  "temporalCoverage": null,
  "spatialCoverage": null,
  "columns": [
    {
      "name": "Shape of array A",
      "unit": "",
      "description": ""
    },
    {
      "name": "Shape of array B",
      "unit": "",
      "description": ""
    },
    {
      "name": "Result shape",
      "unit": "",
      "description": ""
    },
    {
      "name": "Compatible",
      "unit": "",
      "description": ""
    }
  ],
  "rows": [
    {
      "Shape of array A": "5x4",
      "Shape of array B": "1",
      "Result shape": "5x4",
      "Compatible": "yes"
    },
    {
      "Shape of array A": "5x4",
      "Shape of array B": "4",
      "Result shape": "5x4",
      "Compatible": "yes"
    },
    {
      "Shape of array A": "15x3x5",
      "Shape of array B": "15x1x5",
      "Result shape": "15x3x5",
      "Compatible": "yes"
    },
    {
      "Shape of array A": "15x3x5",
      "Shape of array B": "3x5",
      "Result shape": "15x3x5",
      "Compatible": "yes"
    },
    {
      "Shape of array A": "15x3x5",
      "Shape of array B": "3x1",
      "Result shape": "15x3x5",
      "Compatible": "yes"
    },
    {
      "Shape of array A": "8x1x6x1",
      "Shape of array B": "7x1x5",
      "Result shape": "8x7x6x5",
      "Compatible": "yes"
    },
    {
      "Shape of array A": "3",
      "Shape of array B": "4",
      "Result shape": "none (ValueError)",
      "Compatible": "no"
    },
    {
      "Shape of array A": "2x1",
      "Shape of array B": "8x4x3",
      "Result shape": "none (ValueError)",
      "Compatible": "no"
    }
  ],
  "sources": [
    {
      "title": "NumPy v2.5 manual: Broadcasting",
      "url": "https://numpy.org/doc/stable/user/basics.broadcasting.html",
      "accessed": "2026-11-12"
    }
  ]
}