Hi All,

I am trying to calculate the derivative of a function that
depends on eigenvalues of a matrix. I am new to Theano.
Here is a snippet of the code.
import numpy as np

import theano
import theano.tensor as T
import theano.tensor.nlinalg as nlin

def myFun(X,a=2):
    s=T.dmatrix('s') 
    x=T.dvector('x')
    a=T.dscalar('a')
    def smat(x):
      return  [[x[0]**2,x[1],x[2]],
               [x[1]**2,a*x[1],a*X[0]],
               [x[2]**2,x[0],a*x[1]]]
    v,w=nlin.eigh(smat(x))
    TG=T.grad(v,x)
    Eigen,Grad = theano.function([x], [v,TG],allow_input_downcast=True )
   
    ev=Eigen(X)
    der=Grad(X)
    print ev,der

myFun([2,3,5])

Can anyone help me to solve this problem? 

Regards,
Jyotiranjan

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"theano-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to