Skip to content

Commit

Permalink
#474 - Upgrade to .NET 6
Browse files Browse the repository at this point in the history
  • Loading branch information
sys27 committed Nov 13, 2021
1 parent 90d35ed commit cda68b9
Show file tree
Hide file tree
Showing 461 changed files with 42,288 additions and 44,468 deletions.
10 changes: 5 additions & 5 deletions CI/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ jobs:

steps:
- task: UseDotNet@2
displayName: 'Install .NET 5'
displayName: 'Install .NET 6'
inputs:
packageType: 'sdk'
version: '5.0.x'
version: '6.0.x'

- task: DotNetCoreCLI@2
displayName: 'dotnet restore'
Expand All @@ -40,7 +40,7 @@ jobs:
displayName: 'dotnet build'
inputs:
projects: '$(solution)'
arguments: '-c $(buildConfiguration)'
arguments: '--nologo -c $(buildConfiguration)'

- task: DotNetCoreCLI@2
displayName: 'dotnet test'
Expand Down Expand Up @@ -105,5 +105,5 @@ jobs:

- task: PublishPipelineArtifact@1
inputs:
path: xFunc/bin/Release/net5.0-windows
artifact: xFunc.UI (.NET 5)
path: xFunc/bin/Release/net6.0-windows
artifact: xFunc.UI (.NET 6)
14 changes: 5 additions & 9 deletions xFunc.Benchmark/Benchmarks/CtorBenchmark.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
// Copyright (c) Dmytro Kyshchenko. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using BenchmarkDotNet.Attributes;
using xFunc.Maths;
namespace xFunc.Benchmark.Benchmarks;

namespace xFunc.Benchmark.Benchmarks
public class CtorBenchmark
{
public class CtorBenchmark
[Benchmark]
public IParser ParserCtor()
{
[Benchmark]
public IParser ParserCtor()
{
return new Parser();
}
return new Parser();
}
}
38 changes: 16 additions & 22 deletions xFunc.Benchmark/Benchmarks/DifferentiatorBenchmark.cs
Original file line number Diff line number Diff line change
@@ -1,33 +1,27 @@
// Copyright (c) Dmytro Kyshchenko. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using BenchmarkDotNet.Attributes;
using xFunc.Maths;
using xFunc.Maths.Analyzers;
using xFunc.Maths.Expressions;
namespace xFunc.Benchmark.Benchmarks;

namespace xFunc.Benchmark.Benchmarks
public class DifferentiatorBenchmark
{
public class DifferentiatorBenchmark
{
private Differentiator differentiator;
private DifferentiatorContext context;

private IExpression complexExp;
private Differentiator differentiator;
private DifferentiatorContext context;

[GlobalSetup]
public void Setup()
{
differentiator = new Differentiator();
context = DifferentiatorContext.Default();
private IExpression complexExp;

var processor = new Processor();
[GlobalSetup]
public void Setup()
{
differentiator = new Differentiator();
context = DifferentiatorContext.Default();

complexExp = processor.Parse("(2 * abs(3 * sin(4 * cos(5 * tan(6 * ctg(x ^ 2))))) - ln(x ^ 2)) + arcsin(arccos(arctan(arcctg(x ^ 10))))");
}
var processor = new Processor();

[Benchmark]
public IExpression ComplexExpression()
=> complexExp.Analyze(differentiator, context);
complexExp = processor.Parse("(2 * abs(3 * sin(4 * cos(5 * tan(6 * ctg(x ^ 2))))) - ln(x ^ 2)) + arcsin(arccos(arctan(arcctg(x ^ 10))))");
}

[Benchmark]
public IExpression ComplexExpression()
=> complexExp.Analyze(differentiator, context);
}
35 changes: 15 additions & 20 deletions xFunc.Benchmark/Benchmarks/GcdBenchmark.cs
Original file line number Diff line number Diff line change
@@ -1,30 +1,25 @@
// Copyright (c) Dmytro Kyshchenko. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using BenchmarkDotNet.Attributes;
using xFunc.Maths;
using xFunc.Maths.Expressions;
namespace xFunc.Benchmark.Benchmarks;

namespace xFunc.Benchmark.Benchmarks
public class GcdBenchmark
{
public class GcdBenchmark
{
private IExpression gcd;
private IExpression lcm;
private IExpression gcd;
private IExpression lcm;

[GlobalSetup]
public void Setup()
{
var processor = new Processor();
[GlobalSetup]
public void Setup()
{
var processor = new Processor();

gcd = processor.Parse("gcd(2, 4, 6, 8, 2, 4, 6, 8, 2, 4, 6, 8, 2, 4, 6, 8)");
lcm = processor.Parse("gcd(2, 4, 6, 8, 2, 4, 6, 8, 2, 4, 6, 8, 2, 4, 6, 8)");
}
gcd = processor.Parse("gcd(2, 4, 6, 8, 2, 4, 6, 8, 2, 4, 6, 8, 2, 4, 6, 8)");
lcm = processor.Parse("gcd(2, 4, 6, 8, 2, 4, 6, 8, 2, 4, 6, 8, 2, 4, 6, 8)");
}

[Benchmark]
public object GcdExecute() => gcd.Execute();
[Benchmark]
public object GcdExecute() => gcd.Execute();

[Benchmark]
public object LcmExecute() => lcm.Execute();
}
[Benchmark]
public object LcmExecute() => lcm.Execute();
}
57 changes: 26 additions & 31 deletions xFunc.Benchmark/Benchmarks/MulMatrixBenchmark.cs
Original file line number Diff line number Diff line change
@@ -1,48 +1,43 @@
// Copyright (c) Dmytro Kyshchenko. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using System.Collections.Immutable;
using BenchmarkDotNet.Attributes;
using xFunc.Maths.Expressions;
using xFunc.Maths.Expressions.Matrices;

namespace xFunc.Benchmark.Benchmarks
namespace xFunc.Benchmark.Benchmarks;

public class MulMatrixBenchmark
{
public class MulMatrixBenchmark
{
private readonly Random random = new Random();
private readonly Random random = new Random();

private Mul mul;
private Mul mul;

[Params(2, 10, 100)]
public int Size;
[Params(2, 10, 100)]
public int Size;

[GlobalSetup]
public void Setup()
{
var left = CreateMatrix();
var right = CreateMatrix();
[GlobalSetup]
public void Setup()
{
var left = CreateMatrix();
var right = CreateMatrix();

mul = new Mul(left, right);
}
mul = new Mul(left, right);
}

private Matrix CreateMatrix()
private Matrix CreateMatrix()
{
var vectors = ImmutableArray.CreateBuilder<Vector>(Size);
for (var i = 0; i < Size; i++)
{
var vectors = ImmutableArray.CreateBuilder<Vector>(Size);
for (var i = 0; i < Size; i++)
{
var vector = ImmutableArray.CreateBuilder<IExpression>(Size);
for (var j = 0; j < Size; j++)
vector.Add(new Number(random.Next()));
var vector = ImmutableArray.CreateBuilder<IExpression>(Size);
for (var j = 0; j < Size; j++)
vector.Add(new Number(random.Next()));

vectors.Add(new Vector(vector.ToImmutableArray()));
}

return new Matrix(vectors.ToImmutableArray());
vectors.Add(new Vector(vector.ToImmutableArray()));
}

[Benchmark]
public object MulMatrix() => mul.Execute();
return new Matrix(vectors.ToImmutableArray());
}

[Benchmark]
public object MulMatrix() => mul.Execute();
}
51 changes: 23 additions & 28 deletions xFunc.Benchmark/Benchmarks/MulVectorBenchmark.cs
Original file line number Diff line number Diff line change
@@ -1,42 +1,37 @@
// Copyright (c) Dmytro Kyshchenko. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using System.Collections.Immutable;
using BenchmarkDotNet.Attributes;
using xFunc.Maths.Expressions;
using xFunc.Maths.Expressions.Matrices;

namespace xFunc.Benchmark.Benchmarks
{
public class MulVectorBenchmark
{
private readonly Random random = new Random();
namespace xFunc.Benchmark.Benchmarks;

private Mul mul;
public class MulVectorBenchmark
{
private readonly Random random = new Random();

[Params(2, 10, 100)]
public int Size;
private Mul mul;

[GlobalSetup]
public void Setup()
{
var left = CreateVector();
var right = CreateVector();
[Params(2, 10, 100)]
public int Size;

mul = new Mul(left, right);
}
[GlobalSetup]
public void Setup()
{
var left = CreateVector();
var right = CreateVector();

private Vector CreateVector()
{
var vector = ImmutableArray.CreateBuilder<IExpression>(Size);
for (var j = 0; j < Size; j++)
vector.Add(new Number(random.Next()));
mul = new Mul(left, right);
}

return new Vector(vector.ToImmutableArray());
}
private Vector CreateVector()
{
var vector = ImmutableArray.CreateBuilder<IExpression>(Size);
for (var j = 0; j < Size; j++)
vector.Add(new Number(random.Next()));

[Benchmark]
public object MulVector() => mul.Execute();
return new Vector(vector.ToImmutableArray());
}

[Benchmark]
public object MulVector() => mul.Execute();
}
34 changes: 14 additions & 20 deletions xFunc.Benchmark/Benchmarks/ProcessorBenchmark.cs
Original file line number Diff line number Diff line change
@@ -1,29 +1,23 @@
// Copyright (c) Dmytro Kyshchenko. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using BenchmarkDotNet.Attributes;
using xFunc.Maths;
using xFunc.Maths.Expressions;
using xFunc.Maths.Results;
namespace xFunc.Benchmark.Benchmarks;

namespace xFunc.Benchmark.Benchmarks
public class ProcessorBenchmark
{
public class ProcessorBenchmark
{
private Processor processor;
private Processor processor;

[GlobalSetup]
public void Setup()
{
processor = new Processor();
}
[GlobalSetup]
public void Setup()
{
processor = new Processor();
}

[Benchmark]
public IExpression Parse()
=> processor.Parse("(100.1 + 2(3sin(4cos(5tan(6ctg(10x)))) * 3) / (func(a, b, c) ^ 2)) - (cos(y) - 111.3) & (true | false -> true <-> false eq true) + (det({{1, 2}, {3, 4}}) * 10log(2, 3)) + re(3 + 2i) - im(2 - 9i) + (9 + 2i)");
[Benchmark]
public IExpression Parse()
=> processor.Parse("(100.1 + 2(3sin(4cos(5tan(6ctg(10x)))) * 3) / (func(a, b, c) ^ 2)) - (cos(y) - 111.3) & (true | false -> true <-> false eq true) + (det({{1, 2}, {3, 4}}) * 10log(2, 3)) + re(3 + 2i) - im(2 - 9i) + (9 + 2i)");

[Benchmark]
public NumberResult Solve()
=> processor.Solve<NumberResult>("count(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) + (2 * sin(4 * cos(6 * tan(8 * cot(pi / 4) ^ 2) ^ 3) ^ 4) ^ 5 + 2 * sin(4 * cos(6 * tan(8 * cot(pi / 4) ^ 2) ^ 3) ^ 4) ^ 5 + 2 * sin(4 * cos(6 * tan(8 * cot(pi / 4) ^ 2) ^ 3) ^ 4) ^ 5 + 2 * sin(4 * cos(6 * tan(8 * cot(pi / 4) ^ 2) ^ 3) ^ 4) ^ 5) * 10 ^ 6 + 10!");
}
[Benchmark]
public NumberResult Solve()
=> processor.Solve<NumberResult>("count(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) + (2 * sin(4 * cos(6 * tan(8 * cot(pi / 4) ^ 2) ^ 3) ^ 4) ^ 5 + 2 * sin(4 * cos(6 * tan(8 * cot(pi / 4) ^ 2) ^ 3) ^ 4) ^ 5 + 2 * sin(4 * cos(6 * tan(8 * cot(pi / 4) ^ 2) ^ 3) ^ 4) ^ 5 + 2 * sin(4 * cos(6 * tan(8 * cot(pi / 4) ^ 2) ^ 3) ^ 4) ^ 5) * 10 ^ 6 + 10!");
}
34 changes: 14 additions & 20 deletions xFunc.Benchmark/Benchmarks/SimplifierBenchmark.cs
Original file line number Diff line number Diff line change
@@ -1,31 +1,25 @@
// Copyright (c) Dmytro Kyshchenko. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using BenchmarkDotNet.Attributes;
using xFunc.Maths;
using xFunc.Maths.Analyzers;
using xFunc.Maths.Expressions;
namespace xFunc.Benchmark.Benchmarks;

namespace xFunc.Benchmark.Benchmarks
public class SimplifierBenchmark
{
public class SimplifierBenchmark
{
private Simplifier simplifier;

private IExpression exp;
private Simplifier simplifier;

[GlobalSetup]
public void Setup()
{
simplifier = new Simplifier();
private IExpression exp;

var processor = new Processor();
[GlobalSetup]
public void Setup()
{
simplifier = new Simplifier();

exp = processor.Parse("0 + x + x + 0 + 1 + 2 + 3 + x + (2 * x) + (3 * x) + (x * 4) - 0 - x - 0 - 1 - 2 - 3 - (2 * x) - (x * 3) + (x * 0) - (0 * x) + (1 * x) - (x * 1) * (x * x) * (2 * x) * (x * 3) + (x ^ 0) + (x ^ 0) + (e ^ ln(1)) + cos(arccos(0)) + (x * 0) + tan(arctan(0)) + sin(arcsin(x)) - (0 * x)");
}
var processor = new Processor();

[Benchmark]
public IExpression Simplify()
=> exp.Analyze(simplifier);
exp = processor.Parse("0 + x + x + 0 + 1 + 2 + 3 + x + (2 * x) + (3 * x) + (x * 4) - 0 - x - 0 - 1 - 2 - 3 - (2 * x) - (x * 3) + (x * 0) - (0 * x) + (1 * x) - (x * 1) * (x * x) * (2 * x) * (x * 3) + (x ^ 0) + (x ^ 0) + (e ^ ln(1)) + cos(arccos(0)) + (x * 0) + tan(arctan(0)) + sin(arcsin(x)) - (0 * x)");
}

[Benchmark]
public IExpression Simplify()
=> exp.Analyze(simplifier);
}
Loading

0 comments on commit cda68b9

Please sign in to comment.