Subversion Repositories gelsvn

Rev

Rev 222 | Rev 315 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 222 Rev 230
1
#include <iostream>
1
#include <iostream>
2
 
2
 
3
#include "QEM.h"
3
#include "QEM.h"
4
#include "LinAlg/LapackFunc.h"
4
#include "LinAlg/LapackFunc.h"
5
#include <gsl/gsl_matrix.h>
-
 
6
#include <gsl/gsl_linalg.h>
-
 
7
 
5
 
8
using namespace LinAlg;
6
using namespace LinAlg;
9
using namespace CGLA;
7
using namespace CGLA;
10
using namespace std;
8
using namespace std;
11
 
9
 
12
namespace Geometry
10
namespace Geometry
13
{
11
{
14
	Vec3d QEM::opt_pos(double sv_thresh) const
12
	Vec3d QEM::opt_pos(double sv_thresh) const
15
	{
13
	{
16
			CMatrix A_num(A);
14
			CMatrix A_num(A);
17
			CVector b_num(b);
15
			CVector b_num(b);
18
			CVector x(3);
16
			CVector x(3);
19
			x = LinearLSSolve(A,b);
17
			x = LinearLSSolve(A,b);
20
			/* Actually LSSolve uses SVD, but we cannot set a cut off value for
18
			/* Actually LSSolve uses SVD, but we cannot set a cut off value for
21
				 the singular values. Might be worth fixing */
19
				 the singular values. Might be worth fixing */
22
			Vec3d p(-x[0], -x[1], -x[2]);
20
			Vec3d p(-x[0], -x[1], -x[2]);
23
			return p;
21
			return p;
24
	}
22
	}
25
 
23
 
26
}
24
}
27
 
25