TISEAN: decision about porting a function

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

TISEAN: decision about porting a function

Piotr Held
Hi Juan,

I encountered a problem (more like a decision) about some of the functions. The problem is that the output is dependent on time (that is execution time). The reason why the TISEAN programs were implemented this way was to get some results without waiting for the program to finish (which I assume could have taken a very long time). What happens is that when a certain amount of time passes the program outputs wherever it's at and then continues on computing. This applies to 'lyap_spec', 'd2' and maybe others.

For further reading see:
* my discussion on github with 'heggus': https://github.com/heggus/Tisean/issues/9

The solution I thought of was to add an option to the program (similar to 'q' in 'more') that would terminate the program and return the latest output it had calculated.

What do you propose to solve this issue?

:)
Reply | Threaded
Open this post in threaded view
|

Re: TISEAN: decision about porting a function

Juan Pablo Carbajal-2
On Mon, Jun 15, 2015 at 8:17 PM, Piotr Held <[hidden email]> wrote:

> Hi Juan,
>
> I encountered a problem (more like a decision) about some of the functions.
> The problem is that the output is dependent on time (that is execution
> time). The reason why the TISEAN programs were implemented this way was to
> get some results without waiting for the program to finish (which I assume
> could have taken a very long time). What happens is that when a certain
> amount of time passes the program outputs wherever it's at and then
> continues on computing. This applies to 'lyap_spec', 'd2' and maybe others.
>
> For further reading see:
> * 'Description of output' section of:
> http://www.mpipks-dresden.mpg.de/~tisean/Tisean_3.0.1/docs/docs_c/lyap_spec.html
> * lines 429-442 of:
> https://bitbucket.org/josiah425/tisean/src/cf22e24e3e20fbf7d8575929098d9ba08d296219/src/__lyap_spec__.cc?at=devel
> * my discussion on github with 'heggus':
> https://github.com/heggus/Tisean/issues/9
>
> The solution I thought of was to add an option to the program (similar to
> 'q' in 'more') that would terminate the program and return the latest output
> it had calculated.
>
> What do you propose to solve this issue?
>
> :)

Basically this is emulating an event. Instead of terminating the
program you can ask for a handle to a function that will plot/print
the data provided every time in a while (could be another parameter,
something like "ShowEvery" and an integer indicating the number of
iterations to wait before showing a result). This is how it is done in
the odepkg package[1], so you can continue with the calculation but
from time to time update a plot with the current values. How do you
see this?

You could implement this part in an m-file and have a call to the C++
code only to do the calculation.
Some thing like
(assume ShowEvery was given)

while (calculation is not finished)
    L = __calculate_lyap__ (..., ShowEvery);
    print/plot L;
endwhile


The last argument of calculate_lyap is just indicating how many
iterations should be calculated. This means that at each call all the
necessary data has to be provided. It would be easier if one could
have a reference to the variables being updated, but I do not know if
this is possible (that is updating a plot/print from within the C++
code). I will check and report back.

Also looking at the code...we need to discuss the gram_schmidt in
there. It might be convenient to use qr (but this is just a future
improvement of TISEAN!).

[1] http://sourceforge.net/p/octave/odepkg/ci/default/tree/inst/integrate_functions/integrate_adaptive.m
line 280 and so on

Reply | Threaded
Open this post in threaded view
|

Re: TISEAN: decision about porting a function

Piotr Held


2015-06-16 0:34 GMT-06:00 Juan Pablo Carbajal <[hidden email]>:
On Mon, Jun 15, 2015 at 8:17 PM, Piotr Held <[hidden email]> wrote:
> Hi Juan,
>
> I encountered a problem (more like a decision) about some of the functions.
> The problem is that the output is dependent on time (that is execution
> time). The reason why the TISEAN programs were implemented this way was to
> get some results without waiting for the program to finish (which I assume
> could have taken a very long time). What happens is that when a certain
> amount of time passes the program outputs wherever it's at and then
> continues on computing. This applies to 'lyap_spec', 'd2' and maybe others.
>
> For further reading see:
> * 'Description of output' section of:
> http://www.mpipks-dresden.mpg.de/~tisean/Tisean_3.0.1/docs/docs_c/lyap_spec.html
> * lines 429-442 of:
> https://bitbucket.org/josiah425/tisean/src/cf22e24e3e20fbf7d8575929098d9ba08d296219/src/__lyap_spec__.cc?at=devel
> * my discussion on github with 'heggus':
> https://github.com/heggus/Tisean/issues/9
>
> The solution I thought of was to add an option to the program (similar to
> 'q' in 'more') that would terminate the program and return the latest output
> it had calculated.
>
> What do you propose to solve this issue?
>
> :)

Basically this is emulating an event. Instead of terminating the
program you can ask for a handle to a function that will plot/print
the data provided every time in a while (could be another parameter,
something like "ShowEvery" and an integer indicating the number of
iterations to wait before showing a result). This is how it is done in
the odepkg package[1], so you can continue with the calculation but
from time to time update a plot with the current values. How do you
see this?

TISEAN uses time instead of iterations. So I left the time (it will automatically show the output after 10 seconds) and I added what you proposed (it's in the 'devel' branch). I tested it manually, did not add new tests.
 
You could implement this part in an m-file and have a call to the C++
code only to do the calculation.
Some thing like
(assume ShowEvery was given)

while (calculation is not finished)
    L = __calculate_lyap__ (..., ShowEvery);
    print/plot L;
endwhile


The last argument of calculate_lyap is just indicating how many
iterations should be calculated. This means that at each call all the
necessary data has to be provided. It would be easier if one could
have a reference to the variables being updated, but I do not know if
this is possible (that is updating a plot/print from within the C++
code). I will check and report back.

In the case of lyap_spec there is no need to plot anything. That could be useful with d2. 

For 'd2' it would be also useful to implement a program interruption that will give you the most recent output as output. So that you could do something like 'ctrl+c' and get the most recent output (I started porting 'd2' in branch: 'devel-0.2.0').

Should the intermediary steps for 'lyap_spec' be part of the output? (that's the way it's implemented in TISEAN), I am not sure that is best. Right now the output contains only the last iteration.

Also, in the issue on git ( https://github.com/heggus/Tisean/issues/9 ), he told me I could feed a delayed input into lyap_spec. I thought about it and I couldn't figure out what parameters to use. If I want to call lyap_spec ([1:100;1:100], 'm',4,'d',6), what should the parameters be that I pass to delay?

:)