Loading...
Searching...
No Matches
gpr::pairlocal::TileEvaluator Class Reference

#include <gpr/ml/gp/PairLocalKernel.h>

Public Member Functions

 TileEvaluator (const Geometry &geometry, const Weights &weights)
 TileEvaluator (const Geometry &left, const Geometry &right, const Weights &weights)
 TileEvaluator (const Geometry &geometry, const Weights &weights, const std::vector< Eigen::Index > &derivative_groups)
 TileEvaluator (const Geometry &left, const Geometry &right, const Weights &weights, const std::vector< Eigen::Index > &derivative_groups)
Eigen::Index tileSize () const noexcept
Eigen::Index parameterCount () const noexcept
 1 + number of log lengths.
void prepare (Eigen::Index i, Eigen::Index j)
void tile (Eigen::Index parameter, Eigen::MatrixXd &out) const
void directional (const Eigen::VectorXd &direction, Eigen::MatrixXd &first, Eigen::MatrixXd &second) const
void contract (const double *W, Eigen::Index row_stride, Eigen::Index col_stride, bool lower_only, Eigen::VectorXd &out) const
void quadratic (const double *alpha_i, const double *alpha_j, Eigen::VectorXd &out) const
void action (const double *vector, bool transpose, Eigen::MatrixXd &out) const
void diagonals (Eigen::MatrixXd &out) const

Detailed Description

One configuration pair of the joint covariance and its derivatives with respect to log m (parameter 0) and each log length (parameters 1..P, or the single parameter 1 for a shared length).

Definition at line 82 of file PairLocalKernel.h.

Constructor & Destructor Documentation

◆ TileEvaluator() [1/4]

gpr::pairlocal::TileEvaluator::TileEvaluator ( const Geometry & geometry,
const Weights & weights )

Definition at line 165 of file PairLocalKernel.cpp.

166 : TileEvaluator(geometry, geometry, weights)
167{
168}
TileEvaluator(const Geometry &geometry, const Weights &weights)

◆ TileEvaluator() [2/4]

gpr::pairlocal::TileEvaluator::TileEvaluator ( const Geometry & left,
const Geometry & right,
const Weights & weights )

Cross tiles between the configurations of two geometries of the same atoms: i indexes left, j indexes right.

Definition at line 170 of file PairLocalKernel.cpp.

172 : TileEvaluator(left, right, weights, {})
173{
174}

◆ TileEvaluator() [3/4]

gpr::pairlocal::TileEvaluator::TileEvaluator ( const Geometry & geometry,
const Weights & weights,
const std::vector< Eigen::Index > & derivative_groups )

Compact derivative groups, indexed by fine pair type. Each group parameter moves all of its members' log lengths together. Group IDs must cover 0..G-1; an empty map retains the fine-coordinate workspace.

Definition at line 176 of file PairLocalKernel.cpp.

178 : TileEvaluator(geometry, geometry, weights, derivative_groups)
179{
180}

◆ TileEvaluator() [4/4]

gpr::pairlocal::TileEvaluator::TileEvaluator ( const Geometry & left,
const Geometry & right,
const Weights & weights,
const std::vector< Eigen::Index > & derivative_groups )

Definition at line 182 of file PairLocalKernel.cpp.

185 : geometry_(left),
186 right_(right),
187 weights_(weights),
188 derivative_groups_(derivative_groups)
189{
190 Eigen::Index group_count = left.n_pt;
191 if (!derivative_groups_.empty()) {
192 if (derivative_groups_.size() != static_cast<std::size_t>(left.n_pt))
193 throw std::invalid_argument("Pair derivative group count mismatch");
194 std::vector<bool> seen(static_cast<std::size_t>(left.n_pt), false);
195 group_count = 0;
196 for (const Eigen::Index group: derivative_groups_) {
197 if (group < 0 || group >= left.n_pt)
198 throw std::invalid_argument("Invalid pair derivative group");
199 seen[static_cast<std::size_t>(group)] = true;
200 group_count = std::max(group_count, group + 1);
201 }
202 if (std::find(seen.begin(), seen.begin() + group_count, false) !=
203 seen.begin() + group_count)
204 throw std::invalid_argument(
205 "Pair derivative groups are not compact");
206 if (weights.scalar_length && group_count != 1)
207 throw std::invalid_argument("A shared length requires one group");
208 }
209 length_count_ = weights.scalar_length ? 1 : group_count;
210 s_t_.setZero(group_count);
211 coef_.setZero(static_cast<Eigen::Index>(left.pairs.size()));
212 g_.setZero(left.dof);
213 h_.setZero(left.dof);
214 gt_.setZero(group_count, left.dof);
215 ht_.setZero(group_count, left.dof);
216}

Member Function Documentation

◆ action()

void gpr::pairlocal::TileEvaluator::action ( const double * vector,
bool transpose,
Eigen::MatrixXd & out ) const

Apply every derivative tile to one channel vector without materializing the tiles. out(p, c) is the c-th component of (dK/dtheta_p) vector; transpose=true applies each transposed tile. Workspace is O(G D).

Definition at line 488 of file PairLocalKernel.cpp.

490{
491 const Eigen::Index dof = geometry_.dof;
492 const Eigen::Index groups = s_t_.size();
493 const Eigen::Map<const Eigen::VectorXd> gradient(vector + 1, dof);
494 Eigen::MatrixXd products = Eigen::MatrixXd::Zero(groups, dof);
495 for (Eigen::Index f = 0;
496 f < static_cast<Eigen::Index>(geometry_.pairs.size()); ++f) {
497 const Pair& pair = geometry_.pairs[static_cast<std::size_t>(f)];
498 const double weight = weights_.inverse_square(pair.type);
499 if (weight == 0.0) continue;
500 const Eigen::Vector3d left =
501 geometry_.grad.block(i_, 3 * f, 1, 3).transpose();
502 const Eigen::Vector3d right =
503 right_.grad.block(j_, 3 * f, 1, 3).transpose();
504 Eigen::Vector3d difference = gradient.segment<3>(3 * pair.first);
505 if (pair.second >= 0)
506 difference -= gradient.segment<3>(3 * pair.second);
507 const Eigen::Vector3d product =
508 transpose ? (weight * left.dot(difference)) * right
509 : (weight * right.dot(difference)) * left;
510 products.block<1, 3>(groupIndex(pair.type), 3 * pair.first) +=
511 product.transpose();
512 if (pair.second >= 0)
513 products.block<1, 3>(groupIndex(pair.type), 3 * pair.second) -=
514 product.transpose();
515 }
516 const double energy =
517 vector[0] + (transpose ? -g_.dot(gradient) : h_.dot(gradient));
518 out.setZero(parameterCount(), dof + 1);
519 out(0, 0) = kernel_ * energy;
520 out.row(0).tail(dof) = (2.0 * kernel_) * products.colwise().sum();
521 if (transpose)
522 out.row(0).tail(dof) += (kernel_ * energy) * h_.transpose();
523 else
524 out.row(0).tail(dof) -= (kernel_ * energy) * g_.transpose();
525 for (Eigen::Index t = 0; t < groups; ++t) {
526 const Eigen::Index parameter = 1 + lengthIndex(t);
527 const double projection =
528 transpose ? gt_.row(t).dot(gradient) : ht_.row(t).dot(gradient);
529 out.row(parameter) += (2.0 * s_t_(t)) * out.row(0);
530 out(parameter, 0) += (transpose ? 2.0 : -2.0) * kernel_ * projection;
531 if (transpose) {
532 out.row(parameter).tail(dof) +=
533 kernel_ *
534 (-2.0 * energy * ht_.row(t) +
535 2.0 * projection * h_.transpose() - 4.0 * products.row(t));
536 } else {
537 out.row(parameter).tail(dof) +=
538 kernel_ *
539 (2.0 * energy * gt_.row(t) + 2.0 * projection * g_.transpose() -
540 4.0 * products.row(t));
541 }
542 }
543}
Eigen::Index parameterCount() const noexcept
1 + number of log lengths.
eon_relax_band_t eon_relax_surface_fn void eon_relax_outcome_t * out

◆ contract()

void gpr::pairlocal::TileEvaluator::contract ( const double * W,
Eigen::Index row_stride,
Eigen::Index col_stride,
bool lower_only,
Eigen::VectorXd & out ) const

Frobenius products of a weight tile with the covariance tile and every derivative tile: out(p) = <W, dK/dtheta_p>, out(0) = <W, K>. Entry (c, c') of W sits at W[c * row_stride + c' * col_stride]. When lower_only the tile is the diagonal tile i == j and only the entries with c >= c' are read.

Definition at line 373 of file PairLocalKernel.cpp.

376{
377 const Eigen::Index dof = geometry_.dof;
378 const Eigen::Index n_pt = s_t_.size();
379 const Eigen::Index n_pairs =
380 static_cast<Eigen::Index>(geometry_.pairs.size());
381 out.setZero(parameterCount());
382 const auto entry = [&](Eigen::Index c, Eigen::Index cc) {
383 if (lower_only && c < cc) std::swap(c, cc);
384 return W[c * row_stride + cc * col_stride];
385 };
386 // sigma_f = J_if^T W_grad J_jf, bucketed by type.
387 Eigen::VectorXd sigma_t = Eigen::VectorXd::Zero(n_pt);
388 for (Eigen::Index f = 0; f < n_pairs; ++f) {
389 const Pair& pair = geometry_.pairs[static_cast<std::size_t>(f)];
390 const double w = weights_.inverse_square(pair.type);
391 if (w == 0.0) continue;
392 const Eigen::Vector3d gi =
393 geometry_.grad.block(i_, 3 * f, 1, 3).transpose();
394 const Eigen::Vector3d gj =
395 right_.grad.block(j_, 3 * f, 1, 3).transpose();
396 const Eigen::Index a = 1 + 3 * pair.first;
397 const Eigen::Index b = pair.second >= 0 ? 1 + 3 * pair.second : -1;
398 double sigma = 0.0;
399 for (Eigen::Index d = 0; d < 3; ++d) {
400 for (Eigen::Index e = 0; e < 3; ++e) {
401 double weight = entry(a + d, a + e);
402 if (b >= 0)
403 weight += entry(b + d, b + e) - entry(a + d, b + e) -
404 entry(b + d, a + e);
405 sigma += weight * gi(d) * gj(e);
406 }
407 }
408 sigma_t(groupIndex(pair.type)) += w * sigma;
409 }
410 const double sigma_sum = sigma_t.sum();
411 if (lower_only) {
412 // The diagonal tile: d_f = 0, so g = h = 0 and every S_t = 0.
413 out(0) = kernel_ * (entry(0, 0) + 2.0 * sigma_sum);
414 for (Eigen::Index t = 0; t < n_pt; ++t)
415 out(1 + lengthIndex(t)) += kernel_ * (-4.0 * sigma_t(t));
416 return;
417 }
418 using Strided = Eigen::Map<const Eigen::MatrixXd, 0,
419 Eigen::Stride<Eigen::Dynamic, Eigen::Dynamic>>;
420 const Strided grad_weight(
421 W + row_stride + col_stride, dof, dof,
422 Eigen::Stride<Eigen::Dynamic, Eigen::Dynamic>(col_stride, row_stride));
423 const Strided energy_row(
424 W + col_stride, 1, dof,
425 Eigen::Stride<Eigen::Dynamic, Eigen::Dynamic>(col_stride, row_stride));
426 const Strided energy_col(
427 W + row_stride, dof, 1,
428 Eigen::Stride<Eigen::Dynamic, Eigen::Dynamic>(col_stride, row_stride));
429 const Eigen::VectorXd p = grad_weight * h_;
430 const Eigen::VectorXd q = grad_weight.transpose() * g_;
431 const double row_h = (energy_row * h_)(0, 0);
432 const double col_g = (energy_col.transpose() * g_)(0, 0);
433 const double value =
434 kernel_ * (entry(0, 0) + row_h - col_g - g_.dot(p) + 2.0 * sigma_sum);
435 out(0) = value;
436 for (Eigen::Index t = 0; t < n_pt; ++t) {
437 const double row_ht = (energy_row * ht_.row(t).transpose())(0, 0);
438 const double col_gt =
439 (energy_col.transpose() * gt_.row(t).transpose())(0, 0);
440 const double derivative =
441 2.0 * s_t_(t) * value +
442 kernel_ * (-2.0 * row_ht + 2.0 * col_gt + 2.0 * gt_.row(t).dot(p) +
443 2.0 * q.dot(ht_.row(t)) - 4.0 * sigma_t(t));
444 out(1 + lengthIndex(t)) += derivative;
445 }
446}

◆ diagonals()

void gpr::pairlocal::TileEvaluator::diagonals ( Eigen::MatrixXd & out) const

Diagonal of every parameter tile: out(p, c). Meaningful for i == j, where the kernel nugget scales the diagonal.

Definition at line 545 of file PairLocalKernel.cpp.

546{
547 const Eigen::Index dof = geometry_.dof;
548 const Eigen::Index n_pt = s_t_.size();
549 const Eigen::Index n_pairs =
550 static_cast<Eigen::Index>(geometry_.pairs.size());
551 out.setZero(parameterCount(), dof + 1);
552 // Per channel and type: sum_{f in t} w_f J_if,n J_jf,n.
553 Eigen::MatrixXd pair_diag = Eigen::MatrixXd::Zero(n_pt, dof);
554 for (Eigen::Index f = 0; f < n_pairs; ++f) {
555 const Pair& pair = geometry_.pairs[static_cast<std::size_t>(f)];
556 const double w = weights_.inverse_square(pair.type);
557 if (w == 0.0) continue;
558 const Eigen::Array3d product =
559 w * geometry_.grad.block(i_, 3 * f, 1, 3).transpose().array() *
560 right_.grad.block(j_, 3 * f, 1, 3).transpose().array();
561 pair_diag.block(groupIndex(pair.type), 3 * pair.first, 1, 3) +=
562 product.matrix().transpose();
563 if (pair.second >= 0)
564 pair_diag.block(groupIndex(pair.type), 3 * pair.second, 1, 3) +=
565 product.matrix().transpose();
566 }
567 const Eigen::RowVectorXd pair_diag_sum = pair_diag.colwise().sum();
568 out(0, 0) = kernel_;
569 for (Eigen::Index n = 0; n < dof; ++n)
570 out(0, 1 + n) = kernel_ * (-g_(n) * h_(n) + 2.0 * pair_diag_sum(n));
571 for (Eigen::Index t = 0; t < n_pt; ++t) {
572 const Eigen::Index p = 1 + lengthIndex(t);
573 out.row(p) += (2.0 * s_t_(t)) * out.row(0);
574 for (Eigen::Index n = 0; n < dof; ++n)
575 out(p, 1 + n) +=
576 kernel_ * (2.0 * gt_(t, n) * h_(n) + 2.0 * g_(n) * ht_(t, n) -
577 4.0 * pair_diag(t, n));
578 }
579}

◆ directional()

void gpr::pairlocal::TileEvaluator::directional ( const Eigen::VectorXd & direction,
Eigen::MatrixXd & first,
Eigen::MatrixXd & second ) const

Exact first and second derivatives along one packed log-parameter direction. Pair products use their six-entry Cartesian support.

Definition at line 309 of file PairLocalKernel.cpp.

312{
313 if (i_ < 0 || j_ < 0 || direction.size() != parameterCount() ||
314 !direction.allFinite())
315 throw std::invalid_argument(
316 "Prepared pair tile and finite parameter direction required");
317 const Eigen::Index dof = geometry_.dof;
318 Eigen::VectorXd g1 = Eigen::VectorXd::Zero(dof), h1 = g1;
319 Eigen::VectorXd g2 = g1, h2 = g1;
320 double a = direction(0), b = 0.0;
321 for (Eigen::Index t = 0; t < s_t_.size(); ++t) {
322 const double d = direction(1 + lengthIndex(t));
323 a += 2.0 * d * s_t_(t);
324 b -= 4.0 * d * d * s_t_(t);
325 g1.noalias() -= (2.0 * d) * gt_.row(t).transpose();
326 h1.noalias() -= (2.0 * d) * ht_.row(t).transpose();
327 g2.noalias() += (4.0 * d * d) * gt_.row(t).transpose();
328 h2.noalias() += (4.0 * d * d) * ht_.row(t).transpose();
329 }
330 const double c = a * a + b;
331 first.resize(dof + 1, dof + 1);
332 second.resize(dof + 1, dof + 1);
333 first(0, 0) = kernel_ * a;
334 second(0, 0) = kernel_ * c;
335 first.block(0, 1, 1, dof) = kernel_ * (a * h_ + h1).transpose();
336 second.block(0, 1, 1, dof) =
337 kernel_ * (c * h_ + 2.0 * a * h1 + h2).transpose();
338 first.block(1, 0, dof, 1) = -kernel_ * (a * g_ + g1);
339 second.block(1, 0, dof, 1) = -kernel_ * (c * g_ + 2.0 * a * g1 + g2);
340 first.block(1, 1, dof, dof).noalias() =
341 (-kernel_) *
342 (a * g_ * h_.transpose() + g1 * h_.transpose() + g_ * h1.transpose());
343 second.block(1, 1, dof, dof).noalias() =
344 (-kernel_) *
345 (c * g_ * h_.transpose() + (2.0 * a) * g1 * h_.transpose() +
346 (2.0 * a) * g_ * h1.transpose() + g2 * h_.transpose() +
347 2.0 * g1 * h1.transpose() + g_ * h2.transpose());
348 for (Eigen::Index f = 0;
349 f < static_cast<Eigen::Index>(geometry_.pairs.size()); ++f) {
350 const Pair& pair = geometry_.pairs[static_cast<std::size_t>(f)];
351 const double w = weights_.inverse_square(pair.type);
352 if (w == 0.0) continue;
353 const double d = direction(1 + lengthIndex(groupIndex(pair.type)));
354 const Eigen::Matrix3d product =
355 (2.0 * kernel_ * w) *
356 geometry_.grad.block(i_, 3 * f, 1, 3).transpose() *
357 right_.grad.block(j_, 3 * f, 1, 3);
358 const auto add = [&](Eigen::MatrixXd& target, double scale) {
359 const Eigen::Index left = 1 + 3 * pair.first;
360 target.block<3, 3>(left, left) += scale * product;
361 if (pair.second >= 0) {
362 const Eigen::Index right = 1 + 3 * pair.second;
363 target.block<3, 3>(left, right) -= scale * product;
364 target.block<3, 3>(right, left) -= scale * product;
365 target.block<3, 3>(right, right) += scale * product;
366 }
367 };
368 add(first, a - 2.0 * d);
369 add(second, c - 4.0 * a * d + 4.0 * d * d);
370 }
371}

◆ parameterCount()

Eigen::Index gpr::pairlocal::TileEvaluator::parameterCount ( ) const
inlinenodiscardnoexcept

1 + number of log lengths.

Definition at line 103 of file PairLocalKernel.h.

104 {
105 return 1 + length_count_;
106 }

◆ prepare()

void gpr::pairlocal::TileEvaluator::prepare ( Eigen::Index i,
Eigen::Index j )

Definition at line 218 of file PairLocalKernel.cpp.

219{
220 i_ = i;
221 j_ = j;
222 s_t_.setZero();
223 gt_.setZero();
224 ht_.setZero();
225 const Eigen::Index n_pairs =
226 static_cast<Eigen::Index>(geometry_.pairs.size());
227 for (Eigen::Index f = 0; f < n_pairs; ++f) {
228 const Pair& pair = geometry_.pairs[static_cast<std::size_t>(f)];
229 const double w = weights_.inverse_square(pair.type);
230 const double d = geometry_.q(i, f) - right_.q(j, f);
231 s_t_(groupIndex(pair.type)) += w * d * d;
232 const double coef = 2.0 * w * d;
233 coef_(f) = coef;
234 if (coef == 0.0) continue;
235 const auto gi = geometry_.grad.block(i, 3 * f, 1, 3);
236 const auto gj = right_.grad.block(j, 3 * f, 1, 3);
237 gt_.block(groupIndex(pair.type), 3 * pair.first, 1, 3) += coef * gi;
238 ht_.block(groupIndex(pair.type), 3 * pair.first, 1, 3) += coef * gj;
239 if (pair.second >= 0) {
240 gt_.block(groupIndex(pair.type), 3 * pair.second, 1, 3) -=
241 coef * gi;
242 ht_.block(groupIndex(pair.type), 3 * pair.second, 1, 3) -=
243 coef * gj;
244 }
245 }
246 g_ = gt_.colwise().sum().transpose();
247 h_ = ht_.colwise().sum().transpose();
248 kernel_ = weights_.magnitude * numerics::exp(-s_t_.sum());
249}
double exp(double x) noexcept

◆ quadratic()

void gpr::pairlocal::TileEvaluator::quadratic ( const double * alpha_i,
const double * alpha_j,
Eigen::VectorXd & out ) const

alpha_i^T (dK/dtheta_p) alpha_j for every parameter, with the tiles of the two weight vectors given channel-contiguous.

Definition at line 448 of file PairLocalKernel.cpp.

450{
451 const Eigen::Index dof = geometry_.dof;
452 const Eigen::Index n_pt = s_t_.size();
453 const Eigen::Index n_pairs =
454 static_cast<Eigen::Index>(geometry_.pairs.size());
455 out.setZero(parameterCount());
456 const Eigen::Map<const Eigen::VectorXd> ai(alpha_i + 1, dof);
457 const Eigen::Map<const Eigen::VectorXd> aj(alpha_j + 1, dof);
458 Eigen::VectorXd mixed_t = Eigen::VectorXd::Zero(n_pt);
459 for (Eigen::Index f = 0; f < n_pairs; ++f) {
460 const Pair& pair = geometry_.pairs[static_cast<std::size_t>(f)];
461 const double w = weights_.inverse_square(pair.type);
462 if (w == 0.0) continue;
463 const Eigen::Vector3d gi =
464 geometry_.grad.block(i_, 3 * f, 1, 3).transpose();
465 const Eigen::Vector3d gj =
466 right_.grad.block(j_, 3 * f, 1, 3).transpose();
467 Eigen::Vector3d ri = ai.segment<3>(3 * pair.first);
468 Eigen::Vector3d rj = aj.segment<3>(3 * pair.first);
469 if (pair.second >= 0) {
470 ri -= ai.segment<3>(3 * pair.second);
471 rj -= aj.segment<3>(3 * pair.second);
472 }
473 mixed_t(groupIndex(pair.type)) += w * gi.dot(ri) * gj.dot(rj);
474 }
475 const double left = alpha_i[0] - g_.dot(ai);
476 const double right = alpha_j[0] + h_.dot(aj);
477 const double value = kernel_ * (left * right + 2.0 * mixed_t.sum());
478 out(0) = value;
479 for (Eigen::Index t = 0; t < n_pt; ++t) {
480 const double derivative =
481 2.0 * s_t_(t) * value +
482 kernel_ * (2.0 * gt_.row(t).dot(ai) * right -
483 2.0 * left * ht_.row(t).dot(aj) - 4.0 * mixed_t(t));
484 out(1 + lengthIndex(t)) += derivative;
485 }
486}

◆ tile()

void gpr::pairlocal::TileEvaluator::tile ( Eigen::Index parameter,
Eigen::MatrixXd & out ) const

The dense tile of parameter parameter (0 is the covariance itself, which equals its derivative with respect to log m).

Definition at line 251 of file PairLocalKernel.cpp.

252{
253 const Eigen::Index dof = geometry_.dof;
254 const Eigen::Index size = dof + 1;
255 const Eigen::Index n_pairs =
256 static_cast<Eigen::Index>(geometry_.pairs.size());
257 // The four channel blocks cover every covariance entry. A covariance
258 // request writes directly into the caller's reusable tile storage.
259 Eigen::MatrixXd value_storage;
260 Eigen::MatrixXd& value = parameter == 0 ? out : value_storage;
261 value.resize(size, size);
262 if (parameter != 0) out.setZero(size, size);
263 value(0, 0) = kernel_;
264 value.block(0, 1, 1, dof) = kernel_ * h_.transpose();
265 value.block(1, 0, dof, 1) = -kernel_ * g_;
266 value.block(1, 1, dof, dof).noalias() = (-kernel_) * g_ * h_.transpose();
267 const auto add_pair_products = [&](Eigen::MatrixXd& target,
268 const double scale,
269 const Eigen::Index only_type) {
270 for (Eigen::Index f = 0; f < n_pairs; ++f) {
271 const Pair& pair = geometry_.pairs[static_cast<std::size_t>(f)];
272 if (only_type >= 0 && groupIndex(pair.type) != only_type) continue;
273 const double w = weights_.inverse_square(pair.type);
274 if (w == 0.0) continue;
275 const Eigen::Matrix3d product =
276 (scale * w) *
277 geometry_.grad.block(i_, 3 * f, 1, 3).transpose() *
278 right_.grad.block(j_, 3 * f, 1, 3);
279 const Eigen::Index a = 1 + 3 * pair.first;
280 target.block<3, 3>(a, a) += product;
281 if (pair.second >= 0) {
282 const Eigen::Index b = 1 + 3 * pair.second;
283 target.block<3, 3>(a, b) -= product;
284 target.block<3, 3>(b, a) -= product;
285 target.block<3, 3>(b, b) += product;
286 }
287 }
288 };
289 add_pair_products(value, 2.0 * kernel_, -1);
290 if (parameter == 0) return;
291 const auto add_length = [&](const Eigen::Index t) {
292 out += (2.0 * s_t_(t)) * value;
293 out.block(0, 1, 1, dof) += (-2.0 * kernel_) * ht_.row(t);
294 out.block(1, 0, dof, 1) += (2.0 * kernel_) * gt_.row(t).transpose();
295 out.block(1, 1, dof, dof).noalias() +=
296 (2.0 * kernel_) * gt_.row(t).transpose() * h_.transpose();
297 out.block(1, 1, dof, dof).noalias() +=
298 (2.0 * kernel_) * g_ * ht_.row(t);
299 add_pair_products(out, -4.0 * kernel_, t);
300 };
301 if (weights_.scalar_length) {
302 for (Eigen::Index t = 0; t < s_t_.size(); ++t)
303 add_length(t);
304 } else {
305 add_length(parameter - 1);
306 }
307}

◆ tileSize()

Eigen::Index gpr::pairlocal::TileEvaluator::tileSize ( ) const
inlinenodiscardnoexcept

Definition at line 98 of file PairLocalKernel.h.

99 {
100 return geometry_.dof + 1;
101 }

The documentation for this class was generated from the following files: