Documentation
¶
Overview ¶
filename: strassenmatrixmultiply.go description: Implements matrix multiplication using the Strassen algorithm. details: This program takes two matrices as input and performs matrix multiplication using the Strassen algorithm, which is an optimized divide-and-conquer approach. It allows for efficient multiplication of large matrices. author(s): Mohit Raghav(https://github.com/mohit07raghav19) See strassenmatrixmultiply_test.go for test cases
Index ¶
- func IsValid[T constraints.Integer](elements [][]T) bool
- type Matrix
- func (m1 Matrix[T]) Add(m2 Matrix[T]) (Matrix[T], error)
- func (m1 Matrix[T]) CheckEqual(m2 Matrix[T]) bool
- func (m Matrix[T]) Columns() int
- func (m Matrix[T]) Copy() (Matrix[T], error)
- func (m Matrix[T]) Get(row, col int) (T, error)
- func (m Matrix[T]) MatchDimensions(m1 Matrix[T]) bool
- func (m1 Matrix[T]) Multiply(m2 Matrix[T]) (Matrix[T], error)
- func (m Matrix[T]) Rows() int
- func (m Matrix[T]) Set(row, col int, val T) error
- func (A Matrix[T]) StrassenMatrixMultiply(B Matrix[T]) (Matrix[T], error)
- func (m Matrix[T]) String() string
- func (m Matrix[T]) SubMatrix(rowStart, colStart, numRows, numCols int) (Matrix[T], error)
- func (m1 Matrix[T]) Subtract(m2 Matrix[T]) (Matrix[T], error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsValid ¶
func IsValid[T constraints.Integer](elements [][]T) bool
IsValid checks if the input matrix has consistent row lengths.
Types ¶
type Matrix ¶
type Matrix[T constraints.Integer] struct { // contains filtered or unexported fields }
func New ¶
func New[T constraints.Integer](rows, columns int, initial T) Matrix[T]
NewMatrix creates a new Matrix based on the provided arguments.
func NewFromElements ¶
func NewFromElements[T constraints.Integer](elements [][]T) (Matrix[T], error)
NewFromElements creates a new Matrix from the given elements.
func (Matrix[T]) CheckEqual ¶
CheckEqual checks if the current matrix is equal to another matrix (m2). Two matrices are considered equal if they have the same dimensions and all their elements are equal.
func (Matrix[T]) MatchDimensions ¶
MatchDimensions checks if two matrices have the same dimensions.
func (Matrix[T]) Multiply ¶
Multiply multiplies the current matrix (m1) with another matrix (m2) and returns the result as a new matrix.
func (Matrix[T]) StrassenMatrixMultiply ¶
Perform matrix multiplication using Strassen's algorithm