Commit c0345f8d authored by Carsten Gräser's avatar Carsten Gräser

Implement SymmetricMatrix::(dataSize(), frobenius_norm2(), frobenius_norm())

parent 3378b903
Pipeline #16268 passed with stage
in 60 minutes and 22 seconds
......@@ -92,6 +92,22 @@ public:
data_.axpy(a,other.data_);
}
/** \brief Compute the Frobenius norm of the matrix */
T frobenius_norm2() const
{
T result = 0;
for (size_t i=0; i<N; i++)
for (size_t j=0; j<=N; j++)
result += operator()(i,j)*operator()(i,j);
return result;
}
/** \brief Compute the Frobenius norm of the matrix */
T frobenius_norm() const
{
return std::sqrt(frobenius_norm2());
}
const Data& data() const
{
return data_;
......@@ -102,6 +118,13 @@ public:
return data_;
}
/** \brief Number of scalars needed for compressed vector storage of the symmetric matrix
*/
static constexpr size_t dataSize()
{
return Data::size();
}
private:
Data data_;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment