Skip to content

Commit 06f31a5

Browse files
committed
Avoid conflict with amd and rcm api
1 parent 0a84909 commit 06f31a5

File tree

13 files changed

+72
-78
lines changed

13 files changed

+72
-78
lines changed

extern/amd/SuiteSparse_config.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
#include "SuiteSparse_config.h"
1515

16-
void *SuiteSparse_malloc /* pointer to allocated block of memory */
16+
void *Highs_SuiteSparse_malloc /* pointer to allocated block of memory */
1717
(
1818
size_t nitems, /* number of items to malloc */
1919
size_t size_of_item /* sizeof each item */
@@ -41,7 +41,7 @@ void *SuiteSparse_malloc /* pointer to allocated block of memory */
4141
/* SuiteSparse_free: free wrapper */
4242
/* -------------------------------------------------------------------------- */
4343

44-
void *SuiteSparse_free /* always returns NULL */
44+
void *Highs_SuiteSparse_free /* always returns NULL */
4545
(
4646
void *p /* block to free */
4747
)

extern/amd/SuiteSparse_config.h

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,25 +36,17 @@
3636
#include <stdarg.h>
3737
#include <ctype.h>
3838

39-
void *SuiteSparse_malloc // pointer to allocated block of memory
39+
void *Highs_SuiteSparse_malloc // pointer to allocated block of memory
4040
(
4141
size_t nitems, // number of items to malloc (>=1 is enforced)
4242
size_t size_of_item // sizeof each item
4343
) ;
4444

45-
void *SuiteSparse_free // always returns NULL
45+
void *Highs_SuiteSparse_free // always returns NULL
4646
(
4747
void *p // block to free
4848
) ;
4949

50-
// SuiteSparse printf macro
51-
#define SUITESPARSE_PRINTF(params) \
52-
{ \
53-
\
54-
printf params ; \
55-
\
56-
}
57-
5850
#define SUITESPARSE_DATE "Nov 4, 2025"
5951
#define SUITESPARSE_MAIN_VERSION 7
6052
#define SUITESPARSE_SUB_VERSION 12

extern/amd/amd.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ typedef unsigned int amd_uint;
5353
extern "C" {
5454
#endif
5555

56-
int amd_order /* returns AMD_OK, AMD_OK_BUT_JUMBLED,
56+
int Highs_amd_order /* returns AMD_OK, AMD_OK_BUT_JUMBLED,
5757
* AMD_INVALID, or AMD_OUT_OF_MEMORY */
5858
(
5959
amd_int n, /* A is n-by-n. n must be >= 0. */
@@ -232,7 +232,7 @@ int amd_order /* returns AMD_OK, AMD_OK_BUT_JUMBLED,
232232
* of the matrix for AMD to destroy). Refer to AMD/Source/amd_2.c for a
233233
* description of each parameter. */
234234

235-
void amd_2
235+
void Highs_amd_2
236236
(
237237
amd_int n,
238238
amd_int Pe [ ],
@@ -263,7 +263,7 @@ void amd_2
263263
* of columns of the matrix. For its use in AMD, these must both equal n.
264264
*/
265265

266-
int amd_valid
266+
int Highs_amd_valid
267267
(
268268
amd_int n_row, /* # of rows */
269269
amd_int n_col, /* # of columns */
@@ -276,13 +276,13 @@ int amd_valid
276276
/* ------------------------------------------------------------------------- */
277277

278278
/* amd_defaults: sets the default control settings */
279-
void amd_defaults (double Control [ ]) ;
279+
void Highs_amd_defaults (double Control [ ]) ;
280280

281281
/* amd_control: prints the control settings */
282-
void amd_control (double Control [ ]) ;
282+
void Highs_amd_control (double Control [ ]) ;
283283

284284
/* amd_info: prints the statistics */
285-
void amd_info (double Info [ ]) ;
285+
void Highs_amd_info (double Info [ ]) ;
286286

287287
#ifdef __cplusplus
288288
}

extern/amd/amd_1.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,6 @@ void amd_1
167167
/* order the matrix */
168168
/* --------------------------------------------------------------------- */
169169

170-
amd_2 (n, Pe, Iw, Len, iwlen, pfree,
170+
Highs_amd_2 (n, Pe, Iw, Len, iwlen, pfree,
171171
Nv, Pinv, P, Head, Elen, Degree, W, Control, Info) ;
172172
}

extern/amd/amd_2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ static amd_int clear_flag (amd_int wflg, amd_int wbig, amd_int W [ ], amd_int n)
3939
/* === AMD_2 =============================================================== */
4040
/* ========================================================================= */
4141

42-
void amd_2
42+
void Highs_amd_2
4343
(
4444
amd_int n, /* A is n-by-n, where n > 0 */
4545
amd_int Pe [ ], /* Pe [0..n-1]: index in Iw of row i on input */

extern/amd/amd_control.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
#include "amd_internal.h"
1717

18-
void amd_control
18+
void Highs_amd_control
1919
(
2020
double Control [ ]
2121
)
@@ -34,31 +34,31 @@ void amd_control
3434
aggressive = AMD_DEFAULT_AGGRESSIVE ;
3535
}
3636

37-
SUITESPARSE_PRINTF ((
37+
printf (
3838
"\nAMD version %d.%d.%d, %s: approximate minimum degree ordering\n"
3939
" dense row parameter: %g\n", AMD_MAIN_VERSION, AMD_SUB_VERSION,
40-
AMD_SUBSUB_VERSION, AMD_DATE, alpha)) ;
40+
AMD_SUBSUB_VERSION, AMD_DATE, alpha) ;
4141

4242
if (alpha < 0)
4343
{
44-
SUITESPARSE_PRINTF ((" no rows treated as dense\n")) ;
44+
printf (" no rows treated as dense\n") ;
4545
}
4646
else
4747
{
48-
SUITESPARSE_PRINTF ((
48+
printf (
4949
" (rows with more than max (%g * sqrt (n), 16) entries are\n"
5050
" considered \"dense\", and placed last in output permutation)\n",
51-
alpha)) ;
51+
alpha) ;
5252
}
5353

5454
if (aggressive)
5555
{
56-
SUITESPARSE_PRINTF ((" aggressive absorption: yes\n")) ;
56+
printf (" aggressive absorption: yes\n") ;
5757
}
5858
else
5959
{
60-
SUITESPARSE_PRINTF ((" aggressive absorption: no\n")) ;
60+
printf (" aggressive absorption: no\n") ;
6161
}
6262

63-
SUITESPARSE_PRINTF ((" size of AMD integer: %lu\n\n", sizeof (amd_int))) ;
63+
printf (" size of AMD integer: %lu\n\n", sizeof (amd_int)) ;
6464
}

extern/amd/amd_defaults.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
/* === AMD defaults ======================================================== */
1919
/* ========================================================================= */
2020

21-
void amd_defaults
21+
void Highs_amd_defaults
2222
(
2323
double Control [ ]
2424
)

extern/amd/amd_info.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@
1414

1515
#include "amd_internal.h"
1616

17-
#define PRI(format,x) { if (x >= 0) { SUITESPARSE_PRINTF ((format, x)) ; }}
17+
#define PRI(format,x) { if (x >= 0) { printf (format, x) ; }}
1818

19-
void amd_info
19+
void Highs_amd_info
2020
(
2121
double Info [ ]
2222
)
2323
{
2424
double n, ndiv, nmultsubs_ldl, nmultsubs_lu, lnz, lnzd ;
2525

26-
SUITESPARSE_PRINTF (("\nAMD version %d.%d.%d, %s, results:\n",
27-
AMD_MAIN_VERSION, AMD_SUB_VERSION, AMD_SUBSUB_VERSION, AMD_DATE)) ;
26+
printf ("\nAMD version %d.%d.%d, %s, results:\n",
27+
AMD_MAIN_VERSION, AMD_SUB_VERSION, AMD_SUBSUB_VERSION, AMD_DATE) ;
2828

2929
if (!Info)
3030
{
@@ -39,26 +39,26 @@ void amd_info
3939
lnzd = (n >= 0 && lnz >= 0) ? (n + lnz) : (-1) ;
4040

4141
/* AMD return status */
42-
SUITESPARSE_PRINTF ((" status: ")) ;
42+
printf (" status: ") ;
4343
if (Info [AMD_STATUS] == AMD_OK)
4444
{
45-
SUITESPARSE_PRINTF (("OK\n")) ;
45+
printf ("OK\n") ;
4646
}
4747
else if (Info [AMD_STATUS] == AMD_OUT_OF_MEMORY)
4848
{
49-
SUITESPARSE_PRINTF (("out of memory\n")) ;
49+
printf ("out of memory\n") ;
5050
}
5151
else if (Info [AMD_STATUS] == AMD_INVALID)
5252
{
53-
SUITESPARSE_PRINTF (("invalid matrix\n")) ;
53+
printf ("invalid matrix\n") ;
5454
}
5555
else if (Info [AMD_STATUS] == AMD_OK_BUT_JUMBLED)
5656
{
57-
SUITESPARSE_PRINTF (("OK, but jumbled\n")) ;
57+
printf ("OK, but jumbled\n") ;
5858
}
5959
else
6060
{
61-
SUITESPARSE_PRINTF (("unknown\n")) ;
61+
printf ("unknown\n") ;
6262
}
6363

6464
/* statistics about the input matrix */
@@ -81,11 +81,11 @@ void amd_info
8181
Info [AMD_NCMPA]) ;
8282

8383
/* statistics about the ordering quality */
84-
SUITESPARSE_PRINTF (("\n"
84+
printf ("\n"
8585
" The following approximate statistics are for a subsequent\n"
8686
" factorization of A(P,P) + A(P,P)'. They are slight upper\n"
8787
" bounds if there are no dense rows/columns in A+A', and become\n"
88-
" looser if dense rows/columns exist.\n\n")) ;
88+
" looser if dense rows/columns exist.\n\n") ;
8989

9090
PRI (" nonzeros in L (excluding diagonal): %.20g\n",
9191
lnz) ;
@@ -104,7 +104,7 @@ void amd_info
104104

105105
if (n >= 0 && ndiv >= 0 && nmultsubs_ldl >= 0 && nmultsubs_lu >= 0)
106106
{
107-
SUITESPARSE_PRINTF (("\n"
107+
printf ("\n"
108108
" chol flop count for real A, sqrt counted as 1 flop: %.20g\n"
109109
" LDL' flop count for real A: %.20g\n"
110110
" LDL' flop count for complex A: %.20g\n"
@@ -114,6 +114,6 @@ void amd_info
114114
ndiv + 2*nmultsubs_ldl,
115115
9*ndiv + 8*nmultsubs_ldl,
116116
ndiv + 2*nmultsubs_lu,
117-
9*ndiv + 8*nmultsubs_lu)) ;
117+
9*ndiv + 8*nmultsubs_lu) ;
118118
}
119119
}

extern/amd/amd_order.c

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
/* === AMD_order =========================================================== */
1919
/* ========================================================================= */
2020

21-
int amd_order
21+
int Highs_amd_order
2222
(
2323
amd_int n,
2424
const amd_int Ap [ ],
@@ -76,7 +76,7 @@ int amd_order
7676
}
7777

7878
/* check the input matrix: AMD_OK, AMD_INVALID, or AMD_OK_BUT_JUMBLED */
79-
status = amd_valid (n, n, Ap, Ai) ;
79+
status = Highs_amd_valid (n, n, Ap, Ai) ;
8080

8181
if (status == AMD_INVALID)
8282
{
@@ -86,15 +86,15 @@ int amd_order
8686

8787
/* allocate two size-n integer workspaces */
8888
size_t nn = (size_t) n ;
89-
Len = SuiteSparse_malloc (nn, sizeof (amd_int)) ;
90-
Pinv = SuiteSparse_malloc (nn, sizeof (amd_int)) ;
89+
Len = Highs_SuiteSparse_malloc (nn, sizeof (amd_int)) ;
90+
Pinv = Highs_SuiteSparse_malloc (nn, sizeof (amd_int)) ;
9191
mem += n ;
9292
mem += n ;
9393
if (!Len || !Pinv)
9494
{
9595
/* :: out of memory :: */
96-
SuiteSparse_free (Len) ;
97-
SuiteSparse_free (Pinv) ;
96+
Highs_SuiteSparse_free (Len) ;
97+
Highs_SuiteSparse_free (Pinv) ;
9898
if (info) Info [AMD_STATUS] = AMD_OUT_OF_MEMORY ;
9999
return (AMD_OUT_OF_MEMORY) ;
100100
}
@@ -103,17 +103,17 @@ int amd_order
103103
{
104104
/* sort the input matrix and remove duplicate entries */
105105

106-
Rp = SuiteSparse_malloc (nn+1, sizeof (amd_int)) ;
107-
Ri = SuiteSparse_malloc (nz, sizeof (amd_int)) ;
106+
Rp = Highs_SuiteSparse_malloc (nn+1, sizeof (amd_int)) ;
107+
Ri = Highs_SuiteSparse_malloc (nz, sizeof (amd_int)) ;
108108
mem += (n+1) ;
109109
mem += MAX (nz,1) ;
110110
if (!Rp || !Ri)
111111
{
112112
/* :: out of memory :: */
113-
SuiteSparse_free (Rp) ;
114-
SuiteSparse_free (Ri) ;
115-
SuiteSparse_free (Len) ;
116-
SuiteSparse_free (Pinv) ;
113+
Highs_SuiteSparse_free (Rp) ;
114+
Highs_SuiteSparse_free (Ri) ;
115+
Highs_SuiteSparse_free (Len) ;
116+
Highs_SuiteSparse_free (Pinv) ;
117117
if (info) Info [AMD_STATUS] = AMD_OUT_OF_MEMORY ;
118118
return (AMD_OUT_OF_MEMORY) ;
119119
}
@@ -156,16 +156,16 @@ int amd_order
156156
ok = ok && (slen < SIZE_T_MAX / sizeof (amd_int)) ; /* check for overflow */
157157
if (ok)
158158
{
159-
S = SuiteSparse_malloc (slen, sizeof (amd_int)) ;
159+
S = Highs_SuiteSparse_malloc (slen, sizeof (amd_int)) ;
160160
}
161161

162162
if (!S)
163163
{
164164
/* :: out of memory :: (or problem too large) */
165-
SuiteSparse_free (Rp) ;
166-
SuiteSparse_free (Ri) ;
167-
SuiteSparse_free (Len) ;
168-
SuiteSparse_free (Pinv) ;
165+
Highs_SuiteSparse_free (Rp) ;
166+
Highs_SuiteSparse_free (Ri) ;
167+
Highs_SuiteSparse_free (Len) ;
168+
Highs_SuiteSparse_free (Pinv) ;
169169
if (info) Info [AMD_STATUS] = AMD_OUT_OF_MEMORY ;
170170
return (AMD_OUT_OF_MEMORY) ;
171171
}
@@ -185,11 +185,11 @@ int amd_order
185185
/* free the workspace */
186186
/* --------------------------------------------------------------------- */
187187

188-
SuiteSparse_free (Rp) ;
189-
SuiteSparse_free (Ri) ;
190-
SuiteSparse_free (Len) ;
191-
SuiteSparse_free (Pinv) ;
192-
SuiteSparse_free (S) ;
188+
Highs_SuiteSparse_free (Rp) ;
189+
Highs_SuiteSparse_free (Ri) ;
190+
Highs_SuiteSparse_free (Len) ;
191+
Highs_SuiteSparse_free (Pinv) ;
192+
Highs_SuiteSparse_free (S) ;
193193
if (info) Info [AMD_STATUS] = status ;
194194
return (status) ; /* successful ordering */
195195
}

extern/amd/amd_valid.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535

3636
#include "amd_internal.h"
3737

38-
int amd_valid
38+
int Highs_amd_valid
3939
(
4040
/* inputs, not modified on output: */
4141
amd_int n_row, /* A is n_row-by-n_col */

0 commit comments

Comments
 (0)