JuliaMath / JuliaMath/RandomMatrices.jl

support StaticArrays

Open
#64 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Julia
Stars
94
Forks
41
PR merge metrics
No merged PRs in 30d

Description

It would be nice if the various `rand(...)` functions supported returning an `SMatrix`, for example if `::Val{n}` is passed instead of `n::Integer`.

This improves performance and reduces memory allocations in cases where lots of small matrices need to be sampled. e.g. see [this example from discourse](https://discourse.julialang.org/t/code-speed-decreases-when-loop-number-increases/78920) which generates lots of 2x2 and 4x4 Haar-distributed unitary matrices.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the various rand(...) functions in RandomMatrices.jl and review how they currently accept integer dimensions. Check how an SMatrix and a Val{n} argument could fit the existing APIs, then verify that small Haar-distributed unitary matrices can be returned without the stated allocation and performance costs.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
performance
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.