Returns an array containing the environment variable values associated with the given names. See also ENV.select
.
Returns the external encoding for files read from ARGF
as an Encoding
object. The external encoding is the encoding of the text as stored in a file. Contrast with ARGF.internal_encoding
, which is the encoding used to represent this text within Ruby.
To set the external encoding use ARGF.set_encoding
.
For example:
ARGF.external_encoding #=> #<Encoding:UTF-8>
Returns the internal encoding for strings read from ARGF
as an Encoding
object.
If ARGF.set_encoding
has been called with two encoding names, the second is returned. Otherwise, if Encoding.default_external
has been set, that value is returned. Failing that, if a default external encoding was specified on the command-line, that value is used. If the encoding is unknown, nil
is returned.
This method is a shortcut for converting a single row (Array) into a CSV
String.
The options
parameter can be anything CSV::new()
understands. This method understands an additional :encoding
parameter to set the base Encoding
for the output. This method will try to guess your Encoding
from the first non-nil
field in row
, if possible, but you may need to use this parameter as a backup plan.
The :row_sep
option
defaults to $INPUT_RECORD_SEPARATOR
($/
) when calling this method.
This method is a shortcut for converting a single line of a CSV
String into an Array. Note that if line
contains multiple rows, anything beyond the first row is ignored.
The options
parameter can be anything CSV::new()
understands.
Returns true
if illegal input is handled. See CSV::new
for details.
Pre-compiles parsers and stores them by name for access during reads.
Stores the pattern of comments to skip from the provided options.
The pattern must respond to .match
, else ArgumentError
is raised. Strings are converted to a Regexp
.
See also CSV.new
This method is used to turn a finished row
into a CSV::Row
. Header rows are also dealt with here, either by returning a CSV::Row
with identical headers and fields (save that the fields do not go through the converters) or by reading past them to return a field row. Headers are also saved in @headers
for use in future rows.
When nil
, row
is assumed to be a header row not based on an actual row of the stream.
Return the appropriate error message in POSIX-defined format. If no error has occurred, returns nil.
Returns a string for DNS reverse lookup compatible with RFC3172.
Returns the Laplace expansion along given row or column.
Matrix[[7,6], [3,9]].laplace_expansion(column: 1) => 45 Matrix[[Vector[1, 0], Vector[0, 1]], [2, 3]].laplace_expansion(row: 0) => Vector[3, -2]
Hadamard product
Matrix[[1,2], [3,4]].hadamard_product(Matrix[[1,2], [3,2]]) => 1 4 9 8
Private. Use Matrix#determinant
Returns the determinant of the matrix, using Bareiss’ multistep integer-preserving gaussian elimination. It has the same computational cost order O(n^3) as standard Gaussian elimination. Intermediate results are fraction free and of lower complexity. A matrix of Integers will have thus intermediate results that are also Integers, with smaller bignums (if any), while a matrix of Float
will usually have intermediate results with better precision.
Explicit conversion to a Matrix
. Returns self