📄 todo
字号:
* Routines for selecting the k largest or smallest values could useheapsort for speed O(N log k) rather than insertion O(N k).* Sorting of complex arrarys without using additional memory. We tryto avoid allocating memory internally in GSL, so internally computingthe magnitudes and storing them in a temporary array is undesirable. Obviously a complex array can be sorted using sqrt(x*x + y*y) <=>sqrt(u*u + v*v) (written in a numerically stable way) for everycomparison, but this may be unacceptably slow. Maybe not? It is just aconstant factor. The square roots could sometimes be avoided byoptimization, (x,y) = (MAX(|x|,|y|), MIN(|x|,|y|)) (u,v) = (MAX(|u|,|v|), MIN(|u|,|v|)) if (x < u/sqrt(2)) /* This part is optional optimization */ return -1 if (x > u*sqrt(2)) return +1 if (x == 0 && u == 0) ... if (x == 0) ... if (u == 0) ... t = u*sqrt((1+(v/u)^2)/(1+(y/x)^2)) if (x < t) return -1 if (x > t) return +1 else return 0but this does depend on the data having sufficient range for theoptimization to be worthwhile, otherwise it is an extra cost.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -