Data update
This commit is contained in:
parent
4d5544505c
commit
4924dd0264
3073 changed files with 55820 additions and 4408 deletions
20
Task/Identity-matrix/DuckDB/identity-matrix.duckdb
Normal file
20
Task/Identity-matrix/DuckDB/identity-matrix.duckdb
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
# Produce an (i,j,value) table representing the matrix I(m,n)
|
||||
# which is the identity matrix if m = n
|
||||
create or replace function I(m,n,zero) as table (
|
||||
with recursive cte(i,j,ij,value) as (
|
||||
select 1, 1, (null,null), zero
|
||||
union all
|
||||
select if(j=n, i+1, i) as i,
|
||||
if(j=n, 1, j+1) as j,
|
||||
(i, j) as ij,
|
||||
zero + if(i=j, 1, 0) as value
|
||||
from cte
|
||||
where i <= m
|
||||
)
|
||||
select ij[1] as i, ij[2] as j, value
|
||||
from cte
|
||||
offset 1
|
||||
);
|
||||
|
||||
# Generate a 3x3 matrix with DOUBLE(3,2) values:
|
||||
from I(3, 3, 0.000);
|
||||
Loading…
Add table
Add a link
Reference in a new issue