daily update on 20230813 by nitload youmu, weritting matrix algs
This commit is contained in:
+59
-23
@@ -1,42 +1,78 @@
|
||||
using StgSharp.Math;
|
||||
using System;
|
||||
using System.Runtime.Intrinsics;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
|
||||
internal static class Program
|
||||
{
|
||||
private unsafe static void Main(string[] args)
|
||||
internal unsafe static void Main(string[] args)
|
||||
{
|
||||
Matrix4x4 m = new Matrix4x4(
|
||||
0,1,2,3,
|
||||
4,5,6,7,
|
||||
0,1,2,3,
|
||||
4,5,6,7
|
||||
);
|
||||
for (int i = 0; i < 1000; i++)
|
||||
{
|
||||
Matrix4x4 ret = m;
|
||||
}
|
||||
//Console.WriteLine(m + m);
|
||||
|
||||
/*
|
||||
|
||||
Vec3d v = new Vec3d(1,2,3);
|
||||
Console.WriteLine(v._m128Ptr);
|
||||
Console.WriteLine(v);
|
||||
Console.WriteLine();
|
||||
|
||||
Vec3d v2 = new Vec3d(2,2,3);
|
||||
Console.WriteLine(v2._m128Ptr);
|
||||
Console.WriteLine(v2);
|
||||
Console.WriteLine();
|
||||
|
||||
Vec3d v3 = v / 114514.0f;
|
||||
|
||||
Console.WriteLine();
|
||||
|
||||
Console.WriteLine(v3);
|
||||
|
||||
/**/
|
||||
|
||||
Matrix4x4 m1 = new Matrix4x4(
|
||||
System.Numerics.Matrix4x4 smt1 = new System.Numerics.Matrix4x4(
|
||||
1,2,3,4,
|
||||
5,6,7,8,
|
||||
1,2,3,4,
|
||||
5,6,7,8
|
||||
);
|
||||
|
||||
Console.WriteLine(VectorCalc.Multiple(m1,m1));
|
||||
Matrix4x4 gmt1 = new Matrix4x4(
|
||||
1, 2, 3, 4,
|
||||
5, 6, 7, 8,
|
||||
1, 2, 3, 4,
|
||||
5, 6, 7, 8
|
||||
);
|
||||
|
||||
Stopwatch s = new Stopwatch();
|
||||
|
||||
double cycle = 1e6;
|
||||
|
||||
for (int t = 0; t < 1000; t++)
|
||||
{
|
||||
s.Reset();
|
||||
s.Start();
|
||||
for (int i = 0; i < cycle; i++)
|
||||
{
|
||||
System.Numerics.Matrix4x4 ret = smt1* smt1;
|
||||
}
|
||||
s.Stop();
|
||||
|
||||
TimeSpan span = s.Elapsed;
|
||||
Console.WriteLine(span.TotalMilliseconds);
|
||||
|
||||
s.Reset();
|
||||
s.Start();
|
||||
|
||||
for (int i = 0; i < cycle; i++)
|
||||
{
|
||||
Matrix4x4 ret = VectorCalc.Multiple(gmt1,gmt1);
|
||||
}
|
||||
s.Stop();
|
||||
|
||||
TimeSpan span1 = s.Elapsed;
|
||||
Console.WriteLine(span1.TotalMilliseconds);
|
||||
|
||||
Console.WriteLine();
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**/
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user