Sha256: 7df1f14b6597542d327ec3706291779750ec771a0a0ac218447c544c0db55e6c
Contents?: true
Size: 826 Bytes
Versions: 3
Compression:
Stored size: 826 Bytes
Contents
require 'rubygems' require "test/unit" require 'shoulda' require 'mdarray' class MDArrayTest < Test::Unit::TestCase context "Statistics Tests" do setup do # create a byte array filled with 0's @a = MDArray.typed_arange("double", 10_000) @weight = MDArray.arange(10_000) # create double array @b = MDArray.double([2, 3, 4]) end #------------------------------------------------------------------------------------- # #------------------------------------------------------------------------------------- should "do stats operations" do assert_equal(49995000, @a.sum) assert_equal(0, @a.min) assert_equal(9999, @a.max) assert_equal(4999.5, @a.mean) assert_equal(6666.333333333333, @a.weighted_mean(@weight)[0]) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mdarray-0.4.3-java | test/test_statistics.rb |
mdarray-0.4.3.pre-java | test/test_statistics.rb |
mdarray-0.4.2-java | test/test_statistics.rb |