2014-01-17 73 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?上述解決方案也適用於矢量。謝謝!!!! –