Sha256: b29de0e715aea70ebfcbf2f7b9e59b0943366b4052b374e120238c3da0a09493

Contents?: true

Size: 428 Bytes

Versions: 1

Compression:

Stored size: 428 Bytes

Contents

require 'benchmark/plot'
require 'matrix'
require 'nmatrix'
require 'nmatrix/atlas'

sizes = [5, 10, 50, 100, 150, 200]

Benchmark.plot sizes, title: "Matrix multiplication",
  file_name: "matrix_multiplication" do |x|
  x.report "NMatrix with ATLAS" do |size|
    n = NMatrix.new([size,size], [1]*size*size, dtype: :float32)
    n.dot(n)
  end

  x.report "Matrix" do |size|
    n = Matrix[*[[1]*size]*size]
    n * n
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
benchmark-plot-0.1.1 examples/matrix_vs_nmatrix/matrix_multiplication/matrix_multiplication.rb