# V = \[1,2,3\]; v .== v' returns boolean matrix?

**URL:** <https://discourse.julialang.org/t/v-1-2-3-v-v-returns-boolean-matrix/7707>\
**Category:** General Usage\
**Created:** [December 12, 2017, 1:30pm UTC](https://discourse.julialang.org/t/v-1-2-3-v-v-returns-boolean-matrix/7707 "2017-12-12T13:30:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![e3c6](https://avatars.discourse-cdn.com/v4/letter/e/e79b87/32.png) [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Post date:** [December 12, 2017, 1:30pm UTC](https://discourse.julialang.org/t/v-1-2-3-v-v-returns-boolean-matrix/7707/1 "2017-12-12T13:30:19Z")

</div>

I find this a bit weird.

```julia
julia> v = [1,2,3]; v .== v'
3×3 BitArray{2}:
  true false false
 false true false
 false false true

```

Why this returns a matrix? I’d expect a simple vector.

---

<div class="post-metadata">

**Author:** ![mschauer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mschauer/32/13946_2.png) [@mschauer](https://discourse.julialang.org/u/mschauer)\
**Post date:** [December 12, 2017, 1:39pm UTC](https://discourse.julialang.org/t/v-1-2-3-v-v-returns-boolean-matrix/7707/2 "2017-12-12T13:39:53Z")

</div>

The interplay between column and row vectors under broadcasting corresponds to that of nx1 and 1xn arrays. Both arrays get padded to an nxn matrix by repeating columns, respective rows:

```julia
julia> v2 = [1 2 3]; v1 = v2'; v1 .== v2
3×3 BitArray{2}:
  true false false
 false true false
 false false true

```

---

<div class="post-metadata">

**Author:** ![StefanKarpinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefankarpinski/32/24_2.png) [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)\
**Post date:** [December 12, 2017, 2:28pm UTC](https://discourse.julialang.org/t/v-1-2-3-v-v-returns-boolean-matrix/7707/3 "2017-12-12T14:28:15Z")

</div>

Out of curiosity, and potentially for the sake of improving our documentation, why did you expect a vector?

---

<div class="post-metadata">

**Author:** ![e3c6](https://avatars.discourse-cdn.com/v4/letter/e/e79b87/32.png) [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Post date:** [December 12, 2017, 2:46pm UTC](https://discourse.julialang.org/t/v-1-2-3-v-v-returns-boolean-matrix/7707/4 "2017-12-12T14:46:26Z")

</div>

I somehow had the (wrong) assumption that `broadcast` always returned an object whose dimensions matched the dimensions of the at least one of its arguments. Also, I had not been exposed to the new `RowVector`. These two things confused me, but this example cleared that up.

Perhaps an example in the docs for broadcast using RowVector could help.
