The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Origin c Functions Slow Down SIGNIFICANTLY
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Nikola Draganic

USA
2 Posts

Posted - 06/14/2016 :  12:30:35 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hello.
I am using Origin 9.1(Gov).
I wrote multiple functions which take ranges (columns) as vector<double> 's and find things like the derivative, rolling averages on non-static binning, and custom baseline development.

I am fine up to this point where the functions work correctly and speedily(2-4 to find baseline with all inbetween steps).
When using, the functions repetedly, I notice they slow down to about 45 secs after a few re imports original data.
This fixed by saving, closing, and opening the file again. But the real problem is with batch process, where I can see the import take more and more time inbetween. By the way, with Origin's baseline modes, this does not happen.

Should I be deleting my vectors after I use them and if so how...
And how do you make this faster...
Also can you parrallel the batch process?

Nikola

Nikola Draganic

Nikola Draganic

USA
2 Posts

Posted - 06/14/2016 :  12:54:36 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
it might be a good idea to post some code that I use
rIx: range In x
rIy: range In y
angles because the binning is un even...
calling something like avgIterAng(rIx, rIy, .02, .02, 12);
can take from 2 to 20 secs... you can try it in a batch why?

vector<double> avgIterAng(vector<double> rIx,vector<double> rIy,
double backAng, double frontAng, int iter)
{
rs = rIx.GetSize();
vector<double> rO(rs);

for(int j = 0; j < iter; j++)
{
for(int i =0; i < rs; i++)
{
double sum = 0.0;
int backPt = -1, frontPt = -1, tracker = i;
//-1 because the first condition in while
//looops will always pass

while(tracker>-1 && rIx[i]-rIx[tracker]<backAng)
{
tracker--; backPt++;
}
tracker = i;
while(tracker<rs && rIx[tracker]-rIx[i]<frontAng)
{
tracker++; frontPt++;
}


for(int index = i-backPt; index <= i+frontPt; index++)
{
if (index>=0 && index<rs) sum += rIy[index];
else if (index<0) sum += rIy[0];
else sum += rIy[rs-1];
}
rO[i] = sum/(backPt+frontPt+1);
}
rIy =rO;
}


rO = rIy;
return rO;

}

Nikola Draganic
Go to Top of Page

jasonzhao

China
262 Posts

Posted - 06/15/2016 :  04:23:30 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello,

Batch Process feature has been improved in Origin 2016

Would you please try our current version Origin 2016 to see the improvement
http://www.originlab.com/demodownload.aspx

Best regards!
Jason
OriginLab Technical Service
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000