Returns true
if this is a permutation matrix Raises an error if matrix is not square.
Returns the conjugate 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]].conjugate => 1-2i -i 0 1 2 3
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
Iterate over the elements of this vector
Iterate over the elements of this vector and v
in conjunction.
Returns the modulus (Pythagorean distance) of the vector.
Vector[5,8,2].r => 9.643650761
Like Vector#collect2
, but returns a Vector
instead of an Array.
Returns a new vector with the same direction but with norm 1.
v = Vector[5,8,2].normalize # => Vector[0.5184758473652127, 0.8295613557843402, 0.20739033894608505] v.norm => 1.0
Terminates option parsing. Optional parameter arg
is a string pushed back to be the first non-option argument.
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.
Add separator in summary.
Searches key
in @stack for id
hash and returns or yields the result.
Parses environment variable env
or its uppercase with splitting like a shell.
env
defaults to the basename of the program.
Iterates the given block over all prime numbers.
ubound
Optional. An arbitrary positive number. The upper bound of enumeration. The method enumerates prime numbers infinitely if ubound
is nil.
generator
Optional. An implementation of pseudo-prime generator.
An evaluated value of the given block at the last time. Or an enumerator which is compatible to an Enumerator
if no block given.
Calls block
once for each prime number, passing the prime as a parameter.
ubound
Upper bound of prime numbers. The iterator stops after it yields all prime numbers p <= ubound
.
Returns the path to the data store file.
Returns a string containing the character represented by the int
‘s value according to encoding
.
65.chr #=> "A" 230.chr #=> "\346" 255.chr(Encoding::UTF_8) #=> "\303\277"
Returns the smallest number than or equal to int
in decimal digits (default 0 digits).
Precision may be negative. Returns a floating point number when ndigits
is positive, self
for zero, and truncate up for negative.
1.truncate #=> 1 1.truncate(2) #=> 1.0 15.truncate(-1) #=> 10
Returns the remainder after dividing big by numeric as:
x.remainder(y) means x-y*(x/y).truncate
Examples
5.remainder(3) #=> 2 -5.remainder(3) #=> -2 5.remainder(-3) #=> 2 -5.remainder(-3) #=> -2 -1234567890987654321.remainder(13731) #=> -6966 -1234567890987654321.remainder(13731.24) #=> -9906.22531493148
See Numeric#divmod
.
Returns the absolute value of int
.
-12345.abs #=> 12345 12345.abs #=> 12345 -1234567890987654321.abs #=> 1234567890987654321
Returns self.
Returns 1.