omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
omega-mv / src / turing / ty_prd.h
| 1 | /* SPDX-License-Identifier: Apache-2.0 |
| 2 | * Copyright 2026 Drake Stapleton (AIEN / aien-dev) |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | /* PRD1 prediction file reader/validator/encoder (little-endian). |
| 18 | * Header: "PRD1", u32 version = 1. Then one record per held-out index: |
| 19 | * u32 index, u32 family, f64 loc, f64 scale. Wave 1 accepts family 0 only; |
| 20 | * every other family and every malformed byte pattern is TYQ_FAIL_PROTOCOL. */ |
| 21 | #ifndef TURING_TY_PRD_H |
| 22 | #define TURING_TY_PRD_H |
| 23 | |
| 24 | #include "turing/ty_qcont.h" |
| 25 | |
| 26 | typedef struct { uint32_t n, first_index; tyq_pred *rec; } ty_prd; |
| 27 | |
| 28 | /* Refusals: family != 0, non-finite loc or scale, scale <= 0. */ |
| 29 | int ty_prd_validate(const tyq_pred *p); |
| 30 | /* The indices must be exactly first_index .. first_index+count-1, in order. */ |
| 31 | int ty_prd_parse(const uint8_t *buf, size_t len, uint32_t first_index, uint32_t count, ty_prd *out); |
| 32 | int ty_prd_read(const char *path, uint32_t first_index, uint32_t count, ty_prd *out); |
| 33 | int ty_prd_encode(const ty_prd *p, uint8_t **buf, size_t *len); |
| 34 | void ty_prd_free(ty_prd *p); |
| 35 | |
| 36 | #endif |