* Compute the quadratic matrix norm.
* Return value is the root of the square
* sum of all matrix entries. Also called
- * Frobenius Norm.
+ * Frobenius norm.
*
* This norm is compatible with the $l_2$
* vector norm. But it is not a natural
* therefore it is not called $l_2$-norm.
*/
number norm2 () const;
+
+ /**
+ * Compute the relative norm of
+ * the skew-symmetric part. The
+ * return value is the Frobenius
+ * norm of the skew-symmetric
+ * part of the matrix divided by
+ * that of the matrix.
+ *
+ * Main purpose of this function
+ * is to check, if a matrix is
+ * symmetric within a certain
+ * accuracy, or not.
+ */
+ number relative_symmetry_norm2 () const;
/**
* A=Inverse(A). Inversion of
number s = 0.;
for (unsigned int i=0;i<dim_image*dim_range;++i)
s += val[i]*val[i];
- return s;
+ return sqrt(s);
+}
+
+
+template <typename number>
+number
+FullMatrix<number>::relative_symmetry_norm2 () const
+{
+ Assert (val != 0, ExcEmptyMatrix());
+
+ number s = 0.;
+ number a = 0.;
+ for (unsigned int i=0;i<dim_image;++i)
+ for (unsigned int j=0;j<dim_range;++j)
+ {
+ a += ((*this)(i,j)-(*this)(j,i))*((*this)(i,j)-(*this)(j,i));
+ s += (*this)(i,j)*(*this)(i,j);
+ }
+ if (s!=0.)
+ return sqrt(a)/sqrt(s);
+ return 0;
}