úÎwBqËX      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVW Safe-Infered5Sparse vector is just indexed map of non-zero values "real size of vector (with zeroes) IntMap storing non-zero values  Type of internal vector storage Dot product of two Xs (for internal use) 6Shifts (re-enumerates) keys of IntMap by given number CAdds element to the map at given index, shifting all keys after it FDeletes element of the map at given index, shifting all keys after it DSplits map using predicate and returns a pair with filtered map and ( re-enumereted second part (that doesn'#t satisfy predicate). For example: ?partitionMap (>0) (fromList [(1,1),(2,-1),(3,-2),(4,3),(5,-4)]);( fromList [(1,1),(4,3)], fromList [(1,-1),(2,-2),(3,-4)] )  Sets vector's size #Vector of zero size with no values -Vector of given size with no non-zero values 8Checks if vector has no non-zero values (i.e. is empty) 8Checks if vector has no non-zero values (i.e. is empty) $Vector of length 1 with given value This is like cons (:) operator for lists. x .> v = singVec x <> vJSplits vector using predicate and returns a pair with filtered values and ( re-enumereted second part (that doesn'#t satisfy predicate). For example: 9partitionVec (>0) (sparseList [0,1,-1,2,3,0,-4,5,-6,0,7])=( sparseList [0,1,0,2,3,0,0,5,0,0,7], sparseList [-1,-4,-6] )CLooks up an element in the vector (if not found, zero is returned) >Deletes element of vector at given index (size of vector doesn' t change) ,Returns plain list with all zeroes restored >Converts plain list to sparse vector, throwing out all zeroes "Dot product of two sparse vectors Unicode alias for  Y2Shows size and filled vector (but without zeroes) ZMonoid [4 operation works like concatenation of two vectors 6 (indexes of second are shifted by length of first) \] operators like (*), (+) and (-) work on sparse vectors  like ^ ( &)2 works on lists, except size of result is maximum  of arguments sizes. _, ` and a work through b , so usual ] laws  are satisfied (such as (signum v)*(abs v) == v. c/ constructs a vector with single element. So, 3 + (sparseList [0,2,1])sparseList [3,2,1]d.fold functions are applied to non-zero values eb2 applies given function on vector non-zero values ! YZ\de    YZ\de Safe-Infered-0Sparse matrix is indexed map of non-zero rows, 'real height and width of filled matrix /IntMap (IntMap ±) representing non-zero values Internal storage of matrix !Matrix real height and width "Matrix real height and width # Sets height and width of matrix $#Matrix of zero size with no values %Zero matrix of given size &8Checks if matrix has no non-zero values (i.e. is empty) '8Checks if matrix has no non-zero values (i.e. is empty) (Identity matrix of given size )8Adds row at given index, increasing matrix height by 1 ! and shifting indexes after it *:Adds column at given index, increasing matrix width by 1 ! and shifting indexes after it +"Just adds zero row at given index ,%Just adds zero column at given index -;Deletes row at given index, decreasing matrix height by 1 ! and shifting indexes after it .=Deletes column at given index, decreasing matrix width by 1 ! and shifting indexes after it /(Deletes row and column at given indexes 0WARNING: doesn't work with empty rows :Partitions matrix, using pedicate on rows and returns two new matrices, Q one constructed from rows satisfying predicate, and another from rows that don't 7CLooks up an element in the matrix (if not found, zero is returned) 8%Returns row of matrix at given index 9(Returns column of matrix at given index :+Updates values in row using given function ;@Fills row with zeroes (i.e. deletes it, but size of matrix doesn' t change) <%Erases matrix element at given index =>Inserts new element to the sparse matrix (replaces old value) >qFinds indices of rows, that satisfy given predicate. Searches from left to right (in ascending order of indices) ?rFinds indices of rows, that satisfy given predicate. Searches from right to left (in descending order of indices) @9Constructs square matrix with given elements on diagonal A!Collects main diagonal of matrix B&Constructs matrix from a list of rows C,Converts sparse matrix to associative list, F adding fake zero element, to save real size for inverse conversion D,Converts associative list to sparse matrix, & using maximal index as matrix size EEConverts sparse matrix to plain list-matrix with all zeroes restored FEConverts plain list-matrix to sparse matrix, throwing out all zeroes I(Transposes matrix (rows become columns) J Matrix-by-vector multiplication KUnicode alias for J L Vector-by-matrix multiplication MUnicode alias for L NSparse matrices multiplication OUnicode alias for N f2Shows size and filled matrix (but without zeroes) gb/ applies given function on all non-zero values 7 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOfhg4 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNO4 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNO4 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOfhg Safe-InferedPStaircase Form of matrix. :It uses an identity matrix as initial protocol matrix for Q. 'It returns also transformation matrix: (let (s, t) = staircase m in t × m == sTrue Usage of i causes j context. (TODO: eliminate it) Method: C Gauss method applied to the rows of matrix. Though ± may be not C a field, we repeat the remainder division to obtain zeroes down  in the column. QStaircase Form of matrix. CIt takes matrix itself and initial protocol matrix and applies all E transformations to both of them in the same way, and then returns = matrix in the staircase form and a transformation matrix.  Usage of i causes j context. (TODO: eliminate it) Method: C Gauss method applied to the rows of matrix. Though ± may be not C a field, we repeat the remainder division to obtain zeroes down  in the column. RFills column with zeroes SExtended Euclid algorithm PQR+row index (clears column beneath this row)  column index matrix itself protocol matrix *result matrix and changed protocol matrix SPQRSPQRSPQRS Safe-InferedT#Checks if matrix has diagonal form UKTransforms matrix to diagonal form and returns also two protocol matrices: 1let (d,t,u) = toDiag m in t × m × (trans u) == dTrueSo, t! stores rows transformations and u  columns transformations TUTUTUTU Safe-InferedV7Just solves system of linear equations in matrix form 4 for given left-side matrix and right-side vector WSolves a system in form: 4x3 3x5 4x5[ ] [ ] [ ][ m ] × [ x ] = [ b ][ ] [ ] [ ][ ] [ ]solveLinSystems m b returns solution matrix x VWVWVWVW Safe-InferedPQRSTUVW Safe-InferedX  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWk      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefgheijekleimeineioepqeirstuvwexyexz{sparse-lin-alg-0.3 Math.LinearAlgebra.Sparse.Vector Math.LinearAlgebra.Sparse.Matrix.Math.LinearAlgebra.Sparse.Algorithms.Staircase-Math.LinearAlgebra.Sparse.Algorithms.Diagonal0Math.LinearAlgebra.Sparse.Algorithms.SolveLinear$Math.LinearAlgebra.Sparse.AlgorithmsMath.LinearAlgebra.Sparse SparseVectorSVdimvecSVecIndex·· shiftKeysaddElemdelElem partitionMap setLengthemptyVeczeroVec isZeroVec isNotZeroVecsingVec.> partitionVec! eraseInVecvecInsfillVec sparseListshowSparseList showNonZerodot· SparseMatrixSMdimsmxSMxheightwidthsetSizeemptyMxzeroMxisZeroMx isNotZeroMxidMxaddRowaddCol addZeroRow addZeroColdelRowdelCol delRowCol partitionMx separateMxpopRow|><| replaceRow exchangeRows#rowcolupdRoweraseRoweraseinsfindRowIndicesfindRowIndicesR diagonalMxmainDiagfromRows toAssocList fromAssocListfillMxsparseMxshowSparseMatrixcolumntransmulMV×·mulVM·×mul× staircase staircase' clearColumnextGCDisDiagtoDiag solveLinearsolveLinSystemscontainers-0.4.2.1 Data.IntMapIntMap$fShowSparseVector$fMonoidSparseVectorbase Data.Monoidmappend$fNumSparseVectorGHC.NumNumGHC.ListzipWithsignumabsnegateGHC.Basefmap fromInteger$fFoldableSparseVector$fFunctorSparseVector$fShowSparseMatrix$fFunctorSparseMatrix$fNumSparseMatrixGHC.RealdivModIntegral