Cmul   xtlang


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/libs/contrib/gsl.xtm

Implementation

(bind-func Cmul
  (lambda (num1:gsl_complex* num2:gsl_complex*)
    (let ((n1 (bitcast num1 |2,double|*))
    (n2 (bitcast num2 |2,double|*))
    (num3:gsl_complex* (alloc))
    (n3 (bitcast num3 |2,double|*))
    (ac (* (aref n1 0) (aref n2 0)))
    (ad (* (aref n1 0) (aref n2 1)))
    (bc (* (aref n1 1) (aref n2 0)))
    (bd (* (aref n1 1) (aref n2 1))))
      (aset! n3 0 (- ac bd))
      (aset! n3 1 (+ ad bc))
      num3)))


Back to Index

Similar Entries