1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424
|
diff --git a/scipy/sparse/linalg/dsolve/SuperLU/SRC/cpanel_bmod.c b/scipy/sparse/linalg/dsolve/SuperLU/SRC/cpanel_bmod.c
index f8f859d..4a73091 100644
--- a/scipy/sparse/linalg/dsolve/SuperLU/SRC/cpanel_bmod.c
+++ b/scipy/sparse/linalg/dsolve/SuperLU/SRC/cpanel_bmod.c
@@ -425,6 +425,12 @@ cpanel_bmod (
CTRSV( ftcs1, ftcs2, ftcs3, &segsze, &lusup[luptr],
&nsupr, tempv, &incx );
#else
+#if SCIPY_FIX
+ if (nsupr < segsze) {
+ /* Fail early rather than passing in invalid parameters to TRSV. */
+ ABORT("failed to factorize matrix");
+ }
+#endif
ctrsv_( "L", "N", "U", &segsze, &lusup[luptr],
&nsupr, tempv, &incx );
#endif
diff --git a/scipy/sparse/linalg/dsolve/SuperLU/SRC/cpivotL.c b/scipy/sparse/linalg/dsolve/SuperLU/SRC/cpivotL.c
index a71d87a..41e5f8e 100644
--- a/scipy/sparse/linalg/dsolve/SuperLU/SRC/cpivotL.c
+++ b/scipy/sparse/linalg/dsolve/SuperLU/SRC/cpivotL.c
@@ -125,7 +125,16 @@ if ( jcol == MIN_COL ) {
/* Test for singularity */
if ( pivmax == 0.0 ) {
#if 1
+#if SCIPY_FIX
+ if (pivptr < nsupr) {
+ *pivrow = lsub_ptr[pivptr];
+ }
+ else {
+ *pivrow = diagind;
+ }
+#else
*pivrow = lsub_ptr[pivptr];
+#endif
perm_r[*pivrow] = jcol;
#else
perm_r[diagind] = jcol;
diff --git a/scipy/sparse/linalg/dsolve/SuperLU/SRC/csnode_bmod.c b/scipy/sparse/linalg/dsolve/SuperLU/SRC/csnode_bmod.c
index fa357c1..b2ea2f4 100644
--- a/scipy/sparse/linalg/dsolve/SuperLU/SRC/csnode_bmod.c
+++ b/scipy/sparse/linalg/dsolve/SuperLU/SRC/csnode_bmod.c
@@ -95,6 +95,12 @@ csnode_bmod (
CGEMV( ftcs2, &nrow, &nsupc, &alpha, &lusup[luptr+nsupc], &nsupr,
&lusup[ufirst], &incx, &beta, &lusup[ufirst+nsupc], &incy );
#else
+#if SCIPY_FIX
+ if (nsupr < nsupc) {
+ /* Fail early rather than passing in invalid parameters to TRSV. */
+ ABORT("failed to factorize matrix");
+ }
+#endif
ctrsv_( "L", "N", "U", &nsupc, &lusup[luptr], &nsupr,
&lusup[ufirst], &incx );
cgemv_( "N", &nrow, &nsupc, &alpha, &lusup[luptr+nsupc], &nsupr,
diff --git a/scipy/sparse/linalg/dsolve/SuperLU/SRC/dpanel_bmod.c b/scipy/sparse/linalg/dsolve/SuperLU/SRC/dpanel_bmod.c
index 6f44b47..b1f868b 100644
--- a/scipy/sparse/linalg/dsolve/SuperLU/SRC/dpanel_bmod.c
+++ b/scipy/sparse/linalg/dsolve/SuperLU/SRC/dpanel_bmod.c
@@ -218,7 +218,7 @@ dpanel_bmod (
STRSV( ftcs1, ftcs2, ftcs3, &segsze, &lusup[luptr],
&nsupr, TriTmp, &incx );
#else
- dtrsv_( "L", "N", "U", &segsze, &lusup[luptr],
+ dtrsv_( "L", "N", "U", &segsze, &lusup[luptr],
&nsupr, TriTmp, &incx );
#endif
#else
@@ -397,6 +397,12 @@ dpanel_bmod (
STRSV( ftcs1, ftcs2, ftcs3, &segsze, &lusup[luptr],
&nsupr, tempv, &incx );
#else
+#if SCIPY_FIX
+ if (nsupr < segsze) {
+ /* Fail early rather than passing in invalid parameters to TRSV. */
+ ABORT("failed to factorize matrix");
+ }
+#endif
dtrsv_( "L", "N", "U", &segsze, &lusup[luptr],
&nsupr, tempv, &incx );
#endif
diff --git a/scipy/sparse/linalg/dsolve/SuperLU/SRC/dpivotL.c b/scipy/sparse/linalg/dsolve/SuperLU/SRC/dpivotL.c
index b306b02..6b078e9 100644
--- a/scipy/sparse/linalg/dsolve/SuperLU/SRC/dpivotL.c
+++ b/scipy/sparse/linalg/dsolve/SuperLU/SRC/dpivotL.c
@@ -124,7 +124,16 @@ if ( jcol == MIN_COL ) {
/* Test for singularity */
if ( pivmax == 0.0 ) {
#if 1
+#if SCIPY_FIX
+ if (pivptr < nsupr) {
+ *pivrow = lsub_ptr[pivptr];
+ }
+ else {
+ *pivrow = diagind;
+ }
+#else
*pivrow = lsub_ptr[pivptr];
+#endif
perm_r[*pivrow] = jcol;
#else
perm_r[diagind] = jcol;
diff --git a/scipy/sparse/linalg/dsolve/SuperLU/SRC/dsnode_bmod.c b/scipy/sparse/linalg/dsolve/SuperLU/SRC/dsnode_bmod.c
index 1557675..f3116a9 100644
--- a/scipy/sparse/linalg/dsolve/SuperLU/SRC/dsnode_bmod.c
+++ b/scipy/sparse/linalg/dsolve/SuperLU/SRC/dsnode_bmod.c
@@ -94,6 +94,12 @@ dsnode_bmod (
SGEMV( ftcs2, &nrow, &nsupc, &alpha, &lusup[luptr+nsupc], &nsupr,
&lusup[ufirst], &incx, &beta, &lusup[ufirst+nsupc], &incy );
#else
+#if SCIPY_FIX
+ if (nsupr < nsupc) {
+ /* Fail early rather than passing in invalid parameters to DTRSV. */
+ ABORT("failed to factorize matrix");
+ }
+#endif
dtrsv_( "L", "N", "U", &nsupc, &lusup[luptr], &nsupr,
&lusup[ufirst], &incx );
dgemv_( "N", &nrow, &nsupc, &alpha, &lusup[luptr+nsupc], &nsupr,
diff --git a/scipy/sparse/linalg/dsolve/SuperLU/SRC/ilu_cpivotL.c b/scipy/sparse/linalg/dsolve/SuperLU/SRC/ilu_cpivotL.c
index 4d1202c..e7efad9 100644
--- a/scipy/sparse/linalg/dsolve/SuperLU/SRC/ilu_cpivotL.c
+++ b/scipy/sparse/linalg/dsolve/SuperLU/SRC/ilu_cpivotL.c
@@ -136,9 +136,13 @@ ilu_cpivotL(
/* Test for singularity */
if (pivmax < 0.0) {
+#if SCIPY_FIX
+ ABORT("[0]: matrix is singular");
+#else
fprintf(stderr, "[0]: jcol=%d, SINGULAR!!!\n", jcol);
fflush(stderr);
exit(1);
+#endif
}
if ( pivmax == 0.0 ) {
if (diag != EMPTY)
@@ -151,9 +155,13 @@ ilu_cpivotL(
for (icol = jcol; icol < n; icol++)
if (marker[swap[icol]] <= jcol) break;
if (icol >= n) {
+#if SCIPY_FIX
+ ABORT("[1]: matrix is singular");
+#else
fprintf(stderr, "[1]: jcol=%d, SINGULAR!!!\n", jcol);
fflush(stderr);
exit(1);
+#endif
}
*pivrow = swap[icol];
diff --git a/scipy/sparse/linalg/dsolve/SuperLU/SRC/ilu_dpivotL.c b/scipy/sparse/linalg/dsolve/SuperLU/SRC/ilu_dpivotL.c
index 5edee72..410ec00 100644
--- a/scipy/sparse/linalg/dsolve/SuperLU/SRC/ilu_dpivotL.c
+++ b/scipy/sparse/linalg/dsolve/SuperLU/SRC/ilu_dpivotL.c
@@ -134,9 +134,13 @@ ilu_dpivotL(
/* Test for singularity */
if (pivmax < 0.0) {
+#if SCIPY_FIX
+ ABORT("[0]: matrix is singular");
+#else
fprintf(stderr, "[0]: jcol=%d, SINGULAR!!!\n", jcol);
fflush(stderr);
exit(1);
+#endif
}
if ( pivmax == 0.0 ) {
if (diag != EMPTY)
@@ -149,9 +153,13 @@ ilu_dpivotL(
for (icol = jcol; icol < n; icol++)
if (marker[swap[icol]] <= jcol) break;
if (icol >= n) {
+#if SCIPY_FIX
+ ABORT("[1]: matrix is singular");
+#else
fprintf(stderr, "[1]: jcol=%d, SINGULAR!!!\n", jcol);
fflush(stderr);
exit(1);
+#endif
}
*pivrow = swap[icol];
diff --git a/scipy/sparse/linalg/dsolve/SuperLU/SRC/ilu_spivotL.c b/scipy/sparse/linalg/dsolve/SuperLU/SRC/ilu_spivotL.c
index ad689f0..7cf038d 100644
--- a/scipy/sparse/linalg/dsolve/SuperLU/SRC/ilu_spivotL.c
+++ b/scipy/sparse/linalg/dsolve/SuperLU/SRC/ilu_spivotL.c
@@ -134,9 +134,13 @@ ilu_spivotL(
/* Test for singularity */
if (pivmax < 0.0) {
+#if SCIPY_FIX
+ ABORT("[0]: matrix is singular");
+#else
fprintf(stderr, "[0]: jcol=%d, SINGULAR!!!\n", jcol);
fflush(stderr);
exit(1);
+#endif
}
if ( pivmax == 0.0 ) {
if (diag != EMPTY)
@@ -149,9 +153,13 @@ ilu_spivotL(
for (icol = jcol; icol < n; icol++)
if (marker[swap[icol]] <= jcol) break;
if (icol >= n) {
+#if SCIPY_FIX
+ ABORT("[1]: matrix is singular");
+#else
fprintf(stderr, "[1]: jcol=%d, SINGULAR!!!\n", jcol);
fflush(stderr);
exit(1);
+#endif
}
*pivrow = swap[icol];
diff --git a/scipy/sparse/linalg/dsolve/SuperLU/SRC/ilu_zpivotL.c b/scipy/sparse/linalg/dsolve/SuperLU/SRC/ilu_zpivotL.c
index 9ed7c99..4a93280 100644
--- a/scipy/sparse/linalg/dsolve/SuperLU/SRC/ilu_zpivotL.c
+++ b/scipy/sparse/linalg/dsolve/SuperLU/SRC/ilu_zpivotL.c
@@ -136,9 +136,13 @@ ilu_zpivotL(
/* Test for singularity */
if (pivmax < 0.0) {
+#if SCIPY_FIX
+ ABORT("[0]: matrix is singular");
+#else
fprintf(stderr, "[0]: jcol=%d, SINGULAR!!!\n", jcol);
fflush(stderr);
exit(1);
+#endif
}
if ( pivmax == 0.0 ) {
if (diag != EMPTY)
@@ -151,9 +155,13 @@ ilu_zpivotL(
for (icol = jcol; icol < n; icol++)
if (marker[swap[icol]] <= jcol) break;
if (icol >= n) {
+#if SCIPY_FIX
+ ABORT("[1]: matrix is singular");
+#else
fprintf(stderr, "[1]: jcol=%d, SINGULAR!!!\n", jcol);
fflush(stderr);
exit(1);
+#endif
}
*pivrow = swap[icol];
diff --git a/scipy/sparse/linalg/dsolve/SuperLU/SRC/scipy_slu_config.h b/scipy/sparse/linalg/dsolve/SuperLU/SRC/scipy_slu_config.h
new file mode 100644
index 0000000..5afc93b
--- /dev/null
+++ b/scipy/sparse/linalg/dsolve/SuperLU/SRC/scipy_slu_config.h
@@ -0,0 +1,36 @@
+#ifndef SCIPY_SLU_CONFIG_H
+#define SCIPY_SLU_CONFIG_H
+
+#include <stdlib.h>
+
+/*
+ * Support routines
+ */
+void superlu_python_module_abort(char *msg);
+void *superlu_python_module_malloc(size_t size);
+void superlu_python_module_free(void *ptr);
+
+#define USER_ABORT superlu_python_module_abort
+#define USER_MALLOC superlu_python_module_malloc
+#define USER_FREE superlu_python_module_free
+
+#define SCIPY_FIX 1
+
+/*
+ * Fortran configuration
+ */
+#if defined(NO_APPEND_FORTRAN)
+#if defined(UPPERCASE_FORTRAN)
+#define UpCase 1
+#else
+#define NoChange 1
+#endif
+#else
+#if defined(UPPERCASE_FORTRAN)
+#error Uppercase and trailing slash in Fortran names not supported
+#else
+#define Add_ 1
+#endif
+#endif
+
+#endif
diff --git a/scipy/sparse/linalg/dsolve/SuperLU/SRC/slu_Cnames.h b/scipy/sparse/linalg/dsolve/SuperLU/SRC/slu_Cnames.h
index 9f42608..7e51638 100644
--- a/scipy/sparse/linalg/dsolve/SuperLU/SRC/slu_Cnames.h
+++ b/scipy/sparse/linalg/dsolve/SuperLU/SRC/slu_Cnames.h
@@ -19,6 +19,7 @@
#ifndef __SUPERLU_CNAMES /* allow multiple inclusions */
#define __SUPERLU_CNAMES
+#include "scipy_slu_config.h"
#define ADD_ 0
#define ADD__ 1
diff --git a/scipy/sparse/linalg/dsolve/SuperLU/SRC/slu_util.h b/scipy/sparse/linalg/dsolve/SuperLU/SRC/slu_util.h
index 4fa9537..d54c2cf 100644
--- a/scipy/sparse/linalg/dsolve/SuperLU/SRC/slu_util.h
+++ b/scipy/sparse/linalg/dsolve/SuperLU/SRC/slu_util.h
@@ -22,6 +22,8 @@
#include <assert.h>
#include "superlu_enum_consts.h"
+#include "scipy_slu_config.h"
+
/***********************************************************************
* Macros
***********************************************************************/
diff --git a/scipy/sparse/linalg/dsolve/SuperLU/SRC/spanel_bmod.c b/scipy/sparse/linalg/dsolve/SuperLU/SRC/spanel_bmod.c
index 847c569..dbec42d 100644
--- a/scipy/sparse/linalg/dsolve/SuperLU/SRC/spanel_bmod.c
+++ b/scipy/sparse/linalg/dsolve/SuperLU/SRC/spanel_bmod.c
@@ -397,6 +397,12 @@ spanel_bmod (
STRSV( ftcs1, ftcs2, ftcs3, &segsze, &lusup[luptr],
&nsupr, tempv, &incx );
#else
+#if SCIPY_FIX
+ if (nsupr < segsze) {
+ /* Fail early rather than passing in invalid parameters to TRSV. */
+ ABORT("failed to factorize matrix");
+ }
+#endif
strsv_( "L", "N", "U", &segsze, &lusup[luptr],
&nsupr, tempv, &incx );
#endif
diff --git a/scipy/sparse/linalg/dsolve/SuperLU/SRC/spivotL.c b/scipy/sparse/linalg/dsolve/SuperLU/SRC/spivotL.c
index 6bd8d74..0da781a 100644
--- a/scipy/sparse/linalg/dsolve/SuperLU/SRC/spivotL.c
+++ b/scipy/sparse/linalg/dsolve/SuperLU/SRC/spivotL.c
@@ -124,7 +124,16 @@ if ( jcol == MIN_COL ) {
/* Test for singularity */
if ( pivmax == 0.0 ) {
#if 1
+#if SCIPY_FIX
+ if (pivptr < nsupr) {
+ *pivrow = lsub_ptr[pivptr];
+ }
+ else {
+ *pivrow = diagind;
+ }
+#else
*pivrow = lsub_ptr[pivptr];
+#endif
perm_r[*pivrow] = jcol;
#else
perm_r[diagind] = jcol;
diff --git a/scipy/sparse/linalg/dsolve/SuperLU/SRC/ssnode_bmod.c b/scipy/sparse/linalg/dsolve/SuperLU/SRC/ssnode_bmod.c
index 153459c..9de8c0b 100644
--- a/scipy/sparse/linalg/dsolve/SuperLU/SRC/ssnode_bmod.c
+++ b/scipy/sparse/linalg/dsolve/SuperLU/SRC/ssnode_bmod.c
@@ -94,6 +94,12 @@ ssnode_bmod (
SGEMV( ftcs2, &nrow, &nsupc, &alpha, &lusup[luptr+nsupc], &nsupr,
&lusup[ufirst], &incx, &beta, &lusup[ufirst+nsupc], &incy );
#else
+#if SCIPY_FIX
+ if (nsupr < nsupc) {
+ /* Fail early rather than passing in invalid parameters to TRSV. */
+ ABORT("failed to factorize matrix");
+ }
+#endif
strsv_( "L", "N", "U", &nsupc, &lusup[luptr], &nsupr,
&lusup[ufirst], &incx );
sgemv_( "N", &nrow, &nsupc, &alpha, &lusup[luptr+nsupc], &nsupr,
diff --git a/scipy/sparse/linalg/dsolve/SuperLU/SRC/zpanel_bmod.c b/scipy/sparse/linalg/dsolve/SuperLU/SRC/zpanel_bmod.c
index 7fcdb7c..d06ab07 100644
--- a/scipy/sparse/linalg/dsolve/SuperLU/SRC/zpanel_bmod.c
+++ b/scipy/sparse/linalg/dsolve/SuperLU/SRC/zpanel_bmod.c
@@ -425,6 +425,12 @@ zpanel_bmod (
CTRSV( ftcs1, ftcs2, ftcs3, &segsze, &lusup[luptr],
&nsupr, tempv, &incx );
#else
+#if SCIPY_FIX
+ if (nsupr < segsze) {
+ /* Fail early rather than passing in invalid parameters to TRSV. */
+ ABORT("failed to factorize matrix");
+ }
+#endif
ztrsv_( "L", "N", "U", &segsze, &lusup[luptr],
&nsupr, tempv, &incx );
#endif
diff --git a/scipy/sparse/linalg/dsolve/SuperLU/SRC/zpivotL.c b/scipy/sparse/linalg/dsolve/SuperLU/SRC/zpivotL.c
index e8996bc..a42aa3c 100644
--- a/scipy/sparse/linalg/dsolve/SuperLU/SRC/zpivotL.c
+++ b/scipy/sparse/linalg/dsolve/SuperLU/SRC/zpivotL.c
@@ -125,7 +125,16 @@ if ( jcol == MIN_COL ) {
/* Test for singularity */
if ( pivmax == 0.0 ) {
#if 1
+#if SCIPY_FIX
+ if (pivptr < nsupr) {
+ *pivrow = lsub_ptr[pivptr];
+ }
+ else {
+ *pivrow = diagind;
+ }
+#else
*pivrow = lsub_ptr[pivptr];
+#endif
perm_r[*pivrow] = jcol;
#else
perm_r[diagind] = jcol;
diff --git a/scipy/sparse/linalg/dsolve/SuperLU/SRC/zsnode_bmod.c b/scipy/sparse/linalg/dsolve/SuperLU/SRC/zsnode_bmod.c
index 0a107c9..17dc271 100644
--- a/scipy/sparse/linalg/dsolve/SuperLU/SRC/zsnode_bmod.c
+++ b/scipy/sparse/linalg/dsolve/SuperLU/SRC/zsnode_bmod.c
@@ -95,6 +95,12 @@ zsnode_bmod (
CGEMV( ftcs2, &nrow, &nsupc, &alpha, &lusup[luptr+nsupc], &nsupr,
&lusup[ufirst], &incx, &beta, &lusup[ufirst+nsupc], &incy );
#else
+#if SCIPY_FIX
+ if (nsupr < nsupc) {
+ /* Fail early rather than passing in invalid parameters to TRSV. */
+ ABORT("failed to factorize matrix");
+ }
+#endif
ztrsv_( "L", "N", "U", &nsupc, &lusup[luptr], &nsupr,
&lusup[ufirst], &incx );
zgemv_( "N", &nrow, &nsupc, &alpha, &lusup[luptr+nsupc], &nsupr,
|