Compressors

Abstract Types

RLinearAlgebra.CompressorType
Compressor

An abstract supertype for structures that contain user-controlled parameters corresponding to techniques that compress a matrix.

source
RLinearAlgebra.CompressorRecipeType
CompressorRecipe

An abstract supertype for structures that contain both the user-controlled parameters in the Compressor and the memory allocations necessary for applying the compression technique to a particular set of matrices and vectors.

source
RLinearAlgebra.CompressorAdjointType
CompressorAdjoint{S<:CompressorRecipe}

A structure for the adjoint of a compression recipe.

Fields

  • Parent::CompressorRecipe, the CompressorRecipe the adjoint is being applied to.
source

Compressor Structures

RLinearAlgebra.CountSketchType
CountSketch <: Compressor

An implementation of the count sketch compression method. See additional details in [1] Section 2.1, in which the CountSketch matrix is equivalently defined as sparse embedding matrix.

Mathematical Description

Let $A$ be an $m \times n$ matrix that we want to compress. If we want to compress $A$ from the left (i.e., we reduce the number of rows), then we construct a Count Sketch matrix $S$ with dimension $s \times m$, where $s$ is the user-specified compression dimension. Each column of $S$ is generated independently by the following steps:

  1. Randomly select an integer between 1 and $s$ to determine the row position of the nonzero entry.
  2. Assign this entry a value of either +1 or -1, chosen uniformly at random.
  3. Set all the other entries in the column to zero.

As a result, each column of S has exactly one nonzero element.

If $A$ is compressed from the right, then we construct a Count Sketch matrix $S$ with dimension $n \times s$, where $s$ is the user-specified compression dimension. Each row of $S$ is generated independently using the following steps:

  1. Randomly select an integer between 1 and $s$ to determine the column position of the nonzero entry.
  2. Assign this entry a value of either +1 or -1, chosen uniformly at random.
  3. Set all other entries in the row to zero.

In this case, each row of S has exactly one nonzero entry. The compressed matrix is then formed by multiplying S A (for left compression) or A S (for right compression).

Fields

  • cardinality::Cardinality, the direction the compression matrix is intended to be applied to a target matrix or operator. Values allowed are Left() or Right().
  • compression_dim::Int64, the target compression dimension. Referred to as $s$ in the mathematical description.
  • type::Type{<:Number}, the type of the elements in the compressor.

Constructor

CountSketch(;carinality=Left(), compression_dim=2, type=Float64)

Keywords

  • cardinality::Cardinality, the direction the compression matrix is intended to be applied to a target matrix or operator. Values allowed are Left() or Right(). By default Left() is chosen.
  • compression_dim, the target compression dimension. Referred to as $s$ in the mathemtical description. By default this is set to 2.
  • type::Type{<:Number}, the type of the elements in the compressor. By default is set to Float64.

Returns

  • A CountSketch object.

Throws

  • ArgumentError if compression_dim is non-positive
  • ArgumentError if Undef() is taken as the input for cardinality
source
RLinearAlgebra.CountSketchRecipeType
CountSketchRecipe <: CompressorRecipe

The recipe containing all allocations and information for the CountSketch compressor.

Fields

  • cardinality::C where C<:Cardinality, the cardinality of the compressor. The value is either Left() or Right().
  • compression_dim::Int64, the target compression dimension.
  • n_rows::Int64, the number of rows of the compression matrix.
  • n_cols::Int64`, the number of columns of the compression matrix.
  • mat::SparseMatrixCSC, the compression matrix stored in a sparse form.
source
RLinearAlgebra.FJLTType
FJLT <: Compressor

An implementation of the Fast Johnson-Lindenstrauss Transform method. This technique applies a sparse matrix, a Walsh-Hadamard transform, and a diagonal sign matrix to produce a sketch. See [2] for additional details.

Mathematical Description

Let $A$ be an $m \times n$ matrix that we want to compress. If we want to compress $A$ from the left (i.e., we reduce the number of rows), then we create a matrix, $S$, with dimension $s \times m$ where $s$ is the compression dimension that is supplied by the user. Here $S=KHD$ where

  • $K$ is a sparse matrix with with dimension $s \times m$, where each entry has probability $q$ of being non-zero, and, if it is non-zero, then its value is drawn from an independent normal distribution with mean $0$ and variance $1/q$;
  • $H$ is a Hadamard matrix of dimension $m \times m$, which is implicitly applied through the fast Walsh-Hadamard transform;
  • $D$ of is a diagonal matrix of dimension $m \times m$ with entries given by independent Rademacher variables.

If we want to compress $A$ from the right (i.e., we reduce the number of columns), then we would apply $S=DHK$ from the right where the dimensions of the matrices are adjusted to reflect the number of columns in $A$.

Fields

  • cardinality::Cardinality, the direction the compression matrix is intended to be applied to a target matrix or operator. Values allowed are Left() or Right().
  • compression_dim::Int64, the target compression dimension. Referred to as $s$ in the mathematical description.
  • block_size::Int64, the number of vectors in the padding matrix.
  • sparsity::Int64, the desired sparsity of the matrix $K$.
  • type::Type{<:Number}, the type of the elements in the compressor.

Constructor

FJLT(;
    cardinality=Left(),
    compression_dim::Int64=2,
    block_size::Int64=10,
    sparsity::Float64=0.0,
    type::Type{N}=Float64,
) where {N<:Number}

Keywords

  • cardinality::Cardinality, the direction the compression matrix is intended to be applied to a target matrix or operator. Values allowed are Left() or Right(). By default Left() is chosen.
  • compression_dim::Int64, the target compression dimension. Referred to as $s$ in the mathematical description. By default this is set to 2.
  • block_size::Int64, the number of vectors in the padding matrix.
  • sparsity::Int64, the desired sparsity of the matrix $K$, by default sparsity will be set to be $\min\left(1/4 \log(n)^2 / m, 1\right)$, see [2].
  • type::Type{<:Number}, the type of elements in the compressor.

Returns

  • A FJLT object.

Throws

  • ArgumentError if compression_dim is non-positive, if sparsity is not in $[0,1]$, or if block_size is non-positive.
source
RLinearAlgebra.FJLTRecipeType
FJLTRecipe{C<:Cardinality, S<:SparseMatrixCSC, M<:AbstractMatrix} <: CompressorRecipe

The recipe containing all allocations and information for the FJLT compressor.

Fields

  • cardinality::Cardinality, the direction the compression matrix is intended to be applied to a target matrix or operator. Values allowed are Left() or Right().
  • n_rows::Int64, the number of rows of the compression matrix.
  • n_cols::Int64, the number of columns of the compression matrix.
  • sparsity:Float64, the sparsity, $q$, of the sparse component, $K$.
  • scale::Float64, the factor to ensure the isopmorphism of the sketch.
  • op::SparseMatrixCSC, the sparse matrix $K$ in the mathematical description.
  • signs::BitVector, the vector of signs where 0 indicates negative one and 1 indicates positive one.
  • padding::AbstractMatrix, the matrix containing the padding for the matrix being sketched.

Constructor

FJLTRecipe(
    compression_dim::Int64, 
    block_size::Int64,
    cardinality::C where {C<:Cardinality},
    sparsity::Float64,
    A::AbstractMatrix, 
    type::Type{<:Number}
)

Keywords

  • compression_dim, the target compression dimension. Referred to as $s$ in the mathemtical description. By default this is set to 2.
  • block_size::Int64, the number of columns in the padding memory buffer.
  • cardinality::Cardinality, the direction the compression matrix is intended to be applied to a target matrix or operator. Values allowed are Left() or Right(). By default Left() is chosen.
  • sparsity::Vector{Number}, the expected sparsity of the Sparse operator matrix.
  • A::AbstractMatrix, the matrix being compressed.
  • type::Type{<:Number}, the type of elements in the compressor.
Info

If the sparsity parameter is set to 0.0, then the sparsity will be set to $\min\left(1/4 \log(n)^2 / m, 1\right)$, see [2].

Returns

  • A FJLTRecipe object.
source
RLinearAlgebra.GaussianType
Gaussian <: Compressor

A specification for a Gaussian compressor.

Mathematical Description

Let $A$ be an $m \times n$ matrix that we want to compress.

If we want to compress $A$ from the left (i.e., we reduce the number of rows), then we create a Gaussian sketch matrix, $S$, with dimension $s \times m$ where $s$ is the compression dimension that is supplied by the user. Each entry of $S$ is generated independently following N(0, 1/s), namely, a Gaussian distribution with mean being zero and variance being 1 divided by the compression dimension.

If $A$ is compressed from the right, then we create a Gaussian sketch matrix, $S$, with dimension $n \times s$, where $s$ is the compression dimension that is supplied by the user. Each entry of $S$ is generated independently following N(0, 1/s), namely, a Gaussian distribution with mean being zero and variance being 1 divided by the compression dimension.

Fields

  • cardinality::Cardinality, the direction the compression matrix is intended to be applied to a target matrix or operator. Values allowed are Left() or Right().
  • compression_dim::Int64, the target compression dimension. Referred to as $s$ in the mathematical description.
  • type::Type{<:Number}, the type of the elements in the compressor.

Constructor

Gaussian(;cardinality=Left(), compression_dim=2, type=Float64)

Arguments

  • cardinality::Cardinality, the direction the compression matrix is intended to be applied to a target matrix or operator. Values allowed are Left() or Right(). By default Left() is chosen.
  • compression_dim::Int64, the target compression dimension. Referred to as $s$ in the mathemtical description. By default this is set to 2.
  • type::Type{<:Number}, the type of elements in the compressor.

Returns

  • A Gaussian object.

Throws

  • ArgumentError if compression_dim is non-positive
source
RLinearAlgebra.GaussianRecipeType
GaussianRecipe <: CompressorRecipe

The recipe containing all allocations and information for the Gaussian compressor.

Fields

  • cardinality::C where C<:Cardinality, the cardinality of the compressor. The

value is either Left() or Right().

  • compression_dim::Int64, the target compression dimension.
  • n_rows::Int64, the number of rows of the compression matrix.
  • n_cols::Int64, the number of columns of the compression matrix.
  • scale::Number, the standard deviation of Gaussian distribution during the

compression matrix generation.

  • op::Matrix{Float64}, the Gaussian compression matrix.
source
RLinearAlgebra.SamplingType
Sampling <: Compressor

This method subsets the rows or columns of a matrix according to a user-supplied distribution. The size of the subset is also provided by the user.

Mathematical Description

Let $A$ be an $m \times n$ matrix that we want to compress.

If we want to compress $A$ from the left (i.e., we reduce the number of rows), then we create an index set to contain all the indices of selected rows. The indices are chosen by sampling over all the rows with the user-specified distribution in the distribution field.

If $A$ is compressed from the right (i.e., we reduce the number of columns), then we create an index set to contain all the indices of selected columns. The indices are chosen by sampling over all the columns with the user-specified distribution in the distribution field.

Fields

  • cardinality::Cardinality, the direction the compression matrix is intended to be applied to a target matrix or operator. Values allowed are Left() or Right().
  • compression_dim::Int64, the target compression dimension.
  • distribution::Distribution, the distribution being used to assign probability weights on the indices.

Constructor

Sampling(;cardinality = Left(), compression_dim = 2, distribution)

Arguments

  • cardinality::Cardinality, the direction the compression matrix is intended to be applied to a target matrix or operator. Values allowed are Left() or Right(). By default Left() is chosen.
  • compression_dim::Int64, the target compression dimension. By default this is set to 2.
  • distribution::Distribution, the distribution being used to assign probability weights on the indices. By default this is set as Uniform distribution.

Returns

  • A Sampling object.

Throws

  • ArgumentError if compression_dim is non-positive
  • ArgumentError if Undef() is taken as the input for cardinality
source
RLinearAlgebra.SamplingRecipeType
SamplingRecipe{C<:Cardinality} <: CompressorRecipe

The recipe containing all allocations and information for the sampling compressor.

Fields

  • cardinality::Cardinality, the cardinality of the compressor. The value is either Left() or Right().
  • compression_dim::Int64, the target compression dimension.
  • n_rows::Int64, number of rows of compression matrix.
  • n_cols::Int64, number of columns of compression matrix.
  • distribution_recipe::DistributionRecipe, the user-specified distribution recipe.
  • idx::Vector{Int64}, the index set that contains all the chosen indices.
  • idx_v::SubArray, the view of the idx.
source
RLinearAlgebra.SparseSignType
SparseSign <: Compressor

An implementation of the sparse sign compression method. This method forms a sparse matrix with a fixed number of non-zeros per row or column depending on the direction that the compressor is being applied. See Section 9.2 of [3] for additional details.

Mathematical Description

Let $A$ be an $m \times n$ matrix that we want to compress. If we want to compress $A$ from the left (i.e., we reduce the number of rows), then we create a sparse sign matrix, $S$, with dimension $s \times m$ where $s$ is the compression dimension that is supplied by the user. In this case, each column of $S$ is generated independently by the following steps:

  1. Randomly choose nnz components of the the $s$ components of the column. Note, nnz is supplied by the user.
  2. For each selected component, randomly set it either to $-1/\sqrt{\text{nnz}}$ or $1/\sqrt{\text{nnz}}$ with equal probability.
  3. Set the remaining components of the column to zero.

If $A$ is compressed from the right, then we create a sparse sign matrix, $S$, with dimension $n \times s$, where $s$ is the compression dimension that is supplied by the user. In this case, each row of $S$ is generated independently by the following steps:

  1. Randomly choose nnz components fo the $s$ components of the row. Note, nnz is supplied by the user.
  2. For each selected component, randomly set it either to $-1/\sqrt{\text{nnz}}$ or $1/\sqrt{\text{nnz}}$ with equal probability.
  3. Set the remaining components of the row to zero.

Fields

  • cardinality::Cardinality, the direction the compression matrix is intended to be applied to a target matrix or operator. Values allowed are Left() or Right().
  • compression_dim::Int64, the target compression dimension. Referred to as $s$ in the mathematical description.
  • nnz::Int64, the target number of nonzeros for each column or row of the spares sign matrix.
  • type::Type{<:Number}, the type of the elements in the compressor.

Constructor

SparseSign(;carinality=Left(), compression_dim=2, nnz::Int64=8, type=Float64)

Keywords

  • carinality::Cardinality, the direction the compression matrix is intended to be applied to a target matrix or operator. Values allowed are Left() or Right(). By default Left() is chosen.
  • compression_dim, the target compression dimension. Referred to as $s$ in the mathemtical description. By default this is set to 2.
  • nnz::Int64, the number of non-zeros per row/column in the sampling matrix. By default this is set to min(compressiond_dim, 8).
  • type::Type{<:Number}, the type of elements in the compressor.

Returns

  • A SparseSign object.

Throws

  • ArgumentError if compression_dim is non-positive, if nnz is exceeds compression_dim, or if nnz is non-positive.
source
RLinearAlgebra.SparseSignRecipeType
SparseSignRecipe{C<:Cardinality} <: CompressorRecipe

The recipe containing all allocations and information for the SparseSign compressor.

Fields

  • cardinality::Cardinality, the direction the compression matrix is intended to

be applied to a target matrix or operator. Values allowed are Left() or Right().

  • n_rows::Int64, the number of rows of the compression matrix.
  • n_cols::Int64, the number of columns of the compression matrix.
  • nnz::Int64, the number of non-zero entries in each row if cardinality==Left or the

number of non-zero entries each column if cardinality==Right.

  • scale::Vector{Number}, the set of values of the non-zero entries of the Spares Sign

compression matrix.

  • op::SparseMatrixCSC, the Spares Sign compression matrix.

Constructors

SparseSignRecipe(
    cardinality::C where C<:Cardinality,
    compression_dim::Int64, 
    A::AbstractMatrix, 
    nnz::Int64, 
    type::Type{<:Number}
)

An external constructor of SparseSignRecipe that is dispatched based on the value of cardinality. See SparseSign for additional details.

Arguments

  • cardinality::C where C<:Cardinality, the cardinality of the compressor. The value is either Left() or Right()
  • compression_dim::Int64, the target compression dimension.
  • A::AbstractMatrix, a target matrix for compression.
  • nnz::Int64, the number of nonzeros in the Sparse Sign compression matrix.
  • type::Type{<:Number}, the data type for the entries of the compression matrix.

Returns

  • A SparseSignRecipe object.
Use `complete_compressor`

While an external constructor is provided, it is mainly for internal use. To ensure cross library compatibility please use complete_compressor for forming the SparseSignRecipe.

source
RLinearAlgebra.SRHTType
SRHT <: Compressor

An implementation of the Subsampled Randomized Hadamard Transform (SRHT) method. This technique applies a subsampling matrix, a Walsh-Hadamard transform, and a diagonal sign matrix to produce a sketch. See [4] for additional details.

Mathematical Description

Let $A$ be an $m \times n$ matrix that we want to compress. If we want to compress $A$ from the left (i.e., we reduce the number of rows), then we create a matrix, $S$, with dimension $s \times m$ where $s$ is the compression dimension that is supplied by the user. Here $S=KHD$ where

  • $K$ is a matrix with with dimension $s \times m$, where the rows are made up of a random sample of the rows of a $m \times m$ identity matrix.
  • $H$ is a Hadamard matrix of dimension $m \times m$, which is implicitly applied through the fast Walsh-Hadamard transform;
  • $D$ of is a diagonal matrix of dimension $m \times m$ with entries given by independent Rademacher variables.

If we want to compress $A$ from the right (i.e., we reduce the number of columns), then we would apply $S=DHK$ from the right where the dimensions of the matrices are adjusted to reflect the number of columns in $A$.

Fields

  • cardinality::Cardinality, the direction the compression matrix is intended to be applied to a target matrix or operator. Values allowed are Left() or Right().
  • compression_dim::Int64, the target compression dimension. Referred to as $s$ in the mathematical description.
  • block_size::Int64, the number of vectors in the padding matrix.
  • type::Type{<:Number}, the type of the elements in the compressor.

Constructor

SRHT(;
    cardinality = Left(),
    compression_dim::Int64=2,
    block_size::Int64=10,
    type::Type{N}=Float64
) where {N <: Number}

Keywords

  • cardinality::Cardinality, the direction the compression matrix is intended to be applied to a target matrix or operator. Values allowed are Left() or Right(). By default Left() is chosen.
  • compression_dim::Int64, the target compression dimension. Referred to as $s$ in the mathematical description. By default this is set to 2.
  • block_size::Int64, the number of vectors in the padding matrix.
  • type::Type{<:Number}, the type of elements in the compressor.

Returns

  • A SRHT object.

Throws

  • ArgumentError if compression_dim is non-positive or if block_size is non-positive.
  • ArgumentError if Cardinality is not either Left or Right.
source
RLinearAlgebra.SRHTRecipeType
SRHTRecipe{C<:Cardinality, M<:AbstractMatrix} <: CompressorRecipe

The recipe containing all allocations and information for the SRHT compressor.

Fields

  • cardinality::Cardinality, the direction the compression matrix is intended to be applied to a target matrix or operator. Values allowed are Left() or Right().
  • n_rows::Int64, the number of rows of the compression matrix.
  • n_cols::Int64, the number of columns of the compression matrix.
  • scale::Float64, the factor to ensure the isopmorphism of the sketch.
  • op::Vector{Int64}, the vector of indices to be subsampled.
  • signs::BitVector, the vector of signs where 0 indicates negative one and 1 indicates positive one.
  • padding::AbstractMatrix, the matrix containing the padding for the matrix being sketched.

Constructor

SRHTRecipe(
    compression_dim::Int64,
    block_size::Int64,
    cardinality::Left,
    A::AbstractMatrix,
    type::Type{<:Number}
)

Keywords

  • compression_dim::Int64, the target compression dimension. Referred to as $s$ in the mathematical description.
  • block_size::Int64, the number of vectors in the padding matrix.
  • cardinality::Left, the direction the compression matrix is intended to be applied to a target matrix or operator. Values allowed are Left() or Right().
  • A::AbstractMatrix, the matrix being compressed.
  • type::Type{<:Number}, the type of elements in the compressor.
source

Exported Functions

RLinearAlgebra.complete_compressorFunction
complete_compressor(compressor::Compressor, A::AbstractMatrix)

A function that generates a CompressorRecipe given the arguments.

Arguments

  • compressor::Compressor, a user-specified compression method.
  • A::AbstractMatrix, a target matrix for compression.

Returns

  • A CompressorRecipe object.

Throws

  • ArgumentError if no method for completing the compressor exists for the given arguments.
source
complete_compressor(compressor::Compressor, A::AbstractMatrix, b::AbstractVector)

A function that generates a CompressorRecipe given the arguments.

Arguments

  • compressor::Compressor, a user-specified compression method.
  • A::AbstractMatrix, a target matrix for compression.
  • b::AbstractVector, a possible target vector for compression.

Returns

  • A CompressorRecipe object.

Throws

  • ArgumentError if no method for completing the compressor exists for the given arguments.
source
complete_compressor(
    compressor::Compressor, 
    x::AbstractVector
    A::AbstractMatrix, 
    b::AbstractVector, 
)

A function that generates a CompressorRecipe given the arguments.

Arguments

  • compressor::Compressor, a user-specified compression method.
  • x::AbstractVector, a vector that ususally represents a current iterate typically used in a solver.
  • A::AbstractMatrix, a target matrix for compression.
  • b::AbstractVector, a possible target vector for compression.

Returns

  • A CompressorRecipe object.

Throws

  • ArgumentError if no method for completing the compressor exists for the given arguments.
source
RLinearAlgebra.update_compressor!Function
update_compressor!(S::CompressorRecipe)

A function that updates the CompressorRecipe in place given arguments.

Arguments

  • S::CompressorRecipe, a fully initialized realization for a compression method for a specific matrix or collection of matrices and vectors.

Returns

  • nothing

Throws

  • ArgumentError if no method exists for updating the compressor exists.
source
update_compressor!(S::CompressorRecipe, A::AbstractMatrix)

A function that updates the CompressorRecipe in place given arguments.

Arguments

  • S::CompressorRecipe, a fully initialized realization for a compression method for a specific matrix or collection of matrices and vectors.
  • A::AbstractMatrix, a target matrix for compression.

Returns

  • nothing

Throws

  • ArgumentError if no method exists for updating the compressor exists.
source
update_compressor!(S::CompressorRecipe, A::AbstractMatrix, b::AbstractVector)

A function that updates the CompressorRecipe in place given arguments.

Arguments

  • S::CompressorRecipe, a fully initialized realization for a compression method for a specific matrix or collection of matrices and vectors.
  • A::AbstractMatrix, a target matrix for compression.
  • b::AbstractVector, a possible target vector for compression.

Returns

  • nothing

Throws

  • ArgumentError if no method exists for updating the compressor exists.
source
update_compressor!(
    S::CompressorRecipe, 
    A::AbstractMatrix, 
    b::AbstractVector,
    x::AbstractMatrix
)

A function that updates the CompressorRecipe in place given arguments.

Arguments

  • S::CompressorRecipe, a fully initialized realization for a compression method for a specific matrix or collection of matrices and vectors.
  • x::AbstractVector, a vector that ususally represents a current iterate typically used in a solver.
  • A::AbstractMatrix, a target matrix for compression.
  • b::AbstractVector, a possible target vector for compression.

Returns

  • nothing

Throws

  • ArgumentError if no method exists for updating the compressor exists.
source

Internal Functions

RLinearAlgebra.left_mul_dimcheckFunction
left_mul_dimcheck(C::AbstractMatrix, S::CompressorRecipe, A::AbstractMatrix)

A function that checks the compatibility of arguments for multiplication from the left.

Arguments

  • C::AbstractMatrix, a matrix where the output will be stored.
  • S::CompressorRecipe, a fully initialized realization for a compression method for a specific matrix or collection of matrices and vectors.
  • A::AbstractMatrix, a target matrix for compression.

Returns

  • nothing

Throws

  • DimensionMismatch if dimensions of arguments are not compatible for multiplication.
source
left_mul_dimcheck(C::AbstractMatrix, S::CompressorAdjoint, A::AbstractMatrix)

A function that checks the compatibility of arguments for multiplication from the left.

Arguments

  • C::AbstractMatrix, a matrix where the output will be stored.
  • S::CompressorAdjoint, the representation of an adjoint of a compression operator.
  • A::AbstractMatrix, a target matrix for compression.

Returns

  • nothing

Throws

  • DimensionMismatch if dimensions of arguments are not compatible for multiplication.
source
RLinearAlgebra.right_mul_dimcheckFunction
right_mul_dimcheck(C::AbstractMatrix, A::AbstractMatrix, S::CompressorRecipe)

A function that checks the compatibility of arguments for multiplication from the right.

Arguments

  • C::AbstractMatrix, a matrix where the output will be stored.
  • A::AbstractMatrix, a target matrix for compression.
  • S::CompressorRecipe, a fully initialized realization for a compression method for a specific matrix or collection of matrices and vectors.

Returns

  • nothing

Throws

  • DimensionMismatch if dimensions of arguments are not compatible for multiplication.
source
right_mul_dimcheck(C::AbstractMatrix, A::AbstractMatrix, S::CompressorAdjoint)

A function that checks the compatibility of arguments for multiplication from the right.

Arguments

  • C::AbstractMatrix, a matrix where the output will be stored.
  • A::AbstractMatrix, a target matrix for compression.
  • S::CompressorAdjoint, the representation of an adjoint of a compression operator.

Returns

  • nothing

Throws

  • DimensionMismatch if dimensions of arguments are not compatible for multiplication.
source
RLinearAlgebra.sparse_idx_update!Function
sparse_idx_update!(
    values::Vector{Int64}, 
    max_sample_val::Int64, 
    n_samples::Int64, 
    sample_size::Int64
)

Implicitly splits values into n_samples components of size sample_size. On each component, replaces the entries of each component with a random sample without replacement of size sample_size from the set 1:max_sample_val.

Warn

values should have length equal to sample_size*n_samples, but this is not checked.

Arguments

  • values::Vector{Int64}, a vector containing samples from 1:max_sample_val.
  • max_sample_val::In64, implicitly supplies the set from which to sample, 1:max_sample_val.
  • n_samples::Int64, the number of components that values is implicitly split into.
  • sample_size::Int64, the size each component that values is split into.

Returns

  • nothing
source
RLinearAlgebra.fwht!Function
fwht!(x::AbstractVector, signs::BitVector; scaling::Int64 = 1)

Performs an in-place Fast Walsh Hadamard Transform on the vector x. signs allows the user to input a boolean vector that flips the signs of the entries of the vector x before applying the transform. scaling allows the user to scale the result of the transform. Choosing a scaling of 1/sqrt{size(x)} will result in the FWHT being an orthogonal transform.

Arguments

  • x::AbstractVector, the vector the FJLT will be applied to.
  • signs::Vector{Bool}, whether the sign of each entry is positive or negative.

Keywords

  • scaling::Number, how much the vector is scaled, by default this is 1.

Returns

  • nothing
source