| MATLAB Central > MATLAB Newsreader > vectorize intersect with cells? |
|
|
|
I have a cell cliques=cell(n,1) where each cell |
|
Subject: vectorize intersect with cells? From: Bruno Luong Date: 9 Mar, 2009 07:56:01 Message: 2 of 13 |
|
HenryW <hwolkowicz@uwaterloo.ca> wrote in message <18230588.1236560716722.JavaMail.jakarta@nitrogen.mathforum.org>... |
|
HenryW wrote: |
|
HenryW wrote: |
|
Subject: vectorize intersect with cells? From: Bruno Luong Date: 9 Mar, 2009 10:33:30 Message: 5 of 13 |
|
Here is one way, complicated but should be much faster at the run |
|
Subject: vectorize intersect with cells? From: Bruno Luong Date: 9 Mar, 2009 15:26:02 Message: 6 of 13 |
|
% More compact code: |
|
Subject: vectorize intersect with cells? From: Roger Stafford Date: 9 Mar, 2009 16:11:01 Message: 7 of 13 |
|
HenryW <hwolkowicz@uwaterloo.ca> wrote in message <18230588.1236560716722.JavaMail.jakarta@nitrogen.mathforum.org>... |
|
The values of n are typically from 2000 upwards; often 10,000. But, we are hoping to solve some very large problems and this is a preliminary preprocessing step. |
|
Subject: vectorize intersect with cells? From: Bruno Luong Date: 9 Mar, 2009 17:50:02 Message: 9 of 13 |
|
Great algo from Roger, very quick using binary sparse matrix to store set-element relationship. Here is the algo, slightly modified to give the same result as the original one, and vectorized two for-oops: |
|
Subject: vectorize intersect with cells? From: Bruno Luong Date: 9 Mar, 2009 20:09:01 Message: 10 of 13 |
|
% Somehow shorter |
|
Subject: vectorize intersect with cells? From: Roger Stafford Date: 9 Mar, 2009 20:36:01 Message: 11 of 13 |
|
"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <gp3ksa$aak$1@fred.mathworks.com>... |
|
Rogers algorithm was really fast --- thanks!! |
|
Subject: vectorize intersect with cells? From: Bruno Luong Date: 9 Mar, 2009 21:18:01 Message: 13 of 13 |
|
"Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in message <gp3ujh$9k3$1@fred.mathworks.com>... |
A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.
Anyone can tag a thread. Tags are public and visible to everyone.
