1
以下代碼:在犰狳上C++,總和(<sp_mat>,<dim>)上稀疏矩陣不起作用
#include <iostream>
#include <armadillo>
using namespace std;
using namespace arma;
int main()
{
sp_mat A = speye<sp_mat>(5,5);
rowvec s1 = max(A,0);
return 0;
}
給出以下編譯時間錯誤:
benchmark.cpp: In function ‘int main()’:
benchmark.cpp:11:21: error: conversion from ‘arma::enable_if2<true, const arma::SpOp<arma::SpMat<double>, arma::spop_max> >::result {aka const arma::SpOp<arma::SpMat<double>, arma::spop_max>}’ to non-scalar type ‘arma::rowvec {aka arma::Row<double>}’ requested
rowvec s1 = max(A,0);
^
make: *** [all] Error 1
同爲分鐘,和與對稀疏矩陣的其他操作,而對密集矩陣來說,它們工作得非常好。 我在這裏做錯了什麼?