0

I'm trying to write a DenseMatrix object to a csv file using DelimitedWriter like so:

DelimitedWriter.WriteFile(originalData, "written.csv", ",");

A red line would appear saying that the type arguments for the method cannot be inferred from the usage and to specify the type arguments explicitly. So I tried doing this:

DelimitedWriter.WriteFile<Double>(originalData, "written.csv", ",");

to which I got, "The best overloaded match... has some invalid arguments".

And this:

DelimitedWriter.WriteFile<Double>(originalData<Double>, "written.csv", ",");

to which I got originalData cannot be used with type arguments. I also tried casting originalData as a Matrix (rather than DenseMatrix) but that did not work either. I'm not sure what I'm missing here. Any ideas?

TylerH
  • 20,799
  • 66
  • 75
  • 101
covfefe
  • 2,485
  • 8
  • 47
  • 77

2 Answers2

0

It looks like an internal versioning issue with Math.NET nuget packages, you will get an error even if you try to pass in a null literal for the first argument.

I notice that Intellisense says it is expecting a MathNet.Numerics.LinearAlgebra.Generic.Matrix<T> but that in version 3.0+ of Math.NET that type is MathNet.Numerics.LinearAlgebra.Matrix<T>

You may want to try installing the specific version that the text IO extensions says it supports from the package manager console:

Uninstall-Package MathNet.Numerics -Force
Install-Package MathNet.Numerics -Version 2.5.0

That worked for me. I'm not sure when the breaking changes were made, presumably with version 3.0. You should report this as an issue to the maintainers.

Mike Zboray
  • 39,828
  • 3
  • 90
  • 122
0

Use the v3 versions of the Data extensions with the v3 versions of Math.NET Numerics.

As of today e.g. use the MathNet.Numerics.Data.Text v3.0.0-beta02 package. You may need to allow pre-release packages in NuGet or this version may not appear though. Unfortunately there is no full v3 release of that package yet because of some pending changes.

Do not downgrade to Math.NET Numerics v2.

Christoph Rüegg
  • 4,626
  • 1
  • 20
  • 34