randsvd 0.1.2 → 0.2.2

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: ec5af9328b7e8e9af4aa83adbe5cf8fd0a6f2b3aad8b4a9faacfb5d178bc5a6a
4
+ data.tar.gz: 3e24bd50af0eadbc2fb70a54129c9261bbe11de6472cab3bed35494a1afe8a7d
5
5
  SHA512:
6
- metadata.gz: 1a780bb65d483996b492c8c0123379c9b917c60699c60a51f905a0a64d00d27c2a36ff22b0b933fbb549fbdfdd96657c058c418569b08dcb6a35f232c980e208
7
- data.tar.gz: 144eac0afa622d5fa7613e1403f4fdc88125fcbbabbced72775be41b0f6fd44193da8c496c2d09fdc3a6d33b646b2a1f74300d7c2373f36a33b8e850ead538b3
6
+ metadata.gz: 3ae1580e31834872c03f0fa2821a81ee48234d13a30d4804c43f627be899927d235ca9bea9fca1903c3e0b9366b9661b3d2ce5520495f918edd11b472834d853
7
+ data.tar.gz: '000281f8ebcd24bf50be26bc7939922d2d2ad4bb580aa3dadb64ff4ae66a09c292d16e47fac34ecc9df6669ba7af49d00a705a15bcfc08b5d0f5a39b2df39908'
@@ -0,0 +1,22 @@
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.7' ]
12
+ steps:
13
+ - uses: actions/checkout@v3
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: ruby/setup-ruby@v1
18
+ with:
19
+ ruby-version: ${{ matrix.ruby }}
20
+ bundler-cache: true
21
+ - name: Build and test with Rake
22
+ run: bundle exec rake
data/CHANGELOG.md ADDED
@@ -0,0 +1,21 @@
1
+ # 0.2.2
2
+ - Add rubygems_mfa_required option.
3
+ - Remove unneeded depedencies.
4
+
5
+ # 0.2.1
6
+ - Remove dependent gem's type declaration file from installation files.
7
+
8
+ # 0.2.0
9
+ - Add type declaration file: sig/randsvd.rbs
10
+ - Add frozen string literal comment.
11
+ - Fix some configuration files.
12
+
13
+ # 0.1.2
14
+ - Change the visibility of protected methods to private.
15
+ - Add NMatrix gems to runtime dependency.
16
+
17
+ # 0.1.1
18
+ - Add option for setting random seed to gesvd and gesdd methods.
19
+
20
+ # 0.1.0
21
+ - 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-2022 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", "sig-deps"
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
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class RandSVD
2
- VERSION = '0.1.2'.freeze
4
+ VERSION = '0.2.2'
3
5
  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
 
data/randsvd.gemspec CHANGED
@@ -14,17 +14,18 @@ Gem::Specification.new do |spec|
14
14
  spec.homepage = 'https://github.com/yoshoku/randsvd'
15
15
  spec.license = 'MIT'
16
16
 
17
+ spec.metadata['homepage_uri'] = spec.homepage
18
+ spec.metadata['source_code_uri'] = spec.homepage
19
+ spec.metadata['changelog_uri'] = 'https://github.com/yoshoku/randsvd/blob/main/CHANGELOG.md'
20
+ spec.metadata['rubygems_mfa_required'] = 'true'
21
+
17
22
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
- f.match(%r{^(test|spec|features)/})
23
+ f.match(%r{^(test|spec|features|sig-deps)/})
19
24
  end
20
25
  spec.bindir = 'exe'
21
26
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
27
  spec.require_paths = ['lib']
23
28
 
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'
29
+ spec.add_dependency 'nmatrix'
30
+ spec.add_dependency 'nmatrix-lapacke'
30
31
  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,112 +1,73 @@
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.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - yoshoku
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-01-07 00:00:00.000000000 Z
11
+ date: 2022-08-21 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'
83
- description:
40
+ version: '0'
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/randsvd.rbs
105
62
  homepage: https://github.com/yoshoku/randsvd
106
63
  licenses:
107
64
  - MIT
108
- metadata: {}
109
- post_install_message:
65
+ metadata:
66
+ homepage_uri: https://github.com/yoshoku/randsvd
67
+ source_code_uri: https://github.com/yoshoku/randsvd
68
+ changelog_uri: https://github.com/yoshoku/randsvd/blob/main/CHANGELOG.md
69
+ rubygems_mfa_required: 'true'
70
+ post_install_message:
110
71
  rdoc_options: []
111
72
  require_paths:
112
73
  - lib
@@ -121,9 +82,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
82
  - !ruby/object:Gem::Version
122
83
  version: '0'
123
84
  requirements: []
124
- rubyforge_project:
125
- rubygems_version: 2.4.5.4
126
- signing_key:
85
+ rubygems_version: 3.2.33
86
+ signing_key:
127
87
  specification_version: 4
128
88
  summary: RandSVD is a class that performs truncated singular value decomposition using
129
89
  a randomized algorithm.
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"