Bullet Collision Detection & Physics Library
|
Go to the documentation of this file.
16 #ifndef BT_CONJUGATE_GRADIENT_H
17 #define BT_CONJUGATE_GRADIENT_H
24 template <
class MatrixX>
57 std::cout <<
"Iteration = 0" << std::endl;
58 std::cout <<
"Two norm of the residual = " << r_dot_z << std::endl;
71 std::cout <<
"Encountered negative direction in CG!" << std::endl;
86 r_dot_z = r_dot_z_new;
87 r_dot_z_new =
dot(
r,
z);
91 std::cout <<
"ConjugateGradient iterations " << k << std::endl;
101 std::cout <<
"ConjugateGradient max iterations reached " <<
max_iterations << std::endl;
120 for (
int i = 0; i < a.
size(); ++i)
135 for (
int i = 0; i < a.
size(); ++i)
136 ans += a[i].
dot(b[i]);
144 for (
int i = 0; i < a.
size(); ++i)
145 result[i] += s * a[i];
153 for (
int i = 0; i < a.
size(); ++i)
154 result[i] = s * a[i] + b[i];
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
int solve(MatrixX &A, TVStack &x, const TVStack &b, bool verbose=false)
btConjugateGradient(const int max_it_in)
btScalar tolerance_squared
void resize(int newsize, const T &fillData=T())
void reinitialize(const TVStack &b)
TVStack sub(const TVStack &a, const TVStack &b)
void multAndAddTo(btScalar s, const TVStack &a, TVStack &result)
TVStack multAndAdd(btScalar s, const TVStack &a, const TVStack &b)
btScalar squaredNorm(const TVStack &a)
btScalar dot(const TVStack &a, const TVStack &b)
btAlignedObjectArray< btVector3 > TVStack
virtual ~btConjugateGradient()
int size() const
return the number of elements in the array