public Matrix3D minus(Matrix3D B) {
        Matrix3D A = this;
        if (B.M != A.M || B.N != A.N || B.K != A.K) throw new RuntimeException("Illegal matrix dimensions.");
        Matrix3D C = new Matrix3D(M, N, K);
        for (int i = 0; i < M; i++)
            for (int j = 0; j < N; j++)
            	for (int l = 0; l < K; l++)
            		C.data[i][j][l] = A.data[i][j][l] - B.data[i][j][l];
        return C;
    }