(bind-func cart_to_pol
"transform a whole buffer cart->pol in-place"
(lambda (a:Complexd* n:i64)
(let ((temp:double 0.0))
(doloop (i n)
(set! temp (sqrt (+ (* (tref (pref a i) 0) (tref (pref a i) 0))
(* (tref (pref a i) 1) (tref (pref a i) 1)))))
(tset! (pref-ptr a i) 1
(atan2 (tref (pref a i) 1) (tref (pref a i) 0)))
(tset! (pref-ptr a i) 0 temp))
void)))