changeset 944:4a4ef4bf6cb9 feature/tensormapping_application_promotion

Move exports to the top of the files
author Jonatan Werpers <jonatan@werpers.com>
date Thu, 10 Mar 2022 16:59:43 +0100
parents fb060e98ac0a
children 1f41cf9454f2
files src/LazyTensors/lazy_tensor_operations.jl src/LazyTensors/tensor_mapping.jl
diffstat 2 files changed, 16 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/src/LazyTensors/lazy_tensor_operations.jl	Thu Mar 10 16:57:01 2022 +0100
+++ b/src/LazyTensors/lazy_tensor_operations.jl	Thu Mar 10 16:59:43 2022 +0100
@@ -1,3 +1,13 @@
+export LazyTensorMappingApplication
+export LazyTensorMappingTranspose
+export TensorMappingComposition
+export LazyLinearMap
+export IdentityMapping
+export InflatedTensorMapping
+export LazyOuterProduct
+export ⊗
+export SizeMismatch
+
 """
     LazyTensorMappingApplication{T,R,D} <: LazyArray{T,R}
 
@@ -17,7 +27,6 @@
     end
 end
 # TODO: Do boundschecking on creation!
-export LazyTensorMappingApplication
 
 Base.getindex(ta::LazyTensorMappingApplication{T,R}, I::Vararg{Any,R}) where {T,R} = apply(ta.t, ta.o, I...)
 Base.size(ta::LazyTensorMappingApplication) = range_size(ta.t)
@@ -45,7 +54,6 @@
 struct LazyTensorMappingTranspose{T,R,D, TM<:TensorMapping{T,R,D}} <: TensorMapping{T,D,R}
     tm::TM
 end
-export LazyTensorMappingTranspose
 
 # # TBD: Should this be implemented on a type by type basis or through a trait to provide earlier errors?
 # Jonatan 2020-09-25: Is the problem that you can take the transpose of any TensorMapping even if it doesn't implement `apply_transpose`?
@@ -92,7 +100,6 @@
         return new{T,R,K,D, typeof(t1), typeof(t2)}(t1,t2)
     end
 end
-export TensorMappingComposition
 
 range_size(tm::TensorMappingComposition) = range_size(tm.t1)
 domain_size(tm::TensorMappingComposition) = domain_size(tm.t2)
@@ -129,7 +136,6 @@
         return new{T,R,D,RD,AA}(A,range_indicies,domain_indicies)
     end
 end
-export LazyLinearMap
 
 range_size(llm::LazyLinearMap) = size(llm.A)[[llm.range_indicies...]]
 domain_size(llm::LazyLinearMap) = size(llm.A)[[llm.domain_indicies...]]
@@ -157,7 +163,6 @@
 struct IdentityMapping{T,D} <: TensorMapping{T,D,D}
     size::NTuple{D,Int}
 end
-export IdentityMapping
 
 IdentityMapping{T}(size::NTuple{D,Int}) where {T,D} = IdentityMapping{T,D}(size)
 IdentityMapping{T}(size::Vararg{Int,D}) where {T,D} = IdentityMapping{T,D}(size)
@@ -214,7 +219,6 @@
         return new{T,R,D,D_before,R_middle,D_middle,D_after, typeof(tm)}(before, tm, after)
     end
 end
-export InflatedTensorMapping
 """
     InflatedTensorMapping(before, tm, after)
     InflatedTensorMapping(before,tm)
@@ -400,7 +404,6 @@
 ```
 """
 function LazyOuterProduct end
-export LazyOuterProduct
 
 function LazyOuterProduct(tm1::TensorMapping{T}, tm2::TensorMapping{T}) where T
     itm1 = InflatedTensorMapping(tm1, IdentityMapping{T}(range_size(tm2)))
@@ -416,7 +419,6 @@
 LazyOuterProduct(tms::Vararg{TensorMapping}) = foldl(LazyOuterProduct, tms)
 
 ⊗(a::TensorMapping, b::TensorMapping) = LazyOuterProduct(a,b)
-export ⊗
 
 
 function check_domain_size(tm::TensorMapping, sz)
@@ -429,7 +431,6 @@
     tm::TensorMapping
     sz
 end
-export SizeMismatch
 
 function Base.showerror(io::IO, err::SizeMismatch)
     print(io, "SizeMismatch: ")
--- a/src/LazyTensors/tensor_mapping.jl	Thu Mar 10 16:57:01 2022 +0100
+++ b/src/LazyTensors/tensor_mapping.jl	Thu Mar 10 16:59:43 2022 +0100
@@ -1,3 +1,9 @@
+export TensorMapping
+export apply
+export apply_transpose
+export range_dim, domain_dim
+export range_size, domain_size
+
 """
     TensorMapping{T,R,D}
 
@@ -21,7 +27,6 @@
 ```
 """
 abstract type TensorMapping{T,R,D} end
-export TensorMapping
 
 """
     apply(t::TensorMapping{T,R,D}, v::AbstractArray{<:Any,D}, I::Vararg) where {R,D,T}
@@ -29,7 +34,6 @@
 Return the result of the mapping for a given index.
 """
 function apply end
-export apply
 
 """
     apply_transpose(t::TensorMapping{T,R,D}, v::AbstractArray{<:Any,R}, I::Vararg) where {R,D,T}
@@ -37,7 +41,6 @@
 Return the result of the transposed mapping for a given index.
 """
 function apply_transpose end
-export apply_transpose
 
 """
     range_dim(::TensorMapping)
@@ -51,7 +54,6 @@
 """
 domain_dim(::TensorMapping{T,R,D}) where {T,R,D} = D
 
-export range_dim, domain_dim
 
 """
     range_size(M::TensorMapping)
@@ -67,7 +69,6 @@
 """
 function domain_size end
 
-export range_size, domain_size
 
 """
     eltype(::TensorMapping{T})