Comments (6)
@PaulWAyers Me and @Pavlo3P can't find the P-condition in thesis. Should we take a look at other sources or it has a different name?
As for the T2', The only condition we found is
It's not straight forward which transformation we need to apply to
For the
from pyci.
So the
The
Both equations from Ward Poelman's thesis.
from pyci.
The P condition is merely that the 2-electron reduced density matrix is positive semi-definite. The inverse of the (identity) mapping is the identity. I.e., the P condition is
from pyci.
@PaulWAyers So, the semicolon means reshaping of array? For example, if T2-transformation gives array of (1, 2, 3, 4, 5, 6) shape, it should be reshaped to (1*2*3, 4*5*6) in a straightforward way (i.e. with np.reshape)?
from pyci.
No semicolon's show up. It's simple using NumPy documentation for reshape
or ChatGPT. Her's what the latter said....
-
Understand the dimensions: Your initial array is a 6-dimensional array of shape
$(n, n, n, n, n, n) $ . The total number of elements in this array is$n^6$ . -
Calculate the desired shape: You want to reshape this into a square matrix with $n^3 $ rows and $ n^3 $ columns. Thus, the target shape of the matrix is
$(n^3, n^3) $ . -
Use
np.reshape
: You can usenp.reshape
to transform the array. This function needs the new shape you want to convert your array into. For your case, it should be reshaped as mentioned above.
Here's how you can do it in Python:
import numpy as np
# Assume n is known and your array `a` is defined as:
a = np.random.rand(n, n, n, n, n, n) # This creates a 6D array with random values
# Reshape the array to a square matrix of shape (n^3, n^3)
reshaped_matrix = np.reshape(a, (n**3, n**3))
Make sure that n
is set appropriately, as the reshape operation requires that the total number of elements remains constant. In this case, since both the original array and the reshaped array have
You need to be careful to understand how the indices are ordered and to make sure the right indices are being combined. This can be controlled somewhat by intrinsic orderings in reshape
but you may have to use moveaxis
in some cases. I always suggest looking at a simple example in detail to be sure the numpy functionality is doing what you want.
from pyci.
I think the semicolon @Pavlo3P is referring to is the semicolon in the notation for constructing matrices from tensors.
I created a simple wrapper around numpy.reshape
function to convert tensors into arrays. I made it a separate function so that it's easier to add some extra functionality on top of it, such as swapping axis, etc. if we need it in the future.
I think for now it would be good if calc_T2_prime
function return just a matrix for which we will impose positive semidefinite constraint later.
So, the code can look something like this:
def calc_T2_prime(gamma, N, conjugate=False):
if not conjugate:
T2 = calc_T2(gamma, N)
omega = ...
rho = ...
omega_conj = ....
row_1 = np.hstack([
flatten_tensor(T2, (N**3, N**3)), flatten_tensor(omega, (N***3, N))])
row_2 = np.hstack([
flatten_tensor(omega_conj, (N, N**3)), rho])
return np.vstack([row_1, row_2])
from pyci.
Related Issues (20)
- handling seniorities in low dimensional systems HOT 2
- Testing the odometer algorithm HOT 3
- change add_gkci algorithm to match the new api HOT 1
- FanCI tutorial HOT 3
- pCCDS Overlap Derivatives HOT 1
- Conditions HOT 3
- Inequality constraints
- Algorithms
- Closest N-representable Density Matrix (Semidefinite and Equality Constraints) HOT 1
- finding the closest semidefinite HOT 1
- Q,T2
- G,T1 HOT 1
- von Neumann cyclic permutation
- Halpern
- cyclic Dykstra
- HIgher-Order Reduced Density Matrices HOT 2
- Stabilize code and release new version in accordance with paper release and the end of the course
- FanPT (Perturbation Theory for Parameterized Projected Schrodinger Equation) HOT 4
- Automatic Determination of Number of Orbital Nodes (for GKCI) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyci.