Skip to content

Commit

Permalink
minor fix to permuation + calc vertex weight during max matching
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahdhn committed Oct 6, 2024
1 parent 4808274 commit 7cb04a7
Show file tree
Hide file tree
Showing 6 changed files with 330 additions and 101 deletions.
16 changes: 9 additions & 7 deletions apps/NDReorder/count_nnz_fillin.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
#include <Eigen/Sparse>

template <typename SparseMatrixType>
void exportToPlainText(const SparseMatrixType& mat, const std::string& filename)
void export_to_plain_text(const SparseMatrixType& mat,
const std::string& filename)
{
std::ofstream file(filename);
if (!file.is_open()) {
Expand Down Expand Up @@ -51,11 +52,12 @@ int count_nnz_fillin(const EigeMatT& eigen_mat,
Eigen::internal::permute_symm_to_fullsymm<Eigen::Lower, false>(
eigen_mat, permuted_mat, perm.indices().data());

// exportToPlainText(permuted_mat,
// std::string("C:\\Github\\Matlab_Reordering_Trial\\") +
// st + std::string(".txt"));

exportToPlainText(permuted_mat, st + std::string(".txt"));
// export_to_plain_text(permuted_mat,
// std::string("C:\\Github\\Matlab_Reordering_Trial\\")
// +
// st + std::string(".txt"));
//
// return 0;

// compute Cholesky factorization on the permuted matrix

Expand All @@ -81,7 +83,7 @@ int count_nnz_fillin(const EigeMatT& eigen_mat,
// these are the nnz on (strictly) the lower part
int lower_nnz = lower_mat.nonZeros() - lower_mat.rows();

// multiply by two to account for lower and upper parts of the matirx
// multiply by two to account for lower and upper parts of the matrix
// add rows() to account for entries along the diagonal
return 2 * lower_nnz + lower_mat.rows();
}
Expand Down
14 changes: 7 additions & 7 deletions include/rxmesh/matrix/kmeans_patch.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -264,15 +264,15 @@ struct PatchKMeans
assert(v_permute(vh) == INVALID16);

if (m_s_separator(v)) {
v_permute(vh) = sum - m_s_index[v] - 1;
// v_permute(vh) = m_s_index[v];
//v_permute(vh) = sum - m_s_index[v] - 1;
v_permute(vh) = m_s_index[v];
} else if (m_s_partition_b_v(v)) {
v_permute(vh) = sum - s_num_sep - m_s_index[v] - 1;
// v_permute(vh) = s_num_sep + m_s_index[v];
//v_permute(vh) = sum - s_num_sep - m_s_index[v] - 1;
v_permute(vh) = s_num_sep + m_s_index[v];
} else if (m_s_partition_a_v(v)) {
v_permute(vh) =
sum - (s_num_sep + s_num_b) - m_s_index[v] - 1;
// v_permute(vh) = s_num_sep + s_num_b + m_s_index[v];
//v_permute(vh) =
// sum - (s_num_sep + s_num_b) - m_s_index[v] - 1;
v_permute(vh) = s_num_sep + s_num_b + m_s_index[v];
}
}
}
Expand Down
Loading

0 comments on commit 7cb04a7

Please sign in to comment.