Commit 59ffaf32 by Victor

### bug fix in metrics

parent f971bdc1
Pipeline #75034 passed with stage
in 21 minutes and 37 seconds
 ... @@ -54,12 +54,13 @@ thanks to the Fiedler vector (cf `https://mathworld.wolfram.com/FiedlerVector.ht ... @@ -54,12 +54,13 @@ thanks to the Fiedler vector (cf `https://mathworld.wolfram.com/FiedlerVector.ht """ """ function var(world::World;trait=1) function var(world::World;trait=1) xarray = get_x(world,trait) xarray = get_x(world,trait) if trait > 0 && typeof(space(world)[trait]) <: GraphSpace if trait > 0 fiedlervec = eigs(laplacian_matrix(space(world)[trait].g),nev=2,which=:SM)[2][:,2] if typeof(space(world)[trait]) <: GraphSpace return mean(fiedlervec[xarray].^2) - mean(fiedlervec[xarray])^2 fiedlervec = eigs(laplacian_matrix(space(world)[trait].g),nev=2,which=:SM)[2][:,2] else return mean(fiedlervec[xarray].^2) - mean(fiedlervec[xarray])^2 return var(Float64.(xarray),dims=1,corrected=false) end end end return var(Float64.(xarray),dims=1,corrected=false) end end """ """ ... @@ -69,12 +70,13 @@ If trait = 0, returns the variance of the geotrait, ... @@ -69,12 +70,13 @@ If trait = 0, returns the variance of the geotrait, """ """ function mean(world::World;trait=1) function mean(world::World;trait=1) xarray = get_x(world,trait) xarray = get_x(world,trait) if trait > 0 && typeof(space(world)[trait]) <: GraphSpace if trait > 0 fiedlervec = eigs(laplacian_matrix(space(world)[trait].g),nev=2,which=:SM)[2][:,2] if typeof(space(world)[trait]) <: GraphSpace return mean(fiedlervec[xarray]) fiedlervec = eigs(laplacian_matrix(space(world)[trait].g),nev=2,which=:SM)[2][:,2] else return mean(fiedlervec[xarray]) return mean(Float64.(xarray),dims=1) end end end return mean(Float64.(xarray),dims=1) end end """ """ ... ...
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!