48 lines
1.4 KiB
C#
48 lines
1.4 KiB
C#
using System;
|
|
using System.Linq;
|
|
using System.Numerics;
|
|
using Skeleton.Algebra.Extensions;
|
|
using Skeleton.Samples;
|
|
using Skeleton.Utils;
|
|
using Skeleton.Utils.Helpers;
|
|
|
|
namespace Skeleton.Test;
|
|
[TestFixture]
|
|
public class CayleySU3Test : BaseTest
|
|
{
|
|
[DatapointSource]
|
|
private static readonly LieSU3[] Data = 40
|
|
.WithSeed(Seed)
|
|
.ScaleSamples(-1, 1)
|
|
.LieSU3LogSU3Samples()
|
|
.ToArray();
|
|
private static Action<LieSU3> OnFail = x => Console.WriteLine(x.CSharpRepresentation);
|
|
[Theory]
|
|
public static void TestCayleyForLieSU3(LieSU3 data)
|
|
{
|
|
Action<LieSU3> rawTest = x =>
|
|
{
|
|
Assert.IsTrue(x.Property.IsSkewHermitian);
|
|
U3 cN = x.CayleyNegative();
|
|
Assert.IsTrue(cN.Property.IsUnitary);
|
|
Console.WriteLine(cN.Representation);
|
|
U3 h =cN.Hermitian();
|
|
U3 xx = cN * cN.Hermitian();
|
|
Assert.IsTrue((xx).IsEqualApprox(C33.One));
|
|
};
|
|
rawTest.OnFail(OnFail)(data);
|
|
}
|
|
|
|
[Theory]
|
|
public static void TestCayleyUnitary(LieSU3 data)
|
|
{
|
|
U3 cN = data.CayleyNegative();
|
|
U3 cP = data.CayleyPositive();
|
|
var udN = cN.EigenDecomposition();
|
|
var udP = cP.EigenDecomposition();
|
|
Assert.IsTrue(cN.Det().IsEqualApprox(Complex.Conjugate(cP.Det())));
|
|
Console.WriteLine($"{cN.Det()} =x= {cP.Det()}");
|
|
Console.WriteLine($"{udN.J.Det()} =x= {udP.J.Det()}");
|
|
}
|
|
|
|
} |