1
1
module InfiniteLinearAlgebra
2
2
using BlockArrays, BlockBandedMatrices, BandedMatrices, LazyArrays, LazyBandedMatrices,
3
- FillArrays, InfiniteArrays, MatrixFactorizations, LinearAlgebra
3
+ FillArrays, InfiniteArrays, MatrixFactorizations, ArrayLayouts, LinearAlgebra
4
4
5
5
import Base: + , - , * , / , \ , ^ , OneTo, getindex, promote_op, _unsafe_getindex, print_matrix_row, size, axes,
6
6
AbstractMatrix, AbstractArray, Matrix, Array, Vector, AbstractVector, Slice,
7
- show, getproperty
8
- import Base. Broadcast: BroadcastStyle, Broadcasted
7
+ show, getproperty, copy, map
8
+ import Base. Broadcast: BroadcastStyle, Broadcasted, broadcasted
9
9
10
10
import ArrayLayouts: colsupport, rowsupport, triangularlayout, MatLdivVec, triangulardata, TriangularLayout, sublayout
11
11
import BandedMatrices: BandedMatrix, _BandedMatrix, AbstractBandedMatrix, bandeddata, bandwidths, BandedColumns, bandedcolumns,
12
12
_default_banded_broadcast
13
13
import FillArrays: AbstractFill, getindex_value
14
- import InfiniteArrays: OneToInf, InfUnitRange, Infinity, InfStepRange, AbstractInfUnitRange
14
+ import InfiniteArrays: OneToInf, InfUnitRange, Infinity, InfStepRange, AbstractInfUnitRange, InfAxes
15
15
import LinearAlgebra: lmul!, ldiv!, matprod, qr, AbstractTriangular, AbstractQ, adjoint, transpose
16
16
import LazyArrays: applybroadcaststyle, CachedArray, CachedMatrix, CachedVector, DenseColumnMajor, FillLayout, ApplyMatrix, check_mul_axes, ApplyStyle, LazyArrayApplyStyle, LazyArrayStyle,
17
- CachedMatrix, CachedArray, resizedata!, MemoryLayout, mulapplystyle, LmulStyle, RmulStyle,
18
- factorize, sub_materialize, LazyLayout, LazyArrayStyle,
19
- @lazymul , applylayout, ApplyLayout, PaddedLayout, materialize!, zero!
17
+ resizedata!, MemoryLayout, mulapplystyle, LmulStyle, RmulStyle,
18
+ factorize, sub_materialize, LazyLayout, LazyArrayStyle, lazy_getindex,
19
+ @lazymul , applylayout, ApplyLayout, PaddedLayout, materialize!, zero!, MulAddStyle,
20
+ LazyArray, LazyMatrix, LazyVector
20
21
import MatrixFactorizations: ql, ql!, QLPackedQ, getL, getR, reflector!, reflectorApply!, QL, QR, QRPackedQ
21
22
22
- import BlockArrays: BlockSizes, cumulsizes, _find_block, AbstractBlockVecOrMat, sizes_from_blocks
23
+ import BlockArrays: AbstractBlockVecOrMat, sizes_from_blocks, _length, BlockedUnitRange
23
24
24
25
import BandedMatrices: BandedMatrix, bandwidths, AbstractBandedLayout, _banded_qr!, _banded_qr, _BandedMatrix
25
26
26
- import BlockBandedMatrices: _BlockSkylineMatrix, _BandedMatrix, AbstractBlockSizes, cumulsizes, _BlockSkylineMatrix, BlockSizes, blockstart, blockstride,
27
+ import LazyBandedMatrices: MulBandedLayout, BroadcastBandedLayout
28
+
29
+ import BlockBandedMatrices: _BlockSkylineMatrix, _BandedMatrix, _BlockSkylineMatrix, blockstart, blockstride,
27
30
BlockSkylineSizes, BlockSkylineMatrix, BlockBandedMatrix, _BlockBandedMatrix, BlockTridiagonal
28
31
29
32
30
33
LazyArrays. @lazymul BandedMatrix{<: Any ,<: Any ,<: OneToInf }
34
+ * (A:: BandedMatrix{<:Any,<:Any,<:OneToInf} , b:: CachedVector ) = apply (* ,A,b)
31
35
32
36
33
37
# BroadcastStyle(::Type{<:BandedMatrix{<:Any,<:Any,<:OneToInf}}) = LazyArrayStyle{2}()
@@ -56,7 +60,7 @@ export Vcat, Fill, ql, ql!, ∞, ContinuousSpectrumError, BlockTridiagonal
56
60
include (" banded/hessenbergq.jl" )
57
61
58
62
include (" banded/infbanded.jl" )
59
- include (" blockbanded/infblocktridiagonal .jl" )
63
+ include (" blockbanded/blockbanded .jl" )
60
64
include (" banded/infqltoeplitz.jl" )
61
65
include (" infql.jl" )
62
66
include (" infqr.jl" )
@@ -80,4 +84,28 @@ ApplyStyle(::typeof(*), ::Type{<:Adjoint{<:Any,<:BandedMatrix{<:Any,<:Any,<:OneT
80
84
LazyArrayApplyStyle ()
81
85
ApplyStyle (:: typeof (* ), :: Type{<:Transpose{<:Any,<:BandedMatrix{<:Any,<:Any,<:OneToInf}}} , :: Type{<:AbstractArray} ) =
82
86
LazyArrayApplyStyle ()
87
+
88
+ ApplyStyle (:: typeof (* ), :: Type{<:BandedMatrix{<:Any,<:AbstractFill,<:OneToInf}} , :: Type{<:BandedMatrix{<:Any,<:AbstractFill,<:OneToInf}} ) =
89
+ MulAddStyle ()
90
+
91
+ # ######
92
+ # block broadcasted
93
+ # #####
94
+
95
+ const CumsumOneToInf2 = BroadcastArray{Int64,1 ,typeof (div),Tuple{BroadcastArray{Int64,1 ,typeof (* ),Tuple{InfiniteArrays. OneToInf{Int64},InfiniteArrays. InfUnitRange{Int64}}},Int64}}
96
+ BlockArrays. sortedunion (a:: CumsumOneToInf2 , :: CumsumOneToInf2 ) = a
97
+
98
+
99
+ map (:: typeof (length), A:: BroadcastArray{OneTo{Int},1,Type{OneTo}} ) = A. args[1 ]
100
+ map (:: typeof (length), A:: BroadcastArray{<:Fill,1,Type{Fill}} ) = A. args[2 ]
101
+ map (:: typeof (length), A:: BroadcastArray{<:Zeros,1,Type{Zeros}} ) = A. args[1 ]
102
+ map (:: typeof (length), A:: BroadcastArray{<:Vcat,1,Type{Vcat}} ) = broadcast (+ ,map .(length,A. args)... )
103
+ broadcasted (:: LazyArrayStyle{1} , :: typeof (length), A:: BroadcastArray{OneTo{Int},1,Type{OneTo}} ) =
104
+ A. args[1 ]
105
+ broadcasted (:: LazyArrayStyle{1} , :: typeof (length), A:: BroadcastArray{<:Fill,1,Type{Fill}} ) =
106
+ A. args[2 ]
107
+
108
+ BlockArrays. _length (:: BlockedUnitRange , :: OneToInf ) = ∞
109
+ BlockArrays. _last (:: BlockedUnitRange , :: OneToInf ) = ∞
110
+
83
111
end # module
0 commit comments