Skip to content

Commit

Permalink
Remove unused parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
william-dawson committed Apr 17, 2024
1 parent 235289d commit 42a94c6
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 21 deletions.
6 changes: 2 additions & 4 deletions Source/C/SMatrix_c.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ void PrintMatrix_lsr_wrp(const int *ih_this);
void PrintMatrixF_lsr_wrp(const int *ih_this, const char *file_name,
const int *name_size);
void MatrixToTripletList_lsr_wrp(const int *ih_this, int *ih_triplet_list);
void DiagonalScale_lsr_wrp(int *ih_mat, const int *ih_tlist,
const double *threhsold);
void DiagonalScale_lsr_wrp(int *ih_mat, const int *ih_tlist);

void ConstructMatrixFromFile_lsc_wrp(int *ih_this, const char *file_name,
const int *name_size);
Expand Down Expand Up @@ -72,7 +71,6 @@ void PrintMatrix_lsc_wrp(const int *ih_this);
void PrintMatrixF_lsc_wrp(const int *ih_this, const char *file_name,
const int *name_size);
void MatrixToTripletList_lsc_wrp(const int *ih_this, int *ih_triplet_list);
void DiagonalScale_lsc_wrp(int *ih_mat, const int *ih_tlist,
const double *threhsold);
void DiagonalScale_lsc_wrp(int *ih_mat, const int *ih_tlist);

#endif
6 changes: 3 additions & 3 deletions Source/CPlusPlus/SMatrix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,13 @@ void Matrix_lsc::Gemm(const Matrix_lsc &matA, const Matrix_lsc &matB,
}

////////////////////////////////////////////////////////////////////////////////
void Matrix_lsr::DiagonalScale(const TripletList_r &tlist, double threshold) {
DiagonalScale_lsr_wrp(ih_this, tlist.ih_this, &threshold);
void Matrix_lsr::DiagonalScale(const TripletList_r &tlist) {
DiagonalScale_lsr_wrp(ih_this, tlist.ih_this);
}

////////////////////////////////////////////////////////////////////////////////
void Matrix_lsc::DiagonalScale(const TripletList_c &tlist, double threshold) {
DiagonalScale_lsc_wrp(ih_this, tlist.ih_this, &threshold);
DiagonalScale_lsc_wrp(ih_this, tlist.ih_this);
}

////////////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion Source/CPlusPlus/SMatrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class Matrix_lsr {
//! Scale a matrix using a diagonal matrix (triplet list form).
//!\param tlist the triplet list.
//!\param threshold for flushing small values.
void DiagonalScale(const NTPoly::TripletList_r &tlist, double threshold);
void DiagonalScale(const NTPoly::TripletList_r &tlist);

public:
//! Transpose a sparse matrix.
Expand Down
8 changes: 2 additions & 6 deletions Source/Fortran/SMatrixAlgebraModule.F90
Original file line number Diff line number Diff line change
Expand Up @@ -533,27 +533,23 @@ PURE SUBROUTINE PruneList_lsc(memorypool,alpha,threshold, &
END SUBROUTINE PruneList_lsc
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!> Scale a matrix using a diagonal matrix (triplet list form).
SUBROUTINE DiagonalScale_lsr(mat, tlist, threshold_in)
SUBROUTINE DiagonalScale_lsr(mat, tlist)
!> The matrix to scale.
TYPE(Matrix_lsr), INTENT(INOUT) :: mat
!> The diagonal matrix.
TYPE(TripletList_r), INTENT(IN) :: tlist
!> For flushing values to zero. Default value is 0.0.
REAL(NTREAL), OPTIONAL, INTENT(IN) :: threshold_in
!! Intermediate Data
REAL(NTREAL) :: val

#include "sparse_includes/DiagonalScale.f90"
END SUBROUTINE DiagonalScale_lsr
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!> Scale a matrix using a diagonal matrix (triplet list form).
SUBROUTINE DiagonalScale_lsc(mat, tlist, threshold_in)
SUBROUTINE DiagonalScale_lsc(mat, tlist)
!> The matrix to scale.
TYPE(Matrix_lsc), INTENT(INOUT) :: mat
!> The diagonal matrix.
TYPE(TripletList_c), INTENT(IN) :: tlist
!> For flushing values to zero. Default value is 0.0.
REAL(NTREAL), OPTIONAL, INTENT(IN) :: threshold_in
!! Intermediate Data
COMPLEX(NTCOMPLEX) :: val

Expand Down
10 changes: 4 additions & 6 deletions Source/Wrapper/SMatrixAlgebraModule_wrp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -114,18 +114,17 @@ SUBROUTINE MatrixMultiply_lsr_wrp(ih_matA, ih_matB, ih_matC, IsATransposed, &
END SUBROUTINE MatrixMultiply_lsr_wrp
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!> Scale a matrix using a diagonal matrix (triplet list form).
SUBROUTINE DiagonalScale_lsr_wrp(ih_mat, ih_tlist, threshold) &
SUBROUTINE DiagonalScale_lsr_wrp(ih_mat, ih_tlist) &
& BIND(c,name="DiagonalScale_lsr_wrp")
INTEGER(kind=c_int), INTENT(INOUT) :: ih_mat(SIZE_wrp)
INTEGER(kind=c_int), INTENT(IN) :: ih_tlist(SIZE_wrp)
REAL(NTREAL), INTENT(in) :: threshold
TYPE(Matrix_lsr_wrp) :: h_mat
TYPE(TripletList_r_wrp) :: h_tlist

h_mat = TRANSFER(ih_mat, h_mat)
h_tlist = TRANSFER(ih_tlist, h_tlist)

CALL DiagonalScale(h_mat%DATA, h_tlist%DATA, threshold)
CALL DiagonalScale(h_mat%DATA, h_tlist%DATA)
END SUBROUTINE DiagonalScale_lsr_wrp
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!> Wrap the scale a sparse matrix by a constant routine.
Expand Down Expand Up @@ -220,18 +219,17 @@ SUBROUTINE MatrixMultiply_lsc_wrp(ih_matA, ih_matB, ih_matC, IsATransposed, &
END SUBROUTINE MatrixMultiply_lsc_wrp
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!> Scale a matrix using a diagonal matrix (triplet list form).
SUBROUTINE DiagonalScale_lsc_wrp(ih_mat, ih_tlist, threshold) &
SUBROUTINE DiagonalScale_lsc_wrp(ih_mat, ih_tlist) &
& BIND(c,name="DiagonalScale_lsc_wrp")
INTEGER(kind=c_int), INTENT(INOUT) :: ih_mat(SIZE_wrp)
INTEGER(kind=c_int), INTENT(IN) :: ih_tlist(SIZE_wrp)
REAL(NTREAL), INTENT(in) :: threshold
TYPE(Matrix_lsc_wrp) :: h_mat
TYPE(TripletList_c_wrp) :: h_tlist

h_mat = TRANSFER(ih_mat, h_mat)
h_tlist = TRANSFER(ih_tlist, h_tlist)

CALL DiagonalScale(h_mat%DATA, h_tlist%DATA, threshold)
CALL DiagonalScale(h_mat%DATA, h_tlist%DATA)
END SUBROUTINE DiagonalScale_lsc_wrp
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
END MODULE SMatrixAlgebraModule_wrp
2 changes: 1 addition & 1 deletion UnitTests/test_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ def test_scalediag(self):
tlist.Append(t)
CheckMat[:, i] *= i
ntmatrix = self.SMatrix(self.file1)
ntmatrix.DiagonalScale(tlist, 0)
ntmatrix.DiagonalScale(tlist)
ntmatrix.WriteToMatrixMarket(self.file2)

ResultMat = mmread(self.file2)
Expand Down

0 comments on commit 42a94c6

Please sign in to comment.