Skip to content

Commit

Permalink
Merge pull request root-project#11 from Dr15Jones/makeSMatrixThreadSafe
Browse files Browse the repository at this point in the history
Made smatrix code thread safe by removing statics
  • Loading branch information
ktf committed May 23, 2014
2 parents fb22a6f + b693b84 commit 554f936
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions math/smatrix/inc/Math/Dfact.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ static bool Dfact(MatRepStd<T,n,idim>& rhs, T& det) {
//typename MatrixRep::value_type* a = rhs.Array();

/* Local variables */
static unsigned int nxch, i, j, k, l;
unsigned int nxch, i, j, k, l;
//static typename MatrixRep::value_type p, q, tf;
static T p, q, tf;
T p, q, tf;

/* Parameter adjustments */
// a -= idim + 1;
static int arrayOffset = - int(idim+1);
const int arrayOffset = - int(idim+1);
/* Function Body */

// fact.inc
Expand Down
4 changes: 2 additions & 2 deletions math/smatrix/inc/Math/Dfactir.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ bool Dfactir(Matrix& rhs, typename Matrix::value_type& det, unsigned int* ir)
typename Matrix::value_type* a = rhs.Array();

/* Local variables */
static unsigned int nxch, i, j, k, l;
static typename Matrix::value_type p, q, tf;
unsigned int nxch, i, j, k, l;
typename Matrix::value_type p, q, tf;

/* Parameter adjustments */
a -= idim + 1;
Expand Down
6 changes: 3 additions & 3 deletions math/smatrix/inc/Math/Dfinv.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ bool Dfinv(Matrix& rhs, unsigned int* ir) {
typename Matrix::value_type* a = rhs.Array();

/* Local variables */
static unsigned int nxch, i, j, k, m, ij;
static unsigned int im2, nm1, nmi;
static typename Matrix::value_type s31, s34, ti;
unsigned int nxch, i, j, k, m, ij;
unsigned int im2, nm1, nmi;
typename Matrix::value_type s31, s34, ti;

/* Parameter adjustments */
a -= idim + 1;
Expand Down
2 changes: 1 addition & 1 deletion math/smatrix/inc/Math/Dinv.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class Inverter {
/* Initialized data */
unsigned int work[n+1] = {0};

static typename MatrixRep::value_type det(0.0);
typename MatrixRep::value_type det(0.0);

if (DfactMatrix(rhs,det,work) != 0) {
std::cerr << "Dfact_matrix failed!!" << std::endl;
Expand Down
4 changes: 2 additions & 2 deletions math/smatrix/inc/Math/Dsfact.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ static bool Dsfact(MatRepStd<T,n,idim>& rhs, T& det) {
#endif

/* Local variables */
static unsigned int i, j, l;
unsigned int i, j, l;

/* Parameter adjustments */
// a -= idim + 1;
static int arrayOffset = -(idim+1);
const int arrayOffset = -(idim+1);
/* sfactd.inc */
det = 1.;
for (j = 1; j <= n; ++j) {
Expand Down
8 changes: 4 additions & 4 deletions math/smatrix/inc/Math/Dsinv.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ class SInverter
inline static bool Dsinv(MatrixRep& rhs) {

/* Local variables */
static int i, j, k, l;
static T s31, s32;
static int jm1, jp1;
int i, j, k, l;
T s31, s32;
int jm1, jp1;

/* Parameter adjustments */
static int arrayOffset = -1*(idim + 1);
const int arrayOffset = -1*(idim + 1);


/* Function Body */
Expand Down

0 comments on commit 554f936

Please sign in to comment.