Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forward Declare Aliases to Prevent Style Warnings #168

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/high-level/matrix.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,7 @@ If :SQUARE is T, then the result will be restricted to the upper rightmost squar
(tref matrix i j))))
target))))
;;; Synonym for upper-triangular
(declaim (ftype (function (matrix)) triu))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these aren't necessarily matrix functions, just the implementation provided is

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If these were to be replaced with t, would that impair any optimizations?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so. There's a lot of indirection already.

(setf (fdefinition 'triu) #'upper-triangular)

(define-extensible-function (lower-triangular lower-triangular-lisp) (matrix &key square)
Expand All @@ -507,18 +508,21 @@ If :SQUARE is T, then the result will be restricted to the lower leftmost square
(tref matrix i j))))
target))))
;;; Synonym for lower-triangular
(declaim (ftype (function (matrix)) tril))
(setf (fdefinition 'tril) #'lower-triangular)

(define-extensible-function (conjugate-transpose conjugate-transpose-lisp) (matrix)
(:documentation "Compute the conjugate transpose of a matrix")
(:method ((matrix matrix))
(map #'conjugate (transpose matrix))))
(declaim (ftype (function (matrix)) dagger))
(setf (fdefinition 'dagger) #'conjugate-transpose)

(define-extensible-function (conjugate-transpose! conjugate-transpose!-lisp) (matrix)
(:documentation "Compute the conjugate transpose of a matrix, replacing the elements")
(:method ((matrix matrix))
(map! #'conjugate (transpose! matrix))))
(declaim (ftype (function (matrix)) dagger!))
(setf (fdefinition 'dagger!) #'conjugate-transpose!)

(define-backend-function eig (matrix)
Expand Down