Repository navigation
Update Magicl bindings for Magicl NG - #238
Conversation
appleby
left a comment
There was a problem hiding this comment.
Looking good! Nice to see some examples of the new-and-improved magicl in the wild. Seems like a nice usability & ergonomics improvement.
| (reduce #'+ (magicl:matrix-diagonal | ||
| (density-matrix (magicl:from-array prepared-state | ||
| (list rows cols) | ||
| :type '(complex double-float)))) |
There was a problem hiding this comment.
As long as the compiler doesn't complain, maybe the :type here should be qvm:cflonum instead? ditto elsewhere below.
| (make-instance 'quil:simple-gate | ||
| :name (concatenate 'string (quil:gate-name gate) "*") | ||
| :matrix (magicl:conjugate-entrywise (quil:gate-matrix gate)))) | ||
| :matrix (magicl:map! #'conjugate (quil:gate-matrix gate)))) |
There was a problem hiding this comment.
Does the ! indicate mutation? I don't know if it matters here, but the old conjugate-entrywise did not mutate the input.
There was a problem hiding this comment.
No we very much shall not mutate. You're destroying the environment aka the original gate binding matrix.
Co-Authored-By: appleby <mappleby@rigetti.com>
ddc7493 to
b7cb424
Compare
|
@stylewarning smash the merge button |
| (make-instance 'quil:simple-gate | ||
| :name (concatenate 'string (quil:gate-name gate) "*") | ||
| :matrix (magicl:conjugate-entrywise (quil:gate-matrix gate)))) | ||
| :matrix (magicl:map! #'conjugate (quil:gate-matrix gate)))) |
There was a problem hiding this comment.
No we very much shall not mutate. You're destroying the environment aka the original gate binding matrix.
| :matrix-function #'(lambda (&rest parameters) | ||
| (magicl:conjugate-entrywise | ||
| (apply #'quil:gate-matrix gate parameters)))))) | ||
| (magicl:map! #'conjugate |
|
@colescott if u dont stop mutating im going to force us all to write HASKELL instead |
Promise? |
This is to update all magicl bindings to work with rigetti/magicl#63.
Benchmarks need to be done prior to merging to make sure there is not a significant performance hit.