Mercurial > hg > octave-nkf
comparison liboctave/array/dNDArray.cc @ 15271:648dabbb4c6b
build: Refactor liboctave into multiple subdirectories. Move libcruft into liboctave.
* array/Array-C.cc, array/Array-b.cc, array/Array-ch.cc, array/Array-d.cc,
array/Array-f.cc, array/Array-fC.cc, array/Array-i.cc, array/Array-idx-vec.cc,
array/Array-s.cc, array/Array-str.cc, array/Array-util.cc, array/Array-util.h,
array/Array-voidp.cc, array/Array.cc, array/Array.h, array/Array2.h,
array/Array3.h, array/ArrayN.h, array/CColVector.cc, array/CColVector.h,
array/CDiagMatrix.cc, array/CDiagMatrix.h, array/CMatrix.cc, array/CMatrix.h,
array/CNDArray.cc, array/CNDArray.h, array/CRowVector.cc, array/CRowVector.h,
array/CSparse.cc, array/CSparse.h, array/DiagArray2.cc, array/DiagArray2.h,
array/MArray-C.cc, array/MArray-d.cc, array/MArray-decl.h, array/MArray-defs.h,
array/MArray-f.cc, array/MArray-fC.cc, array/MArray-i.cc, array/MArray-s.cc,
array/MArray.cc, array/MArray.h, array/MArray2.h, array/MArrayN.h,
array/MDiagArray2.cc, array/MDiagArray2.h, array/MSparse-C.cc,
array/MSparse-d.cc, array/MSparse-defs.h, array/MSparse.cc, array/MSparse.h,
array/Matrix.h, array/MatrixType.cc, array/MatrixType.h, array/PermMatrix.cc,
array/PermMatrix.h, array/Range.cc, array/Range.h, array/Sparse-C.cc,
array/Sparse-b.cc, array/Sparse-d.cc, array/Sparse.cc, array/Sparse.h,
array/boolMatrix.cc, array/boolMatrix.h, array/boolNDArray.cc,
array/boolNDArray.h, array/boolSparse.cc, array/boolSparse.h,
array/chMatrix.cc, array/chMatrix.h, array/chNDArray.cc, array/chNDArray.h,
array/dColVector.cc, array/dColVector.h, array/dDiagMatrix.cc,
array/dDiagMatrix.h, array/dMatrix.cc, array/dMatrix.h, array/dNDArray.cc,
array/dNDArray.h, array/dRowVector.cc, array/dRowVector.h, array/dSparse.cc,
array/dSparse.h, array/dim-vector.cc, array/dim-vector.h, array/fCColVector.cc,
array/fCColVector.h, array/fCDiagMatrix.cc, array/fCDiagMatrix.h,
array/fCMatrix.cc, array/fCMatrix.h, array/fCNDArray.cc, array/fCNDArray.h,
array/fCRowVector.cc, array/fCRowVector.h, array/fColVector.cc,
array/fColVector.h, array/fDiagMatrix.cc, array/fDiagMatrix.h,
array/fMatrix.cc, array/fMatrix.h, array/fNDArray.cc, array/fNDArray.h,
array/fRowVector.cc, array/fRowVector.h, array/idx-vector.cc,
array/idx-vector.h, array/int16NDArray.cc, array/int16NDArray.h,
array/int32NDArray.cc, array/int32NDArray.h, array/int64NDArray.cc,
array/int64NDArray.h, array/int8NDArray.cc, array/int8NDArray.h,
array/intNDArray.cc, array/intNDArray.h, array/module.mk,
array/uint16NDArray.cc, array/uint16NDArray.h, array/uint32NDArray.cc,
array/uint32NDArray.h, array/uint64NDArray.cc, array/uint64NDArray.h,
array/uint8NDArray.cc, array/uint8NDArray.h:
Moved from liboctave dir to array subdirectory.
* cruft/Makefile.am, cruft/amos/README, cruft/amos/cacai.f, cruft/amos/cacon.f,
cruft/amos/cairy.f, cruft/amos/casyi.f, cruft/amos/cbesh.f, cruft/amos/cbesi.f,
cruft/amos/cbesj.f, cruft/amos/cbesk.f, cruft/amos/cbesy.f, cruft/amos/cbinu.f,
cruft/amos/cbiry.f, cruft/amos/cbknu.f, cruft/amos/cbuni.f, cruft/amos/cbunk.f,
cruft/amos/ckscl.f, cruft/amos/cmlri.f, cruft/amos/crati.f, cruft/amos/cs1s2.f,
cruft/amos/cseri.f, cruft/amos/cshch.f, cruft/amos/cuchk.f, cruft/amos/cunhj.f,
cruft/amos/cuni1.f, cruft/amos/cuni2.f, cruft/amos/cunik.f, cruft/amos/cunk1.f,
cruft/amos/cunk2.f, cruft/amos/cuoik.f, cruft/amos/cwrsk.f,
cruft/amos/dgamln.f, cruft/amos/gamln.f, cruft/amos/module.mk,
cruft/amos/xzabs.f, cruft/amos/xzexp.f, cruft/amos/xzlog.f,
cruft/amos/xzsqrt.f, cruft/amos/zacai.f, cruft/amos/zacon.f,
cruft/amos/zairy.f, cruft/amos/zasyi.f, cruft/amos/zbesh.f, cruft/amos/zbesi.f,
cruft/amos/zbesj.f, cruft/amos/zbesk.f, cruft/amos/zbesy.f, cruft/amos/zbinu.f,
cruft/amos/zbiry.f, cruft/amos/zbknu.f, cruft/amos/zbuni.f, cruft/amos/zbunk.f,
cruft/amos/zdiv.f, cruft/amos/zkscl.f, cruft/amos/zmlri.f, cruft/amos/zmlt.f,
cruft/amos/zrati.f, cruft/amos/zs1s2.f, cruft/amos/zseri.f, cruft/amos/zshch.f,
cruft/amos/zuchk.f, cruft/amos/zunhj.f, cruft/amos/zuni1.f, cruft/amos/zuni2.f,
cruft/amos/zunik.f, cruft/amos/zunk1.f, cruft/amos/zunk2.f, cruft/amos/zuoik.f,
cruft/amos/zwrsk.f, cruft/blas-xtra/cconv2.f, cruft/blas-xtra/cdotc3.f,
cruft/blas-xtra/cmatm3.f, cruft/blas-xtra/csconv2.f, cruft/blas-xtra/dconv2.f,
cruft/blas-xtra/ddot3.f, cruft/blas-xtra/dmatm3.f, cruft/blas-xtra/module.mk,
cruft/blas-xtra/sconv2.f, cruft/blas-xtra/sdot3.f, cruft/blas-xtra/smatm3.f,
cruft/blas-xtra/xcdotc.f, cruft/blas-xtra/xcdotu.f, cruft/blas-xtra/xddot.f,
cruft/blas-xtra/xdnrm2.f, cruft/blas-xtra/xdznrm2.f, cruft/blas-xtra/xerbla.f,
cruft/blas-xtra/xscnrm2.f, cruft/blas-xtra/xsdot.f, cruft/blas-xtra/xsnrm2.f,
cruft/blas-xtra/xzdotc.f, cruft/blas-xtra/xzdotu.f, cruft/blas-xtra/zconv2.f,
cruft/blas-xtra/zdconv2.f, cruft/blas-xtra/zdotc3.f, cruft/blas-xtra/zmatm3.f,
cruft/daspk/datv.f, cruft/daspk/dcnst0.f, cruft/daspk/dcnstr.f,
cruft/daspk/ddasic.f, cruft/daspk/ddasid.f, cruft/daspk/ddasik.f,
cruft/daspk/ddaspk.f, cruft/daspk/ddstp.f, cruft/daspk/ddwnrm.f,
cruft/daspk/dfnrmd.f, cruft/daspk/dfnrmk.f, cruft/daspk/dhels.f,
cruft/daspk/dheqr.f, cruft/daspk/dinvwt.f, cruft/daspk/dlinsd.f,
cruft/daspk/dlinsk.f, cruft/daspk/dmatd.f, cruft/daspk/dnedd.f,
cruft/daspk/dnedk.f, cruft/daspk/dnsd.f, cruft/daspk/dnsid.f,
cruft/daspk/dnsik.f, cruft/daspk/dnsk.f, cruft/daspk/dorth.f,
cruft/daspk/dslvd.f, cruft/daspk/dslvk.f, cruft/daspk/dspigm.f,
cruft/daspk/dyypnw.f, cruft/daspk/module.mk, cruft/dasrt/ddasrt.f,
cruft/dasrt/drchek.f, cruft/dasrt/droots.f, cruft/dasrt/module.mk,
cruft/dassl/ddaini.f, cruft/dassl/ddajac.f, cruft/dassl/ddanrm.f,
cruft/dassl/ddaslv.f, cruft/dassl/ddassl.f, cruft/dassl/ddastp.f,
cruft/dassl/ddatrp.f, cruft/dassl/ddawts.f, cruft/dassl/module.mk,
cruft/fftpack/cfftb.f, cruft/fftpack/cfftb1.f, cruft/fftpack/cfftf.f,
cruft/fftpack/cfftf1.f, cruft/fftpack/cffti.f, cruft/fftpack/cffti1.f,
cruft/fftpack/fftpack.doc, cruft/fftpack/module.mk, cruft/fftpack/passb.f,
cruft/fftpack/passb2.f, cruft/fftpack/passb3.f, cruft/fftpack/passb4.f,
cruft/fftpack/passb5.f, cruft/fftpack/passf.f, cruft/fftpack/passf2.f,
cruft/fftpack/passf3.f, cruft/fftpack/passf4.f, cruft/fftpack/passf5.f,
cruft/fftpack/zfftb.f, cruft/fftpack/zfftb1.f, cruft/fftpack/zfftf.f,
cruft/fftpack/zfftf1.f, cruft/fftpack/zffti.f, cruft/fftpack/zffti1.f,
cruft/fftpack/zpassb.f, cruft/fftpack/zpassb2.f, cruft/fftpack/zpassb3.f,
cruft/fftpack/zpassb4.f, cruft/fftpack/zpassb5.f, cruft/fftpack/zpassf.f,
cruft/fftpack/zpassf2.f, cruft/fftpack/zpassf3.f, cruft/fftpack/zpassf4.f,
cruft/fftpack/zpassf5.f, cruft/lapack-xtra/crsf2csf.f,
cruft/lapack-xtra/module.mk, cruft/lapack-xtra/xclange.f,
cruft/lapack-xtra/xdlamch.f, cruft/lapack-xtra/xdlange.f,
cruft/lapack-xtra/xilaenv.f, cruft/lapack-xtra/xslamch.f,
cruft/lapack-xtra/xslange.f, cruft/lapack-xtra/xzlange.f,
cruft/lapack-xtra/zrsf2csf.f, cruft/link-deps.mk, cruft/misc/blaswrap.c,
cruft/misc/cquit.c, cruft/misc/d1mach-tst.for, cruft/misc/d1mach.f,
cruft/misc/f77-extern.cc, cruft/misc/f77-fcn.c, cruft/misc/f77-fcn.h,
cruft/misc/i1mach.f, cruft/misc/lo-error.c, cruft/misc/lo-error.h,
cruft/misc/module.mk, cruft/misc/quit.cc, cruft/misc/quit.h,
cruft/misc/r1mach.f, cruft/mkf77def.in, cruft/odepack/cfode.f,
cruft/odepack/dlsode.f, cruft/odepack/ewset.f, cruft/odepack/intdy.f,
cruft/odepack/module.mk, cruft/odepack/prepj.f, cruft/odepack/scfode.f,
cruft/odepack/sewset.f, cruft/odepack/sintdy.f, cruft/odepack/slsode.f,
cruft/odepack/solsy.f, cruft/odepack/sprepj.f, cruft/odepack/ssolsy.f,
cruft/odepack/sstode.f, cruft/odepack/stode.f, cruft/odepack/svnorm.f,
cruft/odepack/vnorm.f, cruft/ordered-qz/README, cruft/ordered-qz/dsubsp.f,
cruft/ordered-qz/exchqz.f, cruft/ordered-qz/module.mk,
cruft/ordered-qz/sexchqz.f, cruft/ordered-qz/ssubsp.f, cruft/quadpack/dqagi.f,
cruft/quadpack/dqagie.f, cruft/quadpack/dqagp.f, cruft/quadpack/dqagpe.f,
cruft/quadpack/dqelg.f, cruft/quadpack/dqk15i.f, cruft/quadpack/dqk21.f,
cruft/quadpack/dqpsrt.f, cruft/quadpack/module.mk, cruft/quadpack/qagi.f,
cruft/quadpack/qagie.f, cruft/quadpack/qagp.f, cruft/quadpack/qagpe.f,
cruft/quadpack/qelg.f, cruft/quadpack/qk15i.f, cruft/quadpack/qk21.f,
cruft/quadpack/qpsrt.f, cruft/quadpack/xerror.f, cruft/ranlib/Basegen.doc,
cruft/ranlib/HOWTOGET, cruft/ranlib/README, cruft/ranlib/advnst.f,
cruft/ranlib/genbet.f, cruft/ranlib/genchi.f, cruft/ranlib/genexp.f,
cruft/ranlib/genf.f, cruft/ranlib/gengam.f, cruft/ranlib/genmn.f,
cruft/ranlib/genmul.f, cruft/ranlib/gennch.f, cruft/ranlib/gennf.f,
cruft/ranlib/gennor.f, cruft/ranlib/genprm.f, cruft/ranlib/genunf.f,
cruft/ranlib/getcgn.f, cruft/ranlib/getsd.f, cruft/ranlib/ignbin.f,
cruft/ranlib/ignlgi.f, cruft/ranlib/ignnbn.f, cruft/ranlib/ignpoi.f,
cruft/ranlib/ignuin.f, cruft/ranlib/initgn.f, cruft/ranlib/inrgcm.f,
cruft/ranlib/lennob.f, cruft/ranlib/mltmod.f, cruft/ranlib/module.mk,
cruft/ranlib/phrtsd.f, cruft/ranlib/qrgnin.f, cruft/ranlib/randlib.chs,
cruft/ranlib/randlib.fdoc, cruft/ranlib/ranf.f, cruft/ranlib/setall.f,
cruft/ranlib/setant.f, cruft/ranlib/setgmn.f, cruft/ranlib/setsd.f,
cruft/ranlib/sexpo.f, cruft/ranlib/sgamma.f, cruft/ranlib/snorm.f,
cruft/ranlib/tstbot.for, cruft/ranlib/tstgmn.for, cruft/ranlib/tstmid.for,
cruft/ranlib/wrap.f, cruft/slatec-err/fdump.f, cruft/slatec-err/ixsav.f,
cruft/slatec-err/j4save.f, cruft/slatec-err/module.mk,
cruft/slatec-err/xerclr.f, cruft/slatec-err/xercnt.f,
cruft/slatec-err/xerhlt.f, cruft/slatec-err/xermsg.f,
cruft/slatec-err/xerprn.f, cruft/slatec-err/xerrwd.f,
cruft/slatec-err/xersve.f, cruft/slatec-err/xgetf.f, cruft/slatec-err/xgetua.f,
cruft/slatec-err/xsetf.f, cruft/slatec-err/xsetua.f, cruft/slatec-fn/acosh.f,
cruft/slatec-fn/albeta.f, cruft/slatec-fn/algams.f, cruft/slatec-fn/alngam.f,
cruft/slatec-fn/alnrel.f, cruft/slatec-fn/asinh.f, cruft/slatec-fn/atanh.f,
cruft/slatec-fn/betai.f, cruft/slatec-fn/csevl.f, cruft/slatec-fn/d9gmit.f,
cruft/slatec-fn/d9lgic.f, cruft/slatec-fn/d9lgit.f, cruft/slatec-fn/d9lgmc.f,
cruft/slatec-fn/dacosh.f, cruft/slatec-fn/dasinh.f, cruft/slatec-fn/datanh.f,
cruft/slatec-fn/dbetai.f, cruft/slatec-fn/dcsevl.f, cruft/slatec-fn/derf.f,
cruft/slatec-fn/derfc.in.f, cruft/slatec-fn/dgami.f, cruft/slatec-fn/dgamit.f,
cruft/slatec-fn/dgamlm.f, cruft/slatec-fn/dgamma.f, cruft/slatec-fn/dgamr.f,
cruft/slatec-fn/dlbeta.f, cruft/slatec-fn/dlgams.f, cruft/slatec-fn/dlngam.f,
cruft/slatec-fn/dlnrel.f, cruft/slatec-fn/dpchim.f, cruft/slatec-fn/dpchst.f,
cruft/slatec-fn/erf.f, cruft/slatec-fn/erfc.in.f, cruft/slatec-fn/gami.f,
cruft/slatec-fn/gamit.f, cruft/slatec-fn/gamlim.f, cruft/slatec-fn/gamma.f,
cruft/slatec-fn/gamr.f, cruft/slatec-fn/initds.f, cruft/slatec-fn/inits.f,
cruft/slatec-fn/module.mk, cruft/slatec-fn/pchim.f, cruft/slatec-fn/pchst.f,
cruft/slatec-fn/r9gmit.f, cruft/slatec-fn/r9lgic.f, cruft/slatec-fn/r9lgit.f,
cruft/slatec-fn/r9lgmc.f, cruft/slatec-fn/xacosh.f, cruft/slatec-fn/xasinh.f,
cruft/slatec-fn/xatanh.f, cruft/slatec-fn/xbetai.f, cruft/slatec-fn/xdacosh.f,
cruft/slatec-fn/xdasinh.f, cruft/slatec-fn/xdatanh.f,
cruft/slatec-fn/xdbetai.f, cruft/slatec-fn/xderf.f, cruft/slatec-fn/xderfc.f,
cruft/slatec-fn/xdgami.f, cruft/slatec-fn/xdgamit.f, cruft/slatec-fn/xdgamma.f,
cruft/slatec-fn/xerf.f, cruft/slatec-fn/xerfc.f, cruft/slatec-fn/xgamma.f,
cruft/slatec-fn/xgmainc.f, cruft/slatec-fn/xsgmainc.f:
Moved from top-level libcruft to cruft directory below liboctave.
* numeric/CmplxAEPBAL.cc, numeric/CmplxAEPBAL.h, numeric/CmplxCHOL.cc,
numeric/CmplxCHOL.h, numeric/CmplxGEPBAL.cc, numeric/CmplxGEPBAL.h,
numeric/CmplxHESS.cc, numeric/CmplxHESS.h, numeric/CmplxLU.cc,
numeric/CmplxLU.h, numeric/CmplxQR.cc, numeric/CmplxQR.h, numeric/CmplxQRP.cc,
numeric/CmplxQRP.h, numeric/CmplxSCHUR.cc, numeric/CmplxSCHUR.h,
numeric/CmplxSVD.cc, numeric/CmplxSVD.h, numeric/CollocWt.cc,
numeric/CollocWt.h, numeric/DAE.h, numeric/DAEFunc.h, numeric/DAERT.h,
numeric/DAERTFunc.h, numeric/DASPK-opts.in, numeric/DASPK.cc, numeric/DASPK.h,
numeric/DASRT-opts.in, numeric/DASRT.cc, numeric/DASRT.h,
numeric/DASSL-opts.in, numeric/DASSL.cc, numeric/DASSL.h, numeric/DET.h,
numeric/EIG.cc, numeric/EIG.h, numeric/LSODE-opts.in, numeric/LSODE.cc,
numeric/LSODE.h, numeric/ODE.h, numeric/ODEFunc.h, numeric/ODES.cc,
numeric/ODES.h, numeric/ODESFunc.h, numeric/Quad-opts.in, numeric/Quad.cc,
numeric/Quad.h, numeric/SparseCmplxCHOL.cc, numeric/SparseCmplxCHOL.h,
numeric/SparseCmplxLU.cc, numeric/SparseCmplxLU.h, numeric/SparseCmplxQR.cc,
numeric/SparseCmplxQR.h, numeric/SparseQR.cc, numeric/SparseQR.h,
numeric/SparsedbleCHOL.cc, numeric/SparsedbleCHOL.h, numeric/SparsedbleLU.cc,
numeric/SparsedbleLU.h, numeric/base-aepbal.h, numeric/base-dae.h,
numeric/base-de.h, numeric/base-lu.cc, numeric/base-lu.h, numeric/base-min.h,
numeric/base-qr.cc, numeric/base-qr.h, numeric/bsxfun-decl.h,
numeric/bsxfun-defs.cc, numeric/bsxfun.h, numeric/dbleAEPBAL.cc,
numeric/dbleAEPBAL.h, numeric/dbleCHOL.cc, numeric/dbleCHOL.h,
numeric/dbleGEPBAL.cc, numeric/dbleGEPBAL.h, numeric/dbleHESS.cc,
numeric/dbleHESS.h, numeric/dbleLU.cc, numeric/dbleLU.h, numeric/dbleQR.cc,
numeric/dbleQR.h, numeric/dbleQRP.cc, numeric/dbleQRP.h, numeric/dbleSCHUR.cc,
numeric/dbleSCHUR.h, numeric/dbleSVD.cc, numeric/dbleSVD.h,
numeric/eigs-base.cc, numeric/fCmplxAEPBAL.cc, numeric/fCmplxAEPBAL.h,
numeric/fCmplxCHOL.cc, numeric/fCmplxCHOL.h, numeric/fCmplxGEPBAL.cc,
numeric/fCmplxGEPBAL.h, numeric/fCmplxHESS.cc, numeric/fCmplxHESS.h,
numeric/fCmplxLU.cc, numeric/fCmplxLU.h, numeric/fCmplxQR.cc,
numeric/fCmplxQR.h, numeric/fCmplxQRP.cc, numeric/fCmplxQRP.h,
numeric/fCmplxSCHUR.cc, numeric/fCmplxSCHUR.h, numeric/fCmplxSVD.cc,
numeric/fCmplxSVD.h, numeric/fEIG.cc, numeric/fEIG.h, numeric/floatAEPBAL.cc,
numeric/floatAEPBAL.h, numeric/floatCHOL.cc, numeric/floatCHOL.h,
numeric/floatGEPBAL.cc, numeric/floatGEPBAL.h, numeric/floatHESS.cc,
numeric/floatHESS.h, numeric/floatLU.cc, numeric/floatLU.h, numeric/floatQR.cc,
numeric/floatQR.h, numeric/floatQRP.cc, numeric/floatQRP.h,
numeric/floatSCHUR.cc, numeric/floatSCHUR.h, numeric/floatSVD.cc,
numeric/floatSVD.h, numeric/lo-mappers.cc, numeric/lo-mappers.h,
numeric/lo-specfun.cc, numeric/lo-specfun.h, numeric/module.mk,
numeric/oct-convn.cc, numeric/oct-convn.h, numeric/oct-fftw.cc,
numeric/oct-fftw.h, numeric/oct-norm.cc, numeric/oct-norm.h,
numeric/oct-rand.cc, numeric/oct-rand.h, numeric/oct-spparms.cc,
numeric/oct-spparms.h, numeric/randgamma.c, numeric/randgamma.h,
numeric/randmtzig.c, numeric/randmtzig.h, numeric/randpoisson.c,
numeric/randpoisson.h, numeric/sparse-base-chol.cc, numeric/sparse-base-chol.h,
numeric/sparse-base-lu.cc, numeric/sparse-base-lu.h, numeric/sparse-dmsolve.cc:
Moved from liboctave dir to numeric subdirectory.
* operators/Sparse-diag-op-defs.h, operators/Sparse-op-defs.h,
operators/Sparse-perm-op-defs.h, operators/config-ops.sh, operators/mk-ops.awk,
operators/module.mk, operators/mx-base.h, operators/mx-defs.h,
operators/mx-ext.h, operators/mx-inlines.cc, operators/mx-op-decl.h,
operators/mx-op-defs.h, operators/mx-ops, operators/sparse-mk-ops.awk,
operators/sparse-mx-ops, operators/vx-ops:
Moved from liboctave dir to operators subdirectory.
* system/dir-ops.cc, system/dir-ops.h, system/file-ops.cc, system/file-ops.h,
system/file-stat.cc, system/file-stat.h, system/lo-sysdep.cc,
system/lo-sysdep.h, system/mach-info.cc, system/mach-info.h, system/module.mk,
system/oct-env.cc, system/oct-env.h, system/oct-group.cc, system/oct-group.h,
system/oct-openmp.h, system/oct-passwd.cc, system/oct-passwd.h,
system/oct-syscalls.cc, system/oct-syscalls.h, system/oct-time.cc,
system/oct-time.h, system/oct-uname.cc, system/oct-uname.h, system/pathlen.h,
system/sysdir.h, system/syswait.h, system/tempnam.c, system/tempname.c:
Moved from liboctave dir to system subdirectory.
* util/base-list.h, util/byte-swap.h, util/caseless-str.h, util/cmd-edit.cc,
util/cmd-edit.h, util/cmd-hist.cc, util/cmd-hist.h, util/data-conv.cc,
util/data-conv.h, util/f2c-main.c, util/functor.h, util/glob-match.cc,
util/glob-match.h, util/kpse.cc, util/lo-array-gripes.cc,
util/lo-array-gripes.h, util/lo-cieee.c, util/lo-cutils.c, util/lo-cutils.h,
util/lo-ieee.cc, util/lo-ieee.h, util/lo-macros.h, util/lo-math.h,
util/lo-traits.h, util/lo-utils.cc, util/lo-utils.h, util/module.mk,
util/oct-alloc.cc, util/oct-alloc.h, util/oct-base64.cc, util/oct-base64.h,
util/oct-binmap.h, util/oct-cmplx.h, util/oct-glob.cc, util/oct-glob.h,
util/oct-inttypes.cc, util/oct-inttypes.h, util/oct-locbuf.cc,
util/oct-locbuf.h, util/oct-md5.cc, util/oct-md5.h, util/oct-mem.h,
util/oct-mutex.cc, util/oct-mutex.h, util/oct-refcount.h, util/oct-rl-edit.c,
util/oct-rl-edit.h, util/oct-rl-hist.c, util/oct-rl-hist.h, util/oct-shlib.cc,
util/oct-shlib.h, util/oct-sort.cc, util/oct-sort.h, util/oct-sparse.h,
util/pathsearch.cc, util/pathsearch.h, util/regexp.cc, util/regexp.h,
util/singleton-cleanup.cc, util/singleton-cleanup.h, util/sparse-sort.cc,
util/sparse-sort.h, util/sparse-util.cc, util/sparse-util.h, util/statdefs.h,
util/str-vec.cc, util/str-vec.h, util/sun-utils.h:
Moved from liboctave dir to util subdirectory.
* Makefile.am: Eliminate reference to top-level liboctave directory.
* autogen.sh: cd to new liboctave/operators directory to run config-ops.sh.
* build-aux/common.mk: Eliminate LIBCRUFT references.
* configure.ac: Eliminate libcruft top-level references. Switch test
programs to find files in liboctave/cruft subdirectory.
* OctaveFAQ.texi, install.txi, mkoctfile.1: Eliminate references to libcruft in
docs.
* libgui/src/Makefile.am, libinterp/Makefile.am, src/Makefile.am: Update
include file locations. Stop linking against libcruft.
* libinterp/corefcn/module.mk: Update location of OPT_INC files which are
now in numeric/ subdirectory.
* libinterp/dldfcn/config-module.awk: Stop linking against libcruft.
* libinterp/interpfcn/toplev.cc: Remove reference to LIBCRUFT.
* libinterp/link-deps.mk, liboctave/link-deps.mk:
Add GNULIB_LINK_DEPS to link dependencies.
* libinterp/oct-conf.in.h: Remove reference to OCTAVE_CONF_LIBCRUFT.
* liboctave/Makefile.am: Overhaul to use convenience libraries in
subdirectories.
* scripts/miscellaneous/mkoctfile.m: Eliminate reference to LIBCRUFT.
* src/mkoctfile.in.cc, src/mkoctfile.in.sh: Stop linking againt libcruft.
Eliminate references to LIBCRUFT.
author | Rik <rik@octave.org> |
---|---|
date | Fri, 31 Aug 2012 20:00:20 -0700 |
parents | liboctave/dNDArray.cc@9020dddc925a |
children | d63878346099 |
comparison
equal
deleted
inserted
replaced
15270:6615a46d90ec | 15271:648dabbb4c6b |
---|---|
1 // N-D Array manipulations. | |
2 /* | |
3 | |
4 Copyright (C) 1996-2012 John W. Eaton | |
5 Copyright (C) 2009 VZLU Prague, a.s. | |
6 | |
7 This file is part of Octave. | |
8 | |
9 Octave is free software; you can redistribute it and/or modify it | |
10 under the terms of the GNU General Public License as published by the | |
11 Free Software Foundation; either version 3 of the License, or (at your | |
12 option) any later version. | |
13 | |
14 Octave is distributed in the hope that it will be useful, but WITHOUT | |
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
16 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
17 for more details. | |
18 | |
19 You should have received a copy of the GNU General Public License | |
20 along with Octave; see the file COPYING. If not, see | |
21 <http://www.gnu.org/licenses/>. | |
22 | |
23 */ | |
24 | |
25 #ifdef HAVE_CONFIG_H | |
26 #include <config.h> | |
27 #endif | |
28 | |
29 #include <cfloat> | |
30 | |
31 #include <vector> | |
32 | |
33 #include "Array-util.h" | |
34 #include "dNDArray.h" | |
35 #include "f77-fcn.h" | |
36 #include "functor.h" | |
37 #include "lo-error.h" | |
38 #include "lo-ieee.h" | |
39 #include "lo-mappers.h" | |
40 #include "mx-base.h" | |
41 #include "mx-op-defs.h" | |
42 #include "oct-fftw.h" | |
43 #include "oct-locbuf.h" | |
44 | |
45 #include "bsxfun-defs.cc" | |
46 | |
47 NDArray::NDArray (const Array<octave_idx_type>& a, bool zero_based, | |
48 bool negative_to_nan) | |
49 { | |
50 const octave_idx_type *pa = a.fortran_vec (); | |
51 resize (a.dims ()); | |
52 double *ptmp = fortran_vec (); | |
53 if (negative_to_nan) | |
54 { | |
55 double nan_val = lo_ieee_nan_value (); | |
56 | |
57 if (zero_based) | |
58 for (octave_idx_type i = 0; i < a.numel (); i++) | |
59 { | |
60 double val = static_cast<double> | |
61 (pa[i] + static_cast<octave_idx_type> (1)); | |
62 if (val <= 0) | |
63 ptmp[i] = nan_val; | |
64 else | |
65 ptmp[i] = val; | |
66 } | |
67 else | |
68 for (octave_idx_type i = 0; i < a.numel (); i++) | |
69 { | |
70 double val = static_cast<double> (pa[i]); | |
71 if (val <= 0) | |
72 ptmp[i] = nan_val; | |
73 else | |
74 ptmp[i] = val; | |
75 } | |
76 } | |
77 else | |
78 { | |
79 if (zero_based) | |
80 for (octave_idx_type i = 0; i < a.numel (); i++) | |
81 ptmp[i] = static_cast<double> | |
82 (pa[i] + static_cast<octave_idx_type> (1)); | |
83 else | |
84 for (octave_idx_type i = 0; i < a.numel (); i++) | |
85 ptmp[i] = static_cast<double> (pa[i]); | |
86 } | |
87 } | |
88 | |
89 NDArray::NDArray (const charNDArray& a) | |
90 : MArray<double> (a.dims ()) | |
91 { | |
92 octave_idx_type n = a.numel (); | |
93 for (octave_idx_type i = 0; i < n; i++) | |
94 xelem (i) = static_cast<unsigned char> (a(i)); | |
95 } | |
96 | |
97 #if defined (HAVE_FFTW) | |
98 | |
99 ComplexNDArray | |
100 NDArray::fourier (int dim) const | |
101 { | |
102 dim_vector dv = dims (); | |
103 | |
104 if (dim > dv.length () || dim < 0) | |
105 return ComplexNDArray (); | |
106 | |
107 octave_idx_type stride = 1; | |
108 octave_idx_type n = dv(dim); | |
109 | |
110 for (int i = 0; i < dim; i++) | |
111 stride *= dv(i); | |
112 | |
113 octave_idx_type howmany = numel () / dv (dim); | |
114 howmany = (stride == 1 ? howmany : (howmany > stride ? stride : howmany)); | |
115 octave_idx_type nloop = (stride == 1 ? 1 : numel () / dv (dim) / stride); | |
116 octave_idx_type dist = (stride == 1 ? n : 1); | |
117 | |
118 const double *in (fortran_vec ()); | |
119 ComplexNDArray retval (dv); | |
120 Complex *out (retval.fortran_vec ()); | |
121 | |
122 // Need to be careful here about the distance between fft's | |
123 for (octave_idx_type k = 0; k < nloop; k++) | |
124 octave_fftw::fft (in + k * stride * n, out + k * stride * n, | |
125 n, howmany, stride, dist); | |
126 | |
127 return retval; | |
128 } | |
129 | |
130 ComplexNDArray | |
131 NDArray::ifourier (int dim) const | |
132 { | |
133 dim_vector dv = dims (); | |
134 | |
135 if (dim > dv.length () || dim < 0) | |
136 return ComplexNDArray (); | |
137 | |
138 octave_idx_type stride = 1; | |
139 octave_idx_type n = dv(dim); | |
140 | |
141 for (int i = 0; i < dim; i++) | |
142 stride *= dv(i); | |
143 | |
144 octave_idx_type howmany = numel () / dv (dim); | |
145 howmany = (stride == 1 ? howmany : (howmany > stride ? stride : howmany)); | |
146 octave_idx_type nloop = (stride == 1 ? 1 : numel () / dv (dim) / stride); | |
147 octave_idx_type dist = (stride == 1 ? n : 1); | |
148 | |
149 ComplexNDArray retval (*this); | |
150 Complex *out (retval.fortran_vec ()); | |
151 | |
152 // Need to be careful here about the distance between fft's | |
153 for (octave_idx_type k = 0; k < nloop; k++) | |
154 octave_fftw::ifft (out + k * stride * n, out + k * stride * n, | |
155 n, howmany, stride, dist); | |
156 | |
157 return retval; | |
158 } | |
159 | |
160 ComplexNDArray | |
161 NDArray::fourier2d (void) const | |
162 { | |
163 dim_vector dv = dims (); | |
164 if (dv.length () < 2) | |
165 return ComplexNDArray (); | |
166 | |
167 dim_vector dv2(dv(0), dv(1)); | |
168 const double *in = fortran_vec (); | |
169 ComplexNDArray retval (dv); | |
170 Complex *out = retval.fortran_vec (); | |
171 octave_idx_type howmany = numel () / dv(0) / dv(1); | |
172 octave_idx_type dist = dv(0) * dv(1); | |
173 | |
174 for (octave_idx_type i=0; i < howmany; i++) | |
175 octave_fftw::fftNd (in + i*dist, out + i*dist, 2, dv2); | |
176 | |
177 return retval; | |
178 } | |
179 | |
180 ComplexNDArray | |
181 NDArray::ifourier2d (void) const | |
182 { | |
183 dim_vector dv = dims (); | |
184 if (dv.length () < 2) | |
185 return ComplexNDArray (); | |
186 | |
187 dim_vector dv2(dv(0), dv(1)); | |
188 ComplexNDArray retval (*this); | |
189 Complex *out = retval.fortran_vec (); | |
190 octave_idx_type howmany = numel () / dv(0) / dv(1); | |
191 octave_idx_type dist = dv(0) * dv(1); | |
192 | |
193 for (octave_idx_type i=0; i < howmany; i++) | |
194 octave_fftw::ifftNd (out + i*dist, out + i*dist, 2, dv2); | |
195 | |
196 return retval; | |
197 } | |
198 | |
199 ComplexNDArray | |
200 NDArray::fourierNd (void) const | |
201 { | |
202 dim_vector dv = dims (); | |
203 int rank = dv.length (); | |
204 | |
205 const double *in (fortran_vec ()); | |
206 ComplexNDArray retval (dv); | |
207 Complex *out (retval.fortran_vec ()); | |
208 | |
209 octave_fftw::fftNd (in, out, rank, dv); | |
210 | |
211 return retval; | |
212 } | |
213 | |
214 ComplexNDArray | |
215 NDArray::ifourierNd (void) const | |
216 { | |
217 dim_vector dv = dims (); | |
218 int rank = dv.length (); | |
219 | |
220 ComplexNDArray tmp (*this); | |
221 Complex *in (tmp.fortran_vec ()); | |
222 ComplexNDArray retval (dv); | |
223 Complex *out (retval.fortran_vec ()); | |
224 | |
225 octave_fftw::ifftNd (in, out, rank, dv); | |
226 | |
227 return retval; | |
228 } | |
229 | |
230 #else | |
231 | |
232 extern "C" | |
233 { | |
234 // Note that the original complex fft routines were not written for | |
235 // double complex arguments. They have been modified by adding an | |
236 // implicit double precision (a-h,o-z) statement at the beginning of | |
237 // each subroutine. | |
238 | |
239 F77_RET_T | |
240 F77_FUNC (zffti, ZFFTI) (const octave_idx_type&, Complex*); | |
241 | |
242 F77_RET_T | |
243 F77_FUNC (zfftf, ZFFTF) (const octave_idx_type&, Complex*, Complex*); | |
244 | |
245 F77_RET_T | |
246 F77_FUNC (zfftb, ZFFTB) (const octave_idx_type&, Complex*, Complex*); | |
247 } | |
248 | |
249 ComplexNDArray | |
250 NDArray::fourier (int dim) const | |
251 { | |
252 dim_vector dv = dims (); | |
253 | |
254 if (dim > dv.length () || dim < 0) | |
255 return ComplexNDArray (); | |
256 | |
257 ComplexNDArray retval (dv); | |
258 octave_idx_type npts = dv(dim); | |
259 octave_idx_type nn = 4*npts+15; | |
260 Array<Complex> wsave (nn); | |
261 Complex *pwsave = wsave.fortran_vec (); | |
262 | |
263 OCTAVE_LOCAL_BUFFER (Complex, tmp, npts); | |
264 | |
265 octave_idx_type stride = 1; | |
266 | |
267 for (int i = 0; i < dim; i++) | |
268 stride *= dv(i); | |
269 | |
270 octave_idx_type howmany = numel () / npts; | |
271 howmany = (stride == 1 ? howmany : (howmany > stride ? stride : howmany)); | |
272 octave_idx_type nloop = (stride == 1 ? 1 : numel () / npts / stride); | |
273 octave_idx_type dist = (stride == 1 ? npts : 1); | |
274 | |
275 F77_FUNC (zffti, ZFFTI) (npts, pwsave); | |
276 | |
277 for (octave_idx_type k = 0; k < nloop; k++) | |
278 { | |
279 for (octave_idx_type j = 0; j < howmany; j++) | |
280 { | |
281 octave_quit (); | |
282 | |
283 for (octave_idx_type i = 0; i < npts; i++) | |
284 tmp[i] = elem ((i + k*npts)*stride + j*dist); | |
285 | |
286 F77_FUNC (zfftf, ZFFTF) (npts, tmp, pwsave); | |
287 | |
288 for (octave_idx_type i = 0; i < npts; i++) | |
289 retval((i + k*npts)*stride + j*dist) = tmp[i]; | |
290 } | |
291 } | |
292 | |
293 return retval; | |
294 } | |
295 | |
296 ComplexNDArray | |
297 NDArray::ifourier (int dim) const | |
298 { | |
299 dim_vector dv = dims (); | |
300 | |
301 if (dim > dv.length () || dim < 0) | |
302 return ComplexNDArray (); | |
303 | |
304 ComplexNDArray retval (dv); | |
305 octave_idx_type npts = dv(dim); | |
306 octave_idx_type nn = 4*npts+15; | |
307 Array<Complex> wsave (nn); | |
308 Complex *pwsave = wsave.fortran_vec (); | |
309 | |
310 OCTAVE_LOCAL_BUFFER (Complex, tmp, npts); | |
311 | |
312 octave_idx_type stride = 1; | |
313 | |
314 for (int i = 0; i < dim; i++) | |
315 stride *= dv(i); | |
316 | |
317 octave_idx_type howmany = numel () / npts; | |
318 howmany = (stride == 1 ? howmany : (howmany > stride ? stride : howmany)); | |
319 octave_idx_type nloop = (stride == 1 ? 1 : numel () / npts / stride); | |
320 octave_idx_type dist = (stride == 1 ? npts : 1); | |
321 | |
322 F77_FUNC (zffti, ZFFTI) (npts, pwsave); | |
323 | |
324 for (octave_idx_type k = 0; k < nloop; k++) | |
325 { | |
326 for (octave_idx_type j = 0; j < howmany; j++) | |
327 { | |
328 octave_quit (); | |
329 | |
330 for (octave_idx_type i = 0; i < npts; i++) | |
331 tmp[i] = elem ((i + k*npts)*stride + j*dist); | |
332 | |
333 F77_FUNC (zfftb, ZFFTB) (npts, tmp, pwsave); | |
334 | |
335 for (octave_idx_type i = 0; i < npts; i++) | |
336 retval((i + k*npts)*stride + j*dist) = tmp[i] / | |
337 static_cast<double> (npts); | |
338 } | |
339 } | |
340 | |
341 return retval; | |
342 } | |
343 | |
344 ComplexNDArray | |
345 NDArray::fourier2d (void) const | |
346 { | |
347 dim_vector dv = dims (); | |
348 dim_vector dv2 (dv(0), dv(1)); | |
349 int rank = 2; | |
350 ComplexNDArray retval (*this); | |
351 octave_idx_type stride = 1; | |
352 | |
353 for (int i = 0; i < rank; i++) | |
354 { | |
355 octave_idx_type npts = dv2(i); | |
356 octave_idx_type nn = 4*npts+15; | |
357 Array<Complex> wsave (nn); | |
358 Complex *pwsave = wsave.fortran_vec (); | |
359 Array<Complex> row (npts); | |
360 Complex *prow = row.fortran_vec (); | |
361 | |
362 octave_idx_type howmany = numel () / npts; | |
363 howmany = (stride == 1 ? howmany : | |
364 (howmany > stride ? stride : howmany)); | |
365 octave_idx_type nloop = (stride == 1 ? 1 : numel () / npts / stride); | |
366 octave_idx_type dist = (stride == 1 ? npts : 1); | |
367 | |
368 F77_FUNC (zffti, ZFFTI) (npts, pwsave); | |
369 | |
370 for (octave_idx_type k = 0; k < nloop; k++) | |
371 { | |
372 for (octave_idx_type j = 0; j < howmany; j++) | |
373 { | |
374 octave_quit (); | |
375 | |
376 for (octave_idx_type l = 0; l < npts; l++) | |
377 prow[l] = retval((l + k*npts)*stride + j*dist); | |
378 | |
379 F77_FUNC (zfftf, ZFFTF) (npts, prow, pwsave); | |
380 | |
381 for (octave_idx_type l = 0; l < npts; l++) | |
382 retval((l + k*npts)*stride + j*dist) = prow[l]; | |
383 } | |
384 } | |
385 | |
386 stride *= dv2(i); | |
387 } | |
388 | |
389 return retval; | |
390 } | |
391 | |
392 ComplexNDArray | |
393 NDArray::ifourier2d (void) const | |
394 { | |
395 dim_vector dv = dims (); | |
396 dim_vector dv2 (dv(0), dv(1)); | |
397 int rank = 2; | |
398 ComplexNDArray retval (*this); | |
399 octave_idx_type stride = 1; | |
400 | |
401 for (int i = 0; i < rank; i++) | |
402 { | |
403 octave_idx_type npts = dv2(i); | |
404 octave_idx_type nn = 4*npts+15; | |
405 Array<Complex> wsave (nn); | |
406 Complex *pwsave = wsave.fortran_vec (); | |
407 Array<Complex> row (npts); | |
408 Complex *prow = row.fortran_vec (); | |
409 | |
410 octave_idx_type howmany = numel () / npts; | |
411 howmany = (stride == 1 ? howmany : | |
412 (howmany > stride ? stride : howmany)); | |
413 octave_idx_type nloop = (stride == 1 ? 1 : numel () / npts / stride); | |
414 octave_idx_type dist = (stride == 1 ? npts : 1); | |
415 | |
416 F77_FUNC (zffti, ZFFTI) (npts, pwsave); | |
417 | |
418 for (octave_idx_type k = 0; k < nloop; k++) | |
419 { | |
420 for (octave_idx_type j = 0; j < howmany; j++) | |
421 { | |
422 octave_quit (); | |
423 | |
424 for (octave_idx_type l = 0; l < npts; l++) | |
425 prow[l] = retval((l + k*npts)*stride + j*dist); | |
426 | |
427 F77_FUNC (zfftb, ZFFTB) (npts, prow, pwsave); | |
428 | |
429 for (octave_idx_type l = 0; l < npts; l++) | |
430 retval((l + k*npts)*stride + j*dist) = prow[l] / | |
431 static_cast<double> (npts); | |
432 } | |
433 } | |
434 | |
435 stride *= dv2(i); | |
436 } | |
437 | |
438 return retval; | |
439 } | |
440 | |
441 ComplexNDArray | |
442 NDArray::fourierNd (void) const | |
443 { | |
444 dim_vector dv = dims (); | |
445 int rank = dv.length (); | |
446 ComplexNDArray retval (*this); | |
447 octave_idx_type stride = 1; | |
448 | |
449 for (int i = 0; i < rank; i++) | |
450 { | |
451 octave_idx_type npts = dv(i); | |
452 octave_idx_type nn = 4*npts+15; | |
453 Array<Complex> wsave (nn); | |
454 Complex *pwsave = wsave.fortran_vec (); | |
455 Array<Complex> row (npts); | |
456 Complex *prow = row.fortran_vec (); | |
457 | |
458 octave_idx_type howmany = numel () / npts; | |
459 howmany = (stride == 1 ? howmany : | |
460 (howmany > stride ? stride : howmany)); | |
461 octave_idx_type nloop = (stride == 1 ? 1 : numel () / npts / stride); | |
462 octave_idx_type dist = (stride == 1 ? npts : 1); | |
463 | |
464 F77_FUNC (zffti, ZFFTI) (npts, pwsave); | |
465 | |
466 for (octave_idx_type k = 0; k < nloop; k++) | |
467 { | |
468 for (octave_idx_type j = 0; j < howmany; j++) | |
469 { | |
470 octave_quit (); | |
471 | |
472 for (octave_idx_type l = 0; l < npts; l++) | |
473 prow[l] = retval((l + k*npts)*stride + j*dist); | |
474 | |
475 F77_FUNC (zfftf, ZFFTF) (npts, prow, pwsave); | |
476 | |
477 for (octave_idx_type l = 0; l < npts; l++) | |
478 retval((l + k*npts)*stride + j*dist) = prow[l]; | |
479 } | |
480 } | |
481 | |
482 stride *= dv(i); | |
483 } | |
484 | |
485 return retval; | |
486 } | |
487 | |
488 ComplexNDArray | |
489 NDArray::ifourierNd (void) const | |
490 { | |
491 dim_vector dv = dims (); | |
492 int rank = dv.length (); | |
493 ComplexNDArray retval (*this); | |
494 octave_idx_type stride = 1; | |
495 | |
496 for (int i = 0; i < rank; i++) | |
497 { | |
498 octave_idx_type npts = dv(i); | |
499 octave_idx_type nn = 4*npts+15; | |
500 Array<Complex> wsave (nn); | |
501 Complex *pwsave = wsave.fortran_vec (); | |
502 Array<Complex> row (npts); | |
503 Complex *prow = row.fortran_vec (); | |
504 | |
505 octave_idx_type howmany = numel () / npts; | |
506 howmany = (stride == 1 ? howmany : | |
507 (howmany > stride ? stride : howmany)); | |
508 octave_idx_type nloop = (stride == 1 ? 1 : numel () / npts / stride); | |
509 octave_idx_type dist = (stride == 1 ? npts : 1); | |
510 | |
511 F77_FUNC (zffti, ZFFTI) (npts, pwsave); | |
512 | |
513 for (octave_idx_type k = 0; k < nloop; k++) | |
514 { | |
515 for (octave_idx_type j = 0; j < howmany; j++) | |
516 { | |
517 octave_quit (); | |
518 | |
519 for (octave_idx_type l = 0; l < npts; l++) | |
520 prow[l] = retval((l + k*npts)*stride + j*dist); | |
521 | |
522 F77_FUNC (zfftb, ZFFTB) (npts, prow, pwsave); | |
523 | |
524 for (octave_idx_type l = 0; l < npts; l++) | |
525 retval((l + k*npts)*stride + j*dist) = prow[l] / | |
526 static_cast<double> (npts); | |
527 } | |
528 } | |
529 | |
530 stride *= dv(i); | |
531 } | |
532 | |
533 return retval; | |
534 } | |
535 | |
536 #endif | |
537 | |
538 // unary operations | |
539 | |
540 boolNDArray | |
541 NDArray::operator ! (void) const | |
542 { | |
543 if (any_element_is_nan ()) | |
544 gripe_nan_to_logical_conversion (); | |
545 | |
546 return do_mx_unary_op<bool, double> (*this, mx_inline_not); | |
547 } | |
548 | |
549 bool | |
550 NDArray::any_element_is_negative (bool neg_zero) const | |
551 { | |
552 return (neg_zero ? test_all (xnegative_sign) | |
553 : do_mx_check<double> (*this, mx_inline_any_negative)); | |
554 } | |
555 | |
556 bool | |
557 NDArray::any_element_is_positive (bool neg_zero) const | |
558 { | |
559 return (neg_zero ? test_all (xpositive_sign) | |
560 : do_mx_check<double> (*this, mx_inline_any_positive)); | |
561 } | |
562 | |
563 bool | |
564 NDArray::any_element_is_nan (void) const | |
565 { | |
566 return do_mx_check<double> (*this, mx_inline_any_nan); | |
567 } | |
568 | |
569 bool | |
570 NDArray::any_element_is_inf_or_nan (void) const | |
571 { | |
572 return ! do_mx_check<double> (*this, mx_inline_all_finite); | |
573 } | |
574 | |
575 bool | |
576 NDArray::any_element_not_one_or_zero (void) const | |
577 { | |
578 return ! test_all (xis_one_or_zero); | |
579 } | |
580 | |
581 bool | |
582 NDArray::all_elements_are_zero (void) const | |
583 { | |
584 return test_all (xis_zero); | |
585 } | |
586 | |
587 bool | |
588 NDArray::all_elements_are_int_or_inf_or_nan (void) const | |
589 { | |
590 return test_all (xis_int_or_inf_or_nan); | |
591 } | |
592 | |
593 // Return nonzero if any element of M is not an integer. Also extract | |
594 // the largest and smallest values and return them in MAX_VAL and MIN_VAL. | |
595 | |
596 bool | |
597 NDArray::all_integers (double& max_val, double& min_val) const | |
598 { | |
599 octave_idx_type nel = nelem (); | |
600 | |
601 if (nel > 0) | |
602 { | |
603 max_val = elem (0); | |
604 min_val = elem (0); | |
605 } | |
606 else | |
607 return false; | |
608 | |
609 for (octave_idx_type i = 0; i < nel; i++) | |
610 { | |
611 double val = elem (i); | |
612 | |
613 if (val > max_val) | |
614 max_val = val; | |
615 | |
616 if (val < min_val) | |
617 min_val = val; | |
618 | |
619 if (! xisinteger (val)) | |
620 return false; | |
621 } | |
622 | |
623 return true; | |
624 } | |
625 | |
626 bool | |
627 NDArray::all_integers (void) const | |
628 { | |
629 return test_all (xisinteger); | |
630 } | |
631 | |
632 bool | |
633 NDArray::too_large_for_float (void) const | |
634 { | |
635 return test_any (xtoo_large_for_float); | |
636 } | |
637 | |
638 // FIXME -- this is not quite the right thing. | |
639 | |
640 boolNDArray | |
641 NDArray::all (int dim) const | |
642 { | |
643 return do_mx_red_op<bool, double> (*this, dim, mx_inline_all); | |
644 } | |
645 | |
646 boolNDArray | |
647 NDArray::any (int dim) const | |
648 { | |
649 return do_mx_red_op<bool, double> (*this, dim, mx_inline_any); | |
650 } | |
651 | |
652 NDArray | |
653 NDArray::cumprod (int dim) const | |
654 { | |
655 return do_mx_cum_op<double, double> (*this, dim, mx_inline_cumprod); | |
656 } | |
657 | |
658 NDArray | |
659 NDArray::cumsum (int dim) const | |
660 { | |
661 return do_mx_cum_op<double, double> (*this, dim, mx_inline_cumsum); | |
662 } | |
663 | |
664 NDArray | |
665 NDArray::prod (int dim) const | |
666 { | |
667 return do_mx_red_op<double, double> (*this, dim, mx_inline_prod); | |
668 } | |
669 | |
670 NDArray | |
671 NDArray::sum (int dim) const | |
672 { | |
673 return do_mx_red_op<double, double> (*this, dim, mx_inline_sum); | |
674 } | |
675 | |
676 NDArray | |
677 NDArray::xsum (int dim) const | |
678 { | |
679 return do_mx_red_op<double, double> (*this, dim, mx_inline_xsum); | |
680 } | |
681 | |
682 NDArray | |
683 NDArray::sumsq (int dim) const | |
684 { | |
685 return do_mx_red_op<double, double> (*this, dim, mx_inline_sumsq); | |
686 } | |
687 | |
688 NDArray | |
689 NDArray::max (int dim) const | |
690 { | |
691 return do_mx_minmax_op<double> (*this, dim, mx_inline_max); | |
692 } | |
693 | |
694 NDArray | |
695 NDArray::max (Array<octave_idx_type>& idx_arg, int dim) const | |
696 { | |
697 return do_mx_minmax_op<double> (*this, idx_arg, dim, mx_inline_max); | |
698 } | |
699 | |
700 NDArray | |
701 NDArray::min (int dim) const | |
702 { | |
703 return do_mx_minmax_op<double> (*this, dim, mx_inline_min); | |
704 } | |
705 | |
706 NDArray | |
707 NDArray::min (Array<octave_idx_type>& idx_arg, int dim) const | |
708 { | |
709 return do_mx_minmax_op<double> (*this, idx_arg, dim, mx_inline_min); | |
710 } | |
711 | |
712 NDArray | |
713 NDArray::cummax (int dim) const | |
714 { | |
715 return do_mx_cumminmax_op<double> (*this, dim, mx_inline_cummax); | |
716 } | |
717 | |
718 NDArray | |
719 NDArray::cummax (Array<octave_idx_type>& idx_arg, int dim) const | |
720 { | |
721 return do_mx_cumminmax_op<double> (*this, idx_arg, dim, mx_inline_cummax); | |
722 } | |
723 | |
724 NDArray | |
725 NDArray::cummin (int dim) const | |
726 { | |
727 return do_mx_cumminmax_op<double> (*this, dim, mx_inline_cummin); | |
728 } | |
729 | |
730 NDArray | |
731 NDArray::cummin (Array<octave_idx_type>& idx_arg, int dim) const | |
732 { | |
733 return do_mx_cumminmax_op<double> (*this, idx_arg, dim, mx_inline_cummin); | |
734 } | |
735 | |
736 NDArray | |
737 NDArray::diff (octave_idx_type order, int dim) const | |
738 { | |
739 return do_mx_diff_op<double> (*this, dim, order, mx_inline_diff); | |
740 } | |
741 | |
742 NDArray | |
743 NDArray::concat (const NDArray& rb, const Array<octave_idx_type>& ra_idx) | |
744 { | |
745 if (rb.numel () > 0) | |
746 insert (rb, ra_idx); | |
747 return *this; | |
748 } | |
749 | |
750 ComplexNDArray | |
751 NDArray::concat (const ComplexNDArray& rb, const Array<octave_idx_type>& ra_idx) | |
752 { | |
753 ComplexNDArray retval (*this); | |
754 if (rb.numel () > 0) | |
755 retval.insert (rb, ra_idx); | |
756 return retval; | |
757 } | |
758 | |
759 charNDArray | |
760 NDArray::concat (const charNDArray& rb, const Array<octave_idx_type>& ra_idx) | |
761 { | |
762 charNDArray retval (dims ()); | |
763 octave_idx_type nel = numel (); | |
764 | |
765 for (octave_idx_type i = 0; i < nel; i++) | |
766 { | |
767 double d = elem (i); | |
768 | |
769 if (xisnan (d)) | |
770 { | |
771 (*current_liboctave_error_handler) | |
772 ("invalid conversion from NaN to character"); | |
773 return retval; | |
774 } | |
775 else | |
776 { | |
777 octave_idx_type ival = NINTbig (d); | |
778 | |
779 if (ival < 0 || ival > std::numeric_limits<unsigned char>::max ()) | |
780 // FIXME -- is there something | |
781 // better we could do? Should we warn the user? | |
782 ival = 0; | |
783 | |
784 retval.elem (i) = static_cast<char>(ival); | |
785 } | |
786 } | |
787 | |
788 if (rb.numel () == 0) | |
789 return retval; | |
790 | |
791 retval.insert (rb, ra_idx); | |
792 return retval; | |
793 } | |
794 | |
795 NDArray | |
796 real (const ComplexNDArray& a) | |
797 { | |
798 return do_mx_unary_op<double, Complex> (a, mx_inline_real); | |
799 } | |
800 | |
801 NDArray | |
802 imag (const ComplexNDArray& a) | |
803 { | |
804 return do_mx_unary_op<double, Complex> (a, mx_inline_imag); | |
805 } | |
806 | |
807 NDArray& | |
808 NDArray::insert (const NDArray& a, octave_idx_type r, octave_idx_type c) | |
809 { | |
810 Array<double>::insert (a, r, c); | |
811 return *this; | |
812 } | |
813 | |
814 NDArray& | |
815 NDArray::insert (const NDArray& a, const Array<octave_idx_type>& ra_idx) | |
816 { | |
817 Array<double>::insert (a, ra_idx); | |
818 return *this; | |
819 } | |
820 | |
821 NDArray | |
822 NDArray::abs (void) const | |
823 { | |
824 return do_mx_unary_map<double, double, std::abs> (*this); | |
825 } | |
826 | |
827 boolNDArray | |
828 NDArray::isnan (void) const | |
829 { | |
830 return do_mx_unary_map<bool, double, xisnan> (*this); | |
831 } | |
832 | |
833 boolNDArray | |
834 NDArray::isinf (void) const | |
835 { | |
836 return do_mx_unary_map<bool, double, xisinf> (*this); | |
837 } | |
838 | |
839 boolNDArray | |
840 NDArray::isfinite (void) const | |
841 { | |
842 return do_mx_unary_map<bool, double, xfinite> (*this); | |
843 } | |
844 | |
845 Matrix | |
846 NDArray::matrix_value (void) const | |
847 { | |
848 Matrix retval; | |
849 | |
850 if (ndims () == 2) | |
851 retval = Matrix (Array<double> (*this)); | |
852 else | |
853 (*current_liboctave_error_handler) | |
854 ("invalid conversion of NDArray to Matrix"); | |
855 | |
856 return retval; | |
857 } | |
858 | |
859 void | |
860 NDArray::increment_index (Array<octave_idx_type>& ra_idx, | |
861 const dim_vector& dimensions, | |
862 int start_dimension) | |
863 { | |
864 ::increment_index (ra_idx, dimensions, start_dimension); | |
865 } | |
866 | |
867 octave_idx_type | |
868 NDArray::compute_index (Array<octave_idx_type>& ra_idx, | |
869 const dim_vector& dimensions) | |
870 { | |
871 return ::compute_index (ra_idx, dimensions); | |
872 } | |
873 | |
874 NDArray | |
875 NDArray::diag (octave_idx_type k) const | |
876 { | |
877 return MArray<double>::diag (k); | |
878 } | |
879 | |
880 NDArray | |
881 NDArray::diag (octave_idx_type m, octave_idx_type n) const | |
882 { | |
883 return MArray<double>::diag (m, n); | |
884 } | |
885 | |
886 // This contains no information on the array structure !!! | |
887 std::ostream& | |
888 operator << (std::ostream& os, const NDArray& a) | |
889 { | |
890 octave_idx_type nel = a.nelem (); | |
891 | |
892 for (octave_idx_type i = 0; i < nel; i++) | |
893 { | |
894 os << " "; | |
895 octave_write_double (os, a.elem (i)); | |
896 os << "\n"; | |
897 } | |
898 return os; | |
899 } | |
900 | |
901 std::istream& | |
902 operator >> (std::istream& is, NDArray& a) | |
903 { | |
904 octave_idx_type nel = a.nelem (); | |
905 | |
906 if (nel > 0) | |
907 { | |
908 double tmp; | |
909 for (octave_idx_type i = 0; i < nel; i++) | |
910 { | |
911 tmp = octave_read_value<double> (is); | |
912 if (is) | |
913 a.elem (i) = tmp; | |
914 else | |
915 goto done; | |
916 } | |
917 } | |
918 | |
919 done: | |
920 | |
921 return is; | |
922 } | |
923 | |
924 MINMAX_FCNS (NDArray, double) | |
925 | |
926 NDS_CMP_OPS (NDArray, double) | |
927 NDS_BOOL_OPS (NDArray, double) | |
928 | |
929 SND_CMP_OPS (double, NDArray) | |
930 SND_BOOL_OPS (double, NDArray) | |
931 | |
932 NDND_CMP_OPS (NDArray, NDArray) | |
933 NDND_BOOL_OPS (NDArray, NDArray) | |
934 | |
935 BSXFUN_STDOP_DEFS_MXLOOP (NDArray) | |
936 BSXFUN_STDREL_DEFS_MXLOOP (NDArray) | |
937 | |
938 BSXFUN_OP_DEF_MXLOOP (pow, NDArray, mx_inline_pow) | |
939 BSXFUN_OP2_DEF_MXLOOP (pow, ComplexNDArray, ComplexNDArray, | |
940 NDArray, mx_inline_pow) | |
941 BSXFUN_OP2_DEF_MXLOOP (pow, ComplexNDArray, NDArray, | |
942 ComplexNDArray, mx_inline_pow) |