Quantcast
Channel: First steps - JuliaLang
Viewing all articles
Browse latest Browse all 2795

Tensor product inside function

$
0
0

@Veenty wrote:

So I have the following code

function CC_trap(X::Array{Float64,2}, tag::Int64)
    a = 0.0

    for i=1:size(X)[1]
      	    for j=1:size(X)[2]

		    global a += weights_CC[i]*X[i,j]
	    end
    end

    a = result_integral*Parameters.dv[tag]

end

But I’m getting the error
syntax: global a: a is a local variable in its enclosing scope

What would be the proper Julia way of doing this?

Posts: 3

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 2795

Trending Articles