Mercurial > hg > octave-lyh
comparison liboctave/array/CNDArray.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/CNDArray.cc@4bbd3bbb8912 |
children |
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 "CNDArray.h" | |
35 #include "f77-fcn.h" | |
36 #include "functor.h" | |
37 #include "lo-ieee.h" | |
38 #include "lo-mappers.h" | |
39 #include "MArray-defs.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 ComplexNDArray::ComplexNDArray (const charNDArray& a) | |
48 : MArray<Complex> (a.dims ()) | |
49 { | |
50 octave_idx_type n = a.numel (); | |
51 for (octave_idx_type i = 0; i < n; i++) | |
52 xelem (i) = static_cast<unsigned char> (a(i)); | |
53 } | |
54 | |
55 #if defined (HAVE_FFTW) | |
56 | |
57 ComplexNDArray | |
58 ComplexNDArray::fourier (int dim) const | |
59 { | |
60 dim_vector dv = dims (); | |
61 | |
62 if (dim > dv.length () || dim < 0) | |
63 return ComplexNDArray (); | |
64 | |
65 octave_idx_type stride = 1; | |
66 octave_idx_type n = dv(dim); | |
67 | |
68 for (int i = 0; i < dim; i++) | |
69 stride *= dv(i); | |
70 | |
71 octave_idx_type howmany = numel () / dv (dim); | |
72 howmany = (stride == 1 ? howmany : (howmany > stride ? stride : howmany)); | |
73 octave_idx_type nloop = (stride == 1 ? 1 : numel () / dv (dim) / stride); | |
74 octave_idx_type dist = (stride == 1 ? n : 1); | |
75 | |
76 const Complex *in (fortran_vec ()); | |
77 ComplexNDArray retval (dv); | |
78 Complex *out (retval.fortran_vec ()); | |
79 | |
80 // Need to be careful here about the distance between fft's | |
81 for (octave_idx_type k = 0; k < nloop; k++) | |
82 octave_fftw::fft (in + k * stride * n, out + k * stride * n, | |
83 n, howmany, stride, dist); | |
84 | |
85 return retval; | |
86 } | |
87 | |
88 ComplexNDArray | |
89 ComplexNDArray::ifourier (int dim) const | |
90 { | |
91 dim_vector dv = dims (); | |
92 | |
93 if (dim > dv.length () || dim < 0) | |
94 return ComplexNDArray (); | |
95 | |
96 octave_idx_type stride = 1; | |
97 octave_idx_type n = dv(dim); | |
98 | |
99 for (int i = 0; i < dim; i++) | |
100 stride *= dv(i); | |
101 | |
102 octave_idx_type howmany = numel () / dv (dim); | |
103 howmany = (stride == 1 ? howmany : (howmany > stride ? stride : howmany)); | |
104 octave_idx_type nloop = (stride == 1 ? 1 : numel () / dv (dim) / stride); | |
105 octave_idx_type dist = (stride == 1 ? n : 1); | |
106 | |
107 const Complex *in (fortran_vec ()); | |
108 ComplexNDArray retval (dv); | |
109 Complex *out (retval.fortran_vec ()); | |
110 | |
111 // Need to be careful here about the distance between fft's | |
112 for (octave_idx_type k = 0; k < nloop; k++) | |
113 octave_fftw::ifft (in + k * stride * n, out + k * stride * n, | |
114 n, howmany, stride, dist); | |
115 | |
116 return retval; | |
117 } | |
118 | |
119 ComplexNDArray | |
120 ComplexNDArray::fourier2d (void) const | |
121 { | |
122 dim_vector dv = dims (); | |
123 if (dv.length () < 2) | |
124 return ComplexNDArray (); | |
125 | |
126 dim_vector dv2(dv(0), dv(1)); | |
127 const Complex *in = fortran_vec (); | |
128 ComplexNDArray retval (dv); | |
129 Complex *out = retval.fortran_vec (); | |
130 octave_idx_type howmany = numel () / dv(0) / dv(1); | |
131 octave_idx_type dist = dv(0) * dv(1); | |
132 | |
133 for (octave_idx_type i=0; i < howmany; i++) | |
134 octave_fftw::fftNd (in + i*dist, out + i*dist, 2, dv2); | |
135 | |
136 return retval; | |
137 } | |
138 | |
139 ComplexNDArray | |
140 ComplexNDArray::ifourier2d (void) const | |
141 { | |
142 dim_vector dv = dims (); | |
143 if (dv.length () < 2) | |
144 return ComplexNDArray (); | |
145 | |
146 dim_vector dv2(dv(0), dv(1)); | |
147 const Complex *in = fortran_vec (); | |
148 ComplexNDArray retval (dv); | |
149 Complex *out = retval.fortran_vec (); | |
150 octave_idx_type howmany = numel () / dv(0) / dv(1); | |
151 octave_idx_type dist = dv(0) * dv(1); | |
152 | |
153 for (octave_idx_type i=0; i < howmany; i++) | |
154 octave_fftw::ifftNd (in + i*dist, out + i*dist, 2, dv2); | |
155 | |
156 return retval; | |
157 } | |
158 | |
159 ComplexNDArray | |
160 ComplexNDArray::fourierNd (void) const | |
161 { | |
162 dim_vector dv = dims (); | |
163 int rank = dv.length (); | |
164 | |
165 const Complex *in (fortran_vec ()); | |
166 ComplexNDArray retval (dv); | |
167 Complex *out (retval.fortran_vec ()); | |
168 | |
169 octave_fftw::fftNd (in, out, rank, dv); | |
170 | |
171 return retval; | |
172 } | |
173 | |
174 ComplexNDArray | |
175 ComplexNDArray::ifourierNd (void) const | |
176 { | |
177 dim_vector dv = dims (); | |
178 int rank = dv.length (); | |
179 | |
180 const Complex *in (fortran_vec ()); | |
181 ComplexNDArray retval (dv); | |
182 Complex *out (retval.fortran_vec ()); | |
183 | |
184 octave_fftw::ifftNd (in, out, rank, dv); | |
185 | |
186 return retval; | |
187 } | |
188 | |
189 #else | |
190 | |
191 extern "C" | |
192 { | |
193 // Note that the original complex fft routines were not written for | |
194 // double complex arguments. They have been modified by adding an | |
195 // implicit double precision (a-h,o-z) statement at the beginning of | |
196 // each subroutine. | |
197 | |
198 F77_RET_T | |
199 F77_FUNC (zffti, ZFFTI) (const octave_idx_type&, Complex*); | |
200 | |
201 F77_RET_T | |
202 F77_FUNC (zfftf, ZFFTF) (const octave_idx_type&, Complex*, Complex*); | |
203 | |
204 F77_RET_T | |
205 F77_FUNC (zfftb, ZFFTB) (const octave_idx_type&, Complex*, Complex*); | |
206 } | |
207 | |
208 ComplexNDArray | |
209 ComplexNDArray::fourier (int dim) const | |
210 { | |
211 dim_vector dv = dims (); | |
212 | |
213 if (dim > dv.length () || dim < 0) | |
214 return ComplexNDArray (); | |
215 | |
216 ComplexNDArray retval (dv); | |
217 octave_idx_type npts = dv(dim); | |
218 octave_idx_type nn = 4*npts+15; | |
219 Array<Complex> wsave (dim_vector (nn, 1)); | |
220 Complex *pwsave = wsave.fortran_vec (); | |
221 | |
222 OCTAVE_LOCAL_BUFFER (Complex, tmp, npts); | |
223 | |
224 octave_idx_type stride = 1; | |
225 | |
226 for (int i = 0; i < dim; i++) | |
227 stride *= dv(i); | |
228 | |
229 octave_idx_type howmany = numel () / npts; | |
230 howmany = (stride == 1 ? howmany : (howmany > stride ? stride : howmany)); | |
231 octave_idx_type nloop = (stride == 1 ? 1 : numel () / npts / stride); | |
232 octave_idx_type dist = (stride == 1 ? npts : 1); | |
233 | |
234 F77_FUNC (zffti, ZFFTI) (npts, pwsave); | |
235 | |
236 for (octave_idx_type k = 0; k < nloop; k++) | |
237 { | |
238 for (octave_idx_type j = 0; j < howmany; j++) | |
239 { | |
240 octave_quit (); | |
241 | |
242 for (octave_idx_type i = 0; i < npts; i++) | |
243 tmp[i] = elem ((i + k*npts)*stride + j*dist); | |
244 | |
245 F77_FUNC (zfftf, ZFFTF) (npts, tmp, pwsave); | |
246 | |
247 for (octave_idx_type i = 0; i < npts; i++) | |
248 retval((i + k*npts)*stride + j*dist) = tmp[i]; | |
249 } | |
250 } | |
251 | |
252 return retval; | |
253 } | |
254 | |
255 ComplexNDArray | |
256 ComplexNDArray::ifourier (int dim) const | |
257 { | |
258 dim_vector dv = dims (); | |
259 | |
260 if (dim > dv.length () || dim < 0) | |
261 return ComplexNDArray (); | |
262 | |
263 ComplexNDArray retval (dv); | |
264 octave_idx_type npts = dv(dim); | |
265 octave_idx_type nn = 4*npts+15; | |
266 Array<Complex> wsave (dim_vector (nn, 1)); | |
267 Complex *pwsave = wsave.fortran_vec (); | |
268 | |
269 OCTAVE_LOCAL_BUFFER (Complex, tmp, npts); | |
270 | |
271 octave_idx_type stride = 1; | |
272 | |
273 for (int i = 0; i < dim; i++) | |
274 stride *= dv(i); | |
275 | |
276 octave_idx_type howmany = numel () / npts; | |
277 howmany = (stride == 1 ? howmany : (howmany > stride ? stride : howmany)); | |
278 octave_idx_type nloop = (stride == 1 ? 1 : numel () / npts / stride); | |
279 octave_idx_type dist = (stride == 1 ? npts : 1); | |
280 | |
281 F77_FUNC (zffti, ZFFTI) (npts, pwsave); | |
282 | |
283 for (octave_idx_type k = 0; k < nloop; k++) | |
284 { | |
285 for (octave_idx_type j = 0; j < howmany; j++) | |
286 { | |
287 octave_quit (); | |
288 | |
289 for (octave_idx_type i = 0; i < npts; i++) | |
290 tmp[i] = elem ((i + k*npts)*stride + j*dist); | |
291 | |
292 F77_FUNC (zfftb, ZFFTB) (npts, tmp, pwsave); | |
293 | |
294 for (octave_idx_type i = 0; i < npts; i++) | |
295 retval((i + k*npts)*stride + j*dist) = tmp[i] / | |
296 static_cast<double> (npts); | |
297 } | |
298 } | |
299 | |
300 return retval; | |
301 } | |
302 | |
303 ComplexNDArray | |
304 ComplexNDArray::fourier2d (void) const | |
305 { | |
306 dim_vector dv = dims (); | |
307 dim_vector dv2 (dv(0), dv(1)); | |
308 int rank = 2; | |
309 ComplexNDArray retval (*this); | |
310 octave_idx_type stride = 1; | |
311 | |
312 for (int i = 0; i < rank; i++) | |
313 { | |
314 octave_idx_type npts = dv2(i); | |
315 octave_idx_type nn = 4*npts+15; | |
316 Array<Complex> wsave (dim_vector (nn, 1)); | |
317 Complex *pwsave = wsave.fortran_vec (); | |
318 Array<Complex> row (dim_vector (npts, 1)); | |
319 Complex *prow = row.fortran_vec (); | |
320 | |
321 octave_idx_type howmany = numel () / npts; | |
322 howmany = (stride == 1 ? howmany : | |
323 (howmany > stride ? stride : howmany)); | |
324 octave_idx_type nloop = (stride == 1 ? 1 : numel () / npts / stride); | |
325 octave_idx_type dist = (stride == 1 ? npts : 1); | |
326 | |
327 F77_FUNC (zffti, ZFFTI) (npts, pwsave); | |
328 | |
329 for (octave_idx_type k = 0; k < nloop; k++) | |
330 { | |
331 for (octave_idx_type j = 0; j < howmany; j++) | |
332 { | |
333 octave_quit (); | |
334 | |
335 for (octave_idx_type l = 0; l < npts; l++) | |
336 prow[l] = retval((l + k*npts)*stride + j*dist); | |
337 | |
338 F77_FUNC (zfftf, ZFFTF) (npts, prow, pwsave); | |
339 | |
340 for (octave_idx_type l = 0; l < npts; l++) | |
341 retval((l + k*npts)*stride + j*dist) = prow[l]; | |
342 } | |
343 } | |
344 | |
345 stride *= dv2(i); | |
346 } | |
347 | |
348 return retval; | |
349 } | |
350 | |
351 ComplexNDArray | |
352 ComplexNDArray::ifourier2d (void) const | |
353 { | |
354 dim_vector dv = dims (); | |
355 dim_vector dv2 (dv(0), dv(1)); | |
356 int rank = 2; | |
357 ComplexNDArray retval (*this); | |
358 octave_idx_type stride = 1; | |
359 | |
360 for (int i = 0; i < rank; i++) | |
361 { | |
362 octave_idx_type npts = dv2(i); | |
363 octave_idx_type nn = 4*npts+15; | |
364 Array<Complex> wsave (dim_vector (nn, 1)); | |
365 Complex *pwsave = wsave.fortran_vec (); | |
366 Array<Complex> row (dim_vector (npts, 1)); | |
367 Complex *prow = row.fortran_vec (); | |
368 | |
369 octave_idx_type howmany = numel () / npts; | |
370 howmany = (stride == 1 ? howmany : | |
371 (howmany > stride ? stride : howmany)); | |
372 octave_idx_type nloop = (stride == 1 ? 1 : numel () / npts / stride); | |
373 octave_idx_type dist = (stride == 1 ? npts : 1); | |
374 | |
375 F77_FUNC (zffti, ZFFTI) (npts, pwsave); | |
376 | |
377 for (octave_idx_type k = 0; k < nloop; k++) | |
378 { | |
379 for (octave_idx_type j = 0; j < howmany; j++) | |
380 { | |
381 octave_quit (); | |
382 | |
383 for (octave_idx_type l = 0; l < npts; l++) | |
384 prow[l] = retval((l + k*npts)*stride + j*dist); | |
385 | |
386 F77_FUNC (zfftb, ZFFTB) (npts, prow, pwsave); | |
387 | |
388 for (octave_idx_type l = 0; l < npts; l++) | |
389 retval((l + k*npts)*stride + j*dist) = prow[l] / | |
390 static_cast<double> (npts); | |
391 } | |
392 } | |
393 | |
394 stride *= dv2(i); | |
395 } | |
396 | |
397 return retval; | |
398 } | |
399 | |
400 ComplexNDArray | |
401 ComplexNDArray::fourierNd (void) const | |
402 { | |
403 dim_vector dv = dims (); | |
404 int rank = dv.length (); | |
405 ComplexNDArray retval (*this); | |
406 octave_idx_type stride = 1; | |
407 | |
408 for (int i = 0; i < rank; i++) | |
409 { | |
410 octave_idx_type npts = dv(i); | |
411 octave_idx_type nn = 4*npts+15; | |
412 Array<Complex> wsave (dim_vector (nn, 1)); | |
413 Complex *pwsave = wsave.fortran_vec (); | |
414 Array<Complex> row (dim_vector (npts, 1)); | |
415 Complex *prow = row.fortran_vec (); | |
416 | |
417 octave_idx_type howmany = numel () / npts; | |
418 howmany = (stride == 1 ? howmany : | |
419 (howmany > stride ? stride : howmany)); | |
420 octave_idx_type nloop = (stride == 1 ? 1 : numel () / npts / stride); | |
421 octave_idx_type dist = (stride == 1 ? npts : 1); | |
422 | |
423 F77_FUNC (zffti, ZFFTI) (npts, pwsave); | |
424 | |
425 for (octave_idx_type k = 0; k < nloop; k++) | |
426 { | |
427 for (octave_idx_type j = 0; j < howmany; j++) | |
428 { | |
429 octave_quit (); | |
430 | |
431 for (octave_idx_type l = 0; l < npts; l++) | |
432 prow[l] = retval((l + k*npts)*stride + j*dist); | |
433 | |
434 F77_FUNC (zfftf, ZFFTF) (npts, prow, pwsave); | |
435 | |
436 for (octave_idx_type l = 0; l < npts; l++) | |
437 retval((l + k*npts)*stride + j*dist) = prow[l]; | |
438 } | |
439 } | |
440 | |
441 stride *= dv(i); | |
442 } | |
443 | |
444 return retval; | |
445 } | |
446 | |
447 ComplexNDArray | |
448 ComplexNDArray::ifourierNd (void) const | |
449 { | |
450 dim_vector dv = dims (); | |
451 int rank = dv.length (); | |
452 ComplexNDArray retval (*this); | |
453 octave_idx_type stride = 1; | |
454 | |
455 for (int i = 0; i < rank; i++) | |
456 { | |
457 octave_idx_type npts = dv(i); | |
458 octave_idx_type nn = 4*npts+15; | |
459 Array<Complex> wsave (dim_vector (nn, 1)); | |
460 Complex *pwsave = wsave.fortran_vec (); | |
461 Array<Complex> row (dim_vector (npts, 1)); | |
462 Complex *prow = row.fortran_vec (); | |
463 | |
464 octave_idx_type howmany = numel () / npts; | |
465 howmany = (stride == 1 ? howmany : | |
466 (howmany > stride ? stride : howmany)); | |
467 octave_idx_type nloop = (stride == 1 ? 1 : numel () / npts / stride); | |
468 octave_idx_type dist = (stride == 1 ? npts : 1); | |
469 | |
470 F77_FUNC (zffti, ZFFTI) (npts, pwsave); | |
471 | |
472 for (octave_idx_type k = 0; k < nloop; k++) | |
473 { | |
474 for (octave_idx_type j = 0; j < howmany; j++) | |
475 { | |
476 octave_quit (); | |
477 | |
478 for (octave_idx_type l = 0; l < npts; l++) | |
479 prow[l] = retval((l + k*npts)*stride + j*dist); | |
480 | |
481 F77_FUNC (zfftb, ZFFTB) (npts, prow, pwsave); | |
482 | |
483 for (octave_idx_type l = 0; l < npts; l++) | |
484 retval((l + k*npts)*stride + j*dist) = prow[l] / | |
485 static_cast<double> (npts); | |
486 } | |
487 } | |
488 | |
489 stride *= dv(i); | |
490 } | |
491 | |
492 return retval; | |
493 } | |
494 | |
495 #endif | |
496 | |
497 // unary operations | |
498 | |
499 boolNDArray | |
500 ComplexNDArray::operator ! (void) const | |
501 { | |
502 if (any_element_is_nan ()) | |
503 gripe_nan_to_logical_conversion (); | |
504 | |
505 return do_mx_unary_op<bool, Complex> (*this, mx_inline_not); | |
506 } | |
507 | |
508 // FIXME -- this is not quite the right thing. | |
509 | |
510 bool | |
511 ComplexNDArray::any_element_is_nan (void) const | |
512 { | |
513 return do_mx_check<Complex> (*this, mx_inline_any_nan); | |
514 } | |
515 | |
516 bool | |
517 ComplexNDArray::any_element_is_inf_or_nan (void) const | |
518 { | |
519 return ! do_mx_check<Complex> (*this, mx_inline_all_finite); | |
520 } | |
521 | |
522 // Return true if no elements have imaginary components. | |
523 | |
524 bool | |
525 ComplexNDArray::all_elements_are_real (void) const | |
526 { | |
527 return do_mx_check<Complex> (*this, mx_inline_all_real); | |
528 } | |
529 | |
530 // Return nonzero if any element of CM has a non-integer real or | |
531 // imaginary part. Also extract the largest and smallest (real or | |
532 // imaginary) values and return them in MAX_VAL and MIN_VAL. | |
533 | |
534 bool | |
535 ComplexNDArray::all_integers (double& max_val, double& min_val) const | |
536 { | |
537 octave_idx_type nel = nelem (); | |
538 | |
539 if (nel > 0) | |
540 { | |
541 Complex val = elem (0); | |
542 | |
543 double r_val = std::real (val); | |
544 double i_val = std::imag (val); | |
545 | |
546 max_val = r_val; | |
547 min_val = r_val; | |
548 | |
549 if (i_val > max_val) | |
550 max_val = i_val; | |
551 | |
552 if (i_val < max_val) | |
553 min_val = i_val; | |
554 } | |
555 else | |
556 return false; | |
557 | |
558 for (octave_idx_type i = 0; i < nel; i++) | |
559 { | |
560 Complex val = elem (i); | |
561 | |
562 double r_val = std::real (val); | |
563 double i_val = std::imag (val); | |
564 | |
565 if (r_val > max_val) | |
566 max_val = r_val; | |
567 | |
568 if (i_val > max_val) | |
569 max_val = i_val; | |
570 | |
571 if (r_val < min_val) | |
572 min_val = r_val; | |
573 | |
574 if (i_val < min_val) | |
575 min_val = i_val; | |
576 | |
577 if (D_NINT (r_val) != r_val || D_NINT (i_val) != i_val) | |
578 return false; | |
579 } | |
580 | |
581 return true; | |
582 } | |
583 | |
584 bool | |
585 ComplexNDArray::too_large_for_float (void) const | |
586 { | |
587 return test_any (xtoo_large_for_float); | |
588 } | |
589 | |
590 boolNDArray | |
591 ComplexNDArray::all (int dim) const | |
592 { | |
593 return do_mx_red_op<bool, Complex> (*this, dim, mx_inline_all); | |
594 } | |
595 | |
596 boolNDArray | |
597 ComplexNDArray::any (int dim) const | |
598 { | |
599 return do_mx_red_op<bool, Complex> (*this, dim, mx_inline_any); | |
600 } | |
601 | |
602 ComplexNDArray | |
603 ComplexNDArray::cumprod (int dim) const | |
604 { | |
605 return do_mx_cum_op<Complex, Complex> (*this, dim, mx_inline_cumprod); | |
606 } | |
607 | |
608 ComplexNDArray | |
609 ComplexNDArray::cumsum (int dim) const | |
610 { | |
611 return do_mx_cum_op<Complex, Complex> (*this, dim, mx_inline_cumsum); | |
612 } | |
613 | |
614 ComplexNDArray | |
615 ComplexNDArray::prod (int dim) const | |
616 { | |
617 return do_mx_red_op<Complex, Complex> (*this, dim, mx_inline_prod); | |
618 } | |
619 | |
620 ComplexNDArray | |
621 ComplexNDArray::sum (int dim) const | |
622 { | |
623 return do_mx_red_op<Complex, Complex> (*this, dim, mx_inline_sum); | |
624 } | |
625 | |
626 ComplexNDArray | |
627 ComplexNDArray::xsum (int dim) const | |
628 { | |
629 return do_mx_red_op<Complex, Complex> (*this, dim, mx_inline_xsum); | |
630 } | |
631 | |
632 ComplexNDArray | |
633 ComplexNDArray::sumsq (int dim) const | |
634 { | |
635 return do_mx_red_op<double, Complex> (*this, dim, mx_inline_sumsq); | |
636 } | |
637 | |
638 ComplexNDArray | |
639 ComplexNDArray::diff (octave_idx_type order, int dim) const | |
640 { | |
641 return do_mx_diff_op<Complex> (*this, dim, order, mx_inline_diff); | |
642 } | |
643 | |
644 ComplexNDArray | |
645 ComplexNDArray::concat (const ComplexNDArray& rb, const Array<octave_idx_type>& ra_idx) | |
646 { | |
647 if (rb.numel () > 0) | |
648 insert (rb, ra_idx); | |
649 return *this; | |
650 } | |
651 | |
652 ComplexNDArray | |
653 ComplexNDArray::concat (const NDArray& rb, const Array<octave_idx_type>& ra_idx) | |
654 { | |
655 ComplexNDArray tmp (rb); | |
656 if (rb.numel () > 0) | |
657 insert (tmp, ra_idx); | |
658 return *this; | |
659 } | |
660 | |
661 ComplexNDArray | |
662 concat (NDArray& ra, ComplexNDArray& rb, const Array<octave_idx_type>& ra_idx) | |
663 { | |
664 ComplexNDArray retval (ra); | |
665 if (rb.numel () > 0) | |
666 retval.insert (rb, ra_idx); | |
667 return retval; | |
668 } | |
669 | |
670 static const Complex Complex_NaN_result (octave_NaN, octave_NaN); | |
671 | |
672 ComplexNDArray | |
673 ComplexNDArray::max (int dim) const | |
674 { | |
675 return do_mx_minmax_op<Complex> (*this, dim, mx_inline_max); | |
676 } | |
677 | |
678 ComplexNDArray | |
679 ComplexNDArray::max (Array<octave_idx_type>& idx_arg, int dim) const | |
680 { | |
681 return do_mx_minmax_op<Complex> (*this, idx_arg, dim, mx_inline_max); | |
682 } | |
683 | |
684 ComplexNDArray | |
685 ComplexNDArray::min (int dim) const | |
686 { | |
687 return do_mx_minmax_op<Complex> (*this, dim, mx_inline_min); | |
688 } | |
689 | |
690 ComplexNDArray | |
691 ComplexNDArray::min (Array<octave_idx_type>& idx_arg, int dim) const | |
692 { | |
693 return do_mx_minmax_op<Complex> (*this, idx_arg, dim, mx_inline_min); | |
694 } | |
695 | |
696 ComplexNDArray | |
697 ComplexNDArray::cummax (int dim) const | |
698 { | |
699 return do_mx_cumminmax_op<Complex> (*this, dim, mx_inline_cummax); | |
700 } | |
701 | |
702 ComplexNDArray | |
703 ComplexNDArray::cummax (Array<octave_idx_type>& idx_arg, int dim) const | |
704 { | |
705 return do_mx_cumminmax_op<Complex> (*this, idx_arg, dim, mx_inline_cummax); | |
706 } | |
707 | |
708 ComplexNDArray | |
709 ComplexNDArray::cummin (int dim) const | |
710 { | |
711 return do_mx_cumminmax_op<Complex> (*this, dim, mx_inline_cummin); | |
712 } | |
713 | |
714 ComplexNDArray | |
715 ComplexNDArray::cummin (Array<octave_idx_type>& idx_arg, int dim) const | |
716 { | |
717 return do_mx_cumminmax_op<Complex> (*this, idx_arg, dim, mx_inline_cummin); | |
718 } | |
719 | |
720 NDArray | |
721 ComplexNDArray::abs (void) const | |
722 { | |
723 return do_mx_unary_map<double, Complex, std::abs> (*this); | |
724 } | |
725 | |
726 boolNDArray | |
727 ComplexNDArray::isnan (void) const | |
728 { | |
729 return do_mx_unary_map<bool, Complex, xisnan> (*this); | |
730 } | |
731 | |
732 boolNDArray | |
733 ComplexNDArray::isinf (void) const | |
734 { | |
735 return do_mx_unary_map<bool, Complex, xisinf> (*this); | |
736 } | |
737 | |
738 boolNDArray | |
739 ComplexNDArray::isfinite (void) const | |
740 { | |
741 return do_mx_unary_map<bool, Complex, xfinite> (*this); | |
742 } | |
743 | |
744 ComplexNDArray | |
745 conj (const ComplexNDArray& a) | |
746 { | |
747 return do_mx_unary_map<Complex, Complex, std::conj<double> > (a); | |
748 } | |
749 | |
750 ComplexNDArray& | |
751 ComplexNDArray::insert (const NDArray& a, octave_idx_type r, octave_idx_type c) | |
752 { | |
753 dim_vector a_dv = a.dims (); | |
754 | |
755 int n = a_dv.length (); | |
756 | |
757 if (n == dimensions.length ()) | |
758 { | |
759 Array<octave_idx_type> a_ra_idx (dim_vector (a_dv.length (), 1), 0); | |
760 | |
761 a_ra_idx.elem (0) = r; | |
762 a_ra_idx.elem (1) = c; | |
763 | |
764 for (int i = 0; i < n; i++) | |
765 { | |
766 if (a_ra_idx (i) < 0 || (a_ra_idx (i) + a_dv (i)) > dimensions (i)) | |
767 { | |
768 (*current_liboctave_error_handler) | |
769 ("Array<T>::insert: range error for insert"); | |
770 return *this; | |
771 } | |
772 } | |
773 | |
774 a_ra_idx.elem (0) = 0; | |
775 a_ra_idx.elem (1) = 0; | |
776 | |
777 octave_idx_type n_elt = a.numel (); | |
778 | |
779 // IS make_unique () NECCESSARY HERE?? | |
780 | |
781 for (octave_idx_type i = 0; i < n_elt; i++) | |
782 { | |
783 Array<octave_idx_type> ra_idx = a_ra_idx; | |
784 | |
785 ra_idx.elem (0) = a_ra_idx (0) + r; | |
786 ra_idx.elem (1) = a_ra_idx (1) + c; | |
787 | |
788 elem (ra_idx) = a.elem (a_ra_idx); | |
789 | |
790 increment_index (a_ra_idx, a_dv); | |
791 } | |
792 } | |
793 else | |
794 (*current_liboctave_error_handler) | |
795 ("Array<T>::insert: invalid indexing operation"); | |
796 | |
797 return *this; | |
798 } | |
799 | |
800 ComplexNDArray& | |
801 ComplexNDArray::insert (const ComplexNDArray& a, octave_idx_type r, octave_idx_type c) | |
802 { | |
803 Array<Complex>::insert (a, r, c); | |
804 return *this; | |
805 } | |
806 | |
807 ComplexNDArray& | |
808 ComplexNDArray::insert (const ComplexNDArray& a, const Array<octave_idx_type>& ra_idx) | |
809 { | |
810 Array<Complex>::insert (a, ra_idx); | |
811 return *this; | |
812 } | |
813 | |
814 ComplexMatrix | |
815 ComplexNDArray::matrix_value (void) const | |
816 { | |
817 ComplexMatrix retval; | |
818 | |
819 if (ndims () == 2) | |
820 retval = ComplexMatrix (Array<Complex> (*this)); | |
821 else | |
822 (*current_liboctave_error_handler) | |
823 ("invalid conversion of ComplexNDArray to ComplexMatrix"); | |
824 | |
825 return retval; | |
826 } | |
827 | |
828 void | |
829 ComplexNDArray::increment_index (Array<octave_idx_type>& ra_idx, | |
830 const dim_vector& dimensions, | |
831 int start_dimension) | |
832 { | |
833 ::increment_index (ra_idx, dimensions, start_dimension); | |
834 } | |
835 | |
836 octave_idx_type | |
837 ComplexNDArray::compute_index (Array<octave_idx_type>& ra_idx, | |
838 const dim_vector& dimensions) | |
839 { | |
840 return ::compute_index (ra_idx, dimensions); | |
841 } | |
842 | |
843 ComplexNDArray | |
844 ComplexNDArray::diag (octave_idx_type k) const | |
845 { | |
846 return MArray<Complex>::diag (k); | |
847 } | |
848 | |
849 ComplexNDArray | |
850 ComplexNDArray::diag (octave_idx_type m, octave_idx_type n) const | |
851 { | |
852 return MArray<Complex>::diag (m, n); | |
853 } | |
854 | |
855 // This contains no information on the array structure !!! | |
856 std::ostream& | |
857 operator << (std::ostream& os, const ComplexNDArray& a) | |
858 { | |
859 octave_idx_type nel = a.nelem (); | |
860 | |
861 for (octave_idx_type i = 0; i < nel; i++) | |
862 { | |
863 os << " "; | |
864 octave_write_complex (os, a.elem (i)); | |
865 os << "\n"; | |
866 } | |
867 return os; | |
868 } | |
869 | |
870 std::istream& | |
871 operator >> (std::istream& is, ComplexNDArray& a) | |
872 { | |
873 octave_idx_type nel = a.nelem (); | |
874 | |
875 if (nel > 0) | |
876 { | |
877 Complex tmp; | |
878 for (octave_idx_type i = 0; i < nel; i++) | |
879 { | |
880 tmp = octave_read_value<Complex> (is); | |
881 if (is) | |
882 a.elem (i) = tmp; | |
883 else | |
884 goto done; | |
885 } | |
886 } | |
887 | |
888 done: | |
889 | |
890 return is; | |
891 } | |
892 | |
893 MINMAX_FCNS (ComplexNDArray, Complex) | |
894 | |
895 NDS_CMP_OPS (ComplexNDArray, Complex) | |
896 NDS_BOOL_OPS (ComplexNDArray, Complex) | |
897 | |
898 SND_CMP_OPS (Complex, ComplexNDArray) | |
899 SND_BOOL_OPS (Complex, ComplexNDArray) | |
900 | |
901 NDND_CMP_OPS (ComplexNDArray, ComplexNDArray) | |
902 NDND_BOOL_OPS (ComplexNDArray, ComplexNDArray) | |
903 | |
904 ComplexNDArray& operator *= (ComplexNDArray& a, double s) | |
905 { | |
906 if (a.is_shared ()) | |
907 a = a * s; | |
908 else | |
909 do_ms_inplace_op<Complex, double> (a, s, mx_inline_mul2); | |
910 return a; | |
911 } | |
912 | |
913 ComplexNDArray& operator /= (ComplexNDArray& a, double s) | |
914 { | |
915 if (a.is_shared ()) | |
916 return a = a / s; | |
917 else | |
918 do_ms_inplace_op<Complex, double> (a, s, mx_inline_div2); | |
919 return a; | |
920 } | |
921 | |
922 BSXFUN_STDOP_DEFS_MXLOOP (ComplexNDArray) | |
923 BSXFUN_STDREL_DEFS_MXLOOP (ComplexNDArray) | |
924 | |
925 BSXFUN_OP_DEF_MXLOOP (pow, ComplexNDArray, mx_inline_pow) |