forum.alglib.net

ALGLIB forum
It is currently Sun Dec 22, 2024 9:22 am

All times are UTC


Forum rules


1. This forum can be used for discussion of both ALGLIB-related and general numerical analysis questions
2. This forum is English-only - postings in other languages will be removed.



Post new topic Reply to topic  [ 22 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: ALGLIB with Texas Instruments Code Composer Studio
PostPosted: Wed Oct 20, 2010 10:15 am 
Offline

Joined: Wed Oct 20, 2010 10:12 am
Posts: 20
Hi,
I just found out about ALGLIB. Just a quick question, can we use ALGLIB with TI Code Composer Studio ? Have anyone tried this yet?

Thanks in advance.

Regards,
Rizuan


Top
 Profile  
 
 Post subject: Re: ALGLIB with Texas Instruments Code Composer Studio
PostPosted: Wed Oct 20, 2010 12:41 pm 
Offline
Site Admin

Joined: Fri May 07, 2010 7:06 am
Posts: 927
Several questions:
* what ALGLIB functions you want to use?
* what CPU you want to use?

ALGLIB requires IEEE-compatible double precision floating point numbers (single precision support is not enough). So you may have problems when compiling for embedded systems. However, in some cases it is possible to modify ALGLIB so that functions you need will work. I can say more if you tell me more :)


Top
 Profile  
 
 Post subject: Re: ALGLIB with Texas Instruments Code Composer Studio
PostPosted: Thu Oct 21, 2010 10:10 am 
Offline

Joined: Wed Oct 20, 2010 10:12 am
Posts: 20
Hi Sergey,

Thanks for reply. I'm going to use OMAP-L137 Low Power Applications Processor with TMS320C6747 DSP and it support IEEE Double Precision/64-bit floating point. Currentlly, I'm thinking of using smatrixevd to calculate eigenvalue and eigenvector of my matrices. Do you think ALGLIB can be used with that DSP ?

I'm wondering if ALGLIB can perform covariance matrix calculation efficiently like in Matlab as well? Covariance matrix calculation is simple but it requires so many iteration. I'm using basic formula Cov(A,B) = mean(A.B) - mean(A).mean(B). In Visual C++, it took around 4-5 minutes just to calculate covariance matrix with dimension 224 x 224. In Matlab, we can get the result in a few seconds.

Sorry for double questions. But the main issue is can we use ALGLIB with the DSP that supports IEEE Double Precision floating point ?

Regards,
Rizuan


Top
 Profile  
 
 Post subject: Re: ALGLIB with Texas Instruments Code Composer Studio
PostPosted: Thu Oct 21, 2010 11:33 am 
Offline
Site Admin

Joined: Fri May 07, 2010 7:06 am
Posts: 927
Quote:
Sorry for double questions. But the main issue is can we use ALGLIB with the DSP that supports IEEE Double Precision floating point ?

Yes, it is the main issue, but there is one more thing to account for (see below). Your CPU should be either little or big endian, but not mixed endian. From http://focus.ti.com/lit/ds/symlink/omap-l137.pdf I can assume that ALGLIB will work for you.

Another issue possible - compiler being used. ALGLIB initialization code does tricky operations with pointers and double precision numbers to determine system properties at runtime. Although this autodetection code is 100% ANSI C conformant (and is full of optimization-preventing modifiers), some old and broken compilers can overoptimize these operations. MSVC, Sun Studio or modern GCC correctly handle it, but there was a thread recently about bug in the old GCC - viewtopic.php?f=2&t=69

I haven't tested ALGLIB with Texas Instruments C++ compiler, but you can easily do it:
* read http://www.alglib.net/translator/man/ma ... gs_testing
* download patch published at the top of viewtopic.php?f=2&t=69&start=11 and overwrite your copy of ALGLIB with these files (it was not included into 3.0, so you should do it manually). This patch improves situation with overoptimization of autodetection code.
* try to test without optimization, then with full optimization settings
* try both test_i.cpp and test_c.cpp (I recommend you to start from test_i.cpp).
* in any case - whether it fails or works - please, write here about results ;)

As for the covariance matrix, you can improve situation by using Cov(A,B) = mean { (A-mean(A))*(B-mean(B)) }:
* center your variables by subtracting their means
* make one big rectangular matrix from variables
* calculate product of centered vars as product of two matrices. use alglib::rmatrixgemm() to calculate it efficiently.
* then divide result by N - you have your covariance matrix.
Actually, I wanted to implement this code long ago... Maybe it will be done in 3.1 (will be released at the end of the month)


Top
 Profile  
 
 Post subject: Re: ALGLIB with Texas Instruments Code Composer Studio
PostPosted: Tue Oct 26, 2010 2:46 pm 
Offline

Joined: Wed Oct 20, 2010 10:12 am
Posts: 20
Hello Sergey and others who read this thread,

I'm happy to hear that about ALGLIB and Code Composer Studio. I'm not doing that right now, but surely I will let everyone know the results later through here.

And yeap, that is the formulae for covariance matrix I'm using. But I have 224 different vectors to calculate the covariance value. eg. cov(1st, 2nd), cov(1st, 3rd) ...... cov(1st, 224th), cov(2nd, 2nd), cov(2nd, 3rd) .... cov(2nd, 224th) and so on. This makes the process takes time to complete since there are multiplication in our formula between two variables. I'm going to try using alglib::rmatrixgemm() after this. Thanks for the suggestions. Will let you know later.

Regards,
Rizuan


Top
 Profile  
 
 Post subject: Re: ALGLIB with Texas Instruments Code Composer Studio
PostPosted: Wed Oct 27, 2010 12:43 pm 
Offline
Site Admin

Joined: Fri May 07, 2010 7:06 am
Posts: 927
OK, waiting for your results. It is really interesting to hear about ALGLIB being used in embedded platforms.


Top
 Profile  
 
 Post subject: Re: ALGLIB with Texas Instruments Code Composer Studio
PostPosted: Tue Feb 08, 2011 10:03 am 
Offline

Joined: Wed Oct 20, 2010 10:12 am
Posts: 20
Hi Sergey,
I'm back on trying the ALGLIB in Code Composer Studio. I've got a lot of errors and warning. I just followed the similar steps when I want to try run the test_i.c and test_c.c in Visual C++ (Visual Studio 2010). I'm using your latest version, 3.2.0. Do you have any advice ? Code Composer Studio use C codes (I think so, because they use malloc for allocating dynamic array).

Really stuck right here.

Rizuan


Top
 Profile  
 
 Post subject: Re: ALGLIB with Texas Instruments Code Composer Studio
PostPosted: Tue Feb 08, 2011 10:23 am 
Offline
Site Admin

Joined: Fri May 07, 2010 7:06 am
Posts: 927
Can you post compiler log here? As attachment, if possible, because it can be too long.

If Code Composer Studio is just incompatible in some way with ANSI C++, we can try to find some workaround. But if it is in fact C compiler, then things are somewhat harder - it is possible to use plain C version of ALGLIB, but it is not user friendly and not intended to be used directly. But why do you think that it is C compiler, not C++ one? I've googled for a while, and it seems that Texas Instruments Code Composer Studio supports both C and C++.


Top
 Profile  
 
 Post subject: Re: ALGLIB with Texas Instruments Code Composer Studio
PostPosted: Thu Feb 10, 2011 11:50 am 
Offline

Joined: Wed Oct 20, 2010 10:12 am
Posts: 20
Hi Sergey,

Here is a good news (maybe). I can compile the test_i.cpp but with warnings (in Build Logs.txt). The output lsfit_d_spline is failed however (stdout.txt). Can you explain what is this about. There are also a few lines that is unreachable. All the other warnings are just for unused variables. However, most of the variables are used in the codes, but the compiler still give the warnings. Can you suggest any solutions?

Rizuan


Attachments:
File comment: Build logs with warnings
Build Logs.txt [9.96 KiB]
Downloaded 825 times
File comment: Output file from the code
Stdout.txt [86 Bytes]
Downloaded 831 times
Top
 Profile  
 
 Post subject: Re: ALGLIB with Texas Instruments Code Composer Studio
PostPosted: Thu Feb 10, 2011 1:17 pm 
Offline

Joined: Wed Oct 20, 2010 10:12 am
Posts: 20
Hi Sergey,
I've tested the ALGLIB by using the test_c.cpp. The output is as attached.


Attachments:
File comment: Output when running test_c.cpp
Stdout test_c.txt [2.73 KiB]
Downloaded 848 times
Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 22 posts ]  Go to page 1, 2, 3  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 42 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group