Matrix(T)
Inherits Enumerable < Reference < Object
Class methods
[](*rows : Array(U)) forall U
Sourcebuild(row_size : Int, column_size : Int = row_size, & : Int32, Int32 -> T)
Sourcecolumn_vector(column : Array(T))
Sourcecolumns(columns : Array(Array(T)))
Sourcecombine(*matrices, &)
Sourcediagonal(*values)
Sourceempty(row_size = 0, column_size = 0)
Sourcehstack(*matrices)
Sourceidentity(n : Int)
Sourcerow_vector(row : Array(T))
Sourcerows(rows : Array(Array(T)), copy = false)
Sourcescalar(n : Int, value : T)
Sourcezero(row_size : Int, column_size : Int = row_size)
SourceInstance methods
*(other) forall U
Source**(exponent : Int)
Source/(other) forall U
Source//(other) forall U
Source[](i : Int, j : Int)
Source[]=(i : Int, j : Int, value : T)
Source[]?(i : Int, j : Int)
Sourceadjugate
Sourceantisymmetric?
Sourceclone
Sourcecofactor(i : Int, j : Int)
Sourcecolumn_size
Sourcedet
Sourcediagonal?
Sourceeach(which = :all)
Sourceeach_with_index(which = :all, & : T -> )
Iterates over the collection, yielding both the elements and their index.
["Alice", "Bob"].each_with_index do |user, i|
puts "User ##{i}: #{user}"
end
Prints:
User # 0: Alice
User # 1: Bob
Accepts an optional offset parameter, which tells it to start counting from there. So, a more human friendly version of the previous snippet would be:
["Alice", "Bob"].each_with_index(1) do |user, i|
puts "User ##{i}: #{user}"
end
Which would print:
User # 1: Alice
User # 2: Bob
empty?
Returns true if self does not contain any element.
([] of Int32).empty? # => true
([1]).empty? # => false
[nil, false].empty? # => false
#present?returns the inverse.
first_minor(i : Int, j : Int)
Sourceinv
Sourcerow(i : Int)
Sourcerow_size
Sourceskew_symmetric?
Sourcesquare?
Sourceswap_column(i : Int, j : Int)
Sourceswap_row(i : Int, j : Int)
Sourcesweep(extended? : Bool = false) : Int32
Sourcesymmetric?
Sourceto_s(io : IO)
Appends a short String representation of this object which includes its class name and its object address.
class Person
def initialize(@name : String, @age : Int32)
end
end
Person.new("John", 32).to_s # => #<Person:0x10a199f20>
unsafe_fetch(i : Int, j : Int)
Sourceunsafe_put(i : Int, j : Int, value : T)
Source