10
10
11
11
A `PseudoBlockArray` is similar to a [`BlockArray`](@ref) except the full array is stored
12
12
contiguously instead of block by block. This means that is not possible to insert and retrieve
13
- blocks without copying data. On the other hand `Array ` on a `PseudoBlockArray` is instead instant since
13
+ blocks without copying data. On the other hand `parent ` on a `PseudoBlockArray` is instead instant since
14
14
it just returns the wrapped array.
15
15
16
16
When iteratively solving a set of equations with a gradient method the Jacobian typically has a block structure. It can be convenient
17
17
to use a `PseudoBlockArray` to build up the Jacobian block by block and then pass the resulting matrix to
18
- a direct solver using `Array `.
18
+ a direct solver using `parent `.
19
19
20
20
# Examples
21
21
```jldoctest
22
- julia> PseudoBlockArray(reshape([1:6;], 2, 3), [1,1], [2,1])
22
+ julia> A = zeros(Int, 2, 3);
23
+
24
+ julia> B = PseudoBlockArray(A, [1,1], [2,1])
23
25
2×2-blocked 2×3 PseudoBlockMatrix{Int64}:
24
- 1 3 │ 5
26
+ 0 0 │ 0
25
27
──────┼───
26
- 2 4 │ 6
28
+ 0 0 │ 0
27
29
28
- julia> PseudoBlockArray([1:6;], [3,2,1])
29
- 3-blocked 6-element PseudoBlockVector{Int64}:
30
- 1
31
- 2
32
- 3
33
- ─
34
- 4
35
- 5
36
- ─
37
- 6
30
+ julia> parent(B) === A
31
+ true
32
+
33
+ julia> B[Block(1,1)] .= 4
34
+ 1×2 view(::Matrix{Int64}, 1:1, 1:2) with eltype Int64:
35
+ 4 4
36
+
37
+ julia> A
38
+ 2×3 Matrix{Int64}:
39
+ 4 4 0
40
+ 0 0 0
38
41
```
39
42
"""
40
43
struct PseudoBlockArray{T, N, R<: AbstractArray{T,N} , BS<: NTuple{N,AbstractUnitRange{Int}} } <: AbstractBlockArray{T, N}
@@ -46,7 +49,52 @@ struct PseudoBlockArray{T, N, R<:AbstractArray{T,N}, BS<:NTuple{N,AbstractUnitRa
46
49
end
47
50
end
48
51
52
+ """
53
+ PseudoBlockMatrix{T}
54
+
55
+ Alias for `PseudoBlockArray{T, 2}`
56
+
57
+ ```jldoctest
58
+ julia> A = reshape([1:6;], 2, 3)
59
+ 2×3 Matrix{Int64}:
60
+ 1 3 5
61
+ 2 4 6
62
+
63
+ julia> PseudoBlockMatrix(A, [1,1], [1,2])
64
+ 2×2-blocked 2×3 PseudoBlockMatrix{Int64}:
65
+ 1 │ 3 5
66
+ ───┼──────
67
+ 2 │ 4 6
68
+ ```
69
+ """
49
70
const PseudoBlockMatrix{T} = PseudoBlockArray{T, 2 }
71
+ """
72
+ PseudoBlockVector{T}
73
+
74
+ Alias for `PseudoBlockArray{T, 1}`
75
+
76
+ ```jldoctest
77
+ julia> A = [1:6;]
78
+ 6-element Vector{Int64}:
79
+ 1
80
+ 2
81
+ 3
82
+ 4
83
+ 5
84
+ 6
85
+
86
+ julia> PseudoBlockVector(A, [3,2,1])
87
+ 3-blocked 6-element PseudoBlockVector{Int64}:
88
+ 1
89
+ 2
90
+ 3
91
+ ─
92
+ 4
93
+ 5
94
+ ─
95
+ 6
96
+ ```
97
+ """
50
98
const PseudoBlockVector{T} = PseudoBlockArray{T, 1 }
51
99
const PseudoBlockVecOrMat{T} = Union{PseudoBlockMatrix{T}, PseudoBlockVector{T}}
52
100
0 commit comments