Generation

generate functionMon, 10 Apr 2023

@Override public MatrizL add(MatrizL m) { Preconditions.checkArgument(this.nf()==m.nf() && this.nc()==m.nc(), "El numero de filas y columnas de las matrices tienen que ser iguales."); List<List<Long>> matriz = new ArrayList<>(); for (int i=0;i<this.datos.size();i++) { List<Long> fila = new ArrayList<>(); for (int j=0; j<this.datos.get(i).size();j++) { fila.add(this.get(i, j)+m.get(i,j)); } matriz.add(fila); } return MatrizL2.ofI(matriz); } implementacion funcional

matriz.stream().map(fila -> fila.stream().mapToLong(n -> n).sum()).reduce(0, (a,b) -> a+b)

Want to kickstart your project?Use the new AI Studio to create your code