Coding standards
One readable public vocabulary across C++ and Python. These rules make ownership, semantics, execution, and language parity visible at the call site.
A standard is part of the API
A large library is read more often than it is written. OA therefore treats naming, ownership, failure behavior, and formatting as interface contracts rather than personal style. The rules below are OA's own and follow the public architecture, generated API, and current source contracts.
Matrix, not Tensor
OA uses Matrix as the general multidimensional numerical value for dense compute and ML. It carries shape, strides, dtype, device, storage offset, and optional autograd state. A second Tensor name would duplicate that contract without adding useful behavior.
That convention is deliberately narrower than “everything is a matrix.” An Image retains pixel layout and format; Audio retains sample rate and channel meaning; a VideoFrame retains planes and timing. Each may expose a zero-copy matrix view when representation and lifetime permit it, but numerical storage never erases domain semantics.
C++ and Python spell one contract
The two front ends preserve public names and operation families. C++ uses ::and explicit status/event handling; Python uses ., raises binding errors, and borrows a lazily managed native engine. Parity means the same values, semantics, and Vulkan implementation—not identical lifetime syntax or overloads.
1#include <oa/oa.h>23oa::Result<oa::Event> runExample(4 oa::Engine& inEngine,5 const oa::Matrix& inMatrix,6 const oa::Matrix& inWeights7) {8 [[maybe_unused]] oa::Matrix outputMatrix =9 oa::FnMatrix::matMulNt(inMatrix, inWeights);1011 return inEngine.submit();12}13
FnMatrix is the operation namespace in both languages, and its results remain device-resident. C++ exposes explicit engine submission; Python borrows a lazily managed native engine and does not currently publish an Engine class or public submit method.
Naming
| Surface | Rule | Examples |
|---|---|---|
| Namespace / module | lowercase | oa, oa::vlm, oa.vision |
| Values, types, and sessions | PascalCase; no Oa prefix | Matrix, Engine, VideoDecoder |
| Primary operation namespaces | PascalCase Fn* exception for value-class syntax parity | Matrix / FnMatrix, Image / FnImage, Audio / FnAudio |
| Methods and functions | camelCase | matMulNt, numElements, submit |
| C++ parameters | camelCase with in / out / inOut direction | inMatrix, outResult, inOutBuffer |
| Local variables | camelCase | outputMatrix, submittedEvent |
| C++ members | camelCase with trailing underscore | device_, shape_ |
| Constants and enum values | PascalCase | Float32, Unavailable |
| Macros | OA_SCREAMING_SNAKE | OA_MAIN, OA_RETURN_IF_ERROR |
Directory segments and importable modules remain lowercase. Maintained C++ and Python source filenames are camelCase. Names should be grep-friendly; single letters belong only to tight loops and conventional local mathematics. The deliberate Fn* exception keeps primary operation namespaces PascalCase for syntax similarity with their semantic value classes in both languages.
oa::Syntax
This illustrative wrapper exists to show naming in context; it is not an additional OA API.
1#include <oa/oa.h>23// namespace / module: lowercase4namespace oa::example {56// types / classes: PascalCase7class MatrixJob {8public:9 // methods / functions and parameters: camelCase10 oa::Matrix execute(11 const oa::Matrix& inMatrix,12 const oa::Matrix& inWeights13 ) {14 // local variables: camelCase15 oa::Matrix outputMatrix = oa::FnMatrix::matMulNt(16 inMatrix, inWeights17 );18 return outputMatrix;19 }2021 oa::Result<oa::Event> submit(oa::Engine& inEngine) {22 auto submittedEvent = inEngine.submit();23 return submittedEvent;24 }25};2627} // namespace oa::example28
Foundation, not oa::std
OA owns the bounded C++ foundation vocabulary needed by its shipped library. Containers, strings, ownership, synchronization, memory, paths, formatting, and algorithms live directly under oa. There is no oa::std, oastd, or OaStd*compatibility layer, and the target is not a complete STL clone. oa::Vector is the canonical owning sequence; the former pre-1.0 oa::Vec spelling has been removed.
Foundation.cpp
1#include <oa/core/types.h>23oa::Vector<oa::F32> samples;4oa::String label;5oa::Optional<oa::Path> outputPath;67samples.pushBack(0.5F);8auto owner = oa::makeUnique<oa::String>();9auto movedOwner = oa::move(owner);10
This is an original OA implementation written from scratch for the product's admitted workloads—not an STL source port or renamed wrapper surface. A small auditable vocabulary gives OA explicit failure behavior, allocation control, reproducibility, and a portable adapter boundary. The current fixed-host benchmark keeps both wins and retained overhead visible; each ratio is OA time divided by the equivalent host operation.
| Case | Median OA / host | Process range | Result |
|---|---|---|---|
| Array indexed read | 1.001× | 0.998–1.002× | Parity |
| Find / count algorithms | 0.939× | 0.938–0.939× | OA faster |
| String geometric growth | 0.876× | 0.865–0.892× | OA faster |
| HashMap insertion | 0.341× | 0.309–0.346× | OA faster |
| SharedPtr copy · thread-safe host path | 1.003× | 0.988–1.017× | Parity |
| Dynamic copy · 8 B | 0.498× | 0.448–0.540× | OA faster |
| Streaming copy · 2 KiB | 0.653× | 0.608–0.731× | OA faster |
These representative rows come from the 32-case foundation campaign and the host-memory campaign that now lives under oa/core/std/memory.h. They are seven-process medians from one CPU, compiler, host library, workload, and date—not a universal performance or security claim. The Foundation benchmark page owns the protocol, complete result set, spread, correctness gate, rejected alternatives, and reproduction steps.
Print and format with braces
Use oa::format when you need an owning oa::String, oa::print for one complete newline-terminated record, and oa::write when no newline should be added. The syntax uses sequential {} and {:spec} fields in the style familiar from Python and {fmt}, while remaining a bounded OA dialect rather than a full {fmt} compatibility layer or runtime dependency.
Print.cpp
1#include <oa/core/std/print.h>23const oa::String summary = oa::format(4 "epoch={} loss={:.4f}", epoch, loss5);67OA_RETURN_IF_ERROR(oa::print("{}", summary));8OA_RETURN_IF_ERROR(oa::print(9 oa::PrintStream::Error,10 "failed: {}", reason11));1213// Same-line progress: write adds no newline and flush is explicit.14OA_RETURN_IF_ERROR(oa::write("\rprogress={:5.1f}%", percent));15OA_RETURN_IF_ERROR(oa::flush());16
| Use | Contract |
|---|---|
| format("...", values...) | Returns an oa::String and performs no output |
| print("...", values...) | Writes one serialized record and appends exactly one newline |
| print(PrintStream::Error, ...) | Writes the complete record to the explicit error stream |
| write("...", values...) | Writes without adding a newline; use \r for same-line progress |
| flush(stream) | Publishes buffered host output explicitly; print and write do not auto-flush |
| Common specs | Alignment/fill, sign, alternate form, zero padding, width, precision, integer bases, and f/e/g floats |
Format strings are compile-time character-array literals. Pass untrusted runtime text as an oa::StringViewso it is treated as data rather than reparsed as a format program. Malformed fields, argument mismatches, invalid type/specifier pairs, null C strings, and excessive width, precision, or output fail through OA's always-on contract. Host output failures remain recoverable through the returned oa::Status.
Vulkan Linear Math
VLM is OA's compact host-side spatial-math library, not a vision-language model and not a second tensor engine. It provides packed vectors, quaternions, matrices, transforms, and projections for cameras, UI, rendering, animation, simulation, and format conversion.
| Convention | VLM contract |
|---|---|
| Axes | Right-handed; +X right, +Y up, camera-forward −Z |
| Storage and multiplication | Row-major matrices and row vectors: transformed = value * matrix |
| Clip depth | Vulkan normalized-device-coordinate Z in [0, 1] |
| Raster Y | Selected once through viewport state |
| Interop | External axes, units, handedness, and quaternion order convert once at the format boundary |
The 2026-08-30 fixed-host qualification covers 50 operation families in both F32 and F64. All 100 whole-workload checksum oracles passed. Across the 27 families with equivalent valid-input arithmetic, OA reached parity or better in both precisions and used 13.4% less time by geometric mean for F32 and 11.9% less for F64 against GLM 1.1.0. The table shows representative arithmetic results; checked and fail-closed operations remain separate because their GLM peers omit OA's validation. See the complete VLM benchmark for all 50 rows, provenance, spread, safety costs, and reproduction.
| Case | F32 OA / GLM | F64 OA / GLM | Result |
|---|---|---|---|
| 27 equivalent arithmetic families | 0.866× geometric mean | 0.881× geometric mean | All parity or faster |
| Mat4 multiplication | 0.622× | 0.975× | F32 faster; F64 parity |
| TRS composition | 0.358× | 0.322× | OA faster |
| Translation construction | 0.418× | 0.472× | OA faster |
| Scale construction | 0.453× | 0.452× | OA faster |
Cameramath.cpp
1#include <oa/core/vlm.h>23const oa::vlm::Vec3 eye{0.0F, 2.0F, 5.0F};4const oa::vlm::Vec3 target{0.0F, 0.0F, 0.0F};5const oa::vlm::Mat4 view = oa::vlm::lookAt(6 eye,7 target,8 {0.0F, 1.0F, 0.0F}9);10const oa::vlm::Mat4 projection = oa::vlm::perspective(11 60.0F,12 16.0F / 9.0F,13 0.1F,14 1000.0F15);1617const oa::vlm::Vec3 worldPoint{1.0F, 1.0F, 0.0F};18oa::vlm::Vec3 ndc;19const bool visible = oa::vlm::tryProjectPoint(20 worldPoint,21 view * projection,22 ndc23);24
Common GLM Vulkan integrations enable [0, 1] clip depth through a compile-time definition and apply a Y sign correction to the projection matrix. Those are valid adapter choices. VLM instead fixes one OA-wide convention: projection depth is Vulkan-native, raster Y belongs to viewport state, and callers do not scatter transposes, * -1 repairs, or compensating -90° rotations through camera, render, and application code. External axes, units, handedness, and quaternion order convert once at the format boundary. The public VLM value surface is currently C++ only; Python parity remains unshipped.
Core libraries and third-party code
| Category | Ownership | Boundary |
|---|---|---|
| OA foundation | Core OA library | Direct oa:: vocabulary; not a third-party or STL-compatibility module |
| VLM | Core OA library | oa::vlm spatial values and stateless host math under one Vulkan convention |
| Third-party dependencies | Private adapter or vendored boundary | Native types and policy do not leak into unrelated public OA values |
Tests, generators, bindings, and SDK programs may use the host standard library inside their declared boundary. Shipped product code uses the OA foundation vocabulary; native OS, compiler, Vulkan, C-runtime, and third-party APIs terminate in focused adapters. Linked-binary independence and the remaining installed-header adapter closure retain separate qualification gates.