Data update
This commit is contained in:
parent
29a5eea0d4
commit
5c1bb7bfa9
2011 changed files with 35081 additions and 3229 deletions
|
|
@ -1,17 +1,16 @@
|
|||
// version 1.0.6
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
fun main() {
|
||||
print("Enter size of matrix : ")
|
||||
val n = readLine()!!.toInt()
|
||||
val n = readln().toInt()
|
||||
println()
|
||||
val identity = Array(n) { IntArray(n) } // create n x n matrix of integers
|
||||
|
||||
// enter 1s in diagonal elements
|
||||
for(i in 0 until n) identity[i][i] = 1
|
||||
val identity = Array(n) { i ->
|
||||
IntArray(n) { j ->
|
||||
if (i == j) 1 else 0
|
||||
}
|
||||
}
|
||||
|
||||
// print identity matrix if n <= 40
|
||||
if (n <= 40)
|
||||
for (i in 0 until n) println(identity[i].joinToString(" "))
|
||||
for (row in identity) println(row.joinToString(" "))
|
||||
else
|
||||
println("Matrix is too big to display on 80 column console")
|
||||
}
|
||||
|
|
|
|||
5
Task/Identity-matrix/PascalABC.NET/identity-matrix.pas
Normal file
5
Task/Identity-matrix/PascalABC.NET/identity-matrix.pas
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
begin
|
||||
var n := ReadInteger;
|
||||
var matrix: array [,] of integer := MatrGen(n,n,(i,j) -> i = j ? 1 : 0);
|
||||
matrix.Println
|
||||
end.
|
||||
2
Task/Identity-matrix/Uiua/identity-matrix.uiua
Normal file
2
Task/Identity-matrix/Uiua/identity-matrix.uiua
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
IdMatrix ← ⊞=.⇡
|
||||
IdMatrix 7
|
||||
Loading…
Add table
Add a link
Reference in a new issue