Skip to content

Commit

Permalink
Return early if there are no predecessors.
Browse files Browse the repository at this point in the history
  • Loading branch information
tillahoffmann committed Nov 15, 2024
1 parent 7fb7fe3 commit 7242247
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions stan/gptools/stan/gptools/graph.stan
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ vector gp_graph_conditional_loc_scale(
int node, array [] int predecessors, real epsilon
) {
int k = size(predecessors);

// If there are no predecessors, we simply use the marginal distribution.
if (k == 0) {
return [0, sqrt(sigma ^ 2 + epsilon)]';
}

matrix[1, k] cov12;
matrix[k, k] cov22;
if (kernel == 0) {
Expand Down

0 comments on commit 7242247

Please sign in to comment.