mathnet - How to convert an integer array to a matrix in c# -
i have integer array named resp
want rewrite/convert as/to row matrix
name resp
.
int[] resp= {1, 0, 1, 0};
i using mathnet.numerics library.
how can that?
in mathnet, not able initialize array of integers. is, there's in limited support available this. if tried, this:
unhandled exception: system.typeinitializationexception: type initializer 'mathnet.numerics.linearalgebra.vector`1' threw exception. ---> system.notsupportedexception: matrices , vectors of type 'int32' not supported. double, single, complex or complex32 supported @ point.
you can initialize vector similar values (with doubles) this:
var resp = new [] {1.0, 0.0, 1.0, 0.0}; var v = vector<double>.build; var rowvector = v.denseofarray(resp);
in order build matrix, need multi-dimensional array.
Comments
Post a Comment