From 7b246c315ea60e02d0141ff3519b4b9eb94d53b8 Mon Sep 17 00:00:00 2001 From: Christoph Ruegg Date: Fri, 9 Jan 2015 21:35:12 +0100 Subject: [PATCH] LA: F# Matrix.insertRow/appendRow/prependRow, also for columns #277 --- src/FSharp/LinearAlgebra.Matrix.fs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/FSharp/LinearAlgebra.Matrix.fs b/src/FSharp/LinearAlgebra.Matrix.fs index 9571016b..64d44acd 100644 --- a/src/FSharp/LinearAlgebra.Matrix.fs +++ b/src/FSharp/LinearAlgebra.Matrix.fs @@ -315,6 +315,16 @@ module Matrix = v :> _ Vector + let inline insertRow rowIndex (rowVector: #Vector<_>) (matrix: #Matrix<_>) = matrix.InsertRow(rowIndex, rowVector) + let inline insertCol columnIndex (columnVector: #Vector<_>) (matrix: #Matrix<_>) = matrix.InsertColumn(columnIndex, columnVector) + + let inline appendRow (rowVector: #Vector<_>) (matrix: #Matrix<_>) = matrix.InsertRow(matrix.RowCount, rowVector) + let inline appendCol (columnVector: #Vector<_>) (matrix: #Matrix<_>) = matrix.InsertColumn(matrix.ColumnCount, columnVector) + + let inline prependRow (rowVector: #Vector<_>) (matrix: #Matrix<_>) = matrix.InsertRow(0, rowVector) + let inline prependCol (columnVector: #Vector<_>) (matrix: #Matrix<_>) = matrix.InsertColumn(0, columnVector) + + /// In-place matrix addition. let inline addInPlace (v: #Matrix<_>) (w: #Matrix<_>) = v.Add(w, v)