{"id":16860996,"url":"https://github.com/nickmcintyre/numero","last_synced_at":"2025-09-12T23:34:55.787Z","repository":{"id":43892472,"uuid":"209173854","full_name":"nickmcintyre/numero","owner":"nickmcintyre","description":"A friendly and intuitive math library for p5.js","archived":false,"fork":false,"pushed_at":"2025-08-09T12:42:14.000Z","size":28787,"stargazers_count":43,"open_issues_count":1,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-08-09T14:34:47.958Z","etag":null,"topics":["math","numpy","p5js"],"latest_commit_sha":null,"homepage":"https://mcintyre.io/numero/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nickmcintyre.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-09-17T23:19:06.000Z","updated_at":"2025-08-09T12:42:16.000Z","dependencies_parsed_at":"2024-01-10T14:08:34.045Z","dependency_job_id":"4242fde1-4587-4f37-8e95-566bffd97b3b","html_url":"https://github.com/nickmcintyre/numero","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/nickmcintyre/numero","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickmcintyre%2Fnumero","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickmcintyre%2Fnumero/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickmcintyre%2Fnumero/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickmcintyre%2Fnumero/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nickmcintyre","download_url":"https://codeload.github.com/nickmcintyre/numero/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickmcintyre%2Fnumero/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274893250,"owners_count":25369278,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-12T02:00:09.324Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["math","numpy","p5js"],"created_at":"2024-10-13T14:28:34.759Z","updated_at":"2025-09-12T23:34:55.752Z","avatar_url":"https://github.com/nickmcintyre.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# número\n\u003e A friendly and intuitive math library for p5.js\n\n[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors)\n\n[![Build Status](https://github.com/nickmcintyre/numero/actions/workflows/ci.yml/badge.svg)](https://github.com/nickmcintyre/numero/actions/workflows/ci.yml)\n\nThis p5.js addon library provides a beginner-friendly `Tensor` class that's similar to a [NumPy](https://numpy.org/) array. It builds on the linear algebra engine from [TensorFlow.js](https://js.tensorflow.org/api/latest/) and adapts it for sketching. You can view número's source code along with examples on [GitHub](https://github.com/nickmcintyre/numero).\n\n## Usage\n\nnúmero's `Tensor` class is a generalization of numbers (scalars), vectors, and matrices. `Tensor`s are used heavily in fields ranging from physics to machine learning. Here are a few examples of `Tensor`s you may recognize:\n\n```javascript\n// The age of a cat in years.\n// Rank-0 (Scalar)\nlet age = createTensor(5);\n\n// The position of a cat in space.\n// Rank-1 (Vector)\nlet position = createTensor([10, 20, 30]);\n\n// The grayscale values of the pixels in a 2x2 cat picture.\n// Rank-2 (Matrix)\nlet grayscale = createTensor([[100, 187],\n                              [123, 182]]);\n\n// The RGB values of the pixels in a 2x2 cat picture.\n// Rank-3 (Array of Matrices)\nlet rgb = createTensor([\n                        // Red.\n                        [[100, 187],\n                        [123, 182]],\n                        // Green.\n                        [[80, 205],\n                        [20, 133]],\n                        // Blue.\n                        [[201, 72],\n                        [209, 247]],\n                      ]);\n```\n\nThe following example multiplies a rank-1 `Tensor` (vector) by a rank-2 `Tensor` (matrix):\n\n```javascript\nfunction setup() {\n  createCanvas(400, 400);\n\n  background(220);\n\n  // Translate the origin to the center.\n  translate(200, 200);\n  \n  // Create the rotation matrix.\n  let R = createTensor([[cos(HALF_PI), -sin(HALF_PI)],\n                        [sin(HALF_PI), cos(HALF_PI)]]);\n\n  // Create the vector.\n  let v = createTensor([100, 0]);\n\n  // Get the vector's components.\n  let [x1, y1] = v.arraySync();\n\n  // Draw the vector in red.\n  stroke('red');\n  line(0, 0, x1, y1);\n\n  // Rotate the vector using matrix-vector multiplication,\n  // also called the \"inner\" or \"dot\" product.\n  v = R.dot(v);\n\n  // Get the rotated vector's components.\n  let [x2, y2] = v.arraySync();\n\n  // Draw the rotated vector in blue.\n  stroke('blue');\n  line(0, 0, x2, y2);\n\n  describe('Two lines extend from the center of a gray square. A red line extends to the right. A blue line extends downward.');\n}\n```\n\n## Contributing\n\nSee [CONTRIBUTING](CONTRIBUTING.md).\n\n## Contributors ✨\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore --\u003e\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/ashneeldas2\"\u003e\u003cimg src=\"https://avatars3.githubusercontent.com/u/18149521?v=4\" width=\"100px;\" alt=\"Ashneel Das\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eAshneel Das\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/nickmcintyre/numero/commits?author=ashneeldas2\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/nickmcintyre/numero/commits?author=ashneeldas2\" title=\"Tests\"\u003e⚠️\u003c/a\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnickmcintyre%2Fnumero","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnickmcintyre%2Fnumero","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnickmcintyre%2Fnumero/lists"}