b5      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwx y z { | } ~        !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~            !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" " " " " """"""""""""""""""" "!"""#"$"%"&"'"(")"*"+","-"."/"0"1"2"3"4"5"6"7"8"9":#;$<$=%>%?&@&A&BCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_'`'a'b'c'd'e'f'g'h'i'j(k(l(m(n(o(p(q(r(s(t(u(v)w*x*y*z*{*|*}*~+++++++++++++++++++++++++++,,,,,,,,,---------------------------------------------.......///000000000001=2portable (uses FFI) provisionalAlberto Ruiz <aruiz@um.es>""3portable (uses FFI) provisionalAlberto Ruiz <aruiz@um.es>description of GSL error codes clear the fpu  partit 3 [1..9] == [[1,2,3],[4,5,6],[7,8,9]] 1obtains the common value of a property of a list  postfix function application (flip ($))  specialized fromIntegral  Aerror codes for the auxiliary functions required by the wrappers check the error code          4portable (uses FFI) provisionalAlberto Ruiz <aruiz@um.es>HA one-dimensional array of objects stored in a contiguous memory block. number of elements $foreign pointer to the memory block creates a Vector from a list: > fromList [2,3,5,7] 4 |> [2.0,3.0,5.0,7.0] 'extracts the Vector elements to a list > toList (linspace 5 (1,10)) [1.0,3.25,5.5,7.75,10.0] An alternative to  $ with explicit dimension. The input F list is explicitly truncated if it is too long, so it may safely 1 be used, for instance, with infinite lists. >This is the format used in the instances for Show (Vector a). 1access to Vector elements without range checking /access to Vector elements with range checking. 5takes a number of consecutive elements from a Vector  > subVector 2 3 (fromList [1..10]) 3 |> [3.0,4.0,5.0] Reads a vector position: > fromList [0..9] @> 7 7.02creates a new Vector by joining a list of Vectors > join [fromList [1..5], constant 1 3] %8 |> [1.0,2.0,3.0,4.0,5.0,1.0,1.0,1.0]Ztransforms a complex vector into a real vector with alternating real and imaginary parts Ytransforms a real vector into a complex vector with alternating real and imaginary parts map on Vectors zipWith for Vectors ULoads a vector from an ASCII file (the number of elements must be known in advance). TSaves the elements of a vector, with a given format (%f, %e, %g), to an ASCII file. ULoads a vector from a binary file (the number of elements must be known in advance). 1Saves the elements of a vector to a binary file.     5portable (uses FFI) provisionalAlberto Ruiz <aruiz@um.es>Auxiliary class. @Matrix representation suitable for GSL and LAPACK computations. Matrix transpose. !*Creates a vector by concatenation of rows > flatten (ident 3) )9 |> [1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0]"the inverse of Data.Packed.Matrix.fromLists #(creates a Matrix from a list of vectors $3extracts the rows of a matrix as a list of vectors %4Creates a matrix from a list of vectors, as columns &7Creates a list of vectors from the columns of a matrix 'Reads a matrix position. )Creates a matrix from a vector by grouping the elements in rows with the desired number of columns. (GNU-Octave groups by columns. To do it you can define reshapeF r = trans . reshape r (where r is the desired number of rows.) > reshape 4 (  [1..12]) (3><4)  [ 1.0, 2.0, 3.0, 4.0  , 5.0, 6.0, 7.0, 8.0  , 9.0, 10.0, 11.0, 12.0 ]*Bapplication of a vector function on the flattened matrix elements +Dapplication of a vector function on the flattened matrices elements ,$Extracts a submatrix from a matrix. 2obtains the complex conjugate of a complex vector Dcreates a complex vector from vectors with real and imaginary parts the inverse of  -"Saves a matrix as 2D ASCII table. & !"#$ %!"#$%&'&()'*+,-#  #!$"!"#$ !"#$%&'()*+,-6portable provisionalAlberto Ruiz <aruiz@um.es>n       !"#$ %!"#$%&'&()'*+,-7(Vconversion of Haskell functions into function pointers that can be used in the C side )*(+,-./)*(+,-8uses ffi provisional!Alberto Ruiz (aruiz at um dot es)0access to a sf_result 1access to sf_result_e10 23./01401 23.10//01401portable provisionalAlberto Ruiz <aruiz@um.es> (( portable provisionalAlberto Ruiz <aruiz@um.es>23456789:;<=>?@ABCDEFGHIJKLM3@4;6=>9:2MAICJKFG?785<LDEBH23456789:;<=>?@ABCDEFGHIJKLMportable provisionalAlberto Ruiz <aruiz@um.es>N2Creates a StorableArray indexed from 0 to dim -1. T (Memory is efficiently copied, so you can then freely modify the obtained array) O'Creates a Vector from a StorableArray. ` (Memory is efficiently copied, so posterior changes in the array will not affect the result) PCcreates an immutable Array from an hmatrix Vector (to do: unboxed) Q@creates a mutable array from an hmatrix Vector (to do: unboxed) Sbcreates a mutable Array from an hmatrix Vector for manipulation with runSTUArray (to do: unboxed) NOPQRSTUVW PRQSNOUTVW NOPQRSTUVWuses ffi provisional!Alberto Ruiz (aruiz at um dot es)XYZ[\]^_`abcdeXYZ[\]^_`abcdeXYZ[\]^_`abcdeuses ffi provisional!Alberto Ruiz (aruiz at um dot es)fghijklmnopqrstuvwfghijklmnopqrstuvwfghijklmnopqrstuvw uses ffi provisional!Alberto Ruiz (aruiz at um dot es)xyz{|}~xyz{|}~xyz{|}~ uses ffi provisional!Alberto Ruiz (aruiz at um dot es) uses ffi provisional!Alberto Ruiz (aruiz at um dot es) uses ffi provisional!Alberto Ruiz (aruiz at um dot es) uses ffi provisional!Alberto Ruiz (aruiz at um dot es)uses ffi provisional!Alberto Ruiz (aruiz at um dot es)%%%uses ffi provisional!Alberto Ruiz (aruiz at um dot es)uses ffi provisional!Alberto Ruiz (aruiz at um dot es)uses ffi provisional!Alberto Ruiz (aruiz at um dot es)uses ffi provisional!Alberto Ruiz (aruiz at um dot es)uses ffi provisional!Alberto Ruiz (aruiz at um dot es)uses ffi provisional!Alberto Ruiz (aruiz at um dot es)               uses ffi provisional!Alberto Ruiz (aruiz at um dot es)uses ffi provisional!Alberto Ruiz (aruiz at um dot es) !"#$%&'()*+,-./ !"#$%&'()*+,-./ !"#$%&'()*+,-./uses ffi provisional!Alberto Ruiz (aruiz at um dot es)012012012uses ffi provisional!Alberto Ruiz (aruiz at um dot es)343434uses ffi provisional!Alberto Ruiz (aruiz at um dot es) 56789:;<=>?@ 56789:;<=>?@ 56789:;<=>?@uses ffi provisional!Alberto Ruiz (aruiz at um dot es)ABABABuses ffi provisional!Alberto Ruiz (aruiz at um dot es)CDEFGHIJCDEFGHIJCDEFGHIJuses ffi provisional!Alberto Ruiz (aruiz at um dot es)KLMNOKLMNOKLMNOuses ffi provisional!Alberto Ruiz (aruiz at um dot es)PQPQPQuses ffi provisional!Alberto Ruiz (aruiz at um dot es)XRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~XRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~XRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~uses ffi provisional!Alberto Ruiz (aruiz at um dot es)uses ffi provisional!Alberto Ruiz (aruiz at um dot es)./01.10/ uses ffi provisional!Alberto Ruiz (aruiz at um dot es)   !uses ffi provisional!Alberto Ruiz (aruiz at um dot es)(((9uses ffi provisional!Alberto Ruiz (aruiz at um dot es)./01XYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~"portable (uses FFI) provisionalAlberto Ruiz <aruiz@um.es>  >normal distribution with mean zero and standard deviation one  uniform distribution in [0,1) 2Vobtains different functions of a vector: norm1, norm2, max, min, posmax, posmin, etc. 3(map of real vectors with given function 4+map of complex vectors with given function 5(map of real vectors with given function 6+map of complex vectors with given function 7&elementwise operation on real vectors 8)elementwise operation on complex vectors 9Obtains a vector of pseudorandom elements from the the mt19937 generator in GSL, with a given seed. Use randomIO to get a random seed. 2      !"#$%&'()*+,-./01234567892   2 10/.-,+*)('&%$#"!345678  92          10/.-,+*)('&%$#"!!"#$%&'()*+,-./0123456789#uses ffi provisional!Alberto Ruiz (aruiz at um dot es):0Solution of general polynomial equations, using gsl_poly_complex_solve. For example, ( the three solutions of x^3 + 8 = 0  > polySolve [8,0,0,1] [(-1.9999999999999998) :+ 0.0,  1.0 :+ 1.732050807568877,  1.0 :+ (-1.732050807568877)]@The example in the GSL manual: To find the roots of x^5 -1 = 0: > polySolve [-1, 0, 0, 0, 0, 1] .[(-0.8090169943749475) :+ 0.5877852522924731, 0(-0.8090169943749475) :+ (-0.5877852522924731), +0.30901699437494734 :+ 0.9510565162951536, .0.30901699437494734 :+ (-0.9510565162951536),  1.0 :+ 0.0]:::$uses ffi provisional!Alberto Ruiz (aruiz at um dot es);Fast 1D Fourier transform of a  (5:; 6<=) using gsl_fft_complex_forward6. It uses the same scaling conventions as GNU Octave. > fft (  [1,2,3,4]) Dvector (4) [10.0 :+ 0.0,(-2.0) :+ 2.0,(-2.0) :+ 0.0,(-2.0) :+ (-2.0)]<The inverse of ;$, using gsl_fft_complex_inverse. ;<;<;<%uses ffi provisional!Alberto Ruiz (aruiz at um dot es)7Vconversion of Haskell functions into function pointers that can be used in the C side =Numerical integration using gsl_integration_qags9 (adaptive integration with singularities). For example: >% let quad = integrateQAGS 1E-9 1000 ># let f a x = x**(-0.5) * log (a*x) > quad (f 1) 0 1 *(-3.999999999999974,4.871658632055187e-13)>Numerical integration using gsl_integration_qngA (useful for fast integration of smooth functions). For example: > let quad = integrateQNG 1E-6 > quad (\x -> 4/(1+x*x)) 0 1 )(3.141592653589793,3.487868498008632e-14)=>>==>&uses ffi provisional!Alberto Ruiz (aruiz at um dot es)8Vconversion of Haskell functions into function pointers that can be used in the C side ?'Adaptive central difference algorithm, gsl_deriv_central. For example: " > let deriv = derivCentral 0.01  > deriv sin (pi/4) ,(0.7071067812000676,1.0600063101654055e-10)  > cos (pi/4) 0.7071067811865476 @'Adaptive forward difference algorithm, gsl_deriv_forwardX. The function is evaluated only at points greater than x, and never at x itself. The derivative is returned in result and an estimate of its absolute error is returned in abserr. This function should be used if f(x) has a discontinuity at x, or is undefined for values less than x. A backward derivative can be obtained using a negative step. A(Adaptive backward difference algorithm, gsl_deriv_backward. ?@A?@A?@Aportable provisionalAlberto Ruiz <aruiz@um.es>B4Creates a real vector containing a range of values: > linspace 5 (-3,7) 5 |> [-3.0,-0.5,2.0,4.5,7.0]G:creates a vector with a given number of equal components: > constant 2 7 !7 |> [2.0,2.0,2.0,2.0,2.0,2.0,2.0] BCDEFG  GBCDEFBCDEFGportable provisionalAlberto Ruiz <aruiz@um.es>92creates a matrix from a vertical list of matrices :4creates a matrix from a horizontal list of matrices HCCreates a matrix from blocks given as a list of lists of matrices: > let a = K $   [5,7,2] > let b = ) 4 $ G (-1) 12 > fromBlocks [[a,b],[b,a]] (6><7) , [ 5.0, 0.0, 0.0, -1.0, -1.0, -1.0, -1.0 , , 0.0, 7.0, 0.0, -1.0, -1.0, -1.0, -1.0 , , 0.0, 0.0, 2.0, -1.0, -1.0, -1.0, -1.0 , , -1.0, -1.0, -1.0, -1.0, 5.0, 0.0, 0.0 , , -1.0, -1.0, -1.0, -1.0, 0.0, 7.0, 0.0 , , -1.0, -1.0, -1.0, -1.0, 0.0, 0.0, 2.0 ]IReverse rows JReverse columns K/Creates a square matrix with a given diagonal. L&creates a rectangular diagonal matrix /> diagRect (constant 5 3) 3 4 :: Matrix Double (3><4)  [ 5.0, 0.0, 0.0, 0.0  , 0.0, 5.0, 0.0, 0.0  , 0.0, 0.0, 5.0, 0.0 ]M0extracts the diagonal from a rectangular matrix N/creates the identity matrix of given dimension O An easy way to create a matrix:  > (2><3)[1..6] (2><3)  [ 1.0, 2.0, 3.0  , 4.0, 5.0, 6.0 ]GThis is the format produced by the instances of Show (Matrix a), which can also be used for input. 7The input list is explicitly truncated, so that it can Csafely be used with lists that are too long (like infinite lists).  Example: > (2>|<3)[1..] (2><3)  [ 1.0, 2.0, 3.0  , 4.0, 5.0, 6.0 ]P9Creates a matrix with the first n rows of another matrix Q4Creates a copy of a matrix without the first n rows R<Creates a matrix with the first n columns of another matrix S7Creates a copy of a matrix without the first n columns T Creates a , from a list of lists (considered as rows). > fromLists [[1,2],[3,4],[5,6]] (3><2)  [ 1.0, 2.0  , 3.0, 4.0  , 5.0, 6.0 ]U%creates a 1-row matrix from a vector V(creates a 1-column matrix from a vector XZCreates a string from a matrix given a separator and a function to show each entry. Using Gthis function the user can easily define any desired display function:  import Text.Printf(printf) disp = putStrLn . format " " (printf "%.2f")Y<reads a matrix from a string containing a table of numbers. Z=obtains the number of rows and columns in an ASCII data file  (provisionally using unix's wc). [;Loads a matrix from an ASCII file formatted as a 2D table. \]Loads a matrix from an ASCII file (the number of rows and columns must be known in advance). ]Urearranges the rows of a matrix according to the order given in a list of integers. ^Lcreates matrix by repetition of a matrix a given number of rows and columns (> repmat (ident 2) 2 3 :: Matrix Double (4><6)  [ 1.0, 0.0, 1.0, 0.0, 1.0, 0.0  , 0.0, 1.0, 0.0, 1.0, 0.0, 1.0  , 1.0, 0.0, 1.0, 0.0, 1.0, 0.0  , 0.0, 1.0, 0.0, 1.0, 0.0, 1.0 ](!"#$%&')*+,-HIJKLMNOPQRSTUVWXYZ[\]^,O)!T"'UV#$%&H^IJ,PQRS]NKLM*+X[-\ZYWHIJKLMNOPQRSTUVWXYZ[\]^'uses ffi provisional!Alberto Ruiz (aruiz at um dot es)h"Minimization without derivatives. iMinimization with derivatives. _`abcdefg;<=hi hegfi_dcba` _dcba``abcdegffghi(uses ffi provisional!Alberto Ruiz (aruiz at um dot es)tNNonlinear multidimensional root finding using algorithms that do not require 8 any derivative information to be supplied by the user. @ Any derivatives needed are approximated by finite differences. uUNonlinear multidimensional root finding using both the function and its derivatives. jklmnopqrstu tosrqpujnmlk jnmlkklmnosrqppqrstu)uses -fffi and -fglasgow-exts provisional!Alberto Ruiz (aruiz at um dot es)vVThis action removes the GSL default error handler (which aborts the program), so that N GSL errors can be handled by Haskell (using Control.Exception) and ghci doesn' t abort. >?@ABCDEF5./01XYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~:;<=>?@A_`abcdefg;<=hijklmnopqrstuvvv*uses ffi provisional!Alberto Ruiz (aruiz at um dot es)wconversion utilities GQconverts a real vector into a complex representation (with zero imaginary parts) P>?@ABCDEF5 !"#$%&')*+,-BCDEFGHIJKLMNOPQRSTUVWXYZ[\]^wxyz{|}wxyz{|}wxyz{|}xyz{|}+portable (uses FFI) provisional!Alberto Ruiz (aruiz at um dot es)~Matrix product based on BLAS's dgemm. Matrix product based on BLAS's zgemm. Wrapper for LAPACK's dgesvd>, which computes the full svd decomposition of a real matrix. (u,s,v)=full svdR m so that m=u <> s <>  v. Wrapper for LAPACK's dgesvd>, which computes the full svd decomposition of a real matrix. (u,s,v)=full svdRdd m so that m=u <> s <>  v. Wrapper for LAPACK's zgesvdA, which computes the full svd decomposition of a complex matrix. (u,s,v)=full svdC m so that m=u <> comp s <>  v. Wrapper for LAPACK's zgeevU, which computes the eigenvalues and right eigenvectors of a general complex matrix: if  (l,v)=eigC m then m <> v = v <> diag l. 'The eigenvectors are the columns of v. ! The eigenvalues are not sorted. Wrapper for LAPACK's dgeevR, which computes the eigenvalues and right eigenvectors of a general real matrix: if  (l,v)=eigR m then m <> v = v <> diag l. 'The eigenvectors are the columns of v. ! The eigenvalues are not sorted. Wrapper for LAPACK's dsyevT, which computes the eigenvalues and right eigenvectors of a symmetric real matrix: if  (l,v)=eigSl m then m <> v = v <> diag l. 'The eigenvectors are the columns of v. 9 The eigenvalues are sorted in descending order (use eigS' for ascending order). Wrapper for LAPACK's zheevW, which computes the eigenvalues and right eigenvectors of a hermitian complex matrix: if  (l,v)=eigH m then m <> s v = v <> diag l. 'The eigenvectors are the columns of v. 9 The eigenvalues are sorted in descending order (use eigH' for ascending order). Wrapper for LAPACK's dgesvr, which solves a general real linear system (for several right-hand sides) internally using the lu decomposition. Wrapper for LAPACK's zgesvu, which solves a general complex linear system (for several right-hand sides) internally using the lu decomposition. Wrapper for LAPACK's dgels, which obtains the least squared error solution of an overconstrained real linear system or the minimum norm solution of an underdetermined system, for several right-hand sides. For rank deficient systems use +. Wrapper for LAPACK's zgels, which obtains the least squared error solution of an overconstrained complex linear system or the minimum norm solution of an underdetermined system, for several right-hand sides. For rank deficient systems use +. Wrapper for LAPACK's dgelss, which obtains the minimum norm solution to a real linear least squares problem Ax=B using the svd, for several right-hand sides. Admits rank deficient systems but it is slower than +. The effective rank of A is determined by treating as zero those singular valures which are less than rcond times the largest singular value. If rcond == Nothing machine precision is used. Wrapper for LAPACK's zgelss, which obtains the minimum norm solution to a complex linear least squares problem Ax=B using the svd, for several right-hand sides. Admits rank deficient systems but it is slower than +. The effective rank of A is determined by treating as zero those singular valures which are less than rcond times the largest singular value. If rcond == Nothing machine precision is used. Wrapper for LAPACK's zpotrf1, which computes the Cholesky factorization of a - complex Hermitian positive definite matrix. Wrapper for LAPACK's dpotrf1, which computes the Cholesky factorization of a * real symmetric positive definite matrix. Wrapper for LAPACK's dgeqr26, which computes a QR factorization of a real matrix. Wrapper for LAPACK's zgeqr29, which computes a QR factorization of a complex matrix. Wrapper for LAPACK's dgehrdE, which computes a Hessenberg factorization of a square real matrix. Wrapper for LAPACK's zgehrdH, which computes a Hessenberg factorization of a square complex matrix. Wrapper for LAPACK's dgees@, which computes a Schur factorization of a square real matrix. Wrapper for LAPACK's zgeesC, which computes a Schur factorization of a square complex matrix. Wrapper for LAPACK's dgetrf>, which computes a LU factorization of a general real matrix. Wrapper for LAPACK's zgeesC, which computes a Schur factorization of a square complex matrix. Wrapper for LAPACK's dgetrsp, which solves a general real linear system (for several right-hand sides) from a precomputed LU decomposition. Wrapper for LAPACK's zgetrsp, which solves a general real linear system (for several right-hand sides) from a precomputed LU decomposition. ~HI~~,uses ffi provisional!Alberto Ruiz (aruiz at um dot es)jA generic interface for vectors and matrices to a few element-by-element functions in Numeric.GSL.Vector. "element by element multiplication element by element division 7scale the element by element reciprocal of the object: scaleRecip 2 (fromList [5,i]#) == 2 |> [0.4 :+ 0.0,0.0 :+ (-2.0)]   >portable provisional!Alberto Ruiz (aruiz at um dot es)-uses ffi provisional!Alberto Ruiz (aruiz at um dot es)$Objects which have a p-norm. / Using it you can define convenient shortcuts:  norm2 x = pnorm PNorm2 x !frobenius m = norm2 . flatten $ m\Auxiliary typeclass used to define generic computations for both real and complex matrices. )Singular value decomposition using lapack's dgesvd or zgesvd. RObtains the LU decomposition of a matrix in a compact data structure suitable for -. aSolution of a linear system (for several right hand sides) from the precomputed LU factorization  obtained by -. PSolution of a general linear system (for several right-hand sides) using lapacks' dgesv or zgesv.  It is similar to - . -, but  linearSolve1 raises an error if called on a singular system. , See also other versions of linearSolve in Numeric.LinearAlgebra.LAPACK. DEigenvalues and eigenvectors of a general square matrix using lapack's dgeev or zgeev. If  (s,v) = eig m then m < > v == v <> diag s  Similar to -C without checking that the input matrix is hermitian or symmetric.  Similar to -C without checking that the input matrix is hermitian or symmetric. QR factorization using lapack's dgeqr2 or zgeqr2. If  (q,r) = qr m then m == q <> r0, where q is unitary and r is upper triangular. %Hessenberg factorization using lapack's dgehrd or zgehrd. If (p,h) = hess m then m == p <> h < > ctrans p, where p is unitary $ and h is in upper Hessenberg form.  Schur factorization using lapack's dgees or zgees. If (u,s) = schur m then m == u <> s < > ctrans u, where u is unitary \ and s is a Shur matrix. A complex Schur matrix is upper triangular. A real Schur matrix is ! upper triangular in 2x2 blocks. "GAnything that the Jordan decomposition can do, the Schur decomposition  can do better!" (Van Loan) Generic conjugate transpose. Matrix product. YEigenvalues and Eigenvectors of a complex hermitian or real symmetric matrix using lapack's dsyev or zheev. If (s,v) = eigSH m then m == v < > diag s < > ctrans v XCholesky factorization of a positive definite hermitian or symmetric matrix using lapack's dpotrf or zportrf. If  c = chol m then m == ctrans c <> c. Ddeterminant of a square matrix, computed from the LU decomposition. :Explicit LU factorization of a general matrix using lapack's dgetrf or zgetrf. If (l,u,p,s) = lu m then m == p <> l <> u, where l is lower triangular, ] u is upper triangular, p is a permutation matrix and s is the signature of the permutation. (Inverse of a square matrix using lapacks' dgesv and zgesv. .Pseudoinverse of a general matrix using lapack's dgelss or zgelss.  A version of -H which returns an appropriate diagonal matrix with the singular values. If (u,d,v) = full svd m then m == u <> d < > trans v.  A version of -i which returns only the nonzero singular values and the corresponding rows and columns of the rotations. If (u,s,v) = economy svd m then m == u < > diag s < > trans v. 5Numeric rank of a matrix from the SVD decomposition. #The machine precision of a Double: eps = 2.22044604925031e-16! (the value used by GNU-Octave). The imaginary unit: i = 0.0 :+ 1.0 6The nullspace of a matrix from its SVD decomposition. $The nullspace of a matrix. See also -. SThe nullspace of a matrix, assumed to be one-dimensional, with default tolerance 1*-. NReciprocal of the 2-norm condition number of a matrix, computed from the SVD. 0Number of linearly independent rows or columns. DGeneric matrix functions for diagonalizable matrices. For instance: logm = matFunc logNMatrix exponential. It uses a direct translation of Algorithm 11.3.1 in Golub & Van Loan, + based on a scaled Pade approximation. [Matrix square root. Currently it uses a simple iterative algorithm described in Wikipedia. jIt only works with invertible matrices that have a real solution. For diagonalizable matrices you can try  matFunc sqrt.  m = (2><2) [4,9  ,0,4] :: Matrix Double >sqrtm m (2><2)  [ 2.0, 2.25  , 0.0, 2.0 ]Euclidean inner product. Outer product of two vectors. >   [1,2,3] `outer`   [5,2,3] (3><3)  [ 5.0, 2.0, 3.0  , 10.0, 4.0, 6.0  , 15.0, 6.0, 9.0 ]#Kronecker product of two matrices.  m1=(2><3)  [ 1.0, 2.0, 0.0  , 0.0, -1.0, 3.0 ] m2=(4><3)  [ 1.0, 2.0, 3.0  , 4.0, 5.0, 6.0  , 7.0, 8.0, 9.0  , 10.0, 11.0, 12.0 ] > kronecker m1 m2 (8><9) ; [ 1.0, 2.0, 3.0, 2.0, 4.0, 6.0, 0.0, 0.0, 0.0 ; , 4.0, 5.0, 6.0, 8.0, 10.0, 12.0, 0.0, 0.0, 0.0 ; , 7.0, 8.0, 9.0, 14.0, 16.0, 18.0, 0.0, 0.0, 0.0 ; , 10.0, 11.0, 12.0, 20.0, 22.0, 24.0, 0.0, 0.0, 0.0 ; , 0.0, 0.0, 0.0, -1.0, -2.0, -3.0, 3.0, 6.0, 9.0 ; , 0.0, 0.0, 0.0, -4.0, -5.0, -6.0, 12.0, 15.0, 18.0 ; , 0.0, 0.0, 0.0, -7.0, -8.0, -9.0, 21.0, 24.0, 27.0 ; , 0.0, 0.0, 0.0, -10.0, -11.0, -12.0, 30.0, 33.0, 36.0 ].J--.portable provisional!Alberto Ruiz (aruiz at um dot es)matrix product  u <.> v = dot u v x .* a = scale x a a */ x = scale (recip x) a:least squares solution of a linear system, similar to the \ operator of Matlab/"Octave (based on linearSolveSVD). 2Horizontal concatenation of matrices and vectors:  > (ident 3 <-> 3 * ident 3) <|> fromList [1..6.0] (6><4)  [ 1.0, 0.0, 0.0, 1.0  , 0.0, 1.0, 0.0, 2.0  , 0.0, 0.0, 1.0, 3.0  , 3.0, 0.0, 0.0, 4.0  , 0.0, 3.0, 0.0, 5.0  , 0.0, 0.0, 3.0, 6.0 ]0Vertical concatenation of matrices and vectors. / provisionalAlberto Ruiz <aruiz@um.es>IObtains a matrix whose rows are pseudorandom samples from a multivariate  Gaussian distribution. IObtains a matrix whose rows are pseudorandom samples from a multivariate  uniform distribution. CCompute mean vector and covariance matrix of the rows of a matrix.   9  9?uses ffi provisional!Alberto Ruiz (aruiz at um dot es)>?@ABCDEF5 !"#$%&')*+,-  9BCDEFGHIJKLMNOPQRSTUVWXYZ[\]^wxyz{|}J0uses gnuplot and ImageMagick provisional!Alberto Ruiz (aruiz at um dot es) K6Loads a real matrix from a formatted ASCII text file "fromFile :: FilePath -> IO Matrix CfromFile filename = readFile filename >>= return . readMatrix read 3Saves a real matrix to a formatted ascii text file lFrom vectors x and y, it generates a pair of matrices to be used as x and y arguments for matrix functions. 4Draws a 3D surface representation of a real matrix.   > mesh (hilb 20) NIn certain versions you can interactively rotate the graphic using the mouse. mDraws the surface represented by the function f in the desired ranges and number of points, internally using 0.  > let f x y = cos (x + y) " > splot f (0,pi) (0,2*pi) 50 -plots several vectors against the first one TDraws a list of functions over a desired range and with a desired number of points + > plot [sin, cos, sin.(3*)] (0,2*pi) 1000 SDraws a parametric curve. For instance, to draw a spiral we can do something like: > > parametricPlot (\t->(t * sin t, t * cos t)) (0,10*pi) 1000 "writes a matrix to pgm image file Qimshow shows a representation of a matrix as a gray level image using ImageMagick' s display.   @portable provisional!Alberto Ruiz (aruiz at um dot es) LMNOPQRSTUVWXYZ[\]^_`abcdefghijkLMNOOPQQRSSTUUVWWXYYZ[[Aportable provisional!Alberto Ruiz (aruiz at um dot es) lmnopqrstuvwxyz{|}~lmmnp1portable provisional!Alberto Ruiz (aruiz at um dot es)9All tests must pass with a maximum dimension of about 20 A (some tests may fail with bigger sizes due to precision loss). 3B3C3D3E3F4G4H4I4J4K4L4M4N4O4P4Q4R4S4T4U4V5W5X5Y5Z5[5\5]5^5_5`5a5b5c5d5e5f5g5h5i5j5k5l5m5n5o8p8q8r8stuvwxyz{|}~       !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                 !!"!#!$!%!&!'!(!)!*!+!,!-!.!/!0!1!2!3!4!5!6!7!8!9!:!;!<!=!>!?!@!A!B!C!D!E!F!G!H!I"J"K"L"M"N"O"P"Q"R"S"T"U"V"W"X"Y"Z"["\"]"^"_"`"a"b"c"d"e"f"g"h"i"j"k"l"m"n"o"p"q"r"s"t"u"v"w"x"y"z"{#|$}$~%%&&&'''''''''''(((((((((((()*******+++++++++++++++++++++++++++,,,,,,,,,--------------------s-------------------- - - - - -.......///00000000 0!0"0#1$2%2&2'2(2)2*2+2,2-2.2/202122232425262728292:2;2<2=2>2?2@2A2B2C2D2E2F3G3H3I3J3K3L3M3N4O4P4Q4R4S4T4U4V4W4X4Y4Z5555[5\5]5^5_5`5a5b5c5d7e7f7g7h7i7j7k7l8m8n8o8p8q:;r<=s%t&tuv'w'x'y:;z:;{:;|:;}:;~:;:;:;:;*++-0@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA1hmatrix-0.6.0.0Data.Packed.DevelopmentData.Packed.VectorData.Packed.MatrixNumeric.GSL.Special.AiryData.Packed.STData.Packed.ConvertNumeric.GSL.Special.ZetaNumeric.GSL.Special.TrigNumeric.GSL.Special.TransportNumeric.GSL.Special.SynchrotronNumeric.GSL.Special.PsiNumeric.GSL.Special.Pow_intNumeric.GSL.Special.LogNumeric.GSL.Special.LegendreNumeric.GSL.Special.LambertNumeric.GSL.Special.LaguerreNumeric.GSL.Special.HypergNumeric.GSL.Special.GegenbauerNumeric.GSL.Special.Fermi_diracNumeric.GSL.Special.ExpintNumeric.GSL.Special.ElljacNumeric.GSL.Special.EllintNumeric.GSL.Special.ElementaryNumeric.GSL.Special.DilogNumeric.GSL.Special.DebyeNumeric.GSL.Special.DawsonNumeric.GSL.Special.CouplingNumeric.GSL.Special.CoulombNumeric.GSL.Special.ClausenNumeric.GSL.Special.BesselNumeric.GSL.Special.ExpNumeric.GSL.Special.ErfNumeric.GSL.Special.GammaNumeric.GSL.VectorNumeric.GSL.PolynomialsNumeric.GSL.FourierNumeric.GSL.IntegrationNumeric.GSL.DifferentiationNumeric.GSL.MinimizationNumeric.GSL.Root Numeric.GSL Data.PackedNumeric.LinearAlgebra.LAPACKNumeric.LinearAlgebra.Linear Numeric.LinearAlgebra.AlgorithmsNumeric.LinearAlgebra.InterfaceData.Packed.Random Graphics.PlotNumeric.LinearAlgebra.TestsData.Packed.Internal.SignaturesData.Packed.Internal.CommonData.Packed.Internal.VectorData.Packed.Internal.MatrixData.Packed.InternalNumeric.GSL.InternalNumeric.GSL.Special.InternalNumeric.GSL.Specialbase Data.Complexghc-prim GHC.TypesNumeric.LinearAlgebra.InstancesNumeric.LinearAlgebra%Numeric.LinearAlgebra.Tests.Instances&Numeric.LinearAlgebra.Tests.PropertiesAdaptapp1app2app3app4Vectordimvec createVectorfromListtoList|> subVector@>join mapVector zipVector fscanfVector fprintfVector freadVector fwriteVectorElementMatrixrowscols MatrixOrder ColumnMajorRowMajororderOftranscmatfmatmatflattentoListsfromRowstoRows fromColumns toColumns@@> createMatrixreshape liftMatrix liftMatrix2 subMatrix saveMatrix Precision PrecApprox PrecSingle PrecDoubleSTMatrixSTVector thawVectorunsafeThawVector runSTVectorunsafeReadVectorunsafeWriteVector modifyVector liftSTVector freezeVectorunsafeFreezeVector readVector writeVectornewUndefinedVector newVector thawMatrixunsafeThawMatrix runSTMatrixunsafeReadMatrixunsafeWriteMatrix modifyMatrix liftSTMatrixunsafeFreezeMatrix freezeMatrix readMatrix writeMatrixnewUndefinedMatrix newMatrixvectorToStorableArraystorableArrayToVectorarrayFromVectormArrayFromVectorvectorFromArrayvectorFromMArraymatrixFromArrayarrayFromMatrixmArrayFromMatrixmatrixFromMArray zeta_int_ezeta_intzeta_ezetazetam1_ezetam1 zetam1_int_e zetam1_inthzeta_ehzeta eta_int_eeta_inteta_eetasin_esincos_ecoshypot_ehypotsinc_esinclnsinh_elnsinhlncosh_elncosh sin_err_e cos_err_eangle_restrict_symmangle_restrict_posangle_restrict_symm_err_eangle_restrict_pos_err_e transport_2_e transport_2 transport_3_e transport_3 transport_4_e transport_4 transport_5_e transport_5synchrotron_1_e synchrotron_1synchrotron_2_e synchrotron_2 psi_int_epsi_intpsi_epsi psi_1piy_epsi_1piy psi_1_int_e psi_1_intpsi_1_epsi_1psi_n_epsi_n pow_int_epow_intlog_elog log_abs_elog_abs log_1plusx_e log_1plusxlog_1plusx_mx_e log_1plusx_mx legendre_Pl_e legendre_Pl legendre_P1_e legendre_P2_e legendre_P3_e legendre_P1 legendre_P2 legendre_P3 legendre_Q0_e legendre_Q0 legendre_Q1_e legendre_Q1 legendre_Ql_e legendre_Qllegendre_Plm_e legendre_Plmlegendre_sphPlm_elegendre_sphPlmlegendre_array_sizeconicalP_half_e conicalP_halfconicalP_mhalf_econicalP_mhalf conicalP_0_e conicalP_0 conicalP_1_e conicalP_1conicalP_sph_reg_econicalP_sph_regconicalP_cyl_reg_econicalP_cyl_reglegendre_H3d_0_elegendre_H3d_0legendre_H3d_1_elegendre_H3d_1legendre_H3d_e legendre_H3d lambert_W0_e lambert_W0 lambert_Wm1_e lambert_Wm1 laguerre_1_e laguerre_2_e laguerre_3_e laguerre_1 laguerre_2 laguerre_3 laguerre_n_e laguerre_n hyperg_0F1_e hyperg_0F1hyperg_1F1_int_ehyperg_1F1_int hyperg_1F1_e hyperg_1F1hyperg_U_int_e hyperg_U_inthyperg_U_int_e10_e hyperg_U_ehyperg_Uhyperg_U_e10_e hyperg_2F1_e hyperg_2F1hyperg_2F1_conj_ehyperg_2F1_conjhyperg_2F1_renorm_ehyperg_2F1_renormhyperg_2F1_conj_renorm_ehyperg_2F1_conj_renorm hyperg_2F0_e hyperg_2F0 gegenpoly_1_e gegenpoly_2_e gegenpoly_3_e gegenpoly_1 gegenpoly_2 gegenpoly_3 gegenpoly_n_e gegenpoly_nfermi_dirac_m1_efermi_dirac_m1fermi_dirac_0_e fermi_dirac_0fermi_dirac_1_e fermi_dirac_1fermi_dirac_2_e fermi_dirac_2fermi_dirac_int_efermi_dirac_intfermi_dirac_mhalf_efermi_dirac_mhalffermi_dirac_half_efermi_dirac_halffermi_dirac_3half_efermi_dirac_3halffermi_dirac_inc_0_efermi_dirac_inc_0 expint_E1_e expint_E1 expint_E2_e expint_E2 expint_En_e expint_Enexpint_E1_scaled_eexpint_E1_scaledexpint_E2_scaled_eexpint_E2_scaledexpint_En_scaled_eexpint_En_scaled expint_Ei_e expint_Eiexpint_Ei_scaled_eexpint_Ei_scaledshi_eshichi_echi expint_3_eexpint_3si_esici_eci atanint_eatanintelljac_eellint_Kcomp_e ellint_Kcompellint_Ecomp_e ellint_Ecompellint_Pcomp_e ellint_Pcompellint_Dcomp_e ellint_Dcomp ellint_F_eellint_F ellint_E_eellint_E ellint_P_eellint_P ellint_D_eellint_D ellint_RC_e ellint_RC ellint_RD_e ellint_RD ellint_RF_e ellint_RF ellint_RJ_e ellint_RJ multiply_emultiplymultiply_err_edilog_edilog debye_1_edebye_1 debye_2_edebye_2 debye_3_edebye_3 debye_4_edebye_4 debye_5_edebye_5 debye_6_edebye_6dawson_edawson coupling_3j_e coupling_3j coupling_6j_e coupling_6jcoupling_RacahW_ecoupling_RacahW coupling_9j_e coupling_9jhydrogenicR_1_e hydrogenicR_1 hydrogenicR_e hydrogenicR coulomb_CL_e clausen_eclausen bessel_J0_e bessel_J0 bessel_J1_e bessel_J1 bessel_Jn_e bessel_Jn bessel_Y0_e bessel_Y0 bessel_Y1_e bessel_Y1 bessel_Yn_e bessel_Yn bessel_I0_e bessel_I0 bessel_I1_e bessel_I1 bessel_In_e bessel_Inbessel_I0_scaled_ebessel_I0_scaledbessel_I1_scaled_ebessel_I1_scaledbessel_In_scaled_ebessel_In_scaled bessel_K0_e bessel_K0 bessel_K1_e bessel_K1 bessel_Kn_e bessel_Knbessel_K0_scaled_ebessel_K0_scaledbessel_K1_scaled_ebessel_K1_scaledbessel_Kn_scaled_ebessel_Kn_scaled bessel_j0_e bessel_j0 bessel_j1_e bessel_j1 bessel_j2_e bessel_j2 bessel_jl_e bessel_jl bessel_y0_e bessel_y0 bessel_y1_e bessel_y1 bessel_y2_e bessel_y2 bessel_yl_e bessel_ylbessel_i0_scaled_ebessel_i0_scaledbessel_i1_scaled_ebessel_i1_scaledbessel_i2_scaled_ebessel_i2_scaledbessel_il_scaled_ebessel_il_scaledbessel_k0_scaled_ebessel_k0_scaledbessel_k1_scaled_ebessel_k1_scaledbessel_k2_scaled_ebessel_k2_scaledbessel_kl_scaled_ebessel_kl_scaled bessel_Jnu_e bessel_Jnu bessel_Ynu_e bessel_Ynubessel_Inu_scaled_ebessel_Inu_scaled bessel_Inu_e bessel_Inubessel_Knu_scaled_ebessel_Knu_scaled bessel_Knu_e bessel_Knubessel_lnKnu_e bessel_lnKnubessel_zero_J0_ebessel_zero_J0bessel_zero_J1_ebessel_zero_J1bessel_zero_Jnu_ebessel_zero_Jnuexp_eexp exp_e10_e exp_mult_eexp_multexp_mult_e10_eexpm1_eexpm1exprel_eexprel exprel_2_eexprel_2 exprel_n_eexprel_n exp_err_e exp_err_e10_eexp_mult_err_eexp_mult_err_e10_e airy_Ai_eairy_Ai airy_Bi_eairy_Biairy_Ai_scaled_eairy_Ai_scaledairy_Bi_scaled_eairy_Bi_scaledairy_Ai_deriv_e airy_Ai_derivairy_Bi_deriv_e airy_Bi_derivairy_Ai_deriv_scaled_eairy_Ai_deriv_scaledairy_Bi_deriv_scaled_eairy_Bi_deriv_scaledairy_zero_Ai_e airy_zero_Aiairy_zero_Bi_e airy_zero_Biairy_zero_Ai_deriv_eairy_zero_Ai_derivairy_zero_Bi_deriv_eairy_zero_Bi_deriverfc_eerfc log_erfc_elog_erfcerf_eerferf_Z_eerf_Q_eerf_Zerf_Qhazard_ehazard lngamma_elngammagamma_egamma gammastar_e gammastar gammainv_egammainv taylorcoeff_e taylorcoefffact_efact doublefact_e doublefactlnfact_elnfactlndoublefact_e lndoublefact lnchoose_elnchoosechoose_echooselnpoch_elnpochpoch_epoch pochrel_epochrel gamma_inc_Q_e gamma_inc_Q gamma_inc_P_e gamma_inc_P gamma_inc_e gamma_inclnbeta_elnbetabeta_ebeta beta_inc_ebeta_incRandDistGaussianUniformFunCodeSMinMinIdxMaxMaxIdxAbsSumNorm2 FunCodeVVATan2PowDivMulSubAdd FunCodeSVPowVSPowSVNegate AddConstantRecipScaleFunCodeVSqrtSignLogExpATanhACoshASinhTanhCoshSinhATanACosASinAbsTanCosSin toScalarR vectorMapR vectorMapC vectorMapValR vectorMapValC vectorZipR vectorZipC randomVector polySolvefftifft integrateQAGS integrateQNG derivCentral derivForward derivBackwardlinspace vectorMax vectorMinvectorMaxIndexvectorMinIndexconstant fromBlocksflipudfliprldiagdiagRecttakeDiagident><takeRowsdropRows takeColumns dropColumns fromListsasRowasColumn fromArray2DformatfileDimensions loadMatrixfromFile extractRowsrepmatMinimizeMethodDSteepestDescent VectorBFGS2 VectorBFGS ConjugatePR ConjugateFRMinimizeMethod NMSimplex2 NMSimplexminimize minimizeD RootMethodJGNewtonNewtonHybridJHybridsJ RootMethodBroydenDNewtonHybridHybridsrootrootJsetErrorHandlerOff Container toComplex fromComplexcompconjrealcomplex multiplyR multiplyCsvdRsvdRddsvdCeigCeigReigSeigH linearSolveR linearSolveClinearSolveLSRlinearSolveLSClinearSolveSVDRlinearSolveSVDCcholHcholSqrRqrChessRhessCschurRschurCluRluClusRlusCLinearscale addConstantaddsubmuldivide scaleRecipequalNormedpnormNormTypePNorm2PNorm1InfinityFieldsvdluPackedluSolve linearSolvelinearSolveSVDeigeigSH'cholSHqrhessschurctranseigSHcholdetluinvpinvfulleconomyrankSVDepsi nullspaceSVD nullspacePrec nullVector haussholderunpackQR unpackHessrcondrankmatFuncexpmsqrtmdotouter kronecker<><.>.**/<\><|><->gaussianSample uniformSamplemeanCovmeshdomgnuplotXmeshmesh'splotmplotplotparametricPlot matrixToPGMimshow gnuplotpdfrunTestsTMMCVMTMCVMTCVMTVCVTCMCVTCVCVCVTCVCVTCVTCMCMCMTCMCMVCMTCMVCMTVCMTCMCM TCMCMCVCMTMCMCVCMTCMCVCMTCVCMTCMTMMVMTMVMTMMVTMVTVVMTVMTMMMTMVMMTVMMTMMTMTVVVTVVTVPCPD gsl_strerrorfinitpartitcommon//fi errorCodecheckfptrat'atasReal asComplexV withVectorsafe cloneVector foldVectorfoldLoop foldVectorG subMatrixD transdata constantDMFfdatMCcdat withMatrixmatrixFromVector singletonmkVecfun mkVecMatfun mkVecVecfunivaux_vTovaux_vTomcreateV createMIO createSFR createSFR_E10Size_t Gsl_mode_tprecCodeComplexDoublemkfunjoinVert joinHorizminimizeNMSimplexminimizeConjugateGradientminimizeVectorBFGS2phase magnitudepolarcismkPolar conjugateimagPartrealPart:+ internalcompeigS'eigH'pinvToltoFile'CMRM ConsistentPosDefSqWCWCHerRotSqrMcMrHercHerrRotcRotrSqcSqrWCcWCrSqWCcSqWCrPosDefcPosDefrConsistcConsistAprox:~dist|~|~:squareunitary hermitianwellCondpositiveDefinite upperTriangupperHessenbergzerosonesluPropinvProppinvPropdetProp nullspacePropsvdProp1svdProp2eigProp eigSHPropqrProphessProp schurProp1 schurProp2cholProp expmDiagProp multProp1 multProp2linearSolvePropqCheck