@@ -341,15 +341,7 @@ boundary_modified_ud(_, ud, column_space, i) = ud
341
341
boundary_modified_ud (:: BottomRightMatrixCorner , ud, column_space, i) =
342
342
min (Operators. right_idx (column_space) - i, ud)
343
343
344
- # TODO : Use @propagate_inbounds here, and remove @inbounds from this function.
345
- # As of Julia 1.8, doing this increases compilation time by more than an order
346
- # of magnitude, and it also makes type inference fail for some complicated
347
- # matrix field broadcast expressions (in particular, those that involve products
348
- # of linear combinations of matrix fields). Not using @propagate_inbounds causes
349
- # matrix field broadcast expressions to take roughly 3 or 4 times longer to
350
- # evaluate, but this is less significant than the decrease in compilation time.
351
- # matrix-matrix multiplication
352
- function multiply_matrix_at_index (
344
+ Base. @propagate_inbounds function multiply_matrix_at_index (
353
345
space,
354
346
idx,
355
347
hidx,
@@ -374,9 +366,11 @@ function multiply_matrix_at_index(
374
366
375
367
# Precompute the row that is needed from matrix1 so that it does not get
376
368
# recomputed multiple times.
377
- matrix1_row = @inbounds Operators. getidx (space, matrix1, idx, hidx)
369
+ TM1R = Operators. getidx_return_type (matrix1)
370
+ matrix1_row = @inbounds Operators. getidx (space, matrix1, idx, hidx):: TM1R
378
371
379
372
matrix2 = arg
373
+ TM2R = Operators. getidx_return_type (matrix2)
380
374
column_space2 = column_axes (matrix2, column_space1)
381
375
ld2, ud2 = outer_diagonals (eltype (matrix2))
382
376
prod_ld, prod_ud = outer_diagonals (prod_type)
@@ -395,7 +389,7 @@ function multiply_matrix_at_index(
395
389
# TODO : Use @propagate_inbounds_meta instead of @inline_meta.
396
390
Base. @_inline_meta
397
391
if isnothing (bc) || boundary_modified_ld1 <= d <= boundary_modified_ud1
398
- @inbounds Operators. getidx (space, matrix2, idx + d, hidx)
392
+ @inbounds Operators. getidx (space, matrix2, idx + d, hidx):: TM2R
399
393
else
400
394
zero (eltype (matrix2)) # This row is outside the matrix.
401
395
end
@@ -437,7 +431,7 @@ function multiply_matrix_at_index(
437
431
return BandMatrixRow {prod_ld} (prod_entries... )
438
432
end
439
433
# matrix-vector multiplication
440
- function multiply_matrix_at_index (
434
+ Base . @propagate_inbounds function multiply_matrix_at_index (
441
435
space,
442
436
idx,
443
437
hidx,
@@ -454,6 +448,7 @@ function multiply_matrix_at_index(
454
448
arg,
455
449
typeof (lg),
456
450
)
451
+ TM1R = Operators. getidx_return_type (matrix1)
457
452
458
453
column_space1 = column_axes (matrix1, space)
459
454
ld1, ud1 = outer_diagonals (eltype (matrix1))
@@ -462,13 +457,14 @@ function multiply_matrix_at_index(
462
457
463
458
# Precompute the row that is needed from matrix1 so that it does not get
464
459
# recomputed multiple times.
465
- matrix1_row = @inbounds Operators. getidx (space, matrix1, idx, hidx)
460
+ matrix1_row = @inbounds Operators. getidx (space, matrix1, idx, hidx):: TM1R
466
461
467
462
vector = arg
463
+ TVR = Operators. getidx_return_type (vector)
468
464
prod_value = rzero (prod_type)
469
465
@inbounds for d in boundary_modified_ld1: boundary_modified_ud1
470
466
value1 = matrix1_row[d]
471
- value2 = Operators. getidx (space, vector, idx + d, hidx)
467
+ value2 = Operators. getidx (space, vector, idx + d, hidx):: TVR
472
468
value2_lg = Geometry. LocalGeometry (space, idx + d, hidx)
473
469
prod_value =
474
470
radd (prod_value, rmul_with_projection (value1, value2, value2_lg))
0 commit comments