Skip to content
Snippets Groups Projects
Commit d22ab424 authored by Sander, Oliver's avatar Sander, Oliver
Browse files

Don't hand-code the Frobenius norm

Use the corresponding member method of FieldMatrix.
parent 3fcdf894
No related branches found
No related tags found
No related merge requests found
......@@ -16,19 +16,6 @@ namespace MatrixOperations {
return Id;
}
static double norm(VectorRT v){
return sqrt(pow(v[0],2) + pow(v[1],2) + pow(v[2],2));
}
static double norm(MatrixRT M){
return sqrt(
pow(M[0][0],2) + pow(M[0][1],2) + pow(M[0][2],2)
+ pow(M[1][0],2) + pow(M[1][1],2) + pow(M[1][2],2)
+ pow(M[2][0],2) + pow(M[2][1],2) + pow(M[2][2],2));
}
// static MatrixRT sym (MatrixRT M) { // 1/2 (M^T + M)
// MatrixRT ret(0);
// for (int i = 0; i< 3; i++)
......@@ -210,7 +197,7 @@ namespace MatrixOperations {
static double QuadraticForm(const double mu, const double lambda, const MatrixRT M){
auto tmp1 = sym(M);
double tmp2 = norm(tmp1);
double tmp2 = tmp1.frobenius_norm();
// double tmp2 = norm(M); //TEST
return lambda*std::pow(trace(M),2) + 2.0*mu*pow( tmp2 ,2);
// return lambda*std::pow(trace(M),2) + 2*mu*pow( norm( sym(M) ),2);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment