Sha256: 4b1befadbd8dd960109b50f4e904ac680d55aa81e966e593bbe3844b996f79c1

Contents?: true

Size: 659 Bytes

Versions: 3

Compression:

Stored size: 659 Bytes

Contents

class MPFR
  @@error = MPFR('1e-12')

  def self.set_error_of_test(err)
    @error = err
  end

  def self.get_error_of_test
    @error
  end

  def check_error(other, error = nil)
    (self - other).abs < (error || @@error)
  end

  class Matrix
    def check_error(other, error = nil)
      err = error || @error
      column_size.times.all? do |i|
        row_siize.times.all? do |j|
          self[i][j].check_error(other[i][j], err)
        end
      end
    end
  end

  module Vector
    def check_error(other, error = nil)
      err = error || @error
      size.times.all? do |i|
        self[i].check_error(other[i], err)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ruby-mpfr-0.0.14 lib/mpfr/rspec.rb
ruby-mpfr-0.0.13 lib/mpfr/rspec.rb
ruby-mpfr-0.0.12 lib/mpfr/rspec.rb