An open API service indexing awesome lists of open source software.

https://github.com/red-data-tools/red-tensor

Generic tensor interface in Ruby
https://github.com/red-data-tools/red-tensor

Last synced: about 1 year ago
JSON representation

Generic tensor interface in Ruby

Awesome Lists containing this project

README

          

# Tensor - Common protocol for numerical array libraries

Tensor provides the programming interface and the backend protocol for operating numerical arrays among different libraries.

## Install

```console
$ gem install tensor
```

## Usage

```ruby
require "tensor"
require "numo/narray"
require "pandas"

x1 = [0, 0.5, 1, 1.5, 2].map {|x| x * Math::PI }
x2 = Numo::DFloat[*ary]
x3 = Pandas::Series.new(a)

y1 = Tensor.sin(x1)
y2 = Tensor.sin(x2)
y3 = Tensor.sin(x3)

p y1.class #=> Array
p y2.class #=> Numo::DFloat
p y3.class #=>
```

## License

MIT License

## Author

- [Kenta Murata](https://github.com/mrkn)