//-- FILE: function.cc
//-- CODER: KUBO Takuya (kubo@ees.hokudai.ac.jp)
//--
//-- (C)opyright 2000 KUBO Takuya (kubo@ees.hokudai.ac.jp).
//-- All rights are reserved.
//-- Do not modify without amending copyright,
//-- distribute freely but retain this paragraph.
//--
//-- CHANGE: Mon Feb 28 10:43:20 2000
// MODIFY: Sat Feb 5 17:58:44 2000
#include "ml.h"
double function( Plist* p, ItrSample itr_sample ) {
double y = ( *itr_sample )[ 0 ]; // the first column
double x = ( *itr_sample )[ 1 ]; // the second column
double h = 1.0 /
(
1.0 / p->Val( 2 ) +
1.0 / p->Val( 0 ) * pow( x, - p->Val( 1 ) )
); // height of tree given by an allometric equation
return - ( y - h ) * ( y - h ); // + ( term without p )
} |