Skip to content

Instantly share code, notes, and snippets.

@lelemmen
lelemmen / main.cpp
Created November 30, 2017 09:49
Undocumented behavior of Eigen::Tensor contractions
#include <iostream>
#include <unsupported/Eigen/CXX11/Tensor>
// Inspired by my question and its accepted answer on StackOverflow (https://stackoverflow.com/questions/47556726), I've decided to create this in a little gist.
// This Gist is about some undocumented (https://bitbucket.org/eigen/eigen/src/default/unsupported/Eigen/CXX11/src/Tensor/README.md?fileviewer=file-view-default) behavior of Eigen::Tensor contractions.
/** Print the contents of a rank-four tensor in a fashionable way
*/
void print(const Eigen::Tensor<double, 4>& T) {