test(c12): add sparse-matrix triples and multiply fixture
- Fixture 73 implements triple-list lookup, dense conversion and sparse multiply with Int arithmetic and exact indexing. - Include it in the P2 pure closure lane and update golden count to 73, C12 evidence mapping, status/README/changelog. Gate: fmt, clippy -D warnings, 430 tests passed.
This commit is contained in:
1 parent
3484ab944c
commit
8bbed34bd3
8 files changed
+187
-5
No files matched your search
+1
-1
@@ -15,7 +15,7 @@ no test commits, copies or rewrites files outside a throw-away temp directory.
|
||||
tests/
|
||||
├── conformance/
|
||||
│ ├── ast/ 160 × *.mq.md + sibling *.ast.json goldens
|
||||
│ └── semantics/ 72 × *.mq.md + sibling *.expected.json goldens
|
||||
│ └── semantics/ 73 × *.mq.md + sibling *.expected.json goldens
|
||||
├── negative/
|
||||
│ ├── *.mq.md 52 × compile-time hard-error fixtures + *.expected.json
|
||||
│ ├── warnings/ 6 × inert-executable warning fixtures + *.expected.json
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
{
|
||||
"args": {},
|
||||
"function": "main",
|
||||
"stdout": "",
|
||||
"value": {
|
||||
"items": [
|
||||
{
|
||||
"items": [
|
||||
{
|
||||
"items": [
|
||||
{
|
||||
"decimal": "0",
|
||||
"type": "int"
|
||||
},
|
||||
{
|
||||
"decimal": "0",
|
||||
"type": "int"
|
||||
},
|
||||
{
|
||||
"decimal": "16",
|
||||
"type": "int"
|
||||
}
|
||||
],
|
||||
"type": "list"
|
||||
},
|
||||
{
|
||||
"items": [
|
||||
{
|
||||
"decimal": "1",
|
||||
"type": "int"
|
||||
},
|
||||
{
|
||||
"decimal": "1",
|
||||
"type": "int"
|
||||
},
|
||||
{
|
||||
"decimal": "15",
|
||||
"type": "int"
|
||||
}
|
||||
],
|
||||
"type": "list"
|
||||
}
|
||||
],
|
||||
"type": "list"
|
||||
},
|
||||
{
|
||||
"items": [
|
||||
{
|
||||
"items": [
|
||||
{
|
||||
"decimal": "16",
|
||||
"type": "int"
|
||||
},
|
||||
{
|
||||
"decimal": "0",
|
||||
"type": "int"
|
||||
}
|
||||
],
|
||||
"type": "list"
|
||||
},
|
||||
{
|
||||
"items": [
|
||||
{
|
||||
"decimal": "0",
|
||||
"type": "int"
|
||||
},
|
||||
{
|
||||
"decimal": "15",
|
||||
"type": "int"
|
||||
}
|
||||
],
|
||||
"type": "list"
|
||||
}
|
||||
],
|
||||
"type": "list"
|
||||
}
|
||||
],
|
||||
"type": "list"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
## 查值
|
||||
|
||||
`(三元组, 行, 列)`
|
||||
|
||||
**值 = 0**
|
||||
|
||||
**下标 = 0**
|
||||
|
||||
- `下标 < 长度(三元组)`
|
||||
|
||||
1. `三元组[下标][0] == 行 and 三元组[下标][1] == 列`
|
||||
|
||||
**值 = 三元组[下标][2]**
|
||||
|
||||
2. `true`
|
||||
|
||||
**忽略 = 0**
|
||||
|
||||
**下标 = 下标 + 1**
|
||||
|
||||
*值*
|
||||
|
||||
## 三列转稠密
|
||||
|
||||
`(三元组, 行数, 列数)`
|
||||
|
||||
**矩阵 = []**
|
||||
|
||||
**行号 = 0**
|
||||
|
||||
- `行号 < 行数`
|
||||
|
||||
**行 = []**
|
||||
|
||||
**列号 = 0**
|
||||
|
||||
- `列号 < 列数`
|
||||
|
||||
**行 = list.append(行, 查值(三元组, 行号, 列号))**
|
||||
|
||||
**列号 = 列号 + 1**
|
||||
|
||||
**矩阵 = list.append(矩阵, 行)**
|
||||
|
||||
**行号 = 行号 + 1**
|
||||
|
||||
*矩阵*
|
||||
|
||||
## 稀疏乘法
|
||||
|
||||
`(左, 右, 行数, 内维, 列数)`
|
||||
|
||||
**结果 = []**
|
||||
|
||||
**行号 = 0**
|
||||
|
||||
- `行号 < 行数`
|
||||
|
||||
**列号 = 0**
|
||||
|
||||
- `列号 < 列数`
|
||||
|
||||
**和 = 0**
|
||||
|
||||
**内号 = 0**
|
||||
|
||||
- `内号 < 内维`
|
||||
|
||||
**左值 = 查值(左, 行号, 内号)**
|
||||
|
||||
**右值 = 查值(右, 内号, 列号)**
|
||||
|
||||
**和 = 和 + 左值 * 右值**
|
||||
|
||||
**内号 = 内号 + 1**
|
||||
|
||||
1. `和 != 0`
|
||||
|
||||
**结果 = list.append(结果, [行号, 列号, 和])**
|
||||
|
||||
2. `true`
|
||||
|
||||
**忽略 = 0**
|
||||
|
||||
**列号 = 列号 + 1**
|
||||
|
||||
**行号 = 行号 + 1**
|
||||
|
||||
*结果*
|
||||
|
||||
## main
|
||||
|
||||
**左 = [[0, 0, 1], [0, 2, 2], [1, 1, 3]]**
|
||||
|
||||
**右 = [[0, 0, 4], [1, 1, 5], [2, 0, 6]]**
|
||||
|
||||
**乘积 = 稀疏乘法(左, 右, 2, 3, 2)**
|
||||
|
||||
*[乘积, 三列转稠密(乘积, 2, 2)]*
|
||||
Reference in new issue
Block a user