Skip to content

Commit a10cb5b

Browse files
committed
homogenize notation
1 parent eb346bc commit a10cb5b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/linalg.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -645,18 +645,18 @@ function dot(x::AbstractSparseVector, Q::Diagonal, y::AbstractVector)
645645
return s
646646
end
647647

648-
function dot(x::AbstractSparseVector, Q::Diagonal, y::AbstractSparseVector)
649-
n = length(x)
650-
if length(y) != n || n != size(Q, 1)
648+
function dot(x::AbstractSparseVector, D::Diagonal, y::AbstractSparseVector)
649+
d = D.diag
650+
if length(y) != length(x) || length(y) != length(d)
651651
throw(
652-
DimensionMismatch("Vectors and matrix have different dimensions, x has a length $(length(x)), y has a length $(length(y)), Q has side dimension $(size(Q, 1))")
652+
DimensionMismatch("Vectors and matrix have different dimensions, x has a length $(length(x)), y has a length $(length(y)), Q has side dimension $(length(d))")
653653
)
654654
end
655655
xnzind = nonzeroinds(x)
656656
ynzind = nonzeroinds(y)
657657
xnzval = nonzeros(x)
658658
ynzval = nonzeros(y)
659-
s = zero(Base.promote_eltype(x, Q, y))
659+
s = zero(Base.promote_eltype(x, D, y))
660660

661661
if isempty(xnzind) || isempty(ynzind)
662662
return s
@@ -672,7 +672,7 @@ function dot(x::AbstractSparseVector, Q::Diagonal, y::AbstractSparseVector)
672672
ix = xnzind[x_idx]
673673
iy = ynzind[y_idx]
674674
if ix == iy
675-
s += dot(xnzval[x_idx], Q.diag[ix], ynzval[y_idx])
675+
s += dot(xnzval[x_idx], d[ix], ynzval[y_idx])
676676
x_idx += 1
677677
y_idx += 1
678678
elseif ix < iy

0 commit comments

Comments
 (0)