Python Forum
How many times does it fit? help please
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How many times does it fit? help please
#1
What im trying to do is to check how many times does an 1x1 slice fits in the entire array, i used slice to get array "fragments" but how to check how many times that fragment fits inside the entire array?
the 1x1 fits 64 times, 2x2 16.....
Tablero means board, by uxu i mean 1x1, dxd = 2x2....
import numpy as np

tablero = np.zeros((8,8))
print(tablero)

uxu = tablero[0:1,0:1]
print(uxu)

dxd = tablero [0:2,0:2]
print (dxd)

txt = tablero [0:3,0:3]
print (txt)
Reply
#2
Solved, left the code here if someone would like to see it
Grande=Big
Chica=Small
Filas=Rows
Columnas=Columns
Entra=Fits
Veces=Times
maybe those few word translations will be useful :)
import numpy as np
nGrande = 8
matrizGrande = np.zeros((nGrande,nGrande))
for i in range(1,matrizGrande.shape[0]+1):
    matrizChica = np.zeros((i,i))
    filasMatriz = matrizChica.shape[0]
    columnasMatriz = matrizChica.shape[1]
    entra = matrizGrande.shape[0]//filasMatriz * matrizGrande.shape[0]//columnasMatriz
    print("La Matriz de",str(i)+"x"+str(i)+" entra",entra, "veces en la matriz de",str(matrizGrande.shape[0])+"x"+str(matrizGrande.shape[0]))
Reply
#3
Number of times the small list S[row,col] fits in the Big list A[bRow,bCol] is equal to:
(bRow * bCol)/(row * col)
Hope you get the idea..
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Find how many times a user played an artist and how many times disruptfwd8 1 2,590 May-04-2018, 08:32 AM
Last Post: killerrex

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020