enthought / enthought/distarray
Independent test of grid factoring methods.
- Lenguaje dominante
- Python
- Estrellas
- 5
- Forks
- 1
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
To address #258, we are making changes to allow 1 values in grid_shape. Previously, we had two methods for computing the factors, I think one slow but simpler, and one fast and more subtle. Only the second one of these is surviving the refactor for this, as the first is effectively unused code. But, the deprecated method being removed might be useful as an independent test of the factorization method that we do use. This deprecated method proved difficult to adapt to allowing the 1 values, which also argued for its removal.
But in case this alternate method is later useful for testing, I note the code used here, so it is not lost track of.
```
def test_both_methods(self):
"""
Do the two methods of computing the multiplicative partitions agree?
"""
for s in [2, 3]:
for n in range(2, 512):
self.assertEqual(utils.mult_partitions(n, s),
utils.create_factors(n, s))
def divisors(n):
i = 2
while i>> mult_partitions(52,3)
[(2, 2, 13)]
>>> mult_partitions(52,2)
[(2, 26), (4, 13)]
"""
return [tuple(flatten(p)) for p in mult_partitions_recurs(n,s)]
def mult_partitions_recurs(n, s, pd=1):
if s == 1:
return [n]
divs = divisors_minmax(n, pd, int(sqrt(n)))
fs = []
for d in divs:
fs.extend([(d,f) for f in mult_partitions_recurs(n/d, s-1, pd)])
pd = d
return fs
```
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Línea de trabajo
Comienza localizando la implementación actual de multiplicative-partition y comprobando si los helpers create_factors obsoletos siguen presentes después del refactor de grid_shape. Compara los dos enfoques descritos en el issue y, a continuación, determina si una prueba independiente puede cubrir el método que permanece, incluidas las formas de grid que contienen valores 1; se considera terminado cuando la prueba es útil y pasa para los casos compatibles.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- python
- Área
- testing-qa
- Tipo de issue
- Refactorización
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 25/100