Alan Gauld a �crit :
I am trying to use a least squares method (the one written by Konrad
Hinsen),
but I do not want the method to be able to generate negative values.
Is there
a way to stop least squares programs from doing so?
def _leastSquare(): # do the thing that might generate negatives
def leastSquare(): firstTry = _leastSquare() if firstTry < 0: return leastSquare() # try again else: return firstTry
Primitive but it works. If you want more a efficient/elegant solution show us what you have...
How is this suppose to work ? Most of the least square algorithm find the nearest local minimum of the distance function. So, if you call many times the least square function without changing the initial values it will do absolutely nothing ! Or what do you suppose for your least square method ?
Alan G.
_______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor
-- Pierre Barbier de Reuille
INRA - UMR Cirad/Inra/Cnrs/Univ.MontpellierII AMAP Botanique et Bio-informatique de l'Architecture des Plantes TA40/PSII, Boulevard de la Lironde 34398 MONTPELLIER CEDEX 5, France
tel : (33) 4 67 61 65 77 fax : (33) 4 67 61 56 68
_______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor
