-
Notifications
You must be signed in to change notification settings - Fork 47
Reduced SVD interface plus tests. #65
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
Conversation
I'd like to remove the conversion of sigma to a diagonal matrix and simply return the vector of singular values. Let me know if you're opposed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm. comments are ignorable.
(defun svd (m &key reduced) | ||
"Find the SVD of a matrix M. Return (VALUES U SIGMA Vt) where M = U*SIGMA*Vt. If REDUCED is non-NIL, return the reduced SVD (where either U or V are just partial isometries and not necessarily unitary matrices)." | ||
(let* ((jobu (if reduced "S" "A")) | ||
(jobvt (if reduced "S" "A")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@appleby @stylewarning do you see what i see
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you squint that v
almost looks like ν
* Add initial version of magicl high-level rewrite * Add *derive-function-types* to asdf project * Add random, fix multiplication, add lapack, make things work * Fix idenetity typo * Fix empty and deye documentation and fix assert-square-matrix printing whole matrix * Remove FASL in high-level dir (Why was that there?) * Fix indentation in matrix.lisp and clean up trace * Add macro to generate blas mult boilerplate * Remove old version of matrix/double-float * Add lapack macros to make mult work * Fix from-*-major-index and add tests for util file * Move lapack method definitions into macros for ease of use * Add square restriction to qr/ql/rq/lq * Remove magicl from :use on packages to avoid shadowing errors * Add support for calling PPRINT-MATRIX within FORMAT * Add distribution as function to RAND and add tests * Add lapack inverse to high level and finish updating examples to new interface * Remove debug message from lapack-inv * Update TEST-RANDOM-UNITARY and TEST-LOGM to new interface * Fix TEST-KRON * Gave it some throught. It should work. * Add p-norm to vector type * Add slice to ABSTRACT-TENSOR - Slice implemented for abstract-tensor - Docstrings cleaned up - TODOs TODONE * Remove TODO regarding if it makes sense. It makes sense. * Fix tests not calling all the tests * Fix constant redefinition in magicl-tests caused by incorrect test predicate * Extract function for type inferring in tensor constructors * Clean up TODOs in high-level * Reduce oddity in abstract-tensor-tests and include dim=1 case * Fix TEST-TENSOR-SHAPE and TEST-TENSOR-RANK with more advanced loops * Remove unneeded multiplication of shape in FROM-DIAG constructor * Update high-level docstrings to be more uniform and descriptive and add order parameters to map and into * Implement VALID-INDEX-P properly and use in high-level * Fix teh typo and bad indentation in high-level-tests * Fix indentation in INFER-TENSOR-TYPE * Fix VALID-INDEX-P to allow for not specifying shape * Make map and into functions more readable * Change high-level constructors to functions from generic functions * Make DEFVECTOR/DEFMATRIX macros more expandable * Add HERMITIAN-EIG to new high-level interface * Fix appleby's nitpicks * Add policy-cond for performance when speed > safety and directly construct classes * Switch from CLOS to structs for tensor objects This gives a significant performance improvement due to avoiding generics at the cost of some flexibility and my sanity. * Remove freeze on tensor struct causing type error * Fix pretty printing for matrix and tensor types and remove old methods * Remove accidentally committed log files * Add (SETF SHAPE) and optimize matrix TREF * Remove warnings from unused arguments and load order * Add basic documentation for high-level interface * Fix bug in transpose on matrix with dimension of 1 * Add integer printing to matrix and vector pretty printers * Change from dynamic to static symbols in INFER-TENSOR-TYPE and move to appropriate file * Add CAST, a replacement for CHANGE-CLASS on tensors * Clean up util and comments * Add subtypes and straggling symbols to package * Add reduced svd interface and tests (#65) * Add CSD-2X2-BASIC (#67) * Use use-expectations in the expected way * Change ABSTRACT-TENSOR to not allow for construction or copying * Move magicl high-level into module in ASDF * Clean up documentation for ABSTRACT-TENSOR * Replace POLICY-IF with WITH-EXPECTATIONS in constructors * Fix mistake in abstract-tensor docstring * Use COPY-SEQ for copying tensor storage and add copiers to vector * Remove funky comma in ASSERT-SQUARE-SHAPE * Move lapack bindings to lapack-bindings.lisp and switch to functions to generate lapack code * Update docstrings for DEFTENSOR, DEFMATRIX, DEFVECTOR, and DEFCOMPATIBLE * Fix other library equivalents table errors Co-Authored-By: Juan M. Bello-Rivas <jbellorivas@rigetti.com> * Change def- to generate- in lapack-templates to reflect change from macro to func * Add numpy rq to high-level doc * Change terminology regarding indexing and number of dimensions of tensors ORDER is now LAYOUT RANK is now ORDER * Remove LAYOUT arg from INTO! and FOREACH in abstract tensor interface These fields do not make sense to have on a method which is calling a function independent of the ordering of the elements * Add ZEROS and ONES constructors for convenience * Remove square requirement from DEYE constructor * Remove ORDER 2 requirement from DEYE * Rename DEYE to EYE * Add TRIL and TRIU synonyms and change DAGGER(!) to synonyms * Add TRIL/TRIU to package * Add issue number to ZUNCSD shim * Replace = with := in LOOPs * Allow for FIXNUM in EYE shape and remove SHAPE requirement from FROM-DIAG * Update tests to refelect change in FROM-DIAG interface * Add BINARY-OPERATOR method and add '.' prefix to element-wise operators * Update documentation for elementwise operators * Remove unwanted argument on FROM-DIAG * Fix typo, represening how bad I am at speling * Fix RAND docstring to be more documenting * Allow for multiple tensors in every, any, notevery, notany * Fix bug in hermitian-eig caused by copying/resetting layout slot on return and export method * Export slice and mult from high-level * Fix expm returning incorrect layout for result * Bump version to 0.7.0 * Symbol case invariance. Drop unused declarations (#74) * Add optimizations for MATRIX class Add matrix-{row,column}-major-index Add specialized INTO! for MATRIX class Add make-storage for matrix class * Update documentation to be more correct Apply suggestions from code review Co-Authored-By: appleby <mappleby@rigetti.com> * Change INVERSE -> INV * Change POLICY-IF to POLICY-COND herminitan-matrix-p has a strict epsilon added to avoid test failures * Fix LAYOUT->ORDER in high-level docs * Fix indentation in high-level docs * Fix deye->eye in high-level docs * Add check for valid index to tref and setf tref in vector and tensor classes * Change default tensor type to var to allow for rebinding * Remove unneeded variable in hermitian-eig * Force square shape for upper and lower triangular of matrix * Update element-wise exponentiation in high-level docs to be consistent * Update examples.lisp Co-Authored-By: Erik Davis <erik@rigetti.com> * Remove layout from ARANGE constructor layout is not needed because it returns a vector * Fix tensor equality errors and add corresponding tests * Add equality for float vectors and fix error in high-level tests * Overhaul p-norm for vectors and add tests * Update documentation for numpy hermitian transpose * Fix p-norm for infinite norm of negative single element vectors * Change float comparison thresholds to variables * Change *-MATRIX-P to functions * Fix incorrect assertion in p-norm of vector * Apply suggestions from code review Co-Authored-By: Erik Davis <erik@rigetti.com> * Remove ORTHONORMALIZE methods for matrices (just use QR) * Add check for singular matrices in INV folllowing call to LU * Remove old note about LU requried for INV. INV now calls the LU LAPACK routine directly and does not require LU to be defined. * Add P-NORM-TYPE and modify vector norm to use type and to disallow negative infinity Co-authored-by: Juan M. Bello-Rivas <jmbr@superadditive.com> Co-authored-by: appleby <mappleby@rigetti.com> Co-authored-by: Erik Davis <erik@cadlag.org>
No description provided.