Source identity
| Field | Recorded value |
|---|---|
| Source type | archive member |
| Original record | two_way_engine.hpp |
| Date | Not specified in source |
| Path or archive member | archives/libsrc-b5cb90ed4bd7/AI_DEEP_SCAN_2026-10-14_v2/verified_source/rhiannon/include/agents/two_way_engine.hpp |
| Original SHA-256 | 0635322e451fc177fb089ca29d7da4d4f53e5ef63eab4dde2b7b51b188952173 |
| Reading-copy SHA-256 | 0635322e451fc177fb089ca29d7da4d4f53e5ef63eab4dde2b7b51b188952173 |
| Archive source | {"sourceId": "libsrc-b5cb90ed4bd7", "member": "AI_DEEP_SCAN_2026-10-14_v2/verified_source/rhiannon/include/agents/two_way_engine.hpp"} |
Every recorded occurrence
These 2 records contain identical original source bytes. Their paths and revisions remain part of the archive.
| Original record | Branch or archive | Revision / identifier | Original location |
|---|---|---|---|
| two_way_engine.hpp | {"sourceId": "libsrc-b5cb90ed4bd7", "member": "AI_DEEP_SCAN_2026-10-14_v2/verified_source/rhiannon/include/agents/two_way_engine.hpp"} | libsrc-6cad8bc1f7db | archives/libsrc-b5cb90ed4bd7/AI_DEEP_SCAN_2026-10-14_v2/verified_source/rhiannon/include/agents/two_way_engine.hpp |
| Janady13/rhiannon / include/agents/two_way_engine.hpp | main | df358362a21fdde4372dc6239573622aafe4835f | Open original |
Recovered source transcript
Download complete source text ↓67 lines · 1.6 KB
#pragma once
// Rhiannon — Two-Way Equation Engine (core)
// Style: C++20, 2-space indent, same-line braces.
#include <vector>
#include <span>
#include <cstddef>
#include <cmath>
#include <algorithm>
namespace agents {
struct TwoWayEngine {
struct Cfg {
std::size_t dim = 8;
int iters = 64;
double epsilon = 1e-6;
bool use_gpu = false;
};
TwoWayEngine(); // uses default Cfg()
explicit TwoWayEngine(const Cfg& cfg);
// D <- target vector (size must be >= cfg.dim; extra values ignored)
void set_target(std::span<const float> target);
// B(S): current behavior snapshot (computed on demand)
std::vector<float> behavior() const;
// RMSE in [0, +inf) (practically clamped by sigmoid to [0, 1])
double error() const { return current_error_; }
// Run one optimization tick (alternating + joint update proxy)
void step();
const std::vector<float>& params() const { return params_; }
private:
Cfg cfg_;
std::vector<float> params_; // S (system parameters)
std::vector<float> target_; // D (design target)
double current_error_ = 1.0;
static inline float sigmoid(float x) {
// Numerically stable-ish sigmoid
if (x >= 0.f) {
float z = std::exp(-x);
return 1.f / (1.f + z);
} else {
float z = std::exp(x);
return z / (1.f + z);
}
}
void init_();
void gradient_descent_step_(float lr);
void update_error_();
// Optional accelerated steps (stubs for now)
void simd_step_(std::span<float> s);
#ifdef __APPLE__
void metal_step_();
#endif
};
} // namespace agents