diff --git a/transcendental/transcendental.lisp b/transcendental/transcendental.lisp index ea47ab7d..c4b13f13 100644 --- a/transcendental/transcendental.lisp +++ b/transcendental/transcendental.lisp @@ -9,11 +9,13 @@ (let ((ideg 6) (rows (magicl:nrows m)) (tcoef (coerce 1.0 'double-float)) - (h (copy-seq (magicl::storage m))) + (h-tensor (magicl::deep-copy-tensor m)) (iexph 0) (ns 0) (iflag 0)) - (let ((lwsp (+ (* 4 rows rows) ideg 1)) + (when (eql :row-major (magicl::layout h-tensor)) (magicl:transpose! h-tensor)) + (let ((h (magicl::storage h-tensor)) + (lwsp (+ (* 4 rows rows) ideg 1)) (ipiv (magicl::make-array (list rows) :element-type '(signed-byte 32)))) (let ((wsp (magicl::make-array (list lwsp) :element-type '(complex double-float)))) ;; Requires direct foreign function call due to need to access a pointer