Skip to content

Commit

Permalink
feat(matrices): add randjorth
Browse files Browse the repository at this point in the history
  • Loading branch information
AnzhiZhang committed Aug 26, 2024
1 parent 18df1c5 commit 55a386d
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/src/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ TypedMatrices.Poisson
TypedMatrices.Prolate
TypedMatrices.Randcolu
TypedMatrices.Randcorr
TypedMatrices.Randjorth
TypedMatrices.Rando
TypedMatrices.RandSVD
TypedMatrices.Redheff
Expand Down
3 changes: 3 additions & 0 deletions src/matrices/index.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export
Prolate,
Randcolu,
Randcorr,
Randjorth,
Rando,
RandSVD,
Redheff,
Expand Down Expand Up @@ -113,6 +114,7 @@ include("poisson.jl")
include("prolate.jl")
include("randcolu.jl")
include("randcorr.jl")
include("randjorth.jl")
include("rando.jl")
include("randsvd.jl")
include("redheff.jl")
Expand Down Expand Up @@ -178,6 +180,7 @@ MATRIX_GROUPS[GROUP_BUILTIN] = Set([
Prolate,
Randcolu,
Randcorr,
Randjorth,
Rando,
RandSVD,
Redheff,
Expand Down
29 changes: 29 additions & 0 deletions src/matrices/randjorth.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# TODO: Randjorth Matrix
"""
Randjorth Matrix
================
This matrix is currently not implemented.
"""
struct Randjorth{T<:Number} <: AbstractMatrix{T}
n::Integer

function Randjorth{T}(n::Integer) where {T<:Number}
n >= 0 || throw(ArgumentError("$n < 0"))
return new{T}(n)
end
end

# constructors
Randjorth(n::Integer) = Randjorth{Float64}(n)

# metadata
@properties Randjorth [:random]

# properties
size(A::Randjorth) = (A.n, A.n)

# functions
@inline Base.@propagate_inbounds function getindex(A::Randjorth{T}, i::Integer, j::Integer) where {T}
@boundscheck checkbounds(A, i, j)
return zero(T)
end
11 changes: 11 additions & 0 deletions test/matrices/randjorth.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# constructors & content (random matrix)
@test allequal([
size(Randjorth(5)),
size(Randjorth{Float64}(5)),
])

# linear algebra functions
run_test_linearalgrbra_functions(Randjorth.(1:5))

# eltype
@test test_matrix_elements(Randjorth{Float32}(5))

0 comments on commit 55a386d

Please sign in to comment.