Skip to content

Commit

Permalink
[ParU] Mark more function arguments const
Browse files Browse the repository at this point in the history
Express the intention of an input variable more clear
Found by Cppcheck (constParameterPointer)
  • Loading branch information
gruenich committed Dec 25, 2023
1 parent fcd6151 commit 51da3a9
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion ParU/Source/paru_backward.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#include "paru_internal.hpp"

ParU_Ret paru_backward(double *x1, double &resid, double &anorm, double &xnorm,
ParU_Ret paru_backward(const double *x1, double &resid, double &anorm, double &xnorm,
cholmod_sparse *A, ParU_Symbolic *Sym, ParU_Numeric *Num,
ParU_Control *Control)
{
Expand Down
4 changes: 2 additions & 2 deletions ParU/Source/paru_print.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/

#include "paru_internal.hpp"
void paru_print_element(int64_t e, paru_work *Work, ParU_Numeric *Num)
void paru_print_element(int64_t e, paru_work *Work, const ParU_Numeric *Num)
{
// print out contribution blocks
paru_element **elementList;
Expand Down Expand Up @@ -70,7 +70,7 @@ void paru_print_element(int64_t e, paru_work *Work, ParU_Numeric *Num)
}
}

void paru_print_paru_tupleList(paru_tupleList *listSet, int64_t index)
void paru_print_paru_tupleList(const paru_tupleList *listSet, int64_t index)
{
DEBUGLEVEL(0);
PRLEVEL(1, ("%% listSet =%p\n", listSet));
Expand Down
4 changes: 2 additions & 2 deletions ParU/Source/paru_residual.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

#include "paru_internal.hpp"

ParU_Ret ParU_Residual (cholmod_sparse *A, double *x, double *b, int64_t m,
ParU_Ret ParU_Residual (cholmod_sparse *A, const double *x, const double *b, int64_t m,
double &resid, double &anorm, double &xnorm, ParU_Control *Control)
{
DEBUGLEVEL(0);
Expand Down Expand Up @@ -81,7 +81,7 @@ ParU_Ret ParU_Residual (cholmod_sparse *A, double *x, double *b, int64_t m,
* resid = norm1(b-A*x) / norm1(A)
*
* */
ParU_Ret ParU_Residual(cholmod_sparse *A, double *X, double *B, int64_t m,
ParU_Ret ParU_Residual(cholmod_sparse *A, const double *X, const double *B, int64_t m,
int64_t nrhs,
double &resid, double &anorm, double &xnorm, ParU_Control *Control)
{
Expand Down
4 changes: 2 additions & 2 deletions ParU/Source/paru_solve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ ParU_Ret ParU_Solve(ParU_Symbolic *Sym, ParU_Numeric *Num, double *b,
// ParU_Solve: x = A\b
//------------------------------------------------------------------------------

ParU_Ret ParU_Solve(ParU_Symbolic *Sym, ParU_Numeric *Num, double *b, double *x,
ParU_Ret ParU_Solve(ParU_Symbolic *Sym, ParU_Numeric *Num, const double *b, double *x,
ParU_Control *Control)
{

Expand Down Expand Up @@ -118,7 +118,7 @@ ParU_Ret ParU_Solve(ParU_Symbolic *Sym, ParU_Numeric *Num, int64_t nrhs,
//------------------------------------------------------------------------------

ParU_Ret ParU_Solve(ParU_Symbolic *Sym, ParU_Numeric *Num, int64_t nrhs,
double *B, double *X, ParU_Control *Control)
const double *B, double *X, ParU_Control *Control)
{
// Note: B and X can be aliased
DEBUGLEVEL(0);
Expand Down
4 changes: 2 additions & 2 deletions ParU/Source/paru_tasked_dgemm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
#include "paru_internal.hpp"

int64_t paru_tasked_dgemm(int64_t f, int64_t M, int64_t N, int64_t K,
double *A, int64_t lda, double *B, int64_t ldb, double beta, double *C,
int64_t ldc, paru_work *Work, ParU_Numeric *Num)
const double *A, int64_t lda, const double *B, int64_t ldb, double beta, double *C,
int64_t ldc, const paru_work *Work, ParU_Numeric *Num)
{
DEBUGLEVEL(0);
// alpha is always -1 in my DGEMMs
Expand Down
6 changes: 3 additions & 3 deletions ParU/Source/paru_tasked_trsm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
* @author Aznaveh
*/
#include "paru_internal.hpp"
int64_t paru_tasked_trsm(int64_t f, int64_t m, int64_t n, double alpha, double *a, int64_t lda,
double *b, int64_t ldb, paru_work *Work, ParU_Numeric *Num)
int64_t paru_tasked_trsm(int64_t f, int64_t m, int64_t n, double alpha, const double *a, int64_t lda,
double *b, int64_t ldb, const paru_work *Work, const ParU_Numeric *Num)
{
DEBUGLEVEL(0);
int64_t naft;
ParU_Control *Control = Num->Control;
const ParU_Control *Control = Num->Control;
int64_t L = Control->worthwhile_trsm;
int64_t blas_ok = TRUE;
#ifdef PARU_COVERAGE
Expand Down

0 comments on commit 51da3a9

Please sign in to comment.