Replies: 4 comments 1 reply
-
I imagine seeing the code would help, if you like I can add you to my repo to see the code (it's two .py files so it wouldn't take much of your time). |
Beta Was this translation helpful? Give feedback.
-
I was able to generate a call graph to see what methods/functions call the above methods/functions. I can see that |
Beta Was this translation helpful? Give feedback.
-
As you have found, the runtime is being dominated by the low level QR and SVD routines, meaning that improvements will have to come from hardware or algorithm changes.
|
Beta Was this translation helpful? Give feedback.
-
Apologies for the massive delay. I got sidetracked with a few other tasks for the package. Here's what I have for my def compress(
self,
max_bond_dimension: int | None = None,
mode: Literal["left", "right"] | None = None
) -> None:
""" SVD Compress the bond dimension of the MPS.
```
a)│ │ b)│ │ c)│ │
━━●━━━●━━ -> ━━>━━○━━○━━<━━ -> ━━>━━━M━━━<━━
│ │ │ .... │ │ │
<*> <*> contract <*>
QR LQ -><- SVD
d)│ │ e)│ │
-> ━━>━━━ML──MR━━━<━━ -> ━━●───●━━
│.... ....│ │ │
contract contract ^compressed bond
-><- -><-
```
Parameters
----------
`max_bond_dimension` : int
The maximum bond dimension of the MPS.
`mode` : Literal["left", "right"], optional
The mode of compression.
Raises
------
ValueError
- If `mode` is not "left", or "right".
Usage
-----
>>> mps.compress(max_bond_dimension=16)
>>> mps.compress(mode="left")
>>> mps.compress(max_bond_dimension=32, mode="right")
"""
if not (max_bond_dimension or mode):
self.mps.compress()
elif not mode:
self.mps = tensor_network_1d_compress(tn=self.mps, max_bond=max_bond_dimension)
else:
if mode in ["left", "right", "flat"]:
if not max_bond_dimension:
self.mps.compress(form=mode)
else:
self.mps.compress(form=mode, max_bond=max_bond_dimension)
else:
raise ValueError(f"`mode` must be either 'left', or 'right'. Received {mode}.") I checked out |
Beta Was this translation helpful? Give feedback.
-
Greetings there dear Johnnie,
I hope this letter finds you well. I have a few questions regarding how I can improve runtime to be faster when running the below operations. I have done a quick profiler to show which ones are taking the most time and need to be done faster:
As you can see, the majority of the runtime is dominated by
decomp.py
methodssvd_truncated_numba
andqr_stabilized_numba
(taking 3922 seconds out of 4968 seconds), and with addition ofdo
andtensordot
it increases even more (taking 4582 seconds overall). I would like to decrease this significantly and understand there are options implemented in quimb for doing so.Could I have some suggestions regarding this? Preferably those which would significantly reduce this runtime.
Beta Was this translation helpful? Give feedback.
All reactions