Permalink
Browse files

linalg.py: added (currently unused) version of svd-based lstsq. too s…

…low b/c svd nested loop for now.
  • Loading branch information...
1 parent b692c0f commit 016dfc6eb585b94b189ba52df6dc02e772dca91d @mattloper committed Aug 24, 2014
Showing with 9 additions and 0 deletions.
  1. +9 −0 linalg.py
View
@@ -30,6 +30,15 @@ def norm(x, ord=None, axis=None):
return ch.sqrt(ch.sum(x**2))
+# This version works but derivatives are too slow b/c of nested loop in Svd implementation.
+# def lstsq(a, b):
+# u, s, v = Svd(a)
+# x = (v.T / s).dot(u.T.dot(b))
+# residuals = NotImplementedError # ch.sum((a.dot(x) - b)**2, axis=0)
+# rank = NotImplementedError
+# s = NotImplementedError
+# return x, residuals, rank, s
+
def lstsq(a, b, rcond=-1):
if rcond != -1:
raise Exception('non-default rcond not yet implemented')

0 comments on commit 016dfc6

Please sign in to comment.