Most voted "matrix" questions
An array is a collection of variables of the same type, accessible with a single name and stored contiguously in memory. The individualization of each variable of a vector is done through the use of indexes. Vectors are matrices of a single dimension.
Learn more…508 questions
Sort by count of
-
1
votes2
answers123
viewsHow to make an associative matrix in python 3?
I have a code that asks for a matrix 8x8, but I need in the input He asks for the values like this: matriz [A][1]: matriz [A][2]: That is, he asks for the line in letter form and the column in…
-
1
votes2
answers374
viewsSUMS with reference within the array
I would like to use the following formula:: =SUM(SUMS(A:A;B:B;{"car";"bicycle"})) It turns out that I do not want to leave the criteria "car" and "bike" fixed, I would like to put in there a…
-
1
votes3
answers2758
viewsHow to print without line break in Python
matriz = [] def create_matriz(a, b): for contador in range(a): matriz.append( [0] * b ) def print_matriz(txt): cont = 0 for j in range(a): for i in range(b): if txt[cont] == "0": matriz[i][j] = 0…
-
1
votes1
answer125
viewsWhat is the difference between char (*ptr)[20] and char *ptr[20]?
I’m studying pointers and came across these statements, but I couldn’t understand it very well. Could you help me? Thank you.
-
1
votes2
answers905
viewscheck symmetrical matrix
The exercise asks you to make a function that checks whether a matrix is symmetric. Rows and columns are respectively the variables i and j the program always returns true, but I don’t know what’s…
-
1
votes2
answers94
viewsHow to omit char matrix size in the function?
I have a question now, I have a function implemented this way: mostrarMensagem(char msg[10]) { //aqui faço algo com a variável "msg". } however I do not know the size I will receive as real…
-
1
votes2
answers1578
viewsHow to change position of all matrix elements by changing the row number by the column?
I tried this algorithm but the result is the same after this exchange int[,] array = new int[10,10]; for (int l = 0; l < 10; l++) for (int c = 0; c < 10; c++) { int temp = array[l, c];…
-
1
votes2
answers78
viewsHow to assemble a matrix in R being the values the subtraction of values of a vector
How to create an array in R, whose values are the result of a subtraction of values from a vector? ex.: Vector x <- c(a, b, c) Matrix 1 a-a a-b a-c 2 b-a b-b b-c 3 c-a b-b c-c…
-
1
votes1
answer127
viewsMatrix error as function parameter
Good night. I have a problem using an array as a parameter in my functions. I have in a function that has an int matrix as parameter, when I call the matrix step an original matrix, and in the…
-
1
votes2
answers91
viewsIs it possible to assign the first column of a row of a/a vector/matrix?
taking as an example a two-dimensional vector of the type char 2x2: char vet[2][2]; Is it possible to assign to the first line indices of this vector? or they work like a pointer to the other rows…
-
1
votes1
answer151
viewsDynamic matrix in C#
What would be the best way to create a dynamic square matrix ? An array that increases row and column as elements appear to be inserted into the matrix I found some comments on the internet saying…
-
1
votes1
answer59
viewsDoubt with matrix in Python
I have the following code: matrix = [[0 for x in range(2)] for y in range(10)] I’m trying to implement this in another language, in which there is no such structure above for matrix creation. I…
-
1
votes1
answer656
viewsassignment to Expression with array type
I’m having an error when associating an array address on a pointer to struct, I’m getting a type error: assignment to Expression with array type The code I’m using is this: struct MaxHeap { int…
-
1
votes5
answers3780
viewsI want to know how many rows and columns an array has in Python?
I am trying to develop an exercise that requires the creation of a function that when it receives as a parameter an array, it returns the number of row and column that this matrix has. I’m trying to…
-
1
votes1
answer171
viewsCan anyone help me assign value to the positions of this matrix with pointers?
Hello, I am doubtful about the following code, it creates a two-dimensional matrix using pointers, the command line that should assign specific value to each position of the matrix seems not to…
-
1
votes1
answer303
viewsHow to make a pointer point to NULL?
I need an element position in a dynamic vector to be empty, so I can check if I can place an element inside it later. However, the compiler does not allow it. Follow my code: MATRIZ_ESPARSA…
-
1
votes1
answer311
viewsdouble free or corruption (out) - Using C++ matrices
I’m writing a class that deals with C++ matrices. However when creating a method to calculate the determinant of a matrix I am bumping into the following error: double free or corruption (out)…
-
1
votes1
answer880
viewsCompute Principal Diagonal Sum of a Javascript Matrix (Node)
I’m trying to calculate the main diagonal of an array in Js, someone could help ? function calcularDiagonal(matriz) { let soma = 0; for(let i = 0; i < matriz.length; i++) { for(let j = 0; j <…
-
1
votes2
answers1152
viewsSquare Matrix in Python 3
My code is printing spaces at the beginning and end of the line, and is giving presentation error (URI issue 1557) Does anyone have a good tip? "Matrix values should be formatted in a…
-
1
votes2
answers177
viewsPrinting of Matrices in Python
I’m starting in python and I need to solve several Python matrix exercises, but I can’t make the right impression. Understanding the Logica of this exercise I can solve the other quiet. Could…
-
1
votes1
answer80
viewsError reading values for a dynamically allocated matrix
Good afternoon, I’m doing some coding to study more about C memory allocation with the malloc function, and I was developing a code to allocate an array and then read values and save it, but it’s…
-
1
votes1
answer1351
viewsAccessing matrix row and swap row by column
Good afternoon friends, I am trying to make an exchange in an array, exchange the values of the first row with the values of the last column. I know that a row of a matrix in C is a vector. I…
-
1
votes0
answers36
viewsSearch for matrix inside another matrix in Js
I wonder if it is possible to identify if a matrix is inside another javascript matrix. For example, if the matrix A is inside B or C inside A. I’m trying to apply the following code: a =…
-
1
votes1
answer1566
viewsSwap rows from an array
Below is my code. I need to exchange line 1 with line 3 and line 2 with line 4. The problem is that the third line is not changing and I don’t find the problem. int matriz[TAM][TAM], n = 0, x = 0, y…
-
1
votes4
answers1234
viewsPython - Calculate transposed matrix
I need to calculate the transposed matrix using the python map function. But, I’m not able to solve. def transp(a): for i in range(2): for j in a: return [a[i][j]] list (map(transp,matrix)) The…
-
1
votes1
answer842
viewsPython, display index of a specific row within the matrix
Dear Gentlemen(as), You could give me a hand. An idea?! --> I am trying to present (print) the index(the line) of the longest interval between the longest and shortest of the rows of a matrix…
-
1
votes2
answers775
viewsHow to sort an Array alphabetically in PHP?
I have an nxm array which I call $tabela. This array has some inside data organized as follows: | Papel1 | Hora1 | Valor1 | Erro | B | | Papel2 | Hora2 | Valor2 | OK_Ok | A | | Papel3 | Hora3 |…
-
1
votes1
answer106
viewsHow can I build a table result using "eventReactive" in Shiny
How can I create a "table result" for each relationship I chose in selectInput "Col" and "Row"? Dinamicaly, for every time you press the 'ok' button'. library(shiny) shinyUI(fluidPage( h4("Give a…
-
1
votes3
answers106
viewsFind the size of the largest sequence of # in an array. JAVA
I’m new to Java and found this problem: Given a character array ('.' or '#'), your task is to specify the the size of the largest contiguous segment (horizontal or vertical) of characters '#' This…
-
1
votes1
answer44
viewsExtract position of values in a matrix in R
I have the following data: numbers <- c(303, 2107, 35000) matriz <- matrix(1:90000, nrow = 300, ncol = 300, byrow=T) I need the position of the values in the matrix. I am trying with the…
-
1
votes1
answer1212
viewsDynamic matrix as parameter in C or C++?
After hours of searching, I didn’t find anything that would answer my question, or I couldn’t understand the answer. I want to create a matrix NxN variable size. I made with pointers,but I want to…
-
1
votes1
answer47
viewsSeparate values from a list of summaries in R
From the previous question How to run a looping in R and store the results of a summary in a vector have as response a list with 20 summaries with values calculated from a specified template. One of…
-
1
votes0
answers39
viewsWhy isn’t the instruction being executed?
I am creating a program that sorts a Matrix of structures, first sorts the rows and goes to each row and organizes it by columns. In the matrix I am using after two cycles the value of (i+1 = 4),…
-
1
votes1
answer135
viewsGraphs - return a pointer to the adjacency matrix
I am implementing a work of Graph Theory that deals with the game Flood-It which is a problem in flooding in Graphs. I’m right at the beginning and implemented the graph structure yet. The structure…
-
1
votes1
answer2674
viewsMatrix multiplication and storing in another matrix?
is a function that receives three integer matrices A, B and C, and two whole n and m representing the number of rows and columns of these matrices. This function shall calculate the multiplication…
-
1
votes1
answer755
viewsRecursively counting sequence of numbers in a C matrix
So I have the following problem: I need to count how many decreasing sequences of numbers there are in a matrix recursively, but it is only considered a sequence if it is completed to number 1. Ex:…
-
1
votes1
answer255
viewsStruct and matrix, how to relate?
I’m doing a code for a college paper and a question has arisen about how to assign values to a matrix of the type struct. struct posicao { int x; int y; }; struct posicao inimigo_val[5][15] = {…
-
1
votes1
answer120
views -
1
votes2
answers209
viewsWhy isn’t the break working?
Enunciation: Read a 5x5 matrix. Also read an X value. The program should do a search for this value in the matrix and, at the end, write the location (row and column) or "not found) message" Code:…
-
1
votes2
answers709
viewsCounting elements from one matrix, storing information in another
Hello, I’m a beginner in python and I’m doing an exercise that consists in reading all the numbers of a matrix and adding in another matrix the numbers existing in the previous one and how often…
-
1
votes1
answer14836
viewsHow to calculate the sum of each row of a matrix in C?
I need to create an algorithm that reads the dimensions of a matrix, read the values to be placed in the matrix, with a vector calculate the sum of the values of each row and print the matrix and…
-
1
votes1
answer165
viewsI can’t fill a matrix
When I put fixed values in the size of the matrix I can fill it, but when I try to capture the values in matrices a message like this appears: The index was outside the matrix boundaries ` int a =…
-
1
votes1
answer82
viewsI am trying to print an array using for in javascript, but it is not displayed correctly
I printed it manually and then tried using a for to carry out the printing, but I happen not to be able to display it properly. let mochila = new Array(); let item1 = ['corda', 2], item2 = ['faca',…
-
1
votes0
answers75
viewsReferencing a specific element of a bidemensional matrix via pointer notation
The C allows treating each row of a matrix of two dimensions considering them as a matrix of one dimension. As we know, one way to reference two-dimensional matrices in the form of C pointers is,…
-
1
votes0
answers92
views -
1
votes1
answer47
viewsHow to place successive matrices in vector
I have the following matrices of 100 elements: int [][]matriz1 = { {0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0},…
-
1
votes0
answers59
viewsGenerate new matrix by removing a particular column and row
I wonder if there is any R function that I can generate a new matrix by deleting a certain column and row. Matriz_1 [,1] [,2] [,3] [,4] [,5] [,6] [1,] 0.0 136.6 123.7 124.3 128.0 123.7 [2,] 136.6…
-
1
votes1
answer55
viewsVariable changes value without apparent reason in C
I’m writing a C code to solve the problem suggested in the Facebook post: https://www.facebook.com/groups/414761988665865/permalink/1390954547713266/ Can someone explain to me why you changed the…
-
1
votes1
answer68
viewsProblem with adjacency matrix
I’m having a hard time printing the data from an array, I believe I’m saving the data the wrong way, so you notice the data was not saved because when I go to print no data comes back that I added,…
-
1
votes1
answer34
viewsLooping in a validation within a matrix
Well, I need to validate typed numbers so that my matrix matriz[5][3] accept only odd numbers, for this I used inside the loops for one do{ }while to have another number typed in case it was…