Skip to content

Modifying a single index of a vector valued function doesn't work #752

@Nidish96

Description

@Nidish96

The following works:

N = 8;
t = (0:N-1)*2π/N;
yt = cos.(t);
fun = (yt) -> begin yf = rfft(yt); yout = real(yf); return yout; end;
Dh = ForwardDiff.jacobian(fun, yt)

while the following doesn't:

N = 8;
t = (0:N-1)*2π/N;
yt = cos.(t);
fun = (yt) -> begin yf = rfft(yt); yout = real(yf); yout[1] .*= 2; return yout; end;
Dh = ForwardDiff.jacobian(fun, yt)

Curiously enough, the following works:

N = 8;
t = (0:N-1)*2π/N;
yt = cos.(t);
fun = (yt) -> begin yf = rfft(yt); yout = real(yf); yout[1] = 2yout[1]; return yout; end;
Dh = ForwardDiff.jacobian(fun, yt)

I'd appreciate any leads!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions