From 3c0be7487674c6ca5a5cd503409e5b5a348b4cf1 Mon Sep 17 00:00:00 2001 From: conrad Date: Fri, 18 Apr 2025 16:46:01 +1000 Subject: [PATCH] refactor to use superlu 7 --- CMakeLists.txt | 4 +- cmake_aux/Modules/ARMA_FindSuperLU7.cmake | 62 +++++++++++++ include/armadillo_bits/config.hpp | 4 + include/armadillo_bits/config.hpp.cmake | 4 + include/armadillo_bits/def_superlu.hpp | 24 ++--- include/armadillo_bits/include_superlu.hpp | 97 +++++++++++--------- include/armadillo_bits/sp_auxlib_meat.hpp | 30 +++--- include/armadillo_bits/translate_superlu.hpp | 12 +-- src/wrapper1.cpp | 24 ++--- 9 files changed, 171 insertions(+), 90 deletions(-) create mode 100644 cmake_aux/Modules/ARMA_FindSuperLU7.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index c63a9286..5d5be866 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -74,7 +74,7 @@ set(ARMA_USE_LAPACK false) set(ARMA_USE_BLAS false) set(ARMA_USE_ATLAS false) set(ARMA_USE_ARPACK false) -set(ARMA_USE_SUPERLU false) # Caveat: only SuperLU version 5.x can be used! +set(ARMA_USE_SUPERLU false) # Caveat: only SuperLU version 7.x can be used! # extract version from sources @@ -470,7 +470,7 @@ if(ARPACK_FOUND) set(ARMA_LIBS ${ARMA_LIBS} ${ARPACK_LIBRARY}) endif() -include(ARMA_FindSuperLU5) +include(ARMA_FindSuperLU7) message(STATUS "SuperLU_FOUND = ${SuperLU_FOUND}") if(SuperLU_FOUND) diff --git a/cmake_aux/Modules/ARMA_FindSuperLU7.cmake b/cmake_aux/Modules/ARMA_FindSuperLU7.cmake new file mode 100644 index 00000000..d6872e35 --- /dev/null +++ b/cmake_aux/Modules/ARMA_FindSuperLU7.cmake @@ -0,0 +1,62 @@ +# Try to find SuperLU 7.x +# Once done, this will define +# +# SuperLU_FOUND - system has SuperLU +# SuperLU_LIBRARY - Link this to use SuperLU +# SuperLU_INCLUDE_DIR - directory of SuperLU headers + +find_path(SuperLU_INCLUDE_DIR slu_ddefs.h + PATHS ${CMAKE_SYSTEM_INCLUDE_PATH} /usr/include /usr/local/include /opt/local/include + PATH_SUFFIXES superlu SuperLU "" +) + +find_library(SuperLU_LIBRARY + NAMES superlu + PATHS ${CMAKE_SYSTEM_LIBRARY_PATH} /usr/lib64 /usr/lib /usr/local/lib64 /usr/local/lib /opt/local/lib64 /opt/local/lib +) + +set(SuperLU_FOUND NO) + +if(NOT SuperLU_FIND_QUIETLY) + message(STATUS "Looking for SuperLU version 7") +endif() + +if(SuperLU_LIBRARY AND SuperLU_INCLUDE_DIR) + + # Now determine if the version is version 7. + # This voodoo is required as SuperLU developers like to keep things messy. + + if(EXISTS "${SuperLU_INCLUDE_DIR}/slu_ddefs.h") + + file(READ "${SuperLU_INCLUDE_DIR}/slu_ddefs.h" _slu_HEADER_CONTENTS) + + string(REGEX REPLACE ".*version ([0-9]).*" "\\1" SLU_VERSION_MAJOR "${_slu_HEADER_CONTENTS}") + + if("${SLU_VERSION_MAJOR}" EQUAL "7") + set(SuperLU_FOUND YES) + else() + if(NOT SuperLU_FIND_QUIETLY) + message(STATUS "Found an older version of SuperLU, but version 7 is required") + endif() + endif() + else() + if(NOT SuperLU_FIND_QUIETLY) + message(STATUS "Found SuperLU and headers, but could not verify version 7") + endif() + endif() +endif() + +if(SuperLU_LIBRARY AND NOT SuperLU_INCLUDE_DIR) + if(NOT SuperLU_FIND_QUIETLY) + message(STATUS "Incomplete installation of SuperLU: no SuperLU headers found") + endif() +endif() + +if(NOT SuperLU_FOUND) + if(NOT SuperLU_FIND_QUIETLY) + message(STATUS "Could not find SuperLU") + endif() +else() + message(STATUS "Found SuperLU: ${SuperLU_LIBRARY}") +endif() + diff --git a/include/armadillo_bits/config.hpp b/include/armadillo_bits/config.hpp index 14156c59..0195b156 100644 --- a/include/armadillo_bits/config.hpp +++ b/include/armadillo_bits/config.hpp @@ -316,6 +316,10 @@ #pragma message ("WARNING: use of ARMA_BLAS_64BIT_INT in conjunction with ARMA_USE_WRAPPER is not supported") #endif +#if (defined(ARMA_SUPERLU_64BIT_INT) && defined(ARMA_USE_WRAPPER)) + #pragma message ("WARNING: use of ARMA_SUPERLU_64BIT_INT in conjunction with ARMA_USE_WRAPPER is not supported") +#endif + #if defined(ARMA_DONT_OPTIMISE_BAND) || defined(ARMA_DONT_OPTIMISE_SOLVE_BAND) #undef ARMA_OPTIMISE_BAND #endif diff --git a/include/armadillo_bits/config.hpp.cmake b/include/armadillo_bits/config.hpp.cmake index 59e7ef51..df4788dc 100644 --- a/include/armadillo_bits/config.hpp.cmake +++ b/include/armadillo_bits/config.hpp.cmake @@ -316,6 +316,10 @@ #pragma message ("WARNING: use of ARMA_BLAS_64BIT_INT in conjunction with ARMA_USE_WRAPPER is not supported") #endif +#if (defined(ARMA_SUPERLU_64BIT_INT) && defined(ARMA_USE_WRAPPER)) + #pragma message ("WARNING: use of ARMA_SUPERLU_64BIT_INT in conjunction with ARMA_USE_WRAPPER is not supported") +#endif + #if defined(ARMA_DONT_OPTIMISE_BAND) || defined(ARMA_DONT_OPTIMISE_SOLVE_BAND) #undef ARMA_OPTIMISE_BAND #endif diff --git a/include/armadillo_bits/def_superlu.hpp b/include/armadillo_bits/def_superlu.hpp index 81f6ac39..ca48ad2c 100644 --- a/include/armadillo_bits/def_superlu.hpp +++ b/include/armadillo_bits/def_superlu.hpp @@ -19,20 +19,20 @@ extern "C" { - extern void arma_wrapper(sgssv)(superlu::superlu_options_t*, superlu::SuperMatrix*, int*, int*, superlu::SuperMatrix*, superlu::SuperMatrix*, superlu::SuperMatrix*, superlu::SuperLUStat_t*, int*); - extern void arma_wrapper(dgssv)(superlu::superlu_options_t*, superlu::SuperMatrix*, int*, int*, superlu::SuperMatrix*, superlu::SuperMatrix*, superlu::SuperMatrix*, superlu::SuperLUStat_t*, int*); - extern void arma_wrapper(cgssv)(superlu::superlu_options_t*, superlu::SuperMatrix*, int*, int*, superlu::SuperMatrix*, superlu::SuperMatrix*, superlu::SuperMatrix*, superlu::SuperLUStat_t*, int*); - extern void arma_wrapper(zgssv)(superlu::superlu_options_t*, superlu::SuperMatrix*, int*, int*, superlu::SuperMatrix*, superlu::SuperMatrix*, superlu::SuperMatrix*, superlu::SuperLUStat_t*, int*); + extern void arma_wrapper(sgssv)(superlu::superlu_options_t*, superlu::SuperMatrix*, int*, int*, superlu::SuperMatrix*, superlu::SuperMatrix*, superlu::SuperMatrix*, superlu::SuperLUStat_t*, superlu::int_t*); + extern void arma_wrapper(dgssv)(superlu::superlu_options_t*, superlu::SuperMatrix*, int*, int*, superlu::SuperMatrix*, superlu::SuperMatrix*, superlu::SuperMatrix*, superlu::SuperLUStat_t*, superlu::int_t*); + extern void arma_wrapper(cgssv)(superlu::superlu_options_t*, superlu::SuperMatrix*, int*, int*, superlu::SuperMatrix*, superlu::SuperMatrix*, superlu::SuperMatrix*, superlu::SuperLUStat_t*, superlu::int_t*); + extern void arma_wrapper(zgssv)(superlu::superlu_options_t*, superlu::SuperMatrix*, int*, int*, superlu::SuperMatrix*, superlu::SuperMatrix*, superlu::SuperMatrix*, superlu::SuperLUStat_t*, superlu::int_t*); - extern void arma_wrapper(sgssvx)(superlu::superlu_options_t*, superlu::SuperMatrix*, int*, int*, int*, char*, float*, float*, superlu::SuperMatrix*, superlu::SuperMatrix*, void*, int, superlu::SuperMatrix*, superlu::SuperMatrix*, float*, float*, float*, float*, superlu::GlobalLU_t*, superlu::mem_usage_t*, superlu::SuperLUStat_t*, int*); - extern void arma_wrapper(dgssvx)(superlu::superlu_options_t*, superlu::SuperMatrix*, int*, int*, int*, char*, double*, double*, superlu::SuperMatrix*, superlu::SuperMatrix*, void*, int, superlu::SuperMatrix*, superlu::SuperMatrix*, double*, double*, double*, double*, superlu::GlobalLU_t*, superlu::mem_usage_t*, superlu::SuperLUStat_t*, int*); - extern void arma_wrapper(cgssvx)(superlu::superlu_options_t*, superlu::SuperMatrix*, int*, int*, int*, char*, float*, float*, superlu::SuperMatrix*, superlu::SuperMatrix*, void*, int, superlu::SuperMatrix*, superlu::SuperMatrix*, float*, float*, float*, float*, superlu::GlobalLU_t*, superlu::mem_usage_t*, superlu::SuperLUStat_t*, int*); - extern void arma_wrapper(zgssvx)(superlu::superlu_options_t*, superlu::SuperMatrix*, int*, int*, int*, char*, double*, double*, superlu::SuperMatrix*, superlu::SuperMatrix*, void*, int, superlu::SuperMatrix*, superlu::SuperMatrix*, double*, double*, double*, double*, superlu::GlobalLU_t*, superlu::mem_usage_t*, superlu::SuperLUStat_t*, int*); + extern void arma_wrapper(sgssvx)(superlu::superlu_options_t*, superlu::SuperMatrix*, int*, int*, int*, char*, float*, float*, superlu::SuperMatrix*, superlu::SuperMatrix*, void*, superlu::int_t, superlu::SuperMatrix*, superlu::SuperMatrix*, float*, float*, float*, float*, superlu::GlobalLU_t*, superlu::mem_usage_t*, superlu::SuperLUStat_t*, superlu::int_t*); + extern void arma_wrapper(dgssvx)(superlu::superlu_options_t*, superlu::SuperMatrix*, int*, int*, int*, char*, double*, double*, superlu::SuperMatrix*, superlu::SuperMatrix*, void*, superlu::int_t, superlu::SuperMatrix*, superlu::SuperMatrix*, double*, double*, double*, double*, superlu::GlobalLU_t*, superlu::mem_usage_t*, superlu::SuperLUStat_t*, superlu::int_t*); + extern void arma_wrapper(cgssvx)(superlu::superlu_options_t*, superlu::SuperMatrix*, int*, int*, int*, char*, float*, float*, superlu::SuperMatrix*, superlu::SuperMatrix*, void*, superlu::int_t, superlu::SuperMatrix*, superlu::SuperMatrix*, float*, float*, float*, float*, superlu::GlobalLU_t*, superlu::mem_usage_t*, superlu::SuperLUStat_t*, superlu::int_t*); + extern void arma_wrapper(zgssvx)(superlu::superlu_options_t*, superlu::SuperMatrix*, int*, int*, int*, char*, double*, double*, superlu::SuperMatrix*, superlu::SuperMatrix*, void*, superlu::int_t, superlu::SuperMatrix*, superlu::SuperMatrix*, double*, double*, double*, double*, superlu::GlobalLU_t*, superlu::mem_usage_t*, superlu::SuperLUStat_t*, superlu::int_t*); - extern void arma_wrapper(sgstrf)(superlu::superlu_options_t*, superlu::SuperMatrix*, int, int, int*, void*, int, int*, int*, superlu::SuperMatrix*, superlu::SuperMatrix*, superlu::GlobalLU_t*, superlu::SuperLUStat_t*, int*); - extern void arma_wrapper(dgstrf)(superlu::superlu_options_t*, superlu::SuperMatrix*, int, int, int*, void*, int, int*, int*, superlu::SuperMatrix*, superlu::SuperMatrix*, superlu::GlobalLU_t*, superlu::SuperLUStat_t*, int*); - extern void arma_wrapper(cgstrf)(superlu::superlu_options_t*, superlu::SuperMatrix*, int, int, int*, void*, int, int*, int*, superlu::SuperMatrix*, superlu::SuperMatrix*, superlu::GlobalLU_t*, superlu::SuperLUStat_t*, int*); - extern void arma_wrapper(zgstrf)(superlu::superlu_options_t*, superlu::SuperMatrix*, int, int, int*, void*, int, int*, int*, superlu::SuperMatrix*, superlu::SuperMatrix*, superlu::GlobalLU_t*, superlu::SuperLUStat_t*, int*); + extern void arma_wrapper(sgstrf)(superlu::superlu_options_t*, superlu::SuperMatrix*, int, int, int*, void*, superlu::int_t, int*, int*, superlu::SuperMatrix*, superlu::SuperMatrix*, superlu::GlobalLU_t*, superlu::SuperLUStat_t*, superlu::int_t*); + extern void arma_wrapper(dgstrf)(superlu::superlu_options_t*, superlu::SuperMatrix*, int, int, int*, void*, superlu::int_t, int*, int*, superlu::SuperMatrix*, superlu::SuperMatrix*, superlu::GlobalLU_t*, superlu::SuperLUStat_t*, superlu::int_t*); + extern void arma_wrapper(cgstrf)(superlu::superlu_options_t*, superlu::SuperMatrix*, int, int, int*, void*, superlu::int_t, int*, int*, superlu::SuperMatrix*, superlu::SuperMatrix*, superlu::GlobalLU_t*, superlu::SuperLUStat_t*, superlu::int_t*); + extern void arma_wrapper(zgstrf)(superlu::superlu_options_t*, superlu::SuperMatrix*, int, int, int*, void*, superlu::int_t, int*, int*, superlu::SuperMatrix*, superlu::SuperMatrix*, superlu::GlobalLU_t*, superlu::SuperLUStat_t*, superlu::int_t*); extern void arma_wrapper(sgstrs)(superlu::trans_t, superlu::SuperMatrix*, superlu::SuperMatrix*, int*, int*, superlu::SuperMatrix*, superlu::SuperLUStat_t*, int*); extern void arma_wrapper(dgstrs)(superlu::trans_t, superlu::SuperMatrix*, superlu::SuperMatrix*, int*, int*, superlu::SuperMatrix*, superlu::SuperLUStat_t*, int*); diff --git a/include/armadillo_bits/include_superlu.hpp b/include/armadillo_bits/include_superlu.hpp index 0ce6c7bb..9c6fd653 100644 --- a/include/armadillo_bits/include_superlu.hpp +++ b/include/armadillo_bits/include_superlu.hpp @@ -16,7 +16,7 @@ // // ------------------------------------------------------------------------ // -// This file includes portions of SuperLU 5.2 software, +// This file includes portions of SuperLU 7.0 software, // licensed under the following conditions. // // Copyright (c) 2003, The Regents of the University of California, through @@ -64,16 +64,23 @@ // and manually specify a few SuperLU structures and function prototypes. // // CAVEAT: -// This code requires SuperLU version 5.2, -// and assumes that newer 5.x versions will have no API changes. +// This code requires SuperLU version 7.0, and assumes that newer 7.x versions have no API changes. namespace arma { namespace superlu { - // slu_*defs.h has int typedefed to int_t. - // I'll just write it as int for simplicity, where I can, but supermatrix.h needs int_t. - typedef int int_t; + // superlu_config.h uses either int or int64_t as int_t + + #if defined(ARMA_SUPERLU_64BIT_INT) + #if defined(INT64_MAX) + typedef std::int64_t int_t; + #else + typedef long long int_t; + #endif + #else + typedef int int_t; + #endif } } @@ -84,7 +91,7 @@ namespace arma namespace superlu { // Include supermatrix.h. This gives us SuperMatrix. - // Put it in the slu namespace. + // Put it in the superlu namespace. // For versions of SuperLU I am familiar with, supermatrix.h does not include any other files. // Therefore, putting it in the superlu namespace is reasonably safe. // This same reasoning is true for superlu_enum_consts.h. @@ -120,7 +127,7 @@ namespace superlu #undef ARMA_SLU_STR1 #undef ARMA_SLU_STR2 - + #undef ARMA_SLU_HEADER_A #undef ARMA_SLU_HEADER_B @@ -130,7 +137,7 @@ namespace superlu { int* panel_histo; double* utime; - float* ops; + float* ops; // NOTE: orig definition is flops_t* ops, where flops_t = float int TinyPivots; int RefineSteps; int expansions; @@ -174,16 +181,16 @@ namespace superlu typedef struct e_node { - int size; + int_t size; void* mem; } ExpHeader; typedef struct { - int size; - int used; - int top1; - int top2; + int_t size; + int_t used; + int_t top1; + int_t top2; void* array; } LU_stack_t; @@ -191,16 +198,16 @@ namespace superlu { int* xsup; int* supno; - int* lsub; - int* xlsub; + int_t* lsub; + int_t* xlsub; void* lusup; - int* xlusup; + int_t* xlusup; void* ucol; - int* usub; - int* xusub; - int nzlmax; - int nzumax; - int nzlumax; + int_t* usub; + int_t* xusub; + int_t nzlmax; + int_t nzumax; + int_t nzlumax; int n; LU_space_t MemModel; int num_expansions; @@ -283,23 +290,23 @@ namespace superlu { int* panel_histo; double* utime; - float* ops; + float* ops; // NOTE: orig definition is flops_t* ops, where flops_t = float int TinyPivots; int RefineSteps; int expansions; } SuperLUStat_t; - typedef enum {NO, YES} yes_no_t; + typedef enum {NO, YES} yes_no_t; typedef enum {DOFACT, SamePattern, SamePattern_SameRowPerm, FACTORED} fact_t; - typedef enum {NOROWPERM, LargeDiag, MY_PERMR} rowperm_t; + typedef enum {NOROWPERM, LargeDiag_MC64, LargeDiag_HWPM, MY_PERMR} rowperm_t; typedef enum {NATURAL, MMD_ATA, MMD_AT_PLUS_A, COLAMD, - METIS_AT_PLUS_A, PARMETIS, ZOLTAN, MY_PERMC} colperm_t; - typedef enum {NOTRANS, TRANS, CONJ} trans_t; - typedef enum {NOREFINE, SLU_SINGLE=1, SLU_DOUBLE, SLU_EXTRA} IterRefine_t; - typedef enum {SYSTEM, USER} LU_space_t; - typedef enum {ONE_NORM, TWO_NORM, INF_NORM} norm_t; - typedef enum {SILU, SMILU_1, SMILU_2, SMILU_3} milu_t; - + METIS_AT_PLUS_A, PARMETIS, METIS_ATA, ZOLTAN, MY_PERMC} colperm_t; + typedef enum {NOTRANS, TRANS, CONJ} trans_t; + typedef enum {NOREFINE, SLU_SINGLE=1, SLU_DOUBLE, SLU_EXTRA} IterRefine_t; + typedef enum {SYSTEM, USER} LU_space_t; + typedef enum {ONE_NORM, TWO_NORM, INF_NORM} norm_t; + typedef enum {SILU, SMILU_1, SMILU_2, SMILU_3} milu_t; + typedef struct { fact_t Fact; @@ -352,16 +359,16 @@ namespace superlu typedef struct e_node { - int size; + int_t size; void* mem; } ExpHeader; typedef struct { - int size; - int used; - int top1; - int top2; + int_t size; + int_t used; + int_t top1; + int_t top2; void* array; } LU_stack_t; @@ -369,16 +376,16 @@ namespace superlu { int* xsup; int* supno; - int* lsub; - int* xlsub; + int_t* lsub; + int_t* xlsub; void* lusup; - int* xlusup; + int_t* xlusup; void* ucol; - int* usub; - int* xusub; - int nzlmax; - int nzumax; - int nzlumax; + int_t* usub; + int_t* xusub; + int_t nzlmax; + int_t nzumax; + int_t nzlumax; int n; LU_space_t MemModel; int num_expansions; diff --git a/include/armadillo_bits/sp_auxlib_meat.hpp b/include/armadillo_bits/sp_auxlib_meat.hpp index 29e1be72..81aacce0 100644 --- a/include/armadillo_bits/sp_auxlib_meat.hpp +++ b/include/armadillo_bits/sp_auxlib_meat.hpp @@ -1237,21 +1237,21 @@ sp_auxlib::spsolve_simple(Mat& X, const SpBase(&options, a.get_ptr(), perm_c.get_ptr(), perm_r.get_ptr(), l.get_ptr(), u.get_ptr(), x.get_ptr(), stat.get_ptr(), &info); // Process the return code. - if( (info > 0) && (info <= int(A.n_cols)) ) + if( (info > 0) && (info <= superlu::int_t(A.n_cols)) ) { // std::ostringstream tmp; // tmp << "spsolve(): could not solve system; LU factorisation completed, but detected zero in U(" << (info-1) << ',' << (info-1) << ')'; // arma_warn(1, tmp.str()); } else - if(info > int(A.n_cols)) + if(info > superlu::int_t(A.n_cols)) { arma_warn(1, "spsolve(): memory allocation failure"); } @@ -1381,10 +1381,11 @@ sp_auxlib::spsolve_refine(Mat& X, typename T1::pod_type& char equed[8] = {}; // extra characters for paranoia T rpg = T(0); T rcond = T(0); - int info = int(0); // Return code. - char work[8] = {}; - int lwork = int(0); // 0 means superlu will allocate memory + char work[8] = {}; + superlu::int_t lwork = 0; // 0 means superlu will allocate memory + + superlu::int_t info = 0; // Return code. arma_debug_print("superlu::gssvx()"); superlu::gssvx(&options, a.get_ptr(), perm_c.get_ptr(), perm_r.get_ptr(), etree.get_ptr(), equed, R.get_ptr(), C.get_ptr(), l.get_ptr(), u.get_ptr(), &work[0], lwork, b.get_ptr(), x.get_ptr(), &rpg, &rcond, ferr.get_ptr(), berr.get_ptr(), &glu, &mu, stat.get_ptr(), &info); @@ -1396,20 +1397,20 @@ sp_auxlib::spsolve_refine(Mat& X, typename T1::pod_type& { status = true; } - if( (info > 0) && (info <= int(A.n_cols)) ) + if( (info > 0) && (info <= superlu::int_t(A.n_cols)) ) { // std::ostringstream tmp; // tmp << "spsolve(): could not solve system; LU factorisation completed, but detected zero in U(" << (info-1) << ',' << (info-1) << ')'; // arma_warn(1, tmp.str()); } else - if( (info == int(A.n_cols+1)) && (user_opts.allow_ugly) ) + if( (info == superlu::int_t(A.n_cols+1)) && (user_opts.allow_ugly) ) { arma_warn(2, "spsolve(): system is singular to working precision (rcond: ", rcond, ")"); status = true; } else - if(info > int(A.n_cols+1)) + if(info > superlu::int_t(A.n_cols+1)) { arma_warn(1, "spsolve(): memory allocation failure"); } @@ -2123,7 +2124,7 @@ sp_auxlib::run_aupd_shiftinvert superlu_opts superlu_opts_default; superlu::superlu_options_t options; sp_auxlib::set_superlu_opts(options, superlu_opts_default); - int lwork = 0; + superlu::trans_t trans = superlu::NOTRANS; superlu::GlobalLU_t Glu; /* Not needed on return. */ @@ -2176,7 +2177,9 @@ sp_auxlib::run_aupd_shiftinvert int panel_size = superlu::sp_ispec_environ(1); int relax = superlu::sp_ispec_environ(2); - int slu_info = 0; // Return code. + + superlu::int_t lwork = 0; + superlu::int_t slu_info = 0; // Return code. arma_debug_print("superlu::gstrf()"); superlu::get_permutation_c(options.ColPerm, x.get_ptr(), perm_c.get_ptr()); @@ -2704,8 +2707,9 @@ superlu_worker::factorise(typename get_pod_type::result& out_rcond, cons int panel_size = superlu::sp_ispec_environ(1); int relax = superlu::sp_ispec_environ(2); - int lwork = 0; - int info = 0; + + superlu::int_t lwork = 0; + superlu::int_t info = 0; arma_debug_print("superlu::superlu::get_permutation_c()"); superlu::get_permutation_c(options.ColPerm, AA.get_ptr(), perm_c.get_ptr()); diff --git a/include/armadillo_bits/translate_superlu.hpp b/include/armadillo_bits/translate_superlu.hpp index b99c0050..1f9eb956 100644 --- a/include/armadillo_bits/translate_superlu.hpp +++ b/include/armadillo_bits/translate_superlu.hpp @@ -26,7 +26,7 @@ namespace superlu template inline void - gssv(superlu_options_t* options, SuperMatrix* A, int* perm_c, int* perm_r, SuperMatrix* L, SuperMatrix* U, SuperMatrix* B, SuperLUStat_t* stat, int* info) + gssv(superlu_options_t* options, SuperMatrix* A, int* perm_c, int* perm_r, SuperMatrix* L, SuperMatrix* U, SuperMatrix* B, SuperLUStat_t* stat, superlu::int_t* info) { arma_type_check(( is_supported_blas_type::value == false )); @@ -63,11 +63,11 @@ namespace superlu int* etree, char* equed, typename get_pod_type::result* R, typename get_pod_type::result* C, SuperMatrix* L, SuperMatrix* U, - void* work, int lwork, + void* work, superlu::int_t lwork, SuperMatrix* B, SuperMatrix* X, typename get_pod_type::result* rpg, typename get_pod_type::result* rcond, typename get_pod_type::result* ferr, typename get_pod_type::result* berr, - GlobalLU_t* glu, mem_usage_t* mu, SuperLUStat_t* stat, int* info + GlobalLU_t* glu, mem_usage_t* mu, SuperLUStat_t* stat, superlu::int_t* info ) { arma_type_check(( is_supported_blas_type::value == false )); @@ -105,11 +105,11 @@ namespace superlu gstrf(superlu_options_t* options, SuperMatrix* A, int relax, - int panel_size, int *etree, - void *work, int lwork, + int panel_size, int* etree, + void* work, superlu::int_t lwork, int* perm_c, int* perm_r, SuperMatrix* L, SuperMatrix* U, - GlobalLU_t* Glu, SuperLUStat_t* stat, int* info + GlobalLU_t* Glu, SuperLUStat_t* stat, superlu::int_t* info ) { arma_type_check(( is_supported_blas_type::value == false )); diff --git a/src/wrapper1.cpp b/src/wrapper1.cpp index 5cb169a4..50a471df 100644 --- a/src/wrapper1.cpp +++ b/src/wrapper1.cpp @@ -1480,22 +1480,22 @@ extern "C" #if defined(ARMA_USE_SUPERLU) - void wrapper_sgssv(superlu::superlu_options_t* a, superlu::SuperMatrix* b, int* c, int* d, superlu::SuperMatrix* e, superlu::SuperMatrix* f, superlu::SuperMatrix* g, superlu::SuperLUStat_t* h, int* i) + void wrapper_sgssv(superlu::superlu_options_t* a, superlu::SuperMatrix* b, int* c, int* d, superlu::SuperMatrix* e, superlu::SuperMatrix* f, superlu::SuperMatrix* g, superlu::SuperLUStat_t* h, superlu::int_t* i) { sgssv(a,b,c,d,e,f,g,h,i); } - void wrapper_dgssv(superlu::superlu_options_t* a, superlu::SuperMatrix* b, int* c, int* d, superlu::SuperMatrix* e, superlu::SuperMatrix* f, superlu::SuperMatrix* g, superlu::SuperLUStat_t* h, int* i) + void wrapper_dgssv(superlu::superlu_options_t* a, superlu::SuperMatrix* b, int* c, int* d, superlu::SuperMatrix* e, superlu::SuperMatrix* f, superlu::SuperMatrix* g, superlu::SuperLUStat_t* h, superlu::int_t* i) { dgssv(a,b,c,d,e,f,g,h,i); } - void wrapper_cgssv(superlu::superlu_options_t* a, superlu::SuperMatrix* b, int* c, int* d, superlu::SuperMatrix* e, superlu::SuperMatrix* f, superlu::SuperMatrix* g, superlu::SuperLUStat_t* h, int* i) + void wrapper_cgssv(superlu::superlu_options_t* a, superlu::SuperMatrix* b, int* c, int* d, superlu::SuperMatrix* e, superlu::SuperMatrix* f, superlu::SuperMatrix* g, superlu::SuperLUStat_t* h, superlu::int_t* i) { cgssv(a,b,c,d,e,f,g,h,i); } - void wrapper_zgssv(superlu::superlu_options_t* a, superlu::SuperMatrix* b, int* c, int* d, superlu::SuperMatrix* e, superlu::SuperMatrix* f, superlu::SuperMatrix* g, superlu::SuperLUStat_t* h, int* i) + void wrapper_zgssv(superlu::superlu_options_t* a, superlu::SuperMatrix* b, int* c, int* d, superlu::SuperMatrix* e, superlu::SuperMatrix* f, superlu::SuperMatrix* g, superlu::SuperLUStat_t* h, superlu::int_t* i) { zgssv(a,b,c,d,e,f,g,h,i); } @@ -1503,22 +1503,22 @@ extern "C" - void wrapper_sgssvx(superlu::superlu_options_t* a, superlu::SuperMatrix* b, int* c, int* d, int* e, char* f, float* g, float* h, superlu::SuperMatrix* i, superlu::SuperMatrix* j, void* k, int l, superlu::SuperMatrix* m, superlu::SuperMatrix* n, float* o, float* p, float* q, float* r, superlu::GlobalLU_t* s, superlu::mem_usage_t* t, superlu::SuperLUStat_t* u, int* v) + void wrapper_sgssvx(superlu::superlu_options_t* a, superlu::SuperMatrix* b, int* c, int* d, int* e, char* f, float* g, float* h, superlu::SuperMatrix* i, superlu::SuperMatrix* j, void* k, superlu::int_t l, superlu::SuperMatrix* m, superlu::SuperMatrix* n, float* o, float* p, float* q, float* r, superlu::GlobalLU_t* s, superlu::mem_usage_t* t, superlu::SuperLUStat_t* u, superlu::int_t* v) { sgssvx(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v); } - void wrapper_dgssvx(superlu::superlu_options_t* a, superlu::SuperMatrix* b, int* c, int* d, int* e, char* f, double* g, double* h, superlu::SuperMatrix* i, superlu::SuperMatrix* j, void* k, int l, superlu::SuperMatrix* m, superlu::SuperMatrix* n, double* o, double* p, double* q, double* r, superlu::GlobalLU_t* s, superlu::mem_usage_t* t, superlu::SuperLUStat_t* u, int* v) + void wrapper_dgssvx(superlu::superlu_options_t* a, superlu::SuperMatrix* b, int* c, int* d, int* e, char* f, double* g, double* h, superlu::SuperMatrix* i, superlu::SuperMatrix* j, void* k, superlu::int_t l, superlu::SuperMatrix* m, superlu::SuperMatrix* n, double* o, double* p, double* q, double* r, superlu::GlobalLU_t* s, superlu::mem_usage_t* t, superlu::SuperLUStat_t* u, superlu::int_t* v) { dgssvx(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v); } - void wrapper_cgssvx(superlu::superlu_options_t* a, superlu::SuperMatrix* b, int* c, int* d, int* e, char* f, float* g, float* h, superlu::SuperMatrix* i, superlu::SuperMatrix* j, void* k, int l, superlu::SuperMatrix* m, superlu::SuperMatrix* n, float* o, float* p, float* q, float* r, superlu::GlobalLU_t* s, superlu::mem_usage_t* t, superlu::SuperLUStat_t* u, int* v) + void wrapper_cgssvx(superlu::superlu_options_t* a, superlu::SuperMatrix* b, int* c, int* d, int* e, char* f, float* g, float* h, superlu::SuperMatrix* i, superlu::SuperMatrix* j, void* k, superlu::int_t l, superlu::SuperMatrix* m, superlu::SuperMatrix* n, float* o, float* p, float* q, float* r, superlu::GlobalLU_t* s, superlu::mem_usage_t* t, superlu::SuperLUStat_t* u, superlu::int_t* v) { cgssvx(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v); } - void wrapper_zgssvx(superlu::superlu_options_t* a, superlu::SuperMatrix* b, int* c, int* d, int* e, char* f, double* g, double* h, superlu::SuperMatrix* i, superlu::SuperMatrix* j, void* k, int l, superlu::SuperMatrix* m, superlu::SuperMatrix* n, double* o, double* p, double* q, double* r, superlu::GlobalLU_t* s, superlu::mem_usage_t* t, superlu::SuperLUStat_t* u, int* v) + void wrapper_zgssvx(superlu::superlu_options_t* a, superlu::SuperMatrix* b, int* c, int* d, int* e, char* f, double* g, double* h, superlu::SuperMatrix* i, superlu::SuperMatrix* j, void* k, superlu::int_t l, superlu::SuperMatrix* m, superlu::SuperMatrix* n, double* o, double* p, double* q, double* r, superlu::GlobalLU_t* s, superlu::mem_usage_t* t, superlu::SuperLUStat_t* u, superlu::int_t* v) { zgssvx(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v); } @@ -1526,22 +1526,22 @@ extern "C" - void wrapper_sgstrf(superlu::superlu_options_t* a, superlu::SuperMatrix* b, int d, int e, int* f, void* g, int h, int* i, int* j, superlu::SuperMatrix* k, superlu::SuperMatrix* l, superlu::GlobalLU_t* m, superlu::SuperLUStat_t* n, int* o) + void wrapper_sgstrf(superlu::superlu_options_t* a, superlu::SuperMatrix* b, int d, int e, int* f, void* g, superlu::int_t h, int* i, int* j, superlu::SuperMatrix* k, superlu::SuperMatrix* l, superlu::GlobalLU_t* m, superlu::SuperLUStat_t* n, superlu::int_t* o) { sgstrf(a, b, d, e, f, g, h, i, j, k, l, m, n, o); } - void wrapper_dgstrf(superlu::superlu_options_t* a, superlu::SuperMatrix* b, int d, int e, int* f, void* g, int h, int* i, int* j, superlu::SuperMatrix* k, superlu::SuperMatrix* l, superlu::GlobalLU_t* m, superlu::SuperLUStat_t* n, int* o) + void wrapper_dgstrf(superlu::superlu_options_t* a, superlu::SuperMatrix* b, int d, int e, int* f, void* g, superlu::int_t h, int* i, int* j, superlu::SuperMatrix* k, superlu::SuperMatrix* l, superlu::GlobalLU_t* m, superlu::SuperLUStat_t* n, superlu::int_t* o) { dgstrf(a, b, d, e, f, g, h, i, j, k, l, m, n, o); } - void wrapper_cgstrf(superlu::superlu_options_t* a, superlu::SuperMatrix* b, int d, int e, int* f, void* g, int h, int* i, int* j, superlu::SuperMatrix* k, superlu::SuperMatrix* l, superlu::GlobalLU_t* m, superlu::SuperLUStat_t* n, int* o) + void wrapper_cgstrf(superlu::superlu_options_t* a, superlu::SuperMatrix* b, int d, int e, int* f, void* g, superlu::int_t h, int* i, int* j, superlu::SuperMatrix* k, superlu::SuperMatrix* l, superlu::GlobalLU_t* m, superlu::SuperLUStat_t* n, superlu::int_t* o) { cgstrf(a, b, d, e, f, g, h, i, j, k, l, m, n, o); } - void wrapper_zgstrf(superlu::superlu_options_t* a, superlu::SuperMatrix* b, int d, int e, int* f, void* g, int h, int* i, int* j, superlu::SuperMatrix* k, superlu::SuperMatrix* l, superlu::GlobalLU_t* m, superlu::SuperLUStat_t* n, int* o) + void wrapper_zgstrf(superlu::superlu_options_t* a, superlu::SuperMatrix* b, int d, int e, int* f, void* g, superlu::int_t h, int* i, int* j, superlu::SuperMatrix* k, superlu::SuperMatrix* l, superlu::GlobalLU_t* m, superlu::SuperLUStat_t* n, superlu::int_t* o) { zgstrf(a, b, d, e, f, g, h, i, j, k, l, m, n, o); }