Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • H hdnum
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 4
    • Issues 4
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Teaching
  • hdnum
  • Merge requests
  • !9

clang format config & includes & gitignore

  • Review changes

  • Download
  • Patches
  • Plain diff
Merged Christian Heusel requested to merge clang_format into master Aug 25, 2020
  • Overview 3
  • Commits 7
  • Pipelines 0
  • Changes 5

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;
    }
}
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: clang_format