matrix

package
v0.0.0-...-a4d355c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 18, 2024 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Overview

matrix is a package that defines a matrix type, and operations on it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func String

func String(m Matrix) string

String returns a string representation of the matrix

Types

type Matrix

type Matrix struct {
	// contains filtered or unexported fields
}

Matrix is a slice of slice of int of a specified size

func Add

func Add(m1 Matrix, m2 Matrix) (res Matrix, valid bool)

Add adds two matrices if their dimensions are the same It returns a new matrix with the addition results, and the validity of the operation

func New

func New(r int, c int) Matrix

New creates a new matrix with r rows and c columns

func Subtract

func Subtract(m1 Matrix, m2 Matrix) (res Matrix, valid bool)

Subtract subtracts two matrices, m2 from m1, if their dimensions are the same It returns a new matrix with the addition results, and the validity of the operation

func (*Matrix) Add

func (m *Matrix) Add(other Matrix)

func (*Matrix) Get

func (m *Matrix) Get(x int, y int) (result int)

func (*Matrix) Set

func (m *Matrix) Set(x int, y int, value int) (result bool)

func (*Matrix) Size

func (m *Matrix) Size() (int, int)

func (Matrix) String

func (m Matrix) String() string

func (*Matrix) Subtract

func (m *Matrix) Subtract(other Matrix)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL