Adding the test driver for multigrid.

This commit is contained in:
Dongryeol Lee
2010-08-05 20:46:15 +00:00
parent 144ae61825
commit a433a7eb8a
5 changed files with 41 additions and 5 deletions
@@ -10,6 +10,7 @@ set(DIRS
linear_regression
# lprcde ## does not compile (missing NWRCdeProblem<>::MultiTreeQuerySummary::PostAccumulate)
# matrix_factorized_fmm ## does not compile right
multigrid
multitree_template ## requires memory manager (mmapmm)
# nested_summation_template
# pca
@@ -47,7 +47,7 @@ class Multigrid {
VectorType &right_hand_side_in,
int max_num_iterations_in);
void Compute(VectorType *output);
void Compute(Vector *output);
};
};
};
@@ -59,12 +59,16 @@ void Multigrid<MatrixType, VectorType>::Coarsen_(
}
// Add to the coarse set if the following condition is satisfied.
if (sum_affinities < threshold * sum_all_affinities) {
if (sum_coarse_affinities < threshold * sum_all_affinities) {
coarse_point_indices.push_back(
std::pair<int, int>(fine_point_index, fine_point_label));
}
} // end of looping over all fine nodes.
// Sort the coarse point indices.
std::sort(coarse_point_indices.begin(), coarse_point_indices.end());
// Build the interpolation matrix.
}
template<typename MatrixType, typename VectorType>
@@ -23,7 +23,7 @@ class MultigridLevel {
/** @brief The coarser left hand side created by the
* coarsening procedure.
*/
SparseMatrix left_hand_side_;
Matrix left_hand_side_;
/** @brief The coarser right hand sides created by the
* coarsening procedure.
@@ -36,6 +36,10 @@ class MultigridLevel {
public:
double get(int row, int col) const {
return left_hand_side_.get(row, col);
}
const std::vector<int> &point_indices() const {
return point_indices_;
}
@@ -44,11 +48,11 @@ class MultigridLevel {
return point_indices_;
}
const SparseMatrix &left_hand_side() const {
const Matrix &left_hand_side() const {
return left_hand_side_;
}
SparseMatrix &left_hand_side() {
Matrix &left_hand_side() {
return left_hand_side_;
}
@@ -0,0 +1,27 @@
/** @file multigrid_test.cc
*
* @brief The test driver for the multigrid solver.
*
* @author Dongryeol Lee (dongryel@cc.gatech.edu)
*/
#include <stdexcept>
#include "multigrid_dev.h"
namespace multigrid_test {
class MultigridTest {
public:
void Start() {
fl::ml::Multigrid<Matrix, Vector> multigrid;
}
};
};
int main(int argc, char *argv[]) {
printf("Starting multigrid tests.\n");
multigrid_test::MultigridTest test;
test.Start();
printf("All tests passed!");
}