Skip to content

Commit 5adb406

Browse files
authored
Merge branch 'master' into jishnub/genmatvecmul_onepass
2 parents 90249c1 + cdd135e commit 5adb406

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+2524
-379
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "LinearAlgebra"
22
uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
3-
version = "1.12.0"
3+
version = "1.13.0"
44

55
[deps]
66
Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"

docs/src/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,7 @@ LinearAlgebra.BLAS.trsv
745745

746746
```@docs
747747
LinearAlgebra.BLAS.ger!
748-
# xGERU
748+
LinearAlgebra.BLAS.geru!
749749
# xGERC
750750
LinearAlgebra.BLAS.her!
751751
# xHPR

src/LinearAlgebra.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,8 @@ public AbstractTriangular,
180180
symmetric_type,
181181
zeroslike,
182182
matprod_dest,
183-
fillstored!
183+
fillstored!,
184+
fillband!
184185

185186
const BlasFloat = Union{Float64,Float32,ComplexF64,ComplexF32}
186187
const BlasReal = Union{Float64,Float32}

src/adjtrans.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,3 +569,15 @@ Compute `vec(adjoint(A))`, but avoid an allocating reshape if possible
569569
"""
570570
_vecadjoint(A::AbstractVector) = vec(adjoint(A))
571571
_vecadjoint(A::Base.ReshapedArray{<:Any,1,<:AdjointAbsVec}) = adjoint(parent(A))
572+
573+
diagview(A::Transpose, k::Integer = 0) = _vectranspose(diagview(parent(A), -k))
574+
diagview(A::Adjoint, k::Integer = 0) = _vecadjoint(diagview(parent(A), -k))
575+
576+
# triu and tril
577+
triu!(A::AdjOrTransAbsMat, k::Integer = 0) = wrapperop(A)(tril!(parent(A), -k))
578+
tril!(A::AdjOrTransAbsMat, k::Integer = 0) = wrapperop(A)(triu!(parent(A), -k))
579+
580+
function fillband!(A::AdjOrTrans, v, k1, k2)
581+
fillband!(parent(A), wrapperop(A)(v), -k2, -k1)
582+
return A
583+
end

src/bidiag.jl

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1467,6 +1467,35 @@ function inv(B::Bidiagonal{T}) where T
14671467
return B.uplo == 'U' ? UpperTriangular(dest) : LowerTriangular(dest)
14681468
end
14691469

1470+
# cholesky-version for (sym)tridiagonal matrices
1471+
for (T, uplo) in ((:UpperTriangular, :(:U)), (:LowerTriangular, :(:L)))
1472+
@eval function _chol!(A::Bidiagonal, ::Type{$T})
1473+
dv = real(A.dv)
1474+
ev = A.ev
1475+
n = length(dv)
1476+
@inbounds for i in 1:n-1
1477+
iszero(dv[i]) && throw(ZeroPivotException(i))
1478+
ev[i] /= dv[i]
1479+
dv[i+1] -= abs2(ev[i])*dv[i]
1480+
Akk = dv[i]
1481+
Akk, info = _chol!(Akk, UpperTriangular)
1482+
if info != 0
1483+
return $T(A), convert(BlasInt, i)
1484+
end
1485+
dv[i] = Akk
1486+
ev[i] *= dv[i]
1487+
end
1488+
Akk = dv[n]
1489+
Akk, info = _chol!(Akk, $T)
1490+
if info != 0
1491+
return $T(A), convert(BlasInt, n)
1492+
end
1493+
dv[n] = Akk
1494+
B = Bidiagonal(dv, ev, $uplo)
1495+
return $T(B), convert(BlasInt, 0)
1496+
end
1497+
end
1498+
14701499
# Eigensystems
14711500
eigvals(M::Bidiagonal) = copy(M.dv)
14721501
function eigvecs(M::Bidiagonal{T}) where T
@@ -1543,3 +1572,30 @@ function Base._sum(A::Bidiagonal, dims::Integer)
15431572
end
15441573
res
15451574
end
1575+
1576+
function fillband!(B::Bidiagonal, x, l, u)
1577+
if l > u
1578+
return B
1579+
end
1580+
if ((B.uplo == 'U' && (l < 0 || u > 1)) ||
1581+
(B.uplo == 'L' && (l < -1 || u > 0))) && !iszero(x)
1582+
throw_fillband_error(l, u, x)
1583+
else
1584+
if B.uplo == 'U'
1585+
if l <= 1 <= u
1586+
fill!(B.ev, x)
1587+
end
1588+
if l <= 0 <= u
1589+
fill!(B.dv, x)
1590+
end
1591+
else # B.uplo == 'L'
1592+
if l <= 0 <= u
1593+
fill!(B.dv, x)
1594+
end
1595+
if l <= -1 <= u
1596+
fill!(B.ev, x)
1597+
end
1598+
end
1599+
end
1600+
return B
1601+
end

src/cholesky.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ end
413413
# cholesky!. Destructive methods for computing Cholesky factorization of real symmetric
414414
# or Hermitian matrix
415415
## No pivoting (default)
416-
function cholesky!(A::SelfAdjoint, ::NoPivot = NoPivot(); check::Bool = true)
416+
function cholesky!(A::RealSymHermitian, ::NoPivot = NoPivot(); check::Bool = true)
417417
C, info = _chol!(A.data, A.uplo == 'U' ? UpperTriangular : LowerTriangular)
418418
check && checkpositivedefinite(info)
419419
return Cholesky(C.data, A.uplo, info)
@@ -455,7 +455,7 @@ end
455455

456456
## With pivoting
457457
### Non BLAS/LAPACK element types (generic).
458-
function cholesky!(A::SelfAdjoint, ::RowMaximum; tol = 0.0, check::Bool = true)
458+
function cholesky!(A::RealSymHermitian, ::RowMaximum; tol = 0.0, check::Bool = true)
459459
AA, piv, rank, info = _cholpivoted!(A.data, A.uplo == 'U' ? UpperTriangular : LowerTriangular, tol, check)
460460
C = CholeskyPivoted(AA, A.uplo, piv, rank, tol, info)
461461
check && chkfullrank(C)

0 commit comments

Comments
 (0)