// Returns a new dense matrix with the given number of rows and columns. func NewMatrix(rows, columns int) *Matrix { return &Matrix{ &DenseMat{ common.NewCoreMat(false, rows, columns, columns, 1, 0, 0), make([]float64, rows*columns), }, } }
// Returns a new sparse matrix with the given number of rows and columns. func NewSparseMatrix(rows, columns int) *Matrix { return &Matrix{ &SparseMat{ common.NewCoreMat(false, rows, columns, columns, 1, 0, 0), make(map[int]float64), }, } }
func newWrapperMatrix(content Matrix) *WrapperMatrix { wm := &WrapperMat{ common.NewCoreMat(false, content.Rows(), content.Columns(), content.Columns(), 1, 0, 0), content, } return &WrapperMatrix{ Matrix{wm}, wm, } }
func (m *SparseMat) Like(rows, columns int) Mat { return &SparseMat{ common.NewCoreMat(false, rows, columns, columns, 1, 0, 0), make(map[int]float64), } }
func (m *DenseMat) Like(rows, columns int) Mat { return &DenseMat{ common.NewCoreMat(false, rows, columns, columns, 1, 0, 0), make([]float64, rows*columns), } }