Questions tagged [submatrix]

A submatrix is a matrix formed by selecting a subset of the rows and columns of one larger matrix. Questions tagged [submatrix] deal with implementation issues regading accessing the relevant rows/columns of the larger matrix, relevant memory issues, etc.

A submatrix is a matrix formed by selecting a subset of the rows and columns of one larger matrix.

For example, let A be a matrix of size n-by-m

A = [ a00 a01 ...
      a10 a11 ...
      .       .
      .        .
      .         .
      an1 an2 ... anm ]

Then one can form a 2-by-3 sub-matrix by selecting rows 2 and 5, and columns 1,4 and 6.
The resulting sub-matrix is then

S = [ a21 a24 a26
      a51 a54 a56 ]

Questions tagged [submatrix] deal with implementation issues regading accessing the relevant rows/columns of the larger matrix, relevant memory issues, etc.

183 questions
0
votes
1 answer

matlab submatrices in loop

I have a 118800x6 matrix. the first column contains values from 1 to 99 (there are 1200 rows for each value). now I need to create a new matrix that contains 900 random rows (all of the previous column; the rows are extracted from the original…
0
votes
2 answers

opencv android java matrix submatrix (ROI Region of Interest)

I've mRgba Matrix and a Rect r (something recognized in the frame) I want a sub-matrix of this part of the frame which is defined by the Rect r. when I use it like this: sub = mRgba.submat(r); I get the right sub-matrix, but I've a problem with the…
ddd
  • 481
  • 6
  • 17
-1
votes
1 answer

Function to calculate average of Sum of all elements in sub-matrix

I want to make a function that take three arguments 2-D array. (int array[rows][cols]) an integer. (int n) address of array[i][j]. Means my function prototype should look like this double Sub_avg(int arr[rows][cols], int n, int…
setller
  • 43
  • 7
-1
votes
3 answers

How to create a sub-matrix in MATLAB

I have this work which I have to do by creating a sub-matrix out of a given data set. I will explain it below. Suppose, I have the data set as: 100 200 300 400 500 600 101 201 301 401 501 601 102 202 302 402 502 602 So, I want to…
MaJoR
  • 954
  • 7
  • 20
-1
votes
1 answer

Maximum sum all prime submatrix

The problem is given in the title. My approach to this problem is like that: Create a binary matrix B where 1s represents the prime numbers in the input let say V, which is nxn non negative integer matrix Find all the positive submatrices including…
Sami
  • 490
  • 6
  • 29
-1
votes
2 answers

Grouping on two columns and performing multiple calculations

I am currently working with a large dataframe which consists of rougly 20 columns and a lot of rows. Simplified it can look like this: letter = c("A", "A", "A", "B", "B", "B", "C", "C", "C", "C", "A", "A", "A", "B", "B", "B", "C") number =…
Paul
  • 1,801
  • 1
  • 12
  • 18
-1
votes
1 answer

Select an element of a Sub matrix

I have a Matrix of 100 sub matrix . Each of this sub matrix have 6 elements (1*6), I need to compute the mean of the first element of each sub matrix then the second, etc Example:…
-1
votes
1 answer

Submatrix by colname

I have a matrix with row and col names and want to reduce it to a submatrix certain row / colnames. The specified names are in a string vector of ~20 values, while the matrix has 55.000 rownames and 805 colnames. How can I do this efficiently in…
El Dude
  • 5,328
  • 11
  • 54
  • 101
-1
votes
1 answer

searching two identical submatrices in a bigger matrix

I need to find two identical submatices in a larger matrix. I am not getting how to approach as first I need to have a submatrice and then to find if its identical is present or not. e.g. (N X M) 4X5 matrix xy*yyx* yx*xyy* x*yyx*y x*xyy*x Identicals…
-1
votes
1 answer

C++ Submatrix from a Multidimensional Vector/Matrix

In MSVS C++ I have a multidimensional vector (matrix). I am not using arrays. For example: vector< vector > image(1056, vector(366)); After data is included in the vector from another source how is it possible to create a sub matrix…
kclausch
  • 43
  • 1
  • 1
  • 3
-2
votes
5 answers

How to extract all K*K submatrix of matrix with or without NumPy?

This is my input: row=6 col=9 6 9 s b k g s y w g f r g y e q j j a s s m s a s z s l e u s q u e h s s s g s f h s s e s g x d r h g y s s s This is my code: r=int(input()) c=int(input()) n=min(r,c) k=3 matrix=[list(map(str,input().split())) for i…
Comrade
  • 29
  • 2
-2
votes
1 answer

Extract sub rows with varying sizes from a big 2D NumPy Array

I have a NumPy Array with size say 3*10, I would like to extract sub rows with varying sizes from each row. The sub rows are centered in the middle pixel with varying pixel sizes. Then I take the average number of each subrow. I have a pseudo…
Huanian Zhang
  • 830
  • 3
  • 16
  • 37
-2
votes
1 answer

extract a submatrix from matrix

How can I extract a submatrix from matrix in python? I have a .mat file that when uploaded to python has a nested array that is something similar to the following but with 12,000 items each: letters= array([[(array([[a],[a],[a]]),…
NEURO
  • 1
  • 1
-2
votes
1 answer

A subset of 3 dimensional matrix in Matlab

Lets assume we have a 3 dimensional matrix A and X_IND = 4:8 and Y_IND = f(X_IND). f is a function like 2*x^2+1. How I can extract following vector out of A: a = A(X_IND,Y_IND,3) However, above equation in MATLAB leads to a matrix while the result…
Roy
  • 65
  • 2
  • 15
  • 40
-2
votes
1 answer

How do I find the sum of every X rows in a matrix in Matlab

I have a 189 x 4914 matrix and am trying to find the sum of each row in each 1x26 sub-matrix. How would I go about this? Many thanks.
1 2 3
12
13