[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M75MHT6NXMY79KNWT3ZX6K6J":3,"skill-same:01M75MHT6NXMY79KNWT3ZX6K6J":71},{"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":16,"sourceHtmlUrl":17,"categories":18,"keywords":19,"publishedAt":20,"linkOnly":21,"markdownContent":22,"markdownBody":23,"frontMatter":24,"refName":30,"commitSha":31,"skillDirectory":32,"forksCount":33,"repositoryHtmlUrl":34,"repositoryHomepageUrl":6,"ownerHtmlUrl":35,"ownerBlogUrl":36,"ownerDescription":6,"updatedAt":37,"install":38,"resources":51},"01M75MHT6NXMY79KNWT3ZX6K6J","matlab-upgrade-mex-ic",null,"Upgrade C, C++, and Fortran MEX source files from the Separate Complex (SC) API to the Interleaved Complex (IC) API. Use when converting mxGetPr\u002FmxGetPi to mxGetComplexDoubles, migrating MEX files to -R2018a, adding MX_HAS_INTERLEAVED_COMPLEX guards for SC\u002FIC guarded builds, or modernizing legacy MEX code that uses mxGetData\u002FmxSetData\u002FmxGetImagData\u002FmxSetImagData. Covers C (.c), C++ (.cpp, .cxx), and Fortran (.F, .f90) MEX functions. Triggers on: interleaved complex, IC MEX, mex upgrade, mex migration, separate complex, mxGetPi, mxGetPr replacement, -R2018a, complex MEX, Fortran MEX, .F MEX file, C++ MEX, .cpp MEX file, MEX performance, MEX slow complex, MEX call overhead, improve MEX performance complex.","stanfish06\u002Fskillquarium","stanfish06","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F93099613?v=4","01M75F1CK4ZW109ZK3T26VN52F","Zhiyuan","01M75F1CM53VH6F79DZ8GXKKES",12,"BSD-2-Clause","https:\u002F\u002Fgithub.com\u002Fstanfish06\u002Fskillquarium\u002Fblob\u002Fmaster\u002Fskills\u002Fmatlab-upgrade-mex-ic\u002FLICENSE.md","https:\u002F\u002Fgithub.com\u002Fstanfish06\u002Fskillquarium\u002Fblob\u002Fmaster\u002Fskills\u002Fmatlab-upgrade-mex-ic\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: matlab-upgrade-mex-ic\ndescription: >\n  Upgrade C, C++, and Fortran MEX source files from the Separate Complex (SC) API\n  to the Interleaved Complex (IC) API. Use when converting mxGetPr\u002FmxGetPi to\n  mxGetComplexDoubles, migrating MEX files to -R2018a, adding\n  MX_HAS_INTERLEAVED_COMPLEX guards for SC\u002FIC guarded builds, or modernizing\n  legacy MEX code that uses mxGetData\u002FmxSetData\u002FmxGetImagData\u002FmxSetImagData.\n  Covers C (.c), C++ (.cpp, .cxx), and Fortran (.F, .f90) MEX functions.\n  Triggers on: interleaved complex, IC MEX, mex upgrade, mex migration,\n  separate complex, mxGetPi, mxGetPr replacement, -R2018a, complex MEX,\n  Fortran MEX, .F MEX file, C++ MEX, .cpp MEX file, MEX performance,\n  MEX slow complex, MEX call overhead, improve MEX performance complex.\nlicense: MathWorks BSD-3-Clause\nmetadata:\n  author: MathWorks\n  version: \"1.0\"\n---\n\n# Upgrade MEX Files to Interleaved Complex API\n\nConvert C, C++, and Fortran MEX source files from the Separate Complex (SC) API to the Interleaved Complex (IC) API, following the MathWorks upgrade workflow with guardrails for SC\u002FIC guarded builds using `MX_HAS_INTERLEAVED_COMPLEX`, required vs recommended changes, and verification.\n\n## When to Use\n\n- User has a C, C++, or Fortran MEX file using `mxGetPr`\u002F`mxGetPi`, `mxGetData`\u002F`mxGetImagData`, or `mxSetPr`\u002F`mxSetPi`\n- User wants to build with `mex -R2018a`\n- User asks about interleaved complex, IC MEX, or modernizing MEX code\n- User has legacy MEX code from File Exchange, GitHub, or pre-R2018a era\n- User has a C++ MEX file (`.cpp`, `.cxx`) using the C Matrix API (`mxGetPr`\u002F`mxGetPi`, etc.)\n- User has a Fortran MEX file (`.F`, `.f90`) using `mxGetPr`\u002F`mxGetPi` via `%val()` pointers\n- User reports a MEX function is slow on large complex arrays (call overhead, not loop)\n- User asks how to improve MEX performance for complex data\n\n## When NOT to Use\n\n- Writing a new MEX function from scratch — no conversion needed, but advise the user to use IC APIs (`mxGetDoubles`, `mxGetComplexDoubles`, etc.) from the start for better performance on complex data and modern, type-safe data access instead of legacy `mxGetPr`\u002F`mxGetPi`\n- C++ MEX API (`matlab::mex::Function`) — different API entirely; this skill covers C++ files that use the C Matrix API (`mex.h`), not the MATLAB Data API for C++ and C++ Engine\n- MEX file already uses typed accessors (`mxGetDoubles`, `mxGetComplexDoubles`, etc.) — already IC-compatible, no conversion needed\n\n## Workflow\n\nFollow these 7 steps in order. Do NOT skip steps.\n\n### Step 1: Pre-Upgrade Verification\n\nBefore changing anything, understand the current state:\n\n1. Read the source file completely\n2. Identify all SC API calls (see [Key API Mappings](#key-api-mappings))\n3. Note which data types the MEX handles (double, single, int32, etc.)\n4. Note whether it handles complex data (`mxGetPi`, `mxIsComplex`, `mxCOMPLEX`)\n\nReport to the user:\n- Number of SC API calls found\n- Whether file processes complex numbers (complex arrays in SC mode incur deinterleave\u002Fre-interleave overhead)\n- **Performance impact:** If the file handles complex data, note that SC MEX calls incur O(n) deinterleave\u002Fre-interleave copies at the MATLAB boundary. For large arrays, IC conversion eliminates this overhead entirely (see [Performance Benefits](#performance-benefits-of-ic-conversion)).\n- Any other issues noticed (missing error checking, etc.)\n\n### Step 2: Output File Decision\n\n**ASK the user before proceeding:**\n\n> \"Where should I write the converted code?\n> - **New file** — creates a separate file (e.g., `\u003Cname>_ic.c` or `\u003Cname>_dual.c`), preserving the original untouched\n> - **Modify in place** — edits the original file directly. Choose this if the file is under version control and you can revert if needed.\"\n\nIf user chooses **new file**, use these naming defaults (or a user-specified name):\n- IC-only: `\u003Cname>_ic.c` \u002F `\u003Cname>_ic.F`\n- SC\u002FIC guarded: `\u003Cname>_dual.c` \u002F `\u003Cname>_dual.F`\n\nIf user chooses **modify in place**, confirm the file is recoverable (e.g., \"This file is tracked by git — you can revert with `git checkout \u003Cfile>` if needed.\"). Then edit the original directly.\n\nTell the user which file you're writing to and why.\n\n### Step 3: Decision Point — IC-Only or SC\u002FIC Guarded?\n\n> **What is \"SC\u002FIC guarded\"?** A single source file that uses `#if MX_HAS_INTERLEAVED_COMPLEX` preprocessor guards to compile under both the Separate Complex API (`mex -R2017b`) and the Interleaved Complex API (`mex -R2018a`). The compiler defines `MX_HAS_INTERLEAVED_COMPLEX=1` in IC mode and `0` in SC mode, so the guards select the correct code path at build time.\n\n**ASK the user before proceeding:**\n\n> \"Do you need this MEX file to compile under both the old SC API and the new IC API? \n> - **SC\u002FIC guarded** — wraps code in `#if MX_HAS_INTERLEAVED_COMPLEX` \u002F `#else` guards so the same source builds with both `mex -R2017b file.c` (SC mode) and `mex -R2018a file.c` (IC mode). Choose this if you support multiple MATLAB versions.\n> - **IC-only** — converts fully to IC API. Requires `mex -R2018a` to build. Simpler code but only works on R2018a+.\"\n\nIf user chooses **SC\u002FIC guarded**, use the `#if MX_HAS_INTERLEAVED_COMPLEX` preprocessor pattern:\n\n**C\u002FC++ files:**\n```c\n#if MX_HAS_INTERLEAVED_COMPLEX\n    \u002F* IC code path *\u002F\n    mxComplexDouble *pc = mxGetComplexDoubles(prhs[0]);\n#else\n    \u002F* SC code path *\u002F\n    double *pr = mxGetPr(prhs[0]);\n    double *pi = mxGetPi(prhs[0]);\n#endif\n```\n\n**Fortran files** (`.F` preprocessed source):\n```fortran\n#if MX_HAS_INTERLEAVED_COMPLEX\n      mwPointer mxGetComplexDoubles\n      complex*16, pointer :: pc(:)\n      call mxGetComplexDoubles(prhs(1), pc)\n#else\n      mwPointer mxGetPr, mxGetPi\n      mwPointer pr, pi\n      pr = mxGetPr(prhs(1))\n      pi = mxGetPi(prhs(1))\n#endif\n```\n\n> **Fortran note:** SC\u002FIC guarded Fortran files MUST use `.F` extension (uppercase) so the MEX compiler invokes the C preprocessor. The `.f` or `.f90` extension skips preprocessing and `#if` guards will not work. For `.f90` files that cannot use preprocessor guards, use IC-only conversion.\n\nIf user chooses **IC-only**, convert directly without guards.\n\n### Step 4: Iterative Refactoring\n\nAll legacy data-access APIs are **REQUIRED** to be converted for a complete IC upgrade. Convert every pattern in this table:\n\n| Legacy Pattern | Replacement | Reason |\n|----------------|-------------|--------|\n| `mxGetPi(arr)` for data access | `mxGetComplexDoubles(arr)` + `.imag` | Does not exist in IC |\n| `mxSetPi(arr, ptr)` | `mxSetComplexDoubles(arr, ptr)` | Does not exist in IC |\n| `mxGetImagData(arr)` | Type-specific complex accessor | Does not exist in IC |\n| `mxSetImagData(arr, ptr)` | Type-specific complex setter | Does not exist in IC |\n| `mxGetPi(arr) != NULL` for complexity check | `mxIsComplex(arr)` — works in both SC and IC | Does not exist in IC |\n| `mxGetPr(arr)` | `mxGetDoubles(arr)` | Wrong results on complex arrays in IC; untyped |\n| `mxSetPr(arr, ptr)` | `mxSetDoubles(arr, ptr)` | Wrong results on complex arrays in IC; untyped |\n| `mxGetData(arr)` + void* cast | Type-specific accessor (`mxGetDoubles`, `mxGetInt32s`, etc.) | Wrong results on complex arrays in IC; untyped |\n| `mxSetData(arr, ptr)` | Type-specific setter (`mxSetDoubles`, `mxSetInt32s`, etc.) | Wrong results on complex arrays in IC; untyped |\n\n> **Why all REQUIRED?** `mxGetPr`\u002F`mxGetData` on complex arrays in IC mode return a pointer to interleaved data (real and imaginary interleaved) — iterating as if it were real-only gives **wrong results silently**. On real-only arrays they still work, but are untyped (`void*` or always `double*`). When upgrading to IC, convert everything in one pass for correctness and type safety.\n\nSee `references\u002Fpitfalls.md` for common conversion mistakes (complexity checks, output allocation, buffer sizing, Fortran interleaved layout).\n\n### Reducing Code Duplication in SC\u002FIC Guarded Mode\n\nIn SC\u002FIC guarded mode, minimize duplication by guarding only the accessor calls, not entire logic blocks.\n\n**C\u002FC++ files:**\n```c\n\u002F* Guard only the pointer acquisition — logic stays shared *\u002F\ndouble *pr_in, *pr_out;\n\n#if MX_HAS_INTERLEAVED_COMPLEX\n    pr_in = mxGetDoubles(prhs[0]);\n#else\n    pr_in = mxGetPr(prhs[0]);\n#endif\n\nplhs[0] = mxCreateDoubleMatrix(m, n, mxREAL);\n\n#if MX_HAS_INTERLEAVED_COMPLEX\n    pr_out = mxGetDoubles(plhs[0]);\n#else\n    pr_out = mxGetPr(plhs[0]);\n#endif\n\n\u002F* Shared logic — no duplication *\u002F\nfor (i = 0; i \u003C numElements; i++) {\n    pr_out[i] = pr_in[i] * factor;\n}\n```\n\n**Fortran files (`.F`):**\n```fortran\nc     Guard only the pointer acquisition\n#if MX_HAS_INTERLEAVED_COMPLEX\n      pr_in = mxGetDoubles(prhs(1))\n#else\n      pr_in = mxGetPr(prhs(1))\n#endif\n\nc     Shared logic — no duplication\n      call mxCopyPtrToReal8(pr_in, data, numElements)\n      do i = 1, numElements\n          data(i) = data(i) * factor\n      end do\n```\n\nFor complex data, the layout differs between modes (interleaved struct vs separate arrays), so full `#if`\u002F`#else` blocks around the logic are unavoidable.\n\n**Rule of thumb:**\n- **Real data paths** — guard only the accessor, share the loop\n- **Complex data paths** — guard the entire block (different data layouts require different loop bodies). See `references\u002Fapi-mappings.md` § \"SC\u002FIC Guarded Pattern\" for full complex loop examples in C, C++, and Fortran.\n\nSee `references\u002Fapi-mappings.md` for the complete function mapping table.\n\n### Step 5: Build\n\nProvide the exact build commands (adjust extension for language):\n\n```matlab\n% C\u002FC++ files\nmex -R2018a \u003Cfilename>.c       % Explicit IC mode\nmex -R2017b \u003Cfilename>.c       % Explicit SC mode\nmex \u003Cfilename>.c               % Default (version-dependent)\n% For C++: same flags with .cpp or .cxx extension\nmex -R2018a \u003Cfilename>.cpp     % Explicit IC mode\n\n% Fortran files (.F with preprocessor guards)\nmex -R2018a \u003Cfilename>.F       % Explicit IC mode\nmex -R2017b \u003Cfilename>.F       % Explicit SC mode\nmex \u003Cfilename>.F               % Default (version-dependent)\n```\n\nIf the file is SC\u002FIC guarded, remind the user to test all three build modes: `-R2017b` (SC), `-R2018a` (IC), and default (no flag).\n\n> **Fortran:** Files must use `.F` (uppercase) extension for preprocessor guards to work. If the source is `.f` or `.f90`, rename to `.F` or `.F90` when adding `#if` guards.\n\n### Step 6: Verify\n\nProvide MATLAB test commands that compare the converted MEX against the original.\n\n**For IC-only conversions** (separate source files):\n\n```matlab\n%% Build original with SC, converted with IC\nmex -R2017b originalFile.c -output func_sc    % Explicit SC build\nmex -R2018a convertedFile_ic.c -output func_ic % Explicit IC build\n\n%% Compare outputs\nZ = complex(rand(4,4), rand(4,4));\nassert(isequal(func_sc(Z), func_ic(Z)), 'Output mismatch!');\n```\n\n**For SC\u002FIC guarded files** (same source, three build modes):\n\n```matlab\n%% Build same source in all three modes\nmex -R2017b convertedFile.c -output func_sc       % Explicit SC (forces separate complex)\nmex -R2018a convertedFile.c -output func_ic       % Explicit IC (forces interleaved complex)\nmex convertedFile.c -output func_default           % Default (no API flag)\n\n%% Compare outputs — all three must match\nZ = complex(rand(4,4), rand(4,4));\nout_sc = func_sc(Z);\nout_ic = func_ic(Z);\nout_default = func_default(Z);\nassert(isequal(out_sc, out_ic), 'SC vs IC mismatch!');\nassert(isequal(out_sc, out_default), 'SC vs default mismatch!');\n```\n\nAlways test with:\n- Complex inputs (if the MEX handles complex data)\n- Real inputs (if the MEX handles real data)\n- Edge cases: empty arrays, scalars, large arrays\n- All three build modes: `-R2017b` (SC), `-R2018a` (IC), and default (no flag)\n- The original source file still compiles with `mex -R2017b` (confirms it was not modified)\n\n### Step 7: Document\n\nAdd build information to the converted file's header comment:\n\n```c\n\u002F*\n * Compile (Interleaved Complex API, R2018a+):\n *   mex -R2018a filename.c\n *\n * Original (Separate Complex API):\n *   mex originalFilename.c\n *\n * API Migration:\n *   mxGetPr\u002FmxGetPi -> mxGetComplexDoubles\n *   mxSetPr\u002FmxSetPi -> mxSetComplexDoubles\n *\u002F\n```\n\n## Performance Benefits of IC Conversion\n\nIC conversion is not just API modernization — it delivers measurable performance gains for MEX functions that handle complex data.\n\n### Why IC Is Faster\n\nSince R2018a, MATLAB stores complex arrays internally in **interleaved format** (`[re0, im0, re1, im1, ...]`). When a MEX function compiled with the SC API is called:\n\n1. **On entry:** MATLAB deinterleaves the input — splitting one contiguous buffer into two separate real\u002Fimag arrays. This is an O(n) copy.\n2. **On exit:** MATLAB re-interleaves the output — merging separate buffers back. Another O(n) copy.\n\nFor a 10M-element complex double array, that's ~80 MB per complex array crossing the boundary (N × 16 bytes). A MEX with one complex input and one complex output pays ~160 MB total; a MEX with three complex inputs pays ~240 MB on input alone.\n\nIC MEX functions access data in MATLAB's native layout — **zero copy** at the boundary.\n\n### Additional Performance Advantages\n\n- **Cache locality:** `z[i].real` and `z[i].imag` are adjacent (same cache line). SC requires jumping between two arrays millions of elements apart.\n- **Single memcpy for bulk copy:** Duplicating a complex array is one `memcpy(dst, src, n * sizeof(mxComplexDouble))` vs two separate copies.\n- **FFTW\u002FBLAS\u002FLAPACK interop:** IC layout is byte-for-byte compatible with `fftw_complex`, `double _Complex` (C99), and cuBLAS\u002FcuFFT types — no pack\u002Funpack needed.\n- **SIMD-friendly:** Compilers can emit packed-double instructions that load a full complex number in one operation.\n\n### When Performance Justifies IC Migration\n\n| Scenario | Speedup Significance |\n|----------|---------------------|\n| Large complex arrays (>100K elements) | High — boundary copy dominates |\n| Frequent MEX calls in a loop | High — copy overhead accumulates |\n| MEX wraps FFTW\u002FBLAS calls | High — eliminates pack\u002Funpack |\n| Small arrays (\u003C1K elements) | Low — copy overhead negligible |\n| Real-only data (no `mxGetPi`) | None — no deinterleave occurs |\n\nTell the user: *\"For your [N]-element complex array, the SC API forces MATLAB to copy ~[N×16\u002F1e6] MB per complex array argument. With [K] complex arrays crossing the boundary, that's ~[K×N×16\u002F1e6] MB per call. IC eliminates this entirely.\"*\n\n### Benchmark Template\n\nAfter conversion, offer this benchmark to quantify the speedup:\n\n```matlab\n%% Benchmark SC vs IC MEX performance\nN = 1e7;  % 10M complex elements\nZ = randn(1,N) + 1i*randn(1,N);\nnumIter = 20;\n\n% Build both versions\nmex -R2017b originalFile.c -output func_sc\nmex -R2018a convertedFile_ic.c -output func_ic\n\n% Warmup\nfor k = 1:3, func_sc(Z); func_ic(Z); end\n\n% Time SC\ntSC = zeros(numIter,1);\nfor k = 1:numIter, tic; func_sc(Z); tSC(k) = toc; end\n\n% Time IC\ntIC = zeros(numIter,1);\nfor k = 1:numIter, tic; func_ic(Z); tIC(k) = toc; end\n\nfprintf('SC median: %.2f ms\\n', median(tSC)*1000);\nfprintf('IC median: %.2f ms\\n', median(tIC)*1000);\nfprintf('Speedup: %.1fx\\n', median(tSC)\u002Fmedian(tIC));\nassert(isequal(func_sc(Z), func_ic(Z)), 'Output mismatch!');\n```\n\n### Optimization Tips\n\n- **Use `mxDuplicateArray` for in-place-style operations:** `plhs[0] = mxDuplicateArray(prhs[0]); z = mxGetComplexDoubles(plhs[0]);` — then modify `z[i]` directly. Avoids manual allocation and lets MATLAB optimize the copy.\n- **Single-pass loops:** In IC mode, conjugation or scaling touches both `.real` and `.imag` in one loop iteration with perfect spatial locality.\n- **Avoid unnecessary `mxMalloc`:** Create output as `mxCOMPLEX` and write directly into the buffer from `mxGetComplexDoubles` — no intermediate allocation.\n\n## Key API Mappings\n\nSummary of the most common conversions. Full table in `references\u002Fapi-mappings.md`.\n\n### Complex Data Access\n\n| SC API | IC API | Type |\n|--------|--------|------|\n| `mxGetPr` + `mxGetPi` | `mxGetComplexDoubles` | Required |\n| `mxSetPr` + `mxSetPi` | `mxSetComplexDoubles` | Required |\n| `mxGetImagData` | Type-specific complex accessor | Required |\n| `mxSetImagData` | Type-specific complex setter | Required |\n| `mxGetPi(x) != NULL` | `mxIsComplex(x)` | Required |\n\n### Real Data Access (Not Recommended in IC)\n\n| SC API | IC API | Status |\n|--------|--------|--------|\n| `mxGetPr` | `mxGetDoubles` | Not recommended — replace |\n| `mxSetPr` | `mxSetDoubles` | Not recommended — replace |\n| `mxGetData` | `mxGetDoubles`\u002F`mxGetInt32s`\u002Fetc. | Not recommended — replace |\n| `mxSetData` | `mxSetDoubles`\u002F`mxSetInt32s`\u002Fetc. | Not recommended — replace |\n\n### Complex Data Types (IC mode)\n\n```c\nmxComplexDouble  \u002F* struct with .real and .imag (both double) *\u002F\nmxComplexSingle  \u002F* struct with .real and .imag (both float) *\u002F\nmxComplexInt32   \u002F* struct with .real and .imag (both int32_T) *\u002F\n```\n\n## Conventions\n\n- **Always ask** whether to create a new file or modify in place before writing\n- **Always explain** the reason for each change (does not exist in IC, or wrong results on complex arrays \u002F untyped)\n- **Always ask** whether to use SC\u002FIC guarded mode or IC-only before converting\n- **Always provide** verification test commands\n- **Use `mxIsComplex()`** for complexity checks — never `mxGetPi() != NULL`. `mxIsComplex` works in both SC and IC modes, so it can be placed outside `#if` guards.\n- **Buffer sizing in IC mode:** `mxGetElementSize()` returns the full interleaved size (16 bytes for complex double). Do NOT multiply by 2.\n- **File naming (when creating new file):** `_ic.c`\u002F`_ic.cpp` or `_ic.F` suffix for IC-only conversions; `_dual.c`\u002F`_dual.cpp`\u002F`_dual.F` for SC\u002FIC guarded; or modify in place if user chooses\n- **C89 compatibility (C files only):** Declare variables at the top of each `#if`\u002F`#else` block or at the top of the function. MEX compilers may enforce C89 rules where declarations must precede statements. C++ files do not have this restriction.\n- **Fortran file extensions:** Use `.F` (uppercase) for SC\u002FIC guarded Fortran files so the C preprocessor processes `#if MX_HAS_INTERLEAVED_COMPLEX` guards. `.f` and `.f90` do not invoke the preprocessor.\n- **Fortran pointer handling:** In Fortran MEX, data pointers are `mwPointer` integers passed via `%val()` to copy routines (`mxCopyPtrToReal8`, `mxCopyPtrToComplex16`). In IC mode, use `mxGetComplexDoubles` which returns an `mwPointer` to the interleaved buffer.\n\n## Common Mistakes\n\n| Mistake | Why It's Wrong | Correct Approach |\n|---------|---------------|-----------------|\n| Modifying without asking | User may lose the working SC version if not under version control | Always ask: new file or modify in place? |\n| Leaving `mxGetPr`\u002F`mxGetData` calls unchanged | Not recommended by MathWorks in IC MEX functions | Replace with typed accessors (`mxGetDoubles`, `mxGetInt32s`, etc.) |\n| `numElements * mxGetElementSize(arr) * 2` for complex buffer | `mxGetElementSize` already returns 16 in IC mode | Use `numElements * mxGetElementSize(arr)` without doubling |\n| Using `mxGetPi(arr) != NULL` to check complexity | `mxGetPi` doesn't exist in IC mode | Use `mxIsComplex(arr)` |\n| Converting without asking about compatibility needs | User may need the file to work on older MATLAB | Always ask: IC-only or SC\u002FIC guarded? |\n| Not providing verification steps | Silent wrong answers are catastrophic in MEX | Always provide test commands comparing old vs new output |\n\n----\n\nCopyright 2026 The MathWorks, Inc.\n\n----\n","# Upgrade MEX Files to Interleaved Complex API\n\nConvert C, C++, and Fortran MEX source files from the Separate Complex (SC) API to the Interleaved Complex (IC) API, following the MathWorks upgrade workflow with guardrails for SC\u002FIC guarded builds using `MX_HAS_INTERLEAVED_COMPLEX`, required vs recommended changes, and verification.\n\n## When to Use\n\n- User has a C, C++, or Fortran MEX file using `mxGetPr`\u002F`mxGetPi`, `mxGetData`\u002F`mxGetImagData`, or `mxSetPr`\u002F`mxSetPi`\n- User wants to build with `mex -R2018a`\n- User asks about interleaved complex, IC MEX, or modernizing MEX code\n- User has legacy MEX code from File Exchange, GitHub, or pre-R2018a era\n- User has a C++ MEX file (`.cpp`, `.cxx`) using the C Matrix API (`mxGetPr`\u002F`mxGetPi`, etc.)\n- User has a Fortran MEX file (`.F`, `.f90`) using `mxGetPr`\u002F`mxGetPi` via `%val()` pointers\n- User reports a MEX function is slow on large complex arrays (call overhead, not loop)\n- User asks how to improve MEX performance for complex data\n\n## When NOT to Use\n\n- Writing a new MEX function from scratch — no conversion needed, but advise the user to use IC APIs (`mxGetDoubles`, `mxGetComplexDoubles`, etc.) from the start for better performance on complex data and modern, type-safe data access instead of legacy `mxGetPr`\u002F`mxGetPi`\n- C++ MEX API (`matlab::mex::Function`) — different API entirely; this skill covers C++ files that use the C Matrix API (`mex.h`), not the MATLAB Data API for C++ and C++ Engine\n- MEX file already uses typed accessors (`mxGetDoubles`, `mxGetComplexDoubles`, etc.) — already IC-compatible, no conversion needed\n\n## Workflow\n\nFollow these 7 steps in order. Do NOT skip steps.\n\n### Step 1: Pre-Upgrade Verification\n\nBefore changing anything, understand the current state:\n\n1. Read the source file completely\n2. Identify all SC API calls (see [Key API Mappings](#key-api-mappings))\n3. Note which data types the MEX handles (double, single, int32, etc.)\n4. Note whether it handles complex data (`mxGetPi`, `mxIsComplex`, `mxCOMPLEX`)\n\nReport to the user:\n- Number of SC API calls found\n- Whether file processes complex numbers (complex arrays in SC mode incur deinterleave\u002Fre-interleave overhead)\n- **Performance impact:** If the file handles complex data, note that SC MEX calls incur O(n) deinterleave\u002Fre-interleave copies at the MATLAB boundary. For large arrays, IC conversion eliminates this overhead entirely (see [Performance Benefits](#performance-benefits-of-ic-conversion)).\n- Any other issues noticed (missing error checking, etc.)\n\n### Step 2: Output File Decision\n\n**ASK the user before proceeding:**\n\n> \"Where should I write the converted code?\n> - **New file** — creates a separate file (e.g., `\u003Cname>_ic.c` or `\u003Cname>_dual.c`), preserving the original untouched\n> - **Modify in place** — edits the original file directly. Choose this if the file is under version control and you can revert if needed.\"\n\nIf user chooses **new file**, use these naming defaults (or a user-specified name):\n- IC-only: `\u003Cname>_ic.c` \u002F `\u003Cname>_ic.F`\n- SC\u002FIC guarded: `\u003Cname>_dual.c` \u002F `\u003Cname>_dual.F`\n\nIf user chooses **modify in place**, confirm the file is recoverable (e.g., \"This file is tracked by git — you can revert with `git checkout \u003Cfile>` if needed.\"). Then edit the original directly.\n\nTell the user which file you're writing to and why.\n\n### Step 3: Decision Point — IC-Only or SC\u002FIC Guarded?\n\n> **What is \"SC\u002FIC guarded\"?** A single source file that uses `#if MX_HAS_INTERLEAVED_COMPLEX` preprocessor guards to compile under both the Separate Complex API (`mex -R2017b`) and the Interleaved Complex API (`mex -R2018a`). The compiler defines `MX_HAS_INTERLEAVED_COMPLEX=1` in IC mode and `0` in SC mode, so the guards select the correct code path at build time.\n\n**ASK the user before proceeding:**\n\n> \"Do you need this MEX file to compile under both the old SC API and the new IC API? \n> - **SC\u002FIC guarded** — wraps code in `#if MX_HAS_INTERLEAVED_COMPLEX` \u002F `#else` guards so the same source builds with both `mex -R2017b file.c` (SC mode) and `mex -R2018a file.c` (IC mode). Choose this if you support multiple MATLAB versions.\n> - **IC-only** — converts fully to IC API. Requires `mex -R2018a` to build. Simpler code but only works on R2018a+.\"\n\nIf user chooses **SC\u002FIC guarded**, use the `#if MX_HAS_INTERLEAVED_COMPLEX` preprocessor pattern:\n\n**C\u002FC++ files:**\n```c\n#if MX_HAS_INTERLEAVED_COMPLEX\n    \u002F* IC code path *\u002F\n    mxComplexDouble *pc = mxGetComplexDoubles(prhs[0]);\n#else\n    \u002F* SC code path *\u002F\n    double *pr = mxGetPr(prhs[0]);\n    double *pi = mxGetPi(prhs[0]);\n#endif\n```\n\n**Fortran files** (`.F` preprocessed source):\n```fortran\n#if MX_HAS_INTERLEAVED_COMPLEX\n      mwPointer mxGetComplexDoubles\n      complex*16, pointer :: pc(:)\n      call mxGetComplexDoubles(prhs(1), pc)\n#else\n      mwPointer mxGetPr, mxGetPi\n      mwPointer pr, pi\n      pr = mxGetPr(prhs(1))\n      pi = mxGetPi(prhs(1))\n#endif\n```\n\n> **Fortran note:** SC\u002FIC guarded Fortran files MUST use `.F` extension (uppercase) so the MEX compiler invokes the C preprocessor. The `.f` or `.f90` extension skips preprocessing and `#if` guards will not work. For `.f90` files that cannot use preprocessor guards, use IC-only conversion.\n\nIf user chooses **IC-only**, convert directly without guards.\n\n### Step 4: Iterative Refactoring\n\nAll legacy data-access APIs are **REQUIRED** to be converted for a complete IC upgrade. Convert every pattern in this table:\n\n| Legacy Pattern | Replacement | Reason |\n|----------------|-------------|--------|\n| `mxGetPi(arr)` for data access | `mxGetComplexDoubles(arr)` + `.imag` | Does not exist in IC |\n| `mxSetPi(arr, ptr)` | `mxSetComplexDoubles(arr, ptr)` | Does not exist in IC |\n| `mxGetImagData(arr)` | Type-specific complex accessor | Does not exist in IC |\n| `mxSetImagData(arr, ptr)` | Type-specific complex setter | Does not exist in IC |\n| `mxGetPi(arr) != NULL` for complexity check | `mxIsComplex(arr)` — works in both SC and IC | Does not exist in IC |\n| `mxGetPr(arr)` | `mxGetDoubles(arr)` | Wrong results on complex arrays in IC; untyped |\n| `mxSetPr(arr, ptr)` | `mxSetDoubles(arr, ptr)` | Wrong results on complex arrays in IC; untyped |\n| `mxGetData(arr)` + void* cast | Type-specific accessor (`mxGetDoubles`, `mxGetInt32s`, etc.) | Wrong results on complex arrays in IC; untyped |\n| `mxSetData(arr, ptr)` | Type-specific setter (`mxSetDoubles`, `mxSetInt32s`, etc.) | Wrong results on complex arrays in IC; untyped |\n\n> **Why all REQUIRED?** `mxGetPr`\u002F`mxGetData` on complex arrays in IC mode return a pointer to interleaved data (real and imaginary interleaved) — iterating as if it were real-only gives **wrong results silently**. On real-only arrays they still work, but are untyped (`void*` or always `double*`). When upgrading to IC, convert everything in one pass for correctness and type safety.\n\nSee `references\u002Fpitfalls.md` for common conversion mistakes (complexity checks, output allocation, buffer sizing, Fortran interleaved layout).\n\n### Reducing Code Duplication in SC\u002FIC Guarded Mode\n\nIn SC\u002FIC guarded mode, minimize duplication by guarding only the accessor calls, not entire logic blocks.\n\n**C\u002FC++ files:**\n```c\n\u002F* Guard only the pointer acquisition — logic stays shared *\u002F\ndouble *pr_in, *pr_out;\n\n#if MX_HAS_INTERLEAVED_COMPLEX\n    pr_in = mxGetDoubles(prhs[0]);\n#else\n    pr_in = mxGetPr(prhs[0]);\n#endif\n\nplhs[0] = mxCreateDoubleMatrix(m, n, mxREAL);\n\n#if MX_HAS_INTERLEAVED_COMPLEX\n    pr_out = mxGetDoubles(plhs[0]);\n#else\n    pr_out = mxGetPr(plhs[0]);\n#endif\n\n\u002F* Shared logic — no duplication *\u002F\nfor (i = 0; i \u003C numElements; i++) {\n    pr_out[i] = pr_in[i] * factor;\n}\n```\n\n**Fortran files (`.F`):**\n```fortran\nc     Guard only the pointer acquisition\n#if MX_HAS_INTERLEAVED_COMPLEX\n      pr_in = mxGetDoubles(prhs(1))\n#else\n      pr_in = mxGetPr(prhs(1))\n#endif\n\nc     Shared logic — no duplication\n      call mxCopyPtrToReal8(pr_in, data, numElements)\n      do i = 1, numElements\n          data(i) = data(i) * factor\n      end do\n```\n\nFor complex data, the layout differs between modes (interleaved struct vs separate arrays), so full `#if`\u002F`#else` blocks around the logic are unavoidable.\n\n**Rule of thumb:**\n- **Real data paths** — guard only the accessor, share the loop\n- **Complex data paths** — guard the entire block (different data layouts require different loop bodies). See `references\u002Fapi-mappings.md` § \"SC\u002FIC Guarded Pattern\" for full complex loop examples in C, C++, and Fortran.\n\nSee `references\u002Fapi-mappings.md` for the complete function mapping table.\n\n### Step 5: Build\n\nProvide the exact build commands (adjust extension for language):\n\n```matlab\n% C\u002FC++ files\nmex -R2018a \u003Cfilename>.c       % Explicit IC mode\nmex -R2017b \u003Cfilename>.c       % Explicit SC mode\nmex \u003Cfilename>.c               % Default (version-dependent)\n% For C++: same flags with .cpp or .cxx extension\nmex -R2018a \u003Cfilename>.cpp     % Explicit IC mode\n\n% Fortran files (.F with preprocessor guards)\nmex -R2018a \u003Cfilename>.F       % Explicit IC mode\nmex -R2017b \u003Cfilename>.F       % Explicit SC mode\nmex \u003Cfilename>.F               % Default (version-dependent)\n```\n\nIf the file is SC\u002FIC guarded, remind the user to test all three build modes: `-R2017b` (SC), `-R2018a` (IC), and default (no flag).\n\n> **Fortran:** Files must use `.F` (uppercase) extension for preprocessor guards to work. If the source is `.f` or `.f90`, rename to `.F` or `.F90` when adding `#if` guards.\n\n### Step 6: Verify\n\nProvide MATLAB test commands that compare the converted MEX against the original.\n\n**For IC-only conversions** (separate source files):\n\n```matlab\n%% Build original with SC, converted with IC\nmex -R2017b originalFile.c -output func_sc    % Explicit SC build\nmex -R2018a convertedFile_ic.c -output func_ic % Explicit IC build\n\n%% Compare outputs\nZ = complex(rand(4,4), rand(4,4));\nassert(isequal(func_sc(Z), func_ic(Z)), 'Output mismatch!');\n```\n\n**For SC\u002FIC guarded files** (same source, three build modes):\n\n```matlab\n%% Build same source in all three modes\nmex -R2017b convertedFile.c -output func_sc       % Explicit SC (forces separate complex)\nmex -R2018a convertedFile.c -output func_ic       % Explicit IC (forces interleaved complex)\nmex convertedFile.c -output func_default           % Default (no API flag)\n\n%% Compare outputs — all three must match\nZ = complex(rand(4,4), rand(4,4));\nout_sc = func_sc(Z);\nout_ic = func_ic(Z);\nout_default = func_default(Z);\nassert(isequal(out_sc, out_ic), 'SC vs IC mismatch!');\nassert(isequal(out_sc, out_default), 'SC vs default mismatch!');\n```\n\nAlways test with:\n- Complex inputs (if the MEX handles complex data)\n- Real inputs (if the MEX handles real data)\n- Edge cases: empty arrays, scalars, large arrays\n- All three build modes: `-R2017b` (SC), `-R2018a` (IC), and default (no flag)\n- The original source file still compiles with `mex -R2017b` (confirms it was not modified)\n\n### Step 7: Document\n\nAdd build information to the converted file's header comment:\n\n```c\n\u002F*\n * Compile (Interleaved Complex API, R2018a+):\n *   mex -R2018a filename.c\n *\n * Original (Separate Complex API):\n *   mex originalFilename.c\n *\n * API Migration:\n *   mxGetPr\u002FmxGetPi -> mxGetComplexDoubles\n *   mxSetPr\u002FmxSetPi -> mxSetComplexDoubles\n *\u002F\n```\n\n## Performance Benefits of IC Conversion\n\nIC conversion is not just API modernization — it delivers measurable performance gains for MEX functions that handle complex data.\n\n### Why IC Is Faster\n\nSince R2018a, MATLAB stores complex arrays internally in **interleaved format** (`[re0, im0, re1, im1, ...]`). When a MEX function compiled with the SC API is called:\n\n1. **On entry:** MATLAB deinterleaves the input — splitting one contiguous buffer into two separate real\u002Fimag arrays. This is an O(n) copy.\n2. **On exit:** MATLAB re-interleaves the output — merging separate buffers back. Another O(n) copy.\n\nFor a 10M-element complex double array, that's ~80 MB per complex array crossing the boundary (N × 16 bytes). A MEX with one complex input and one complex output pays ~160 MB total; a MEX with three complex inputs pays ~240 MB on input alone.\n\nIC MEX functions access data in MATLAB's native layout — **zero copy** at the boundary.\n\n### Additional Performance Advantages\n\n- **Cache locality:** `z[i].real` and `z[i].imag` are adjacent (same cache line). SC requires jumping between two arrays millions of elements apart.\n- **Single memcpy for bulk copy:** Duplicating a complex array is one `memcpy(dst, src, n * sizeof(mxComplexDouble))` vs two separate copies.\n- **FFTW\u002FBLAS\u002FLAPACK interop:** IC layout is byte-for-byte compatible with `fftw_complex`, `double _Complex` (C99), and cuBLAS\u002FcuFFT types — no pack\u002Funpack needed.\n- **SIMD-friendly:** Compilers can emit packed-double instructions that load a full complex number in one operation.\n\n### When Performance Justifies IC Migration\n\n| Scenario | Speedup Significance |\n|----------|---------------------|\n| Large complex arrays (>100K elements) | High — boundary copy dominates |\n| Frequent MEX calls in a loop | High — copy overhead accumulates |\n| MEX wraps FFTW\u002FBLAS calls | High — eliminates pack\u002Funpack |\n| Small arrays (\u003C1K elements) | Low — copy overhead negligible |\n| Real-only data (no `mxGetPi`) | None — no deinterleave occurs |\n\nTell the user: *\"For your [N]-element complex array, the SC API forces MATLAB to copy ~[N×16\u002F1e6] MB per complex array argument. With [K] complex arrays crossing the boundary, that's ~[K×N×16\u002F1e6] MB per call. IC eliminates this entirely.\"*\n\n### Benchmark Template\n\nAfter conversion, offer this benchmark to quantify the speedup:\n\n```matlab\n%% Benchmark SC vs IC MEX performance\nN = 1e7;  % 10M complex elements\nZ = randn(1,N) + 1i*randn(1,N);\nnumIter = 20;\n\n% Build both versions\nmex -R2017b originalFile.c -output func_sc\nmex -R2018a convertedFile_ic.c -output func_ic\n\n% Warmup\nfor k = 1:3, func_sc(Z); func_ic(Z); end\n\n% Time SC\ntSC = zeros(numIter,1);\nfor k = 1:numIter, tic; func_sc(Z); tSC(k) = toc; end\n\n% Time IC\ntIC = zeros(numIter,1);\nfor k = 1:numIter, tic; func_ic(Z); tIC(k) = toc; end\n\nfprintf('SC median: %.2f ms\\n', median(tSC)*1000);\nfprintf('IC median: %.2f ms\\n', median(tIC)*1000);\nfprintf('Speedup: %.1fx\\n', median(tSC)\u002Fmedian(tIC));\nassert(isequal(func_sc(Z), func_ic(Z)), 'Output mismatch!');\n```\n\n### Optimization Tips\n\n- **Use `mxDuplicateArray` for in-place-style operations:** `plhs[0] = mxDuplicateArray(prhs[0]); z = mxGetComplexDoubles(plhs[0]);` — then modify `z[i]` directly. Avoids manual allocation and lets MATLAB optimize the copy.\n- **Single-pass loops:** In IC mode, conjugation or scaling touches both `.real` and `.imag` in one loop iteration with perfect spatial locality.\n- **Avoid unnecessary `mxMalloc`:** Create output as `mxCOMPLEX` and write directly into the buffer from `mxGetComplexDoubles` — no intermediate allocation.\n\n## Key API Mappings\n\nSummary of the most common conversions. Full table in `references\u002Fapi-mappings.md`.\n\n### Complex Data Access\n\n| SC API | IC API | Type |\n|--------|--------|------|\n| `mxGetPr` + `mxGetPi` | `mxGetComplexDoubles` | Required |\n| `mxSetPr` + `mxSetPi` | `mxSetComplexDoubles` | Required |\n| `mxGetImagData` | Type-specific complex accessor | Required |\n| `mxSetImagData` | Type-specific complex setter | Required |\n| `mxGetPi(x) != NULL` | `mxIsComplex(x)` | Required |\n\n### Real Data Access (Not Recommended in IC)\n\n| SC API | IC API | Status |\n|--------|--------|--------|\n| `mxGetPr` | `mxGetDoubles` | Not recommended — replace |\n| `mxSetPr` | `mxSetDoubles` | Not recommended — replace |\n| `mxGetData` | `mxGetDoubles`\u002F`mxGetInt32s`\u002Fetc. | Not recommended — replace |\n| `mxSetData` | `mxSetDoubles`\u002F`mxSetInt32s`\u002Fetc. | Not recommended — replace |\n\n### Complex Data Types (IC mode)\n\n```c\nmxComplexDouble  \u002F* struct with .real and .imag (both double) *\u002F\nmxComplexSingle  \u002F* struct with .real and .imag (both float) *\u002F\nmxComplexInt32   \u002F* struct with .real and .imag (both int32_T) *\u002F\n```\n\n## Conventions\n\n- **Always ask** whether to create a new file or modify in place before writing\n- **Always explain** the reason for each change (does not exist in IC, or wrong results on complex arrays \u002F untyped)\n- **Always ask** whether to use SC\u002FIC guarded mode or IC-only before converting\n- **Always provide** verification test commands\n- **Use `mxIsComplex()`** for complexity checks — never `mxGetPi() != NULL`. `mxIsComplex` works in both SC and IC modes, so it can be placed outside `#if` guards.\n- **Buffer sizing in IC mode:** `mxGetElementSize()` returns the full interleaved size (16 bytes for complex double). Do NOT multiply by 2.\n- **File naming (when creating new file):** `_ic.c`\u002F`_ic.cpp` or `_ic.F` suffix for IC-only conversions; `_dual.c`\u002F`_dual.cpp`\u002F`_dual.F` for SC\u002FIC guarded; or modify in place if user chooses\n- **C89 compatibility (C files only):** Declare variables at the top of each `#if`\u002F`#else` block or at the top of the function. MEX compilers may enforce C89 rules where declarations must precede statements. C++ files do not have this restriction.\n- **Fortran file extensions:** Use `.F` (uppercase) for SC\u002FIC guarded Fortran files so the C preprocessor processes `#if MX_HAS_INTERLEAVED_COMPLEX` guards. `.f` and `.f90` do not invoke the preprocessor.\n- **Fortran pointer handling:** In Fortran MEX, data pointers are `mwPointer` integers passed via `%val()` to copy routines (`mxCopyPtrToReal8`, `mxCopyPtrToComplex16`). In IC mode, use `mxGetComplexDoubles` which returns an `mwPointer` to the interleaved buffer.\n\n## Common Mistakes\n\n| Mistake | Why It's Wrong | Correct Approach |\n|---------|---------------|-----------------|\n| Modifying without asking | User may lose the working SC version if not under version control | Always ask: new file or modify in place? |\n| Leaving `mxGetPr`\u002F`mxGetData` calls unchanged | Not recommended by MathWorks in IC MEX functions | Replace with typed accessors (`mxGetDoubles`, `mxGetInt32s`, etc.) |\n| `numElements * mxGetElementSize(arr) * 2` for complex buffer | `mxGetElementSize` already returns 16 in IC mode | Use `numElements * mxGetElementSize(arr)` without doubling |\n| Using `mxGetPi(arr) != NULL` to check complexity | `mxGetPi` doesn't exist in IC mode | Use `mxIsComplex(arr)` |\n| Converting without asking about compatibility needs | User may need the file to work on older MATLAB | Always ask: IC-only or SC\u002FIC guarded? |\n| Not providing verification steps | Silent wrong answers are catastrophic in MEX | Always provide test commands comparing old vs new output |\n\n----\n\nCopyright 2026 The MathWorks, Inc.\n\n----\n",{"name":5,"license":25,"metadata":26,"description":29},"MathWorks BSD-3-Clause",{"author":27,"version":28},"MathWorks","1.0","Upgrade C, C++, and Fortran MEX source files from the Separate Complex (SC) API to the Interleaved Complex (IC) API. Use when converting mxGetPr\u002FmxGetPi to mxGetComplexDoubles, migrating MEX files to -R2018a, adding MX_HAS_INTERLEAVED_COMPLEX guards for SC\u002FIC guarded builds, or modernizing legacy MEX code that uses mxGetData\u002FmxSetData\u002FmxGetImagData\u002FmxSetImagData. Covers C (.c), C++ (.cpp, .cxx), and Fortran (.F, .f90) MEX functions. Triggers on: interleaved complex, IC MEX, mex upgrade, mex migration, separate complex, mxGetPi, mxGetPr replacement, -R2018a, complex MEX, Fortran MEX, .F MEX file, C++ MEX, .cpp MEX file, MEX performance, MEX slow complex, MEX call overhead, improve MEX performance complex.\n","master","49e49abf2f670d429e0b7e2c0349739c3fdd5cbe","skills\u002Fmatlab-upgrade-mex-ic",5,"https:\u002F\u002Fgithub.com\u002Fstanfish06\u002Fskillquarium","https:\u002F\u002Fgithub.com\u002Fstanfish06","https:\u002F\u002Fwww.stanfish.dev\u002F","2026-11-14 21:31:37",{"source":8,"skillName":5,"commands":39,"prompt":49,"zipAvailable":50},[40,43,46],{"tool":41,"command":42},"npx","npx skills add stanfish06\u002Fskillquarium --skill matlab-upgrade-mex-ic",{"tool":44,"command":45},"bunx","bunx skills add stanfish06\u002Fskillquarium --skill matlab-upgrade-mex-ic",{"tool":47,"command":48},"pnpm","pnpm dlx skills add stanfish06\u002Fskillquarium --skill matlab-upgrade-mex-ic","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fstanfish06\u002Fskillquarium\u002Fblob\u002Fmaster\u002Fskills\u002Fmatlab-upgrade-mex-ic\u002FSKILL.md",true,[52,57,63,67],{"path":53,"resourceType":54,"resourceTypeDesc":55,"sizeBytes":56,"sourceHtmlUrl":16},"LICENSE.md","LICENSE","许可证",1482,{"path":58,"resourceType":59,"resourceTypeDesc":60,"sizeBytes":61,"sourceHtmlUrl":62},"manifest.yaml","REFERENCE","参考文档",447,"https:\u002F\u002Fgithub.com\u002Fstanfish06\u002Fskillquarium\u002Fblob\u002Fmaster\u002Fskills\u002Fmatlab-upgrade-mex-ic\u002Fmanifest.yaml",{"path":64,"resourceType":59,"resourceTypeDesc":60,"sizeBytes":65,"sourceHtmlUrl":66},"references\u002Fapi-mappings.md",7647,"https:\u002F\u002Fgithub.com\u002Fstanfish06\u002Fskillquarium\u002Fblob\u002Fmaster\u002Fskills\u002Fmatlab-upgrade-mex-ic\u002Freferences\u002Fapi-mappings.md",{"path":68,"resourceType":59,"resourceTypeDesc":60,"sizeBytes":69,"sourceHtmlUrl":70},"references\u002Fpitfalls.md",7402,"https:\u002F\u002Fgithub.com\u002Fstanfish06\u002Fskillquarium\u002Fblob\u002Fmaster\u002Fskills\u002Fmatlab-upgrade-mex-ic\u002Freferences\u002Fpitfalls.md",[72,80,89,96,103,110],{"skillNo":73,"name":74,"nameZh":6,"description":75,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":76,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":20},"01M76ZJTRVA456GD7K8Y3EP82H","zarr-python","Stores and queries chunked N-D scientific arrays with Zarr-Python 3, including codecs, sharding, S3\u002FGCS storage, and NumPy\u002FDask\u002FXarray integration. Use for array layout, bounded I\u002FO, format migration, or scientific metadata preservation.","MIT","https:\u002F\u002Fgithub.com\u002Fstanfish06\u002Fskillquarium\u002Fblob\u002Fmaster\u002Fskills\u002Fzarr-python\u002FSKILL.md",[],[],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":84,"licenseFileUrl":85,"sourceHtmlUrl":86,"categories":87,"keywords":88,"publishedAt":20},"01M76ZJQZ15Q1HKC5V85NHE325","yeet","Publish local changes to GitHub by confirming scope, committing intentionally, pushing the branch, and opening a draft PR through the GitHub app from this plugin, with `gh` used only as a fallback where connector coverage is insufficient.","Apache-2.0","https:\u002F\u002Fgithub.com\u002Fstanfish06\u002Fskillquarium\u002Fblob\u002Fmaster\u002Fskills\u002Fyeet\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fstanfish06\u002Fskillquarium\u002Fblob\u002Fmaster\u002Fskills\u002Fyeet\u002FSKILL.md",[],[],{"skillNo":90,"name":91,"nameZh":6,"description":92,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":84,"licenseFileUrl":6,"sourceHtmlUrl":93,"categories":94,"keywords":95,"publishedAt":20},"01M76ZJ8ASZ4QYQ70Y6SBA4Z4S","xarray","N-dimensional labeled arrays and datasets in Python. Built on top of NumPy and Dask. It introduces labels in the form of dimensions, coordinates, and attributes on top of raw NumPy-like arrays, making data analysis in physical sciences more intuitive and less error-prone. Use for working with multi-dimensional scientific data, NetCDF\u002FGRIB\u002FZarr files, climate\u002Fweather\u002Foceanographic datasets, remote sensing, geospatial imaging, large out-of-memory datasets with Dask, and labeled array operations.","https:\u002F\u002Fgithub.com\u002Fstanfish06\u002Fskillquarium\u002Fblob\u002Fmaster\u002Fskills\u002Fxarray\u002FSKILL.md",[],[],{"skillNo":97,"name":98,"nameZh":6,"description":99,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":76,"licenseFileUrl":6,"sourceHtmlUrl":100,"categories":101,"keywords":102,"publishedAt":20},"01M76ZHFBXD6VXPQ02VCEG202B","writing-mstest-tests","Use when asked to fix, rewrite, update, improve, modernize, show corrected code for, or explain existing MSTest tests or MSTest-specific configuration. Use for \"review\" when corrected code or edits are wanted, even for one pasted assertion or passing tests with bad failure output. Covers expected\u002Factual labels; generic Boolean, collection, string, numeric, null, identity, exception, hard-cast, and object[] checks; TestContext\u002Flifecycle; timeout\u002Fcancellation; OS\u002FCI conditions, retry, cleanup, parallelization, MSTest.Sdk project setup, and MSTESTxxxx. Honor the installed MSTest version. DO NOT USE to design new test cases (code-testing), perform report-only audits, create project files rather than explain MSTest setup, run tests, migrate frameworks, or handle non-MSTest\u002Fnon-.NET code.","https:\u002F\u002Fgithub.com\u002Fstanfish06\u002Fskillquarium\u002Fblob\u002Fmaster\u002Fskills\u002Fwriting-mstest-tests\u002FSKILL.md",[],[],{"skillNo":104,"name":105,"nameZh":6,"description":106,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":76,"licenseFileUrl":6,"sourceHtmlUrl":107,"categories":108,"keywords":109,"publishedAt":20},"01M76ZDFDF4N88RH6HSYGS7GP2","wgs-prs","End-to-end WGS to polygenic risk score pipeline. Takes paired-end FASTQ files (or a pre-existing VCF) through nf-core\u002Fsarek for variant calling, applies VCF QC (normalisation, hard filtering, Ti\u002FTv and Het\u002FHom checks), then computes polygenic risk scores via the PGS Catalog. Fills the FASTQ to VCF gap upstream of the gwas-prs skill.","https:\u002F\u002Fgithub.com\u002Fstanfish06\u002Fskillquarium\u002Fblob\u002Fmaster\u002Fskills\u002Fwgs-prs\u002FSKILL.md",[],[],{"skillNo":111,"name":112,"nameZh":6,"description":113,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":84,"licenseFileUrl":114,"sourceHtmlUrl":115,"categories":116,"keywords":117,"publishedAt":20},"01M76ZCC1SC68J42QK4MDC8RCG","webapp-testing","Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.","https:\u002F\u002Fgithub.com\u002Fstanfish06\u002Fskillquarium\u002Fblob\u002Fmaster\u002Fskills\u002Fwebapp-testing\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fstanfish06\u002Fskillquarium\u002Fblob\u002Fmaster\u002Fskills\u002Fwebapp-testing\u002FSKILL.md",[],[]]