julia> using LinearAlgebraicRepresentation
julia> using Plasm
julia> using DataStructures
julia> Lar = LinearAlgebraicRepresentation


julia> v0 = [0. 1. 2. 3. 4. 5. 6. 7. 8.]
1×9 Array{Float64,2}:
 0.0  1.0  2.0  3.0  4.0  5.0  6.0  7.0  8.0

julia> v1 = collect(0.:12)
13-element Array{Float64,1}:
  0.0
  1.0
  2.0
  3.0
  4.0
  5.0
  6.0
  7.0
  8.0
  9.0
 10.0
 11.0
 12.0



julia> c0 = Lar.larGridSkeleton([1,1,1])(0)
8-element Array{Array{Int64,1},1}:
 [1]
 [2]
 [3]
 [4]
 [5]
 [6]
 [7]
 [8]


julia> m0 = (v0, c0)
([0.0 1.0 … 7.0 8.0], Array{Int64,1}[[1], [2], [3], [4], [5], [6], [7], [8]])

julia> c1 = [[1,2],[2,3],[3,4],[4,5],[5,6],[6,7],[7,8]]
12-element Array{Array{Int64,1},1}:
 [1, 2]
 [3, 4]
 [5, 6]
 [7, 8]
 [1, 3]
 [2, 4]
 [5, 7]
 [6, 8]
 [1, 5]
 [2, 6]
 [3, 7]
 [4, 8]

julia> v1 = hcat(collect(0.:12)...)
1×13 Array{Float64,2}:
 0.0  1.0  2.0  3.0  4.0  5.0  6.0  7.0  8.0  9.0  10.0  11.0  12.0


julia> m0 = (v0,c0)
([0.0 1.0 … 7.0 8.0], Array{Int64,1}[[1], [2], [3], [4], [5], [6], [7], [8]])

julia> m1 = (v1,c1)
([0.0 1.0 … 11.0 12.0], Array{Int64,1}[[1, 2], [3, 4], [5, 6], [7, 8], [1, 3], [2, 4], [5, 7], [6, 8], [1, 5], [2, 6], [3, 7], [4, 8]])






julia> Plasm.view(Lar.larModelProduct( m1,m0 ))

julia> m11 = Lar.larModelProduct( m0, m1 )
([0.0 0.0 … 8.0 8.0; 0.0 1.0 … 11.0 12.0], Array{Int64,1}[[1, 2], [3, 4], [5, 6], [7, 8], [1, 3], [2, 4], [5, 7], [6, 8], [1, 5], [2, 6]  …  [96, 97], [98, 99], [92, 94], [93, 95], [96, 98], [97, 99], [92, 96], [93, 97], [94, 98], [95, 99]])

julia> m12 = Lar.larModelProduct( m1, m0 )
([0.0 0.0 … 12.0 12.0; 0.0 1.0 … 7.0 8.0], Array{Int64,1}[[1, 10], [2, 11], [3, 12], [4, 13], [5, 14], [6, 15], [7, 16], [8, 17], [19, 28], [20, 29]  …  [25, 61], [26, 62], [28, 64], [29, 65], [30, 66], [31, 67], [32, 68], [33, 69], [34, 70], [35, 71]])

julia> Lar.Struct([ m11,m12 ])
LinearAlgebraicRepresentation.Struct(Tuple{Array{Float64,2},Array{Array{Int64,1},1}}[([0.0 0.0 … 8.0 8.0; 0.0 1.0 … 11.0 12.0], [[1, 2], [3, 4], [5, 6], [7, 8], [1, 3], [2, 4], [5, 7], [6, 8], [1, 5], [2, 6]  …  [96, 97], [98, 99], [92, 94], [93, 95], [96, 98], [97, 99], [92, 96], [93, 97], [94, 98], [95, 99]]), ([0.0 0.0 … 12.0 12.0; 0.0 1.0 … 7.0 8.0], [[1, 10], [2, 11], [3, 12], [4, 13], [5, 14], [6, 15], [7, 16], [8, 17], [19, 28], [20, 29]  …  [25, 61], [26, 62], [28, 64], [29, 65], [30, 66], [31, 67], [32, 68], [33, 69], [34, 70], [35, 71]])], Array{Float64,2}[[0.0; 0.0], [12.0; 12.0]], "10562118164415904967", 2, "feature")

julia> m2 = Lar.struct2lar(Lar.Struct([ m11,m12 ]))
([0.0 0.0 … 7.0 7.0; 0.0 1.0 … 6.0 7.0], Array{Int64,1}[[1, 2], [3, 4], [5, 6], [7, 8], [1, 3], [2, 4], [5, 7], [6, 8], [1, 5], [2, 6]  …  [23, 55], [24, 56], [25, 57], [26, 58], [27, 59], [28, 60], [29, 61], [30, 62], [31, 63], [32, 64]])

julia> Plasm.view(m2)

julia> m21 = Lar.larModelProduct( m2,m1 )
([0.0 0.0 … 7.0 7.0; 0.0 0.0 … 7.0 7.0; 0.0 1.0 … 11.0 12.0], Array{Int64,1}[[1, 2, 14, 15], [3, 4, 16, 17], [5, 6, 18, 19], [7, 8, 20, 21], [1, 3, 14, 16], [2, 4, 15, 17], [5, 7, 18, 20], [6, 8, 19, 21], [1, 5, 14, 18], [2, 6, 15, 19]  …  [408, 409, 824, 825], [410, 411, 826, 827], [404, 406, 820, 822], [405, 407, 821, 823], [408, 410, 824, 826], [409, 411, 825, 827], [404, 408, 820, 824], [405, 409, 821, 825], [406, 410, 822, 826], [407, 411, 823, 827]])

julia> Plasm.view(m21)

julia> m20 = Lar.larModelProduct( m1,m1 )
([0.0 0.0 … 12.0 12.0; 0.0 1.0 … 11.0 12.0], Array{Int64,1}[[1, 2, 14, 15], [3, 4, 16, 17], [5, 6, 18, 19], [7, 8, 20, 21], [1, 3, 14, 16], [2, 4, 15, 17], [5, 7, 18, 20], [6, 8, 19, 21], [1, 5, 14, 18], [2, 6, 15, 19]  …  [44, 45, 96, 97], [46, 47, 98, 99], [40, 42, 92, 94], [41, 43, 93, 95], [44, 46, 96, 98], [45, 47, 97, 99], [40, 44, 92, 96], [41, 45, 93, 97], [42, 46, 94, 98], [43, 47, 95, 99]])

julia> Plasm.view(m20)

julia> m20 = Lar.larModelProduct( m20,m0 )
([0.0 0.0 … 12.0 12.0; 0.0 0.0 … 12.0 12.0; 0.0 1.0 … 7.0 8.0], Array{Int64,1}[[1, 10, 118, 127], [2, 11, 119, 128], [3, 12, 120, 129], [4, 13, 121, 130], [5, 14, 122, 131], [6, 15, 123, 132], [7, 16, 124, 133], [8, 17, 125, 134], [19, 28, 136, 145], [20, 29, 137, 146]  …  [376, 412, 844, 880], [377, 413, 845, 881], [379, 415, 847, 883], [380, 416, 848, 884], [381, 417, 849, 885], [382, 418, 850, 886], [383, 419, 851, 887], [384, 420, 852, 888], [385, 421, 853, 889], [386, 422, 854, 890]])

julia> m20 = Lar.larModelProduct( m1,m1 )
([0.0 0.0 … 12.0 12.0; 0.0 1.0 … 11.0 12.0], Array{Int64,1}[[1, 2, 14, 15], [3, 4, 16, 17], [5, 6, 18, 19], [7, 8, 20, 21], [1, 3, 14, 16], [2, 4, 15, 17], [5, 7, 18, 20], [6, 8, 19, 21], [1, 5, 14, 18], [2, 6, 15, 19]  …  [44, 45, 96, 97], [46, 47, 98, 99], [40, 42, 92, 94], [41, 43, 93, 95], [44, 46, 96, 98], [45, 47, 97, 99], [40, 44, 92, 96], [41, 45, 93, 97], [42, 46, 94, 98], [43, 47, 95, 99]])

julia> m22 = Lar.larModelProduct( m20,m0 )
([0.0 0.0 … 12.0 12.0; 0.0 0.0 … 12.0 12.0; 0.0 1.0 … 7.0 8.0], Array{Int64,1}[[1, 10, 118, 127], [2, 11, 119, 128], [3, 12, 120, 129], [4, 13, 121, 130], [5, 14, 122, 131], [6, 15, 123, 132], [7, 16, 124, 133], [8, 17, 125, 134], [19, 28, 136, 145], [20, 29, 137, 146]  …  [376, 412, 844, 880], [377, 413, 845, 881], [379, 415, 847, 883], [380, 416, 848, 884], [381, 417, 849, 885], [382, 418, 850, 886], [383, 419, 851, 887], [384, 420, 852, 888], [385, 421, 853, 889], [386, 422, 854, 890]])

julia> Plasm.view(m22)

julia> Lar.struct2lar(Lar.Struct([ m22,m21 ]))
([0.0 0.0 … 7.0 7.0; 0.0 1.0 … 6.0 7.0; 0.0 0.0 … 7.0 7.0], Array{Int64,1}[[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16], [17, 18, 19, 20], [21, 22, 23, 24], [25, 26, 27, 28], [29, 30, 31, 32], [33, 34, 35, 36], [37, 38, 39, 40]  …  [244, 248, 500, 504], [252, 256, 508, 512], [228, 236, 484, 492], [232, 240, 488, 496], [244, 252, 500, 508], [248, 256, 504, 512], [228, 244, 484, 500], [232, 248, 488, 504], [236, 252, 492, 508], [240, 256, 496, 512]])

julia> m32 = Lar.struct2lar(Lar.Struct([ m22,m21 ]))
([0.0 0.0 … 7.0 7.0; 0.0 1.0 … 6.0 7.0; 0.0 0.0 … 7.0 7.0], Array{Int64,1}[[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16], [17, 18, 19, 20], [21, 22, 23, 24], [25, 26, 27, 28], [29, 30, 31, 32], [33, 34, 35, 36], [37, 38, 39, 40]  …  [244, 248, 500, 504], [252, 256, 508, 512], [228, 236, 484, 492], [232, 240, 488, 496], [244, 252, 500, 508], [248, 256, 504, 512], [228, 244, 484, 500], [232, 248, 488, 504], [236, 252, 492, 508], [240, 256, 496, 512]])

julia> Plasm.view(m32)










