integer valued vector data type

548 Views Asked by At

What is the difference between integer valued and real valued vectors, in the mathematics and programming senses?

For example, since certain binary operations on vectors, such as "angleBetween()" return a real, does that mean that the type of integer valued vectors is somehow smaller than the type of real valued vectors? I'm looking for a formal discussion of how these types differ.

I see that the programming language R (or S) defines an integer vector type.

2

There are 2 best solutions below

5
On

From a programming perspective, the difference between vectors of integers and vectors of floating point numbers is very much the same as the difference between integers and floating point numbers.

Integers are very easy for computers to handle; numbers involving decimals less so. If you were to dig under the hood of your favorite programming language, you'd find that even the most basic operations (addition/subtraction/multiplication/etc.) are handled differently for the two types - they are even stored differently in memory.

In a theoretical context, there is still a massive amount of difference between vectors of integers and vectors of reals. For instance, vectors of integers don't form a vector space - because they are not closed under scalar multiplication by elements in $\mathbb{R}$ (or $\mathbb{C}$). Further, there is a very real sense in which there are "fewer" vectors of integers: even though bouth $\mathbb{Z}$ and $\mathbb{R}$ are infinite, $\mathbb{Z}$ is countably infinite whereas $\mathbb{R}$ is uncountably infinite. The same can be said of $\mathbb{Z}^n$ vs $\mathbb{R}^n$.

0
On

While real-valued vectors of some fixed length form a vector space over the field of real numbers, the integer-valued "vectors" (or tuples) form a $\mathbb{Z}$-module or (equivalently) abelian group.

The notion of a module over a ring is a generalization of the vector space concept. As such we lose some of the nice properties of vector spaces, and in particular "dimension" of a vector space can only partially be extended to the setting of modules.

Another topic which is closely related to this generalization is that of linear transformations (for vectors spaces) versus module homomorphisms. When your specific construction is used (tuples of integers), you get something that is naturally embedded in a vector space and which geometrically is "flat" in the sense of its embedding. The more general $\mathbb{Z}$-module or abelian group will have "wrap around" or torsion components. In any case your construction gives a free $\mathbb{Z}$-module, for which a nice notion of rank (agreeing with the length of "vectors") exists, and which is related to homomorphisms of the free $\mathbb{Z}$-module into itself by the structure theorem for finitely generated modules over a principal ideal domain.

A more specialized context for these integer-valued "vectors" is an integer lattice, which should give you another way to research information about these constructions.