You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To speed up the computation of the idealized line by the function points_on_ideal(), I propose to vectorize the function point_to_line() such that the argument P0 expects a matrix of points and not just a single point.
A small benchmark on computation times shows that the time is reduced drastically. On my machine the mean computation time for an example with 1000 observations can be reduced from about 1400 to 100 microseconds.
As the functions points_on_ideal() and point_to_line() are both internal, it should be easy to replace point_to_line() by the vectorized version and keep everything else as is.
Attached you find such a vectorized version of point_to_line(), with some code for benchmarking (R-Code as .txt as .R files cannot be uploaded here).
To speed up the computation of the idealized line by the function
points_on_ideal()
, I propose to vectorize the functionpoint_to_line()
such that the argumentP0
expects a matrix of points and not just a single point.A small benchmark on computation times shows that the time is reduced drastically. On my machine the mean computation time for an example with 1000 observations can be reduced from about 1400 to 100 microseconds.
As the functions
points_on_ideal()
andpoint_to_line()
are both internal, it should be easy to replacepoint_to_line()
by the vectorized version and keep everything else as is.Attached you find such a vectorized version of
point_to_line()
, with some code for benchmarking (R-Code as .txt as .R files cannot be uploaded here).Best,
Sarah
vectorize_point_to_line.txt
The text was updated successfully, but these errors were encountered: