6
$\begingroup$

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
$\endgroup$
4
  • 1
    $\begingroup$ I'm not sure if there are official terms for either of these contexts. From a CS background the bit flipping would be called the "two's complement" relationship and is used for negating numbers, so perhaps you could call this just simply negation. As for the number of ones in the vector, I would call it the sum, or the weight. $\endgroup$
    – Pavan C.
    Commented Mar 18, 2023 at 21:52
  • $\begingroup$ We have questions about calculating this on SO, eg stackoverflow.com/q/109023/4014959 $\endgroup$
    – PM 2Ring
    Commented Mar 19, 2023 at 7:47
  • 2
    $\begingroup$ @PavanC. - Not quite. To negate a number in two's complement, you flip the bits, and then add $1$. $\endgroup$
    – JonathanZ
    Commented Mar 19, 2023 at 8:04
  • 2
    $\begingroup$ @PavanC. Just inverting the bits is used in ones' complement. $\endgroup$
    – Bavi_H
    Commented Mar 20, 2023 at 6:51

4 Answers 4

28
$\begingroup$

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

$\endgroup$
2
  • $\begingroup$ Thank you! Is there a name for the logical inverse of the hamming weight? Or a name for the two things together? $\endgroup$
    – Connor
    Commented Mar 18, 2023 at 22:05
  • 7
    $\begingroup$ Very commonly referred to, at least in computer science, as 'zero norm' (despite not being a norm). It gives rise to a valid distance, the Hamming distance $\endgroup$
    – Oly
    Commented Mar 19, 2023 at 10:58
13
$\begingroup$

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\}$.

$\endgroup$
1
  • $\begingroup$ Does this apply to both sides of the symmetry? $\endgroup$
    – Connor
    Commented Mar 19, 2023 at 10:01
6
$\begingroup$

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.

$\endgroup$
5
$\begingroup$

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$.

$\endgroup$
2
  • $\begingroup$ What does "the positions that are nonzero" mean in this case? Wouldn't that mean the only zero position is $v = [0, 0, 0, ..., 0]$? $\endgroup$
    – Connor
    Commented Mar 18, 2023 at 22:07
  • 2
    $\begingroup$ @Connor I've added an example, hope that helps. $\endgroup$
    – MvG
    Commented Mar 18, 2023 at 22:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .