[mlpack-svn] master: don't hardcore Evaluate for the lovasz theta objective function (b0d2b8e)
gitdub at big.cc.gt.atl.ga.us
gitdub at big.cc.gt.atl.ga.us
Tue Jan 6 14:20:31 EST 2015
Repository : https://github.com/mlpack/mlpack
On branch : master
Link : https://github.com/mlpack/mlpack/compare/6b14d78fc09cb205ffa7a297f5e6310b2ad83e25...9147fd3ee8072669c18422de4ea6fbe8f964b423
>---------------------------------------------------------------
commit b0d2b8e7e753c449b692bc9ec9cf95a847675646
Author: Stephen Tu <tu.stephenl at gmail.com>
Date: Fri Jan 2 14:20:47 2015 -0800
don't hardcore Evaluate for the lovasz theta objective function
>---------------------------------------------------------------
b0d2b8e7e753c449b692bc9ec9cf95a847675646
src/mlpack/core/optimizers/lrsdp/lrsdp_function.cpp | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/mlpack/core/optimizers/lrsdp/lrsdp_function.cpp b/src/mlpack/core/optimizers/lrsdp/lrsdp_function.cpp
index f6ac6ae..9bbdd22 100644
--- a/src/mlpack/core/optimizers/lrsdp/lrsdp_function.cpp
+++ b/src/mlpack/core/optimizers/lrsdp/lrsdp_function.cpp
@@ -34,7 +34,13 @@ LRSDPFunction::LRSDPFunction(const size_t numSparseConstraints,
double LRSDPFunction::Evaluate(const arma::mat& coordinates) const
{
- return -accu(coordinates * trans(coordinates));
+ const arma::mat rrt = coordinates * trans(coordinates);
+ double objective = 0.;
+ if (hasSparseObjective())
+ objective += trace(SparseC() * rrt);
+ if (hasDenseObjective())
+ objective += trace(DenseC() * rrt);
+ return objective;
}
void LRSDPFunction::Gradient(const arma::mat& /* coordinates */,
More information about the mlpack-git
mailing list