[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Re: how to make a matrix with all combinations of digits efficiently

**From**: |
Juan Pablo Carbajal |

**Subject**: |
Re: how to make a matrix with all combinations of digits efficiently |

**Date**: |
Sat, 30 Dec 2017 18:42:05 +0100 |

>* I just saw that dec2digit(100) produces 0 0 in stead of 1 0 0, so I*
>* changed the function as follows*
>* function digits = dec2digit (num, nc, base = 10)*
>* %nc = ceil (log (num) / log (base));*
>* digits=mod(floor(num./base.^[(nc-1):-1:0]), base);*
a better fix is probably to force rounding up.
function digits = dec2digit (num, base = 10)
nc = floor (log (num) / log (base)) + 1;
digits = mod(floor(num./base.^[(nc-1):-1:0]), base);
endfunction

**how to make a matrix with all combinations of digits efficiently**, *Jean Dubois*, `2017/12/28`
**Re: how to make a matrix with all combinations of digits efficiently**, *Juan Pablo Carbajal*, `2017/12/28`
**Re: how to make a matrix with all combinations of digits efficiently**, *Jean Dubois*, `2017/12/29`
**Re: how to make a matrix with all combinations of digits efficiently**, *Francesco PotortÃ¬*, `2017/12/29`
**Re: how to make a matrix with all combinations of digits efficiently**, *Jean Dubois*, `2017/12/29`
**Re: how to make a matrix with all combinations of digits efficiently**, *Francesco PotortÃ¬*, `2017/12/29`
**Re: how to make a matrix with all combinations of digits efficiently**, *Juan Pablo Carbajal*, `2017/12/29`
**Re: how to make a matrix with all combinations of digits efficiently**, *Jean Dubois*, `2017/12/30`
**Re: how to make a matrix with all combinations of digits efficiently**, *Jean Dubois*, `2017/12/30`
**Re: how to make a matrix with all combinations of digits efficiently**,
*Juan Pablo Carbajal* **<=**
**Re: how to make a matrix with all combinations of digits efficiently**, *Juan Pablo Carbajal*, `2017/12/30`