From f9316bb824b7d6f023e7afd4573fc2e25ba4f63c Mon Sep 17 00:00:00 2001 From: "Documenter.jl" Date: Thu, 20 Jul 2023 13:43:10 +0000 Subject: [PATCH] build based on 12e9857 --- dev/index.html | 10 +++++----- dev/search/index.html | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dev/index.html b/dev/index.html index 76fae1a0..43dc4193 100644 --- a/dev/index.html +++ b/dev/index.html @@ -1,5 +1,5 @@ -Home · BandedMatrices.jl

BandedMatrices.jl Documentation

Creating banded matrices

BandedMatrices.BandedMatrixType
BandedMatrix{T}(undef, (n, m), (l, u))

returns an uninitialized n×m banded matrix of type T with bandwidths (l,u).

source
BandedMatrix{T}(kv::Pair, (m,n), (l,u))

Construct a m × n BandedMatrix with bandwidths (l,u) from Pairs of diagonals and vectors. Vector kv.second will be placed on the kv.first diagonal.

source
BandedMatrix(kv::Pair{<:Integer,<:AbstractVector}...)

Construct a square matrix from Pairs of diagonals and vectors. Vector kv.second will be placed on the kv.first diagonal.

source
BandedMatrices.brandFunction
brand(T,n,m,l,u)

Creates an n×m banded matrix with random numbers in the bandwidth of type T with bandwidths (l,u)

source

To create a banded matrix of all zeros, identity matrix, or with a constant value use the following constructors:

julia> BandedMatrix(Zeros(5,5), (1,2))
+Home · BandedMatrices.jl

BandedMatrices.jl Documentation

Creating banded matrices

BandedMatrices.BandedMatrixType
BandedMatrix{T}(undef, (n, m), (l, u))

returns an uninitialized n×m banded matrix of type T with bandwidths (l,u).

source
BandedMatrix{T}(kv::Pair, (m,n), (l,u))

Construct a m × n BandedMatrix with bandwidths (l,u) from Pairs of diagonals and vectors. Vector kv.second will be placed on the kv.first diagonal.

source
BandedMatrix(kv::Pair{<:Integer,<:AbstractVector}...)

Construct a square matrix from Pairs of diagonals and vectors. Vector kv.second will be placed on the kv.first diagonal.

source
BandedMatrices.brandFunction
brand(T,n,m,l,u)

Creates an n×m banded matrix with random numbers in the bandwidth of type T with bandwidths (l,u)

source

To create a banded matrix of all zeros, identity matrix, or with a constant value use the following constructors:

julia> BandedMatrix(Zeros(5,5), (1,2))
 5×5 BandedMatrix{Float64} with bandwidths (1, 2):
  0.0  0.0  0.0   ⋅    ⋅
  0.0  0.0  0.0  0.0   ⋅
@@ -32,7 +32,7 @@
 
 julia> using LazyArrays
 julia> @time BandedMatrix(Hcat(Ones(10000,5000),Zeros(10000,5000)),(1,1));
-0.012627 seconds (30.01 k allocations: 1.374 MiB, 92.24% gc time)

See LazyArrays, FillArrays for other implemented structured matrices.

Accessing banded matrices

BandedMatrices.bandFunction
band(i)

Represents the i-th band of a banded matrix.

julia> using BandedMatrices
+0.012627 seconds (30.01 k allocations: 1.374 MiB, 92.24% gc time)

See LazyArrays, FillArrays for other implemented structured matrices.

Accessing banded matrices

BandedMatrices.bandFunction
band(i)

Represents the i-th band of a banded matrix.

julia> using BandedMatrices
 
 julia> A = BandedMatrix(0=>1:4, 1=>5:7, -1=>8:10)
 4×4 BandedMatrix{Int64} with bandwidths (1, 1):
@@ -58,7 +58,7 @@
 3-element Vector{Int64}:
   8
   9
- 10
source
BandedMatrices.BandRangeConstant
BandRange

Represents the entries in a row/column inside the bands.

julia> using BandedMatrices
 
 julia> A = BandedMatrix(0=>1:4, 1=>5:7, -1=>8:10)
 4×4 BandedMatrix{Int64} with bandwidths (1, 1):
@@ -71,7 +71,7 @@
 3-element Vector{Int64}:
  8
  2
- 6
source

To loop over the nonzero elements of a BandedMatrix, you can use colrange(A, c) and rowrange(A, r).

Creating symmetric banded matrices

Use Symmetric(::BandedMatrix) to work with symmetric banded matrices.

Banded matrix interface

Banded matrices go beyond the type BandedMatrix: one can also create matrix types that conform to the banded matrix interface, in which case many of the utility functions in this package are available. The banded matrix interface consists of the following:

Required methodsBrief description
bandwidths(A)Returns a tuple containing the sub-diagonal and super-diagonal bandwidth
isbanded(A)Override to return true
Optional methodsBrief description
inbands_getindex(A, k, j)Unsafe: return A[k,j], without the need to check if we are inside the bands
inbands_setindex!(A, v, k, j)Unsafe: set A[k,j] = v, without the need to check if we are inside the bands
BandedMatrices.MemoryLayout(A)Override to get banded lazy linear algebra, e.g. y .= Mul(A,x)
BandedMatrices.bandeddata(A)Override to return a matrix of the entries in BLAS format. Required if MemoryLayout(A) returns BandedColumnMajor

Note that certain SubArrays of BandedMatrix are also banded matrices. The banded matrix interface is implemented for such SubArrays to take advantage of this.

Eigenvalues

To compute efficiently a selection of eigenvalues for a BandedMatrix, you may use any Krylov method that relies on a sequence of matrix * vector operations. For instance, using the package KrylovKit:

using KrylovKit
+ 6
source

To loop over the nonzero elements of a BandedMatrix, you can use colrange(A, c) and rowrange(A, r).

Creating symmetric banded matrices

Use Symmetric(::BandedMatrix) to work with symmetric banded matrices.

Banded matrix interface

Banded matrices go beyond the type BandedMatrix: one can also create matrix types that conform to the banded matrix interface, in which case many of the utility functions in this package are available. The banded matrix interface consists of the following:

Required methodsBrief description
bandwidths(A)Returns a tuple containing the sub-diagonal and super-diagonal bandwidth
isbanded(A)Override to return true
Optional methodsBrief description
inbands_getindex(A, k, j)Unsafe: return A[k,j], without the need to check if we are inside the bands
inbands_setindex!(A, v, k, j)Unsafe: set A[k,j] = v, without the need to check if we are inside the bands
BandedMatrices.MemoryLayout(A)Override to get banded lazy linear algebra, e.g. y .= Mul(A,x)
BandedMatrices.bandeddata(A)Override to return a matrix of the entries in BLAS format. Required if MemoryLayout(A) returns BandedColumnMajor

Note that certain SubArrays of BandedMatrix are also banded matrices. The banded matrix interface is implemented for such SubArrays to take advantage of this.

Eigenvalues

To compute efficiently a selection of eigenvalues for a BandedMatrix, you may use any Krylov method that relies on a sequence of matrix * vector operations. For instance, using the package KrylovKit:

using KrylovKit
 A = BandedMatrix(Eye(5), (1, 1))
 KrylovKit.eigsolve(A, 1, :LR)

Implementation

Currently, only column-major ordering is supported: a banded matrix B

[ a_11 a_12  ⋅    ⋅
   a_21 a_22 a_23  ⋅
@@ -79,4 +79,4 @@
    ⋅   a_42 a_43 a_44  ]

is represented as a BandedMatrix with a field B.data representing the matrix as

[ ⋅     a_12   a_23    a_34
  a_11   a_22   a_33    a_44
  a_21   a_32   a_43    ⋅
- a_31   a_42   ⋅       ⋅       ]

B.l gives the number of subdiagonals (2) and B.u gives the number of super-diagonals (1). Both B.l and B.u must be non-negative at the moment.

+ a_31 a_42 ⋅ ⋅ ]

B.l gives the number of subdiagonals (2) and B.u gives the number of super-diagonals (1). Both B.l and B.u must be non-negative at the moment.

diff --git a/dev/search/index.html b/dev/search/index.html index 306f3e7c..fb992923 100644 --- a/dev/search/index.html +++ b/dev/search/index.html @@ -1,2 +1,2 @@ -Search · BandedMatrices.jl

Loading search...

    +Search · BandedMatrices.jl

    Loading search...