[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7ESSSKMSG6G9Q26441H2YGR":3,"skill-same:01M7ESSSKMSG6G9Q26441H2YGR":47},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":25,"commitSha":26,"skillDirectory":27,"forksCount":28,"repositoryHtmlUrl":29,"repositoryHomepageUrl":6,"ownerHtmlUrl":30,"ownerBlogUrl":31,"ownerDescription":6,"updatedAt":32,"install":33,"resources":46},"01M7ESSSKMSG6G9Q26441H2YGR","linear-algebra-practice",null,"Applied linear algebra — decompositions, least squares, conditioning, and numerical habits for real matrices.","TanNhatCMS\u002Fjarvis","TanNhatCMS","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F113796420?v=4","01M753MV17KG5CD3152G3WQEQY","KietNT","01M7EKEDYVYQ6PWVJJMZ911VMX",0,"MIT","https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis\u002Fblob\u002Fmain\u002Fskills\u002Fams-linear-algebra-practice\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: linear-algebra-practice\ndescription: Applied linear algebra — decompositions, least squares, conditioning, and numerical habits for real matrices.\ncategory: scientific\n---\n\n## Overview\n\nLinear algebra is the computational substrate of science: every fit,\nsimulation, and data analysis reduces to matrix operations. This skill\ncovers choosing the right decomposition (LU, QR, SVD, eigendecomposition),\nsolving least-squares problems properly, understanding conditioning and\nstability, and the numerical habits (never invert explicitly, exploit\nstructure) that separate working code from slow, wrong code.\n\n## When to use\n\n- Solving linear systems or least-squares problems\n- Choosing between SVD, QR, eigendecomposition, Cholesky for a task\n- Diagnosing numerical instability: huge condition numbers, rank deficiency\n- Dimensionality reduction (PCA), low-rank approximation, pseudoinverses\n- Reviewing numerical code for stability and efficiency\n\n## Core concepts\n\n- **The decompositions and their jobs:** LU (general square systems), Cholesky (symmetric positive-definite — 2× faster than LU), QR (least squares, orthogonalization), SVD (rank, pseudoinverse, PCA — the most revealing, most expensive), eigendecomposition (symmetric\u002FHermitian only for guaranteed orthogonal eigenvectors).\n- **Condition number κ:** κ = σ_max\u002Fσ_min — measures error amplification; κ ~ 10^k means losing ~k digits. A large κ is a property of the problem, not the algorithm — regularize or reformulate.\n- **Least squares done right:** solve via QR or SVD, never via the normal equations (AᵀA squares the condition number: κ²). `lstsq` with SVD is the safe default.\n- **Rank and nullspace:** SVD reveals numerical rank (singular values near zero), nullspace (right singular vectors), and range — the diagnostic toolkit for degenerate problems.\n- **Sparsity and structure:** sparse (scipy.sparse), banded, Toeplitz, Kronecker — structured solvers are orders of magnitude faster; forming a dense matrix from a sparse problem is the classic performance bug.\n- **Floating point:** double precision has ~16 digits; catastrophic cancellation (subtracting nearly equal numbers) and overflow in naive formulas (use hypot, log-sum-exp) are the perennial traps.\n\n- **Krylov subspace methods:** CG, GMRES, Lanczos build solutions in expanding Krylov spaces — matrix-free (only matvecs needed), the only option for million-degree-of-freedom systems; preconditioning makes or breaks them.\n- **Randomized algorithms:** randomized SVD and sketching give near-optimal low-rank approximations in a fraction of the time — the practical tool for huge dense matrices in data science.\n- **Tensor decompositions:** CP and Tucker generalize SVD to multiway arrays — compression and latent-structure discovery for multidimensional scientific data.\n\n## Practical workflow\n\n### 1. Solve systems correctly\n\n```python\nimport numpy as np\nfrom scipy import linalg\n# Least squares via SVD (safe default); never form inv(A) or A.T @ A\nx, residuals, rank, sv = linalg.lstsq(A, b)\n# Check conditioning before trusting the answer\nkappa = sv[0] \u002F sv[-1]\n```\n\n1. Never compute the matrix inverse explicitly — solve the system (`solve`, `lstsq`) instead.\n2. Check κ (or the singular-value spectrum) routinely; if κ > 1\u002F√ε (~10⁸ in double), treat results as suspect.\n3. For SPD systems use Cholesky; for least squares use QR\u002FSVD — match the decomposition to the structure.\n\n### 2. Diagnose trouble\n\n1. **Huge κ:** rescale columns (column equilibration), remove collinear features, or regularize (ridge\u002FTikhonov: minimize ‖Ax−b‖² + λ‖x‖², choosing λ by L-curve or cross-validation).\n2. **Rank deficiency:** inspect small singular values and their vectors — they tell you which combinations of variables are unidentifiable.\n3. **Residual analysis:** large residuals + small κ = model wrong; small residuals + huge κ = solution unstable — different diseases, different cures.\n\n### 3. Exploit structure\n\n1. Sparse systems: iterative solvers (CG for SPD, GMRES\u002FBiCGSTAB general) with preconditioners (incomplete Cholesky\u002FLU) — direct sparse factorization for moderate sizes.\n2. Use matrix-free formulations (linear operators) when A is too big to form — common in inverse problems and PDE-constrained optimization.\n3. Randomized SVD for huge matrices when only the top-k singular vectors are needed.\n\n### 4. PCA and low-rank work\n\n1. Center (and consider scaling) before PCA — the first component of uncentered data is usually the mean.\n2. Choose rank by the singular-value spectrum (elbow, or a variance threshold) and validate that discarded components are noise (compare against a shuffled null).\n3. Remember PCA is variance-maximizing, not signal-maximizing — high-variance components can be artifacts (batch effects, trends).\n\n### 5. Solve a large sparse system iteratively\n\n1. Choose the solver for the structure: CG for symmetric positive-definite, GMRES\u002FBiCGSTAB otherwise — and always precondition (incomplete Cholesky\u002FLU, or algebraic multigrid for PDE-derived systems).\n2. Monitor the residual norm and the true error (they differ) — set tolerances on the quantity you actually care about.\n3. Verify against a direct solve on a small version of the problem — iterative solvers with bad preconditioners converge to wrong answers slowly and confidently.\n\n## Common pitfalls\n\n- **Explicit inverses:** `inv(A) @ b` is slower and less accurate than `solve(A, b)` — always.\n- **Normal equations:** forming AᵀA squares the condition number — the textbook method that fails in practice.\n- **Ignoring κ:** publishing solutions from κ ~ 10¹² systems as if they were precise.\n- **Uncentered PCA:** first component captures the mean, not the interesting variation.\n- **Dense treatment of sparse problems:** forming a million×million dense matrix instead of using sparse\u002Fiterative methods.\n- **Single precision by accident:** float32 halves your digits — fine for ML, dangerous for ill-conditioned solves; check dtypes.\n- **Iterative solver without preconditioning:** unpreconditioned Krylov methods on ill-conditioned systems stall for thousands of iterations — preconditioning is not optional.\n- **Confusing residual with error:** a small residual with an ill-conditioned matrix still means a large error — bound the error by κ times the residual.\n","## Overview\n\nLinear algebra is the computational substrate of science: every fit,\nsimulation, and data analysis reduces to matrix operations. This skill\ncovers choosing the right decomposition (LU, QR, SVD, eigendecomposition),\nsolving least-squares problems properly, understanding conditioning and\nstability, and the numerical habits (never invert explicitly, exploit\nstructure) that separate working code from slow, wrong code.\n\n## When to use\n\n- Solving linear systems or least-squares problems\n- Choosing between SVD, QR, eigendecomposition, Cholesky for a task\n- Diagnosing numerical instability: huge condition numbers, rank deficiency\n- Dimensionality reduction (PCA), low-rank approximation, pseudoinverses\n- Reviewing numerical code for stability and efficiency\n\n## Core concepts\n\n- **The decompositions and their jobs:** LU (general square systems), Cholesky (symmetric positive-definite — 2× faster than LU), QR (least squares, orthogonalization), SVD (rank, pseudoinverse, PCA — the most revealing, most expensive), eigendecomposition (symmetric\u002FHermitian only for guaranteed orthogonal eigenvectors).\n- **Condition number κ:** κ = σ_max\u002Fσ_min — measures error amplification; κ ~ 10^k means losing ~k digits. A large κ is a property of the problem, not the algorithm — regularize or reformulate.\n- **Least squares done right:** solve via QR or SVD, never via the normal equations (AᵀA squares the condition number: κ²). `lstsq` with SVD is the safe default.\n- **Rank and nullspace:** SVD reveals numerical rank (singular values near zero), nullspace (right singular vectors), and range — the diagnostic toolkit for degenerate problems.\n- **Sparsity and structure:** sparse (scipy.sparse), banded, Toeplitz, Kronecker — structured solvers are orders of magnitude faster; forming a dense matrix from a sparse problem is the classic performance bug.\n- **Floating point:** double precision has ~16 digits; catastrophic cancellation (subtracting nearly equal numbers) and overflow in naive formulas (use hypot, log-sum-exp) are the perennial traps.\n\n- **Krylov subspace methods:** CG, GMRES, Lanczos build solutions in expanding Krylov spaces — matrix-free (only matvecs needed), the only option for million-degree-of-freedom systems; preconditioning makes or breaks them.\n- **Randomized algorithms:** randomized SVD and sketching give near-optimal low-rank approximations in a fraction of the time — the practical tool for huge dense matrices in data science.\n- **Tensor decompositions:** CP and Tucker generalize SVD to multiway arrays — compression and latent-structure discovery for multidimensional scientific data.\n\n## Practical workflow\n\n### 1. Solve systems correctly\n\n```python\nimport numpy as np\nfrom scipy import linalg\n# Least squares via SVD (safe default); never form inv(A) or A.T @ A\nx, residuals, rank, sv = linalg.lstsq(A, b)\n# Check conditioning before trusting the answer\nkappa = sv[0] \u002F sv[-1]\n```\n\n1. Never compute the matrix inverse explicitly — solve the system (`solve`, `lstsq`) instead.\n2. Check κ (or the singular-value spectrum) routinely; if κ > 1\u002F√ε (~10⁸ in double), treat results as suspect.\n3. For SPD systems use Cholesky; for least squares use QR\u002FSVD — match the decomposition to the structure.\n\n### 2. Diagnose trouble\n\n1. **Huge κ:** rescale columns (column equilibration), remove collinear features, or regularize (ridge\u002FTikhonov: minimize ‖Ax−b‖² + λ‖x‖², choosing λ by L-curve or cross-validation).\n2. **Rank deficiency:** inspect small singular values and their vectors — they tell you which combinations of variables are unidentifiable.\n3. **Residual analysis:** large residuals + small κ = model wrong; small residuals + huge κ = solution unstable — different diseases, different cures.\n\n### 3. Exploit structure\n\n1. Sparse systems: iterative solvers (CG for SPD, GMRES\u002FBiCGSTAB general) with preconditioners (incomplete Cholesky\u002FLU) — direct sparse factorization for moderate sizes.\n2. Use matrix-free formulations (linear operators) when A is too big to form — common in inverse problems and PDE-constrained optimization.\n3. Randomized SVD for huge matrices when only the top-k singular vectors are needed.\n\n### 4. PCA and low-rank work\n\n1. Center (and consider scaling) before PCA — the first component of uncentered data is usually the mean.\n2. Choose rank by the singular-value spectrum (elbow, or a variance threshold) and validate that discarded components are noise (compare against a shuffled null).\n3. Remember PCA is variance-maximizing, not signal-maximizing — high-variance components can be artifacts (batch effects, trends).\n\n### 5. Solve a large sparse system iteratively\n\n1. Choose the solver for the structure: CG for symmetric positive-definite, GMRES\u002FBiCGSTAB otherwise — and always precondition (incomplete Cholesky\u002FLU, or algebraic multigrid for PDE-derived systems).\n2. Monitor the residual norm and the true error (they differ) — set tolerances on the quantity you actually care about.\n3. Verify against a direct solve on a small version of the problem — iterative solvers with bad preconditioners converge to wrong answers slowly and confidently.\n\n## Common pitfalls\n\n- **Explicit inverses:** `inv(A) @ b` is slower and less accurate than `solve(A, b)` — always.\n- **Normal equations:** forming AᵀA squares the condition number — the textbook method that fails in practice.\n- **Ignoring κ:** publishing solutions from κ ~ 10¹² systems as if they were precise.\n- **Uncentered PCA:** first component captures the mean, not the interesting variation.\n- **Dense treatment of sparse problems:** forming a million×million dense matrix instead of using sparse\u002Fiterative methods.\n- **Single precision by accident:** float32 halves your digits — fine for ML, dangerous for ill-conditioned solves; check dtypes.\n- **Iterative solver without preconditioning:** unpreconditioned Krylov methods on ill-conditioned systems stall for thousands of iterations — preconditioning is not optional.\n- **Confusing residual with error:** a small residual with an ill-conditioned matrix still means a large error — bound the error by κ times the residual.\n",{"name":5,"category":24,"description":7},"scientific","main","af388a77c2fe5e0b4fd879cca4300a0ffa9a6579","skills\u002Fams-linear-algebra-practice",1,"https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis","https:\u002F\u002Fgithub.com\u002FTanNhatCMS","https:\u002F\u002Fmrkiet.name.vn","2026-11-07 14:23:08",{"source":8,"skillName":5,"commands":34,"prompt":44,"zipAvailable":45},[35,38,41],{"tool":36,"command":37},"npx","npx skills add TanNhatCMS\u002Fjarvis --skill linear-algebra-practice",{"tool":39,"command":40},"bunx","bunx skills add TanNhatCMS\u002Fjarvis --skill linear-algebra-practice",{"tool":42,"command":43},"pnpm","pnpm dlx skills add TanNhatCMS\u002Fjarvis --skill linear-algebra-practice","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis\u002Fblob\u002Fmain\u002Fskills\u002Fams-linear-algebra-practice\u002FSKILL.md",true,[],[48,55,63,70,77,84],{"skillNo":49,"name":50,"nameZh":6,"description":51,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":52,"categories":53,"keywords":54,"publishedAt":19},"01M7EWYJR0J8DARY7E59Z6Y9MV","web-scrape","Turn web pages into LLM-ready markdown via the Firecrawl API (renders JS, anti-bot handling). Use when browser_open\u002Ffetch fails on JS-heavy pages, or when you need clean markdown\u002Fstructured extraction from a site. Requires FIRECRAWL_API_KEY.","https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis\u002Fblob\u002Fmain\u002Fskills\u002Fweb-scrape\u002FSKILL.md",[],[],{"skillNo":56,"name":57,"nameZh":6,"description":58,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":59,"sourceHtmlUrl":60,"categories":61,"keywords":62,"publishedAt":19},"01M7EWYBN5P6F2AJG3FR24T9BP","design-taste-frontend","tasteskill v2, the anti-slop frontend skill. Art direction for websites, distilled from a study of 247 curated gallery sites (One Page Love, Awwwards Sites of the Day). Deals researched directions (idea, composition, type, palette, photographs, section blueprints) from a library, enforces a strict no-slop house style with a real-browser inspector, and runs a look-and-fix loop on screenshots. Use this whenever you build, design, redesign, restyle, polish or review a landing page, marketing site, portfolio, product page, one-pager, hero or any public-facing web page, in any stack (HTML\u002FCSS, React, Next.js, Vue, Svelte, Astro, Tailwind) — also when the user says a page looks generic, templated, \"AI-made\", sloppy, or asks to make it look designed, premium, award-level or less like every other site. Not for dashboards or app screens.","https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis\u002Fblob\u002Fmain\u002Fskills\u002Ftaste-design\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis\u002Fblob\u002Fmain\u002Fskills\u002Ftaste-design\u002FSKILL.md",[],[],{"skillNo":64,"name":65,"nameZh":6,"description":66,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":19},"01M7EWY8FQFNQ2GB7NZZWGSSDX","test-driven-development","Use when implementing any feature or bugfix, before writing implementation code","https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis\u002Fblob\u002Fmain\u002Fskills\u002Fsuperpowers-tdd\u002FSKILL.md",[],[],{"skillNo":71,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":19},"01M7EWY5SHBFRH1HDHVWM9K7TV","systematic-debugging","Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes","https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis\u002Fblob\u002Fmain\u002Fskills\u002Fsuperpowers-debugging\u002FSKILL.md",[],[],{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":19},"01M7EWY3NM0Z0JAKS7HDZ24K66","requesting-code-review","Use when completing tasks, implementing major features, or before merging to verify work meets requirements","https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis\u002Fblob\u002Fmain\u002Fskills\u002Fsuperpowers-code-review\u002FSKILL.md",[],[],{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":19},"01M7EWY0WRMWX4M9ZFY0WKC593","brainstorming","You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).","https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis\u002Fblob\u002Fmain\u002Fskills\u002Fsuperpowers-brainstorming\u002FSKILL.md",[],[]]