るりまサーチ

最速Rubyリファレンスマニュアル検索!
155件ヒット [1-100件を表示] (0.037秒)

別のキーワード

  1. kernel require
  2. getoptlong require_order
  3. rubygems/custom_require require
  4. irb/ext/use-loader irb_require
  5. require execute

ライブラリ

クラス

モジュール

キーワード

検索結果

<< 1 2 > >>

Matrix.zero(n) -> Matrix (18116.0)

n × n の零行列(要素が全て 0 の行列)を生成して返します。

...n × n の零行列(要素が全て 0 の行列)を生成して返します。

//emlist[例][ruby]{
require
'matrix'
p Matrix.zero(2) #=> Matrix[[0, 0], [0, 0]]
//}

@param n 生成する正方零行列の次数...

Matrix.zero(row, column) -> Matrix (18116.0)

row × column の零行列(要素が全て 0 の行列)を生成して返します。

...row × column の零行列(要素が全て 0 の行列)を生成して返します。

//emlist[例][ruby]{
require
'matrix'
p Matrix.zero(2, 3) #=> Matrix[[0, 0, 0], [0, 0, 0]]
//}

@param row 生成する行列の行数
@param column 生成する行列の列数...

Vector.zero(size) -> Vector (18113.0)

零ベクトルを返します。

...零ベクトルを返します。

//emlist[例][ruby]{
require
'matrix'
Vector.zero(3) # => Vector[0, 0, 0]
//}

@param size ベクトルの次元...

BigDecimal#zero? -> bool (6119.0)

self が 0 のときに true を返します。それ以外のときに false を返します。

...self が 0 のときに true を返します。それ以外のときに false を返します。

//emlist[][ruby]{
require
"bigdecimal"
BigDecimal("0").zero? # => true
BigDecimal("1").zero? # => false
//}...

BigDecimal#nonzero? -> self | nil (6106.0)

self が 0 以外のときに self を返します。0 のときに nil を返します。

...self が 0 以外のときに self を返します。0 のときに nil を返します。

//emlist[][ruby]{
require
"bigdecimal"
BigDecimal("0").nonzero? # => nil
BigDecimal("1").nonzero? # => 0.1e1
//}...

絞り込み条件を変える

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

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

...す。

@param zero 0.0 を表す値を指定します。

//emlist[][ruby]{
require
'bigdecimal'
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
o...
...ne = '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]
//}...

Pathname#empty? -> bool (30.0)

ディレクトリに対しては Dir.empty?(self.to_s) と同じ、他に対しては FileTest.empty?(self.to_s) と同じです。

...[例 ディレクトリの場合][ruby]{
require
"pathname"
require
'tmpdir'

Pathname("/usr/local").empty? # => false
Dir.mktmpdir { |dir| Pathname(dir).empty? } # => true
//}

//emlist[例 ファイルの場合][ruby]{
require
"pathname"
require
'tempfile'

Pathname("testfile").empty...
...? # => false
Tempfile.create("tmp") { |tmp| Pathname(tmp).empty? } # => true
//}

@see Dir.empty?, FileTest.#empty?, Pathname#zero?...

Array#pack(template) -> String (24.0)

配列の内容を template で指定された文字列にしたがって、 バイナリとしてパックした文字列を返します。

..."0" ? +1.0 : -1.0
exp = Integer("0b" + e)
fra = Integer("0b" + f)
if exp == 0
if fra == 0
sgn * 0 # ±0 (positive/negative zero)
else
sgn * fra * 2**(-126-23) # 非正規化数 (denormalized number)
end
elsif exp == 255
if fra == 0
sgn * Inf...
..."0" ? +1.0 : -1.0
exp = Integer("0b" + e)
fra = Integer("0b" + f)
if exp == 0
if fra == 0
sgn * 0 # ±0 (positive/negative zero)
else
sgn * fra * 2**(-1022-52) # 非正規化数 (denormalized number)
end
elsif exp == 2047
if fra == 0
sgn * Inf...
...ong(その2)
//emlist[][ruby]{
s = "\xFF\xFF\xFF\xFE"
n = s.unpack("N").pack("l").unpack("l")[0]
n # => -2
//}

: IPアドレス
//emlist[][ruby]{
require
'socket'
official_hostname, alias_hostnames, address_family, *address_list = Socket.gethostbyname("localhost")
address_list.find {|address| addre...

Array#pack(template, buffer: String.new) -> String (24.0)

配列の内容を template で指定された文字列にしたがって、 バイナリとしてパックした文字列を返します。

..."0" ? +1.0 : -1.0
exp = Integer("0b" + e)
fra = Integer("0b" + f)
if exp == 0
if fra == 0
sgn * 0 # ±0 (positive/negative zero)
else
sgn * fra * 2**(-126-23) # 非正規化数 (denormalized number)
end
elsif exp == 255
if fra == 0
sgn * Inf...
..."0" ? +1.0 : -1.0
exp = Integer("0b" + e)
fra = Integer("0b" + f)
if exp == 0
if fra == 0
sgn * 0 # ±0 (positive/negative zero)
else
sgn * fra * 2**(-1022-52) # 非正規化数 (denormalized number)
end
elsif exp == 2047
if fra == 0
sgn * Inf...
...ong(その2)
//emlist[][ruby]{
s = "\xFF\xFF\xFF\xFE"
n = s.unpack("N").pack("l").unpack("l")[0]
n # => -2
//}

: IPアドレス
//emlist[][ruby]{
require
'socket'
official_hostname, alias_hostnames, address_family, *address_list = Socket.gethostbyname("localhost")
address_list.find {|address| addre...

BigDecimal#sign -> -3 | -2 | -1 | 0 | 1 | 2 | 3 (24.0)

自身の符号等の性質に応じて、Integer を返します。

...0。 BigDecimal::SIGN_NaN と同じです。
+0 であれば、 1。 BigDecimal::SIGN_POSITIVE_ZERO と同じです。
-0 であれば、-1。 BigDecimal::SIGN_NEGATIVE_ZERO と同じです。
有限の正の値 であれば、 2。 BigDecimal::SIGN_POSITIVE_FINITE と同じ...
...あっても、+ か - の符号を持つことに注意して下さい。
(「lib:bigdecimal#internal_structure」を参照)

//emlist[][ruby]{
require
"bigdecimal"

p BigDecimal("NaN").sign # => 0
p BigDecimal("0").sign # => 1
p BigDecimal("100").sign # => 2
p BigDecimal("In...
...finity").sign # => 3
p BigDecimal("-0").sign # => -1
p BigDecimal("-5").sign # => -2
p BigDecimal("-Infinity").sign # => -3

p BigDecimal("0").sign == BigDecimal::SIGN_POSITIVE_ZERO # => true
//}...

絞り込み条件を変える

<< 1 2 > >>