From 6c0aab2a703c5d11a3ce8ba4d5aa91fcbd7aade2 Mon Sep 17 00:00:00 2001 From: Francesc Verdugo Date: Mon, 14 Oct 2019 15:19:55 +0200 Subject: [PATCH] Added mutable --- src/TensorValues.jl | 1 + src/Types.jl | 4 ++++ test/TypesTests.jl | 8 ++++++++ 3 files changed, 13 insertions(+) diff --git a/src/TensorValues.jl b/src/TensorValues.jl index c2e6bb5..0d9f33b 100644 --- a/src/TensorValues.jl +++ b/src/TensorValues.jl @@ -9,6 +9,7 @@ export VectorValue export inner, outer, meas export det, inv +export mutable import Base: show import Base: zero, one diff --git a/src/Types.jl b/src/Types.jl index 1c59edf..3601d32 100644 --- a/src/Types.jl +++ b/src/Types.jl @@ -209,3 +209,7 @@ function show(io::IO,::MIME"text/plain",v::MultiValue) print(io,v.array.data) end +# Misc + +mutable(::Type{MultiValue{S,T,N,L}}) where {S,T,N,L} = MArray{S,T,N,L} + diff --git a/test/TypesTests.jl b/test/TypesTests.jl index a5d8ead..4873bda 100644 --- a/test/TypesTests.jl +++ b/test/TypesTests.jl @@ -245,4 +245,12 @@ v = MultiValue{Tuple{3,2},Float64}(1,2,3,4,5,6) s = "(1.0, 2.0, 3.0, 4.0, 5.0, 6.0)" @test string(v) == s +# Misc + +M = mutable(VectorValue{3,Int}) +@test M == MVector{3,Int} +m = zero(M) +v = VectorValue(m) +@test isa(v,VectorValue{3,Int}) + end # module TypesTests