[Visual Basic] matrix-matrix transpose

This is a matrix with respect to the college entrance examination, the trouble is really annoying.
But personally I feel, mainly on their own understanding of the meaning of the title, and then slowly push. Common sense lesson matrix is not exactly out of the test.
So consider the following 8

definition

Ps: the contents of this tedious and boring , it is recommended to skip (just to complete my notes just Ctrl + V)
matrix
In mathematics, a matrix (Matrix) is a collection of in accordance with complex or real rectangular array arrangement, the earliest from the equation coefficients and constants of the group consisting of square. This concept was first proposed by British mathematician Kelly 19th century.
Number of tables arranged by m number m × n rows and n columns referred to as a matrix of m rows and n columns, referred to as m × n matrix
of the m × n number of elements in matrix A is called, simply referred to as metadata, the number of a ( i, j) of the matrix a is the i-th row j-th column, called matrix a (i, j) element.

Generating plain matrix

m = Val(Text1.Text)
 n = Val(Text2.Text)
For i = 1 To m * n
    r=Int(Rnd *90)+10 
   a(i) = r
   s = s + Str(a(i))
     If i Mod n =0 Then
          List1.AddItem s 
          s = ""
     End If 
Next i
End Sub

The following formula is the focus of it! Push your own again!
Line number: H = (i-1) \ n + 1
column number: L = (i-1) mod n + 1
array subscript: i = (H-1) * n + L
array subscript position relationship (line number 1) * number of columns + column where
particular attention to the last column of the data processing

Flip Matrix

I believe you also think reading the above matrix very difficult thing, then the following flip for you certainly have no problem friends -
the way Tucao about, VB in fact, there is a two-dimensional array, but SB topic happens to people just like with a one-dimensional array, so we add all sorts of trouble! QAQ

Flip Vertical

Flip Vertical
Flip Vertical drop like this turn! The equivalent of your handstand up! This is the line of transformation

Dimensional simulation method

New data in the i-th row, the original data of the line m-i + 1

b((i-1)*n+j)=a((m-i)*n+j)
'数组下标与位置关系为(所在行数-1)*列数+所在列

Method one-dimensional linear

New data b (i)
line: (I-. 1) \ n-+. 1
column: (I-. 1) MOD n-+. 1
original data A (?)
Line: m - ((I-. 1) \ n-+. 1) + 1 = m- (i-1)
\ n columns: (. 1-I) + n-MOD. 1

b(i)=a((m-(i-1)\n-1)*n+(i-1) Mod n+1
'数组下标与位置关系为(所在行数-1)*列数+所在列

Do not ask, ask what I can not remember. One-dimensional approach really do not comply with the law thinking hey

horizontal flip

Level
This is from you to see himself in the mirror, about the column transformations
are also two ways, just to paste the code:

Dimensional simulation method

b((i-1)*n+j) =a((i-1)*n+n-j+1)
'数组下标与位置关系为(所在行数-1)*列数+所在列

Method one-dimensional linear

b(i)=a((i-1)\n*n+n-(i-1) mod n)
'数组下标与位置关系为(所在行数-1)*列数+所在列

Rotation matrix

Rotated 90 degrees clockwise

S90
Imitation dimensional method: B ((. 1-I) m + J) = A ((MJ) n-I +)
one-dimensional linear method: B (I) = A ((M- (I-. 1) Mod. 1-m ) * n + (i-1 ) \ m + 1)

Rotate 90 degrees

N90
Imitation dimensional method: B ((. 1-I) m + J) = A (J n-I-n-+ +. 1)
one-dimensional linear method: B (I) = A ((I-. 1) Mod m) * n- + n- (i-1) \ m)

Rotated 180 degrees (centrosymmetric)

ZX
Imitation dimensional method: B ((. 1-I) n-+ J) = A ((mi The) n-J-n-+ +. 1)
one-dimensional linear method: B (I) = A ((M- (I-. 1) \ n-1) * n +
n- (i-1) Mod n) or b (i) = a (m * n + 1 - i)

Transpose (swap line)

ZZ
Imitation dimensional method: B ((. 1-I) m + J) = A ((. 1-J) n-I +)
one-dimensional linear method: B (I) = A (((. 1-I) Mod m) * n + (i-1) \ m + 1)

Too lazy to write a note of light ... This formula is actually quite boring ...... or manual simulation again how to walk around it. Title and push on.

Guess you like

Origin www.cnblogs.com/lsqwq/p/Matrix.html