Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Cleaned code and resized result
  • Loading branch information
Pranav Jain committed Mar 10, 2022
commit aef3adf259c695bfce4c8dcc45d2ed4caa2f3fa2
4 changes: 2 additions & 2 deletions src/CHOLMODSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,15 @@ namespace polysolve
{
b = eigen2cholmod(rhs);
x = cholmod_l_solve (CHOLMOD_A, L, &b, cm);

result.conservativeResize(rhs.size());
memcpy(result.data(), x->x, result.size() * sizeof(result[0]));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might need to resize result before this

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

}

////////////////////////////////////////////////////////////////////////////////

CHOLMODSolver::~CHOLMODSolver()
{
cholmod_l_gpu_stats(cm);
// cholmod_l_gpu_stats(cm);
cholmod_l_free_factor (&L, cm);
cholmod_l_free_dense (&x, cm);
}
Expand Down
44 changes: 1 addition & 43 deletions src/CHOLMODSolver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,6 @@
#include <nlohmann/json.hpp>
using json = nlohmann::json;

// #define POLYSOLVE_DELETE_MOVE_COPY(Base) \
// Base(Base &&) = delete; \
// Base &operator=(Base &&) = delete; \
// Base(const Base &) = delete; \
// Base &operator=(const Base &) = delete;

////////////////////////////////////////////////////////////////////////////////
// TODO:
// - [ ] Support both RowMajor + ColumnMajor sparse matrices
// - [ ] Wrapper around MUMPS
// - [ ] Wrapper around other iterative solvers (AMGCL, ViennaCL, etc.)
// - [ ] Document the json parameters for each
////////////////////////////////////////////////////////////////////////////////

namespace polysolve
{
Expand All @@ -32,36 +19,7 @@ namespace polysolve
*/
class CHOLMODSolver
{

// public:
// Shortcut alias
// typedef Eigen::VectorXd VectorXd;
// template <typename T>
// using Ref = Eigen::Ref<T>;

// public:
//////////////////
// Constructors //
//////////////////

// Virtual destructor


// Static constructor
//
// @param[in] solver Solver type
// @param[in] precond Preconditioner for iterative solvers
//
// static std::unique_ptr<LinearSolver> create(const std::string &solver, const std::string &precond);

// List available solvers
// static std::vector<std::string> availableSolvers();
// static std::string defaultSolver();

// List available preconditioners
// static std::vector<std::string> availablePrecond();
// static std::string defaultPrecond();


protected:

cholmod_common *cm;
Expand Down
2 changes: 1 addition & 1 deletion tests/test_solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ TEST_CASE("CHOLMOD", "[solver]")
{
const std::string path = POLYSOLVE_DATA_DIR;
Eigen::SparseMatrix<double, Eigen::ColMajor, long int> A;
bool ok = loadMarket(A, path + "/nd6k.mtx");
bool ok = loadMarket(A, path + "/A_2.mat");
REQUIRE(ok);

Eigen::VectorXd b(A.rows());
Expand Down