# Nested loops For

Hello guys,.

Am a beginner, so can someone help me with this problem.

This is the sequence

Table 2D-> indexed by a table 2 x 2-> find the Max and Min difference in table 2 x 2-> result item must be compared with the participation of entry each array element 2 x 2, if its rained 1 0 otherwise -> finally replace the output array should be identical to the size of the input array.

Attachment Vi for reference. How to do this? Thanks in advance.

The average function does not work on the 2D tables, but you can use 'add elements to the table' and divide by four.

The rest of my code works for you?

(EDIT: new version of upladed.) You must be careful not to overflow U8 adding).

Tags: NI Software

### Similar Questions

• nested loops for speed optimization

Hello. I need help to optimize for speed (in LabVIEW) code (matlab) following:

-----------------------------------

a = rand(1024, 200);
b = rand(1024, 512);
c = Zeros (200,512);
ICT
for i = 1: 200
j = 1:512
c (i, j) = (Sum ((:,i).*b(:,j))) a ABS;
end
end
end

-------------------------------------------------------------

Basically I have two 2d tables, a and b, one with 200 columns and rows of 1024, other columns a 512 and 1024 lines. What I have to do is multiply (dot product) each column a each column of b, the sum and take the absolute value of the result. The output, c, will be an array of 2d of size 200 x 512. Is it possible to do without the help of 2 loops of nesting? The two paintings 2d, a and b\, are produced by my material.

What is the best strategy to get the maximum speed? I have a powerful enough processor.

Thank you very much?

So I looked at this problem, said «seems familiar, but different...» ».  Did a little math, encoded at top and improved the speed by a factor of 100 (with absolutely no parallelism).  How about apples?

If we let A and B tables 1024 x 512 and 1024 x 200 and turn them into matrices, the problem is (mathematically) the absolute value of the transposed from A times B, where "the times" are the multiplication of matrices.  I "guessed" that NEITHER would have included the Multiplication of matrices in his bag of tricks and maybe optimized, so I coded it upward, adding the calendar.

Using the first double Lynn - to multiply, sum, formulation of abs and a 'do it as a matrix' on my machine, the Array 1004 msec, the matrix method took 10 msec, as well as the results differ by less than one part in 1 million (I generated at random (0, 1) floats, and made the comparison by subtracting the two tables and checking that the absolute all the differences were less than 1E-6).

Bob Schor

• Nested loops in the XSLT handling

Hello
I want to manage nested loops for each within the transformation roadmap.
I have two collections of source and a target collection.
I have to search the value of key in source1 source2 and if the key is found, I map the value of the target, and if the key is not found, maybe I want to the key itself to target.

Entry
----------------------
------------------------
< Source1Collection >
< Group1 >
< key > < / keys >
i < value > < / value >
< / Group1 >
< Group2 >
b < Key > < / key >
II < value > < / value >
< / Group2 >
Group < 3 >
< Key > c < / keys >
III < value > < / value >
< / Group 3 >
< / Source1Collection >
---------------------------------------
< Source2Collection >
< Feild1 > z < / Feild1 >
< Feild1 > x < / Feild1 >
c < Feild1 > < / Feild1 >
< Feild1 > v < / Feild1 >
b < Feild1 > < / Feild1 >
< / Source2Collection >
----------------------------------------

Output
--------------------------------------
--------------------------------------
< TargetCollection >
< Field1 > one < / Feild1 >
b < Field1 > < / Feild1 >
III < Field1 > < / Feild1 >
< / TargetCollection >

is it possible that I can keep the position of the corresponding source2Key "?" This will help me to map the corresponding value of the sourceKey2 to the target.

For something like that...

``````
1one
2two
3three
```
```

You can use the following to get the value of a respective key...

```
```

Thus, when \$key = '2' the expression above will return "two"...

I hope this helps...

See you soon,.

• Simple as possible"nested loop"XML (XPATH)?

What is the best way to view the entries to an XML file with the following structure as a nested list (actually it must become a form where it is possible to control all entries).

I can out of each level (see the code), but it seems not to be possible to nest loops for.

Advice if it is directly possible with XPath or should I check the result of a loop to output in the other or it would even be better to make a query on the XML result?

Thank you, excellent!

I tried somwhere along this before, but it didn't work then. I have propably just forgot to bring the book of signs to the correct place or something ;-)

But yes, your solution is exactly what I was looking for!

Thank you

• use OPT_ESTIMATE or CARDINALITY tip for correct estimation of nested loops

I'm using Oracle 11.2.0.3.  Below the execution below plan, how can I use tip OPT_ESTIMATE or CARDINALITY to teach optimization E-lines for ID 9 (Nested Loop) 30553 instead of 6.

```------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| Id  | Operation                                   | Name                        | Starts | E-Rows |E-Bytes| Cost (%CPU)| E-Time   | A-Rows |   A-Time   | Buffers |  OMem |  1Mem | Used-Mem |
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT                            |                             |      1 |        |       |  4604 (100)|          |  30553 |00:00:02.56 |     208K|       |       |          |
|   1 |  SORT ORDER BY                              |                             |      1 |      6 |  7044 |  4604   (1)| 00:01:05 |  30553 |00:00:02.56 |     208K|    41M|  2086K|   36M (0)|
|*  2 |   HASH JOIN OUTER                           |                             |      1 |      6 |  7044 |  4603   (1)| 00:01:05 |  30553 |00:00:02.10 |     208K|    38M|  3120K|   39M (0)|
|*  3 |    HASH JOIN OUTER                          |                             |      1 |      6 |  6870 |  4599   (1)| 00:01:05 |  30553 |00:00:01.97 |     208K|    38M|  3120K|   39M (0)|
|*  4 |     HASH JOIN OUTER                         |                             |      1 |      6 |  6744 |  4591   (1)| 00:01:05 |  30553 |00:00:01.85 |     208K|    37M|  3121K|   39M (0)|
|*  5 |      HASH JOIN OUTER                        |                             |      1 |      6 |  6570 |  4584   (1)| 00:01:05 |  30553 |00:00:01.74 |     208K|    37M|  3121K|   38M (0)|
|*  6 |       HASH JOIN OUTER                       |                             |      1 |      6 |  6414 |  4576   (1)| 00:01:05 |  30553 |00:00:01.60 |     208K|    37M|  3121K|   38M (0)|
|   7 |        NESTED LOOPS                         |                             |      1 |        |       |            |          |  30553 |00:00:01.44 |     208K|       |       |          |
|   8 |         NESTED LOOPS                        |                             |      1 |      6 |  6318 |  4572   (1)| 00:01:05 |  30553 |00:00:01.31 |     182K|       |       |          |
|   9 |          NESTED LOOPS                       |                             |      1 |      6 |  1830 |  4568   (1)| 00:01:04 |  30553 |00:00:01.11 |     124K|       |       |          |
|* 10 |           HASH JOIN                         |                             |      1 |   2069 |   270K|  2499   (1)| 00:00:35 |  30646 |00:00:00.46 |   23738 |  6539K|  2033K| 7965K (0)|
|* 11 |            TABLE ACCESS BY INDEX ROWID      | DSCLR                       |      1 |   5079 |   158K|   533   (1)| 00:00:08 |  91395 |00:00:00.28 |    6460 |       |       |          |
|  12 |             BITMAP CONVERSION TO ROWIDS     |                             |      1 |        |       |            |          |    197K|00:00:00.16 |     615 |       |       |          |
|  13 |              BITMAP AND                     |                             |      1 |        |       |            |          |      4 |00:00:00.14 |     615 |       |       |          |
|  14 |               BITMAP OR                     |                             |      1 |        |       |            |          |      4 |00:00:00.07 |     276 |       |       |          |
|  15 |                BITMAP CONVERSION FROM ROWIDS|                             |      1 |        |       |            |          |      2 |00:00:00.02 |      69 |       |       |          |
|* 16 |                 INDEX RANGE SCAN            | XIF913DSCLR                 |      1 |    274K|       |    14   (0)| 00:00:01 |  68407 |00:00:00.01 |      69 |       |       |          |
|  17 |                BITMAP CONVERSION FROM ROWIDS|                             |      1 |        |       |            |          |      4 |00:00:00.05 |     207 |       |       |          |
|* 18 |                 INDEX RANGE SCAN            | XIF913DSCLR                 |      1 |    274K|       |    42   (0)| 00:00:01 |    209K|00:00:00.03 |     207 |       |       |          |
|  19 |               BITMAP CONVERSION FROM ROWIDS |                             |      1 |        |       |            |          |      5 |00:00:00.06 |     339 |       |       |          |
|* 20 |                INDEX RANGE SCAN             | XIF910DSCLR                 |      1 |    274K|       |    67   (0)| 00:00:01 |    239K|00:00:00.04 |     339 |       |       |          |
|  21 |            NESTED LOOPS                     |                             |      1 |        |       |            |          |  21749 |00:00:00.10 |   17278 |       |       |          |
|  22 |             NESTED LOOPS                    |                             |      1 |   3404 |   339K|  1965   (1)| 00:00:28 |  22772 |00:00:00.03 |    1246 |       |       |          |
|  23 |              TABLE ACCESS FULL              | TMP_RPT_BD_STATE_DATA_DWNLD |      1 |   3255 |   257K|    11   (0)| 00:00:01 |   3255 |00:00:00.01 |      27 |       |       |          |
|* 24 |              INDEX RANGE SCAN               | XIE2OCRN                    |   3255 |      7 |       |     1   (0)| 00:00:01 |  22772 |00:00:00.03 |    1219 |       |       |          |
|* 25 |             TABLE ACCESS BY INDEX ROWID     | OCRN                        |  22772 |      1 |    21 |     1   (0)| 00:00:01 |  21749 |00:00:00.06 |   16032 |       |       |          |
|* 26 |           VIEW PUSHED PREDICATE             |                             |  30646 |      1 |   171 |     1   (0)| 00:00:01 |  30553 |00:00:00.63 |     101K|       |       |          |
|  27 |            WINDOW BUFFER                    |                             |  30646 |      1 |    21 |     1   (0)| 00:00:01 |  46946 |00:00:00.59 |     101K|  2048 |  2048 | 2048  (0)|
|* 28 |             TABLE ACCESS BY INDEX ROWID     | DSCLR_FLNG                  |  30646 |      1 |    21 |     1   (0)| 00:00:01 |  46946 |00:00:00.32 |     101K|       |       |          |
|* 29 |              INDEX RANGE SCAN               | XIE1DSCLR_FLNG              |  30646 |      2 |       |     1   (0)| 00:00:01 |  46946 |00:00:00.21 |   59862 |       |       |          |
|* 30 |          INDEX RANGE SCAN                   | XPKH760_RGLTY_ACTN_DSCLR    |  30553 |      1 |       |     1   (0)| 00:00:01 |  30553 |00:00:00.18 |   57541 |       |       |          |
|  31 |         TABLE ACCESS BY INDEX ROWID         | H760_RGLTY_ACTN_DSCLR       |  30553 |      1 |   748 |     1   (0)| 00:00:01 |  30553 |00:00:00.11 |   26218 |       |       |          |
|  32 |        TABLE ACCESS FULL                    | DSCLR_ST_TYPE_TBL           |      1 |      4 |    64 |     4   (0)| 00:00:01 |      4 |00:00:00.01 |       5 |       |       |          |
|  33 |       TABLE ACCESS FULL                     | RGLTY_RSLTN_TYPE_TBL        |      1 |     12 |   312 |     7   (0)| 00:00:01 |     12 |00:00:00.01 |      10 |       |       |          |
|  34 |      TABLE ACCESS FULL                      | INTTR_TYPE_TBL              |      1 |     14 |   406 |     7   (0)| 00:00:01 |     14 |00:00:00.01 |      10 |       |       |          |
|  35 |     TABLE ACCESS FULL                       | SNCTN_TYPE_TBL              |      1 |     15 |   315 |     7   (0)| 00:00:01 |     15 |00:00:00.01 |      10 |       |       |          |
|  36 |    TABLE ACCESS FULL                        | PRDCT_TYPE_TBL              |      1 |     25 |   725 |     4   (0)| 00:00:01 |     25 |00:00:00.01 |       5 |       |       |          |
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Query Block Name / Object Alias (identified by operation id):
-------------------------------------------------------------

1 - SEL\$A8B7A3F4
11 - SEL\$A8B7A3F4 / [email protected]\$13
23 - SEL\$A8B7A3F4 / [email protected]\$1
24 - SEL\$A8B7A3F4 / [email protected]\$13
25 - SEL\$A8B7A3F4 / [email protected]\$13
26 - SEL\$13512960 / [email protected]\$13
27 - SEL\$13512960
28 - SEL\$13512960 / [email protected]\$14
29 - SEL\$13512960 / [email protected]\$14
30 - SEL\$A8B7A3F4 / [email protected]\$2
31 - SEL\$A8B7A3F4 / [email protected]\$2
32 - SEL\$A8B7A3F4 / [email protected]\$9
33 - SEL\$A8B7A3F4 / [email protected]\$11
34 - SEL\$A8B7A3F4 / [email protected]\$3
35 - SEL\$A8B7A3F4 / [email protected]\$5
36 - SEL\$A8B7A3F4 / [email protected]\$7

Outline Data
-------------

/*+
BEGIN_OUTLINE_DATA
IGNORE_OPTIM_EMBEDDED_HINTS
OPTIMIZER_FEATURES_ENABLE('11.2.0.3')
DB_VERSION('11.2.0.3')
ALL_ROWS
OUTLINE_LEAF(@"SEL\$13512960")
PUSH_PRED(@"SEL\$A8B7A3F4" "DF"@"SEL\$13" 11)
OUTLINE_LEAF(@"SEL\$A8B7A3F4")
ELIMINATE_JOIN(@"SEL\$2D47CDEA" "DTT"@"SEL\$13")
OUTLINE(@"SEL\$14")
OUTLINE(@"SEL\$A8B7A3F4")
ELIMINATE_JOIN(@"SEL\$2D47CDEA" "DTT"@"SEL\$13")
OUTLINE(@"SEL\$2D47CDEA")
MERGE(@"SEL\$3FAACB6D")
OUTLINE(@"SEL\$15")
OUTLINE(@"SEL\$3FAACB6D")
MERGE(@"SEL\$11")
MERGE(@"SEL\$A1A6E401")
OUTLINE(@"SEL\$12")
OUTLINE(@"SEL\$11")
OUTLINE(@"SEL\$A1A6E401")
MERGE(@"SEL\$9")
MERGE(@"SEL\$BFB1842A")
OUTLINE(@"SEL\$10")
OUTLINE(@"SEL\$9")
OUTLINE(@"SEL\$BFB1842A")
MERGE(@"SEL\$7")
MERGE(@"SEL\$EEDE2B8C")
OUTLINE(@"SEL\$8")
OUTLINE(@"SEL\$7")
OUTLINE(@"SEL\$EEDE2B8C")
MERGE(@"SEL\$5")
MERGE(@"SEL\$A6B38458")
OUTLINE(@"SEL\$6")
OUTLINE(@"SEL\$5")
OUTLINE(@"SEL\$A6B38458")
MERGE(@"SEL\$171BE69E")
MERGE(@"SEL\$3")
OUTLINE(@"SEL\$4")
OUTLINE(@"SEL\$171BE69E")
MERGE(@"SEL\$AF02BF1E")
OUTLINE(@"SEL\$3")
OUTLINE(@"SEL\$2")
OUTLINE(@"SEL\$AF02BF1E")
MERGE(@"SEL\$13")
OUTLINE(@"SEL\$1")
OUTLINE(@"SEL\$13")
FULL(@"SEL\$A8B7A3F4" "OH"@"SEL\$1")
INDEX(@"SEL\$A8B7A3F4" "O"@"SEL\$13" ("OCRN"."ORG_PK" "OCRN"."DSCLR_DSCLB_FL" "OCRN"."DSCLR_RPTBL_FL"))
BITMAP_TREE(@"SEL\$A8B7A3F4" "D"@"SEL\$13" AND(OR(1 1 ("DSCLR"."FORM_TYPE_CD") 2 ("DSCLR"."FORM_TYPE_CD")) ("DSCLR"."DSCLR_TYPE_CD")))
NO_ACCESS(@"SEL\$A8B7A3F4" "DF"@"SEL\$13")
INDEX(@"SEL\$A8B7A3F4" "H7"@"SEL\$2" ("H760_RGLTY_ACTN_DSCLR"."FLNG_PK" "H760_RGLTY_ACTN_DSCLR"."DSCLR_PK" "H760_RGLTY_ACTN_DSCLR"."REC_SEQ_NB"))
FULL(@"SEL\$A8B7A3F4" "DS"@"SEL\$9")
FULL(@"SEL\$A8B7A3F4" "RST"@"SEL\$11")
FULL(@"SEL\$A8B7A3F4" "ITT"@"SEL\$3")
FULL(@"SEL\$A8B7A3F4" "ST"@"SEL\$5")
FULL(@"SEL\$A8B7A3F4" "PT"@"SEL\$7")
LEADING(@"SEL\$A8B7A3F4" "OH"@"SEL\$1" "O"@"SEL\$13" "D"@"SEL\$13" "DF"@"SEL\$13" "H7"@"SEL\$2" "DS"@"SEL\$9" "RST"@"SEL\$11" "ITT"@"SEL\$3" "ST"@"SEL\$5" "PT"@"SEL\$7")
USE_NL(@"SEL\$A8B7A3F4" "O"@"SEL\$13")
NLJ_BATCHING(@"SEL\$A8B7A3F4" "O"@"SEL\$13")
USE_HASH(@"SEL\$A8B7A3F4" "D"@"SEL\$13")
USE_NL(@"SEL\$A8B7A3F4" "DF"@"SEL\$13")
USE_NL(@"SEL\$A8B7A3F4" "H7"@"SEL\$2")
NLJ_BATCHING(@"SEL\$A8B7A3F4" "H7"@"SEL\$2")
USE_HASH(@"SEL\$A8B7A3F4" "DS"@"SEL\$9")
USE_HASH(@"SEL\$A8B7A3F4" "RST"@"SEL\$11")
USE_HASH(@"SEL\$A8B7A3F4" "ITT"@"SEL\$3")
USE_HASH(@"SEL\$A8B7A3F4" "ST"@"SEL\$5")
USE_HASH(@"SEL\$A8B7A3F4" "PT"@"SEL\$7")
SWAP_JOIN_INPUTS(@"SEL\$A8B7A3F4" "D"@"SEL\$13")
INDEX_RS_ASC(@"SEL\$13512960" "DF1"@"SEL\$14" ("DSCLR_FLNG"."DSCLR_PK" "DSCLR_FLNG"."BLLBL_FL"))
END_OUTLINE_DATA
*/
```

This plan gives you an idea of why your initial synchronization has been long - most of your readings are one-piece readings and you have read 53 724 blocks. If you estimate 1 centisecond by read (which could be on a reasonable charge system) then it is 537 seconds. to 5 milliseconds per read, it's still 268 seconds or 4 minutes and 30 seconds.

A quick break down of some (the worst case) potential time - only you can say whether or not some of these readings will be always/often/never being cached in the file or at the SAN level.

Line 11 - physical reads 6 400 done - it's a tree bitmap then the readings are in the order of physical table with no. rereads. Call 5ms by read-online 32 seconds. L

| * 11 |            TABLE ACCESS BY INDEX ROWID | DSCLR                       |      1.   5079.   158K |   533 (1) | 00:00:08 |  91395 | 00:00:01.27 |    6460.   6400 |       |       |          |

The hash join takes us from 6 400 to 11 788 because it joins, lines 21 to 25 (nested loop) in which most of the work is the random access table with some automatic caching: 26 seconds. Do a search here rather than indexed 22 000 access? Which would be faster, which would charge less.

| * 25.             TABLE ACCESS BY INDEX ROWID | OCRN                        |  22050.      1.    21.     1 (0) | 00:00:01 |  21059 | 00:01:04.74 |   15634 |   5280.       |       |          |

Three nested loops that introduce more readings:

11788 9-> 26386:14 600 of the predicate view pushed which some lies but a very large index and a table of random access 73 seconds

8 26386-> 33783:7 400 index line 30 - big clue about 37 seconds Access hides

33783 7-> 53691:19 900 31 table access - large table line, not much caching, 100 seconds.

In each case, you can ask if an analysis would take less time than all of these random reads.

NOTE - all I'm pointing our here where you potentially use a lot of time so that you can ask whether or not you should do little of the query in this way, or if there is an alternative, or if the work you're doing is absolutely necessary. If you want to optimize the query you should consider the intent of the query and think your way through a reasonable join order to see if you can imagine an effective way to get the same data. I have written a few articles and presentation on an approach that begins by drawing - here is a link to an article I wrote for a group of SQL Server: https://www.simple-talk.com/sql/performance/designing-efficient-sql-a-visual-approach/

and a video I did with Kyle Hailey, while he was working for Embarcadero:Tune in for the ultimate SQL Tune-off | Landing pages

Concerning

Jonathan Lewis

• Need help for the conversion of the nested loops to use the stream

I'm trying to teach me how to effectively use the java stream, but finds it difficult to find the correct syntax for a problem of nested loop. I would like to convert the following code to use the Java 8 stream instead of nested loops.  Can anyone provide an example or a solution?

``` /**
* Return all members of stringListOne that begin with any of the strings in
* stringListTwo
*
* @return all members of stringListOne that begin with any of the strings in
* stringListTwo
*/
Set<String> getFilteredStrings(Set<String> stringListOne, Set<String> stringListTwo) {

Set<String> stringListOneFiltered = new HashSet<String>();
for (String next : stringListOne) {
for (String nextPrefix : stringListTwo) {
if (next.startsWith(nextPrefix)) {
}
}
}
return stringListOneFiltered;
}
```

Here's a test case for the above code:

```/**
*/
@Test
public final void testGetFilteredStrings() {

MyClass uut = new MyClass();

Set<String> stringListOne = new HashSet<String>();

Set<String> stringListTwo = new HashSet<String>();

Set<String> result= uut.getFilteredStrings(stringListOne, stringListTwo);

System.out.println(result);
assertEquals(8, result.size());
}
```

Thanks for any help you can provide!  I get the hang of using the course of water, but this particular code was difficult.

tmbc

I found the following solution to my question:

GetFilteredStrings (Set stringListOne, the value

{Set stringListTwo)

Predicate startsWith = p-> stringListTwo.stream () .anyMatch (prefix-> p.startsWith (prefix));

Return stringListOne.stream () .filter (startsWith) .collect (Collectors.toSet ());

}

• Variable and nested loops

Hi, I'm a relatively new to programming of LV, so be gentle.

In a Word, I am running nested loops than the material test power on and off cycles. The parameters for each loop is entered on the front panel of the user. For example, the power supply at the time, how many times to read in the data, power supply off time and the number of cycles power is a typical customer task ask me to do. Therefore, I decided to do a generic as possible executable vi instead of writing code (in which I request is trivial), that my technicians can easily use.

I want to put a counter - down in this vi, even a journey of one. I'll take the more the off time multiplied by the number of cycles and display on the front panel. For some reason that I can't find a simple way such that when the last cycle ended if poster zero before the program ends.

For example, the total is equal to 60 minutes and 10-minute cycle. I run the program and the display shows 60 during the first cycle, after the first cycle is complete and the second cycle begins the display turns 50, and so on until that last cycle where you can read 10. Then the program ends and the screen 10. How can I get a last beat of this kind it says 0 and 0 poster before the end of the program?

Thank you!

Wire a zero to a local variable of this indicator so that it can turn when the while loop ends.

• Create a table in a loop 'for' (reset the number of loops)

Hello

I try to incorporate a signal of acceleration from an analog input CRIO to get speed and then further integrate to get the moving of a vibration system.

I understand that to achieve integration, a table must be fed in. My problem is that I could not buffer the signal in a buffer block, as I couldn't find buffer blocks. so I decided to create my data table by using a loop "for". The nests of the loop 'for' inside a timed loop. The problem that I'm stuck on is how to reset the loop 'for' in order to fill the buffer with each iteration of the outer loop timed.

I enclose the code if that helps. Note that I use labview in 2013.

If anyone who has encountered a similar problem before can help me, I would be gratefull.

Concerning

Ali

You can use a shift register initialized as inputs to your curls, to build your table of one. However, you realize, don't you, that the execution of your program as written loops as soon as the computer can spit out responses, then the output array may contain several points that took place before the entry has updated? Assuming that your thing cRIO (I've not worked with these) has integrated into its routine acquisition of calendar data, I suggest you put that inside the loop to get a data point by reading.

And do you really want your graph to distance for update only every thousand points (points of acceleration million) speed?

Cameron

• Value of the loop 'For' pass before the complete loop - FPGA

Hello

8.5 LV, LV FPGA, PCI 7831-R FPGA Board

I got a cramp of brain on this one.  I have a function (Arb. GIS read) that Im using to generate an arbitrary signal which I created in memory.  I can't move to the value of data however.  I don't know why I can not, its because it is nested in a "loop For" who runs indefinetly and updates only the value whenever it loops back to 'zero '.  Ideas quick and dirty on how to use this value as it is being updated in the loop in my hand vi?

I've seen messages on the use of local variable 'Files' and property nodes, but I can not just give a sense the.  Maybe because it's FPGA, something is different/no supported?

* My principal is 'control MicroMirror Arb. SP", look in the #4 case and the condition of"false. "

The 'Sub - VI' is called 'Arb Sig read RevB', and I'm trying to pass the variable 'Data' to hand while the loop For always runs.

Thank you!

• Help to find the best way to interior design (Nested Loops of sliders?)

Oracle 11G

First here the table I work with, for example data

ID FID ANNOTATION DESIGNATION LOW HIGH SEQ
11008755360FC1053, 81-82FC105381821
21008755360XD, 3-24XD3242
31008756293FC1053, 81-82FC105381821
41008756293XD, 3-24XD3242

Each FID is a different line, these two lines are connected physically, that's why I've shown them here on the table. Each line has a 'meter', in this case, each line has 2 lines of account that are the same.

From there, we can say that FC1053, 81 and 82 are connected between the 2 cables. XD DESIGNATION means that cables are connect not really so I can't ignore those.

We have a different way to show that they connect other than only those data and I need to connect each other too much. For this I need the Info

FID1 LOW HIGH FID2
100875536081821008756293

So my first design was the hepatitis hase sliders 2 with the data in the table, as shown above. I would then have a nested loop. The first slider to select the first record, then go down to the second loop where I compare all other records the first record and then go back in the outer loop to move to the next record, then return once again to the inner loop to compare the values again.

LOOP1

LOOP 2

If LOOP1. IDF! LOOP2 =. IDF THEN

IF LOOP1. ANNOTATION = LOOP2. ANNOTATION THEN

-CONNECT THE DATA

ON THE OTHER

IF LOOP1. DESCRIPTION = LOOP2. DESIGNATION THEN

IF LOOP2. LOW BETWEEN LOOP1. LOW AND LOOP1. THEN HIGH

IF LOOP2. HIGH BETWEEN LOOP1. LOW AND LOOP1. HGH THEN

-CONNECT THE DATA

END IF;

END IF;

END IF;

END IF;

END IF;

END LOOP;

-Open and close done to reset the cursor to the front/top

CLOSE CURSOR LOOP2;

OPEN CURSOR LOOP2

END LOOP;

The problem with this approach is once the outside loop moves the next value of the IDF, that logic will connect them once again, but this time with the FIDs reverse which is essentially the same thing as it does not matter the direction in which they are connected. I almost feel that once I found the link I need to remove that line from the cursor (which isn't possible).

FID1 LOW HIGH FID2
100875536081821008756293
100875629381821008755360

I was able to

1. make a list of all those I have connected and check against that

2 use some kind of collection

3. use a temporary table to hold the data

4 something that I have not yet thought

I really appreciate in advance for any help I get.

If your query mapping is correct, this is the result of your query with the addition of the values of sum for the strand/down running.  Manually change the incorrect in the output bit numbers so that we can move on to find another solution.

with gc_count like)

Select

Sum(current_high-current_low+1) on strand_high (g3e_fid seq order partition),

Sum(current_high-current_low+1) more (partition of g3e_fid order of seq).

strand_low (current_high-current_low),

t.* from b\$ gc_count t

)

Select

a.g3e_fid, a.current_designation, a.current_low, a.current_high, a.strand_high, a.strand_low,

b.g3e_fid, b.current_designation, b.current_low, b.current_high, b.strand_high, b.strand_low

gc_count a, gc_count b

where a.g3e_fid in (1008757155,1008757159,1009999655)

and in b.g3e_fid (1008757155,1008757159,1009999655)

and a.g3e_fid > b.g3e_fid

and ((a.count_annotation = b.count_annotation)

or (a.current_designation = b.current_designation

and a.current_low b.current_low and b.current_high and a.current_high between b.current_low and b.current_high)

order of b.seq

/

G3E_FID CURRENT_DESIGNATION CURRENT_LOW CURRENT_HIGH STRAND_HIGH STRAND_LOW G3E_FID CURRENT_DESIGNATION CURRENT_LOW CURRENT_HIGH STRAND_HIGH STRAND_LOW

---------- --------------------- ----------- ------------ ----------- ---------- ---------- --------------------- ----------- ------------ ----------- ----------

GAGA GAGA 1008757159 1008757155 1 1 2 2 1 2 2 1

1008757159 3 8 8 3 1008757155 3 8 8 3 F1DM F1DM

1008757159 9 10 10 9 1008757155 9 10 10 9 F2 F2

1008757159 11 14 14 11 1008757155 11 14 14 11 F1DM F1DM

1009999655 17 18 6 5 1008757155 15 18 18 15 F2 F2

1008757159 15 16 16 15 1008757155 15 18 18 15 F2 F2

1009999655 21 24 4 1 1008757155 21 24 24 21 F2 F2

7 selected lines.

Elapsed time: 00:00:00.06

• Not the same State (<>) of nested loops

Hi gurus and Experts.

I need advice/suggestion on the query plan below. This plan is go for Nested Loops, am not able to force to go to the hash join or Merge Join with tips.
Can someone help me please what is happening, and it is possible to escape from nested loops.
I don't want to take the help of index for this scenario.

D/B: Oracle 11 g 2,
``````create table parent as
with main as (select --+materialize
round(dbms_random.value(low=>1,high=>100)) SAMPLE_ID,dbms_random.string(opt=>'U',len=>10) SAMPLE_TEXT,rownum id from dual
connect by level<=100000)
``````create table child as
with main as (select --+materialize
round(dbms_random.value(low=>1,high=>100)) SAMPLE_ID,dbms_random.string(opt=>'U',len=>10) SAMPLE_TEXT,rownum id from dual
connect by level<=10000)
``````select --+use_hash(p c)
p.id from parent p,child c where p.id<>c.id``````
``````Plan
SELECT STATEMENT  ALL_ROWSCost: 973,076  Bytes: 8,999,910,000  Cardinality: 999,990,000
3 NESTED LOOPS  Cost: 973,076  Bytes: 8,999,910,000  Cardinality: 999,990,000
1 TABLE ACCESS FULL TABLE APP.CHILD Cost: 12  Bytes: 40,000  Cardinality: 10,000
2 TABLE ACCESS FULL TABLE APP.PARENT Cost: 97  Bytes: 499,995  Cardinality: 99,999  ``````

902629 wrote:

I need advice/suggestion on the query plan below. This plan is go for Nested Loops, am not able to force to go to the hash join or Merge Join with tips.

You will not be able to use a hash join

http://docs.Oracle.com/CD/E11882_01/server.112/e16638/optimops.htm#i36043

>
The optimizer uses hash join to join two tables if they are added by using an equijoin and if one of the following conditions are met:
>

You may be able to force a sort merge join, it does not mention if different will work, I don't see how it would be

http://docs.Oracle.com/CD/E11882_01/server.112/e16638/optimops.htm#i49183

>
Sort merge joins are useful when the join condition between two tables is a condition of inequality such as <,> <=,>, or > =. Fusion type joints are more successful than joins loops nested for large sets of data. You cannot use hash joins unless there is a condition of equality.
>

I can't imagine this treatment an antijoin more efficiently than nested If loops.

• Is the merge join Cartesian intensibe more CPU than nested loops?

Hello
just wonderning which access method is more intensive CPU, supposed to leave we got 2 the same rank sources and make joing via merge join Cartesian and then case is nested loop.
I know that nl can be CPU due to the tight loop access, but what abour MJC?
I can see bufferd sort but not sure is that cpu friendly?
Concerning
GregG

The simplest answer I think is "it depends on the situation." Two of them could be disaster in different situations. Nested loops are suitable for a type of join and Cartesian for another.

• Nested loops

Hello

A fundamental question about Nested Loops, what is the number of rows in the inner table means (4 in this example)? This is the average number of lines that oracle had to read by loop?

Thank you.
``````SYS> SHOW PARAMETER optimizer_features_enable

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
optimizer_features_enable            string      11.2.0.1

HR> EXEC DBMS_STATS.GATHER_TABLE_STATS (USER , 'EMPLOYEES' , CASCADE => TRUE )

PL/SQL procedure successfully completed.

HR> EXEC DBMS_STATS.GATHER_TABLE_STATS (USER , 'DEPARTMENTS' , CASCADE => TRUE )

PL/SQL procedure successfully completed.

HR> SELECT COUNT(*) FROM employees ;

COUNT(*)
----------
107

HR> SELECT COUNT(*) FROM departments ;

COUNT(*)
----------
27

SELECT /*+ USE_NL(e d) */ e.last_name , d.department_name
FROM employees e , departments d
WHERE e.department_id = d.department_id;

Execution Plan
----------------------------------------------------------
Plan hash value: 2968905875

------------------------------------------------------------------
| Id  | Operation          | Name        | Rows  | Bytes | Cost  |
------------------------------------------------------------------
|   0 | SELECT STATEMENT   |             |   106 |  2862 |    24 |
|   1 |  NESTED LOOPS      |             |   106 |  2862 |    24 |
|   2 |   TABLE ACCESS FULL| DEPARTMENTS |    27 |   432 |     2 |
|*  3 |   TABLE ACCESS FULL| EMPLOYEES   |     *4* |    44 |     1 |
------------------------------------------------------------------``````

Hello

A fundamental question about Nested Loops, what is the number of rows in the inner table means (4 in this example)? This is the average number of lines that oracle had to read by loop?

Hello

in fact, it's exactly what it is, with the exception of is not the true Oracle number was read, it is an estimate.

You can track 10053 and see how the optimizer reach these numbers. The optimizer calculates the cardinality of the join using the following formula:

cardinality (employees) * *(join selectivity) cardinality (departments).

and join selectivity is essentially 1/greater (num_distinct (departments.department_id), (departments.department_id) num_distinct), adjusted for null values (not NULL values in this particular case, so no adjustment is necessary).

If you plug the values you get for the cardinality of the join:

107 * 27 * join selectivity, which join selectivity = 1/greater(11, 27) = 1/27 = 0.036691, so 107 * 27 * 0.036 ~ = 106.

4 comes from this number by dividing the cardinality expected join (106) by the estimated number of iterations of the nested loop (27).

It is not true the optimizer assumes an even distribution here - if it did, then it should get to 11 employees by Department, not 4 (because num_distinct (employees.department_id) = 11, not 4).

If you are interested in these issues, please refer to the excellent book by Jonathan Lewis "Cost based fundamentals", is all explained quite well in there.

Best regards
Nikolai

• When oracle uses a nested loop join full?

Hello!

Oracle database uses a complete nested loop join? I mean, imagine 2 tables without any index... is there a case where Oracle made a full scan of the inner table for each row in the outer table? I know it's the original algorithm of the nested loop join, but some databases prefer to do a temp table to autoindex the internal table and never does a full scan of the inner table...

Thank you!!

is 100% clear in its language. Simply click on it.
A nested loop join involves the following steps:

The optimizer determines the driving table and it designates as the outer table.
The other table is referred to as the inner table.
For each row in the outer table, Oracle access all rows from the inner table. The outer loop is for each row in the outer table, and the inner loop is for each line of the internal table. The outer loop appears before the inner loop in the execution plan, as follows:
NESTED LOOPS
outer_loop
inner_loop

Concerning
Girish Sharma

• Partition pruning, nested loops

Hello

I'm having a problem with obtaining the size of partition in a query. I managed to dumb down the problem to the two tables and a minimum query (see below).

Basically I have a partitioned table "Made each year" and a table of assistance 'Current year' that contain always 1 row. The sole purpose of this line is to say which is the year curent, it was the previous year and that next year will be. (In the real problem, there is no standard timeperiods, so we can't calculate just previous and next by adding/subtraction 1 as would be possible in this example).

The following query is executed as I want.
It runs a scan on current_year and then nested loop on the facts. And the size of the partition that was happening.
``````select sum(decode(a.year_key, b.curr_year, some_measure)) as curr_year_measure
from yearly_fact_t a
,current_year  b
where a.year_key = b.curr_year;

------------------------------------------------------------------------------------------------------------
| Id  | Operation                  | Name          | Rows  | Bytes | Cost (%CPU)| Time     | Pstart| Pstop |
------------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT           |               |     1 |    39 |     4   (0)| 00:00:01 |       |    |
|   1 |  SORT AGGREGATE            |               |     1 |    39 |            |          |       |    |
|   2 |   NESTED LOOPS             |               |     1 |    39 |     4   (0)| 00:00:01 |       |    |
|   3 |    INDEX FAST FULL SCAN    | SYS_C00247890 |     1 |    13 |     2   (0)| 00:00:01 |       |    |
|   4 |    PARTITION RANGE ITERATOR|               |     1 |    26 |     2   (0)| 00:00:01 |   KEY |   KEY |
|*  5 |     TABLE ACCESS FULL      | YEARLY_FACT_T |     1 |    26 |     2   (0)| 00:00:01 |   KEY |   KEY |
------------------------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

5 - filter("A"."YEAR_KEY"="B"."CURR_YEAR")``````
The following query is where I have my problem.
The xplan base is the same, but for some reason any cbo abandoned and decide to analyze all the partitions, which was not highly scalable data on production :)
I would have thought that the plan would be the same.
``````select sum(decode(a.year_key, b.curr_year, some_measure)) as curr_year_measure
,sum(decode(a.year_key, b.prev_year, some_measure)) as prev_year_measure
from yearly_fact_t a
,current_year  b
where a.year_key = b.curr_year
or a.year_key = b.prev_year;

-------------------------------------------------------------------------------------------------------
| Id  | Operation             | Name          | Rows  | Bytes | Cost (%CPU)| Time     | Pstart| Pstop |
-------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT      |               |     1 |    52 |    13   (0)| 00:00:01 |       |       |
|   1 |  SORT AGGREGATE       |               |     1 |    52 |            |          |       |       |
|   2 |   NESTED LOOPS        |               |     4 |   208 |    13   (0)| 00:00:01 |       |       |
|   3 |    TABLE ACCESS FULL  | CURRENT_YEAR  |     1 |    26 |     4   (0)| 00:00:01 |       |       |
|   4 |    PARTITION RANGE ALL|               |     4 |   104 |     9   (0)| 00:00:01 |     1 |     6 |
|*  5 |     TABLE ACCESS FULL | YEARLY_FACT_T |     4 |   104 |     9   (0)| 00:00:01 |     1 |     6 |
-------------------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

5 - filter("A"."YEAR_KEY"="B"."CURR_YEAR" OR "A"."YEAR_KEY"="B"."PREV_YEAR")``````
``````-- drop table yearly_fact_t purge;
-- drop table current_year  purge;

create table current_year(
curr_year number(4) not null
,prev_year number(4) not null
,next_year number(4) not null
,primary key(curr_year)
,unique(prev_year)
,unique(next_year)
);

insert into current_year(curr_year, prev_year, next_year) values(2010, 2009, 2011);
commit;

create table yearly_fact_t(
year_key     number(4) not null
,some_dim_key number    not null
,some_measure number    not null
)
partition by range(year_key)(
partition p2007 values less than(2008)
,partition p2008 values less than(2009)
,partition p2009 values less than(2010)
,partition p2010 values less than(2011)
,partition p2011 values less than(2012)
,partition pmax  values less than(maxvalue)
);

insert into yearly_fact_t(year_key, some_dim_key, some_measure) values(2007,1, 10);
insert into yearly_fact_t(year_key, some_dim_key, some_measure) values(2008,1, 20);
insert into yearly_fact_t(year_key, some_dim_key, some_measure) values(2009,1, 30);
insert into yearly_fact_t(year_key, some_dim_key, some_measure) values(2010,1, 40);

commit;``````
What can I do to get the size of partition that you want to occur in the second query?
Or better yet, what is it in my query that prevents it from happening?

We do not have Oracle Database 10 g Enterprise Edition Release 10.2.0.4.0 - 64 bit.

Best regards
Ronnie

I think that the decision of condition influenced gold optimizer. You can rewrite your query to use UNION ALL to see if it helps.

``````select sum(decode(year_key, curr_year, some_measure)) as curr_year_measure
,sum(decode(year_key, prev_year, some_measure)) as prev_year_measure
from (select a.year_key, b.curr_year, some_measure
from yearly_fact_t a
,current_year  b
where a.year_key = b.curr_year
UNION ALL
select a.year_key, b.curr_year, some_measure
from yearly_fact_t a
,current_year  b
where a.year_key = b.prev_year);
```
```

### Maybe you are looking for

• Why the iPhone only applications migrated to the size of the iPhone 4?

IPhone only apps that seem to be enhanced version 4 inches. I know that the ratio is different, but surely, it would be better to show the iPhone 6 version more? Namely, Instagram. I see much more vertical photos on my iPhone on my iPad pro 6. This i

• Question about the new Satellite Pro P100 PSPAHE HARD drive

Hello Can someone tell me, if I can use this drive in my notebook? The original is just too slow. Seagate Momentus 7200.2 2.5 "SATA 8 MB hard 100GB (ST9100821AS) It's a sata-II drive. The laptop will not work with sata-I accelerates, but it will be e

• Why Firefox is not saving my log in info after that I used the option "Remember Me"?

Why Firefox is not saving my log in info after that I used the option "Remember Me"?Whenever I get on a frequently used site where I have already indicated on the Firefox browser to save my log in info, I still need to manually connect. The latest ve

• Qosmio F750 - some keys on the keyboard stoped working

Hello Since 3 months ago, I have a Toshiba Qosmio F750. The other day, I have just the laptop powered and noticed some keys (a, b, n, enter...) didn't work at all. I tried to clean blowing under the keyboard and nothing. In the windows start these ke

• HP envy 1109 tx 32 GB SSD not showning

Hello I buy laptop 15.5 inch HP envy 1109 tx, said, it included 32 GB SSD + 500 GB Sata, but I couldn't see SSD of 32 GB. I also checked in Diskmanagement, but I could not there also. also, I couldn't find the drivers of windows 8 for this laptop. Pl