Data update

This commit is contained in:
Ingy döt Net 2026-04-30 12:34:36 -04:00
parent 4bb20c9b71
commit cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions

View file

@ -0,0 +1,27 @@
with Ada.Numerics.Real_Arrays; use Ada.Numerics.Real_Arrays;
with Ada.Text_IO; use Ada.Text_IO;
procedure Matrix_Transpose is
procedure Put (X : Real_Matrix) is
type Fixed is delta 0.01 range -500.0..500.0;
begin
for I in X'Range (1) loop
for J in X'Range (2) loop
Put (Fixed'Image (Fixed (X (I, J))));
end loop;
New_Line;
end loop;
end Put;
Matrix : constant Real_Matrix :=
( (0.0, 0.1, 0.2, 0.3),
(0.4, 0.5, 0.6, 0.7),
(0.8, 0.9, 1.0, 1.1)
);
begin
Put_Line ("Before Transposition:");
Put (Matrix);
New_Line;
Put_Line ("After Transposition:");
Put (Transpose (Matrix));
end Matrix_Transpose;

View file

@ -0,0 +1,7 @@
(require 'cl-lib)
(defun transpose (m)
(apply #'cl-mapcar #'list m))
;;test for transposition function
(transpose '((2 3 4 5) (3 5 6 9) (9 9 9 9)))

View file

@ -0,0 +1,7 @@
(defun matrix-transposition (m)
(apply #'seq-mapn (append (list #'list) m)) )
(let ((m '(( 2 0 -5 -1)
(-3 -2 -4 7)
(-1 -3 0 -6))))
(message "%s" (matrix-transposition m)) )

View file

@ -0,0 +1,19 @@
function transpose(sequence in)
sequence out
out = repeat(repeat(0,length(in)),length(in[1]))
for n = 1 to length(in) do
for m = 1 to length(in[1]) do
out[m][n] = in[n][m]
end for
end for
return out
end function
sequence m
m = {
{1,2,3,4},
{5,6,7,8},
{9,10,11,12}
}
? transpose(m)

View file

@ -0,0 +1,17 @@
class Matrix {
static function main() {
var m = [ [1, 1, 1, 1],
[2, 4, 8, 16],
[3, 9, 27, 81],
[4, 16, 64, 256],
[5, 25, 125, 625] ];
var t = [ for (i in 0...m[0].length)
[ for (j in 0...m.length) 0 ] ];
for(i in 0...m.length)
for(j in 0...m[0].length)
t[j][i] = m[i][j];
for(aa in [m, t])
for(a in aa) Sys.println(a);
}
}

View file

@ -0,0 +1,13 @@
require "matrix"
local m = matrix.from({
{ 1, 2, 3},
{ 4, 5, 6},
{ 7, 8, 9},
{10, 11, 12}
})
print("Original:\n")
print(m)
print("\nTransposed:\n")
print(m:transpose())

View file

@ -0,0 +1,58 @@
function transpose($a) {
$arr = @()
if($a) {
$n = $a.count - 1
if(0 -lt $n) {
$m = ($a | foreach {$_.count} | measure-object -Minimum).Minimum - 1
if( 0 -le $m) {
if (0 -lt $m) {
$arr =@(0)*($m+1)
foreach($i in 0..$m) {
$arr[$i] = foreach($j in 0..$n) {@($a[$j][$i])}
}
} else {$arr = foreach($row in $a) {$row[0]}}
}
} else {$arr = $a}
}
$arr
}
function show($a) {
if($a) {
0..($a.Count - 1) | foreach{ if($a[$_]){"$($a[$_])"}else{""} }
}
}
$a = @(@(2, 0, 7, 8),@(3, 5, 9, 1),@(4, 1, 6, 3))
"`$a ="
show $a
""
"transpose `$a ="
show (transpose $a)
""
$a = @(1)
"`$a ="
show $a
""
"transpose `$a ="
show (transpose $a)
""
"`$a ="
$a = @(1,2,3)
show $a
""
"transpose `$a ="
"$(transpose $a)"
""
"`$a ="
$a = @(@(4,7,8),@(1),@(2,3))
show $a
""
"transpose `$a ="
"$(transpose $a)"
""
"`$a ="
$a = @(@(4,7,8),@(1,5,9,0),@(2,3))
show $a
""
"transpose `$a ="
show (transpose $a)

View file

@ -0,0 +1,22 @@
function transpose($a) {
if($a) {
$n = $a.Count - 1
foreach($i in 0..$n) {
$j = 0
while($j -lt $i) {
$a[$i][$j], $a[$j][$i] = $a[$j][$i], $a[$i][$j]
$j++
}
}
}
$a
}
function show($a) {
if($a) {
0..($a.Count - 1) | foreach{ if($a[$_]){"$($a[$_])"}else{""} }
}
}
$a = @(@(2, 4, 7),@(3, 5, 9),@(4, 1, 6))
show $a
""
show (transpose $a)

View file

@ -0,0 +1,2 @@
(define (transpose m)
(apply map list m))

View file

@ -0,0 +1,15 @@
(import srfi/231)
(define (transpose m)
(array-permute m '#(1 0)))
(define m
(list->array (make-interval '#(3 8))
(iota 24)))
(define m*
(transpose m))
(pretty-print (array->list* m))
(newline)
(pretty-print (array->list* m*))

View file

@ -0,0 +1,9 @@
mut transpose := [5][4]int{}
matrix := [[78,19,30,12,36], [49,10,65,42,50], [30,93,24,78,10], [39,68,27,64,29]]
for ial in 0..5 {
for jal in 0..4 {
transpose[ial][jal] = matrix[jal][ial]
print("" + "${transpose[ial][jal]}" + " ")
}
println("")
}

View file

@ -0,0 +1,31 @@
'create and display the initial matrix
WScript.StdOut.WriteLine "Initial Matrix:"
x = 4 : y = 6 : n = 1
Dim matrix()
ReDim matrix(x,y)
For i = 0 To y
For j = 0 To x
matrix(j,i) = n
If j < x Then
WScript.StdOut.Write n & vbTab
Else
WScript.StdOut.Write n
End If
n = n + 1
Next
WScript.StdOut.WriteLine
Next
'display the trasposed matrix
WScript.StdOut.WriteBlankLines(1)
WScript.StdOut.WriteLine "Transposed Matrix:"
For i = 0 To x
For j = 0 To y
If j < y Then
WScript.StdOut.Write matrix(i,j) & vbTab
Else
WScript.StdOut.Write matrix(i,j)
End If
Next
WScript.StdOut.WriteLine
Next