You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- remove most instances of μ.blocks in favour of μ[BlockIndex(n, k)] which should exist for any AbstractBlockVector
- have the bivariatemoments constructor return a BlockedVector
- the rationale is that the block-analogue of a zero-padded vector isa BlockedVector{T, <: PaddedVector{T}} rather than a BlockVector
- remove X and Y from BivariateChebyshevGramMatrix. the whole point for it is to be a light type
Base.@propagate_inboundsgetindex(W::BivariateChebyshevGramMatrix{T}, blockindex::BlockIndex{2}) where T =_blockindex_getindex(W, blockindex)
366
+
Base.@propagate_inboundsgetindex(G::BivariateChebyshevGramMatrix{T}, blockindex::BlockIndex{2}) where T =_blockindex_getindex(G, blockindex)
383
367
384
-
@inlinefunction_blockindex_getindex(W::BivariateChebyshevGramMatrix{T}, bi::BlockIndex{2}) where T
385
-
μ = W.μ
386
-
@boundscheckblockcheckbounds(W, Block(bi.I))
368
+
@inlinefunction_blockindex_getindex(G::BivariateChebyshevGramMatrix{T}, bi::BlockIndex{2}) where T
369
+
@boundscheckblockcheckbounds(G, Block(bi.I))
387
370
m, n = bi.I
388
371
j, k = bi.α
389
372
@boundscheck (1≤ j ≤ m) && (1≤ k ≤ n)
390
-
v = (μ.blocks[m+n-1][j+k-1]+μ.blocks[abs(m-j-n+k)+j+k-1][j+k-1]+μ.blocks[m-j+n-k+abs(j-k)+1][abs(j-k)+1]+μ.blocks[abs(m-j-n+k)+abs(j-k)+1][abs(j-k)+1])/4
373
+
μ = G.μ
374
+
v = (μ[BlockIndex(m+n-1, j+k-1)]+μ[BlockIndex(abs(m-j-n+k)+j+k-1, j+k-1)]+μ[BlockIndex(m-j+n-k+abs(j-k)+1, abs(j-k)+1)]+μ[BlockIndex(abs(m-j-n+k)+abs(j-k)+1, abs(j-k)+1)])/4
391
375
return v
392
376
end
393
377
394
-
@inlinefunctiongetindex(W::BivariateChebyshevGramMatrix{T}, i::Vararg{Integer, 2}) where T
395
-
@boundscheckcheckbounds(W, i...)
396
-
@inbounds v =W[findblockindex.(axes(W), i)...]
378
+
@inlinefunctiongetindex(G::BivariateChebyshevGramMatrix{T}, i::Vararg{Integer, 2}) where T
379
+
@boundscheckcheckbounds(G, i...)
380
+
@inbounds v =G[findblockindex.(axes(G), i)...]
397
381
return v
398
382
end
399
383
400
-
function_chebyshev_x(::Type{T}, n::Integer) where T
401
-
X =BandedBlockBandedMatrix{T}(undef, 1:n, 1:n, (1, 1), (0, 0))
402
-
dat = X.data.blocks
403
-
@inboundsfor j in1:n*(n+1)÷2
404
-
dat[2, j] =zero(T)
405
-
end
406
-
@inboundsfor j in1:n-1
407
-
for k in1:j-1
408
-
dat[3, k+j*(j-1)÷2] =one(T)/2
409
-
end
410
-
dat[3, j+j*(j-1)÷2] =one(T)
411
-
end
412
-
@inboundsfor j in2:n
413
-
for k in1:j
414
-
dat[1, k+j*(j-1)÷2] =one(T)/2
415
-
end
416
-
end
417
-
418
-
return X
384
+
@inlinefunctionblockbandwidths(G::BivariateChebyshevGramMatrix{T, <: BlockedVector{T, <: PaddedVector{T}}}) where T
385
+
N =length(G.μ.blocks.args[2])
386
+
b =ceil(Int, (-1+sqrt(1+8N))/2) -1
387
+
return (b, b)
419
388
end
420
-
421
-
function_chebyshev_y(::Type{T}, n::Integer) where T
422
-
Y =BandedBlockBandedMatrix{T}(undef, 1:n, 1:n, (1, 1), (1, 1))
423
-
dat = Y.data.blocks
424
-
@inboundsfor k in2:8
425
-
for j in1:n*(n+1)÷2
426
-
dat[k, j] =zero(T)
427
-
end
428
-
end
429
-
@inboundsfor j in1:n-1
430
-
dat[9, 1+j*(j-1)÷2] =one(T)
431
-
for k in2:j
432
-
dat[9, k+j*(j-1)÷2] =one(T)/2
433
-
end
434
-
end
435
-
@inboundsfor j in2:n
436
-
for k in2:j
437
-
dat[1, k+j*(j-1)÷2] =one(T)/2
438
-
end
439
-
end
440
-
441
-
return Y
389
+
@inlinefunctionsubblockbandwidths(G::BivariateChebyshevGramMatrix{T, <: BlockedVector{T, <: PaddedVector{T}}}) where T
390
+
N =length(G.μ.blocks.args[2])
391
+
b =ceil(Int, (-1+sqrt(1+8N))/2) -1
392
+
return (b, b)
442
393
end
394
+
@inlineMemoryLayout(G::BivariateChebyshevGramMatrix{T, <: BlockedVector{T, <: PaddedVector{T}}}) where T =BandedBlockBandedLayout()
443
395
444
396
#
445
397
# The computation of the skew-symmetric generators for the bivariate Chebyshev--Gram matrix equation:
@@ -460,38 +412,38 @@ function compute_skew_generators(::Val{1}, W::BivariateChebyshevGramMatrix{T}) w
0 commit comments