X-Git-Url: https://git.auder.net/?p=valse.git;a=blobdiff_plain;f=pkg%2FR%2Futil.R;h=ed10430477d3052496d1e373feffc56c7bb43c01;hp=f8b01ccb3e635853eba84a261a75cc2475382997;hb=0ba1b11c49d7b2a0cae493200793c1ba3fb8b8e7;hpb=4c4b3888e07594f0bacdd2b60ffc97aa61600643 diff --git a/pkg/R/util.R b/pkg/R/util.R index f8b01cc..ed10430 100644 --- a/pkg/R/util.R +++ b/pkg/R/util.R @@ -1,7 +1,5 @@ -# ... +# Compute the determinant of a matrix, which can be 1x1 (scalar) gdet <- function(M) { - if (is.matrix(M)) - return (det(M)) - return (M[1]) #numeric, double + ifelse(is.matrix(M), det(M), M[1]) }