Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

Add LocalUnivariateMinimum function parameter range determination #678

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Standard/src/Optimization/Univariate.qs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Microsoft.Quantum.Optimization {
open Microsoft.Quantum.Canon;
open Microsoft.Quantum.Intrinsic;
open Microsoft.Quantum.Math;

open Microsoft.Quantum.Diagnostics;
/// # Summary
/// Represents the result of optimizing a univariate function.
///
Expand All @@ -25,6 +25,7 @@ namespace Microsoft.Quantum.Optimization {
/// # Summary
/// Returns the width of an interval.
internal function Width(left : Double, right : Double) : Double {
Fact(left <= right, "Left endpoint of bounds must be less than or equal to right endpoint.");
return right - left;
}

Expand Down Expand Up @@ -70,6 +71,7 @@ namespace Microsoft.Quantum.Optimization {
bounds : (Double, Double),
tolerance : Double
) : UnivariateOptimizationResult {
Fact(tolerance > 0.0, "The tolerance value must be positive.");
mutable interval = bounds;
mutable leftProbe = ProbeValue(fn, Fst(NextProbes(interval)));
mutable rightProbe = ProbeValue(fn, Snd(NextProbes(interval)));
Expand Down