Deftioon
MModular
•Created by Deftioon on 1/13/2025 in #questions
An question about compile-time parameters
Hey all,
So I was trying to make a Matrix struct:
When using these Matrices, its guaranteed that
rows*cols
is a power of two.
I have another struct that uses a Matrix
:
And I fill this state
with a series of kronecker products of 2x2 Matrices T times, ensuring that the resulting output is definitely of shape [2**T, 1]
. That looks like this:
Here there is an issue. I cannot put filled_matrix
into self.state
.
I figured this is because the compiler cannot figure out the shape of filled_matrix
, even though it is guaranteed to be a Matrix[2**T, 1]
. However, if I turn from compiler-time parameters to dynamic parameters, I am not sure how to create the ComplexSIMD
as a struct property.
Is there a way to use ComplexSIMD
while also achieving this behaviour? Or will I need to use UnsafePointer
instead.2 replies
MModular
•Created by Deftioon on 1/11/2025 in #questions
Is there a way to reflect changes to a variable in the reference?
Here's a small reproducible example:
This outputs:
When I want it to output
My logic was that because
q1
is a reference to mylist.list
, whenever I change mylist.list
, it should also be reflected in q1
. But it seems q1
is copying the value instead of taking a reference? Am I misunderstanding how references work as a whole?34 replies