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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: d2c9e241646eaca8d1efb45ad72b3662b31b9887
4
- data.tar.gz: fcb5fc76673874d947fcd7094ceda6ec954fe025
2
+ SHA256:
3
+ metadata.gz: f6a549a51ab2ed25c96e636f86cc5cc42cb628ce2addb14f42d5e894c406bdd0
4
+ data.tar.gz: a1e42f0d9017b323b92d9b59468a37d5ce76508ab7de24e661f0dc062ab9b32f
5
5
  SHA512:
6
- metadata.gz: 1a780bb65d483996b492c8c0123379c9b917c60699c60a51f905a0a64d00d27c2a36ff22b0b933fbb549fbdfdd96657c058c418569b08dcb6a35f232c980e208
7
- data.tar.gz: 144eac0afa622d5fa7613e1403f4fdc88125fcbbabbced72775be41b0f6fd44193da8c496c2d09fdc3a6d33b646b2a1f74300d7c2373f36a33b8e850ead538b3
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
@@ -4,3 +4,9 @@ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
4
 
5
5
  # Specify your gem's dependencies in randsvd.gemspec
6
6
  gemspec
7
+
8
+ gem "bundler", "~> 2.0"
9
+ gem "rake", "~> 12.0"
10
+ gem "rspec", "~> 3.0"
11
+ gem "rbs", "~> 1.2"
12
+ gem "steep", "~> 0.44"
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2017 yoshoku
3
+ Copyright (c) 2017-2021 yoshoku
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # RandSVD
2
2
 
3
- [![Build Status](https://travis-ci.org/yoshoku/RandSVD.svg?branch=master)](https://travis-ci.org/yoshoku/RandSVD)
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/[USERNAME]/randsvd. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
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
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'randsvd/version'
2
4
  require 'nmatrix/lapacke'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class RandSVD
2
- VERSION = '0.1.2'.freeze
4
+ VERSION = '0.2.0'
3
5
  end
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', '~> 0.2.3'
25
- spec.add_runtime_dependency 'nmatrix-lapacke', '~> 0.2.3'
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.1.2
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: 2018-01-07 00:00:00.000000000 Z
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.2.3
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.2.3
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.2.3
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.2.3
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
- - ".travis.yml"
51
+ - CHANGELOG.md
94
52
  - CODE_OF_CONDUCT.md
95
53
  - Gemfile
96
54
  - LICENSE.txt
97
55
  - README.md
98
56
  - Rakefile
99
- - bin/console
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
- rubyforge_project:
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
@@ -1,14 +0,0 @@
1
- sudo: false
2
- os: linux
3
- dist: trusty
4
- language: ruby
5
- rvm:
6
- - 2.2.9
7
- before_install:
8
- - gem install --no-document bundler -v '~> 1.16'
9
- addons:
10
- apt:
11
- packages:
12
- - liblapack-dev
13
- - liblapacke-dev
14
-
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
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
data/exe/randsvd DELETED
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "randsvd"