Commit 5a48436b authored by agebhard's avatar agebhard
Browse files

DEC cc ...

parent 7a689a35
library(baykrig)
library(baykrig)
leman.bk<- bk.grid(point = leman.88.pt , at = "cadpbm", prior=leman.prior,var.mod.obj = leman.88.vmsph, xsw=min(leman.bank$x),ysw=min(leman.bank$y), xne=max(leman.bank$x), yne=max(leman.bank$y), nx=100, ny=100, trend=1, rsearch = 10, extrap = F,border=leman.bank, duplicate="mean")
library(baykrig)
leman.bk<- bk.grid(point = leman.88.pt , at = "cadpbm", prior=leman.prior,var.mod.obj = leman.88.vmsph, xsw=min(leman.bank$x),ysw=min(leman.bank$y), xne=max(leman.bank$x), yne=max(leman.bank$y), nx=100, ny=100, trend=1, rsearch = 10, extrap = F,border=leman.bank, duplicate="mean")
library(baykrig)
library(baykrig)
leman.bk<- bk.grid(point = leman.88.pt , at = "cadpbm", prior=leman.prior,var.mod.obj = leman.88.vmsph, xsw=min(leman.bank$x),ysw=min(leman.bank$y), xne=max(leman.bank$x), yne=max(leman.bank$y), nx=100, ny=100, trend=1, rsearch = 10, extrap = F,border=leman.bank, duplicate="mean",method="ols") leman.bk<- bk.grid(point = leman.88.pt , at = "cadpbm", prior=leman.prior,var.mod.obj = leman.88.vmsph, xsw=min(leman.bank$x),ysw=min(leman.bank$y), xne=max(leman.bank$x), yne=max(leman.bank$y), nx=100, ny=100, trend=1, rsearch = 10, extrap = F,border=leman.bank, duplicate="mean",method="ols")
library(baykrig) library(baykrig)
library(baykrig) library(baykrig)
...@@ -22,7 +15,6 @@ leman.bk.2<- bk.grid(point = leman.88.pt , at = "cadpbm", prior=leman.prior,var. ...@@ -22,7 +15,6 @@ leman.bk.2<- bk.grid(point = leman.88.pt , at = "cadpbm", prior=leman.prior,var.
library(baykrig) library(baykrig)
leman.bk<- bk.grid(point = leman.88.pt , at = "cadpbm", prior=leman.prior,var.mod.obj = leman.88.vmsph, xsw=min(leman.bank$x),ysw=min(leman.bank$y), xne=max(leman.bank$x), yne=max(leman.bank$y), nx=10, ny=10, trend=1, rsearch = 10, extrap = F,border=leman.bank, duplicate="mean") leman.bk<- bk.grid(point = leman.88.pt , at = "cadpbm", prior=leman.prior,var.mod.obj = leman.88.vmsph, xsw=min(leman.bank$x),ysw=min(leman.bank$y), xne=max(leman.bank$x), yne=max(leman.bank$y), nx=10, ny=10, trend=1, rsearch = 10, extrap = F,border=leman.bank, duplicate="mean")
plot(leman.bk) plot(leman.bk)
q()
library(baykrig) library(baykrig)
leman.bk<- bk.grid(point = leman.88.pt , at = "cadpbm", prior=leman.prior,var.mod.obj = leman.88.vmsph, xsw=min(leman.bank$x),ysw=min(leman.bank$y), xne=max(leman.bank$x), yne=max(leman.bank$y), nx=50, ny=50, trend=1, rsearch = 10, extrap = F,border=leman.bank, duplicate="mean") leman.bk<- bk.grid(point = leman.88.pt , at = "cadpbm", prior=leman.prior,var.mod.obj = leman.88.vmsph, xsw=min(leman.bank$x),ysw=min(leman.bank$y), xne=max(leman.bank$x), yne=max(leman.bank$y), nx=50, ny=50, trend=1, rsearch = 10, extrap = F,border=leman.bank, duplicate="mean")
plot(leman.bk) plot(leman.bk)
...@@ -30,3 +22,11 @@ plot(leman.bk,show.snb=T) ...@@ -30,3 +22,11 @@ plot(leman.bk,show.snb=T)
plot(leman.bk,show.snb=T,bias=T) plot(leman.bk,show.snb=T,bias=T)
dev.print(file="bias.ps") dev.print(file="bias.ps")
q() q()
library(baykrig)
plot(leman.bk,show.snb=T,bias=T)
ls()
library(baykrig)
leman.bk.pt <- bk.points(point = leman.88.pt , at = "cadpbm", prior=leman.prior, var.mod.obj = leman.88.vmsph, x=c(530,550),y=c(142,147), trend=1, rsearch = 10, extrap = F,border=leman.bank, duplicate="mean")
ls()
library(baykrig)
leman.bk.pt <- bk.points(point = leman.88.pt , at = "cadpbm", prior=leman.prior, var.mod.obj = leman.88.vmsph, x=c(530,550),y=c(142,147), trend=1, rsearch = 10, extrap = F,border=leman.bank, duplicate="mean")
...@@ -44,7 +44,7 @@ void bk_grid(double *xsw, ...@@ -44,7 +44,7 @@ void bk_grid(double *xsw,
int *glsmth){ int *glsmth){
int nz=(*nx)*(*ny), ldcov=(*n), ldc0=(*n),ldphwk=(*ntrend), int nz=(*nx)*(*ny), ldcov=(*n), ldc0=(*n),ldphwk=(*ntrend),
ldfwrk=(*n), ldlmbd=(*n), ldkwrk=(*n), // ldcvbt=(*ntrend)*(*ntrend), ldfwrk=(*n), ldlmbd=(*n), ldkwrk=(*n),
ldcvbt=(*ntrend), ldcvbt=(*ntrend),
ldclup=(*n),ldcinv=(*n),ldzg=(*nx); ldclup=(*n),ldcinv=(*n),ldzg=(*nx);
double *covmat, *c0vec, *muwrk, *phiwrk, *beta, errbta, double *covmat, *c0vec, *muwrk, *phiwrk, *beta, errbta,
...@@ -52,8 +52,8 @@ void bk_grid(double *xsw, ...@@ -52,8 +52,8 @@ void bk_grid(double *xsw,
*fwork, *fwrk2, *f0work, *dist, *kwork, *fwork, *fwrk2, *f0work, *dist, *kwork,
*rhswork, *fpwork, *fpfwork, *fpf0wrk, *chlup, *rhswork, *fpwork, *fpfwork, *fpf0wrk, *chlup,
*cminv, *work, *ferr, *berr, *cminv, *work, *ferr, *berr,
*mu, // *lambda, *mu,
cov0; // lambd0 cov0;
int *indsnb, *indsnw, *indsrt, *ipiv, *ipvt, *iwork; int *indsnb, *indsnw, *indsrt, *ipiv, *ipvt, *iwork;
...@@ -61,7 +61,7 @@ void bk_grid(double *xsw, ...@@ -61,7 +61,7 @@ void bk_grid(double *xsw,
#ifndef TRANSIENT #ifndef TRANSIENT
covmat =Calloc((size_t)(*n)*(*n),double); covmat =Calloc((size_t)(*n)*(*n),double);
c0vec =Calloc((size_t)(*n),double); c0vec =Calloc((size_t)(*n),double);
muwrk =Calloc((size_t)((*ntrend)*(*npr)),double); muwrk =Calloc((size_t)(*ntrend),double);
phiwrk =Calloc((size_t)((*ntrend)*(*ntrend)),double); phiwrk =Calloc((size_t)((*ntrend)*(*ntrend)),double);
covbta =Calloc((size_t)((*ntrend)*(*ntrend)),double); covbta =Calloc((size_t)((*ntrend)*(*ntrend)),double);
beta =Calloc((size_t)(*ntrend),double); beta =Calloc((size_t)(*ntrend),double);
...@@ -89,11 +89,10 @@ void bk_grid(double *xsw, ...@@ -89,11 +89,10 @@ void bk_grid(double *xsw,
berr =Calloc((size_t)(*n),double); berr =Calloc((size_t)(*n),double);
iwork =Calloc((size_t)(3*(*n)),int); iwork =Calloc((size_t)(3*(*n)),int);
mu =Calloc((size_t)(*ntrend),double); mu =Calloc((size_t)(*ntrend),double);
// lambda =Calloc((size_t)(*n),double);
#else #else
covmat =(double *) R_alloc((*n)*(*n),sizeof(double)); covmat =(double *) R_alloc((*n)*(*n),sizeof(double));
c0vec =(double *) R_alloc((*n),sizeof(double)); c0vec =(double *) R_alloc((*n),sizeof(double));
muwrk =(double *) R_alloc((*ntrend)*(*npr),sizeof(double)); muwrk =(double *) R_alloc((*ntrend),sizeof(double));
phiwrk =(double *) R_alloc((*ntrend)*(*ntrend),sizeof(double)); phiwrk =(double *) R_alloc((*ntrend)*(*ntrend),sizeof(double));
covbta =(double *) R_alloc((*ntrend)*(*ntrend),sizeof(double)); covbta =(double *) R_alloc((*ntrend)*(*ntrend),sizeof(double));
beta =(double *) R_alloc((*ntrend),sizeof(double)); beta =(double *) R_alloc((*ntrend),sizeof(double));
...@@ -121,7 +120,6 @@ void bk_grid(double *xsw, ...@@ -121,7 +120,6 @@ void bk_grid(double *xsw,
berr =(double *) R_alloc((*n),sizeof(double)); berr =(double *) R_alloc((*n),sizeof(double));
iwork =(int *) R_alloc(3*(*n),sizeof(int)); iwork =(int *) R_alloc(3*(*n),sizeof(int));
mu =(double *) R_alloc((*ntrend),sizeof(double)); mu =(double *) R_alloc((*ntrend),sizeof(double));
// lambda =(double *) R_alloc((*n),sizeof(double));
#endif #endif
F77_CALL(bkgrid)(xsw, F77_CALL(bkgrid)(xsw,
...@@ -211,7 +209,6 @@ void bk_grid(double *xsw, ...@@ -211,7 +209,6 @@ void bk_grid(double *xsw,
glsmth); glsmth);
#ifndef TRANSIENT #ifndef TRANSIENT
// Free(lambda);
Free(mu); Free(mu);
Free(iwork); Free(iwork);
Free(berr); Free(berr);
...@@ -232,13 +229,13 @@ void bk_grid(double *xsw, ...@@ -232,13 +229,13 @@ void bk_grid(double *xsw,
Free(dist); Free(dist);
Free(f0work); Free(f0work);
Free(fwrk2); // crash bei trend=0 Free(fwrk2);
Free(fwork); Free(fwork);
Free(zsrnb); Free(zsrnb);
Free(cvsrnb); Free(cvsrnb);
Free(dev); Free(dev);
Free(beta); Free(beta);
Free(covbta); // crash bei trend=1 Free(covbta);
Free(phiwrk); Free(phiwrk);
Free(muwrk); Free(muwrk);
Free(c0vec); Free(c0vec);
...@@ -247,7 +244,6 @@ void bk_grid(double *xsw, ...@@ -247,7 +244,6 @@ void bk_grid(double *xsw,
#else #else
/* /*
// free(lambda);
free(mu); free(mu);
free(iwork); free(iwork);
free(berr); free(berr);
......
#include <R.h> #include <R.h>
#include <Rinternals.h> #include <Rinternals.h>
// #define TRANSIENT /* #define TRANSIENT */
void bk_grid(double *xsw, void bk_grid(double *xsw,
double *ysw, double *ysw,
......
...@@ -36,7 +36,7 @@ void bk_point(double *xp, ...@@ -36,7 +36,7 @@ void bk_point(double *xp,
int *glsmth){ int *glsmth){
int ldcov=(*n), ldc0=(*n),ldphwk=(*ntrend), int ldcov=(*n), ldc0=(*n),ldphwk=(*ntrend),
ldfwrk=(*n), ldlmbd=(*n), ldkwrk=(*n), // ldcvbt=(*ntrend)*(*ntrend), ldfwrk=(*n), ldlmbd=(*n), ldkwrk=(*n),
ldcvbt=(*ntrend), ldcvbt=(*ntrend),
ldclup=(*n),ldcinv=(*n), usesbbt; ldclup=(*n),ldcinv=(*n), usesbbt;
double *covmat, *c0vec, *muwrk, *phiwrk, *beta, errbta, double *covmat, *c0vec, *muwrk, *phiwrk, *beta, errbta,
...@@ -44,8 +44,8 @@ void bk_point(double *xp, ...@@ -44,8 +44,8 @@ void bk_point(double *xp,
*fwork, *fwrk2, *f0work, *dist, *kwork, *fwork, *fwrk2, *f0work, *dist, *kwork,
*rhswork, *fpwork, *fpfwork, *fpf0wrk, *chlup, *rhswork, *fpwork, *fpfwork, *fpf0wrk, *chlup,
*cminv, *work, *ferr, *berr, *cminv, *work, *ferr, *berr,
*mu, // *lambda, *mu,
cov0; // lambd0 cov0;
int *indsnb, *indsnw, *indsrt, *ipiv, *ipvt, *iwork, *inddop, *nap, *snb; int *indsnb, *indsnw, *indsrt, *ipiv, *ipvt, *iwork, *inddop, *nap, *snb;
...@@ -55,7 +55,7 @@ void bk_point(double *xp, ...@@ -55,7 +55,7 @@ void bk_point(double *xp,
#ifndef TRANSIENT #ifndef TRANSIENT
covmat =Calloc((size_t)(*n)*(*n),double); covmat =Calloc((size_t)(*n)*(*n),double);
c0vec =Calloc((size_t)(*n),double); c0vec =Calloc((size_t)(*n),double);
muwrk =Calloc((size_t)((*ntrend)*(*npr)),double); muwrk =Calloc((size_t)(*ntrend),double);
phiwrk =Calloc((size_t)((*ntrend)*(*ntrend)),double); phiwrk =Calloc((size_t)((*ntrend)*(*ntrend)),double);
covbta =Calloc((size_t)((*ntrend)*(*ntrend)),double); covbta =Calloc((size_t)((*ntrend)*(*ntrend)),double);
beta =Calloc((size_t)(*ntrend),double); beta =Calloc((size_t)(*ntrend),double);
...@@ -63,7 +63,7 @@ void bk_point(double *xp, ...@@ -63,7 +63,7 @@ void bk_point(double *xp,
cvsrnb =Calloc((size_t)(*n)*(*n),double); cvsrnb =Calloc((size_t)(*n)*(*n),double);
zsrnb =Calloc((size_t)(*n),double); zsrnb =Calloc((size_t)(*n),double);
fwork =Calloc((size_t)(*n)*(*ntrend),double); fwork =Calloc((size_t)(*n)*(*ntrend),double);
fwrk2 =Calloc((size_t)(*n)*(*ntrend),double); fwrk2 =Calloc((size_t)(*n)*(*ntrend),double);
f0work =Calloc((size_t)(*ntrend),double); f0work =Calloc((size_t)(*ntrend),double);
dist =Calloc((size_t)(*n),double); dist =Calloc((size_t)(*n),double);
indsnb =Calloc((size_t)(*n),int); indsnb =Calloc((size_t)(*n),int);
...@@ -85,11 +85,10 @@ void bk_point(double *xp, ...@@ -85,11 +85,10 @@ void bk_point(double *xp,
berr =Calloc((size_t)(*n),double); berr =Calloc((size_t)(*n),double);
iwork =Calloc((size_t)(3*(*n)),int); iwork =Calloc((size_t)(3*(*n)),int);
mu =Calloc((size_t)(*ntrend),double); mu =Calloc((size_t)(*ntrend),double);
// lambda =Calloc((size_t)(*n),double);
#else #else
covmat =(double *) R_alloc((*n)*(*n),sizeof(double)); covmat =(double *) R_alloc((*n)*(*n),sizeof(double));
c0vec =(double *) R_alloc((*n),sizeof(double)); c0vec =(double *) R_alloc((*n),sizeof(double));
muwrk =(double *) R_alloc((*ntrend)*(*npr),sizeof(double)); muwrk =(double *) R_alloc((*ntrend),sizeof(double));
phiwrk =(double *) R_alloc((*ntrend)*(*ntrend),sizeof(double)); phiwrk =(double *) R_alloc((*ntrend)*(*ntrend),sizeof(double));
covbta =(double *) R_alloc((*ntrend)*(*ntrend),sizeof(double)); covbta =(double *) R_alloc((*ntrend)*(*ntrend),sizeof(double));
beta =(double *) R_alloc((*ntrend),sizeof(double)); beta =(double *) R_alloc((*ntrend),sizeof(double));
...@@ -118,13 +117,12 @@ void bk_point(double *xp, ...@@ -118,13 +117,12 @@ void bk_point(double *xp,
berr =(double *) R_alloc((*n),sizeof(double)); berr =(double *) R_alloc((*n),sizeof(double));
iwork =(int *) R_alloc(3*(*n),sizeof(int)); iwork =(int *) R_alloc(3*(*n),sizeof(int));
mu =(double *) R_alloc((*ntrend),sizeof(double)); mu =(double *) R_alloc((*ntrend),sizeof(double));
// lambda =(double *) R_alloc((*n),sizeof(double));
#endif #endif
F77_CALL(bk)(xp, F77_CALL(bk)(xp,
yp, yp,
dop, dop,
inddop, // inddop,
np, np,
lon, lon,
lat, lat,
...@@ -135,7 +133,7 @@ void bk_point(double *xp, ...@@ -135,7 +133,7 @@ void bk_point(double *xp,
covmat, covmat,
&ldcov, &ldcov,
c0vec, c0vec,
n, // n,
&cov0, &cov0,
trend, trend,
ntrend, ntrend,
...@@ -166,7 +164,7 @@ void bk_point(double *xp, ...@@ -166,7 +164,7 @@ void bk_point(double *xp,
fwrk2, fwrk2,
&ldfwrk, &ldfwrk,
f0work, f0work,
ntrend, // ntrend,
dist, dist,
indsnb, indsnb,
indsnw, indsnw,
...@@ -190,20 +188,19 @@ void bk_point(double *xp, ...@@ -190,20 +188,19 @@ void bk_point(double *xp,
iwork, iwork,
mode, mode,
mu, mu,
ntrend, // ntrend,
zp, zp,
nap, // nap,
lambda, lambda,
&ldlmbd, &ldlmbd,
lambd0, lambd0,
varp, varp,
searchnb, // searchnb,
&usesbbt, // &usesbbt,
ierr, ierr,
glsmth); glsmth);
#ifndef TRANSIENT #ifndef TRANSIENT
// Free(lambda);
Free(mu); Free(mu);
Free(iwork); Free(iwork);
Free(berr); Free(berr);
...@@ -226,13 +223,13 @@ void bk_point(double *xp, ...@@ -226,13 +223,13 @@ void bk_point(double *xp,
Free(dist); Free(dist);
Free(f0work); Free(f0work);
Free(fwrk2); // crash bei trend=0 Free(fwrk2);
Free(fwork); Free(fwork);
Free(zsrnb); Free(zsrnb);
Free(cvsrnb); Free(cvsrnb);
Free(dev); Free(dev);
Free(beta); Free(beta);
Free(covbta); // crash bei trend=1 Free(covbta);
Free(phiwrk); Free(phiwrk);
Free(muwrk); Free(muwrk);
Free(c0vec); Free(c0vec);
...@@ -241,7 +238,6 @@ void bk_point(double *xp, ...@@ -241,7 +238,6 @@ void bk_point(double *xp,
#else #else
/* /*
// free(lambda);
free(mu); free(mu);
free(iwork); free(iwork);
free(berr); free(berr);
......
#include <R.h> #include <R.h>
#include <Rinternals.h> #include <Rinternals.h>
// #define TRANSIENT /* #define TRANSIENT */
void bk_point(double *xp, void bk_point(double *xp,
double *yp, double *yp,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment