Returns true
iff the current severity level allows for the printing of WARN
messages.
Returns true
iff the current severity level allows for the printing of ERROR
messages.
Creates an n
by n
diagonal matrix where each diagonal element is value
.
Matrix.scalar(2, 5) => 5 0 0 5
Returns true
if this is a regular (i.e. non-singular) matrix.
Returns true
if this is a singular matrix.
Returns true
if this is a square matrix.
Returns true
if this is a unitary matrix Raises an error if matrix is not square.
Returns the rank of the matrix. Beware that using Float
values can yield erroneous results because of their lack of precision. Consider using exact types like Rational
or BigDecimal
instead.
Matrix[[7,6], [3,9]].rank => 2
deprecated; use Matrix#rank
Returns the trace (sum of diagonal elements) of the matrix.
Matrix[[7,6], [3,9]].trace => 16
Returns the transpose of the matrix.
Matrix[[1,2], [3,4], [5,6]] => 1 2 3 4 5 6 Matrix[[1,2], [3,4], [5,6]].transpose => 1 3 5 2 4 6
Returns the imaginary part of the matrix.
Matrix[[Complex(1,2), Complex(0,1), 0], [1, 2, 3]] => 1+2i i 0 1 2 3 Matrix[[Complex(1,2), Complex(0,1), 0], [1, 2, 3]].imaginary => 2i i 0 0 0 0
Puts option summary into to
and returns to
. Yields each line if a block is given.
to
Output destination, which must have method <<. Defaults to [].
width
Width of left side, defaults to @summary_width.
max
Maximum length allowed for left side, defaults to width
- 1.
indent
Indentation, defaults to @summary_indent.
Parses command line arguments argv
in order when environment variable POSIXLY_CORRECT is set, and in permutation mode otherwise.
Same as parse
, but removes switches destructively. Non-option arguments remain in argv
.
Searches key
in @stack for id
hash and returns or yields the result.
Puts option summary into to
and returns to
. Yields each line if a block is given.
to
Output destination, which must have method <<. Defaults to [].
width
Width of left side, defaults to @summary_width.
max
Maximum length allowed for left side, defaults to width
- 1.
indent
Indentation, defaults to @summary_indent.
Parses command line arguments argv
in order when environment variable POSIXLY_CORRECT is set, and in permutation mode otherwise.
Same as parse
, but removes switches destructively. Non-option arguments remain in argv
.
Searches key
in @stack for id
hash and returns or yields the result.