Struggling with Symbolics matrix multiplication

Newbie Symbolics question.

I have two matrices with element type Int
L = [1 0 0 0; -3 1 0 0; 2 3 1 0; -2 3 -2 1]
D = [1 0 0 0; 0 2 0 0; 0 0 1 0; 0 0 0 2]

Forming the product G = Num.(L) * sqrt( Num.(D) ) yields
G = Num[sqrt(1) 0 0 0; -3sqrt(1) sqrt(2) 0 0; 2sqrt(1) 3sqrt(2) sqrt(1) 0; -2sqrt(1) 3sqrt(2) -2sqrt(1) sqrt(2)]

with the result that G*G’ promotes sqrt(2)*sqrt(2) to a float 2.0,
as opposed to sqrt(Num(2))*sqrt(Num(2)) = Num(2)

How do I avoid this promotion to float? I would hope to get
G*G’ = Num[1 -3 2 -2; -3 11 0 12; 2 0 23 12; -2 12 12 28]

Simplified the example too much: D should be the diagonal of matrix D.

The only workaround I have found is to use variables for the square roots, and substitute the actual values after each computation…

Unfortunately this is deep in Num operations: sqrt(Num(2)) * sqrt(Num(2)) === Num(2.0). That’s not a general eagerness to simplify Num scalars e.g. sqrt(Num(2))*sqrt(Num(18)) does not simplify at all to Num(6.0). I’m pretty sure rule rewriting of subexpressions can’t change how Julia operations are implemented. I couldn’t quickly find a Github issue along these lines, so I don’t know what the developers’ opinions on this are.

There is Expansion of sqrt for integers · Issue #1875 · JuliaSymbolics/Symbolics.jl · GitHub