mirror of
https://github.com/metabarcoding/obitools4.git
synced 2026-04-30 12:00:39 +00:00
8c7017a99d
- Update obioptions.Version from "Release 4.4.29" to "/v/ Release v5" - Update version.txt from 4.29 → .30 (automated by Makefile)
1.4 KiB
1.4 KiB
obiutils Package: Semantic Overview
This Go package (obiutils) provides generic utilities for numerical and matrix operations, leveraging generics (Go 1.18+). It defines foundational types and helper functions for working with multidimensional data structures.
-
Type Interfaces
Integer: Constraint covering signed integer types (int,int8–int64).Float: Constraint for floating-point types (float32,float64).Numeric: Union of both, enabling generic numeric functions.
-
Data Structures
Vector[T]: A slice-based vector ([]T).Matrix[T]: A row-major representation of a 2D matrix ([][]T), backed by contiguous memory for performance.
-
Core Functions
Make2DArray[T]: Allocates a zero-initialized, contiguous-row-major matrix of arbitrary typeT.Make2DNumericArray[T]: Same as above, but restricted to numeric types; optionally pre-fills with zeros ifzeroed=true.
-
Matrix Methods
.Column(i int): Extracts columnias a slice (not row-wise access)..Rows(i ...int): Returns a new matrix containing only the specified row indices..Dim() (int, int): Returns(rows, cols)safely handlingnilor empty matrices.
The design prioritizes memory efficiency (via contiguous backing arrays), type safety through generics, and ergonomic access patterns for linear algebra-like workflows.