|
1 | 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license
|
2 | 2 |
|
3 | 3 | using LinearAlgebra: AbstractTriangular, StridedMaybeAdjOrTransMat, UpperOrLowerTriangular,
|
4 |
| - RealHermSymComplexHerm, checksquare, sym_uplo, wrap |
| 4 | + RealHermSymComplexHerm, HermOrSym, checksquare, sym_uplo, wrap |
5 | 5 | using Random: rand!
|
6 | 6 |
|
7 | 7 | const tilebufsize = 10800 # Approximately 32k/3
|
@@ -1210,6 +1210,9 @@ function nzrangelo(A, i, excl=false)
|
1210 | 1210 | @inbounds r2 < r1 || rv[r1] >= i + excl ? r : (searchsortedfirst(view(rv, r1:r2), i + excl) + r1-1):r2
|
1211 | 1211 | end
|
1212 | 1212 |
|
| 1213 | +dot(x::AbstractVector, A::HermOrSym{<:Any,<:AbstractSparseMatrixCSC}, y::AbstractVector) = |
| 1214 | + _dot(x, parent(A), y, A.uplo == 'U' ? nzrangeup : nzrangelo, A isa Symmetric ? identity : real, A isa Symmetric ? transpose : adjoint) |
| 1215 | +# disambiguation |
1213 | 1216 | dot(x::AbstractVector, A::RealHermSymComplexHerm{<:Real,<:AbstractSparseMatrixCSC}, y::AbstractVector) =
|
1214 | 1217 | _dot(x, parent(A), y, A.uplo == 'U' ? nzrangeup : nzrangelo, A isa Symmetric ? identity : real, A isa Symmetric ? transpose : adjoint)
|
1215 | 1218 | function _dot(x::AbstractVector, A::AbstractSparseMatrixCSC, y::AbstractVector, rangefun::Function, diagop::Function, odiagop::Function)
|
@@ -1242,9 +1245,12 @@ function _dot(x::AbstractVector, A::AbstractSparseMatrixCSC, y::AbstractVector,
|
1242 | 1245 | end
|
1243 | 1246 | return r
|
1244 | 1247 | end
|
1245 |
| -dot(x::SparseVector, A::RealHermSymComplexHerm{<:Real,<:AbstractSparseMatrixCSC}, y::SparseVector) = |
1246 |
| - _dot(x, parent(A), y, A.uplo == 'U' ? nzrangeup : nzrangelo, A isa Symmetric ? identity : real) |
1247 |
| -function _dot(x::SparseVector, A::AbstractSparseMatrixCSC, y::SparseVector, rangefun::Function, diagop::Function) |
| 1248 | +dot(x::AbstractSparseVector, A::HermOrSym{<:Any,<:AbstractSparseMatrixCSC}, y::AbstractSparseVector) = |
| 1249 | + _dot(x, parent(A), y, A.uplo == 'U' ? nzrangeup : nzrangelo, A isa Symmetric ? identity : real, A isa Symmetric ? transpose : adjoint) |
| 1250 | +# disambiguation |
| 1251 | +dot(x::AbstractSparseVector, A::RealHermSymComplexHerm{<:Real,<:AbstractSparseMatrixCSC}, y::AbstractSparseVector) = |
| 1252 | + _dot(x, parent(A), y, A.uplo == 'U' ? nzrangeup : nzrangelo, A isa Symmetric ? identity : real, A isa Symmetric ? transpose : adjoint) |
| 1253 | +function _dot(x::AbstractSparseVector, A::AbstractSparseMatrixCSC, y::AbstractSparseVector, rangefun::Function, diagop::Function, odiagop::Function) |
1248 | 1254 | m, n = size(A)
|
1249 | 1255 | length(x) == m && n == length(y) ||
|
1250 | 1256 | throw(DimensionMismatch("x has length $(length(x)), A has size ($m, $n), y has length $(length(y))"))
|
@@ -1275,7 +1281,7 @@ function _dot(x::SparseVector, A::AbstractSparseMatrixCSC, y::SparseVector, rang
|
1275 | 1281 | A_ptr_lo = first(rangefun(A, xi, true))
|
1276 | 1282 | A_ptr_hi = last(rangefun(A, xi, true))
|
1277 | 1283 | if A_ptr_lo <= A_ptr_hi
|
1278 |
| - r += dot(xv, _spdot((a, y) -> a'y, A_ptr_lo, A_ptr_hi, Arowval, Anzval, |
| 1284 | + r += dot(xv, _spdot((a, y) -> odiagop(a)*y, A_ptr_lo, A_ptr_hi, Arowval, Anzval, |
1279 | 1285 | 1, length(ynzind), ynzind, ynzval))
|
1280 | 1286 | end
|
1281 | 1287 | end
|
@@ -2241,7 +2247,7 @@ end
|
2241 | 2247 | # return F
|
2242 | 2248 | # end
|
2243 | 2249 | # end
|
2244 |
| -function factorize(A::LinearAlgebra.RealHermSymComplexHerm{Float64,<:AbstractSparseMatrixCSC}) |
| 2250 | +function factorize(A::RealHermSymComplexHerm{Float64,<:AbstractSparseMatrixCSC}) |
2245 | 2251 | F = cholesky(A; check = false)
|
2246 | 2252 | if LinearAlgebra.issuccess(F)
|
2247 | 2253 | return F
|
|
0 commit comments