From 2d2f26910d8477a7b4bc97ac2128ced65f1efa31 Mon Sep 17 00:00:00 2001 From: Cole Scott Date: Wed, 6 May 2020 01:57:45 -0700 Subject: [PATCH] Add check for input layout in EXPM --- transcendental/transcendental.lisp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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