;; this xtm_multiple works!
(bind-func xtmmultiplication:[DArray{!a},!b,DArray{!a}_]
(lambda (s a)
(let ((dat (tref a 1))
(size (tref a 0))
(dat2 (alloc size))
(i 0))
(dotimes (i size)
(pset! dat2 i (\ s (pref dat i))))
(let ((a2 (DArray size dat2)))
a2))))
;; against this test
(bind-func test1
(lambda ()
(let ((a:DArray{float} (DArray 10)))
(* 2.0:f a))))
;; these two versions both fail!!!
(bind-func xtmmultiplication:[DArray{!a},!b,DArray{!a}_]
(lambda (s a)
(let ((dat (tref a 1))
(size (tref a 0))
(dat2 (alloc size))
(i 0))
(dotimes (i size)
(pset! dat2 i (\ s (pref dat i))))
(DArray size dat2))))
(bind-func xtmmultiplication:[DArray{!a},!b,DArray{!a}_]
(lambda (s a)
(let ((dat (tref a 1))
(size (tref a 0))
(dat2 (alloc size))
(a2 (DArray size dat2))
(i 0))
(dotimes (i size)
(pset! dat2 i (\ s (pref dat i))))
a2)))
(bind-type DArray <i64,!a>)
(bind-func DArray:[DArray,i64] (lambda (x) (let ((dat (alloc x))) (DArray x dat))))
;; this xtm_multiple works! (bind-func xtmmultiplication:[DArray{!a},!b,DArray{!a}_] (lambda (s a) (let ((dat (tref a 1)) (size (tref a 0)) (dat2 (alloc size)) (i 0)) (dotimes (i size) (pset! dat2 i (\ s (pref dat i)))) (let ((a2 (DArray size dat2))) a2))))
;; against this test (bind-func test1 (lambda () (let ((a:DArray{float} (DArray 10))) (* 2.0:f a))))
;; these two versions both fail!!!
(bind-func xtmmultiplication:[DArray{!a},!b,DArray{!a}_] (lambda (s a) (let ((dat (tref a 1)) (size (tref a 0)) (dat2 (alloc size)) (i 0)) (dotimes (i size) (pset! dat2 i (\ s (pref dat i)))) (DArray size dat2))))
(bind-func xtmmultiplication:[DArray{!a},!b,DArray{!a}_] (lambda (s a) (let ((dat (tref a 1)) (size (tref a 0)) (dat2 (alloc size)) (a2 (DArray size dat2)) (i 0)) (dotimes (i size) (pset! dat2 i (\ s (pref dat i)))) a2)))