Skip to content

Add common method for number of colums and rows #92

Closed
@stewi1014

Description

Currently the library's open methods on matrices do not easily conform to a single unified interface very well.

The At(row, col) -> n function is the only function (save me being blind) that is commonly implemented across all matrix implementations.

I propose that all matrix implementations implement a common interface;

interface {
	At(row, col int) float32 | float64
	NumRows() int
	NumCols() int
}

I personally like the garbage-in garbage-out approach from implementations of .At in this library, but I do feel that all matrices should also provide .NumRows() and .NumCols() like MatMxN does, or some equivalent.

In the case of generalized methods that can operate on matrices of varying dimensions, this would allow one to implement methods that can operate on all matrix implementations in this library using an interface, avoiding the need to duplicate functions or type-switch to find the dimensions of a matrix.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions