Skip to content

Commit

Permalink
Bug fix, specified type. (quil-lang#186)
Browse files Browse the repository at this point in the history
* Bug fix, specified type.

* Fix typo

* export sum function

* FIx Tab typo

* Typo
  • Loading branch information
anranyicheng authored Apr 2, 2023
1 parent dbf24da commit e904b43
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/high-level/constructors.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,12 @@ The tensor is specialized on SHAPE and TYPE."
shape
(lambda (&rest pos)
(setf (aref storage (funcall index-function pos shape))
(aref array (funcall input-index-function pos shape))))))
(coerce (aref array (funcall input-index-function pos shape)) type)))))
(t (map-indexes
shape
(lambda (&rest pos)
(setf (aref storage (funcall index-function pos shape))
(apply #'aref array pos)))))))
(coerce (apply #'aref array pos) type)))))))
(let ((tensor
(make-tensor tensor-class shape
:storage storage
Expand Down
4 changes: 2 additions & 2 deletions src/high-level/matrix-functions/eig/eig.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
(right-vecs (make-array (* n n) :element-type 'double-float :initial-element 0.0d0))
(lwork (* 4 n n))
(work (make-array lwork :element-type 'double-float :initial-element 0.0d0)))
(lapack::dgeev
(magicl.lapack-cffi:%dgeev ;lapack::dgeev
"N" ; left eigenvectors
"V" ; right eigenvectors
n ; order
Expand All @@ -62,7 +62,7 @@
(cond
((and a-real? b-real?)
(< (realpart a) (realpart b)))
((and a-real? (not b-real))
((and a-real? (not b-real?))
t)
((and (not a-real?) b-real?)
nil)
Expand Down
2 changes: 1 addition & 1 deletion src/high-level/tensor.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ COPY-TENSOR, DEEP-COPY-TENSOR, TREF, SETF TREF)"
(:row-major (row-major-index pos (tensor-shape tensor)))
(:column-major (column-major-index pos (tensor-shape tensor))))))
(setf (aref (,storage-sym tensor) index)
new-value)))))))
(coerce new-value ',type))))))))

(defun pprint-tensor (stream tensor &optional colon-p at-sign-p)
"Pretty-print a matrix MATRIX to the stream STREAM."
Expand Down
3 changes: 2 additions & 1 deletion src/high-level/vector.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ ELEMENT-TYPE, CAST, COPY-TENSOR, DEEP-COPY-TENSOR, TREF, SETF TREF)"
(defmethod (setf tref) (new-value (vector ,name) &rest pos)
(policy-cond:with-expectations (> speed safety)
((assertion (valid-index-p pos (list (vector-size vector)))))
(setf (aref (,storage-sym vector) (first pos)) new-value))))))
(setf (aref (,storage-sym vector) (first pos))
(coerce new-value ',type)))))))


(defun pprint-vector (stream vector)
Expand Down
1 change: 1 addition & 0 deletions src/packages.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@
#:kron
#:scale
#:scale!
#:sum
#:diag
#:det
#:upper-triangular
Expand Down

0 comments on commit e904b43

Please sign in to comment.