diff --git a/Source/C/SMatrix_c.h b/Source/C/SMatrix_c.h index d2629770..4a49f801 100644 --- a/Source/C/SMatrix_c.h +++ b/Source/C/SMatrix_c.h @@ -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); @@ -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 diff --git a/Source/CPlusPlus/SMatrix.cc b/Source/CPlusPlus/SMatrix.cc index 68620ae4..48dbbe8d 100644 --- a/Source/CPlusPlus/SMatrix.cc +++ b/Source/CPlusPlus/SMatrix.cc @@ -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); } //////////////////////////////////////////////////////////////////////////////// diff --git a/Source/CPlusPlus/SMatrix.h b/Source/CPlusPlus/SMatrix.h index 40984449..21f90116 100644 --- a/Source/CPlusPlus/SMatrix.h +++ b/Source/CPlusPlus/SMatrix.h @@ -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. diff --git a/Source/Fortran/SMatrixAlgebraModule.F90 b/Source/Fortran/SMatrixAlgebraModule.F90 index 1493a300..ace4bbc9 100644 --- a/Source/Fortran/SMatrixAlgebraModule.F90 +++ b/Source/Fortran/SMatrixAlgebraModule.F90 @@ -533,13 +533,11 @@ 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 @@ -547,13 +545,11 @@ SUBROUTINE DiagonalScale_lsr(mat, tlist, threshold_in) 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 diff --git a/Source/Wrapper/SMatrixAlgebraModule_wrp.F90 b/Source/Wrapper/SMatrixAlgebraModule_wrp.F90 index 55fec023..405bd326 100644 --- a/Source/Wrapper/SMatrixAlgebraModule_wrp.F90 +++ b/Source/Wrapper/SMatrixAlgebraModule_wrp.F90 @@ -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. @@ -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 diff --git a/UnitTests/test_matrix.py b/UnitTests/test_matrix.py index 2d874988..90ee3d14 100644 --- a/UnitTests/test_matrix.py +++ b/UnitTests/test_matrix.py @@ -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)