def pro_tensorial(m1,m2): fi1,co1 = len(ma1),len(ma1[0]) fi2,co2 = len(ma2),len(ma2[0]) f = fi1*fi2 c = co1*co2 matres = [[[0,0] for i in range(f)]for j in range (c)] for i in range(0,f): for j in range(0,c): matres[i][j] = com.multiplicacion(m1[i//fi2][j//co2],m2[i%fi2][j%co2]) return matres
def mul_escalar_matriz(e,ma1): resul = [] for i in range(0,len(ma1)): fila = [] for j in range(0,len(ma1[0])): resul = com.multiplicacion(e,m1[i][j]) fila.append(resul) resul.append(fila) return resul
def multiplicacion_mat(ma1,ma2): fi1,co1 = len(ma1),len(ma1[0]) fi2,co2 = len(ma2),len(ma2[0]) if co1 == fi2: matres = [[[0,0] for i in range(co2)]for j in range (fi1)] for i in range (0,fi1): for j in range(0,co2): for k in range (0,co1): matres[i][j] = com.suma(matres[i][j],com.multiplicacion(ma1[i][k],ma2[k][j])) return matres else: return "No es posible multiplicar las matrices"
def accion_ma_ve(ma,ve): fi1,co1 = len(ma),len(ma[0]) fi2,co2 = len(ve),len(ve[0]) if co1 == fi2: matres = [[[0,0] for i in range(fi1)]for j in range (co2)] for i in range (0,fi1): for j in range(0,co2): for k in range (0,co1): matres[i][j] = com.suma(matres[i][j],com.multiplicacion(ma[i][k],ve[k][j])) return matres else: return "No es posible multiplicar las matrices" return res
def mul_escalar_vector(e,v1): resul = [] for i in range(0,len(v1)): resul.append(com.multiplicacion(e,v1[i])) return resul