简体   繁体   English

矩阵的位置

[英]Positions of matrices

i'm learning matrices. 我正在学习矩阵。 I found out how to get to plenty of positions in matrices, but there are still some i can't figure out and i got stuck with. 我找到了如何在矩阵中获得大量职位的方法,但是仍然有些我无法弄清楚,因此我陷入了困境。

For example if we got matrice with height n=5, where i and j go from 0, i = rows, j = columns. 例如,如果我们得到高度为n = 5的矩阵,其中i和j从0开始,i =行,j =列。 (i don't use any array, just for in for) (我不使用任何数组,仅用于in)

Matrice: 矩阵:

00 01 02 03 04 00 01 02 03 04
10 11 12 13 14 10 11 12 13 14
20 21 22 23 24 20 21 22 23 24
30 31 32 33 34 30 31 32 33 34
40 41 42 43 44 40 41 42 43 44

When i want to get : 当我想得到时:

  1. The main diagonal: if(i == j) 主对角线:if(i == j)
  2. Secondary diagonal: if(i+j == n-1) 次对角线:if(i + j == n-1)
  3. Under secondary diagonal: if(i+j > n-1) 在次对角线下:if(i + j> n-1)
  4. Under main diagonal: if(i>j) 在主对角线下:if(i> j)
  5. Above secondary diagonal: if(i+j < n-1) 次级对角线上方:if(i + j <n-1)
  6. Above main diagonal: if(j>i) 在主对角线上方:if(j> i)

This is what i can't figure out 这是我不知道的

  1. Part of the right side where the diagonals intersect: (10, 20, 30, 21) 对角线相交的右侧部分:(10,20,30,21)
  2. Part of the left side where the diagonals intersect: (14, 23, 24, 34) 对角线相交的左侧部分:(14,23,24,34)
  3. Part above the diagonals that intersect (01, 02, 03, 12) 在相交的对角线上方(01,02,03,12)
  4. Part below the diagonals that intersect (32, 41, 42, 43) 在相交的对角线下方(32、41、42、43)

I don't want you to give me all the code i need i just want you to direct me to answer so i can figure it out by myself. 我不希望您给我我需要的所有代码,而只是希望您指示我回答,以便我自己解决。 This piece of code from parts i need must work for every height i want, not only for height 5. 我需要的这些代码段必须适合我想要的每个高度,而不仅仅是高度5。

And, if you could give me some good advice how to fix matrices problems, which methods did you use. 而且,如果您能给我一些很好的建议,以解决矩阵问题,请使用哪种方法。

你可以结合的条件-例如,(10,20,30,21)将低于主对角线上面的次对角线: if(i > j && i+j < n-1)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM