[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.14 Miscellaneouses


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.14.1 ctrl

ctrl("switch"[,obj])

:: Sets the value of switch.

return

value of switch

switch

switch name

obj

parameter

References

cputime, tstart, tstop, output, pari, setbprec, setprec, eval, deval.

ChangeLog


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.14.2 debug

debug

:: Forces to enter into debugging mode.

[1] debug;
(debug) quit
0
[2] 

[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.14.3 error

error(message)

:: Forces Asir to cause an error and enter debugging mode.

message

string

% cat mod3
def mod3(A) {
        if ( type(A) >= 2 )
                error("invalid argument");
        else
                return A % 3;
}
end$
% asir
[0] load("mod3");
1
[3] mod3(5);
2
[4] mod3(x);
invalid argument
stopped in mod3 at line 3 in file "./mod3"
3                       error("invalid argument");
(debug) print A
A = x
(debug) quit
return to toplevel
[4] 
References

debug.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.14.4 help

help(["function"])

:: Displays the description of function function.

return

0

function

function name


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.14.5 time

time()

:: Returns a four element list consisting of total CPU time, GC time, the elapsed time and also total memory quantities requested from the start of current Asir session.

return

list

[72] T0=time();
[2.390885,0.484358,46560,9.157768]
[73] G=hgr(katsura(4),[u4,u3,u2,u1,u0],2)$
[74] T1=time();
[8.968048,7.705907,1514833,63.359717]
[75] ["CPU",T1[0]-T0[0],"GC",T1[1]-T0[1]]; 
[CPU,6.577163,GC,7.221549]
References

cputime, tstart, tstop, currenttime.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.14.6 cputime, tstart, tstop

cputime(onoff)

:: Stop displaying cputime if its argument is 0, otherwise start displaying cputime after every top level evaluation of Asir command.

tstart()

:: Resets and starts timer for CPU time and GC time.

tstop()

:: Stops timer and then displays CPU time GC time elapsed from the last time when timer was started.

return

0

onoff

flag (arbitrary)

[49] tstart$
[50] fctr(x^10-y^10);
[[1,1],[x+y,1],[x^4-y*x^3+y^2*x^2-y^3*x+y^4,1],[x-y,1],
[x^4+y*x^3+y^2*x^2+y^3*x+y^4,1]]
[51] tstop$
80msec + gc : 40msec
References

time, currenttime, ctrl.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.14.7 timer

timer(interval,expr,val)

:: Compute an expression under the interval timer.

return

result

interval

interval (second)

expr

expression to be computed

val

a value to be returned when the timer is expired

[0] load("cyclic");
1
[10] timer(10,dp_gr_main(cyclic(7),[c0,c1,c2,c3,c4,c5,c6],1,1,0),0);
interval timer expired (VTALRM)
0
[11] 

[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.14.8 currenttime

currenttime()

:: Get current time.

return

UNIX time.

[0] currenttime();
1071639228
[1] 

[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.14.9 sleep

sleep(interval)

:: Suspend computation for an interval.

return

1

interval

interval (micro second)

[0] sleep(1000);
1
[1] 

[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.14.10 heap

heap()

:: Heap area size currently in use.

return

non-negative integer

% asir -adj 16  
[0] load("fctrdata")$
0
[97] cputime(1)$
0msec
[98] heap();
524288
0msec
[99] fctr(Wang[8])$
3.190sec + gc : 3.420sec
[100] heap();
1118208
0msec
[101] quit;
% asir
[0] load("fctrdata")$   
0
[97] cputime(1)$   
0msec
[98] heap();    
827392
0msec
[99] fctr(Wang[8])$
3.000sec + gc : 1.180sec
[100] heap();       
1626112
0msec
[101] quit;
References

Command line options.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.14.11 version

version()

:: Version identification number of Asir.

return

integer

[0] version();
991214

[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.14.12 shell

shell(command)

:: Execute shell commands described by a string command.

return

integer

command

string

[0] shell("ls");
alg           da            katsura       ralg          suit
algt          defs.h        kimura        ratint        test
alpi          edet          kimura3       robot         texput.log
asir.o        fee           mfee          sasa          wang
asir_symtab   gr            mksym         shira         wang_data
base          gr.h          mp            snf1          wt
bgk           help          msubst        solve
chou          hom           p             sp
const         ifplot        proot         strum
cyclic        is            r             sugar
0
[1] 

[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.14.13 map

map(function,arg0,arg1,...)

:: Applies a function to each member of a list or an array.

return

an object of the same type as arg0.

function

the name of a function

arg0

list, vector or matrix

arg1 ...

arbitrary (the rest of arguments)

[82] def afo(X) { return X^3; }
[83] map(afo,[1,2,3]);
[1,8,27]

[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.14.14 flist

flist([mname])

:: Returns the list of function names currently defined.

mname

a module name

return

list of character strings

[77] flist();
[defpoly,newalg,mainalg,algtorat,rattoalg,getalg,alg,algv,...]

[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.14.15 delete_history

delete_history([index])

:: Deletes the history.

return

0

index

Index of history to be deleted.

[0] (x+y+z)^100$
[1] @0;
...
[2] delete_history(0);
[3] @0;
0

[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.14.16 get_rootdir

get_rootdir()

:: Gets the name of Asir root directory.

return

string


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.14.17 getopt

getopt([key])

:: Returns the value of an option.

return

object

References

option, type.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.14.18 getenv

getenv(name)

:: Returns the value of an environment variable.

return
name

string

[0] getenv("HOME");
/home/pcrf/noro

[ << ] [ < ] [ Up ] [ > ] [ >> ]

This document was generated on October 19, 2017 using texi2html 5.0.