|
Algorithm 1: Subroutine to encode 0 or a power of 2 |
-
Input:
Value to be encoded , size of a vector D
-
Ensure:
, is 0 or a power of 2 in the range
-
Output:
D-dimensional vector with an encoded value
-
1:
if
then
-
2:
{p: Position of 1}
-
3:
else
-
4:
-
5:
end if
-
6:
for to D
do {}
-
7:
if
then
-
8:
-
9:
else
-
10:
-
11:
end if
-
12:
end for
-
13:
return
|