Linear Algebra
Specialized matrix types make algorithms dispatch to faster methods automatically (e.g., Diagonal \ b is O(n)).
Specialized matrix types make algorithms dispatch to faster methods automatically (e.g., Diagonal \ b is O(n)).
using LinearAlgebra
A = [4.0 1; 2 3]
b = [1.0, 2.0]
A * b # matrix-vector product
A \ b # solve Ax = b (uses an appropriate factorization)
inv(A), det(A), tr(A), rank(A), norm(b), norm(A, 1), cond(A)
A', transpose(A), adjoint(A)
dot(b, b), b ⋅ b, cross([1,0,0], [0,1,0])
I # identity of any size (UniformScaling): A + 2I
diag(A), Diagonal([1, 2]), Symmetric(A + A'), UpperTriangular(A), Tridiagonal(...)
kron(A, A)
eigen(A) # eigenvalues & vectors: E.values, E.vectors
eigvals(A), svd(A), svdvals(A)
lu(A), qr(A), cholesky(Symmetric(A'A)), schur(A), hessenberg(A)
F = lu(A); F \ b # reuse factorizations
nullspace(A), pinv(A), exp(A), sqrt(Symmetric(A'A))
mul!(C, A, B) # in-place multiplication (no allocation)
ldiv!(F, b)
BLAS.set_num_threads(4)
using SparseArrays
S = sprand(1000, 1000, 0.01); S \ rand(1000)