Questions tagged as 'matrices'

2
answers

Problem with chess exercise in java

The objective of the program is to print a chessboard, with squares B (white) and N (black), ask for a row and a column and establish a bishop there. So far so good, but the problem comes when you have to modify the board with asterisks in th...
asked by 08.11.2016 / 19:48
1
answer

Python: 'numpy.int32' object is not iterable

I'm constantly having this error and I do not know how to fix it. This is the code: import numpy as np import itertools import random g_row=10 g_col=10 m_prob = np.ones((g_row, g_col), dtype=np.int) s_acomulada = list(itertools.accumulat...
asked by 26.05.2018 / 02:26
2
answers

Fill part of a matrix with a circle shape

My question is how I could create a circle within a matrix. Let me explain: Imagine a 1000x1000 matrix, filled with 0. I already have the necessary code to create rectangles and diamonds (fill in 1 the necessary boxes with that shape). But my...
asked by 09.04.2018 / 19:57
1
answer

How to remove specific elements within a matrix in Python?

I did not know how to be more specific in the title, but the problem is that I'm doing a code for the problem of isomorphism of subgraphs (quite basic the truth), and I have a problem, I need to "decompose" a matrix, with this I mean the followi...
asked by 02.05.2018 / 18:44
1
answer

error in switch case [error] jump to case label [-fpermisive]

I am implementing this code which is to project the vowels using a matrix and to identify if a word or phrase is palindrome. Everything was fine until I made a mistake in the exit option #include <iostream> #include <stdlib.h> #...
asked by 26.08.2017 / 16:37
2
answers

Convert String to matrix

I have this string in Java String str = "a, b, c, d, e, f, g, h, i, j, k, l, m, , n, o, p"; And I need to convert it into a matrix where the rows and columns are specified. That is: 3 by 3 a b c d e f g h i O 2 for 8 a b...
asked by 01.04.2018 / 08:24
1
answer

Help with matrix in C #

I am learning C# on my own and I have tried to make an array from other array but it tells me the following:    A nested Array initializer is expected This is the code: string[] a = {"pequeña","mediana","grande"}; string...
asked by 13.04.2018 / 21:57
3
answers

Identify isolated regions in a matrix (error in some special cases)

I need to separate the different regions or "islands" formed by 1s within a matrix of any dimension. My example seemed to work correctly but there is some "special" case like the next one that does not work well. It should detect 2 elements o...
asked by 05.12.2017 / 10:03
1
answer

like reading a txt file in java and passing it to an array

I have the following code in java to read a txt file // recibe la dirección del archivo public String leerTxt (String direccion){ String texto=""; try { BufferedReader bf= new BufferedReader(new FileR...
asked by 05.05.2017 / 00:35
3
answers

Help with matrix in c ++

Could you help me modify this code? I spent the whole morning trying to make it comply with this statement:    Create a bidimensional matrix or array containing four (04) columns and the rows that you indicate by keyboard, the first three...
asked by 13.07.2017 / 01:09