Cholesky
JudiLing.make_transform_fac
— FunctionThe first part of make transform matrix, usually used by the learn_paths
function to save time and computing resources.
JudiLing.make_transform_matrix
— FunctionUsing Cholesky decomposition to calculate the transformation matrix from S to C or from C to S.
JudiLing.make_transform_fac
— Methodmake_transform_fac(X::SparseMatrixCSC)
Calculate the first step of Cholesky decomposition for sparse matrices.
JudiLing.make_transform_fac
— Methodmake_transform_fac(X::Matrix)
Calculate the first step of Cholesky decomposition for dense matrices.
JudiLing.make_transform_matrix
— Methodmake_transform_matrix(fac::Union{LinearAlgebra.Cholesky, SuiteSparse.CHOLMOD.Factor}, X::Union{SparseMatrixCSC, Matrix}, Y::Union{SparseMatrixCSC, Matrix})
Second step in calculating the Cholesky decomposition for the transformation matrix.
JudiLing.make_transform_matrix
— Methodmake_transform_matrix(X::SparseMatrixCSC, Y::Matrix)
Use Cholesky decomposition to calculate the transformation matrix from X to Y, where X is a sparse matrix and Y is a dense matrix.
Obligatory Arguments
X::SparseMatrixCSC
: the X matrix, where X is a sparse matrixY::Matrix
: the Y matrix, where Y is a dense matrix
Optional Arguments
method::Symbol = :additive
: whether :additive or :multiplicative decomposition is requiredshift::Float64 = 0.02
: shift value for :additive decompositionmultiplier::Float64 = 1.01
: multiplier value for :multiplicative decompositionoutput_format::Symbol = :auto
: to force output format to dense(:dense) or sparse(:sparse), make it auto(:auto) to determined by the programsparse_ratio::Float64 = 0.05
: the ratio to decide whether a matrix is sparseverbose::Bool = false
: if true, more information will be printed out
Examples
# additive mode
JudiLing.make_transform_matrix(
C,
S,
method = :additive,
shift = 0.02,
verbose = false)
# multiplicative mode
JudiLing.make_transform_matrix(
C,
S,
method = :multiplicative,
multiplier = 1.01,
verbose = false)
# further control of sparsity ratio
JudiLing.make_transform_matrix(
...
output_format = :auto,
sparse_ratio = 0.05,
...)
JudiLing.make_transform_matrix
— Methodmake_transform_matrix(X::Matrix, Y::Union{SparseMatrixCSC, Matrix})
Use the Cholesky decomposition to calculate the transformation matrix from X to Y, where X is a dense matrix and Y is either a dense matrix or a sparse matrix.
Obligatory Arguments
X::Matrix
: the X matrix, where X is a dense matrixY::Union{SparseMatrixCSC, Matrix}
: the Y matrix, where Y is either a sparse or a dense matrix
Optional Arguments
method::Symbol = :additive
: whether :additive or :multiplicative decomposition is requiredshift::Float64 = 0.02
: shift value for :additive decompositionmultiplier::Float64 = 1.01
: multiplier value for :multiplicative decompositionoutput_format::Symbol = :auto
: to force output format to dense(:dense) or sparse(:sparse), make it auto(:auto) to determined by the programsparse_ratio::Float64 = 0.05
: the ratio to decide whether a matrix is sparseverbose::Bool = false
: if true, more information will be printed out
Examples
# additive mode
JudiLing.make_transform_matrix(
C,
S,
method = :additive,
shift = 0.02,
verbose = false)
# multiplicative mode
JudiLing.make_transform_matrix(
C,
S,
method=:multiplicative,
multiplier = 1.01,
verbose = false)
# further control of sparsity ratio
JudiLing.make_transform_matrix(
...
output_format = :auto,
sparse_ratio = 0.05,
...)
JudiLing.make_transform_matrix
— Methodmake_transform_matrix(X::SparseMatrixCSC, Y::SparseMatrixCSC)
Use the Cholesky decomposition to calculate the transformation matrix from X to Y, where X is a sparse matrix and Y is a sparse matrix.
Obligatory Arguments
X::SparseMatrixCSC
: the X matrix, where X is a sparse matrixY::SparseMatrixCSC
: the Y matrix, where Y is a sparse matrix
Optional Arguments
method::Symbol = :additive
: whether :additive or :multiplicative decomposition is requiredshift::Float64 = 0.02
: shift value for :additive decompositionmultiplier::Float64 = 1.01
: multiplier value for :multiplicative decompositionoutput_format::Symbol = :auto
: to force output format to dense(:dense) or sparse(:sparse), make it auto(:auto) to determined by the programsparse_ratio::Float64 = 0.05
: the ratio to decide whether a matrix is sparseverbose::Bool = false
: if true, more information will be printed out
Examples
# additive mode
JudiLing.make_transform_matrix(
C,
S,
method = :additive,
shift = 0.02,
verbose = false)
# multiplicative mode
JudiLing.make_transform_matrix(
C,
S,
method = :multiplicative,
multiplier = 1.01,
verbose = false)
# further control of sparsity ratio
JudiLing.make_transform_matrix(
...
output_format = :auto,
sparse_ratio = 0.05,
...)
JudiLing.format_matrix
— Functionformat_matrix(M::Union{SparseMatrixCSC, Matrix}, output_format=:auto)
Convert output matrix format to either a dense matrix or a sparse matrix.