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
-
2
votes1
answer69
viewsimage processing (KNN classifier) - python
When using Kneighborsclassifier, I am getting the following error: /Feature Extraction (Python)/KNNpy:58: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please…
-
2
votes1
answer55
viewsDoubt about pointer and matrix
Hello, I was trying to do an exercise in which you asked to print the address of each position of the matrix using pointer and I am in doubt if it is correct. I searched some videos on youtube and…
-
2
votes3
answers745
viewsReturn the positions of the largest number in a matrix
I need a code that returns the position of the largest element of the matrix, and if this element repeats, the code returns all positions that this largest element appears. Below, in my code, I can…
-
2
votes2
answers141
viewsPython value and reference
Disregarding the way it was made, this is a square matrix transposition code, the person who did came across the error in assigning the values in the latter for and neither I or he could solve: when…
-
2
votes1
answer56
viewsI have trouble printing the output of a string array
Code: #include <stdio.h> #include <string.h> int main() { int i, j, k; char nomes[10][99]; for (j = 0; j < 2; j++) { printf("\nTurma %d:\n", j+1); for (i = 0; i < 10; i++) {…
-
2
votes0
answers37
viewslist, delete, or insert, select array in mips
I have some questions about an academic paper in which the teacher asks to list, delete, insert and select matrices. If someone could explain to me how to do thank you, follows down the slides of…
-
1
votes1
answer216
viewsJava permeability
I’m having some difficulty solving a recursive problem, which I explain below. Given an array of n rows and columns, check for permeability, i.e., having the following matrix (where '*' - represents…
-
1
votes3
answers517
viewsComparing matrices of different sizes in R
I have the following situation : all_sec = Matrix of all possible assets in a portfolio all_sec <- matrix(c("SEC1","SEC2","SEC3","SEC4","SEC5"),ncol=1) portfolio <- composition of a portfolio…
-
1
votes1
answer96
viewsProblem attaching value to Python 2 matrix
The problem is in matrix.append([(x+1), vectorY[x][1]]). No matter how much vextor[x][1] is different from (x+1), when added you will receive the same value as (x+1), leaving a matrix with two equal…
-
1
votes1
answer3080
viewsHow to use for each in array of arrays(array)?
Having the array of arrays: int matriz[][] = new int[1][1] How do I use for each (for(int Count : array)) to traverse your rows and columns?
-
1
votes1
answer756
viewsChanging integer array to image filter
I’m making a program that applies filters to images .ppm, images without any encoding, the problem is that when I apply the filters, the original image is not changing, where is my error? The same…
-
1
votes2
answers344
viewsHow to make a matrix in R that its inputs are equal to i * j?
I want a Generic matrix 10x10, that their entries are equal to i*j, where i is the column and j the line
-
1
votes1
answer1714
viewsHow to create a vector that displays the frequency of each element in a matrix?
"Write a method frequency which receives data from a matrix A that has integers between 0 and x; generates a vector with the occurrences of each integer between 0 and x. Write a method greater that…
-
1
votes2
answers241
viewsExtensive matrix makes the program stop working
I have the following problem, when I define a matrix that is very large, for example: int matriz[2000][2000], compile and run, the program stops working. I tested only on Windows and it appears that…
-
1
votes1
answer65
viewsSet an analytic function in python
I need to do some operations with matrices (very large), but the elements of it are analytical functions. There is a way to do this in Python? Ex: Matrix = [[x**2+3x,x+y+1]...[...].....[...]]…
-
1
votes2
answers355
viewsCreate 3x3 array using Imageviews - SWIFT
How do I programmatically create a 3x3 matrix composed of 9 Imageviews ?
-
1
votes2
answers1044
viewsHow to invert the values of the main diagonal of a 5x5 matrix?
Input example: 1 3 6 8 7 3 7 8 0 3 2 4 3 6 7 8 9 1 3 5 5 6 7 8 5 Output example: 5 3 6 8 7 3 3 8 9 3 2 4 3 6 7 8 0 1 7 5 5 6 7 8 1 I have so far this: BufferedReader in = new BufferedReader(new…
-
1
votes1
answer228
viewsHow to receive a value and store it in the position indicated by the user in an array of arrays (matrix)?
I did it this way: int matriz[][] = new int[numLinhas][numColunas]; //FOR PARA RECEBER OS VALORES E POSIÇÕES INFORMADAS PELO USUÁRIO for(int x=0; x<numLinhas; x++) { valor =…
-
1
votes1
answer583
viewsCopia de Vetores
good night! I have a question about how to copy a vector. I declared a "matrix [a][j]" vector and I need to take the arithmetic mean only from the values contained in "matrix[a]", so I need to make…
-
1
votes2
answers5027
viewsProduct of Matrices
I am trying to create a method that returns the product of two matrices passed as parameter. The method is working only for square matrices and not for two 2x3 and 3x2 matrices, for example. If…
-
1
votes2
answers94
viewsOrganize Results Kalman Filter in a Matrix
simple question: With the code below I estimate Kalman Filter with an AR component(1). The goal is to exit the vector k_fk. When I have only one vector it is simple. But I need to run the same code…
-
1
votes1
answer213
viewsC - Is it possible to insert a matrix into a structure?
A question that came to me a few days ago, was whether it is possible to insert a matrix into a structure, I think so, but on the road of doubts I decided to clarify. EXAMPLE typedef struct…
-
1
votes2
answers260
viewsHow to check the 4 vertical and horizontal elements in a matrix based on the current position?
Let’s assume I have a matrix this way: $matrix = [[0, 1, 1, 0], [1, 1, 1, 0], [1, 0, 0, 0]]; Imagine that you are making a loop and capturing the position of this matrix as the example below, being…
-
1
votes1
answer1141
viewsVariable with multiple lists for matrix
Good night. I have a text file where I have already converted your content to lists. Each line in the file has become a list[], but now I need these lists to be all within an array. This way I can’t…
-
1
votes4
answers8205
viewsHow to get the highest value of a python array / vector?
how do I get the highest value of a matrix or vector? For example, in this exercise I have to make a 4x4 matrix and return to row and column of the largest element, but I stopped there. m = [] for i…
-
1
votes1
answer119
viewsError reading and comparing matrix numbers
The program must read a number and compare with the numbers of any 3x3 matrix if the number belongs to a column of the matrix it must print the position, when type 1 it prints two positions, but 1…
-
1
votes1
answer597
viewsReplace matrix value (R)
I need to replace the value that appears on the main diagonal of my matrix with another, how to proceed?
-
1
votes0
answers153
viewsInverse matrix in block form
I have a 1 shape matrix (X and U are square): | X Y | | Z U | Which is the inverse of the matrix (which I don’t know) (A and D are square): | A B | | C D | I’m trying to get the inverse matrix of…
-
1
votes0
answers56
viewsHow to return the difference of a C# matrix without using LINQ?
I have a matrix A and B: Method: public static int[] RetornaDiferenca(int[] a, int[] b) {... } Calling the method: RetornaDiferença(new int[] {1, 2, 2}, new int[] {2}) The result would have to be:…
-
1
votes1
answer96
viewsProblem in assembling a C matrix
I have a problem with a matrix that I set up to be typed letters and these transformed into ascii table numbers, but it doesn’t print Where am I wrong? Someone can help me? #include <stdio.h>…
-
1
votes1
answer760
viewsArrays and Pointers
Hello, how do I point to a multidimensional matrix? I know that to do this with a vector (one-dimensional matrix), it’s like this: int v[5]; int *ptr = v; I understand that very well, but with a…
-
1
votes3
answers196
viewsIs it possible to store values without using static vectors?
I need to create a sparse matrix of the cross-dynamic list type and my cells are the type: typedef struct CELULA{ int linha; int coluna; double valor; }CELULA; But every time I create a new cell in…
-
1
votes1
answer1943
viewsHow to print a table-shaped array in nodejs on the console?
How do I get the same output from this matrix, written in Java, on Nodejs? public class Matriz { public static void main(String[] args) { int[][] m = new int[4][4]; for (int i = 0; i < m.length ;…
-
1
votes2
answers1540
viewsTransforming vectors into a Matrix
I have several signals, where S1, s2 until Sn, are vectors of size n, I would like to unite them in a matrix to stay as follows: matriz = ( [s1] [s2] ... [sn] ) So that I can access an element at…
-
1
votes2
answers675
viewsHow to multiply the number of lists by an integer?
If I have an input integer and an input list, it is possible to multiply the integer by the list? M = int(input()) C = (eval('[' + input() + ']')) That is, to have '’M'' lists according to the…
-
1
votes1
answer511
viewsProduct of nasm matrices
I have to make an algorithm that will multiply a matrix A by a matrix B and put the result into a third matrix. The matrices are square, of same size and will be passed by reference by another…
-
1
votes1
answer131
viewsOutput of largest matrix value exiting incorrect
The code does not print the highest value of the matrix informed by the user #include<stdio.h> #include<locale.h> int main(void){ setlocale(LC_ALL, ""); int n, m, o=0, posic, posic1; int…
-
1
votes2
answers392
viewsArray sum storage in vector
This function I created needs to calculate the summing up of each column of the matrix and store in a vector position. However, it is not giving the desired result, I think it may be within the…
-
1
votes1
answer165
viewsWhat does "sort an array" mean, either by rows or columns?
What it means to "sort an array", whether by rows or columns?
-
1
votes1
answer97
viewsMatrix initialization error
I don’t understand this error in the matrix. #include<stdio.h> #include<stdlib.h> #include<math.h> #define MAX 800 int main () { float ponto[MAX][MAX]; float i, j, n, y, x, aux_st,…
-
1
votes3
answers77
viewsFind an index of a value in a matrix
I’m looking for a matrix index for a value: List<string> list = new List<string>() { "Leão", "Guepardo", "Elefante" }; String[] array = new String[3] { "Leão", "Guepardo", "Elefante" };…
-
1
votes2
answers424
viewsCompare char in a matrix function
I’m playing an old game and I need to compare the positions if they’re equal to check the winner, but it’s not working. Here is the code: #include <stdio.h> #include <string.h> void…
-
1
votes1
answer79
viewsExecution time of arrow problem
I’m looking to solve a programming problem. The statement is here: http://olimpiada.ic.unicamp.br/pratique/programacao/nivel1/2014f1p1_setas I made a code, but at the time of sending gives problem…
-
1
votes1
answer276
viewsHow to represent a matrix in Prolog?
I am doing a work on Prolog that consists basically of a search problem, there is a scenario in a two-dimensional environment and one must trace the path that one character must follow to get to the…
-
1
votes1
answer52
viewsJava Array: no value received
I’m having a little problem regarding a matrix I’m trying to develop to get coordinates inside a JFrame and pass them to position the buttons correctly. Follow the code: public class Coordenadas {…
-
1
votes1
answer1063
viewsHow to create a sub-matrix from an array in Python?
I managed to generate a matrix via Python and through this generated matrix I had to generate a 3x3 matrix. But I don’t know how to do this, I was researching and I know that Python himself has a…
-
1
votes1
answer924
viewsHow to make one matrix run inside another using functions?
I have two functions, one belongs to a 10x10 matrix and the other to a 3x3 matrix. I need to make the 3x3 matrix run inside the 10x10 matrix. How do I do that? From now on I thank anyone who can…
-
1
votes0
answers47
viewsHow to create sublists by obeying the cell connection in a matrix
Friends, I am trying to create sublists from a matrix to segment cells that are connected, such as the matrix below: From this matrix I get this list with the painted cells: lista = [[1, 1], [2, 1],…
-
1
votes1
answer692
views -
1
votes1
answer64
viewsModify >= 2D array using pointers
I would like to modify my matrix ( multiplying by 2 each of its elements) using pointers, but I don’t know why my code isn’t working... #include<stdio.h> void changematrix(int **mm,int row,…