41 lines
1.2 KiB
C#
41 lines
1.2 KiB
C#
using System;
|
|
using System.Linq;
|
|
using Skeleton.Algebra.Extensions;
|
|
using Skeleton.Samples;
|
|
using Skeleton.Utils;
|
|
using Skeleton.Utils.Helpers;
|
|
|
|
namespace Skeleton.Test;
|
|
[TestFixture]
|
|
public class CayleyTransformationTest : BaseTest
|
|
{
|
|
[DatapointSource]
|
|
private static readonly LieSU2[] Data = 40
|
|
.WithSeed(Seed)
|
|
.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()}");
|
|
}
|
|
} |