I want to calculate a point/vector with the least Euclidian distance to a given set of N lines (e.g. given by a point and a vector for the direction) in a D dimensional space (for example by least squares)
Since I use Python for my project, I was wondering, whether there are already appropriate implementations for this general problem in some standard library like numpy, but I have not found any.
There are already related questions like:
Finding the centre of multiple lines using least squares approach in Python
nearest intersection point to many lines in python
However, these questions did not consider a dimension larger than 3 and in my case, I would like to adapt the problem to dimensions like 100.
I also found this resource for Matlab, which does not seem to be used that much, but it deals with the same problem: https://de.mathworks.com/matlabcentral/fileexchange/59805-line-line-intersection-n-lines-d-space?s_tid=FX_rc1_behav