Expand description
FFI (Foreign Function Interface) bindings for tensorlogic-cli
This module provides C-compatible bindings for the tensorlogic-cli library, enabling integration with C/C++ projects and other languages via FFI.
§Memory Management
- All functions that return owned strings use
CStringand must be freed withtl_free_string - All error messages are allocated and must be freed with
tl_free_string - Graph results are allocated and must be freed with
tl_free_graph_result
§Example (C)
// Compile an expression
TLGraphResult* result = tl_compile_expr("friend(alice, bob)", "soft_differentiable");
if (result->error_message != NULL) {
fprintf(stderr, "Error: %s\n", result->error_message);
tl_free_graph_result(result);
return 1;
}
printf("Graph: %s\n", result->graph_data);
tl_free_graph_result(result);Structs§
- TLBenchmark
Result - FFI-compatible benchmark results
- TLExecution
Result - FFI-compatible result type for execution
- TLGraph
Result - FFI-compatible result type for graph compilation
- TLOptimization
Result - FFI-compatible result type for optimization
Functions§
- tl_
benchmark_ ⚠compilation - Benchmark compilation of an expression
- tl_
compile_ ⚠expr - Compile a logical expression to a tensor graph
- tl_
execute_ ⚠graph - Execute a compiled graph
- tl_
free_ ⚠benchmark_ result - Free a benchmark result
- tl_
free_ ⚠execution_ result - Free an execution result
- tl_
free_ ⚠graph_ result - Free a graph result
- tl_
free_ ⚠optimization_ result - Free an optimization result
- tl_
free_ ⚠string - Free a string allocated by tensorlogic
- tl_
is_ ⚠backend_ available - Check if a backend is available
- tl_
optimize_ ⚠graph - Optimize a compiled graph
- tl_
version - Get the version string