File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -69,6 +69,7 @@ get_unit(x::Real) = unitless
69
69
get_unit (x:: DQ.AbstractQuantity ) = screen_unit (x)
70
70
get_unit (x:: AbstractArray ) = map (get_unit, x)
71
71
get_unit (x:: Num ) = get_unit (unwrap (x))
72
+ get_unit (x:: Symbolics.Arr ) = get_unit (unwrap (x))
72
73
get_unit (op:: Differential , args) = get_unit (args[1 ]) / get_unit (op. x)
73
74
get_unit (op:: Difference , args) = get_unit (args[1 ]) / get_unit (op. t)
74
75
get_unit (op:: typeof (getindex), args) = get_unit (args[1 ])
Original file line number Diff line number Diff line change 239
239
@test mm2units == MT. oneunit (mm2units)
240
240
@test mmunits == mm2units
241
241
end
242
+
243
+ # test for array variable units https://github.com/SciML/ModelingToolkit.jl/issues/3009
244
+ let
245
+ @variables x_vec (t)[1 : 3 ] [unit = u " 1" ] x_mat (t)[1 : 3 , 1 : 3 ] [unit = u " 1" ]
246
+ @test MT. get_unit (x_vec) == u " 1"
247
+ @test MT. get_unit (x_mat) == u " 1"
248
+ end
You can’t perform that action at this time.
0 commit comments