• Stars
    star
    20
  • Rank 1,121,974 (Top 23 %)
  • Language
    C++
  • License
    MIT License
  • Created over 1 year ago
  • Updated 10 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

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
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

MIT

More Repositories

1

ziko.js

zikojs is a new javascript library with a focus on making coding effortless .
JavaScript
37
star
2

HIGH-TO-LOW

in this repository you will find codes in C and their equivalence in MIPS Assembly
Assembly
31
star
3

awesome-processing

Processing is a flexible software sketchbook and a language for learning how to code. Since 2001, Processing has promoted software literacy within the visual arts and visual literacy within technology. There are tens of thousands of students, artists, designers, researchers, and hobbyists who use Processing for learning and prototyping.
Processing
19
star
4

zakarialaoui10

Config files for my GitHub profile.
JavaScript
12
star
5

ziko-kit

JavaScript
11
star
6

mapfun

mapfun is a function that applies a mapping function to an infinite number of input elements, with options to skip certain elements and selectively apply the mapping to keys and/or values of objects. The origin of this function traces back to zikojs
JavaScript
8
star
7

ziko-addons

JavaScript
8
star
8

PowerMonitor

A C++ library designed to measure the electrical characteristics of AC circuits such as voltage, current, power, reactive power, and power factor...
C++
7
star
9

Greenlab-Challenge

JavaScript
6
star
10

only-for-psychopathic-programmers

C
5
star
11

dir2tree

a user-friendly Node.js tool for creating organized json tree from a root directory .
JavaScript
5
star
12

ziko-micro

4
star
13

_ziko-lottie

Lottie player element for zikojs
JavaScript
3
star
14

Vanilla-X

3
star
15

ziko-lottie

Lottie player element for zikojs
JavaScript
2
star
16

ziko-addons-template

JavaScript
1
star
17

npm-ziko-test

JavaScript
1
star