Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update colamd.c to SuiteSparse v4.5.6. #149

Merged
merged 1 commit into from
Jul 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 46 additions & 39 deletions SRC/colamd.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,30 +65,7 @@ at the top-level directory.
COLAMD is also available under alternate licenses, contact T. Davis
for details.

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA

Permission is hereby granted to use or copy this program under the
terms of the GNU LGPL, provided that the Copyright, this License,
and the Availability of the original version is retained on all copies.
User documentation of any code that uses this code or any modified
version of this code must cite the Copyright, this License, the
Availability note, and "Used by permission." Permission to modify
the code and to distribute modified code is granted, provided the
Copyright, this License, and the Availability note are retained,
and a notice that the code was modified is included.
See COLAMD/Doc/License.txt for the license.

Availability:

Expand Down Expand Up @@ -690,6 +667,37 @@ at the top-level directory.
#define NULL ((void *) 0)
#endif

/* ========================================================================== */
/* === int or SuiteSparse_long ============================================== */
/* ========================================================================== */

#ifdef DLONG

#define Int SuiteSparse_long
#define ID SuiteSparse_long_id
#define Int_MAX SuiteSparse_long_max

#define COLAMD_recommended colamd_l_recommended
#define COLAMD_set_defaults colamd_l_set_defaults
#define COLAMD_MAIN colamd_l
#define SYMAMD_MAIN symamd_l
#define COLAMD_report colamd_l_report
#define SYMAMD_report symamd_l_report

#else

#define Int int
#define ID "%d"
#define Int_MAX INT_MAX

#define COLAMD_recommended colamd_recommended
#define COLAMD_set_defaults colamd_set_defaults
#define COLAMD_MAIN colamd
#define SYMAMD_MAIN symamd
#define COLAMD_report colamd_report
#define SYMAMD_report symamd_report

#endif

/* ========================================================================== */
/* === Row and Column structures ============================================ */
Expand Down Expand Up @@ -1602,7 +1610,6 @@ PUBLIC Int COLAMD_MAIN /* returns TRUE if successful, FALSE otherwise*/
return (TRUE) ;
}

#if 0

/* ========================================================================== */
/* === colamd_report ======================================================== */
Expand All @@ -1629,7 +1636,7 @@ PUBLIC void SYMAMD_report
print_report ("symamd", stats) ;
}

#endif


/* ========================================================================== */
/* === NON-USER-CALLABLE ROUTINES: ========================================== */
Expand Down Expand Up @@ -3194,15 +3201,15 @@ PRIVATE void print_report

SUITESPARSE_PRINTF(
"%s: number of duplicate or out-of-order row indices: %d\n",
method, (int) i3) ;
method, i3) ;

SUITESPARSE_PRINTF(
"%s: last seen duplicate or out-of-order row index: %d\n",
method, (int) INDEX (i2)) ;
method, INDEX (i2)) ;

SUITESPARSE_PRINTF(
"%s: last seen in column: %d",
method, (int) INDEX (i1)) ;
method, INDEX (i1)) ;

/* no break - fall through to next case instead */

Expand All @@ -3212,15 +3219,15 @@ PRIVATE void print_report

SUITESPARSE_PRINTF(
"%s: number of dense or empty rows ignored: %d\n",
method, (int) stats [COLAMD_DENSE_ROW]) ;
method, stats [COLAMD_DENSE_ROW]) ;

SUITESPARSE_PRINTF(
"%s: number of dense or empty columns ignored: %d\n",
method, (int) stats [COLAMD_DENSE_COL]) ;
method, stats [COLAMD_DENSE_COL]) ;

SUITESPARSE_PRINTF(
"%s: number of garbage collections performed: %d\n",
method, (int) stats [COLAMD_DEFRAG_COUNT]) ;
method, stats [COLAMD_DEFRAG_COUNT]) ;
break ;

case COLAMD_ERROR_A_not_present:
Expand All @@ -3237,46 +3244,46 @@ PRIVATE void print_report

case COLAMD_ERROR_nrow_negative:

SUITESPARSE_PRINTF("Invalid number of rows (%d).\n", (int) i1) ;
SUITESPARSE_PRINTF("Invalid number of rows (%d).\n", i1) ;
break ;

case COLAMD_ERROR_ncol_negative:

SUITESPARSE_PRINTF("Invalid number of columns (%d).\n", (int) i1) ;
SUITESPARSE_PRINTF("Invalid number of columns (%d).\n", i1) ;
break ;

case COLAMD_ERROR_nnz_negative:

SUITESPARSE_PRINTF(
"Invalid number of nonzero entries (%d).\n", (int) i1) ;
"Invalid number of nonzero entries (%d).\n", i1) ;
break ;

case COLAMD_ERROR_p0_nonzero:

SUITESPARSE_PRINTF(
"Invalid column pointer, p [0] = %d, must be zero.\n", (int)i1);
"Invalid column pointer, p [0] = %d, must be zero.\n", i1);
break ;

case COLAMD_ERROR_A_too_small:

SUITESPARSE_PRINTF("Array A too small.\n") ;
SUITESPARSE_PRINTF(
" Need Alen >= %d, but given only Alen = %d.\n",
(int) i1, (int) i2) ;
i1, i2) ;
break ;

case COLAMD_ERROR_col_length_negative:

SUITESPARSE_PRINTF
("Column %d has a negative number of nonzero entries (%d).\n",
(int) INDEX (i1), (int) i2) ;
INDEX (i1), i2) ;
break ;

case COLAMD_ERROR_row_index_out_of_bounds:

SUITESPARSE_PRINTF
("Row index (row %d) out of bounds (%d to %d) in column %d.\n",
(int) INDEX (i2), (int) INDEX (0), (int) INDEX (i3-1), (int) INDEX (i1)) ;
INDEX (i2), INDEX (0), INDEX (i3-1), INDEX (i1)) ;
break ;

case COLAMD_ERROR_out_of_memory:
Expand Down