"Concatenating" matrices

161 views
Skip to first unread message

Owen Densmore

unread,
Mar 11, 2014, 11:17:53 PM3/11/14
to nume...@googlegroups.com
I need to create an augmented matrix from two matrices.  For example, in Gauss Jordan reduction, one starts with 
[ A | I ] converting to [ I | A-1 ] via elimination.

I realize there is already code to do that directly but I'm using this for a class and need to play with the basics.

I believe setBlock is the method, but looking at the docs and .js file, there was no description of its use.

What is its syntax?  

   -- Owen

Sébastien Loisel

unread,
Mar 12, 2014, 9:29:50 AM3/12/14
to nume...@googlegroups.com

Hi,

Does this help?

http://numericjs.com/workshop.php?link=5fcdfcddec2455fe1978020f0eebc959373f22a11204e778a2ca2895f5fbd020

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

Owen Densmore

unread,
Mar 12, 2014, 1:03:47 PM3/12/14
to nume...@googlegroups.com
Yup, thanks!

Owen Densmore

unread,
Mar 12, 2014, 1:53:52 PM3/12/14
to nume...@googlegroups.com
Well, actually, it makes clear how setBlock works, very nifty.  But is there a simpler way to build and augmented matrix?

I.e. If 
A= 1 2
     3 4
and 
I = 1 0
     0 1
Is there a method to create the augmented matrix:
1 2 1 0
3 4 0 1

Its easy enough to write, I already have several simple utilities and adding a few more is fine.

   -- Owen

Sébastien Loisel

unread,
Mar 12, 2014, 8:11:40 PM3/12/14
to nume...@googlegroups.com
Hi, try numeric.blockMatrix?


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



--
Sébastien Loisel
Department of Mathematics
Heriot-Watt University
Riccarton EH14 4AS
United Kingdom
web: http://www.ma.hw.ac.uk/~loisel/
email: S.Loisel at hw.ac.uk
phone: +44 131 451 3234
fax: +44 131 451 3249

Owen Densmore

unread,
Mar 13, 2014, 11:50:36 AM3/13/14
to nume...@googlegroups.com
Didn't see it in the docs.  Should have looked.

What is its syntax?  

Thanks!  You know you've got a winner when whenever you need something, its there.

BTW: I'm having fun using numeric to do examples in Strang's Linear Algebra book.  I'm using CoffeeScript which makes the syntax easier and adding a few trivial utilities that make using it quickly,

For example, a matrix can be made like this:
A= mat '''
1 2 3
4 5 6
7 8 9
'''
..using CS's multiline strings.  Variables can be put into the matrix at any location via #{num}; "string interpolation" I believe its called.  

Not for "production" work but great for quickly typing and exploring.

   -- Owen

Owen Densmore

unread,
Mar 14, 2014, 1:04:17 PM3/14/14
to nume...@googlegroups.com
On Thursday, March 13, 2014 9:50:36 AM UTC-6, Owen Densmore wrote:
Didn't see it in the docs.  Should have looked.

What is its syntax?  

Figured it out: input is an array of the arrays you want to concatinate, thanks 
Reply all
Reply to author
Forward
0 new messages