matrix

How to find the common eigenvectors of two matrices with distincts eigenvalues

你说的曾经没有我的故事 提交于 2021-01-27 04:07:51
问题 I am looking for finding or rather building common eigenvectors matrix X between 2 matrices A and B such as : AX=aX with "a" the diagonal matrix corresponding to the eigenvalues BX=bX with "b" the diagonal matrix corresponding to the eigenvalues where A and B are square and diagonalizable matrices. I took a look in a similar post but had not managed to conclude, i.e having valid results when I build the final wanted endomorphism F defined by : F = P D P^-1 I have also read the wikipedia topic

How to find the common eigenvectors of two matrices with distincts eigenvalues

孤人 提交于 2021-01-27 04:04:08
问题 I am looking for finding or rather building common eigenvectors matrix X between 2 matrices A and B such as : AX=aX with "a" the diagonal matrix corresponding to the eigenvalues BX=bX with "b" the diagonal matrix corresponding to the eigenvalues where A and B are square and diagonalizable matrices. I took a look in a similar post but had not managed to conclude, i.e having valid results when I build the final wanted endomorphism F defined by : F = P D P^-1 I have also read the wikipedia topic

How to find the common eigenvectors of two matrices with distincts eigenvalues

我们两清 提交于 2021-01-27 04:02:06
问题 I am looking for finding or rather building common eigenvectors matrix X between 2 matrices A and B such as : AX=aX with "a" the diagonal matrix corresponding to the eigenvalues BX=bX with "b" the diagonal matrix corresponding to the eigenvalues where A and B are square and diagonalizable matrices. I took a look in a similar post but had not managed to conclude, i.e having valid results when I build the final wanted endomorphism F defined by : F = P D P^-1 I have also read the wikipedia topic

opencv error multiplying 2 Mat's

我怕爱的太早我们不能终老 提交于 2021-01-22 05:18:29
问题 I am multiplying 2 matrices (Mat objects) in opencv. Here is how first Mat was generated : cv::Mat R(m, k, CV_8UC1); rm.generateRandomMatrix(m, k, 255, R); Here is how the second one was generated: for (int i=0; i<=n; i++) { randomMatrix_Xi rm; cv::Mat Xi(k, 1, CV_8UC1); rm.generateRandomMatrix(k, 1, 255, Xi); random_Xi_Vectors.push_back(Xi); sleep(2); } Here is the generateRandomMatrix() function definition which I have used in both places: int randomMatrix_Xi::generateRandomMatrix(int m,

opencv error multiplying 2 Mat's

◇◆丶佛笑我妖孽 提交于 2021-01-22 05:18:06
问题 I am multiplying 2 matrices (Mat objects) in opencv. Here is how first Mat was generated : cv::Mat R(m, k, CV_8UC1); rm.generateRandomMatrix(m, k, 255, R); Here is how the second one was generated: for (int i=0; i<=n; i++) { randomMatrix_Xi rm; cv::Mat Xi(k, 1, CV_8UC1); rm.generateRandomMatrix(k, 1, 255, Xi); random_Xi_Vectors.push_back(Xi); sleep(2); } Here is the generateRandomMatrix() function definition which I have used in both places: int randomMatrix_Xi::generateRandomMatrix(int m,

how many ways to visit all the points of a given matrix?

眉间皱痕 提交于 2021-01-21 05:42:46
问题 There is a m*n Matrix . From one point of the matrix, you can move to one of the eight adjacent points ( up, down, left, right, upper left, lower left, upper right, lower right ) If the point in one direction has been visited, you can continue to move to the next unvisited point in this direction. You cann't visit a point which has been visited, but you can pass through the visited adjacent point to visit other un-visited point. For example, the current point is (5,5): If (5,4) has been

how many ways to visit all the points of a given matrix?

微笑、不失礼 提交于 2021-01-21 05:42:06
问题 There is a m*n Matrix . From one point of the matrix, you can move to one of the eight adjacent points ( up, down, left, right, upper left, lower left, upper right, lower right ) If the point in one direction has been visited, you can continue to move to the next unvisited point in this direction. You cann't visit a point which has been visited, but you can pass through the visited adjacent point to visit other un-visited point. For example, the current point is (5,5): If (5,4) has been

Cannot pass my matrix of structs to a function after using malloc function

|▌冷眼眸甩不掉的悲伤 提交于 2021-01-20 10:41:20
问题 I need to create a matrix containing structs. My struct: typedef struct { int a; int b; int c; } myStruct; My method to create matrix: myStruct (*matrix)[WIDTH] = malloc(HEIGHT * sizeof *matrix); How can I pass my matrix to a function to do something? 回答1: In C89, WIDTH must be a constant and you can simply pass the matrix this way: #include <stdlib.h> #define WIDTH 5 typedef struct { int a; int b; int c; } myStruct; void init_matrix(myStruct matrix[][WIDTH], int height) { for (int i = 0; i <

Add all elements in matrix R

柔情痞子 提交于 2021-01-19 19:07:45
问题 I am trying to add all the elements in a matrix. This is an example of my matrix (the actual matrix is bigger): m = matrix(c(528,479,538,603),nrow=2,ncol=2) m A B male 528 538 female 479 603 I am trying to do: sum.elements = colSums(colSums(m)) but it gives the following error: Error in colSums(colSums(m)) : 'x' must be an array of at least two dimensions I have tried doing: x = colSums(m) sum.elements = x[1] + x[2] but this would be very long when you have a 100-column matrix... Any help

Add all elements in matrix R

不想你离开。 提交于 2021-01-19 19:06:03
问题 I am trying to add all the elements in a matrix. This is an example of my matrix (the actual matrix is bigger): m = matrix(c(528,479,538,603),nrow=2,ncol=2) m A B male 528 538 female 479 603 I am trying to do: sum.elements = colSums(colSums(m)) but it gives the following error: Error in colSums(colSums(m)) : 'x' must be an array of at least two dimensions I have tried doing: x = colSums(m) sum.elements = x[1] + x[2] but this would be very long when you have a 100-column matrix... Any help