Files
Denso/srcs/RobotNet10/RobotApp/Communication/CeresSharp/Advanced/GradientCheckerOptions.cs
2026-07-03 16:31:37 +07:00

55 lines
1.7 KiB
C#

using System;
using CeresSharp.Native;
using CeresSharp.Native.SafeHandles;
namespace CeresSharp.Advanced;
/// <summary>
/// Options for gradient checking.
/// </summary>
public sealed class GradientCheckerOptions : IDisposable
{
private readonly GradientCheckerOptionsHandle _handle;
private bool _disposed;
/// <summary>
/// Creates a new GradientCheckerOptions instance with default settings.
/// </summary>
public GradientCheckerOptions()
{
_handle = GradientCheckerOptionsHandle.Create();
}
/// <summary>
/// Gets the native handle.
/// </summary>
internal GradientCheckerOptionsHandle Handle => _handle;
/// <summary>
/// Gets or sets the gradient check relative precision.
/// </summary>
public double GradientCheckRelativePrecision
{
get => CeresNative.ceres_wrapper_gradient_checker_options_get_gradient_check_relative_precision(_handle.DangerousGetHandle());
set => CeresNative.ceres_wrapper_gradient_checker_options_set_gradient_check_relative_precision(_handle.DangerousGetHandle(), value);
}
/// <summary>
/// Gets or sets the numeric derivative relative step size.
/// </summary>
public double NumericDerivativeRelativeStepSize
{
get => CeresNative.ceres_wrapper_gradient_checker_options_get_gradient_check_numeric_derivative_relative_step_size(_handle.DangerousGetHandle());
set => CeresNative.ceres_wrapper_gradient_checker_options_set_gradient_check_numeric_derivative_relative_step_size(_handle.DangerousGetHandle(), value);
}
public void Dispose()
{
if (!_disposed)
{
_handle?.Dispose();
_disposed = true;
}
}
}