Hi all,

I’m calling optim() and getting correct results, but need help to upscale it. I 
need to call it on a matrix that’s 3000x5000. I know the SANN option is slow 
but I get similar results with all other options. Perhaps there’s another 
package..I also heard about implementing my loss function in the cpp core but 
I’m not sure what this entails. I do have bounds for both parameters. My 
function is below – thank you in advance for your patience and suggestions!

rvog = function(x){
                ext = x[1]
                height = x[2]
                ext_linear = ext * log(10)/20 #change units to nepers per meter
                inc_radians = myinc *pi/180
                p1 = 2*ext/cos(inc_radians)
              p2 = p1 + 1i*mykz
                #minimize distance to a provided coherence value
              coh = abs(mycoh - ((p1 / p2) * ((exp(p2*height)-1) / 
(exp(p1*height)-1))))
                return (coh)
}

#ancillary variables
mykz = kz[i,j]
myinc = inc
mycoh = volume

#call optimization function
myoptim = optim(c(0.05,30), rvog, method = "SANN", control = list(maxit = 
30000, temp = 2000, trace = FALSE))

~Naiara.

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.

Reply via email to