diff src/LazyTensors/lazy_tensor_operations.jl @ 469:481e86e77c22 feature/outer_product

Merge in feature/infated_tensormapping
author Jonatan Werpers <jonatan@werpers.com>
date Sat, 24 Oct 2020 20:40:28 +0200
parents a52f38e72258 f270d82fc9ad
children 0c3decc04649
line wrap: on
line diff
--- a/src/LazyTensors/lazy_tensor_operations.jl	Thu Oct 22 10:18:57 2020 +0200
+++ b/src/LazyTensors/lazy_tensor_operations.jl	Sat Oct 24 20:40:28 2020 +0200
@@ -195,14 +195,20 @@
     end
 end
 export InflatedTensorMapping
-
 """
     InflatedTensorMapping(before, tm, after)
+    InflatedTensorMapping(before,tm)
+    InflatedTensorMapping(tm,after)
 
 The outer product of `before`, `tm` and `after`, where `before` and `after` are `IdentityMapping`s.
+
+If one of `before` or `after` is left out, a 0-dimensional `IdentityMapping` is used as the default value.
 """
 InflatedTensorMapping(::IdentityMapping, ::TensorMapping, ::IdentityMapping)
-# TODO: Implement constructors where one of `before` or `after` is missing
+InflatedTensorMapping(before::IdentityMapping, tm::TensorMapping{T}) where T = InflatedTensorMapping(before,tm,IdentityMapping{T}())
+InflatedTensorMapping(tm::TensorMapping{T}, after::IdentityMapping) where T = InflatedTensorMapping(IdentityMapping{T}(),tm,after)
+# Resolve ambiguity between the two previous methods
+InflatedTensorMapping(I1::IdentityMapping{T}, I2::IdentityMapping{T}) where T = InflatedTensorMapping(I1,I2,IdentityMapping{T}())
 
 # TODO: Implement syntax and constructors for products of different combinations of InflatedTensorMapping and IdentityMapping