MCPcopy Create free account
hub / github.com/SZAILAB/MaterialDFT-Demo / contraction_ij

Function contraction_ij

cpp_core/src/paw_projector.cpp:298–315  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

296}
297
298double contraction_ij(const std::vector<std::vector<double>>& a, const std::vector<std::vector<double>>& b) {
299 const int n = static_cast<int>(a.size());
300 if (n <= 0 || static_cast<int>(b.size()) != n) {
301 throw std::invalid_argument("contraction_ij: matrix size mismatch");
302 }
303 double sum = 0.0;
304 for (int i = 0; i < n; ++i) {
305 if (static_cast<int>(a[static_cast<std::size_t>(i)].size()) != n
306 || static_cast<int>(b[static_cast<std::size_t>(i)].size()) != n) {
307 throw std::invalid_argument("contraction_ij: matrix size mismatch");
308 }
309 for (int j = 0; j < n; ++j) {
310 sum += a[static_cast<std::size_t>(i)][static_cast<std::size_t>(j)]
311 * b[static_cast<std::size_t>(i)][static_cast<std::size_t>(j)];
312 }
313 }
314 return sum;
315}
316
317std::vector<double> build_normalized_gaussian_shape(
318 const std::vector<double>& r_grid,

Calls 1

sizeMethod · 0.80

Tested by

no test coverage detected