The Perl Toolchain Summit 2025 Needs You: You can help 🙏 Learn more

NAME

Sidef::Types::Array::Matrix

DESCRIPTION

This class implements ...

SYNOPSIS

var A = Matrix(
[2, -3, 1],
[1, -2, -2],
[3, -4, 1],
)
var B = Matrix(
[9, -3, -2],
[3, -1, 7],
[2, -4, -8],
)
say (A + B) # matrix addition
say (A - B) # matrix subtraction
say (A * B) # matrix multiplication
say (A / B) # matrix division
say (A + 42) # matrix-scalar addition
say (A - 42) # matrix-scalar subtraction
say (A * 42) # matrix-scalar multiplication
say (A / 42) # matrix-scalar division
say A**20 # matrix exponentation
say A**-1 # matrix inverse: A^-1
say A**-2 # (A^2)^-1
say B.det # matrix determinant
say B.solve([1,2,3]) # solve a system of linear equations

INHERITS

Inherits methods from:

* Sidef::Types::Array::Array

METHODS

%

a % b

Returns the

Aliases: mod

&

a & b

Returns the

Aliases: and

*

a * b

Returns the

Aliases: mul

**

a ** b

Returns the

Aliases: pow

+

a + b

Returns the

Aliases: add

-

a - b

Returns the

Aliases: sub

/

a / b

Returns the

Aliases: ÷, div

^

a ^ b

Returns the

Aliases: xor

I

Matrix.I(n)

Returns the

Aliases: identity

|

a | b

Returns the

Aliases: or

abs

m1.abs

Returns the

anti_diagonal

self.anti_diagonal

Returns the

build

Matrix.build(n, m, block)

Returns the

ceil

self.ceil

Returns the

col

self.col(n)

Returns the

Aliases: column, get_column

col_len

A.col_len

Returns the

Aliases: col_size, col_count, column_len, column_size, column_count

cols

self.cols(*cols)

Returns the

Aliases: columns, from_cols, from_columns

col_vector

Matrix.col_vector(*list)

Returns the

Aliases: column_vector

concat

m1.concat(m2)

Returns the

det

self.det

Returns the

Aliases: determinant

det_bareiss

self.det_bareiss

Returns the

diagonal

self.diagonal

Returns the

flip

self.flip

Returns the

floor

self.floor

Returns the

gauss_jordan_invert

self.gauss_jordan_invert

Returns the

gauss_jordan_solve

self.gauss_jordan_solve(vector)

Returns the

horizontal_flip

self.horizontal_flip

Returns the

inv

self.inv

Returns the

Aliases: invert, inverse

invmod

self.invmod(mod)

Returns the

is_square

self.is_square

Returns the

neg

m1.neg

Returns the

new

self.new

Returns the

Aliases: call

powmod

A.powmod(pow, mod)

Returns the

prod

A.prod(block)

Returns the

Aliases: prod_by

rand

Matrix.rand(n, m)

Returns the

row

self.row(n)

Returns the

Aliases: get_row

row_len

A.row_len

Returns the

Aliases: row_size, row_count

rows

self.rows(*rows)

Returns the

Aliases: from_rows

row_vector

Matrix.row_vector(*list)

Returns the

rref

self.rref

Returns the

Aliases: reduced_row_echelon_form

scalar

Matrix.scalar(n, value)

Returns the

set_col

A.set_col(k, col)

Returns the

Aliases: set_column

set_row

A.set_row(k, row)

Returns the

size

self.size

Returns the

solve

self.solve(vector)

Returns the

sum

A.sum(block)

Returns the

Aliases: sum_by

t

matrix.t

Returns the

Aliases: not, transpose

to_a

A.to_a

Returns the

Aliases: to_array

to_s

self.to_s

Returns the

Aliases: dump, to_str

vec_cols

self.vec_cols

Returns the

Aliases: vec_columns, vector_columns

vec_rows

self.vec_rows

Returns the

Aliases: vector_rows

vertical_flip

self.vertical_flip

Returns the

zero

Matrix.zero(n, m)

Returns the