Thank you so much for looking at it. Initially my code was in the "free" F95 format but partly because of the error and partly because of portability concerns I chose to translate it to strict F77 even thought it is ugly and annoying with the line width limit.
The subroutine is thought as a multivariate version of filter(..., method = 'recursive') and I use it to simulate VAR processes. dgemm is the double precision BLAS subroutine for C = alpha*A*B + beta*C for general matrices A, B, C and scalars alpha and beta. Indeed I think something is going wrong with the initial values but I cannot figure out why. Maybe because of missing Fortran skills but I am puzzled because the code works fine on Windows and Linux. I think the "-mtune=core2" problem has disappeared in the latest 4.2.3 gfortran at r.research because I had the error in the beginning but after reinstall of gfortran it was gone (right now, however, I am on gfortran 4.2.4 aka gcc 4.2.1). Thank you once again and hope some new ideas to isolate the problem will appear. Best Andreas Den 27/04/10 13.34 skrev "Berend Hasselman" <b...@xs4all.nl> følgende: > > On 25-04-2010, at 22:22, Andreas Noack Jensen wrote: > > ... >> On Mac I quite randomly get very weird results from the subroutine. It is >> like the initial values explodes to fx 2e+290 even for identical calls >> without random number generation. Most results are identical to results I >> get from a pure R code but at some calls they explode in a non systematic >> fashion. > ... > > I have experimented with your stuff. > Find attached the R files needed to run my test. > Below is what I have done together with the R output. > As you can see the third column of the result matrix is weird. > This result is independent from setting the seed. > Some sort of initialisation issue? > Since I haven't got a clue what rmfilter does and my memory needs some > refreshing wrt dgemm, > I can't pinpoint the problem. > > Berend > > > I am (still) using the gfortran from gfortran-4.2.3.dmg > ------------------------------------------------------------------ > I made the rmfilter.so with > > MAKEFLAGS="FCFLAGS=-O2" R CMD SHLIB rmfilter.f90 > > NB. had to do it since this gfortran doesn't accept the -mtune=core2 option!! > ---------------------------------------------------------------------- > sessionInfo() > > R version 2.10.1 Patched (2010-04-07 r51689) > x86_64-apple-darwin9.8.0 > > locale: > [1] en_GB/en_GB/C/C/en_GB/en_GB > > attached base packages: > [1] stats graphics grDevices utils datasets methods base > > ------------------------------------------------------------------ > Mac OS X 10.6.3 Intel > > ------------------------------------------------------------------ > > I ran this test job > > > dyn.load('rmfilter.so') > source("rmfilter.R") > > set.seed(407) > > eps <- matrix(rnorm(30), ncol = 3) > eps > > z <- rmfilter(eps, array(diag(3)*0.5, c(3,3,2))) > z > > > with this as output > >> >> dyn.load('rmfilter.so') >> source("rmfilter.R") >> >> set.seed(407) >> >> eps <- matrix(rnorm(30), ncol = 3) >> eps > [,1] [,2] [,3] > [1,] 0.841081288 1.7100891 0.9161884 > [2,] 1.072881139 1.1351244 -0.4314795 > [3,] -0.543593265 -1.0828613 -0.6333517 > [4,] 0.441951763 -1.0539372 -1.8468529 > [5,] 0.004920633 -0.9635668 0.6060301 > [6,] -0.731256023 0.4951620 -1.9168646 > [7,] -1.216400546 -1.5097126 1.1407077 > [8,] -0.210674189 -1.1110270 -0.3563495 > [9,] -0.378021236 -1.5624664 -2.5094364 > [10,] -0.939183015 -0.2886860 2.1596868 >> >> z <- rmfilter(eps, array(diag(3)*0.5, c(3,3,2))) >> z > [,1] [,2] [,3] > [1,] 0.8410813 1.7100891 1.018209e+277 > [2,] 1.4934218 1.9901689 1.018209e+277 > [3,] 0.6236583 0.7672677 1.018209e+277 > [4,] 1.5004918 0.3247811 1.018209e+277 > [5,] 1.0669957 -0.4175424 1.018209e+277 > [6,] 0.5524877 0.4487814 1.018209e+277 > [7,] -0.4066589 -1.4940931 1.018209e+277 > [8,] -0.1377598 -1.6336829 1.018209e+277 > [9,] -0.6502306 -3.1263543 1.018209e+277 > [10,] -1.3331782 -2.6687046 1.018209e+277 > attr(,"tsp") > [1] 1 10 1 > > > > _______________________________________________ R-SIG-Mac mailing list R-SIG-Mac@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-mac