@gjordan wrote:
I’ve been using the intel MKL implementation of SVD() through Math.NET numerics. I’ve had success running the algorithm. However, for very large matrices (in this case 64,000 x 500), I get the following error:
Unhandled exception. System.OverflowException: Arithmetic operation resulted in an overflow. at MathNet.Numerics.LinearAlgebra.Storage.DenseColumnMajorMatrixStorage`1..ctor(Int32 rows, Int32 columns) at MathNet.Numerics.LinearAlgebra.Double.DenseMatrix..ctor(Int32 order) at MathNet.Numerics.LinearAlgebra.Double.Factorization.DenseSvd.Create(DenseMatrix matrix, Boolean computeVectors) at MathNet.Numerics.LinearAlgebra.Double.DenseMatrix.Svd(Boolean computeVectors)
My questions are: Is this an inherent limitation in the MKL when using with large matrices? Is this a feature of the C# code and I’ve hit the upper limit of the size of the matrix? Is there a hot fix you could suggest that could be implemented to allow the library to be run on larger matrices? Have I done something goofy with the setup of the software?
I’ve pasted the relevant source code below along with the project file (I can’t upload items as a new user).
Thanks!
***** Source Code ****
using System; using MathNet.Numerics.LinearAlgebra; using System.Diagnostics; namespace Copula { class Program { static void Main(string[] args) { Console.WriteLine("Parsing matrix dimensions from input parameters."); //int n_rows = Int32.Parse(args[0]); //int n_columns = Int32.Parse(args[1]); int n_columns = 500; int n_rows = 64000; Console.WriteLine("Generating Random matrix wtih dimensions " + n_rows + " rows and " + n_columns + " columns."); var stop_watch = Stopwatch.StartNew(); var time_series_matrix = GenerateRandomMatrix(n_rows, n_columns); stop_watch.Stop(); Console.Write("Took " + stop_watch.Elapsed + "\n"); Console.WriteLine("Performing SVD."); stop_watch = Stopwatch.StartNew(); var ts_svd = time_series_matrix.Svd(); stop_watch.Stop(); Console.Write("Took " + stop_watch.Elapsed + "\n"); } static Matrix<double> GenerateRandomMatrix(int n_rows, int n_columns) { Matrix<double> out_matrix = Matrix<double>.Build.Random(n_rows, n_columns); return out_matrix; } } }
****** Project File
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <TargetFramework>netcoreapp3.0</TargetFramework> </PropertyGroup> <ItemGroup> <PackageReference Include="MathNet.Numerics" Version="4.8.1" /> <PackageReference Include="MathNet.Numerics.MKL.Win-x64" Version="2.3.0" /> <PackageReference Include="Meta.Numerics" Version="4.0.7" /> </ItemGroup> </Project>
Posts: 1
Participants: 1