rankcan now take aQRPivotedmatrix to allow rank estimation via QR factorization (#54283)- Added keyword argument
algtoeigen,eigen!,eigvalsandeigvals!for self-adjoint matrix types (RealHermSymComplexHerm) to switch between different eigendecomposition algorithms (#49355) - Added a generic version of the (unblocked) pivoted Cholesky decomposition (callable via
cholesky[!](A, RowMaximum())) (#54619) - The number of default BLAS threads now respects process affinity, instead of using the total number of logical threads available on the system (#55574)
- Added a new function
zeroslikethat generates zero elements for matrix-valued banded matrices. Custom array types may specialize this function (#55252) A * Bmatrix multiplication now callsmatprod_dest(A, B, T::Type)to generate the destination; this function is now public (#55537)- The function
haszero(T::Type)to check if a type has a unique zero element is now public (#56223) - Added
diagviewto return a view into a specific band of anAbstractMatrix(#56175)
cbrt(::AbstractMatrix{<:Real})is now defined and returns real-valued matrix cube roots of real-valued matrices (#50661)eigvals/eigen(A, bunchkaufman(B))andeigvals/eigen(A, lu(B)), which utilize the Bunchkaufman (LDL) and LU decomposition ofB, now efficiently compute the generalized eigenvalues (and eigenvectors) ofAandB(#50471)- Specialized dispatch for
eigvals/eigen(::Hermitian{<:Tridiagonal})now performs a similarity transformation to create a real symmetric tridiagonal matrix and solves it using LAPACK routines (#49546) - Structured matrices now retain either the axes of the parent (for
Symmetric/Hermitian/AbstractTriangular/UpperHessenberg) or that of the principal diagonal (for banded matrices) (#52480) bunchkaufmanandbunchkaufman!now work for anyAbstractFloat,Rational, and their complex variants.bunchkaufmannow also supportsIntegertypes via internal conversion toRational{BigInt}. Added new functioninertiato compute the inertia of the diagonal factor in the Bunchkaufman factorization; for complex symmetric matrices,inertiaonly computes the number of zero eigenvalues of the diagonal factor (#51487)- Packages that specialize
mul!with a method signature likemul!(::AbstractMatrix, ::MyMatrix, ::AbstractMatrix, ::Number, ::Number)no longer encounter method ambiguities with LinearAlgebra’s structured matrix types (e.g.,AbstractTriangular) (#52837) luandissuccess(::LU)now accept anallowsingularkeyword argument. When set to true, a valid factorization with rank-deficient U factor will be treated as success instead of throwing an error. Such factorizations are now shown by printing the factors together with a "rank-deficient" note rather than printing a "Failed Factorization" message (#52957)
AbstractQno longer subtypesAbstractMatrix. Additionally,adjoint(Q::AbstractQ)now wrapsQin anAdjointQinstead ofAdjoint.AdjointQitself subtypesAbstractQ. This change clarifies thatAbstractQinstances generally behave like function-based, matrix-backed linear operators, which may not allow efficient indexing. ManyAbstractQtypes can act on vectors/matrices of varying sizes, behaving like a matrix with context-dependent dimensions. The full API is described in the Julia documentation (#46196).- Adjoints and transposes of
Factorizationobjects are now wrapped inAdjointFactorizationandTransposeFactorizationtypes, respectively, instead of the genericAdjointandTransposewrappers. These new types subtypeFactorization(#46874). - Added new functions
hermitianpartandhermitianpart!to extract the Hermitian (real symmetric) part of a matrix (#31836). - The norm of the adjoint or transpose of an
AbstractMatrixnow returns the norm of the parent matrix by default, consistent with the behavior forAbstractVectors (#49020). eigen(A, B)andeigvals(A, B), where one ofAorBis symmetric or Hermitian, are now fully supported (#49533).eigvalsandeigen(A, cholesky(B))now compute the generalized eigenvalues (and eigenvectors) ofAandBvia Cholesky decomposition for positive definiteB. The second argument is the output ofcholesky(#49533).
- The methods
a / bandb \ a, whereais a scalar andba vector, have been removed. These were previously equivalent toa * pinv(b)but could be confusing (#44358). - LinearAlgebra is now fully reliant on
libblastrampoline(LBT) for calling BLAS and LAPACK. OpenBLAS is shipped by default. Building the system image with other BLAS/LAPACK libraries is no longer supported; instead, the LBT mechanism should be used to swap BLAS/LAPACK with vendor-provided libraries (#44360). lunow supports a new pivoting strategyRowNonZero()which chooses the first non-zero pivot element. This is useful for new arithmetic types and educational purposes (#44571).normalize(x, p=2)now supports any normed vector spacex, including scalars (#44925).- The default number of BLAS threads is now set to the number of CPU threads on ARM CPUs, and half the number of CPU threads on other architectures (#45412, #46085).
- The
BLASsubmodule now supports the level-2 BLAS subroutinespr!(#42830). cholesky[!]now supportsLinearAlgebra.PivotingStrategy(singleton type) values as its optional pivot argument. The default remainscholesky(A, NoPivot())instead ofcholesky(A, RowMaximum()); the previousVal{true/false}-based calls are now deprecated (#41640).LinearAlgebra.jlis now completely independent ofSparseArrays.jl, both in source code and unit testing (#43127).
As a result, sparse arrays are no longer silently returned by LinearAlgebra methods applied to Base or LinearAlgebra objects. Specifically, this introduces the following breaking changes:- Concatenations involving special "sparse" matrices (e.g.,
*diagonal) now return dense matrices. Consequently, theD1andD2fields ofSVDobjects constructed viagetpropertyare now dense matrices. 3-arg similar(::SpecialSparseMatrix, ::Type, ::Dims)now returns a dense zero matrix. As a consequence, products of bi-, tri-, and symmetric tridiagonal matrices with each other produce dense output. Constructing 3-arg similar matrices for special "sparse" (nonstatic) matrices now fails due to the lack ofzero(::Type{Matrix{T}}).
- Concatenations involving special "sparse" matrices (e.g.,
- Use
Libblastrampolineto pick a BLAS and LAPACK at runtime. By default it forwards to OpenBLAS in the Julia distribution. The forwarding mechanism can be used by packages to replace the BLAS and LAPACK with user preferences (#39455). - On
aarch64, OpenBLAS now uses an ILP64 BLAS like all other 64-bit platforms (#39436). - OpenBLAS is updated to 0.3.13 (#39216).
- SuiteSparse is updated to 5.8.1 (#39455).
- The shape of an
UpperHessenbergmatrix is preserved under certain arithmetic operations, e.g. when multiplying or dividing by anUpperTriangularmatrix (#40039). - Real quasitriangular Schur factorizations
Scan now be efficiently converted to complex upper-triangular form withSchur{Complex}(S)(#40573). cis(A)now supports matrix arguments (#40194).dotnow supportsUniformScalingwithAbstractMatrix(#40250).qr[!]andlu[!]now supportLinearAlgebra.PivotingStrategy(singleton type) values as their optional pivot argument: defaults areqr(A, NoPivot())(vs.qr(A, ColumnNorm())for pivoting) andlu(A, RowMaximum())(vs.lu(A, NoPivot())without pivoting); the formerVal{true/false}-based calls are deprecated (#40623).det(M::AbstractMatrix{BigInt})now callsdet_bareiss(M), which uses the Bareiss algorithm to calculate precise values (#40868).
- New method
LinearAlgebra.issuccess(::CholeskyPivoted)for checking whether pivoted Cholesky factorization was successful (#36002) UniformScalingcan now be indexed using ranges to return dense matrices and vectors (#24359)- New function
LinearAlgebra.BLAS.get_num_threads()for getting the number of BLAS threads (#36360) (+)(::UniformScaling)is now defined, making+Ia valid unary operation (#36784)- Instances of
UniformScalingare no longerisequalto matrices; previous behavior violated the rule thatisequal(x, y)implieshash(x) == hash(y) - Transposing
*Triangularmatrices now returns matrices of the opposite triangular type, consistent withadjoint!(::*Triangular)andtranspose!(::*Triangular). Packages containing methods with, e.g.,Adjoint{<:Any,<:LowerTriangular{<:Any,<:OwnMatrixType}}should replace that byUpperTriangular{<:Any,<:Adjoint{<:Any,<:OwnMatrixType}}in the method signature (#38168)
- The BLAS submodule now supports the level-2 BLAS subroutine
hpmv!(#34211). normalizenow supports multidimensional arrays (#34239).lqfactorizations can now be used to compute the minimum-norm solution to under-determined systems (#34350).sqrt(::Hermitian)now treats slightly negative eigenvalues as zero for nearly semidefinite matrices, and accepts a newrtolkeyword argument for this tolerance (#35057).- The BLAS submodule now supports the level-2 BLAS subroutine
spmv!(#34320). - The BLAS submodule now supports the level-1 BLAS subroutine
rot!(#35124). - New generic
rotate!(x, y, c, s)andreflect!(x, y, c, s)functions (#35124).
qrandqr!functions supportblocksizekeyword argument (#33053).dotnow admits a 3-argument methoddot(x, A, y)to compute generalized dot productsdot(x, A*y)without computing and storing an intermediate resultA*y(#32739).ldltand non-pivotedlunow throw a newZeroPivotExceptiontype (#33372).cond(A, p)withp=1orp=Infnow computes the exact condition number instead of an estimate (#33547).UniformScalingobjects may now be exponentiated such that(a*I)^x = a^x * I.
- The BLAS submodule no longer exports
dot, which conflicted with that in LinearAlgebra (#31838). diagmandspdiagmnow accept optionalm,ninitial arguments to specify a size (#31654).HessenbergfactorizationsHnow support efficient shifted solves(H+µI) \ band determinants, and use a specialized tridiagonal factorization for Hermitian matrices. There is also a newUpperHessenbergmatrix type (#31853).- Added keyword argument
algtosvdandsvd!to switch between different SVD algorithms (#31057). - Five-argument
mul!(C, A, B, α, β)now implements in-place multiplication fused with addition C = A B α + C β (#23919).
- Added keyword arguments
rtolandatoltopinvandnullspace(#29998). UniformScalinginstances are now callable such that e.g.I(3)will produce aDiagonalmatrix (#30298).- Eigenvalues λ of general matrices are now sorted lexicographically by (Re λ, Im λ) (#21598).
onefor structured matrices (Diagonal,Bidiagonal,Tridiagonal,Symtridiagonal) now preserves structure and type (#29777).diagm(v)is now shorthand fordiagm(0 => v)(#31125).
isdiagandisposdefnow supportDiagonalandUniformScaling(#29638).- Added
mul!,rmul!, andlmul!methods forUniformScaling(#29506). SymmetricandHermitianmatrices now preserve the wrapper when scaled with a number (#29469).- Exponentiation operator
^now supports raising anIrrationalto anAbstractMatrixpower (#29782). - Added keyword arguments
rtolandatoltorank(#29926).