Skip to content

Error thrown when calling rand(d::GaussianLaguerre, dims::Dim2) method #87

Open
@apkille

Description

@apkille

While writing docstrings for rand methods I found this:

julia> rand(GaussianLaguerre(2, 1.0), (3, 3))
ERROR: UndefVarError: `a` not defined in `RandomMatrices`
Suggestion: check for spelling errors or missing imports.
Stacktrace:
 [1] rand(d::GaussianLaguerre, dims::Tuple{Int64, Int64})
   @ RandomMatrices ~/Documents/Julia Packages/JuliaMatrices/RandomMatrices.jl/src/GaussianEnsembles.jl:180
 [2] top-level scope
   @ REPL[54]:1

Originates from not accessing a from the object d. Tests should be added for this method too as it looks a little suspicious as is:

mutable struct GaussianLaguerre <: ContinuousMatrixDistribution
beta::Real
a::Real
end
const Wishart = GaussianLaguerre
#Generates a NxN Hermitian Wishart matrix
#TODO Check - the eigenvalue distribution looks funky
#TODO The appropriate matrix size should be calculated from a and one matrix dimension
function rand(d::GaussianLaguerre, dims::Dim2)
n = 2.0*a/d.beta
if d.beta == 1 #real
A = randn(dims)
elseif d.beta == 2 #complex
A = randn(dims) + im*randn(dims)
elseif d.beta == 4 #quaternion
#Employs 2x2 matrix representation of quaternions
X = randn(dims) + im*randn(dims)
Y = randn(dims) + im*randn(dims)
A = [X Y; -conj(Y) conj(X)]
error("beta = $(d.beta) is not implemented")
end
return (A * A') / dims[1]
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions