Operators
Operators are used to transform size distributions. The operators overload the Base or LinearAlgebra methods. Operators fall into two broad categories: operators changing number concentration and spectral density fields (π.N and π.S) and operators that change the sizing vector (π.Dp). The former include πβ + πβ, πβ - πβ, πβ β πβ, πβ / πβ, a β π, T .β π, and A β π, while the latter include a Β· π and T Β· π.
Operator | Description |
---|---|
πβ + πβ | Superposition of the distributions πβ and πβ |
πβ - πβ | Superposition of the distributions πβ and πβ |
a β π | Uniform scaling of the concentration fields by factor a |
π β π | Matrix multiplication of π and concentration |
πβ * πβ | Scaled such that total number concentration equals to N1 β N2 |
πβ / πβ | Ratio of concentration fields of distributions πβ.N and πβ.N |
a Β· π | Uniform scaling of the diameter field of the size distribution by factor a |
T Β· π | Elementwise scaling the diameter field by factor T |
Index
Number Operators
Base.:+
β Method+(πβ::SizeDistribution, πβ::SizeDistribution)
Defines the sum of two size distributions. If diameter grids are not equal, then the diameter grid of n2 is interpolated onto the n1 grid prior to addition.
π© = πβ + πβ
is defined such that
π©.S = πβ.S + πβ.S
π©.N = π©.S .* π.ΞlnD
Example Usage
πβ = lognormal([[120, 90, 1.20]]; d1 = 10.0, d2 = 1000.0, bins = 256)
πβ = lognormal([[90, 140, 1.15]]; d1 = 20.0, d2 = 800.0, bins = 64)
π© = πβ + πβ
Base.:-
β Method-(πβ::SizeDistribution, πβ::SizeDistribution)
Defines the sum of two size distributions. If diameter grids are not equal, then the diameter grid of n2 is interpolated onto the n1 grid prior to addition.
π© = πβ - πβ
is defined such that
π©.S = πβ.S - πβ.S
π©.N = π©.S .* π.ΞlnD
Example Usage
πβ = lognormal([[120, 90, 1.20]]; d1 = 10.0, d2 = 1000.0, bins = 256)
πβ = lognormal([[90, 140, 1.15]]; d1 = 20.0, d2 = 800.0, bins = 64)
π© = πβ - πβ
Base.:*
β Method*(a::Number, π::SizeDistribution)
Multiplication of scalar and size distribution. The net result is a scaling of the number concentration of the spectra by a. The function is symmetric such that a * π == π * a.
Let a denote a number and π denote a size distribution. Then
π© = a * π
is defined such that
π©.N = a * π.N
π©.S = a * π.S
Example Usage
π = lognormal([[120, 90, 1.20]]; d1 = 10.0, d2 = 1000.0, bins = 256)
π© = 2.3 * πβ
Base.:*
β Method*(π::AbstractMatrix, π::SizeDistribution)
Multiplication of matrix and size distribution. The net result is the multiplication of the matrix with number concentration and spectral density fields.
Let π denote an nxn matrix where n equals the number of size bins of π. Then
π© = π * π
is defined such that
π©.N = π * π.N
π©.S = π * π.S
π = lognormal([[100, 100, 1.1]]; d1 = 10.0, d2 = 1000.0, bins = 256)
π = rand(256,256)
π© = π * π
Base.:*
β Method*(πβ::SizeDistribution, πβ::SizeDistribution)
Multiplication of size distribution and a size distribution. The net result is a size distribution that has total number concentration square. For a probability distributions that by definition integrate to unity, this operation corresponds to the product of two random variates with distribution 1 and 2.
Let πβ and πβ denote a two size distribution defined on the same diameter grid. Then
π© = πβ * πβ
is defined such that
Nsq = πβ.N * πβ.N
π©.N = sum(πβ.N) * sum(πβ.N) * Nsq./sum(Nsq)
π©.S = N ./ πβ.ΞdlnD
Example Usage
πβ = lognormal([[120, 90, 1.20]]; d1 = 10.0, d2 = 1000.0, bins = 256)
πβ = lognormal([[90, 140, 1.15]]; d1 = 20.0, d2 = 800.0, bins = 64)
π© = πβ * πβ
Base.:/
β Method/(πβ::SizeDistribution, πβ::SizeDistribution)
Division of size distribution and size distribution. The net result is a size distribution that is the ratio of the concentration vectors.
Let πβ and πβ denote a two size distribution defined on the same diameter grid. Then
π© = πβ / πβ
is defined such that
N = πβ.N ./ πβ.N
S = πβ.S ./ πβ.S
Example Usage
πβ = lognormal([[120, 90, 1.20]]; d1 = 10.0, d2 = 1000.0, bins = 256)
πβ = lognormal([[90, 140, 1.15]]; d1 = 20.0, d2 = 800.0, bins = 64)
π© = πβ / πβ
Size Operators
LinearAlgebra.:β
β Methodβ
(a::Number, π::SizeDistribution)
Multiplication of a scalar and a size distribution. The net result is a uniform diameter shift of the size distribution. The function is symmetric such that a β π == π β a.
Let a denote a floating point scalar and π denote a size distribution. Then
π© = a β
π
is defined such that
π©.Dp = a * π.Dp
Example Usage
a = 2.0
π = lognormal([[300, 100, 1.3]]; d1 = 10.0, d2 = 1000.0, bins = 256)
π© = a β
π
LinearAlgebra.:β
β MethodLinearAlgebra.:β
(A::Vector{<:AbstractFloat}, π::SizeDistribution)
Dot product of vector and size distribution. The net result is diameter dependent shift of the size distribution. The function is symmetric such that A β π == π β A.
Let T denote a floating point vector with the same number of elements as the size distribution π. Then
π© = T β
π
is defined such that
π©.Dp = T .* π.dp
Example Usage
π = lognormal([[100, 100, 1.1]]; d1 = 10.0, d2 = 1000.0, bins = 256)
ΞΌ,Ο = 80.0, 2000.0
T = (1.0 .+ erf.((π.Dp .- ΞΌ)./(sqrt(2Ο))))
π© = T β
π