Skip to content

Commit

Permalink
Smoothed aggregation with energy minimization
Browse files Browse the repository at this point in the history
  • Loading branch information
ddemidov committed Jun 6, 2014
1 parent 3eb9384 commit c5c186e
Show file tree
Hide file tree
Showing 5 changed files with 491 additions and 21 deletions.
18 changes: 2 additions & 16 deletions amgcl/backend/builtin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ THE SOFTWARE.
#include <amgcl/util.hpp>
#include <amgcl/backend/interface.hpp>
#include <amgcl/detail/gaussj.hpp>
#include <amgcl/detail/sort_row.hpp>

namespace amgcl {
namespace backend {
Expand Down Expand Up @@ -297,22 +298,7 @@ struct crs {
for(ptrdiff_t i = 0; i < static_cast<ptrdiff_t>(n); ++i) {
ptr_type beg = A.ptr[i];
ptr_type end = A.ptr[i + 1];
insertion_sort(A.col.data() + beg, A.val.data() + beg, end - beg);
}
}

static void insertion_sort(col_type *col, val_type *val, int n) {
for(int j = 1; j < n; ++j) {
col_type c = col[j];
val_type v = val[j];
int i = j - 1;
while(i >= 0 && col[i] > c) {
col[i + 1] = col[i];
val[i + 1] = val[i];
i--;
}
col[i + 1] = c;
val[i + 1] = v;
detail::sort_row(A.col.data() + beg, A.val.data() + beg, end - beg);
}
}

Expand Down
Loading

0 comments on commit c5c186e

Please sign in to comment.