Sha256: e51fdd0822cfa8aff2e4d5ee3510d2a0564d1bab76a65865f5525d8b2abde39c

Contents?: true

Size: 271 Bytes

Versions: 4

Compression:

Stored size: 271 Bytes

Contents

module MPI

  module_function

  def task_divide(m, size)
    dm = m.to_f/size
    ary = Array.new(size)
    ary[0] = dm.round
    sum = ary[0]
    (size-1).times do|i|
      ary[i+1] = (dm*(i+2)).round - sum
      sum += ary[i+1]
    end
    ary
  end

end # module MPI

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ruby-mpi-0.4.0 lib/mpi/utils.rb
ruby-mpi-0.3.2 lib/mpi/utils.rb
ruby-mpi-0.3.1 lib/mpi/utils.rb
ruby-mpi-0.3.0 lib/mpi/utils.rb