diff --git a/Build/props/tests.props b/Build/props/tests.props index f8425ad56b1..8c6bdbe91e3 100644 --- a/Build/props/tests.props +++ b/Build/props/tests.props @@ -6,7 +6,7 @@ - + diff --git a/Chemistry/src/Runtime/Runtime.csproj b/Chemistry/src/Runtime/Runtime.csproj index 5582c4bbbfb..19e2bb18e2b 100644 --- a/Chemistry/src/Runtime/Runtime.csproj +++ b/Chemistry/src/Runtime/Runtime.csproj @@ -1,4 +1,4 @@ - + netstandard2.1 @@ -36,7 +36,7 @@ - + diff --git a/Chemistry/tests/ChemistryTests/QSharpTests.csproj b/Chemistry/tests/ChemistryTests/QSharpTests.csproj index 5f67d6eabb3..c10bdcc9653 100644 --- a/Chemistry/tests/ChemistryTests/QSharpTests.csproj +++ b/Chemistry/tests/ChemistryTests/QSharpTests.csproj @@ -1,4 +1,4 @@ - + diff --git a/Chemistry/tests/SystemTests/SystemTests.csproj b/Chemistry/tests/SystemTests/SystemTests.csproj index e639c70d365..a856d69a6ff 100644 --- a/Chemistry/tests/SystemTests/SystemTests.csproj +++ b/Chemistry/tests/SystemTests/SystemTests.csproj @@ -1,4 +1,4 @@ - + diff --git a/MachineLearning/src/MachineLearning.csproj b/MachineLearning/src/MachineLearning.csproj index c3c610ce7d5..02408133dc4 100644 --- a/MachineLearning/src/MachineLearning.csproj +++ b/MachineLearning/src/MachineLearning.csproj @@ -1,4 +1,4 @@ - + netstandard2.1 Microsoft.Quantum.MachineLearning diff --git a/MachineLearning/tests/MachineLearningTests.csproj b/MachineLearning/tests/MachineLearningTests.csproj index 24e796bf78b..a0824b9e216 100644 --- a/MachineLearning/tests/MachineLearningTests.csproj +++ b/MachineLearning/tests/MachineLearningTests.csproj @@ -1,4 +1,4 @@ - + diff --git a/Numerics/src/Numerics.csproj b/Numerics/src/Numerics.csproj index 356da38b794..23ce269672f 100644 --- a/Numerics/src/Numerics.csproj +++ b/Numerics/src/Numerics.csproj @@ -1,4 +1,4 @@ - + netstandard2.1 @@ -40,7 +40,7 @@ - + diff --git a/Numerics/tests/NumericsTests.csproj b/Numerics/tests/NumericsTests.csproj index ed5dc9199c6..ad593aad679 100644 --- a/Numerics/tests/NumericsTests.csproj +++ b/Numerics/tests/NumericsTests.csproj @@ -1,4 +1,4 @@ - + diff --git a/Standard/src/Arrays/ForEach.cs b/Standard/src/Arrays/ForEach.cs new file mode 100644 index 00000000000..534e3e3366d --- /dev/null +++ b/Standard/src/Arrays/ForEach.cs @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +using Microsoft.Quantum.Simulation.Core; +using System; + +namespace Microsoft.Quantum.Arrays +{ + public partial class ForEach<__T__, __U__> + { + public override RuntimeMetadata GetRuntimeMetadata(IApplyData args) + { + var metadata = base.GetRuntimeMetadata(args); + if (metadata == null) throw new NullReferenceException($"Null RuntimeMetadata found for {this.ToString()}."); + metadata.IsComposite = true; + return metadata; + } + } +} diff --git a/Standard/src/Canon/Combinators/ApplyToEach.cs b/Standard/src/Canon/Combinators/ApplyToEach.cs new file mode 100644 index 00000000000..352bfc32039 --- /dev/null +++ b/Standard/src/Canon/Combinators/ApplyToEach.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +using Microsoft.Quantum.Simulation.Core; +using System; + +namespace Microsoft.Quantum.Canon +{ + public partial class ApplyToEach<__T__> + { + public override RuntimeMetadata GetRuntimeMetadata(IApplyData args) + { + var metadata = base.GetRuntimeMetadata(args); + if (metadata == null) throw new NullReferenceException($"Null RuntimeMetadata found for {this.ToString()}."); + metadata.IsComposite = true; + return metadata; + } + } + + public partial class ApplyToEachC<__T__> + { + public override RuntimeMetadata GetRuntimeMetadata(IApplyData args) + { + var metadata = base.GetRuntimeMetadata(args); + if (metadata == null) throw new NullReferenceException($"Null RuntimeMetadata found for {this.ToString()}."); + metadata.IsComposite = true; + return metadata; + } + } + + public partial class ApplyToEachA<__T__> + { + public override RuntimeMetadata GetRuntimeMetadata(IApplyData args) + { + var metadata = base.GetRuntimeMetadata(args); + if (metadata == null) throw new NullReferenceException($"Null RuntimeMetadata found for {this.ToString()}."); + metadata.IsComposite = true; + return metadata; + } + } + + public partial class ApplyToEachCA<__T__> + { + public override RuntimeMetadata GetRuntimeMetadata(IApplyData args) + { + var metadata = base.GetRuntimeMetadata(args); + if (metadata == null) throw new NullReferenceException($"Null RuntimeMetadata found for {this.ToString()}."); + metadata.IsComposite = true; + return metadata; + } + } +} diff --git a/Standard/src/Standard.csproj b/Standard/src/Standard.csproj index d0cbc8cc426..634fa6a0eb6 100644 --- a/Standard/src/Standard.csproj +++ b/Standard/src/Standard.csproj @@ -1,4 +1,4 @@ - + netstandard2.1 @@ -30,7 +30,7 @@ - + diff --git a/Standard/tests/Arrays/MapTests.cs b/Standard/tests/Arrays/MapTests.cs new file mode 100644 index 00000000000..5594ee6ce29 --- /dev/null +++ b/Standard/tests/Arrays/MapTests.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + + +using Microsoft.Quantum.Simulation.Core; +using Microsoft.Quantum.Simulation.Simulators; +using Microsoft.Quantum.Simulation.XUnit; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Security.Cryptography; +using System.Text; +using Xunit; + +namespace Microsoft.Quantum.Tests +{ + public class ForEachRuntimeMetadataTests + { + [Fact] + public void ForEach() + { + var op = new Microsoft.Quantum.Arrays.ForEach(new QuantumSimulator()); + var baseOp = new Microsoft.Quantum.Intrinsic.M(new QuantumSimulator()); + IQArray targets = new QArray(new Qubit[] { }); + var args = op.__dataIn((baseOp, targets)); + var expected = new RuntimeMetadata() + { + Label = "ForEach", + FormattedNonQubitArgs = "(M)", + IsComposite = true, + Targets = new List() { }, + }; + Assert.Equal(expected, op.GetRuntimeMetadata(args)); + } + } +} diff --git a/Standard/tests/Canon/ApplyToEachTests.cs b/Standard/tests/Canon/ApplyToEachTests.cs new file mode 100644 index 00000000000..bca042da663 --- /dev/null +++ b/Standard/tests/Canon/ApplyToEachTests.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + + +using Microsoft.Quantum.Simulation.Core; +using Microsoft.Quantum.Simulation.Simulators; +using Microsoft.Quantum.Simulation.XUnit; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Security.Cryptography; +using System.Text; +using Xunit; + +namespace Microsoft.Quantum.Tests +{ + public class ApplyToEachRuntimeMetadataTests + { + [Fact] + public void ApplyToEach() + { + var op = new Microsoft.Quantum.Canon.ApplyToEach(new QuantumSimulator()); + var baseOp = new Microsoft.Quantum.Intrinsic.I(new QuantumSimulator()); + IQArray targets = new QArray(new Qubit[] { }); + var args = op.__dataIn((baseOp, targets)); + var expected = new RuntimeMetadata() + { + Label = "ApplyToEach", + FormattedNonQubitArgs = "(I)", + IsComposite = true, + Targets = new List() { }, + }; + Assert.Equal(expected, op.GetRuntimeMetadata(args)); + } + + [Fact] + public void ApplyToEachC() + { + var op = new Microsoft.Quantum.Canon.ApplyToEachC(new QuantumSimulator()); + var baseOp = new Microsoft.Quantum.Intrinsic.I(new QuantumSimulator()); + IQArray targets = new QArray(new Qubit[] { }); + var args = op.__dataIn((baseOp, targets)); + var expected = new RuntimeMetadata() + { + Label = "ApplyToEachC", + FormattedNonQubitArgs = "(I)", + IsComposite = true, + Targets = new List() { }, + }; + Assert.Equal(expected, op.GetRuntimeMetadata(args)); + } + + [Fact] + public void ApplyToEachA() + { + var op = new Microsoft.Quantum.Canon.ApplyToEachA(new QuantumSimulator()); + var baseOp = new Microsoft.Quantum.Intrinsic.I(new QuantumSimulator()); + IQArray targets = new QArray(new Qubit[] { }); + var args = op.__dataIn((baseOp, targets)); + var expected = new RuntimeMetadata() + { + Label = "ApplyToEachA", + FormattedNonQubitArgs = "(I)", + IsComposite = true, + Targets = new List() { }, + }; + Assert.Equal(expected, op.GetRuntimeMetadata(args)); + } + + [Fact] + public void ApplyToEachCA() + { + var op = new Microsoft.Quantum.Canon.ApplyToEachCA(new QuantumSimulator()); + var baseOp = new Microsoft.Quantum.Intrinsic.I(new QuantumSimulator()); + IQArray targets = new QArray(new Qubit[] { }); + var args = op.__dataIn((baseOp, targets)); + var expected = new RuntimeMetadata() + { + Label = "ApplyToEachCA", + FormattedNonQubitArgs = "(I)", + IsComposite = true, + Targets = new List() { }, + }; + Assert.Equal(expected, op.GetRuntimeMetadata(args)); + } + } +} diff --git a/Standard/tests/Standard.Tests.csproj b/Standard/tests/Standard.Tests.csproj index 1a4ded18c16..993c86a80fa 100644 --- a/Standard/tests/Standard.Tests.csproj +++ b/Standard/tests/Standard.Tests.csproj @@ -1,4 +1,4 @@ - +