# Does svd() not support forwarddiff?

**URL:** <https://discourse.julialang.org/t/does-svd-not-support-forwarddiff/84662>\
**Category:** General Usage\
**Tags:** question\
**Created:** [July 23, 2022, 5:16am UTC](https://discourse.julialang.org/t/does-svd-not-support-forwarddiff/84662 "2022-07-23T05:16:44Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![maxkapur](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/maxkapur/32/21208_2.png) [@maxkapur](https://discourse.julialang.org/u/maxkapur)\
**Post date:** [July 23, 2022, 1:30pm UTC](https://discourse.julialang.org/t/does-svd-not-support-forwarddiff/84662/3 "2022-07-23T13:30:12Z")

</div>

The discussion @DanielVandH linked mentions [GenericLinearAlgebra.jl](https://julialinearalgebra.github.io/GenericLinearAlgebra.jl/stable/), a project to implement linear algebra functions in pure Julia with support for generic arguments. The `svd` function from this package seems to work just fine with ForwardDiff:

```julia
using GenericLinearAlgebra: svd
using ForwardDiff

function f(x)
    a = [1 2; 3 4]
    a = a .* x
    _, s, _ = svd(a)
    return sum(s)
end

ForwardDiff.derivative(f,2)
# 5.830951894845303

```

---

_[View the full topic](https://discourse.julialang.org/t/does-svd-not-support-forwarddiff/84662)._
