Distributions

Abstract Types

Distribution Structures

RandLinearAlgebra.UniformType
Uniform <: Distribution

Uniform distribution over the row/column index set of a matrix.

Mathematical Description

During the sampling, the uniform distribution is defined on the domain of row/column indices. If it's compressing from the left, then it means every row index has the same probability weight. If it's compressing from the right, then it means every column index has the same probability weight.

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() or Undef().
  • replace::Bool, if true, then the sampling occurs with replacement; if false, then the sampling occurs without replacement.

Constructor

Uniform(;cardinality=Undef(), replace = false)

Returns

  • A Uniform object.
source
RandLinearAlgebra.UniformRecipeType
UniformRecipe <: DistributionRecipe

The recipe containing all allocations and information for the uniform distribution.

Fields

  • cardinality::C where C<:Cardinality, the cardinality of the compressor. The value is either Left() or Right() or Undef().
  • replace::Bool, an option to replace or not during the sampling process based on the given weights.
  • state_space::Vector{Int64}, the row/column index set.
  • weights::ProbabilityWeights, the weights of each element in the state space.
source
RandLinearAlgebra.L2NormType
L2Norm <: Distribution

Distribution where the probability of selecting a row (or column) is proportional to its squared Euclidean norm, as proposed by Strohmer and Vershynin [10].

Mathematical Description

During the sampling, the distribution is defined on the domain of row/column indices based on their norms. If it's compressing from the left, the probability $p_i$ of selecting row $i$ is: $p_i = \frac{\|A_{i,:}\|_2^2}{\|A\|_F^2}$; If it's compressing from the right, the probability $p_j$ of selecting column $j$ is: $p_j = \frac{\|A_{:,j}\|_2^2}{\|A\|_F^2}$.

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() or Undef(). The default value is Undef().
  • replace::Bool, if true, then the sampling occurs with replacement; if false, then the sampling occurs without replacement. The default value is false.

Constructor

L2Norm(;cardinality=Undef(), replace = false)

Returns

  • A L2Norm object.
source
RandLinearAlgebra.L2NormRecipeType
L2NormRecipe <: DistributionRecipe

The recipe containing all allocations and information for the Strohmer-Vershynin distribution.

Fields

  • cardinality::C where C<:Cardinality, the cardinality of the compressor. The value is either Left() or Right() or Undef().
  • replace::Bool, an option to replace or not during the sampling process based on the given weights.
  • state_space::Vector{Int64}, the row/column index set.
  • weights::ProbabilityWeights, the probability of each element in the state space, calculated as the squared Euclidean norms.
source

Exported Functions

RandLinearAlgebra.complete_distributionFunction
complete_distribution(distribution::Distribution, A::AbstractMatrix)

A function that generates a DistributionRecipe given the arguments.

Arguments

  • distribution::Distribution, a user-specified distribution function for sampling.
  • A::AbstractMatrix, a coefficient matrix.

Outputs

  • A DistributionRecipe object.

Throws

  • ArgumentError if no method for completing the distribution exists for the given distribution type.
source
RandLinearAlgebra.update_distribution!Function
update_distribution!(distribution::DistributionRecipe, A::AbstractMatrix)

A function that updates the DistributionRecipe in place given arguments.

Arguments

  • distribution::DistributionRecipe, a fully initialized realization of distribution.
  • A::AbstractMatrix, a coefficient matrix.

Outputs

  • Modifies the DistributionRecipe in place and returns nothing.

Throws

  • ArgumentError if no method for updating the distribution exists for the given distribution type.
source
RandLinearAlgebra.sample_distribution!Function
sample_distribution!(x::AbstractVector, distribution::DistributionRecipe)

A function that in place updates the x by given DistributionRecipe info.

Arguments

  • x::AbstractVector, an abstract vector to store the sampled indices.
  • distribution::DistributionRecipe, a fully initialized realization of distribution.

Outputs

  • Modifies the x in place by sampling that follows the weights and replacement given by

'DistributionRecipe'.

Throws

  • ArgumentError if no method for sampling from the distribution exists for the given distribution type.
source

Internal Functions