Skip to content

Commit

Permalink
Moved to GT 1.0.3; errors for single-element matrices fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
WhiteBlackGoose committed May 8, 2021
1 parent 4043999 commit 78fd180
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Sources/AngouriMath/AngouriMath.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
</None>
<PackageReference Include="Antlr4.Runtime.Standard" Version="4.9.2" />
<PackageReference Include="FieldCache" Version="1.0.0-alpha.3" />
<PackageReference Include="GenericTensor" Version="1.0.1" />
<PackageReference Include="GenericTensor" Version="1.0.3" />
<PackageReference Include="PeterO.Numbers" Version="1.8.0" />
<PackageReference Include="System.Memory" Version="4.5.4" />
<PackageReference Include="Nullable" Version="1.3.0" PrivateAssets="all" />
Expand Down
5 changes: 1 addition & 4 deletions Sources/AngouriMath/Core/Entity/Omni/Entity.Matrix.cs
Original file line number Diff line number Diff line change
Expand Up @@ -356,10 +356,7 @@ public IEnumerator<Entity> GetEnumerator()
if (!@this.IsSquare)
return null;
var innerSimplified = new Matrix(@this.InnerMatrix.Adjoint()).InnerSimplified;
if (innerSimplified is Matrix m)
return m;
else
return MathS.Vector(innerSimplified);
return ToMatrix(innerSimplified);
},
this);
private FieldCache<Matrix?> adjugate;
Expand Down
3 changes: 2 additions & 1 deletion Sources/Samples/Samples/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;

Console.WriteLine(5);
Matrix m = "[5]";
Console.WriteLine(m.Determinant);
Console.WriteLine(5);
6 changes: 5 additions & 1 deletion Sources/Tests/UnitTests/Algebra/MatrixTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -566,12 +566,16 @@ public void TensorProductTest(string a, string b, string expectedRaw)
[InlineData("[[1, 70, 0], [0, 1, 0], [0, 0, 1]]")]
[InlineData("[[1, 70], [0, 1]]")]
[InlineData("[[1, 0, 0, 0], [0, 1, 70, 0], [0, 0, 1, 0], [0, 0, 0, 1]]")]
[InlineData("[6]")]
public void TestInverseWithGT101Issue400(string matrixRaw)
{
Matrix a = matrixRaw;
var inverse = TestExtensions.AsNotNull(a.Inverse);
var product = (a * inverse).Simplify();
Assert.Equal(MathS.IdentityMatrix(a.RowCount), product);
if (a.RowCount == 1)
Assert.Equal(1, product);
else
Assert.Equal(MathS.IdentityMatrix(a.RowCount), product);
}

[Theory]
Expand Down

0 comments on commit 78fd180

Please sign in to comment.