class Matrix(T)
- Matrix(T)
- Reference
- Object
Included Modules
- Enumerable(T)
Defined in:
matrix.crClass Method Summary
- .[](*rows : Array(U)) forall U
- .build(row_size : Int, column_size : Int = row_size, & : Int32, Int32 -> T)
- .column_vector(column : Array(T))
- .columns(columns : Array(Array(T)))
- .combine(*matrices, &)
- .diagonal(*values)
- .empty(row_size = 0, column_size = 0)
- .hstack(*matrices)
- .identity(n : Int)
- .row_vector(row : Array(T))
- .rows(rows : Array(Array(T)), copy = false)
- .scalar(n : Int, value : T)
- .vstack(*matrices : Matrix(T))
- .zero(row_size : Int, column_size : Int = row_size)
Instance Method Summary
- #&(other : Matrix(U)) forall U
- #*(other : Matrix(U)) forall U
- #*(other) forall U
- #**(exponent : Int)
- #+(other : Matrix(U)) forall U
- #-(other : Matrix(U)) forall U
- #/(other) forall U
- #//(other) forall U
- #==(other : Matrix(U)) forall U
- #[](i : Int, j : Int)
- #[]=(i : Int, j : Int, value : T)
- #[]?(i : Int, j : Int)
- #^(other : Matrix(U)) forall U
- #|(other : Matrix(U)) forall U
- #adjugate
- #antisymmetric?
- #clone
- #cofactor(i : Int, j : Int)
- #column_size : Int32
- #det
- #diagonal?
-
#each(which = :all, &block : T -> )
Must yield this collection's elements to the block.
- #each(which = :all)
-
#each_with_index(which = :all, & : T -> )
Iterates over the collection, yielding both the elements and their index.
-
#empty?
Returns
true
ifself
is empty,false
otherwise. - #first_minor(i : Int, j : Int)
- #inv
- #row(i : Int)
- #row_size : Int32
- #skew_symmetric?
- #square?
- #swap_column(i : Int, j : Int)
- #swap_row(i : Int, j : Int)
- #sweep(extended? : Bool = false) : Int32
- #symmetric?
-
#to_s(io : IO)
Appends a short String representation of this object which includes its class name and its object address.
- #unsafe_fetch(i : Int, j : Int)
- #unsafe_put(i : Int, j : Int, value : T)
Class Method Detail
Instance Method Detail
def each(which = :all, &block : T -> )
#
Description copied from module Enumerable(T)
Must yield this collection's elements to the block.
def each_with_index(which = :all, & : T -> )
#
Description copied from module Enumerable(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
def empty?
#
Description copied from module Enumerable(T)
Returns true
if self
is empty, false
otherwise.
([] of Int32).empty? # => true
([1]).empty? # => false
def to_s(io : IO)
#
Description copied from class Reference
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>