diff --git a/src/additional_functions/helper.jl b/src/additional_functions/helper.jl index 26d079b00..91095e071 100644 --- a/src/additional_functions/helper.jl +++ b/src/additional_functions/helper.jl @@ -114,11 +114,11 @@ function sparse_outer_mul!(C, A, B::Vector, ind) #computes A*S*B -> C, where ind end function cov_and_mean(rows; corrected = false) - data = permutedims(hcat(rows...)) + data = transpose(reduce(hcat, rows)) size(rows, 1) > 1 ? obs_cov = Statistics.cov(data; corrected = corrected) : obs_cov = reshape([0.0],1,1) - obs_mean = vcat(Statistics.mean(data, dims = 1)...) + obs_mean = vec(Statistics.mean(data, dims = 1)) return obs_cov, obs_mean end diff --git a/src/additional_functions/parameters.jl b/src/additional_functions/parameters.jl index b381e1c32..13aa1cd41 100644 --- a/src/additional_functions/parameters.jl +++ b/src/additional_functions/parameters.jl @@ -103,7 +103,7 @@ function get_matrix_derivative(M_indices, parameters, n_long) ones(length(M_indices[i])), n_long) for i in 1:length(parameters)] - ∇M = hcat(∇M...) + ∇M = reduce(hcat, ∇M) return ∇M diff --git a/test/examples/multigroup/multigroup.jl b/test/examples/multigroup/multigroup.jl index a86371caa..5ef6bd8c6 100644 --- a/test/examples/multigroup/multigroup.jl +++ b/test/examples/multigroup/multigroup.jl @@ -21,25 +21,24 @@ dat_miss_g2 = dat_missing[dat_missing.school .== "Grant-White", :] ############################################################################################ x = Symbol.(:x, 1:36) -#x = [x...] F = zeros(9, 12) F[diagind(F)] .= 1.0 A = Matrix{Any}(zeros(12, 12)) A[1, 10] = 1.0; A[4, 11] = 1.0; A[7, 12] = 1.0 -A[2:3, 10] .= [x...][16:17]; A[5:6, 11] .= [x...][18:19]; A[8:9, 12] .= [x...][20:21]; +A[2:3, 10] .= x[16:17]; A[5:6, 11] .= x[18:19]; A[8:9, 12] .= x[20:21]; # group 1 S1 = Matrix{Any}(zeros(12, 12)) -S1[diagind(S1)] .= [x...][1:12] +S1[diagind(S1)] .= x[1:12] S1[10, 11] = x[13]; S1[11, 10] = x[13] S1[10, 12] = x[14]; S1[12, 10] = x[14] S1[12, 11] = x[15]; S1[11, 12] = x[15] # group 2 S2 = Matrix{Any}(zeros(12, 12)) -S2[diagind(S2)] .= [x...][22:33] +S2[diagind(S2)] .= x[22:33] S2[10, 11] = x[34]; S2[11, 10] = x[34] S2[10, 12] = x[35]; S2[12, 10] = x[35] S2[12, 11] = x[36]; S2[11, 12] = x[36]