class Matrix(T)

Included Modules

Defined in:

matrix.cr

Class Method Summary

Instance Method Summary

Class Method Detail

def self.[](*rows : Array(U)) forall U #

[View source]
def self.build(row_size : Int, column_size : Int = row_size, & : Int32, Int32 -> T) #

[View source]
def self.column_vector(column : Array(T)) #

[View source]
def self.columns(columns : Array(Array(T))) #

[View source]
def self.combine(*matrices, &) #

[View source]
def self.diagonal(*values) #

[View source]
def self.empty(row_size = 0, column_size = 0) #

[View source]
def self.hstack(*matrices) #

[View source]
def self.identity(n : Int) #

[View source]
def self.row_vector(row : Array(T)) #

[View source]
def self.rows(rows : Array(Array(T)), copy = false) #

[View source]
def self.scalar(n : Int, value : T) #

[View source]
def self.vstack(*matrices : Matrix(T)) #

[View source]
def self.zero(row_size : Int, column_size : Int = row_size) #

[View source]

Instance Method Detail

def &(other : Matrix(U)) forall U #

[View source]
def *(other : Matrix(U)) forall U #

[View source]
def *(other) forall U #

[View source]
def **(exponent : Int) #

[View source]
def +(other : Matrix(U)) forall U #

[View source]
def -(other : Matrix(U)) forall U #

[View source]
def /(other) forall U #

[View source]
def //(other) forall U #

[View source]
def ==(other : Matrix(U)) forall U #

[View source]
def [](i : Int, j : Int) #

[View source]
def []=(i : Int, j : Int, value : T) #

[View source]
def []?(i : Int, j : Int) #

[View source]
def ^(other : Matrix(U)) forall U #

[View source]
def |(other : Matrix(U)) forall U #

[View source]
def adjugate #

[View source]
def antisymmetric? #

[View source]
def clone #

[View source]
def cofactor(i : Int, j : Int) #

[View source]
def column_size : Int32 #

[View source]
def det #

[View source]
def diagonal? #

[View source]
def each(which = :all, &block : T -> ) #
Description copied from module Enumerable(T)

Must yield this collection's elements to the block.


[View source]
def each(which = :all) #

[View source]
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

[View source]
def empty? #
Description copied from module Enumerable(T)

Returns true if self is empty, false otherwise.

([] of Int32).empty? # => true
([1]).empty?         # => false

[View source]
def first_minor(i : Int, j : Int) #

[View source]
def inv #

[View source]
def row(i : Int) #

[View source]
def row_size : Int32 #

[View source]
def skew_symmetric? #

[View source]
def square? #

[View source]
def swap_column(i : Int, j : Int) #

[View source]
def swap_row(i : Int, j : Int) #

[View source]
def sweep(extended? : Bool = false) : Int32 #

[View source]
def symmetric? #

[View source]
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>

[View source]
def unsafe_fetch(i : Int, j : Int) #

[View source]
def unsafe_put(i : Int, j : Int, value : T) #

[View source]