feat(linalg): L6 lstsq, norms, complex dtype, draw themes
Add QR/SVD least squares, norm/cond/rank, complex dense Frobenius baseline, and light/dark/bw draw themes aligned with quantum Q8. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
01287d9e7e
commit
c0fbe9b182
15 files changed
+910
-136
No files matched your search
+37
-2
@@ -200,11 +200,46 @@ Dense factorization → `linalg_factor` (`kind` = `lu` | `qr` | `svd` | `eig` |
|
||||
+ `factor`
|
||||
+ `kind`=None
|
||||
+ `path`=None
|
||||
+ `theme`="light"
|
||||
|
||||
Structure SVG for a factor or dense matrix (`eig` | `svd` | `qr` | `lu` | `ge` | `chol` | `structure` | `heatmap` | `hinton`).
|
||||
Structure SVG (`eig` | `svd` | `qr` | `lu` | `ge` | `chol` | `structure` | `heatmap` | `hinton`). Theme tokens match quantum Q8: `light` | `dark` | `bw`.
|
||||
|
||||
> ensure_plugin
|
||||
**> linalg_draw factor=`factor` kind=`kind` path=`path`**
|
||||
**> linalg_draw factor=`factor` kind=`kind` path=`path` theme=`theme`**
|
||||
|
||||
## lstsq
|
||||
+ `a`
|
||||
+ `b`
|
||||
|
||||
Least squares `min ||a x - b||` (QR if tall, SVD if wide).
|
||||
|
||||
> ensure_plugin
|
||||
**> linalg_lstsq a=`a` b=`b`**
|
||||
|
||||
## norm
|
||||
+ `expr`
|
||||
+ `ord`="fro"
|
||||
|
||||
Matrix norm: `fro` | `1` | `inf` | `2`. Complex dense supports `fro` only.
|
||||
|
||||
> ensure_plugin
|
||||
**> linalg_norm expr=`expr` ord=`ord`**
|
||||
|
||||
## cond
|
||||
+ `expr`
|
||||
|
||||
Spectral condition number via SVD (`ord=2`).
|
||||
|
||||
> ensure_plugin
|
||||
**> linalg_cond expr=`expr`**
|
||||
|
||||
## rank
|
||||
+ `expr`
|
||||
|
||||
Numerical rank (SVD).
|
||||
|
||||
> ensure_plugin
|
||||
**> linalg_rank expr=`expr`**
|
||||
|
||||
## symbol
|
||||
+ `name`
|
||||
|
||||
+37
-2
@@ -192,11 +192,46 @@ import sys:lib/sys.mq.md
|
||||
+ `分解`
|
||||
+ `类型`=None
|
||||
+ `路径`=None
|
||||
+ `主题`="light"
|
||||
|
||||
分解/稠密结构 SVG(`eig` | `svd` | `qr` | `lu` | `ge` | `chol` | `structure` | `heatmap` | `hinton`)。
|
||||
结构 SVG(`eig` | `svd` | `qr` | `lu` | `ge` | `chol` | `structure` | `heatmap` | `hinton`)。主题与 quantum Q8 对齐:`light` | `dark` | `bw`。
|
||||
|
||||
> 确保插件
|
||||
**> linalg_draw factor=`分解` kind=`类型` path=`路径`**
|
||||
**> linalg_draw factor=`分解` kind=`类型` path=`路径` theme=`主题`**
|
||||
|
||||
## 最小二乘
|
||||
+ `左`
|
||||
+ `右`
|
||||
|
||||
最小二乘 `min ||左 · x - 右||`(高瘦用 QR,宽用 SVD)。
|
||||
|
||||
> 确保插件
|
||||
**> linalg_lstsq a=`左` b=`右`**
|
||||
|
||||
## 范数
|
||||
+ `式`
|
||||
+ `范数`="fro"
|
||||
|
||||
矩阵范数:`fro` | `1` | `inf` | `2`。复数稠密暂仅 `fro`。
|
||||
|
||||
> 确保插件
|
||||
**> linalg_norm expr=`式` ord=`范数`**
|
||||
|
||||
## 条件数
|
||||
+ `式`
|
||||
|
||||
谱条件数(SVD,`ord=2`)。
|
||||
|
||||
> 确保插件
|
||||
**> linalg_cond expr=`式`**
|
||||
|
||||
## 秩
|
||||
+ `式`
|
||||
|
||||
数值秩(SVD)。
|
||||
|
||||
> 确保插件
|
||||
**> linalg_rank expr=`式`**
|
||||
|
||||
## 符号
|
||||
+ `名`
|
||||
|
||||
Reference in new issue
Block a user