+      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~None<FT\ltraverse the sparse mutable vector and operate on the union set between the indices of the immutable vector v and those of the mutable one vm?, _overwriting_ the values in vm. Invariant: the index set of v is a strict subset of that of vm (i.e. we assume that vmZ is preallocated properly, or, we assume there won't be any out-of-bound writes attempted) NoneCV None ;=>?CFTV:Stream fusion based version of the above, from [1] [1] : Thttps://www.schoolofhaskell.com/user/edwardk/revisiting-matrix-multiplication/part-3<O(N) : Intersection between sorted vectors, in-place updates5O(N) : Union between sorted vectors, in-place updates! Safe  None* JIntersection and union of sparse lists having indices in _ascending_ orderAIntersection of sparse lists having indices in _descending_ order:Union of sparse lists having indices in _descending_ order7Lift a binary function onto the second entry of a tuple5Wrap a function with a null check, returning in MaybeIComponentwise tuple operations TODO : use semilattice properties insteadIComponentwise tuple operations TODO : use semilattice properties insteadinteger-indexed ziplist ", 2d arrays foldr over the results of a fmapstrict left foldindexed right foldNone-#Numerical iteration errorsMatrix exceptionsOperand size mismatch errors Out of bounds index errors Input errors(Errors associated with partial functions      ,(C) 2016 Marco Zocca, 2012-2015 Edward KmettGPL-3 (see LICENSE)zocca.marco gmail provisionalportableSafe;=6 %2Provides a test to see if a quantity is near zero.nearZero (1e-11 :: Double)FalsenearZero (1e-17 :: Double)TruenearZero (1e-5 :: Float)FalsenearZero (1e-7 :: Float)True&%Determine if a quantity is near zero.'Is this quantity close to 1 ?()Is this quantity distinguishable from 0 ?+Round to respectively 0 or 1,  a  1e-12-  a  1e-6.  a  1e-12/  a  1e-60  a  1e-121  a  1e-62  a  1e-123  a  1e-6%&'()*+%&()*+'%& (C) 2016 Marco ZoccaGPL-3 (see LICENSE)zocca.marco gmail provisionalportableSafe"#<? )Pretty printing options: total length in ' digits (including the decimal point),  of decimal digits4&Pretty-print with a descriptive header5Pretty-print with no header Some defaults Some defaults%Pretty print an array of real numbers(Pretty print an array of complex numbersJprintf an array of items with padding space to render a fixed column widthprintf format string"printf format string for a ComplexHelpersLength of list to be provided 5445(c) Marco Zocca 2017GPL-3 (see the file LICENSE)zocca marco gmail experimentalportableNone +;<=>?FT[,H;Union binary lift : apply function on _union_ of two "sets"IIIntersection binary lift : apply function on _intersection_ of two "sets"K'Sparsity (fraction of nonzero elements)NNumber of nonzerosR:Dimension (i.e. Int for SpVector, (Int, Int) for SpMatrix)T>Solve a linear system; uses GMRES internally as default methodXMatrix-vector actionYDual matrix-vector actionZ}A matrix ring is any collection of matrices over some ring R that form a ring under matrix addition and matrix multiplication\Matrix-matrix product]%Matrix times matrix transpose (A B^T)^%Matrix transpose times matrix (A^T B)_:Matrix transpose (Hermitian conjugate in the Complex case)`Frobenius normdL1 normeEuclidean (L2) norm squaredfLp norm (p > 0)gNormalize w.r.t. Lp normhNormalize w.r.t. L2 normi(Normalize w.r.t. norm2' instead of norm2jEuclidean (L2) normkMEuclidean (L2) norm; returns a Complex (norm :+ 0) for Complex-valued vectorslLp norm (p > 0)mAdds inner (dot) products.nInner/dot productqScale a vectors&The zero element: identity for '(^+^)'t Add vectorsuAdditive inversevGroup subtractionyCComplex conjugate, or identity function if its input is real-valuedz Magnitude{ Inner product|EScale a vector by the reciprocal of a number (e.g. for normalization)}Vector multiplied by scalar~,Convex combination of two vectors (NB: 0 <= a <= 1). X`hilbertDistSq x y = || x - y ||^2` computes the squared L2 distance between two vectorsInfinity-norm (Real)Infinity-norm (Complex)Lp inner product (p > 0) ReciprocalScale)Lift a real number onto the complex planeInstances for builtin typesT System matrixRight-hand sideResultP6:987;?>=<@FEDCBAGHIJKLONMPRQSTUVXYWZ`]^\_[afedihgkjlcbmnoqprusvtwzyx{|}~cwxyzrstuvopqmn{|}~abcdefghijklZ[\]^_`VWXYUSTPQRLMNOJKGHI@ABCDEF;<=>?6789:6789:;<=>?@ABCDEFGHIJKLMNOPQRSTVWXYZ[\]^_`a bcdefghijklmnopqrstuvwxyzq7t6v6|7}7None ;=>?FTk.O(N) : Lookup an index in a SVector (based on find from Data.Foldable)O(N) : Applies a function to the index _intersection_ of two CsrVector s. Useful e.g. to compute the inner product of two sparse vectors.O(N) : Applies a function to the index _union_ of two CsrVector s. Useful e.g. to compute the vector sum of two sparse vectors.`Modify the mutable vector operand by applying a binary function over the index union of the two.e.g.7g = (+) z = 0 u = [(1, a), (2, b)] v = [(0, d), (2, e)]3unionWithSMV g z u v = [(0, d), (1, a), (2, b + e)] invariants :uu, vv nonzero valuesixu, ixv nonzero indices"ixu, ixv sorted in ascending ordern1 == n2length ixu == length uulength ixv == length vvNone3;=FTo Sparse listFNB : unionWith and intersectWith work only if the indices are _sorted_.NB2 : we use the _descending_ order comparison"Inner product between sparse listsVector sum of sparse lists`vector-space` instances      None35FTpA synonym for IntMap  !"#$%(C) 2016 Marco ZoccaGPL-3 (see LICENSE)zocca.marco gmail provisionalportableNone35<FT(SpVector densityNumber of nonzeros*Empty sparse vector (length n, no entries)"Singleton sparse vector (length 1)Canonical basis vector in R^nHSparse vector from an association list while discarding all zero entries(Dense real SpVector (monomorphic Double)+Dense complex SpVector (monomorphic Double)>Create new sparse vector, assumin 0-based, contiguous indexing^Map a function over a range of indices and filter the result (indices and values) to fit in a n-long SpVector0", using just the integer bounds of the interval_one-hot encoding : `oneHotSV n k` produces a SpVector of length n having 1 at the k-th positionDENSE vector of `1`sDENSE vector of `0`s#DENSE vector with constant elements3Populate a SpVector with the contents of a Vector. jPopulate a Vector with the entries of a SpVector, discarding the indices (NB: loses sparsity information).VPopulate a Vector with the entries of a SpVector, replacing the missing entries with 0insert element x at index i: in a preexisting SpVector; discards out-of-bounds entriesSCreate new SpVector using data from a Foldable (e.g. a list) in (index, value) form Create a dense! SpVector from a list of Double's Create a dense) SpVector from a list of Complex Double's&Populate a list with SpVector contentsTo dense list (default = 0)Indexed fold over SpVectorLookup an index in a SpVector7Lookup an index, return a default value if lookup fails8Lookup an index in a SpVector, returns 0 if lookup fails Tail elements Head element2Keep the first n components of the SpVector (like & for lists)LDiscard the first n components of the SpVector and rebalance the keys (like ' for lists)2Keep the first n components of the SpVector (like & for lists)Keep a range of entries Concatenate two sparse vectorsFilterIndexed filterSparsify an SpVector*Generate an arbitrary (not random) vector u such that `v dot u = 0`bs are sparse containers too, i.e. any specific component may be missing (so it is assumed to be 0)@s form a vector space because they can be multiplied by a scalar s are finite-dimensional vectors3=None-(nInsert an element insertIM2 :: IM.Key -> IM.Key -> a -> IM.IntMap (IM.IntMap a) -> IM.IntMap (IM.IntMap a))TLookup a key lookupIM2 :: IM.Key -> IM.Key -> IM.IntMap (IM.IntMap a) -> Maybe a*Lookup with default 0+Populate an IM2 from a list of (row index, column index, value) fromListIM2 :: Foldable t => t (IM.Key, IM.Key, a) -> IM.IntMap (IM.IntMap a) -> IM.IntMap (IM.IntMap a),Indexed left fold over an IM2, with general accumulator ifoldlIM2' :: (IM.Key -> IM.Key -> a -> b -> b) -> b -> IM.IntMap (IM.IntMap a) -> b-Indexed left fold over an IM2 ifoldlIM2 :: (IM.Key -> IM.Key -> t -> IM.IntMap a -> IM.IntMap a) -> IM.IntMap (IM.IntMap t) -> IM.IntMap a.oLeft fold over an IM2, with general accumulator foldlIM2 :: (a -> b -> b) -> b -> IM.IntMap (IM.IntMap a) -> b/Inner indices become outer ones and vice versa. No loss of information because both inner and outer IntMaps are nubbed. transposeIM2 :: IM.IntMap (IM.IntMap a) -> IM.IntMap (IM.IntMap a)0Map over outer IM and filter all inner IM's ifilterIM2 :: (IM.Key -> IM.Key -> a -> Bool) -> IM.IntMap (IM.IntMap a) -> IM.IntMap (IM.IntMap a)1|Specialized filtering : keep only sub-diagonal elements filterSubdiag :: IM.IntMap (IM.IntMap a) -> IM.IntMap (IM.IntMap a)2}List of (row, col) indices of (nonzero) subdiagonal elements subdiagIndices :: IM.IntMap (IM.IntMap a) -> [(IM.Key, IM.Key)]3 Map over IM24|Indexed map over IM2 imapIM2 :: (IM.Key -> IM.Key -> a -> b) -> IM.IntMap (IM.IntMap a) -> IM.IntMap (IM.IntMap b)5}Mapping keys mapKeysIM2 :: (IM.Key -> IM.Key) -> (IM.Key -> IM.Key) -> IM.IntMap (IM.IntMap a) -> IM.IntMap (IM.IntMap a)()*+,-./016273458(C) 2016 Marco ZoccaGPL-3 (see LICENSE)zocca.marco gmail provisionalportableNone 35;<=FT-?Internal implementation,`zeroSM m n` : Empty SpMatrix of size (m, n)5`mkDiagonal n ll` : create a diagonal matrix of size n from a list ll of elements"`eye n` : identity matrix of rank nPermutation matrix from a (possibly incomplete) list of row swaps starting from row 0 e.g. `permutationSM 5 [1,3]` first swaps rows (0, 1) and then rows (1, 3) :.prd (permutationSM 5 [1,3] :: SpMatrix Double)  ( 5 rows, 5 columns ) , 5 NZ ( density 20.000 % ) _ , 1.00 , _ , _ , _ _ , _ , _ , 1.00 , _ _ , _ , 1.00 , _ , _ 1.00 , _ , _ , _ , _ _ , _ , _ , _ , 1.00 yPermutation matrix from a (possibly incomplete) list of row pair swaps e.g. `permutPairs 5 [(2,4)]` swaps rows 2 and 4 :0prd (permutPairsSM 5 [(2,4)] :: SpMatrix Double)  ( 5 rows, 5 columns ) , 5 NZ ( density 20.000 % ) 1.00 , _ , _ , _ , _ _ , 1.00 , _ , _ , _ _ , _ , _ , _ , 1.00 _ , _ , _ , 1.00 , _ _ , _ , 1.00 , _ , _ 9`mkSubDiagonal n o xx` creates a square SpMatrix of size n with xx on the oth subdiagonalDInsert an element in a preexisting Spmatrix at the specified indices?Add to existing SpMatrix using data from list (row, col, value)VCreate new SpMatrix using data from a Foldable (e.g. a list) in (row, col, value) formECreate new SpMatrix assuming contiguous, 0-based indexing of elements$Populate list with SpMatrix contentsHPopulate list with SpMatrix contents and populate missing entries with 0`Looks up an element in the matrix with a default (if the element is not found, zero is returned)3Zero-default lookup, infix form (no bound checking)`Looks up an element in the matrix with a default (if the element is not found, zero is returned)Indexed filtering functionbDiagonal, subdiagonal, superdiagonal partitions of a SpMatrix (useful for writing preconditioners)bDiagonal, subdiagonal, superdiagonal partitions of a SpMatrix (useful for writing preconditioners)bDiagonal, subdiagonal, superdiagonal partitions of a SpMatrix (useful for writing preconditioners)fExtract a submatrix given the specified index bounds, rebalancing keys with the two supplied functions^Extract a submatrix given the specified index bounds NB : subtracts (i1, j1) from the indices\Extract a submatrix given the specified index bounds NB : submatrix indices are _preserved_Extract whole column!Extract column within a row range1Extract column within a row range, rebalance keys.Are the supplied indices within matrix bounds?Is the matrix square?Is the matrix diagonal?%Is the matrix lower/upper triangular?%Is the matrix lower/upper triangular?,Is the matrix orthogonal? i.e. Q^t ## Q == I_Data in internal representation (do not export) immSM :: SpMatrix t -> IM.IntMap (IM.IntMap t) #(Number of rows, Number of columns) &Number of rows times number of columns Number of rows Number of columns"Vertical stacking of matrix blocks"Vertical stacking of matrix blocks$Horizontal stacking of matrix blocks$Horizontal stacking of matrix blocksoAssemble a block-diagonal square matrix from a list of square matrices, arranging these along the main diagonalIndexed filter over SpMatrixLeft fold over SpMatrixIndexed left fold over SpMatrixCount sub-diagonal nonzeros`Filter the index subset that lies below the diagonal (used in the QR decomposition, for example)Sparsify an SpMatrix 3Round almost-0 and almost-1 to 0 and 1 respectively!Modify (row, column) keys, leaving data intact. Be careful when using this! modifyKeysSM' :: (IxRow -> IxRow) -> (IxCol -> IxCol) -> SpMatrix a -> SpMatrix a#0Swap two rows of a SpMatrix (bounds not checked)$.Swap two rows of a SpMatrix (bounds checked) %transposeSM : Matrix transpose&Hermitian conjugate( Matrix trace,'Matrix product without dimension checks-1After multiplying the two matrices, all elements x& for which `| x | <= eps` are removed..1After multiplying the two matrices, all elements x& for which `| x | <= eps` are removed./Sparsifying A B^T0Sparsifying A^T B1 Contract row i of A with column j of B up to an index nD, i.e. summing over repeated indices: Aij Bjk , for j in [0 .. n] 2ces are sparse containers too, i.e. any specific component may be missing (so it is assumed to be 0)5-es are maps between finite-dimensional spaces7bes form an additive group, in that they can have an invertible associtative operation (matrix sum)Y      !"#$%&'()*+,-./01c98765432      !"#$%&'()*;:+,-.0/1(C) 2016 Marco ZoccaGPL-3 (see LICENSE)zocca.marco gmail provisionalportableNone &';<=FST92Modify the size of a SpVector. Do not use directly:1Remap the keys of a SpVector. Do not use directlyCAInsert row , using the provided row index transformation functionDInsert row ECInsert column, using the provided row index transformation functionF Insert columnG Outer productH Outer productIAFill the diagonal of a SpMatrix with the components of a SpVectorJpromote a SV to SMK.Demote (n x 1) or (1 x n) SpMatrix to SpVectorLRLookup a row in a SpMatrix; returns an SpVector with the row, if this is non-emptyMExtract ith rowNExtract jth columnOGeneric extraction functionPExtract ith row (dense)QExtract jth columnRExtract the diagonalS&extract row interval (all entries between columns j1 and j2, INCLUDED, are returned) extractSubRow :: SpMatrix a -> IxRow -> (IxCol, IxCol) -> SpVector a extractSubRow m i (j1, j2) = case lookupRowSM m i of Nothing -> zeroSV (ncols m) Just rv -> ifilterSV (j _ -> j >= j1 && j <= j2) rv", returning in Maybe extractSubRow :: SpMatrix a -> IxRow -> (Int, Int) -> Maybe (SpVector a) extractSubRow m i (j1, j2) = resizeSV (j2 - j1) . ifilterSV (j _ -> j >= j1 && j  =j2) <$ lookupRowSM m iExtract an interval of SpVector components, changing accordingly the resulting SpVector size. Keys are _not_ rebalanced, i.e. components are still labeled according with respect to the source matrix.T>extract row interval, rebalance keys by subtracting lowest oneUextract column intervalVAextract column interval, rebalance keys by subtracting lowest one;>Vector-on-matrix (FIXME : transposes matrix: more costly than matVec , I think)W/Pack a list of SpVectors as rows of an SpMatrixX/Pack a list of SpVectors as columns an SpMatrixY7Unpack the rows of an SpMatrix into a list of SpVectorsZ:Unpack the columns of an SpMatrix into a list of SpVectors[6Pack a V.Vector of SpVectors as columns of an SpMatrix\3Pack a V.Vector of SpVectors as rows of an SpMatrix(%&'()*+456789:;<=>?@ABCDEFGIHJKLMNOPQRSTUVWYXZ[_\^]`acbljkghidefmnopqrtvsuwxyz{|}~      !"#$%&'()*+,-./01CDEFGHIJKLMNOPQRSTUVWXYZ[\CDEFIGHKJLNMOPQRSUTVW\[XYZ(c) Marco Zocca 2017 GPL-style (see the file LICENSE)zocca marco gmail experimentalportableNone3<K>Gcprint function for type bdMax.# of iterationsePrint iteration info to stdout fProject state to a type b<5modifyUntil with optional iteration logging to stdoutjj is a special case of kH that assesses convergence based on the L2 distance to a known solution xKnownk0This function makes some default choices on the m machinery: convergence is assessed using the squared L2 distance between consecutive states, and divergence is detected when this function is increasing between pairs of measurements.l", monadic versionmm is a high-order abstraction of a numerical iterative process. It accumulates a rolling window of 3 states and compares a summary qf of the latest 2 with that of the previous two in order to assess divergence (e.g. if `q latest2 > q prev2` then the function throws an exception and terminates). The process ends by either hitting an iteration budget or by relative convergence, whichever happens first. After the iterations stop, the function then assesses the final state with a predicate qfinalw (e.g. for comparing the final state with a known one; if this is not available, the user can just supply `const True`)n", monadic version=Some useful combinatorsoApply a function over a range of integer indices, zip the result with it and filter out the almost-zero entries>", monadic version?%A combinator I don't know how to call@HelpersRelative residualA7Squared difference of a 2-element list. | NB: unsafe !BTRelative tolerance : relTol a b := ||a - b|| / (1 + min (||norm2 a||, ||norm2 b||))j Known valuem Calling function name ConfigurationState summary array projectionConvergence criterionDivergence criterion Final state acceptance criterionState evolution Initial state Final state&CDEFbcgfedGHIJKLhi<Mjklmn=>NO?@ABPQRSTCDFEbcdefgGLKJIHNone 345;<=FTPU)triangular sparse matrix, row-major orderRIntmap-of-sparse lists * fast random access of rows * fast consing of row elementsVGiven a lower triangular system L x = b, finds the nonzero entries of the solution vector x as the set of reachable nodes from the r.h.s. via the graph G(L^T). Node indices are _sorted_ afterwards, for a total complexity of O(N)W"Build the initial solution vector x= for the triangular solve, given a vector of nonzero indices ixnz. and the right hand side of the linear system bbf: -- 1. Initialize an empty mutable vector of length `length ixnz` to 0 -- 2. Copy the entries from bb to x.)Note: this assumes that the index set of bb& is strictly contained within that of x: (which is true for the case of the triangular solve, see V)X%`appendIM i x im` appends an element x3 to the i'th SList in an IntMap-of-SLists structureY$Nested lookup with default value = 0Z7LU factorization : store L and U^T in TriMatrix format Y row lookup in-row lookupZL, U[$updated U, i'th diagonal element Uii\'diagonal element of U (must be nonzero) updated L]^_U`abVWcdefghXYZi[\jklmnopqrs]_^U`aNone<FTWt`eigRayleigh n mm` performs n0 iterations of the Rayleigh algorithm on matrix mm and returns the eigenpair closest to the initialization. It displays cubic-order convergence, but it also requires an educated guess on the initial eigenpair.ukGolub-Kahan-Lanczos bidiagonalization (see "Restarted Lanczos Bidiagonalization for the SVD", SLEPc STR-8,  ,http://slepc.upv.es/documentation/manual.htm )tuNone<FTXevwxyz{|}~v w~}|{zyxNone +/;<=>?FTo$Iterative methods for linear systemspGeneralized Minimal RESidual q*Conjugate Gradient on the Normal EquationsrBiConjugate GradientsConjugate Gradient SquaredtBiConjugate Gradient Stabilized'A lumped constraint for numerical typesunMatrix condition number: computes the QR factorization and extracts the extremal eigenvalues from the R factorv!Householder reflection: a vector xw uniquely defines an orthogonal (hyper)plane, i.e. an orthogonal subspace; the Householder operator reflects any point v- through this subspace: v' = (I - 2 x >< x) vw3Givens matrix : a planar rotation embedded in R^n. aa = fromListSMg <- givens aa 1 0Row version of the method: given a matrix element below the diagonal, indexed (i,j), choose a row index i' that is below the diagonal as well and distinct from i such that the corresponding element is nonzero.To zero out entry A(i, j) we must find row i' such that A(i', j) is non-zero but A has zeros in row i' for all column indices < j.9NB: The Givens' matrix differs from Identity in 4 entriesANB2: The form of a Complex rotation matrix in R^2 is as follows ( indicates complex conjugation): - ( c s ) G =( ) ( -s* c*) 1Givens coefficients and norm of associated vectorxGiven a matrix A, returns a pair of matrices (Q, R) such that Q R = A, where Q is orthogonal and R is upper triangular. Applies Givens rotation iteratively to zero out sub-diagonal elements.NB: at each iteration i we multiply the Givens matrix G_i by the previous partial result M0. Since this corresponds to a rotation, and the Q function already computes the value of the resulting non-zero component (output r@), `G_i ## M` can be simplified by just updating two entries of M3 (i.e. zeroing one out and changing the other into r).%However, we must also accumulate the G_i in order to build Q>, and the present formulation follows this definition closely.y`eigsQR n mm` performs at most n* iterations of the QR algorithm on matrix mm4, and returns a SpVector containing all eigenvalues.z:`eigsArnoldi n aa b` computes at most n iterations of the Arnoldi algorithm to find a Krylov subspace of (A, b), denoted Q, along with a Hessenberg matrix of coefficients H. After that, it computes the QR decomposition of H, denoted (O, R) and the eigenvalues {_i} of A are listed on the diagonal of the R factor.{*Given a positive semidefinite matrix A, returns a lower-triangular matrix L such that L L^T = A . This is an implementation of the Cholesky Banachiewicz algorithm, i.e. proceeding row by row from the upper-left corner. | NB: The algorithm throws an exception if some diagonal element of A is zero.|Given a matrix A, returns a pair of matrices (L, U) where L is lower triangular and U is upper triangular such that L U = A . Implements the Doolittle algorithm, which sets the diagonal of the L matrix to ones and expects all diagonal entries of A to be nonzero. Apply pivoting (row or column permutation) to enforce a nonzero diagonal of the A matrix (the algorithm throws an appropriate exception otherwise).}4Given a matrix A, a vector b and a positive integer n-, this procedure finds the basis of an order n Krylov subspace (as the columns of matrix Q), along with an upper Hessenberg matrix H, such that A = Q^T H Q. At the i`th iteration, it finds (i + 1) coefficients (the i`th column of the Hessenberg matrix H) and the (i + 1)`th Krylov vector.~WPartition a matrix into strictly subdiagonal, diagonal and strictly superdiagonal partsAThe Jacobi preconditioner is just the reciprocal of the diagonal Used for Incomplete LU : remove entries in the output matrix corresponding to zero entries in the input matrix (this is called ILU(0) in the preconditioner literature)Symmetric Successive Over-Relaxation. `mSsor aa omega` : if `omega = 1` it returns the symmetric Gauss-Seidel preconditioner. When  = 1, the SOR reduces to Gauss-Seidel; when  > 1 and  < 1, it corresponds to over-relaxation and under-relaxation, respectively.GDirect solver based on a triangular factorization of the system matrix.Forward substitution solverBackward substitution solver&Given a linear system `A x = b` where AR is an (m x m) real-valued matrix, the GMRES method finds an approximate solution xhatI such that the Euclidean norm of the residual `A xhat - b` is minimized. xhat is spanned by the order-n Krylov subspace of (A, b). In this implementation: 1) the Arnoldi iteration is carried out until numerical breakdown (therefore yielding _at_most_ `m+1` Krylov basis vectors) 2) the resulting Hessenberg matrix H is factorized in QR form (H = Q R) 3) the Krylov-subspace solution yhato is found by backsubstitution (since R is upper-triangular) 4) the approximate solution in the original space xhat6 is computed using the Krylov basis, `xhat = Q_n yhat`A common optimization involves interleaving the QR factorization (and the subsequent triangular solve) with the Arnoldi process (and employing an updating QR factorization which only requires one Givens' rotation at every update). ALeast-squares approximation of a rectangular system of equations.-Interface method to individual linear solvers#<> uses the GMRES method as default xQ, RyMax. # of iterationsPrint debug information Operand matrixEigenvalues {_i}z Q, O, {_i}{L|L, U} System matrixr.h.s.Max. # of iterationsQ, H~/Subdiagonal, diagonal, superdiagonal partitionsL, U (with holes)relaxation factorLeft, right factorsLower triangularUpper triangularr.h.s.d &'(54KNRTYX`_]^\dihgkjlnq|~(./0HWXYZ[\bcdefghijklmnopqrstuvwxyz{|}~dTyzx|{}wuv~WYXZ\[&'(q|nXY\^]./0HRNK~ljkghid_(`45jklmnbcdefghiopqrst opqrst !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHI J KLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                                                                                             !"#$%&'()*+,-./0/123456789:;<=>?@ABCDEFGHIJKLMMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~~0sparse-linear-algebra-0.3-LcSxiEzyG6zGwAH0qhoUu4Control.Exception.Common Numeric.EpsNumeric.LinearAlgebra.SparseNumeric.LinearAlgebra.ClassData.Sparse.SpVectorData.Sparse.SpMatrixData.Sparse.Common$Data.Sparse.Internal.SVector.MutableData.Sparse.Internal.StreamData.Sparse.Internal.UtilsData.Sparse.TypesData.Sparse.UtilsData.Sparse.PPrintData.Sparse.Internal.SVectorData.Sparse.Internal.SListData.Sparse.Internal.IntMData.Sparse.Internal.IntMap2Control.IterativeData.Sparse.Internal.TriMatrix/Numeric.LinearAlgebra.EigenSolvers.Experimental0Numeric.LinearAlgebra.LinearSolvers.ExperimentalIterationException NotConvergedE DivergingEMatrixExceptionHugeConditionNumber NeedsPivotingOperandSizeMismatchDotSizeMismatchNonTriangularExceptionMatVecSizeMismatchExceptionOutOfBoundsIndexError OOBIxError OOBIxsErrorOOBNoCompatRows InputError NonNegErrorPartialFunctionError EmptyList checkIxBound$fExceptionPartialFunctionError$fShowPartialFunctionError$fExceptionInputError$fShowInputError $fExceptionOutOfBoundsIndexError$fShowOutOfBoundsIndexError$fExceptionOperandSizeMismatch$fShowOperandSizeMismatch$fExceptionMatrixException$fShowMatrixException$fExceptionIterationException$fShowIterationException$fEqPartialFunctionError$fEqInputError$fEqOutOfBoundsIndexError$fEqOperandSizeMismatch$fEqMatrixException$fEqIterationExceptionEpsilonnearZeronearOneisNz roundZeroroundOne roundZeroOne$fEpsilonComplex$fEpsilonComplex0$fEpsilonComplex1$fEpsilonComplex2$fEpsilonCDouble$fEpsilonCFloat$fEpsilonDouble$fEpsilonFloatprdprd0 SparseMatrix smFromVector smTransposeencodeIxdecodeIx SparseVectorSpvIx svFromListsvFromListDensesvConcat SpContainerScIxScElemscInsertscLookupscToList@@SetliftU2liftI2SparsespyHasDataHDDatannzdat FiniteDimFDSizedim LinearSystem<\>VLinearVectorSpace MatrixType#><# MatrixRing MatrixNorm####^#^# transpose normFrobeniusNormed Magnitude RealScalarnorm1norm2SqnormP normalize normalize2 normalize2'norm2norm2'norm InnerSpace<.> VectorSpaceScalar.* AdditiveGroupzeroV^+^negateV^-^EltEltMagconjmagdot./*.cvx hilbertDistSq normInftyR normInftyCdotLp reciprocalscaletoC $fEltComplex $fEltFloat $fEltDouble$fAdditiveGroupComplex$fAdditiveGroupComplex0$fAdditiveGroupDouble$fAdditiveGroupFloat$fVectorSpaceComplex$fVectorSpaceComplex0$fVectorSpaceDouble$fVectorSpaceFloat$fInnerSpaceComplex$fInnerSpaceComplex0$fInnerSpaceDouble$fInnerSpaceFloat$fNormedComplex$fNormedComplex0$fNormedDouble $fNormedFloatSpVectorSVsvDimsvDataspySVnzSV sizeStrSVfoldlWithKeySVfoldlWithKeySV'dotSdotSSafezeroSV singletonSVei mkSpVector mkSpVector1mkSpVRmkSpVCfromListDenseSVspVectorDenseIxspVectorDenseLoHi oneHotSVUoneHotSVonesSVzerosSVconstv fromVectortoVector toVectorDenseinsertSpVectorinsertSpVectorSafe fromListSVcreatevvrvctoListSV toDenseListSVifoldSVlookupSVlookupDefaultSV lookupDenseSVtailSVheadSVtakeSVdropSVrangeSVconcatSVfilterSV ifilterSV sparsifySV orthogonalSV$fNormedSpVector$fInnerSpaceSpVector$fVectorSpaceSpVector$fAdditiveGroupSpVector$fSpContainerSpVector$fSparseSpVector$fHasDataSpVector$fFiniteDimSpVector $fSetSpVector$fShowSpVector $fEqSpVector$fFunctorSpVector$fFoldableSpVectorMatProd_ABABtSMInfosmNzsmSpySpMatrixSMsmDimsmData sizeStrSMzeroSM mkDiagonaleye permutationSM permutPairsSM mkSubDiagonalinsertSpMatrix fromListSM' fromListSMmkSpMRmkSpMCfromListDenseSMtoListSM toDenseListSMlookupSM lookupWD_SM@@!filterSMextractSubDiagextractSuperDiag extractDiagextractSubmatrixSMextractSubmatrixRebalanceKeysextractSubmatrixtakeRowstakeCols extractColSMextractSubColSMextractSubColSM_RK isValidIxSM isSquareSM isDiagonalSM isLowerTriSM isUpperTriSMisOrthogonalSMimmSMdimSMnelSMnrowsncolsinfoSMnzSMspySMnzRowbwMinSMbwMaxSM bwBoundsSM vertStackSM-=- horizStackSM-||-fromBlocksDiag ifilterSMfoldlSMifoldlSMcountSubdiagonalNZSMsubdiagIndicesSM sparsifyIM2 sparsifySMroundZeroOneSM modifyKeysSM' modifyKeysSMswapRows swapRowsSafe transposeSM hermitianConjmatScaletracenormFrobeniusSMnormFrobeniusSMCmatMat_matMatUnsafeWithmatMatSparsified#~##~^##~#^ contractSub$fSpContainerSpMatrix$fSparseSpMatrix$fHasDataSpMatrix$fFiniteDimSpMatrix$fVectorSpaceSpMatrix$fAdditiveGroupSpMatrix $fSetSpMatrix$fShowSpMatrix$fMatrixRingSpMatrix$fMatrixRingSpMatrix0 $fEqSpMatrix$fFunctorSpMatrix$fFoldableSpMatrix $fEqSMInfo $fShowSMInfo $fEqMatProd_$fShowMatProd_ insertRowWith insertRow insertColWith insertCol outerProdSV>< diagonalSMsvToSMtoSV lookupRowSM extractRow extractColextractVectorDenseWithextractRowDenseextractColDenseextractDiagDense extractSubRowextractSubRow_RK extractSubColextractSubCol_RK fromRowsL fromColsLtoRowsLtoColsL fromColsV fromRowsV$fPrintDenseSpMatrix$fPrintDenseSpMatrix0$fPrintDenseSpVector$fPrintDenseSpVector0$fLinearVectorSpaceSpVectorIterationConfigIterConfnumIterationsMaxprintDebugInfo iterationView printDebugIO modifyUntil modifyUntilMuntilConvergedG0untilConvergedGuntilConvergedGMmodifyInspectGuardedmodifyInspectGuardedMLinSolveMethodGMRES_CGNE_BCG_CGS_ BICGSTAB_conditionNumberSMhhReflgivensqreigsQR eigsArnoldicholluarnoldidiagPartitionsluSolve triLowerSolve triUpperSolvepinv linSolve0 $fShowCGNE $fShowBCG $fShowCGS$fShowBICGSTAB$fLinearSystemSpVector$fEqCGNE$fEqBCG$fEqCGS $fEqBICGSTAB$fEqLinSolveMethod$fShowLinSolveMethodunionWithM_preallocSMVectorSMVsmvValsmvIxsmvDimfromListfromListOverwrite MergeState MergeStartMergeRightEndedMergeLeftEndedMergeRMergeLmergeStreamsWith0Stream intersectWith unionWithStepSkipYieldDonenumLoop numLoopST' numLoopST''intersectWithCompareunionWithComparesortWith sortWith3 sortByFst3 sortBySnd3fst3snd3third3tail3mapFst3mapSnd3 mapThird3lift2mergeStreamsWith isOrderedVLexOrd ColsFirst RowsFirstLexIxIxColIxRowColsRowsintersectWithD unionWithDlift2sndsafemaxTupminTupindexedindexed2foldrMap foldlStrictifoldrUBLBintersectWith0 unionWith0indexed'inBounds inBounds2 inBounds0 inBounds02head'tail'base Data.Complex magnitudeghc-prim GHC.Classes<=GHC.Numabs PPrintOptionsprdefRprdefCprintDNprintCN printNpadprepDprepCspacesPPOpts pprintLen pprintDecpprintColWidth PrintDensenewlineindex unionWithSMVSVectorsvValsvIx fromDenseintersectWithM unionWithMthawfreezebothheadTailSListsldotslsum$fAdditiveGroupSListSLunSLemptySLconsSLheadSLtoListl1l2IntMunIMemptysize singleton filterWithKeyinsertfilterIlookuplookupLT foldlWithKey foldlWithKey' mapWithKeykeysmapKeysunionfindMinfindMax!mkImmkImCGHC.Listtakedrop insertIM2 lookupIM2 lookupWD_IM fromListIM2 ifoldlIM2' ifoldlIM2foldlIM2 transposeIM2 ifilterIM2 filterSubdiagsubdiagIndicesmapIM2imapIM2 mapKeysIM2countSubdiagonalNZrpairs mapColumnIM2resizeSV mapKeysSVvecMatSD modifyUntil' onRangeSparseonRangeSparseMcombxrelResdiffSqLrelTolSunS2unS1ConvergenceStatus NotConverged Diverging Converged ConvergingBufferNotReady modifyUntilM' unfoldZipM0 unfoldZipMqdiverg norm2DiffliftS1s0ic1 TriMatrixreachableFromRHSinitializeSolnappendIMlookupWDuSteplStepTBranchLeafTMunTM flattenForesttlUpdateSubdiagg0t0g1 emptyIMSLemptyTMluConfigfillSMtesttm0tm2tm4tm9tmc4nextnext'labelElt eigRayleigh gklBidiagTFQMR _alphaTfq_rhoTfq_etaTfq _thetaTfq_tauTfq_mTfq_dTfq_vTfq_uTfq_wTfq_xTfq tfqmrInit tfqmrStepNum'* givensCoef jacobiPreilu0PremSsorPregmresBICGSTAB _xBicgstab _rBicgstab _pBicgstabCGS_x_r_p_uBCG_xBcg_rBcg_rHatBcg_pBcg_pHatBcgCGNE_xCgne_rCgne_pCgne