1#ifndef W_ABACUS_DEVELOP_ABACUS_DEVELOP_SOURCE_MODULE_HAMILT_LCAO_MODULE_TDDFT_EVOLVE_ELEC_H
2#define W_ABACUS_DEVELOP_ABACUS_DEVELOP_SOURCE_MODULE_HAMILT_LCAO_MODULE_TDDFT_EVOLVE_ELEC_H
29 std::cout <<
"Shape of " << name <<
": [";
30 for (
int i = 0; i < tensor.
shape().ndim(); ++i)
38 std::cout <<
"]" << std::endl;
44 const std::vector<int64_t>& shape,
45 const std::vector<int64_t>& strides,
47 std::vector<int64_t>& indices,
48 const std::string& name)
50 if (dim == shape.size())
54 for (
size_t i = 0; i < indices.size(); ++i)
56 std::cout <<
"[" << indices[i] <<
"]";
58 std::cout <<
" = " << *data << std::endl;
62 for (int64_t i = 0; i < shape[dim]; ++i)
73 const std::vector<int64_t>& shape = tensor.
shape().
dims();
74 const std::vector<int64_t>& strides = tensor.
shape().
strides();
75 const T* data = tensor.
data<
T>();
76 std::vector<int64_t> indices(shape.size(), 0);
82inline void print_tensor_data<std::complex<double>>(
const ct::Tensor& tensor,
const std::string& name)
84 const std::vector<int64_t>& shape = tensor.shape().dims();
85 const std::vector<int64_t>& strides = tensor.shape().strides();
86 const std::complex<double>* data = tensor.data<std::complex<double>>();
87 std::vector<int64_t> indices(shape.size(), 0);
95template <
typename Device = base_device::DEVICE_CPU>
113 hamilt::Hamilt<std::complex<double>>* phm,
114 Parallel_Orbitals& para_orb,
115 psi::Psi<std::complex<double>>* psi,
116 psi::Psi<std::complex<double>>* psi_laststep,
117 ct::Tensor& Hk_laststep,
118 ct::Tensor& Sk_laststep,
119 ModuleBase::matrix& ekb,
120 std::ofstream& ofs_running,
121 const int propagator,
122 const bool use_tensor,
123 const bool use_lapack);
Definition esolver_ks_lcao_tddft.h:15
Definition esolver_ks_lcao.h:32
int64_t dim_size(int dim) const
Get the size of a dimension in the tensor.
Definition tensor_shape.cpp:31
const std::vector< int64_t > & dims() const
Get all dimension sizes in the tensor.
Definition tensor_shape.cpp:36
unsigned int ndim() const
Get the ndim of the tensor.
Definition tensor_shape.cpp:46
const std::vector< int64_t > & strides() const
Definition tensor_shape.cpp:41
A multi-dimensional array of elements of a single data type.
Definition tensor.h:32
void * data() const
Get a pointer to the data buffer of the tensor.
Definition tensor.cpp:73
const TensorShape & shape() const
Get the shape of the tensor.
Definition tensor.cpp:67
Definition evolve_elec.h:97
static ct::DeviceType ct_device_type
Definition evolve_elec.h:126
typename ct::PsiToContainer< Device >::type ct_Device
Definition evolve_elec.h:128
static void solve_psi(const int &istep, const int nband, const int nlocal, const int &nks, hamilt::Hamilt< std::complex< double > > *phm, Parallel_Orbitals ¶_orb, psi::Psi< std::complex< double > > *psi, psi::Psi< std::complex< double > > *psi_laststep, ct::Tensor &Hk_laststep, ct::Tensor &Sk_laststep, ModuleBase::matrix &ekb, std::ofstream &ofs_running, const int propagator, const bool use_tensor, const bool use_lapack)
Definition evolve_elec.cpp:23
std::complex< double > complex
Definition diago_cusolver.cpp:13
void print_tensor_data_recursive(const T *data, const std::vector< int64_t > &shape, const std::vector< int64_t > &strides, int dim, std::vector< int64_t > &indices, const std::string &name)
Definition evolve_elec.h:43
void print_tensor_shape(const ct::Tensor &tensor, const std::string &name)
Definition evolve_elec.h:27
void print_tensor_data(const ct::Tensor &tensor, const std::string &name)
Definition evolve_elec.h:71
#define T
Definition exp.cpp:237
DeviceType
The type of memory used by an allocator.
Definition tensor_types.h:73
Definition band_energy.cpp:11
Definition memory_op.h:61
Definition tensor_types.h:113