Skip to content

Commit 9c6dc1b

Browse files
committed
bug fix: fe_ls_parabolic edf computation correctly handles n_dofs_
1 parent aa96c2f commit 9c6dc1b

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

fdaPDE/core

fdaPDE/src/solvers/fe_ls_parabolic.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -422,16 +422,16 @@ class fe_ls_parabolic_mono {
422422
for (int j = 0; j < r; ++j) { Us_->operator()(i, j) = rademacher(rng); }
423423
}
424424
Ys_ = Us_->transpose() * Psi_;
425-
Bs_ = matrix_t::Zero(2 * n_dofs_, r); // implicitly enforce homogeneous forcing
425+
Bs_ = matrix_t::Zero(2 * m_ * n_dofs_, r); // implicitly enforce homogeneous forcing
426426
}
427427
if (n_covs_ == 0) {
428-
Bs_->topRows(n_dofs_) = -PsiNA().transpose() * D_ * W_ * (*Us_);
428+
Bs_->topRows(m_ * n_dofs_) = -PsiNA().transpose() * D_ * W_ * (*Us_);
429429
} else {
430-
Bs_->topRows(n_dofs_) = -PsiNA().transpose() * D_ * internals::lmbQ(W_, X_, invXtWX_, *Us_);
430+
Bs_->topRows(m_ * n_dofs_) = -PsiNA().transpose() * D_ * internals::lmbQ(W_, X_, invXtWX_, *Us_);
431431
}
432432
matrix_t x = n_covs_ == 0 ? invA_.solve(*Bs_) : woodbury_system_solve(invA_, U_, XtWX_, V_, *Bs_);
433433
double trS = 0; // monte carlo Tr[S] approximation
434-
for (int i = 0; i < r; ++i) { trS += Ys_->row(i).dot(x.col(i).head(n_dofs_)); }
434+
for (int i = 0; i < r; ++i) { trS += Ys_->row(i).dot(x.col(i).head(m_ * n_dofs_)); }
435435
return trS / r;
436436
}
437437
template <typename... LambdaT>

0 commit comments

Comments
 (0)