Skip to content

Commit

Permalink
update intrinsic implementation and vignette
Browse files Browse the repository at this point in the history
  • Loading branch information
David Bolin authored and David Bolin committed Dec 19, 2024
1 parent 74e2e05 commit d7a2b75
Show file tree
Hide file tree
Showing 4 changed files with 215 additions and 159 deletions.
18 changes: 10 additions & 8 deletions R/intrinsic.R
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,15 @@
#' col = 2, lty = 2
#' )
#' }
intrinsic.operators <- function(tau,
alpha,
beta = 1,
intrinsic.operators <- function(tau = NULL,
beta = NULL,
G = NULL,
C = NULL,
d = NULL,
mesh = NULL,
graph = NULL,
loc_mesh = NULL,
m_alpha = 2,
m_beta = 2,
m = 2,
compute_higher_order = FALSE,
return_block_list = FALSE,
type_rational_approximation = c(
Expand All @@ -74,8 +72,12 @@ intrinsic.operators <- function(tau,
),
fem_mesh_matrices = NULL,
scaling = NULL) {

if(is.null(tau) || is.null(beta)) {
stop("tau and beta must be provided.")
}
return(intrinsic.matern.operators(tau = tau,
kappa = 0,
kappa = 1,
alpha = 0,
beta = beta,
G = G,
Expand Down Expand Up @@ -906,8 +908,8 @@ simulate.intrinsicCBrSPDEobj <- function(object, nsim = 1, seed = NULL,
#' }
variogram.intrinsic.spde <- function(s0 = NULL,
s = NULL,
kappa = NULL,
alpha = NULL,
kappa = 0,
alpha = 0,
beta = NULL,
tau = 1,
L = NULL,
Expand Down
3 changes: 2 additions & 1 deletion pkgdown/_pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,10 @@ reference:
- title: Intrinsic models
contents:
- intrinsic.matern.operators
- intrinsic.operators
- variogram.intrinsic.spde
- rspde.matern.intrinsic
- rspde.intrinsic
- simulate.intrinsicCBrSPDEobj
- title: Log-likelihood
contents:
Expand Down Expand Up @@ -132,7 +134,6 @@ reference:
- title: Functions and methods for rSPDE interface for inlabru
contents:
- cross_validation
- group_predict
- predict.inla_rspde_matern1d
- bru_get_mapper.inla_rspde
- bru_get_mapper.inla_rspde_spacetime
Expand Down
6 changes: 4 additions & 2 deletions src/cgeneric_aux_intrinsic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,10 @@ void compute_Q_fintrinsic( double tau, double nu,
if(compute_mean){
Qidiag_perm = intrinsic_mean(Lq);
Qidiag = R.permutationPinv() * Qidiag_perm;
for(int i = 0; i < n; i++){
for(int i = 0; i < n - 1; i++){
mean_out[i] = Qidiag[i];
}
mean_out[n-1] = 0;
}
} else {
int start;
Expand All @@ -174,9 +175,10 @@ void compute_Q_fintrinsic( double tau, double nu,
if(compute_mean){
Qidiag_perm = intrinsic_mean(Lq);
Qidiag = R.permutationPinv() * Qidiag_perm;
for(int i = 0; i < n; i++){
for(int i = 0; i < n - 1; i++){
mean_out[start + i] = Qidiag[i];
}
mean_out[start + n - 1] = 0;
}
}
}
Expand Down
Loading

0 comments on commit d7a2b75

Please sign in to comment.