stdlib-js / stdlib

✨ Standard library for JavaScript and Node.js. ✨
https://stdlib.io
Apache License 2.0
4.33k stars 441 forks source link

[RFC]: City Block (Manhattan) distance between two strided arrays #833

Open Planeshifter opened 1 year ago

Planeshifter commented 1 year ago

This RFC proposes adding a function to calculate the City Block (Manhattan) distance between two strided arrays.

Package: @stdlib/math/strided/distances/cityblock

The function should have the following signature cityblock( N, x, strideX, y, strideY ).

The function should return the City Block distance between the two arrays. It is calculated by summing the absolute differences between corresponding elements for each array.

The City Block (Manhattan) distance is a useful measure of distance between two points or vectors in a multidimensional space. It is commonly used in machine learning and data science applications. The ability to calculate the City Block distance between two strided arrays would make it easier to implement these algorithms in JavaScript.

See:

Related Issues

None.

Questions

No.

Other

No.

Checklist

kgryte commented 1 year ago

For compute.io, we named as manhattan; SciPy names as cityblock. Is there a reason to prefer one over the other? Atm, the OP uses cityblock.

Planeshifter commented 1 year ago

Both SciPy and Julia use cityblock, so I was leaning towards that name. Either choice would be appropriate, I think.

kgryte commented 1 year ago

Fine with me. cityblock it is.

AhmedKhaled590 commented 6 months ago

Hi @Planeshifter. Is this RFC available to work on?

kgryte commented 6 months ago

@AhmedKhaled590 This one is probably not ideal at the moment, as we need to do some R&D in terms of the interface. @Planeshifter and I will be putting up some new good first issues within the next day or so, some of which will be oriented toward C and native add-ons.