This project has moved and is read-only. For the latest updates, please go here.

Grad calculation wrong answer

Aug 8, 2011 at 6:48 AM

Hi, sorry for my poor english.

I want to calculate Jacobian matrix by using AutoDiff library.

Variable x = new Variable();
Variable y = new Variable();
Variable z = new Variable();

Term func = y;
double[] grad = func.Differentiate(new Variable[] {x, y, z}, new double[] {1, 2, 3 });

The answer of grad array is [0, 0, 1] , but actually the answer of grad array should be [0, 1, 0]

What's wrong with the code ?  Any ideas?  Comments?  Something else?



Aug 8, 2011 at 5:10 PM
Edited Aug 8, 2011 at 5:14 PM

What's wrong with the code is that it found a bug in my library, and it isn't supposed to have bugs :)

Anyway, this is a bug with AutoDiff when the target function doesn't use all the variables. I will fix it ASAP and release a fix release 0.4.1.


I opened a WorkItem for this problem:

please subscribe to it and when it's fixed get the latest version and check that your program works.


Aug 8, 2011 at 7:19 PM

Try it now

Aug 9, 2011 at 1:46 AM

It works on the newest version.

By the way, the package has a sub package of ver 0.2. Is there any special things between two versions?


Aug 9, 2011 at 5:13 AM
Edited Aug 9, 2011 at 6:30 AM

What do you mean? Are you talking about the NuGet package? Or you're talking about the directory in the source control?

If you're talking about the directory in the source code - you can ignore it. I saved it for myself. You should not use it at all.

Aug 10, 2011 at 1:58 AM

I downloaded the source code from the directory in the source control, so I saw several directory in the downloaded package.


Thanks, alexshtf.