feat(linalg): L5 examples, public feature pages, and skill docs
Ship SVD / least-squares examples, heatmap-hinton draw paths, coerce dense factors into MatExpr ops, and document ext/linalg in skill/README. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
70fb2fbfb2
commit
01287d9e7e
15 files changed
+238
-26
No files matched your search
@@ -192,13 +192,21 @@ fn arg_expr_opt(v: &Value, keys: &[&str]) -> Result<Expr, String> {
|
||||
for k in keys {
|
||||
if let Some(e) = v.get(*k) {
|
||||
if !e.is_null() {
|
||||
return Expr::from_value(e);
|
||||
return coerce_expr(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
Err(format!("missing one of {:?}", keys))
|
||||
}
|
||||
|
||||
fn coerce_expr(v: &Value) -> Result<Expr, String> {
|
||||
if let Ok(e) = Expr::from_value(v) {
|
||||
return Ok(e);
|
||||
}
|
||||
let data = dense::from_value(v)?;
|
||||
Ok(Expr::Dense { data })
|
||||
}
|
||||
|
||||
fn wrap(expr: Expr) -> Result<Value, String> {
|
||||
expr.to_value()
|
||||
}
|
||||
@@ -349,15 +357,6 @@ la_ffi!(linalg_show, |args: &Value| {
|
||||
Ok(out)
|
||||
});
|
||||
|
||||
fn coerce_expr(v: &Value) -> Result<Expr, String> {
|
||||
if let Ok(e) = Expr::from_value(v) {
|
||||
return Ok(e);
|
||||
}
|
||||
// Formula Matrix / nested list / linalg_dense → dense leaf
|
||||
let data = dense::from_value(v)?;
|
||||
Ok(Expr::Dense { data })
|
||||
}
|
||||
|
||||
la_ffi!(linalg_from_formula, |args: &Value| {
|
||||
let f = args
|
||||
.get("formula")
|
||||
|
||||
Reference in new issue
Block a user