Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thi-ng/zig-thing
Small collection of data types/structures, utilities & open-learning with Zig
https://github.com/thi-ng/zig-thing
linalg monorepo ndarray simd vector wasm zig
Last synced: 3 months ago
JSON representation
Small collection of data types/structures, utilities & open-learning with Zig
- Host: GitHub
- URL: https://github.com/thi-ng/zig-thing
- Owner: thi-ng
- License: apache-2.0
- Created: 2022-03-22T14:53:25.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-04-24T08:13:32.000Z (9 months ago)
- Last Synced: 2024-04-24T20:10:24.391Z (9 months ago)
- Topics: linalg, monorepo, ndarray, simd, vector, wasm, zig
- Language: Zig
- Homepage: https://thi.ng
- Size: 80.1 KB
- Stars: 25
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# zig.thi.ng
## About
Various, still somewhat unstructured, raw-around-the-edges utilities / open
learning with [Zig](https://ziglang.org), at some point hopefully culminating
into a useful toolkit.**All code in this repo is compatible with Zig v0.13.0**
## Current modules (all WIP)
| Name | Description |
| -------------------------------------------------- | --------------------------------------------------------------------------- |
| [`thing.FixedBufferDualList`](./src/dual_list.zig) | Dual-headed linked list for resource IDs allocation (active/available) |
| [`thing.ndarray`](./src/ndarray.zig) | Generic nD-Array base implementation |
| [`thing.random`](./src/random.zig) | Additional `std.rand.Random`-compatible PRNGs and related utilities. |
| [`thing.vectors`](./doc/vectors.md) | SIMD-based generic vector type & operations (incl. type specific additions) |## Usage with Zig's package manager
Tagged versions of this project are available and can be added as dependency to
your project via `zig fetch`, like so:```bash
zig fetch --save https://github.com/thi-ng/zig-thing/archive/refs/tags/v0.1.0.tar.gz
```The `--save` option adds a new dependency called `thi.ng` to your
`build.zig.zon` project file.You'll also need to update your main `build.zig` with these additions:
```zig
//
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
// main build step...
const exe = b.addExecutable(.{ ... });
//// declare & configure dependency (via build.zig.zon)
const thing = b.dependency("thi.ng", .{
.target = target,
.optimize = optimize,
}).module("thi.ng");// declare module for importing via given id
exe.root_module.addImport("thi.ng", thing);
```**Important:** If you're having a test build step configured (or any other build
step requiring separate compilation), you'll also need to add the
`.root_module.addImport()` call for that step too!With these changes, you can then import the module in your source code like so:
```zig
const thing = @import("thi.ng");
```## Building & Testing
The package is not meant to be build directly (yet), so currently the build file
only declares a module.To run all tests:
```bash
zig test src/main.zig
```## License
© 2021 - 2024 Karsten Schmidt // Apache Software License 2.0