SparseMatrix
Build a sparce matrix from dense matrix
RubyGems
https://rubygems.org/gems/sparse_matrix
Tree
.
├── Gemfile
├── Gemfile.lock
├── Guardfile
├── LICENSE.txt
├── README.md
├── Rakefile
├── lib
│ ├── sparse_matrix
│ │ └── version.rb
│ └── sparse_matrix.rb
├── pkg
│ └── sparse_matrix-0.0.1.gem
├── sparse_matrix.gemspec
└── spec
├── spec_helper.rb
└── sparsematrix_spec.rb
Installation
Add this line to your application's Gemfile:
gem 'sparse_matrix'
And then execute:
$ bundle
Or install it yourself as:
$ gem install sparse_matrix
How to Use
require 'sparse_matrix'
DM = DenseMatrix.new(2,2,[[1.0,2.0],[4.0,5.0]])
SM = SparseMatrix::SparseMatrix.new(2,2,[[2.0,0.0],[4.0,0.0]])
SM+DM
Authors
Kevin Robayna
Jose Antonio Rodriguez Leandro