Log an INFO
message.
message
The message to log; does not need to be a String
.
progname
In the block form, this is the progname
to use in the log message. The default can be set with progname=
.
block
Evaluates to the message to log. This is not evaluated unless the logger’s level is sufficient to log the message. This allows you to create potentially expensive logging messages that are only called when the logger is configured to show them.
logger.info("MainApp") { "Received connection from #{ip}" } # ... logger.info "Waiting for input from user" # ... logger.info { "User typed #{input}" }
You’ll probably stick to the second form above, unless you want to provide a program name (which you can do with progname=
as well).
See add
.
Create a matrix by combining matrices entrywise, using the given block
x = Matrix[[6, 6], [4, 4]] y = Matrix[[1, 2], [3, 4]] Matrix.combine(x, y) {|a, b| a - b} # => Matrix[[5, 4], [1, 0]]
The index method is specialized to return the index as [row, column] It also accepts an optional selector
argument, see each
for details.
Matrix[ [1,2], [3,4] ].index(&:even?) # => [0, 1] Matrix[ [1,1], [1,1] ].index(1, :strict_lower) # => [1, 0]
Returns true
if this is an hermitian matrix. Raises an error if matrix is not square.
Returns true
if this is a normal matrix. Raises an error if matrix is not square.
Returns true
if this is a singular matrix.
Overrides Object#inspect
Returns true
iff all of vectors are linearly independent.
Vector.independent?(Vector[1,0], Vector[0,1]) => true Vector.independent?(Vector[1,2], Vector[2,4]) => false
Returns true
iff all of vectors are linearly independent.
Vector[1,0].independent?(Vector[0,1]) => true Vector[1,2].independent?(Vector[2,4]) => false
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
Overrides Object#inspect
Returns an incremented value of default
according to arg
.
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.