how to append row or column to a matrix?

156 views
Skip to first unread message

Yingjun Wu

unread,
Jun 16, 2014, 8:35:07 AM6/16/14
to jblas...@googlegroups.com
Dear all,

I am a newbie to jblas and I am seeking a way to append row or column to a matrix at runtime. It seems that the number of rows and columns are set at initialization time, using the constructor like:
DoubleMatrix matrix=new DoubleMatrix(10, 10);

However, what if I want to add a row or column to the matrix to get a 11*10 or 10*11 matrix? Thanks.

Regards,
Yingjun

Mikio Braun

unread,
Jun 19, 2014, 9:20:34 AM6/19/14
to jblas...@googlegroups.com
concatHorizontally and concatVertically are the methods you are looking for.

-M


--
You received this message because you are subscribed to the Google Groups "jblas-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jblas-users...@googlegroups.com.
To post to this group, send email to jblas...@googlegroups.com.
Visit this group at http://groups.google.com/group/jblas-users.
For more options, visit https://groups.google.com/d/optout.



--
Mikio Braun - http://blog.mikiobraun.de, http://twitter.com/mikiobraun

Christos Boutsidis

unread,
Nov 30, 2014, 12:16:10 AM11/30/14
to jblas...@googlegroups.com, mikio...@googlemail.com
Hi, i have noticed that this is extremely slow. For example, let's say you have a bilion by 10 matrix A and just
want to append a row. then, this shouldn't take that long. but concatVertically creates an m x 10 matrix B and
then sets the top part of B to A. here m = 1 billion + 1, that's why creating the whole B is very expensive.
Do you know of any alternative solution ?
Reply all
Reply to author
Forward
0 new messages