Git Product home page Git Product logo

mathnet-numerics's Introduction

Math.NET Numerics

Math.NET Numerics is an opensource numerical library for .NET and Mono.

Math.NET Numerics is the numerical foundation of the Math.NET initiative, aiming to provide methods and algorithms for numerical computations in science, engineering and every day use. Covered topics include special functions, linear algebra, probability models, random numbers, statistics, interpolation, integration, regression, curve fitting, integral transforms (FFT) and more.

In addition to the core .NET package (which is written entirely in C#), Numerics specifically supports F# with idiomatic extension modules and maintains mathematical data structures like BigRational that originated in the F# PowerPack. If a performance boost is needed, the managed-code provider backing its linear algebra routines and decompositions can be exchanged with wrappers for optimized native implementations such as Intel MKL.

Math.NET Numerics is covered under the terms of the MIT license. You may therefore link to it and use it in both opensource and proprietary software projects. We accept contributions!

Current Version

Math.NET Numerics Version Math.NET Numerics
MKL Native Provider Version MKL Native Provider
OpenBLAS Native Provider Version OpenBLAS Native Provider
Data Extensions Version Data Extensions

Installation Instructions

The recommended way to get Math.NET Numerics is to use NuGet. The following packages are provided and maintained in the public NuGet Gallery.

Core Package:

  • MathNet.Numerics
  • MathNet.Numerics.FSharp - optional extensions for a better F# experience. BigRational.

Intel MKL Provider (optional):

  • MathNet.Numerics.Providers.MKL - Binding to Native Intel MKL provider.
  • MathNet.Numerics.MKL.Win - Native Intel MKL provider (Windows).
  • MathNet.Numerics.MKL.Win-x86 - Native Intel MKL provider (Windows/32-bit only).
  • MathNet.Numerics.MKL.Win-x64 - Native Intel MKL provider (Windows/64-bit only).

Data/IO Packages for reading and writing data (optional):

  • MathNet.Numerics.Data.Text - Text-based matrix formats like CSV and MatrixMarket.
  • MathNet.Numerics.Data.Matlab - MATLAB Level-5 matrix file format.

Platform Support and Dependencies

Supported Platforms:

  • .NET 5.0 or higher (Package includes builds for 5.0 and 6.0)
  • .NET Framework 4.6.1 or higher (Package includes builds for 4.6.1 and 4.8)
  • .NET Standard 2.0 or higher (Package includes builds for 2.0)

For full details, dependencies and platform discrepancies see Platform Compatibility.

Building Math.NET Numerics

Windows (.NET): AppVeyor build status

You can build Math.NET Numerics with an IDE like VisualStudio or JetBrains Rider, with MsBuild, .NET CLI tools or with FAKE (recommended).

FAKE:

./build.sh build (or build.cmd)
./build.sh test

.NET CLI:

./restore.sh (or restore.cmd)
dotnet build MathNet.Numerics.sln

MsBuild/XBuild:

./restore.sh (or restore.cmd)
msbuild MathNet.Numerics.sln

See Build & Tools for full details on how to build, generate documentation or even create a full release.

mathnet-numerics's People

Contributors

aignas avatar alexkaratarakis avatar candychiu avatar cdrnet avatar cuda avatar dependabot[bot] avatar diluculo avatar eriove avatar evangelink avatar evelinag avatar febkor avatar hany-abdelrahman avatar ijmmuch avatar jkalias avatar jnyrup avatar jvangael avatar kjbartel avatar larzw avatar lionpeloux avatar malin2223 avatar manyue avatar mjmckp avatar philcleveland avatar praeclarum avatar rca22 avatar rneatherway avatar scottstephens avatar superbest avatar tibel avatar yoon-gu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mathnet-numerics's Issues

Geometric Distribution Sampling formula seems wrong

Below is the Sample method from Geometric Distribution at https://github.com/mathnet/mathnet-numerics/blob/master/src/Numerics/Distributions/Discrete/Geometric.cs

    private static int DoSample(Random rnd, double p)
    {
        return (int)Math.Ceiling(-Math.Log(rnd.NextDouble()) / p);
    }

If rnd = 0 (it is possible) , then it would return -Infinity, which is acceptable in theory (as probability of rnd=0 is 0), however it might result in a problem in practical, as the range for the sampling should take values in real.

Also, shouldn't it be log(1-p) instead of /p?

SparseMatrix should implement its own ToString() method

Implementing the ToString() method for SparseMatrix would improve debugging experience for large matrices, which is kinda slow at the moment. Additionally, for sparse matrices it doesn't make sense to include the 0-entries.

Maybe just display the non-zeros count ... or show the first 20 non-zero entries including indices.

complex eigenvalue decomposition bug

Original Report: https://mathnetnumerics.codeplex.com/workitem/5694

// Breakpoint before the decomposition shows the content of the first DenseMatrix in the array of dense matrices (index = [0] )
base {MathNet.Numerics.LinearAlgebra.Complex32.Matrix} = {(0.9275488, 0),(0, 0),(0, 0)(-0.9275488, 0),(0.9275488, 0),(0, 0)(0, 0),(-0.9275488, 0),(0.9275488, 0)}

UserEvd eigVR = new UserEvd(mArrayOld[0]); // halts the program

Descriptive statistics needing two passes over the data

Original Report: https://mathnetnumerics.codeplex.com/workitem/5670

I guess the goal of descriptive statistics is to compute a whole bunch of stats in as few passes over the data as possible. It has proven very useful to me many times; the only slightly unsatisfactory thing I feel is that it computes the Median all the time. This particular pass seems to require access to all the data - in memory - at the same time. Not sure how we could change the API to be as elegant as it currently is but we might be able to give people the option as to what level of descriptive statistics they require. Not sure if people have any thoughts?

AlmostEqualWithDecimalPlaces magitude of decimal places

Is there a reason why Precision#AlmostEqualsWithRelativeDecimalPlaces and Precision#AlmostEqualsWithAbsoluteDecimalPlaces calculate decimalPlaceMagnitude as Math.Pow(10, -(decimalPlaces - 1)) rather than Math.Pow(10, -decimalPlaces)?

This seems contrary to the documentation that:

The values are equal if the difference between the two numbers is smaller than 10^(-numberOfDecimalPlaces).

Distributions.StudentT.Density returns NaN for large degrees of freedom

Distributions.StudentT.Density returns NaN for large degrees of freedom. For examples

foreach(int dof in Enumerable.Range(1,500))
{
    var dist = new MathNet.Numerics.Distributions.StudentT(0,1,dof);
    Console.WriteLine("{0} {1}",dist,dist.Density(0));
}

StudentT(Location = 0, Scale = 1, DoF = 1) 0.318309886183791
StudentT(Location = 0, Scale = 1, DoF = 2) 0.353553390593275
StudentT(Location = 0, Scale = 1, DoF = 3) 0.367552596947861
.......
StudentT(Location = 0, Scale = 1, DoF = 337) 0.398646439335889
StudentT(Location = 0, Scale = 1, DoF = 338) 0.398647314279096
StudentT(Location = 0, Scale = 1, DoF = 339) Infinity
StudentT(Location = 0, Scale = 1, DoF = 340) NaN
StudentT(Location = 0, Scale = 1, DoF = 341) NaN

The StudentT distribution is well defined for all degrees of freedom, so this is a bug. However, for large degrees of freedom it converges to a normal distribution, so there's a workaround:

new MathNet.Numerics.Distributions.Normal(0,1).Density(0)

0.398942280401433

http://numerics.mathdotnet.com/api/MathNet.Numerics.Distributions/StudentT.htm

Levinson Decomposition Omitted

Levinnson Decomposition (both symmetric and non symmetric) was available in dnAnalytics 0.2 and are highly popular in signal processing. was there any special issues that it is omitted ?

Build error in CompositeSolver classes for Silverlight 5

After converting the Silverlight project to version 5 (RC) of Silverlight, I get the following build error in some of the LoadSolverInformationFromAssembly method overloads in the CompositeSolver classes:

Argument 1: cannot convert from 'System.Reflection.AssemblyName' to 'string'

The build error apparently occurs in code sections like this:

        var assemblyName = new AssemblyName(assemblyFileName);
        var assembly = Assembly.Load(assemblyName);

where the (public) Assembly.Load method in SL5 does not support an AssemblyName argument.

According to the Silverlight MSDN documentation even for SL4 (http://msdn.microsoft.com/en-us/library/x4cw969y(v=VS.95).aspx), public use of this method is advised against, as the method is claimed to throw a MethodAccessException. It seems like this safety barrier has indeed been activated in SL5...

I have solved the problem in my local copy of mathnet-numerics by using theAssembly.Load(string) overload instead, with the following formulation:

        var assembly = Assembly.Load(assemblyName.FullName);

If I have interpreted the MSDN documentation (http://msdn.microsoft.com/en-us/library/ky3942xh(v=VS.96).aspx) correctly for this overload, I do need the full display name of the assembly, so I thought it would be safest to have the AssemblyName object generate it for me.

I do not know if the assembly load feature is covered in the unit tests, either way I get all tests to pass after the above code modifications.

Sparse arithmetics: accidential zeros inconsistent with Equals

Currently sparse arithmetics allows accidential zeros (e.g. (null, 5)+(1, -5) = (1,0) instead of (1,null)). However, IEquatable<Vector>.Equals is currently implemented such that (1,0) is not equal to (1,null). This is inconsistent.

Either one of the two should be fixed:

  • avoid accidential zeros in arithmetic routines
  • change Equals implementation to treat accidential zeros the same as full zeros

Sequence of data in VolatileWindow?

Shouldn't the sequence of the elements in source and VolatileWindow be the same (like a shift buffer)?

Actually this is what happens:

input  = 1, 2, 3, 4, 5
output = 5, 4, 3, 2, 1

Performance of DescriptiveStatistics is questionable

Original Report: https://mathnetnumerics.codeplex.com/workitem/5698

I have a VERY large dataset (TBs in size) that I will be wanting to run against. I was testing against only 20 MBs of data and using the DescriptiveStatistics class. I noticed that performance was harsh when i used this class even if just asking for 1 or 2 types of stats. This would run the DescriptiveStatistics class over my aggregate contents in approx 104 seconds. (even just for the MEAN)

I then decided I should give the static class/ienumerable extensions a try, this shocked me in my evaluation of the exact same dataset, 69 milliseconds. (just MEAN)

I would like to suggest an update to the DescriptiveStatistics class. lazy load the statistics. this would increase performance drastically.

Thanks,

Single.SparseVector.Divide exception

When I try to divide a Single.SparseVector with a float number I get the following exception:

"Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection."

In my opinion there is nothing illegal in this operation. The vector was obtained from a SparseMatrix:

Single.SparseVector v = mySparseMatrix.Row(index);

SparseMatrix.initCol (in F# facade) iterates over rowcount

Original Report: https://mathnetnumerics.codeplex.com/workitem/5695

The SparseMatrix.initCol function in the MathNet.Numerics.FSharp assembly incorrectly iterates over the row count instead of the column count. For example:

SparseMatrix.initCol 3 4 (fun i -> DenseVector.ofList [float i; float i; float i]);;
val it : SparseMatrix = 0,1,2,0
0,1,2,0
0,1,2,0

You can see that the fourth column is uninitialized, rather than having all 3's. Fix appears to be substituting m for n in the for loop in initCol.

CommonParallel does not support empty loops

CommonParallel.For breaks on empty loops (fromInclusive=0, toExclusive=0) with an ArgumentOutOfRange exception instead of just skipping the whole operation.

While we're at it, we should also consider to special-case the case of only a single item.

Dirichlet DensityLn is wrong

Original Report: https://mathnetnumerics.codeplex.com/workitem/5700

hello,

your current version of the Dirichlet.DensityLn function is wrong. the calculated do not match the Beta.DensityLn values when using a 2 dimensional parmaeter.
you can check the bug yourself by comparing the current Dirichlet function with the following code that works:

public double DirichletDensityLn(Dirichlet dir, double[] pi)
{
double ans = 0;
double sumalpha = 0;
double[] alpha = dir.Alpha;

for (int i = 0; i < pi.Length; i++)
{
ans += (alpha[i] - 1) * Math.Log(pi[i]) - SpecialFunctions.GammaLn(alpha[i]);
sumalpha += alpha[i];
}
ans += SpecialFunctions.GammaLn(sumalpha);
return ans;
}

best regards,
makro

Genetic optimization design

I've added a simple genetic optimization solver for continuous functions to my fork -
https://github.com/cuda/mathnet-numerics/tree/ga

I'm not sure of the design. I used delegates for the primary functions (pairing, mating, mutating, evaluating/cost, and convergence) so users could pass in lambdas.

Simple example using defaults (minimize x^2 where -10 < x < 10):

var solver = new ContinuousSolver((double[] x) => x[0]*x[0], ContinuousBounds.CreateBounds(1, -10, 10));
var solutions = solver.Evolve();

The solver takes in a cost function as a delegate and an IList of bounds.

Users can override the default behavior by setting the various delegates using lambdas (or they could use regular methods):

solver.Pair = (options, population) => ...
solver.Crossover = (options, bounds, ma, pa) => ...
solver.Mutate = (options, bounds, population) => ...
solver.Converge = (options, currentStatus, population) => ...

I prefixed the solver and bounds with Continuous so we could support other function types in the future, but since they are already in the Continuous namespace it might be redundant.

Any comments on the design or code would be greatly appreciated.

Thanks,
Marcus

Addtional Row and Column methods available in other packages such as octave, R,..

SORTING AND SHUFFLING:
SortByColumn -- similar to excel sort
SortByRow
ShuffleRows --puts rowvectors in a matrix in a random order
ShuffleColumns --puts columnvectos in a matrix in a random order.

FINDING AND SETTING SPECIFIC ELEMENTS:
FindMask(Predicate matchCondition) find a mask matrix of 0's and 1's where matchCondition is true.
OnMaskSet(Matrix mask, T value)
OnMaskApply(Matrix mask, Func<T, T> func) can apply a functin to all elements of a Mask Matrix.

e.g. in other languages:
A= Find(myMatrix<0)
myMatrix(A)=0;

//find elemets less than 0
var lessthanZero= myMatrix.FindMask(elem => (elem < 0.0))
// set them all to 0
myMatrix.OnMaskSet(lessthanZero, 0.0)

// a similar method:
FindIndices(Predicate matchCondition)

REMOVING AND SETTING SPECIFIC ROW AND COLUM RANGES:
RemoveColumn
RemoveRow
RemoveRowandColumn

SelectColumns ..selects all rows from a specified range of columns e.g. Matrix(:,10:12) would be selectColumns(10,3)
SelectRows ..selects all rows from a specified range of Rows e.g. Matrix(10:12,:) would be selectRows(10,3)
SetColumns
SetRows

Vector performance issues

Currently Control class only checks if (Control.DisableParallelization || Control.NumberOfParallelWorkerThreads < 2) to decide to use parallel execution or not.

I think it should use bool Control.ParallelizeOperation(int elements) instead, as the element count is relevant for that decision too.

DenseVector and SparseVector operators should call correct method

DenseVector:

  • divide scalar operator should call Divide() instead of Multiply()
  • multiply operator should call DotProduct() instead of LinearAlgebraProvider
  • double vector modulus operator: type of rightSide operand should be double instead of float

SparseVector:

  • divide scalar operator should call Divide() instead of Multiply()
  • double vector modulus operator: type of rightSide operand should be double instead of float

some files are missing!

I'm usind numerics ver 2.4.0 in my project and after runing the project and doing someparts it says find a source:ManagedLinearAlgebraProvider.Double
original location:
c:\TeamCity\buildAgent\work\d4ecde2945c804d6\src\Numerics\Algorithms\LinearAlgebra\ManagedLinearAlgebraProvider.Double.

and open a window to locate it when i press cancel the program continuous But my matices are all NAN.
and this is not the only file it wants, everytime it needs a different file...
what should I do?

Vector.SubVector() should use Storage.CopySubVectorTo()

Vector.CopySubVectorTo() is using Storage.CopySubVectorTo().
Vector.SubVector() uses CommonParallel.For() what is slower.

Also Vector.SubVector() does not need to be overridden in every Vector derivative as all can be handled in the Storage implementation.

SubMatrix throws indexOutofRange exception for Diagonal Matrix

For Diagonal Matrices Submatrix creates a SparseMatrix and somehow tries to populate it incorrectly.
(This was from a build downloaded three weeks ago.)

using MathNet.Numerics.LinearAlgebra.Generic;
using MathNet.Numerics.LinearAlgebra.Double;
namespace TestLinearAlgebra
{
class Program
{
static void Main(string[] args)
{

        var diagMatrix= new DiagonalMatrix(3);
        var subM2 = diagMatrix.SubMatrix(0, 2, 1, 2); //throws Exception
        var subM3 = diagMatrix.SubMatrix(0, 3, 1, 2); //throws Exception

 }

}
}

System.ArgumentOutOfRangeException was unhandled
Message=Specified argument was out of the range of valid values.
Parameter name: row
..

Statistics: DescriptiveStatistics Kurtosis fix

Hello, I was using MathNet library and suddenly found an issue:
DescriptiveStatistics computes kurtosis incorrectly for large series (my example is a sample of Meixner(0,Sqrt(2),0,1) of 10000 values).

The proof (as a test) and the fix is already in my branch: statistics-kurtosis

Also there is a small fix for parsing double int StatTestData for machines which have not an English locale as default

Convert to portable class library

.Net 4.5/VS11 will come with a new project type, "Portable Class Library", that will create libraries that will work in all .Net profiles (including full .Net 4, Silverlight 4, Windows Phone 7, Tailored/Metro and Xbox 360 - hopefully also Mono?).

Might be interesting, if not just to simplify our current dual linked Net40/SL4 project approach.

Handling of elements in Symmetric matrices

When working with symmetric matrices there is a potential risk of misuse because element ij and element ji is the same value. Therefore if a user makes a modification on both triangles of the matrix, the result would not be what the user expects.
For example, user A have a 3x3 SymmetricDenseMatrix:
[0, 0, 0]
[, 0, 0]
[
,~, 0]

Since the matrix is symmetric (s)he proceeds to add 5 to (0,2), so:
[0, 0, 5]
[, 0, 0]
[
,~, 0]

The symmetric matrix is then expected to return 5 in both matrix[2,0] and matrix[0,2], which stands true.

On the other hand, there is a risk of adding the value twice with (for example) the intention to preserve symmetry, If add 5 to both (0,2) and (2,0) the result is:
[0, 0, 10]
[, 0, 0]
[
, ~, 0]

which is not what is expected. The actual cases would involve writing on both sides of the matrix for whatever reason and won't be so clear as the provided example so we have the danger of allowing silent errors which would be hard to debug.

I would like to know your opinion about how you would want to handle this in mathnet.
My opinion, and the handling I currently use, is to disallow writing on the lower triangle of the matrix (throw an exception when attempted). Only writing on the diagonal and upper triangle is allowed, so you are alerted in case of mis-use. This has caught a huge amount of bugs.

Please port filters from math.net neodym to math.net numerics

Neodym is still based on discontinued Iridium project, but contains some useful filters.
May you also port the rest of Neodym to Numerics?
It seems that some parts (e.g. some signal generators) were already ported. So completing this would completely replace Neodym.

Hope this is possible because of the different licenses of both projects.

Sparse Vector Managed Inplace-Arithmetic broken

The inplace implementations of the sparse vector arithmetic methods (i.e. DoAdd, DoSubstract) seem to be completely broken if the vectors are indeed arbitrarily sparse. Confirmed by new more extensive theory-based unit tests.

Related to gh-18.

Confusion where to put issues

On http://numerics.mathdotnet.com/
under "use" is a Report link that send you to https://github.com/mathnet/mathnet-numerics/issues
in README.markdown is link Work Items and Bug Tracker that sends you to http://mathnetnumerics.codeplex.com/workitem/list/advanced

I think all the info should be consistent.
It should be only one issue tracker here on github and readme should be changed. Also there should be some information on codeplex that you should create new issues on github.

Matrix Inverse with different results. Bug?

Hi,

I found a phenomena I can not explain. For two same calculations I get different results of matrix inverse. It depends how I start the unit test in Visual Studio (Run or debug). (and it does not depend on how I build it (Release or Debug).

Here is the code to reproduce:

using MathNet.Numerics.LinearAlgebra.Single;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace MathNetTestProject
{
    [TestClass]
    public class MathTests
    {
        [TestMethod]
        public void MatrixInverseTest()
        {
            var matrix =
               new DenseMatrix(
                   new float[,]
                        {
                            { 2977729, 11436322, 6625426, 2285420 }, { 11436322, 46377269, 26289264, 9135869 },
                            { 6625426, 26289264, 15675893, 5229745 }, { 2285420, 9135869, 5229745, 1913456 }
                        });

            var inverseMatrix = matrix.Inverse();
            using (var file = new System.IO.StreamWriter(@"C:\Temp\Test.txt", true))
            {
                for (int i = 0; i < inverseMatrix.RowCount; i++)
                {
                    for (int j = 0; j < inverseMatrix.ColumnCount; j++)
                    {
                        file.WriteLine("inversematrix: " + inverseMatrix.At(i, j));
                    }
                }
            }
        }
    }
}

The results:

Started using Unit Test Debug:
inversematrix: 7.909061E-06
inversematrix: -8.58662E-07
inversematrix: -1.349097E-06
inversematrix: -1.659549E-06
inversematrix: -8.586639E-07
inversematrix: 7.608483E-07
inversematrix: -4.909148E-07
inversematrix: -1.265377E-06
inversematrix: -1.349096E-06
inversematrix: -4.909151E-07
inversematrix: 1.562084E-06
inversematrix: -3.141512E-07
inversematrix: -1.659542E-06
inversematrix: -1.265379E-06
inversematrix: -3.141512E-07
inversematrix: 9.404982E-06

Started using Unit Test Run:
inversematrix: 7.909059E-06
inversematrix: -8.586632E-07
inversematrix: -1.349095E-06
inversematrix: -1.65954E-06
inversematrix: -8.586637E-07
inversematrix: 7.608483E-07
inversematrix: -4.909148E-07
inversematrix: -1.265377E-06
inversematrix: -1.349094E-06
inversematrix: -4.90915E-07
inversematrix: 1.562083E-06
inversematrix: -3.14152E-07
inversematrix: -1.659544E-06
inversematrix: -1.265377E-06
inversematrix: -3.14151E-07
inversematrix: 9.404975E-06

Do you see the little difference between the two results?

Funny is, that I do not get the same behaviour if I take a double matrix (then it works perfectly).
I am not sure if this behaviour is a problem of visual studio or a problem of math.net.
But please have a look to this situation.

My environment: Visual Studio 2010 with the SP1, latest Math.Net library version taken from nuget.

Thanks!

Suggestion: Support building with Mono's 'xbuild' ?

Tried to build Math.NET using Mono's xbuild (on Windows), and it failed. Maybe this isn't a mainline scenario but having some kind of build on Linux/Mac would be useful

  • No dmcs.bat C# compiler found. Copied mcs.bat to dmcs.bat to continue. Not sure why it's looking for dmcs.bat
  • The C# compilation of Numerics uses a mix of .NET 4.5 and .NET 4.0 DLLs. Not sure why. This causes a warning about 'multiple ExtensionAttribute'
  • The compilation of 'Examples' fails with

LinearAlgebra\Factorization\Evd.cs(159,22): error CS0121: The call is ambiguous between the following methods or properties: `

MathNet.Numerics.LinearAlgebra.Generic.Matrix.operator *(MathNet.Numerics.LinearAlgebra.Generic.Matrix, MathNet.Numerics.LinearAlgebra.Generic.Matrix)
MathNet.Numerics.LinearAlgebra.Generic.Matrix.operator *(MathNet.Numerics.LinearAlgebra.Generic.Matrix, MathNet.Numerics.LinearAlgebra.Generic.Matrix)

Possibly a bug in the Mono C# compiler getting confused between the
operator *(Matrix<T≶, T)
operator *(Matrix<T>,Matrix<T>)

overloads. Even if not supported the Mono team should know about this.

For Sparse Matrix/Vector provide a means to access the non-zero sparse values without enumerating over a complete column/row.

There are interbal arrays that would be more efficient for access to the non-zero values in a SparseMatrix. Somtheing alaong the lines of:
let last = coMatrix.InternalSparseRowOffsets.Length - 1
if item >= 0 && item <= last then
let (startI, endI) =
if item = last then (coMatrix.InternalSparseRowOffsets.[item], coMatrix.InternalSparseRowOffsets.[item])
else (coMatrix.InternalSparseRowOffsets.[item], coMatrix.InternalSparseRowOffsets.[item + 1] - 1)
seq {
for idx = startI to endI do
let item= coMatrix.InternalSparseColumnValues.[idx]
yield KeyValuePair(coMatrix.InternalSparseValues.[idx], item)
}

It seems the only alternative is to iterate over a Row.
The element-wise operations would allow for more efficient code.

Random Vector not static

Hi am using the library in a project
and find it peculiar that vector.Random(..) is not a static method, since it does not use any of this members' attributes.

i.e.:
DenseVector v= new DenseVector(1); //v's data are not needed at all..
IContinuousDistribution zeroOneDistribution = new ContinuousUniform();
DenseVector randVector= v.Random(50, zeroOneDistribution)

instead of:

IContinuousDistribution zeroOneDistribution = new ContinuousUniform();
DenseVector randVector= DenseVector.Random(50, zeroOneDistribution)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.