qutip/QuantumToolbox.jl

`rand_unitary` returns a full sparse matrix

Closed this issue · 0 comments

Bug Description

rand_unitary returns a full sparse matrix rather than a dense matrix or a sparse matrix with a small number of non-zero elements.

Code to Reproduce the Bug

rand_unitary(10, :haar)

Code Output

Quantum Object:   type=Operator   dims=[10]   size=(10, 10)   ishermitian=false
10×10 SparseMatrixCSC{ComplexF64, Int64} with 100 stored entries:
  0.0632417-0.131305im   -0.230814-0.259968im    -0.226769+0.367886im   …  -0.0287067-0.00684086im    0.298216+0.194432im   -0.212687+0.52328im
 -0.0406162-0.0831418im   0.148478-0.297714im    -0.274749-0.144714im       0.0950875+0.0592872im    0.0740545-0.204811im    0.468646-0.303375im
 -0.0752184-0.0106459im   0.161864-0.0666191im  0.00380834-0.0472319im        0.33104+0.273685im      0.215449-0.0494954im  -0.119553-0.054074im
 -0.0437017-0.172603im   0.0555544-0.132859im     0.369062-0.289866im       -0.140639-0.358096im    -0.0331894+0.498063im   0.0337133+0.0629756im
           ⋮                                                            ⋱                                                   
  -0.199976+0.537801im    0.133004-0.353803im   -0.0114151+0.285496im       -0.117898-0.140528im      0.112986+0.30782im     0.312629-0.137968im
  -0.268216-0.140464im   -0.279726+0.363753im    0.0686069+0.117375im       -0.267182+0.106167im    -0.0829904+0.0797804im  0.0592592-0.23626im
   0.367579-0.0876562im   0.274465+0.220096im    -0.209799+0.187118im        0.147872+0.0469607im     0.266915+0.0132135im   0.108786+0.0451848im

Expected Behaviour

A dense matrix or a sparse matrix with a small number of non-zero elements.

Your Environment

QuantumToolbox.jl: Quantum Toolbox in Julia
≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡
Copyright © QuTiP team 2022 and later.
Current admin team:
    Alberto Mercurio, Luca Gravina, Yi-Te Huang

Package information:
====================================
QuantumToolbox  Ver. 0.13.0
LinearSolve     Ver. 2.34.0
OrdinaryDiffEq  Ver. 6.89.0

System information:
====================================
Julia Version: 1.10.5
OS       : Linux (x86_64-linux-gnu)
CPU      : 32 × 13th Gen Intel(R) Core(TM) i9-13900KF
Memory   : 62.512 GB
WORD_SIZE: 64
LIBM     : libopenlibm
LLVM     : libLLVM-15.0.7 (ORCJIT, goldmont)
BLAS     : libopenblas64_.so (ilp64)
Threads  : 8 (on 32 virtual cores)

Additional Context

No response