How to get SIMD matrix type from vector, in generic function?

I want to write a generic function that works with different real numbers (mainly Float, Double) and vectors and matrices from the simd module.

import simd
func foo<S: SIMDScalar>(vector: SIMD4<S>) {
    let m = // how to get the 4x4 matrix of type simd_float4x4 or simd_double4x4 ?
    ...
}

Is there a way to get the associated matrix type? It looks like maybe the vectors are unified with protocols, but the matrix types are not. Maybe I need to declare my own matrix protocol.