I have a vector
e <- c(0.1, -0.1, 0.1)
norm(e, type="2")
norm(e, type="1")
norm(e, type="I")
Error in norm(e, type = "1") : 'A' must be a numeric matrix
To solve the problem, usee <- as.matrix(c(0.1, -0.1, 0.1))
.
right below is the body of the norm function, if type!="2"
, it will skip to .Internal(La_dlange(x,type))
, I guess this cause type 2 special but I can't give any further explain.
function (x, type = c("O", "I", "F", "M", "2"))
{
if (identical("2", type)) {
svd(x, nu = 0L, nv = 0L)$d[1L]
}
else .Internal(La_dlange(x, type))
}