Sha256: 810547b98598e61bc484ec0db79b7d67c3f6833d86cc910964df23ca7afd40eb

Contents?: true

Size: 832 Bytes

Versions: 6

Compression:

Stored size: 832 Bytes

Contents

require File.dirname(__FILE__) + '/spec_helper.rb'

describe MPFI::Matrix, "when making mid_interval" do
  before(:all) do
    MPFR.set_default_prec(512)
    @row = 4
    @column = 1
    @args = GenerateNumber.float_vector_arguments(1000, @row, @column).map{ |a| MPFI::ColumnVector.new(a) }
  end

  it "should have mid_interval including midpoint" do
    @args.each do |a|
      mid_int = a.mid_interval
      a.include?(mid_int).should be_true
      mid_int.include?(a.mid).should be_true
    end
  end

  it "should have midpoint of two points." do
    @args.each_with_index do |a, ind|
      m = a.midpoint(@args[ind-1])
      m2 = (a + @args[ind-1]).div_scalar(MPFI.new(2))
      (0...@row).each do |i|
        m[i].should == m2[i]
      end
      m.include?(a.mid.midpoint(@args[ind-1].mid)).should be_true
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ruby-mpfi-0.0.7 spec/mpfi_matrix/mpfi_matrix_interval_func_spec.rb
ruby-mpfi-0.0.6 spec/mpfi_matrix/mpfi_matrix_interval_func_spec.rb
ruby-mpfi-0.0.5 spec/mpfi_matrix/mpfi_matrix_interval_func_spec.rb
ruby-mpfi-0.0.4 spec/mpfi_matrix/mpfi_matrix_interval_func_spec.rb
ruby-mpfi-0.0.3 spec/mpfi_matrix/mpfi_matrix_interval_func_spec.rb
ruby-mpfi-0.0.2 spec/mpfi_matrix/mpfi_matrix_interval_func_spec.rb