Thanks, Erwin, for pointing out this mistake. Here is the correct function for Frobenius norm.
Klaus - Just replace the old `dist' with the following one. dist <- function(A, B) { # Frobenius norm of A - B n <- nrow(A) sqrt(sum((B - A)^2)) } Ravi. ____________________________________________________________________ Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Gerontology School of Medicine Johns Hopkins University Ph. (410) 502-2619 email: rvarad...@jhmi.edu ----- Original Message ----- From: Erwin Kalvelagen <erwin.kalvela...@gmail.com> Date: Saturday, January 16, 2010 2:35 am Subject: Re: [R] optimization problem To: r-h...@stat.math.ethz.ch > Ravi Varadhan <rvaradhan <at> jhmi.edu> writes: > > dist <- function(A, B) { > > # Frobenius norm of A - B > > n <- nrow(A) > > sum(abs(B - A)) > > } > > > > See for a definition of the > Frobenius norm. > > > Erwin > > ---------------------------------------------------------------- > Erwin Kalvelagen > Amsterdam Optimization Modeling Group > er...@amsterdamoptimization.com > > > ______________________________________________ > R-help@r-project.org mailing list > > PLEASE do read the posting guide > and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.