Skip to content

Commit

Permalink
updates to prepare for v8.1.2 release.
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyeli committed Nov 12, 2022
1 parent 3859112 commit 58e4171
Show file tree
Hide file tree
Showing 22 changed files with 514 additions and 461 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ cmake_minimum_required(VERSION 3.18.1 FATAL_ERROR)
project(SuperLU_DIST C CXX)
set(VERSION_MAJOR "8")
set(VERSION_MINOR "1")
set(VERSION_BugFix "1")
set(VERSION_BugFix "2")
set(PROJECT_VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_BugFix})

list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
Expand Down
141 changes: 75 additions & 66 deletions SRC/dgsequ_dist.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,83 +8,92 @@ All rights reserved.
The source code is distributed under BSD license, see the file License.txt
at the top-level directory.
*/
/*! @file
* \brief Computes row and column scalings
*/


/*! @file dgsequ_dist.c
* \brief Computes row and column scalings
*
* <pre>
* -- SuperLU routine (version 2.0) --
* Univ. of California Berkeley, Xerox Palo Alto Research Center,
* and Lawrence Berkeley National Lab.
* November 15, 1997
*
* Modified from LAPACK routine DGEEQU
* </pre>
*/
/*
* File name: dgsequ.c
* History: Modified from LAPACK routine DGEEQU
*/
#include <math.h>
#include "superlu_ddefs.h"

/*! \brief
<pre>
Purpose
=======
DGSEQU_dist computes row and column scalings intended to equilibrate an
M-by-N sparse matrix A and reduce its condition number. R returns the row
scale factors and C the column scale factors, chosen to try to make
the largest element in each row and column of the matrix B with
elements B(i,j)=R(i)*A(i,j)*C(j) have absolute value 1.
R(i) and C(j) are restricted to be between SMLNUM = smallest safe
number and BIGNUM = largest safe number. Use of these scaling
factors is not guaranteed to reduce the condition number of A but
works well in practice.
See supermatrix.h for the definition of 'SuperMatrix' structure.
Arguments
=========
A (input) SuperMatrix*
The matrix of dimension (A->nrow, A->ncol) whose equilibration
factors are to be computed. The type of A can be:
Stype = SLU_NC; Dtype = SLU_D; Mtype = SLU_GE.
R (output) double*, size A->nrow
If INFO = 0 or INFO > M, R contains the row scale factors
for A.
C (output) double*, size A->ncol
If INFO = 0, C contains the column scale factors for A.
ROWCND (output) double*
If INFO = 0 or INFO > M, ROWCND contains the ratio of the
smallest R(i) to the largest R(i). If ROWCND >= 0.1 and
AMAX is neither too large nor too small, it is not worth
scaling by R.
COLCND (output) double*
If INFO = 0, COLCND contains the ratio of the smallest
C(i) to the largest C(i). If COLCND >= 0.1, it is not
worth scaling by C.
AMAX (output) double*
Absolute value of largest matrix element. If AMAX is very
close to overflow or very close to underflow, the matrix
should be scaled.
INFO (output) int*
= 0: successful exit
< 0: if INFO = -i, the i-th argument had an illegal value
> 0: if INFO = i, and i is
<= M: the i-th row of A is exactly zero
> M: the (i-M)-th column of A is exactly zero
=====================================================================
</pre>
*/

*
* <pre>
* Purpose
* =======
*
* DGSEQU_DIST computes row and column scalings intended to equilibrate an
* M-by-N sparse matrix A and reduce its condition number. R returns the row
* scale factors and C the column scale factors, chosen to try to make
* the largest element in each row and column of the matrix B with
* elements B(i,j)=R(i)*A(i,j)*C(j) have absolute value 1.
*
* R(i) and C(j) are restricted to be between SMLNUM = smallest safe
* number and BIGNUM = largest safe number. Use of these scaling
* factors is not guaranteed to reduce the condition number of A but
* works well in practice.
*
* See supermatrix.h for the definition of 'SuperMatrix' structure.
*
* Arguments
* =========
*
* A (input) SuperMatrix*
* The matrix of dimension (A->nrow, A->ncol) whose equilibration
* factors are to be computed. The type of A can be:
* Stype = SLU_NC; Dtype = SLU_D; Mtype = SLU_GE.
*
* R (output) double*, size A->nrow
* If INFO = 0 or INFO > M, R contains the row scale factors
* for A.
*
* C (output) double*, size A->ncol
* If INFO = 0, C contains the column scale factors for A.
*
* ROWCND (output) double*
* If INFO = 0 or INFO > M, ROWCND contains the ratio of the
* smallest R(i) to the largest R(i). If ROWCND >= 0.1 and
* AMAX is neither too large nor too small, it is not worth
* scaling by R.
*
* COLCND (output) double*
* If INFO = 0, COLCND contains the ratio of the smallest
* C(i) to the largest C(i). If COLCND >= 0.1, it is not
* worth scaling by C.
*
* AMAX (output) double*
* Absolute value of largest matrix element. If AMAX is very
* close to overflow or very close to underflow, the matrix
* should be scaled.
*
* INFO (output) int*
* = 0: successful exit
* < 0: if INFO = -i, the i-th argument had an illegal value
* > 0: if INFO = i, and i is
* <= A->nrow: the i-th row of A is exactly zero
* > A->ncol: the (i-M)-th column of A is exactly zero
*
* =====================================================================
* </pre>
*/
void
dgsequ_dist(SuperMatrix *A, double *r, double *c, double *rowcnd,
double *colcnd, double *amax, int_t *info)
double *colcnd, double *amax, int_t *info)
{


/* Local variables */
NCformat *Astore;
double *Aval;
Expand Down Expand Up @@ -116,7 +125,7 @@ dgsequ_dist(SuperMatrix *A, double *r, double *c, double *rowcnd,
Aval = (double *) Astore->nzval;

/* Get machine constants. */
smlnum = dmach_dist("S");
smlnum = dmach_dist("S"); /* dlamch_("S"); */
bignum = 1. / smlnum;

/* Compute row scale factors. */
Expand Down
109 changes: 59 additions & 50 deletions SRC/dlangs_dist.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,66 +8,75 @@ All rights reserved.
The source code is distributed under BSD license, see the file License.txt
at the top-level directory.
*/
/*! @file
* \brief Returns the value of the one norm, the infinity norm, or the element of largest value
*/



/*! @file dlangs_dist.c
* \brief Returns the value of the one norm, the infinity norm, or the element of largest value
* Modified from SuperLU routine DLANGS
*
* <pre>
* -- SuperLU routine (version 2.0) --
* Univ. of California Berkeley, Xerox Palo Alto Research Center,
* and Lawrence Berkeley National Lab.
* November 15, 1997
*
* </pre>
*/
/*
* File name: dlangs.c
* File name: dlangs_dist.c
* History: Modified from lapack routine DLANGE
*/
#include <math.h>
#include "superlu_ddefs.h"

/*! \brief
*
* <pre>
* Purpose
* =======
*
* DLANGS_DIST returns the value of the one norm, or the Frobenius norm, or
* the infinity norm, or the element of largest absolute value of a
* real matrix A.
*
* Description
* ===========
*
* DLANGE returns the value
*
* DLANGE = ( max(abs(A(i,j))), NORM = 'M' or 'm'
* (
* ( norm1(A), NORM = '1', 'O' or 'o'
* (
* ( normI(A), NORM = 'I' or 'i'
* (
* ( normF(A), NORM = 'F', 'f', 'E' or 'e'
*
* where norm1 denotes the one norm of a matrix (maximum column sum),
* normI denotes the infinity norm of a matrix (maximum row sum) and
* normF denotes the Frobenius norm of a matrix (square root of sum of
* squares). Note that max(abs(A(i,j))) is not a matrix norm.
*
* Arguments
* =========
*
* NORM (input) CHARACTER*1
* Specifies the value to be returned in DLANGE as described above.
* A (input) SuperMatrix*
* The M by N sparse matrix A.
*
* =====================================================================
* </pre>
*/

<pre>
Purpose
=======
DLANGS_dist returns the value of the one norm, or the Frobenius norm, or
the infinity norm, or the element of largest absolute value of a
real matrix A.
Description
===========
DLANGE returns the value
DLANGE = ( max(abs(A(i,j))), NORM = 'M' or 'm'
(
( norm1(A), NORM = '1', 'O' or 'o'
(
( normI(A), NORM = 'I' or 'i'
(
( normF(A), NORM = 'F', 'f', 'E' or 'e'
where norm1 denotes the one norm of a matrix (maximum column sum),
normI denotes the infinity norm of a matrix (maximum row sum) and
normF denotes the Frobenius norm of a matrix (square root of sum of
squares). Note that max(abs(A(i,j))) is not a matrix norm.
Arguments
=========
NORM (input) CHARACTER*1
Specifies the value to be returned in DLANGE as described above.
A (input) SuperMatrix*
The M by N sparse matrix A.
=====================================================================
</pre>
*/
double dlangs_dist(char *norm, SuperMatrix *A)
{


/* Local variables */
NCformat *Astore;
double *Aval;
int_t i, j, irow;
double value=0., sum;
int_t i, j, irow;
double value = 0.0, sum;
double *rwork;

Astore = (NCformat *) A->Store;
Expand All @@ -76,24 +85,24 @@ double dlangs_dist(char *norm, SuperMatrix *A)
if ( SUPERLU_MIN(A->nrow, A->ncol) == 0) {
value = 0.;

} else if ( strncmp(norm, "M", 1)==0 ) {
} else if ( (strncmp(norm, "M", 1)==0 ) ) {
/* Find max(abs(A(i,j))). */
value = 0.;
for (j = 0; j < A->ncol; ++j)
for (i = Astore->colptr[j]; i < Astore->colptr[j+1]; i++)
value = SUPERLU_MAX( value, fabs( Aval[i]) );

} else if ( strncmp(norm, "O", 1)==0 || *(unsigned char *)norm == '1') {
} else if (strncmp(norm, "O", 1)==0 || *(unsigned char *)norm == '1') {
/* Find norm1(A). */
value = 0.;
for (j = 0; j < A->ncol; ++j) {
sum = 0.;
for (i = Astore->colptr[j]; i < Astore->colptr[j+1]; i++)
sum += fabs(Aval[i]);
value = SUPERLU_MAX(value, sum);
value = SUPERLU_MAX(value,sum);
}

} else if ( strncmp(norm, "I", 1)==0 ) {
} else if (strncmp(norm, "I", 1)==0) {
/* Find normI(A). */
if ( !(rwork = (double *) SUPERLU_MALLOC(A->nrow * sizeof(double))) )
ABORT("SUPERLU_MALLOC fails for rwork.");
Expand All @@ -109,7 +118,7 @@ double dlangs_dist(char *norm, SuperMatrix *A)

SUPERLU_FREE (rwork);

} else if ( strncmp(norm, "F", 1)==0 || strncmp(norm, "E", 1)==0 ) {
} else if (strncmp(norm, "F", 1)==0 || strncmp(norm, "E", 1)==0) {
/* Find normF(A). */
ABORT("Not implemented.");
} else
Expand Down
Loading

0 comments on commit 58e4171

Please sign in to comment.