It is actually pretty debatably whether this needs to be adopted for this project, so feel free to discuss
I will use it for myself and chose a style similar to my own coding style, but I would also be happy to adopt different styles
Besides the clang stuff there are some changes in this pullrequest which I would call minor:
- some more aggressive ignore directives in the
.gitignore
- reordering / restructuring of the includes in
hdnum.hh
While making this change I noticed that there were some dependencies on the order of includes and fixed that.
Example formatting using this clang-format
config (example taken from $PROJ/examples/num0/matrizen.cc
:
before:
// Beispiel wie man A und b für ein
// Gleichungssystem initialisieren könnte
template<class T>
void initialize (hdnum::DenseMatrix<T> &A, hdnum::Vector<T> &b)
{
if (A.rowsize()!=A.colsize() || A.rowsize()==0)
HDNUM_ERROR("need square and nonempty matrix");
if (A.rowsize()!=b.size())
HDNUM_ERROR("b must have same size as A");
for (int i=0; i<A.rowsize(); ++i)
{
b[i] = 1.0;
for (int j=0; j<A.colsize(); ++j)
if (j<=i) A[i][j]=1.0; else A[i][j]=0.0;
}
}
after:
// Beispiel wie man A und b für ein
// Gleichungssystem initialisieren könnte
template <class T>
void initialize (hdnum::DenseMatrix<T> &A, hdnum::Vector<T> &b) {
if (A.rowsize() != A.colsize() || A.rowsize() == 0)
HDNUM_ERROR ("need square and nonempty matrix");
if (A.rowsize() != b.size()) HDNUM_ERROR ("b must have same size as A");
for (int i = 0; i < A.rowsize(); ++i) {
b[i] = 1.0;
for (int j = 0; j < A.colsize(); ++j)
if (j <= i)
A[i][j] = 1.0;
else
A[i][j] = 0.0;
}
}