From dce319199ca08682d7ebe9d02f60b4fbfd2763d4 Mon Sep 17 00:00:00 2001 From: Azzaare Date: Thu, 15 Jul 2021 18:00:43 +0900 Subject: [PATCH] Add a max_icn_length function --- src/CompositionalNetworks.jl | 1 + src/icn.jl | 2 ++ test/icn.jl | 1 + 3 files changed, 4 insertions(+) diff --git a/src/CompositionalNetworks.jl b/src/CompositionalNetworks.jl index 1a5deb0..b3db836 100644 --- a/src/CompositionalNetworks.jl +++ b/src/CompositionalNetworks.jl @@ -14,6 +14,7 @@ export hamming export lazy export lazy_param export manhattan +export max_icn_length export minkowski export regularization diff --git a/src/icn.jl b/src/icn.jl index 04f1c7c..332b1fb 100644 --- a/src/icn.jl +++ b/src/icn.jl @@ -182,3 +182,5 @@ function regularization(icn) end return Σop / (Σmax + 1) end + +max_icn_length(icn = ICN(param = true)) = length(icn.transformation) diff --git a/test/icn.jl b/test/icn.jl index 501de68..d166a58 100644 --- a/test/icn.jl +++ b/test/icn.jl @@ -1,5 +1,6 @@ # # Test with manually weighted ICN icn = ICN(param=true) +@test max_icn_length() == 18 show_layers(icn) icn.weigths = vcat(trues(18), falses(6)) @test CN.is_viable(icn)