为什么我在C ++中使用Eigen会出现此错误?

时间:2016-11-09 11:34:13

标签: c++ eigen

我试图在C ++中使用Eigen和张量,我得到两个错误 下面的 - (void)viewDidLoad { [super viewDidLoad]; //keyboard observers [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil]; //tap on tableview or whole view UITapGestureRecognizer *gestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hideKeyboard)]; [self.view addGestureRecognizer:gestureRecognizer]; //scroll to bottom of conversation [self scrollToBottomOfConversation]; } - (void)scrollToBottomOfConversation { CGFloat yOffset = 0; if (_chatConversationTableView.contentSize.height > _chatConversationTableView.bounds.size.height) { yOffset = _chatConversationTableView.contentSize.height - _chatConversationTableView.bounds.size.height; } [_chatConversationTableView setContentOffset:CGPointMake(0, yOffset) animated:NO]; } - (void)keyboardWillShow:(NSNotification *)notification { NSDictionary *userInfo = [notification userInfo]; CGSize size = [[userInfo objectForKey: UIKeyboardFrameEndUserInfoKey] CGRectValue].size; CGRect frame = CGRectMake(_chatConversationTableView.frame.origin.x, _chatConversationTableView.frame.origin.y, _chatConversationTableView.frame.size.width, _chatConversationTableView.frame.size.height - size.height); _chatConversationTableView.frame = frame; CGRect framee = containerView.frame;//containerView is my subView which holds the textbox and send button framee.origin.y = self.view.frame.size.height - framee.size.height - size.height; containerView.frame = framee; [UIView commitAnimations]; //scroll to bottom of conversation [self scrollToBottomOfConversation]; } -(void)keyboardWillHide:(NSNotification *)notification { NSDictionary *userInfo = [notification userInfo]; CGSize size = [[userInfo objectForKey: UIKeyboardFrameEndUserInfoKey] CGRectValue].size; _chatConversationTableView.frame = CGRectMake(_chatConversationTableView.frame.origin.x, _chatConversationTableView.frame.origin.y, _chatConversationTableView.frame.size.width, _chatConversationTableView.frame.size.height + size.height); CGRect frame = containerView.frame; frame.origin.y = self.view.frame.size.height - frame.size.height; containerView.frame = frame; [UIView commitAnimations]; } 命令和添加命令。

如何在每个“模式”(本例中为3 x 3矩阵)中创建具有特定尺寸的新张量,如何添加这种类型的两个张量?

另外,我需要做些什么才能在其中一种模式中采用*张量并将其与自身相乘(通过张量收缩)以获得新的3 x 3张量?

new

我得到的错误:对于新陈述:

#include <eigen/Eigen/Core>
#include <eigen/unsupported/Eigen/CXX11/Tensor>


int main()
{
    Tensor<double, 2>* tensor;

    tensor = new Tensor<double, 2>(3,3);

    (*tensor) = (*tensor) + (*tensor);
}

对于补充声明:

Field `Tensor' must be static.

1 个答案:

答案 0 :(得分:0)

gcc-5.4,libeigen3-dev在ubu16上,以下编译为:

// g ++ --std = c ++ 11 -I / usr / include / eigen3 test2.cpp -Wall -o test2

leaflet