CXX11/TensorSymmetry: add symmetry support for Tensor class
Add a symCoeff() method to the Tensor class template that allows the
user of the class to set multiple elements of a tensor at once if they
are connected by a symmetry operation with respect to the tensor's
indices (symmetry/antisymmetry/hermiticity/antihermiticity under
echange of two indices and combination thereof for different pairs of
indices).
A compile-time resolution of the required symmetry groups via meta
templates is also implemented. For small enough groups this is used to
unroll the loop that goes through all the elements of the Tensor that
are connected by this group. For larger groups or groups where the
symmetries are defined at run time, a standard run-time implementation
of the same algorithm is provided.
For example, the following code completely initializes all elements of
the totally antisymmetric tensor in three dimensions ('epsilon
tensor'):
SGroup<3, AntiSymmetry<0,1>, AntiSymmetry<1,2>> sym;
Eigen::Tensor<double, 3> epsilon(3,3,3);
epsilon.setZero();
epsilon.symCoeff(sym, 0, 1, 2) = 1;
2013-11-15 06:35:11 +08:00
|
|
|
// This file is part of Eigen, a lightweight C++ template library
|
|
|
|
// for linear algebra.
|
|
|
|
//
|
2013-11-16 07:03:23 +08:00
|
|
|
// Copyright (C) 2013 Christian Seiler <christian@iwakd.de>
|
CXX11/TensorSymmetry: add symmetry support for Tensor class
Add a symCoeff() method to the Tensor class template that allows the
user of the class to set multiple elements of a tensor at once if they
are connected by a symmetry operation with respect to the tensor's
indices (symmetry/antisymmetry/hermiticity/antihermiticity under
echange of two indices and combination thereof for different pairs of
indices).
A compile-time resolution of the required symmetry groups via meta
templates is also implemented. For small enough groups this is used to
unroll the loop that goes through all the elements of the Tensor that
are connected by this group. For larger groups or groups where the
symmetries are defined at run time, a standard run-time implementation
of the same algorithm is provided.
For example, the following code completely initializes all elements of
the totally antisymmetric tensor in three dimensions ('epsilon
tensor'):
SGroup<3, AntiSymmetry<0,1>, AntiSymmetry<1,2>> sym;
Eigen::Tensor<double, 3> epsilon(3,3,3);
epsilon.setZero();
epsilon.symCoeff(sym, 0, 1, 2) = 1;
2013-11-15 06:35:11 +08:00
|
|
|
//
|
|
|
|
// This Source Code Form is subject to the terms of the Mozilla
|
|
|
|
// Public License v. 2.0. If a copy of the MPL was not distributed
|
|
|
|
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
|
|
|
|
#ifndef EIGEN_CXX11_TENSORSYMMETRY_MODULE
|
|
|
|
#define EIGEN_CXX11_TENSORSYMMETRY_MODULE
|
|
|
|
|
2014-06-05 00:31:02 +08:00
|
|
|
#include <unsupported/Eigen/CXX11/Tensor>
|
CXX11/TensorSymmetry: add symmetry support for Tensor class
Add a symCoeff() method to the Tensor class template that allows the
user of the class to set multiple elements of a tensor at once if they
are connected by a symmetry operation with respect to the tensor's
indices (symmetry/antisymmetry/hermiticity/antihermiticity under
echange of two indices and combination thereof for different pairs of
indices).
A compile-time resolution of the required symmetry groups via meta
templates is also implemented. For small enough groups this is used to
unroll the loop that goes through all the elements of the Tensor that
are connected by this group. For larger groups or groups where the
symmetries are defined at run time, a standard run-time implementation
of the same algorithm is provided.
For example, the following code completely initializes all elements of
the totally antisymmetric tensor in three dimensions ('epsilon
tensor'):
SGroup<3, AntiSymmetry<0,1>, AntiSymmetry<1,2>> sym;
Eigen::Tensor<double, 3> epsilon(3,3,3);
epsilon.setZero();
epsilon.symCoeff(sym, 0, 1, 2) = 1;
2013-11-15 06:35:11 +08:00
|
|
|
|
|
|
|
#include <Eigen/src/Core/util/DisableStupidWarnings.h>
|
|
|
|
|
2016-04-26 17:20:25 +08:00
|
|
|
#include "src/util/CXX11Meta.h"
|
|
|
|
|
CXX11/TensorSymmetry: add symmetry support for Tensor class
Add a symCoeff() method to the Tensor class template that allows the
user of the class to set multiple elements of a tensor at once if they
are connected by a symmetry operation with respect to the tensor's
indices (symmetry/antisymmetry/hermiticity/antihermiticity under
echange of two indices and combination thereof for different pairs of
indices).
A compile-time resolution of the required symmetry groups via meta
templates is also implemented. For small enough groups this is used to
unroll the loop that goes through all the elements of the Tensor that
are connected by this group. For larger groups or groups where the
symmetries are defined at run time, a standard run-time implementation
of the same algorithm is provided.
For example, the following code completely initializes all elements of
the totally antisymmetric tensor in three dimensions ('epsilon
tensor'):
SGroup<3, AntiSymmetry<0,1>, AntiSymmetry<1,2>> sym;
Eigen::Tensor<double, 3> epsilon(3,3,3);
epsilon.setZero();
epsilon.symCoeff(sym, 0, 1, 2) = 1;
2013-11-15 06:35:11 +08:00
|
|
|
/** \defgroup CXX11_TensorSymmetry_Module Tensor Symmetry Module
|
|
|
|
*
|
|
|
|
* This module provides a classes that allow for the definition of
|
|
|
|
* symmetries w.r.t. tensor indices.
|
|
|
|
*
|
|
|
|
* Including this module will implicitly include the Tensor module.
|
|
|
|
*
|
|
|
|
* \code
|
|
|
|
* #include <Eigen/TensorSymmetry>
|
|
|
|
* \endcode
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "src/TensorSymmetry/util/TemplateGroupTheory.h"
|
|
|
|
#include "src/TensorSymmetry/Symmetry.h"
|
|
|
|
#include "src/TensorSymmetry/StaticSymmetry.h"
|
|
|
|
#include "src/TensorSymmetry/DynamicSymmetry.h"
|
|
|
|
|
|
|
|
#include <Eigen/src/Core/util/ReenableStupidWarnings.h>
|
|
|
|
|
|
|
|
#endif // EIGEN_CXX11_TENSORSYMMETRY_MODULE
|
|
|
|
|
|
|
|
/*
|
|
|
|
* kate: space-indent on; indent-width 2; mixedindent off; indent-mode cstyle;
|
|
|
|
*/
|