Skip to content

Commit 31d78ff

Browse files
committed
using gemm instead of einsum in orth_cholesky
1 parent bcf492f commit 31d78ff

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

source/module_hsolver/diago_bpcg.cpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,23 @@ void DiagoBPCG<T, Device>::orth_cholesky(
9797
// hsub_out = psi_out * transc(psi_out)
9898
ct::EinsumOption option(
9999
/*conj_x=*/false, /*conj_y=*/true, /*alpha=*/1.0, /*beta=*/0.0, /*Tensor out=*/&hsub_out);
100-
hsub_out = ct::op::einsum("ij,kj->ik", psi_out, psi_out, option);
100+
// hsub_out = ct::op::einsum("ij,kj->ik", psi_out, psi_out, option);
101+
102+
// gemm: hsub_out(n_band x n_band) = psi_out^T(n_band x n_basis) * psi_out(n_basis x n_band)
103+
gemm_op()(this->ctx,
104+
'C',
105+
'N',
106+
this->n_band, //m
107+
this->n_band, //n
108+
this->n_dim, //k
109+
this->one,
110+
psi_out.data<T>(),
111+
this->n_basis, //lda
112+
psi_out.data<T>(),
113+
this->n_basis, //ldb
114+
this->zero,
115+
hsub_out.data<T>(),
116+
this->n_band); //ldc
101117

102118
// set hsub matrix to lower format;
103119
ct::kernels::set_matrix<T, ct_Device>()(

0 commit comments

Comments
 (0)