How about we unify the interface?
Proposal:
eigenspaces: Return a list of tuples, the first element being an
eigenvalue and the second being the associated eigenspace.
eigenvalues: Return a list of eigenvalues.
eigenvectors(left=True, right=False): Return a list of eigenvalues and
an associated matrix (or matrices) containing associated eigenvectors.
*should we have the following?*
eigenvectors_right, eigenvectors_left: Wrapper calls to eigenvalues
which return the eigenvalues and either the left or right eigenvalues.
The function here *starts* with eigen so that tab completion is helpful.
For comparison, Matlab does this with the eig and eigs functions. Mma
has Eigenvalues, Eigenvectors, and Eigensystem (which returns
eigenvalues and eigenvectors).
Thoughts on keeping the current right_eigenvectors and left_eigenvectors?
Thanks,
Jason
I like your idea in general but what does eigenvectors(left=True, right=False)
mean?
>
> *should we have the following?*
>
> eigenvectors_right, eigenvectors_left: Wrapper calls to eigenvalues
> which return the eigenvalues and either the left or right eigenvalues.
> The function here *starts* with eigen so that tab completion is helpful.
+1
Sorry for the confusion:
I want a way to tell eigenvectors that I would like either the right or
left or both sets of eigenvectors. I'm inspired by the interface from
scipy (the scipy.linalg.decomp.eig function):
eigenvectors() returns the eigenvalues and left eigenvectors
eigenvectors(left=True) returns the eigenvalues and left eigenvectors
eigenvectors(right=True) returns the eigenvalues and right eigenvectors
eigenvectors(left=True, right=True) returns the eigenvalues and both
sets of eigenvectors
so basically, I mean the function is defined as
def eigenvectors(left=False, right=False)
but if both are false, then we set left=True anyway so that we have
something to return.
The eig function mentioned above has this signature:
def eig(a,b=None, left=False, right=True, overwrite_a=False,
overwrite_b=False):
So by default, it returns the right eigenvectors. a is the original
matrix; b is the matrix for computing generalized eigenvalues, and the
overwrite parameters are there to tell lapack that it's okay to
overwrite the matrices for speed.
Oh, and the eigenspaces function should have similar left and right
keyword arguments, as well as eigenspaces_left and eigenspaces_right
wrappers.
Thanks,
Jason
+1 for the above.
> *should we have the following?*
>
> eigenvectors_right, eigenvectors_left: Wrapper calls to eigenvalues
> which return the eigenvalues and either the left or right eigenvalues.
> The function here *starts* with eigen so that tab completion is
> helpful.
I don't see the need, and I'm always leery of overpopulating the
namespace :-} You already have the functionality, and with '?', it is
easily accessible.
Justin
--
They said it couldn't be done, but sometimes,
it doesn't work out that way.
- Casey Stengel
--
+1 to everything Justin just said.
William
+1 as well. And while we're at it, if this gets voted in, we should
change kernel to have a consistent behavior as well, i.e. have
kernel(left=True, right=False)
and get rid of left_kernel() and right_kernel().
Alex
- --
Alexandru Ghitza
Assistant Professor
Department of Mathematics
Colby College
Waterville, ME 04901
http://bayes.colby.edu/~ghitza/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFH9O89dZTaNFFPILgRAgTYAKCNa3phUJk0OPeE+8RGW76h0elJvACfdO/Z
Bw2iHJ9tlSm5N3xa3O9w9aQ=
=UB0u
-----END PGP SIGNATURE-----
+1 for (non-foolish[*]) consistency.
Justin
[*] R.W. Emerson ("A foolish consistency is the hobgoblin of little
minds")
--
Justin C. Walker, Curmudgeon-At-Large
Institute for the Enhancement of the Director's Income
--------
Experience is what you get
when you don't get what you want.
--------
John
+1 This has bothered me too.
I don't always support synonyms but I do want all those little helper
functions. The point is to make it easy to read code -- eigensystem
() makes the intention clear, whereas (eigenvalues(), eigenvectors())
obscures the meaning. I don't want to lose that declaration of
intent just to keep the namespace small.
Nick
I'm not objecting to your suggestion above, but:
My comment was mainly about the _right/_left names, but clearly, some
of this is in the eye (or ear) of the beholder. 'eigensystem'
doesn't seem to have the impact for me that it does for you; I could
scratch my head a while trying to dope out what it intended.
Justin
--
Justin C. Walker, Curmudgeon-At-Large
Institute for the Absorption of Federal Funds
--------
If you're not confused,
You're not paying attention
--------