Miscellaneous

bool danceq::internal::Vector::operator==(const Vector<T> &input) const

Overloaded == operator for comparison.

Parameters:

input – Input vector

Returns:

True if input equals this, False otherwise

Vector<T> &danceq::internal::Vector::operator=(const Vector<T> &input)

Overloaded = operator.

Parameters:

input – Input vector

Returns:

New instance of Input vector

Vector<T> &danceq::internal::Vector::operator=(const T &input)

Overloaded = operator.

Parameters:

input – Scalar

Returns:

New instance where all entries equal input

Vec danceq::internal::Vector::create_PetscVec(void) const

Returns Vec from Petsc.

This is only available if Petsc is included. It uses the same memory layout.

using MyVector=danceq::internal::Vector<ScalarType>;

// Create a Mat object from Petsc (H is a Hamiltonian)
Mat H_mat = H.create_PetscSparseMatrix();

// Create a Vec object from Petsc using H_mat
MyVector V(H_mat);

// Do somthing to V
V.make_random();

// Retrieve the Petsc Vec
Vec Psi = V.create_PetscVec();

Returns:

Copy in form of Vec

EigenVectorType danceq::internal::Vector::create_EigenVector(const int32_t root = 0) const

Returns the Vector as an instance in Eigen.

This is only available if Eigen is included.

using MyVector=danceq::internal::Vector<ScalarType>;

// Do somthing to V
MyVector V(100);
V.make_random();

// Retrieve the vector as EigenVectorType
auto EigenV = create_EigenVector(void);

The vector matrix will be only returned to the root rank if MPI is enabled.

Parameters:

root – Designated MPI rank (Default: 0)

Returns:

Copy in form of EigenVectorType

std::vector<std::vector<T>> danceq::internal::Vector::get_density_matrix(const int32_t root = 0) const

Returns the density matrix (if possible).

We represent the density matrix \(\rho\) of dimension \(d\) as a large vector \(v\) with dimension \(d^2\) when we work with the Lindbladian OperatorType. This function returns the density matrix using a two-dimensional vector if the total dimension dim is the quadrat of an integer.

\[\rho[i,j] = v[i\cdot d+j]\]

The density matrix will be only returned to the root rank if MPI is enabled.

Parameters:

root – Designated MPI rank (Default: 0)

Returns:

density matrix

EigenMatrixType danceq::internal::Vector::get_density_matrix_in_eigen(const int32_t root = 0) const

Returns the density matrix (if possible).

This is a equivalent to get_density_matrix(root). It returns the density matrix using Eigen which has to be available.

Parameters:

root – Designated MPI rank (Default: 0)

Returns:

density matrix