File: likeDist2USSRV.cpp

package info (click to toggle)
fastml 3.11-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,772 kB
  • sloc: cpp: 48,522; perl: 3,588; ansic: 819; makefile: 386; python: 83; sh: 55
file content (65 lines) | stat: -rwxr-xr-x 2,257 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// 	$Id: likeDist2USSRV.cpp 962 2006-11-07 15:13:34Z privmane $	


#include "likeDist2USSRV.h"
#include "numRec.h"


const MDOUBLE likeDist2USSRV::giveDistance(	const countTableComponentGam& ctcBase,
										   const countTableComponentHom& ctcSSRV,
										   MDOUBLE& resQ,
										   const MDOUBLE initialGuess) const {
	return giveDistanceBrent(ctcBase,ctcSSRV,resQ,initialGuess);
}


const MDOUBLE likeDist2USSRV::giveDistanceBrent(const countTableComponentGam& ctcBase,
												const countTableComponentHom& ctcSSRV,
												MDOUBLE& resL,
												const MDOUBLE initialGuess) const {
	const MDOUBLE ax=0,bx=initialGuess,cx=_maxPairwiseDistance,tol=_toll;
	LOG(12,<<"ax: " << ax << " bx: " << bx << " cx: " << cx << endl);
	MDOUBLE dist=-1.0;
	resL = -brent(ax,bx,cx,
		  C_evalLikeDist2USSRV(ctcBase,ctcSSRV,_model),
		  tol,
		  &dist);
	
	
	LOG(9, <<"brent: resL = " << resL << " dist = " << dist << endl);
	
	return dist;
}	

// @@@@dbrent doesn't work. I should try fix this
//const MDOUBLE likeDist2USSRV::giveDistanceBrent(const countTableComponentGam& ctcBase,
//												const countTableComponentHom& ctcSSRV,
//												MDOUBLE& resL,
//												const MDOUBLE initialGuess) const {
//	const MDOUBLE ax=0,bx=initialGuess,cx=_maxPairwiseDistance,tol=_toll;
//	const MDOUBLE ax_debug=0,bx_debug=initialGuess,cx_debug=_maxPairwiseDistance,tol_debug=_toll;
//	MDOUBLE dist=-1.0;
//	// @@@@ debug OZ
//	MDOUBLE dist_debug=-1.0;
//	MDOUBLE resL_debug = -brent(ax_debug,bx_debug,cx_debug,
//		  C_evalLikeDist2USSRV(ctcBase,ctcSSRV,_model),
//		  tol_debug,
//		  &dist_debug);
//	
//	resL = -dbrent(ax,bx,cx,
//		  C_evalLikeDist2USSRV(ctcBase,ctcSSRV,_model),
//		  C_evalLikeDist_d_2USSRV(ctcBase,ctcSSRV,_model),
//		  tol,
//		  &dist);
//
//	MDOUBLE small = 0.001;
//	if ((resL < resL_debug - small) || (resL_debug < resL-small) ||
//		(dist < dist_debug - small) || (dist_debug < dist-small))
//	{
//		LOG(8,<<"likeDist2USSRV::giveDistanceBrent, different results when using brent and dbrent" << endl);
//		LOG(8,<<"dbrent resL = " << resL << " , brent resL = " << resL_debug << endl);
//		LOG(8,<<"dbrent dist = " << dist << " , brent dist = " << dist_debug << endl);
//	}
//	// end of debug OZ
//	return dist;
//}