Skip to content

Commit

Permalink
matrix to vector
Browse files Browse the repository at this point in the history
  • Loading branch information
xieguigang committed Nov 23, 2024
1 parent 6530423 commit d5cd65e
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Library/Rlapack/RMatrix.vb
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,27 @@ Module RMatrix
End If
End Function

''' <summary>
''' matrix to vector by extract from the row dimensions
''' </summary>
''' <param name="x"></param>
''' <param name="env"></param>
''' <returns></returns>
<ExportAPI("row_pack")>
Public Function rowPack(x As Object, Optional env As Environment = Nothing) As Object
Dim pack As New List(Of Double)

If x Is Nothing Then
Return Nothing
ElseIf x.GetType.ImplementInterface(Of GeneralMatrix) Then
Dim m As GeneralMatrix = x
m.RowVectors.DoEach(Sub(v) pack.AddRange(v))
Return pack.ToArray
Else
Return Message.InCompatibleType(GetType(GeneralMatrix), x.GetType, env)
End If
End Function

''' <summary>
''' sum all matrix
''' </summary>
Expand Down

0 comments on commit d5cd65e

Please sign in to comment.