small refactoring including doc

Former-commit-id: 6d6b527d89d77aa571831f7500f841840e280536
This commit is contained in:
2023-08-27 15:52:28 +02:00
parent f1025f97b8
commit 7b7128196a
4 changed files with 17 additions and 8 deletions

View File

@ -33,6 +33,15 @@ func Make2DArray[T any](rows, cols int) Matrix[T] {
return matrix
}
// Make2DNumericArray generates a 2D numeric array with the specified number of rows and columns.
//
// Parameters:
// - rows: the number of rows in the array.
// - cols: the number of columns in the array.
// - zeroed: a boolean indicating whether the array should be initialized with zeros.
//
// Returns:
// - matrix: a 2D numeric array with the specified dimensions.
func Make2DNumericArray[T Numeric](rows, cols int, zeroed bool) Matrix[T] {
matrix := make(Matrix[T], rows)
data := make([]T, cols*rows)