https://github.com/himeyama/numo-binrw
バイナリファイルを読み込んで NArray オブジェクトを生成、または書き込みます。(gem 配布中)
https://github.com/himeyama/numo-binrw
gem narray ruby
Last synced: about 1 month ago
JSON representation
バイナリファイルを読み込んで NArray オブジェクトを生成、または書き込みます。(gem 配布中)
- Host: GitHub
- URL: https://github.com/himeyama/numo-binrw
- Owner: Himeyama
- License: mit
- Created: 2021-07-28T05:34:46.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-09-05T14:11:02.000Z (over 4 years ago)
- Last Synced: 2024-03-15T02:51:07.345Z (almost 2 years ago)
- Topics: gem, narray, ruby
- Language: Ruby
- Homepage: https://rubygems.org/gems/numo-binrw
- Size: 25.4 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# numo-binrw
[](https://github.com/Himeyama/numo-binrw/actions/workflows/build.yml) [](https://badge.fury.io/rb/numo-binrw)
## 開発状況
- [x] 書き込み
- [x] 複数のファイル書き込み
- 対応型
- [x] 倍精度浮動小数点数
- [x] 単精度浮動小数点
- [x] 32 Bit 整数
- [x] 64 Bit 整数
- [x] 読み込み
- [x] 複数のファイルから読み込み
- 対応型
- [x] 倍精度浮動小数点数
- [x] 単精度浮動小数点
- [x] 32 Bit 整数
- [x] 64 Bit 整数
## 使用法
```rb
require "numo/binrw"
# 書き込み (例: 倍精度浮動小数点数)
a = Numo::DFloat.cast(0...100)
a.bin_write("dfdata.bin")
# 他の型で書き込み (例: 単精度浮動小数点)
b = Numo::SFloat.cast(0...100)
b.bin_write("fdata.bin")
# 複数ファイルに書き込み
c = Numo::Int32.cast(0...100).reshape(4, true)
c.bin_write(["idata01.bin", "idata02.bin", "idata03.bin", "idata04.bin"])
# 読み込み
d = Numo::Int32.bin_read("idata01.bin")
p d
## 複数ファイルから読み込み
e = Numo::Int32.bin_read(["idata01.bin", "idata02.bin", "idata03.bin", "idata04.bin"])
p e
```
## インストール
```sh
gem install numo-binrw
```