Class: GSL::Interp2d

Inherits:
Object
  • Object
show all
Defined in:
lib/gsl/interp2d_fix.rb

Defined Under Namespace

Modules: BugDetectHelper

Class Method Summary collapse

Class Method Details

.detect_gsl_interp2d_swapping_bugObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/gsl/interp2d_fix.rb', line 25

def self.detect_gsl_interp2d_swapping_bug
  @@swapped = nil
  x = GSL::Vector.alloc((-4..4).to_a)
  y = GSL::Vector.alloc((-4..4).to_a)

  z = []
  x.each do |xi|
    y.each do |yi|
      z << BugDetectHelper.asymmetric_function(xi, yi)
    end
  end
  z = GSL::Vector.alloc(z)
  i2d = GSL::Interp2d.alloc(GSL::Interp2d::BICUBIC, x, y, z)

  test_x = x[1]
  test_y = y[1]

  ans_normal = i2d.eval(x,y,z,test_x, test_y)
  ans_swapped = i2d.eval(x,y,z,test_y, test_x)
  ans_expected = BugDetectHelper.asymmetric_function(test_x, test_y)
  @@swapped = ans_expected == ans_normal

  @@swapped
end

.swappedObject



50
51
52
# File 'lib/gsl/interp2d_fix.rb', line 50

def self.swapped
  @@swapped
end