简体   繁体   English

用特征库再现张量矩阵

[英]reproducing a tensor matrix with eigen library

I'm facing a little problem. 我面临一个小问题。 I'm translating a program from matlab/octave to C++. 我正在将程序从matlab / octave转换为C ++。 This progam is dealing with some matrix manipulation. 该程序处理一些矩阵操作。 I want to reproduce this : in matlab/octave we can define a matrix like : 我想重现这一点:在matlab / octave中,我们可以定义一个矩阵:

      matrix = zeros(10,25,360);

and I get a matrix with 10 rows, 25 columns and a "depth" of 360. I want to reproduce the same thing in C++ using Eigen. 我得到了一个包含10行,25列和360的“深度”的矩阵。我想使用Eigen在C ++中重现同样的事情。

Thank you in advance for your help. 预先感谢您的帮助。

There are unsupported Modules for Eigen which let you define tensors . Eigen有不受支持的模块 ,可让您定义张量 With those modules you can translate your problem into C++. 使用这些模块,您可以将问题转换为C ++。

The current Eigen tensor module is extremely limited feature wise. 当前的Eigen张量模块在功能上极为有限。 You can't even add the coefficients of 2 tensors together! 您甚至无法将2个张量的系数相加! I have been using the tensor code in this fork of Eigen instead. 我一直在Eigen的这个fork中使用张量代码 It adds support for coefficient wise operations, convolutions, contractions, and recently morphing primitives such as slicing. 它增加了对系数明智运算,卷积,收缩以及最近变形的图元(例如切片)的支持。 Moreover it can take advantage of GPUs to speed things up which was the big selling point for me. 此外,它可以利用GPU来加快处理速度,这对我来说是最大的卖点。

There is a pending pull request so hopefully it will make its way into the main Eigen code base soon. 有一个待处理的请求,因此希望它将很快进入主要的Eigen代码库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM