Skip to content

Extract transpose-flip helper in bgemm_blas.rs #127

@shinaoka

Description

@shinaoka

Summary

strided-einsum2/src/bgemm_blas.rs lines 408-437: when C is row-major, the GEMM is rewritten as C^T = B^T * A^T with inline transpose flag flipping logic. This is correct but adds cognitive load as an inline closure within do_batch.

Proposal

Extract the transpose-flip logic into a standalone helper function:

fn flip_transpose(t: CBLAS_TRANSPOSE) -> CBLAS_TRANSPOSE {
    match t {
        CblasNoTrans => CblasTrans,
        CblasTrans => CblasNoTrans,
        other => other,
    }
}

And separate the col-major vs row-major C dispatch into clearly named branches.

Risk

Low. Purely cosmetic refactoring for readability.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions