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
2 answers

Submatrix Ocaml

let moja_matrika1 = [[1; 2]; [3; 4]];; let moja_matrika2 = [[4; 7; 8]; [3; 2; 1]];; let rec does_it_contain (lis1, lis2) = if (List.hd lis1 = []) then false else if (List.hd lis1 = lis2) then true else does_it_contain ((List.tl lis1),…
Broda
  • 15
  • 7
0
votes
1 answer

Grundy Number For a Matrix

How to calculate the Grundy number for states of a 4*4 matrix. A valid move consists of transforming the 1s into 0s of a submatrix having all 1s. Example: 1010 0011 0000 0000 Grundy Number = 2 I checked for smaller cases and calculated the Grundy…
Deepak
  • 45
  • 1
  • 8
0
votes
1 answer

Submatrix / vector contingent on values in array

I have a 3D matrix A of size 20x500x68. I have two vectors carrying information regarding this matrix which are: B (containing zeros and ones) of size 1x68 and C (containing numbers from 1 to 3) of size 1x68 (in length both B and C correspond to…
C_Hut
  • 31
  • 8
0
votes
1 answer

Algorithm - Grid Map find number of sub-blocks with specific property

I have a grid map NxN. Each cell may have the value '0' or '1'. I am trying to find the exact number of distinct rectangle sub-blocks of the map that include a specific number of '1' and this number can be between 1 and 6. I have thought of…
chris k.
  • 13
  • 5
0
votes
4 answers

How to extract dimension of a submatrix from a bigger matrix using R?

I have the following matrix: [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 0 0 0 0 0 0 0 0 0 0 [2,] 0 0 0 0 0 0 0 0 0 0 [3,] 0 0 0 0 0 0 0 0 …
0
votes
1 answer

Fast averaging of 3D sub matrices in Matlab

Let the size of my matrix A is sx x sy x sz. I want to get a matrix B (with the same size as A) where the element of B at (x,y,z) represents the average of the n x n x n submatrix extracted from the same position at A. How can I do it? I know I can…
user570593
  • 3,420
  • 12
  • 56
  • 91
0
votes
1 answer

Determine all square sub matrices of a given NxN matrix in C++

GIven an NxN square matrix, I would like to determine all possible square sub matrices by removing equal number of rows and columns. In order to determine all possible 2x2 matrices I need to loop 4 times. Similarly for 3x3 matrices I need to loop 6…
Vineel
  • 436
  • 6
  • 12
0
votes
1 answer

"Submatrix incorrectly defined" when trying to decrease color depth of greyscale images

I'm trying to make Scilab receive a certain JPEG image then transform it into a matrix of values between 0 and 255 (normal 8bit depth image) and then rearrange those values into smaller depths. The proposal is to make all the options from 1bit to…
0
votes
2 answers

createing sub matrix/dataframe R

Question about dataframe manipulations. not HW, although I will phrase it as a HW problem. I know there is a 3 line way of doing this but I can't seem to find it. Problem I have a dataframe A with 10 columns and a thousand rows, it's filled with…
OctaveParango
  • 113
  • 1
  • 14
0
votes
1 answer

Rcpp Armadillo, submatrices and subvectors

I try to translate some R code into RcppArmadillo and therefore I would also like to do the following: Assume there is a nonnegative vector v and a matrix M, both with for example m rows. I would like to get rid of all rows in the matrix M whenever…
Cello
  • 91
  • 4
0
votes
0 answers

MATLAB - Combine two binary image by comparing 3 x 3 patch (sub-matrix)

Matlab - Hello, I want to combine two binary images with same size (111x111), but first i want to divide the image into 3 x 3 matrix patch (37 sub matrix), with the two conditions: 1.If the 3 x 3 patches from image 2 matrix values is all white (1)…
0
votes
0 answers

How to take submatrix in matlab

Hello i have a matrix whose rows and columns are multiple of 8 let's say 256x160 and i need to have as output all the possible submatrix of 8x8 elements. Fore few elements i can write bloc = 8; imm = imread('cameraman.tif'); [rows, columns,…
Andy
  • 23
  • 7
0
votes
1 answer

Multiply each sub-block with a matrix in MATLAB

I would like to multiply each sub-block of a matrix A mxn with a matrix B pxq. For example A can be divided into k sub blocks each one of size mxp. A = [A_1 A_2 ... A_k] The resulting matrix will be C = [A_1*B A_2*B ... A_k*B] and I would like to…
zSt
  • 300
  • 1
  • 3
  • 10
0
votes
1 answer

R: Sparse submatrix without reducing original matrix dimension

From this data frame df group from to weight 1 1 Joey Joey 1 2 1 Joey Deedee 1 3 1 Deedee Joey 1 4 1 Deedee Deedee 1 5 2 Johnny Johnny 1 6 2 Johnny Tommy 1 7 2 Tommy Johnny …
hyco
  • 213
  • 3
  • 11
0
votes
0 answers

Memcpy and two-dimensial arrays

What I am trying to do is to copy a part of matrix to an other in order to create a submatrix. However, while the following part of code looks quiet logical to me, it results in absolutely nothing being copied into a destination. void Copy(double…
RKT
  • 1
  • 1