vnormalise   xtlang


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/libs/core/math.xtm

Implementation

(bind-func vnormalise
  (lambda (v1:double* len:i64 result:double*)
    (let ((mag 0.0)
          (i 0))
      (dotimes (i len)
        (set! mag (+ mag (* (pref v1 i) (pref v1 i)))))
      (set! mag (sqrt mag))
      (dotimes (i len)
        (pset! result i (/ (pref v1 i) mag)))
      void)))


Back to Index

Similar Entries

  • vnormalise    xtlang