diff --git a/ChangeLog b/ChangeLog index 426b4a3a..8c7c5f20 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,15 @@ +2015-04-01 Martin Maechler + + * inst/NEWS.Rd: Moving ChangeLog to new (markup) NEWS file + +2015-03-16 Martin Maechler + + * R/Auxiliaries.R (anyDuplicatedT): renamed from is_duplicatedT(), + and exported. uniqTsparse(): exported too. + 2014-06-15 Martin Maechler - * DESCRIPTION (Version): 1.1-4, released to CRAN + * DESCRIPTION (Version): 1.1-4, released to CRAN on 2014-06-14 * src/dsyMatrix.c (dsyMatrix_matrix_mm): fix crossprod(, ) bug 2014-04-26 Martin Maechler @@ -9,7 +18,7 @@ 2014-03-30 Martin Maechler - * DESCRIPTION (Version): 1.1-3, released to CRAN + * DESCRIPTION (Version): 1.1-3, released to CRAN on 2014-03-30 2014-03-12 Martin Maechler @@ -24,7 +33,7 @@ 2014-01-20 Martin Maechler - * DESCRIPTION (Version): 1.1-2 + * DESCRIPTION (Version): 1.1-2, released to CRAN on 2014-01-28 * NAMESPACE: export fast power-user coercion utilities .dsy2mat(), .dxC2mat(), .T2Cmat(), ..2dge(). diff --git a/DESCRIPTION b/DESCRIPTION index 8868abb6..4072dac6 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,13 +1,13 @@ Package: Matrix -Version: 1.1-5-1 -Date: 2015-03-23 +Version: 1.2-0 +Date: 2015-04-03 Priority: recommended Title: Sparse and Dense Matrix Classes and Methods Author: Douglas Bates and Martin Maechler Maintainer: Martin Maechler Contact: Doug and Martin Description: Classes and methods for dense and sparse matrices and - operations on them using LAPACK and SuiteSparse. + operations on them using 'LAPACK' and 'SuiteSparse'. Depends: R (>= 2.15.2), methods Imports: graphics, grid, stats, utils, lattice Suggests: expm, MASS @@ -24,6 +24,6 @@ LicenseNote: The Matrix package includes libraries AMD, CHOLMOD, LGPL licenses. See the directory doc/UFsparse for details. URL: http://Matrix.R-forge.R-project.org/ NeedsCompilation: yes -Packaged: 2015-03-23 15:44:22 UTC; maechler +Packaged: 2015-04-03 21:19:32 UTC; maechler Repository: CRAN -Date/Publication: 2015-03-23 22:33:36 +Date/Publication: 2015-04-04 16:16:00 diff --git a/MD5 b/MD5 index ff6ca358..ba6097d0 100644 --- a/MD5 +++ b/MD5 @@ -1,102 +1,103 @@ -31e34fb53c46f90150bb91ca6629505e *ChangeLog -4bab61f198c1b3b77730fc5dee7eb6ee *DESCRIPTION -49ca5e9b3f27643f0deac2fe45b778f0 *NAMESPACE -d28b31d446957037ae54f0868d4475fd *R/AllClass.R -e67ec26bf0b8c8937fb085b29783c913 *R/AllGeneric.R -1ab40cb4fdc614e3a876fa90a7090d9f *R/Auxiliaries.R +da73464d7288eb24c3a6025ba80be8c0 *ChangeLog +05f1e506c22f454d584c0893ac77e112 *DESCRIPTION +897d1a5bb77334003f4023698fe18efa *NAMESPACE +0b8128ba2ab893ea7026a6e58f9903f8 *R/AllClass.R +fe666a11e0038a306beac07fcf44b564 *R/AllGeneric.R +87a1066fb9b97e4fa8d352f3ec838d24 *R/Auxiliaries.R 7025e2165b918d54fc398d70f41035c2 *R/CHMfactor.R -4bca092d12c2d8a26d4bb0564e8f876a *R/Csparse.R -c900a4080317d3a6b766324be4e64189 *R/HBMM.R +e9fa6881a118de418d5c95acc757a552 *R/Csparse.R +75db2aef5533eb1cff06e859feccc81c *R/HBMM.R 3f37d43942f54523314df6f5406cf488 *R/Hilbert.R 3eacab76e65bc0493686a2dab2646e78 *R/KhatriRao.R 7cd5d5938844fa73c1a2b50fae7fdd19 *R/LU.R -5c600a54ea21fff9ecf1051ed4df9b76 *R/Math.R -a4f168cb97a801ff63f6f9a9197115fd *R/Matrix.R +e4ddcb0e220b4fdea6bb3fba4b1de186 *R/Math.R +cf4daf86ccaa75848207aaa975471cb7 *R/Matrix.R e19ed36934229e22f41552d4d40c5d5a *R/MatrixFactorization.R -43400d40298f3a1f7043a6eb05498dc7 *R/Ops.R +da6cf0255d81262449f16ee9afbbb2e0 *R/Ops.R 5f24daa36457fcc57724cd57adebfca6 *R/Rsparse.R 6433ca318f74c40760e68b1d56466d09 *R/SparseM-conv.R -9762a3475e2586904d25f3fdc29055f5 *R/Summary.R -68b6185aede9b53929b190695040cc75 *R/Tsparse.R -9cf8de63fa0b6f64df31cd32d89eb12a *R/abIndex.R +f93c44d434972ce1986679a3629bfead *R/Summary.R +6091bd34e9fe730d0cc1cc2aad662116 *R/Tsparse.R +c5765178e060c89033cfcbc64a5f78c3 *R/abIndex.R 4b467ca6296fe89da23404d61644cd2d *R/bandSparse.R -9df38d1b4f2dff615379b62e72220564 *R/bind2.R +b634f4365707e0b39cc5ee632aa109c5 *R/bind2.R 504923d5ff7c137b8589bb23fd4e38d0 *R/colSums.R 73f70ce30c4eb94c71d69d824173f8e3 *R/condest.R 9107b79ca2f8d9d0692f2a11614def29 *R/corMatrix.R -6bc7c69bbbe009cf1cfe913b73a1099b *R/dMatrix.R -d8670f16b29f6d037f6fcd31952316a9 *R/ddenseMatrix.R -550a089c986922cb98123f8e95dc36a5 *R/denseMatrix.R -6c56e42b3a74ab7f2ad6c4f66c6ccd81 *R/dgCMatrix.R +30d3814cd0c8e0bb65e32a8afcf266e7 *R/dMatrix.R +8f877c1d8d4f15b6e226505bf3922fce *R/ddenseMatrix.R +f8841dafd5b040ae3e0a6d2b92dd1c77 *R/denseMatrix.R +a56ee8b041670e6f38b7d45db7f2118b *R/dgCMatrix.R 1fc4711d16cafbba316edf09edace251 *R/dgTMatrix.R -98c56a9e6bccf923695b2a72c1f72321 *R/dgeMatrix.R -910e7891ba45f9694d7a6862363b2c25 *R/diagMatrix.R +e8817c23a954a0304b495710fd36b721 *R/dgeMatrix.R +08f4e43691607ff3a0b264f7387e4adc *R/diagMatrix.R be76b734bbed865c5a76f90ecd874448 *R/dpoMatrix.R 239dd04632141e119924f4b3a15e2188 *R/dppMatrix.R -90547d24e15ddb234093b1c4254f6e05 *R/dsCMatrix.R -3ee77774e2a81752173065ef0f4100db *R/dsTMatrix.R +7bcf56ce74f237df35bc521a887fe938 *R/dsCMatrix.R +09de435f59f2647d1df19343018f2944 *R/dsTMatrix.R 70aebf5f54f8e7aef29a93be664efaad *R/dspMatrix.R 030bf1a324d474d915ad44d4092d5b37 *R/dsparseMatrix.R -0d061518ccd33be9bdd9694881b53f39 *R/dsyMatrix.R +7e27821ad3ae1f73bdbbd92ee5febae3 *R/dsyMatrix.R 98a8cbf502792ff5b19aefce4de9bfaa *R/dtCMatrix.R e826da941555bb348d828af69c77b7dc *R/dtTMatrix.R 41b48ca51c434b9bce81df1c595e6abf *R/dtpMatrix.R -b7d49cdccd1bd70e2688c636dac83c7d *R/dtrMatrix.R +e95c40000221b4bd46682e4b98a2439f *R/dtrMatrix.R 952b2122422438fe96f3e8f08056b99a *R/eigen.R 333accc94fd2c5ba991ce2473e4cd510 *R/expm.R -b803b46feaca3381d6dd7f72df561ba0 *R/indMatrix.R +da65fe65710e06d5406a92e49489c857 *R/indMatrix.R 233e9458cb509610a5d8efde8cc0e4ce *R/kronecker.R -957e6bb144a6a3c95555a67a16398c6c *R/lMatrix.R -7f773895c4771db3b7f1fcbcd95279d6 *R/ldenseMatrix.R +8c278a61b96a72ee143a550e283af8a6 *R/lMatrix.R +968f4169a8cd904f8c679cbc51c82ac0 *R/ldenseMatrix.R b20a87bf779fb61474a2dc3e39db7893 *R/lgCMatrix.R -a1f935c148f57cc70de54b75b7b72c50 *R/lgTMatrix.R +6ee5d8250439cac40030ec3a6b5f2b72 *R/lgTMatrix.R 32f129fb9fec2b6de53b2e4d6bbab656 *R/lsCMatrix.R -90c6e2853bc49fa96e28459a62c1bdda *R/lsTMatrix.R -721b78ef9d2bf39c4bc10e0fb9824a8b *R/lsparseMatrix.R +599da5bf12a53c62027b1a71dddc3a56 *R/lsTMatrix.R +87d55d4730f37c32d6f8ec66d2203b47 *R/lsparseMatrix.R ba75b509b85c63732e38f2521e9766a1 *R/ltCMatrix.R 47012791a775a04b711b374e846d4637 *R/ltTMatrix.R -3b90404770aca153eb4310f70b37229d *R/ndenseMatrix.R +d27a2b24faf3828b383b0cd321a7d9dd *R/ndenseMatrix.R 349409010ac0683a7672aaab6940b7f6 *R/nearPD.R -f15e6f79552eb6b8b2463d48cbcf5742 *R/ngCMatrix.R -5fa5b1497fc4c2778aebb13cf22a451a *R/ngTMatrix.R -447791d9550f1dbb927ddba156432802 *R/nnzero.R -ee9bbd4354af83445abc2b3c95f89218 *R/not.R -9ddae86af4641147e6a876e9e29f5f69 *R/nsCMatrix.R -115451edb7df8f2752483b879103360b *R/nsTMatrix.R -e484c5c8e4ef99d3b9835a28cd327abf *R/nsparseMatrix.R -c90a8c1c8f6328c3d257ce73ee8622dd *R/ntCMatrix.R +0e2392a9363bade395c7bded4e1b78a5 *R/ngCMatrix.R +fcb45493f9bf912c437e6bd8469d4628 *R/ngTMatrix.R +d5e42272817bc3082d5860d296abba02 *R/nnzero.R +a7d4c2f2e58bf7b10dda13211a67190a *R/not.R +4264a9bacf136df9609ac07a9aa269b2 *R/nsCMatrix.R +1d83aff8b65c3776a8bcbfddff2e8109 *R/nsTMatrix.R +71338b9aab7597cc0fbef88031ce9968 *R/nsparseMatrix.R +e9884d53a29d2fe1fee43846826c7755 *R/ntCMatrix.R f12c8b3ac756a91e8c0dfdf270a38b98 *R/ntTMatrix.R -b8166a9d06aab03a53432358a59ad9e5 *R/pMatrix.R -84ecff7660af235b11dc0d7b26ffc2cd *R/products.R -011ff226817062c7d05be602b2043b0c *R/rankMatrix.R -8dc90941d51a42e4270cd2ae717f3cb5 *R/spModels.R -828c96813c20837d65da931bea0884a1 *R/sparseMatrix.R -9091e186403012bf94f7db9c01157ad6 *R/sparseQR.R -78bb698752724104240f338dcac36330 *R/sparseVector.R -d2cc65f75f1966504c8b0fba9eb6df68 *R/symmetricMatrix.R +0514b0a4895312a1820692af6df7f8ed *R/pMatrix.R +77c06c1c8bb3ffa70f74641356fe24a2 *R/products.R +b1e6e02f30221d3b7d1ac4f975bc0401 *R/rankMatrix.R +e9d6bb7530a4c8ac0fee1a31b3d61ff4 *R/spModels.R +5bef68dad9e75fdc76c6847bdb928ed8 *R/sparseMatrix.R +811e5da9f3152977caf7a942e136b199 *R/sparseQR.R +791d644a169efcd506c14e3a62056837 *R/sparseVector.R +97e508e9e124aac0fb3dc3d046de347f *R/symmetricMatrix.R a3265f0761ef916f610e9849c6677600 *R/triangularMatrix.R -6a912c2869bc6466a2f4324d9150e131 *R/zzz.R -a034a86f5e659776be405d214fa8ab65 *TODO +527c0d545dba53c478f5ddfd006f3e48 *R/zzz.R +0b04266bb752124464f896935425b168 *TODO 690042981f48345946424e3d51bdf987 *build/vignette.rds f2ad5375e270deeb7b041272dd095032 *cleanup d3528bc0cd82f248821809f253bffe35 *data/CAex.R 7586556183d8d0a3c7979702254f93c1 *data/KNex.R 10b959df8869ec28b992f2ff6dad2991 *data/USCounties.R 8734f0b040c6292983d273d4251d250a *inst/Copyrights -cd003f462d78d4471ff1e295f79f7b9a *inst/Doxyfile +3dd4fe9e88726c051985891483708da5 *inst/Doxyfile +bbb2922492b5727e13a2d7f2ef7fed03 *inst/NEWS.Rd ea747a35318c564002a7144ebd510e28 *inst/doc/Announce.txt 0eeea40a3fb6da7157d2862bba10713a *inst/doc/Comparisons.R 09e13507b9832a30aa92e8aff0dc96a0 *inst/doc/Comparisons.Rnw -9b8246a1434f1580eea6c7703be1dbb0 *inst/doc/Comparisons.pdf +99551cef21aeabb476adb9b05dbb743c *inst/doc/Comparisons.pdf 3fb9bf234f272d784fde95ee66b75f71 *inst/doc/Design-issues.R 7bf6c80a144d27b6baece257c69bd800 *inst/doc/Design-issues.Rnw -93282e315c2f1d072c1e9a73df9ae64d *inst/doc/Design-issues.pdf +6fcf441e486c1526151fc80089be2290 *inst/doc/Design-issues.pdf 6f66bd95aab28d7bf06a019e7fbc14b5 *inst/doc/Intro2Matrix.R a6d6903590a8f5ac036fdeb74b48bb89 *inst/doc/Intro2Matrix.Rnw -8601cb19a70eeb33c384140596b45570 *inst/doc/Intro2Matrix.pdf +36ef6c68f8bd8b904a2eb613f540c5c2 *inst/doc/Intro2Matrix.pdf 188b839523ce6ec32e1f00ec4e2bc18e *inst/doc/Introduction.R c39a26dfe7ccaafd044e88468155b153 *inst/doc/Introduction.Rnw -162d70aa32cfeb8294841c45f6c0d1b0 *inst/doc/Introduction.pdf +103e98810e3e930682821cdf63e26417 *inst/doc/Introduction.pdf 7d60c8defc517d361513bac03d04f13b *inst/doc/SuiteSparse/AMD.txt e4f8cd28fc8be8ab14106630610b9c5f *inst/doc/SuiteSparse/CHOLMOD.txt 0a80fb0db9cefb02e290ffd2f3431e6c *inst/doc/SuiteSparse/COLAMD.txt @@ -105,7 +106,7 @@ d75882d4bb768ba0ea352291652daaee *inst/doc/SuiteSparse/SPQR.txt 6d217288f5da4fe419afaa34988bf42d *inst/doc/SuiteSparse/UserGuides.txt 2ab394c4daa5c94c2498ba3fa0578462 *inst/doc/sparseModels.R 491d961ca64f8da569c817b82daa9c58 *inst/doc/sparseModels.Rnw -3a6295a44a0b6022188cf5157d597888 *inst/doc/sparseModels.pdf +852d82d707b09d1ed38110e2587ea46b *inst/doc/sparseModels.pdf dcd11f6947f910f743254824e930b2c7 *inst/external/CAex_slots.rda be886d6bb832210bb654b9ad064fe0ff *inst/external/KNex_slots.rda 90f019ec81e67d7f3542f7ca39bf3f2d *inst/external/USCounties_slots.rda @@ -117,32 +118,33 @@ a5748e10322306f8c2114db09cd58dd8 *inst/external/pores_1.mtx 7e22a368a5d129fc7396432949fb72ab *inst/external/test3comp.rda 697db4242eb44425ce2550fafdc957a8 *inst/external/utm300.rua 5ce5ea63a73e4641173fe37b6a809a01 *inst/external/wrong.mtx -9cb0640700c7646c66768ed8f32c6510 *inst/include/Matrix.h -368e713b6834e292205ee3225b6ce71c *inst/include/Matrix_stubs.c +c27bb4e4b72e482db87123e3db7443ea *inst/include/Matrix.h +633a571d741b1ef1b279ea9d1c7977d4 *inst/include/Matrix_stubs.c 49f74dc92dea52b4f888837ca26452fc *inst/include/cholmod.h -b5f0baf6451cce9dc6dd163bd491ffb8 *inst/po/de/LC_MESSAGES/Matrix.mo -b7235666f9d115ff7b3e568a96e1fae2 *inst/po/de/LC_MESSAGES/R-Matrix.mo -fb2655a0285ba7957b3351c5a451cb03 *inst/po/en@quot/LC_MESSAGES/Matrix.mo -8399605f56fb476dabab9709af84dd58 *inst/po/en@quot/LC_MESSAGES/R-Matrix.mo -df1af7b814db8c0099e0f3289b7aa296 *inst/po/fr/LC_MESSAGES/Matrix.mo -e459224ab12c5d4d3f69b6530b11201d *inst/po/fr/LC_MESSAGES/R-Matrix.mo -995039b39827b577ec644adb765a5739 *inst/po/pl/LC_MESSAGES/Matrix.mo -835de6dd95a039d6443b8cfcfa9d8c70 *inst/po/pl/LC_MESSAGES/R-Matrix.mo -a5acfaf4b660bf665b35d6d2c43f1067 *inst/test-tools-1.R -3f9160636090282b9ac3127a8baafdf5 *inst/test-tools-Matrix.R +0f7c6d7cf197daa8f73f69bd0ca6ee1a *inst/po/de/LC_MESSAGES/Matrix.mo +f816a8752cd136e17e2fb199c8c04c66 *inst/po/de/LC_MESSAGES/R-Matrix.mo +ab66224c99642fa82ad48f746a267786 *inst/po/en@quot/LC_MESSAGES/Matrix.mo +e29560cbc8351b7181c7fe1a80d83b91 *inst/po/en@quot/LC_MESSAGES/R-Matrix.mo +c9c7c02cbf213f49180f78de275fe37d *inst/po/fr/LC_MESSAGES/Matrix.mo +293088d46d5e32367f9f1b198518eb02 *inst/po/fr/LC_MESSAGES/R-Matrix.mo +061ec0abe44879489735b61d3e6a6f5e *inst/po/ko/LC_MESSAGES/R-Matrix.mo +454df84d9c9e69fcb4af9ed964b468e3 *inst/po/pl/LC_MESSAGES/Matrix.mo +9f4d95056bbed3aaf9af13d58a2888c1 *inst/po/pl/LC_MESSAGES/R-Matrix.mo +e9a5ba19af1b2d8f7c20463c50ff1c3d *inst/test-tools-1.R +fe8ee2c8fa2d91876824376782da8aa6 *inst/test-tools-Matrix.R 384ad19fd9e35dfa867ff36dc6d502f4 *inst/test-tools.R 008b2c14ce99ff19c7c5fa9e8c8736b1 *man/BunchKaufman-methods.Rd -3f382d978f8947e4e17047f95d20ed84 *man/CAex.Rd +a84142e187e2a8d79be122f60b91395e *man/CAex.Rd 5b10b3332f494d1fc81c004541234d8b *man/CHMfactor-class.Rd f39cd7f9daaa240217e1d6ce0f810b47 *man/Cholesky-class.Rd -5d5811453fa47a25fef4ac4d973385e3 *man/Cholesky.Rd +26f33c25b3b814bb0fafa26c1c0f12e2 *man/Cholesky.Rd 4ef1b053e942af5a8a2289f4e252d323 *man/CsparseMatrix-class.Rd 808e4ca0630256acf52598f4a34d77d7 *man/Diagonal.Rd 74df4ccf77c8797a57520d36afe98a0f *man/Hilbert.Rd 2ad7cc5b8c267f23bf7012c5248f87a5 *man/KNex.Rd ff1568bd735efff9a9c2c463c35c7a4a *man/KhatriRao.Rd b79c16e807bb0dc031ddb41644d605f6 *man/LU-class.Rd -8824ddbb49e4f4739d00f5cedaf3345a *man/Matrix-class.Rd +c547ed8500590701b05d4f686244c0a8 *man/Matrix-class.Rd 0241d3d91abca6086cb03e1292cb4432 *man/Matrix.Rd 34116420a7c90c8df288f9eba5233966 *man/MatrixFactorization-class.Rd 12d75917210de453f9572de25be75995 *man/RsparseMatrix-class.Rd @@ -150,7 +152,7 @@ b79c16e807bb0dc031ddb41644d605f6 *man/LU-class.Rd d15bfb87449f86c5cb9b65e77de821bb *man/Schur.Rd 601a206196fb38ff2c3eb6a696aebeef *man/SparseM-conv.Rd b946bf426edf45858278e6eaacb14f4a *man/Subassign-methods.Rd -3a229d88e2e56d2d8061fe509536e12a *man/TsparseMatrix-class.Rd +93b66f4c5fe69d4122fc140510c684de *man/TsparseMatrix-class.Rd 61465055d850a039eac3853d4ad120b1 *man/USCounties.Rd 0502c8aba3321a819cd00dd1e553ab5d *man/Xtrct-methods.Rd 7abbeae6546c97bd4a59cabf15abe143 *man/abIndex-class.Rd @@ -161,7 +163,8 @@ f4f8612666bf98866b98f1630a89f5f0 *man/atomicVector-class.Rd 1b1d5cbf19514d832542121fafb8a48e *man/band.Rd 8c5d951ae5615c8f93e5894f7e6b0581 *man/bandSparse.Rd e01f3ae7320eea9a3d51fa6776b8daa5 *man/bdiag.Rd -a6cad9af0b78e935e26195af7a314190 *man/cBind.Rd +908ebebcda1ea09c3f061fbe869ab333 *man/boolean-matprod.Rd +0a56de0ee84b953cadc2a23b1ce500f5 *man/cBind.Rd 8c7312211f0224f12b21c3342de442c7 *man/chol.Rd 56c41276d74b7373b67fe98947b62834 *man/chol2inv-methods.Rd 2560a6f20527e8ea3a04c434a412002d *man/colSums.Rd @@ -173,17 +176,17 @@ fea7d6aa90395d29ab34ebe90603aec4 *man/ddiMatrix-class.Rd a45e58a48e996ba2ee632fb58122e6a9 *man/denseMatrix-class.Rd feec03c7616aabc27d3f7b5f0958e393 *man/dgCMatrix-class.Rd 33311e5379364ad7d6fa816ce187506d *man/dgRMatrix-class.Rd -bb72c1b1e9f6837dc354b3c6aea3e14d *man/dgTMatrix-class.Rd +041d945f08fb616237f7b522492cbe80 *man/dgTMatrix-class.Rd 2bbda14fe19c769958294b8006c83448 *man/dgeMatrix-class.Rd 7b339b007d683c02526d2ead6043bf31 *man/diagU2N.Rd fefec9a47e06e4010c48a0b9383c1900 *man/diagonalMatrix-class.Rd cab5f0fa9bd7b9c584d9025ace66e4e6 *man/dpoMatrix-class.Rd 852c331dbdd4220a2f26c8b238bda50d *man/drop0.Rd -0c14415ce7caa0d8b5b8c2c03d004fbd *man/dsCMatrix-class.Rd +d0f0bf296b8675b9540dd84b8c620a33 *man/dsCMatrix-class.Rd e6232ded0c7b441674776381b8e25efa *man/dsRMatrix-class.Rd 5a84601e5f8ed336d3cc947e6703d271 *man/dsparseMatrix-class.Rd 1f52e18e5bc70601f1c49abb4ca5658e *man/dsyMatrix-class.Rd -03ac1de72f472220f4c8073113c0f1e8 *man/dtCMatrix-class.Rd +ac3f72f537dbfa72345d274fcde51e48 *man/dtCMatrix-class.Rd 9e88fe051b42ffdfc4fdc08361372a21 *man/dtRMatrix-class-def.Rd 3f894c8473e90abe89ca43c9d8cbe465 *man/dtpMatrix-class.Rd 22a99ac7381f2b826f73c3c76114bc1e *man/dtrMatrix-class.Rd @@ -194,43 +197,43 @@ dd7dc20ed8afa4c6a0dd752270ff2617 *man/facmul.Rd 12fee6d998e1b954161ce53043fae6e2 *man/forceSymmetric.Rd 829bc7814aa9d26fd79c0f6c7a04aaa0 *man/formatSparseM.Rd 10534177267141a74ee6f1403862bf3c *man/generalMatrix-class.Rd -0bbdeba42ac962a61cdb9610897c3e6f *man/graph2T.Rd +190b4cdd24d18fdeb27897e58235f348 *man/graph2T.Rd a766a9c8090bd54484c4a0a7f5dacb1c *man/image-methods.Rd -d1ce3b266f6ba8d040f4e2400186317d *man/indMatrix-class.Rd +71aded4a993f63269673d661bdeb700d *man/indMatrix-class.Rd 828999cf8aaac364bf35e98b84993b62 *man/index-class.Rd 1bc58269199564d45feef99cf46ca01f *man/invPerm.Rd eeed15170e23c5a284c59332a97f76cc *man/is.na-methods.Rd 46efc2ba7204f7391229a157e0853997 *man/is.null.DN.Rd 70cb42ba2fbfebc7e94b82138da9a3f3 *man/isSymmetric-methods.Rd -636cb025dee991948d8425bf5e3aa88b *man/isTriangular.Rd +578954786e644291a3912ad9d75b024b *man/isTriangular.Rd f85d12e1198821c5b5d2dc7301764e55 *man/kronecker-methods.Rd f999665adfd73c5130dee09921eca36a *man/ldenseMatrix-class.Rd bec8838d4bd72f6a27d62383edc953b5 *man/ldiMatrix-class.Rd 52ce6bf3ac3dcc8fb8618608c4701498 *man/lgeMatrix-class.Rd -7a21658e580247b8c3f5f8b4ca1eaad8 *man/lsparseMatrix-classes.Rd +82753566da45377b13acea93c5c9a878 *man/lsparseMatrix-classes.Rd f1e1cfefe3650a6c19b1c63b7d6052dc *man/lsyMatrix-class.Rd fc78ae1f310100dc8dbe8cff430a2093 *man/ltrMatrix-class.Rd 9a889abad6ddae7c62ca17e920c1391c *man/lu.Rd -d9fccdb73a6bca50aac55b9d984195cf *man/matrix-products.Rd -0b78b90513390c5816114d3058f0777c *man/nMatrix-class.Rd -886584fb276685d58c0558202e0a5bbc *man/ndenseMatrix-class.Rd +803c6ecc111f2909ea0ce218750318c6 *man/matrix-products.Rd +4a449d40a733322c55cf7146d8ddb43e *man/nMatrix-class.Rd +43e4a742f0d3668b5c3ef36d5ccda4ad *man/ndenseMatrix-class.Rd 46dc1c9089fefb669bf1b8137edd2d12 *man/nearPD.Rd 84f3a5d496768cfe6f139e3fab1ef042 *man/ngeMatrix-class.Rd b0eb88e96c037d58bdee94dbc2a92d6b *man/nnzero.Rd baf1f784c556584df45b0b3ff7152b18 *man/norm.Rd -3a14b23ea37d2d9e9ad6e8b62ead68fb *man/nsparseMatrix-classes.Rd +0cd0233e14e38cf16e2a871351b2f09c *man/nsparseMatrix-classes.Rd b299d889bba52b4d4e558b7d121eb97a *man/nsyMatrix-class.Rd 11890bb8c3bdd03d0d0ca39ab95a6c08 *man/ntrMatrix-class.Rd b44976fc24c22cc0d7d0bf722a951a3b *man/number-class.Rd 358232f60f227a3908652716415f6b5c *man/pMatrix-class.Rd 6e9825c54dc87baf423237b3ff934f5b *man/printSpMatrix.Rd f61b7ca27c49d694c6b4b7b1e71d753b *man/qr-methods.Rd -89d4ef7a94e5eec8c8ae7a3e23218e99 *man/rankMatrix.Rd +7b74d710e87a0d2a9bf5c56cc2a5538f *man/rankMatrix.Rd e6a10cf788588d6a28eb8b8ed328a790 *man/rcond.Rd eaa76f30797997d7d49d45c2f9c55c4f *man/rep2abI.Rd b6fedde6a4c71d315554de6eb2eba367 *man/replValue-class.Rd 12d2c9caa3c91beecd1f6c60903478f6 *man/rleDiff-class.Rd -110d2e592b5c2cea7aeed0ef69f02665 *man/rsparsematrix.Rd +5e85265a461822bd32acf5d56a3a2861 *man/rsparsematrix.Rd 0cc917f4625559f00b18b296608abe7a *man/solve-methods.Rd a1bf541febf7b913a88fea7dd9c597bf *man/spMatrix.Rd 47b173d7c7515d8616daab061f58df12 *man/sparse.model.matrix.Rd @@ -240,23 +243,25 @@ f5ebe1e0fff8a192a4130b16dfbdd6ee *man/sparseLU-class.Rd df61fe96a74790c4fdde5e7997db2dbf *man/sparseQR-class.Rd 5d18f5528e6f5bf15cc1dc896b021890 *man/sparseVector-class.Rd e7bf1f347f18c79f54acb50f237c9ee0 *man/sparseVector.Rd -401173e5302fdc743b1a4478e80a1121 *man/symmetricMatrix-class.Rd +69f2f153e0466c6fe53a6239d4cd63d2 *man/symmetricMatrix-class.Rd 749ddc8f3da2e72556ea5a3b605e570e *man/symmpart.Rd -2b9535d8ff19b59d927159ba5050a7f2 *man/triangularMatrix-class.Rd +7c865bb2197d10d31e7262b4ecac067f *man/triangularMatrix-class.Rd +13f057a0328f191c96d5028672d8debc *man/uniqTsparse.Rd c85d81fef271d0f630bea4ad1ddf67d8 *man/unpack.Rd 95a864f6e2b3c41d1aefd0c6686f278a *man/unused-classes.Rd 0ef56496d0eca5c262145a3bc0760242 *man/updown.Rd -751f37e631d3c7135e3abb2515dd07a9 *po/Matrix.pot -2b16b1770005836f23fc8b9fafa45093 *po/R-Matrix.pot -63687b239ffe55beb88bd09d71469121 *po/R-de.po +689c0ba1e7dd59b29e8bb6787aa38e89 *po/Matrix.pot +b39a219891bbc8f24eac7f44cff120af *po/R-Matrix.pot +360652219cbab89c51c35eb20ed02c9d *po/R-de.po 0fcc87da49f23ddccefa2a887aa68c8a *po/R-en@quot.po -0f57d592b7ea3743d42b983d7ba653d9 *po/R-fr.po -17be3af0be414c5b726fd28f609083e5 *po/R-pl.po -718c0c910d048120df131db2ea4d5aad *po/de.po +3dd6aaf2a0f44e2b3b2b260232624686 *po/R-fr.po +7314fe57def733c623aa2e964021d181 *po/R-ko.po +30fb18b101d6c68b9bfa0dfabf4e0094 *po/R-pl.po +2e1a4ed6e6324a114a8d68b9d87606dc *po/de.po 57680b9c8d9a9e8cd4fe5329ce92d7fe *po/en@quot.po -082490f216d63ffddbebf37156735288 *po/fr.po -f6d62ce76196530358556d1c38932f76 *po/pl.po -ea252f1e070012e8bd7a01ce0329cf92 *po/update-me.sh +832e1c490a51ce09524a902d97b618a5 *po/fr.po +22efd5d47e96a5f9e442402ff6e5efbd *po/pl.po +e342dfbb9df8cbd3cc3c8c9ff3657384 *po/update-me.sh 752c6c39d6c94efc9d6ab8059c1b7335 *src/AMD/Include/amd.h 8a4f23f111c15e93421f06cc660db9ea *src/AMD/Include/amd_internal.h 44b5e7133f7f818d07d17637c8410c51 *src/AMD/Makefile @@ -276,7 +281,7 @@ d696467688131d58e3acf9e5a627360e *src/AMD/Source/amd_postorder.c 56f64a3203f5752b5a012b806f101d8c *src/AMD/Source/amd_valid.c addde010ddd6b0dd973dd110fb760c26 *src/AMD/Source/make-Make.R fb72579361b37fe421cb34b65b9b7b3f *src/AMD/Source/make_o.mk -75192748acd4dcad3d3912cfbbaffcc4 *src/CHMfactor.c +fccf5a254b8b8cffea30ba2a018b2e50 *src/CHMfactor.c 30dc9cebc72c3cab2862a1f04209874e *src/CHMfactor.h d2d49c52f19cae17de0efe9bbd0e50b0 *src/CHOLMOD/Check/License.txt 0689532ab6ed7c3864c9fafbee1aa1b6 *src/CHOLMOD/Check/cholmod_check.c @@ -374,45 +379,45 @@ e14e53d0b36e1d0647348a326e8b3b54 *src/COLAMD/Include/colamd.h a40eda898c98a8b193aae541a40e16b8 *src/COLAMD/Source/Makefile ed584482056a57c97c84f0f2701f76a6 *src/COLAMD/Source/colamd.c 8f9d70daa9adafe39e555573d974d17e *src/COLAMD/Source/colamd_global.c -ea11be3f32c42b96383874f423901438 *src/Csparse.c -18b51d39ff3bcecdcac0d2408fbd9a67 *src/Csparse.h +20caae8853570b842eb1bc2b9dc24cfb *src/Csparse.c +83401a56dbbf08169618c5df821f2889 *src/Csparse.h 8f61a05750779ce84f2ed402f5596488 *src/Makevars -2b9fef012cfa7dcba78736453c8b215e *src/Mutils.c -c77435cd484096c2e29d5f6c78b235a1 *src/Mutils.h +10e85bbc44d011973138d0cba6ddcbfd *src/Mutils.c +74740906374b4093f1a21a448a4a1279 *src/Mutils.h 1579a754fcbf8ebabf9b30c31289fdfe *src/SuiteSparse_config/Makefile e9b2be5ad0056f588187cf504cf60764 *src/SuiteSparse_config/SuiteSparse_config.c 5be5db8ccb99f88f234639b97d8227c5 *src/SuiteSparse_config/SuiteSparse_config.h d41d8cd98f00b204e9800998ecf8427e *src/SuiteSparse_config/SuiteSparse_config.mk 40c1ce69ac595b8511b2f59b6a8389a4 *src/Syms.h -a890380e08dd55e9d1db21b91ecb7ecf *src/TMatrix_as.c +166c3d16d89ff57476c221bc110a4f5f *src/TMatrix_as.c 0ef00bab2b7ffb79f64b25311decd236 *src/TMatrix_as.h 403ed36ffbb641c04203fd4a16eb7837 *src/Tsparse.c 20c550b57138bf22290ea759dfcb1c3e *src/Tsparse.h -30c07a189ab75fbdcb6df0232bbfeca5 *src/abIndex.c +3714d37c755fbf0b5b2a88362b651390 *src/abIndex.c ea6bdd1b33f38c8c2913eeef6eb21be3 *src/abIndex.h -65915cf23e80dcb1246e7fb3ad0cce0b *src/chm_common.c -6434e073aeea38fde36e07a9483355aa *src/chm_common.h +6d100e95fbaa1973b58e9f3a5740fe6c *src/chm_common.c +35bf8ffd5ab5fdf813e1a942dd7969a1 *src/chm_common.h 90f42d39e5e8eed2adb1400618718a7e *src/cs.c 7556d0aeb5c30bbac0e4bccca96b58f6 *src/cs.h f7d0c9d93510c1fb58f43637e662f6bf *src/cs_utils.c a9ec7536f6c4518c799bf108f34381db *src/cs_utils.h -50c4e3164d086b03c212cb41c01e4ea5 *src/dense.c +f946a10909bc7353d69752d1a6fd9c4d *src/dense.c e73271fa5f7b9cf9e233cd24f55cfc7d *src/dense.h -712f55747d964c0afd1207db433c76a8 *src/dgCMatrix.c +a33c276093e4ba56e3e4a70488a90aef *src/dgCMatrix.c 65b0e724e0bb67bcd82b5f3f57ea2b58 *src/dgCMatrix.h -130569749628885030c543d404f7995d *src/dgTMatrix.c +13c6556792e205ad739c0207b2beeeaa *src/dgTMatrix.c b79dce2247ffabcb51997b8fe591b41b *src/dgTMatrix.h -74f67f2313bed597a1e68188328dc087 *src/dgeMatrix.c -abb3c73f4a912de19114010daa9608ab *src/dgeMatrix.h +3d0d96e897b4383a17a9e34a0c98b060 *src/dgeMatrix.c +fdd9e01ae6f24fc59d821db2c984da53 *src/dgeMatrix.h f26dfaf602ce007c04be535e921313c9 *src/dpoMatrix.c b58f1f64d6141e98de9eaf6d953e7f6d *src/dpoMatrix.h cf1e54516cd78c8d4093b5ffd500ba27 *src/dppMatrix.c 4cb570fdeeab6cd03ba14db58efeddce *src/dppMatrix.h -7ea5ff363b9ed4eef558d1c4d8fd24a5 *src/dsCMatrix.c +c03240114bc1325161fa96a947882765 *src/dsCMatrix.c dadce6c58bc388ff5f6501f4c3cafab1 *src/dsCMatrix.h 417baab279fa6ac1bbc3679201cebb56 *src/dspMatrix.c 461e5e7cafb6a6cc4e466f124c0ef54e *src/dspMatrix.h -11ea4c255f4b12463ef72366368a0d50 *src/dsyMatrix.c +c835d303925a90c54dc10d6d8e41f3b2 *src/dsyMatrix.c cf331499d9904a6569c326515bb75aef *src/dsyMatrix.h 5b5cbd05aae78f6f3e92b922b6bf191c *src/dtCMatrix.c 0eab9c4475b8630bb8f2a3ebb782530e *src/dtCMatrix.h @@ -420,11 +425,11 @@ cf331499d9904a6569c326515bb75aef *src/dsyMatrix.h fac7ed66a9097104e94c3d91c01fcdc7 *src/dtTMatrix.h 85a7997785b68496a227b300268ed5d4 *src/dtpMatrix.c ca00a8f2c785b0b4e3ead5cb888dc330 *src/dtpMatrix.h -913ceae9de7733f7f20d1515e7e52748 *src/dtrMatrix.c +32df59d92e1ff526eee72162a6e867cf *src/dtrMatrix.c feba4a84f226246a992cc103f3da8874 *src/dtrMatrix.h f3c82d4a7faeaf3d820ea313093a563c *src/factorizations.c 23c4dbba1f4d18ef2ff794ad129e8174 *src/factorizations.h -0571b95805a5b280d505bf6f7828b810 *src/init.c +6f2f1320b2a6ad28e9470455f826a881 *src/init.c 2582450ecf52d4e9d9fece3695fa7af2 *src/ldense.c d8522bb27a18eea16d17c411d8da9e38 *src/ldense.h 0b0a474b5b19cb09637063134a0ba203 *src/lgCMatrix.c @@ -442,23 +447,23 @@ c55fe12890cabcf61d562a4969825c02 *src/t_Matrix_rle.c 4399d656e1aec423a0b43d2b5ce9e1a7 *src/t_gCMatrix_colSums.c e6de21ff3bf0908eaca620d9b868b4f1 *src/t_sparseVector.c e0f570b1cb86d81cb278f2cc719c2046 *tests/Class+Meth.R -da028a449978fba34208c6565e609bb8 *tests/Simple.R -2af48af7c30c89de75a11153cd6aa367 *tests/abIndex-tsts.R +5c04562ff4df8368f6e5be15c5610cd5 *tests/Simple.R +4966b9ac5a23de46814439a84174973b *tests/abIndex-tsts.R ce85ee2aba7d78e88fef738a0d1c7118 *tests/base-matrix-fun.R -1e92c4f780ea8228568b3134e3e968e9 *tests/bind.R -db1c3877f76089d81185235015a8c6fd *tests/bind.Rout.save +72b99b1fb486ebf0a437d84a2b0ef83a *tests/bind.R +da31297bcd2cc360e7e8a26de6476a58 *tests/bind.Rout.save 21024c2ae5eb4f5b1e073a7568171d89 *tests/dg_Matrix.R -1f5b88045e501047f8adf08c4cb542a8 *tests/dpo-test.R +1ad766f666dad37b9507ef21c071bb83 *tests/dpo-test.R 25542600eadca4e8af5261e98e3b3c5d *tests/dtpMatrix.R -47d887c86bb13da294d172b0aefec80c *tests/factorizing.R -968d761dab3dbad0c026c92417d12044 *tests/group-methods.R -e655e4430796d877726fcfbd99dbd207 *tests/indexing.R -a31d1521eb888cfab84c3b5eb58fe258 *tests/indexing.Rout.save -a4a12af23eb85b46b4902c7b21cead8d *tests/matprod.R +526e362a2c455b325fa9d11617f5143f *tests/factorizing.R +ed231754703a243d3731f29b7057cba4 *tests/group-methods.R +ac4f5052d4dc6bb574edee859bea54d2 *tests/indexing.R +58477e4d2211e5d807381dabb1b105b5 *tests/indexing.Rout.save +a525f9470803b0708a7e4280de778f7e *tests/matprod.R 06d9de87597574aff0aa03776011bfa8 *tests/matr-exp.R -8247f14ca71453d247f6df8e64feed93 *tests/other-pkgs.R +128ccccdfe84c2dbed42bdce86258491 *tests/other-pkgs.R 2787ae0732f209eee2a0965c196c3363 *tests/spModel.matrix.R -ce6f115cbb88e8fb5e080b062925ef1d *tests/validObj.R +8d94ef0528ccbd6756361acd354279a5 *tests/validObj.R eca424b43492f27bcb4ba5a1fdb0a0c7 *tests/write-read.R 09e13507b9832a30aa92e8aff0dc96a0 *vignettes/Comparisons.Rnw 7bf6c80a144d27b6baece257c69bd800 *vignettes/Design-issues.Rnw diff --git a/NAMESPACE b/NAMESPACE index f5d5995d..fdca1d01 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -27,7 +27,8 @@ importFrom("methods", ## Generics and functions defined in this package -export("Cholesky", ".SuiteSparse_version", +export("%&%", + "Cholesky", ".SuiteSparse_version", "Diagonal", ".symDiagonal", ".sparseDiagonal", "Hilbert", "KhatriRao", "Matrix", @@ -46,6 +47,7 @@ export("Cholesky", ".SuiteSparse_version", ## "mkDet", # <- useful in other packages (Rmpfr, gmp) .. hmm --> 'stats' ? ## FIXME: why exactly these and not e.g. dsp2dsy and many more? ".dsy2mat", ".dsy2dsp", ".dxC2mat", ".T2Cmat", "..2dge", ".dense2sy", + ".C2nC", ".nC2d", ".nC2l", ".diag.dsC",# -> R/dsCMatrix.R --has FIXME ".solve.dgC.chol", ".solve.dgC.qr", "diagN2U", "diagU2N", ".diagU2N", ".diag2tT", ".diag2sT", ".diag2mat", @@ -54,8 +56,8 @@ export("Cholesky", ".SuiteSparse_version", "expm", "facmul", "fac2sparse", "fac2Sparse", "forceSymmetric", - ## 'graph' package (and class) related: - "T2graph", "graph2T", + "T2graph", "graph2T", ## <- 'graph' package (and class) related + "anyDuplicatedT", "uniqTsparse", "isTriangular", "isDiagonal", "isLDL", @@ -87,6 +89,7 @@ if(getRversion() < "2.15.0") export(".M.classEnv") ## substitute for using cbind() / rbind() +## .Deprecated() for R version >= 3.2.0 [2015-04]: export("cBind", "rBind") diff --git a/R/AllClass.R b/R/AllClass.R index ab5651dc..0e4dc770 100644 --- a/R/AllClass.R +++ b/R/AllClass.R @@ -140,24 +140,32 @@ setClass("lsparseMatrix", representation("VIRTUAL"), if(FALSE) { ##--not yet-- setClass("isparseMatrix", representation("VIRTUAL"), - contains = c("lMatrix", "sparseMatrix")) + contains = c("iMatrix", "sparseMatrix")) } ## these are the "pattern" matrices for "symbolic analysis" of sparse OPs: setClass("nsparseMatrix", representation("VIRTUAL"), contains = c("nMatrix", "sparseMatrix")) -if(FALSE) { ##-- a nice idea --- but needs more careful method re-definitions - ##-- such that the *correct* methods are dispatched: -## Trying to use more economical method defs: +## More Class Intersections {for method dispatch}: +if(FALSE) { ## this is "natural" but gives WARNINGs when other packages use "it" setClass("dCsparseMatrix", representation("VIRTUAL"), contains = c("CsparseMatrix", "dsparseMatrix")) setClass("lCsparseMatrix", representation("VIRTUAL"), contains = c("CsparseMatrix", "lsparseMatrix")) setClass("nCsparseMatrix", representation("VIRTUAL"), contains = c("CsparseMatrix", "nsparseMatrix")) + +## dense general +setClass("geMatrix", representation("VIRTUAL"), + contains = c("denseMatrix", "generalMatrix")) + +} else { ## ----------- a version that maybe works better for other pkgs --------- + + ##--> setClassUnion() ... below } + ## ------------------ Proper (non-virtual) Classes ---------------------------- ##---------------------- DENSE ----------------------------------------- @@ -540,12 +548,12 @@ setClass("isRMatrix", setClass("indMatrix", representation(perm = "integer"), contains = c("sparseMatrix", "generalMatrix"), validity = function(object) { - n <- object@Dim[1] - d <- object@Dim[2] + n <- object@Dim[1] + d <- object@Dim[2] perm <- object@perm if (length(perm) != n) return(paste("length of 'perm' slot must be", n)) - if(n > 0 && (any(perm > d) | any(perm < 1))) + if(n > 0 && (any(perm > d) || any(perm < 1))) return("'perm' slot is not a valid index") TRUE }) @@ -695,6 +703,17 @@ setClassUnion("xMatrix", ## those Matrix classes with an 'x' slot "ndenseMatrix", "zMatrix")) +if(TRUE) { ##--- variant of setClass("dCsparse..." ..) etc working better for other pkgs ----- + +setClassUnion("dCsparseMatrix", members = c("dgCMatrix", "dtCMatrix", "dsCMatrix")) +setClassUnion("lCsparseMatrix", members = c("lgCMatrix", "ltCMatrix", "lsCMatrix")) +setClassUnion("nCsparseMatrix", members = c("ngCMatrix", "ntCMatrix", "nsCMatrix")) + +## dense general +setClassUnion("geMatrix", members = c("dgeMatrix", "lgeMatrix", "ngeMatrix")) +} + + ## Definition Packed := dense with length( . @x) < prod( . @Dim) ## ~~~~~~ diff --git a/R/AllGeneric.R b/R/AllGeneric.R index 7a77adc0..26b800ad 100644 --- a/R/AllGeneric.R +++ b/R/AllGeneric.R @@ -9,6 +9,10 @@ setGeneric("isDiagonal", function(object) standardGeneric("isDiagonal")) setGeneric("isTriangular", function(object, upper = NA, ...) standardGeneric("isTriangular")) +## Boolean Arithmetic Matrix multiplication +setGeneric("%&%", function (x, y) standardGeneric("%&%")) + + ## isSymmetric is "S3 generic" in R's base/R/eigen.R setGeneric("facmul", @@ -26,12 +30,19 @@ setGeneric("lu", function(x, ...) standardGeneric("lu")) ##NB setGeneric("qr", def = function(x, tol=1e-7,...) standardGeneric("qr"), ##NB useAsDefault= function(x, tol=1e-7,...) base::qr(x, tol, ...)) +if(is.na(match("...", names(formals(implicitGeneric("crossprod")))))) { + ## base:crossprod() has no '...', but since 2015-03, there's an implicit generic + setGeneric("crossprod", function(x, y=NULL, ...) standardGeneric("crossprod"), + useAsDefault= function(x, y=NULL, ...) base::crossprod(x, y)) + setGeneric("tcrossprod", function(x, y=NULL, ...) standardGeneric("tcrossprod"), + useAsDefault= function(x, y=NULL, ...) base::tcrossprod(x, y)) +} + setGeneric("Schur", function(x, vectors, ...) standardGeneric("Schur")) setGeneric("unpack", function(x, ...) standardGeneric("unpack")) setGeneric("pack", function(x, ...) standardGeneric("pack")) -##- setGeneric("%p%", function(a, b) standardGeneric("%p%")) setGeneric("expm", function(x) standardGeneric("expm")) diff --git a/R/Auxiliaries.R b/R/Auxiliaries.R index 626cdb6e..c75fa629 100644 --- a/R/Auxiliaries.R +++ b/R/Auxiliaries.R @@ -22,7 +22,7 @@ any0 <- function(x) .Call(R_any0, x) ## These work "identically" for 1 ('==' TRUE) and 0 ('==' FALSE) ## (but give a warning for "double" 1 or 0) ## TODO: C versions of these would be faster -allTrue <- function(x) all(x) && !any(is.na(x)) +allTrue <- function(x) all(x) && !anyNA(x) ## Note that mode() = "numeric" -- as0(), as1() return "double" @@ -233,7 +233,7 @@ detSparseLU <- function(x, logarithm = TRUE, ...) { ll <- lu(x, errSing = FALSE) ## ^^^^^^^^^^^^^^^ no error in case of singularity if(identical(NA, ll)) { ## LU-decomposition failed with singularity - return(mkDet(ldet=if(any(is.na(x))) NaN else -Inf, + return(mkDet(ldet = if(anyNA(x)) NaN else -Inf, logarithm=logarithm, sig = 1L)) } ## else @@ -730,22 +730,12 @@ uniqTsparse <- function(x, class.x = c(class(x))) { ## and as() are based on C code (all of them?) ## ## FIXME: Do it fast for the case where 'x' is already 'uniq' - - switch(class.x, - "dgTMatrix" = as(as(x, "dgCMatrix"), "dgTMatrix"), - "dsTMatrix" = as(as(x, "dsCMatrix"), "dsTMatrix"), - "dtTMatrix" = as(as(x, "dtCMatrix"), "dtTMatrix"), - ## do we need this for "logical" ones, there's no sum() there! - "lgTMatrix" = as(as(x, "lgCMatrix"), "lgTMatrix"), - "lsTMatrix" = as(as(x, "lsCMatrix"), "lsTMatrix"), - "ltTMatrix" = as(as(x, "ltCMatrix"), "ltTMatrix"), - ## do we need this for "logical" ones, there's no sum() there! - "ngTMatrix" = as(as(x, "ngCMatrix"), "ngTMatrix"), - "nsTMatrix" = as(as(x, "nsCMatrix"), "nsTMatrix"), - "ntTMatrix" = as(as(x, "ntCMatrix"), "ntTMatrix"), - ## otherwise: - stop(gettextf("not yet implemented for class %s", dQuote(class.x)), - domain = NA)) + if(extends(class.x, "TsparseMatrix")) { + tri <- extends(class.x, "triangularMatrix") + .Call(Csparse_to_Tsparse, .Call(Tsparse_to_Csparse, x, tri), tri) + } else + stop(gettextf("not yet implemented for class %s", dQuote(class.x)), + domain = NA) } ## Note: maybe, using @@ -753,15 +743,14 @@ uniqTsparse <- function(x, class.x = c(class(x))) { ## would be slightly more efficient than as( , "dgTMatrix") ## but really efficient would be to use only one .Call(.) for uniq(.) ! -## Earlier was: -## drop0 <- function(x, clx = c(class(x)), tol = 0) { drop0 <- function(x, tol = 0, is.Csparse = NA) { .Call(Csparse_drop, - if(isTRUE(is.Csparse) || is.na(is.Csparse) && is(x, "CsparseMatrix")) x else - as(x, "CsparseMatrix"), + if(isTRUE(is.Csparse) || is.na(is.Csparse) && is(x, "CsparseMatrix")) + x else as(x, "CsparseMatrix"), tol) } + uniq <- function(x) { if(is(x, "TsparseMatrix")) uniqTsparse(x) else if(is(x, "sparseMatrix")) drop0(x) else x @@ -773,10 +762,11 @@ asTuniq <- function(x) { ## is 'x' a uniq Tsparse Matrix ? is_not_uniqT <- function(x, di = dim(x)) - is.unsorted(x@j) || anyDuplicated(.Call(m_encodeInd2, x@i, x@j, di, FALSE, FALSE)) + is.unsorted(x@j) || anyDuplicatedT(x, di) ## is 'x' a TsparseMatrix with duplicated entries (to be *added* for uniq): -is_duplicatedT <- function(x, di = dim(x)) +is_duplicatedT <- # <- keep old name for a while, as ../inst/test-tools-Matrix.R has used it +anyDuplicatedT <- function(x, di = dim(x)) anyDuplicated(.Call(m_encodeInd2, x@i, x@j, di, FALSE, FALSE)) @@ -808,6 +798,10 @@ fixupDense <- function(m, from, cldm = getClassDef(class(m))) { m } +##' @title Transform {vectors, matrix, Matrix, ...} to dgeMatrix +##' @export +..2dge <- function(from) .Call(dup_mMatrix_as_dgeMatrix, from) + ## -> ./ldenseMatrix.R : l2d_Matrix <- function(from, cl = MatrixClass(class(from)), cld = getClassDef(cl)) { ## stopifnot(is(from, "lMatrix")) @@ -968,10 +962,9 @@ l2d_meth <- function(x) { else .M.kindC(clx) } -.M.kindC <- function(clx) { ## 'clx': class() *or* classdefinition +.M.kindC <- function(clx, ex = extends(clx)) { ## 'clx': class() *or* classdefinition if(is.character(clx)) # < speedup: get it once - clx <- getClassDef(clx) - ex <- extends(clx) + clx <- getClassDef(clx) if(any(ex == "sparseVector")) { ## must work for class *extending* "dsparseVector" ==> cannot use (clx@className) ! if (any(ex == "dsparseVector")) "d" @@ -1116,8 +1109,6 @@ as_Csp2 <- function(x) { if(is(x, "triangularMatrix")) .Call(Csparse_diagU2N, x) else x } -.gC2sym <- function(x, uplo) .Call(Csparse_general_to_symmetric, x, uplo) - ## 'cl' : class() *or* class definition of from as_gCsimpl2 <- function(from, cl = class(from)) as(from, paste0(.M.kind(from, cl), "gCMatrix")) @@ -1164,7 +1155,7 @@ as_CspClass <- function(x, cl) { ##(extends(cld, "diagonalMatrix") && isDiagonal(x)) || if (extends(cld, "symmetricMatrix") && isSymmetric(x)) forceSymmetric(as(x,"CsparseMatrix")) - else if (extends(cld, "triangularMatrix") && (iT <- isTriangular(x))) + else if (extends(cld, "triangularMatrix") && isTriangular(x)) as(x, cl) else if(is(x, "CsparseMatrix")) x else as(x, paste0(.M.kind(x, cld), "gCMatrix")) @@ -1208,7 +1199,7 @@ try_as <- function(x, classes, tryAnyway = FALSE) { ## For *dense* matrices -isTriMat <- function(object, upper = NA) { +isTriMat <- function(object, upper = NA, ...) { ## pretest: is it square? d <- dim(object) if(d[1] != d[2]) return(FALSE) @@ -1231,7 +1222,7 @@ isTriMat <- function(object, upper = NA) { } ## For Tsparse matrices: -isTriT <- function(object, upper = NA) { +isTriT <- function(object, upper = NA, ...) { ## pretest: is it square? d <- dim(object) if(d[1] != d[2]) return(FALSE) @@ -1253,7 +1244,7 @@ isTriT <- function(object, upper = NA) { } ## For Csparse matrices -isTriC <- function(object, upper = NA) { +isTriC <- function(object, upper = NA, ...) { ## pretest: is it square? d <- dim(object) if(d[1] != d[2]) return(FALSE) @@ -1312,12 +1303,10 @@ isTriC <- function(object, upper = NA) { ## -> has 'uplo' differentiate between packed and unpacked ### .......... FIXME ............... - - packed <- isPacked(object) - if(object@uplo == "U") { - } else { ## uplo == "L" - } - + ## packed <- isPacked(object) + ## if(object@uplo == "U") { + ## } else { ## uplo == "L" + ## } ### very cheap workaround all0(as.matrix(object)[rep_len(c(FALSE, rep.int(TRUE,n)), n^2)]) } diff --git a/R/Csparse.R b/R/Csparse.R index 2cc99ae3..fca51281 100644 --- a/R/Csparse.R +++ b/R/Csparse.R @@ -27,28 +27,32 @@ rm(prefix) setAs("dtCMatrix", "dtTMatrix", function(from) .Call(Csparse_to_Tsparse, from, TRUE)) +if(FALSE) ## old version C2dense <- function(from) { ## |-> cholmod_C -> cholmod_dense -> chm_dense_to_dense cld <- getClassDef(class(from)) if (extends(cld, "generalMatrix")) - .Call(Csparse_to_dense, from) - else { + .Call(Csparse_to_dense, from, FALSE) + else { ## "triangular" or "symmetric" : + tri <- extends(cld, "triangularMatrix") ## Csparse_to_dense loses symmetry and triangularity properties. ## With suitable changes to chm_dense_to_SEXP (../src/chm_common.c) ## we could do this in C code -- or do differently in C {FIXME!} - if (extends(cld, "triangularMatrix") && from@diag == "U") + if (tri && from@diag == "U") from <- .Call(Csparse_diagU2N, from) - as(.Call(Csparse_to_dense, from), # -> "[dln]geMatrix" + as(.Call(Csparse_to_dense, from, symm = !tri), # -> "[dln]geMatrix" paste0(.M.kindC(cld), - .dense.prefixes[.M.shape(from, cld)], "Matrix")) + .dense.prefixes[if(tri) "t" else "s"], "Matrix")) } } -setAs("CsparseMatrix", "denseMatrix", C2dense) +C2dense <- function(from) .Call(Csparse_to_dense, from, NA_integer_) +setAs("CsparseMatrix", "denseMatrix", C2dense) ## special cases (when a specific "to" class is specified) -setAs("dgCMatrix", "dgeMatrix", - function(from) .Call(Csparse_to_dense, from)) +setAs("dgCMatrix", "dgeMatrix", function(from) .Call(Csparse_to_dense, from, 0L)) +setAs("dsCMatrix", "denseMatrix", function(from) .Call(Csparse_to_dense, from, 1L)) +setAs("dtCMatrix", "denseMatrix", function(from) .Call(Csparse_to_dense, from, -1L)) setAs("dgCMatrix", "vector", function(from) .Call(Csparse_to_vector, from)) setAs("dsCMatrix", "vector", function(from) .Call(Csparse_to_vector, from)) @@ -64,10 +68,11 @@ setMethod("as.vector", signature(x = "dsCMatrix", mode = "missing"), ## cholmod_sparse_to_dense converts symmetric storage to general ## storage so symmetric classes are ok for conversion to matrix. ## unit triangular needs special handling -.dxC2mat <- function(from, chkUdiag=TRUE) .Call(Csparse_to_matrix, from, chkUdiag) -setAs("dgCMatrix", "matrix", function(from) .Call(Csparse_to_matrix, from, FALSE)) -setAs("dsCMatrix", "matrix", function(from) .Call(Csparse_to_matrix, from, FALSE)) -setAs("dtCMatrix", "matrix", function(from) .Call(Csparse_to_matrix, from, TRUE)) +##' exported +.dxC2mat <- function(from, chkUdiag=TRUE) .Call(Csparse_to_matrix, from, chkUdiag, NA) +setAs("dgCMatrix", "matrix", function(from) .Call(Csparse_to_matrix, from, FALSE, FALSE)) +setAs("dsCMatrix", "matrix", function(from) .Call(Csparse_to_matrix, from, FALSE, TRUE)) +setAs("dtCMatrix", "matrix", function(from) .Call(Csparse_to_matrix, from, TRUE, FALSE)) ## NB: Would *not* be ok for l*Matrix or n*Matrix, ## --------- as cholmod coerces to "REAL" aka "double" diff --git a/R/HBMM.R b/R/HBMM.R index be01c8bb..38b730fa 100644 --- a/R/HBMM.R +++ b/R/HBMM.R @@ -36,9 +36,9 @@ readHB <- function(file) on.exit(close(file)) } hdr <- readLines(file, 4, ok = FALSE) - Title <- sub('[[:space:]]+$', '', substr(hdr[1], 1, 72)) - Key <- sub('[[:space:]]+$', '', substr(hdr[1], 73, 80)) - totln <- as.integer(substr(hdr[2], 1, 14)) + ## Title <- sub('[[:space:]]+$', '', substr(hdr[1], 1, 72)) + ## Key <- sub('[[:space:]]+$', '', substr(hdr[1], 73, 80)) + ## totln <- as.integer(substr(hdr[2], 1, 14)) ptrln <- as.integer(substr(hdr[2], 15, 28)) indln <- as.integer(substr(hdr[2], 29, 42)) valln <- as.integer(substr(hdr[2], 43, 56)) @@ -54,14 +54,12 @@ readHB <- function(file) nr <- as.integer(substr(hdr[3], 15, 28)) nc <- as.integer(substr(hdr[3], 29, 42)) nz <- as.integer(substr(hdr[3], 43, 56)) - nel <- as.integer(substr(hdr[3], 57, 70)) + ## nel <- as.integer(substr(hdr[3], 57, 70)) ptrfmt <- toupper(sub('[[:space:]]+$', '', substr(hdr[4], 1, 16))) indfmt <- toupper(sub('[[:space:]]+$', '', substr(hdr[4], 17, 32))) valfmt <- toupper(sub('[[:space:]]+$', '', substr(hdr[4], 33, 52))) - rhsfmt <- toupper(sub('[[:space:]]+$', '', substr(hdr[4], 53, 72))) - if (!is.na(rhsln) && rhsln > 0) { - h5 <- readLines(file, 1, ok = FALSE) - } + ## rhsfmt <- toupper(sub('[[:space:]]+$', '', substr(hdr[4], 53, 72))) + if (!is.na(rhsln) && rhsln > 0) readLines(file, 1, ok = FALSE) # h5 ptr <- readmany(file, ptrln, nc + 1, ptrfmt, as.integer) ind <- readmany(file, indln, nz, indfmt, as.integer) vals <- readmany(file, valln, nz, valfmt, as.numeric) @@ -87,7 +85,7 @@ readMM <- function(file) scan1 <- function(what, ...) scan(file, nmax = 1, what = what, quiet = TRUE, ...) - if ((hdr <- scan1(character())) != "%%MatrixMarket") + if (scan1(character()) != "%%MatrixMarket")# hdr stop("file is not a MatrixMarket file") if (!(typ <- tolower(scan1(character()))) %in% "matrix") stop(gettextf("type '%s' not recognized", typ), domain = NA) diff --git a/R/Math.R b/R/Math.R index 7a499c69..b6256ac0 100644 --- a/R/Math.R +++ b/R/Math.R @@ -38,7 +38,7 @@ setMethod("Math", slot(rx, nm) <- slot(x, nm) rx } - } else { ## no sparseness (or no matrix!): + } else { ## no sparseness (or no matrix!); C2dense() returns *numeric* callGeneric(C2dense(x)) } }) ## {Math} @@ -64,7 +64,8 @@ setMethod("Math", "ddenseMatrix", function(x) } } else { ## triangularMatrix (no need for testing), includes, e.g. "corMatrix"! - if(is0(f0 <- callGeneric(0.))) { ## -> result remains triangular + ## if(is0(f0 <- callGeneric(0.))) { ## -> result remains triangular + if(is0(callGeneric(0.))) { ## -> result remains triangular cl <- .class0(x) if(cl %in% (scl <- c("dtrMatrix","dtpMatrix"))) { x@x <- callGeneric(x@x) @@ -111,7 +112,8 @@ setMethod("Math", signature(x = "diagonalMatrix"), function(x) { if(.Generic %in% Math.vecGenerics) # vector result callGeneric(.diag2mat(x)) - else if(is0(f0 <- callGeneric(0.))) { ## result remains diagonal + ## else if(is0(f0 <- callGeneric(0.))) { ## result remains diagonal + else if(is0(callGeneric(0.))) { ## result remains diagonal cl <- class(x) if(!extends(cl, "ddiMatrix")) cl <- class(x <- as(x, "dMatrix")) @@ -180,7 +182,7 @@ setMethod("Math", signature(x = "sparseVector"), function(x) { if(.Generic %nin% Math.vecGenerics && is0(callGeneric(0.))) { ## sparseness preserved - cld <- getClassDef(cx <- class(x)) + cld <- getClassDef(class(x)) kind <- .M.kindC(cld)# "d", "n", "l", "i", "z", ... has.x <- kind != "n" if(has.x) { diff --git a/R/Matrix.R b/R/Matrix.R index e37fa928..ab90fa1b 100644 --- a/R/Matrix.R +++ b/R/Matrix.R @@ -10,10 +10,14 @@ setAs("Matrix", "denseMatrix", function(from) as_dense(from)) ## Maybe TODO: ## setAs("Matrix", "nMatrix", function(from) ....) +## Anything: we build on as.matrix(.) : +## --- authors can always provide their own specific setAs(*, "Matrix") +setAs("ANY", "Matrix", function(from) Matrix(as.matrix(from))) + ## Most of these work; this is a last resort: -setAs(from = "Matrix", to = "matrix", # do *not* call base::as.matrix() here: +setAs("Matrix", "matrix", # do *not* call base::as.matrix() here: function(from) .bail.out.2("coerce", class(from), class(to))) -setAs(from = "matrix", to = "Matrix", function(from) Matrix(from)) +setAs("matrix", "Matrix", function(from) Matrix(from)) ## ## probably not needed eventually: ## setAs(from = "ddenseMatrix", to = "matrix", @@ -494,7 +498,7 @@ setMethod("[", signature(x = "Matrix", i = "ANY", j = "ANY", drop = "ANY"), ## Note: current method dispatch seems not to call this ever - if(!any(is.na(i)) && all(i)) ## select everything + if(!anyNA(i) && all(i)) ## select everything x else ## not selecting all -> result is *NOT* diagonal/triangular/symmetric/.. ## keep j missing, but drop = "logical" @@ -619,7 +623,7 @@ setMethod("[", signature(x = "Matrix", i = "matrix", j = "missing", drop="missin if(!is.integer(i)) storage.mode(i) <- "integer" if(any(i < 0)) stop("negative values are not allowed in a matrix subscript") - if(any(is.na(i))) + if(anyNA(i)) stop("NAs are not allowed in subscripted assignments") if(any(i0 <- (i == 0))) # remove them i <- i[ - which(i0, arr.ind = TRUE)[,"row"], ] diff --git a/R/Ops.R b/R/Ops.R index f6c203f1..fb54121c 100644 --- a/R/Ops.R +++ b/R/Ops.R @@ -100,7 +100,7 @@ setMethod("Compare", signature(e1 = "Matrix", e2 = "Matrix"), ## can be done for matching-dim "*geMatrix", and also ## matching-{dim + uplo} for *packed* (only!) symmetric+triangular .Ops.via.x <- function(e1,e2) { - d <- dimCheck(e1, e2) + dimCheck(e1, e2) e1@x <- callGeneric(e1@x, e2@x) e1 } @@ -195,7 +195,7 @@ Cmp.Mat.atomic <- function(e1, e2) { ## result will inherit from "lMatrix" } if(remainSparse) { - if(!any(is.na(r)) && ((Ar <- all(r)) || !any(r))) { + if(!anyNA(r) && ((Ar <- all(r)) || !any(r))) { lClass <- class2(cl, "l") # is "lsparse*" r <- new(lClass) r@Dim <- d @@ -268,8 +268,8 @@ Ops.x.x <- function(e1, e2) le <- prod(d) isPacked <- function(x) length(x@x) < le Mclass <- - if(sym <- extends(c1, "symmetricMatrix") && - extends(c2, "symmetricMatrix")) { + if(extends(c1, "symmetricMatrix") && + extends(c2, "symmetricMatrix")) { if(e1@uplo != e2@uplo) ## one is upper, one is lower e2 <- t(e2) @@ -286,8 +286,8 @@ Ops.x.x <- function(e1, e2) } else "syMatrix" } - else if(tri <- extends(c1, "triangularMatrix") && - extends(c2, "triangularMatrix")) { + else if(extends(c1, "triangularMatrix") && + extends(c2, "triangularMatrix")) { if(!(geM <- e1@uplo != e2@uplo || isN0(callGeneric(0,0)))) { p1 <- isPacked(e1) p2 <- isPacked(e2) @@ -306,7 +306,7 @@ Ops.x.x <- function(e1, e2) "trMatrix" } } - else { + else { ## not symmetric, not triangular ==> "general" geM <- TRUE } if(geM) @@ -701,7 +701,7 @@ Logic.Mat.atomic <- function(e1, e2) { ## result will typically be "like" e1: } if(remainSparse) { - if(!any(is.na(r)) && ((Ar <- all(r)) || !any(r))) { + if(!anyNA(r) && ((Ar <- all(r)) || !any(r))) { lClass <- class2(cl, "l") # is "lsparse*" r <- new(lClass) r@Dim <- d @@ -1151,7 +1151,7 @@ A.M.n <- function(e1, e2) { } else { ## non-sparse, since '0 o e2' is not (all) 0 r <- as(e1, "matrix") - if(length(e2) == 1) { + if(l2 == 1) { r[] <- f0 r[non0ind(e1, getClassDef("dgCMatrix")) + 1L] <- callGeneric(e1@x, e2) ..2dge(r) @@ -1191,7 +1191,7 @@ A.n.M <- function(e1, e2) { } else { ## non-sparse, since '0 o e2' is not (all) 0 r <- as(e2, "matrix") - if(length(e1) == 1) { + if(l1 == 1) { r[] <- f0 r[non0ind(e2, getClassDef("dgCMatrix")) + 1L] <- callGeneric(e1, e2@x) @@ -1285,7 +1285,7 @@ setMethod("Compare", signature(e1 = "CsparseMatrix", e2 = "CsparseMatrix"), shape <- if(T) "t" else if(S) "s" else "g" } - dn <- dimNamesCheck(e1, e2) + dn <- dimNamesCheck(e1, e2) ## <- FIXME: for 'S'; allow staying ## the result object: newC <- sub("^.", "l", MatrixClass(class(e1))) ## FIXME: "n" result when e1 & e2 are "n", or even whenever possible @@ -1441,11 +1441,11 @@ setMethod("Ops", signature(e1 = "ANY", e2 = "sparseVector"), setMethod("Ops", signature(e1 = "sparseVector", e2 = "atomicVector"), function(e1, e2) { if(length(e2) == 1) { ## scalar ------ special case - "fast" - if(all0(rf <- callGeneric(FALSE, e2))) { # result remains sparse + if(all0(callGeneric(FALSE, e2))) { # result remains sparse if(is(e1, "nsparseVector")) { # no 'x' slot, i.e. all TRUE r <- callGeneric(TRUE, e2) if(is.logical(r)) { - if(isTRUE(at <- all(r))) # (could be NA) + if(isTRUE(all(r))) # (could be NA) e1 # result unchanged else newSpVec("lsparseVector", x = r, e1) @@ -1473,11 +1473,11 @@ setMethod("Ops", signature(e1 = "sparseVector", e2 = "atomicVector"), setMethod("Ops", signature(e1 = "atomicVector", e2 = "sparseVector"), function(e1, e2) { if(length(e1) == 1) { ## scalar ------ special case - "fast" - if(all0(rf <- callGeneric(e1, FALSE))) { # result remains sparse + if(all0(callGeneric(e1, FALSE))) { # result remains sparse if(is(e2, "nsparseVector")) { # no 'x' slot, i.e. all TRUE r <- callGeneric(e1, TRUE) if(is.logical(r)) { - if(isTRUE(at <- all(r))) # (could be NA) + if(isTRUE(all(r))) # (could be NA) e2 # result unchanged else newSpVec("lsparseVector", x = r, e2) diff --git a/R/Summary.R b/R/Summary.R index 96a18730..14d34a3f 100644 --- a/R/Summary.R +++ b/R/Summary.R @@ -27,18 +27,21 @@ setMethod("Summary", "ddenseMatrix", else x@x[indTri(d[1], upper= x@uplo == "U", diag= TRUE)], ..., na.rm = na.rm) - } else callGeneric(as(x, "dgeMatrix")@x, ..., na.rm = na.rm) + } else callGeneric(..2dge(x)@x, ..., na.rm = na.rm) } else { ## triangular , possibly packed if(.Generic %in% summGener1) { - if(.Generic %in% c("any","all")) { - Zero <- FALSE; One <- TRUE - } else { - Zero <- 0; One <- 1 - } - callGeneric(x@x, if(d[1] >= 2) Zero, if(x@diag == "U") One, + if(.Generic %in% c("any","all")) { + Zero <- FALSE; One <- TRUE + } else { + Zero <- 0; One <- 1 + } + callGeneric(if (length(x@x) < prod(d)) x@x ## <- 'packed' + else x@x[indTri(d[1], upper= x@uplo == "U", + diag= TRUE)], + if(d[1] >= 2) Zero, if(x@diag == "U") One, ..., na.rm = na.rm) - } else callGeneric(as(x, "dgeMatrix")@x, ..., na.rm = na.rm) + } else callGeneric(..2dge(x)@x, ..., na.rm = na.rm) } }) @@ -50,7 +53,7 @@ setMethod("Summary", "dsparseMatrix", n <- d[1] clx <- getClassDef(class(x)) isTri <- extends(clx, "triangularMatrix") - if(extends(clx, "TsparseMatrix") && is_duplicatedT(x, di = d)) + if(extends(clx, "TsparseMatrix") && anyDuplicatedT(x, di = d)) x <- .Call(Tsparse_to_Csparse, x, isTri)# = as(x, "Csparsematrix") l.x <- length(x@x) if(l.x == ne) ## fully non-zero (and "general") - very rare but quick @@ -73,7 +76,7 @@ setMethod("Summary", "dsparseMatrix", } else { ## prod() or sum() : care for "symmetric" and U2N if(!full.x && .Generic == "prod") { - if(any(is.na(x@x))) NaN else 0 + if(anyNA(x@x)) NaN else 0 } else callGeneric((if(isSym) as(x, "generalMatrix") else x)@x, @@ -313,6 +316,6 @@ setMethod("Summary", "sparseVector", callGeneric(x@x, if(logicF) FALSE else 0, ..., na.rm = na.rm) } else { ## prod() - if(any(is.na(x@x))) NaN else 0 + if(anyNA(x@x)) NaN else 0 } }) diff --git a/R/Tsparse.R b/R/Tsparse.R index 975756e3..1d62671a 100644 --- a/R/Tsparse.R +++ b/R/Tsparse.R @@ -136,7 +136,7 @@ intI <- function(i, n, dn, give.dn = TRUE) DN <- has.dn && give.dn if(is(i, "numeric")) { storage.mode(i) <- "integer" - if(any(is.na(i))) + if(anyNA(i)) stop("'NA' indices are not (yet?) supported for sparse Matrices") if(any(i < 0L)) { if(any(i > 0L)) @@ -160,7 +160,7 @@ intI <- function(i, n, dn, give.dn = TRUE) if(!has.dn) stop("no 'dimnames[[.]]': cannot use character indexing") i0 <- match(i, dn) - if(any(is.na(i0))) stop("invalid character indexing") + if(anyNA(i0)) stop("invalid character indexing") if(DN) dn <- dn[i0] i0 <- i0 - 1L } @@ -310,7 +310,7 @@ replTmat <- function (x, i, j, ..., value) ## "FIXME": could pass this (and much ? more) when this function would not *be* a ## method but be *called* from methods - clDv <- getClassDef(clV <- class(value)) + clDv <- getClassDef(class(value)) spV <- extends(clDv, "sparseVector") ## own version of all0() that works both for sparseVector and atomic vectors: .all0 <- function(v) if(spV) length(v@i) == 0 else all0(v) @@ -340,7 +340,7 @@ replTmat <- function (x, i, j, ..., value) } nr <- di[1] x.i <- .Call(m_encodeInd2, x@i, x@j, di=di, FALSE, FALSE) - if(anyDuplicated(x.i)) { ## == if(is_duplicatedT(x, di = di)) + if(anyDuplicated(x.i)) { ## == if(anyDuplicatedT(x, di = di)) x <- uniqTsparse(x) x.i <- .Call(m_encodeInd2, x@i, x@j, di=di, FALSE, FALSE) } @@ -487,7 +487,7 @@ replTmat <- function (x, i, j, ..., value) clDx <- getClassDef(clx) # extends() , is() etc all use the class definition stopifnot(extends(clDx, "TsparseMatrix")) ## Tmatrix maybe non-unique, have an entry split into a sum of several ones: - if(is_duplicatedT(x, di = di)) + if(anyDuplicatedT(x, di = di)) x <- uniqTsparse(x) toGeneral <- r.sym <- FALSE @@ -549,7 +549,7 @@ replTmat <- function (x, i, j, ..., value) ## now have lenV <= lenRepl if(!has.x && # <==> "n.TMatrix" - ((iNA <- any(is.na(value))) || value.not.logical)) + ((iNA <- anyNA(value)) || value.not.logical)) warning(if(iNA) gettextf("x[.,.] <- val: x is %s, val not in {TRUE, FALSE} is coerced NA |--> TRUE.", dQuote(clx)) @@ -700,7 +700,7 @@ replTmat <- function (x, i, j, ..., value) if(!is.integer(i)) storage.mode(i) <- "integer" if(any(i < 0)) stop("negative values are not allowed in a matrix subscript") - if(any(is.na(i))) + if(anyNA(i)) stop("NAs are not allowed in subscripted assignments") if(any(i0 <- (i == 0))) # remove them i <- i[ - which(i0, arr.ind = TRUE)[,"row"], ] @@ -731,7 +731,7 @@ replTmat <- function (x, i, j, ..., value) if(any(i2 > nc)) stop(gettextf("column indices must be <= ncol(.) which is %d", nc), domain=NA) ## Tmatrix maybe non-unique, have an entry split into a sum of several ones: - if(is_duplicatedT(x, di = di)) + if(anyDuplicatedT(x, di = di)) x <- uniqTsparse(x) toGeneral <- FALSE diff --git a/R/abIndex.R b/R/abIndex.R index 19ede88a..be9cd13d 100644 --- a/R/abIndex.R +++ b/R/abIndex.R @@ -340,13 +340,14 @@ setMethod("[", signature(x = "abIndex", i = "index"), function (x, i, j, ..., drop) { switch(x@kind, - "rleDiff" = { - ## intIv() in ./sparseVector.R -- not memory-efficient (??) - n <- length(x) - ii <- intIv(i, n) ## ii : 1-based integer indices - d <- x@rleD - ## Now work with the equivalent of - ## cumsum(c(d@first, rep.int(d@rle$values, d@rle$lengths))) + "rleDiff" = { + ## FIXME + ## intIv() in ./sparseVector.R -- not memory-efficient (??) + ## n <- length(x) + ## ii <- intIv(i, n) ## ii : 1-based integer indices + ## d <- x@rleD + ## Now work with the equivalent of + ## cumsum(c(d@first, rep.int(d@rle$values, d@rle$lengths))) stop("[i] is not yet implemented") }, @@ -423,7 +424,7 @@ setMethod("Summary", signature(x = "abIndex", na.rm = "ANY"), switch(.Generic, "all" = { ## these often, but *not* always come in pairs - en <- ends.rleD(d) + ## en <- ends.rleD(d) ## so maybe it does not really help! stop("all() is not yet implemented") @@ -519,7 +520,7 @@ setMethod("Arith", signature(e1 = "abIndex", e2 = "numLike"), }, "/" = { if(is0(e2) ## division by 0 - && length(unique(sign(ee <- ends.rleD(e1@rleD)))) > 1) { + && length(unique(sign(ends.rleD(e1@rleD)))) > 1) { ## at least one subsequence contains 0, i.e., changes sign: warning("x / 0 for an x with sign-change\n no longer representable as 'rleDiff'") return(vec2abI(abI2num(e1) / 0)) @@ -692,6 +693,7 @@ setAs("abIndex", "seqMat", function(from) ## we need to care for the "length 1" stretches: if(any(nonPair <- le[2* seq_len(m2 <- m %/% 2)] != 1)) { + m2 + n + va + nonPair # <- "dummy" using "unused" ## an "easy" (but not so efficient when 'm' is "large") ## way would be to "make these" into pairs, then work for that case... } diff --git a/R/bind2.R b/R/bind2.R index 8ea8d380..8dde25c1 100644 --- a/R/bind2.R +++ b/R/bind2.R @@ -7,51 +7,51 @@ ###-- Sparse ------------------------------------------------------------ setMethod("cbind2", signature(x = "sparseMatrix", y = "matrix"), - function(x, y) cbind2(x, .Call(dense_to_Csparse, y))) + function(x, y, ...) cbind2(x, .Call(dense_to_Csparse, y))) setMethod("cbind2", signature(x = "matrix", y = "sparseMatrix"), - function(x, y) cbind2(.Call(dense_to_Csparse, x), y)) + function(x, y, ...) cbind2(.Call(dense_to_Csparse, x), y)) setMethod("rbind2", signature(x = "sparseMatrix", y = "matrix"), - function(x, y) rbind2(x, .Call(dense_to_Csparse, y))) + function(x, y, ...) rbind2(x, .Call(dense_to_Csparse, y))) setMethod("rbind2", signature(x = "matrix", y = "sparseMatrix"), - function(x, y) rbind2(.Call(dense_to_Csparse, x), y)) + function(x, y, ...) rbind2(.Call(dense_to_Csparse, x), y)) ## originally from ./Matrix.R : ------------------------------- ## The trivial methods : setMethod("cbind2", signature(x = "Matrix", y = "NULL"), - function(x, y) x) + function(x, y, ...) x) setMethod("cbind2", signature(x = "Matrix", y = "missing"), - function(x, y) x) + function(x, y, ...) x) setMethod("cbind2", signature(x = "NULL", y="Matrix"), - function(x, y) x) + function(x, y, ...) x) ## using "atomicVector" not just "numeric" setMethod("cbind2", signature(x = "Matrix", y = "atomicVector"), - function(x, y) cbind2(x, matrix(y, nrow = nrow(x)))) + function(x, y, ...) cbind2(x, matrix(y, nrow = nrow(x)))) setMethod("cbind2", signature(x = "atomicVector", y = "Matrix"), - function(x, y) cbind2(matrix(x, nrow = nrow(y)), y)) + function(x, y, ...) cbind2(matrix(x, nrow = nrow(y)), y)) setMethod("cbind2", signature(x = "ANY", y = "Matrix"), - function(x, y) .bail.out.2(.Generic, class(x), class(y))) + function(x, y, ...) .bail.out.2(.Generic, class(x), class(y))) setMethod("cbind2", signature(x = "Matrix", y = "ANY"), - function(x, y) .bail.out.2(.Generic, class(x), class(y))) + function(x, y, ...) .bail.out.2(.Generic, class(x), class(y))) setMethod("rbind2", signature(x = "Matrix", y = "NULL"), - function(x, y) x) + function(x, y, ...) x) setMethod("rbind2", signature(x = "Matrix", y = "missing"), - function(x, y) x) + function(x, y, ...) x) setMethod("rbind2", signature(x = "NULL", y="Matrix"), - function(x, y) x) + function(x, y, ...) x) setMethod("rbind2", signature(x = "Matrix", y = "atomicVector"), - function(x, y) rbind2(x, matrix(y, ncol = ncol(x)))) + function(x, y, ...) rbind2(x, matrix(y, ncol = ncol(x)))) setMethod("rbind2", signature(x = "atomicVector", y = "Matrix"), - function(x, y) rbind2(matrix(x, ncol = ncol(y)), y)) + function(x, y, ...) rbind2(matrix(x, ncol = ncol(y)), y)) setMethod("rbind2", signature(x = "ANY", y = "Matrix"), - function(x, y) .bail.out.2(.Generic, class(x), class(y))) + function(x, y, ...) .bail.out.2(.Generic, class(x), class(y))) setMethod("rbind2", signature(x = "Matrix", y = "ANY"), - function(x, y) .bail.out.2(.Generic, class(x), class(y))) + function(x, y, ...) .bail.out.2(.Generic, class(x), class(y))) ## Makes sure one gets x decent error message for the unimplemented cases: setMethod("cbind2", signature(x = "Matrix", y = "Matrix"), - function(x, y) { + function(x, y, ...) { rowCheck(x,y) .bail.out.2("cbind2", class(x), class(y)) }) @@ -59,7 +59,7 @@ setMethod("cbind2", signature(x = "Matrix", y = "Matrix"), ## Use a working fall back {particularly useful for sparse}: ## FIXME: implement rbind2 via "cholmod" for C* and Tsparse ones setMethod("rbind2", signature(x = "Matrix", y = "Matrix"), - function(x, y) { + function(x, y, ...) { colCheck(x,y) t(cbind2(t(x), t(y))) }) @@ -68,7 +68,7 @@ setMethod("rbind2", signature(x = "Matrix", y = "Matrix"), ### cbind2 setMethod("cbind2", signature(x = "denseMatrix", y = "numeric"), - function(x, y) { + function(x, y, ...) { d <- dim(x); nr <- d[1]; nc <- d[2] y <- rep_len(y, nr) # 'silent procrustes' ## beware of (packed) triangular, symmetric, ... @@ -81,7 +81,7 @@ setMethod("cbind2", signature(x = "denseMatrix", y = "numeric"), }) ## the same, (x,y) <-> (y,x): setMethod("cbind2", signature(x = "numeric", y = "denseMatrix"), - function(x, y) { + function(x, y, ...) { d <- dim(y); nr <- d[1]; nc <- d[2] x <- rep_len(x, nr) y <- as(y, geClass(y)) @@ -94,9 +94,9 @@ setMethod("cbind2", signature(x = "numeric", y = "denseMatrix"), setMethod("cbind2", signature(x = "denseMatrix", y = "matrix"), - function(x, y) cbind2(x, as_geSimpl(y))) + function(x, y, ...) cbind2(x, as_geSimpl(y))) setMethod("cbind2", signature(x = "matrix", y = "denseMatrix"), - function(x, y) cbind2(as_geSimpl(x), y)) + function(x, y, ...) cbind2(as_geSimpl(x), y)) cbind2DN <- function(dnx,dny, ncx,ncy) { ## R and S+ are different in which names they take @@ -110,24 +110,33 @@ cbind2DN <- function(dnx,dny, ncx,ncy) { } setMethod("cbind2", signature(x = "denseMatrix", y = "denseMatrix"), - function(x, y) { - nr <- rowCheck(x,y) + function(x, y, ...) { + rowCheck(x,y) ncx <- x@Dim[2] ncy <- y@Dim[2] ## beware of (packed) triangular, symmetric, ... hasDN <- !is.null.DN(dnx <- dimnames(x)) | !is.null.DN(dny <- dimnames(y)) x <- as(x, geClass(x)) y <- as(y, geClass(y)) - x@x <- c(x@x, y@x) - x@Dim[2] <- ncx + ncy - if(hasDN) x@Dimnames <- cbind2DN(dnx,dny, ncx,ncy) - x + xx <- c(x@x, y@x) + ## be careful, e.g., if we have an 'n' and 'd' + if(identical((tr <- typeof(xx)), typeof(x@x))) { + x@x <- xx + x@Dim[2] <- ncx + ncy + if(hasDN) x@Dimnames <- cbind2DN(dnx,dny, ncx,ncy) + x + } else if(identical(tr, typeof(y@x))) { + y@x <- xx + y@Dim[2] <- ncx + ncy + if(hasDN) y@Dimnames <- cbind2DN(dnx,dny, ncx,ncy) + y + } else stop("resulting x-slot has different type than x's or y's") }) ### rbind2 -- analogous to cbind2 --- more to do for @x though: setMethod("rbind2", signature(x = "denseMatrix", y = "numeric"), - function(x, y) { + function(x, y, ...) { if(is.character(dn <- x@Dimnames[[1]])) dn <- c(dn, "") y <- rbind2(as(x,"matrix"), y) new(paste0(.M.kind(y), "geMatrix"), x = c(y), @@ -135,7 +144,7 @@ setMethod("rbind2", signature(x = "denseMatrix", y = "numeric"), }) ## the same, (x,y) <-> (y,x): setMethod("rbind2", signature(x = "numeric", y = "denseMatrix"), - function(x, y) { + function(x, y, ...) { if(is.character(dn <- y@Dimnames[[1]])) dn <- c("", dn) x <- rbind2(x, as(y,"matrix")) new(paste0(.M.kind(x), "geMatrix"), x = c(x), @@ -143,9 +152,9 @@ setMethod("rbind2", signature(x = "numeric", y = "denseMatrix"), }) setMethod("rbind2", signature(x = "denseMatrix", y = "matrix"), - function(x, y) rbind2(x, as_geSimpl(y))) + function(x, y, ...) rbind2(x, as_geSimpl(y))) setMethod("rbind2", signature(x = "matrix", y = "denseMatrix"), - function(x, y) rbind2(as_geSimpl(x), y)) + function(x, y, ...) rbind2(as_geSimpl(x), y)) rbind2DN <- function(dnx, dny, nrx,nry) { if(!is.null.DN(dnx) || !is.null.DN(dny)) { @@ -160,16 +169,30 @@ rbind2DN <- function(dnx, dny, nrx,nry) { } setMethod("rbind2", signature(x = "denseMatrix", y = "denseMatrix"), - function(x, y) { - nc <- colCheck(x,y) + function(x, y, ...) { + colCheck(x,y) nrx <- x@Dim[1] nry <- y@Dim[1] - dnx <- dimnames(x) - ## beware of (packed) triangular, symmetric, -> "cheap" (FIXME): - x <- rbind2(as(x,"matrix"), as(y,"matrix")) - new(paste0(.M.kind(x), "geMatrix"), x = c(x), - Dim = c(nrx + nry, nc), - Dimnames = rbind2DN(dnx, dimnames(y), nrx,nry)) + ## beware of (packed) triangular, symmetric, ... + hasDN <- !is.null.DN(dnx <- dimnames(x)) | !is.null.DN(dny <- dimnames(y)) + x <- as(x, geClass(x)) + y <- as(y, geClass(y)) + ## xx <- as.vector(.Internal(rbind(-1L, + ## array(x@x, dim=x@Dim), + ## array(y@x, dim=y@Dim)))) + xx <- .Call(R_rbind2_vector, x, y) + ## be careful, e.g., if we have an 'n' and 'd' + if(identical((tr <- typeof(xx)), typeof(x@x))) { + x@x <- xx + x@Dim[1] <- nrx + nry + if(hasDN) x@Dimnames <- rbind2DN(dnx,dny, nrx,nry) + x + } else if(identical(tr, typeof(y@x))) { + y@x <- xx + y@Dim[1] <- nrx + nry + if(hasDN) y@Dimnames <- rbind2DN(dnx,dny, nrx,nry) + y + } else stop("resulting x-slot has different type than x's or y's") }) ## originally from ./diagMatrix.R : -------------------------------------- @@ -180,37 +203,37 @@ setMethod("rbind2", signature(x = "denseMatrix", y = "denseMatrix"), diag2Sp <- function(x) suppressWarnings(as(x, "CsparseMatrix")) setMethod("cbind2", signature(x = "diagonalMatrix", y = "sparseMatrix"), - function(x,y) cbind2(diag2Sp(x), as(y,"CsparseMatrix"))) + function(x, y, ...) cbind2(diag2Sp(x), as(y,"CsparseMatrix"))) setMethod("cbind2", signature(x = "sparseMatrix", y = "diagonalMatrix"), - function(x,y) cbind2(as(x,"CsparseMatrix"), diag2Sp(y))) + function(x, y, ...) cbind2(as(x,"CsparseMatrix"), diag2Sp(y))) setMethod("rbind2", signature(x = "diagonalMatrix", y = "sparseMatrix"), - function(x,y) rbind2(diag2Sp(x), as(y,"CsparseMatrix"))) + function(x, y, ...) rbind2(diag2Sp(x), as(y,"CsparseMatrix"))) setMethod("rbind2", signature(x = "sparseMatrix", y = "diagonalMatrix"), - function(x,y) rbind2(as(x,"CsparseMatrix"), diag2Sp(y))) + function(x, y, ...) rbind2(as(x,"CsparseMatrix"), diag2Sp(y))) ## in order to evade method dispatch ambiguity, but still remain "general" ## we use this hack instead of signature x = "diagonalMatrix" for(cls in names(getClass("diagonalMatrix")@subclasses)) { setMethod("cbind2", signature(x = cls, y = "matrix"), - function(x,y) cbind2(diag2Sp(x), .Call(dense_to_Csparse, y))) + function(x, y, ...) cbind2(diag2Sp(x), .Call(dense_to_Csparse, y))) setMethod("cbind2", signature(x = "matrix", y = cls), - function(x,y) cbind2(.Call(dense_to_Csparse, x), diag2Sp(y))) + function(x, y, ...) cbind2(.Call(dense_to_Csparse, x), diag2Sp(y))) setMethod("rbind2", signature(x = cls, y = "matrix"), - function(x,y) rbind2(diag2Sp(x), .Call(dense_to_Csparse, y))) + function(x, y, ...) rbind2(diag2Sp(x), .Call(dense_to_Csparse, y))) setMethod("rbind2", signature(x = "matrix", y = cls), - function(x,y) rbind2(.Call(dense_to_Csparse, x), diag2Sp(y))) + function(x, y, ...) rbind2(.Call(dense_to_Csparse, x), diag2Sp(y))) ## These are already defined for "Matrix" ## -- repeated here for method dispatch disambiguation {"design-FIXME" ?} setMethod("cbind2", signature(x = cls, y = "atomicVector"), - function(x, y) cbind2(x, matrix(y, nrow = nrow(x)))) + function(x, y, ...) cbind2(x, matrix(y, nrow = nrow(x)))) setMethod("cbind2", signature(x = "atomicVector", y = cls), - function(x, y) cbind2(matrix(x, nrow = nrow(y)), y)) + function(x, y, ...) cbind2(matrix(x, nrow = nrow(y)), y)) setMethod("rbind2", signature(x = cls, y = "atomicVector"), - function(x, y) rbind2(x, matrix(y, ncol = ncol(x)))) + function(x, y, ...) rbind2(x, matrix(y, ncol = ncol(x)))) setMethod("rbind2", signature(x = "atomicVector", y = cls), - function(x, y) rbind2(matrix(x, ncol = ncol(y)), y)) + function(x, y, ...) rbind2(matrix(x, ncol = ncol(y)), y)) } @@ -223,7 +246,7 @@ for(cls in names(getClass("diagonalMatrix")@subclasses)) { .cbind2Csp <- function(x,y) .Call(Csparse_horzcat, as_Csp2(x), as_Csp2(y)) .rbind2Csp <- function(x,y) .Call(Csparse_vertcat, as_Csp2(x), as_Csp2(y)) -cbind2Sparse <- function(x,y) { +cbind2sparse <- function(x,y) { ## beware of (packed) triangular, symmetric, ... if(identical(c(dnx <- dimnames(x), dny <- dimnames(y)), @@ -244,12 +267,12 @@ cbind2Sparse <- function(x,y) { } } setMethod("cbind2", signature(x = "sparseMatrix", y = "sparseMatrix"), - function(x, y) { - nr <- rowCheck(x,y) - cbind2Sparse(x,y) + function(x, y, ...) { + rowCheck(x,y) + cbind2sparse(x,y) }) -rbind2Sparse <- function(x,y) { +rbind2sparse <- function(x,y) { ## beware of (packed) triangular, symmetric, ... if(identical(c(dnx <- dimnames(x), dny <- dimnames(y)), @@ -270,71 +293,71 @@ rbind2Sparse <- function(x,y) { } } setMethod("rbind2", signature(x = "sparseMatrix", y = "sparseMatrix"), - function(x, y) { - nc <- colCheck(x,y) - rbind2Sparse(x,y) + function(x, y, ...) { + colCheck(x,y) + rbind2sparse(x,y) }) if(length(formals(cbind2)) >= 3) { ## newer R -- can use optional 'sparse = NA' setMethod("cbind2", signature(x = "sparseMatrix", y = "denseMatrix"), - function(x, y, sparse = NA) { + function(x, y, sparse = NA, ...) { nr <- rowCheck(x,y) if(is.na(sparse)) # result is sparse if "enough zeros" <==> sparseDefault() in Matrix() sparse <- (nnzero(x)+nnzero(y)) * 2 < nr * (ncol(x)+ncol(y)) - if(sparse) cbind2Sparse(x,y) else cbind2(as(x, "denseMatrix"), y) + if(sparse) cbind2sparse(x,y) else cbind2(as(x, "denseMatrix"), y) }) setMethod("cbind2", signature(x = "denseMatrix", y = "sparseMatrix"), - function(x, y, sparse = NA) { + function(x, y, sparse = NA, ...) { nr <- rowCheck(x,y) if(is.na(sparse)) # result is sparse if "enough zeros" <==> sparseDefault() in Matrix() sparse <- (nnzero(x)+nnzero(y)) * 2 < nr * (ncol(x)+ncol(y)) - if(sparse) cbind2Sparse(x,y) else cbind2(x, as(y, "denseMatrix")) + if(sparse) cbind2sparse(x,y) else cbind2(x, as(y, "denseMatrix")) }) setMethod("rbind2", signature(x = "sparseMatrix", y = "denseMatrix"), - function(x, y, sparse = NA) { + function(x, y, sparse = NA, ...) { nc <- colCheck(x,y) if(is.na(sparse)) # result is sparse if "enough zeros" <==> sparseDefault() in Matrix() sparse <- (nnzero(x)+nnzero(y)) * 2 < (nrow(x)+nrow(y)) * nc - if(sparse) rbind2Sparse(x,y) else rbind2(as(x, "denseMatrix"), y) + if(sparse) rbind2sparse(x,y) else rbind2(as(x, "denseMatrix"), y) }) setMethod("rbind2", signature(x = "denseMatrix", y = "sparseMatrix"), - function(x, y, sparse = NA) { + function(x, y, sparse = NA, ...) { nc <- colCheck(x,y) if(is.na(sparse)) # result is sparse if "enough zeros" <==> sparseDefault() in Matrix() sparse <- (nnzero(x)+nnzero(y)) * 2 < (nrow(x)+nrow(y)) * nc - if(sparse) rbind2Sparse(x,y) else rbind2(x, as(y, "denseMatrix")) + if(sparse) rbind2sparse(x,y) else rbind2(x, as(y, "denseMatrix")) }) } else { ## older version of R -- cbind2() has no "..." setMethod("cbind2", signature(x = "sparseMatrix", y = "denseMatrix"), - function(x, y) { + function(x, y, ...) { nr <- rowCheck(x,y) ## result is sparse if "enough zeros" <==> sparseDefault() in Matrix() sparse <- (nnzero(x)+nnzero(y)) * 2 < nr * (ncol(x)+ncol(y)) - if(sparse) cbind2Sparse(x,y) else cbind2(as(x, "denseMatrix"), y) + if(sparse) cbind2sparse(x,y) else cbind2(as(x, "denseMatrix"), y) }) setMethod("cbind2", signature(x = "denseMatrix", y = "sparseMatrix"), - function(x, y) { + function(x, y, ...) { nr <- rowCheck(x,y) ## result is sparse if "enough zeros" <==> sparseDefault() in Matrix() sparse <- (nnzero(x)+nnzero(y)) * 2 < nr * (ncol(x)+ncol(y)) - if(sparse) cbind2Sparse(x,y) else cbind2(x, as(y, "denseMatrix")) + if(sparse) cbind2sparse(x,y) else cbind2(x, as(y, "denseMatrix")) }) setMethod("rbind2", signature(x = "sparseMatrix", y = "denseMatrix"), - function(x, y) { + function(x, y, ...) { nc <- colCheck(x,y) ## result is sparse if "enough zeros" <==> sparseDefault() in Matrix() sparse <- (nnzero(x)+nnzero(y)) * 2 < (nrow(x)+nrow(y)) * nc - if(sparse) rbind2Sparse(x,y) else rbind2(as(x, "denseMatrix"), y) + if(sparse) rbind2sparse(x,y) else rbind2(as(x, "denseMatrix"), y) }) setMethod("rbind2", signature(x = "denseMatrix", y = "sparseMatrix"), - function(x, y) { + function(x, y, ...) { nc <- colCheck(x,y) ## result is sparse if "enough zeros" <==> sparseDefault() in Matrix() sparse <- (nnzero(x)+nnzero(y)) * 2 < (nrow(x)+nrow(y)) * nc - if(sparse) rbind2Sparse(x,y) else rbind2(x, as(y, "denseMatrix")) + if(sparse) rbind2sparse(x,y) else rbind2(x, as(y, "denseMatrix")) }) }# older R -- no "sparse = NA" @@ -346,7 +369,7 @@ if(FALSE) { ##------------- maybe a bit faster --- but too much to maintain ## would have to be done for "rbind2" as well ... setMethod("cbind2", signature(x = "sparseMatrix", y = "numeric"), - function(x, y) { + function(x, y, ...) { d <- dim(x); nr <- d[1]; nc <- d[2]; cl <- class(x) x <- as(x, "CsparseMatrix") if(nr > 0) { @@ -366,7 +389,7 @@ setMethod("cbind2", signature(x = "sparseMatrix", y = "numeric"), }) ## the same, (x,y) <-> (y,x): setMethod("cbind2", signature(x = "numeric", y = "sparseMatrix"), - function(x, y) { + function(x, y, ...) { d <- dim(y); nr <- d[1]; nc <- d[2]; cl <- class(y) y <- as(y, "CsparseMatrix") if(nr > 0) { @@ -388,7 +411,7 @@ setMethod("cbind2", signature(x = "numeric", y = "sparseMatrix"), ## Can be made very efficient setMethod("rbind2", signature(x = "indMatrix", y = "indMatrix"), - function(x, y) { + function(x, y, ...) { dx <- x@Dim dy <- y@Dim if(dx[2] != dy[2]) diff --git a/R/dMatrix.R b/R/dMatrix.R index 31b470c5..100d61a7 100644 --- a/R/dMatrix.R +++ b/R/dMatrix.R @@ -18,20 +18,22 @@ setAs("nMatrix", "dMatrix", ## NOTE: This is *VERY* parallel to ("lMatrix" -> "nMatrix") in ./lMatrix.R : setAs("dMatrix", "nMatrix", function(from) { - if(any(is.na(from@x))) - stop("\"dMatrix\" object with NAs cannot be coerced to \"nMatrix\"") - ## i.e. from@x are only TRUE (or FALSE in dense case) + if(anyNA(from@x) && ((.w <- isTRUE(getOption("Matrix.warn"))) || + isTRUE(getOption("Matrix.verbose")))) { + (if(.w) warning else message)( + "\"dMatrix\" object with NAs coerced to \"nMatrix\": NA |-> TRUE") + from@x[is.na(from@x)] <- 1 # "TRUE" + } cld <- getClassDef(cl <- MatrixClass(class(from))) - if(extends(cld, "diagonalMatrix")) { # have no "ndi*" etc class - cl <- class(from <- as(from, "sparseMatrix")) - isSp <- TRUE - } else { - isSp <- extends(cld, "sparseMatrix") - if(isSp && any(from@x == 0)) { - from <- drop0(from) # was drop0(from, cld) - if(cl != (c. <- class(from))) - cld <- getClassDef(cl <- c.) - } + if(extends(cld, "diagonalMatrix")) # no "ndi*" class + ## should not happen, setAs(diagonalMatrix -> nMatrix) in ./diagMatrix.R: + return(di2nMat(from)) + ## else + isSp <- extends(cld, "sparseMatrix") + if(isSp && any(from@x == 0)) { + from <- drop0(from) # was drop0(from, cld) + if(cl != (c. <- class(from))) + cld <- getClassDef(cl <- c.) } sNams <- slotNames(cld) r <- copyClass(from, sub("^d", "n", cl), sNams[sNams != "x"]) diff --git a/R/ddenseMatrix.R b/R/ddenseMatrix.R index 71ce90fe..df20a247 100644 --- a/R/ddenseMatrix.R +++ b/R/ddenseMatrix.R @@ -4,11 +4,10 @@ ## >> but << needs all sub(sub(sub)) classes of "ddenseMatrix" listed ## ----- in ../src/Mutils.c -setAs("ddenseMatrix", "dgeMatrix", - function(from) .Call(dup_mMatrix_as_dgeMatrix, from)) +setAs("ddenseMatrix", "dgeMatrix", ..2dge) setAs("ddenseMatrix", "matrix", - function(from) as(as(from, "dgeMatrix"), "matrix")) + function(from) as(..2dge(from), "matrix")) ## d(ouble) to l(ogical): setAs("dgeMatrix", "lgeMatrix", function(from) d2l_Matrix(from, "dgeMatrix")) @@ -43,8 +42,7 @@ setAs("numeric", "CsparseMatrix", function(from) .Call(dense_to_Csparse, .Call(dup_mMatrix_as_dgeMatrix, from))) -setMethod("as.numeric", signature(x = "ddenseMatrix"), - function(x, ...) as(x, "dgeMatrix")@x) +setMethod("as.numeric", "ddenseMatrix", function(x, ...) ..2dge(x)@x) ## -- see also ./Matrix.R e.g., for a show() method @@ -53,50 +51,50 @@ setMethod("as.numeric", signature(x = "ddenseMatrix"), ## dgeMatrix. Methods for special forms override these. setMethod("norm", signature(x = "ddenseMatrix", type = "missing"), - function(x, type, ...) norm(as(x, "dgeMatrix"))) + function(x, type, ...) norm(..2dge(x))) setMethod("norm", signature(x = "ddenseMatrix", type = "character"), - function(x, type, ...) norm(as(x, "dgeMatrix"), type)) + function(x, type, ...) norm(..2dge(x), type)) setMethod("rcond", signature(x = "ddenseMatrix", norm = "missing"), - function(x, norm, ...) rcond(as(x, "dgeMatrix"), ...)) + function(x, norm, ...) rcond(..2dge(x), ...)) setMethod("rcond", signature(x = "ddenseMatrix", norm = "character"), - function(x, norm, ...) rcond(as(x, "dgeMatrix"), norm, ...)) + function(x, norm, ...) rcond(..2dge(x), norm, ...)) ## Not really useful; now require *identical* class for result: ## setMethod("t", signature(x = "ddenseMatrix"), -## function(x) callGeneric(as(x, "dgeMatrix"))) +## function(x) callGeneric(..2dge(x))) ## "diag" --> specific methods for dge, dtr,dtp, dsy,dsp setMethod("solve", signature(a = "ddenseMatrix", b = "missing"), - function(a, b, ...) solve(as(a, "dgeMatrix"))) + function(a, b, ...) solve(..2dge(a))) for(.b in c("Matrix","ANY")) ## << against ambiguity notes setMethod("solve", signature(a = "ddenseMatrix", b = .b), - function(a, b, ...) solve(as(a, "dgeMatrix"), b)) + function(a, b, ...) solve(..2dge(a), b)) for(.b in c("matrix","numeric")) ## << against ambiguity notes setMethod("solve", signature(a = "ddenseMatrix", b = .b), - function(a, b, ...) solve(as(a, "dgeMatrix"), Matrix(b))) + function(a, b, ...) solve(..2dge(a), Matrix(b))) rm(.b) setMethod("lu", signature(x = "ddenseMatrix"), function(x, ...) - .set.factors(x, "LU", lu(as(x, "dgeMatrix"), ...))) + .set.factors(x, "LU", lu(..2dge(x), ...))) setMethod("chol", signature(x = "ddenseMatrix"), cholMat) setMethod("determinant", signature(x = "ddenseMatrix", logarithm = "missing"), - function(x, logarithm, ...) determinant(as(x, "dgeMatrix"))) + function(x, logarithm, ...) determinant(..2dge(x))) setMethod("determinant", signature(x = "ddenseMatrix", logarithm = "logical"), function(x, logarithm, ...) - determinant(as(x, "dgeMatrix"), logarithm)) + determinant(..2dge(x), logarithm)) ## now done for "dMatrix": ## setMethod("expm", signature(x = "ddenseMatrix"), -## function(x) callGeneric(as(x, "dgeMatrix"))) +## function(x) callGeneric(..2dge(x))) .trilDense <- function(x, k = 0, ...) { diff --git a/R/denseMatrix.R b/R/denseMatrix.R index b52ba5f7..044a10c2 100644 --- a/R/denseMatrix.R +++ b/R/denseMatrix.R @@ -7,7 +7,7 @@ setAs("ANY", "denseMatrix", function(from) Matrix(from, sparse=FALSE)) ## setAs("matrix", "denseMatrix", ....) which was slightly more efficient than ## Matrix(.) but would have many things in common -setAs(from = "denseMatrix", to = "generalMatrix", as_geSimpl) +setAs("denseMatrix", "generalMatrix", as_geSimpl) ## dense to sparse: ## : if we do this, do it "right", i.e. preserve symmetric/triangular! @@ -16,19 +16,26 @@ setAs(from = "denseMatrix", to = "generalMatrix", as_geSimpl) ## ## function(from) as(as(from, "dgeMatrix"), "dsparseMatrix")) ## function(from) as(as(from, "dgeMatrix"), "dgCMatrix")) -.dense2C <- function(from) { - cl <- class(from) - cld <- getClassDef(cl) ## get it once (speedup) +.dense2C <- function(from, kind = NA, uplo = "U") { + useK <- is.character(kind) && length(kind) == 1 && + kind %in% c("gen", "sym", "tri") + if(!useK) { + cl <- class(from) + cld <- getClassDef(cl) ## get it once (speedup) + } r <- .Call(dense_to_Csparse, from)# goes via "generalMatrix" ## FIXME: for symmetric / triangular matrices, this is a waste, notably if packed - - if (extends(cld, "generalMatrix")) + if (useK && kind == "gen" || !useK && extends(cld, "generalMatrix")) r - else if(extends(cld, "symmetricMatrix")) - forceSymmetric(r) - else if(extends(cld, "diagonalMatrix")) + else if(useK && kind == "sym" || !useK && extends(cld, "symmetricMatrix")) + forceCspSymmetric(r, uplo, isTri = FALSE) + else if(!useK && extends(cld, "diagonalMatrix")) stop("diagonalMatrix in .dense2C() -- should never happen, please report!") else { ## we have "triangular" : + if(useK) { + cl <- class(from) + cld <- getClassDef(cl) ## get it once (speedup) + } if (extends(cld,"dMatrix")) as(r, "dtCMatrix") else if (extends(cld,"lMatrix")) as(r, "ltCMatrix") else if (extends(cld,"nMatrix")) as(r, "ntCMatrix") @@ -37,7 +44,7 @@ setAs(from = "denseMatrix", to = "generalMatrix", as_geSimpl) } } -setAs("denseMatrix", "CsparseMatrix", .dense2C) +setAs("denseMatrix", "CsparseMatrix", function(from) .dense2C(from)) ## This sometimes fails (eg. for "lsyMatrix"), and we really want to ## use the generic ``go via Csparse'' (top of ./sparseMatrix.R) instead diff --git a/R/dgCMatrix.R b/R/dgCMatrix.R index 9cb92e79..2d1cc489 100644 --- a/R/dgCMatrix.R +++ b/R/dgCMatrix.R @@ -10,8 +10,7 @@ ## setAs("dgCMatrix", "dgeMatrix", .... ## setAs("dgeMatrix", "dgCMatrix", .... -setAs("dgCMatrix", "ngCMatrix", - function(from) .Call(Csparse_to_nz_pattern, from, FALSE)) +setAs("dgCMatrix", "ngCMatrix", function(from) .C2nC(from, FALSE)) ## rather use Csparse* to lsparse* in ./lsparseMatrix.R , ## but this is for "back-compatibility" (have had tests for it..): @@ -93,7 +92,7 @@ setMethod("lu", signature(x = "sparseMatrix"), } n <- dim(a)[1L] ## == dim(a)[2], as a[.,.] is square matrix b.isMat <- - if((b.miss <- missing(b))) { + if(missing(b)) { ## default b = Identity = Diagonal(nrow(a)), however more efficiently b <- .sparseDiagonal(n) TRUE diff --git a/R/dgeMatrix.R b/R/dgeMatrix.R index 44e46068..67aa52cc 100644 --- a/R/dgeMatrix.R +++ b/R/dgeMatrix.R @@ -1,6 +1,5 @@ -##' works for vectors, matrix, .. -..2dge <- function(from) .Call(dup_mMatrix_as_dgeMatrix, from) +## ..2dge() -> ./Auxiliaries.R setAs("matrix", "dgeMatrix", ..2dge) setAs("numLike", "dgeMatrix", ..2dge) diff --git a/R/diagMatrix.R b/R/diagMatrix.R index c555190a..ac27894d 100644 --- a/R/diagMatrix.R +++ b/R/diagMatrix.R @@ -281,7 +281,7 @@ setAs("ldiMatrix", "symmetricMatrix", function(from) .diag2sT(from, "U", "l")) rm(di2tT) setAs("diagonalMatrix", "nMatrix", - function(from) { + di2nMat <- function(from) { i <- if(from@diag == "U") integer(0) else which(isN0(from@x)) - 1L new("ntTMatrix", i = i, j = i, diag = from@diag, Dim = from@Dim, Dimnames = from@Dimnames) @@ -334,11 +334,11 @@ setAs("diagonalMatrix", "denseMatrix", m } -setAs("ddiMatrix", "dgeMatrix", - function(from) .Call(dup_mMatrix_as_dgeMatrix, from)) -setAs("ddiMatrix", "ddenseMatrix", +setAs("ddiMatrix", "dgeMatrix", ..2dge) + +setAs("ddiMatrix", "ddenseMatrix", #-> "dtr" function(from) as(as(from, "triangularMatrix"),"denseMatrix")) -setAs("ldiMatrix", "ldenseMatrix", +setAs("ldiMatrix", "ldenseMatrix", #-> "ltr" function(from) as(as(from, "triangularMatrix"),"denseMatrix")) @@ -577,29 +577,77 @@ diagdiagprod <- function(x, y) { return(y) } +##' Boolean Algebra/Arithmetic Product of Diagonal Matrices +##' %&% +diagdiagprodBool <- function(x, y) { + dimCheck(x,y) + if(x@diag != "U") { + if(!is.logical(x@x)) x <- as(x, "lMatrix") + if(y@diag != "U") { + nx <- x@x & y@x + x@x <- as.logical(nx) + } + x + } else { ## x is unit diagonal: return y + if(!is.logical(y@x)) y <- as(y, "lMatrix") + y + } +} + setMethod("%*%", signature(x = "diagonalMatrix", y = "diagonalMatrix"), diagdiagprod, valueClass = "ddiMatrix") +setMethod("%&%", signature(x = "diagonalMatrix", y = "diagonalMatrix"), + diagdiagprodBool, valueClass = "ldiMatrix")# do *not* have "ndiMatrix" ! +##' Both Numeric or Boolean Algebra/Arithmetic Product of Diagonal Matrices +diagdiagprodFlexi <- function(x, y=NULL, boolArith = NA, ...) +{ + dimCheck(x,y) + bool <- isTRUE(boolArith) + if(x@diag != "U") { + if(bool && !is.logical(x@x)) x <- as(x, "lMatrix") + if(y@diag != "U") { + if(bool) { + nx <- x@x & y@x + x@x <- as.logical(nx) + } else { ## boolArith is NA or FALSE: ==> numeric, as have *no* "diagMatrix" patter[n]: + nx <- x@x * y@x + if(is.numeric(nx) && !is.numeric(x@x)) + x <- as(x, "dMatrix") + x@x <- as.numeric(nx) + } + } + x + } else { ## x is unit diagonal: return y + if(bool && !is.logical(y@x)) y <- as(y, "lMatrix") + y + } +} setMethod("crossprod", signature(x = "diagonalMatrix", y = "diagonalMatrix"), - diagdiagprod, valueClass = "ddiMatrix") + diagdiagprodFlexi) setMethod("tcrossprod", signature(x = "diagonalMatrix", y = "diagonalMatrix"), - diagdiagprod, valueClass = "ddiMatrix") + diagdiagprodFlexi) ##' crossprod(x) := x'x -diagprod <- function(x) { +diagprod <- function(x, y = NULL, boolArith = NA, ...) { + bool <- isTRUE(boolArith) + if(bool && !is.logical(x@x)) x <- as(x, "lMatrix") if(x@diag != "U") { - nx <- x@x * x@x - if(is.numeric(nx) && !is.numeric(x@x)) - x <- as(x, "dMatrix") - x@x <- as.numeric(nx) + if(bool) { + nx <- x@x & y@x + x@x <- as.logical(nx) + } else { ## boolArith is NA or FALSE: ==> numeric, as have *no* "diagMatrix" patter[n]: + nx <- x@x * x@x + if(is.numeric(nx) && !is.numeric(x@x)) + x <- as(x, "dMatrix") + x@x <- as.numeric(nx) + } } x } -setMethod("crossprod", signature(x = "diagonalMatrix", y = "missing"), - diagprod, valueClass = "ddiMatrix") -setMethod("tcrossprod", signature(x = "diagonalMatrix", y = "missing"), - diagprod, valueClass = "ddiMatrix") +setMethod( "crossprod", signature(x = "diagonalMatrix", y = "missing"), diagprod) +setMethod("tcrossprod", signature(x = "diagonalMatrix", y = "missing"), diagprod) ## analogous to matdiagprod() below: @@ -608,9 +656,15 @@ diagmatprod <- function(x, y) { if(x@Dim[2] != nrow(y)) stop("non-matching dimensions") Matrix(if(x@diag == "U") y else x@x * y) } -setMethod("%*%", signature(x = "diagonalMatrix", y = "matrix"), - diagmatprod) -setMethod("crossprod", signature(x = "diagonalMatrix", y = "matrix"), diagmatprod) +setMethod("%*%", signature(x = "diagonalMatrix", y = "matrix"), diagmatprod) + +formals(diagmatprod) <- alist(x=, y=NULL, boolArith = NA, ...=) ## FIXME boolArith +diagmatprod2 <- function(x, y=NULL, boolArith = NA, ...) { + ## x is diagonalMatrix + if(x@Dim[2] != nrow(y)) stop("non-matching dimensions") + Matrix(if(x@diag == "U") y else x@x * y) +} +setMethod("crossprod", signature(x = "diagonalMatrix", y = "matrix"), diagmatprod2) diagGeprod <- function(x, y) { if(x@Dim[2] != y@Dim[1]) stop("non-matching dimensions") @@ -620,10 +674,27 @@ diagGeprod <- function(x, y) { } setMethod("%*%", signature(x= "diagonalMatrix", y= "dgeMatrix"), diagGeprod) setMethod("%*%", signature(x= "diagonalMatrix", y= "lgeMatrix"), diagGeprod) -setMethod("crossprod", signature(x = "diagonalMatrix", y = "dgeMatrix"), - diagGeprod, valueClass = "dgeMatrix") -setMethod("crossprod", signature(x = "diagonalMatrix", y = "lgeMatrix"), - diagGeprod) + +diagGeprodBool <- function(x, y) { + if(x@Dim[2] != y@Dim[1]) stop("non-matching dimensions") + if(!is.logical(y@x)) y <- as(y, "lMatrix") + if(x@diag != "U") + y@x <- x@x & y@x + y +} +setMethod("%&%", signature(x= "diagonalMatrix", y= "geMatrix"), diagGeprodBool) + +diagGeprod2 <- function(x, y=NULL, boolArith = NA, ...) { + if(x@Dim[2] != y@Dim[1]) stop("non-matching dimensions") + bool <- isTRUE(boolArith) + if(bool && !is.logical(y@x)) y <- as(y, "lMatrix") + if(x@diag != "U") + y@x <- if(bool) x@x & y@x else x@x * y@x + y +} +setMethod("crossprod", signature(x = "diagonalMatrix", y = "dgeMatrix"), diagGeprod2) +setMethod("crossprod", signature(x = "diagonalMatrix", y = "lgeMatrix"), diagGeprod2) + ## analogous to diagmatprod() above: matdiagprod <- function(x, y) { @@ -632,13 +703,6 @@ matdiagprod <- function(x, y) { Matrix(if(y@diag == "U") x else x * rep(y@x, each = dx[1])) } setMethod("%*%", signature(x = "matrix", y = "diagonalMatrix"), matdiagprod) -setMethod("tcrossprod",signature(x = "matrix", y = "diagonalMatrix"), matdiagprod) -setMethod("crossprod", signature(x = "matrix", y = "diagonalMatrix"), - function(x, y) { - dx <- dim(x) - if(dx[1] != y@Dim[1]) stop("non-matching dimensions") - Matrix(t(rep.int(y@x, dx[2]) * x)) - }) gediagprod <- function(x, y) { dx <- dim(x) @@ -649,10 +713,52 @@ gediagprod <- function(x, y) { } setMethod("%*%", signature(x= "dgeMatrix", y= "diagonalMatrix"), gediagprod) setMethod("%*%", signature(x= "lgeMatrix", y= "diagonalMatrix"), gediagprod) -setMethod("tcrossprod", signature(x = "dgeMatrix", y = "diagonalMatrix"), - gediagprod) -setMethod("tcrossprod", signature(x = "lgeMatrix", y = "diagonalMatrix"), - gediagprod) + +gediagprodBool <- function(x, y) { + dx <- dim(x) + if(dx[2] != y@Dim[1]) stop("non-matching dimensions") + if(!is.logical(x@x)) x <- as(x, "lMatrix") + if(y@diag == "N") + x@x <- x@x & rep(y@x, each = dx[1]) + x +} +setMethod("%&%", signature(x= "geMatrix", y= "diagonalMatrix"), gediagprodBool) + +setMethod("tcrossprod",signature(x = "matrix", y = "diagonalMatrix"), + function(x, y=NULL, boolArith = NA, ...) { + dx <- dim(x) + if(dx[2] != y@Dim[1]) stop("non-matching dimensions") + bool <- isTRUE(boolArith) + if(bool && !is.logical(y@x)) y <- as(y, "lMatrix") + Matrix(if(y@diag == "U") x else + if(bool) x & rep(y@x, each = dx[1]) + else x * rep(y@x, each = dx[1])) + }) + +setMethod("crossprod", signature(x = "matrix", y = "diagonalMatrix"), + function(x, y=NULL, boolArith = NA, ...) { + dx <- dim(x) + if(dx[1] != y@Dim[1]) stop("non-matching dimensions") + bool <- isTRUE(boolArith) + if(bool && !is.logical(y@x)) y <- as(y, "lMatrix") + Matrix(if(bool) t(rep.int(y@x, dx[2]) & x) + else t(rep.int(y@x, dx[2]) * x)) + }) + + +gediagprod2 <- function(x, y=NULL, boolArith = NA, ...) { + dx <- dim(x) + if(dx[2] != y@Dim[1]) stop("non-matching dimensions") + bool <- isTRUE(boolArith) + if(bool && !is.logical(x@x)) x <- as(x, "lMatrix") + if(y@diag == "N") + x@x <- if(bool) x@x & rep(y@x, each = dx[1]) + else x@x * rep(y@x, each = dx[1]) + x +} +setMethod("tcrossprod", signature(x = "dgeMatrix", y = "diagonalMatrix"), gediagprod2) +setMethod("tcrossprod", signature(x = "lgeMatrix", y = "diagonalMatrix"), gediagprod2) + ## crossprod {more of these} @@ -672,88 +778,143 @@ setMethod("%*%", signature(x = "denseMatrix", y = "diagonalMatrix"), ##' @param x CsparseMatrix ##' @param y diagonalMatrix ##' @return x %*% y -Cspdiagprod <- function(x, y) { - m <- ncol(x <- .Call(Csparse_diagU2N, x)) - if(m != y@Dim[1]) stop("non-matching dimensions") +Cspdiagprod <- function(x, y, boolArith = NA, ...) { + if((m <- ncol(x)) != y@Dim[1]) stop("non-matching dimensions") if(y@diag == "N") { ## otherwise: y == Diagonal(n) : multiplication is identity - if(!all(y@x[1L] == y@x[-1L]) && is(x, "symmetricMatrix")) + x <- .Call(Csparse_diagU2N, x) + cx <- getClass(class(x)) + if(!all(y@x[1L] == y@x[-1L]) && extends(cx, "symmetricMatrix")) x <- as(x, "generalMatrix") ind <- rep.int(seq_len(m), x@p[-1] - x@p[-m-1L]) - x@x <- x@x * y@x[ind] + if(isTRUE(boolArith)) { + if(extends(cx, "nMatrix")) x <- as(x, "lMatrix") # so, has y@x + x@x <- r <- x@x & y@x[x@i + 1L] + if(!anyNA(r) && !extends(cx, "diagonalMatrix")) x <- as(drop0(x), "nMatrix") + } else { + if(!extends(cx, "dMatrix")) x <- as(x, "dMatrix") # <- FIXME if we have zMatrix + x@x <- x@x * y@x[ind] + } if(.hasSlot(x, "factors") && length(x@factors)) {# drop cashed ones ## instead of dropping all factors, be smart about some ## TODO ...... x@factors <- list() } + x + } else { # y is unit-diagonal ==> "return x" + cx <- getClass(class(x)) + if(isTRUE(boolArith)) { + is.l <- if(extends(cx, "dMatrix")) { ## <- FIXME: extend once we have iMatrix, zMatrix + x <- as(x, "lMatrix"); TRUE } else extends(cx, "lMatrix") + if(is.l && !anyNA(x@x)) as(drop0(x), "nMatrix") + else if(is.l) x else # defensive: + as(x, "lMatrix") + } else { + ## else boolArith is NA or FALSE {which are equivalent here, das diagonal = "numLike"} + if(extends(cx, "nMatrix") || extends(cx, "lMatrix")) + as(x, "dMatrix") else x + } } - x } ##' @param x diagonalMatrix ##' @param y CsparseMatrix ##' @return x %*% y -diagCspprod <- function(x, y) { - y <- .Call(Csparse_diagU2N, y) +diagCspprod <- function(x, y, boolArith = NA, ...) { if(x@Dim[2] != y@Dim[1]) stop("non-matching dimensions") if(x@diag == "N") { - if(!all(x@x[1L] == x@x[-1L]) && is(y, "symmetricMatrix")) + y <- .Call(Csparse_diagU2N, y) + cy <- getClass(class(y)) + if(!all(x@x[1L] == x@x[-1L]) && extends(cy, "symmetricMatrix")) y <- as(y, "generalMatrix") - y@x <- y@x * x@x[y@i + 1L] - if(.hasSlot(y, "factors") && length(yf <- y@factors)) { - ## TODO - if(FALSE) { ## instead of dropping all factors, be smart about some - keep <- character() - if(any(iLU <- names(yf) == "LU")) { - keep <- "LU" - } - y@factors <- yf[keep] - } else y@factors <- list() ## for now + if(isTRUE(boolArith)) { + if(extends(cy, "nMatrix")) y <- as(y, "lMatrix") # so, has y@x + y@x <- r <- y@x & x@x[y@i + 1L] + if(!anyNA(r) && !extends(cy, "diagonalMatrix")) y <- as(drop0(y), "nMatrix") + } else { + if(!extends(cy, "dMatrix")) y <- as(y, "dMatrix") # <- FIXME if we have zMatrix + y@x <- y@x * x@x[y@i + 1L] + } + if(.hasSlot(y, "factors") && length(y@factors)) { + ## if(.hasSlot(y, "factors") && length(yf <- y@factors)) { ## -- TODO? -- + ## instead of dropping all factors, be smart about some + ## keep <- character() + ## if(any(names(yf) == "LU")) { ## <- not easy: y = P'LUQ, x y = xP'LUQ => LU ??? + ## keep <- "LU" + ## } + ## y@factors <- yf[keep] + y@factors <- list() } + y + } else { ## x @ diag == "U" + cy <- getClass(class(y)) + if(isTRUE(boolArith)) { + is.l <- if(extends(cy, "dMatrix")) { ## <- FIXME: extend once we have iMatrix, zMatrix + y <- as(y, "lMatrix"); TRUE } else extends(cy, "lMatrix") + if(is.l && !anyNA(y@x)) as(drop0(y), "nMatrix") + else if(is.l) y else # defensive: + as(y, "lMatrix") + } else { + ## else boolArith is NA or FALSE {which are equivalent here, das diagonal = "numLike"} + if(extends(cy, "nMatrix") || extends(cy, "lMatrix")) + as(y, "dMatrix") else y + } } - y } +## + 'boolArith' argument { ==> .local() is used in any case; keep formals simple :} setMethod("crossprod", signature(x = "diagonalMatrix", y = "CsparseMatrix"), - function(x, y = NULL) diagCspprod(x, y)) + function(x, y=NULL, boolArith=NA, ...) diagCspprod(x, y, boolArith=boolArith)) setMethod("crossprod", signature(x = "diagonalMatrix", y = "sparseMatrix"), - function(x, y = NULL) diagCspprod(x, as(y, "CsparseMatrix"))) + function(x, y=NULL, boolArith=NA, ...) + diagCspprod(x, as(y, "CsparseMatrix"), boolArith=boolArith)) ## Prefer calling diagCspprod to Cspdiagprod if going to transpose anyway ## x'y == (y'x)' setMethod("crossprod", signature(x = "CsparseMatrix", y = "diagonalMatrix"), - function(x, y = NULL) t(diagCspprod(y, x))) + function(x, y=NULL, boolArith=NA, ...) t(diagCspprod(y, x, boolArith=boolArith))) setMethod("crossprod", signature(x = "sparseMatrix", y = "diagonalMatrix"), - function(x, y = NULL) t(diagCspprod(y, as(x, "Csparsematrix")))) + function(x, y=NULL, boolArith=NA, ...) t(diagCspprod(y, as(x, "Csparsematrix"), boolArith=boolArith))) setMethod("tcrossprod", signature(x = "diagonalMatrix", y = "CsparseMatrix"), - function(x, y = NULL) diagCspprod(x, t(y))) + function(x, y=NULL, boolArith=NA, ...) diagCspprod(x, t(y), boolArith=boolArith)) setMethod("tcrossprod", signature(x = "diagonalMatrix", y = "sparseMatrix"), - function(x, y = NULL) diagCspprod(x, t(as(y, "CsparseMatrix")))) + function(x, y=NULL, boolArith=NA, ...) diagCspprod(x, t(as(y, "CsparseMatrix")), boolArith=boolArith)) setMethod("tcrossprod", signature(x = "CsparseMatrix", y = "diagonalMatrix"), - function(x, y = NULL) Cspdiagprod(x, y)) + function(x, y=NULL, boolArith=NA, ...) Cspdiagprod(x, y, boolArith=boolArith)) setMethod("tcrossprod", signature(x = "sparseMatrix", y = "diagonalMatrix"), - function(x, y = NULL) Cspdiagprod(as(x, "CsparseMatrix"), y)) + function(x, y=NULL, boolArith=NA, ...) Cspdiagprod(as(x, "CsparseMatrix"), y, boolArith=boolArith)) setMethod("%*%", signature(x = "diagonalMatrix", y = "CsparseMatrix"), - function(x, y) diagCspprod(x, y)) + function(x, y) diagCspprod(x, y, boolArith=NA)) +setMethod("%&%", signature(x = "diagonalMatrix", y = "CsparseMatrix"), + function(x, y) diagCspprod(x, y, boolArith=TRUE)) ## instead of "sparseMatrix", use: [RT]sparse.. ("closer" in method dispatch) for(cl in c("TsparseMatrix", "RsparseMatrix")) { setMethod("%*%", signature(x = "diagonalMatrix", y = "sparseMatrix"), - function(x, y) diagCspprod(as(x, "CsparseMatrix"), y)) + function(x, y) diagCspprod(as(x, "CsparseMatrix"), y, boolArith=NA)) setMethod("%*%", signature(x = "sparseMatrix", y = "diagonalMatrix"), - function(x, y) Cspdiagprod(as(x, "CsparseMatrix"), y)) + function(x, y) Cspdiagprod(as(x, "CsparseMatrix"), y, boolArith=NA)) + +setMethod("%&%", signature(x = "diagonalMatrix", y = "sparseMatrix"), + function(x, y) diagCspprod(as(x, "CsparseMatrix"), y, boolArith=TRUE)) + +setMethod("%&%", signature(x = "sparseMatrix", y = "diagonalMatrix"), + function(x, y) Cspdiagprod(as(x, "CsparseMatrix"), y, boolArith=TRUE)) + } setMethod("%*%", signature(x = "CsparseMatrix", y = "diagonalMatrix"), - function(x, y) Cspdiagprod(x, y)) + function(x, y) Cspdiagprod(x, y, boolArith=NA)) +setMethod("%&%", signature(x = "CsparseMatrix", y = "diagonalMatrix"), + function(x, y) Cspdiagprod(x, y, boolArith=TRUE)) ## TODO: Write tests in ./tests/ which ensure that many "ops" with diagonal* ## do indeed work by going through sparse (and *not* ddense)! @@ -819,7 +980,7 @@ diagOdiag <- function(e1,e2) { xx <- as.vector(matrix(rbind(r, matrix(r00,n,n)), n,n)) newcl <- paste0(if(isNum) "d" else if(isLog) { - if(!any(is.na(r)) && !any(is.na(r00))) "n" else "l" + if(!anyNA(r) && !anyNA(r00)) "n" else "l" } else stop("not yet implemented .. please report"), "syMatrix") new(newcl, Dim = e1@Dim, Dimnames = e1@Dimnames, x = xx) @@ -1091,8 +1252,10 @@ for(other in c("ANY", "Matrix", "dMatrix")) { } ## Direct subclasses of "denseMatrix": currently ddenseMatrix, ldense... : +if(FALSE) # now also contains "geMatrix" dense.subCl <- local({ dM.scl <- getClass("denseMatrix")@subclasses names(dM.scl)[vapply(dM.scl, slot, 0, "distance") == 1] }) +dense.subCl <- paste0(c("d","l","n"), "denseMatrix") for(DI in diCls) { dMeth <- if(extends(DI, "dMatrix")) function(e1,e2) callGeneric(diag2Tsmart(e1,e2, "d"), e2) diff --git a/R/dsCMatrix.R b/R/dsCMatrix.R index 49cbfcdb..c12b2c8e 100644 --- a/R/dsCMatrix.R +++ b/R/dsCMatrix.R @@ -100,9 +100,8 @@ solve.dsC.dC <- function(a,b, LDL = NA, tol = .Machine$double.eps) { setMethod("solve", signature(a = "dsCMatrix", b = "ddenseMatrix"), function(a, b, LDL = NA, tol = .Machine$double.eps, ...) { - if (class(b) != "dgeMatrix") - b <- .Call(dup_mMatrix_as_dgeMatrix, b) - solve.dsC.mat(a,b, LDL=LDL, tol=tol) + solve.dsC.mat(a, b = if(!is(b, "dgeMatrix")) ..2dge(b) else b, + LDL=LDL, tol=tol) }, valueClass = "dgeMatrix") setMethod("solve", signature(a = "dsCMatrix", b = "denseMatrix"), @@ -113,12 +112,12 @@ setMethod("solve", signature(a = "dsCMatrix", b = "denseMatrix"), setMethod("solve", signature(a = "dsCMatrix", b = "matrix"), function(a, b, LDL = NA, tol = .Machine$double.eps, ...) - solve.dsC.mat(a, .Call(dup_mMatrix_as_dgeMatrix, b), LDL=LDL, tol=tol), + solve.dsC.mat(a, ..2dge(b), LDL=LDL, tol=tol), valueClass = "dgeMatrix") setMethod("solve", signature(a = "dsCMatrix", b = "numeric"), function(a, b, LDL = NA, tol = .Machine$double.eps, ...) - solve.dsC.mat(a, .Call(dup_mMatrix_as_dgeMatrix, b), LDL=LDL, tol=tol), + solve.dsC.mat(a, ..2dge(b), LDL=LDL, tol=tol), valueClass = "dgeMatrix") ## . ------------------------ @@ -197,7 +196,7 @@ setMethod("determinant", signature(x = "dsCMatrix", logarithm = "missing"), setMethod("determinant", signature(x = "dsCMatrix", logarithm = "logical"), function(x, logarithm, ...) { - if((n <- x@Dim[1]) <= 1) + if(x@Dim[1] <= 1L) return(mkDet(diag(x), logarithm)) Chx <- tryCatch(suppressWarnings(Cholesky(x, LDL=TRUE)), error = function(e) NULL) diff --git a/R/dsTMatrix.R b/R/dsTMatrix.R index 4cb6618c..8d97f55b 100644 --- a/R/dsTMatrix.R +++ b/R/dsTMatrix.R @@ -27,7 +27,7 @@ setAs("matrix", "dsTMatrix", to_dsT) setMethod("t", "dsTMatrix", function(x) - new("dsTMatrix", Dim = x@Dim, Dimnames = x@Dimnames, + new("dsTMatrix", Dim = x@Dim, Dimnames = x@Dimnames[2:1], i = x@j, j = x@i, x = x@x, uplo = if (x@uplo == "U") "L" else "U")) diff --git a/R/dsyMatrix.R b/R/dsyMatrix.R index 3b04a3b7..6e937e86 100644 --- a/R/dsyMatrix.R +++ b/R/dsyMatrix.R @@ -32,13 +32,13 @@ setAs("dsyMatrix", "dspMatrix", .dsy2dsp) dsy2T <- function(from) { # 'dsT': only store upper *or* lower uplo <- from@uplo - if(any((d <- dim(from)) == 0)) { + if(any0(dim(from))) { ij <- matrix(0L, 0,2) ; m <- from@x } else { ## FIXME! working via "matrix" is *not* efficient: ## the "other triangle" is filled, compared with 0, and then trashed: m <- .Call(dsyMatrix_as_matrix, from, FALSE) # no dimnames! - ij <- which(m != 0, arr.ind = TRUE) + ij <- which(m != 0, arr.ind = TRUE, useNames = FALSE) ij <- ij[if(uplo == "U") ij[,1] <= ij[,2] else ij[,1] >= ij[,2], , drop = FALSE] } new("dsTMatrix", i = ij[,1] - 1L, j = ij[,2] - 1L, diff --git a/R/dtrMatrix.R b/R/dtrMatrix.R index 91314d8f..be277571 100644 --- a/R/dtrMatrix.R +++ b/R/dtrMatrix.R @@ -8,8 +8,10 @@ setAs("dgeMatrix", "dtrMatrix", function(from) asTri(from, "dtrMatrix")) setAs("dtrMatrix", "dtpMatrix", dtr2dtp <- function(from) .Call(dtrMatrix_as_dtpMatrix, from)) -setAs("dtrMatrix", "sparseMatrix", .dense2C) -setAs("dtrMatrix", "CsparseMatrix", .dense2C) +setAs("dtrMatrix", "sparseMatrix", function(from) + .dense2C(from, kind="tri", uplo=from@uplo)) +setAs("dtrMatrix", "CsparseMatrix", function(from) + .dense2C(from, kind="tri", uplo=from@uplo)) .dtr2mat <- function(from, keep.dimnames=TRUE) @@ -19,7 +21,7 @@ setAs("dtrMatrix", "matrix", function(from) .Call(dtrMatrix_as_matrix, from, TRUE)) setAs("matrix", "dtrMatrix", - function(from) as(.Call(dup_mMatrix_as_dgeMatrix, from), "dtrMatrix")) + function(from) as(..2dge(from), "dtrMatrix")) setAs("Cholesky", "lMatrix", function(from) as(as(from, "dtrMatrix"), "lMatrix")) diff --git a/R/indMatrix.R b/R/indMatrix.R index d8687b0b..dd8ee07f 100644 --- a/R/indMatrix.R +++ b/R/indMatrix.R @@ -60,7 +60,6 @@ setAs("nMatrix", "indMatrix", function(from) { from <- as(as(from, "TsparseMatrix"), "ngTMatrix") n <- (d <- from@Dim)[1] - if(n < d[2]) stop("not a skinny matrix") if(length(i <- from@i) != n) stop("the number of non-zero entries differs from nrow(.)") if((need.sort <- is.unsorted(i))) { @@ -127,9 +126,9 @@ setMethod("tcrossprod", signature(x = "Matrix", y = "indMatrix"), setMethod("tcrossprod", signature(x = "indMatrix", y = "indMatrix"), function(x, y) { mmultCheck(x,y, 3L); x[, y@perm] }) - setMethod("crossprod", signature(x = "indMatrix", y = "missing"), - function(x, y=NULL) Diagonal(x=as.numeric(table(x@perm)))) + function(x, y=NULL) Diagonal(x = tabulate(x@perm, nbins=x@Dim[2L]))) + setMethod("tcrossprod", signature(x = "indMatrix", y = "missing"), function(x, y=NULL) x[,x@perm]) @@ -137,12 +136,9 @@ setMethod("tcrossprod", signature(x = "indMatrix", y = "missing"), setMethod("kronecker", signature(X = "indMatrix", Y = "indMatrix"), function (X, Y, FUN = "*", make.dimnames = FALSE, ...) { if (FUN != "*") stop("kronecker method must use default 'FUN'") -## perm <- as.integer(interaction(rep(X@perm, each =Y@Dim[1]), -## rep(Y@perm, times=X@Dim[1]), -## lex.order=TRUE)) - ## this is wrong if any of the columns in X or Y are empty because interaction() - ## drops non-occuring levels from a non-factor. Explicitly defining a factor - ## with levels 1:ncol(.) avoids that. + ## Explicitly defining a factor with levels 1:ncol(.) avoids that + ## interaction() drops non-occuring levels when any of the + ## columns in X or Y are empty: perm <- as.integer(interaction(factor(rep(X@perm, each =Y@Dim[1]), levels=seq_len(X@Dim[2])), factor(rep.int(Y@perm, times=X@Dim[1]), diff --git a/R/lMatrix.R b/R/lMatrix.R index f7b59cb6..7b45b5f9 100644 --- a/R/lMatrix.R +++ b/R/lMatrix.R @@ -4,20 +4,23 @@ setAs("matrix", "lMatrix", ## NOTE: This is *VERY* parallel to ("dMatrix" -> "nMatrix") in ./dMatrix.R : setAs("lMatrix", "nMatrix", function(from) { - if(any(is.na(from@x))) - stop("\"lMatrix\" object with NAs cannot be coerced to \"nMatrix\"") - ## i.e. from@x are only TRUE or FALSE + if(anyNA(from@x) && ((.w <- isTRUE(getOption("Matrix.warn"))) || + isTRUE(getOption("Matrix.verbose")))) { + (if(.w) warning else message)( + "\"lMatrix\" object with NAs coerced to \"nMatrix\": NA |-> TRUE") + from@x[is.na(from@x)] <- TRUE + } + ## ==> from@x are in {TRUE, FALSE} cld <- getClassDef(cl <- MatrixClass(class(from))) - if(extends(cld, "diagonalMatrix")) { # have no "ndi*" etc class - cl <- class(from <- as(from, "sparseMatrix")) - isSp <- TRUE - } else { - isSp <- extends(cld, "sparseMatrix") - if(isSp && !all(from@x)) { - from <- drop0(from) # was drop0(from, cld) - if(cl != (c. <- class(from))) - cld <- getClassDef(cl <- c.) - } + if(extends(cld, "diagonalMatrix")) # no "ndi*" class + ## should not happen, setAs(diagonalMatrix -> nMatrix) in ./diagMatrix.R: + return(di2nMat(from)) + ## else + isSp <- extends(cld, "sparseMatrix") + if(isSp && !all(from@x)) { + from <- drop0(from) # was drop0(from, cld) + if(cl != (c. <- class(from))) + cld <- getClassDef(cl <- c.) } sNams <- slotNames(cld) copyClass(from, sub("^l", "n", cl), @@ -38,7 +41,7 @@ setAs("nMatrix", "lMatrix", setAs("dMatrix", "lMatrix", function(from) { - cld <- getClassDef(newCl <- class2(cl <- class(from), "l")) + cld <- getClassDef(newCl <- class2(class(from), "l")) sNams <- slotNames(cld) r <- copyClass(from, newCl, sNames = sNams[sNams != "x"]) r@x <- as.logical(from@x) @@ -68,6 +71,7 @@ setMethod("which", "ldiMatrix", i <- if(x@diag == "U") seq_len(n) else which(x@x) if(arr.ind) cbind(i,i, deparse.level = 0) else i + n*(i - 1L) }) +## FIXME?: not 100% compatible to "base :: which" -- here useNames=FALSE hardcoded! whichDense <- function(x, arr.ind = FALSE) { wh <- which(x@x) ## faster but "forbidden": .Internal(which(x@x)) if (arr.ind && !is.null(d <- dim(x))) @@ -79,16 +83,17 @@ setMethod("which", "ldenseMatrix", function(x, arr.ind) whichDense(as(x, "lgeMatrix"), arr.ind=arr.ind)) setMethod("which", "nsparseMatrix", - function(x, arr.ind) { - if(arr.ind) which(as(x, "TsparseMatrix"), arr.ind=TRUE) + function(x, arr.ind, useNames = TRUE) { + if(arr.ind) which(as(x, "TsparseMatrix"), arr.ind=TRUE, useNames=useNames) else as(x, "sparseVector")@i }) setMethod("which", "lsparseMatrix", - function(x, arr.ind) { - if(arr.ind) which(as(x, "TsparseMatrix"), arr.ind=TRUE) + function(x, arr.ind, useNames = TRUE) { + if(arr.ind) which(as(x, "TsparseMatrix"), arr.ind=TRUE, useNames=useNames) else which(as(x, "sparseVector")) }) +## FIXME?: not 100% compatible to "base :: which" -- here useNames=FALSE hardcoded! which.ngT <- function(x, arr.ind) if(arr.ind) cbind(x@i, x@j) + 1L else as(x, "sparseVector")@i setMethod("which", "ngTMatrix", which.ngT) @@ -97,6 +102,7 @@ setMethod("which", "ntTMatrix", function(x, arr.ind) setMethod("which", "nsTMatrix", function(x, arr.ind) which.ngT(as(x, "generalMatrix"), arr.ind)) +## FIXME?: not 100% compatible to "base :: which" -- here useNames=FALSE hardcoded! which.lgT <- function(x, arr.ind) { if(arr.ind) { iT <- is1(x@x) diff --git a/R/ldenseMatrix.R b/R/ldenseMatrix.R index d15340da..e338bf7a 100644 --- a/R/ldenseMatrix.R +++ b/R/ldenseMatrix.R @@ -102,10 +102,10 @@ setAs("ldenseMatrix", "matrix", ## uses the above l*M. -> lgeM. ## dense |-> compressed : setAs("lgeMatrix", "lgTMatrix", - function(from) as(.dense2C(from), "lgTMatrix")) + function(from) as(.dense2C(from, kind = "gen"), "lgTMatrix")) -setAs("lgeMatrix", "lgCMatrix", - function(from) as(as(from, "lgTMatrix"), "lgCMatrix")) +setAs("lgeMatrix", "lgCMatrix", # TODO: need as(*, ..) ? + function(from) as(.dense2C(from, kind = "gen"), "lgCMatrix")) setMethod("as.logical", signature(x = "ldenseMatrix"), function(x, ...) as(x, "lgeMatrix")@x) diff --git a/R/lgTMatrix.R b/R/lgTMatrix.R index 1ad6696b..ac87fde7 100644 --- a/R/lgTMatrix.R +++ b/R/lgTMatrix.R @@ -20,7 +20,7 @@ setAs("matrix", "lgTMatrix", dn <- list(NULL,NULL) else dimnames(from) <- NULL TorNA <- is.na(from) | from - ij <- which(TorNA, arr.ind = TRUE) - 1L + ij <- which(TorNA, arr.ind = TRUE, useNames = FALSE) - 1L if(length(ij) == 0) ij <- matrix(ij, 0, 2) new("lgTMatrix", i = ij[,1], diff --git a/R/lsTMatrix.R b/R/lsTMatrix.R index d1d616ef..a8784020 100644 --- a/R/lsTMatrix.R +++ b/R/lsTMatrix.R @@ -25,6 +25,6 @@ setAs("lsTMatrix", "lsyMatrix", setMethod("t", "lsTMatrix", function(x) - new("lsTMatrix", Dim = x@Dim, Dimnames = x@Dimnames, + new("lsTMatrix", Dim = x@Dim, Dimnames = x@Dimnames[2:1], i = x@j, j = x@i, x = x@x, uplo = if (x@uplo == "U") "L" else "U")) diff --git a/R/lsparseMatrix.R b/R/lsparseMatrix.R index 5b7ddf51..4380c37d 100644 --- a/R/lsparseMatrix.R +++ b/R/lsparseMatrix.R @@ -2,7 +2,7 @@ C2l <- function(from) { - if(extends(cld <- getClassDef(cl <- class(from)), "lsparseMatrix")) + if(extends(cld <- getClassDef(class(from)), "lsparseMatrix")) return(from) ## else if(!(is.n <- extends(cld, "nsparseMatrix"))) { @@ -10,8 +10,7 @@ C2l <- function(from) { from <- .Call(Csparse_drop, from, 0) ## did.drop <- length(from@x) != len.x } - r <- as(.Call(Csparse_to_nz_pattern, from, extends(cld, "triangularMatrix")), - "lsparseMatrix") + r <- as(.C2nC(from, extends(cld, "triangularMatrix")), "lsparseMatrix") if(!is.n && any(ina <- is.na(from@x))) { ## NAs must remain NA ## since we dropped, we "know" that the 'x' slots match: stopifnot(length(from@x) == length(r@x)) diff --git a/R/ndenseMatrix.R b/R/ndenseMatrix.R index 96e449aa..ffb57cd3 100644 --- a/R/ndenseMatrix.R +++ b/R/ndenseMatrix.R @@ -7,7 +7,7 @@ ## packed <-> non-packed : -setAs("nspMatrix", "nsyMatrix", ## vv for "n*", 0L for "l*" +setAs("nspMatrix", "nsyMatrix", ## 1L for "n*", 0L for "l*" : vv nsp2nsy <- function(from) .Call(lspMatrix_as_lsyMatrix, from, 1L)) setAs("nsyMatrix", "nspMatrix", @@ -112,14 +112,15 @@ setAs("ndenseMatrix", "matrix", ## uses the above l*M. -> lgeM. ## go via "l" because dense_to_Csparse can't be used for "n" [missing CHOLMOD function] setAs("ndenseMatrix", "CsparseMatrix", function(from) as(as(as(from, "lMatrix"), "CsparseMatrix"), "nMatrix")) -## setAs("ndenseMatrix", "sparseMatrix", -## function(from) as(as(as(from, "lMatrix"), "sparseMatrix"), "nMatrix")) +setAs("ndenseMatrix", "nsparseMatrix", + function(from) as(as(as(from, "lMatrix"), "sparseMatrix"), "nMatrix")) +setAs("ndenseMatrix", "sparseMatrix", function(from) as(from, "nsparseMatrix")) setAs("ndenseMatrix", "TsparseMatrix", function(from) { if(is(from, "generalMatrix")) { ## cheap but not so efficient: - ij <- which(as(from,"matrix"), arr.ind = TRUE) - 1L + ij <- which(as(from,"matrix"), arr.ind = TRUE, useNames = FALSE) - 1L new("ngTMatrix", i = ij[,1], j = ij[,2], Dim = from@Dim, Dimnames = from@Dimnames, factors = from@factors) @@ -135,7 +136,7 @@ setAs("ndenseMatrix", "TsparseMatrix", setAs("ngeMatrix", "ngTMatrix", function(from) { ## cheap but not so efficient: - ij <- which(as(from,"matrix"), arr.ind = TRUE) - 1L + ij <- which(as(from,"matrix"), arr.ind = TRUE, useNames = FALSE) - 1L new("ngTMatrix", i = ij[,1], j = ij[,2], Dim = from@Dim, Dimnames = from@Dimnames, factors = from@factors) diff --git a/R/ngCMatrix.R b/R/ngCMatrix.R index bd949b7a..fecfb52d 100644 --- a/R/ngCMatrix.R +++ b/R/ngCMatrix.R @@ -2,39 +2,27 @@ ### contains = "nsparseMatrix" -nC2d <- function(from) .Call(nz_pattern_to_Csparse, from, 0L)## 0 --> "double" -nC2l <- function(from) .Call(nz_pattern_to_Csparse, from, 1L)## 1 --> "logical" +.nC2d <- function(from) .Call(nz_pattern_to_Csparse, from, 0L)## 0 --> "double" +.nC2l <- function(from) .Call(nz_pattern_to_Csparse, from, 1L)## 1 --> "logical" if(FALSE) { ## nice idea, but needs more method re-definitions --- -setAs("nCsparseMatrix", "dMatrix", nC2d) -setAs("nCsparseMatrix", "dsparseMatrix", nC2d) -setAs("nCsparseMatrix", "dgCMatrix", nC2d) +setAs("nCsparseMatrix", "dMatrix", .nC2d) +setAs("nCsparseMatrix", "dsparseMatrix", .nC2d) +setAs("nCsparseMatrix", "dgCMatrix", .nC2d) -setAs("nCsparseMatrix", "lMatrix", nC2l) -setAs("nCsparseMatrix", "lsparseMatrix", nC2l) -setAs("nCsparseMatrix", "lgCMatrix", nC2l) +setAs("nCsparseMatrix", "lMatrix", .nC2l) +setAs("nCsparseMatrix", "lsparseMatrix", .nC2l) +setAs("nCsparseMatrix", "lgCMatrix", .nC2l) } else { -setAs("ngCMatrix", "dMatrix", nC2d) -setAs("ngCMatrix", "dsparseMatrix", nC2d) -setAs("ngCMatrix", "dgCMatrix", nC2d) +setAs("ngCMatrix", "dMatrix", .nC2d) +setAs("ngCMatrix", "dsparseMatrix", .nC2d) +setAs("ngCMatrix", "dgCMatrix", .nC2d) -setAs("ngCMatrix", "lMatrix", nC2l) -setAs("ngCMatrix", "lsparseMatrix", nC2l) -setAs("ngCMatrix", "lgCMatrix", nC2l) +setAs("ngCMatrix", "lMatrix", .nC2l) +setAs("ngCMatrix", "lsparseMatrix", .nC2l) +setAs("ngCMatrix", "lgCMatrix", .nC2l) } -if(FALSE) ## rather use ("Csparse*, to= "Tsparse*"): -setAs("ngCMatrix", "ngTMatrix", - function(from) new("ngTMatrix", i = from@i, - j = .Call(Matrix_expand_pointers, from@p), - Dim = from@Dim, Dimnames = from@Dimnames)) - -if(FALSE) ## rather use ("Csparse*, to= "dense*"): -setAs("ngCMatrix", "ngeMatrix", - function(from) - new("ngeMatrix", x = c(as(from, "matrix")), # is fast, - Dim = from@Dim, Dimnames = from@Dimnames)) - setAs("ngCMatrix", "matrix", function(from) .Call(ngC_to_matrix, from)) ## not this: .Call(Csparse_to_matrix, from)), since it goes via dense -> double precision diff --git a/R/ngTMatrix.R b/R/ngTMatrix.R index 49e786d3..a8039d3a 100644 --- a/R/ngTMatrix.R +++ b/R/ngTMatrix.R @@ -20,13 +20,13 @@ setAs("matrix", "ngTMatrix", function(from) { if(!is.logical(from)) storage.mode(from) <- "logical" - if(any(is.na(from))) + if(anyNA(from)) stop("cannot coerce 'NA's to \"nsparseMatrix\"") dn <- dimnames(from) if(is.null.DN(dn)) dn <- list(NULL,NULL) else dimnames(from) <- NULL # such that which(.) does not see any: - ij <- which(from, arr.ind = TRUE) - 1L + ij <- which(from, arr.ind = TRUE, useNames = FALSE) - 1L if(length(ij) == 0) ij <- matrix(ij, 0, 2) new("ngTMatrix", i = ij[,1], diff --git a/R/nnzero.R b/R/nnzero.R index d90e5e2f..b12c806b 100644 --- a/R/nnzero.R +++ b/R/nnzero.R @@ -28,7 +28,7 @@ setMethod("nnzero", "sparseMatrix", nn <- switch(.sp.class(cl), "CsparseMatrix" = x@p[d[2]+1L],# == length(x@i) only if not over-alloc. "TsparseMatrix" = { - if(is_duplicatedT(x, di = d)) + if(anyDuplicatedT(x, di = d)) x <- .Call(Tsparse_to_Csparse, x, iTri) length(x@i) }, diff --git a/R/not.R b/R/not.R index a4c6cc8a..f4179924 100644 --- a/R/not.R +++ b/R/not.R @@ -107,7 +107,7 @@ setMethod("!", "sparseVector", else { ## sparse result ii <- seq_len(n)[-x@i] if((has.x <- !is(x, "nsparseVector"))) { - xx <- rep.int(TRUE, (l.i <- length(ii))) + xx <- rep.int(TRUE, length(ii)) if((.na <- any(x.na <- is.na(x@x))) | (.fa <- any(x.f <- !x.na & !x@x))) { ## deal with 'FALSE' and 'NA' in x slot diff --git a/R/nsCMatrix.R b/R/nsCMatrix.R index 1ca9545d..387de1b4 100644 --- a/R/nsCMatrix.R +++ b/R/nsCMatrix.R @@ -13,28 +13,15 @@ setAs("nsCMatrix", "ngCMatrix", setAs("nsCMatrix", "nsTMatrix", function(from) .Call(Csparse_to_Tsparse, from, FALSE)) -## --- these now happen using "nCsparseMatrix" -- in ./ngCMatrix.R -## -## .nsC2d <- function(from) -## new("dsCMatrix", i = from@i, p = from@p, -## x = rep.int(1, length(from@i)), uplo = from@uplo, -## Dim = from@Dim, Dimnames = from@Dimnames) - -## .nsC2l <- function(from) -## new("lsCMatrix", i = from@i, p = from@p, -## x = rep.int(TRUE, length(from@i)), uplo = from@uplo, -## Dim = from@Dim, Dimnames = from@Dimnames) ## Not needed, once we use "nCsparseMatrix" (-> ./ngCMatrix.R ): -setAs("nsCMatrix", "dMatrix", nC2d) -setAs("nsCMatrix", "dsparseMatrix", nC2d) -setAs("nsCMatrix", "dsCMatrix", nC2d) +setAs("nsCMatrix", "dMatrix", .nC2d) +setAs("nsCMatrix", "dsparseMatrix", .nC2d) +setAs("nsCMatrix", "dsCMatrix", .nC2d) ## -setAs("nsCMatrix", "lMatrix", nC2l) -setAs("nsCMatrix", "lsparseMatrix", nC2l) -setAs("nsCMatrix", "lsCMatrix", nC2l) - -## rm(.nsC2d,.nsC2l) # don't even keep "hidden" +setAs("nsCMatrix", "lMatrix", .nC2l) +setAs("nsCMatrix", "lsparseMatrix", .nC2l) +setAs("nsCMatrix", "lsCMatrix", .nC2l) ## have rather tril() and triu() methods than ## setAs("nsCMatrix", "ntCMatrix", ....) diff --git a/R/nsTMatrix.R b/R/nsTMatrix.R index 1ff9eed6..b241ca5c 100644 --- a/R/nsTMatrix.R +++ b/R/nsTMatrix.R @@ -23,5 +23,5 @@ setAs("nsTMatrix", "nsyMatrix", setMethod("t", "nsTMatrix", function(x) - new("nsTMatrix", Dim = x@Dim, Dimnames = x@Dimnames, + new("nsTMatrix", Dim = x@Dim, Dimnames = x@Dimnames[2:1], i = x@j, j = x@i, uplo = if (x@uplo == "U") "L" else "U")) diff --git a/R/nsparseMatrix.R b/R/nsparseMatrix.R index 57b96e2c..abdc52e2 100644 --- a/R/nsparseMatrix.R +++ b/R/nsparseMatrix.R @@ -1,11 +1,10 @@ #### Superclass Methods for all sparse nonzero-pattern matrices -setAs("CsparseMatrix", "nsparseMatrix", - function(from) .Call(Csparse_to_nz_pattern, from, - is(from, "triangularMatrix"))) -setAs("CsparseMatrix", "nMatrix", - function(from) .Call(Csparse_to_nz_pattern, from, - is(from, "triangularMatrix"))) +.C2nC <- function(from, isTri = is(from, "triangularMatrix")) + .Call(Csparse_to_nz_pattern, from, isTri) + +setAs("CsparseMatrix", "nsparseMatrix", function(from) .C2nC(from)) +setAs("CsparseMatrix", "nMatrix", function(from) .C2nC(from)) setAs("nsparseMatrix", "dsparseMatrix", function(from) as(from, "dMatrix")) diff --git a/R/ntCMatrix.R b/R/ntCMatrix.R index f2bae615..2d79d24f 100644 --- a/R/ntCMatrix.R +++ b/R/ntCMatrix.R @@ -12,36 +12,21 @@ setAs("ntCMatrix", "ngCMatrix", function(from) copyClass(diagU2N(from), "ngCMatrix")) -## --- these now happen using "nCsparseMatrix" -- in ./ngCMatrix.R -## -## .ntC2d <- function(from) -## new("dtCMatrix", i = from@i, p = from@p, -## x = rep.int(1, length(from@i)), uplo = from@uplo, -## diag = from@diag, Dim = from@Dim, Dimnames = from@Dimnames) - -## .ntC2l <- function(from) -## new("ltCMatrix", i = from@i, p = from@p, -## x = rep.int(TRUE, length(from@i)), uplo = from@uplo, -## diag = from@diag, Dim = from@Dim, Dimnames = from@Dimnames) - -## Not needed, once we use "nCsparseMatrix" (-> ./ngCMatrix.R ): -setAs("ntCMatrix", "dMatrix", nC2d) -setAs("ntCMatrix", "dsparseMatrix", nC2d) -setAs("ntCMatrix", "dtCMatrix", nC2d) + +## "FIXME": Not needed, once we use "nCsparseMatrix" (-> ./ngCMatrix.R ): +setAs("ntCMatrix", "dMatrix", .nC2d) +setAs("ntCMatrix", "dsparseMatrix", .nC2d) +setAs("ntCMatrix", "dtCMatrix", .nC2d) ## -setAs("ntCMatrix", "lMatrix", nC2l) -setAs("ntCMatrix", "lsparseMatrix", nC2l) -setAs("ntCMatrix", "ltCMatrix", nC2l) +setAs("ntCMatrix", "lMatrix", .nC2l) +setAs("ntCMatrix", "lsparseMatrix", .nC2l) +setAs("ntCMatrix", "ltCMatrix", .nC2l) -## rm(.ntC2d,.ntC2l) # don't even keep "hidden" setAs("ngCMatrix", "ntCMatrix", # to triangular, needed for triu,.. function(from) as(as(as(from, "TsparseMatrix"), "ntTMatrix"), "ntCMatrix")) -## setAs("ntCMatrix", "generalMatrix", -## function(from) ......) - ## setMethod("t", signature(x = "ntCMatrix"), ## function(x) .Call(ntCMatrix_trans, x), ## valueClass = "ntCMatrix") diff --git a/R/pMatrix.R b/R/pMatrix.R index fdcba27e..2c75dd28 100644 --- a/R/pMatrix.R +++ b/R/pMatrix.R @@ -74,8 +74,7 @@ setMethod("%*%", signature(x = "Matrix", y = "pMatrix"), setMethod("%*%", signature(x = "pMatrix", y = "pMatrix"), function(x, y) { - stopifnot(identical(d <- x@Dim, y@Dim)) - ## n <- d[1] + stopifnot(identical(x@Dim, y@Dim)) ## FIXME: dimnames dealing: as with S3 matrix's %*% x@perm <- x@perm[y@perm] x diff --git a/R/products.R b/R/products.R index ca3730de..48831ba7 100644 --- a/R/products.R +++ b/R/products.R @@ -1,7 +1,7 @@ #### All %*%, crossprod() and tcrossprod() methods of the Matrix package #### ^^^ ---------------------------------------------------------- -### with EXCEPTIONS: ./diagMatrix.R -### ./indMatrix.R ./pMatrix.R +### with EXCEPTIONS: ./diagMatrix.R ./indMatrix.R ./pMatrix.R +### ~~~~~~~~~~ ------------ ----------- --------- ### NOTA BENE: vector %*% Matrix _and_ Matrix %*% vector ### --------- The k-vector is treated as (1,k)-matrix *or* (k,1)-matrix @@ -26,25 +26,34 @@ } ## For tcrossprod() : -.v.Mt <- function(x, y) { +.v.Mt <- function(x, y=NULL, boolArith=NA, ...) { + ##_ Not needed: y is never "missing", when used: + ##_ if(is.null(y)) y <- x dim(x) <- if(ncol(y) == (n <- length(x))) c(1L, n) else c(n, 1L) - tcrossprod(x, y) + tcrossprod(x, y, boolArith=boolArith, ...) } ## tcrossprod(, ) -.M.vt <- function(x, y) tcrossprod(x, - if(nrow(x) == 1L) - spV2M(y, nrow=1L, ncol=y@length, check=FALSE) - else - spV2M(y, nrow=y@length, ncol=1L, check=FALSE)) +.M.vt <- function(x, y=NULL, boolArith=NA, ...) + tcrossprod(x, + if(nrow(x) == 1L) + spV2M(y, nrow=1L, ncol=y@length, check=FALSE) + else + spV2M(y, nrow=y@length, ncol=1L, check=FALSE), + boolArith=boolArith, ...) ###-- I --- %*% ------------------------------------------------------ ## General method for dense matrix multiplication in case specific methods ## have not been defined. -setMethod("%*%", signature(x = "ddenseMatrix", y = "ddenseMatrix"), - function(x, y) .Call(dgeMatrix_matrix_mm, - .Call(dup_mMatrix_as_dgeMatrix, x), y, FALSE), - valueClass = "dgeMatrix") +for ( c.x in paste0(c("d", "l", "n"), "denseMatrix")) { + for(c.y in c("matrix", paste0(c("d", "l", "n"), "denseMatrix"))) + setMethod("%*%", signature(x = c.x, y = c.y), + function(x, y) .Call(geMatrix_matrix_mm, x, y, FALSE), + valueClass = "dgeMatrix") + setMethod("%*%", signature(x = "matrix", y = c.x), + function(x, y) .Call(geMatrix_matrix_mm, y, x, TRUE), + valueClass = "dgeMatrix") +} setMethod("%*%", signature(x = "dgeMatrix", y = "dgeMatrix"), function(x, y) .Call(dgeMatrix_matrix_mm, x, y, FALSE), @@ -82,7 +91,7 @@ setMethod("%*%", signature(x = "dspMatrix", y = "matrix"), ## Not needed because of c("numeric", "Matrix") method ##setMethod("%*%", signature(x = "numeric", y = "CsparseMatrix"), -## function(x, y) t(.Call(Csparse_dense_crossprod, y, t(x))), +## function(x, y) .Call(Csparse_dense_crossprod, y, x, "B"), ## valueClass = "dgeMatrix") ## FIXME -- do the "same" for "dtpMatrix" {also, with [t]crossprod()} @@ -148,15 +157,17 @@ for(c.x in c("lMatrix", "nMatrix")) { }; rm(c.x, c.y) setMethod("%*%", signature(x = "CsparseMatrix", y = "CsparseMatrix"), - function(x, y) .Call(Csparse_Csparse_prod, x, y)) + function(x, y) .Call(Csparse_Csparse_prod, x, y, boolArith=NA)) setMethod("%*%", signature(x = "CsparseMatrix", y = "ddenseMatrix"), - function(x, y) .Call(Csparse_dense_prod, x, y)) + function(x, y) .Call(Csparse_dense_prod, x, y, " ")) setMethod("%*%", signature(x = "CsparseMatrix", y = "matrix"), - function(x, y) .Call(Csparse_dense_prod, x, y)) # was x %*% Matrix(y) + function(x, y) .Call(Csparse_dense_prod, x, y, " ")) # was x %*% Matrix(y) setMethod("%*%", signature(x = "CsparseMatrix", y = "numLike"), - function(x, y) .Call(Csparse_dense_prod, x, y)) + function(x, y) .Call(Csparse_dense_prod, x, y, " ")) +setMethod("%*%", signature(x = "sparseMatrix", y = "matrix"), + function(x, y) .Call(Csparse_dense_prod, as(x,"CsparseMatrix"), y, " ")) ## Not yet. Don't have methods for y = "CsparseMatrix" and general x #setMethod("%*%", signature(x = "ANY", y = "TsparseMatrix"), @@ -189,19 +200,21 @@ setMethod("%*%", signature(x = "nsparseMatrix", y = "nsparseMatrix"), function(x, y) as(x, "ngCMatrix") %*% as(y, "ngCMatrix")) -## FIXME(2): These three are sub-optimal : has 2 x t() : -## *faster*: provide dense_Csparse_prod() ## x %*% y = t(crossprod(y, t(x))) unless when x is vector setMethod("%*%", signature(x = "ddenseMatrix", y = "CsparseMatrix"), - function(x, y) t(.Call(Csparse_dense_crossprod, y, t(x))), + function(x, y) .Call(Csparse_dense_crossprod, y, x, "B"), valueClass = "dgeMatrix") setMethod("%*%", signature(x = "matrix", y = "CsparseMatrix"), - function(x, y) t(.Call(Csparse_dense_crossprod, y, t(x))), + function(x, y) .Call(Csparse_dense_crossprod, y, x, "B"), + valueClass = "dgeMatrix") +setMethod("%*%", signature(x = "matrix", y = "sparseMatrix"), + function(x, y) .Call(Csparse_dense_crossprod, as(y, "CsparseMatrix"), x, "B"), valueClass = "dgeMatrix") setMethod("%*%", signature(x = "numLike", y = "CsparseMatrix"), - function(x, y) t(.Call(Csparse_dense_crossprod, y, x)), + function(x, y) .Call(Csparse_dense_crossprod, y, x, "c"), valueClass = "dgeMatrix") + ## "Matrix" ## Methods for operations where one argument is numeric setMethod("%*%", signature(x = "Matrix", y = "numLike"), .M.v) @@ -245,372 +258,553 @@ setMethod("%*%", signature(x = "numLike", y = "sparseVector"), v.X.sp) ###--- II --- crossprod ----------------------------------------------------- setMethod("crossprod", signature(x = "dgeMatrix", y = "missing"), - function(x, y = NULL) .Call(dgeMatrix_crossprod, x, FALSE), - valueClass = "dpoMatrix") + function(x, y = NULL, boolArith=NA, ...) { + if(isTRUE(boolArith)) ## FIXME: very inefficient + crossprod(as(x,"sparseMatrix"), boolArith=TRUE) + else + .Call(dgeMatrix_crossprod, x, FALSE) + }) ## crossprod (x,y) setMethod("crossprod", signature(x = "dgeMatrix", y = "dgeMatrix"), - function(x, y = NULL) .Call(dgeMatrix_dgeMatrix_crossprod, x, y, FALSE), - valueClass = "dgeMatrix") + function(x, y=NULL, boolArith=NA, ...) { + if(isTRUE(boolArith)) ## FIXME: very inefficient + crossprod(as(x,"sparseMatrix"), as(y,"sparseMatrix"), boolArith=TRUE) + else + .Call(dgeMatrix_dgeMatrix_crossprod, x, y, FALSE) + }) setMethod("crossprod", signature(x = "dgeMatrix", y = "matrix"), - function(x, y = NULL) .Call(dgeMatrix_matrix_crossprod, x, y, FALSE), - valueClass = "dgeMatrix") + function(x, y=NULL, boolArith=NA, ...) { + if(isTRUE(boolArith)) ## FIXME: very inefficient + crossprod(as(x,"sparseMatrix"), as(y,"sparseMatrix"), boolArith=TRUE) + else + .Call(dgeMatrix_matrix_crossprod, x, y, FALSE) + }) + setMethod("crossprod", signature(x = "dgeMatrix", y = "numLike"), - function(x, y = NULL) .Call(dgeMatrix_matrix_crossprod, x, y, FALSE), - valueClass = "dgeMatrix") -setMethod("crossprod", signature(x = "matrix", y = "dgeMatrix"), - function(x, y = NULL) crossprod(..2dge(x), y), - valueClass = "dgeMatrix") -setMethod("crossprod", signature(x = "numLike", y = "dgeMatrix"), - function(x, y = NULL) crossprod(as.matrix(as.double(x)), y), - valueClass = "dgeMatrix") + function(x, y=NULL, boolArith=NA, ...) { + if(isTRUE(boolArith)) + crossprod(as(x,"sparseMatrix"), as(y,"sparseVector"), boolArith=TRUE) + else + .Call(dgeMatrix_matrix_crossprod, x, y, FALSE) + }) -setMethod("crossprod", signature(x = "ddenseMatrix", y = "missing"), - function(x, y = NULL) crossprod(as(x, "dgeMatrix"))) +setMethod("crossprod", signature(x = "matrix", y = "dgeMatrix"), + function(x, y=NULL, boolArith=NA, ...) + crossprod(..2dge(x), y, boolArith=boolArith, ...)) -setMethod("crossprod", signature(x = "dtrMatrix", y = "missing"), - function(x, y = NULL) crossprod(as(x, "dgeMatrix")), - valueClass = "dpoMatrix") +setMethod("crossprod", signature(x = "numLike", y = "dgeMatrix"), + function(x, y=NULL, boolArith=NA, ...) + crossprod(as.matrix(as.double(x)), y, boolArith=boolArith, ...)) + +for(c.x in paste0(c("d", "l", "n"), "denseMatrix")) { + setMethod("crossprod", signature(x = c.x, y = "missing"), + function(x, y = NULL, boolArith=NA, ...) + if(isTRUE(boolArith)) ## FIXME: very inefficient + crossprod(as(x,"sparseMatrix"), boolArith=TRUE) + else + .Call(geMatrix_crossprod, x, FALSE)) + + for(c.y in c("matrix", paste0(c("d", "l", "n"), "denseMatrix"))) { + setMethod("crossprod", signature(x = c.x, y = c.y), + function(x, y=NULL, boolArith=NA, ...) + if(isTRUE(boolArith)) ## FIXME: very inefficient + crossprod(as(x,"sparseMatrix"), as(y,"sparseMatrix"), boolArith=TRUE) + else + .Call(geMatrix_geMatrix_crossprod, x, y, FALSE)) + } +} +## setMethod("crossprod", signature(x = "dtrMatrix", y = "missing"), +## function(x, y = NULL, boolArith=NA, ...) +## crossprod(..2dge(x), boolArith=boolArith, ...)) ## "dtrMatrix" - remaining (uni)triangular if possible setMethod("crossprod", signature(x = "dtrMatrix", y = "dtrMatrix"), - function(x, y) .Call(dtrMatrix_dtrMatrix_mm, x, y, FALSE, TRUE)) + function(x, y=NULL, boolArith=NA, ...) + if(isTRUE(boolArith)) ## FIXME: very inefficient + crossprod(as(x,"sparseMatrix"), as(y,"sparseMatrix"), boolArith=TRUE) + else + .Call(dtrMatrix_dtrMatrix_mm, x, y, FALSE, TRUE)) setMethod("crossprod", signature(x = "dtrMatrix", y = "ddenseMatrix"), - function(x, y) .Call(dtrMatrix_matrix_mm, x, y, FALSE, TRUE), - valueClass = "dgeMatrix") + function(x, y=NULL, boolArith=NA, ...) + if(isTRUE(boolArith)) ## FIXME: very inefficient + crossprod(as(x,"sparseMatrix"), as(y,"sparseMatrix"), boolArith=TRUE) + else + .Call(dtrMatrix_matrix_mm, x, y, FALSE, TRUE)) + setMethod("crossprod", signature(x = "dtrMatrix", y = "matrix"), - function(x, y) .Call(dtrMatrix_matrix_mm, x, y, FALSE, TRUE), - valueClass = "dgeMatrix") + function(x, y=NULL, boolArith=NA, ...) + if(isTRUE(boolArith)) ## FIXME: very inefficient + crossprod(as(x,"sparseMatrix"), as(y,"sparseMatrix"), boolArith=TRUE) + else + .Call(dtrMatrix_matrix_mm, x, y, FALSE, TRUE)) + + ## "dtpMatrix" if(FALSE) ## not yet in C setMethod("crossprod", signature(x = "dtpMatrix", y = "dtpMatrix"), - function(x, y) .Call(dtpMatrix_dtpMatrix_mm, x, y, FALSE, TRUE)) + function(x, y=NULL, boolArith=NA, ...) + if(isTRUE(boolArith)) + crossprod(as(x,"sparseMatrix"), as(y,"sparseMatrix"), boolArith=TRUE) + else + .Call(dtpMatrix_dtpMatrix_mm, x, y, FALSE, TRUE)) setMethod("crossprod", signature(x = "dtpMatrix", y = "ddenseMatrix"), - function(x, y) .Call(dtpMatrix_matrix_mm, x, y, FALSE, TRUE), - valueClass = "dgeMatrix") + function(x, y=NULL, boolArith=NA, ...) + if(isTRUE(boolArith)) + crossprod(as(x,"sparseMatrix"), as(y,"sparseMatrix"), boolArith=TRUE) + else + .Call(dtpMatrix_matrix_mm, x, y, FALSE, TRUE)) setMethod("crossprod", signature(x = "dtpMatrix", y = "matrix"), - function(x, y) .Call(dtpMatrix_matrix_mm, x, y, FALSE, TRUE), - valueClass = "dgeMatrix") + function(x, y=NULL, boolArith=NA, ...) + if(isTRUE(boolArith)) + crossprod(as(x,"sparseMatrix"), as(y,"sparseMatrix"), boolArith=TRUE) + else + .Call(dtpMatrix_matrix_mm, x, y, FALSE, TRUE)) ## "crossprod" methods too ... ## setMethod("crossprod", signature(x = "dgTMatrix", y = "missing"), -## function(x, y = NULL) +## function(x, y=NULL, boolArith=NA, ...) ## .Call(csc_crossprod, as(x, "dgCMatrix"))) ## setMethod("crossprod", signature(x = "dgTMatrix", y = "matrix"), -## function(x, y = NULL) +## function(x, y) ## .Call(csc_matrix_crossprod, as(x, "dgCMatrix"), y)) ##setMethod("crossprod", signature(x = "dgTMatrix", y = "numeric"), -## function(x, y = NULL) +## function(x, y) ## .Call(csc_matrix_crossprod, as(x, "dgCMatrix"), as.matrix(y))) ## setMethod("tcrossprod", signature(x = "dgTMatrix", y = "missing"), -## function(x, y = NULL) +## function(x, y=NULL, boolArith=NA, ...) ## .Call(csc_tcrossprod, as(x, "dgCMatrix"))) setMethod("crossprod", signature(x = "CsparseMatrix", y = "missing"), - function(x, y = NULL) { - if (is(x, "symmetricMatrix")) - ## crossprod() should give "symmetric*": - forceSymmetric(x %*% x, uplo = x@uplo) - else - .Call(Csparse_crossprod, x, trans = FALSE, triplet = FALSE) - }) + function(x, y = NULL, boolArith=NA, ...) + .Call(Csparse_crossprod, x, trans = FALSE, triplet = FALSE, boolArith=boolArith)) setMethod("crossprod", signature(x = "CsparseMatrix", y = "CsparseMatrix"), - function(x, y = NULL) - .Call(Csparse_Csparse_crossprod, x, y, trans = FALSE)) + function(x, y = NULL, boolArith = NA, ...) + .Call(Csparse_Csparse_crossprod, x, y, trans = FALSE, boolArith=boolArith)) ## FIXME: Generalize the class of y. (?? still ??) setMethod("crossprod", signature(x = "CsparseMatrix", y = "ddenseMatrix"), - function(x, y = NULL) .Call(Csparse_dense_crossprod, x, y)) + function(x, y=NULL, boolArith=NA, ...) + if(isTRUE(boolArith)) + crossprod(x, as(y,"sparseMatrix"), boolArith=TRUE) + else + .Call(Csparse_dense_crossprod, x, y, " ")) setMethod("crossprod", signature(x = "CsparseMatrix", y = "matrix"), - function(x, y = NULL) .Call(Csparse_dense_crossprod, x, y)) + function(x, y=NULL, boolArith=NA, ...) + if(isTRUE(boolArith)) + crossprod(x, as(y,"sparseMatrix"), boolArith=TRUE) + else + .Call(Csparse_dense_crossprod, x, y, " ")) setMethod("crossprod", signature(x = "CsparseMatrix", y = "numLike"), - function(x, y = NULL) .Call(Csparse_dense_crossprod, x, y)) + function(x, y=NULL, boolArith=NA, ...) + if(isTRUE(boolArith)) + crossprod(x, as(y,"sparseVector"), boolArith=TRUE) + else + .Call(Csparse_dense_crossprod, x, y, " ")) setMethod("crossprod", signature(x = "TsparseMatrix", y = "missing"), - function(x, y = NULL) { - if (is(x, "symmetricMatrix")) - ## crossprod() should give "symmetric*": - forceSymmetric(x %*% x, uplo = x@uplo) - else - .Call(Csparse_crossprod, x, trans = FALSE, triplet = TRUE) - }) + function(x, y = NULL, boolArith = NA, ...) + .Call(Csparse_crossprod, x, trans = FALSE, triplet = TRUE, boolArith=boolArith)) setMethod("crossprod", signature(x = "TsparseMatrix", y = "ANY"), - function(x, y = NULL) crossprod(.T.2.C(x), y)) + function(x, y = NULL, boolArith = NA, ...) + crossprod(.T.2.C(x), y, boolArith=boolArith, ...)) setMethod("crossprod", signature(x = "ANY", y = "TsparseMatrix"), - function(x, y = NULL) crossprod(x, .T.2.C(y))) + function(x, y=NULL, boolArith=NA, ...) + crossprod(x, .T.2.C(y), boolArith=boolArith, ...)) setMethod("crossprod", signature(x = "TsparseMatrix", y = "Matrix"), - function(x, y = NULL) crossprod(.T.2.C(x), y)) + function(x, y=NULL, boolArith=NA, ...) + crossprod(.T.2.C(x), y, boolArith=boolArith, ...)) setMethod("crossprod", signature(x = "Matrix", y = "TsparseMatrix"), - function(x, y = NULL) crossprod(x, .T.2.C(y))) + function(x, y=NULL, boolArith=NA, ...) + crossprod(x, .T.2.C(y), boolArith=boolArith, ...)) setMethod("crossprod", signature(x = "TsparseMatrix", y = "TsparseMatrix"), - function(x, y = NULL) crossprod(.T.2.C(x), .T.2.C(y))) + function(x, y=NULL, boolArith=NA, ...) + crossprod(.T.2.C(x), .T.2.C(y), boolArith=boolArith, ...)) setMethod("crossprod", signature(x = "dsparseMatrix", y = "ddenseMatrix"), - function(x, y = NULL) - .Call(Csparse_dense_crossprod, as(x, "CsparseMatrix"), y)) + function(x, y=NULL, boolArith=NA, ...) + if(isTRUE(boolArith)) + crossprod(as(x, "CsparseMatrix"), as(y,"sparseMatrix"), boolArith=TRUE) + else + .Call(Csparse_dense_crossprod, as(x, "CsparseMatrix"), y, " ")) setMethod("crossprod", signature(x = "ddenseMatrix", y = "dgCMatrix"), - function(x, y = NULL) t(.Call(Csparse_dense_crossprod, y, x))) + function(x, y=NULL, boolArith=NA, ...) + if(isTRUE(boolArith)) + crossprod(as(x, "sparseMatrix"), y, boolArith=TRUE) + else + .Call(Csparse_dense_crossprod, y, x, "c")) setMethod("crossprod", signature(x = "ddenseMatrix", y = "dsparseMatrix"), - function(x, y = NULL) - t(.Call(Csparse_dense_crossprod, as(y, "CsparseMatrix"), x))) - + function(x, y=NULL, boolArith=NA, ...) + if(isTRUE(boolArith)) + crossprod(as(x, "sparseMatrix"), as(y, "CsparseMatrix"), boolArith=TRUE) + else + .Call(Csparse_dense_crossprod, as(y, "CsparseMatrix"), x, "c")) setMethod("crossprod", signature(x = "dgCMatrix", y = "dgeMatrix"), - function(x, y = NULL) .Call(Csparse_dense_crossprod, x, y)) + function(x, y=NULL, boolArith=NA, ...) + if(isTRUE(boolArith)) + crossprod(x, as(y, "CsparseMatrix"), boolArith=TRUE) + else + .Call(Csparse_dense_crossprod, x, y, " ")) setMethod("crossprod", signature(x = "dsparseMatrix", y = "dgeMatrix"), - function(x, y = NULL) - .Call(Csparse_dense_crossprod, as(x, "CsparseMatrix"), y)) + function(x, y=NULL, boolArith=NA, ...) + if(isTRUE(boolArith)) + crossprod(as(x, "CsparseMatrix"), as(y, "CsparseMatrix"), boolArith=TRUE) + else + .Call(Csparse_dense_crossprod, as(x, "CsparseMatrix"), y, " ")) ## NB: there's already ## ("CsparseMatrix", "missing") and ("TsparseMatrix", "missing") methods ## infinite recursion: ## setMethod("crossprod", signature(x = "dgeMatrix", y = "dsparseMatrix"), -## function(x, y = NULL) crossprod(x, as(y, "dgCMatrix"))) +## function(x, y) crossprod(x, as(y, "dgCMatrix"))) setMethod("crossprod", signature(x = "lsparseMatrix", y = "ldenseMatrix"), - function(x, y = NULL) crossprod(x, as(y, "sparseMatrix"))) + function(x, y=NULL, boolArith=NA, ...) + crossprod(x, as(y, "sparseMatrix"), boolArith=boolArith, ...)) setMethod("crossprod", signature(x = "ldenseMatrix", y = "lsparseMatrix"), - function(x, y = NULL) crossprod(as(x, "sparseMatrix"), y)) + function(x, y=NULL, boolArith=NA, ...) + crossprod(as(x, "sparseMatrix"), y, boolArith=boolArith, ...)) setMethod("crossprod", signature(x = "lsparseMatrix", y = "lsparseMatrix"), - function(x, y = NULL) - crossprod(as(x, "lgCMatrix"), as(y, "lgCMatrix"))) + function(x, y=NULL, boolArith=NA, ...) + crossprod(as(x, "lgCMatrix"), as(y, "lgCMatrix"), boolArith=boolArith, ...)) setMethod("crossprod", signature(x = "nsparseMatrix", y = "ndenseMatrix"), - function(x, y = NULL) crossprod(x, as(y, "sparseMatrix"))) + function(x, y=NULL, boolArith=NA, ...) + crossprod(x, as(y, "sparseMatrix"), boolArith=boolArith, ...)) setMethod("crossprod", signature(x = "ndenseMatrix", y = "nsparseMatrix"), - function(x, y = NULL) crossprod(as(x, "sparseMatrix"), y)) + function(x, y=NULL, boolArith=NA, ...) + crossprod(as(x, "sparseMatrix"), y, boolArith=boolArith, ...)) setMethod("crossprod", signature(x = "nsparseMatrix", y = "nsparseMatrix"), - function(x, y = NULL) - crossprod(as(x, "ngCMatrix"), as(y, "ngCMatrix"))) - + function(x, y=NULL, boolArith=NA, ...) + crossprod(as(x, "ngCMatrix"), as(y, "ngCMatrix"), boolArith=boolArith, ...)) -## FIXME(3): slightly sub-optimal : t() : setMethod("crossprod", signature(x = "ddenseMatrix", y = "CsparseMatrix"), - function(x, y) t(.Call(Csparse_dense_crossprod, y, x))) + function(x, y=NULL, boolArith=NA, ...) + if(isTRUE(boolArith)) + crossprod(as(x, "CsparseMatrix"), y, boolArith=TRUE) + else + .Call(Csparse_dense_crossprod, y, x, "c")) setMethod("crossprod", signature(x = "matrix", y = "CsparseMatrix"), - function(x, y) t(.Call(Csparse_dense_crossprod, y, x))) + function(x, y=NULL, boolArith=NA, ...) + if(isTRUE(boolArith)) + crossprod(as(x, "CsparseMatrix"), y, boolArith=TRUE) + else + .Call(Csparse_dense_crossprod, y, x, "c")) setMethod("crossprod", signature(x = "numLike", y = "CsparseMatrix"), - function(x, y) t(.Call(Csparse_dense_crossprod, y, x))) + function(x, y=NULL, boolArith=NA, ...) + if(isTRUE(boolArith)) + crossprod(as(x, "sparseVector"), y, boolArith=TRUE) + else + .Call(Csparse_dense_crossprod, y, x, "c")) ## "Matrix" : cbind(), rbind() do names -> dimnames setMethod("crossprod", signature(x = "Matrix", y = "numLike"), - function(x, y) crossprod(x, cbind(y, deparse.level=0))) + function(x, y=NULL, boolArith=NA, ...) crossprod(x, cbind(y, deparse.level=0), boolArith=boolArith, ...)) setMethod("crossprod", signature(x = "numLike", y = "Matrix"), - function(x, y) crossprod(cbind(x, deparse.level=0), y)) + function(x, y=NULL, boolArith=NA, ...) crossprod(cbind(x, deparse.level=0), y, boolArith=boolArith, ...)) setMethod("crossprod", signature(x = "Matrix", y = "matrix"), - function(x, y) crossprod(x, Matrix(y))) + function(x, y=NULL, boolArith=NA, ...) crossprod(x, Matrix(y), boolArith=boolArith, ...)) setMethod("crossprod", signature(x = "matrix", y = "Matrix"), - function(x, y) crossprod(Matrix(x), y)) + function(x, y=NULL, boolArith=NA, ...) crossprod(Matrix(x), y, boolArith=boolArith, ...)) ## sparseVector setMethod("crossprod", signature(x = "mMatrix", y = "sparseVector"), - function(x, y) crossprod(x, - if(nrow(x) == 1L) - spV2M(y, nrow=1L, ncol=y@length, check=FALSE) - else - spV2M(y, nrow=y@length, ncol=1L, check=FALSE))) + function(x, y=NULL, boolArith=NA, ...) + crossprod(x, + if(nrow(x) == 1L) + spV2M(y, nrow=1L, ncol=y@length, check=FALSE) + else + spV2M(y, nrow=y@length, ncol=1L, check=FALSE), + boolArith=boolArith, ...)) setMethod("crossprod", signature(x = "sparseVector", y = "mMatrix"), - function(x, y) - crossprod(spV2M(x, nrow = length(x), ncol = 1L, check = FALSE), y)) -setMethod("crossprod", signature(x = "sparseVector", y = "sparseVector"), sp.X.sp) -setMethod("crossprod", signature(x = "sparseVector", y = "numLike"), sp.X.sp) -setMethod("crossprod", signature(x = "numLike", y = "sparseVector"), v.X.sp) + function(x, y=NULL, boolArith=NA, ...) + crossprod(spV2M(x, nrow = length(x), ncol = 1L, check = FALSE), y, + boolArith=boolArith, ...)) + +sp.t.sp <- function(x, y=NULL, boolArith=NA, ...) + Matrix(if(isTRUE(boolArith)) any(x & y) else sum(x * y), + 1L, 1L, sparse=FALSE) +## inner product -- no sense to return sparse! +sp.T.sp <- function(x, y=NULL, boolArith=NA, ...) { + if((n <- length(x)) == length(y)) sp.t.sp(x,y, boolArith=boolArith, ...) + else if(n == 1L) + (if(isTRUE(boolArith)) `%&%` else `%*%`)( + spV2M(x, nrow = 1L, ncol = 1L, check = FALSE), y) + else stop("non-conformable arguments") +} +v.T.sp <- function(x, y=NULL, boolArith=NA, ...) { + if((n <- length(x)) == length(y)) sp.t.sp(x,y, boolArith=boolArith, ...) + else if(n == 1L) + (if(isTRUE(boolArith)) `%&%` else `%*%`)(matrix(x, nrow = 1L, ncol = 1L), y) + else stop("non-conformable arguments") +} + +setMethod("crossprod", signature(x = "sparseVector", y = "sparseVector"), sp.T.sp) +setMethod("crossprod", signature(x = "sparseVector", y = "numLike"), sp.T.sp) +setMethod("crossprod", signature(x = "numLike", y = "sparseVector"), v.T.sp) setMethod("crossprod", signature(x = "sparseVector", y = "missing"), - function(x, y=NULL) sp.x.sp(x,x)) + function(x, y=NULL, boolArith=NA, ...) sp.t.sp(x,x, boolArith=boolArith, ...)) ## Fallbacks -- symmetric LHS --> saving a t(.): ## {FIXME: want the method to be `%*%` -- but primitives are not allowed as methods} -setMethod("crossprod", signature(x = "symmetricMatrix", y = "Matrix"), function(x,y) x %*% y) -setMethod("crossprod", signature(x = "symmetricMatrix", y = "missing"), function(x,y) x %*% x) -setMethod("crossprod", signature(x = "symmetricMatrix", y = "ANY"), function(x,y) x %*% y) +setMethod("crossprod", signature(x = "symmetricMatrix", y = "missing"), + function(x,y=NULL, boolArith=NA, ...) + if(isTRUE(boolArith)) x %&% x else x %*% x) +setMethod("crossprod", signature(x = "symmetricMatrix", y = "Matrix"), + function(x,y=NULL, boolArith=NA, ...) + if(isTRUE(boolArith)) x %&% y else x %*% y) +setMethod("crossprod", signature(x = "symmetricMatrix", y = "ANY"), + function(x,y=NULL, boolArith=NA, ...) + if(isTRUE(boolArith)) x %&% y else x %*% y) ## ## cheap fallbacks setMethod("crossprod", signature(x = "Matrix", y = "Matrix"), - function(x, y) { + function(x, y=NULL, boolArith=NA, ...) { Matrix.msg(sprintf( "potentially suboptimal crossprod(\"%s\",\"%s\") as t(.) %s y", class(x), class(y), "%*%")) - t(x) %*% y }) + if(isTRUE(boolArith)) t(x) %&% y else t(x) %*% y }) setMethod("crossprod", signature(x = "Matrix", y = "missing"), - function(x, y) { + function(x, y=NULL, boolArith=NA, ...) { Matrix.msg(paste0( "potentially suboptimal crossprod(<",class(x),">) as t(.) %*% . ")) - t(x) %*% x }) + if(isTRUE(boolArith)) t(x) %&% x else t(x) %*% x }) setMethod("crossprod", signature(x = "Matrix", y = "ANY"), - function(x, y) { + function(x, y=NULL, boolArith=NA, ...) { Matrix.msg(sprintf( "potentially suboptimal crossprod(\"%s\", <%s>[=]) as t(.) %s y", class(x), class(y), "%*%")) - t(x) %*% y }) + if(isTRUE(boolArith)) t(x) %&% y else t(x) %*% y }) setMethod("crossprod", signature(x = "ANY", y = "Matrix"), - function(x, y) t(x) %*% y) + function(x, y=NULL, boolArith=NA, ...) + if(isTRUE(boolArith)) t(x) %&% y else t(x) %*% y) ###--- III --- tcrossprod --------------------------------------------------- setMethod("tcrossprod", signature(x = "dgeMatrix", y = "dgeMatrix"), - function(x, y = NULL) .Call(dgeMatrix_dgeMatrix_crossprod, x, y, TRUE), - valueClass = "dgeMatrix") - + function(x, y=NULL, boolArith=NA, ...) + if(isTRUE(boolArith)) ## FIXME: very inefficient + tcrossprod(as(x, "sparseMatrix"), as(y,"sparseMatrix"), boolArith=TRUE) + else + .Call(dgeMatrix_dgeMatrix_crossprod, x, y, TRUE)) setMethod("tcrossprod", signature(x = "dgeMatrix", y = "matrix"), - function(x, y = NULL) .Call(dgeMatrix_matrix_crossprod, x, y, TRUE), - valueClass = "dgeMatrix") + function(x, y=NULL, boolArith=NA, ...) + if(isTRUE(boolArith)) ## FIXME: very inefficient + tcrossprod(as(x, "sparseMatrix"), as(y,"sparseMatrix"), boolArith=TRUE) + else + .Call(dgeMatrix_matrix_crossprod, x, y, TRUE)) + setMethod("tcrossprod", signature(x = "dgeMatrix", y = "numLike"), - function(x, y = NULL) .Call(dgeMatrix_matrix_crossprod, x, y, TRUE), - valueClass = "dgeMatrix") -setMethod("tcrossprod", signature(x = "matrix", y = "dgeMatrix"), - function(x, y = NULL) tcrossprod(..2dge(x), y), - valueClass = "dgeMatrix") -setMethod("tcrossprod", signature(x = "numLike", y = "dgeMatrix"), .v.Mt, - valueClass = "dgeMatrix") + function(x, y=NULL, boolArith=NA, ...) + if(isTRUE(boolArith)) ## FIXME: very inefficient + tcrossprod(as(x, "sparseMatrix"), as(y,"sparseVector"), boolArith=TRUE) + else + .Call(dgeMatrix_matrix_crossprod, x, y, TRUE)) +setMethod("tcrossprod", signature(x = "matrix", y = "dgeMatrix"), + function(x, y=NULL, boolArith=NA, ...) + tcrossprod(..2dge(x), y, boolArith=boolArith, ...)) +setMethod("tcrossprod", signature(x = "numLike", y = "dgeMatrix"), .v.Mt) setMethod("tcrossprod", signature(x = "dgeMatrix", y = "missing"), - function(x, y = NULL) .Call(dgeMatrix_crossprod, x, TRUE), - valueClass = "dpoMatrix") + function(x, y=NULL, boolArith=NA, ...) + if(isTRUE(boolArith)) ## FIXME: very inefficient + tcrossprod(as(x, "sparseMatrix"), boolArith=TRUE) + else + .Call(dgeMatrix_crossprod, x, TRUE)) + +for(c.x in paste0(c("d", "l", "n"), "denseMatrix")) { + setMethod("tcrossprod", signature(x = c.x, y = "missing"), + function(x, y=NULL, boolArith=NA, ...) + if(isTRUE(boolArith)) ## FIXME: very inefficient + tcrossprod(as(x, "sparseMatrix"), boolArith=TRUE) + else + .Call(geMatrix_crossprod, x, TRUE)) + + for(c.y in c("matrix", paste0(c("d", "l", "n"), "denseMatrix"))) { + setMethod("tcrossprod", signature(x = c.x, y = c.y), + function(x, y=NULL, boolArith=NA, ...) + if(isTRUE(boolArith)) ## FIXME: very inefficient + tcrossprod(as(x,"sparseMatrix"), as(y,"sparseMatrix"), boolArith=TRUE) + else + .Call(geMatrix_geMatrix_crossprod, x, y, TRUE)) + } +} if(FALSE) { ## this would mask 'base::tcrossprod' setMethod("tcrossprod", signature(x = "matrix", y = "missing"), - function(x, y = NULL) - .Call(dgeMatrix_crossprod, ..2dge(x), TRUE), - valueClass = "dpoMatrix") - + function(x, y=NULL, boolArith=NA, ...) + if(isTRUE(boolArith)) ## FIXME: very inefficient + tcrossprod(as(x, "sparseMatrix"), boolArith=TRUE) + else + .Call(dgeMatrix_crossprod, ..2dge(x), TRUE)) setMethod("tcrossprod", signature(x = "numLike", y = "missing"), - function(x, y = NULL) tcrossprod(as.matrix(as.double(x)))) -} + function(x, y=NULL, boolArith=NA, ...) + tcrossprod(as.matrix(as.double(x)), boolArith=boolArith, ...)) +}# FALSE setMethod("tcrossprod", signature(x = "ddenseMatrix", y = "missing"), - function(x, y = NULL) tcrossprod(as(x, "dgeMatrix"))) + function(x, y=NULL, boolArith=NA, ...) + tcrossprod(as(x, "dgeMatrix"), boolArith=boolArith, ...)) setMethod("tcrossprod", signature(x = "dtrMatrix", y = "dtrMatrix"), - function(x, y) .Call(dtrMatrix_dtrMatrix_mm, y, x, TRUE, TRUE)) + function(x, y=NULL, boolArith=NA, ...) + if(isTRUE(boolArith)) ## FIXME: very inefficient + tcrossprod(as(x, "sparseMatrix"), as(y,"sparseMatrix"), boolArith=TRUE) + else + .Call(dtrMatrix_dtrMatrix_mm, y, x, TRUE, TRUE)) -## Must have 1st arg. = "dtrMatrix" in dtrMatrix_matrix_mm (): +## Must have 1st arg. = "dtrMatrix" in dtrMatrix_matrix_mm (): ## would need another way, to define tcrossprod() --- TODO? --- ## ## setMethod("tcrossprod", signature(x = "dtrMatrix", y = "ddenseMatrix"), -## function(x, y) .Call(dtrMatrix_matrix_mm, y, x, TRUE, TRUE)) +## function(x, y=NULL, boolArith=NA, ...) .Call(dtrMatrix_matrix_mm, y, x, TRUE, TRUE)) ## setMethod("tcrossprod", signature(x = "dtrMatrix", y = "matrix"), -## function(x, y) .Call(dtrMatrix_matrix_mm, y, x, TRUE, TRUE)) +## function(x, y=NULL, boolArith=NA, ...) .Call(dtrMatrix_matrix_mm, y, x, TRUE, TRUE)) setMethod("tcrossprod", signature(x = "ddenseMatrix", y = "dtrMatrix"), - function(x, y) .Call(dtrMatrix_matrix_mm, y, x, TRUE, TRUE)) + function(x, y=NULL, boolArith=NA, ...) + if(isTRUE(boolArith)) ## FIXME: very inefficient + tcrossprod(as(x, "sparseMatrix"), as(y,"sparseMatrix"), boolArith=TRUE) + else + .Call(dtrMatrix_matrix_mm, y, x, TRUE, TRUE)) setMethod("tcrossprod", signature(x = "matrix", y = "dtrMatrix"), - function(x, y) .Call(dtrMatrix_matrix_mm, y, x, TRUE, TRUE)) + function(x, y=NULL, boolArith=NA, ...) + if(isTRUE(boolArith)) ## FIXME: very inefficient + tcrossprod(as(x, "sparseMatrix"), as(y,"sparseMatrix"), boolArith=TRUE) + else + .Call(dtrMatrix_matrix_mm, y, x, TRUE, TRUE)) if(FALSE) { ## TODO in C setMethod("tcrossprod", signature(x = "ddenseMatrix", y = "dtpMatrix"), - function(x, y) .Call(dtpMatrix_matrix_mm, y, x, TRUE, TRUE)) + function(x, y=NULL, boolArith=NA, ...) + if(isTRUE(boolArith)) ## FIXME: very inefficient + tcrossprod(as(x, "sparseMatrix"), as(y,"sparseMatrix"), boolArith=TRUE) + else + .Call(dtpMatrix_matrix_mm, y, x, TRUE, TRUE)) setMethod("tcrossprod", signature(x = "matrix", y = "dtpMatrix"), - function(x, y) .Call(dtpMatrix_matrix_mm, y, x, TRUE, TRUE)) -} - + function(x, y=NULL, boolArith=NA, ...) + if(isTRUE(boolArith)) ## FIXME: very inefficient + tcrossprod(as(x, "sparseMatrix"), as(y,"sparseMatrix"), boolArith=TRUE) + else + .Call(dtpMatrix_matrix_mm, y, x, TRUE, TRUE)) +}# FALSE setMethod("tcrossprod", signature(x = "CsparseMatrix", y = "CsparseMatrix"), - function(x, y = NULL) - .Call(Csparse_Csparse_crossprod, x, y, trans = TRUE)) + function(x, y = NULL, boolArith = NA, ...) + .Call(Csparse_Csparse_crossprod, x, y, trans = TRUE, boolArith=boolArith)) setMethod("tcrossprod", signature(x = "CsparseMatrix", y = "missing"), - function(x, y = NULL) { - if (is(x, "symmetricMatrix")) - ## tcrossprod() should give "symmetric*": - forceSymmetric(x %*% x, uplo = x@uplo) + function(x, y = NULL, boolArith = NA, ...) + .Call(Csparse_crossprod, x, trans = TRUE, triplet = FALSE, boolArith=boolArith)) + +for(dmat in c("ddenseMatrix", "matrix")) { +setMethod("tcrossprod", signature(x = "CsparseMatrix", y = dmat), + function(x, y=NULL, boolArith=NA, ...) + if(isTRUE(boolArith)) ## FIXME: very inefficient + tcrossprod(x, as(y,"CsparseMatrix"), boolArith=TRUE) else - .Call(Csparse_crossprod, x, trans = TRUE, triplet = FALSE) - }) + .Call(Csparse_dense_prod, x, y, "2")) +setMethod("tcrossprod", signature(x = dmat, y = "CsparseMatrix"), + function(x, y=NULL, boolArith=NA, ...) + if(isTRUE(boolArith)) ## FIXME: very inefficient + tcrossprod(as(x,"CsparseMatrix"), y, boolArith=TRUE) + else + .Call(Csparse_dense_prod, y, x, "B")) -### FIXME (suboptimal): one t(): -setMethod("tcrossprod", signature(x = "CsparseMatrix", y = "ddenseMatrix"), - function(x, y) .Call(Csparse_dense_prod, x, t(y))) -setMethod("tcrossprod", signature(x = "CsparseMatrix", y = "matrix"), - function(x, y) .Call(Csparse_dense_prod, x, t(y))) +} setMethod("tcrossprod", signature(x = "CsparseMatrix", y = "numLike"), - function(x, y) .Call(Csparse_dense_prod, x, - if(nrow(x) == 1L) - cbind(y, deparse.level=0) - else - rbind(y, deparse.level=0))) - + function(x, y=NULL, boolArith=NA, ...) + if(isTRUE(boolArith)) ## FIXME: very inefficient + tcrossprod(x, as(y,"sparseVector"), boolArith=TRUE) + else + .Call(Csparse_dense_prod, x, y, "2")) +setMethod("tcrossprod", signature(x = "numLike", y = "CsparseMatrix"), + function(x, y=NULL, boolArith=NA, ...) ## ~== .v.Mt : + if(isTRUE(boolArith)) ## FIXME: very inefficient + tcrossprod(as(x,"sparseVector"), y, boolArith=TRUE) + else + ## x or t(x) depending on dimension of y [checked inside C]: + .Call(Csparse_dense_prod, y, x, "B")) ### -- xy' = (yx')' -------------------- -### FIXME (speed): Csparse_dense_crossprod should also get a 'trans = TRUE' -## so we could have one less t() in this: -for(T in c("d", "l", "n")) { ## speedup for *symmetric* RHS - .sCMatrix <- paste0(T, "sCMatrix") - setMethod("tcrossprod", signature(x = "ddenseMatrix", y = .sCMatrix), - function(x, y) t(.Call(Csparse_dense_prod, y, x))) - setMethod("tcrossprod", signature(x = "matrix", y = .sCMatrix), - function(x, y) t(.Call(Csparse_dense_prod, y, x))) +tcr.dd.sC <- function(x, y=NULL, boolArith=NA, ...) { + if(isTRUE(boolArith)) ## FIXME: very inefficient + tcrossprod(as(x,"CsparseMatrix"), y, boolArith=TRUE) + else + .Call(Csparse_dense_prod, y, x, "c") } -rm(T, .sCMatrix) -setMethod("tcrossprod", signature(x = "ddenseMatrix", y = "CsparseMatrix"), - function(x, y) t(.Call(Csparse_dense_prod, y, t(x)))) -setMethod("tcrossprod", signature(x = "matrix", y = "CsparseMatrix"), - function(x, y) t(.Call(Csparse_dense_prod, y, t(x)))) -setMethod("tcrossprod", signature(x = "numLike", y = "CsparseMatrix"), - # x or t(x) depending on dimension of y ! - .v.Mt)#<- FIXME more efficient - - +for(.sCMatrix in paste0(c("d", "l", "n"), "sCMatrix")) { ## speedup for *symmetric* RHS + setMethod("tcrossprod", signature(x = "ddenseMatrix", y = .sCMatrix), tcr.dd.sC) + setMethod("tcrossprod", signature(x = "matrix", y = .sCMatrix), tcr.dd.sC) +} +rm(dmat, .sCMatrix) setMethod("tcrossprod", signature(x = "TsparseMatrix", y = "missing"), - function(x, y = NULL) { - if (is(x, "symmetricMatrix")) - ## tcrossprod() should give "symmetric*": - forceSymmetric(x %*% x, uplo = x@uplo) - else - .Call(Csparse_crossprod, x, trans = TRUE, triplet = TRUE) - }) + function(x, y = NULL, boolArith = NA, ...) + .Call(Csparse_crossprod, x, trans = TRUE, triplet = TRUE, + boolArith=boolArith)) setMethod("tcrossprod", signature(x = "ANY", y = "TsparseMatrix"), - function(x, y = NULL) tcrossprod(x, .T.2.C(y))) + function(x, y=NULL, boolArith=NA, ...) + tcrossprod(x, .T.2.C(y), boolArith=boolArith, ...)) setMethod("tcrossprod", signature(x = "TsparseMatrix", y = "ANY"), - function(x, y = NULL) tcrossprod(.T.2.C(x), y)) + function(x, y=NULL, boolArith=NA, ...) + tcrossprod(.T.2.C(x), y, boolArith=boolArith, ...)) setMethod("tcrossprod", signature(x = "Matrix", y = "TsparseMatrix"), - function(x, y = NULL) tcrossprod(x, .T.2.C(y))) + function(x, y=NULL, boolArith=NA, ...) + tcrossprod(x, .T.2.C(y), boolArith=boolArith, ...)) setMethod("tcrossprod", signature(x = "TsparseMatrix", y = "Matrix"), - function(x, y = NULL) tcrossprod(.T.2.C(x), y)) + function(x, y=NULL, boolArith=NA, ...) + tcrossprod(.T.2.C(x), y, boolArith=boolArith, ...)) setMethod("tcrossprod", signature(x = "TsparseMatrix", y = "TsparseMatrix"), - function(x, y = NULL) tcrossprod(.T.2.C(x), .T.2.C(y))) + function(x, y=NULL, boolArith=NA, ...) + tcrossprod(.T.2.C(x), .T.2.C(y), boolArith=boolArith, ...)) ## "Matrix" setMethod("tcrossprod", signature(x = "Matrix", y = "numLike"), - function(x, y) x %*% rbind(y, deparse.level=0)) + function(x, y=NULL, boolArith=NA, ...) + (if(isTRUE(boolArith)) `%&%` else `%*%`)(x, + rbind(y, deparse.level=0))) setMethod("tcrossprod", signature(x = "numLike", y = "Matrix"), .v.Mt) setMethod("tcrossprod", signature(x = "Matrix", y = "matrix"), - function(x, y = NULL) tcrossprod(x, Matrix(y))) + function(x, y=NULL, boolArith=NA, ...) + tcrossprod(x, Matrix(y), boolArith=boolArith, ...)) setMethod("tcrossprod", signature(x = "matrix", y = "Matrix"), - function(x, y = NULL) tcrossprod(Matrix(x), y)) + function(x, y=NULL, boolArith=NA, ...) + tcrossprod(Matrix(x), y, boolArith=boolArith, ...)) ## sparseVector ## NB: the two "sparseMatrix" are "unneeded", only used to avoid ambiguity warning @@ -619,43 +813,151 @@ setMethod("tcrossprod", signature(x = "mMatrix", y = "sparseVector"), .M.vt setMethod("tcrossprod", signature(x = "sparseVector", y = "sparseMatrix"), .v.Mt) setMethod("tcrossprod", signature(x = "sparseVector", y = "mMatrix"), .v.Mt) setMethod("tcrossprod", signature(x = "sparseVector", y = "sparseVector"), - function(x, y) .sparseV2Mat(x) %*% - spV2M(y, nrow=1L, ncol=length(y), check=FALSE)) + function(x, y=NULL, boolArith=NA, ...) { + if(isTRUE(boolArith)) + .sparseV2Mat(x) %&% + spV2M(y, nrow=1L, ncol=length(y), check=FALSE) + else { + if(!is.na(boolArith)) + warning(gettextf("'boolArith = %d' not yet implemented", + boolArith), domain=NA) + .sparseV2Mat(x) %*% + spV2M(y, nrow=1L, ncol=length(y), check=FALSE) + } + }) setMethod("tcrossprod", signature(x = "sparseVector", y = "missing"), ## could be speeded: spV2M(x, *) called twice with different ncol/nrow - function(x, y=NULL) .sparseV2Mat(x) %*% - spV2M(x, nrow=1L, ncol=length(x), check=FALSE)) + function(x, y=NULL, boolArith=NA, ...) { + if(isTRUE(boolArith)) + .sparseV2Mat(x) %&% + spV2M(x, nrow=1L, ncol=length(x), check=FALSE) + else { + if(!is.na(boolArith)) + warning(gettextf("'boolArith = %d' not yet implemented", + boolArith), domain=NA) + .sparseV2Mat(x) %*% + spV2M(x, nrow=1L, ncol=length(x), check=FALSE) + } + }) + setMethod("tcrossprod", signature(x = "numLike", y = "sparseVector"), - function(x, y) tcrossprod(x, .sparseV2Mat(y))) + function(x, y=NULL, boolArith=NA, ...) + tcrossprod(x, .sparseV2Mat(y), boolArith=boolArith, ...)) setMethod("tcrossprod", signature(x = "sparseVector", y = "numLike"), - function(x, y) .sparseV2Mat(x) %*% t(x)) + function(x, y=NULL, boolArith=NA, ...) { + if(isTRUE(boolArith)) + .sparseV2Mat(x) %&% t(x) + else { + if(!is.na(boolArith)) + warning(gettextf("'boolArith = %d' not yet implemented", + boolArith), domain=NA) + .sparseV2Mat(x) %*% t(x) + } + }) ## Fallbacks -- symmetric RHS --> saving a t(.): ## {FIXME: want the method to be `%*%` -- but primitives are not allowed as methods} -setMethod("tcrossprod", signature(x = "Matrix", y = "symmetricMatrix"), function(x,y) x %*% y) -setMethod("tcrossprod", signature(x = "ANY", y = "symmetricMatrix"), function(x,y) x %*% y) +setMethod("tcrossprod", signature(x = "Matrix", y = "symmetricMatrix"), + function(x, y=NULL, boolArith=NA, ...) + if(isTRUE(boolArith)) x %&% y else x %*% y) +setMethod("tcrossprod", signature(x = "ANY", y = "symmetricMatrix"), + function(x, y=NULL, boolArith=NA, ...) + if(isTRUE(boolArith)) x %&% y else x %*% y) ## ## cheap fallbacks setMethod("tcrossprod", signature(x = "Matrix", y = "Matrix"), - function(x, y = NULL) { + function(x, y=NULL, boolArith=NA, ...) { Matrix.msg(sprintf( "potentially suboptimal tcrossprod(\"%s\",\"%s\") as x %s t(y)", class(x), class(y), "%*%")) + if(isTRUE(boolArith)) x %&% t(y) else x %*% t(y) }) setMethod("tcrossprod", signature(x = "Matrix", y = "missing"), - function(x, y = NULL) { + function(x, y=NULL, boolArith=NA, ...) { Matrix.msg(paste0( - "potentially suboptimal crossprod(<",class(x), ">) as . %*% t(.)")) + "potentially suboptimal tcrossprod(<",class(x), ">) as . %*% t(.)")) + if(isTRUE(boolArith)) x %&% t(x) else x %*% t(x) }) setMethod("tcrossprod", signature(x = "Matrix", y = "ANY"), - function(x, y = NULL) x %*% t(y)) + function(x, y=NULL, boolArith=NA, ...) + if(isTRUE(boolArith)) x %&% t(y) else x %*% t(y)) setMethod("tcrossprod", signature(x = "ANY", y = "Matrix"), - function(x, y = NULL) { + function(x, y=NULL, boolArith=NA, ...) { Matrix.msg(sprintf( "potentially suboptimal tcrossprod(<%s>[=], \"%s\") as x %s t(y)", class(x), class(y), "%*%")) - x %*% t(y) }) + if(isTRUE(boolArith)) x %&% t(y) else x %*% t(y) }) + +###--- IV --- %&% Boolean Matrix Products ---------------------------------- + +## Goal: crossprod / tcrossprod with a 'boolArith' option: +## ---- boolArith = NA [default now] <==> boolean arithmetic if *both* matrices +## are pattern matrices +## boolArith = TRUE <==> boolean arithmetic: return n.CMatrix +## boolArith = FALSE [default later?] <==> numeric arithmetic even for pattern +## +## A %&% B <==> prod(..... boolArith = TRUE) +## A %*% B <==> now: prod(..... boolArith = NA) +## but later: prod(..... boolArith = FALSE) # <==> always numeric +## RFC: Should we introduce matprod(x, y, boolArith) as generalized "%*%" +## which also has all three boolArith options ? +## since %*% does not allow 'boolArith = FALSE' now, or 'boolArith = NA' later + +setMethod("%&%", signature(x = "ANY", y = "ANY"), + function(x, y) as.matrix(x) %&% as.matrix(y)) +setMethod("%&%", signature(x = "matrix", y = "ANY"), function(x, y) x %&% as.matrix(y)) +setMethod("%&%", signature(x = "ANY", y = "matrix"), function(x, y) as.matrix(x) %&% y) +setMethod("%&%", signature(x = "Matrix", y = "ANY"), function(x, y) x %&% as(y, "Matrix")) +setMethod("%&%", signature(x = "ANY", y = "Matrix"), function(x, y) as(x, "Matrix") %&% y) +## catch all +setMethod("%&%", signature(x = "mMatrix", y = "mMatrix"), + function(x, y) as(x, "nMatrix") %&% as(y, "nMatrix")) +setMethod("%&%", signature(x = "Matrix", y = "Matrix"), + function(x, y) as(x, "nMatrix") %&% as(y, "nMatrix")) +setMethod("%&%", signature(x = "mMatrix", y = "nMatrix"), function(x, y) as(x, "nMatrix") %&% y) +setMethod("%&%", signature(x = "nMatrix", y = "mMatrix"), function(x, y) x %&% as(y, "nMatrix")) + +## sparseVectors : +sp.bx.sp <- function(x, y) Matrix(any(x & y), 1L, 1L, sparse=FALSE) +sp.bX.sp <- function(x, y) { + if((n <- length(x)) == length(y)) sp.bx.sp(x,y) + else if(n == 1L) spV2M(x, nrow = 1L, ncol = 1L, check = FALSE) %&% y + else stop("non-conformable arguments") +} +v.bX.sp <- function(x, y) { + if((n <- length(x)) == length(y)) sp.bx.sp(x,y) + else if(n == 1L) matrix(x, nrow = 1L, ncol = 1L) %&% y + else stop("non-conformable arguments") +} +setMethod("%&%", signature(x = "mMatrix", y = "sparseVector"), function(x, y) + x %&% `dim<-`(y, if(ncol(x) == (n <- length(y))) c(n, 1L) else c(1L, n))) + +setMethod("%&%", signature(x = "sparseVector", y = "mMatrix"), function(x, y) + `dim<-`(x, if(nrow(y) == (n <- length(x))) c(1L, n) else c(n, 1L)) %&% y) + +setMethod("%&%", signature(x = "sparseVector", y = "sparseVector"), sp.bX.sp) +setMethod("%&%", signature(x = "sparseVector", y = "numLike"), sp.bX.sp) +setMethod("%&%", signature(x = "numLike", y = "sparseVector"), v.bX.sp) + +## For now --- suboptimally!!! --- we coerce to nsparseMatrix always: +setMethod("%&%", signature(x = "nMatrix", y = "nsparseMatrix"), + function(x, y) as(x, "nsparseMatrix") %&% y) +setMethod("%&%", signature(x = "nsparseMatrix", y = "nMatrix"), + function(x, y) x %&% as(y, "nsparseMatrix")) +setMethod("%&%", signature(x = "nMatrix", y = "nMatrix"), + function(x, y) as(x, "nsparseMatrix") %&% as(y, "nsparseMatrix")) +setMethod("%&%", signature(x = "nsparseMatrix", y = "nsparseMatrix"), + function(x, y) .Call(Csparse_Csparse_prod, as(x,"CsparseMatrix"), as(y,"CsparseMatrix"), + boolArith=TRUE)) +setMethod("%&%", signature(x = "nsparseMatrix", y = "nCsparseMatrix"), + function(x, y) .Call(Csparse_Csparse_prod, as(x,"CsparseMatrix"), y, boolArith=TRUE)) +setMethod("%&%", signature(x = "nCsparseMatrix", y = "nsparseMatrix"), + function(x, y) .Call(Csparse_Csparse_prod, x, as(y,"CsparseMatrix"), boolArith=TRUE)) +setMethod("%&%", signature(x = "nCsparseMatrix", y = "nCsparseMatrix"), + function(x, y) .Call(Csparse_Csparse_prod, x, y, boolArith=TRUE)) + + ## Local variables: ## mode: R diff --git a/R/rankMatrix.R b/R/rankMatrix.R index b274ce4f..c3d11764 100644 --- a/R/rankMatrix.R +++ b/R/rankMatrix.R @@ -32,7 +32,7 @@ rankMatrix <- function(x, tol = NULL, stopifnot(length(d <- dim(x)) == 2) p <- min(d) - miss.meth <- missing(method) + ## miss.meth <- missing(method) method <- match.arg(method) if(useGrad <- (method %in% c("useGrad", "maybeGrad"))) { diff --git a/R/spModels.R b/R/spModels.R index c45599d4..67564931 100644 --- a/R/spModels.R +++ b/R/spModels.R @@ -103,7 +103,7 @@ sparse.model.matrix <- reorder <- match(sapply(attr(t,"variables"),deparse, width.cutoff=500)[-1L], names(data)) - if (any(is.na(reorder))) + if (anyNA(reorder)) stop("model frame and formula mismatch in model.matrix()") if(!isSeq(reorder, ncol(data), Ostart=FALSE)) data <- data[,reorder, drop=FALSE] @@ -275,7 +275,8 @@ is.model.frame <- function(x) is.matrix(attr(tms, "factors")) && is.language(vv <- attr(tms, "variables")) && vv[[1]] == as.symbol("list") && - all((vars <- sapply(as.list(vv[-1]), as.character)) %in% colnames(x)) + all(vapply(as.list(vv[-1]), as.character, "") %in% colnames(x)) + ## all((vars <- sapply(as.list(vv[-1]), as.character)) %in% colnames(x)) ## and we could go on testing vars } diff --git a/R/sparseMatrix.R b/R/sparseMatrix.R index c17eebf5..87f83a44 100644 --- a/R/sparseMatrix.R +++ b/R/sparseMatrix.R @@ -9,7 +9,7 @@ setAs("ANY", "sparseMatrix", function(from) as(from, "CsparseMatrix")) ## If people did not use xtabs(), but table(): setAs("table", "sparseMatrix", function(from) { - if(length(d <- dim(from)) != 2) + if(length(dim(from)) != 2L) stop("only 2-dimensional tables can be directly coerced to sparse matrices") as(unclass(from), "CsparseMatrix") }) @@ -55,7 +55,7 @@ sparseMatrix <- function(i = ep, j = ep, p, x, dims, dimnames, ## "minimal dimensions" from (i,j,p); no warnings from empty i or j : dims.min <- suppressWarnings(c(max(i), max(j))) - if(any(is.na(dims.min))) stop("NA's in (i,j) are not allowed") + if(anyNA(dims.min)) stop("NA's in (i,j) are not allowed") if(missing(dims)) { dims <- dims.min } else { ## check dims @@ -893,9 +893,14 @@ rsparsematrix <- function(nrow, ncol, density, if(symmetric) sample(indTri(nrow, diag=TRUE), nnz) else sample.int(maxE, nnz) ## i,j below correspond to ij <- decodeInd(code, nr) : - sparseMatrix(i = ijI %% nrow, - j = ijI %/% nrow, - index1 = FALSE, symmetric = symmetric, - x = rand.x(nnz), dims = c(nrow, ncol), ...) + if(is.null(rand.x)) + sparseMatrix(i = ijI %% nrow, + j = ijI %/% nrow, + index1 = FALSE, symmetric = symmetric, dims = c(nrow, ncol), ...) + else + sparseMatrix(i = ijI %% nrow, + j = ijI %/% nrow, + index1 = FALSE, symmetric = symmetric, + x = rand.x(nnz), dims = c(nrow, ncol), ...) } diff --git a/R/sparseQR.R b/R/sparseQR.R index 3ce0a325..48a1cfce 100644 --- a/R/sparseQR.R +++ b/R/sparseQR.R @@ -22,7 +22,8 @@ setMethod("qr.Q", "sparseQR", function(qr, complete=FALSE, Dvec) { d <- qr@Dim - ir <- seq_len(d[k <- if(complete) 1L else 2L]) + ## ir <- seq_len(d[k <- if(complete) 1L else 2L]) + k <- if(complete) 1L else 2L if(missing(Dvec)) Dvec <- rep.int(1, if(complete) d[1] else min(d)) D <- .sparseDiagonal(d[1], x=Dvec, cols=0L:(d[k] -1L)) qr.qy(qr, D) diff --git a/R/sparseVector.R b/R/sparseVector.R index 0a00266e..cda4d436 100644 --- a/R/sparseVector.R +++ b/R/sparseVector.R @@ -49,7 +49,7 @@ setAs("xsparseVector", "zsparseVector", setAs("xsparseVector", "nsparseVector", function(from) { - if(any(is.na(from@x))) + if(anyNA(from@x)) stop("cannot coerce 'NA's to \"nsparseVector\"") new("nsparseVector", i = from@i, length = from@length) }) @@ -201,7 +201,7 @@ setAs("TsparseMatrix", "sparseVector", from <- as(from, "generalMatrix") else if(extends(cld, "triangularMatrix") && from@diag == "U") from <- .Call(Tsparse_diagU2N, from) - if(is_duplicatedT(from, di = d)) + if(anyDuplicatedT(from, di = d)) from <- uniqTsparse(from) ii <- if(n < .Machine$integer.max) 1L + from@i + d[1] * from@j diff --git a/R/symmetricMatrix.R b/R/symmetricMatrix.R index 8297d66d..04f664c0 100644 --- a/R/symmetricMatrix.R +++ b/R/symmetricMatrix.R @@ -49,15 +49,26 @@ setMethod("forceSymmetric", signature(x="sparseMatrix"), callGeneric() }) -forceCspSymmetric <- function(x, uplo, isTri = is(x, "triangularMatrix")) +##' @title Transform a CsparseMatrix into a [dln]sCMatrix (symmetricMatrix) +##' @param x CsparseMatrix +##' @param uplo missing, "U", or "L" +##' @param isTri logical specifying if 'x' is triangular +##' @param symDimnames logical specifying if dimnames() will be forced to +##' symmetric even when one of the two is NULL +forceCspSymmetric <- function(x, uplo, isTri = is(x, "triangularMatrix"), + symDimnames = FALSE) { ## isTri ==> effectively *diagonal* if(isTri && x@diag == "U") x <- .Call(Csparse_diagU2N, x) if(missing(uplo)) uplo <- if(isTri) x@uplo else "U" - .Call(Csparse_general_to_symmetric, x, uplo) + .Call(Csparse_general_to_symmetric, x, uplo, symDimnames) } +.gC2sym <- function(x, uplo, symDimnames = FALSE) + .Call(Csparse_general_to_symmetric, x, uplo, symDimnames) + + setMethod("forceSymmetric", signature(x="CsparseMatrix"), function(x, uplo) forceCspSymmetric(x, uplo)) @@ -65,6 +76,19 @@ setMethod("forceSymmetric", signature(x="CsparseMatrix"), setMethod("symmpart", signature(x = "symmetricMatrix"), function(x) x) setMethod("skewpart", signature(x = "symmetricMatrix"), function(x) .setZero(x)) +##' Allow x@Dimnames to be contain one NULL with still symmetric dimnames() +if(FALSE) ##' R version {overwritten, just below}: +symmetricDimnames <- function(x) { + r <- x@Dimnames # validity ==> r is length-2 list + if(is.null(r[[1L]]) && !is.null(r[[2L]])) + r[[1L]] <- r[[2L]] + else if(is.null(r[[2L]]) && !is.null(r[[1L]])) + r[[2L]] <- r[[1L]] + r +} +symmetricDimnames <- function(x) .Call(R_symmetric_Dimnames, x) +setMethod("dimnames", signature(x = "symmetricMatrix"), symmetricDimnames) + ###------- pack() and unpack() --- for *dense* symmetric & triangular matrices: packM <- function(x, Mtype, kind, unpack=FALSE) { cd <- getClassDef(cx <- class(x)) diff --git a/R/zzz.R b/R/zzz.R index 07fad5ad..b118a97a 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -16,8 +16,29 @@ ## based on [cr]bind2 : ## ## save to cBind / rBind ("rename") -cBind <- methods:::cbind -rBind <- methods:::rbind +if(getRversion() >= "3.2.0") { + ## New (2015-02) base :: cbind(), rbind() which dispatch on S4 "when needed": + cBind <- function (..., deparse.level = 1) { + ## not yet by default: (TODO: Once per session from ~ Oct.2015) + if(isTRUE(getOption("Matrix.warn")) || + isTRUE(getOption("Matrix.verbose"))) + .Deprecated(msg = "'cBind' is deprecated. + Since R version 3.2.0, base's cbind() should work fine with S4 objects") + base::cbind(..., deparse.level=deparse.level) + } + rBind <- function (..., deparse.level = 1) { + ## not yet by default: (TODO: ...) + if(isTRUE(getOption("Matrix.warn")) || + isTRUE(getOption("Matrix.verbose"))) + .Deprecated(msg = "'rBind' is deprecated. + Since R version 3.2.0, base's rbind() should work fine with S4 objects") + base::rbind(..., deparse.level=deparse.level) + } + +} else { + cBind <- methods:::cbind + rBind <- methods:::rbind +} .onUnload <- function(libpath) { diff --git a/TODO b/TODO index 95166aa7..9d3c4975 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,20 @@ ##-*- mode: org -*- +* Very *Urgent* +** TODO %*% and crossprod(), tcrossprod() often return a pattern, + i.e., nsparseMatrix as well *because* cholmod_ssmult() just does that even + if only *one* of the two matrices is a pattern matrix. The latter case + is really wrong. The above behavior seems many years old.. and + sometimes is interesting and good, using Boolean arithmetic: T+T := T|T = T + + Currently I think we should change to return *numeric*, i.e., behave the same as for + 'ndenseMatrix' or 'lsparseMatrix' or traditional logical matrices. + OTOH, we then would want to provide the previous functionality via a + Matrix package R function in some way. What name should this function get ? + + What Matrix - dependent packages would break ? + ==> send e-mail to all maintainer() ?? + * *Urgent* in some sense --------------------------------------------------- ** DONE [t]crossprod() could/should become more lenient with *vector*s: adapt R-devel (= R 3.2.0)'s rules: see misc/products-Mv.R and *.Rout -- now tests/matprod.R ("3.2.0") @@ -7,7 +22,11 @@ *** DONE consider analagous changes to base-R ** DONE m %*% M (crossprod, ..) with 0-dim. result give garbage ** DONE M[i,j] should *not* drop dimnames (R-forge bug 2556, see ~/R/MM/Pkg-ex/Matrix/dimnames-prod.R) +** DONE "Math"/"Math2" *fail* entirely for sparseVectors +** DONE rbind2(, ) did not work, now is completely wrong !! (e.g. , ) ** TODO M[] indexing should work (but with a warning: use *dense*!) +** TODO doxygen (seed inst/Doxyfile and ../../www/doxygen/UPDATE_me.sh) now _fails_ partly, e.g., for + ------- e.g., for src/Csparse.c, Csp_dense_products(...) around lines 600 ** TODO src/CHOLMOD/MatrixOps/cholmod_symmetry.c is "cool" and fast; Definitely should use it for solve() {it seems MATLAB does}; alternatively also is_sym() [in src/cs_utils.c], see below. @@ -25,24 +44,28 @@ alternatively also is_sym() [in src/cs_utils.c], see below. level e.g. for solve(). Should define expand() method or similar, see man/BunchKaufman-methods.Rd and R/dsyMatrix.R (at end). ** TODO src/cs_utils.c : I think is_sym() [only used in Matrix_cs_to_SEXP()] can be made sped up: -leave the for loops, as soon as is_lower == is_upper == 0. + leave the for loops, as soon as is_lower == is_upper == 0. -** DONE "Math"/"Math2" *fail* entirely for sparseVectors +** TODO kronecker(, ) should return symmetricMatrix, notably + when one of the arguments is diagonal * New smallish ideas, relatively urgent for MM ----------------------------- ** DONE generalize new "indMatrix" class, to allow 0 repetitions of some samples, i.e., columns of all 0 s. It's mathematically more natural --> typically will be useful. ** DONE polnish translation (e-mail!) +** DONE FIXME(2) and (3) in R/products.R: t(.Call(Csparse_dense_*)) ** TODO cor() and cov() at least for y=NULL ("no y"). --> ~/R/MM/Pkg-ex/Matrix/cor_sparse-propos.R <- http://stackoverflow.com/questions/5888287/ + -> ~/R/MM/Pkg-ex/Matrix/cor_sparse-propos.R <- http://stackoverflow.com/questions/5888287/ + -> ~/R/MM/Pkg-ex/Matrix/cor_cos.R and + ~/R/MM/Pkg-ex/Matrix/cor_cos_testing + Provide cor.sparse() and other association measures for sparse matrices. ** TODO Investigate the "band changing (and getting) ideas 'band<-' etc, from Jeremy D Silver, per posts to R-devel on Aug.26,2011 {MM: ~/R/MM/Pkg-ex/Matrix/bands-Jeremy_Silver-ex.R } +** TODO finalize and activate the _unused_ code in src/t_sparseVector.c -** TODO FIXME(2) and (3) in R/products.R: t(.Call(Csparse_dense_*)) ** TODO cbind2() / rbind2() for sparseMatrices: dimnames propagation should happen in C, see R/bind2.R and src/Csparse.c (Csparse_horzcat etc). - ** TODO use getOption("Matrix.quiet") in more places [--> less messages/warnings] ** TODO Check for DimNames propagation in coercion and other operations. Done for (%*%, crossprod, tcrossprod) -- but not systematically checked (tests/matprod.R) @@ -57,7 +80,6 @@ leave the for loops, as soon as is_lower == is_upper == 0. 'classed' argument. [done with dgeMatrix_matrix_mm(); not yet for other classes; and for _crossprod()] - ** DONE Cache '@factors' components also from R, e.g., for "Tsparse.." via .set.factors() ** TODO chol() and Cholesky() caching unfinished: the *name* [Ss][Pp][Dd]Cholesky @@ -119,8 +141,6 @@ leave the for loops, as soon as is_lower == is_upper == 0. ** TODO make sure *all* group methods have (maybe "bail-out") setMethod for "Matrix". e.g. zapsmall() fails "badly" -** TODO rbind2(, ) does not work (e.g. , ) - ** TODO %*% {also in crossprod/tcrossprod} currently always returns , since --> Csparse_dense_prod --> cholmod_sdmult and that does only return dense. @@ -303,8 +323,6 @@ leave the for loops, as soon as is_lower == is_upper == 0. correct and equivalent to src/CHOLMOD/Include/cholmod_core.h and siblings ??? {currently need to do this manually (Emacs M-x compare-windows) for the typedefs} -** finalize and activate the new *unused* code in src/t_sparseVector.c - ** check all uses of alloca()/Alloca() in src/*.[ch] ensuring that the *size* allocated cannot grow with the vector/matrix/nnzero sizes of the input. diff --git a/inst/Doxyfile b/inst/Doxyfile index 9a658ad1..45d78d68 100644 --- a/inst/Doxyfile +++ b/inst/Doxyfile @@ -1,109 +1,121 @@ -# Doxyfile 1.7.4 +# Doxyfile 1.8.6 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project. # -# All text after a hash (#) is considered a comment and will be ignored. +# All text after a double hash (##) is considered a comment and is placed in +# front of the TAG it is preceding. +# +# All text after a single hash (#) is considered a comment and will be ignored. # The format is: -# TAG = value [value, ...] -# For lists items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (" "). +# TAG = value [value, ...] +# For lists, items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (\" \"). #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- # This tag specifies the encoding used for all characters in the config file -# that follow. The default is UTF-8 which is also the encoding used for all -# text before the first occurrence of this tag. Doxygen uses libiconv (or the -# iconv built into libc) for the transcoding. See -# http://www.gnu.org/software/libiconv for the list of possible encodings. +# that follow. The default is UTF-8 which is also the encoding used for all text +# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv +# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv +# for the list of possible encodings. +# The default value is: UTF-8. DOXYFILE_ENCODING = UTF-8 -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded -# by quotes) that should identify the project. +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by +# double-quotes, unless you are using Doxywizard) that should identify the +# project for which the documentation is generated. This name is used in the +# title of most generated pages and in a few other places. +# The default value is: My Project. PROJECT_NAME = Matrix -# The PROJECT_NUMBER tag can be used to enter a project or revision number. -# This could be handy for archiving the generated documentation or -# if some version control system is used. +# The PROJECT_NUMBER tag can be used to enter a project or revision number. This +# could be handy for archiving the generated documentation or if some version +# control system is used. -PROJECT_NUMBER = "$Rev: 2721 $ at $LastChangedDate: 2011-10-06 14:59:16 +0200 (Thu, 06 Oct 2011) $" +PROJECT_NUMBER = "$Rev: 3071 $ at $LastChangedDate: 2015-03-26 15:35:47 +0100 (Thu, 26 Mar 2015) $" # Using the PROJECT_BRIEF tag one can provide an optional one line description -# for a project that appears at the top of each page and should give viewer -# a quick idea about the purpose of the project. Keep the description short. +# for a project that appears at the top of each page and should give viewer a +# quick idea about the purpose of the project. Keep the description short. PROJECT_BRIEF = -# With the PROJECT_LOGO tag one can specify an logo or icon that is -# included in the documentation. The maximum height of the logo should not -# exceed 55 pixels and the maximum width should not exceed 200 pixels. -# Doxygen will copy the logo to the output directory. +# With the PROJECT_LOGO tag one can specify an logo or icon that is included in +# the documentation. The maximum height of the logo should not exceed 55 pixels +# and the maximum width should not exceed 200 pixels. Doxygen will copy the logo +# to the output directory. PROJECT_LOGO = -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) -# base path where the generated documentation will be put. -# If a relative path is entered, it will be relative to the location -# where doxygen was started. If left blank the current directory will be used. +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path +# into which the generated documentation will be written. If a relative path is +# entered, it will be relative to the location where doxygen was started. If +# left blank the current directory will be used. OUTPUT_DIRECTORY = ../../../www/doxygen -# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create -# 4096 sub-directories (in 2 levels) under the output directory of each output -# format and will distribute the generated files over these directories. -# Enabling this option can be useful when feeding doxygen a huge amount of -# source files, where putting all generated files in the same directory would -# otherwise cause performance problems for the file system. +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 4096 sub- +# directories (in 2 levels) under the output directory of each output format and +# will distribute the generated files over these directories. Enabling this +# option can be useful when feeding doxygen a huge amount of source files, where +# putting all generated files in the same directory would otherwise causes +# performance problems for the file system. +# The default value is: NO. CREATE_SUBDIRS = NO # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. -# The default language is English, other supported languages are: -# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, -# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, -# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English -# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, -# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, -# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. +# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, +# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), +# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, +# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), +# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, +# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, +# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, +# Ukrainian and Vietnamese. +# The default value is: English. OUTPUT_LANGUAGE = English -# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will -# include brief member descriptions after the members that are listed in -# the file and class documentation (similar to JavaDoc). -# Set to NO to disable this. +# If the BRIEF_MEMBER_DESC tag is set to YES doxygen will include brief member +# descriptions after the members that are listed in the file and class +# documentation (similar to Javadoc). Set to NO to disable this. +# The default value is: YES. BRIEF_MEMBER_DESC = YES -# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend -# the brief description of a member or function before the detailed description. -# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# If the REPEAT_BRIEF tag is set to YES doxygen will prepend the brief +# description of a member or function before the detailed description +# +# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. +# The default value is: YES. REPEAT_BRIEF = YES -# This tag implements a quasi-intelligent brief description abbreviator -# that is used to form the text in various listings. Each string -# in this list, if found as the leading text of the brief description, will be -# stripped from the text and the result after processing the whole list, is -# used as the annotated text. Otherwise, the brief description is used as-is. -# If left blank, the following values are used ("$name" is automatically -# replaced with the name of the entity): "The $name class" "The $name widget" -# "The $name file" "is" "provides" "specifies" "contains" -# "represents" "a" "an" "the" +# This tag implements a quasi-intelligent brief description abbreviator that is +# used to form the text in various listings. Each string in this list, if found +# as the leading text of the brief description, will be stripped from the text +# and the result, after processing the whole list, is used as the annotated +# text. Otherwise, the brief description is used as-is. If left blank, the +# following values are used ($name is automatically replaced with the name of +# the entity):The $name class, The $name widget, The $name file, is, provides, +# specifies, contains, represents, a, an and the. ABBREVIATE_BRIEF = # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# Doxygen will generate a detailed section even if there is only a brief +# doxygen will generate a detailed section even if there is only a brief # description. +# The default value is: NO. ALWAYS_DETAILED_SEC = YES @@ -111,153 +123,204 @@ ALWAYS_DETAILED_SEC = YES # inherited members of a class in the documentation of that class as if those # members were ordinary class members. Constructors, destructors and assignment # operators of the base classes will not be shown. +# The default value is: NO. INLINE_INHERITED_MEMB = NO -# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full -# path before files name in the file list and in the header files. If set -# to NO the shortest path that makes the file name unique will be used. +# If the FULL_PATH_NAMES tag is set to YES doxygen will prepend the full path +# before files name in the file list and in the header files. If set to NO the +# shortest path that makes the file name unique will be used +# The default value is: YES. FULL_PATH_NAMES = NO -# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag -# can be used to strip a user-defined part of the path. Stripping is -# only done if one of the specified strings matches the left-hand part of -# the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the -# path to strip. +# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. +# Stripping is only done if one of the specified strings matches the left-hand +# part of the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the path to +# strip. +# +# Note that you can specify absolute paths here, but also relative paths, which +# will be relative from the directory where doxygen is started. +# This tag requires that the tag FULL_PATH_NAMES is set to YES. STRIP_FROM_PATH = -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of -# the path mentioned in the documentation of a class, which tells -# the reader which header file to include in order to use a class. -# If left blank only the name of the header file containing the class -# definition is used. Otherwise one should specify the include paths that -# are normally passed to the compiler using the -I flag. +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the +# path mentioned in the documentation of a class, which tells the reader which +# header file to include in order to use a class. If left blank only the name of +# the header file containing the class definition is used. Otherwise one should +# specify the list of include paths that are normally passed to the compiler +# using the -I flag. STRIP_FROM_INC_PATH = -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter -# (but less readable) file names. This can be useful if your file system -# doesn't support long names like on DOS, Mac, or CD-ROM. +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but +# less readable) file names. This can be useful is your file systems doesn't +# support long names like on DOS, Mac, or CD-ROM. +# The default value is: NO. SHORT_NAMES = NO -# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen -# will interpret the first line (until the first dot) of a JavaDoc-style -# comment as the brief description. If set to NO, the JavaDoc -# comments will behave just like regular Qt-style comments -# (thus requiring an explicit @brief command for a brief description.) +# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the +# first line (until the first dot) of a Javadoc-style comment as the brief +# description. If set to NO, the Javadoc-style will behave just like regular Qt- +# style comments (thus requiring an explicit @brief command for a brief +# description.) +# The default value is: NO. JAVADOC_AUTOBRIEF = YES -# If the QT_AUTOBRIEF tag is set to YES then Doxygen will -# interpret the first line (until the first dot) of a Qt-style -# comment as the brief description. If set to NO, the comments -# will behave just like regular Qt-style comments (thus requiring -# an explicit \brief command for a brief description.) +# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first +# line (until the first dot) of a Qt-style comment as the brief description. If +# set to NO, the Qt-style will behave just like regular Qt-style comments (thus +# requiring an explicit \brief command for a brief description.) +# The default value is: NO. QT_AUTOBRIEF = NO -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen -# treat a multi-line C++ special comment block (i.e. a block of //! or /// -# comments) as a brief description. This used to be the default behaviour. -# The new default is to treat a multi-line C++ comment block as a detailed -# description. Set this tag to YES if you prefer the old behaviour instead. +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a +# multi-line C++ special comment block (i.e. a block of //! or /// comments) as +# a brief description. This used to be the default behavior. The new default is +# to treat a multi-line C++ comment block as a detailed description. Set this +# tag to YES if you prefer the old behavior instead. +# +# Note that setting this tag to YES also means that rational rose comments are +# not recognized any more. +# The default value is: NO. MULTILINE_CPP_IS_BRIEF = NO -# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented -# member inherits the documentation from any documented member that it -# re-implements. +# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the +# documentation from any documented member that it re-implements. +# The default value is: YES. INHERIT_DOCS = YES -# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce -# a new page for each member. If set to NO, the documentation of a member will -# be part of the file/class/namespace that contains it. +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce a +# new page for each member. If set to NO, the documentation of a member will be +# part of the file/class/namespace that contains it. +# The default value is: NO. SEPARATE_MEMBER_PAGES = NO -# The TAB_SIZE tag can be used to set the number of spaces in a tab. -# Doxygen uses this value to replace tabs by spaces in code fragments. +# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen +# uses this value to replace tabs by spaces in code fragments. +# Minimum value: 1, maximum value: 16, default value: 4. TAB_SIZE = 8 -# This tag can be used to specify a number of aliases that acts -# as commands in the documentation. An alias has the form "name=value". -# For example adding "sideeffect=\par Side Effects:\n" will allow you to -# put the command \sideeffect (or @sideeffect) in the documentation, which -# will result in a user-defined paragraph with heading "Side Effects:". -# You can put \n's in the value part of an alias to insert newlines. +# This tag can be used to specify a number of aliases that act as commands in +# the documentation. An alias has the form: +# name=value +# For example adding +# "sideeffect=@par Side Effects:\n" +# will allow you to put the command \sideeffect (or @sideeffect) in the +# documentation, which will result in a user-defined paragraph with heading +# "Side Effects:". You can put \n's in the value part of an alias to insert +# newlines. ALIASES = -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C -# sources only. Doxygen will then generate output that is more tailored for C. -# For instance, some of the names that are used will be different. The list -# of all members will be omitted, etc. +# This tag can be used to specify a number of word-keyword mappings (TCL only). +# A mapping has the form "name=value". For example adding "class=itcl::class" +# will allow you to use the command class in the itcl::class meaning. + +TCL_SUBST = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources +# only. Doxygen will then generate output that is more tailored for C. For +# instance, some of the names that are used will be different. The list of all +# members will be omitted, etc. +# The default value is: NO. OPTIMIZE_OUTPUT_FOR_C = YES -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java -# sources only. Doxygen will then generate output that is more tailored for -# Java. For instance, namespaces will be presented as packages, qualified -# scopes will look different, etc. +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or +# Python sources only. Doxygen will then generate output that is more tailored +# for that language. For instance, namespaces will be presented as packages, +# qualified scopes will look different, etc. +# The default value is: NO. OPTIMIZE_OUTPUT_JAVA = NO # Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran -# sources only. Doxygen will then generate output that is more tailored for -# Fortran. +# sources. Doxygen will then generate output that is tailored for Fortran. +# The default value is: NO. OPTIMIZE_FOR_FORTRAN = NO # Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL -# sources. Doxygen will then generate output that is tailored for -# VHDL. +# sources. Doxygen will then generate output that is tailored for VHDL. +# The default value is: NO. OPTIMIZE_OUTPUT_VHDL = NO # Doxygen selects the parser to use depending on the extension of the files it -# parses. With this tag you can assign which parser to use for a given extension. -# Doxygen has a built-in mapping, but you can override or extend it using this -# tag. The format is ext=language, where ext is a file extension, and language -# is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C, -# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make +# parses. With this tag you can assign which parser to use for a given +# extension. Doxygen has a built-in mapping, but you can override or extend it +# using this tag. The format is ext=language, where ext is a file extension, and +# language is one of the parsers supported by doxygen: IDL, Java, Javascript, +# C#, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL. For instance to make # doxygen treat .inc files as Fortran files (default is PHP), and .f files as C -# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions -# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. +# (default is Fortran), use: inc=Fortran f=C. +# +# Note For files without extension you can use no_extension as a placeholder. +# +# Note that for custom extensions you also need to set FILE_PATTERNS otherwise +# the files are not read by doxygen. EXTENSION_MAPPING = +# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments +# according to the Markdown format, which allows for more readable +# documentation. See http://daringfireball.net/projects/markdown/ for details. +# The output of markdown processing is further processed by doxygen, so you can +# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in +# case of backward compatibilities issues. +# The default value is: YES. + +MARKDOWN_SUPPORT = YES + +# When enabled doxygen tries to link words that correspond to documented +# classes, or namespaces to their corresponding documentation. Such a link can +# be prevented in individual cases by by putting a % sign in front of the word +# or globally by setting AUTOLINK_SUPPORT to NO. +# The default value is: YES. + +AUTOLINK_SUPPORT = YES + # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want -# to include (a tag file for) the STL sources as input, then you should -# set this tag to YES in order to let doxygen match functions declarations and -# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. -# func(std::string) {}). This also makes the inheritance and collaboration +# to include (a tag file for) the STL sources as input, then you should set this +# tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); +# versus func(std::string) {}). This also make the inheritance and collaboration # diagrams that involve STL classes more complete and accurate. +# The default value is: NO. BUILTIN_STL_SUPPORT = NO # If you use Microsoft's C++/CLI language, you should set this option to YES to # enable parsing support. +# The default value is: NO. CPP_CLI_SUPPORT = NO -# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. -# Doxygen will parse them like normal C++ but will assume all classes use public -# instead of private inheritance when no explicit protection keyword is present. +# Set the SIP_SUPPORT tag to YES if your project consists of sip (see: +# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen +# will parse them like normal C++ but will assume all classes use public instead +# of private inheritance when no explicit protection keyword is present. +# The default value is: NO. SIP_SUPPORT = NO -# For Microsoft's IDL there are propget and propput attributes to indicate getter -# and setter methods for a property. Setting this option to YES (the default) -# will make doxygen replace the get and set methods by a property in the -# documentation. This will only work if the methods are indeed getting or -# setting a simple type. If this is not the case, or you want to show the -# methods anyway, you should set this option to NO. +# For Microsoft's IDL there are propget and propput attributes to indicate +# getter and setter methods for a property. Setting this option to YES will make +# doxygen to replace the get and set methods by a property in the documentation. +# This will only work if the methods are indeed getting or setting a simple +# type. If this is not the case, or you want to show the methods anyway, you +# should set this option to NO. +# The default value is: YES. IDL_PROPERTY_SUPPORT = YES @@ -265,394 +328,471 @@ IDL_PROPERTY_SUPPORT = YES # tag is set to YES, then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. +# The default value is: NO. DISTRIBUTE_GROUP_DOC = NO -# Set the SUBGROUPING tag to YES (the default) to allow class member groups of -# the same type (for instance a group of public functions) to be put as a -# subgroup of that type (e.g. under the Public Functions section). Set it to -# NO to prevent subgrouping. Alternatively, this can be done per class using -# the \nosubgrouping command. +# Set the SUBGROUPING tag to YES to allow class member groups of the same type +# (for instance a group of public functions) to be put as a subgroup of that +# type (e.g. under the Public Functions section). Set it to NO to prevent +# subgrouping. Alternatively, this can be done per class using the +# \nosubgrouping command. +# The default value is: YES. SUBGROUPING = YES -# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and -# unions are shown inside the group in which they are included (e.g. using -# @ingroup) instead of on a separate page (for HTML and Man pages) or -# section (for LaTeX and RTF). +# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions +# are shown inside the group in which they are included (e.g. using \ingroup) +# instead of on a separate page (for HTML and Man pages) or section (for LaTeX +# and RTF). +# +# Note that this feature does not work in combination with +# SEPARATE_MEMBER_PAGES. +# The default value is: NO. INLINE_GROUPED_CLASSES = NO -# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum -# is documented as struct, union, or enum with the name of the typedef. So +# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions +# with only public data fields or simple typedef fields will be shown inline in +# the documentation of the scope in which they are defined (i.e. file, +# namespace, or group documentation), provided this scope is documented. If set +# to NO, structs, classes, and unions are shown on a separate page (for HTML and +# Man pages) or section (for LaTeX and RTF). +# The default value is: NO. + +INLINE_SIMPLE_STRUCTS = NO + +# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or +# enum is documented as struct, union, or enum with the name of the typedef. So # typedef struct TypeS {} TypeT, will appear in the documentation as a struct # with name TypeT. When disabled the typedef will appear as a member of a file, -# namespace, or class. And the struct will be named TypeS. This can typically -# be useful for C code in case the coding convention dictates that all compound +# namespace, or class. And the struct will be named TypeS. This can typically be +# useful for C code in case the coding convention dictates that all compound # types are typedef'ed and only the typedef is referenced, never the tag name. +# The default value is: NO. TYPEDEF_HIDES_STRUCT = NO -# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to -# determine which symbols to keep in memory and which to flush to disk. -# When the cache is full, less often used symbols will be written to disk. -# For small to medium size projects (<1000 input files) the default value is -# probably good enough. For larger projects a too small cache size can cause -# doxygen to be busy swapping symbols to and from disk most of the time -# causing a significant performance penalty. -# If the system has enough physical memory increasing the cache will improve the -# performance by keeping more symbols in memory. Note that the value works on -# a logarithmic scale so increasing the size by one will roughly double the -# memory usage. The cache size is given by this formula: -# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, -# corresponding to a cache size of 2^16 = 65536 symbols - -SYMBOL_CACHE_SIZE = 0 +# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This +# cache is used to resolve symbols given their name and scope. Since this can be +# an expensive process and often the same symbol appears multiple times in the +# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small +# doxygen will become slower. If the cache is too large, memory is wasted. The +# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range +# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 +# symbols. At the end of a run doxygen will report the cache usage and suggest +# the optimal cache size from a speed point of view. +# Minimum value: 0, maximum value: 9, default value: 0. + +LOOKUP_CACHE_SIZE = 0 #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- # If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in -# documentation are documented, even if no documentation was available. -# Private class members and static file members will be hidden unless -# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES +# documentation are documented, even if no documentation was available. Private +# class members and static file members will be hidden unless the +# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. +# Note: This will also disable the warnings about undocumented members that are +# normally produced when WARNINGS is set to YES. +# The default value is: NO. EXTRACT_ALL = YES -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class -# will be included in the documentation. +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class will +# be included in the documentation. +# The default value is: NO. EXTRACT_PRIVATE = NO -# If the EXTRACT_STATIC tag is set to YES all static members of a file -# will be included in the documentation. +# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal +# scope will be included in the documentation. +# The default value is: NO. + +EXTRACT_PACKAGE = NO + +# If the EXTRACT_STATIC tag is set to YES all static members of a file will be +# included in the documentation. +# The default value is: NO. EXTRACT_STATIC = YES -# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) -# defined locally in source files will be included in the documentation. -# If set to NO only classes defined in header files are included. +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) defined +# locally in source files will be included in the documentation. If set to NO +# only classes defined in header files are included. Does not have any effect +# for Java sources. +# The default value is: YES. EXTRACT_LOCAL_CLASSES = YES -# This flag is only useful for Objective-C code. When set to YES local -# methods, which are defined in the implementation section but not in -# the interface are included in the documentation. -# If set to NO (the default) only methods in the interface are included. +# This flag is only useful for Objective-C code. When set to YES local methods, +# which are defined in the implementation section but not in the interface are +# included in the documentation. If set to NO only methods in the interface are +# included. +# The default value is: NO. EXTRACT_LOCAL_METHODS = NO # If this flag is set to YES, the members of anonymous namespaces will be # extracted and appear in the documentation as a namespace called -# 'anonymous_namespace{file}', where file will be replaced with the base -# name of the file that contains the anonymous namespace. By default -# anonymous namespaces are hidden. +# 'anonymous_namespace{file}', where file will be replaced with the base name of +# the file that contains the anonymous namespace. By default anonymous namespace +# are hidden. +# The default value is: NO. EXTRACT_ANON_NSPACES = NO -# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all -# undocumented members of documented classes, files or namespaces. -# If set to NO (the default) these members will be included in the -# various overviews, but no documentation section is generated. -# This option has no effect if EXTRACT_ALL is enabled. +# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all +# undocumented members inside documented classes or files. If set to NO these +# members will be included in the various overviews, but no documentation +# section is generated. This option has no effect if EXTRACT_ALL is enabled. +# The default value is: NO. HIDE_UNDOC_MEMBERS = NO -# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. -# If set to NO (the default) these classes will be included in the various -# overviews. This option has no effect if EXTRACT_ALL is enabled. +# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. If set +# to NO these classes will be included in the various overviews. This option has +# no effect if EXTRACT_ALL is enabled. +# The default value is: NO. HIDE_UNDOC_CLASSES = NO -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all -# friend (class|struct|union) declarations. -# If set to NO (the default) these declarations will be included in the -# documentation. +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend +# (class|struct|union) declarations. If set to NO these declarations will be +# included in the documentation. +# The default value is: NO. HIDE_FRIEND_COMPOUNDS = NO -# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any -# documentation blocks found inside the body of a function. -# If set to NO (the default) these blocks will be appended to the -# function's detailed documentation block. +# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any +# documentation blocks found inside the body of a function. If set to NO these +# blocks will be appended to the function's detailed documentation block. +# The default value is: NO. HIDE_IN_BODY_DOCS = NO -# The INTERNAL_DOCS tag determines if documentation -# that is typed after a \internal command is included. If the tag is set -# to NO (the default) then the documentation will be excluded. -# Set it to YES to include the internal documentation. +# The INTERNAL_DOCS tag determines if documentation that is typed after a +# \internal command is included. If the tag is set to NO then the documentation +# will be excluded. Set it to YES to include the internal documentation. +# The default value is: NO. INTERNAL_DOCS = NO -# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate -# file names in lower-case letters. If set to YES upper-case letters are also +# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file +# names in lower-case letters. If set to YES upper-case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows # and Mac users are advised to set this option to NO. +# The default value is: system dependent. CASE_SENSE_NAMES = YES -# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen -# will show members with their full class and namespace scopes in the -# documentation. If set to YES the scope will be hidden. +# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with +# their full class and namespace scopes in the documentation. If set to YES the +# scope will be hidden. +# The default value is: NO. HIDE_SCOPE_NAMES = NO -# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen -# will put a list of the files that are included by a file in the documentation -# of that file. +# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of +# the files that are included by a file in the documentation of that file. +# The default value is: YES. SHOW_INCLUDE_FILES = YES -# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen -# will list include files with double quotes in the documentation -# rather than with sharp brackets. +# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each +# grouped member an include statement to the documentation, telling the reader +# which file to include in order to use the member. +# The default value is: NO. + +SHOW_GROUPED_MEMB_INC = NO + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include +# files with double quotes in the documentation rather than with sharp brackets. +# The default value is: NO. FORCE_LOCAL_INCLUDES = NO -# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] -# is inserted in the documentation for inline members. +# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the +# documentation for inline members. +# The default value is: YES. INLINE_INFO = YES -# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen -# will sort the (detailed) documentation of file and class members -# alphabetically by member name. If set to NO the members will appear in -# declaration order. +# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the +# (detailed) documentation of file and class members alphabetically by member +# name. If set to NO the members will appear in declaration order. +# The default value is: YES. SORT_MEMBER_DOCS = YES -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the -# brief documentation of file, namespace and class members alphabetically -# by member name. If set to NO (the default) the members will appear in -# declaration order. +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief +# descriptions of file, namespace and class members alphabetically by member +# name. If set to NO the members will appear in declaration order. Note that +# this will also influence the order of the classes in the class list. +# The default value is: NO. SORT_BRIEF_DOCS = YES -# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen -# will sort the (brief and detailed) documentation of class members so that -# constructors and destructors are listed first. If set to NO (the default) -# the constructors will appear in the respective orders defined by -# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. -# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO -# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the +# (brief and detailed) documentation of class members so that constructors and +# destructors are listed first. If set to NO the constructors will appear in the +# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. +# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief +# member documentation. +# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting +# detailed member documentation. +# The default value is: NO. SORT_MEMBERS_CTORS_1ST = NO -# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the -# hierarchy of group names into alphabetical order. If set to NO (the default) -# the group names will appear in their defined order. +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy +# of group names into alphabetical order. If set to NO the group names will +# appear in their defined order. +# The default value is: NO. SORT_GROUP_NAMES = NO -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be -# sorted by fully-qualified names, including namespaces. If set to -# NO (the default), the class list will be sorted only by class name, -# not including the namespace part. +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by +# fully-qualified names, including namespaces. If set to NO, the class list will +# be sorted only by class name, not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the -# alphabetical list. +# Note: This option applies only to the class list, not to the alphabetical +# list. +# The default value is: NO. SORT_BY_SCOPE_NAME = NO -# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to -# do proper type resolution of all parameters of a function it will reject a -# match between the prototype and the implementation of a member function even -# if there is only one candidate or it is obvious which candidate to choose -# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen -# will still accept a match between prototype and implementation in such cases. +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper +# type resolution of all parameters of a function it will reject a match between +# the prototype and the implementation of a member function even if there is +# only one candidate or it is obvious which candidate to choose by doing a +# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still +# accept a match between prototype and implementation in such cases. +# The default value is: NO. STRICT_PROTO_MATCHING = NO -# The GENERATE_TODOLIST tag can be used to enable (YES) or -# disable (NO) the todo list. This list is created by putting \todo -# commands in the documentation. +# The GENERATE_TODOLIST tag can be used to enable ( YES) or disable ( NO) the +# todo list. This list is created by putting \todo commands in the +# documentation. +# The default value is: YES. GENERATE_TODOLIST = YES -# The GENERATE_TESTLIST tag can be used to enable (YES) or -# disable (NO) the test list. This list is created by putting \test -# commands in the documentation. +# The GENERATE_TESTLIST tag can be used to enable ( YES) or disable ( NO) the +# test list. This list is created by putting \test commands in the +# documentation. +# The default value is: YES. GENERATE_TESTLIST = YES -# The GENERATE_BUGLIST tag can be used to enable (YES) or -# disable (NO) the bug list. This list is created by putting \bug -# commands in the documentation. +# The GENERATE_BUGLIST tag can be used to enable ( YES) or disable ( NO) the bug +# list. This list is created by putting \bug commands in the documentation. +# The default value is: YES. GENERATE_BUGLIST = YES -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or -# disable (NO) the deprecated list. This list is created by putting -# \deprecated commands in the documentation. +# The GENERATE_DEPRECATEDLIST tag can be used to enable ( YES) or disable ( NO) +# the deprecated list. This list is created by putting \deprecated commands in +# the documentation. +# The default value is: YES. GENERATE_DEPRECATEDLIST= YES -# The ENABLED_SECTIONS tag can be used to enable conditional -# documentation sections, marked by \if sectionname ... \endif. +# The ENABLED_SECTIONS tag can be used to enable conditional documentation +# sections, marked by \if ... \endif and \cond +# ... \endcond blocks. ENABLED_SECTIONS = -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines -# the initial value of a variable or macro consists of for it to appear in -# the documentation. If the initializer consists of more lines than specified -# here it will be hidden. Use a value of 0 to hide initializers completely. -# The appearance of the initializer of individual variables and macros in the -# documentation can be controlled using \showinitializer or \hideinitializer -# command in the documentation regardless of this setting. +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the +# initial value of a variable or macro / define can have for it to appear in the +# documentation. If the initializer consists of more lines than specified here +# it will be hidden. Use a value of 0 to hide initializers completely. The +# appearance of the value of individual variables and macros / defines can be +# controlled using \showinitializer or \hideinitializer command in the +# documentation regardless of this setting. +# Minimum value: 0, maximum value: 10000, default value: 30. MAX_INITIALIZER_LINES = 30 -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated -# at the bottom of the documentation of classes and structs. If set to YES the -# list will mention the files that were used to generate the documentation. +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at +# the bottom of the documentation of classes and structs. If set to YES the list +# will mention the files that were used to generate the documentation. +# The default value is: YES. SHOW_USED_FILES = YES -# If the sources in your project are distributed over multiple directories -# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy -# in the documentation. The default is NO. - -SHOW_DIRECTORIES = NO - -# Set the SHOW_FILES tag to NO to disable the generation of the Files page. -# This will remove the Files entry from the Quick Index and from the -# Folder Tree View (if specified). The default is YES. +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This +# will remove the Files entry from the Quick Index and from the Folder Tree View +# (if specified). +# The default value is: YES. SHOW_FILES = YES -# Set the SHOW_NAMESPACES tag to NO to disable the generation of the -# Namespaces page. -# This will remove the Namespaces entry from the Quick Index -# and from the Folder Tree View (if specified). The default is YES. +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces +# page. This will remove the Namespaces entry from the Quick Index and from the +# Folder Tree View (if specified). +# The default value is: YES. SHOW_NAMESPACES = YES # The FILE_VERSION_FILTER tag can be used to specify a program or script that # doxygen should invoke to get the current version for each file (typically from # the version control system). Doxygen will invoke the program by executing (via -# popen()) the command , where is the value of -# the FILE_VERSION_FILTER tag, and is the name of an input file -# provided by doxygen. Whatever the program writes to standard output -# is used as the file version. See the manual for examples. +# popen()) the command command input-file, where command is the value of the +# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided +# by doxygen. Whatever the program writes to standard output is used as the file +# version. For an example see the documentation. FILE_VERSION_FILTER = # The LAYOUT_FILE tag can be used to specify a layout file which will be parsed # by doxygen. The layout file controls the global structure of the generated -# output files in an output format independent way. The create the layout file -# that represents doxygen's defaults, run doxygen with the -l option. -# You can optionally specify a file name after the option, if omitted -# DoxygenLayout.xml will be used as the name of the layout file. +# output files in an output format independent way. To create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. You can +# optionally specify a file name after the option, if omitted DoxygenLayout.xml +# will be used as the name of the layout file. +# +# Note that if you run doxygen from a directory containing a file called +# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE +# tag is left empty. LAYOUT_FILE = +# The CITE_BIB_FILES tag can be used to specify one or more bib files containing +# the reference definitions. This must be a list of .bib files. The .bib +# extension is automatically appended if omitted. This requires the bibtex tool +# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info. +# For LaTeX the style of the bibliography can be controlled using +# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the +# search path. Do not use file names with spaces, bibtex cannot handle them. See +# also \cite for info how to create references. + +CITE_BIB_FILES = + #--------------------------------------------------------------------------- -# configuration options related to warning and progress messages +# Configuration options related to warning and progress messages #--------------------------------------------------------------------------- -# The QUIET tag can be used to turn on/off the messages that are generated -# by doxygen. Possible values are YES and NO. If left blank NO is used. +# The QUIET tag can be used to turn on/off the messages that are generated to +# standard output by doxygen. If QUIET is set to YES this implies that the +# messages are off. +# The default value is: NO. QUIET = NO # The WARNINGS tag can be used to turn on/off the warning messages that are -# generated by doxygen. Possible values are YES and NO. If left blank -# NO is used. +# generated to standard error ( stderr) by doxygen. If WARNINGS is set to YES +# this implies that the warnings are on. +# +# Tip: Turn warnings on while writing the documentation. +# The default value is: YES. WARNINGS = YES -# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings -# for undocumented members. If EXTRACT_ALL is set to YES then this flag will -# automatically be disabled. +# If the WARN_IF_UNDOCUMENTED tag is set to YES, then doxygen will generate +# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag +# will automatically be disabled. +# The default value is: YES. WARN_IF_UNDOCUMENTED = YES -# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some -# parameters in a documented function, or documenting parameters that -# don't exist or using markup commands wrongly. +# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some parameters +# in a documented function, or documenting parameters that don't exist or using +# markup commands wrongly. +# The default value is: YES. WARN_IF_DOC_ERROR = YES -# The WARN_NO_PARAMDOC option can be enabled to get warnings for -# functions that are documented, but have no documentation for their parameters -# or return value. If set to NO (the default) doxygen will only warn about -# wrong or incomplete parameter documentation, but not about the absence of -# documentation. +# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that +# are documented, but have no documentation for their parameters or return +# value. If set to NO doxygen will only warn about wrong or incomplete parameter +# documentation, but not about the absence of documentation. +# The default value is: NO. WARN_NO_PARAMDOC = NO -# The WARN_FORMAT tag determines the format of the warning messages that -# doxygen can produce. The string should contain the $file, $line, and $text -# tags, which will be replaced by the file and line number from which the -# warning originated and the warning text. Optionally the format may contain -# $version, which will be replaced by the version of the file (if it could -# be obtained via FILE_VERSION_FILTER) +# The WARN_FORMAT tag determines the format of the warning messages that doxygen +# can produce. The string should contain the $file, $line, and $text tags, which +# will be replaced by the file and line number from which the warning originated +# and the warning text. Optionally the format may contain $version, which will +# be replaced by the version of the file (if it could be obtained via +# FILE_VERSION_FILTER) +# The default value is: $file:$line: $text. WARN_FORMAT = "$file:$line: $text " -# The WARN_LOGFILE tag can be used to specify a file to which warning -# and error messages should be written. If left blank the output is written -# to stderr. +# The WARN_LOGFILE tag can be used to specify a file to which warning and error +# messages should be written. If left blank the output is written to standard +# error (stderr). WARN_LOGFILE = #--------------------------------------------------------------------------- -# configuration options related to the input files +# Configuration options related to the input files #--------------------------------------------------------------------------- -# The INPUT tag can be used to specify the files and/or directories that contain -# documented source files. You may enter file names like "myfile.cpp" or -# directories like "/usr/src/myproject". Separate the files or directories -# with spaces. +# The INPUT tag is used to specify the files and/or directories that contain +# documented source files. You may enter file names like myfile.cpp or +# directories like /usr/src/myproject. Separate the files or directories with +# spaces. +# Note: If this tag is empty the current directory is searched. INPUT = ../src # This tag can be used to specify the character encoding of the source files -# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is -# also the default input encoding. Doxygen uses libiconv (or the iconv built -# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for -# the list of possible encodings. +# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses +# libiconv (or the iconv built into libc) for the transcoding. See the libiconv +# documentation (see: http://www.gnu.org/software/libiconv) for the list of +# possible encodings. +# The default value is: UTF-8. INPUT_ENCODING = UTF-8 # If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank the following patterns are tested: -# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh -# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py -# *.f90 *.f *.for *.vhd *.vhdl +# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and +# *.h) to filter out the source-files in the directories. If left blank the +# following patterns are tested:*.c, *.cc, *.cxx, *.cpp, *.c++, *.java, *.ii, +# *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp, +# *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown, +# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf, +# *.qsf, *.as and *.js. FILE_PATTERNS = -# The RECURSIVE tag can be used to turn specify whether or not subdirectories -# should be searched for input files as well. Possible values are YES and NO. -# If left blank NO is used. +# The RECURSIVE tag can be used to specify whether or not subdirectories should +# be searched for input files as well. +# The default value is: NO. RECURSIVE = NO -# The EXCLUDE tag can be used to specify files and/or directories that should +# The EXCLUDE tag can be used to specify files and/or directories that should be # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. +# +# Note that relative paths are relative to the directory from which doxygen is +# run. EXCLUDE = -# The EXCLUDE_SYMLINKS tag can be used select whether or not files or +# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or # directories that are symbolic links (a Unix file system feature) are excluded # from the input. +# The default value is: NO. EXCLUDE_SYMLINKS = NO # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. Note that the wildcards are matched -# against the file with absolute path, so to exclude all test directories -# for example use the pattern */test/* +# certain files from those directories. +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories for example use the pattern */test/* EXCLUDE_PATTERNS = @@ -661,744 +801,1080 @@ EXCLUDE_PATTERNS = # output. The symbol name can be a fully qualified name, a word, or if the # wildcard * is used, a substring. Examples: ANamespace, AClass, # AClass::ANamespace, ANamespace::*Test +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories use the pattern */test/* EXCLUDE_SYMBOLS = -# The EXAMPLE_PATH tag can be used to specify one or more files or -# directories that contain example code fragments that are included (see -# the \include command). +# The EXAMPLE_PATH tag can be used to specify one or more files or directories +# that contain example code fragments that are included (see the \include +# command). EXAMPLE_PATH = # If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank all files are included. +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and +# *.h) to filter out the source-files in the directories. If left blank all +# files are included. EXAMPLE_PATTERNS = # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude -# commands irrespective of the value of the RECURSIVE tag. -# Possible values are YES and NO. If left blank NO is used. +# searched for input files to be used with the \include or \dontinclude commands +# irrespective of the value of the RECURSIVE tag. +# The default value is: NO. EXAMPLE_RECURSIVE = NO -# The IMAGE_PATH tag can be used to specify one or more files or -# directories that contain image that are included in the documentation (see -# the \image command). +# The IMAGE_PATH tag can be used to specify one or more files or directories +# that contain images that are to be included in the documentation (see the +# \image command). IMAGE_PATH = # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command , where -# is the value of the INPUT_FILTER tag, and is the name of an -# input file. Doxygen will then use the output that the filter program writes -# to standard output. -# If FILTER_PATTERNS is specified, this tag will be -# ignored. +# by executing (via popen()) the command: +# +# +# +# where is the value of the INPUT_FILTER tag, and is the +# name of an input file. Doxygen will then use the output that the filter +# program writes to standard output. If FILTER_PATTERNS is specified, this tag +# will be ignored. +# +# Note that the filter must not add or remove lines; it is applied before the +# code is scanned, but not when the output code is generated. If lines are added +# or removed, the anchors will not be placed correctly. INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. -# Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. -# The filters are a list of the form: -# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further -# info on how filters are used. If FILTER_PATTERNS is empty or if -# non of the patterns match the file name, INPUT_FILTER is applied. +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: pattern=filter +# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how +# filters are used. If the FILTER_PATTERNS tag is empty or if none of the +# patterns match the file name, INPUT_FILTER is applied. FILTER_PATTERNS = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will be used to filter the input files when producing source -# files to browse (i.e. when SOURCE_BROWSER is set to YES). +# INPUT_FILTER ) will also be used to filter the input files that are used for +# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). +# The default value is: NO. FILTER_SOURCE_FILES = NO # The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file -# pattern. A pattern will override the setting for FILTER_PATTERN (if any) -# and it is also possible to disable source filtering for a specific pattern -# using *.ext= (so without naming a filter). This option only has effect when -# FILTER_SOURCE_FILES is enabled. +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and +# it is also possible to disable source filtering for a specific pattern using +# *.ext= (so without naming a filter). +# This tag requires that the tag FILTER_SOURCE_FILES is set to YES. FILTER_SOURCE_PATTERNS = +# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that +# is part of the input, its contents will be placed on the main page +# (index.html). This can be useful if you have a project on for instance GitHub +# and want to reuse the introduction page also for the doxygen output. + +USE_MDFILE_AS_MAINPAGE = + #--------------------------------------------------------------------------- -# configuration options related to source browsing +# Configuration options related to source browsing #--------------------------------------------------------------------------- -# If the SOURCE_BROWSER tag is set to YES then a list of source files will -# be generated. Documented entities will be cross-referenced with these sources. -# Note: To get rid of all source code in the generated output, make sure also -# VERBATIM_HEADERS is set to NO. +# If the SOURCE_BROWSER tag is set to YES then a list of source files will be +# generated. Documented entities will be cross-referenced with these sources. +# +# Note: To get rid of all source code in the generated output, make sure that +# also VERBATIM_HEADERS is set to NO. +# The default value is: NO. SOURCE_BROWSER = YES -# Setting the INLINE_SOURCES tag to YES will include the body -# of functions and classes directly in the documentation. +# Setting the INLINE_SOURCES tag to YES will include the body of functions, +# classes and enums directly into the documentation. +# The default value is: NO. INLINE_SOURCES = NO -# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct -# doxygen to hide any special comment blocks from generated source code -# fragments. Normal C and C++ comments will always remain visible. +# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any +# special comment blocks from generated source code fragments. Normal C, C++ and +# Fortran comments will always remain visible. +# The default value is: YES. STRIP_CODE_COMMENTS = YES -# If the REFERENCED_BY_RELATION tag is set to YES -# then for each documented function all documented -# functions referencing it will be listed. +# If the REFERENCED_BY_RELATION tag is set to YES then for each documented +# function all documented functions referencing it will be listed. +# The default value is: NO. REFERENCED_BY_RELATION = YES -# If the REFERENCES_RELATION tag is set to YES -# then for each documented function all documented entities -# called/used by that function will be listed. +# If the REFERENCES_RELATION tag is set to YES then for each documented function +# all documented entities called/used by that function will be listed. +# The default value is: NO. REFERENCES_RELATION = YES -# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) -# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from -# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will -# link to the source code. -# Otherwise they will link to the documentation. +# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set +# to YES, then the hyperlinks from functions in REFERENCES_RELATION and +# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will +# link to the documentation. +# The default value is: YES. REFERENCES_LINK_SOURCE = YES -# If the USE_HTAGS tag is set to YES then the references to source code -# will point to the HTML generated by the htags(1) tool instead of doxygen -# built-in source browser. The htags tool is part of GNU's global source -# tagging system (see http://www.gnu.org/software/global/global.html). You -# will need version 4.8.6 or higher. +# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the +# source code will show a tooltip with additional information such as prototype, +# brief description and links to the definition and documentation. Since this +# will make the HTML file larger and loading of large files a bit slower, you +# can opt to disable this feature. +# The default value is: YES. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +SOURCE_TOOLTIPS = YES + +# If the USE_HTAGS tag is set to YES then the references to source code will +# point to the HTML generated by the htags(1) tool instead of doxygen built-in +# source browser. The htags tool is part of GNU's global source tagging system +# (see http://www.gnu.org/software/global/global.html). You will need version +# 4.8.6 or higher. +# +# To use it do the following: +# - Install the latest version of global +# - Enable SOURCE_BROWSER and USE_HTAGS in the config file +# - Make sure the INPUT points to the root of the source tree +# - Run doxygen as normal +# +# Doxygen will invoke htags (and that will in turn invoke gtags), so these +# tools must be available from the command line (i.e. in the search path). +# +# The result: instead of the source browser generated by doxygen, the links to +# source code will now point to the output of htags. +# The default value is: NO. +# This tag requires that the tag SOURCE_BROWSER is set to YES. USE_HTAGS = NO -# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen -# will generate a verbatim copy of the header file for each class for -# which an include is specified. Set to NO to disable this. +# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a +# verbatim copy of the header file for each class for which an include is +# specified. Set to NO to disable this. +# See also: Section \class. +# The default value is: YES. VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index +# Configuration options related to the alphabetical class index #--------------------------------------------------------------------------- -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index -# of all compounds will be generated. Enable this if the project -# contains a lot of classes, structs, unions or interfaces. +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all +# compounds will be generated. Enable this if the project contains a lot of +# classes, structs, unions or interfaces. +# The default value is: YES. ALPHABETICAL_INDEX = NO -# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then -# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns -# in which this list will be split (can be a number in the range [1..20]) +# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in +# which the alphabetical index list will be split. +# Minimum value: 1, maximum value: 20, default value: 5. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. COLS_IN_ALPHA_INDEX = 5 -# In case all classes in a project start with a common prefix, all -# classes will be put under the same header in the alphabetical index. -# The IGNORE_PREFIX tag can be used to specify one or more prefixes that -# should be ignored while generating the index headers. +# In case all classes in a project start with a common prefix, all classes will +# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag +# can be used to specify a prefix (or a list of prefixes) that should be ignored +# while generating the index headers. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. IGNORE_PREFIX = #--------------------------------------------------------------------------- -# configuration options related to the HTML output +# Configuration options related to the HTML output #--------------------------------------------------------------------------- -# If the GENERATE_HTML tag is set to YES (the default) Doxygen will -# generate HTML output. +# If the GENERATE_HTML tag is set to YES doxygen will generate HTML output +# The default value is: YES. GENERATE_HTML = YES -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `html' will be used as the default path. +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of +# it. +# The default directory is: html. +# This tag requires that the tag GENERATE_HTML is set to YES. HTML_OUTPUT = . -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for -# each generated HTML page (for example: .htm,.php,.asp). If it is left blank -# doxygen will generate files with .html extension. +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each +# generated HTML page (for example: .htm, .php, .asp). +# The default value is: .html. +# This tag requires that the tag GENERATE_HTML is set to YES. HTML_FILE_EXTENSION = .html -# The HTML_HEADER tag can be used to specify a personal HTML header for -# each generated HTML page. If it is left blank doxygen will generate a -# standard header. Note that when using a custom header you are responsible -# for the proper inclusion of any scripts and style sheets that doxygen -# needs, which is dependent on the configuration options used. -# It is adviced to generate a default header using "doxygen -w html -# header.html footer.html stylesheet.css YourConfigFile" and then modify -# that header. Note that the header is subject to change so you typically -# have to redo this when upgrading to a newer version of doxygen or when changing the value of configuration settings such as GENERATE_TREEVIEW! +# The HTML_HEADER tag can be used to specify a user-defined HTML header file for +# each generated HTML page. If the tag is left blank doxygen will generate a +# standard header. +# +# To get valid HTML the header file that includes any scripts and style sheets +# that doxygen needs, which is dependent on the configuration options used (e.g. +# the setting GENERATE_TREEVIEW). It is highly recommended to start with a +# default header using +# doxygen -w html new_header.html new_footer.html new_stylesheet.css +# YourConfigFile +# and then modify the file new_header.html. See also section "Doxygen usage" +# for information on how to generate the default header that doxygen normally +# uses. +# Note: The header is subject to change so you typically have to regenerate the +# default header when upgrading to a newer version of doxygen. For a description +# of the possible markers and block names see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. HTML_HEADER = -# The HTML_FOOTER tag can be used to specify a personal HTML footer for -# each generated HTML page. If it is left blank doxygen will generate a -# standard footer. +# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each +# generated HTML page. If the tag is left blank doxygen will generate a standard +# footer. See HTML_HEADER for more information on how to generate a default +# footer and what special commands can be used inside the footer. See also +# section "Doxygen usage" for information on how to generate the default footer +# that doxygen normally uses. +# This tag requires that the tag GENERATE_HTML is set to YES. HTML_FOOTER = -# If the HTML_TIMESTAMP tag is set to YES then the generated HTML documentation will contain the timesstamp. +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style +# sheet that is used by each HTML page. It can be used to fine-tune the look of +# the HTML output. If left blank doxygen will generate a default style sheet. +# See also section "Doxygen usage" for information on how to generate the style +# sheet that doxygen normally uses. +# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as +# it is more robust and this tag (HTML_STYLESHEET) will in the future become +# obsolete. +# This tag requires that the tag GENERATE_HTML is set to YES. -HTML_TIMESTAMP = NO +HTML_STYLESHEET = -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading -# style sheet that is used by each HTML page. It can be used to -# fine-tune the look of the HTML output. If the tag is left blank doxygen -# will generate a default style sheet. Note that doxygen will try to copy -# the style sheet file to the HTML output directory, so don't put your own -# stylesheet in the HTML output directory as well, or it will be erased! +# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional user- +# defined cascading style sheet that is included after the standard style sheets +# created by doxygen. Using this option one can overrule certain style aspects. +# This is preferred over using HTML_STYLESHEET since it does not replace the +# standard style sheet and is therefor more robust against future updates. +# Doxygen will copy the style sheet file to the output directory. For an example +# see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. -HTML_STYLESHEET = +HTML_EXTRA_STYLESHEET = # The HTML_EXTRA_FILES tag can be used to specify one or more extra images or # other source files which should be copied to the HTML output directory. Note # that these files will be copied to the base HTML output directory. Use the -# $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these -# files. In the HTML_STYLESHEET file, use the file name only. Also note that -# the files will be copied as-is; there are no commands or markers available. +# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these +# files. In the HTML_STYLESHEET file, use the file name only. Also note that the +# files will be copied as-is; there are no commands or markers available. +# This tag requires that the tag GENERATE_HTML is set to YES. HTML_EXTRA_FILES = -# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. -# Doxygen will adjust the colors in the stylesheet and background images -# according to this color. Hue is specified as an angle on a colorwheel, -# see http://en.wikipedia.org/wiki/Hue for more information. -# For instance the value 0 represents red, 60 is yellow, 120 is green, -# 180 is cyan, 240 is blue, 300 purple, and 360 is red again. -# The allowed range is 0 to 359. +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen +# will adjust the colors in the stylesheet and background images according to +# this color. Hue is specified as an angle on a colorwheel, see +# http://en.wikipedia.org/wiki/Hue for more information. For instance the value +# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 +# purple, and 360 is red again. +# Minimum value: 0, maximum value: 359, default value: 220. +# This tag requires that the tag GENERATE_HTML is set to YES. HTML_COLORSTYLE_HUE = 220 -# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of -# the colors in the HTML output. For a value of 0 the output will use -# grayscales only. A value of 255 will produce the most vivid colors. +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors +# in the HTML output. For a value of 0 the output will use grayscales only. A +# value of 255 will produce the most vivid colors. +# Minimum value: 0, maximum value: 255, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. HTML_COLORSTYLE_SAT = 100 -# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to -# the luminance component of the colors in the HTML output. Values below -# 100 gradually make the output lighter, whereas values above 100 make -# the output darker. The value divided by 100 is the actual gamma applied, -# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, -# and 100 does not change the gamma. +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the +# luminance component of the colors in the HTML output. Values below 100 +# gradually make the output lighter, whereas values above 100 make the output +# darker. The value divided by 100 is the actual gamma applied, so 80 represents +# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not +# change the gamma. +# Minimum value: 40, maximum value: 240, default value: 80. +# This tag requires that the tag GENERATE_HTML is set to YES. HTML_COLORSTYLE_GAMMA = 80 # If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML -# page will contain the date and time when the page was generated. Setting -# this to NO can help when comparing the output of multiple runs. +# page will contain the date and time when the page was generated. Setting this +# to NO can help when comparing the output of multiple runs. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. HTML_TIMESTAMP = YES -# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, -# files or namespaces will be aligned in HTML using tables. If set to -# NO a bullet list will be used. - -HTML_ALIGN_MEMBERS = YES - # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the -# page has loaded. For this to work a browser that supports -# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox -# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). +# page has loaded. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. HTML_DYNAMIC_SECTIONS = NO -# If the GENERATE_DOCSET tag is set to YES, additional index files -# will be generated that can be used as input for Apple's Xcode 3 -# integrated development environment, introduced with OSX 10.5 (Leopard). -# To create a documentation set, doxygen will generate a Makefile in the -# HTML output directory. Running make will produce the docset in that -# directory and running "make install" will install the docset in -# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find -# it at startup. -# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html +# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries +# shown in the various tree structured indices initially; the user can expand +# and collapse entries dynamically later on. Doxygen will expand the tree to +# such a level that at most the specified number of entries are visible (unless +# a fully collapsed tree already exceeds this amount). So setting the number of +# entries 1 will produce a full collapsed tree by default. 0 is a special value +# representing an infinite number of entries and will result in a full expanded +# tree by default. +# Minimum value: 0, maximum value: 9999, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_INDEX_NUM_ENTRIES = 100 + +# If the GENERATE_DOCSET tag is set to YES, additional index files will be +# generated that can be used as input for Apple's Xcode 3 integrated development +# environment (see: http://developer.apple.com/tools/xcode/), introduced with +# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a +# Makefile in the HTML output directory. Running make will produce the docset in +# that directory and running make install will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at +# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html # for more information. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_DOCSET = NO -# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the -# feed. A documentation feed provides an umbrella under which multiple -# documentation sets from a single provider (such as a company or product suite) -# can be grouped. +# This tag determines the name of the docset feed. A documentation feed provides +# an umbrella under which multiple documentation sets from a single provider +# (such as a company or product suite) can be grouped. +# The default value is: Doxygen generated docs. +# This tag requires that the tag GENERATE_DOCSET is set to YES. DOCSET_FEEDNAME = "Doxygen generated docs" -# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that -# should uniquely identify the documentation set bundle. This should be a -# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen -# will append .docset to the name. +# This tag specifies a string that should uniquely identify the documentation +# set bundle. This should be a reverse domain-name style string, e.g. +# com.mycompany.MyDocSet. Doxygen will append .docset to the name. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_DOCSET is set to YES. DOCSET_BUNDLE_ID = org.doxygen.Project -# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify +# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify # the documentation publisher. This should be a reverse domain-name style # string, e.g. com.mycompany.MyDocSet.documentation. +# The default value is: org.doxygen.Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. DOCSET_PUBLISHER_ID = org.doxygen.Publisher -# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. +# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. +# The default value is: Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. DOCSET_PUBLISHER_NAME = Publisher -# If the GENERATE_HTMLHELP tag is set to YES, additional index files -# will be generated that can be used as input for tools like the -# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) -# of the generated HTML documentation. +# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three +# additional HTML index files: index.hhp, index.hhc, and index.hhk. The +# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop +# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on +# Windows. +# +# The HTML Help Workshop contains a compiler that can convert all HTML output +# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML +# files are now used as the Windows 98 help format, and will replace the old +# Windows help format (.hlp) on all Windows platforms in the future. Compressed +# HTML files also contain an index, a table of contents, and you can search for +# words in the documentation. The HTML workshop also contains a viewer for +# compressed HTML files. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_HTMLHELP = NO -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can -# be used to specify the file name of the resulting .chm file. You -# can add a path in front of the file if the result should not be +# The CHM_FILE tag can be used to specify the file name of the resulting .chm +# file. You can add a path in front of the file if the result should not be # written to the html output directory. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. CHM_FILE = -# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can -# be used to specify the location (absolute path including file name) of -# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run -# the HTML help compiler on the generated index.hhp. +# The HHC_LOCATION tag can be used to specify the location (absolute path +# including file name) of the HTML help compiler ( hhc.exe). If non-empty +# doxygen will try to run the HTML help compiler on the generated index.hhp. +# The file has to be specified with full path. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. HHC_LOCATION = -# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag -# controls if a separate .chi index file is generated (YES) or that -# it should be included in the master .chm file (NO). +# The GENERATE_CHI flag controls if a separate .chi index file is generated ( +# YES) or that it should be included in the master .chm file ( NO). +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. GENERATE_CHI = NO -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING -# is used to encode HtmlHelp index (hhk), content (hhc) and project file -# content. +# The CHM_INDEX_ENCODING is used to encode HtmlHelp index ( hhk), content ( hhc) +# and project file content. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. CHM_INDEX_ENCODING = -# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag -# controls whether a binary table of contents is generated (YES) or a -# normal table of contents (NO) in the .chm file. +# The BINARY_TOC flag controls whether a binary table of contents is generated ( +# YES) or a normal table of contents ( NO) in the .chm file. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. BINARY_TOC = NO -# The TOC_EXPAND flag can be set to YES to add extra items for group members -# to the contents of the HTML help documentation and to the tree view. +# The TOC_EXPAND flag can be set to YES to add extra items for group members to +# the table of contents of the HTML help documentation and to the tree view. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. TOC_EXPAND = NO # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and -# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated -# that can be used as input for Qt's qhelpgenerator to generate a -# Qt Compressed Help (.qch) of the generated HTML documentation. +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that +# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help +# (.qch) of the generated HTML documentation. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_QHP = NO -# If the QHG_LOCATION tag is specified, the QCH_FILE tag can -# be used to specify the file name of the resulting .qch file. -# The path specified is relative to the HTML output folder. +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify +# the file name of the resulting .qch file. The path specified is relative to +# the HTML output folder. +# This tag requires that the tag GENERATE_QHP is set to YES. QCH_FILE = -# The QHP_NAMESPACE tag specifies the namespace to use when generating -# Qt Help Project output. For more information please see -# http://doc.trolltech.com/qthelpproject.html#namespace +# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help +# Project output. For more information please see Qt Help Project / Namespace +# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace). +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_QHP is set to YES. QHP_NAMESPACE = -# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating -# Qt Help Project output. For more information please see -# http://doc.trolltech.com/qthelpproject.html#virtual-folders +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt +# Help Project output. For more information please see Qt Help Project / Virtual +# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual- +# folders). +# The default value is: doc. +# This tag requires that the tag GENERATE_QHP is set to YES. QHP_VIRTUAL_FOLDER = doc -# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to -# add. For more information please see -# http://doc.trolltech.com/qthelpproject.html#custom-filters +# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom +# filter to add. For more information please see Qt Help Project / Custom +# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- +# filters). +# This tag requires that the tag GENERATE_QHP is set to YES. QHP_CUST_FILTER_NAME = -# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the -# custom filter to add. For more information please see -# -# Qt Help Project / Custom Filters. +# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see Qt Help Project / Custom +# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- +# filters). +# This tag requires that the tag GENERATE_QHP is set to YES. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this -# project's -# filter section matches. -# -# Qt Help Project / Filter Attributes. +# project's filter section matches. Qt Help Project / Filter Attributes (see: +# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes). +# This tag requires that the tag GENERATE_QHP is set to YES. QHP_SECT_FILTER_ATTRS = -# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can -# be used to specify the location of Qt's qhelpgenerator. -# If non-empty doxygen will try to run qhelpgenerator on the generated -# .qhp file. +# The QHG_LOCATION tag can be used to specify the location of Qt's +# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the +# generated .qhp file. +# This tag requires that the tag GENERATE_QHP is set to YES. QHG_LOCATION = -# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files -# will be generated, which together with the HTML files, form an Eclipse help -# plugin. To install this plugin and make it available under the help contents -# menu in Eclipse, the contents of the directory containing the HTML and XML -# files needs to be copied into the plugins directory of eclipse. The name of -# the directory within the plugins directory should be the same as -# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before -# the help appears. +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be +# generated, together with the HTML files, they form an Eclipse help plugin. To +# install this plugin and make it available under the help contents menu in +# Eclipse, the contents of the directory containing the HTML and XML files needs +# to be copied into the plugins directory of eclipse. The name of the directory +# within the plugins directory should be the same as the ECLIPSE_DOC_ID value. +# After copying Eclipse needs to be restarted before the help appears. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_ECLIPSEHELP = NO -# A unique identifier for the eclipse help plugin. When installing the plugin -# the directory name containing the HTML and XML files should also have -# this name. +# A unique identifier for the Eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have this +# name. Each documentation set should have its own identifier. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. ECLIPSE_DOC_ID = org.doxygen.Project -# The DISABLE_INDEX tag can be used to turn on/off the condensed index at -# top of each HTML page. The value NO (the default) enables the index and -# the value YES disables it. +# If you want full control over the layout of the generated HTML pages it might +# be necessary to disable the index and replace it with your own. The +# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top +# of each HTML page. A value of NO enables the index and the value YES disables +# it. Since the tabs in the index contain the same information as the navigation +# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. DISABLE_INDEX = NO -# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values -# (range [0,1..20]) that doxygen will group on one line in the generated HTML -# documentation. Note that a value of 0 will completely suppress the enum -# values from appearing in the overview section. - -ENUM_VALUES_PER_LINE = 8 - # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index -# structure should be generated to display hierarchical information. -# If the tag value is set to YES, a side panel will be generated -# containing a tree-like index structure (just like the one that -# is generated for HTML Help). For this to work a browser that supports -# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). -# Windows users are probably better off using the HTML help feature. +# structure should be generated to display hierarchical information. If the tag +# value is set to YES, a side panel will be generated containing a tree-like +# index structure (just like the one that is generated for HTML Help). For this +# to work a browser that supports JavaScript, DHTML, CSS and frames is required +# (i.e. any modern browser). Windows users are probably better off using the +# HTML help feature. Via custom stylesheets (see HTML_EXTRA_STYLESHEET) one can +# further fine-tune the look of the index. As an example, the default style +# sheet generated by doxygen has an example that shows how to put an image at +# the root of the tree instead of the PROJECT_NAME. Since the tree basically has +# the same information as the tab index, you could consider setting +# DISABLE_INDEX to YES when enabling this option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_TREEVIEW = YES -# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories, -# and Class Hierarchy pages using a tree view instead of an ordered list. +# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that +# doxygen will group on one line in the generated HTML documentation. +# +# Note that a value of 0 will completely suppress the enum values from appearing +# in the overview section. +# Minimum value: 0, maximum value: 20, default value: 4. +# This tag requires that the tag GENERATE_HTML is set to YES. -USE_INLINE_TREES = NO +ENUM_VALUES_PER_LINE = 8 -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be -# used to set the initial width (in pixels) of the frame in which the tree -# is shown. +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used +# to set the initial width (in pixels) of the frame in which the tree is shown. +# Minimum value: 0, maximum value: 1500, default value: 250. +# This tag requires that the tag GENERATE_HTML is set to YES. TREEVIEW_WIDTH = 250 -# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open -# links to external symbols imported via tag files in a separate window. +# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open links to +# external symbols imported via tag files in a separate window. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. EXT_LINKS_IN_WINDOW = NO -# Use this tag to change the font size of Latex formulas included -# as images in the HTML documentation. The default is 10. Note that -# when you change the font size after a successful doxygen run you need -# to manually remove any form_*.png images from the HTML output directory -# to force them to be regenerated. +# Use this tag to change the font size of LaTeX formulas included as images in +# the HTML documentation. When you change the font size after a successful +# doxygen run you need to manually remove any form_*.png images from the HTML +# output directory to force them to be regenerated. +# Minimum value: 8, maximum value: 50, default value: 10. +# This tag requires that the tag GENERATE_HTML is set to YES. FORMULA_FONTSIZE = 10 # Use the FORMULA_TRANPARENT tag to determine whether or not the images -# generated for formulas are transparent PNGs. Transparent PNGs are -# not supported properly for IE 6.0, but are supported on all modern browsers. -# Note that when changing this option you need to delete any form_*.png files -# in the HTML output before the changes have effect. +# generated for formulas are transparent PNGs. Transparent PNGs are not +# supported properly for IE 6.0, but are supported on all modern browsers. +# +# Note that when changing this option you need to delete any form_*.png files in +# the HTML output directory before the changes have effect. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. FORMULA_TRANSPARENT = YES -# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax -# (see http://www.mathjax.org) which uses client side Javascript for the -# rendering instead of using prerendered bitmaps. Use this if you do not -# have LaTeX installed or if you want to formulas look prettier in the HTML -# output. When enabled you also need to install MathJax separately and -# configure the path to it using the MATHJAX_RELPATH option. +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see +# http://www.mathjax.org) which uses client side Javascript for the rendering +# instead of using prerendered bitmaps. Use this if you do not have LaTeX +# installed or if you want to formulas look prettier in the HTML output. When +# enabled you may also need to install MathJax separately and configure the path +# to it using the MATHJAX_RELPATH option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. USE_MATHJAX = NO -# When MathJax is enabled you need to specify the location relative to the -# HTML output directory using the MATHJAX_RELPATH option. The destination -# directory should contain the MathJax.js script. For instance, if the mathjax -# directory is located at the same level as the HTML output directory, then -# MATHJAX_RELPATH should be ../mathjax. The default value points to the -# mathjax.org site, so you can quickly see the result without installing -# MathJax, but it is strongly recommended to install a local copy of MathJax -# before deployment. +# When MathJax is enabled you can set the default output format to be used for +# the MathJax output. See the MathJax site (see: +# http://docs.mathjax.org/en/latest/output.html) for more details. +# Possible values are: HTML-CSS (which is slower, but has the best +# compatibility), NativeMML (i.e. MathML) and SVG. +# The default value is: HTML-CSS. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_FORMAT = HTML-CSS + +# When MathJax is enabled you need to specify the location relative to the HTML +# output directory using the MATHJAX_RELPATH option. The destination directory +# should contain the MathJax.js script. For instance, if the mathjax directory +# is located at the same level as the HTML output directory, then +# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax +# Content Delivery Network so you can quickly see the result without installing +# MathJax. However, it is strongly recommended to install a local copy of +# MathJax from http://www.mathjax.org before deployment. +# The default value is: http://cdn.mathjax.org/mathjax/latest. +# This tag requires that the tag USE_MATHJAX is set to YES. MATHJAX_RELPATH = http://www.mathjax.org/mathjax -# When the SEARCHENGINE tag is enabled doxygen will generate a search box -# for the HTML output. The underlying search engine uses javascript -# and DHTML and should work on any modern browser. Note that when using -# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets -# (GENERATE_DOCSET) there is already a search function so this one should -# typically be disabled. For large projects the javascript based search engine -# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. +# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax +# extension names that should be enabled during MathJax rendering. For example +# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_EXTENSIONS = + +# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces +# of code that will be used on startup of the MathJax code. See the MathJax site +# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an +# example see the documentation. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_CODEFILE = + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box for +# the HTML output. The underlying search engine uses javascript and DHTML and +# should work on any modern browser. Note that when using HTML help +# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) +# there is already a search function so this one should typically be disabled. +# For large projects the javascript based search engine can be slow, then +# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to +# search using the keyboard; to jump to the search box use + S +# (what the is depends on the OS and browser, but it is typically +# , /