How to delete a random set of indizes from an array as fast as possible?

Hello,
My question sounds a bit like this thread but it isn't...    :-(
http://forums.ni.com/ni/board/message?board.id=170​&message.id=129888&query.id=10689#M129888
When sampling position/force/resistance data I use a time triggered sampling approach. For later analysis I need (among others) force (Y) over position (x).
To get this I calculate the mean force from all time points with equal positions (as time is my common index). That works quite well but with arrays over 300000 points it becomes a bit too slow...
These are my steps so far:
1. Sort the position array
2. Eliminate duplicates from the position array (no array reshape in loop)
3. With the data from 2. get all indices where my original position array has a given value
4. With the indices from 3. get the corresponding force values from the force raw data and calculate the mean
In step 3 I need to search the whole raw position array as many times as there are different position values in itself.
If I could delete all indizes I already found from the array to search that should (in theory) significantly improve performance. On the other hand such an operation would mean a lot of array reshape operations.
What is the best approach to delete the found indizes?
OR
Is there no benefit in deleting the indizes as the array operations to do this need more time than they save?
Thanks!
Sören

Now I'm getting a bit more confused about the app.  If you need a sampling rate higher than the encoder can provide, then then only way I can think of to accumulate multiple readings at the same position is if you have some type of bi-directional cyclical motion.  But if you originally used the encoder as a sampling clock, that seems to imply a unidirectional motion.  Is the motion cyclical or unidirectional?
Knowing that I need to do some similar processing down the road, I did a bit of tinkering today.  The method I described earlier took ~350 msec to process (sort and then calculate averages force per unique position) on 350,000 data points.  A little more tinkering gave me a method that took <100 msec.  The machine was a pretty new test PC with a 2.8 GHz Pentium.  Here's an outline and perhaps I'll be able to scrub the code a bit to post soon.  Hopefully someone will have some even better ideas!
The basic idea is essentially a histogram where each possible integer position value maps to a histogram bin.
1. Based on knowledge of your test equipment, you can know the # of unique positions that can possibly be recorded.  Pre-initialize 2 arrays of this size before starting the main data acquisition.  Both should be full of floating-point 0's.  These will hold (a) count of entries and (b) sum of forces.  Call them the binning arrays.  My test used a size of 8000 possible positions.
2. An auto-indexing For loop goes through the 350,000 integer positions and floating point forces.  The binning arrays enter this loop through shift registers.
3. For each pair, use the integer position to map yourself to the appropriate index of the binning arrays.  Increment that element of the count array and add this iteration's force value to the sum array.
4. After loop completes, divide sum array by count array.  These are your average forces.  (This is why the count is computed as a floating point value.  It was very costly to allow a type coercion from an integer count array into the division function.)  Note that unsampled positions should have 0 counts and produce a NaN result from the division.
There are also ways to calculate a running average in the loop, but I haven't checked (yet) to see if it's faster.  The median you mentioned would need some extra post-loop steps.
I'm sure that if this were a coding challenge, someone would cut the processing time at least in half...  Anyone out there?
-Kevin P.

Similar Messages

  • HOW TO DELETE PARTICULAR TRIPLE SET FROM Oracle SEMANTIC TABLES in 11g

    Can somebody help us how to delete a particular set of triples from Oracle(11g) semantic that we have. Because we noticed that few triple belongs to particular data sets were wrongly loaded so we need to remove only those triples.
    Usually we delete all triples including others such and reload them again along with new triples. We would like to avoid this as we go to production.
    Otherwise When we insert a set of triples belongs to a particular data set, is it possible to know what ids Oracle assigned to that set? Can we delete by id? Just a thought.
    Rgds
    Srini

    Hi,
    It is very strange. I got an email in my inbox saying that you want to find out
    IDs of triples that belong to RNAIDB data set like the following.
    "<http://www.lscdd.lilly.com.sg/lscdd/RNAIDB/...../.../:>".
    This forum does not have your message somehow.
    Assume you have asked such an question :), my answers are
    1) from a modeling perspective, it is not a very good idea to encode
    semantics in the URI lexical form itself. A URI should be treated
    as a symbol.
    2) now assume you have a valid reason for doing this, you can try something like the following.
    CREATE INDEX testdel_sub_idx ON tstdel (triple.GET_SUBJECT());
    -- You can then get the rowid out for those offending rows.
    select rowid
    from tstdel t
    where t.triple.GET_SUBJECT() like '<urn:su%'
    -- Or you can remove them directly.
    delete from tstdel t
    where t.triple.GET_SUBJECT() like '<urn:su%'
    ;

  • How can i distinguish between set or tuples from incoming filters in a calculation

    How can i distinguish between set or tuples from incoming filters in a calculation. i am using descendants function with the leaves option to calculate some project revenue cause there is different calcuation method on sub projects the sum on the main project
    should reflect the sum of the sub project with all different methods.
    this works fine until i try to select 2 sub projects at the same time. i am getting the standard currentset dosnt work cause its a set.
    is there i way i can check if its a multiple select or not and handle it a different way

    Hi,
    Check the following link about Multi Select Calculations written by Mosha.
    http://sqlblog.com/blogs/mosha/archive/2007/01/13/multiselect-friendly-mdx-for-calculations-looking-at-current-coordinate.aspx
    Best regards...
    Chandima Lakmal Fonseka

  • I have a game in the game center(clash of clans) and i have more than one apple mobile on the same account and i dont know how to delete the game(clash of clans) from the game center

    i have a game in the game center(clash of clans) and i have more than one apple mobile on the same account and i dont know how to delete the  game(clash of clans) from the game center.

    Hello ayhamnaser,
    Thank you for using Apple Support Communities.
    For more information, take a look at:
    Using Game Center
    http://support.apple.com/kb/ht4314
    If in Game Center > Me > Games > my iOS Games > swipe to the left on the game > Remove.
    Have a nice day,
    Mario

  • HT4528 im trying to find out how u delete a song that u added from the itunes radio...from iphone???

    i am trying to find out how u delete a song that u added from itunes radio....from iphone????

    HI nhenson04,
    If you are looking to delete downloaded content on your iPhone, you may find the following article helpful:
    Apple Support: How to delete content you've downloaded from the iTunes Store, App Store, iBooks Store, or Mac App Store
    http://support.apple.com/kb/HT5772
    Regards,
    - Brenden

  • HT2731 How do I create an iStore USA account from South Africa. Is it possible using a South African credit card.

    How do I create a USA iStore account from South Africa. Is it possible with a South African credit card.

    Hi ...
    Afraid not ...
    Your credit or debit card credentials must be associated with the same country where you reside.
    "Although you can browse the iTunes Store in any country without being signed in, you can only purchase content from the iTunes Store for your own country. This is enforced via the billing address associated with your credit card or other payment method that you use with the iTunes Store, rather than your actual geographic location."
    From here >  The Complete Guide to Using the iTunes Store | iLounge Article

  • How to delete a RAID set in Disk Utility?

    I set up a mirrored RAID set with two 80GB disks on a 500MHz G4 "sawtooth", then installed Tiger successfully. Statup Disk on the Tiger DVD recognizes it as a valid startup disk, but it won't boot (stays on the white screen with the large apple).
    So, I decided to go back to two separate disks with no RAID, but Disk Utility won't seeem to let me delete a RAID set. It shows the volumes as locked (no apparent way to unlock them), and also doesn't allow me to format the underlying drives (bad file descriptor error).
    Any suggestions on how to undo a RAID set in Tiger?
    Thanks,
    0g
    G4 "Gigabit" Dual-500   Mac OS X (10.4.8)   1.5GB RAM, 1TB internal, SCSI, 802.11g, USB2.0

    Boot from your OS X Installer Disc. After the installer loads select your language and click on the Continue button. After the menubar appears select Disk Utility from the Utilities menu (Installer menu for Panther.) After DU loads select the main entry of the RAID (the one with the RAID size) then click on the RAID tab in the DU main window. Select the main RAID entry from the icon list (the one that says "Mirrored RAID Set" and should have the word "Online" in green. Then click the Delete button down below the list view.
    Be sure to backup first because this could cause complete loss of data.
    Why reward points?(Quoted from Discussions Terms of Use.)
    The reward system helps to increase community participation. When a community member gives you (or another member) a reward for providing helpful advice or a solution to their question, your accumulated points will increase your status level within the community.
    Members may reward you with 5 points if they deem that your reply is helpful and 10 points if you post a solution to their issue. Likewise, when you mark a reply as Helpful or Solved in your own created topic, you will be awarding the respondent with the same point values.

  • How to Delete a Hyper Set - Help!

    Has anyone had any success in deleting a HyperSet? I have tried the actual command to "Clear" hyperset, but all that does is to leave you with a blank "canvas", so to speak. The name changes to "MIDI Controls". Now I have a drop down list of "MIDI Controls". I have found no way to remove those other than to recreate a brand new autoload.iso. However, if you try to import the Hypersets from other songs, all the ones I don't want, end up importing also. I just want a simple way to "delete hyperset".
    Thanks,
    Jack

    hi chris
    thank you for your time.
    i have read what little i can find about the preset manager. i cannot find any info on how to Delete.
    was just returning to say i figured out the save thing from the manual ... which oddly... is hard to find b/c when i click on Photoshop CC manual ... nothing about Patterns is listed.

  • How to Delete the Software Conponents in BULK from IR

    Hi,
    I have Imported many number of software components those were available in SLD into IR unexpectedly
    I know we can delete those from IR one by one using this Blog
    How to : Delete Software Component from Integration Builder
    But How to delete all those at a time . is there any single place to do that
    Regards

    HI
    In IR you need to go one by one only. Double click and select delete from menu.
    Actually in bulk you can remove but thats from SLD and not from IR. You can select SWC from SLD and delete all in one go but from IR its one by one
    Thanks
    Gaurav

  • How to delete the all records in Ztable from report program

    Hi Guys,
    Good Day!
    How to delete all records in Ztable from report program(Means I want to clean Ztable records from report program) .  Please send me the code.
    Thanks & Regards,
    Reddy

    Use this.
    DELETE { {FROM target [WHERE sql_cond]}
           | {target FROM source} }.
    *But before deleting the rows please check if this Ztable is being used in any other programs or used by others.
    Check "where-used-list"
    in se11 give the table name
    utilities- where-used list.
    I hope this helps.
    thanks.

  • How to delete other files(yellow color code) from the hard drive, how to delete other files from the hard drive

    how can i delete the yellow color code items from my hard drive? What are these other files anyway? I wanna save some memory space from my storage.

    Macbook Pro community is here
    Following thread could solve your question.
    https://discussions.apple.com/message/19030300#19030300

  • How to delete large number of email notifications from facebook

    I have been receiving email notifications from facebook for years. I only know how to delete them one at a time. I now want to clean up my computer and do not know how to delete these unneeded emails. they number in the thousands.

    Holding Shift while you click selected everything between two mouse clicks.
    Using Ctrl you can fine turn what is selected by clicking on thing to unselect them
    Got the idea?

  • How to delete all objects for one user from SE80

    Hi all,
    If i want to delete the customer objects defined in the customer space Y or Z from SE80. Object of one user is defined in one package, if i want to delete the pakcage it says, it contain the subobject. So can anybody help me how to delete the customer objects from SE80.
    Your response will be highly rewared.
    Tahnks,
    Salahuddin.

    hi
    good
    i think here you want to delege the development class, if you want to delete the particular development class you have to go for se09 where after selecting the particular development class you can select the delete button.
    thanks
    mrutyun

  • How to delete 3 months old ALL partitions from oracle tables

    How to delete 3 months old ALL partitions? Here is the query i am executing..but this query delete partitions 90 days old..need help sir..
    select 'alter table ABC.'||table_name||' drop partition L_'||to_char(sysdate - 90 ,'DDMONYY') || ' UPDATE GLOBAL INDEXES;' from dba_tables where table_name in ('TABLE1','TABLE2');
    Thanks
    Ora_user

    static sql :-
    alter table TEST1 drop partition L_01DEC10 update global indexes;
    alter table TEST1 drop partition L_06DEC10 update global indexes;
    Table DDL :-
    CREATE TABLE TABLE1
    SEQ_CACHE NUMBER(10) NOT NULL,
    REQUEST_DATE_TIME DATE NOT NULL,
    Manual_load VARCHAR2(30 BYTE) NOT NULL,
    SRS_AUTO VARCHAR2(200 BYTE) NOT NULL,
    SRS_REM VARCHAR2(30 BYTE) NOT NULL,
    TGT_FORM VARCHAR2(200 BYTE) NOT NULL,
    TGT_SYS1 VARCHAR2(25 BYTE),
    LOCK_TYPE VARCHAR2(30 BYTE) NOT NULL,
    AUTO_LEVEL VARCHAR2(20 BYTE) NOT NULL,
    SUCCESS_STS CHAR(1 BYTE) NOT NULL,
    SOURCE_NAME VARCHAR2(200 BYTE) NOT NULL,
    PNAME_SS VARCHAR2(40 BYTE),
    ID_CORE VARCHAR2(40 BYTE),
    ID_TRAN VARCHAR2(40 BYTE),
    TRIP_TIME NUMBER(10),
    REMOTE_TIME NUMBER(10),
    ERROR_TYPE VARCHAR2(30 BYTE),
    ERROR_TOLL VARCHAR2(30 BYTE),
    PRG_ID VARCHAR2(30 BYTE),
    OPER_ERROR_ID VARCHAR2(30 BYTE),
    DES_SYS_ERR VARCHAR2(200 BYTE),
    DBS_INS_DT DATE NOT NULL
    TABLESPACE DAT01
    PCTUSED 0
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    STORAGE (
    INITIAL 64K
    BUFFER_POOL DEFAULT
    PARTITION BY RANGE (REQUEST_DATE_TIME)
    PARTITION L_06APR11 VALUES LESS THAN (TO_DATE(' 2011-04-06 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    LOGGING
    NOCOMPRESS
    TABLESPACE DAT01
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    STORAGE (
    INITIAL 64K
    NEXT 1M
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    BUFFER_POOL DEFAULT
    PARTITION L_11APR11 VALUES LESS THAN (TO_DATE(' 2011-04-11 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    LOGGING
    NOCOMPRESS
    TABLESPACE DAT01
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    STORAGE (
    INITIAL 64K
    NEXT 1M
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    BUFFER_POOL DEFAULT
    PARTITION L_16APR11 VALUES LESS THAN (TO_DATE(' 2011-04-16 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    LOGGING
    NOCOMPRESS
    TABLESPACE DAT01
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    STORAGE (
    INITIAL 64K
    NEXT 1M
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    BUFFER_POOL DEFAULT
    PARTITION L_21APR11 VALUES LESS THAN (TO_DATE(' 2011-04-21 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    LOGGING
    NOCOMPRESS
    TABLESPACE DAT01
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    STORAGE (
    INITIAL 64K
    NEXT 1M
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    BUFFER_POOL DEFAULT
    PARTITION L_26APR11 VALUES LESS THAN (TO_DATE(' 2011-04-26 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    LOGGING
    NOCOMPRESS
    TABLESPACE DAT01
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    STORAGE (
    INITIAL 64K
    NEXT 1M
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    BUFFER_POOL DEFAULT
    PARTITION L_01MAY11 VALUES LESS THAN (TO_DATE(' 2011-05-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    LOGGING
    NOCOMPRESS
    TABLESPACE DAT01
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    STORAGE (
    INITIAL 64K
    NEXT 1M
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    BUFFER_POOL DEFAULT
    PARTITION L_06MAY11 VALUES LESS THAN (TO_DATE(' 2011-05-06 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    LOGGING
    NOCOMPRESS
    TABLESPACE DAT01
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    STORAGE (
    INITIAL 64K
    NEXT 1M
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    BUFFER_POOL DEFAULT
    PARTITION L_11MAY11 VALUES LESS THAN (TO_DATE(' 2011-05-11 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    LOGGING
    NOCOMPRESS
    TABLESPACE DAT01
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    STORAGE (
    INITIAL 64K
    NEXT 1M
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    BUFFER_POOL DEFAULT
    PARTITION L_16MAY11 VALUES LESS THAN (TO_DATE(' 2011-05-16 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    LOGGING
    NOCOMPRESS
    TABLESPACE DAT01
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    STORAGE (
    INITIAL 64K
    NEXT 1M
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    BUFFER_POOL DEFAULT
    PARTITION L_21MAY11 VALUES LESS THAN (TO_DATE(' 2011-05-21 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    LOGGING
    NOCOMPRESS
    TABLESPACE DAT01
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    STORAGE (
    INITIAL 64K
    NEXT 1M
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    BUFFER_POOL DEFAULT
    PARTITION L_26MAY11 VALUES LESS THAN (TO_DATE(' 2011-05-26 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    LOGGING
    NOCOMPRESS
    TABLESPACE DAT01
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    STORAGE (
    INITIAL 64K
    NEXT 1M
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    BUFFER_POOL DEFAULT
    PARTITION L_01JUN11 VALUES LESS THAN (TO_DATE(' 2011-06-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    LOGGING
    NOCOMPRESS
    TABLESPACE DAT01
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    STORAGE (
    INITIAL 64K
    NEXT 1M
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    BUFFER_POOL DEFAULT
    NOCOMPRESS
    NOCACHE
    NOPARALLEL
    MONITORING
    /

  • How to delete photos albums on ipod copied from my computer?

    I copied my photos from my computer to my ipod touch but now need to delete them.  I know how to delete the photos that I took with my ipod camera but can't delete the ones I copied to my ipod. 
    I've gone into iTunes and seleced the photo option but it only lets me check on select sync photo options.  How do I delete the photo's?
    So annoying!

    I tried that but it still didn't remove them from my ipod touch.  They are deleted from my main computer.  The ipod did it's sync then I selected the photo tab, then it ask me to syn photo from pictures.  I clicked on the folder option and deleted the pictures put they are still on my ipod.
    On the bottom it has 2 options: revert and apply.  What does revert mean?

Maybe you are looking for

  • How to set List and Tree Binding Value manually from backing bean?

    Dear All, I somehow found this code to work so that I could set a value on my bindings from a managed bean.   public void setBindingExpressionValue(String expression, Object value)     FacesContext facesContext = getFacesContext();     Application ap

  • ILife 06 compared to iLife 08

    I have been reading that iMovie 08 will not be compatible on my iBook G4. If I purchase iLife 08 and load it will I still have the use of the old iMovie? Or should I just keep what I've got and continue to use 06. Thanks for advise.

  • Is it just me being feeble?

    Just bought an additional 512 for my 17" flat panel imac and I can't get the screws to undo! Arghhh!!! I am really really paranoid about being too forceful as I don't want to damage the screw heads - the middle one turns just fine but the other two a

  • Edge animate and Cordova build

    So recently I was trying out some edge commons functions and have gotten them to work on browsers. So I wanted to do a little experiment so I've decided to try compile the project with cordova build. Well was hoping for it to work but it seems like s

  • How do i update to the latest ios7 without sim card

    I tried to update me old iphone 4 that doesn't have any sim. I am using this phone as a security camera and was wondering how can I achieve the update without sim card. Any help is appreciated. PS I tried the one in google (ios7 beta) but in the late