úÎ…­‚X*      !"#$%&'()None/Type of matrices. Number of rows. Number of columns. *)Content of the matrix as a plain vector. +0Just a cool way to output the size of a matrix. Display a matrix as a , using the - instance of its elements.  O(rows*cols) . Similar to ., drop any extra memory. Useful when using  from a big matrix.  O(rows*cols). Map a function over a row.  Example: 0 ( 1 2 3 ) ( 1 2 3 ) 0 ( 4 5 6 ) ( 5 6 7 ) 0 mapRow (\_ x -> x + 1) 2 ( 7 8 9 ) = ( 7 8 9 )  O(rows*cols) . Map a function over a column.  Example: 0 ( 1 2 3 ) ( 1 3 3 ) 0 ( 4 5 6 ) ( 4 6 6 ) 0 mapCol (\_ x -> x + 1) 2 ( 7 8 9 ) = ( 7 9 9 )  O(rows*cols)%. The zero matrix of the given size.  zero n m =  n  1 ( 0 0 ... 0 0 )  2 ( 0 0 ... 0 0 )  ( ... )  ( 0 0 ... 0 0 )  n ( 0 0 ... 0 0 )  O(rows*cols)/. Generate a matrix from a generator function.  Example of usage: 2 ( 1 0 -1 -2 ) 2 ( 3 2 1 0 ) 2 ( 5 4 3 2 ) 2 matrix 4 4 $ \(i,j) -> 2*i - j = ( 7 6 5 4 )  O(rows*cols)&. Identity matrix of the given order.  identity n =  n  1 ( 1 0 ... 0 0 )  2 ( 0 1 ... 0 0 )  ( ... )  ( 0 0 ... 1 0 )  n ( 0 0 ... 0 1 ) >Create a matrix from a non-empty list given the desired size.  The list must have at least  rows*cols elements.  An example: ! ( 1 2 3 ) ! ( 4 5 6 ) ! fromList 3 3 [1..] = ( 7 8 9 ) ;Create a matrix from an non-empty list of non-empty lists.  /Each list must have the same number of elements.  For example: $ fromLists [ [1,2,3] ( 1 2 3 ) $ , [4,5,6] ( 4 5 6 ) $ , [7,8,9] ] = ( 7 8 9 ) O(1)*. Represent a vector as a one row matrix. O(1)-. Represent a vector as a one column matrix.  O(rows*cols). Permutation matrix.   permMatrix n i j =  i j n ! 1 ( 1 0 ... 0 ... 0 ... 0 0 ) ! 2 ( 0 1 ... 0 ... 0 ... 0 0 ) ! ( ... ... ... ) ! i ( 0 0 ... 0 ... 1 ... 0 0 ) ! ( ... ... ... ) ! j ( 0 0 ... 1 ... 0 ... 0 0 ) ! ( ... ... ... ) ! ( 0 0 ... 0 ... 0 ... 1 0 ) ! n ( 0 0 ... 0 ... 0 ... 0 1 ) When i == j it reduces to   n. O(1). Get an element of a matrix. Short alias for . Safe variant of . O(cols)%. Get a row of a matrix as a vector. O(rows)(. Get a column of a matrix as a vector. O(min rows cols). Diagonal of a not necessarily square matrix. O(1)+. Replace the value of a cell in a matrix.  O(rows*cols). The transpose of a matrix.  Example: ! ( 1 2 3 ) ( 1 4 7 ) ! ( 4 5 6 ) ( 2 5 8 ) ! transpose ( 7 8 9 ) = ( 3 6 9 ) /Extend a matrix to a given size adding zeroes. A If the matrix already has the required size, nothing happens.  The matrix is never reduced in size.  Example: ( ( 1 2 3 0 0 ) ( ( 1 2 3 ) ( 4 5 6 0 0 ) ( ( 4 5 6 ) ( 7 8 9 0 0 ) ( extendTo 4 5 ( 7 8 9 ) = ( 0 0 0 0 0 ) O(subrows*subcols)3. Extract a submatrix given row and column limits.  Example:  ( 1 2 3 ) ' ( 4 5 6 ) ( 2 3 ) ' submatrix 1 2 2 3 ( 7 8 9 ) = ( 5 6 )  O(rows*cols)+. Remove a row and a column from a matrix.  Example:  ( 1 2 3 ) % ( 4 5 6 ) ( 1 3 ) % minorMatrix 2 2 ( 7 8 9 ) = ( 7 9 ) GMake a block-partition of a matrix using a given element as reference. S The element will stay in the bottom-right corner of the top-left corner matrix.  3 ( ) ( | ) 3 ( ) ( ... | ... ) 3 ( x ) ( x | ) G splitBlocks i j ( ) = (-------------) , where x = a_{i,j} 3 ( ) ( | ) 3 ( ) ( ... | ... ) 3 ( ) ( | ) XNote that some blocks can end up empty. We use the following notation for these blocks:   ( TL | TR )  (---------)  ( BL | BR ) 0Where T = Top, B = Bottom, L = Left, R = Right. /Implementation is done via slicing of vectors. $Join blocks of the form detailed in . *Horizontally join two matrices. Visually:   ( A ) <|> ( B ) = ( A | B ) Where both matrices A and B have the same number of rows.  This condition is not checked. (Vertically join two matrices. Visually:   ( A )  ( A ) <-> ( B ) = ( - )  ( B ) Where both matrices A and B" have the same number of columns.  This condition is not checked. .Standard matrix multiplication by definition. /OStandard matrix multiplication by definition, without checking if sizes match. 0Strassen'*s algorithm over square matrices of order 2^n. Strassen's matrix multiplication. 1Strassen's mixed algorithm. Mixed Strassen's matrix multiplication. !"Scale a matrix by a given factor.  Example: ( ( 1 2 3 ) ( 2 4 6 ) ( ( 4 5 6 ) ( 8 10 12 ) ( scaleMatrix 2 ( 7 8 9 ) = ( 14 16 18 ) "Scale a row by a given factor.  Example: ' ( 1 2 3 ) ( 1 2 3 ) ' ( 4 5 6 ) ( 8 10 12 ) ' scaleRow 2 2 ( 7 8 9 ) = ( 7 8 9 ) #/Add to one row a scalar multiple of other row.  Example: , ( 1 2 3 ) ( 1 2 3 ) , ( 4 5 6 ) ( 6 9 12 ) , combineRows 2 2 1 ( 7 8 9 ) = ( 7 8 9 ) $Switch two rows of a matrix.  Example: & ( 1 2 3 ) ( 4 5 6 ) & ( 4 5 6 ) ( 1 2 3 ) & switchRows 1 2 ( 7 8 9 ) = ( 7 8 9 ) %Matrix LU decomposition with partial pivoting.  The result for a matrix M is given in the format  (U,L,P,d) where:  U is an upper triangular matrix.  L is an unit lower triangular matrix.  P is a permutation matrix.  d is the determinant of P.  PM = LU. JThese properties are only guaranteed when the input matrix is invertible. P An additional property matches thanks to the strategy followed for pivoting:  L_(i,j) < = 1, for all i,j. JThis follows from the maximal property of the selected pivots, which also ; leads to a better numerical stability of the algorithm.  Example: = ( 1 2 0 ) ( 2 0 2 ) ( 1 0 0 ) ( 0 0 1 ) = ( 0 2 1 ) ( 0 2 -1 ) ( 1/2 1 0 ) ( 1 0 0 ) C luDecomp ( 2 0 2 ) = ( ( 0 0 2 ) , ( 0 1 1 ) , ( 0 1 0 ) , 1 ) &.Sum of the elements in the diagonal. See also .  Example:  ( 1 2 3 )  ( 4 5 6 )  trace ( 7 8 9 ) = 15 '2Product of the elements in the diagonal. See also .  Example:  ( 1 2 3 )  ( 4 5 6 )  diagProd ( 7 8 9 ) = 45 (,Matrix determinant using Laplace expansion.  If the elements of the  are instance of 2 and 3  consider to use )( in order to obtain better performance. )+Matrix determinant using LU decomposition. <4*56+:Function takes the current column as additional argument.  Row to map. 7Function takes the current row as additional argument. Column to map. Rows Columns Rows Columns Generator function Rows Columns List of elements Size of the matrix. Permuted row 1. Permuted row 2. Permutation matrix. Row Column Matrix 7 New value. Position to replace. Original matrix. >Matrix with the given position replaced with the given value. Minimal number of rows. Minimal number of columns.  Starting row  Ending row Starting column Ending column Row r to remove. Column c to remove. Original matrix. Matrix with row r and column c removed. Row of the splitting element. !Column of the splitting element. Matrix to split. (TL,TR,BL,BR) /8091 !"#$Row 1. Row 2. Original matrix. #Matrix with rows 1 and 2 switched. %:U L P d  Current row  Total rows &'();<=>?@*  !"#$%&'(),   !"#$%&'()84*56+ 7/8091 !"#$%:&'();<=>?@A      !"#$%&'()*+,-./0.123456789:;.<=>?@ABCDEFGHIJK matrix-0.2.2 Data.MatrixMatrixnrowsncols prettyMatrix forceMatrixmapRowmapColzeromatrixidentityfromList fromLists rowVector colVector permMatrixgetElem!safeGetgetRowgetColgetDiagsetElem transposeextendTo submatrix minorMatrix splitBlocks joinBlocks<|><->multStd multStrassenmultStrassenMixed scaleMatrixscaleRow combineRows switchRowsluDecomptracediagProd detLaplacedetLUmvectsizeStrbaseGHC.BaseStringGHC.ShowShowvector-0.10.9.1 Data.VectorforcemultStd_strassen strassenMixedghc-prim GHC.ClassesOrdGHC.Real FractionalMencodedecodemsetElemfirst strmixFactor recLUDecomp $fNumMatrix$fTraversableMatrix$fFoldableMatrix$fFunctorMatrix$fNFDataMatrix $fShowMatrix