Skip to content

ruby-numo/numo-narray

Folders and files

NameName
Last commit message
Last commit date

Latest commit

8ddb728 · Jan 1, 2024
Jul 14, 2022
Sep 6, 2021
Feb 25, 2017
Aug 20, 2022
Jul 21, 2013
Jul 14, 2022
Oct 18, 2021
May 6, 2020
Aug 14, 2016
Jul 11, 2013
May 5, 2020
Dec 31, 2023
May 6, 2020
May 20, 2020
Aug 20, 2022
May 10, 2016

Repository files navigation

Numo::NArray

Binder Build Status

GitHub | RubyGems

Numo::NArray is an Numerical N-dimensional Array class for fast processing and easy manipulation of multi-dimensional numerical data, similar to numpy.ndarray. This project is the successor to Ruby/NArray.

Documentation

All documents are primitive.

Related Projects

Installation

Requirement

Ruby ver 2.2 and later.

Ubuntu, Debian, Bash on Windows

apt install -y git ruby gcc ruby-dev rake make
gem install specific_install
gem specific_install https://github.com/ruby-numo/numo-narray.git

Quick start

An example

[1] pry(main)> require "numo/narray"
=> true
[2] pry(main)> a = Numo::DFloat.new(3,5).seq
=> Numo::DFloat#shape=[3,5]
[[0, 1, 2, 3, 4],
 [5, 6, 7, 8, 9],
 [10, 11, 12, 13, 14]]
[3] pry(main)> a.shape
=> [3, 5]
[4] pry(main)> a.ndim
=> 2
[5] pry(main)> a.class
=> Numo::DFloat
[6] pry(main)> a.size
=> 15

For more examples, check out the narray version of 100 numpy exercises.

Development

Build

git clone https://github.com/ruby-numo/numo-narray
cd numo-narray
bundle install
bundle exec rake compile

Run tests

bundle exec rake test

Tips: You may run tests defined in a specified line as:

bundle exec ruby test/bit_test.rb --location 27