# Difference between continuous and binarized vectors

What is the difference between a continuous value vector and its binarized counterpart in higher dimensional space? The answer is 37 degrees on average. Which actually is very close in such spaces (it would be nearly impossible by chance for 2 randomly selected vectors to have such a “small” angle between them.)
https://arxiv.org/pdf/1705.07199.pdf
In other words there is no problem representing continuous value data like images or sound by a suitably processed binary version (simplification) of that data. I presume that is also true with spiking neuron representations.

I checked it using FreeBasic and 37 degrees is what I get:

sub wht(x() as single)
dim as ulongint hs=1,n=ubound(x)+1
dim as single sc=1.0/sqr(n)
while hs<n
var i=0ULL
while i<n
var k=i+hs
while i<k
var a=x(i)
var b=x(i+hs)
x(i)=a+b
x(i+hs)=a-b
i+=1
wend
i=k+hs
wend
hs+=hs
wend
for i as ulongint =0 to n-1
x(i)*=sc
next
end sub

sub hashflip(x() as single, h as ulongint)
const as ulongint PHI= &h9E3779B97F4A7C15ULL
const as ulongint FHI= &h6A09E667F3BCC908ULL
dim as ulongint k,m=ubound(x)
dim as ulong ptr y=cptr(ulong ptr,@x(0))
h*=PHI
for i as ulongint=0 to m
h+=FHI
k=h
k xor= k shr 33
k *= &hff51afd7ed558ccdULL
k xor= k shr 33
k *= &hc4ceb9fe1a85ec53ULL
k xor= k shr 33
dim as ulong t=k
t and=&h80000000
y[i] xor=t
next
end sub

screenres 500,500,32
dim as single test(65535),binarized(65535)
dim as ulong i,j,m=ubound(test)
for j=0 to m:test(j)=1!:next

for i=0 to 999
hashflip(test(),i)
wht(test())
for j=0 to m step 2
var x=test(j)*50
var y=test(j+1)*50
pset (x+250,y+250)
next
dim as single ltest,lbinarized,dotp,c
for j=0 to m
binarized(j)=iif(test(j)>=0!,1!,-1!)
ltest+=test(j)*test(j)
lbinarized+=binarized(j)*binarized(j)
dotp+=binarized(j)*test(j)
next
c=dotp/(sqr(ltest)*sqr(lbinarized))