Please consider helping us improve by answering our 3 question survey.
KINSOL is a solver for nonlinear algebraic systems. It includes a NewtonKrylov solver as well as Picard and fixed point solvers, both of which can be accelerated with Anderson acceleration. KINSOL is based on the previous Fortran package NKSOL of Brown and Saad.
KINSOL’s Newton solver employs the Inexact Newton method. As this solver is intended mainly for large systems, four iterative methods are provided to solve the resulting linear systems–GMRES, BiCGStab, TFQMR, and FGMRES. These are Krylov methods, implemented with scaling and preconditioning, and can be used with all versions of the NVECTOR module.
For the sake of convenience to users with smaller systems, KINSOL (used with the serial NVECTOR module) also includes direct (dense, banded, and sparse) linear solvers for the linear systems. In this case the nonlinear iteration is a Modified Newton method.
In addition, KINSOL (used with the serial NVECTOR module) also includes interfaces to the sparse direct solvers, KLU, and the the multithreaded sparse solver, SuperLU_MT.
In addition to the basic Krylov method modules, the KINSOL package includes a module called KINBBDPRE, which provides a bandblockdiagonal preconditioner for the native MPI parallel vector.
For use with Fortran applications, a set of Fortran/C interface routines, called FKINSOL, is also supplied. These are written in C, but assume that the user calling program and all usersupplied routines are in Fortran.
See Software page for download and documentation.
kinsol release history
What’s new in v3.0.0?
 New features and/or enhancements
 New linear solver API and interfaces for all SUNDIALS packages and linear solvers. The goal of the redesign of these interfaces was to provide more encapsulation and ease in interfacing custom linear solvers and interoperability with linear solver libraries.
 Added generic SUNMATRIX module with three provided implementations: dense, banded, and sparse. These implementations replicate previous SUNDIALS Dls and Sls matrix structures in a single objectoriented API.
 Added example problems demonstrating use of generic SUNMATRIX modules.
 Added generic SUNLINEARSOLVER module with eleven provided implementations: dense, banded, LAPACK dense, LAPACK band, KLU, SuperLU_MT, SPGMR, SPBCGS, SPTFQMR, SPFGMR, and PCG. These implementations replicate previous SUNDIALS generic linear solvers in a single objectoriented API.
 Added example problems demonstrating use of generic SUNLINEARSOLVER modules.
 Expanded packageprovided direct linear solver (Dls) interfaces and scaled, preconditioned, iterative linear solver (Spils) interfaces to utilize generic SUNMATRIX and SUNLINEARSOLVER objects.
 Removed packagespecific, linear solverspecific, solver modules (e.g. CVDENSE, KINBAND, IDAKLU, ARKSPGMR) since their functionality is entirely replicated by the generic Dls/Spils interfaces and SUNLINEARSOLVER/SUNMATRIX modules. The exception is CVDIAG, a diagonal approximate Jacobian solver available to CVODE and CVODES.
 Converted all SUNDIALS example problems to utilize new generic SUNMATRIX and SUNLINEARSOLVER objects, along with updated Dls and Spils linear solver interfaces.
 Added Spils interface routines to ARKode, CVODE, CVODES, IDA and IDAS to allow specification of a userprovided “JTSetup” routine. This change supports users who wish to set up data structures for the userprovided Jacobiantimesvector (“JTimes”) routine, and where the cost of one JTSetup setup per Newton iteration can be amortized between multiple JTimes calls.
 Two new NVECTOR modules added: for CUDA and RAJA support for GPU systems. These vectors are supplied to provide very basic support for running on GPU architectures. Users are advised that these vectors both move all data to the GPU device upon construction, and speedup will only be realized if the user also conducts the righthandside function evaluation on the device. In addition, these vectors assume the problem fits on one GPU. For further information about RAJA, users are referred to the web site, https://software.llnl.gov/RAJA/.
 Addition of sunindextype option for 32 or 64bit integer data index types within all SUNDIALS structures.
 Sunindextype can be int64_t or int32_t or long long int and int depending on machine support for portable types.
 The Fortran interfaces continue to use long_int for indices, except for their sparse matrix interface that now uses the new sunindextype.
 Includes interfaces to PETSc, hypre, SuperLU_MT, and KLU with either 64bit or 32bit capabilities depending how the user configures SUNDIALS.
 Temporary vectors were removed from preconditioner setup and solve routines for all packages. It is assumed that all necessary data for userprovided preconditioner operations will be allocated and stored in userprovided data structures.
 The file include/sundials_fconfig.h was added. This file contains SUNDIALS type information for use in Fortran programs.
 Added support for many xSDKcompliant build system keys.
 The xSDK is a movement in scientific software to provide a foundation for the rapid and efficient production of highquality, sustainable extremescale scientific applications.
 More information can be found at https://xsdk.info.

Added functions SUNDIALSGetVersion and SUNDIALSGetVersionNumber to
get SUNDIALS release version information at runtime. 
To avoid potential namespace conflicts, the macros defining booleantype values TRUE and FALSE have been changed to SUNTRUE and SUNFALSE respectively.
 In build system:
 Added separate BLAS_ENABLE and BLAS_LIBRARIES CMake variables.
 Additional error checking during CMake configuration.
 Fixed minor CMake bugs.
 Renamed CMake options to enable/disable examples for greater clarity and added option to enable/disable Fortran 77 examples:
 Changed EXAMPLES_ENABLE to EXAMPLES_ENABLE_C.
 Changed CXX_ENABLE to EXAMPLES_ENABLE_CXX.
 Changed F90_ENABLE to EXAMPLES_ENABLE_F90.
 Added EXAMPLES_ENABLE_F77 option.
 Corrections and additions to all User Guides.
 New linear solver API and interfaces for all SUNDIALS packages and linear solvers. The goal of the redesign of these interfaces was to provide more encapsulation and ease in interfacing custom linear solvers and interoperability with linear solver libraries.
 Bug fixes
 Corrected KINSOL fcmix name translation for FKIN_SPFGMR.
What’s new in v2.9.0?
 New features and/or enhancements
 Two new NVECTOR modules added: for Hypre ParVector and PETSc.
 In vector API, added new required function, N_VGetVectorID.
 Upgrades to sparse solver interfaces; now support CSR matrix type with KLU solver.
 Example codes were changed from using NV_DATA macro to using N_VGetArrayPointer_* when using the native vectors shipped with SUNDIALS.
 Updated to return integers from linear solver and preconditioner ‘free’ functions.
 Added FKINCREATE and FKININIT routines to split FKINMALLOC routine into two pieces. FKINMALLOC remains for backward compatibility, but documentation for it has been removed.
 Added kinFoodWeb_kry_omp.c OpenMP example.
 Bug fixes
 Fixed memory leak in banded preconditioner interface.
 Fixed some examples w.r.t. switch to new macro/function names SUNRexp etc.
 Various minor fixes to installationrelated files.
 Corrected name N_VCloneEmptyVectorArray to N_VCloneVectorArrayEmpty in all documentation files.
 In FKINSOL, added missing Fortran interface routines so that users can supply the sparse Jacobian routine.
 Minor corrections and additions to User Guide, including removal of references to specific NVECTOR names in usage skeletons.
 Minor bug fix in Picard iteration so that newest iterate is returned.
 Minor bug fix in line search to prevent infinite loop when beta condition fails and lambda is below minimum size.
What’s new in v2.8.0?
 New features
 Added fixedpoint iteration and Picard iteration as globalization strategy options, both with Anderson acceleration.
 Added interface to the sparse direct solver KLU.
 Added interface to SuperLU_MT.
 Added interface to FGMRES.
 Bug fixes
 Corrected two return values in function KINStop.
 Fixed line setting smu in KINLapackBand.
 Fixed bug involving initialization of mxnewtstep.
 Fixed bug in difference quotient increments in kinDlsBandDQJac.
 Fixed an incorrect return value ier in FKINSOL function FKINfunc.
 Changes to the FKINSOL module
 In optional input routines FKINSETIIN, FKINSETRIN, and FKINSETVIN, removed the optional fourth argument key_length.
 Revised integer declarations in all examples so that those which must match a C type long int are declared INTEGER*8.
 Changes related to the build system
 Dropped support and documentation of the Autotools mode of installation.
What’s new in v2.7.0?
 Bug fixes
 Three major logic bugs were fixed – involving updating the solution vector, updating the linesearch parameter, and a missing error return.
 Three minor errors were fixed – involving setting etachoice in the Matlab/KINSOL interface, a missing error case in KINPrintInfo, and avoiding an exponential overflow in the evaluation of omega.
 linear solver memory set to zero after being created.
 linear solver memory is freed on an error return.
 Changes to user interface
 Problem size and related integers (bandwidth parameters etc.) all have type long int, except for those in user calls specifying BLAS/LAPACK routines.
What’s new in v2.6.0?
 New features
 new linear solver module, based on Blas and Lapack for both dense and banded matrices.
 Changes to user interface
 reorganization of all linear solver modules into two families (besides the existing family of scaled preconditioned iterative linear solvers, the direct solvers, including the new Lapackbased ones, were also organized into a direct family).
 maintaining a single pointer to user data, optionally specified through a Settype function.
 general streamlining of the bandblockdiagonal preconditioner module distributed with the solver.
What’s new in v2.5.0?
 Changes related to the build system
 rearranged the entire SUNDIALS source tree.
 all exported header files are now installed in separate subdirectories of the installtion include directory.
 header files are included now by specifying the relative path (e.g. #include <kinsol/kinsol.h>).
What’s new in v2.4.0?
 New features
 added direct linear solvers (dense and band, provided through the KINDENSE and KINBAND modules, respectively) thus adding modified (and exact) Newton methods to KINSOL.
 added KINSPBCG interface module to allow KINSOL to interface with the shared SPBCG (scaled preconditioned BiCGSTAB) linear solver module.
 added KINSPTFQMR interface module to allow KINSOL to interface with the shared SPTFQMR (scaled preconditioned TFQMR) linear solver module.
 added support for SPBCG and SPTFQMR to the KINBBDPRE preconditioner module.
 added option to KINBBDPRE preconditioner module to allow specification of different halfbandwidths for difference quotient approximation and retained matrix.
 added support for interpreting failures in usersupplied functions.
 Bug fixes
 corrected a bug in the preconditioner logic that caused the initial call to the preconditioner setup routine (controlled by KINSetNoInitSetup) to be skipped during subsequent calls to KINSol.
 Changes to underlying algorithm
 modified the KINBBDPRE preconditioner module to allow the use of different halfbandwidths for the difference quotient approximation and the retained matrix.
 added nonlinear residual monitoring scheme to control Jacobian updating when a direct linear solver is used (modified Newton iteration).
 Changes to user interface
 changed argument of KINFree and KINBBDPrecFree to be the address of the respective memory block pointer, so that its NULL value is propagated back to the calling function.
 modified the argument list of KINBBDPrecAlloc to allow specification of the upper and lower halfbandwidths to be used in the computation of the local Jacobian blocks (mudq, mldq), and the halfbandwidths of the retained banded approximation to the local Jacobian block (mukeep, mlkeep).
 added KINSPBCG module which defines appropriate KINSpbcg* functions to allow KINSOL to interface with the shared SPBCG linear solver module.
 added KINBBDSpbcg function to KINBBDPRE module to support SPBCG linear solver module.
 changed function type names to accomodate all the Scaled Preconditioned Iterative Linear Solvers now available:
KINSpgmrJactimesVecFn > KINSpilsJacTimesVecFn
KINSpgmrPrecSetupFn > KINSpilsPrecSetupFn
KINSpgmrPrecSolveFn > KINSpilsPrecSolveFn  changed function types so that all usersupplied functions return an integer flag.
 changed some names for KINBBDPRE function outputs.
 added option for usersupplied error handler function.
 added option for usersupplied info handler function.
 renamed all exported header files (except for kinsol.h, all header files have the prefix kinsol_).
 changed naming scheme for KINSOL examples.
 Changes to FKINSOL module:
 modified argument list of FKINBBDINIT to accomadate changes made to KINBBDPRE module, so now user must specify the upper and lower halfbandwidths for the difference quotient approximation (mudq, mldq) and the retained matrix (mukeep, mlkeep).
 added support for KINSPBCG/SPBCG (added FKIN*SPBCG* functions).
 added support for KINSPTFQMR/SPTFQMR (added FKIN*SPTFQMR* functions).
 added support for KINDENSE/DENSE (added FKIN*DENSE* functions).
 added support for KINBAND/BAND (added FKIN*DENSE* functions).
 Optional inputs are now set using routines FKINSETIIN (integer inputs), FKINSETRIN (real inputs), and FKINSETVIN (vector inputs) through pairs keyvalue. Optional outputs are still obtained from two arrays (IOUT and ROUT), owned by the user and passed as arguments to FKINMALLOC.
 Changes related to the build system
 updated configure script and Makefiles for Fortran examples to avoid C++ compiler errors (now use CC and MPICC to link only if necessary).
 the main KINSOL header file (kinsol.h) is still exported to the install include directory. However, all other KINSOL header files are exported into a kinsol subdirectory of the install include directory.
 the KINSOL library now contains all shared object files (there is no separate libsundials_shared library any more).
What’s new in v2.3.0?
 Changes to user interface
 KINSOL now stores an actual copy of the constraints vector rather than just a pointer in order to resolve potential scoping issues.
 several optional input functions were combined into a single function:
 KINSpgmrSetPrecSetupFn, KINSpgmrSetPrecSolveFn and KINSpgmrSetPrecData were combined into KINSpgmrSetPreconditioner
 KINSpgmrSetJacTimesVecFn and KINSpgmrSetJacData were combined into KINSpgmrSetJacTimesVecFn
 Changes to FKINSOL module:
 FKINSPGMRSETPSET and FKINSPGMRSETPSOL were combined into FKINSPGMRSETPREC.
 due to changes to the main solver, if FKPSOL is provided, then FKPSET must also be defined, even if it is empty.
What’s new in v2.2.2?
 Bug fixes
 fixed bug in computation of the scaled step length.
 fixed bug in logic for disabling the call to the preconditioner setup function at the first iteration.
 Changes to documentation
 added section with numerical values of all input and output solver constants.
 Changes related to the build system
 fixed autoconfrelated bug to allow configuration with the PGI Fortran compiler.
 modified to use customized detection of the Fortran name mangling scheme (autoconf’s AC_F77_WRAPPERS routine is problematic on some platforms).
 added –withmpiflags as a configure option to allow user to specify MPIspecific flags.
 updated Makefiles for Fortran examples to avoid C++ compiler errors (now use CC and MPICC to link).
What’s new in v2.2.1?
 Changes related to the build system
 changed order of compiler directives in header files to avoid compilation errors when using a C++ compiler.
 changed method of generating sundials_config.h to avoid potential warnings of redefinition of preprocessor symbols.
What’s new in v2.2.0?
 New feature
 added option to disable all error messages.
 Bug fixes
 fixed constraintsrelated bug.
 fixed bug in implementation of linesearch method related to betacondition.
 corrected value of ealpha variable (related to forcing term).
 Changes related to NVECTOR module
 removed machEnv, redefined table of vector operations (now contained in the N_Vector structure itself).
 all KINSOL functions create new N_Vector variables through cloning, using an N_Vector passed by the user as a template.
 Changes to type names and KINSOL constants
 removed type ‘integertype’; instead use ‘int’ or ‘long int’, as appropriate.
 restructured the list of return values from the various KINSOL functions.
 changed all KINSOL constants (inputs and return values) to have the prefix ‘KIN_’ (e.g. KIN_SUCCESS).
 renamed function type ‘SysFn’ to ‘KINSysFn’.
 Changes to underlying algorithms
 modified linesearch backtracking scheme to use cubic interpolation after the first backtrack, if possible.
 changed implementation of constraints:
constraints[i] = 0 then u[i] NOT constrained
constraints[i] = +1 then u[i] >= 0
constraints[i] = 1 then u[i] <= 0
constraints[i] = +2 then u[i] > 0
constraints[i] = 2 then u[i] < 0
where u is the solution vector (see the KINSOL User Guide [1] for additional details).
 Changes to optional input/output
 added KINSet* and KINGet* functions for optional inputs/outputs, replacing the arrays iopt and ropt.
 added new optional inputs (e.g. maximum number of nonlinear iterations between calls to preconditioner setup routine, etc.).
 the value of the last return flag from any function within the SPGMR linear solver module can be obtained as an optional output using KINSpgmrGetLastFlag.
 Changes to usercallable functions
 added new function KINCreate which initializes the KINSOL solver object and returns a pointer to the KINSOL memory block.
 removed N (problem size) from all functions.
 shortened argument lists of most KINSOL functions (the arguments that were dropped can now be specified through KINSet* functions).
 removed reinitialization functions for SPGMR linear solver (same functionality can be obtained using KINSpgmrSet* functions).
 Changes to usersupplied functions
 removed N (problem dimension) from argument lists.
 in KINSPGMR, shortened argument lists for user preconditioner functions.