Skip to content

Instantly share code, notes, and snippets.

@SquidDev
Created November 25, 2014 22:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SquidDev/128d9fc3bab62478afba to your computer and use it in GitHub Desktop.
Save SquidDev/128d9fc3bab62478afba to your computer and use it in GitHub Desktop.
using System;
using MathNet.Numerics.LinearAlgebra;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Testing
{
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{
Matrix<float> a = Matrix<float>.Build.Dense(2, 2, new float[] { 10, 19, 25, 10 });
Console.WriteLine("Det {0}", a.Determinant());
Console.WriteLine("Det Int {0}", (int)a.Determinant());
Console.WriteLine("Det Trunc {0}", Math.Truncate(a.Determinant()));
Console.WriteLine("Det Round {0}", Math.Round(a.Determinant()));
Console.WriteLine("Det floor {0}", Math.Floor(a.Determinant()));
}
}
}
Run:
Det -375
Det Int -374
Det Trunc -374
Det Round -375
Det floor -375
Debug:
Det -375
Det Int -375
Det Trunc -375
Det Round -375
Det floor -376
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment