Table of Contents

Mojo struct

Solver

@memory_only
struct Solver

Aliases

  • LOWER_BOUND = Int8(0)
  • UPPER_BOUND = Int8(1)
  • FREE = Int8(2)

Fields

  • active_size (Int)
  • y (Optional[UnsafePointer[Int8, MutExternalOrigin]])
  • G (Optional[UnsafePointer[Float64, MutExternalOrigin]])
  • alpha_status (Optional[UnsafePointer[Int8, MutExternalOrigin]])
  • alpha (Optional[UnsafePointer[Float64, MutExternalOrigin]])
  • QD (Optional[UnsafePointer[Float64, MutExternalOrigin]])
  • eps (Float64)
  • Cp (Float64)
  • Cn (Float64)
  • p (Optional[UnsafePointer[Float64, MutExternalOrigin]])
  • active_set (Optional[UnsafePointer[Int, MutExternalOrigin]])
  • G_bar (Optional[UnsafePointer[Float64, MutExternalOrigin]])
  • l (Int)
  • unshrink (Bool)

Implemented traits

AnyType, ImplicitlyDestructible

Methods

__init__

fn __init__(out self)

Args:

  • self (Self)

Returns:

Self

get_C

fn get_C(self, i: Int) -> Float64

Args:

  • self (Self)
  • i (Int)

Returns:

Float64

update_alpha_status

fn update_alpha_status(self, i: Int)

Args:

  • self (Self)
  • i (Int)

is_upper_bound

fn is_upper_bound(self, i: Int) -> Bool

Args:

  • self (Self)
  • i (Int)

Returns:

Bool

is_lower_bound

fn is_lower_bound(self, i: Int) -> Bool

Args:

  • self (Self)
  • i (Int)

Returns:

Bool

is_free

fn is_free(self, i: Int) -> Bool

Args:

  • self (Self)
  • i (Int)

Returns:

Bool

swap_index

fn swap_index[QM: QMatrix](self, mut Q: QM, i: Int, j: Int)

Parameters:

  • QM (QMatrix)

Args:

  • self (Self)
  • Q (QM)
  • i (Int)
  • j (Int)

reconstruct_gradient

fn reconstruct_gradient[QM: QMatrix](self, mut Q: QM)

Parameters:

  • QM (QMatrix)

Args:

  • self (Self)
  • Q (QM)

Solve

fn Solve[QM: QMatrix](mut self, l: Int, mut Q: QM, p_: Optional[UnsafePointer[Float64, MutExternalOrigin]], y_: Optional[UnsafePointer[Int8, MutExternalOrigin]], alpha_: Optional[UnsafePointer[Float64, MutExternalOrigin]], Cp: Float64, Cn: Float64, eps: Float64, mut si: SolutionInfo, shrinking: Int)

Parameters:

  • QM (QMatrix)

Args:

  • self (Self)
  • l (Int)
  • Q (QM)
  • p_ (Optional[UnsafePointer[Float64, MutExternalOrigin]])
  • y_ (Optional[UnsafePointer[Int8, MutExternalOrigin]])
  • alpha_ (Optional[UnsafePointer[Float64, MutExternalOrigin]])
  • Cp (Float64)
  • Cn (Float64)
  • eps (Float64)
  • si (SolutionInfo)
  • shrinking (Int)

select_working_set

fn select_working_set[QM: QMatrix](self, mut Q: QM, mut out_i: Int, mut out_j: Int) -> Int

Parameters:

  • QM (QMatrix)

Args:

  • self (Self)
  • Q (QM)
  • out_i (Int)
  • out_j (Int)

Returns:

Int

be_shrunk

fn be_shrunk(self, i: Int, Gmax1: Float64, Gmax2: Float64) -> Bool

Args:

  • self (Self)
  • i (Int)
  • Gmax1 (Float64)
  • Gmax2 (Float64)

Returns:

Bool

do_shrinking

fn do_shrinking[QM: QMatrix](mut self, mut Q: QM)

Parameters:

  • QM (QMatrix)

Args:

  • self (Self)
  • Q (QM)

calculate_rho

fn calculate_rho(self) -> Float64

Args:

  • self (Self)

Returns:

Float64