.. _Vector: ###### Vector ###### This class simply represent a vector and provides basic linear algebra routines. If :ref:`MPI` is available the vector is distributed across all processes, otherwise not. In the case of shared memory (:ref:`MPI` has not been found), routines are parallelized using :ref:`openMP` if possible. .. note:: The syntax is equivalent for all cases. The class is mainly used by the :ref:`ShellMatrix` to make **matrix-free** multiplication possible. Here is a brief example of some features: .. code-block:: cpp /* Defining the type */ using Vector=danceq::internal::Vector; /* Initializing two vectors with are random values */ Vector A(10); Vector B(10); A.make_random(); B.make_random(); std::cout << "A: " << A << std::endl; std::cout << "A[0] = " << A[0] << " || B[0] = " << B[0] << std::endl; /* Vectors can be added */ auto C = A + B; std::cout << "C[0] = " << C[0] << std::endl; /* Vector can be scaled */ auto D = 2. * A; std::cout << "D[0] = " << D[0] << std::endl; /* Vector can be scaled */ auto scalar = A*A; std::cout << "scalar = " << scalar << std::endl; The vector class can interact with :ref:`Petsc` if included: .. code-block:: cpp /* Defining the type */ using Vector=danceq::internal::Vector; /* Some Operator Hamiltonian H */ Hamiltonian_U1 H(L,n); /* Retrieve Petsc Mat from H */ Mat H_mat = H.create_PetscSparseMatrix(); /* Retrieve Vector class from H_Mat */ Vector V_from_mat(H_mat); Operators that are a Lindbladian :ref:`OperatorType` act on the space density matrices which are represented with this :ref:`Vector class`. In this case, the class allows you to directly extract the density matrix via: :ref:`get_density_matrix(...)` and :ref:`get_density_matrix_in_eigen(...)`. Class content ------------- .. toctree:: :maxdepth: 2 :titlesonly: Vector/Members.rst Vector/Constructors.rst Vector/Functions.rst Vector/Autodocs.rst