granit77: Shift into the positive region by 2 units to remove 0 and -1 (followed by restoration after reading) and you can easily form an integer.
It is possible to write their indexes instead of numbers themselves, then any numbers can be generated. The main thing is not to exceed 10... Although on closer examination no more than 36 at least.
Alternatively, you can use data repetition (like in image compression). Or, you can write different values to the same memory space. You may save on indexes by giving one name to all sorts of stuff. You may even create such a service - it would be in demand :)
I want to store data compactly - one line, one integer
It won't work. It takes 3 bits to encode 6 values. The integer has 32 bits, you need 36 bits to encode 12 numbers.
The question is why you need compact storage. Most likely the end goal is different and achievable in a different way.
It won't work. It takes 3 bits to encode 6 values. The integer has 32 bits, you need 36 to encode 12 numbers.
Well... as an option.
Shift into the positive region by 2 units to remove 0 and -1 (followed by restoration after reading) and you can easily form an integer.
Alternatively, you can use data repetition (like in image compression). Or, you can write different values to the same memory space. You may save on indexes by giving one name to all sorts of stuff. You may even create such a service - it would be in demand :)
| 4,4,1,2,1,1, 1,1,1,1,1,1 |
| 3,3,3,3,3,3, -1,-1,-1,-1,-1,-1|
I want to compactly store data - one line, one integer
Change to pentameter notation where I can convert a string of numbers to one. For binary, I had functions ready to use
Switch to a pentatonic number system where you can convert a string of numbers into one. For binary, I had ready-made functions
I've already thought about this, there is no ready-made matrix to store several 5-digit numbers in one int?
It doesn't take long to make one. Both for encoding and decoding
The following formula can be used for coding
{a1,a2,a3,a4,a5}
N=a1*5^4+a2*5^3+a3*5^2+a4*5^1+a5*5^0;
The decoding is a bit more complicated. But if we go to a loop, there is no problem with both
a5=N%5;
N=(N-a5)/5;
a4=N%5;
N=(N-a4)/5;
a3=N%5;
N=(N-a3)/5;
a2=N%5;
a1=(N-a2)/5;
I can't even formulate a query for a search engine :(((
I want to do some kind of comparison of similarity? correlation? several matrices with numerical data.
like this:
matrix1: matrix2:
| 4,4,1,2,1,1, 1,1,1,1,1,1 | | 4,4,1,2,1,1, 1,1,1,1,1,1 |
| 4,4,1,2,1,1, 1,1,1,1,1,1 | | 4,4,1,1,1,1, 1,1,1,1,1,1 |
| 4,4,4,2,1,1, 1,1,1,1,1,1 | | 4,4,4,2,1,1, 1,2,1,1,1,1 |
the given matrices have minimal differences, how can this be analysed programmatically?
I can't even formulate a query for a search engine :(((
I want to do some kind of comparison of similarity? correlation? several matrices with numerical data.
like this:
matrix1: matrix2:
| 4,4,1,2,1,1, 1,1,1,1,1,1 | | 4,4,1,2,1,1, 1,1,1,1,1,1 |
| 4,4,1,2,1,1, 1,1,1,1,1,1 | | 4,4,1,1,1,1, 1,1,1,1,1,1 |
| 4,4,4,2,1,1, 1,1,1,1,1,1 | | 4,4,4,2,1,1, 1,2,1,1,1,1 |
the given matrices have minimal differences, how can this be analysed programmatically?
if if and if again. I would start with a1a1