FillArrays.FillArrays
— ModuleFillArrays
module to lazily represent matrices with a single value
diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json index b5a12893..5cb5ad54 100644 --- a/dev/.documenter-siteinfo.json +++ b/dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.10.4","generation_timestamp":"2024-08-19T08:08:38","documenter_version":"1.5.0"}} \ No newline at end of file +{"documenter":{"julia_version":"1.10.4","generation_timestamp":"2024-08-19T10:11:55","documenter_version":"1.5.0"}} \ No newline at end of file diff --git a/dev/index.html b/dev/index.html index a8482ed3..83133d02 100644 --- a/dev/index.html +++ b/dev/index.html @@ -91,16 +91,16 @@ julia> ones(1,5) .+ (_ -> rand()).(fill("vec", 2)) # fused, 10 evaluations 2×5 Matrix{Float64}: 1.00745 1.43924 1.95674 1.99667 1.11008 - 1.19938 1.68253 1.64786 1.74919 1.49138
FillArrays.FillArrays
— ModuleFillArrays
module to lazily represent matrices with a single value
FillArrays.AbstractFill
— TypeAbstractFill{T, N, Axes} <: AbstractArray{T, N}
Supertype for lazy array types whose entries are all equal. Subtypes of AbstractFill
should implement FillArrays.getindex_value
to return the value of the entries.
FillArrays.Falses
— TypeFillArrays.Fill
— TypeFill{T, N, Axes} where {T,N,Axes<:Tuple{Vararg{AbstractUnitRange,N}}}
A lazy representation of an array of dimension N
whose entries are all equal to a constant of type T
, with axes of type Axes
. Typically created by Fill
or Zeros
or Ones
Examples
julia> Fill(7, (2,3))
+ 1.19938 1.68253 1.64786 1.74919 1.49138
FillArrays.FillArrays
— ModuleFillArrays
module to lazily represent matrices with a single value
FillArrays.AbstractFill
— TypeAbstractFill{T, N, Axes} <: AbstractArray{T, N}
Supertype for lazy array types whose entries are all equal. Subtypes of AbstractFill
should implement FillArrays.getindex_value
to return the value of the entries.
FillArrays.Falses
— TypeFillArrays.Fill
— TypeFill{T, N, Axes} where {T,N,Axes<:Tuple{Vararg{AbstractUnitRange,N}}}
A lazy representation of an array of dimension N
whose entries are all equal to a constant of type T
, with axes of type Axes
. Typically created by Fill
or Zeros
or Ones
Examples
julia> Fill(7, (2,3))
2×3 Fill{Int64}, with entries equal to 7
julia> Fill{Float64, 1, Tuple{UnitRange{Int64}}}(7.0, (1:2,))
-2-element Fill{Float64, 1, Tuple{UnitRange{Int64}}} with indices 1:2, with entries equal to 7.0
FillArrays.Fill
— MethodFill(x, dims)
construct lazy version of fill(x, dims)
FillArrays.Fill
— MethodFill(x, dims...)
construct lazy version of fill(x, dims...)
FillArrays.OneElement
— TypeOneElement(val, ind, axesorsize) <: AbstractArray
Represents an array with the specified axes (if its a tuple of AbstractUnitRange
s) or size (if its a tuple of Integer
s), with a single entry set to val
and all others equal to zero, specified by ind
`.
FillArrays.OneElement
— MethodOneElement(val, ind::Int, n::Int)
Creates a length n
vector where the ind
entry is equal to val
, and all other entries are zero.
FillArrays.OneElement
— MethodOneElement(ind::Int, n::Int)
Creates a length n
vector where the ind
entry is equal to 1
, and all other entries are zero.
FillArrays.OneElement
— MethodOneElement{T}(val, ind::Int, n::Int)
Creates a length n
vector where the ind
entry is equal to one(T)
, and all other entries are zero.
FillArrays.Ones
— TypeOnes{T, N, Axes} <: AbstractFill{T, N, Axes}
(lazy ones
with axes)
FillArrays.Ones
— MethodOnes{T}(dims...)
construct lazy version of ones(dims...)
FillArrays.Trues
— TypeTrues = Ones{Bool, N, Axes} where {N, Axes}
Lazy version of trues
with axes. Typically created using Trues(dims)
or Trues(dims...)
Example
julia> T = Trues(1,3)
+2-element Fill{Float64, 1, Tuple{UnitRange{Int64}}} with indices 1:2, with entries equal to 7.0
FillArrays.Fill
— MethodFill(x, dims)
construct lazy version of fill(x, dims)
FillArrays.Fill
— MethodFill(x, dims...)
construct lazy version of fill(x, dims...)
FillArrays.OneElement
— TypeOneElement(val, ind, axesorsize) <: AbstractArray
Represents an array with the specified axes (if its a tuple of AbstractUnitRange
s) or size (if its a tuple of Integer
s), with a single entry set to val
and all others equal to zero, specified by ind
`.
FillArrays.OneElement
— MethodOneElement(val, ind::Int, n::Int)
Creates a length n
vector where the ind
entry is equal to val
, and all other entries are zero.
FillArrays.OneElement
— MethodOneElement(ind::Int, n::Int)
Creates a length n
vector where the ind
entry is equal to 1
, and all other entries are zero.
FillArrays.OneElement
— MethodOneElement{T}(val, ind::Int, n::Int)
Creates a length n
vector where the ind
entry is equal to one(T)
, and all other entries are zero.
FillArrays.Ones
— TypeOnes{T, N, Axes} <: AbstractFill{T, N, Axes}
(lazy ones
with axes)
FillArrays.Ones
— MethodOnes{T}(dims...)
construct lazy version of ones(dims...)
FillArrays.Trues
— TypeTrues = Ones{Bool, N, Axes} where {N, Axes}
Lazy version of trues
with axes. Typically created using Trues(dims)
or Trues(dims...)
Example
julia> T = Trues(1,3)
1×3 Ones{Bool}
julia> Array(T)
1×3 Matrix{Bool}:
- 1 1 1
FillArrays.Zeros
— TypeZeros{T, N, Axes} <: AbstractFill{T, N, Axes}
(lazy zeros
with axes)
FillArrays.Zeros
— MethodZeros{T}(dims...)
construct lazy version of zeros(dims...)
FillArrays.fillsimilar
— Methodfillsimilar(a::AbstractFill, axes...)
creates a fill object that has the same fill value as a
but with the specified axes. For example, if a isa Zeros
then so is the returned object.
FillArrays.getindex_value
— FunctionFillArrays.getindex_value(F::AbstractFill)
Return the value that F
is filled with.
Examples
julia> f = Ones(3);
+ 1 1 1
FillArrays.Zeros
— TypeZeros{T, N, Axes} <: AbstractFill{T, N, Axes}
(lazy zeros
with axes)
FillArrays.Zeros
— MethodZeros{T}(dims...)
construct lazy version of zeros(dims...)
FillArrays.fillsimilar
— Methodfillsimilar(a::AbstractFill, axes...)
creates a fill object that has the same fill value as a
but with the specified axes. For example, if a isa Zeros
then so is the returned object.
FillArrays.getindex_value
— FunctionFillArrays.getindex_value(F::AbstractFill)
Return the value that F
is filled with.
Examples
julia> f = Ones(3);
julia> FillArrays.getindex_value(f)
1.0
@@ -108,14 +108,14 @@
julia> g = Fill(2, 10);
julia> FillArrays.getindex_value(g)
-2
FillArrays.getindex_value
— Methodgetindex_value(A::OneElement)
Return the only non-zero value stored in A
.
If the index at which the value is stored doesn't lie within the valid indices of A
, then this returns zero(eltype(A))
.
Examples
julia> A = OneElement(2, 3)
+2
FillArrays.getindex_value
— Methodgetindex_value(A::OneElement)
Return the only non-zero value stored in A
.
If the index at which the value is stored doesn't lie within the valid indices of A
, then this returns zero(eltype(A))
.
Examples
julia> A = OneElement(2, 3)
3-element OneElement{Int64, 1, Tuple{Int64}, Tuple{Base.OneTo{Int64}}}:
⋅
1
⋅
julia> FillArrays.getindex_value(A)
-1
FillArrays.nzind
— Methodnzind(A::OneElement{T,N}) -> CartesianIndex{N}
Return the index where A
contains a non-zero value.
The indices are not guaranteed to lie within the valid index bounds for A
, and if FillArrays.nzind(A) ∉ CartesianIndices(A)
then all(iszero, A)
. On the other hand, if FillArrays.nzind(A) in CartesianIndices(A)
then A[FillArrays.nzind(A)] == FillArrays.getindex_value(A)
Examples
julia> A = OneElement(2, (1,2), (2,2))
+1
FillArrays.nzind
— Methodnzind(A::OneElement{T,N}) -> CartesianIndex{N}
Return the index where A
contains a non-zero value.
The indices are not guaranteed to lie within the valid index bounds for A
, and if FillArrays.nzind(A) ∉ CartesianIndices(A)
then all(iszero, A)
. On the other hand, if FillArrays.nzind(A) in CartesianIndices(A)
then A[FillArrays.nzind(A)] == FillArrays.getindex_value(A)
Examples
julia> A = OneElement(2, (1,2), (2,2))
2×2 OneElement{Int64, 2, Tuple{Int64, Int64}, Tuple{Base.OneTo{Int64}, Base.OneTo{Int64}}}:
⋅ 2
⋅ ⋅
@@ -124,4 +124,4 @@
CartesianIndex(1, 2)
julia> A[FillArrays.nzind(A)]
-2
FillArrays.unique_value
— Methodunique_value(arr::AbstractArray)
Return only(unique(arr))
without intermediate allocations. Throws an error if arr
does not contain one and only one unique value.
Settings
This document was generated with Documenter.jl version 1.5.0 on Monday 19 August 2024. Using Julia version 1.10.4.