ZikoMatrix
Arduino library for creating and manipulating matrices of arbitrary size and data type. The library provides a Matrix class that can be used to create matrices, perform basic matrix operations
Install / Use
/learn @zakarialaoui10/ZikoMatrixREADME
Get Started
// 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|
|2|M.at(i,j)|M.at(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();
Matrix<4,5> Nums = Matrix<4,5,double>::Nums(6.7);
Operators
List
M1: Matrix
|Operator |Operande|Syntax|
|--|--|--|
|+|M2:Matrix|Matrix<r,c,type> M3=M1+M2;|
|+|a:Scalar|Matrix<r,c,type> M3=M1+a;|
|-|M2:Matrix|Matrix<r,c,type> M3=M1-M2;|
|-|a:Scalar|Matrix<r,c,type> M3=M1-a;|
||M2:Matrix|Matrix<r,c,type> M3=M1*M2;|
||a:Scalar|Matrix<r,c,type> M3=M1*a;|
|/|a:Scalar|Matrix<r,c,type> M3=M1/a;|
|=|a:Matrix|Matrix<r,c,type> M3=M1;|
|%|a:Integer|Matrix<r,c,type> M3=M1ùa;|
|+=|M2:Matrix|M1+=M2;|
|+=|a:Scalar|M1+=a;|
|-=|M2:Matrix|M1-=M2;|
|-=|a:Scalar|M1-=a;|
|=|M2:Matrix|M1*=M2;|
|=|a:Scalar|M1+=a;|
|/=|a:Scalar|M1/=a;|
|%=|a:Integer|M1%=a;|
Examples
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;
Void Methodes
|Methode|Description|Example|Condition|
|-|--|-|--|
|.clone()|||-|
|.print()|||-|
|.at(i,j)|Acces and set data||-|
|.det()|The determinant of the given matrix|View|should be a square matrix|
|.transpose()|Transposes the given matrix |View|-|
|.comatrice()| |View|-|
|.reshape(r,c)|Reshapes the given matrix|View|The size of the new Matrix should be equal to the old one|
|.slice(r0,c0,r1,c1)|Extracts a sub-matrix from the original matrix,|View|-|
|.deleteRow(i)|Remove a specific row from the original matrix.|View|-|
|.deleteCol(j)|Remove a specific column from the original matrix.|View|-|
|.hstack(M)|Stacks the original matrix horizontally with the matrix M|View|The number of cols in both matrices should be the same,|
|.vstack(M)|Stacks the original matrix vertically with the matrix M|View|The number of rows in both matrices should be the same,|
|.foreach(lambda_func)|Higher-order function that takes a function as an argument and applies it to each element of the Matrix.|View|-|
|.clamp(min,max)|clamp all matrix elements between min and max|View|-|
|.lerp(min,max)||View|-|
|.norm(min,max)|Normalize the values in a matrix to a range between 0 and 1|View|-|
|.map(a1,b1,a2,b2)|Map the values of a matrix from one range to another.|View|-|
|.count(n)|||-|
Testers
|Methode|description|
|-|---|
|isId()|determines whether a given matrix is identity matrix or not|
|isSquare()|determines whether a given matrix is square or not|
|isSym()|determines whether a given matrix is symmetric or not|
|isAntiSym()|determines whether a given matrix is antisymmetric or not|
|isInv()|determines whether a given matrix is inversible or not|
|isZeros()|determines whether a given matrix is filled by zeros or not|
|isOnes()|determines whether a given matrix is filled by ones or not|
License
This projet is licensed under the terms of MIT License </br></br>
Related Skills
node-connect
347.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
107.8kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
347.0kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
347.0kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
