mirror of
https://github.com/metabarcoding/obitools4.git
synced 2025-06-29 16:20:46 +00:00
first trial of obilandmark
Former-commit-id: 00a50bdbf407b03dfdc385a848a536559f5966a5
This commit is contained in:
@ -22,6 +22,17 @@ func Make2DArray[T any](rows, cols int) Matrix[T] {
|
||||
return matrix
|
||||
}
|
||||
|
||||
// Init initializes the Matrix with the given value.
|
||||
//
|
||||
// value: the value to initialize the Matrix elements with.
|
||||
func (matrix *Matrix[T]) Init(value T) {
|
||||
data := (*matrix)[0]
|
||||
data = data[0:cap(data)]
|
||||
for i := range data {
|
||||
data[i] = value
|
||||
}
|
||||
}
|
||||
|
||||
// Row returns the i-th row of the matrix.
|
||||
//
|
||||
// Parameters:
|
||||
@ -38,3 +49,11 @@ func (matrix *Matrix[T]) Column(i int) []T {
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
// Dim returns the dimensions of the Matrix.
|
||||
//
|
||||
// It takes no parameters.
|
||||
// It returns two integers: the number of rows and the number of columns.
|
||||
func (matrix *Matrix[T]) Dim() (int, int) {
|
||||
return len(*matrix), len((*matrix)[0])
|
||||
}
|
||||
|
Reference in New Issue
Block a user