Skip to content

Commit

Permalink
Merge pull request #127 from conradsnicta/fast-solve
Browse files Browse the repository at this point in the history
use fast solve
  • Loading branch information
rcurtin authored Sep 7, 2019
2 parents 45efb3e + be9b788 commit d0cd0da
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion include/ensmallen_bits/fw/atoms.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class Atoms
// add an atom norm constraint, you could use projected gradient method,
// see the implementaton of ProjectedGradientEnhancement().
arma::vec newCoeffs =
solve(function.MatrixA() * newAtoms, function.Vectorb());
solve(function.MatrixA() * newAtoms, function.Vectorb(), arma::solve_opts::fast);

// Evaluate the function again.
double Fnew = function.Evaluate(newAtoms * newCoeffs);
Expand Down
2 changes: 1 addition & 1 deletion include/ensmallen_bits/fw/update_span.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class UpdateSpan

// Reoptimize the solution in the current space.
arma::vec b = function.Vectorb();
atoms.CurrentCoeffs() = solve(function.MatrixA() * atoms.CurrentAtoms(), b);
atoms.CurrentCoeffs() = solve(function.MatrixA() * atoms.CurrentAtoms(), b, arma::solve_opts::fast);

// x has coords of only the current atoms, recover the solution
// to the original size.
Expand Down
3 changes: 1 addition & 2 deletions include/ensmallen_bits/sdp/primal_dual_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,7 @@ SolveKKTSystem(const SparseConstraintType& aSparse,
if (aDense.n_rows)
rhs(arma::span(aSparse.n_rows, numConstraints - 1), 0) += aDense * eInvFrdRc;

// TODO(stephentu): use a more efficient method (e.g. LU decomposition)
if (!arma::solve(dy, m, rhs))
if (!arma::solve(dy, m, rhs, arma::solve_opts::fast))
{
throw std::logic_error("PrimalDualSolver::SolveKKTSystem(): Could not "
"solve KKT system.");
Expand Down

0 comments on commit d0cd0da

Please sign in to comment.