Exemple #1
0
// 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),
		},
	}
}
Exemple #2
0
// 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),
		},
	}
}
Exemple #3
0
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,
	}
}
Exemple #4
0
func (m *SparseMat) Like(rows, columns int) Mat {
	return &SparseMat{
		common.NewCoreMat(false, rows, columns, columns, 1, 0, 0),
		make(map[int]float64),
	}
}
Exemple #5
0
func (m *DenseMat) Like(rows, columns int) Mat {
	return &DenseMat{
		common.NewCoreMat(false, rows, columns, columns, 1, 0, 0),
		make([]float64, rows*columns),
	}
}