m3
This commit is contained in:
36
tests/CayleyTransformationTest.cs
Normal file
36
tests/CayleyTransformationTest.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Skeleton.Algebra.Extensions;
|
||||
using Skeleton.Samples;
|
||||
using Skeleton.Utils;
|
||||
|
||||
namespace SkeletonTest.tests;
|
||||
|
||||
public static class CayleyTransformationTest
|
||||
{
|
||||
[DatapointSource]
|
||||
private static readonly LieSU2[] Data = 40.ScaleSamples(-1, 1).LieSU2LogSU2Samples().ToArray();
|
||||
private static Action<LieSU2> OnFail = x => Console.WriteLine(x.CSharpRepresentation);
|
||||
[Theory]
|
||||
public static void TestCayleyForLieSU2(LieSU2 data)
|
||||
{
|
||||
Action<LieSU2> rawTest = x =>
|
||||
{
|
||||
U2 cN = x.CayleyNegative();
|
||||
Assert.IsTrue((cN * cN.Hermitian()).IsEqualApprox(C22.One));
|
||||
};
|
||||
rawTest.OnFail(OnFail)(data);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
public static void TestCayleyUnitary(LieSU2 data)
|
||||
{
|
||||
U2 cN = data.CayleyNegative();
|
||||
U2 cP = data.CayleyPositive();
|
||||
var udN = cN.EigenDecomposition();
|
||||
var udP = cP.EigenDecomposition();
|
||||
Assert.IsTrue(cN.Det().IsEqualApprox(1));
|
||||
Assert.IsTrue(cP.Det().IsEqualApprox(1));
|
||||
Console.WriteLine($"{udN.J.Det()} =x= {udP.J.Det()}");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user