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;
}
}
Activity
added tooling label
mentioned in merge request !10 (merged)
The includes and the .gitignore is definitely good.
About the clang-formatting: I guess this is only applied if you call it. We could add your suggestion without formatting any files. Then you can use it for your actual implementation and adjust it later on if we find something where it could be improved.
If you think that this can be merged just reply to this comment and I will do so :)
mentioned in commit fdfb6672