I want to calculate something like: Matrix<float> * Matrix<double>
the Matrix<float>
has about 6M*3 elements , how can I convert the Matrix<double>
to Matrix<float>
so that I can get a Matrix<float>
result.
You can convert your double matrix argument to a float matrix using the Map
function:
Matrix<double> m1 = Matrix<double>.Build.Random(6000000,3);
Matrix<float> m2 = m1.Map(x => (float)x);
Or alternatively
Matrix<float> m2 = m1.Map(Convert.ToSingle);