Skip to content

Commit a5daf85

Browse files
committed
Add and update examples. Add rake tasks.
1 parent a47fe24 commit a5daf85

File tree

6 files changed

+24
-0
lines changed

6 files changed

+24
-0
lines changed

Rakefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
require 'rspec/core/rake_task'
2+
require 'bundler/gem_tasks'
5.26 KB
Loading

examples/matrix_benchmarks.rb

Whitespace-only changes.
76.4 KB
Loading
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
require 'benchmark/plot'
2+
require 'matrix'
3+
require 'nmatrix'
4+
require 'nmatrix/atlas'
5+
6+
sizes = [5, 10, 50, 100, 150, 200]
7+
8+
Benchmark.plot sizes, title: "Matrix multiplication",
9+
file_name: "matrix_multiplication" do |x|
10+
x.report "NMatrix with ATLAS" do |size|
11+
n = NMatrix.new([size,size], [1]*size*size, dtype: :float32)
12+
n.dot(n)
13+
end
14+
15+
x.report "Matrix" do |size|
16+
n = Matrix[*[[1]*size]*size]
17+
n * n
18+
end
19+
end
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
require 'numo-narray'
2+
require 'nmatrix'
3+

0 commit comments

Comments
 (0)