File: helpers.py

package info (click to toggle)
python-pypathlib 0.1.3-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 156 kB
  • sloc: python: 360; makefile: 30
file content (8 lines) | stat: -rw-r--r-- 176 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
import numpy


def shoelace(x):
    previous = numpy.roll(x, 1, axis=0)
    return numpy.sum(
        x[..., 1] * previous[..., 0] - x[..., 0] * previous[..., 1], axis=0
    )