Xmipp  v3.23.11-Nereus
IntPoly.h
Go to the documentation of this file.
1 /*
2 
3 CONDOR 1.06 - COnstrained, Non-linear, Direct, parallel Optimization
4  using trust Region method for high-computing load,
5  noisy functions
6 Copyright (C) 2004 Frank Vanden Berghen
7 
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation version 2
11 of the License.
12 
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17 
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 
22 If you want to include this tools in any commercial product,
23 you can contact the author at fvandenb@iridia.ulb.ac.be
24 
25 */
26 
27 #include "Poly.h"
28 #include "Vector.h"
29 #include "ObjectiveFunction.h"
30 
31 #ifndef _INTPOLY_H_
32 #define _INTPOLY_H_
33 
34 
35 class InterPolynomial : public Polynomial
36 {
37 public:
38 
39  double M;
40  unsigned nPtsUsed, nUpdateOfM;
41 
42  // (*this) = sum_i newBasis[i]*NewtonCoefPoly[i]
44  // double *NewtonCoefPoly;
45 
46  // data:
48  double *valuesF;
49  int kbest;
50 
51  double *NewtonCoefficient(double *);
52  void ComputeLagrangeBasis(double *, unsigned nPtsTotal);
53  void GenerateBasis(double rho,double rhosmall, Matrix data,ObjectiveFunction *of);
54 
55 /*
56  InterPolynomial() : Polynomial() {}
57  InterPolynomial( const Polynomial& p ) : Polynomial( p ) {};
58  InterPolynomial( const InterPolynomial& p ) : Polynomial( p ) {};
59 */
60 
61 // InterPolynomial( unsigned _deg, unsigned nPtsTotal, Vector *_Pp, double *_Yp );
62  InterPolynomial( unsigned _deg, double rho, Vector vBase, Matrix data, ObjectiveFunction *of);
63 
64  int findAGoodPointToReplace(int excludeFromT,double rho,
65  Vector pointToAdd, double *modelStep=NULL);
66  void replace(int t, Vector pointToAdd, double valueF);
67  int maybeAdd(Vector pointToAdd, unsigned k, double rho, double valueF);
68 
69  void updateM(Vector newPoint, double valueF);
70  int checkIfValidityIsInBound(Vector dd, unsigned k, double bound, double rho);
71  int getGoodInterPolationSites(Matrix d, int k, double rho, Vector *v=NULL);
72  double interpError(Vector Point);
73 
74  void translate(int k);
75  void translate(Vector translation);
76 
77 // void test();
78 // void check(Vector Base, double (*f)( Vector ) );
79 
80  // allow shallow copy:
86  void copyFrom(Polynomial a);
87  InterPolynomial(unsigned dim, unsigned deg);
88 
89 protected:
90  void destroyCurrentBuffer();
91 
92 };
93 
94 #ifndef NOOBJECTIVEFUNCTION
95 
96 #endif
97 
98 #endif /* _MPI_INTPOLY_H_ */
double interpError(Vector Point)
Definition: IntPoly.cpp:536
InterPolynomial & operator=(const InterPolynomial &A)
Definition: IntPoly.cpp:838
int getGoodInterPolationSites(Matrix d, int k, double rho, Vector *v=NULL)
Definition: IntPoly.cpp:750
Vector * NewtonPoints
Definition: IntPoly.h:47
void GenerateBasis(double rho, double rhosmall, Matrix data, ObjectiveFunction *of)
Definition: IntPoly.cpp:324
void destroyCurrentBuffer()
Definition: IntPoly.cpp:805
int findAGoodPointToReplace(int excludeFromT, double rho, Vector pointToAdd, double *modelStep=NULL)
Definition: IntPoly.cpp:551
void updateM(Vector newPoint, double valueF)
Definition: IntPoly.cpp:519
double rho
Definition: Vector.h:37
unsigned dim()
Definition: Poly.h:62
unsigned deg()
Definition: Poly.h:63
Definition: point.h:32
double * NewtonCoefficient(double *)
int maybeAdd(Vector pointToAdd, unsigned k, double rho, double valueF)
Definition: IntPoly.cpp:649
ql0001_ & k(htemp+1),(cvec+1),(atemp+1),(bj+1),(bl+1),(bu+1),(x+1),(clamda+1), &iout, infoqp, &zero,(w+1), &lenw,(iw+1), &leniw, &glob_grd.epsmac
void replace(int t, Vector pointToAdd, double valueF)
Definition: IntPoly.cpp:622
void ComputeLagrangeBasis(double *, unsigned nPtsTotal)
Definition: IntPoly.cpp:127
InterPolynomial clone()
Definition: IntPoly.cpp:868
unsigned nUpdateOfM
Definition: IntPoly.h:40
double * valuesF
Definition: IntPoly.h:48
Vector vBase
Definition: IntPoly.h:47
void copyFrom(InterPolynomial a)
Definition: IntPoly.cpp:876
Definition: Matrix.h:38
PolynomialData * d
Definition: Poly.h:49
unsigned nPtsUsed
Definition: IntPoly.h:40
int checkIfValidityIsInBound(Vector dd, unsigned k, double bound, double rho)
Definition: IntPoly.cpp:684
double M
Definition: IntPoly.h:39
Polynomial * NewtonBasis
Definition: IntPoly.h:43
InterPolynomial(unsigned _deg, double rho, Vector vBase, Matrix data, ObjectiveFunction *of)
Definition: IntPoly.cpp:228
doublereal * a
void translate(int k)