MCPcopy Create free account
hub / github.com/NGSolve/ngsolve / expand_higher_order_identities

Function expand_higher_order_identities

fem/tensorcoefficient.cpp:529–559  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

527 }
528
529 pair<string, Array<shared_ptr<CoefficientFunction>>>
530 expand_higher_order_identities(string signature,
531 const Array<shared_ptr<CoefficientFunction>>& cfs,
532 [[maybe_unused]] const map<string, bool> &options) {
533
534 Array<shared_ptr<CoefficientFunction>> new_cfs;
535 new_cfs.SetAllocSize(cfs.Size());
536
537 cout << IM(5) << "EinsumCF: expand higher-order identities" << endl;
538 auto parts = split_signature(signature);
539
540 for (auto i : Range(cfs))
541 if (is_identity(cfs[i]))
542 {
543 auto dims = cfs[i]->Dimensions();
544 stringstream new_part{};
545 for (auto j : Range(dims.Size() / 2)) {
546 new_cfs.Append(IdentityCF(dims[j]));
547 new_part << (j > 0 ? "," : "")
548 << parts[i][j] << parts[i][j + dims.Size() / 2];
549 }
550 parts[i] = new_part.str();
551 }
552 else
553 {
554 new_cfs.Append(cfs[i]);
555 }
556
557
558 return {form_index_signature(parts), std::move(new_cfs)};
559 }
560
561
562 pair<string, Array<shared_ptr<CoefficientFunction>>>

Callers 1

Calls 9

IMClass · 0.85
split_signatureFunction · 0.85
is_identityFunction · 0.85
IdentityCFFunction · 0.85
form_index_signatureFunction · 0.85
DimensionsMethod · 0.80
RangeFunction · 0.50
SizeMethod · 0.45
AppendMethod · 0.45

Tested by

no test coverage detected