init
This commit is contained in:
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
bin/
|
||||||
|
obj/
|
||||||
|
/packages/
|
||||||
|
riderModule.iml
|
||||||
|
/_ReSharper.Caches/
|
||||||
13
Hermeteus.csproj
Normal file
13
Hermeteus.csproj
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Skeleton\Skeleton.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
22
Hermeteus.sln
Normal file
22
Hermeteus.sln
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Hermeteus", "Hermeteus.csproj", "{65C35817-9FA0-4AC6-B798-4AFBFC66A7C7}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Skeleton", "..\Skeleton\Skeleton.csproj", "{D8D5EFCF-16AD-4E1F-ACF6-B47367A5CDB6}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{65C35817-9FA0-4AC6-B798-4AFBFC66A7C7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{65C35817-9FA0-4AC6-B798-4AFBFC66A7C7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{65C35817-9FA0-4AC6-B798-4AFBFC66A7C7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{65C35817-9FA0-4AC6-B798-4AFBFC66A7C7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{D8D5EFCF-16AD-4E1F-ACF6-B47367A5CDB6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{D8D5EFCF-16AD-4E1F-ACF6-B47367A5CDB6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{D8D5EFCF-16AD-4E1F-ACF6-B47367A5CDB6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{D8D5EFCF-16AD-4E1F-ACF6-B47367A5CDB6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
25
src/HomogeneousMixture.cs
Normal file
25
src/HomogeneousMixture.cs
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
namespace Hermeteus;
|
||||||
|
|
||||||
|
public class HomogeneousMixture
|
||||||
|
{
|
||||||
|
public HomogeneousMixture()
|
||||||
|
{
|
||||||
|
Components = new Dictionary<Molecule, double>();
|
||||||
|
}
|
||||||
|
|
||||||
|
internal Dictionary<Molecule, double> Components { get; }
|
||||||
|
|
||||||
|
internal SU3 EigenState => Components.Keys
|
||||||
|
.Select(x => x.EigenState.Log() * Ratio(x))
|
||||||
|
.Aggregate((a, b) => a + b)
|
||||||
|
.Exp();
|
||||||
|
|
||||||
|
public double Amount => Components.Sum(p => p.Value);
|
||||||
|
|
||||||
|
public double Ratio(Molecule m) => Amount == 0
|
||||||
|
? 0
|
||||||
|
: Components.GetValueOrDefault(m, 0) / Amount;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
37
src/Measurements/Basic.cs
Normal file
37
src/Measurements/Basic.cs
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
namespace Hermeteus.Measurements;
|
||||||
|
|
||||||
|
public static partial class Measurement
|
||||||
|
{
|
||||||
|
private static double MolecularMass(this Molecule m)
|
||||||
|
{
|
||||||
|
H3 w = m.EigenState.ConjugateOn(new DiagR3(Math.PI / 32, Math.PI * 2, Math.PI * 8));
|
||||||
|
double r0 = w.Rayleigh(
|
||||||
|
m.EigenState.Log().ColumnAverageBivariant +
|
||||||
|
m.EigenState.ColumnAverage
|
||||||
|
);
|
||||||
|
return r0 * r0 / 8d;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static double MolecularDensity(this Molecule m)
|
||||||
|
{
|
||||||
|
H3 w = m.EigenState.ConjugateOn(new DiagR3(-Math.PI, 0, Math.PI));
|
||||||
|
double r0 = w.Rayleigh(
|
||||||
|
m.EigenState.ColumnAverageBivariant -
|
||||||
|
m.EigenState.Log().ColumnAverage
|
||||||
|
);
|
||||||
|
return r0 * r0 / 3d;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double Mass(this HomogeneousMixture h) =>
|
||||||
|
h.Components
|
||||||
|
.Select(p => p.Key.MolecularMass() * p.Value)
|
||||||
|
.Sum();
|
||||||
|
|
||||||
|
public static double Density(this HomogeneousMixture h) =>
|
||||||
|
h.Components.Keys
|
||||||
|
.Select(x => x.MolecularDensity() * h.Ratio(x))
|
||||||
|
.Sum();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
70
src/Measurements/Color.cs
Normal file
70
src/Measurements/Color.cs
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
using Skeleton.Constants;
|
||||||
|
|
||||||
|
namespace Hermeteus.Measurements;
|
||||||
|
|
||||||
|
public static partial class Measurement
|
||||||
|
{
|
||||||
|
private static readonly U3 RedFilter = new LieU3
|
||||||
|
(
|
||||||
|
I, 0, -1,
|
||||||
|
0, I, 0,
|
||||||
|
1, 0, -I
|
||||||
|
).Exp();
|
||||||
|
|
||||||
|
private static readonly U3 GreenFilter = new LieU3
|
||||||
|
(
|
||||||
|
0, -I, 0,
|
||||||
|
-I, 0, -1,
|
||||||
|
0, 1, 0
|
||||||
|
).Exp();
|
||||||
|
|
||||||
|
private static readonly U3 BlueFilter = new LieU3
|
||||||
|
(
|
||||||
|
0, 0, -I,
|
||||||
|
0, 0, -1,
|
||||||
|
-I, 1, 0
|
||||||
|
).Exp();
|
||||||
|
|
||||||
|
private static readonly U3 OpacityFilter = new LieU3(
|
||||||
|
I, -I, -I,
|
||||||
|
-I, I, -1,
|
||||||
|
-I, 1, -I
|
||||||
|
).Exp();
|
||||||
|
|
||||||
|
|
||||||
|
private static readonly H3 RedDefinite = RedFilter.ConjugateOn(AlgebraConstant.UniformSpectrum3);
|
||||||
|
|
||||||
|
private static readonly H3 GreenDefinite = GreenFilter.ConjugateOn(AlgebraConstant.UniformSpectrum3);
|
||||||
|
|
||||||
|
private static readonly H3 BlueDefinite = BlueFilter.ConjugateOn(AlgebraConstant.UniformSpectrum3);
|
||||||
|
|
||||||
|
private static readonly H3 OpacityDefinite = OpacityFilter.ConjugateOn(new DiagR3(0.05d, 0.74d, 1d));
|
||||||
|
|
||||||
|
public static Byte Red(HomogeneousMixture m) => (Byte)
|
||||||
|
(
|
||||||
|
m.EigenState
|
||||||
|
.ConjugateOn(RedDefinite)
|
||||||
|
.Rayleigh(Ita(m)) * 255
|
||||||
|
);
|
||||||
|
|
||||||
|
public static Byte Green(HomogeneousMixture m) => (Byte)
|
||||||
|
(
|
||||||
|
m.EigenState
|
||||||
|
.ConjugateOn(GreenDefinite)
|
||||||
|
.Rayleigh(Ita(m)) * 255
|
||||||
|
);
|
||||||
|
|
||||||
|
public static Byte Blue(HomogeneousMixture m) => (Byte)
|
||||||
|
(
|
||||||
|
m.EigenState
|
||||||
|
.ConjugateOn(BlueDefinite)
|
||||||
|
.Rayleigh(Ita(m)) * 255
|
||||||
|
);
|
||||||
|
|
||||||
|
public static Byte Alpha(HomogeneousMixture m) => (Byte)
|
||||||
|
(
|
||||||
|
m.EigenState
|
||||||
|
.ConjugateOn(OpacityDefinite)
|
||||||
|
.Rayleigh(Ita(m)) * 255
|
||||||
|
);
|
||||||
|
}
|
||||||
11
src/Measurements/Measurement.cs
Normal file
11
src/Measurements/Measurement.cs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
using System.Numerics;
|
||||||
|
|
||||||
|
namespace Hermeteus.Measurements;
|
||||||
|
|
||||||
|
public static partial class Measurement
|
||||||
|
{
|
||||||
|
private static Complex I => Complex.ImaginaryOne;
|
||||||
|
public static C3 Ita(this HomogeneousMixture h) => h.Components.Keys
|
||||||
|
.Select(x => x.EigenState.ColumnAverageBivariant * h.Ratio(x))
|
||||||
|
.Aggregate((a, b) => a + b);
|
||||||
|
}
|
||||||
12
src/Measurements/Reaction.cs
Normal file
12
src/Measurements/Reaction.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
namespace Hermeteus.Measurements;
|
||||||
|
|
||||||
|
public static partial class Measurement
|
||||||
|
{
|
||||||
|
public static double[] Negativity(this Molecule m) =>
|
||||||
|
m.EigenState.EigenValues()
|
||||||
|
.Select(eiv => eiv.Phase/Math.PI)
|
||||||
|
.ToArray();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
13
src/Molecule.cs
Normal file
13
src/Molecule.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
|
||||||
|
namespace Hermeteus;
|
||||||
|
|
||||||
|
public class Molecule
|
||||||
|
{
|
||||||
|
internal SU3 EigenState { get; set; }
|
||||||
|
|
||||||
|
public Molecule(SU3 eigenState)
|
||||||
|
{
|
||||||
|
EigenState = eigenState;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
23
src/Using.cs
Normal file
23
src/Using.cs
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
global using C3 = Skeleton.Algebra.CategoryOf<Skeleton.Algebra.DimensionProviders.IDim3>.OnField<System.Numerics.Complex>.FVector;
|
||||||
|
|
||||||
|
global using R3 = Skeleton.Algebra.CategoryOf<Skeleton.Algebra.DimensionProviders.IDim3>.OnField<double>.FVector;
|
||||||
|
|
||||||
|
global using C33 = Skeleton.Algebra.CategoryOf<Skeleton.Algebra.DimensionProviders.IDim3>.OnField<System.Numerics.Complex>.FMatrix;
|
||||||
|
|
||||||
|
global using R33 = Skeleton.Algebra.CategoryOf<Skeleton.Algebra.DimensionProviders.IDim3>.OnField<double>.FMatrix;
|
||||||
|
|
||||||
|
global using U3 = Skeleton.Algebra.CategoryOf<Skeleton.Algebra.DimensionProviders.IDim3>.FUnitaryMatrix;
|
||||||
|
|
||||||
|
global using SU3 = Skeleton.Algebra.CategoryOf<Skeleton.Algebra.DimensionProviders.IDim3>.FSpecialUnitaryMatrix;
|
||||||
|
|
||||||
|
global using LieU3 = Skeleton.Algebra.CategoryOf<Skeleton.Algebra.DimensionProviders.IDim3>.FLieUnitaryMatrix;
|
||||||
|
|
||||||
|
global using LieSU3 = Skeleton.Algebra.CategoryOf<Skeleton.Algebra.DimensionProviders.IDim3>.FSpecialLieUnitaryMatrix;
|
||||||
|
|
||||||
|
global using C3Space = Skeleton.Algebra.CategoryOf<Skeleton.Algebra.DimensionProviders.IDim3>.OnField<System.Numerics.Complex>.FVectorSpace;
|
||||||
|
|
||||||
|
global using R3Space = Skeleton.Algebra.CategoryOf<Skeleton.Algebra.DimensionProviders.IDim3>.OnField<double>.FVectorSpace;
|
||||||
|
|
||||||
|
global using DiagR3 = Skeleton.Algebra.CategoryOf<Skeleton.Algebra.DimensionProviders.IDim3>.OnField<double>.FDiagonalMatrix;
|
||||||
|
|
||||||
|
global using H3 = Skeleton.Algebra.CategoryOf<Skeleton.Algebra.DimensionProviders.IDim3>.FHermitianMatrix;
|
||||||
Reference in New Issue
Block a user