# [SciPy-user] [Fwd: Re: Computing eigenvalues by trace minimization]

Nils Wagner nwagner@iam.uni-stuttgart...
Fri Jun 29 05:42:10 CDT 2007

```dmitrey wrote:
> As for your code, I didn't make any changes. You need just specify
> desired contol and then make funtol, xtol, gradtol small enough. Maybe,
> in future I'll implement something more appropriate for to have exitflag
> positive.
>
> BTW for small-scaled problem using df, dh didn't yields any benefits
> only for nVars = 100 I've got ~6 sec with df, dh provided and 11 sec
> without the ones.
> for your nVars=10 time elapsed is almost the same.
>
> HTH, D.
>
> Nils Wagner wrote:
>
>
>>
>>
>
> _______________________________________________
> SciPy-user mailing list
> SciPy-user@scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user
>
Hi Dmitrey,

Thank you for your help. BTW, have you managed the installation of symeig ?
http://mdp-toolkit.sourceforge.net/symeig.html

1) you don't need to use .T in dot, it's executing automatically:
f = lambda x: dot(x.T,dot(A,x)) # => dot(x,dot(A,x))
h = lambda x: dot(x.T,dot(B,x))-1.0 # => dot(x,dot(B,x))-1.0

Let us assume that we are interested in the smallest m eigenvalues
Then you will need .T in case of rectangular matrices x. Therefore I
an extension.
#f = lambda x: trace(dot(x.T,dot(A,x))) # Version for m > 1
#h = lambda x: dot(x.T,dot(B,x))-identity(m)

from scipy import dot, rand

n = 10
m = 3
A = rand(n,n)
x = rand(n,m)
res = dot(x.T,dot(A,x))

Nils

```