Fix primitive array functions handling empty arrays
This commit is contained in:
parent
b924d960b5
commit
c3c14eba04
3 changed files with 13 additions and 108 deletions
|
|
@ -512,9 +512,12 @@ decompLUP : FieldCmp a => (mat : Matrix m n a) -> DecompLUP mat
|
|||
decompLUP {m,n} mat with (viewShape mat)
|
||||
decompLUP {m=0,n} mat | Shape [0,n] = MkLUP mat identity 0
|
||||
decompLUP {m=S m,n=0} mat | Shape [S m,0] = MkLUP mat identity 0
|
||||
decompLUP {m=S m,n=S n} mat | Shape [S m,S n] =
|
||||
iterateN (S $ minimum m n) gaussStepSwap (MkLUP mat identity 0)
|
||||
decompLUP {m=S m,n=S n} mat | Shape [S m,S n] = undelay $
|
||||
iterateN (S $ minimum m n) gaussStepSwap (MkLUP (convertRep Delayed mat) identity 0)
|
||||
where
|
||||
undelay : DecompLUP mat -> DecompLUP mat
|
||||
undelay (MkLUP mat' p sw) = MkLUP (convertRep _ @{getRepC mat} mat') p sw
|
||||
|
||||
maxIndex : (s,a) -> List (s,a) -> (s,a)
|
||||
maxIndex x [] = x
|
||||
maxIndex _ [x] = x
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue