About
tensorderiv and DiscreteTensorDerivatives.jl
tensorderiv is a Python port of the Julia package DiscreteTensorDerivatives.jl, by the same author. Both packages implement the same method: the same moment conditions, the same minimum-norm weights, the same check on every stencil, and the same four operators. tensorderiv’s core is written in Rust, and its test suite compares it with the Julia package: the neighbour lists are identical, and the weights and all four operators agree to rounding, on scalar, vector and matrix fields in two and three dimensions.
The two packages differ only where each language has its own conventions. tensorderiv stores one point per row and puts the point index first, as NumPy and SciPy do, whereas the Julia package stores one point per column and puts the point index last. tensorderiv’s operators also take an at argument with NumPy’s indexing rules, where the Julia package has a separate method for a single point.
Citing tensorderiv
If you use tensorderiv in your work, please cite it. Each release is archived on Zenodo with its own DOI; the DOI below always refers to the latest version:
Bielefeld, N. M. (2026). tensorderiv: gradient, divergence, curl and Laplacian on scattered points. Zenodo. https://doi.org/10.5281/zenodo.23111349
@software{bielefeld_tensorderiv,
author = {Bielefeld, Nikolaj Maack},
title = {tensorderiv: gradient, divergence, curl and Laplacian on scattered points},
year = {2026},
publisher = {Zenodo},
doi = {10.5281/zenodo.23111349},
url = {https://tensorderiv.org}
}To cite one specific version, use its own DOI, listed on the Zenodo record. The GitHub repository also offers these details under “Cite this repository”.
Acknowledgements
The method descends from a 2016 Stack Overflow answer by a user named Hans, which introduced the moment conditions and the four operators, and computed the weights through the Gram matrix of the offsets. The theory page shows how that formula relates to the one tensorderiv uses.
Declaration of AI assistance
The Rust core and much of the Python code of tensorderiv were written with substantial assistance from Claude (Anthropic). The method and the reference implementation come from the author’s Julia package DiscreteTensorDerivatives.jl, and the port is validated against it: the test suite compares tensorderiv with the Julia package for the stencil weights, the neighbour lists and all four operators, on scalar, vector and matrix fields in two and three dimensions. The author has reviewed and is responsible for all code.
License
tensorderiv is free software under the MIT license.