-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add BLOCK-DIAG, MAP-BLOCKS, and PARTIAL-TRACE #104
base: master
Are you sure you want to change the base?
Conversation
And BLOCK-MATRIX-P
@@ -219,6 +219,11 @@ ELEMENT-TYPE, CAST, COPY-TENSOR, DEEP-COPY-TENSOR, TREF, SETF TREF)" | |||
"Whether MATRIX is a unitary matrix" | |||
(= matrix (conjugate-transpose matrix) epsilon)) | |||
|
|||
(defun block-matrix-p (matrix) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: the general usage is that a "block matrix" is a matrix with an associated decomposition, e.g.
[[A, B, C],
[D, E, F]]
would be a valid block decomposition if nrows(A) = nrows(B) = nrows(C)
, ncols(A) = ncols(D)
, and so on. In this usage, the matrix doesn't have to be square. I'd suggest changing the name of your defun and adding a docstring if you want to keep the current behavior.
@@ -379,6 +384,17 @@ If fast is t then just change layout. Fast can cause problems when you want to m | |||
(loop :for i :below rows | |||
:collect (tref matrix i i)))))) | |||
|
|||
(defgeneric block-diag (matrix) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same thing here -- seems like you have in mind specifically 2x2 block decompositions.
(policy-cond:with-expectations (> speed safety) | ||
((assertion (block-matrix-p matrix))) | ||
(let* ((dim (floor (sqrt (nrows matrix)))) | ||
(freiche (zeros (list dim dim) :type type))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yum
@@ -146,6 +148,7 @@ | |||
#:orthonormalize | |||
#:orthonormalize! | |||
#:trace | |||
#:partial-trace |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gotem
And BLOCK-MATRIX-P