Skip to content

Commit 65ee829

Browse files
committed
Precise axes in generic_mattrimul!
1 parent b5cc56a commit 65ee829

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/triangular.jl

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1391,7 +1391,7 @@ function generic_trimatmul!(C::AbstractVecOrMat, uploc, isunitc, tfun::Function,
13911391
@inbounds if uploc == 'U'
13921392
if tfun === identity
13931393
for j in axes(B,2)
1394-
for i in axes(B,1)
1394+
for i in axes(A,1)
13951395
Cij = (unit ? oA : A[i,i]) * B[i,j]
13961396
for k in i + 1:lastindex(B,1)
13971397
Cij += A[i,k] * B[k,j]
@@ -1413,7 +1413,7 @@ function generic_trimatmul!(C::AbstractVecOrMat, uploc, isunitc, tfun::Function,
14131413
else # uploc == 'L'
14141414
if tfun === identity
14151415
for j in axes(B,2)
1416-
for i in reverse(axes(B,1))
1416+
for i in reverse(axes(A,1))
14171417
Cij = (unit ? oA : A[i,i]) * B[i,j]
14181418
for k in firstindex(B,1):i - 1
14191419
Cij += A[i,k] * B[k,j]
@@ -1423,7 +1423,7 @@ function generic_trimatmul!(C::AbstractVecOrMat, uploc, isunitc, tfun::Function,
14231423
end
14241424
else # tfun in (transpose, adjoint)
14251425
for j in axes(B,2)
1426-
for i in axes(B,1)
1426+
for i in axes(A,2)
14271427
Cij = (unit ? oA : tfun(A[i,i])) * B[i,j]
14281428
for k in i + 1:lastindex(B,1)
14291429
Cij += tfun(A[k,i]) * B[k,j]
@@ -1444,7 +1444,7 @@ function generic_trimatmul!(C::AbstractVecOrMat, uploc, isunitc, ::Function, xA:
14441444
unit = isunitc == 'U'
14451445
@inbounds if uploc == 'U'
14461446
for j in axes(B,2)
1447-
for i in axes(B,1)
1447+
for i in axes(A,1)
14481448
Cij = (unit ? oA : conj(A[i,i])) * B[i,j]
14491449
for k in i + 1:lastindex(B,1)
14501450
Cij += conj(A[i,k]) * B[k,j]
@@ -1454,7 +1454,7 @@ function generic_trimatmul!(C::AbstractVecOrMat, uploc, isunitc, ::Function, xA:
14541454
end
14551455
else # uploc == 'L'
14561456
for j in axes(B,2)
1457-
for i in reverse(axes(B,1))
1457+
for i in reverse(axes(A,1))
14581458
Cij = (unit ? oA : conj(A[i,i])) * B[i,j]
14591459
for k in firstindex(B,1):i - 1
14601460
Cij += conj(A[i,k]) * B[k,j]
@@ -1474,7 +1474,7 @@ function generic_mattrimul!(C::AbstractMatrix, uploc, isunitc, tfun::Function, A
14741474
@inbounds if uploc == 'U'
14751475
if tfun === identity
14761476
for i in axes(A,1)
1477-
for j in reverse(axes(A,2))
1477+
for j in reverse(axes(B,2))
14781478
Cij = A[i,j] * (unit ? oB : B[j,j])
14791479
for k in firstindex(A,2):j - 1
14801480
Cij += A[i,k] * B[k,j]
@@ -1484,7 +1484,7 @@ function generic_mattrimul!(C::AbstractMatrix, uploc, isunitc, tfun::Function, A
14841484
end
14851485
else # tfun in (transpose, adjoint)
14861486
for i in axes(A,1)
1487-
for j in axes(A,2)
1487+
for j in axes(B,1)
14881488
Cij = A[i,j] * (unit ? oB : tfun(B[j,j]))
14891489
for k in j + 1:lastindex(A,2)
14901490
Cij += A[i,k] * tfun(B[j,k])
@@ -1496,7 +1496,7 @@ function generic_mattrimul!(C::AbstractMatrix, uploc, isunitc, tfun::Function, A
14961496
else # uploc == 'L'
14971497
if tfun === identity
14981498
for i in axes(A,1)
1499-
for j in axes(A,2)
1499+
for j in axes(B,2)
15001500
Cij = A[i,j] * (unit ? oB : B[j,j])
15011501
for k in j + 1:lastindex(A,2)
15021502
Cij += A[i,k] * B[k,j]
@@ -1506,7 +1506,7 @@ function generic_mattrimul!(C::AbstractMatrix, uploc, isunitc, tfun::Function, A
15061506
end
15071507
else # tfun in (transpose, adjoint)
15081508
for i in axes(A,1)
1509-
for j in reverse(axes(A,2))
1509+
for j in reverse(axes(B,1))
15101510
Cij = A[i,j] * (unit ? oB : tfun(B[j,j]))
15111511
for k in firstindex(A,2):j - 1
15121512
Cij += A[i,k] * tfun(B[j,k])
@@ -1527,7 +1527,7 @@ function generic_mattrimul!(C::AbstractMatrix, uploc, isunitc, ::Function, A::Ab
15271527
unit = isunitc == 'U'
15281528
@inbounds if uploc == 'U'
15291529
for i in axes(A,1)
1530-
for j in reverse(axes(A,2))
1530+
for j in reverse(axes(B,2))
15311531
Cij = A[i,j] * (unit ? oB : conj(B[j,j]))
15321532
for k in firstindex(A,2):j - 1
15331533
Cij += A[i,k] * conj(B[k,j])
@@ -1537,7 +1537,7 @@ function generic_mattrimul!(C::AbstractMatrix, uploc, isunitc, ::Function, A::Ab
15371537
end
15381538
else # uploc == 'L'
15391539
for i in axes(A,1)
1540-
for j in axes(A,2)
1540+
for j in axes(B,2)
15411541
Cij = A[i,j] * (unit ? oB : conj(B[j,j]))
15421542
for k in j + 1:lastindex(A,2)
15431543
Cij += A[i,k] * conj(B[k,j])

0 commit comments

Comments
 (0)