Mercurial > repos > public > sbplib_julia
changeset 838:76e5682d0e52 feature/setup_documenter
Fix a bunch of docstring mistakes
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Fri, 14 Jan 2022 09:19:07 +0100 |
parents | 126e169bb0b7 |
children | d138a3e9fd67 |
files | src/DiffOps/DiffOps.jl src/LazyTensors/lazy_array.jl src/LazyTensors/lazy_tensor_operations.jl src/LazyTensors/tensor_mapping.jl src/StaticDicts/StaticDicts.jl |
diffstat | 5 files changed, 29 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/src/DiffOps/DiffOps.jl Fri Jan 14 09:01:12 2022 +0100 +++ b/src/DiffOps/DiffOps.jl Fri Jan 14 09:19:07 2022 +0100 @@ -93,6 +93,7 @@ """ + BoundaryCondition A BoundaryCondition should implement the method sat(::DiffOp, v::AbstractArray, data::AbstractArray, ...) """
--- a/src/LazyTensors/lazy_array.jl Fri Jan 14 09:01:12 2022 +0100 +++ b/src/LazyTensors/lazy_array.jl Fri Jan 14 09:19:07 2022 +0100 @@ -42,10 +42,10 @@ """ LazyElementwiseOperation{T,D,Op} <: LazyArray{T,D} -Struct allowing for lazy evaluation of elementwise operations on AbstractArrays. +Struct allowing for lazy evaluation of elementwise operations on `AbstractArray`s. -A LazyElementwiseOperation contains two arrays together with an operation. -The operations are carried out when the LazyElementwiseOperation is indexed. +A `LazyElementwiseOperation` contains two arrays together with an operation. +The operations are carried out when the `LazyElementwiseOperation` is indexed. """ struct LazyElementwiseOperation{T,D,Op,T1<:AbstractArray{T,D},T2<:AbstractArray{T,D}} <: LazyArray{T,D} a::T1
--- a/src/LazyTensors/lazy_tensor_operations.jl Fri Jan 14 09:01:12 2022 +0100 +++ b/src/LazyTensors/lazy_tensor_operations.jl Fri Jan 14 09:19:07 2022 +0100 @@ -76,7 +76,7 @@ """ TensorMappingComposition{T,R,K,D} -Lazily compose two TensorMappings, so that they can be handled as a single TensorMapping. +Lazily compose two `TensorMapping`s, so that they can be handled as a single `TensorMapping`. """ struct TensorMappingComposition{T,R,K,D, TM1<:TensorMapping{T,R,K}, TM2<:TensorMapping{T,K,D}} <: TensorMapping{T,R,D} t1::TM1 @@ -165,8 +165,8 @@ apply_transpose(tmi::IdentityMapping{T,D}, v::AbstractArray{T,D}, I::Vararg{Any,D}) where {T,D} = v[I...] """ -Base.:∘(tm, tmi) -Base.:∘(tmi, tm) + Base.:∘(tm, tmi) + Base.:∘(tmi, tm) Composes a `Tensormapping` `tm` with an `IdentityMapping` `tmi`, by returning `tm` """ @@ -316,7 +316,7 @@ slice_tuple(t, Val(l), Val(u)) Get a slice of a tuple in a type stable way. -Equivalent to t[l:u] but type stable. +Equivalent to `t[l:u]` but type stable. """ function slice_tuple(t,::Val{L},::Val{U}) where {L,U} return ntuple(i->t[i+L-1], U-L+1) @@ -327,7 +327,7 @@ Split the tuple `t` into two parts. the first part is `M` long. E.g -``` +```julia split_tuple((1,2,3,4),Val(3)) -> (1,2,3), (4,) ``` """ @@ -357,17 +357,19 @@ flatten_tuple(t::Tuple) = ((flatten_tuple.(t)...)...,) # simplify? flatten_tuple(ts::Vararg) = flatten_tuple(ts) -""" - LazyOuterProduct(tms...) +@doc raw""" + LazyOuterProduct(tms...) Creates a `TensorMappingComposition` for the outerproduct of `tms...`. This is done by separating the outer product into regular products of outer products involving only identity mappings and one non-identity mapping. First let ```math -A = A_{I,J} -B = B_{M,N} -C = C_{P,Q} +\begin{aligned} +A &= A_{I,J} \\ +B &= B_{M,N} \\ +C &= C_{P,Q} \\ +\end{aligned} ``` where ``I``, ``M``, ``P`` are multi-indexes for the ranges of ``A``, ``B``, ``C``, and ``J``, ``N``, ``Q`` are multi-indexes of the domains. @@ -385,10 +387,12 @@ ```math A⊗B⊗C = (A⊗I_{|M|}⊗I_{|P|})(I_{|J|}⊗B⊗I_{|P|})(I_{|J|}⊗I_{|N|}⊗C) ``` -where |.| of a multi-index is a vector of sizes for each dimension. ``I_v`` denotes the identity tensor of size ``v[i]`` in each direction +where ``|⋅|`` of a multi-index is a vector of sizes for each dimension. ``I_v`` denotes the identity tensor of size ``v[i]`` in each direction To apply ``A⊗B⊗C`` we evaluate +```math (A⊗B⊗C)v = [(A⊗I_{|M|}⊗I_{|P|}) [(I_{|J|}⊗B⊗I_{|P|}) [(I_{|J|}⊗I_{|N|}⊗C)v]]] +``` """ function LazyOuterProduct end export LazyOuterProduct
--- a/src/LazyTensors/tensor_mapping.jl Fri Jan 14 09:01:12 2022 +0100 +++ b/src/LazyTensors/tensor_mapping.jl Fri Jan 14 09:19:07 2022 +0100 @@ -1,21 +1,24 @@ """ TensorMapping{T,R,D} -Describes a mapping of a D dimension tensor to an R dimension tensor. +Describes a mapping of a `D` dimension tensor to an `R` dimension tensor. The action of the mapping is implemented through the method - +```julia apply(t::TensorMapping{T,R,D}, v::AbstractArray{T,D}, I::Vararg) where {R,D,T} +``` The size of the range and domain that the operator works with should be returned by the functions - +```julia range_size(::TensorMapping) domain_size(::TensorMapping) - +``` to allow querying for one or the other. Optionally the action of the transpose may be defined through +```julia apply_transpose(t::TensorMapping{T,R,D}, v::AbstractArray{T,D}, I::Vararg) where {R,D,T} +``` """ abstract type TensorMapping{T,R,D} end export TensorMapping @@ -37,11 +40,13 @@ export apply_transpose """ + range_dim(::TensorMapping) Return the dimension of the range space of a given mapping """ range_dim(::TensorMapping{T,R,D}) where {T,R,D} = R """ + domain_dim(::TensorMapping) Return the dimension of the domain space of a given mapping """ domain_dim(::TensorMapping{T,R,D}) where {T,R,D} = D
--- a/src/StaticDicts/StaticDicts.jl Fri Jan 14 09:01:12 2022 +0100 +++ b/src/StaticDicts/StaticDicts.jl Fri Jan 14 09:19:07 2022 +0100 @@ -10,7 +10,7 @@ The immutable nature means that `StaticDict` can be compared with `===`, in constrast to regular `Dict` or `ImmutableDict` which can not. (See -https://github.com/JuliaLang/julia/issues/4648 for details) One important +<https://github.com/JuliaLang/julia/issues/4648> for details) One important aspect of this is that `StaticDict` can be used in a struct while still allowing the struct to be comared using the default implementation of `==` for structs.