Re: add a column a matrix

26 views
Skip to first unread message

Peter A

unread,
Jan 28, 2013, 6:49:30 PM1/28/13
to efficient-java-mat...@googlegroups.com
There isn't any way to do that in a single line of code. Due to how
matrices are stored, you will have to create a new matrix and then
copy the values into it. See below for one way to do that

DenseMatrix64F a = new DenseMatrix64F( b.numRows , b.numCols+1);
CommonOps.insert(b,a,0,0)

I haven't tried to compile the above code...

- Peter

On Mon, Jan 28, 2013 at 11:05 AM, Sotiris Beis <sot....@gmail.com> wrote:
> Hi,
> let's say i have a matrix with dimension (4,5) tha is already filled with
> values. Is there an easy way to add a column of zeros so my dimension change
> to (4,6) and not change my values?
> Thanks
>
> --
> You received this message because you are subscribed to the Google Groups
> "efficient-java-matrix-library-discuss" group.
> To unsubscribe from this group, send email to
> efficient-java-matrix-li...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>



--
"Now, now my good man, this is no time for making enemies." —
Voltaire (1694-1778), on his deathbed in response to a priest asking
that he renounce Satan.
Reply all
Reply to author
Forward
0 new messages