{"id":13377695,"url":"https://github.com/SciRuby/nmatrix","last_synced_at":"2025-03-13T03:30:54.457Z","repository":{"id":2972808,"uuid":"3988087","full_name":"SciRuby/nmatrix","owner":"SciRuby","description":"Dense and sparse linear algebra library for Ruby via SciRuby","archived":false,"fork":true,"pushed_at":"2024-04-24T04:37:01.000Z","size":8076,"stargazers_count":469,"open_issues_count":76,"forks_count":133,"subscribers_count":38,"default_branch":"master","last_synced_at":"2024-11-17T14:43:30.806Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"translunar/nmatrix","license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SciRuby.png","metadata":{"files":{"readme":"README.rdoc","changelog":"History.txt","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-04-10T23:05:34.000Z","updated_at":"2024-05-05T06:29:43.000Z","dependencies_parsed_at":"2023-02-13T06:30:36.011Z","dependency_job_id":null,"html_url":"https://github.com/SciRuby/nmatrix","commit_stats":null,"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SciRuby%2Fnmatrix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SciRuby%2Fnmatrix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SciRuby%2Fnmatrix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SciRuby%2Fnmatrix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SciRuby","download_url":"https://codeload.github.com/SciRuby/nmatrix/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243335204,"owners_count":20274897,"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":[],"created_at":"2024-07-30T06:02:08.950Z","updated_at":"2025-03-13T03:30:53.700Z","avatar_url":"https://github.com/SciRuby.png","language":"C++","funding_links":[],"categories":["C++"],"sub_categories":[],"readme":"= NMatrix\n\n{\u003cimg src=\"https://badges.gitter.im/SciRuby/nmatrix.svg\" alt=\"Join the chat at https://gitter.im/SciRuby/nmatrix\"\u003e}[https://gitter.im/SciRuby/nmatrix?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge]\n\nFast Numerical Linear Algebra Library for Ruby\n\n* {sciruby.com}[http://sciruby.com]\n* {Google+}[https://plus.google.com/109304769076178160953/posts]\n* {Google Group - Mailing List}[https://groups.google.com/forum/#!forum/sciruby-dev]\n* {NMatrix Installation wiki}[https://github.com/SciRuby/nmatrix/wiki/Installation]\n* {SciRuby Installation guide}[http://sciruby.com/docs#installation]\n\n{\u003cimg src=https://travis-ci.org/SciRuby/nmatrix.png\u003e}[https://travis-ci.org/SciRuby/nmatrix]\n\n{\u003cimg src=\"https://codeclimate.com/github/SciRuby/nmatrix.png\" /\u003e}[https://codeclimate.com/github/SciRuby/nmatrix]\n\n== Description\n\nNMatrix is a fast numerical linear algebra library for Ruby, with\ndense and sparse matrices, written mostly in C and C++ (and with\nexperimental JRuby support). It is part of the SciRuby project.\n\nNMatrix was inspired by {NArray}[http://narray.rubyforge.org], by Masahiro Tanaka.\n\nSeveral gems are provided in this repository:\n* +nmatrix+\n* +nmatrix-java+\n* +nmatrix-atlas+\n* +nmatrix-lapacke+\n* +nmatrix-fftw+\n\n== Installation\n\nTo install the latest stable version:\n\n    gem install nmatrix\n\nNMatrix was originally written in C/C++, but an experimental JRuby version is also included (see instructions below for JRuby). For the MRI (C/C++) version, you need:\n* Ruby 2.0 or later\n* a compiler supporting C++11 (clang or GCC)\n\nTo install the +nmatrix-atlas+ or +nmatrix-lapacke+ extensions, an additional requirement is a\ncompatible LAPACK library.\nDetailed directions for this step can be found\n{here}[https://github.com/SciRuby/nmatrix/wiki/Installation].\n\nIf you want to obtain the latest (development) code, you should generally do:\n\n    git clone https://github.com/SciRuby/nmatrix.git\n    cd nmatrix/\n    gem install bundler\n    bundle install\n    bundle exec rake compile\n    bundle exec rake spec\n\nIf you want to try out the code without installing:\n\n    bundle exec rake pry\n\nTo install:\n\n    bundle exec rake install\n\n=== JRuby\n\nFirst, you need to download Apache Commons Math 3.6.1 (the JAR, which\nyou can find in the binary package). For example, in the NMatrix\ndirectory, do:\n\n    wget https://www.apache.org/dist/commons/math/binaries/commons-math3-3.6.1-bin.tar.gz\n    tar zxvf commons-math3-3.6.1-bin.tar.gz\n    mkdir ext/nmatrix_java/vendor/\n    cp commons-math3-3.6.1/commons-math3-3.6.1.jar ext/nmatrix_java/vendor/\n\nNext, create build directories:\n\n    mkdir -p ext/nmatrix_java/build/class\n    mkdir ext/nmatrix_java/target\n\nFinally, compile and package as jar.\n\n    rake jruby\n\n=== Plugins\n\nThe commands above build and install only the core +nmatrix+ gem.  If\nyou want to build one or more of the plugin gems (+nmatrix-atlas+,\n+nmatrix-lapacke+) in addition to the core nmatrix gem, use the\n\u003ctt\u003enmatrix_plugins=\u003c/tt\u003e option, e.g.  \u003ctt\u003erake compile\nnmatrix_plugins=all\u003c/tt\u003e, \u003ctt\u003erake install nmatrix_plugins=atlas\u003c/tt\u003e,\n\u003ctt\u003erake clean nmatrix_plugins=atlas,lapacke\u003c/tt\u003e. Each of these\ncommands apply to the +nmatrix+ gem and any additional plugin gems\nspecified. For example, \u003ctt\u003erake spec nmatrix_plugins=atlas\u003c/tt\u003e will\ntest both the core +nmatrix+ gem and the +nmatrix-atlas+ gem.\n\n=== Upgrading from NMatrix 0.1.0\n\nIf your code requires features provided by ATLAS (Cholesky\ndecomposition, singular value decomposition, eigenvalues/eigenvectors,\ninverses of matrices bigger than 3-by-3), your code now depends on the\n+nmatrix-atlas+ gem. You will need to add this a dependency of your\nproject and \u003ctt\u003erequire 'nmatrix/atlas'\u003c/tt\u003e in addition to\n\u003ctt\u003erequire 'nmatrix'\u003c/tt\u003e. In most cases, no further changes should\nbe necessary, however there have been a few {API\nchanges}[https://github.com/SciRuby/nmatrix/wiki/API-Changes], please\ncheck to see if these affect you.\n\n== Documentation\n\nIf you have a suggestion or want to add documentation for any class or\nmethod in NMatrix, please open an issue or send a pull request with\nthe changes.\n\nYou can find the complete API documentation {on our\nwebsite}[http://sciruby.com/nmatrix/docs/].\n\n== Examples\n\nCreate a new NMatrix from a ruby Array:\n\n    \u003e\u003e require 'nmatrix'\n    \u003e\u003e NMatrix.new([2, 3], [0, 1, 2, 3, 4, 5], dtype: :int64)\n    =\u003e [\n        [0, 1, 2],\n        [3, 4, 5]\n       ]\n\nCreate a new NMatrix using the +N+ shortcut:\n\n    \u003e\u003e m = N[ [2, 3, 4], [7, 8, 9] ]\n    =\u003e [\n        [2, 3, 4],\n        [7, 8, 9]\n       ]\n    \u003e\u003e m.inspect\n    =\u003e #\u003cNMatrix:0x007f8e121b6cf8shape:[2,3] dtype:int32 stype:dense\u003e\n\nThe above output requires that you have a pretty-print-enabled console\nsuch as Pry; otherwise, you'll see the output given by +inspect+.\n\nIf you want to learn more about how to create a matrix, {read the guide in our wiki}[https://github.com/SciRuby/nmatrix/wiki/How-to-create-an-NMatrix].\n\nAgain, you can find the complete API documentation {on our website}[http://sciruby.com/nmatrix/docs/].\n\n=== Using advanced features provided by plugins\n\nCertain features (see the documentation) require either the\nnmatrix-atlas or the nmatrix-lapacke gem to be installed. These can be\naccessed by using \u003ctt\u003erequire 'nmatrix/atlas'\u003c/tt\u003e or \u003ctt\u003erequire\n'nmatrix/lapacke'\u003c/tt\u003e. If you don't care which of the two gems is\ninstalled, use \u003ctt\u003erequire 'nmatrix/lapack_plugin'\u003c/tt\u003e, which will\nrequire whichever one of the two is available.\n\nFast fourier transforms can be conducted with the nmatrix-fftw\nextension, which is an interface to the FFTW C library. Use\n\u003ctt\u003erequire 'nmatrix/fftw'\u003c/tt\u003e for using this plugin.\n\n== Plugin details\n\n=== ATLAS and LAPACKE\n\nThe +nmatrix-atlas+ and +nmatrix-lapacke+ gems are optional extensions \nof the main +nmatrix+ gem that rely on external linear algebra libraries \nto provide advanced features for dense matrices (singular value \ndecomposition, eigenvalue/eigenvector finding, Cholesky factorization), \nas well as providing faster implementations of common operations like \nmultiplication, inverses, and determinants. +nmatrix-atlas+ requires the\n{ATLAS library}[http://math-atlas.sourceforge.net/], while +nmatrix-lapacke+ \nis designed to work with various LAPACK implementations (including ATLAS). \nThe +nmatrix-atlas+ and +nmatrix-lapacke+ gems both provide similar \ninterfaces for using these advanced features.\n\n=== *FFTW*\n\nThis is plugin for interfacing with the {FFTW library}[http://www.fftw.org].\nIt has been tested with FFTW 3.3.4.\n\nIt works reliably only with 64 bit numbers (or the NMatrix `:float64`\nor `:complex128` data type). See the docs for more details.\n\n== NArray compatibility\n\nWhen NArray[http://masa16.github.io/narray/] is installed alongside\nNMatrix, \u003ctt\u003erequire 'nmatrix'\u003c/tt\u003e will inadvertently load NArray's\n+lib/nmatrix.rb+ file, usually accompanied by the following error:\n\n    uninitialized constant NArray (NameError)\n\nTo make sure NMatrix is loaded properly in the presence of NArray, use\n\u003ctt\u003erequire 'nmatrix/nmatrix'\u003c/tt\u003e instead of \u003ctt\u003erequire\n'nmatrix'\u003c/tt\u003e in your code.\n\n== Developers\n\nRead the instructions in +CONTRIBUTING.md+ if you want to help\nNMatrix.\n\n== Features\n\nThe following features exist in the current version of NMatrix (0.1.0.rc1):\n\n* Matrix and vector storage containers: dense, yale, list (more to come)\n* Data types: byte (uint8), int8, int16, int32, int64, float32, float64, complex64, complex128,\n  Ruby object\n* Interconversion between storage and data types\n* Element-wise and right-hand-scalar operations and comparisons for all matrix types\n* Matrix-matrix multiplication for dense (with and without ATLAS) and yale\n* Matrix-vector multiplication for dense (with and without ATLAS)\n* Lots of enumerators (each, each_with_indices, each_row, each_column, each_rank, map, etc.)\n* Matrix slicing by copy and reference (for dense, yale, and list)\n* Native reading and writing of dense and yale matrices\n  * Optional compression for dense matrices with symmetry or triangularity: symmetric, skew, hermitian, upper, lower\n* Input/output:\n  * Matlab .MAT v5 file input\n  * MatrixMarket file input/output\n  * Harwell-Boeing and Fortran file input\n  * Point Cloud Library PCD file input\n* C and C++ API\n* BLAS internal implementations (no library) and external (with nmatrix-lapack or nmatrix-atlas) access:\n  * Level 1: xROT, xROTG (BLAS dtypes only), xASUM, xNRM2, IxAMAX, xSCAL\n  * Level 2: xGEMV\n  * Level 3: xGEMM, xTRSM\n* LAPACK access (with nmatrix-lapack or nmatrix-atlas plugin):\n  * xGETRF, xGETRI, xGETRS, xGESV (Gaussian elimination)\n  * xPOTRF, xPOTRI, xPOTRS, xPOSV (Cholesky factorization)\n  * xGESVD, xGESDD (singular value decomposition)\n  * xGEEV (eigenvalue decomposition of asymmetric square matrices)\n* LAPACK-less internal implementations (no plugin or LAPACK needed and working on non-BLAS dtypes):\n  * xGETRF, xGETRS\n* LU decomposition\n* Matrix inversions\n* Determinant calculation for BLAS dtypes\n* Traces\n* Ruby/GSL interoperability (requires {SciRuby's fork of rb-gsl}[http://github.com/SciRuby/rb-gsl])\n* slice assignments, e.g.,\n    x[1..3,0..4] = some_other_matrix\n\n=== Planned features (Short-to-Medium Term)\n\nSee the issues tracker for a list of planned features or to request\nnew ones.\n\n== License\n\nCopyright (c) 2012--17, John Woods and the Ruby Science Foundation.\n\nAll rights reserved.\n\nNMatrix, along with SciRuby, is licensed under the BSD 2-clause\nlicense. See {LICENSE.txt}[https://github.com/SciRuby/sciruby/wiki/License]\nfor details.\n\n== Donations\n\nSupport a SciRuby Fellow:\n\n{\u003cimg src=http://pledgie.com/campaigns/15783.png?skin_name=chrome\u003e}[http://www.pledgie.com/campaigns/15783]\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSciRuby%2Fnmatrix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FSciRuby%2Fnmatrix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSciRuby%2Fnmatrix/lists"}