enable and apply clang-format to a whole bunch of small .cpp files in src/
This commit is contained in:
@ -1,4 +1,3 @@
|
||||
// clang-format off
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
@ -23,23 +22,23 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
using std::vector;
|
||||
using std::array;
|
||||
using std::vector;
|
||||
using namespace MathEigen;
|
||||
|
||||
// Special case: 3x3 matrices
|
||||
|
||||
typedef Jacobi<double,double*,double(*)[3],double const(*)[3]> Jacobi_v1;
|
||||
typedef Jacobi<double,double*,double**,double const*const*> Jacobi_v2;
|
||||
typedef Jacobi<double, double *, double (*)[3], double const (*)[3]> Jacobi_v1;
|
||||
typedef Jacobi<double, double *, double **, double const *const *> Jacobi_v2;
|
||||
|
||||
int MathEigen::jacobi3(double const mat[3][3], double *eval, double evec[3][3])
|
||||
{
|
||||
// make copy of const matrix
|
||||
|
||||
double mat_cpy[3][3] = { {mat[0][0], mat[0][1], mat[0][2]},
|
||||
{mat[1][0], mat[1][1], mat[1][2]},
|
||||
{mat[2][0], mat[2][1], mat[2][2]} };
|
||||
double *M[3] = { &(mat_cpy[0][0]), &(mat_cpy[1][0]), &(mat_cpy[2][0]) };
|
||||
double mat_cpy[3][3] = {{mat[0][0], mat[0][1], mat[0][2]},
|
||||
{mat[1][0], mat[1][1], mat[1][2]},
|
||||
{mat[2][0], mat[2][1], mat[2][2]}};
|
||||
double *M[3] = {&(mat_cpy[0][0]), &(mat_cpy[1][0]), &(mat_cpy[2][0])};
|
||||
int midx[3];
|
||||
|
||||
// create instance of generic Jacobi class and get eigenvalues and -vectors
|
||||
@ -49,21 +48,20 @@ int MathEigen::jacobi3(double const mat[3][3], double *eval, double evec[3][3])
|
||||
|
||||
// transpose the evec matrix
|
||||
|
||||
for (int i=0; i<3; i++)
|
||||
for (int j=i+1; j<3; j++)
|
||||
std::swap(evec[i][j], evec[j][i]);
|
||||
for (int i = 0; i < 3; i++)
|
||||
for (int j = i + 1; j < 3; j++) std::swap(evec[i][j], evec[j][i]);
|
||||
|
||||
return ierror;
|
||||
}
|
||||
|
||||
int MathEigen::jacobi3(double const* const* mat, double *eval, double **evec)
|
||||
int MathEigen::jacobi3(double const *const *mat, double *eval, double **evec)
|
||||
{
|
||||
// make copy of const matrix
|
||||
|
||||
double mat_cpy[3][3] = { {mat[0][0], mat[0][1], mat[0][2]},
|
||||
{mat[1][0], mat[1][1], mat[1][2]},
|
||||
{mat[2][0], mat[2][1], mat[2][2]} };
|
||||
double *M[3] = { &(mat_cpy[0][0]), &(mat_cpy[1][0]), &(mat_cpy[2][0]) };
|
||||
double mat_cpy[3][3] = {{mat[0][0], mat[0][1], mat[0][2]},
|
||||
{mat[1][0], mat[1][1], mat[1][2]},
|
||||
{mat[2][0], mat[2][1], mat[2][2]}};
|
||||
double *M[3] = {&(mat_cpy[0][0]), &(mat_cpy[1][0]), &(mat_cpy[2][0])};
|
||||
int midx[3];
|
||||
|
||||
// create instance of generic Jacobi class and get eigenvalues and -vectors
|
||||
@ -73,9 +71,8 @@ int MathEigen::jacobi3(double const* const* mat, double *eval, double **evec)
|
||||
|
||||
// transpose the evec matrix
|
||||
|
||||
for (int i=0; i<3; i++)
|
||||
for (int j=i+1; j<3; j++)
|
||||
std::swap(evec[i][j], evec[j][i]);
|
||||
for (int i = 0; i < 3; i++)
|
||||
for (int j = i + 1; j < 3; j++) std::swap(evec[i][j], evec[j][i]);
|
||||
|
||||
return ierror;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user