Chien - 2017-02-17

Hi Dear JLinAlg developers,

I am trying to pre-allocate a n x 3 matrix, which I will need to assign/insert/append values to the row.
However,
when I tried to do this:
Matrix<DoubleWrapper> EventMatrix = new Matrix<DoubleWrapper>(new DoubleWrapper[2501][3])
I got errors.

And, Would you please let me know how can i use the setRow method? I also got error from the following usage: EventMatrix.setRow(eventIdx, dummyDoubleWrapper);

This is the method I am trying to develop, I am trying to conver ArrayList<int[]> into the matrix:

public static Matrix<DoubleWrapper> ArrListIntArrToMatrix(ArrayList<int[]> ColorBeadsAllFL) // take
// Three Color Beads' Three FL signals, i.e. 3 colors * n events * 3 FL Channels
{
DoubleWrapper dummyDoubleWrapper;
DoubleWrapper NullDoubleWrapper = new DoubleWrapper(0.0);
Matrix<DoubleWrapper> EventMatrix = new Matrix<DoubleWrapper>(new DoubleWrapper[][]{{NullDoubleWrapper,NullDoubleWrapper,NullDoubleWrapper}});

    // create EventMatrix

DoubleWrapper[ColorBeadsAllFL.size()][NumOfChannel]);

    for (int eventIdx = 0; eventIdx < ColorBeadsAllFL.size() ; eventIdx++) // visit/access each event; while SelectedCh is in each column; 0 for FL1, 1 for FL2, 2 for FL3
    {
        for (int channelIdx = 0; channelIdx < NumOfChannel;channelIdx++)
        {   
            dummyDoubleWrapper = new DoubleWrapper((double)ColorBeadsAllFL.get(eventIdx)[channelIdx]);

            EventMatrix.setRow(eventIdx, dummyDoubleWrapper);
            System.out.println("pausing!!");
        }
    }

    return EventMatrix;

}

 Or, would you please instruct some better way to pre-allocate the matrix and assign values to the rows.

 Highly Appreciate,
 Chien