randsvd 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/build.yml +24 -0
- data/CHANGELOG.md +14 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +1 -1
- data/README.md +4 -8
- data/Steepfile +20 -0
- data/lib/randsvd.rb +2 -0
- data/lib/randsvd/version.rb +3 -1
- data/randsvd.gemspec +2 -6
- data/sig/patch.rbs +20 -0
- data/sig/randsvd.rbs +16 -0
- metadata +17 -60
- data/.travis.yml +0 -14
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/exe/randsvd +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f6a549a51ab2ed25c96e636f86cc5cc42cb628ce2addb14f42d5e894c406bdd0
|
4
|
+
data.tar.gz: a1e42f0d9017b323b92d9b59468a37d5ce76508ab7de24e661f0dc062ab9b32f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f53887728067b34dca5bd60fda4149902882bc2131e488186b2d16b468cd30f59d3d9ada48810b692858b726284035ebfa6e7737b25b7630242e0e6d34e10f73
|
7
|
+
data.tar.gz: 33114840169f5029d68f0ce7db578f812e8536c680848dbb4d9b0c32e51dbb3d43f2c3bcc8fbf97c393737191ee246fd0811187a4e693b9ec10933e71393f349
|
@@ -0,0 +1,24 @@
|
|
1
|
+
name: build
|
2
|
+
|
3
|
+
on: [push, pull_request]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
build:
|
7
|
+
runs-on: ubuntu-18.04
|
8
|
+
strategy:
|
9
|
+
fail-fast: false
|
10
|
+
matrix:
|
11
|
+
ruby: [ '2.6', '2.7' ]
|
12
|
+
steps:
|
13
|
+
- uses: actions/checkout@v2
|
14
|
+
- name: Install BLAS and LAPACK
|
15
|
+
run: sudo apt-get install -y libopenblas-dev libatlas-base-dev liblapacke-dev
|
16
|
+
- name: Set up Ruby ${{ matrix.ruby }}
|
17
|
+
uses: actions/setup-ruby@v1
|
18
|
+
with:
|
19
|
+
ruby-version: ${{ matrix.ruby }}
|
20
|
+
- name: Build and test with Rake
|
21
|
+
run: |
|
22
|
+
gem install --no-document bundler
|
23
|
+
bundle install --jobs 4 --retry 3
|
24
|
+
bundle exec rake
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# 0.2.0
|
2
|
+
- Add type declaration file: sig/randsvd.rbs
|
3
|
+
- Add frozen string literal comment.
|
4
|
+
- Fix some configuration files.
|
5
|
+
|
6
|
+
# 0.1.2
|
7
|
+
- Change the visibility of protected methods to private.
|
8
|
+
- Add NMatrix gems to runtime dependency.
|
9
|
+
|
10
|
+
# 0.1.1
|
11
|
+
- Add option for setting random seed to gesvd and gesdd methods.
|
12
|
+
|
13
|
+
# 0.1.0
|
14
|
+
- First release.
|
data/Gemfile
CHANGED
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# RandSVD
|
2
2
|
|
3
|
-
[![Build Status](https://
|
3
|
+
[![Build Status](https://github.com/yoshoku/randsvd/actions/workflows/build.yml/badge.svg)](https://github.com/yoshoku/randsvd/actions/workflows/build.yml)
|
4
4
|
[![Gem Version](https://badge.fury.io/rb/randsvd.svg)](https://badge.fury.io/rb/randsvd)
|
5
5
|
|
6
6
|
RandSVD is a class that performs truncated singular value decomposition using a randomized algorithm.
|
@@ -41,15 +41,11 @@ u, s, vt = RandSVD.gesvd(input_matrix, nb_singular_values)
|
|
41
41
|
reconstructed_matrix = u.dot(NMatrix.diag(s).dot(vt))
|
42
42
|
```
|
43
43
|
|
44
|
-
## Development
|
45
|
-
|
46
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
47
|
-
|
48
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
49
|
-
|
50
44
|
## Contributing
|
51
45
|
|
52
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
46
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/yoshoku/randsvd.
|
47
|
+
This project is intended to be a safe, welcoming space for collaboration,
|
48
|
+
and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
53
49
|
|
54
50
|
## License
|
55
51
|
|
data/Steepfile
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
target :lib do
|
2
|
+
signature "sig"
|
3
|
+
|
4
|
+
check "lib" # Directory name
|
5
|
+
# check "Gemfile" # File name
|
6
|
+
# check "app/models/**/*.rb" # Glob
|
7
|
+
# # ignore "lib/templates/*.rb"
|
8
|
+
#
|
9
|
+
# # library "pathname", "set" # Standard libraries
|
10
|
+
# library "nmatrix" # Gems
|
11
|
+
end
|
12
|
+
|
13
|
+
# target :spec do
|
14
|
+
# signature "sig", "sig-private"
|
15
|
+
#
|
16
|
+
# check "spec"
|
17
|
+
#
|
18
|
+
# # library "pathname", "set" # Standard libraries
|
19
|
+
# # library "rspec"
|
20
|
+
# end
|
data/lib/randsvd.rb
CHANGED
data/lib/randsvd/version.rb
CHANGED
data/randsvd.gemspec
CHANGED
@@ -21,10 +21,6 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
22
|
spec.require_paths = ['lib']
|
23
23
|
|
24
|
-
spec.add_runtime_dependency 'nmatrix'
|
25
|
-
spec.add_runtime_dependency 'nmatrix-lapacke'
|
26
|
-
|
27
|
-
spec.add_development_dependency 'bundler', '~> 1.15'
|
28
|
-
spec.add_development_dependency 'rake', '~> 10.0'
|
29
|
-
spec.add_development_dependency 'rspec', '~> 3.0'
|
24
|
+
spec.add_runtime_dependency 'nmatrix'
|
25
|
+
spec.add_runtime_dependency 'nmatrix-lapacke'
|
30
26
|
end
|
data/sig/patch.rbs
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
class NMatrix
|
2
|
+
INDEX_DTYPE: Symbol
|
3
|
+
|
4
|
+
def self.size: (untyped shape) -> untyped
|
5
|
+
|
6
|
+
def initialize: (*untyped) -> untyped
|
7
|
+
|
8
|
+
def []: (*untyped) -> untyped
|
9
|
+
def *: (untyped) -> untyped
|
10
|
+
def +: (untyped) -> untyped
|
11
|
+
|
12
|
+
def shape: () -> untyped
|
13
|
+
def transpose: (?untyped permute) -> untyped
|
14
|
+
def dot: (untyped right_v) -> untyped
|
15
|
+
def log: (*untyped) -> untyped
|
16
|
+
def sin: () -> untyped
|
17
|
+
def factorize_qr: () -> untyped
|
18
|
+
def gesdd: (?untyped workspace_size) -> untyped
|
19
|
+
def gesvd: (?untyped workspace_size) -> untyped
|
20
|
+
end
|
data/sig/randsvd.rbs
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
class RandSVD
|
2
|
+
VERSION: String
|
3
|
+
|
4
|
+
attr_reader self.seed: untyped
|
5
|
+
|
6
|
+
def self.gesvd: (NMatrix mat, Integer k, ?::Integer t, ?Integer? seed) -> [NMatrix, NMatrix, NMatrix]
|
7
|
+
def self.gesdd: (NMatrix mat, Integer k, ?::Integer t, ?Integer? seed) -> [NMatrix, NMatrix, NMatrix]
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
def self.rsvd: (NMatrix mat, Integer k, Integer t, Integer svd_type) -> [NMatrix, NMatrix, NMatrix]
|
12
|
+
def self.rand_uniform: (Array[Integer] shape) -> NMatrix
|
13
|
+
def self.rand_normal: (Array[Integer] shape, ?Float mu, ?Float sigma) -> NMatrix
|
14
|
+
def self.make_orthonormal_mat: (NMatrix mat, Integer l, Integer t) -> NMatrix
|
15
|
+
def self.truncate_svd_mats: (NMatrix mat_u, NMatrix vec_s, NMatrix mat_v, Integer k) -> [NMatrix, NMatrix, NMatrix]
|
16
|
+
end
|
metadata
CHANGED
@@ -1,107 +1,65 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: randsvd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- yoshoku
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-06-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nmatrix
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0
|
19
|
+
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: nmatrix-lapacke
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0
|
33
|
+
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: bundler
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '1.15'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '1.15'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rake
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '10.0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '10.0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: rspec
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '3.0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '3.0'
|
40
|
+
version: '0'
|
83
41
|
description:
|
84
42
|
email:
|
85
43
|
- yoshoku@outlook.com
|
86
|
-
executables:
|
87
|
-
- randsvd
|
44
|
+
executables: []
|
88
45
|
extensions: []
|
89
46
|
extra_rdoc_files: []
|
90
47
|
files:
|
48
|
+
- ".github/workflows/build.yml"
|
91
49
|
- ".gitignore"
|
92
50
|
- ".rspec"
|
93
|
-
-
|
51
|
+
- CHANGELOG.md
|
94
52
|
- CODE_OF_CONDUCT.md
|
95
53
|
- Gemfile
|
96
54
|
- LICENSE.txt
|
97
55
|
- README.md
|
98
56
|
- Rakefile
|
99
|
-
-
|
100
|
-
- bin/setup
|
101
|
-
- exe/randsvd
|
57
|
+
- Steepfile
|
102
58
|
- lib/randsvd.rb
|
103
59
|
- lib/randsvd/version.rb
|
104
60
|
- randsvd.gemspec
|
61
|
+
- sig/patch.rbs
|
62
|
+
- sig/randsvd.rbs
|
105
63
|
homepage: https://github.com/yoshoku/randsvd
|
106
64
|
licenses:
|
107
65
|
- MIT
|
@@ -121,8 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
121
79
|
- !ruby/object:Gem::Version
|
122
80
|
version: '0'
|
123
81
|
requirements: []
|
124
|
-
|
125
|
-
rubygems_version: 2.4.5.4
|
82
|
+
rubygems_version: 3.1.6
|
126
83
|
signing_key:
|
127
84
|
specification_version: 4
|
128
85
|
summary: RandSVD is a class that performs truncated singular value decomposition using
|
data/.travis.yml
DELETED
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "randsvd"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start(__FILE__)
|
data/bin/setup
DELETED
data/exe/randsvd
DELETED