Skip to main content

scitex-linalg

SciTeX

Small linear-algebra helpers — distances, NaN-aware norms, geometric median, vector projections.

Full Documentation · uv pip install scitex-linalg[all]

pypi python docs

tests cov


Quick Start

import scitex_linalg as sxl

sxl.cdist(u, v)                # pairwise distances
sxl.cosine(v1, v2)             # cosine similarity (NaN-safe)
sxl.nannorm(v, axis=-1)        # norm; propagates NaN
sxl.rebase_a_vec(v, v_base)    # project v onto v_base basis

Demo

flowchart LR
    A["u, v (np.ndarray)"] --> B["scitex_linalg.cdist"]
    B --> C["pairwise distance matrix"]
    A2["v with NaNs"] --> D["scitex_linalg.nannorm"]
    D --> E["vector norm; NaN propagates"]
    A3["v, v_base"] --> F["scitex_linalg.rebase_a_vec"]
    F --> G["projected coords"]
    A4["xx (torch.Tensor)"] --> H["scitex_linalg.geometric_median"]
    H --> I["robust median point"]

Figure 1. Demo. Distances, NaN-propagating norms, projections, and the torch geometric median.

>>> import numpy as np, scitex_linalg as sxl
>>> sxl.cosine(np.array([1, 0]), np.array([1, 1]))
0.7071...
>>> sxl.nannorm(np.array([3.0, np.nan, 4.0]))
nan
>>> sxl.nannorm(np.array([3.0, 4.0]))
5.0

Installation

uv pip install "scitex-linalg[all]"
Extras
Extra Enables
all Everything below (torch)
torch Geometric median (torch, geom-median)
dev Test/lint tools (pytest, ruff, scitex-dev)
docs Sphinx build (sphinx, theme/parser extensions)

Architecture

flowchart LR
    UV["u, v"] --> DIST[euclidean_distance / cdist / edist]
    V["vectors"] --> MISC[cosine / nannorm / rebase_a_vec]
    XX["xx (torch.Tensor)"] --> GM[geometric_median]
    DEC[vendor decorators] --> NP[numpy_fn]
    DEC --> TF[torch_fn]

Figure 2. Architecture. Pure numpy/scipy core plus the torch geometric-median path and vendored decorators.

Tiny single-purpose helpers. Core dependencies cover numpy/scipy/sympy/pandas. Install scitex-linalg[torch] for the geometric median and Torch numerical helpers; the package imports without that optional extra.

1 Interfaces

Python API
import scitex_linalg as sxl

sxl.euclidean_distance(u, v, axis=0)      # element-wise Euclidean distance
sxl.cdist(u, v)                           # pairwise distances
sxl.edist(u, v)                           # alias for euclidean_distance
sxl.cosine(v1, v2)                        # cosine similarity (NaN-safe)
sxl.nannorm(v, axis=-1)                   # NaN-aware vector norm
sxl.rebase_a_vec(v, v_base)               # project v onto v_base basis
sxl.three_line_lengths_to_coords(a, b, c) # triangle side lengths -> 2-D coords
sxl.geometric_median(xx, dim=-1)          # torch geometric median (requires [torch] extra)

Status

Standalone fork of scitex.linalg — intended to remain importable as scitex.linalg via the SciTeX umbrella package's bridge module. Decorators (numpy_fn, torch_fn, wrap) are vendored under _vendor_decorators/ to keep the package free of scitex.* runtime deps; when scitex-decorators is split out, those will be replaced with a direct dependency.

Part of SciTeX

scitex-linalg is part of SciTeX. Install via the umbrella with pip install scitex[linalg] to use as scitex.linalg (Python).

Four Freedoms for Research

  1. The freedom to run your research anywhere — your machine, your terms.
  2. The freedom to study how every step works — from raw data to final manuscript.
  3. The freedom to redistribute your workflows, not just your papers.
  4. The freedom to modify any module and share improvements with the community.

AGPL-3.0 — because we believe research infrastructure deserves the same freedoms as the software it runs on.

License

AGPL-3.0-only (see LICENSE).


SciTeX

Metadata

Release files for scitex-linalg 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for scitex-linalg 0.1.6
File Size Uploaded Provenance
scitex_linalg-0.1.6.tar.gz 29.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for scitex-linalg 0.1.6
File Interpreter ABI Platform
scitex_linalg-0.1.6-py3-none-any.whl Python 3 none any Details

Total release size: 61.0 kB

Release files / scitex_linalg-0.1.6.tar.gz

Download URL scitex_linalg-0.1.6.tar.gz
Size 29.1 kB
Tags Source
SHA-256 checksum
How to use checksums
561efa750e6f55dea122e17859cf27d7254ba78679a6a5cc10e6db6b7e5cd828
BLAKE2b-256 checksum
How to use checksums
dfffe3c9719face67ec7c273e37228d0a4586fcb953eb4a2134a3731e24318a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.12.14

Release files / scitex_linalg-0.1.6-py3-none-any.whl

Download URL scitex_linalg-0.1.6-py3-none-any.whl
Size 31.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1db1bd393e6cd8cc8c020d31d2334c43537646225e68fa465a33c35c9b4f54d9
BLAKE2b-256 checksum
How to use checksums
df500b22ed57f95208972a86cc6edf02de5c1eacc869f2466407eecf835bccd9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.12.14

Security for scitex-linalg 0.1.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page