Skip to content

Commit

Permalink
Add brandn
Browse files Browse the repository at this point in the history
  • Loading branch information
dlfivefifty committed Oct 3, 2023
1 parent da44440 commit 574da71
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/banded/BandedMatrix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ promote_rule(::Type{BandedMatrix{T1, C1}}, ::Type{BandedMatrix{T2, C2}}) where {
BandedMatrix{promote_type(T1,T2), promote_type(C1, C2)}


for (op,bop) in ((:(rand),:brand),)
for (op,bop) in ((:rand,:brand), (:randn,:brandn))
@eval begin
$bop(::Type{T},n::Integer,m::Integer,a::Integer,b::Integer) where {T} =
_BandedMatrix($op(T,max(0,b+a+1),m),n,a,b)
Expand Down Expand Up @@ -193,6 +193,13 @@ Creates an `n×m` banded matrix with random numbers in the bandwidth of type `T
"""
brand

"""
brandn(T,n,m,l,u)
Creates an `n×m` banded matrix with random normals in the bandwidth of type `T` with bandwidths `(l,u)`
"""
brand

## Conversions from AbstractArrays, we include FillArrays in case `zeros` is ever faster
BandedMatrix{T}(A::AbstractMatrix, bnds::NTuple{2,Integer}) where T =
BandedMatrix{T, Matrix{T}}(A, bnds)
Expand Down

0 comments on commit 574da71

Please sign in to comment.