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_inbounds getindex(W::BivariateChebyshevGramMatrix{T}, blockindex::BlockIndex{2}) where T = _blockindex_getindex(W, blockindex)
366
+
Base.@propagate_inbounds getindex(G::BivariateChebyshevGramMatrix{T}, blockindex::BlockIndex{2}) where T = _blockindex_getindex(G, blockindex)
383
367
384
-
@inline function _blockindex_getindex(W::BivariateChebyshevGramMatrix{T}, bi::BlockIndex{2}) where T
385
-
μ = W.μ
386
-
@boundscheck blockcheckbounds(W, Block(bi.I))
368
+
@inline function _blockindex_getindex(G::BivariateChebyshevGramMatrix{T}, bi::BlockIndex{2}) where T
369
+
@boundscheck blockcheckbounds(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
-
@inline function getindex(W::BivariateChebyshevGramMatrix{T}, i::Vararg{Integer, 2}) where T
395
-
@boundscheck checkbounds(W, i...)
396
-
@inbounds v = W[findblockindex.(axes(W), i)...]
378
+
@inline function getindex(G::BivariateChebyshevGramMatrix{T}, i::Vararg{Integer, 2}) where T
379
+
@boundscheck checkbounds(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
-
@inbounds for j in 1:n*(n+1)÷2
404
-
dat[2, j] = zero(T)
405
-
end
406
-
@inbounds for j in 1:n-1
407
-
for k in 1: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
-
@inbounds for j in 2:n
413
-
for k in 1:j
414
-
dat[1, k+j*(j-1)÷2] = one(T)/2
415
-
end
416
-
end
417
-
418
-
return X
384
+
@inline function blockbandwidths(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
-
@inbounds for k in 2:8
425
-
for j in 1:n*(n+1)÷2
426
-
dat[k, j] = zero(T)
427
-
end
428
-
end
429
-
@inbounds for j in 1:n-1
430
-
dat[9, 1+j*(j-1)÷2] = one(T)
431
-
for k in 2:j
432
-
dat[9, k+j*(j-1)÷2] = one(T)/2
433
-
end
434
-
end
435
-
@inbounds for j in 2:n
436
-
for k in 2:j
437
-
dat[1, k+j*(j-1)÷2] = one(T)/2
438
-
end
439
-
end
440
-
441
-
return Y
389
+
@inline function subblockbandwidths(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
+
@inline MemoryLayout(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