anchor.diff:  
       //----------------------------------------------------------------------------
       // Stats
  -    //----------------------------------------------------------------------------
  +
  +    /// Returns upper triangular Matrix by setting all values beneath the diagonal to Zero.  
  +    /// Warning: triangular matrices can only be computed for square input matrices.
  +    let getUpperTriangular (a:Matrix<float>) = 
  +        let nA = a.NumCols 
  +        let mA = a.NumRows
  +        if nA<>mA then invalidArg "a" "expected a square matrix";
  +        else
  +        a  
  +        |> mapi (fun n m x -> if n > m then 0. else x ) 
       
  +    /// Returns lower triangular Matrix by setting all values beneath the diagonal to Zero.
  +    /// Warning: triangular matrices can only be computed for square input matrices.
  +    let getLowerTriangular (a:Matrix<float>)  = 
  +        let nA = a.NumCols 
  +        let mA = a.NumRows
  +        if nA<>mA then invalidArg "a" "expected a square matrix";
  +        else
  +        a  
  +        |> mapi (fun n m x -> if n < m then 0. else x ) 
  +
  +    /// Returns diagonal matrix by setting all values beneath and above the diagonal to Zero.
  +    /// Warning: diagonal matrices can only be computed for square input matrices.
  +    let toDiagonal (a:Matrix<float>) = 
  +        getDiag a
  +        |> diag
   
       /// Computes the row wise mean of a Matrix 
       let meanRowWise (a:matrix) = 
  
positive.code:         a.Transpose 
          |> foldByRow (fun acc r -> acc + r ) (Vector.zero a.NumCols)
          |> Vector.map (fun sum -> sum / (a.NumCols |> float))
  
  end
  
  
  
  
  
  [<AutoOpen>]
  module MatrixExtension =
  
negative.code:         member x.Copy () = Matrix.Generic.copy x
  
  
  //    [<AutoOpen>]
  //    module MatrixTopLevelOperators = 
  //
  