![]() |
KIDS
ver-0.0.1
KIDS : Kernel Integrated Dynamics Simulator
|
this file provides einsum operation More...
#include <cstring>
#include <string>
#include <vector>
Go to the source code of this file.
Classes | |
struct | PROJECT_NS::EinsumIdx |
EinsumIdx is a struct store information of index used in einsum operation. More... | |
struct | PROJECT_NS::DimenHelper |
DimenHelper is a struct control dimensional utils on the orginal/einsum index for a given tensor. More... | |
class | PROJECT_NS::EinsumHelper |
Namespaces | |
namespace | PROJECT_NS |
< http://warp.povusers.org/FunctionParser/fparser.html | |
Functions | |
template<typename T > | |
void | PROJECT_NS::einsum (EinsumHelper &EH, const std::vector< T * > &data_inputs, T *data_output) |
template<typename T > | |
void | PROJECT_NS::einsum (const std::string &einsum_expression, std::vector< T * > data_inputs, const std::vector< std::vector< std::size_t > > &shape_inputs, T *data_output, const std::vector< std::size_t > &shape_output={}) |
this file provides einsum operation
In this documentation, we define key terms related to the einsum operation:
einsum label:
[name]
. It cannot appear in user's deduction!rules for einsum expression:
->
indicates for einsum result. Then all (non-fixed) labels appear behind ->
are treated as outer labels, while those not appear behind ->
are used as inner labels.->
is not provided in einsum expression. The inner/ outer labels are seperated by the times they appear in summation.This file provides a einsum operation with an easy realization, the performance is not optimized so well. Based on some test, there are about 20x slower than in optimized loop in pure C.
the following benchmark test is passed:
which is coincided with the results by numpy's einsum() function:
Copyright (c) 2024 Xin He, Liu-GroupThis software is a product of Xin's PhD research conducted by Professor Liu's Group at the College of Chemistry and Molecular Engineering, Peking University. All rights are reserved by Peking University. You should have received a copy of the GNU Lesser General Public License along with this software. If not, see https://www.gnu.org/licenses/lgpl-3.0.en.html
Date | Description |
---|---|
2024-03-29 | initial version. The shape_inputs and shape_output are consistent with that interface Basic_Shape in the file Shape.h. |
Definition in file Einsum.h.