File: [local] / OpenXM / src / kan96xx / Doc / oxasir.sm1 (download)
Revision 1.4, Sun Jan 6 08:47:36 2002 UTC (22 years, 6 months ago) by takayama
Branch: MAIN
Changes since 1.3: +29 -2
lines
"Oxpp" is a utility to build an asir source code from multiple source codes which are
included by the load command each other.
The new source code does not contain "load".
The asirinit command in oxasir.sm1 loads "oxasir-win.rr" instead of
"oxasir.asir" when it is executed on Windows.
oxasir-win.rr should be built by the Makefile in misc/packages/Windows.
|
% $OpenXM: OpenXM/src/kan96xx/Doc/oxasir.sm1,v 1.4 2002/01/06 08:47:36 takayama Exp $
%% kxx/oxasir.sm1 1998, 2/12 (this version is at Old/oxasir.sm1.19980212
%% 3/1, 1995, 11/5, 11/21
%% This file is error clean.
%%%%%%% How to install.
%%% Set ASIR_LIBDIR if necessary. Ex. /u/nobuki/lib/asir
%%% write ~/.asirrc : load("gr")$ load("primdec")$ end$
%%% oxasir.asir must be in
%%% LOAD_SM1_PATH or oxasirpath.asirlib
%%% Edit below
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% /usr/local/lib/sm1, SM1_LOAD_PATH, /usr/local/lib/asir, ASIR_LOAD_PATH
/oxasirpath.oxasir (ox_asir) def %% loadmethod is 1
/oxasirpath.asirlib (oxasir.asir) def
/ox_asirConnectMethod { asirconnectr /oxasir.ccc set } def
%/ox_asirConnectMethod { asirconnect2 } def
%% Old path
%/oxasirpath.oxasir (/home/nobuki/kxx/ox_asir) def %% loadmethod is 1
%/oxasirpath.asirlib (/home/nobuki/kxx/oxasir.asir) def
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
/oxasir.loadmethod 1 def %% "..." oxsendcmo (load) ox...
%/oxasir.loadmethod 0 def %% load("..."); %% at MSRI
%%%%%%%%%%%%%%%% end of configuration.
/initializePathNamesForOxAsir {
[oxasirpath.oxasir] getPathNameAsir /oxasirpath.oxasir set
[oxasirpath.asirlib] getPathNameSm1 /oxasirpath.asirlib set
} def
/oxasir.verbose 0 def
/oxasir.version (2.981105) def
oxasir.version [(Version)] system_variable gt
{ [(This package requires the latest version of kan/sm1) nl
(Please get it from http://www.math.kobe-u.ac.jp/KAN) ] cat
error
} { } ifelse
(oxasir.sm1, --- open asir protocol module 3/1 1998, 6/5 1999) message-quiet
( asirconnect, asir, fctr, primadec, (C) M.Noro, N.Takayama ) message-quiet
/oxasir.ccc load isArray
{ }
{ /oxasir.ccc [ ] def } ifelse
[(parse) (ox.sm1) pushfile] extension pop
oxasir.verbose {
(type in asirconnect to connect, asir is used to execute asir command. )
message
(type in asirconnect2 to open a new window for ox_asir, connect, asir is used to execute asir command [you need to edit asirconnect2 to tell the path to load ox_asir] )
message
} { } ifelse
/loadAsirFile {
/arg1 set
[/in-loadAsirFile /peer /fname] pushVariables
[
/peer arg1 0 get def
/fname arg1 1 get def
oxasir.loadmethod {
peer fname oxsendcmo peer 1 oxsendcmo
peer (load) oxexec
}{
peer [$load("$ fname $");$] cat oxsubmit
}ifelse
] pop
popVariables
} def
[(loadAsirFile)
[$[client fname] loadAsirFile (ox_asir function)$
$Load a file into the client$
]] putUsages
/asirinit {
%% gr and primdec are loaded by .asirrc
/asirinit.peer set
[(ostype)] extension 0 get (windows) eq {
[asirinit.peer (oxasir-win.rr)] oxasirParseFile
}{
[asirinit.peer oxasirpath.asirlib] loadAsirFile
} ifelse
} def
/asirconnect {
[(localhost) 1300 1200] oxconnect /oxasir.ccc set
/ccc oxasir.ccc def %% for compatibility.
oxasir.ccc asirinit
} def
/asirconnect2 {
[oxpath.oxlog.xterm oxpath.ox ( -ox ) oxasirpath.oxasir
oxpath.null
( & )] cat system-csh
% (xterm -e /home/nobuki/kxx/ox -ox /home/nobuki/kxx/ox_asir &) system-csh
% (kterm -iconic -e /home/nobuki/kxx/ox -ox /home/nobuki/kxx/ox_asir &) system-csh
% For MSRI
% Eterm is also nice (including kanji). rxvt is also nice.
%(xterm -icon -e /u/nobuki/tmp/kxx/ox -ox /u/nobuki/tmp/Ox/ox_asir2 &) system-csh
%(kterm2 -e /u/nobuki/tmp/kxx/ox -ox /u/nobuki/tmp/Ox/ox_asir2 &) system-csh
% (If you start the server automatically, you may have a trouble to) message
% (oxreset. In order to avoid this trouble, start the server by hand.) message
(sleep 5) system-csh
[(localhost) 1300 1200] oxconnect /oxasir.ccc set
/ccc oxasir.ccc def %% for compatibility.
oxasir.ccc asirinit
} def
[(asirconnect2)
[(asirconnect2 starts ox_asir server. (ox_asir function))
(Open xxx protocol is used for the communication between sm1 and ox_asir.)
(cf. oxhelp, asir.)
(You need to install ox_asir server to use this function. cf. oxasir)
]] putUsages
/asirconnect3 {
[oxpath.oxlog.xterm oxpath.ox ( -ox ) oxasirpath.oxasir
( -data 2300 -control 2200) oxpath.null
( & )] cat system-csh
% (If you start the server automatically, you may have a trouble to) message
% (oxreset. In order to avoid this trouble, start the server by hand.) message
(sleep 5) system-csh
[(localhost) 2300 2200] oxconnect /oxasir.ccc2 set
/ccc2 oxasir.ccc2 def %% for compatibility.
oxasir.ccc2 asirinit
(The client is stored in oxasir.ccc2.) message
} def
[(asir)
[(pid [asir-command, asir-arg1, asir-arg2, ...] asir result (ox_asir function))
(Call open asir server. You need to install ox_asir on your system)
(to use this function. cf. primadec, fctr, asirconnect2, asirconnectr.)
(If you interrupted the computation by typing ctrl-C, type in )
( oxasir.ccc oxreset ; )
(to interrupt the ox_asir server.)
(Example: oxasir.ccc [(fctr) (x^10-1).] asir )
( )
(This function requires plugins cmo, socket and ox_asir server. cf. oxasir)
(See, ftp://endeavor.fujitsu.co.jp/pub/isis/asir on asir)
]
] putUsages
/asir {
/arg2 set
/arg1 set
[/pid /asir-comm /comm /n /i /rr] pushVariables
[(CurrentRingp)] pushEnv
[
/pid arg1 def
/asir-comm arg2 def
pid tag 6 eq { } { (Invalid pid. See asir.) error } ifelse
pid 0 get (client) eq { } { (Invalid pid. See asir.) error } ifelse
asir-comm tag 6 eq { } { (Invalid argument asir-comm. See asir) error } ifelse
[ %% Change the current ring if necessary to send a correct OxVlist.
asir-comm oxasir.changeRing
] pop
%%% Setting OxVlist to tell asir a way to change dist-poly <==> poly.
(OxVlist=) getVlist2 toString (;) 3 cat_n /comm set
%% comm message
pid comm oxsubmit
pid (print(OxVlist);) oxsubmit
/n asir-comm length def
n 1 sub -1 1 {
/i set
pid asir-comm i get oxsendcmo
pid 1 oxsendcmo pid (ox_dtop) oxexec
} for
pid n 1 sub oxsendcmo
pid asir-comm 0 get oxexec
pid 1 oxsendcmo pid (ox_ptod) oxexec
pid oxpopcmo /arg1 set
] pop
popEnv
popVariables
arg1
} def
/oxasir.changeRing {
/arg1 set
[/in-oxasir.changeRing /f /rr] pushVariables
[
/f arg1 def
f isArray {
f {oxasir.changeRing} map
}{
f isPolynomial {
f (0). eq { }
{ f (ring) dc /rr set [(CurrentRingp) rr] system_variable } ifelse
} { } ifelse
} ifelse
] pop
popVariables
} def
/fctr {
/arg1 set
[/f /comm /vv] pushVariables
[(CurrentRingp)] pushEnv
[
/f arg1 def
oxasir.ccc [ ] eq {
(Starting ox_asir server.) message
ox_asirConnectMethod
} { } ifelse
f isPolynomial not {
/vv f 1 get def
vv isArray { /vv vv from_records def } { } ifelse
/f f 0 get def
[vv ring_of_polynomials 0] define_ring
f . /f set
}{ } ifelse
oxasir.ccc [(fctr) f] asir /arg1 set
] pop
popEnv
popVariables
arg1
} def
[(fctr)
[(You need to install ox_asir server to use this function. (ox_asir function))
(f fctr g)
(poly f; array g;)
([f v] fctr g ; string f, string or array of string v)
(This function factors the polynomial f over Q.)
( )
(Example 1: [(x^10-y^10) (x,y)] fctr ::)
(Example 2: (x^10-1). fctr ::)
( )
(If you interrupted the computation by typing ctrl-C, type in )
( oxasir.ccc oxreset ; )
(to interrupt the ox_asir server.)
( )
(This function requires plugins cmo, socket and ox_asir server. cf.oxasir)
]] putUsages
[(primadec)
[(You need to install ox_asir server to use this function. (ox_asir function))
([ ii ] primadec [[q1 p1] [q2 p2] ... ] )
( array of poly ii; array of poly q1, p1, q2, p2 ...;)
( q1, q2, ... are primary components of the primary ideal decomposition)
( of the ideal generated by << ii >>.)
( )
([ ii v ] primadec [[q1 p1] [q2 p2] ... ] )
( array of poly or string ii; array of string v; array of poly q1, p1, q2, p2 ...;)
(<< v >> is an array of independent variables.)
( )
([ ii v ] primadec [[q1 p1] [q2 p2] ... ] )
( array of poly or string ii; array of string v; array of poly q1, p1, q2, p2 ...;)
( v is a string of variables separated by , )
( )
(Example: [(x,y) ring_of_polynomials 0] define_ring)
( [ [(x^2-1). (x y).] ] primadec pmat ;)
( )
(Example: [ [(x^2-1) (x y)] [(x) (y)]] primadec pmat ;)
( )
(If you interrupted the computation by typing ctrl-C, type in )
( oxasir.ccc oxreset ; )
(to interrupt the ox_asir server.)
( )
(This function requires plugins cmo, socket and ox_asir server. cf.oxasir)
]] putUsages
/primadec {
/arg1 set
[/in-primadec /aa /f /comm /vvv /r /setarg] pushVariables
[(CurrentRingp)] pushEnv
[
/aa arg1 def
aa isArray { } { (<<array>> primadec) error } ifelse
/setarg 0 def
oxasir.ccc [ ] eq {
(Starting ox_asir server.) message
ox_asirConnectMethod
} { } ifelse
aa { tag } map /typev set
typev [ ArrayP ] eq
{ /f aa 0 get def
f 0 get (ring) dc /r set
[(CurrentRingp) r] system_variable
/vvv getVariableNames def
/setarg 1 def
} { } ifelse
typev [ArrayP StringP] eq
{ /f aa 0 get def
/vvv [ aa 1 get to_records pop ] def
/setarg 1 def
} { } ifelse
typev [ArrayP ArrayP] eq
{ /f aa 0 get def
/vvv aa 1 get {toString} map def
/setarg 1 def
} { } ifelse
setarg { } { (primadec : Argument mismatch) error } ifelse
f 0 get isPolynomial {
/r f 0 get (ring) dc def
/vvv vvv { r ,, } map def
}
{
[vvv from_records ring_of_polynomials 0] define_ring
f { toString . } map /f set
vvv { . } map /vvv set
} ifelse
oxasir.ccc [(primadec) f vvv] asir /arg1 set
] pop
popEnv
popVariables
arg1
} def
/getVlist2 {
[/n /i ] pushVariables
[
/n [(N)] system_variable def
[
0 1 n 1 sub { /i set (x) i (dollar) dc 2 cat_n } for
0 1 n 1 sub { /i set (d) i (dollar) dc 2 cat_n } for
] /arg1 set
] pop
popVariables
arg1
} def
%%%%%%%%%%%%%%%%%%%
/getVlist {
[/n /i ] pushVariables
[
/n [(N)] system_variable def
[
0 1 n 1 sub { /i set [(x) (var) i] system_variable } for
0 1 n 1 sub { /i set [(D) (var) i] system_variable } for
] /arg1 set
] pop
popVariables
arg1
} def
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[(chattr) 0 /findIntegralRoots] extension pop
oxasir.verbose {
(Overloaded on findIntegralRoots.) message
} { } ifelse
/findIntegralRoots {
/arg1 set
[/in-findIntegralRoots /pp ] pushVariables
[
/pp arg1 def
oxasir.ccc [ ] eq {
(Starting ox_asir server.) message
ox_asirConnectMethod
} { } ifelse
oxasir.ccc oxIsServerReady
{ pp findIntegralRoots.oxasir /arg1 set}
{ pp findIntegralRoots.slow /arg1 set} ifelse
] pop
popVariables
arg1
} def
/findIntegralRoots.oxasir {
/arg1 set
[/in-findIntegralRoots /f /r /g /aa /rlist] pushVariables
[(CurrentRingp) (KanGBmessage)] pushEnv
[
/f arg1 def
[(s) ring_of_polynomials 0] define_ring
f toString . /f set
f fctr rest /g set
g {
0 get /aa set
aa (s). degree 1 eq {
aa (s). coeff 1 get /aa set
aa length 1 eq { 0 }
{ aa 0 get (1). eq {
0 << aa 1 get (integer) dc >> sub
} { } ifelse
} ifelse
}{ } ifelse
} map
/rlist set
%% rlist ::
[-1000000] rlist join shell rest /arg1 set
] pop
popEnv
popVariables
arg1
} def
%%%%%%%%%%%%%%%%%%%%%%%%%%
/asirconnectr {
[/in-asirconnectr /pass /peer /data /control /oxasir] pushVariables
[
/pass [(oxGenPass)] extension def
/peer [(oxGetPort) (localhost)] extension def
/data peer 1 get toString def
/control peer 3 get toString def
peer message
[oxpath.oxlog.xterm oxpath.ox ( -reverse -ox ) oxasirpath.oxasir
( -data ) data ( -control ) control ( -pass ) pass
oxpath.null
( &)] cat system-csh
[(oxCreateClient2) peer 0 pass] extension /oxasir set
%% 0 means connect from only localhost.
oxasir asirinit
/arg1 oxasir def
] pop
popVariables
arg1
} def
[(asirconnectr)
[(asirconnectr server (ox_asir function))
(array server;)
(Example: asirconnectr /oxasir.ccc set)
]] putUsages
%%%%%%%%%%%%% From gbhg3/Int/intw.sm1
%% This function needs solv1.asir and ox_asir.
%% See solv1.asir for the usage of this function.
/rationalRoots2 {
/arg1 set
[/in-rationalRoots2 /aa /f /comm /vvv /r /setarg
/w /ans
] pushVariables
[(CurrentRingp) (KanGBmessage)] pushEnv
[
/aa arg1 def
aa isArray { } { (<<array>> rationalRoots2) error } ifelse
/setarg 0 def
oxasir.ccc [ ] eq {
(Starting ox_asir server.) message
ox_asirConnectMethod
} { } ifelse
aa { tag } map /typev set
typev [ArrayP StringP ArrayP] eq
{ /f aa 0 get def
/vvv [ aa 1 get to_records pop ] def
/w aa 2 get def
/setarg 1 def
} { } ifelse
typev [ArrayP ArrayP ArrayP] eq
{ /f aa 0 get def
/vvv aa 1 get {toString} map def
/setarg 1 def
/w aa 2 get def
} { } ifelse
setarg { } { (rationalRoots2 : Argument mismatch) error } ifelse
[vvv from_records ring_of_polynomials 0] define_ring
f { toString . } map /f set
vvv { . } map /vvv set
w { toString . } map /w set
(rationalRoots2 -- f = ) messagen f messagen
( , vvv= ) messagen vvv messagen ( , w = ) messagen w message
vvv length 1 eq w 0 get (1). eq and
{
[(KanGBmessage) 0] system_variable
[f] groebner_sugar 0 get /f set
vvv 0 get toString (s) eq {
}{ [[vvv 0 get toString (s)] from_records ring_of_polynomials 0] define_ring}
ifelse
f 0 get toString . [[vvv 0 get toString . (s).]] replace
findIntegralRoots /ans set
}
{
oxasir.ccc [(sm1_rationalRoots2) f vvv w] asir
{(integer) dc} map
/ans set
} ifelse
/arg1 ans def
] pop
popEnv
popVariables
arg1
} def
[(rationalRoots2)
[(rationalRoots2 (ox_asir function) called from intw.sm1 to analyze integral)
(roots.)
]] putUsages
/ptozp_subst {
/arg1 set
[/in-ptozp_subst /aaa /fff /xxx /vvv /vlist] pushVariables
[(CurrentRingp)] pushEnv
[
/aaa arg1 def
/fff aaa 0 get def
/xxx aaa 1 get toString def
/vvv aaa 2 get {toString ..} map def
aaa length 4 eq {
/vlist aaa 3 get def
} {
/vlist 0 def
} ifelse
oxasir.ccc [ ] eq {
(Starting ox_asir server.) message
ox_asirConnectMethod
} { } ifelse
fff isPolynomial {
fff (ring) dc ring_def
fff toString /fff set
}
{ vlist isInteger { (ptozp_subst: need variable names.) error } { } ifelse
[vlist ring_of_differential_operators 0] define_ring
} ifelse
oxasir.ccc [(sm1_ptozp_subst) fff . xxx . vvv] asir
/arg1 set
] pop
popEnv
popVariables
arg1
} def
[(ptozp_subst)
[$[f s [p q] v] ptozp_subst g (ox_asir function)$
$It returns ptozp(subst(f,s,p/q))$
$Example 1: [ (x Dx - s) (s) [2 3] (x,s)] ptozp_subst $
$ ===> 3 x Dx - 2 $
]] putUsages
/reduceByAsir {
/arg1 set
[/in-reduceByAsir /aaa /fff /fff0 /fff1 /vlist] pushVariables
[(CurrentRingp)] pushEnv
[
/aaa arg1 def
/fff aaa 0 get def
aaa length 2 eq {
/vlist aaa 1 get def
} {
/vlist 0 def
} ifelse
oxasir.ccc [ ] eq {
(Starting ox_asir server.) message
ox_asirConnectMethod
} { } ifelse
fff isArray {
fff length 2 eq {
/fff0 fff 0 get def
/fff1 fff 1 get def
} {
([ << [f g] >> vlist ] reduceByAsir ) error
} ifelse
} {
([ << [f g] >> vlist ] reduceByAsir ) error
} ifelse
fff0 isPolynomial fff1 isPolynomial and {
fff0 (ring) dc ring_def
fff0 toString . /fff0 set
fff1 (ring) dc ring_def
fff1 toString . /fff1 set
}
{ vlist isInteger { (reduceByAsir: need variable names.) error } { } ifelse
[vlist ring_of_differential_operators 0] define_ring
fff0 toString . /fff0 set
fff1 toString . /fff1 set
} ifelse
oxasir.ccc [(sm1_rat2plist2) [fff0 fff1]] asir
/arg1 set
] pop
popEnv
popVariables
arg1
} def
[(reduceByAsir)
[$ [[f g] v] reduceByAsir [ff gg] (ox_asir function)$
$ [[f g]] reduceByAsir [ff gg] $
$Example 1: [[(2 x -2) (4 x - 8)] (x)] reduceByAsir $
(Note that there may be a gcd that is more than 1 among the coefficients.)
]] putUsages
%% File should be preprocessed by OpenXM/misc/packages/Windows/oxpp
%% and ./oxapp --removeSharp
[(oxasirParseFile)
[$[peer filename] oxasirParseFile $
$File should be preprocessed by OpenXM/misc/packages/Windows/oxpp$
$and ./oxapp --removeSharp $
]] putUsages
/oxasirParseFile {
/arg1 set
[/in-oxasirParseFile /fname /sss] pushVariables
[
/fname arg1 1 get def
/peer arg1 0 get def
fname pushfile /sss set
peer
[$if (1) { ; $ sss (}$)] cat
oxsubmit
] pop
popVariables
} def
/oxasir.sm1.loaded 1 def
[(ostype)] extension 0 get (windows) eq {
[(parse) (oxasir-win.sm1) pushfile ] extension
}{
initializePathNamesForOxAsir %% This should be the last.
} ifelse