Chang ,JX

рассказ и язык

Posts Tagged ‘OX’

Speed test

Posted by changjx on January 1, 2009

%Matlab

m=ones(200000,10);
ret=0;
tic
for i=1:20,
ret=ret+sum(sum(m,1),2);
end
toc

/*Gauss*/
m=ones(200000,10);
ret=0;

starttime=date;
for i (1,20,1);
ret=ret+sumc(sumr(m));
endfor;
endtime=date;
print etstr( ethsec(starttime,endtime) );

/*OX*/
#include
main(){
decl tim,i,m,ret,k;
m = ones(200000,10);
ret =0;

tim = timer();
for (i=0;i<20;++i){
ret=ret+sumc(sumr(m));
}
print(“time lapsed: “, timespan(tim, timer()), “\n”);
}

#R
# File name: loop_rowSums.r

my.loop <- 20
m.dim <- list(nrow = 200000, ncol = 10)
m <- matrix(1, nrow = m.dim$nrow, ncol = m.dim$ncol)
ret <- 0

start <- Sys.time()
for(k in 1 : my.loop){
ret <- ret + sum(rowSums(m))
}
Sys.time() – start
==========================

Speed:

Matlab(0.119)
OX(0.2)
Gauss(0.14)
R(1.625)

http://www.math.ncu.edu.tw/~chenwc/R_note/index.php?item=loop

Posted in Gauss, OX, R | Tagged: , , , | Leave a Comment »

Simulate price process

Posted by changjx on July 11, 2008

http://www.kevinsheppard.com/matlab/Assignment2.html
use R and OX

Read the rest of this entry »

Posted in EconStatistics, OX, R | Tagged: , | Leave a Comment »