norm {PET} | R Documentation |
Computes the L1 or L2 norm between two vectors or matrices.
norm(orgImage, testImage, mode = "L2")
orgImage |
A vector or a matrix. |
testImage |
A vector or a matrix of same size as |
mode |
Defaults to |
If X and Y are vectors of length n or (n1,n2)-matrices with n=n1*n2 then the L1-norm and the L2-norm will be compute as follow:
L1 = 1/n*(∑_{i=1}^{n} |X_i-Y_i|)
L2 = (1/n*(∑_{i=1}^{n} (X_i-Y_i)^2))^0.5
Returns the L1 or L2 norm.
Joern Schulz, jschulz78@web.de.
P <- phantom(n=101) P.pois <- markPoisson(P)$Data cat("The L1 is:",norm(P, P.pois, mode="L1"),"\n") rm(P,P.pois)