X-Git-Url: https://git.auder.net/?a=blobdiff_plain;ds=sidebyside;f=pkg%2FR%2Futil.R;h=ed10430477d3052496d1e373feffc56c7bb43c01;hb=HEAD;hp=f8b01ccb3e635853eba84a261a75cc2475382997;hpb=ea5860f1b4fc91f06e371a0b26915198474a849d;p=valse.git 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]) }