From 0cecdd353161531621bd79da18ec3758a689a442 Mon Sep 17 00:00:00 2001
From: Rene Brun <Rene.Brun@cern.ch>
Date: Wed, 9 May 2007 10:06:17 +0000
Subject: [PATCH] From Christophe Delaere: "Moved the declaration of 3 matrices
 to the BFGS-specific part of the code to avoid unneeded instantiations when
 using other training methods."

git-svn-id: http://root.cern.ch/svn/root/trunk@18705 27541ba8-7e3a-0410-8455-c3a389f83636
---
 mlp/src/TMultiLayerPerceptron.cxx | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/mlp/src/TMultiLayerPerceptron.cxx b/mlp/src/TMultiLayerPerceptron.cxx
index bf6a4ffffdd..a072c28c5bb 100644
--- a/mlp/src/TMultiLayerPerceptron.cxx
+++ b/mlp/src/TMultiLayerPerceptron.cxx
@@ -1,4 +1,4 @@
-// @(#)root/mlp:$Name:  $:$Id: TMultiLayerPerceptron.cxx,v 1.40 2007/01/02 14:05:48 brun Exp $
+// @(#)root/mlp:$Name:  $:$Id: TMultiLayerPerceptron.cxx,v 1.41 2007/01/29 16:14:25 brun Exp $
 // Author: Christophe.Delaere@cern.ch   20/07/03
 
 /*************************************************************************
@@ -791,9 +791,6 @@ void TMultiLayerPerceptron::Train(Int_t nEpoch, Option_t * option)
    Double_t *dir = new Double_t[els];
    for (i = 0; i < els; i++)
       buffer[i] = 0;
-   TMatrixD bfgsh(els, els);
-   TMatrixD gamma(els, 1);
-   TMatrixD delta(els, 1);
    // Epoch loop. Here is the training itself.
    for (Int_t iepoch = 0; iepoch < nEpoch; iepoch++) {
       switch (fLearningMethod) {
@@ -878,6 +875,9 @@ void TMultiLayerPerceptron::Train(Int_t nEpoch, Option_t * option)
          }
       case TMultiLayerPerceptron::kBFGS:
          {
+            TMatrixD bfgsh(els, els);
+            TMatrixD gamma(els, 1);
+            TMatrixD delta(els, 1);
             SetGammaDelta(gamma, delta, buffer);
             if (!(iepoch % fReset)) {
                SteepestDir(dir);
-- 
GitLab