title: F# Pick function based on input?
body: <p>I have the following functions</p>
  
  <pre><code>let private sigmoid (z:float) =
      1.0 / (1.0 + exp(-z))
  let private sigmoidM (z : Matrix&lt;float&gt;) : Matrix&lt;float&gt; =
      z.Map (fun x -&gt; sigmoid(x))
  let private sigmoidV (z:Vector&lt;float&gt;) =
      z.Map(fun x -&gt; sigmoid(x))
  </code></pre>
  
  <p>I would like to just have sigmoid and it execute against a scalar, vector or matrix depending on the input.</p>
  
  <p>That said, this function needs to be extremely performant as it is in the most critical section of loops.  Any insight on how to do this?  Feel free to post how with caution it will be slow if it will be slow.</p>