# MethodError: no method matching -(::LinearAlgebra

**URL:** <https://discourse.julialang.org/t/methoderror-no-method-matching-linearalgebra/65477>\
**Category:** General Usage\
**Created:** [July 29, 2021, 6:44am UTC](https://discourse.julialang.org/t/methoderror-no-method-matching-linearalgebra/65477 "2021-07-29T06:44:12Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [July 29, 2021, 7:19am UTC](https://discourse.julialang.org/t/methoderror-no-method-matching-linearalgebra/65477/2 "2021-07-29T07:19:16Z")

</div>

It’s a little hard to tell because your code is not an MWE - none of your variables are defined anywhere, and there’s a lot of most likely irrelevant stuff in there as well. Have a look at [Please read: make it easier to help you](https://discourse.julialang.org/t/please-read-make-it-easier-to-help-you/14757) to get some ideas on how to most effectively ask for help here.

That said, you method error is (reasonably) clear I would say:

```julia
no method matching -(::LinearAlgebra.Adjoint{Float64,StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}}, ::Float64)

```

It’s slightly more convoluted then it could be because your `FD` (presumably) is an adjoint rather than a regular matrix, but it tells you that you can’t subtract an integer from a matrix. The error is a bit easier to digest if you have a “regular” matrix:

```julia
julia> matrix = rand(3, 3)
3×3 Matrix{Float64}:
 0.936169 0.367046 0.109481
 0.763018 0.0366246 0.933463
 0.748903 0.128593 0.47728

julia> matrix - 1
ERROR: MethodError: no method matching -(::Matrix{Float64}, ::Int64)
For element-wise subtraction, use broadcasting with dot syntax: array .- scalar

```

And it even tells you what you should be doing if you are looking to subtract that scalar from every element of your matrix!

---

_[View the full topic](https://discourse.julialang.org/t/methoderror-no-method-matching-linearalgebra/65477)._
