# Mesh-Free method for CG giving method error

**URL:** <https://discourse.julialang.org/t/mesh-free-method-for-cg-giving-method-error/68509>\
**Category:** New to Julia\
**Tags:** iterative, linearalgebra\
**Created:** [September 21, 2021, 7:20am UTC](https://discourse.julialang.org/t/mesh-free-method-for-cg-giving-method-error/68509 "2021-09-21T07:20:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nikhil\_Singh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nikhil_singh/32/29371_2.png) [@Nikhil\_Singh](https://discourse.julialang.org/u/Nikhil_Singh)\
**Post date:** [September 21, 2021, 7:20am UTC](https://discourse.julialang.org/t/mesh-free-method-for-cg-giving-method-error/68509/1 "2021-09-21T07:20:44Z")

</div>

Hi, I am attempting to develop linear operator to be used into IterativeSolver.cg. I have scripted the following for the same

struct MyA  
Asm::SparseMatrixCSC{Float64, Int64}  
Freedof::Vector{Int64}  
Cdof::Matrix{Int64}  
Ke::Matrix{Float64}  
dof::Int64  
TN::Int64  
Nno::Int64  
TE::Int64  
end

function (t::MyA)(F\_int::Vector{Float64}, u::Vector{Float64})  
## Internal force evaluation  
U = zeros(t.dof\*t.TN)  
U[Freedof] = u;

```
Fe = zeros(t.dof*t.Nno,t.TE)
f_int = zeros(t.dof*t.TN)
mul!(Fe,Ke,U[Cdof'])

mul!(f_int,t.Asm,vec(Fe))
F_int = f_int[Freedof]

```

end  
A = MyA(Asm,Freedof,Cdof,Ke,dof,TN,Nno,TE)  
Us = cg(A,F\_ext[Freedof];tol=1e-6)

This gives me a method error. Can someone please point out the issue.

---

<div class="post-metadata">

**Author:** ![vinicius\_de\_lima](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vinicius_de_lima/32/28717_2.png) [@vinicius\_de\_lima](https://discourse.julialang.org/u/vinicius_de_lima)\
**Post date:** [September 22, 2021, 3:13am UTC](https://discourse.julialang.org/t/mesh-free-method-for-cg-giving-method-error/68509/2 "2021-09-22T03:13:45Z")

</div>

Hi Nikhil, could you append the error in your description? Besides that, if possible use backticks (```) to involve your code, this gives syntax highlighting and improves the readability.
