Customization

Nilpotent Matrix

Default Nilpotent Matrix

SMG2S.NilpMethod
Nilp(nbOne::Ti, size::Ti) where {Ti<:Integer}

Create a nilpotent matrix object with parameters nbOne and size. size refers to the size of nilpotent matrix to be generated, and nbOne refers to the number of continuous 1 on the non-zero diagonal of generated nilptent matrix.

This is the default type of nilptent matrix used by SMG2S, in which the non-zero diagonal is selected as the one of offset 1. This diagonal starts with nbOne number of 1, then a 0, then nbOne number of 1, ... until to the end.

Examples

julia> SMG2S.Nilp(2,8)
Nilpotent{Int64}(2, 8, 3,
  ⋅   1.0   ⋅    ⋅    ⋅    ⋅    ⋅    ⋅
  ⋅    ⋅   1.0   ⋅    ⋅    ⋅    ⋅    ⋅
  ⋅    ⋅    ⋅    ⋅    ⋅    ⋅    ⋅    ⋅
  ⋅    ⋅    ⋅    ⋅   1.0   ⋅    ⋅    ⋅
  ⋅    ⋅    ⋅    ⋅    ⋅   1.0   ⋅    ⋅
  ⋅    ⋅    ⋅    ⋅    ⋅    ⋅    ⋅    ⋅
  ⋅    ⋅    ⋅    ⋅    ⋅    ⋅    ⋅   1.0
  ⋅    ⋅    ⋅    ⋅    ⋅    ⋅    ⋅    ⋅ )
source

Construction from User-provided vector

SMG2S.NilpMethod
Nilp(vector::AbstractVector, size::Ti) where {Ti<:Integer}

Create a nilpotent matrix whose dimension is size from user-provided vector. The non-zero diagonal of nilpotent matrix is fixed as the one with offset 1. Therefore, the size of given vector should at least be size-1.

Examples

julia> vec=[1; 1; 0; 1; 1; 1; 0]
7-element Vector{Int64}:
 1
 1
 0
 1
 1
 1
 0

julia> SMG2S.Nilp(vec, 8)
Nilpotent{Int64}(3, 8, 4,
  ⋅   1.0   ⋅    ⋅    ⋅    ⋅    ⋅    ⋅
  ⋅    ⋅   1.0   ⋅    ⋅    ⋅    ⋅    ⋅
  ⋅    ⋅    ⋅    ⋅    ⋅    ⋅    ⋅    ⋅
  ⋅    ⋅    ⋅    ⋅   1.0   ⋅    ⋅    ⋅
  ⋅    ⋅    ⋅    ⋅    ⋅   1.0   ⋅    ⋅
  ⋅    ⋅    ⋅    ⋅    ⋅    ⋅   1.0   ⋅
  ⋅    ⋅    ⋅    ⋅    ⋅    ⋅    ⋅    ⋅
  ⋅    ⋅    ⋅    ⋅    ⋅    ⋅    ⋅    ⋅ )
source

Construction from User-provided Sparse Matrix

SMG2S.NilpMethod
Nilp(matrix::SparseMatrixCSC{Tv, Ti} ,size::Ti; maxdegree::Ti=80) where{Tv <: Real, Ti <: Integer}

Create a nilpotent matrix whose dimension is size from user-provided sparse matrix matrix. This matrix should be nilpotent, and its nilpotency should not be larger than 80. Before generation, SMG2S.jl will check if the user-provided matrix is nilpotent matrix with nilpotency no larger than 80. If it doesn't satisfy any of the two, an error message will appear.

Examples

julia> nilpMatrix = sparse([0. 1 1 0; 0 0 1 1 ; 0 0 0 1 ; 0 0 0 0])
4×4 SparseMatrixCSC{Float64, Int64} with 5 stored entries:
  ⋅   1.0  1.0   ⋅
  ⋅    ⋅   1.0  1.0
  ⋅    ⋅    ⋅   1.0
  ⋅    ⋅    ⋅    ⋅

julia> SMG2S.Nilp(nilpMatrix,4)
┌ Info: the degree of given nilpotent matrix is:
└   degree = 4
Nilpotent{Int64}(1, 4, 4,
  ⋅   1.0  1.0   ⋅
  ⋅    ⋅   1.0  1.0
  ⋅    ⋅    ⋅   1.0
  ⋅    ⋅    ⋅    ⋅ )

Examples

julia> nilpMatrix = sparse([1. 1 1 0; 0 0 1 1 ; 0 0 0 1 ; 0 0 0 0])
4×4 SparseMatrixCSC{Float64, Int64} with 6 stored entries:
 1.0  1.0  1.0   ⋅
  ⋅    ⋅   1.0  1.0
  ⋅    ⋅    ⋅   1.0
  ⋅    ⋅    ⋅    ⋅

julia> SMG2S.Nilp(nilpMatrix,4)
ERROR: the given nilpotent matrix is invalid
source

Construction from User-provided vector with specific diagonal offset

SMG2S.NilpMethod
Nilp(vec::AbstractVector, diag::Ti, size::Ti) where{Ti <: Integer}

Create a nilpotent matrix whose dimension is size from user-provided vector. The non-zero diagonal of nilpotent matrix is set as the one with offset diag. Therefore, the size of given vector should at least be size-diag.

Examples

julia> vec=[1; 1; 0; 1; 1; 1; 0]
7-element Vector{Int64}:
 1
 1
 0
 1
 1
 1
 0

julia> SMG2S.Nilp(vec, 3, 8)
┌ Info: the degree of given nilpotent matrix is:
└   degree = 3
Nilpotent{Int64}(1, 8, 3,
 ⋅  ⋅  ⋅  1  ⋅  ⋅  ⋅  ⋅
 ⋅  ⋅  ⋅  ⋅  1  ⋅  ⋅  ⋅
 ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅
 ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  1  ⋅
 ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  1
 ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅
 ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅
 ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅)
source

Construction from specific diagonal offset

SMG2S.NilpMethod
Nilp(nbOne::Ti, diag::Ti, size::Ti) where{Ti <: Integer}

Create a nilpotent matrix object with parameters nbOne, diag and size. size refers to the size of nilpotent matrix to be generated, and nbOne refers to the maximum number of continuous 1 on the non-zero diagonal of generated nilptent matrix. The offset of non-zero diagonal is determined by the parameter diag.

The non-zero diagonal is generated as:

  1. randomly generating an interger number in the interval [1, nbOne]

  2. this number determines the number of continous 1 for this time of sampling

  3. then generating another within the same interval, which determines the number of continuous 0

  4. then re-samling for a new sequence of continuous 1

  5. ...

Examples

julia> SMG2S.Nilp(4, 3, 15)
┌ Info: the degree of given nilpotent matrix is:
└   degree = 3
Nilpotent{Int64}(1, 15, 3,
 ⋅  ⋅  ⋅  1  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅
 ⋅  ⋅  ⋅  ⋅  1  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅
 ⋅  ⋅  ⋅  ⋅  ⋅  1  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅
 ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  1  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅
 ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅
 ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅
 ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅
 ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅
 ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  1  ⋅  ⋅  ⋅
 ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  1  ⋅  ⋅
 ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  1  ⋅
 ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅
 ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅
 ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅
 ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅)
source

Initialization of Matrix

Non-Hermtian Case

SMG2S.initMat!Method
initMat!(matrix::SparseMatrixCSC{Tv, Ti}, diag_l::Ti, diag_u::Ti, size::Ti; scale::Real = 1.0, shift::Real = 0.0, sparsity::Real = 0.9) where {Tv<:Complex, Ti<:Integer}

Initialization of matrix to be generated. This function is for non-Hermitian case, in which the entries of matrix are complex scalars.

In this function, the parameters diag_l and diag_u determine the range ([diag_l, diag_u]) of lower triangular part to be filled. The two parameters should also be negatif, which refer to the offfsets of diagonals in the lower triangular part. The parameter size defines the size of matrix to be generated.

The non-zero elements of the initialized matrices are randomly generated in the interval (0,1). Two optionals parameters shift and scale allow shifting and scaling this interval.

Another optional parameter sparsity is more important. It determines the possility of the elements within the band of diagonal determined by diag_l and diag_u to be non-zeros. In other words, the initalized matrix would be more sparse with a smaller number of sparisty parameter.

Examples

julia> Am=spzeros(ComplexF64, 50, 50);
julia> initMat!(Am, -20, -10, 50)
julia> Am
50×50 SparseMatrixCSC{ComplexF64, Int64} with 335 stored entries:
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⣟⡳⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⣿⣿⣢⣵⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠙⢟⣾⣿⣽⢲⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠙⢽⣿⣛⣿⣵⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠙⠽⣻⡾⣿⣷⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠙⢟⣻⢿⢻⣗⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣽⣯⣻⣳⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣛⢿⡾⣷⣄⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠑⢯⡽⣯⣜⣷⢄⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⠚⠋⠛⠚⠓⠀⠀⠀⠀⠀

Examples

julia> Am=spzeros(ComplexF64, 50, 50);
julia> initMat!(Am, -20, -10, 50, sparsity=0.1)
julia> Am
50×50 SparseMatrixCSC{ComplexF64, Int64} with 36 stored entries:
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠠⢀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠉⠂⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠂⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⢂⠀⠈⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠂⠈⠀⠤⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⢀⢀⠅⠂⠄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠂⠀⠠⠈⠰⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠂⠈⠀⠡⢀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠄⢄⡆⢀⠀⠀⠀⠀⠀⠀

⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀

source

Non-Symmetric Case

SMG2S.initMat!Method
initMat!(matrix::SparseMatrixCSC{Tv, Ti}, diag_l::Ti, diag_u::Ti, size::Ti; scale::Real = 1.0, shift::Real = 0.0, sparsity::Real = 0.9) where {Tv<:Real, Ti<:Integer}

Initialization of matrix to be generated. This function is for non-Symmetric case, in which the entries of matrix are real scalars.

The usage of this function is quite similar as the one for non-Hermitian case, the only difference is that the entries of matrices are real scalars.

Examples

julia> Am=spzeros(Float64, 50, 50);
julia> initMat!(Am, -20, -10, 50, sparsity=0.5)
julia> Am
50×50 SparseMatrixCSC{Float64, Int64} with 178 stored entries:
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠌⡱⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠍⠫⢠⡀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠈⠏⣌⠺⣑⠰⢀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠙⣣⢑⡿⢡⢀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠅⣊⡼⠖⠷⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠉⢀⣫⠇⢛⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠑⠟⡕⣭⠉⣱⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⢐⡚⢘⠔⣡⢄⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠪⡌⡆⣜⣆⢀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠒⠉⠂⠘⠁⠀⠀⠀⠀⠀
source

Set Spectrum

SMG2S.Spectrum!Method
Spectrum!(spec::AbstractVector{Tv}, f::Function, size::Ti) where {Tv<:Complex, Ti<:Integer}

Set the spectrum from user provided function.

Examples

julia> function f(idx::Integer, size = 10)
           return 10 * cos(((idx-1) / 2) * 2 * π / size) + sin(((idx-1) / 2) * 2 * π / size) * im
       end
f (generic function with 2 methods)

julia> vec=zeros(ComplexF64, 10);

julia> Spectrum!(vec, f, 10);

julia> vec
10-element Vector{ComplexF64}:
                  10.0 + 0.0im
     9.510565162951535 + 0.3090169943749474im
     8.090169943749475 + 0.5877852522924731im
     5.877852522924732 + 0.8090169943749475im
    3.0901699437494745 + 0.9510565162951535im
 6.123233995736766e-16 + 1.0im
   -3.0901699437494736 + 0.9510565162951536im
     -5.87785252292473 + 0.8090169943749475im
    -8.090169943749473 + 0.5877852522924732im
    -9.510565162951535 + 0.3090169943749475im
source
SMG2S.Spectrum!Method
Spectrum!(spec::AbstractVector{Tv}, vec::AbstractVector{Tv}, size::Ti) where {Tv<:Complex, Ti<:Integer}

Set the spectrum from user provided vector. In fact, this function only check if the size of given spectrum vector is large enough. And they copy the first size elements of vec into spec.

source

Assembling the Customizations

Non-Hermitian Case

SMG2S.nonhermMethod
nonherm(nbOne::Ti, size::Ti, diag_l::Ti, diag_u::Ti, spectrum::AbstractVector{Tv}) where {Tv<:Complex, Ti<:Integer}

Generate a non hermitian matrix with default nilpotent matrix and default initialization of matrix.

Examples

julia> spec=[1+im, 2, 4, 6, 7-2im, 4+3im, 7, 8, 9, 10.2-im]
10-element Vector{ComplexF64}:
  1.0 + 1.0im
  2.0 + 0.0im
  4.0 + 0.0im
  6.0 + 0.0im
  7.0 - 2.0im
  4.0 + 3.0im
  7.0 + 0.0im
  8.0 + 0.0im
  9.0 + 0.0im
 10.2 - 1.0im

julia> nonherm(3, 10, -8, -2, spec)
10×10 SparseMatrixCSC{ComplexF64, Int64} with 66 stored entries:
   1.04657+1.0im    -0.4959+0.5im  0.0833701+0.0833333im  0.00347223+0.00347222im            ⋅                ⋅               ⋅                     ⋅                ⋅           ⋅
 -0.231523+0.0im     1.9567+0.0im   -1.00012+0.0im        3.02285e-5+0.0im                   ⋅                ⋅               ⋅                     ⋅                ⋅           ⋅
  0.207446+0.0im  -0.115496+0.0im    3.94688+0.0im          -1.00394+0.0im                   ⋅                ⋅               ⋅                     ⋅                ⋅           ⋅
  0.766797+0.0im   0.949636+0.0im   0.347018+0.0im           6.04985+0.0im                   ⋅                ⋅               ⋅                     ⋅                ⋅           ⋅
  0.413475+0.0im   0.847118+0.0im    1.11204+0.0im          0.240384+0.0im           7.05096-2.0im    1.50334-2.5im  0.500002-0.666667im  0.0277777-0.0381944im      ⋅           ⋅
 -0.114481+0.0im   0.314934+0.0im   0.463301+0.0im          0.257056+0.0im         -0.253119+0.0im     3.9802+3.0im  -1.49669+1.5im       -0.166576+0.25im           ⋅           ⋅
  0.592639+0.0im   0.167683+0.0im  -0.318934+0.0im          0.847507+0.0im          0.225334+0.0im  -0.292356+0.0im    6.8867+0.0im       -0.507753+0.0im            ⋅           ⋅
  0.112486+0.0im   0.332264+0.0im   0.799049+0.0im          0.349224+0.0im          0.842714+0.0im    1.37186+0.0im  0.545475+0.0im         8.08213+0.0im            ⋅           ⋅
   0.96467+0.0im    1.36421+0.0im    1.13479+0.0im          0.769023+0.0im         -0.219469+0.0im  -0.196588+0.0im   0.26921+0.0im        0.154841+0.0im        9.0+0.0im  -0.6+0.5im
           ⋅        0.12781+0.0im   0.438092+0.0im           1.12886+0.0im          0.438939+0.0im   0.466332+0.0im  0.160009+0.0im        0.022096+0.0im            ⋅      10.2-1.0im
source
SMG2S.nonhermMethod
nonherm(nbOne::Ti, size::Ti, diag_l::Ti, diag_u::Ti, spectrum::AbstractVector{Tv}, Am::SparseMatrixCSC{Tv, Ti}) where {Tv<:Complex, Ti<:Integer}

Generate a non hermitian matrix with default nilpotent matrix and user-provided initialization of matrix.

Examples

julia> spec=[1+im, 2, 4, 6, 7-2im, 4+3im, 7, 8, 9, 10.2-im]
10-element Vector{ComplexF64}:
  1.0 + 1.0im
  2.0 + 0.0im
  4.0 + 0.0im
  6.0 + 0.0im
  7.0 - 2.0im
  4.0 + 3.0im
  7.0 + 0.0im
  8.0 + 0.0im
  9.0 + 0.0im
 10.2 - 1.0im

julia> Am = spzeros(ComplexF64, 10, 10);
julia> initMat!(Am, -8, -2, 10; scale=0.1, sparsity=0.005)
julia> nonherm(3, 10, -8, -2, spec, Am)
10×10 SparseMatrixCSC{ComplexF64, Int64} with 22 stored entries:
 1.0+1.0im  -0.5+0.5im  0.0833333+0.0833333im  0.00347222+0.00347222im      ⋅          ⋅           ⋅                     ⋅                ⋅           ⋅
     ⋅       2.0+0.0im       -1.0+0.0im                   ⋅                 ⋅          ⋅           ⋅                     ⋅                ⋅           ⋅
     ⋅           ⋅            4.0+0.0im              -1.0+0.0im             ⋅          ⋅           ⋅                     ⋅                ⋅           ⋅
     ⋅           ⋅                ⋅                   6.0+0.0im             ⋅          ⋅           ⋅                     ⋅                ⋅           ⋅
     ⋅           ⋅                ⋅                       ⋅             7.0-2.0im  1.5-2.5im   0.5-0.666667im  0.0277778-0.0381944im      ⋅           ⋅
     ⋅           ⋅                ⋅                       ⋅                 ⋅      4.0+3.0im  -1.5+1.5im       -0.166667+0.25im           ⋅           ⋅
     ⋅           ⋅                ⋅                       ⋅                 ⋅          ⋅       7.0+0.0im            -0.5+0.0im            ⋅           ⋅
     ⋅           ⋅                ⋅                       ⋅                 ⋅          ⋅           ⋅                 8.0+0.0im            ⋅           ⋅
     ⋅           ⋅                ⋅                       ⋅                 ⋅          ⋅           ⋅                     ⋅            9.0+0.0im  -0.6+0.5im
     ⋅           ⋅                ⋅                       ⋅                 ⋅          ⋅           ⋅                     ⋅                ⋅      10.2-1.0im
source
SMG2S.nonhermMethod
nonherm(size::Ti, diag_l::Ti, diag_u::Ti, spectrum::AbstractVector{Tv}, Am::SparseMatrixCSC{Tv, Ti}, nilp::Nilpotent{Ti}) where {Tv<:Complex, Ti<:Integer}

Generate a non hermitian matrix with user-provided nilpotent matrix and initialization of matrix.

Examples

julia> spec=[1+im, 2, 4, 6, 7-2im, 4+3im, 7, 8, 9, 10.2-im]
10-element Vector{ComplexF64}:
  1.0 + 1.0im
  2.0 + 0.0im
  4.0 + 0.0im
  6.0 + 0.0im
  7.0 - 2.0im
  4.0 + 3.0im
  7.0 + 0.0im
  8.0 + 0.0im
  9.0 + 0.0im
 10.2 - 1.0im

julia> Am = spzeros(ComplexF64, 10, 10);
julia> initMat!(Am, -8, -2, 10; scale=0.1, sparsity=0.005)
julia> nilp=SMG2S.Nilp(4, 3, 10)
┌ Info: the degree of given nilpotent matrix is:
└   degree = 2
Nilpotent{Int64}(1, 10, 2,
 ⋅  ⋅  ⋅  1  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅
 ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅
 ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅
 ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅
 ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  1  ⋅  ⋅
 ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅
 ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  1
 ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅
 ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅
 ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅  ⋅)

julia> nonherm(10, -8, -2, spec, Am, nilp)
10×10 SparseMatrixCSC{ComplexF64, Int64} with 13 stored entries:
 1.0+1.0im      ⋅          ⋅      -2.5+0.5im      ⋅          ⋅          ⋅           ⋅          ⋅           ⋅
     ⋅      2.0+0.0im      ⋅           ⋅          ⋅          ⋅          ⋅           ⋅          ⋅           ⋅
     ⋅          ⋅      4.0+0.0im       ⋅          ⋅          ⋅          ⋅           ⋅          ⋅           ⋅
     ⋅          ⋅          ⋅       6.0+0.0im      ⋅          ⋅          ⋅           ⋅          ⋅           ⋅
     ⋅          ⋅          ⋅           ⋅      7.0-2.0im      ⋅          ⋅      -0.5-1.0im      ⋅           ⋅
     ⋅          ⋅          ⋅           ⋅          ⋅      4.0+3.0im      ⋅           ⋅          ⋅           ⋅
     ⋅          ⋅          ⋅           ⋅          ⋅          ⋅      7.0+0.0im       ⋅          ⋅      -1.6+0.5im
     ⋅          ⋅          ⋅           ⋅          ⋅          ⋅          ⋅       8.0+0.0im      ⋅           ⋅
     ⋅          ⋅          ⋅           ⋅          ⋅          ⋅          ⋅           ⋅      9.0+0.0im       ⋅
     ⋅          ⋅          ⋅           ⋅          ⋅          ⋅          ⋅           ⋅          ⋅      10.2-1.0im
source

Non-Symmetric Matrix

SMG2S.nonsymMethod
nonsym(nbOne::Ti, size::Ti, diag_l::Ti, diag_u::Ti, spectrum::AbstractVector{Tv}) where {Tv<:Complex, Ti<:Integer}

Generate a non symmetric matrix with default nilpotent matrix and default initialization of matrix.

The usage of nonsym is the same as the one of nonherm, please refers to that part for more detais.

Please keep in mind the constraints of given spectrum vector and initialization of matrix, click here for more details.

source
SMG2S.nonsymMethod
nonsym(nbOne::Ti, size::Ti, diag_l::Ti, diag_u::Ti, spectrum::AbstractVector{Tv}, Am::SparseMatrixCSC{Tv2, Ti},) where {Tv<:Complex, Tv2<:Real, Ti<:Integer}

Generate a non symmetric matrix with default nilpotent matrix and user-provided initialization of matrix.

The usage of nonsym is the same as the one of nonherm, please refers to that part for more detais.

Please keep in mind the constraints of given spectrum vector and initialization of matrix, click here for more details.

source
SMG2S.nonsymMethod
nonsym(size::Ti, diag_l::Ti, diag_u::Ti, spectrum::AbstractVector{Tv}, Am::SparseMatrixCSC{Tv2, Ti}, nilp::Nilpotent{Ti}) where {Tv<:Complex, Tv2<:Real, Ti<:Integer}

Generate a non symmetric matrix with user-provided nilpotent matrix and initialization of matrix.

The usage of nonsym is the same as the one of nonherm, please refers to that part for more detais.

Please keep in mind the constraints of given spectrum vector and initialization of matrix, click here for more details.

source