2014-01-17 74 views

回答

2

可以使用conv_to矩阵类型之间转换:

mat A = my_function(); 
fmat B = conv_to<fmat>::from(A); 
fmat C = conv_to<fmat>::from(my_function()); 

或者,你可以改变你的函数到模板;例如:

template <typename T> 
Mat<T> other_function() { 
    return Mat<T>(4,4); 
} 

... 

fmat D = other_function<float>(); 
mat F = other_function<double>(); 
+0

什么是矢量?例如,双向量vec浮动向量fvec?上述解决方案也适用于矢量。谢谢!!!! –