f

#### Nested parfor loop: Classification of Matrix inside loop #2

```Hello,

I am having problems with the following loop, since it is taking too much time. Hence, I would like to use parallel processing, specifically parfor function.

Can anyone, please, help me to convert the following 'far' loop into 'parfor'?

P = numel(scaleX); %  quite BIG number
sz = P;
start = 1;
sqrL = 10; %  sqr len
e = 200;
A = false(sz, sz);

parfor m = sz-sqrL/2:(-1)*sqrL:start
for n = M(m):-sqrL:1
temp = [scaleX(m), scaleY(m); scaleX(n), scaleY(n)];
d = pdist(temp, 'euclidean');
if d < e
A(m, n) = 1;
end
end
end

Thank you!
```
 0
Bek
4/14/2015 1:17:41 AM
comp.soft-sys.matlab 211266 articles. 15 followers. lunamoonmoon (258) is leader.

0 Replies
1495 Views

Similar Articles

[PageSpeed] 53

Similar Artilces:

Nested parfor loop: Classification of Matrix inside loop
Hello, I am having problems with the following loop, since it is taking too much time. Hence, I would like to use parallel processing, specifically parfor function. Can anyone, please, help me to convert the following 'far' loop into 'parfor'? P = numel(scaleX); % quite BIG number sz = P; start = 1; sqrL = 10; % sqr len e = 200; A = false(sz, sz); parfor m = sz-sqrL/2:(-1)*sqrL:start for n = M(m):-sqrL:1 temp = [scaleX(m), scaleY(m); scaleX(n), scaleY(n)]; d = pdist(temp, 'euclidean'); if d < e A(m, n) =...

parfor loop with nested for loop #2
Hi All I just got a parallel toolbox and trying to modify my previous serial program. Can parfor loop be nested with a for loop like the following? c = zeros(m*n+1); parfor i = 1:m for j = 1:n id = (i-1)*n+j; c(id) = id; end end I got a error message saying "valid indices for 'c' are restricted in parfor loops". Does this mean I have to change this nested loop to a single loop? Is there a simpler way? Thanks! Cindy "Cindy" <xzhan2@fhcrc.org> wrote in message <h15vkh\$fia\$1@fred.mathworks.com>... > Hi All > > I just g...

Triple nested loop python (While loop insde of for loop inside of while loop)
try to make my triple nested loop working. My code would be: c = 4 y1 = [] m1 = [] std1 = [] while c <24: c = c + 1 a = [] f.seek(0,0) for columns in ( raw.strip().split() for raw in f ): a.append(columns[c]) x = np.array(a, float) not_nan = np.logical_not(np.isnan(x)) indices = np.arange(len(x)) interp = interp1d(indices[not_nan], x[not_nan], kind = 'nearest') p = interp(indices) N = len(p) dt ...

Loop with 2 loops. Start 2 'inside' loops at different time.
Hello, &nbsp; I've got a question. Is there a technique or a certain road which will provides the following... I have a while loop. In that while loop I have some other while loops. Now I want to start the while loops in the big loop at differents time... how can I do that... &nbsp; I included the problem in the vi. When I press start for inside loop 1 I can't start inside loop 2.&nbsp; It's obvious that I can't do that because I can't iniziate a other while loop because the 'inside' loop is still running. But is there a certain technique for this? It is...

Nested While loop inside For loop
I have been coding in matlab for a while and I am confused about the below code: It seems like the "For loop" iterator variable "Index" does not update inside the "While loop". Please help me understand! I hate to assume this is some error induced on Matlab's end. ---------- CODE ------------ for Index = 390000:length(Stopxy) fprintf('Index: %d, \n',Index); while (Stopxy_YCoord(Index) < LowToHighThresh) fprintf('Index: %d, Yval: %f \n',Index,Stopxy_YCoord(Index)); Stopxy_YCoord(Index); Index = Index + 1; ...

parfor loop with nested for loop
Hi all, I'm new to this group, but googling my problem always points here so I thought I'd sign up. I'm running multiple iterations of a time-evolving Monte Carlo simulation in Matlab. Since each iteration is initialized randomly at the first time point, the iterations can safely be run in parallel on a quad core PC. I've previously been doing this by simply running 4 simultaneous Matlab sessions on one machine, but I thought I would save my institution some licenses and automate the process at the same time. The problem is that my code essentially has multiple nested for ...

nesting for loops in a parfor loop
Hi, I am trying to nest several for loops in a parfor loop. I have even read the documentation and several other queries/replies before posting here. I have a large dataset that I need to iterate over, calculating a property which would result in a prohibitively large array if I sent each answer to a separate element, and doing this on one cpu will take a prohibitively long time. Instead, what I am doing is reducing the array by another property, and then combining the calculated results in bins of this second property (essentially making a histogram). The parfor section of my cod...

Parfor nested for loops, triangular matrix structure #2
I am looking for advice in handling a large square matrix, C, of integer values. My code works well enough when tested for sizes 353x353 (takes several minutes to run), 5500x5500 (takes several hours to run), 8000x8000 and up to 13890x13890 (takes several days to run). I would now like to run my code one last time for size 45000x45000. Essentially, my code constructs a distance matrix whose elements describe the minimal weight of the path from vertex ii to vertex jj in a weighted, directed graph. Thus, the number of vertices could be N=353, 5500, 13890, 45,000 etc. To do this, I conside...

Nested FOR loops. (a loop within a loop)
I can't get my head around them. I have two MySQL tables, one contains the categories, the other contains the posts. Each post is linked to a category. Now I'm trying to display each post with a drop down menu that has the categories in it and have the category that the post is in selected. Here's my code for the drop down menu where my woes lie. for (\$i=0; \$i<count(\$posts); \$i++) { for (\$j=1; \$j<=count(\$categories); \$j++) { if (\$j == \$post[\$i]['id']) { selected = ' selected="selected"'; } else { sele...

Re: i am having a problem with while loops, i have two while loops, i have a random number generator inside the &quot;inside&quot; loop and i want to read an array outside the &quot;outer&quot; #2
Hi guys, Apologies about he messy thread - I needed asolution urgently and I didn't get a chance to notice the post date. &nbsp; :Ravens - Thank you a lot. The solution, also found in "my assignmnet live update.vi", works perfectly, doing exactly what I needed. Thanks again. kolorek ...

while-loops nested in while-loop
Hi! I'm new to labview and I've got some problems. I want to program a control for a testing facility. therefore I want to program several while-loops&nbsp; nested in each other, according to a designed Nassi-Shneiderman-diagram. So if the stop condition for an inner while loop is true (e.g. measure device mistake), the program should jump out of that while loop in the next outer while-loop. is that possible? Thank you right now! Yes it is possible When you stop the inner loop, from inside the inner loop, just&nbsp;wire/pass an appropriate&nbsp;stop condition ( stop if tr...

nested loops only loop once
I am using two while loops that are nested. The first loop (post name) returns the full column of results, but the second (post modified) only returns the first row of the column. Is there another way I could write this to get both loops to complete fully? I am using the two while loops to pull data from different tables, and insert that data into a list that has html code surrounding each loop. while (\$url = mysql_fetch_array(\$urls, MYSQL_ASSOC)) { \$pn = \$url['post_name']; while (\$date = mysql_fetch_array(\$lmdate, MYSQL_ASSOC)) { \$lm = \$date['post_modified']; ...

while loop inside a for loop
Hi, can someone please tell me why "time" (t) is not updated correctly within the while loop? Please run this small code in your machine and you'll know what I'm taking about. What I want is: for t=1 run the "while loop" until iq<=(numberc-1) then t=2 run the "while loop" again until iq<=(numberc-1), and so on. Basically, this code runs through all the nonzero elements of A and attempts to divide them individually into two, once a certain time has passed. Please feel free to ask for clarifications. Many thanks in advance. A=[0 0 0 0 0 0 ...

loops in loops
In the attached vi, the one second loop runs at one second and can't be touched.&nbsp; In the ten second loop, the ten second clock is a stand in for a process that generates a finished signal. The problem is once the process is complete, to start it again, leave the one second loop running, and start an additional process that will take less time than 10 seconds. thanks internal loops.vi: http://forums.ni.com/attachments/ni/170/319512/1/internal loops.vi Hi exo, what do you try there? If you start your vi, the value from your stop button will be read and after that, both loops &quo...

Web resources about - Nested parfor loop: Classification of Matrix inside loop #2 - comp.soft-sys.matlab

Classification - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

BISMARCK CAMPAIGN HIT WITH ANOTHER SALVO: Hillary’s Emails Altered to Hide Classification Markings
Johnny Dollar relays a story from Catherine Herridge that describes another set of Clinton felonies . Just tack these on to a laundry list of ...

New On-Demand Economy Study Casts Worker Classification Debate in a New Light
New data from Intuit Inc. and Emergent Research is shedding new light on the debate about worker classification in the on-demand economy.

Report: Emails At The Highest Classification Levels Found On Hillary’s Private Server
Report: Emails At The Highest Classification Levels Found On Hillary’s Private Server

How Do You Set Your Company Up For Success With Data Classification?
Defining your data via data discovery and classification is the foundation for data security strategy. The idea that you must understand what ...

FBI expands probe of Clinton emails, launches independent classification review
The FBI has expanded its probe of Hillary Clinton’s emails, with agents exploring whether multiple statements violate a federal false statements ...

On-demand valet service Zirx sued over workers’ independent contractor classification
A former Zirx worker says she was required to work set hours and wear a uniform when she parked cars for the on-demand valet company — but she ...

Great news: Hillary planning to “educate the public” on the natsec classification process
Spin. Looks like we’ve finally reached step four in the Clinton scandal playbook. I didn't do it. You can't prove I did it. Technically, I didn't ...

Judge sets trial date for Uber driver classification lawsuit
The fate of Uber's business model — the same business model that has earned the company a \$50-billion valuation — will be decided next summer, ...

Key to Hillary conspiracy to subvert classification system revealed?
if Hillary is not indicted, it's because someone at DOJ doesn't want her indicted.

Resources last updated: 1/25/2016 6:56:56 PM