Extracting submatrix from matrix

From: Anonymous (nospam_at_noISP.com)
Date: 05/28/04


Date: Fri, 28 May 2004 17:31:35 GMT

Given a 2-dimensional array A(m,n), and lists of rows, R(m), and columns, C(n), how can I
create the submatrix of A consisting of A(r,c), where r is in R and c is in C?

Example (m=3, n=4):

   (1 2 3 4)
A=(5 6 7 8) R=(2,0,0) C=(2,4,0,0) submatrix=(6 8)
   (9 10 11 12)

    R=(2,3,0) C=(1,2,4,0,0) submatrix=(5 6 8)
                                        (9 10 12)

In R and C, 0 means no row or column is used.

sherNOwoodSPAM@computer.org (remove caps to get e-mail)



Relevant Pages

  • Re: garbage collection problem in large linked lists
    ... Instead all buckets are allocated at once in an array. ... VG.net, which must be very scalable, but only for lists which would normally ... Linked lists require pointer dereferencing in order to traverse. ... When you run out of space, you allocate a new smaller array. ...
    (microsoft.public.dotnet.framework.performance)
  • Re: Dict sharing vs. duplication
    ... array to enforce unique keys and I use lists to enforce order. ... API in a page or two of Tcl code, it isn't so much a missing feature ... OpenACS database API which creates a new specialized data structure, ...
    (comp.lang.tcl)
  • Re: Compare the values of two sorted arrays of variable size.
    ... This algorithm does not check for every possible location in each array. ... > contains a double loop where each element of the inner loop is compared ... > Dim lngMaxAIdx ' Upper value of the A list index. ... one of the lists has finished. ...
    (microsoft.public.scripting.vbscript)
  • Re: Approx mode creates largedr matricies
    ... real/complex "array" types ... In the "list (of lists)" alternate storage type, ... no ROM address is ever used, ... which started with the HP48S series) ...
    (comp.sys.hp48)
  • Re: Comments requested: brief summary of Perl
    ... | Perl uses the term list to describe an ordered collection of scalars. ... so the terms "array" and "list" are often thought of as being the same. ... | As a shortcut for lists of strings, you can use qw: ... | are related the same way as if and unless), and also do/while and do/until loops. ...
    (comp.lang.perl.misc)