mirror of
https://github.com/metabarcoding/obitools4.git
synced 2025-06-29 16:20:46 +00:00
Patch a bug in the Dim function
Former-commit-id: 004545e81df4dcf33294fb062de8204692035cdf
This commit is contained in:
@ -93,5 +93,13 @@ func (matrix *Matrix[T]) Rows(i ...int) Matrix[T] {
|
|||||||
// It takes no parameters.
|
// It takes no parameters.
|
||||||
// It returns two integers: the number of rows and the number of columns.
|
// It returns two integers: the number of rows and the number of columns.
|
||||||
func (matrix *Matrix[T]) Dim() (int, int) {
|
func (matrix *Matrix[T]) Dim() (int, int) {
|
||||||
|
switch {
|
||||||
|
case *matrix == nil:
|
||||||
|
return 0, 0
|
||||||
|
case len(*matrix) == 0:
|
||||||
|
return 0, 0
|
||||||
|
case len((*matrix)[0]) == 0:
|
||||||
|
return len(*matrix), 0
|
||||||
|
}
|
||||||
return len(*matrix), len((*matrix)[0])
|
return len(*matrix), len((*matrix)[0])
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user