inst/test/test.r

library(array)


N <- 100
pitch <- 0.5

system.time(S1 <- array.factor(N=N,start = 0.6, end = 0.8, N.lambda = 300, pitch=pitch))

system.time(S2 <- array_factor(N=N,start = 0.6, end = 0.8, N.lambda = 300, pitch=pitch))

matplot(S1$lambda,cbind(Re(S1$S),Im(S1$S)),t="l",lty=1,lwd=0.8)
matlines(S2$wavelength,cbind(Re(S2$S),Im(S2$S)),t="l",lty=2,lwd=1.5)


## source('http://rbenchmark.googlecode.com/svn/trunk/benchmark.r')

## benchmark(
##    R=array.factor(N=50,start = 0.6, end = 0.8, N.lambda = 300, pitch=pitch), 
##    C=array_factor(N=50,start = 0.6, end = 0.8, N.lambda = 300, pitch=pitch), 
##    replications=2,
##    order=c('replications', 'elapsed'))

Try the array package in your browser

Any scripts or data that you put into this service are public.

array documentation built on May 2, 2019, 6:07 p.m.