# \#vector-of-vectors

**URL:** https://discourse.julialang.org/tag/vector-of-vectors/1420.md

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

---

## [Reducing over Point objects](https://discourse.julialang.org/t/reducing-over-point-objects/133540)

<div class="topic-metadata">

**Author:** [@xor0110](https://discourse.julialang.org/u/xor0110)\
**Replies:** 9\
**Last updated:** [November 22, 2025, 10:27am UTC](https://discourse.julialang.org/t/reducing-over-point-objects/133540 "2025-11-22T10:27:25Z")

</div>

Julia has many statistics-computing functions, typically a “reduce” kind of function, that can take either a simple vector, or go over an array and compute the output over row, columns, etc according to the dims paramete…

---

## [How to best assign values to multiple locations in a Vector of Vectors?](https://discourse.julialang.org/t/how-to-best-assign-values-to-multiple-locations-in-a-vector-of-vectors/118607)

<div class="topic-metadata">

**Author:** [@oscarvdvelde](https://discourse.julialang.org/u/oscarvdvelde)\
**Replies:** 2\
**Last updated:** [August 26, 2024, 4:23am UTC](https://discourse.julialang.org/t/how-to-best-assign-values-to-multiple-locations-in-a-vector-of-vectors/118607 "2024-08-26T04:23:34Z")

</div>

I am looking for an equivalent to myvector\[locations\] .= myvalue for a vector of vectors. It seems that I can assign to one location at a time. Is there a way? myvecvec = \[Int64\[\] for i in 1:10\] myvecvec\[2\] = \[1,2\] # …

---

## [Why is \`getindex\` slower the second time in a vector of vectors?](https://discourse.julialang.org/t/why-is-getindex-slower-the-second-time-in-a-vector-of-vectors/113819)

<div class="topic-metadata">

**Author:** [@alex180500](https://discourse.julialang.org/u/alex180500)\
**Replies:** 7\
**Last updated:** [May 5, 2024, 1:56pm UTC](https://discourse.julialang.org/t/why-is-getindex-slower-the-second-time-in-a-vector-of-vectors/113819 "2024-05-05T13:56:15Z")

</div>

Why is in this function calling the getindex method the second time slower? This function (the smallest working example I could make) is a snippet of a bigger project I’m making on agent based models where I choose a ra…

---

## [Performance issue: Axelrod model of dissemination of culture optimization](https://discourse.julialang.org/t/performance-issue-axelrod-model-of-dissemination-of-culture-optimization/113326)

<div class="topic-metadata">

**Author:** [@alex180500](https://discourse.julialang.org/u/alex180500)\
**Replies:** 6\
**Last updated:** [April 22, 2024, 1:30pm UTC](https://discourse.julialang.org/t/performance-issue-axelrod-model-of-dissemination-of-culture-optimization/113326 "2024-04-22T13:30:40Z")

</div>

Hello! I’m implementing an Agent Based Model (axelrod model of dissemination of culture). Every node has an associated vector of “opinions” (data) on different subjects (number of features is feat). Each step two nodes a…

---

## [How to declare N nested Vectors?](https://discourse.julialang.org/t/how-to-declare-n-nested-vectors/110813)

<div class="topic-metadata">

**Author:** [@chaojin](https://discourse.julialang.org/u/chaojin)\
**Replies:** 15\
**Last updated:** [February 27, 2024, 8:14pm UTC](https://discourse.julialang.org/t/how-to-declare-n-nested-vectors/110813 "2024-02-27T20:14:47Z")

</div>

HI, I want to declare N nested Vectors in Julia. e.g. Vector{Int} Vector{Vector{Int}} ... Vector{Vector{....Vector{Int}...} # N dimensional nested Vector In C++, it can be implemented by using recursive specializatio…

---

## [Vector of vectors non-allocating](https://discourse.julialang.org/t/vector-of-vectors-non-allocating/109762)

<div class="topic-metadata">

**Author:** [@Domenico\_Lahaye](https://discourse.julialang.org/u/Domenico_Lahaye)\
**Replies:** 10\
**Last updated:** [February 8, 2024, 12:28pm UTC](https://discourse.julialang.org/t/vector-of-vectors-non-allocating/109762 "2024-02-08T12:28:11Z")

</div>

How do I make the function that follows non-allocating? function genvec2(N) result = \[zeros(Int64,2) for i=1:N\] for i=1:N result\[i\] = \[2\*i, 2i+1\] end return result end

---

## [Concatenate Vector of Vector with differents length](https://discourse.julialang.org/t/concatenate-vector-of-vector-with-differents-length/109071)

<div class="topic-metadata">

**Author:** [@blociss](https://discourse.julialang.org/u/blociss)\
**Replies:** 8\
**Last updated:** [January 22, 2024, 5:37pm UTC](https://discourse.julialang.org/t/concatenate-vector-of-vector-with-differents-length/109071 "2024-01-22T17:37:01Z")

</div>

Consider the following vector: v = \[ (1, \[\[11, 11, 11\], \[12, 12, 12\]\]), (2, \[\[21, 21, 21\]), (3, \[\[31, 31, 31\], \[32, 32, 32\]\]), (4, \[\[41, 41, 41\]), \] I want to get 4-element Vector{Any}: \[\[11, 11, 11\], …

---

## [Vectors of vectors : Concatenation](https://discourse.julialang.org/t/vectors-of-vectors-concatenation/109061)

<div class="topic-metadata">

**Author:** [@blociss](https://discourse.julialang.org/u/blociss)\
**Replies:** 6\
**Last updated:** [January 21, 2024, 12:00pm UTC](https://discourse.julialang.org/t/vectors-of-vectors-concatenation/109061 "2024-01-21T12:00:54Z")

</div>

Consider this vector v = \[ (1, \[\[11, 11, 11\], \[12, 12, 12\]\]), (2, \[\[21, 21, 21\], \[22, 22, 22\]\]), (3, \[\[31, 31, 31\], \[32, 32, 32\]\]), (4, \[\[41, 41, 41\], \[42, 42, 42\]\]), \] I want to get from v the followin…

---

## [Q: Vector of vectors of variable lengths](https://discourse.julialang.org/t/q-vector-of-vectors-of-variable-lengths/102817)

<div class="topic-metadata">

**Author:** [@Audrius-St](https://discourse.julialang.org/u/Audrius-St)\
**Replies:** 6\
**Last updated:** [August 15, 2023, 6:37pm UTC](https://discourse.julialang.org/t/q-vector-of-vectors-of-variable-lengths/102817 "2023-08-15T18:37:47Z")

</div>

Hello, What is the recommended/best Julia method to create a vector of vectors of variable lengths? Current method MWE: # test\_vector\_of\_vectors.jl begin vec\_of\_vecs = \[Float64\[\] for \_ in 1:3\] for i = 1:3 …

---

## [Converting CartesianIndices to a vector of vectors](https://discourse.julialang.org/t/converting-cartesianindices-to-a-vector-of-vectors/102794)

<div class="topic-metadata">

**Author:** [@Gus\_Hart](https://discourse.julialang.org/u/Gus_Hart)\
**Replies:** 12\
**Last updated:** [August 15, 2023, 1:21am UTC](https://discourse.julialang.org/t/converting-cartesianindices-to-a-vector-of-vectors/102794 "2023-08-15T01:21:02Z")

</div>

I’m using CartesianIndices to generate lists resembling base-k numbers. I want the convert the output into a “flat” vector of vectors, irrespective of the number of “digits” passed to CartesianIndices. The lists will gen…
