[opengm] 281/386: lweighted sum of functions calls operator() on Marray with proper indices for dimension =2 (and 1)

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Wed Aug 31 08:38:11 UTC 2016


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch debian/master
in repository opengm.

commit b46caa64078682222cb2a06e28aea4e6c29ca599
Author: Janez Ales <janez.ales at iwr.uni-heidelberg.de>
Date:   Thu Oct 15 20:15:53 2015 +0200

    lweighted sum of functions calls operator() on Marray with proper indices for dimension =2 (and 1)
---
 .../opengm/functions/learnable/lweightedsum_of_functions.hxx   | 10 +++++++++-
 include/opengm/learning/bundle-optimizer.hxx                   |  8 ++++----
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/include/opengm/functions/learnable/lweightedsum_of_functions.hxx b/include/opengm/functions/learnable/lweightedsum_of_functions.hxx
index 7180164..eaa7d28 100644
--- a/include/opengm/functions/learnable/lweightedsum_of_functions.hxx
+++ b/include/opengm/functions/learnable/lweightedsum_of_functions.hxx
@@ -99,7 +99,15 @@ LWeightedSumOfFunctions<T, I, L>::weightGradient
    ITERATOR begin
 ) const {
   OPENGM_ASSERT(weightNumber< numberOfWeights());
-  return feat_[weightNumber](*begin);
+
+  if(dimension()==1){
+    return feat_[weightNumber](*begin);
+  }
+  else if(dimension()==2){
+    return feat_[weightNumber](*begin, *(begin+1));
+  }
+  else
+    OPENGM_ASSERT(dimension()<=2);
 }
 
 template <class T, class I, class L>
diff --git a/include/opengm/learning/bundle-optimizer.hxx b/include/opengm/learning/bundle-optimizer.hxx
index aebe248..1135b0b 100644
--- a/include/opengm/learning/bundle-optimizer.hxx
+++ b/include/opengm/learning/bundle-optimizer.hxx
@@ -157,7 +157,7 @@ BundleOptimizer<T>::optimize(Oracle& oracle, Weights& w) {
 
 		t++;
 
-		std::cout << std::endl << "----------------- iteration " << t << std::endl;
+        std::cout << std::endl << "----------------- iteration " << t << std::endl;
 
         Weights w_tm1 = w;
 
@@ -173,7 +173,7 @@ BundleOptimizer<T>::optimize(Oracle& oracle, Weights& w) {
 		oracle(w_tm1, L_w_tm1, a_t);
 
 		std::cout << "       L(w)              is: " << L_w_tm1 << std::endl;
-		//std::cout << "      ∂L(w)/∂            is: " << a_t << std::endl;
+        //std::cout << "      ∂L(w)/∂            is: " << a_t << std::endl;
 
 		// update smallest observed value of regularized L
 		minValue = std::min(minValue, L_w_tm1 + _parameter.lambda*0.5*dot(w_tm1, w_tm1));
@@ -183,7 +183,7 @@ BundleOptimizer<T>::optimize(Oracle& oracle, Weights& w) {
 		// compute hyperplane offset
 		T b_t = L_w_tm1 - dot(w_tm1, a_t);
 
-		//std::cout << "adding hyperplane " << a_t << "*w + " << b_t << std::endl;
+        //std::cout << "adding hyperplane " << a_t << "*w + " << b_t << std::endl;
 
 		// update lower bound
 		_bundleCollector.addHyperplane(a_t, b_t);
@@ -195,7 +195,7 @@ BundleOptimizer<T>::optimize(Oracle& oracle, Weights& w) {
 		findMinLowerBound(w, minLower);
 
 		std::cout << " min_w ℒ(w)   + ½λ|w|²   is: " << minLower << std::endl;
-		//std::cout << " w* of ℒ(w)   + ½λ|w|²   is: "  << w << std::endl;
+        //std::cout << " w* of ℒ(w)   + ½λ|w|²   is: "  << w << std::endl;
 
 		// compute gap
 		T eps_t;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/opengm.git



More information about the debian-science-commits mailing list