This project has moved and is read-only. For the latest updates, please go here.

In need of an example for Matrix.fill method

Oct 3, 2013 at 4:05 PM
Edited Oct 3, 2013 at 4:05 PM
Hi I'm working on VS 2008 with VB, I would like to use the array.fill method but with only the definition and without an example i'm failing:
f
Func(Of Int32, Int32, T)
The fill function.

let's say I would like to implement, in a SquareMatrix.fill the following function that should create an identity matrix:
Private Function Identity(ByVal row As Integer, ByVal column As Integer) As Double
If row = column Then Return 1
Return 0
End Function
someone can write an example ? thank's in advance
Oct 4, 2013 at 9:56 PM
Here's an example that uses VB's anonymous delegate feature.
        Dim A As New SquareMatrix(5)
        A.Fill(
            Function(i, j)
                If (i = j) Then
                    Return (1.0)
                Else
                    Return (0.0)
                End If
            End Function
        )