Skip to content

Commit

Permalink
Merge pull request #417 from martinbrehm/master
Browse files Browse the repository at this point in the history
Fix Eigen incompatible matrix sizes error (only shown in debug build)
  • Loading branch information
jonpvandermause authored Sep 30, 2024
2 parents f7c6034 + 626dcbb commit cb57c6b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/flare_pp/bffs/sparse_gp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ void SparseGP ::update_matrices_QR() {
.triangularView<Eigen::Upper>()
.solve(Kuu_eye);
R_inv_diag = R_inv.diagonal();
alpha = R_inv * Q_b;
alpha = R_inv * Q_b.head( R_inv.cols() );
Sigma = R_inv * R_inv.transpose();
}

Expand Down
15 changes: 9 additions & 6 deletions src/flare_pp/kernels/normalized_dot_product.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ Eigen::MatrixXd NormalizedDotProduct ::envs_envs(const ClusterDescriptor &envs1,
// Why not do envs1.descriptors[s] / envs1.descriptor_norms[s]
// and then multiply them to get norm_dot matrix directly??
// Compute dot products. (Should be done in parallel with MKL.)
Eigen::MatrixXd dot_vals =
envs1.descriptors[s] * envs2.descriptors[s].transpose();
Eigen::MatrixXd dot_vals;
if ((envs1.descriptors[s].rows() != 0) && (envs1.descriptors[s].cols() != 0))
dot_vals = envs1.descriptors[s] * envs2.descriptors[s].transpose();

// Compute kernels.
int n_sparse_1 = envs1.n_clusters_by_type[s];
Expand Down Expand Up @@ -138,10 +139,12 @@ Eigen::MatrixXd NormalizedDotProduct ::envs_struc(const ClusterDescriptor &envs,

for (int s = 0; s < n_types; s++) {
// Compute dot products. (Should be done in parallel with MKL.)
Eigen::MatrixXd dot_vals =
envs.descriptors[s] * struc.descriptors[s].transpose();
Eigen::MatrixXd force_dot =
envs.descriptors[s] * struc.descriptor_force_dervs[s].transpose();
Eigen::MatrixXd dot_vals;
Eigen::MatrixXd force_dot;
if ((envs.descriptors[s].rows() != 0) && (envs.descriptors[s].cols() != 0)) {
dot_vals = envs.descriptors[s] * struc.descriptors[s].transpose();
force_dot = envs.descriptors[s] * struc.descriptor_force_dervs[s].transpose();
}

Eigen::VectorXd struc_force_dot = struc.descriptor_force_dots[s];

Expand Down

0 comments on commit cb57c6b

Please sign in to comment.