Is there a name for the number of ones in a binary vector?

1.7k Views Asked by At

I'm creating two types of binary vector. The vectors have $M$ components and either $N$ ones or $(M-N)$ ones.

If you were to take all permutations of these vector types there would be a symmetry in the sets. One set could become the other by swapping the ones for zeroes and the zeroes for ones. For example, you could have the pair:

$$\begin{align}v &= [1, 0, 0, 1, 0, 1, 1] \\[10pt]v' &= [0, 1, 1, 0, 1, 0, 0]\end{align}$$

It feels like there should be a name for this type of a symmetry, and a name for the number of ones or conversely zeroes in the vector. But I can't think of what to search to find out what that name is. For the moment I'm using depth, but that doesn't seem right.

Is there a name for the number of ones in a binary vector, and a name for the symmetry between it and its logical inverse?

Potentially related:

  1. Question on permutation depths. The answer to this questions suggests n-tuples as the correct name.

Edit:

Suggestion:

As there doesn't appear to be a term that fully captures this idea, I suggest one of the following:

  • Symmetric combination depth,
  • Symmetric permutation depth,
  • Symmetric depth,
  • Symmetric hamming weight,
  • Symmetric cardinality
4

There are 4 best solutions below

2
On BEST ANSWER

There is the term Hamming weight: https://en.wikipedia.org/wiki/Hamming_weight

2
On

You can call it the cardinality (or size) of the support. It's typically associated with real-valued functions, but since zero and one are real values, treating this as a special case doesn't sound unreasonable to me. Support itself is a conveniently concise term, but would refer to the positions which are nonzero, not just the count.

For example, assuming one-based indexing your $v=[1,0,0,1,0,1,1]$ has support $S=\{1,4,6,7\}$ since $v_i\neq 0$ for $i\in S$ and the size of that support is $\lvert S\rvert=4$.

1
On

For binary vectors like you have, it's called "population count", Many programming languages have a popcount( ) function (C++), and some microprocessors even have popcnt available as a single instruction (x86).

This is also mentioned as a special case in the Hamming weight article that @Maksim's answer refers to.

Reply to comment: I'm not sure what you mean by "apply to both sides of the symmetry". If it helps, popcount only counts the number of $1$s, not the number of $0$s. If you want the number of zeros, you could let $\operatorname{not}()$ be "bitwise not", and then $$\operatorname{zeros}(v) = \operatorname{popcount}( \operatorname{not}(v))$$

If you want to know how to describe the symmetry, you could say "$\operatorname{not}( )$ provides a bijection between $\{v \mid \operatorname{popcount}(v) = N\}$ and $\{v \mid \operatorname{popcount}(v) =M-N\}$.

0
On

The weight

If the vectors are guaranteed to contain only zero or one, the count of ones is equivalent to the variously-named L1/taxicab/Manhattan norm, all of which are commonly-used terms in computer science and some areas of mathematics. (If we can't guarantee ones or zeros, we have the Hamming weight as described in another answer).

The inverse

The inverted vector you describe is called the one's complement or bitwise NOT, each of which is a commonly used term in computer science.