Closed KJ7LNW closed 2 years ago
More info:
This is a PDL::LinearAlgebra problem because it works natively:
pdl> p $S = pdl [ [0.7163927-0.4504119*i, 0.2836073+0.4504119*i ], [0.2836073+0.4504119*i, 0.7163927-0.4504119*i ] ]
[
[0.7163927-0.4504119i 0.2836073+0.4504119i]
[0.2836073+0.4504119i 0.7163927-0.4504119i]
]
pdl>
pdl> p $sqrt_y = stretcher(zeroes(2)+sqrt(50))->inv
[
[0.14142136 0]
[ 0 0.14142136]
]
pdl> p $id = identity(2)
[
[1 0]
[0 1]
]
pdl>
pdl> p $id-$S
[
[ 0.2836073+0.4504119i -0.2836073-0.4504119i]
[-0.2836073-0.4504119i 0.2836073+0.4504119i]
]
pdl> p $sqrt_y x ($id-$S)
[
[ 0.0401081290048015+0.0636978617634234i -0.0401081290048015-0.0636978617634234i]
[-0.0401081290048015-0.0636978617634234i 0.0401081290048015+0.0636978617634234i]
]
This is explicitly a PDL::LinearAlgebra problem and should be moved to there (am doing so now).
I believe https://github.com/PDLPorters/pdl-linearalgebra/blob/a162b361f076f5bd93a363a784af0df92ef90ef0/Real/real.pd#L91-L97 is only checking the left arg for being complex, and it should instead check both; the overload's conditional operator condition needs to be !(grep ref($_) && !$_->type->real, @_)
instead.
Now released as 0.35.
here is the setup with trivial values using the latest PDL from git (8c46144b9f6a2788673a78f7697eeb7f764c8def):
Here is the inconsistency after the setup above; note that the
x
operator has no imaginary part, butmatmult
does:Here are the real-life numbers from a 10pF capacitor:
setup:
and the problem with missing
i
values.The matmult numbers provide the same thing I get in
Math::Matrix::Complex
so I think the numbers are right, its just an oddity with 'x'.