module CAMath


carray/basic.rb

This file is part of Ruby/CArray extension library.

Copyright (C) 2005-2020 Hiroki Motoyoshi

Public Instance Methods

max(*argv) click to toggle source
# File lib/carray/math.rb, line 177
def max (*argv)
  if ary = argv.find{|x| x.is_a?(CArray) }
    out = ary.to_ca
    argv.delete(ary)
    argv.each do |x|
      out.pmax!(x)
    end
  else
    raise "args should contain more than one CArray object"
  end
  return out
end
min(*argv) click to toggle source
# File lib/carray/math.rb, line 164
def min (*argv)
  if ary = argv.find{|x| x.is_a?(CArray) }
    out = ary.to_ca
    argv.delete(ary)
    argv.each do |x|
      out.pmin!(x)
    end
  else
    raise "args should contain more than one CArray object"
  end
  return out
end