691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
|
# File 'lib/BOAST/CKernel.rb', line 691
def compare_ref(ref_outputs, outputs, epsilon = nil)
res = {}
@procedure.parameters.each_with_index { |param, indx|
if param.direction == :in or param.constant then
next
end
if param.dimension then
diff = (outputs[indx] - ref_outputs[indx]).abs
if epsilon then
diff.each { |elem|
raise "Error: #{param.name} different from ref by: #{elem}!" if elem > epsilon
}
end
res[param.name] = diff.max
else
raise "Error: #{param.name} different from ref: #{outputs[indx]} != #{ref_outputs[indx]} !" if epsilon and (outputs[indx] - ref_outputs[indx]).abs > epsilon
res[param.name] = (outputs[indx] - ref_outputs[indx]).abs
end
}
return res
end
|