matrix

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package matrix can be used to wrap a DataFrame such that it implements the Matrix interface found in various external packages such as gonum.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Matrix

type Matrix interface {
	// Dims returns the dimensions of a Matrix.
	Dims() (r, c int)

	// At returns the value of a matrix element at row i, column j.
	// It will panic if i or j are out of bounds for the matrix.
	At(i, j int) float64

	// T returns the transpose of the Matrix. Whether T returns a copy of the
	// underlying data is implementation dependent.
	// This method may be implemented using the Transpose type, which
	// provides an implicit matrix transpose.
	T() Matrix
}

Matrix replicates gonum/mat Matrix interface.

type MatrixWrap

type MatrixWrap struct {
	*dataframe.DataFrame
}

MatrixWrap is used to wrap a dataframe so that it can satisfy the Matrix interface. All Series contained by DataFrame must be of type SeriesFloat64.

func (MatrixWrap) At

func (m MatrixWrap) At(i, j int) float64

At returns the value of a matrix element at row i, column j. It will panic if i or j are out of bounds for the matrix.

func (MatrixWrap) Dims

func (m MatrixWrap) Dims() (r, c int)

Dims returns the dimensions of a Matrix.

func (MatrixWrap) Set

func (m MatrixWrap) Set(i, j int, v float64)

Set alters the matrix element at row i, column j to v. It will panic if i or j are out of bounds for the matrix.

func (MatrixWrap) T

func (m MatrixWrap) T() Matrix

T returns the transpose of the MatrixWrap. It returns a copy instead of performing the operation "in-place".

Jump to

Keyboard shortcuts

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