Skip to content
ZAKARIA ELALAOUI edited this page Apr 20, 2023 · 4 revisions

Welcome to the ZikoMatrix wiki!

Initialize

 // 1 
 int arr[2][3] = {{1, 2, 3}, {4, 5, 6}};
 Matrix<2,3,int> M1(arr);
 // 2
 int arr[] = {1.6, 2.2, 3.9 , 4.7, 5.3, 6.8};
 Matrix<2,3,float> M2(arr);
 // 3
 Matrix<5,5,int> // A 5x5 Matrix filled by zeros

Print to the terminal

  M1.print();

Acces And Set Data

Mehode Acces Set
1 M[i][j] M[i][j]=4
2 M(i,j) M(i,j)=4

Static Methodes

  int r=2,c=3;
  Matrix<r, c> z = Matrix<r, c>::zeros();
  Matrix<r, c> o = Matrix<r, c>::ones();
  Matrix<3> Id = Matrix<3>::id();

Operators

   int arr1[2][3] = {{1, 2, 3},{4, 5, 6}};
   int arr2[2][3] = {{2, 3, 4},{5, 6, 7}};
   Matrix<2,3,int> M1(arr1);
   Matrix<2,3,int> M2(arr2);
   Matrix<2,3,int> M3=M1+M2;
   Matrix<2,3,int> M4=M1-M2;
   M3+=M3;
   M4-=M3;

Other Methodes

Methode Description Condition
.reshape(r,c) Reshape the given matrix The size of the new Matrix should be equal to the old one
.transpose() Transposes the given matrix -
.slice(r0,c0,r1,c1) Extracts a sub-matrix from the original matrix, -
.hstack(M) S the original matrix vertically with ths matrix M -
.vstack(M) Stacks the original matrix horizontally with ths matrix M -

Testers

Methode description
isSquare() determines whether a given matrix is square or not
isSym() determines whether a given matrix is symmetric or not
isId() determines whether a given matrix is identity matrix or not
Clone this wiki locally