4159
4378
call vfrexp(mn,stk(l),1,stk(lr),1,stk(lr1),1)
4381
subroutine inttan(id)
4382
INCLUDE '../stack.h'
4393
if (lhs .ne. 1) then
4404
if(abs(istk(il)).ne.1) then
4405
call funnam(ids(1,pt+1),'tan',iadr(lstk(top)))
4410
if(istk(il).lt.0) then
4411
c argument is passed by reference
4414
mn=istk(il+1)*istk(il+2)
4418
err=lr+mn*(it+1)-lstk(bot)
4423
call icopy(4,istk(il),1,istk(ilr),1)
4424
lstk(top+1)=lr+mn*(it+1)
4426
mn=istk(il+1)*istk(il+2)
4436
stk(lr+i)=tan(stk(l+i))
4440
call wtan(stk(l+i),stk(l+mn+i),stk(lr+i),stk(lr+mn+i))
4447
subroutine intimult(id)
4448
INCLUDE '../stack.h'
4451
c interface for imult : multiplication by i
4453
double precision sr,si
4459
if (lhs .ne. 1) then
4470
if(abs(istk(il)).ne.1) then
4471
call funnam(ids(1,pt+1),'imult',iadr(lstk(top)))
4476
if(istk(il).lt.0) then
4477
c argument is passed by reference
4480
mn=istk(il+1)*istk(il+2)
4484
err=lr+mn*(it+1)-lstk(bot)
4489
call icopy(4,istk(il),1,istk(ilr),1)
4490
lstk(top+1)=lr+mn*(it+1)
4492
mn=istk(il+1)*istk(il+2)
4502
c argument is real but result is complex
4503
err=lr+2*mn-lstk(bot)
4510
stk(lr+mn+i) = stk(l+i)
4515
c argument is complex
4527
subroutine intlog1p(id)
4529
c interface for log1p function (log(1+x))
4530
c rmk : don't work in complex
4532
INCLUDE '../stack.h'
4535
double precision logp1
4543
if (lhs .ne. 1) then
4554
if(abs(istk(il)).ne.1) then
4555
call funnam(ids(1,pt+1),'log1p',iadr(lstk(top)))
4560
if(istk(il).lt.0) then
4561
c argument is passed by reference
4564
mn=istk(il+1)*istk(il+2)
4568
err=lr+mn*(it+1)-lstk(bot)
4573
call icopy(4,istk(il),1,istk(ilr),1)
4574
lstk(top+1)=lr+mn*(it+1)
4576
mn=istk(il+1)*istk(il+2)
4588
if(stk(l+i).le.-1.0d+0) then
4592
elseif(ieee.eq.1) then
4602
stk(lr+i)=logp1(stk(l+i))
4605
c complex case : message "not implemented in scilab ..."
4612
subroutine intasin(id)
4613
INCLUDE '../stack.h'
4616
c interface for the arcsin function
4618
double precision sr,si
4624
if (lhs .ne. 1) then
4635
if(abs(istk(il)).ne.1) then
4636
call funnam(ids(1,pt+1),'asin',iadr(lstk(top)))
4641
if(istk(il).lt.0) then
4642
c argument is passed by reference
4645
mn=istk(il+1)*istk(il+2)
4649
err=lr+mn*(it+1)-lstk(bot)
4654
call icopy(4,istk(il),1,istk(ilr),1)
4655
lstk(top+1)=lr+mn*(it+1)
4657
mn=istk(il+1)*istk(il+2)
4669
if(abs(stk(l+i)).gt.1.0d+0) then
4677
c argument is a real positive matrix with entries in [-1,1]
4679
stk(lr+i)=asin(stk(l+i))
4682
c argument is a real matrix with some entries outside [-1,1]
4683
err=lr+2*mn-lstk(bot)
4690
call wasin(stk(l+i),0.0d+0,stk(lr+i),stk(lr+mn+i))
4695
c argument is a complex matrix
4697
call wasin(stk(l+i),stk(l+mn+i),stk(lr+i),stk(lr+i+mn))
4703
subroutine intacos(id)
4704
INCLUDE '../stack.h'
4707
double precision sr,si
4713
if (lhs .ne. 1) then
4724
if(abs(istk(il)).ne.1) then
4725
call funnam(ids(1,pt+1),'acos',iadr(lstk(top)))
4730
if(istk(il).lt.0) then
4731
c argument is passed by reference
4734
mn=istk(il+1)*istk(il+2)
4738
err=lr+mn*(it+1)-lstk(bot)
4743
call icopy(4,istk(il),1,istk(ilr),1)
4744
lstk(top+1)=lr+mn*(it+1)
4746
mn=istk(il+1)*istk(il+2)
4758
if(abs(stk(l+i)).gt.1.0d+0) then
4766
c argument is a real positive matrix with entries in [-1,1]
4768
stk(lr+i)=acos(stk(l+i))
4771
c argument is a real matrix with some entries outside [-1,1]
4772
err=lr+2*mn-lstk(bot)
4779
call wacos(stk(l+i),0.0d+0,stk(lr+i),stk(lr+mn+i))
4784
c argument is a complex matrix
4786
call wacos(stk(l+i),stk(l+mn+i),stk(lr+i),stk(lr+i+mn))
4793
subroutine intnbprop(id)
4795
c Interface for number_properties (an interface on dlamch) :
4797
c number_properties("eps") -> machine epsilon
4798
c number_properties("radix") -> base
4799
c number_properties("digits") -> number of digits for the mantissa
4800
c number_properties("minexp") -> emin
4801
c number_properties("maxexp") -> emax
4802
c number_properties("huge") -> max positive float
4803
c number_properties("tiny") -> min positive normalised float
4804
c number_properties("denorm") -> (boolean) true if denormalised number are used
4805
c number_properties("tiniest")-> min positive denormalised float
4810
INCLUDE '../stack.h'
4814
c EXTERNAL FUNCTIONS
4815
double precision dlamch
4818
c EXTERNAL API FUNCTIONS
4819
logical checkrhs, checklhs, getsmat, getrmat, cremat, crebmat
4820
external checkrhs, checklhs, getsmat, getrmat, cremat, crebmat
4824
integer n, m, idxmat, mt, nt, lstr, nlstr, lm, lr, lc, i
4826
parameter(lmax = 10)
4827
character*(lmax) inputstring
4829
double precision tiniest, b
4832
fname = 'number_properties'
4836
if (.not.checkrhs(fname,1,1)) return
4837
if (.not.checklhs(fname,1,1)) return
4840
if( .not. getsmat(fname,topk,top,mt,nt,1,1,lstr,nlstr)) return
4841
c rmq : pas de verif qu'il s'agit bien d'une matrice (1,1) ...
4842
c on recupere la chaine dans la variable inputstring
4843
lm = min(nlstr,lmax)
4844
call cvstr(lm,istk(lstr),inputstring,1)
4845
c complete (eventualy) the string with some blanks
4846
inputstring(lm+1:lmax) = ' '
4849
if (inputstring(1:9) .eq. 'eps ') then
4850
if (.not.cremat(fname,top,0,1,1,lr,lc)) return
4851
stk(lr) = dlamch('e')
4852
elseif (inputstring(1:9) .eq. 'huge ') then
4853
if (.not.cremat(fname,top,0,1,1,lr,lc)) return
4854
stk(lr) = dlamch('o')
4855
elseif (inputstring(1:9) .eq. 'tiny ') then
4856
if (.not.cremat(fname,top,0,1,1,lr,lc)) return
4857
stk(lr) = dlamch('u')
4858
elseif (inputstring(1:9) .eq. 'radix ') then
4859
if (.not.cremat(fname,top,0,1,1,lr,lc)) return
4860
stk(lr) = dlamch('b')
4861
elseif (inputstring(1:9) .eq. 'digits ') then
4862
if (.not.cremat(fname,top,0,1,1,lr,lc)) return
4863
stk(lr) = dlamch('n')
4864
elseif (inputstring(1:9) .eq. 'minexp ') then
4865
if (.not.cremat(fname,top,0,1,1,lr,lc)) return
4866
stk(lr) = dlamch('m')
4867
elseif (inputstring(1:9) .eq. 'maxexp ') then
4868
if (.not.cremat(fname,top,0,1,1,lr,lc)) return
4869
stk(lr) = dlamch('l')
4870
elseif (inputstring(1:9) .eq. 'denorm ') then
4871
if (.not.crebmat(fname,top,1,1,lr)) return
4872
if (dlamch('u') / dlamch('b') .gt. 0.d0) then
4877
elseif (inputstring(1:9) .eq. 'tiniest ') then
4878
if (.not.cremat(fname,top,0,1,1,lr,lc)) return
4880
tiniest = dlamch('u')
4881
if ( tiniest/b .ne. 0.d0 ) then
4882
c denormalised number are used
4883
do i = 1, dlamch('n') - 1
4884
tiniest = tiniest / b
4889
buf=fname//' : unknown property kind'
4897
subroutine intnearfl(id)
4899
c Interface for nearfloat :
4901
c nearfloat("succ",x) -> succ of x
4902
c nearfloat("pred",x) -> pred of x
4906
INCLUDE '../stack.h'
4910
c EXTERNAL FUNCTIONS
4911
double precision nearfloat
4914
c EXTERNAL API FUNCTIONS
4915
logical checkrhs, checklhs, getsmat, getrmat, cremat
4916
external checkrhs, checklhs, getsmat, getrmat, cremat
4920
integer n, m, idxmat, mt, nt, lstr, nlstr, lm, lr, lc, i
4923
character*(lmax) inputstring
4931
if (.not.checkrhs(fname,2,2)) return
4932
if (.not.checklhs(fname,1,1)) return
4934
c 1/ get the adress of the matrix
4935
if( .not. getrmat(fname, topk, top, m, n, idxmat) ) return
4938
if( .not. getsmat(fname,topk,top,mt,nt,1,1,lstr,nlstr)) return
4939
c pas de verif qu'il s'agit bien d'une matrice (1,1) ...
4940
c on recupere la chaine dans la variable inputstring
4941
lm = min(nlstr,lmax)
4942
call cvstr(lm,istk(lstr),inputstring,1)
4945
if (inputstring .eq. 'succ') then
4946
if (.not.cremat(fname,top,0,m,n,lr,lc)) return
4948
stk(lr+i) = nearfloat(stk(idxmat+i),1.d0)
4951
elseif (inputstring .eq. 'pred') then
4952
if (.not.cremat(fname,top,0,m,n,lr,lc)) return
4954
stk(lr+i) = nearfloat(stk(idxmat+i),-1.d0)
4958
buf=fname//' : unknown string specifier (must be pred or succ)'
4965
subroutine intdsearch(id)
4967
* interface for dsearch (Bruno le 10/12/2001)
4969
* [ind , occ, info] = dsearch(X, val [, ch])
4971
* X and val must be real vectors (says of length m for X and n for val ),
4972
* if ch is not present then ch = 'c' (dsearch on "intervals")
4973
* ch must be 'd' or 'c'
4975
* ind is a vector with the same format than X
4976
* occ is a vector with the same format than val (but with n-1
4977
* components in the case ch='c')
4982
INCLUDE '../stack.h'
4986
c EXTERNAL SUBROUTINES
4987
external dsearchc, dsearchd
4989
c EXTERNAL API FUNCTIONS
4990
logical checkrhs, checklhs, getsmat, getrvect, cremat, getrmat
4991
external checkrhs, checklhs, getsmat, getrvect, cremat, getrmat
4995
integer mX, nX, lX, mval, nval, lval, mch, nch, lch, nlch
4996
integer lind, mocc, nocc, locc, linfo, lc, j
5001
integer l, iadr,sadr
5010
if (.not.checkrhs(fname,2,3)) return
5011
if (.not.checklhs(fname,1,3)) return
5014
if (rhs .eq. 3) then
5015
if( .not. getsmat(fname,topk,top,mch,nch,1,1,lch,nlch)) return
5017
call cvstr(1,istk(lch),ch,1)
5021
if (ch.ne.'c' .and. ch.ne.'d') then
5022
buf=fname//' : unknown char specifier (must be ''c'' or ''d'')'
5028
if( .not. getrvect(fname, topk, top, mval, nval, lval) ) return
5030
if (mval*nval.lt.1) then
5031
buf=fname//' : argument 2 must not be an empty vector'
5038
if (mval*nval.lt.2) then
5039
buf=fname//' : in the interval case, argument 2 must be'
5040
$ //' a vector with length > 1'
5044
if (mval .eq. 1) then
5052
* verif that val is in strict increasing order
5053
do j = 1, mval*nval-1
5054
if (.not. stk(lval+j-1) .lt. stk(lval+j)) then ! cette forme permet de detecter les nans
5055
buf=fname//' : the array val (arg 2) is not well ordered'
5063
if( .not. getrmat(fname, topk, top, mX, nX, lX) ) return
5065
c reserve space for ind
5066
if (.not.cremat(fname, topk+1, 0, mX, nX, lind, lc)) return
5068
c reserve space for occ
5069
if (.not.cremat(fname, topk+2, 0, mocc, nocc, locc, lc)) return
5071
c reserve space for info
5072
if (.not.cremat(fname, topk+3, 0, 1, 1, linfo, lc)) return
5074
if (mX.eq.0.or.nX.eq.0) then
5076
call dset(mocc*nocc,0.0D0,stk(locc),1)
5079
c go on for the computation
5080
if ( ch .eq. 'c') then
5081
call dsearchc(stk(lX), mX*nX, stk(lval), mval*nval-1,
5082
$ stk(lind), stk(locc), stk(linfo))
5084
call dsearchd(stk(lX), mX*nX, stk(lval), mval*nval, stk(lind
5085
$ ),stk(locc), stk(linfo))
5088
c int2db ... (normalement ca doit passer avec -1 sans copie
5090
call int2db(mX*nX, istk(iadr(lind)), -1, stk(lind), -1)
5091
call int2db(mocc*nocc, istk(iadr(locc)), -1, stk(locc), -1)
5092
call int2db(1, istk(iadr(linfo)),-1, stk(linfo),-1)
5097
call copyobj(fname,topk+1,topl+1)
5100
call copyobj(fname,topk+2,topl+2)
5103
call copyobj(fname,topk+3,topl+3)
5109
subroutine intisequal(id)
5111
c Interface for isequal:
5115
INCLUDE '../stack.h'
5118
integer typ,m,n,l,il,il1,ilk,k,topk,top1,srhs,k1
5120
c EXTERNAL API FUNCTIONS
5121
logical checkrhs, checklhs
5122
external checkrhs, checklhs
5137
if (.not.checkrhs(fname,2,2000000)) return
5138
if (.not.checklhs(fname,1,1)) return
5139
c first check the types
5140
typ=abs(istk(iadr(lstk(top1))))
5142
if (abs(istk(iadr(lstk(top1+k)))).ne.typ) goto 60
5145
if (typ.ge.15.and.typ.le.17) then
5146
call setfunnam(ids(1,pt+1),'%l_isequal',10)
5152
call funnam(ids(1,pt+1),'isequal',iadr(lstk(top1)))
5158
c first check the dimensions
5159
il=iadr(lstk(top-rhs+1))
5160
if(istk(il).lt.0) il=iadr(istk(il+1))
5164
il=iadr(lstk(top-rhs+k))
5165
if(istk(il).lt.0) il=iadr(istk(il+1))
5166
if(m.ne.istk(il+1).or.n.ne.istk(il+2)) goto 60
5172
call createref(iadr(lstk(top1)),top1,lstk(top1+1)-lstk(top1))
5174
call createref(iadr(lstk(topk)),topk,lstk(topk+1)-lstk(topk))
5178
if(err.gt.0.or.err1.gt.0) return
5183
call funnam(ids(1,pt+1),'isequal',iadr(lstk(top-rhs+1)))
5189
do 35 k1=1,istk(il+1)*istk(il+2)
5190
if(istk(il+2+k1).eq.0) goto 60
5195
c variables are equal
5202
lstk(top+1)=sadr(il+4)
5204
c variables are different
5212
lstk(top+1)=sadr(il+4)