Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,32 @@
class IdentityMatrix {
function : Matrix(n : Int) ~ Int[,] {
array := Int->New[n,n];
for(row:=0; row<n; row+=1;){
for(col:=0; col<n; col+=1;){
if(row = col){
array[row, col] := 1;
}
else{
array[row,col] := 0;
};
};
};
return array;
}
function : PrintMatrix(array : Int[,]) ~ Nil {
sizes := array->Size();
for(row:=0; row<sizes[0]; row+=1;){
for(col:=0; col<sizes[1]; col+=1;){
value := array[row,col];
"{$value} \t"->Print();
};
'\n'->PrintLine();
};
}
function : Main(args : String[]) ~ Nil {
PrintMatrix(Matrix(5));
}
}