{"id":22409467,"url":"https://github.com/iodevs/matrix_reloaded","last_synced_at":"2025-07-31T20:31:15.668Z","repository":{"id":33974964,"uuid":"162134264","full_name":"iodevs/matrix_reloaded","owner":"iodevs","description":"A library for matrix and vectors working...","archived":false,"fork":false,"pushed_at":"2022-05-13T13:03:59.000Z","size":68,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-16T23:16:16.456Z","etag":null,"topics":["algebra","elixir","hacktoberfest","math","matrix","vector"],"latest_commit_sha":null,"homepage":"https://hexdocs.pm/matrix_reloaded/","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iodevs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-12-17T13:24:50.000Z","updated_at":"2024-08-08T06:47:08.000Z","dependencies_parsed_at":"2022-08-09T03:30:25.528Z","dependency_job_id":null,"html_url":"https://github.com/iodevs/matrix_reloaded","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iodevs%2Fmatrix_reloaded","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iodevs%2Fmatrix_reloaded/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iodevs%2Fmatrix_reloaded/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iodevs%2Fmatrix_reloaded/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iodevs","download_url":"https://codeload.github.com/iodevs/matrix_reloaded/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228295605,"owners_count":17897596,"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","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":["algebra","elixir","hacktoberfest","math","matrix","vector"],"created_at":"2024-12-05T12:07:48.425Z","updated_at":"2024-12-05T12:07:49.360Z","avatar_url":"https://github.com/iodevs.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MatrixReloaded\n[![Continuous Integration](https://github.com/iodevs/matrix_reloaded/workflows/Continuous%20Integration/badge.svg)](https://github.com/iodevs/matrix_reloaded/actions)\n[![Coverage Status](https://coveralls.io/repos/github/iodevs/matrix_reloaded/badge.svg?branch=master)](https://coveralls.io/github/iodevs/matrix_reloaded?branch=master)\n![GitHub top language](https://img.shields.io/github/languages/top/iodevs/matrix_reloaded)\n![Hex.pm](https://img.shields.io/hexpm/v/matrix_reloaded)\n![Hex.pm](https://img.shields.io/hexpm/dt/matrix_reloaded)\n\n\nThis a library is focusing only on updating, rearranging, getting/dropping\nrow/column of a matrix. Also contains a few matrix operations like addition,\nsubtraction or multiplication. Anyway if you need make fast operations on\nmatrices, please use [Matrex](https://hexdocs.pm/matrex/Matrex.html) library.\n\nEach matrix is represented as a \"list of lists\" and functions mostly return\n[Result](https://hexdocs.pm/result/api-reference.html). It means either tuple\nof `{:ok, object}` or `{:error, \"msg\"}` where `object` is either `matrix` or\n`submatrix`, `vector` or `number`.\n\nNumbering of row and column of matrix starts from `0` and goes to `m - 1`\nand `n - 1` where `{m, n}` is dimension (size) of matrix. Similarly for\na row or column vector.\n\nIn case of need, if you want to save your matrix to a file you can use package [CSVlixir](https://hexdocs.pm/csvlixir/api-reference.html) and then call function\n\n```elixir\ndef save_csv(matrix, file_name \\\\ \"matrix.csv\") do\n  file_name\n  |\u003e File.open([:write], fn file -\u003e\n    matrix\n    |\u003e CSVLixir.write()\n    |\u003e Enum.each(\u0026IO.write(file, \u00261))\n  end)\nend\n```\n\nFor example, you can choose where to save your matrix (in our case it's a `tmp` directory)\n```elixir\nMatrixReloaded.Matrix.new(3, 1)\n|\u003e Result.and_then(\u0026MatrixReloaded.Matrix.save_csv(\u00261, \"/tmp/matrix.csv\"))\n# {:ok, :ok}\n```\n\n\n  ## Examples:\n```elixir\niex\u003e alias MatrixReloaded.Matrix\n\niex\u003e up = Matrix.diag([2, 2, 2], 1)\niex\u003e down = Matrix.diag([2, 2, 2], -1)\niex\u003e diag = Matrix.diag([3, 3, 3, 3])\niex\u003e band_mat = Result.and_then_x([up, down], \u0026Matrix.add(\u00261, \u00262))\niex\u003e band_mat = Result.and_then_x([band_mat, diag], \u0026Matrix.add(\u00261, \u00262))\n{:ok,\n  [\n    [3, 2, 0, 0],\n    [2, 3, 2, 0],\n    [0, 2, 3, 2],\n    [0, 0, 2, 3]\n  ]\n}\n\niex\u003e ones = Matrix.new(2, 1)\niex\u003e mat = Result.and_then_x([band_mat, ones], \u0026Matrix.update(\u00261, \u00262, {1, 1}))\n{:ok,\n  [\n    [3, 2, 0, 0],\n    [2, 1, 1, 0],\n    [0, 1, 1, 2],\n    [0, 0, 2, 3]\n  ]\n}\n\niex\u003e mat |\u003e Result.and_then(\u0026Matrix.get_row(\u00261, 4))\niex\u003e\n{:error, \"You can not get row from the matrix. The row number 4 is outside of matrix!\"}\n\niex\u003e mat |\u003e Result.and_then(\u0026Matrix.get_row(\u00261, 3))\niex\u003e\n{:ok, [0, 0, 2, 3]}\n\niex(4)\u003e mat |\u003e Result.and_then(\u0026Matrix.drop_col(\u00261, 3))\n{:ok,\n  [\n    [3, 2, 0],\n    [2, 3, 2],\n    [0, 2, 3],\n    [0, 0, 2]\n  ]\n}\n```\n\n\n## Installation\n\nIf [available in Hex](https://hex.pm/docs/publish), the package can be installed\nby adding `matrix_reloaded` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:matrix_reloaded, \"~\u003e 2.3.0\"}\n  ]\nend\n```\n\n## Documentation\n\nDocumentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)\nand published on [HexDocs](https://hexdocs.pm). Once published, the docs can\nbe found at [https://hexdocs.pm/matrix_reloaded](https://hexdocs.pm/matrix_reloaded).\n\n\n## License\n[![BSD](https://img.shields.io/badge/license-BSD-blue.svg)](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiodevs%2Fmatrix_reloaded","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiodevs%2Fmatrix_reloaded","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiodevs%2Fmatrix_reloaded/lists"}