Skip to content
Back to skills

Two Loop Direction

ASecurity

Compute L-BFGS search directions with the two-loop inverse-Hessian recursion and scalar scaling.

  • 247 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 9, 2026
testingpython

Security analysis

A100/100

Scanned September 9, 2026

npx -y skills add VectorSpaceLab/AREX-Skill --skill two_loop_direction --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Two Loop Direction?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Two Loop Direction
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectorspacelab-two-loop-direction/badge)](https://www.skillsdirectory.com/skills/vectorspacelab-two-loop-direction)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

SKILL.md
---
name: two_loop_direction
description: Compute L-BFGS search directions with the two-loop inverse-Hessian recursion and scalar scaling.
---

# Two-Loop Direction

Use this skill when an optimizer has L-BFGS curvature memory and needs a quasi-Newton descent direction without materializing a Hessian matrix. Do not use it when curvature pairs fail the positive-curvature condition.

## Inputs
- Current gradient vector.
- Ordered correction memory `(s_i, y_i)` from oldest to newest.
- Optional scalar initial inverse-Hessian scale.

## Outputs
- Search direction `p = -H g`.
- Diagnostics with pair count, effective scale, and descent dot product.

## Workflow
1. Run the first loop from newest pair to oldest and store alpha values.
2. Apply scalar initial scaling; use the newest pair scale `(s^T y)/(y^T y)` when none is supplied.
3. Run the second loop from oldest pair to newest.
4. Negate the resulting inverse-Hessian product.
5. Verify the result is a descent direction on convex positive-curvature tests.

## Validation
Run `python tests/test_two_loop_direction.py` or use the generated skill tree validator with tests enabled.

## Limitations
The skill computes directions only; it does not update memory or perform line search.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…