diff --git a/fastlib2/contrib/nvasil/dual_manifold/dual_manifold_objective.h b/fastlib2/contrib/nvasil/dual_manifold/dual_manifold_objective.h deleted file mode 100644 index 8bdc6b7f35..0000000000 --- a/fastlib2/contrib/nvasil/dual_manifold/dual_manifold_objective.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * ===================================================================================== - * - * Filename: dual_manifold_objective.h - * - * Description: - * - * Version: 1.0 - * Created: 03/18/2008 07:45:50 PM EDT - * Revision: none - * Compiler: gcc - * - * Author: Nikolaos Vasiloglou (NV), nvasil@ieee.org - * Company: Georgia Tech Fastlab-ESP Lab - * - * ===================================================================================== - */ - -#ifndef DUAL_MANIFOLD_OBJECTIVES_H_ -#define DUAL_MANIFOLD_OBJECTIVES_H_ - -#include "fastlib/fastlib.h" -#include "../l_bfgs/optimization_utils.h" - -class DualMaxVariance { - public: - void Init(datanode *module, Matrix *other_part, - ArrayList > *pairs_to_consider, - ArrayList *dot_prod_values); - void Destruct(); - void ComputeGradient(Matrix &coordinates, Matrix *gradient); - void ComputeObjective(Matrix &coordinates, double *objective); - void ComputeFeasibilityError(Matrix &coordinates, double *error); - double ComputeLagrangian(Matrix &coordinates); - void UpdateLagrangeMult(Matrix &coordinates); - void Project(Matrix *coordinates); - void set_sigma(double sigma); - - private: - datanode *module_; - ArrayList > pairs_to_consider_; - ArrayList *dot_prod_values_; - Matrix *other_part_; - Vector eq_lagrange_mult_; - double sigma_; -}; - -#include "dual_manifold_objective_impl.h" -#endif // DUAL_MANIFOLD_OBJECTIVES_H_ - diff --git a/fastlib2/contrib/nvasil/dual_manifold/dual_manifold_objective_impl.h b/fastlib2/contrib/nvasil/dual_manifold/dual_manifold_objective_impl.h deleted file mode 100644 index 269b8bd21d..0000000000 --- a/fastlib2/contrib/nvasil/dual_manifold/dual_manifold_objective_impl.h +++ /dev/null @@ -1,98 +0,0 @@ -/* - * ===================================================================================== - * - * Filename: dual_manifold_objective_impl.h - * - * Description: - * - * Version: 1.0 - * Created: 03/18/2008 08:09:51 PM EDT - * Revision: none - * Compiler: gcc - * - * Author: Nikolaos Vasiloglou (NV), nvasil@ieee.org - * Company: Georgia Tech Fastlab-ESP Lab - * - * ===================================================================================== - */ - -void DualMaxVariance::Init(datanode *module, Matrix *other_part, - ArrayList > &pairs_to_consider, - ArrayList &dot_prod_values) { - auxiliary_mat__=other_part; - module_=module; - pairs_to_consider_.Copy(pairs_to_consider); - dot_prod_values_.Copy(dot_prod_values); - eq_lagrange_mult_.Init(pairs_to_consider_.size()); - eq_lagrange_mult_.SetAll(1.0); -} -void DualMaxVariance::ComputeGradient(Matrix &coordinates, - Matrix *gradient) { - gradient->CopyValues(coordinates); - la::Scale(-2.0, &gradient); - for(index_t i=0; iGetColumnPtr(n2); - double diff=la::Dot(dimension, p1, p2)-(*dot_prod_values)[i]; - la::AddExpert(dimension, -eq_lagrange_mult_[i]+sigma_*diff, - gradient->GetColumnPtr(n1)); - } -} -void DualMaxVariance::ComputeObjective(Matrix &coordinates, - double *objective) { - index_t dimension=coordinates.n_rows(); - *objective=0; - for(index_t i=0; in_rows()); - *error=0; - index_t dimension=coordinates.n_rows(); - for(index_t i=0; iGetColumnPtr(n2); - *error+=math::Sqr(la::Dot(dimension, p1, p2)-(*dot_prod_values)[i]); - } -} -double DualMaxVariance::ComputeLagrangian(Matrix &coordinates) { - double lagrangian=0; - ComputeObjective(coordinates, &lagrangian); - for(index_t i=0; iGetColumnPtr(n2); - double diff=la::Dot(dimension, p1, p2)-(*dot_prod_values)[i]; - *error+=(-eq_lagrange_mult_[i]+sigma_/2*diff)*diff; - } -} - -void DualMaxVariance::UpdateLagrangeMult(Matrix &coordinates) { - index_t dimension=coordinates.n_rows(); - for(index_t i=0; iGetColumnPtr(n2); - double diff=la::Dot(dimension, p1, p2)-(*dot_prod_values)[i]; - eq_lagrange_mult_[i]-=sigma_*diff; - } -} - -void DualMaxVariance::Project(Matrix *coordinates) { - OptUtils::RemoveMean(coordinates); -} - -void DualMaxVariance::set_sigma(double sigma) { - sigma_=sigma; -} -