vsinf4   xtlang


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/examples/core/extempore_lang.xtm

Implementation

;; vectorised sine func
(bind-func vsinf4
  (let ((p:/4,float/* (alloc))
        (b:/4,float/* (alloc))
        (c:/4,float/* (alloc))
        (f1:/4,float/* (alloc))
        (f2:/4,float/* (alloc))
        (i:i32 0)
        (p_ 0.225)
        (b_ (dtof (/ 4.0 3.141592)))
        (c_ (dtof (/ -4.0 (* 3.141592 3.141592)))))
    (dotimes (i 4) (vset! p i p_) (vset! b i b_) (vset! c i c_))
    (lambda (x:/4,float/)
      ;; no SIMD for abs yet!
      (dotimes (i 4) (vset! f1 i (fabs (vref x i))))
      (let ((y (+ (* b x) (* c x f1))))
        ;; no SIMD for abs yet!
        (dotimes (i 4) (vset! f2 i (fabs (vref y i))))
        (+ (* p (- (* y f2) y)) y)))))


Back to Index

Similar Entries