Changes between version 5.5.2 and 5.5.3
=======================================
+Scilab Bug Fixes
+================
+
+* Bug #13829 fixed - mean and sum functions returned wrong results for hypermatrices.
+
Changes between version 5.5.1 and 5.5.2
</target>
<!-- Compile sources -->
<target name="compile" description="Build sources" depends="init">
- <javac srcdir="${src.dir}" destdir="${classes.dir}" classpathref="compile.classpath" deprecation="on" debug="${build.debug}" verbose="off" listfiles="on" includeAntRuntime="no" source="6" target="6" encoding="utf-8">
+ <javac srcdir="${src.dir}" destdir="${classes.dir}" classpathref="compile.classpath" deprecation="on" debug="${build.debug}" debuglevel="lines,vars,source" verbose="off" listfiles="on" includeAntRuntime="no" source="6" target="6" encoding="utf-8">
<compilerarg value="-Xlint" />
<!-- Silent some warnings -->
<compilerarg value="-Xlint:-unchecked" />
if test "$with_intelcompilers" = yes; then
-
- CFLAGS=" $CFLAGS -mp"
- # -cm remove comments displays, -w90 -w95 remove warnings abort f90 f95 non standard
-
- FFLAGS=" $FFLAGS -cm -w90 -w95 -mp"
-
-
case "$host" in
i*86-*-linux-gnu | *-pc-linux-gnu )
# -pc64 : double precision
;;
esac
+ if test "$enable_debug_CXX" = yes; then
+ COMPILER_CXXFLAGS="-g $COMPILER_CXXFLAGS $EXTRA_OPTIONS"
+ else
+ COMPILER_CXXFLAGS="-O -DNDEBUG $COMPILER_CXXFLAGS "
+ fi
+
if test "$enable_debug_C" = yes; then
- CFLAGS="-g $CFLAGS $EXTRA_OPTIONS"
+ COMPILER_CFLAGS="-g $COMPILER_CFLAGS $EXTRA_OPTIONS"
else
- CFLAGS="-O -DNDEBUG $CFLAGS "
+ COMPILER_CFLAGS="-O -DNDEBUG $COMPILER_CFLAGS "
fi
if test "$enable_debug_fortran" = yes; then
- FFLAGS="-g $FFLAGS $EXTRA_OPTIONS"
+ COMPILER_FFLAGS="-g $COMPILER_FFLAGS $EXTRA_OPTIONS"
else
- FFLAGS="-O $FFLAGS "
+ COMPILER_FFLAGS="-O -DNDEBUG $COMPILER_FFLAGS "
fi
# TODO : voir si obligatoire vu que c'est en partie le boulot de AC_PROG_C
else
DEBUG_CXXFLAGS="-DNDEBUG"
fi
- COMPILER_CXXFLAGS="-fno-stack-protector " # bug 3131
+ COMPILER_CXXFLAGS="$COMPILER_CXXFLAGS -fno-stack-protector " # bug 3131
;;
esac
DEBUG_CFLAGS="-DNDEBUG"
fi
- COMPILER_CFLAGS="-fno-stack-protector " # bug 3131
+ COMPILER_CFLAGS="$COMPILER_CFLAGS -fno-stack-protector " # bug 3131
# Explictly disable the as needed. It was disable by default but Ubuntu
# activated it by default since release 11.04. See bug #8961.
# Once all cyclic dependencies have been dropped, this line could be removed.
else
DEBUG_CXXFLAGS="-DNDEBUG"
fi
- COMPILER_CXXFLAGS="-fno-stack-protector " # bug 3131
+ COMPILER_CXXFLAGS="$COMPILER_CXXFLAGS -fno-stack-protector " # bug 3131
;;
esac
DEBUG_CFLAGS="-DNDEBUG"
fi
- COMPILER_CFLAGS="-fno-stack-protector " # bug 3131
+ COMPILER_CFLAGS="$COMPILER_CFLAGS -fno-stack-protector " # bug 3131
# Explictly disable the as needed. It was disable by default but Ubuntu
# activated it by default since release 11.04. See bug #8961.
# Once all cyclic dependencies have been dropped, this line could be removed.
AC_DEFUN([SCI_INTEL_COMPILER],
[
-
- CFLAGS=" $CFLAGS -mp"
- # -cm remove comments displays, -w90 -w95 remove warnings abort f90 f95 non standard
-
- FFLAGS=" $FFLAGS -cm -w90 -w95 -mp"
-
-
case "$host" in
i*86-*-linux-gnu | *-pc-linux-gnu )
- # -pc64 : double precision
+ # -pc64 : double precision
EXTRA_OPTIONS=" -pc64 -ffnalias -falias"
;;
esac
+ if test "$enable_debug_CXX" = yes; then
+ COMPILER_CXXFLAGS="-g $COMPILER_CXXFLAGS $EXTRA_OPTIONS"
+ else
+ COMPILER_CXXFLAGS="-O -DNDEBUG $COMPILER_CXXFLAGS "
+ fi
+
if test "$enable_debug_C" = yes; then
- CFLAGS="-g $CFLAGS $EXTRA_OPTIONS"
+ COMPILER_CFLAGS="-g $COMPILER_CFLAGS $EXTRA_OPTIONS"
else
- CFLAGS="-O -DNDEBUG $CFLAGS "
+ COMPILER_CFLAGS="-O -DNDEBUG $COMPILER_CFLAGS "
fi
if test "$enable_debug_fortran" = yes; then
- FFLAGS="-g $FFLAGS $EXTRA_OPTIONS"
+ COMPILER_FFLAGS="-g $COMPILER_FFLAGS $EXTRA_OPTIONS"
else
- FFLAGS="-O $FFLAGS "
- fi
-
+ COMPILER_FFLAGS="-O -DNDEBUG $COMPILER_FFLAGS "
+ fi
+
# TODO : voir si obligatoire vu que c'est en partie le boulot de AC_PROG_C
])dnl SCI_INTEL_COMPILER
if dt==[] then
//R does not furnish time domain
if dt1==[] then
- //no user time domain specified, continuuous time assumed
+ //no user time domain specified, continuous time assumed
dt=0
else
//user time domain specified
//gain margin
//-----------
function ok=check_gmargin(h,fref,gref)
- eps=1e-10
- [g,f]=g_margin(h)
- if fref==0 then
- ok=abs(f - fref)<eps
- else
- ok=abs(f - fref)/abs(fref)<eps
- end
- if gref==0 then
- ok=ok&abs(g - gref)<eps
- else
- ok=ok&abs(g - gref)/abs(gref)<eps
- end
+ eps=1e-10
+ [g,f]=g_margin(h)
+ if fref==0 then
+ ok=abs(f - fref)<eps
+ else
+ ok=abs(f - fref)/abs(fref)<eps
+ end
+ if gref==0 then
+ ok=ok&abs(g - gref)<eps
+ else
+ ok=ok&abs(g - gref)/abs(gref)<eps
+ end
endfunction
//discrete time case
-z=poly(0,'z');
+z=poly(0,"z");
//the references solutions are computed using the following Maple instructions
//Digits:=50:
//z:=exp(I*w):
f_ref=atan((1/215)*sqrt(1136805-8330*sqrt(5970))/(833/43+(1/215)*sqrt(5970)))/(0.1*2*%pi);
g_ref=12.3470513198103944037870;
if ~check_gmargin(h,f_ref,g_ref) then bugmes();quit;end
-h=syslin(0.1,((129/500)+(-483/1000)*z+(117/500)*z^2)/((-67/100)+(1143/500)*z+(-261/100)*z^2+z^3));
+h=syslin(0.1,((129/500)+(-483/1000)*z+(117/500)*z^2)/((-67/100)+(1143/500)*z+(-261/100)*z^2+z^3));
f_ref=atan((1/215)*sqrt(1136805-8330*sqrt(5970))/(833/43+(1/215)*sqrt(5970)))/(0.1*2*%pi);
g_ref=2.8046262254171456578864840;
if ~check_gmargin(h,f_ref,g_ref) then bugmes();quit;end
-h=syslin(1,((21/500)+(-3933/100000)*z+(-15407/100000)*z^2+(9259/50000)*z^3+(6939/(10^12))*z^4)/((-21/500)+(11/125)*z+(57/500)*z^2+(-9/25)*z^3+(1/5)*z^4));
+h=syslin(1,((21/500)+(-3933/100000)*z+(-15407/100000)*z^2+(9259/50000)*z^3+(6939/(10^12))*z^4)/((-21/500)+(11/125)*z+(57/500)*z^2+(-9/25)*z^3+(1/5)*z^4));
f_ref=1/2;
g_ref=6.48227782514616029706190;
if ~check_gmargin(h,f_ref,g_ref) then bugmes();quit;end
-//continuuous time case
-s=poly(0,'s');
+//continuous time case
+s=poly(0,"s");
//the reference solutions are computed using the following Maple instructions
//s:=I*w:
//assume(w, 'real', w > 0)
//M := solve(Im(h) = 0, w)
//evalf(M/(2*Pi))
//evalf(eval(20*log10(1/abs(h)), w = M[k]))
-h=syslin('c',(-1+s)/(3+2*s+s^2));
+h=syslin("c",(-1+s)/(3+2*s+s^2));
f_ref=0;
g_ref=9.5424250943932487459005580;
if ~check_gmargin(h,f_ref,g_ref) then bugmes();quit;end
-h = syslin('c',((1/5)+(4/5)*s+(0/1)*s^2+(3/10)*s^3)/((409/10000)+(1827/10000)*s+(5129/4000)*s^2+(31909/10000)*s^3+(64/25)*s^4 +s^5));
+h = syslin("c",((1/5)+(4/5)*s+(0/1)*s^2+(3/10)*s^3)/((409/10000)+(1827/10000)*s+(5129/4000)*s^2+(31909/10000)*s^3+(64/25)*s^4 +s^5));
f_ref=0.0714555258202006740373134;
g_ref=-4.91687406933815400242335;
if ~check_gmargin(h,f_ref,g_ref) then bugmes();quit;end
-h=syslin('c',485000/(10000*s+200*s^2+s^3));
+h=syslin("c",485000/(10000*s+200*s^2+s^3));
f_ref=100/(2*%pi);
g_ref=12.305765141234350772862319;
if ~check_gmargin(h,f_ref,g_ref) then bugmes();quit;end
-h = syslin('c',1/(s+2*s^2+s^3));
+h = syslin("c",1/(s+2*s^2+s^3));
f_ref=1/(2*%pi);
g_ref=6.0205999132796239042747779;
if ~check_gmargin(h,f_ref,g_ref) then bugmes();quit;end
//phase margin
//-----------
function ok=check_pmargin(h,f_ref,p_ref)
- eps=1e-9
- [p,f]=p_margin(h)
- if f_ref==0 then
- ok=abs(f - f_ref)<eps
- else
- ok=abs(f - f_ref)/abs(f_ref)<eps
- end
- if p_ref==0 then
- ok=ok&abs(p - p_ref)<eps
- else
- ok=ok&abs(p - p_ref)/abs(p_ref)<eps
- end
+ eps=1e-9
+ [p,f]=p_margin(h)
+ if f_ref==0 then
+ ok=abs(f - f_ref)<eps
+ else
+ ok=abs(f - f_ref)/abs(f_ref)<eps
+ end
+ if p_ref==0 then
+ ok=ok&abs(p - p_ref)<eps
+ else
+ ok=ok&abs(p - p_ref)/abs(p_ref)<eps
+ end
endfunction
//discrete time case
//the reference solutions are computed using the following Maple instructions
//assume(w, 'real', w > 0)
//P := solve(abs(h) = 1, w)
//evalf(-(eval(180-180*argument(h)/Pi, w = Re(P[k]))))+360
-h = syslin(0.1,((29/625)+(2399/50000)*z)/((1131/1250)+(-181/100)*z+z^2));
+h = syslin(0.1,((29/625)+(2399/50000)*z)/((1131/1250)+(-181/100)*z+z^2));
f_ref=0.693016600315284442350578876;
p_ref=13.57115563612946355428439468;
if ~check_pmargin(h,f_ref,p_ref) then bugmes();quit;end
-h=syslin(0.1,((43/500)+(-161/1000)*z+(39/500)*z^2)/((-67/100)+(1143/500)*z+(-261/100)*z^2+z^3));
+h=syslin(0.1,((43/500)+(-161/1000)*z+(39/500)*z^2)/((-67/100)+(1143/500)*z+(-261/100)*z^2+z^3));
[p ,f]=p_margin(h);
if p<>%inf then bugmes();quit;end
if f<>[] then bugmes();quit;end
h=syslin(0.1,3*(0.086-0.161*%z+0.078*%z^2),-0.67+2.286*%z-2.61*%z^2+%z^3);
-h=syslin(0.1,((129/500)+(-483/1000)*z+(117/500)*z^2)/((-67/100)+(1143/500)*z+(-261/100)*z^2+z^3));
+h=syslin(0.1,((129/500)+(-483/1000)*z+(117/500)*z^2)/((-67/100)+(1143/500)*z+(-261/100)*z^2+z^3));
f_ref=0.212336488950669705771059018;
p_ref=52.94967415965772478856630911;
if ~check_pmargin(h,f_ref,p_ref) then bugmes();quit;end
//assume(w, 'real', w > 0)
//P := solve(abs(h) = 1, w)
//evalf(-(eval(180-180*argument(h)/Pi, w = Re(P[k]))))+360
-h=syslin('c',((11/10)+(12/5)*s+(7/10)*s^2)/(3+2*s+s^2));
+h=syslin("c",((11/10)+(12/5)*s+(7/10)*s^2)/(3+2*s+s^2));
f_ref=(1/51)*sqrt(15861-204*sqrt(3562))/(2*%pi);
p_ref=-148.547076202317410601324666;
if ~check_pmargin(h,f_ref,p_ref) then bugmes();quit;end
-h = syslin('c',((1/5)+(4/5)*s+(3/10)*s^3)/((409/10000)+(1827/10000)*s+(5129/4000)*s^2+(31909/10000)*s^3+(64/25)*s^4+s^5));
+h = syslin("c",((1/5)+(4/5)*s+(3/10)*s^3)/((409/10000)+(1827/10000)*s+(5129/4000)*s^2+(31909/10000)*s^3+(64/25)*s^4+s^5));
f_ref=0.09144216563554157543991;
p_ref=-13.1128497150069802772313;
if ~check_pmargin(h,f_ref,p_ref) then bugmes();quit;end
//gain margin
//-----------
function ok=check_gmargin(h,fref,gref)
- eps=1e-10
- [g,f]=g_margin(h)
- if fref==0 then
- ok=abs(f - fref)<eps
- else
- ok=abs(f - fref)/abs(fref)<eps
- end
- if gref==0 then
- ok=ok&abs(g - gref)<eps
- else
- ok=ok&abs(g - gref)/abs(gref)<eps
- end
+ eps=1e-10
+ [g,f]=g_margin(h)
+ if fref==0 then
+ ok=abs(f - fref)<eps
+ else
+ ok=abs(f - fref)/abs(fref)<eps
+ end
+ if gref==0 then
+ ok=ok&abs(g - gref)<eps
+ else
+ ok=ok&abs(g - gref)/abs(gref)<eps
+ end
endfunction
//discrete time case
-z=poly(0,'z');
+z=poly(0,"z");
//the references solutions are computed using the following Maple instructions
//Digits:=50:
//z:=exp(I*w):
g_ref=12.3470513198103944037870;
if ~check_gmargin(h,f_ref,g_ref) then pause,end
-h=syslin(0.1,((129/500)+(-483/1000)*z+(117/500)*z^2)/((-67/100)+(1143/500)*z+(-261/100)*z^2+z^3));
+h=syslin(0.1,((129/500)+(-483/1000)*z+(117/500)*z^2)/((-67/100)+(1143/500)*z+(-261/100)*z^2+z^3));
f_ref=atan((1/215)*sqrt(1136805-8330*sqrt(5970))/(833/43+(1/215)*sqrt(5970)))/(0.1*2*%pi);
g_ref=2.8046262254171456578864840;
if ~check_gmargin(h,f_ref,g_ref) then pause,end
-h=syslin(1,((21/500)+(-3933/100000)*z+(-15407/100000)*z^2+(9259/50000)*z^3+(6939/(10^12))*z^4)/((-21/500)+(11/125)*z+(57/500)*z^2+(-9/25)*z^3+(1/5)*z^4));
+h=syslin(1,((21/500)+(-3933/100000)*z+(-15407/100000)*z^2+(9259/50000)*z^3+(6939/(10^12))*z^4)/((-21/500)+(11/125)*z+(57/500)*z^2+(-9/25)*z^3+(1/5)*z^4));
f_ref=1/2;
g_ref=6.48227782514616029706190;
if ~check_gmargin(h,f_ref,g_ref) then pause,end
-//continuuous time case
-s=poly(0,'s');
+//continuous time case
+s=poly(0,"s");
//the reference solutions are computed using the following Maple instructions
//s:=I*w:
//assume(w, 'real', w > 0)
//evalf(M/(2*Pi))
//evalf(eval(20*log10(1/abs(h)), w = M[k]))
-h=syslin('c',(-1+s)/(3+2*s+s^2));
+h=syslin("c",(-1+s)/(3+2*s+s^2));
f_ref=0;
g_ref=9.5424250943932487459005580;
if ~check_gmargin(h,f_ref,g_ref) then pause,end
-h = syslin('c',((1/5)+(4/5)*s+(0/1)*s^2+(3/10)*s^3)/((409/10000)+(1827/10000)*s+(5129/4000)*s^2+(31909/10000)*s^3+(64/25)*s^4 +s^5));
+h = syslin("c",((1/5)+(4/5)*s+(0/1)*s^2+(3/10)*s^3)/((409/10000)+(1827/10000)*s+(5129/4000)*s^2+(31909/10000)*s^3+(64/25)*s^4 +s^5));
f_ref=0.0714555258202006740373134;
g_ref=-4.91687406933815400242335;
if ~check_gmargin(h,f_ref,g_ref) then pause,end
-h=syslin('c',485000/(10000*s+200*s^2+s^3));
+h=syslin("c",485000/(10000*s+200*s^2+s^3));
f_ref=100/(2*%pi);
g_ref=12.305765141234350772862319;
if ~check_gmargin(h,f_ref,g_ref) then pause,end
-h = syslin('c',1/(s+2*s^2+s^3));
+h = syslin("c",1/(s+2*s^2+s^3));
f_ref=1/(2*%pi);
g_ref=6.0205999132796239042747779;
if ~check_gmargin(h,f_ref,g_ref) then pause,end
//phase margin
//-----------
function ok=check_pmargin(h,f_ref,p_ref)
- eps=1e-9
- [p,f]=p_margin(h)
- if f_ref==0 then
- ok=abs(f - f_ref)<eps
- else
- ok=abs(f - f_ref)/abs(f_ref)<eps
- end
- if p_ref==0 then
- ok=ok&abs(p - p_ref)<eps
- else
- ok=ok&abs(p - p_ref)/abs(p_ref)<eps
- end
+ eps=1e-9
+ [p,f]=p_margin(h)
+ if f_ref==0 then
+ ok=abs(f - f_ref)<eps
+ else
+ ok=abs(f - f_ref)/abs(f_ref)<eps
+ end
+ if p_ref==0 then
+ ok=ok&abs(p - p_ref)<eps
+ else
+ ok=ok&abs(p - p_ref)/abs(p_ref)<eps
+ end
endfunction
//discrete time case
//P := solve(abs(h) = 1, w)
//evalf(-(eval(180-180*argument(h)/Pi, w = Re(P[k]))))+360
-h = syslin(0.1,((29/625)+(2399/50000)*z)/((1131/1250)+(-181/100)*z+z^2));
+h = syslin(0.1,((29/625)+(2399/50000)*z)/((1131/1250)+(-181/100)*z+z^2));
f_ref=0.693016600315284442350578876;
p_ref=13.57115563612946355428439468;
if ~check_pmargin(h,f_ref,p_ref) then pause,end
-h=syslin(0.1,((43/500)+(-161/1000)*z+(39/500)*z^2)/((-67/100)+(1143/500)*z+(-261/100)*z^2+z^3));
+h=syslin(0.1,((43/500)+(-161/1000)*z+(39/500)*z^2)/((-67/100)+(1143/500)*z+(-261/100)*z^2+z^3));
[p ,f]=p_margin(h);
if p<>%inf then pause,end
if f<>[] then pause,end
h=syslin(0.1,3*(0.086-0.161*%z+0.078*%z^2),-0.67+2.286*%z-2.61*%z^2+%z^3);
-h=syslin(0.1,((129/500)+(-483/1000)*z+(117/500)*z^2)/((-67/100)+(1143/500)*z+(-261/100)*z^2+z^3));
+h=syslin(0.1,((129/500)+(-483/1000)*z+(117/500)*z^2)/((-67/100)+(1143/500)*z+(-261/100)*z^2+z^3));
f_ref=0.212336488950669705771059018;
p_ref=52.94967415965772478856630911;
if ~check_pmargin(h,f_ref,p_ref) then pause,end
//P := solve(abs(h) = 1, w)
//evalf(-(eval(180-180*argument(h)/Pi, w = Re(P[k]))))+360
-h=syslin('c',((11/10)+(12/5)*s+(7/10)*s^2)/(3+2*s+s^2));
+h=syslin("c",((11/10)+(12/5)*s+(7/10)*s^2)/(3+2*s+s^2));
f_ref=(1/51)*sqrt(15861-204*sqrt(3562))/(2*%pi);
p_ref=-148.547076202317410601324666;
if ~check_pmargin(h,f_ref,p_ref) then pause,end
-h = syslin('c',((1/5)+(4/5)*s+(3/10)*s^3)/((409/10000)+(1827/10000)*s+(5129/4000)*s^2+(31909/10000)*s^3+(64/25)*s^4+s^5));
+h = syslin("c",((1/5)+(4/5)*s+(3/10)*s^3)/((409/10000)+(1827/10000)*s+(5129/4000)*s^2+(31909/10000)*s^3+(64/25)*s^4+s^5));
f_ref=0.09144216563554157543991;
p_ref=-13.1128497150069802772313;
if ~check_pmargin(h,f_ref,p_ref) then pause,end
c Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
c Copyright (C) INRIA
-c
+c
c This file must be used under the terms of the CeCILL.
c This source file is licensed as described in the file COPYING, which
c you should have received as part of this distribution. The terms
-c are also available at
-c http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+c are also available at
+c http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
subroutine matz(ar,ai,lda,m,n,name,job)
c!purpose
tf=tmax
50 continue
hf=min(t0+nhpass*hstep+delta*hstep,tmax)
-c set continuuous integration time
+c set continuous integration time
51 continue
if(abs(tleft-hf).le.1.d-12) goto 52
istore=1
endif
tcrit=hf
stk(lc)=tcrit
-c integrate continuuous part
+c integrate continuous part
if(meth.eq.0) then
call lsoda(bydot2,ny,stk(ly),tleft,tright,itol
$ ,stk(lr),stk(la),itask,istate,iopt,stk(lc),lrw
assert_checkalmostequal(nn(1),81.163512,0.009);
// Same problem, with psol and pjac macros
// Redefine pjac to use res2
+prot = funcprot();
+funcprot(0);
function [wp, iwp, ires] = pjac(neq, t, y, ydot, h, cj, rewt, savr)
ires = 0;
SQuround = 1.490D-08;
ydot(i) = ypsave;
end
endfunction
-Warning : redefining function: pjac . Use funcprot(0) to avoid this message
-
+funcprot(prot);
[yy,nn]=daskr([y0,y0d],t0,t,atol,rtol,res2,jac2,ng,"gr2",info,psol,pjac);
assert_checkalmostequal(nn(1),81.163512,0.003);
deff("s=gr2(t,y,yd)","s=y(1)")
[yy,nn]=daskr([y0,y0d],t0,t,atol,rtol,res2,jac2,ng,gr2,info,psol,pjac);
assert_checkalmostequal(nn(1),81.163512,0.003);
info=list([],0,[],[],[],0,[],0,[],0,0,[],[],1);
-// Hot Restart
+// Hot Restart
[yy,nn,hotd]=daskr([y0,y0d],t0,t,atol,rtol,"res2","jac2",ng,"gr2",info);
t01=nn(1);t=100:20:200;[pp,qq]=size(yy);y01=yy(3:4,qq);y0d1=yy(4:5,qq);
[yy,nn,hotd]=daskr([y01,y0d1],t01,t,atol,rtol,"res2","jac2",ng,"gr2",info,hotd);
// Same problem, with psol and pjac macros
// Redefine pjac to use res2
+prot = funcprot();
+funcprot(0);
function [wp, iwp, ires] = pjac(neq, t, y, ydot, h, cj, rewt, savr)
ires = 0;
SQuround = 1.490D-08;
ydot(i) = ypsave;
end
endfunction
+funcprot(prot);
[yy,nn]=daskr([y0,y0d],t0,t,atol,rtol,res2,jac2,ng,"gr2",info,psol,pjac);
assert_checkalmostequal(nn(1),81.163512,0.003);
deff("s=gr2(t,y,yd)","s=y(1)")
assert_checkalmostequal(nn(1),81.163512,0.003);
info=list([],0,[],[],[],0,[],0,[],0,0,[],[],1);
-// Hot Restart
+// Hot Restart
[yy,nn,hotd]=daskr([y0,y0d],t0,t,atol,rtol,"res2","jac2",ng,"gr2",info);
t01=nn(1);t=100:20:200;[pp,qq]=size(yy);y01=yy(3:4,qq);y0d1=yy(4:5,qq);
//
// This file is distributed under the same license as the Scilab package.
// =============================================================================
+//
// <-- CLI SHELL MODE -->
+//
// <-- ENGLISH IMPOSED -->
-// Run with test_run('differential_equations','intg',['no_check_error_output'])
ilib_verbose(0);
// Function written in the Scilab language
function y = f(x), y = x*sin(30*x)/sqrt(1-((x/(2*%pi))^2)), endfunction
// Function written in Fortran (a Fortran compiler is required)
// define a Fortran function
cd TMPDIR;
-F=[' double precision function ffun(x)'
- ' double precision x, pi'
- ' pi = 3.14159265358979312d+0'
- ' ffun = x*sin(30.0d+0*x)/sqrt(1.0d+0-(x/(2.0d+0*pi))**2)'
- ' return'
- ' end'];
-mputl(F, fullfile(TMPDIR, 'ffun.f'));
+F=[" double precision function ffun(x)"
+" double precision x, pi"
+" pi = 3.14159265358979312d+0"
+" ffun = x*sin(30.0d+0*x)/sqrt(1.0d+0-(x/(2.0d+0*pi))**2)"
+" return"
+" end"];
+mputl(F, fullfile(TMPDIR, "ffun.f"));
// compile the function
-l = ilib_for_link('ffun', 'ffun.f', [], 'f');
+l = ilib_for_link("ffun", "ffun.f", [], "f");
// add the function to the working environment
-link(l, 'ffun', 'f');
+link(l, "ffun", "f");
// integrate the function
-I = intg(0, 2*%pi, 'ffun');
+I = intg(0, 2*%pi, "ffun");
abs(exact-I);
if abs(exact-I) > 1e-9 then bugmes();quit;end
// Function written in C (a C compiler is required)
// define a C function
-C=['#include <math.h>'
- 'double cfun(double *x)'
- '{'
- ' double y, pi = 3.14159265358979312;'
- ' y = *x/(2.0e0*pi);'
- ' return *x*sin(30.0e0**x)/sqrt(1.0e0-y*y);'
- '}'];
-mputl(C, fullfile(TMPDIR, 'cfun.c'));
+C=["#include <math.h>"
+"double cfun(double *x)"
+"{"
+" double y, pi = 3.14159265358979312;"
+" y = *x/(2.0e0*pi);"
+" return *x*sin(30.0e0**x)/sqrt(1.0e0-y*y);"
+"}"];
+mputl(C, fullfile(TMPDIR, "cfun.c"));
// compile the function
-l = ilib_for_link('cfun', 'cfun.c', [], 'c');
+l = ilib_for_link("cfun", "cfun.c", [], "c");
// add the function to the working environment
-link(l, 'cfun', 'c');
+link(l, "cfun", "c");
// integrate the function
-I = intg(0, 2*%pi, 'cfun');
+I = intg(0, 2*%pi, "cfun");
if abs(exact-I) > 1e-9 then bugmes();quit;end
// Test third output argument
[i, err, ierr] = intg(0, 1, f);
if abs(ierr) <> 0 then bugmes();quit;end
+prot = funcprot();
+funcprot(0);
function y = f(x), y = cos(x); endfunction
-Warning : redefining function: f . Use funcprot(0) to avoid this message
-
+funcprot(prot);
[i, err, ierr] = intg(0, %pi, f);
Warning: Round-off error detected, the requested tolerance (or default) cannot be achieved. Try using bigger tolerances.
if abs(ierr) <> 2 then bugmes();quit;end
// IEEE compatibility
// Error 264: "Wrong value for argument #i: Must not contain NaN or Inf."
-if execstr("I = intg(%inf, 0, f)", 'errcatch') <> 264 then bugmes();quit;end
-if execstr("I = intg(-%inf, 0, f)", 'errcatch') <> 264 then bugmes();quit;end
-if execstr("I = intg(%nan, 0, f)", 'errcatch') <> 264 then bugmes();quit;end
-if execstr("I = intg(0, %inf, f)", 'errcatch') <> 264 then bugmes();quit;end
-if execstr("I = intg(0, -%inf, f)", 'errcatch') <> 264 then bugmes();quit;end
-if execstr("I = intg(0, %nan, f)", 'errcatch') <> 264 then bugmes();quit;end
-if execstr("I = intg(%nan, %nan, f)", 'errcatch') <> 264 then bugmes();quit;end
+if execstr("I = intg(%inf, 0, f)", "errcatch") <> 264 then bugmes();quit;end
+if execstr("I = intg(-%inf, 0, f)", "errcatch") <> 264 then bugmes();quit;end
+if execstr("I = intg(%nan, 0, f)", "errcatch") <> 264 then bugmes();quit;end
+if execstr("I = intg(0, %inf, f)", "errcatch") <> 264 then bugmes();quit;end
+if execstr("I = intg(0, -%inf, f)", "errcatch") <> 264 then bugmes();quit;end
+if execstr("I = intg(0, %nan, f)", "errcatch") <> 264 then bugmes();quit;end
+if execstr("I = intg(%nan, %nan, f)", "errcatch") <> 264 then bugmes();quit;end
//
// This file is distributed under the same license as the Scilab package.
// =============================================================================
-
+//
// <-- CLI SHELL MODE -->
+//
// <-- ENGLISH IMPOSED -->
-// Run with test_run('differential_equations','intg',['no_check_error_output'])
-
ilib_verbose(0);
// Function written in the Scilab language
function y = f(x), y = x*sin(30*x)/sqrt(1-((x/(2*%pi))^2)), endfunction
// Function written in Fortran (a Fortran compiler is required)
// define a Fortran function
cd TMPDIR;
-F=[' double precision function ffun(x)'
- ' double precision x, pi'
- ' pi = 3.14159265358979312d+0'
- ' ffun = x*sin(30.0d+0*x)/sqrt(1.0d+0-(x/(2.0d+0*pi))**2)'
- ' return'
- ' end'];
-mputl(F, fullfile(TMPDIR, 'ffun.f'));
+F=[" double precision function ffun(x)"
+" double precision x, pi"
+" pi = 3.14159265358979312d+0"
+" ffun = x*sin(30.0d+0*x)/sqrt(1.0d+0-(x/(2.0d+0*pi))**2)"
+" return"
+" end"];
+mputl(F, fullfile(TMPDIR, "ffun.f"));
// compile the function
-l = ilib_for_link('ffun', 'ffun.f', [], 'f');
+l = ilib_for_link("ffun", "ffun.f", [], "f");
// add the function to the working environment
-link(l, 'ffun', 'f');
+link(l, "ffun", "f");
// integrate the function
-I = intg(0, 2*%pi, 'ffun');
+I = intg(0, 2*%pi, "ffun");
abs(exact-I);
if abs(exact-I) > 1e-9 then pause,end
// Function written in C (a C compiler is required)
// define a C function
-C=['#include <math.h>'
- 'double cfun(double *x)'
- '{'
- ' double y, pi = 3.14159265358979312;'
- ' y = *x/(2.0e0*pi);'
- ' return *x*sin(30.0e0**x)/sqrt(1.0e0-y*y);'
- '}'];
-mputl(C, fullfile(TMPDIR, 'cfun.c'));
+C=["#include <math.h>"
+"double cfun(double *x)"
+"{"
+" double y, pi = 3.14159265358979312;"
+" y = *x/(2.0e0*pi);"
+" return *x*sin(30.0e0**x)/sqrt(1.0e0-y*y);"
+"}"];
+mputl(C, fullfile(TMPDIR, "cfun.c"));
// compile the function
-l = ilib_for_link('cfun', 'cfun.c', [], 'c');
+l = ilib_for_link("cfun", "cfun.c", [], "c");
// add the function to the working environment
-link(l, 'cfun', 'c');
+link(l, "cfun", "c");
// integrate the function
-I = intg(0, 2*%pi, 'cfun');
+I = intg(0, 2*%pi, "cfun");
if abs(exact-I) > 1e-9 then pause,end
// Test third output argument
[i, err, ierr] = intg(0, 1, f);
if abs(ierr) <> 0 then pause,end
+prot = funcprot();
+funcprot(0);
function y = f(x), y = cos(x); endfunction
+funcprot(prot);
[i, err, ierr] = intg(0, %pi, f);
if abs(ierr) <> 2 then pause,end
// IEEE compatibility
// Error 264: "Wrong value for argument #i: Must not contain NaN or Inf."
-if execstr("I = intg(%inf, 0, f)", 'errcatch') <> 264 then pause,end
-if execstr("I = intg(-%inf, 0, f)", 'errcatch') <> 264 then pause,end
-if execstr("I = intg(%nan, 0, f)", 'errcatch') <> 264 then pause,end
-if execstr("I = intg(0, %inf, f)", 'errcatch') <> 264 then pause,end
-if execstr("I = intg(0, -%inf, f)", 'errcatch') <> 264 then pause,end
-if execstr("I = intg(0, %nan, f)", 'errcatch') <> 264 then pause,end
-if execstr("I = intg(%nan, %nan, f)", 'errcatch') <> 264 then pause,end
+if execstr("I = intg(%inf, 0, f)", "errcatch") <> 264 then pause,end
+if execstr("I = intg(-%inf, 0, f)", "errcatch") <> 264 then pause,end
+if execstr("I = intg(%nan, 0, f)", "errcatch") <> 264 then pause,end
+if execstr("I = intg(0, %inf, f)", "errcatch") <> 264 then pause,end
+if execstr("I = intg(0, -%inf, f)", "errcatch") <> 264 then pause,end
+if execstr("I = intg(0, %nan, f)", "errcatch") <> 264 then pause,end
+if execstr("I = intg(%nan, %nan, f)", "errcatch") <> 264 then pause,end
show = grep(mgetl(SCIHOME+"/.scilab_settings"),"displayWarningFFTW=no")==[]
end
if show then
- MSG_FTTW = [_("You choose to install scilab with fftw module.");
- _("This module requires : "+librarynamefftw+" (GPL licence).");
+ MSG_FTTW = [_("You chose to install Scilab with the fftw module.");
+ _("This module requires: "+librarynamefftw+" (GPL licence).");
_("Scilab will use standard fft by default until you install this library.");
_("See help fftw for more information.")];
msgid "Scilab FFTW module not installed.\n"
msgstr "El mòdul FFTW de Scilab no està instal·lat.\n"
-msgid "You choose to install scilab with fftw module."
+msgid "You chose to install Scilab with the fftw module."
msgstr "Heu triat instal·lar Scilab amb el mòdul fftw."
-msgid "This module requires : "
+msgid "This module requires: "
msgstr "Aquest mòdul requereix: "
msgid ""
msgid "Scilab FFTW module not installed.\n"
msgstr "Scilab modul FFTW není nainstalován.\n"
-msgid "You choose to install scilab with fftw module."
-msgstr "Zvolili jste instalovat scilab s modulem fftw."
+msgid "You chose to install Scilab with the fftw module."
+msgstr "Zvolili jste instalovat Scilab s modulem fftw."
-msgid "This module requires : "
+msgid "This module requires: "
msgstr "Tento modul vyžaduje : "
msgid ""
msgid "Scilab FFTW module not installed.\n"
msgstr "Scilab FFTW Modul nicht installiert.\n"
-msgid "You choose to install scilab with fftw module."
+msgid "You chose to install Scilab with the fftw module."
msgstr ""
-msgid "This module requires : "
+msgid "This module requires: "
msgstr ""
msgid ""
msgid "Scilab FFTW module not installed.\n"
msgstr "El módulo FFTW de Scilab no está instalado.\n"
-msgid "You choose to install scilab with fftw module."
+msgid "You chose to install Scilab with the fftw module."
msgstr "Escogió instalar Scilab con el módulo fftw"
-msgid "This module requires : "
+msgid "This module requires: "
msgstr "Este módulo requiere: "
msgid ""
msgstr ""
# File: etc/fftw.start, line: 34
-msgid "You choose to install scilab with fftw module."
+msgid "You chose to install Scilab with the fftw module."
msgstr ""
#
# File: etc/fftw.start, line: 35
-msgid "This module requires : "
+msgid "This module requires: "
msgstr ""
#
msgid "Scilab FFTW module not installed.\n"
msgstr "Le module Scilab FFTW n'est pas installé.\n"
-msgid "You choose to install scilab with fftw module."
+msgid "You chose to install Scilab with the fftw module."
msgstr "Vous avez choisi d'installer Scilab avec le module fftw."
-msgid "This module requires : "
+msgid "This module requires: "
msgstr "Ce module nécessite : "
msgid ""
msgid "Scilab FFTW module not installed.\n"
msgstr "Il modulo FFTW di Scilab non è installato\n"
-msgid "You choose to install scilab with fftw module."
+msgid "You chose to install Scilab with the fftw module."
msgstr "Si è scelto di installare Scilab con il modulo fftw."
-msgid "This module requires : "
+msgid "This module requires: "
msgstr "Questo modulo richiede : "
msgid ""
msgid "Scilab FFTW module not installed.\n"
msgstr "Scilab FFTW モジュールはインストールされていません。\n"
-msgid "You choose to install scilab with fftw module."
-msgstr "fftwモジュール付きのscilabインストールが選択されました."
+msgid "You chose to install Scilab with the fftw module."
+msgstr "fftwモジュール付きのScilabインストールが選択されました."
-msgid "This module requires : "
+msgid "This module requires: "
msgstr "このモジュールは以下を必要とします : "
msgid ""
msgid "Scilab FFTW module not installed.\n"
msgstr "Modułu Scilab FFTW nie zainstalowano.\n"
-msgid "You choose to install scilab with fftw module."
+msgid "You chose to install Scilab with the fftw module."
msgstr "Wybrałeś instalację Scilaba z modułem fft."
-msgid "This module requires : "
+msgid "This module requires: "
msgstr "Ten moduł wymaga: "
msgid ""
msgid "Scilab FFTW module not installed.\n"
msgstr "O módulo FFTW do Scilab não está instalado.\n"
-msgid "You choose to install scilab with fftw module."
+msgid "You chose to install Scilab with the fftw module."
msgstr "Você escolheu instalar o Scilab com o módulo fftw."
-msgid "This module requires : "
+msgid "This module requires: "
msgstr "Este módulo exige: "
msgid ""
msgid "Scilab FFTW module not installed.\n"
msgstr "Модуль Scilab FFTW не установлен.\n"
-msgid "You choose to install scilab with fftw module."
-msgstr "Вы выбрали установку scilab с модулем fftw."
+msgid "You chose to install Scilab with the fftw module."
+msgstr "Вы выбрали установку Scilab с модулем fftw."
-msgid "This module requires : "
+msgid "This module requires: "
msgstr "Этот модуль требует: "
msgid ""
msgid "Scilab FFTW module not installed.\n"
msgstr "Модуль FFTW Scilab не встановлено.\n"
-msgid "You choose to install scilab with fftw module."
-msgstr "Вами вибрано встановлення scilab з модулем fftw."
+msgid "You chose to install Scilab with the fftw module."
+msgstr "Вами вибрано встановлення Scilab з модулем fftw."
-msgid "This module requires : "
+msgid "This module requires: "
msgstr "Для роботи цього модуля потрібні: "
msgid ""
msgid "Scilab FFTW module not installed.\n"
msgstr "Scilab模块FFTW未安装。\n"
-msgid "You choose to install scilab with fftw module."
+msgid "You chose to install Scilab with the fftw module."
msgstr "你选择要安装带FFTW模块的Scilab"
-msgid "This module requires : "
+msgid "This module requires: "
msgstr "此模块需要: "
msgid ""
msgid "Scilab FFTW module not installed.\n"
msgstr "未安裝 Scilab FFTW 模組.\n"
-msgid "You choose to install scilab with fftw module."
+msgid "You chose to install Scilab with the fftw module."
msgstr ""
-msgid "This module requires : "
+msgid "This module requires: "
msgstr ""
msgid ""
<refnamediv>
<refname>clf</refname>
<refpurpose>
- Clear or reset or reset a figure or a frame uicontrol.
+ Clear or reset a figure or a frame uicontrol.
</refpurpose>
</refnamediv>
<refsynopsisdiv>
</listitem>
</varlistentry>
<varlistentry>
- <term>xset("wpos", x, y)</term>
+ <term>xset("wpos", [x, y])</term>
<listitem>
<para>
Set the position of the upper left point of the graphics
</listitem>
</varlistentry>
<varlistentry>
- <term>xset("wpos",x,y)</term>
+ <term>xset("wpos",[x,y])</term>
<listitem>
- <para>Choisit la position (en pixels) du point en haut à gauche de
+ <para>Choisit la position (en pixels) du point en haut à gauche de
la fenêtre graphique.
</para>
</listitem>
</listitem>
</varlistentry>
<varlistentry>
- <term>xset("wpos",x,y)</term>
+ <term>xset("wpos",[x,y])</term>
<listitem>
<para>ajusta a posição do ponto superior esquerdo da janela de
gráficos.
bar.close();
break;
case Frame:
- SwingScilabFrame frame = (SwingScilabFrame) requestedObject.getValue();
- frame.destroy();
+ Boolean scrollable = (Boolean) GraphicController.getController().getProperty(id, __GO_UI_SCROLLABLE__);
+ if (scrollable) {
+ SwingScilabScrollableFrame frame = (SwingScilabScrollableFrame) requestedObject.getValue();
+ frame.destroy();
+ } else {
+ SwingScilabFrame frame = (SwingScilabFrame) requestedObject.getValue();
+ frame.destroy();
+ }
break;
default:
// Nothing to do
boolean needRevalidate = false;
boolean hasOpenGLAxes = false;
int oldComponentCount = updatedComponent.getComponentCount();
-
+
// Add new children
for (Integer childId : newChildren) {
int childType = (Integer) GraphicController.getController().getProperty(childId, __GO_TYPE__);
if (needRevalidate && updatedComponent != null) {
updatedComponent.revalidate();
}
-
+
// Force repaint if we removed components
if (oldComponentCount > updatedComponent.getComponentCount()) {
updatedComponent.repaint();
if (needRevalidate && updatedComponent != null) {
updatedComponent.getPanel().revalidate();
}
-
+
// Force repaint if we removed components
if (oldComponentCount > updatedComponent.getPanel().getComponentCount()) {
updatedComponent.repaint();
* Destroy the Frame
*/
public void destroy() {
- getParent().remove(this);
this.setVisible(false);
}
-# Polish translation for scilab
# Copyright (c) 2010 Rosetta Contributors and Canonical Ltd 2010
# This file is distributed under the same license as the scilab package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
"Report-Msgid-Bugs-To: <localization@lists.scilab.org>\n"
"POT-Creation-Date: 2013-04-16 17:44+0100\n"
"PO-Revision-Date: 2011-09-02 08:22+0000\n"
-"Last-Translator: Scilab.team <Unknown>\n"
+"Last-Translator: Leszek Dziamski <Unknown>\n"
"Language-Team: Polish <pl@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
#, c-format
msgid "%s: Can not read input argument #%d.\n"
-msgstr ""
+msgstr "%s: Brak możliwości odczytu argumentu wejściowego #%d.\n"
#, c-format
msgid "%s: Wrong type for argument #%d: Real matrix expected.\n"
-msgstr ""
+msgstr "%s: Nieprawidłowy typ dla argumentu wejściowego #%d: Oczekiwana matryca rzeczywista.\n"
#, c-format
msgid "%s: Wrong type for argument #%d: Real scalar expected.\n"
-msgstr ""
+msgstr "%s: Nieprawidłowy typ dla argumentu wejściowego #%d: Oczekiwany skalar rzeczywisty.\n"
#, c-format
msgid "%s: Wrong size for argument #%d: Real scalar expected.\n"
-msgstr ""
+msgstr "%s: Nieprawidłowy rozmiar dla argumentu #%d: Oczekiwany skalar rzeczywisty.\n"
#, c-format
msgid "%s: No more memory.\n"
-msgstr ""
+msgstr "Brak pamięci.\n"
#, c-format
msgid "%s: Wrong value for input argument #%d: An integer value expected.\n"
-msgstr ""
+msgstr "%s: Nieprawidłowa wartość dla argumentu wejściowego #%d: Oczekiwana wartość całkowita.\n"
#, c-format
msgid "%s: Wrong value for input argument #%d: Must be in the set {%s}.\n"
-msgstr ""
+msgstr "%s: Nieprawidłowa wartość dla argumentu wejściowego #%d: Musi znajdować sie w zestawie {%s}.\n"
\ No newline at end of file
/**
* This class provides the capability to access to the Scilab engine from
- * a Java application.<br />
- * <br />
- * Example:<br />
+ * a Java application.<BR>
+ * <BR>
+ * Example:<BR>
* <code>
- * Scilab sci = new Scilab();<br />
- * if (sci.open()) {<br />
- * double [][]a={{21.2, 22.0, 42.0, 39.0},{23.2, 24.0, 44.0, 40.0}};<br />
- * ScilabDouble aOriginal = new ScilabDouble(a);<br />
- * sci.put("a",aOriginal);<br />
- * ScilabDouble aFromScilab = (ScilabDouble)sci.get("a");<br />
- * }<br />
+ * Scilab sci = new Scilab();<BR>
+ * if (sci.open()) {<BR>
+ * double [][]a={{21.2, 22.0, 42.0, 39.0},{23.2, 24.0, 44.0, 40.0}};<BR>
+ * ScilabDouble aOriginal = new ScilabDouble(a);<BR>
+ * sci.put("a",aOriginal);<BR>
+ * ScilabDouble aFromScilab = (ScilabDouble)sci.get("a");<BR>
+ * }<BR>
* </code>
* @see org.scilab.modules.types
*/
private boolean advancedMode = false;
/**
- * Creator of the Scilab Javasci object. <br />
+ * Creator of the Scilab Javasci object. <BR>
* Scilab data path is autodetected and advanced features disabled
*/
public Scilab() throws InitializationException {
}
/**
- * Creator of the Scilab Javasci object with a specific Scilab path.<br />
+ * Creator of the Scilab Javasci object with a specific Scilab path.<BR>
* Advanced features are disabled (faster)
- * <br />
- * Example:<br />
+ * <BR>
+ * Example:<BR>
* <code>
- * Scilab sci = new Scilab("/path/to/Scilab/data/dir/");<br />
- * <br />
+ * Scilab sci = new Scilab("/path/to/Scilab/data/dir/");<BR>
+ * <BR>
* </code>
* @param SCI provide the path to Scilab data
*/
}
/**
- * Creator of the Scilab Javasci object in advanced mode<br />
+ * Creator of the Scilab Javasci object in advanced mode<BR>
* Scilab data path is autodetected
- * <br />
- * Example:<br />
+ * <BR>
+ * Example:<BR>
* <code>
- * Scilab sci = new Scilab(true); // Starts in advanced mode<br />
- * <br />
+ * Scilab sci = new Scilab(true); // Starts in advanced mode<BR>
+ * <BR>
* </code>
* @param advancedMode true enables the advanced mode (GUI, graphics, Tcl/Tk, sciNotes...). Smaller.
*/
}
/**
- * Creator of the Scilab Javasci object. <br />
- * Under GNU/Linux / Mac OS X, try to detect Scilab base path<br />
- * if the property SCI is set, use it<br />
- * if not, try with the global variable SCI<br />
- * if not, throws a new exception<br />
- * Under Windows, use also the registery<br />
- * <br />
- * Example:<br />
+ * Creator of the Scilab Javasci object. <BR>
+ * Under GNU/Linux / Mac OS X, try to detect Scilab base path<BR>
+ * if the property SCI is set, use it<BR>
+ * if not, try with the global variable SCI<BR>
+ * if not, throws a new exception<BR>
+ * Under Windows, use also the registery<BR>
+ * <BR>
+ * Example:<BR>
* <code>
- * Scilab sci = new Scilab("/path/to/Scilab/data/dir/",true); // Starts in advanced mode<br />
- * <br />
+ * Scilab sci = new Scilab("/path/to/Scilab/data/dir/",true); // Starts in advanced mode<BR>
+ * <BR>
* </code>
* @param SCIPath the path to Scilab data
* @param advancedMode true enables the advanced mode (GUI, graphics, Tcl/Tk, sciNotes...). Smaller.
}
/**
- * Open a connection to the Scilab engine<br />
- * This function is based on Call_ScilabOpen from call_scilab<br />
- * Note: For now, only one instance of Scilab can be launched<br />
- * A second launch will return FALSE<br />
- * <br />
- * Example:<br />
+ * Open a connection to the Scilab engine<BR>
+ * This function is based on Call_ScilabOpen from call_scilab<BR>
+ * Note: For now, only one instance of Scilab can be launched<BR>
+ * A second launch will return FALSE<BR>
+ * <BR>
+ * Example:<BR>
* <code>
- * Scilab sci = new Scilab();<br />
- * sci.open();<br />
- * <br />
+ * Scilab sci = new Scilab();<BR>
+ * sci.open();<BR>
+ * <BR>
* </code>
* @return if the operation is successful
* @throws AlreadyRunningException Scilab is already running
}
/**
- * Open a connection to the Scilab engine and run the command job<br />
- * This function is based on Call_ScilabOpen from call_scilab<br />
- * Note: For now, only one instance of Scilab can be launched<br />
- * A second launch will return FALSE<br />
- * <br />
- * Example:<br />
+ * Open a connection to the Scilab engine and run the command job<BR>
+ * This function is based on Call_ScilabOpen from call_scilab<BR>
+ * Note: For now, only one instance of Scilab can be launched<BR>
+ * A second launch will return FALSE<BR>
+ * <BR>
+ * Example:<BR>
* <code>
- * Scilab sci = new Scilab();<br />
- * sci.open("a=%pi;");<br />
- * <br />
+ * Scilab sci = new Scilab();<BR>
+ * sci.open("a=%pi;");<BR>
+ * <BR>
* </code>
* @param job The job to run on startup
* @return if the operation is successful
}
/**
- * Open a connection to the Scilab engine and run commands job<br />
- * This function is based on Call_ScilabOpen from call_scilab<br />
- * Note: For now, only one instance of Scilab can be launched<br />
- * A second launch will return FALSE<br />
- * <br />
- * Example:<br />
+ * Open a connection to the Scilab engine and run commands job<BR>
+ * This function is based on Call_ScilabOpen from call_scilab<BR>
+ * Note: For now, only one instance of Scilab can be launched<BR>
+ * A second launch will return FALSE<BR>
+ * <BR>
+ * Example:<BR>
* <code>
- * Scilab sci = new Scilab();<br />
- * sci.open(new String[]{"a=42*2;","b=44*2", "c=(a==b)"});<br />
- * <br />
+ * Scilab sci = new Scilab();<BR>
+ * sci.open(new String[]{"a=42*2;","b=44*2", "c=(a==b)"});<BR>
+ * <BR>
* </code>
* @param jobs The serie of jobs to run on startup
* @return if the operation is successful
/**
- * Open a connection to the Scilab engine and run thefile scriptFilename<br />
- * This function is based on Call_ScilabOpen from call_scilab<br />
- * Note: For now, only one instance of Scilab can be launched<br />
- * A second launch will return FALSE<br />
- * <br />
- * Example:<br />
+ * Open a connection to the Scilab engine and run thefile scriptFilename<BR>
+ * This function is based on Call_ScilabOpen from call_scilab<BR>
+ * Note: For now, only one instance of Scilab can be launched<BR>
+ * A second launch will return FALSE<BR>
+ * <BR>
+ * Example:<BR>
* <code>
- * Scilab sci = new Scilab();<br />
- * sci.open(new File("/tmp/myscript.sce"));<br />
- * <br />
+ * Scilab sci = new Scilab();<BR>
+ * sci.open(new File("/tmp/myscript.sce"));<BR>
+ * <BR>
* </code>
* @param scriptFilename The script to execute on startup
* @return if the operation is successful
/**
- * Execute a single command in Scilab<br />
+ * Execute a single command in Scilab<BR>
* This function is based on SendScilabJob from call_scilab
- * <br />
- * Example:<br />
+ * <BR>
+ * Example:<BR>
* <code>
- * sci.exec("a=2*%pi");<br />
- * <br />
+ * sci.exec("a=2*%pi");<BR>
+ * <BR>
* </code>
* @param job the job to execute
* @return if the operation is successful
/**
- * Execute a single command in Scilab<br />
- * Returns a ScilabErrorException in case of Scilab problem<br />
+ * Execute a single command in Scilab<BR>
+ * Returns a ScilabErrorException in case of Scilab problem<BR>
* This function is based on SendScilabJob from call_scilab
- * <br />
- * Example:<br />
+ * <BR>
+ * Example:<BR>
* <code>
- * sci.exec("a=2*%pi");<br />
- * <br />
+ * sci.exec("a=2*%pi");<BR>
+ * <BR>
* </code>
* @param job the job to execute
* @since 5.4.0
/**
- * Execute several commands in Scilab<br />
+ * Execute several commands in Scilab<BR>
* This function is based on SendScilabJob from call_scilab
- * <br />
- * Example:<br />
+ * <BR>
+ * Example:<BR>
* <code>
- * sci.exec(new String[]{"a=42*2;","b=44*2", "c=(a==b)"});<br />
- * <br />
+ * sci.exec(new String[]{"a=42*2;","b=44*2", "c=(a==b)"});<BR>
+ * <BR>
* </code>
* @param jobs the serie of job to execute
* @return if the operation is successful
}
/**
- * Execute several commands in Scilab<br />
- * Returns a ScilabErrorException in case of Scilab problem<br />
+ * Execute several commands in Scilab<BR>
+ * Returns a ScilabErrorException in case of Scilab problem<BR>
* This function is based on SendScilabJob from call_scilab
- * <br />
- * Example:<br />
+ * <BR>
+ * Example:<BR>
* <code>
- * sci.exec(new String[]{"a=42*2;","b=44*2", "c=(a==b)"});<br />
- * <br />
+ * sci.exec(new String[]{"a=42*2;","b=44*2", "c=(a==b)"});<BR>
+ * <BR>
* </code>
* @param jobs the serie of job to execute
* @since 5.4.0
}
/**
- * Execute a Scilab script .sce/.sci and throws an exception in case<br />
- * of a Scilab error<br />
- * Returns a ScilabErrorException in case of Scilab problem<br />
- * This function is based on SendScilabJob from call_scilab<br />
+ * Execute a Scilab script .sce/.sci and throws an exception in case<BR>
+ * of a Scilab error<BR>
+ * Returns a ScilabErrorException in case of Scilab problem<BR>
+ * This function is based on SendScilabJob from call_scilab<BR>
* Note that this function is a direct call on the Scilab function exec:
* <code> this.exec("exec('" + scriptFilename + "');");</code>
- * <br />
- * Example:<br />
+ * <BR>
+ * Example:<BR>
* <code>
- * sci.exec(new File("/tmp/myscript.sci"));<br />
- * <br />
+ * sci.exec(new File("/tmp/myscript.sci"));<BR>
+ * <BR>
* </code>
* @param scriptFilename the script to execute
* @since 5.4.0
}
/**
- * Execute a Scilab script .sce/.sci and throws an exception in case<br />
- * the file is not found<br />
- * This function is based on SendScilabJob from call_scilab<br />
+ * Execute a Scilab script .sce/.sci and throws an exception in case<BR>
+ * the file is not found<BR>
+ * This function is based on SendScilabJob from call_scilab<BR>
* Note that this function is a direct call on the Scilab function exec:
* <code> this.exec("exec('" + scriptFilename + "');");</code>
- * <br />
- * Example:<br />
+ * <BR>
+ * Example:<BR>
* <code>
- * sci.exec(new File("/tmp/myscript.sci"));<br />
- * <br />
+ * sci.exec(new File("/tmp/myscript.sci"));<BR>
+ * <BR>
* </code>
* @param scriptFilename the script to execute
* @return if the operation is successful
/**
* Detect if a variable (varname) exists in Scilab
- * <br />
- * Example:<br />
+ * <BR>
+ * Example:<BR>
* <code>
- * double [][]a={{21.2, 22.0, 42.0, 39.0},{23.2, 24.0, 44.0, 40.0}};<br />
- * ScilabDouble aOriginal = new ScilabDouble(a);<br />
- * sci.put("a",aOriginal);<br />
- * assert sci.isExistingVariable("a") == true;<br />
- * <br />
+ * double [][]a={{21.2, 22.0, 42.0, 39.0},{23.2, 24.0, 44.0, 40.0}};<BR>
+ * ScilabDouble aOriginal = new ScilabDouble(a);<BR>
+ * sci.put("a",aOriginal);<BR>
+ * assert sci.isExistingVariable("a") == true;<BR>
+ * <BR>
* </code>
* @param varname the variable to check
* @return if the variable exists or not
/**
- * Shutdown Scilab<br />
+ * Shutdown Scilab<BR>
* This function is based on TerminateScilab from call_scilab
- * <br />
- * Example:<br />
+ * <BR>
+ * Example:<BR>
* <code>
- * sci.close();<br />
- * <br />
+ * sci.close();<BR>
+ * <BR>
* </code>
* @return if the operation is successful
*/
/**
* Return the last error code
- * <br />
- * Example:<br />
+ * <BR>
+ * Example:<BR>
* <code>
- * sci.open("a=1+"); // Wrong operation<br />
- * sci.getLastErrorCode() // Returns 2<br />
- * <br />
+ * sci.open("a=1+"); // Wrong operation<BR>
+ * sci.getLastErrorCode() // Returns 2<BR>
+ * <BR>
* </code>
* @return the error code
*/
/**
* Return the last error message
- * <br />
- * Example:<br />
+ * <BR>
+ * Example:<BR>
* <code>
- * sci.open("a=1+");<br />
- * System.err.println(sci.getLastErrorMessage());<br />
- * <br />
+ * sci.open("a=1+");<BR>
+ * System.err.println(sci.getLastErrorMessage());<BR>
+ * <BR>
* </code>
* @return the error message itself
*/
/**
- * Detect if a Scilab graphic window is still opened<br />
+ * Detect if a Scilab graphic window is still opened<BR>
* This function is based on ScilabHaveAGraph from call_scilab
- * <br />
- * Example:<br />
+ * <BR>
+ * Example:<BR>
* <code>
- * sci.exec("plot3d();");<br />
- * sci.isGraphicOpened();<br />
- * <br />
+ * sci.exec("plot3d();");<BR>
+ * sci.isGraphicOpened();<BR>
+ * <BR>
* </code>
* @return if the graphic is open or not
*/
/**
* Return the code type of a variable varname
- * <br />
- * Example:<br />
+ * <BR>
+ * Example:<BR>
* <code>
- * sci.exec("a = 2*%pi");<br />
- * if (sci.getVariableType("a") == ScilabTypeEnum.sci_matrix) {<br />
- * System.out.println("a is a double matrix");<br />
- * }<br />
- * <br />
+ * sci.exec("a = 2*%pi");<BR>
+ * if (sci.getVariableType("a") == ScilabTypeEnum.sci_matrix) {<BR>
+ * System.out.println("a is a double matrix");<BR>
+ * }<BR>
+ * <BR>
* </code>
* @param varName the name of the variable
* @return the type of the variable
/**
* Return the code type of a variable varname in the current Scilab session
- * <br />
- * Example:<br />
+ * <BR>
+ * Example:<BR>
* <code>
- * sci.exec("a = 2*%pi");<br />
- * if (sci.getVariableType("a") == ScilabTypeEnum.sci_matrix) {<br />
- * System.out.println("a is a double matrix");<br />
- * }<br />
- * <br />
+ * sci.exec("a = 2*%pi");<BR>
+ * if (sci.getVariableType("a") == ScilabTypeEnum.sci_matrix) {<BR>
+ * System.out.println("a is a double matrix");<BR>
+ * }<BR>
+ * <BR>
* </code>
* @param varName the name of the variable
* @return the type of the variable
}
/**
- * Returns a variable named varname<br />
+ * Returns a variable named varname<BR>
* Throws an exception if the datatype is not managed or if the variable is not available
- * <br />
- * Example:<br />
+ * <BR>
+ * Example:<BR>
* <code>
- * double [][]a={{21.2, 22.0, 42.0, 39.0},{23.2, 24.0, 44.0, 40.0}};<br />
- * double [][]aImg={{212.2, 221.0, 423.0, 393.0},{234.2, 244.0, 441.0, 407.0}};<br />
- * ScilabDouble aOriginal = new ScilabDouble(a, aImg);<br />
- * sci.put("a",aOriginal);<br />
- * ScilabDouble aFromScilab = (ScilabDouble)sci.get("a");<br />
- * <br />
+ * double [][]a={{21.2, 22.0, 42.0, 39.0},{23.2, 24.0, 44.0, 40.0}};<BR>
+ * double [][]aImg={{212.2, 221.0, 423.0, 393.0},{234.2, 244.0, 441.0, 407.0}};<BR>
+ * ScilabDouble aOriginal = new ScilabDouble(a, aImg);<BR>
+ * sci.put("a",aOriginal);<BR>
+ * ScilabDouble aFromScilab = (ScilabDouble)sci.get("a");<BR>
+ * <BR>
* </code>
* @param varname the name of the variable
* @return return the variable
}
/**
- * Returns a reference variable named varname<br />
+ * Returns a reference variable named varname<BR>
* Throws an exception if the datatype is not managed or if the variable is not available
- * <br />
- * Example:<br />
+ * <BR>
+ * Example:<BR>
* <code>
- * double [][]a={{21.2, 22.0, 42.0, 39.0},{23.2, 24.0, 44.0, 40.0}};<br />
- * double [][]aImg={{212.2, 221.0, 423.0, 393.0},{234.2, 244.0, 441.0, 407.0}};<br />
- * ScilabDouble aOriginal = new ScilabDouble(a, aImg);<br />
- * sci.put("a",aOriginal);<br />
- * ScilabDouble aFromScilab = (ScilabDouble)sci.get("a");<br />
- * <br />
+ * double [][]a={{21.2, 22.0, 42.0, 39.0},{23.2, 24.0, 44.0, 40.0}};<BR>
+ * double [][]aImg={{212.2, 221.0, 423.0, 393.0},{234.2, 244.0, 441.0, 407.0}};<BR>
+ * ScilabDouble aOriginal = new ScilabDouble(a, aImg);<BR>
+ * sci.put("a",aOriginal);<BR>
+ * ScilabDouble aFromScilab = (ScilabDouble)sci.get("a");<BR>
+ * <BR>
* </code>
* @param varname the name of the variable
* @return return the variable
}
/**
- * Returns a variable named varname in the current Scilab session<br />
+ * Returns a variable named varname in the current Scilab session<BR>
* Throws an exception if the datatype is not managed or if the variable is not available
- * <br />
- * Example:<br />
+ * <BR>
+ * Example:<BR>
* <code>
- * double [][]a={{21.2, 22.0, 42.0, 39.0},{23.2, 24.0, 44.0, 40.0}};<br />
- * double [][]aImg={{212.2, 221.0, 423.0, 393.0},{234.2, 244.0, 441.0, 407.0}};<br />
- * ScilabDouble aOriginal = new ScilabDouble(a, aImg);<br />
- * sci.put("a",aOriginal);<br />
- * ScilabDouble aFromScilab = (ScilabDouble)sci.get("a");<br />
- * <br />
+ * double [][]a={{21.2, 22.0, 42.0, 39.0},{23.2, 24.0, 44.0, 40.0}};<BR>
+ * double [][]aImg={{212.2, 221.0, 423.0, 393.0},{234.2, 244.0, 441.0, 407.0}};<BR>
+ * ScilabDouble aOriginal = new ScilabDouble(a, aImg);<BR>
+ * sci.put("a",aOriginal);<BR>
+ * ScilabDouble aFromScilab = (ScilabDouble)sci.get("a");<BR>
+ * <BR>
* </code>
* @param varname the name of the variable
* @return return the variable
}
/**
- * Returns a variable named varname in the current Scilab session<br />
+ * Returns a variable named varname in the current Scilab session<BR>
* Throws an exception if the datatype is not managed or if the variable is not available
- * <br />
- * Example:<br />
+ * <BR>
+ * Example:<BR>
* <code>
- * double [][]a={{21.2, 22.0, 42.0, 39.0},{23.2, 24.0, 44.0, 40.0}};<br />
- * double [][]aImg={{212.2, 221.0, 423.0, 393.0},{234.2, 244.0, 441.0, 407.0}};<br />
- * ScilabDouble aOriginal = new ScilabDouble(a, aImg);<br />
- * sci.put("a",aOriginal);<br />
- * ScilabDouble aFromScilab = (ScilabDouble)sci.get("a");<br />
- * <br />
+ * double [][]a={{21.2, 22.0, 42.0, 39.0},{23.2, 24.0, 44.0, 40.0}};<BR>
+ * double [][]aImg={{212.2, 221.0, 423.0, 393.0},{234.2, 244.0, 441.0, 407.0}};<BR>
+ * ScilabDouble aOriginal = new ScilabDouble(a, aImg);<BR>
+ * sci.put("a",aOriginal);<BR>
+ * ScilabDouble aFromScilab = (ScilabDouble)sci.get("a");<BR>
+ * <BR>
* </code>
* @param varname the name of the variable
* @return return the variable
}
/**
- * Send to Scilab a variable theVariable named varname<br />
+ * Send to Scilab a variable theVariable named varname<BR>
* Throws an exception if the datatype is not managed or if the variable is not available
- * <br />
- * Example:<br />
+ * <BR>
+ * Example:<BR>
* <code>
- * boolean [][]a={{true, true, false, false},{true, false, true, false}};<br />
- * ScilabBoolean aOriginal = new ScilabBoolean(a);<br />
- * sci.put("a",aOriginal);<br />
- * ScilabBoolean aFromScilab = (ScilabBoolean)sci.get("a");<br />
- * <br />
+ * boolean [][]a={{true, true, false, false},{true, false, true, false}};<BR>
+ * ScilabBoolean aOriginal = new ScilabBoolean(a);<BR>
+ * sci.put("a",aOriginal);<BR>
+ * ScilabBoolean aFromScilab = (ScilabBoolean)sci.get("a");<BR>
+ * <BR>
* </code>
* @param varname the name of the variable
* @param theVariable the variable itself
}
/**
- * Send to the current Scilab session a variable theVariable named varname<br />
+ * Send to the current Scilab session a variable theVariable named varname<BR>
* Throws an exception if the datatype is not managed or if the variable is not available
- * <br />
- * Example:<br />
+ * <BR>
+ * Example:<BR>
* <code>
- * boolean [][]a={{true, true, false, false},{true, false, true, false}};<br />
- * ScilabBoolean aOriginal = new ScilabBoolean(a);<br />
- * sci.put("a",aOriginal);<br />
- * ScilabBoolean aFromScilab = (ScilabBoolean)sci.get("a");<br />
- * <br />
+ * boolean [][]a={{true, true, false, false},{true, false, true, false}};<BR>
+ * ScilabBoolean aOriginal = new ScilabBoolean(a);<BR>
+ * sci.put("a",aOriginal);<BR>
+ * ScilabBoolean aFromScilab = (ScilabBoolean)sci.get("a");<BR>
+ * <BR>
* </code>
* @param varname the name of the variable
* @param theVariable the variable itself
err = Call_Scilab.putInt(varname, sciInteger.getDataAsInt());
break;
case sci_uint64:
- // err = Call_Scilab.putUnsignedLong(varname, sciInteger.getData_());
+ // err = Call_Scilab.putUnsignedLong(varname, sciInteger.getData_());
case sci_int64:
// err = Call_Scilab.putLong(varname, sciInteger.getData_());
break;
-I$(top_srcdir)/libs/MALLOC/includes/ \
-I$(top_srcdir)/modules/output_stream/includes \
-I$(top_srcdir)/modules/localization/includes \
- -I$(top_srcdir)/modules/api_scilab/includes \
- -DDEBUG
+ -I$(top_srcdir)/modules/api_scilab/includes
# libscimpi_la_LDFLAGS = $(LAMPI_LDFLAGS)
libscimpi_la_LIBADD = $(OPENMPI_LIBS)
-I$(top_srcdir)/libs/MALLOC/includes/ \
-I$(top_srcdir)/modules/output_stream/includes \
-I$(top_srcdir)/modules/localization/includes \
- -I$(top_srcdir)/modules/api_scilab/includes \
- -DDEBUG
+ -I$(top_srcdir)/modules/api_scilab/includes
# libscimpi_la_LDFLAGS = $(LAMPI_LDFLAGS)
libscimpi_la_LIBADD = $(OPENMPI_LIBS)
Maximum Area =0.667053 (expected = 0.677981)
// Now redefine largesmallpolygon() without transposing x0 in neldermead_configure(nm,"-x0",x0');
// and check that we get the same result as before.
+prot = funcprot();
+funcprot(0);
function [A,r,t] = findlargestpolygon (nv)
// Finds the largest smallest polygon with nv vertices
// A : a 1-by-1 matrix of doubles, the area
t = xopt(nv+1:$)
nm = neldermead_destroy(nm)
endfunction
-Warning : redefining function: findlargestpolygon . Use funcprot(0) to avoid this message
-
+funcprot(prot);
nv = 6;
rand("seed" , 0);
[A,r,t] = findlargestpolygon (nv);
// Now redefine largesmallpolygon() without transposing x0 in neldermead_configure(nm,"-x0",x0');
// and check that we get the same result as before.
+prot = funcprot();
+funcprot(0);
function [A,r,t] = findlargestpolygon (nv)
// Finds the largest smallest polygon with nv vertices
// A : a 1-by-1 matrix of doubles, the area
t = xopt(nv+1:$)
nm = neldermead_destroy(nm)
endfunction
-
+funcprot(prot);
nv = 6;
rand("seed" , 0);
// Check second argument : d
select type(d)
case 1
- if size(d,'*') <> 1 then
+ if size(d,"*") <> 1 then
error(msprintf(_("%s: Wrong size for input argument #%d: A scalar expected.\n"),"sum", 2))
end
if int(d) <> d | d < 0 then
error(msprintf(_("%s: Wrong value for input argument #%d: Integer >= %d expected.\n"),"sum", 2, 1))
end
- case 10
- if size(d,'*') <> 1 then
+ case 10
+ if size(d,"*") <> 1 then
error(msprintf(_("%s: Wrong size for input argument #%d: A string expected.\n"),"sum",2))
end
if and(d<>["r","c","*","m"]) then
end
if d == 0 then // '*'
- a=sum(a.entries, "*", typ), dims;
+ a = sum(a.entries, "*", typ), dims;
elseif d > size(dims,"*") then
//requested summation direction exceeds array dims, return the array, converted
//to double if necessary.
if typ == "double" & or(tm == [4 8]) then
- a.entries=double(a.entries),
+ a.entries = double(a.entries),
end
a=a
else
//permute the array dimension to put the selected dimension first
- p=1:size(dims,"*");
- p([1,d])=p([d,1]);
- a=matrix(permute(a,p),dims(d),-1)
- a=sum(a,1,typ);
+ p = 1:size(dims,"*");
+ p([1,d]) = p([d,1]);
+ a = matrix(permute(a,p),dims(d),-1)
+ a = sum(a,1,typ);
//permute back
if d==size(dims, "*") then
- dims=dims(1:$-1)
- p(1) = []
+ dims = dims(1:$-1)
+ p(1) = p($)
+ p($) = []
else
- dims(d)=1
+ dims(d) = 1
end
- a=permute(matrix(a,dims(p)),p)
+ a = permute(matrix(a,dims(p)),p)
end
endfunction
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2015 - Scilab Enterprises - Vincent COUVERT
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- Non-regression test for bug 13829 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=13829
+//
+// <-- Short Description -->
+// mean and sum functions returned wrong results for hypermatrices.
+a = matrix(1:24, 1:4);
+s = sum(a,4);
+ref = matrix([40 44 48 52 56 60], 1:3);
+assert_checkequal(s, ref);
+a = ones(1,2,3,4);
+m = mean(a,4);
+ref = ones(1,2,3,1);
+assert_checkequal(m, ref);
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2015 - Scilab Enterprises - Vincent COUVERT
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- Non-regression test for bug 13829 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=13829
+//
+// <-- Short Description -->
+// mean and sum functions returned wrong results for hypermatrices.
+
+a = matrix(1:24, 1:4);
+s = sum(a,4);
+ref = matrix([40 44 48 52 56 60], 1:3);
+assert_checkequal(s, ref);
+
+a = ones(1,2,3,4);
+m = mean(a,4);
+ref = ones(1,2,3,1);
+assert_checkequal(m, ref);
\ No newline at end of file
opar=sim.opar
ztyp=sim.ztyp
labels=sim.labels
- st=state.x
- dst=state.z
- odst=state.oz
- st0=%state0.x
- dst0=%state0.z
- odst0=%state0.oz
+ x=state.x
+ z=state.z
+ oz=state.oz
+ x0=%state0.x
+ z0=%state0.z
+ oz0=%state0.oz
Impl=%f
- if xptr($)-1 < size(st,"*") then
- std=st($/2+1:$)
- st=st(1:$/2)
- std0=st0($/2+1:$)
- st0=st0(1:$/2)
+ if xptr($)-1 < size(x,"*") then
+ xd=x($/2+1:$)
+ x=x(1:$/2)
+ xd0=x0($/2+1:$)
+ x0=x0(1:$/2)
Impl=%t
end
nek=prod(size(statek))-(xptr(kc+1)-xptr(kc))
sel=xptr(kc+1):xptr($)-1
if nek<>0&sel<>[] then
- st(nek+sel)=st(sel)
- st0(nek+sel)=st0(sel)
+ x(nek+sel)=x(sel)
+ x0(nek+sel)=x0(sel)
if Impl then
- std(nek+sel)=std(sel)
- std0(nek+sel)=std0(sel)
+ xd(nek+sel)=xd(sel)
+ xd0(nek+sel)=xd0(sel)
end
end
if nek<0 then
- st($+nek+1:$)=[],st0($+nek+1:$)=[],
- if Impl then std($+nek+1:$)=[],std0($+nek+1:$)=[],end
+ x($+nek+1:$)=[],x0($+nek+1:$)=[],
+ if Impl then xd($+nek+1:$)=[],xd0($+nek+1:$)=[],end
end
xptr(kc+1:$)=xptr(kc+1:$)+nek
- st(xptr(kc):xptr(kc+1)-1)=statek(:),
- st0(xptr(kc):xptr(kc+1)-1)=statek(:),
+ x(xptr(kc):xptr(kc+1)-1)=statek(:),
+ x0(xptr(kc):xptr(kc+1)-1)=statek(:),
if Impl then
if statekd==[] then statekd=0*statek,end
- std(xptr(kc):xptr(kc+1)-1)=statekd(:),
- std0(xptr(kc):xptr(kc+1)-1)=statekd(:),
+ xd(xptr(kc):xptr(kc+1)-1)=statekd(:),
+ xd0(xptr(kc):xptr(kc+1)-1)=statekd(:),
end
//Change discrete state
nek=prod(size(dstatek))-(zptr(kc+1)-zptr(kc))
sel=zptr(kc+1):zptr($)-1
if nek<>0&sel<>[] then
- dst(nek+sel)=dst(sel)
- dst0(nek+sel)=dst0(sel)
+ z(nek+sel)=z(sel)
+ z0(nek+sel)=z0(sel)
end
if nek<0 then
- dst($+nek+1:$)=[],dst0($+nek+1:$)=[],
+ z($+nek+1:$)=[],z0($+nek+1:$)=[],
end
zptr(kc+1:$)=zptr(kc+1:$)+nek
- dst(zptr(kc):zptr(kc+1)-1)=dstatek(:)
- dst0(zptr(kc):zptr(kc+1)-1)=dstatek(:)
+ z(zptr(kc):zptr(kc+1)-1)=dstatek(:)
+ z0(zptr(kc):zptr(kc+1)-1)=dstatek(:)
//Change objects discrete state
if ((type(odstatek)<>15) | ...
sel=ozptr(kc+1):ozptr($)-1
if nek<>0&sel<>[] then
- while lstsize(odst)<max(nek+sel), odst($+1)=[], end
- while lstsize(odst0)<max(nek+sel), odst0($+1)=[], end
+ while lstsize(oz)<max(nek+sel), oz($+1)=[], end
+ while lstsize(oz0)<max(nek+sel), oz0($+1)=[], end
if nek>0 then sel=gsort(sel), end
for j=sel
- odst(j+nek)=odst(j)
- odst0(j+nek)=odst0(j)
+ oz(j+nek)=oz(j)
+ oz0(j+nek)=oz0(j)
end
end
ozptr(kc+1:$)=ozptr(kc+1:$)+nek;
if ((type(odstatek)==15) & (type(fun)==15)) then
if ((fun(2)==5) | (fun(2)==10005)) then // sciblocks
if lstsize(odstatek)>0 then
- odst(ozptr(kc))=odstatek;
- odst0(ozptr(kc))=odstatek;
+ oz(ozptr(kc))=odstatek;
+ oz0(ozptr(kc))=odstatek;
end
elseif ((fun(2)==4) | (fun(2)==10004) | (fun(2)==2004)) then // C blocks
for j=1:lstsize(odstatek)
- odst(ozptr(kc)+j-1)=odstatek(j);
- odst0(ozptr(kc)+j-1)=odstatek(j);
+ oz(ozptr(kc)+j-1)=odstatek(j);
+ oz0(ozptr(kc)+j-1)=odstatek(j);
end
end
end
- //## rebuild odst list if nek < 0
+ //## rebuild oz list if nek < 0
if nek < 0 then
- n_odst = list(); n_odst0 = list();
+ n_oz = list(); n_oz0 = list();
for j=1:max(ozptr)-1
- n_odst(j)=odst(j);
- n_odst0(j)=odst0(j);
+ n_oz(j)=oz(j);
+ n_oz0(j)=oz0(j);
end
- odst = n_odst; odst0 = n_odst0;
- clear n_odst; clear n_odst0;
+ oz = n_oz; oz0 = n_oz0;
+ clear n_oz; clear n_oz0;
end
//Change real parameters
sim.labels=labels
if Impl then
- state.x=[st;std]
+ state.x=[x;xd]
else
- state.x=st
+ state.x=x
end
- state.z=dst
- state.oz=odst
+ state.z=z
+ state.oz=oz
if Impl then
- %state0.x=[st0;std0]
+ %state0.x=[x0;xd0]
else
- %state0.x=st0
+ %state0.x=x0
end
- %state0.z=dst0
- %state0.oz=odst0
+ %state0.z=z0
+ %state0.oz=oz0
endfunction
/* B=data2sig(A[,step])
*
* Put data in a 'scicos' signal structure.
-* If A is a vector, then it will be understand
+* If A is a vector, then it will be understood
* as a scalar that evolves along time.
-* If A is a matrix, then it will be understand
+* If A is a matrix, then it will be understood
* as a vector that evolves along time.
-* If A is an hypermatrix, then it will be understand
+* If A is an hypermatrix, then it will be understood
* as a matrix that evolves along time.
*
* Usage :
/* 2 : Dimension properties */
Blocks[kf].ztyp = ztyp[kf + 1];
- Blocks[kf].nx = xptr[kf + 2] - xptr[kf + 1]; /* continuuous state dimension*/
+ Blocks[kf].nx = xptr[kf + 2] - xptr[kf + 1]; /* continuous state dimension*/
Blocks[kf].ng = zcptr[kf + 2] - zcptr[kf + 1]; /* number of zero crossing surface*/
Blocks[kf].nz = zptr[kf + 2] - zptr[kf + 1]; /* number of double discrete state*/
Blocks[kf].noz = ozptr[kf + 2] - ozptr[kf + 1]; /* number of other discrete state*/
return;
}
- if (solver != LSodar_Dynamic) /* Call CVDense to specify the CVDENSE dense linear solver */
+ /* Call CVDense to specify the CVDENSE dense linear solver, only for solvers needing CVode's Newton method */
+ if (solver == CVode_BDF_Newton || solver == CVode_Adams_Newton)
{
flag = CVDense(ode_mem, *neq);
}
//sciprint("callf type=%d flag=%d\n",block->type,flagi);
switch (block->type)
{
- /*******************/
- /* function type 0 */
- /*******************/
+ /*******************/
+ /* function type 0 */
+ /*******************/
case 0 :
{
/* This is for compatibility */
// Modify solver + run DDaskr + save results
scs_m.props.tol(6) = 102; // Solver
scicos_simulate(scs_m, Info); // DDaskr
-Warning : redefining function: dst . Use funcprot(0) to avoid this message
-
ddaskrval = res.values; // Results
// Modify solver + run IDA + save results
scs_m.props.tol(6) = 100; // Solver
scicos_simulate(scs_m, Info); // IDA
-Warning : redefining function: dst . Use funcprot(0) to avoid this message
-
idaval = res.values; // Results
// Compare results
compa = abs(ddaskrval-idaval);
// Modify solver + run DDaskr + save results
scs_m.props.tol(6) = 102; // Solver
scicos_simulate(scs_m, Info); // DDaskr
-Warning : redefining function: dst . Use funcprot(0) to avoid this message
-
ddaskrval = res.values; // Results
// Modify solver + run IDA + save results
scs_m.props.tol(6) = 100; // Solver
scicos_simulate(scs_m, Info); // IDA
-Warning : redefining function: dst . Use funcprot(0) to avoid this message
-
idaval = res.values; // Results
// Compare results
compa = abs(ddaskrval-idaval);
// Modify solver + run DDaskr + save results
scs_m.props.tol(6) = 101; // Solver
scicos_simulate(scs_m, Info); // DDaskr
-Warning : redefining function: dst . Use funcprot(0) to avoid this message
-
ddaskrval = res.values; // Results
// Modify solver + run IDA + save results
scs_m.props.tol(6) = 100; // Solver
scicos_simulate(scs_m, Info); // IDA
-Warning : redefining function: dst . Use funcprot(0) to avoid this message
-
idaval = res.values; // Results
// Compare results
compa = abs(ddaskrval-idaval);
// Modify solver + run DDaskr + save results
scs_m.props.tol(6) = 101; // Solver
scicos_simulate(scs_m, Info); // DDaskr
-Warning : redefining function: dst . Use funcprot(0) to avoid this message
-
ddaskrval = res.values; // Results
// Modify solver + run IDA + save results
scs_m.props.tol(6) = 100; // Solver
scicos_simulate(scs_m, Info); // IDA
-Warning : redefining function: dst . Use funcprot(0) to avoid this message
-
idaval = res.values; // Results
// Compare results
compa = abs(ddaskrval-idaval);
* This class is {@link java.io.Serializable} and any modification could impact
* load and store of data (Xcos files, Javasci saved data, etc...).<br>
* <br>
- * Example:<br />
+ * Example:<BR>
* <code>
- * boolean [][]a={{true,false,true}, {true,true,true}};<br />
+ * boolean [][]a={{true,false,true}, {true,true,true}};<BR>
* ScilabBoolean aMatrix = new ScilabBoolean(a);
* </code>
*
}
/**
- * Display the representation in the Scilab language of the type<br />
+ * Display the representation in the Scilab language of the type<BR>
* Note that the representation can be copied/pasted straight into Scilab
*
* @return the pretty print
* This class is {@link java.io.Serializable} and any modification could impact
* load and store of data (Xcos files, Javasci saved data, etc...).<br>
* <br>
- * Example:<br />
+ * Example:<BR>
* <code>
- * boolean [][]a={{true,false,true}, {true,true,true}};<br />
+ * boolean [][]a={{true,false,true}, {true,true,true}};<BR>
* ScilabBoolean aMatrix = new ScilabBoolean(a);
* </code>
*
}
/**
- * Display the representation in the Scilab language of the type<br />
+ * Display the representation in the Scilab language of the type<BR>
* Note that the representation can be copied/pasted straight into Scilab
*
* @return a Scilab-like String representation of the data.
* This class is {@link java.io.Serializable} and any modification could impact
* load and store of data (Xcos files, Javasci saved data, etc...).<br>
* <br>
- * Example (real):<br />
+ * Example (real):<BR>
* <code>
- * double [][]a={{21.2, 22.0, 42.0, 39.0},{23.2, 24.0, 44.0, 40.0}};<br />
- * ScilabDouble aMatrix = new ScilabDouble(a);<br />
+ * double [][]a={{21.2, 22.0, 42.0, 39.0},{23.2, 24.0, 44.0, 40.0}};<BR>
+ * ScilabDouble aMatrix = new ScilabDouble(a);<BR>
* </code> <br>
- * Example (complex):<br />
+ * Example (complex):<BR>
* <code>
- * double [][]a={{21.2, 22.0, 42.0, 39.0},{23.2, 24.0, 44.0, 40.0}};<br />
- * double [][]aImg={{210.2, 220.0, 420.0, 390.0},{230.2, 240.0, 440.0, 400.0}};<br />
+ * double [][]a={{21.2, 22.0, 42.0, 39.0},{23.2, 24.0, 44.0, 40.0}};<BR>
+ * double [][]aImg={{210.2, 220.0, 420.0, 390.0},{230.2, 240.0, 440.0, 400.0}};<BR>
* ScilabDouble aMatrix = new ScilabDouble(a, aImg);
* </code>
*
}
/**
- * Display the representation in the Scilab language of the type<br />
+ * Display the representation in the Scilab language of the type<BR>
* Note that the representation can be copied/pasted straight into Scilab
*
* @return a Scilab-like String representation of the data.
* This class is {@link java.io.Serializable} and any modification could impact
* load and store of data (Xcos files, Javasci saved data, etc...).<br>
* <br>
- * Example (real):<br />
+ * Example (real):<BR>
* <code>
- * double [][]a={{21.2, 22.0, 42.0, 39.0},{23.2, 24.0, 44.0, 40.0}};<br />
- * ScilabDouble aMatrix = new ScilabDouble(a);<br />
+ * double [][]a={{21.2, 22.0, 42.0, 39.0},{23.2, 24.0, 44.0, 40.0}};<BR>
+ * ScilabDouble aMatrix = new ScilabDouble(a);<BR>
* </code> <br>
- * Example (complex):<br />
+ * Example (complex):<BR>
* <code>
- * double [][]a={{21.2, 22.0, 42.0, 39.0},{23.2, 24.0, 44.0, 40.0}};<br />
- * double [][]aImg={{210.2, 220.0, 420.0, 390.0},{230.2, 240.0, 440.0, 400.0}};<br />
+ * double [][]a={{21.2, 22.0, 42.0, 39.0},{23.2, 24.0, 44.0, 40.0}};<BR>
+ * double [][]aImg={{210.2, 220.0, 420.0, 390.0},{230.2, 240.0, 440.0, 400.0}};<BR>
* ScilabDouble aMatrix = new ScilabDouble(a, aImg);
* </code>
*
* This class is {@link java.io.Serializable} and any modification could impact
* load and store of data (Xcos files, Javasci saved data, etc...).<br>
* <br>
- * Example:<br />
+ * Example:<BR>
* <code>
- * byte [][]a={{32,42,41}, {12,13,32}};<br />
+ * byte [][]a={{32,42,41}, {12,13,32}};<BR>
* ScilabInteger aMatrix = new ScilabInteger(a, true); // true = unsigned
* </code>
*
}
/**
- * Display the representation in the Scilab language of the type<br />
+ * Display the representation in the Scilab language of the type<BR>
* Note that the representation can be copied/pasted straight into Scilab
*
* @return the pretty-printed values
* This class is {@link java.io.Serializable} and any modification could impact
* load and store of data (Xcos files, Javasci saved data, etc...).<br>
* <br>
- * Example:<br />
+ * Example:<BR>
* <code>
- * byte [][]a={{32,42,41}, {12,13,32}};<br />
+ * byte [][]a={{32,42,41}, {12,13,32}};<BR>
* ScilabInteger aMatrix = new ScilabInteger(a, true); // true = unsigned
* </code>
*
* This class is {@link java.io.Serializable} and any modification could impact
* load and store of data (Xcos files, Javasci saved data, etc...).<br>
* <br>
- * Example:<br />
+ * Example:<BR>
* <code>
- * ScilabList data = new ScilabList();<br />
- * data.add(new ScilabString("hello"));<br />
- * data.add(new ScilabDouble(2));<br />
+ * ScilabList data = new ScilabList();<BR>
+ * data.add(new ScilabString("hello"));<BR>
+ * data.add(new ScilabDouble(2));<BR>
* </code>
*
* @see org.scilab.modules.javasci.Scilab
}
/**
- * Display the representation in the Scilab language of the type<br />
+ * Display the representation in the Scilab language of the type<BR>
* Note that the representation can be copied/pasted straight into Scilab
*
* @return the pretty-printed data
* This class is {@link java.io.Serializable} and any modification could impact
* load and store of data (Xcos files, Javasci saved data, etc...).<br>
* <br>
- * Example:<br />
+ * Example:<BR>
* <code>
- * ScilabMList data = new ScilabMList();<br />
- * data.add(new ScilabString("hello"));<br />
- * data.add(new ScilabDouble(2));<br />
+ * ScilabMList data = new ScilabMList();<BR>
+ * data.add(new ScilabString("hello"));<BR>
+ * data.add(new ScilabDouble(2));<BR>
* </code>
*
* @see org.scilab.modules.javasci.Scilab
}
/**
- * Display the representation in the Scilab language of the type<br />
+ * Display the representation in the Scilab language of the type<BR>
* Note that the representation can be copied/pasted straight into Scilab
*
* @return the pretty-printed data
}
/**
- * Display the representation in the Scilab language of the type<br />
+ * Display the representation in the Scilab language of the type<BR>
* Note that the representation can be copied/pasted straight into Scilab
*
* @return a Scilab-like String representation of the data.
}
/**
- * Display the representation in the Scilab language of the type<br />
+ * Display the representation in the Scilab language of the type<BR>
* Note that the representation can be copied/pasted straight into Scilab
*
* @return a Scilab-like String representation of the data.
* This class is {@link java.io.Serializable} and any modification could impact
* load and store of data (Xcos files, Javasci saved data, etc...).<br>
* <br>
- * Example:<br />
+ * Example:<BR>
* <code>
- * String [][]a={{"This","is","my","string"},{"and","I want to", "compare"," them"}};<br />
+ * String [][]a={{"This","is","my","string"},{"and","I want to", "compare"," them"}};<BR>
* ScilabString aMatrix = new ScilabString(a);
* </code>
*
}
/**
- * Display the representation in the Scilab language of the type<br />
+ * Display the representation in the Scilab language of the type<BR>
* Note that the representation can be copied/pasted straight into Scilab
*
* @return a Scilab-like String representation of the data.
* This class is {@link java.io.Serializable} and any modification could impact
* load and store of data (Xcos files, Javasci saved data, etc...).<br>
* <br>
- * Example:<br />
+ * Example:<BR>
* <code>
- * ScilabTList data = new ScilabTList();<br />
- * data.add(new ScilabString("hello"));<br />
- * data.add(new ScilabDouble(2));<br />
+ * ScilabTList data = new ScilabTList();<BR>
+ * data.add(new ScilabString("hello"));<BR>
+ * data.add(new ScilabDouble(2));<BR>
* </code>
*
* @see org.scilab.modules.javasci.Scilab
}
/**
- * Display the representation in the Scilab language of the type<br />
+ * Display the representation in the Scilab language of the type<BR>
* Note that the representation can be copied/pasted straight into Scilab
*
* @return the pretty-printed data
public Object getSerializedObject();
/**
- * Display the representation in the Scilab language of the type<br />
+ * Display the representation in the Scilab language of the type<BR>
* Note that the representation can be copied/pasted straight into Scilab
*
* @return the pretty print
<?xml version="1.0" encoding="UTF-8"?>
<!--
* Scicos
- *
+ *
* Copyright (C) INRIA - METALAU Project <scicos@inria.fr> (HTML version)
* Copyright (C) DIGITEO - Scilab Consortium (XML Docbook version)
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
+ *
* See the file ./license.txt
-->
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="C_struct">
That structure of type <literal>scicos_block</literal> is defined in the file <literal>scicos_block4.h</literal> included into the standard Scilab distribution, and users must include that header in each computational functions.
</para>
<para>
- This access is a direct approach and most of users should prefer the <link linkend="C_macros">C macros</link> approach for facilities purpose.
+ This access is a direct approach and most of users should prefer the <link linkend="C_macros">C macros</link> approach for facilities purpose.
</para>
</refsection>
<refsection id="Inputsoutputs_C_struct">
</para>
<para>
One can't override the index <literal>(3*block->nin)-1</literal> when reading sizes of input ports in the array <literal>insz</literal> and the index <literal>block->nin-1</literal> when reading data in the array <literal>inptr</literal> with a C computational function.
- The number of regular input ports can also be got by the use of the C macros <literal>GetNin(block)</literal>.
+ The number of regular input ports can also be got by the use of the C macros <literal>GetNin(block)</literal>.
</para>
</listitem>
<listitem>
</textobject>
</mediaobject>
<para>
- For i.e., to directly access to the data, the user can use theses instructions :
+ For i.e., to directly access to the data, the user can use theses instructions :
</para>
<programlisting role="c"><![CDATA[
#include "scicos_block4.h"
void mycomputfunc(scicos_block *block,int flag)
{
...
-
+
/*get the ptrs of the first int32 regular input port*/
ptr_i = (SCSINT32_COP *) block->inptr[0];
/*get the ptrs of the second complex regular input port*/
ptr_dc = (SCSCOMPLEX_COP *) block->inptr[1];
/*get the ptrs of the third real regular input port*/
ptr_d = (SCSREAL_COP *) block->inptr[2];
-
+
...
-
+
/*get the dimension of the first int32 regular input port*/
n1=block->insz[0];
m1=block->insz[3];
-
+
/*compute the cumsum of the input int32 matrix*/
for(i=0;i<n1*m1;i++) {
cumsum_i += ptr_i[i];
One can also use the set of C macros : <literal>GetInPortPtrs(blk,x)</literal>, <literal>GetRealInPortPtrs(block,x)</literal>, <literal>GetImagInPortPtrs(block,x)</literal>, <literal>Getint8InPortPtrs(block,x)</literal>, <literal>Getint16InPortPtrs(block,x)</literal>, <literal>Getint32InPortPtrs(block,x)</literal>, <literal>Getuint8InPortPtrs(block,x)</literal>, <literal>Getuint16InPortPtrs(block,x)</literal>, <literal>Getuint32InPortPtrs(block,x)</literal> to have the appropriate pointer of the data to handle and <literal>GetNin(block)</literal>, <literal>GetInPortRows(block,x)</literal>, <literal>GetInPortCols(block,x)</literal>, <literal>GetInPortSize(block,x,y)</literal>, <literal>GetInType(block,x)</literal>, <literal>GetSizeOfIn(block,x)</literal> to handle number, dimensions and type of regular input ports.
(<emphasis role="bold">x is numbered from 1 to nin and y numbered from 1 to 2</emphasis>).
</para>
- <para>
+ <para>
For the previous example that gives :
</para>
<programlisting role="c"><![CDATA[
void mycomputfunc(scicos_block *block,int flag)
{
...
-
+
/*get the ptrs of the first int32 regular input port*/
ptr_i = Getint32InPortPtrs(block,1);
/*get the ptrs of the second complex regular input port*/
ptr_dc = GetRealInPortPtrs(block,2);
/*get the ptrs of the third real regular input port*/
ptr_d = GetRealInPortPtrs(block,3);
-
+
...
-
+
/*get the dimension of the first int32 regular input port*/
n1=GetInPortRows(block,1);
m1=GetInPortCols(block,1);
-
+
...
}]]></programlisting>
<para>
One can't override the index <literal>(3*block->nout)-1</literal> when reading sizes of output ports in the array <literal>outsz</literal> and the index <literal>block->nout-1</literal> when reading data in the array <literal>outptr</literal>with a C computational function.
</para>
<para>
- The number of regular output ports can also be got by the use of the C macros <literal>GetNout(block)</literal> .
+ The number of regular output ports can also be got by the use of the C macros <literal>GetNout(block)</literal> .
</para>
</listitem>
<listitem>
<programlisting role="code"><![CDATA[
model = scicos_model();
model.out = [3;1;4];
-model.out2 = [2;1;1];
+model.out2 = [2;1;1];
model.outtyp = [2;1;3];
]]></programlisting>
<para>
}
}
]]></programlisting>
- <para>One can also use the set of C macros :
+ <para>One can also use the set of C macros :
<literal>GetOutPortPtrs(block,x)</literal>, <literal>GetRealOutPortPtrs(block,x)</literal>, <literal>GetImagOutPortPtrs(block,x)</literal>, <literal>Getint8OutPortPtrs(block,x)</literal>, <literal>Getint16OutPortPtrs(block,x)</literal>, <literal>Getint32OutPortPtrs(block,x)</literal>, <literal>Getuint8OutPortPtrs(block,x)</literal>, <literal>Getuint16OutPortPtrs(block,x)</literal>, <literal>Getuint32OutPortPtrs(block,x)</literal> to have the appropriate pointer of the data to handle and <literal>GetNout(block)</literal>, <literal>GetOutPortRows(block,x)</literal>, <literal>GetOutPortCols(block,x)</literal>, <literal>GetOutPortSize(block,x,y)</literal>, <literal>GetOutType(block,x)</literal>, <literal>GetSizeOfOut(block,x)</literal>to handle number, dimensions and type of regular output ports. (<emphasis role="bold">x is numbered from 1 to nout and y is numbered from 1 to 2</emphasis>).
</para>
<para>
void mycomputfunc(scicos_block *block,int flag)
{
...
-
+
/*get the ptrs of the first int32 regular output port*/
ptr_i = GetOutPortPtrs(block,1);
/*get the ptrs of the second complex regular output port*/
/*get the ptrs of the third real regular output port*/
ptr_d = GetRealOutPortPtrs(block,3);
...
-
+
/*get the dimension of the first int32 regular output port*/
n1=GetOutPortRows(block,1);
m1=GetOutPortCols(block,1);
...
-
+
}
]]></programlisting>
<para>
One can't override the index <literal>block->nevout-1</literal> when setting value of events in the output event register <literal>evout</literal>.
</para>
<para>
- The number of event output ports can also be got by the use of the C macro <literal>GetNevOut(block)</literal>.
+ The number of event output ports can also be got by the use of the C macro <literal>GetNevOut(block)</literal>.
</para>
</listitem>
<listitem>
}
]]></programlisting>
- <para>
- Note that every events generated from output event register will be asynchronous with event coming from event input port (even if you set
- <literal>block->evout[x]=0</literal>).
+ <para>
+ Note that every events generated from output event register will be asynchronous with event coming from event input port (even if you set
+ <literal>block->evout[x]=0</literal>).
</para>
<para>
- The event output register must be only written for
+ The event output register must be only written for
<literal>flag=3</literal>.
</para>
</listitem>
One can't override the index <literal>(block->nrpar)-1</literal> when reading value of real parameters in the register <literal>rpar</literal>.
</para>
<para>
- The total number of real parameters can also be got by the use of the C macro <literal>rpar</literal>.
+ The total number of real parameters can also be got by the use of the C macro <literal>rpar</literal>.
</para>
</listitem>
<listitem>
/*get the third value of the real param register*/
PI_4 = block->rpar[2];
...
-}
+}
]]></programlisting>
<para>
B = [0.1 ; 0.98];
model = scicos_model();
-model.rpar = [A;B]
+model.rpar = [A;B]
]]></programlisting>
<para>
in the corresponding C computational function of that block, we'll use :
One can't override the index <literal>(block->nipar)-1</literal> when reading value of integer parameters in the register <literal>ipar</literal>.
</para>
<para>
- The total number of integer parameters can also be got by the use of the C macro <literal>GetNipar(block)</literal>.
+ The total number of integer parameters can also be got by the use of the C macro <literal>GetNipar(block)</literal>.
</para>
</listitem>
<listitem>
</para>
<programlisting role="scilab"><![CDATA[
model = scicos_model();
-model.ipar = [(1:3)';5]
+model.ipar = [(1:3)';5]
]]></programlisting>
<para>
you can retrieve the previous data in the C computational function with :
double *A;
double *B;
double cumsum;
-int i;
+int i;
...
void mycomputfunc(scicos_block *block,int flag)
...
/*get the number of object parameter*/
nopar=block>nopar;
-
+
...
-
+
/*get number of row of the last object parameter*/
n=block>oparsz[nopar-1];
/*get number of column of the last object parameter*/
m=block>oparsz[2*nopar-1];
...
-}
+}
]]></programlisting>
<para>
The dimensions of object parameters can be get with the following C macros <literal>GetOparSize(block,x,1)</literal> to get the first dimension of <literal>opar</literal> and <literal>GetOparSize(block,x,2)</literal>to get the second dimension with <literal>x</literal> an integer that gives the index of the object parameter, <emphasis role="bold">numbered from 1 to nopar</emphasis>.
int8([ascii("me") 0]) ..
);]]></programlisting>
<para>
- Then we have three object parameters, one is an 32-bit integer matrix with two rows and two columns, the second is a vector of complex numbers that can be understand as a matrix of size [1,3] and the third is a string encoded as a standard C one (ASCII ended with a '\0').
+ Then we have three object parameters, one is an 32-bit integer matrix with two rows and two columns, the second is a vector of complex numbers that can be understood as a matrix of size [1,3] and the third is a string encoded as a standard C one (ASCII ended with a '\0').
</para>
<para>
At the C computational function level, the instructions <literal>block->oparsz[0]</literal>, <literal>block->oparsz[1]</literal>, <literal>block->oparsz[2]</literal>, <literal>block->oparsz[3]</literal>, <literal>block->oparsz[4]</literal>, <literal>block->oparsz[5]</literal> will respectively return the values <literal>2, 1, 1, 2, 3, 3</literal> and the instructions <literal>block->opartyp[0]</literal>, <literal>block->opartyp[1]</literal>, <literal>block->opartyp[2]</literal> the values <literal>11, 84, 81</literal>.
cumsum_d = ptr_d[0]+ptr_d[1]+ptr_d[2];
fprintf(stderr, str);
...
-}
+}
]]></programlisting>
<para>
One can also use the set of C macros : <literal>GetRealOparPtrs(block,x)</literal>, <literal>GetImagOparPtrs(block,x)</literal>, <literal>Getint8OparPtrs(block,x)</literal>, <literal>Getint16OparPtrs(block,x)</literal>, <literal>Getint32OparPtrs(block,x)</literal>, <literal>Getuint8OparPtrs(block,x)</literal>, <literal>Getuint16OparPtrs(block,x)</literal>, <literal>Getuint32OparPtrs(block,x)</literal> to have the appropriate pointer of the data to handle (<emphasis role="bold">x is numbered from 1 to nopar</emphasis>).
/*get the string*/
str = Getint8OparPtrs(block,3);
...
-}
+}
]]></programlisting>
<para>
- Note that object parameters register is only accessible for reading.
+ Note that object parameters register is only accessible for reading.
</para>
</listitem>
</itemizedlist>
<emphasis role="bold">block->nx :</emphasis> Integer that gives the length of the continus state register.
</para>
<para>
- One can't override the index <literal>block->nx-1</literal> when reading or writing data in the array , or with a C computational function.
+ One can't override the index <literal>block->nx-1</literal> when reading or writing data in the array , or with a C computational function.
</para>
</listitem>
<listitem>
...
x_1=block->x[0];
...
-}
+}
]]></programlisting>
<para>
Note that on <literal>flag=4</literal>, user can write some initial conditions in that register.
xd[2] = x[0]*x[1]-c*x[2];
}
...
-}
+}
]]></programlisting>
</listitem>
<listitem>
</latex>
<para> For i.e the Lorenz attractor written as a DAE system with three state variables, will be defined :
</para>
- <programlisting role="c"><![CDATA[
+ <programlisting role="c"><![CDATA[
#include "scicos_block4.h"
...
double *x = block->x;
double *xd = block->xd;
double *res = block->res;
-
+
if (flag == 0) {
res[0] = - xd[0] + (a*(x[1]-x[0]));
res[1] = - xd[1] + (x[0]*(b-x[2])-x[1]);
One can't override the index <literal>block->nz-1</literal> when reading data in the array <literal>z</literal> with a C computational function.
</para>
<para>
- This value is also accessible via the C macros <literal>GetNdstate(block)</literal>.
+ This value is also accessible via the C macros <literal>GetNdstate(block)</literal>.
</para>
</listitem>
<listitem>
One can't override the index <literal>block->noz-1</literal> when accessing data in the arrays <literal>ozsz</literal>, <literal>oztyp</literal> and <literal>ozptr</literal> in a C computational function.
</para>
<para>
- This value is also accessible via the C macro <literal>GetNoz(block)</literal>.
+ This value is also accessible via the C macro <literal>GetNoz(block)</literal>.
</para>
</listitem>
<listitem>
/*get number of column of the last object state*/
m=block>ozsz[2*noz-1];
...
-}
+}
]]></programlisting>
<para>
The dimensions of object discrete states can be get with the following C macro : <literal>GetOzSize(block,x,1)</literal> for the first dimension and <literal>GetOzSize(block,x,2)</literal> for the second dimension with <literal>x</literal> an integer that gives the index of the discrete object state, <emphasis role="bold">numbered from 1 to noz</emphasis>.
model.odstate=list(int32([1,2;3,4]),[1+%i %i 0.5]);
]]></programlisting>
<para>
- Then we have two discrete object states, one is an 32-bit integer matrix with two rows and two columns and the second is a vector of complex numbers that can be understand as a matrix of size [1,3].
+ Then we have two discrete object states, one is an 32-bit integer matrix with two rows and two columns and the second is a vector of complex numbers that can be understood as a matrix of size [1,3].
</para>
<para>
At the C computational function level, the instructions <literal>block->ozsz[0]</literal>, <literal>block->ozsz[1]</literal>, <literal>block->ozsz[2]</literal> and <literal>block->ozsz[3]</literal> will respectively return the values <literal>2,1,2,3</literal> and the instructions <literal>block->oztyp[0]</literal>, <literal>block->oztyp[1]</literal> the values <literal>11</literal> and <literal>84</literal>.
</para>
<programlisting role="c"><![CDATA[
#include "scicos_block4.h"
-
+
...
SCSINT32_COP *ptr_i;
SCSREAL_COP *ptr_dr;
ptr_dr = GetRealOzPtrs(block,2);
ptr_di = GetImagOzPtrs(block,2);
...
-}
+}
]]></programlisting>
<para>
Finally note that the discrete objects state should be only written for <literal>flag=4</literal> and <literal>flag=2</literal>.
return;
}
break;
-
+
case 5: /*finish*/
scicos_free(*work);
break;
-
+
/*other flag treatment*/
...
}
...
-}
+}
]]></programlisting>
<para>
Note that if a block use a <literal>work</literal> pointer, it will be called with <literal>flag=2></literal> even if the block do not use discrete states.
</para>
<para>
- The pointer of that array can also be retrieve via the C macro <literal>GetWorkPtrs(block)</literal>.
+ The pointer of that array can also be retrieve via the C macro <literal>GetWorkPtrs(block)</literal>.
</para>
</listitem>
</itemizedlist>
One can't override the index <literal>(block->ng)-1</literal> when reading/writing data in the array <literal>g</literal> with a C computational function.
</para>
<para>
- The number of zero crossing surface can also be got by the use of the C macro <literal>GetNg(block)</literal>.
+ The number of zero crossing surface can also be got by the use of the C macro <literal>GetNg(block)</literal>.
</para>
</listitem>
<listitem>
Note that it is accessible for writing for <literal>flag=9</literal>.
</para>
<para>
- The pointer of that array can also be retrieve via the C macro <literal>GetGPtrs(block)</literal>.
+ The pointer of that array can also be retrieve via the C macro <literal>GetGPtrs(block)</literal>.
</para>
</listitem>
<listitem>
It is typically accessible for writing for <literal>flag=9</literal>.
</para>
<para>
- The pointer of that array can also be retrieve via the C macro <literal>GetModePtrs(block)</literal>.
+ The pointer of that array can also be retrieve via the C macro <literal>GetModePtrs(block)</literal>.
</para>
</listitem>
</itemizedlist>
<itemizedlist>
<listitem>
<para>
- <emphasis role="bold">block->type :</emphasis> Integer that gives the type of the computational function. For C blocks, this number is equal to <literal>4</literal>.
+ <emphasis role="bold">block->type :</emphasis> Integer that gives the type of the computational function. For C blocks, this number is equal to <literal>4</literal>.
</para>
</listitem>
<listitem>