るりまサーチ

最速Rubyリファレンスマニュアル検索!
55件ヒット [1-55件を表示] (0.014秒)
トップページ > クエリ:map[x] > 種類:モジュール関数[x]

別のキーワード

  1. matrix map
  2. _builtin map
  3. matrix map!
  4. _builtin flat_map
  5. set map!

ライブラリ

モジュール

キーワード

検索結果

LUSolve.#lusolve(a, b, ps, zero = 0.0) -> [BigDecimal] (19.0)

LU 分解を用いて、連立1次方程式 Ax = b の解 x を求めて返します。

...mal'
require 'bigdecimal/util'
require 'bigdecimal/ludcmp'

include LUSolve

a = [['1.0', '2.0'], ['3.0', '1.0']].flatten.map(&:to_d)
# x = ['1.0', -1.0']
b = ['-1.0', '2.0'].map(&:to_d)

zero = '0.0'.to_d
one = '1.0'.to_d
# 以下の 2 行は
ps = ludecomp(a, b.size, zero, one) # a が破壊的に...
...変更される
x = lusolve(a, b, ps, zero)
# こう書いてもよい
# x = lusolve(a, b, ludecomp(a, b.size, zero, one), zero)

p x.map(&:to_f) #=> [1.0, -1.0]
//}...

Kernel.#caller_locations(range) -> [Thread::Backtrace::Location] | nil (13.0)

現在のフレームを Thread::Backtrace::Location の配列で返します。引 数で指定した値が範囲外の場合は nil を返します。

...します。

//emlist[例][ruby]{
def test1(start, length)
locations = caller_locations(start, length)
p locations
p locations.map(&:lineno)
p locations.map(&:path)
end

def test2(start, length)
test1(start, length)
end

def test3(start, length)
test2(start, length)
end

caller_location...

Kernel.#caller_locations(start = 1, length = nil) -> [Thread::Backtrace::Location] | nil (13.0)

現在のフレームを Thread::Backtrace::Location の配列で返します。引 数で指定した値が範囲外の場合は nil を返します。

...します。

//emlist[例][ruby]{
def test1(start, length)
locations = caller_locations(start, length)
p locations
p locations.map(&:lineno)
p locations.map(&:path)
end

def test2(start, length)
test1(start, length)
end

def test3(start, length)
test2(start, length)
end

caller_location...

Benchmark.#bmbm(width = 0) {|job| ... } -> [Benchmark::Tms] (7.0)

Benchmark::Job オブジェクトを生成して、それを引数として与えられたブロックを 実行します。

...ことは保証されません。

@param width ラベルの幅を指定します。

//emlist[][ruby]{
require 'benchmark'

array = (1..1000000).map { rand }

Benchmark.bmbm do |x|
x.report("sort!") { array.dup.sort! }
x.report("sort") { array.dup.sort }
end

#=>
#
# Rehearsal --------------...

Process.#getrlimit(resource) -> [Integer] (7.0)

カレントプロセスでのリソースの制限値を、整数の配列として返します。 返り値は、現在の制限値 cur_limit と、制限値として設定可能な最大値 max_limit の 配列 [cur_limit, max_limit] です。

...(バイト) (NetBSD, FreeBSD)

例:

include Process
p lim = getrlimit(RLIMIT_STACK) #=> [8388608, 18446744073709551615]
p lim.map{|i| i == RLIM_INFINITY ? "unlimited" : "#{i/(1024**2)}MB" } #=> ["8MB", "unlimited"]

@see Process.#setrlimit, getrlimit(2)...

絞り込み条件を変える