matrix 0.4.1 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0c8ddb0e922826f9f120eb357aa5c2680fe54a2adc10b63f2c7d3c991856130e
4
- data.tar.gz: 7b0cdbf46462679c994526757128667dee31b98485e240f4e4a7fe58df4dc7f1
3
+ metadata.gz: 02ce60499729edc0aa3f3e631db74a8cf03b8474541af9eff71c66ce4390f2a7
4
+ data.tar.gz: 4db5b1184f4e9393c5d8ee4a1ca7809dc15026457552868c125cb21aee7c5d82
5
5
  SHA512:
6
- metadata.gz: b0cb611a8e2b971c363f007104a3c4973412944135edad972999dd7ba8c68493f2ac971cf69e5f52143bf5f89218eb7ffb7a995751ecd0bf86b8533cb2d86155
7
- data.tar.gz: 787cc92a9765b6150690e909e091eafba5fc5a42a73bc6dcb126f4f3d2438b923d3882d9c639e399bf9e3aab034b6e13cff67c870c0d3462a3d0ae17f572ce20
6
+ metadata.gz: 3bf409ceb52d64863fe5efc62bbed23e4438f2d1b2043652e31e10f2518a748cdb7a8b4fd2b0f572c3bcd0a6af30990f5a584fb67a27d29844d5e2d192475a40
7
+ data.tar.gz: 85114876d42103a122ae27f0d1988cc3ba4f22742023ae7083132acd41049740982fa81ff4ac2c9ab3ab6fcca71e025dbde47fb57b58cf148eb58f8b1752c0bc
@@ -4,10 +4,10 @@ Redistribution and use in source and binary forms, with or without
4
4
  modification, are permitted provided that the following conditions
5
5
  are met:
6
6
  1. Redistributions of source code must retain the above copyright
7
- notice, this list of conditions and the following disclaimer.
7
+ notice, this list of conditions and the following disclaimer.
8
8
  2. Redistributions in binary form must reproduce the above copyright
9
- notice, this list of conditions and the following disclaimer in the
10
- documentation and/or other materials provided with the distribution.
9
+ notice, this list of conditions and the following disclaimer in the
10
+ documentation and/or other materials provided with the distribution.
11
11
 
12
12
  THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
13
13
  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
data/COPYING ADDED
@@ -0,0 +1,56 @@
1
+ Ruby is copyrighted free software by Yukihiro Matsumoto <matz@netlab.jp>.
2
+ You can redistribute it and/or modify it under either the terms of the
3
+ 2-clause BSDL (see the file BSDL), or the conditions below:
4
+
5
+ 1. You may make and give away verbatim copies of the source form of the
6
+ software without restriction, provided that you duplicate all of the
7
+ original copyright notices and associated disclaimers.
8
+
9
+ 2. You may modify your copy of the software in any way, provided that
10
+ you do at least ONE of the following:
11
+
12
+ a. place your modifications in the Public Domain or otherwise
13
+ make them Freely Available, such as by posting said
14
+ modifications to Usenet or an equivalent medium, or by allowing
15
+ the author to include your modifications in the software.
16
+
17
+ b. use the modified software only within your corporation or
18
+ organization.
19
+
20
+ c. give non-standard binaries non-standard names, with
21
+ instructions on where to get the original software distribution.
22
+
23
+ d. make other distribution arrangements with the author.
24
+
25
+ 3. You may distribute the software in object code or binary form,
26
+ provided that you do at least ONE of the following:
27
+
28
+ a. distribute the binaries and library files of the software,
29
+ together with instructions (in the manual page or equivalent)
30
+ on where to get the original distribution.
31
+
32
+ b. accompany the distribution with the machine-readable source of
33
+ the software.
34
+
35
+ c. give non-standard binaries non-standard names, with
36
+ instructions on where to get the original software distribution.
37
+
38
+ d. make other distribution arrangements with the author.
39
+
40
+ 4. You may modify and include the part of the software into any other
41
+ software (possibly commercial). But some files in the distribution
42
+ are not written by the author, so that they are not under these terms.
43
+
44
+ For the list of those files and their copying conditions, see the
45
+ file LEGAL.
46
+
47
+ 5. The scripts and library files supplied as input to or produced as
48
+ output from the software do not automatically fall under the
49
+ copyright of the software, but belong to whomever generated them,
50
+ and may be sold commercially, and may be aggregated with this
51
+ software.
52
+
53
+ 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
54
+ IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
55
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
56
+ PURPOSE.
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: false
2
2
  class Matrix
3
3
  # Adapted from JAMA: http://math.nist.gov/javanumerics/jama/
4
+ # Like JAMA, this code does not support Complex matrices inputs.
4
5
 
5
6
  # Eigenvalues and eigenvectors of a real matrix.
6
7
  #
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Matrix
4
- VERSION = "0.4.1"
4
+ VERSION = "0.4.3"
5
5
  end
data/lib/matrix.rb CHANGED
@@ -379,7 +379,7 @@ class Matrix
379
379
  end
380
380
 
381
381
  private def set_value(row, col, value)
382
- raise ErrDimensionMismatch, "Expected a a value, got a #{value.class}" if value.respond_to?(:to_matrix)
382
+ raise ErrDimensionMismatch, "Expected a value, got a #{value.class}" if value.respond_to?(:to_matrix)
383
383
 
384
384
  @rows[row][col] = value
385
385
  end
@@ -1228,7 +1228,8 @@ class Matrix
1228
1228
  #
1229
1229
  # Matrix exponentiation.
1230
1230
  # Equivalent to multiplying the matrix by itself N times.
1231
- # Non integer exponents will be handled by diagonalizing the matrix.
1231
+ # Non-integer exponents will be handled by diagonalizing the matrix;
1232
+ # this is not supported for Complex matrices.
1232
1233
  #
1233
1234
  # Matrix[[7,6], [3,9]] ** 2
1234
1235
  # # => 67 96
@@ -1547,6 +1548,7 @@ class Matrix
1547
1548
  # v.inv == v_inv # => true
1548
1549
  # (v * d * v_inv).round(5) == m # => true
1549
1550
  #
1551
+ # This is not supported for Complex matrices
1550
1552
  def eigensystem
1551
1553
  EigenvalueDecomposition.new(self)
1552
1554
  end
data/matrix.gemspec CHANGED
@@ -19,11 +19,8 @@ Gem::Specification.new do |spec|
19
19
  spec.licenses = ["Ruby", "BSD-2-Clause"]
20
20
  spec.required_ruby_version = ">= 2.5.0"
21
21
 
22
- spec.files = [".gitignore", "Gemfile", "LICENSE.txt", "README.md", "Rakefile", "bin/console", "bin/setup", "lib/matrix.rb", "lib/matrix/eigenvalue_decomposition.rb", "lib/matrix/lup_decomposition.rb", "lib/matrix/version.rb", "matrix.gemspec"]
22
+ spec.files = ["COPYING", "BSDL", "lib/matrix.rb", "lib/matrix/eigenvalue_decomposition.rb", "lib/matrix/lup_decomposition.rb", "lib/matrix/version.rb", "matrix.gemspec"]
23
23
  spec.bindir = "exe"
24
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
+ spec.executables = []
25
25
  spec.require_paths = ["lib"]
26
-
27
- spec.add_development_dependency "bundler"
28
- spec.add_development_dependency "rake"
29
26
  end
metadata CHANGED
@@ -1,43 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: matrix
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marc-Andre Lafortune
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-01-21 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: rake
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
11
+ date: 2025-06-18 00:00:00.000000000 Z
12
+ dependencies: []
41
13
  description: An implementation of Matrix and Vector classes.
42
14
  email:
43
15
  - ruby-core@marc-andre.ca
@@ -45,13 +17,8 @@ executables: []
45
17
  extensions: []
46
18
  extra_rdoc_files: []
47
19
  files:
48
- - ".gitignore"
49
- - Gemfile
50
- - LICENSE.txt
51
- - README.md
52
- - Rakefile
53
- - bin/console
54
- - bin/setup
20
+ - BSDL
21
+ - COPYING
55
22
  - lib/matrix.rb
56
23
  - lib/matrix/eigenvalue_decomposition.rb
57
24
  - lib/matrix/lup_decomposition.rb
@@ -77,7 +44,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
77
44
  - !ruby/object:Gem::Version
78
45
  version: '0'
79
46
  requirements: []
80
- rubygems_version: 3.2.3
47
+ rubygems_version: 3.5.11
81
48
  signing_key:
82
49
  specification_version: 4
83
50
  summary: An implementation of Matrix and Vector classes.
data/.gitignore DELETED
@@ -1,9 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
data/Gemfile DELETED
@@ -1,6 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
-
5
- # Specify your gem's dependencies in matrix.gemspec
6
- gemspec
data/README.md DELETED
@@ -1,45 +0,0 @@
1
- # Matrix [![Version](https://badge.fury.io/rb/matrix.svg)](https://badge.fury.io/rb/matrix) [![Default Gem](https://img.shields.io/badge/stdgem-default-9c1260.svg)](https://stdgems.org/matrix/) [![Test](https://github.com/ruby/matrix/workflows/test/badge.svg)](https://github.com/ruby/matrix/actions?query=workflow%3Atest)
2
-
3
- An implementation of `Matrix` and `Vector` classes.
4
-
5
- The `Matrix` class represents a mathematical matrix. It provides methods for creating matrices, operating on them arithmetically and algebraically, and determining their mathematical properties (trace, rank, inverse, determinant, eigensystem, etc.).
6
-
7
- The `Vector` class represents a mathematical vector, which is useful in its own right, and also constitutes a row or column of a `Matrix`.
8
-
9
- ## Installation
10
-
11
- The `matrix` library comes pre-installed with Ruby. Unless you need recent features, you can simply `require 'matrix'` directly, no need to install it.
12
-
13
- If you need features that are more recent than the version of Ruby you want to support (check the [CHANGELOG](CHANGELOG.md)), you must use the gem. To do this, add this line to your application's Gemfile or gem's gemspec:
14
-
15
- ```ruby
16
- gem 'matrix'
17
- ```
18
-
19
- And then execute:
20
-
21
- $ bundle
22
-
23
- To make sure that the gem takes precedence over the builtin library, call `bundle exec ...` (or call `gem 'matrix'` explicitly).
24
-
25
- ## Usage
26
-
27
- ```ruby
28
- require 'matrix'
29
- m = Matrix[[1, 2], [3, 4]]
30
- m.determinant # => -2
31
- ```
32
-
33
- ## Development
34
-
35
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
36
-
37
- 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).
38
-
39
- ## Contributing
40
-
41
- Bug reports and pull requests are welcome on GitHub at https://github.com/ruby/matrix.
42
-
43
- ## License
44
-
45
- The gem is available as open source under the terms of the [2-Clause BSD License](https://opensource.org/licenses/BSD-2-Clause).
data/Rakefile DELETED
@@ -1,10 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rake/testtask"
3
-
4
- Rake::TestTask.new(:test) do |t|
5
- t.libs << "test" << "test/lib"
6
- t.libs << "lib"
7
- t.test_files = FileList['test/**/test_*.rb']
8
- end
9
-
10
- task :default => [:test]
data/bin/console DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "matrix"
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