RcppArmadillo/0000755000176200001440000000000015031311037012775 5ustar liggesusersRcppArmadillo/tests/0000755000176200001440000000000014205476637014163 5ustar liggesusersRcppArmadillo/tests/tinytest.R0000644000176200001440000000014114205476637016165 0ustar liggesusers if (requireNamespace("tinytest", quietly=TRUE)) { tinytest::test_package("RcppArmadillo") } RcppArmadillo/MD50000644000176200001440000016266115031311037013321 0ustar liggesusers5d8d9d46aa638a2a0cfcb82976fd2576 *ChangeLog 836f6e417d794cd09fef7a57efefc383 *DESCRIPTION bef7b527614eed15bf7dbcbb1c5a15a4 *NAMESPACE 629d5b0a8294521bb2b4436f8dd7933d *R/RcppArmadillo.package.skeleton.R 1598e95bf0372bdd47a0e04253a89533 *R/RcppExports.R 36125adfa038ee14587f8d55c6ca4425 *R/SciPy2R.R 8016a762faeef9b4454d7d0316f2c9c3 *R/fastLm.R c425fa93fb2732616eb94c17a8141afa *R/flags.R dbc181949101220df345c977feac1dc6 *R/init.R 9cb63b43ee8977137fa1f9f6be2c8bba *R/inline.R d8aeb5271912384943ee73f311cd787e *README.md 1bf18d9c216b8d95033f0bd2fe2906b2 *build/partial.rdb 2f780f255a9b20acdab54baf404a8a53 *build/vignette.rds 0708c906a98f2a190be7d450d62be084 *cleanup 95f96880e76b65734bc5175351d5c6dc *configure 680ca6c84d269939d2429ef593d9759a *configure.ac a176169a58643ff39de12fff6e63b11f *inst/AUTHORS b56e5229095ffda62a877dae8fc263fa *inst/CITATION ab2552793bb68fff3fc1447dad76543b *inst/COPYRIGHTS e99719d9d2b264874200eae356424561 *inst/NEWS.Rd 662c1aa30653a4d2667c81c1acd84c87 *inst/announce/ANNOUNCE-0.2.0.txt 36775614f3fdb06c07121a96332741e6 *inst/doc/RcppArmadillo-intro.Rnw 84ab86ed170abb4cdc39ff00a2209721 *inst/doc/RcppArmadillo-intro.pdf b7df93033cf8677a5bbd8870522ca9eb *inst/doc/RcppArmadillo-sparseMatrix.Rnw 3f848bada14fb07fc7101bb7669c6e87 *inst/doc/RcppArmadillo-sparseMatrix.pdf 8c836d5a9edcff81a85060a33142f0f5 *inst/examples/fastLm.r 93037baec9a906713b4ca11046a1b0fc *inst/examples/kalman/FirstKalmanR.R 4a7b51922e6d94f6dc6075eb5c0bf09f *inst/examples/kalman/Kalman.cpp 700568fe04f7c2001be4ad3ca5b6f244 *inst/examples/kalman/KalmanR.R df9eaa9c640cda72c24570759edf4cd1 *inst/examples/kalman/KalmanRimp.R 2879448e68c1679f0833da45cd454e5e *inst/examples/kalman/benchmark.R d329b78c9f94c4d99155333f18b3f311 *inst/examples/kalman/firstExample.R c3c2e3d3d7867f6ed7574a273723dcf5 *inst/examples/kalman/kalmanExample.m 04f360597c45a3eb82ada7f23be16812 *inst/examples/kalman/kalmanM.m c17927f9637d4000daf2aa4331c7db9d *inst/examples/kalman/kalmanfilter.m 2771369ff122fc008211c246481d09a5 *inst/examples/kalman/pos.txt 34be46a9afd0879fe2b6d3e07fcf8596 *inst/examples/varSimulation.r 446b5281f5e18f4946d7f915cde24337 *inst/include/README afadfc7af3d91491371161d958b47b79 *inst/include/RcppArmadillo.h 2c911467deebb580089fdebb05feded4 *inst/include/RcppArmadillo/Alt_R_RNG.h 0a3121118153732ee6867a520e435775 *inst/include/RcppArmadillo/Light 3b06f7b93302102ae4d366141d7485d2 *inst/include/RcppArmadillo/Lighter 735e77b4ee0b3cdbd54b59445984f424 *inst/include/RcppArmadillo/Lightest 720637248d20b892292ef5c53ef3e26b *inst/include/RcppArmadillo/RcppArmadillo 62e2e5b85bac007f5a4d9cc04a92c571 *inst/include/RcppArmadillo/config/RcppArmadilloConfig.h 555f8de602da17d48c7f5fc054338850 *inst/include/RcppArmadillo/config/RcppArmadilloConfigGenerated.h.in 1707474365c47bfe191ca743c6a66b61 *inst/include/RcppArmadillo/interface/RcppArmadilloAs.h 08b129ba5dc7285cee282c04292d1ee9 *inst/include/RcppArmadillo/interface/RcppArmadilloForward.h 8e81fd2cce3921b56a099ee512897e13 *inst/include/RcppArmadillo/interface/RcppArmadilloSugar.h c7bb70fb3d204aeb6f158336dacaf245 *inst/include/RcppArmadillo/interface/RcppArmadilloWrap.h daa8921d68416c321159f700a0477222 *inst/include/RcppArmadillo/internal/Col_meat.h 29697cb890d6a5fb2b205772dfc27ca2 *inst/include/RcppArmadillo/internal/Col_proto.h 8f93c982390d94e806882aa09368c289 *inst/include/RcppArmadillo/internal/Mat_meat.h 084c9564f00621b4d4ee65e6ad5dc3b5 *inst/include/RcppArmadillo/internal/Mat_proto.h e577ccb03d814de3925c79c083f080c6 *inst/include/RcppArmadillo/internal/Row_meat.h bbda5c00444bb23d5e5ab3e7fe7f0f1c *inst/include/RcppArmadillo/internal/Row_proto.h 646fb8066afe7b3a0382f3e19188f94e *inst/include/RcppArmadillo/rng/Alt_R_RNG.h 52e090e9c3e5589c47a30ffb57c93956 *inst/include/RcppArmadilloExtensions/fixprob.h 34d716ed36ef2493765eb52e66985850 *inst/include/RcppArmadilloExtensions/rmultinom.h c1cbcb28269483b87b7330c576cc0f59 *inst/include/RcppArmadilloExtensions/sample.h 3ee32e82964f4527a4a94a1971911d04 *inst/include/armadillo d1af99536036b19fda02bbfe1f4ed74d *inst/include/armadillo_bits/BaseCube_bones.hpp 017ef0a7153247fe9ba006632c575067 *inst/include/armadillo_bits/BaseCube_meat.hpp e22e478ad1a98e5a8c75b73c3793a30b *inst/include/armadillo_bits/Base_bones.hpp 86ef422d58b7ad3603b5dd3c311cbef6 *inst/include/armadillo_bits/Base_meat.hpp 333840d1d65fbbbdb0884c6e40345979 *inst/include/armadillo_bits/Col_bones.hpp 69a591d68b3539ff0fca109f62173b94 *inst/include/armadillo_bits/Col_meat.hpp 02415452e034a555a07acf81f7dc7427 *inst/include/armadillo_bits/CubeToMatOp_bones.hpp 5efa126f2217a888b32496bdca440793 *inst/include/armadillo_bits/CubeToMatOp_meat.hpp 5cee23eac3d7436f11aae92c5752dfe2 *inst/include/armadillo_bits/Cube_bones.hpp 4bc035aec334bdbea4efe68b9d68d806 *inst/include/armadillo_bits/Cube_meat.hpp 781196b74196d71c609750e03d02f7a8 *inst/include/armadillo_bits/GenCube_bones.hpp 80b4669c4542f71f4132e89cf606c741 *inst/include/armadillo_bits/GenCube_meat.hpp 4fa8739212cbc2ecf350568287976040 *inst/include/armadillo_bits/Gen_bones.hpp f72514725ad85125b48f9c13e8c2d305 *inst/include/armadillo_bits/Gen_meat.hpp 53459308a3c415abb982dd434b6e98c9 *inst/include/armadillo_bits/GlueCube_bones.hpp 3d834c1663475c33c68243e66f332821 *inst/include/armadillo_bits/GlueCube_meat.hpp 190914854589474c0cfdafa24870bc84 *inst/include/armadillo_bits/Glue_bones.hpp ae89e542d985967bddd853c5ddcb6ae5 *inst/include/armadillo_bits/Glue_meat.hpp 2aae5a104256863213751348f3757c98 *inst/include/armadillo_bits/MapMat_bones.hpp d659ae8a2ef347e500f8a324ebbfa84a *inst/include/armadillo_bits/MapMat_meat.hpp 89da9bb9e6818f79de02fc7e556a94b4 *inst/include/armadillo_bits/Mat_bones.hpp 2e8ff84f0f53986d5b87ed3747ef5f39 *inst/include/armadillo_bits/Mat_meat.hpp ec6f7cdcd54da7344ce21f37d4451f39 *inst/include/armadillo_bits/OpCube_bones.hpp d67b06690a1e4d6e3030d10a2a929b78 *inst/include/armadillo_bits/OpCube_meat.hpp 2147edde2a1b2662b5b7728197e06b94 *inst/include/armadillo_bits/Op_bones.hpp b9abcc2e50d24115b9103da87cef9cd7 *inst/include/armadillo_bits/Op_meat.hpp 563b315521a6669a33a051d34b4e2665 *inst/include/armadillo_bits/Proxy.hpp 71853b8b32c315945d61123e6c43f1a7 *inst/include/armadillo_bits/ProxyCube.hpp 944c9a7504d898df767b30489084534f *inst/include/armadillo_bits/Row_bones.hpp a149d0f820460cfde04b359ed78d2801 *inst/include/armadillo_bits/Row_meat.hpp e92862a77b15f652825bddf76478918f *inst/include/armadillo_bits/SizeCube_bones.hpp b562b59c9d0858d6df9787317b6f3c60 *inst/include/armadillo_bits/SizeCube_meat.hpp f9b29cc8b9a8ca5b32d5b9466972a4ab *inst/include/armadillo_bits/SizeMat_bones.hpp 71cf24a0c70088d14a3f2d3055755519 *inst/include/armadillo_bits/SizeMat_meat.hpp e9132387fe5b6975f221c82b12ab1592 *inst/include/armadillo_bits/SpBase_bones.hpp 5937c8070fa4cac49a20a0d0c85f90e4 *inst/include/armadillo_bits/SpBase_meat.hpp be77e3efe41f6fedd26cba627cfc30e2 *inst/include/armadillo_bits/SpCol_bones.hpp 1d70b3b162a080c533f71025476428f3 *inst/include/armadillo_bits/SpCol_meat.hpp 06c186cc01fc7c01b1ad4dfab090f6f3 *inst/include/armadillo_bits/SpGlue_bones.hpp 8d408cffb66b9d09e9fcc3c2acf9f823 *inst/include/armadillo_bits/SpGlue_meat.hpp 97d22ed2d6a57d2aacb859eaeb97918d *inst/include/armadillo_bits/SpMat_bones.hpp 417320acf3cf676127564c17cb29e865 *inst/include/armadillo_bits/SpMat_iterators_meat.hpp e9c4a89f0f0c42087dc0340e525ff21b *inst/include/armadillo_bits/SpMat_meat.hpp 7829d5c5d1fe81ab0b2e6f27d1a7ab22 *inst/include/armadillo_bits/SpOp_bones.hpp be13d76c84c5a66f77b9062c694712d1 *inst/include/armadillo_bits/SpOp_meat.hpp 47ff8d4026c4e4d3688020563be68928 *inst/include/armadillo_bits/SpProxy.hpp c93e93dbb2adeeaea77f3c87f201da0a *inst/include/armadillo_bits/SpRow_bones.hpp c63c5ce0d306ac43a655a0b9e8dc8190 *inst/include/armadillo_bits/SpRow_meat.hpp 2bc9cdac875357f068f01bf54eefffe0 *inst/include/armadillo_bits/SpSubview_bones.hpp 8fb286c8fe462c8daefcb612c8e63576 *inst/include/armadillo_bits/SpSubview_col_list_bones.hpp 7abb7da8aa593334fe009b3cdd0ebb19 *inst/include/armadillo_bits/SpSubview_col_list_meat.hpp b887a80177cd6c8748227486645a6bb5 *inst/include/armadillo_bits/SpSubview_iterators_meat.hpp bef40a24fc422033ec6723bf0585b31f *inst/include/armadillo_bits/SpSubview_meat.hpp 5eec766cbe64314801ae8758e8eea907 *inst/include/armadillo_bits/SpToDGlue_bones.hpp ad6d84222987cc653508c90f8133b8d3 *inst/include/armadillo_bits/SpToDGlue_meat.hpp 70f989c1002eb289c9c3cd9d8afa1790 *inst/include/armadillo_bits/SpToDOp_bones.hpp 886ee6d6d93c2514c6ca015a2adfc868 *inst/include/armadillo_bits/SpToDOp_meat.hpp ab30f2f292ef4e5d5f61946ba3588d75 *inst/include/armadillo_bits/SpValProxy_bones.hpp 9d22d5087b44f7d572f3b910c89efcd0 *inst/include/armadillo_bits/SpValProxy_meat.hpp e19516b1bf66e4c80053997ac9f7bf9c *inst/include/armadillo_bits/access.hpp 388d31b6abbb583b5b4b11ac157adebc *inst/include/armadillo_bits/arma_cmath.hpp e181f9473480df0ed758f1bdd525fc40 *inst/include/armadillo_bits/arma_config.hpp 873d417d37148b1b2e4cd96d044472ee *inst/include/armadillo_bits/arma_forward.hpp 6eb638cd5a10a81c47c9b63d82b49b56 *inst/include/armadillo_bits/arma_ostream_bones.hpp b094171cf209ddaac5d7c2dbf78fdd3c *inst/include/armadillo_bits/arma_ostream_meat.hpp 9575132e3e6342597ba453869be23c49 *inst/include/armadillo_bits/arma_rel_comparators.hpp 604b89f96f6fab3270ec2bacaef7f67d *inst/include/armadillo_bits/arma_rng.hpp 2de10ab1b1819a85e3a033cc61d84f56 *inst/include/armadillo_bits/arma_rng_cxx03.hpp 9ef823e0b4c08e8dde05449da70e4426 *inst/include/armadillo_bits/arma_static_check.hpp 4f49607b770de00263de575ed439a2f4 *inst/include/armadillo_bits/arma_str.hpp 7c525cc0fc0756ad5412bb1247162ce0 *inst/include/armadillo_bits/arma_version.hpp 815a1082c290a476951b56be986a6351 *inst/include/armadillo_bits/arrayops_bones.hpp 6d15503adeed9774a879d198d2f9dc6a *inst/include/armadillo_bits/arrayops_meat.hpp a1794068b3e1259bb56f33606d169c51 *inst/include/armadillo_bits/auxlib_bones.hpp a17f7c2ee0a3f6d3236029ba07b10cfb *inst/include/armadillo_bits/auxlib_meat.hpp 742e8db851bd48a190d1612119ab7a17 *inst/include/armadillo_bits/band_helper.hpp 314292820f8f5a5e50c1378c87b81dae *inst/include/armadillo_bits/compiler_check.hpp 9cee31369ece694bf071150667af91d5 *inst/include/armadillo_bits/compiler_setup.hpp 470b6fe89e48afa4d213d1ab64cf2be1 *inst/include/armadillo_bits/compiler_setup_post.hpp bea9092fd834c6ae383f54e695aa0aac *inst/include/armadillo_bits/cond_rel_bones.hpp cf9429f8cd17b1cd2af072a407d0508b *inst/include/armadillo_bits/cond_rel_meat.hpp 2ec3fe079609c6c8c994b50c2f16fc7f *inst/include/armadillo_bits/config.hpp 597c6406c69987314f49863e2800dc97 *inst/include/armadillo_bits/constants.hpp bff236c6c5ba99962d0e2ad19c03353a *inst/include/armadillo_bits/constants_old.hpp 6a5fea84d45a9e41cebdc092e287bf73 *inst/include/armadillo_bits/csv_name.hpp df65b60a0518a511f1563c320f7e2cd8 *inst/include/armadillo_bits/debug.hpp 25372d34d91afca1c836a6d59bf5a1e6 *inst/include/armadillo_bits/def_arpack.hpp 468037f3180ae4ee3d7f718ae1c58cd7 *inst/include/armadillo_bits/def_atlas.hpp 06f2d860374c561220c60be92c960bf7 *inst/include/armadillo_bits/def_blas.hpp 50e4c018add283c5b37f53ec6aa08005 *inst/include/armadillo_bits/def_fftw3.hpp ed4dc0d5afe7d48633bf68fad7f66d16 *inst/include/armadillo_bits/def_lapack.hpp 8e08c98adda27c7fbaddd13ff9994dd7 *inst/include/armadillo_bits/def_superlu.hpp 47b96f5a08c8a4236dfac33f8d5ca51f *inst/include/armadillo_bits/diagmat_proxy.hpp a19c0deab3778eb486af12c8340184d9 *inst/include/armadillo_bits/diagview_bones.hpp e41cebf127ec9f658a8571cf139de468 *inst/include/armadillo_bits/diagview_meat.hpp 1c131a0a41eda16db3f33116cc3481e7 *inst/include/armadillo_bits/diskio_bones.hpp 4010cffd1051528aa0866edb8dab4d26 *inst/include/armadillo_bits/diskio_meat.hpp 81597997a6f9925f2f8da63cd97af8ec *inst/include/armadillo_bits/distr_param.hpp 5722504e899578ccbb183355c1bd1a1a *inst/include/armadillo_bits/eGlueCube_bones.hpp 92b69fb17566576aff1ef311a32f6e81 *inst/include/armadillo_bits/eGlueCube_meat.hpp c6983ec9f5b7f0e67ae6ef06fdc8d65b *inst/include/armadillo_bits/eGlue_bones.hpp 9a1b4198080734a1ac6fa3a6fc1723e6 *inst/include/armadillo_bits/eGlue_meat.hpp d5d2b255f72e25b941cd3c97fbde5743 *inst/include/armadillo_bits/eOpCube_bones.hpp 2ca86e155ebb8016f3d549c451f2c424 *inst/include/armadillo_bits/eOpCube_meat.hpp 9f1c21528e1ef55a7b5bbe47f4b7de38 *inst/include/armadillo_bits/eOp_bones.hpp eda096eb2addece9a0a6d0ede41760d3 *inst/include/armadillo_bits/eOp_meat.hpp f07bd113fd72d3c3789243bb5d2cc6db *inst/include/armadillo_bits/eglue_core_bones.hpp 4ebe9f7cbbc1418fa2f06d39fd44b385 *inst/include/armadillo_bits/eglue_core_meat.hpp 5c8eb8c1ad6d71b37442dfa8a79a7ee0 *inst/include/armadillo_bits/eop_aux.hpp c4730f03dd35c58083df5f08b596e3b5 *inst/include/armadillo_bits/eop_core_bones.hpp 8fda61df034e6a812115e3ff54d51e26 *inst/include/armadillo_bits/eop_core_meat.hpp cdc8b46c78dc15b2049c3efdb800a035 *inst/include/armadillo_bits/fft_engine_fftw3.hpp 170419b54a456a6346f56aafc0e52cb2 *inst/include/armadillo_bits/fft_engine_kissfft.hpp 4de8d3a0d636a027ef94d5528d0a9ce9 *inst/include/armadillo_bits/field_bones.hpp 34f288efb3a75fd91bcb84b856570084 *inst/include/armadillo_bits/field_meat.hpp 4c9af8991b48457503c89cd59f15113f *inst/include/armadillo_bits/fill.hpp de883005f4e9bfe138f00424a874aeb8 *inst/include/armadillo_bits/fn_accu.hpp b0fdfe2fc8eea4ca2ecdc72ae2f21e3f *inst/include/armadillo_bits/fn_all.hpp 58e5df3e5bb058e3e7db9de7fd73ba2d *inst/include/armadillo_bits/fn_any.hpp e6ffabd79039e98deb48e886b1c65bef *inst/include/armadillo_bits/fn_approx_equal.hpp 079106d0313821bd1ac946e8d7fb5a8d *inst/include/armadillo_bits/fn_as_scalar.hpp 6e7a3a4ac426298c37044c0aea5ccc48 *inst/include/armadillo_bits/fn_balance.hpp edd5f7cbd7ae4bf5d6a83fafe81359ca *inst/include/armadillo_bits/fn_chi2rnd.hpp 1e0e84c903a1aed1eb6d6fe3c82adcfb *inst/include/armadillo_bits/fn_chol.hpp 0821eb15f65e1b95a9662b7bf5e2d8d4 *inst/include/armadillo_bits/fn_clamp.hpp abc479785d306ba4074359dfffbf81bc *inst/include/armadillo_bits/fn_cond_rcond.hpp 343a91395ece2a2ee736ea0a017171cd *inst/include/armadillo_bits/fn_conv.hpp 5efda605c7160950d2cc938f4cb40725 *inst/include/armadillo_bits/fn_conv_to.hpp ad308079912e66db9b4358b97b11aeb4 *inst/include/armadillo_bits/fn_cor.hpp 0a0dc39bca546db45085c1f4e03bd474 *inst/include/armadillo_bits/fn_cov.hpp 3d696543a75c328f3542d19dff2e383c *inst/include/armadillo_bits/fn_cross.hpp b0e09587243b8d588c76cff334fa5728 *inst/include/armadillo_bits/fn_cumprod.hpp 38eee4894d6257eb2d3142d48a85e6c6 *inst/include/armadillo_bits/fn_cumsum.hpp 483a11f9185a2b320ab67b574a08c68c *inst/include/armadillo_bits/fn_det.hpp 62a90e3e706c58ff1fa09538833c7b77 *inst/include/armadillo_bits/fn_diagmat.hpp 8c1689bc81a0601242fc64598b8e84ed *inst/include/armadillo_bits/fn_diags_spdiags.hpp be0d645aa467f34a7582f2e635655e11 *inst/include/armadillo_bits/fn_diagvec.hpp 888e3c72ab9cc69c319cba6a6e375cd7 *inst/include/armadillo_bits/fn_diff.hpp d4cc9fd4ddf464ffdbd330660c6eb3ed *inst/include/armadillo_bits/fn_dot.hpp 03f390b128cc52e36b767a6d89621795 *inst/include/armadillo_bits/fn_eig_gen.hpp 368d4bd0c9b02bcd6c0673a9bb313e6a *inst/include/armadillo_bits/fn_eig_pair.hpp 047932d03f2141db231ee7e1c6a10c55 *inst/include/armadillo_bits/fn_eig_sym.hpp 306c55c9e2c4ed568227e034361db576 *inst/include/armadillo_bits/fn_eigs_gen.hpp bacee6e0040f19cd17357c2b7255782f *inst/include/armadillo_bits/fn_eigs_sym.hpp 1ba7a31e9d85d7c5a4706118fd5d62c7 *inst/include/armadillo_bits/fn_elem.hpp ca1c22febe336cb8c6c81e3c2e860c01 *inst/include/armadillo_bits/fn_eps.hpp fbd188cb698a5beab04ca95073c02c65 *inst/include/armadillo_bits/fn_expmat.hpp b8452741a5f7e2bb3fe773cbf6e75ddb *inst/include/armadillo_bits/fn_eye.hpp 689a18302566f4bc9494bf0a3d3e1290 *inst/include/armadillo_bits/fn_fft.hpp f58c994efad14b8287e862d2c53e6c69 *inst/include/armadillo_bits/fn_fft2.hpp 6fe1e1efad89e5dacd099e345d78d85c *inst/include/armadillo_bits/fn_find.hpp 77239ff9a01c774a1910beb7f790ee30 *inst/include/armadillo_bits/fn_find_unique.hpp cd116775178ed8b8e1850559a641e396 *inst/include/armadillo_bits/fn_flip.hpp 49d9cf32fb834dd323a3d26bd634fdd6 *inst/include/armadillo_bits/fn_hess.hpp fcf9e277792ed928d655696d8a863c51 *inst/include/armadillo_bits/fn_hist.hpp c3b16cd744b1e769691e2e9723d87e48 *inst/include/armadillo_bits/fn_histc.hpp 33f7c097c652d13d4c16b3dcc3eeacb2 *inst/include/armadillo_bits/fn_index_max.hpp 0d87aa720eb7c89c8b5323b4d3e202d4 *inst/include/armadillo_bits/fn_index_min.hpp b1184363d3884395f6dc3261b91fddf7 *inst/include/armadillo_bits/fn_inplace_strans.hpp ee0206a3ba453155b0200a069d223a51 *inst/include/armadillo_bits/fn_inplace_trans.hpp aa292414ceb484904e9a0a34b84ff052 *inst/include/armadillo_bits/fn_interp1.hpp d3c3135f69421ad0a32476af17d5b4a8 *inst/include/armadillo_bits/fn_interp2.hpp de0a573c9bdb447b35b30b89c4cc76a0 *inst/include/armadillo_bits/fn_intersect.hpp 6e4544efe59ec0834086c240354ef9ed *inst/include/armadillo_bits/fn_inv.hpp 21aefd9e6bea61e7e6fe5f131d03ed0c *inst/include/armadillo_bits/fn_inv_sympd.hpp 08e520a14fcab581b4cd74082ec5a8b4 *inst/include/armadillo_bits/fn_join.hpp 49a3e038b4f7be8596c4814b95416b88 *inst/include/armadillo_bits/fn_kmeans.hpp c46dd7324a28913898cc0914164f610b *inst/include/armadillo_bits/fn_kron.hpp cbfcdbde92c0601ea213b08a4976f87c *inst/include/armadillo_bits/fn_log_det.hpp 26ec679d5c72df4393f5aa802e9e3f71 *inst/include/armadillo_bits/fn_log_normpdf.hpp 16830a822f5524b363cb6f4334bbdbd8 *inst/include/armadillo_bits/fn_logmat.hpp b285834b6ceb415954717c70ea4281d5 *inst/include/armadillo_bits/fn_lu.hpp a2330592e09ffb431283e9a8f20b8888 *inst/include/armadillo_bits/fn_max.hpp 12ae78448323c6812c8bf1a2d95ad487 *inst/include/armadillo_bits/fn_mean.hpp 759c7821cad56d007e335b6ed37d1bee *inst/include/armadillo_bits/fn_median.hpp 2476db1d4bd4ae32a0c0fdb9e62b819c *inst/include/armadillo_bits/fn_min.hpp 79becd0cb2d8c7e46851c6aed585f8e1 *inst/include/armadillo_bits/fn_misc.hpp 104abe07abe9bad4e9bab986139ee27a *inst/include/armadillo_bits/fn_mvnrnd.hpp 1fd4acb37e8310af48011582cb33b6d8 *inst/include/armadillo_bits/fn_n_unique.hpp cfed49714188034de41894de9d4492b3 *inst/include/armadillo_bits/fn_nonzeros.hpp 8ffb6a72b3352971c9f9b49b5dc0848a *inst/include/armadillo_bits/fn_norm.hpp 0a0bc024938d40f4702861c737edf344 *inst/include/armadillo_bits/fn_normalise.hpp 9e65ef2e100596bbad6a9bc024578827 *inst/include/armadillo_bits/fn_normcdf.hpp 018daf776aa6a09b22cc2d1a77163f1d *inst/include/armadillo_bits/fn_normpdf.hpp 1d5cea20355006aafcde8abd39c94514 *inst/include/armadillo_bits/fn_numel.hpp 525a209dcac03016c3c379fd91a0456f *inst/include/armadillo_bits/fn_omit.hpp 5a0aaa6a1bd662f1822b40c284b973fe *inst/include/armadillo_bits/fn_ones.hpp 791c5eb05c1b4fa1c7004755d06dd964 *inst/include/armadillo_bits/fn_orth_null.hpp 1a41099fe24428b7fd9e9190cb436e01 *inst/include/armadillo_bits/fn_pinv.hpp 02c57c4cfd204d2ccfd0a2f015ac9577 *inst/include/armadillo_bits/fn_polyfit.hpp 2688dc1c9cb66c9376e6f39d0eb871ac *inst/include/armadillo_bits/fn_polyval.hpp f6b85e4c9c0b00b50aec9b1462aca813 *inst/include/armadillo_bits/fn_powext.hpp ac5c0eb6f886f8a1ce79e192e47ffc0e *inst/include/armadillo_bits/fn_powmat.hpp 2edb26b24a0513c631fa1539ec874871 *inst/include/armadillo_bits/fn_princomp.hpp eb414b3c110b2123ad8f59e65686cc9b *inst/include/armadillo_bits/fn_prod.hpp 1e3ddf415910fe3c2f2fe135dc5619dc *inst/include/armadillo_bits/fn_qr.hpp a23d8eb79b4c7cf8252c0cd0dd00a0ca *inst/include/armadillo_bits/fn_quantile.hpp 5722ee05d94f8d4aa2a81fdc508af3db *inst/include/armadillo_bits/fn_qz.hpp bc4e55ab373fd168f706dd1304eea4b0 *inst/include/armadillo_bits/fn_randg.hpp 31027a8265f6964a970e0a57c8646872 *inst/include/armadillo_bits/fn_randi.hpp 022154451084cd41f6b55b332716dfc2 *inst/include/armadillo_bits/fn_randn.hpp d97ffc53f538c8a9053c8d5a3e4f634b *inst/include/armadillo_bits/fn_randperm.hpp 5789d85c16a01428c232dbde6c22c9e3 *inst/include/armadillo_bits/fn_randu.hpp 1adaf4ccc9729daa015e49ab2edff603 *inst/include/armadillo_bits/fn_range.hpp f3e118b9e2dbc70b59ee8aa9c646d24e *inst/include/armadillo_bits/fn_rank.hpp 080e5f812c6fbcbf815c60e0a3dfe5fc *inst/include/armadillo_bits/fn_regspace.hpp 9a57077088306560edf18f3bd2dad7e1 *inst/include/armadillo_bits/fn_repelem.hpp aa5910b12b8fee4faf1f1cf346280b42 *inst/include/armadillo_bits/fn_repmat.hpp 1939db7b39946dbdfea0f36194623921 *inst/include/armadillo_bits/fn_reshape.hpp d8568d7f85b7db148459b0e5474eb65c *inst/include/armadillo_bits/fn_resize.hpp 18311627868ee94c8a13b40c542636f1 *inst/include/armadillo_bits/fn_reverse.hpp cfaba7ea50e9d7f428d4358fd64b1151 *inst/include/armadillo_bits/fn_roots.hpp 66f85e181ca23856103c9dcd9198171f *inst/include/armadillo_bits/fn_schur.hpp e5d73d4d4143c4913144d7d240b61714 *inst/include/armadillo_bits/fn_shift.hpp 2e070cc99beeb86b29a975fdbc6f6644 *inst/include/armadillo_bits/fn_shuffle.hpp cba44f0575ea4b800ae2dff117d2d0c0 *inst/include/armadillo_bits/fn_size.hpp 4d7217c07aaa46338c7d76b47c2ea613 *inst/include/armadillo_bits/fn_solve.hpp a12a61427fe5cfa46c52062ef6fd69ba *inst/include/armadillo_bits/fn_sort.hpp 809e2ee3b264b6ed09cd6fb2d4be0166 *inst/include/armadillo_bits/fn_sort_index.hpp 81a41ee75bf0e35c32f95a8c99824313 *inst/include/armadillo_bits/fn_speye.hpp 98b35c18377415ddd296f264b082a2ec *inst/include/armadillo_bits/fn_spones.hpp 3cffd9ff2d1b153fe6b8de84cc32510d *inst/include/armadillo_bits/fn_sprandn.hpp f620ee481c9ca900099f6c7755025df4 *inst/include/armadillo_bits/fn_sprandu.hpp 5661fb19ec60157ff14eb8dd3d7b6c76 *inst/include/armadillo_bits/fn_spsolve.hpp 407936d995465240b00568d55b3962f8 *inst/include/armadillo_bits/fn_sqrtmat.hpp 426ecce54b83106ba2ae8872de573f99 *inst/include/armadillo_bits/fn_stddev.hpp de49b759bfa6d2bbaaad078306fbfb05 *inst/include/armadillo_bits/fn_strans.hpp 3bd2a840983fcc0f79f1add9112745f4 *inst/include/armadillo_bits/fn_sum.hpp 7b04eab8b6575b8b3be78e13734168c2 *inst/include/armadillo_bits/fn_svd.hpp 447cc02ca0adb23837914f3eab286bbe *inst/include/armadillo_bits/fn_svds.hpp 5780f4520b39aa57ef67f90372ebd6ea *inst/include/armadillo_bits/fn_sylvester.hpp 7c0c6f2d276bee2f738c3d6c1b41c554 *inst/include/armadillo_bits/fn_symmat.hpp f33d7acfa4dce2351dfda70211bef24e *inst/include/armadillo_bits/fn_toeplitz.hpp fd5eae3348488355517e8fef0d059cdb *inst/include/armadillo_bits/fn_trace.hpp 80d74e621f067ca9dfdc661222ac857f *inst/include/armadillo_bits/fn_trans.hpp 60c914366ec28a6fa5430aa8c95d18a6 *inst/include/armadillo_bits/fn_trapz.hpp 339b1f0cd1354cb80b51d130b43be9a2 *inst/include/armadillo_bits/fn_trig.hpp dd8432d7a2d3c0b8ee2b1ff31b72a585 *inst/include/armadillo_bits/fn_trimat.hpp 1f10b6e90016373293e0fc58b9b90afa *inst/include/armadillo_bits/fn_trimat_ind.hpp 1784f162935fb9b9b1d62eaf6fa2aad9 *inst/include/armadillo_bits/fn_trunc_exp.hpp 9edbb4c2609be3049d69432102a63987 *inst/include/armadillo_bits/fn_trunc_log.hpp 3d50e0f77bab64154c10c569f6d73019 *inst/include/armadillo_bits/fn_unique.hpp 648410d673dd91847f253eddad72d7f2 *inst/include/armadillo_bits/fn_var.hpp 0de543ead4f362e5f05099a63690f283 *inst/include/armadillo_bits/fn_vecnorm.hpp 3a17798d89771fbbfef569e2fe8ee00f *inst/include/armadillo_bits/fn_vectorise.hpp adba63a1378f0643de452fc79c7b48d8 *inst/include/armadillo_bits/fn_wishrnd.hpp 7ef0a2fb81475fd5f7d2c8d0274b2d5a *inst/include/armadillo_bits/fn_zeros.hpp fd1da746bc8f3ec6a9521f9dcc29b50f *inst/include/armadillo_bits/glue_affmul_bones.hpp ff68061be8f95a2a6a6e0111f1f2dcf5 *inst/include/armadillo_bits/glue_affmul_meat.hpp 758918bf6fdc8f15930c5d8e596e2746 *inst/include/armadillo_bits/glue_atan2_bones.hpp 40dd5397af53ad4de9bbfa44324dd1fd *inst/include/armadillo_bits/glue_atan2_meat.hpp 228620666311453c5bdb0246799bdc7b *inst/include/armadillo_bits/glue_conv_bones.hpp b24d620adf12f1b06cd04115e3e24617 *inst/include/armadillo_bits/glue_conv_meat.hpp da67cec5d69a053037fbd3fac09f4177 *inst/include/armadillo_bits/glue_cor_bones.hpp 3c053c7ed82b32326327351eb8c381fb *inst/include/armadillo_bits/glue_cor_meat.hpp f7e1fd84a54d44f6856c8b6ef0bb33a0 *inst/include/armadillo_bits/glue_cov_bones.hpp 55ac14bfcf90986dff9536cd7c3d49f4 *inst/include/armadillo_bits/glue_cov_meat.hpp 11e82cb2ab71ae533761c5131bfe57cc *inst/include/armadillo_bits/glue_cross_bones.hpp 3e72c00e56a714ae99860d672aec87e5 *inst/include/armadillo_bits/glue_cross_meat.hpp 74534f195669f96862bd60fe742662e1 *inst/include/armadillo_bits/glue_hist_bones.hpp f0682e83ea230ab8583435d35e7d854a *inst/include/armadillo_bits/glue_hist_meat.hpp ebbe2483a02cc15baf42c1ef99654345 *inst/include/armadillo_bits/glue_histc_bones.hpp bf7084d58eb60a9641d102d7b1971ede *inst/include/armadillo_bits/glue_histc_meat.hpp df220080feacdd7ecdebd7803d6de29f *inst/include/armadillo_bits/glue_hypot_bones.hpp ad0b541fecd2dfa778d87001ae7180ef *inst/include/armadillo_bits/glue_hypot_meat.hpp 6b2547c27c50ee53993a8877935dafdb *inst/include/armadillo_bits/glue_intersect_bones.hpp e68b55d587922f588e70882dd18007d6 *inst/include/armadillo_bits/glue_intersect_meat.hpp 30893821b24130bd727bcb50d51c84b4 *inst/include/armadillo_bits/glue_join_bones.hpp 036dc9cedcaa6dbfe82f9160b09cd138 *inst/include/armadillo_bits/glue_join_meat.hpp d255be47039eab5a4b9e02b0a6f9cf1b *inst/include/armadillo_bits/glue_kron_bones.hpp 212c7cb8303120daafc6c5253d7b4b08 *inst/include/armadillo_bits/glue_kron_meat.hpp 5168fff71c97c248d913eb242b772aed *inst/include/armadillo_bits/glue_max_bones.hpp ac90a95da4713e0d25f877254bc74170 *inst/include/armadillo_bits/glue_max_meat.hpp 36c40009d2307ba4f6e7afb635fd7672 *inst/include/armadillo_bits/glue_min_bones.hpp 76cf479a4b9c3b85bc9debafa07cc740 *inst/include/armadillo_bits/glue_min_meat.hpp 60906aedfd5c3a5f46591b1c07097f46 *inst/include/armadillo_bits/glue_mixed_bones.hpp 0a018010522cae47a18aa4f426710fcc *inst/include/armadillo_bits/glue_mixed_meat.hpp 6546a287526bf276bef436f98705ea3e *inst/include/armadillo_bits/glue_mvnrnd_bones.hpp afa42b2bdaa767a9fd21ada727890fdb *inst/include/armadillo_bits/glue_mvnrnd_meat.hpp 98b5012e5be636fc348f7ecc3fab6ff7 *inst/include/armadillo_bits/glue_polyfit_bones.hpp c315a08a2343fdff0ce390d81f2c3f45 *inst/include/armadillo_bits/glue_polyfit_meat.hpp 27726a22fe9608be69201e88c66613e7 *inst/include/armadillo_bits/glue_polyval_bones.hpp 25c58422e241085e66d81e00789e48cf *inst/include/armadillo_bits/glue_polyval_meat.hpp 7b8f894713af7ae156914a90a27054ac *inst/include/armadillo_bits/glue_powext_bones.hpp 0bf75130abbce67236b3a0cc6e05999f *inst/include/armadillo_bits/glue_powext_meat.hpp f46fa8415771de7af93791de2ebfd809 *inst/include/armadillo_bits/glue_quantile_bones.hpp f672c51cc526df7fcd3b4a0297582fc7 *inst/include/armadillo_bits/glue_quantile_meat.hpp 260954229c78079ec76e088aca91a391 *inst/include/armadillo_bits/glue_relational_bones.hpp 00bca91104bd729bf44bfceb9a63d1e8 *inst/include/armadillo_bits/glue_relational_meat.hpp 969bc6d66b0ff657fe2b7ef87856d797 *inst/include/armadillo_bits/glue_solve_bones.hpp bb22fbb528b5983dd1be0e0ff7711975 *inst/include/armadillo_bits/glue_solve_meat.hpp 4e639dd9acc118d8cad340e29a531854 *inst/include/armadillo_bits/glue_times_bones.hpp 51086547c52fa4a1141e581e62ef8f56 *inst/include/armadillo_bits/glue_times_meat.hpp 6adc9fb8ef4da98857f1235a0fc40d0e *inst/include/armadillo_bits/glue_times_misc_bones.hpp 6039aecd5556e791f60c0c82b30c20bf *inst/include/armadillo_bits/glue_times_misc_meat.hpp 7b4e0a89301fd57f3f8138f9d56b3862 *inst/include/armadillo_bits/glue_toeplitz_bones.hpp 4a7a15f73a85cb7439e8ed3cf4c50357 *inst/include/armadillo_bits/glue_toeplitz_meat.hpp e09461d473859cedd1a44d359a206280 *inst/include/armadillo_bits/glue_trapz_bones.hpp 0cd3bfaa90c7d4b8a07bcec8b327ccfc *inst/include/armadillo_bits/glue_trapz_meat.hpp 63c7772e5ca5a5fe4cbbf7b786ff26eb *inst/include/armadillo_bits/gmm_diag_bones.hpp a09722bfaca14161ead3cce4a7dd07c8 *inst/include/armadillo_bits/gmm_diag_meat.hpp 8c13a2d8d0cd5eb2311dc858f3728227 *inst/include/armadillo_bits/gmm_full_bones.hpp 9ca3dc4e3698ede1df2bceede93341cd *inst/include/armadillo_bits/gmm_full_meat.hpp bc6e945955cb05f2a710ef3a516c113f *inst/include/armadillo_bits/gmm_misc_bones.hpp 959f6f9340743c19ad4c02d29a0dbc29 *inst/include/armadillo_bits/gmm_misc_meat.hpp d543abd2e1c932604deed345a7ea152a *inst/include/armadillo_bits/hdf5_misc.hpp d772e73987f7d375f4a313eedece101e *inst/include/armadillo_bits/hdf5_name.hpp cc1b0e3e54f6958eaf9ec74e200b3622 *inst/include/armadillo_bits/include_hdf5.hpp 6976b9a9bc6b56398e03515124a0e2ef *inst/include/armadillo_bits/include_superlu.hpp adc7369ad88e7d2040340d9803ef29eb *inst/include/armadillo_bits/injector_bones.hpp c1521ab5fbb0d4867bb8a75ed2a2a5cf *inst/include/armadillo_bits/injector_meat.hpp 9ea12dd00590f2a98f1a8ade0f7311b8 *inst/include/armadillo_bits/memory.hpp 87901cafa7674dba60243c4898057376 *inst/include/armadillo_bits/mp_misc.hpp 53658500b8a68fa1d767808fb4931fa8 *inst/include/armadillo_bits/mtGlueCube_bones.hpp 9f810bd5f69a2c8c78c7288e2191a14f *inst/include/armadillo_bits/mtGlueCube_meat.hpp d97f7537448e9fb5471e0cc8301b03ab *inst/include/armadillo_bits/mtGlue_bones.hpp 4d413406aa46522c32c72c55be1f5cd6 *inst/include/armadillo_bits/mtGlue_meat.hpp 058dfa366f12e3472e7b0f80140da8f4 *inst/include/armadillo_bits/mtOpCube_bones.hpp d79a67b88ebc02a0205be1fa6c12148e *inst/include/armadillo_bits/mtOpCube_meat.hpp 94bc7e255c91bcf3162db93e227e307d *inst/include/armadillo_bits/mtOp_bones.hpp 80c2a331fcb353cce1331663aa4c6c08 *inst/include/armadillo_bits/mtOp_meat.hpp 478f360a19bc4fa3986d9bb2d5867418 *inst/include/armadillo_bits/mtSpGlue_bones.hpp d0f89c2d1cd954d4bc247854a9b9d351 *inst/include/armadillo_bits/mtSpGlue_meat.hpp 8ae328d8d9aaec724eb6d889f7130623 *inst/include/armadillo_bits/mtSpOp_bones.hpp 006156b8503128d6927595cfd0668a74 *inst/include/armadillo_bits/mtSpOp_meat.hpp fdd653d430898b5991231a5beb893174 *inst/include/armadillo_bits/mtSpReduceOp_bones.hpp 937ea0d087dddad8aaff6d21e5503271 *inst/include/armadillo_bits/mtSpReduceOp_meat.hpp 33429caf0b502b873805a16ef912fa9c *inst/include/armadillo_bits/mul_gemm.hpp 8379bce86d5e82b34c1e7e13d52196b9 *inst/include/armadillo_bits/mul_gemm_mixed.hpp 1a489e721650f4499f529c2a4b0f49d4 *inst/include/armadillo_bits/mul_gemv.hpp d7d7426b1b372065f9fa8cba6d6d68e4 *inst/include/armadillo_bits/mul_herk.hpp 58292f2050b9acf7691a2e100cadc25e *inst/include/armadillo_bits/mul_syrk.hpp cd751c8539247bfcbf7c69277af7d7d8 *inst/include/armadillo_bits/newarp_DenseGenMatProd_bones.hpp 330cee96756a905391b8e4495e1d4c7c *inst/include/armadillo_bits/newarp_DenseGenMatProd_meat.hpp 8fbd622a93e16834af098ec8b0a3c9ea *inst/include/armadillo_bits/newarp_DoubleShiftQR_bones.hpp 0aab1531baeef254f8418a734a552f5d *inst/include/armadillo_bits/newarp_DoubleShiftQR_meat.hpp 4dced0e5a3b97ea3b3d113f17e876f15 *inst/include/armadillo_bits/newarp_EigsSelect.hpp c72e78bc1b0561600640ff13ed37c518 *inst/include/armadillo_bits/newarp_GenEigsSolver_bones.hpp d41b06b69d43b99d60f5d30a672a46e8 *inst/include/armadillo_bits/newarp_GenEigsSolver_meat.hpp e5a42501589efd52ac1121598caed0f5 *inst/include/armadillo_bits/newarp_SortEigenvalue.hpp e25d04473f566960767c4a28e5e40ec9 *inst/include/armadillo_bits/newarp_SparseGenMatProd_bones.hpp ab59476cdd779de7aa15250624be004a *inst/include/armadillo_bits/newarp_SparseGenMatProd_meat.hpp f7cf58f1e5eeac485d0a896573598f10 *inst/include/armadillo_bits/newarp_SparseGenRealShiftSolve_bones.hpp 1b5ff0a3244be3a7183f3eae6c18e0d8 *inst/include/armadillo_bits/newarp_SparseGenRealShiftSolve_meat.hpp 82aa7e1349ffd441ab07904b369a12dd *inst/include/armadillo_bits/newarp_SymEigsShiftSolver_bones.hpp 8f1d75fc44542762bdc440094965ffb5 *inst/include/armadillo_bits/newarp_SymEigsShiftSolver_meat.hpp 2945dedf415a6785c6e7135b2d4f3a14 *inst/include/armadillo_bits/newarp_SymEigsSolver_bones.hpp b5befd579272aa5f91da182fa0d55a70 *inst/include/armadillo_bits/newarp_SymEigsSolver_meat.hpp d90c1104ae351152be1f21797883189f *inst/include/armadillo_bits/newarp_TridiagEigen_bones.hpp e8043da83572447032531914c00d456f *inst/include/armadillo_bits/newarp_TridiagEigen_meat.hpp 04c6c7588a27dab833e5c8ad0dffd6f8 *inst/include/armadillo_bits/newarp_UpperHessenbergEigen_bones.hpp b0bb4bbd287b82418172f482cca2e96f *inst/include/armadillo_bits/newarp_UpperHessenbergEigen_meat.hpp a571a4772c12783d99dde1fa1d49a70d *inst/include/armadillo_bits/newarp_UpperHessenbergQR_bones.hpp 5dbf671771ad6a30efd9d0e2fbf8bc90 *inst/include/armadillo_bits/newarp_UpperHessenbergQR_meat.hpp 63d382b7fbbc6ea9bd377ce5d3fb8da2 *inst/include/armadillo_bits/newarp_cx_attrib.hpp dc74db42d27688e97280bb49aa14d80c *inst/include/armadillo_bits/op_all_bones.hpp d9bdbc1813b5864db180590404f3b325 *inst/include/armadillo_bits/op_all_meat.hpp b767a29fdb7e696f71057397df4c85f8 *inst/include/armadillo_bits/op_any_bones.hpp 513b9266c32dc3cfe5d16559a4c8fc5d *inst/include/armadillo_bits/op_any_meat.hpp 8b100ef30e966ea7122c1df5d840d81a *inst/include/armadillo_bits/op_chi2rnd_bones.hpp 10e685b224a9432c1f48ae0a5d5fa144 *inst/include/armadillo_bits/op_chi2rnd_meat.hpp 2293aec27f979a60988543a719b97762 *inst/include/armadillo_bits/op_chol_bones.hpp 3e6c7f832ff740f8a9b023008df1172c *inst/include/armadillo_bits/op_chol_meat.hpp 3951138bd972663f19d01de5be7b7505 *inst/include/armadillo_bits/op_clamp_bones.hpp a67815391feefa92bf0c75d729cc2348 *inst/include/armadillo_bits/op_clamp_meat.hpp 8db6b82cb9702bd269062c1ee19b1182 *inst/include/armadillo_bits/op_col_as_mat_bones.hpp 033a812e482849bdef57a997757efaa1 *inst/include/armadillo_bits/op_col_as_mat_meat.hpp 62fb61d6b8b8296edc614e44810ec13d *inst/include/armadillo_bits/op_cond_bones.hpp de84da06db3c7057c74cc11bf7fd7d5d *inst/include/armadillo_bits/op_cond_meat.hpp 73ab881f6d3081fa97cfeb5a6b6f76a7 *inst/include/armadillo_bits/op_cor_bones.hpp 947121d4ca445efe69156c38615eb76f *inst/include/armadillo_bits/op_cor_meat.hpp 6c1a11f77b9d90f5c204d5f205bd9904 *inst/include/armadillo_bits/op_cov_bones.hpp b1f77be1ca5720e82607081a73164d23 *inst/include/armadillo_bits/op_cov_meat.hpp 593784958a877a6120a8cd5070942848 *inst/include/armadillo_bits/op_cumprod_bones.hpp 58170618db33df3f95306b935850b2fb *inst/include/armadillo_bits/op_cumprod_meat.hpp d1ef53e747cc1add9af12177b00e9c77 *inst/include/armadillo_bits/op_cumsum_bones.hpp bac1643aad7994bfce5958aa37f80547 *inst/include/armadillo_bits/op_cumsum_meat.hpp 4fe3a4a985c9ac57cef094876476b77d *inst/include/armadillo_bits/op_cx_scalar_bones.hpp 041660d121a8ae675612ba8516aea391 *inst/include/armadillo_bits/op_cx_scalar_meat.hpp 6113a14c4ed2d2fec77082b8632e3188 *inst/include/armadillo_bits/op_det_bones.hpp c557a58c32f65ea2b7d9faca75cfa1ec *inst/include/armadillo_bits/op_det_meat.hpp f7b1651833dd950538da05e4bf3a5abd *inst/include/armadillo_bits/op_diagmat_bones.hpp 27ec09cccfa26798215f908f2cbe1906 *inst/include/armadillo_bits/op_diagmat_meat.hpp 37088a9028e4421dbb1b44895f2d24e2 *inst/include/armadillo_bits/op_diagvec_bones.hpp 771e91927a19c8fd73baadb49a1fce71 *inst/include/armadillo_bits/op_diagvec_meat.hpp 068065fe327abd3e6ee80f93c4a56885 *inst/include/armadillo_bits/op_diff_bones.hpp ba7e6819fe7e0ea87ab04f12f9a0f9b3 *inst/include/armadillo_bits/op_diff_meat.hpp 045c81e500b486d8066bb3498e5868c2 *inst/include/armadillo_bits/op_dot_bones.hpp 92cd2e1bca69b5dfc41533bb95448951 *inst/include/armadillo_bits/op_dot_meat.hpp 128afd228ff8edaf56a9721986f6d61a *inst/include/armadillo_bits/op_dotext_bones.hpp fcd7abca5fde5502a3651600821491b6 *inst/include/armadillo_bits/op_dotext_meat.hpp 11a14e241191788dc3282bf2fdce2dc2 *inst/include/armadillo_bits/op_expmat_bones.hpp bde7997f0735514d91a41770d1b9b01f *inst/include/armadillo_bits/op_expmat_meat.hpp 5bceb56b6b1e96ccc47c580bb85be4c3 *inst/include/armadillo_bits/op_fft_bones.hpp 1415e0830b0c2467f34af0eafeb2226c *inst/include/armadillo_bits/op_fft_meat.hpp be3b7189935cd532b14da701364ad535 *inst/include/armadillo_bits/op_find_bones.hpp fa9fa75e5241176bfdfec7dbe2ba8954 *inst/include/armadillo_bits/op_find_meat.hpp 73123b1a2ef10996531317c40fe52873 *inst/include/armadillo_bits/op_find_unique_bones.hpp c14d96603a96c9e6e4d97b616a301061 *inst/include/armadillo_bits/op_find_unique_meat.hpp f106fbbfaf53b7a51e0319f83fef7ec1 *inst/include/armadillo_bits/op_flip_bones.hpp 1fb0eeec5ca2bbe78be17c653da5e8be *inst/include/armadillo_bits/op_flip_meat.hpp 6274576457b60ec6f4f0089389a02416 *inst/include/armadillo_bits/op_hist_bones.hpp d4be262fdba4e21329ea427940f6f546 *inst/include/armadillo_bits/op_hist_meat.hpp aebe1f8676311912fb6a2b9942663748 *inst/include/armadillo_bits/op_htrans_bones.hpp 6bf64288493f8abc695216b1f5834e7f *inst/include/armadillo_bits/op_htrans_meat.hpp 26cc158dbddaad13a3e204d46604c536 *inst/include/armadillo_bits/op_index_max_bones.hpp c632de2790c9eaa717ce88fab886344d *inst/include/armadillo_bits/op_index_max_meat.hpp 9b695ba25a988e77289b78e433171db8 *inst/include/armadillo_bits/op_index_min_bones.hpp c3d0c66b87ccb4548a6df763faf07ad7 *inst/include/armadillo_bits/op_index_min_meat.hpp 0a5355288d00dd239e2be9168d03ca05 *inst/include/armadillo_bits/op_inv_gen_bones.hpp 28870e27e2f450f31eeec65be5a6911a *inst/include/armadillo_bits/op_inv_gen_meat.hpp c24e3e1aadc91067de70316226b599b9 *inst/include/armadillo_bits/op_inv_spd_bones.hpp d98acdbbbd60440132558dc02caa0870 *inst/include/armadillo_bits/op_inv_spd_meat.hpp f9a9097c9e2e3eaa16a5dba455c74907 *inst/include/armadillo_bits/op_log_det_bones.hpp 95495c199ee48925024c526dfc165579 *inst/include/armadillo_bits/op_log_det_meat.hpp 634c9420dca34b8124588ea46ae6168b *inst/include/armadillo_bits/op_logmat_bones.hpp e3fd483d6d3d37ba0aafc34bca964da4 *inst/include/armadillo_bits/op_logmat_meat.hpp 4d8e64ba874ef9148eec90721f9de463 *inst/include/armadillo_bits/op_max_bones.hpp 8f1ca27585a25772e253096d284d3afa *inst/include/armadillo_bits/op_max_meat.hpp e4640dc7fc64b9db201e9aa69f788a72 *inst/include/armadillo_bits/op_mean_bones.hpp 65e4b2b379247f02ee68be72a6602196 *inst/include/armadillo_bits/op_mean_meat.hpp 719895f88d22e397360477cadbf2b88c *inst/include/armadillo_bits/op_median_bones.hpp fba62d934c7844195712e3524b0205a1 *inst/include/armadillo_bits/op_median_meat.hpp 0fb3a2b7c92fba76eb943ccc4415cf82 *inst/include/armadillo_bits/op_min_bones.hpp c2a56ab9fac236bfff73e82ec8bbf713 *inst/include/armadillo_bits/op_min_meat.hpp c57aa9518417da7c6965d99de25360a9 *inst/include/armadillo_bits/op_misc_bones.hpp 76eb8364f164685556c1d3588e9e4636 *inst/include/armadillo_bits/op_misc_meat.hpp a238716d7925ad940059dff84f98788e *inst/include/armadillo_bits/op_nonzeros_bones.hpp 9759697880fa4344cf68f7b5cc3a9fb5 *inst/include/armadillo_bits/op_nonzeros_meat.hpp 7a28be0af6351d864c17eda53003555e *inst/include/armadillo_bits/op_norm2est_bones.hpp 9d6a95166d08a66482caa62e87dc8dcf *inst/include/armadillo_bits/op_norm2est_meat.hpp 98227cd1984edbc6df7e5a0e2c6a18a0 *inst/include/armadillo_bits/op_norm_bones.hpp a0a80cbc5e8dac28696e4107b1c38c98 *inst/include/armadillo_bits/op_norm_meat.hpp a7b9eef98d496e376e1797b763003da4 *inst/include/armadillo_bits/op_normalise_bones.hpp ac7465d02a671244b629748723660eda *inst/include/armadillo_bits/op_normalise_meat.hpp 4be78ef537fa6869bebbe191b6b276b3 *inst/include/armadillo_bits/op_omit_bones.hpp f23d783c8eeff7362d90d01624364753 *inst/include/armadillo_bits/op_omit_meat.hpp f659f66fd6e3ba041513addff90f4ed0 *inst/include/armadillo_bits/op_orth_null_bones.hpp b131bef697d65c6bba9ac27c94de5d24 *inst/include/armadillo_bits/op_orth_null_meat.hpp 2f948ae743cb9b29b5da271ef6dfa08e *inst/include/armadillo_bits/op_pinv_bones.hpp 0216db1bc86905cf53311b3b2be2e197 *inst/include/armadillo_bits/op_pinv_meat.hpp 54179ce66bcabd6c475e0ffa60ff64bd *inst/include/armadillo_bits/op_powmat_bones.hpp 6d57448d732cba84484913373a339bca *inst/include/armadillo_bits/op_powmat_meat.hpp 37a19a4ebca23f78eb5b05af343b70db *inst/include/armadillo_bits/op_princomp_bones.hpp 9f7f349340386d1f98be2ec5780b01f1 *inst/include/armadillo_bits/op_princomp_meat.hpp fa2703874282b8e76fb9151008d305a7 *inst/include/armadillo_bits/op_prod_bones.hpp bc4c60e33fc5d44ff57cf3e14bce4f39 *inst/include/armadillo_bits/op_prod_meat.hpp 0e0a90d175fec5267aa1b3804edec8cb *inst/include/armadillo_bits/op_range_bones.hpp 6f1d857de8b9a9a5a1d19946a5d389cf *inst/include/armadillo_bits/op_range_meat.hpp 316e47d6ed030837f73760a1e553cca2 *inst/include/armadillo_bits/op_rank_bones.hpp 6233211816dd20c7f18770357530d972 *inst/include/armadillo_bits/op_rank_meat.hpp 91570c03abc7ed7401b463b7cabb32fc *inst/include/armadillo_bits/op_rcond_bones.hpp 7626af4b6a2340eb900310a9f4de993d *inst/include/armadillo_bits/op_rcond_meat.hpp be0d35279c7b509fb6faf8948b6890fd *inst/include/armadillo_bits/op_relational_bones.hpp 92c6469c177ebc8c3cd0a97c11ad37ba *inst/include/armadillo_bits/op_relational_meat.hpp e34a4ada93c46b81d272a22968ff62a1 *inst/include/armadillo_bits/op_repelem_bones.hpp 2e45403bb732620b1ceef36d60b01597 *inst/include/armadillo_bits/op_repelem_meat.hpp f18952a11ecb82a769a84f63cc60784c *inst/include/armadillo_bits/op_repmat_bones.hpp 8c84d81a7307730eb105c60199fbc0c4 *inst/include/armadillo_bits/op_repmat_meat.hpp 2f527ef725af8029e0fa409237a0770d *inst/include/armadillo_bits/op_reshape_bones.hpp a990b969cac967fb8da681a57ee54de0 *inst/include/armadillo_bits/op_reshape_meat.hpp 3a5a5c963cf09a7c03cde77877c754e6 *inst/include/armadillo_bits/op_resize_bones.hpp 84f38f037bd6e6a18339aad3f6e62ae4 *inst/include/armadillo_bits/op_resize_meat.hpp 1e28425726f9a0eaf089ea5f467b125d *inst/include/armadillo_bits/op_reverse_bones.hpp c66d70ff9f5085b1833dc9b98687a00b *inst/include/armadillo_bits/op_reverse_meat.hpp 89e9167dda299db89afcce9bd597657d *inst/include/armadillo_bits/op_roots_bones.hpp d8764a904cb4e7fe26e75af793b6f5e1 *inst/include/armadillo_bits/op_roots_meat.hpp b180eb5fc352d7361131a4da85f41027 *inst/include/armadillo_bits/op_row_as_mat_bones.hpp 54d7d5ae271e259435d78f06ead1ab49 *inst/include/armadillo_bits/op_row_as_mat_meat.hpp b2c69f489461dd2f233f53e1b59580d2 *inst/include/armadillo_bits/op_shift_bones.hpp 68d6ac7ef92b340349fda7658b3fbd8f *inst/include/armadillo_bits/op_shift_meat.hpp faf7b83469bb76494fb32cc999bb781c *inst/include/armadillo_bits/op_shuffle_bones.hpp 765ebcef789afd9c3f596dd098238e51 *inst/include/armadillo_bits/op_shuffle_meat.hpp e8a54d20f13d3c02cb7265ddf6a926d4 *inst/include/armadillo_bits/op_sort_bones.hpp f43a29998a841eca99fe830345017c67 *inst/include/armadillo_bits/op_sort_index_bones.hpp 745d290303bebb9ec9107ed793251d7d *inst/include/armadillo_bits/op_sort_index_meat.hpp bec87234a2396f4cc3b73897635e8db5 *inst/include/armadillo_bits/op_sort_meat.hpp 59e643c0dc9502f5b0caf7971542b292 *inst/include/armadillo_bits/op_sp_as_dense_bones.hpp 6b6f29c95950bf8a661706c279f0f98f *inst/include/armadillo_bits/op_sp_as_dense_meat.hpp b0f8c929ea5cf7330757377a9ef2a4a5 *inst/include/armadillo_bits/op_sp_diagvec_bones.hpp 8b9cdcdab0aca47a5afe856f30814bce *inst/include/armadillo_bits/op_sp_diagvec_meat.hpp f93ec35a791f9b0a1c5e661fb823f367 *inst/include/armadillo_bits/op_sp_max_bones.hpp d7bbba27bc81bac044bdc67e15b6874d *inst/include/armadillo_bits/op_sp_max_meat.hpp 559e39c1f9d5110995c03ea509212196 *inst/include/armadillo_bits/op_sp_mean_bones.hpp 843f8730e1a04117859752837de49e2d *inst/include/armadillo_bits/op_sp_mean_meat.hpp 2aae15e293ded495ac62c30d835b25d9 *inst/include/armadillo_bits/op_sp_min_bones.hpp db0c527cca4c41614584dc8df222cd45 *inst/include/armadillo_bits/op_sp_min_meat.hpp 3d0ed1651f3c85c02cda41495274785b *inst/include/armadillo_bits/op_sp_minus_bones.hpp ea3a8b53c43f579d50ed10c9afbb5cbf *inst/include/armadillo_bits/op_sp_minus_meat.hpp 265fd83aa43837402839cdb307fe7452 *inst/include/armadillo_bits/op_sp_nonzeros_bones.hpp d358372c287ee1a6bf415df93b72e541 *inst/include/armadillo_bits/op_sp_nonzeros_meat.hpp 587492ef4708ecd2a67df48be083300f *inst/include/armadillo_bits/op_sp_plus_bones.hpp b78d50bb896b3c0e04c627981d5a46aa *inst/include/armadillo_bits/op_sp_plus_meat.hpp ba95f9e97f23f7a4b437e31e40a18d7e *inst/include/armadillo_bits/op_sp_stddev_bones.hpp ecaaa3c7f0f894e1108a79fa4e0aab26 *inst/include/armadillo_bits/op_sp_stddev_meat.hpp 9166378816c985847b07a0bea4d93b4f *inst/include/armadillo_bits/op_sp_sum_bones.hpp 145ad84d3b26c260e22baf7e834abf8a *inst/include/armadillo_bits/op_sp_sum_meat.hpp 13480faed28154e568affdd6f7566860 *inst/include/armadillo_bits/op_sp_var_bones.hpp a42eedcf4f4df7139cb882d9d4232647 *inst/include/armadillo_bits/op_sp_var_meat.hpp 3bd67c75fb589ed111896474b15791b5 *inst/include/armadillo_bits/op_sp_vecnorm_bones.hpp 836b1c0f10a8ab6a07bd611223df42b8 *inst/include/armadillo_bits/op_sp_vecnorm_meat.hpp e30f4889d35ce090618bc3a41946854d *inst/include/armadillo_bits/op_sqrtmat_bones.hpp 12d6183b3d2839f68d7b412c0efcc677 *inst/include/armadillo_bits/op_sqrtmat_meat.hpp 53b8cfed92631290d125bddbc1a55d23 *inst/include/armadillo_bits/op_stddev_bones.hpp bbb8ddd97f6c0d611ef9754769022709 *inst/include/armadillo_bits/op_stddev_meat.hpp 84433d77257164655ce75af496a762d3 *inst/include/armadillo_bits/op_strans_bones.hpp 4a608055143cc103f769afe9f33f4aae *inst/include/armadillo_bits/op_strans_meat.hpp 7ca11a76da1797684a90075c22e44b7d *inst/include/armadillo_bits/op_sum_bones.hpp ba569ca9ee09c915da6ed508897d5a21 *inst/include/armadillo_bits/op_sum_meat.hpp 2f5aa45c6c3c2ce7aedd6aede196a84c *inst/include/armadillo_bits/op_symmat_bones.hpp 6ed4ffd90866d88819998d5c1216c68f *inst/include/armadillo_bits/op_symmat_meat.hpp de0f46b1491f411a2cff7181ccb6e2de *inst/include/armadillo_bits/op_toeplitz_bones.hpp 5b7c67f81730492893b5ac9e7a1f284a *inst/include/armadillo_bits/op_toeplitz_meat.hpp 4cbff1275ba28366767585b7a339184a *inst/include/armadillo_bits/op_trimat_bones.hpp 0236e7afe402d9fbf056e703ec868233 *inst/include/armadillo_bits/op_trimat_meat.hpp 7dded59b9bc90d8e24d6c50387e03b91 *inst/include/armadillo_bits/op_unique_bones.hpp eba14c54b2da9863e8ccbd95a1f28025 *inst/include/armadillo_bits/op_unique_meat.hpp b0c6493751af4b09f69749cb4745f057 *inst/include/armadillo_bits/op_var_bones.hpp 7900df652dc50493ec2d454bf2fd53c2 *inst/include/armadillo_bits/op_var_meat.hpp 85179d163f8066be1f3522e7643f3804 *inst/include/armadillo_bits/op_vecnorm_bones.hpp 840343a9220fe9723ee72e99590fd560 *inst/include/armadillo_bits/op_vecnorm_meat.hpp e384d38ac6f3f02c37cba04b3b99057d *inst/include/armadillo_bits/op_vectorise_bones.hpp 97d0d641de3d16f32fb3092ddc76ed31 *inst/include/armadillo_bits/op_vectorise_meat.hpp 7621ce30c8d483bc95b2bb8d2f615c12 *inst/include/armadillo_bits/op_wishrnd_bones.hpp 19e303bc73d8cf0015d7a342a758fc21 *inst/include/armadillo_bits/op_wishrnd_meat.hpp 704284494d5ecbbe9389bd5c89e6f285 *inst/include/armadillo_bits/operator_cube_div.hpp 93373904ff0427bd1e7ac30f2440fe7b *inst/include/armadillo_bits/operator_cube_minus.hpp 284b70c3d998cc749019b79f89e84e2b *inst/include/armadillo_bits/operator_cube_plus.hpp 6a4c80eb96a65c2c39979f8369874ab1 *inst/include/armadillo_bits/operator_cube_relational.hpp ecad27b83f091a2813db241b72d41ce6 *inst/include/armadillo_bits/operator_cube_schur.hpp fddc6922ac691dca9294630bded991ed *inst/include/armadillo_bits/operator_cube_times.hpp 8d4856d219382e554ee4141b262ef20a *inst/include/armadillo_bits/operator_div.hpp f062f84967bb9978fb05b67409937556 *inst/include/armadillo_bits/operator_minus.hpp bc5f320250377c9d118b1e8e53022b28 *inst/include/armadillo_bits/operator_ostream.hpp 3abf84caed1d905026fc2c7713f117b1 *inst/include/armadillo_bits/operator_plus.hpp 031cd441437782f04629490d60b2c6a5 *inst/include/armadillo_bits/operator_relational.hpp fec9bf605e8ac7af4cf7e963d16aaaf6 *inst/include/armadillo_bits/operator_schur.hpp f79df73d32bd644d6f62c0bce0433f78 *inst/include/armadillo_bits/operator_times.hpp 214cde327787485beb050553aa04d814 *inst/include/armadillo_bits/podarray_bones.hpp 8207346fd470950450e94c9f747ed275 *inst/include/armadillo_bits/podarray_meat.hpp 7df853d7a969779a11e5b0e452e44ddc *inst/include/armadillo_bits/promote_type.hpp 0fdb5e043d4864b5c70d41521ec901af *inst/include/armadillo_bits/restrictors.hpp a1310f6698222ad8d1d0995875624246 *inst/include/armadillo_bits/running_stat_bones.hpp a530f12188606fcc527aed95ccbbe6ac *inst/include/armadillo_bits/running_stat_meat.hpp 2ce262f946aa79379c3ea8397c85593e *inst/include/armadillo_bits/running_stat_vec_bones.hpp aef196141b4f1ec9b719f57662be0a69 *inst/include/armadillo_bits/running_stat_vec_meat.hpp 89d63aae9c0fa2a085b6a1b24b6a12f2 *inst/include/armadillo_bits/sp_auxlib_bones.hpp d74dad1bdcd5d7114cb18dc23f79c10a *inst/include/armadillo_bits/sp_auxlib_meat.hpp ace7e1397bed321432381a8d4c5af0cc *inst/include/armadillo_bits/span.hpp a7e48f22b3be0ab618d917e88138b130 *inst/include/armadillo_bits/spdiagview_bones.hpp 352aa0a5aed6f622b31333a58ef6f5e4 *inst/include/armadillo_bits/spdiagview_meat.hpp 28cd23770e40db2395cd456cfc8c569b *inst/include/armadillo_bits/spglue_join_bones.hpp 0b4d3a0ab0035b81055e410d4328947d *inst/include/armadillo_bits/spglue_join_meat.hpp 1038d73c9bb67a823694fd9bca78402d *inst/include/armadillo_bits/spglue_kron_bones.hpp 967f5d3c5d14fddae553c945abc77780 *inst/include/armadillo_bits/spglue_kron_meat.hpp 52b2e195044b6bf8233b0eb1ba43dd09 *inst/include/armadillo_bits/spglue_max_bones.hpp 45e0ad62aa16e9c2318bf261dceff51d *inst/include/armadillo_bits/spglue_max_meat.hpp 6e026871669b77107f8d647893feb4fe *inst/include/armadillo_bits/spglue_merge_bones.hpp b30724c6ae85ffc7d50aabc94979ed2f *inst/include/armadillo_bits/spglue_merge_meat.hpp 9f0861db826cfb927c0c6a0b3693ac99 *inst/include/armadillo_bits/spglue_min_bones.hpp 3b54106a6f36d0852ba335110beff4de *inst/include/armadillo_bits/spglue_min_meat.hpp 110f358082177785ac0ea5b6a542fbfb *inst/include/armadillo_bits/spglue_minus_bones.hpp bdd8fdf6af1ff290dd9422ffc720f556 *inst/include/armadillo_bits/spglue_minus_meat.hpp 160bfb0817b31ee4a1ac2368108cb66c *inst/include/armadillo_bits/spglue_plus_bones.hpp 31c24d40f5e2654469ca4524c723483c *inst/include/armadillo_bits/spglue_plus_meat.hpp 227d4667c8ea8c9a85ce3f21f280e3b2 *inst/include/armadillo_bits/spglue_relational_bones.hpp 858ba67a3d432f84dd03403595a91237 *inst/include/armadillo_bits/spglue_relational_meat.hpp ed2ca671b64e41ffcc2cb536eacb9025 *inst/include/armadillo_bits/spglue_schur_bones.hpp 68fd90bec160cf37f3c88a92a3a74bc9 *inst/include/armadillo_bits/spglue_schur_meat.hpp ffe310d205515b671fb0e4a41f4a225d *inst/include/armadillo_bits/spglue_times_bones.hpp 1f7dfc18f8aa55423b2b206079a15201 *inst/include/armadillo_bits/spglue_times_meat.hpp 746befe67029847ea18be9199f5318f0 *inst/include/armadillo_bits/spop_diagmat_bones.hpp a9fd3624696a180122aeebf0dd2837cc *inst/include/armadillo_bits/spop_diagmat_meat.hpp 01a30e3ccdf868055a596b32b588713a *inst/include/armadillo_bits/spop_htrans_bones.hpp c2dc0bdca7c2f6b6c0fd19a9cc059343 *inst/include/armadillo_bits/spop_htrans_meat.hpp c660d32e1771fac1cdc5a6ebfdcff90a *inst/include/armadillo_bits/spop_misc_bones.hpp e25cf4f209706ba0d2a4c2255d90344b *inst/include/armadillo_bits/spop_misc_meat.hpp 1051b78f1c2e5c269b387afd4c25ded3 *inst/include/armadillo_bits/spop_norm_bones.hpp 1cd9c4a2e599ae96f82f8c30b26b36a6 *inst/include/armadillo_bits/spop_norm_meat.hpp 46aa3eccbdaf4b65521e11a36e97bbe8 *inst/include/armadillo_bits/spop_normalise_bones.hpp a3a917d1ff34b990259da66c69aabffc *inst/include/armadillo_bits/spop_normalise_meat.hpp 61d053821a5958924e6ac158937ff019 *inst/include/armadillo_bits/spop_omit_bones.hpp fe053d0a426a811858cc1b9ab10a9c29 *inst/include/armadillo_bits/spop_omit_meat.hpp b41dec90ab5de6a9d84a625047e7471a *inst/include/armadillo_bits/spop_relational_bones.hpp 01fcf2547a81a0643a0f16ea0073b50f *inst/include/armadillo_bits/spop_relational_meat.hpp b3e712f18f75ab5b7391420f5402b207 *inst/include/armadillo_bits/spop_repmat_bones.hpp a72538e8c5c2223d4cc41d93639ae673 *inst/include/armadillo_bits/spop_repmat_meat.hpp 69d65bce76fd5d9988a65d85974f366d *inst/include/armadillo_bits/spop_reverse_bones.hpp c30915f060ba941b52762bd1b50a7ccf *inst/include/armadillo_bits/spop_reverse_meat.hpp ef118f4cde2e456db4c609e07bded14f *inst/include/armadillo_bits/spop_shift_bones.hpp a31c4e2ad7a83da89cfdec8e45c87218 *inst/include/armadillo_bits/spop_shift_meat.hpp 350caa150e0bbb06a4eda332bb43ddfe *inst/include/armadillo_bits/spop_strans_bones.hpp 0a352ae910b6b7650d50186b98eb6b82 *inst/include/armadillo_bits/spop_strans_meat.hpp 08156fed940f83fe2ca1a807914410ad *inst/include/armadillo_bits/spop_symmat_bones.hpp f6e655a077480ecd699273654b4bfb2d *inst/include/armadillo_bits/spop_symmat_meat.hpp 79cc799e4e36cecf379c6d7a6199b40b *inst/include/armadillo_bits/spop_trimat_bones.hpp 9197c072c7c4189511bfab43538e2d29 *inst/include/armadillo_bits/spop_trimat_meat.hpp 6fea69e5e64257283777adf03b963526 *inst/include/armadillo_bits/spop_vectorise_bones.hpp 6b096db7a983e0a931df6265eb1e5f90 *inst/include/armadillo_bits/spop_vectorise_meat.hpp 20b7ecdf9163de9d2a7430276299336b *inst/include/armadillo_bits/spsolve_factoriser_bones.hpp 1f08f150d082ebca12a51dfc6556d739 *inst/include/armadillo_bits/spsolve_factoriser_meat.hpp b98aa421d32d1a7fded958a6bf199e06 *inst/include/armadillo_bits/strip.hpp 9a5a1891b8f94b8f3a309f5351032719 *inst/include/armadillo_bits/subview_bones.hpp c0a456e412ff7ce4e7936118aacbb073 *inst/include/armadillo_bits/subview_cube_bones.hpp d6dd136820fa84aefa1dc09609b3f22d *inst/include/armadillo_bits/subview_cube_each_bones.hpp a6c628c47586c0a0f7e34344f6522779 *inst/include/armadillo_bits/subview_cube_each_meat.hpp 9edacde1456146453ec20a154aa23d6d *inst/include/armadillo_bits/subview_cube_meat.hpp 50e3f3727481a19ca47d1db0fed6d2f1 *inst/include/armadillo_bits/subview_cube_slices_bones.hpp 4046f1e5dd83e0a785b9db9a57ce8f2d *inst/include/armadillo_bits/subview_cube_slices_meat.hpp f0e05a381ebaeb7307cf91cdf65b5d8e *inst/include/armadillo_bits/subview_each_bones.hpp 269396ba6ec7de777f9bfd5e648bbc3e *inst/include/armadillo_bits/subview_each_meat.hpp b5c681d35756e78fb48d588de0afabca *inst/include/armadillo_bits/subview_elem1_bones.hpp ee363d588bddfa09e0d2baed9953b363 *inst/include/armadillo_bits/subview_elem1_meat.hpp 190484f3fc5f2ab6f2500604e5997425 *inst/include/armadillo_bits/subview_elem2_bones.hpp 8894a0b6665eba33700f1712d5cac989 *inst/include/armadillo_bits/subview_elem2_meat.hpp 8de6da2ea0fc057807fc3ca00392a1c6 *inst/include/armadillo_bits/subview_field_bones.hpp e63189fac708d98f2c592778d0a013cd *inst/include/armadillo_bits/subview_field_meat.hpp 6e77b6d977be4511b22528f6bbfcf875 *inst/include/armadillo_bits/subview_meat.hpp cd22cacb2fed82999a6c26bd671e994a *inst/include/armadillo_bits/sym_helper.hpp 7905c9704c570710d1925f3dcb07c624 *inst/include/armadillo_bits/traits.hpp 1ebd50e9020507a43a257b9d9fdfd403 *inst/include/armadillo_bits/translate_arpack.hpp 11b823245a3a1e01803882e8a1408092 *inst/include/armadillo_bits/translate_atlas.hpp c989354b4c1057243513222ce798417b *inst/include/armadillo_bits/translate_blas.hpp ed85a3415bfa5c419307039b2dcdedd7 *inst/include/armadillo_bits/translate_fftw3.hpp 11289332ff86930e0de59eb4716138c7 *inst/include/armadillo_bits/translate_lapack.hpp 7cd2fa2f38c69a7299bb7275ef47baa2 *inst/include/armadillo_bits/translate_superlu.hpp b5bd96762bd4b99b8336b3cd81e4b07e *inst/include/armadillo_bits/trimat_helper.hpp cd86b60fe5464e0657673aba4d66c55e *inst/include/armadillo_bits/typedef_elem.hpp 8eaaf415ee254a51cd23d97d65ab0d8e *inst/include/armadillo_bits/typedef_elem_check.hpp eef45088caef7a830105fdf12ecd2510 *inst/include/armadillo_bits/typedef_mat.hpp 59204c3c874b7d3590199f5e6cfbc9b7 *inst/include/armadillo_bits/typedef_mat_fixed.hpp ad65886f42b55caeaf9a7cf5e85dfed0 *inst/include/armadillo_bits/unwrap.hpp 5f1d090378cfdaec8d7b8ccd15c11d29 *inst/include/armadillo_bits/unwrap_cube.hpp ad943dd25fa39399bd8d04523abddedd *inst/include/armadillo_bits/unwrap_spmat.hpp cb3edf0a9c3c1d6549cf4ecb0be6a4f5 *inst/include/armadillo_bits/upgrade_val.hpp 43a2d0fa4721131989b16834954667ee *inst/include/armadillo_bits/wall_clock_bones.hpp f5c106aa5cdaf6e0ff84a4f4ef3c68ac *inst/include/armadillo_bits/wall_clock_meat.hpp 6832cf55ed501cd77551b7ac351fc388 *inst/include/armadillo_bits/xtrans_mat_bones.hpp e63bc16dc2fbd57c2e6fca14953523ac *inst/include/armadillo_bits/xtrans_mat_meat.hpp 3c94c3aadbc81a91ac8a5edb33faac4b *inst/include/armadillo_bits/xvec_htrans_bones.hpp 6114157f136708e5a22e76b7cc52e340 *inst/include/armadillo_bits/xvec_htrans_meat.hpp e62585629948e7dd143efbad43c2a6eb *inst/skeleton/Makevars e62585629948e7dd143efbad43c2a6eb *inst/skeleton/Makevars.win 072214dfd360b239e67aa8a29c564ea1 *inst/skeleton/rcpparma_hello_world.Rd 6f35999ed6c5117a6c547833c636afd1 *inst/skeleton/rcpparma_hello_world.cpp 0ebc72e83cb36b1706239d400f4a292d *inst/tinytest/cpp/Rlapack.cpp d2e0be58ea75b3d0aa7089ef131848c3 *inst/tinytest/cpp/any_as_vec.cpp 1480cb2147d16df6c1e4187eea009b3e *inst/tinytest/cpp/armadillo.cpp ab3e35e3243da9f9f193bf3a4f5d83fb *inst/tinytest/cpp/colrow_as_vec.cpp 3da810d96e56cdaca0590f2ce46e4dea *inst/tinytest/cpp/complex.cpp 311bacd34f8b9f071223ce850b0237be *inst/tinytest/cpp/cube.cpp 565de9891c83fbf29b113955a5d82ebb *inst/tinytest/cpp/fields.cpp a4f17b00ae044a2a654adc4a62c508ee *inst/tinytest/cpp/fields_new.cpp c8672878a3ff0be51186f7d79ff28aa6 *inst/tinytest/cpp/rmultinom.cpp bffc543aba8aa98bb5a13d968ab16506 *inst/tinytest/cpp/rng.cpp a1ddd74a7c925a4d576d6e8227dfb546 *inst/tinytest/cpp/sample.cpp c04abcba0775a4e2cc925ceeca7c31e8 *inst/tinytest/cpp/sparse.cpp 28ee64876b5dc5bd01fc9c12c647492f *inst/tinytest/test_Rlapack.R eaf021e02df90cd9e2015e31f63f0ec5 *inst/tinytest/test_complex.R 95e0187aedf6b54553356b456c989e3b *inst/tinytest/test_cube.R eeb5f550d2f4a32d1b2ad49d6e09bbf2 *inst/tinytest/test_fastLm.R 65b6bebf8b4b28051f3435659d0097df *inst/tinytest/test_fields.R 2debd6c0cf861627798a306817aaa6ef *inst/tinytest/test_fields_new.R e775ad36e9a1c0b67afee3e39e5fc43b *inst/tinytest/test_misc.R 628a439ae16a9b311cccf2b1ad36b6a3 *inst/tinytest/test_rcpparmadillo.R 19842b532c4ba3ace953cd423c005214 *inst/tinytest/test_rmultinom.R 973976aad43c2a01c984f14880d84127 *inst/tinytest/test_rng.R 501cf848d1977214130193e353f68176 *inst/tinytest/test_sample.R 923d99eb5ee14fed21ec5b3f0dc8df76 *inst/tinytest/test_scipy2r.R 463d670f332aba2234dba497a8961466 *inst/tinytest/test_sparse.R 401c8d66027b041dc671f820a0d14c3d *inst/tinytest/test_sparseConversion.R 3d7cdee3d57b48d3882844db1cfe5370 *man/RcppArmadillo-package.Rd 5fb3c647aed044c291bc4938755d7599 *man/RcppArmadillo.package.skeleton.Rd c41a2fb537c4e9ed96f82c15b7a7382d *man/armadillo_get_number_of_omp_threads.Rd 1d7cd3261ff81c4b924b9133c3cf371a *man/armadillo_set_seed.Rd c4a623bb5a3fb6b51fae3b0fde22ed31 *man/armadillo_set_seed_random.Rd 974993fcda649cba3eca75a6131b8195 *man/armadillo_throttle_cores.Rd 53d212616758a15391c8ed8c0a3c8b04 *man/armadillo_version.Rd 3fcc434fdfa2c1fd1861e71c308481fe *man/fastLm.Rd 19266bffa767303c3456e3cf2f09bbcf *src/Makevars.in e688919f24bfb97e92017669d164d703 *src/Makevars.win 78d1fc377f80e785c1add57908954429 *src/RcppArmadillo.cpp ea9688ddd2a3a70aa55d667dabb8cc8a *src/RcppExports.cpp 07dcff882439077560a82ef8ef6e5d75 *src/fastLm.cpp 29f35f110171b2d41cc73c9ed1ec3dfc *tests/tinytest.R 36775614f3fdb06c07121a96332741e6 *vignettes/RcppArmadillo-intro.Rnw b7df93033cf8677a5bbd8870522ca9eb *vignettes/RcppArmadillo-sparseMatrix.Rnw 044ccafdf8dd529225c75f5ce4078517 *vignettes/pdf/RcppArmadillo-intro.pdf b68701a1b6b214ef7b24a8a304f53a1c *vignettes/pdf/RcppArmadillo-sparseMatrix.pdf RcppArmadillo/.aspell/0000755000176200001440000000000013143045426014343 5ustar liggesusersRcppArmadillo/.aspell/defaults.R0000644000176200001440000000024213143045426016273 0ustar liggesusersRd_files <- vignettes <- R_files <- description <- list(encoding = "UTF-8", language = "en", dictionaries = c("en_stats", "RcppArmadillo")) RcppArmadillo/.aspell/RcppArmadillo.rds0000644000176200001440000000014713143045426017610 0ustar liggesusers‹‹àb```b`fad`b2€˜…H3ûø@™œÁ‰y)©EÅùy0ÔÜ‚œÄ’Ô¨_Jjr~nA~qfIf~^1T”=?¯<±(Æå,éÞ²‡ÄyRcppArmadillo/R/0000755000176200001440000000000014753015652013214 5ustar liggesusersRcppArmadillo/R/RcppExports.R0000644000176200001440000000712214520330720015616 0ustar liggesusers# Generated by using Rcpp::compileAttributes() -> do not edit by hand # Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 #' Report the version of Armadillo #' #' @details The version is defined by Armadillo in the header \code{arma_version.hpp}. #' @param single A logical vector indicating whether a single return values is requested, #' or a named vector with three elements \code{major}, \code{minor} and \code{patch}. #' @return Depending on the value of \code{single}, either a single number describing #' the Armadillo version or a named vector with three elements \code{major}, \code{minor} #' and \code{patch}. #' @seealso Armadillo header file \code{arma_version.hpp}. armadillo_version <- function(single) { .Call(`_RcppArmadillo_armadillo_version`, single) } #' Set the Armadillo Random Number Generator to a random value #' #' @details #' Depending on whether RcppArmadillo was compiled for the C++98 standard #' (currently the default) or for C++11 (optional), two different RNGs may be used. #' This function resets either. For C++98, the R programming language's RNG is used. #' For C++11, the RNG included in the \code{} library is used only when #' \code{#define ARMA_USE_CXX11_RNG} is placed before \code{#include }. #' Otherwise, the R programming language's RNG will be used. #' @return The function is invoked for its side effect and has no return value. #' @note This has been found to not work as espected in \pkg{RStudio} #' as its code also uses the system RNG library. You may have to either #' not run within \pkg{RStudio} or change your code to use a different RNG such #' as the one from R. #' @seealso The R documentation on its RNGs all of which are accessible via \pkg{Rcpp}. armadillo_set_seed_random <- function() { invisible(.Call(`_RcppArmadillo_armadillo_set_seed_random`)) } #' Set the Armadillo Random Number Generator to the given value #' #' @param val The seed used to initialize Armadillo's random number generator. #' @details #' Depending on whether RcppArmadillo was compiled for the C++98 standard #' (currently the default) or for C++11 (optional), two different RNGs may be used. #' This function resets either. For C++98, the R programming language's RNG is used. #' For C++11, the RNG included in the \code{} library is used only when #' \code{#define ARMA_USE_CXX11_RNG} is placed before \code{#include }. #' Otherwise, the R programming language's RNG will be used. #' @return The function is invoked for its side effect and has no return value. #' @note This has been found to not work as espected in \pkg{RStudio} #' as its code also uses the system RNG library. You may have to either #' not run within \pkg{RStudio} or change your code to use a different RNG such #' as the one from R. #' @seealso The R documentation on its RNGs all of which are accessible via \pkg{Rcpp}. armadillo_set_seed <- function(val) { invisible(.Call(`_RcppArmadillo_armadillo_set_seed`, val)) } #' Report (or Set) Maximum Number of OpenMP Threads #' #' @param n Number of threads to be set #' @return For the getter, and on a system with OpenMP, the maximum #' number of threads that OpenMP may be using and on systems without it, #' one. The setter does not return a value. armadillo_get_number_of_omp_threads <- function() { .Call(`_RcppArmadillo_armadillo_get_number_of_omp_threads`) } #' @rdname armadillo_get_number_of_omp_threads armadillo_set_number_of_omp_threads <- function(n) { invisible(.Call(`_RcppArmadillo_armadillo_set_number_of_omp_threads`, n)) } fastLm_impl <- function(X, y) { .Call(`_RcppArmadillo_fastLm_impl`, X, y) } RcppArmadillo/R/flags.R0000644000176200001440000000167712253723621014441 0ustar liggesusers## Copyright (C) 2010 Dirk Eddelbuettel, Romain Francois and Douglas Bates ## ## This file is part of RcppArmadillo. ## ## RcppArmadillo is free software: you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by ## the Free Software Foundation, either version 2 of the License, or ## (at your option) any later version. ## ## RcppArmadillo is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with RcppArmadillo. If not, see . RcppArmadilloCxxFlags <- function(){ paste( '-I"', system.file( "include", package = "RcppArmadillo" ), '"', sep = "" ) } CxxFlags <- function(){ cat( RcppArmadilloCxxFlags() ) } RcppArmadillo/R/fastLm.R0000644000176200001440000000776114443051550014571 0ustar liggesusers## fastLm.R: Rcpp/Armadillo implementation of lm() ## ## Copyright (C) 2010 - 2021 Dirk Eddelbuettel, Romain Francois and Douglas Bates ## ## This file is part of RcppArmadillo. ## ## RcppArmadillo is free software: you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by ## the Free Software Foundation, either version 2 of the License, or ## (at your option) any later version. ## ## RcppArmadillo is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with RcppArmadillo. If not, see . fastLmPure <- function(X, y) { stopifnot(is.matrix(X), is.numeric(y), nrow(y)==nrow(X)) .Call(`_RcppArmadillo_fastLm_impl`, X, y) } fastLm <- function(X, ...) UseMethod("fastLm") fastLm.default <- function(X, y, ...) { X <- as.matrix(X) y <- as.numeric(y) res <- fastLmPure(X, y) res$coefficients <- as.vector(res$coefficient) names(res$coefficients) <- colnames(X) res$fitted.values <- as.vector(X %*% res$coefficients) res$residuals <- y - res$fitted.values res$call <- match.call() res$intercept <- any(apply(X, 2, function(x) all(x == x[1]))) class(res) <- "fastLm" res } print.fastLm <- function(x, ...) { cat("\nCall:\n") print(x$call) cat("\nCoefficients:\n") print(x$coefficients, digits=5) } summary.fastLm <- function(object, ...) { se <- object$stderr tval <- coef(object)/se TAB <- cbind(Estimate = coef(object), StdErr = se, t.value = tval, p.value = 2*pt(-abs(tval), df=object$df)) # why do I need this here? rownames(TAB) <- names(object$coefficients) colnames(TAB) <- c("Estimate", "StdErr", "t.value", "p.value") ## cf src/library/stats/R/lm.R and case with no weights and an intercept f <- object$fitted.values r <- object$residuals #mss <- sum((f - mean(f))^2) mss <- if (object$intercept) sum((f - mean(f))^2) else sum(f^2) rss <- sum(r^2) r.squared <- mss/(mss + rss) df.int <- if (object$intercept) 1L else 0L n <- length(f) rdf <- object$df adj.r.squared <- 1 - (1 - r.squared) * ((n - df.int)/rdf) res <- list(call=object$call, coefficients=TAB, r.squared=r.squared, adj.r.squared=adj.r.squared, sigma=sqrt(sum((object$residuals)^2)/rdf), df=object$df, residSum=summary(object$residuals, digits=5)[-4]) class(res) <- "summary.fastLm" res } print.summary.fastLm <- function(x, ...) { cat("\nCall:\n") print(x$call) cat("\nResiduals:\n") print(x$residSum) cat("\n") printCoefmat(x$coefficients, P.values=TRUE, has.Pvalue=TRUE) digits <- max(3, getOption("digits") - 3) cat("\nResidual standard error: ", formatC(x$sigma, digits=digits), " on ", formatC(x$df), " degrees of freedom\n", sep="") cat("Multiple R-squared: ", formatC(x$r.squared, digits=digits), ",\tAdjusted R-squared: ",formatC(x$adj.r.squared, digits=digits), "\n", sep="") invisible(x) } fastLm.formula <- function(formula, data=list(), ...) { mf <- model.frame(formula=formula, data=data) x <- model.matrix(attr(mf, "terms"), data=mf) y <- model.response(mf) res <- fastLm.default(x, y, ...) res$call <- match.call() res$formula <- formula res$intercept <- attr(attr(mf, "terms"), "intercept") res } predict.fastLm <- function(object, newdata=NULL, ...) { if (is.null(newdata)) { y <- fitted(object) } else { if (!is.null(object$formula)) { x <- model.matrix(object$formula, newdata) } else { x <- newdata # #nocov } y <- as.vector(x %*% coef(object)) } y } RcppArmadillo/R/SciPy2R.R0000644000176200001440000000441014056451471014570 0ustar liggesusers## .SciPy2R.R: Conversion of SciPy sparse matrix to R ## ## Copyright (C) 2017 - 2020 Binxiang Ni and Dirk Eddelbuettel ## ## This file is part of RcppArmadillo. ## ## RcppArmadillo is free software: you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by ## the Free Software Foundation, either version 2 of the License, or ## (at your option) any later version. ## ## RcppArmadillo is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with RcppArmadillo. If not, see . .SciPy2R <- function(spmat) { # #nocov start .Deprecated("This function is no longer needed as 'reticulate' now converts from 'scipy'.", package="reticulate") if (!requireNamespace("reticulate", quietly=TRUE)) { stop("You must install the 'reticulate' package (and have SciPy).", call.=FALSE) } type <- spmat$getformat() shape <- unlist(spmat$shape) data <- as.vector(reticulate::py_get_attr(spmat, "data")) # Since CSC Matrix from SciPy has been automatically converted to dgCMatrix, # the conversion for csc matrix is no longer needed. # if (type == "csc") { # indices <- as.vector(reticulate::py_get_attr(spmat, "indices")) # indptr <- as.vector(reticulate::py_get_attr(spmat, "indptr")) # res <- new("dgCMatrix", i = indices, p = indptr, x = data, Dim = shape) # } if (type == "coo") { row <- as.vector(reticulate::py_get_attr(spmat, "row")) col <- as.vector(reticulate::py_get_attr(spmat, "col")) res <- new("dgTMatrix", i = row, j = col, x = data, Dim = shape) } else if (type == "csr") { indices <- as.vector(reticulate::py_get_attr(spmat, "indices")) indptr <- as.vector(reticulate::py_get_attr(spmat, "indptr")) res <- new("dgRMatrix", j = indices, p = indptr, x = data, Dim = shape) } else { stop("Only CSC, COO and CSR matrices from SciPy are supported.", call.=FALSE) } return(res) } # #nocov end RcppArmadillo/R/init.R0000644000176200001440000000267214535115723014307 0ustar liggesusers## init.R: Startup ## ## Copyright (C) 2023 Dirk Eddelbuettel ## ## This file is part of RcppArmadillo. ## ## RcppArmadillo is free software: you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by ## the Free Software Foundation, either version 2 of the License, or ## (at your option) any later version. ## ## RcppArmadillo is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with RcppArmadillo. If not, see . .pkgenv <- new.env(parent=emptyenv()) .onLoad <- function(libname, pkgname) { .pkgenv[["omp_threads"]] <- armadillo_get_number_of_omp_threads() # #nocov } ##' Throttle (or Reset) (Rcpp)Armadillo to Two Cores ##' ##' Helper functions to throttle use of cores by RcppArmadillo-internal ##' code on systems with OpenMP. On package load, the initial value is ##' saved and used to reset the value. ##' @param n Integer value of desired cores, default is two armadillo_throttle_cores <- function(n = 2) { armadillo_set_number_of_omp_threads(n) } ##' @rdname armadillo_throttle_cores armadillo_reset_cores <- function() { n <- .pkgenv[["omp_threads"]] armadillo_set_number_of_omp_threads(n) } RcppArmadillo/R/inline.R0000644000176200001440000000244214614433434014615 0ustar liggesusers## Copyright (C) 2010 - 2024 Dirk Eddelbuettel, Romain Francois and Douglas Bates ## ## This file is part of RcppArmadillo. ## ## RcppArmadillo is free software: you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by ## the Free Software Foundation, either version 2 of the License, or ## (at your option) any later version. ## ## RcppArmadillo is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with RcppArmadillo. If not, see . inlineCxxPlugin <- function(...) { ismacos <- Sys.info()[["sysname"]] == "Darwin" openmpflag <- if (ismacos) "" else "$(SHLIB_OPENMP_CFLAGS)" plugin <- Rcpp::Rcpp.plugin.maker(include.before = "#include ", libs = paste(openmpflag, "$(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)"), package = "RcppArmadillo") settings <- plugin() settings$env$PKG_CPPFLAGS <- paste("-I../inst/include", openmpflag) settings } RcppArmadillo/R/RcppArmadillo.package.skeleton.R0000644000176200001440000001273114753015652021311 0ustar liggesusers## RcppArmadillo.package.skeleton.R: makes a skeleton for a package that wants to use RcppArmadillo ## ## Copyright (C) 2010 - 2025 Dirk Eddelbuettel, Romain Francois and Douglas Bates ## ## This file is part of RcppArmadillo. ## ## RcppArmadillo is free software: you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by ## the Free Software Foundation, either version 2 of the License, or ## (at your option) any later version. ## ## RcppArmadillo is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with RcppArmadillo. If not, see . RcppArmadillo.package.skeleton <- function(name = "anRpackage", list = character(), environment = .GlobalEnv, path = ".", force = FALSE, code_files = character(), example_code = TRUE, author = "Your Name", maintainer = if (missing(author)) "Your Name" else author, email = "your@email.com", githubuser = NA_character_, license = "GPL (>= 2)") { env <- parent.frame(1) # #nocov start if (! length(list)) { fake <- TRUE assign("Rcpp.fake.fun", function(){}, envir = env) } else { fake <- FALSE } haveKitten <- requireNamespace("pkgKitten", quietly=TRUE) skelFunUsed <- ifelse(haveKitten, pkgKitten::kitten, package.skeleton) skelFunName <- ifelse(haveKitten, "kitten", "package.skeleton") message("\nCalling ", skelFunName, " to create basic package.") ## first let the traditional version (or the kitten alternate) do its business call <- match.call() call[[1]] <- skelFunUsed if ("example_code" %in% names(call)){ call[["example_code"]] <- NULL # remove the example_code argument } if (! haveKitten) { # in the package.skeleton() case if (fake) { call[["list"]] <- "Rcpp.fake.fun" } } else { if (force) { call[["force"]] <- NULL } } tryCatch(eval(call, envir=env), error = function(e) { cat(paste(e, "\n")) # print error stop(paste("error while calling `", skelFunName, "`", sep="")) }) message("\nAdding RcppArmadillo settings") ## now pick things up root <- file.path(path, name) ## Add Rcpp to the DESCRIPTION DESCRIPTION <- file.path(root, "DESCRIPTION") if (file.exists(DESCRIPTION)) { splitname <- strsplit(author, " ")[[1]] x <- cbind(read.dcf(DESCRIPTION), "Imports" = sprintf("Rcpp (>= %s)", packageDescription("Rcpp")[["Version"]]), "LinkingTo" = "Rcpp, RcppArmadillo") write.dcf(x, file=DESCRIPTION) message(" >> added Imports: Rcpp") message(" >> added LinkingTo: Rcpp, RcppArmadillo") } ## add a useDynLib to NAMESPACE, NAMESPACE <- file.path( root, "NAMESPACE") lines <- readLines( NAMESPACE ) ## remove *.fake.fun and set exportPattern (will also be in Rcpp 1.0.5) lines <- lines[!grepl("^export.*fake\\.fun", lines)] if (!any(grepl("^exportPattern", lines))) { lines <- c(lines, "exportPattern(\"^[[:alpha:]]+\")") } if (!any(grepl("useDynLib", lines))) { lines <- c(sprintf("useDynLib(%s, .registration=TRUE)", name), "importFrom(Rcpp, evalCpp)", ## ensures Rcpp instantiation lines) writeLines(lines, con = NAMESPACE) message( " >> added useDynLib and importFrom directives to NAMESPACE") } ## lay things out in the src directory src <- file.path(root, "src") if (!file.exists(src)) { dir.create(src) } man <- file.path(root, "man") if (!file.exists(man)) { dir.create(man) } skeleton <- system.file("skeleton", package="RcppArmadillo") Makevars <- file.path(src, "Makevars") if (!file.exists(Makevars)) { file.copy(file.path(skeleton, "Makevars"), Makevars) message(" >> added Makevars file with Rcpp settings") } Makevars.win <- file.path(src, "Makevars.win") if (! file.exists(Makevars.win)) { file.copy(file.path(skeleton, "Makevars.win"), Makevars.win) message(" >> added Makevars.win file with RcppArmadillo settings") } if (example_code) { file.copy(file.path(skeleton, "rcpparma_hello_world.cpp"), src) message(" >> added example src file using armadillo classes") file.copy(file.path(skeleton, "rcpparma_hello_world.Rd"), man) message(" >> added example Rd file for using armadillo classes") Rcpp::compileAttributes(root) message(" >> invoked Rcpp::compileAttributes to create wrappers") } if (fake) { rm("Rcpp.fake.fun", envir=env) unlink(file.path(root, "R" , "Rcpp.fake.fun.R")) unlink(file.path(root, "man", "Rcpp.fake.fun.Rd")) } invisible(NULL) # #nocov end } RcppArmadillo/cleanup0000755000176200001440000000146415031230430014354 0ustar liggesusers#!/bin/sh rm -f config.log config.status confdefs.h \ src/*.o src/*.so src/symbols.rds \ vignettes/RcppArmadillo-unitTests.out \ vignettes/RcppArmadillo-unitTests.aux \ vignettes/RcppArmadillo-unitTests.log \ vignettes/RcppArmadillo-intro.out \ vignettes/RcppArmadillo*.log \ vignettes/RcppArmadillo*.aux \ vignettes/RcppArmadillo*.out \ vignettes/RcppArmadillo*.tex \ vignettes/RcppArmadillo-*.pdf \ vignettes/*.blg \ vignettes/*.bbl \ vignettes/*.xwm \ vignettes/*~ \ */*~ *~ \ inst/include/RcppArmadilloLapack.h \ inst/include/RcppArmadillo/config/RcppArmadilloConfigGenerated.h \ src/Makevars \ vignettes/jss.bst vignettes/pinp.cls rm -rf autom4te.cache/ \ vignettes/auto/ RcppArmadillo/vignettes/0000755000176200001440000000000015031230427015010 5ustar liggesusersRcppArmadillo/vignettes/RcppArmadillo-sparseMatrix.Rnw0000644000176200001440000000051013620530500022702 0ustar liggesusers\documentclass{article} \usepackage{pdfpages} %\VignetteIndexEntry{RcppArmadillo-sparseMatrix} %\VignetteKeywords{R, C++, Armadillo, linear algebra, sparse matrix} %\VignettePackage{RcppArmadillo} %\VignetteEncoding{UTF-8} \begin{document} \includepdf[pages=-, fitpaper=true]{pdf/RcppArmadillo-sparseMatrix.pdf} \end{document} RcppArmadillo/vignettes/RcppArmadillo-intro.Rnw0000644000176200001440000000050113620530500021353 0ustar liggesusers\documentclass{article} \usepackage{pdfpages} %\VignetteIndexEntry{RcppArmadillo-introduction} %\VignetteKeywords{R, C++, Armadillo, linear algebra, kalman filter} %\VignettePackage{RcppArmadillo} %\VignetteEncoding{UTF-8} \begin{document} \includepdf[pages=-, fitpaper=true]{pdf/RcppArmadillo-intro.pdf} \end{document} RcppArmadillo/vignettes/pdf/0000755000176200001440000000000013620530500015556 5ustar liggesusersRcppArmadillo/vignettes/pdf/RcppArmadillo-intro.pdf0000644000176200001440000106456513620530500022154 0ustar liggesusers%PDF-1.5 %¿÷¢þ 1 0 obj << /Type /ObjStm /Length 4277 /Filter /FlateDecode /N 76 /First 625 >> stream xœå[[sÛ8²~?¿o;SS!î ¹µ;[vœ«ãı=I&[S[ŠEۜȒG¢bgý~ /’Lk¼çᜲ)‚4}oP1Á4s13LÙ„Y¦Sdz‰a1sʲ„Å2a)K¥aRàß)&%“ÊXüàý¥f2)C¥R]âÁ„‡³ï7ãOÑ2»d?ÿì‡Ø[W³9ûáG´Ì³Q‘Ϧ£"c?üU %„¶(á¤~"Ü_„øKÕÞy3:Ë>±Û¼¸bW{>Ï.Ð|˜}¿ÍÇ ?æÑl|ßpÇóÙxyža¼ÇoØ‹«Ù¢XœÏó›‚¥‘ŠÑátùå÷ì¼ðãåÅ$£R þÓÙrZ¿ðÃSþŒGkŦÐ-`E žÂ-õ¿Ö•máôäïØÜPžBc•&<þV¡2`·Bät:+fU¡³#iY½út6-²)zÊìâ8íÏîð.uv’¸MQßãÑ]«ý;ɳåüSÒ|Ïá6 àñç|Vîü|v~š“<ÄÙ]!þ¹ |‹CäóEå‡x3B9 㕲EQ#™úõ3qRƒÊ•–QÖž.'ý-Í—ˆŠ ý:JÐÊ=|÷-›˳Û{4a|ú›NZÞ’5ˆŒ ‘i‘P;a²*y ¬ieí0Õxu¡. Ë­Ãdú8@C7Q©Ô`ïŠfóëÑríøˆIt:dÅ|™U½WóU¯Œ™Ÿ‘|qp°wôÓÓ£°26=Ÿóé% ÖÑùÓ«ÑœT°”í…äšÔ+ú}?I¡ÂÏJsË „r¶|\\yé“@ãb“èJ´öÈ»ÿÏŠUYAÀë$ñ´0ž| Æ¢;õz©òÝÕØ1TT, ë±ž˜TøÓAcƤWЦ¡ì,VO³’É’B“ùwèÙór MOkó#Ø0")ð5K©ÁEwCz¸¼“}QÕû¥Ñ³  Ê<úÊvª×©$#Ç#¤ª£ééNù[Mê‹s¢N Šîæe–_^UØI¢½øßçOùÆŸóü%Å_óCþ†ñ·ü?æ'ü”Ÿñ_øþ‘ø~ÎÏg“Ù¿××#>æ÷Ãò ~Aÿ9÷ÿß2~1á`~ɯ8âU6å9ÿå~ͧ| ÍÌg|†ß~C|4É.ŠPšû¡CóÙ˜ßL– þÿc9+²ñ—‰ïU=„ŽþiU*ç|ÁÙu ]dß0ÿ"¿ã‹ÉhqÅ ^\ͳŒ·3¾äßø-¿ãßù¿ù¿³ùìG/Ù=êž(BÖóÉè’ìOßûA<ç[!SÓßBûó|’i2OV,ÿvtu™ðìŽü|oz áÇ£|±KzÖñÎO‹ìúYIMæjðeÉ?¿þxü‘Æ<nœîMùªbÅíÆô¹Ýv¸Z`³Ã˜l2±KëkÛ?üÆvš¸,îѼƒèiÐ|x¬i¾¢c¢`O£514÷^¦¦Ú{©¥m¡¹44zg÷?ì~kwn~oØ{þ©\—UÐ#„ÏŽŽ~}©Î^%C)Aô)¡a÷”r_$8þ¢MÒª"ò^ªK4~C©û§$m!‰¡˜o–Æ¥05Þ8Mù—ªì™†øów¸zNhÿfì ÀµÄC¾œJºª2ÁZ=S9À® &’ùB7à5дF »^¤µDÀÓ}"˜Lô¾~áK¢7Þ÷µèm’+ Ü‹•`%‰äéVQ„a%‹Zìy¡·YäÁqhÉÕ}ïYõ}¦Á±2-kÊmrŽÌc¢1F·®=’hÍ´®´‚U¯uó>Dü™k­¶ßûVm:z45 „E‡ó^‚×*N£°Ö'Ïk_Fç_E™£˜ž Êr`„5ìøÇr4iºckxðAìW½Uxk n`ÀåtœÍç³y¶Ɉ¼hÛ¼hC£5v S©ªšÛ¼ÒåÅÑ]cKÚœI5¥þÜßZçìíùÀú)dÀɫ굽sBY¨úáª(nþÊùíím4ξä£i4›_þèCêû³9PS†ð½”yê$#’â'”S£tUQNÚ&q¤À¼:q‘%Ç?Å]z¢fç7ùôk e æø.Ïr‘KI!ÿ=:_ŒG<  a½K¢ÄgÊ]DšM‹(¥L­Ãb¤~\à Ç¿ƒî§£É"Ê&Ð y6ÀÄ7ËÂ'OG“' *¬ÏOFÓñJТ0š|_ä þÅi£#—¤ÕâLœDÆ'‚ÿ/,NjÅ”ú6qDg`FIâ×JaþA‹[%®Ü#eÛLÃ=¦hñi«Z¯Ÿ¿ûüþ§yq7êèžPЦ£`ÝP?×éû}Yá{uõ y  kT ð†„Û<ŠÅ?LG¼6ò­A¼¶P¶ÍÒ‘¢álŠžõãÄŽßÿTÜ-¾7 Êàª÷¡Ö®³ úA»@¿&îkr«ZVsx\í¤ _¯GſΧP™×ËI‘ßLZº]of j±‰ð£¶‹.â[˜ŒøMÑú~¦fÿpïÃþOoóë/ËÅÉìúí,}óä$»\ÒT™Ãõ£@:éYŸƒ¹£òÍÝúhPUï½4‘±þ¼F(Ó/=‡º^̧•ÏM6´­Z(…¹.ÙM鸤ïS½õvÝ™·ê~åŸa¤å0½ ²ƒÚA·)ÄÛÐLÙ„~^'îçu¶ïå6âñ.Q韈t§°Îëã£7Çëfß=ïcD‡Šàî %Âu×43¿ªé‡\;üÓ2Ú½ý¼Îzöqa˜½]ûVÆñÖµ“é@ótö·—ÂØ‚á{Îà>{¶ÿúãG’÷×yS"WZ¸Þ6›ô·Mu·mhâ–@U¶¿)R¨æ¦„ÇzS‚ü—îM3WÑW÷h—©õÃupߋŷñ1T«M¬T.ïDÒIÖ8Çu¢èœdi A Ȥ*ûä¡l‰¸«2EÁªrL=Ë2@-ËÎðl̲Þ”ÕCy˜¬œºy˜Ì ÄÔ‡É*“1€)œ5EÏ%\¶¦£4n˜Í8 ¨´”iDøP*µ‘>œQ‘¶’i81>eu¼?"Lå¡Äö±;Zz,»@éØD‰Ïq‰ˆ"ëDF‰I¤Œ”h]¯ØôäÃÉÞÁ3ïõOÚ¬´ýD£,¢£Ë.QþöÔðÚ¾bãóê­uuÍ9šoöïƒs{ûæÚæû÷„„T;¹ tßp @ì¡?óDa! Uæ&ņæ£ó¬Ž•ñ˜ÂD—ü’ góUœˆ¢D“l±¨O÷†‰Úq ¢óY›Ñ'‘Xš;ºsŠ)´ÒÁë~À'î%­:¤¿1âCoG|Ь9;øøòø½'š´iÖT¶Ö¶ˆºíŸ>}ˆÜ.‚ûê‹Ó¾PÞ\ÓiÝXCëvúð5í `m_ÀR®ëeyºi•å" ¢ön1šŽOèŽg“Éh^gÌê@}#cVËâ ÒxPòŒ°±á ê®9´?ÂwU_­“è½lZ›9wèCBøjë{w‹›Ÿ‡—4g©ý—ŸG”$”GüËÓº­Óÿñ#}GÑ< ÊÜNgÿÄÕ4Þ 6ð}ë•Dðz®ƒ3‘£S㩉(›9ô1—p‘ucé;@UšéžŠK\Ïwp.¢ó“%P*Ö>ó  à§@âílþuáû7þë¼?*&£/O ¥ ÆÙõl]ד\€…þ¾êæ[øâ*¿¹SðÐÝÿRË¿¾Ž&×£é¿ðd€àAé÷s¤í¢”NšVÉí":uúÿ UjDÚÈÐ7Ÿp-¥¶7ñ@TÜ#u}»XI ÇT-úX4”!ÂTIË'ô]K #Uÿ”>ÎŒ›Ó4ÄÉ#ådš'ÉXu†éAâä>d$ô…mëý aP·lE7TÑg¬=%#i,«ŽŒ 9LMßÐèH‹G $<(ee¤%•'Ee“H¥P;‰‰ÔPZU3æÛ(!­—¦‘NºPAPJEßE²JD$RÿÑTDQµa¢Òe6¤ŒtËò‹M¹î“Íø±¾ÓÍ<£ÔÛ‰šz¾€•e6ðÏ(͵Q$(Í´Ú¢x›¥/ÏDiâmôé‰R"¢ƒŸÿe¥©À¦»ùÂFÄ + 4%„#”¨Ej3<²µÅ¡>È/.2l#íÛ?ÉÚj¶«¯ëþ» Jñì`D³`Á?Ò¸”ª½¸À•ãšP9÷Nfëó±î’@¹­Íè#âÕɸG‚ì¿‚FXì>/ʰ‚*5ÊZyÓÇÇky÷ãê?»ÙËendstream endobj 78 0 obj << /Subtype /XML /Type /Metadata /Length 1549 >> stream GPL Ghostscript 9.27 2020-02-10T22:06:13-06:00 2020-02-10T22:06:13-06:00 LaTeX with hyperref endstream endobj 79 0 obj << /Type /ObjStm /Length 4564 /Filter /FlateDecode /N 76 /First 675 >> stream xœÅ›]sÛ8²†ïϯÀålm I yjÏV9N2ñ&™ÉÊ™ÌÇ©\hd&ÖŽ,y$9“ì¯ß~A²I‰òXÎ8µå²EѾÝhÀea SZc‹`Jg\”2T–¦dã­\ó&7¥œ÷dÊh*®Œ\¶TH±2Öã\alä`*yPÉTò$\¯È8_UòãJùSyCÖËýA>£7U4DN>KCåze(8k 9`˜e EƒU8€yr£-ØP oØR™ÚÀÖ9ˆ†±”†›çTÆb¹•&yç匵ƳÔc­3Þ{ñÑá@š^FHã‹t&˜`Ó™(h¾-Mp¬L`'gä¾ÀÒ ÖY¼n“¹n¥I!ÀÇ&D‹{äÉ189&¾M¤àå 4‘¥ë*9Ñ®6Ñ“œ‘ŽˆA†Â’3±$DÜÃ&bh,áNzÚâºci§Åw]H£†š*S÷ºRÚľåN÷:9Ü›ÎîHçw¤sçÓ¹€óSÉá¨ÄQº»ÂyÔ‰þå -Gßû"ÈÝÞá7È!KŽ"îc”0†Þ£Dáþö7“?®7[óÿ¦X'&ÿñ§ŸÑòLúBÆÇf2²fy³X˜·&ÿ¶þ¸ÉéÆWÓu½ÜšÐ–Öõ›ã×óí¢6_¬¯¦óÅbõó÷¿§šN–ËÕv#u/Ü*Ï<]-·òœ±eÑ|ýe}1Ÿ>Z}”ûp&CQ «U6ßÍ'õfu³žÕƒg?ù¸ýæ|;ÝÖ‰ÙtÃSyt·µp5;¯ÑÒüÕã§b%óVL“ÃO×5žþ¾î,íúÄŽ;ÅÇ2Cïv ÝÚ)]³Ú^™Ì®¯Ç=ÓÖW«ã¢ÊBؾ½:·SÝóéâjº4Oç‹m½ž/ß›'§W׋z¿f[Œ«vÁg6Ú½ªÃíUÓNÕO®®çëùlº0ç×u}aNWW×Óõ|³Z‚›úñ–4Ÿ®ý¤ö“ÛOß~†Ùˆã .ÿ@þ@·r™•Uß­‡z’wzRš8[Ül惞{4ÝÔɼüÕO§“Óó¿ž¾œH;ó'ËÙêãœÿ0_ž,7óþÄÓùz³=½œ®tjj›9[ϯ·«5¼NªñÅ´½Ú›Ÿßü²MMCm×ΦÞæÛKŒ] èwr!õö¡íN9Ú‹¸w¦­îÞðD8?úañR"eÒ&¯ŸN\Xw¾«Ÿ¥mïi¯‰Õéílþ6½U673 K‡•ŸN¯ŸÕó÷—]Q:$|•Ÿä§ù³üEþ*ŸäÓü—|–ÏV‹Õ2¿Èëü]þ>¿Ì/?]_ÖË|ž/ò«|™¯òëüZÆ2_çÛü÷¿$PR=_;‘­üébú~#}Ùtò£ât1ŠÇGõo›‹òJ×"íÝûŽSßN¯ê} ζÓÅ|v²|/ ònÌ7¡! žxm9s¾­¯Þ$Ÿ;ÞùmÓY|ʈ¾Ÿ>yúü…Töú,IŸ&ûuTÅ}Õ±ð Y¼ˆ~÷‡.ˆ£ ]SÔ¡KÃ5‘À¶ÿ%€‡Ú¹~Ècö†€ö‡`·WŽÞ»F@Ôq4/žü4yüLê:{ýM8NÂx Üg+€}é÷ÐûyÛùÏýéë ëÚ=7üÛ|Ža‘?ùÐ ‹ÛC‡Gèè{Ž·|Þ½ÚâdWòroÓÍåè—ð³E¬{ ¯¸\ ò森=¾xŸ¯ý1ö5êåôã !»ÄáLKßIœD·#â¾üÍùëHí~,ä-Œ=NÅ#Þâ±¼Ex«Ê¹4šÅ;©¹•¦*q!âÄø€Q㉈ ý´˜§à„!9 ù¼øÏqfä6dŽ2t©8p¢Yë&†¾á· ÄÑ!ÁçfG 0^·y\¬ª"Õ´‡Ï nðÙÀc=á!|× LÍšx¬;#}X¶ÕÄavÖc2ÓÌ{Ûc™²´AÑDfi•íŽå»ew,“ߢ;ÆuÏ$„Yí1‘îX&ÏahÕ£Õú¢^·‘b‘âI„£]áaܤžáVvœy™ÿÉL6ƒ^3ÉJf¿ÁU™´èíñóå¯]—¦HøžF lªd’P¥Iaæ¢Û·É—aÎÇ¥ÏʈÀ¾Ê0抳XòqFÑÁ(îŒÊ½ŸOdZJÝy Åá“1}{ÿŸŸ⤔è¸LŸp¹ÓRoÈZOdâßN3î‡À¡ùiÁÒ{ ³Y%µ#Ÿyä†\™!uÄ!‹ÖQúÆå‘LßuL ï¼Óhu1ÿ<›<ú(Ôù‹½¨7©Î…üH’œÚó.béñÑÌ~İmŽ9Ç=·?o÷h|ßîó?ahÇþïíW_Ù={¿ÉÑþ¼èI~–¿L3£×ù›üDMëéì×Z¦´ï¶ÝñßNÓ¦««iò‡õo7ÓE;yšç¿¶¾qysõK½ÞÌßÃM®–ukÁ®.æJ³ªßnVÈsà™Ýþ¾ÊoòùÇüSþïüßõzµUGÝÇdÂÕ\ ˆúÇÙ AиÔ°û^õ¨€ Ë;çnœ=i³7¶}9‘mm>Û¬‰mÞ™ÝlIù@ÊÚ9éFYmü e=Ní|8à…+Ï÷ÕÎÆ*C¦ÓEŸò¡eÈD„]3÷°^Øvò·“8¥˜ÑÈ(ö!c™Wº@Ë×X> îXŒt‘޳j0èåA­jP«á v¾ì ê=úÏú˜ìó.+iX>ËÞ”þÈ0æ8«0ÊŬä‘cu,£Xš2#Q ç A¯Jʹÿ–U¥XƒµÖ** ?Ãý¬ºÃßïè÷ò÷ùD^Y[ìÄ|GâRꄳ£¨—¤ œÌ†;™ÙUHg{«êí\îx]º£ÏVðº‰Ä À³Çx2åq)…àÅExß%®û£Û~BøãTCŸ¼>¦§cB=¬É ®Md”išÐ]#¢twciÑ~¿£\¢˜A®!5{"ár uþnþ¡–ê_P]Í—-µ‘”æ¬$^JqÒ~”d5mµ›ýZ.¤«XmEµ»QR—Õí£¤ñ°ÿQò-×ôôm©ª¶+ÎZb;rÏåöõt¹¹†»›}ê¾üÍzus}ôëpOüýÖÃV­)Ãâ8»"+°~^rFë‡+”\eE¤ƒ´N"Î}o-ÑCèЬ*ñYeKØ02é^K]gBá|ûiܳª­i5¾›c7+òj¦uw×i%c…ÜUZŠi¹G§±:¯¹¦´BßeÆ'i•^³i¥¾êë*¯%yr´TbddªÎ¢´z_UZ²Æ…–D µÅK[¨-)µEfÅ®P[ùj‹´Òj‹—R¨-¨¸Bm "7…ÚÄ«¶È+î¬Ú"¡ˆSï%˜”Ô– ¶hFÏ"ç`Õ©§C â¬Ú"p9õ|Øâ¬ÚÅͨØÑT[$tvšù³QléYïz"R„j‹8Q§ù(‹@Ü©-òö8¥[œRƒufGj vöÚ"ÎØ‘ÚG£¹$b©-eÊÅhIl!µEæfN}=‚zGj‹¨ª#µEHu¬¶`o«-Ø!ÄjKJö¨-BªcµEHu¬¶©ŽÕ– !ˆÚ"¤:<@ªcÍ× ©N#н@] »•4ÚÁ$È“–ÒkXHu]ŽgR]7Tç5‡\ ØV[„TçÕ!»_ºj‹*S-¥ ™–Ä– ¶©.¨-Bª jKšx¨-Bª j‹ê‚Ú"¤º¨¶ÀáGµÅa…ZmqLÔ!ÕEµÅ¥Ù¬–bÚOÖ•0‰ìsëU4¤!„P[„TWª-Bª+Õ–4AV[Â,Õ¬ª—j Rí¥Ú"¤ºRmAÈÚçù…TWª-BªëóûBª«Ô$‡UwAª«úÆD_KXáW[„T§º Rê.Huª» Õ©î‚T§º RIu¤’ê.H%Õ]Jª» •TwA*©î‚TRÝ©¤º RIu¤’ê.H%Õ]Jª» •úYƒJª» •+)ب¶©¤º RIu¤’ê.H%Õ]Jª» •TwA*©î‚TRÝ©¤º RIu¤’ê.H%Õ]Jª» •\¿$¶¨î‚TRÝ©DýlŠSøÜ•ÄÕ]Jª» •TwA*©î‚TRÝ©¤º RIu¤’ê.H%Õ]Jª» •TwA*©î‚TRÝu;M-‰-ª» •TwA*©î‚TRÝ©¤º RIu¤’ê.H%Õ]J¾_}[TwA*©î‚TRÝ©¤º RIu¤’ê.H%Õ]Jª» •TwA*©î‚TRÝ©¤º RIu¤’ê.H%Õ]J±_¸`ì„Õ’oW›’Ø¢º R)ö3u±Eu7¥YTwA*©î‚TRÝ©¤º RIu¤’ê.H%Õ]Jª» •TwA*©î‚T*ûÕ(ìqR[¹µEH¥~mUH%Õ]Jª» •TwA*©î‚TRÝ©¤º RIu¤’ê.HeÕ]ʪ» •UwA*«î‚TVÝ©¬º RYu¤²ê.HeÕ]ʪ» •UwA*«î‚TTVÝ©¬º RYu¤rŸÙÁ~NÕ]Ê}¦GHeÕ]Êýʶʪ» •û•n!•UwA*«î‚TVÝ©¬º RYu¤²ë³Nb‹ê.HeÕ]ʪ» •UwA*«î‚TVÝ©¬º R™úäa™všt%±Eu¤²ê.HeÕ]ʪ» •UwA*«î‚TVÝ©¬º RYu¤²ê.HeÕ]ʪ» •UwA*«î‚TVÝ©¬º RYu¤²ê.HeÕ]ʪ» •UwA*«î‚TVÝmÔ!•UwA*«î‚TVÝ©¬º RYu¤²ê.HeÕ]ʪ» •UwA*«î‚TVÝ©¬º RYu¤²ê.HeÕ]ʪ» •UwA*«î‚TVÝ©¬º RYu¤²ê.HeÕ]ʪ» •UwA*«î‚TVÝ©¬º›vƒ¨î‚TVÝ©¬º R¹ß5!¤²ê.HeÕ]ʪ» •UwA*W}æCl©ú̇kS‘ƒÌGúÿ…~†qx‡Î­»l{;>cÁÿÍɳ7¯¥-IÕ‘{ÊâxO™íDd°©¬<2+ÜHÀîO™†¹LòzKV7-(Ä´ˆ›>ÙµWš0¶ù¬ä9éjeÓ'ÎãÕÂ+‹rpwï^•G ²ºgiY½ÙrŒUóá²´q,ÿp¿­c"%£­¾óÅ}wwœŽÞ:v÷ÖV‘Çñ.ÉËo¾ÿ'v2ËÄ}­¶s&‘L4“\lßÚÿŸ³[BœK¯à |ÇšÃøÉMÍg‰õ‹Øp˜˜‚BX_Uv$ú݉;»¡Oó§ùó´‰=]Îß­nÖ Õr¾¬ûMÝbÁ¦þP/óÍü#¶Y\®ë:m¶Ø_<¸“<¬zÀ˜=òFÛÚw`8‹ÕÀ*GY!·} «î±¸¤o$2ðÖfùüÒ>5,ŽÜ öðûHĪRbá1C.Ć˜¾±ó¨ÿÒâ¾Xe–rÌ‘¥¯0_©d$ÜHòà\¥.ôjvÀ¯}£v¶ã '•8lŠÑv\WRæ]JJd˜Ä¹ªÈ>É+CRú‹n}„D¹-õ%Ÿþ]t?\íñiC'ÛN,†{}|7þÓ{}ü@kÓÿ‹¦Ò—ØëÓÍv–]™E™í¿yUƒM·Ú>C´H0¹¨y’šznòï'gzà ûë›S_]n·×ÿ›ç³õt™­¿¾^¯þ%µg«õûüz:ûUø£ÿ×¼­±…4×î­øG[+†#i8k–EBì‘Òq×¶‘a`>¤ðÎ }kýA`õxþî]ô:EÈ1¤°½]‹ínýœçI`6ذyø¡ÿÿAñTendstream endobj 156 0 obj << /Filter /FlateDecode /Length 6465 >> stream xœ½\Ér$Éq½Ãôe:U©»rb_¤ƒ \D-cäL” K ˆzù{úá‘•‰iŒÌd=f“ÈŠŒÅÃýùsåo+5è•Âåÿ÷'ß}Ðyu}8Q«ë“¿húuUþwq¿úÕ”0ðÆ Ö³:ûxŸê•QipÚ¯‚ƒ±~uvòçõ‡œ ÑøõÅf íä¬UZ?â³RÙühe´ŠëÓ§ –2Véõ=—Òþ‹ëþ”Š&­/é­³6n}ËÅœóÙÚõÝ+í±7Z'»þçÍÖY;äœ×§Ô1£TÒ]¯ÚëRKH*j ?¨!¦˜¡é'ü!æœl€þ©Áf—´]?Ó”‡ÚûÎ=ˆ‘^o¶ÖøÁgR‚BPZ™ð¿gÿy]LöqµÕqȤ| ¢ü\ú–}­µÈšK9º´¾áJsë/…LôÑ{hnûèÄËX¨T§õ`0ÁðЋx>"Lâúc“Èž›Œ¥ vyÂä„]4^a¶µþµhô]“å;.áS\oÆž¿"VÙwžíTÆ™BÁÄ~7L~™Z_Ÿsɇ8™æn®ÀÌ*ðI@c€:oõʃœ¢²8sk½9ûËÉÖ7»ÚZ?À¼YžÓß ìTLÐÞ-M¢Ùrs!'Ãÿ+ôÛš!é¸þ-Ž&EYýA²IRÞ•Yƒ¹tõk Ïëg/í3¨‡IK‰µGœ ñØWÏIikc²[…!G›pÈ1¡¹›•‚ª(+K LF§)¹ÔŠn»oÞóPcbUEË.®÷›Ú)˜Ý%`‘¬CÜ=LECÊÑ ¾šä ÎA¼Þ·/g™üLìÇH:§\ƾSMÐe‘”sÔ¦Ô@rŒ4ö­ö „ Æm@Ø^ˆ ¬ÍØxZ郱¸´²tô ››îX0'i62àœçÊø@AV`®£)ZP§Mvp€?àk­¢™{€ô˜v+û¶ThÚð€JF2ßÒ*Œ3&Ë`»Ã!üöìäÇv OËžÄ*1ÌêH²2˜P…I‰ýÈÍFƒ¬•òÐäñÓc}\×Qþ­¿«ï¾«ï>×wsOC-wYß]Õ§óút[Ÿvõéa¦–}}÷TŸ®7B8¯xX©1ÍÁêÁF Ìž,˜sžB˜ð8£9vˆ~¢6¿Ç)Ctëÿ Os¶Ê²Å© Š(x¶I0ðuëÓZ39€_#µæ¬K  ë_1”av^{·þÂë×Aè•"g¤@uM+«DÒ82n¯àPÝèmÐä ÈÿÄõ ê#“» þÉ£J‹ÎÿˆF NÎY•´S:jÌÚÍw)Ô>ÇV@Ô|ŠîÓãÓËdÒBžÐ‚ÀÅâ—¨ÂV –ŸlR>@Ya°sâГÁo¡Å¨U橽x«.Ha¼\!€[†p›žÝ6Àx‚<¨]ßiKטºÒ—,OŸÜúOU‰„ÆÉ©úD3èÁH({§ÆÁÙÌR2*[Ò‡ZâkÓ¡ÛüV'$:²alÃÛ†Ó.¿fdÙ½m‡„×fj„¦ÀåÓê3€êïN§ !­¼µHáV÷'.FTßÜüqÙ%I¢2B/T9D¬R[¤ ½§ÅÜBHÌ’µØÕÅ<@¢<+(Ì ñ‰Š îø‚çÊ€s…f¸…|röOf­)Ôè¦ã~Æd Là£Öžz´[)ԎľãçL®Œ4ˆ¹)…S Y´ôBŒww‡­€=éŽ[=lL„"зO€Þ2{N)I¾ ±#Pàž ï’²ãê`„déÔ\&ŠW¿»ä±b u×:*K\ Ò»»¾âjlFáµ÷~ –ÔZpdÑ?ÁåkjP8²ÔçÆð©¾d ¢ß» áˆêÊYàa„WÐm#“yŸ#â `ûP %êÄô¶ˆò™ìÖê4€vK B ÁOÄÞÄ'úS{**¦xu¬v«7xW¼ËG*ï" %F_ÁƒP¬T¨D›L§pBJv? MßC_M¯žM?¡¶"mÔ ÇÔg©¦¥¤MK1ÓþñmºiƒÝôëýGnÚ§ÜØc†úÜ©„ÆRñ©–"h€Ô*„¼»;aa×{šUê¯øV(T›G14Ù<w´hÛh,ÊD ¤#. íŽËF$â»6rä;,Œ ôgÙƒó·ÊZêþ⨥—BÓ¯šÜ »½à1k  øP[fÚ½+f=õº_@±Øšëlvš^¨~c`²wwB©x66J€Ø=—°Ðrdf4fU:„Ðü\ÌÍG uH>Ò,a÷œò2pGÀ…ë° €Ðá°*iuú”ä…R<’_‡Q«œþ{vÑš\PëÔ°Iíôñ”Dž²ÐÌÝ8RŠèÇß{ì@OcìRÒB€écCl~›uˆR$ÏLÖtâä^PÀÐaSÃ!“æQ¡2Ji€fF¨s”FIx±ïš¦"@sƬ^P.Nª ´ø…°o7ÍHÇ>u.QÀ}eMhe %Ã!nš=é–„U‚sR-h¶˜xº€™~&èmPlÔð@„2§¬]ŠK³Ò»‡ª©„ÚjP`™Ì!øß’ɱÌêa+ÀõT™¸ªá͵S÷Y¼Ï( ~ñk‡ ã¸huí;shõò@BÔq ö¢B¡{~ “"q"IÉqŸ|ŠÚÄìˆQI?õ… µë}|Ç$t8“Ðë³°Õ#@­3ý2G DïœÔ7FaniÂ<’àÛë½TQFS—:¿?ñaEÝÑëxLŽÄéÄzÌ,ÔpÅ¿;ÄЪ0BÔú;0Y<ÒR{›DrvT_qoÑGJ0ß“N“Ñ^Îõ‘8|糞÷ê¢l{¹ïùÕXÔ¥ZhñÄŸ.‚ùòÎ=ðû û>8ަ'•^îz.Z‹ ÕÀ|¨NýX¤Ç/R2ã ó;VZ‹I3jí»F XÓÊϽªõ‘µ’ð*`zJ¨` ®hé‰[·€[BWöüRéW†ˆ—&M¡@œÖoÈ7€ ÃQ>ë3z3©¶´Pz×3æ&ÁD¾s’’³Îõãj:~Û:;ߌĵCŠ÷Üx]]iP,ˆèì®áZgë¡Ê¤ÅШ:Àì€m–bîžJ Ê”Q21èQá®EásQ‡ÀðèÇ1rm½~^‰8[Ä4Ò½ªà_c›¤¾» ™hc£\Ü&»œ˜c¦óÁ­Ä2á’(yîf ¼øv†r‹aï[â‘/6Ðh”Báºe2v1Æë#ÊÒÔ6ðD1y¹0vh…{ÞBà Iì²¶ý5‡]˜Úz׿èëHÃÕ8+a H;WS±s>GpU”S&d7QŸuœð“3®vªšÂµ_^VX¨(,·ÐúS®Wt·ãzMO%î¸êEY¹Ô¥šˆ…ÚÅÑ!£Ÿ¥ Ò7ùÙ. ö`€;AÍeZ„„ºqušPŸsGF¿ˆN ´Xß–ayTP é;& ­Ch‘¸'»÷™{±hŸÅ@ÃVøV>7$}r%ýXã£DÿhpM3÷êe˜~àÏÀ™JåØKp`•5¸zœF•z(áT„÷ÂX#K=„Jô(È6tÚyÕÐé31¯#ÌÞÍñÑ©s+¸fwDG¹µ˜An…ÃãÙ¯ü;Pë2 Æè38qwX•^Hõ\ñïN—Ý&¸l9ª(º |ücébò½&Ϲõ>ý[y¡Ãûqô©§.pøÐ‘°þëÆ{$y±p°@ˆ8N|t°´n]ÈÌ“Š\‹ ÍŸ«k÷Úͨ¢ì´Œ×çyÎ4Jëe VX%iÚu…û’ÁÜñ,­ìŠÖõoIµ¡”sˆ Žý#·iô–œ ´4*ç}óËÅoФ>áT í¡$?¹ŠÞwKÙ~¢D(éÖÇsL¯'سJÄ]îÚðIw®{/ÔöqvâÒŠ—\wPúÍ.›Y¨å„’f;l,c>,ë­ÝÀ[Lë«æ°.qv¹ë²c!"æaÑï¡ôf¦•7©9;‰Ÿ_[å"PlYá½xK1,§leW­Åùd§Ô(NûÀ°" BÁ~)«*¥ª9#Ñ‹óF&vÓ¬P[ëa²TÖ;rI;ÞÒ”r+Š< h¤õVmClä”Ïr^>@ 6-±Gt¬, öãÓÇvGÔŠb¦•ìûý|U÷‘_êŒ ò]ÈÔé_‹qZšF˜Oïÿ5ÚÆ+I!( ܉p‡ÊjÛ5÷2ó*”„½·%g;V!I]#‹ûù¼ƒ ¯×\QÇü–‡?Ñ"ÔQÝ)êma–nH0_ ðûˆœ¿z%7)!¶VfCŸTÇß—QŽ„ÒšÅ•Mžeb˜8¯ ÌD#ia}i ¤Î梼§ígBîìª({ŽZ E5R©dÔÇ F‡x™Ï´k˜ú€¬kÊłȭ’Ú½L …PX”íV2Ç÷jÑP˜ågSéðÊHÓ|irP½äí¥ Çñ™–̇ %x8ޤ: ÿ)©æcá”ÀBJ=Ö¬÷[¯ÿgš;;"5Çœ’ëíõt™Sšl9qÛ4ù’_e‹ÿ¶äo_‹J…\ýÃtí´T¸ì|{ðªó¥R·S(ULSt˜ÛÝ[ÁXb;-8R÷C7ðy;XÓ. ø.*=ƒ¥£%€…"îøËœú%\Ö.ʥͮž.€ÇdOIÿNÌs‹)ÇêÅÉt=¸ç8æÑ†R´_yl+z²I\Asx^ÿUêûòàM.G¼k0ôŽK$÷ùü¢ÈEîvl°^oYÚl!çIêÌõ aíDl +˜ÅócÒXЄFXÁò¡›€Ày²›Kº(ê*nHzóæŽja‚|X~XŸâÕD ãÖ ×J¿Y+Y¦ô»ê‰ñÏûpR>Ì×ĺØÜÁ W~^Nóð4⎺ÑÜ”Ï"ƒ"ã1ØV 7«-4MC¥%zö]¦¹Ú]‡^T4!¯Ÿ-D‡2ôÚO‘õ~“ž± ²¡ÅдדF*YûóyS£ÿ›iS3‘w½Kî˜úàöwßÒPs™B J1Y‚Gð,⤊øj>à_Ðân‘\0XÞ±aà“QÁ$½ÚrR¹ç‘³ëCx"'FZ7x{2¨tâ[ý¶£ðîõ^¬óׯ ^ ! ÃúÙܸ̎sohÏðÐà7Ù['7Ù£“Tu“=jª‚¾:Ÿù˜NFãÂÌØ‰Ïðí¸•ÿiã5ôÚ›rB¹¼æÓ+bu< 6fœf6ûÓ œP÷³´s{¹‚JÙòÁFH&kËÝ"f9?*#»ñ¬e¶Ë”»Ê¹ÌìøÈlºl%чڽ=Jª';ÆãÆå<8+ŽsŒo~ñq<“›mäãš&—Ñ¡A У?lÆë§ „<0‡e„m«NP Xy"}2JOJ®¥çz@_œÓt.4SÖ‰¾¾úa^µIÌ. ×ï÷!óî”Pþr§ˆL^ò§x^¼ß)„oqs‚(Ðe⻼Î\ˆ¼pÌVF[’pˆEz^Ht²÷ÿa=´”¾…eM§»žv¡õ’y\JËS¿EzÛ§]‰ÏÌ^8ÒÆäÇ5vp-¾m§ßsØJ‹£Ó-h’3˜4x­'œáp¼ËtúÈ¢#S=^· "³© Ç6ÙÈY‹ãZ…gÌú¿1ÜW¥'ûoErGìº;”^iÿmK›­–/ø¥£e¤ùó@)ˆ=ðã^t½Óðcn±°ÃãÐ&ó="ŸÍ¿zq𘠚_ººîŽ)Ýsq«zž°áÐÏ¡¦ïAÑkö$øÕpñø! º‰Èüê‹WA}îx´vРwP’ª0‚úvDÑïONÖ—3±Û¬ágep†wE¹)ê@i}Q,@sd úÙàêPWäº(Ü4EQE4{y9Åsñ»ÁÉÇ+®Û”k2Êqà}µ’[+§‹å³¬§"%oxÝÕdä$±«å;ˆë=D#á!šX‡6î *õa†.árZ9[Ê•¼áœš;ç2t2¯4îɆ'ìQôq×'FÑ_NBÝÕ†”<@ sõ"ª8üºÏ(¬¬BT%ü.ŸÊv.[5ßt~v¼YGöýxeGf[ù%¢µ` !MšúuÓì=IKáªÔ}{û(„õÒd/AÌ~÷¡,k¼9eQËä§w¬OÚàÝG5ÿô4ùæ3ùÑ<èìïm3èB,êaâ…Bâ‡Ciƒói7Ëó%ß‚' [53#/ýììa >$W[<0þÀ¨r:¢·éÛ ˜¸“ø®Ó¡r|?Å¡úÇ/WKhÉ¢™A™rݦ¨FÕ¸éžõCâ~Æë@JzsìÓxkR dQ2FâÛd”[‡Ë·#oe}4—Å@Ð¥ˆ;Hƒ jÃSβÄeÓi¿Ô öfFi=*–?M—Õgð^Wå,¯ÉaßäŒú—;h’U3¤™9)\^"ú{¾¤JëI#­ŽƸ«)y¥RâºSyÄ|‚›sJ$yÙèU0ˆx@ÆÛŽXô„ò­w•ÕXVv„áh:ã@Ç,‘hÇóô¨"ãz™(Ô¢.¸0ªõ÷‰«Ò£¼æÀ×D|ve垎È%t\uU¢â¼êv 3)²FÆ1ø1ž»/$-ºÔ3³M«I(„Î//£Ôð|þè cÉ3tþ2¨'ŒBðÑ"î$(¯õ¿mRDèxfê±eÄJir{ÏPêy¡ø~¢!{ëRoú˜kpˆ<¡£w² ™‹¦ÛÁ¤Aú2Ô{¼|â¥Ùß´ˆœ°ï>¸î6"‘_Uß%å¤;Afxd \Òõ4è¤WÖ¦¡Þz7ÃâöUÛ WÐ9øK£U´}©ØÈY*\.—À8#:ê):©« –à†X”§÷PÔô3 b„‚¹õ.”Vä¡á+PJ™e>ˆ÷Më¥t$9m\åI¹ï:Yñ䲑T ZänÚwÙÇòüÓ†{<ÍÌ·V£G1KR1AøP‚ =Ô„0R K¨ ÖÚ eøœÚÜ ¬ †vÝ8ŘÀi¬×ÅñÓ‰7¯Ž©ƒŽ€LèÀŠ1ÌyÛÏûÀ'‰z'ê0]ªéšÈréËÑ5‘U%ªo=m*ÞɃÀ=Gk:VÆá SÙžLÌ?—narç§`&¦˜x8šÏ·ã”^ ¢tê.ß§†\^|ªŠëÖ¨|]®ìÑ0ay¢D€zÙ:û!Åg?E3šJd WLUIó0h¡^$?v;2Lm ƒZÓGQÏ@FÏ”ðÀ¹î¾;?Ò² 0Áf‚²ÈW®7›ëæëäļŸšç(96ÏäX€Fè½"èôÆçÉëÉt ®>½œËà¹*=.@ü XB¹™¯\Â÷rÕÍÔ‰“:6æŽ8R^ôW.2©+צ(ŸíŒ…¹zÁÌ»Q¸·ïžsó6õwKÑýLÚzk»›¶èú,lñ†' ä]}y ̪»WnϹ*eʦ°b”cåãyÌuWX=·ïd÷¸:ºàMÞØµÛÈ»pàVçÉ-rµê]«ZÜFµpÁ–üP¡[Ä¢ÃWzÆÄåèB1q1š¸Áqa¸;Þ}qJ;1•ö˃%3Çõ³v3ÚfŒá¾Ì=ßBÖpk®<'´6 ^ºlG«7Jª¶Y õòE\Ô%ß— hjñ𝠏éN\ofZòæ0Ó ‹×5Äýñäïe¼Ãìendstream endobj 157 0 obj << /Filter /FlateDecode /Length 7231 >> stream xœí]koÇ•ý®ÝÁCXl×û‘ X8Ù È®ز²0àÁˆ¤(Å”†&%KÚ_¿÷VUWªî‘’w“ ȸY}ëuî½ç>füÓ‰˜ä‰àÊÿŸ¿zôåO®î‰“«G?=’é¯'åÿÎ_üö)Pê$NÑ)wòôù£ü¦<‘&L^ªgý¤´=yúêÑ»ïNŤƒ—qwyz&&#„sawŸßÐ)¥r÷’?í£Þ^ó£tö¯OÿãÑïŸ>úöQžçö¡ë z—µS§Oÿ>‹|¨´(¦ e¿Ë›ºË[^¶"8ÚérS Zí~NsÊhÜãuBh>Þ¬°!ìîNÏTP“Ž~·?Û0Ëd)šYHOTÇhHì- PÁ(ç6&ÃÁï²XúËîð|žBï¾ÊBèÈýîW1ð*.象}›@y{1„àv×mžk¸¸Ç$0ªÉµ{žŽÅx³;äÁEÓ ®»zÇŸè~¡mqÏxÛFЀù¡§%ÀþŒÍlðó©Ú½®Þð QÐótîNxO¿‚#Üá¤ð&&Pª 'Ç'H‚£f^D:xíEÆ/--2~Ï.©xr&å­•'O/8yÕF’ð ð|šÎÃH»{’fÂxMjC«•BFEˆk£oòh'ó~è´”v»÷<"!¥*:&”w8TŒÎŒ¬Z¨éØlšqÆøþœ/‹„„ݧÖò9J®2†µ ÇÓé™12aà»UŸÃ%ç3°ÚÛ¥H/~¦þ«H‹Õ'ÎXºÞ¤þæÓÕ_ 3yAÚŒ·º™é”iQnV&!¢ñ<˜/‹Æ$õΧ:Ô¿oº²=¼ijxÝéµNÀ–I—³<ÛÉ~’?ŠfØ0*Ñd®@õyN©ÉÄ^–Qfsˆ–^N¯Ñ •Làf•t–—ßÙþCVJ)âhÖÊX#žrÖÉ yÓ¬“Î$ò„4àwpø_œV­ý"¿æƒ§©›Q{ g_EÓÁ í›y2üüø"?æ ùeŒ++–"µþ'P+<oOœÖ“VÙ¯ÚÏP,òÒ&:÷Ãî¢ÚØ¡€Iº¯·u0ޏkþß囩^–.Ú Ö1][3/‹ê9›4Øß ¤yŸyÛÙaàÂØÒ’ýë^BÑ[З›fÏš{JŽE“2hŠG{ÇóÐøC@0x]wH~…ÈÎDïÿÞB¨ê°®]-¸[$Û®È OW´ûËm;çC¾# ñ£ëÀ­®^Ÿf6Ù¨¯&‚îè@Xa¼Mò‘tÒZç‘È%ýˆR;Pò$Û“¼voÛk¯’'äPkÃg¬û ¿œæÅ…Hk¾ËŸ™#¯:ÖNûók^S’+Òtæôm‹Ižõ© HQ°ôÖ:ÄAMðv† ¼SÚ@[ùû&‹ÉÛ6Î|)…¡WÉQ̆ Þe;“NÊHW,-˜¯1ÔæE#Ìv€lAdŸ…ÓÉÚ-F‰ÃaÈù`´h"Ýe8šuKrÞ¨9X¯#Ì#Ë5lf†°âéªèàü|=ÿÖ“ßdÙ8Å0&ÈÕ…£ Ží_Üýñ”§#|2Àë9¢J¼…_Ë´Ëe$¢7ÛM›;\·ã¸læùw†vÝé{¼õú0ë-c¶:tæ3=£•Í‚»A?ô”3íTâ áoaÄùiòdZ^ä±ìaöõ½ V4·Ð§ÏvP—䉅FÌÓ$k'‚âÔ(úQøž_”SBØ1¯?º¢ „£½~}C)!Reÿ¡‰[{r ?·ŒÐ|Ìr=Ûûï?…p°0}œøª)®éìTrþ³;§KwUYûݶX94Øæln‹ˆ“c”9Qj¶À—,Ô$ªgšÙÞ9‰  ÕF,¨(i™¦£WÉ’Ïy ¸÷zöo›a ,3«Zå “æ°1,uvé@,Üt“Ë|L„Ì_”Åæ§ÑD8A£Ó¥ý¯áêñòÊz2¬–3PÆú©Ðz‚aˆl*’‚eŠ g@©Äô o  ÚY„h–Ès|ù¶¤òÊ-\qB'Ãâ.œ’lZµgýuô¦èHþ˜ÉG|•%3UèÉëÒq€BSÐÜú¯é2 ¦cèY{U¸xêk~ê}£—‰û‘´(ü")Ÿ÷±Ö\nŸñíã'ÏŠÝ'X¥éï! jÚJæ—>Óia¶>æ"I²€·åÒ¢ýº`Åé #]z¬Y:Ð^XÞyƦ “•¬R %hš!m0ØÇòVo1ëáwGêR†=¼è"ï´ .û Ù?~lûCݦþƒ4áY)£rd~Œü9¾Y¡«üXGSæÏ©ò!•™4s…ž!ºq*°ªŽ‘Ö$ÅEžÐÆu6‘–FBÉ’0-yõb>³>¦)©2¯zÊÕHä#{}zâbe¤ ’©¹t¬ äÈV|$&gÀ¬Ñ—,1žÄóÁz7´bðì˜â) f߈Wà6>¬‡]ÂS¥ºz|x$´‰­deذw(Д#fPÝ¢‘fç¥J0ŽL½Êè_·rcøR´-“R"•¹†^®¨qêvi¢¥å)µÙìâäMͰs‘–Êqßu ¯=€ d½þ{œä™?ÍúŸ @0tŸf÷ÛtEÖ ¿þê»üܲ±|}yõ믾a·Nl›+csoTUÿ3‹Â},I )ÍýóÑûü£ä¦¥Å~†—-F‚¬ÍFsSGÞŸëS¬‡¼V#°t%¼§}—ߢ{êÕÉ`ß7ѵ™±g¹ –Úí'q¤†q¤|jÎ&¼¢9-yBº›y,§Qó½ëÔ±ð¤ì.„ƒcX$ ‰´Ch¾Ñ_»èß¹ß+¸(ûúdV´Ô3ƹ¥&TéØʔÆcÙ±·¶ë•Áê«Ø ç¯fÙ/š±»^½ØlS 犧3Ī6ã•gm0Ø»ý2™˜Œ;Æ]Þ !¬sâ©YËò=Û¡~4ï{L •oÚBâî¡î0´S¦iä°õùé¾í›}´òvr¶êü~ƒ-biy†…ZZ&¬<¹Øñœ\TްH8Íëè-èëCµyÆ]Jœ­Àd˜Þéó`¸¥¤«…kb—8د2¾]ïR¾`•>qî“§ˆ",hžÏÕàÃVÚ®+ ´¿.6äõ¬/Ú®óH3rŸÃVÚˆßÒƒàBHâÐ僱œí¿bð1oNN\ÿ;>ÙBiÔ§yE!l%)‘ =oN´Kο*RDjÌÔÓLZU*€Y¦/ñÕ’gʃ{ì­‡0C…¬ÐÔfYÏšïÞ`ž=BZ>5›;z³Î7Í]?qLåÐÓÝŠ"9k%gˆ2˜´”k=ÏZaP»ïZ¸?œ¦saÓö?¦nˆ(K3³ÍÁ e(äâ;ž2)ü"/­­6E›dy0²éõ\H‹7|@ 4F튉U-†IÓùkázb lØœçÔ|o-ω ]d7ËØ±³c-\Æd;t߃C7^2l°2ß ‘t{…ï™0Ô眼§¶Ô¼µ0E5ÆuGš¢úVÙ²ç|üžÈ17"HlØj …¦‡»<–í̾½¶^ëA‹SÑõaµwé"Ë"uîà³…•j‹<š°HòÌP´é‚“b0ûB#Kø rH<˜†²Õ!£Àï±æBêìzçkÓ¹ ·é°««/µÌAÔ5 ¡ËT*G¼…ún ßL^ÍÖ<èšHXÔQ5×õvÇú*™ås2œeó}ÁŸwotrIcÀet²T½Vó~Œq]  EҡДDG×UšØLðsW(øJd77‚'`ºx˜ˆP.Mñ–¹-iÛڦʑzmp>¢´Mª{ÙLFT¦3ƒÀŒ)·¡C‘åy.Op-; Úîß댸$Ȧõ{PϽÌæ. y]V-âlÉ%AC·V©U_‰³=NÒfM¢û)ú“wÄÉ(ÊÖ´çp¢-‡@Ÿ¼zdÉÕO²>¸~ôÝfr܈%d÷å5VãN´qD¢UNާ&Y¶G"÷ì¹ÈÁô«  ^é˜ÙðR˜Ð°[:ö¼2Æ”Yò—Îéü9ÙìRô“6'Sˆ=; Zæv)IkÉ'£#¡7óu/ŒÕÜ}ˇ9ËoR”Dw¡vÿ/ómÑnrÂ3µÖ¤ix[ü±²Y8ä+±dÂô&y‡à]ñ5u?4BÒÕoOñèzy;º¼zqF’ãôpqåÁÑ‹SÇ.Nó×öÊ·#¾‡MfÂK«lÜIxþ¯xOÁ8bª¬áVËI“Úþ¦}ÔíÍÂ.ÆJ&K3Ô¿šífé·Ë9½â ʼ„ÏWY8ÓÍsjnew&¥˜ñïU¢ÙòÞ[xï2ŒJi^+‹Ð2c¥øhQB”ò˜-÷x‹Ø=~UtQ…î1épä&° ò|{8Éùq)·r^"—M#­4µz%ºI`SË/ñÌ0¦Äã*·Òxi¸™MÂÇø®‚?$ËÍ+z™Ïócßöl´Yì©”›rèAöÉX×/³|§×Ÿña=â#úÉûb Oÿ>™lgdãxr'ãˆ7d$}?€‘¯›ÍÒüð‹öñ·ŸˆÐ ØiIƒ¨˜ï#Ðù6n>™5­°ìy'É3Å8iWÂÑÿ^6'{ qwàdw0æ¶gEõyªQ Éõ®™¹–*Ášx¾1éuƒû(¤yŒ,d®ÅÍ/6`½lBÎaÈ% ¹kCþº¢ÁU¯î¯Kè˜;;O¤«SlT „y¶Ž.v‰rÃÿÆÁ'ùcá}'1Žx;4y·3ÄçKl¯Ëº-Ú¤4Òˆ=œDfö¨ÞöaF²ÔKѹ¾ƒ‹t‰¬ MTM™&ûÿ¼ûC3ÏóSrÎyt‚³ÂÚù`瀷T_«Cãçù2{•™o³w$ˆï×Me.á1‚0±œ¢3[jõ®wö =!䋜¶,[ǵ`dr׬ÿBOXH;ÐÑ2â%ÜðyÓ‡Ë^vò×65£Ó™ÿW“:5§‹C.B¢•ê¢|XWŽ?Ý6Õè½Æm#}:î+’D|óafûO9q¤äÞ¬c°ç÷刣KùU(ôî/åaȸÃA$]Ï€PHAÔoÚ½/¸ EM¤C˜5 Oð_N+Î@ÈEÓô£ûTÂÖ~šwž÷“”^([²}3-*x t‰%Wž3ɲG¡Ejš!²Ï!*ÚLâæ¤8~™³ ySEªAÿ ÏÓ;1B易¡ƒøÔ <~ÕG…ë›-%ÁÀ4`Û—T‘ƒ!ç‹ËIw‰¡ÚþËŽs­9Ñ ­p®¿ÁóóÆqøÍ:EÛò7Óã'§™å›q¹+‘EZntF›M0û˜ðð@»3þs"r…Ö;Ceìi}·ã0´[H¢çLKô©¥£#ÜðœÒÑ|=¬G´‡Ý-¼CýïŠÔ•L¯‘·6sø¥„ÞÌÁd²ä|Üt:ÀÓÖTN)39e§s±®rGô©KÞ?á²'4˜Í»íî¢$ûM 0{€¼è$Ÿeì2;‹I—¡,Î „d€E]â>å¸U”Õ¦’A Þ×ÙÃ1¸ß#º-¦~-ŠÕ©MñX«ø‡tF£‹ù™Ãz‹Fù¸fŠ}Ó6þ0Œü®z¶²‚Ë}phðÞ¶¤×yíR/ °–ˆ£S´ªô$Ò„K«¡§¬¬_’C=GÕ<4›=+ùH²ÓÈÇíaË~TÙ@Å 7®3˜‘Ü9êŠÉ•S‹dJÉ÷M¡;™ ûƒ0Û7ô!(¼úæÚþÏp–]œ‚®Ñ¨'Ëöcc¿¿.€Wñ’4˜"0yÔlØ8y­»ñ ŽÿåúÍmyŽÇ-u±.…ÿ„ˆÅoÚË¿ÏVµô׿ÑZ£V¼#}ŠÚ×RíÈ2³ã}ß±Aäû.¥Ümm…¾j£W¶v¦ø«)JÏ«ý}K:Ã]§‚RŸÂIÀè‹\œ—F%”’S-ÕÙ²½PnŒ= W xߨ/må°ÏÙ,þfÁ‹2wµ/2Ì]Â$ÐÝÊÜ=:–¦‹cxÉ[ßÒnË[Ry{Ëß•ø¡N¶XI‡Cîˆ ¢v©ôšqˆèDÉ£ Qr’®‘Ý¢=iktQZóXCZxÛ´uÑn%¼¿GE:®Åšæ¿õۧͱ Ö—Ç5QkS·‹ÎbxîšJDÉßEø!¦Ï"·¥Ü6Mùè1\´Ú„¾òr“¢-†‚ñ]*nk—=þ†zÑ Ï=½ò8©ä,šHC§ãŒ”'ku[Ì;!e?4œ`·È/x€³OÎY{3›6eQ±"»sÎÑ F-ÈoY/ÌÃܤü£VÊ 7¶$ÿ¥\Wó6øx­=À‡Ø>A„×< Jîˆ ÕdÅÙßT+.t§x幡#õÖÀ•õi?mËì«´>ai„ϨSp1ªnJ#KãžÖqM’™¬J¿L…gº#"è¹K•à»Ek ¬¥»JMq(~¼ììd5B?>æIÕD=¥›I>b&_n­ðc¼›Cèd Þ™îxï7ê8!¶*×_çæRþ ØÛ¢ ¿]ŠVåw˜þ—2œœpGx¤ùèêúú6&^7(þϽý‚³H0©ÙÙ7\A¢›ÞE×Sû,æ 9¼£ÏMÏŸ ¼UJ@Ãݪî— ñ?=ÿ6Õh˜6F=øÛšŽ~ KÛè¦þ C ŸôMÓ9¯>a_Ÿ–Ÿlvl”¼sÍC{å—UŒù^q)C_Í“ðpmX`@W¿Xø&:RÚ®Ï.ç ¥dû}¨vÞ¾Ä†Ž­J*žíó²!·ÚPP¼yx:8íºbê&•@nž¿÷£Ò÷iò/‘›>ã½B:#ë¨t ¹äfË|^í)³öà˜Ú7ëÝ!¸•_5 ü% ùrIí¯Îé¬÷¡ñššD4ûÏׇ`bâr8âB3q-øÕ > stream xœÍ][\¹qò¨øGÌ[z°ž6ÉÃë¡ë\ ±,ÄYdƒ ¥ÑŽd¦µi%ýûT±xÈ*²§Ç»@=èè4/Ū¯®¤~¸P{}¡ðOùûåÛ'¿z¦ÓÅÍýuqóä‡':ÿzQþzùöâžC c.Ò>yã/žÿ„¾ÔzYöÁÇ ïÂÞ,îâùÛ'ÿµûty¥öF©dÃîõ¥Ú/É:kv¯ðµUÊû¸{¯M´Æ{|½@/ÔÞÅÅ,~wxyi<þ#Bð³Ù{íwÇ—WÎÂc\vÆÎ\JÚ»ò¡OÚì^âë%%k—Ýú2¦¸{-à«–Ý=½]bÜè1Aƒ/ ,@é…fYzxI3Ö1Yè ºÐʘÇ{ú0è¯áC­ãîKÂøìÝå¼ô*jZœÙÃê¿Ûae’±bŒ22¬”­ÿŽhâ’çSÿ~%EÜë³ÝÝbo!Å}éÃù°“PKÚÝÐäAÐó.oŽQI‹)}w™§ê–àv¿,K°«°%!š…-êuã€?§¤¼¤eiø¡-þبþêò¿Ÿÿë“EÅýâž_ó|Æ–Ik뀎0¥t¢%FµX×›Fè—bôV/y,hœ`×4|‡Œè¢Åý©TÂA¯Ê¨WZï“sšÉX¨ë°Z¥ž;¶<\Y-í>2ƼÏóƒ5߯;Öâ&SàWÏB`Âå5P@™•"‡K½W*Z ýáSòv÷?õ©½{YŸõévðî}}ž¬—e&BÌ=Ìê¸Îd¼‹‡{Æ;¸d¯‚u²%ßT†Ö¼“×uƒ+üxé¬Þ‡Ýá6rm‰¨Äg+Oée6.ÕFãêi³<Š,›×áEë8—¼²žñ-ÉNÜNE øòU‹Ážêàà¹RòºþXŸ>Ö§ƒý{5ÚŸEïc–µ×}âq ˱còßæéëÓŒ+‰ôÉFCT¡_.ãoMÆ„a X¶Àj› *"_-ÑÁÞ:Þ`”Ô$7âÌ=l¹æO; RîxP¿ŒISH=ÜÑ3t´{FZ À<¼…N‚^ˆ¢“ëõC7™ôp…þ Ö,È# "çôÛ&Do˜hoo¨_` `©:Ú‘z(wYä8ƒ5ÐöU½w_0˜Î¸•Ñ ÈAë"7´$6Í{Öņ-ÝÇÐqåSø°¾A¬ÊJ™²ËÊ%½„21x‰·4xNH|k€øjÉ2ŒÝ9@FÞ×›·Më YpˆÓ ¦cƒßσ§ïb~7€îõéÍ"îÝa}Õª ²Ö&T㌶BÂ*Û~¢¨õ}n`Nzmʤ$3)d¦sßd èBà༠ :!É;ÝÙkÒ&ìÚ㹉tÍX,0R@»ü ¾.<øÆA­|®Xe6nt¹—˜~¥=P.ÚŽu‘¤ µR ‚]ëˆßmÕ÷™ÿ@³û¥¼¶ÖkÄ4mÉl=ã 6óvÝcZ@1ÛØõ+oÌdû"Ìœõ3¾CÇlØ*Ÿ]yÙ à$f cß½ÍÿP4ê»ÊSld¦Üâ4<Ì(³R~ž댿{ßVú_[àûŒ€uýd˜¹~†ñþ1³Y_5ùŠZ ~â~Ä‘ð4ûM¾™‚šŒãÖ†…ãµo–1g¢c6ÁAiÿØx™ùzÆ™±pÑj$c 9Í xh—~îžþO/€S‚W­fæÜä%¢0»¬Ø‘Az„ëuOm­´û@DŠh=•Uä¶*SÊÜà™š—Ø™ÕŨÁ›Æ:ÓæesîOr5ö¥LS3èfzå¾>øÀ*À}}âðúªIË{ú V|I€hâÞù¥ÄÖ!·‡zßiÑÑÁü®”NŽÓ+CÎNû4ë ‡ÒèJH§µôxØd³M÷µUÉÈ-(~ÐêOçX…€zQO9 h¶‘—`#̧òðÍùܯA‚}ûrª¬,0¦žã¤ÁX"r-q9Ë’U{,oLš™G™^ `V˜U÷Lí¶&¼k"˜11­ð¥¢ Ý—‰r­&Zâ¯ÀI¦9óžtË,îLµáž ê{Þ,¨/ÂvÖi †38ì}0cbÅÒ÷õém}: §äÑU—´]9¼e¢µ5Ÿ5xöè…4·$øÔvͯ‹¼"ýhôZ,zTq*ð8LpÖfÇÉÚ®ê¼vx›Ò Y4ƒñ'RûbèöÜäIP¨ñÀ\œW4.–OŽ<±0*=/ÒKbá‡{Z©U¾ÇUiÄÕL çáBªê ~ÂPÃÉpÛfõ†Å¼^4¦bp~àÊŸÙ¯R›UËã×0ŒC,èd%Û#Æ5ätZhÀ(IYj$ç~]¹ôëBY_ê¸ú¿KœEÕÊ.TSÈ5`ÈU÷ÁÜ€Á\#ÂEd¦hµ Æ1ÙüRƒ¦ä^ ŒŒ Eå8ßyúßï© /õÈ‘¦”ÀÖxFà}s{­qÍ ŸgV.†ælÜ'¥¹ø >‰¶—y`ì‘EÏ ¿¢] MªˆÜtÈ¿=ý}ž7ÀDØ}SóG†³ÿŽÑ¡žwO ]–ñ7Ô1ªv² ;ÙÐÂ…ý•Öf£? «¼l¾³\¥CƒžnQCÓ…¼Ö(û3zÔÚoP¬œE'†É†wT°IXƒ,mðýÆÉfÝë! ò8ý^†±Ql­Õ$>Ÿ&`00,Œßót!4‹«ж4@Ÿ£KÐÒî”ÒÇ&ð#Ë([Tv“Œ.ɦÙâd¼)ÄE <Ç;Œ–Å^³øýn¤ê˜>Óh¡´03ë÷wÜ2U3*Œ¿Ø’0 ÖÖ˜þ¯1Ó^/¦ùi,˜‚,mú~YÙ±4UáŒM„¬¨ !“Qü=æOLØ™2›eŒ{P¯j¼ˆ5š²(\Ÿ’ö±ŠÂ/«\JÎæ6.Má§^êËb.€'%Þ¢( s—8‘I| hXc¦ÜÃî±Ù$°ˆ…`h-_Œ¥òRİNJª3_ʇŒ2³|åÈA̺SeåBù è=›_T—»2›Ï$Ãø²ñÄôò9&#‚D%ßfô<.×Ôx½F¨­nÂÂHÅ2JŸiû}J‹Ð±}įt+µT‹òD20ì(ÓùFi©8d: ÍGl²Ÿ„ÖZ†ùÖ·0dAÜåÐcs«ÂÏRUûü0½ò€¤Ç­ £ÑcA£ø7ÿ€mí/iÎu›×Í ìõ÷³3ðù¾¯( ¸úhì5C×ã‡bc›½ 5Y÷šfáb&`ëxîfÐUR{ÔYçî–´ÈÝ—!|^·uf}0[“54âkE€ëóãçEµ¶S:'Û½ÝÄ1<0?ò¶ &¼h!]éë“vá5už¥)Éc€£"鞺³Ê ûíŽ^o½•bMÕ1=Œ-q泈ˆpýn›ÐZmÄ<‹„‚‹¼d¢A |e:Æ “ôË¡;ÀµùuÉ*š9„24E(³ØöÚõ1 QDKË>ïƒihVóu܆3FÒÄrvZh ëȯÛ=eã1~>\g¡HÊFɺW2{M<¶þ~ 7aÈ»ãÀ.^eFŸ©̹o… lW 5Ø£^ñYc‘®eZ¿<ÍÛ)ª~ &Ý,¹ÓåÐ2GÉ´HffÐá!¤–ÉË Cô¢®ì ½Œ:K{‹¥ãt½ !§E[ÇïÿlP¸Œ&¹¶$½• ”©,gª8†’ ç ó‘Š(–Q!™×ï2_º¬Ùƒ{ú +'mɹÆFÏÒÃdP€ßªû–ÃËcv.ò:Õhá¸~%o¡ÄËöÛìwMKÍNš§t£eWáPHÅ(<Ó ,yxóšlÐ J&òrP*™6¬aùl*sÅ||@Æ3O,ö(ȸƒ˜/J5QtrP‚fk„R29}B¸³33¶jKöŒÐsÂy)¢­ÎÊR iœ… ÿ 6ÀzÏ9X`QMJ'¼v̈Îü›†Ü ïd+1wl·ñxµI]<¦Lãgª£Àî¼¢9!e܉LEBÎÍuëÛZúxä-†?ÂîõW†e‚ø~Í-8«ÞÖú_çjmYË÷j›·I06=ÜlÊ%J_»®Â´ƒfî +7ÿK3¢oˆGp5yûà3`‚Þô/o"]TE-uåÜÎð¿ uÎo­ØMmšà"Qó(‚se­½cX^7…ÊÓ]Þ&9Ù¼î>“Ä™¨üÞSÈ|î›NxD<‰[ÝÄ!½Ñéå•[ƾ™’×5@›ãuãñ1ϵ_P’j«˜äÁ*³ [sßíòt@%‘ FmÔòl¿a]ÿ†Œ˜WÔ£°1tjT P”c…÷Í’ yeáG©l YÇX"¹ÃÔÚ§ü¹ Ó/¿ãl{{Ywˆ{TŸ N-€åo/«Gø†æ¶ß²w¯ØbYØ›æ?Ü5¤¾¡Q0:ûMk›½JêáÐÁ­JÊM5Ñ-‰¶6tÍÎ†Š fgJ úwM… Çð!ÓƒºÀ-Ë­*¦“¤Æ¥Xð&£r‡ÃÔ‹69Öö‡Æç%‰ Hq_‹iN6†¬V¦SCX`9CSžV¡—í®¡Æ(ˆ)øIL±/~¯^ ¨´ï“‘,½Uª8Ž1ñ7ÜaÀ° =4…ŸÊó§âf`¾t” çÞßíJ­(º.qG9‡Úå`¶Å?ˆ†gäO– Qk¡­DŠNcP}£”tÌg›&)^nM)Yî»9Æò,,1Qš÷4"Úè¨9j=@7%>Nu òX%Sì0´¥ŽðØx46z ×úI¾Ïî 9‰]()Ÿtˆ X!H‘HPCyÊùMY½ÃÆuÊÃŒƒì›$DZÿYßìõºÂÊ?2ÎÞ*üüݤ^&Ù(˜ÔæØ— ¥úc_œãˆ€å AÕ,ãÃõófÍ I.[Xé™,Ð’2yðӚIJÿ¶mÝÇËšF™Ä`޵gËjÖþÆUÞ|vú”Ɇöy—y%š—Ö΂/’oi˜<-|{Ζ= ‡ŸÈž_T޶ò•qµsÙlMÐGf8±<ùÒŠˆˆ8.x' SÆáRT󦧇 ÇÊäÐûêŒ;»“ÙÿÜ';cÁjôÁÖI qèÎzÙœ¸çÚ-Ø„übèãˆ0 WÜô]Ü:ÐÔŸ™TYœL âå¬!ï\$)šöf…*c׬}yìŒïäàŒ /Hg-È2Þ–ã21Ÿ{Aðo–R„gÀùiÜÀJ#Yˆ}Ì©›Ã®ÅÈ +Äïc v²IXÐrÂà_úMè ’rÊêjE‚ôì” çÄ@Bö7¦¦¼8!¶/Bóü@L—ĉ1ŸG‘bç‚Ç­{MC{µ)—Åט'ä§#ËÉ£íèØú¯ø6‰Gf w¥÷yl½ôF®ÏE»IAk—ºèÓJ<]:$ã‰Q† ³ÅA·Olê­ŽC¦”)ö²î&¿\r{’<„ô{òåQ¥`:nË 3‹_U[N)ÒW’ yøàCá¹¾Á°zÛtš¬3úŠÝÓÆ´ð•©sÁ,½–Ǿ1°8ÁÅa8¦×BLp¦Úv†ÿúvR$»Æ³;Ë/`ç÷'Á`^¨ ²’×ëâxJ¨§/3¡mèy}*%œ“I"st™.ëœ7"…Ìÿµ,»^jbÓ˜Åa.åçz‡¡U^oYâžy„®„3 ¹â™Rè|®œÄŠâ@¾€5Y§ÎŽd¬ ‡³/ôi,>¬¥åqê8×Rb¬W”pQ&æ^´Y˜lgô•el~²Òa¯Ó³²—:β›”ç=™hd«´@Œ K>ø§ï~Eô€Ö"ô ýìšï´û&8¾®/åóÔøˆ§Dï›]Á }— zx‚Ÿ´¨š£%ݹ–«µ­LMœªÃ¶Þcè–ffå2xÔ8_a0ŽPg_¹Sá¶2¿še€RǦv”‹/áH ÈÛzý»¶º¹çVÙ”gÀuÉ•‡1:QY@¤Ë&ºv O°S®¸÷YÉ–Ðay5YKøi«)­“êb‡:¯bîÂTòÎð¬0«·Âhä·Àòêëœ_0‹ñ 4ðý&Ì…½uÊ)áèúqŠz-'  ‰Ï…\³»I:ÿk=3UIˆÑoMÇÓŸ–rm’æ·Fh¥;ùüÏØÀñ£­ûÅFU ˜Ýß”¢‹|~©Ä¨všZçÌ<€¤@œïëKË…B<õZ >É€æzc<:=°Ô7'0y„”¥‚Æõ]q.Ð@\ǀйžåÛýç€À*´ëR6gõX%¾èYc¾tÍ”ï¾ô Rá–¦â'‡æÌ"üöŒ~ðfch qá_³3º½Í+ÔÉ2=Ãìh¡F¤Õ?[0—Ü Ó‰«`°L€*óÆHÖÅS6‡N Lº¢‡æœQÙç,X kãQ?›•P¢Ä2X‚£`j‹ RqÒ"õ>+™gan®ux‡CQ“'#Ã]¤··Í FQ6ÁàF{Œâ×ïþ£L¸Í–˜¯Ù¯´0÷6”Oe,îÍbC¸`í'i99°Aò©Y6‘‘HFh¨“™Xfše퉹2¸+É-|7?ˆL‚7F† µ*ĸþ¼¨J,pâ(x™ÃÉ0ÄÁU­al%Ú¼üyè®ÉêC*uFÓ¢Þ®· -)V·Ìy—éƒÉ®LRx§ÊÊucwØ™zÇh¼éª°ìÓ‰ì€ùI, ›uBv€p)^°v“¯¼99&;ëDF²·^L7‘îèᕱ ã7÷8Iw&ßéÖ Cãè 5›]`C¿²ë²Ž½5½Æw·9T«Ÿë÷®Å(ÍÁ‚N+ã6s©3‰âöóý†g XùþÏsœÑÝÅu 6„Å{+„‘›‡Òm‡0tñÌŠÏ,b.nÖL6­öÖßWNæ-gÖ³4µÔñzÐZê 5 ¯ºJÀý¼ÝWƒ!±°ìY…¼S¢·ÜUFê¥ëFãÃ+üÞ²ë=ÎÆ„Å¢«¥åÚÑl?cNÒZ3ßâÛ­ÁƒZRΪžAk,úÉ´ìí·ƒ~ÇLLÒÚk181ÿë<^t‹r²Î'XO¾: kã(²ˆoœ¾l é[5ñ9èVQ¦Â›îà­ôÀr¸“L [/·¼Õ>D9íÈ)Ü 6Zß;?È]î å–ö[Ì˜Ü ƬŽq޸逽ÉÇÄez‰`Rs[a #v9A;3 ´5Äû~ÐÅ*IïÓªyõ×±ÆH2b¶îÌ FÝ´§À_ªó€ßüDàŸ‚hLrÞ_Æœ]¿s6¸é‰}·Îþ;¼ì k%êÿƒVX|8íºÁ2؇vø„ºùz¨nð,^;ÉÕÍŸ.Õ ,\FaÀ†Ï!_é@fܺ­k”=I®Z »åSò]–pÉ% ±«_¨ð´¸ôu€ç;XZ£½Xr»?Œ{6¸¿&®·ÔëÖvφq½Å±r¾.$@g’ë—by’)ºÍ¹_r¹sq;÷C™.̸&©é‰xžÊes™VÏ ƒ캽WKùb‹©¿`ÐAÕ"Ë$bÇã»ÏVîÊg–úÀ¼ÆÃжÏ\ÊB¢ú܉[w>Q=’™ ‡Ïô¾TdtamºâjT$õ°ð4sç^†Yó­Íràç-ÆöÄ=õ•ó“ôH„µáæE`kqT]¬™œwì/Ô”µœãuÒ¢û²•Æò 5×ÓÊ%Î_»­-7üJw¥DÉî¿B±ÎȦ™w\´WÒ±3¥:‰;¾‘•]ë;9 Ì1çcó©ªþRÞérˆ'äÚÎ>INm7Iòròæ‘)›C Àlò]jˆæq G`•IÁý'j,ÝeBÖsžå6޳±, ùœûŒaƾ×R—Wx,ìþɉã’;Æ#g]og¤Í,ƒÏoó3!Ì|(Gánc-Mj”-DÆ“cÓ›Ù+dMN(3GëÀ¼‹þŽ›u’£ÇžéøÎµc£)BŽB]´¹Ó·Ì fœÏ4KÎgS5ü, /W9¦1%|^ˆšÞ'8Iê7G9›Z¾/-ö¸²Bœ,ue…몧÷üñ($õ!²Ƕ#Ó”â•(L¥3ëŒ/ß–œý‚ˆÂ/v¨©E‘Áá¬ÿU ŠW)sïuj»€µò°·Ö…–&ÿæù“?ÀŸÿM]Ñendstream endobj 159 0 obj << /Filter /FlateDecode /Length 6134 >> stream xœÍ\[7v~ù ïCºaO¹x'“uGØ] rVØÞ<´fzFc÷eÔ3cIÿ>çÂ"««GjiŒ¬3Õ,òðð;WùvÖwjÖãùß‹ÍÙw/Tš]ßõ] Ö÷ivHì¯Ï”1¡óqæ‰3cáo¥fÆt1À¿ûÕÙÕ™éRœ½;ëgímßÙ0ÛœÙlRy²>{ -¯ÏÞž)âh–ÿ¹ØÌþãpeâ,½š½º:cnÕLEÛífÞÚ.éÙ«ÍÙ/óПò.ùùÍâ¼ïú”œ³z~'ÿ¸Ç?TJªm«-þaú^%;¿^œgà¯0wâñ¿,Îmоú·ÁÏŸS‹µ ó%°àS´JÍ×4Pý|3jTï½Å!ƒyÌ¿ƒ¬™©Økí™[ÝÃ{z¾‚á©óó=¿§€½ 19âRôx‡/F­{$ó›–'Ÿ[gFt óg8ƒ>¹çß` Û+ÉBïòt¢zD>Ày0©wÌ9HDÙôÿ¼úÏ3 `VÖÐ^]®Vbdã®ÒøÖ_^ýýS•G{ÝE×(š•§6J 'FjL~‚SZ)¨/]©>u.qOiŒ»(l´ÊØ®:W–ÕêÅâ\iÕ¥4ÿ·Åy(;ÿmq¼€Lp™2µ.¬b2,¹øu[¨—…Ú Ö)ö^1ó? {mæç0 UðTÏÿyqªŒ{k`‰OŒ™I‰Ê4‚Ñ®³Ð%ôì‹Eãêû¾7´ø#Æl@¯ú(ÀLEÀœÅH²HÐóàá÷ÞÏð@/¾GRé°­ƒ5ˆ¬ÃÊ¡¨"ŠJ)7ˆ0ÕãShëAú½‰Ø¯JÐ,.rŠý9òÜFÃù]Äuá…Vó,€ÝøW°x‹ÿ>A¾ˆ ¹ ó[X,|kYI`‘fk‰ž®êÓK\nCó½Ò àÿ»ºô('ï_à‰KïáøétB[z0ížÔö0vDóOdMè Âëòl3ñëŇïZ|™…@Ô§Î2jÛÙô”wÑ} ]Õ~ ý0ÔÏÐî§®APÐé }ˆ@Û(­ ”î˳‡Bí%ÐXËÜü(hXŠ}%—Ußnq=ÙlKæ§)!3q²Qv¾wQOŠY°u"W—³>šÙI·öü ÜÚ³BÝJêˆ[óað{`ŸÁÇù{z L<“ùéU}úPŸn+yQÜ×§7õé®yMÙlÿ­G j!¯Úäwˆ¼®ä¶U­üô¾’•ÜW’…êy¸Œ˜Ÿ«îæûв¯ñ=$)"Oèü=‘ÉMÕïU}º¯äM%/jgØooiÊd4àÛ“lA˜ª=­Ê;ɵ€Â¿úõ ¼1„̪¯‹sdÏ™aô¡ª, Р©ÅÀ,¢Ã·ì3¹®$z$†¸i°­äËJîk[¥Ö´¶˜HƒP|BÖÛº.õéúp ÇI ä*/QÄIœº¸ƒ0õiÖ¡75°À€ L6Ñž 4#€M%S­sÿº-Ô³æÚŽß½ãgн›ÖcŽF|çÜ“ÚSÙœRÇOŽp]ÉœDt¸®äC¯ëÓ›J’™B56 #‹¦[Z?¡T$«{HþPÉ}%7•\ÖÎ.ëÓ›J®'É]eçëI¦åä„™Š4e2„FÕTpxòyÅ$`·;ûGO,O»c¢õÇâ‰c9üÜ‚œ¡xr‰Å“¡óͨ¨ž€ Äœ_Õ:„Lò%»+Aïy|¬`\ÀyPQÍó‘%„”в•¢kغ©…Q׸u É-Öw@$½s²µä{»3á¤D3Ëå‰Ë*ûq}srˆìé„ríÁX(è¦iü~]Cúìša„Hö ÛÔ·¦Hƒ«'`FŠïºÊk­Pk‘òÌ‹•–’¸‡ϦkOßp ‹ÓP M±èävP:“bÁ’#X0“ÓÅœY¿ÚVþ®«¼îqHˆŸ ˜{3=Nÿ<Ïÿ°û=Z& \&|} ÈVU[Ôë¼j”;^0ÅIކÊÜ«F«1T±qN½&5.&Ä:÷Úªx1^×UðRß༠ÐP¸Ù¯ké&tx¾\Õ[ n6O°TŠåBL¬ËBSï¹ÛÆû@¢¯á¡ï !εPD² :Ô£Ê,Mª$\áèQEþ^´ØñêÛÞÇÁ€Z0¤“¦‡0ɲNBæàI]Þ@W÷O®vªköºS&Í,Ä`~Ø7»ªê¢û“{ö ¬íS!*•CÔõ®ùæ@’Û˜½±0hÃD³™‡Á±dí¼6é,ÝŽwWzÐûW••‘¥¥‡`ó–¹VÙÇЈ‡#~¶]Ñb%ö)Ø2HóHƒ&XÃ`›0…ÒJ1’=–V7y§'µaCÙŽQ#—Šr‹>†&>YUqÊÖ#gÜØQSµaË.ïÁ„0Ú$ª¦nÊ&(” Å0,0ô­â“öÓŒØÝëØÉæõ–zѰ·µõ„g þ¬˜‘îo=ƒdÊk­Ï5@ ÇÙ¹FÓø¥WÒÉ2‹&YD1HÏBebdëdô`LvwЙ>‘{Ëæf%Zpƒž°…=¤æ»+¤c‡~äÇŠ©”²y» ¢Yk uǼ'‚"$Ï!†"e]€­O7(Íĵ×NìÌb…«§`ì ¤jµ"ÓÝyVDöö‹äü.Kw,äDq ¡O†ñRŒ×ëm#üÒü²ŠŽ%Á€EäÂ"P9sÉ À$Î_8‡ñ*ÀyOŽÁðVr”åë:ʺò*dà„ 'Œ€Åþ¶P˜À{ j]¨ÍįÛB=›x£¶»Ô€AÞ®V‚Þ±"Cpî3pAaT^e`‚·y5X®7¼.RÉ»J‘½t¤ì„fv®¨¸Í*"5F¦Cvä§=°VJ,¯T‹ßQ-ÀŒtÙcEÙò¹†àÂ^0pûJ‘ÆÇà›Ùä—8Œ‹ÎÓˆ-¹w9ÄW}ÑÕ9ÜN$¿YÛG‘àºh n&Vøbb… uY¨U¡¾ŸZkL+#I<_?T›°¡@ ¥ÉFÈ9Itª*uòŽÖè ðò2¤îxI-c’Í~¶0^ÖžKÊ¿ íbtDOŸèÐ)ú¾cÒçß Ly×,êÛj=Êk0&Ä™„´ˆ}§‹Fs•;v1 æœzcd{RBTˆÆd»ÌMH-”ÇA]V ˆ[iMFS̘–Þb]™Í è,à{ÉsÇ„>¡2¢‡rZHåBÞ¨~ò/ñÊÓä  pP_Õ§ÂˆŠ®…¬¥1܉Öm&À!2²gÀÆ\ÑÌ-Ä^;Å=ó™Óƒ$áíQHP·ì&Y–âżv¨±¸oÒëVä7rJ[æÁIîgpqº£ –y‡1G¬7 F–$?ýJèP¶t^7¸år.½`_KÒ¶@ˆS{kpÓ”4—joët¤+ʺ/a¾Y0æ!Àƒ‰šF¸œòV™™Z"¨žéýu5á­¦¼Ú}¡ª÷ÛM¼qF!“ÑLèÀñ‹ØÝZÝáG-]D,€h–DpyPÁ Ï߀T^“ä}k»ã%-uÒ‘qñ-üÍõ"lÓD0äŒ×ãxÜ0ê\cäÙoë[Û¿*ÒþhJ€Y#ŒÂéž#|./ù±ùGaõók)§ƒôô¡†Õ¼]Œ’ Õ;<Žq"ö¡ÊK‹kÁy­žrÑ$Û•¹K€×ç×Õ†mr#’¹‡l•öwH‹yû(ºñË<ðÖÿOÑ ¦òô0“®l¹›¥>æ¨@é ›ÈåŽ×Cëå"é®Ó¶à:ñÙí¨6ìc}@Ó•°˜Ð W[ƒ‘âÏurÆîÈ<ƒ’(Fy’=yÝ“ãÝçAbkóþ©*ÆÅhìì–E¯Ü]R\ ÈQÉ75Lýf˜•kL¶ÐÄÛ a 7ˆ¬ëA\@ìÓ@r)ìÍØE 9ˆAªwÇuÀyËkHM×uV‚¥åг²´·ÅZ'ƒÁ’˜Õž—Ê'GÕ¼!ϲ£`ádz{ªnrFžG"! ïJ5^&’Ükk{—28f¿‹©jƒ 6D1øÄA™'sr%LµÀ4zjÒS±å°1èMðqßü7Y(@iK½†ñçIÜ ¦ÔÕcJ¤xX×Ýž»À¼”ÃYGÁèîu]N]aÞ¡\LKÔ1Èe¤„5Õè!n'{/T™­k"€„J¿æ?c­gì…; 3“ÐtÇ܇6 I%52L+^Isç‚6£^tÀŠZ‰¼5.„²‹*8ò‘§,r\AÒûªÉ8[Hšx¯<=¨ŠhüpÎ阀VÄcIdÓšEáC ~ÔËcki);>±øir-MzÓ”C¹ŒÂ: ˜ÂêgSÛ9’ìµu<Úߊj\˜ÁǶիõ$ù ´—ѯñ»!*-,§ ZÞgóý¸>:<ýkõ&2„i2Ô¼+tPçù’ª*nwj53:÷†ªªê ªª¢`ew¿d î½1Ò‘ˆJrc¶qÑ%™•45çèM{ÆeIÂ>T LXínj¯u!D'ÃÊ53Œ9!ZIŒ~±–û+ù:­c:nhÈØ8DÝhI½õøů< ÆL n׆M2=´v}Ù‚\T%(û‘Ê)n/õôä‘2ëõC”úr.ì Š¢ æy·®2Þ}øTCH´H[þ¶ZBÑòíy6´kUÐ$…û ²LÕor<ªü&ò° Â]'Q~F ±/Ô4`è$^;Z Èß Žxyz,zÉ`î‘l©ÇéŽãóGÜ ‰1de0þØK¶\JòÅlsI¥âMÑšŒzD™ddòh¼Kñš»xœóc·Í#^sðÍß”‡¥ #×7”@”Åßz¸Dœ>ž!²AÅq8`&Qˆh<ÂÉ7qìT‘² ‹hŒcåÖEM@$3ÍÆtéŒÊå4¢«r<¯1‹´„^­¨ìN¤ÛGj<—Ì´KÇÒñžl!êÑmuaœ¥lSô¶V ?ÍÓ9"»UD´=ªN¸7 Üð1J‚Õ·u·B">£K(˜2Ý•µwiìkð[ :8Jk{e!QÔ‹XGô¡Š4.§K?ôÕYÀϪÚ"> É/Q ÀÄü¿›>† ›Øý '“Úɪ²ð“€(|±p'ëì{~”=º$Ó8#ÎPe‹÷Õ/EÎIêm<²9Š>ðC‚¨Ì¼™¾§|ÊŸF k±VFtKnÐ+7Fgž´(±®¦Uãfš·é¤aXRr ŒU}Àê®òÓŽ-^ù‘@û¼üè$ö`®y<×öû¿"Tø½Ït~,ÃJb-ŽÍÔ(Ï—eÍ!˜²:Ë™’´É}–#ÆëH™‘j„ø%]þ° 5ômÂÄf¦|Oâh:½«¦}œ¦º@•è6‹Æ¡Ý#9³6ôK[ëÒ[ï9ˆ`;}ù¬j:ŠøÀ,à6ÃhãšK í\j>‚“6%˼0ª½™HÉd0ðÝ Ó”L!©fòïµ >±A…›š)„#ÅÂQÏçà/4H}†_îBê—sE· ó|‰î¿À³Ê¶¿àì/BÄDRC“ʆOìNeËÇ”>Ár¢·Äò$ÇGG8Ýüm¡ uS¨æ >Œ«ÄäÏ Ã:ÑáÐòª’à kmäYç7•ÜTrYIqù·|ìùäÃyšŽ0?éñJ ¾1FóIwˆ¤jl9Åjl9üj(§ ¯TV(OŸWrYÉu%7‡ ,kg&ű\<û î O‹ÿ™Ž­Ó•d„ aùøï¦žùG…¯jƒ‡Ñ¡`E°g¼&<O³wˆ£¾ùé]%ÅýÏS€×•œ>!,î]xQy8Üà;7Oxq‚[ѱ}?i¾-]‚ð¼hÿ²¨ùºPíõÜn[ž½(.nïéû¶¸¦ð›oX¶w ÃtØ@\ñ¢vö«ð§'Ur<ÂfÃ]Vrê$Õ£žjxÁTŒÓvô»)Èw6-[ªWý qãé&«õRšÕè~ êBÄklèLÝVeÉ WÝ×KE–xáU¾¢pPaܶ¹¡jâ:‚ýB^V+H—4‰{†.› Nä)‡÷¢ˆëT.*¹¬á•ÊuùNž±âR“» ô‡ÅÔ•÷²í©¸°wØÏ¸Èät;<¼øI7G÷`ù–¨ÛzwÔ®’ ‘ÐNð}:&åš8UPÁ¹Û®Z—M]lq_Ù}%÷µ¸‘âýÈ>åkWöõ2–YÂåpGËТ£‹±F8H@s³|¯Êëút]ÉU}MÞÆ„7M6´Y>©7ƒ|_%24 ‘{ºúí¾6x_ÉûÚöëzjŽ3t%כɫۄØ.'쫬ðúÌ‘E%Á`˜OW?ä¸rˆ&‡×Î O!Ô=ÿôQ” ʬí^ЃRA‰z‚Ã,_|ê9±ëÑjð{Û™Ü4‹? ã®â@\…rÁq‘Þ·Oêš}]|¨7"µ7˜ŒèriÒ©+ êÏHQ§ âÁ͘œ¢*Ìε‡\}Þ?fn¼+¾‘š¼ùk¸K®(ª7zqðsSž]j;ñÆýpÿU^§ŒƒeƒŽc@á8x[Wða>늯q•=ÈrÒƒ òk2€šW“òQóS.ÙlJ fÄMbÕ N¤™¢AËÌðôÙè~±“øzŠ‹À”Â/>£6ð¨Áš›3åî¿~úlxÞ#ØdTŒ`#®ý’°~æ£q÷á%l»üO‡ n…˜r/Ÿn.¡U‡Íd˜=«ämC¶(:Æf ®²­dƒ¢ñW~ãÚ^S5Ríçòl®êç‚?û_4— endstream endobj 160 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 7506 >> stream xœµZtSW¶}BXï…bÀÊ‹m O¦$ôÞBÓ{3ãÞpoÂÝ–‹lIG’{/²l¹ ÛSÀ ´0H€@h“È}æzfþ•d“Ìú™Iþ¬ù‹µ´Ð}÷ž}ö>gŸ+TÏ”@ Í_¹nÒDÓß&ñƒüàüÛBO¬}%ïH±z›ê7oîÛ«žŸ´†>BèÓs÷àclø…PS?äÞŸ Á)óCBcÂwøúE:Œôå0iæÌc&Oœ8ÓÁ1È;|‡§{°ÃJ÷H?ï ÷Hò&ÐÁ)Äs‡wdŒÃÈY~‘‘¡ïO˜5Þ=(b|H¸ï‡£Æ:DíˆôsXçá¾ÓÛËaQHp¤Ã*÷ oó9Ç›_燅J#½ÃV†xy‡SµÜ1x^ÈüÐa ÃE,Ž\"]ºsY”ûòh1ž+c½Vy¯öYãë·n‡“ÿú€ ƒ6Mœ4yÊÔiC§ÏxoæûŒp9jLŸ±}ÇŸàÖÛš¢†R«©aÔj8µ–z‡ZG½K9Q#¨õÔHj5ŠÚH¦6Qc¨ÍÔtçм¡‡ öõð;¼Âº#Œh‹‘_ª4t8 ù¡+Øô"eNÄBžž€=;¿µ‹Ùì¿AÅÒUêšf0B»²Au´Ï0#½%ÜP£Uç«5’ÃÈÖ è8§ÎÐÈ!Ã>È B¹@ºY{öÀ8¬jUš–ÄЫ!!GÖÈ`=ŸÏ"+|Ó KEÖ|;y«V©Þõ¸„¼/ÙŠ¡è)‹+i,!jRÓÔB Ù{·eï%28$A+蟯œ¼p¾`Ã:'üËïn‚pPíb ÷ÀØœPæ¯[ óÀÙ-d%#¾ñ‚ÆCdV´øÐåÜ´­ëŽÍ•‹z´×hƒ$wÐé§óžÙŠyÎ÷`‘ŠnÔä´q¨¿èiÓôË·ÎÀBÉ£öiÅ¥ p¹?á6~‹ëìX-º¡‘ùJ:«iñ _¥ìC.",BöüõþÌëXX(Y‰o±x€ÈY™Ó(A5h ýCëø% 6Í.±æ2?Q/¨»ƒvÝòÈŸEoŽx‰û⣱ÀìÏcШïß#1‡Ã°3뮕¡‡ÃÂYh†½p¢ú`íá¶Ê}pHkÜjÜ`-xƒ/lºJ]\ƒ·cÝá#5vŒ3Úœ|Î4…lÅON¢oY쉦ãIhšñ=’ &re OVq©x˜ÃL,fÞ¼“ˆDíhÓî³Hð`"~WÇi@Q L)h+%(™.ƒYF$¥r[}š7öâ'x5ž†§`7`;ÞhDcõ¼}k¸Áæå%TzÇVüÍåû°i<Ü”‹+9rW‰ø«N¿î¤îV·kj Ž)›~K€Yt׺á `PG,þ÷”ˆŸÎw×()£Å%,Š ë©?ÌÕ³S°î»p†£§·n¨$¡Ô #pd‚±C` î/~&lê˜ÃVÓÝ9ìÎ`š…84­Aëð 4 Ï‘à7ÿæÀš“Èï±Pã™è\’[p`MÞ4˜ X½ÚwkT躵ïØùê®ÈG¢t6»ï RÂõ¯øþgY¼øßGÊŸ’ÒÞ­ÄOë=Î03CGã·ð€§ï"†àtöÐ×3ZÈâ!4Ä„H#B™·ê¢QïËw®}Ù:u#a÷,Âî3FÔ¸[€?@[ hŒAk¢Á7Ùî8¯‰ZQU¸(œ‡çƒí»ˆª{H?-˜.1 òpÑ4YàhnJY$ÁŠÐ8¨]_Š%ŒA‚¤Vgºu`ÍêøË‹/ïÙŠo Ð×,êAc‰)Ûf݉ý*÷½ê6Mìƒ6ا0a°“vT4KÐx"“_äh@¥áª¨$cB*ãõå†Â††Àz7N|cø.Ip#u a¶ÑaK˜ë h˜AÈßê˜Åv~-ÏÊîÔŠš´7‰pöÃ#h6oèO…¢& RÝ£¿ËïxF²ÿnÊî ¸ƒS)æHÀÖ<'ÓóÓ+l á¡CäG¶âÈ mdõ·ã`>³ÙÏsö ßS_GsŠ"Uf20‰#Ávt,¤d©ÕœFšòŠƒî‡T•„Îôá¿|~AÈOE÷ؼª²ÕŒ‘ŽT«"!¶kbÕ¦gÒ-ª‚Hˆ†eF†ìœk‡{¢y!®Æ¾f/”r©œ”‘ žê yÉyÈ”¢áÙe'hÒ‹ 2ó2ó +ò¥úÓ¨'¿Ó(Øz¢Q÷„èc4’°Åi£|1œöåÚ wÕ4‡èB¤;\¯¬~ðÓÕË× $ê\²Ýn†_Cï/†ódGW¥·ÊÜa x›o¦¿‡D?R},a•›üÐ?жü¨±¨É–”„%…`pÑD[ÂjVécÈ{9(Ó'â<»‘¨!£P¥,ûÚ½ #{«6+# ‚»£jRe~b–¼ ('zN·‹té…ä`™Ý+,8dÀFµ¯eÅQ(T ü‹]V‚6Õ„ƒ&;«øGÔl÷nÉ”™>²/­…LkDúš‡“ÖÛ´ÞØö͸t•´÷ ãèÞl¦g­{0•g‹¿’œ w¢×†Ëeþ‡²8äLC+ìõmñÚ»¥t039/ ÒÅÖÔ•ëj Ó·«%µMG €9rÊk²Ä‡8¾Y±P±"hîŽðMàʼÿ4ü#_™ITXÓœ%A±¿­F‘X‹ýÐèN]zb‚¿dÑrHRÖÊ™¹z(ej¢K#£¤‰A.­¾GÏï?uªš³æ×Öø¸Å`rz›'LcÄ(˜E3n·Ï;¯òmâ<ò HdÂÊ£êjte»>›³÷C<`¦pNü¿ùÃHB× ¨O~~2(H•+¹àñË’|€ó§@Ó$Ö¯FvéÊ¡Ž¯þJˆä£Ø½‚ŽÁ³_{ ÎÃÍãÑM#4‘n9Új%|³šFò¿õÈJÌ"|µ/mnfRuôµSw^u«ªEûi{á/Ðò[UñÕÝÊijEaª´ÒyÆŽ þM½ Õ€Î‘läßaó L)J…_Éð4+ƒ(û§ŠÔƒ˜‘7töM‘ÒírH:ÐQZMÜh îµÓ3$¨^¢îŽio&u—ŽçûÌ.¥Ñˆ_{æþçßRÒÁÍn5LÏ: ³XüýHdbö8´ÛÐÀ ÊžØ&dQÊbƒ¶¹HÝL®‰Ø¶_qŠ˜ÃÍ™úC•Æ='H¡h7ºÄ’sÆ0f“a©luüÌ:!Šï˜Ì¦ªÔÑd£ëE% S•¨ªjD3‰2:+]­Ê”óc;ŸÚå%©U9ÀCN…„?B×BÛsÂP?ÕV¥?øÃVŸ…ÔÏÁ9TÒ9‡¶p.¨ÍÓÛù1åb¸™t=Q›FÝ5ìæy>ä%Á);YÔ Òk¡ò‡ O‰ú˜ Ãñ áÜÀ£ÉÀ`} +òS5é)Jyª’ó> ’a xîŠl ú.B3‰º\ZÓ1£F@Ü£ësa‡7zÌ"7<†ŒËðb<OÅÄÖÇÑ"´ AS ‡¿Æß°cðÀoP1*Dï~vç>¶çárüöŒ ktÚ\lÑÔ»¹zêyññ}!šÏÏgCóÑGµ%VÂ%eÄ$B8YU[_¢«nñiܸpúÆ!¦gÞÂ7þh†¸ŽDFÚ2í©AçMCßÔö\ˆ¢Ð%Í¡>ˆúêÙ÷#¿ÁoKðËߌòÐZ¨ŒEU–!ðM![yŠi¢ÇUhÝé»UªlêÚ£®£y×›Ú]OÛŠ‘¡p4— ϪjÕ %InaUÝ>`îÈÈPU@|¸$5)2Ä“‰ñb!ªÊt{Cö+*€yréÒ–¸–ð*Ióîæ¬r¢ª,Ъdé2Hbb‹’Jó+rªÊ’¼¢\åîœ{£»V ÌøE‹>tÕ{vJãcüÁwPXämŒZàžÌüÖ#kÔëçc7›Žm®ã6Ö­…U¤^ºAš: s§ˆL†ãK컋Ž?¼§å Vò‰èê Ó6,Ø2Jb¹Ê1ËR`ñ²BÔã öÿïg¸®ŽõfÐóßêܺ#Rª'ù=®GíF2Ô#²šóü»[ñ+‰^²¨†*(Ôkó5õ æ!ê™ßYñ>)y–È>­¾yn2ßaÑ]<‚Ãù4k¯˜+á•®±Û_d#šÿ­”¸©¦{|!–À2ðÜï½ß÷cù.`n–ݮˆ‚D¤¤©$ò~1á°R%qö&ú@ßsÉæÔrt—h»y~KS©’Ò8¿uAõû'“ùM8cÊ÷ŽÏ»*)È8–t9–?©MÛ•VçS–O*³`ËüÁs²ŽläÖžP\P5«òSAÑ=ü:›‡ßµ¦ ‡µVÛxܸã‚ïÒÞøò{ÔC"¾ Ï–Þž¡#œ&¾ô>ÂŒŠçãöË.š’écÂe¬ —y&ã@»¤L[ž Ea\I¦®j™š]HHLTئ“!§®Ÿ»ðˆôÕŽñ=ë#ªƒƒ#"‚ƒ«#êë««ë‰=õ!¨Ï¬DŽ-‚fÊ}€r ÂŽñ3ÙN$ŠÆRÒ¥ŠÑ´’F4Ê -ó•• ƒH†pb$ å<Eûµ?Áaòç9ì7s“ Å»MÝ‘p¬¸<³€ºÈJü‹ñ4ó¥Å\¢°VÁˋ—¯…ÒHjW=ì‚}ª}Ê_…òœ¾ðñ!­Nc›M¾W§þDSIòŸ•”Bck1lF“a‹cñÐÑŒuƽ hÇøCSÞ—ÆCƒÉ#ýð •qZäÁ>]¥᩟ùª¶)w€lÓøþ¦Ÿ™…Ð! •DxQˆv,ckWËè×`×À@ÚhËoªŠéä•Cˆ#ìØ&ìð·Ùâ–ÚúÏL *=Í–}­&̲[»ª2ŒØ¥T…\)ÇË;wÚa'^#/6O¨õ§À`:¡b m¸uŸðS“'ôFñ¯ìr¢³EPš¬¬bÒ¯ýóe¶yž?òß¼ÏþoUÍ„ûŽ.¯ïÁ¿z}~Ä’úW…Ë_E_ !–Ÿ:¿×䩃”*2ÖÂònÿ¢Òù“ _®H%Žîô°ÃSùDU¦2› ûNCÀÅfv¸i<,kNA%úêÚaI§#žÆËTZât´ÿòû×!3½Ð9wvØiS´ÉE@ò““Y„fòYvèýÎlˇö–OMðTßa§콃rïy7t•…/Ó¿ô»¶ý»™¥î°æ…yŒX”>>€¹™“öÏ9ðþÕ¨#p¾¨<ømÃ¥¬›p‹Á¾ø*ëk 1ßÉÎÀcø.ÀÅܨ÷õ<1nc*Fæ;ÁXAH¿X¶<~ìº Ó5¯‚P ÅxP'@¡×„¨­ãM¶4‘ÜÊåS Ȱ¦#j¯a:KH˜I“¸“©¸O¼Ê>¸ße*èIŠ‚“u€èÅ‹6G_ ×G;'¾Á¾|Ž&"îÌ xfD“¾ÄÖØÊqÂd§£ -k*Ü_Sã—ª•‚«úôDËi`xæ[f­_)Á뱿Ìä¯#ìÅ/xZT‡æs”暟–º”Ô3vuWÈà1¼ õúñœÁ¦õœþúàñœç¶bL¡è{»öôe‚Ðí)'Ǽ;gõ}t½Q§¯?ê ñœñÈÅ¢f`ö,”¤\æ* Ú¶C®JUE(Ó U•¦‚dFÜ)“å@wPt»eñ(;.Eaº…Äg:w¾#ƒ‘Å RðoX™CG=¾G+ôÈöŽÍѶQôbÓø h;‹zÏ|†©mnq~¾ÚDëäi ¤Yõ»ü¨([‘•¦R‚"]•²5j xÂöçÊT­’ Í$Cjœ¡c µ8G£ÍÎä J[N|í`ØžSê£ñ‚-Œø)€«#Ü#¼|¶U®;û‰–h‚4àÆ2Cuu¬Á?Á/mû´K£QO‰øÄüô›ÂK*w¢ö!/mQ©þšéÅVüw4Ž¿Çž‰8äæVÚ¬+ÎÏ&-]£V«Ñ@BF@Úü+%IIä„ &-+#«àΨ‡6¾õŸ,3#Ç­ºóh!ÌCäõxÙC[q'²C_±Õ4ñEý›U·Êwè¹xOp ¬Ž×—îÊÛ{Æõ£÷ð›x™ÅÂ$âWX‡˜OðÛ¿’uâÉßa!'î\ >›£¶1¨7¾Î®€ 3ò’˜6øÊ™› Ï–†•F®Ü6µ ¶Äú­ÞNú¿™Ä•ü§7' ß>ò¡üK6Ït×VÉà ¶eQF.òǤ³kKóÎædß„"’OO‘,nHý'áAþXïº> ‡ò¹c4|¬ý8÷DfUñ½ƒç,JA9…ÊHÌG#¢šƒ‘GM¿eÍà·³Ûweì†2æì§­W®^Ø4×¶Õ~œ>žý¼åH;\dO>5qÄûŽãc4.­Î\ARK¸¸§çkƒ§98ä§%/Õ·w~i–ònå¢+ãò—ïcF¸³¨ßìºè¶ Xeï8wÓÌióÏÝ9Ýpáë6 üÍïVñÃMð/{Œ¼šh+DWØ'Û¾6vƒfw(w0·¾ÌQ" JñZrÂãkÄ»?ô‘ÓŸM^¿5ÆÅóp‰t‡¹ ðÍ(Ô“ÿrö·VfpÿÙ8ØçcZà(˜êe[eKíÑ=EMÄø4î(s) È\Û™÷vŒžÂ™øKòRp省ç­ÙÿåºðÍßqbhÞP‰æšVÚÜ{MØüãï¯?‰î²ÄÐÌ^ú+!?ÿ1õÊkº9œ¥µšËQhrsLöúµbîYÄÂ#ÿP,&ùq/‡ ö( «—¢>×L/&ýx'¶&¶Ö7*!Y.çTJ•JŒŠ3r>?NRh"£–ÉIÏL—½7÷Z]ír ©¼¶Æ¤¿ÿd™5o‡µ•¯œt‚N Ñ]œÆó§‰-ÃMZ h y{Ð<Ô (êzH†VžMFž‘!W€²"FòýÈSx `oÀs|ðÜÛ$Z@“gfdç?ü ‰?Ꭱ…HwMwïU¢CûÐa€·Ú'äÇ¡XÓµDqètÑ Á ¨QT QQÀáFÜH'DCTñ^DÞ‰ Z§ƒŠb®ë? úA³é‡F´â±iH8ŠîðÃÙÃ9‰\õï=#/¤±MJœÊ„¹½øŽJ©„„A¸²ýpoß¹]ÍÉ‘:ÎC)8Æ¿&±¢ªªt×'ë[ÇãÞ›±€Ã¢ºøý-Ð ÚÂo+ ß°ÐUÍ^ˆØïÙÍ¿ÒÂìÜ|N£±R«U ËCV¹:Kärrª 3÷ oÝBôëˆQ†NfŽ×—Dû”“hÿèüßi_¹•ø« P©34Åd”a†bÓ0ÉŸù’®éO yòÅákyµRÇ¥dÄ%CÄ䯗ɉÌî¡Õ§¨\ˆêÑjö4._K› ‚¥ÿßr6Ý“Xxv’·òË:œÙ¬"‹™‚”j;ô»7QÍ~»Ö¸zg¤sÁ-NY¡ÀŒÅÌ&LýYH‘Ï^^9¼d‘ýôvë§Gê¢AÍ©èXe”i¦“«ÃkSÈt—I ¦é®1Ä,‡Ç]ôèRÄ1ÿóÿA^Š­©°-Ã^|—ú³’˜²Î3>†‹lr×mf~ƒèãOÃàû'Ø·´‹|Ïîïý¤º)=¤–óR¦D@H ãÊÓk©žŸ_†‚ ²õ"ìQH{]êÍõê9C×ç }^Ÿ>—t}úRÔÿædI,endstream endobj 161 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 1028 >> stream xœRLw½ëwc¥2¡qdãîŒfÇø¡l(N­!êsLDpm)¥Ðöj¹Zq)Ðúµ!¢¶³–‚Ë6)²¹’B$¸Á¶¨ËÂFf‚?¾ÇŽ?V–—¼|Þ_ï½OŠ„‰EÃåÙ¹²µ#… å_ññ øßVÞGÖíÝŸütFćyÿ5®‡æ`Ù:X`(ª?Q'gŒÕ&­¦œ¥·¨èÔôtY"½-%%Þ£W›´*…ÎV°åj½‚ }˜QiÕl5½eg9Ë3’“-K’B_•Ę4»i‹–-§sÕUjÓIu)ÅX:G¡WÓk)“ÖHÎèfVm¢³™RµÉ€ ®Pª¶mOKD½ˆÙ‡Ä ±ˆ‰BˆP?$ q" >öQ¡‚péiЇN?…¶%ŒwƒRm„Ýl=Tkµ5ì5€Þxä&ý³·o‚EFmœb…hYZò‘o/}1Ðåûì“ÁÈËwouûñèûÌŒ´ì¬J %4õÖzàLŸò²xî@ nä ¾@,CæûàÒ¹ñ|Zˆ–—½¯ÚÞ:¡ üÎÖ+ÀMxªzt sZùúã©¿ƒæÞ™D=ä“áá{`Š˜O™0{3‡¶ûÔ——]=܀ŭs’ƒßÞnĵis𢦸„ŽªP3ŽB»Éág ‡ÍQWstý_Þc}üQ ƒsßß’ú„Тp7h1Ÿi5VR¸¿úa¸úÓq-8“A5cΧ ǘcL¼ÉgÄ3@›—úÏä_‘®Š„.\ ÜpÄQxœÃàñN)`€,s_S“݉†–ú–ö‡ó0j’½~¬ÜlÔUuV|ÝÛÑqî)±¸xy4\ºèŠ­¸/rþy22Læ?Ç]‹ç;ÅQòAfØ endstream endobj 162 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 5683 >> stream xœ­X TS׺>1C©Õ¦5µ=‡:Ô±Ž­C[m§ª8âX "S!2@æäüIÈ@€Jƒ‚¢ˆ8ÜÚ:õ:´ŽµZ{moíðÚÞîÐÍ]ëí€õµ÷ùÞí½ë.VÉÙ{ÿ÷ß÷oÕµ Åãñ3.Ÿ7)ôÛØ`^ðÅ.Á—ø Øö Û¦ {‰zzú;/-úÒs'zñ¡W×Ú_¢û ÿz9ŸF1½)>—š¡™!I“¥oÞ”14nXÄØÉ“'ŽŒ7fÌäˆi)âôÍq1© c2Ä)1™ääˆe’¸ÍâLYÄз23ÓÞ=:;;{TLJÆ(Iú¦©ÃFFdoÎLˆX*ΧKÅ#fKR3#Ťˆ#:ö9ªãû IJZV¦8=b¡d£8=•¢¨ÑÓR§Kf¤ÍLŸ‘™5O³ 'ö]YÜÆEâÅñ‘›–$,ݼ,qùŠä”1cǽ6aâÐa#)jµ˜HERƒ¨%Ô`j5„ZN­ VRé(j:5’ZMÍ ^¥ÖP3©YÔhj65†šC¥æRã¨yÔxj>õµ€zš@-¤QÏP}¨¾”zžêGu§zPOQc¶TWª‚Å{Øez—“|-wÍ ›vZ0Up§ÛÒn§é¨î+{ôêáîÑóÃ^Cz]xJóÔýð©áWŸ?ýKï=ÏD÷™Þçd_ã³ô³g…Rá½ç>~~êóûeІ‰ö¾°ø…@ÿîýçMám @kÁé<´õn˜±QdÊãÔäÒj—ÑÁ¸Ài»g¡Êd‡Ã½ÚKakIžEÏJ­rT‚·z¯·æð~È!(Å£­Ù\Ö"N¤Èƒ£M]Âî‚=¶¸NSQLJ=°Õ“ò5\aµ™]ÜÆ3ûLvˆ” 5åËhœÜ>MˆÖ OwâOÃߩýAÖÏ Ž<ë>ÏG[Q¥Ðî­;Q·£®f§gÐ{Š%â%1X³šÕÉôrÑëñGþº±ž%äœ1×ÀÈ$®ÜtŽÉS^åªtV°jB§ïFú–OX·43‡Ñ·Äׯ͑“ Û¬X ZU¯ÅVí`JO”­Ú ¥YnT²Óñ³†3I$/É+Ûé¨n,dœÛÜMö {%X‹öÑámé)?ªðÚzÝç£ÅŸ5›õšE@gåC޲¼,úF€† §‘à‡«‹>ïf¨øþcø’¾1ãîÂàk‚ܼŽ7–ÕøA¡3Y¶›„§W¸Ë u B/ e“÷Æ„á8œÅëð}¡Ô ±ZŠÀf+ù3ÚÙ- ž}ˆbèèWqW6ú§Ã¯Úb̪PITØr4¼2€Ftr%á ÿ[ü´P›¨7ˆÎWZÕÅl!Øm—á”™\y¨‚<‰*T¦©ŒR“Š5æfZé[±ÝBjû>J±XP ò(À(ç r#“ývNö$ _œAÎÂÝíÐp½FòNž9Ëc9½YE6&/g™ÅYfe*Ð ‹'ŒÔ[Á´KBèÉnØZW rYkÖ±XÔ^Û ¼(¼Ö¡/ÜZeƒ ö”à>ì7Ù€vÑó(AÁê*ȵ¨,™6€ ÀZPJМ¯ö¾…F\n" 6î4zé4?88ØM˜ r™'¯¬`/;Y³÷OÂ<ñ–"Ie.ãË)2ŸPùŒʇUtÊ–wpi¤­EÊpA#i¢­J4-=;fÙ±ØÏÑØ&Ô£õþøòD']¸Ù M´Ûñë;ëó“‹™p$ÍÝ;€B"Þ‡Heup€ð/‚²âN±e' v£A¥`»¨*Û®IÒ¦hÌÌF<:l¬@âR ”²w³pÀ zP‹"›ýtExŠ•`Tp&•‰¼.;èt£Ïç·­˜(Ê•GŠ2é‘“`_a‡¬@¶­rç&i“É s°ß3e.ˆ"áTÙÛ.î¼Çº* ÜPA‹õÇŒˆÅªGô)/`ÊOŽ5]^ ’ej¥šLV2U2–ÓcÎ¥~XuÀvü0Sºº%;ì†j_Y]åÞ’ã`¥CBŸ ¦t=“3Uš˜´vÿºÁ1½üQ誷~telµrÅʼD3aÊÁH·é€ÖP’m€ÂhVsF÷ooÐÄëu³A${dfÞmV éÈgÅ\½¹hg§™É’%àu"xÈ’êG˜L¾€¢¾â˃]…gRÜ ©$[¢têz¦Bê”@-ŽÂ*6 .–î/=ZŸqUùÿ ,)“Óç¾ »’v ½y Ý<Âü¸‡]á]ÁîB‹ÝVDTÕ«*ÎUfi$Fº+µ2†è@üŠŽøpÁÇ'5WW²…ñäÖ?Œéâ}Bm¼7#^§8²÷àÔc[ »÷Js‘¹3EÔ¬IÞvöîÛƒc…h%QfßÕÏ8E.K‘Êh‡Ñ¥á$&Ð1q‚Ͱɖ´^9*geK9§4 —É&½¾Ÿ™ã8­®½;nîwwÕ; OƒÈGêd7æåf™9‹{ t°Æf&Qþ£*âÚëÿ¡¯íÍV‹‹=)ø ü$ÎÐŽÎæ&g€×îðÙzG†=?5+=eíió€W5S߸¥èO¢ÞµÅDñTF“ÚÄ& Z˜• t²Ô×ä+n-¬gÝÍEû‹ö{O×ïn„íP¦²rÓ9¤>Vìc‹<‰±›3ãÒ˜¼ê”=ÄPDâ>iži³¹mlÝ·' ÕéÀÖ-ñÙiþ†ÇÌEâ<Ôë4’_ᣳm¯ ;ÕJå\>7PÓOI~œE`ö´‚^c0åszfXû œI›D£Ž.øÑ$× @Ã:ìs½8-CÂ8Úiẜí{Šöoÿ†uÖUVWùŠÝÚ†'xcxÛkØ3 ø°°Áá¾´KPNŠîÖhØ °Þ C@nÓ†Ðÿ§EïpÑàrAXˆ\Câ~ör IV’3IµÌæq°Ozä?šd9Þào¼Ýò{™³y,( êì–ÿ§e®¹ÞWZÆh6ªV‰WoI§DÃH/Êßî·—U¾”«J3å ù«WíßtuýëO_T1uCµ·ww&»´{üàêàS ˆ-/Êݶm{ÅÞÃëvÏÂÏ‘˜G‚Þàós¿Fƒn}íq©JtzάÖ0+潕¾è• ªú‚ttËÓõP ûÍå›é_Õ¥ƒ!¹õy±çtÊŽèß—ýaÙix¥JƒW„e>l X‹,ÓƒKÍèAfšoâèBÄ1tJŽ­ãüzHQfÌo_Ú‹ƒ•ÚrÎ’EöÝýqÖrÕ‚¾2ä u¬*ÚlùÅUÎýÎZÖåPï{B®]œ¸axÄ“€y†$ôau<4êAÐr—ßv-8Wˆ&EüˆâTœHL(}ˆi4mB”†ÔLûío ǽu x¿ /!>{æ»oŽ“ðý幄@Ëð˸G±áè6鎒[ÁL’½o•øyéwÑõ»|´d{‚²’Gi² ô†I[vÝÝênmKUr½,2èÔjCÑ_u]ó{Uï ÈÀ}Ä:FŠya³:1e’s‚9øïy ÌêÜÅ"}¦bYIÆŠb`·þV?3’×·J÷üÔ„¦¡î>’/“H¾ÜY‹N&Lý‚n sB4E€XÄüŒÂnϸˆ{²øüï3´IÃéC)p§:N§Ÿ"…ꟺ…¥,›~MÞ?®œÌœ‘"ŸÇ®Z1˰‰ØíËRbšé C-ú¿ý9;W‘m`ò+$õQä4i”—ñ€!§–\nh( 4²Ò‰ù1úŒÔ$QLt4È@A!ÍUå±n'S¡ôd¥§K£ÎéO£¾—®œó22'Ôlš?•´Ê†œæ–æíóµ°ug£ O—¼™gäÌfMˆxåW7êP˜?¸5Ä{ß“üx—¬wQä ÄñoýDžx–’Æ”fJ„lz¥gÅ%Ô«-(ré:µIcäÉä%9© †œ­º{4^V&Ü\:³P‰‰+Š|ps~ùõ82 Î|…ÑÉ=6è%ëW¬QY V{A%ÌO‚Æú]MMåÒe ŽÓ›XŽ‹—GÃï¥èçŽ[?jRxpû'œÑ¬£HéVTzK‹åž-;Ø4¿Ì>®Êh][¬µÆ”dì†fúÖ§w|¿cöÔÄÐŨÈtêk¹éÒàÝî"Éy~°{Å·\’•&Í-–Uo«®ÚÆàè¿Oª¢¢§/9¨í&KU±½\2–™™ߘuèÖgg?÷1 v±W€ œ¢cq +Fâežì¥[‰iþÛï6 ËJ´›:ï+ÂÛ ‰sþ¼—¼”êœV§Åi­ƒ­@³Ç0CÍé8 «fèœÅD"¹Ù¬¬baN«Çf÷{<[ïd ô²Exv?±ÓÐ(O–-p€­€±YÁZXs ªõ¢ ¶A©™S‚ɨÀÏ·ûú©ãôùc€Vu ¤F«º´q ö°W{aŸiÏãaKΪ¹ ·äZ2l:+ÙÜ$Ìó'èࡤküÿ#˜ Ý4ÞÅÿÆá¶~)D‚©ƒŽš_ûÝvû{%û0(ú—‡íÏê$ "$ÆÏ<˜÷-z‰ÐãùŸ·“rרým½ð¾ýWÔ«w»öÑl¾¨%¹¥²ÎÙº)ßí9N‚è£ÖeTî¼M¿ÍMá¿ð:ö·;Ä2tÑc?/ìt£'=VK”%…}pd2ë<ùJÓ{®Ÿ­°ætóžòÒ@EÓB!gE‰£ÄŒöò’òuð:¬]š“ùŸº„ y„ÔßÖƒ˜møEt‹ôÒí B¸Ð`üÊ„)Q//fV¾‹gÁd:ÖŽ_@¾¹qéÞAæýoÑÛp›Æ§Û³„kãëÏÝ¿ˆŒîZ¶doéiÐûš%³§¼ƒlšÇn˜²"'¡Ã‹H×$¯‚Ìhë#´:,D.læ"¥ÖlÊÓ2Q³—ˆgêt¡zæÒyEfgý^?ƒéö±^=DjA.IœE嵜°“EUÜvsÕo讘!Å¢´¤ÛŒ!º;­.«³ãŒWÑn?ÚNŽùf ÷£ŸðÑ[·„‡o\oj(GË¿ûà"üH#Þ”³£ðˆÑxéÌdO|ó­VÔm_•ª^¥ÓêtF›Þjd¬fi]:uãÐE ]qå…Û$E=ÕrT2: ÷XÈà1“¢ñ+ä*7z¬Ö’Æêð¾ßðçîΪVÔK÷zC“+ŠIñ•fS¾‘Íš½:n%$Alaš=Ñ)v%GZÁÀÑ—µ•hl <¼J€{­¹±“4ãËqæ'²—(˜$üÜ›~™ƒ  ‚æ½W.\üõB èu(¤;î¯t©³Ï™gà>¸ÿª [Lf•.UIö©så»Þb—›©(Ý ~¨":Ög+œÊÚ„d £;Hc÷(fjPW'WNù/—”è=j³ŒjVc’hRÀZ0X:à® ŠünïÙÎCÏ\B[¯ñ‘}%üBã­^h‚­ GF´Á´ ´tv‰Ê篮hùpmõÒ·^]7èMwÁx ÈéI; žD „dBÔ’‚ºáðÕ«3­cváÏ„±âíWk_¼ÆÖ4·8ôMx#óÜ3m5«Î^?mJ餕ÁJÿž«<4,¸LhPs锼"p9ìdhe¬ä EåG¿ºûþy(7”exÓ=²:ð‘9ÄãX>aüu£ÞÂã31Ev*õ*+› w—0ÇPƒú 9^_Ç%^q>hUÄ8µLrÌúÈU†"ý.Ý?†”uuþ²µ.oI QŸÐ•œY©#£è|l«üeYÿ€Z±FœEW}JrPW@ã/£‡HyK,‹•lÕFÊ^¨³éò13¿3œ§dà7aÌ,YP¾®fnë"/i§­ýÍÿû€|W—TgeÓ.¬=%Zc0j ®@ÏV'™ x8àq3ñC¬Ä‹åJ®Ã³:üHKÄ»1÷Ñ;™¯Ñ”jô&|Š1!RNC|!Zw>ÚP$Ì2wÙ–,½Ñd"øêZW9êKJ÷tS®/iCº85»8c—Ïiw¸˜pR‘n”i)«à înWz2=ºN¬èÕÝoïÕ‹¢þyS=endstream endobj 163 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 4095 >> stream xœWXT×¶>ãÀœ£T&#bôlØP±%1±¢`DìÔA©DzW™Y3ôj¡£ÂH‘rĆ^cI|¶—è—ÜÜgKÔ˜èõƬƒ›ûÞÛƒ1¹y_Þ÷Þ7ßÌ™²æ¬ý¯ý¯ý[Ƙ `d2»d¥“Ç GÓÛÒ{2iäi”ˆçë{טb;-µêq)± 9X˜µŒ´¾m·†¢n0ú aä2YX̾%aá ‘AÑv}'Ù͘;÷»™ŽŽsí‡øGùz‡Ú­ôŽôñަvÚ­ó òN°›8/0::ü£éÓãââ¦y‡DM ‹ X0ÉÁ..(:Ðn”d¬¿ŸKXh´Ý*ï»7 öæ²$,$<&Ú?Òne˜Ÿd(Ã0㇆- wŽt‰ŠŽ‰ó^ïãëç¿:`]Ðúà!3fΚ=çý…Óf ³šYÃŒcÖ2öÌzf³ÙÈlbÜƉq`63K˜¥Œ3ãÂ82Ÿ0³Wf6ãÆ¬dV1ÖŒ’y—Q1ÃÆŽÌŒ§Õc̘Dæ¹l¹ìÒ€Ë-ä;ÌÞ5ó0ÍíÌ{k¯Ø"Î’ á~¸aà¹A%ï,y§Øb¹Å·–JKÑÊÌ*nðÈÁaC†©:aè2IcÕÛ "Ú‹’k¹¬­÷°\ í­J©M†]™iûˆ¾ï§á鉚´…ÀŪÍú“†zhóp\sÊb¬ÈjgC‰>«P¯N¡¥9V(>#öæ40ë)´C+<€¦þÀÉ,y"«PAêÍI¼Âª×šæ}Ñ`´F}x¡ÂFÙIßH*rÙEÍÑfh¦y.jèLwAe÷º¯4VÄ.äIÕŸ†³?ol™0eÓ:^y–,J3W³ÊÎËyà'XI·Ò[%¥QÖ€ïb¾+—Z0T…#¦¿ Ç[2äÁüç݃y’OÜTD ÈÜï„Ó…²ã'*ºáœØ]X`+7C”¼UïÍQz-Ê®âTIÓ-ïÍë¡*ƒ‚„T­v_¿|ÍÊSŸZ¶Ä@¦’IÄ›x#½¢W£9F¶|Ÿ~WR*ìÒ ûÈb¹ÊæÃÕî—Ô’¿„Gp> ™+_|þÅý¢3t5ðta%QfÅëµUÀÕê µ­%Ù$âh£$ëñmµ~E«˜ƒïÚ(¿Ápü« ÊôúÒÒÖ¶3¹•À];¿ŠX“ÑÎî®{Ôpn›Rz(ãæ›µvìm'ÿý hëø„Œ[´igB´ |ÖÍgSiý…>ýŸUžµêͤÛÙ$báYNÀ18G”÷àa•ZCø°™d%pÄ›z?z-DlT+§zMæ7`!:(pÔ: –œ¨Ø‰éæÿ”©‘éû–0ê^k…•Bo]‚c7ôPhÌ+´2e;>R¡9K>úue~B?mšô†.h†«`ìgÝl\Â*ïܨA«ç¼N—°B9Ÿ†¸ºº†ŠÖ³ëÜye§3ønŽvã¬zh–*+0]ÄQÃðÞyª¾¿¿]eõ è€n@tô' ïaÕ)ö‡‚ß@¥QP›±íL ªì')(+isºQz¯Áºù„÷ML¦/6”Ÿ(ª>Ís-‘»üʾlÝÃëõÀUCN•ð5k"Q¦âýøˆ’À\_àBÈ4 6¾åá廄ÖÀæô;{8åCcú—IkF,š1£#n·'ó¥°¸(HˆŒ‡ÔCyØ_Áë¡r–¡+ø ”WÓíÛãšÊ;~uÁ¹óK8+i}z+þ—ˆ Ëe/)‘‰ò—Òh9ÌÚݹùUç…ÛüYµ»,8*l-\­â±ŽŠ±ÇõjV7aËĉ.€’Á:Ýp–v÷¿ôv¼äzK5ŸEç\s‘]¹Ze§D;tÅ︞ë±Éi¦æOþðËÖŸxe|-Ü‚®»t•/3+¤!¢¬V:-—²$ UnivÞUàD6Rª‹„HØfˆÕÓ R³euš4N›™*Žd%ÖšŸ;´3t:*qÛ >ýaWY\ÒgQY%`{ ³ +('n¾ÉRÓ[!ï¡YrJ²ó/š²DkCtQjCÌ›,ݺ&]§Æ¢ÀcæçEE°Î]ÞàmØÝu‘­Ø ZÐA¦)rÙ0| ™}´>:Ø Û A¿âÔ¾Ay»²÷Ö€m dæ|…ÅÃ_‘â?|Gëp>Ý"âê£8ÕhÝ€àPœm*w¬4èŽj'xþƒ?©(/†êª$HVé)º*ƒÙ‡K?'“Ö«ÌYÛ›â×7Tœ8Pcàä6è‹û²É{¡Ä*Å¥’—JƘ‚C®óÊØ¯Al«<ÁíÂ*vÊô¤Hߦdpfé©,Þêµ-ˆÒC±¿äR‚4W…ûP]yè¥E¾šuþ°²ú«VByX“q 3Y_ éSËÃñ62"믙^ô1 üûãh÷=¤ÝÇ6gýHgJ;üÍošÁOÙçߢ©ÎImVºmBZ§fÛ²A'?×S¡ì&Ðd'0Q‡6úKQV)}&ÇŸP§Â8¬¤47ï[°Ù@­».ƒÒg³!ìÍÆ–B±¶x_&½}fæS‡OBÖ¼UTDèÜ´ÁLé³£?ì&‹ŽÄØ »â`+ØR)2œÑç@ üE[Þ/’lB|N®ôyùÂ3”á2ÌÜO­¨Õ_2ƒèÔëZú¦{B*¤QF\Ûó»˜'âi¼ »~c?¡ï™ÈvŸ7Wv§åwo|øNzÙ/ÞSŸñ‚2Ñ 6‡FÅq¹¤G…Ùìᦓu=Tà­€X:«aC„Ÿêã™ Îàwnï~Z—|:·Êšétt¡r쓦¨vkc!•{K’{„Ë]K–-&,í%Û'8 ß?Š\^騛 Ó&eðn[ã=¨Ö €ºÎCUÓA¦DxK”äý°LIrL3rIµœŽø|µãrÚM¸W³þ£ãßÚ.]«¹H‡Ùõ°ÖåÍ+²À2pΜéí²ÍÉ9f#PT·ˆ§~¸iÄè6ë†'Î(Ç¥(‡Î÷l”¿¤`>®SÍ‚kpíÁødÛ6ød–@¬öªº¢Nkk(Æõܽ!FK< =Pa(Òk3´©ÎEL¨­=XV]µ«É3Q­ ÜÎ'{W,¦àÇm˜ïìSîÓ@A/˜¾#v$foi NÒ8Å‚çѳÕè|÷â£iW>iä×Y S ШkÔšbw±^TÀ“ù0‡½(-*È»fRìpM$åW8¸¢ß(vdiòÓÞlô°G†œiIѽ®ªÿ¹žz˜1Í“.mã[ûzÝŽ%Þož6Êîÿëhr¿ûrceÜ‚ÿíhòÿ)f_z´stßìÁÇ=žžå³aݶ`7Žùߎ2Ýo2[ºØQ.Ãd|GŽ¿ôÊU•P‘¢…}©ü‚uã ¸8u¹âôè/–q}¥DP³Y¯¨wí†WoÍ«kºõ pt³(»€ãÐy¹TŠ‘Ô¹kâRWìÙ—’¾vÓΟ [δwCÅß®Šð”Cvì¿S9¶œºrÆš“‰Õ ­•§ÎxHÌæëª›‹ŒÀÝëZ¶ÈÅ™óRxï¤dj|âl¤Å¦”)í 8Í[ná¨æë“ô4dI£èuª’öçÏø³êzÅí p»³ð2ÍóÎü{Õ‡7wÖ4ÿËÆ¢L=ßt¤#¿¸o³VìHÒ›±é‚V«ËÐíÕi÷R Sö¥$Â!¾CAÍú$5Œáž}t«p¬ ¦Ú¸ÎàúíÞá3ž­F.»ýü;ž&†žÐ{´Í¸þ £L”œi‰oÓq(­EGÕ3q²4WqX›«Ó%&óäï}ËÍÕØFdÄÌdO¾ë?òÞÿýÈ« " @À+æý¸/Q1g|„C¬/àˆÏÒNC•šÜS…ì¼Çdbè&M°šÇá쑌"m#•hûïѼ&O[”¬¡¾1EX³)Ý ¦²ˆ‚Ô,^ÜHÙ-N–6Ne‰!;?oé:WHEì!ÌúXP¾v‚ Ä"Ê-ç‚7o4ÔUSìg½öG%º§®zÿîû8„Wþ‚³|„VBÿ ñ¥ñ$©5m «p¨Ž´Qö¡>U•±€ŠŠö¼ýÕâ9ã%*嚪而„pႪÂZZªk›/{_MF’¹sH¯| ó >ns~uƒB~ø+Ž@;ûÛÄRPöÅÀzð^ÈýL®¨Ü!¼%íÀî¸ ‡8zNìy ‹&ØÃb{ÞJjt¼QûqH½Ñú*MFG{ñ¦Él@£ ^>¾Ô\Y^|ò0\áPE\àS"¬v[±õøîš†úÊ6Ñ«D«çkËÚŠ»€û^ï§Þž¶;.NXé¶\962ªª!·šW¾:G\TíM^oõ¸½©©7 :ʾAG9î½û'¿§Ik p[Ea‘‚xæ±â T¼Ã2û Üb`kž…*ŽXXê-¬æ¿˜«Iendstream endobj 164 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 2629 >> stream xœ­VkTSW¾1ˆW¥ÔBï8ê½ÔºhÕJ§ÕZíÃ:Ô©ú@¬E‰IˆBB ’ìò€$¼‘w@å%Å”¶¶Ø:­m«íL»Zg¦í´:'ôvÖš‹èª³ÚNgÖýqîù±ÏÙgïïûöÇ‚æ`,kÞ¦¸/Ƭžù D°Ì ,aÍþzzËÜ%ؽÏ?·$þ‹ª ¡† öîÙ†ZîCÊ{oÆf±Ä¹ºMbI¾Tq@•³nÝÚ‘­^½.rc6_*HçŠ"㸲ül®ŒÙdEn§ ø²üȨ d2ÉS>*—ËWq³®K3ž‰^)ÈD¾Ì?È—æñy‘/ˆE²Èxn6?r6ÑU³Ë&q¶$WÆ—FƉy|©Ã0B$–HÊróäÜ­ùé<~† +û©•–€mñíØl'¶ KÂvcÏc+°=Øï±XììØ,‹Ç"°PìWLA° ¬ŸÂ:=ç™9cì'ØWƒ’ç.™{2x`ž`Þ9\‡ÿm~Ù‚¥ *š¾27` Lh|•>ʘDq“lT€66Ÿ½ÁæóœKm[Uãàû(KÉ‹ÛG/T¥Sj±òð}­Ã_FѶJ-èÔ`*,%µIt"àyæêª¦Êfg#U?Ö‡‚`ÿh‡oϺWjR7"hO… ˔يtõ60áÅ•`óX,>Y÷ŽwÄx3ˆ4J£¢TI=G™ôf9ga½»Öáu¡筌缃Üï°vä'®m;ÿ8½ˆ&è¥ôòeoÄ}Œ!-E¿%i;]Oðöû/Œ6#vÇ)ªkr¸½ð‘Ö}ÛRs— (ÑŽÝ){gN¥wùÑŠ›'ÞfFßOh³´Fž/)…ÎfpP-Ðfm…8lôÃhÈCvxÝÅ Ú öJ»£¹¼†:Š–; šÒN±ÐB…¢ÿ™0’°'5C ¢ŠÆSÜÒ»x¹”:15!#œ‡_¿tðÁÊ—…\ ½P´•*’¦Æî<±øªÓj±–9©ÐÀ:M:©šÉ9ú ¹Pa±"â°A+Ô«hŒB0àê Es¿ªçäWæ ɹJR3ÆófþÂ>´;ÚœeLVh|g/£US£¾°‹WugPØÙ½\þ=”L ÃN\(Y¿,7ÑvBIž°Á1(ýjOžL\?žñ.z¸…}út]Z~ClÏpöÿ¦±aêrKW1ÏE Kµ(Æ5ö‚ÆÚfwÿPZÏ‹ôü´G’Èðïá™sªV=Š®2HàøÑ¦z¦Ú¯±‘'°Œ¸\ëbÚRJj}pŠ*¯‚2°q lÅÒâ<¤<úws×h@QT5ÔåàMt¯¹´T *NrgúÉoNÜ‚t˜óµdþ+éϽ ¸šjPãheJÞy ~N¢˜Iv 2A”Ù-6°â.mµ<['ÒšÈçéAC>˜JÔ…X”½ð”’ÎÉÎÏš¦(gƒ­ ¼øh¦?uÕ:J?[ö²ªrÒéo¹6¸ËeÌ9X,Qñ¨œØœ„?>.:5v¸½½‘¬ÛÙ¯÷B44UûëºÝãLAo¦j6çêIÕvÅKÀs ¥êvª©·R]=YuÅŒ°ÅâH‘_$“Êdj‡Î®#s¬B†Íâ½t9=o§f´s¼ãÓ– ¤­Æ^}—Yf­‘'À^|õ›¢ ´aý«™ ^qëâ˜I´j ™›¡ „NlήÉzrW,¼ç9Õüžÿ#ÒáµÝíMÉô8Í;ăÆZ†ŒG<í'ª÷÷J&à58Ö×þnûTZcøÏ=Ò…K Òr“„i¯ž¬ì;Vait PÇл¯²Ê93é$Lge&¢Þä CØzvrqøè„kOWÞ‘»nÁjº€BÀ`&ÃûÂaͦÐ+èåk†bß§Â?8  ½#ø)ä öÒ‰ZaÜS;€³W;Ñ>êGóëŽQM“C£}Œ7%qMfƒIO…NW€šåg½>ÝÍOè%´òwêì[vŽÓRiZÜQjÓ‘y 5Êàð­‚ÙÒ«A¡©0Û¨*³Û*È/(TªéëôЯ/¡ Χó à4T@KW¦£øfäA:¤Yy·c‹œàõ·@L¥*ŠŽø¡W+Ðk7G9Ã)X©nè³ö@/ô{f‚n¨óè@žÎ »³ÃVGAË…æ}GwØ ÁÄÈŠoV3ŒË×8Lò(ôX» :Œm3áÎòj†Ï%T†¥ÈQäg¤:ŸæV]ò–Õk|a_]MVŸY~M7|zÝÆ}É€¿¢ê¶Y,‡…òÛÜ-Pƒ7(]ùE<ýö¤>Áéï>ÿö«&òïÒb/cx˹“·Çç†ÿU¤KOØñ¿R–Ñ´!ð7z<øM"¢îKƒ³C‹{•ظ‡HÖC£»J—òPK£¯{$µkëí5ñâŸÑý]mÓº´¥fs±–ܸò±ÒÀwJÇÇZ®7SGÏ šªÓðÛSí?ÆšÅ+;pj:†˜ D+ôV­±Øl6’QÚ"³Æ ަª†ËtÅF£Ìd"­.ôKZ¸À¹–GFz©»‡|µ½‘ÚÖÈÌÍøõ;ÿ xpÈ\'®TVŠ@Fs©I«4ZÏÔ&ø<2t³‘)‰vxÛ:ì½ÔçÀíïÙº”~h93¼æÚÏ×e‹æÝžîÊAG e÷ýèÉo­•€÷’¤×AæŒÒ\Ÿûƒ/}PÃé±+’©Åá×ÑçcDÞÚ¢d}žXÀIß›… †,¸êî†?žoN~–Š—Þ•åúÅ·.zIÄ l)¯f(]~“ÒE2­¨” ¿Ö¦’´¦FÐAô<:Š~pÍñÍ ¥¯Ÿ€þ>·?‡ªˆz‹Vÿ4C馋®áv4¿á8Õtj`1#¯U¬ÕR¡hÖˆ!·aèþ3ÇOs?Z@WÐCÄK$y„1XZ•¥¥ÙÓéé¢ÞDÏV¶1örNó›ö¯ÐцÁYÑÙüÅMpd5"‚Ê~RYÄ|¿Trœ×˜vòËNôp9þC@F4ɪ<‰\,­×VÕ·zÛÈPÄ jš8Æú’™®gþ 8Ñ÷ýÀô× ‡Bή£û‡»ë[š» %:‘©„ÚB{~b{Ñã³1œŸýr{%±~olò¾}Ù¤ö|’7`O¦àÕÿƒ§Ep‰o„¡¹ˆE³Ð.šY‡ƒ¤o>eƒX˜™™SWÐ|ØßÙN†O~ˆþDRÖ‹YÂ,Y¼õ°¿ÃÏœ1ΰ>Av6:‹/c­î2»ÝåøŒ"é¤`9£¶¥j“Þ ˜q…N¨#Cs}M.t°¬ÆLs]óü ¦’ ‚ÖÖ‡Ì÷U„„`Ø¿‰É—iendstream endobj 165 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 702 >> stream xœ³LýCMR6/øøø‹vøÈù7B@Nè™Í‹ ‹ ­ù#÷k÷b÷\mq€Copyright (c) 1997, 2009 American Mathematical Society (), with Reserved Font Name CMR6.CMR6Computer Modern1234OÂQªøˆø÷‹²øŸ²·Ÿ÷¥á÷ûù©‡‹mIK%‹g‹d¥‹Í‹Ç§üj‹~$`dÂًËËً‡½ #²`$‹˜¬ø÷‹å÷ç÷ä²Ó÷÷•ðø®÷Of‰}I|€„…:‹}‹ûO÷ó­¦ä˪©©©´¾‹Ò÷ûÔûû16-X¶…–¤¨¯¡~«_¢¾È±Ð‹ôÃ=:D\BEKûûmŠŠ‹løGø÷v¯Ê÷÷¬÷ôÀ¬êõ÷÷÷º÷ààÄR%ûI[Bp$‘Å^²›¥‹¦­s¢jpmza(÷S÷÷(îêîÔSØû ©Ú¥ËË‹ÝÛ-Çû û 2U9`¬Ÿ¥¦®ªupº¿æ‹”‹¾Ës8Tl+'…yŠp‰‚‹Š€Š‹|{–‹œø÷‹²÷²øXŸøÞøÈ÷8²û øN¢‹’ry‰ˆ‚ûïü]d÷Ë;j‹7ndŸŒéŽ·‹·‹éˆŸŠ½ #²n7‹—¬Û8ø&ûÿû§v øCš÷o•“ ûa–² Þ  7Ÿ «’ Þœ cÚ-_endstream endobj 166 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 6541 >> stream xœ­YTT×Ö¾ãèÜEÍ`ô¶XbO4¶ˆbTì¥)½÷* ™ÙÃ0 ½÷»‚]ClQóÔX¢F}橉šbÙ—ó¿ÿÌ IÞ{y/ÿ[ë_‡E[眻˷÷÷í;¦kF"‘t›³dåã/Äw%â€.â@©'Ñþ<®#©Û@¦—í¬Kž63)˜um`}¤8Ê«{¡SoF*‘ø'Ì Šñöô ³±y¤õ„©S?m=qüø©Ö³ýÝC¼7»X/q ór÷w £øY¯ Üìím=b†WXXдqã"##Ǻú‡Ž ñœ9r´u¤w˜—õJ÷P÷w7ëyaÖK]ýÝ­fŽ5~›èæb½$ÐÍ=$€a˜9³lç}<7d^èü0»ð‘®‹¢6-ŽÞ¼$ÆÍÝc¹ç ¯•Þ«|Vû®ñó?aâNšüÑ”©Ó¦1ò}³ÑcÆŽséÁ0ƒ™eÌf93”YÁ cV2ï1«˜áÌjf³†ÉØ3£˜µÌ:Æ–ͬgæ0cæf,³™ËÌcæ3;f"³€ù€YÈ|È,b&1‹™ÉÌf)cÁôaú2o3<óÓ±d¬˜þ̻̆cÞbº3fŒ?Ó“1gz1½™Ù’îÌ'4)LWF-‘Jb%wº¬ìrEú±tW×!]Ó»¾èV&›&‹g‡°QìYΆûñ­àîû?êáÒc—™­YyÏ{昛›™_í5·wßÞísútíãЗéëØ÷ìÛoßçñWßYõNY¿Þýrú}k©µd•Ú¿gÿìþgßµ~wã»-z °ðbàøsº,xM(•æÛÁ€ë â'åqz‡ŸV Ì‰hP&§Å‘ÐWw-ƒ"\¦çÃnÓ…RØ pPyÈlˆuÖ—C=dC†.¿-,±Fv‚ŒÐ) TVþk!Pðaïh3à8œ ?5ŠaCbŽbGöˆù<ö"_u# 3ïAì­—à[WÑÿªTŒÁü×îÇpšªÔßÉȰ„n>ì…­)rRÌ:)`½|¯vÔQ öÀÞN‹)`¿°Ï¿:xêT‘ËbDÿç½æ)ÔýSzl2Hpäüú±´­Ã†÷©d¯e$xÈ_•²ª„™B¸8Z†Â“¿~{sæ bQ(GIÕ™ÏáwøW¤¿@ìÉySئŒìÊeO÷Ï\>ÙL"“ ¹Ï;ª²›äXŽÎìã“Ϙf7w˜Ü\Ô'6Šƒô’†û¸ÿ¾TT¢7C‘!–Är(aˆ±x9ßFþÅ´ˆ‚¬æ×€kmxsÈnåA8;à³Æ½µÍ{Ê[áì ©òªsÕ¬Íà¨Zè´Ù)Ú8óŽ­†ŽáIû31»IÚ±¶c_ ¹ñ)ju|’°n¶çÎß+âHfIô»N'“Ðg`´Bó\ȉMP¦%ªåÉd,é=gp“ÉÊ#؈•h÷Ù·³#³jåšdMJ!p%]FݺGì ø¾^Ð(AéUl¼/Åb2‰ïLÌT¶uÝáämÀa_ìò„zgñÞ÷¤§ÛŠÄµëä§Y2Ò˜â¿èR]å¯ÜÿMÚlÄj¾jס–3À];7™F—3eš—cÑ!_¹¢4PF>B¡ô MçðûâĤþ8½eh‡Ãp.Á5ä=GæËÉà_„Î\‰Û^§’•]‡s¾ûÖŸµkp€u0rñl¯M‹Ü&ÒàŠ'sµù>n£¨ —ð2}ŽnhZLkAºŒ"<±øi8öºt`WCµœ|òŸñh‹y<ÄBê–`¥ö[¼›¾ø>2(»róÆÍ¶i«)^=(^O°a»‡=@Fi‡ð~²`2*b&±ŽŒ”u®ø1û´ÐÿCy#–ûÉ>Œó!ŒÂY§cƒe8 *–•’þ\£,#»½ºçS)ë RѯAúæDMfMæe”Òd.Æ(¾lD滌ÔôÄdãüªãÊ«+Šë›}õÎ VEêç22øÊu§ö8TC;dÀ9“Ë‘¬­*o;õiõiŸ÷vúäÜ(ÿÞ1ƒué_M’ûÉyh…˰ßt‡/; ›å˜ö}’ï7©ÓÙÉ ß‘ÂXÌxí¬• ?‚²Å%¤uÖ\ü(Q/¯‘4ÔcRÅ)¦¢HSBl¬ R'%)A *HÍŒÍ Ès¢ñ´ö³Ù°¾%@«”ïò¯J?¯hMºó9·`Çqï\?/¤¨iÓãb!9JNz³±X¥Ñ”• :]^N·S«ªÖˆù}—?o ø‚ô¨”'g¬ÊM¿ì°‹k¨Üó-vÕM Ì4ÉÙÊlàŠMµÔq%€±Qn*àõ¤ëÐß•©ûB0°ë”°\`¸ii|šÙoµ ù""a“}ÀúÀU@MFìNcVã¢O|]mÉÔ¹&Q“ú¦^QÁþ¾!¸X°gÅíFò±©!lÀ)d º]»[Õ¾K^Øä“ \>äÑ:Ÿ@ÛWON)—`—«8 QŠKÅÁ<Ž4‘¸ØO¦¿iôX%ø ©eÉ[ßD8¿ë³/…~kØy~îvp·Xèdžv6Li¿Bħ|KFÞ5¡Ò ›¬TÁ2ºT0Ùäáë&1ä Æ°²ë·J7!æ3º2àŽ 1áìLU^‹óð Éû³]´¡Q´ôÚ÷†˜ðžhË¿¶-;iíâY“Ò÷ð6KF!”åd;Æâ‡¶_ÊÑ ši2™ÛÍÀÎOÎ>(Ç笹Øçu‹ö@ЉÔçÚÜBµA6z3—.L7ySÍÞÐ&º½qW&ÎB}d_Q;¿ +¾2ÙÊÎPæî vžL¬û$â2¼ÉWŸh*hÑpÖ‹Þ· ’`#ø™îc›U9ቪ´ô$Ê2:KÒ«S 2¬j¶C E–‹r#DAlßÎ3§@—Zä£ÈSËì-Y´×BöV]¾‘^:ŸÙ1oó9U%ûÚÏô¡Ït_zs~Ÿ*/˜ …2U•2šdXÅÚ´ÐB¦Uí6M5}¢›Ò!œZêÿæ‰ieöãXŽÀ|ufzÝ[·JMÖ9Që¢i+èÜ{rÓó±?yn™µE›T %™§+xM–/H“.>3¡¬Š!3733²®Cê jõ’}·0àêeÚk¦àaþÉèCã§Ìö]à_]«/+¯«ÞR®ZjŽQuÃ8á6UîÇ®PÚ)ç|à³|¸I?_¼¼÷®JAç^뾸Ü;™“÷[ÍnÚáò›Ãü¨©Á›×:7·}~úŽ×QÈþ[âEñC×áìÏÛjª4VÆ8¨`-õL :}+W—&ÑzNVÆGůÉKüüÿøÓYäQ†kIyn|V(¬½ úµT;D9é4w2’'xCÀ.#ÓQ«%ÔêSÏë›ë› †ææÚ3Ælmv‚4XþaeªLÄC|šB·x¶åŒGŠB£B´‚쬢ã‰ÍÊU`Êàël_úÈÒŸˆ…åxë@M6*+¶E›M©1NÁ¶Ncâ3²©Š,Í/Ôêjêjëo´,£þ§@rJ\¨š3rê~(£›CCç¡%¨ nä:«X®G÷N"k2YÇB¾Sq˜ŠùÕßÙí§«½[Ý/€ÕyÒgèSb>ÃÁ%:F®]ÄÓ«3ŠJë[Z+öS͵ӯܿ$¨Ð l! >ñÜèé´1Þ‡Íæšàв×Räýߥûï&šV ÙBz‘EÀídi±šm†ÂGÂ6ƒÌIiK ÕîßgTÜ+3ª½øƒ¤â®”Öúm¾ædK®áM­»Rémÿ¦2êU…±Ô¶TuJšÂš¤Y‹RŠhL3­ª5•´˜œ”.´ì~WêG PUâŽÉÏ–NƒüçÎ.$6äÙUyPÏé#ŠÂ#Ãâýœ÷z»ßö27S0ýqÇ7e& äõH*vñIéa à‚Ê"õµ¥ §ç7Œ!ò1DJz¾ÏF`ÔŒÝóóãA™’¦NT )3†·dbŽÀ¡WŽ]Î9 ÑÍróŸ]^‡oT“xô–³;FðÉåjm %å¿jƒd66¼Gñ»_Û µtµ¾–ì{ÐV+õ¬FƒºW$‹¶‚B°*]¾.·vH-5ên¯NÿZ.7´F´ÑÖ7~_.bé›’#Ë‚@¥L‰&[^µ¤®C£ÈQ/’ŠˆÖ|vNFlåŠ+‡2™Þ­Q–õ¬²»Rö—ÉÈÞW]R’T*H²ŠÉ£­ŸÉJqM7?Y"á¢I/êUÙï¡JCÚtYŠ·Œ ö5åx²^;6–¯¥[-ˆÔ¨-{}? û´Ô7ä‹Yý+͈?²6¯Îó´ÎÒ·Dnv Ýް¹:´%hgÚA¢OsvW5W·ì׆6h mXËuærs-N1M%Ù¤â*ö*³ ê¾Ã 2ˆô5”ô&<2Ãi ûzY•©ÌOP¥¤ªäž£&)£ip¬ð?àÎB§©åsÐúNu à[IiÂ8s¼fj$¨¢ƒ^÷Ëß}#ÅUFÑ`f ½°›ìÞÁýûŠsÒÕ™BtRZ ÄsÁeQµu¥eµ{]ëígM\c-®S}n‘˪'y[ž2 xõ™“ñ eØ {ÜxþdÐ}2TþJú+„þ´g*±ÇòÎ¡à™ m€Hœœt!6ÆIŽ¸Ö£Ý¹ëõ˜P/ihÇäMíRœ}‘÷Ó†ÔÁv¨ÎÊÉÎÙ²3­¸§—/^ß³-´V^˜o¨8¨IW¦¥A,]_ZXB)4¾É9fCº«£RêV²¸¶ó>ÞXëU)Iö…PØTîW³6n“8rs~Z…–h]ß8æ»Ç§DXÞè#Ë~É…ï*[tµEåò’*}~páýp´à-ô¢@ß”hàZÉ,¾ûÁô53G ·9p¬¢¸ýÝybÿìb#vÓ‹´¨ÛÀ©z<÷ƒTlÝÊ?hÆÞÈÚqèH> ÒО¬'ÈT*ðC2í·5ér…Ša¥“÷¬ß>™…q uBŠZžºÔ!Ä6¨àjß+ñ)æížûp‡©8è!J‘Eá}’D,Ü3n™àö`CÖ»»9FeÇf¦ÈqšŽ÷ÞâŸÜÚä½úªú«=Wµhç»Ssÿ§×8®òÔøHöûV_ðÿùþ 2BŸbÀ6=¶úÑvêÙ÷ ýúÆ‹ø¿^þÝI¸Ë=%}o’‘¹ño÷© ÃÿHÒÀö=Œ}dWÀà‘\ïK5Ï|X .{<özœH«îvù­†,(ˆcpÓ{…ÂH=}¹¾ñ)'/’.Ma‹i‹À,Ôjòªµ9šmPÜ7h d8‘N÷,7Ç6Ó€‡f(5¥׊¯øú°:Ÿ€à0_¯úˆÚæŠúZŒ"Ki:›“J›PÉoxŠ €ÖËkŰ0]·S.2TáÞ‹0tŒj´ŸÁ'g¤'Nâm< §¸óŸž¹‡³«Èdw‘ I)x=îà:Ó(’¬R&¤^«Ö_T´šŽ"=>˜0Ìf¯kY”|»§!™»‘EJƒWnB78póìmÇÐ*”Eyª ¦÷ĽÃ֚ư­šŒÜl!3+3G¿ç̪+ñŸÑFlñõÓ—÷VÞVM}¿f$Ó/:÷|ôõ>’zßRãçêç]®7TÕéŠr£÷_æÑcÅ¥¿7oKx¦.^Èʨ(=WUã·îDàé¯Î}$ˆ±,UÇ4°/wIðãäÖ1…ÿEE’HÊ …øqU Ž¡z¢¶ªÊÒ5‰½*a½ nˆàî#kÑ"{é¢?ZLug‡§\±„…*ȯÈÌɨ§§éU!…äcÓTkÔh¿˜äa çÂçGöèjŒº2TGµµÄiœ3:5š:3R!"2&9• %œ¥ÄþaìÔ£zºÜ(w~úÇì…cZ¨õ*޲*Š(Ž,Ž,Œ¬†-\L”R!tª°ØA½F…+Dgz¶R9´‚¢I‰½ Æiï2_ m?˜”ˆÀœ:•Ȱ!XNž°dÀ°)ÃÖóF\$ˆfª~ßbÉìmƒ±ÿs슅N|cÄöª}¿G²ÑÑcÿà¨ùÏoýöZ2Àø%í¨¤­å¦×I"ç¸8 Vˆ¾´²|!ŒÇyñAÜÿžòÆÁ3çòÖ­þÓ>óß쥌¡ïè®—ì¾U÷¥b^âáeÂ9Ÿ³ÎV¹Hpèi«AÇÚ÷Ú¦˜}%ê(w‹=m¹¤½ç8FÎñÞ0¯8âyÂIxD!p¾È;^ñãõÜh‚‹1åãóWÃ,Ú––ÃŪˆÁóâ|ŒoÅô4bÛ ûÊ%¨¸!Åó|J$lÚl:Úø¹ŽÆøÓ:îU.ë¡TŒ¼|d»µwa?]÷`·É /v´2ß8zëá~ÿü‰Arô9†}+Åftá‹‹öŠ OŸl?ã°ÇðkT™Í?ÑagJaEcÑŽ#ëA!Ô_>_sr^ÛŒ†ØÚœô!ï((^B¬D¹¬çSÝ¥ŒL^¯ˆJM¶X*¨æÉŒk¸L©hÇOŸÖJ®üˆ›¨rÈÂ{üC+‹O<ìWÏ*?ê%ß^SeØVå³yôKè,eõðÁ÷·\V)¿¡o¿_q_M89ÄzÚ šØÚÆòÊúßÂp°çø5m)pµW“‡Î p‹•ûû…©–¦G©“ÕTîÄåPQh ö3ˆN4‚—¾”ŠBÇ»|9lˆW«ãréÕæn>Ø<…FHX'œ¤ë „±3•”@n¿0 bg‰ÝøWÝH6kòìùSœ§GþN~¹ä%Õ`¤h-¶óé»÷ÛâÕ¿å¥hÓ¨>MK’»mqT¬¡™u(òËOÔ©@ \<$DËÉ–NòÅ[µ™[uB~ÑŽÃwè¸Xç˜Uâ™ánà¡^èå¿ÙÏ¢Ýaç´ê,: qúÊÒÆ–€‚ÈhßD— ×ÇS²·xñØ('>ú‰t_¿1ÖÛÝÛÑJóÁ®ZɾǘùHŠ~ÍÃíìËÛO5:¼û -ÐÊ*/'Uº7$pþU1Õ¥õy;>s:8È©@µ$~¤ûØ=n;R°w¿°kgÓ¸Ça¿ˆtŽ‹£C˜€<ù’·Ÿ–-ú°ýª °ƒ{zìʵC Á^eB…°ëèrŽô vô2½@§&Uˆí·hÄpn´â >'†º’#Ù²ðÓ„d¬ÍTç(‹9?™7ñ¤½=£(ïbáÖ<Ý—”9ô’ %‘‘Ñ¡d"̰JÇV:ä m,àÐjì~ðœé Ý©Ë'ñÓCR¼ƒ¿ð'ê.‚ëÜ·£Ž4ÉvŒGwM€P‘©:íFz¯²…Ué‚ÒÅ(Á^Oo¿8ã½'¶Dˆ)Vk&ãȸG|@Ih=4sg.îúËõ³ösW89,l–ð™*”Í-I(N:â ˸™Ó6LhsêÖ—'Ú/nLv4>¾¥P[¡î;©8Ûx¢$œëŠˆµÚÆ a_¦Ö¹\CXIht@‚ûü›à@| öêPÒ}Ð8ÒðÇ`·¿ìݸZ ýçóŽPÞÖBÌa*uöÔí®Ù¾­¼ÎCýmZ…ƒæcˆäf¸ŒžhêÖ´þÜ)?@©Å|SPe wxP ‘›*l|¹ë¿ü$ö8ûõa ôs8ä•”‡…+œ×§&«ÔÆ%å¤ê ®ÜĆôK«}ƒü+‚›K²´ºl㥢•éR ®¤®ó0ÒÓÑÙ•Šv%¨Lg ïÜÀîí¡7ú„‡øÏÖåäeeÑpN ÚŠŸW•K~:'Å»DËo͇üLµ&¾@N"ïKÇîÆøîá… è8]zvbìúuIÉ4nÄ:Ø1öˆØá€÷¹ßîD%½ô4jyø6eK°»Ãƒñ7©¨O¤u:¨òr´&VÛÈ" c좃÷€uŽñ´…P‡Ó´)¹Å‡çl°?ZëÑÐŒróù!xæž-—ˆýHE;Œä±UVX UUá''­Ø&+„ʰ0HicãÂ!,¬ å4öm²8¯ª‚ÊB¡SÓ)Ïüq­Þôº%˜2ï÷â<>A*5]@ey%²§[N74¤DÕ*·äM¾µ±•…M9»®m›<’¼ã`üü¬Ë?M|DÓxg±{²®rRöŸwŠö7¤HpMê²"üaªÍ'J%Õ©x¸}ÍŽGÙð•…ùZ-ÅÃK\tN’ÍRlÅEü9Ò¼í„ìk¸ÿWÀçÃΤµ‹ã¥¢GÇz^—™Á$æÆÇ¦+i!ÿ3=­ócÓøÜÄ‚âÌü|]'ú(žmË%×ôÒçb$O¶Ø·G§-=“”•7yé¾¼Ú¡µ±ºÊP]ï””šJù÷ßælSü#CŒ£vOé]eßÚ»O›i…4j{¸Äø>;—kƒ€Nú®'ÝþÏyþÓéœÂg> stream xœ¥X T“×¶þcàϯ¢Öâ¯r«ÿÏ­Öy¤¶¶Ö ¨CUmE«"2„™’æ! œdF† ADAq¬¢ÕZµ¤U£µÚÁ¢¶új½½÷íx]÷ž$éóv­÷Ö[‹9œsö9{ïoû;P(@@{z}ôÑ;–O³Í¯ Ìc˜Ç ³q¼¹ãù DZÔ0ÅcW?Úug(r"'×äWÍ£‡Cí0ð… y†§4:Aªp8Ùuö»ïÎæê6kÖ»®îQbYX ¿ÄÕË_*ŽòWA¤ë‡ÒÀ0±"ÁuÒüP…"zÞÌ™qqq3ü£ä3¤²…“§¹Æ…)B]׉åb™RäºT*Q¸®ö»öÞsFïoOiTt¬B,sõ’‰eŠ¢æ»K6zH£cdrÅòXeœ|Àª„ÀÄ q°wÈÚÐua†G¬ô‰š5ÛíÍ9o¿>ï½'-š¼yê–i¾ÓgøÍ¤¨×©5Ô»Ô8Ê›ZK­£>¤>¢ÖS“)jµ‘ò >¦<©éÔ&ê}j3µ„ZJ-£fSË)7êêMj5‡ZI­¢Þ¦¼¨¹Ôjj8õ*åL Xj%¤^£ÆPÅP)Wj5Ÿr¢PC¨…ÔPjµ˜z…Z@R@9Prê¾@,¸6€°cÀ3¡·ðžÃ‡³Ž“³éQt±h”(^t‰b. œ0°pàσ¼íâ4ÊI3ä­!ùCç m6cXþ°+¯¸½ryø˜á‘ÃM¯†½ú¥órç2ç+#^8B7â'Ö—mdïœ12xdÝÈ»£Œ7jé¨DsãPs#2>0škf‰LæoÙŒöX"Q"ÊÂN=5£ÃbPx¸íâÿAï2 ––h$ák8‚];ËQýÇÉÆcf³Ø™.i;òü#ŒšÖ( c ¥LïqpÎ(øÙÞ&¡yaŸ~|ô]÷Í*gÈ© äÜé$‹ÅTŶ9®ª¡÷ô$>Óoí?y¬2Ö›ÃòpQ²”¬jD•5Ž„W ‘, þ+f03}Ї?ž äˆÇa8‡ƒñLÖÓëÚƒ.]ºvíÒª9³¼Þ÷´˜À2#L}‘%I¡XÆÚ…~ÝÕžx1 |ú8÷_°Ã–€Di0)ÿÁžû 4'°ŸÿäÂÕóËÞšµlå÷à{'9Û‰‚&¨%ßbËj‘^,F±RNÚPçƒì4a ~}<èoNœ*(àqÀVQš`ž-ì[éEð7vÇ"÷•—¿ïþªËtóÈb/Κ‹N‚†)&ð|(%¬dApûöNÔ˜Y…˜z]MS}¡3×ûÈd¼A´OUÎa-C&ܹÈ._e6°ý•îþu#”…æ%fW¶5†+²Ó²r¸€š@¤ ^,Œ:ãïI÷Sø3·ÒÐ&&D5Ç+P÷¹’Ë®ÚQ.AŒÉx7Q2’¶”ÖäJ¹SágQ- ÷ÂÝ?Ðgî7ñ† Â%åËÊV—¢ýL­¾åiw~D‚šÓDÔ£2Ä´!½¶ 猫À4ñXñf sèÊFre)Jæñœ;´5ʲî½w¬±´€û[OcÊvµÛxé«}”“®’åq¹!Ñbĸ£Oëx{\g‚ ’´µæV÷¢,ˆõAÖj"uØÏŸÍöÈ•¶ ²­R|aéŸÍÒ/œìçóh¶7g`‘`z¾G²x!jjâ`·èåy =ó’äÛÓm•Úzn§D*sã°H¶žõf…å Û`DÆfªŽ‡/Œƒ Žu¶íd¾Ÿ4hpÀßUˆõH‡\tH*Ú˜~ãUæl¡9¯k샱%F/¶§}q›cSŸÜ©Ú›|&»*‰ÑŽÄä²·rU9IL½ÚÛ]¬/¨Ž?¹zär”Wž®ÿA]®Ñ^V§…ë35-I‘¤\Zžì/—l"ùM Ö2vêóû?,êt-à¢Ôî¹’ÆW—çivò݇Øý:Μ9Òq²óð6Ÿ þ~>¼/eàé?qÂû‡¶ï?tº—Ó0¯ÊhÞaœ3A5AÐ̳»j‘®iRêùÔ=…)þß´Uí®+û¹°Ñq:” x ^á]4¬iÕ uWQQ© Sç5 Í€ ì ”ÜœÑ™yÝ@GÑYt­äxùY]m7z„jcËVoAîh+òCâ߬yñ)ªíŒÿÍ’´ôšÌŠ<µ1)tŠ)3ª¢Õ¹|YÊ­é×è}ü÷²L‡/÷Ðùÿ_©«.n0B Œ¯Eáa:dåœ f8Çm8p }Î|¿àÄá¥ÿ;åH;ŸºIëP=2ÄÔÅ툖¡Ð†ÐºÈ–,‹/.Ý…23%("ßž’"CÇN\BE™»9çT•>i·²ŠÁ¯¶²K!à ÝݱÎ××Ýì~²¹”¶ˆ_1Êäú¨(¹<*J/7ôz‡½°3kë=܉Úõ¢ã¶²™7éÞhZÐ ‘Ó× õšÐìc¾Ù«S·‡‚¬ØÖ´d\°`¡Ûº– ’ þSÖăªÑçSËsô±ÕI•äÍÆøl[¿Ø K~Éâò´yµ!}j;÷ÊÉòêü¶Rîx¤Qõ iVƒ¾úñÇŽ¤#á­¼¸=²èíÚàbIQ–Z\¸—ðÄñcW@´Ë-r'·3º•ÚT¥µ×Xü?ñft þðýC†÷L QDŽĄE¡Xº¤wæT”^žR­Dyˆ‰N ›ÿ ‚×;€¾Á›‰^ÄÅÊ]4á.ÁE!|lžœÀÁ±ÅNfM·á¯‘ÆÓð_á‰ÕÂJ[äöÈ·ÚåašÝ“á:}û+pÄo8ƼxÐÂ@›y mÍO Q÷&H&^û’®Ý`wþH;^ÃÝôÄU||Vu>å »Aô'«ÒxÄÃ7Ÿ>}ø°6UqUg_´ìFÛGQŽ‡Û¿¶ÝŸüßrC¹Ù(КӅæMä~Í{úªa¼U8‘RàßÇR×+çfosÉ£³;”÷R;=áÐhC}_'o5¿5Bî©( ÚM´„KÚJÛûûˆàÔE -?B³ΰuf‡$‡Åpñû¥"ï³"£³(1Ö³õh/;Eò¾ò¿oí>rÁƒ§èÞácu¥ŠN©^4›kÿ§%ýt­$AJøŒ¯q0 ;bz®õU£2+U•ÍùÍðÝ™›’—œ†â˜´B¥áDGSY×3ÕÍî=ZdKŽ[ß=§Ÿ@IøU›šž•’ qŒX¥GCŸôPÈ UÒ×/Þ¹ØÒt®ólú‘TëÄÛx84oáÛÛöeTêªZʳwesÕ5žAÌë¾sÝ×y¯Þhd]†uFÁ'½m¸N²¿y“÷z¯Y©sÑq1¯V#µZ]XŠ4šRòYƒ ˜úø:IŒ"1Ìí± ‡1ß=zôiT×üvõ4!ßÛ »0{nõˆ¨KØÓ Ó5TïØ¹£Û»ç‘ZÌ•£â äÁ¡‘¼D&ÍÈ]»#1ð‘%IVh?3šÌ›…í f3R‰lT2‘;SÛ8м±Æ®y¬°Õšg×mÅžÑû2J¸HZ†²òR• žÓC³ ñ‘Õíz#¼Eàù=h‰Û,üÄjaâ}y‹<Ÿk²Ë2²³²ÓP#«Q Z]Óé O§â1x,‘T›q6 ^öžÞ#Ì"tëÆôŸ-YÛ¹Rü&«Ö¨ P*ÙQˆ*™s>¹~ýüÚóW®ó\Üu!ÉâÜÑA1ñnدw‚Â|•ÝS¥ˆ“¦„r•x›:N£0 —f¤Ñ«+ð ¶Uº+N“F¦ý4Jul3r1 MZÛ[c𼯠`¼&„ïá_ìÁˆÆÐ@iDhà^iëÁƽ­þÄá¥ÿõ A¶Ý®²ûü/6-H¦¦få$m'N¬LÔ꟞æœìèæ ©$(¹øã ¹½ž}xëæ-A›y“Ðì ÙÒ6ÔÖhá›_è”@$nC¥<üOcwDímb¤âñ?i•‰ƒ’"°8®oK³ÜoÂ~s>‹¢Ñây¾ªì´í(I¨JªÞ®ÂÈk¡Ç6'Hc¤º˜–â":ßrú;ºç ÖŤœ½6°¨:½(«O{*‡Éè:XxãéÀ•#í§ö•kÊQ!S‘Q#Ç~ø/¸ùÛ¢/©©èÅPwu@ž´—žûþ)ÁÆQа¨¹à¯§ëÊO4¢Ï˜3[¯âùx’ß²õaõIúú:mSªÈ(ã †³äeÌüÜ!Š•§fîàñ´y¹ï•Œ’7VæäÊð²—ûŸíò„‹àŸ.*Æ~ð—p…*1%½PU’ŵÉ:Å š½+—£Uhj(ÁáèY ©™VH)M¬k²Šz-Ÿ»Æ %aX÷œam²}®Ê å_& +Íhá`•¤ŸúÜÅB;·u0ÿ, ‰»%„sPËG—µ“4ŠQ9àé2Ô.Bâ4󘥓Am¨œ2¢ÓQPY\nsè¼y–^{>ƒÍ.ˬ–!&!.Yž­ÉÜ™ÎÃÝß=v¦“ךKMm¥~gnqvoC¥‘dë ›*–Ë‚R3râ³P,“X•X³ïŸ‚èBàáÍÛd!u¡GKóÕêv®[ÞÉ_<çûzâ*Û÷"0õw<Õn¼ÊJ¥äÕÞœ3Ïšß#NÛ<¾B÷{h­µuöåË…BLzadÒŸÚ°ÆÅø|0[T¥F¨˜ÑÇU&È2Ó³9üÍïÛ“òÊt‘×&×ÔW—¿T¥fÏbX\JãøB‘qi07È!Aê4ÐèädrBQÿ–â£lendstream endobj 168 0 obj << /Filter /FlateDecode /Length 7498 >> stream xœÅ][7v7í"¿Aoé‰Ôí"«ŠEî"ìE€l ‰£`ìæ¡¥‘ÇòJÓ²ÇZ{ö×çùÙÝãxèA…¯‡çòKû|8˜çÿKÿ¿ùðì³/Mx~÷ðlx~÷ìÛg&þõyúï͇ç_¼¢Ö>‡à¬{þê«gò¥ynÆñ°8ÿÜÍËÁŽóóWžý~÷öf?¦apÎïÞÝÐ0~™\ØÝ½¥çÙ{3.»û룷a÷§›y>˜à–Ýñ}lë]˜vŸ¸‹9ãfînÃa2n÷=NÃN:íèRÿãFîŸ>C˜¦‘XhÁÑ4”ñ&àgo é÷ÜÅ0˼;}'c-Æ«&§Ôf1óLÓüÈïÝ0ŒfÉ-¦y²©ì´;ÊóâíŒÓ;Ý—Ö%Ѫ¿£&Ö»…žßÆåÑ´íî<;˜q‡«z”ïÎø6 ô‡4ÃÒJ©Å<‘ôNVmÌ4Ëi O ˆS¥Õ58wçÌ2OÓØâ²Þ¯=ŒH24­jaŠ ³è@Ëìgç>žÃì{„ò’Æž'ZV@šùº¹zQqÎt%™ä¹uð“Éï©ÕîôUÜŽà&>9jhH#Û1, Íï^ÓÞ¾’z(÷úû&$ÜÁº…8Ô«[âG¼*¡²ÝñM9Àö·y¤Ú´]–¦Ìì×ö™fׄ‘ÞáÁ c£³#ÖäŒÓíi¬qi–®"Úq™hšV¤™XØ›rÒÐÇ/Ë)½‘î¦!‘¦4€¶¯›„…Ü WÄ{¦‹/ç9-Sd¬üv1áÚ·éX>Cé€×°3Oùn0f÷CäaæEÈ4é»Â‡Þ0§œƒ¹Ak— ï =öÞkMð*2sàS^è”?&¢µC"4-3aðŽD’ÐñCáš»(—¤Ñ[¸¤Ò|²ÎáÝM”+ÃhÊý:3¢#‹Kš»W‚s?Žö@·ã#/ >ÊLV~Ûæ¸Lé¤@Ì$¥+R¡Ñ¸_R&bönê2ûém¢Y|ÌËAV“¶‘fÁB dìâ;àÙ÷…ÝÉœBðH¿G Ú;žÉ4L#qíãÆCÚ=£?¸•×D€»†â2-­T y‹T!Ä:é.)ZÀ­Êßü ’Å/QOš…©¨ã_ËÕÓ²“X¥¥ ,©Çy  "‡‹‹V8óÅâ¶ô^ñº´Z÷S+g'kL°j­Qd‡a³åüš8ýÿÁíæ‘¼™{ºO‹ù1j:ÃÈû{Ÿ úN62x[QbÞœ»OeÄH‰ñ–€ZÛƒ¼å}ýR õý‡]‰L Ÿ}9¢Î?´ Å¯ 긭”4VÂÌ÷0䯏)ÔǺÕÄ{3î~[úqùÔh-Y™ÆOñµš}”3¯Ez¿(âzÏQƒwž6%^7ùÒE9Aƒ™PWõéÄ|šŒ›…6–ô“ø<³øŒ’›T‡2£òŽ7EˆÁp—£¾ÜÊÓyÅY˜Ù, Î á#Œ(ZQnM¸Ü +¯•vί‰ ìŽËëÂ7Qw}Wî&˜PÐÜ~Pª’Å0«y6peudF´%-Ïß]¤Nþ|ºš:‰e¸uÎÆÇóþ]ÑÙ7ŠƒlÇûr£€ã ý¤!š©â¤|Ùè…ÆŠ”ù-õòõ¢mÈ ‹ $¦:V ¸kç§.ë(ý(ý€)–içYÏ|Ôñ9Ð)4~Ô#R :"¿ô¤3 BÏ|i h–ïúRšÇtj¶ox[Zàì†G™ÿBÛÔ–D¸±ÚÈ^­Ùµu¡à‡bÂm%J±›ùdèt™±ð3M†&›É><¾Œ:"›Å0) Š1˦aYçAº¯ÍÆ8EZ2kzV HR!H–Î[!=†h2åÓìˆÅ©ÓˆËšGÚyFá1Í/˽<óy( ªVq’ÐhyÍ+ç»oó5T7’4Ž_ifÖC/ åð~;/ûöÛ g(†Øä-’Wa3H•|$.DSÛŽü–wXAkoå•…ékYøO¼?Á[RçŽQô=y¡Ã ‡7…A»É¿¶‚°Ú¶9#X[Œ%7ý£f·ÔE ¡ð¿Ýd¬ç?_J'~·­:éDˆ©±B˜ò¨€“Óª-’xÜúŽfÒŽïYujc+pˆÝYG¶URÚ2ßíÊ.Öáˆ÷ÜZX–F¦r‹÷G% ΃ô7úŠH×AŽò8˜ˆÞ°” (Ü4 ¥1f Xü´l†ÉWX_„I¤= HÄd£ä5$”¥&­¶ò[º p—ÚÞ¶T…K‚MiËZšNDw v±²*µ-õ´&!£i¼žM°›«µÔ•!²NCó¾m“dÒÊ š c04õ¥¬.:JŽ«=C”¾œ'šðQ!–Ô‹‰—³o>p‹à]\`ËÛN T$;ì’ž‡aat^A7αÍW)èôŒO6Wðô¶ÿZözöÓe¨ý;iëŠV—eUVÃßµ/|Ej²ÓÒ«[û4òO0sNH£âᘉnP<ßIƒUôg7šÑ-ãÆ1 ™Ð´­B¹n”½ÜXŨ„´ôÃÒüG^KŒ1ɯÝPKeÀ2æ×á°ÊVP½ðÁ£ÐÞÖluá^àR¨ódº‹¼6; -gÒGP´E9ðz¼ñãQ'£d=üäEðl¨ÝÜ’®‹Z%\¨÷i/MõU‘Õ=¶–7[™ Åì–C[-«}Òz² (ORàërºï:=|A§ÿÈóy£•TVçÉöïùIß_,WMÁë¨BÁÓ"ƒk¤fÅe¯$½Œ–óëirF“^ºÑŒºOX­Ñ^BpEþ¹2/åCo–¾&·‚Ãk³Ö=Hš#î)h· RqrÚ\ú±pÇñý©hªý‘@꫼NÚ¿¸Bû5÷Ûº¨N<7bIèCƒŠãÉ&(Ÿ5ò¼$[R|è+!ãå0gÇ :í“Zº(îP¡ãtÑi/líЖ¢á=-—›NP§‰ª YˆÄVªe%žö®ˆg `‹{°™Å‹@¼ÎG6f˜o‡'£\{‹XÜOKØâ(— 8!Ýïà&·LD9‰›:—ò>£¡Æ[G ¶ó»4 ´Ø5>˜}Ñ9}'}q`Nd¼qu®——I(à1Mˆ¯ÇY·vÒüÀ¨8ÒH½2D+K«czú~­ ®´õkÅ&(Õ‘Ê-£kRÖ@bæ ÞãHðúh4H‰/ÅÄ`6‰·@à[Ë>þÚö'}lyºøA¾Œ¾’*D…ß3ÛUÞ…3`TDóV:vƒò›ð~xfÖV!L™ï@}kû/Œ%ÐŒF – —z W-1ýÌ{©™èh3<™&žŒÌüx«Ñ¦ýÚ…&ÉxYávmÒ4-áV.T$EGöå©Eë” ]:¼ßÞð‰’ÆçOƒ“²ïknËSb,Ù’þI>¦•€Ö7ZX¹‚|ÂXÞ£Lˆ˜Äîß¡Žš-§Ql–÷ºh’Ð]…ŽOãCëh‚¢>ÝØGnÀ=BVlN” ×Ç ÷À O¸ÅP„uóarÙWx*¸]¹™‚H† ®ˆ"̆nÓ<1«Î{ü=hˆ'xC]8¼)¨×,œC Ùëžó‘¾‡›uâɾÕ€·ð¼¯xöº íYW8½hBa±6áÿuô/QÔº%:Â*Ó£rT‚¹8šã@æjJ,öËwÅò©÷1~îwê‡D^p!a€äO†ú[†©bÍüv îwÛ¼aw¯næ:¹ŽýÕóͲŠÎŸ’êí¨-ƒG'›ìý½­ÝÔ­ˆýº`ë „¸j 2©Ø_µç™ ·#…+E¢h€‚ðîWBªxõ ®Ž¾’ìE*ÞGG–êb¸@G—Õ¤88±56,`Þ—… £íÕ7õ… Ç9äàƒ—úÆQo³Â6‰äCº=»¿êtG¶âOéî¯Ý-‡eJàÎ…8 ên¶O€iòtaÚ™dɸ±~Û}!ûÏjÙ¨ˆÒõƒ~œs3î°Œq[®X£Êd®Žæãy°%æ³ è‡°bíõØøaQ­<Ïi&²ú¸ÚYÛª÷ò[!µ¥YI2ºeÌ„¦ œVØýÛ(y¼‹Ëê–{?M^ä{ ïÀ×(á¢ÌüÊÖH»]ƒx&ÈZ Pùhæˆëo½;¢¡Ý½kª辪´FW†:Ì`«µÝb·mÝêVúƒ‚ŠNò–ãòzA&H˜àÌ‚y^#IìÖ{U´¨ˆù,= ýSM´+fÉý²é#f­¬Oþ«'Äkïû5.·1â`S5‘‹¬aˈ9@Àã1Xæ\ƒNYé¨"$.cØõÿ ¨ðo‹fžÖÐ=Ñæ= $UìQKøVV*-QØYixÇ]Ϧ­5n¼‹oÜ õw×-­oösM´4Þ NéõñçX]{®Ìç<Ó+BÓ€n•''öí5Pw¿.v©À¹U{“™ÕÝ t<Ì£ƒ9¾”bD‡ç‚BÖøêǨ#XSOš.‘èã²$5j³©ä‚¬”Û2MÏÁÚ¶rc­¤ ·­;ì®WÈh¨?T!Žm4%°ŠT!E fiKêpP0…{ðÍõ"k”¥…1ŽÄöœRš T‘(QŽÂ'hãÏ +ö ÀiÄ“âqbÔ‹a ƒ\—•)·´¤È²Í§=Yë"·N·Hù5æ—4>- Ë ä­t=kÙ Óø”]†ð«£²&U¥[’AMüc P0XdD¿ŒÓŽáÅôI–0Ã9å“e/(ÁYù™0³A™J Ä 3/bÉq˜‡•´€aã4L6é¿ VâYu˜kÞ&8ÝbÀä é“±’¸sןÑuK 6¢Q•[¢ÖëÂ6´ŽÉ»JjÜ\À[Ð`´@Ø:6:þ9¤êƒ€ë6¿-ÎAóÙ*bÀ±lœ4 BoYovj'e‚KÐhô¦B EßË ,}ë0‚ôšÕ-g£ ˜ä©r;ȜЙ…l ‰¦|3 K£´ßË\ŽÃ9jL"²é¯¸Kþp3ŽKB"ÁH%JHÄ ¡€”@³!ŸZü}jT pü°¤…3h6²5¬-~Õèƒl0¬ÆÎ¤³BDLXÃVÈD-…Ìó “Ýç¥ÐRéL ©iøÃ<_XÝ ë0«.²³uL5öS-ÄÂB¾h C¤ßù҆Ã,Øù˜Ê/’` Ì¤Ô È¬#„÷Ö‡ÑÖ8`Ç_Ȣךƒöh1ó²ÖFòíèÒÂVüâDÒ[ ÍhÇ'õh^Ø&}]¸ŽHópÌg½Š·å˶ÅÜÑD¢ncÀ°¶¸Ü)eQõÌËC…Á‚H‘áŒÎÙD“ªçñcÑÙI;1ãñ ,ƒL{*ËPV³Œ±hÞh=ÜŠe#Æäm­¿«ËfÈHÈ|‡àv"QCÔ»ŽÑ'„ï ĦGÂC’I”or'õ•¨f7rܺFš^‹¡xfõþc, Å\dJ¿n0”é0U\Gp‡V“çyÓ"nc>Ð_76z"æ›YkµÑMX½ÑkHÓOÜg¿\Üç`íù}öÄ4ã>#Ä:û £|ÑE1nÚëu·+W‚§‚Ð×mÄâaò"üêÆsÌ¢U(uÔ±ÂÖª¬¼2¬¼ø9ÚR´2ˆ7•ü¸/JÐ_~òD—ƒ ¢x·“ñgT^€Ÿza$Xc¥ü©õØu¸ˆ¯RÏså…†¼¡b‚µQ¯3E ÒJ»>Ò8 #9AéR½(Lü…LmñÚKÑßfÂJr}S –J'Xy¤PÞÈÔ1^¥¨×XhR§ÁøìdÂvÔó¨×pª^D%Æ™qß°«ã÷„FŠn¨íp±ŠDCåILpßÚ*};~_º}Sº}ZP§)Öe Ágk”/ ¨6’O?.Ì_²{û‡›ìêë,FìDE­V’Ù`ºéí±PÆCŠ#n9f²SÉ€…èÏ}öõ×?kw:oâyòÇo …ÞˆuIªÌ.š7˜Eâ–¢KŽ$τòeïÝWÒßìÏÜè4Þ'+÷6\bÌíiŠW¤ó˜±å'~2PŠ>ãyä”3w&¦¸˜ŠÈÓf@¿}ÛPkÝã Q²f$éÂXÛVÖ€/Ë­˜Îrâkvò ÏûÅM4;y?ù°g ³Ü˜¥FíÌâˆ*m%²/ÇIðÙ1—keÊ šÓLmªb,¹>‡óFe—¾¸¡[0ãPNŸð·,g\g†ÈÃUåÀøCöTÂuk#é8 [<Ÿ^æÌmZø¶¸̓˜°N ‚¯ƒ£IÑ Êƒ;øú1í3—#Œ˜êÌku»oòЄŠïå;.Ç€ùœ™+¬§h]å w ¸°â£NObVgOÂÖêH›´kíØã„ÜÉt´Fð˼¡ˆ;'ÏÙ¤«à<–l%ÌS.ÒÎê2>!37‡¹,—ê@>‚oi+†m¤ì¶øYκæÞ 4fv;Åàóxax&¸ü#^}Èü{”ÃæJGÜûÛÔI“ºN CG!™´]䪭1E ÓºƒÔ$i:¢“Ò’‡ÛóVúXÓÓeáóî ,½éâ'©Jÿæô@Ú€–O .KÓP®±NÝ -§X“£KC%[1xQÉŒuü…àæÃ2å+´æ“Êl7Éœ škS’ò:b°îVU^ÇBG’H½Õ:Ësc°š]${W;q?HvÏïs¦XájOt$býƒôBš ä~óÛ'†°å™¶ãLo×­áL‘•=®ë8cÓÆÉÐB¿¸ÉYr—sm ¹ñh=/¸;NžZ³×#[G½Ó”­Âåy §é÷Qºcár^õ´üÉÏPˆìe †Œ\sÈõ³MŒ‡ä®êJ”×1ö'D¿¤Öèï´ÅÛþP´½‹×«È‡±ÌCËjëU‚Õ²¾ÏÉ­ºúÜ0Ä|„˜«7D#Jé:X7Óv§–/I-7IÌÔ²~“Ê$†Õ6ÿ ]Tèí§갂ܳ2ˆ^ÔÇfæA>F½oÂWUlÈyYKv†5‰pœÕ¢-Õ}Vú1áñ¸ñÛ§®µ}Z¡Tºt¨6e"‘Ei‚keFOø°ç…”™¥Âe¦™cà]+4mŠL.¼5sQ˜Žè­ükÿVÅ»›ZÃuÑ2¢çìë0ŠN¼‰Îδ\'²Î\Î]Cî¹í&"ðÑæN¸‚KnÝç´«|‚¶wkd[1ÓrÔµ.É^ù sé¯D91ÛÓ1Y\®!F%#Ñ)y\Ù–Û뚊 Â¹:º–!…é²fשÜUÇlà&àB˜ã,»:åì ,ýPÚba©fxÖËdìùsÁ½ °š®Ì†<,¤Kå±ðË¿-¬é5÷M¥!#GR·!8¿­xʦ¤ŠºÔjsΟV%£u8«óúÒ×Ô ‹8–%·îÞøh't4ÔÜÖuà¨Ís+mg•r™ä¿/±¸)Êñ¹ûò¸WDZ-3­ð¥Áú ßsT{Ê Xw”?]òs]<²þ¼ ¬ÁF(Ñ-„SGêë+¥üÔÈ,T­££Øœ¯ w¡>ç¡DV=V†/u²eƒâ2*¡TÙáÞ04 /9D‰'¡)¹>÷ìjË–_'®a›m=z©Ú¸­³Ö«¬³‚Ç÷ÀÐ߯pJŸ~¥úF;ž 7¦ó£Ây#@[1©<ò5¹ž-ŸIU Õ©#ó¬S°r›ÚAóä7? ÁÓäl3©Â½M6ë `š°+ õ#))IXóÝÛ\Îq(uy©ÅäáMáÆßIí"—œu;õJ»w"ht´[*âý}ŠŠü!>†`;Ôñƒ4°:N³ØG[0+Ö•ãŒîä'ñ)°î¢Nª™Q”bú2¤‰÷].²cWUÄÙ+ì8N2·®Kâ–„šòD‰ÇÚD”Ê>|ÉOšj±~Ó®âˆÕÆÊ&ˆ±>Ñ4Šå à +LAÅ}WÛºÇY“ChV¸1̘œ0z Žì$èwƒ-³ÅÒWßRßXDXIí,âÌKe— 0có`.xÀä9Å µÜaî@ŸØÏÞ$œaÆ´-ž€G}StµÿM ØºOWU"[ìLÅã?×3<¿«¢+í´OÒY‹ç†X²RRMÛ4Ðcœ`,icߊ‰Ž((WŒ„| ©cäÅíP¦¾+ªdÑá«‹–ÄZ™2)%ºX!âgIÙå òû<·¶: ˜2*–…ébUû*w!í…›©Ây4î˜}ÚùðcÔá­¿>‰AÁËÒ  7 Ê3½X0òAÚFéÿdØ8mÓ|9'ÇÝbù)ÉßÞ6þe-æ¬]«ÇùŠa«”ÌB’Œ[ýô Ñŏiõíj´åfT-:Ú-Úú㉠©k-7GºÜ9p]¸?ßùÁæUe\¸™êû“fd„1 •¬àæì¯æ5\¨%þ·šH­þ˜õFfì,ÀgΖ Êeh%•ÌÙ]$úŠÅ4¥&5¢É/ëÂ°Öø‘!º?bô°úþ¦NÙŒ:[#zå¶ñKŠìIØ«_b8“üaç„zî±tˆå\J}n i+ôûÔܨÒ§Èf-¡ã†“WµœÑp)FãRU@ûVh bÉqÊÛ¯¢ Œ)Nœâ ŒúîÉž³È 1½®Y“mÕríÁæÒÇâÃýgËþQ¬Ý1 UÙ©ØöU¿Ä‘éI*½:§I|îàưhç’ˆe?&Ÿ‹)a­¢ŸÛÅn*ñc£×…k©P?ù4<]Îõó,¹ÃiP9Ù’j\ŸÞ‹{B÷í§;*ó"Qw`;éT¿”AÌSJ•00þ”WpN~× <¼Ts¢ÉŒÇ×Î’öý_\˜f¥gÇŒ5…»×ZP†x2áh-h±óã0¦ ‹rðLª_¦¨>æuùVA¯UxïÕI¾© ®l'ÞÃd3ÓO– )¬µYÌµÉØ–ëˆâwÝ;B‘Ì.B‘§~XÐô äòÓ+þ>¸lE5O[6Ø+b¶.ü qÍO^¨È£UôD–Ç×íÏŠ>³­ñeÓu¶/¦_E0NGÍ6ÁÓ? ®'d³òÐ-ŸJ5»3&s ÿBÐK•’}‰` l6?ÛÔüýÀ2àÕÝŸÔ+[ùa˜p…2þ7?ß3ôC¼§d½üã«gÿNÿþR¨+Çendstream endobj 169 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 231 >> stream xœcd`ab`ddd-*©(1t~H3þaú!ÃÜÝýãÒɬ² üN²~/f.åëæaîæa9òÝYè­à þ' LŒŒ‚¢a©EÅ™ùy Æz: î>`“˜lµäx˜Y”ÜÕðýø.|ø{|0ãKßï‰þ3%˜ýÇ”ßñP¶{þ÷¹ÁŒß·f*¨=ü»â{Yðï²ßÁß+~Wþ^ÉÎW;óGØÔïq3Ù~çõ°Ë™,dÿÏ%׺Øó?·»ˆF>'XLNleû°ŒœÈ2‰ÿ<¼ @AXÏendstream endobj 170 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 397 >> stream xœcd`ab`ddd-©(®1ô~H3þaú!ÃÜÝöãÆ9¬² üN²~/f.æëæaîæa9øý‰ÐwÁïŒüŸ˜EÃR‹Š3óóŒõ tÜ|@†%—¤egç&–d000031030¬`XÆØÉÀÂÈÈbä|õW ßO7Ö‰þ.þ^ô½ø{qòæßE¿‹ÙÉÉßÁ¬ßE›“Ár@+Põ÷ÊÃŒ?.}¯=ügJ0;ß윿+¿/ö`þ¡ûý‘èœÚ¹•%––Uyr݇—î^˱ vFYy}myÊâ°îP¹ìy¶÷˺9*««*3¾so*•O,¶­/¯klinê®ã¨œY=wÑ;sVÊu‡äwgp”Ϫ?ú¬y[Jöw[UyË|~7ÇÜÙsæÎhšÒ8Q¾pŽÛ´„%»–Ÿî_1gÚÄISºgpðE­ú鳌í·ålv¹ ¥Éÿ¹ä‚*þç–ãbVŠçá”3[Ôô_NlQã°ŒœÁ¢iÿyxìr¨Cendstream endobj 171 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 2608 >> stream xœUytSU¡ôå)P„H\š§ ¢l¢¥€cY”S–Ò eÒ&-±iò’fyi³¼$Mr“´YÚ¤IÚt_,P¡,•#ƒ:Œ£"uPÆs6qÆãñfÉk+tT©ª¶H•¿aA©¬ZW¨•(2¡%ì“<ö© ìÓY¨"]“~#ûilꪂ§‹î´ä°y“109 Lž˜|jÒÖéé—¦¥§Le}ìáµ~ÞAÞ¹ ØÜ²Ò­/Ì›7µJmÔÈ«÷jÉÅùùùd…‘üO„\#£äÕJr·¨“)TêZ™R»Ü,“‘Ú½2²J®‘«7o+,ZKÎ][TF®•)e‰‚,ÖU(ä•äy¥LIÉ^ «TRñðƒ¬T)¥r­\¥¤’+)RBRjY¥œ;$3TÊÔ™À|R-ÓÔÊ)Š[“rЬÖH”Z™”ÔªH¹²R¡“fà¹ÿU*¥–TkT\¼–‹pW«(-U©‘«µ$‡X¼æ­‡9j÷J´\JÎ…IU·SªªÔeªù-¦•È•©•´œ )•Sj…ÄÈárW©5ò)è(¹²úwôù¤FV-ÑH2êÁ½V~¯ü¯ª%jµÂøà¬êÁ®ßðåZJ¦¨ZøPg’Z¢$9­É dFl…DCf—Wþï†ßeûÿ„Ä0lÚÊòUÛV«·k FiQI©üí-ö,–Í–a³±l9V†möcob‹°—±W°uØì5l:×CØD¬ û¯}BÞGÖ‚,CÖß'†²_Ì¾Š¿†ÿƒOñ&VaÈa!HÁŠvFŠÇ^IJ›á†Ï°W…ûpt|ܽ‰lÖJFDÃM ~y3Ó zAG ’

»ÏÕÛ×; zùã"ÀalŲ °é/=+ýŒIi|Ìu-hpZêiôZ.,†Ï[û“ &½‰È…‘@IšÙ·uìú'J«$ïJh$FKUš-Vâ݇)Ò'cq1œ þ„òCÆ&˜E@isº¸=} þ›a{Póás°U_‡[Î^ê>Þ&Êä3ÄÞšÎÀ©¿¾…Ó¥34Ôs3ñ‡|Mƒ÷„P»‡†CCm¢*¡ùQo«·É;èŽ1ÀÔ»ÖÍBSLz'c6ZFÝ1úœæ[ëq=Ñà‡AކŸ“^d<ÁÞá}'f¥IV&8wd×á msê,þºæwZ+ƒ5€@rT†v! Z1„Á¿Ü½[lj[üJIm>¡¬õ_BœtN¹ù•øôØÕOÀàLY ¸2ÝÖvqÊš^%Ð{fî‹ì\A7€ø|±`Ÿ˜½=» ÕÏSóJë®Ë/'±$ÎßiŠt¶%o¦¾÷6´7vÎ á øÊÍݧ֬ÛQ³¬DP •Köl”ïPl„Jï:0g~!î¿vyì÷=FØ›#<ö®ÇMø.4§ÃÕ9Mv$Eƒ=çb×9ì7ðqjünv=ë矇+ šõFJnÉõÛ˜|ަ%8«gïfçÀ÷¬cð×ac Ëñ_|þL±¢;àrº½Œ3OZ¾q[]Ã8œÀ ¼Àãs_à«Ñ€Çîu»í"{-³0„®“î?¹àÎÕ¼†Ðö 4M‘ÝŽú8Þâïá·Ùßà9l±õ2üá"³ŒÝå´[´µ›5CjÌ1à {ƒÞ€æžõ$ˆÞmAv·¸¢Ž' ˆÎ¶xg§)Aí–U“o‰­ê¯YSj Ò¹½Hom6™G"þõ‚ ½mÓ š*ÌGèkõF+9-` 6„¬³Y¿/E½\ù@Ü?ÜÙìòš,Œ•Çèapôõ\¾Í‘\ÌæsF4ãhVœ-ˆB¾Vp Ä5'QAr]z„k]ÚI›Š ý>«¥Nga€8Ö°9jm¶Bg2é4]†ÁàL΀¶CL| Nø ŒCšÞZ-mÖ™ÃÖTC^‡5dõ ²êõWÑ3zHÍßo†ùf@4â^o#hvoµs‹Íåmp×{2]Ú2žfOM7~93×ÀVr|–m´ÚM€°1‘Ö¶a˜³N÷ÿØyë Üéjn±V;9C4ñ/xBnP¼ÎúòÝh©9fLH¹v˜^EÅèÅ5G÷||mtøî5±µÜcZ"7¦N{}ÿó³y¹åh)üT0ä‰@5æÏB‹äTÿ‘¯?€Ä'Ÿæ êàòK/2§Òç±5ÝAã—\1¨Å¡÷º¹Š¼Ï?&DR¶1-¡ñS íR4i|‰P†g,¥ ÷œ¶sßdh H;!Î.BÓø©ìvÎfÁ!(h ^å 4]…Ö_K[÷ó>¼Ï®¼Ÿ‡iÁæÃ-߃s¿¾_ðe>9ïg$Z¾¸bõò¼9 ŠÑÀi—?´ö¼¤¯®Ë6j{i¹ùCY‹Yx¸óp˃ÎQËÓyÛ!p|ÚwæhO{¬­oÄÜ*Ü\RaX öº¦7Ú·ÆvFœÞF¯@hpèHoÜ+™ÿÌNôüúEâ·Wl”®IJWîÿ4_¸òøâWWžñÒ̺;Äcõ÷³Ø‚Ý}Òpv!ôo$÷· ïl?NwVžAOä!s6{[aWн?‹‹r¨š|1gòvŽ*w‚_v4ƒý %‹¼eÂ]p*º‘ çâ(Êþ(vÆBÀøú}ÙʹëËÑ4Úêk¢Ä™§Š¤`YŠ7v= j . jŒÍj2™mv@0L8Ôˆ‡:Ä ùÄŸïó¯»ýs z·Ô-¢ùç¼-nÀ9°›vêw 7…t‰SôDUB?tòÐÐ7—òêØÓµ^[[ÓQ7Ø×Ý=0¨íS‹ΓŸòÒS2þ5ˆKÐÂöÆsNš=ÞKo¡èB7XŽ'ø&ŸÙï•K qí€bÖ%¼€6¬ÙÜà5{Lâ¤'3Û©ô$®ïÖdú®ˆÆO¸ÚmÀ †=ï–¢ Ä ÙMÞfЂ"p ­åjf¶;iþE‡ß݉¦ým<)ìÀÙGX”ìOD»}¢}Š]“‚»Rx÷£7'uG&OưMZ endstream endobj 172 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 996 >> stream xœ’mLEÇg¹ãî¨WZ —ÒZ`LÕB@„R,hUÊK©Éå„DB*Ù»›»ÙÛ]v÷*”—Zj q¬4}/msÔ«¼TSK‰øù€Œ©©hÔ´ç[ÐÖãìeLt´˜øÍo3óŸùÿžçùÌ €ã¸4yª[ ¹¤RçnÇ‹õ»9}S‚ža"¬J—c%‰`MyY†káôùd=ÓˆÝDìæÁMæ©1sŠN×è‹k—-q#ÜËnp7æäææUHr‡‚A –––BOü[•HÅÞo,ö"A’CHÔòaBP "èÇ‚OÖ4=᪆ÙÕ®XD¤ð¬ {ì…NìE¢Šr _R °¼^Iôa K¢šwª‡ªŒ¼Øx„Ú½HŽ yPFJ«ª±†X……5䃚±è¾8Þ8÷K¢eE2ô¡V5’ª©^Ë4ˆ5•»–kÔ‚¼çªØ¡ä7nú$o8ÞÍM㱨B µkqŽAVeï0¸†•¬à¥Â*+ô<¨ ¯ø¤.ùƧ²ÒüW×¼, Ko¥¥[wøXS‘àÏ_Î!ó"4r†NZà•ÿ*+yý¿–‚­eçRAX’À*`5þ0&8 æ®rÒW’õ¾î¡Xêwá=uËDÄJõ„ßçÖÖ!f%,‰0î –tµn¢eF%3äòÙñ±Ù'©ÐÕ6ÊÐ{Øú̾6Ç+,‘!†Z`qqËïÔGƒW¨)šeÈ€þþékŽâ¨‰¾cØî‚ÄnëÉÃ'úû;r¶ÿ8± ëjÍú£ÉJž=¨uövõv÷ñ/ÙºèkÖ/w'Ó6ý¶5n5¯¿z£?FMºD3=‡ýîžÞgÈvÐBwÐÊï.Í“/7,>üÅæúưןي»Z÷U¾˜þÖ/ã?%¶¹·?º'ûÖ,¶‹Õ&î×7Æ]»Gtó÷æíÿÁ¤»cef9PÛ^þ4Õ0 aɶá¢ËM“-¨sÄF×F¦™t]ù×ÌÚ²÷ä̦¹ÔL-²1»äˆ¾[ÁRX‚ÏUUÔð}pæèHd kðÌëÇÆˆ-™Fc÷F¸icÓÆ(v6‡Úü{*··,:m"ç»ûÞn ¿×zòLú#Kcòçê'ÏÏ“EòÛ©o†çFæFÇ?›ýÇ„6GM“¬Êq}zthbêÚ·c‹„&ºÎ»èWÏtÛùÆ‹û;Ó¿rGÊ.ì>ñ8ÙB6÷”È.É TÔÚ’Ÿ‹èOEh}Ä2ºêæ]£Gíö›çì«ø Àã3endstream endobj 173 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 261 >> stream xœcd`ab`ddd+*©Èͱt~H3þaú!ÃÜý[ñ{øGVY~'Y¿3—óuó0wó°ìý+ô^ðÿ3&FFA±°Ô¢âÌü<c=C÷ˆQ LÖV ¼ ü ÌŒŒ,öñ¿jø¾÷}üÍÀø=<…ù{øDÑ{3Jвj’×7.4¡§§O®¿§¯§·›cÒ¤¶¦Šê8ÏDù)+§Þ=Û}I¨µá;3ãÅïÌÌß=·‰®*\š›[T”º¶zÁ‚us6ÈñÕõ²ýNée—³X™ùŸK®uYén9.33³ÿ<œrK%þË , üÏÃ#W¼¨õ¿œÐâù<¼ (9\§endstream endobj 174 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 4412 >> stream xœ…X TS×Ö¾rs!Þ jï¥Z§Š³¶J­Eq((Ö*Ί""a‘Æf„äA L fDœ­bµÚjpx¥þõ¯öU‹­¯í«úªÿŽ=ô_ï†ÁÕ¾õÖ +9÷œ»Ï>ûûö·÷GØÙ<Oàåëç7g¶ùçÓ8ži¼éMÛ,oÒ½òá¿I8.ó|sí̓‘ÈÁ9Ø5£Íþp‚RGØ;аåñ$Ñ^’ýñÒ`‘Ìmjà4·9‹½çî6wöìEnKÅAÒÀ€7ß™(H ãán$!A²x·©‹E2Ù~Y³bccgˆ£fJ¤ÁK¦¹»Å†ÈDn냢‚¤1A{ÝVJ"dnkÄAnGgZ¾¼$âýѲ ©›¯do4‚ ˆ¹K#¶,“xí—®ŒZ%‹Ž X·'>ÐwïÚ }ÁëC6„…‹gËï/þ`ÉÔiïlŸî¾sÆÌ]1ø˜XDL$ÖoŸˆ)„1•ØHl"6Ëwb+áEl#–3‰Ä,b%±Šøˆ˜Gøó‰5„/±–p"vþÄ8b<ñ&Á,1ŒNØ‹ b±„I8žÄ<.΄O¼äÉy/lÞ³ÑÛŽµM±}f§â;òÃùÈÅä5Á'‚{Ô*êö°)Ã:‡/~Äž²;x;<á;Â42iäEÇPÇÓ£3úSõHS52üfã}^½)ÔŒ¦ûtÚQ…:E 9J Â#zu. $C™Ê”ÌÌT”D‰ëP󜬬EMͱ(˜­ùï’5ùÁ±(\\‹*ÙçdEj*=p(ù ›™…½LÑ´š¼|ìBöm ?ƒó/Fð3Ž~ ¦Ñt * d–‘r)g¨iØ3¸s—uóH g·YŠäì.XA Ï<ýêèg5’»Wз®Þ¼nÆÐu‰ä³-§3¯?Bþ!qqTßÞ&…wÔäo §áiàƒŒ_M–™ß‰D‰ìD2QŠÄá5¨†]Ž'/É|m jn’Z¦"¹©:TÆÖà€£±+®àG“ò(no=÷ô7‹™($c„M¿âM|YôëSædýˆ1€¿Áù#$·sA0Á|ÓYœÈïª}C÷„y¿Ã¾MÂF }½úôÔIu¯}€mC*Ì>èQ9[ß« …/ö ‘ŠþÕž{Æí7<ªXo\Bc!ÄC~×´ÌÛÞuóYnãL|mà}a½ÑÖ áÜŽ3ÅvØnæTì„…?¹ƒ Øüô3838/ —úÞ}ò÷ï\÷™=Ó×s©ÙDŠÁThà7­«¶¦8Ó=ºéÅñR30Ê,¤L’†6ìÔná`§9»c±^ Ü7¼ÔÞǭQ(%M†"”lÆ4¨=ˆš½à%¼Ó½ì¹zi§‡†ÍMÈ‘7!ª é´æÍ°Ô³ p«Ÿ.ù\¤îƒTÐW¾¼xí«/—ÍŸ¾ÂgÅ¢ïÏ1x²Ý‰€Si-ˆÞ/?çþó­íþñá!¬ð—F¥&è5rõ6ü'r %(Ì0ÂÊGc„g@ ké\ùF0ꨊX=¢ªµåõÚä“ ·¬Ž_ãÇ ¿>,hÎ<Â` j9„îãNë4V`Ûþ]BÍÞs#Œ7ž1Ú‡Ð@Ãxr’·FÕUÌAª!ù‡PÈÝDÆ¡èÃæà0Ý– {ÎQƶö*B­#˜I–éûø(g7“Ø;ß1@²!Ü0Fø >ƒBZ–›+=‘·ª£êZšúV#ŽÌeÔ 9 Íý0f„£²Jf—nŠã°}_¶(xÖ‹„¬ðIGú7I›ÆîÛ:{džâ{Ræ@eVq$¢D(&–}G GÒ¦¢ru{ Ó|QÙÀÁ3·åÛs¬ðú Óº°ƒT¥`žNsyi„:Ž˜!ˆ®5ç]_°ì­Aã×õG©ofÀÉã$ ÇSñ(¼€h} Ã,ðÄ pö!8ö`G¾d ¸psƒ{ZÝO`þ f&r%Ö…Ÿ?s§7ŸŒE1\hõŒ°#à§ ã†(+LÜŽüãCÂ)¼Õ®[ð'Õ5KtœÁtØÀ;õè¿0Í ‡$íËŒÏwU‘ªÒtU3!ÃEÿ×´k&a~•—Š”H劔ÒEIÒ¿`e¢ ©¢RJ_)ÝŸp8°ãép)Îc«[·¢zlMû€G7D Lyª26ƒÉLŠÛ±Qïzuýp®0Nw ¥±jQ•¢QµºŠÆî‰È{~ŒÇÏÃÿ˜ÎÀþg……\0ÑM^×eÐs;eâÓÉÁi™”ŠL=;J”ù©µR¤@ÔËyu¨…íUÂbúó`»0Ö©.ýò’ e¥A3òÓK2JP)Òjró¿ƒü’‹”º7’üË—‚]?e6pU"K‘9˜Œ·úð>2€÷ïçé`¤8Î USþ_¨Ë\RØÑº§|÷8̛xÔãw^r°_F'ë)³[.Øà¿pÉòo÷üÜu£ëzÇ?f0çž\†.&ëMwèäÖÄÜýˆZeÅ\ß«ZG/­HKM5 kz³KEåª:äÚT’{”5åëƒ+Þ²RAß+Qõ—¯ñWa´wɵ\‘X h]jrõ?ñØ~úìˆG>› 4¸œ}¬7CŸž—ÁFoÙ˜&AžÈó¼ü!¥¾Jkº¯\êB\W%-z{0mÁÉÀƒ5Æ_ÙB¾YøGáåȳ使¡&&«ho›¶¦¼áêûHþþ’ó™MS¬Uàîœlí¡ÖZí'›½ÇñWaé—®ÂΫÎ_Æ™ËÀ±/?¹3Fø) €åôÆ€³¿8}úÂç'wlZ¿k×fvŽˆÎU•u êÇî;=Mi ¬®¤6¯T¿¿&ã¢*jJkâš7¦lS…ìdåÅ¢ªˆš±ÜóÝÝ¡eq¬)ò´hñX$ÒH‹’—ú£U(…Zðb-Œ†Ñ/:¿k?¿¥žI*¨žƒ¨d:JBé9‰(%kR4*-ÊAy9š¼CØãkôÏS§+‹ZZ´¬¾¼u#ªøhÁ.ÏÝS,áÖþVÆù‘¼F-ÇA9Ìæ:Ú;ä§×mßæÿÉlÖ‹¿0úf{• ~øgðŠ¡8slýº@()<«¾M¨ERƒ¢QòA⪰ qƒü0¢®ÕÞ<ÚÂu–\Å«Øtå¾ úôâ5T˜VÃ$7ÊtŠâAœï?u† §+9ÿž@§i,méÚ& AŽ;ñˆ!mÔ9+’Há3“Ò®!ºZ"‰Ž–Hª£ª«˜®Øù (¿tÃl¼êé†ÌocÑ|jóîu‹%ÛòꙀú¬“ªJU…ª2¬¿AÂ.}Ru¾¦¥ˆ9.6ȯsuçûžëÁ'“KÙ=Ç÷|PI ŸyT”µ¡³®Ÿuœ» ÃËf„ç3¹ÑřڎÇÅÒ¥H§3{Ú6–øs­çâw?úÔûÛ(®KËSý"Ód[ùnÏñÝæ²¹RÒà~Ûþt¦ˆv¿‹ÝùðÂR;|¬ ÝÑ«Ø6¤¿Ònn»O~óGœY–{ažÃ­æÃÉAý€8®Ó:oú[?s‡4åoô*0=dü`HF¾1´K¿xìÍóÕ€gšD+›bQ<¢Â,˜êÐw ‚cú+é÷?b¸Û+¬;zNœ=Q£Iða°B7p¼ûÚ¢ÿºä€@‹€œ+Þ“´WÂ$–T†"Jx? ‰QÑÔà•鼎qº_Ò°vŒÁ6ØnJß iís<†»xÙ=…±Àí"Â…ô>0¦Âdã¯_uwMÃSðT<üs¶-4Àyóg v4ң㹅•G¿ÏiCT¾6¿– Rü ÌKš—Àª2ÑV$¡æP0J –'nUqmiflf”¸Vuˆ­S/;g#…=HŒü/Dœ”]Ê8‡(î†ßÜ(U§±x|.:‚š)X @úì~M'õe­j=õŽ\¡Q:³¹q{Ýš<¢¸HEVeqÈ1JnóP s&ËÂNÉ6„)w , ¯ Œ')ûüáúªŠG?iï—±ê|t5PÜÎeGÊ”S×ZÖ¥Ne£ÔØ&Gy¹ÊàÞàăàd ÷Lvt»¸.,H¾¯)²å¨¾¹™ÁWìþôÌ¬Ç¬Ž pßÛÎæ·×]1߈þÒ‚ðɺ^;:icP\bzf¶"ɩIJ„ŠêŸ?»›â– àHIˆ¤BÔa6{YgÚ¥å]6Ͷ5­3Ééâ‚ÒBTEÕÄ•ÈÓ²Ui ?Ài™Ié(Î%¦Ê€‡8ÈE“–«âšàòª’š*îi‹ƒ7Ÿ3›»tñŽšülM¾ð”.iEmmû¸RŽ%ûHÔŠJXxÝiM;7Š’Yü;™ÊÍ´s}ÝŸõPGå›ýA¥éÅ©ø!¹(вÕiˆ’Ç%Ë⸧,ç®HÜ_JFŸ“²ªäò¢\u‘Æ|¸EºWQÜýh)Gbï4*ËÈ‹/Á£þ¾\Ø¡§G…±?”ä¡2ªð€62ïÆ.¸Û:§m+sqÙÝ Œuµ…¬ÕØŽ:/€£Øï|,:¿©Ûór¢¤™±é‰Å³YXˆyex'÷Söa›˜š~%Réù±úFØ .Pdví±.Æä…Ÿ\Çk·µÎ·L.8öæáÿÃȧ !û´]õòTˆ(mieYEr‘RÍJ+VµFj€¸âRRPZÀ¡”‡<Ê+§N}5º¡ÖÐPš¡öΉd0qMQ¤DÈ56)>1®8³”‹o&Ö%g$e¢X×,qœQw”‘*oᚆB[[QkQ£ê¦²ŽéË–W¹T‘rÁûøÕÚªeÞdhFZûÇjAx~êa¼‡èœû«‰f¥»¯ƒº` ®Ø..Ó –† dI¹È ù˜H– 6‘‰’<O$s?EmfrLÀÉd$jã—ôó>*°“ÎÌúÉ«¯›ÿóÔ–K'úî'g¥fÇ@±}ìnyþ9ØöÛ(‡5J[ó Ô9C¢à€»ôê­~áöRÜÿ˜ˆÝ‡Œ½ÉÖ‚¢3æPÛeáâ"îVÿo“ƒþZrz Ÿ;ÿœŒÜ÷#îÿÁFJ±É«>,&q|À0ÜhÏ ·‹—8 388FÄ¿4&endstream endobj 175 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 1468 >> stream xœ%’ PSW†ß#< ¨XSkÕ—(•ÅaPËRµ*u©²ˆÆCx’ !,AD#V@p$Š"¢,E*À \F,VÔZ•R-.¬ÖV<¹ÚéCçÌÜ9÷Î{þÿ»?MÙÚP4MÛ‡Ol¼øÑ4?Ɔ+‚”¡þvc©¡sf ynéRHmëÇØu Ç gÔÅÕÃ(Mëú„´$m¬Æ pW{(¼ýý}=>^^þŠÙ:.I«VÅ+‚U §S„ÍE„^­å i ÷éƒ!!`òäÔÔÔI*]ò$}RìLOEªÖ Q„sÉ\ÒF.F1OoP„¨tœbPå¤Á%P¯KH1pIŠ`} —OQ”ƒ—·Ï”©Ó¾ôõó§(gj8õ 5‚’QŸR#©Ï¨QÔ産`”²¥b©´+ÝlãlÓ" Ymým;ùì!ÓSêlêèû¯ðî+ÿÞ–uV ±© œ¤-h,¿Í ‡×dëÀw_Òß[Ï›nA7Ü›ß_:Üs¯ô¤Ð¶qes-JðƒP˜é‹'~•®FVÞlµ–Ñxù™ˆ?0LV“ qì7‹ˆRÙU*>ù퇙wÙ’ `Ç._ØÝ íBõÂ…¬3RërÉ80•¾Ö‡Ðᮕ~ŠöXùVÄ?ÂH™Jœ½i{ð–í;vúB:0D)¾qúÎÅ+ÇŸ\ëi‡~G§[Ä…ŒvŸá±Ìši©¬ÝßÔX¶!Ÿ­jn¯ù ˜Ã<|ÃÍ\('ÙD½=Ó¦ïFéxN2H¨© ­}ö-4JPŒ{Ð^„¿aìÙÕp÷ A‘>Fâç”ò¦Ââ£PÁÓWÄ­×mT¹ ÃJƒ~¯_¾èžó3aQúcí/p‘éžp• 'CÝ—y¯jÜv ºê`ámU±…ìÉ–ÞüƒÀÜ>·n~ç5~§\oÊ2%šŒBA:³¹ö³€¢£•_ZFóîˆø÷è+³g>HRa*LL5™¶Ùwâw+í¢ðÑ èö©¬&Jܚב7ôzΩœA ÉT(:*ÿU2…Ÿ(#ÿ‘ÖV£-ΨC‡>=­x¼_„Jþ”¬-£ÌÐ gÊŽX*Š;OB9SbÌËÎÉ]F–ËÞú-„Ã’¢¥û»s ˜­°m‹œ´I6CÆsnžy/Ûhm+ïÆ×j-i ÖÀJPeEÄĬYž aNÕ†Ë'ò-5pˆ©M®XŸ¢ÍXíÑç‡#ч¼Âah7ñ ‘)·Ä­e?èäë;ßT6ÒÆvAe>”å¶äÞoè¨>ßqñ9€æœšä-Y‰é eÖWl¬.mØÛzž»BœÈ,âCÆ5Ùö®èú²õXU={½mße8WSO/k‰:¾ºr*„ÁB½*Ao!ôd`À‰{ž¼9[›¡>*¯Y—«‚á ·^­Ó¤E|ˆyÊA¾¥¯Xˆya¿hÀŽ!Û»òr ˜*²K’ÄuwZ¾¡ÀT”SĨÄI±;!Î+1w”š þÌ-3Ū‘‘1+ˆ#ñL'_@³ä‡ûÛàl1[&œ×ˆ6Wn0Ý÷ ÎoâÛk"~6¾—ýs²® .1ÿÉ)B“aæºM¾}.½8ü"ÅQ8ètv9» †%ÊײµåG„¸^ï®~ð 'æë)Dm2™  “2K†“§7l:›‘£\5>^®ÍO_"ÕRkùÈ¿üíÍzÞIPÑíH‹øL¼%ƒ ¬¯µ¡qa¡kÀ! ­8¼§ä~ô`üæØÌUDŒnP‰ÓÑ ]P»ˆCaÝVh´j6X™±”^ª<¿ªUÕ’ø;4A—åÜc†ø.©ÛÛ¬;fj‚ËЕ_Óx¼¤´¦ºK`æÄ­_è4Wù”r>°ãÍ…åb],±:ô:²¶¾eRû:³TÚ[*u¢¨ÿ¥»Üuendstream endobj 176 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 6286 >> stream xœ¥Y XS×¶>1ää¨8{α­zëlê€3‚8¡(NÈ<&@B€„)$ì„yžæyETpÂjœÚAm-¶Õz{­}íŽß¦ß}; ½mß÷Þ÷Hàc³wöÞk­ýë_a1€àp8äZû]»–[hÏ1L`˜ÈC¡†cïly‰a6«'ný!÷ó¡*K°äK‹ê ðGÖ€MàÛp‚ËáË× „aAÞž^¢IÓ\§Oš·té’Y“æÏ»tÒ÷ oW—€Iö."/wøMÚ)põv…Mš¶ÂK$.ûøc‰D2ÇÅ?xŽ ÈsåôY“$Þ"¯I;܃݃BÜÝ&mˆ&muñwŸÔsÕ9=?× ü…b‘{Ð${›{PA¶kl{× ÷®Ú,Ú$‘¸l =bæî¶ÕÝÃs»×ï»|ýüçJçÍX°pÑâ%Ÿ|¸tÙäåSVLýô+§MŸáF©Hµ(ÓYKõ ¯ê8/õp›žk°môOûÚ–î?îãÎT&aV‘|¦qד¨ãy“¹•ø !±‡àòŸÚÛsƒ·1(Ø—€WUWÍè·Š4'ÔA'§KEzîu¤e¦-óÙònq Ù7‚‰$$¯~÷øªÇyeì£òê« Òo}‚¸ ‰riè‡òŸh¶úy 7Î`ÿši(„ãùO*×röر„ŇÅëà-ç¢a㼡 ‡Ïþ ñoö44 5Z@‹W¯áp¹¢¹´Ãƒ]7>»s÷ºýüy66lÏ} bŠñ[ ­´†Ì­Âæ°9˜®Z´l€½®p¥”¤¢ÅޏFiËA]­iUŸ/4$ü]ä¡Á|iàûH 5G*n4z(Zg:N‹ž~Ä5„Óy ÂWå-eDE+¶ A\4mB›à4ZA^××¯ê… &Þ*Yò¡2Pó–þ'Ãé_¿ý¦ø™ /b“ƒÊ@: š@I‘Ñ4¤ƒ³Þ‡_¥çB/D÷‹é~²ÆÿXØI@AîëWp$¼è ²ØïàÅ6F¦üÝšþÐd£¯^m¿vçêÆ…óm7Ù¬sûê<ÓçÌN=,Çîô0´Ð™y dRM" aÐSÒ[®ðbWñC¨ÉxI¦>zÔ#q ÆÚ£hø†¬ËH¯gä elPßlÏ §Y ñ { mZ$ñc|«Ý´{°ïÈ)³0|†|? ’÷OŸÈÍe‘›s?¼®4Ø™\ßÒ»ö}º|í–ÛÏ¿»§{ø¨u¥ƒÉ(ÐÁ½=Ž©ïÄ®[›h8’t¡¦›¿ê½]¨;+Ü åŽdŸUùuŠ o¦{ ëUÝâóÈÀšLüÁlâz”Ã7ÜÑ8Ÿ(‚vô›[ß@‚Iò¨ŒÍT‰¶ ²(ªí“vÁŽÎlédaÞöKÔ±¼_zš-EÜÞÔt3¾9ÿÒÃ1úf|† ,§á˜¿¶j tƒñaÕpR*Äà6:³¶[ìkÁyæȾ켯ƒ™:®aრ‹â£b÷¢} k­l®`wKp¶‚­©Œ+-?úE$ØKùxÍÜꪽ*ab5G³€Â>’°sù2 ¬ÍËM«LgÎz]ŒÜe¥ßk÷« Îc]Ë‚Rf繤nÎMTymåwß%y‹UŒZPÑ?'âùðVÃ3õ=^Ðp™ÃЂ¯ÈÞ H˜åŸð{¬3bþ’‘Ý÷º÷ÍN}C ˆ–J”¾‰ŒÒÙUŒY| è(eû“ß3=tõÌRj&4”ì#†Rä„Ü Ógûè¿´[ܯüD„Ð ƒÉ¿¦ò½}”o°¦{÷¢÷ —¬Œò^ ªjXÌÿó|29ûVà㆖”êV&Ù_ õè?ˆ>^ ßê8¥!×°;±ŠÌ3McC™9±œœŒt“¡ŽWÞƒú%‰)îy6Î|-°.e »‘êÛ<ßÍ5ìÇ›W–b¶í ÏóÖgÉè/‘:ƒhÈ“y-ýà:ø½3ËØMs6üÀ+í Ò`3t[HÈC“Ñ`4çÚ²ƒßŸÀ~©'ˆâÿÇœñ ×^8ßÐÁ}Ul…áæŸÝ H‰‰©4ÌßV54Êâï«Ö¯z‰wß„Söb?,/5ÛÒØ-ö4 –&ÿsf)æ‹àPfŠì©S¡LÇiÕ›2£T‚uº:7 SX3„3ˆ$ÃñÍ#S#ò޲)Jìv°Ͱ,ŠöŽ—`ØÆVIÎÞu„¬UΈTuNJZÈ£°sÃŒŸ•âX…fË3ðg«0FáDô‹•J™A¢h…,@ì¤L+²R6e†J*t­9|þnÇgßT™uÓ==ôû×iÈ¡µ² qdË™XY¸Ëz@-Þpçù¹šßàè‚ÜDÌj”ªD•<É»"&PMÅÃ)`?Z³_€†þs?ªù)ÏŒ˜v=¬Á怿ӹ98'²z%@—I8›%@9Œæ#jˆrÝ+Þ™\{Í\ÝQ¿?ê{°€Ùí/°€f‘â"גݸ¾pgÎD#а3 ÑÖZÐØÈúð̨l C;\¶zöÛÏ»t·tžÝãhFÅw0gßÃ]:¢9ˆµîoYšèÇÃo™{°À¹`?¤‘Á*×] J±ç UÇYƒª”oÎ"¢ÿvÞ‰dD[ø™ðÓ½”C߀C0ç|3±T\·ÓšbÐ )ۆΚ‚Ójø/Óàh8®íE©1„؉b9¼c ˆÛÁ’zÉ+Juƒ.zrýØep?¶šz"h‰óÚ>ÃXö«€O‘®©ª™$¡VªTQynígKlå²Ã³{gš+âkÔ1ÕÌÆ°Ê̳Si‹BoÀe×ÎÝ€»optÆZTûz^§ (’¤˜ë¢Î9 d§dTÈjä5€z©ðm­¼2¼œ-ÎÎSçªRµŠ\,~Š K+Ä5»E‡âít¸µ££µõܹÖÃŽŽ‡;±*´Ž~9à×õ‡§N·9ÞÚT{ü\rzfµ¿õ(õKzX€¡¶±t^!Ц*“„çYŸkmš‚æôGÖ©à8EÁ!•ÈÙ‡Q+:¡Bû-På0i‘g§%Ç¥Gçlšé™ ²^~9ö´ñcà2¸—q&ûriÑsÐJB²vd8ƒ5À  ©qö>AŸ[Åf%‚@E¡ ä(PžšÇ¾oêz)ñÏ}ÜòçŠÞ-þÿ·vÑ:Ç^9ëý ýØQ‘ðx‰>_W}\¤¾Yù dÐÆÿŽq#G{H–‚ÒĪÀbÌàØ | }‹|«¤ €ú¬âzk½Èq`}Ù8¥§,œn¿Rå¥Ì¨ÈȺ€’£IÞ@o€nwÈï[¶<äæ0§‚¾ø™åÞ:úRT"ˆDA‰¨²²¤¤’AhŒ¹-Ū‹/³{:ÌPþ>&{œÙ׸¿ ëîr Ûß7nòHÿXƱe[R0gÕŠEŽU™QìñCÕ±Ã3îH“À I‘ð¦öÞ¹æˆkF¾9PyôxbQb~¢Æ«WÛ"ºGÜgäT§1§|uÑçp£îû¢VÞâwŒu;½?Ë3=$Ŧ 2ù`–g#8IµŸ>}òóæ%c…V˜oÖ¸&æ*×ÃÆ7žÇ% Žø )?ö/²Ýb§~X÷šÞÄ|̦Å0†ƒ¡¯¡Ÿ.˜ku$š…>âÁŸLn6ÓÅ™n±s?ò˜Û¯+{H>~€C2çk”U —…–æíýz[èhÜYè¡ ƒß ›×_}Z™[’*ô‚œl·g÷n»óoø¢Šÿ7«^’hD×Ü7oº¾ƒ#ÌÜoTzØy½-îä1Ýb4¦ßøy?ûÇôù‰s®’Æ7×p^¤‹´˜ã öa”É¡§1ä}G«$iÓvÅ Eü¾G=/ÌÏà:þ³ã§Z49ö çËzñzïÿ´¤Ègô°»O¯Ðpë8Y ÞT4Ù¢­?£±ÐòÞÀqЖA>(™þÔ‚“á”Û?Þ¿{VtSìÑÀO›}¢ƒ'ï^wAWöÕ—jÁPDÁ…|¬ašáX5•mrQXÐ&eà^v»?ØB)„çƒÁ!d­¤b„‰~¾‰,—\@PÏ\ úÀuÿ6ñM%.Ÿ…å ®F R°hœ4‚ S13ºŸqC‹O¿Õ›”á ydã·ÞUèš K+?%ÉŠ*m9¦Õ”0ÝÏï÷|&Źù¦À¡uþ˜ªçÞúŒVÄÆÆâbbD3¿5É’ª^Y"d˜¼p Zt••45Þ¿~¢ààiŸ£áhàòå‹]kcò4åÕZEZ| Spòd9Îé/õ­wtpõù+×¢±H8 ­ÕTf…ª¦V¨’cK“À PÖãÆrå)»êƒÅ›ÕÁ€ ÃøU&¦c_)q×#ìñU(Øwɧ/pîõkpGc•T” ¦…e·ÔågÙ+ՠǥð¨îÑqüÐã½lx–~{r½“ÝŽm‹W%ŸñbJ­ªÔ  VgªT@ ’©2‰60X$ó^ðrÇ<ÿîÕûKûµÌƒói7qD¯º‰xhØæ}ý‹ÃÊÊ´šòŒ„¬ø4¦®BRu·Í㈠òˆ[–¸?ÁM)1LjQSÞ½Õ(ÌûÜfhy$P‚* 9¢™ªÉý8z“¹89¼Õ›kàÏd½"Ë ƒ@\bd…t“4ô…/yè%ßdv‰±›ã|­‡ œ,æ³úÑ9ÑE9| l(LIÉLgªÛrÛq_wrý–•¶-uÝ“ß*fUª´L•ZmÝë˜r‰&0Tå¾ìÉ:ÜSø× ÈýyÅk4ÐçH¼ø0íz®º é8gŸYâîä%­»ž¾À¹ äKãb¢œˆª*4EÕ§|¯NAãñkrFÑ»úÈù×S8òæ¿@»œB=0Ùh: 2Ž&Bêòås¿ŸI†bÜâmøåMQa’wFw0è1›Ž•¹±J…²{+…¶‚éŸ+z˜ƒ­y ŸÒW nµ;Ô“%_ Kd¹dÅÒ ·\‘2¶¡kveÔôï`›G~ßõú骻BfE-½Þ¡õâÙŽÓuìß»Ëáðz]³XfwéæµËÏ¿½ä°u³ÝÎeÆ\_iaª†óoBv—øñ«¹ÿ&¾ü7a¸G7ä„GxÊ“˜´_”U¬5 ;[UJÁÐãš7™°è&¬ÂÑâg\ǰ„ŽD£VÌŸUj€J’—œ’œ ¨’ð’¡$Ôÿ@í6HÂñ¸ß÷ÀhD<œŠxS–`[y]ó EÛ…œíL4œA«bÕRKmßá´rùÝýgw.Þ¿U¿kw£ŽSÅ©â)Tñ%ÆpÖò##öñ–ëá(t†£¸ð —nò«ðõúùzÔk›*jjtÙâO3Òˆ¶S=º ƒ®SùrûÝÛÛ\xÆpŠnŽk Ï=¯Pà$ò+“jsêÓN^wýÍbšùF¢ôB)ãÁG„lËZ°ì«™?À¼+æ{¦.”OMÉÈÆ¸*ÑIý‡×žZGFáõR ¬«yx—7yw¯Á5·.dUNÙæÐ;³œë1ó7Öž¼ŸCéP%}=¢å0¦¤n¶DR&akIŸ±Vc¬]7—–{ üe± ²XÌh²¼°¢â×wMØìâ)x纟Uö8à&w&Ü„ãor:;:Åß\ÃúwCéä u*H£JBóÂ’è£ ªø}­2.!È­C µeiš¬>ù™~àÙé´ÇËÁƦÑáÜù†ÎÌÂM´"´ääÉ¢’ôô"Ñ¡C¡"\w zú¡çU¼Ò~ÝêÆmxåg÷Œ+åa¥­mxeFaðáƒÆ•øVçµ ç’a.×°ÍFg¦å¦-U&Α)£A´”A[”":H¬$Wž»¯UZBz¢ —:M^‰&2#&E p#ÏUŽÔqÞt>é„ñ‹qçVmf¾%="87¶@Éoö_,ØQâÑ)9ýàçר›6nß»{ö®»¼ÃL„ÔÃ3R*ô‰q^ÔŠ3ë^ji¬­`êÝù·êvŽ6¬½•¥0ŽUúFHBð>YPwEÓ‘”F¡íp-½ˆ˜ êBiUIX“ õß»£tŽðÌM€$0@à (÷è‹u-éÅm'{’x×ÃÇ9M†Ý\ƒ|Mg5‚¦f7Á¢×d„p÷hY,|‹fѹÇ@s“'ˆf‘Œöîǰ 4npA ·ae_­ãÂW†XZïuü§4@§viO`T K¥JT'‚8ü*l×¹ÄÄÇÄ0*¬@–_úÛm8šùc\¶ÃR:;=+ h€&"C‘‚º ¯Ul’B•ˆ+¬D&’äÈ3cYØ€6¢ShÛÑEµ*ŽÌKIQ«SM¹÷N„ëÕ*L®›wÓ ?&Už†¬ž ø<ÒêŠÛZµ?]“–’j| ’§Š–l_¸“ÙýIø|°lÊusVûÚ/ÊU‘ªÉdM{n½Âµ˜RÅâ ÜŠxµùÕ¾ûŸvJ/VH3c3âXhµð8bÀG`Uˆ­ø ëª}Göû)ââcpù§†T”<»òüsáiA¸g̺ZÃ8|QÉ].< §Õe*.×é ÁË x)„*[u3ùZdšR-Ö™44*%ª0†ýuç;DQ Ä[‡æI5)II8_ˆÊ D[ ´V¯†Ð^‘¨S–1Eѧ„á¥2µñ)¨&/¿H‘—ÄŠsVIùõ²UI6È©T‘,_"OHˆïq îÝx,€Œÿ{7ÆbÌø5 [ÒG®ðfßÌ÷I—×3Ж4ÏÍx7Þ¨Õ¾ÔÂåá l–ø!^€Z2dV3•ˆbY2 4{¸(±ˆåGã_Ý›@6 ñˆŒîMxq6c&%#!MãÂZ5/sw —'„ÅqõÔ¾½-®x´îw ò÷ñ¨6¥¥©Tê~&à^^}7©·[°í§Ufü>Íè7¶5éH#žµMH\‚/o¾ù-²ï¦¦Êð¾*\ÿ3Oâ3Þo2ão÷0áôŠa×pð%žT½¼,‰gÐç¿Û(¤ ÄZ‹Šd…¥…˜‡FgÖ¦ÃÕY$ Måëé3ƒ,–u––zË!ñßc¬endstream endobj 177 0 obj << /Filter /FlateDecode /Length 5070 >> stream xœí\moGrþNäG,^úÄÑô{w#NœØbY¹|ŒMR#î.KYÒåÏç©êžéîÙÙ]Îre‡À€Yê­é©®÷ªîž¿ÌÚFÌZú/ý½Xœ<}.ÂìÍú¤½9ùˉà_géÏÅböÍ `H9 M°ÒÎ^¼>‰OŠ™PªqÖϬqTföbqòrþj~й[-t˜¯nOÏÚÆ„ ¬™ßÓ¸0¹ù5^¹ æ ÂPm+‚™Ÿß`\ äW§§gZà•­žÏØÞ1\=¹ºlÛ†ù›sž>(ƒ–•w"ÌŸCËÆ·bþž”m´›¿%„ –%U§Ò6Vxß™ãéw<æ‚Çëçëø>-â²Z¤ŽsñË®˜¶´VóeœÁbø= Û¶U€1^Ie+äË8/XVN¼Š£xStïo¥Ãl ò²1ä%Ö¼Í8¥Ÿ¾8åp¢$)A÷úÒB ÝdÏÖ©Ð'/¾|Yf邈ýÃTÊX:½èh¡Ÿ¡°nö®m½U¥xJ:ÖY>ëîyW¢Ã‰#QëQógËH ™z¡¸…Ç?ßPd-~ 4<Þ4TGŒZ¬ñ?h´õb.U¥’ó/™‚QëŽÃzÈ‘äQSTl=,°§¹˜ 'ƒD„_¢Žò{ÝÖdGeÛmËxÛûÅìȱ|Z} úº1JuNí]cu.2%59¯ŸH3JUJç—ÂE7 _Ü«;{±:éŒ^ôí‹“Ob†{·##Ö3òÆÊW±5“g¶Mël̈%ƒéE9ýÔ\Û)âà ö×hZ;ÍœLŸMù2f.&ØÒ}–þ<)‚¯`’®’œ9#\åQRR#˜†WsÒGˤý5ƒÔ‚H ‹ž*>ƒåÓŷÈ­ÀÔÉŠÕÀŠ+¾ Ø‹‡ûÉu´Ã:‹±[3‰ òd` ú*¥1Öª©ëÕA5ÎMwZ•÷é׫u£0›1e‘‹+f_da’Ì ‡ÁåÀÕÄÑû £ç¼EøkÉ•(r%òÎY4çóä‚§d8ƒ÷¡x¬ án”†e×£ä WQxß~ÏfiØJ FÊ,ùlÅ”%ð.ƒ×ü8Ù/!;l GNZ60Î(f³S±áÚ´ïûX!@=ksTñ—€,©8ëuò7m?XÙBkÇ €ÐFfá,*yrh©LÏÐÏ—ù‘zrG®.†/r>VДžlÎjÊ?ºÑ,]ÏÐP¼l¼qe˜Ö¼täµ?ÆŸy€•¦8”0¢'¦Ÿ' éŠöÓ…_ ±O•ñ¸U˜U‘÷‰âÈ¢äö˜( vg&Ë- kÂü…Û´ÔDdÁ‘Æ¡¾!iüžd˜Á]‚³²1ZNÁºQ?ý‰F`ÑÈÖ?æÑQAVOŠ)XÿÄTÙ¢†h¼>®aKdÄHoY²n—a#M’V†Ž/ãRÚ!» á~5a†íóFEø¹R©ÇH÷Ùdé>;’t… vøô|dÜr‰ßå‹Àß®Žú®Nïør«‘í4ÈÚG+üjÌa'ÝN•覣¥¼\hNùC—ûöÊu%§¡-ã69uYT)ÆHVP¤ïÕÆc‹ÓaxÛ•Ÿ¼‡ÁÅJ”ó ÞOÖž–v¤Ìq}B‰:êN˜ô¬ô¬ÌWÅhÎÊî9jRµDŒç>j¯ÆêA­OÓ{#*R†lÁEÒF«¡$þñ˜ÄYp#+¢&»ÔÔóMn÷ym–Î\T§€ÕæˆÖV£;X‹ÂN;ݳöËÓ3+@Ž—c\VrœËX8µšF¸,wpù rL{8NyH5=®À’¬³BtÖtm•ŸEz¼Ña©W-APϹ[NÅeàdW¤Þõƒëº®Æâ}õt„–=DI‘w¼óòq§4)G²ZDšæ¦þÚ€h؃Ä<…)%I­³¤8å ,¨Û¡O­í’6Dýãß¶Ãm{Û#á¶=ï'O®el]äW¬6_Ü:Ê1ém!ˆé-"ííJà•G[DðÖ¨mL›º ×| Ž»,–²6v€R3hÁ« .2x;ÚCú4æ i²¿.›2»õl•Ê«ÇkTçhÑøÑ0$Ú¢=V¨LžÆB Ênxš] ,FçîÛn"k£öº¯êv‡fÄÑ¿î%õ]%,.jñÆs—F·e;p½%”¯Kͱ d´š¶žR½Ø¯Epì¡»ü Ò%µ/„*šPuÆ‘Û<Yøè£cÇÌj2ku&ø*÷Œ×äª3pv÷u®R _”O²úT¦f Dë Òp9ޱ =¸ø›`e‡áúø`FàéU_É(_ªb%gøb²;3ÁJ+ùOkÚ·t©·tûÿ6mÀ>À¦ˆOÊlŽíø´§=Ú Ç7ìÖ †D©ëg›yÿ2ƒ—“Õ“v¸Û-ÏIÏHçw3A„f¿Á„<«T®aŽìþo{տ˪Y©~Wu<ÛýfÞpî|å—#o´Á-ªulM-i¨¨oÂ[JŽaL€¯3ºO+ŠÝÒÿ¬J÷n‹ô*^Žn‘^Tû¢X?F¥ šY&Ÿƒ”4Wq¿­ó?t9-¿ŒomÚödð×8W çsžG©ÿÀ½©CòT î€ÎâîW„Æ ýYûï¦Ý» §£i÷Žw€«Þvm£XŽîÁ|‘¹ò‡ þ˜³øG—Ɇ8vùÎ+ nµnFM Rp[Ð&Û­èmÛ8Ÿº ?6Y¿Û—håÑ6%,ö‹÷[s`‡ªÐcðt]&s²Ð•BT’ÔfW³þÔ™=êØ{àïö(ãó­Ê8ð앵U!5p¿´j o½±[ôg‹ï8nµ­;Uñà—(O'ØÜÝ*³Žoþ¦Ô5xö¥_”;:4åBƒ=¢«0˜Ì‹Æ›Ô%x×ûþ›ìû;Y%èLÚž0imÛwhÞävñyn"_çÑen8â/;…?{õ*ÃßÔ‡p¨ VRç ‰fc×f ç-l> ÌÜm+t0ˆ cQÇ<Ôøc¨Qùœ,ÔÄtõÛìÉÖ9]½ÍQ<ÿ|骆;¨ç§c'ë.»-.Sæ úë€Ès8ãÇ‚Š#9żW“ý±!å=Þ!™¤cÐ}m7òÎ3Ÿ· |@¤3éÝoV†nïL؂ؗ¢SÐwüžp{¦mŠã[]aÑÁ{ˆ+ܳ%ÒÚ}1/× ƒ‹iWû ¤«66†Ø­¯SLÔïUso]Ù}|É 4çG;«”’qÌFné÷j'vÆ´ûÍÇ3¦´}HŠeH8âoǘŠr·±ÐîÒžD…¶ÜÑý-åV6A¹¨î®è ƒÔ”^å§ß¢jØ ÷U “¶÷4‘$y[V›i»úy×x•÷’yôvt»ú*gXëÑ ë:#,ºÖ^N‰Îq¤Ò5é@1Ä;¿)U .Äâ7Ž¾Ï£wyô*.FG—yô¾œwªK¨<¤ç¾í¦Dk`Ôx°©9´k a(É èèA)JëyCn•÷ð^çvÂýÖ‹,’òfÏ·Hì|¬ËÌ—¼è¿Ïƒ×\õ¿Oo+ˆúCu¿)#ºðX\jêFèRÓ.þ+?h¥ 0,Ô²|5u½~à;•–î¢ñM3¤ömw=0^o·±­)‘ð;Y!-£;˜J¢Uë╼hó<=Ө߀N…gÿä9¶ x£ë7•³ÓC'Üüûxwrsü(_¾ñgÂ^ Pø£Îh5ÿ»‚¨›m‹£KŽ5ܔ痷n¸bÆšù6&~–‚«œ~nº¹ç@¯É+Q~)ØÖdœ‰$Cë* rø[i âu…u#åµ8éBžG@;0íá&NÇ$|¬èÎÿ ÌÄ]ëtÔ n2ÞK£ë ÞgðûŒ{žGo2¸EXfð9Õº´ó¢j™“-kèÐ Û>…UÏ·àáYZÙFãOàEF¸Ï£×\UQ \.ø03 ¹×Òq‡(Ï5ÿß©.DZ*-¦ nûÁQºÄ /Qܬ=¤¿" µ—GÒ(úü0X-m­÷ý·NÄçYšQ š‘p_×*Yèyßë¡ä°ÚwI¡äo¬O­âÓÇ|‡Ê$­ábé­ÑTºë£j¡œ,5èô®ÓäQµí‹_äÚ–âg¼GÈyâ±VÇ‚›Ø1“—¨,H0GÒ?è²ò4)þv©žur·µ6žà[¤\ùÁyIää‰4ßëF¯3HGèx²Ü(rÛdQò|€7‰\äá'y´Ï<Éå’>³@"sñ¸6ô<`¢rdד;SÊ¡J‹BLcNTùÝýãÏë‰Øü>‡J •gL¥`Ht^Hbþ#çGüž*/ds€'å? aÌ©c8EÝ9Ú_Í÷£BÕžíQµgQ56‹£&µôqRRëw:=¸l×g'vTlÖ#j> r£œót=Üó5¼Ëà*ƒX!¸õó5+&'é‹4ÙsÎ+ÿ‹ÿÿmÆ8@e ’Is¬$<%At Óê|'ñóæ@Ë)†7ùè-íŠhä2Ú£ÖœÛî0&ö”ÔÀˆ"ÚÊ_¤ˆ2õ’V^Òa’ʼntp¦ kƒÈÎøŒzý$ðÑX â–E{%2šLÕ[‚/1³3Ùø á=Øn~*ZÜPJz¿%µ¾µår; ¿ÐÁk×…·¹ç{0ÂHRw'ßV})¸¯­tó§ÊÓåC1þf„æº4œP𢓳àUÌ ”QÞf”r–Ur—QÞ(ëaË(_dºVÅð¢@šg,pW ¬2Êeò¾@¹È(÷[è*^TlZEf$”òÑ›Lú¶æØ» 6.4uýÊ…^ØWÕêúÉŸnE%w?‰<^©~×`qKî¿­–6:ÝMÿs¿fµQ>öGÐ#–Âè×Åp¹žÛŒr7T¨~É=ÊûJqê–eBY¿ˆ¿Ge>¼ÂYh4oäïÈ&#¹ÊfW†ª¨Y›Ýz“©<~ÅXlËVz|g\(oª…ô([èºÌÒ«Õ¨Tï½f·E½îö£,†ÒK(w¥MÝì7»bO—gL¤¿®Ø8:ci°Wãnꃈ(ú^ßèN†B–€(7" (RÅÇær+}ðº3EBC9}&Š2ä‹´ûèúÞýxò_ÐãÂendstream endobj 178 0 obj << /Filter /FlateDecode /Length 3215 >> stream xœí[Is[Ǿ£ò#pJ=Èáhö%ŽVU*ª8Ѽ8qÊÅØ€”%§üßÓ=Ëëy è9ö!¥*ª1˜µûëuÿ^r&–ÿåÿ¯6‹—ç",o ΂Ӗ‡åØß,„RŽY¿´Fy¦ýRiø,ÄR)æü¿_/Þ. ~ùÂ/ÿTõלi·Ü,´sš¹Ð¶Ü-¾†ž7‹/DÜÑ2ÿwµY¾º€])¿t°.–oi·b) gV´æòry±Yü­ùË &ÖÛÜ®Î8ã!£es¨?<à‚à¾Ûk‹ç"èæfu¦Œ‚O®ÑØ,ƒ·V5¿_i'ýÖ^¹*£¡³H l³&hie³«¦ÞW]îW20'nÞ­¤gÂyݬa˜çÆJÕ\牛¯âøà¥pÍ%|oƒ×B4wÕê.´Ü6DúÐü¦j¾K'÷\J›X"9 •yyi,nWÀƒÛ'ÚAgŒvº³—uÅâØ]s!}§yO.BWëj#ùðÒãò°'/%×-¯›óÕ™ã€,šo›jŠ}yº·+”¢JtöQw߯þ~ñç…T–Ááe×€©Á–¢³éû"~[Ëæ&ÖBœõ幬a¬$ƒ)mYä+˜yzWI !Ç6F$™ZÎr‹È’Üiƒl(½Ó2mQ†nBYæÛUuV!‡þñbñæcuËŒ×}êä-ÓªVøÜ‚ ßö ÀÁ¶S @iÒLSFÁ›¥‡qVwŒ‚ÂmY˜ÔQPÉ(<®Î¼cP|h)À3l…sƒxÊm ò^ 6©Ë–Ú´Ôº¥-µëŒP@qÕ\åFÐdã¹g\ FμBÜÁ_˜ÔC= Yò@Íç«cåÁAÐÊÏDµæ{¡:L”†i˜µ@'Ê‚½päÆL€ÉœŸWº&Ö8míª•ß]K]¶Ò=tdæ‚‹hL}*ɊǶ»¶m3ò-àÁ98Xçÿ+ã…K1§l `&p— ;²é±.ÀÊ:È¢ÿˆR@¸0¿L*0F`xÞµm—-õÐR€`¡Á¯^ðX8@Ó\:n@ŠFÀœ°ˆ?"6( àØÆK"a󶌻ÿv/ì¾ù4Š„Ž×ÃFÛ¼)¢n=ï¶šD¾_YÄŠ‰ž«"a­fMdô.êþštÿ>Áܳ¢ÌJø&$Û)”)ÁœiAvÝ*Ð}«@mÛ?Zê®ý8á°1:ØÈ:­#72Ç熭×r”m0ãÏÉ1 ªâDâ˜F/µ^f¦<¶Lé0*S·í·W¨ÀŽŽ×Fi=Ó>“:‚ŸØ ÑŽÈqøKØG[á,¦M5¸@™Ú¶Ô¡¥ÚóîSÌ”É+"ˆ¼'†IØN€à²ÒºC_ëbÃÁ§â¤¸;j½ŽÝ.ûã°co߆黀ðH‘e!‰¼"ò¡ß!ÎP [y8ZÈp fO°¹ãðF¡`R®Éq•ÀdKZæ“OZÄ m<}’÷&Äà #}‡­VÇ`Ö„–Ǽ,‘Q\±‡KÖ½ˆÆH$'rxù£VNdœtØp‚¿çözB,6ª].0åqRž<1þKÒ.†.CணÍ~ï‘èµ!V‡ô+ñs™EóÎQCPâ:¶–È!‘'˜_T¨K³`Oƒƒ“Ê °'§°ÒWÎèÅ À#xD.VŠƒÎ­²Ëg\ó6!Ó}ž&²¦æ©å©êOe`ŽðÓɲ3Ýî Z5Í|Ütjt:3~PR¥:9Õk©¾?!žÒ *,]N^÷4"à‘šÛàÝR{Òý{Rx0àŠè¤"Ï2‡åÏ«%NBæ>³’8È…(Éd’ÐU’׫$|RI^£$âi%±) Ñç²ø—“+>žéVpæNˆ“'±h5S&GÊo~õÖÙpÁÄxp|:ðŒbz»É¬¡ »ó„¢³Ù(ö,jÞÊ>þ-Àx$/ZŽŒ ÓDFcøÖUv­ëé,†x‡™tû)”Y'—ZK¦uÎ. óô-¤ˆ6F·¹¡Í#=YC­a¶|k²|{"'ìa…Ë!ÓÄ\¸”–ð„y’'Ô€ÓÙHÇ̼%5¹'rOf&ºhm"ÛÆƒ¸C7ØÊn:‘[ír‡èdLIžõN·]g‘5““~NnIÍþ0p#½~*Mÿ-Z‘©l/â¥Íñ!ýÖsÝQËÞùCpTÎ@~ìÚÿq­Òö÷tª{" QÊyÜm7Jêùãªr‹ƒŠRþxbEW™Ÿí½IRÀµ¹œ©¼\rñÝUkdúI v«ÞíZy’SÈk"o‰ì%;£ÃÒ‹!Ù‹u y9ÚŠu*4õ¡€+=º.)­o ï‰|7ê@öýCŒ» þ-äúhá{㘜«œšb¹„I—vPÜÚQ0½˜º¦ Ýî¥G!_P‡÷4x]âÎO|g!vlnà;žÆ €?™ ð§[ÕÝL,Û=ɲºàZ]5ÕÙÆ¨Á)]׆h´óo>!<6ùøüpN›-­ÃW‘ãRع—»Î¯ôo³ ÇûÞ׺z,/ŒôÌÌ\Õ—Æ2¡ÀœÌŠzùëQ¯÷šò”­ô.j×¾Ì@¼&}ý8¿Vžg½è,øÉP=ÿ¨j,šëF @Â<ásXþê`ôé„‚óŸR“™D«ÒLJ9€ëd–pµA¶/±RvÀ?³»¨ÄSÙ]$§²»8Ö I%¨º²vÍþïˆ|× &„ò±z[×zm^äÕ0R¬ë¹dô³\@tçæºq(ø—ŠˆÇMu ýªhmðJ«ïõLõÿC¿¡9¤æbæk)$xŒ¡—™LŠ{áOÿ:´÷¬¶² |ÿ¤ ,?ë×|úLÔ|ú^þD«ð¢gx¬‡tFe«×ÏE½%*tñÇ<…lͼËÚ¯O+5 83s½t+‰àrØ¿z}^¬O{¶òœù‡¯ «¿˜XÇ·ë ® ßONW„ooçUXF@y[~~0K¢ž~X€¶ m_!7Dî¨õH­DÆëPž*Èɤþ³ó¤T°Žõ ÕÙ°oÏ/`¡2¤{5ƒŽ9=äÍä%‘¸°E‡ŸÞÿæÖ}wXî0>Ù–Èê{ô[aU35cFΟ­h™³ÚG§ïÛwÚIÕéÕõéj`!#ð3ß ë™¶~ Ï¥íµ|3òXì”êŸéÜV÷sþ'õ@a´„Ð{¾{"ŸnNzO"4œßÎ| ‚w2Æ ä=}GؽÙ\sÐÏèW2ûÕà§g†ÀrŠ(ˆ•ùÌ¿ùøóÒ O“Šé™ïW„„lN©ˆ&3@ ?=ý|é'ºqL\~yȆÄÌJ»ƒ™‚Ä{y‡—ÖkÕÞÿÍâ¿~@÷endstream endobj 179 0 obj << /Filter /FlateDecode /Length 7223 >> stream xœÅ]]s%·q}gùG°ô’˲y  ñ™ŠS•8q*–_¼Þª<Èy w)‰2¹\sW’õïs0=ƒ¹À]-¥u¥\Ñ‚¦§ÑèÓ_ÀÜüíÒí¥áÿ–_=\üú…•xùÕ»‹¿]8í±øK/9Ó¥s¦£_ÿ}º½üŸË7rÌmºüþÂ^þÿ÷Í…9ÆzÇl2ÿ›ãå‹ÿºp!H¸Œbå@ÅCûÏÓíÅŸ0œË±pÔý8‹QL:JG­; G1)Ž£NŽ/vÅ‹ŒÃâÁ/†³;†2ûpÄ ¢KæèÒ8ÒÑp8„cš<óÑqXÊQÜ8œÊÑsØÊf.%‡ 6h$ž°Þ©Ø”Ž>ôuî˜&ÃhK° ÇÒf¤ìfH8F0%í(¸ä#6Ã1Ýd8d>ÈÑ;š"–.—¡HhÍG¡v2Œ­4ÓÙTÆ=˶îxȹMžÆ†¾ÁŽBã#ÂaïÙŽÃ:ŽáXÂLOsÄ>& {€fINö0°ín´d Sa'OO䟦›Y ¶‹ö6ÝÈZA··—A Ç~ÄPq™ª0ïF±oŽœ;èRœ‡ì¦X’›r…à &§) $ÁØ0}{†"¦K_¼å†ahXKŸc˜¬F£‚Ë'P)“aªFMœ]¨Ü€ˆè·L Œ‡äKÿqÃÅ@xØCÉý 1@ˆ±x8˜£0 &Ó¶âÕa2 N°Ý ¦¥Ø‰ÌÅOëâ+Z±ÁcÅ[®K†¡x˜]Œê)yèDä¦ ìÀ¸vZ¥ˆ·°Ý“]±ÑW$Ù\­Ô0œ"_\Àð(w g«ĹÙÓ†ÓIôk£Üt݃ÃÑê u<†°"fò4—‹§C’‰í‡Í„Í ptœ œU9Dà`´{∃Bócæ@¾¶Ú/7@Ež{2 ’ÆMÁ®s¡á,G;n ¸§ª… 4Q9áÒ!õ”'Océ W^&îD& Ò_ÀoÈ(ÁŽûêŒÂÄhãÕ…j­˜‰‰o ŒÆ©.{بh´0¡³a×<™C Æ-õ%¬z¬[;y*ê8̽›p«áEt’éÒ†a <2ò±y!ˆ/RC¡+e L°`ƇLC`D† e².úCÚÙR£‡aŸ“(t #ㆡ>] ½Ö0œª¨£‡]#RXÑ[3Û†ƒ¥C_'öc–™å„¬«L=b͉"Ò;‡ÊZš.ˆÏóÝ4"£žF:q.[&A$Úv¨N!¬ÄHD&¶…]!ñ“ÃÐSjšÐòŽŒ'_ÜXâd˜‘,•Ÿé»Áp5.„é0 ïiR‹ƒÇ¸I2ìGé4ž;JYW!Ãn,Ænˆâ‘ÊbƸ) (ËtDfd[Xb Àè±þ0„šèÿÍèIœ ÂØ!)ËfŸ0n’ZžJSÆÈ…^*æ#ìÒPgaëáC|‚ºOp ‹Bÿž£ŒA“¸ÌѰæ5'Ì9D>†3èŠÇ•;q|áæ4;p@Qe®19 Ã$Áƒùs>:"‡¼êXc;ËÙß™8\µn†õð ]Læ´a(ƒžF`ÄwVâvÚ8"ÈÕnb³!¡R×–G}„àuª’Iã¦ÜЖ*×Ѥ;¡¿àpSaYvn»:B Y¨¡‡†Jø‰ír4i!5…šì8­-7…ÙÍ$7òh3ØÉM¢èC5Ê y”º÷ÕÚIӌϖ €BwF[=ósFËÓ`Úy81ê[€™ä|ô£ð7žÿ†qå¡2âwO.ÆPÙ„ÊEž<£Ž¯¬q<„>Æ޹SˆÀ„xB;ÔXÕGèÚ$¥  ¥ ›”èf LœjjÈ5¨ò‘žÉÓ° –Ú¿3+ÊXCU¢í†°‹™ð†2ÇII†i §©&±æB››`s'Ù`õÀñ,úc«,`DZÕã({•±)iR *Õ×øŒU)Š kæmRkJH£‰ ì§YvbäQ8\f›™IÒ&ŸfWñI½NºY9sãŽ$†À‡%Mb"xõš&V¹ÌJ¦qªL'øÈ0q±ÇOD¢¶m綸ìkÈ^•a¢eN”>’ªTFƙէ¦†ôäTãȪÁ“jMÿ:Mw\Á¢£oà™¸þBÔKƒÞ¬f½v®w²ê‚ÀÞ•°/£ìuaØ«9n(ÕääId\¢¹0ØËI,ÿ' Ÿñ4âÈIᯡ±õfs‹™ŒFìÕzˆ·-šÄ·ÆÇfŽÂ,fMµ”±TÙ ÃH©…Þ }“Z «@UOfœº©±TÊ~–?Z*œ`ô[—»0séb\Èþa\µ ÍáçTf˲±VR2¼Ç$sµÙU‰–Y ¥Ôäɳ:7É<­uDÏêÜ$wDˆ3âK¨¼£Hæ…Eµ0«\ ¼³>hP˜¬6˜oÄh™@C•‡|#ì”HX<-Ëè,laìêùÉÂdYX}O­RäeaaZCAæKOÁLjK  ês«1qBÜ#le`…k’ ˆ­·2…Y–üèH‹‡~Nð\«µÉI2À3zÇ“¢É©e®ç,Á–I\ "›`áy'F‹¹‚åÑ?Ìé„t¨g‰žÅÄw:_Z½eZgª&K’ |ÏŽSy5…Ë43;<èe‘áÛ¤8ìªÅž5ՉȰښ(3È›ÅÔîs‰²-õ ÚÓE$…­–ÊluXõë®ÔîpÙ„Ð…9¢þ,–«Yþ=‰ë’w¶h=œ^{¸ð¨[o„Ý_üiœ³u„ÍÝ·ü¹‡­“¶ŽnRÌn?iíØ&pг´M2—_qéõfÛåòÏ«‡ËY%s;›¨½üò¢Ý{£< º<-á ¨Êˇ‹/׿®®ûl>˜£ÁµÂgmdù€»úß—¿¿øÏ—þzkŽç°©k|€0*©b›Ìrí0héÙÍ*íp®›µôô³‚‡ݤ¥c7‡Éëß§=ý,åt›Õóþ‘¢¥X¯)_˺8ë¹ô`Ø¢&[ í:ÂK,bŽfL‹˜™ýdYÄŒ?ÎÈxÓ‚vwjUL투aÃýßwk;íé´ù™Z#õâvƒÜB:XÙáïW/¿éÖŽ®î ÄW×~ø3ê:þøÑ·,Á‚w—ÿñX¢ ¯ ¨¤¬²4‚цՆRJ9(å ”ƒRJ9(å ”£RŽJ9*娔£RŽJ9*娔£RŽJ9)夔“RNJ9)夔“RNJ9)夔³RÎJ9+嬔³RÎJ9+嬔³RÎJ¹(墔‹R.J¹(墔‹R.J¹(å²PvÆhÃjÃiC´áµ´µ‘´‘µ¡”­R¶JÙ*e«”­R¶JÙ*e«”­R¶JÙ)e§”RvJÙ)e§”RvJÙ)e§”E)‹R¥,JY”²(eQÊ¢”E)‹RöJÙ+eÅ S :Å S :Å S :Å S :Å S :Å S :Å S :Å S :Å S :Å S :Å S :Å S :Å S :Å S :Å S :Å S :Å S :Å S :Å S :Å S :Å S :Å S :Å S :Å S :Å S :Å S :Å S :Å S :Å S ŠbPƒ¢Å (E1(ŠAQ ŠbPƒ¢Å (E1(ŠAQ ŠbPƒ¢Å (E1(ŠAQ ŠbPƒ¢Å (E1(ŠAQ ŠbPƒ¢Å (E1(ŠAQ ŠbPƒ¢Å (E1(ŠAQ ŠbPƒ¢Å (E1(ŠAQ ŠbPƒ¢Å (E1(ŠAQ ŠbPƒ¢Å (E1(ŠAQ ŠbPƒ¢Å (E1(ŠAQ ŠbPƒ¢Å (E1(ŠAQ ŠbPƒ¢Å (E1(ŠAQ ŠbPƒ¢Å W zÅ W zÅ W zÅ W zÅ W zÅ W zÅ W zÅ W zÅ W zÅ W zÅ W zÅ W zÅ W zÅ W zÅ W zÅ W zÅ W zÅ W zÅ W zÅ W zÅ W zÅ W zÅ W zÅ W zÅ W zÅ W z`ùêÇ~KÄÃ\~ÃäšÇ߼܌ԥeÁkLâ•ÛË ù±KÄšû¬ÐÖ /bµÖ·Ìåå•EÒnL9<]ñÆ!B‰ÃÍ7·¯Þ?>]];ÞvEâòCMV"Hf¨ýË?\þóÝû»‡›÷·Wÿ¤±ÿ‡?<~bwìX]BoXß*-Ýøâð»«k^{,!xw¸ëÿøêŠ—ÀàXÂá[öÃg!à×ݜ۫kÞF0v°œ^2TþðÏW×LM ‡ãìTŠ/éð†“ù±@æsül¢X“‘ñðN@ò9nØÍ2¢Ø4]>¼ÅŒ„ø¾îësHèrÔwƒÚcÇÞ—í%Éì»ÿruÍËWƾaïÂèíU#D'‡WGïÊ¥°¹v?u/¿iô~$A¬Ë`•®q…ÐÀŠEs,¦$tÿÐÞ™ i¯ôÞtKx½ÈzÏÔ×”ã8›@ö/Üfô+xÚ‹rþ®ë[5Rl#2å‰zŠšI¾¹|ùu×xÃw›…:)ûŸWª˜úµö{ûp2%Y£oäñr9ü¢ãby&•²áG[؃ÐVµHý©=i²Ûu¿Û=Y…º†Úÿ@ 0š~./í÷´m{Ž9Ž Ù ùX <ýõîal<}uayýκE žÀCž¬xâOØ£/?v8XO@Ëì´fèÞ)ñKÕ„õ´RåàªÖ#…\‚H¸ÌÇ!W"ÎëŽþòê:ÁñØ ËVh`îwM~9aL]¿ÚOAç„Nèãß¶&l /{@üfë½ßûóm_ÐïhJ@/ŒÀÝÖÄf–ȹU[µ÷ýÖü|›p³õÞo͇­y³Í}³õ¾Øx¨üˆ­&ûí¶æÇ­ùn›ðç+´ëg…öð+Š­uÿn{ÉÝÖ<¿Ž¥÷dlº m>lÍn‚®¨{±õþœñ[0ônKJº¤ cý¸5ßm°¤ç*2ýú³µx§€ªÅ´gpÕÂ+,žQ‹7CÄÏeMÚ³OÃïA“˜ÐS—ÆÝÿXø6Wµ…_Í´ÉڼߚÔZ…¼›ðfk¾Øˆý<­oË;Ñú½KóÝ6á½8;ô.s¦Þlô’ŸðQª~ÍïKÉK›Âˆ?üÚ )Чµå®Þ“=5åþGL¹IHgSþb…ο>{IÖzVú?t Ê ÊæK,Ú3·(QSêNåBŒh›ÆË'ªü/o±£÷šEj8>Y9Æd×…7¿JÕöµèL›_o͇­y³5Ÿ¶æ_©X¡éÄyä-;AÞÍòBªÌð@Õ´w-Íû¯‡é„7Û„[/†' üÏá빚Æ;&ЗO `97 '>/¢$ŸKžcÙ– çã’´l͉gjϸf³l½…¦Pì,t—të8—øÁBŸ`Æ®ëpŽK6cÍ;w€Ú©±nÖ%åŸ ¯Ìý?iÀÛ«©ÈPWBÖhTîÏZKïo·æÛ]ÓúØ|Õ‰*üã éR¼ðôI¡É ÝYüÍü|hºjÙ;ö8‚¾D-¦oI®êÕoЩ2~¥á@iâÆÎ~F¡ÆêZ¹­ÿÅóÙ¢ÂnñÙ€¶†uµwÁsg=n7ø¼æ/X_Ms÷êî6¨=4ßUVœb ¼»úiáÄËT)ÔCï_òÐÛfªN·ü³ÍgÞNwºsµo·~·õv½Þˆ}`§šëÚˆÝî=lçV— ï—è#źKó»eB¨µ—FWê+¶ˆógìFˆõòܧi@Æac©Û@jž RSjiN“™§­ùzkÞn‰ÏÓ–íüfÃàs·ci¾ßæÞm½ßmÍÛ-àùìçØIâñ'˜ÉâÁc,ä{ɧfciž˜ÑÇ¿š†"]¬ÒÍ}¼š…"4Ìssà¾èÆÙ­i¶=4[ïós)çÛ×0*L~“kÒ¬Ÿ¢}_ï›uó=s¯‡ Ÿ’o_¦¶ž»Ý5/›óö>ïÆòºŸ]Ò¯?6†÷Eówý}v7«/¡~µTÅáºSWþ^jè|ôE›íIY·ÖfaÕ_×B}a¾+ɲz¶Ù†]!|-„摽µø 3›rññ¤–»®µ˜›ÉÓZòîßÓWp·úýÍž“•vÿžw]µÕS,±¬Åßsåþg—•7*ËÉ‚±®¬œŒõ^˜Y§ÅîÝyQ]½±>ù“ã‹V:*èb»3¾"•è…Üñkcgö<ìkÑà†UŠê™Jo·F¶#5f'âãVënܹK~˜á"QpÍOõx¯ãš¿ÅË6•Ó?Ü]ñÞ*”§4jpÞKåZSÅÓ$NDÄõ@rÂä¯:ôWx=‡ãŽ‘ŽõB{ºtô-¥Ei½÷!tÏɵO÷;j_4˜y®˜Aú ”X׆‹;Ü´µå¨‚­’ðHZd?ùëmÂí2!çö’EjÄ2ÍcJÌMRu.?êË’©A<$$…XÜŽÂSE;\òr˜³tßT6ÀG ?¦ÛQ_O…Òf¿£wõx.Ck«aÒœ­Ù™®éžt‹…7îYþ –Y³MU•Ctv²zE¹FR/Ÿ‡Åà“KâUe¬ú¯•õèvÀ¨ %Qíë:R —nÁ€Õ³Å·µ»“Ö«®ûn{Í»®›üG›‚÷ +ÙHʉj|Í@­ —×qB¶ã¿¢ŒO5ààOSåR å"†Ç‡˜¡Úo‹a_mb‚Ÿ¬Á)ç‰Õ«HäÏc12âtEUM¿£4 »Ýï–ysßø€ Þ”éÛU vûB¡š ¢@¶i¶‘×cÕžscc&èoVTÒú{\9õZ×mn[3þ—šú´ =ï‹„¬w‹üë’Æ–]éñuN±)2jóŠº8NUý|ÃòÍýÖîuñM[P(tJ¢ã¼“TåHö®ÉÃ10‘à¯2ÕãÝûMÍî«5ƒäÉõgxÕŸ^i¿Ýv£[hOãõ†“ª´úº¦´<ä[¿o¾Å¿lZ{k£YB¿nt„Cgþ!W¿Ï=;ù¶Íð¶–¿´a§¾‹‘ebt‚ô*Þ§õˆ]vê×mQSÊÍ•Èå…e8ê?mšúv±RVñvæoaèSô*sßn;düuøáŠ?ÒU|Ý{þœ#±ïÉZÊNšLßÒ¿ùïÛÛnºÅ5 ʨ«TÝyg£î:ÆFZØ^Äs<ÑlÍ„Åu[÷]‹]øcA¼X£j».£7cÍ`¹¸·ÝoöJùë)uÞÙñ—>·S‹ß]ÕÒU$oÚzZ[ïÖÖûµõùÚºY[÷këa2úfm½¸šÅAwäSß{Êf\£ÈGî3⫼ƒ‘âsb³Z/¶éÙQÕ†±ŸW9~Ôjý%5Ì׿A~zXåøãxˆ§6j_TÀaf[ƒW®¹¬¾j±\¾\ÍìÍ«I,ñÌc{’~ìž|­R.ê­œs‹gÇ fåä×l&­zÿÉUM˜æ+õ„‚5Ë>*ó2(X3&?[¿<ð´”^¿üO×/Lümª^¾úkÇß+\jtZüR\â×%vìôaë‰êœq¥ü²•ת›QˆKr4<[}ÜǪ]ô3¤í/ùkS’÷E þDÐ3¤¾œ¯J%nlîÈ?7aBÃË|‚ÈFyËZ¾=ñû¥ªlÔÂ…­G8uŸ§’Ù^ýúãâÂS†]=b—~<~»KºÚ[öqB玾ì}"{¡éÜäÛÆ’ç¡ÙasŠ[dùø¾½°÷\tr®gˆºZ ë&H”v¢klê+΀± ?º ´{þõöªSÓX¸R{’GqÅÑœ•U"o{«\#'ÉÈÎøÛ/%"Nþª ²ˆ‘vBƒâ_mñǪyZ®³ÞÔ_rxàkLJ¾¨ã¯¨CéÓ^5ù³êÁ/S×)}³m®Û]•ÏóûÙk~wÍï *|_nU˜z»â]Jküeu­ôh-¯VË `íšQ™]“}d'² ÓPH#íî\òjgf1ïÌx_*ëïgö%§Z)ˈÂk‘–¬Š“³·<çWjûšR_k<¹J^MÚìnñöbØ•ÐzvkÙÐ"Þw¿o¬¯,§Woû…®oÚÕ´ÚÅUWÄ÷7WwSÖýôºpK1Zzqþôž ewúl}ð®ÅÇ®}Ö¹xò·Wk™öþÌö2oËš'uäuËwå½ú#Öy±9Kññî‹_/óS>í^Ivep© 8±À•Äõ0îÕN÷U¹O7hm¯{8€fi?îw‚©¸> stream xœÍ$³’V+[Òè4ÒžýïSUd“EN÷H£èC°°—ËaÉzYÅ¿¬Ä(Wÿä¿ÏoOþîWW»±º:ùˉ¤_Wù¯óÛÕïÏ`„R«8F§ÜêìÓIúR®¤ £—j嬕¶«³Û“‡?nO¸tF¨áòt­}uÔõ #M>CS/ã°yL¢pÃEé}*­½ïUTfØboc”лðµ ’ ˜7:þÙæ#‹JÀàkà=ÜÔæ5‚ð1„àœò£R¿¥9‚ˆÃöSgi@YÅg¾Jœ#£ÿ|öo€-ï9¶¬ƒ2€±³ ÀÏw§r":k˜ZO¥uyš 4øVft6N¶O×z`ùÃÏ8³Bã"¬–î‡óºžá1ï#ö b’mb›P\4@мá8<@¯ €_Ç·9|j7o€ð]l”sy9Zi7Üá×–VVÉ?ÜMó tNL%|PÖ\á±]?…nŽ kÝh”_­¥£µ’S#™©­§Ò𧆽s‹Ô°°\góÂ\”*‘Ãá\Ø6v ïˆaŠ 0[l`O&DØ•…õU6ÝÞSkÔpÅÉRÆûasWyã"uΆ[ìU1@s‹äÒR;¯‘&̆{¶·0ÄKkî+€±Û†É6΢$ Í;'qÞ%`ÀBíÔwi·nø˜§’ïͶÙ1L;‘pzS›¿¥=Ì·aÌ»¦ вÈ:3EË\œð“·éc!£EWnŒ°¦öDv’‚A"0¸FX–³c~ø—Ó  êM’‡õ³* kq8Òg¢ñu¥ñšNZÑÑ8MZK6¼œFÃæT£Zr4 0iTƒÃ_£ cÓ{ÒëðÇ72Ðr†ð¹‚ÁÁ(ã0ÈI!‚’–3ub=;Œ+ú´e6 $kK *ë® õ*íKHŸö(0Oê Ög„iy²l÷7´;JµMÈPZë‡IÉ\L¨³-5¹,{%~Ìß·üÈ©tNTòÖ˜N× ]€ïD£(aRÓÚ’Ä@;Òé»D¯ÌÆÏ濕ۥ4™lQŒ7¨—j±ÛJª-gêi !³L–lµ-z]-³ûþ5Ìt˸d´p–¾CªQ}ËÄ\²æìá®[¦ˆA(Õ.ÿ¢"¿ÝvÕ]LV©;ZCö:áN6î#­ úœmdÉ #7Á¾F 72CÛévœÃ ×ÚðdB57¡>’ROÿ ¦ñ3öX؉êþpX]` Ûñú_OA­‚m–x“dRH‰:~ 8HŠQdnµz`È»ÕÙõÌj-,-TÉëŒ3Ã(½= Kn¤šW1ãôØžNÖä Qß)£9#4¢CÍ:lRSV˜«ýÔm]@ųé "¹™€ÍˆÐ~µÏÀ†á€å$¥ó gú)l¦—7½ ÛsøYs[wÎÆNÊþPV½Ou»½(RD‹FýÓP…ˆ¢™Âw¾aŽÏE$Â/ãš$ ö ’<)PÔÚe…£¥’~_'ƒ˜ÑæãmäÜ 9¯žíöê®71z¥¸Áè(9‘f¬ztF0T$“¿:ûþäì›9Dvô™õùáZR„©sÀ“‡¶=mðž–Ú÷C£ §5$ãBr³¹8-®Ñošvqÿ¶s4#Œ“«5Ø^c@_Έ5!º3ñ¹ºí(~Á"EÓNòÜçÕyºg¨M"¥5ìéwÆ’{|0îßXnä þ-Zk@ØðË)Ä4 bøasu™Æb8ÿÓP\ò¢>Zˆ°^ª'a›%Œúéôt «&µ/qÙFH߉€Žz1Ì»¼diöü¥É`&ìƒy=„ý4ø>As\¢Îq^Xd@TYD¶ŸP…`ŸG•µq3p©=Çon·AÏ¡°õ3©g-FÊ@s4¶e–Ì x×`5P47ØR@;|,s.|Å|ÈgÕM£Uª%Ï1!¨ã›4w²ÕèÕP=ç©UGtÓš=Œ1Ƽÿˆs€/çÐ÷ð¸ßLÁ-Â]* ùÑ&…îuCp@ŠîÄbÚ+_]Þ6!4CŽJò¨˜þ’b§ZO‹¢zÜkæ 9ˆU1hýÏýÈ›x‹‡R™ˆ–'p^Iꚮў7•Ç"ëdƒw‘B‰‰4BøøØC·|à!…ˆÍÆïO±³÷e Uâ½h,†y›òœ,uÃNç]t›§mâdç¥çs÷§AÐÁ7 ¯øqK:’Jé%_9»„%#]–ÕžÜM›éapE¡ Ô7I·;Kj~Mš5´ñûEV=Xî@ÍGZ-ŽR\ Rb‹/ßôÀ >Ì„/ëé³E.üÜ*B­YŸæˆù«óªŽqá}ÅÙvßóë5g{sDz£}ùÿ‹£á‘€ë®ÓìL!3C!gûÎëû糓?Óyãx{‡+°”ðVœ ÁJø·”+pQÉÕêáò"4<ëøë‰X}ÇÆãå„^Ýž£¥çæä?Ê(ˆ–+PA3ÀÐC×!³IÆi®C85Ò€¯jÒeˆ,¨Nö6À~;“¢?І%že>+Úé<]{æ3 û !u>NŠè£IZ¥µiúÒÀÐÒh:=Gg\'I€B„µ¹¹­RX2õ²—€€~Æ‘´3>ÒßGc™c«`\'øK"l¾tâÈ;vq.0ÛoÊ@=]Zš~- h¤G‰ö<ûô0xôì],³Ah†_¡iq9MóSð”{U@²b/:Íçµ÷±6¯ë€mó™4!ó’#•°£"Ù‰u‚(pc®jï]mnjó±6Ÿjó¡6‰Û`Z0\4! áÚ!?Zšyêýh‚±þjbwE³RÀ˜àçæmm^f! ºÈÓEÄ™º ÂØŒäaO³¾?šÏ¬£};Pi'Gð=£½£Å :tar=5Ÿªˆ_ÕÞVÚ'ç(…_Ũ-“x&7ïg›jó¡6o+'mjïEm^׿Íls[—ó'ÄÚg^¨™,ˆw`®r¥ÆCžHÃïÀÿøúh‚¦£|SEaÁJ‚i"úÙÊ̸(šh­*@‰È d )¬ýp[;à7i )ûo³ìƒM‰Žþ‚¦Z‚dbjž£†^ž""¦ð.¡ñÂë9ýÿ¾¢û§£E}[%õÛJ*XŽEä'×TZ"ˆZm"φ >Tˆ·ÔQ¶¡zÀZÑæP1À¼Ãâ6t"`bàœPŸNŸ‘BÑYjA¡˜g‘ÿÝÑ\¢mA¥¿­œÃz!ôŸÄüMH[齩ÍGl’¨Mˆ¢z[4­'gÐq¾ø¦6¿TÄI…<2´ŒL“bZ¹·DÀ ” ÃþhA„ŸI•eÇj›U-)ÝÜ÷±´nʯ(rØI¥ ¾©(&qU2’PdùØp‰ótñ˜—D'13 þßUÓïªU8¯¦`3ë²Þæ‰Ò=íS³£ÿ´D¤ÿ´ËyþIBh_ÁÒ€R5o,€ÒZ4H4(T½,T},}•úåWô©ê*û"-Êiš:¿¯#¯éÓýÿqQGZÔuœº§Ü­Ÿ¡îãé¬ß?TEýC]D]^úü"’®ÿ# ó˜\“æËÍÛÚ¼¬Í‹úW_ÕîmüT›-44tÁ‘?#·†ÐjeÕCIÚó9Œ*ÏÇ´£ôÙñŸÀ{ÎW¸|ô”p#€K|_¬§€eÏ~>‘AŒ¡Ïÿÿ áu|7Û<š„¹9iTMþðÔ[M»;^³à à÷m5‹Žt Á]x ¿Îð¯·ur„¨àø],0¶xŸ¢ìt¬!àÏžpHøÖ ½z&¾Ž&G²ÂôEa~[ú$oå__O§|oLE¯GãrÄÿ·“ƒ©HC9RöO… ¥uYZGïÂBû /ó ‰Áq¶Âï‘øà fq ]Tœ|ŠËFÎ ¹&ôÏèÒÐï³#UUe¤¬CU &Q1Ö1Öò±Ç’Å€ÿí^#.1—ŽHk9Z]~¬¸”•ÏÞ7VÜYð*Míµ—íÏÕ^W{uíõµWÌöú£1„¢"Þšs <Ç=Î=Rãe^°Šqî„,õbmíG¡™E–ª½a±¬7XØòh^d=G§åëéç0äš±/Æ…¬½qC¬7!ô Ã+"ƒƒ¬'È÷=ë "—YÏ<‡X_{çgY­,YC}Ñ4Á;ü† hÆ‹kaÀ2¾áq'q£ð£—zíHó Ò6Ïa{H“Ï!Mñ±G"MEب{³Û¨Ä *ºÑ[³Ç môpÌ*„"âîå!JLÅ´{Ôuq îгt÷”òªW¸qíÍtvÕËdã ÷ Bˆ[a½ܪt¨"fØ£à‚ä® ^¨zø›0ÀéѱKÔÜw¨‡°¤Ã Öžvƒ% ¾ \Ùª!‹ñ÷ÓÕ¿K÷ù"F‹ùq;þJM1JÚQw)wIÈhèê¼NK¹ÎQü€÷qøé¿ÒEzÀÌÀ»S,·Q*ÃVB¸TàArE%ðCÊÂC^„ì1®Ì_¸”=…ó"î¯É`¶;¥ Ò¥ºjÞæºÁ;zí•O÷üFÞ0æˆç æü)ooë·k†¬ èÍ„Üò’mã"­ŒÚðLFÑ‚Gü®®ñ]0%{a¢+p@ÓØfå—i°ô9ï5ª,ÒÍ8?Ï xêTèwÎFß§$u-PžKvt…ð¡Îý Ìç›*ÐÛŒ2%)Á·¦cÃÀœ#¯d°_NõaÕ¶ùýŠfw>6¤ë3¹k¥‰ 9Ù4ª´mž*–óFrMNÍÁHµTo »Ò‰œ†‚éÊKü¡ ƒ.j ò³‰›BS:KØù•%qnRÎ åÑÍç‘—e„®,ƒº1¿éû¦Š©MКÊ.š4Á6û,©SR^GÖÆbÆPt+¥‘ôd}A+ý<<¨S4“¥ÓétnøŽ%t²-ÏgŽ1ülRÏa–²ÌæRzšRœ÷ì^_j¶^*Nê*3#•oûwUjajót6áü4ïˉ槚S÷ÄfgéS{9s©³K¹or뵯p/v>‹ìJñ2iÔž˜5‡Š4ßÇšò¶­é‰˜ ª´É)Ä(…Û¦¡äñ]’ÓMšÀá¥P— ˆÝBÏËšŠŒÖï=¤Å{!›¤âRÖµ¥ì5P³ŠW¦5Röûb²d)4ñž+²âð_©ÀÑÅ´c@Z“¡¶){X.ÏN_Íî×Î&¢–Ï_’þ‚¬;[H—ïä²»÷äËÖÞ×ÄÇ\…EëSi³ñSÔz®ð Ièd™§Œ”“¾Iœe¹¤5Ñþ%™àt£]cfDßA“v¥€wÛZØŠ„¦>k".HP C4CVYå¨Àœ2ºÏ9¡\ÞviAhø(ñkRØy¬‰<{Îv_«Ø>nÀú=:šàì„ågspGø°ØöEuÿ¸ /ÕÒ:ÙÉ÷gØàájw¦ÓÝKÏB$:6¯¬UÆ=¯| 3ÒiħÔvB:ƒ©8üh­K å‹´nsò„ßá‹XY- éÞ”`Ç…lLɱ­®©@.*>&YéT/HGWôÎM-ïjŠÓHÿÎP4ÂÍYɽ¹™±c3ÞR¬)$wˆY”ÆÆÝö0GSøH…‘TŽ<© þcÆ«´‚xð!<þ4KÚW’ϩߦÌ{=½VAF¸ÜK ò0štNë&nk†ÃÁµb|»K?›¶’œ3Ѧ}]Œé?:¡£õQ`æ(Ô€ÚÁ¢ÔÒ‹o˜WÂÁ%DÒf=ná±-~'I‰ó‡ûøPüY¾.úTXÄ;Æ ßÌ8/jj:ßvªÕÕmÉ,)çêBKPàŸª8LÝX¥~KP¤7øZg ‹@ÃØ…ƒ{Ï¡9¢üà7?3zÞ Ýɯ¦Kàö…Á½÷†À‡}ZÁÎp9Wó6ZCÛkŽÒžñDºsÎ8´¯Â%¸Ât‡IØ»ÿìÃdöŸ=Ïã6ϪD_´‰ù÷öéŸÙiÙ¦¹{ß=솻0XTq·õOÏ%Ô·Œaºï‹o„ÐÜ„W…wäøÈHÁ«ÐnßöBd˜òüñVëæ¦—À†é¹:tnðÙ{{‘9jÉñè½ãi¶ö€¸±eÈúÖæXÌǺlz§° Æ ›,Tgmˆ±ÅYUÛÝ,"Pd0Z°.û· VÍšE¾fW«“à’IgT l©qúCžÃ/Z2U¾IM¬O\x1‘{#›²¬_+—|/ìˆ?c{àÈWêôHwŽËŒâäkâÔ6´WbSŒ¤Iç~äf—?Úú~Cdwœ-Jõh¹oͧea„ÿV˜6"ªÉäØr?ú§“ÿhilendstream endobj 181 0 obj << /Filter /FlateDecode /Length 6770 >> stream xœÍ]IsÉu¾#ü#psÃÃ.徨5am3^DÁ'Ën  è†bfè_ï·de¾Ì®jb8#[15 Y™ùöï-Ýúó¹šô¹ÂÿÊÿ^=œýâÎç·OgqÊñüû3uþë3í´™ài!?œ¹ò,ÿóþì°æöìÏgš6:/ÿsõpþËKØÌÁÂ4åÜùå»3>EŸkaÃp¼Ÿ²3ç—gÿ±ùíÅVMV©Ýæ?«œm²aóx¡¦ M°ysQ—ÜÀG¥ŒR.d^¯•ŠÎonöVà yóŸÂ mòf'>„W“R^ûÍ>9Ǹ9ÀS“CLy³¿Ø:§ì'^Šïðt;øþÀ‹­Í.x…2ÆzÜŸ:•7OðTçCìo}…ÿ€ó‚±Ãé ÞSÆÇÍ5<ö9Àž°ËV[k§d6oðí“Ëý†÷šјB²34¬|‡\òZ»v'—ð©…Ý6oá“™lÚÜ0!A9Z‰/éä7â)SáPzO³×fóÌ™œø€²ø®Q!ÞÛ×Åÿyù»³º<ûý™™r]¬zèUœR&UÔøQŸ 6®k¢?¥‰®•X¿éÔõT]%¢ÈëhmÑ7—spš–h•2p’î®´2.éÍ×BŸéFkàþCÛ¨ÔFћօ´™ÚÞ±=µ°ÒDg§¼Ñ‹kî›rò6"·´š²Ïç—ßž]þÝÏF*›K)cñð´ñ71&‚üªµN(ߘvåîömz –¡†Í;Â*±0l·=ä2F xÂ%¾VÒ–ìŵ®ÄîåVÐÅÁÏȦ­.&£#Áº¨C,ج¬Ç߉ÏOL~p.„r °DœÈ¡;è> ‹t|š@œäìÚ1rgº &âéV§ hDÐ’’1ªãÀ™%>ü{±¢³^®–Ù£œBÖq†FôTrD>﯊É@l‚jkŒž€µ c—× QOÌT†Îì ïRdÏ\#Øt¬ uIWœÀߌê FP²>Ïïn«¨i X£ h¼æäUf(Ì„]ìp—z¯U ÑfUÀ /Ažmg¦mÁZæÝ46d¤S­ùœô^œtSþžsjÉw†!?ëd¼FØk¼v™1ŸHž£`JÞ¦y-¶énˆñ3+€ý¦“BxÌbtOR•EêVgUR-¯™&Ì;î:¨{…ÝmcìÆBä4.ŒJŸ0O1ƒÒãÁ%ù:ßÝóM¶Ý’ú8€ À†°]L›¯šõ}Å œö=ùR¤´Êh¼Û|ß^,;ƒ¶¯ø-å_JÙ„1’lÒ‚W‡”£Ùd;ð£`Ô°au&·Íä»5JqDù°ž€/F ›=Þ9èØEÉ¿}oeû¹3pjŠ.ô;ï:©!B€(•¤:ÿDz8 вþÔð³Ðc äm¶ß•÷ˆ4åFRªb'UH !¦sV”vðŠ»µW‹ÁÈßÙs%kÞϕ܊ç°»IOºç§œ÷«WŒ»óL¶\°çïÐDŒŠñÈo„„¹üÊxŸVƒ02)hŸÚ]co;ÏG%Ðé¢[wJr{é æûÂ-ß"i vó‰&mÙ:¥ïDŒþDåpáFb€C‹Z’–*1Óqêf®æDŒßõJ7 e} ˜ o Žüû楯ëîªx-ŠNÏ^ë=óßp×åàñÄëUêÁË3ççxà/Þ8#¬Ï—t óùW6Ψñ0^¥~®Ús¤ÆÕ½×%ƒÜ€Ó`ý1ÎAÈl$A¾cľY&_°:û÷_Þ­xÓZ›Â)<²?–ÿá#§\Z÷Sj+ê»C}ÏèÇ£6R§~À1g— „ÊðÙö™Hw3‰yîú›ñ±ºS©³£I…ìá^Ç@œàR ØqIÝ]Æ‹]ŸÃQHîÌbÙ^¤ÂÞþl0I=ÙàL;ð¥Úíšør˜„NþÿÆš2)î¯VƇӬá\ëŠ[‰k#Ígunè¡Å¶u½ß@-íXX0>¿hwüˆþºåKrñZ”•Žï#Ÿ3¦îëή]Y)ŸlgÔ/­²g2@EÇÄïµ?•q‰Ñý›kÅ’[Á]t À.e|GÑ®w”x/ÉÑ?S.mâ0€9ôÞ=ýì±ìäu-o¼-ÂJþ¯Ùó° òày$™Ïù¾ynñÞiÏãüd°Â_«çIæÜ+‡¼daÇ&IP·3åg¢-ÿö¢óçà ¬J e¥¹ŽBK´ÊEŸ¨˜ V“é¿Â†©Á]OY”ƒT°5!| nP¢sò$7Üý؉Tãìãoy%lÕÑõš-Õe¤¹<•ý(Ѭ‡¿¥*Š‚¸úI É­&*OÜŠí$óûò1zù€ûÇ‘=3óÇòkÒ1Å@°¤™«§„¨çqïäf‡£¢Žte¥jë¨jK‚L UVû9g‹KŒÎT|Æzkõ‰ÊÍ]Ï“*ü±~€]9-@äjáWjåe¥[OecÅKñk@£5MN¦‹m„êfNTTë]dm†„ˆ^½l>ä}Ϻ¹N'm×'ÕÙn‰í&BðK³©õ¶XkÛC¨»8IAaÅœ.ûÑi3ï“,ÁHƒ¾®|­º’‡b&HÉ®'d7åoøcŽ}‡ÒÑ;-¤)wDI“É Ïú„Ñ9º½7>ÏsÜ·Ç*Ò*g´,§6Z³µ ¡åà;åBßå-5àeuo_öH”á `ù‘³(ò B,±¬•û5ivÎVÙÍo.j;÷xkŒ¬ÔžKé=`D ¨¬Š´ñ5Õ·Òâ|Ñx\ºm¦as†ÉY}^Ÿ()²ÜQÏ`cÎó”ƒ ¥ls¨3u»'Ì-à ¡ÒédJæè@g™tŠe×&@xò=€Å'-·R0ÎRx–à®ì¶­là™Š+9<é•ʬÓYÍp Ô/‘?©{ßPè) ÆkM œ€¸5Ë¿cÈáZ.¤k¯¨`RLØnû9"PìÂݰ•úÇ `²qLmŠºXÎ9Ë²ß˜Š••ýn÷¤7ƒÍ޹<õÝ«õÖ–+tØos‘wƒp¾°NßHÜñÇLƒ§uÁ‡¹Š ø")P‰ ÞI\OP{Ë»)ˆE”V%e!µ .3¬„Ì Óªúø¸œâ[éª06 ƒ×p&„YâÄæ6±ä—Ç‚{‹‚³8Mõ©É››å„­¢½×|ÐsÇ“à)Òhpž«ø?ÖîA N •|/%Š·Iÿ4=¸"Ys¤¹¾^iæ#®Ä…ì9}(Þ¥"”@HPj"o8%öbïN*+LàP"%$,^ì¹zE¾X³GEÅ£¾HQ‘Îó ¿§áãŠYV•]‘!š%ïPnjZ &nñNjnF{é.}/éõL~©ªªÿÈ.o½à"=025œŠ_IœH&p׿j:ÂrжätÌÜݽ0žûưO #šáª „•d&nÆ›0£Ò!·ÈÒÁ¾‚ùjŽdÇB :kˆ ß¡r4Ñ3FQböŒÁêR K ØÀ÷îh  [A4r@éfÒ<üi°aƒa¶a[#Þ&œø8 wø=ËNùØZÙˆ `à  4\† °˜z6àN†ø×"ä ¯@–ÈH±n9åe̪„†2Œ£Æ¥‚÷mµ4HÊ\ì¬`ps[ƒåÑ膠%±ÖÖ:ðšçwá£Òa vq ¢*ìÇò^©À·"Ó¼…|O„ô3ÏÍÏDrÃ{8޼»¾í1¯F툻‚¨êþhvDñX‘„¸ZcþŠŠ÷¨ó$7L„ͺãÉN¤be\Òñ§ÚÎ 3¥EñáÞF/0Œ €fxê)n  ]þÐŒ¸õ+®ßd°U‡—:ª¨Þ] n½$!-}uµœÀºlëÌÌCâšN]¡Xº‡v“‘!Xmä´ÂR*Uâc-})1ug;øé>õdïåq|NDd¦Q-<Û§#!e·wõ·>–â{Ç‘´iÅ©c;˜Îb~Üx.ÜÿGÞ"ñ=Tª,ˬCÑ;'“&áªvÕD> Ø»Pdº©Ý+ôš/ì éfWZ0`#d©L¿òù¥–Q¢´@±r$à2â™rˆ°!…â’>BG™³¶~güNŽÁ/ç@£qxþíE­V,G柊U“›¼9ǰ*DPÕü2~ÇInÇíq«)‘ú׿  CðCø9Î;Ut'J ³2Þ2±<²¥žkŽºtg HJfnðò}X¾bçЇ|r¡\ƒ'¨Ü ×G:Aé /Ål_:ÁRgÜljù5‰vGÀZÜÑÇqéån.j=OÂU¦¤–d úŒßòRf‚K˜zÚ¹´]ÀêeéuìÜç•ð™õMšr™ðÞZ–)=Ã÷'Þ$f½¢2\¥„ÿâZ|^({ô¡µOàà̳VXcs"%û?pÒbÒ %(l“$ß7M>ÂoÆ®ù­z›’,!ç»b‚¬IÕâßzA‡‚xnðUqhÒxû=ñY‡$mïšGÝÙ›ÌUÊc4ÚÖõKêH«ß :Á©õ‘Ú¢b/¢¶ºðOY£~ëÍ/…¹|¢Õ:Gw„vrŠ5bCr+#ú¸OXHíŽ(ž"ÆÞSàR ù_æÌ®%|¨õÆ'ÞË X.ÁÏ¿ÌwÝ9×…ò¨v_Ïoõ÷{Þ/ñwÖGª!DÙ%?‚¬Ând»|g@R©s­7\Ç<Ð×ÊáíîNÔ÷Cb4/îUOÆq7:_×Àæ\P“ÉÿÓ\Iw> J–d&[¾l"Ó „1²%r@ðBߨq2­×‹¹.“†’²>á´LqZ5,8²ì³ºŠ8iëkqŒ#:üºíªIÔ:iиP‹4ßÔ:Ë®~º_(ÜìŠ4_/”u—Š5¨¦ûº ›„ÈÚöÍÈ¥ióЬDvbWäª3€¾÷6#š.%ìÌ”wq/l¦µ†!–=²éD,ú¸Í›ˆñšn‡¿†“{_zÝ|©(GõMXפ_²p'²Á³Ýð)6›‹Þ&íì“¿+ჰdß6”èAu‰• ×ãC ÞeÓ¹à’Üb#p,ASA·l©ÎöC©(óå%¦êa_Õƒ—õq9^¯´Ô;ø ¢çj2C¹ÿ‰ÀÕ‡Å2˜,0ª¡|þjÐà"ø¶Å®°:q>†Cg kº":tT.OÞµJwYn‚+p”ß;eU$AË Ì§Z³¦GÓX“J~²Ö½¸*±T+9ž,V,®}Ù+)•ŸºÔ v ®Š|ˆ0Ò~¼¢i_òùljV¤ÂóÉx8–^_Ô‘ÆÅ~l±.ä¾ËYšÈò¤Î w;&¡³çÅ/‡dŒ{ ?oY°’>‰îG›®ÅàY^¸)k°3^„V¿Œ:¸Å¡qž€ÁâûþŸmœC¨;¿âŸkÀÒ!Q•ºîûv}n¦ÆŸÐ–.rì&MQèZèê]ÓÕÑ+%gÏ~Ô@&ìiù¢´ŽLü.!a't¤n¥N¾ë˜úvð‘3Е>;ñ½dzÈÜt´€-‹ß“¦µº¯" ÿ'.:‚yx­] ^®oÊvê%Yéà –öJ(Ú5ý[¢›~…ɲ²=µã2þ$ŒòõËU·Ï²´uK•*Nô^ îv~qÐÅ9\¥N£ÄlÜ-[á¯?ÕàµìlÅ[]ÿ¶Z¸¬q•݈ äxB -ÿH‘¸þ˜Nµ$œb ˆa5äÔL€ Ç}-”‘þ<%óæ t‰ËÆ<Ï žÜÇüêIû ­üH-Äúž=òúHâf¾y ¹Ò`¿°XQRº2GUP"ž/¤ÂÓ|ZO]ðïöZ·-8Ÿã¸~n9qàbl=OQ.5ß{_±uØúJI2Ž Ä·?5¨y;ß<Ïైi-¥¨öÑ@à´EÆt³U…‡Ç¹xó|·X¾¾]îéCTe³bŽk«»Ðߊ#íBÃHc¹6&!àA`ð®d\ i_5'Àzƒ¦¾Î\gÔ\ɶ ÇÌôÊôÎ:@‡×ð ë @*Ûñ¯½àŒ¹ÖG [ù#/öiZ<¦bex·åλ«^«æ[¼@sQQ"Q% I¤Ÿ¸Ú6Ì)Kz½5¨_cÊk)21ËÙ¯£iÎ’âŠqŠ2éÊ{S-ùÙ.5TDIÓ Ÿqb}}ЕþþRPôûÇ>Ñ`Å òy}êW îaP,X¡è\Vü¶Uÿi±ÁQ£Ëàal¡°÷í–Ÿæ[võ§„G|lmµ½]ëw+•“®ž5_óõZaùÇC€\Ǽiñ]>p@ƒ>{ɬ6•ýwˆUP´ï¶Ý¨ !Þ«WË[©Ü@¦_ip;o·âOH/¡/k¶D‹ØÃ Õ ÚÆ«]rèv§:©âr"óVÔ¶w·’=Xµá%Pô×|ðBÒnd¨åæš§|™ŽŒ)­éÕŽER:®Ì/ >Ûy\™¥ç—’èÙÂH_U29=n¢9JI~ÓôDêÌС7ƒæO¬%kRLün“Z}C¦ê«`y«WÁ˜¦´AV²=À…¾¶À?ø>œÇ‘‰4Ïž¨]ÌØ&ƒ8³0b*1ôƹ! ÊO./øÜ•⯼ûÄ_ÚÂßT?š>/ bq¬^VU^]PÏUô ã«è¶­÷u‘p”czK¸Æ%jjBÒ vÅEÞ9™nçe> {ü‰·Ð¡u½úu\ýS°µHQÏöÔ®«fØŒ¡Ðí:p°;îð¶c—MÇ9•37µíº*dËŸ˜vȔʷ³5õXº/ÍXK¿ °R°]ö31'µ¤Kc±VQ±öDØÇœì_ÔFƵXo9…ðÀt¢È×a‹Äš±ñ„Ç þÃ"[º‹.W½_Íd­×gRºàÚÏÆw> stream xœµV Pgîq`ºDWÓYŒ:k6 ^ˆšxĨxOM`8”`.e„‘k†çÈ}̉BƒŠœ‚ ñÊ¡†5‰V¢qÕMÌ&AC“¸y=û[©m Ù¸ÙXÙÚÚ­©žê¿ë½ÿýï}ßûþ'¡\†Q‰D°r­ßÌ7?aœD?L˜ ¢pv†ºN Fú/žÜWyÚ<¤àárxüˆÉ£±õw¨‰ŠQ”T"Q'OÓÄDEk½Ÿ ÷ñö›7oÎTï™3fÌó~^¥ÔÄ„+ÔÞ+Úh¥J¡±ÞëâÂc”Ú4ï§Dkµñó}}SRR¦+T‰Óã4Q }¦z§Äh£½×*•šde„÷Ò8µÖ;X¡Rzžsúà@œ*>I«Ôx¯Œ‹PjÔE=ö¼:. ^£]ž¢ PF®ŽŠ^«š?eEýZE­¦§ÖPë¨ʇÚ@ùSÔ4êj µ”ZFùQË©©YT µ’ ¦ÆQ”'5N,åB%#$ñ’¿ ‹Ö+)mw‰w¹çåz\6Ff’Ý¡×Я1v7·/†/®s_à®qïq¿$<àq+/¼`•¿w±yåÆ"èÀhÈÝI”÷ïxéÂâVä3júœÉ‡ NÀcÇ$žVìÑØÄu˜ +ŽáX/,”!~…`ÃXÕÐÈÕ´ÃtM4©‡Ëàr „4е3Ä"ØYdÈÇ®$]æ)´/Œ·JêÅð^©°óXèƒzíAu릢˜ ʹY)Lþ·22>ÓUM¿Sœý GjéÐLƒ0Cðpú§“­È€.ƒé{ïž=¾rC°œd<Ôv#h ¿ñtz»0Ó*i¸‚ W¤ÂÜÆ"ëó-aˆÇÔ‰d4yäë)(Ãáý_âh9ÙFBÙH­VwÇwå¿ Ðç»êvV7A+t¤ÕE4n† ˆ„hX™°)îÕÍ©J`œ„ÃÊ (SŸŸ›Íí&³³d20KȺìÂ\ÝyùÞç3Éd+gÊC90•°×ʉU%/ñèk¦Ù%ßõbõ)Édçé}I•דx$·L°wl}3Øä<g í·‹ë†c#ÄCœè4äñ”æ•mÇÑäï^™{³Ë  ÷V-^_“–Â…†[{÷” ¶˜wXößxË*鼄a½WìRáQ´²"§Ú¶´F ­Ü̼ @µE稭©©m‚tÎÑqÂÜ̱7•~\8M6Í…Ì‚Ï5çþÔÕvÂ"/ØÔuÛ•æÎ&­£×&fé”pªJØÍúøoÛúJØ‘è… Ë˜äbSè­‚¯cÚDB¢Yì‰gìá©vÿŽ.(®ï)Øçˆ<ªüב®ß¤QÄp¦Ì`*«®=ÒÉwÓp/ƒ¬_®W$Fq)±á±!¢›vÔí²AÔˆi#ðN×ARI…‹XÂ&ÉôOî"cH0³e[ŒûqÂaúˆ©ü–¼—©³DÕPÁ̇HQ0—éíÈß8m—4]ÁЛRüA±‘–X³£Öa©ä/.91Ÿ¸MŸ4 \_ø +z5 GII6vç2 \Ò !ª`‚çŸÂ©8ÿ£öž–3éîÁòˆ;›/Hñ”sûS&ÐÉüÖ¦``ó¤y„Œ¹ãƒÃ®töX*¹¥4N,uåéeYûº9áotàý÷YQê º¤Äè0õF`UŠ/].o³â¬m=pšBKw–ïÙ”Æ ¥oÁ€A Î:/Æ`:k7ånÈm2‚Èf=NF¯o&£Ý»²åädss\œåZ0Š'êñyÎBï±°Åè÷‰¹¾‡"2qO ã‰'E rã±H¼c$>uhñ€:¸ò„F7Ù§ÇŽµWsÊåyùšÝ f´Õ;µÕÕµÍQü«K„üQNÜžSH®ÿ–9§‹ ÒQ+Šˆ'\Ã3}RTã%Ÿ“¡Û÷×îöOþ„Œãȧj«ì?#ZXÜO2íë”ß–á3@\·*€ÈÈ*QØ0äÌÇ64Ù$çÞÅ€w[»ÅÚà‹ìñØ6(æÓ‹ï\­ËjÙ~km;…"ÅǨÏËÕC&£+ͨ.6Úͺúè—#¶§ëä*Gt…xMù-_¶pmSdén.#=M °¦ISœ»y׿(x™Yz{-ŽD÷¯N}°?ûÍUò 6ÂÓ ÙfÑ—î¶€ jŠjJ+™¯ôì,¸ë0C{MgáJmÀ|OhÓ lG<—ªVé“©#ÈNñï~½ØÔÚr€³W–À{ÀÜDW˜½zÑ&_î§¹`€ ž†ð@],“ßÈlbÛÿt6pF$ÛDdÏZñ̲}_Ú¤Â|ìc¿r\½W™~âz“<.''[Ç ¶<Üü'[†¿ºš3ëâ+!–ÂHèÜZ•Þ¡= ̇·lEP’©‡}>—»J¿6ƒþxÖ©ü}9G û³{òª3ËêÖW1ÓÊYâ‚U2p@¹­ dOX¹Ž™2{Ó ò(牵b%™6Ó?ÐRôî³’q IÉñªÚÔÚFó»œÈI°Øëo—䈽¾ÿg²Ÿ_oÀáG¸¼ÂVNp¡7uº¶ í¸ø2jûÙ¿[$vô@ýx:Ï>8ó `ëTüÛ¹ Xµ3Bw5ÄôÿJˆ¹÷£¾_r«_ŠA¶NkÓ¨S´ÕþTGÝV/'·\þ훧ӴІmÍØ.æýC³T˜„;Yäe•f0[vˆWáV`NK…érž֥AZj Tq(®d:H3[ ¦Jî‰×pÍiIVH±×°§IEí™lª0®´Ø&#Š2šÞë.î2Çêáf-ñðè­öAQÿW'nßendstream endobj 183 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 654 >> stream xœ]HSqÅÿ×»ôfk–1©l»×¢Ðð«0İ(—Q”f„بë¼nÓm×î®®©mócî¯ åºsfÌU´J3Úú°‡ ̈ôñÐ[=ùÿkׇl8œóö;²4€aXº¦¦þtùÿT"æbâ®4Q…C×*¶zfƒ dUSÕþ𸤀rÊeQño6jÛŠš³Ðå-Ç0‹Õ­aÛíœQoà©|]u ¢¢¼:XZZA73œQG[¨š70fš_/&ê<«32¼Ê¯4ð|ûá’›ÍVL›­Å,§?ZPHÙŒ¼ªc¬ ×É4S'Y OÕÒf†JQ§\ÚÛ;x†£jØf†³pºI@Ѐ©U@‰yD¯B\qED2‚!eŸ‰JC?îíiu½>57×ÐCBRHÛ¤ØI8($`¯»8Ôû×rÜzÈC玼¥úÏ( e£=hïÊÙÅÊ t«W k„’6Ç–¡#cd4±ðâ%$â“ÚF-+ɸKdKuÃÕ6H¤ PôÛãõsr¾"×O\´‹›•Ë »ˆîñ®éàƒñÄRu¸^¢$Õºv-A8:”ü-Œ:n¹û½^O¯º¶ªìZ$´3ßãá?Ïß’³¯Só0çûƒ&Ba ‰š1dºJ—®ŒeÄ2“›Ô™²ò|cdT.ààöendstream endobj 184 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 1835 >> stream xœµUkP×ÝEHl0±Ïv‚»r&v;Åv7±›Ô)8žØ-ÄãR—‚$H½½0Bt%@ /)ÆŽ ~‰ClÅIvÝdÒqÝz&nÓv&?Ò+÷:® ÓÄæggÜÝ™{ï÷s¾sÇ’“0ljܼÃÇïÙxß߈Ç7%Å7sÒÜO»„»[—óÊæü{þ÷Ö‚4HKŽl"Œ™°72ë`u:ÆÁq™Ú’+•1rqµHÁß^ñ Ͼ}/<Ën÷î}üŸÔ åâ A=?O  ë ö£–_(­  ûK"…B¶×.µZ-¨kÌ–Ê«ü̳|µX!â6 å*a%ÿ´^ÁÏÔ ù«f¯®¹Ò:™R!”óó¤•By=†aéõR™\¡”W «EâýÙ»0ìuì(V€bEX1–ƒåb¯b‡°×°ÃØl#¶KÇ2X°dl û?ÿ#©Šó'œœžâfqƒ¼çy ¼¦lL)Œ®š}qn ?¿ÌäEÒªmÀJ¨û Hgÿåjà“á;ã×Cg'ççìi©) T€63P%câÙ{gà†¾û°XfÕ3JRU­„Ùæòø=|àl[Pi¶M@N4hû£=sK£9Ì1PPDÞ¬ —b§m³®étÑÝg¼³@t­R3h³êVÉ\ŠÁýAVÞàÀ¿Çyä½àRøË¼(ÜÐáNО5 ó3õ­²–6ª íàfÃÔ§¼×зø­²`ÒM¸6’¿Ñzš1Qª’2A t*WÄœ½«õþÄ¿XŒ§¾ÏWá/I‹º¥D˜ ¼é¹ûiwÐ3Úö޹`œøÃÏœ¦Z»Äns(Ã6ªËz ¶6Ÿ®oi4)Í“Æ(§ˆ­Ÿ(ÏOõ¥Â'/·Áä»C‹¾‰Kð`™è • £U·:ÍN+ÕͰ€",ZÕEy ~Ñ:=:è~â½€Ó{>ðÑýÝ ðýZ…EÅâþfô2Ù¹ÓŹdGo‚"¨õ5©Ú%™ªéÐa[ÐDïœ/øhñ¯=ºÓ8Tþ˜Couù¢þ+ ‹HÐ$µëL”U£+TBmru9Ù‡F‡N|÷$:€¬Iá¦%¨`}z%~tt:]ÀE$4£¾¥Ì"ïEtÛ$j`ÈÚ+¸ÉÚ‚ Ÿ‚ôŸÿæeq•¾±†ò ¿’ź÷¦!÷.L¾qvTxñžCI‡­”€;ù_eöót²Õ23ÀZËá í1ròÓß^ZÄÄPSÃÁ'{æ„&”° 7/sâ# ÏèôŒ•’œ+w7²Â§ .â#êékGoEÏø†'è¾Ýf·Y’—´ 49íŽv–† 6(—)”µ?ý#˜Û®þmÁG¡m&ËT³ó¿Ãši®¯°bË^ÄÍ}DŽøÓ,ö ß-Ç,e>+Ùõ0>\C#.jn¿ ó!“.ecI)Zg¬¡ÍZ‹hˆ“QÑÅ/ÎÃïW‚Û ±Pº2 ÜÆ¶.Ÿ8{Æèî‘‹ï·J&óŠÊåú¦ÿøáÎ]–Ã,5Eñ%rTÓ«”)å _ …ûÇ(Tñ ˆ´l­@Mœ˜½ýå"L_ýC­TÓÑ I:wÐíŸêb 8ê {ÃÃמè;Çâ  §¦Š¶CÕ$‚l¤ÓÓÛI <¢¿çtS‹µÅnKð`< 3p(ë9ñÆ'ÇåƒuU"qUý <:=¦ «ä03&”TJOUG˜ðÙèÔ$µrtåüËÍÿ¹áÅÐ}E¿ÿŒs»ŸFº=.à%ú~ÓÚl¶P\_ç·l6МÅô6ûº=Ýnjm³7žë‚9^Ò¸Rb©Ëk¨ÔdFšöX¬+- Ãþ {†%Žendstream endobj 185 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 1847 >> stream xœ­TkPTç>ǽœ#®ë-‡Z‘s¶L x1Z  QD×ûq…UÙEXäj!qw_Ø ŠŠ£rQ¹/ %†Ô6iÒi­%qÚ´“ ‰[ÇÉ{àãGÏ®IšLó£?:ßÌ™sÎ|ó<ïû¼ÏûД| EÓ´2rcĶ®·Å¢-Ο"zË€lÈ߬ð¦fD¬ñŽ«WƒJ*yç|6w6ž›…Ù30y&%£icÖ[‘¦Œ¼LCjšY㟠YúŠfIpp˜æµt}¦!%٨٘lNÓ§'›¥CšSŠAoÎÓø¯J3›3Våää&§gš2SðŠ&Ç`NÓlÑgé3è÷i¢MF³&.9]¯q×è~FšÒ3²ÍúLÍFÓ>}¦‘¢¨Ù¯Mk3³ÌÙÉ)ûôû ‡ÒÃ)jµ‰Š§6S~T•H%Q[©j-EESë¨Xj#Gi¨9’”œ:JÑKé6zbÊö)Ïd!²r9+Ï’?TD)šÏ•Ê÷˜õ¢E=Nœbl--VއrÅ…p²¡Š“šÉ'sK m¶,Ëa‹ÌÀfi•·ìÍpî@ŒZU>N&‚ñTeÍÜ[È*°KùZe»ý+p@|÷Ü÷BÄN'פL©_%;hTKLjj™ø s¨o\B¦'½š]ÄÛþ¥$‘% -ónìÈPŒ–¹mo• ;áÜvƒÆàneú~ÛÚ¿š'ç~ì £ÅÒ~qªƒ¾^Ø„^2ñ>9œ½eäu²a)‘“YdÚ?~†0îӯу'—I4G¼áÙßÂ?ѽÁoå2ð%Þ‚T5ÙêD/‡¨è§Q.UÞ ááYÀÅà:¥S?p¬X\ñüK‰jÖ’gdù–„ƒ;…~†Äº:¹àŒå¼Š!—<ößåÆˆ-ÜùºÁî?;:´ž(ɼµI{vÖÔ«Á)Ž:i Bq9Ê0h\ÍMŽJ+î`Ð ý õ˜Nã\’&Ln×*ñíÉQNÅe VÙùò" [È)A-Ú%ñmø W,Êp® sñ£×Pñȶ‚0±)͇ÛÛ››:ï$\ß²7J_ÈÛÊ_3dõgr×^ #ðŽdˆnÁÃ$ÁsJâœvºûÚÈÄ qwÎd—X ßÀ'ŸßùÀH(y{—s….SOéïŠKþT‰lÔRë!?ã;ý|ÙykE6°&(1 ¾L.ÕŸª€³u|ãùÁô!¨ƒŸ^Ã0@ÿÞœ«æ:A×­=©?|.ñô²ï>†:”W&™*øŠ‚8lSyÕ%©ïŒÒ~|îÄðZ]ÎS ˰@œÏa°“cB‚Òæ¿máB+›ü)©g|?ÉøÛŸ‡oò·v0ÑúófÛP/Y ÔâÈ÷Œ«7qß*²… ߺmåJKÃ-¿dHü´Êcˆü‹¼'-ÀG·ù(c«N&¾:œ”$û\šHt'ú:èV 7Ë…kÃî³ÈIèâþºY-]Wš;®ç\°•ó'+š+;ý¸U)²ÈF´€¨ÙG¤ŸõÜ©=˧ŸÖ?懔ÏAccÝÕ Q;9?¢‚ãÚ]×~ýÑXzÚyµØ-퇼Ÿî–L»Áµ'á.@Q®òJySÌú·K}zFìRu󪆭Çm6«Å"”/„£lʵŒ¶Ž«Ž¯ˆì%‰áDEdæg 0¢oðäån~¨åÜ œ`Ýâ‰|}ÄÍÖàjÓs<â;ù61IíÚû%¶Õþ G~ò8—þq°¹¶Q,ÿdâS†¨'?ævÅÄ¿in{ι8}nöç¾qCõ]iÔk:1äÅÞŸy"‹1«; Í=o¾¿}@H^ìŠ4Bdăx>õÅh\ÛTMÝ(Í?nÍ/F…”š€øC²Öa¶S^Þõ¶ÔÿL‰ *ÉŒò}¬Zô7æÄƒR”ÍBö ×.sYJí$/=QÞiøÍCiA¬6°Y­|qQY°ºÖìkWÛê{o¦Ü ý9™º—Lã­ÒŽ’±_'“(>ù+.sSÈÐ.®'­}Ïû »w·zúZÛ{xOÖH:W^ ·ÝH§aº¡ÜHñ¢Ï ,qtä cã±Ü‹drË?ÙõMÃÒ©†»ßèDå³Úmû‰`W^«"®-HŒ;t„ÏúËúšu@¦CÒ«EÙìÿ)¼ÿ·|¿¸ìÃ:¬BÏËú÷èÕ5|ßËNlçàý–{Hß¹~².AGv_Ü¥í:iðË·GÇk»óú:_øÕ ¡£¾Ç~اåûuyp(Ó,ø¼l]Zv/”]¹§êy'YÏõ¦¶ét©©:][joo[[/¯>Z#ÆŸFÝ…ê%Ùs’qz zï!­UMuT«T¨nRM/W©)êß­E$"endstream endobj 186 0 obj << /Filter /FlateDecode /Length 6432 >> stream xœÕ=k]·qý,ù ‹~É]H{Í÷£¶SÈAP´€ÔPQ^½VJ¥½k­TkQô¿w†ä!gxÈ£»Z;@áa®xøÎûµ?‰½<ø_ùßçï|õƒŒg—7ÄÙ僟Èô¯gåž¿;ûî ÌPê,î£SîìÉ«ùKy&µÞ{Μõ{¥íÙ“wþ¼ûpK #MÜÏ/´7{!åîÙù…ØÛ¥³»÷0Cç¥ß}„¡^Fø &„µÛ½„pVºÝþª…Ñî^ÁÏF8Ãã{üÝ œÞ=‡ßm€|™64Rã§ çÂî¿Ï­ÝKØ|wx‹§ ÁECö>ä3û ìîMZ9˜³;^á”h¬Q»›t’Ñ»G°M€«G·{?;!tLǶQØvoÉ"‡såö1hµ»=W'‘‡GÖJ§ðÈNÄ|ä²Å G†ÉQÈ áÈO Àya1 K[€J[ìpµl¢v×u‰ü °\4ŸQ ¨ÚÉß´_Ô¯ˆé+P8|˜ÏfáÕÙõßߟÿåÉ¿=PQí£A´zòPèð,-¦\?2탯{Ã9¯Ï/àÈkOIÑâUÚO©]ðªF¹ŠQxÜùbÙúBÊ}´Væ¼#xwÀ«… ùÊ«ð4BáRÚG;¼î^Kí¼fÐnÑ~S½„¡c(q…“0¾œÜ ¬á2é97ËÂîgÜðY³2&9•†i®L9,kÀNÐóÛEg$AAúüôI_ä¥4*†˜_ÉI‹¢¿ Xn—#iؤRÕM{ÝÃ%Ýf~a€ÿáwOÒ‚BD€Í놇/—{­o C}“ÛþMø¥û9‘)LvH¦ˆOZº=¼Ü‚É[+<²È«Œ#€:1áã²À>>ÇZ ×¿2 Â8î®zJKXEh mlÜYØ]€…e¢[üXîѾL 6"ÍìŽäí®YP~÷¦õ&½¹@¯‡| jþ?KqúõEœ¸|O `£ßѧ-“FñsV:¥<ÿe>|:ÁX²Éᢇüç3çq1 !/Ó¹áYdØÈЉ°3wÊP’ÎG0`w™/aϧ»Š0ˆ_ý ©VÑ¿ÙÏþç–’qþËnxn+«}zÞ®bÍD™Ðâç´Ft¸BQ‰sÎ]ñ‰üœqXóQ¦Ãa¢PÄ…•ðàf÷BÇÏëæfP´i­óŒÓJ ïM‘ã}^Ðh œûð žþÚˆ‰ˆúÉp.ˆ¼Ê:J/òbN0Ì>æ_…ð3N{ üyCZbwH‚Û{|ȉ‚!nBm€÷jFx³ÙäâLx»'=–äpTjzŸ—b§ËeµV$"»Ì³‘|f¨+”§ºcþé2‘©+(d@O+"Ž&L»‚#.ü)!y"v u«{õ9?ÛPâ5!ãiÆ–‚§1# gZZgÝð×QÝ dfÓËf6½È‹X°g²Öl¼I“µ}¬ÃÁ¬~8’þ±|G”ðOä ¯¯š0¼5[èöHÞsÏÉXÐÝWÊû㛦ø%ËÛ->5!qà*ûHYHš¤À€éùjY0Ž_h× ¨Ž™¯ T¸)fU0€š±{V—àTP–cVão¦R”kÖ7ªöN™zÑ·ó\¨Õ›-¹ö8„+S±ú!5$~¹ 1P6íÅ5<Ʀõû¼ž0'Bޏã©8¹ˆª¤¾ x/îœÒ[c&Fm¯¾õƒõ„×'1£ ׄv?ž?ùÎÔdf„×TÑçwß–žÍÐVy]f<.3,™Pá•Ëÿ0X˜:À`Yã»Á9Z3u‡Ã5€T|`ÀÿÓ &áü^߬"ÕJ / ÿ5¶àœžé%”IwZew Ï v 0£‚󊜂rŽn5°ø”«×þn°\DNër‡«†E Q+˸÷f Z€ÂËæû Þ±¤kxÔfúaªÕíeÇ_ A#uBÐq4~-Õ òÊ òp'ÝÐØºhÆVrÒIé€ÝÉMº¥[Oê»æ—)LØ¡y÷¶Í 7Y™iI—¼B™­ƒbåν¡²™$-Ƚֶ“%Í‘BõnÂQv—’Å1 tç¿kŠd>—´Ò{úå…@·PʨMÊSÓÛ Ê‡%¤jÁ=(Ÿ•jCôùF“DBÈ`ªvÄ ƒDUŒOn6PG㸈~.La5X›ë©ìÈxš<~T‚âAÁŠŠrÇ¥\y7ôЦ¡'9’®dø} —º-¦XüÖ×÷ÎxHõ0‚“Ÿ6y”’èú4å Ÿ YhÈJSÛ"84÷³‡lÓž/Î'¸¿¨›ÆçuÆþ$¢A¡ ú#vÇëf©N,—œÝiy¸pᓈçÂ.»gÔ\ŸlĈE¾_'û"r¼_XöÞ*—J±”Þ4Ë+1Ë­¦vN0Ü3vgjP•4KHœhØ™]eL!¿Í[£æ$²®Æy*æUÙ™´Ò¸ úCD·Ê47ÉÍuhž¶¤“p:±ª.]X gV^¹M‰ð߃‚ÁF² 0Àê6y¼p†®L3&jCäóZƒ,—ŒoózŽ:IOhÈ@ü7ˆ©cZaÅÎMvæ3~¤°7>q™¿B¿ø´¥¤!‰cûW‚K”á^7‹…êCÔ‡^€h3GŠÍ 8‰œ¨Þâ&ïˆ*Ggà®÷>3?‡ÉÒ‡ªÿ„²ž»ƒñ÷jW(ÂM+ÙøÎ^O5L$(S3ê9]¾x±ú¢wˆ|ëxo6äeÆ_MÂ7KÔ!£“óÑ»‰Úù)¯â#‹ÉMŒE"S_6$jp7ùD×{>&lˆ†ãu{U¢wõq»B9o‹ç6lèÂ<üïò 8çÀînzK¸ïóf Ý6hR ¯P`¥ãDòzTÐ:“ et?¼S{t-5vº\‹3ßãët:Á$äF›"»5(9b#ñnaƒ+â 8Ú<@Zý÷•oSÚ?At>cK¸E,n°S¨²(iÞ…)i¿˜ç÷ô1®u£õuèþÇ^ñ.î£G‹¼Ó»ÇÄJ£CF`@_Œ>ý[:¬Œ<3C…AÜ)Â57æM†žŽs½)–cGÝ%•y™Ýªìï®8ã’ÀM¯šÆ–£9—1h{vº~¥Eæ¡Æ×rBò—8àÞmÞ…æ‰è—œU.>Ëa}¥éjÔúª¬–²¹y. qê`/,ÁsÊáùå4äþÃp×e•s?'žéuJèrM„#Sµ¸¾:ˆuòåyß~;øªb_Uøñ@ÛrøÃy™ù+ޤY %gB7‚9 ³<41Gò³! Þ¶½(;pTš€Q¯Kƒíøž;ºwùõƒg&‡ÂPjõ;ý˹Ü[sè×_FëhpRvo—Ž -ÚY ‘ÿ­cqYeÎð ajµ·½3Øäj—1pJ %‡ ªÈE©OŸ·yú˜oºCàKJEfu¿ÌOc¤šE^qŽ´f¸'øÉIêfÙ0öÈ¿rÿAç‘Æk¡úIÝ\‡v¯0s âžS3W;ìîTHcCâŒEjøØÜnYÅKbc“+X›)Àñ»f<ÜäÅp³‡ ý4TÉo–õT•ÿ9-ÖÉ…É™ [TcÔFœ|„)DK-\N²-ìaŸ ™.økÄnòŽO|º£­-r¹o§:öúMÅÐJýì(ÅÍõ=¸ÑEY¡³š{¦T•B<—‹R±Ôr Ê'R2KŽß«äýR±¸€‹©T2=šžkoDÙ‘ØP³W΄P>GçêAnbB¢ÉŠ3¢(i˜uNW]°7ÖÊ*,¢Ö¥<-VËÐðŸÛ‹eébI”ñܾâ6U Ùñ°’$yÊä6½ßÁ¡#;³¶Åâ››D4(ÅÆT·Ð–çf™ºVWÞ` F¹°ÜCóÓyµ©?ögJœrí[Jßå»q9”¡*Ø‚ÙJB× T¬Äx;§é!ù‹×å–©c‹'éår½ôÌøˆß¹„{U}ï«6ÜG=ÑÈ—ã/¡ž,O6~ÈKœjÒ»—ŸåñUµéü£ý£“ä±WÌ9b¶<MóÃqa[]W‰ô˜ý®ÜQ¨1g÷ ?õÆÉç%#©*̺Ô\ºõ ŸäO×ÈŒ'x7õ"ë6“ël$…jöŽ[vCY~RJ(­›;¦„ÖåÔfÀm³•Z‡Ùc¡Ñ¤&FÊn 1ôí~¿Šà½ZÇÐàÞ¦³—HU§9\v±êééšÁIÝUkdOüôö<è=áQ1È€Àu5Q.)kΘ$¹B´bÇeîbÚðž[¹òׯÂe•QHÖ¢>òÅ$thùÿ%¡¸ jY›pò1ED’Û»âÖ%î´×•2û«óhÄ';%øÞäÅŒXH’•%èÔå@ÒD‡ÅO׈†Ô%pçM:>·3Ù½!ÁÊ—«`Ô—;ØRž¢Ëu%)ÍÒÂ1ÌLiÎÞID4–…¸rl["]:)™ii?×>p‚nVd°8R¼Åš^vä=úhÃû"Q®ZõtU8Å«‘Ê\„ÀfàêТÕÓ[ñøR‚V<5Üœa¿™I—€˜þrK…æµ§Õ,^Ñ–¾,h‹^¶ÐW Ì“Šõz–_•B49û¶Qóõ¹…5À¿–ô˜ó]ŸëŸúr@0Áxv:lDq@õ¶Ž>ÖÑË:ú T…¥ŸÅ«eôM}_G‡:úPG–¥åé/O<Ã_ëè]½©£«Á·7uôû¿ó ¯7¿ çy*ŒÎÆay^µd„5ääÅf“4}žÙÅ0H!ö‹ÈÙË)˜³Œö›£áµÿ;¹ËÈ(6jºÕI.êΕ&Ù«§$·wÀpð¥÷ñ-©dè .GvÈÊFŒØLu]?$²åažø-¦1"êÆ.ÊcoHÀj¦K‚¤¥‡“š¤f‚—äž4Š*Ã%Ñ×yt­Oóè¬Nñ:¶ÀÐaHî·ò3;¿×¦÷3÷9XÕK‡¹ð½<®´Õ¹wUl7€Ònò\#÷rÉsüf ªZxƒØÒt—×õè3î¼Kt;šsרzI ûý6$OÉ\/(>1ÙRnWO²ÎyžŠ§ i-Td¥é'S…m¥\,ù†ÙÁTç¨êø$ÒHñu6«Ã†¶—LYÝ•¹ úmO5˜÷û¨Of'k»ßÝA€åd1,TR®³q/Oäø­£ëÍ/n>Ãû18á.å’LÃæ>@@mOª÷¿Œq[õÅJ8;è~Rý"âl Gø©Šߥxð†gºf[VÿäÊ骷Ëä ZÍèg¨»?ʰt—ÔV®Ò3Y|±èä£;¶á¤˜³ÅUû~ ‰”Õ¹¸¤¦}^;*æiòŒó §S¨X–Æ"휘ä¹ñé_’­]Œ§f`À¡4NÈ›„qÜž¹-ÒTlBB?;´}y$ú3 a+PÔàó ò] ô 0ưÈyÛÜfŸ ó%ݽ´1 Ïnuï _eJæü?ô)7MD)p™hBáì[•Æ{ï“áﮣ_G‡:úPGšxâÄ¿—©62u¤wñft¡mZþn+žðþÕÙO&O‰„ogö\Ñ=æ…$A2žš\þõŽ©ÔÏ›k°KÔ(gXE7MŠn2”ežÈ‚¼„Y3×<É%gTev\^¬K ™cbbðÓØîrÒ˜)E4JîÊóö@dFbxáKA‡ ÛB®…Š'ýŒ*È0"mª"üWœºàÚU¾ ¾=Í÷åy8ÃÉ)ûÀÆ Š¡ìŸV“ãW^ºþaË^÷Ö_ÜE©{1`ôtÑHålÊ™W—˜œ¥ôùð1¯Ìä&šÞ«æB+Ç#ÞzƒihÌ4”UQPÑo˜³Îè k™­8±GÉ¡$X¥'ås­»ÔÎÄÖé+ëÒ{cœd^ô®‘&·÷œ«lLÎp·ÊÐOåÀ˜“@¶˜‘í¦žåÊÒ>äóDÕ[ %/|Ìg eðW£&iÕÔ,%ݦNª÷Ÿ·R6ý?¦g’º5Ú³dø:kÏLŠýÒ4©Û¥ c‚¦7欺˜Ý£¿LiüÂôÃqIE¬§çùÃæù6KGV°†`÷Þ¨©g®¢y_èæbò]3Ç\cXxçž¹ŒßÅî‚CܪȲZî O‹ÃˆÖ÷:]BOù|תëB®ˆI𣬠ñYJ=úŽ ŒlÀÖ ®šÜÕÝDÉêîþ&¡ƒBÉÒ ç>½ˆX,¥”·môXJ²œ7û\ÚyßµÒ]O”Ÿ-¦G È0—Kâxc¦ÜpP‚FU?]jÉz Û«½ÇV‡_}>¿Æ«jñëè}X†oê芘ËÕšn†î·u$êèëfM·‰Í÷û§í‰#d ËÌÿiÃë„?l𿴉߶a¹$Nx|êçmøÝg¾øaþáÄÏ dþw?U˜jk¿düÔvá™ ÜÒÕâO£î*°)nì´W©ûfšÉºkEFDéy—aEi¹¢Ëvà{rBË®6¶£ª¬3§µ±å'—×Ã2 ]?Ó:‡´¤ÙnVª“~»³HënsrÛìjXo³¤4#9$¶NÅî±'¥¾Ìå FÁZöçpœÑ bÑpn• ·”ûŒ=“D‰U[qô»ª¾Â„vð¨]‚xÝÈMéˆ$Ý<‘¹>mÈ (©h––ì-ú ã½3yŠJmmg•]²é„'1#«Iÿ¦l¬*êP3Yìdì1w*o¬ï˜cçéĹp®—¿B§ñ–¤g€†~“aÚÅÚr¨~ÌÜ[Gcß5ŸÌ[³”¥u§‘aÌÍt=ǘÉRÝZD#2~Ú¿>­ìwC‘‚ßY(‹l~xÑNʦʊ£0R"`›k¬8Ä «Q[‹«¶&h6ŠŽ4{†Üù·Í䟤ÍŠh+Œ’æ4ûb#é¿ &\µê Ø*[®Õ\­¯ôp…‹é{ŽŠ÷lõ½6%Ò_í0$2TøÓß—ð\¦^ôUûRÉ_#ÙÀ@úZ}a²¹t¿„PE8`.Øìψt®ýòAhÏ%ÆïÍ‘ÖV'¤¦=iNÒNÿjC-Iª¯œþ°æ¯ÇyVdåÍ·%ƒ‰¯o³/wøHh`•ö¢=†¯æá$æ+ÒWb®JŸ“´´YÎIöJûŽPs?9½]Û±]MÜCXÈÔÎøY50É6SgúK#®× 8™®øó¼!?îç…]ùÔfµªN±0A:é¤ ­Òc”é+Dä;j6½½žÈhfMÚ›¾Ì»iwì/šä+¦Ê¼—­°®…D·^³=Ö•u²Ïa—4g9éftš®Õ~&O*R¿Î~|Ìežûm.bìN7h‹Ð*® >ѧ¦ëú=°÷Qww`}w÷ÞN_Öu²oÊÌ‹ÏÍMl~NLŒEé/$-§ÙÃû<Ý– Â ÞWe½YùÏdk:lywO÷¹ÙN×<1³«\O×i»õÃU!ò(q Ì4·—¶/~›}¹ÂÙ)}¹uD÷繊[ŸãÇÒemC•À8¼ÑoÆf\×Í)9Ï…%1Z™¼*BÌq„><ŽQ'F§JN’´ÙtyüñɃ‡ÿþ¾îoÀendstream endobj 187 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 4094 >> stream xœ•X XS×¶>1äxPœ°§Bµç ´ØVŠC¯ãSë,Z‡:k™…$$@B†‘)Ì„!ŒJµÖê}¯ÚªÑ×[A­¶uêíµõÚ×ɶv¿íý¾·“ɽŸ÷Þï&„dוּö¿þµÖ¿á~#ç¿bÃÖõÛ¶Íšéz3‹›Ì㦌à^äç 9÷ûãu‚‰qË—¾¸ñ¯ÕŸ|àç˜B÷‡`Õ8xp<Áçñ2äÚât¹$%)YòJÜ«!³,˜2{æÌ!Ë„ ’”¸XQȆXir‚0VŠß¤…lÇ¥$Hå!¯,J–JÓΘ‘““+ÌŒK’–¼’“"MÙ’™ ÉNˆY-IC6Æ B†Búc…X˜ž%M„lÇ'HDAD,‰W¤¯’dJ³ÖfÇÊäqrãßNJÞ’²-5m‡pçÌY³Ã^^1$&~I0E,"ˆ1Äbñ:Æ,ç xëx§G,ñÿŽßf¿;‚—JÁc2o$1r7EP©Ô÷þkýOš<êÖèô€—´OƘÆ\»`ì£qWÇ¿8^2þþ„–À…yÇáÄK'^Ÿ¹¦±\pþêäÆ4ò¸YÜmZçÐÚUHæ‚L%>qe’Š pPܪØGduèîÈböد8‡, d“Št*jÕx¹Æ·g‚4½À¤«ûj—µQ†T乡  ©‚P0év /;y\äŸósÒû]REl¾NÖ¶b@ÉÆ“‡á¾Òw VÐüùÞî5;÷g‹`4– åÚÁ,wùö„ÖOîBïøXšík©¾a=bkk9uæ„Pï•ÉDÅú|½šÅ±¨ðs'ï›AØu™Ï™`9 ý–\}M@h§ÄÕÌ}@C§s¥»N~ÔKª_ܤBŸ¶ÑïÅè%—>ÂVT¿²¦ ÷7(`‘¿·+6“hº¾ ^t{#ðlðØtçÐ}krhÁ ÔvQ¬æ9rò®c°DðíP@š‹ø`qº]i/ë7Ÿfš,=  P¿™ßVht9z »J‹ÊôõÖ™­þû‚Íñ.SŸ~¸ä  ÚZphb TÉ€%‹Ýr“V§hó’r2ò%jgRKß'pl/œ`b‡ ƒ‹Ã‡:AÖ:ÜßÌǽÎS%ÐÀÎ ûgAgó3NÓGþ½‚¦£9‚}^ åÁ&ä°à¸4Nœ=©¿ ×Z>›D†Ã9Wû’Á@.ÍÉ«¿Ç÷ÅÖ†?©*Ö&FE Ú`T·o‡@Ðñìò6‚&¦†>hbæ*¬OÔåê-¥–jPNÕ6ŠrSTÑ:ÄÇn]üóÙvf¸| @Ë_øœ òèêÂjI–FWÈHb²öjáž ƒçáÈØ:¶‚5è : rAò±Ú®Êw/G‚=híPDè+Wfá¶|æñR/+ Ëë­U–*Ê@.~"äz©wk°lö§Ôyi·Ë=}•âyhQt¯h³2™Ò“Ú³1°LSZØ òµi(QM¬‹ÀÏ6û'HSZÅú²=¶7­)æ ëASv;n¯­ ÆMÁ§4¨âÚVQQZ©–Ç H(Ò¨Óô……»q3uk§±ì|9ä }\p¨(È‚3›@ Ãñp6–[ºÍÍe'pɺšÉ!È(atE@WC¡æ§ò3'8y˜îõܹÞÒÑœ¼†ÄŽM Oà4…!¿ëËïŸ:aï:ÂêKôZPH¹ŽÊü]½£Ýjzó¾S7 ïۿְܽ&[S",ÚÃ*¬Zž–Û” ð9'ïÞìÂ1ÄÀ­tg øN‰èY‰‚Ð(4ÿ|½ àó—î9ÜTЖäb3ì‘ÅjÃ’#?²Uè–ÁÁs×õ˜ŸYtúâázÂc€/»úl OŸõ'ÍvC…¹ÑÚÛÞ˜bz€P5¶¾–ÜEûã T,‹ª¼T˜…ïÜjfª‡Ýîjõšœþt´­wB-Ξlã Ž†ãI8é>ôûéÆÎ/ÐÉþÅìăz; ‰ùGÿF>h{+ný¦%ál¨Ë>’_€Ë>>{F_àUŸ{wjÎó¡ÐIa)Wd¤TY Ï^Õ`4±µªNÅq@ýxïë-ê¦Âz¶½¦ÉTe°HìE6@Ùíumu=[¤±%½l†=¥<P/ÿaöŒ¤Ú4£†•I•ñ TƒÌéœè‚å ‹Zuë-ø.8ÚùŽC¯™£Iïöž¸xî‚óýîƒÑ6oÚÈŠÐôk›úûêkú·²íµ6pP÷ïƒUë_Ž‹d‡$¦‹p.• «þã\àüÇÊ1©ÿ‘pu«ÄÝNxÐõ¿\78i¢‚› ÏÒ_ï¹ ÎRW¶^C­õ¦½Ñ›ˆÌî³£=ÛÕýdd/<(˜xúy£b¯\]"ѱª  äSožÌ:z¥ãn îÅ •0z}á¾l¬ì‹Ím6K‡¹•5·XÚ@5QšÔ}‰‡)$è¡Wº-^%¿êÙ»}KÔ«ÃÔ¾e?uÄ™‡|nw‰n‘5‰Ó¤bI†=ÛÑÑÚÚÁ ×ŸièƒÆi/]§‘Âkì=ª…úOâ'õ¤+ '“ønÔIª5An) õl5Õ`µ‰µÐac ƒÜÀmõQ}˼ zXÂѸdïÀ2Ëå‘‚c^lQ¤w²t“hšþ1üÎ÷뼇=áöµÃÇW¤×W i´™šÊ>¸ÿYÐ4Ã÷¶Gy1J÷Aaò?PÍör׸[°¼àõ-Ÿy8Þe§ÈÎõ`;G1švO 1ã¶âMBR¥ïEþÅÙÁz´€¶â¯Äð» F_é3¼ûä“zSbèÁMxkU·Ïàˆþˆ ´$sX» HñýÐÒ… §ÌÑüÉñž^@UTë“ õZÜ,c‘Mð¬ý•ת®Ú®•VPKá¶¼të8U!Sðnj¥H@Ê¡t©¦-Ë%­S=goí¬«If{«åÞ¿wï…ç1×^ÐW&á“|y‘j!ŠÏß…‡³¡Ìú«éã—æ›†/A%(3بNoV¹ΪS×èYùH KÐ'èãÁ]¼nŸÞýÔFƒý” È{Ë½Š±” •G(ƒœy¦m†$c¢ÉõÚeÈï=ÀÚh©¥ü=Ú0`š¸z*Žqø"úà ü|›íàž£!ý佌¦àç‹‚þ4õ'ø"œ ·Áý ªA_Ókãïþ×ÿC¾¾zdÎ,ôZ$Úî)|n¬óa#‹pÝh­ ¾ÑVÖdç«ÔF!‰^¶B­Ðgë€RYsGúë›:™ÕOæ "|øjòªË¹O9Žgœø ´ ò¹Ñp? ©»g¨ïÞ¼Š'pè"ä·QÒ˜ÛÔfon­PÛ4¦ùØé£—õé§©K§!ÿ¹¹˜æõh‡BUR”Án!ï“u X[ŒÖ# Œj‘YÊ,°W‡ïën§v:Ãah#ï2—Ïç8¾EÚzAoo2óo“Ça¸àCïid×ïF«±”×+êr2ÔY&='ÿg È‚dœÜ lì2… ¶{?è&SCtÅ:5( Ϊϯk-µWš˜~8Iðó³VŸèŸÝ&Â]±Ï¿C/BíEv‘?úô£Züâs}ÇÑeÕ ßùòjeÙEŠ‚bæIðßÖ)A1ÐËkrk++m¥ ü †ÐNáñ˜í;—ÌYÕ{ðÈùSwn2SÃé¢ÂzÇ™Ã'j«Í©ªí©ûäìlŽ£/ Ån~gáüÕ=)GÏŸº}›™ú2]XÔÐúqÏñš*‹H±#5Zî"Ü9x{wƒñ9#¸²#—àê@?’y®sw¹’Eе.LÓ\+ˆT¥à•£xÅeà¬ÚñL9Çð9‚+§Õ›’·¯NPkó‹A•_%«ï€“¾†“¿|§,7Qž&MkË鶺fè|çã0\¾S¡áLo{CQ®© /ICÔßÞ ÒæáâÕxd"ŒòinLoÙáâA¸¤‘wÛÆ‡ÿ[h8Í›|4…l¡ ߯à:e}¶°DtHÇHÐtšæÍ*œBf¢P¬GÕ@œ[-·wZ:*Œîÿ̰v8 NàÁDʇ‡ ´xãe®Z­—©AUP™c? ý¾xø¾¸_LFRj’#»«Ì &ŸÓÍx2Tržå37ÂIÄû[˜ÍôQ$ÖâÀâiÎß|xï2Ý)mKNI&›Òûzz:2cU•ÜŠrøf¥ª–DòÒ‘ÎQ£™Q~rq€?Aü?y™€,endstream endobj 188 0 obj << /Filter /FlateDecode /Length 5245 >> stream xœÍ\[odÇq~'Œü† Á‡’xÒ÷K?HÇRh½y’d–Ãå2KάIz/1òßSU}«>s—CŽCÀª·Ù§ºº®_U7÷Ï+1Ê•ÀÿòÿÏoNþñ…Œ«Ë»1Foœˆ«ýÁíå‰ÔÚ.¬œÕq4a¥ ü]Ê•q´°ââäõ‰X]žüùDýUþßùÍêÛ—°GÐ+3Æ õêåë“´7|¬Ô(`ÊY?*mW/oN~ä©r:ÆAœž‰Ñ ¡ã//ÿ€Dì*ŒÑ9CD”Eô@èå>S§gRè1Âg_ŸžyÃ08œµ4ãÂ(”^ž? ôð© oÛp׆àk ;5ü‡¸ÃKX``{C=ü'ýù»¶âO§§Èðï^žüôX±Çk'‘"VG¨•wI¬?¡@bÒ ÿ‚Î`‚N¢6t€+úsÝNw 'rŽo†? °ÚÃb¡Q¦eø„ƒj%F}dóÑvÔ2ì™zÈ|Àä´·Åz^< IrõÏ,Q>ñ×m¸i š<³(œÀu¢TÏ¥’bôrV–ur”êÈò–z4{Ò6Ÿ‘¶ƒ}³´?‚LúgÞ‘´oÛÐGcMšÐ¤ "Ujø[‘R¾HŽýeóú/P Éÿ>Ò‡ôç]SÈýiâ ‚spc\aíר -²i_ eT£†!¨lÓf¯Úð¼ ïûÏòMDJ:Ð]‹5÷mˆ&ÚÕY남 <†%Ã6YPðèh@6F9Úñ—_1ŽGÕÊ ò”É<Š,$FÕrþ÷½\³0™×m¸•ëÅÁ' â˜9^xu^ø$dB•NúîolÒï–LºFž/Úw_&J_´Èᦠ×mx߆Wí³]›Ýl¥Ö»G†°Ö0Æ}A¾ý´šCEhŒF™Í… çQ m2\}›M5^×|r³÷s4¬m^¶![pÕ¥–l xTÆlÔK1á–©Yp݆ïÛð¢}†$Ê4D© EÉ+”o{—ËáøP}hý„äö =ƒm¸à“2ÔRIv‹ 2ž™G«‡ƒu¡ô*&.]$éŠ3xÉ€¦ÀŒYÄÍ,¹oåP·?[@\$ —¡ÿ¶ 7õçç³÷~vV½^eìèºÛ6<ï˜QÊQ}‡ée—ÝB% Ñ†QÀФ-òìeâ!p¬(d{\k öùÒžXÇ åm‘‡‘zYÔ’ÔO‰ìRš1^íÌÚ˜vTÂÐô¾¡¼|ÞuÈm›½èRÜHæˆÐ=ªNíï>©@îŽ\G[ð0ê=Ÿÿ\=_Ù]Í–‰û¢d ¸RbÙ’qNIµæö¹‚›KZî~Õ@ÆÛÙP=uì邇’ emÙm¦çhÎÁÔÿàqR¼Ç“Irˇ2ùô»*Mð“wS—©ùÛ?!_˜-äÚãÖC&ª1ØýzèY†°Œ^‰˜G¬‘ÿž áñj~¡ªU¡ÿÈå—Ê9D½ÌS€q ?sxùõ 0p¢6ó@@ç| õ:$%ªpä’=ä!v{ðÄ ƒ¿´Ùû6D3‚Œ7Gí7mH?„Ï…á áQˆ#c‹õìÚ âP‚l?³ˆ/-ÈÃuâÆ”Ø&ÏÞöŸåóĶmÁ=§{¨²¡ØF×$ÁÝ£·{&é_k}zN­•3Pë2f‡½£‰ûƒedðúã õèl0¶ oi(Â*¦†ÿ=}ùß1¤¡;¶Î  v¿žx°>Ö hÌ(¬Ç–gQ«NR¦¹ipŒ!Üû6¼E¸°§´h”Úº8ŒK¹” 9‹U£ëo ¬À-Þöá)yZØäáEÓ‚iîH4ýÿQyúïR¦îY2•*ŒöÈW"ÐÔ¹ÕG(— ˆ2Ú‘ƒ 2d€ÿãW^Û¦nÖÇÞѲ¬qD AuÛ»– wmx‡ $á´Ã5¥#úØ ùT)µ§©‹ e¥¨qh6y4— 3—Õ#R ͵«'þ`°ø.õƒEå ­{pìÑ[¼»&ÈUÄ}/)û…ʵ³}Š_hã蟀c…À 䛤ý:ßU%S*Ã[ž S•Ó_•#…Ú0† ·Ã¶šÄ ZúOM?îßfüõ`)8P•|ÂåÀƒ6‡×"ÂìÙÜç®L{ÀR0íϹƒC½:ÔhüºÉé—VµÆf~ýð¶Á:¯Ûð¦Ç“yí¶Í¾në¶€Q¸ŸÅ“·hãX¥©ªåéTŽŸ $åü©ÛÅÜ€eŠ¡6Ó¢jWj­²â·E†fø®õξi{üÐupË_{ Câú¥u¬¨ƒ‹ …'Å;ºêzðz(ækLÚØ'AMeÕ‘oJ4x¶nÏDï—ÅJ %뱬×Êéž(Aù»n.^ÕQ»MÀ޽±”úŠu~:å}ùC5IR?Öýd…s|y¥üÓ4©ô1Ðá1xø?q¤QÇ€±ãëc¹º91Þ›ÑÇ:s}òÇ Ã \Öƒ®øÀ°=ÖüPb¹¢ûP÷ÒÙt  Fk õÓÛ_îñ/<]Þ´lñ/c4صÑ(5„Dͦ!5ˆ¼øé·DFÀ»Ïøl&kÊVÛUf"¯9GŠf”ÞßEbÒÓ§B…$ã©«o&K¼ Cd‰èáWŒ©k¾%Nz6(dXjðÑæ)Â×]29)Ÿ+ PTÆ`UB·lù£ýhÃw¢.–ßÂÀ[ž8iK6ySo;Uì’Ä•§û‚z8.ÏäŪ3È­Æ×{âï®:^0(Ou4 ʃÓ¦ ¢’&`šð(s+m–if᪄µ2¯ ­µXH@òE[xìLNá¨FŒèUŒãþñÔ r‡S?=SªãWgاQØIGKt.lî’¡DC—dÌÊ@öÆÃ« lÖ$“ÜI5\¾9·5spµr(f`8 HÍÙa—¾„±`®ÜèŠ&Í:Ÿ¤iea=ÞÝÓPJ´+ òéd¼ 2bxôHøÏ'‘z@`dI°_°.x¾gñyYD_„uP1³©àTÃ:!Ë·Ûm CtUű®ó¡ž Þà¤Øð!)BDàŽš‘f›³áÛ¤îa‡õ]!M7È0ìØ¹&²NÁpGZÂ,Ý߆ØÄ°s %¢ø‡çlŒËµ Ö›Ì>„x… õ dbn"iiÑh[Ö«kwÛ¶Wži(ÃðÛ™ôa!×Ð;°ì:ÙYÐfAi…ÿlI‚r³ò"$Âë&àõ«BÎBº71›¸¤ËzY×™:2®`*þÄ8¥ùáŸ1>K0vÃl7ó£ƒåÔ¸1˜iÈ^±›½Í¬…Nù;œ5t¿Àfß4H¦QBöGŽig0è÷èw +¶~ äàʃ§+Z³5)XxÏ‚^‡Û ï¿;%lëÐ Êè¶Žîê辎¾¯£u]×ÑÍÌO·uTñtÑË©ÑSoòÆtNøï)MdÇJrœÒ¸ JŽB·“Ê]ŒŒÌywJ÷ÌÖ'/–Ñ ã†l RI6¬\Ëh‹ Knõd(]ið“á‡4 6\6µ¢†2rH“OBšs€–#lr»Œe:ùp,£J)FÀÇtƒc@£r 8m89>À¤1`îÀcÙt7‰NÙä˜xrº¾‹M<’BrzL©>“˜÷eõA–žõúM¢jé}ÂlT8˰Is]M’žÌMåÇü7¤CƒØoÁ)/:ô‰ö‚E^îØ³ü­¯gE´M’¥×«‡$zÛš…æuΆžJa¤…㎱#9›{i–>œM³éJæÌÊÑ:[â?`òÌ¢5‘„U %ãUD@x¦¨™à§AÏ@!ìâgÒÙî/-µÝ§éX‚’ -Q}eaºì¼ÒßåŒïú€›Äô|¿|C¤!’Iž>µ”}ÖäÇóî:ù Š×S>ÃÛ%x‚Y)I°s³ôuŽ2~ì+æn»m³Y’HBV·æ. aÈ»*±ßk_%{ .š,Œi:Ü40ÛÜ–Y[(‰«3N#¿äÀ uê•ÝžHñÚË·RxE©w>˜§Rd¢çÔ~žƒIÁü$Å4Á¯/™í?7Q`×VGØT7)QÄg$ çÑù9¹Ÿy8å .‹]eX‡«ñÌè°ì¸w-  Š7¼P.ÀÌ›cçDËj¿ü»O‡"¤~¯‹ÁÜhˆ.¦’Ó¹ ì/±\\ 5G…ùàPyñ<±_½a%Ré:-±Ö«>Æ Ç?Ëè×i#'Ý>eœìÁœ¹Rô5›ˆy,dŸín³<”ìÊ—ÍÄyÈõ2¸z!Éí¦X6rµÔíne-í¤€œŒËY7mÑúm«;–{…xlˆc}.`_^&– ÉÍ;ÜûF±Ì+fž“BqÆ{Ézñenë»#ê˜=?“`ÑG_óõMÕÚͬ†—Œ6ïÖGÝ €Ìá3åx »u9~¹u\¾œ:Œß!w,&£Ä@ÕbÝÌüt[GÀ_c‘‘HÊ+P”OõcRØŽ÷ ´cUÓù]ÚÙ䀑ȩ޾‹&·Ü¦k¹z›¾Âý·ÆõÒ„Q©ZI¾}°=Ó#½žéŒ^°ê\ŸÓŽÚºªÇY€KŠ¢C#wiìž+oÍüÿšuE&š"iÂh‚_t À“jà~½¦¬ ”5´¢ÂaÇñHŠ?.ʰV è›Í·-Æ6œKª=å„ñoyáÞ[Zo-FaBí“À¼q‘ƒOHËVáK [®BèD ñ^È\ÜÌZû" :PÌÿá4_ÔºÎÈY[¤ýT΀‹ß'rØÔ›í&.x ª¿sAO‹,œÆæi*g‚ÂËJÑQ @H·E2=çå J /Or¿€àyu‚y’l:ðÆ4Á¬Ÿ{~WÕšjL }@ºX©°­W\hQnÖ»"¦öé_Ké›ß·h™]’ÆAnüp ¼_Uog6ÈðÔ‚ûPï RÉ•ïEÀ(2¤#>fø¡¿Sú\Ë€…èg·Ô”1Ô#’”¥'¾ƒ}zËIYH-¦#—zj(CÍ\ã¬èè9§û üR<ã1Dšœq¨Â»G5Å¡qŠC[ZÀøƒé5­$ý'®Ç‰ó÷]áÜ¡ä\Š]$bرùW#¾jÐá«´‡`àyf}×Am:T]³g——Tr_P°`•ÇÐM÷íÞ3ˆÈ£USp‡‚ßf <­Y6âñÿ<-ŸäQïx[¨qR9hÍ-AGÊ¢ØÉ†}躟ö¤ÂÃ+“»Ïâ¸c+ÿnÇÂöE™¦,WUKE&O$Ó‡ Kyv÷ôt=Só@_Ë âëÄþ¿×ÂÐø“//æ`]Šyø ,u™²e¾™•ÆÄìjàçu0„ £¡/‚BJh¥ê-Ë®è(’]â‹ãMú÷gªaPì×x{ìI€µs³Àú´½T/ѯ½5ô—¸ÒFÇMr—¨âcãù Î²Á¼¤×¼‘Öåž²“<±]§I´˜½"à·µõ«fk w_wy‘Çèòî†yKæbZŽkCµò%«!#©>[Ý0°0mu¡–¤zC@R:=B#\¢}. £:Ú.¾´¶Ïf~ñU³EUm±˜t 탓ô}N¸)2ü»f º§Qß4gðÏ? ÛsÙ¨èðk’K·CÜ ¯ÓjìÓMÞeyês=~œïs|šØ£FÈ­MÚ#ŸþÈÐÝÄNWÄÝ]påz·õ¬I¿íTNðˆWÛÆÔcÞáZôÇ!óº|ò¦§5]§&ŽDhÃ̲š0Ù`ÆÜD×kOOz©°ðú`ÓûØ8ʽÄĤþC ô¦-›ù$ÐDJ©<ž±x‡AÕÐoxñ;ž·éNËu51#Öe\šýýWÇŧÄtè¯ÞØÎk&‡M¢‡ç“ülþÜ;±®ËYF¹Fxo^Tþ¦p&es kÝ{Êë²Zî¿YÉé÷pëQ^~N›¸ïMç|‡ˆ0+ë;ÝYˆÅ¤=ýny6éªÊ„¬É¢|îŠPÓœi~¢¼â÷v Nãrú½¿°ÞG‹qÓ!Ժ⧓ÿì—Ä'endstream endobj 189 0 obj << /Filter /FlateDecode /Length 3081 >> stream xœí[m·þ®_! 0°r"–ï/Eóá ¸ ÚÀ€kÃñÅ÷âkîtÎé|¶[ä¿g†äîp_´ÑÊ›¶ §1Åå’3Ï ŸR?-9KŽÿòç››Å_ˆ°¼Ü-øòrñÓBÄo—ùãÍÍòÉ)ôrX°Ò.O/éI±J1gýÒǤ2ËӛūêÃJZæ¼TÕùj­´a*øj»ZsfBÖ@3ˆ>(+±gšsk}u–z› ª·Ã½ï°Ùqî­ÊÍZ[Q±ÕZ{É\ÐÕ×E+è!‚ÚT+ äB¥ª´V8§ôBYí ¯†U½Ç–sª7ø˜åÆá„”¶ÐEW›$raá{œƒ’ÊV×ñÅÁ{o«ÍŽÚwÅû¾Ä'=ª¦ºÇ¹q¤NkMïkô%ZóL“sFëò¹«â7Ðìh^žºÀKL«Ëm½Zï`Þ4ø¦hÿaµÓâyZ¥¾Ú¤ez¡ÚOfÛ zß³âsšùiðZ•—Ò°(gÒqMu{³z}ú×…‚¡^§g¦YÛðŽ\˜·RgÓ„´,ͱ‰¬ëÖðŒi rZoi·qÞè€FY+%™!j¥AàYj ´FÁIH˜ læ\S½ƒf-àŸPà4¬/êœE§{x LR@-ZMá\^\|j'êD çA*t4!â0N\y58è Á1n·ýfî÷ª }Xñ·…O–#ãì8 'e÷ÉzJ—ѶOOÏ)ôÜM UÊŒK X—#UeW§ÿ¬‡œ:ZÐ0IYŒö ÃPím4Wœ¶<,û,Â'X §ÒÔ²Tþ/`tżuryw¾¸X(ÐóòLñ뢿Œ»åÍB;§áMËõâ;ê%U`¶Tð¨Hcޭ׫¥†W‚•^¦aDˆ¢:/W4ÆÁÕÂsféAOVãs¸p©Ú‹ÿ¶Z˜Ÿ0è®Y‚ˆ$H½§÷í¶‘ xn ¬ú3ˆºZ¯ÖÎjø#É:(úBÍGÔ`£ä ÃU-ÞS‡+j½%V‘æû d%â;ßÁÛ´¦Îµ¸£߯ ðÀãþ½šjy¡ùbÐHM˜ÓrVC‚B•JvTcv„5zÏvüÔep̸  JGKæÖ›v‡,n©ïµ^‘x;hí„­ÒcªEØù!Ђ¡"T€‰è¹ þoY³AîpO­‡€ƒ÷Ávð/M656ùé¦^ÃØdªƒ+ìјÑÅ8¨fʉdÉ?Ôv(:gâ:ÀЉKJŒRbfµxFâ‰oH,”Ö~Ìà 2:ƒwà IÁµ¸l…€§1ÜbÉ›¶$â°°`„y q“¹%ñÄ ‰wÝEt;lI,Æ=ŸlDÏ“fN_Ú°L&4cÎh4p%Ø&²3~UaØñ1Hy$7œ¡šÁ£`%‡‘QCÕ Å«G × éбl ©ãƒçñ/šžæSuf!’Û#6"³ø¸5üÄäöî7ÖÄ»}šh‚Ð#zîqé…Š{ú² *'ý òMèùd5X2P€9¡iÓA'%»4§LL£­üÌÏ=Wv8ðÙ¨Á¬‚‹éIãò÷$‘â†âÇæ×úÞ–Qeª. …cV#Ë3Î%M„ÑøTÒ5ñ㻾¶ V2Ñ©o“{ PzŸ1 Sé,éï9Ëõ(ß|¯tÓrœo ê:O_L¶‹åLß›÷†¨Qé!éÉlùÉQÙSu!´bn˜“Q¤^ …±a”œ: ¡µüu²ˆ)³ä R°#Xñ>“_‚A-Ëžô#E ‰× ™ºé}ß¡—ƒ<¤ X[¤:‰i¹3!Ój[Ú#.IÖ-‰×$>´HVýQ7ƒÃ )JKQ5äž´½)oI­¹ž†xˆƒ¸cöí-Ós†q'7à<ÜôœÜ’æÄ[²“¿› >ûy[í©±3øXò>‡ƒc„›NÅ‚‚™™áœ©é#íl™o‹ ð拏aMØPŒ[_*lßfɪ¦n£¾Êrfn½'qÇyD[³oIŒ_Âã\—Dá Ö‘7™Í`ßë<»®ö¶kµwT×}ß*æ–åÃmWC•áÝd 0>"§Kð´Àí3ç4Ÿ>'ÁË[UÜhçöGTÜ4×èÌÌÁ=–—âbå¾®{| À1ùCõ3·´  ‡‘Ã9EÓÇc’=Ñ®TáÞcdo©ã'%0íg™giÝÙÚÀS-«bîò;ˆcc™0¤)"dò{2„c+âüo2 ‘c&é>óÁ_¼"ñ#ž¨ iMÜ£öƒ7”áÖå ‘šŠÔ”“³­ [d-Â*æÉÆcÆü%çÕ:Ì!2¸E4¯Ÿü8Ùlð¦g;‹Í0µÜC÷`:z† ?X7Ï‹ÖLi‰}:íZÁÅBFW½Ãƒ ([ÏŒÊþ4YÙ:æàŽC>"»/ŒbÒeî8‚§Ö‚gGôaŠËœþ”#N¬§–³Õ©3`µdJØ`Gù÷A€ÁZÔãA eŒY¢îcõ?ÃÒs6SÜ@X ¦Œ›áCƒi[»ø©#Q{ò9¨NÄû3³¢VÆkJ=ÔŽµÌ†Ú¶.¬õ"GÔÅXÉU!ÖŠŽ7ÀtØr` f¦¢¼Œ%eÀ-îy›³ƒê°¤6‹eo7Äq0üD•Ï»Áúª–Eç&§ÄÂ_Dþ÷ø÷é眬ȀQeæ*¹ ži/êË<Ó‰ù«˜Ÿü‡8Ÿ0±âˆÍóT‘B‡´ÑzZÇ@;—cìezSlæq×:"à Űg¤ Ňp°ƒt`҉øéúÀ鸙Ëï+¥bßë¬z%R¾„òÇÐaðWSsÝiÉÔ ?ÁQâÏØ¦ž«{Èuò9㬱=g'߆ ÏEí õ´ÈWPzh¤«ÖM*jKÒDW4ñ¤6‘¡Öè|Y sº%ÎE²%J>ypdÉî/mÚÖZ3H½ãIjh,þ|ñ ùdœäendstream endobj 190 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 1430 >> stream xœSyPWˆ͎ŨÄH"(#F+£AP´ `ACDH@h” â…<ðšRÑ ¶B­GG± T†¶"R/¥EÊŒŽØ~›yq¦‹uÚÿ;óþxß;¾ãwPHdƒ(ŠªJÏUéR×'FüTŠw²áh=ÑZZ4¶¼³Âv4¶Õ81È*&@ö8HhŠšX03&z»§§ò³ŒL}Vªz£N1ÛwÖ\E²^ññF¤ÊNUknÂ&W•ž‘©Qiu©šäœlÅÊ$möÿ_*„4#8+[—´U¿^•ºi•Æw–Ÿ—7B‘È ­D«P D±(¡%( …#?& {ä€Î¢qh¢¡¥h3:O9P+¨ç6Ž6‰6õ4E»Ñ‰týDä#ŠÝÝ…z ß¢ëæ•ÝTƒZÌ4œæ82sŽ "Á/\Áf¾|‹ Ìï-QÊ‹¸W­ÄŒ ðñŽî)Hì”K,>ØM`0Qƒ4„Ã3ŽŸf²Nïk²–¼×ðF“5‘Àslä·÷íïuô;JÛïñUœµªN‹‹Á¾¹Ä…ì3±Ô·Ä°»x×Ôœœ¶v!+KøÂÚ¼f†3͇ñ®èmÈm2³Dòé2ù—7Àx¼gëmCM.N™·)0QU^+˯Ø[±¯‘Ã"c;£À³0©ÿΛžuW\OËœ 9®­Æ“›®œë¼Û ]U"“@½îïÑI=ë£á¨ÐŸL÷'ÓƒB~µ*˜˜íê%‡ke]â…;‹¶aV½«´Qä¹xʼo7uÙ å}4¾‰+8°ïìv{Å9´‹Cn. "gƒZ–¹Ks` ÛÏýåÛºÌ>¾”+Ï©õù!dLž~Z~ÄæôÂ*;VüÙÑRs³Mv$æŒî&>¿*©=Ê7ápÆîmYºÔôäíq˜ SÕ·Üj¨(—¿,«1Ìû")³>«Áxp¼Ùó[×ÕäÀRù•Bh'Ìí¦øRÈçpïÞëySŸ/hvr¹yš,&‹\`&ØõuS%äÒ-‰W‡âÕ8ñTÆÕ-çöœ+jfK:¹£Ãm?÷cöYÛR/¹²>àóú}G¿Ÿ£t<„‰ý­U}ŒôE#šçÒ/ˆ6‹hXœ…WTWÝ5ªØañšíÛÖì-ÄÅ;eAâÒ‡‹Ê1ûª©ñ¾Ü2V I"—>FÀF‹ØDÁ1ÁY¦r°Ûd½7ö¼Ÿ:ÈH,…ÒÑ6í»+@æèr”^èúh“Xz÷ñ­öΟ.¨BeäýèÁhØÞ°aéhÈ;‹_Å4»'åFÆÉÒ[“N…`VêŒã7¯[Æ>ü(Åß{¨+Ð8@C­EÍ-Å+4)q á:OL¦°¤°—p pPŠœWñ²”‘u¡˜](ºæA>'É žîÞñ¯a-¬½6<4J¤Tö‚†2¾Œ³–½°¨£Äé„Þ’Gœôlø‡ª=`î3Å/ ùLK,gµaV[lŸ2—š¾©lÅìP[˜ËŒÈåžñ{sås˜²¨ÒŒªÍßÅÜOïœéúz<@áýqŠ]Ÿ¯I–×Bœ-\À| ±] Œœµ8˜/h©Ç#”y„†•#œ«ë#ÑÕðU]–vŒy:f𓞃vv}¥vcú·ä>endstream endobj 191 0 obj << /BBox [ 3111.59 5462.34 3133.84 5484.59 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝÍ Â0 …ïžÂ˜ø§v:7Ê*¨„åÀú¤@K˜€C}–ßó‹Wãpƒ+Hr¦ÖÐ4g I-¹-ïxÀ=^ ‹`" .w$ÇqeVj %s<וLbá o g!Â"²p_¹êÐG+‡…Ÿ3&Å\ñL†7¯F¼xÌ!æŽ9äÛàû=A)«sà7åœ~, [ÿív°…´Fiüendstream endobj 192 0 obj << /BBox [ 3110.01 5464.9 3132.26 5487.15 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝÍ Â0 …ïžÂÿ¤N27Ê*¨„åÀúMU‰ 8ÄÑçø=;ÞõÇ> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝM Â@ …÷9ENó7'ÜY@´ (X^ßimËžÀÅÌð…÷^2Ùtâ‚ý …Š£[ΔP• E_ßáŒG¼“¨"“'©wâˆC&©ÏNñÖV ¹¡‰q¨\ŒB9Ö¤•OÕ¡B’…2mVžzL޹’ M‚9 ’дøðhX†XËsÀ÷/Np£lQ¾@pWÏõǺíß.à{xxªi¼endstream endobj 194 0 obj << /BBox [ 3088.73 5500.55 3110.98 5522.8 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝÁ Â0 EïžÂÛqd$n”TP $Êõ %j*Ä’èYÎÿßÞôb‚ãî ìBÙÐBJQ•3¹-ïtÂ#Þ€IT‘É¢”;²ã4BàÌävyÂëºâ Å\X™Rzs¦ä „²¶)¾ìM¡ñì1ÿ¨vrÁ¦ÀZò­<><@K±tÔ”UákŽÎ(—ˆOÜ•sù±‚~ûÇ+8À^„Pjäendstream endobj 195 0 obj << /BBox [ 3044.18 5576.35 3066.43 5598.6 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝÁ Â0 EïžÂÇqìt$n”TP $ÊõI)i‹ÄâèYÿÛþ›6hÀþw¶@¢ÆœÉQ„2ÿá„G¼SA&õPª³áÐCd5 ˜RvҌץÑ%ÅȉItd#Ë#'Š3vEoLÑWSJë•§ oGí•ËÏ$¾¬˜p4Ôª ÞüñEèà ‘r´àø„€»ò.?·ۿ €=¼Jhžendstream endobj 196 0 obj << /BBox [ 2952.26 5734.66 2974.51 5756.91 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 177 >> stream xœÝÁ Â0 EïžÂ˜Øq{$n”TP $ÊõIUŠÄ’èYþß?Þt¬ŒÃî !3¹¢F3*(œ²¶w<áoˆE0®w ÇÄ“¦¢‰ŠãuUI,ae£(+¹WΑ¢7î«"iZu¡ä+‡…ç“¢UjÁCÌ”l5cæI±¤X:Zî·Ã÷?z8C$‹™ >qWÏåÇ ºí¯à{x÷+lhendstream endobj 197 0 obj << /BBox [ 2820.76 5963.55 2843.01 5985.8 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝPA 1 ¼çyAlÒnš¾@ðæz𢠂‚ëÁï›*]+øí0!3™d5rbœîp ÊT¦hFEB!M ÎGÜã±J™ýÏAqž@L„Ôp(9U¼ô•BÙ]L”Lœ[$3ç‘+6~pET*Cב˜BéþšQ­¢žñã ƒçëf¼yU´­£¥lß{à&*g|ãÆßùÇ ÆõŸ`[x(lendstream endobj 198 0 obj << /BBox [ 2693.3 6188.3 2715.55 6210.55 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 173 >> stream xœÝPAÂ@¼ó ^€ ‹ìòoÖƒh´‰‰&Öƒßïnl·Æø@fÃÀ¦cežð ÆäŠs¦„"ÁÉ´ÕñŒ'¼C Á@š¸ä ÇÄ|KÂhìNñ¶2”Ô±`§hg²ˆ’*/ ÷P˜2›?:8ÖÚ<ï¨ѪÝØ“mÇŒ{h.–ŽÕ÷[áëŽ.)Gã„/`Ü—¸þxA·ûãá¤{k endstream endobj 199 0 obj << /BBox [ 2605.78 6345.02 2628.03 6367.27 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 173 >> stream xœÝOAÂ@¼ó ^€ KÙí L¼Y> Ñ&&šX~_ÖºmM| C˜fÓ±2¸ƒcj5æL EBK¦óOxÄb ¤‰½§`8 ’S,6F¬x].)ŒbÌ”µà†bS°QË3î nžVâR¼R¨x²x3ê†)d\ÔJŒÅcÂ…Q¿¨õëÀWˆÎ)»Â'0î¼.?âwÛ?€=¼û7i2endstream endobj 200 0 obj << /BBox [ 2562.87 6423.89 2585.12 6446.14 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝOKÂPÜs N€Àã}8‰;ëÂmb¢‰uáõ}MûjM< CffÓ‰ öOx€rrC ¥PFUvJ¶ÌáŒG¼“¨"“e©=s¡É(;& ‘Xñ¶Ú¬¸‡U9û‚OU‘8®%® f8]ùóB<âG®‘ЬLx´£½Ø¾CœàJH’ñ‚»Z×ù»í¿æ?ÀÞRj$endstream endobj 201 0 obj << /BBox [ 2554.02 6441.64 2576.27 6463.89 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝÁ Â0 EïžÂÛ±ãt$n” ¨„åÀú¤¥­ŠÄ’èYþÿ;Þ´b‚Ý œ…CK¥P *7”myû3ñL¢ŠLRïàŒ}êîÔ$ÌæJx[W‚JBõÌÄ¥ò;‰-|ªŠ`RYu„Qò•ÃÂcƨ˜*4 &KäyñáA01wÌCNß¿8ÁRÎøÁ]=× h·»€ìá M£jœendstream endobj 202 0 obj << /BBox [ 2568.64 6416.32 2590.89 6438.57 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝÁ Â0 EïžÂ˜Øqw$n”TP $àÀú¤”” 1‡$z–ÿ÷W=+ãx‡+H0¦NQ£;e ™.ïí€{¼@ Á@š¹Ü9ÞF”%CSɤ ÏM% %ÆÂJERØÈÒÄå¼ðP®äÚt”7•ç/E­EÇ;‰63fž5ÅÒQs¿¾ÿ1À"y4ÎøÆM9§+è×¼‚lá 6zk¢endstream endobj 203 0 obj << /BBox [ 2598.52 6361.7 2620.77 6383.95 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝÍ Â0 …ïžÂ˜ØImw$n”TP $àÀú¸¥HLÀ!‰¾'¿gÇ›† c÷„;HR¦º`Éîd(’jÒ2¿ñ‰Xã¸-)>:M¡dÔlB.x]+Fî\¨ò`J¹ç!uâ6\(B— vòj•0óÐcpŒŠY…K‚fR^õøp˜+Æ)§„ï´p†Lž• _À¸‹sù±‚fûÇ+8ÀÞ“³jþendstream endobj 204 0 obj << /BBox [ 2637.24 6288.76 2659.49 6311 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝÍ Â0 …ïžÂ˜Ävœx$n”TP $àÀú´Ò"1‡8ú,¿çŸU5âp‡+p°H®¨R edN¦í¿p™1æ8Æ o°‰S44v§Rð> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝÁ Â0 EïžÂ˜ØIœd$n”TP $Êõq(i‹ÄâèYöÿ¶7Æáw§L%`ð9SBWHÃü'<â ±: ‰-&§8 š™$¢ gâ€×UF< £q$_*'òѸ˜†ÎÜ[G‰e]a¾ºRh> >> /Subtype /Form /Type /XObject /Length 172 >> stream xœÝPË Â0 ½{ O`âOt$n”TP $ÊõqTÚ‚Ä’øYïãxÓ±1¸ƒ$gj MK¡Œ"©%·åOxÄ$bLd™ãÎÉq@²IFgmH ¯ .tŠ €FMÅÊdeÁ}Ôkµ2Bèe5˜á”PK'Õ¤Õ ¢X?"&\ó3c™úíðý‹ΠTÔ9ãwq.?ÐmÿvØÃ Oliendstream endobj 207 0 obj << /BBox [ 2757.23 6045.95 2779.48 6068.2 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝÍ Â0 …ïžÂÛIìd$n”TP $àÀú´”” 1‡8ú,¿çŸU'Qp¸Ã”M¨DŒ!grTåB—ÿvÀ=^€IT‘)ºŒÑÙð6€z*$ “g<7S’ÑÅ-–‰4Oœ)ØÂý¨ð@Q› wJÖ8Tž{¼5£Ä‚‡è”½é1ó¤¨SÔŠeî·Ã÷=!P&ŽÜŒïôãÝúO°ƒ-<ð²k\endstream endobj 208 0 obj << /BBox [ 2788.33 5975.26 2810.58 5997.51 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝË Â0 †ïžÂ˜Øq{$n”TP $Êõi©š Äâèóã÷cÓ±2¸ƒ„ÌäŠͨ HpÊZÿñ„G¼A Á@Zx²%dâ$ar˯gÒ„ë™8Qò™4WîA,(%iŒrn •—ïŠÕÛB)ÄöÑcáÚ5c{QøÚ£‡3D²˜¹àwÓ»ü8A·ýã`/lrendstream endobj 209 0 obj << /BBox [ 2813.14 5913.27 2835.39 5935.52 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 171 >> stream xœÝOÉ Â@ ü» W`ÖGö¨‰áADB‰ð }œÀ&A¢kk¼3cϦecìp ‘©šæL EB¡hsNxÄb d‰½¦qèA27lŠiÁëzRÈ":.$UiDΓXaçt§©.ÿÞ,­Ô3žüGAð$\ |/—Õ†7Ÿ *¡X ¾#tp¥¬‘>qçïò#}»ýÏôØÃ ÀÇijendstream endobj 210 0 obj << /BBox [ 2832.06 5859.46 2854.31 5881.71 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝK 1 †÷9EN›¤ä‚;Ç…^ߎұ‚'pÑ”/äÿóX Ç;Ü@BfòˆQͨ HpÊqù§#îñ XÅÂ5–qAL•Ü0Y ”/}&QNXÙˆuf§â•£û‡ªˆF’ºŠ$¤Þ9,üê1+Z&'J‚‡ºˆZ×ãͳ¢MÑ*Ú”Íá{œ@É4sÁ0nê;ÿ8Á°þãì` Oú€lbendstream endobj 211 0 obj << /BBox [ 2845.93 5812.41 2868.18 5834.66 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝÍ Â0 …ïžÂ˜Øqw$n”TP $àÀú¤…” 1‡8ú,¿çŸUÏÊ8Þá Œ©SÔèNEBG¦Ë;à/ˆE0f.1ÃÛâšÉ“K¤ñÜfœR‡â©˜{á(”uâL!-<… 17f$Ö8,<÷˜ï ;©áÇ•¢4=^<)êµ¢NY¾÷à‘<g|㦼Óôë?>Á¶ðG»k¬endstream endobj 212 0 obj << /BBox [ 2855.9 5770.41 2878.15 5792.66 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝPKÂ@Ýs N€Caæ&î¬ ÐhM¬ ¯ï´:mM< xy„÷ølZVÆþw`LYQcJä(2™Î8œðˆ7Ä"HKö`8ô ©qJ‚'¦Fñº®J½­Ð\D:r§ 3ïŠÀ…B^u¸‘ÄÅ`¦Ó„Ið©TÇÅ `Œ«o>*êµ£îX¾¯èà ‘R4v|ã®ÄåÇÚíß>à{xÒøk*endstream endobj 213 0 obj << /BBox [ 2863.01 5731.44 2885.26 5753.69 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 172 >> stream xœÝOA1¼ó ^€¥Ph_`âÍõàŒnb¢‰ëÁïÛUÛ¬‰/ðd&3À¬VÆñ7ˆÁ˜Š¢JÎäc(dÚçtÄ=^!LjԹv†Ó1›RL®‘’áeÉ8™`Å…‚Wœ˜¼nÏ®ÄÒñ¡:¼P\²èbAǯ³¡1â”°û¥²¶8ðÆ³¾½ÐíÅÿ;ÃN ”ÅØñŒ›Zçñ‡õŸÆßÁž zj@endstream endobj 214 0 obj << /BBox [ 2868.43 5693.69 2890.68 5715.94 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 177 >> stream xœÝÍ Â0 …ïžÂÛuœd$n”TP $ÊõI”‰ 8$Ñgù=¿x׊ ö/x‚² eCkR¢ˆªœÉ­¾ÃÏø&QE&‹RîÈŽCš"S0D6J‚÷m%SJXØÈra1b9S•»¢HF®›Ž1†o*O3&Å\ñœ)¬ž¹¬3KеcNY¾ÿÑÁJKÄ7ʹýXA»ÿãœà„Ìl endstream endobj 215 0 obj << /BBox [ 2873.04 5655.43 2895.29 5677.68 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝÍ Â0 …ïžÂ˜8qìx$n” ¨„åÀú¤*M‹Äâè³üž6 cÿ„Ä L.(©2Œ18©´8ãïˆcÄ@b\£Å¡‡XLÈ3fU¥œñ¶Ê“F¬ì|äL¦•‹kãSU§j½Tx¢d+‡™§£¢e˜ÄqqÈF)¯zL<*æ)æŠ6÷Çá{\ QIʆ/`ÜÕwýq‚nûÇ'8ÀÞçl\endstream endobj 216 0 obj << /BBox [ 2877.69 5615.38 2899.94 5637.63 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 173 >> stream xœÝOÁ Â0 ü{ O`bÇIœ øQ € H”ëãVm ðˆ£³ïξMÇÊØ?á2SUÔhFEB¥¬ë?œñˆwÄ"H {-!ãЃXqcÊ’)á­iD¦äff‘Jq"W:62^ñÉ5’YèFA‡O+&ÁÒ`RŊ͆ Žüå„y¾ž<Ë¿"œànŒ/`Üù»þßmÿ2üöðMài`endstream endobj 217 0 obj << /BBox [ 2882.91 5572.52 2905.16 5594.77 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 173 >> stream xœÝPAÂ@¼ó ^€,Kwá&Þ¬ÐhM¬¿ï¶f·šø@† 3À¦p|À„S WÔhFEØ)i«Ó x¦ ‚LšCÉ™N#ˆ™’ vÅ™{ýì,bVЧ]Ⱥ‚]‰cÃCp'ö•áI´ ¬pq(­“:ÃU +iü°xãÙ¢.QuǪð}Ågˆd1…ŒO¸+qùñ€~û·8À^ýkjendstream endobj 218 0 obj << /BBox [ 2889.04 5526.13 2911.29 5548.38 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝK Â@ †÷9ENóš× wÖ…(Z¬ ¯ïhµSĸ˜ ßOòç±êć\A9 G·œ)¡*Š>ÿã÷x&QE&ORcâˆãš S‰‚%Ò€ç…âJ&X9È“#yD-\ÒÌ=T%Ú2£åæ0óÔãUñQ”$csÐLì‹÷Цxg´¹'‡¯=z8‚Q¶X]î ¸©ïôãÝúO°ƒ-<Ë k0endstream endobj 219 0 obj << /BBox [ 2896.25 5475.84 2918.5 5498.09 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝÁ Â0 EïžÂ˜ØIc{$n”TP $ÊõI)m#Ä’è}Ùß?Þ´œûÜABfò„)š‘¢HpÊiy‡ñX%årkÈ8ô æF¬Ø$ËäŠ×Jq¡P\<E9ÛÈJÑî@œ…RSUp¦Æ+‡™§ïŽY)ÁWUÒ\͘xì˜S|*ÖÜ“Ã×?:8C$‹¹hO`Ü•sù±‚vûÇ+8À^’élendstream endobj 220 0 obj << /BBox [ 2904.7 5421.57 2926.95 5443.82 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 172 >> stream xœÝOK Â@ Ýç9AL2é|N ¸³.<@Ñ‚ `]x}Óê <‹ÉðÂûeÓ‹ ޏƒr*†r¦„ª\(Zû§ñL¢ŠL–ÄgâˆÓZ8Rì,¨K¯ëE¢äfEœ›gÈŒ;ÊÚðà eÊyÅÐŽ8¬ž#Ág¡iéÙ 4•UÄÏŠZ¢2jÉêðuÅg”C”„OÜù»ü¸¿ßþëýØÃ uiÎendstream endobj 221 0 obj << /BBox [ 2914.21 5363.42 2936.46 5385.67 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝË Â0 †ïžÂ˜ø‘×HÜ(¨ H”ë7-$‰ 8ØÖoùÿâxÓ±1¸ƒ¸À” MS¢ˆ".S°VÇñŽXYä’£ 8 ™±¢×hä ¯ëNq3JG‹NJÑÏÚ“jÓ}qh¡®tA}M/u1¼;!“%l€Pȶzá¥gCÝ¡NÔ+àû=œA)iàˆO`Ü•¸ü8@·ýÛ`j`endstream endobj 222 0 obj << /BBox [ 2924.7 5301.58 2946.95 5323.83 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 172 >> stream xœÝO[ 1 üÏ)r‚˜¤ïþ¹~x€Eׯo¶ì– žÀ¶L:3™Ù â§]×h`endstream endobj 223 0 obj << /BBox [ 2935.95 5236.31 2958.2 5258.56 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝPKÂ@Ýs N€ÀÐaæ&î¬ ÐhMÔ…×wÚ:mM< ¼÷ølZ1Áþ wPŽBÙÐBJä¨Ê™¢ÍõqÂ#Þ€IT‘É\JvŽøèAspJ5'3¼®:RƒšM‰e€q4Í…È>ã® QlÅ(UÓbPá4aÔŽRH¸„DV#&<(ê•1oýqø¾¢ƒ3J!Šã w%.?ÐnÿöØÃ%Zjrendstream endobj 224 0 obj << /BBox [ 2947.81 5167.98 2970.06 5190.23 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 171 >> stream xœÝOÁ Â0 ü{ O`âÄMì øQ PA%$(ÖoRš*HLÀöξóÙ»ž…q|Á¼‹L&(A•zluºààˆ½GG’8çä"N#x£°ãdÄŒ÷¦£Bœ·YHµ`¥Àk1«xÈŠ(Í8*±4òŠ? ½v„œà*FÖ,_`!W÷u¾»j¿Ïà ™bv~ã!ÇíÇçýþÿ>?ÁfØŒhDendstream endobj 225 0 obj << /BBox [ 2960.04 5096.88 2982.29 5119.13 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 172 >> stream xœÝOÁ Â0 ü{ O`l'ØÉHü(¨ H”ë7Qi(ðp¬s|ç»M'Qpx”M(GŒ!%rTåL[ÏxÂ;0‰*2E—ò:Žh®Típ"¼­&ˆ‹Z6#©ÐI¥@k¸/7Ò°ÚHLÁW žOTF›hõÝ8'JŸ3¬û³…å»Y~³¿#ôp@)˜8¾@p_êú#}·ûÏôG8À7 hæendstream endobj 226 0 obj << /BBox [ 2972.57 5023.33 2994.82 5045.58 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 173 >> stream xœÝÁ Â0 EïžÂ˜Äqœx$n”TP $ÊõqÐ"1‡ÄzÖ·¿ÿª‹q¸Á8h$”T+dF*Ÿ:p™1”è ŠãlEH sH^3ž—£Ìè\I“³$Ru®ÉMö>0¹êB`LËù†OƒIÿn°Q2œÇ9çyÿ '};  ÚmÁw„ލ&ïqãïô#}·þÏô;ØÂŠiªendstream endobj 227 0 obj << /BBox [ 2985.15 4947.53 3007.4 4969.78 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝK Â@ †÷9EN“Læ‘î¬ P´ (X^ß>è´ˆ'p1¾ŸäÏc׈ v/x‚rrC ¥PFUvJVÿþ‚g|“¨"“ebæ„}ê%g4…RÄûFI†TuR9SI#'ÒR¹…À,¬*G²RVž{L‹(:®ædqÓcæÖ)–Œ:÷äð½G WTB’Œo< ïöãÍþOp‚#|‘Ñlendstream endobj 228 0 obj << /BBox [ 2997.73 4869.73 3019.98 4891.98 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝPË Â0 ½{ O`ì$ ¸Q PA%$(ÖoÒ–¦BLÀ!‰ÞÓû8Þµû<ÁqJƒ7#Eç8Q ë;\ðŒ`ç)¨ä[9âЃK)k fLñ¾eJ=³'Ë01eO†V„ÜgñEXbĺ XñT19FÒ„5A¥T׎Ç2ÄLÔç€ï_tp…¬÷Qß xÈçöcíþop‚#Œ‘Ìjöendstream endobj 229 0 obj << /BBox [ 3010.27 4790.04 3032.52 4812.29 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝÍ Â0 …ïžÂÿ'™‰åÀTB‰r`}RHC‘˜€ƒc}Öó‹ßª“ 8ÜáÊ.”K‰"ªr&­G<à˜D™B”òFv0%I ‰ãe9qRÃÂNf……Éba²Ü¸/êÖ …1ùÂ`Æ×“þ=ˆÙI°mÇ\BøÇ¿ò¤¯4E½p6øŽÐà Œ’¹D|€à¶ÔùGúnóŸé÷°ƒ'x>h"endstream endobj 230 0 obj << /BBox [ 3022.64 4708.51 3044.89 4730.76 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 173 >> stream xœÝPÁ Â0 ü{ O`âØÄéHü(¨ H”ë×QI(ðHœ;ÝozVÆñ ˆ!1uŠ*9“aŒ¡£¤­Ng<áqŒHý¶pABTÚ&tÒµ‚·ãÕСgr™²:!³†7ˆ¿d¥ÐH]þT¸t(†Æx§¢¨ìÓɪł‹£QmêwÂ÷/¸€xdbÃ0îý\, ßýíŽp€Ѽjendstream endobj 231 0 obj << /BBox [ 3034.92 4625.19 3057.17 4647.43 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 172 >> stream xœÝPÉ Â@ ü» W`|ì• øA$$Úg—°› Q{4–g|lzq‚ãî „:‡ÎR¢ˆªÜQp §ñL¢ŠL.JΑN#[ ”¥!£ ^W'd S— ÷äµð@ì²Â ‰¬:¼'õ+‡ÊçoE­HÁÅAcÁeÆÌ‹¢nQ;ÚÞ‡ï;8ƒQ² Ÿ ¸Ëqùñ‚~ûÇ/8À^Ý¡j4endstream endobj 232 0 obj << /BBox [ 3047.04 4540.07 3069.29 4562.32 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝÍ Â0 …ïžÂ˜ø§N27Ê*¨„åÀú¤@J˜€C}–߳ߪgcop Δ MS¢ˆ"!“ÛòOÜ㱲ȥÆà8 ÁeGë:&ÁsÛpG sa/Rž9Ç…‡¢p%ÑfÂ#ijžW<ï†9±áÇÀJŒÜ¬xñ¬¨GÔ‰zduøJ1À”’z1¹㦼Óüýú_óï` ¸ži€endstream endobj 233 0 obj << /BBox [ 3059.06 4457.01 3081.31 4479.26 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝÁ Â0 EïžÂ;vãd$n”TP $ÊõI)i‹Äâè9þߎ7­˜`ÿ€;ŽBÙÐ4%r 3E›ïá„G¼“„€LæR¢sÄ¡åÈ”šÅD¢x]e\)`Áf|(è¤VØ‹Qž¹+o(4ëŠLšƒŠS‡· f”Øq1he]µ˜xTÔ!jÅ<õÇáûœA)iÇ'îʹüX@»ýÛ`/éÕjBendstream endobj 234 0 obj << /BBox [ 3070.98 4454.76 3093.23 4477.01 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝÁ Â0 EïžÂ;qbg$n” ¨„åÀú¤*i‹ÄâèYþßþ›NT°Âg¡¢¨Ñ CàBYç8ãïÀ$! “šÔjœqè!²*¨š¹ãmiSIXшuäD\*{ ‘™OUàFb«‰"eåÐxZ1*æ“\R¦ì«ŠvE›hW ¾Bœà‘<æêùÁ]}×ñ»íŸÆ?ÀÞ0ñihendstream endobj 235 0 obj << /BBox [ 3082.85 4508.82 3105.1 4531.07 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝÁ Â0 EïžÂ;q{$n”TP $ÊõIUš€Ä’èYöÿ?Þô¢‚ãî8 ¹¢F3Ê;%­ïtÂ#Þ€IB@&ÍRîÌ §"›RΨ8y‡×Jèˆ ¹Ìì$]aä¹òP&܉µuGk •2Ñ*Jfؤ$Ó…g5ÅÚQs¿¾ÿ1À"YL’ñ ‚»r.?VÐoÿxØÃ ‘Økendstream endobj 236 0 obj << /BBox [ 3094.61 4599.1 3116.86 4621.35 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝÍ Â0 …ïžÂÿÕi&@âF90@•@¢XŸ´”¨BLÀ!‰>ËïùÅ›N\pxÀ”C(;ºµ-%TåLáõOxÄ0‰*2y’r'0ÎA¡‡0©áu]iH3š0S¤‰3¹MÜP²Ê=˜m»jŸÓTƒÊóˆY°TŠ•Vb]Mxó$ødX:jÆÅàë=œÁ¨µ„OÜ•sù±€nû· 8À^i4endstream endobj 237 0 obj << /BBox [ 3106.43 4709.48 3128.68 4731.73 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝM1…÷œ‚`¡:'0qç¸ðÄDÇ…×·ÌŸ‰'pAÉGyÀÛµ¬Œý ž Á˜E9“£HhÈtÉÃÏø€@,‚Ô¹¼ ‡"‡L±H]ã}[IdŽ‘YH›Ê e®ì”ÒÂ]QˆTíÚ!Fn› ;FÅTáDIqÀLºY1bíŸo˜þçgù·‰®)GcÇ70JÜ~øo÷ÿêÿGøi6endstream endobj 238 0 obj << /BBox [ 3118.24 4827.79 3140.49 4850.04 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 172 >> stream xœÝOIÂ0 ¼û~‰c7Ë ¸Q< ‚JH Q|§4%H¼€CÍØ3ölzVÆñwð.0eE•”(¢÷.SÐõŸNxÄ8bïÑ‘F¶]Àiao|@M’(3^F…rBÃJR`2ƒ3I\ñ`QÒv¬ºØTü^1+*#”:ü8˜wlV̰Ì/'Ôv=yQGà ÖÀŸÀ¸³wù‘¾ßþgúìáRYhúendstream endobj 239 0 obj << /BBox [ 3130.06 4945.38 3152.31 4967.63 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝÍ Â0 …ïžÂ˜8vþ&@âF90@•@¢X¿nÕ† 1‡$zŽ¿÷ì]ÇÊ8¼à ÞE¦¢¨’3%ôÞŠZßñ‚g|€#öib»“‹8 ,†fÔ"¼7ó MGgÈH±Tâ\uo„Fò¡éޤ4›^"f ˜Tñc ‰¤IXäÜ¿°þבWük…® ”%rÂ70ìÜ~,ßíÿrùa˜Üh¦endstream endobj 240 0 obj << /BBox [ 3141.98 5056.63 3164.23 5078.88 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝÍ Â0 …ïžÂÛIœd$n” ¨„åÀú¸*M‹Äë{²Ÿ6DÁþ P6¡1†R(£*W²ØâpÆ#ÞIT‘)fñ?³áÐC¨TLl™rÂÛJÉJEѹÇ‘ª9§@Òð䩨*Á”‚¬ fžZŒMQ²Š‹ƒÇ”–Žó sB›úcð½Å .àB0ÉøÁ¿ëtÛ¿=Àöð·jendstream endobj 241 0 obj << /BBox [ 3153.89 5158.26 3176.14 5180.51 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝÍ Â0 …ïžÂÛqþ&@âF90@•@¢X¿)%%HLÀ!‰>ËïùÅ›NLpxÀ”ƒP64—ETåLÁÖw<áoÀ$ªÈdQÊ9à8€ï) z ™\ÆkS‰Fæ±p¦ìgNäsáà‰uå¾("§¦£(U‡ÊËŒ—¢VŒœâÇ!””©™±ð¬¨)jÇšûíðýÎà(¹ Ÿ ¸+çòcÝöWp€=L~ÈjÔendstream endobj 242 0 obj << /BBox [ 3165.91 5249.1 3188.16 5271.35 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝA 1 E÷9EN“´MÛî`ÐAÁqáõ팶Tð.Úò>ù?i6ƒxÁéwP6¡ìÑ»”(¢*g2ßÞù„G¼“¨"“RîȆóN,RrÔ˜ÔáµWiF'±„Ç…3y·p$öÇâHJÒ$# ]@ãµÅjø(!¶€ ÄÚuxób¨3ÔŠ:c øþÅgpE0‰øÁ]9— ¶»€ìá–;iÊendstream endobj 243 0 obj << /BBox [ 3177.93 5329.15 3200.18 5351.4 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝË Â0 †ïžÂ˜8vž‰åÀTB‰r`}’BÚ"1‡8ú,ÿ¿›Ž•qxÀ¼‹L¦¨’3%ôÞEÿñ„G¼#öiâ“‹8 œŒrÀ êÈ'¼®3DQ8 ™U6Ò\Ù¨ˆ÷EaZ¼W–«×â0óÔcR|2È3.ÂäҪǛ«¢MÑ*Ú”Íá{Î ”%rÂ'0îÊ»ü8A·ýã`/Ñ·k&endstream endobj 244 0 obj << /BBox [ 3190.05 5399.53 3212.3 5421.78 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝÁ Â0 EïžÂ;qœd$n”TP $àÀú¸Pš 1‡$ú_þÏŽW¨àp‡+6¡ª¨±ÊW2ßÛ÷x& ™4‹ß™ oD©͘T˜Ìð¼t倮͓£®T c`!)³îÁ£ ‹ gÅÚM¿zŒ‰Ã‰RÅFp¶¦E·î¡M1UÌSN„¯ôp„H%šd|€àÆÏéÇ ºõ¯`[x/ jˆendstream endobj 245 0 obj << /BBox [ 3202.23 5461.73 3224.48 5483.98 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 177 >> stream xœÝÍ Â0 …ïžÂ˜ø'q27Ê*¨„åÀú¤ ´EbIôY~Ï/ÞtlŒÃî !1CÓœÉQ$J6¿ã xƒ@,‚̹ÞŽ¨#ŽÍ…rÄëºâT+g’R9 U‘ +iœ¹¯ Îd²ê¡˜V3¿gLŠVIN^pqH:%^f|xR´­£¥lßÿèá JY;>qWÏåÇ ºí¯à{xQüjÄendstream endobj 246 0 obj << /BBox [ 3214.5 5517.53 3236.75 5539.78 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝË Â0 †ïžÂ˜ø'™‰åÀTB 8°>-%%HLÀ!Ž>ËÿïǪccîp ÎT Ms¦„"¡Ûòß¸Ç b d‰Ç˜‚ãmv2Á%“;ž›Œ*%Am(¦‰eŸ8’ëÂý¨Ð@^š 5ÊÖ8Tž{¼5£ ~¸Å¦ÇÌ“¢NQ+–¹ßß{ôp¥¬Î À¸ßéÇ ºõŸ`[x‹}jöendstream endobj 247 0 obj << /BBox [ 3226.78 5568.58 3249.03 5590.83 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 170 >> stream xœÝA! E÷=EOPiéP8‰;Ç…˜è$&š8.¼¾@‡…'p?úÛßÝÈÊ8¿à âSRT#ЏDA¿º\ðŒpÄ"èHóm.à2ƒ)–a°”å¾qT2C/^(jáH‰ [ÑÆS6¨P²®B˜»ë„jhZÒm ÌÑÐM¨Xê[„õ¿^Ý}þ ®à)úÀ†o`<äsû±ø¸ÿ»ÅOp„·Ígzendstream endobj 248 0 obj << /BBox [ 3239.11 5616.45 3261.36 5638.7 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 173 >> stream xœÝK 1 †÷9EN›G_'Ü9.<À ‚‚ãÂëÛql©à \4å ùÿ<6ãô€;ˆ LÙÐ4%Š(â2kÿ|Â#ÞÀ‹ #‹\btç TŒÉ ú ‘|Âk—QYÔ…=q\8PÌ…½#ÑÆcQxOÚd2ë *¯-Þ‚šò‚Í€iì:¬¼ê µ¢Mý1øÞb„3(% EóÆ]y—¶{€ìá²iøendstream endobj 249 0 obj << /BBox [ 3251.48 5662.34 3273.73 5684.58 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝÁ Â0 EïžÂ˜ØIìt$n”TP $Êõq” 1‡äëYö·ÿªçÄ8Þà ”©K˜b)d(:Ò´ètÀ=^ ‹` dì¿Åi„(9R¬æ¢xn …² £QÎÎEHÕY]yáÁÔH­é0¦"ÃÂÏóD­h¡ØáÇAInv¼xž¨WÔŽ÷‘Õà+ÄGˆT¢²á7þN?â÷ë?¿ƒ-<™jiÒendstream endobj 250 0 obj << /BBox [ 3263.91 5707.14 3286.16 5729.39 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 173 >> stream xœÝOÁ Â0 ü{ O`b;‰Ó øQ PA%$(ÖÇ¥J(ðˆ£;ÝÙw›ž#ãø€;HÈL]Ĩ¥¡Hè(ÇöO'<â ±ŠÆ>-dœFPɉŠb2.$†×#Jªè¸£®ÌØÜëØ…ØðàŽâ»W‚IÒjAÅˉ·¡2J‚Íïq=ÕçÀ‚g}P-ôâÿî0Àԉ̆O`Üù»ü¨ßoÿ´þöð^ÜiŠendstream endobj 251 0 obj << /BBox [ 3276.34 5751.54 3298.59 5773.79 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝPAÂ@¼ó ^€ ìÂö&Þ¬ÐhM¬¿ï¶¶uM| C˜`Órdìp ÆÔDŒš39Š„†,®u8áoˆE0Pt.ÙƒáЃŠgÃä&d†×ºãäŠ*Y¨8%w¦ì#ö¢±â®0¡¤ÕDcd¹RXñä11æNr2ü$¥h•Å„e‰ebYrø¾¢ƒ3(e5v|ã®ÄåÇÚíß>à{xÔ`k*endstream endobj 252 0 obj << /BBox [ 3288.88 5795.73 3311.13 5817.98 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 172 >> stream xœÝÁ Â0 EïžÂÛId$n”TP $àÀú¸´M+Ä’øÙúÿÇ›V¢`ÿ„;(›P‰CΔP• Y¬ïã„G¼“¨"SLâwbÃGA‹×›ÌFÙðºêˆ›*:ÇÁÜÙÈE!0WèÀ±ªÕ¸Ê"¯<|sG† êJ"k¦€ :¨ùóxùñ(ÿÚ ƒ3ÊÁ$á w~.?–o·¹üöðÑhðendstream endobj 253 0 obj << /BBox [ 3301.41 5839.82 3323.66 5862.07 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝM Â@ …÷9EN“Iæï‚;ëˆëÂë›V¦­à \Ì ß#ï%“M'&Ø?á“P54-…2†À•’ÍïpÆ#ÞIB@&Ëâwæ„Cª¬¤c‰L5âm­$bAçìçä ÑYEùäÉëª"e[%Ì<õM±H¥à’`“¾ôøðèhS´Š6eKøþÇ . T4IÆîü\¬ Ûþñ °‡7KŠjÄendstream endobj 254 0 obj << /BBox [ 3313.99 5883.71 3336.24 5905.96 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝPË Â0 ½{ O`ìØIœ ¸Q € H”ë“Vm(pðçY~ÏŸM'&Ø?á“P14u§Œ!p¡d-g<â˜$d²,ÕgN8ô *‘Š`ôb䊷u¥T L16bq$‘†O•¡UÛWj¤a¥Ðð4cbÌ/”36÷HI?3f<2æ-ZDzå¢ð}Ç . 5I’ñ‚»j×/è¶ü‚ìá Â"k@endstream endobj 255 0 obj << /BBox [ 3326.62 5927.13 3348.87 5949.38 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝPK 1 Ýç9Al>MÛî@t@Pp\x}çc‡ žÀEÞã½—4›Ž±Â$8S14Í™Š„BnkÎxÄ;b d‰Ç7Ç¡UÉ cÑLâxkSRA ò<áDæN”âŠO£Ã„27 s*±I¨x™1;*£4 >R(ÄfÄ‚'C]¢*Öµ—€ï_œàJY¾€q7ÖõǺíßà{xhïj¸endstream endobj 256 0 obj << /BBox [ 3339.26 5969.84 3361.51 5992.09 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝÁ Â0 EïžÂ;Ž“x$n”TP $àÀú„Ò– 1‡$z–ÿ÷WDÁáWœ„> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝA 1 E÷9ENðm’NÚ9àÎqá^ßÒ±‚'pÑ”òò7ƒDáéAwÒà‚>r´œ‘X5ôð¸þó‰|£Q倘¤Ôœç‰Ì:C/ìAÎ×¶‘àÎ…3BWØY »£•Ç¢ð ÉÍDR˜6+/+AmHBùc ë›o^õˆ:Q¬_)F:“!›Kâ' ïÊ»üÈ?lÿ5ÿöôdDiendstream endobj 258 0 obj << /BBox [ 3364.73 6051.73 3386.98 6073.98 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝPK 1 Ýç9Al“6iO ¸s\x€AuáõmG;Uð.ÚðÂû$Y >xœîpvê) ’2»L–z;à/àÈ3££`¾üæoˆ¨’FT§LIñüÙ1ÊŒ"Vع`c*¢‚ce6<Er•Ù)ÖÚ> >> /Subtype /Form /Type /XObject /Length 178 >> stream xœÝÁ Â0 EïžÂ;vd$n”TP $àÀú¤¥M‹Ä’èYþÿ;Þ´b‚ýîØ…²¡iJ1ÎäVßÇ x& ™,J¹#;>zP™LÑ……,àu]q²„ªI©I……Éuà4¸ÎÜEÖ»4äH©YT#FÁ§ÂÙIg΂, ‚i†Ú1ÍX ¾ÑÁ”’ºD|ஜË´Û¿]ÀöðÚ|j,endstream endobj 260 0 obj << /BBox [ 3390.41 6126.97 3412.66 6149.22 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 173 >> stream xœÝOIÂ0 ¼û~‰—:É ¸Q< ‚JH ¾OºÐ‰pˆ£{ÆžMËÆØ?áœ)š¦DEB&·åœðˆ7Ä"È"—ƒã£Õ,¤‚Κˆñº"L‰ ö"p$EµÀÔèvP§&×>o«òþÃüB(…ÑpÖK¢”W &ÜA½`ž¨'Oß:8ƒRRçˆ/`Ü•wù¾Ýþeøìá Àh&endstream endobj 261 0 obj << /BBox [ 3403.3 6161.55 3425.55 6183.8 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝK Â@ †÷9EN'“é wÖ…(Z¬ ¯ïT™:‚'p1¾ÿÏcÕ³1Žw¸$gê Ms¦@‘Ô‘ÛòOG<à±&²à#9N#¨¥5 £syà¥Í…aáŽÔ g¦œ ³‘ÉÂCQpG–› Qrm~õ˜5ãAÎøqp%ó¦Ç›gE¢VÔ)«Ã÷œ@)ka|ã¶¼óô›?>ÁvðtdjÔendstream endobj 262 0 obj << /BBox [ 3416.23 6193.93 3438.48 6216.18 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝË Â0 †ïžÂ˜ø'™‰åÀTB 8°>)-¡HLÀ!Ž>ËÿïǪccîp ÎT Ms¦„"¡[ûoÜã±²Ä5¦àx@3qD—)D=fÓ­`ž±|oÑÔ²:'|㦾Ótë¿=À¶ð^ÞiÐendstream endobj 263 0 obj << /BBox [ 3429.23 6224.05 3451.48 6246.3 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝKÂ0 D÷>…O`âO~'@bGYp€ *!DYpý¦”” qIôFöxâMÇÆ8<àâS64M‰"ЏLÁÖw<áoàˆEБE.wtÇÔ”‰ ƒ¨'Nxms$†…=IžÙHS᢫_¹/æÉ¤­ÈäCãPy™ñê¨JIÅøqO963ž;jŠZ±æ~;|ÿ£‡3(% ñ Œ»r.?VÐmÿxØÃj|endstream endobj 264 0 obj << /BBox [ 3442.27 6251.83 3464.52 6274.07 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝÍ Â0 …ïžÂ˜ø'N27Ê*¨„åÀú¤@J‘˜€C}Ö{Ïöªccnp ÎT Ms¦„"¡ÛüÜ㱲ĵ¦à8 fF\ÐÅ…JÄó²“)VΤZ9 ±WŽJZfî«#f2_(j–/>'Lúw#&Ê?öœâbÀ‹'C[¡)ÚŠ-áûˆŽ ”Õ9á7õ~Üß­ÿõþláAQjendstream endobj 265 0 obj << /BBox [ 3455.36 6277.25 3477.61 6299.5 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 173 >> stream xœÝOÉ 1 ü» W`â#qR?–¬`%$€í“eO$*àGcÍŒg6 c÷„;HHLÅÐ4gr …’Íÿã„G¼A Á@æ\§‡„Ô¢“dLR¥êx]mŠ’ªUsÓ;ÅÜãDVfÜV…3Ÿbx¬1ƒ>üq¡¤Œ‹Ü qZp/˜"LŒ9ôèð]¢…3(eMìøÆ]}—ý›í¿ö?ÀÞÑ1j”endstream endobj 266 0 obj << /BBox [ 3468.51 6300.42 3490.76 6322.67 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝÁ Â0 EïžÂ˜8vt$n”TP $Êõë–6 pH¢÷åÿíx×±2/xB ÆÔ*ªäL c -™–w¼àˆcÄ@šØï ÇD“+‚&ÌÔ(ÞkÅÈ•šäÝÕ̼¤nÜ»#+Õ>EÖ* ðÒb1¬J0ÒŒ% D­:|x6l3”ŠuÆ-àû=\A(‹qÂ70üÜ~, ÛÿíNp„ Óèjendstream endobj 267 0 obj << /BBox [ 3481.71 6321.29 3503.96 6343.54 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝKÂ0 D÷>…O`âOãäHì( PA%$( ®©è‰°ˆ£çdfìMËÆØ?à’2S54-…ER¥ló=œðˆ7HÄ"˜Èœ£zÊ8ô V”²bV ¿ëºãdƒÜƒ)Kp*:sŠêTêò£IBɇ…ÇŒPÌqÒQZGŒøN˜fø¼O#Nòï%:8ƒ†AfÇ'0îâ\~ìßnÿuÿìáÿni²endstream endobj 268 0 obj << /BBox [ 3495 6339.96 3517.25 6362.21 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝPË Â0 ½{ O`lÇu’ ¸Q PA%$(Ö'-%Špˆ£÷ì÷üÙôb‚ãî ìBÙÐBJQ•3¹Õ:áoÀ$ªÈdQJŒì8,;eE'¼¶Œ“†ŽK&ìLšg\øPñE*¤Mt¬1¨xi±VÆœX±˜PJM‡7žŸÖŠ:ãjðµÅg”‚KÄ'îÊ»ü8@¿ýÛ`/ŒLiØendstream endobj 269 0 obj << /BBox [ 3508.3 6356.43 3530.55 6378.68 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝÁ Â0 EïžÂ˜Øqœd$n”TP $ÊõI(i‹Ä’èYþÿ;Þt¬ŒÃî Θ²¢ú”(¢ˆËd:¿ã xG,‚Ž4r¹£3ð•²y‹^W•(dŒ…•|¬l­r&õ3÷E!JšW’jîâÐxÊx+ZEªrq‰¼®2&®Š6ÅÜÑæþ8|ÿ£‡3xJÞ8âwå\~¬ Ûþñ °‡µÖk endstream endobj 270 0 obj << /BBox [ 3521.65 6370.8 3543.9 6393.05 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝA 1 E÷9EN›¤“´'Ü© 0耠à¸ðúf”Ž#xmy!ÿÿ4«gÆá7dL5cÖRÈQ$U²<¿ãx…D,‚‰²sÜž Ç´¥ÎÑ´„…àeY1ªƒBbZ™XƒUÈËÌ}(Ô©äEG¯²p˜ù•1)ZÅŠáÇÁeÊúd¼yR´)ZG›²9|ÿ£‡(5v|ã&ÎùÇ vë?^Á¶ð'k˜endstream endobj 271 0 obj << /BBox [ 3535.11 6383.07 3557.36 6405.32 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝOK ÂP Üç9A|ù¼ON ¸³.<@Ñ‚ `]x}_¥}Vð.’0!3“ÙtlŒÃî !1¹¡i)”Q$8%ks<áoˆE0e®=‡„ã5SLêF‚×õÂIj4&Θ,(Uʉ6ÜWFd_]ÄHf+…†'‹7a^'6lZŒÜ?3žóíbyrQøJÑÔЦJyã®ÖåGþnû¯ù°‡ Çiæendstream endobj 272 0 obj << /BBox [ 3548.56 6393.25 3570.81 6415.5 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 177 >> stream xœÝÁ Â0 EïžÂ˜8vœd$n” ¨„åÀú˜¶J‹Ä’è}};Þt¬Œýƒ1UE•R(cŒ¡’i{‡3ñ8F ¤™ýÎÁpèARr¥ iP’‚·µRI•,:³PªöÔÒøä¦”ÓÊa…J]%4{Œ“"µ’0¶©‰8/=fþTÌS,ŽiÊ–ðý\@¨ˆ¹÷Œ;?×+è¶¼‚ìá MÌkÆendstream endobj 273 0 obj << /BBox [ 3562.11 6401.44 3584.36 6423.69 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 173 >> stream xœÝM 1 …÷9EN›Ÿ&î@t@Pp\x};ê <‹4|á½&oÕ³1w¸$gê MK¡@‘Ô‘ÛÒÇ#îñ ‰XYp}#9Žhv£¤èÆBÙñÒN‚\±r!.•…)¢r(‰-|¨Ž(¤ Yn>Xøµb2Ì“”qñ'%õfÁ›'ý|¬˜Oüø¿3àJEÀ¸©uþ¿_ÿiülá )‹iPendstream endobj 274 0 obj << /BBox [ 3575.72 6407.57 3597.97 6429.82 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 173 >> stream xœÝOIÂ0 ¼û~‰×N^€ÄràTB‰ràû$…¤EⲌ53žÙô,Œãîà2%A 1’¡÷.‘J{§ñŽØ{t$Æù6§8:³ÂQá"½®>)†.2Y,Ø(qÁJQ²"qù-Œ¤äº•CÅóŠYP¡¬Z r^I«o\5De´Ô‡¯œ!P ʆO`ÜåsùÑ¿ßþkÿìáÕáj¢endstream endobj 275 0 obj << /BBox [ 3589.38 6411.72 3611.63 6433.97 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝPK Â@ Ýç9AÌo~'ÜY hAP°.¼¾c-Ó"žÀÅdxä½—l:qÁáwPŽBÅÑ-gJ¨Ê…¢·<áoÀ$ªÈäIjMqÀBÒ‚ÑU);^×L¢"Xq ÷ŠM‰Zd¦Ð`•⺡Põh ž,¦‰™‘D)㢠öÜ,>°‡%ÃÜÐ2Î_[ôp£lQ>ApWßåǺíßà{xåFj> >> /Subtype /Form /Type /XObject /Length 170 >> stream xœÝ1Â0 EwŸÂ'0±ã&õ Ø(¨ H”ë×¥2íÀ ë%þß߻ޕqxÁ$&SÔܶTQ$ýÖñ‚g|@"ÁDZÙïš Žä’,*Jfx̉¼:±Î¬$Žì…{of#©ë¿dRÞȃ÷Y/.´Œ«7Tm3aáY¢ã“/ä›ì=\!SëßÀxðsû±s·ÿ§Op„ ÿ‚dðendstream endobj 277 0 obj << /BBox [ 3616.89 6413.97 3639.14 6436.22 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝKÂ0 D÷>…O`üIçHì( PA%$€×'ý¤‰°H¢7ñØžM+A°Â”£P̪r¦–÷qÂ#Þ€IT‘)$)wâˆ,Š“ Æ  qÆëJ±âˆhQ•r3p ЉµbWê͈ýóo‰ÔVöÊÓ€ÑP&siÈójÂă£®P+–¥çß!:8ƒ‘9á wå\~äo·ÿšÿ{xÌi’endstream endobj 278 0 obj << /BBox [ 3630.7 6412.07 3652.95 6434.32 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 172 >> stream xœÝOK B1 Üç9Al>¦í w>@ô àsáõÍCú¬à \4e†ÌLf5°1ޏƒ$gª†¦¥PF‘TÉmù§ð‰XYæ˜99N#¨« º‰’àµ' IÆÀN9>Õ©è‚¡0§R»5S²ÎaÁsÄ,hbÃ+ÕÚE¼ñ¬hG´vdsøjq„3h88g|ã6ÞåGÿaó¯ý÷°ƒè0i°endstream endobj 279 0 obj << /BBox [ 3644.62 6408.14 3666.87 6430.39 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 173 >> stream xœÝA 1 E÷9EN“6MÛî`ÐAÁqáõíLéPÁ¸Hà ÿ7ù»ATpzÁ›PVTŸEtŽ3™n}¾àÀ$Î!“F)odÃyojM%“3¼w§äz L–NÅ»p ¨ÅaL½À”rè>h\W¬†6QZÕ/Lº•};¡)¶£«ÿ;ÃWð”¼IÄ7JÝ~ÄöÿGøn9iŒendstream endobj 280 0 obj << /BBox [ 3658.58 6402.15 3680.83 6424.4 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 172 >> stream xœÝOK Â@ Ýç9AL21™ž@pg]x€¢AÁºðúN[û<‹ÉðÂûämj1Áö Pv¡ÊÐRΨʹÍwÆÞIT‘ÉBÊ vìZHîL[t“Dšñ¶ZdJ†Zïá¦J–{\•ˆ 6…F+Bdªde0ã!aP|6œI6âX"FØ ¦fÂxâ¤ÿªÐÀåäøÁ}y×åëÝ_–?ÂÞÉthÒendstream endobj 281 0 obj << /BBox [ 3672.59 6394.18 3694.84 6416.42 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 173 >> stream xœÝÍ Â0 …ïžÂÿ¤N27Ê*¨„åÀú$¨MAbIô½øÙ~›^‚àø€;(»P,%Š¨Ê™<´w:áoÀ$ªÈ¢”;²ã4‚y Ô zàŽ ¯‚0™cáDî•‹^0E]p(õuf^ÿ³R¶ûÂïþµ¾ LjØü–8¯f®ŽyƒVÑVž;|Eà FÉ\">ApWÎåGø~û—á°‡Úhöendstream endobj 282 0 obj << /BBox [ 3686.71 6384.15 3708.96 6406.4 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝM 1 …÷9ENÓ$&í wŽ  : (8.¼¾™‚xMùBÞËϪK–°À„=Q14Í™E¸Ûò'<à ˜’2Y¤ƒ‡Ô«Ä]Ëš$ðÚ2ÆLj¨^„"F6²!á¶¾Ët›¿=ÀvðS°j®endstream endobj 283 0 obj << /BBox [ 3700.83 6372.03 3723.08 6394.28 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝM 1 …÷9ENóÓIÚî@t@PP^ߎҙ<‹¶|!ï½4«^’àð€(»PI˜,g TåBž¦÷~Ä=^IT‘)…Ô;Øñ>€+E‡nÙH:¼,+™T°²S.•‹’ye©aÝćª ÖE‡ ‰/&~gŒŠV‰L\pv½çŒŠ6EëhS6‡ïàFÙ\Ÿ ¸©çücýúW°ƒ-¼Êk@endstream endobj 284 0 obj << /BBox [ 3715.05 6357.91 3737.3 6380.16 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝPAÂ@¼ó ^€ËBa÷&Þ¬ÐhM¬¿ïÖºmM|†Ì ,›–•±Àb0¦¬¨’9Æ2™Îy8áoˆcÄ@ê\^†Câl” M,SP¼®:®Ä(™˜G˜(êˆØgÜðX- iHÒbPá4á-¨¡ì¸4™’¬FLxTÔ%*cÞúãðý‹Î …hÅå Œ»—h·{€ìáJdj®endstream endobj 285 0 obj << /BBox [ 3729.37 6341.7 3751.62 6363.95 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝM Â0…÷sŠ9Á˜ùÉ$9àκðE ‚‚uáõ-i<‹$|Ã{“÷6ãð€;Hp¦bhš3% …Ü–w<áoˆE0%®w Žãš”I ºF¡,xýœ$Ê+G2­ìBA+[ ¸`_ )ú§ Ô«¿áôÁ¤Ÿ–(9®vSr^÷ÏøÖ·Mжßz8ƒRVç„O`ÜÕsùѾÛþgûìáœiBendstream endobj 286 0 obj << /BBox [ 3743.69 6323.43 3765.94 6345.68 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝÍ Â0 …ïžÂ˜Ävìd$n”TP $ÊõI”"1‡8ú,¿çŸU5âpƒ+p°HEQ%grd…Lç<à/(2c õX£ÃqqMdMD)ž—™ª¬\ÈSer¯œ”2ÏÜWE*”ó¢Â”/f~ö˜-Ã…~ 8‘¤E‹O‚6D«hC¾ ¾·èáBY,:Þ!⦾Ótë¿=À¶ðrÆj¾endstream endobj 287 0 obj << /BBox [ 3758.12 6303.13 3780.37 6325.38 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝM Â@ …÷9ENó7'ÜY@´ (X^ßim‡ žÀÅÌð…¼—7Ùtâ‚ý …Š£[ΔP• EoïpÆ#ÞIT‘É“Ô;qÄ¡K‘‰£‰“¼­+…L±²“äÊjäqäBêOU‘œlÕ2yX4žFL‚¹RJÁfÀ8¬&|x,ZÇœq1øþÅ .`”-JÂîê¹þX@·ýÛ`oÌØjendstream endobj 288 0 obj << /BBox [ 3772.59 6280.73 3794.84 6302.98 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝPK 1 Ýç9AlÒN’ž@pç¸ðƒ êÂëÛÊ´Œà \¤á…¼O³91ÎO¸ƒeÊ St'C‘ISïñX%ãòZP|ÌÍ Œ*™É¼®'J™±`'Pc`*¤h©H4<FµõÕFʲRèøãQmâJ–±+ˆKMÜ=\KоÑR6…ïLp†H• _À¸+uùq‚qûÇ'8ÀÞbôkæendstream endobj 289 0 obj << /BBox [ 3787.17 6256.33 3809.42 6278.58 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝÍ Â0 …ïžÂÇNìd$n”TP $ÊõI)ýbqôYÏÏ~›&Ä€Ýî lJĨ9“£²8ÿý x¦ ‚LÑC­Î†}ê¹41§˜ðºê¸PT/J¢™ œIÊÌ-hf%µE‘Ù)-ŽÞúOCH .ã©§Õ‚‘ëÀ|¤˜¾B´p¥¬ŸpWßåGþfû¯ù°‡Û j¤endstream endobj 290 0 obj << /BBox [ 3801.8 6229.83 3824.05 6252.08 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝM 1 …÷9ENóÓIÛî@t@Pp\x}3JÇ<‹¶|¼—4«^’àp‡(»PM˜¬ʨʕ<ÍïxÄ=^IT‘)e‰;³ã8€6 Á51UÇËRqbÅàLŃ»Hð`Qª:ó!’©–E…*‰-f~õ˜M±ŽJÅO‚ ånÑãÍ“£MÑ*Ú”-áû8Q1—ŒÜÄ9ÿXA¿þãì` Of‚jÜendstream endobj 291 0 obj << /BBox [ 3809.52 6214.79 3831.77 6237.04 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝË Â0 †ïžÂÛy9 q£ ‚JH Q¬OBI[$&àXŸåÿ÷cÓ‰på(”=zgF U9SôsOxÄ0‰*2ù$åOqÀ™yQ5PV¼®2Ž)¬r q…•«kã¾(ж˜®*2YX94žz¼-Ãd‰5.=&®Š6E«˜çþ8|ïÑÙ‹’ð ‚»ò.?NÐmÿøØÃ …jìendstream endobj 292 0 obj << /BBox [ 3615.1 6014.65 3637.35 6036.9 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝPIÂ0 ¼û~‰—:É ¸Q< ‚JH ¾OCI /ààX3òŒ'^õlŒã® Á™²¡iJQ$dr[úí€{¼@ Á@yzcp¼ Î‘‚ é(F<7ŒJ†êÂÄ^°QN;‰.x˜Ê$¹™ÐŽL‡Šç/Ee¦$Œvêb³cÆEQSÔ‰%÷ÛáûA)À¸™êôãýúO°ƒ-<újtendstream endobj 293 0 obj << /BBox [ 3278.03 5683.66 3300.28 5705.91 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝÍ Â0 …ïžÂ˜8?Ž=7Ê*¨„åÀú¤% EbIôœ÷>Û›Ž#ãð€;x'L1UÊè½3’ØÞñ„G¼#öÅÌåÎNp øld “X¤lx]WŒ4aðɦìâ$ŒXÞ¢/Þ’*ÐúgJAVÁ¦gôl¯•BÉ[\4QÒ½ê)Q›7Ç2ÜBø¿‡3Ò œñ Œ»r.?6ï¶ÿ·ùöð\Çhäendstream endobj 294 0 obj << /BBox [ 2847.56 5266.54 2869.81 5288.79 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝM Â@ …÷9EN'™4Éœ@pg]x€¢AA]x}[këžÀÅdøBÞËϪeeìïpIÆT5G£H*dºü·îñ‰X©ó=ÞzÐB؈;™ã¹Ê„g”h2™Œl1r•…»Aa™¼©*Ì)Jå0óÔ㥘3BÆøq° µªÇÄ£bžb®Xæ~;|ïÑÁ2E6v|ãfx§'h×|‚lá plxendstream endobj 295 0 obj << /BBox [ 2362.82 4799.04 2385.07 4821.29 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝÍ Â0 …ïžÂ;Ng$n”TP $Êõq” 1‡ü|Žß³ãU/Qp¼Á'¡1ªe ¥¸œÓ÷x& ™bß3'œFš"e—šø{Æsé((:™Í\HÝ]³Ré\‘ ±4¦$]ã°ð³Æ¬¨îHðcÀL%5%^< j5£6ù6øþÅGP2M~¿ƒàÆ×éÇúõß`[xòHj8endstream endobj 296 0 obj << /BBox [ 2050.76 4501.81 2073.01 4524.06 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 171 >> stream xœÝOK 1 Ýç9ALÒN“ž@pç¸ðƒ Ž ¯o«t¨à \4å…÷ÉÛŒçÜA9 åˆ1¸“¡*gJqý—ñL¢ŠLѤLã„Ë\¤ƒRrŒƒhµ¸öǹ JR,k’çO5;Q:† qnò¼Ý+½mØÈ+£É9….àƒ«¢Ðí¾æðÝ`‚3òÄð ‚»ò.?ÊÛ¿,€=¼#Ah> >> /Subtype /Form /Type /XObject /Length 71 >> stream xœÓ241TH/æ*ä2203Ô³4Q01¶°Ð3W022°Ô33ÓE© á y\z†FF z&æ†@ÒÜÀL¡(+ 'qíendstream endobj 298 0 obj << /BBox [ 1814.96 4307.65 1837.21 4329.9 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 71 >> stream xœÓ241TH/æ*ä2203Ô³4Q01¶°Ð3W022°Ô33ÓE© á y\z†FF z&æ†@ÒÜÀL¡(+ 'qíendstream endobj 299 0 obj << /BBox [ 1823.97 4337.32 1846.22 4359.57 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 71 >> stream xœÓ241TH/æ*ä2203Ô³4Q01¶°Ð3W022°Ô33ÓE© á y\z†FF z&æ†@ÒÜÀL¡(+ 'qíendstream endobj 300 0 obj << /BBox [ 1880.18 4411.64 1902.43 4433.89 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 71 >> stream xœÓ241TH/æ*ä2203Ô³4Q01¶°Ð3W022°Ô33ÓE© á y\z†FF z&æ†@ÒÜÀL¡(+ 'qíendstream endobj 301 0 obj << /BBox [ 1961.87 4507.85 1984.11 4530.1 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 71 >> stream xœÓ241TH/æ*ä2203Ô³4Q01¶°Ð3W022°Ô33ÓE© á y\z†FF z&æ†@ÒÜÀL¡(+ 'qíendstream endobj 302 0 obj << /BBox [ 2052.45 4608.97 2074.7 4631.22 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 172 >> stream xœÝOA1¼ó ^€ÐÒB_`âÍõàŒnb¢‰ëÁï۪ݬ‰/ðPšf†Y ¢‚ãn8 EîdÊ:ÿÓ÷x& ™Ô¤VãŒÓX©I)juŽ—e#‘d¬Ø)IÃ…b…9R²ÍÛ›É<·@æ úŒ›~Ûï IÄ/Á_˜¼, Þ¸1ú}£_ؾ"à‘> >> /Subtype /Form /Type /XObject /Length 172 >> stream xœÝOAÂ0 »çyAhÒ4m_€ÄqàLB‰qàûd@Ùx‡¶²e»öªcenp ÆT5–BEB%ÓÏ;pÄ"H3ûƒá8€° …ŠN*yÞyÉTÒ‚Ž$:–H&ŽÓ {7$£h J ƒÏ&ý›ðv1ál‰„çüœô­@´‚-à{BGˆT¢qÆ;0nüœ~¬ïÖÿ¹~[xˆÆhendstream endobj 304 0 obj << /BBox [ 2217.46 4783.29 2239.71 4805.54 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 178 >> stream xœÝÍ Â0 …ïžÂ˜ø§‰37Ê*¨„åÀú¤U›‰ 8$ѳü¾çxײ1ö/x‚„È” MÝ)¡HÈ­¾ÃÏø€@,‚,q¹Sˆ8ô ™ÔÑR6*¼û¶’ɼPD©4JQFíÔxÕ]q¨Ž9k‡&JyC¨zʘsÅKVƒ•¼!á5cÖ£cž¢v,S.„ïtp%×È ßÀx(çöcíþWp‚#|ÞCkNendstream endobj 305 0 obj << /BBox [ 2280.21 4845.43 2302.46 4867.68 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 177 >> stream xœÝÍ Â0 …ïžÂ˜ø'N27Ê*¨„åÀú¤ªš‰ 8$ѳìï½x×±1/x‚g*†¦9SB‘PÈ­½ãÏø€@,‚,q½SpÉB¬h9:EÇû¦R¡.•’$O:Ršè…I­é¾N§š¥uhãJhzö¨k…)â °D7³ž,–KG‹=¾ÑÔ²:'|㡞Ûtû¿]À Žð÷ÉjBendstream endobj 306 0 obj << /BBox [ 2327.07 4888.66 2349.32 4910.9 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 172 >> stream xœÝOK B1ÛÏ)æcçc;sÁÏ…} (¨ ¯oŸ–úOà¢- Iš,6ÆñW”™ÂÐÔ Š¤ lý½p‡HÄ"˜È ×»¤Œ·DÅ)Í#¨8ž?L$#¯)ªJ¬®¼OØI:ÜWƒ)Iž ¬ÍüoØ>xéaT«t»G¢eéù NúV  zåð=aGPrÍ\ðŒëzN?Ö«ÿ\¿… <7†iìendstream endobj 307 0 obj << /BBox [ 2358.83 4914.18 2381.08 4936.43 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝÍ Â0 …ïžÂÛqd$n”TP $àÀú¤…” 1‡ü|–߳ߪïpeʆR¢ˆªœÉmyoÜã˜D™,J¹#;ÞFÐàåß¡eí(à¹)¦PÌ‚¥<±Q'gʾðP±#Ö¦#fo*Ï#fA-0©áÇ@œ87#^<)êKGÝúíð•b€#JÁ%â7åœ~äï×ÿš[x.ùiðendstream endobj 308 0 obj << /BBox [ 2377.35 4924.3 2399.6 4946.55 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝPË Â0 ½{ O`Ûã ¸Q PA%$€ë“¶¤-pH¢g½_¼i£FìŸp)’+ªäL†ÌÁ)éü>NxÄŠÌH-–ÛBÂG,æÄ†êÒ ^W-\G–,T’ ÖÑuQ›qW.ÔèŠáF)¯*ž2FEÃÅ•’KÆ„EmQsïÃ÷?:8ƒP– _qWÎåÇ Úí¯à{x9Nkžendstream endobj 309 0 obj << /BBox [ 2385.38 4921.95 2407.63 4944.2 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 173 >> stream xœÝOK Â@ Ýç9A̯ó9àκðE ‚‚uáõkQð.&à êÅÇ\A9eG·”(¢*g ^ÿé€{¼“¨"“G)3rÀiµÉгqÂóÇ"‘ËB^¬³+i~â@]…¨³PÁ¹£’P žfŲÑD,ØÔ(Åñ‚EPox–ýw…ŽPh$â7å~”ï×Y~[x™øh®endstream endobj 310 0 obj << /BBox [ 2385.89 4910.39 2408.14 4932.64 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝKÂ0 D÷>…O`쉛¤'@bGYp€ *!DYp}BéOˆ°ˆ£gyÆŸMcnÜ=èNÐhR;{ÈYZKôùïO|ä©À*ž¬Ä¤‘ûŽr’lì5L*ðu‰ReF¨‹yU8ÞœD1sKp…h^*\£‹ÃÂCA1f,ŠW¼8$تLJ‹bžbª˜¦¾öhéLArˆ–øIÆ»ò.?NÐlÿøÚÓ Xæj´endstream endobj 311 0 obj << /BBox [ 2381.64 4892.49 2403.89 4914.74 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝPK1Ýs N€…2-œÀÄãÂLtM^_4cGOà¢4ð>°êYÇ\ARarEÍfTQ$9mÿtÀ=^ ‹`"­µ¦‚Ó’-SWP=e*‚çÏŽQ1 \)(ê,dØ…jmx†W²¼LhŠ8¶(,øåŒwÇܨë°)˜+ÅVÍcÆO9E›˜S6…ï=8BÉÂïÀ¸‰wúq‚~ýÇ'ØÁ&ëk endstream endobj 312 0 obj << /BBox [ 2375.25 4870.91 2397.5 4893.16 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝPË Â0 ½{ O`bÇ ¸Q PA%$€ë“R‚Äâø=ù=V=+ãx‡+HHLYQ£;Š„LI—ÿvÀ=^ ‹` 5.ÑBÂÛ͈ Õ](D<·ŒQÈ(Ñ™"œ™D'œ(ú‚‡¢(™jS‘;ê¼qXðÜcV¼K”~LÈ¥éñ“¢NQ+ê”Õá{ŽÉc*Ü7å~œ _ÿñ v°…',+k¤endstream endobj 313 0 obj << /BBox [ 2368.7 4847.58 2390.95 4869.83 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 173 >> stream xœÝOÁ Â0 ü{ O`ìÄã øQ PA%$(Ö'-¤ ðˆ­s|ç»M/*8>à“+jÌ™ C`§¤kŸNxÄ0IȤ&¥'œFјR@Í]¡ ^›IŠdE-šÎ½`#—;å¸â¡0²Röf#;±6 ¿o,Œ:‰‹ÓUAºæÄçýê¡þWÓúwˆÎ‹@Ã'îÊ»üÈßoÿ5ÿöðëGj´endstream endobj 314 0 obj << /BBox [ 2363.49 4824.05 2385.74 4846.3 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝPË Â0 ½{ O`bÇIœ ¸Q PA%$(ÖÇUi(pp¬gù}âMÇÊ8<à2SUÔhFEB¥¬­'<â ±ÒÂþ–q@bNä:j1^W $®s¥”&¬ÍqQÊÜpïŒâ>¶Ú°H&+…Ï£M<ãGAÕ²ò˜ñÄXR,-÷[áû=œÁ-bæ‚O`Üy]~œ Ûþñ °‡ÔÿkBendstream endobj 315 0 obj << /BBox [ 2360.57 4801.19 2382.82 4823.44 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 173 >> stream xœÝM Â@ …÷9ENó3M¦'ÜY hAP°.¼¾SulOàb2|á½$oÕInpej&Ë™U¹%OŸ<à/À$ªÈ”BJ vPs¥ÔbÊ¢d‚çe'È2vr+¬B)K*öÅNá AfZú+>Lúwƒƒ´ÁÙÎF"óüNúz@Ôë€ï=Á(›Kà7å~¤ïÖÿ™~[xyh°endstream endobj 316 0 obj << /BBox [ 2360.57 4779.45 2382.82 4801.7 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 172 >> stream xœÝOA1¼ó ^€ÐRh_`âÍõà6º‰‰&êÁïÛ]­»&¾À!3³êD‡;\!° E9“c\Èô3oÜã˜$dR—Ú o„h´ zaJŽçå&M.ÑŒ,ޏçŠ]ê‘û*p#·!3-õ NFþ{‘%ÁYž…¢Ïþ/8òÛÐlßz8B¤M ¸©uú‘¾[ÿgúlá MÎiðendstream endobj 317 0 obj << /BBox [ 2363.54 4758.89 2385.79 4781.14 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝPA1¼ó ^€Ð²Ð¾ÀÄ›ëÁltMԃ߷«v·&¾ÀC)C˜`Õ‹ Žw¸B`ÊŠS"Ç8“éüß¸Ç 0IȤ.%:ÞFÑ:RCugâ€ç¶Ò',¸¨L0Sá‡èJ¶à¡Jæ±éH‘’73~YLŒZ1¥Üá¢`LI7žŸ!jC± |o1ÀŠC4q|€à¦¼Óôë¿=À¶ðij¼endstream endobj 318 0 obj << /BBox [ 2369.37 4739.3 2391.62 4761.55 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 173 >> stream xœÝOIÂ0 ¼û~‰g{7ÊTP $Êïã¶JS$^À!ŽÆž{v+ãð‚'ˆ‹LEQ}ΔPÄŠºþãÏøG,‚Ž4±Õä"ŽˆOLRPS°‰Çû¶H ÓݹyÃÙQXao‚(Ä-¡ØM_á¼`æ/ ä#6¹Ú^iþ œøõ€J¨Vƒï=\ÁSö‘¾ñ`ïö#}·ÿÏô'8©9i> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝPË Â0 ½{ O`âOg$n”TP $àÀú¤…” 1ÇzÖû8^õlŒã® !2eCSwJ(2E[úí€{¼@ Á@–¸¼)D¼ š GÑ’2©á¹D* ¢®”RÁ¨ë&ìäºà¡(²’熑‚5 ž3fÅ{"‘Äñã BlMÆ OŠºEeÔ-«Ã÷?8B±ÔÈ À¸)uúq‚~ýÇ'ØÁž×ûk>endstream endobj 320 0 obj << /BBox [ 2388.14 4701.19 2410.39 4723.44 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 173 >> stream xœÝIÂ0 E÷>…O`<5à ØQ ‚JH Q\ŸPª¤Bœ€E†÷åüïxÓ‹ ޏƒrÊŽn)QDUμžÓ x&QE&RöȧÔ2S¹Qɯk%’%,ì¤U¨Ó7fÒXyuv2kΩ„4ƒÆsÄübQ8’vØØHd•ñájµ`éq1øúÅg0J$âwe]~  ßþí°‡@izendstream endobj 321 0 obj << /BBox [ 2400.11 4681.6 2422.36 4703.85 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝM 1 …÷9EN›“Î wŽ  : (8.¼¾™Ö<‹¶|!ï½4«žqxÀ$9Sghš3ФŽÜÚ;žð€7HÄ"˜È‚ËÉq@, %EóN(¯ËJPtX؉-R ÑÂÌ$ÚøX줋)!¶0hüŽ˜µ’ƒÜ±xVZË'aæI0ÏÐ:êŒÕàûG8ƒRV/š'0n˹üX@¿ùÛìa/c%i²endstream endobj 322 0 obj << /BBox [ 2413.15 4660.94 2435.4 4683.19 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 172 >> stream xœÝOAÂ0 »çyiÒv/@âÆ8ð“@bø>Ý S‘x‡¦²e;ñªt' .èŒ-æŒÄª¡ƒÛò'>ðD•,I™)8©É!±yRêÚ2 ¹à*g–tSƒæ‹C;Dk1Âr“°àyÇ䨌Ï»+²7 Þx’ת¢ž8Û¿éL9º$~’ð¶¼Ëòýæ/ËïiG/nhh†endstream endobj 323 0 obj << /BBox [ 2426.86 4638.79 2449.11 4661.04 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝPÁ Â0 ü{ O`bÇMâ øQ PA%$(ÖoBI ðˆ£»øÎozVÆñw˜LQ}JQÄ]ïé„G¼#AG9×èN#ˆJ–$Ô F&xm˜NÉŠz)/±/8¾â!+Ô“ëšÄÖ8T¼Ìx)*£”:ü8hNÆÍŒEMQ;ÖÜo‡ï pOÉŽøÆ]>—+è·¼‚ìa#êkŠendstream endobj 324 0 obj << /BBox [ 2440.77 4614.8 2463.02 4637.05 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝÁ Â0 EïžÂ˜Øqœx$n” ¨„åÀú¤*M‹Ä’èYöÿ?Þt¬Œý Á˜\Qc)”Q$8™¶w8ãïˆE0f®w†C¢*dŽj’È#ÞV•È+9ÇÊ©š5<Õdä¶j¨i˜W3OãD«*†‹eY,&æ sCKýøþÅ .©DãŒ/`ÜÕsý±€nû· 8ÀÞÞìj0endstream endobj 325 0 obj << /BBox [ 2454.74 4588.56 2476.99 4610.81 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝPÁ Â0 ü{ O`œÄ± øQ PA%$€ë“BI‹Ä<’ø¬»óÅ«.HÀáWˆ¬Š $w2Œ‘ ©´÷vÀ=^€)ĈLb¡ÞÆŠ·¢d%U”\*·àyî( YÆX ò:ya&׆û*0¦’ ËĶ0˜ð4â¥øt„4asÈ¥ÆóyÆ„GÅ;D#´Ô“Á÷/z8B"O pSÏéǺõß.`[x¾“kendstream endobj 326 0 obj << /BBox [ 2468.39 4560.02 2490.64 4582.27 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝPIÂ0 ¼û~‰ÇI_€ÄràTB‰ràû$]Ò"ñq4#Ïxì]ËÊØ¿à 〈QTŸEq ™Ö¸ààˆEБFÎ5:áÑèÈ3jˆLð¾eŒ„1c% §Ì[Á ©¸ËФÒ¦£Äð‡ŠÇ£bfÌÈ%\¦EÖ.Š%Eí˜S.ß{tpOÉG|ã!¿Û´û?>Á Žð¤Zkendstream endobj 327 0 obj << /BBox [ 2481.74 4528.97 2503.99 4551.22 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝÍ Â0 …ïžÂ;vâd$n”TP $ÊõIi‹Äâ賟Þ¦p‡ÀI¨šæLŽ!p¡dó?žðˆ7`’É\jtN8,+¥„­ÖñºND’„•ò„…´R ”½a_åÅ©è\ˆ}é^x_õsB#±áÒ¯L¹¬¼yÚð9  Ú}mÀ—Π”5‰ãwõ]~Xï¶hý{xî)gÜendstream endobj 328 0 obj << /BBox [ 2494.73 4495.37 2516.98 4517.62 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 172 >> stream xœÝOÁ AüS °ÀîV`âÏóaFML4Q¶ïÝéÞib>€ 0³èÄw¸‚rUCK¥PFU®6ÕÛ·x&QE&ËÒçÌ·#¨Õ p4ç ÇóGC„> >> /Subtype /Form /Type /XObject /Length 173 >> stream xœÝOÁ Â0 ü{ O`b;q’ øQ PA%$(Ö'i•¶HLÀÃqîtgûv{ÆáOgLÙ£×”(¢ˆËd~éãÏøG,‚Ž|äòFg8 ¡h8¡/,IÀû–1RA ¬¤Zp*^«8‘æ÷Å!Z«B"Ùf@ƒÓ†I?fÄW» ¹°Y0ãjh'4E;±MøÑÔ’G|ã¡ÔíGþnÿ¯ùOp„ɲi„endstream endobj 330 0 obj << /BBox [ 2519.44 4459.16 2541.69 4481.41 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝPAÂ@¼ó ^€, K÷&Þ¬ÐhM¬¿ï¶¶uM| C˜a`Ó Ø?àÂ)PVÔØ4ä(™’®u8áoÀDI=”ìœpèALÅ„ªÎ$ ^ëŽQ,*&F6ÂLš ŒLæ+î !¥XOdr¯V<­˜s'O…r{µãGÆlbX<.ßWtp†HMLÁñ w%.?ÐnÿöØÃ îcj*endstream endobj 331 0 obj << /BBox [ 2531.31 4481.71 2553.56 4503.96 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝOK Â@ Ýç9Aœ|f2sÁuáŠëÂë;•v¬à \$á…÷òò6ãð€;HHLÅÐ4gr …’µ9žðˆ7Ä"Èœk÷p@¢*‰¢Yʆ×õÆ©`…Nêh1…z4šiÃ}˜S\"O®MßàÛ`â/›ì䎋޲RÒÁŒ'ÁüBc,.¾3ôp¥¬‰ŸÀ¸«uù¿Ûþiüìá ˆiNendstream endobj 332 0 obj << /BBox [ 2542.97 4518.9 2565.22 4541.15 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 173 >> stream xœÝM 1 …÷9EN“4í4'Ü9.<À ‚‚ºðú¶jµ‚'pÑ”ïñ^~£˜à|…3('!7´3 ¨ÊNÉÞÿe‡[<“¨"“ RêÀ /3h4£ìh10±â±W"±ca'•4ŽVõÆSID'I# ]ƒ† ÕÿÔÈ~âÊ”µðäh+4G[±uø>b‚=Ê!É€7\•wøqÿ¸ü×û7°†;Þti˜endstream endobj 333 0 obj << /BBox [ 2554.43 4563.75 2576.68 4586 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 177 >> stream xœÝÍ Â0 …ïžÂ˜8‰íd$n”TP $àÀú¸…”"1‡8ú,¿çŸUÇ™q¸ÃbP¦š1§RÈ0ÆPIóüß¸Ç â1P6öhAñ6@QJ.ËT ž—™JU0Šº¦:—L¡Ž,$2sï ¤¼¨p/Ó…ÃÌSIñÎh¥ñãàÞj‹/mŠVѦlß{ôp„D%)>€qãïôãÝúO°ƒ-<tëkìendstream endobj 334 0 obj << /BBox [ 2565.78 4610.91 2588.03 4633.16 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 173 >> stream xœÝOK Â@ Ýç9AœdÒdzÁuáŠuáõMk‚'p1^xŸ¼MÃÊØ=á’Œ©VÔ\ 9ФšLçÿqÂ#Þ ‹`"uŽéÉðÑTæ!Q¡¤x]-œ˜Q*g*am™IªÕ<ã6%Â}Å(Ö+‡ƒbÜpx\X¨äUÆ÷ŠéЉ19|•há 9hÆŽ/`ÜÅ»ü¨ßlÿ´þöð'_idendstream endobj 335 0 obj << /BBox [ 2577.14 4656.59 2599.39 4678.84 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝPÁ Â0 ü{ O`b'±“ øQ PA%$(Ö'¥mðˆ£³}w¶7Æáw§L9`ð)‘¡ˆË¤¡þã xG,‚Ž‚q‰æÇ$Z&1¨•µɘ%”˜<É•²L0‘hÅ}!dO¾íÈVLÏoÆšÒˆ…˜(rã1㉱ ±6Ô©ï-z8ƒ§ä• ŸÀ¸+ïòãÝöop€=¼¾ëkendstream endobj 336 0 obj << /BBox [ 2588.49 4698.38 2610.74 4720.63 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 171 >> stream xœÝOKÂPÜs N€ÀãýN`âκð61ÑĺðúÒšöiâ \™fÓ‰ ¸ƒrª†J¡Œª\)ÙZÇñL¢ŠL–Åsæ„ã«3‚–}6âõƒ£èb±zvm™°‹êŠ{ÐÄF©´‰Ä…Š6…Ï'æ……02Ã&ÀLáã {h/,ýåå÷ú·…Ψ„$Ÿ ¸ó¸ü0ßmÿÒüöð’"hŽendstream endobj 337 0 obj << /BBox [ 2599.9 4734.85 2622.15 4757.1 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝPË Â0 ½{ O`l'µ“ ¸Q PA%$(Ö'Uipˆ£÷ì÷üÙôÇÜAÙ„rÄR"GUÎd±þÓ x&QE¦èR¢³á4‚ %Åè±£ìxm˜Nˆ‹‹qÉØŒ;’T°^+ŠBŒ87ʤ¡qXñÒcVT†) ~‚‘{ÓcÁ³bb­¨s¿¾÷à R0q|‚஼ËôÛ?>ÁöðW‘jÊendstream endobj 338 0 obj << /BBox [ 2611.41 4765.44 2633.66 4787.69 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝÍ Â0 …ïžÂ˜ØNìt$n”TP $Êõ›ªjpˆ£Ïò{þÙõÇ> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝA 1 E÷9EN“&¦í wŽ  : (8.¼¾­vÊžÀE^úó›¿ÄÇÜ!° eCÓ”(bœÉ­×鄼“„€L¥Ü‘§‚£”Ð iÄë²ãdŠ…3±¦uqw5âÜùX&4“øBaJº0˜ñýCÕ1;Õç6s¨µû7®ú¶AW´ gƒïG8ƒRR—ˆOÜ–sù‘~Øügú=ìàb¿iendstream endobj 340 0 obj << /BBox [ 2634.63 4809.63 2656.88 4831.88 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 173 >> stream xœÝPA 1 ¼çyAlÒ&m_ xs=ø€Eõà÷mW»UðÚ0Ãd&ÉjàÀ8Ýá âŒ) >%Š(â2YXêí€{¼€#AG!rù£3¼M æT1$)œâù“QJ‚bÁ‘åŠ3e«X«²á±t¨«Ê®ÐPkwXðœ1w¼ÖêݘkvÏxáÚѦhŠ6esøÞc„#xJÞ8â7å~œ`Xÿñ v°…'?k¤endstream endobj 341 0 obj << /BBox [ 2646.39 4824.36 2668.64 4846.61 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝÁ Â0 EïžÂ˜Øqw$n”TP $àÀú¤”” 1‡$z–ÿ÷W=+ãx‡+H0¦NQ£;e ™.ïí€{¼@ Á@š¹Ü9ÞFS§È¨©ã¹©h ”P, išXɺ‰3%Yx( JÞt˜Q–Æ¡ò<㥨•’Gðã FâÍŒ™'EMQ;–Üo‡ï p„H3>€qSÎéÇ úõ¯`[xÙkxendstream endobj 342 0 obj << /BBox [ 2658.26 4835.2 2680.51 4857.45 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝÍ Â0 …ïžÂ˜ø'q27Ê*¨„p`}RJK˜€C}Oöó‹Wãp‡+HHLÅÐ4gr …’-ïí€{¼@ Á@æ\o oHJUÏhÙ©â¹Q"“¬l¤2r¤h#Ò¼p_;ÜÈbSá™bifžf¼:f…I?ê5e3câ±cN±T̹ßßÿèáJY;>€qSÏéÇ ºõ¯`[x&XkŠendstream endobj 343 0 obj << /BBox [ 2670.18 4842.77 2692.43 4865.02 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝA 1 E÷9ENðmÚLšž@pç¸ð¢‚‚ãÂëÛA:3‚'pÑ”òò7½¨ðð¤Å`‚¢¬É™c ¦ó?žùÈw 9@³Ôšƒñ8P´ «w …o놣W6Äêí– RÙiÆS¸!Ùj t²2˜yÚ0 ZC®¼¨Âʲდ ÐÚ‰Íà+É.”àÉ$ó‹„wõ]¤ï·ÿ™þ@{zúi´endstream endobj 344 0 obj << /BBox [ 2682.2 4847.89 2704.45 4870.14 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝÁ Â0 EïžÂ˜Øq{$n”TP $àÀú¤P’"1‡ÄzN¾¿ÿªgeïp ‰É5šQF‘à”´ÖÛ÷x@,‚4s¹sHxA’)1£ZçÏ‹NR †…$M\ªöHQ*EáFÑÛ„ºØ&T~{EëDòÛu²…Å '‡Ïó{]z–‡à‘,&ÎøÆM9§ùûõ¿æßÁžŒƒj^endstream endobj 345 0 obj << /BBox [ 2694.27 4850.96 2716.52 4873.21 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝM1…÷œ‚ д'0qç¸ðÄDuáõíüÚOà¢4y> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝPAÂ@¼ó ^€ Ë}‰7ëÁ4ÚÄDëÁïÛÖ¶ÖÄx2„™65+cû€;H2¦JQs9ФŠL—Úðˆ7HÄ"˜HûìɰkA<‰¡†e*‚×u'¨гP¯.ä2@'µ7=A„J^Mˆ‘ùJ`Á£ÅȘ:%H ~ŠRæ•ÇŒi‰y`Þqø¾¢3dŠlìøÆ]—¨·û€ìáN(jšendstream endobj 347 0 obj << /BBox [ 2718.51 4852.54 2740.76 4874.79 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝÁ Â0 EïžÂ˜8vmw$n” ¨„åÀú¤¥ŠÄ’è}ù;Þt¬Œý“1µŠ*ä˜sjÉ´¾Ãx‡Dœ3&Rçr{2zÈž‹"¨aBæx[+%L°°Rã…=SÄÈSê§â¥u…®*O-&ì4AÆX%µU‡†e†Z1ϸ|ÿâ 1v|㮜ëtÛ¿]Àöð¸9k endstream endobj 348 0 obj << /BBox [ 2730.69 4851.42 2752.94 4873.67 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 173 >> stream xœÝPK 1 Ýç9AlÒ´Éœ@pç¸ð¢‚‚ãÂëÛ*+xÉã…¼—Ïjdeœîp ™iPÔèN†"a ¬ ÎGÜã±Rã’-dœ'‹B™Q= %ÅK_±Š…g²T¸qE1er^ø¡(4“{ב˜‚t ͨŠVIFêøqH‘¢v3Þ¼*Ú­£mÙ¾ï8À "yÌløÆM‰óŒë?~Á¶ðêukVendstream endobj 349 0 obj << /BBox [ 2742.91 4849.07 2765.16 4871.32 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 173 >> stream xœÝOÁ Â0 ü{ O`llj“ øQ PA%$(Öo J)ðˆ£;ß|›NLpxÀ”“P1´39ªr¡dË?žðˆ7`Ud2—:ލ›Qh9Õ}Á뚉¤+ÎT|Æ…j¨G#¶ûª…ä³NÔVî¿òg}cb$ ¸ø#SÉ«ü7ž 퀦h¶€ï =œ!T"‰ãwõ]~´ï¶ÿÙþ{˜Ti²endstream endobj 350 0 obj << /BBox [ 2755.14 4845.48 2777.39 4867.73 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 172 >> stream xœÝOÁ Â0 ü{ O`bÇ±Ó øQ PA%$(Ö'-m ðˆ­s|w¾MËÊØ?àŒ©QÔ˜39Š„†L×>œðˆ7Ä"HKõ`8ô žœBBÍÉȯդˆZQóÒe„‰²ŒÐHlÅ]!8S¬7<“J`Áo‹‰±L˜R‚:ie1Áq>aþ^OžÙß:8C¤ŸÀ¸+ïò#}»ýÏôØÃ ôƒi˜endstream endobj 351 0 obj << /BBox [ 2767.41 4840.57 2789.66 4862.82 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 172 >> stream xœÝOAÂ@¼ó ^€ Ka÷&Þ¬ÐhM¬¿ï¶ºÍšø@†ÌÀ̦gep Æ”5¦DŽ"!“é:§ñX©sé §Ä-SŒ¨©ã"½¶ #7÷X$[ Ì3NÔ銇¢H‘¬!$'׿ÀŠç ÿ³P[lV½ in¼ñ,¨*£Z¬¾2 p†H);>qWêò#}¿ýÏôØÃ bØjendstream endobj 352 0 obj << /BBox [ 2779.74 4834.18 2801.99 4856.43 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 173 >> stream xœÝO[ Â@ üÏ)r‚1Ù;N øgýðE ‚‚õÃë»-¥[Áø‘ “ÍÌdvšòð¢'9‰Šbl>g$vN ¢­}¼ð™$PçX`Ië›$ò8KY#[¶Ï÷Í |K9 OдÂ"ÈqÅ}%”€âÛF¤&°âÙ¡Ú@àŒ›€Ø:Ìp2X.X¾×ƒöW€ž®äQW5ñ›”µn?¢wû?Œ~¢#}3Rhendstream endobj 353 0 obj << /BBox [ 2792.07 4826.1 2814.31 4848.35 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝÍ Â0 …ïžÂ> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝPIÂ0 ¼û~±gé ¸Q< ‚JH Q|¿ %%H¼€CÍÄ3žxÓ‹ ޏƒrê Í¥DU¹£`ë=ðˆ7`Ud²(¹F8 ‰9AKÉ<^Æ)yEMÂå%ã@!ì _ñÊäSÓ¡FQ‡Š—/Ee”\‡I¤¾™±à¢¨)jÇšûíðýÎà(’ˆOÜåsù±‚~ûÇ+8Àf˜bkendstream endobj 355 0 obj << /BBox [ 2816.82 4804.62 2839.07 4826.87 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 173 >> stream xœÝPIÂ0 ¼û~±Í}7ÊTP $Êï7i›R$^À!53^v­xÁþOPŽBGïÌ(¡*7ýŠÃÏø&QE&Ÿ$ÿ‰#=¨I¶d«I(xßT”ÉPM•Ì õÔ„ÂSÁÊ»lpŽX6 —HÂ' Ò¹Ãd¨¦8)–Žü¦ÅÌ‹£QëÔKÂ÷\Á‘¹( ß xÈïöãíþop‚#ŒUãj¨endstream endobj 356 0 obj << /BBox [ 2829.25 4790.91 2851.5 4813.16 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝPA1¼ó ^€@ÙB_`âÍõàŒnb¢‰ëÁï[×MW_à’™Ì ”U/&8ÜáÊY¨ZŠ GU.”­õñˆ{¼“¨"“¹Ô×9ã8€FG VbÃË'ã$XaGI*!­¡aL)>Tƒudö©(ÔÅÐà4a2¼/™Šc ð¢i1ã—c^¢)æ[Â÷/p‚T…¹rÜÔ:ÿ8@¿þÛì` OëEjZendstream endobj 357 0 obj << /BBox [ 2841.73 4775.16 2863.98 4797.4 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝM Â@ …÷9EN'™4Éœ@pg]x€¢AÁºðúN©­<‹Éð…¼—ŸMËÊØ?à’Œ©(jŽ G‘TÈtù‡ñ‰X©sž ‡$4“5¨Fx]e S®.¡N^FnH£r#¶pWS‘U… %[9Ì<õK†I?î”|ÕcâQ1O1W,s¿¾÷èà ™";>qWßåÇ ÚíŸà{xœ×lendstream endobj 358 0 obj << /BBox [ 2854.26 4757.3 2876.51 4779.55 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 177 >> stream xœÝÍ Â0 …ïžÂ˜8vìd$n”TP $àÀú¤-ýAbIô,¿Ï/Þ4¬ŒÝîƒ1E•œÉ1ÆPÈt~'<â qŒHëíÁðÑAÌɈ3ª[&¼®*.¤c¶@{í5[")³n«Ã+5­:\)•aÒãŒÁ1U„Äp!¤B5ä2cÔ½cJ1u̹?„ï´p¡,ÆŽ/`ÜÕsù±‚fûÇ+8ÀÞœJlendstream endobj 359 0 obj << /BBox [ 2866.79 4737.25 2889.04 4759.5 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝÁ Â0 EïžÂ˜ØNcg$n”TP $àÀú¤”” 1‡$zÖÿߎW=GÆñW˜rĨîd(2¥¸¼·îñXEãr[HxA< c´è¤Žç¦Ò)Å’â&äib£.Ol”eá¡8\({£p#Ö&¡òÜãå¨%eü$h&¶¦ÇÌ“£NQËÜï„ï p%×T´`Ü”sú±‚~ýÇ+ØÁžÖÜlBendstream endobj 360 0 obj << /BBox [ 2879.43 4715.05 2901.68 4737.3 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝÁ Â0 EïžÂ˜ØI{$n”TP $àÀú¤”– 1‡$z–ÿ÷W'ÆáW Lž0E3*(œ4-ïí€{¼@ Á@©p½KP¼ fL±J‹(±á¹©D&©.f™’œ)ze”óÂ}Ux&•¶Ã©hã0ó4㥘+\SáÇ•¼43&sйcÉývøþGGˆdQ¹à7õœ~¬ [ÿñ v°…'gƒkØendstream endobj 361 0 obj << /BBox [ 2892.06 4690.66 2914.31 4712.91 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝPIA¼ó ^€ ÝÃòoŽ0ÑIL4q<ø}[3[Œ/ð¤*PlZ.Œýî I™¢`Éîd(’‚´Ìu8áoˆE0Q1®Ù’âЃxd Çb‰É¯kFɫЇ×ÉŠ9QJ¤L3î 2NÒ¬:X(Ç¢°àÇ{bd4”LpVÐjlñqóSÇ´å¤ðuGgÈäYÙ𠌻—/h·ü‚ìáw‹kôendstream endobj 362 0 obj << /BBox [ 2904.75 4664.11 2927 4686.36 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝPAÂ@¼ó ^€ÀRv÷&Þ¬ÐhM¬¿ïÖºmM|‡e3À ›VL°À”](ZH‰"ªr&·ùNxÄ0‰*2Y”#;=hf'w4 iÀë*“˜j¦$#42qC)θ+eÊaÕ¡ qZ*œ&¼ 5S> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝÍ Â0 …ïžÂ˜ø'N27Ê*¨„p`}ZJJ˜€C}O~ÏŽWãp‡+Hp¦bhš3% …Ü–÷vÀ=^ ‹` K<Þ)8ÞÂ…,¢¹9EÃs£D&g”"J±L)ʼn3¹/ÜUJÒTh¢ìMBå¹ÇËQ&ËøIuÕ¦ÇÌ“£NQ+–¹ß ßÿèáJY>€q3žÓtë?^Á¶ðSßkÀendstream endobj 364 0 obj << /BBox [ 2930.32 4604.57 2952.57 4626.82 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 173 >> stream xœÝÁ Â0 EïžÂ˜Øqœf$n”TP $Êõq† 1‡Äz–ÿ·ÿªgeop ÆT5ve …Lk¸Ç b ¤™ýÏÁpAJ—'—ž›†ø¡³QìfV*ì¬Lš*®P£ÄÍD d©qXø¹bԆ׈ƒ`¤¥YñâY±±LÔ«ß_)8B¤.g¼ãÆßéGþ~ý¯ùw°…¥iÎendstream endobj 365 0 obj << /BBox [ 2943.16 4571.63 2965.41 4593.88 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝPK 1 Ýç9AlÓ¤iN ¸s\xÑAÁqáõí¨-#xix!ïÓ¬†(Ç;Ü€CŽä‚’J!Cæà”¥÷éˆ{¼B ÈŒÄb}-dœF`¥PP´0YÆËrbT+vªDQ¯&¹bbïøPê”t±‘‰/:~yÌŒ61›wK¤º°xã™ÐB´ò#ðý‹œ QI9> â¦Öùdžõß`[xXkXendstream endobj 366 0 obj << /BBox [ 2956.05 4536.65 2978.3 4558.89 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝÁ Â0 EïžÂ˜Øqíd$n”TP $àÀú¤”” 1‡$ú–ÿóW=+ãx‡+H0¦¬¨1%r ™L—÷vÀ=^ ‹` u.·ÃÛ’;§l¨:¹ã¹©tB©P² 1OÚ(§I;±/z(m:Ü(¦†Põ<ã娡çCˆ‰:ofÌzrÔµcÉý&|ÿc€#DJÑ åŒ›rN?VЯÿx;ØÂÎil> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝK Â@ †÷9EN“y&'ÜY hAP°.¼~§Õ©#x“á ùÿ<6Ááwpœ„,`ðª”Ñ96JaýÇñLâ2…,%fN8à,3™`ˆÂ” ¯m&RŽX8Ç™Ô kq’•û¢ÐH¢m…‘wÃÊKEñÎp¤äñãÀBA›/žuŠZQ§¬ß{ôpOê“d|‚஼ËtÛ?>Áö0kpendstream endobj 368 0 obj << /BBox [ 2982.03 4460.38 3004.28 4482.63 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝO[ Â@ üÏ)r‚˜ì#»9àŸõÃ- Ö¯o,n[Áø±YfÂÌd6$Ááw¬B–0ÅZ©`l¤iþÇñL2¥"> +Ž«‘,cr–²àuÍ(ew37es\]%Ž-’èŒ{WX%·nLduvXá)£‡…Q¥”qqPçW|'´>ûvb“—èá ‘jT)øÁ¿ËþÝö_û`/fëj"endstream endobj 369 0 obj << /BBox [ 2995.07 4456.55 3017.32 4478.8 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝM 1 …÷9EN“4“´'Ü9.<À ‚‚ãÂë;?Ìâ \´å{4//ÙÕb‚í ž ìBÅÐRΨʅܖ·»àÀ$ªÈd!ýìØµ ¥8•‚fä÷J‘01 ‰ ì”óÀNº`‰EHcóA*꣭3O-ÆŠYQrÁÕ¡Êd¾¶˜p(˜3LÊ&õhð=EWH”“Kàý¹ýX@½ÿÛœà#©jpendstream endobj 370 0 obj << /BBox [ 3008.17 4480.43 3030.42 4502.68 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 173 >> stream xœÝOAÂ@¼ó ^€ÀRv÷&Þ¬ÐhM¬¿ï¶®mM| CffÓŠ ö¸ƒ² eC )QDUÎä6Ïá„G¼“¨"“E)=²ãÐC`aâŒfY¨q¼®7N®X°‘´†‹*Ž8“æwE¡FÁW MÔ¬ >pº0ñß‹äeÌjKJ¡Yü+ùõƒ…Q?¬ß:8C \">ApWêò#}»ýÏôØÃ ·hTendstream endobj 371 0 obj << /BBox [ 3021.32 4522.12 3043.56 4544.37 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 173 >> stream xœÝPK Â@ Ýç9Aœ|æÓî¬ P´ (X^¿©2cOàbæñBÞ{I6=ãø€;HHL¡i)”Q$t”¬átÂ#Þ ‹` Ëì §4ˆ’(ZTLj×u¥2:ϤŹ Yt®ŽÖøà ÍW ÆKìÇ ñWÄ"¨)Ä›[%¼ù"¨3ÔŽ:c5øÞb€3(Mœñ Œ;—è·{€ìaÖÒiendstream endobj 372 0 obj << /BBox [ 3034.51 4573.47 3056.76 4595.72 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 173 >> stream xœÝOIÂ0 ¼û~qbg{7ÊTP $Êïצ‰pˆ£±gÆžMçÔáð€;xŽŽŠ¢JΔÐ{.uùÇñLÎ{dÒä¬&Ž8 ,‘TPCVŠx]7LQX™B2\„r…¡zΰ7~0³Ï8(e]©\í_ô¹‘ ÅEžIYÙ¿q´ýÑîk_z8ƒ"Ñ%|‚ýËèÝö£`hendstream endobj 373 0 obj << /BBox [ 3047.81 4628.36 3070.06 4650.61 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝÁ Â0 EïžÂ;vg$n”TP $ÊõIiSŠÄ’è;ÿåçoZ1Áþw…²¡©;% 3E[Îá„G¼“„€L–¤ì‰#=([¦¤hQ3™ãu51£¦AåFÉÓ¨bµSÖEw…(!Ÿëè$¶Â«žÞö:1²€3®L!­^Ÿôh¯ùÕ±üxÆ¿tp†h”„OÜ•uùQ¾Ýþeùìáä¦hêendstream endobj 374 0 obj << /BBox [ 3061.11 4682.37 3083.36 4704.62 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 173 >> stream xœÝOK Â@ Ýç9A̯“é wÖ…(Z¬ ¯ï:mOàb2¼ä½—¼]'.8¼à ÊI¨utË™U¹¥äË?^ðŒ`UdòRƒŽ'#6ôÔ5xß625 ’@ÖâmJjö…A¶Ž³ûF½àÉ~¢×F9Õ «> >> /Subtype /Form /Type /XObject /Length 177 >> stream xœÝÍ Â0 …ïžÂ'vg$n”TP $àÀú¤…”"1‡8ú,¿çŸU4àp‡+D¶@EQÅ2ÆÈ…LçÿvÀ=^€)ĈLšC™ og#qÔ¬B–ñ¼ÌT3AagJ±rŠä>r¢ä3÷UQ˜,-*ŠR. ‡™§“â' øq%µEŠ6E«hS6‡ï=z8‚‹…Œ¸©ïôãÝúO°ƒ-<4økžendstream endobj 376 0 obj << /BBox [ 3087.91 4777.15 3110.16 4799.4 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 172 >> stream xœÝPK Â@ Ýç9AL&a2sÁuáŠëÂë›Z:ñ.’ðy/ŸM'&8<à‰³P54-…SâJÙZOxÄ0IJÈd.‘3Ž(—JEÑ<¤Éñºbª’*G­>a'+®ÄÖp*l$Ÿá°²AÃóˆ·`a”’`3ðpöÕ„‡ í°t´­gƒ¯+z8ƒ‘Åñ ‚»ˆËtÛ¿}Àöðˆ²jÚendstream endobj 377 0 obj << /BBox [ 3101.36 4815.56 3123.61 4837.81 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 173 >> stream xœÝI A E÷9EN+CM'ÜÙ.<€hƒ `»ðú¦éÁ<‹ªðÂÿIþ¦ccìŸð ‰©š–BEB¥dkÎxÄ;b d™ýÏ!áЃrP’‚V$Qªxk:Ê”#:g29R©Î,duå“;8SŒBÜÙ ˜qÚ0ê—SRüؽZiL<–Åzô<á;Ä . T4qÆ0îü]äï¶ÿšÿ{xöBi´endstream endobj 378 0 obj << /BBox [ 3114.92 4847.63 3137.17 4869.88 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝPK 1 Ýç9Al’6mO ¸s\x€AÇ…×·uèXÁ¸Hà yŸf3°gœpqÆ”=zM‰"ЏLæ×>Ÿðˆ7pÄ"èÈG.ot†óÊl” 5…B5¼vSJ‚Êâ(§Š#e«ØÈù…¡LÌ݆’Ð)4¼x¼m¢%ðGÀg ¡³Xp%´mc½|ÿb„3k5ŽøÆ]©Ë Û¿=Àöð1Ëj„endstream endobj 379 0 obj << /BBox [ 3128.52 4873.87 3150.77 4896.12 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 171 >> stream xœÝA! E÷=EOP)('0qç¸ðÄDÇ…×·è0²ð.(yôÿO»X§ÜÁ»ÄT%¨RFï]¡$ë=Ÿðˆ7pÄÞ£#Él5»„󃽘U5âµÃâÈÆBQ+ ùŠ–ަ!Ë[û¢¤©³7¶ô·zÁ\¨üºs¤\ºøWGûU,óµ„nüÎHCâŒO`ÜÙ¹üX{ØþÙÚØÃ fÐendstream endobj 380 0 obj << /BBox [ 3142.18 4895.05 3164.43 4917.3 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 172 >> stream xœÝA1E÷œ‚`)”Ò˜¸s\x€‰Nb¢‰ãÂëÛ‰3uL<‹áÓ±2¸C ÆTUÜ)cŒ¡i‹ã xƒ@#ÒÌõÏÁp@X•µ#Îxý˜)*Vô)VN$^9 Iþö''É«‹”Ö~o˜­ÂÄŒm‚£bmÅŒ“`¾¡5,7Ïú/ =œAÈÅjþÆ]}—æ»í_š?À^*hBendstream endobj 381 0 obj << /BBox [ 3155.89 4911.93 3178.14 4934.18 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝOË Â0 ½{ O`l'“ ¸Q PA%$(Ö¯[úCbqô¬÷ñÛÕÛ> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝÍ Â0 …ïžÂ˜Øqâd$n”TP $Êõ1””"1‡Äú,¿çŸUÇÊ8Üà 2SUÔX Š„JYç8pÄ"Hý·q ²1%C­1“&> >> /Subtype /Form /Type /XObject /Length 173 >> stream xœÝÍ Â0 …ïžÂ˜ø§I<7Ê*¨„åÀúM¦EbIô9ÏÏ~›–±À$D&74Í™Š§hõNxÄb d‰ËBÄ¡åÜ)š["ÁëªÐIÄÂNMš8’t£¨3vEïNË·¥lKwå—}‘/!V¬íšÈ}eÿæÉž?+ꃯœ¡ ÐÈ ŸÀ¸+çò#z»ýÃèØÃaÛhfendstream endobj 384 0 obj << /BBox [ 3197.42 4944.71 3219.67 4966.96 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝÍ Â0 …ïžÂ;vœd$n”TP $ÊõI)ýbIôY~Ï/Þ4b‚ÝîØ…Š¡iΔ0.ä6¿ý x& ™,I½;ö¨”BZ¥%Fʆ×UÅ™ j`%ËFâ8p¦gnAƒ(¹¬:$QŠ‹Á„ã„·`ªÔ sr]yPL!>KêÑáë-œA)«KÂ'îê¹üX@³ýÛ`/DÐj¢endstream endobj 385 0 obj << /BBox [ 3211.38 4951.72 3233.63 4973.97 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝÍ Â0 …ïžÂ˜ø'q27Ê*¨„p`}R m‘˜€C}–߳ߪccîp ‰©šæLŽ"¡P²é¿pÄ"Èœkõð6€ +)ZIB9âyÑp*Œ,Vv¡+‹Pä‰û*§è‹ er^8LüZ1*Z':yÆÙ!êxï¼ãÍ£¢]Ñ&>G6ƒ¯=A)kbÇ0nê;ýˆß­ÿ4þ¶ð#–ibendstream endobj 386 0 obj << /BBox [ 3225.4 4957.4 3247.65 4979.65 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 172 >> stream xœÝPK Â@ Ýç9Aœ|:Ÿî¬ P´ (¨ ¯ocŽ‚'p1^xŸ$«žq¼Ã$D¦bhš3% …¢-õvÀ=^ ‹` K<ý)D¼ "‰TÐJÌÔ ž?:I©+¨¢L'Jê8:³âaR;³1¬óÚ*ž3^ŠÚQ÷n]ñì–1cWÔ)*c™ûíð½ÇGPÊ9á7Ó;ý8A¿þãì` Ovknendstream endobj 387 0 obj << /BBox [ 3239.46 4962 3261.71 4984.25 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 173 >> stream xœÝM Â@ …÷9ENðœ$ó{ÁuáŠëÂë;¶L­à \L†/¼—¼l:ñÂÃî¤. Šgo9#±ª+ˆ~ùÇùF¢Ê>I­ÉE2õËìK2ˆñuÝÉ•‚UÎ ³ÊÁ!”…ûê1¬ë § “~nÄŒšâc†¢«3¿ -BS´ˆmÂ÷=É-Jâ' ïê»ü¸¿ÛþëýÚÓ yMjDendstream endobj 388 0 obj << /BBox [ 3253.63 4965.43 3275.88 4987.68 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝK 1 †÷9EN›4MÚî@t@Pp\x};Ìà žÀEûó…äÏcÓ±2öOx€c*Šs&G‘PÈtÕáŒG¼C Á@ê\†CQR¢”P‹Û¨·&’™L°r©¦¹U4uáS-°BYš T¬1Xxj1V¬&-øq0§˜šóKÂ:õlð½Å .)GcÇ0îê»þ8@·ýÛ`o¡kbendstream endobj 389 0 obj << /BBox [ 3267.85 4967.73 3290.1 4989.98 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝPÁ Â0 ü{ O`âÄÄÎHü(¨ H”ëãRR‚Ä<’ÓY¾;Û«Ž…q¸Ã bÈLEP’)Æ eYp<⯈cÄ@¢ì¿†Œã)æBª(E,㥩X¢1Eu䉹ȹQ±…÷®0¡ M‡#[ãPùœñRÔJ"-øqðì¼n2f>)êµc™ûíð½G'Hd)³â·þÎ?NÐmþø{ØÁ/Æl¸endstream endobj 390 0 obj << /BBox [ 3282.13 4968.8 3304.37 4991.05 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝPË Â0 ½{ O`bÇMâ ¸Q PA%$(ÖÇUipH¬gù}ìMÏÊ8>à“)j,…2Š£¤µN'<â ±ÒÌþçp!JQ Nµld¯¯f踗±:¶HÒU<8à En1i×*^<œÑ:J%cSÈžL><<{¬)Ö‰šû­ð½ÇgˆTbâŒO`Üù»ü8A¿ýã`/fýkÔendstream endobj 391 0 obj << /BBox [ 3296.5 4968.45 3318.75 4990.7 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝÍ Â0 …ïžÂ˜ø§N27Ê*¨„åÀú¤”¶bIôY~ï9Þ´lŒýî Á™²¡iJQ$dr[Þá„G¼A Á@¹Ü18=¨äDÅÇrÌÔD¼V•d£Z55>r1O#GrY¸UòTu°SÒÊaæ)ã­˜+F ãê©WŠyŠOÇ:÷äðõΠ%Â9âwå\~¬ Ýþñ °‡yëkÜendstream endobj 392 0 obj << /BBox [ 3310.92 4966.55 3333.17 4988.8 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝÁ Â0 EïžÂ˜ØImg$n”TP $ÊõIU‚Ä’èYþß?ÞôœÇÜA‚2å„)º“¡HȤ©¾Ó xƒ@,‚’q¹-(N#ÄÈB^¤ÙŒÔñÚT\ÈVÊ>³’çÂ"ºÊCQˆsÓ™¤kV^fÌŠZRÁƒzÉ×ÌXxV¬)ÖŽšûíðýÎÉ£²áwå\~¬ ßþñ °‡A­k°endstream endobj 393 0 obj << /BBox [ 3325.39 4962.92 3347.64 4985.17 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝÍ Â0 …ïžÂ˜8vg$n”TP $àÀú´…” 1‡8ú,¿çŸUÇÊ8Üá 1SQTq§Œ1†B¦Ë;à/ˆcÄ@šyŒ9Þ‰™„QKV Ïm¦3Š“ÚÈ.ÓÄF).Ü eJÞTh¢,ÃÂsYñΘSqü8˜’kÓãÅ“¢NQ+ê”Õá{Ž äbœñŒ›ñ~œ [ÿñ v°…'ä*kdendstream endobj 394 0 obj << /BBox [ 3339.97 4957.5 3362.22 4979.75 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 173 >> stream xœÝM 1 …÷9EN“&MÛî`ÐAÁqáõí0¿‚'pÑ–/¼—¾·kÄ»> >> /Subtype /Form /Type /XObject /Length 172 >> stream xœÝOKÂ@Ýs N€Ã§Ð9‰;uáŒ61ÑĺðúÒÆÖšxÃð€÷¬vlŒÝî Å™ª¡iÛR H©ä6ÿý xƒB,‚…,8cǾÕÆ©´šÂx]Vœ$PÕ ¹'Žäò€ ñ1™E]L„QÕ…ÂŒG‘ñ®¤~Òøc`˜üÇÞ´ÜDü^ÿgPjÕ9𠌛|——ïÖÿwù¶ðXPg¶endstream endobj 396 0 obj << /BBox [ 3362.32 4945.43 3384.57 4967.68 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝÍ Â0 …ïžÂ˜8vìd$n”TP $ÊõIUŠÄâè³üž6+ãð€;Ä`LEQ%grŒ12mÿxÂ#Þ LjԹF†ã"¦«´$£”ðºÊTS‹X9“”‰¹Uv!MûªðL‰W9’ÙÊaá¹Ç¤h&-øqP'I«3OŠeŠ¥¢ÍývøÞ£‡3e1v|㮾ËtÛ?>ÁöðX‚kÊendstream endobj 397 0 obj << /BBox [ 3462.58 5118.72 3484.83 5140.97 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 173 >> stream xœÝOË Â0 ½{ O`bÇ“ ¸Q PA%$(ÖÇQI pˆ£g½ß¦gep ‰©(jÌ™ EB¡¤Ë?ðˆ7Ä"H}ZH85)uرÊ^×ET*Œsõp\(tŽ-zDƒƒóÍ3탥 Wƒ†ç„ªX6JVpuP£–ˆVA»¡ÚÍoýW…Î)ÇĆO`Üù»ü(ßoÿ²üöð«h¼endstream endobj 398 0 obj << /BBox [ 3628.5 5417.84 3650.75 5440.09 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝÁ Â0 EïžÂ˜8vd$n”TP $Êõq©R‚Ä’è}Ùß?Þô¬Œãîƒ1E•œ)aŒ¡éúN'<â qŒHû‚á4‚˜¸±Ó˜©^E”‚ ³R—fÎÄifw••ïP%+M…fÊÚ8T^f¼;ª"TðcÀ…’5#žjˆµ¢Æ^ ¾1À„²˜§yãÎÏåÇúíß.à{xCŠj¢endstream endobj 399 0 obj << /BBox [ 3837.7 5799.67 3859.95 5821.92 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 173 >> stream xœÝOIÂ0 ¼û~±ã,Î ¸Q< ‚JH Q|Ÿ´%%H¼€CÍxflo:ñ‚Ãîà8 e^Í(¡sœ)úõOxÄ0‰sÈä“”š8â8€šÃ`R¸Œ×– dÕ¼RJ;ž€‘éú¢ J–k/±oŒ+ž£gù›á@Iñcg¡›ôOŽ:¼*êr5á{ýÎP"5JÂ'îÊ»ü¸¼ÛþßåØÃ æ€hVendstream endobj 400 0 obj << /BBox [ 4072.43 6229.88 4094.68 6252.13 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝÁ Â0 EïžÂÛqœd$n”TP $ÊõI+RŠÄ’è9þþþ›NLpxÀ”]¨ZÈ™ªr!·åOxÄ0‰*2Y’z'v0NFÁÐÕ„Xðº®8qÂÊ™¬TŽL*•s î«¢Úº¬:ŠRòÕ„…gIÑ*!R‰ø™„òÊbÆ©¿íðþo+6ùwˆÎ(—„OÜÕsù‘¿Ûþkþìá—LiXendstream endobj 401 0 obj << /BBox [ 4221.63 6506.55 4243.88 6528.8 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝPÁ Â0 ü{ O`bÇ±Ó øQ PA%$(Ö'Uiðˆ£»øÎozVÆñw`L¢ÆœÉQ$tdZïé„G¼A Á@ê\ªÃi‰”Zb's¼6Œy1)/ÝŒr.8>U<EtÊÒth‰cÊ—³¢2BÆøq™Ôš žkе£æ~;|ÿc€3DÊÑØñ Œ»r.?VÐoÿxØÃ ßìkDendstream endobj 402 0 obj << /BBox [ 4298.91 6647 4321.16 6669.25 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 71 >> stream xœÓ241TH/æ*ä2203Ô³4Q01¶°Ð3W022°Ô33ÓE© á y\z†FF z&æ†@ÒÜÀL¡(+ 'qíendstream endobj 403 0 obj << /BBox [ 4310.37 6650.94 4332.62 6673.19 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 71 >> stream xœÓ241TH/æ*ä2203Ô³4Q01¶°Ð3W022°Ô33ÓE© á y\z†FF z&æ†@ÒÜÀL¡(+ 'qíendstream endobj 404 0 obj << /BBox [ 4274.82 6570.02 4297.07 6592.27 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 71 >> stream xœÓ241TH/æ*ä2203Ô³4Q01¶°Ð3W022°Ô33ÓE© á y\z†FF z&æ†@ÒÜÀL¡(+ 'qíendstream endobj 405 0 obj << /BBox [ 4227.25 6462.87 4249.5 6485.12 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝÁ Â0 EïžÂ|ÛMâ ¸Q € $ÊõI "1‡$z?þ¶ÿ¢ùx£+IHnlZ 2‹G²÷;ìyË ˆ"`9Ö;‡ÄÑLÄ3'Ë w>ÏGèØD*•‹BF,ÐÒpWëMaöù·ŒÎgö7O&ÃKI®üi Ùgž<:Ú ­¢­Ø:|‡ØÑESÕîyUÏéGþ~ù¯ù7´¦¤ij„endstream endobj 406 0 obj << /BBox [ 4176 6345.22 4198.25 6367.47 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝPË Â0 ½{ O`bÇùM€Är`€ *!D9°~]JJ˜€C=ëýâMÇÊ8<àâ"SQTŸ3%q…¢®ïxÂ#ÞÀ‹ #MlwrÇ”S¢"}ˆä^›‰™Z‚r2²á@!Ì8û÷¦(B\F1/m*^2^Š:a’‚5om2<+j‹ÊX{¿¾ÿÑÃ> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝÍ Â0 …ïžÂ˜ø‡Ä™‰åÀTB‰r`}RJJ˜€C}–ßó‹Wãp‡HˆLÙÐÔŠ„LÑ–w<⯈E0%.w ÇŒÅÉ£h&¼43RGcÊqb§µNìdá¾(L)ä¦Ã‰6•ç/E­Iă–”Ü̘yRÔµcÉývøþG'PrœðŒÛrÎ?VÐmþx{ØÁÁjbendstream endobj 408 0 obj << /BBox [ 4083.53 6118.99 4105.78 6141.24 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝÍ Â0 …ïžÂ;q~<7Ê*¨„åÀú¸ ¦Ebqô9ö{Ž7¨àð€;ÎB¦¨±V*em÷xÂ#Þ€IB@&-â±pÆqåšHf‰Ó;^×™DRÑÙ(ÙÄF18›RN{ï0#m‘j^~{xGË„DœpQL&+OósÅ<å¬ðýÎà1KÁ'îü\~¬ Ûþñ °‡5VjŒendstream endobj 409 0 obj << /BBox [ 4047.77 6021.35 4070.02 6043.6 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝPË Â0 ½{ O`lÇu’ ¸Q PA%$(Ö'-¤-pˆ£g¿÷üÙ´b‚ýî ìBÙÐBJQ•3¹ÍÿpÂ#Þ€IT‘É¢”ÙqèÁØ '£sÐRÁë:©)¦ÜJ¡`ò4âDy†]x ì+‚'YÌxj1)>T–X4ƥŎ‚:C%Ô«Á÷œa¸D|‚஼Ë´Û¿=Àöð¸7iúendstream endobj 410 0 obj << /BBox [ 4020.1 5936.59 4042.35 5958.84 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝÍ Â0 …ïžÂ˜ø§N27Ê*¨„åÀú¤* AbIôY~ï9ÞôlŒãî Á™²¡iJQ$dr«ïtÂ#Þ ‹` ‹\î§,ˆPì²EŠ‚×¦Ò ÅŒ…ØgvÊZX™D+E¡N’›+)Ú8¬¼dÌŠZrǃ&ê¸ÉXxV¬S¬uî·Ã÷?8ƒRRçˆO`Ü•sù±‚~ûÇ+8À^hjÊendstream endobj 411 0 obj << /BBox [ 4000.1 5864.02 4022.35 5886.27 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝÁ Â0 EïžÂÛqœd$n” ¨„åÀú¤*M‹Ä’èYþÿ;Þtb‚ý ìBÅÐBΔP• ¹µw8ãïÀ$ªÈdIêØqèÁ˜•X1æI o«JfR¬è$>¢Qˆ•EHCãSˆ“–U‡Ö°Ì8%Œ‚Vaâ„‹G*a1ñ¨˜‡˜;ÚÔ‡ï_œàrpIøÁ]=× è¶»€ìá ( ixendstream endobj 412 0 obj << /BBox [ 3986.6 5801.77 4008.85 5824.02 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝÁ Â0 EïžÂÛIãx$n”TP $Êõ -i+ÄâèýäÛþ›V¢`ÿ€;('!CÎd¨ÊN)Î÷pÂ#Þ€IT‘)š”jœpè!x±4ŠM¥ìx]+FÞ`pWJ©°*ÉL+v™•Ì«P0‘‡Ù¾âqÀhø(l”. 8PÊ« w°¬PÔ§ß!:8C(I Ÿ ¸+çò#»ý×üØÃ Ôjªendstream endobj 413 0 obj << /BBox [ 3978.26 5747.29 4000.51 5769.54 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝÁ Â0 EïžÂ˜8v{$n”TP $àÀú¤”” 1‡$z_þߎW=+ãx‡+Ę\QÅŒ2Æœ’.ïí€{¼@ Žiærçð6‚¸ݰˑF<7JRÃÂJ'Δdb'ñ…‡âp%íš 7ê¼I¨<÷x9ª"$ ? ê¹é1óä¨S,uîwÂ÷?8‚IâŒ`Ü”sú±‚~ýÇ+ØÁž Îlxendstream endobj 414 0 obj << /BBox [ 3973.45 5697.88 3995.7 5720.13 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝÍ Â0 …ïžÂ˜8¶'@âF90@•@¢X¿)mÓ"1‡$ú??¿]ѱ{Á¼ËL1UôÞåXßþ‚g|€#öEár‹ËØwLÁ$¥×1Þ7Žä %?²’çÂ)iå¶(ôã³vX ±Í„…'QQ+,aÍHW‹ Çþy‡å¿.=Ë¿C´p…@2 ¾ñPÎíGþfÿ¯ùOp„Dôk*endstream endobj 415 0 obj << /BBox [ 3970.79 5650.72 3993.04 5672.97 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝPË Â0 ½{ O`b'qœ ¸Q PA%$(ÖÇ¥-pH¢÷ô>Ž7'Æáw L5aŠfTP$TÒ4¿ã xƒ@,‚Ra¿KPˆµ9‘Õ#,ãuÍ(UFÇJ¦Ž SÈŽÍËdƽ;Ì•¶RT&Ž«„¿;&Gc²R©¸$d™&^:>xr´)š¢MÙ¾ÿÑÃ"YT.øÆŸËtÛ?^Áöð¥²l"endstream endobj 416 0 obj << /BBox [ 3969.05 5603.56 3991.3 5625.81 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝÍ Â0 …ïžÂ˜8q~<7Ê*¨„åÀúu )AbIôY~Ï/Þt,ŒÃîà]bRA ¥PFïR’õOxÄ8bïÑ‘d¶;»„ãA³#Í %Åk[QÊ£)} ¢ÆÅœÊʽ)J$/m‡RÐÆaåeÆ¢xWæ„?.’”fÆ‹gEMQ;jÊêðýÎ`aBâŒO`ÜÙ¹üXA·ýã`ãŽlRendstream endobj 417 0 obj << /BBox [ 3967.21 5554.51 3989.46 5576.76 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝÁ Â0 EïžÂ˜8vâd$n”TP $ÊõIZRŠÄë[ïÇþ›Ž•qxÀ¼‹LYQ%%2ôÞeŠºôñ„G¼#ö©qyÍE3±`1TöºšX¡P² y«R)iÕ‰DÝCÒŒ‚~üMÎ &¾M…‰˜ý!’ÊjÁ¬«¡Ðˆåæ÷ßz8ƒP’ȆO`Ü•ºüˆßmÿ4þöðD>j€endstream endobj 418 0 obj << /BBox [ 3964.61 5502.09 3986.86 5524.33 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 173 >> stream xœÝOKÂ@Ýs N€ÀPfæ&î¬ `´‰‰&Ö…×—6öcâ \ “¼›VL°{”]¨Z*…2ªr%·ùïÏxÄ;0‰*2Y–¨™ûRu§F±i$‘ ÞÖBš1ÕÌäX•Â1pC9ÍøŒzuµQlˆ³(ÌxôŸÃEme`ØüÇÙn"~Ç?Á•ä’ñ‚»x×—·Ûÿ»ü{xzîgÖendstream endobj 419 0 obj << /BBox [ 3960.66 5445.36 3982.91 5467.61 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 173 >> stream xœÝÁ Â0 EïžÂ˜8qlg$n”TP $àÀú¤”– 1ÇzÑÿßöªcaîp…”©Jr'ÃC!•¥ß¸Ç â1×ׂâm€T4RvÌ’•ÄñÜüÔМ±²’¥‘3i©lLVî«Ã”\…scÁ”>j'd’ˆ£Eo¢'åóðY±¬ûNø^¿‡#$ò¤løÆM­ÓË»õÿ]¾ƒ-<D§h°endstream endobj 420 0 obj << /BBox [ 3955.19 5383.93 3977.44 5406.18 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 177 >> stream xœÝM 1 …÷9EN›¤éÏ wŽ 0耠à¸ðú¶Òé(xmó…¼—4›=ãô€;ˆ LÙ£×”(¢ˆË|çñŽXùÈåŽ.à> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝÁ Â0 EïžÂ˜8vœd$n”TP $ÊõIi‚Ä’è}ù;Þt¬ŒÃîà1eE•”(¢÷.“i}ÇñŽØ{t¤‘Ëá8€äPtà ¾X¯"B1aa%™0Röf«Üƒ)i[a‰BlVž[¼«"d? œ)pÓcæÉ± Q Ö©—€ï_ôp¡$ÆŸÀ¸+çòcÝöop€=¼pjºendstream endobj 422 0 obj << /BBox [ 3939.8 5246.49 3962.05 5268.74 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝPÁ Â0 ü{ O`'vœ øQ € H”ëãª4-ðˆ£;ùîloº˜#öOxT3ædF™C%ÍíÎxÄ;ŠÌ(—èµÅ¡‡Ts$'„¥2ÞVŒ2©¡c!Ó+;–@•>¹B„ª­:Ô³ÒÊaÆSƨh “.ÙÈ·Z2&<*æ)æŽ6÷Çá{\ ‘%_qçïúãÝöOp€=¼þHk`endstream endobj 423 0 obj << /BBox [ 3930.13 5170.95 3952.38 5193.2 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝPA 1 ¼çyAlÒ6i_ xs=øÑAÁõà÷Í*]+øí0!3“d5pbïp ÊT¦X Š„JšœŽ¸Ç+b ”Œý· 8k 3GÃK_1âˆÎ•¸:¯LRœ'Ǽðƒ+’R”®#{Šv eÌŠV1£Àøq0¡¢]ƛϊ6EëhS6‡ï=p‚H%*>€qãïüãÃúO°ƒ-<‡Mjîendstream endobj 424 0 obj << /BBox [ 3919.49 5091.46 3941.74 5113.71 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝK 1 †÷9ENóhÚæ‚;uáDÇ…×·êPGð.šò…ü‹$ÁáWPÎB‘0Y­TP•ƒrêÿxÀ^€IT‘)i±pÆq j>.¬äçy¦PvlìäÞX„J46¦¬÷MaN¹Î+‚ªÎ:¿z¼ï G!WìFV?=&~*¦)zÅ4ewøÞcG0ª–¥àWí~œ`³üãla ¦´kendstream endobj 425 0 obj << /BBox [ 3908.09 5008.45 3930.34 5030.7 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 169 >> stream xœÝMÂ@…÷œ‚ 0t~N`âκð61Ñĺðú¥6Sgá \̼÷€]/&8¾à ÊQ¨ZÈ™ªr¡h[.xÆ0‰*2YÿGœFE;–B]Â{E5ŠŒÄöؼp!•—»RS£ðjÚ$T^|µcÔ ~„)ÄfÆÊ‹£n±)¸±7ëp…@9DIøÁƒ¿Û³ûýŸ}‚#ÌReÐendstream endobj 426 0 obj << /BBox [ 3896.22 4922.41 3918.47 4944.66 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 177 >> stream xœÝÍ Â0 …ïžÂ˜ø§‰37Ê*¨„åÀú¤¥¤bIôY~Ï/Þ´lŒýî !2eCSwJ(2E«ïpÂ#Þ ‹` K\î"=¨g'.Ò¬Jáu]qЍ9‰4¡ÔŒœH­ršY¨DY:8RÓ,§ “`®ˆ—4¸ˆ‘êjÄ›GÅ'ÄÜQ3Î_¿èà J®‘>qWÎåÇÚíß.à{x|øjÎendstream endobj 427 0 obj << /BBox [ 3884.1 4833.72 3906.34 4855.97 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 177 >> stream xœÝÁ Â0 EïžÂÇv“x$n”TP $ÊõIKÛ Ä’èYþß?Þ´Áö¸ƒp 䆦9SBvж¾Ã x¦ ‚L–B¹Gz(ŠH,hÙŒ²áõ³âä5{QÆÂ7#7$²rêÌ$^;œL«CåiƤ˜+ê”2VmÆÄuÆ›‹bM±t,)g‡¯tp¥¬1$|BÀ]9—+h·¼‚ìá%òkžendstream endobj 428 0 obj << /BBox [ 3871.87 4742.73 3894.12 4764.98 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 171 >> stream xœÝOA1¼ó ^€¥°¥}‰7׃Øè&&š¨¿/Õ­»&¾ÀC)3 ¬zVÆñWˆ!1E•œÉ0ÆP(éç¿pÄ1b 5öh!ámÉ&dÕ:¡ÜáyYÉTqœ„\ä3œîžžÍí).Ô ¾ÆWþTÐ\]f¹jÝušþ•ÝÌ[»-×äßëpO$±á7þN?.ï×ÿwù¶ðHãhÆendstream endobj 429 0 obj << /BBox [ 3859.75 4649.74 3882 4671.99 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝPKÂ@Ýs N€0†žÀÄuámb¢‰ºðúÒêŒ5ñ.f^ὬzI‚ã®X…º„)šQÁ¸#M oÜã˜$dJEü/¬x!šKµ`Re2Åó²’©‹è<“‰óÂÄŹ£Yãƒ+Jžã[‡9Ú¡ñ9cRÔJvoüdÖEÄ‹O‚:Dí¨C¾ ¾·à‘,ª|€àÆßéÇúõß`[xº8kendstream endobj 430 0 obj << /BBox [ 3847.78 4554.96 3870.03 4577.21 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝOÁ Â0 ü{ O`âÄqœ øQ PA%$(Ö'¥¤ ð°­³îξMÇÂ8<àÞ)S”`F ½w™T–9žðˆ7pÄÞ£#I\zrŠãÁ$‰DUr†×u‘˜8b°Èd‘|ž°Qæ÷E rjjÄÜ8T<Ÿx+ê†Éy\¢’YscÆ“¢~QõëÁWˆÎPèA9áw¥.?âwÛ?€=¼ Jj`endstream endobj 431 0 obj << /BBox [ 3836.02 4459.41 3858.27 4481.66 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝKÂ0 D÷>…O`âOâôHì( PA%$€×'-$‰°H¢gÍÄ3«žq¼Ã$$¦ÎÐ4gr %kïí€{¼@ Á@æ\n o#hV§NÑÌEÃór)¡f yÂŽÜ&vbk<C’… &Òøñ7œÌú÷$Å›¿”P],xñd¨ª¢&¬|wàJY;>€qSÎéGý~ý§õw°…'ºiäendstream endobj 432 0 obj << /BBox [ 3824.51 4453.53 3846.76 4475.78 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝM! …÷=EOPþ'0qç¸ðÄDÇ…×—…`â \ùš¾×G7ƒÓîœyÊ‚Â)QÄ\&“öÎ'<â ùБD_îè ç 8#a1!3¼ö•L1 'v¤±pdJ¶°’qã±(¤øu "”¤3h¼ŽXŸŠfÒŒÍ@•D» o^5Cí¨«Á÷/F8CÉÂæ#>Á㮜Ë Û¿]Àöð}jèendstream endobj 433 0 obj << /BBox [ 3813.2 4510.46 3835.45 4532.71 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝM 1 …÷9EN›Ÿþ@pç¸ð¢‚‚ãÂë›Q:Vð.Úò=ò^Ò¬6Æñ7˜ª¡i)”Q$TJ¶¼Ó÷x…@,‚,³ß9$œFÐÂÑu´(L±à¥W¥ˆÎ•$;«»ª³©.|p‡TÒÚU¨R´.aáWÙÑN? ,¤¥ëñæÙѦhmÊ–ðýœ@©hâŒ`Üø9ÿXÁ°þãì` O•šjôendstream endobj 434 0 obj << /BBox [ 3802.16 4608 3824.41 4630.25 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 173 >> stream xœÝPK 1 Ýç9Al>ôsÁã : (8.¼¾ÆÖ žÀEÛ¼÷i6ãô€;HˆLÅÐ4gJ( Ekï|Â#Þ ‹` Kìw ç 4£Ð"bÅk×#.è8“ð‚3©:f%É Î`¯¬›!+BÅ«ÇÂh÷ŠøQðÄE:/Œš¢N´Üo…ïŒp¥¬‘>qççòcÃöWp€=¼|Jjäendstream endobj 435 0 obj << /BBox [ 3791.31 4728.46 3813.56 4750.71 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝÍ Â0 …ïžÂ˜ø§q27Ê*¨„åÀúMT”Vˆ 8$Ñ÷ä÷ìx׳1Ž/x‚„È” MS"G‘)Z{§ žñX™s¹=DœFPÏJ¢h®™º„÷bVÝ…Ô+—ðŒš‚YãŠâÔm ˜«±4^ZTCSŒ:Á 4m:,<À:çbz øúÅWPJÙñ Œ‡rn?Ðïÿv'8 “òjÚendstream endobj 436 0 obj << /BBox [ 3780.62 4858.32 3802.87 4880.57 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝÁ Â0 EïžÂ;qg$n”TP $ÊõIUڀĒèYþÿ;Þt¢‚ÃîØ„Š¢FwÊ2]ßñ„G¼“„€Lš¥Þ™ Çbö@©JÝ iÂëG%+%ÁÊFæ;™U.B9­ÜWE1riÎL%5‡•猪h¥èØŒ)èGÆÌSÆ2ÅÒ±ÎývøþGgˆäÑ$ãwõ\~¬ Ûþñ °‡È)l0endstream endobj 437 0 obj << /BBox [ 3770.04 4987.98 3792.28 5010.23 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝÁ Â0 EïžÂ;q{$n” ¨„p`}Rµ 1‡$zŽÿ·ÿªpƒÄ&ŠšÝ©`JdÚÞû÷x&I ™´H½ ÞÈ¥Ti‡$‚—V阕ı²ÇÈN9Uv!±Æ‡ªp£jýî¦l/3FE«(q‡‹ƒ†E1ãØ?íÐþÛÒ³ü;ÄNɳIÁ'nê9ÿÈ߯ÿ5ÿ¶ðš§jˆendstream endobj 438 0 obj << /BBox [ 3759.5 5111.1 3781.75 5133.35 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝPÁ Â0 ü{ O`b;‰Ó øQ PA%$(ÖÇR‚Ä<âè.¾;Ç«ž#ãxƒ+HÈL]Ĩ¥¡Hè(Çåž¸Ç b ½ZÈ8 æR÷IþF¢xn#éÐq¢”«óêØeYðà K”KÛÑQÑÆaÁsƬx3lÄ?¬¤Éxá§¢NQ;ê”ÕáûA="³á7~N?VЯÿx;ØÂ:1jŽendstream endobj 439 0 obj << /BBox [ 3749.06 5224.09 3771.31 5246.34 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝK Â@ †÷9EN“LæuÁuáŠuáõM­­#x“á ùÿ> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝÍ Â0 …ïžÂ˜8þI27Ê*¨„åÀú´”´EbŽõ9~¶ß¦aeìp‡œ©(ªäL c …\çÜŸðˆ7Ä1b M<¼)8öHÒ@fh"NVðºª(“;¬äed£> >> /Subtype /Form /Type /XObject /Length 172 >> stream xœÝOIÂ0 ¼û~‰—,}7ÊTP $àÀ÷q )Aâ’h&3cϪgcïp ‰©34-…2Єޒ-ïí€{¼@ Á@–ÙïÞFЬÎ3F“Džwne×¢c#‰Ž”d©,xp‡iiV(J“PñkÆì¨ “~8S;b†“¾îPÿëÒoûw‰Ž T4qÆ0nüœ~ôï×ÿÚ[x™piFendstream endobj 442 0 obj << /BBox [ 3717.81 5494.62 3740.06 5516.87 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 173 >> stream xœÝË Â0 †ïžÂ;vâd$n”TP $àÀú¤¥/$&ààXŸóÿ~l1Áî wœ„Š¡iÎäJ6çÇ x& ™Ì¥¾Î ¨K!WŒ‘#¹áuU¦ŒêA){F%öœ©èÌm5¨­¾5“ØâžðÓ~PO¦4(*XImi>r/ÇÏŠyßÑþ½ g¨MâøÁ]ËÓ›íž~€=¼U.hTendstream endobj 443 0 obj << /BBox [ 3707.38 5565.1 3729.63 5587.35 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝPË Â0 ½{ O`âOât$n”TP $ÊõI)i‹Äë9ïãxÓ²1ö¸ƒ„ÄÔšæLŽ"¡¡dsNxÄb dÎåöpèA½p¤Á=Qy¾®:™ÇªÎJf#Žd:âLq†]ˆRôAœJÆbPññVÔ'\’S%b‚£ ÎP óÔƒï_tp¥¬‰ŸÀ¸+çòcíöop€=¼=àj†endstream endobj 444 0 obj << /BBox [ 3696.99 5628.68 3719.24 5650.93 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 173 >> stream xœÝKÂ@†÷œ‚ t`N`âκð61Ñĺðúö‘>L< †| üðïj1ÁöOHœ…Š¡i9¦Ä…²-¹»àÀ$)!“¹ô¯sÆ®Í%¨VY Þ73 GuVâjàB,G/´pê¢$±é'M…™ÇãÀ\0rÃU@™òfÈCÿ|Âô¿ž<[hà J¡Yß xèãöÃ|½ÿKó'8ÂàXhîendstream endobj 445 0 obj << /BBox [ 3686.56 5687.19 3708.81 5709.44 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝK 1 †÷9EN›¤MÒîÔ…T^ßú˜ˆ'pÑ”/äÿóXl83opIÆT3f G‘TÉrÿÇ=îð‰Xeç=ŽGPk’X¬©àyÎxRÒ@µ*dòd§"Ov²è<€zò2W4oŠ:;LüéñRL%)Ø,*1Ï=>ÜÓ½¢ÏývøÚc€(…;ÞqÕÞéÇ 6Ë?>ÁÖðGlendstream endobj 446 0 obj << /BBox [ 3676.13 5742.28 3698.38 5764.53 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝOK Â@ Ýç9Aœ|šÉœ@pg]xÑ‚ `]x}§¥­<‹Éð’÷^ò6-c÷„Hr¦bhAER!·åïÏxÄ;$bLd™kÍɱï@=%Ã&7JÕï¶îDå¢zqTìBÎÎ$Í‚OUQ„”WŒâd¾rXð¸cTL RÃÉjÅþ|Ã4ŸOœåß!Np¥PçŒ/`ÜÕwý‘¿Ýþkþìá ©…jhendstream endobj 447 0 obj << /BBox [ 3665.74 5795.37 3687.99 5817.62 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝOIÂ0 ¼û~‰³ØÎ ¸Q< ‚JH Q|¿iiÓ"ñq4öÌØ³k82v/x‚w”#Æ`FŠÞ»Lëß_ðŒpÄÞ££¨\ª:Á¾ƒ ¢$‚ÉœPÂû¦ÁLI0ˆ2ÙS±.HÈtm¡[YÖ¹ 9ݨ<ÙOü¥ÁV½f%Ÿ×3Ÿ*¡<|há ,+¾ñPÞíGôfÿ‡ÑOp„ÅyhÎendstream endobj 448 0 obj << /BBox [ 3655.36 5847.44 3677.61 5869.69 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝÍ Â0 …ïžÂ˜8Žíd$n”TP $ÊõI©RŠÄâè³üž6'ÆáwˆÁ˜JÂ$9“cŒ¡¥åOxÄâ1Pr®Ñƒá8€˜:ÅŒš5“:^W2A±jžâÄNp_Τºªp%++‡Æs·¢e„?©ØªÅÌ“  Ñ*–±gƒï-z8ƒPcÇ'0îê»ü8@·ýÛ`/M»kªendstream endobj 449 0 obj << /BBox [ 3644.97 5899.15 3667.22 5921.4 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 173 >> stream xœÝOÁ Â0 ü{ O`ìÄq’ øQ PA%$(Ö'i•¶HLÀöκóùv¨àð‚'86¡¬¨>%Šèg2]æxÁ3>€IœC&RzdÃqoj”2†,L.á}» ä½!ÖŠ3iªØHØAqÛ¬7ú'ƒ‰?/8\å\|âz†•ßh„ö`;ð¡‡+xJÞ$â¥n?ÒwûÿL‚#|²“iDendstream endobj 450 0 obj << /BBox [ 3634.64 5950.87 3656.89 5973.11 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 173 >> stream xœÝOIÂ0 ¼û~‰“Ø®_€ÄràTB‰ràûMK7$^À!ŽÆž{v5gÆöOˆA™xPLÌ„ùÀÙà;BWHÅQÙ𠌇òn?Ò×ûÿL‚#ôsj> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝPË Â0 ½{ O`Çq’ ¸Q PA%$(Ö')¤-p°Ÿžå÷üÙtN¸ƒ°9ÊŠêS¢ˆ"œÉtÆñ„G¼“A&®äȆãÞÄH;O1àu]I”½ù¢‘ÂE([å4ͼ/ e aÕ¡J–W3ŸfLŠO…SÅŵâ2ãÍ«¢mÑ:Ú–ÍáûŽÎà)ysŸàpWâòãÝö_p€=¼|éjâendstream endobj 452 0 obj << /BBox [ 3614.08 6054.34 3636.33 6076.59 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 171 >> stream xœÝ1Â0 EwŸÂ'0¶ã8í Ø(¨ H”ë7%JÉÀ âèYÿÛß»ALpzÁ”]¨7´Ðu”P•{rÛþù‚g|“¨"“%É5±ã> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝÁ Â0 EïžÂÛ5N27Ê*¨„p`}\JÚ"1‡$z_ö÷W­˜`ÿ€(»P1´&gJ¨Ê…ܦ÷~Ä^IT‘É’ÄØñÞC㼦”ÐEœŠâe¡h˜f .Td`'i‚ŽrÊ͍P#É ‡ÊãŒwGU„²ãìÀ‰"ÞApçücíæW°‡¼N¸j´endstream endobj 454 0 obj << /BBox [ 3593.67 6156.64 3615.92 6178.89 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 173 >> stream xœÝÍ Â0 …ïžÂ˜8?v<7Ê*¨„åÀú¤MÕTˆ 8ÄÑg=¿gï:ŽŒÃ žà0YÄr&Eï‘Äõ/xÆ8bïÑQT.Uà8@H–( ‹’ Þ7õ”6Ò0±)q‘òŠ=”†Q–€c›®PÍ'mEO³Ñ2—2¥ÔŒ+öÐ’AÛužÿZ½‡+„’Y¢ñ Œ‡òn?®îöÿuõ ŽðDZfâendstream endobj 455 0 obj << /BBox [ 3583.54 6206.56 3605.79 6228.81 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝA1E÷œ‚`¡ ¥'0qç¸ðÄDÇ…×·“qZM< Jÿ)›ž•q|À$SVÔèN EB&Óš§ñXiâò¦`8;ïH M8‘9^?*"”:,\Txf#Ï…³’¥ÊC™È™Rl"¹7…Ê‹G™h!l ÁIýÃcáÙcÝbí¨{¿¾ÿ1ÀŠE4NøÆ]‰ËôÛ?>ÁöðeÚkÎendstream endobj 456 0 obj << /BBox [ 3573.47 6255.15 3595.72 6277.4 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝM 1 …÷9EN›4MÚî@t@Pp\x};Ì<‹¦|á½¼dÓ±2öOx€c*Šs&G‘PÈtý‡3ñX©s­ ‡bòD± ‰IÆ[Óq¦¨X¹PŠ#'Ò\9+¥²ò©:rͱFQ"åfÀŒS¨_LÂø±'§àMÀÄ£aYaQ¬KϾ8ÁjB4v|㮾ëû»í¿Þ€=¼ä­j¦endstream endobj 457 0 obj << /BBox [ 3563.39 6302.11 3585.64 6324.36 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝK 1 †÷9ENóêë‚;Ç…^ߎұ‚'pÑ”/Íÿ'Íjïpå(TÝr¦„ª\(úrOGÜã˜D™> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝÍ Â0 …ïžÂ˜8þI27ÊTB‰r`}R•´EbIô9~~~›Ž•±Âbp¦¢¨’3%Œ1rßáŒG¼C Žiâz§à8ô fF¢èb™bÁÛªâBâX¹æ‘YEW2mxªý^]xùOBÉVòÆ“Á(˜+BQp …BY9L<*Ú ­c^ú3á;Ä . ”Å9á wõ\äï¶ÿšÿ{x­%jvendstream endobj 459 0 obj << /BBox [ 3543.45 6390.18 3565.69 6412.43 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝÍ Â0 …ïžÂ˜8þk&@âF90@•@¬O€ŠÄ’èsüüü=+ãx…3ääLEQ¥ë(0çTȵ½—nñ‰8gL¤ÁõŽäxALÄÑ51 ãq^q’ÀÊ…¬"'²\Ñ”,U`ÕFf.1ÐøiñPL)NÙ°M’‰?/|ô¿VxO 6õw„ö Ô‰sà Wõ~¤ï—ÿ™~k¸Lhòendstream endobj 460 0 obj << /BBox [ 3533.52 6431 3555.77 6453.25 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝM Â@ …÷9EN'?ówÁuáŠëÂë›*ÓVð.f†/$ï½É¦ccp ‰©š–BEB¥dó;žðˆ7Ä"È2ûCÂqÉ “™+^וL\ѹR,ΑIÕÙlRmÜû„UrÑ¥#*•¸R˜ùí1M´Šfò ‹‚ UYy|xšh)ZGKÙ¾ÿÑÃÜBg|ãÎÏåÇ ºí¯à{x©kendstream endobj 461 0 obj << /BBox [ 3523.65 6469.46 3545.9 6491.71 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝÁ Â0 EïžÂ˜8vâd$n”TP $ÊõqAi‹Ä’ø9þþö¦cep‡2SUT)… c •²ÎïxÂ#Þ ÇˆÔØo Ç$ÅDÉ0k ”*^×™D9¡s%—8W*Ž¢dÖ°÷zñ@—ªe%Ÿùm0 ZÆÜHpi`L²vøð¤h#´Š6bëð½Dg*’Ùð Œ;?—ûwÛÝÿ{x’jàendstream endobj 462 0 obj << /BBox [ 3513.83 6505.63 3536.08 6527.88 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝÍ Â0 …ïžÂÛ‰d$n”TP $àÀú¤”– 1‡Äú,¿çŸU'Qp¸Ã”]¨DŒ!gJ¨Ê…<.ñvÀ=^€IT‘)&©bÇÛÁÄ(º‰ñÜdT(+V.”ËÈFÅ+k¤b ÷U˜X›ŠI¼q˜yêñRÌ!/øqàDfM‰GÅ<Å\±ÌývøÞ£‡#ÊÁ%á7õ~œ [ÿñ v°…'ÒÇk>endstream endobj 463 0 obj << /BBox [ 3504.06 6522.76 3526.31 6545.01 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝPIÂ0 ¼û~ñ’¤Î ¸Q< ‚JH ¾OZH /àÇ3òŒ—U/Ap¼Ã”“PÌ:TåL),ÿí€{¼“¨"Sè¤ÄŽÞF°È‘²cŠfäÏ-ã”#Z”IYp0â<áHâ ŠB™46Èrã°à¹Ç¬x3ê䊇Â'oz¼ð¤¨SÔŠ:euøÞc€#”Ä’tøÁMy§'è×|‚lá åøkXendstream endobj 464 0 obj << /BBox [ 3494.29 6513.09 3516.54 6535.34 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝË Â0 †ïžÂ˜ø§™‰åÀTB 8°>i)!BLÀ!Ž>?~?V=ãx‡+Hp¦lhÚu”P$dr«ÿí€{¼@ Á@–¸Øo#¨e'aô(F%|n=™$£ÆHcaU28’qå4rQíš 6ri*Ï=æŠÅÙØñ£À‘7=^> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝPK 1 Ýç9ALÚ¤Ÿî`ÐAÁqáõmu¦ñ.ÚÇ yï%Ù ¢‚Óîà8eEõ)QDç8SІó x&q™4Jù#œ'ðš™bÐld ¯½bÌUí5L•+Å\¹Q´ÆGðµ3I礼­;¬|Éx+Ö “ 6‡šícÏXxQ¬S´Ž6÷ÇákÎà)ù Ÿ ¸+ïòãÃöOp€=¼77k°endstream endobj 466 0 obj << /BBox [ 3474.96 6443.18 3497.2 6465.43 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝÁ Â0 EïžÂ˜8vx$n”TP $ÊõI” 1‡8z–ÿ·ÿªgeop…ŒÉUr¦„1'ÓåŸ¸Ç â1&.5ÃiÑd”3švJ‚ç¶á$†¢™)ÄÂ&ÔñÌF!/<…3±6ÞQôÆaáyÅSðn¨SühGÁ›/žõˆ:Q¬_)8‚Pã„w`Ü”wú‘¿_ÿkþláŒjRendstream endobj 467 0 obj << /BBox [ 3465.34 6394.23 3487.59 6416.48 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝÁ Â0 EïžÂ˜8vœd$n”TP $ÊõIi‚Ä’èYÿ;Þt¬ŒÃîà1eE•”(¢÷.“i}ÇñŽØ{t¤‘Ëá8€¨Eò†¦.¼6.ZF)zÒ •‚Mh¤V¹/†Ä¤Q¤@›€•çoÇZqä3ÖÉF¬Ÿ OŽyˆ*¨S/ß¿èá BIŒ#>qWÎåǺíß.à{xååj:endstream endobj 468 0 obj << /BBox [ 3455.77 6341.23 3478.02 6363.48 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 172 >> stream xœÝOK 1 Ýç9AlÚ4iO ¸s\x€AuáõÍŒó<‹6¼ðò>›†…±{ÂbP¦*(©2Œ1TR™çã„G¼A މ±ÿ$ÉFZQSŽ”¯ë‘DLââEûÌÖc¥:ÃÖÌÝuE0%æ•ÀŒ‹áb܈QÂE@q^>°çO&Âq¼ÿîÐÂcøÆ¿ËúÍöOë`oŠ2i¶endstream endobj 469 0 obj << /BBox [ 3446.26 6286.71 3468.51 6308.96 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝM 1 …÷9EN›ŸIÚî@t@Pp\x}g¤v<‹¶|!ïå5«žq¸Ã $9S14Í™ER!·öŽGÜã±&²àéŽä8 f™8£K ʆ—¥¢I¨ Z'¤2cP²™ƒ´4>L²î£Ãº²T¬^‚wE(›Lñ]—•gE Ñ:Zêêðý‹œ@)«sà7Ó9ÿX@¿þÛì` OQ%jÀendstream endobj 470 0 obj << /BBox [ 3436.8 6232.23 3459.05 6254.48 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝPIÂ0 ¼û~‰—l/@âF9ð•@¢ø>ni« ñI<£ãMÇÆØ?áS54-…2Š„JÉÖw8ãïˆE0eö;‡„Cêr"‰)iÂ[Ë2E5*ÉqŠyÄ™ª¬øä¯jm1kÓaÅSÆä˜Ïšs5âØD|ðhX†XËsƒï_œàJEg|ãÎÏõǺíß.à{xò%j6endstream endobj 471 0 obj << /BBox [ 3427.39 6178.58 3449.64 6200.83 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 173 >> stream xœÝOÁ Â0 ü{ O`âØ‰“ øQ PA%$€ë“”¦-ðp¬»øì»MÇÊ8<áÞE¦¬¨’zï2Eûã„G¼#ö©qyÍE| ê3 FN™ ]ˆ¬d†¢"¤¡âD™+NxÆ}¨P°Õ„™_mhøsbT4F«¿eCrV'FX盇é¿YžÔ_ z8ƒP’Ȇ/`Ü•ºüÈÞmÿ1ûöðh’endstream endobj 472 0 obj << /BBox [ 3418.03 6126 3440.28 6148.25 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝÍ Â0 …ïžÂ˜ø§I<7Ê*¨„p`}RJJ˜€C}–ßó‹W=ãx‡+HˆLnhš3% NÑ–÷vÀ=^ ‹` K\î"ÞFPc'ï0²&bÅsS1!vT£àGR؉»…‡¢P#á¦C3il*Ï3^ŠZ*A>’È¥™1ó¤¨)jÇ’ûíðýŽ ”5rÂ0nÊ9ýXA¿þãì` OGžj¬endstream endobj 473 0 obj << /BBox [ 3408.72 6074.24 3430.96 6096.49 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝÁ Â0 EïžÂ;qd$n”TP $Êõ›´¤ pH¢gýÿíx׋ Ž/x‚cJŠêc¤€Îq"Óí.xÆ0‰sȤAòØpÁ«pÑÇŽ¼á½©¤¬õ˜Y)ÄÂJ](œ(êÆCv8¥$Â%â®I¨¼öXµÂ´>ÁH¬i±r1Ô!6E{ øþÅWð½IÀ7ò¹ýX@¿ÿÛœà3´iøendstream endobj 474 0 obj << /BBox [ 3399.46 6022.83 3421.71 6045.08 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝK Â@ †÷9ENóš× wÖ…(Z¬ ¯ïXZÁ¸˜ _Èÿç±êć\A9 G·œ)¡*Š>ÿã÷x&QE&ORcâˆãæ,d#›Q‰x^f ±bå@A+»‘ÄÊÂòÌ}UH –…RY8Ì<õ˜ïŒfÊ?ꔢNjŸŠ6E«hS6‡ï=z8‚Q¶( ï ¸©ïôãÝúO°ƒ-<.Fj¤endstream endobj 475 0 obj << /BBox [ 3390.25 5971.22 3412.5 5993.47 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝÍ Â0 …ïžÂ˜ø'q27Ê*¨„åÀú(M…˜€C}OÎ{¶Wãpƒ+HHLÅÐ4gr …’ÍïxÀ=^ ‹` s®·‡„ãªEˆcÉBñ¼TœjBåDÊ• SŒ¨˜4ÏÜCU™-*8PÌÍ¡ñ+ãù㣸“l®Ä¶Èxs­‹©bîrrøš£‡#(eMU»㦞Ótë?^Á¶ðGkpendstream endobj 476 0 obj << /BBox [ 3381.1 5918.85 3403.35 5941.1 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝÍ Â0 …ïžÂ˜ø§I<7Ê*¨„åÀú¤*M@bIôYö{/ÞôlŒãî !2¹¡iΔP$8E«ïtÂ#Þ ‹` K\î"N#¨f¥ ع8yÂëGE; †…qœÙ‰sa©<” O$Þ:,0™6…Ê‹G™h#gl R’¥…g5ÅÚQs¿¾ÿ1À”²FNøÆ]9—+è·¼‚ìáðyk^endstream endobj 477 0 obj << /BBox [ 3371.99 5865.04 3394.24 5887.29 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝÁ Â0 EïžÂ˜ØNg$n”TP $Êõ›ªjpH¢gùÿïx×sd_ð Æ”#Fu§„"!“ÅúN<㱊‰Ë‚á4‚jRÊŒ'#6¼7gÅÂN¡[¸#M…]‹Så¡(J,{Ó‘…T‡×ŒEQ+LŒ3ÊÖD¬¼¶!¶Ž:öjðý‹® äjœð Œ‡rn?Ðïÿv'8 †–jâendstream endobj 478 0 obj << /BBox [ 3362.94 5809.44 3385.19 5831.69 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 172 >> stream xœÝA1E÷œ‚`)Ú˜¸s\x€‰Nb¢‰ºðúvFg¬‰'pQš|ø¬:VÆáWˆÁ˜Š¢JÎäc(dºü·îñ8F ¤Î5z0¼ bJÙ0å(žÛL"¬\F(ä^Á•‚-Ü×v/ÄÒtd¡è|áiÁ¨˜3œ(ág3‰5+^< &sy¶÷VûïáBYŒÀ¸©ïôãôný‡§ï` OqªhXendstream endobj 479 0 obj << /BBox [ 3353.99 5751.54 3376.24 5773.79 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝÍ Â0 …ïžÂ˜8Žít$n”TP $ÊõIK[‚Äâè³üž6-'ÆþwˆÁ˜š„Ir&ÇCC–Ö8áoˆcÄ@ɹD†C"ªÔ0ª[$3¼Ö'±@A ;Sö‘•˜WîŠÂ‹w®*<‘ÄÊaå©Ç¤˜3êdø1P¡dU‹7‚eˆ¥br6øÞ¢ƒ3e1v|㮼Ë´Û¿=Àöð?°jŽendstream endobj 480 0 obj << /BBox [ 3345.04 5691.18 3367.29 5713.43 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝOÁ Â0 ü{ O`b;±› øQ PA%$(ÖoÚB(ðp¬s|w¾MË‘±À$S޵iÈQ$d²XûpÂ#Þ ‹` è\^†CªÑ('L„”ñºž8©£jbâ™)ÉØ*î ¡¸‹®6,MÄ@ųÅÌX&–$bU°¬ÅªZ,pÚ_Nx¿¬ìïœA©)šŽO`Ü•ºüHßnÿ3ýö0#¡hÈendstream endobj 481 0 obj << /BBox [ 3336.14 5628.12 3358.39 5650.36 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 170 >> stream xœÝOK ÂP Üç9AÌï}zÁuáŠëÂë÷Õ~Oà" f2™]-.ؾà ÊQ¨rtË™ªrEÑ—Ù]ðŒ`Udò$¥'ŽØµ`f™8`ˆV‘:Þ7w24s%P&L¤qÁMá%Û2B,«~†£ÁG0oœ$ãzÀ˜Ø7#Ó3aùy:ð¡+e‹’𠂇R·ñëýŸÆ?ÁzÆi"endstream endobj 482 0 obj << /BBox [ 3327.34 5562.39 3349.59 5584.64 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝ_ Â0 ÆßsŠœ 6šv'|s>x€¡AÁùàõíæ6+x mø…|_ÒlZ6ÆþwàL¡iΔP$4ä¶Æá„G¼A Á@–¸¼)8=¨JCâcRŠŒ×:“)fÔrÈ f¡$#f2_¹++R­*,‘§Ê`å©Å¤˜3^¼"~ÜH¹êñæQ1±,3.ß¿èà JY>qWîåÇÚíß.à{x/öjzendstream endobj 483 0 obj << /BBox [ 3318.59 5493.9 3340.84 5516.15 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝK ÂP EçYEVó{Ÿ¬@p¦\@Ñ‚ `¸}[«mWààåqBîÍgµlïpå,ŽnµRAUÊ>ýÝx&QE&/ÒÇ»̔) ¦Ä‰Xñ²Èöì”ÓÀNj¸éæTê¢Â*…-><öx)ÆŒGPdœ<U{¼yP¼§˜+Æ)'‡ï=8Qµ, ¸éßùÇ vë?>Á¶ð/;j¶endstream endobj 484 0 obj << /BBox [ 3309.9 5422.75 3332.15 5445 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝÍ Â0 …ïžÂÿ5q&@âF90‚JH Q¬O J)pHâÏò{v¼êŇ;Ü@9 G·ʨʅ’ÏïxÄ=^IT‘ɳÔ;sÂq3 ÅÎÍ(/ËLL¦•;*©²qTV!Ö™U¡‰¸,*ŒImá0ó«Ç¤h Áƒ:¥¼èñæIѦhmÊæðýœ –$ã7õœ¬ _ÿñ v°…'j†endstream endobj 485 0 obj << /BBox [ 3301.25 5349 3323.5 5371.25 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝM 1 …÷9ENðLšþž@pç¸ð¢‚‚ãÂëÛ*Gð.šò¥y/iVƒzåñN7rų·œ‘Ø9)ˆ~¾§#ïùJuŽ>iI"O#™‰A‹í/ËL€f®œ`Ú¸À¬²:XžùPšàý¢Â)BY8ÌüêÑ=$ðÇ!Š.z¼¹)ú½¢OÙ¾ÿq ²Åš{ò¦žó ë?^Á޶ôÚCj0endstream endobj 486 0 obj << /BBox [ 3292.66 5272.84 3314.91 5295.09 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝÁ Â0 EïžÂ˜ØNâx$n”TP $Êõ Pš 1‡$z_ö÷WGÆáW™> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝK Â@ †÷9ENóšGO ¸³.<@Ñ‚ `]x}g¬E<‹Éð…ü«^\p¼Á”£Pçè–3%T厢·:à/À$ªÈäIJLqÁ4GbÇ Èž?2ÂM»¢Ì•b¨H½ñfÌdò®0öêÕÏ=žŠ%S”›ƒt±z·/.ŠeŠVÑæž¾öàFÙ¢$¼ƒà¦¼Óôë?>Á¶ðŸ3jendstream endobj 488 0 obj << /BBox [ 3275.68 5113.55 3297.93 5135.8 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝOKÂ@Ýs N€3…™˜¸³.<@£ML4±.¼~iíÏĸòÈ{ðÞ®æÄؾà ”©$L1g2 …4-³»àˆE0P2önA±k!Š)V,‰4ã}³(dFÉL–ÇH¹ X)/°q~aʶ!¥À› ?ŒŠiÃnOp½À•›[_|à ˜=Ì„Éâ¬ÿŠÐÀÜIT6|ãÁëö#|½ÿËð'8B³ˆh¾endstream endobj 489 0 obj << /BBox [ 3267.29 5030.64 3289.54 5052.89 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝPË Â0 ½{ O`b;qÜ ¸Q PA%$(Ö'-m pp¬gù}âMË‘±À$S1ª;e Y\ûpÂ#Þ ‹` ˜¹¼9=¨XC˜BdʯõÄÈU²’¦‚S ÆGìyÅ]a¸RôjÃ3™T +ž<&Æ> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝÁ Â0 EïžÂÛqâd$n”TP $ÊõI©RŠÄ’èYþß?Þtb‚Ãî œ„Š¡…œÉQ• %[Þñ„G¼“¨"“¹ÔÛ9á8@ÐÄ”­ÄDžðºªTÓ¬X9ëÄ‘JªìLœî«Â#‰­; iY94žg¼­"5ðÇÀœb\˜y´­c‰=|ÿ¢‡3Ê!‰ãwõ\~, Ûþí°‡¦jüendstream endobj 491 0 obj << /BBox [ 3250.67 4858.63 3272.92 4880.88 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 173 >> stream xœÝË Â0 †ïžÂ˜Äqìx$n”TP $ÊõI)} 1‡$ú¢ÿaoš(»܃FrAI¥!spR™ßþ„G¼A ÈŒÄb½-(ö$ÎLÙQŠ:YÆëêÇ„ ce%Kr­\ËÌgn«C•Š®µa±¿aL´# ©ãbÔ@9¯¢GäSù¤˜Çý$|ß•¤Ñð wõ\~lÞlÿoóìá hŒendstream endobj 492 0 obj << /BBox [ 3242.48 4769.68 3264.73 4791.93 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 171 >> stream xœÝAÂ@E÷œ‚ Ì0@O`âκð61ÑD]x}§¦­³ð.†É>|6½¨àø„;$6¡NQs9¦Ä™®ÿã„G¼“¤„LêR£³ác„œT©*=˜¯  ÇŠAe⎉¥rÉd²òP%ȼé°D‘š +O&Á’ðB®øàBÖløàÔ¿X˜ë³ÁEÝúà ™"›8¾@pWßåÇáýöï?ÀÞZ0g(endstream endobj 493 0 obj << /BBox [ 3234.3 4678.69 3256.55 4700.94 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝÁ Â0 EïžÂ˜8vg$n”TP $àÀú¤”” 1‡$z_þߎW=+ãx‡+Ä`LYQÅÆ2™.ïí€{¼@ Žiâr§`xA¢YÍ39ã¹Q²’;JÔ@bg qâŽTŠ£+©¹©è”Lš„Ês—£*J©ÃO‚2nzÌ<9êµb™ûðýŽ äbœðŒ›rN?VЯÿx;ØÂ»²k endstream endobj 494 0 obj << /BBox [ 3226.22 4585.8 3248.47 4608.05 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝM 1 …÷9EN›Ÿ¦í wŽ  : (8.¼¾©Oà¢-_È{yÍj`cïp ÎT Ms¦„"¡[§#îñ XYâz§à8 "™¸Jcq*Š—¥â¡šTQ!É3;±ÎœH­ó¡*L¨fY:Ì)ƇÆmÆKñ®0eÇîs¢$ˌƳ¢¥è=wsøþÇN ”Õ9á7õœ¬`Xÿñ v°…'uÊjôendstream endobj 495 0 obj << /BBox [ 3218.24 4490.92 3240.49 4513.17 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝKÂ0 D÷>…O0ÄŸæs$v”@P $Ê‚ë(J‹Ä X$ѳfÆŽW½¸ðp§iˆ‚âì–3«†‚èí¼ç+ˆ*x’z§yȪÙ» Ηe%A„+;¬¢´{aÅÆ‡j0‡/–Ñ¥E@ãw‹·cªx‰(™[‚Eö¹Ç‡_ŽiˆY0ÍØ¾q ²EIü áM=ç è×»€mé Òipendstream endobj 496 0 obj << /BBox [ 3210.31 4454.55 3232.56 4476.8 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 173 >> stream xœÝPK Â@ Ýç9Aœ|š™ž@pg]x€¢AÁºðú¦ÔŽ<‹™ðÂË{/ÙtlŒÃî É™ZCÓR(£HjÉ­Öñ„G¼A"ÁD–9þœÇTXHͼ!/x]ur° ;iž°Q)…É´â>&Ä©Y4M¶ÏÓ@íDe¬Gº•ÃŒ§%è©ßß[ôp¥¢ÎŸÀ¸‹wùq€nû·8À^{ iÀendstream endobj 497 0 obj << /BBox [ 3202.43 4491.89 3224.68 4514.14 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝM Â@ …÷9ENó7'ÜY hAP°.¼~§ZÆ žÀÅÌð…÷^2Ùtâ‚Ãî …Š£[ΔP• EoïxÂ#Þ€IT‘É“Ô;qÄqSv²€؈¯ëJ&ÎX9ÓŒ¢Tý¦bbã¾$SÔ•B•RZ4~µ˜KÅK¢°%x1Êòé±ðìxÑËŒ-àû=œ¡ -JÂ'îê¹üX@·ýÛ` :ihendstream endobj 498 0 obj << /BBox [ 3194.61 4578.59 3216.86 4600.84 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝM1…÷œ‚ ÚÒ˜¸s\x€‰Nb¢‰ãÂë;?NOà¢4…Ç+›FL°{À'¡bhêNCàBÉêÝŸðˆ7`’ɲ 1s¾•’(*ZôBÃÃu•)FÙQ3¥<²S #GÊZ¹ Â䫱ÉMXx15,£± 8S”Õ„™Ç†ÅûâãzøúE gPrM’ñ ‚»á\~, Ùþí°‡>’j‚endstream endobj 499 0 obj << /BBox [ 3186.88 4694.9 3209.13 4717.15 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝÍ Â0 …ïžÂÿ¤N27Ê*¨„åÀú¤”&BbqôY~Ï~›^‚àø€;(»P,%Š¨Ê™<Ô:áoÀ$ªÈ¢”ÙqÁ¤H†‚Ć×Ö!Îh’•r7sGj3'b©<€)qlÊ‘TšCåeÅ[±v˜²cuðì”´íøpQ¬WÔ‰õêÅà;Äg0Jæñ ‚»ò.?â÷Û?€=¼Ø€iendstream endobj 500 0 obj << /BBox [ 2101.45 6455.55 2121.86 6475.96 ] /Filter /FlateDecode /FormType 1 /Group 127 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R141 128 0 R >> >> /Subtype /Form /Type /XObject /Length 160 >> stream xœÝÁ Â0 EïžÂÛqívΔTÐH”ý%RJÒVb.‰žåÿýÿ¡_ðeê -µ-ªrGnõŸ®xÁ0‰*2YH~ƒ§T8Q tó†Âñ¾™SÌ$3q6r¯> stream xœU PWíf†éÇu[d§G +ñOü°*…FˆÄ hGƒN+”(ß™ ¨þ⣂ˆ0(-(Á¸e¬]u­¤âjbYj6›Ï®Émxdkß@’µ²»U©WÝÕ]uë¾sÏ=ç^–Q:1,˪‚WE,u|ùÈ/±òËNòT-Û†Ö9OeÜV­œò´zPj¨•í/óéñèLsCƒ;£`YcêþSrfJ|lœYçõªÎgéRß9º×,Xª{=)&%>Ê`ÔÌq1I3ýIÔm2EÅǘ3uÞ~qfsò²ùó-Ë‘,2e:z¤ÏïgßÌ0>`.¤E¬­zbÔ·•¦ÿ.ä§ŠÓ¸LÈ©)+êZmãñîÄ«PžgqàïzÍ™GÅȶ„ƒ~UÛ¯¯€.~ð)Ô¢òÀ†ämqv5EË׬£˜væ_Âa WÔ°ßQ6Æõ*0Uœ-‘Ù¸)Be›»ý¯">ê©çˆê«¬?îyïŽöjÄV.063e# Öi)§ùv$/a¼"üÔõ0nyøVÿÂÚ«Z|Æ‘àÿèaGØÏ,_6Ý‚¿ôjWrtÈYâBs¡]ÄÑž‡$?”Xœ…^ ìš  ³¤Š+" è!,Ä•RÂõè<òМçK‘‹ô çG…Cœ9Ͳà”ì&±rì*”U—–Ý^âLE)`#$€q4wÊ Ê m…`-È%jR2…x`½sŸ¤ZcµØvA,X`Ãhä s„/Ï8¼¿<ëápyùI^#ߦè[p¦½ƒ“ñ÷ 2°Wxð™F~cÙ’ÞÔÒT×qæÇ‹Jµ%u.»#ÖOLàÈ2â·“(¼qBÆí{}çºÅwaÛ÷ZIu²êëöÀ>q]1mXO\ú…鄇Âù®s'>Æðò1ò©50tÀ¡gwè9yh­0&ØQ¦G¾è庚¤Ä?ƒ'.øöþ_šõ”x/ßâ÷¡MB}sOóTøî@Ôk ž+îÞRh`ˆjKo¦%ÖRRÏ´S_¼“rò±,ȱ€-3WkÙiÚ<™øJ×`1º£GÙ5[ÍZd³‰ûs ÷@6ÿNSjKSË©®gDÑdójjjÜÇ^¸ì‚t¨á¢và|e”ò/Vä¸íˆƒMåЪŸõ·£y{Õ6z›ïo"ÏgspÎ+u ÍâVƒ‘üޏŒÜÒâ¶E­£Ñî€ê›×‹/5\ì=•çá t¤5EÓÚÚ©V·â’±cý»BNÆáT%œ®µ>Z{MŒ¼Z®§Vø†ªÃã«™èK/~w¬Æù™Öüì|Ñ’¼ÞA€IlU–\>ˆ¡þ²-~xS•F {U¨(ÿ+Îþ“‘;d®^ÕYJGt=(@çX™så;Ÿp4äð’ Âò½ªQhòÃqíù…À/S·è$¾Ð`»fýqo _XQ±cbØÍ±¦\ΈXŸ˜¡M{¼ðÀ òÐûäeñ¿vg)žt ¶²¬ø?;ëW„pš½•ò†rÜQSQ©"o—qE9Nëªô­Q»ØËÕjt9­_¬Ö0Ì¿Òäendstream endobj 502 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 2746 >> stream xœ•V TçžÈŒ–bKœ¢¾:¡.µ*"j+b]@** X\ª¨,bX!¸@ ‚I.‘Ed‘((*Ê^T\ÀŠU¤•ê³Å«­åÕúýy=o‚¯ïÙsÞzîœÿÌœóŸ»|÷»ßa6‚àñxæ.î^ަ—ÙìŸxì»#Ø |À{×›O F/ušàÑŸûµ%XðÁ¬ú] o+Tñ6Š|Þ"ø<ž4Ré"‹ˆ“‡+l>˜f3ÛÑÑÁÖf޽½£³T, ð·q÷W‹¥þ îCb³V"VÄÙ|°0X¡ˆX0kVLLŒ¿4ÊN&Z<ÍÖ&&Dlã%ŽËwˆ·Û¸ÊÂ6þR±)M;Óá"“FD+ÄrwÙv±<œ ëp—¹k”•WˆDj?{ÎÜç9Ìw´#Ob2ñ)±–˜J¬#ÖK [b.áF¸ÄÛ„!$Æ4aMŒ%Æã‰ÑÄXÂŒHå¼$ÞO#|ø¾ÿ¾Y®ùózó_ͤ#©"(udÜȯGùzñÆVmÉv‘57îÑ[!³Øc-¬G(›þå«Ï;/æx{2x¹U + Ù¨+Li‚&ÈѶiZ,&É ­‘BëH¸ •²…Aœ³ ìÀÏuŒÒ „·ž‘xŠÒ\B^ËÜç-ÂEÿÖÑJ%4ˆ,wFgyílrŸ`£ÃŒ^çß oÀóñGØoC ð´-ø š€F‚Ì=ñ°O¥%b[lá<¨yxe:ŠŽ ·¶»?¾pÂóÊDºø”ä ò ­X„âÉ|ÈLاV«’®v¼Áˆlõì;Æ«—=¨¤ÏZ¸­Dèê çŠê€ê½4X°|îqyM”(¾tPH-7+¬½ zxЬ‘Õ´çxÔúMÑÛÄ"áÑN`ªúFz’Ÿh(ø¿T;ÿ{^Þxyß¿+Š£Oe¡©HÀhIvWDQÅ;K‹KW‘Vùxúû»+¾?“xâ¿À·M—“Ò '¡LÛ9)†\ªÎ:Î<Œ¨ÑˆªyÈæ!ò6ðÙ§ƒ é¡ ’RÁ-2P4THj”‹…DP 8 FmòFÚïÏ>.Bš‡ä³¬°y"* æ)æ3³Qš Z—ÑÈ +š úµy˜¡ KvšRÏÚ—ðª[Q|+=cÐ&ì“5Ïh4*UR²¤D’µwlèÒa¹‘¥Ñ¢jIí¾VUëÞ|uÉÎC‰úXSs߇=S"¿;›À¨iÓ€Ú‰q"<†Ü ªìô””Â&5=+'-­n[ƒZÏõdôéî®ú˜ŠèRQÈÑ  çÜÈ´¥9ÐN)­{„ˆŒùr“’I%r!£kÀ$¥Ñü"Þ/=h¼zÙÉ´OA«e¤Ö!xòt5%¿‡+IlvGÑÖUsåÓ.[O:K‚‚VÀýU‘–ì!¥>¦é+ŸÔè­N÷nîG÷t¬…›•èûn:Í¿2è4PúÎ÷EçeëH%l ‚¦<¹ÐÕ>§n>¼ (‡eþ«$Å;Ë+ ‹ÊOû¦iEåM™•@µ¶‹çŠBIa9±^㔼"Ì%8ú3 ŸEt1\Œ»P{.×@©¾¤§;I}·øV·\m¿Žf¦3–ƒ'Á8È3šúÍ5›½Ow^ìHÉO¡Œd¸zìLñÑq –íáxˆ…Dubò>܇/E_’ÇuY·˜R£ÀG½¶r¶|˜.—’¯øRò_Îs|i€óP?̹XÃq-!‘%2Gž¸ð 2s7(Ç…o‡8Ž£g´@=”s k¾O®†=™a 8}7ÖrP­WQ«µ­ÐÄ{(ë¹ûÀFkáN‡^Òè åºÌÂÔLÝ(ª OûÈw5~W„x»éï+z/B/õ#~óžÊàîÐûŸé6ráMÃÈH÷)¬F‚n8"NÝ_»áX¾MâÆÀKÔ·‡ï•¥C6';ªD­(yµ$Ja ,JÌW•¨®%Õ'v¨º0¿†²Dµ¦±®Cˆ°úÎ7¬…ýh5ëAãɦ‰½’™ÄMlñï[¯+N9yPͯÐpÛŸvB$üé[KWE•I% yxx©ÜXUVVÅ ûäÕñù >Z=èF¿Ò›aÊ{]o òµÍPÙg¯ ~é±6k>"z[.+ؾì?‰þ°äFþO—_Û÷Àz|GY@öVpoÙ†„‹ÇàcðþlÇVJxGûƒàÿYì¡hý •žw²åöñY)ºIC—º/ø+ß'KÊ>OXå;#Ì5y,7ÝôÓ çõîj€/ ÇP÷¸ª+ý+¸Ma ¾NKÁ%7™ï½}Ü(^ƒo²Ï=¸RP µÐSh—µÁjp‡½kv`ó^9P\pÃãÜTÅÜâ£öA!­×êäŒûªY JBÂe8[N å’ê;&L"8vàœâì!û»šÚ©9559º~0òZFaùì6´Œ– 4ñ‰kâw%©\!†SGWÁOÐ|4ñr ŒC¤ím<“‹ìí7NÎ,©Ê;Vµ£D’¬í~¦ìÆ•#g¨±u²xþæÏDxöV*AŠq¬P`ÍÀ‘M,G£žwpB…xhS¿ó€µð7t½ ûkÎÜ„/©[ó.Mš´hÍ’Ð’ØÊÊââÊš¨Ã!LyÝå¢f îæ­Ü"MÚ,‹$>Ášp\£D „UiµÊññ!ŸiÜ«]f‹Ç,Ú;=­ÇGt,Ù ‡j꨼8\.Ýí?§ßQèíþ‡Œð7¸çÚ3£ø¦h¼‘õ/â¡Ë=üJ´‘– ò8•NL´DÐyà:d@tCç0„Ѥ“i©õ §°ÞddÄ&hµ{T >:H#`æCr¸bV¤¿ûø$Wí#$íw{d-BãÑ·4 dµW|^tªùBAÃþÒ *pWlDdAŒÁPXPu> ÍÓø=,ÄQ"᯸ Y®x‚øÏûÑX$œõ›3Â!Oð –yRè-ÜK{AhcBel½ö.äQ]FD<Ík÷#L¡¼a3gÞ±/ß}Ãü‰.f;nóÚOúùl<û’ÎÌâ~,Š)¬`+Pç¨ )™ ‹Í ‚ÔÒƒçs²3Ò¿\n· f`kü^ž€Àkœ|áLÓLšZ‚¨¶îaï†ÁÑ\½g#›¡)ò¬µðrb½ii¡¢ŽS_\?qõVÇúeË<·(ý.º¥ìf Ü¡žÌ<7{¢£Ó,qnPY8“›¾ÿB %|0ׇãø÷^¬àˆCýðgDÚx–®ŒÒK¥QòpiYTÕ+m.a]òQxVz‰oË&£zÞ`F™9YŒÔ§[XôäY¼Iv½?endstream endobj 503 0 obj << /Filter /FlateDecode /Length 2410 >> stream xœ•YMs#7½ëWô±µµjóû#U98ÙT*©ÝTe¢[jË–‘%ÇòÄ;ÿ>$» Ê-×lÍaz(‡óg'Ù úSþ¾y\\}±Û¢Û-þ\ÈôkWþºyì¾[CB©.Ñ)×­ïy§ì¤ ƒ—ªsÖJÛný¸ø½_/WbPBDãûû¥t4Ö¨þŸ2huZ®´‘ƒ®¿Áª Zi×—Ê ^x×$6FélÙ‡ïØH[ðøÚ¼ÐªðAY®øxÈšmì±êEPÒö›O¤XúÛjŽ9ñ«Q8/%üY‘ÇÑÝ?%sщO,;!t쯟±¬¢³’ŒÐQcˆ¾ßl±ld&pö$ácÁá›–‚ê#‡QÚX?Û`LªaþÛè$ü¯î1uûjÙ>T§w£‘>NEeÈ åõÇ}ò\­:‘í»ÏÙ@$‡HÂHÓoR`‚Q.‹y3ÙçòÍ28YÄaï–ÿ]ÿ¼XI3àd²[I9Dke·ÞO›”‡¨D,y(ÀØW`0—‹5áí-LD‡¨>û&llNK:\ð®].'Ê b™±œ|çYhMæŒôývV–ŠãâH&"òÞ©)m²0*Ûe ØöVÆœž¶±Ü½S8ã¾”™h‘ÉÎÓHJ2ä•faaxÚVucTDUBêB‘‹øö1óSС?~®‰ɶBˆ½ù;F ²MîHéK=¤8¤2K*>-­Å™áÉfÇ1wÊ*ˆi­9–ºÿžü QCš –A(…cÿ’ã¹mÈŠrú&Ý /§RŸ<¥õß‹õ?~Ϧ¤ÆëÜ2 s<¥&€êRìpè¤KˆàtîKÒZ—ZÆY›‹&(žöyL8ûa½øu‘{ïó;½Út8…×÷jtdÔfìpNœÐå^m’ð]¦þÿœ”0ƒ šå }V |è ‡pXf²P€ õ+r¤4ö¼}yiÓ`C­—Ý“„¦Æß4*ÆÂô3FVÜÜ1Ž´»$a<—å|}¨4΋(““·&a•ÌA_*9òÝ _€àp 9„|Ô'Œ»è3H¥<§—l&6|ÈBtÊ8•[=ny\LÝ“I”ØTÓÂmr-·UK"D"éÕ!~\¢C€‰·h­dí(ìx–1üžªš>¤œån ÚöiptÑj–°Ú4Xê^Ⱦ )çË2@iTÄ”¼Ð¯>hŽqA`>ŽuÍjýf©©Aº?¥Hœ=™•øiÒÄw ‚×Ä déúeûmf+à4ÈÔjÁ»²²F„ðâ‚TãSØç@vDT¡aetš•ÏÔÖí8f)ø¯@ )5¿üÄ´~Ÿ¾sãY/©…ÓkkèT#Æ€B•€Φ©|–2ZvŽ¥‚á<#M t- Yê PêË´ÁGÏQA@!ö׬뜪^¶^nªHw4|"¡ÆK i猰 O!‘sÔüø5‚k®mæ&¢AP;*Ð_êd ‘ê7%|`‘F³Á†:Ö¨/p_>Lád±àT·­gþ89w)ôµ4 TZ¢:Ug¬UŠ`ž¯ê„•XA«€q>&±9€·ÊdÖq!äÕ~9 µ™qmHTøÛG¡ÓÂiÔá‘3îGªOa4b·a=' i9ŒÔÌœA33¹0J‘ñ¹»Ü]›áqž‚2‰Yr¾4Œ/Wĸ53§|¨ÄÞ—iÙÆwŸḎÈ1êß±nømñlhÀõ/ÆÄ3^»ÞVüÑv`uи÷ü'1Q¤'ŸVUº™þœZ*æ'äì>Í ÎRõ°s\šXY‹úB¯¨Ãö_5n ä3:qyÛx'>³Ç >@OÛöÙGcêq“ˆQ~³³ÞÙ¹.f<‡Ó)ûF}ºâ 0Uëøý7܇yè<%8Ö¶­)l¢{ù]>—B§.mJyå(›. Q5NPioÎ[âü£×W4¼‰ýR(l EÓÄiT›‡^IÛ_é+I€ÀÏn•5íä˜c‹(o`}îøy9=sž²VÚ➢~ljeîÉŒ -Ÿ–ÉófGËN6Ý綸!uo®TéNÉ_?Ÿ‹¶ çËsi aÒÕ<þ6ïré‘TÄ Ã°º¬Ãe3Ÿåû÷G±ˆÛC|Kf›§ú4s†ïÑ…<–ƒqöõŠnasD)%k¢ª·´[dZüU5ãÎïÕåÁ(=ÝéùÀ·OC“@Œæßö5çXÛJR»7뙨Ϩ==‰hè^¢ûq!µF· T! Ât åAkvZØ/~»ø|¢]‡¡ßû³ÿDcXŠ€Ãfr÷UåZ:Ì·^HÚkiqC»PÑçlý61†IÈ«¡"Ë]£‘_ÿ€d³5ù‰X€ŸÀ$uvó¾ Ü•qÝK«ÒL]~b~}“î°Æ)ß_1‘+&rÃÖŸS?T—&rÈ"^jjĤÍÔfP¬Sèµ24öŸÙÎcÝùGº*rSE^˜È0¯…Ûß1‘«*Â}Ù4†êú§ùCs·Uã·LäüëÜ蹞wý‘‰lªÈ–‰<0‘=[ßW×uù«tˆÓΡãúqwc§±Ü€ž&ø1Ñ2öÄs‰ôJÒË·"3(™_^ÊH)^*ãcŠ’^5ix¨u™è"ê^—ÿð*ýx`23Ï/+\‹œ6(_¬)KÕÛK³\ÿ‘£ôëâooMGÒendstream endobj 504 0 obj << /Type /XRef /Length 514 /Filter /FlateDecode /DecodeParms << /Columns 5 /Predictor 12 >> /W [ 1 3 1 ] /Info 3 0 R /Root 2 0 R /Size 505 /ID [<41b221eca90e0ad1e2707b284decacbf>] >> stream xœíU=KAÝ=5 ‰ ABbüèµ°Sˆþ+mÒû¬m,D°‘»ÍíEmì´³…¿@Sꈙ¹ƒ{{“MHŠÇ0»÷æíÌÛM èh¥–ÿT@ =Ã)Æ¡ªo¿ŽâR—f:xŸÍtúq¨¶Îh¦í+šæú%aû‰°u@¸ùL8ß%l^.ŸÖ á\k„ºýCñÊï¿%Ô‡„Á7a•™ö9Ï<õ;Âr“« Ä£¿7ιÖ'áÚ3\p-®R¦XWn(^=e¶cfø`†#ÂÒ/ײ¬¡—£Ž!ÓçLGbOÂ1c_e™t¿…*Ä ì7y­Œô¤ÌC,ô¤±Œ…êx"+ø±¢«‰ÈXèR‡Åo=T%À€ª”¿/4cŸ­¨Câ"›·«!°A?³>÷&2 fœ2f`'œZgüÆ=^íˆLg|€>G‚ßx܈³FŸxV¢7P?|ëLÖW|+éܬˆzpŽ=qjSœË˜=Ù½è.©ÐNÔ _ŒDx » ²!8SVÄž$ ?‚ ª2Åé]á7ù¾¡‹ÄÆøÜzÔöÅìð=¸ß̨Xѹ}¡è@ºê{ ļäkã¼'Ò·¹'µ×E¶XÅ» ÍÒùÆÃ€ï6úÖ‚gdòÎíÿÎÝÇ©Nç¦ðÿxå‘°Ö ¬¾¨!›ä¾ endstream endobj startxref 288352 %%EOF RcppArmadillo/vignettes/pdf/RcppArmadillo-sparseMatrix.pdf0000644000176200001440000020314114755121433023476 0ustar liggesusers%PDF-1.5 %¿÷¢þ 1 0 obj << /Type /ObjStm /Length 3174 /Filter /FlateDecode /N 63 /First 515 >> stream xœí[ksÛ6ý¾¿ßšNÇÄ;ÝÌÈN“fãd;7| %Úf"“.I%îþú=H‰zY’íìtg2š—÷àÞ Ð‚0" ç–("¹ š(f‰!ÖpÎ$#ű% áRi<"\%® áÆàFnÑ„ãQ£\¡ 5ÖU6DJe‰ŒÜãM’áœÇ’F4œh¥,À@¸ÄÈÄ@1J$Dhb,‹‰0$æ÷1‰%„ Kb•à>!±‰À±Õ8sbÀHA,7 ˆ•*±Zk"5± @HCÁp“D”£§Ö4ú˘åЇ»À\§˜`x"œb€M¡ÏLá%JáB£«^Aïp=f•Ӣô  rœäD£¿Nrb(êd1ž@2Æí,¬‚Np!9×VmÜxÄ(‚d¨Ü ɂǨÉBB™~\4zQä"É"0t‘c 9´Š É’üò ¡/³&¥MJŒ†Aúïë¬ ›¼,Ȥ}ö4oÈGMšq^d51qx~”^d/ËQFèÛ:›–úÇ5ÌÊ×yó×5ÊðŠqyA?öoLšË²"~DI•¥îmOÒ&#žü,˜ÐLÀ²` Bî1óc?tõ\›ÃôMvJ¾æÍ%¹„ìªÊÎQü"ûëkYj/˜6‰;ªÊÑd˜AÞ³£Cò첬›zXå× F&b2â¨s29û” /òMÞŒ3wÕöà œ ¨A_äxi§)ãÿíXÿ7ñAâá$ü †éN;µu*вq‚E)‚P¤Š V±2ˆ•A¬ l‹"4°¡A$¡A$G, =I‚”$HIÚÎt½i»ÃÚþ0Ñže{VíY·gÓžãölÛs+oªžV^« Ø{nåñVoåñ¸ÓàAY4Y…ñV50ìQžî—7P¡“n 3F‡?:=W¨ÚÙçqV—“jÍ;µÿzÓ<;iœí¸™1?D;¾µ&_•Ó¬Tzôä)†.»qÜxü¸?ŠKƒ(í2ÐvðîT°>PÁï´‡Š? *™ô@)vå)¾Byâa`*ч)ï§:ù@˜T“¾—êÌ Õ©‚÷aÚû©N?¦¾Õé{Y^euæa`ê¾Õé»XÝ~Zg¾5<{ôþùO¯ò«³I}’‡{ûåx„·Ãr”„¾Ï‹AQç³Oóªn.ÓÊ™šñ$ ÎþµkéaÚÖáУs…á ðQ@ð>5—ÞUÅÎ Â_­ÍV[øÅ»Ã Î0Þ'tRÝSÄ¥`Z¸Â<_¬»êçÞåÊûg 9¡Í ³»²ð–îyw PÆ“~‹€|]¶ý¹¶§†WåĘí-]ÿ–å—Ý-†ÁYÆ#ºOèú+}JŸÓô%}E_ÓczBßДžÑ!–WW)ÑŒúæ4+Fi}IÏéyþ%£ç0FzAsú™Žé-hx–´ÄßkŠP*/G´¢5­³/YAëü†6´¹¬²Œ6_K:¡_è ý‹þ'«JDDÎfâ=ßHŸŽÓ‹ÚÅØÞ(ö9ö’PjË»ž| ¥Oóqæ‚ÑÞò*½ÊÖÛòsùpP\ ƒ1¾Ìë†ìíÎ=i²«wÁRg–Ù3jzÚêSc†X¢Ð¯¯ß¾=øÉ©¹Éªý7{ÇåUZô(dºyJ0~‰8f‘8x×vÄѱº£ )„@ʇAÁˆ%Ov$ k!}tÓý}!p h…àPljKÑá´fföFµÒ’€#ñAê’±#øÓ¬\m$ A¨t¹Ÿp™ rGëk¡/Â"sSî©õ-´Ë˜—HlÝY{®%¸x™ˆªODƒ¬GÄÁ”ŠÏAÃ@Á÷ž„g“ñ8k<Çe±ÄHGÅ96^Rd1— Û:Z:2ÎΛpUy)-Wÿ¤NÊ&}…î&Ô D¾ÊŽõ”þº†Ô¶#µ™ç´ …‰Ëá£N÷‚æÀéuäÚ–ÓxÍN+¸ÞeN½8|ÝŸJ޳‹É¶n‘-³Û.²{k·èœ†ôÁ¡F^ïYŠ;wvÇvN²«d´¼s.Ç:w©Y¨ã$Ì\¦ñÉ{¿~w½ÎEùƒÍ®û¨ںÕ»³{ÏwWŸ³¦¦öµnf…¹pËàY5ïgÆtœÕõ]cÇ[S¾I1ʪzXVÙÌ«,û±Ž±{*”j${N™ ”å‹”]Kž[IkYGZ»1Tj-ž Èy:®³®Élf‰ÔÇ_ ~Ÿá p¶å´^æ´^âôÖŽg‹æy¶r_x¾®Þ¦:}>ÎßÏc¹mfXÏþ]ùwìBµM´r„Ê»Ôjru{Î/œZCO‡6ªZtMBÜâš\\u…÷Öû‚¯³§-Í<Ùœp.ýêã ¡oŸwÍÚ>ÿèÑeÓ\×?Sz‘7—“³Ó=Ë‹›<-.ŠüG¿¹_V˜ÚõNæWEý '>Tü ÈÝrçÐ-_jÅÖÇ‘Û6áRFì·&2ÌEë33?Ì‹ÏSDnáõ>Gu6ο¤EùewÈÈ[#Ï0#Žw˜Gyõ9ÊF£l|6Éš&;ø»cBFLÉæ˜¥þöŠn.ójôf¹;fÉ` f¦giY$ÌŽ˜W¿w7`C3Ûº>ýýÑ<²n‰GâÂ蘑b2/›-‹\`©UYæ7Í#âjD±J¾14±ãf2!"·Á¥Ž,æ bYdˆÌô™H*÷MW ¯]ͺd>ŽÜ2‚p( Py)¡¶´Áé–KXfÕA?:€Ña•X‡õQb}â¦W3ÝOŸíبÚ“ãí6|·ÉÚ}q·=›ýÓÁàõÛÅun7÷o›ÊÊ¥™_.G|ëT6¤”aió/,$u;0ó?+å\½u Km”0ÝG™íªô‘lޙɹËRÐAµwij>]°¹ž[— ¹*‚ßòÔ)÷òZJ{7·™Ã¶ë)rs²ºjëãÃé‹×'¿µqÈaƒHd—•åeÒnO§g…z‡¸v>B¼-J]Ž|ê·>ê]Žwk¬ŽaÅ\ ëo§6¸&OÌÚ¶—f°ËÛºª·<ˆÀµo©Üg ÞR¹ä~ímÞZ]Í¥·`­Ý'`³U•5&³eèŠ(kc†¦vO†UZDÕÞuUº/¶¢²º€††Ÿ1ûþóxx}=¨®ÒQ>—»‡,’‘Šˆ bYÄ)@§$Bƒ-C‚cÔÁ uO0[´_6áZ‘ö«&\û%ÛkKºOŽŽ•ÿH²½ÖDt¾Êí M¯%i¿Nø®ºûªîû}²ïCö·PK—o¢Q™{qIa¸¢ǃWQ«¿èeÚTùÍ’Q<Ê:ˆÈpÜç2’Fá1Ò*Î6ç÷€÷ŽV ÿ]á'H¹´ÛKV‘ÁÈ @ŒÀIRìø—,6Á=mØð(F)‘kÆÌí([ŸáJ!£¶ù¿Š{öBÊ8BfØõB%IÄù6½˜θ¡Ÿ¢a=J#Á¸Œ˜ˆÓwXc> stream GPL Ghostscript 10.03.1 2025-02-18T09:11:23-06:00 2025-02-18T09:11:23-06:00 LaTeX with hyperref endstream endobj 66 0 obj << /Type /ObjStm /Length 2516 /Filter /FlateDecode /N 62 /First 517 >> stream xœÍZkoÛFý¾¿b€~ixÞÏE6€í$Ûtã4²MÓE(m³‘E-%7éþú=—¤Þ”,ù‘‚ÍápçÞ{æÎ^úÀ$ó‘¹È|b*$3Åœ´,hæ-.†…ˆ‹eIã☒Už)-q Lj™²Ñ±€‘¼ö,J¦‚,*Œ,%‹ši©qo˜6WË´W¸:¦“Ž,zf¦ŠC÷‘‹Æ11ãMd‰ %Í’b&¡?ŠVIÜf5$H–Y«€Ñ1ë GòÌà€T6D‚œƒ¥Äœ¶$„dÎJ ÃŸs‰j4sÁQa.I%xVIǼV‘DgÞ@ ½óÔÚ ÒÊ5b:¥$4¼J)(2(¥¡·ª@ 3P‘"£Rªrô:ÓŠz‘r$=‚€ …„)ZCž4¬ 4—ÖÐX¢Õ@™ 6J¶zä 4Ì«  …)Mx«I4Éb¬üÛãÇLœ×£)ÓL<ÏËÉ”(!Y‡‰—=ºIõÍ›¿Æ?_O‡ù(›°'OªžO34ùsu›_ßýÆœâÑ‘±PðdˆÑõpÈ~gâUöy1Úë^™aJšÁóé0cϳós)-èâ3)ƒÅŸFužÊWS×ûÔÔgOfPj!Ž ê¨\äIù¨Z` \ ®´A|]fÎ5³‚×& ,ªÆpïEiMýLàñÉšúüPÏ5D Ë]ˆkê kØR R•ŒrûéµõˆÃ«ÓëÖé+ÕÌt¸…æÞKØ´™õŠ;³Î$¸ŠíXÔ6,æ,qS/^J`ð5,v½ÃFÎÞK—í·ŠÙa¢ý¡¤–Ån rƒ.~»ÃDûcQ²ÅFNs7øv€q»l¤ïFÛÄÉ=¬‰;Àø]VÚŒjñ~`܆SI;À´9è¹™îFëÈ 6ºU0QîÓæ}}³[øý9£7Íä¤çÔm L»»­Á´ùÞ°·Ëog¡mÚ¸ÍÍúfW¼aú“Þ${^`TñêMçé»g^žu{£‰’G'ÅpÀijQ¿ä£ &Þæ£ãÑ$_TT{åée¯¤€QÐ ¥_æãiQRX7ßB«6«ˆîõ‡i7Pô fAD=ÿÛ|0½œ@Fã¿`ÌÊýâ—*4­¤ùŠWÛ~NÓ²¶ˆùœGˆ7o«Ÿ_cµ½;'«6b"¬DLeùÕ5Ä k4ú;žôÉ&Ñš8íÌò‹ËÙ-ÄîfSö½8g¢#º¢'ú¢_ ‹‘ˆLäb(®D!Æ¢1×âóª"Xñ|Ø»˜0£k%œŸ¡ Y?Œ‘i¢ßë‡Ïóa†°Ñ6^õ®²m†}1í óþñè´eÎòÉV­ŒÀt$[M³«_Ëëe3-YXüÚká.7Øôîí/oßž="L³òäÍQ=ßž„‚„rë„"ïE(½D“‡üÕ£ŸÕvå‰n­­©7HdVIdVHÔe†bœ•y1Óe¦¤O”QtDYãJ¢O5ÚSÂ:S¶m'Y Ý†,(nâ Ž}3®å ++ˆô¶Sòƒ³›bщNÖ¯:xÄÉX°ÉqM'5'ê-_yò¤óg^æ£3ÀÇ£Q1= Ú>¡i+´(´Ä­Ãñ4Iîä½BÛ'Rm…æ-§#¤²’ÓÁßlƒö¡¡­®­È bרÓО4ïÙ>ql+48ídOz£`m¨”xÐö k[±iXݪʠÍhîýƒCÛr[¡ÉÚ«Ê¢ ›±U‘ky¿Øö‰yÛ°™dxhLê%aŽ}pl!p+6 =a ÜéÈLÄ="ÓûĶODÜŠÍkžÈ¦º¶­ –GýàØÖåVhN‚úªR½3.Îï í˜Ñÿ.ÿ7èOóbTW}9Ž'¢_öF¼<—Å˜å…ø”}ã^ÿcï"›ˆ³Þ´Ì?7>œÿ€)¶‰.!¼Ú1<§÷:jpW¬é_­v¸pUËJÙ U³Pµ¶µ³1.píºÖXËFϱak‹æÁ Ѩ96´D7u¶½xôÊ«Ÿ×e?;2>ʦbPô'ürz5ü®;·¼± rZXÞy@¤ùe´«üÝæpºäôú†ökùÅXy6ç€eaù*Ó‡YþØBخڈ8Õ-ôæàÓ<âœoñ@™Å-b}ì5œr_´fTšCñû´9 Û]œzãÐÿQ;ò[8ñ€ÀRa);8%JmawµËÅ#vT{_×%Í%í”ò:ŒÃùOkÇv§ûµ@6âŸòù8ä½zSÅèŽ{å${UÙà»Óâj\f“I6x?©ô‹áõÕè=¢£Óîéû¢|zÚå:ÝÂñ:¡ù¹¬&ÑRÐ$ìÐÍXœp V)ñl—yOÆ£ÈsÏSÔW¸¢TsDȇoŒãѱð¿à‚ïôÇãc¬§A>‡Ëaq ”Ëmäp0€“’ã’Bðë·ú{Ë-ج‚F djŒ.âêèÄôu±a'àšNd 8­°ô(qþ…ÀáÔ€pk[h‰PRš8g¤ãž>øÀ™¸S ³ÒÒ‘FîX:ΠăïÕœ>NÁ¡7Ez÷½M÷y¾\V0@t.G`wé¶-?µµ 2ɬƒÎºžvVcªd* ²•™•áÃݬ 7fe¯yÕ¢•±I©Yá†]™¥eÞCçj_t諜yœó˳,²ÝgßþùìÑ«üêÃõ¤Û½<êd×ô¶y)Q@ߦÔ/ªçù“6^1+½™qRû&´fû¼à_O$ø*[D/ŠÂÒÔŠrD”Gò,V„ MOjG½veª¨Wõ'åjÌY¹™‹®4ú¼}•Ç¢Äõœõ¨F”[²VXOË ‡êv)ku*žŠâ'ñRœ‰Ÿ« ÖÑV²XçâB\6¹¬Q•Íúïu1ÍJq‘Ø-',èË©&e±‘­ gIù ÌZ¾bFƒy¾b}öLY(nÊY8°mƒ¹¯ŸŸœþ‹’jgŨˆÕ¼CpîÖé-¥7ò[{'LQ7þ5Ô2«´«ï×k϶÷lk-×fܬ[}ÖÖg6Ö:U=eCT¥/ רz&^¢«)ÖóüOüÃÉ$ÍÅâc“r-FˆÚäÒˆ¤“ü³˜ {“KÐuzYf™˜~*@Ûÿee±Â\·$e\ý”^ÉØ5î¦uîn#ОyÙnLµamwôÕ§z¶Å(ªo¹áÜvرXžæççY™úYõI¤]¸Òm-û¼=ý?/ µendstream endobj 129 0 obj << /Filter /FlateDecode /Length 3428 >> stream xœí\[ÛÆ~_äGèËXÍÎýâ´j'-Ò¢’]4v¸½ËXeŠòÚ@~GoÏ™!Å¡¢½Š 6È€—"‡çÌ9ó9ÎÌÇ£|Äð_ówº8a”y%¤“pSZ¡µ‡ ã´VvT]|<áá…Qógº½¾89ûA²‘àÔsëFïO"5>Òœ: `¹§Ê‰ÑÅâä-ùaºZým l$·J{R-Æü¥Ršd³ŸiÍ¥µd®•v¬]¾O”sÔ+IÎWÙXx꽤Z§´òñDOÈ¿³:}R ±ÏØÌ’óÍjWŒ”cø¯JÛÿtñÏ“o/N¾?‰2ߥ1²¨¹G ÆC_„ŠZx],?Ùòj<ÖQ&8ùO1F>@C4µÒi¤¡$ÕZò‘¤J*kG³ÂÇ?ïò’0Fž™Ñ$iø–œ"yhäùfQÔUñ¥áÇ9Ïçŧ±!™æ$[–c%ï¤&ŸöuÄ2ª…~P?œ±·õƒ“oŠêCóË‘ogcŽðšÌòùeè ŽlòºÎçûºa<¶ßéÞn0 €»¥Äušÿ>¦É¿ÆRC7Àl³· ˆŠ^fMÔHQëÇf¡p=á– &Bà ¶P¢Òkï Ú—2Ê©;eF†rm}XÛÈX4/u]׫õ«³³«¢¾Þ\ŽhT(Eè´\œ]6 [F¨=Òû8s)¨†qHX“¯÷(”$„°#AåÌ\ª.=e0è÷*A6J˜­#ðP«|o˜>>ªÁÖæAjáÊõÔ2T-äcÒÿZ- •YQ'(³0œ| ùlk{ 1Úªê`mxІzFfƒ*C2Eµy€¡´©¯‹jvSÀ¬¨à±ÆÉ©1žŒ jÃôâºX·³¼ ðRÕº(—ÍM+ÈM„#LÙYÛÔèÔª˜ç³nÛ¾â$ù;z¬ü²U®Ùdð½¢SŽ´“¾°„»Óæ·&%øDÇ/àø(£ö¸<í8•Î…¡S.ë|Y¯Ÿ<²)+öEZ3Šn'(™'|ŠøÝ²®ÊÙfZ£Š6–ûÙ}åeÊ'º¿á%šJÑÀEt’@˜S­sT¿1 ©ŠÏ‰¤<W2~OIíca,˜GÑPk­L4ŒOˆ;ÈìêÍ£$ÙËfR¤Ï…B€È]ü „0ï€;6Ä»—>Hðr÷ö»îW ýMî ”`ƒ›Þúu­¹õ Hô¼ÛpXWÞPŶX ÖëA°Î©v}.Àüö¿WØß†÷Ý7Ž}ðö^m¡/评~ÊåúÏëîs‡¾<ôáBay B_¥ÎÅpÐO¹¼@ÿyÝ}îÐWÇ‚¾–Zn¡¯Ó€g@è§\^ ÿ¼îþa¡/\l¡oÒ€g@è§\^ ÿ¼î>wèëcA_(ÊÙú6 x~¬¤Óãò‚÷gp÷·Æûä%s,¬34T‹u—F8ƒ`=Nó)——iþyÝ}îÓü± „(w[èû4Âú=./Ð^wŸ;ôí± ïµb }ÎÆ©UPS±œ ‡ý”Í öŸ×Ý?,ö¡ÂtØçöW _**v¹ Š÷ ø]YÀÑýíèwÇB?.Å`úE‡þÙ¬næOÙ¼àþyÝ}î3Šý#,Ü’W»f=ðÕŒmT……Â^(òÈ•U=c`4kËT+åGÂC ¬]»TW;9lvWN7‹|Ygu\+ç°7†„ÅtÂ!(«óå,,‘ /9ò¾ÄEp;+IÝ‘dZ.?åË"_Nó†3¤|ß6ˆkÔ«E6+æó²¡áY·k°š7q*ØþÞ¬ójݲää2[Çî4ô—íµ½ª²­òà®è€p††Õ¨‹Ø5̺D„•¿Ò œÛö¨ºyqYeÕ—¡æÊ®£‚qÊÓ~¶‹Òº5dO¡ Áõ¢G÷h]ZÊÆS’²yÕù:.PU,}OXª„Ñ­aæu«iC²9}’+Hzâó]p9 OIÙz¾%\ŠjSÒ\…®õ%jóB.uHOƒ€IŽ+‚sèr\ÞaêŒÛ¸º4æà"øæé¦ªàáüK› ½º¬b,Bê­ ;iaHÁø{¾OBù˜ž¿yb‰¢ãÃ#=ïs_ êO*­ Nõ|3½ŽjüP,£ÐM.‘_hcL•èN‘›¢ÎÛbÛ­˜¤ÂE¶ëbQÌÿ°‘Ï“ºŒ{± ËÍ"‡x(<„ÁšoËIY0*y»å™%• ë^ÛQ¶6øÝHY4ņf¿àà•„­”2ls·©˜Tak(îËL ¿ §óÍ ·wÞåÁµãzŒôÕûâˆ-_*ã}¶w»[§ÐºúÌî‰#:ŒH÷û=Åìå~'ȇ|×<*’àÀE1¾û6DÿA N?^ç!Ïæ3„x(v¨ó¬Cœ%¹÷U¹h[êwH¬¤€‡¯$0ˆŒí©a8^‚UéE[ÅÈU¶nJƒa‹.ˆ[•›«ëN䣤- Ý€ï‹Û¯t$5î¿vÍ,ÒaÄ> stream xœå[[oE~÷¯Xõi\âÉÜ/"•R!q“hŒ@J+dœmpqlwí@ð3à÷rfvgw&uŒã#ÊC¶›Ýï\¿sÎÌNßÓ‚¸Ÿæ÷ôz@0±‚qÃá&×LJ ÊH)tQ] Þ¨¡h~M¯‹ÆƒÓœÁ,¥Åøõ F£…T˜ ^hƱ†ßãëÁbx8’ÄPÎW“jH¶V u91m0!}1ÙT³Ûá«ñ§5´ÅŠ3í‘áR(ZŒ?Œ;0 pÂZlE—WÏê7±õùxðÕ€÷+mia°¶z‹ÊÊP,µÓÿ²X®Ö³5Žß8u„³ThfükTœ5ØH ÷.ÁÆ?ÀDF@'ƒ>.×Ój¶ÚÌ–‹³áˆk *tU.Êj2w[¸ÁÐt9¿¹^Œ–Õ¬\lÊËæ”¢ÅÍuYͦµo¬‘h > ¾²–¡ëÈbʱ–ï€ÂÔo=[.Ö›êfºYVÁ­&¶ƒ̨0`‡Æ”3oú³¶XøØZf:‹!¬ó–·tQþü=jÿèÄYîªÆøåp«°Qƒ1jõÝOX-ã%z¤@̃;$“Þ³OšKÊÑøÅ×Ï÷ÒÀìin#,¨Ø[2bÄÁãh3bSÚeDвšB:ì‡}=3Y¯HôèY¬æ£}< ’ÓE½•3j$øV€#¨Â‚VC<{ï=—¼rÄ€/.!v@jk)ŠXûv •Ä–±B(«01…$œcª EØÀ‹ª,¾)P®¬ŠX`ùß¿1x Ð` (®Ö^Ç@ux\`ÝóSÏ[,€û—fp÷g¥à°ð“}D»Úƒ¥"®pB)…’ÕÁ•=â¯vÔR!“„ÂÆS‚7 ­kééi G/¦«ÕÙYy»ZV›W¯ö+w‚}Wá˜)/ Mªë‰KT–)0 .vYdù6)Pbµ/ÆRÎÎ:VâH­² àzõTÈ”ìVu;2…ø2“:dý¶Ú|—×#TQÈ+‘ˆy‰zx„* YKHj]¦ç‹## x"cÀ‹ȶÐ%x#˜Ðô< …­m'¿Æ)ƒæîf$f ¸Ì2»sFÚ.W†Ñ¶ÆbM™÷^UnnªEŸ¸S7½¥ Gˆ{ÊXJ¯ÀS!\IHÍr³¬&E,¥Ë4o§~ø6³Î0R¢R‡ï;!# £&ƒ®µòß÷²fÇü+$ÇV5#û‹¦aµGÃfnÆÕ¶í‰Œ 3ÍŽ†}ÿ¾a·šqe1oû4<¦ ÞïÓ§wH8÷iŽ‚ L¤wx¨gƒQÂÍ ,ý°GJj˜KÜãÍ¢”nC–Däãv„÷æÈÜŽDeäv„š…Û^~nGà,·#¼ìÜŽ°m]­¡k u„­zgVàvš­I·{’@SÒkmæ{)·š:Da B,‹'º|U¦&+3V¡ïöÈU(u· ÖPŒ"pÝ;Cш@÷* ±#¼|.°<§ý'‚†Þh6&–ß²C™;·&¢¥Xq-Ó}âlTäÖ5Df£bŒ÷ô¸TŒEåbÔx»÷ÚÜÆÐ@Yû Á 7'ñÎŽó8u½81îë×ÃÍa-àïDäm·‘ô¤ÏÖ,,‚ïÚƒnCÛ€EºêHã+HÅFªÚœƒ9¬ÙíaR} €=­ÊP.‚+pѽõŽLðn3éöÄcì^S†50dðÄø‹w>š5,kÿ½|Ý}W˜Î'ëuLµÃ–ÖºWM¬5öžpR>26úªÔÃê6äÐ…1ù"SˆZ>DØ}ûm:uxèäUäkvÍÛ\ˆ4gX ©e¯Ý ×>•M À]¸÷RPÿáþÎ%WÚ=‘Þu¨»±âi7ÎVÐOA~÷]çµaíðî†õ_d÷¥X8Ÿ$}!»ß(Ô¾³t°ÛZ¸£z-³8çþÃEì¸A•ì3—r#ý`¡úC(#ÎDT— Ê…l>ç‰ ðú„4SĨþs_b%–†I­zÆ³ÄØ½yºm~ËVã=é –9ÂÚáebj¦·¡ˆ ÆÌB»êS Àhÿ>±{gXƒ¥pwÜI'¬мbïl£Ö/ÎáŠÈv·ƒ¯HŸñ>ÔòÄ[¢ª…{õÈd•`!å½w8Ú¨vxÿ¥¶»:Ÿ!ÐZ3ôÕöŸl¬B`®D¶uh„÷OM˜¹ây$Jóƒ"Gç…Iͱ“6œDfñááM¶ÃÃÔÒ`ìh§‡AËÉâêf>©ºcÀÿñÄ›ÿÅâ°ó²M.¨OR¹ÿ²ÓÅž8`ü€¥GŒ7ï1µ¦;'rØ(g‘ó"QõlÅ®©èI÷‰Øm}û~‹+:Üw;Y®¶€;kKX¦X^øq3Ì ?l6«õÙéé´‚d·×Ž& \†#ãž&­ªå›rºÁËêêt5™™ßGSèÇÉUùÄå}êØísƒG/góùr¿Ê´UI¡8&쎖_ºmp´K[t^Îg? =   LË!u40 ý44„ÿžÁÑóËËrþýЃ¿Þ”›M9oþJ-¼y΋iôÙP8»¨DË›Nû¯¬€âendstream endobj 131 0 obj << /Filter /FlateDecode /Length 2872 >> stream xœÍ\mo¹þ®_±ð§UÎbøþâ6´¹´@›8Çm°ƒƒÏR¶ä“䋃¶?£ý½.wµ³²å³ÍaPøƒVòî3ÃἑœÙŸ+ÎDÅã_ûyq5âÕÇÑÏ#ÑüZµWÕïOF/ƒ¨>ùÔâ1/ºQY\<4š î#ó/£ì{GG=…'sìAõ„o}ýãÕùaò‡ù¼X€êz>ÆúË_þH+á4³RbBgu†D„çÅ'QrE:‹R€5PwÚM#è¹aœÛú¤Ø$c°`¥J hž[zBÕÿÄô„ Þ+ 'WF >ïÉd­‰jŸ0MÆ‹Fv«ÙæfµÈ™s¨Á @ég=™„PÉšv¡yR#Ø1ç­M :™6fw f9ˆ;Â>ÿ&™å Pé .˜ÑAV'ÓQýïGç`mutD:YÂqª½}D¨Ö6Þ*·ÑPD›rêP½ÿ‰&ToC4Üg˜VÛ ÷ð Ñx×xF`„Ë…oæâ87À€ûRÐo3tÒ pgr7ݼFJù¼”ä^Z Iƒ.¢õÛIvÄôo(ÅìsŽ™v1!b»g `oBTÐ(ÈNÃ3˜WúŽø@þ9߬æ·9ƒîò!ƒ³!†1°Å£?Cò’{0$‡IœÖßͯº$ÓׯpVù¬Ù•ZíšÐENÆ ˜ß;µñ¶Î ?W0÷]½1HäÏÉöPj’áä¾Í‹µLÚ}º’'p§.®’Ê Å+p/„Bñ@êʘ؆· ßbhC7×—ËÖˆ‚¡ëQÚÞ×ÁÛ—£¬j2‚.gë/áÚ¶ËÚÛ.û–G—‚TO!Ëã«’!<2#,Dª`à‚g¯‡£§ò)55Cf³#œ*Âk m~€­²Wª¦ ¯Ò2áèt@Â2¡1ã¼6ñ7é@ ¹¶ ¯MP„‚mBa!fc°rtr…TÝ_„Õò$\•p ® ³2€P2«ù% Ï*º0i‚kÙ&JÎKDÉžIDpä1aó"ùgÚ‘U˜PNúÙ…bG‰´,#’6D‰¤Ù?¶%$ÒÅg­Ë,R$o²n*‰¤Ø_B"m€ E‰4+|:‰´F ‘4«îHT‘´™•Hœh’Ù"iSšâž$-îéûÛÞgo+ 2jÌ„pñ ‘7;ݼN#˜…tVo ¤ÞNîZÑ“Ùmêu€ ŒwKÄiª…Ód¼vÅp/ÖQ¯Ö³¾Ž*H÷ß—úZ‹ËóõºÌ)Uò9ÞˆÈÛù–q!ÐT¯Ô§Dó³5„³»Õ%„wøžˆY/cµÎ³YGHmQdTÁ–±€ŠJ²]%Y^»4aç!µú*LWmE¯¯[Rèkwv"¸Žå`¸,SÆÎ Gpž§¼‚!@2…è” 3›Ãk§`»¼‚œapó Ê“k —pa²õz«-λÅЦ†àY2ïœÂ#Ó6ÃÁ¬fér§o%xítH®É¹ªÂâÄqn[¨+Â+æÜ’®aγt·õmLÚM›¯YÊÛ*Øfwœ[[ÅL®-2[wg1ý|mAxäÎ ƒçxâ­Â!<êÌ cSdnEx5¢)YðŠ÷ÝxÐR5{*ÊIÓ,t¬7¿B ¬#0«ä}5ôZKf|›)I¦Øx¢Cˆ»ÏõtÝ®uØãVÏa¥¾°vÖ©.ïÝ—Åòz=_72æt„vÒ7ÏAB¡‚¯bõ¾1FD;­ÿ|¼©ëýn¶¾Xͯ7óåâhÔ.³ÿ‰a»ŒlÚdìNG«{L»Ì$ u´JðfÒ¶Ce;Zã>²k ™‹µ´b"$=­¶©#ƒ¶òM¡®VL‰¢­µìLv}­dSÙ5¶"À¯×Ù: ú[[%رh+"ÉZ[1h¹ÖVL…¤µ¶–FÌykˆIk+,ÔÚ:à¹hk«ð1iDžÔÚj…d^¡.R §½…bïÃXîK­­"À§ÔÛ'ÚG¯¶¿€Äåuu9‚4_3©ïù¥{êòÙý¯Â:fyZÓ5bP‚þW 7GzKØýšNZÜ€Aûk³¨Yå,ã´<ºz–¶Wƒgí4[¦b€GVhÒìXø¶¢Ê¤0(UAÚƒ ×çÆ¢EHUÞ° ¸,TE ÀkpãÈ,Á}*lÙˆ¡e#TËFxô–Àsη–ðÈ-açÜlº¯Q#l›­Y­e#L2'¤MSkޱ †fܺ¡tPÌ '{Á†»-솩]7”yÔàÙEu[¯@_dqù‹ëÌ‹l tö@él1™ùž{¶icá&K„•™UÎào:;”–Cg‡nº.û¢L‹îE7oÝçï’!äS°›ùa¿íÿéoþP¼<¦-ìмí7›^ålß¶oÁ’º¥~ùMû –ÿ÷ž—äö+¤¶–Á`âÉKV‡L¾AvÂÁ¿ Ã:[TÍÃáífr~0" „×ÔÂ!0o¹ÌOl$ìªB¸+ê$c¶+´C€ÿ?%ÂJ4[½x°Ód%ÂN‚¿hKΩëL06E‰0ÂKUIüɪ’ÚІÏJ*ÚEé€qÖ{†áeª±òO¼l}me¬&B:‘0µÞVe™Š! 9‘ýk yÍ.¯ õ»Ùåü—qsê<_,Ç"2âdýËØÅ½_/ëÃT°µýÍt:»üiw…½ õÍl³™]¶ÿžŸvÈ¡þóXG}¦^ÞŒ'Úh£˜­ãñåïVpW4K ¦óËø&¨„ê¿Ï?.", N€Ò‡Pÿ«œDƒÓ°dâÖVíIõf?­nÎWQ"‘Q_éÇ(üa/¹4÷ Ë€.áÉT1‚)zf ûKÿï÷ȾýEUnendstream endobj 132 0 obj << /Filter /FlateDecode /Length 2481 >> stream xœÝ[[o7~ׯäi”Z4ïï¦@’¦ lÓ hÙTi¢UV·Œä$EÛŸÑý½=äÌhHYVe GE ?x4—sx¾så!ù!Áˆ$Øþ•ÿGó·ŽJ‰ A’$3†ˆLq–äYò}²è`d‡w’É_tÞu¾ë\¾á<™¬ fïK¬ "Ô¾¯áö}„* w?+ ¯’ükËJ1®æÉüóYGcÖ{îT_Í:×0 CÿÐ!€¤ü7š'/úv¤î ’þ»N¦‘fèPŽOúóN:èößw^õ9 ¤&Xp•ä%-9SŸ4õH?–œÂˆj%éûà<‰*þ§ZÙ[.¾cõ@À¹¤A,§ºt‘—_|a Vih@c ¦Ï!~ø¨ÛycŽY7çŒ0¦‹·óþµó¶mö/"cÏ b’‚„L!”U$Kö E‘­©ÁMáBPCÍÁjp?ßbŠ`Q45òls—/šø±ej@óy\(ŠjO› þ{ä^D03…kÕþáÚ×Í¢“þ«Ç¹Ì¥¶ÖôL™SÄk;óy\âd>`éøÁDõ„SeaåM>\¬ßF¶3·@>Íò§bEtmU“EÿMÅÓä6!×ïÇðbçON,Cžg á`_Hi7†ûD[Ð{é>—Fz/Öh@ÐùYäq—^á³ièfEÝëü!ò˜ËJ8s·ÈBõ‚Q9{m9 Q“D&•„Nò˜Ãé‰2˜Tk×K§‹ÆAÞå#’ãe±ƒ<‘…±x|šY_YNù[pöÊ7=.ÍœŠ)ú÷ž!È—«vÓsFyÐf:r”÷ˆ¶å=.q¢¼GÐ9ZKQÞc'Ê{ÛŠòþ˜ˆò§õ÷-7ÎÊ…¥7e'RË#:‘°tÛóÓJ iÄF䃄}Hm—Ùö!5L°¤:j;áî‡S2ŒÝ "Ë7MóKµÌåý2Â*—Oo<é7NýûçV@f!³öÏ«\*ÕEö©q/@}§G p pÂk¢c´9eRX4|VÞ:@„­%>e¯“‡68 8ÃÚ sâÂzÓ ÖYðÙÎþ ˜t¹É—aÔN]ð}H±öµÓ·pÏâÞ~¾ˆµk1É$§×M`Æ%çL¥*®¡,Ï ”GvCe4TlëZµŠ;4!à¸P´ÝI/âb˜ÛdÚ *¶‹‚ÂZ…alm ”bµ€· ƒì&$=*”"»¨ ªïyþM7r b\ìzÒ }31©ïK“Ä ÄÔL´“ƒ YÞ³ÚŽµh×Z í¤pËŒ„ÌÀÏ€ ‡¢‹«x™™c0>cZA…Cõfh蟼T`(‡ 87Ó¤Tw?GjæPÜj&ã¡Å-Ì€ÛA…kø a@ÇJ[ÅE»Ih;‰³-mZì=ýü,ôD`W†z´ƒ}­'%µê€ŠOõi¬—ç‚7°ëÙ€èU¬—-9Ÿv“CEÿ-7¶Å•‡|_Mç±l®ØzoªBj×w¨hE…”á{6×è\NÕxðèT{D)$øÎáªx}=»¤ T¼¾žGo<é¿õ¸bvöªEŸ]„ÎUv1Ý'º»aâ„S’eäóˆÞXh*õb†ðîFÞxêµ-ùbÏiõzôVùrÜ’v1w;J|n1´[¬8úT·[J›(XívPh¸ÜfíÜ Ü`]ž{Õmy3V»Ë|_ÖÇAÊừ¶Ws!­ ”v,È#Z>lc`Á0¹—âO=¤äÓ»4Öj‡˜OÛ@™ê¹Jô“5c¨f´:Y#ü“5›Ç¬*ÒžÒ1akL›%.IIZ§gx]ú¯ƒ@Öóîññ„ûvé Ê%×ü  rÏ (5&Á ýïf³Z_]^Žò.p¶¡&.PÞëÚŽ9³öù>mÐ2Ÿ\®†£.u '2ýßp’=³»>žçÝ^qð„¥óáx:›-„iß ¹d»8 ÒÿL/ÊEJeÒël6ýØuÛÀ-‡‹e—XÕ4ýØÕ8½(NÁœ&}5g³»v=žÞe›M6+Ÿ_Ž«•O•~ÓåV."Òå]=úï:¿iÂ2Âendstream endobj 133 0 obj << /Filter /FlateDecode /Length 2046 >> stream xœµZÛnǾçS,|µLÄñœj uœm Û  ƒ!בT–”c#íc¤ÏÛofw¹³”DSš%t!JÜýßžùË(aõ?õïÙr@³ëÁoþ›Õ¿fËìoãÁË Ç2KŒ3Ùøý zeŠ«\f¸ FŠl¼ä—ŸVëÛÍbC†ã_ñ– C¤á6¼§ˆÎf#Έ¶Æeãù`’ÿ9)N‰³6ÿ¦ØÌÊÅív±^GÂ0B©Î·åbºº¾»™–Ã7–8ÇóÕݲ(³úVå›Ûi¹)Ú–S¼öÑÿí‘ŪùÎÓ»½)¶íwï×å’ ßŽÿ>`‚(éx6þ~0þ"ˆ&mEÿõzµÙ–w³íº OB7ëÆ-áLqèF‰âÊzÝòÿU(HîŸtz(ÑÎC´_¿_å/æÛñAàg 1uN¹>ÈlTÓíä=ŽÙl=/þ¨ªØ]å_4 ­Œ€~5¾øç›(*¿^|(^W/¾úöëï/ß´‚u,<@‹j$QŒ™‰[‹rû¢>Z¯é¦QDå/Z-jHÑm±³Öp;.q¤Œ`Ú3±Ä:|$^ù¥÷>l-™Ão™Ã,¯ÜðÍxð"Q!N¨å™tdl¦¨„éÌ<¬UVÙ¿³Õ‚©©Cô~þÁ{†‚2»Þx !Œç9L€ w‰>óuØq³'sÛy/¯¾”ƒ[YlïÊU NTêíÙ% Ñ\tX„F ÞeD·éúïQÊhž¥Ñ¡\†Ð½¨»«è „ÿšMáe蜈9Ô<þFè vÝ€Pà+í®Às†@ó#º,.‹§×`éË=7ÁÜô°uÉiÔÑ!úUJÆ©XL-aä‘Ïë~äåd¨/1¯¿ŽRiÜ=¦Š™$%FÑÅ#ò;ãn€ BjÁ”C]€°{†ð¾õ܃?jÉS”pæå³H£x-õaü ä«þÃtX||•jOÎu¨N1ÕYJW#˜\µ¦¬I»OV˜{Î'R„•b?cœõ%ªtÈ]\MЍ s/J†}»ÒÓ¾‹-^õ…ˆuð4×!N“ÝInßÝÎ{X qÛ÷6–`BA5¼2Gô…û^òk_Ü® ¾gÙOߨӨý«a]0xŠý¤FA=iŽhœ¬ëà7‹er–•èºòtC«mq]” ˜HdPK§û§‹+‘<÷ÅM)JR)x.;MQBÓ|Ï…eа˜Ñ÷ݶ¯ª$ ‡ ‹þd5høÍ^Qò?a’ÎÁ«H…ñ§¿~Ü`SA_5üÁ«gt¤"'ELà.è+½z°C=©øÁÚ.'Z!ŒÎ#¦÷±'I«#Ù›¬Í©cDo²»Œi޽~¨/cš¿×ïÛCÛÙÍtÓ9Žìoi‹„N8*?ðÕXZvGˆi§4;'Dô&Þvqص!;ŒXkI“”É+ëÅ „cבqYêÝ(³N°dwÙ¡¥·o„x|83Õ%Rµ±AD®kƒæ.µw+(G„录׈Þ+œ,ÅêDö Ô¡Ï gð€X…J¨­ú 'Á3‡9…?tÄ,ü‘¨o‡8ÑÐI:M]>ßÔge丨ÕãèÑ ϺÉ<Ôä1Ø©«mêà[_UÇT·åtV¼;ÍmfÌ'm5£*^1½þW3š›ê˜KÒnC‘2¬Ãé—3ª;$ÖeÚngðÎvÆ nÞÕ»±··›÷˜è îe‡KšáOІ8ëYnmï¡“fF"ny‡`ß‹ÕÎVGäjdĸîyÍAûàfgïðšª5Š aÊ·†è ;¡;òÕÆëê苳šˆqùeq³ø0 Ý ŠÂtµ2`†ç†Æ“¶> stream xœ½ÛnÇõ_Aèi™ˆ£ûŒZh#@›ˆÄ $#`É5K—7/©ØiÚÏH¾7gf/†÷‡àB¤ÝMSÆiðzJ¥ Ó{pËQÇQz*aÞocBÜ£áû…¼ë;85'ÒZ—S:‘XklDØÞ#;›ÎFU’qc¶.j…€k¥¤R€ªJ)eZ•TVJ“©$7Ýv¥“Ü%p¥ÐInFb ‘:©g TrÔ•J*g¥ÙÙö—岕œ$PLöVj½„'šéÚYZ–X3Mîã‹+_Õ!…²lWŽ'ÅO8®<ÏÿXŒnôµæKR`Gê0Ü$Šö-{J;v¢“(Ès ¼·‰h5Ô%é!­eQ$·,‘;³ÖLzmVF~g} þ ×Ç»Šƒxê\‚MCa-Ôé6›Î®*U&§]=pbˆ¶"¡èÕžë_VëÍv¾%Ž+ M89 •º{Oh†:ß Šp“ýæt„eLöu±”óÍn¾^]†\SŸôÌŠUQŽƒ!Ó°¬\®Ëy±ÚÓú)•ÙênY€ºàÑŒl“'ÿ»eÙñ[»þo{£/< –þ×ëÕvWÞMvëÒŸ fœcc%Æñ ªü{ÅëÁÃÕY'(ÏãªøxëâZ-ó³sÇ3TAVe„°“W ®!šœO2NŒb´•מڢœ€°R’:ÞÞf_xúdvvUɰ¦zOg€hXìû©˜@6H°Æ !dK!¬g†JY‹âõ—_ºë…|߯.þn-ÍVï;d‚æ`)´íB¹¦”É<Þ!{ü ß!k;cpN°è¦3Pˆü”֨ס^ëš ø@¯üÂÅE­Œ†g77W“Íæò²ø´Y—»·ocÂB‹L@ºÜû \Ž‘¿«)°¦rW” o–ó©ËåeD¨RtÜn~çÁ»ú<€üán\BøM*ª¹/0¢ ôdÊÁź.H·WÙ4Å’]eS €7Í]¶%õHÇ“pá»0:D N­N¸xö+FHÄ=ð™ÍÁ1¸ô•Yfü‡ñV‰ 0Ë!jB‰é¤W»»rsñuj‡¦¿øÖ0–¨‹o:Ì`ei© ­¶ „'ÎÐŒð¥7øcbš­ )!Ƀ?U%¢µÁ¦¢µ™À"x÷7aëo!´¿¯ßí§Ø“Åx»ÅS¶tíØ¶ùˆx=›Î^Ç·cÛÏQ¦Ú¦I½$…a§X’ÂðΓmIi7´¥p£NÍPÁ#©€z>šJ°Íêí=Z‡Šã±\jÅ`PR®£Ý}£ÞÓŒÖ4ÉÁû³)onSãtš› ('û¨Q~°ËX‡¬ä·¡5‘n*²¤hocïð6ô\SJ„ã¨Ó N\¢•*Ô!x§qH3Æüà6~ò%OæFù´Yò4xÉs—lÉÓÃ̪§.yj~â’'P9^Íîãr¿°™hÏÓ+ì ozî>³éùÈr#àl÷bŸ¸Ü¨(s Ä~P@¥âØ×}#Ü—@çªåFd€Ážò½ßúÕeû„2•»‰ET.Ô<ð¤ykÑÝ$ZÛ—Ù€®ÏiÇK’ H 0í$†\€ÜÑ$F”d²Û«lV2’]e³‰¾Ü$æ÷°RwVBÕŸ¯v1óC`BL|Én.| ›ÝˆÊ^Ÿ‰¤O5É þ>­xü<÷Pe_pÖ@þbZß”híncI²?ÊbD€”û³O’ýY °›ýYŒá<ÆáÔ.ÃKípêÿ"É~€Š ±hÚlb4[Ên{×Ò°?mOrJE¨tyÞv!9ã}¿¨§ª/婺°Qø8ðãrOî8‚箯èê8¡„Gë8õnÄÜdÿÞí6ÛË‹‹I9Ì.ÙÍÆ+RCãNç<Û”ë÷ÅdGÖåìb3ž ˜ïjªì?ãYñÊ%±q¥”Ëj-‡šh:_,Ö§e³) 8ÓMöÝü¼®Q´Í®‹ÅüçO* ž¯Öê<¶aÙÏ“gçU…n:{3‹ \9½+v»bQÿ•ZxsÚ,Šëìïáø‚ºo}·§þûÞ›~´endstream endobj 135 0 obj << /Filter /FlateDecode /Length 2413 >> stream xœÍ[ÛnG}çW ô4LÄvß/ÚM€DIØdIJ(Ã`ȱAC¼xHÙ2’|Å&ùÞT÷\Ø3C2»ÇXøA=SU}ºªºªëèm‚I°ýWþœ.o‚„5MÕ1•Ì"2I­D’gÉ“å#£¸Ä&y}ƒWƒÏžsž¼ÞXD#aày¥ÖöyO„ADUiàÈhøö=¨’ðˆ!É¿vªSËdÑQ~?BpDù¾oÊ·î7`Ó߈ )LÉ—·`)(ÓÈÚrûjP`CA¶V‚$£Éíb0NŸGvFËôz5ˆ#b1$E÷ÿ|} jvˆ ­¢Æ‡AÑQD¿á­‘Z»° IxN!ÅNAòˆŠ§b?@œÂ7È`åCĉ԰‘š[„ Û7ÅûùaÌ÷‹”aKñ…~î }ª<»ZØ=_ÜlëY‰„Ä‚+ˆ &06>`‚ݧ'Ûn8âœ4týs ±þG›€,³÷ª‘ÆÍ}»K=H^ØcÔBbŒ6gÏxþ Àÿ?“m>¼Y„QÉ—Þ”4‚Áû؆ñÈS¬!”¯bœ~5_ G‚ÚÓég»°?sw)gíš B9ä¥n­Kþš8º­îm¿¡ä„& Pƒ!ëXÿ¡†šs4Ahoîw!°H‰¨<ä+a @‚i9I_ ÀÁ£ ­GE3HWMcˆaÜÎ^ãôÑF€¤Â"D£ |…E !FMÛW¢Ec.o4„‹[9l½86ƒº€4ýš„že ÊmšB¯bÙ+x?ˆOÇJ,À çðвí¼ãt3<86åñƒÑv‹háÁ)î¸î%—r ½ Ñr)g´ã,±‘C•9èØç¹Ô÷‰ŠÁš‘ÈBÀ22é7¹¢8yóY0Ì ­ígAÑgD7)Å ?IÇÑp(ËÞMÚq4€®í®ÛŽ+Š”)¶…:`kÄÜïAQ £å6ÁD'2î†wC+rÄ5øŒaɈ@Æ¡´¹Å¼PBZÇâçÕ±HÓ<[/&Û—þáxv[½S‘­i¬ '\§ ¤!‚å¿'/š­ÒÞ™x¶J ¹l‚;ŒIÅ¥“¤kéDóS¥€ôføò#Y †G³UkëÄ—7N7ëI¾ÉÊØÀ2-®Vv¿¯^U÷,ÞO6/j"ÞôP¨ÝxÓ¶ôböú:ü¦§Üï²u²rÇ‘ö§N3žìó£ö%OÞå‹HÆjj¯ÆŽ¡y¬s"Ù}l|#Kä)AN¤^÷d‡$œù¼±…¾ö|Ôj¤Î¶¼ºãd8XQdJOЕՉjï_ˆ©¥7`;ÃéÉ<Ù! Cí ž¼øq¸þqâNÄx/À{¢cœ¥;qý¡gvŒôÄEÁý†BáÌ)sE?ST¸sXjñ7ŠMŒHî›U I%¤@ü GÜÛw¤³M9tA§y⑉¨` ê&¢é͇åj½™o``·(@/­Ý{¶ú3:AbF(ÛŒÓ?¬C`7?ù*ÛLóùz;_-¯†#¦ˆ«X6‹ LÚa«Fƨ4_½­òy¶Üf3û­ éòa‘íÓ¢®…Š×hºðVl¨D¿Ü~âl€fŽs½Zn¶ùÃt»ÊÝs°í/‚BOH åÍDIê:œ?‹å¶6¶ÏX¬Ü2—Ùû;¨€*Ø/.Ë802EA5\*k 6b`†ì2‚G dî²¹Y>¼N°Ujêdã,½nY ^ãÙ_[ì{ÆR“àÐ2ì`šC á^úi9(7ú„A9˜"¹›IK ñ½gï”~£9(·3]GM(åÒÞ†Š“åGTÜ ŽÅáÏŒB\ª"zŸ=ÛåÍñøùt½¾ºÊ׫|ûâEøYYRT¨“|1ñ’R™ê`YÖŽ-:ÿƒ}OCÉÕU„¾Ç¸Y¿„è®—£ð†äùëå˸€Xzo- qmw^î{ÞG¢¥­âmd1´oà0®v²nXòÔ«(Gì ÌêË/¾¾s®áö«uÅ€µ*k|Q„æÙö!_—*¢!´‡}wQÁZÂöã"#xm˜E6» OK`”éÚ?E¶Yq$¡–jØ<ü‡»[%pŠSE‹»UáóßNZÍ‘ÚÁaf>ÍF™ä°âú<Ôš %å‘CúðÍCž£ÊÚêÖv@Ö)‡ôç²Ùv™Ð¸l6_h6›/*´^Ùl¾®xl6_j6›/±g6›¯Ê«#°Ù|É=±Ù<}±ÙüUÄ`³ÚZûX0›ÍÞ/›Í×ÍvÀWÂ@)Ùl”’Í ”’ÍÖð•¾Ølê…Í+„J6Û±:ŸÆæKEòÀŠÒæË¹ f\vü"2EÎ2>ªØqýº°ŽäÑpá7Q]بŽwq^0ëxD<ÊYI;°‡1)gq.V¾«¸r}øuÅŽû ”¼¹h¨”\¹^C¨â£5B¨&m’N¿J·]&˜ÅáœÔ¦ш%Ûí@õp6Û­¹›ïˆÛYAÙsCãòŽÀ—‘ñµyGÅÕ`ëÈ]Gk_emžGfÇP ?Høh¬šèùòb³cbÙZÝ{òþïØ1þZc²c(””ˆ^†Ã¾ììO^1&˜Û{§ÎxøŒ½ /ÏäX…i5%ŽG¹qÐ1K)ûÙ8Ov”$àÉkÓ)ÎçQøRcí•K¬añØ3 OÓ 6Fü)<%¶ßWÕ~+Çð y¾œÅà ŽÈõSÇðÕŒöoÇð`jöX ÛYg–îÝÀizcBÝ2º;Lÿ_ Þï—¥]X@ÖÙñ&{?•Së¨su¡Ÿ2XÿÄÓEzQ[Ò(â÷¤Q:˜*‰ˆ€ª×ZФÒÖ …5DWI¹ø~~Y Q&½Éîçï†ŽŠ‡Þd¹[Ý(š¾*ç¥4½,8Ö ¾žÍ²ûŸ‡V©f&}ȶÛì¾üo¢àýY5E0é·C‡:éê \@ü¥vxýEOÙ#—XVÆl~¿ªd˜ôG(«¬XXaÄ¿Vk£ÞÚ¸°Í/+p¿É~Î&¹jk¨N?ìÖHôåN<ÅTìÃJØ¿¡§åfÊ }°J”ÿ¯êÜôÃà/æubendstream endobj 136 0 obj << /Filter /FlateDecode /Length 2710 >> stream xœÍ\[o[Ç~ç¯ ôt舫½_Ô8€íÚ¸@l} Œ‚¥h…Ž$2$;hû3ÚßÛÙsö³ºÐÏ,èA4uøÍÌ·³;³»ýkŸ3Ñçñ'ýž\÷~íkX²o挻¾áJ1aû–k¦ê/§ý¿÷ozœ§-ýË'|¢÷±÷SïäÖýËUmB1­àyå˜ññyÏ„†çÓfcA³àáÝÏ`ÊÂ#AôÿüSïÁgÆr£D¦ çÁà .xýjy ˆ:ì~ú5¹î¿>‹þx‡¦Î>öNDßxæ•ô}'“ðÙuoTœ †FFU5½›,§§Ó/‹ùrýáÃàÃÙ_z?œE?ú;ŒÉƸcÖF[Õxy=œ}JˆÌ‹62 !Á‹]õ/˜ÓÀ"2rzº5ñl§ŒA°áªÕâ×ãu$É0Îmu}{µž-®~GäP„"\`‚[ÊyÕ!á5 €*Ë¿p2þ¥qvòÿŠ˜x 3‘ ƒc8Lg)T‚÷˜ržŒwïåÉrŸ÷×ļ+ca9™ÍóA²'Tõ/lOÈà½{2pXAá…‘A÷|³0¼ }4¢¦n9]ß.oºÌ5xO嘯h\À’YxÑÅa(6Ò{ ÷šØaêY…,ü)ZzL/ûC¡˜ÑAöÏ.zÕž ðÌÁ˜ã*c™Š~k §N¢wƒ¡t š­ÞÌ/¦ƒ!,*!ˆŠmjÛa%óaSФÙÑ<þ‰º9Ø4ðgzÓ@çOê vXx_[ا[d]=ïß|÷è> juìKdú]‡|„5“ ;9»¹@)¹_ôp‘÷À²Ê};ìJ‰ê·ÉPÇ«.sTBOi3¼¬!€Ÿv¢>ßÙzþ» \vf òô”Êa­ëFcë.䘛yü¨è3¨‡ÜÔU&„8ûc¶…SòùŽ[Ù¦3KGÚoÇëåìËQ—F#6íw¡~Æ5VX˜Oðt¶ÈÒMzá O7éÞÅåYáIŒNz„z3ýܹ2» O{ÊÔlç+2u@š\ÞCÆÓËÙ`<̬â>ó|ç%¤¶ÎhU³móøo]÷Z©lÓÓ¡&]8ѲÞß=6°–G©Ty Dø>íó#– ,)Vd–~ìB‹ M'úpªtc¥ÞÙÙC°» ûP*Vâ&Ò•!ÅC†œp^†M¸4t¤@m,ÃJÜP礨"¤(nXÜRQ‘ÒìÜuRT7cå!X‘V@ÇŠô÷fþù€¸)mîΤQõ‰²)ëï%K—¤œ‚d1ejË{Ù"Ëd‹7´Ù X™åV •A€ M—vt•YsH¾а¢¡{ 2ŸŸº +"@ÑÐt¬ÀäV^”avr‚¢4khn½²t¬@sk¬*Êöð!H1–OG ´¶N›²Eh³‰ã:ÂÕF¾¼¤:uI§$[ð»Ã‰B}Aå°uM‹ˆ=îì0TÍz'ˆ@ÉεҭÆ6oýrr©3*Z½cC&¾Ÿ]Så\s˜'î:„ÍY™)2„Rñ{9×e7¯=×sŽm ëhƒ¤lÚØïÚ6V>tß½ÇYvs}…MœÇþãÚN<öƒóvyïio< °e¸»myþ9e}ch2¼/DÉÓ 0v—äi /Þ䎗«éö&·9àÛþ{þq+™\W+|óJwÞØXãX..ßt?oÜŒ8Ô+ãêüªFD#´™[PdÓoT ×ñž²b۩Ǩ¦DsNm³ ïRgÒ1uÅ=χN3n,(qÁ"å—êÞ%ÖÞ#³ÅÛ12é]çÝ; H+692ž…kº…áAüD+‹²‘‡N)õ1êGàè©ã’Ö6´TõæA9iêUÎzó•ð”ìÖRɇtâ0$¦ñE2ýÁP‡˜<¾Z4ë{ZÝ!vÐV1çj#Õûßoæ‹ÕlÅ"‘à›ŽLikaüœ?ã5 0äu=ùFÕ#À¦÷Õ÷ÓÕd9[¬gó›ÓÁP9QWƒÅty}»Çw£Â×eáù¾™Ë?öÎ^Ô€1ìàMõf~³Z/o'ëù²~òØ! ;¹xã7”’yÓL†ÿ5žßcˆî]¾™~>¯ŽGÇm±Òc,µ wC*ð(Ö­¡Œ;ÝXmRð[_§ËIŒñ뎊'{:^W/RO³qxã"Ó!l6ÖÑAh‚q À›o¾IêȘ¯«W$Lh ž!m}ü¹zžãQs’KZÝSä+;L“´*Ë‹³‡‘´Æ‹ˆ ]aM+¶B"jE€Wµâ`Hd­eÇ Õµ’A+lÝ9¥”­8 ikaî“¶•ŒûVܺ“ûRêÖÌèå­ÒóšER}+-$pÅ&(®¯Ä›(¨q·‡ÂÕ‡ì &ZÞXoý@Þ!x¿ó"·W ]lŸÐ!yÑʾ\õ×Aüoƒ…0ÕüvëýO½ÿÓ™endstream endobj 137 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 3401 >> stream xœUV XWÖ­ºªXÚÄØ…Ѝ¨¸€ c$Ѐ.€ ²#‹APÀ ÁýáA ‚ìŠ@„FEÁÈ7̨™Lâ–Äh½Å¼Î|ÿ«Æäwø¾úºª¨÷Þ¹çž{î•PZ”D"í»>i“OpÜÒ™Îñ1¡â»OÒqüp÷pŠéi"=­âOF¹A!HFuŒ¦Ä¿YqÎñŸmtqMPlJLòØ왼>%Ä+Ô;,K¹ËŠ –«]?]´¦p°µÿOÐ'‚‘p ÆH΃•æð?„ÍÜÞÎõ1 >÷æ4` AµÁSpÞ2<…0äúC°0›Ç–tºõòUÖäÖí%ØÀ¼ï~+M)‘|þ–¬äìP–ÀÄqEà Úð´%7Ô4ª?!›ÿy<×Ðg—µÄ÷"Œ°ô â2Ñê~v rCk㢖± Ï}wQa1Í_¡p]ÛûæMK_??B»° %„òëü€1ÔÑ ‰úO]ºy£·êwRZ1¿¯èó¿©(ÇZ(ù¿•ê G–c@zÍÏö>ŽXJ¶›õQ%ß“í z8ø ñà 胡ªìÏX¡‘üò„ÿ±D7fÀèÆD¦ü[3õŒlùㆆÇ'ŽÜ_(‡‰LFæ^´y"ŸàXgV6û£\üpÔ=ñ¨Dñ¨;ä¨;äÝÉÙÆ‚9¦-4`4$-dk_ÂpHÐàmÓ‡'“€ÆÏW`͈œ˜ÂÍ|arAú•TX¸Ú´&-7 %±Ñ¡[–DÄËM‘oËÙ“³ç ùš>‚uþíöè>ºž__]_]vµ¡þÈ .ÅØµÕ44wW*a+«‹.õ|³É?Sn?&¾ƒw/$OFvŠs‚ÉØOVX÷áÑó/?¯*?œU.Ål?qpbÃÓsZx¸øQKTWp,R§=P„^g,(ÉâgŒçº`·e±ÕÝrxÍUz Ö½íÌÝK§;ê垌T¡¢a×"I§HMÔp,‡­þ¢ƒ°¾¿HƒÆà-(¥x*%*k ¼x+TJ©š³‘Ò¨ /ƒñšBq—Pºûª`¡O¯aKl¹È ¦Ëa}ìZéÉ>ĶŸN‰HIߺ-ƒOÞ…"Íg—©yÊj_d…òÂÊ7Vm¸˜Ü‚:ÐÕS—ZQüá]y[Y˜Ac'ˆå„¸|W^ßXRt#WÞ’­<öÕ¡ü¬±¢DÕq|Hñ~îþCÈÀ÷¥¤œñ}ÁÎC»Ò¸ß•ÂÝ‘ ™ÿ œ(–bGÚÛÙ€x.¸»ãr)8ÒÏÁñvïÔlkÃ3rÙIn~(´›„;²©ùUæìª‹ b‘q¯`ØÝMºq…oó8ëÜÑÚ„(?rÐÁ—¹¾K®S¦ù»*\¾è|¥.4¡ Ç.’r±lµTã±®0^Š­iPÝ”dö3kÂBýÓ22¦È'2Åûs Ôx¬ìø¹ü‚ÒÒ.H–™~”–³¢ á· Lm¾Ç㈌çÍœ€—bÅ‹I` &Ï—Çc3:Å5~£b]‚º†Z·Tóù•Uùõè::½1ß…5¾7Bïm°"N(Žº90QuK‰V€º¥ªn°ŽÅ›¢Þ¿}Á™‰$!ŸY:à‰XzݦÆóly¬ŒGËÇzû„Ïž¼²éá^9éÚÙxöûùàM²±4‚©À¬èÀãNñ˜.1/Ž)Fmc¯^ªø¥-dñQùÈ€$ƒ¢š9á Q¤A="˜¾T½ùË•EÉß¡¯…'œ0‰4wb;àÊ\û8œ.{?ÃR’búo‡‰VtxõÚà?úÏcÀcžlòéÈe"«éøh.ë¹][ßqñÌÆ 9V©ßüϳ`Ä yÞ”ÛZ2Ë¿lõ;CjY6Û …lðe{Ô-,%]$¤.°ä°åûä¶1rùNÖ‡i8Z‘sº¸¾êk%zÈÂxÑ‘!ä­Dh‡.NÕ9Iè¤?ZÑâz+lùW»ÖrˆÇ‰–*wj8’[„–lZ¾Þ7y6Âã6,˜û_£{_Ø4€:«ÎwÔ·=G`ŠÀxëOQWƒ{J{’I©V-:³¥ üëØ,'Ò„3îŠß›‚ÂQ|ajíöÊŒûè%z’õèø™ü¦Ê²z"#1HN¶sªíÄÏ>·f’윃°©quw!cS Ð’s0D×ËC·Ñ'ëJŠÞ>€QOkÛѯ$î™?áixÊ<[lµed¦ÉÁ¬”þ^ÙÜu«.ÈÅ)!ÏÆšr¬ç¾t76a…ÍEoïÀk‹9ëƒXèç.¡ìƒe{.î¨\V³^ë¼="êîî“ãOèL<ñÅ\ “ Lÿíg?‰h_xŽ—ýëvÃé Ýf cs_à¿:D¹c-ZÊîc&³îp᱓yUÕ… ˆ½VµÜe}„=¿sDˆ0X |;ÒbNq‹wì@ã\•BŠu@‰ç¼Ì¹Çàh`9ìEƒ\™ô  4‡ˆÎɤGÖnþœS¢—ªx)Ñ'jª ›û]Óšyök\½£ª®ïmøýÒäýŒ·o‰±Lžó›|¹3f=_ S¥ÐüÈ#Sœ‘E5È!FtÑ#ÂnwsziÊ©ðÖ%•ÿ@6è³Ð —`Eª#ÂÂ'Õ®lð¸úÙ{¯ïÀ>±{‰ V„¦ò‡ï#ôUe^W}Ý5t•¥œ\ÇNÃ>\wã§E¾^žm÷žoïæGF‰oÅ ÊÅxö‘š}GÌÇ\¼—¿E‚u2žN¶§ó ñ.)1Gd?àÝþ x“<–4²d`ˆ}òKÒù›0S0æÊòrŽå?sº  5³ 9ý6Á¦Ó`-·Š ®(¹lÐ!0ÊÏÎ › ZÃ4˜:øÌ~ˆjw8/—ý†Í ‰»Õæëêíxîj{S]'/<€Ïr}M‹Ý×¹¹]è¿s¾¹GÄ¿‰€1 ‰`+quàÀÆ’ç Á=C}uw”%ïÐh0õñ†¶u\ëç“Ú™h5O%U=ŒjÏÏ/áó²³²KO±x\˜»£ÔéÆýò§Â ®·q•½SàjOÏÖGë¯Üâ Ke8­-¥AG&è¾ËÒÓ£¨ÿqendstream endobj 138 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 4511 >> stream xœuWXWמu™"â*;(&»ö†{TH4DH"M°" "‹‚ˆˆb¹@¤(ETšìŠt,X°!ˆ-b Ö |ÑDMÌ™Í%ßÿßÍcòçgž‡g÷î¹wæœó¾ïyGFt£d2Yï™+–® ñ];c¾…spÐR´öI Öü1^¿‘FFrdd°ÿ“>H Æ`ØëboJú›ü•fFðÌÕ³ÖÌ^».$tî·aK×/ ÷ùf¹¯Ÿÿ ç—ù«‚ÜF[XŽ;nïø ÷Lú|ò”©VÉ#FRÔ j5˜r¤†PNÔPÊ™F¹Pó)WÊE¹SÔ Ê“šI- fQ–ÔlʆšCÙRs©ñ”5šH}M}C9P“© ª'¥ zQÆ”’⩪%P&TeJõ¥úQfTê*€êNRSH–”ÙtT6Q.û¡›S·Cò^ò ù+ƒpƒk´Œ¶¦#c2e,ÇÎg«¸!\÷}÷´îØp§á.=öôxidjTl¤ï¹¹gYÏK=Ûc˧OzùõJëõ¦÷¼ÞU½2ÖßPöPz*«”oyK(TèyT~Õðß,YŒ~˜tz+oú“qŠ¢—Gk—¸%í¸Ð°™¹‰]b#¿‰#ëaeì¼T«ghÏAÂ[\@ãEŒB¼Š´"_¸¶QùºZMùªÖ2^‰2hxÊVäèRŠwûpÐ 5ÞÏnˆðŠ£ýIëÚPÂþâuzÂ?[ÕY_–oÆœ?½êþ/‰t£âkTùV©üýGXó³ó+Sþ·býxÁ‡=¿53’î¨e7D:KO—É—m×AùÊöî¯æ×ÿtèÄ©;fÐmÚil¡â×ÁçØËæÅصqÐí̲©£œ–bã¨M(~“šÿ _7€,¶4¡x×!ò³üÌ’1þY†Í¾ ßµN­µÑ⸠™® Úå#F ¸ÿ¨ax$ñj(˜ÙÏo`Œù÷W/1xPÿ°‰Ó—S­œî‚&ç[¨z£¨:ñq¬â­hrN.>Ê`œ ŠåAÑšmÁ¨ž4 Àæ¼ F–j£7èÔûÂÓÇÐçÀ’™‘;7Åqx9V“k96mÄÜïêê5õ‘¨ 5§6ær ±k´0§JìYzEÙÞ OMù¹X#@”–±ï¬¹«ÛZ¸=d9âÕ¦´ãnÞÞa>nj©ù]-èhéjÿ,!V€g챜âÔ£ˆ{rÁ³¸×ë‘ë‚SV’¼æ¢jñNµŒ4è××rºƒ‘óþ öt'åÚ©.W¼@Ѓ?ÜŒñÕä…Â=ìŸY`wì6ÎÛ«­ ¬ŽtæQ'&5ÿv´ÊÅÅb°à–â•´”Ô`ú€¡xt t/¯J=xJÝØ ¾ÞF µI˺%„gÒâEíÝupW)7ÁOèèÎúl Š Aœ…S3ô“Æ;o³ó¶ÅÎÞBÕP\ IÕÂkž‹8mÊÿQl"¦Âçî̆a‘4Άb˜Ì¤mÜ;“®ÕÞÌ–‘‘4ž IAVi¾,méѰŽuÿH[!* =z]uÐÔo&ÜØªefw¶¡”-«-É+FÙ(3f_Wô˜ùvÏú„0ÄñºbvøküWøsíhÁë:‰á&<$º\_¡,¯õ¹æwíO˜òóᥠ¤/ß½˜”ˆùÚ}¼meà#_5Ÿß¤ w7óöpÒ'g«¢Ñ^Ø„)ÙTsŠÀÀ°ùü ]dÁºꕇ}ÓVdrü|—Ãšì ³ª‚ÃuÆFR%Ï¢O0 x²ý”ؽæq–ìi«ü©8EÀwØYÙA­¥U»ÓkT:6$.d;©ñìMÅwÔ £kðèw~ì˹z«·4¸jEÓÂÌ,åË.±8ƒ$&q~ç‹ÙáµnOÔåV\Tñ!.0BËz'†gТ/û>ä9ËŸ[æ»Å¯¿mÐÑ›jxÈ* •‰OŽË€k“—˜@R™„ò4Z¬e3Ó’èã8ɇmø«'öRé¢Q–h­“ʼn{äqb¨àÇ^Ú ;ìès Ìm/$Ó:<Û=³-9÷Á÷qw¸ŸšQ—@ëX…>µkë}š|LJ­ýÈÖË ô{AÏŽ^ÒÇÁ¢í¹NŠïbCQI;0جC9î~8NLˆ=ã­…%0¤RYþ–’l„'õÂ>'j7)}¨`_/®„•ÓÜÖ%Çæªš2‡S&ßÌZi­d±·×gAh0ÇO?ávOÅo¬Eu9W*È÷£žše+çT|âÖ•Ã0°” !h®“¥Šåû»’Ø f„}C°«s íN:Öyw\êúŒ‹YKÖtì¼d<VB_˜yn/IÎÖ­Ýš¼i îó9˜&î­NêÌH‹ªÄOëÀ¦0#Kö¸vü(S}ˆ€{M¹ûçXèÂËÏm0>±zŽ /Š ñRC1û§hÄï-H"iýrÞcÕ<l·ů"L†þMñ‰N¶SÜ+ßù¡ðÖ6kgi•š€ã~€+XXßñ]ÁÀ½Ýq‰Ý9WÒØ2öëĨN ¦¦]‘€ºr‹;â°£¸“>ŒWø°[÷ØgÃ×Ï‹!°½}…ÐgL%Ì&ÅUjŸB*K…ÈëÇ Ø‘]µ;(!˜ð~ôÀD<´ÙÙÚ¬²Sj~»D¥Î¬·"TRV°|EKG‹àâ帱ón@w0¾þàõÁ‚­[Ž’zGEŸ‡ÀrX%Ó=†ÍÏäâüw‚³¯g˜'â†ÙÞ>ß¡” †&>íE{9è5ë6–a³QC°9Þ6ú^¹šuü¢jìp“ôèü¹Ä5éOC[QœZ·‰0 5^#û¥Užo‘ZæéE Ô`õ-=Ì9]‘Õ6¯ï¡ÝéÐA®(0o!6œ4OÝŽ¶¡m*ût`CõA³°¦]k.¿šÍ¥Êã÷ƒÇãµ·MycJ¤E7§øúíñí §Í5½Æ±eƒ:Ð7bZƒ"6&Erü³Ís¢|¼ìͬ{§9·¢NUZ”]tè¶{!6ÜožÞwgÊÎd”ˆ2Òw§%¡$ò‘#ç÷}Ó³’èüõùjèVÃ;á›…úãÞÓ¦ûx99ùÔ~ßr¼º^MnàÓ1Ux~}SÑfäÚÏežç¸)®Õõ•…º³™*…x‰”¤_cw~’R%îH k黿q§yêÔÅsWÞR€†ŒÀÎ⮼‰»r—ÜÔù2C¥VEÆ4¬7þ"ÿW']Æ:K ÑìþøÌøtÔ†Jמ’mŸ`W»47¬8º å¢¼ï ’¸cìv$]ÓP`jè…ðšgƒ«Ãвìêà™sè1Á…õy*)ˆÌS¥oHMŸ†ÏÇ.{æ. géQõ~ ÷"SdÞõá“Íf»zŽZ䛜®QmÊŒ–v$n¥ÐÿAµ,ã,صÝYy†ä,ϲi/ÒÒi°ì¸Ì„GÚJµM+cmà ë/ƒ%›¶1Í’>K¬BL#•­Ç®ÖËó:=tW—¿¬g¡?v£W˜c¬}"žñð) m¤ÍÙ­Ú¶;[àiôz1Ô—ù;VP‚´úžÒ¡¿¶Ê˜sÄ8K‡þ¥]¡Ž$Tÿð##¿¨KãY\ Z !•¾¹ ÐRäþíÜåÜ¿˜ôND~ðûü‰œJ]Jqÿ‹GVÎþÈð|„Ùìc©³—ß„„Ù®7‚Ÿ=ë¬}œCOW)þ˜@æ-—¡?ÆË!¤‰©b%|ÑQI_c`¼øgSÑM¶)*%÷ìÀ“Å"z6ƒ'vdcA\–œv%™„ø°W"‰DÜè’ã·ÛO)i…@’ḩ7òSÓ2QW¸&gÙÀqÃñ¢P(NeA¯úK`üa­–õx/P«®ïŸÛ;1‚¬Ú­dVÓxÙ-Ý?p²4‡ãÀX/A“’ŸŸ››$$WªQ) GdÍ –—â/„×)×î¢4i=Ö†® OŒL‰R50’ÄfÍð[4#’SÀMði’Õ@¨¼ ¶ÚDŒOa4ð²ï—ƒ …š`ÿüÕ%%GŽ”hƒ¬PKŒ¨_ÖÈÊÚáØäP¨Ÿ&àÁX‰×à5혇Á0¸xXk,@‰«½ žŸŠàžC?ûÌã5,¯SožKç r½,KFÞ%äÐ dG/ea캣„Ú€Ù­ôxZÎb*1*ÖË$2¢{âÉSJÑäeH•)ÿÞÈfAO (9 ­ï7¤ÞãgÍÈ-ÉHOÜ›¦ú-ÈÌß]€¸Ö“.£±)™×2ŒmÔ_³|¢è“1á“HŸ@”Ë`”Ëa”È V v÷ï_m¼wß®ÁÚÊÎÞŠiÝæñ¹{¶¹ÏMù%pÞ ¯Žœ:Z¸×_6a#l<Ñvn`NhQƾ„=©ªv6?«pO âZNzXOuõbÕŽìïöÇg…OüéôBëqsmÆû¼Z½êÑæ„-ñѨ_àºPÇ=Gè–ÄÓ¨ù%¨Íþ2–'“±:¿,ð¿*"u{Ó" ôÄ-·wL¢íà{Ñ@_Å´8‰ýË|#©hÑÕpå2|}Wöú2lz.-©H+›“¿KG$LÝì=ÄÒÞÖ"4$!9TíóxË®˜ø­¨_ÀºÐU^Í ßÂä·/É»&3é.6 ôÛ¼\ Þpâ.9w¸èe… ¾*ùmÑAh¸Tt çÎj½ý×­ ŒJˆÚ³Iu•ÙƒbQ ò^½À͉ƒí&‡…|kø{X'ÊàÍEð¯—|•ÄLÍÓ/ðŽ<OAx‡m_aô‡Oû•üçǵᎎßú¸« ÁæM;L@ñ‡Oáf¡¬àDúYÄ=º`?dà¼i“-\Âø({W¶C¿ñ÷;Ê5ÞâSÞñ†T+–TÃd´Ñp‰Á÷þ4¢[sÞéÍèãRE#N‹¯j••-DÐâZœ›òp[¤,+u«B\ãéÓÍ·j=­Ü‚=ÜTåáÂíÒ²Kdýåô%½'O8SëÖ¬QñycV,t´6Ãô+êçÏÞ©xtwÁ%‹bŽÏÃCB0ólZ…¬9k׉æž6T\ÓJXtÏ‚ô3ð¶FVÑ¥ÄI}7…E!K£–#n´Û%C· ×~h;ó¸- f…ë`@í„Õ<9˜8é?x2|$Va“‡“ gåÉ}‡Î©cvÔxl9SR¢°™¨ÁO’Œ'þxEðjÿG4%%ùù%ZÍarêÿ¬& q„(D>Q¤pS’"2Ox¹Ýÿ³ÓâO©¦ÿ+RWÿ!RïqVª+Òa¦ú…‚½Cà<äĹú×hæMÙ–½OeÏìHF»Q2ª>|¢îãL>„}f÷÷0…8*×g–ËÞ=’‹&úe¶ ŠÍÞGPö›ÃŒ0ŽhY®(D!ˆ­‡>ðéÁv·ä…d'¯O×Õã>Ç"å@$Ñ,„#‹3²Þ9‚=ö sl“Ã)"2ÄИ³¿&™©0l팺SÔÿº§+endstream endobj 139 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 3945 >> stream xœuW X×¶ž23‚’¨ØÁ*‚<¬OPä!ÈK° ˆ å!ŠõU[Ù¨­¥Ö´*¨-‚‚¢h‘0¨DÚ¨´Z±gMÎçœ=Á{nï÷ |!³“Ù{­­ÿ_ÿˆ(c#J$XºV±:'+<>=pZXRrް66§ëöèò%ÈLŒÌŒÑØ‘',áÀHZ4 „Ÿ… Ó½2­÷öÉ\œ•ã¿1 7~IÞêÀü„ Ä¥IkB’SÂÖ†¯[–‘©˜ê8퀓ót—M®nî3ö0sÖœ¹_:L¦(;*˜²§B¨ñT(5šH…S“¨eTIM¡–SS©)/Ê‘Š¢QÓ¨hÊ›r¢|(gj1åK¹P~”?åFPîÔjH}@Q3©¥”5œ2§2( j5’²¤b))õÅQVT.eM¢FS6ÔXJF­¥†Q&”€2¦æP"SQˆ¨ÆHjj”oô½‘Zì'Þ*¾&nƒ±»q²±Nâ$I”ÔHZik:.¥_2VL&s–ùƒ-`k‡æ=¬iØ ‰I I±Éq“Û¦ãMLSL7›~nzÌôªÙ33³Šáã‡G ¯Þocþ™caof‘nqÖB3b œ1×9#%¬PñÓ•">2¸œ! ñ~B‚Íh\:¨üNwB†¾Tqx fðDbÎ7 %Öž¢´lëô| {z¬¥ßµñG9éYýÑÇPÍHÛÿ~³íéýê„@þWoËôÜœè¥ðŠ•I¿Ó0©jØ«†MjË.-ti—j­¥|—¨éVtíÈÅjVú¶ò‚òú­1H“ÐàTÉJùûgÎ7>ƒrk“Î%úÚ±¸ŽÖâl?æ:ªØq"ïdîW ”€ Ó6äfæ¥ïXN¾ä‡Ÿr°r™+èô–cYdçcÙS“Ç ”Ss²s²[V"–$”ÝÉ;vŠ*{¡¡W 'øJOrµÃÞØ[c“aRß[Xþîxª¼Ø“{~Ó[a‹Pg§°N‚å-•Vn®[“­æûÕ¢«Z±n ¸tpwVaw4ÍK‹ö_”l° ÂfUã[½o†þ´þ‚ÅèÕËcÁN¥·Gm]»)]´ÖƒD=ÁX€` 00î‡ù§å§2¥ˆBÅéJX¤â§¨,ô¯õZKûq:÷NÒ—#ê²Z 6Ï@sÁ{a¹\úÖ…¥&±]ž r¿6ÍÁ#±éÒ9ÓåÒ~·Ðn°‹ÛÝ!¤æïªEÏ´üX­ø™œ£!$ ƒ\؈A†ƒäø­´áø»°€ñ?OÁKqàüÉx¼|¨¬{ÔP¨õiŰžpü8µ~òÓÕú݃ ^©Ö{Ñæð”´Ožr§Ò²•$`-mmzçŽÐ;'Ôq¤îRÅÉ#'¾¸]Ì>a¤U» wo±‰@«SWx°ÒÖŒ9¤i›ÿÏ9ðZ_“slÕúÂA…–6ç?ªhm/lëó¼9WôÆ÷6NÐ5Ÿ8evu"ŒPÈUy· oDI£££×y­L*=¶Q¶ùÐ'‡vV±nô^<¼%Þ'hŽzÜüZWcB>÷ˆï×éÇPÕè«5gZT¦/Û-3‡3Ùíü”Ñ“1ì#™Ì€ñ³ðxoßõ¶td¥¢Y©Üýy¹¬ÙòÙæ¢›¼µ¤Jø)#t];­´lî½= :¬¥Z~£•ô5t®glÃ}Üýã/Ý“ñÌ,½ãÞþ‡LªíDu§êZY/†œŠ”:¥èÕs1DêÜ´AÅs!m´"¸`±üQÉ4;è=°-ïAÞB þ¨D@F¥³SŠ¿€ ½§ä^} ƒB?YW™Ÿ±¶` b}kŸÈk—0ØDµˆþvu¥Œ¿Ì bØŸ¿fN†ýíõŽãyGÉz’ÞÑ–¼q¦Á‘óœ~Í;ÿ©w– e9½STÝ ¥=bþÛ:nÛ®OÑNĦtè¤î0ZßzÌÍÌIL‘e­ßªØµœ}LïûÛ… b;ª3¢ä9 JÙ¸É;6Ù”ÿiêæ¥™i1È—u¼üçý†ã?Ⱦˆ<™Õˆ£Òݧö±x"ør(c{AföÚ´ÕE#6 éLêòg¥rÍÁoö–—²Ñ ë"é/€/90%¿%z Ѹ÷†z¨7Èß¿ô /q" Åü/²W ŒoøBÀÖ‡aK“8Ò°—à ¬”¼ a4Ä‚5Ž•ôÓBòSÁS)jìë½âF÷ ¢ãsiiCz;é-Yá—xÎx‹e‹>\’(‡ &⣜vˆ¥As¦ÿ•¢D{Õ:F)ê&Á/$›‘èø(5Ö µÇéjÝ{¤8£Hâ zG<†Ä•ýñÔY›×䦠ѣÂÝù{ÙÌám‡?=†N¡ŠýǾ>yäб¯«¡Pg>ê?Ì9Ch“ ¯¹O¯m9›[‘\XáE¸3Îc/ìÑg v0²«Þ+‘Ϥ g®Š÷F¬ó²Öª_Ú.¯ö*!Šðpé ¿O#æS¬ ž‰4:æœ2hÓtL Ñð@C‚$Åìd/\'=³ä9 —Ñ) áå‚òuÅ"<ûôbŒû©þTóù⇠.àã¹¾[s hÃCçº9/}æ`~çÑ/]3Äñ³†—iĺ1d?7½–Öäµ’‰ÂÙš®×HÞ*Ö ~-àÞ)âK`3‡º?¹ºéâÚ§s¯O&'OœFÒ_€ü2&YO ÐGIúÙ‹c’ýP$ZY–q9÷ôŽÓE×ÙÝ-ܾþî=F¬úžïŒ]hWÑ.¹³<ÙÛ¦]¤!bq€”É]MŸW~saßTtDÖÊäíÝR\€XÏØ¸rWß6}LÓË Íéj5ìW‹~ѳ~1‘å»äӷЕÃÏ_¾t¤=`áý9x¼ 7 ÈÛÃ~ˆdž5¬˜;7r…«Ü0:Ú`¤¡º½P×)æ§“æ3ñw?¬ð#ÙvÁ,öœqܧ&J~1îæ†è>ú¾¼ö>»žAÞÛVmLÏI[•ÿ!JBkK²¿É;´ý«gØèý!`TèÁ‰sÕ—®ºÀ‚åœÄõ5ÌÇÖxdÄ|·éË “ò¦ê™üüƒPá¶bÄmVôë ‡S§¶mRÊÊ J2ÑvÈ@hoLX¸2{I´ N©Ô B¤ÕòÆ¥@œÀº§*ÁE^€V~Wª ’ãtJÙŽ“»ú‹À,¯rÞ9õ¥³×P –óZ±½ ?3ÀdkLüA±§·Ï=±±tŠcgÄ%:aÏ$a¾~kyÿñ,âpZa k–þh-}¢SÏ´{L“º™ÿZ%jÓò"­˜×ò¹"°ŸÜƒç8ÝfãQ®µá/3åà¿â׬ê5(l4Jܘ–“ž»%ÍCGRª×ûñùâ+dàû•ÆU$Ôû>N1êE?*k+ë.žiF÷P_ø}‡SxIÝ(·²Ôrt“}Ø\÷°Í‘ŽÅB”8½]Wò–@)L˜¾ŸY^Pðágȼ™’]Ÿ•"öyÝ…åºá ÄÏ²ë¡ 3TǨEðÑ‘¿ël8خַΆƒ6Ú¡1"ðå6éÒqù„⬢uƒ®’¼¡ñ:xIü‰¿Ä–Æ™8Sbð>:™RôD˛ꄡ²Ÿ™ìŒ‡EÄ•žH‘%—T¡,¿ß‰¬c‡?a!Ì£ç0QÆïg P ¶<ƒ#¹yæ Â€îÐ*?Ö ¾ –ÔÆ+õƒx?(™DÃ!bN ó+º^ø³–ÖÜèyÁQ¨iÇÏ7î´Ü=Ÿä'Âpy§2Ñ_¸äßgžG\Ÿì¿1$Z–v3¾Ìù Ø +YiÍC¢ú¶*!¸M%mbþ (9œ >8'øyirI ¼õpöMù Z¼97f›Ä´¿òTf$·§°ã'Ñ÷°M UÐÌám‹`› 3Â*›¬èï-âïýg1„“ì„…\¥.ŠŒœ|‚Þ:¸Urƒ†­º­ïfªJ%ªéƒª>1”ë¢8œ¾&:6(ÛakoïÆRp„)jBºBåüó7ÙšúrBsãµSÉàŠ6Ù)æ7ˆ„ÈÚ/†X)‚ƒ1äwsúÝ]T(“†E¹›ðØ6$R*DóªIüŠÄóÏ…MÿX(xÔËW­œÝ'æ÷ôrúaôþÛßVõ^{Õ8ê÷Ækí¤Ⱥ!þÂòoü òKM ÎLÚ·k«¡÷\ý¢âàñã5ߟl@lwSØüðu+“åÎ˱ÃÌU~ÛñôÑ|Ú»ú°Ó’—÷-î³–>  âÐUÅik}Ü®Ë"§Æ\}ó‰œx¶°’5‡S+}ÛRúÉlø¼Æô¥ÔP!—>¹òlýcÀ|N;¶Áöó=ðÔÏdº¸foÙcÊ‹—Ën VU» *_‘ø‘Iñq‹sÝæ6ýf~uà…°»i*áI¢ÿÈa”‹K}–­_ž$/†…7_¾FwQMâW¾,¶3¸' !Ž®Ásfµü¢iºÓûNá'òOwç¥4öÀŸ,Æ‘¸}N_„Üg°Üa-;Û·!KeYÕÐEäÅZú†·á‡qÒþöËe•Æ€Ø]EÜÖH7,ö/Kþi¥LúfNbBˆÇlõ› Ø‚ío}Àu%ü0û¢ ³p€ÜØq5n±tÜÂ…Ñ—´Ô]~(ÇõÆÒ7š¦ðY3ƒÃ]fßêéiº©1 åh¡Þº!êñGß1ðÝgbòY*ALXµÃ­ÿÓùG nû£MD”âONŸçÃçÑŒ‡þ ÕÛ0@ž ›‰ÞŽã7p+˜¢[‡ÊÏ}Î^`‚w®‹AóØ‰ ìµú¯ëänzíİ…po¶Ä» ìz¼"„¿A»}4ÌCàŽÀ­<4`Ǿ» =kq ÷ ¬ïA®0 ¬Ùe´ÛבiEžS±[4öpÃä6Šú7»Üæ¤endstream endobj 140 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 1724 >> stream xœ”{\×ÇgfîDÉ‚,†ØPàƒ(*¥i#A¬-(‚¬<”õ±ˆ†Ç* ò‡€zÕDy¨¸ˆZt—°5pÓ’@}’Îúë}LôSo§28lÇb;ÛsóÒfÍybÿµcýT)ú½©Ÿ§¥¯Û¾g¨.~ODÅ2?†ÙÀ„1™fÉh˜…L Í1¾Ì&˜ù#³‚Ñ3ŽŒŠq¢I[fsU1_‘¥xi³Ìæ˜Më˱c¶¶õÏEr¹ Þ…O“R~ƒÍ²Mkü3ÇWà¡ tQ™/;6óZCv5G­-¥°p¿iÏj‰ ì¬mÅ\5#!‡Ô#`µýj#ÒuAê;±Hõ˜xláv>"?ÒШbN)SÐ+{ö*®ƒÙ fÁ"‹d™§'ñ%‹&½`!øMN‚7,÷yM–HÅq¤#ˆ¸gmðê5q#à¢yxDRÊω¾>é¹-aÂñ(!湨ž6½uüñŽCV+Е⦣ XÿŸÞ p xå¾#LˆC*#ù€Ööxú­-²ˆS=…pÈáj®¼XÖˆ…§Ý܈]XàòŒ/N”¤Ñ¤¿Áfx³ýÚ({Õc£3Í|!‹vÞ†.Ÿ;_^ƒ¸>·:UèáÏ€:½"½4¿w;|lGÊÎ= :Û¹±¼ê:ñ¢™Gg¨h¬T"rûe¯`ïÂ,V–d½u6úT4ˆ}`ÈÊ ­»¿Ù%ëúòp¤ MÒG&ë˪ö©ó*r'¸õÄ›¿w°¿ “¶)~;89ÞäwK 3î9‹o ×›- …yõêÊÜÓŸp¼~)ƒ×oë߃û½ì'ÂQǯ¥5f6^Áí¸çô@ƒÐ‰2о8ú9Ö¼8"Á ð Þà‚6/X½‹GJù¿ù›eöÆ¥:ÇçT.ë¬L,`¨{,§{@N"‚L/{{Ûï«Ui›`£m¶ I^»‘ù31£HeÉûL_˜ú~ð¾«ãÜGJø[äa‹lÁ•mv† ÿ‡’ÌNnF5UK8 é‰ACE5ÙÜt3ÊÌ\WD¶ç—›ÎCd7¸ö*Ú`.¬‚9,¼º-ž ç ØÄkJr¨*8m±72weXøÞš¼fõ¿àk Õ'ª±0dLüTJF$~ËâL°ª/ò¯}}·Õí¶ºŒÄ¼}Xت7v õ^„Y©.a“ìÞ¡¨Ï²Ur¦¸Ý.‰ÄÒÇ׆årZИPÔé@ýœ¸çíÎçtcBšrâ‰àõ—q$D‹ºóW9¿…Ù%­¥ÜM uoÁù]‹âÌceYA1É[²¶aÁwýØwt¸ìÔ±£§%wT›s®Jû–Ñxãnh§YH7²˜xþçð¼[{mPRþ‚(É‘NÅO£r8²œ!Ç–eÕròÚé×Ü(:ù-7}åe†q1ÐlAkKrg`WT=*å:Im "NÇ‘¥²–»DªcÑPae7Ý„²üé0Eÿ’¢o‘m¿‚ÅmMut±]!”¬üÞ”›HüQBYÒɽTÅ‹ÝÝÈJâñÝB°íîj¼y[Š€ ‘!»†›ú5Uƒ]46Ý'&Ò¦ª ˆz@ç?ûÎè?êÏå)ñúüqXß ¿ê§9œ \Xù8ˆwEÐ`Á;ô ã˜ þÆãR\†Kðøø;êóɲèG/ð®»ñPMœ¡B$üÉgí]XèoÙPŒàbI _Sdh#OÀÇñ_àE$«ªç‚ÿÔnqGRâ6í•ä¶›-—ÍíÉ-q’êŸd?;-}hf—#­fXmFVKƒè8ä>ï *ÆÀ‚éHï4ˆ÷ÒæÒU ˜œ í%öm¼.…µjª“ÎiZô͸Cè7·µ4åת«²Ï.àFÁŸi© ¥ ø®$lÌù˜dÚõåÁ¶Œ‘„?'PCػ󣤔’r½:§:ì¸U¼R>›_(°|„…¶Kå#/h-ã¸K6t÷Ö)à 8³0>õ{‘$rQæ×—â¦sÑ¡^…\4ü¯ -1X53·ÞÈUƒ ù«[¯~#B*,ág NþOˆ+ñXº&`û%½©®¾´²A "ª;Ug¨ÅÂ_¾Œò#sOX’@¤ßÉû!|=:°œSfÖÈ«`UMïÊÙØî†ù?ìgendstream endobj 141 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 5483 >> stream xœXXWמ¥ÌŽJTGÌ7“˜¨‰-öØD‰ h‚(Vé K[ÊR–vé ½÷&ÁHb#jIJ¨‰«Q“&‰š¢ñ‹ùÏ$—ïyþ»»´üÉ—ç_ÖÙ¹Ü{Î{ÞóžsFB™Q‰Ä|““SpPðÂ󜽼Ã<äº/ŸMÅQâ‘ßM‘™123yûÙi¿Y@¶9˜OÒL¦t¯µ¶A;ì‚_?´.d½Ü>4,<"ÒC±)j¿Sô¯ƒÞ>ξ[ý\¶ÎÞ=wï¼ùî b.Z¼dé²W—O_±rõšµ/½LQÓ©-Ô êêMêEê-jåLͤ¶R³(jµr¥vPvÔNjµ‹ZGͧvSë){ê jå@-¦©%ÔFj)µŒr¢6S¨ÕÔ3ÔZj"5‰²¡Ì©=”ÅRS(ŽšJYR2ÊŠ2¦¬©iÔ¿(ž¨qÔxê5â8eBÅQ¢¤Òè_FnF×77™L1)256 £iú–t•ô6ãÆü>ÎqÜ“ñö$LøÚÌÖ¬å™Ú‰V/Lš1éúdÇÉæŒù&ó§Éç-0»œÝËÆ±õì£)ÑS>ä¸/¦nœzÎÒÆ²T6Uæ)ûÂjª•»UÕÖ ­£ c¢X‹4¿jÄç#%M°åGØb,ª[9T’r8>WŽb~F¬–©Ž*3PŠA*/üÌ`L‰Â:=A­NDqL`#ªàŸÐ•õ¨µ-y u¿šÂ2ºîSïHX*…'tE#jðØÁaý!|dª?ú4.‹Ÿ´à¢µdOˆ…­\›ÅðîKÿ²ã½ÕÜ| žÕ¶£²ý¼#'Û5¢Ráîs½‚Åt)Ù]÷—‚;¬§Ù–Ç·ž9W¼…Ç‘¤úuMºuóôëýÉ¢RcÑNØœ\ÁÉ–üo8Y²·ÄdbCŠåÃhüÿ6Á&ó_Âæ˜ýa.Ñ?‚oŸÏÍw²±µuºóàûk×n~|ÕqO6HЈÉ1-\"(`5׊Ta((O~ye¨'b,ý fÃËßþ6pùüÞ•¥BvtVL+b:QMµ‚´5F¥$&§ðé©(=Nî×¼·zb0G¬°ÆŽx#O˜ Ì7ßé,Ær ¼¢ëR×Âs4™«³}Ò¢ŸŸßíà˳ZÒK½þħÁæÿÊ'OºÛã=U;b@òÓÀ öSç¬w\¿ÆçÞiþ–”µ¸tñÜ•Ûí–ðì’ôk¡’øp°d)ÌÆV<öÞ½L¨T†^‘íÁò<KÉÆxÜ[x‰æQù# ¦½„@Ì·n뱬#{Á.aP ¿Kü€®Bµ¾>(Ú‹?ÔâÙèLÐ1™1³xòÃÙ`týdW]€ýwIõ´­'ô€UtYƒ.‰S9ç]+VØ:Þøîþ íçwN¬u0xáp×§¥¥ö„vÁð1£›ŽŠˆäíq5„ƒ¥ÔÅtAµUüƒ¡{1ž<¶wší†ôí´…ÑÅ’ Õ¦>ìËŽÍ‘ÖAeà(¢@³Fù…íÂ]€yZ0Ö¢¯-ÙbŒ8«ŽwùŽQ›\ø#RöSýŽØˆñì Ü·rô JG³ëøþâÃK?Â3|fhEdbj«Ë›†óÓ½%O´ð,q×XŒÕܰÁæ£&v *ýÆn¾F]Wðƒgé¿ÅâYr+{ #iõ±*5Æ¢;˜sèWÌÕøç¾Q, Êy£½Ã4¶·ýðei`H6ŸÝ6”Z}:„¦*“Óy÷w¤ ¡^¶Âû•§Ñ÷•BOÒçqh;sð ß‚=[‹îÊù”ÊÔ¢ÄèÂ%Ì–Æ ykayfW1ßã}.½™°yQû—§‡²üºF¢ƒzñ}Xp•¨ÆÇ/#"šÏprN CÌZt¶A,—ŽxŒ—÷Ó#dX±Ä ±:õº‡Óè9×½oÝþ⽃³.º`Z@#Ì·×ÚÃ|K6V,lãZC’wƒ~ZóŸ¤Ý—f{®Œ÷_:Úy¨“þuE!=Gz«»ûpsÏîñϬA•ÓnÑå ¨MçPE„8^#©‡ý°ÓXL_4¤ 7ÊfKð,;¦Í£a$+F”º•)~Pì[jUªCE …‡²VCòcR?3I9ì~»Å\q׊¢x,¥£Bõ¢Jè¡wâ3¦tjcÜÉøî¨+iE>(‘Ä-!<-y?æS#™ ÚΘöJgRÃ^C¹Œr²c!«c(»°RÓp/³4»–ɤs]»ð¸œ¤âèJTŒºPvyNíeµÖÐc~Scñ¾bHî*Är‚7©P‰¹ÙI<Honû ¿¸o² ¬‰©/k.ìÊäQAffuVif *DÌ'gÖ x}ž´ÍaØû+ŽOºúòÛNñ¬M@í錣ӚkÉQxÍ¿9ÒDˆbØ’ho7”4ÍÉóÈ;=ßtÁŒœ‘<&Uvv]çÈÇ&ØeÉ~:Rb÷Óx ,^2=F—6 'ëP jQ“`;óµ_Lk‡*,Öˇ¡˜£a<~ OÆKM÷ÓlÃÈ÷0ÎÐ |“ð$ÓàáÒJîéNi$ Ñ‚š°>V'n$Ô„Ï‘DÜÔ¢²W:jвQ^t *Ž^‰fô°fa…f3X¸kÄÝ‹F؉7ôƒ=ì´d­ÿ_ǾqÕQÉVtJ•ª&¹j>$ËþžŽm4LÇ¿ç$¢4„¬’¿'gØä ïôØ å–¬MCT¥œgß;âqdÏã +Êàq·é(k âsK ¡ÆâApÍAH“˜™Ì«ã{l³ìõߟn&dŸVóR ™>UÊzÄÔ×T´Üz¹a›-øÙÅØìá °áÈÏCq^¡rÅ…Þ}½Ÿ÷³äÃ’­sHœ#?/*¥í:n²Kuaä·©LUªB6`7Y¼·*HDò ñÔb(NÏK¬—#%b¶ê‘Ø’íü Rꯋ'›«ƒï7xÃ~dØ<$SZ´÷*vɉ++ñÊMÎK*N.F%¨´  4;ïkÈ+>Çd†Ðº- ]XbÿzŠJz´ÐMhÜÍ]­q^¸V × §¦:3UX G ? ý’’ü„½ÒEo„,)¾†{""3ÒP´•o-ªâÅItmªFeÌp:^×€éŸT0nTż¿QÁE´_‹gù>¢ñ’9¤œ l6žüÝìßzßmjiæÙÍÞHyŒÒ<<^åØÎ­nË×®ÛrsàÇ×n\íÙêb_tù“Ë0EcÁ …;*)M‘Ì‡ïØ¦ F6Èæý˜o8C×T¡. 7þŒ§â sfáIÛ…'þ28ú®_Ó9\E—Þºtþ"§¼ðEf?0'©´IûÓ·Æ¢ƒøwyŠYµvï~û¬ÑÂð î›9Zü¡~´8Ï„>˜8†öOÑw?B­|jáÎêºòf8ê2Ø^8^»xÙ¢å¢B묅 Ú‹©Ú·.Z²“)1O”quжm »2|÷òìxª(Ƨjï´yël–í«ð+S¬„JˆQ…Z#ŸRyaØE6¨UÕÝ\S\ŸS’™w¨.ù0b*êŠ[¼sÎîî®Û)ý`t0:yî *PÕññ-a5Ê"†}úaW•¦Ûú›×úñx¯•°†A¥|ô &ŒF\~wI7ÑŠÚƒöÚîaQ`•E`sÌÄ\©ÿð(éWáßÜ.··ð¯ƒßÇ4;pÿø›»GRøöc ð}lG¬$ ü̘>î´aÞbàéb-×^\ÞÜ\[Û<2ÆXœ½æ¨=¥AëuÍ’ `%‡®z¿_âyìPþšÊ••2b¯NtŠ9Ósú&Œ/›Çg‡©«‡Ç™¡K‰Lâ=;·»‘Ü6¶Y½lÃI‡/C2eËšÕ_F.±vÝ÷æêà]9Mûy¦Ôw3*3*2*ý‡Z9,Ó÷rµy¥í…ü±@MÌUÒË1ß*B¤°Ò¡qzd×<üDwN´7„ÈÊHFÂÔÁy4ŠF^!>‡¼H!BñY±YDì²P>ÓVijª×~FÝ0ãm0»Ê³S2Åÿ$CAýH{Ÿü3SÆ´ÐÓ ’i7*™çÀjPé:f$±ÓK‹Jý¹a&ø§i$w´@v®ïêd3–ÇܘY?¤ŸspuÝîxöxxØ*%!mkÕ×î?­zDãIß¾òøñ·÷aZ¥Ã=ãP; Ð º­CÕzê°.ƒ¦O¤©ƒJ²çèõÿ)%dj9× toK¶G,ÑW@oRH{ô¢@ϸÁ|ì‘àJ?ä•¡á ûEkz$Ššæo0´½-à>©wÄPNÞ3%ÙD€7¤lÏ@÷©îºÒhG+¥ŠáĽó§Eÿ°Dg'D}h,î?UĦgÊ+Þè)ê’¬8¿$U19¨e?'¿žÕ˜ù!j±*D~~ÈO”éÂcꊲ0%#«È¸¨XE‘º$YÉ›˜z3>9N"­RQÐ1&œ’ဂ¬Tȯ£u¶d|˜ÞÈk|VßðhŠÉBˆ©.©,ÓÙ³\óû {9Á>rûös掩 ´_²Ê_øÏFi@^âFQs ì™Æð¨ÓxÇ}X ¿W‹¼#/?3+ŸuÚŸš˜•‚"™Ø²èŠö'€?z¬Rk ç=¸ß7%ˆÃ˜ rî^ÀsÇ\;Œt{PC"úÀ%®ÓÅóø&ïƒ||:Q±7éâNÔ9Æ4sc¸ÛÇu6ú{ɶ†´mhkÓWµUº]°ìw1˜¸XO\l +ˆ TXþÕz0óGß±¡4€Q˜ô‘ùÃâÜÍuŸAêg®÷S¢?lã€^<€\]£=ÝøRxþaÿ=t•'䦗E1¡•‘ Õ­=ÞÌ&©dŸÁn8Lìñìw ùù+0ì§.up~Ýñ@&’O¬ÏªG¥Lßå÷?ùâÜ[Ýù‡#Ä‹Éqíâp˜øéz}I«Ë£Pb|Q¸Bð*|UÍi`/á“ÖE÷ÌO÷||®Mw/ÙÖ|Þt¢]`ú—ÝŰ٫«W:ŸÜùYÏÞ´‰Øø¦õì‹Á,îßû‰_Ç8g'w;ží°s:Ñ{¶÷ôgw/ìvJñ;œ½ÃÖå<ë¼Ü¡W«¹xåûû6mÖ«ÛpJ" âU.û”oAR  „l÷ì.ˌ͎h&ª[™YÁàå°ïŸWYÑ]$ª:Dè_¹Žtê2ÂqsØÅ¯ù”sÙæ¼|åön{³÷ã÷šÃ"IZ2í ë¬ ò £,šüUƒñ%“¿ÓeÑç{UÅ$äãcà ò«(¿¤UYÕ)ŠcTi*%ûñ~•:. )¬Yy8¾Á^²RUvÉâòªâ:=®7ú‰ÄG‹\çA2ê‘DyH|‡Nâÿ ‹;ˆÄã¹&~:ùÿƒŽ÷#÷ºt]Å#º´Ë ÿú*ƒJ’Šóñ7à%S¦eª£ˆSoIõ=†0ùIHÖV_^˜YXÊC?ì/ÌÓ›­3Å–PÔa‡Ê’s¢Šñä¯ö‚ôø(`ý}yQ~W RªC‚ð>,Ã…xÂÉ…;ùsvw¶’ù¿1·º@ïÑÛ¤^>Õ™ö~çóþö[6½¡ˆ‘«#“b‹’sÓXŽ%ex)éßgÄž¶ 61)Å2Iy‘ -°D¯Ÿ˜P$¾^kŠrŠhÍxí~¼‰K°Ù¸£åy™ºWnuNž™Eý/HÌÁendstream endobj 142 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 2584 >> stream xœ­V{PT÷¾+ì͌и&½7†¨­F“ÖVMÚÔ<Ô„4>P0Æ Èk–…eÙì{9 ûbÙ'ìòÚY@Ô6E”0HL¢hÞm&&Ó8Óv:™$ý]ú33½+ŽØ™ø_ïî?{öÜóûÎ÷}÷œË#—<ï¾—víWŠùø† iþ±²ÂxìÀ’yfþE>,M€¥‰#.=œŠV.ÿü'3÷ñkÅ3•â*I´6¿¾ðhѾ²c¯~,ýÉŸÿ‚ &ö{‰Lb?‘Edˆg‰WˆíÄb'±‰x‘ØEì&~Güž¸H$ ’ˆdBÈà~Èyé¼²%¼%Š„”„ÆÄ5‰1~)ÿ*YL~uO;•Ni“~•¤Iº”L&Ϥ$¥d§t¡Ø2¶ f¿eWÉxlkL­†jºíáË¡ª¦D »nô5@ÍB¹¾Y @‰£à§¿!Qˆqù5ÌÄ·|´™´¤+¡Œ¡ÚhЀŠ÷A€Ë F Æà{Q¶¯ Ñ#è²µ™Ïj˜EïÏòØ_Ï%°è­¹§¬Ê¤’iÕ¡º’Z  f‡ÛëŽ8CŒ«{ ¥Âyê­¢S»ó åÅÅ´r¬¸½J¡ºN.RSí-¥³Éú[=Q'ÝêÌòXtšf“EÇìÀƒ&XÀ$”ÔÁ¨½ãOºóÞ//…OŸ›*äÑŠróq²2Ÿ1ÈJ¨£rÊÆ¯Ÿ@+ôm¤(m®$°-("ø>cúiœ‚“ñ*ÌlœÞñ¢Ð½h%ZC?ß"À¼ÇqⶃÒ×'Qâ׈÷ÁTç¾#ñ*X2‹»Y©}ý‡ëÚ†N¾Ìy{{ÎQ±DLKÏ嶨!$bUu}¹ê4.´Ô≺hG·÷B˜Ãi•Í®)/»¡ä—êJqZx´žôs4G«@Íä’¯£—­–Á¢I"â{´=ÄìäpݳS{òôWˆÿJ¹x—›Çå¯cS9_'°¢¯W¶Çž•ïƒÌlZ}\Éj½¯1-°ëír0m'ÚÇ£@µ…LbXLJæy1)9vÍw°ADï{Ñs}ャà…“–P­Á¨Ñ„ªéTtuÄ<wðú‡YôÂl+G«ð嚎×~w±ú¡ÍÙ FÁ >„.¥^on„&ª¬ßèEü§'s†Å«KÏ—¶UGêèˆ,h¾¦>n˜i‚"hP•—ÉKê Ì• †,¨ ·¶z¤šž e©öåõèÁæXôMklŠ>éÿ#œ¡ð\™E»eóÕò Ê뻇¼m#ކ³ k Õã p[€³×`Sªµ:(nº°ýT륋‡Odɤº*&r‹€Zõ<æÄéŠØ<>¾4딚›,æ~N}àˆJB%¨]&_È×Ò6*¤IjÄ ‡¼ÒwƤcÅÆ> ï”8Ê,2ø³9$âÀ÷½/Öw*õ³‰–ÉEb¼„#q+üñþùÝA“ÊÃèM:¨¡ªBêð@¸wäü«¯=‡8?€™Ìpáà1útá$ À0œ³Žùö«œoK…øÜY©WîôÔª…îas­ö8„qÓO’ʪ[f#‹ð†å„ÿåVÎ"nÎ zéçîFÀÀ «µ“‰‘WáͶÑàŸ‡œ— LÍ/çºOë3C‘jzüð8ŒþoïO `ûÚßÐäðÇï¾> ÔPwC5ss¿!Qü›Ê®œëœÛyíþ´ïرÄWN¥†­«T×*€ÒZ쾎–vß$ã~­µü0Y2`iùèĹwá2õážéu4~i‘  ÉMa¿œTVs‘H| §Þþ[¡¼€DüÏÈ·ýǪUGM F *n+n;ߨK§]oè¯af'› ص#ãQú9ò<—ý.ùÉñ¼üÛnyÿ«T¤ž‹ÌÝŸö«^\‘ݰ·°¼‚›FJgÈéq…™Á¿ô\ œât 'Œd¯Þ‡“Dq÷ÚÝ~;ÝóÁX0T‡§©AkÒ6›™­¸À¨6ëA&<0Vzþ›i”£ã(»'=öŠ`¡ÑÕ$Ú:ŸÎG›€3ÈZnûè+ñöö¯h6Z `ˆ¿9yi”q3‹¹],ÂÕBchû|v‹Ãjç¦çBÙŒE»¡GH¼å‡t>ÞtG,ƒ s“Í9ðwÕÍwÈxgÙOæ—ίUur}£ÁHßpü°[«6›¡Q(÷7„mî6'ÍÚæ_rºíhr÷†ëЖ«hÍU´YÆûœµ'°#è`¸4t9…Öð/ža挘<ùÃVNãePV£—iMô+XÈ_{·?¶š2(-ó™…×ð³HMéÍ@;ÓOj¥ÅACÕÕ=Î>‡„üýxøS’[mÃÜÛÊÄ ­½ .þ„£å(-OEå(í J»?mŽÝÌÞ+”tU—–WvIb£C±QzžôÈŠè´pùQñ‘’¨> stream xœ½[ÛrÇ}çW ôâY[ÎýÂÄ©¢(;eGRb’IHUj ¬H(  -Uœ¯HâïM÷ÌÎbiŠ»péA$8Û·ésº{gðÀQ>`ø¯þtsÀW?ððé þot3xq~pxêùÀQëíàüÝA|€4§Nû’Z%ç7äìãl¾XMV´8OIr¨²Â…ç45Ò»ÁPª¹‚ÏÆäÅP F½säeµ-'‹õd>;*†Òrʘ!³Û›j9Ca,Ód<)¯æ³rŠŸxXÂÉër½œ| ÅÛóo¸¤Zy18upþy¯\|îd>[­—·£õ|V‚}.·O8*¸`û¼GûÈ/Ñ%p¥gô„Qã1 ÁƒYõÓ%y6O¢Ïž£GŠzo¥ô²Ø©lXË6ö>FyYû~I>Áau¾5C­@š±Rëž|ñË‚MÂ0®Š!÷ð '1f_|[¯ÁqæÄ@4T4“’r30LÝv°¬ÌÀ4« ó.¿þÄÁ; .©ÁÕ UpG!g´a`ŒÁõŽrë=<.“žƒOU–€‡|Œª3PÅ(ÈÖÊBbKͤ£Œ³ðÓòþüyÈS†+ 1@"$ø9<¬w×Irqq:Z,ŽŽª‹ùrýöí&–Aikw[ª´W°Ù.`©\Þ”¸ÃQ u<¹eÀøá!w¼Ü¥@`ð3%GGŸl3àÊrÅsdµøÇM¹Æ éß›Ûéz²˜~̂Ӈ/Ü‚N!ZÎ\’ÎpÇö¿‚É~·@p{ Þ‚ãžc/  L¶ö<ïâ0½wfß±éÎëþb/™¡Rù‡cÿ¢çØK-€õl[)”‚¨Kò¯\!PW%(žÂZxµâ“õMÓ°çŽaû½eµ¾]κ`Žé¸%™Ðã~ws`iø¼‹ÅÐ$8¦Zò^ôl±„.EKÅïPÅŠClµ ÿ~”3´oZAåB"Öm‚3h .èS!æ*4‚t ÷>š„¦9€e’Þ4°Œiî×p4<¡"c#%#[œf±foín‘À›ÌZÙú‡Ù¼2%mh–ŽOë…vê¾QXë3]¿v çªx; ©Åí‚RmïÛjà_‚ê§Ûl0·\K¸êb¬JÁ^876ôöCÎC;_#Þ…‰©Ç,„œ;ß[fâÆW§ûÍÂLWY˜I…¡®s™Ð-‰yR СØÈ| gþ Ƨr‘©zñ¯‡Ñ.Nx{GrÖæQk:œô¹¼=åN¼ z³5Ý@Èäál¹\U›#Øø&tóûüÝæ ÇhZ®Vù‰i/fÓ[ÈÜ×gã«“î/fëý–±+D¹=íOŒLv—jÕäR&ïùÛžŒu*ÛÆvi¯ê³…\í« ݦ·¸&vÙ6uh¶¨²÷ÄèˆêLúMblä]`f4À¤}‘cÚÕž ov27œnjG´{c…VÚ¦Í0ûÙ .¨Tªsâ7›±‘·½™» ^sNz´×”¯2èÞê\&ïq^÷”˜5†swò—ùÌ+!Cw)­Ð¡$§E“ š´6jÇMi`{Y]$O«w,eŒ+R-«Ù¨Z=®Ý‘f`)“Ö ’-- ݪoK¾(× w(¬ ×a_Ïûœ‚f4~a~]V£ëiU ,­Ñ2­×äuX¦ÀJI¾-ð.Š5Š”Wå¬þœ{òz#é’&ÔeAë·ïÌT!ð*H¼F[·áþ,6[†‡ðîA}·ï!K°ÙZrV·É™r6®±àY5kþfcËQ 9æ›`®°äŽ(_޷ż®Ö×óñ*Ýn…ZK˜3’­ÂD¥Çn3DåÔC3 õ–m½£5ÔYÛÞ¼ñ|r)"a0Q‡¸=€INNßÐE9úgyUÑ:ŽÝˆ‚J³¥'?MÑSô³Vk‚¤4°äÇñ)‡l^Mæ³x€šq@%„1O¾.f4lDzÀ瘒é£ùdU?h59Më‚j¢ò¶& ¯].óÍ$­÷äšäÕZpX‚݇ÍoŒ;I2ýÃì @„¯±…—º—7åx2Îwq„† ÔÌga¸¡hÌgøìgõßÌÖÕUd†‚”øí†Úd!È»B‚0ÐNæËäˆ&ëëj³ä³cdDLnÍImURa9/° ýU7‹)„q¼qùÕdV•ËMÔŽ§WÕ÷aC¬(—I‰•ð9gW ¼ógù¸‹†„d¬{¡!À©Åï:HðH¿ECÔPQ ©ÅCaËB®‹4{×+"Zµ, œ„¹Î7%uà¤pMø)q’ Wq“°(•8©ù àYPQÓ~dú§¬[¸¶ w臅ªt—} …‹ñ–" A^t®jä­à6DîÌæLÄ,Õ̶˜H„¡Ü4L„;è«Yö$ÒzN‘å ‚°&|Ý BÛŠ¥æ?¯ˆ7æ’¯ØB³äx4ª¦Õ24O’ =»ª…zÙ$ ó§Éúº6Rãzru=\TËwâË*¾'$%è,ybÓv 3™Ö N‚Êâ 2±¤…Ç¦Š“ÿÖxm“•ÔøzÍ&²:™ß,n×…â7¨LàŽ3ühµžŒV)±›ÎÄbá'/Ëu™¼„ ÀÃW“ÝŠT”ËÄÏëo‚‰Ü$ê9k¾Òdy½$膹\Èv1ø&¼ž~°ÿ…3#{&$ÎUÐ5fºB⌇¦ÈZOÌá{:ZK %a—Å;±Ìõ`xKmÆ>½s…€’&¸nÅ´¦Šñ fˆNïôõ1cØn–rxžá[š.ðm.¸ÖÕL Û&ÜRØÖ!A¶YmLqÀvâ0à‡6¬q¬;ž%„A)^T³$Ê“Õüv¹Á&OØÔ‘ šŠê,@°Ü ‘N]U^?n–ÄâÏud‚à„ƒÎ Û E£\­ëm`èõ|ýqÑ 4 ¡&Ú•#{ú1a;ô ³Õ$6ÈPhª a~õ©Ài=v—7Õl½*ðWä$ ô êínfQL£UblDÂmNóÜl2*§›˜-«ú(QY²ÞÅÊSçdÓU=ß„äÍ7'(<~×ó˜n·ö¡e@M†ÇZ‚ðx" ìÌQ‹—yŒ2M%-S±0T4æJ¤x¯qc¡à1îtV­;pB8ü…h玠àwg·Úwa`6w&*˜á¢Ì†(‡9¹ÅN{,)5ü ‚Û…š†?B¦\™ˆ+¬ªq…pð²,*Ëq|؇NUˆP©êNuø¢\a»„Ce‹ÈrH*©!EklÀ ƒR€ì>¡’‚Ž€[îÔóÆU&C¨g*”Kà0,À÷d5ÞÊ36Užoÿ|v¶£ë—]è2›»½?*t”@Z·À0G9$ï‡ÃÑhÝû×2<ùÛäj†b¡Šp‰ˆ#?'r™s œgÆ$rÿ y‹( ¯ KU}äîùF<ŒìzS,6ò4#x~n¸Yá KLðó ®¾;ø?Ê0·dendstream endobj 144 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 2004 >> stream xœUUkTSW½îå¶*H⇄‘Š‚#ø¬ÕÑ*HÁ P^EZðE ‘€CxYr‡˜Þ  "ˆ"Ž©O´§Z…YZGkÍr†®¶óÝxhsGÖ´“?÷ ‹K2½™É…?' ÓQ «UàÀá`<á4mÇ2ó+À&Å,æÓÁÃQÒ þ|7‡m'»ipaîÀUZ22f¼|wÎÅ–ÔèœbíáýŠü•°ù~)­3˜Iú$ø‹¥Þa©AarÉbÓ˜p«l`lDcà uàjÍ/á/pï¡%qÛÖDoRÎG+Xl÷t-8õ]ßèMùÀpÇ¿Ð3f®|ˆåû± w³'Ö7Jž¯P†Æ*#»5¡ÿ/ yøã ¬†Yü˜%ú7¸[[Nð\I›¾ U‘ æ>Å^ØÞ%ÜmµÜwY&]ãX¼üwX ›€uç娕IñòXˆXÈ+?޵<ï¿§xp«ë Dg3ë÷ÔhJ3QKPà3ø$ß$|wr\¼âg@Á èªßÚ§º‡¤°‚€Y± xòû€Ðäm± °VsWN}â%Þ˜Z¾»ÿk?«g ;^JX—‚°.©ÿ?ÂoB/-Y?f¼|vlN-ªÔ™ŠNÀ\§ƒúCè0 BAñ1>¬Ä¥ñ'BñàÅbÒzw˜ \ÀÙQ2ÎòV\©I”°ñbݯ ÈHÜ!ß‘¨ A‘(ôlÂó”ÇiN’‰aMMZ–´C½e·²âX¦\[]X¥kd±3S”­+Dè“ö˜ói=êü[ˆ…ƒY7z>hV,lû¸V[‰ÌÒŽ®úA¹äæP§&©Pw¸¸@aÏÔf>h\4ó­ù¥| ·–9 óhB˜Ï£ý'=Âøá§EÚb-Ê‘nïUÞïl*©h“›_i‹êòT]Y{ÄP]jTÜ‚ú¯Ìop^"Rú\ý`®£d„o2rÙÆÂT‹Êô冊at’Œ—š µÕ2ÔžÕ¥®Kj‰ªöCx Z¢Â³YpdŒC'Í·{¹!'9C»_“¯Ðä!´!?¸À)úàN­rxâÞ-h+J4%¶§7gœÊ?‡®¡?7Þ¸ÂJ&Š²Ñ¡Ïe(ßPx$%FÂöÌe­ŠŽÝˆØè4cç@wç*Å¥Šã%•†r}©^Ze(ÑW— ’NSzA+ùPGã5ä4^ù1¬†`ë°·Ò@Æö°æ:^# É9¬k KN– òˆ˜tÞÅ;ÓØ“y8٭ϦCâvùçB†<¹‹jŠ*uõHzõ”¨:glh8}^[ÄN¿’'z$xð¼äJšˆ4*Qß^åÉÄ3±Æ´y'ElÚæßA@‘¦¨ŽÝ§?Ò<@À¡Wû@Æb£ôÝ›FL˜rjd°æzÓEEÛõî–!Ô‰šsk2*² ¹zbËd¶ø‘’ gCÿ;M¾¡a.^B ©\>yUÃ_¥q2ƒ½„@"[Nü›rò¯_–›E…bÝg;¼=êÂlÇÕê+ñÍ‘t5Z±>Ê7e ZÅbñ׫~¸;Ø‹g>[IbuÆÄm°’c9£IŒK‹FlHb÷ÐQTQÒ¦€‚q§2G;*L5ƦŽÞº^Ô…ÚԨʳ y(‰}›Í ä’póåà…ß[Á8ÎC뙫mY;s‹r v)$™þŸïÜ'C¹†ü²L–1e­9•‡*Ñ1)Qy¥¡’•Œ7‚ý‘®f:³¯5Â8ØÒbljf%ïémþ’,þ©'µ5©ã³cÁˆœ1Ųóœ_ÊõBˆ ¬ ¨±°.ûXNÅ”‰T¹Ê,;en$bíà$Qê(8ˆàÛ©Œ›Š$¡Â<;S;‹×TúŠÂ’=àŽ)ps”Ü·Äó¥\Y›á2³@yÞÆË<Ö¥G†ÈC¢v¯G¾èƒKq0-ý•†8õeV»&Fçº8¢óêýQýQ9vcŠ4º|¤EáæØÓ{/Ædüïºv·o õ>ú =ÚþÅ<358Iî/ªK=~FvûËÞ—ORÂé tòÿ‚¿¼­ù-¤è×3þ÷ÎYJaðÎmøMìŽÀ#òÎÝ«í?wmΙfõî\]~qžÂÿsj³ö›þ³ÃHÚ]¯Ù•[œ]¤UlÀãSO`Y;k’>ŽX²1,-d»\{)ºc3 D1iÛYÉbã(Q÷h¾Þ‡é"~ú9ÄôÀG4žÆ$`ò dÒðtÉ,†id|‚ ¸‰ Ü8ìAÔMh¥º‘ï6ÃZst#ô»0oEý¸Æ9Çendstream endobj 145 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 1316 >> stream xœ}“{LSwÇoÜ^ £^‘¡÷j̦ÎÇ¢.Ó¹¡b&ÙCÁU†ÆEJñ¤ky7nLß™QßF/óDe<Ï#œ}Œô©Ø2J¯à>Sk.Å#TO#ð€‰â–5/ %Ü6½ݺyKÄeA% :*ì–úGFÊyçܼÇÍÀM4ß> _µ=ˆ°3c¹¹L^5e[¼b¢Ì^L A[VlÔµš&úîž{Ž˜ÊM@—`ò³~b]QÍæùý옲>øRÖWZšAB·Óíšž¸@3à*üu¼œýŽ,«¨P‘=xÈWol=U&˯¬¶TÖ•˜–0´ë;†~›€ÔãÀ"øÕUòÝÂ>Eö¡‚‚œ!õÈ©Þáá°Ã† ì _<q…o‘#*[…bë/ðp¥xêü²~ŸÇ1º ø¦„=¯jÇ{šúù‘(IAÒÒÕ Í M@ *Tå å™ ?<¦Ãf•Ükm¥»™û[ž—%»ByJwÁü> :ýÛ¿òˤOm«¤ŠÙ% ÖqòQýL } ³gGƒz~sÞîªå7'Îʪ€Š@|¹mJŸ.³Ém–€CŒͳNWïe:nC‘ÿ ÍÂM`´õ;†Ö=ÓÀ#´p-¤þ¦Ä yL^“â1&tNü_è^ÂmùÿÈFô5y­`('G£ÊÓ8åZªü ²¬Âl²”Õapé;»îO@IXîõ’‡mü”½ÈocÚ¸Ìzšu+ JÁïàÇQ˜ç|ëjkj.Â^ë)T£l45£¨ñU#{©7ßÜÕ ˆ¡F~¬Õ;%‚¼Duà¶âƒŒÉ´€Pš‹ªm5Ç,4\¹øZÒ@²% rMi¥é(0ÕME^˜Í¯E35»ª…[××µ4´àÁ¨Ð,*J¼Ky¦« ŸÆö†cÑÑö,Áendstream endobj 146 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 2012 >> stream xœU{PSw¾1psu¨Ä+a¥÷êÖÖV|ᣲõ1«U§ºuEE Š ¢€òPIQ!ɹ„ <„  ²`@)*>Åni­Œ[f\w[ñ±»e§Ž¶ÝžØŸS÷†à¶ÎÎììÍÜò»s¾ßù¾ó}GBùŒ£$‰ÿûë7'dd‡Í›½r_Ú.Ï?S€Dý0áé_ð“‚ŸOGÈøwqüÄÛ×^¡<|žýYÙ9Ê„‰ëwíÞ´gsZú;õ+*‚ÚHm¦"©-Tµ’Š¡VQs¨ÕÔjµŽZH­§~GM¡&‰˜”•O]•,—˜ÇÍwd‘ª¤nŸ½¾~¾Ú.¡Ê̲^&‚iÂ6ÿçãþº…jTaè°{»ZòtM (ÕW“d÷cE~w¨Y@«!òwägúÃ`=³ÿ88]­à8s¥ N–ºÇ÷°`6Z‹õ ÆòBЃÉT\¬)Ú¯L&;¿îš²*¸\ÉPÀÏÿÂËFš—ð™& ’“]PÅ7rú ׎›g¡ö\å£z8ÂxµÕô»g©%‹º.õèj¸Àâ²Ñ:‰ôníážhekS6­Ú\ìèåðü‹£QÒ!›úQú·-ŸÃÝ.S–j=Øõ‚|·Släñ INÆ%žÊbåFÎ'³„˜Ø˜’}ïqªB½4 +ß( ŽUd×,>Ýç.9?æJíÞ>E–BjŒdÆê¾÷ÛoÙoöðê—pHÈ¿Ø9³À°ßÕù5òÖãçï6ˆC§–uG‰°Nl%eº ò6F)ðu\c¯%µ;ÕÏí s¡åëõëæå,BJ‘רr€‰§+A©3—X‹x %ï‘ùäƒb]‰Š‚•NјÝt”šmÃ8Iñ„Lw¨« ‚ÏÒŽFpzÔüÇ}Ϥ‰Žéðô¾ý •%çÕŒÙh×–A«åòòcwþ˜×àñõ¿X¾|òYËÁt_¥ù¯y«Ð•åÙ¶9Óí«!oÍYMÞ%ï ÿC[>Úøã5‚vQKéŸ>½òt:ðo° Ü$þaÂÖ=âUm1YƼDA†ªè¤¹E)Œ‰.tí|¤ê%“ð¦"¯+r §å^Cx %·´Ðò£|»‚¬2î‘@†t*êw…vñwê»q(ìG¯`ˆµ™ž9èQ¡ZÆÂ;mƒb$¡RØá ŒÁAòïÜ%?Ý2ilìÔ²¸îkšØt<È­ÛlÁ­¼|èCè®ê>Ï$9´í/†„ ±…ꬃ9Æ`Þ€¿ßº_¡Ï‰­jTç£Ø³{1d0°YJ¿FiüMw6V³Èn&o‰m’…KÃÈ,>²Ã:¯YÚnðÎJ«ªÀj8a²•´š„B(ÓY£ˆÞ KFþ>ñ…‚†ë £›Ž çx"µ²ò²‹–§õ›nÝ›rj6š—yÜv¹ß³®‹ý‹"MœŽÈÉg=v’%˱ûÓš‘NÀW‚1†¤CGt´ü»—„¸0–lµ(•a89ãÈ®'ÿ‘n¨ƒ“< u'±‡¶ŽLF%N¦‘iܾVlŸzn¦F=~( ¼‚3ÈTïýõ“ÝÇ›üøRˆÊçYÝWÙ#ÞO¢½ÒeXts—éËëOz„M|•R¢ÄÝô˜Ó±'JÝç1–ô ÿrFS¨S¡´¬o‚kÌÝ»¥í}—o»ÈÕæ ¦2(‹Ù\SsOQjƒR0ƒÍ$dU¯:a‰f>™«"Vul?¢æ/У½ÛwØ©wªíÚFìff/2ì]¼²ý\ WPe5)½ÁŸ¿Pa,õ1€êÛd‹q@uÅØ,®™_ àÜÿÐ zÄ»O¢~>t/ñü"ÄžKw¶zˆ›60šË¼¯ôiHÛIÙ7ñ]¯¯ŠÜ»6™;øÏ·Í p noZŽ:U—Ϙ.yÓxÏË»éÅNÌ”=ìï¼x¡RÅ‘ãÿï‘8Çaf 0£1Hrƒ¤˜ß³C²f“É-§3M¦L~¹,S05sCt³ 4óäŽÏÿ:öW:Ýqu¸ç¸Y '`È/¸ >‘ûüÆ÷)/s™Pnüü(êßó@yFendstream endobj 147 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 544 >> stream xœêýCharterBT-Italic‹‚ø|ùt‹ ‹ ø•ÖËÄtael.UBFMUÖ:†¦÷ª÷á„Ãø ¶éŸ·Ý÷;ø×Y'BkmÉUû£…o‰t‹{N¦mÄ®¿š¨Î«c~k„t‹cv¡³–ŽšŽ¿÷Ÿ÷,¶û$ ÷ø¡‚Èø²œÞø.øvwulšl’o‹(‹:\X7iSyM‹HûÀJà»»§ÃÀ‹ˆ‹‰‹ˆXžrµ¦´—¢Â©p…y‡€‹fz™«™Ž¢’¬¯÷EšÕ˜»• û%d³NWûœb_due‹Qn³Û÷3á÷÷ ‹‹ø<‚Â÷D­÷Lµ Ü÷`Ó÷÷”¨÷ ÄÊÅ‹¨¢tlLDOû„†i÷F—êË‹àÇc²LZJnVXSPj7‹7ûÄIéÍÍ©ÇɺQUSo]‹Kc¼Ü›Œ›™÷§‚¼ù¥•Ÿ®Û÷hùtû,mqä+ü~M…d‹}Y£s¼ª¸•£Äªms…z‹gx›ª™Ž¦“³ðø‹Œ‘¡’°÷ª†÷ ¥÷ à÷jqpjj¦q«¬¦¥¬¬p¦jzœøv÷L˜»² Ý ‹ ­šð[endstream endobj 148 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 2841 >> stream xœMVyT÷žf•ÒÖ45ž¤µ¾.Z—jÕŠ\A”E$ʾË"«²Ü¢ì[@$ ¶,A,*(²É"T-àr°­`û~“7xΛ@{Ú™fæÎܹ÷»÷ûîeaš‹ÅúÀÂÓWdíâg¶ÖÊÕ=Ä4ØÅGý\h¿ÿ}¡ ÇA› Úšð‘ö·ËѶ÷}÷Þ{˜úød—Ÿÿž£SAÁ!¦û]ÂDfá'ÌOºts÷°ò´>ìã«ÿ9†­Äb–Ø*ìöÌ;ŒÙ`¶Øjl ¶;ŠíÁÖbö˜¶Û‹c°}˜ fŠmÂöcß`›1sÌÓÃHl%#¦‰écç°?X"V·†ž†Æ¶[Ê.e#ÍJÍŸq+<¯!VD›Ö:-…Öd29²$dIÎR³¥K—‘˾XvUê¨Öƒ 9ŒRd,ªùså´?>K|¦òÅimb~Ó[_ü7½‹üqT>ʥŲFOqª d”õ€‡l91¹‚S‹L©b.Íž/ƨç<@¥}½ÓzÊZ§3É‘‰bá.z–1>¢´Ss¤ÙömùÖÐ4ÀÖNÀ©ÍéV» ¡¾a=šDƒ“lꪆ»¶¹Ùu쀭[Hš=bˆ4g†¯´ ®ß«B,øÚN·z(<«ŽåRbÀªwзŒØpTèjlãn ¤‘³òÑ­‚ûr¥°¶·½ö>:*·àqê·q㉭ʢ€›t'öû0…¨Ï¨v-ÐK`µãwkw|eO €~öÊÌj¯º0ÂókÝý×ê¯þ¤'¿$NY‰}Ã\ºíòSãqôγŠß[‡…ÓƒõÏá5(í/ÒÉ$E{ÊÁBbÔÙIöÚ“û˜è@ŠÊý?öÖ´Þ»y_ñ~%‘¶ÉÃ%'Þ§£%’€ÂÇ<}y›s6Øm¶YÈËmßQ¯ý@îvR>ê(许!¬íQ*î.äÔÝ –jÍ {êCTM ž5NõþÜŒ>ô> ú9Ö¹*l ™ÏéjÂù­½CÝÅ‘!ñß.³O×{ÓÚ'Ì„vÛ o`Ü¡§LÃdgeË9mÈäŸâÞF—ËN'ÒHä>Á9Åç$ñÒ½Cp,Ð܈ä´L0•LZ¨äòÎ>“ÈvÒ|jgÊ¢t¸ç‹¥Cö™4¯6²=)¸{Ù#XTûÍ …ñªâòÎdÄœâÒ#ãt!\ì#–œ =.9¤ñI¹2]š!Ín$ΧDƒ˜ÜÞç€Hôå«´¬Óëê¦aδÎõ“•é‚,ûraA饊Ì ïTŸL€„”x¡ª  ¾êa½zʦ4˜´6•h¾•ð¡WáFD” ÞOì˜'’cSb –o¯ðýIV™š–+ÈôI8Ëü”••Ÿ*=/MŽRl|ŠP·íå cM>cS§?Dlª˜ñfF+ƒiÌhïàÛxT4]”fœËŽQZŒióü Þ%ü}7DOGo•¶ßD[áL` S핱Ьʗ»– ×3Ì{I¨±W e¬¦6%f,4k>3ÚZârŠàá¤{ec–4+5[˜{_KDHŒHŽ€(>/vQø—‡(b[ñàùP9ZHª·ò×#¬îI4:ͦZZ¹qɉd`t†, R¥©Â.t3]™ü^ãÆ•´p‹%Í<&2Ê/äææ–”ÔåÕÙq=À-1E kRxœ(,fwŸÖv‰µ÷±óòµ…Cäö›ÓÕurjW³ò2¬!´µDå§š³R!ý²àœ49ICÆ\‰ù&ÛM@Zy—ÖUUU Kó*.¶\x™sQÚÇð(i¡Yhɸ( eâ« z;}x:Œ¯#ÐR:“ާeø¯Ú§iÇè0Ê–4ÉF®jøÔ°>$ Fs|2¢ò"ùe?F6@ôW66õô7 æH¤iøø³Ç¢Ã}1’¯Û¨œ7M˸ƒ ­"ø9EûìÔ,Üw\9v·°·¼Yxí~[u¨ù*-&ΉªHÙ +èyu1i¿q—‰'Yͨ¨ù5NÔük¢wþ²~€‹8Ö ø± HïäÆg'A?´*ê‡(M•ïo^±†'Ñ-¦}›Ñk®49³ •Uá?Ê}®Šò¬àkÐwµ5v´ð¤Y°óíË=Çú`\¹~³¬"_‘ßNn%|·vÞÃ0˹e´«x¸ŠÑ’;ÊŠN ï]ó°:ÃÐ%N¨£ZìJÊýCô 5Ksçg™¦GëÕãaAÿöVk»J §¹‹™2.5;¼óoð5W 8¶i…w÷‰2#àÓúô{ôFÚ^Òcø¦þzn銜¼Ür±!oœ ?¦DÜ¡†£[,žv“&öž@î:®|Ú^Ð%o~ÿ ùj×ÚÁ#Èdma=^œHÂM-Èh>_rþÌ·iì›­"“£G37š}°¹tøš[µgƒø m˜ªD„»±­» ;޵<)–f¦å ¸eχºÆìotØ›’,f°(Zœof¨+ ªp.Ãjý-×ÛÒ< 9°YnpÝ©ÙaÜï ¼„'òn%Z2=Œ¶ÚcþÃÎö-;ÊuÖçöB—¿ÂYî‘ë–°ÁûKÛ=‡ô79­†ý`VîÑ ˆjÛð¼òUÛàíGSM/ÕŠÌeÚƒ>`QÓ>›‰¼YÊ‚zà_€tÈMÎ{À O‹‘ŠÁ¬‰w…mäíU Z±zÞ‰QîW”þTÍ Úoq¨5#¬!±ÆUÄw‘U±¹!ùüÀ"ï,Oæûï\íÍmM]™ôÖ“4«ßpöÞy›RæGdcó ð÷7 Óµ.nÕJ‘¤ÄÃHäôýïXi}£@Ù,ï”#Î êŽ3çvÕ9ì4ßåo/ô²°t=¤‰‹r¬£ ëÊ aMw{í½Eڨ׉ª†O±QÈßT]Ø&J‘F_ï3à·*p\\=jÍ¡~¦$1sÜOÕ5xC M&†¿®™¸©YÆê­:Âe4±V¡þîgã]yi ÍcÅ¿ót0ìÿE‡ Éendstream endobj 149 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 3139 >> stream xœ}Wy\SW~ayyEᙊÛ{îvjݨZ§­"¢hE\¨[±¨l²…„$}§äe“]‚@$âŠZq·Uaxu)·:ZëÒNu:óú»Ìoæ%AÀö7ó’îÍÍ=ç|ç|ß9ODØX"‘hØJoo¹L>ºOpHŒÔ_iÚãøúßVØ"kä`spÌP•3Ìtz>ôò0Âô°îr(¥*Ú?.Ð;hUpˆOXx„4rÆÌY³]ߟ3wÞ‡1XCL"ÖŸëˆõÄbâ3b 1ƒXJÌ$<‰åÄûÄ Â‹XIx«ˆ¡Ä0‰p&hb8!!Þ&F£‰q‚g„ ‘@œÍ°šluÁz†õ)›¥6:[/Û+äò”¸„ò£. qrÃÎÅî’Ýsû öQö—<^¾å÷Ö#ÇŽE`pü½ˆ@Ü3ŽŸ+jäeÖ¼Æ 1(Pƒíùªô#1( ”¢x”„z«\Â(<\ö°¿’{ôÈ`ˆB2¶æ™-¸’5³leQoüÈâÅà#Á4Ytø,¨òOPZ2O]¨(”S³Ùtr¢‹F¨5ZórJÀqúKLajú숺§ dw781n»$³¼—xxxß|ö}GÇÍ›+ç0–;Ò8>‡s>f„¶;nÆô > HZä(-)&':—ÉÄä”ÌDÍüSþò„¥_~Îû•-ÊÍO0 ê0ÒU³0V\ŽÃÕ9!±Ì¶æm¥ˆÂ.ØÅžxXá±0 ȧ~d-f±’ƒi|Å­âœÿf„<Á´ Ÿi á-׿c›Ïâå! Ýs4©w2Á„Kª`õV ¬Ð*Ì&°àKî<Q`ýó@³noÏZæµÔ}ûÃ3Ìu1=üë˧¯Þ¸¼l.ó:epÎdü–Áãùú>'%õ;Ž-˜¹~ƒRÉèÅôõiEá ‘I‘}y1âsn+(°OÆÃDwïö0yAˆª¯­jb_g q78°âœ»8(áFЉ| 8K.ã`pS >¨pié²’UÅè U£3üü4?b‡–É‹¨G%}ð¶›ÑÎNÉú‚ ¨ DѺ c>ñÏ„'Iì…ô;)È— ŽœãX{EÍdWä”ÊŒ”;XW1™ˆä†âª|}1s6üª Z¸÷ÇCý¾ i€¡±ÎðžÑ„ÆÚ†÷…·%d(]‘š¦Ô04<Ú]¬cA sÄåBØr”Èâ9÷Éj¤ 6™b>š/N” Ø4¢rö¯8ŽÄ„1ìCÛ<å:¾í7¶Šƒ+œs›Ô‚¥8~¯À9J NÏß™Æ@°øáŠ[xìç“Шê}uCéÁ<íÖjËòJ´•¨Qß߾އ7*ñP–Nu¿îõòþ}QC/’Ö¶~Ñ6ºaŸ‰7`%AjGÑe;Bƒ4É£×´:Vz ´ì ñ9‚‘(‰ &ñ0˜Ö0Ñö…›Â.‹)2Qn®·vùìeOm+ûC§*á°@4<¿…gÙn'͘ëCL–7™Oǰ÷€ü“¶ê¨>|€²P|0“¿5Bx5„do|‘:) E§3;¶¦† jþÒkߟmþè¦Ê\M›¯ÑjPzž¬6¾Qúê½ w&"?ì¹3ó°C÷š»+ûå'påœèz;Xµw·[ó%BÈQHÁð*ñ¾†¾@×’±H‰R‚}ðR„¢þœ%¥4dVsvEÊ¡O`‹KzcFY ¢ÖZ¢k@ûØ^•XñZ¯î[îdù ­¸@™ŸZy+\ò3Š¤Í¨UW–ýzm1Õðû?.¡Eœó‹&$òfW˜^Cšé8X ð»¤ßAÿ‚( ÖïLÇ4KgbÇg«ó­ºÆ&¡&ä(î8sËÌR¡Ta¾„6øø}¼hù*îÉ×uùì¦uýzÀ«8ççí°¤=¡Ý¤ƒˆ¿-1ÈP"3Ñr“´ÚÞíRÝòb/áQ¼Ø%éh4ŠAÔÒÁ'TêÕ/X„[X5¿]KÖ®D¹5ŸRtŒêï Ü‹ö¡‘ôòÆ*m+ËkjÅo@t'8p¢ó÷ ìî@MħibÒ˜Ø-¾ih1ZÜ–p‚6²Z‡ƒÃ²X‚‡¾;UÐ~ûŸ'Á{âI=»&Kp)Y~ãò=EuK ?ëk8®æw¶uºNg}‡ÜèÕ>Æý«܇/âKygÉ~e㦨mŠP&½0¸n¢ÞuwŸQZ«`é DFrJ”|’•ÊK)újª¿Jæë;ê} V-|ˆ+O¾w;7n'©uÏ•í¤è‰‹¶¢6Tš¿+¯€­L3$ETÏ­[ß·$ïO©fkJ‚窪R«¥«®Ö±Ø{œd£ÿÖ ]L|¶µõÂ…­gÎß¶ýI€‡ÿT†^ž:eÉñ£G;¯e/’OÀ}ȾnkŸrá‚èÁAçüÈxÛXgô5îb7ޝD2!¨[jjfnH’}ÙÖveìeÒt {Õí¹èdá³WF=^ðÛ1ØówY¦Ç¦ V°fÚdÀδeÎ!½9Õ\:j¼MÖ¢z¤WÔÅ ¢HÑùÛÐ2ÚZ'5d ‘þ¥¡ý$‹?„Ÿ$~þ>³O¸N>mõñ,Q7p†P >œ¿Êû÷ÉÕ¸m!ž0HqDø2h}Ê¢2ô,<ž¯‘èUºÈH•*2R§Òëu:}_íãXޝ3›i놡@˜.Þ>H»‰-&\]éÔ;…D (X¢‹Ê?í@Ê|¤C»RK“*cBTLTBØÇ¯Ð1˜Ð ä-Vè­Ïmþ‡ms„@r"µÃ A›Šû/#ñdðÖ䨨-ž> $~·…‹›^^žìUmäó{"štnKy÷[°Å“mûEHhÜf…¤"ˆf*iÖØéµúü v´¾7XÌ^gÛ4}GЧù*á>Š` E\‡Àfvx@b˜‚‰;(/“ Ý*ѳ¼gsÏI㣟àÇ4‚‡%t1²óã#'ô-çÑêîÂNLb{-‹…ÑŠˆ¨Û±Î5ÔÖ6Tæä²Íû:ÐnD]?”˜³=TÊÊ”ò܈ܵ9ñ$¥èË©¦`ZÉ_N,ñ]³Þ{VòèT0›—_XŒòòŠGÒ»R‘6g}\LæÚ½œ`Ì£/ú‘zÅñcøo dýüLã["³^‘Ò‹Â)©DYšd5ŽÅ¼Kz2ÊEjJZ|˜¼É«î+½úU—¥±§A‚¥$Há™m?,ÕÌ2cÜf„ ‘P^!¼½ú¨ÛIýsb¶2à©ó¨ t{Iº3<-#”Å5âx¤h©(ÜYTÄì©ØßòQwOz®t÷\=?`Så‘8vçÎÝe¨œÚ¯ªR1tQ´"1dîãOÀ è—?€5ëÈ7 öë9˜+°ø1°ƒgš=PÁz X»>Åäœ Ÿge2Õ0õ§oîsuUvIzvVv J¡ècʪh½¾º¶é|ÐÅixŒð"äˆ7ãl°_ÖÃÐ7Áæç‡àÀºi${ùxx¬½öÓWWOwu]^»€éç$Ìà%üçÄħmþHÖ´bÞ£–çkIÎÎhÏØÙ¬“; 9Ü ž¼mMþn‚ø/íIX$endstream endobj 150 0 obj << /Type /XRef /Length 126 /Filter /FlateDecode /DecodeParms << /Columns 5 /Predictor 12 >> /W [ 1 3 1 ] /Info 3 0 R /Root 2 0 R /Size 151 /ID [] >> stream xœcb&F~0ù‰ $À8JÒ•üÏÀsûͶ ïVŒÆ½Ã_fÊa ›o(ä9Ò@$Oˆäú ñ‘Ü¥ ’s;˜ýDò-‘B¿@¤ÀÉ."EÕƒÕ|› "ÙêÁlsÉT¶¥H2òÌc endstream endobj startxref 66769 %%EOF RcppArmadillo/src/0000755000176200001440000000000015031230427013567 5ustar liggesusersRcppArmadillo/src/RcppExports.cpp0000644000176200001440000000640614520330720016571 0ustar liggesusers// Generated by using Rcpp::compileAttributes() -> do not edit by hand // Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 #include "../inst/include/RcppArmadillo.h" #include using namespace Rcpp; #ifdef RCPP_USE_GLOBAL_ROSTREAM Rcpp::Rostream& Rcpp::Rcout = Rcpp::Rcpp_cout_get(); Rcpp::Rostream& Rcpp::Rcerr = Rcpp::Rcpp_cerr_get(); #endif // armadillo_version Rcpp::IntegerVector armadillo_version(bool single); RcppExport SEXP _RcppArmadillo_armadillo_version(SEXP singleSEXP) { BEGIN_RCPP Rcpp::RObject rcpp_result_gen; Rcpp::RNGScope rcpp_rngScope_gen; Rcpp::traits::input_parameter< bool >::type single(singleSEXP); rcpp_result_gen = Rcpp::wrap(armadillo_version(single)); return rcpp_result_gen; END_RCPP } // armadillo_set_seed_random void armadillo_set_seed_random(); RcppExport SEXP _RcppArmadillo_armadillo_set_seed_random() { BEGIN_RCPP Rcpp::RNGScope rcpp_rngScope_gen; armadillo_set_seed_random(); return R_NilValue; END_RCPP } // armadillo_set_seed void armadillo_set_seed(unsigned int val); RcppExport SEXP _RcppArmadillo_armadillo_set_seed(SEXP valSEXP) { BEGIN_RCPP Rcpp::RNGScope rcpp_rngScope_gen; Rcpp::traits::input_parameter< unsigned int >::type val(valSEXP); armadillo_set_seed(val); return R_NilValue; END_RCPP } // armadillo_get_number_of_omp_threads int armadillo_get_number_of_omp_threads(); RcppExport SEXP _RcppArmadillo_armadillo_get_number_of_omp_threads() { BEGIN_RCPP Rcpp::RObject rcpp_result_gen; Rcpp::RNGScope rcpp_rngScope_gen; rcpp_result_gen = Rcpp::wrap(armadillo_get_number_of_omp_threads()); return rcpp_result_gen; END_RCPP } // armadillo_set_number_of_omp_threads void armadillo_set_number_of_omp_threads(int n); RcppExport SEXP _RcppArmadillo_armadillo_set_number_of_omp_threads(SEXP nSEXP) { BEGIN_RCPP Rcpp::RNGScope rcpp_rngScope_gen; Rcpp::traits::input_parameter< int >::type n(nSEXP); armadillo_set_number_of_omp_threads(n); return R_NilValue; END_RCPP } // fastLm_impl Rcpp::List fastLm_impl(const arma::mat& X, const arma::colvec& y); RcppExport SEXP _RcppArmadillo_fastLm_impl(SEXP XSEXP, SEXP ySEXP) { BEGIN_RCPP Rcpp::RObject rcpp_result_gen; Rcpp::RNGScope rcpp_rngScope_gen; Rcpp::traits::input_parameter< const arma::mat& >::type X(XSEXP); Rcpp::traits::input_parameter< const arma::colvec& >::type y(ySEXP); rcpp_result_gen = Rcpp::wrap(fastLm_impl(X, y)); return rcpp_result_gen; END_RCPP } static const R_CallMethodDef CallEntries[] = { {"_RcppArmadillo_armadillo_version", (DL_FUNC) &_RcppArmadillo_armadillo_version, 1}, {"_RcppArmadillo_armadillo_set_seed_random", (DL_FUNC) &_RcppArmadillo_armadillo_set_seed_random, 0}, {"_RcppArmadillo_armadillo_set_seed", (DL_FUNC) &_RcppArmadillo_armadillo_set_seed, 1}, {"_RcppArmadillo_armadillo_get_number_of_omp_threads", (DL_FUNC) &_RcppArmadillo_armadillo_get_number_of_omp_threads, 0}, {"_RcppArmadillo_armadillo_set_number_of_omp_threads", (DL_FUNC) &_RcppArmadillo_armadillo_set_number_of_omp_threads, 1}, {"_RcppArmadillo_fastLm_impl", (DL_FUNC) &_RcppArmadillo_fastLm_impl, 2}, {NULL, NULL, 0} }; RcppExport void R_init_RcppArmadillo(DllInfo *dll) { R_registerRoutines(dll, NULL, CallEntries, NULL, NULL); R_useDynamicSymbols(dll, FALSE); } RcppArmadillo/src/Makevars.win0000644000176200001440000000161514406676726016107 0ustar liggesusers## -*- mode: makefile; -*- PKG_CXXFLAGS = -I../inst/include -I. $(SHLIB_OPENMP_CXXFLAGS) PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) ## With R 3.1.0 or later, you can uncomment the following line to tell R to ## enable compilation with C++11 (where available) ## ## Also, OpenMP support in Armadillo prefers C++11 support. However, for wider ## availability of the package we do not yet enforce this here. It is however ## recommended for client packages to set it. ## ## And with R 3.4.0, and RcppArmadillo 0.7.960.*, we turn C++11 on as OpenMP ## support within Armadillo prefers / requires it ## ## R 4.0.0 made C++11 the default, R 4.1.0 switched to C++14, R 4.3.0 to C++17 ## _In general_ we should no longer need to set a standard as any recent R ## installation will do the right thing. Should you need it, uncomment it and ## set the appropriate value, possibly CXX17. RcppArmadillo/src/RcppArmadillo.cpp0000644000176200001440000001224414564441255017044 0ustar liggesusers // RcppArmadillo.cpp: Rcpp/Armadillo glue // // Copyright (C) 2010 - 2024 Dirk Eddelbuettel, Romain Francois and Douglas Bates // // This file is part of RcppArmadillo. // // RcppArmadillo is free software: you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 2 of the License, or // (at your option) any later version. // // RcppArmadillo is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with RcppArmadillo. If not, see . #include //' Report the version of Armadillo //' //' @details The version is defined by Armadillo in the header \code{arma_version.hpp}. //' @param single A logical vector indicating whether a single return values is requested, //' or a named vector with three elements \code{major}, \code{minor} and \code{patch}. //' @return Depending on the value of \code{single}, either a single number describing //' the Armadillo version or a named vector with three elements \code{major}, \code{minor} //' and \code{patch}. //' @seealso Armadillo header file \code{arma_version.hpp}. // [[Rcpp::export]] Rcpp::IntegerVector armadillo_version(bool single) { // These are declared as constexpr in Armadillo which actually does not define them // They are also defined as macros in arma_version.hpp so we just use that const unsigned int major = ARMA_VERSION_MAJOR; const unsigned int minor = ARMA_VERSION_MINOR; const unsigned int patch = ARMA_VERSION_PATCH; if (single) { return Rcpp::wrap(10000 * major + 100 * minor + patch) ; } else { return Rcpp::IntegerVector::create(Rcpp::Named("major") = major, Rcpp::Named("minor") = minor, Rcpp::Named("patch") = patch); } } // Per request of Gábor Csárdi in https://github.com/RcppCore/RcppArmadillo/issues/11 // //' Set the Armadillo Random Number Generator to a random value //' //' @details //' Depending on whether RcppArmadillo was compiled for the C++98 standard //' (currently the default) or for C++11 (optional), two different RNGs may be used. //' This function resets either. For C++98, the R programming language's RNG is used. //' For C++11, the RNG included in the \code{} library is used only when //' \code{#define ARMA_USE_CXX11_RNG} is placed before \code{#include }. //' Otherwise, the R programming language's RNG will be used. //' @return The function is invoked for its side effect and has no return value. //' @note This has been found to not work as espected in \pkg{RStudio} //' as its code also uses the system RNG library. You may have to either //' not run within \pkg{RStudio} or change your code to use a different RNG such //' as the one from R. //' @seealso The R documentation on its RNGs all of which are accessible via \pkg{Rcpp}. // [[Rcpp::export]] void armadillo_set_seed_random() { arma::arma_rng::set_seed_random(); // set the seed to a random value } //' Set the Armadillo Random Number Generator to the given value //' //' @param val The seed used to initialize Armadillo's random number generator. //' @details //' Depending on whether RcppArmadillo was compiled for the C++98 standard //' (currently the default) or for C++11 (optional), two different RNGs may be used. //' This function resets either. For C++98, the R programming language's RNG is used. //' For C++11, the RNG included in the \code{} library is used only when //' \code{#define ARMA_USE_CXX11_RNG} is placed before \code{#include }. //' Otherwise, the R programming language's RNG will be used. //' @return The function is invoked for its side effect and has no return value. //' @note This has been found to not work as espected in \pkg{RStudio} //' as its code also uses the system RNG library. You may have to either //' not run within \pkg{RStudio} or change your code to use a different RNG such //' as the one from R. //' @seealso The R documentation on its RNGs all of which are accessible via \pkg{Rcpp}. // [[Rcpp::export]] void armadillo_set_seed(unsigned int val) { //Rcpp::Rcout << "Setting value " << val << std::endl; arma::arma_rng::set_seed(val); // set the seed to given value } //' Report (or Set) Maximum Number of OpenMP Threads //' //' @param n Number of threads to be set //' @return For the getter, and on a system with OpenMP, the maximum //' number of threads that OpenMP may be using and on systems without it, //' one. The setter does not return a value. // [[Rcpp::export]] int armadillo_get_number_of_omp_threads() { #ifdef _OPENMP return omp_get_max_threads(); #else return 1; #endif } //' @rdname armadillo_get_number_of_omp_threads // [[Rcpp::export]] void armadillo_set_number_of_omp_threads(int n) { #ifdef _OPENMP omp_set_num_threads(n); #else (void)(n); // prevent unused variable warning #endif } RcppArmadillo/src/fastLm.cpp0000644000176200001440000000307514564441760015544 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- // // fastLm.cpp: Rcpp/Armadillo glue example of a simple lm() alternative // // Copyright (C) 2010 - 2024 Dirk Eddelbuettel, Romain Francois and Douglas Bates // // This file is part of RcppArmadillo. // // RcppArmadillo is free software: you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 2 of the License, or // (at your option) any later version. // // RcppArmadillo is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with RcppArmadillo. If not, see . #include // [[Rcpp::export]] Rcpp::List fastLm_impl(const arma::mat& X, const arma::colvec& y) { int n = X.n_rows, k = X.n_cols; arma::colvec coef = arma::solve(X, y); // fit model y ~ X arma::colvec res = y - X*coef; // residuals double s2 = arma::dot(res, res) / (n - k); // std.errors of coefficients arma::colvec std_err = arma::sqrt(s2 * arma::diagvec(arma::pinv(arma::trans(X)*X))); return Rcpp::List::create(Rcpp::Named("coefficients") = coef, Rcpp::Named("stderr") = std_err, Rcpp::Named("df.residual") = n - k); } RcppArmadillo/src/Makevars.in0000644000176200001440000000160114512445374015702 0ustar liggesusers## -*- mode: makefile; -*- PKG_CPPFLAGS = -I../inst/include PKG_CXXFLAGS = @OPENMP_FLAG@ PKG_LIBS= @OPENMP_FLAG@ $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) ## With R 3.1.0 or later, you can uncomment the following line to tell R to ## enable compilation with C++11 (where available) ## ## Also, OpenMP support in Armadillo prefers C++11 support. However, for wider ## availability of the package we do not yet enforce this here. It is however ## recommended for client packages to set it. ## ## And with R 3.4.0, and RcppArmadillo 0.7.960.*, we turn C++11 on as OpenMP ## support within Armadillo prefers / requires it ## ## R 4.0.0 made C++11 the default, R 4.1.0 switched to C++14, R 4.3.0 to C++17 ## _In general_ we should no longer need to set a standard as any recent R ## installation will do the right thing. Should you need it, uncomment it and ## set the appropriate value, possibly CXX17. RcppArmadillo/ChangeLog0000644000176200001440000041505515031226270014565 0ustar liggesusers2025-07-02 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 14.6.0-1 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem * inst/include/armadillo/: Armadillo 14.6.0 * inst/include/armadillo_bits/: Idem 2025-07-01 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 14.5.92-1 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem * inst/include/armadillo/: Armadillo 14.5.92 as RC2 for 14.6.0 * inst/include/armadillo_bits/: Idem 2025-06-30 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 14.5.91-1 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem * inst/include/armadillo/: Armadillo 14.5.91 as RC1 for 14.6.0 * inst/include/armadillo_bits/: Idem 2025-06-21 Dirk Eddelbuettel * man/fastLm.Rd: Update discussion of rank-deficient systems to note that newer Armadillo versions warn and fall back to approx solution 2025-05-21 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 14.4.3-1 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem * inst/include/armadillo_bits/: Sync with Armadillo 14.4.3 2025-04-25 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 14.4.2-1 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem * inst/include/armadillo_bits/: Final sync with Armadillo 14.4.2 2025-04-24 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 14.4.1-3 * inst/include/armadillo_bits/: Sync again with Armadillo 14.4.2 rc 2025-04-23 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 14.4.1-2 * inst/include/armadillo_bits/: Sync with Armadillo 14.4.2 rc 2025-04-14 Dirk Eddelbuettel * inst/tinytest/test_sparse.R: Remove a redundant duplicate require statement in unit test file 2025-03-27 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 14.4.1-1 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem 2025-03-26 Dirk Eddelbuettel * inst/include/armadillo_bits/: Sync with final Armadillo 14.4.1 2025-03-17 Dirk Eddelbuettel * DESCRIPTION (Version, Date): CRAN Release RcppArmadillo 14.4.0-1 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem 2025-03-10 Dirk Eddelbuettel * .github/workflows/ci.yaml: Switch to r-ci with implicit bootstrap 2025-02-18 Dirk Eddelbuettel * vignettes/rmd/RcppArmadillo.bib: Updated, also show CRAN DOIs * vignettes/rmd/RcppArmadillo-sparseMatrix.Rmd: Tighter spacing * vignettes/pdf/RcppArmadillo-sparseMatrix.pdf: Regenerated 2025-02-17 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 14.4.0-0 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem * inst/include/armadillo_bits/: Sync with final Armadillo 14.4.0 2025-02-15 Dirk Eddelbuettel * inst/include/armadillo_bits/: Sync again with updated sources for Armadillo 14.3.92 as an RC for 14.4.* 2025-02-13 Dirk Eddelbuettel * inst/include/armadillo_bits/: Sync again with updated sources for Armadillo 14.3.91 as a RC for 14.4.* 2025-02-11 Dirk Eddelbuettel * inst/include/armadillo_bits/: Sync again with updated sources for Armadillo 14.3.90 as a RC for 14.4.* * R/RcppArmadillo.package.skeleton.R: Generalise helper function to support additional DESCRIPTION fields * man/RcppArmadillo.package.skeleton.Rd: Document 2025-02-10 Dirk Eddelbuettel * inst/include/armadillo_bits/: Armadillo 14.3.90 as a RC for 14.4.* 2025-02-05 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 14.2.3-1 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem * inst/include/armadillo_bits/: Armadillo 14.2.3 2024-12-05 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 14.2.2-1 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem * inst/include/armadillo_bits/: Armadillo 14.2.2 2024-11-24 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 14.2.1-1 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem * inst/include/armadillo_bits/: Armadillo 14.2.1 bug fixes 2024-11-16 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 14.2.0-1 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem 2024-11-14 Dirk Eddelbuettel * inst/include/armadillo_bits/: Re-sync Armadillo 14.2.0-rc1 2024-11-07 Dirk Eddelbuettel * DESCRIPTION (Depends): Increase to Rcpp (>= 1.0.12) as it supplies the required printf format change more current R versions need * inst/include/armadillo_bits/: Re-sync Armadillo 14.2.0-rc0 2024-11-05 Dirk Eddelbuettel * inst/include/armadillo_bits/: Re-sync Armadillo 14.2.0-rc0 2024-11-03 Dirk Eddelbuettel * inst/include/armadillo_bits/: Armadillo 14.2.0-rc0 2024-09-29 Dirk Eddelbuettel * inst/include/RcppArmadillo/interface/RcppArmadilloAs.h: Add icube exporter specialisation under ARMA_64BIT_WORD case 2024-09-11 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 14.0.2-1 CRAN release 2024-08-06 Dirk Eddelbuettel * DESCRIPTION (Version): Increment micro version in branch * DESCRIPTION (Version, Date): RcppArmadillo 14.0.2 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem 2024-08-04 Dirk Eddelbuettel * DESCRIPTION (Authors@R): Added ORCID ID for Conrad 2024-08-01 Dirk Eddelbuettel * DESCRIPTION (Authors@R): Added, with ORCID IDs for Dirk, Romain, Doug 2024-08-01 Conrad Sanderson * inst/CITATION: Reverse order of items displayed 2024-07-05 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 14.0.0 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem * inst/include/RcppArmadillo/interface/RcppArmadilloForward.h: Re-enable ARMA_IGNORE_DEPRECATED_MARKER 2024-06-24 Dirk Eddelbuettel * inst/include/armadillo_bits/: Armadillo 14.0.0 2024-06-23 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 0.12.8.4.0.14.4 ie the fourth test package of the 14.0.0 development branch * inst/include/armadillo_bits/: Armadillo 14.0.0 rc1 2024-05-30 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 0.12.8.4.0 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem * inst/include/armadillo_bits/: Armadillo 12.8.4 2024-05-29 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 0.12.8.3.1 * inst/NEWS.Rd: Idem * configure.ac: Idem 2024-05-26 Dirk Eddelbuettel * inst/include/armadillo_bits/: Armadillo 12.8.4-rc1 2024-05-17 Dirk Eddelbuettel * DESCRIPTION (Imports): Updated versioned constraint on Rcpp to 1.0.8 or later as we use Light/Lighter/Lightest 2024-05-16 Dirk Eddelbuettel * README.md: Use tinyverse.netlify.app for dependency badge 2024-05-07 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 0.12.8.3.0 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem * inst/include/armadillo_bits/: Armadillo 12.8.3 2024-05-03 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Increment micro version, update date * R/inline.R (inlineCxxPlugin): No longer set C++11 for the plugin as this choice has long been obsoleted by what R does for us 2024-04-15 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 0.12.8.2.1 * inst/NEWS.Rd: Idem 2024-04-10 Tomasz Kalinowski * inst/tinytest/test_scipy2r.R: Update for reticulate v1.36; disable test checking error from scipy.sparse.bsr_matrix() 2024-04-02 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 0.12.8.2.0 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem * inst/include/armadillo_bits/: Armadillo 12.8.2 2024-03-05 Dirk Eddelbuettel * README.md: Correct a badge URL 2024-03-03 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 0.12.8.1.0 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem * inst/include/armadillo_bits/: Armadillo 12.8.1 2024-02-19 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Increment version counter 2024-02-18 Dirk Eddelbuettel * src/fastLm.cpp: Switch to RcppArmadillo/Lighter * src/RcppArmadillo.cpp: Idem * README.md: Update count to February 2024, update example, edits 2024-02-08 Dirk Eddelbuettel * .github/workflows/ci.yaml (jobs): Switch to actions/checkout@v4 and eddelbuettel/github-actions/r-ci-setup@master 2024-02-06 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 0.12.8.0.0 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem * inst/include/armadillo_bits/: Armadillo 12.8.0 2024-01-18 Dirk Eddelbuettel * inst/include/RcppArmadilloAs.h: Remove non-user facing include file, the prefered alternative in RcppArmadillo/ is available * inst/include/RcppArmadilloConfig.h: Idem * inst/include/RcppArmadilloForward.h: Idem * inst/include/RcppArmadilloSugar.h: Idem * inst/include/RcppArmadilloWrap.h: Idem 2023-12-18 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 0.12.6.7.0 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem * inst/include/armadillo_bits/: Armadillo 12.6.7 2023-12-09 Dirk Eddelbuettel * inst/tinytest/test_misc.R: Add tests for thread throttling 2023-12-03 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 0.12.6.6.1 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem 2023-12-02 Dirk Eddelbuettel * inst/include/RcppArmadillo/interface/RcppArmadilloForward.h: Update discussion of 'ARMA_IGNORE_DEPRECATED_MARKER' which is no longer set 2023-10-31 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 0.12.6.6.0 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem * inst/include/armadillo_bits/: Armadillo 12.6.6 2023-10-29 Dirk Eddelbuettel * src/RcppArmadillo.cpp (armadillo_get_number_of_omp_threads) (armadillo_set_number_of_omp_threads): New helper functions * src/RcppExports.cpp: Regenerated * R/RcppExports.R: Idem * man/armadillo_get_number_of_omp_threads.Rd: Documentation * R/init.R (.onLoad): Store initial thread count * R/init.R (armadillo_throttle_cores, armadillo_reset_cores): Tread throtte and reset helper functions * man/armadillo_throttle_cores.Rd: Documentation * man/fastLm.Rd: Illustration of use of throttle and reset function * NAMESPACE: Export new functions 2023-10-14 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 0.12.6.5.0 2023-09-06 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 0.12.6.4.0 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem * inst/include/armadillo_bits/: Armadillo 12.6.4 2023-08-28 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 0.12.6.3.0 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem * inst/include/armadillo_bits/: Armadillo 12.6.3 2023-08-08 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 0.12.6.2.0 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem * inst/include/armadillo: Armadillo 12.6.2 * inst/include/armadillo_bits/: Idem 2023-07-26 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 0.12.6.1.0 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem * inst/include/armadillo: Armadillo 12.6.1 * inst/include/armadillo_bits/: Idem 2023-07-23 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 0.12.6.0.1 * inst/NEWS.Rd: Idem * inst/include/armadillo_bits/: Upstream sync w/o move ctors 2023-07-21 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 0.12.6.0.0 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem * inst/include/armadillo: Armadillo 12.6.0 * inst/include/armadillo_bits/: Idem 2023-06-16 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 0.12.4.1.0 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem * inst/include/armadillo: Armadillo 12.4.1 * inst/include/armadillo_bits/: Idem 2023-06-04 Mikael Jagan * inst/include/RcppArmadillo/interface/RcppArmadilloAs.h: Patch for forthcoming Matrix version (see #415) 2023-05-26 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 0.12.4.0.0 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem 2023-05-25 Dirk Eddelbuettel * inst/include/armadillo: Armadillo 12.4.0 * inst/include/armadillo_bits/: Idem 2023-04-11 Dirk Eddelbuettel * README.md: Use app.codecov.io as base for codecov link 2023-04-04 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 0.12.2.0.0 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem * inst/include/armadillo: Armadillo 12.2.0 * inst/include/armadillo_bits/: Idem 2023-02-20 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 0.12.0.0.0 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem * inst/include/armadillo: Armadillo 12.0.0 * inst/include/armadillo_bits/: Idem 2023-02-11 Kevin Ushey * src/Makevars.in: Use PKG_CPPFLAGS for RcppArmadillo includes 2023-02-09 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 0.11.4.4.0 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem * inst/include/armadillo: Armadillo 11.4.4 * inst/include/armadillo_bits/: Idem 2023-02-05 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version and date * src/Makevars.in: No longer set a compilation standard * src/Makevars.win: Idem * inst/skeleton/Makevars: Idem * inst/skeleton/Makevars.win: Idem * inst/CITATION: Convert to bibentry() style with person() 2023-01-20 Dirk Eddelbuettel * README.md: Update package count 2023-01-15 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 0.11.4.3.1 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem * inst/include/RcppArmadillo/interface/RcppArmadilloForward.h: Still use '#define ARMA_IGNORE_DEPRECATED_MARKER' unless override set to suppress warnings, see issues #391 (initialization) and #402 (stderr) 2022-12-28 Dirk Eddelbuettel * DESCRIPTION (Version): RcppArmadillo 0.11.4.3.0 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem * inst/include/armadillo_bits/: Armadillo 11.4.3 2022-11-15 Dirk Eddelbuettel * inst/include/RcppArmadillo/config/RcppArmadilloConfig.h: Protect undefine of NDEBUG behind additional opt-in define 2022-11-08 Dirk Eddelbuettel * DESCRIPTION (Version): RcppArmadillo 0.11.4.2.1 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem 2022-10-22 Dirk Eddelbuettel * .github/workflows/ci.yaml (jobs): Update to actions/checkout@v3 2022-10-21 Dirk Eddelbuettel * DESCRIPTION (Version): RcppArmadillo 0.11.4.2.0 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem * inst/include/armadillo_bits/: Armadillo 11.4.2 2022-10-20 Dirk Eddelbuettel * DESCRIPTION (Version): Roll minor version * inst/include/RcppArmadillo.h: Use new paths * inst/include/RcppArmadillo.h: Idem * inst/include/RcppArmadillo/LightL Idem * inst/include/RcppArmadillo/Lighter: Idem * inst/include/RcppArmadillo/Lightest: Idem * inst/include/RcppArmadillo/interface/RcppArmadilloAs.h: New location, and updated accordingly * inst/include/RcppArmadillo/interface/RcppArmadilloForward.h: Idem * inst/include/RcppArmadillo/interface/RcppArmadilloSugar.h: Idem * inst/include/RcppArmadillo/interface/RcppArmadilloWrap.h: Idem * inst/include/RcppArmadilloAs.h: New stub * inst/include/RcppArmadilloForward.h: Idem * inst/include/RcppArmadilloSugar.h: Idem * inst/include/RcppArmadilloWrap.h: Idem 2022-10-19 Dirk Eddelbuettel * DESCRIPTION (Version): Roll minor version * inst/include/RcppArmadillo/rng/Alt_R_RNG.h: New location * inst/include/RcppArmadillo/config/RcppArmadilloConfigGenerated.h.in: Idem * inst/include/RcppArmadillo/config/RcppArmadilloConfig.h: Idem * inst/include/RcppArmadilloForward.h: Updated accordingly * inst/include/RcppArmadilloConfig.h: Idem * configure.ac: Idem * configure: Idem * cleanupp: Idem * inst/tinytest/test_sparseConversion.R: Update one conversion as suggested by the Matrix team 2022-10-14 Dirk Eddelbuettel * DESCRIPTION (Version): Roll minor version * inst/include/RcppArmadillo/RcppArmadillo: Header accessing Rcpp/Rcpp, and not imposing column-as-matrix return * inst/include/RcppArmadillo/Light: Header accessing Rcpp/Light, idem * inst/include/RcppArmadillo/Lighter: Header accessing Rcpp/Lighter, idem * inst/include/RcppArmadillo/Lightest: Header accessing Rcpp/Lightest, idem * inst/include/RcppArmadillo/internal/: Regroup internal headers here * inst/include/RcppArmadillo_bits/: Move to new internal location * configure.ac: Support new location of generated config * configure: Idem * cleanup: Idem 2022-10-10 Dirk Eddelbuettel * DESCRIPTION (Version): RcppArmadillo 0.11.4.1.0 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem 2022-10-01 Dirk Eddelbuettel * DESCRIPTION (Version): RcppArmadillo 0.11.4.0.1 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem * README.md: Update some http URLs to https * man/RcppArmadillo-package.Rd: Idem * man/fastLm.Rd: Idem * inst/include/armadillo_bits/: Hot-fix by Conrad to accomodate a possibly over-eager warning from g++-12 affected a few CRAN packages 2022-09-22 Dirk Eddelbuettel * DESCRIPTION (Version): RcppArmadillo 0.11.4.0.0 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem * inst/include/armadillo: Armadillo 11.4.0 * inst/include/armadillo_bits/: Idem 2022-09-19 Dirk Eddelbuettel * inst/include/armadillo: Armadillo 11.4.rc1 * inst/include/armadillo_bits/: Idem 2022-09-09 Dirk Eddelbuettel * DESCRIPTION (Version): RcppArmadillo 0.11.2.4.0 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem * inst/include/armadillo: Armadillo 11.2.4 * inst/include/armadillo_bits/: Idem 2022-09-01 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 0.11.2.3.1.1 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem * README.md: Edited fastLm() example for more compact display * src/fastLm.cpp: Idem * inst/include/RcppArmadilloForward.h: Permit opt-out of deprecation suppresion (useful to develop under full deprecation warnings) 2022-08-31 Dirk Eddelbuettel * inst/include/armadillo_bits/compiler_setup.hpp: Use version from merge request #119 with optional use of ARMA_IGNORE_DEPRECATED_MARKER 2022-08-18 Dirk Eddelbuettel * src/fastLm.cpp: Using dot() as proposed by Conrad in #388 * README.md: Idem 2022-08-16 Dirk Eddelbuettel * DESCRIPTION (Version): RcppArmadillo 0.11.2.3.1 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem * inst/include/armadillo_bits/compiler_setup.hpp: Do not define arma_deprecated as it bites a number of CRAN packages 2022-08-15 Dirk Eddelbuettel * inst/tinytest/test_sparseConversion.R: Further refinements, tests are now conditional on Matrix 1.4-2 * inst/tinytest/test_sparse.R: Idem 2022-08-12 Dirk Eddelbuettel * inst/tinytest/test_scipy2r.R: Update sparse matrix conversions to accomodate deprecation in Matrix 1.4-2 * inst/tinytest/test_sparseConversion.R: Idem * inst/tinytest/test_sparse.R: Idem 2022-07-12 Dirk Eddelbuettel * DESCRIPTION (Version): RcppArmadillo 0.11.2.3.0 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem * inst/include/armadillo: Armadillo 11.2.3 * inst/include/armadillo_bits/: Idem 2022-07-04 Dirk Eddelbuettel * DESCRIPTION (Version): RcppArmadillo 0.11.2.2.0 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem * inst/include/armadillo: Armadillo 11.2.2 * inst/include/armadillo_bits/: Idem 2022-06-28 Dirk Eddelbuettel * DESCRIPTION (Version): RcppArmadillo 0.11.2.1.0 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem * inst/include/armadillo: Armadillo 11.2.1 * inst/include/armadillo_bits/: Idem 2022-06-10 Dirk Eddelbuettel * DESCRIPTION (Version): RcppArmadillo 0.11.2.0.0 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem * inst/include/armadillo: Armadillo 11.2.0 * inst/include/armadillo_bits/: Idem 2022-06-09 Dirk Eddelbuettel * DESCRIPTION (Version): RcppArmadillo 0.11.1.99.0 * inst/include/armadillo: Armadillo 11.2-rc1 * inst/include/armadillo_bits/: Idem 2022-05-15 Dirk Eddelbuettel * DESCRIPTION (Version): RcppArmadillo 0.11.1.1.0 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem 2022-05-14 Dirk Eddelbuettel * inst/include/armadillo_bits/: Armadillo 11.1.1 2022-05-13 Dirk Eddelbuettel * DESCRIPTION (Version): RcppArmadillo 0.11.1.0.0 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem * inst/include/armadillo: Armadillo 11.1.0 * inst/include/armadillo_bits/: Idem 2022-05-11 Dirk Eddelbuettel * configure.ac: Ensure OpenMP is propagated in the 'found' case 2022-05-10 Dirk Eddelbuettel * DESCRIPTION (Version): RcppArmadillo 0.11.0.99.1.0 * inst/include/armadillo: Armadillo 11.1-rc1 * inst/include/armadillo_bits/: Idem 2022-04-14 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 0.11.0.1.0 * inst/include/armadillo_bits/: Armadillo 11.0.1 2022-04-04 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 0.11.0.0.0 * inst/include/armadillo: Armadillo 11.0.0 * inst/include/armadillo_bits/: Idem * inst/tinytest/test_scipy2r.R: Skip on Windows 2022-03-31 Dirk Eddelbuettel * DESCRIPTION (Version): RcppArmadillo 0.10.99.3.0 * inst/include/armadillo: Armadillo 11.0-rc3 * inst/include/armadillo_bits/: Idem 2022-03-24 Dirk Eddelbuettel * DESCRIPTION (Version): RcppArmadillo 0.10.99.1.0 * inst/include/armadillo: Armadillo 11.0-rc2 * inst/include/armadillo_bits/: Idem 2022-03-22 Dirk Eddelbuettel * inst/tinytest/test_Rlapack.R: If a non-suitable LAPACK installation is seen (as currently on Ubuntu under 3.9.0) skip the file 2022-03-20 Dirk Eddelbuettel * DESCRIPTION (Version): RcppArmadillo 0.10.99.0 * inst/include/armadillo: Armadillo 11.0-rc1 * inst/include/armadillo_bits/: Idem * inst/tinytest/test_Rlapack.R: Skipping while investigating 2022-02-23 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/RcppArmadilloWrap.h (wrap): Deprecation transition: until May 1, only correct Fields if RCPP_ARMADILLO_FIX_Field defined * inst/tinytest/cpp/armadillo.cpp (has_old_field_behavior): Adjust * inst/tinytest/cpp/fields.cpp (has_old_field_behavior): Idem * inst/tinytest/test_fields.R: Idem * tests/tinytest.R: Simplified reflecting long-updated tinytest 2022-02-14 Dirk Eddelbuettel * inst/include/RcppArmadilloWrap.h (wrap): Unless RCPP_ARMADILLO_OLD_Field_BEHAVIOR is defines use correction 2022-02-01 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 0.10.8.2.0 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem * inst/include/armadillo_bits/: Armadillo 10.8.2 2022-01-23 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 0.10.8.1.0 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem * inst/include/armadillo_bits/: Armadillo 10.8.1 2022-01-02 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 0.10.8.0 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem * inst/include/armadillo_bits/: Armadillo 10.8 2021-12-27 Dirk Eddelbuettel * DESCRIPTION (Version): RcppArmadillo 0.10.7.99.1 * inst/include/armadillo: Armadillo 10.8-rc2 * inst/include/armadillo_bits/: Idem 2021-12-21 Dirk Eddelbuettel * DESCRIPTION (Version): RcppArmadillo 0.10.7.99.0 * inst/include/armadillo: Armadillo 10.8-rc1 * inst/include/armadillo_bits/: Idem 2021-12-16 Dirk Eddelbuettel * inst/include/armadillo_bits/: Armadillo 10.7.5 2021-11-23 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 0.10.7.4.0 * inst/NEWS.Rd: Idem * inst/include/armadillo_bits/: Armadillo 10.7.4 2021-11-18 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 0.10.7.3.1 * inst/include/RcppArmadilloConfig.h: Simplify to using just one new #define for the two changes to Fields import/export * inst/include/RcppArmadilloAs.h (get): Updated * inst/include/RcppArmadilloWrap.h (wrap): Idem * inst/tinytest/cpp/fields_new.cpp: Idem 2021-11-16 Dirk Eddelbuettel * inst/tinytest/cpp/fields.cpp: Added tests for R -> C++ * inst/tinytest/cpp/fields_new.cpp: Idem * inst/tinytest/test_fields.R: Idem * inst/tinytest/test_fields_new.R: Idem 2021-11-15 Dirk Eddelbuettel * inst/tinytest/cpp/fields.cpp: Additional test using 3d field working in 'new' but not in 'old' setup * inst/tinytest/cpp/fields_new.cpp: Idem * inst/tinytest/test_fields.R: Idem * inst/tinytest/test_fields_new.R: Idem * inst/tinytest/cpp/fields.cpp: Initial tests for R -> C++ * inst/tinytest/test_fields.R: Idem 2021-11-13 Dirk Eddelbuettel * inst/tinytest/cpp/fields_new.cpp: Test for 'new' (i.e. corrected) fields behaviour currently requiring #define (for C++ to R) * inst/tinytest/test_fields_new.R: Idem 2021-11-12 Dirk Eddelbuettel * inst/tinytest/test_fields.R: Added 1-d field tests (for C++ to R) * inst/tinytest/cpp/fields.cpp: Idem 2021-11-09 Dirk Eddelbuettel * inst/tinytest/test_fields.R: Added field tests (for C++ to R) * inst/tinytest/cpp/fields.cpp: Idem 2021-11-09 Jonathan Berrisch * inst/include/RcppArmadilloAs.h: Update arma::field conversion * inst/include/RcppArmadilloWrap.h: Idem * inst/include/RcppArmadilloConfig.h: Define guards for changes * inst/tinytest/test_rcpparmadillo.R: New tests 2021-11-08 Dirk Eddelbuettel * local/armafield.cpp: Add an arma::field test file 2021-11-04 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 0.10.7.3.0 * inst/NEWS.Rd: Idem * inst/include/armadillo_bits/: Armadillo 10.7.3 2021-11-03 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 0.10.7.2.0 * inst/NEWS.Rd: Idem 2021-11-02 Dirk Eddelbuettel * inst/include/armadillo_bits/: Armadillo 10.7.2 2021-10-08 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 0.10.7.1 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem * inst/include/armadillo_bits/: Armadillo 10.7.1 2021-09-29 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 0.10.7.0.0 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem * inst/include/armadillo_bits/arma_version.hpp: Armadillo 10.7.0 2021-09-29 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 0.10.6.99.3 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem * inst/include/armadillo_bits/: Armadillo 10.7-RC2 2021-09-27 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 0.10.6.99.2 * DESCRIPTION (Author): Add Conrad * README.md (Rcpp): Idem * inst/include/RcppArmadilloAs.h: Update copyright header, remove two editor settings lines as we long switched to editorconfig * inst/include/RcppArmadilloConfigGenerated.h.in: Idem * inst/include/RcppArmadilloConfig.h: Idem * inst/include/RcppArmadilloForward.h: Idem * inst/include/RcppArmadillo.h: Idem * inst/include/RcppArmadilloSugar.h: Idem * inst/include/RcppArmadilloWrap.h: Idem 2021-09-27 Condrad Sanderson * inst/include/RcppArmadilloForward.h: Adjust for Armadillo 10.7 and subview_cols * inst/include/RcppArmadilloWrap.h: Idem 2021-09-26 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 0.10.6.99.1 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem * inst/include/armadillo_bits/: Armadillo 10.7-RC1 * README.md: Added total downloads badge 2021-08-05 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 0.10.6.2.0 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem * inst/include/armadillo_bits/: Armadillo 10.6.2 2021-07-19 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 0.10.6.1.0 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem * inst/include/armadillo_bits/: Armadillo 10.6.1 2021-07-16 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 0.10.6.0.0 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem * man/RcppArmadillo-package.Rd: Use https URL * inst/include/armadillo_bits/: Armadillo 10.6.0 2021-07-07 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 0.10.5.99.0 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem * inst/include/armadillo_bits/: Armadillo 10.6-rc1 2021-07-01 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 0.10.5.3.0 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem * inst/include/armadillo_bits/: Armadillo 10.5.3 2021-06-12 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 0.10.5.2.0 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem * inst/include/armadillo_bits/: Armadillo 10.5.2 2021-06-05 Dirk Eddelbuettel * README.md: Add coverage badge 2021-06-04 Dirk Eddelbuettel * inst/tinytest/test_misc.R: Add tests for several miscellaneous functions in src/RcppArmadillo.cpp, R/flags.R * inst/tinytest/test_fastLm.R: Additional fastLm() tests * R/SciPy2R.R: Set nocov tags for deprecated code * R/RcppArmadillo.package.skeleton.R: Set nocov * .codecov.yml (comment): Set to false 2021-05-29 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 0.10.5.1.0 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem * inst/include/armadillo_bits/: Armadillo 10.5.1 2021-05-21 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 0.10.5.0.0 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem * inst/include/armadillo_bits/: Armadillo 10.5.0 2021-05-15 Dirk Eddelbuettel * DESCRIPTION: Release 0.10.499.1.0 [github-only] * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem * inst/include/armadillo_bits/: Armadillo 10.5 RC1 * .codecov.yml (ignore): Exclude Armadillo itself 2021-04-23 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 0.10.4.1.0 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem * inst/include/armadillo_bits/: Armadillo 10.4.1 2021-04-13 Dirk Eddelbuettel * DESCRIPTION (URL): Added to DESCRIPTION file 2021-04-12 Dirk Eddelbuettel * inst/include/armadillo_bits/arma_rng.hpp: Apply two upstream corrections for RNG draws discovered during reverse depends checks 2021-04-11 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 0.10.4.0.0 * inst/NEWS.Rd: Idem * configure.ac: Idem * configure: Idem * inst/include/armadillo{,_bits}/: Armadillo 10.4.0 2021-03-10 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 0.10.3.0.0 * configure.ac: Idem * configure: Idem * inst/include/armadillo{,_bits}/: Armadillo 10.3 2021-03-09 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 0.10.2.2.0 * configure.ac: Idem * configure: Idem 2021-03-08 Dirk Eddelbuettel * inst/tinytest/test_cube.R: On Windows, lower tolerance for two tests to accomodate tests on gcc10-UCRT 2021-02-26 Dirk Eddelbuettel * inst/include/armadillo_bits/: Armadillo 10.2.2 2021-02-09 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 0.10.2.1.0 * configure.ac: Idem * configure: Idem 2021-02-03 Dirk Eddelbuettel * inst/include/armadillo_bits/: Armadillo 10.2.1 2021-01-26 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 0.10.2.0.0 * configure.ac: Idem * configure: Idem 2021-01-25 Dirk Eddelbuettel * inst/include/armadillo{,_bits/}: Armadillo 10.2.0 2021-01-08 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 0.10.1.2.2 * configure.ac: Idem * configure: Idem 2021-01-05 Dirk Eddelbuettel * inst/tinytest/test_sparseConversion.R: Set doDiag=FALSE to ensure dgCMatrix return (accomodates Matrix >= 1.3.0, also conditioned on) 2021-01-05 Condrad Sanderson * inst/include/armadillo_bits/arma_cmath.hpp: fix handling of NaN by arma::sign() 2021-01-01 Dirk Eddelbuettel * .github/workflows/ci.yaml: Add CI runner using r-ci * README.md: Add new badge * inst/tinytest/test_sparseConversion.R: Condition updated test on Matrix package version 1.3.0 or greater * R/RcppArmadillo.package.skeleton.R: Wrap any() around grepl() 2020-12-31 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 0.10.1.2.1 * configure.ac: Idem * configure: Idem * inst/tinytest/test_sparseConversion.R: Update one call to rsparsematrix to suppress another warning from Matrix 1.3.0 * DESCRIPTION (Suggests): Change to versioned 'Suggests: Matrix (>= 1.3.0)', (Description): Minor rewording 2020-12-30 Binxiang Ni * inst/tinytest/test_sparseConversion.R: Coerce dtCMatrix to dgCMatrix in one unit test (required by Matrix 1.3.0) 2020-11-15 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 0.10.1.2.0 * configure.ac: Idem * configure: Idem * inst/tinytest/test_sparseConversion.R: Skipping parts on Windows 2020-11-14 Dirk Eddelbuettel * inst/include/armadillo_bits/: Armadillo 10.1.2 2020-10-26 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * src/RcppArmadillo.cpp: Rewrite version number accessors to be more rebust of upstream and compiler settings * .editorconfig: Added for standardized editor behaviour * .Rbuildignore: Exclude .editorconfig 2020-10-24 Condrad Sanderson * inst/include/RcppArmadilloForward.h: Switch to quoted #include 2020-10-21 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * src/RcppArmadillo.cpp: Remove three redundant const int * configure.ac: No longer use m4 to get version number * configure: Regenerated 2020-10-09 Dirk Eddelbuettel * DESCRIPTION: Release 0.10.1.0.0 * inst/NEWS.Rd: Release 0.10.1.0.0 * configure: Regenerated for 0.10.1.0.0 * inst/include/armadillo: Armadillo 10.1.0 * inst/include/armadillo_bits: Armadillo 10.1.0 2020-10-08 Dirk Eddelbuettel * inst/include/armadillo/: Armadillo 10.1-rc2 * inst/include/armadillo_bits/: Idem * .travis.yml: Switch to focal and BSPM use 2020-10-01 Dirk Eddelbuettel * inst/include/armadillo/: Armadillo 10.1-rc1 * inst/include/armadillo_bits/: Idem * inst/include/RcppArmadillo/Mat_meat.h: Two added lines to set n_alloc(0) as emailed by Conrad 2020-09-02 Dirk Eddelbuettel * DESCRIPTION: Release 0.9.900.3.0 * inst/NEWS.Rd: Release 0.9.900.3.0 * configure: Regenerated for 0.9.900.3.0 * inst/include/armadillo_bits/*: Armadillo 9.900.3 2020-07-17 Dirk Eddelbuettel * DESCRIPTION: Release 0.9.900.2.0 * inst/NEWS.Rd: Release 0.9.900.2.0 2020-07-15 Dirk Eddelbuettel * inst/include/armadillo_bits/*: Armadillo 9.900.2 * configure.ac: One small improvement for AC_INIT 2020-06-08 Dirk Eddelbuettel * DESCRIPTION: Release 0.9.900.1.0 * inst/NEWS.Rd: Release 0.9.900.1.0 * inst/include/armadillo_bits: Armadillo 9.900.1 * R/RcppArmadillo.package.skeleton.R: Accomodate a R 4.0.0 change about NAMESPACE exports from package.skeleton() 2020-06-05 Dirk Eddelbuettel * DESCRIPTION: Release 0.9.899.1.0 [github-only] * inst/NEWS.Rd: Release 0.9.899.1.0 * inst/include/armadillo/: Armadillo 9.900-rc1 * inst/include/armadillo_bits/: Idem 2020-05-17 Dirk Eddelbuettel * README.md: Add 'indirect use' and 'csda' badges 2020-05-16 Dirk Eddelbuettel * .travis.yml (dist): Updated to bionic and R 4.0.0 via matrix 2020-05-15 Dirk Eddelbuettel * DESCRIPTION: Release 0.9.880.1.0 * inst/NEWS.Rd: Release 0.9.880.1.0 * inst/include/armadillo: Armadillo 9.880.1 * inst/include/armadillo_bits: Armadillo 9.880.1 2020-05-06 Dirk Eddelbuettel * configure.ac: Rebasing and rewording 2020-05-05 Kevin Ushey * configure.ac: Improve temporary directory determination and use 2020-05-05 Dirk Eddelbuettel * configure.ac: Tweaks to wording, whitespace and cleanup 2020-05-04 Kevin Ushey * configure.ac: Add explicit check for functioning OpenMP 2020-04-24 Dirk Eddelbuettel * DESCRIPTION: Release 0.9.870.2.0 * inst/NEWS.Rd: Release 0.9.870.2.0 * inst/include/armadillo_bits: Armadillo 9.870.2 2020-04-23 Dirk Eddelbuettel * DESCRIPTION: Release 0.9.869.2.0 [github-only] * inst/NEWS.Rd: Release 0.9.869.2.0 * inst/include/armadillo_bits/: Armadillo 9.870-rc2 2020-04-22 Dirk Eddelbuettel * DESCRIPTION: Release 0.9.869.1.0 [github-only] * inst/NEWS.Rd: Release 0.9.869.1.0 * inst/include/armadillo: Armadillo 9.870-rc1 * inst/include/armadillo_bits/*: Idem 2020-04-13 Dirk Eddelbuettel * DESCRIPTION: Release 0.9.860.2.0 * inst/NEWS.Rd: Release 0.9.860.2.0 * inst/include/armadillo_bits: Armadillo 9.860.2 2020-04-10 Dirk Eddelbuettel * inst/tinytest/test_scipy2r.R: Skip test on 32-bit Windows * inst/tinytest/test_complex.R: Ditto 2020-03-30 Dirk Eddelbuettel * DESCRIPTION: Release 0.9.860.1.0 * inst/NEWS.Rd: Release 0.9.860.1.0 * inst/include/armadillo: Armadillo 9.860.1 * inst/include/armadillo_bits/*: Idem 2020-03-28 Dirk Eddelbuettel * README.md: Updated 2020-03-26 Dirk Eddelbuettel * DESCRIPTION: Release 0.9.859.1.0 [github-only] * inst/NEWS.Rd: Release 0.9.859.1.0 * inst/include/armadillo: Armadillo 9.860-rc1 * inst/include/armadillo_bits/*: Idem * .travis.yml: No longer need r-cran-pinp 2020-02-17 Dirk Eddelbuettel * configure.ac: Provide a negative message for the macOS test * configure: Idem 2020-02-14 Dirk Eddelbuettel * README.md: Add a Debian badge 2020-02-10 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * vignettes/RcppArmadillo-intro.Rnw: Wraps pre-made vignette * vignettes/RcppArmadillo-sparseMatrix.Rmd: Idem * vignettes/rmd/Makefile: Added * DESCRIPTION (Suggests): Remove Suggests for rmarkdown, knitr, pinp; (VignetteBuilder): Removed 2020-02-09 Dirk Eddelbuettel * DESCRIPTION: Release 0.9.850.1.0 * inst/NEWS.Rd: Release 0.9.850.1.0 * inst/include/armadillo: Armadillo 9.850.1 * inst/include/armadillo_bits/*: Idem 2020-02-05 Dirk Eddelbuettel * DESCRIPTION: Release 0.9.849.1.0 [github-only] * inst/NEWS.Rd: Release 0.9.849.1.0 * inst/include/armadillo: Armadillo 9.850.rc1 * inst/include/armadillo_bits/*: Idem 2020-01-26 Dirk Eddelbuettel * inst/tinytest/test_scipy2r.R: Condition on reticulate (>= 1.14) which no longer needs extra helper to convert from scipy * R/SciPy2R.R (.SciPy2R): Added .Deprecated() call 2020-01-24 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Release 0.9.800.4.0 * inst/NEWS.Rd: Release 0.9.800.4.0 * inst/tinytest/test_scipy2r.R: Skip this test for now 2020-01-23 Dirk Eddelbuettel * inst/include/armadillo_bits/: Armadillo 9.800.4 2019-12-04 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Release 0.9.800.3.0 * inst/NEWS.Rd: Release 0.9.800.3.0 * inst/include/armadillo_bits/*: Armadillo 9.800.3 2019-11-14 Dirk Eddelbuettel * inst/include/RcppArmadilloExtensions/sample.h: Const correctness 2019-10-13 Dirk Eddelbuettel * README.md: Added CRAN + BioConductor badges for reverse depends * R/RcppArmadillo.package.skeleton.R: remove force argument if unused 2019-10-09 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Release 0.9.800.1.0 * inst/NEWS.Rd: Release 0.9.800.1.0 * inst/include/armadillo_bits/*: Armadillo 9.800.1 2019-10-04 Dirk Eddelbuettel * DESCRIPTION (Version): Upstream change of heart, 0.9.799.1.0 it is * inst/NEWS.Rd: Ditto 2019-10-02 Dirk Eddelbuettel * DESCRIPTION (Version, Date): 0.10.99.1.0 [github-only] * inst/include/armadillo*: Armadillo 10.100-rc1 2019-09-30 Min Kim * configure.ac: Portability fixes 2019-09-29 Dirk Eddelbuettel * README.md: Add Stackoverflow badge, add use count 2019-09-14 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * DESCRIPTION: Replaced Suggests: of RUnit with tinytest * inst/tinytest/*: Added * tests/tinytest.R: Added converted RUnit tests * tests/doRUnit.R: Removed * inst/unitTests/*: Removed, converted into tinytest files * R/unit.test.R: Removed helper script * .travis.yml: Replace RUnit with tinytest * inst/include/RcppArmadilloSugar.h: Switch one int to size_t and add one cast in order to quieten two compiler warnings 2019-09-01 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Release 0.9.700.2.0 * inst/NEWS.Rd: Release 0.9.700.2.0 * inst/include/armadillo_bits/*: Armadillo 9.700.2 2019-08-28 Dirk Eddelbuettel * configure.ac: Expand list of known gcc and clang versions 2019-08-27 Dirk Eddelbuettel * DESCRIPTION: Release 0.9.699.1.0 [github-only] * inst/NEWS.Rd: Release 0.9.699.1.0 * inst/include/armadillo: Armadillo 9.700-RC1 * inst/include/armadillo_bits/*: Idem 2019-07-14 Dirk Eddelbuettel * DESCRIPTION: Release 0.9.600.4.0 * inst/NEWS.Rd: Release 0.9.600.4.0 * inst/include/armadillo_bits/*: Armadillo 9.600.4 2019-07-13 irk Eddelbuettel * DESCRIPTION: Release 0.9.599.4.0 [github-only] * inst/NEWS.Rd: Release 0.9.599.4.0 * inst/include/armadillo: Armadillo 9.600-RC4 * inst/include/armadillo_bits/*: Idem 2019-07-10 Dirk Eddelbuettel * DESCRIPTION: Release 0.9.599.3.0 [github-only] * inst/NEWS.Rd: Release 0.9.599.3.0 * inst/include/armadillo: Armadillo 9.600-RC3 * inst/include/armadillo_bits/*: Idem 2019-07-03 Dirk Eddelbuettel * inst/examples/fastLm.r (fastLmPureDotCall): Update example 2019-07-02 Dirk Eddelbuettel * DESCRIPTION: Release 0.9.599.2.0 [github-only] * inst/NEWS.Rd: Release 0.9.599.2.0 * inst/include/armadillo: Armadillo 9.600-RC2 * inst/include/armadillo_bits/*: Idem 2019-06-11 Dirk Eddelbuettel * DESCRIPTION: Release 0.9.500.2.0 * inst/NEWS.Rd: Release 0.9.500.2.0 * inst/include/armadillo: Armadillo 9.500.2 * inst/include/armadillo_bits/*: Idem 2019-06-06 Dirk Eddelbuettel * DESCRIPTION: Release 0.9.499.1.0 [github-only] * inst/NEWS.Rd: Release 0.9.499.1.0 * inst/include/armadillo: Armadillo 9.500-RC1 * inst/include/armadillo_bits/*: Idem 2019-05-09 Dirk Eddelbuettel * DESCRIPTION: Release 0.9.400.3.0 * inst/NEWS.Rd: Release 0.9.400.3.0 2019-05-03 Dirk Eddelbuettel * inst/include/armadillo_bits/*: Armadillo 9.400.3 2019-04-28 Dirk Eddelbuettel * DESCRIPTION: Release 0.9.400.2.0 * inst/NEWS.Rd: Release 0.9.400.2.0 2019-04-27 Dirk Eddelbuettel * DESCRIPTION: Release 0.9.399.2.0 [github-only] * inst/NEWS.Rd: Release 0.9.399.2.0 * inst/include/armadillo_bits/*: Armadillo 9.400.2 2019-04-21 Dirk Eddelbuettel * DESCRIPTION: Release 0.9.399.1.0 [github-only] * inst/NEWS.Rd: Release 0.9.399.1.0 * inst/include/armadillo_bits/*: Armadillo 9.400-RC1 2019-03-21 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Release 0.9.300.2.0 * inst/NEWS.Rd: Release 0.9.300.2.0 * inst/include/armadillo_bits/*: Armadillo 9.300.2 2019-03-16 Dirk Eddelbuettel * DESCRIPTION: Release 0.9.299.0.0 [github-only] * inst/NEWS.Rd: Release 0.9.199.0.0 * inst/include/armadillo_bits/*: Armadillo 9.300-RC1 2019-03-08 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Release 0.9.200.7.1 * inst/NEWS.Rd: Release 0.9.200.7.1 2019-03-07 Dirk Eddelbuettel * DESCRIPTION (Version, Date): New minor version * inst/unitTests/runit.sample.R (csample): Set the sample() behaviour to R 3.5.0 as R 3.6.0 has a breaking change (for the better) * inst/include/armadillo_bits/op_wishrnd_meat.hpp (apply_noalias_mode2): Backport a fix from Armadillo upstream 2019-01-17 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Release 0.9.200.7.0 * inst/NEWS.Rd: Release 0.9.200.7.0 * inst/include/armadillo_bits/def_hdf5.hpp: CRLF -> CR * inst/include/armadillo_bits/fn_spsolve.hpp: Idem 2019-01-15 Dirk Eddelbuettel * inst/include/armadillo_bits/*: Armadillo 9.200.7 2018-11-27 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Release 0.9.200.5.0 * inst/NEWS.Rd: Release 0.9.200.5.0 * inst/include/armadillo_bits/*: Armadillo 9.200.5 2018-11-09 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Release 0.9.200.4.0 * inst/NEWS.Rd: Release 0.9.200.4.0 * vignettes/Rcpp-unitTests.Rnw: Removed as less useful now 2018-11-08 Dirk Eddelbuettel * inst/include/armadillo_bits/*: Armadillo 9.200.4 2018-10-27 Dirk Eddelbuettel * DESCRIPTION: Release 0.9.199.2.0 [github-only] * inst/NEWS.Rd: Release 0.9.199.2.0 * inst/include/armadillo_bits/*: Armadillo 9.200.RC3 2018-10-13 Dirk Eddelbuettel * DESCRIPTION: Release 0.9.199.1.1 [github-only] * inst/NEWS.Rd: Release 0.9.199.1.1 * inst/include/armadillo_bits/*: Armadillo 9.200.RC2 (gitlab) 2018-10-04 Dirk Eddelbuettel * inst/unitTests/runit.sparseConversion.R (test.stop): Comment-out a test which consistently fails on fedora-clang at CRAN, and only there 2018-10-03 Dirk Eddelbuettel * DESCRIPTION: Release 0.9.199.1.0 [github-only] * inst/NEWS.Rd: Release 0.9.199.1.0 * inst/include/armadillo_bits/*: Armadillo 9.200.RC2 2018-09-20 Dirk Eddelbuettel * DESCRIPTION: Release 0.9.199.0.0 [github-only] * inst/NEWS.Rd: Release 0.9.199.0.0 * inst/include/armadillo_bits/*: Armadillo 9.200.RC1 2018-09-02 Dirk Eddelbuettel * .travis.yml: Switch Travis CI to R 3.5 repo 2018-08-16 Dirk Eddelbuettel * DESCRIPTION: Release 0.9.100.5.0 * inst/NEWS.Rd: Release 0.9.100.5.0 * inst/include/armadillo_bits/*: Armadillo 9.100.5 2018-08-13 Dirk Eddelbuettel * DESCRIPTION: Release 0.9.099.1 [github-only] * inst/NEWS.Rd: Release 0.9.099.1 * inst/include/armadillo_bits/*: Armadillo 9.100.RC2 2018-08-12 Dirk Eddelbuettel * DESCRIPTION: Release 0.9.099.0 [github-only] * inst/NEWS.Rd: Release 0.9.099.0 * inst/include/armadillo_bits/*: Armadillo 9.100.RC1 2018-08-06 Dirk Eddelbuettel * inst/skeleton/Makevars: Align PKG_CXXFLAGS and PKG_LIBS to both use SHLIB_OPENMP_CXXFLAGS and not once SHLIB_OPENMP_CFLAGS [CRAN request] * inst/skeleton/Makevars.win: Idem 2018-06-28 Dirk Eddelbuettel * DESCRIPTION: Release 0.8.600.0.0 * inst/NEWS.Rd: Release 0.8.600.0.0 * inst/include/armadillo_bits/*: Armadillo 8.600.0 * vignettes/RcppArmadillo-sparseMatrix.Rmd: Do not use biobliography embedded in yaml header as pandoc2 no longer supports it 2018-06-19 Dirk Eddelbuettel * DESCRIPTION: Release 0.8.599.1 [github-only] * inst/NEWS.Rd: Release 0.8.599.1 * inst/include/armadillo_bits/*: Armadillo 8.600.rc2 2018-06-16 Dirk Eddelbuettel * DESCRIPTION: Release 0.8.599.0 [github-only] * inst/NEWS.Rd: Release 0.8.599.0 * inst/include/armadillo_bits/*: Armadillo 8.600.rc1 2018-05-31 Santiago Olivella * R/RcppArmadillo.package.skeleton.R: Correct behavior when example_code=FALSE and pkgKitten is available 2018-05-31 Keith O'Hara * inst/unitTests/cpp/Rlapack.cpp: Update Rlapack tests for band matrix solvers * inst/unitTests/runit.Rlapack.R: Idem 2018-05-17 Dirk Eddelbuettel * DESCRIPTION (Suggests): Add 'slam' used in two unit test functions (and already conditional) * .travis.yml (install): Add r-cran-slam to packages to install; switch reticulate to r-cran-reticulate as both are in the c4d2u PPA 2018-05-15 Dirk Eddelbuettel * DESCRIPTION: Release 0.8.500.1.0 * inst/NEWS.Rd: Release 0.8.500.1.0 * inst/include/armadillo_bits/*: Armadillo 8.500.1 2018-04-21 Dirk Eddelbuettel * DESCRIPTION: Release 0.8.500.0 * inst/NEWS.Rd: Release 0.8.500.0 2018-04-20 Dirk Eddelbuettel * inst/include/armadillo: Upgraded to Armadillo 8.500 * inst/include/armadillo_bits/*: Idem 2018-04-19 Keith O'Hara * configure.ac: Compile-time checks for macOS compilers * configure: Idem 2018-04-17 Dirk Eddelbuettel * DESCRIPTION: Release 0.8.499.1.0 [GitHub only] * inst/NEWS.Rd: Release 0.8.499.1.0 * inst/include/armadillo: Upgraded to Armadillo 8.500.rc2 * inst/include/armadillo_bits/*: Idem 2018-04-14 Dirk Eddelbuettel * configure.ac: Comparison across ranges does not work reliably so explicitly enumerate alternative accepted g++ versions * configure: Regenerated 2018-03-29 Dirk Eddelbuettel * DESCRIPTION (Version, Date): New minor version 0.8.499.0.2 * DESCRIPTION (Depends): Require R (>= 3.3.0) 2018-03-29 Keith O'Hara * configure.ac: Updated check for limited LAPACK * configure: Idem 2018-03-27 Dirk Eddelbuettel * DESCRIPTION: New minor version 0.8.499.0.1 2018-03-27 Keith O'Hara * inst/include/armadillo_bits/auxlib_meat.hpp: Remove several no longer needed define tests for the limited LAPACK shipped with R * inst/unitTests/cpp/Rlapack.cpp: Unit tests for these features * inst/unitTests/runit.Rlapack.R: Idem 2018-03-26 Dirk Eddelbuettel * DESCRIPTION: Release 0.8.499.0.0 [GitHub only] * inst/NEWS.Rd: Release 0.8.499.0.0 * inst/include/armadillo: Upgraded to Armadillo 8.500.rc1 * inst/include/armadillo_bits/*: Idem 2018-02-19 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Release 0.8.400.0.0 * inst/NEWS.Rd: Release 0.8.400.0.0 * inst/include/armadillo: Upgraded to Armadillo 8.400.0 * inst/include/armadillo_bits/*: Idem * configure.ac: Update * configure: Idem 2018-02-13 Dirk Eddelbuettel * inst/include/RcppArmadilloConfigGenerated.h.in: Protect two #define statements by #ifndef clauses 2018-02-12 Dirk Eddelbuettel * DESCRIPTION: Release 0.8.399.1.0 [GitHub only] * inst/NEWS.Rd: Release 0.8.399.1.0 * inst/include/armadillo_bits/*: Upgraded to Armadillo 8.400.rc2 2018-02-10 Dirk Eddelbuettel * inst/include/RcppArmadilloConfig.h: Test if ARMA_COUT_STREAM is defined, not ARMA_COUT_OSTREAM; and ditto for ARMA_CERR_STREAM 2018-02-09 Dirk Eddelbuettel * DESCRIPTION: Release 0.8.399.0.0 [GitHub only] * inst/NEWS.Rd: Release 0.8.399.0.0 * inst/include/armadillo: Upgraded to Armadillo 8.400.rc1 * inst/include/armadillo_bits/*: Idem 2017-12-04 Dirk Eddelbuettel * DESCRIPTION: Release 0.8.300.1.0 * inst/NEWS.Rd: Release 0.8.300.1.0 * inst/include/armadillo: Upgraded to Armadillo 8.300.1 * inst/include/armadillo_bits/*: Idem 2017-12-01 Serguei Sokol * inst/include/RcppArmadilloAs.h: Support conversion from simple_triplet_matrix * inst/unitTests/runit.sparseConversion.R: Test conversion 2017-11-22 Dirk Eddelbuettel * DESCRIPTION: Release 0.8.300.0.0 [GitHub only] * inst/NEWS.Rd: Release 0.8.300.0.0 [GitHub only] * inst/include/armadillo: Upgraded to Armadillo 8.300.0 * inst/include/armadillo_bits/*: Idem 2017-11-08 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Release 0.8.200.2.0 [GitHub only] * inst/include/armadillo_bits/*: Upgraded to Armadillo 8.200.2 2017-10-29 Dirk Eddelbuettel * DESCRIPTION: Release 0.8.200.1.1 [GitHub only] * inst/NEWS.Rd: Release 0.8.200.1.1 [GitHub only] * inst/include/RcppArmadilloConfigGenerated.h.in: Minor edit to comment 2017-10-28 Dirk Eddelbuettel * configure.ac: Repair for OpenMP use as Armadillo needs g++ 5.4 or later * configure: Idem 2017-10-22 Dirk Eddelbuettel * configure.ac: Add default branch to g++ test with thanks to James * configure: Idem 2017-10-21 Dirk Eddelbuettel * DESCRIPTION: Release 0.8.200.1.0 [GitHub only] * inst/NEWS.Rd: Release 0.8.200.1.0 [GitHub only] * inst/include/armadillo: Upgraded to Armadillo 8.200.1 * inst/include/armadillo_bits/*: Idem * inst/include/RcppArmadilloConfig.h: Set ARMA_DONT_PRINT_OPENMP_WARNING to suppress warnings from Armadillo when client packages fail to set -fopenmp * inst/include/RcppArmadilloConfigGenerated.h.in: Small cleanups * configure.ac: Idem * configure: Idem 2017-10-14 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/skeleton/Makevars (CXX_STD): Update C++11 settings * inst/skeleton/Makevars.win (CXX_STD): Idem 2017-10-12 Dirk Eddelbuettel * R/RcppArmadillo.package.skeleton.R: Also set .registration=TRUE in NAMESPACE file 2017-10-10 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Release 0.8.100.1.0 * inst/NEWS.Rd: Idem * configure: Idem 2017-10-09 Dirk Eddelbuettel * inst/include/RcppArmadilloWrap.h (Rcpp): Call sync() on SpMat 2017-10-05 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Release 0.8.100.1.0 (incomplete) * .travis.yml (install): Also install r-cran-pinp 2017-10-04 Dirk Eddelbuettel * vignettes/RcppArmadillo-sparseMatrix.Rmd: Some edits, added references 2017-10-02 Dirk Eddelbuettel * inst/include/armadillo: Upgraded to Armadillo 8.100.1 * inst/include/armadillo_bits/*: Idem * inst/include/RcppArmadilloConfig.h: Update to ARMA_COUT_STREAM and ARMA_CERR_STREAM * vignettes/RcppArmadillo-sparseMatrix.Rmd: Converted to markdown using pinp package, added missing vignette entries 2017-09-20 Serguei Sokol * inst/include/RcppArmadilloAs.h: Use native constructors for dgt, dtt, dst type conversion 2017-08-31 Binxiang Ni * inst/include/RcppArmadilloAs.h: Call .sync() before assessing internals of the SpMat classes [early patch to the 8.100.* code] 2017-08-29 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Release 0.7.960.1.2 2017-08-27 Dirk Eddelbuettel * configure.ac: Detect macOS to turn off OpenMP in src/Makevars * configure: Idem * src/Makevars: New configure var for OpenMP linker/compiler flags * inline.R: Similarly turn OpenMP off on macOS * src/Makevars: Compile under C++11 * src/Makevars.win: Idem 2017-08-26 James Joseph Balamuta * DESCRIPTION: Also Suggests: highlight * vignettes/RcppArmadillo-sparseMatrix.Rnw: Set VignetteDepends 2017-08-21 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/RcppArmadilloConfigGenerated.h.in: Renamed from inst/include/RcppArmadilloLapack.h.in to reflect use beyond LAPACK * inst/include/RcppArmadilloConfig.h: Updated * configure.ac: Idem * configure: Idem * cleanup.sh: Idem 2017-08-20 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Release 0.7.960.1.1 * man/RcppArmadillo-package.Rd: Minor edits * man/fastLm.Rd: Idem * README.md: Idem * src/Makevars.win: Small cosmetic edits as in Makevars 2017-08-19 Dirk Eddelbuettel * configure.ac: Added simple OpenMP detection * configure: Idem * inst/include/RcppArmadilloLapack.h.in: Apply variable here * src/Makevars: Small edits * src/fastLm.cpp: Renamed fastLm to fastLm_impl to not clash with R method of same name now that .registration is true * inst/unitTests/runit.fastLm.R: Updated test call * src/RcppExports.cpp: Regenerated * R/RcppExports.R: Idem * man/fastLm.Rd: New alias 2017-08-18 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/RcppArmadilloAs.h (Rcpp): Improved S4 inheritance check 2017-08-11 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Release 0.7.960.1.0 * inst/NEWS.Rd: Idem * DESCRIPTION (Author): New co-author Binxinag Ni 2017-08-10 Dirk Eddelbuettel * inst/include/armadillo_bits/*: Updated to upstream release 7.960.1 * .aspell/: Added for new R-devel spell checker interface * DESCRIPTION (Version, Date): Rolled to pre-release 0.7.959.0.3 2017-08-09 Dirk Eddelbuettel * inst/unitTests/runit.scipy2r.R: Condition test on having SciPy * DESCRIPTION (Version, Date): Rolled to pre-release 0.7.959.0.2 2017-08-08 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Rolled to pre-release 0.7.959.0.1 in preparation of 0.7.960.0.0 release "real soon now" * tests/doRUnit.R: Small edits and improvements * inst/unitTests/runit.sparseConversion.R: Run Kronecker products once in setup under suppressMessages to suppress dispatch messages 2017-08-07 Dirk Eddelbuettel * inst/unitTests/runit.scipy2r.R: Whitespace edits * R/SciPy2R.R: Idem; also renamed from py2R, removed one require() * .travis.yml (install): Also install reticulate and (r-cran-)jsonlite 2017-08-07 Binxiang Ni * R/py2r.R: Python to R conversion * inst/unitTests/runit.scipy2r.R: Unit tests 2017-08-06 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Rolled to fictional pre-release number 0.7.959.0.0 is preparation of 0.7.960.0.0 release * inst/NEWS.Rd: Expanded description of GSoC 2017 work by Binxiang 2017-08-03 Binxiang Ni * inst/include/RcppArmadilloWrap.h: Comment-out unreachable code 2017-08-02 Qiang Kou (KK) * inst/include/armadillo_bits/SpMat_meat.hpp: Correct use of 'p' in dgCMatrix (by pulling in upstream patch from Armadillo) * inst/unitTests/cpp/sparse.cpp: New speye() unit tests * inst/unitTests/runit.sparse.R: Ditto 2017-08-01 Dirk Eddelbuettel * inst/include/armadillo*: Upgraded to Armadillo 7.960.0 2017-08-01 Serguei Sokol * inst/include/RcppArmadilloWrap.h: Allow collapsed returns of row or column vector if appropriate #define is set * inst/unitTests/runit.RcppArmadillo.R: Corresponding unit test * inst/unitTests/cpp/any_as_vec.cpp: Ditto * inst/unitTests/cpp/armadillo.cpp: Ditto * inst/unitTests/cpp/colrow_as_vec.cpp: Ditto * R/unit.test.R: Generalization for test helper 2017-07-31 Dirk Eddelbuettel * vignettes/RcppArmadillo-sparseMatrix.Rnw: Use highlight engine 2017-07-31 Binxiang Ni * vignettes/RcppArmadillo-sparseMatrix.Rnw: New vignette 2017-07-11 Binxiang Ni * inst/include/RcppArmadilloAs.h: Add a stop message for matrices that cannot be converted * inst/unitTests/runit.sparseConversion.R: Add unit tests for matrices that cannot be converted 2017-07-10 Binxiang Ni * inst/include/RcppArmadilloAs.h: Rewrite conversion for ddiMatrix to support an extreme case * inst/unitTests/runit.sparse.R: Move unit tests for the conversion for sparse matrices to runit.sparseConversion.R * inst/unitTests/runit.sparseConversion.R: Add more unit tests for the conversion for ddiMatrix 2017-07-08 Binxiang Ni * inst/include/RcppArmadilloAs.h: Add conversion for indMatrix * inst/unitTests/runit.sparse.R: Add unit tests for the conversion for indMatrix * inst/unitTests/runit.sparseConversion.R: Add more unit tests for the conversion for indMatrix 2017-07-08 Dirk Eddelbuettel * inst/unitTests/runit.sparseConversion.R: Use text= in read.table 2017-07-04 Binxiang Ni * inst/include/RcppArmadilloAs.h: Rewrite conversion for dgT, dtT & dsTMatrix to support two extreme cases * inst/unitTests/runit.sparseConversion.R: Add new unit tests for conversion of sparse matrices 2017-06-23 Dirk Eddelbuettel * inst/AUTHORS: Added * inst/COPYRIGHTS: Idem 2017-06-21 Binxiang Ni * inst/include/RcppArmadilloAs.h: Add conversion for pMatrix & ddiMatrix * inst/unitTests/runit.sparse.R: Add unit tests for the conversion for pMatrix & ddiMatrix 2017-06-19 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * .travis.yml (group): Added as required by Travis CI 2017-06-19 Binxiang Ni * inst/include/RcppArmadilloAs.h: Add conversion for dgR, dtR & dsRMatrix * inst/unitTests/runit.sparse.R: Add unit tests for the conversion for dgR, dtR & dsRMatrix 2017-06-18 Binxiang Ni * inst/include/RcppArmadilloAs.h: Add conversion for dgT, dtT & dsTMatrix * inst/unitTests/runit.sparse.R: Add unit tests for the conversion for dgT, dtT & dsTMatrix 2017-06-17 Binxiang Ni * inst/include/RcppArmadilloAs.h: Add conversion for dtC & dsCMatrix * inst/unitTests/runit.sparse.R: Add unit tests for the conversion for dtC & dsCMatrix 2017-06-04 Dirk Eddelbuettel * configure.ac: Whitespace changes * configure: Regenerated 2017-06-02 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Release 0.7.900.2.0 * inst/NEWS.Rd: Idem * README.md: Use alternate for img.shields.io GPL-2+ badge * src/Makevars (CXX_STD): Do not enable C++11 by default to not require too modern a compiler 2017-06-01 Dirk Eddelbuettel * inst/include/armadillo*: Upgraded to Armadillo 7.900.2 2017-05-24 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Release 0.7.900.1.2 (GH-only) * src/RcppExports.cpp: Regenerated under Rcpp 0.12.11 with included package registration * R/RcppExports.R: Regenerated under Rcpp 0.12.11 with unquoted registered function calls * src/init.c: Removed * README.md: Switch to https for a few badge URLs * R/inline.R (inlineCxxPlugin): Use '::' to import from Rcpp 2017-05-23 Dirk Eddelbuettel * R/inline.R (inlineCxxPlugin): Also enable OpenMP as a compile-time option 2017-05-22 Dirk Eddelbuettel * R/inline.R (inlineCxxPlugin): Support OpenMP * src/Makevars: Ditto * src/Makevars.win: Ditto * inst/skeleton/Makevars: Ditto * inst/skeleton/Makevars.win: Ditto 2017-05-21 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Release 0.7.900.1.1 (GH-only) * inst/unitTests/cpp/rmultinom.cpp: More careful use of Armadillo vectors and Rcpp vectors 2017-05-15 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Release 0.7.900.1.0 (GH-only) * inst/include/armadillo*: Upgraded to Armadillo 7.900.1 2017-05-10 James Joseph Balamuta * man/armadillo_set_seed.Rd: Clarified RNG usage in C++98 and C++11 modes. * man/armadillo_set_seed_random.Rd: idem * R/RcppExports.R: idem * src/RcppArmadillo.cpp: idem 2017-05-08 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Release 0.7.900.0.0 (GH-only) * inst/include/armadillo*: Upgraded to Armadillo 7.900.0 2017-05-06 James Joseph Balamuta * configure.ac: Added gcc7 to viable gcc compiler list * configure: Idem 2017-05-03 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Test release 0.7.899.0.0 * inst/include/armadillo*: Upgraded to Armadillo 7.899.0 * src/Makevars (PKG_LIBS): Enable OpenMP and C++11 2017-04-16 Dirk Eddelbuettel * inst/include/RcppArmadillo/Alt_R_RNG.h (set_seed): Add a simple null-op to suppress a -Wunused warning 2017-04-12 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Release 0.7.800.2.0 * inst/include/armadillo*: Upgraded to Armadillo 7.800.2 2017-02-20 Dirk Eddelbuettel * NAMESPACE (useDynLib): Add .registration=TRUE; some other edits * src/init.c: Added 'R_registerRoutines()' & 'R_useDynamicSymbols()' 2017-02-19 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Release 0.7.800.0.0 (GH-only) * DESCRIPTION (Description): Mention that Armadillo is now licensed as Apache License 2 (as a change from Mozilla MPL 2.0) * inst/include/armadillo*: Upgraded to Armadillo 7.800.0 2017-02-18 Dirk Eddelbuettel * src/fastLm.cpp: Whitespace tweaks, using Named(), update copyright * .travis.yml (before_install): Use https 2017-02-06 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Release 0.7.700.0.0 (CRAN) * inst/include/*: Upgraded to release 7.700.0 of Armadillo * debian/*: Debian release of 0.7.700.0.0 2017-01-05 Dirk Eddelbuettel * DESCRIPTION (Version, Date): 0.7.600.2.0 (GH-only) 2017-01-04 Dirk Eddelbuettel * inst/include/armadillo_bits/: Armadillo release 7.600.2 2016-12-16 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Release 0.7.600.1.0 * inst/NEWS.Rd: Release 0.7.600.1.0 * debian/*: Debian release of 0.7.600.1.0 * inst/include/*: Upgraded to release 7.600.1 of Armadillo 2016-12-12 Dirk Eddelbuettel * DESCRIPTION (Version): Release 0.7.599.0 (GH-only) * inst/NEWS.Rd: Release 0.7.599.0 (GH-only) * inst/include/*: Upgraded to release 7.600.0-test of Armadillo 2016-11-11 Dirk Eddelbuettel * DESCRIPTION (Version): Release 0.7.500.1.0 (GH-only) * inst/NEWS.Rd: Release 0.7.500.1.0 (GH-only) * inst/include/*: Upgraded to release 7.500.1 of Armadillo 2016-10-25 Dirk Eddelbuettel * inst/include/RcppArmadilloExtensions/sample.h (Rcpp): Update to newer Armadillo interface: descending sort order is now signaled by using the more explicit string "descend" as opposed to (uword) 1 2016-10-20 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Release 0.7.500.0.0 * DESCRIPTION (Description): Noted minimum of g+++ 4.6 or later 2016-10-20 Dirk Eddelbuettel * inst/include/*: Upgraded to release 7.500.0 of Armadillo * debian/*: Debian release of 0.7.500.0.0 * .gitattributes: Added 2016-08-24 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Release 0.7.400.2.0 (CRAN) * inst/include/*: Finalised as 7.400.2 of Armadillo * debian/*: Debian release of 0.7.400.2.0 * .travis.yml: Switch to using run.sh for Travis CI 2016-08-23 Dirk Eddelbuettel * DESCRIPTION (Version): Release 0.7.400.1.1 (GH-only) * inst/NEWS.Rd: Release 0.7.400.1.1 (GH-only) * inst/include/*: Upgraded to release 7.400.2.test of Armadillo 2016-08-15 Dirk Eddelbuettel * DESCRIPTION (Version): Release 0.7.400.1.0 (GH-only) * inst/NEWS.Rd: Release 0.7.400.1.0 (GH-only) * inst/include/*: Upgraded to release 7.400.1 of Armadillo 2016-08-12 Dirk Eddelbuettel * DESCRIPTION (Version): Release 0.7.400.0.0 (GH-only) * inst/NEWS.Rd: Release 0.7.400.0.0 (GH-only) * inst/include/*: Upgraded to release 7.400.0-test of Armadillo 2016-07-30 Dirk Eddelbuettel * DESCRIPTION (Version): Release 0.7.300.1.0 (GH-only) * inst/NEWS.Rd: Release 0.7.300.1.0 (GH-only) * inst/include/*: Upgraded to release 7.300.1 of Armadillo 2016-07-22 Dirk Eddelbuettel * DESCRIPTION (Version): Release 0.7.200.2.0 (CRAN) * DESCRIPTION (Date): Updated 2016-06-22 Dirk Eddelbuettel * DESCRIPTION (Version): Release 0.7.200.2.0 (GH-only) * inst/NEWS.Rd: Release 0.7.200.2.0 (GH-only) * inst/include/*: Upgraded to release 7.200.2 of Armadillo 2016-06-19 James Joseph Balamuta * inst/include/RcppArmadilloExtensions/sample.h: Rewrote sampling functions to use only armadillo outside of the supplied data vector. * inst/include/RcppArmadilloExtensions/fixprob.h: Updated fix probability check code to use armadillo object for probability. 2016-06-09 Dirk Eddelbuettel * configure.ac: Correct assignment for fully-featured versus incomplete LAPACK set in inst/include/RcppArmadilloLapack.h * configure: Ditto 2016-06-06 Dirk Eddelbuettel * DESCRIPTION (Version): Release 0.7.200.1.0 (GH-only) * inst/NEWS.Rd: Release 0.7.200.1.0 (GH-only) * inst/include/*: Upgraded to release 7.200.1 of Armadillo 2016-06-02 Dirk Eddelbuettel * DESCRIPTION: Release 0.7.100.3.1 * configure.ac: Move R-based CXX init before first autoconf commands * configure: Ditto 2016-05-30 Dirk Eddelbuettel * configure.ac: Refined test for minimal g++ version to first set CXX based on the existing R configuratin * configure: Ditto 2016-05-25 Dirk Eddelbuettel * DESCRIPTION: Release 0.7.100.3.0 * inst/NEWS.Rd: Release 0.7.100.3.0 * debian/*: Changes for Debian release of 0.7.100.3.0 * inst/include/*: Upgraded to release 7.100.3 of Armadillo 2016-05-16 Dirk Eddelbuettel * DESCRIPTION: Release 0.7.100.0.0 [GitHub only] * inst/NEWS.Rd: Release 0.7.100.0.0 [GitHub only] * inst/include/*: Upgraded to release 7.100.0 of Armadillo 2016-05-12 Dirk Eddelbuettel * configure.ac: Rewriting configure as autoconf script for better compiler tests * configure (checkoldcompiler): Add test to guard against old g++ compilers (such as g++-4.4 used on some RHEL and CentOS releases) which are no longer sufficient to build RcppArmadillo. 2016-05-05 Dirk Eddelbuettel * DESCRIPTION: Release 0.6.700.6.0 * inst/NEWS.Rd: Release 0.6.700.6.0 * debian/*: Changes for Debian release of 0.6.700.6.0 2016-05-04 George G. Vega Yon * inst/include/RcppArmadilloConfig.h: Added support for int64_t when required * inst/include/RcppArmadilloAs.h: Fixing bug in SpMat exporter * inst/unitTests/cpp/sparse.cpp: Added two new tests * inst/unitTests/runit.sparse.R: Added two new tests 2016-05-03 Dirk Eddelbuettel * inst/include/*: Upgraded to release 6.700.6 of Armadillo 2016-04-05 Dirk Eddelbuettel * DESCRIPTION: Release 0.6.700.3.0 * inst/NEWS.Rd: Release 0.6.700.3.0 * inst/include/*: Upgraded to release 6.700.3 of Armadillo * debian/*: Changes for Debian release of 0.6.600.4.0 2016-03-15 Dirk Eddelbuettel * DESCRIPTION: Release 0.6.600.4.0 * inst/NEWS.Rd: Release 0.6.600.4.0 * inst/include/*: Upgraded to release 6.600.4 of Armadillo * debian/*: Changes for Debian release of 0.6.600.4.0 2016-03-12 Dirk Eddelbuettel * DESCRIPTION: Release 0.6.600.3.1 [GitHub only] * inst/NEWS.Rd: Release 0.6.600.3.1 [GitHub only] * inst/include/*: Upgraded to release 6.600.4-test of Armadillo * configure: Take R 3.3.0 with a complete fallback for LAPACK into consideration when checking for LAPACK features 2016-03-11 Dirk Eddelbuettel * DESCRIPTION: Release 0.6.600.2.1 [GitHub only] * inst/NEWS.Rd: Release 0.6.600.2.1 [GitHub only] * inst/include/*: Upgraded to release 6.600.3-test of Armadillo 2016-01-26 Dirk Eddelbuettel * DESCRIPTION: Release 0.6.500.4.0 * inst/NEWS.Rd: Release 0.6.500.4.0 * inst/include/*: Upgraded to release 6.500.4 of Armadillo * debian/*: Changes for Debian release of 0.6.500.4.0 * inst/include/RcppArmadilloConfig.h (ARMA_32BIT_WORD): Define to ensure 32-bit words are used even with C++11 or C++14 * inst/include/RcppArmadillo.h: Added some comments 2016-01-24 Dirk Eddelbuettel * DESCRIPTION: Release 0.6.500.2.1 [GitHub only] * inst/NEWS.Rd: Release 0.6.500.2.1 [GitHub only] * inst/include/*: Upgraded to release 6.500.3-test of Armadillo 2016-01-10 Dirk Eddelbuettel * configure: Use /usr/bin/env bash as shebang 2015-12-15 Dirk Eddelbuettel * DESCRIPTION: Release 0.6.400.2.0 * inst/NEWS.Rd: Release 0.6.400.2.0 * inst/include/*: Upgraded to release 6.400.2 of Armadillo * debian/*: Changes for Debian release of 0.6.400.2.0 2015-12-12 Dirk Eddelbuettel * DESCRIPTION: Release 0.6.300.2.2 * inst/NEWS.Rd: Release 0.6.300.2.2 * configure (hasRlapack): Reworded test messages 2015-12-09 Dirk Eddelbuettel * configure: Further refinements in test for partial LAPACK 2015-12-08 Dirk Eddelbuettel * DESCRIPTION: Release 0.6.300.2.1 [GitHub only] * inst/NEWS.Rd: Release 0.6.300.2.1 [GitHub only] * inst/include/*: Upgraded to release 6.300.3-test of Armadillo * inst/include/RcppArmadilloConfig.h: Updated #define for limited LAPACK * inst/include/RcppArmadilloLapack.h.in: Updated conditional #define * configure: Updated test for Rlapack and corresponding #define 2015-12-03 Dirk Eddelbuettel * DESCRIPTION: Release 0.6.300.2.0 * inst/NEWS.Rd: Release 0.6.300.2.0 * inst/include/*: Upgraded to release 6.300.2 of Armadillo * debian/*: Changes for Debian release of 0.6.300.2.0 2015-12-01 Dirk Eddelbuettel * DESCRIPTION: Release 0.6.299.0.0 [GitHub only] * inst/NEWS.Rd: Release 0.6.299.0.0 [GitHub only] * inst/include/*: Upgraded to release 6.300.0-test of Armadillo 2015-11-30 Nathan Russell * inst/include/RcppArmadilloAs.h: Support as<> converters to the Armadillo cube type * inst/unitTests/cpp/cube.cpp: Unit tests for Cube converter * inst/unitTests/runit.cube.R: Idem 2015-10-30 Dirk Eddelbuettel * DESCRIPTION: Release 0.6.199.2.0 [GitHub only] * inst/NEWS.Rd: Release 0.6.199.2.0 [GitHub only] * inst/include/*: Upgraded to release 6.200.2-test of Armadillo 2015-10-26 Dirk Eddelbuettel * DESCRIPTION: Release 0.6.199.0.0 [GitHub only] * inst/NEWS.Rd: Release 0.6.199.0.0 [GitHub only] * inst/include/*: Upgraded to release 6.200.0-test of Armadillo 2015-10-03 Dirk Eddelbuettel * DESCRIPTION: Release 0.6.100.0.0 * inst/NEWS.Rd: Release 0.6.100.0.0 * inst/include/*: Upgraded to release 6.100.0 of Armadillo * debian/*: Changes for Debian release of 0.6.100.0.0 2015-09-25 Dirk Eddelbuettel * DESCRIPTION: Release 0.6.000.1.0 [GitHub only] * inst/NEWS.Rd: Release 0.6.000.1.0 [GitHub only] * inst/include/*: Upgraded to release 6.000.1-test of Armadillo 2015-09-19 Dirk Eddelbuettel * DESCRIPTION: Release 0.5.600.2.0 * inst/NEWS.Rd: Release 0.5.600.2.0 * inst/include/*: Upgraded to release 5.600.2 of Armadillo * debian/*: Changes for Debian release of 0.5.600.2.0 2015-09-03 Dirk Eddelbuettel * DESCRIPTION: Release 0.5.500.2.0 * inst/NEWS.Rd: Release 0.5.500.2.0 * inst/include/*: Upgraded to release 5.500.2 of Armadillo * debian/*: Changes for Debian release of 0.5.500.2.0 2015-09-02 Dirk Eddelbuettel * DESCRIPTION: (Test) Release 0.5.499.0 * inst/include/*: Upgraded to (test) release 5.500.1 of Armadillo 2015-08-17 Dirk Eddelbuettel * DESCRIPTION: Release 0.5.400.2.0 * inst/NEWS.Rd: Release 0.5.400.2.0 * inst/include/*: Upgraded to release 5.400.2 of Armadillo * debian/*: Changes for Debian release of 0.5.400.2.0 * NAMESPACE: Also import package.skeleton from utils 2015-08-13 Dirk Eddelbuettel * DESCRIPTION: (Test) Release 0.5.399.0 * inst/include/*: Upgraded to (test) release 5.400.1 of Armadillo 2015-08-05 Dirk Eddelbuettel * inst/examples/varSimulation.r: Minor touch-up 2015-08-04 Dirk Eddelbuettel * R/RcppArmadillo.package.skeleton.R: Correct kitten() use based on patch by Grant Brown for RcppEigen (cf GitHub issue #21 @ RcppEigen) 2015-08-03 Dirk Eddelbuettel * DESCRIPTION: Release 0.5.300.4.0 * inst/NEWS.Rd: Release 0.5.300.4.0 * inst/include/*: Upgraded to release 5.300.4 of Armadillo * debian/*: Changes for Debian release of 0.5.300.4.0 * NAMESPACE: Additional importFrom() statements for R CMD check * DESCRIPTION: Also import utils and stats for R CMD check 2015-07-31 Dirk Eddelbuettel * DESCRIPTION: (Test) Release 0.5.300.3.0 * inst/include/*: Upgraded to (test) release 5.300.3 of Armadillo 2015-07-28 Dirk Eddelbuettel * DESCRIPTION: (Test) Release 0.5.300.1.0 * inst/include/*: Upgraded to (test) release 5.300.1 of Armadillo 2015-07-11 Dirk Eddelbuettel * vignettes/RcppArmadillo-intro.Rnw: No longer use H as a float placement as it upsets Texlive 2015 (per request of Kurt Hornik / CRAN) 2015-06-06 Dirk Eddelbuettel * R/RcppArmadillo.package.skeleton.R: Correct use of requireNamespace() 2015-06-04 Dirk Eddelbuettel * DESCRIPTION: Release 0.5.200.1.0 * inst/NEWS.Rd: Release 0.5.200.1.0 * inst/include/*: Upgraded to release 5.200.1 of Armadillo 2015-05-19 Dirk Eddelbuettel * inst/examples/fastLm.r: Added another example starting directly from a SEXP interface to illustrate potential cost of interfaces 2015-05-12 Dirk Eddelbuettel * DESCRIPTION: Release 0.5.100.2.0 [GitHub only] * inst/NEWS.Rd: Release 0.5.100.2.0 [GitHub only] * inst/include/*: Upgraded to release 5.100.2 of Armadillo 2015-05-09 Dirk Eddelbuettel * DESCRIPTION: Release 0.5.100.1.1 [GitHub only] * inst/NEWS.Rd: Release 0.5.100.1.1 [GitHub only] * inst/include/*: Upgraded to [test] release 5.100.2 of Armadillo 2015-05-01 Dirk Eddelbuettel * DESCRIPTION: Release 0.5.100.1.0 * inst/NEWS.Rd: Release 0.5.100.1.0 * inst/include/*: Upgraded to release 5.100.1 of Armadillo 2015-04-30 Dirk Eddelbuettel * DESCRIPTION: Release 0.5.099.1.0 [GitHub only] with altered release number to permit upgrade once 5.100.1 is released * inst/NEWS.Rd: Release 0.5.099.1.0 [GitHub only] * inst/include/*: Upgraded to release 5.100.1 of Armadillo 2015-04-12 Dirk Eddelbuettel * DESCRIPTION: Release 0.5.000.0 * inst/NEWS.Rd: Release 0.5.000.0 * inst/include/*: Upgraded to release 5.000 of Armadillo 2015-04-04 Dirk Eddelbuettel * DESCRIPTION: Release 0.4.999.1.0 [GitHub only] * inst/NEWS.Rd: Release 0.4.999.1.0 [GitHub only] * inst/include/*: Upgraded to release 4.999.1 of Armadillo 2015-02-26 Dirk Eddelbuettel * DESCRIPTION: Release 0.4.600.2.0 [GitHub only] * inst/NEWS.Rd: Release 0.4.600.2.0 [GitHub only] * inst/include/*: Upgraded to release 4.650.2 of Armadillo 2015-02-25 Dirk Eddelbuettel * DESCRIPTION: Release 0.4.650.1.1 * inst/NEWS.Rd: Release 0.4.650.1.1 * inst/include/armadillo: Fix for C++11 RNG include 2015-02-24 Dirk Eddelbuettel * inst/include/*: Upgraded to release 4.650.1 of Armadillo * .travis.yml: Switch to ppa:edd/misc for binaries 2015-01-23 Dirk Eddelbuettel * DESCRIPTION: Release 0.4.600.4.0 * inst/NEWS.Rd: Release 0.4.600.4.0 * inst/include/*: Upgraded to release 4.600.4 of Armadillo * inst/examples/fastLm.r: Load Rcpp library 2015-01-21 Dirk Eddelbuettel * R/unit.test.R (unit_test_setup): Use requireNamespace() * R/RcppArmadillo.package.skeleton.R: Ditto 2015-01-20 Dirk Eddelbuettel * DESCRIPTION: Release 0.4.600.3.0 [GitHub only] * inst/NEWS.Rd: Release 0.4.600.3.0 [GitHub only] * inst/include/*: Upgraded to release 4.600.3 of Armadillo 2014-12-27 Dirk Eddelbuettel * DESCRIPTION: Release 0.4.600.0 * inst/NEWS.Rd: Release 0.4.600.0 * inst/include/*: Upgraded to release 4.600 of Armadillo 2014-12-25 Dirk Eddelbuettel * DESCRIPTION: Release 0.4.599.2.0 [GitHub only] * inst/NEWS.Rd: Release 0.4.599.2.0 [GitHub only] * inst/include/*: Upgraded to release 4.599.alpha.2 of Armadillo 2014-12-23 Dirk Eddelbuettel * DESCRIPTION: Release 0.4.599.1.0 [GitHub only] * inst/NEWS.Rd: Release 0.4.599.1.0 [GitHub only] * inst/include/*: Upgraded to release 4.599.alpha.1 of Armadillo 2014-12-02 Dirk Eddelbuettel * DESCRIPTION: Release 0.4.550.2.0 [GitHub only] * inst/NEWS.Rd: Release 0.4.549.2.0 [GitHub only] * inst/include/*: Upgraded to release 4.550.2 of Armadillo 2014-11-26 Dirk Eddelbuettel * DESCRIPTION: Release 0.4.550.1.0 * inst/NEWS: Release 0.4.550.1.0 * debian/*: Similarly updated for new release to Debian * inst/include/*: Upgraded to release 4.550.1 of Armadillo * inst/unitTests/runit.rmultinom.R: Run only if 'long double' exists 2014-11-25 Dirk Eddelbuettel * inst/unitTests/runit.rmultinom.R: Run only on i686 or x86_64 2014-11-22 Dirk Eddelbuettel * DESCRIPTION: Release 0.4.550.0 * inst/NEWS: Release 0.4.550.0 * debian/*: Similarly updated for new release to Debian * inst/include/*: Upgraded to release 4.550 of Armadillo * .travis.yml: Undo temporary stop-gap measure of setting CRAN 2014-11-19 Dirk Eddelbuettel * DESCRIPTION: Release 0.4.549.2.0 [GitHub only] * inst/NEWS.Rd: Release 0.4.549.2.0 [GitHub only] * inst/include/*: Upgraded to "alpha" version 4.549.2 of Armadillo * .travis.yml: Temporary stop-gap measure of setting CRAN to something other than the RStudio CDN which currently has DNS issue 2014-11-19 Romain Francois * inst/include/RcppArmadilloAs.h: Support Fields type * inst/include/RcppArmadilloForward.h: Ditto 2014-10-30 Dirk Eddelbuettel * DESCRIPTION: Release 0.4.500.0 * inst/NEWS: Release 0.4.500.0 * debian/*: Similarly updated for new release to Debian * inst/include/*: Upgraded to release 4.500 of Armadillo 2014-10-26 Dirk Eddelbuettel * DESCRIPTION: Release 0.4.449.1.0 [GitHub only] * inst/NEWS.Rd: Release 0.4.449.1.0 [GitHub only] * inst/include/*: Upgraded to "alpha" version 4.449.1 of Armadillo 2014-09-26 Christian Gunning * inst/include/RcppArmadilloExtensions/sample.h: Extended with Walker's method * inst/include/RcppArmadilloExtensions/rmultinom.h: Added * inst/include/RcppArmadilloExtensions/fixprob.h: Split off from sample.h * inst/unitTests/runit.sample.R: Updated for new functionality * inst/unitTests/runit.rmultinom.R: New unit test * inst/unitTests/cpp/rmultinom.cpp: New unit test file in C++ 2014-09-20 Dirk Eddelbuettel * inst/include/RcppArmadilloConfig.h: Add a new #define variable which selects the RNG from R as a fallback (unless C++11 is used) * inst/include/armadillo: Include new R RNG if #define set * inst/include/armadillo_bits/arma_rng_r.hpp: Added new RNG implementation based on runif() from R * inst/include/armadillo_bits/arma_rng.hpp: Deploy new R RNG * inst/unitTests/runit.rng.R: New unit tests for RNG fallback code * inst/unitTests/cpp/rng.cpp: C++ side of new unit tests 2014-09-19 Dirk Eddelbuettel * DESCRIPTION: Release 0.4.450.0 * inst/NEWS.Rd: Release 0.4.450.0 [GitHub only] * inst/include/*: Upgraded to version 4.450 of Armadillo 2014-09-16 Dirk Eddelbuettel * DESCRIPTION: Release 0.4.419.3.0 [GitHub only] * inst/NEWS.Rd: Release 0.4.419.3.0 [GitHub only] * inst/include/*: Upgraded to version 4.419.3 of Armadillo 2014-09-01 Dirk Eddelbuettel * R/RcppArmadillo.package.skeleton.R: Copy new manual page when copying the example code documented in it * R/RcppArmadillo.package.skeleton.R: Use pkgKitten::kitten() when available * .travis.yml: Also install pkgKitten as Suggests: now required 2014-08-30 Dirk Eddelbuettel * inst/skeleton/rcpparma_hello_world.Rd: New manual page for skeleton functions 2014-08-28 Dirk Eddelbuettel * R/RcppArmadillo.package.skeleton.R: In DESCRIPTION and NAMESPACE, only Imports: Rcpp and not RcppArmadillo (to appease R CMD check) 2014-08-27 Dirk Eddelbuettel * man/RcppArmadillo-package.Rd: Updated manual page 2014-08-19 Dirk Eddelbuettel * DESCRIPTION: Release 0.4.400.0 * inst/NEWS: Release 0.4.400.0 * debian/*: Similarly updated for new release to Debian * inst/include/*: Upgraded to release 4.400 of Armadillo 2014-08-18 Dirk Eddelbuettel * inst/include/*: Upgraded to pre-release 4.399.3 of Armadillo 2014-08-17 Dirk Eddelbuettel * inst/unitTests/runit.sparse.R: New unit tests for sparse matrices * inst/unitTests/cpp/sparse.cpp: New unit tests for sparse matrices 2014-08-15 Dirk Eddelbuettel * inst/include/*: Upgraded to pre-release 4.399.2 of Armadillo * inst/include/RcppArmadilloAs.h: Further correction to sparse matrix converter with special thanks to Ryan Curtin for some excellent help 2014-08-10 Dirk Eddelbuettel * inst/include/RcppArmadilloAs.h: Correct sparse matrix converter 2014-07-04 Dirk Eddelbuettel * vignettes/RcppArmadillo-unitTests.Rnw: Commented-out copy of unit test result file to /tmp per request of Kurt 2014-07-03 Dirk Eddelbuettel * DESCRIPTION: Release 0.4.320.0 * inst/NEWS: Release 0.4.320.0 * debian/*: Similarly updated for new release to Debian * inst/include/*: Upgraded to version 4.320 of Armadillo 2014-06-03 Dirk Eddelbuettel * inst/unitTests/cpp/complex.cpp: Rename a variable as the term CS clashes with a macro on the Solaris OS 2014-06-02 Dirk Eddelbuettel * DESCRIPTION: Release 0.4.300.8.0 * inst/NEWS: Release 0.4.300.8.0 * debian/*: Similarly updated for new release to Debian * inst/include/*: Upgraded to version 4.300.8 of Armadillo 2014-06-01 Dirk Eddelbuettel * configure: Change back to #!/bin/bash * configure: Added tips do in case no suitable shell is available * tests/doRUnit.R: Simplified, following use in RProtoBuf * inst/unitTests/runTests.R: Refreshed, following use in RProtoBuf 2014-05-31 Dirk Eddelbuettel * DESCRIPTION: Release 0.4.300.7.0 [pending/unreleased] * inst/NEWS: Release 0.4.300.7.00 [pending/unreleased] * debian/*: Similarly updated for new release to Debian * inst/include/*: Upgraded to version 4.300.7 of Armadillo * src/Makevars.win: Detail possible use of ARMA_DONT_USE_CXX11 define * src/Makevars: Edited as well 2014-05-29 Dirk Eddelbuettel * inst/include/RcppArmadilloConfig.h: Robustify behaviour on Windows under MinGW when C++11 is used 2014-05-28 Dirk Eddelbuettel * src/Makevars: Updated (commented-out) C++11 settings variable * src/Makevars.win: Idem 2014-05-19 Dirk Eddelbuettel * DESCRIPTION: Release 0.4.300.5.0 [GitHub only] * inst/NEWS: Release 0.4.300.5.0 [GitHub only] * inst/include/*: Upgraded to version 4.300.5 of Armadillo 2014-05-13 Dirk Eddelbuettel * DESCRIPTION: Release 0.4.300.2.0 [GitHub only] * inst/NEWS: Release 0.4.300.2.0 [GitHub only] * inst/include/*: Upgraded to version 4.300.2 of Armadillo 2014-05-05 Dirk Eddelbuettel * configure: Rewritten for non-bash versions of /bin/sh 2014-05-04 Dirk Eddelbuettel * DESCRIPTION: Release 0.4.300.0 * inst/NEWS: Release 0.4.300.0 * debian/*: Similarly updated for new release to Debian * configure: If R version 3.0.3 or newer, use comples GESDD 2014-05-02 Dirk Eddelbuettel * inst/include/*: Upgraded to version 4.300 of Armadillo 2014-04-20 Kevin Ushey * inst/include/RcppArmadilloAs.h: Force vector coercion if the type does not fit within an R vector through as * inst/unitTests/cpp/armadillo.cpp: Add unit tests * inst/unitTests/runit.RcppArmadillo.R: Add unit tests 2014-04-20 Dirk Eddelbuettel * inst/include/RcppArmadilloConfig.h: Comment-out setting of C++11 define which (Rcpp)Armadillo gets correctly by itself 2014-04-07 Dirk Eddelbuettel * DESCRIPTION: Release 0.4.200.0 * inst/NEWS: Release 0.4.200.0 * inst/include/*: Upgraded to version 4.200 of Armadillo * debian/*: Similarly updated for new release to Debian 2014-03-07 Dirk Eddelbuettel * DESCRIPTION: Release 0.4.100.2 * inst/NEWS: Release 0.4.100.2 * inst/include/*: Upgraded to version 4.100.2 of Armadillo * debian/*: Similarly updated for new release to Debian 2014-03-04 Dirk Eddelbuettel * inst/include/*: Upgraded to (unreleased) version 4.100.1 of Armadillo 2014-03-01 Dirk Eddelbuettel * inst/skeleton/rcpparma_hello_world.cpp: Correct use of depends for Attributes (for illustration only as skeleton uses package build) * src/Makevars: Simple setup for C++11 use (for R-devel aka R 3.1.0) by defining USE_CXX1X (commented out by default) * inst/include/RcppArmadilloConfig.h: If USE_CXX1X is defined, also define ARMA_USE_CXX11 to permit use C++11 by Armadillo 2014-02-28 Dirk Eddelbuettel * DESCRIPTION: Release 0.4.100.0 * inst/NEWS: Release 0.4.100.0 * inst/include/*: Upgraded to new release 4.100.0 of Armadillo * debian/*: Similarly updated for new release to Debian 2014-02-26 Dirk Eddelbuettel * inst/include/*: Updated current Armadillo 4.100 snapshot 2014-02-25 Dirk Eddelbuettel * inst/include/*: Add current Armadillo 4.100 snapshot 2014-02-20 Dirk Eddelbuettel * debian/control: Remove Depends: on littler 2014-02-19 Dirk Eddelbuettel * DESCRIPTION: Release 0.4.000.4 * inst/NEWS: Release 0.4.000.4 * inst/include/*: Upgraded to new release 4.000.4 of Armadillo * debian/*: Similarly updated for new release to Debian 2014-02-08 Dirk Eddelbuettel * src/RcppArmadillo.cpp: Clarify in help page that Armadillo seed setter will not work under RStudio 2014-02-04 Dirk Eddelbuettel * man/*: Add help pages for \code{armadillo_version}, \code{armadillo_set_seed} and \code{armadillo_set_seed_random} * NAMESPACE: Export three helper functions 2014-02-02 Dirk Eddelbuettel * DESCRIPTION: Versioned Imports: on Rcpp (>= 0.11.0) * src/Makevars (PKG_LIBS): Simplified with Rcpp (>= 0.11.0) * src/Makevars.win (PKG_LIBS): Ditto * inst/skeleton/Makevars (PKG_LIBS): Ditto * R/RcppArmadillo.package.skeleton.R: Updated: - no longer set namespace argument (as NAMESPACEs req'ed) - corresponding code updates - reflect Rcpp 0.11.0 * inst/skeleton/rcpparma_hello_world.cpp: Rewritten to use Rcpp Attributes and expanded to included more examples * src/RcppArmadillo.cpp: Add accessor functions to set Armadillo's RNG from a given and a random value as suggested by Gábor Csárdi 2014-01-21 Dirk Eddelbuettel * DESCRIPTION: Release 0.4.000.2 * inst/NEWS: Release 0.4.000.2 * inst/include/*: Upgraded to new release 4.000.2 of Armadillo * debian/*: Similarly updated for new release to Debian 2014-01-07 Dirk Eddelbuettel * inst/include/armadillo_bits/compiler_setup.hpp: Applied one-line patch by Jan Marvin Garbuszu to permit build under recent icc; patch also passed on upstream to Conrad 2014-01-05 Dirk Eddelbuettel * DESCRIPTION: Release 0.4.000 * inst/NEWS: Release 0.4.000 * inst/include/*: Upgraded to new release 4.000 of Armadillo * debian/*: Similarly updated for new release to Debian 2013-12-09 Dirk Eddelbuettel * DESCRIPTION: Release 0.3.930.1 * inst/NEWS: Release 0.3.930.1 * inst/include/*: Upgraded to new release 3.930.1 of Armadillo which falls back to standard complex SVD if no zgesdd * debian/*: Similarly updated for new release to Debian * configure: Test value of LAPACK_LIBS and if the Lapack version supplied by R used then define ARMA_DONT_USE_CX_GESDD * inst/include/RcppArmadilloLapack.h.in: Added header file to be processed by configure 2013-12-06 Dirk Eddelbuettel * DESCRIPTION: Release 0.3.930.0 * inst/NEWS: Release 0.3.930.0 * inst/include/*: Upgraded to new release 3.930 of Armadillo * debian/*: Similarly updated for new release to Debian * inst/include/*: Upgraded to Armadillo 3.930 ("Dragon's Back") * inst/include/armadillo_bits/compiler_setup.hpp: Exclude POSIX memalign also if on Sun OS as per Brian Ripley's suggestion 2013-12-05 Dirk Eddelbuettel * inst/unitTests/runit.complex.R: Added unit tests for complex matrices and vector contributed by Baptiste Auguie * inst/unitTests/cpp/complex.cpp: C++ side of new tests 2013-12-04 Dirk Eddelbuettel * inst/include/*: Upgraded to 2nd beta release of Armadillo 3.930 2013-12-02 Dirk Eddelbuettel * inst/include/*: Upgraded to 1st beta release of Armadillo 3.930 2013-11-19 Dirk Eddelbuettel * DESCRIPTION: Release 0.3.920.3 * inst/NEWS: Release 0.3.920.3 * inst/include/*: Upgraded to new release 3.920.3 of Armadillo * debian/*: Similarly updated for new release to Debian 2013-09-29 Dirk Eddelbuettel * inst/examples/fastLm.r: Added a 'const ref' example * inst/examples/varSimulation.r: Use 'const ref', skip one superfluous transpose 2013-09-28 Dirk Eddelbuettel * DESCRIPTION: Release 0.3.920.1 * inst/NEWS: Release 0.3.920.1 * inst/include/*: Upgraded to new release 3.920.1 of Armadillo * debian/*: Similarly updated for new release to Debian * DESCRIPTION: Depends on Rcpp (>= 0.10.5) which shipped to CRAN 2013-09-27 Romain Francois * include/RcppArmadilloAs.h : handle cx_mat, using that Rcomplex is layout compatible with std::complex * unitTests/cpp/armadillo.cpp : more testing * unitTests/runit.RcppArmadillo.R : more testing 2013-09-23 Dirk Eddelbuettel * inst/include/*: Upgraded to Armadillo pre-release of 3.920.0 * DESCRIPTION: Mark as test release version 0.3.910.0.2 2013-09-15 Dirk Eddelbuettel * inst/include/RcppArmadilloAs.h: Also define ConstInputParameter * inst/include/RcppArmadilloForward.h: Ditto for declaration * inst/unitTests/runit.RcppArmadillo.R: New unit tests for these * inst/unitTests/cpp/armadillo.cpp: C++ code for new unit tests 2013-09-15 Romain Francois * include/RcppArmadilloForward.h : declaration of specializations of ConstReferenceInputParameter and ReferenceInputParameter * include/RcppArmadilloAs.h : definitions of the above 2013-09-13 Romain Francois * DESCRIPTION : require Rcpp 0.10.4.4 * include/RcppArmadilloForward.h : declaration of specializations of InputParameter for references and const reference to arma::Mat * include/RcppArmadilloAs.h : definitions of the above 2013-08-24 Romain Francois * include/RcppArmadilloExtensions/sample.h: added include guard, made functions SampleReplace, etc ... templates to avoid the multiple definitions problem 2013-08-21 Romain Francois * include/RcppArmadilloWrap.h: Less data copies for wrap< SpMat > * include/RcppArmadilloAs.h: Less data copies for as< SpMat > 2013-08-20 Romain Francois * include/RcppArmadilloWrap.h: Handle wrap * include/RcppArmadilloWrap.h: cleaner implementation for wrap< SpMat > * include/RcppArmadilloAs.h: cleaner implementation for as< SpMat > 2013-08-17 Dirk Eddelbuettel * vignettes/RcppArmadillo-intro.Rnw: Converted from LaTeX minted (which farms out to Python's pygmentize) to LaTeX listings (which is plainer, but works on CRAN) * DESCRIPTION: Remove 'BuildVignettes: FALSE' 2013-08-12 Dirk Eddelbuettel * DESCRIPTION: Release 0.3.910.0 * inst/NEWS: Release 0.3.910.0 * inst/include/*: Upgraded to new release 3.910.0 of Armadillo * debian/*: Similarly updated for new release to Debian * vignettes/*: Moved files from inst/doc per new CRAN standards * DESCRIPTION: Set 'BuildVignettes: FALSE' as LaTeX minted mode creates issues for the CRAN builders * inst/doc/*: Include pre-built vignettes 2013-08-03 Dirk Eddelbuettel * inst/include/RcppArmadilloExtensions/spmat.h: Added basic as<> and wrap support for sparse matrices (of class dgCMatrix from the Matrix package); currently only type double is supported * inst/unitTests/runit.RcppArmadillo.R: Improved test setup a little * inst/unitTests/runit.sample.R: Ditto 2013-08-02 Dirk Eddelbuettel * DESCRIPTION: Release 0.3.900.7 * inst/NEWS: Release 0.3.900.7 * inst/include/*: Upgraded to new release 3.900.7 of Armadillo * debian/*: Similarly updated for new release to Debian 2013-08-02 Romain Francois * include/RcppArmadillo/Row_meat.h: set vec_state correctly * include/RcppArmadillo/Col_meat.h: set vec_state correctly * include/RcppArmadillo/Mat_meat.h: set vec_state correctly 2013-07-12 Dirk Eddelbuettel * inst/unitTests/runTests.R: No longer need to test minimal versions of package 'inline' as unit tests now use Rcpp attributes * inst/unitTests/runit.RcppArmadillo.R: Don't load package 'library' * inst/examples/fastLm.r: Also rewritten to use Rcpp attributes * inst/examples/varSimulation.r: Idem * DESCRIPTION: Removed Suggests: on inline 2013-06-04 Dirk Eddelbuettel * DESCRIPTION: Release 0.3.900.0 * inst/NEWS: Release 0.3.900.0 * inst/include/*: Upgraded to new release 3.900.0 of Armadillo * debian/*: Similarly updated for new release to Debian 2013-05-16 Dirk Eddelbuettel * inst/examples/kalman/benchmark.R: Switch from inline to sourceCpp * inst/examples/kalman/Kalman.cpp: Added Rcpp attributes function * inst/examples/kalman/KalmanCpp.R: Retired, no longer used 2013-05-13 Dirk Eddelbuettel * DESCRIPTION: Release 0.3.820 * inst/NEWS: Release 0.3.820 * inst/include/*: Upgraded to new release 3.820 of Armadillo * debian/*: Similarly updated for new release to Debian 2013-04-30 Dirk Eddelbuettel * DESCRIPTION: Release 0.3.810.2 * inst/NEWS: Release 0.3.810.2 * inst/include/*: Upgraded to new release 3.810.2 of Armadillo * debian/*: Similarly updated for new release to Debian 2013-04-19 Dirk Eddelbuettel * DESCRIPTION: Release 0.3.810.0 * inst/NEWS: Release 0.3.810.0 * inst/include/*: Upgraded to new release 3.810.0 of Armadillo * debian/*: Similarly updated for new release to Debian 2013-04-05 Dirk Eddelbuettel * debian/: Package will be added to Debian as well 2013-03-29 Dirk Eddelbuettel * inst/include/RcppArmadilloExtensions/sample.h: Applied another patch by Christian Gunning * inst/unitTests/runit.sample.R (test.sample): Idem 2013-03-12 Dirk Eddelbuettel * DESCRIPTION: Release 0.3.800.1 * inst/include/*: Upgraded to new release 3.800.1 of Armadillo * inst/unitTests/cpp/armadillo.cpp: Factored out of runit.RcppArmadillo.R to accelerate unit test run * inst/unitTests/runit.RcppArmadillo.R: Deploy refactored cpp code 2013-03-11 Dirk Eddelbuettel * inst/unitTests/cpp/sample.cpp: Regrouping C++ tests for sample() * inst/unitTests/runit.sample.R: Rewritten for sole external cpp file 2013-03-10 Dirk Eddelbuettel * inst/include/add-ons/sample.h: Added sample() function contributed by Christian Gunning * inst/unitTests/runit.sample.R: Added unit test for sample() contributed by Christian Gunning 2013-03-01 Dirk Eddelbuettel * DESCRIPTION: Release 0.3.800.0 * DESCRIPTION: Updated Description to reflect change of Armadillo license to MPL 2.0 (which is fully compatible with GPL so no change or net effect to RcppArmadillo) * inst/include/*: Upgraded to new release 3.800.0 of Armadillo * inst/doc/RcppArmadillo-intro.Rnw: Updated vignette to preprint of the Computational Statistics & Data Analysis paper in press * inst/doc/*: Added or updated relevant support files * inst/CITATION: Added with reference to CSDA paper 2013-02-20 Dirk Eddelbuettel * DESCRIPTION: Release 0.3.6.3 * inst/include/*: Upgraded to new release 3.6.3 of Armadillo 2013-01-29 Dirk Eddelbuettel * DESCRIPTION: Release 0.3.6.2 * inst/include/*: Upgraded to new release 3.6.2 of Armadillo 2013-01-19 Dirk Eddelbuettel * inst/examples/kalman/: New example used in the vignette 2012-12-17 Dirk Eddelbuettel * DESCRIPTION: Release 0.3.6.1 * inst/include/*: Upgraded to new release 3.6.1 of Armadillo 2012-12-10 Romain Francois * include/RcppArmadillo.h: compiler error if Rcpp.h is included before RcppArmadillo.h 2012-12-07 Dirk Eddelbuettel * DESCRIPTION: Release 0.3.6.0 * inst/include/*: Upgraded to new release 3.6.0 of Armadillo 2012-11-15 Dirk Eddelbuettel * DESCRIPTION: Release 0.3.4.4 * inst/include/*: Upgraded to new release 3.4.4 of Armadillo 2012-10-04 Dirk Eddelbuettel * DESCRIPTION: Release 0.3.4.3 * inst/include/*: Upgraded to new release 3.4.3 of Armadillo 2012-09-25 Dirk Eddelbuettel * DESCRIPTION: Release 0.3.4.2 * inst/include/*: Upgraded to new release 3.4.2 of Armadillo 2012-09-18 Dirk Eddelbuettel * DESCRIPTION: Release 0.3.4.1 * inst/include/*: Upgraded to new release 3.4.1 of Armadillo 2012-09-06 Dirk Eddelbuettel * DESCRIPTION: Release 0.3.4.0 * inst/include/*: Upgraded to new release 3.4.0 of Armadillo 2012-08-31 Dirk Eddelbuettel * inst/NEWS.Rd: Converted to Rd format 2012-08-30 Dirk Eddelbuettel * DESCRIPTION: Release 0.3.3.91 * inst/include/*: Upgraded to release 3.3.91 (v3.4 beta 1) of Armadillo 2012-07-21 Dirk Eddelbuettel * inst/unitTests/runit.fastLm.R: expanded unit tests for fastLm 2012-07-18 Dirk Eddelbuettel * R/fastLm.R (summary.fastLm): Also display residual standard error 2012-07-14 Dirk Eddelbuettel * R/fastLm.R (fastLm.formula): Note whether intercept in formula or not; also store the result of summary() on residuals * R/fastLm.R (fastLm.default): Autmagically detect intercept use * R/fastLm.R (print.summary.fastLm): Display summary of residuals * R/fastLm.R (summary.fastLm): Distinguish between the intercept and no-intercept cases when computing R^2 2012-07-11 Dirk Eddelbuettel * DESCRIPTION: Release 0.3.2.4 * inst/include/*: Upgraded to new release 3.2.4 of Armadillo 2012-07-01 Dirk Eddelbuettel * DESCRIPTION: Release 0.3.2.3 * inst/include/*: Upgraded to new release 3.2.3 of Armadillo * inst/include/armadillo_bits/: Reverted files {Mat,Col,Row}_bones.hpp to the previous versions due to compilation issues under g++ 4.7 * inst/doc/RcppArmadillo-intro.Rnw: New introductory vignette based on just-submitted paper by Eddelbuettel and Sanderson * DESCRIPTION: Set Maintainer: to edd@debian.org as CRAN prefers to provide upload email from the same address the Maintainer field 2012-05-26 Dirk Eddelbuettel * inst/examples/fastLm.r: Also examine the 'two versus one' casts impact when converting SEXP to Armadillo types 2012-05-21 Dirk Eddelbuettel * DESCRIPTION: Release 0.3.2.0 * inst/include/*: Upgraded to new release 3.2.0 of Armadillo 2012-05-15 Dirk Eddelbuettel * DESCRIPTION: Release 0.3.1.94 * inst/include/*: Upgraded to new (beta) release 3.1.94 of Armadillo 2012-05-10 Dirk Eddelbuettel * DESCRIPTION: Release 0.3.1.92 * inst/include/*: Upgraded to new (beta) release 3.1.92 of Armadillo 2012-05-03 Dirk Eddelbuettel * DESCRIPTION: Release 0.3.0.3 * inst/include/*: Upgraded to new release 3.0.3 of Armadillo 2012-04-29 Dirk Eddelbuettel * inst/examples/fastLm.r: New example fastLm 2012-04-19 Dirk Eddelbuettel * DESCRIPTION: Release 0.3.0.2 * inst/include/*: Upgraded to new release 3.0.2 of Armadillo 2012-04-17 Dirk Eddelbuettel * inst/include/RcppArmadilloConfig.h: Undefine NDEBUG to not suppress Armadillo debug messages 2012-04-12 Dirk Eddelbuettel * DESCRIPTION: Release 0.3.0.1 * inst/include/*: Upgraded to new release 3.0.1 of Armadillo 2012-04-11 Dirk Eddelbuettel * inst/include/RcppArmadilloConfig.h: Protect define of ARMA_DEFAULT_OSTREAM by a #ifndef test 2012-04-10 Dirk Eddelbuettel * DESCRIPTION: Release 0.3.0 * inst/include/*: Upgraded to new release 3.0.0 of Armadillo 2012-04-04 Dirk Eddelbuettel * DESCRIPTION: Release 0.2.40 * inst/include/*: Upgraded to new test release 2.99.4 of Armadillo 2012-04-02 Dirk Eddelbuettel * DESCRIPTION: Release 0.2.39 * inst/include/*: Upgraded to new test release 2.99.3 of Armadillo 2012-03-28 Dirk Eddelbuettel * DESCRIPTION: Release 0.2.38 * inst/include/*: Upgraded to new test release 2.99.2 of Armadillo 2012-03-24 Dirk Eddelbuettel * DESCRIPTION: Release 0.2.37 2012-03-24 Romain Francois * inst/include/RcppArmadilloWrap.h: adapt to Armadillo 2.99.1 2012-03-19 Dirk Eddelbuettel * inst/include/*: Upgraded to new test release 2.99.1 of Armadillo 2012-03-05 Dirk Eddelbuettel * DESCRIPTION: Release 0.2.36 * inst/include/*: Upgraded to new release 2.4.4 of Armadillo 2012-02-17 Dirk Eddelbuettel * DESCRIPTION: Release 0.2.35 (depending on Rcpp 0.9.10) * inst/include/*: Upgraded to new release 2.4.3 of Armadillo 2012-02-01 Romain Francois * inst/include/armadillo_bits/Cube_meat.hpp : changes related to std::cout -> Rcpp::Rcout * inst/include/armadillo_bits/Mat_meat.hpp : idem * inst/include/armadillo_bits/config.hpp : idem * inst/include/armadillo_bits/debug.hpp : idem * inst/include/armadillo_bits/field_meat.hpp : idem * inst/include/armadillo_bits/forward_bones.hpp : idem * DESCRIPTION: depends on Rcpp 0.9.10 2011-12-31 Dirk Eddelbuettel * inst/include/RcppArmadillo/Mat_meat.h: Add missing semicolon in code ifdef'ed for C++0x mode, with thanks to Teo Guo Ci 2011-12-29 Dirk Eddelbuettel * src/RcppArmadillo.cpp: Force instantiation of arma version vars which helps with older OS X compiler, as suggested by Gershon Bialer 2011-12-23 Dirk Eddelbuettel * inst/unitTests/runTests.R: unit tests output 'fallback' directory changed to '..' and files are now in top-level of $pkg.Rcheck/ 2011-12-13 Dirk Eddelbuettel * man/RcppArmadillo-package.Rd: Updated to current version number, added Conrad's Technical Report as a reference 2011-12-12 Dirk Eddelbuettel * DESCRIPTION: Release 0.2.34 * inst/include/*: Upgraded to new release 2.4.2 of Armadillo 2011-12-07 Dirk Eddelbuettel * DESCRIPTION: Release 0.2.33 * inst/include/*: Upgraded to new release 2.4.1 of Armadillo 2011-12-04 Dirk Eddelbuettel * DESCRIPTION: Release 0.2.32 * inst/include/*: Upgraded to new release 2.4.0 of Armadillo 2011-11-28 Dirk Eddelbuettel * DESCRIPTION: Release 0.2.31 * inst/include/*: Upgraded to new test release 2.3.92 of Armadillo 2011-11-19 Dirk Eddelbuettel * DESCRIPTION: Release 0.2.30 2011-11-17 Romain Francois * inst/include/RcppArmadilloSugar.h: reworked forwarding sugar expressions to arma expressions. No need for the "forward" function anymore. For now, we kept forward as a templated identity function for backwards compatibility but it is not needed anymore * inst/include/RcppArmadillo/Mat_meat.h: reworked handling of complex values * inst/unitTests/runit.RcppArmadillo.R: removed uses of forward as we don't need it anymore. 2011-11-16 Romain Francois * inst/include/RcppArmadilloForward.h: support for the new arma classes Gen and GenCube that arma uses internally * inst/include/RcppArmadilloWrap.h: idem * inst/include/RcppArmadillo/Mat_meat.h: adapted to the changed arma_type_check 2011-11-14 Dirk Eddelbuettel * inst/include/*: Upgraded to new test release 2.3.91 of Armadillo 2011-09-01 Dirk Eddelbuettel * DESCRIPTION: Release 0.2.29 * inst/include/*: Updated to bug-fix release 2.2.3 of Armadillo 2011-08-02 Dirk Eddelbuettel * DESCRIPTION: Release 0.2.28 * inst/include/*: Updated to release 2.2.1 of Armadillo 2011-07-22 Dirk Eddelbuettel * DESCRIPTION: Release 0.2.27 * inst/include/*: Updated to release 2.1.91 of Armadillo 2011-07-17 Dirk Eddelbuettel * DESCRIPTION: Release 0.2.26 * inst/include/*: Updated to release 2.0.2 of Armadillo 2011-06-30 Dirk Eddelbuettel * DESCRIPTION: Release 0.2.25 * inst/include/*: Updated to release 2.0.1 of Armadillo 2011-06-29 Dirk Eddelbuettel * DESCRIPTION: Release 0.2.24 * inst/include/*: Updated to release 2.0.0 of Armadillo 2011-06-23 Dirk Eddelbuettel * DESCRIPTION: Release 0.2.23 * inst/include/*: Updated to release 1.99.5 of Armadillo 2011-06-14 Douglas Bates * R/fastLm.R, inst/unitTests/runit.fastLm.R, man/fastLm.Rd, src/fastLm.cpp: Change order of arguments in fastLm.cpp and fastLm.R and documentation. 2011-06-14 Dirk Eddelbuettel * ChangeLog, inst/NEWS: ChangeLog and NEWS entry for Doug's S3 fixes 2011-06-13 Douglas Bates * NAMESPACE: Properly export S3methods as such * man/fastLm.Rd: Similar updates to help page 2011-06-06 Dirk Eddelbuettel * DESCRIPTION: Release 0.2.22 * inst/include/*: Updated to release 1.99.4 of Armadillo 2011-05-30 Dirk Eddelbuettel * inst/include/RcppArmadilloConfig.h: Enable sprintf on FreeBSD by undefining ARMA_HAVE_STD_SNPRINTF thanks to patch by Rainer Hurling 2011-05-27 Dirk Eddelbuettel * DESCRIPTION: Release 0.2.21 * inst/include/*: Updated to release 1.99.3 of Armadillo 2011-05-25 Dirk Eddelbuettel * DESCRIPTION: Release 0.2.20 * inst/include/*: Updated to release 1.99.2 of Armadillo 2011-05-16 Dirk Eddelbuettel * inst/include/*: Updated to test release 1.99.1 of Armadillo 2011-04-25 Dirk Eddelbuettel * src/RcppArmadillo.cpp: Rewritten armadillo_version as to no longer require an instance of arma::arma_version, with Thanks! to Conrad 2011-04-22 Dirk Eddelbuettel * inst/examples/varSimulation.r: New example simulating of first-order vector autoregression data set via R, compiled R and RcppArmadillo 2011-04-18 Dirk Eddelbuettel * DESCRIPTION: Release 0.2.19 * inst/include/*: Updated to Armadillo 1.2.0 "Unscrupulous Carbon Emitter" 2011-04-08 Dirk Eddelbuettel * R/fastLm.R: In print.summary.fastLm(), use 'P.values' not 'P.value' 2011-04-03 Dirk Eddelbuettel * DESCRIPTION: Release 0.2.18 * inst/include/*: Updated to Armadillo 1.1.92 "Jurassic Barbecue" * inst/doc/Makefile: Do not 'clean' in 'all' target 2011-03-22 Dirk Eddelbuettel * DESCRIPTION: Release 0.2.17 * inst/include/*: Updated to Armadillo 1.1.90 "Inside Job" 2011-03-10 Dirk Eddelbuettel * DESCRIPTION: Release 0.2.16 * inst/include/*: Updated to Armadillo 1.1.8 "Kangaroo Steak" 2011-03-04 Dirk Eddelbuettel * DESCRIPTION: Release 0.2.15 * inst/include/*: Updated to Armadillo 1.1.6 “Baby Carpet Shark†2011-03-02 Dirk Eddelbuettel * DESCRIPTION: Release 0.2.14 * inst/include/RcppArmadillo/Row_meat.h: Support RTTI via vec_state * inst/include/RcppArmadillo/Col_meat.h: Support RTTI via vec_state * inst/unitTests/runit.RcppArmadillo.R: Added unit test for above 2011-02-28 Dirk Eddelbuettel * inst/doc/Makefile: Call R and Rscript relative to R_HOME/bin 2011-02-20 Dirk Eddelbuettel * src/fastLm.cpp (fastLm): Further simplified and shortened by using Rcpp::as() on the input data 2011-02-18 Dirk Eddelbuettel * DESCRIPTION: Release 0.2.13 * inst/include/*: Updated to Armadillo 1.1.4 "Manta Lodge" 2011-02-15 Dirk Eddelbuettel * DESCRIPTION: Release 0.2.12 * inst/include/*: Updated to Armadillo 1.1.2 "Flood Kayak" 2011-01-06 Dirk Eddelbuettel * DESCRIPTION: Release 0.2.11 * inst/include/*: Updated to Armadillo 1.1.0 "Climate Vandal" 2010-12-12 Romain Francois * R/SHLIB.R: new unexported R function SHLIB, small wrapper around R CMD SHLIB 2010-11-25 Dirk Eddelbuettel * DESCRIPTION: Release 0.2.10 * inst/include/*: Updated to Armadillo 1.0.0 "Antipodean Antileech†2010-11-19 Dirk Eddelbuettel * R/fastLm.R: Also provide two R-squared measures in summary method 2010-11-19 Romain Francois * DESCRIPTION: remove dependency on GNU make * R/RcppArmadillo.package.skeleton.R: updated skeleton generator so that the dependency on GNU make is removed 2010-11-11 Dirk Eddelbuettel * DESCRIPTION: Release 0.2.9 * inst/include/*: Updated to Armadillo 0.9.92 "Wall Street Gangster" 2010-10-16 Dirk Eddelbuettel * DESCRIPTION: Release 0.2.8 * inst/include/*: Updated to Armadillo 0.9.90 "Water Dragon" * NEWS: moved to inst/NEWS so that it gets installed with the package * inst/ChangeLog: moved to top-level enabling 'C-x 4 a' lookups 2010-09-25 Dirk Eddelbuettel * DESCRIPTION: Release 0.2.7 2010-09-25 Romain Francois * inst/include/RcppArmadilloWrap.h: Updated for Armadillo 0.9.80 2010-09-21 Dirk Eddelbuettel * inst/include/*: Update to Armadillo 0.9.80 "Chihuahua Muncher" 2010-09-12 Dirk Eddelbuettel * DESCRIPTION: Release 0.2.6 2010-09-10 Romain Francois * inst/include/* : Update to Armadillo 0.9.70 "Subtropical Winter Safari" 2010-08-18 Romain Francois * inst/include/armadillo_bits/Mat_meat.hpp : not so intrusive patch that allows RcppArmadillo to add its own Mat constructors * inst/include/armadillo_bits/Mat_proto.hpp : same * inst/include/RcppArmadillo/Mat_proto.h : Mat constructor that takes a sugar expression * inst/include/RcppArmadillo/Mat_meat.h : implementation 2010-08-17 Romain Francois * inst/include/RcppArmadilloWrap.h : extracted from RcppArmadillo.h * inst/include/RcppArmadilloSugar.h : preliminary code to more interoperability between Rcpp sugar and armadillo. Defines the Rcpp::forward that allows forwarding the result of a sugar expression so that it is used in a Mat constructor. (needs more testing) * inst/unitTests/runit.RcppArmadillo.R : initial test for sugar/armadillo 2010-08-04 Dirk Eddelbuettel * DESCRIPTION: Release 0.2.5 * Upgraded to Armadillo 0.9.60 "Killer Bush Turkey" with changes: - More flexible reshape(), allowing significantly different matrix sizes - Added matrix initialisation via the << operator - Fixes for compilation issues under Mac OS X with GCC 4.2/4.0 hybrid 2010-08-03 Romain Francois * Upgraded to Armadillo 0.9.58 beta for testing purposes * inst/include/armadillo: Reworked so that armadillo_bits/ directory can be included as is without minor tweaks to armadillo_bits/config.hpp 2010-07-28 Dirk Eddelbuettel * DESCRIPTION: Release 0.2.4 * inst/include/armadillo_bits: Added small patch to not use asinh, acosh and atanh on win32 as the (older) MinGW compiler cannot cope. This problem will go away once R 2.12 is released as it requires gcc / g++ 4.5. 2010-07-25 Dirk Eddelbuettel * inst/include/* : upgrade to armadillo 0.9.52 "Monkey Wrench" * src/fastLm.cpp: Switch from inv() (which now throws a warning on (near) singular matrices and returns an empty matrix) to the Moore-Penrose pseudo-inverse pinv() which allows us to continue the example from the manual page. Of course, for standard use inv() is doing the right thing by issueing the warning. 2010-06-14 Dirk Eddelbuettel * DESCRIPTION: Release 0.2.3 2010-06-14 Romain Francois * inst/include/RcppArmadilloConfig.h: Addition cconfig helping suncc 2010-06-09 Dirk Eddelbuettel * DESCRIPTION: Release 0.2.2 2010-06-02 Romain Francois * inst/include/* : upgrade to armadillo 0.9.10 * inst/include/* : support for new mtOp and mtGlue, introduced in armadillo 0.9.10 2010-05-27 Romain Francois * R/flags.R: added RcppArmadillo:::CxxFlags() 2010-05-19 Romain Francois * DESCRIPTION: Release 0.2.1 * src/fastLm.cpp: Rename stderr to std_err 2010-05-18 Dirk Eddelbuettel * DESCRIPTION: Release 0.2.0 2010-05-18 Douglas Bates * man/fastLm/Rd: Added rank-deficient example to illustrate possible problems with fastLmPure() and fastLm() * src/fastLm/cpp: Compute sig2 via std::inner_product 2010-05-17 Dirk Eddelbuettel * inst/include/*: updated to Armadillo 0.9.8 2010-05-17 Romain Francois * inst/include/RcppArmadillo.h: workaround for win64 2010-05-13 Dirk Eddelbuettel * R/fastLm.R: fastLm() is now generic and has a formula interface as well as methods for print, summary, predict to behave like a standard model fitting function * R/fastLm.Rd: Added documentation for new methods * src/fastLm.cpp: Small additions to returned parameters to support new functionality 2010-05-04 Romain Francois * R/RcppArmadillo.package.skeleton.R: new package skeleton function similar to Rcpp::Rcpp.package.skeleton but targetting use of RcppArmadillo * README: removed and promoted to additional documentation in ?RcppArmadillo 2010-05-03 Dirk Eddelbuettel * inst/include/* : updated to armadillo 0.9.6 2010-04-03 Dirk Eddelbuettel * DESCRIPTION: Remove OS_type restriction now that RcppArmadillo includes Armadillo headers, add Doug to Authors and Maintainers 2010-04-03 Douglas Bates * inst/include/armadillo: Added the armadillo headers and the armadillo_bits directory. This is from the armadillo sources with only the armadillo_bits/config.hpp file modified. * configure: and many other configuration files. Removed the foo.in files, modified cleanup not to remove the target files. 2010-03-20 Dirk Eddelbuettel * src/fastLm.cpp: Small fix for Armadillo 0.8.2 2010-03-17 Romain Francois * src/fastLm.cpp: added some arma:: prefix * src/RcppArmadillo.cpp: update examples to use make_list and showcase various ways to use them : Named(.)=., _[.] = , Named( ., . ) 2010-03-11 Dirk Eddelbuettel * DESCRIPTION: Release 0.1.0 and initial CRAN upload 2010-03-03 Dirk Eddelbuettel * src/fastLm.cpp: Moved into its own file, some more polish 2010-03-03 Romain Francois * inst/include/RcppArmadillo.h: avoid an extra memory copy when possible (i.e. in wrap( eGlue) and wrap( eOp ) when the elem_type is int or double). * inst/include/RcppArmadilloDefines.in.h added the SCALAR macro to take care of the 0.9.0 api change * src/RcppArmadillo.cpp : fix a runtime error uisng the SCALAR macro 2010-03-02 Dirk Eddelbuettel * src/RcppArmadillo.cpp: Added bare-bones 'fastLm' function * R/fastLm.R: Added fastLm R wrapper for C++ fastLm * man/fastLm.Rd: Added manual page * inst/unitTests/runit.RcppArmadillo.R: Added unit test * NAMESPACE: Made fastLm visible 2010-03-02 Romain Francois * inst/include/RcppArmadillo.h: support for Armadillo 0.9.* 2010-03-01 Dirk Eddelbuettel * configure.in: Add configure support to test for version 0.9.0 2010-02-23 Romain Francois * inst/include/RcppArmadillo.h: support for wrap( arma::Glue ) and wrap( arma::Op ) enabling wrap()'ing arbitrary expressions involving arma::Mat objects, for example wrap( m1 + m2 ), or wrap( -m1 ) * inst/unitTests/runit.RcppArmadillo.R: new unit test for wrap( Glue ) and wrap( Op ) 2010-02-20 Dirk Eddelbuettel * configure.in: Add configure support to test for presence of 'armadillo' header and working 'libarmadillo' library; and a test for version 0.7.0 or higher (for Cube() type) * src/Makevars.in: Setup to be filled-in from configure * src/RcppArmadilloDefines.h.in: Idem * cleanup: Added to remove configure-generated files * R/flags.R: Small cleanups * src/RcppArmadillo.h: Use the #define ARMA_HAS_CUBE from the autogenerated header, reindent using Emacs' defaults 2010-02-19 Dirk Eddelbuettel * DESCRIPTION: Restrict to 'OS_type: unix' for now, set Date: as an SVN property 2010-02-19 Romain Francois * added support for field where T is wrappable 2010-02-17 Romain Francois * added support for as> as> and as> with T in : int, double, float, unsigned int * added untested support for wrap( Cube ) 2010-02-16 Dirk Eddelbuettel * Initial package structure based on first proof-of-concept 2010-02-16 Romain Francois * initial version, covering wrap(Mat), wrap(Col), wrap(Row) RcppArmadillo/NAMESPACE0000644000176200001440000000146014520330720014217 0ustar liggesusersuseDynLib("RcppArmadillo", .registration=TRUE) importFrom("Rcpp", "evalCpp", "sourceCpp") importFrom("stats", "coef", "fitted", "model.frame", "model.matrix", "model.response", "printCoefmat", "pt") importFrom("utils", "packageDescription", "package.skeleton") importFrom("methods", "new") export("fastLmPure", "fastLm", "RcppArmadillo.package.skeleton", "armadillo_version", "armadillo_set_seed", "armadillo_set_seed_random", "armadillo_throttle_cores", "armadillo_reset_cores", "armadillo_get_number_of_omp_threads", "armadillo_set_number_of_omp_threads" ) S3method("fastLm", "default") S3method("fastLm", "formula") S3method("predict", "fastLm") S3method("print", "fastLm") S3method("summary", "fastLm") S3method("print", "summary.fastLm") RcppArmadillo/configure.ac0000644000176200001440000001572015031230367015276 0ustar liggesusers ## RcppArmadillo configure.ac ## ## 'Rcpp' Integration for the 'Armadillo' Templated Linear Algebra Library ## ## Copyright (C) 2016 - 2025 Dirk Eddelbuettel ## ## Licensed under GPL-2 or later ## require at least autoconf 2.69 AC_PREREQ([2.69]) ## Process this file with autoconf to produce a configure script. AC_INIT([RcppArmadillo],[14.6.0-1],[edd@debian.org]) ## Set R_HOME, respecting an environment variable if one is set : ${R_HOME=$(R RHOME)} if test -z "${R_HOME}"; then AC_MSG_ERROR([Could not determine R_HOME.]) fi ## Use R to set CXX and CXXFLAGS CXX=$(${R_HOME}/bin/R CMD config CXX) CXXFLAGS=$("${R_HOME}/bin/R" CMD config CXXFLAGS) ## We are using C++ AC_LANG(C++) AC_REQUIRE_CPP AC_PROG_CXX ## Is R already configured to compile things using OpenMP without ## any extra hand-holding? openmp_already_works="no" ## default to not even thinking about OpenMP as Armadillo wants a pragma ## variant available if and only if C++11 is used with g++ 5.4 or newer can_use_openmp="no" ## Ensure TMPDIR is set. AC_MSG_CHECKING([whether we have a suitable tempdir]) TMPDIR=$("${R_HOME}/bin/R" --vanilla --slave -e "cat(dirname(tempdir()))") AC_MSG_RESULT([${TMPDIR}]) ## Check if R is configured to compile programs using OpenMP out-of-the-box. AC_MSG_CHECKING([whether R CMD SHLIB can already compile programs using OpenMP]) ## Create private directory in TMPDIR. BUILDDIR="${TMPDIR}/rcpparmadillo-$$-$RANDOM" mkdir -p "${BUILDDIR}" owd=$(pwd) cd "${BUILDDIR}" cat < test-omp.cpp #include int main() { return omp_get_num_threads(); } EOF ## Execute R CMD SHLIB. "${R_HOME}/bin/R" CMD SHLIB test-omp.cpp >/dev/null 2>&1 if test x"$?" = x"0"; then AC_MSG_RESULT([yes]) openmp_already_works="yes" else AC_MSG_RESULT([no]) fi ## Go back home. cd "${owd}" rm -rf "${BUILDDIR}" ## If the above checks failed, then perform other heuristics ## based on the compiler version, etc. if test x"${openmp_already_works}" = x"no"; then ## Check the C++ compiler using the CXX value set ## If it is g++, we have GXX set so let's examine it if test "${GXX}" = yes; then AC_MSG_CHECKING([whether g++ version is sufficient]) gxx_version=$(${CXX} -v 2>&1 | awk '/^.*g.. version/ {print $3}') case ${gxx_version} in 1.*|2.*|3.*|4.0.*|4.1.*|4.2.*|4.3.*|4.4.*|4.5.*|4.6.*|4.7.0|4.7.1) AC_MSG_RESULT([no]) AC_MSG_WARN([Only g++ version 4.7.2 or greater can be used with RcppArmadillo.]) AC_MSG_ERROR([Please use a different compiler.]) ;; 4.7.*|4.8.*|4.9.*|5.0*|5.1*|5.2*|5.3*) AC_MSG_RESULT([yes, but without OpenMP as version ${gxx_version} (Armadillo constraint)]) ## we know this one is bad can_use_openmp="no" ;; 5.4*|5.5*|5.6*|5.7*|5.8*|5.9*|6.*|7.*|8.*|9.*|10.*|11.*|12.*) AC_MSG_RESULT([yes, with OpenMP as version ${gxx_version}]) ## we know this one is good, yay can_use_openmp="yes" ;; *) AC_MSG_RESULT([almost]) AC_MSG_WARN([Compiler self-identifies as being compliant with GNUC extensions but is not g++.]) ## we know nothing, so no can_use_openmp="no" ;; esac fi ## Check for Apple LLVM AC_MSG_CHECKING([for macOS]) RSysinfoName=$("${R_HOME}/bin/Rscript" --vanilla -e 'cat(Sys.info()[["sysname"]])') if test x"${RSysinfoName}" = x"Darwin"; then AC_MSG_RESULT([found]) AC_MSG_CHECKING([for macOS Apple compiler]) apple_compiler=$($CXX --version 2>&1 | grep -i -c -e 'apple llvm') if test x"${apple_compiler}" = x"1"; then AC_MSG_RESULT([found]) AC_MSG_WARN([OpenMP unavailable and turned off.]) can_use_openmp="no" else AC_MSG_RESULT([not found]) AC_MSG_CHECKING([for clang compiler]) clang_compiler=$($CXX --version 2>&1 | grep -i -c -e 'clang ') if test x"${clang_compiler}" = x"1"; then AC_MSG_RESULT([found]) AC_MSG_CHECKING([for OpenMP compatible version of clang]) clang_version=$(${CXX} -v 2>&1 | awk '/^.*clang version/ {print $3}') case ${clang_version} in 4.*|5.*|6.*|7.*|8.*|9.*|10.*|11.*) AC_MSG_RESULT([found and suitable]) can_use_openmp="yes" ;; *) AC_MSG_RESULT([not found]) AC_MSG_WARN([OpenMP unavailable and turned off.]) can_use_openmp="no" ;; esac else AC_MSG_RESULT([not found]) AC_MSG_WARN([unsupported macOS build detected; if anything breaks, you keep the pieces.]) fi fi else AC_MSG_RESULT([no]) fi fi # if test x"${openmp_already_works}" = x"no" ## Check for suitable LAPACK_LIBS AC_MSG_CHECKING([LAPACK_LIBS]) ## external LAPACK has the required function lapack=$(${R_HOME}/bin/R CMD config LAPACK_LIBS) hasRlapack=$(echo ${lapack} | grep lRlapack) ## in what follows below we substitute both side of the define/undef ## while this may seem a little unusual we do it to fully reproduce the ## previous bash-based implementation if test x"${hasRlapack}" = x""; then ## We are using a full Lapack and can use zgbsv -- so #undef remains AC_MSG_RESULT([system LAPACK found]) arma_lapack="#undef ARMA_CRIPPLED_LAPACK" else ## We are using R's subset of Lapack and CANNOT use zgbsv etc, so we mark it AC_MSG_RESULT([R-supplied partial LAPACK found]) AC_MSG_WARN([Some complex-valued LAPACK functions may not be available]) arma_lapack="#define ARMA_CRIPPLED_LAPACK 1" fi ## Default the OpenMP flag to the empty string. ## If and only if OpenMP is found, expand to $(SHLIB_OPENMP_CXXFLAGS) openmp_flag="" ## Set the fallback, by default it is nope arma_have_openmp="#define ARMA_DONT_USE_OPENMP 1" if test x"${openmp_already_works}" = x"yes"; then arma_have_openmp="#define ARMA_USE_OPENMP 1" openmp_flag='$(SHLIB_OPENMP_CXXFLAGS)' fi if test x"${can_use_openmp}" = x"yes"; then AC_MSG_CHECKING([for OpenMP]) ## if R has -fopenmp we should be good allldflags=$(${R_HOME}/bin/R CMD config --ldflags) hasOpenMP=$(echo ${allldflags} | grep -- -fopenmp) if test x"${hasOpenMP}" = x""; then AC_MSG_RESULT([missing]) arma_have_openmp="#define ARMA_DONT_USE_OPENMP 1" else AC_MSG_RESULT([found and suitable]) arma_have_openmp="#define ARMA_USE_OPENMP 1" openmp_flag='$(SHLIB_OPENMP_CXXFLAGS)' fi fi ## now use all these AC_SUBST([ARMA_LAPACK],["${arma_lapack}"]) AC_SUBST([ARMA_HAVE_OPENMP], ["${arma_have_openmp}"]) AC_SUBST([OPENMP_FLAG], ["${openmp_flag}"]) AC_CONFIG_FILES([inst/include/RcppArmadillo/config/RcppArmadilloConfigGenerated.h src/Makevars]) AC_OUTPUT RcppArmadillo/inst/0000755000176200001440000000000015031230427013755 5ustar liggesusersRcppArmadillo/inst/AUTHORS0000644000176200001440000000124013123245425015026 0ustar liggesusers Armadillo itself carries the following in file NOTICE.TXT: Armadillo C++ Linear Algebra Library Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) Copyright 2008-2016 National ICT Australia (NICTA) This product includes software developed by Conrad Sanderson (http://conradsanderson.id.au) This product includes software developed at National ICT Australia (NICTA) The RcppArmadillo package integrates Armadillo into R, provides wrappers, converters, a test framework, examples and more. It was written by Dirk Eddelbuettel, Romain Francois and Doug Bates with contributions by many others as detailed in the ChangeLog file. RcppArmadillo/inst/include/0000755000176200001440000000000015030514741015403 5ustar liggesusersRcppArmadillo/inst/include/README0000644000176200001440000000035012253723621016264 0ustar liggesusersto upgrade to a new release of armadillo: - copy the armadillo file here - replace the armadillo_bits directory by the one from the armadillo source - ignore (or remove) armadillo_bits/config.hpp.cmake as we do not configuration RcppArmadillo/inst/include/armadillo_bits/0000755000176200001440000000000015031230427020365 5ustar liggesusersRcppArmadillo/inst/include/armadillo_bits/spglue_join_meat.hpp0000644000176200001440000002417114631567470024447 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup spglue_join //! @{ template inline void spglue_join_cols::apply(SpMat& out, const SpGlue& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const unwrap_spmat UA(X.A); const unwrap_spmat UB(X.B); if(UA.is_alias(out) || UB.is_alias(out)) { SpMat tmp; spglue_join_cols::apply_noalias(tmp, UA.M, UB.M); out.steal_mem(tmp); } else { spglue_join_cols::apply_noalias(out, UA.M, UB.M); } } template inline void spglue_join_cols::apply_noalias(SpMat& out, const SpMat& A, const SpMat& B) { arma_debug_sigprint(); const uword A_n_rows = A.n_rows; const uword A_n_cols = A.n_cols; const uword B_n_rows = B.n_rows; const uword B_n_cols = B.n_cols; arma_conform_check ( ( (A_n_cols != B_n_cols) && ( (A_n_rows > 0) || (A_n_cols > 0) ) && ( (B_n_rows > 0) || (B_n_cols > 0) ) ), "join_cols() / join_vert(): number of columns must be the same" ); out.set_size( A_n_rows + B_n_rows, (std::max)(A_n_cols, B_n_cols) ); if( out.n_elem > 0 ) { if(A.is_empty() == false) { out.submat(0, 0, A_n_rows-1, out.n_cols-1) = A; } if(B.is_empty() == false) { out.submat(A_n_rows, 0, out.n_rows-1, out.n_cols-1) = B; } } } template inline void spglue_join_cols::apply(SpMat& out, const SpBase& A_expr, const SpBase& B_expr, const SpBase& C_expr) { arma_debug_sigprint(); const unwrap_spmat UA(A_expr.get_ref()); const unwrap_spmat UB(B_expr.get_ref()); const unwrap_spmat UC(C_expr.get_ref()); const SpMat& A = UA.M; const SpMat& B = UB.M; const SpMat& C = UC.M; const uword out_n_rows = A.n_rows + B.n_rows + C.n_rows; const uword out_n_cols = (std::max)((std::max)(A.n_cols, B.n_cols), C.n_cols); arma_conform_check( ((A.n_cols != out_n_cols) && ((A.n_rows > 0) || (A.n_cols > 0))), "join_cols() / join_vert(): number of columns must be the same" ); arma_conform_check( ((B.n_cols != out_n_cols) && ((B.n_rows > 0) || (B.n_cols > 0))), "join_cols() / join_vert(): number of columns must be the same" ); arma_conform_check( ((C.n_cols != out_n_cols) && ((C.n_rows > 0) || (C.n_cols > 0))), "join_cols() / join_vert(): number of columns must be the same" ); out.set_size(out_n_rows, out_n_cols); if(out.n_elem == 0) { return; } uword row_start = 0; uword row_end_p1 = 0; if(A.n_elem > 0) { row_end_p1 += A.n_rows; out.rows(row_start, row_end_p1 - 1) = A; } row_start = row_end_p1; if(B.n_elem > 0) { row_end_p1 += B.n_rows; out.rows(row_start, row_end_p1 - 1) = B; } row_start = row_end_p1; if(C.n_elem > 0) { row_end_p1 += C.n_rows; out.rows(row_start, row_end_p1 - 1) = C; } } template inline void spglue_join_cols::apply(SpMat& out, const SpBase& A_expr, const SpBase& B_expr, const SpBase& C_expr, const SpBase& D_expr) { arma_debug_sigprint(); const unwrap_spmat UA(A_expr.get_ref()); const unwrap_spmat UB(B_expr.get_ref()); const unwrap_spmat UC(C_expr.get_ref()); const unwrap_spmat UD(D_expr.get_ref()); const SpMat& A = UA.M; const SpMat& B = UB.M; const SpMat& C = UC.M; const SpMat& D = UD.M; const uword out_n_rows = A.n_rows + B.n_rows + C.n_rows + D.n_rows; const uword out_n_cols = (std::max)(((std::max)((std::max)(A.n_cols, B.n_cols), C.n_cols)), D.n_cols); arma_conform_check( ((A.n_cols != out_n_cols) && ((A.n_rows > 0) || (A.n_cols > 0))), "join_cols() / join_vert(): number of columns must be the same" ); arma_conform_check( ((B.n_cols != out_n_cols) && ((B.n_rows > 0) || (B.n_cols > 0))), "join_cols() / join_vert(): number of columns must be the same" ); arma_conform_check( ((C.n_cols != out_n_cols) && ((C.n_rows > 0) || (C.n_cols > 0))), "join_cols() / join_vert(): number of columns must be the same" ); arma_conform_check( ((D.n_cols != out_n_cols) && ((D.n_rows > 0) || (D.n_cols > 0))), "join_cols() / join_vert(): number of columns must be the same" ); out.set_size(out_n_rows, out_n_cols); if(out.n_elem == 0) { return; } uword row_start = 0; uword row_end_p1 = 0; if(A.n_elem > 0) { row_end_p1 += A.n_rows; out.rows(row_start, row_end_p1 - 1) = A; } row_start = row_end_p1; if(B.n_elem > 0) { row_end_p1 += B.n_rows; out.rows(row_start, row_end_p1 - 1) = B; } row_start = row_end_p1; if(C.n_elem > 0) { row_end_p1 += C.n_rows; out.rows(row_start, row_end_p1 - 1) = C; } row_start = row_end_p1; if(D.n_elem > 0) { row_end_p1 += D.n_rows; out.rows(row_start, row_end_p1 - 1) = D; } } template inline void spglue_join_rows::apply(SpMat& out, const SpGlue& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const unwrap_spmat UA(X.A); const unwrap_spmat UB(X.B); if(UA.is_alias(out) || UB.is_alias(out)) { SpMat tmp; spglue_join_rows::apply_noalias(tmp, UA.M, UB.M); out.steal_mem(tmp); } else { spglue_join_rows::apply_noalias(out, UA.M, UB.M); } } template inline void spglue_join_rows::apply_noalias(SpMat& out, const SpMat& A, const SpMat& B) { arma_debug_sigprint(); const uword A_n_rows = A.n_rows; const uword A_n_cols = A.n_cols; const uword A_n_nz = A.n_nonzero; const uword B_n_rows = B.n_rows; const uword B_n_cols = B.n_cols; const uword B_n_nz = B.n_nonzero; arma_conform_check ( ( (A_n_rows != B.n_rows) && ( (A_n_rows > 0) || (A_n_cols > 0) ) && ( (B_n_rows > 0) || (B_n_cols > 0) ) ), "join_rows() / join_horiz(): number of rows must be the same" ); const uword C_n_rows = (std::max)(A_n_rows, B_n_rows); const uword C_n_cols = A_n_cols + B_n_cols; const uword C_n_nz = A_n_nz + B_n_nz; if( ((C_n_rows * C_n_cols) == 0) || (C_n_nz == 0) ) { out.zeros(C_n_rows, C_n_cols); return; } out.reserve(C_n_rows, C_n_cols, C_n_nz); arrayops::copy( access::rwp(out.values), A.values, A_n_nz ); arrayops::copy( access::rwp(out.values) + A_n_nz, B.values, B_n_nz+1 ); arrayops::copy( access::rwp(out.row_indices), A.row_indices, A_n_nz ); arrayops::copy( access::rwp(out.row_indices) + A_n_nz, B.row_indices, B_n_nz+1 ); arrayops::copy( access::rwp(out.col_ptrs), A.col_ptrs, A_n_cols ); arrayops::copy( access::rwp(out.col_ptrs) + A_n_cols, B.col_ptrs, B_n_cols+2 ); arrayops::inplace_plus( access::rwp(out.col_ptrs) + A_n_cols, A_n_nz, B_n_cols+1 ); // // OLD METHOD // // umat locs(2, C_n_nz, arma_nozeros_indicator()); // Col vals( C_n_nz, arma_nozeros_indicator()); // // uword* locs_mem = locs.memptr(); // eT* vals_mem = vals.memptr(); // // typename SpMat::const_iterator A_it = A.begin(); // // for(uword i=0; i < A_n_nz; ++i) // { // const uword row = A_it.row(); // const uword col = A_it.col(); // // (*locs_mem) = row; locs_mem++; // (*locs_mem) = col; locs_mem++; // // (*vals_mem) = (*A_it); vals_mem++; // // ++A_it; // } // // typename SpMat::const_iterator B_it = B.begin(); // // for(uword i=0; i < B_n_nz; ++i) // { // const uword row = B_it.row(); // const uword col = A_n_cols + B_it.col(); // // (*locs_mem) = row; locs_mem++; // (*locs_mem) = col; locs_mem++; // // (*vals_mem) = (*B_it); vals_mem++; // // ++B_it; // } // // // TODO: the first element of B within C will always have a larger index than the last element of A in C; // // TODO: so, is sorting really necessary here? // SpMat tmp(locs, vals, C_n_rows, C_n_cols, true, false); // // out.steal_mem(tmp); } template inline void spglue_join_rows::apply(SpMat& out, const SpBase& A_expr, const SpBase& B_expr, const SpBase& C_expr) { arma_debug_sigprint(); const unwrap_spmat UA(A_expr.get_ref()); const unwrap_spmat UB(B_expr.get_ref()); const unwrap_spmat UC(C_expr.get_ref()); const SpMat& A = UA.M; const SpMat& B = UB.M; const SpMat& C = UC.M; SpMat tmp; spglue_join_rows::apply_noalias(tmp, A, B); spglue_join_rows::apply_noalias(out, tmp, C); } template inline void spglue_join_rows::apply(SpMat& out, const SpBase& A_expr, const SpBase& B_expr, const SpBase& C_expr, const SpBase& D_expr) { arma_debug_sigprint(); const unwrap_spmat UA(A_expr.get_ref()); const unwrap_spmat UB(B_expr.get_ref()); const unwrap_spmat UC(C_expr.get_ref()); const unwrap_spmat UD(D_expr.get_ref()); const SpMat& A = UA.M; const SpMat& B = UB.M; const SpMat& C = UC.M; const SpMat& D = UD.M; SpMat AB; SpMat ABC; spglue_join_rows::apply_noalias(AB, A, B); spglue_join_rows::apply_noalias(ABC, AB, C); spglue_join_rows::apply_noalias(out, ABC, D); } //! @} RcppArmadillo/inst/include/armadillo_bits/def_arpack.hpp0000644000176200001440000002503514301267043023165 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ #if defined(ARMA_USE_ARPACK) // I'm not sure this is necessary. #if !defined(ARMA_BLAS_CAPITALS) #define arma_snaupd snaupd #define arma_dnaupd dnaupd #define arma_cnaupd cnaupd #define arma_znaupd znaupd #define arma_sneupd sneupd #define arma_dneupd dneupd #define arma_cneupd cneupd #define arma_zneupd zneupd #define arma_ssaupd ssaupd #define arma_dsaupd dsaupd #define arma_sseupd sseupd #define arma_dseupd dseupd #else #define arma_snaupd SNAUPD #define arma_dnaupd DNAUPD #define arma_cnaupd CNAUPD #define arma_znaupd ZNAUPD #define arma_sneupd SNEUPD #define arma_dneupd DNEUPD #define arma_cneupd CNEUPD #define arma_zneupd ZNEUPD #define arma_ssaupd SSAUPD #define arma_dsaupd DSAUPD #define arma_sseupd SSEUPD #define arma_dseupd DSEUPD #endif extern "C" { #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) // eigendecomposition of non-symmetric positive semi-definite matrices void arma_fortran(arma_snaupd)(blas_int* ido, char* bmat, blas_int* n, char* which, blas_int* nev, float* tol, float* resid, blas_int* ncv, float* v, blas_int* ldv, blas_int* iparam, blas_int* ipntr, float* workd, float* workl, blas_int* lworkl, blas_int* info, blas_len bmat_len, blas_len which_len); void arma_fortran(arma_dnaupd)(blas_int* ido, char* bmat, blas_int* n, char* which, blas_int* nev, double* tol, double* resid, blas_int* ncv, double* v, blas_int* ldv, blas_int* iparam, blas_int* ipntr, double* workd, double* workl, blas_int* lworkl, blas_int* info, blas_len bmat_len, blas_len which_len); void arma_fortran(arma_cnaupd)(blas_int* ido, char* bmat, blas_int* n, char* which, blas_int* nev, float* tol, void* resid, blas_int* ncv, void* v, blas_int* ldv, blas_int* iparam, blas_int* ipntr, void* workd, void* workl, blas_int* lworkl, float* rwork, blas_int* info, blas_len bmat_len, blas_len which_len); void arma_fortran(arma_znaupd)(blas_int* ido, char* bmat, blas_int* n, char* which, blas_int* nev, double* tol, void* resid, blas_int* ncv, void* v, blas_int* ldv, blas_int* iparam, blas_int* ipntr, void* workd, void* workl, blas_int* lworkl, double* rwork, blas_int* info, blas_len bmat_len, blas_len which_len); // recovery of eigenvectors after naupd(); uses blas_int for LOGICAL types void arma_fortran(arma_sneupd)(blas_int* rvec, char* howmny, blas_int* select, float* dr, float* di, float* z, blas_int* ldz, float* sigmar, float* sigmai, float* workev, char* bmat, blas_int* n, char* which, blas_int* nev, float* tol, float* resid, blas_int* ncv, float* v, blas_int* ldv, blas_int* iparam, blas_int* ipntr, float* workd, float* workl, blas_int* lworkl, blas_int* info, blas_len howmny_len, blas_len bmat_len, blas_len which_len); void arma_fortran(arma_dneupd)(blas_int* rvec, char* howmny, blas_int* select, double* dr, double* di, double* z, blas_int* ldz, double* sigmar, double* sigmai, double* workev, char* bmat, blas_int* n, char* which, blas_int* nev, double* tol, double* resid, blas_int* ncv, double* v, blas_int* ldv, blas_int* iparam, blas_int* ipntr, double* workd, double* workl, blas_int* lworkl, blas_int* info, blas_len howmny_len, blas_len bmat_len, blas_len which_len); void arma_fortran(arma_cneupd)(blas_int* rvec, char* howmny, blas_int* select, void* d, void* z, blas_int* ldz, void* sigma, void* workev, char* bmat, blas_int* n, char* which, blas_int* nev, float* tol, void* resid, blas_int* ncv, void* v, blas_int* ldv, blas_int* iparam, blas_int* ipntr, void* workd, void* workl, blas_int* lworkl, float* rwork, blas_int* info, blas_len howmny_len, blas_len bmat_len, blas_len which_len); void arma_fortran(arma_zneupd)(blas_int* rvec, char* howmny, blas_int* select, void* d, void* z, blas_int* ldz, void* sigma, void* workev, char* bmat, blas_int* n, char* which, blas_int* nev, double* tol, void* resid, blas_int* ncv, void* v, blas_int* ldv, blas_int* iparam, blas_int* ipntr, void* workd, void* workl, blas_int* lworkl, double* rwork, blas_int* info, blas_len howmny_len, blas_len bmat_len, blas_len which_len); // eigendecomposition of symmetric positive semi-definite matrices void arma_fortran(arma_ssaupd)(blas_int* ido, char* bmat, blas_int* n, char* which, blas_int* nev, float* tol, float* resid, blas_int* ncv, float* v, blas_int* ldv, blas_int* iparam, blas_int* ipntr, float* workd, float* workl, blas_int* lworkl, blas_int* info, blas_len bmat_len, blas_len which_len); void arma_fortran(arma_dsaupd)(blas_int* ido, char* bmat, blas_int* n, char* which, blas_int* nev, double* tol, double* resid, blas_int* ncv, double* v, blas_int* ldv, blas_int* iparam, blas_int* ipntr, double* workd, double* workl, blas_int* lworkl, blas_int* info, blas_len bmat_len, blas_len which_len); // recovery of eigenvectors after saupd(); uses blas_int for LOGICAL types void arma_fortran(arma_sseupd)(blas_int* rvec, char* howmny, blas_int* select, float* d, float* z, blas_int* ldz, float* sigma, char* bmat, blas_int* n, char* which, blas_int* nev, float* tol, float* resid, blas_int* ncv, float* v, blas_int* ldv, blas_int* iparam, blas_int* ipntr, float* workd, float* workl, blas_int* lworkl, blas_int* info, blas_len howmny_len, blas_len bmat_len, blas_len which_len); void arma_fortran(arma_dseupd)(blas_int* rvec, char* howmny, blas_int* select, double* d, double* z, blas_int* ldz, double* sigma, char* bmat, blas_int* n, char* which, blas_int* nev, double* tol, double* resid, blas_int* ncv, double* v, blas_int* ldv, blas_int* iparam, blas_int* ipntr, double* workd, double* workl, blas_int* lworkl, blas_int* info, blas_len howmny_len, blas_len bmat_len, blas_len which_len); #else // eigendecomposition of non-symmetric positive semi-definite matrices void arma_fortran(arma_snaupd)(blas_int* ido, char* bmat, blas_int* n, char* which, blas_int* nev, float* tol, float* resid, blas_int* ncv, float* v, blas_int* ldv, blas_int* iparam, blas_int* ipntr, float* workd, float* workl, blas_int* lworkl, blas_int* info); void arma_fortran(arma_dnaupd)(blas_int* ido, char* bmat, blas_int* n, char* which, blas_int* nev, double* tol, double* resid, blas_int* ncv, double* v, blas_int* ldv, blas_int* iparam, blas_int* ipntr, double* workd, double* workl, blas_int* lworkl, blas_int* info); void arma_fortran(arma_cnaupd)(blas_int* ido, char* bmat, blas_int* n, char* which, blas_int* nev, float* tol, void* resid, blas_int* ncv, void* v, blas_int* ldv, blas_int* iparam, blas_int* ipntr, void* workd, void* workl, blas_int* lworkl, float* rwork, blas_int* info); void arma_fortran(arma_znaupd)(blas_int* ido, char* bmat, blas_int* n, char* which, blas_int* nev, double* tol, void* resid, blas_int* ncv, void* v, blas_int* ldv, blas_int* iparam, blas_int* ipntr, void* workd, void* workl, blas_int* lworkl, double* rwork, blas_int* info); // recovery of eigenvectors after naupd(); uses blas_int for LOGICAL types void arma_fortran(arma_sneupd)(blas_int* rvec, char* howmny, blas_int* select, float* dr, float* di, float* z, blas_int* ldz, float* sigmar, float* sigmai, float* workev, char* bmat, blas_int* n, char* which, blas_int* nev, float* tol, float* resid, blas_int* ncv, float* v, blas_int* ldv, blas_int* iparam, blas_int* ipntr, float* workd, float* workl, blas_int* lworkl, blas_int* info); void arma_fortran(arma_dneupd)(blas_int* rvec, char* howmny, blas_int* select, double* dr, double* di, double* z, blas_int* ldz, double* sigmar, double* sigmai, double* workev, char* bmat, blas_int* n, char* which, blas_int* nev, double* tol, double* resid, blas_int* ncv, double* v, blas_int* ldv, blas_int* iparam, blas_int* ipntr, double* workd, double* workl, blas_int* lworkl, blas_int* info); void arma_fortran(arma_cneupd)(blas_int* rvec, char* howmny, blas_int* select, void* d, void* z, blas_int* ldz, void* sigma, void* workev, char* bmat, blas_int* n, char* which, blas_int* nev, float* tol, void* resid, blas_int* ncv, void* v, blas_int* ldv, blas_int* iparam, blas_int* ipntr, void* workd, void* workl, blas_int* lworkl, float* rwork, blas_int* info); void arma_fortran(arma_zneupd)(blas_int* rvec, char* howmny, blas_int* select, void* d, void* z, blas_int* ldz, void* sigma, void* workev, char* bmat, blas_int* n, char* which, blas_int* nev, double* tol, void* resid, blas_int* ncv, void* v, blas_int* ldv, blas_int* iparam, blas_int* ipntr, void* workd, void* workl, blas_int* lworkl, double* rwork, blas_int* info); // eigendecomposition of symmetric positive semi-definite matrices void arma_fortran(arma_ssaupd)(blas_int* ido, char* bmat, blas_int* n, char* which, blas_int* nev, float* tol, float* resid, blas_int* ncv, float* v, blas_int* ldv, blas_int* iparam, blas_int* ipntr, float* workd, float* workl, blas_int* lworkl, blas_int* info); void arma_fortran(arma_dsaupd)(blas_int* ido, char* bmat, blas_int* n, char* which, blas_int* nev, double* tol, double* resid, blas_int* ncv, double* v, blas_int* ldv, blas_int* iparam, blas_int* ipntr, double* workd, double* workl, blas_int* lworkl, blas_int* info); // recovery of eigenvectors after saupd(); uses blas_int for LOGICAL types void arma_fortran(arma_sseupd)(blas_int* rvec, char* howmny, blas_int* select, float* d, float* z, blas_int* ldz, float* sigma, char* bmat, blas_int* n, char* which, blas_int* nev, float* tol, float* resid, blas_int* ncv, float* v, blas_int* ldv, blas_int* iparam, blas_int* ipntr, float* workd, float* workl, blas_int* lworkl, blas_int* info); void arma_fortran(arma_dseupd)(blas_int* rvec, char* howmny, blas_int* select, double* d, double* z, blas_int* ldz, double* sigma, char* bmat, blas_int* n, char* which, blas_int* nev, double* tol, double* resid, blas_int* ncv, double* v, blas_int* ldv, blas_int* iparam, blas_int* ipntr, double* workd, double* workl, blas_int* lworkl, blas_int* info); #endif } #endif RcppArmadillo/inst/include/armadillo_bits/Proxy.hpp0000644000176200001440000026672414752446051022253 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup Proxy //! @{ // within each specialisation of the Proxy class: // // elem_type = type of the elements obtained from object Q // pod_type = underlying type of elements if elem_type is std::complex // stored_type = type of Q object // ea_type = type of object that provides access to elements via operator[i] // aligned_ea_type = type of object that provides access to elements via at_alt(i) // // use_at = boolean to indicate at(row,col) must be used to get elements // use_mp = boolean to indicate OpenMP can be used while processing elements // has_subview = boolean to indicate Q object has a subview // // is_row = boolean to indicate Q object can be treated a row vector // is_col = boolean to indicate Q object can be treated a column vector // is_xvec = boolean to indicate Q object is a vector with unknown orientation // // Q = object that can be unwrapped via unwrap family of classes (ie. Q must be convertible to Mat) // // get_n_rows() = return number of rows in Q // get_n_cols() = return number of columns in Q // get_n_elem() = return number of elements in Q // // operator[i] = linear element accessor; valid only if 'use_at' boolean is false // at(row,col) = access elements via (row,col); valid only if 'use_at' boolean is true // at_alt(i) = aligned linear element accessor; valid only if 'use_at' boolean is false and is_aligned() returns true // // get_ea() = return object that provides linear access to elements via operator[i] // get_aligned_ea() = return object that provides linear access to elements via at_alt(i); valid only if is_aligned() returns true // // is_alias(X) = return true/false to indicate Q object aliases matrix X // has_overlap(X) = return true/false to indicate Q object has overlap with subview X // is_aligned() = return true/false to indicate Q object has aligned memory template struct Proxy_default { inline Proxy_default(const T1&) { arma_type_check(( is_arma_type::value == false )); } }; template struct Proxy_fixed { typedef typename T1::elem_type elem_type; typedef typename get_pod_type::result pod_type; typedef T1 stored_type; typedef const elem_type* ea_type; typedef const T1& aligned_ea_type; static constexpr bool use_at = false; static constexpr bool use_mp = false; static constexpr bool has_subview = false; static constexpr bool is_row = T1::is_row; static constexpr bool is_col = T1::is_col; static constexpr bool is_xvec = T1::is_xvec; arma_aligned const T1& Q; inline explicit Proxy_fixed(const T1& A) : Q(A) { arma_debug_sigprint(); } //// this may require T1::n_elem etc to be declared as static constexpr inline variables (C++17) //// see also the notes in Mat::fixed //// https://en.cppreference.com/w/cpp/language/static //// https://en.cppreference.com/w/cpp/language/inline // // static constexpr uword get_n_rows() { return T1::n_rows; } // static constexpr uword get_n_cols() { return T1::n_cols; } // static constexpr uword get_n_elem() { return T1::n_elem; } arma_inline uword get_n_rows() const { return is_row ? 1 : T1::n_rows; } arma_inline uword get_n_cols() const { return is_col ? 1 : T1::n_cols; } arma_inline uword get_n_elem() const { return T1::n_elem; } arma_inline elem_type operator[] (const uword i) const { return Q[i]; } arma_inline elem_type at (const uword r, const uword c) const { return Q.at(r, c); } arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); } arma_inline ea_type get_ea() const { return Q.memptr(); } arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&Q) == void_ptr(&X)); } template arma_inline bool has_overlap(const subview& X) const { return is_alias(X.m); } arma_inline bool is_aligned() const { #if defined(ARMA_HAVE_ALIGNED_ATTRIBUTE) return true; #else return memory::is_aligned(Q.memptr()); #endif } }; template struct Proxy_redirect {}; template struct Proxy_redirect { typedef Proxy_default result; }; template struct Proxy_redirect { typedef Proxy_fixed result; }; template struct Proxy : public Proxy_redirect::value>::result { inline Proxy(const T1& A) : Proxy_redirect::value>::result(A) { } }; template struct Proxy< Mat > { typedef eT elem_type; typedef typename get_pod_type::result pod_type; typedef Mat stored_type; typedef const eT* ea_type; typedef const Mat& aligned_ea_type; static constexpr bool use_at = false; static constexpr bool use_mp = false; static constexpr bool has_subview = false; static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = false; const Mat& Q; inline explicit Proxy(const Mat& A) : Q(A) { arma_debug_sigprint(); } arma_inline uword get_n_rows() const { return Q.n_rows; } arma_inline uword get_n_cols() const { return Q.n_cols; } arma_inline uword get_n_elem() const { return Q.n_elem; } arma_inline elem_type operator[] (const uword i) const { return Q[i]; } arma_inline elem_type at (const uword r, const uword c) const { return Q.at(r, c); } arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); } arma_inline ea_type get_ea() const { return Q.memptr(); } arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template arma_inline bool is_alias(const Mat& X) const { return (is_same_type::yes) && (void_ptr(&Q) == void_ptr(&X)); } template arma_inline bool has_overlap(const subview& X) const { return is_alias(X.m); } arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); } }; template struct Proxy< Col > { typedef eT elem_type; typedef typename get_pod_type::result pod_type; typedef Col stored_type; typedef const eT* ea_type; typedef const Col& aligned_ea_type; static constexpr bool use_at = false; static constexpr bool use_mp = false; static constexpr bool has_subview = false; static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; const Col& Q; inline explicit Proxy(const Col& A) : Q(A) { arma_debug_sigprint(); } arma_inline uword get_n_rows() const { return Q.n_rows; } constexpr uword get_n_cols() const { return 1; } arma_inline uword get_n_elem() const { return Q.n_elem; } arma_inline elem_type operator[] (const uword i) const { return Q[i]; } arma_inline elem_type at (const uword r, const uword) const { return Q[r]; } arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); } arma_inline ea_type get_ea() const { return Q.memptr(); } arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template arma_inline bool is_alias(const Mat& X) const { return (is_same_type::yes) && (void_ptr(&Q) == void_ptr(&X)); } template arma_inline bool has_overlap(const subview& X) const { return is_alias(X.m); } arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); } }; template struct Proxy< Row > { typedef eT elem_type; typedef typename get_pod_type::result pod_type; typedef Row stored_type; typedef const eT* ea_type; typedef const Row& aligned_ea_type; static constexpr bool use_at = false; static constexpr bool use_mp = false; static constexpr bool has_subview = false; static constexpr bool is_row = true; static constexpr bool is_col = false; static constexpr bool is_xvec = false; const Row& Q; inline explicit Proxy(const Row& A) : Q(A) { arma_debug_sigprint(); } constexpr uword get_n_rows() const { return 1; } arma_inline uword get_n_cols() const { return Q.n_cols; } arma_inline uword get_n_elem() const { return Q.n_elem; } arma_inline elem_type operator[] (const uword i) const { return Q[i]; } arma_inline elem_type at (const uword, const uword c) const { return Q[c]; } arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); } arma_inline ea_type get_ea() const { return Q.memptr(); } arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template arma_inline bool is_alias(const Mat& X) const { return (is_same_type::yes) && (void_ptr(&Q) == void_ptr(&X)); } template arma_inline bool has_overlap(const subview& X) const { return is_alias(X.m); } arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); } }; template struct Proxy< Gen > { typedef typename T1::elem_type elem_type; typedef typename get_pod_type::result pod_type; typedef Gen stored_type; typedef const Gen& ea_type; typedef const Gen& aligned_ea_type; static constexpr bool use_at = Gen::use_at; static constexpr bool use_mp = false; static constexpr bool has_subview = false; static constexpr bool is_row = Gen::is_row; static constexpr bool is_col = Gen::is_col; static constexpr bool is_xvec = Gen::is_xvec; const Gen& Q; inline explicit Proxy(const Gen& A) : Q(A) { arma_debug_sigprint(); } arma_inline uword get_n_rows() const { return (is_row ? 1 : Q.n_rows); } arma_inline uword get_n_cols() const { return (is_col ? 1 : Q.n_cols); } arma_inline uword get_n_elem() const { return (is_row ? 1 : Q.n_rows) * (is_col ? 1 : Q.n_cols); } arma_inline elem_type operator[] (const uword i) const { return Q[i]; } arma_inline elem_type at (const uword r, const uword c) const { return Q.at(r, c); } arma_inline elem_type at_alt (const uword i) const { return Q[i]; } arma_inline ea_type get_ea() const { return Q; } arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template constexpr bool is_alias(const Mat&) const { return false; } template constexpr bool has_overlap(const subview&) const { return false; } constexpr bool is_aligned() const { return Gen::is_simple; } }; template struct Proxy< eOp > { typedef typename T1::elem_type elem_type; typedef typename get_pod_type::result pod_type; typedef eOp stored_type; typedef const eOp& ea_type; typedef const eOp& aligned_ea_type; static constexpr bool use_at = eOp::use_at; static constexpr bool use_mp = eOp::use_mp; static constexpr bool has_subview = eOp::has_subview; static constexpr bool is_row = eOp::is_row; static constexpr bool is_col = eOp::is_col; static constexpr bool is_xvec = eOp::is_xvec; const eOp& Q; inline explicit Proxy(const eOp& A) : Q(A) { arma_debug_sigprint(); } arma_inline uword get_n_rows() const { return is_row ? 1 : Q.get_n_rows(); } arma_inline uword get_n_cols() const { return is_col ? 1 : Q.get_n_cols(); } arma_inline uword get_n_elem() const { return Q.get_n_elem(); } arma_inline elem_type operator[] (const uword i) const { return Q[i]; } arma_inline elem_type at (const uword r, const uword c) const { return Q.at(r, c); } arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); } arma_inline ea_type get_ea() const { return Q; } arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template arma_inline bool is_alias(const Mat& X) const { return Q.P.is_alias(X); } template arma_inline bool has_overlap(const subview& X) const { return Q.P.has_overlap(X); } arma_inline bool is_aligned() const { return Q.P.is_aligned(); } }; template struct Proxy< eGlue > { typedef typename T1::elem_type elem_type; typedef typename get_pod_type::result pod_type; typedef eGlue stored_type; typedef const eGlue& ea_type; typedef const eGlue& aligned_ea_type; static constexpr bool use_at = eGlue::use_at; static constexpr bool use_mp = eGlue::use_mp; static constexpr bool has_subview = eGlue::has_subview; static constexpr bool is_row = eGlue::is_row; static constexpr bool is_col = eGlue::is_col; static constexpr bool is_xvec = eGlue::is_xvec; const eGlue& Q; inline explicit Proxy(const eGlue& A) : Q(A) { arma_debug_sigprint(); } arma_inline uword get_n_rows() const { return is_row ? 1 : Q.get_n_rows(); } arma_inline uword get_n_cols() const { return is_col ? 1 : Q.get_n_cols(); } arma_inline uword get_n_elem() const { return Q.get_n_elem(); } arma_inline elem_type operator[] (const uword i) const { return Q[i]; } arma_inline elem_type at (const uword r, const uword c) const { return Q.at(r, c); } arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); } arma_inline ea_type get_ea() const { return Q; } arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template arma_inline bool is_alias(const Mat& X) const { return (Q.P1.is_alias(X) || Q.P2.is_alias(X)); } template arma_inline bool has_overlap(const subview& X) const { return (Q.P1.has_overlap(X) || Q.P2.has_overlap(X)); } arma_inline bool is_aligned() const { return (Q.P1.is_aligned() && Q.P2.is_aligned()); } }; template struct Proxy< Op > { typedef typename T1::elem_type elem_type; typedef typename get_pod_type::result pod_type; typedef Mat stored_type; typedef const elem_type* ea_type; typedef const Mat& aligned_ea_type; static constexpr bool use_at = false; static constexpr bool use_mp = false; static constexpr bool has_subview = false; static constexpr bool is_row = Op::is_row; static constexpr bool is_col = Op::is_col; static constexpr bool is_xvec = Op::is_xvec; const Mat Q; inline explicit Proxy(const Op& A) : Q(A) { arma_debug_sigprint(); } arma_inline uword get_n_rows() const { return is_row ? 1 : Q.n_rows; } arma_inline uword get_n_cols() const { return is_col ? 1 : Q.n_cols; } arma_inline uword get_n_elem() const { return Q.n_elem; } arma_inline elem_type operator[] (const uword i) const { return Q[i]; } arma_inline elem_type at (const uword r, const uword c) const { return Q.at(r, c); } arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); } arma_inline ea_type get_ea() const { return Q.memptr(); } arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template constexpr bool is_alias(const Mat&) const { return false; } template constexpr bool has_overlap(const subview&) const { return false; } arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); } }; template struct Proxy< Glue > { typedef typename T1::elem_type elem_type; typedef typename get_pod_type::result pod_type; typedef Mat stored_type; typedef const elem_type* ea_type; typedef const Mat& aligned_ea_type; static constexpr bool use_at = false; static constexpr bool use_mp = false; static constexpr bool has_subview = false; static constexpr bool is_row = Glue::is_row; static constexpr bool is_col = Glue::is_col; static constexpr bool is_xvec = Glue::is_xvec; const Mat Q; inline explicit Proxy(const Glue& A) : Q(A) { arma_debug_sigprint(); } arma_inline uword get_n_rows() const { return is_row ? 1 : Q.n_rows; } arma_inline uword get_n_cols() const { return is_col ? 1 : Q.n_cols; } arma_inline uword get_n_elem() const { return Q.n_elem; } arma_inline elem_type operator[] (const uword i) const { return Q[i]; } arma_inline elem_type at (const uword r, const uword c) const { return Q.at(r, c); } arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); } arma_inline ea_type get_ea() const { return Q.memptr(); } arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template constexpr bool is_alias(const Mat&) const { return false; } template constexpr bool has_overlap(const subview&) const { return false; } arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); } }; template struct Proxy< Glue > { typedef Glue this_Glue_type; typedef Proxy< Glue > this_Proxy_type; typedef typename T1::elem_type elem_type; typedef typename get_pod_type::result pod_type; typedef this_Glue_type stored_type; typedef const this_Proxy_type& ea_type; typedef const this_Proxy_type& aligned_ea_type; static constexpr bool use_at = (Proxy::use_at || Proxy::use_at ); static constexpr bool use_mp = (Proxy::use_mp || Proxy::use_mp ); static constexpr bool has_subview = (Proxy::has_subview || Proxy::has_subview); static constexpr bool is_row = this_Glue_type::is_row; static constexpr bool is_col = this_Glue_type::is_col; static constexpr bool is_xvec = this_Glue_type::is_xvec; const this_Glue_type& Q; const Proxy P1; const Proxy P2; arma_lt_comparator comparator; inline explicit Proxy(const this_Glue_type& X) : Q (X ) , P1(X.A) , P2(X.B) { arma_debug_sigprint(); arma_conform_assert_same_size(P1, P2, "element-wise min()"); } arma_inline uword get_n_rows() const { return is_row ? 1 : P1.get_n_rows(); } arma_inline uword get_n_cols() const { return is_col ? 1 : P1.get_n_cols(); } arma_inline uword get_n_elem() const { return P1.get_n_elem(); } arma_inline elem_type operator[] (const uword i) const { const elem_type A = P1[i]; const elem_type B = P2[i]; return comparator(A,B) ? A : B; } arma_inline elem_type at (const uword r, const uword c) const { const elem_type A = P1.at(r,c); const elem_type B = P2.at(r,c); return comparator(A,B) ? A : B; } arma_inline elem_type at_alt (const uword i) const { const elem_type A = P1.at_alt(i); const elem_type B = P2.at_alt(i); return comparator(A,B) ? A : B; } arma_inline ea_type get_ea() const { return *this; } arma_inline aligned_ea_type get_aligned_ea() const { return *this; } template arma_inline bool is_alias(const Mat& X) const { return (P1.is_alias(X) || P2.is_alias(X)); } template arma_inline bool has_overlap(const subview& X) const { return (P1.has_overlap(X) || P2.has_overlap(X)); } arma_inline bool is_aligned() const { return (P1.is_aligned() && P2.is_aligned()); } }; template struct Proxy< Glue > { typedef Glue this_Glue_type; typedef Proxy< Glue > this_Proxy_type; typedef typename T1::elem_type elem_type; typedef typename get_pod_type::result pod_type; typedef this_Glue_type stored_type; typedef const this_Proxy_type& ea_type; typedef const this_Proxy_type& aligned_ea_type; static constexpr bool use_at = (Proxy::use_at || Proxy::use_at ); static constexpr bool use_mp = (Proxy::use_mp || Proxy::use_mp ); static constexpr bool has_subview = (Proxy::has_subview || Proxy::has_subview); static constexpr bool is_row = this_Glue_type::is_row; static constexpr bool is_col = this_Glue_type::is_col; static constexpr bool is_xvec = this_Glue_type::is_xvec; const this_Glue_type& Q; const Proxy P1; const Proxy P2; arma_gt_comparator comparator; inline explicit Proxy(const this_Glue_type& X) : Q (X ) , P1(X.A) , P2(X.B) { arma_debug_sigprint(); arma_conform_assert_same_size(P1, P2, "element-wise max()"); } arma_inline uword get_n_rows() const { return is_row ? 1 : P1.get_n_rows(); } arma_inline uword get_n_cols() const { return is_col ? 1 : P1.get_n_cols(); } arma_inline uword get_n_elem() const { return P1.get_n_elem(); } arma_inline elem_type operator[] (const uword i) const { const elem_type A = P1[i]; const elem_type B = P2[i]; return comparator(A,B) ? A : B; } arma_inline elem_type at (const uword r, const uword c) const { const elem_type A = P1.at(r,c); const elem_type B = P2.at(r,c); return comparator(A,B) ? A : B; } arma_inline elem_type at_alt (const uword i) const { const elem_type A = P1.at_alt(i); const elem_type B = P2.at_alt(i); return comparator(A,B) ? A : B; } arma_inline ea_type get_ea() const { return *this; } arma_inline aligned_ea_type get_aligned_ea() const { return *this; } template arma_inline bool is_alias(const Mat& X) const { return (P1.is_alias(X) || P2.is_alias(X)); } template arma_inline bool has_overlap(const subview& X) const { return (P1.has_overlap(X) || P2.has_overlap(X)); } arma_inline bool is_aligned() const { return (P1.is_aligned() && P2.is_aligned()); } }; template struct Proxy< mtOp > { typedef out_eT elem_type; typedef typename get_pod_type::result pod_type; typedef Mat stored_type; typedef const elem_type* ea_type; typedef const Mat& aligned_ea_type; static constexpr bool use_at = false; static constexpr bool use_mp = false; static constexpr bool has_subview = false; static constexpr bool is_row = mtOp::is_row; static constexpr bool is_col = mtOp::is_col; static constexpr bool is_xvec = mtOp::is_xvec; const Mat Q; inline explicit Proxy(const mtOp& A) : Q(A) { arma_debug_sigprint(); } arma_inline uword get_n_rows() const { return is_row ? 1 : Q.n_rows; } arma_inline uword get_n_cols() const { return is_col ? 1 : Q.n_cols; } arma_inline uword get_n_elem() const { return Q.n_elem; } arma_inline elem_type operator[] (const uword i) const { return Q[i]; } arma_inline elem_type at (const uword r, const uword c) const { return Q.at(r,c); } arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); } arma_inline ea_type get_ea() const { return Q.memptr(); } arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template constexpr bool is_alias(const Mat&) const { return false; } template constexpr bool has_overlap(const subview&) const { return false; } arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); } }; template struct Proxy< mtGlue > { typedef out_eT elem_type; typedef typename get_pod_type::result pod_type; typedef Mat stored_type; typedef const elem_type* ea_type; typedef const Mat& aligned_ea_type; static constexpr bool use_at = false; static constexpr bool use_mp = false; static constexpr bool has_subview = false; static constexpr bool is_row = mtGlue::is_row; static constexpr bool is_col = mtGlue::is_col; static constexpr bool is_xvec = mtGlue::is_xvec; const Mat Q; inline explicit Proxy(const mtGlue& A) : Q(A) { arma_debug_sigprint(); } arma_inline uword get_n_rows() const { return is_row ? 1 : Q.n_rows; } arma_inline uword get_n_cols() const { return is_col ? 1 : Q.n_cols; } arma_inline uword get_n_elem() const { return Q.n_elem; } arma_inline elem_type operator[] (const uword i) const { return Q[i]; } arma_inline elem_type at (const uword r, const uword c) const { return Q.at(r,c); } arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); } arma_inline ea_type get_ea() const { return Q.memptr(); } arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template constexpr bool is_alias(const Mat&) const { return false; } template constexpr bool has_overlap(const subview&) const { return false; } arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); } }; template struct Proxy< CubeToMatOp > { typedef typename T1::elem_type elem_type; typedef typename get_pod_type::result pod_type; typedef Mat stored_type; typedef const elem_type* ea_type; typedef const Mat& aligned_ea_type; static constexpr bool use_at = false; static constexpr bool use_mp = false; static constexpr bool has_subview = false; static constexpr bool is_row = CubeToMatOp::is_row; static constexpr bool is_col = CubeToMatOp::is_col; static constexpr bool is_xvec = CubeToMatOp::is_xvec; const Mat Q; inline explicit Proxy(const CubeToMatOp& A) : Q(A) { arma_debug_sigprint(); } arma_inline uword get_n_rows() const { return is_row ? 1 : Q.n_rows; } arma_inline uword get_n_cols() const { return is_col ? 1 : Q.n_cols; } arma_inline uword get_n_elem() const { return Q.n_elem; } arma_inline elem_type operator[] (const uword i) const { return Q[i]; } arma_inline elem_type at (const uword r, const uword c) const { return Q.at(r, c); } arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); } arma_inline ea_type get_ea() const { return Q.memptr(); } arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template constexpr bool is_alias(const Mat&) const { return false; } template constexpr bool has_overlap(const subview&) const { return false; } arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); } }; template struct Proxy< CubeToMatOp > { typedef typename T1::elem_type elem_type; typedef typename get_pod_type::result pod_type; typedef Mat stored_type; typedef const elem_type* ea_type; typedef const Mat& aligned_ea_type; static constexpr bool use_at = false; static constexpr bool use_mp = false; static constexpr bool has_subview = true; static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; const unwrap_cube U; const Mat Q; inline explicit Proxy(const CubeToMatOp& A) : U(A.m) , Q(const_cast(U.M.memptr()), U.M.n_elem, 1, false, true) { arma_debug_sigprint(); } arma_inline uword get_n_rows() const { return Q.n_rows; } constexpr uword get_n_cols() const { return 1; } arma_inline uword get_n_elem() const { return Q.n_elem; } arma_inline elem_type operator[] (const uword i) const { return Q[i]; } arma_inline elem_type at (const uword r, const uword) const { return Q[r]; } arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); } arma_inline ea_type get_ea() const { return Q.memptr(); } arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template constexpr bool is_alias(const Mat&) const { return false; } template constexpr bool has_overlap(const subview&) const { return false; } arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); } }; template struct Proxy< SpToDOp > { typedef typename T1::elem_type elem_type; typedef typename get_pod_type::result pod_type; typedef Mat stored_type; typedef const elem_type* ea_type; typedef const Mat& aligned_ea_type; static constexpr bool use_at = false; static constexpr bool use_mp = false; static constexpr bool has_subview = false; static constexpr bool is_row = SpToDOp::is_row; static constexpr bool is_col = SpToDOp::is_col; static constexpr bool is_xvec = SpToDOp::is_xvec; const Mat Q; inline explicit Proxy(const SpToDOp& A) : Q(A) { arma_debug_sigprint(); } arma_inline uword get_n_rows() const { return is_row ? 1 : Q.n_rows; } arma_inline uword get_n_cols() const { return is_col ? 1 : Q.n_cols; } arma_inline uword get_n_elem() const { return Q.n_elem; } arma_inline elem_type operator[] (const uword i) const { return Q[i]; } arma_inline elem_type at (const uword r, const uword c) const { return Q.at(r, c); } arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); } arma_inline ea_type get_ea() const { return Q.memptr(); } arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template constexpr bool is_alias(const Mat&) const { return false; } template constexpr bool has_overlap(const subview&) const { return false; } arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); } }; template struct Proxy< SpToDOp, op_sp_nonzeros> > { typedef eT elem_type; typedef typename get_pod_type::result pod_type; typedef Mat stored_type; typedef const elem_type* ea_type; typedef const Mat& aligned_ea_type; static constexpr bool use_at = false; static constexpr bool use_mp = false; static constexpr bool has_subview = true; static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; const SpMat& R; const Mat Q; inline explicit Proxy(const SpToDOp, op_sp_nonzeros>& A) : R(A.m) , Q(const_cast(R.values), R.n_nonzero, 1, false, true) { arma_debug_sigprint(); } arma_inline uword get_n_rows() const { return Q.n_rows; } constexpr uword get_n_cols() const { return 1; } arma_inline uword get_n_elem() const { return Q.n_elem; } arma_inline elem_type operator[] (const uword i) const { return Q[i]; } arma_inline elem_type at (const uword r, const uword) const { return Q[r]; } arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); } arma_inline ea_type get_ea() const { return Q.memptr(); } arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template constexpr bool is_alias(const Mat&) const { return false; } template constexpr bool has_overlap(const subview&) const { return false; } arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); } }; template struct Proxy< SpToDGlue > { typedef typename T1::elem_type elem_type; typedef typename get_pod_type::result pod_type; typedef Mat stored_type; typedef const elem_type* ea_type; typedef const Mat& aligned_ea_type; static constexpr bool use_at = false; static constexpr bool use_mp = false; static constexpr bool has_subview = false; static constexpr bool is_row = SpToDGlue::is_row; static constexpr bool is_col = SpToDGlue::is_col; static constexpr bool is_xvec = SpToDGlue::is_xvec; const Mat Q; inline explicit Proxy(const SpToDGlue& A) : Q(A) { arma_debug_sigprint(); } arma_inline uword get_n_rows() const { return is_row ? 1 : Q.n_rows; } arma_inline uword get_n_cols() const { return is_col ? 1 : Q.n_cols; } arma_inline uword get_n_elem() const { return Q.n_elem; } arma_inline elem_type operator[] (const uword i) const { return Q[i]; } arma_inline elem_type at (const uword r, const uword c) const { return Q.at(r, c); } arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); } arma_inline ea_type get_ea() const { return Q.memptr(); } arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template constexpr bool is_alias(const Mat&) const { return false; } template constexpr bool has_overlap(const subview&) const { return false; } arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); } }; template struct Proxy< subview > { typedef eT elem_type; typedef typename get_pod_type::result pod_type; typedef subview stored_type; typedef const subview& ea_type; typedef const subview& aligned_ea_type; static constexpr bool use_at = true; static constexpr bool use_mp = false; static constexpr bool has_subview = true; static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = false; const subview& Q; inline explicit Proxy(const subview& A) : Q(A) { arma_debug_sigprint(); } arma_inline uword get_n_rows() const { return Q.n_rows; } arma_inline uword get_n_cols() const { return Q.n_cols; } arma_inline uword get_n_elem() const { return Q.n_elem; } arma_inline elem_type operator[] (const uword i) const { return Q[i]; } arma_inline elem_type at (const uword r, const uword c) const { return Q.at(r, c); } arma_inline elem_type at_alt (const uword i) const { return Q[i]; } arma_inline ea_type get_ea() const { return Q; } arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template arma_inline bool is_alias(const Mat& X) const { return (is_same_type::yes) && (void_ptr(&(Q.m)) == void_ptr(&X)); } template arma_inline bool has_overlap(const subview& X) const { return Q.check_overlap(X); } constexpr bool is_aligned() const { return false; } }; template struct Proxy< subview_col > { typedef eT elem_type; typedef typename get_pod_type::result pod_type; typedef subview_col stored_type; typedef const eT* ea_type; typedef const subview_col& aligned_ea_type; static constexpr bool use_at = false; static constexpr bool use_mp = false; static constexpr bool has_subview = true; static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; const subview_col& Q; inline explicit Proxy(const subview_col& A) : Q(A) { arma_debug_sigprint(); } arma_inline uword get_n_rows() const { return Q.n_rows; } constexpr uword get_n_cols() const { return 1; } arma_inline uword get_n_elem() const { return Q.n_elem; } arma_inline elem_type operator[] (const uword i) const { return Q[i]; } arma_inline elem_type at (const uword r, const uword) const { return Q[r]; } arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); } arma_inline ea_type get_ea() const { return Q.colmem; } arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template arma_inline bool is_alias(const Mat& X) const { return (is_same_type::yes) && (void_ptr(&(Q.m)) == void_ptr(&X)); } template arma_inline bool has_overlap(const subview& X) const { return Q.check_overlap(X); } arma_inline bool is_aligned() const { return memory::is_aligned(Q.colmem); } }; template struct Proxy< subview_cols > { typedef eT elem_type; typedef typename get_pod_type::result pod_type; typedef Mat stored_type; typedef const eT* ea_type; typedef const Mat& aligned_ea_type; static constexpr bool use_at = false; static constexpr bool use_mp = false; static constexpr bool has_subview = true; static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = false; const subview_cols& sv; const Mat Q; inline explicit Proxy(const subview_cols& A) : sv(A) , Q ( const_cast( A.colptr(0) ), A.n_rows, A.n_cols, false, false ) { arma_debug_sigprint(); } arma_inline uword get_n_rows() const { return Q.n_rows; } arma_inline uword get_n_cols() const { return Q.n_cols; } arma_inline uword get_n_elem() const { return Q.n_elem; } arma_inline elem_type operator[] (const uword i) const { return Q[i]; } arma_inline elem_type at (const uword r, const uword c) const { return Q.at(r,c); } arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); } arma_inline ea_type get_ea() const { return Q.memptr(); } arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template arma_inline bool is_alias(const Mat& X) const { return (is_same_type::yes) && (void_ptr(&(sv.m)) == void_ptr(&X)); } template arma_inline bool has_overlap(const subview& X) const { return sv.check_overlap(X); } arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); } }; template struct Proxy< subview_row > { typedef eT elem_type; typedef typename get_pod_type::result pod_type; typedef subview_row stored_type; typedef const subview_row& ea_type; typedef const subview_row& aligned_ea_type; static constexpr bool use_at = false; static constexpr bool use_mp = false; static constexpr bool has_subview = true; static constexpr bool is_row = true; static constexpr bool is_col = false; static constexpr bool is_xvec = false; const subview_row& Q; inline explicit Proxy(const subview_row& A) : Q(A) { arma_debug_sigprint(); } constexpr uword get_n_rows() const { return 1; } arma_inline uword get_n_cols() const { return Q.n_cols; } arma_inline uword get_n_elem() const { return Q.n_elem; } arma_inline elem_type operator[] (const uword i) const { return Q[i]; } arma_inline elem_type at (const uword, const uword c) const { return Q[c]; } arma_inline elem_type at_alt (const uword i) const { return Q[i]; } arma_inline ea_type get_ea() const { return Q; } arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template arma_inline bool is_alias(const Mat& X) const { return (is_same_type::yes) && (void_ptr(&(Q.m)) == void_ptr(&X)); } template arma_inline bool has_overlap(const subview& X) const { return Q.check_overlap(X); } constexpr bool is_aligned() const { return false; } }; template struct Proxy< subview_elem1 > { typedef eT elem_type; typedef typename get_pod_type::result pod_type; typedef subview_elem1 stored_type; typedef const Proxy< subview_elem1 >& ea_type; typedef const Proxy< subview_elem1 >& aligned_ea_type; static constexpr bool use_at = false; static constexpr bool use_mp = false; static constexpr bool has_subview = true; static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; const subview_elem1& Q; const Proxy R; inline explicit Proxy(const subview_elem1& A) : Q(A) , R(A.a.get_ref()) { arma_debug_sigprint(); const bool R_is_vec = ((R.get_n_rows() == 1) || (R.get_n_cols() == 1)); const bool R_is_empty = (R.get_n_elem() == 0); arma_conform_check( ((R_is_vec == false) && (R_is_empty == false)), "Mat::elem(): given object must be a vector" ); } arma_inline uword get_n_rows() const { return R.get_n_elem(); } constexpr uword get_n_cols() const { return 1; } arma_inline uword get_n_elem() const { return R.get_n_elem(); } arma_inline elem_type operator[] (const uword i) const { const uword ii = (Proxy::use_at) ? R.at(i,0) : R[i]; arma_conform_check_bounds( (ii >= Q.m.n_elem), "Mat::elem(): index out of bounds" ); return Q.m[ii]; } arma_inline elem_type at (const uword r, const uword) const { const uword ii = (Proxy::use_at) ? R.at(r,0) : R[r]; arma_conform_check_bounds( (ii >= Q.m.n_elem), "Mat::elem(): index out of bounds" ); return Q.m[ii]; } arma_inline elem_type at_alt (const uword i) const { const uword ii = (Proxy::use_at) ? R.at(i,0) : R[i]; arma_conform_check_bounds( (ii >= Q.m.n_elem), "Mat::elem(): index out of bounds" ); return Q.m[ii]; } arma_inline ea_type get_ea() const { return (*this); } arma_inline aligned_ea_type get_aligned_ea() const { return (*this); } template arma_inline bool is_alias(const Mat& X) const { return ( (void_ptr(&X) == void_ptr(&(Q.m))) || (R.is_alias(X)) ); } template arma_inline bool has_overlap(const subview& X) const { return is_alias(X.m); } constexpr bool is_aligned() const { return false; } }; template struct Proxy< subview_elem2 > { typedef eT elem_type; typedef typename get_pod_type::result pod_type; typedef Mat stored_type; typedef const eT* ea_type; typedef const Mat& aligned_ea_type; static constexpr bool use_at = false; static constexpr bool use_mp = false; static constexpr bool has_subview = false; static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = false; const Mat Q; inline explicit Proxy(const subview_elem2& A) : Q(A) { arma_debug_sigprint(); } arma_inline uword get_n_rows() const { return Q.n_rows; } arma_inline uword get_n_cols() const { return Q.n_cols; } arma_inline uword get_n_elem() const { return Q.n_elem; } arma_inline elem_type operator[] (const uword i) const { return Q[i]; } arma_inline elem_type at (const uword r, const uword c) const { return Q.at(r, c); } arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); } arma_inline ea_type get_ea() const { return Q.memptr(); } arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template constexpr bool is_alias(const Mat&) const { return false; } template constexpr bool has_overlap(const subview&) const { return false; } arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); } }; template struct Proxy< diagview > { typedef eT elem_type; typedef typename get_pod_type::result pod_type; typedef diagview stored_type; typedef const diagview& ea_type; typedef const diagview& aligned_ea_type; static constexpr bool use_at = false; static constexpr bool use_mp = false; static constexpr bool has_subview = true; static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; const diagview& Q; inline explicit Proxy(const diagview& A) : Q(A) { arma_debug_sigprint(); } arma_inline uword get_n_rows() const { return Q.n_rows; } constexpr uword get_n_cols() const { return 1; } arma_inline uword get_n_elem() const { return Q.n_elem; } arma_inline elem_type operator[] (const uword i) const { return Q[i]; } arma_inline elem_type at (const uword r, const uword) const { return Q.at(r, 0); } arma_inline elem_type at_alt (const uword i) const { return Q[i]; } arma_inline ea_type get_ea() const { return Q; } arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template arma_inline bool is_alias(const Mat& X) const { return (is_same_type::yes) && (void_ptr(&(Q.m)) == void_ptr(&X)); } template arma_inline bool has_overlap(const subview& X) const { return is_alias(X.m); } constexpr bool is_aligned() const { return false; } }; template struct Proxy_diagvec_mat { inline Proxy_diagvec_mat(const T1&) {} }; template struct Proxy_diagvec_mat< Op > { typedef typename T1::elem_type elem_type; typedef typename get_pod_type::result pod_type; typedef diagview stored_type; typedef const diagview& ea_type; typedef const diagview& aligned_ea_type; static constexpr bool use_at = false; static constexpr bool use_mp = false; static constexpr bool has_subview = true; static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; const Mat& R; const diagview Q; inline explicit Proxy_diagvec_mat(const Op& A) : R(A.m), Q( R.diag() ) { arma_debug_sigprint(); } arma_inline uword get_n_rows() const { return Q.n_rows; } constexpr uword get_n_cols() const { return 1; } arma_inline uword get_n_elem() const { return Q.n_elem; } arma_inline elem_type operator[] (const uword i) const { return Q[i]; } arma_inline elem_type at (const uword r, const uword) const { return Q.at(r, 0); } arma_inline elem_type at_alt (const uword i) const { return Q[i]; } arma_inline ea_type get_ea() const { return Q; } arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&R) == void_ptr(&X)); } template arma_inline bool has_overlap(const subview& X) const { return is_alias(X.m); } constexpr bool is_aligned() const { return false; } }; template struct Proxy_diagvec_expr { inline Proxy_diagvec_expr(const T1&) {} }; template struct Proxy_diagvec_expr< Op > { typedef typename T1::elem_type elem_type; typedef typename get_pod_type::result pod_type; typedef Mat stored_type; typedef const elem_type* ea_type; typedef const Mat& aligned_ea_type; static constexpr bool use_at = false; static constexpr bool use_mp = false; static constexpr bool has_subview = false; static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; const Mat Q; inline explicit Proxy_diagvec_expr(const Op& A) : Q(A) { arma_debug_sigprint(); } arma_inline uword get_n_rows() const { return Q.n_rows; } constexpr uword get_n_cols() const { return 1; } arma_inline uword get_n_elem() const { return Q.n_elem; } arma_inline elem_type operator[] (const uword i) const { return Q[i]; } arma_inline elem_type at (const uword r, const uword) const { return Q.at(r, 0); } arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); } arma_inline ea_type get_ea() const { return Q.memptr(); } arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template constexpr bool is_alias(const Mat&) const { return false; } template constexpr bool has_overlap(const subview&) const { return false; } arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); } }; template struct Proxy_diagvec_redirect {}; template struct Proxy_diagvec_redirect< Op, true > { typedef Proxy_diagvec_mat < Op > result; }; template struct Proxy_diagvec_redirect< Op, false> { typedef Proxy_diagvec_expr< Op > result; }; template struct Proxy< Op > : public Proxy_diagvec_redirect< Op, is_Mat::value >::result { typedef typename Proxy_diagvec_redirect< Op, is_Mat::value >::result Proxy_diagvec; inline explicit Proxy(const Op& A) : Proxy_diagvec(A) { arma_debug_sigprint(); } }; template struct Proxy< Op > { typedef typename T1::elem_type elem_type; typedef typename get_pod_type::result pod_type; typedef Mat stored_type; typedef const elem_type* ea_type; typedef const Mat& aligned_ea_type; static constexpr bool use_at = false; static constexpr bool use_mp = false; static constexpr bool has_subview = false; static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; const Mat Q; inline explicit Proxy(const Op& A) : Q(A) { arma_debug_sigprint(); } arma_inline uword get_n_rows() const { return Q.n_rows; } constexpr uword get_n_cols() const { return 1; } arma_inline uword get_n_elem() const { return Q.n_elem; } arma_inline elem_type operator[] (const uword i) const { return Q[i]; } arma_inline elem_type at (const uword r, const uword) const { return Q.at(r, 0); } arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); } arma_inline ea_type get_ea() const { return Q.memptr(); } arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template constexpr bool is_alias(const Mat&) const { return false; } template constexpr bool has_overlap(const subview&) const { return false; } arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); } }; template struct Proxy_xtrans_default { inline Proxy_xtrans_default(const T1&) {} }; template struct Proxy_xtrans_default< Op > { typedef typename T1::elem_type elem_type; typedef typename get_pod_type::result pod_type; typedef xtrans_mat stored_type; typedef const xtrans_mat& ea_type; typedef const xtrans_mat& aligned_ea_type; static constexpr bool use_at = true; static constexpr bool use_mp = false; static constexpr bool has_subview = true; static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = false; const unwrap U; const xtrans_mat Q; inline explicit Proxy_xtrans_default(const Op& A) : U(A.m) , Q(U.M) { arma_debug_sigprint(); } arma_inline ea_type get_ea() const { return Q; } arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template arma_inline bool is_alias(const Mat& X) const { return void_ptr(&(U.M)) == void_ptr(&X); } template arma_inline bool has_overlap(const subview& X) const { return is_alias(X.m); } constexpr bool is_aligned() const { return false; } }; template struct Proxy_xtrans_default< Op > { typedef typename T1::elem_type elem_type; typedef typename get_pod_type::result pod_type; typedef xtrans_mat stored_type; typedef const xtrans_mat& ea_type; typedef const xtrans_mat& aligned_ea_type; static constexpr bool use_at = true; static constexpr bool use_mp = false; static constexpr bool has_subview = true; static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = false; const unwrap U; const xtrans_mat Q; inline explicit Proxy_xtrans_default(const Op& A) : U(A.m) , Q(U.M) { arma_debug_sigprint(); } arma_inline ea_type get_ea() const { return Q; } arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template arma_inline bool is_alias(const Mat& X) const { return void_ptr(&(U.M)) == void_ptr(&X); } template arma_inline bool has_overlap(const subview& X) const { return is_alias(X.m); } constexpr bool is_aligned() const { return false; } }; template struct Proxy_xtrans_vector { inline Proxy_xtrans_vector(const T1&) {} }; template struct Proxy_xtrans_vector< Op > { typedef typename T1::elem_type elem_type; typedef typename get_pod_type::result pod_type; typedef Mat stored_type; typedef const elem_type* ea_type; typedef const Mat& aligned_ea_type; static constexpr bool use_at = false; static constexpr bool use_mp = false; static constexpr bool has_subview = quasi_unwrap::has_subview; // NOTE: the Op class takes care of swapping row and col for op_htrans static constexpr bool is_row = Op::is_row; static constexpr bool is_col = Op::is_col; static constexpr bool is_xvec = Op::is_xvec; const quasi_unwrap U; // avoid copy if T1 is a Row, Col or subview_col const Mat Q; inline Proxy_xtrans_vector(const Op& A) : U(A.m) , Q(const_cast(U.M.memptr()), U.M.n_cols, U.M.n_rows, false, false) { arma_debug_sigprint(); } arma_inline ea_type get_ea() const { return Q.memptr(); } arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template arma_inline bool is_alias(const Mat& X) const { return U.is_alias(X); } template arma_inline bool has_overlap(const subview& X) const { return is_alias(X.m); } arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); } }; template struct Proxy_xtrans_vector< Op > { typedef typename T1::elem_type elem_type; typedef typename get_pod_type::result pod_type; typedef Mat stored_type; typedef const elem_type* ea_type; typedef const Mat& aligned_ea_type; static constexpr bool use_at = false; static constexpr bool use_mp = false; static constexpr bool has_subview = quasi_unwrap::has_subview; // NOTE: the Op class takes care of swapping row and col for op_strans static constexpr bool is_row = Op::is_row; static constexpr bool is_col = Op::is_col; static constexpr bool is_xvec = Op::is_xvec; const quasi_unwrap U; // avoid copy if T1 is a Row, Col or subview_col const Mat Q; inline Proxy_xtrans_vector(const Op& A) : U(A.m) , Q(const_cast(U.M.memptr()), U.M.n_cols, U.M.n_rows, false, false) { arma_debug_sigprint(); } arma_inline ea_type get_ea() const { return Q.memptr(); } arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template arma_inline bool is_alias(const Mat& X) const { return U.is_alias(X); } template arma_inline bool has_overlap(const subview& X) const { return is_alias(X.m); } arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); } }; template struct Proxy_xtrans_redirect {}; template struct Proxy_xtrans_redirect { typedef Proxy_xtrans_default result; }; template struct Proxy_xtrans_redirect { typedef Proxy_xtrans_vector result; }; template struct Proxy< Op > : public Proxy_xtrans_redirect < Op, ((is_cx::no) && ((Op::is_row) || (Op::is_col)) ) >::result { typedef typename Proxy_xtrans_redirect < Op, ((is_cx::no) && ((Op::is_row) || (Op::is_col)) ) >::result Proxy_xtrans; typedef typename Proxy_xtrans::elem_type elem_type; typedef typename Proxy_xtrans::pod_type pod_type; typedef typename Proxy_xtrans::stored_type stored_type; typedef typename Proxy_xtrans::ea_type ea_type; typedef typename Proxy_xtrans::aligned_ea_type aligned_ea_type; static constexpr bool use_at = Proxy_xtrans::use_at; static constexpr bool use_mp = Proxy_xtrans::use_mp; static constexpr bool has_subview = Proxy_xtrans::has_subview; static constexpr bool is_row = Proxy_xtrans::is_row; static constexpr bool is_col = Proxy_xtrans::is_col; static constexpr bool is_xvec = Proxy_xtrans::is_xvec; using Proxy_xtrans::Q; inline explicit Proxy(const Op& A) : Proxy_xtrans(A) { arma_debug_sigprint(); } arma_inline uword get_n_rows() const { return is_row ? 1 : Q.n_rows; } arma_inline uword get_n_cols() const { return is_col ? 1 : Q.n_cols; } arma_inline uword get_n_elem() const { return Q.n_elem; } arma_inline elem_type operator[] (const uword i) const { return Q[i]; } arma_inline elem_type at (const uword r, const uword c) const { return Q.at(r, c); } arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); } arma_inline ea_type get_ea() const { return Proxy_xtrans::get_ea(); } arma_inline aligned_ea_type get_aligned_ea() const { return Proxy_xtrans::get_aligned_ea(); } template arma_inline bool is_alias(const Mat& X) const { return Proxy_xtrans::is_alias(X); } template arma_inline bool has_overlap(const subview& X) const { return Proxy_xtrans::has_overlap(X); } arma_inline bool is_aligned() const { return Proxy_xtrans::is_aligned(); } }; template struct Proxy< Op > : public Proxy_xtrans_redirect < Op, ( (Op::is_row) || (Op::is_col) ) >::result { typedef typename Proxy_xtrans_redirect < Op, ( (Op::is_row) || (Op::is_col) ) >::result Proxy_xtrans; typedef typename Proxy_xtrans::elem_type elem_type; typedef typename Proxy_xtrans::pod_type pod_type; typedef typename Proxy_xtrans::stored_type stored_type; typedef typename Proxy_xtrans::ea_type ea_type; typedef typename Proxy_xtrans::aligned_ea_type aligned_ea_type; static constexpr bool use_at = Proxy_xtrans::use_at; static constexpr bool use_mp = Proxy_xtrans::use_mp; static constexpr bool has_subview = Proxy_xtrans::has_subview; static constexpr bool is_row = Proxy_xtrans::is_row; static constexpr bool is_col = Proxy_xtrans::is_col; static constexpr bool is_xvec = Proxy_xtrans::is_xvec; using Proxy_xtrans::Q; inline explicit Proxy(const Op& A) : Proxy_xtrans(A) { arma_debug_sigprint(); } arma_inline uword get_n_rows() const { return is_row ? 1 : Q.n_rows; } arma_inline uword get_n_cols() const { return is_col ? 1 : Q.n_cols; } arma_inline uword get_n_elem() const { return Q.n_elem; } arma_inline elem_type operator[] (const uword i) const { return Q[i]; } arma_inline elem_type at (const uword r, const uword c) const { return Q.at(r, c); } arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); } arma_inline ea_type get_ea() const { return Proxy_xtrans::get_ea(); } arma_inline aligned_ea_type get_aligned_ea() const { return Proxy_xtrans::get_aligned_ea(); } template arma_inline bool is_alias(const Mat& X) const { return Proxy_xtrans::is_alias(X); } template arma_inline bool has_overlap(const subview& X) const { return Proxy_xtrans::has_overlap(X); } arma_inline bool is_aligned() const { return Proxy_xtrans::is_aligned(); } }; template struct Proxy_subview_row_htrans_cx { typedef eT elem_type; typedef typename get_pod_type::result pod_type; typedef subview_row_htrans stored_type; typedef const subview_row_htrans& ea_type; typedef const subview_row_htrans& aligned_ea_type; static constexpr bool use_at = false; static constexpr bool use_mp = false; static constexpr bool has_subview = true; static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; const subview_row_htrans Q; inline explicit Proxy_subview_row_htrans_cx(const Op, op_htrans>& A) : Q(A.m) { arma_debug_sigprint(); } template arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&(Q.sv_row.m)) == void_ptr(&X)); } template arma_inline bool has_overlap(const subview& X) const { return is_alias(X.m); } }; template struct Proxy_subview_row_htrans_non_cx { typedef eT elem_type; typedef typename get_pod_type::result pod_type; typedef subview_row_strans stored_type; typedef const subview_row_strans& ea_type; typedef const subview_row_strans& aligned_ea_type; static constexpr bool use_at = false; static constexpr bool use_mp = false; static constexpr bool has_subview = true; static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; const subview_row_strans Q; inline explicit Proxy_subview_row_htrans_non_cx(const Op, op_htrans>& A) : Q(A.m) { arma_debug_sigprint(); } template arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&(Q.sv_row.m)) == void_ptr(&X)); } template arma_inline bool has_overlap(const subview& X) const { return is_alias(X.m); } }; template struct Proxy_subview_row_htrans_redirect {}; template struct Proxy_subview_row_htrans_redirect { typedef Proxy_subview_row_htrans_cx result; }; template struct Proxy_subview_row_htrans_redirect { typedef Proxy_subview_row_htrans_non_cx result; }; template struct Proxy< Op, op_htrans> > : public Proxy_subview_row_htrans_redirect < eT, is_cx::yes >::result { typedef typename Proxy_subview_row_htrans_redirect < eT, is_cx::yes >::result Proxy_sv_row_ht; typedef typename Proxy_sv_row_ht::elem_type elem_type; typedef typename Proxy_sv_row_ht::pod_type pod_type; typedef typename Proxy_sv_row_ht::stored_type stored_type; typedef typename Proxy_sv_row_ht::ea_type ea_type; typedef typename Proxy_sv_row_ht::ea_type aligned_ea_type; static constexpr bool use_at = Proxy_sv_row_ht::use_at; static constexpr bool use_mp = Proxy_sv_row_ht::use_mp; static constexpr bool has_subview = Proxy_sv_row_ht::has_subview; static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; using Proxy_sv_row_ht::Q; inline explicit Proxy(const Op, op_htrans>& A) : Proxy_sv_row_ht(A) { arma_debug_sigprint(); } arma_inline uword get_n_rows() const { return Q.n_rows; } constexpr uword get_n_cols() const { return 1; } arma_inline uword get_n_elem() const { return Q.n_elem; } arma_inline elem_type operator[] (const uword i) const { return Q[i]; } arma_inline elem_type at (const uword r, const uword) const { return Q[r]; } arma_inline elem_type at_alt (const uword i) const { return Q[i]; } arma_inline ea_type get_ea() const { return Q; } arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template arma_inline bool is_alias(const Mat& X) const { return Proxy_sv_row_ht::is_alias(X); } template arma_inline bool has_overlap(const subview& X) const { return Proxy_sv_row_ht::has_overlap(X); } constexpr bool is_aligned() const { return false; } }; template struct Proxy< Op, op_strans> > { typedef eT elem_type; typedef typename get_pod_type::result pod_type; typedef subview_row_strans stored_type; typedef const subview_row_strans& ea_type; typedef const subview_row_strans& aligned_ea_type; static constexpr bool use_at = false; static constexpr bool use_mp = false; static constexpr bool has_subview = true; static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; const subview_row_strans Q; inline explicit Proxy(const Op, op_strans>& A) : Q(A.m) { arma_debug_sigprint(); } arma_inline uword get_n_rows() const { return Q.n_rows; } constexpr uword get_n_cols() const { return 1; } arma_inline uword get_n_elem() const { return Q.n_elem; } arma_inline elem_type operator[] (const uword i) const { return Q[i]; } arma_inline elem_type at (const uword r, const uword) const { return Q[r]; } arma_inline elem_type at_alt (const uword i) const { return Q[i]; } arma_inline ea_type get_ea() const { return Q; } arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&(Q.sv_row.m)) == void_ptr(&X)); } template arma_inline bool has_overlap(const subview& X) const { return is_alias(X.m); } constexpr bool is_aligned() const { return false; } }; template struct Proxy< Op< Row< std::complex >, op_htrans> > { typedef typename std::complex eT; typedef typename std::complex elem_type; typedef T pod_type; typedef xvec_htrans stored_type; typedef const xvec_htrans& ea_type; typedef const xvec_htrans& aligned_ea_type; static constexpr bool use_at = false; static constexpr bool use_mp = false; static constexpr bool has_subview = false; static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; const xvec_htrans Q; const Row& src; inline explicit Proxy(const Op< Row< std::complex >, op_htrans>& A) : Q (A.m.memptr(), A.m.n_rows, A.m.n_cols) , src(A.m) { arma_debug_sigprint(); } arma_inline uword get_n_rows() const { return Q.n_rows; } constexpr uword get_n_cols() const { return 1; } arma_inline uword get_n_elem() const { return Q.n_elem; } arma_inline elem_type operator[] (const uword i) const { return Q[i]; } arma_inline elem_type at (const uword r, const uword) const { return Q[r]; } arma_inline elem_type at_alt (const uword i) const { return Q[i]; } arma_inline ea_type get_ea() const { return Q; } arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template arma_inline bool is_alias(const Mat& X) const { return void_ptr(&src) == void_ptr(&X); } template arma_inline bool has_overlap(const subview& X) const { return is_alias(X.m); } constexpr bool is_aligned() const { return false; } }; template struct Proxy< Op< Col< std::complex >, op_htrans> > { typedef typename std::complex eT; typedef typename std::complex elem_type; typedef T pod_type; typedef xvec_htrans stored_type; typedef const xvec_htrans& ea_type; typedef const xvec_htrans& aligned_ea_type; static constexpr bool use_at = false; static constexpr bool use_mp = false; static constexpr bool has_subview = false; static constexpr bool is_row = true; static constexpr bool is_col = false; static constexpr bool is_xvec = false; const xvec_htrans Q; const Col& src; inline explicit Proxy(const Op< Col< std::complex >, op_htrans>& A) : Q (A.m.memptr(), A.m.n_rows, A.m.n_cols) , src(A.m) { arma_debug_sigprint(); } constexpr uword get_n_rows() const { return 1; } arma_inline uword get_n_cols() const { return Q.n_cols; } arma_inline uword get_n_elem() const { return Q.n_elem; } arma_inline elem_type operator[] (const uword i) const { return Q[i]; } arma_inline elem_type at (const uword, const uword c) const { return Q[c]; } arma_inline elem_type at_alt (const uword i) const { return Q[i]; } arma_inline ea_type get_ea() const { return Q; } arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template arma_inline bool is_alias(const Mat& X) const { return void_ptr(&src) == void_ptr(&X); } template arma_inline bool has_overlap(const subview& X) const { return is_alias(X.m); } constexpr bool is_aligned() const { return false; } }; template struct Proxy< Op< subview_col< std::complex >, op_htrans> > { typedef typename std::complex eT; typedef typename std::complex elem_type; typedef T pod_type; typedef xvec_htrans stored_type; typedef const xvec_htrans& ea_type; typedef const xvec_htrans& aligned_ea_type; static constexpr bool use_at = false; static constexpr bool use_mp = false; static constexpr bool has_subview = true; static constexpr bool is_row = true; static constexpr bool is_col = false; static constexpr bool is_xvec = false; const xvec_htrans Q; const subview_col& src; inline explicit Proxy(const Op< subview_col< std::complex >, op_htrans>& A) : Q (A.m.colptr(0), A.m.n_rows, A.m.n_cols) , src(A.m) { arma_debug_sigprint(); } constexpr uword get_n_rows() const { return 1; } arma_inline uword get_n_cols() const { return Q.n_cols; } arma_inline uword get_n_elem() const { return Q.n_elem; } arma_inline elem_type operator[] (const uword i) const { return Q[i]; } arma_inline elem_type at (const uword, const uword c) const { return Q[c]; } arma_inline elem_type at_alt (const uword i) const { return Q[i]; } arma_inline ea_type get_ea() const { return Q; } arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template arma_inline bool is_alias(const Mat& X) const { return void_ptr(&src.m) == void_ptr(&X); } template arma_inline bool has_overlap(const subview& X) const { return is_alias(X.m); } constexpr bool is_aligned() const { return false; } }; template struct Proxy< Op > { typedef typename T1::elem_type elem_type; typedef typename get_pod_type::result pod_type; typedef eOp< Op, eop_scalar_times> stored_type; typedef const eOp< Op, eop_scalar_times>& ea_type; typedef const eOp< Op, eop_scalar_times>& aligned_ea_type; static constexpr bool use_at = eOp< Op, eop_scalar_times>::use_at; static constexpr bool use_mp = eOp< Op, eop_scalar_times>::use_mp; static constexpr bool has_subview = eOp< Op, eop_scalar_times>::has_subview; // NOTE: the Op class takes care of swapping row and col for op_htrans static constexpr bool is_row = eOp< Op, eop_scalar_times>::is_row; static constexpr bool is_col = eOp< Op, eop_scalar_times>::is_col; static constexpr bool is_xvec = eOp< Op, eop_scalar_times>::is_xvec; const Op R; const eOp< Op, eop_scalar_times > Q; inline explicit Proxy(const Op& A) : R(A.m) , Q(R, A.aux) { arma_debug_sigprint(); } arma_inline uword get_n_rows() const { return is_row ? 1 : Q.get_n_rows(); } arma_inline uword get_n_cols() const { return is_col ? 1 : Q.get_n_cols(); } arma_inline uword get_n_elem() const { return Q.get_n_elem(); } arma_inline elem_type operator[] (const uword i) const { return Q[i]; } arma_inline elem_type at (const uword r, const uword c) const { return Q.at(r, c); } arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); } arma_inline ea_type get_ea() const { return Q; } arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template arma_inline bool is_alias(const Mat& X) const { return Q.P.is_alias(X); } template arma_inline bool has_overlap(const subview& X) const { return is_alias(X.m); } arma_inline bool is_aligned() const { return Q.P.is_aligned(); } }; template struct Proxy< subview_row_strans > { typedef eT elem_type; typedef typename get_pod_type::result pod_type; typedef subview_row_strans stored_type; typedef const subview_row_strans& ea_type; typedef const subview_row_strans& aligned_ea_type; static constexpr bool use_at = false; static constexpr bool use_mp = false; static constexpr bool has_subview = true; static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; const subview_row_strans& Q; inline explicit Proxy(const subview_row_strans& A) : Q(A) { arma_debug_sigprint(); } arma_inline uword get_n_rows() const { return Q.n_rows; } constexpr uword get_n_cols() const { return 1; } arma_inline uword get_n_elem() const { return Q.n_elem; } arma_inline elem_type operator[] (const uword i) const { return Q[i]; } arma_inline elem_type at (const uword r, const uword) const { return Q[r]; } arma_inline elem_type at_alt (const uword i) const { return Q[i]; } arma_inline ea_type get_ea() const { return Q; } arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&(Q.sv_row.m)) == void_ptr(&X)); } template arma_inline bool has_overlap(const subview& X) const { return is_alias(X.m); } constexpr bool is_aligned() const { return false; } }; template struct Proxy< subview_row_htrans > { typedef eT elem_type; typedef typename get_pod_type::result pod_type; typedef subview_row_htrans stored_type; typedef const subview_row_htrans& ea_type; typedef const subview_row_htrans& aligned_ea_type; static constexpr bool use_at = false; static constexpr bool use_mp = false; static constexpr bool has_subview = true; static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; const subview_row_htrans& Q; inline explicit Proxy(const subview_row_htrans& A) : Q(A) { arma_debug_sigprint(); } arma_inline uword get_n_rows() const { return Q.n_rows; } constexpr uword get_n_cols() const { return 1; } arma_inline uword get_n_elem() const { return Q.n_elem; } arma_inline elem_type operator[] (const uword i) const { return Q[i]; } arma_inline elem_type at (const uword r, const uword) const { return Q[r]; } arma_inline elem_type at_alt (const uword i) const { return Q[i]; } arma_inline ea_type get_ea() const { return Q; } arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&(Q.sv_row.m)) == void_ptr(&X)); } template arma_inline bool has_overlap(const subview& X) const { return is_alias(X.m); } constexpr bool is_aligned() const { return false; } }; template struct Proxy< xtrans_mat > { typedef eT elem_type; typedef typename get_pod_type::result pod_type; typedef Mat stored_type; typedef const eT* ea_type; typedef const Mat& aligned_ea_type; static constexpr bool use_at = false; static constexpr bool use_mp = false; static constexpr bool has_subview = false; static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = false; const Mat Q; inline explicit Proxy(const xtrans_mat& A) : Q(A) { arma_debug_sigprint(); } arma_inline uword get_n_rows() const { return Q.n_rows; } arma_inline uword get_n_cols() const { return Q.n_cols; } arma_inline uword get_n_elem() const { return Q.n_elem; } arma_inline elem_type operator[] (const uword i) const { return Q[i]; } arma_inline elem_type at (const uword r, const uword c) const { return Q.at(r,c); } arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); } arma_inline ea_type get_ea() const { return Q.memptr(); } arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template constexpr bool is_alias(const Mat&) const { return false; } template constexpr bool has_overlap(const subview&) const { return false; } arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); } }; template struct Proxy< xvec_htrans > { typedef eT elem_type; typedef typename get_pod_type::result pod_type; typedef Mat stored_type; typedef const eT* ea_type; typedef const Mat& aligned_ea_type; static constexpr bool use_at = false; static constexpr bool use_mp = false; static constexpr bool has_subview = false; static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = true; const Mat Q; inline explicit Proxy(const xvec_htrans& A) : Q(A) { arma_debug_sigprint(); } arma_inline uword get_n_rows() const { return Q.n_rows; } arma_inline uword get_n_cols() const { return Q.n_cols; } arma_inline uword get_n_elem() const { return Q.n_elem; } arma_inline elem_type operator[] (const uword i) const { return Q[i]; } arma_inline elem_type at (const uword r, const uword c) const { return Q.at(r,c); } arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); } arma_inline ea_type get_ea() const { return Q.memptr(); } arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template constexpr bool is_alias(const Mat&) const { return false; } template constexpr bool has_overlap(const subview&) const { return false; } arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); } }; template struct Proxy_vectorise_col_mat { inline Proxy_vectorise_col_mat(const T1&) {} }; template struct Proxy_vectorise_col_mat< Op > { typedef typename T1::elem_type elem_type; typedef typename get_pod_type::result pod_type; typedef Mat stored_type; typedef const elem_type* ea_type; typedef const Mat& aligned_ea_type; static constexpr bool use_at = false; static constexpr bool use_mp = false; static constexpr bool has_subview = true; static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; const unwrap U; const Mat Q; inline explicit Proxy_vectorise_col_mat(const Op& A) : U(A.m) , Q(const_cast(U.M.memptr()), U.M.n_elem, 1, false, false) { arma_debug_sigprint(); } arma_inline uword get_n_rows() const { return Q.n_rows; } constexpr uword get_n_cols() const { return 1; } arma_inline uword get_n_elem() const { return Q.n_elem; } arma_inline elem_type operator[] (const uword i) const { return Q[i]; } arma_inline elem_type at (const uword r, const uword) const { return Q[r]; } arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); } arma_inline ea_type get_ea() const { return Q.memptr(); } arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template arma_inline bool is_alias(const Mat& X) const { return ( void_ptr(&X) == void_ptr(&(U.M)) ); } template arma_inline bool has_overlap(const subview& X) const { return is_alias(X.m); } arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); } }; template struct Proxy_vectorise_col_expr { inline Proxy_vectorise_col_expr(const T1&) {} }; template struct Proxy_vectorise_col_expr< Op > { typedef typename T1::elem_type elem_type; typedef typename get_pod_type::result pod_type; typedef Op stored_type; typedef typename Proxy::ea_type ea_type; typedef typename Proxy::aligned_ea_type aligned_ea_type; static constexpr bool use_at = false; static constexpr bool use_mp = Proxy::use_mp; static constexpr bool has_subview = Proxy::has_subview; static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; const Op& Q; const Proxy R; inline explicit Proxy_vectorise_col_expr(const Op& A) : Q(A) , R(A.m) { arma_debug_sigprint(); } arma_inline uword get_n_rows() const { return R.get_n_elem(); } constexpr uword get_n_cols() const { return 1; } arma_inline uword get_n_elem() const { return R.get_n_elem(); } arma_inline elem_type operator[] (const uword i) const { return R[i]; } arma_inline elem_type at (const uword r, const uword) const { return R.at(r, 0); } arma_inline elem_type at_alt (const uword i) const { return R.at_alt(i); } arma_inline ea_type get_ea() const { return R.get_ea(); } arma_inline aligned_ea_type get_aligned_ea() const { return R.get_aligned_ea(); } template arma_inline bool is_alias(const Mat& X) const { return R.is_alias(X); } template arma_inline bool has_overlap(const subview& X) const { return is_alias(X.m); } arma_inline bool is_aligned() const { return R.is_aligned(); } }; template struct Proxy_vectorise_col_redirect {}; template struct Proxy_vectorise_col_redirect< Op, true > { typedef Proxy_vectorise_col_mat < Op > result; }; template struct Proxy_vectorise_col_redirect< Op, false> { typedef Proxy_vectorise_col_expr< Op > result; }; template struct Proxy< Op > : public Proxy_vectorise_col_redirect< Op, (Proxy::use_at) >::result { typedef typename Proxy_vectorise_col_redirect< Op, (Proxy::use_at) >::result Proxy_vectorise_col; inline explicit Proxy(const Op& A) : Proxy_vectorise_col(A) { arma_debug_sigprint(); } }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_find_bones.hpp0000644000176200001440000000664615030507611023717 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_find //! @{ class op_find : public traits_op_col { public: template inline static uword helper ( Mat& indices, const Base& X ); template inline static uword helper ( Mat& indices, const mtOp& X, const typename arma_op_rel_only::result* junk1 = nullptr, const typename arma_not_cx::result* junk2 = nullptr ); template inline static uword helper ( Mat& indices, const mtOp& X, const typename arma_op_rel_only::result* junk1 = nullptr, const typename arma_cx_only::result* junk2 = nullptr ); template inline static uword helper ( Mat& indices, const mtGlue& X, const typename arma_glue_rel_only::result* junk1 = nullptr, const typename arma_not_cx::result* junk2 = nullptr, const typename arma_not_cx::result* junk3 = nullptr ); template inline static uword helper ( Mat& indices, const mtGlue& X, const typename arma_glue_rel_only::result* junk1 = nullptr, const typename arma_cx_only::result* junk2 = nullptr, const typename arma_cx_only::result* junk3 = nullptr ); template inline static void apply(Mat& out, const mtOp& X); }; class op_find_simple : public traits_op_col { public: template inline static void apply(Mat& out, const mtOp& X); }; class op_find_finite : public traits_op_col { public: template inline static void apply(Mat& out, const mtOp& X); }; class op_find_nonfinite : public traits_op_col { public: template inline static void apply(Mat& out, const mtOp& X); }; class op_find_nan : public traits_op_col { public: template inline static void apply(Mat& out, const mtOp& X); }; class op_find_nonnan : public traits_op_col { public: template inline static void apply(Mat& out, const mtOp& X); }; //! @} RcppArmadillo/inst/include/armadillo_bits/SpMat_iterators_meat.hpp0000644000176200001440000006115415013306507025236 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup SpMat //! @{ /////////////////////////////////////////////////////////////////////////////// // SpMat::iterator_base implementation // /////////////////////////////////////////////////////////////////////////////// template inline SpMat::iterator_base::iterator_base() : M(nullptr) , internal_col(0) , internal_pos(0) { // Technically this iterator is invalid (it does not point to a valid element) } template inline SpMat::iterator_base::iterator_base(const SpMat& in_M) : M(&in_M) , internal_col(0) , internal_pos(0) { // Technically this iterator is invalid (it may not point to a valid element) } template inline SpMat::iterator_base::iterator_base(const SpMat& in_M, const uword in_col, const uword in_pos) : M(&in_M) , internal_col(in_col) , internal_pos(in_pos) { // Nothing to do. } template arma_inline eT SpMat::iterator_base::operator*() const { return M->values[internal_pos]; } /////////////////////////////////////////////////////////////////////////////// // SpMat::const_iterator implementation // /////////////////////////////////////////////////////////////////////////////// template inline SpMat::const_iterator::const_iterator() : iterator_base() { } template inline SpMat::const_iterator::const_iterator(const SpMat& in_M, uword initial_pos) : iterator_base(in_M, 0, initial_pos) { // Corner case for empty matrices. if(in_M.n_nonzero == 0) { iterator_base::internal_col = in_M.n_cols; return; } // Determine which column we should be in. while(iterator_base::M->col_ptrs[iterator_base::internal_col + 1] <= iterator_base::internal_pos) { iterator_base::internal_col++; } } template inline SpMat::const_iterator::const_iterator(const SpMat& in_M, uword in_row, uword in_col) : iterator_base(in_M, in_col, 0) { // So we have a position we want to be right after. Skip to the column. iterator_base::internal_pos = iterator_base::M->col_ptrs[iterator_base::internal_col]; // Now we have to make sure that is the right column. while(iterator_base::M->col_ptrs[iterator_base::internal_col + 1] <= iterator_base::internal_pos) { iterator_base::internal_col++; } // Now we have to get to the right row. while((iterator_base::M->row_indices[iterator_base::internal_pos] < in_row) && (iterator_base::internal_col == in_col)) { ++(*this); // Increment iterator. } } template inline SpMat::const_iterator::const_iterator(const SpMat& in_M, const uword /* in_row */, const uword in_col, const uword in_pos) : iterator_base(in_M, in_col, in_pos) { // Nothing to do. } template inline SpMat::const_iterator::const_iterator(const typename SpMat::const_iterator& other) : iterator_base(*other.M, other.internal_col, other.internal_pos) { // Nothing to do. } template inline typename SpMat::const_iterator& SpMat::const_iterator::operator++() { ++iterator_base::internal_pos; if(iterator_base::internal_pos == iterator_base::M->n_nonzero) { iterator_base::internal_col = iterator_base::M->n_cols; return *this; } // Check to see if we moved a column. while(iterator_base::M->col_ptrs[iterator_base::internal_col + 1] <= iterator_base::internal_pos) { ++iterator_base::internal_col; } return *this; } template inline typename SpMat::const_iterator SpMat::const_iterator::operator++(int) { typename SpMat::const_iterator tmp(*this); ++(*this); return tmp; } template inline typename SpMat::const_iterator& SpMat::const_iterator::operator--() { --iterator_base::internal_pos; // First, see if we moved back a column. while(iterator_base::internal_pos < iterator_base::M->col_ptrs[iterator_base::internal_col]) { --iterator_base::internal_col; } return *this; } template inline typename SpMat::const_iterator SpMat::const_iterator::operator--(int) { typename SpMat::const_iterator tmp(*this); --(*this); return tmp; } template inline bool SpMat::const_iterator::operator==(const const_iterator& rhs) const { return (rhs.row() == (*this).row()) && (rhs.col() == iterator_base::internal_col); } template inline bool SpMat::const_iterator::operator!=(const const_iterator& rhs) const { return (rhs.row() != (*this).row()) || (rhs.col() != iterator_base::internal_col); } template inline bool SpMat::const_iterator::operator==(const typename SpSubview::const_iterator& rhs) const { return (rhs.row() == (*this).row()) && (rhs.col() == iterator_base::internal_col); } template inline bool SpMat::const_iterator::operator!=(const typename SpSubview::const_iterator& rhs) const { return (rhs.row() != (*this).row()) || (rhs.col() != iterator_base::internal_col); } template inline bool SpMat::const_iterator::operator==(const const_row_iterator& rhs) const { return (rhs.row() == (*this).row()) && (rhs.col() == iterator_base::internal_col); } template inline bool SpMat::const_iterator::operator!=(const const_row_iterator& rhs) const { return (rhs.row() != (*this).row()) || (rhs.col() != iterator_base::internal_col); } template inline bool SpMat::const_iterator::operator==(const typename SpSubview::const_row_iterator& rhs) const { return (rhs.row() == (*this).row()) && (rhs.col() == iterator_base::internal_col); } template inline bool SpMat::const_iterator::operator!=(const typename SpSubview::const_row_iterator& rhs) const { return (rhs.row() != (*this).row()) || (rhs.col() != iterator_base::internal_col); } /////////////////////////////////////////////////////////////////////////////// // SpMat::iterator implementation // /////////////////////////////////////////////////////////////////////////////// template inline SpValProxy< SpMat > SpMat::iterator::operator*() { return SpValProxy< SpMat >( iterator_base::M->row_indices[iterator_base::internal_pos], iterator_base::internal_col, access::rw(*iterator_base::M), &access::rw(iterator_base::M->values[iterator_base::internal_pos])); } template inline typename SpMat::iterator& SpMat::iterator::operator++() { const_iterator::operator++(); return *this; } template inline typename SpMat::iterator SpMat::iterator::operator++(int) { typename SpMat::iterator tmp(*this); const_iterator::operator++(); return tmp; } template inline typename SpMat::iterator& SpMat::iterator::operator--() { const_iterator::operator--(); return *this; } template inline typename SpMat::iterator SpMat::iterator::operator--(int) { typename SpMat::iterator tmp(*this); const_iterator::operator--(); return tmp; } /////////////////////////////////////////////////////////////////////////////// // SpMat::const_row_iterator implementation // /////////////////////////////////////////////////////////////////////////////// /** * Initialize the const_row_iterator. */ template inline SpMat::const_row_iterator::const_row_iterator() : iterator_base() , internal_row(0) , actual_pos(0) { } template inline SpMat::const_row_iterator::const_row_iterator(const SpMat& in_M, uword initial_pos) : iterator_base(in_M, 0, initial_pos) , internal_row(0) , actual_pos(0) { // Corner case for the end of a matrix. if(initial_pos == in_M.n_nonzero) { iterator_base::internal_col = 0; internal_row = in_M.n_rows; actual_pos = in_M.n_nonzero; iterator_base::internal_pos = in_M.n_nonzero; return; } // We don't count zeros in our position count, so we have to find the nonzero // value corresponding to the given initial position. We assume initial_pos // is valid. // This is irritating because we don't know where the elements are in each row. // What we will do is loop across all columns looking for elements in row 0 // (and add to our sum), then in row 1, and so forth, until we get to the desired position. uword cur_pos = std::numeric_limits::max(); // Invalid value. uword cur_actual_pos = 0; for(uword row = 0; row < iterator_base::M->n_rows; ++row) { for(uword col = 0; col < iterator_base::M->n_cols; ++col) { // Find the first element with row greater than or equal to in_row. const uword col_offset = iterator_base::M->col_ptrs[col ]; const uword next_col_offset = iterator_base::M->col_ptrs[col + 1]; const uword* start_ptr = &iterator_base::M->row_indices[ col_offset]; const uword* end_ptr = &iterator_base::M->row_indices[next_col_offset]; if(start_ptr != end_ptr) { const uword* pos_ptr = std::lower_bound(start_ptr, end_ptr, row); // This is the number of elements in the column with row index less than in_row. const uword offset = uword(pos_ptr - start_ptr); if(iterator_base::M->row_indices[col_offset + offset] == row) { cur_actual_pos = col_offset + offset; // Increment position portably. if(cur_pos == std::numeric_limits::max()) { cur_pos = 0; } else { ++cur_pos; } // Do we terminate? if(cur_pos == initial_pos) { internal_row = row; iterator_base::internal_col = col; iterator_base::internal_pos = cur_pos; actual_pos = cur_actual_pos; return; } } } } } // If we got to here, then we have gone past the end of the matrix. // This shouldn't happen... iterator_base::internal_pos = iterator_base::M->n_nonzero; iterator_base::internal_col = 0; internal_row = iterator_base::M->n_rows; actual_pos = iterator_base::M->n_nonzero; } template inline SpMat::const_row_iterator::const_row_iterator(const SpMat& in_M, uword in_row, uword in_col) : iterator_base(in_M, in_col, 0) , internal_row(0) , actual_pos(0) { // Start our search in the given row. We need to find two things: // // 1. The first nonzero element (iterating by rows) after (in_row, in_col). // 2. The number of nonzero elements (iterating by rows) that come before // (in_row, in_col). // // We'll find these simultaneously, though we will have to loop over all // columns. // This will hold the total number of points with rows less than in_row. uword cur_pos = 0; uword cur_min_row = iterator_base::M->n_rows; uword cur_min_col = 0; uword cur_actual_pos = 0; for(uword col = 0; col < iterator_base::M->n_cols; ++col) { // Find the first element with row greater than or equal to in_row. const uword col_offset = iterator_base::M->col_ptrs[col ]; const uword next_col_offset = iterator_base::M->col_ptrs[col + 1]; const uword* start_ptr = &iterator_base::M->row_indices[ col_offset]; const uword* end_ptr = &iterator_base::M->row_indices[next_col_offset]; if(start_ptr != end_ptr) { const uword* pos_ptr = std::lower_bound(start_ptr, end_ptr, in_row); // This is the number of elements in the column with row index less than in_row. const uword offset = uword(pos_ptr - start_ptr); cur_pos += offset; if(pos_ptr != end_ptr) { // This is the row index of the first element in the column with row index // greater than or equal to in_row. if((*pos_ptr) < cur_min_row) { // If we are in the desired row but before the desired column, // we can't take this. if(col >= in_col) { cur_min_row = (*pos_ptr); cur_min_col = col; cur_actual_pos = col_offset + offset; } } } } } // Now we know what the minimum row is. internal_row = cur_min_row; iterator_base::internal_col = cur_min_col; iterator_base::internal_pos = cur_pos; actual_pos = cur_actual_pos; } /** * Initialize the const_row_iterator from another const_row_iterator. */ template inline SpMat::const_row_iterator::const_row_iterator(const typename SpMat::const_row_iterator& other) : iterator_base(*other.M, other.internal_col, other.internal_pos) , internal_row(other.internal_row) , actual_pos(other.actual_pos) { // Nothing to do. } /** * Increment the row_iterator. */ template inline typename SpMat::const_row_iterator& SpMat::const_row_iterator::operator++() { // We just need to find the next nonzero element. iterator_base::internal_pos++; if(iterator_base::internal_pos == iterator_base::M->n_nonzero) { internal_row = iterator_base::M->n_rows; iterator_base::internal_col = 0; return *this; } // Otherwise, we need to search. We can start in the next column and use // lower_bound() to find the next element. uword next_min_row = iterator_base::M->n_rows; uword next_min_col = iterator_base::M->n_cols; uword next_actual_pos = 0; // Search from the current column to the end of the matrix. for(uword col = iterator_base::internal_col + 1; col < iterator_base::M->n_cols; ++col) { // Find the first element with row greater than or equal to in_row. const uword col_offset = iterator_base::M->col_ptrs[col ]; const uword next_col_offset = iterator_base::M->col_ptrs[col + 1]; const uword* start_ptr = &iterator_base::M->row_indices[ col_offset]; const uword* end_ptr = &iterator_base::M->row_indices[next_col_offset]; if(start_ptr != end_ptr) { // Find the first element in the column with row greater than or equal to // the current row. const uword* pos_ptr = std::lower_bound(start_ptr, end_ptr, internal_row); if(pos_ptr != end_ptr) { // We found something in the column, but is the row index correct? if((*pos_ptr) == internal_row) { // Exact match---so we are done. iterator_base::internal_col = col; actual_pos = col_offset + (pos_ptr - start_ptr); return *this; } else if((*pos_ptr) < next_min_row) { // The first element in this column is in a subsequent row, but it's // the minimum row we've seen so far. next_min_row = (*pos_ptr); next_min_col = col; next_actual_pos = col_offset + (pos_ptr - start_ptr); } else if((*pos_ptr) == next_min_row && col < next_min_col) { // The first element in this column is in a subsequent row that we // already have another element for, but the column index is less so // this element will come first. next_min_col = col; next_actual_pos = col_offset + (pos_ptr - start_ptr); } } } } // Restart the search in the next row. for(uword col = 0; col <= iterator_base::internal_col; ++col) { // Find the first element with row greater than or equal to in_row + 1. const uword col_offset = iterator_base::M->col_ptrs[col ]; const uword next_col_offset = iterator_base::M->col_ptrs[col + 1]; const uword* start_ptr = &iterator_base::M->row_indices[ col_offset]; const uword* end_ptr = &iterator_base::M->row_indices[next_col_offset]; if(start_ptr != end_ptr) { const uword* pos_ptr = std::lower_bound(start_ptr, end_ptr, internal_row + 1); if(pos_ptr != end_ptr) { // We found something in the column, but is the row index correct? if((*pos_ptr) == internal_row + 1) { // Exact match---so we are done. iterator_base::internal_col = col; internal_row++; actual_pos = col_offset + (pos_ptr - start_ptr); return *this; } else if((*pos_ptr) < next_min_row) { // The first element in this column is in a subsequent row, // but it's the minimum row we've seen so far. next_min_row = (*pos_ptr); next_min_col = col; next_actual_pos = col_offset + (pos_ptr - start_ptr); } else if((*pos_ptr) == next_min_row && col < next_min_col) { // The first element in this column is in a subsequent row that we // already have another element for, but the column index is less so // this element will come first. next_min_col = col; next_actual_pos = col_offset + (pos_ptr - start_ptr); } } } } iterator_base::internal_col = next_min_col; internal_row = next_min_row; actual_pos = next_actual_pos; return *this; // Now we are done. } /** * Increment the row_iterator (but do not return anything. */ template inline typename SpMat::const_row_iterator SpMat::const_row_iterator::operator++(int) { typename SpMat::const_row_iterator tmp(*this); ++(*this); return tmp; } /** * Decrement the row_iterator. */ template inline typename SpMat::const_row_iterator& SpMat::const_row_iterator::operator--() { if(iterator_base::internal_pos == 0) { // Do nothing; we are already at the beginning. return *this; } iterator_base::internal_pos--; // We have to search backwards. We'll do this by going backwards over columns // and seeing if we find an element in the same row. uword max_row = 0; uword max_col = 0; uword next_actual_pos = 0; //for(uword col = iterator_base::internal_col; col > 1; --col) for(uword col = iterator_base::internal_col; col >= 1; --col) { // Find the first element with row greater than or equal to in_row + 1. const uword col_offset = iterator_base::M->col_ptrs[col - 1]; const uword next_col_offset = iterator_base::M->col_ptrs[col ]; const uword* start_ptr = &iterator_base::M->row_indices[ col_offset]; const uword* end_ptr = &iterator_base::M->row_indices[next_col_offset]; if(start_ptr != end_ptr) { // There are elements in this column. const uword* pos_ptr = std::lower_bound(start_ptr, end_ptr, internal_row + 1); if(pos_ptr != start_ptr) { // The element before pos_ptr is the one we are interested in. if(*(pos_ptr - 1) > max_row) { max_row = *(pos_ptr - 1); max_col = col - 1; next_actual_pos = col_offset + (pos_ptr - 1 - start_ptr); } else if(*(pos_ptr - 1) == max_row && (col - 1) > max_col) { max_col = col - 1; next_actual_pos = col_offset + (pos_ptr - 1 - start_ptr); } } } } // Now loop around to the columns at the end of the matrix. for(uword col = iterator_base::M->n_cols - 1; col >= iterator_base::internal_col; --col) { // Find the first element with row greater than or equal to in_row + 1. const uword col_offset = iterator_base::M->col_ptrs[col ]; const uword next_col_offset = iterator_base::M->col_ptrs[col + 1]; const uword* start_ptr = &iterator_base::M->row_indices[ col_offset]; const uword* end_ptr = &iterator_base::M->row_indices[next_col_offset]; if(start_ptr != end_ptr) { // There are elements in this column. const uword* pos_ptr = std::lower_bound(start_ptr, end_ptr, internal_row); if(pos_ptr != start_ptr) { // There are elements in this column with row index < internal_row. if(*(pos_ptr - 1) > max_row) { max_row = *(pos_ptr - 1); max_col = col; next_actual_pos = col_offset + (pos_ptr - 1 - start_ptr); } else if(*(pos_ptr - 1) == max_row && col > max_col) { max_col = col; next_actual_pos = col_offset + (pos_ptr - 1 - start_ptr); } } } if(col == 0) // Catch edge case that the loop termination condition won't. { break; } } iterator_base::internal_col = max_col; internal_row = max_row; actual_pos = next_actual_pos; return *this; } /** * Decrement the row_iterator. */ template inline typename SpMat::const_row_iterator SpMat::const_row_iterator::operator--(int) { typename SpMat::const_row_iterator tmp(*this); --(*this); return tmp; } template inline bool SpMat::const_row_iterator::operator==(const const_iterator& rhs) const { return (rhs.row() == row()) && (rhs.col() == iterator_base::internal_col); } template inline bool SpMat::const_row_iterator::operator!=(const const_iterator& rhs) const { return (rhs.row() != row()) || (rhs.col() != iterator_base::internal_col); } template inline bool SpMat::const_row_iterator::operator==(const typename SpSubview::const_iterator& rhs) const { return (rhs.row() == row()) && (rhs.col() == iterator_base::internal_col); } template inline bool SpMat::const_row_iterator::operator!=(const typename SpSubview::const_iterator& rhs) const { return (rhs.row() != row()) || (rhs.col() != iterator_base::internal_col); } template inline bool SpMat::const_row_iterator::operator==(const const_row_iterator& rhs) const { return (rhs.row() == row()) && (rhs.col() == iterator_base::internal_col); } template inline bool SpMat::const_row_iterator::operator!=(const const_row_iterator& rhs) const { return (rhs.row() != row()) || (rhs.col() != iterator_base::internal_col); } template inline bool SpMat::const_row_iterator::operator==(const typename SpSubview::const_row_iterator& rhs) const { return (rhs.row() == row()) && (rhs.col() == iterator_base::internal_col); } template inline bool SpMat::const_row_iterator::operator!=(const typename SpSubview::const_row_iterator& rhs) const { return (rhs.row() != row()) || (rhs.col() != iterator_base::internal_col); } /////////////////////////////////////////////////////////////////////////////// // SpMat::row_iterator implementation // /////////////////////////////////////////////////////////////////////////////// template inline SpValProxy< SpMat > SpMat::row_iterator::operator*() { return SpValProxy< SpMat >( const_row_iterator::internal_row, iterator_base::internal_col, access::rw(*iterator_base::M), &access::rw(iterator_base::M->values[const_row_iterator::actual_pos])); } template inline typename SpMat::row_iterator& SpMat::row_iterator::operator++() { const_row_iterator::operator++(); return *this; } template inline typename SpMat::row_iterator SpMat::row_iterator::operator++(int) { typename SpMat::row_iterator tmp(*this); const_row_iterator::operator++(); return tmp; } template inline typename SpMat::row_iterator& SpMat::row_iterator::operator--() { const_row_iterator::operator--(); return *this; } template inline typename SpMat::row_iterator SpMat::row_iterator::operator--(int) { typename SpMat::row_iterator tmp(*this); const_row_iterator::operator--(); return tmp; } //! @} RcppArmadillo/inst/include/armadillo_bits/op_vecnorm_meat.hpp0000644000176200001440000001373614631567470024305 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_vecnorm //! @{ template inline void op_vecnorm::apply(Mat& out, const mtOp& in) { arma_debug_sigprint(); typedef typename T1::elem_type in_eT; typedef typename T1::pod_type out_eT; const quasi_unwrap U(in.m); const Mat& X = U.M; const uword k = in.aux_uword_a; const uword dim = in.aux_uword_b; arma_conform_check( (k == 0), "vecnorm(): unsupported vector norm type" ); arma_conform_check( (dim > 1), "vecnorm(): parameter 'dim' must be 0 or 1" ); if(U.is_alias(out)) { Mat tmp; op_vecnorm::apply_noalias(tmp, X, k, dim); out.steal_mem(tmp); } else { op_vecnorm::apply_noalias(out, X, k, dim); } } template inline void op_vecnorm::apply_noalias(Mat::result>& out, const Mat& X, const uword k, const uword dim) { arma_debug_sigprint(); typedef typename get_pod_type::result out_eT; const uword X_n_rows = X.n_rows; const uword X_n_cols = X.n_cols; if(dim == 0) { arma_debug_print("op_vecnorm::apply(): dim = 0"); out.set_size((X_n_rows > 0) ? 1 : 0, X_n_cols); if(X_n_rows > 0) { out_eT* out_mem = out.memptr(); for(uword col=0; col < X_n_cols; ++col) { op_vecnorm::apply_rawmem( out_mem[col], X.colptr(col), X_n_rows, k ); } } } else if(dim == 1) { arma_debug_print("op_vecnorm::apply(): dim = 1"); out.set_size(X_n_rows, (X_n_cols > 0) ? 1 : 0); if(X_n_cols > 0) { podarray dat(X_n_cols); in_eT* dat_mem = dat.memptr(); out_eT* out_mem = out.memptr(); for(uword row=0; row < X_n_rows; ++row) { dat.copy_row(X, row); op_vecnorm::apply_rawmem( out_mem[row], dat_mem, X_n_cols, k ); } } } } template inline void op_vecnorm::apply_rawmem(typename get_pod_type::result& out_val, const in_eT* mem, const uword N, const uword k) { arma_debug_sigprint(); typedef typename get_pod_type::result out_eT; const Col tmp(const_cast(mem), N, false, false); const Proxy< Col > P(tmp); if(P.get_n_elem() == 0) { out_val = out_eT(0); return; } if(k == uword(1)) { out_val = op_norm::vec_norm_1(P); return; } if(k == uword(2)) { out_val = op_norm::vec_norm_2(P); return; } out_val = op_norm::vec_norm_k(P, int(k)); } // template inline void op_vecnorm_ext::apply(Mat& out, const mtOp& in) { arma_debug_sigprint(); typedef typename T1::elem_type in_eT; typedef typename T1::pod_type out_eT; const quasi_unwrap U(in.m); const Mat& X = U.M; const uword method_id = in.aux_uword_a; const uword dim = in.aux_uword_b; arma_conform_check( (method_id == 0), "vecnorm(): unsupported vector norm type" ); arma_conform_check( (dim > 1), "vecnorm(): parameter 'dim' must be 0 or 1" ); if(U.is_alias(out)) { Mat tmp; op_vecnorm_ext::apply_noalias(tmp, X, method_id, dim); out.steal_mem(tmp); } else { op_vecnorm_ext::apply_noalias(out, X, method_id, dim); } } template inline void op_vecnorm_ext::apply_noalias(Mat::result>& out, const Mat& X, const uword method_id, const uword dim) { arma_debug_sigprint(); typedef typename get_pod_type::result out_eT; const uword X_n_rows = X.n_rows; const uword X_n_cols = X.n_cols; if(dim == 0) { arma_debug_print("op_vecnorm_ext::apply(): dim = 0"); out.set_size((X_n_rows > 0) ? 1 : 0, X_n_cols); if(X_n_rows > 0) { out_eT* out_mem = out.memptr(); for(uword col=0; col < X_n_cols; ++col) { op_vecnorm_ext::apply_rawmem( out_mem[col], X.colptr(col), X_n_rows, method_id ); } } } else if(dim == 1) { arma_debug_print("op_vecnorm_ext::apply(): dim = 1"); out.set_size(X_n_rows, (X_n_cols > 0) ? 1 : 0); if(X_n_cols > 0) { podarray dat(X_n_cols); in_eT* dat_mem = dat.memptr(); out_eT* out_mem = out.memptr(); for(uword row=0; row < X_n_rows; ++row) { dat.copy_row(X, row); op_vecnorm_ext::apply_rawmem( out_mem[row], dat_mem, X_n_cols, method_id ); } } } } template inline void op_vecnorm_ext::apply_rawmem(typename get_pod_type::result& out_val, const in_eT* mem, const uword N, const uword method_id) { arma_debug_sigprint(); typedef typename get_pod_type::result out_eT; const Col tmp(const_cast(mem), N, false, false); const Proxy< Col > P(tmp); if(P.get_n_elem() == 0) { out_val = out_eT(0); return; } if(method_id == uword(1)) { out_val = op_norm::vec_norm_max(P); return; } if(method_id == uword(2)) { out_val = op_norm::vec_norm_min(P); return; } out_val = out_eT(0); } //! @} RcppArmadillo/inst/include/armadillo_bits/GenCube_bones.hpp0000644000176200001440000000406614752446051023615 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup GenCube //! @{ //! support class for generator functions (zeros, ones) template class GenCube : public BaseCube< eT, GenCube > { public: typedef eT elem_type; typedef typename get_pod_type::result pod_type; static constexpr bool use_at = false; static constexpr bool is_simple = (is_same_type::value) || (is_same_type::value); const uword n_rows; const uword n_cols; const uword n_slices; arma_inline GenCube(const uword in_n_rows, const uword in_n_cols, const uword in_n_slices); arma_inline ~GenCube(); arma_inline eT operator[] (const uword i) const; arma_inline eT at (const uword r, const uword c, const uword s) const; arma_inline eT at_alt (const uword i) const; inline void apply (Cube& out) const; inline void apply_inplace_plus (Cube& out) const; inline void apply_inplace_minus(Cube& out) const; inline void apply_inplace_schur(Cube& out) const; inline void apply_inplace_div (Cube& out) const; inline void apply(subview_cube& out) const; }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_shuffle_meat.hpp0000644000176200001440000001276515030507611024252 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_shuffle //! @{ template inline void op_shuffle::apply_direct(Mat& out, const Mat& X, const uword dim) { arma_debug_sigprint(); if(X.is_empty()) { out.copy_size(X); return; } const uword N = (dim == 0) ? X.n_rows : X.n_cols; // see op_sort_index_bones.hpp for the definition of arma_sort_index_packet // and the associated comparison functor typedef arma_sort_index_packet packet; std::vector packet_vec(N); podarray tmp(N); int* tmp_mem = tmp.memptr(); const int a = 0; const int b = arma_rng::randi::max_val(); arma_rng::randi::fill(tmp_mem, N, a, b); for(uword i=0; i comparator; std::sort( packet_vec.begin(), packet_vec.end(), comparator ); const bool is_alias = (&out == &X); if(X.is_vec() == false) { if(is_alias == false) { arma_debug_print("op_shuffle::apply(): matrix"); out.copy_size(X); if(dim == 0) { for(uword i=0; i 1) // ie. column vector { for(uword i=0; i 1) // ie. row vector { for(uword i=0; i 1) // ie. column vector { for(uword i=0; i 1) // ie. row vector { for(uword i=0; i inline void op_shuffle::apply(Mat& out, const Op& in) { arma_debug_sigprint(); const unwrap U(in.m); const uword dim = in.aux_uword_a; arma_conform_check( (dim > 1), "shuffle(): parameter 'dim' must be 0 or 1" ); op_shuffle::apply_direct(out, U.M, dim); } template inline void op_shuffle_vec::apply(Mat& out, const Op& in) { arma_debug_sigprint(); const unwrap U(in.m); const uword dim = (T1::is_xvec) ? uword(U.M.is_rowvec() ? 1 : 0) : uword((T1::is_row) ? 1 : 0); op_shuffle::apply_direct(out, U.M, dim); } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_symmat.hpp0000644000176200001440000000666314631567470023126 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_symmat //! @{ template arma_warn_unused arma_inline typename enable_if2< is_cx::no, const Op >::result symmatu(const Base& X, const bool do_conj = false) { arma_debug_sigprint(); arma_ignore(do_conj); return Op(X.get_ref()); } template arma_warn_unused arma_inline typename enable_if2< is_cx::no, const Op >::result symmatl(const Base& X, const bool do_conj = false) { arma_debug_sigprint(); arma_ignore(do_conj); return Op(X.get_ref()); } template arma_warn_unused arma_inline typename enable_if2< is_cx::yes, const Op >::result symmatu(const Base& X, const bool do_conj = true) { arma_debug_sigprint(); return Op(X.get_ref(), 0, (do_conj ? 1 : 0)); } template arma_warn_unused arma_inline typename enable_if2< is_cx::yes, const Op >::result symmatl(const Base& X, const bool do_conj = true) { arma_debug_sigprint(); return Op(X.get_ref(), 0, (do_conj ? 1 : 0)); } // template arma_warn_unused arma_inline typename enable_if2< is_cx::no, const SpOp >::result symmatu(const SpBase& X, const bool do_conj = false) { arma_debug_sigprint(); arma_ignore(do_conj); return SpOp(X.get_ref(), 0, 0); } template arma_warn_unused arma_inline typename enable_if2< is_cx::no, const SpOp >::result symmatl(const SpBase& X, const bool do_conj = false) { arma_debug_sigprint(); arma_ignore(do_conj); return SpOp(X.get_ref(), 1, 0); } template arma_warn_unused arma_inline typename enable_if2< is_cx::yes, const SpOp >::result symmatu(const SpBase& X, const bool do_conj = true) { arma_debug_sigprint(); return SpOp(X.get_ref(), 0, (do_conj ? 1 : 0)); } template arma_warn_unused arma_inline typename enable_if2< is_cx::yes, const SpOp >::result symmatl(const SpBase& X, const bool do_conj = true) { arma_debug_sigprint(); return SpOp(X.get_ref(), 1, (do_conj ? 1 : 0)); } //! @} RcppArmadillo/inst/include/armadillo_bits/op_log_det_meat.hpp0000644000176200001440000001437214713753317024244 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_log_det //! @{ template inline bool op_log_det::apply_direct(typename T1::elem_type& out_val, typename T1::pod_type& out_sign, const Base& expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; // typedef typename T1::pod_type T; if(strip_diagmat::do_diagmat) { const strip_diagmat strip(expr.get_ref()); return op_log_det::apply_diagmat(out_val, out_sign, strip.M); } if(strip_trimat::do_trimat) { const strip_trimat strip(expr.get_ref()); return op_log_det::apply_trimat(out_val, out_sign, strip.M); } Mat A(expr.get_ref()); arma_conform_check( (A.is_square() == false), "log_det(): given matrix must be square sized" ); if(A.is_diagmat()) { return op_log_det::apply_diagmat(out_val, out_sign, A); } const bool is_triu = trimat_helper::is_triu(A); const bool is_tril = is_triu ? false : trimat_helper::is_tril(A); if(is_triu || is_tril) { return op_log_det::apply_trimat(out_val, out_sign, A); } // const bool try_sympd = arma_config::optimise_sym && sym_helper::guess_sympd(A); // // if(try_sympd) // { // arma_debug_print("op_log_det: attempting sympd optimisation"); // // T out_val_real = T(0); // // const bool status = auxlib::log_det_sympd(out_val_real, A); // // if(status) // { // out_val = eT(out_val_real); // out_sign = T(1); // // return true; // } // // arma_debug_print("op_log_det: sympd optimisation failed"); // // // restore A as it's destroyed by auxlib::log_det_sympd() // A = expr.get_ref(); // // // fallthrough to the next return statement // } return auxlib::log_det(out_val, out_sign, A); } template inline bool op_log_det::apply_diagmat(typename T1::elem_type& out_val, typename T1::pod_type& out_sign, const Base& expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; typedef typename T1::pod_type T; const diagmat_proxy A(expr.get_ref()); arma_conform_check( (A.n_rows != A.n_cols), "log_det(): given matrix must be square sized" ); const uword N = (std::min)(A.n_rows, A.n_cols); if(N == 0) { out_val = eT(0); out_sign = T(1); return true; } eT x = A[0]; T sign = (is_cx::no) ? ( (access::tmp_real(x) < T(0)) ? T(-1) : T(1) ) : T(1); eT val = (is_cx::no) ? std::log( (access::tmp_real(x) < T(0)) ? x*T(-1) : x ) : std::log(x); for(uword i=1; i::no) ? ( (access::tmp_real(x) < T(0)) ? T(-1) : T(1) ) : T(1); val += (is_cx::no) ? std::log( (access::tmp_real(x) < T(0)) ? x*T(-1) : x ) : std::log(x); } out_val = val; out_sign = sign; return (arma_isnan(out_val) == false); } template inline bool op_log_det::apply_trimat(typename T1::elem_type& out_val, typename T1::pod_type& out_sign, const Base& expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; typedef typename T1::pod_type T; const Proxy P(expr.get_ref()); const uword N = P.get_n_rows(); arma_conform_check( (N != P.get_n_cols()), "log_det(): given matrix must be square sized" ); if(N == 0) { out_val = eT(0); out_sign = T(1); return true; } eT x = P.at(0,0); T sign = (is_cx::no) ? ( (access::tmp_real(x) < T(0)) ? T(-1) : T(1) ) : T(1); eT val = (is_cx::no) ? std::log( (access::tmp_real(x) < T(0)) ? x*T(-1) : x ) : std::log(x); for(uword i=1; i::no) ? ( (access::tmp_real(x) < T(0)) ? T(-1) : T(1) ) : T(1); val += (is_cx::no) ? std::log( (access::tmp_real(x) < T(0)) ? x*T(-1) : x ) : std::log(x); } out_val = val; out_sign = sign; return (arma_isnan(out_val) == false); } // template inline bool op_log_det_sympd::apply_direct(typename T1::pod_type& out_val, const Base& expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; typedef typename T1::pod_type T; Mat A(expr.get_ref()); arma_conform_check( (A.is_square() == false), "log_det_sympd(): given matrix must be square sized" ); if((arma_config::check_conform) && (arma_config::warn_level > 0) && (is_cx::yes) && (sym_helper::check_diag_imag(A) == false)) { arma_warn(1, "log_det_sympd(): imaginary components on diagonal are non-zero"); } if(is_op_diagmat::value || A.is_diagmat()) { arma_debug_print("op_log_det_sympd: diag optimisation"); eT* colmem = A.memptr(); out_val = T(0); const uword N = A.n_rows; for(uword i=0; i::no ) { arma_warn(1, "log_det_sympd(): given matrix is not symmetric"); } if(is_cx::yes) { arma_warn(1, "log_det_sympd(): given matrix is not hermitian"); } } return auxlib::log_det_sympd(out_val, A); } //! @} RcppArmadillo/inst/include/armadillo_bits/newarp_SparseGenMatProd_bones.hpp0000644000176200001440000000241414456557177027047 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ namespace newarp { //! Define matrix operations on existing matrix objects template class SparseGenMatProd { private: const SpMat& op_mat; SpMat op_mat_st; public: const uword n_rows; // number of rows of the underlying matrix const uword n_cols; // number of columns of the underlying matrix inline SparseGenMatProd(const SpMat& mat_obj); inline void perform_op(eT* x_in, eT* y_out) const; }; } // namespace newarp RcppArmadillo/inst/include/armadillo_bits/op_sp_stddev_bones.hpp0000644000176200001440000000247114634016465024775 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_sp_stddev //! @{ class op_sp_stddev : public traits_op_xvec { public: template inline static void apply(Mat& out, const mtSpReduceOp& in); template inline static void apply_slow(Mat& out, const SpProxy& p, const uword norm_type, const uword dim); template inline static typename T1::pod_type stddev_vec(const T1& X, const uword norm_type = 0); }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_unique_bones.hpp0000644000176200001440000000351414301267043024276 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_unique //! @{ class op_unique : public traits_op_col { public: template inline static bool apply_helper(Mat& out, const Proxy& P, const bool P_is_row); template inline static void apply(Mat& out, const Op& in); }; class op_unique_vec : public traits_op_passthru { public: template inline static void apply(Mat& out, const Op& in); }; template struct arma_unique_comparator { arma_inline bool operator() (const eT a, const eT b) const { return ( a < b ); } }; template struct arma_unique_comparator< std::complex > { arma_inline bool operator() (const std::complex& a, const std::complex& b) const { const T a_real = a.real(); const T b_real = b.real(); return ( (a_real < b_real) ? true : ((a_real == b_real) ? (a.imag() < b.imag()) : false) ); } }; //! @} RcppArmadillo/inst/include/armadillo_bits/OpCube_meat.hpp0000644000176200001440000000455614631567470023313 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup OpCube //! @{ template OpCube::OpCube(const BaseCube& in_m) : m(in_m.get_ref()) { arma_debug_sigprint(); } template OpCube::OpCube(const BaseCube& in_m, const typename T1::elem_type in_aux) : m(in_m.get_ref()) , aux(in_aux) { arma_debug_sigprint(); } template OpCube::OpCube(const BaseCube& in_m, const typename T1::elem_type in_aux, const uword in_aux_uword_a, const uword in_aux_uword_b, const uword in_aux_uword_c) : m(in_m.get_ref()) , aux(in_aux) , aux_uword_a(in_aux_uword_a) , aux_uword_b(in_aux_uword_b) , aux_uword_c(in_aux_uword_c) { arma_debug_sigprint(); } template OpCube::OpCube(const BaseCube& in_m, const uword in_aux_uword_a, const uword in_aux_uword_b) : m(in_m.get_ref()) , aux_uword_a(in_aux_uword_a) , aux_uword_b(in_aux_uword_b) { arma_debug_sigprint(); } template OpCube::OpCube(const BaseCube& in_m, const uword in_aux_uword_a, const uword in_aux_uword_b, const uword in_aux_uword_c) : m(in_m.get_ref()) , aux_uword_a(in_aux_uword_a) , aux_uword_b(in_aux_uword_b) , aux_uword_c(in_aux_uword_c) { arma_debug_sigprint(); } template OpCube::~OpCube() { arma_debug_sigprint(); } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_diags_spdiags.hpp0000644000176200001440000000761214770765377024422 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_diags_spdiags //! @{ template inline Mat diags(const Base& V_expr, const Base& D_expr, const uword n_rows, const uword n_cols) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const quasi_unwrap UV(V_expr.get_ref()); const Mat& V = UV.M; const quasi_unwrap UD(D_expr.get_ref()); const Mat& D = UD.M; arma_conform_check( ((D.is_vec() == false) && (D.is_empty() == false)), "D must be a vector" ); arma_conform_check( (V.n_cols != D.n_elem), "number of columns in matrix V must match the length of vector D" ); Mat out(n_rows, n_cols, fill::zeros); for(uword i=0; i < D.n_elem; ++i) { const sword diag_id = D[i]; const uword row_offset = (diag_id < 0) ? uword(-diag_id) : 0; const uword col_offset = (diag_id > 0) ? uword( diag_id) : 0; arma_conform_check_bounds ( ((row_offset > 0) && (row_offset >= n_rows)) || ((col_offset > 0) && (col_offset >= n_cols)), "diags(): requested diagonal out of bounds" ); const uword diag_len = (std::min)(n_rows - row_offset, n_cols - col_offset); const uword V_start = (diag_id < 0) ? uword(0) : uword(diag_id); const eT* V_colmem = V.colptr(i); for(uword j=0; j < diag_len; ++j) { const uword V_index = V_start + j; if(V_index >= V.n_rows) { break; } out.at(j + row_offset, j + col_offset) = V_colmem[V_index]; } } return out; } template inline SpMat spdiags(const Base& V_expr, const Base& D_expr, const uword n_rows, const uword n_cols) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const quasi_unwrap UV(V_expr.get_ref()); const Mat& V = UV.M; const quasi_unwrap UD(D_expr.get_ref()); const Mat& D = UD.M; arma_conform_check( ((D.is_vec() == false) && (D.is_empty() == false)), "D must be a vector" ); arma_conform_check( (V.n_cols != D.n_elem), "number of columns in matrix V must match the length of vector D" ); MapMat tmp(n_rows, n_cols); for(uword i=0; i < D.n_elem; ++i) { const sword diag_id = D[i]; const uword row_offset = (diag_id < 0) ? uword(-diag_id) : 0; const uword col_offset = (diag_id > 0) ? uword( diag_id) : 0; arma_conform_check_bounds ( ((row_offset > 0) && (row_offset >= n_rows)) || ((col_offset > 0) && (col_offset >= n_cols)), "diags(): requested diagonal out of bounds" ); const uword diag_len = (std::min)(n_rows - row_offset, n_cols - col_offset); const uword V_start = (diag_id < 0) ? uword(0) : uword(diag_id); const eT* V_colmem = V.colptr(i); for(uword j=0; j < diag_len; ++j) { const uword V_index = V_start + j; if(V_index >= V.n_rows) { break; } tmp.at(j + row_offset, j + col_offset) = V_colmem[V_index]; } } return SpMat(tmp); } //! @} RcppArmadillo/inst/include/armadillo_bits/spop_vectorise_meat.hpp0000644000176200001440000000500714631567470025172 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup spop_vectorise //! @{ template inline void spop_vectorise_col::apply(SpMat& out, const SpOp& in) { arma_debug_sigprint(); spop_vectorise_col::apply_direct(out, in.m); } template inline void spop_vectorise_col::apply_direct(SpMat& out, const T1& expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; if(out.vec_state == 0) { out = expr; out.reshape(out.n_elem, 1); } else { SpMat tmp = expr; tmp.reshape(tmp.n_elem, 1); out.steal_mem(tmp); } } template inline void spop_vectorise_row::apply(SpMat& out, const SpOp& in) { arma_debug_sigprint(); spop_vectorise_row::apply_direct(out, in.m); } template inline void spop_vectorise_row::apply_direct(SpMat& out, const T1& expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; // NOTE: row-wise vectorisation of sparse matrices is not recommended due to the CSC storage format if(out.vec_state == 0) { out = strans(expr); out.reshape(1, out.n_elem); } else { SpMat tmp = strans(expr); tmp.reshape(1, tmp.n_elem); out.steal_mem(tmp); } } template inline void spop_vectorise_all::apply(SpMat& out, const SpOp& in) { arma_debug_sigprint(); const uword dim = in.aux_uword_a; if(dim == 0) { spop_vectorise_col::apply_direct(out, in.m); } else { spop_vectorise_row::apply_direct(out, in.m); } } //! @} RcppArmadillo/inst/include/armadillo_bits/SpOp_meat.hpp0000644000176200001440000000323514631567470023010 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup SpOp //! @{ template inline SpOp::SpOp(const T1& in_m) : m(in_m) { arma_debug_sigprint(); } template inline SpOp::SpOp(const T1& in_m, const typename T1::elem_type in_aux) : m(in_m) , aux(in_aux) { arma_debug_sigprint(); } template inline SpOp::SpOp(const T1& in_m, const uword in_aux_uword_a, const uword in_aux_uword_b) : m(in_m) , aux_uword_a(in_aux_uword_a) , aux_uword_b(in_aux_uword_b) { arma_debug_sigprint(); } template inline SpOp::~SpOp() { arma_debug_sigprint(); } template arma_inline bool SpOp::is_alias(const SpMat& X) const { return m.is_alias(X); } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_eig_gen.hpp0000644000176200001440000001300414635324415023166 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_eig_gen //! @{ template arma_warn_unused inline typename enable_if2< is_supported_blas_type::value, Col< std::complex > >::result eig_gen ( const Base& expr, const char* option = "nobalance" ) { arma_debug_sigprint(); typedef typename T1::pod_type T; typedef typename std::complex eT; const char sig = (option != nullptr) ? option[0] : char(0); arma_conform_check( ((sig != 'n') && (sig != 'b')), "eig_gen(): unknown option" ); if( auxlib::crippled_lapack(expr) && (sig == 'b') ) { arma_warn(1, "eig_gen(): 'balance' option ignored due to linking with crippled lapack"); } Col eigvals; Mat eigvecs; const bool status = (sig == 'b') ? auxlib::eig_gen_balance(eigvals, eigvecs, false, expr.get_ref()) : auxlib::eig_gen(eigvals, eigvecs, false, expr.get_ref()); if(status == false) { eigvals.soft_reset(); arma_stop_runtime_error("eig_gen(): decomposition failed"); } return eigvals; } template inline typename enable_if2< is_supported_blas_type::value, bool >::result eig_gen ( Col< std::complex >& eigvals, const Base< typename T1::elem_type, T1>& expr, const char* option = "nobalance" ) { arma_debug_sigprint(); typedef typename T1::pod_type T; typedef typename std::complex eT; const char sig = (option != nullptr) ? option[0] : char(0); arma_conform_check( ((sig != 'n') && (sig != 'b')), "eig_gen(): unknown option" ); if( auxlib::crippled_lapack(expr) && (sig == 'b') ) { arma_warn(1, "eig_gen(): 'balance' option ignored due to linking with crippled lapack"); } Mat eigvecs; const bool status = (sig == 'b') ? auxlib::eig_gen_balance(eigvals, eigvecs, false, expr.get_ref()) : auxlib::eig_gen(eigvals, eigvecs, false, expr.get_ref()); if(status == false) { eigvals.soft_reset(); arma_warn(3, "eig_gen(): decomposition failed"); } return status; } template inline typename enable_if2< is_supported_blas_type::value, bool >::result eig_gen ( Col< std::complex >& eigvals, Mat< std::complex >& eigvecs, const Base& expr, const char* option = "nobalance" ) { arma_debug_sigprint(); arma_conform_check( (void_ptr(&eigvals) == void_ptr(&eigvecs)), "eig_gen(): parameter 'eigval' is an alias of parameter 'eigvec'" ); const char sig = (option != nullptr) ? option[0] : char(0); arma_conform_check( ((sig != 'n') && (sig != 'b')), "eig_gen(): unknown option" ); if( auxlib::crippled_lapack(expr) && (sig == 'b') ) { arma_warn(1, "eig_gen(): 'balance' option ignored due to linking with crippled lapack"); } const bool status = (sig == 'b') ? auxlib::eig_gen_balance(eigvals, eigvecs, true, expr.get_ref()) : auxlib::eig_gen(eigvals, eigvecs, true, expr.get_ref()); if(status == false) { eigvals.soft_reset(); eigvecs.soft_reset(); arma_warn(3, "eig_gen(): decomposition failed"); } return status; } template inline typename enable_if2< is_supported_blas_type::value, bool >::result eig_gen ( Col< std::complex >& eigvals, Mat< std::complex >& leigvecs, Mat< std::complex >& reigvecs, const Base& expr, const char* option = "nobalance" ) { arma_debug_sigprint(); arma_conform_check( (void_ptr(&eigvals) == void_ptr(&leigvecs)), "eig_gen(): parameter 'eigval' is an alias of parameter 'leigvec'" ); arma_conform_check( (void_ptr(&eigvals) == void_ptr(&reigvecs)), "eig_gen(): parameter 'eigval' is an alias of parameter 'reigvec'" ); arma_conform_check( (void_ptr(&leigvecs) == void_ptr(&reigvecs)), "eig_gen(): parameter 'leigvec' is an alias of parameter 'reigvec'" ); const char sig = (option != nullptr) ? option[0] : char(0); arma_conform_check( ((sig != 'n') && (sig != 'b')), "eig_gen(): unknown option" ); if( auxlib::crippled_lapack(expr) && (sig == 'b') ) { arma_warn(1, "eig_gen(): 'balance' option ignored due to linking with crippled lapack"); } const bool status = (sig == 'b') ? auxlib::eig_gen_twosided_balance(eigvals, leigvecs, reigvecs, expr.get_ref()) : auxlib::eig_gen_twosided(eigvals, leigvecs, reigvecs, expr.get_ref()); if(status == false) { eigvals.soft_reset(); leigvecs.soft_reset(); reigvecs.soft_reset(); arma_warn(3, "eig_gen(): decomposition failed"); } return status; } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_rank.hpp0000644000176200001440000000314014631567470022532 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_rank //! @{ template arma_warn_unused inline typename enable_if2< is_supported_blas_type::value, uword >::result rank(const Base& expr, const typename T1::pod_type tol = 0) { arma_debug_sigprint(); uword out = uword(0); const bool status = op_rank::apply(out, expr.get_ref(), tol); if(status == false) { arma_stop_runtime_error("rank(): failed"); return uword(0); } return out; } template inline typename enable_if2< is_supported_blas_type::value, bool >::result rank(uword& out, const Base& expr, const typename T1::pod_type tol = 0) { arma_debug_sigprint(); out = uword(0); return op_rank::apply(out, expr.get_ref(), tol); } //! @} RcppArmadillo/inst/include/armadillo_bits/memory.hpp0000644000176200001440000001163714752446051022431 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup memory //! @{ class memory { public: template arma_malloc inline static eT* acquire(const uword n_elem); template arma_inline static void release(eT* mem); template arma_inline static bool is_aligned(const eT* mem); template arma_inline static void mark_as_aligned( eT*& mem); template arma_inline static void mark_as_aligned(const eT*& mem); }; template arma_malloc inline eT* memory::acquire(const uword n_elem) { if(n_elem == 0) { return nullptr; } arma_conform_check ( ( size_t(n_elem) > (std::numeric_limits::max() / sizeof(eT)) ), "arma::memory::acquire(): requested size is too large" ); eT* out_memptr; #if defined(ARMA_ALIEN_MEM_ALLOC_FUNCTION) { out_memptr = (eT *) ARMA_ALIEN_MEM_ALLOC_FUNCTION(sizeof(eT)*n_elem); } #elif defined(ARMA_USE_TBB_ALLOC) { out_memptr = (eT *) scalable_malloc(sizeof(eT)*n_elem); } #elif defined(ARMA_USE_MKL_ALLOC) { out_memptr = (eT *) mkl_malloc( sizeof(eT)*n_elem, 32 ); } #elif defined(ARMA_HAVE_POSIX_MEMALIGN) { eT* memptr = nullptr; const size_t n_bytes = sizeof(eT)*size_t(n_elem); const size_t alignment = (n_bytes >= size_t(1024)) ? size_t(32) : size_t(16); // TODO: investigate apparent memory leak when using alignment >= 64 (as shown on Fedora 28, glibc 2.27) int status = posix_memalign((void **)&memptr, ( (alignment >= sizeof(void*)) ? alignment : sizeof(void*) ), n_bytes); out_memptr = (status == 0) ? memptr : nullptr; } #elif defined(_MSC_VER) { // Windoze is too primitive to handle C++17 std::aligned_alloc() //out_memptr = (eT *) malloc(sizeof(eT)*n_elem); //out_memptr = (eT *) _aligned_malloc( sizeof(eT)*n_elem, 16 ); // lives in malloc.h const size_t n_bytes = sizeof(eT)*size_t(n_elem); const size_t alignment = (n_bytes >= size_t(1024)) ? size_t(32) : size_t(16); out_memptr = (eT *) _aligned_malloc( n_bytes, alignment ); } #else { //return ( new(std::nothrow) eT[n_elem] ); out_memptr = (eT *) std::malloc(sizeof(eT)*n_elem); } #endif // TODO: for mingw, use __mingw_aligned_malloc arma_check_bad_alloc( (out_memptr == nullptr), "arma::memory::acquire(): out of memory" ); return out_memptr; } template arma_inline void memory::release(eT* mem) { if(mem == nullptr) { return; } #if defined(ARMA_ALIEN_MEM_FREE_FUNCTION) { ARMA_ALIEN_MEM_FREE_FUNCTION( (void *)(mem) ); } #elif defined(ARMA_USE_TBB_ALLOC) { scalable_free( (void *)(mem) ); } #elif defined(ARMA_USE_MKL_ALLOC) { mkl_free( (void *)(mem) ); } #elif defined(ARMA_HAVE_POSIX_MEMALIGN) { std::free( (void *)(mem) ); } #elif defined(_MSC_VER) { //free( (void *)(mem) ); _aligned_free( (void *)(mem) ); } #else { //delete [] mem; std::free( (void *)(mem) ); } #endif // TODO: for mingw, use __mingw_aligned_free } template arma_inline bool memory::is_aligned(const eT* mem) { #if (defined(ARMA_HAVE_GCC_ASSUME_ALIGNED) || defined(__cpp_lib_assume_aligned)) && !defined(ARMA_DONT_CHECK_ALIGNMENT) { return (sizeof(std::size_t) >= sizeof(eT*)) ? ((std::size_t(mem) & 0x0F) == 0) : false; } #else { arma_ignore(mem); return false; } #endif } template arma_inline void memory::mark_as_aligned(eT*& mem) { #if defined(ARMA_HAVE_GCC_ASSUME_ALIGNED) { mem = (eT*)__builtin_assume_aligned(mem, 16); } #elif defined(__cpp_lib_assume_aligned) { mem = (eT*)std::assume_aligned<16>(mem); } #else { arma_ignore(mem); } #endif } template arma_inline void memory::mark_as_aligned(const eT*& mem) { #if defined(ARMA_HAVE_GCC_ASSUME_ALIGNED) { mem = (const eT*)__builtin_assume_aligned(mem, 16); } #elif defined(__cpp_lib_assume_aligned) { mem = (const eT*)std::assume_aligned<16>(mem); } #else { arma_ignore(mem); } #endif } //! @} RcppArmadillo/inst/include/armadillo_bits/glue_mvnrnd_meat.hpp0000644000176200001440000001113315030507611024424 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup glue_mvnrnd //! @{ // implementation based on: // James E. Gentle. // Generation of Random Numbers. // Computational Statistics, pp. 305-331, 2009. // http://dx.doi.org/10.1007/978-0-387-98144-4_7 template inline void glue_mvnrnd_vec::apply(Mat& out, const Glue& expr) { arma_debug_sigprint(); const bool status = glue_mvnrnd::apply_direct(out, expr.A, expr.B, uword(1)); if(status == false) { out.soft_reset(); arma_stop_runtime_error("mvnrnd(): given covariance matrix is not symmetric positive semi-definite"); } } template inline void glue_mvnrnd::apply(Mat& out, const Glue& expr) { arma_debug_sigprint(); const bool status = glue_mvnrnd::apply_direct(out, expr.A, expr.B, expr.aux_uword); if(status == false) { out.soft_reset(); arma_stop_runtime_error("mvnrnd(): given covariance matrix is not symmetric positive semi-definite"); } } template inline bool glue_mvnrnd::apply_direct(Mat& out, const Base& M, const Base& C, const uword N) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const quasi_unwrap UM(M.get_ref()); const quasi_unwrap UC(C.get_ref()); arma_conform_check( (UM.M.is_colvec() == false) && (UM.M.is_empty() == false), "mvnrnd(): given mean must be a column vector" ); arma_conform_check( (UC.M.is_square() == false), "mvnrnd(): given covariance matrix must be square sized" ); arma_conform_check( (UM.M.n_rows != UC.M.n_rows), "mvnrnd(): number of rows in given mean vector and covariance matrix must match" ); if( UM.M.is_empty() || UC.M.is_empty() ) { out.set_size(0,N); return true; } if((arma_config::check_conform) && (auxlib::rudimentary_sym_check(UC.M) == false)) { arma_warn(1, "mvnrnd(): given matrix is not symmetric"); } bool status = false; if(UM.is_alias(out) || UC.is_alias(out)) { Mat tmp; status = glue_mvnrnd::apply_noalias(tmp, UM.M, UC.M, N); out.steal_mem(tmp); } else { status = glue_mvnrnd::apply_noalias(out, UM.M, UC.M, N); } return status; } template inline bool glue_mvnrnd::apply_noalias(Mat& out, const Mat& M, const Mat& C, const uword N) { arma_debug_sigprint(); Mat D; const bool chol_status = op_chol::apply_direct(D, C, 1); // '1' means "lower triangular" if(chol_status == false) { // C is not symmetric positive definite, so find approximate square root of C Col eigval; // NOTE: eT is constrained to be real (ie. float or double) in fn_mvnrnd.hpp Mat eigvec; const bool eig_status = eig_sym_helper(eigval, eigvec, C, 'd', "mvnrnd()"); if(eig_status == false) { return false; } eT* eigval_mem = eigval.memptr(); const uword eigval_n_elem = eigval.n_elem; // since we're doing an approximation, tolerate tiny negative eigenvalues const eT tol = eT(-100) * Datum::eps * norm(C, "fro"); if(arma_isnonfinite(tol)) { return false; } for(uword i=0; i DD = eigvec * diagmat(sqrt(eigval)); D.steal_mem(DD); } out = D * randn< Mat >(M.n_rows, N); if(N == 1) { out += M; } else if(N > 1) { out.each_col() += M; } return true; } //! @} RcppArmadillo/inst/include/armadillo_bits/spglue_plus_bones.hpp0000644000176200001440000000337014413016473024637 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup spglue_plus //! @{ class spglue_plus : public traits_glue_or { public: template inline static void apply(SpMat& out, const SpGlue& X); template inline static void apply_noalias(SpMat& out, const SpProxy& pa, const SpProxy& pb); template inline static void apply_noalias(SpMat& out, const SpMat& A, const SpMat& B); }; class spglue_plus_mixed : public traits_glue_or { public: template inline static void apply(SpMat::eT>& out, const mtSpGlue::eT, T1, T2, spglue_plus_mixed>& expr); template inline static void dense_plus_sparse(Mat< typename promote_type::result>& out, const T1& X, const T2& Y); }; //! @} RcppArmadillo/inst/include/armadillo_bits/glue_solve_meat.hpp0000644000176200001440000005334714752446051024277 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup glue_solve //! @{ // // glue_solve_gen_default template inline void glue_solve_gen_default::apply(Mat& out, const Glue& X) { arma_debug_sigprint(); const bool status = glue_solve_gen_default::apply(out, X.A, X.B); if(status == false) { out.soft_reset(); arma_stop_runtime_error("solve(): solution not found"); } } template inline bool glue_solve_gen_default::apply(Mat& out, const Base& A_expr, const Base& B_expr) { arma_debug_sigprint(); return glue_solve_gen_full::apply( out, A_expr, B_expr, uword(0)); } // // glue_solve_gen_full template inline void glue_solve_gen_full::apply(Mat& out, const Glue& X) { arma_debug_sigprint(); const bool status = glue_solve_gen_full::apply( out, X.A, X.B, X.aux_uword ); if(status == false) { out.soft_reset(); arma_stop_runtime_error("solve(): solution not found"); } } template inline bool glue_solve_gen_full::apply(Mat& actual_out, const Base& A_expr, const Base& B_expr, const uword flags) { arma_debug_sigprint(); typedef typename get_pod_type::result T; if(has_user_flags == true ) { arma_debug_print("glue_solve_gen_full::apply(): has_user_flags = true" ); } if(has_user_flags == false) { arma_debug_print("glue_solve_gen_full::apply(): has_user_flags = false"); } const bool fast = has_user_flags && bool(flags & solve_opts::flag_fast ); const bool equilibrate = has_user_flags && bool(flags & solve_opts::flag_equilibrate ); const bool no_approx = has_user_flags && bool(flags & solve_opts::flag_no_approx ); const bool no_band = has_user_flags && bool(flags & solve_opts::flag_no_band ); const bool no_sympd = has_user_flags && bool(flags & solve_opts::flag_no_sympd ); const bool allow_ugly = has_user_flags && bool(flags & solve_opts::flag_allow_ugly ); const bool likely_sympd = has_user_flags && bool(flags & solve_opts::flag_likely_sympd); const bool refine = has_user_flags && bool(flags & solve_opts::flag_refine ); const bool no_trimat = has_user_flags && bool(flags & solve_opts::flag_no_trimat ); const bool force_approx = has_user_flags && bool(flags & solve_opts::flag_force_approx); const bool force_sym = has_user_flags && bool(flags & solve_opts::flag_force_sym ); if(has_user_flags) { arma_debug_print("glue_solve_gen_full::apply(): enabled flags:"); if(fast ) { arma_debug_print("fast"); } if(equilibrate ) { arma_debug_print("equilibrate"); } if(no_approx ) { arma_debug_print("no_approx"); } if(no_band ) { arma_debug_print("no_band"); } if(no_sympd ) { arma_debug_print("no_sympd"); } if(allow_ugly ) { arma_debug_print("allow_ugly"); } if(likely_sympd) { arma_debug_print("likely_sympd"); } if(refine ) { arma_debug_print("refine"); } if(no_trimat ) { arma_debug_print("no_trimat"); } if(force_approx) { arma_debug_print("force_approx"); } if(force_sym ) { arma_debug_print("force_sym"); } arma_conform_check( (fast && equilibrate ), "solve(): options 'fast' and 'equilibrate' are mutually exclusive" ); arma_conform_check( (fast && refine ), "solve(): options 'fast' and 'refine' are mutually exclusive" ); arma_conform_check( (no_sympd && likely_sympd), "solve(): options 'no_sympd' and 'likely_sympd' are mutually exclusive" ); } Mat A = A_expr.get_ref(); if(force_approx) { arma_debug_print("glue_solve_gen_full::apply(): forced approximate solution"); arma_conform_check( no_approx, "solve(): options 'no_approx' and 'force_approx' are mutually exclusive" ); if(fast) { arma_warn(2, "solve(): option 'fast' ignored for forced approximate solution" ); } if(equilibrate) { arma_warn(2, "solve(): option 'equilibrate' ignored for forced approximate solution" ); } if(refine) { arma_warn(2, "solve(): option 'refine' ignored for forced approximate solution" ); } if(likely_sympd) { arma_warn(2, "solve(): option 'likely_sympd' ignored for forced approximate solution" ); } if(force_sym) { arma_warn(2, "solve(): option 'force_sym' ignored for forced approximate solution" ); } return auxlib::solve_approx_svd(actual_out, A, B_expr.get_ref()); // A is overwritten } if(force_sym) { if((arma_config::check_conform) && (auxlib::rudimentary_sym_check(A) == false)) { if(is_cx::no ) { arma_warn(1, "solve(): option 'force_sym' enabled, but given matrix is not symmetric"); } if(is_cx::yes) { arma_warn(1, "solve(): option 'force_sym' enabled, but given matrix is not hermitian"); } } if(likely_sympd) { arma_warn(2, "solve(): option 'likely_sympd' ignored for forced symmetric solver" ); } if(equilibrate) { arma_warn(2, "solve(): option 'force_sym' ignored as option 'equilibrate' is enabled (combination not implemented yet)" ); } if(refine) { arma_warn(2, "solve(): option 'force_sym' ignored as option 'refine' is enabled (combination not implemented yet)" ); } } // A_expr and B_expr can be used more than once (sympd optimisation fails or approximate solution required), // so ensure they are not overwritten in case we have aliasing const bool is_alias = A_expr.get_ref().is_alias(actual_out) || B_expr.get_ref().is_alias(actual_out); if(is_alias) { arma_debug_print("glue_solve_gen_full::apply(): aliasing detected"); } Mat tmp; Mat& out = (is_alias) ? tmp : actual_out; T rcond = T(0); bool status = false; if(A.n_rows == A.n_cols) { arma_debug_print("glue_solve_gen_full::apply(): detected square system"); uword KL = 0; uword KU = 0; const bool is_band = arma_config::optimise_band && ( (no_band || force_sym || auxlib::crippled_lapack(A)) ? false : band_helper::is_band(KL, KU, A, uword(32)) ); const bool is_triu = (no_trimat || refine || equilibrate || likely_sympd || force_sym || is_band ) ? false : trimat_helper::is_triu(A); const bool is_tril = (no_trimat || refine || equilibrate || likely_sympd || force_sym || is_band || is_triu) ? false : trimat_helper::is_tril(A); const bool is_sym = arma_config::optimise_sym && ( (refine || equilibrate || likely_sympd || force_sym || is_band || is_triu || is_tril || auxlib::crippled_lapack(A)) ? false : is_sym_expr::eval(A_expr.get_ref()) ); const bool try_sympd = arma_config::optimise_sym && ( ( no_sympd || is_sym || force_sym || is_band || is_triu || is_tril || auxlib::crippled_lapack(A)) ? false : (likely_sympd ? true : sym_helper::guess_sympd(A, uword(16))) ); arma_debug_print("glue_solve_gen_full::apply(): internal flags:"); arma_debug_print("is_band: ", is_band ); arma_debug_print("is_triu: ", is_triu ); arma_debug_print("is_tril: ", is_tril ); arma_debug_print("is_sym: ", is_sym ); arma_debug_print("try_sympd: ", try_sympd); if(fast) { // fast mode: solvers without refinement and without rcond estimate arma_debug_print("glue_solve_gen_full::apply(): fast mode"); if(is_band) { if( (KL == 1) && (KU == 1) ) { arma_debug_print("glue_solve_gen_full::apply(): fast + tridiagonal"); status = auxlib::solve_tridiag_fast(out, A, B_expr.get_ref()); } else { arma_debug_print("glue_solve_gen_full::apply(): fast + band"); status = auxlib::solve_band_fast(out, A, KL, KU, B_expr.get_ref()); } } else if(is_triu || is_tril) { if(is_triu) { arma_debug_print("glue_solve_gen_full::apply(): fast + upper triangular matrix"); } if(is_tril) { arma_debug_print("glue_solve_gen_full::apply(): fast + lower triangular matrix"); } const uword layout = (is_triu) ? uword(0) : uword(1); status = auxlib::solve_trimat_fast(out, A, B_expr.get_ref(), layout); } else if(force_sym || is_sym) { arma_debug_print("glue_solve_gen_full::apply(): fast + sym"); status = auxlib::solve_sym_fast(out, A, B_expr.get_ref()); // A is overwritten } else if(try_sympd) { arma_debug_print("glue_solve_gen_full::apply(): fast + try_sympd"); status = auxlib::solve_sympd_fast(out, A, B_expr.get_ref()); // A is overwritten if(status == false) { // auxlib::solve_sympd_fast() may have failed because A isn't really sympd arma_debug_print("glue_solve_gen_full::apply(): auxlib::solve_sympd_fast() failed; retrying"); A = A_expr.get_ref(); status = auxlib::solve_square_fast(out, A, B_expr.get_ref()); // A is overwritten } } else { arma_debug_print("glue_solve_gen_full::apply(): fast + dense"); status = auxlib::solve_square_fast(out, A, B_expr.get_ref()); // A is overwritten } } else if(refine || equilibrate) { // refine mode: solvers with refinement and with rcond estimate arma_debug_print("glue_solve_gen_full::apply(): refine mode"); if(is_band) { arma_debug_print("glue_solve_gen_full::apply(): refine + band"); status = auxlib::solve_band_refine(out, rcond, A, KL, KU, B_expr, equilibrate); } // else // if(force_sym || is_sym) // TODO: implement auxlib::solve_sym_refine() // { // } else if(try_sympd) { arma_debug_print("glue_solve_gen_full::apply(): refine + try_sympd"); status = auxlib::solve_sympd_refine(out, rcond, A, B_expr.get_ref(), equilibrate); // A is overwritten if( (status == false) && (rcond == T(0)) ) { // auxlib::solve_sympd_refine() may have failed because A isn't really sympd; // in that case rcond is set to zero arma_debug_print("glue_solve_gen_full::apply(): auxlib::solve_sympd_refine() failed; retrying"); A = A_expr.get_ref(); status = auxlib::solve_square_refine(out, rcond, A, B_expr.get_ref(), equilibrate); // A is overwritten } } else { arma_debug_print("glue_solve_gen_full::apply(): refine + dense"); status = auxlib::solve_square_refine(out, rcond, A, B_expr, equilibrate); // A is overwritten } } else { // default mode: solvers without refinement but with rcond estimate arma_debug_print("glue_solve_gen_full::apply(): default mode"); if(is_band) { arma_debug_print("glue_solve_gen_full::apply(): rcond + band"); status = auxlib::solve_band_rcond(out, rcond, A, KL, KU, B_expr.get_ref()); } else if(is_triu || is_tril) { if(is_triu) { arma_debug_print("glue_solve_gen_full::apply(): rcond + upper triangular matrix"); } if(is_tril) { arma_debug_print("glue_solve_gen_full::apply(): rcond + lower triangular matrix"); } const uword layout = (is_triu) ? uword(0) : uword(1); status = auxlib::solve_trimat_rcond(out, rcond, A, B_expr.get_ref(), layout); } else if(force_sym || is_sym) { arma_debug_print("glue_solve_gen_full::apply(): rcond + sym"); status = auxlib::solve_sym_rcond(out, rcond, A, B_expr.get_ref()); // A is overwritten } else if(try_sympd) { bool sympd_state = false; status = auxlib::solve_sympd_rcond(out, sympd_state, rcond, A, B_expr.get_ref()); // A is overwritten if( (status == false) && (sympd_state == false) ) { arma_debug_print("glue_solve_gen_full::apply(): auxlib::solve_sympd_rcond() failed; retrying"); A = A_expr.get_ref(); status = auxlib::solve_square_rcond(out, rcond, A, B_expr.get_ref()); // A is overwritten } } else { status = auxlib::solve_square_rcond(out, rcond, A, B_expr.get_ref()); // A is overwritten } } } else { arma_debug_print("glue_solve_gen_full::apply(): detected non-square system"); if(equilibrate) { arma_warn(2, "solve(): option 'equilibrate' ignored for non-square matrix" ); } if(refine) { arma_warn(2, "solve(): option 'refine' ignored for non-square matrix" ); } if(likely_sympd) { arma_warn(2, "solve(): option 'likely_sympd' ignored for non-square matrix" ); } if(force_sym) { arma_warn(2, "solve(): option 'force_sym' ignored for non-square matrix" ); } if(fast) { status = auxlib::solve_rect_fast(out, A, B_expr.get_ref()); // A is overwritten } else { status = auxlib::solve_rect_rcond(out, rcond, A, B_expr.get_ref()); // A is overwritten } } if( (status == true) && (fast == false) && (allow_ugly == false) && ((rcond < std::numeric_limits::epsilon()) || arma_isnan(rcond)) ) { status = false; } if( (status == false) && (no_approx == false) ) { arma_debug_print("glue_solve_gen_full::apply(): solving rank deficient system"); if(rcond == T(0)) { arma_warn(2, "solve(): system is singular; attempting approx solution"); } else { arma_warn(2, "solve(): system is singular (rcond: ", rcond, "); attempting approx solution"); } // TODO: conditionally recreate A: have a separate state flag which indicates whether A was previously overwritten A = A_expr.get_ref(); // as A may have been overwritten status = auxlib::solve_approx_svd(out, A, B_expr.get_ref()); // A is overwritten } if(is_alias) { actual_out.steal_mem(out); } return status; } // // glue_solve_tri_default template inline void glue_solve_tri_default::apply(Mat& out, const Glue& X) { arma_debug_sigprint(); const bool status = glue_solve_tri_default::apply( out, X.A, X.B, X.aux_uword ); if(status == false) { out.soft_reset(); arma_stop_runtime_error("solve(): solution not found"); } } template inline bool glue_solve_tri_default::apply(Mat& actual_out, const Base& A_expr, const Base& B_expr, const uword flags) { arma_debug_sigprint(); typedef typename get_pod_type::result T; const bool triu = bool(flags & solve_opts::flag_triu); const bool tril = bool(flags & solve_opts::flag_tril); arma_debug_print("glue_solve_tri_default::apply(): enabled flags:"); if(triu) { arma_debug_print("triu"); } if(tril) { arma_debug_print("tril"); } const quasi_unwrap UA(A_expr.get_ref()); const Mat& A = UA.M; arma_conform_check( (A.is_square() == false), "solve(): matrix marked as triangular must be square sized" ); const uword layout = (triu) ? uword(0) : uword(1); const bool is_alias = A_expr.get_ref().is_alias(actual_out) || B_expr.get_ref().is_alias(actual_out); if(is_alias) { arma_debug_print("glue_solve_tri_default::apply(): aliasing detected"); } T rcond = T(0); bool status = false; Mat tmp; Mat& out = (is_alias) ? tmp : actual_out; status = auxlib::solve_trimat_rcond(out, rcond, A, B_expr.get_ref(), layout); // A is not modified if( (status == true) && ( (rcond < std::numeric_limits::epsilon()) || arma_isnan(rcond) ) ) { status = false; } if(status == false) { arma_debug_print("glue_solve_tri_default::apply(): solving rank deficient system"); if(rcond == T(0)) { arma_warn(2, "solve(): system is singular; attempting approx solution"); } else { arma_warn(2, "solve(): system is singular (rcond: ", rcond, "); attempting approx solution"); } Mat triA = (triu) ? trimatu(A) : trimatl(A); // trimatu() and trimatl() return the same type status = auxlib::solve_approx_svd(out, triA, B_expr.get_ref()); // triA is overwritten } if(is_alias) { actual_out.steal_mem(out); } return status; } // // glue_solve_tri_full template inline void glue_solve_tri_full::apply(Mat& out, const Glue& X) { arma_debug_sigprint(); const bool status = glue_solve_tri_full::apply( out, X.A, X.B, X.aux_uword ); if(status == false) { out.soft_reset(); arma_stop_runtime_error("solve(): solution not found"); } } template inline bool glue_solve_tri_full::apply(Mat& actual_out, const Base& A_expr, const Base& B_expr, const uword flags) { arma_debug_sigprint(); typedef typename get_pod_type::result T; const bool fast = bool(flags & solve_opts::flag_fast ); const bool equilibrate = bool(flags & solve_opts::flag_equilibrate ); const bool no_approx = bool(flags & solve_opts::flag_no_approx ); const bool triu = bool(flags & solve_opts::flag_triu ); const bool tril = bool(flags & solve_opts::flag_tril ); const bool allow_ugly = bool(flags & solve_opts::flag_allow_ugly ); const bool likely_sympd = bool(flags & solve_opts::flag_likely_sympd); const bool refine = bool(flags & solve_opts::flag_refine ); const bool no_trimat = bool(flags & solve_opts::flag_no_trimat ); const bool force_approx = bool(flags & solve_opts::flag_force_approx); const bool force_sym = bool(flags & solve_opts::flag_force_sym ); arma_debug_print("glue_solve_tri_full::apply(): enabled flags:"); if(fast ) { arma_debug_print("fast"); } if(equilibrate ) { arma_debug_print("equilibrate"); } if(no_approx ) { arma_debug_print("no_approx"); } if(triu ) { arma_debug_print("triu"); } if(tril ) { arma_debug_print("tril"); } if(allow_ugly ) { arma_debug_print("allow_ugly"); } if(likely_sympd) { arma_debug_print("likely_sympd"); } if(refine ) { arma_debug_print("refine"); } if(no_trimat ) { arma_debug_print("no_trimat"); } if(force_approx) { arma_debug_print("force_approx"); } if(force_sym ) { arma_debug_print("force_sym"); } arma_conform_check( (likely_sympd), "solve(): option 'likely_sympd' not applicable to triangular matrix" ); arma_conform_check( (force_sym ), "solve(): option 'force_sym' not applicable to triangular matrix" ); if(no_trimat || equilibrate || refine || force_approx) { const uword mask = ~(solve_opts::flag_triu | solve_opts::flag_tril); return glue_solve_gen_full::apply(actual_out, ((triu) ? trimatu(A_expr.get_ref()) : trimatl(A_expr.get_ref())), B_expr, (flags & mask)); } const quasi_unwrap UA(A_expr.get_ref()); const Mat& A = UA.M; arma_conform_check( (A.is_square() == false), "solve(): matrix marked as triangular must be square sized" ); const uword layout = (triu) ? uword(0) : uword(1); const bool is_alias = A_expr.get_ref().is_alias(actual_out) || B_expr.get_ref().is_alias(actual_out); if(is_alias) { arma_debug_print("glue_solve_tri_full::apply(): aliasing detected"); } T rcond = T(0); bool status = false; Mat tmp; Mat& out = (is_alias) ? tmp : actual_out; if(fast) { status = auxlib::solve_trimat_fast(out, A, B_expr.get_ref(), layout); // A is not modified } else { status = auxlib::solve_trimat_rcond(out, rcond, A, B_expr.get_ref(), layout); // A is not modified } if( (status == true) && (fast == false) && (allow_ugly == false) && ((rcond < std::numeric_limits::epsilon()) || arma_isnan(rcond)) ) { status = false; } if( (status == false) && (no_approx == false) ) { arma_debug_print("glue_solve_tri_full::apply(): solving rank deficient system"); if(rcond == T(0)) { arma_warn(2, "solve(): system is singular; attempting approx solution"); } else { arma_warn(2, "solve(): system is singular (rcond: ", rcond, "); attempting approx solution"); } Mat triA = (triu) ? trimatu(A) : trimatl(A); // trimatu() and trimatl() return the same type status = auxlib::solve_approx_svd(out, triA, B_expr.get_ref()); // triA is overwritten } if(is_alias) { actual_out.steal_mem(out); } return status; } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_toeplitz.hpp0000644000176200001440000000302614631567470023454 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_toeplitz //! @{ template arma_warn_unused inline const Op toeplitz(const Base& X) { arma_debug_sigprint(); return Op( X.get_ref() ); } template arma_warn_unused inline const Op circ_toeplitz(const Base& X) { arma_debug_sigprint(); return Op( X.get_ref() ); } template arma_warn_unused inline const Glue toeplitz(const Base& X, const Base& Y) { arma_debug_sigprint(); return Glue( X.get_ref(), Y.get_ref() ); } //! @} RcppArmadillo/inst/include/armadillo_bits/spop_normalise_meat.hpp0000644000176200001440000000635614631567470025170 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup spop_normalise //! @{ template inline void spop_normalise::apply(SpMat& out, const SpOp& expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword p = expr.aux_uword_a; const uword dim = expr.aux_uword_b; arma_conform_check( (p == 0), "normalise(): unsupported vector norm type" ); arma_conform_check( (dim > 1), "normalise(): parameter 'dim' must be 0 or 1" ); const unwrap_spmat U(expr.m); const SpMat& X = U.M; X.sync(); if( X.is_empty() || (X.n_nonzero == 0) ) { out.zeros(X.n_rows, X.n_cols); return; } if(dim == 0) { spop_normalise::apply_direct(out, X, p); } else if(dim == 1) { SpMat tmp1; SpMat tmp2; spop_strans::apply_noalias(tmp1, X); spop_normalise::apply_direct(tmp2, tmp1, p); spop_strans::apply_noalias(out, tmp2); } } template inline void spop_normalise::apply_direct(SpMat& out, const SpMat& X, const uword p) { arma_debug_sigprint(); typedef typename get_pod_type::result T; SpMat tmp(arma_reserve_indicator(), X.n_rows, X.n_cols, X.n_nonzero); bool has_zero = false; podarray norm_vals(X.n_cols); T* norm_vals_mem = norm_vals.memptr(); for(uword col=0; col < X.n_cols; ++col) { const uword col_offset = X.col_ptrs[col ]; const uword next_col_offset = X.col_ptrs[col + 1]; const eT* start_ptr = &X.values[ col_offset]; const eT* end_ptr = &X.values[next_col_offset]; const uword n_elem = end_ptr - start_ptr; const Col fake_vec(const_cast(start_ptr), n_elem, false, false); const T norm_val = norm(fake_vec, p); norm_vals_mem[col] = (norm_val != T(0)) ? norm_val : T(1); } const uword N = X.n_nonzero; typename SpMat::const_iterator it = X.begin(); for(uword i=0; i < N; ++i) { const uword row = it.row(); const uword col = it.col(); const eT val = (*it) / norm_vals_mem[col]; if(val == eT(0)) { has_zero = true; } access::rw(tmp.values[i]) = val; access::rw(tmp.row_indices[i]) = row; access::rw(tmp.col_ptrs[col + 1])++; ++it; } for(uword c=0; c < tmp.n_cols; ++c) { access::rw(tmp.col_ptrs[c + 1]) += tmp.col_ptrs[c]; } if(has_zero) { tmp.remove_zeros(); } out.steal_mem(tmp); } //! @} RcppArmadillo/inst/include/armadillo_bits/SpToDOp_meat.hpp0000644000176200001440000000302014631567470023407 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup SpToDOp //! @{ template inline SpToDOp::SpToDOp(const T1& in_m) : m(in_m) { arma_debug_sigprint(); } template inline SpToDOp::SpToDOp(const T1& in_m, const typename T1::elem_type in_aux) : m(in_m) , aux(in_aux) { arma_debug_sigprint(); } template inline SpToDOp::SpToDOp(const T1& in_m, const uword in_aux_uword_a, const uword in_aux_uword_b) : m(in_m) , aux_uword_a(in_aux_uword_a) , aux_uword_b(in_aux_uword_b) { arma_debug_sigprint(); } template inline SpToDOp::~SpToDOp() { arma_debug_sigprint(); } //! @} RcppArmadillo/inst/include/armadillo_bits/op_reshape_meat.hpp0000644000176200001440000001652314752446051024253 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_reshape //! @{ template inline void op_reshape::apply(Mat& out, const Op& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword new_n_rows = in.aux_uword_a; const uword new_n_cols = in.aux_uword_b; if(is_Mat::value) { const unwrap U(in.m); const Mat& A = U.M; if(&out == &A) { op_reshape::apply_mat_inplace(out, new_n_rows, new_n_cols); } else { op_reshape::apply_mat_noalias(out, A, new_n_rows, new_n_cols); } } else if((is_Mat::stored_type>::value) || (arma_config::openmp && Proxy::use_mp)) { const quasi_unwrap U(in.m); if(U.is_alias(out)) { Mat tmp; op_reshape::apply_mat_noalias(tmp, U.M, new_n_rows, new_n_cols); out.steal_mem(tmp); } else { op_reshape::apply_mat_noalias(out, U.M, new_n_rows, new_n_cols); } } else { const Proxy P(in.m); if(P.is_alias(out)) { Mat tmp; op_reshape::apply_proxy_noalias(tmp, P, new_n_rows, new_n_cols); out.steal_mem(tmp); } else { op_reshape::apply_proxy_noalias(out, P, new_n_rows, new_n_cols); } } } template inline void op_reshape::apply_mat_inplace(Mat& A, const uword new_n_rows, const uword new_n_cols) { arma_debug_sigprint(); if( (A.n_rows == new_n_rows) && (A.n_cols == new_n_cols) ) { return; } arma_conform_check( (A.vec_state == 1) && (new_n_cols != 1), "reshape(): requested size is not compatible with column vector layout" ); arma_conform_check( (A.vec_state == 2) && (new_n_rows != 1), "reshape(): requested size is not compatible with row vector layout" ); if(A.is_empty()) { A.zeros(new_n_rows, new_n_cols); return; } const bool is_into_empty = ( (new_n_cols == uword(0)) || (new_n_rows == uword(0)) ); const bool is_into_colvec = ( (new_n_cols == uword(1)) && (new_n_rows == A.n_elem) ); const bool is_into_rowvec = ( (new_n_rows == uword(1)) && (new_n_cols == A.n_elem) ); const bool is_rowcol_swap = ( (new_n_cols == A.n_rows) && (new_n_rows == A.n_cols) ); if(is_into_empty || is_into_colvec || is_into_rowvec || is_rowcol_swap) { A.set_size(new_n_rows, new_n_cols); return; } Mat B(new_n_rows, new_n_cols, arma_nozeros_indicator()); op_reshape::apply_mat_noalias(B, A, new_n_rows, new_n_cols); A.steal_mem(B); } template inline void op_reshape::apply_mat_noalias(Mat& out, const Mat& A, const uword new_n_rows, const uword new_n_cols) { arma_debug_sigprint(); out.set_size(new_n_rows, new_n_cols); const uword n_elem_to_copy = (std::min)(A.n_elem, out.n_elem); eT* out_mem = out.memptr(); arrayops::copy( out_mem, A.memptr(), n_elem_to_copy ); if(n_elem_to_copy < out.n_elem) { const uword n_elem_leftover = out.n_elem - n_elem_to_copy; arrayops::fill_zeros(&(out_mem[n_elem_to_copy]), n_elem_leftover); } } template inline void op_reshape::apply_proxy_noalias(Mat& out, const Proxy& P, const uword new_n_rows, const uword new_n_cols) { arma_debug_sigprint(); typedef typename T1::elem_type eT; out.set_size(new_n_rows, new_n_cols); const uword n_elem_to_copy = (std::min)(P.get_n_elem(), out.n_elem); eT* out_mem = out.memptr(); if(Proxy::use_at == false) { typename Proxy::ea_type Pea = P.get_ea(); for(uword i=0; i < n_elem_to_copy; ++i) { out_mem[i] = Pea[i]; } } else { uword i = 0; const uword P_n_rows = P.get_n_rows(); const uword P_n_cols = P.get_n_cols(); for(uword col=0; col < P_n_cols; ++col) for(uword row=0; row < P_n_rows; ++row) { if(i >= n_elem_to_copy) { goto nested_loop_end; } out_mem[i] = P.at(row,col); ++i; } nested_loop_end: ; } if(n_elem_to_copy < out.n_elem) { const uword n_elem_leftover = out.n_elem - n_elem_to_copy; arrayops::fill_zeros(&(out_mem[n_elem_to_copy]), n_elem_leftover); } } template inline void op_reshape::apply(Cube& out, const OpCube& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const unwrap_cube U(in.m); const Cube& A = U.M; const uword new_n_rows = in.aux_uword_a; const uword new_n_cols = in.aux_uword_b; const uword new_n_slices = in.aux_uword_c; if(&out == &A) { op_reshape::apply_cube_inplace(out, new_n_rows, new_n_cols, new_n_slices); } else { op_reshape::apply_cube_noalias(out, A, new_n_rows, new_n_cols, new_n_slices); } } template inline void op_reshape::apply_cube_inplace(Cube& A, const uword new_n_rows, const uword new_n_cols, const uword new_n_slices) { arma_debug_sigprint(); if( (A.n_rows == new_n_rows) && (A.n_cols == new_n_cols) && (A.n_slices == new_n_slices) ) { return; } if(A.is_empty()) { A.zeros(new_n_rows, new_n_cols, new_n_slices); return; } const bool is_into_empty = ( (new_n_cols == uword(0)) || (new_n_rows == uword(0)) || (new_n_slices == uword(0) ) ); const bool is_into_colvec = ( (new_n_cols == uword(1)) && (new_n_rows == A.n_elem) && (new_n_slices == uword(1) ) ); const bool is_into_rowvec = ( (new_n_rows == uword(1)) && (new_n_cols == A.n_elem) && (new_n_slices == uword(1) ) ); const bool is_rowcol_swap = ( (new_n_cols == A.n_rows) && (new_n_rows == A.n_cols) && (new_n_slices == A.n_slices) ); if(is_into_empty || is_into_colvec || is_into_rowvec || is_rowcol_swap) { A.set_size(new_n_rows, new_n_cols, new_n_slices); return; } Cube B(new_n_rows, new_n_cols, new_n_slices, arma_nozeros_indicator()); op_reshape::apply_cube_noalias(B, A, new_n_rows, new_n_cols, new_n_slices); A.steal_mem(B); } template inline void op_reshape::apply_cube_noalias(Cube& out, const Cube& A, const uword new_n_rows, const uword new_n_cols, const uword new_n_slices) { arma_debug_sigprint(); out.set_size(new_n_rows, new_n_cols, new_n_slices); const uword n_elem_to_copy = (std::min)(A.n_elem, out.n_elem); eT* out_mem = out.memptr(); arrayops::copy( out_mem, A.memptr(), n_elem_to_copy ); if(n_elem_to_copy < out.n_elem) { const uword n_elem_leftover = out.n_elem - n_elem_to_copy; arrayops::fill_zeros(&(out_mem[n_elem_to_copy]), n_elem_leftover); } } //! @} RcppArmadillo/inst/include/armadillo_bits/op_sp_minus_meat.hpp0000644000176200001440000001133214634016465024453 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_sp_minus //! @{ // scalar - SpBase template inline void op_sp_minus_pre::apply(Mat& out, const SpToDOp& in) { arma_debug_sigprint(); const SpProxy P(in.m); out.set_size(P.get_n_rows(), P.get_n_cols()); out.fill(in.aux); out -= P.Q; } // used for the optimization of sparse % (scalar - sparse) template inline void op_sp_minus_pre::apply_inside_schur(SpMat& out, const T2& x, const SpToDOp& y) { arma_debug_sigprint(); const SpProxy P2(x); const SpProxy P3(y.m); arma_conform_assert_same_size(P2.get_n_rows(), P2.get_n_cols(), P3.get_n_rows(), P3.get_n_cols(), "element-wise multiplication"); out.zeros(P2.get_n_rows(), P2.get_n_cols()); typename SpProxy::const_iterator_type it = P2.begin(); typename SpProxy::const_iterator_type it_end = P2.end(); const eT k = y.aux; for(; it != it_end; ++it) { const uword it_row = it.row(); const uword it_col = it.col(); out.at(it_row, it_col) = (*it) * (k - P3.at(it_row, it_col)); } } // used for the optimization of sparse / (scalar - sparse) template inline void op_sp_minus_pre::apply_inside_div(SpMat& out, const T2& x, const SpToDOp& y) { arma_debug_sigprint(); const SpProxy P2(x); const SpProxy P3(y.m); arma_conform_assert_same_size(P2.get_n_rows(), P2.get_n_cols(), P3.get_n_rows(), P3.get_n_cols(), "element-wise multiplication"); out.zeros(P2.get_n_rows(), P2.get_n_cols()); typename SpProxy::const_iterator_type it = P2.begin(); typename SpProxy::const_iterator_type it_end = P2.end(); const eT k = y.aux; for(; it != it_end; ++it) { const uword it_row = it.row(); const uword it_col = it.col(); out.at(it_row, it_col) = (*it) / (k - P3.at(it_row, it_col)); } } // SpBase - scalar template inline void op_sp_minus_post::apply(Mat& out, const SpToDOp& in) { arma_debug_sigprint(); const SpProxy P(in.m); out.set_size(P.get_n_rows(), P.get_n_cols()); out.fill(-in.aux); out += P.Q; } // used for the optimization of sparse % (sparse - scalar) template inline void op_sp_minus_post::apply_inside_schur(SpMat& out, const T2& x, const SpToDOp& y) { arma_debug_sigprint(); const SpProxy P2(x); const SpProxy P3(y.m); arma_conform_assert_same_size(P2.get_n_rows(), P2.get_n_cols(), P3.get_n_rows(), P3.get_n_cols(), "element-wise multiplication"); out.zeros(P2.get_n_rows(), P2.get_n_cols()); typename SpProxy::const_iterator_type it = P2.begin(); typename SpProxy::const_iterator_type it_end = P2.end(); const eT k = y.aux; for(; it != it_end; ++it) { const uword it_row = it.row(); const uword it_col = it.col(); out.at(it_row, it_col) = (*it) * (P3.at(it_row, it_col) - k); } } // used for the optimization of sparse / (sparse - scalar) template inline void op_sp_minus_post::apply_inside_div(SpMat& out, const T2& x, const SpToDOp& y) { arma_debug_sigprint(); const SpProxy P2(x); const SpProxy P3(y.m); arma_conform_assert_same_size(P2.get_n_rows(), P2.get_n_cols(), P3.get_n_rows(), P3.get_n_cols(), "element-wise multiplication"); out.zeros(P2.get_n_rows(), P2.get_n_cols()); typename SpProxy::const_iterator_type it = P2.begin(); typename SpProxy::const_iterator_type it_end = P2.end(); const eT k = y.aux; for(; it != it_end; ++it) { const uword it_row = it.row(); const uword it_col = it.col(); out.at(it_row, it_col) = (*it) / (P3.at(it_row, it_col) - k); } } //! @} RcppArmadillo/inst/include/armadillo_bits/promote_type.hpp0000644000176200001440000003404414301267044023635 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup promote_type //! @{ template struct is_promotable { static constexpr bool value = false; typedef T1 result; }; struct is_promotable_ok { static constexpr bool value = true; }; template struct is_promotable : public is_promotable_ok { typedef T result; }; template struct is_promotable, T> : public is_promotable_ok { typedef std::complex result; }; template<> struct is_promotable, std::complex> : public is_promotable_ok { typedef std::complex result; }; template<> struct is_promotable, float> : public is_promotable_ok { typedef std::complex result; }; template<> struct is_promotable, double> : public is_promotable_ok { typedef std::complex result; }; template struct is_promotable, u64> : public is_promotable_ok { typedef std::complex result; }; template struct is_promotable, s64> : public is_promotable_ok { typedef std::complex result; }; template struct is_promotable, ulng_t> : public is_promotable_ok { typedef std::complex result; }; template struct is_promotable, slng_t> : public is_promotable_ok { typedef std::complex result; }; template struct is_promotable, s32> : public is_promotable_ok { typedef std::complex result; }; template struct is_promotable, u32> : public is_promotable_ok { typedef std::complex result; }; template struct is_promotable, s16> : public is_promotable_ok { typedef std::complex result; }; template struct is_promotable, u16> : public is_promotable_ok { typedef std::complex result; }; template struct is_promotable, s8> : public is_promotable_ok { typedef std::complex result; }; template struct is_promotable, u8> : public is_promotable_ok { typedef std::complex result; }; template<> struct is_promotable : public is_promotable_ok { typedef double result; }; template<> struct is_promotable : public is_promotable_ok { typedef double result; }; template<> struct is_promotable : public is_promotable_ok { typedef double result; }; template<> struct is_promotable : public is_promotable_ok { typedef double result; }; template<> struct is_promotable : public is_promotable_ok { typedef double result; }; template<> struct is_promotable : public is_promotable_ok { typedef double result; }; template<> struct is_promotable : public is_promotable_ok { typedef double result; }; template<> struct is_promotable : public is_promotable_ok { typedef double result; }; template<> struct is_promotable : public is_promotable_ok { typedef double result; }; template<> struct is_promotable : public is_promotable_ok { typedef double result; }; template<> struct is_promotable : public is_promotable_ok { typedef double result; }; template<> struct is_promotable : public is_promotable_ok { typedef float result; }; template<> struct is_promotable : public is_promotable_ok { typedef float result; }; template<> struct is_promotable : public is_promotable_ok { typedef float result; }; template<> struct is_promotable : public is_promotable_ok { typedef float result; }; template<> struct is_promotable : public is_promotable_ok { typedef float result; }; template<> struct is_promotable : public is_promotable_ok { typedef float result; }; template<> struct is_promotable : public is_promotable_ok { typedef float result; }; template<> struct is_promotable : public is_promotable_ok { typedef float result; }; template<> struct is_promotable : public is_promotable_ok { typedef float result; }; template<> struct is_promotable : public is_promotable_ok { typedef float result; }; template<> struct is_promotable : public is_promotable_ok { typedef u64 result; }; template<> struct is_promotable : public is_promotable_ok { typedef u64 result; }; template<> struct is_promotable : public is_promotable_ok { typedef u64 result; }; template<> struct is_promotable : public is_promotable_ok { typedef s64 result; }; // float ? template<> struct is_promotable : public is_promotable_ok { typedef s64 result; }; template<> struct is_promotable : public is_promotable_ok { typedef s64 result; }; template<> struct is_promotable : public is_promotable_ok { typedef s64 result; }; template<> struct is_promotable : public is_promotable_ok { typedef s64 result; }; template<> struct is_promotable : public is_promotable_ok { typedef s64 result; }; template<> struct is_promotable : public is_promotable_ok { typedef s64 result; }; template<> struct is_promotable : public is_promotable_ok { typedef s32 result; }; // float ? template<> struct is_promotable : public is_promotable_ok { typedef s32 result; }; template<> struct is_promotable : public is_promotable_ok { typedef s32 result; }; template<> struct is_promotable : public is_promotable_ok { typedef s32 result; }; template<> struct is_promotable : public is_promotable_ok { typedef s32 result; }; template<> struct is_promotable : public is_promotable_ok { typedef s32 result; }; // float ? template<> struct is_promotable : public is_promotable_ok { typedef u32 result; }; template<> struct is_promotable : public is_promotable_ok { typedef s32 result; }; // float ? template<> struct is_promotable : public is_promotable_ok { typedef u32 result; }; template<> struct is_promotable : public is_promotable_ok { typedef s16 result; }; // s32 ? template<> struct is_promotable : public is_promotable_ok { typedef s16 result; }; template<> struct is_promotable : public is_promotable_ok { typedef s16 result; }; template<> struct is_promotable : public is_promotable_ok { typedef s16 result; }; // s32 ? template<> struct is_promotable : public is_promotable_ok { typedef u16 result; }; template<> struct is_promotable : public is_promotable_ok { typedef s8 result; }; // s16 ? // // mirrored versions template struct is_promotable> : public is_promotable_ok { typedef std::complex result; }; template<> struct is_promotable, std::complex> : public is_promotable_ok { typedef std::complex result; }; template<> struct is_promotable> : public is_promotable_ok { typedef std::complex result; }; template<> struct is_promotable > : public is_promotable_ok { typedef std::complex result; }; template struct is_promotable> : public is_promotable_ok { typedef std::complex result; }; template struct is_promotable> : public is_promotable_ok { typedef std::complex result; }; template struct is_promotable> : public is_promotable_ok { typedef std::complex result; }; template struct is_promotable> : public is_promotable_ok { typedef std::complex result; }; template struct is_promotable> : public is_promotable_ok { typedef std::complex result; }; template struct is_promotable> : public is_promotable_ok { typedef std::complex result; }; template struct is_promotable> : public is_promotable_ok { typedef std::complex result; }; template struct is_promotable> : public is_promotable_ok { typedef std::complex result; }; template struct is_promotable> : public is_promotable_ok { typedef std::complex result; }; template struct is_promotable> : public is_promotable_ok { typedef std::complex result; }; template<> struct is_promotable : public is_promotable_ok { typedef double result; }; template<> struct is_promotable : public is_promotable_ok { typedef double result; }; template<> struct is_promotable : public is_promotable_ok { typedef double result; }; template<> struct is_promotable : public is_promotable_ok { typedef double result; }; template<> struct is_promotable : public is_promotable_ok { typedef double result; }; template<> struct is_promotable : public is_promotable_ok { typedef double result; }; template<> struct is_promotable : public is_promotable_ok { typedef double result; }; template<> struct is_promotable : public is_promotable_ok { typedef double result; }; template<> struct is_promotable : public is_promotable_ok { typedef double result; }; template<> struct is_promotable : public is_promotable_ok { typedef double result; }; template<> struct is_promotable : public is_promotable_ok { typedef double result; }; template<> struct is_promotable : public is_promotable_ok { typedef float result; }; template<> struct is_promotable : public is_promotable_ok { typedef float result; }; template<> struct is_promotable : public is_promotable_ok { typedef float result; }; template<> struct is_promotable : public is_promotable_ok { typedef float result; }; template<> struct is_promotable : public is_promotable_ok { typedef float result; }; template<> struct is_promotable : public is_promotable_ok { typedef float result; }; template<> struct is_promotable : public is_promotable_ok { typedef float result; }; template<> struct is_promotable : public is_promotable_ok { typedef float result; }; template<> struct is_promotable : public is_promotable_ok { typedef float result; }; template<> struct is_promotable : public is_promotable_ok { typedef float result; }; template<> struct is_promotable : public is_promotable_ok { typedef u64 result; }; template<> struct is_promotable : public is_promotable_ok { typedef u64 result; }; template<> struct is_promotable : public is_promotable_ok { typedef u64 result; }; template<> struct is_promotable : public is_promotable_ok { typedef s64 result; }; // float ? template<> struct is_promotable : public is_promotable_ok { typedef s64 result; }; template<> struct is_promotable : public is_promotable_ok { typedef s64 result; }; template<> struct is_promotable : public is_promotable_ok { typedef s64 result; }; template<> struct is_promotable : public is_promotable_ok { typedef s64 result; }; template<> struct is_promotable : public is_promotable_ok { typedef s64 result; }; template<> struct is_promotable : public is_promotable_ok { typedef s64 result; }; template<> struct is_promotable : public is_promotable_ok { typedef s32 result; }; // float ? template<> struct is_promotable : public is_promotable_ok { typedef s32 result; }; template<> struct is_promotable : public is_promotable_ok { typedef s32 result; }; template<> struct is_promotable : public is_promotable_ok { typedef s32 result; }; template<> struct is_promotable : public is_promotable_ok { typedef s32 result; }; template<> struct is_promotable : public is_promotable_ok { typedef s32 result; }; // float ? template<> struct is_promotable : public is_promotable_ok { typedef u32 result; }; template<> struct is_promotable : public is_promotable_ok { typedef s32 result; }; // float ? template<> struct is_promotable : public is_promotable_ok { typedef u32 result; }; template<> struct is_promotable : public is_promotable_ok { typedef s16 result; }; // s32 ? template<> struct is_promotable : public is_promotable_ok { typedef s16 result; }; template<> struct is_promotable : public is_promotable_ok { typedef s16 result; }; template<> struct is_promotable : public is_promotable_ok { typedef s16 result; }; // s32 ? template<> struct is_promotable : public is_promotable_ok { typedef u16 result; }; template<> struct is_promotable : public is_promotable_ok { typedef s8 result; }; // s16 ? template struct promote_type { inline static void check() { arma_type_check(( is_promotable::value == false )); } typedef typename is_promotable::result result; }; template struct eT_promoter { typedef typename promote_type::result eT; }; //! @} RcppArmadillo/inst/include/armadillo_bits/SpBase_bones.hpp0000644000176200001440000001202314720640014023440 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup SpBase //! @{ template struct SpBase_eval_SpMat { arma_warn_unused inline const derived& eval() const; }; template struct SpBase_eval_expr { arma_warn_unused inline SpMat eval() const; //!< force the immediate evaluation of a delayed expression }; template struct SpBase_eval {}; template struct SpBase_eval { typedef SpBase_eval_SpMat result; }; template struct SpBase_eval { typedef SpBase_eval_expr result; }; template struct SpBase : public SpBase_eval::value>::result { arma_inline const derived& get_ref() const; arma_inline bool is_alias(const SpMat& X) const; arma_warn_unused inline const SpOp t() const; //!< Hermitian transpose arma_warn_unused inline const SpOp ht() const; //!< Hermitian transpose arma_warn_unused inline const SpOp st() const; //!< simple transpose arma_cold inline void print( const std::string extra_text = "") const; arma_cold inline void print(std::ostream& user_stream, const std::string extra_text = "") const; arma_cold inline void raw_print( const std::string extra_text = "") const; arma_cold inline void raw_print(std::ostream& user_stream, const std::string extra_text = "") const; arma_cold inline void print_dense( const std::string extra_text = "") const; arma_cold inline void print_dense(std::ostream& user_stream, const std::string extra_text = "") const; arma_cold inline void raw_print_dense( const std::string extra_text = "") const; arma_cold inline void raw_print_dense(std::ostream& user_stream, const std::string extra_text = "") const; arma_cold inline void brief_print( const std::string extra_text = "") const; arma_cold inline void brief_print(std::ostream& user_stream, const std::string extra_text = "") const; arma_warn_unused inline elem_type min() const; arma_warn_unused inline elem_type max() const; arma_frown("use .index_min() instead") inline elem_type min(uword& index_of_min_val) const; arma_frown("use .index_max() instead") inline elem_type max(uword& index_of_max_val) const; arma_frown("use .index_min() with ind2sub() instead") inline elem_type min(uword& row_of_min_val, uword& col_of_min_val) const; arma_frown("use .index_max() with ind2sub() instead") inline elem_type max(uword& row_of_max_val, uword& col_of_max_val) const; arma_warn_unused inline uword index_min() const; arma_warn_unused inline uword index_max() const; arma_warn_unused inline bool is_symmetric() const; arma_warn_unused inline bool is_symmetric(const typename get_pod_type::result tol) const; arma_warn_unused inline bool is_hermitian() const; arma_warn_unused inline bool is_hermitian(const typename get_pod_type::result tol) const; arma_warn_unused inline bool is_zero(const typename get_pod_type::result tol = 0) const; arma_warn_unused inline bool is_trimatu() const; arma_warn_unused inline bool is_trimatl() const; arma_warn_unused inline bool is_diagmat() const; arma_warn_unused inline bool is_empty() const; arma_warn_unused inline bool is_square() const; arma_warn_unused inline bool is_vec() const; arma_warn_unused inline bool is_colvec() const; arma_warn_unused inline bool is_rowvec() const; arma_warn_unused inline bool is_finite() const; arma_warn_unused inline bool has_inf() const; arma_warn_unused inline bool has_nan() const; arma_warn_unused inline bool has_nonfinite() const; arma_warn_unused inline const SpOp as_col() const; arma_warn_unused inline const SpOp as_row() const; arma_warn_unused inline const SpToDOp as_dense() const; }; //! @} RcppArmadillo/inst/include/armadillo_bits/fn_conv.hpp0000644000176200001440000000423314631567470022550 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_conv //! @{ //! Convolution, which is also equivalent to polynomial multiplication and FIR digital filtering. template arma_warn_unused inline typename enable_if2 < (is_arma_type::value && is_arma_type::value && is_same_type::value), const Glue >::result conv(const T1& A, const T2& B, const char* shape = "full") { arma_debug_sigprint(); const char sig = (shape != nullptr) ? shape[0] : char(0); arma_conform_check( ((sig != 'f') && (sig != 's')), "conv(): unsupported value of 'shape' parameter" ); const uword mode = (sig == 's') ? uword(1) : uword(0); return Glue(A, B, mode); } template arma_warn_unused inline typename enable_if2 < (is_arma_type::value && is_arma_type::value && is_same_type::value), const Glue >::result conv2(const T1& A, const T2& B, const char* shape = "full") { arma_debug_sigprint(); const char sig = (shape != nullptr) ? shape[0] : char(0); arma_conform_check( ((sig != 'f') && (sig != 's')), "conv2(): unsupported value of 'shape' parameter" ); const uword mode = (sig == 's') ? uword(1) : uword(0); return Glue(A, B, mode); } //! @} RcppArmadillo/inst/include/armadillo_bits/op_reshape_bones.hpp0000644000176200001440000000360314374704744024434 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_reshape //! @{ class op_reshape : public traits_op_default { public: template inline static void apply(Mat& out, const Op& in); template inline static void apply_mat_inplace(Mat& A, const uword new_n_rows, const uword new_n_cols); template inline static void apply_mat_noalias(Mat& out, const Mat& A, const uword new_n_rows, const uword new_n_cols); template inline static void apply_proxy_noalias(Mat& out, const Proxy& P, const uword new_n_rows, const uword new_n_cols); // template inline static void apply(Cube& out, const OpCube& in); template inline static void apply_cube_inplace(Cube& A, const uword new_n_rows, const uword new_n_cols, const uword new_n_slices); template inline static void apply_cube_noalias(Cube& out, const Cube& A, const uword new_n_rows, const uword new_n_cols, const uword new_n_slices); }; //! @} RcppArmadillo/inst/include/armadillo_bits/newarp_SortEigenvalue.hpp0000644000176200001440000001217314631567470025432 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ namespace newarp { // When comparing eigenvalues, we first calculate the "target" to sort. // For example, if we want to choose the eigenvalues with largest magnitude, the target will be -std::abs(x). // The minus sign is due to the fact that std::sort() sorts in ascending order. // default target: throw an exception template struct SortingTarget { arma_inline static typename get_pod_type::result get(const eT& val) { arma_ignore(val); arma_stop_logic_error("newarp::SortingTarget: incompatible selection rule"); typedef typename get_pod_type::result out_T; return out_T(0); } }; // specialisation for LARGEST_MAGN: this covers [float, double, complex] x [LARGEST_MAGN] template struct SortingTarget { arma_inline static typename get_pod_type::result get(const eT& val) { return -std::abs(val); } }; // specialisation for LARGEST_REAL: this covers [complex] x [LARGEST_REAL] template struct SortingTarget, EigsSelect::LARGEST_REAL> { arma_inline static T get(const std::complex& val) { return -val.real(); } }; // specialisation for LARGEST_IMAG: this covers [complex] x [LARGEST_IMAG] template struct SortingTarget, EigsSelect::LARGEST_IMAG> { arma_inline static T get(const std::complex& val) { return -std::abs(val.imag()); } }; // specialisation for LARGEST_ALGE: this covers [float, double] x [LARGEST_ALGE] template struct SortingTarget { arma_inline static eT get(const eT& val) { return -val; } }; // Here BOTH_ENDS is the same as LARGEST_ALGE, but we need some additional steps, // which are done in SymEigsSolver => retrieve_ritzpair(). // There we move the smallest values to the proper locations. template struct SortingTarget { arma_inline static eT get(const eT& val) { return -val; } }; // specialisation for SMALLEST_MAGN: this covers [float, double, complex] x [SMALLEST_MAGN] template struct SortingTarget { arma_inline static typename get_pod_type::result get(const eT& val) { return std::abs(val); } }; // specialisation for SMALLEST_REAL: this covers [complex] x [SMALLEST_REAL] template struct SortingTarget, EigsSelect::SMALLEST_REAL> { arma_inline static T get(const std::complex& val) { return val.real(); } }; // specialisation for SMALLEST_IMAG: this covers [complex] x [SMALLEST_IMAG] template struct SortingTarget, EigsSelect::SMALLEST_IMAG> { arma_inline static T get(const std::complex& val) { return std::abs(val.imag()); } }; // specialisation for SMALLEST_ALGE: this covers [float, double] x [SMALLEST_ALGE] template struct SortingTarget { arma_inline static eT get(const eT& val) { return val; } }; // Sort eigenvalues and return the order index template struct PairComparator { arma_inline bool operator() (const PairType& v1, const PairType& v2) { return v1.first < v2.first; } }; template class SortEigenvalue { private: typedef typename get_pod_type::result TargetType; // type of the sorting target, will be a floating number type, eg. double typedef std::pair PairType; // type of the sorting pair, including the sorting target and the index std::vector pair_sort; public: inline SortEigenvalue(const eT* start, const uword size) : pair_sort(size) { arma_debug_sigprint(); for(uword i = 0; i < size; i++) { pair_sort[i].first = SortingTarget::get(start[i]); pair_sort[i].second = i; } PairComparator comp; std::sort(pair_sort.begin(), pair_sort.end(), comp); } inline std::vector index() { arma_debug_sigprint(); const uword len = pair_sort.size(); std::vector ind(len); for(uword i = 0; i < len; i++) { ind[i] = pair_sort[i].second; } return ind; } }; } // namespace newarp RcppArmadillo/inst/include/armadillo_bits/arma_cmath.hpp0000644000176200001440000001220015030507611023166 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup arma_cmath //! @{ // // wrappers for isfinite template inline bool arma_isfinite(eT) { return true; } template<> inline bool arma_isfinite(float x) { return std::isfinite(x); } template<> inline bool arma_isfinite(double x) { return std::isfinite(x); } template inline bool arma_isfinite(const std::complex& x) { return ( arma_isfinite(x.real()) && arma_isfinite(x.imag()) ); } // template inline bool arma_isnonfinite(eT) { return false; } template<> inline bool arma_isnonfinite(float x) { return (std::isfinite(x) == false); } template<> inline bool arma_isnonfinite(double x) { return (std::isfinite(x) == false); } template inline bool arma_isnonfinite(const std::complex& x) { return ( (std::isfinite(x.real()) == false) || (std::isfinite(x.imag()) == false) ); } // // wrappers for isinf template inline bool arma_isinf(eT) { return false; } template<> inline bool arma_isinf(float x) { return std::isinf(x); } template<> inline bool arma_isinf(double x) { return std::isinf(x); } template inline bool arma_isinf(const std::complex& x) { return ( arma_isinf(x.real()) || arma_isinf(x.imag()) ); } // // wrappers for isnan template inline bool arma_isnan(eT val) { arma_ignore(val); return false; } template<> inline bool arma_isnan(float x) { return std::isnan(x); } template<> inline bool arma_isnan(double x) { return std::isnan(x); } template inline bool arma_isnan(const std::complex& x) { return ( arma_isnan(x.real()) || arma_isnan(x.imag()) ); } // // implementation of arma_sign() template constexpr typename arma_unsigned_integral_only::result arma_sign(const eT x) { return (x > eT(0)) ? eT(+1) : eT(0); } template constexpr typename arma_signed_integral_only::result arma_sign(const eT x) { return (x > eT(0)) ? eT(+1) : ( (x < eT(0)) ? eT(-1) : eT(0) ); } template constexpr typename arma_real_only::result arma_sign(const eT x) { return (x > eT(0)) ? eT(+1) : ( (x < eT(0)) ? eT(-1) : ((x == eT(0)) ? eT(0) : x) ); } template inline typename arma_cx_only::result arma_sign(const eT& x) { typedef typename eT::value_type T; const T abs_x = std::abs(x); return (abs_x != T(0)) ? (x / abs_x) : x; } // // wrappers for hypot(x, y) = sqrt(x^2 + y^2) template inline eT arma_hypot(const eT x, const eT y) { arma_ignore(x); arma_ignore(y); arma_stop_runtime_error("arma_hypot(): not implemented for integer or complex element types"); return eT(0); } template<> inline float arma_hypot(const float x, const float y) { return std::hypot(x, y); } template<> inline double arma_hypot(const double x, const double y) { return std::hypot(x, y); } // // implementation of arma_sinc() template inline eT arma_sinc_generic(const eT x) { typedef typename get_pod_type::result T; const eT tmp = Datum::pi * x; return (tmp == eT(0)) ? eT(1) : eT( std::sin(tmp) / tmp ); } template inline eT arma_sinc(const eT x) { return eT( arma_sinc_generic( double(x) ) ); } template<> inline float arma_sinc(const float x) { return arma_sinc_generic(x); } template<> inline double arma_sinc(const double x) { return arma_sinc_generic(x); } template inline std::complex arma_sinc(const std::complex& x) { return arma_sinc_generic(x); } // // wrappers for arg() template struct arma_arg { static inline eT eval(const eT x) { return eT( std::arg(x) ); } }; template<> struct arma_arg { static inline float eval(const float x) { return std::arg(x); } }; template<> struct arma_arg { static inline double eval(const double x) { return std::arg(x); } }; template<> struct arma_arg< std::complex > { static inline float eval(const std::complex& x) { return std::arg(x); } }; template<> struct arma_arg< std::complex > { static inline double eval(const std::complex& x) { return std::arg(x); } }; //! @} RcppArmadillo/inst/include/armadillo_bits/eGlue_bones.hpp0000644000176200001440000000442014752446051023340 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup eGlue //! @{ template class eGlue : public Base< typename T1::elem_type, eGlue > { public: typedef typename T1::elem_type elem_type; typedef typename get_pod_type::result pod_type; typedef Proxy proxy1_type; typedef Proxy proxy2_type; static constexpr bool use_at = (Proxy::use_at || Proxy::use_at ); static constexpr bool use_mp = (Proxy::use_mp || Proxy::use_mp ); static constexpr bool has_subview = (Proxy::has_subview || Proxy::has_subview); static constexpr bool is_col = (Proxy::is_col || Proxy::is_col ); static constexpr bool is_row = (Proxy::is_row || Proxy::is_row ); static constexpr bool is_xvec = (Proxy::is_xvec || Proxy::is_xvec); const Proxy P1; const Proxy P2; arma_inline ~eGlue(); arma_inline eGlue(const T1& in_A, const T2& in_B); template inline bool is_alias(const Mat& X) const; arma_inline uword get_n_rows() const; arma_inline uword get_n_cols() const; arma_inline uword get_n_elem() const; arma_inline elem_type operator[] (const uword ii) const; arma_inline elem_type at (const uword row, const uword col) const; arma_inline elem_type at_alt (const uword ii) const; }; //! @} RcppArmadillo/inst/include/armadillo_bits/glue_times_misc_meat.hpp0000644000176200001440000004070114631567470025276 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup glue_times_misc //! @{ template arma_inline typename arma_not_cx::result dense_sparse_helper::dot(const eT* A_mem, const SpMat& B, const uword col) { arma_debug_sigprint(); uword col_offset = B.col_ptrs[col ]; const uword next_col_offset = B.col_ptrs[col + 1]; const uword* start_ptr = &(B.row_indices[ col_offset]); const uword* end_ptr = &(B.row_indices[next_col_offset]); const eT* B_values = B.values; eT acc = eT(0); for(const uword* ptr = start_ptr; ptr != end_ptr; ++ptr) { const uword index = (*ptr); acc += A_mem[index] * B_values[col_offset]; ++col_offset; } return acc; } template arma_inline typename arma_cx_only::result dense_sparse_helper::dot(const eT* A_mem, const SpMat& B, const uword col) { arma_debug_sigprint(); typedef typename get_pod_type::result T; uword col_offset = B.col_ptrs[col ]; const uword next_col_offset = B.col_ptrs[col + 1]; const uword* start_ptr = &(B.row_indices[ col_offset]); const uword* end_ptr = &(B.row_indices[next_col_offset]); const eT* B_values = B.values; T acc_real = T(0); T acc_imag = T(0); for(const uword* ptr = start_ptr; ptr != end_ptr; ++ptr) { const uword index = (*ptr); const std::complex& X = A_mem[index]; const std::complex& Y = B_values[col_offset]; const T a = X.real(); const T b = X.imag(); const T c = Y.real(); const T d = Y.imag(); acc_real += (a*c) - (b*d); acc_imag += (a*d) + (b*c); ++col_offset; } return std::complex(acc_real, acc_imag); } template inline void glue_times_dense_sparse::apply(Mat& out, const SpToDGlue& expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; if(is_op_diagmat::value) { out = SpMat(expr.A) * expr.B; return; } // SpMat has specialised handling for op_diagmat const quasi_unwrap UA(expr.A); if(UA.is_alias(out)) { Mat tmp; glue_times_dense_sparse::apply_noalias(tmp, UA.M, expr.B); out.steal_mem(tmp); } else { glue_times_dense_sparse::apply_noalias(out, UA.M, expr.B); } } template inline void glue_times_dense_sparse::apply_noalias(Mat& out, const T1& x, const T2& y) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const quasi_unwrap UA(x); const Mat& A = UA.M; const unwrap_spmat UB(y); const SpMat& B = UB.M; arma_conform_assert_mul_size(A.n_rows, A.n_cols, B.n_rows, B.n_cols, "matrix multiplication"); out.set_size(A.n_rows, B.n_cols); if((A.n_elem == 0) || (B.n_nonzero == 0)) { out.zeros(); return; } if((resolves_to_rowvector::value) || (A.n_rows == 1)) { arma_debug_print("using row vector specialisation"); if( (arma_config::openmp) && (mp_thread_limit::in_parallel() == false) && (B.n_cols >= 2) && mp_gate::eval(B.n_nonzero) ) { #if defined(ARMA_USE_OPENMP) { arma_debug_print("openmp implementation"); eT* out_mem = out.memptr(); const eT* A_mem = A.memptr(); const uword B_n_cols = B.n_cols; const int n_threads = mp_thread_limit::get(); #pragma omp parallel for schedule(static) num_threads(n_threads) for(uword col=0; col < B_n_cols; ++col) { out_mem[col] = dense_sparse_helper::dot(A_mem, B, col); } } #endif } else { arma_debug_print("serial implementation"); eT* out_mem = out.memptr(); const eT* A_mem = A.memptr(); const uword B_n_cols = B.n_cols; for(uword col=0; col < B_n_cols; ++col) { out_mem[col] = dense_sparse_helper::dot(A_mem, B, col); } } } else if( (arma_config::openmp) && (mp_thread_limit::in_parallel() == false) && (A.n_rows <= (A.n_cols / uword(100))) ) { #if defined(ARMA_USE_OPENMP) { arma_debug_print("using parallelised multiplication"); const uword B_n_cols = B.n_cols; const int n_threads = mp_thread_limit::get(); #pragma omp parallel for schedule(static) num_threads(n_threads) for(uword i=0; i < B_n_cols; ++i) { const uword col_offset_1 = B.col_ptrs[i ]; const uword col_offset_2 = B.col_ptrs[i+1]; const uword col_offset_delta = col_offset_2 - col_offset_1; const uvec indices(const_cast(&(B.row_indices[col_offset_1])), col_offset_delta, false, false); const Col B_col(const_cast< eT*>(&( B.values[col_offset_1])), col_offset_delta, false, false); out.col(i) = A.cols(indices) * B_col; } } #endif } else { arma_debug_print("using standard multiplication"); out.zeros(); typename SpMat::const_iterator B_it = B.begin(); const uword nnz = B.n_nonzero; const uword out_n_rows = out.n_rows; for(uword count = 0; count < nnz; ++count, ++B_it) { const eT B_it_val = (*B_it); const uword B_it_col = B_it.col(); const uword B_it_row = B_it.row(); const eT* A_col = A.colptr(B_it_row); eT* out_col = out.colptr(B_it_col); for(uword row = 0; row < out_n_rows; ++row) { out_col[row] += A_col[row] * B_it_val; } } } } template inline void glue_times_dense_sparse::apply_mixed(Mat< typename promote_type::result >& out, const T1& X, const T2& Y) { arma_debug_sigprint(); typedef typename T1::elem_type eT1; typedef typename T2::elem_type eT2; typedef typename promote_type::result out_eT; promote_type::check(); if( (is_same_type::no) && (is_same_type::yes) ) { // upgrade T1 const quasi_unwrap UA(X); const unwrap_spmat UB(Y); const Mat& A = UA.M; const SpMat& B = UB.M; const Mat AA = conv_to< Mat >::from(A); const SpMat& BB = reinterpret_cast< const SpMat& >(B); glue_times_dense_sparse::apply_noalias(out, AA, BB); } else if( (is_same_type::yes) && (is_same_type::no) ) { // upgrade T2 const quasi_unwrap UA(X); const unwrap_spmat UB(Y); const Mat& A = UA.M; const SpMat& B = UB.M; const Mat& AA = reinterpret_cast< const Mat& >(A); SpMat BB(arma_layout_indicator(), B); for(uword i=0; i < B.n_nonzero; ++i) { access::rw(BB.values[i]) = out_eT(B.values[i]); } glue_times_dense_sparse::apply_noalias(out, AA, BB); } else { // upgrade T1 and T2 const quasi_unwrap UA(X); const unwrap_spmat UB(Y); const Mat& A = UA.M; const SpMat& B = UB.M; const Mat AA = conv_to< Mat >::from(A); SpMat BB(arma_layout_indicator(), B); for(uword i=0; i < B.n_nonzero; ++i) { access::rw(BB.values[i]) = out_eT(B.values[i]); } glue_times_dense_sparse::apply_noalias(out, AA, BB); } } // template inline void glue_times_sparse_dense::apply(Mat& out, const SpToDGlue& expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; if(is_op_diagmat::value) { out = expr.A * SpMat(expr.B); return; } // SpMat has specialised handling for op_diagmat const quasi_unwrap UB(expr.B); if((sp_strip_trans::do_htrans && is_cx::no) || (sp_strip_trans::do_strans)) { arma_debug_print("detected non-conjugate transpose of A"); const sp_strip_trans x_strip(expr.A); if(UB.is_alias(out)) { Mat tmp; glue_times_sparse_dense::apply_noalias_trans(tmp, x_strip.M, UB.M); out.steal_mem(tmp); } else { glue_times_sparse_dense::apply_noalias_trans(out, x_strip.M, UB.M); } } else { if(UB.is_alias(out)) { Mat tmp; glue_times_sparse_dense::apply_noalias(tmp, expr.A, UB.M); out.steal_mem(tmp); } else { glue_times_sparse_dense::apply_noalias(out, expr.A, UB.M); } } } template inline void glue_times_sparse_dense::apply_noalias(Mat& out, const T1& x, const T2& y) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const unwrap_spmat UA(x); const SpMat& A = UA.M; const quasi_unwrap UB(y); const Mat& B = UB.M; const uword A_n_rows = A.n_rows; const uword A_n_cols = A.n_cols; const uword B_n_rows = B.n_rows; const uword B_n_cols = B.n_cols; arma_conform_assert_mul_size(A_n_rows, A_n_cols, B_n_rows, B_n_cols, "matrix multiplication"); if((resolves_to_colvector::value) || (B_n_cols == 1)) { arma_debug_print("using column vector specialisation"); out.zeros(A_n_rows, 1); eT* out_mem = out.memptr(); const eT* B_mem = B.memptr(); typename SpMat::const_iterator A_it = A.begin(); const uword nnz = A.n_nonzero; for(uword count = 0; count < nnz; ++count, ++A_it) { const eT A_it_val = (*A_it); const uword A_it_row = A_it.row(); const uword A_it_col = A_it.col(); out_mem[A_it_row] += A_it_val * B_mem[A_it_col]; } } else if(B_n_cols >= (B_n_rows / uword(100))) { arma_debug_print("using transpose-based multiplication"); const SpMat At = A.st(); const Mat Bt = B.st(); if(A_n_rows == B_n_cols) { glue_times_dense_sparse::apply_noalias(out, Bt, At); op_strans::apply_mat(out, out); // since 'out' is square-sized, this will do an inplace transpose } else { Mat tmp; glue_times_dense_sparse::apply_noalias(tmp, Bt, At); op_strans::apply_mat(out, tmp); } } else { arma_debug_print("using standard multiplication"); out.zeros(A_n_rows, B_n_cols); typename SpMat::const_iterator A_it = A.begin(); const uword nnz = A.n_nonzero; for(uword count = 0; count < nnz; ++count, ++A_it) { const eT A_it_val = (*A_it); const uword A_it_row = A_it.row(); const uword A_it_col = A_it.col(); for(uword col = 0; col < B_n_cols; ++col) { out.at(A_it_row, col) += A_it_val * B.at(A_it_col, col); } } } } template inline void glue_times_sparse_dense::apply_noalias_trans(Mat& out, const T1& x, const T2& y) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const unwrap_spmat UA(x); const SpMat& A = UA.M; // NOTE: this is the given matrix without the transpose operation applied const quasi_unwrap UB(y); const Mat& B = UB.M; const uword A_n_rows = A.n_rows; const uword A_n_cols = A.n_cols; const uword B_n_rows = B.n_rows; const uword B_n_cols = B.n_cols; arma_conform_assert_mul_size(A_n_cols, A_n_rows, B_n_rows, B_n_cols, "matrix multiplication"); if((resolves_to_colvector::value) || (B_n_cols == 1)) { arma_debug_print("using column vector specialisation (avoiding transpose of A)"); if( (arma_config::openmp) && (mp_thread_limit::in_parallel() == false) && (A_n_cols >= 2) && mp_gate::eval(A.n_nonzero) ) { arma_debug_print("opemp implementation"); #if defined(ARMA_USE_OPENMP) { out.zeros(A_n_cols, 1); eT* out_mem = out.memptr(); const eT* B_mem = B.memptr(); const int n_threads = mp_thread_limit::get(); #pragma omp parallel for schedule(static) num_threads(n_threads) for(uword col=0; col < A_n_cols; ++col) { out_mem[col] = dense_sparse_helper::dot(B_mem, A, col); } } #endif } else { arma_debug_print("serial implementation"); out.zeros(A_n_cols, 1); eT* out_mem = out.memptr(); const eT* B_mem = B.memptr(); for(uword col=0; col < A_n_cols; ++col) { out_mem[col] = dense_sparse_helper::dot(B_mem, A, col); } } } else if(B_n_cols >= (B_n_rows / uword(100))) { arma_debug_print("using transpose-based multiplication (avoiding transpose of A)"); const Mat Bt = B.st(); if(A_n_cols == B_n_cols) { glue_times_dense_sparse::apply_noalias(out, Bt, A); op_strans::apply_mat(out, out); // since 'out' is square-sized, this will do an inplace transpose } else { Mat tmp; glue_times_dense_sparse::apply_noalias(tmp, Bt, A); op_strans::apply_mat(out, tmp); } } else { arma_debug_print("using standard multiplication (avoiding transpose of A)"); out.zeros(A_n_cols, B_n_cols); typename SpMat::const_iterator A_it = A.begin(); const uword nnz = A.n_nonzero; for(uword count = 0; count < nnz; ++count, ++A_it) { const eT A_it_val = (*A_it); const uword A_it_row = A_it.row(); const uword A_it_col = A_it.col(); for(uword col = 0; col < B_n_cols; ++col) { out.at(A_it_col, col) += A_it_val * B.at(A_it_row, col); } } } } template inline void glue_times_sparse_dense::apply_mixed(Mat< typename promote_type::result >& out, const T1& X, const T2& Y) { arma_debug_sigprint(); typedef typename T1::elem_type eT1; typedef typename T2::elem_type eT2; typedef typename promote_type::result out_eT; promote_type::check(); if( (is_same_type::no) && (is_same_type::yes) ) { // upgrade T1 const unwrap_spmat UA(X); const quasi_unwrap UB(Y); const SpMat& A = UA.M; const Mat& B = UB.M; SpMat AA(arma_layout_indicator(), A); for(uword i=0; i < A.n_nonzero; ++i) { access::rw(AA.values[i]) = out_eT(A.values[i]); } const Mat& BB = reinterpret_cast< const Mat& >(B); glue_times_sparse_dense::apply_noalias(out, AA, BB); } else if( (is_same_type::yes) && (is_same_type::no) ) { // upgrade T2 const unwrap_spmat UA(X); const quasi_unwrap UB(Y); const SpMat& A = UA.M; const Mat& B = UB.M; const SpMat& AA = reinterpret_cast< const SpMat& >(A); const Mat BB = conv_to< Mat >::from(B); glue_times_sparse_dense::apply_noalias(out, AA, BB); } else { // upgrade T1 and T2 const unwrap_spmat UA(X); const quasi_unwrap UB(Y); const SpMat& A = UA.M; const Mat& B = UB.M; SpMat AA(arma_layout_indicator(), A); for(uword i=0; i < A.n_nonzero; ++i) { access::rw(AA.values[i]) = out_eT(A.values[i]); } const Mat BB = conv_to< Mat >::from(B); glue_times_sparse_dense::apply_noalias(out, AA, BB); } } //! @} RcppArmadillo/inst/include/armadillo_bits/compiler_setup_post.hpp0000644000176200001440000000153214301267043025201 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ #if defined(_MSC_VER) #pragma warning(pop) #endif RcppArmadillo/inst/include/armadillo_bits/fn_fft.hpp0000644000176200001440000000563014631567470022364 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_fft //! @{ // 1D FFT & 1D IFFT template arma_warn_unused inline typename enable_if2 < (is_arma_type::value && is_real::value), const mtOp, T1, op_fft_real> >::result fft(const T1& A) { arma_debug_sigprint(); return mtOp, T1, op_fft_real>(A, uword(0), uword(1)); } template arma_warn_unused inline typename enable_if2 < (is_arma_type::value && is_real::value), const mtOp, T1, op_fft_real> >::result fft(const T1& A, const uword N) { arma_debug_sigprint(); return mtOp, T1, op_fft_real>(A, N, uword(0)); } template arma_warn_unused inline typename enable_if2 < (is_arma_type::value && (is_cx_float::yes || is_cx_double::yes)), const Op >::result fft(const T1& A) { arma_debug_sigprint(); return Op(A, uword(0), uword(1)); } template arma_warn_unused inline typename enable_if2 < (is_arma_type::value && (is_cx_float::yes || is_cx_double::yes)), const Op >::result fft(const T1& A, const uword N) { arma_debug_sigprint(); return Op(A, N, uword(0)); } template arma_warn_unused inline typename enable_if2 < (is_arma_type::value && (is_cx_float::yes || is_cx_double::yes)), const Op >::result ifft(const T1& A) { arma_debug_sigprint(); return Op(A, uword(0), uword(1)); } template arma_warn_unused inline typename enable_if2 < (is_arma_type::value && (is_cx_float::yes || is_cx_double::yes)), const Op >::result ifft(const T1& A, const uword N) { arma_debug_sigprint(); return Op(A, N, uword(0)); } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_qz.hpp0000644000176200001440000000356314635324415022234 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_qz //! @{ //! QZ decomposition for pair of N-by-N general matrices A and B template inline typename enable_if2 < is_supported_blas_type::value, bool >::result qz ( Mat& AA, Mat& BB, Mat& Q, Mat& Z, const Base& A_expr, const Base& B_expr, const char* select = "none" ) { arma_debug_sigprint(); const char sig = (select != nullptr) ? select[0] : char(0); arma_conform_check( ( (sig != 'n') && (sig != 'l') && (sig != 'r') && (sig != 'i') && (sig != 'o') ), "qz(): unknown select form" ); const bool status = auxlib::qz(AA, BB, Q, Z, A_expr.get_ref(), B_expr.get_ref(), sig); if(status == false) { AA.soft_reset(); BB.soft_reset(); Q.soft_reset(); Z.soft_reset(); arma_warn(3, "qz(): decomposition failed"); } return status; } //! @} RcppArmadillo/inst/include/armadillo_bits/op_reverse_meat.hpp0000644000176200001440000000560714631567470024305 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_reverse //! @{ template inline void op_reverse::apply(Mat& out, const Op& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword dim = in.aux_uword_a; arma_conform_check( (dim > 1), "reverse(): parameter 'dim' must be 0 or 1" ); if(is_Mat::value) { // allow detection of in-place operation const unwrap U(in.m); if(dim == 0) { op_flipud::apply_direct(out, U.M); } if(dim == 1) { op_fliplr::apply_direct(out, U.M); } } else { const Proxy P(in.m); if(P.is_alias(out)) { Mat tmp; if(dim == 0) { op_flipud::apply_proxy_noalias(tmp, P); } if(dim == 1) { op_fliplr::apply_proxy_noalias(tmp, P); } out.steal_mem(tmp); } else { if(dim == 0) { op_flipud::apply_proxy_noalias(out, P); } if(dim == 1) { op_fliplr::apply_proxy_noalias(out, P); } } } } template inline void op_reverse_vec::apply(Mat& out, const Op& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; if(is_Mat::value) { // allow detection of in-place operation const unwrap U(in.m); if((T1::is_xvec) ? bool(U.M.is_rowvec()) : bool(T1::is_row)) { op_fliplr::apply_direct(out, U.M); } else { op_flipud::apply_direct(out, U.M); } } else { const Proxy P(in.m); if(P.is_alias(out)) { Mat tmp; if((T1::is_xvec) ? bool(P.get_n_rows() == 1) : bool(T1::is_row)) { op_fliplr::apply_proxy_noalias(tmp, P); } else { op_flipud::apply_proxy_noalias(tmp, P); } out.steal_mem(tmp); } else { if((T1::is_xvec) ? bool(P.get_n_rows() == 1) : bool(T1::is_row)) { op_fliplr::apply_proxy_noalias(out, P); } else { op_flipud::apply_proxy_noalias(out, P); } } } } //! @} RcppArmadillo/inst/include/armadillo_bits/glue_cross_bones.hpp0000644000176200001440000000230714301267043024436 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup glue_cross //! @{ class glue_cross { public: template struct traits { static constexpr bool is_row = T1::is_row; static constexpr bool is_col = T1::is_col; static constexpr bool is_xvec = true; }; template inline static void apply(Mat& out, const Glue& X); }; //! @} RcppArmadillo/inst/include/armadillo_bits/fn_diff.hpp0000644000176200001440000000326014631567470022512 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_diff //! @{ template arma_warn_unused arma_inline typename enable_if2 < is_arma_type::value && resolves_to_vector::yes, const Op >::result diff ( const T1& X, const uword k = 1 ) { arma_debug_sigprint(); return Op(X, k, 0); } template arma_warn_unused arma_inline typename enable_if2 < is_arma_type::value && resolves_to_vector::no, const Op >::result diff ( const T1& X, const uword k = 1 ) { arma_debug_sigprint(); return Op(X, k, 0); } template arma_warn_unused arma_inline typename enable_if2 < is_arma_type::value, const Op >::result diff ( const T1& X, const uword k, const uword dim ) { arma_debug_sigprint(); return Op(X, k, dim); } //! @} RcppArmadillo/inst/include/armadillo_bits/diagview_bones.hpp0000644000176200001440000000723614752446051024106 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup diagview //! @{ //! Class for storing data required to extract and set the diagonals of a matrix template class diagview : public Base< eT, diagview > { public: typedef eT elem_type; typedef typename get_pod_type::result pod_type; const Mat& m; static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; const uword row_offset; const uword col_offset; const uword n_rows; // equal to n_elem const uword n_elem; static constexpr uword n_cols = 1; protected: arma_inline diagview(const Mat& in_m, const uword in_row_offset, const uword in_col_offset, const uword len); public: inline ~diagview(); inline diagview() = delete; inline diagview(const diagview& in); inline diagview( diagview&& in); inline void operator=(const diagview& x); inline void operator+=(const eT val); inline void operator-=(const eT val); inline void operator*=(const eT val); inline void operator/=(const eT val); template inline void operator= (const Base& x); template inline void operator+=(const Base& x); template inline void operator-=(const Base& x); template inline void operator%=(const Base& x); template inline void operator/=(const Base& x); arma_inline eT at_alt (const uword ii) const; arma_inline eT& operator[](const uword ii); arma_inline eT operator[](const uword ii) const; arma_inline eT& at(const uword ii); arma_inline eT at(const uword ii) const; arma_inline eT& operator()(const uword ii); arma_inline eT operator()(const uword ii) const; arma_inline eT& at(const uword in_n_row, const uword); arma_inline eT at(const uword in_n_row, const uword) const; arma_inline eT& operator()(const uword in_n_row, const uword in_n_col); arma_inline eT operator()(const uword in_n_row, const uword in_n_col) const; inline void replace(const eT old_val, const eT new_val); inline void clean(const pod_type threshold); inline void clamp(const eT min_val, const eT max_val); inline void fill(const eT val); inline void zeros(); inline void ones(); inline void randu(); inline void randn(); inline static void extract(Mat& out, const diagview& in); inline static void plus_inplace(Mat& out, const diagview& in); inline static void minus_inplace(Mat& out, const diagview& in); inline static void schur_inplace(Mat& out, const diagview& in); inline static void div_inplace(Mat& out, const diagview& in); template inline bool is_alias(const Mat& X) const; friend class Mat; friend class subview; }; //! @} RcppArmadillo/inst/include/armadillo_bits/spglue_min_meat.hpp0000644000176200001440000001243314631567470024271 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup spglue_min //! @{ template inline void spglue_min::apply(SpMat& out, const SpGlue& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const SpProxy pa(X.A); const SpProxy pb(X.B); const bool is_alias = pa.is_alias(out) || pb.is_alias(out); if(is_alias == false) { spglue_min::apply_noalias(out, pa, pb); } else { SpMat tmp; spglue_min::apply_noalias(tmp, pa, pb); out.steal_mem(tmp); } } template inline void spglue_min::apply_noalias(SpMat& out, const SpProxy& pa, const SpProxy& pb) { arma_debug_sigprint(); arma_conform_assert_same_size(pa.get_n_rows(), pa.get_n_cols(), pb.get_n_rows(), pb.get_n_cols(), "element-wise min()"); const uword max_n_nonzero = pa.get_n_nonzero() + pb.get_n_nonzero(); // Resize memory to upper bound out.reserve(pa.get_n_rows(), pa.get_n_cols(), max_n_nonzero); // Now iterate across both matrices. typename SpProxy::const_iterator_type x_it = pa.begin(); typename SpProxy::const_iterator_type x_end = pa.end(); typename SpProxy::const_iterator_type y_it = pb.begin(); typename SpProxy::const_iterator_type y_end = pb.end(); uword count = 0; while( (x_it != x_end) || (y_it != y_end) ) { eT out_val; const uword x_it_col = x_it.col(); const uword x_it_row = x_it.row(); const uword y_it_col = y_it.col(); const uword y_it_row = y_it.row(); bool use_y_loc = false; if(x_it == y_it) { out_val = elem_min(eT(*x_it), eT(*y_it)); ++x_it; ++y_it; } else { if((x_it_col < y_it_col) || ((x_it_col == y_it_col) && (x_it_row < y_it_row))) // if y is closer to the end { out_val = elem_min(eT(*x_it), eT(0)); ++x_it; } else { out_val = elem_min(eT(*y_it), eT(0)); ++y_it; use_y_loc = true; } } if(out_val != eT(0)) { access::rw(out.values[count]) = out_val; const uword out_row = (use_y_loc == false) ? x_it_row : y_it_row; const uword out_col = (use_y_loc == false) ? x_it_col : y_it_col; access::rw(out.row_indices[count]) = out_row; access::rw(out.col_ptrs[out_col + 1])++; ++count; } arma_check( (count > max_n_nonzero), "internal error: spglue_min::apply_noalias(): count > max_n_nonzero" ); } const uword out_n_cols = out.n_cols; uword* col_ptrs = access::rwp(out.col_ptrs); // Fix column pointers to be cumulative. for(uword c = 1; c <= out_n_cols; ++c) { col_ptrs[c] += col_ptrs[c - 1]; } if(count < max_n_nonzero) { if(count <= (max_n_nonzero/2)) { out.mem_resize(count); } else { // quick resize without reallocating memory and copying data access::rw( out.n_nonzero) = count; access::rw( out.values[count]) = eT(0); access::rw(out.row_indices[count]) = uword(0); } } } template inline void spglue_min::apply_noalias(SpMat& out, const SpMat& A, const SpMat& B) { arma_debug_sigprint(); const SpProxy< SpMat > pa(A); const SpProxy< SpMat > pb(B); spglue_min::apply_noalias(out, pa, pb); } template inline void spglue_min::dense_sparse_min(Mat& out, const Base& X, const SpBase& Y) { arma_debug_sigprint(); // NOTE: this function assumes there is no aliasing between matrix 'out' and X const Proxy pa(X.get_ref()); const SpProxy pb(Y.get_ref()); const uword n_rows = pa.get_n_rows(); const uword n_cols = pa.get_n_cols(); arma_conform_assert_same_size( n_rows, n_cols, pb.get_n_rows(), pb.get_n_cols(), "element-wise min()" ); out.set_size(n_rows, n_cols); for(uword c=0; c < n_cols; ++c) for(uword r=0; r < n_rows; ++r) { out.at(r,c) = elem_min(pa.at(r,c), pb.at(r,c)); } } // min of non-complex elements template inline typename enable_if2::no, eT>::result spglue_min::elem_min(const eT& a, const eT& b) { return (std::min)(a, b); } // min of complex elements template inline typename enable_if2::yes, eT>::result spglue_min::elem_min(const eT& a, const eT& b) { return (std::abs(a) < std::abs(b)) ? a : b; } //! @} RcppArmadillo/inst/include/armadillo_bits/eOp_bones.hpp0000644000176200001440000000477714752446051023041 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup eOp //! @{ template class eOp : public Base< typename T1::elem_type, eOp > { public: typedef typename T1::elem_type elem_type; typedef typename get_pod_type::result pod_type; typedef Proxy proxy_type; static constexpr bool use_at = Proxy::use_at; static constexpr bool use_mp = Proxy::use_mp || eop_type::use_mp; static constexpr bool has_subview = Proxy::has_subview; static constexpr bool is_row = Proxy::is_row; static constexpr bool is_col = Proxy::is_col; static constexpr bool is_xvec = Proxy::is_xvec; const Proxy P; elem_type aux; //!< storage of auxiliary data, user defined format uword aux_uword_a; //!< storage of auxiliary data, uword format uword aux_uword_b; //!< storage of auxiliary data, uword format inline ~eOp(); inline explicit eOp(const T1& in_m); inline eOp(const T1& in_m, const elem_type in_aux); inline eOp(const T1& in_m, const uword in_aux_uword_a, const uword in_aux_uword_b); inline eOp(const T1& in_m, const elem_type in_aux, const uword in_aux_uword_a, const uword in_aux_uword_b); template inline bool is_alias(const Mat& X) const; arma_inline uword get_n_rows() const; arma_inline uword get_n_cols() const; arma_inline uword get_n_elem() const; arma_inline elem_type operator[] (const uword ii) const; arma_inline elem_type at (const uword row, const uword col) const; arma_inline elem_type at_alt (const uword ii) const; }; //! @} RcppArmadillo/inst/include/armadillo_bits/fn_polyval.hpp0000644000176200001440000000240514631567470023270 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_polyval //! @{ template arma_warn_unused inline typename enable_if2 < (is_supported_blas_type::value && is_arma_type::value && is_same_type::value), const Glue >::result polyval(const Base& P, const T2& X) { arma_debug_sigprint(); return Glue(P.get_ref(), X); } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_trunc_exp.hpp0000644000176200001440000000361714631567470023617 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_trunc_exp //! @{ template arma_warn_unused inline static typename arma_real_only::result trunc_exp(const eT x) { if(std::numeric_limits::is_iec559 && (x >= Datum::log_max )) { return std::numeric_limits::max(); } else { return std::exp(x); } } template arma_warn_unused inline static typename arma_integral_only::result trunc_exp(const eT x) { return eT( trunc_exp( double(x) ) ); } template arma_warn_unused inline static std::complex trunc_exp(const std::complex& x) { return std::polar( trunc_exp( x.real() ), x.imag() ); } template arma_warn_unused arma_inline typename enable_if2< is_arma_type::value, const eOp >::result trunc_exp(const T1& A) { arma_debug_sigprint(); return eOp(A); } template arma_warn_unused arma_inline const eOpCube trunc_exp(const BaseCube& A) { arma_debug_sigprint(); return eOpCube(A.get_ref()); } //! @} RcppArmadillo/inst/include/armadillo_bits/SpSubview_col_list_bones.hpp0000644000176200001440000000655514301267043026121 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup SpSubview_col_list //! @{ template class SpSubview_col_list : public SpBase< eT, SpSubview_col_list > { public: typedef eT elem_type; typedef typename get_pod_type::result pod_type; static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = false; const SpMat& m; const quasi_unwrap U_ci; protected: arma_inline SpSubview_col_list(const SpMat& in_m, const Base& in_ci); public: inline ~SpSubview_col_list(); inline SpSubview_col_list() = delete; template inline void for_each(functor F); template inline void for_each(functor F) const; template inline void transform(functor F); inline void replace(const eT old_val, const eT new_val); inline void clean(const pod_type threshold); inline void fill(const eT val); inline void zeros(); inline void ones(); inline void operator+= (const eT val); inline void operator-= (const eT val); inline void operator*= (const eT val); inline void operator/= (const eT val); template inline void operator= (const Base& x); template inline void operator+=(const Base& x); template inline void operator-=(const Base& x); template inline void operator%=(const Base& x); template inline void operator/=(const Base& x); inline void operator= (const SpSubview_col_list& x); template inline void operator= (const SpSubview_col_list& x); template inline void operator= (const SpBase& x); template inline void operator+= (const SpBase& x); template inline void operator-= (const SpBase& x); template inline void operator%= (const SpBase& x); template inline void operator/= (const SpBase& x); inline static void extract(SpMat& out, const SpSubview_col_list& in); inline static void plus_inplace(SpMat& out, const SpSubview_col_list& in); inline static void minus_inplace(SpMat& out, const SpSubview_col_list& in); inline static void schur_inplace(SpMat& out, const SpSubview_col_list& in); inline static void div_inplace(SpMat& out, const SpSubview_col_list& in); friend class SpMat; }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_diff_bones.hpp0000644000176200001440000000247014301267043023700 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_diff //! @{ class op_diff : public traits_op_default { public: template inline static void apply_noalias(Mat& out, const Mat& X, const uword k, const uword dim); template inline static void apply(Mat& out, const Op& in); }; class op_diff_vec : public traits_op_passthru { public: template inline static void apply(Mat& out, const Op& in); }; //! @} RcppArmadillo/inst/include/armadillo_bits/running_stat_vec_meat.hpp0000644000176200001440000003373715030507611025472 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup running_stat_vec //! @{ template inline running_stat_vec::~running_stat_vec() { arma_debug_sigprint_this(this); } template inline running_stat_vec::running_stat_vec(const bool in_calc_cov) : calc_cov(in_calc_cov) { arma_debug_sigprint_this(this); } template inline running_stat_vec::running_stat_vec(const running_stat_vec& in_rsv) : calc_cov (in_rsv.calc_cov) , counter (in_rsv.counter) , r_mean (in_rsv.r_mean) , r_var (in_rsv.r_var) , r_cov (in_rsv.r_cov) , min_val (in_rsv.min_val) , max_val (in_rsv.max_val) , min_val_norm(in_rsv.min_val_norm) , max_val_norm(in_rsv.max_val_norm) { arma_debug_sigprint_this(this); } template inline running_stat_vec& running_stat_vec::operator=(const running_stat_vec& in_rsv) { arma_debug_sigprint(); access::rw(calc_cov) = in_rsv.calc_cov; counter = in_rsv.counter; r_mean = in_rsv.r_mean; r_var = in_rsv.r_var; r_cov = in_rsv.r_cov; min_val = in_rsv.min_val; max_val = in_rsv.max_val; min_val_norm = in_rsv.min_val_norm; max_val_norm = in_rsv.max_val_norm; return *this; } //! update statistics to reflect new sample template template inline void running_stat_vec::operator() (const Base::T, T1>& X) { arma_debug_sigprint(); const quasi_unwrap tmp(X.get_ref()); const Mat& sample = tmp.M; if( sample.is_empty() ) { return; } if( sample.internal_has_nonfinite() ) { arma_warn(3, "running_stat_vec: non-finite sample ignored"); return; } running_stat_vec_aux::update_stats(*this, sample); } template template inline void running_stat_vec::operator() (const Base< std::complex::T>, T1>& X) { arma_debug_sigprint(); const quasi_unwrap tmp(X.get_ref()); const Mat< std::complex >& sample = tmp.M; if( sample.is_empty() ) { return; } if( sample.internal_has_nonfinite() ) { arma_warn(3, "running_stat_vec: non-finite sample ignored"); return; } running_stat_vec_aux::update_stats(*this, sample); } //! set all statistics to zero template inline void running_stat_vec::reset() { arma_debug_sigprint(); counter.reset(); r_mean.reset(); r_var.reset(); r_cov.reset(); min_val.reset(); max_val.reset(); min_val_norm.reset(); max_val_norm.reset(); r_var_dummy.reset(); r_cov_dummy.reset(); tmp1.reset(); tmp2.reset(); } //! mean or average value template inline const typename running_stat_vec::return_type1& running_stat_vec::mean() const { arma_debug_sigprint(); return r_mean; } //! variance template inline const typename running_stat_vec::return_type2& running_stat_vec::var(const uword norm_type) { arma_debug_sigprint(); const T N = counter.value(); if(N > T(1)) { if(norm_type == 0) { return r_var; } else { const T N_minus_1 = counter.value_minus_1(); r_var_dummy = (N_minus_1/N) * r_var; return r_var_dummy; } } else { r_var_dummy.zeros(r_mean.n_rows, r_mean.n_cols); return r_var_dummy; } } //! standard deviation template inline typename running_stat_vec::return_type2 running_stat_vec::stddev(const uword norm_type) const { arma_debug_sigprint(); const T N = counter.value(); if(N > T(1)) { if(norm_type == 0) { return sqrt(r_var); } else { const T N_minus_1 = counter.value_minus_1(); return sqrt( (N_minus_1/N) * r_var ); } } else { typedef typename running_stat_vec::return_type2 out_type; return out_type(); } } //! covariance template inline const Mat< typename running_stat_vec::eT >& running_stat_vec::cov(const uword norm_type) { arma_debug_sigprint(); if(calc_cov) { const T N = counter.value(); if(N > T(1)) { if(norm_type == 0) { return r_cov; } else { const T N_minus_1 = counter.value_minus_1(); r_cov_dummy = (N_minus_1/N) * r_cov; return r_cov_dummy; } } else { const uword out_size = (std::max)(r_mean.n_rows, r_mean.n_cols); r_cov_dummy.zeros(out_size, out_size); return r_cov_dummy; } } else { r_cov_dummy.reset(); return r_cov_dummy; } } //! vector with minimum values template inline const typename running_stat_vec::return_type1& running_stat_vec::min() const { arma_debug_sigprint(); return min_val; } //! vector with maximum values template inline const typename running_stat_vec::return_type1& running_stat_vec::max() const { arma_debug_sigprint(); return max_val; } template inline typename running_stat_vec::return_type1 running_stat_vec::range() const { arma_debug_sigprint(); return (max_val - min_val); } //! number of samples so far template inline typename running_stat_vec::T running_stat_vec::count() const { arma_debug_sigprint(); return counter.value(); } // //! update statistics to reflect new sample (version for non-complex numbers) template inline void running_stat_vec_aux::update_stats ( running_stat_vec& x, const Mat::eT>& sample, const typename arma_not_cx::eT>::result* junk ) { arma_debug_sigprint(); arma_ignore(junk); typedef typename running_stat_vec::eT eT; typedef typename running_stat_vec::T T; const T N = x.counter.value(); if(N > T(0)) { arma_conform_assert_same_size(x.r_mean, sample, "running_stat_vec(): dimensionality mismatch"); const uword n_elem = sample.n_elem; const eT* sample_mem = sample.memptr(); eT* r_mean_mem = x.r_mean.memptr(); T* r_var_mem = x.r_var.memptr(); eT* min_val_mem = x.min_val.memptr(); eT* max_val_mem = x.max_val.memptr(); const T N_plus_1 = x.counter.value_plus_1(); const T N_minus_1 = x.counter.value_minus_1(); if(x.calc_cov) { Mat& tmp1 = x.tmp1; Mat& tmp2 = x.tmp2; tmp1 = sample - x.r_mean; if(sample.n_cols == 1) { tmp2 = tmp1*trans(tmp1); } else { tmp2 = trans(tmp1)*tmp1; } x.r_cov *= (N_minus_1/N); x.r_cov += tmp2 / N_plus_1; } for(uword i=0; i max_val_mem[i]) { max_val_mem[i] = val; } const eT r_mean_val = r_mean_mem[i]; const eT tmp = val - r_mean_val; r_var_mem[i] = N_minus_1/N * r_var_mem[i] + (tmp*tmp)/N_plus_1; r_mean_mem[i] = r_mean_val + (val - r_mean_val)/N_plus_1; } } else { arma_conform_check( (sample.is_vec() == false), "running_stat_vec(): given sample must be a vector" ); x.r_mean.set_size(sample.n_rows, sample.n_cols); x.r_var.zeros(sample.n_rows, sample.n_cols); if(x.calc_cov) { x.r_cov.zeros(sample.n_elem, sample.n_elem); } x.min_val.set_size(sample.n_rows, sample.n_cols); x.max_val.set_size(sample.n_rows, sample.n_cols); const uword n_elem = sample.n_elem; const eT* sample_mem = sample.memptr(); eT* r_mean_mem = x.r_mean.memptr(); eT* min_val_mem = x.min_val.memptr(); eT* max_val_mem = x.max_val.memptr(); for(uword i=0; i inline void running_stat_vec_aux::update_stats ( running_stat_vec& x, const Mat::T > >& sample, const typename arma_not_cx::eT>::result* junk ) { arma_debug_sigprint(); arma_ignore(junk); typedef typename running_stat_vec::eT eT; running_stat_vec_aux::update_stats(x, conv_to< Mat >::from(sample)); } //! update statistics to reflect new sample (version for complex numbers, non-complex sample) template inline void running_stat_vec_aux::update_stats ( running_stat_vec& x, const Mat::T >& sample, const typename arma_cx_only::eT>::result* junk ) { arma_debug_sigprint(); arma_ignore(junk); typedef typename running_stat_vec::eT eT; running_stat_vec_aux::update_stats(x, conv_to< Mat >::from(sample)); } //! alter statistics to reflect new sample (version for complex numbers, complex sample) template inline void running_stat_vec_aux::update_stats ( running_stat_vec& x, const Mat::eT>& sample, const typename arma_cx_only::eT>::result* junk ) { arma_debug_sigprint(); arma_ignore(junk); typedef typename running_stat_vec::eT eT; typedef typename running_stat_vec::T T; const T N = x.counter.value(); if(N > T(0)) { arma_conform_assert_same_size(x.r_mean, sample, "running_stat_vec(): dimensionality mismatch"); const uword n_elem = sample.n_elem; const eT* sample_mem = sample.memptr(); eT* r_mean_mem = x.r_mean.memptr(); T* r_var_mem = x.r_var.memptr(); eT* min_val_mem = x.min_val.memptr(); eT* max_val_mem = x.max_val.memptr(); T* min_val_norm_mem = x.min_val_norm.memptr(); T* max_val_norm_mem = x.max_val_norm.memptr(); const T N_plus_1 = x.counter.value_plus_1(); const T N_minus_1 = x.counter.value_minus_1(); if(x.calc_cov) { Mat& tmp1 = x.tmp1; Mat& tmp2 = x.tmp2; tmp1 = sample - x.r_mean; if(sample.n_cols == 1) { tmp2 = arma::conj(tmp1)*strans(tmp1); } else { tmp2 = trans(tmp1)*tmp1; //tmp2 = strans(conj(tmp1))*tmp1; } x.r_cov *= (N_minus_1/N); x.r_cov += tmp2 / N_plus_1; } for(uword i=0; i max_val_norm_mem[i]) { max_val_norm_mem[i] = val_norm; max_val_mem[i] = val; } const eT& r_mean_val = r_mean_mem[i]; r_var_mem[i] = N_minus_1/N * r_var_mem[i] + std::norm(val - r_mean_val)/N_plus_1; r_mean_mem[i] = r_mean_val + (val - r_mean_val)/N_plus_1; } } else { arma_conform_check( (sample.is_vec() == false), "running_stat_vec(): given sample must be a vector" ); x.r_mean.set_size(sample.n_rows, sample.n_cols); x.r_var.zeros(sample.n_rows, sample.n_cols); if(x.calc_cov) { x.r_cov.zeros(sample.n_elem, sample.n_elem); } x.min_val.set_size(sample.n_rows, sample.n_cols); x.max_val.set_size(sample.n_rows, sample.n_cols); x.min_val_norm.set_size(sample.n_rows, sample.n_cols); x.max_val_norm.set_size(sample.n_rows, sample.n_cols); const uword n_elem = sample.n_elem; const eT* sample_mem = sample.memptr(); eT* r_mean_mem = x.r_mean.memptr(); eT* min_val_mem = x.min_val.memptr(); eT* max_val_mem = x.max_val.memptr(); T* min_val_norm_mem = x.min_val_norm.memptr(); T* max_val_norm_mem = x.max_val_norm.memptr(); for(uword i=0; i inline static void apply(Mat& out, const mtSpReduceOp& in); // template inline static void apply_proxy(Mat& out, const SpProxy& p, const uword dim, const typename arma_not_cx::result* junk = nullptr); template inline static typename T1::elem_type vector_max(const T1& X, const typename arma_not_cx::result* junk = nullptr); template inline static typename arma_not_cx::result max(const SpBase& X); template inline static typename arma_not_cx::result max_with_index(const SpProxy& P, uword& index_of_max_val); // template inline static void apply_proxy(Mat& out, const SpProxy& p, const uword dim, const typename arma_cx_only::result* junk = nullptr); template inline static typename T1::elem_type vector_max(const T1& X, const typename arma_cx_only::result* junk = nullptr); template inline static typename arma_cx_only::result max(const SpBase& X); template inline static typename arma_cx_only::result max_with_index(const SpProxy& P, uword& index_of_max_val); }; //! @} RcppArmadillo/inst/include/armadillo_bits/traits.hpp0000644000176200001440000007500514752446051022426 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup traits //! @{ template struct get_pod_type { typedef T1 result; }; template struct get_pod_type< std::complex > { typedef T2 result; }; template struct is_Mat_fixed_only { using yes = char[1]; using no = char[2]; template static yes& check(typename X::Mat_fixed_type*); template static no& check(...); static constexpr bool value = ( sizeof(check(0)) == sizeof(yes) ); }; template struct is_Row_fixed_only { using yes = char[1]; using no = char[2]; template static yes& check(typename X::Row_fixed_type*); template static no& check(...); static constexpr bool value = ( sizeof(check(0)) == sizeof(yes) ); }; template struct is_Col_fixed_only { using yes = char[1]; using no = char[2]; template static yes& check(typename X::Col_fixed_type*); template static no& check(...); static constexpr bool value = ( sizeof(check(0)) == sizeof(yes) ); }; template struct is_Mat_fixed { static constexpr bool value = ( is_Mat_fixed_only::value || is_Row_fixed_only::value || is_Col_fixed_only::value ); }; template struct is_Mat_only { static constexpr bool value = is_Mat_fixed_only::value; }; template struct is_Mat_only< Mat > { static constexpr bool value = true; }; template struct is_Mat_only< const Mat > { static constexpr bool value = true; }; template struct is_Mat { static constexpr bool value = ( is_Mat_fixed_only::value || is_Row_fixed_only::value || is_Col_fixed_only::value ); }; template struct is_Mat< Mat > { static constexpr bool value = true; }; template struct is_Mat< const Mat > { static constexpr bool value = true; }; template struct is_Mat< Row > { static constexpr bool value = true; }; template struct is_Mat< const Row > { static constexpr bool value = true; }; template struct is_Mat< Col > { static constexpr bool value = true; }; template struct is_Mat< const Col > { static constexpr bool value = true; }; template struct is_Row { static constexpr bool value = is_Row_fixed_only::value; }; template struct is_Row< Row > { static constexpr bool value = true; }; template struct is_Row< const Row > { static constexpr bool value = true; }; template struct is_Col { static constexpr bool value = is_Col_fixed_only::value; }; template struct is_Col< Col > { static constexpr bool value = true; }; template struct is_Col< const Col > { static constexpr bool value = true; }; template struct is_diagview { static constexpr bool value = false; }; template struct is_diagview< diagview > { static constexpr bool value = true; }; template struct is_diagview< const diagview > { static constexpr bool value = true; }; template struct is_subview { static constexpr bool value = false; }; template struct is_subview< subview > { static constexpr bool value = true; }; template struct is_subview< const subview > { static constexpr bool value = true; }; template struct is_subview_row { static constexpr bool value = false; }; template struct is_subview_row< subview_row > { static constexpr bool value = true; }; template struct is_subview_row< const subview_row > { static constexpr bool value = true; }; template struct is_subview_col { static constexpr bool value = false; }; template struct is_subview_col< subview_col > { static constexpr bool value = true; }; template struct is_subview_col< const subview_col > { static constexpr bool value = true; }; template struct is_subview_cols { static constexpr bool value = false; }; template struct is_subview_cols< subview_cols > { static constexpr bool value = true; }; template struct is_subview_cols< const subview_cols > { static constexpr bool value = true; }; template struct is_subview_elem1 { static constexpr bool value = false; }; template struct is_subview_elem1< subview_elem1 > { static constexpr bool value = true; }; template struct is_subview_elem1< const subview_elem1 > { static constexpr bool value = true; }; template struct is_subview_elem2 { static constexpr bool value = false; }; template struct is_subview_elem2< subview_elem2 > { static constexpr bool value = true; }; template struct is_subview_elem2< const subview_elem2 > { static constexpr bool value = true; }; // // // template struct is_Cube { static constexpr bool value = false; }; template struct is_Cube< Cube > { static constexpr bool value = true; }; template struct is_Cube< const Cube > { static constexpr bool value = true; }; template struct is_subview_cube { static constexpr bool value = false; }; template struct is_subview_cube< subview_cube > { static constexpr bool value = true; }; template struct is_subview_cube< const subview_cube > { static constexpr bool value = true; }; template struct is_subview_cube_slices { static constexpr bool value = false; }; template struct is_subview_cube_slices< subview_cube_slices > { static constexpr bool value = true; }; template struct is_subview_cube_slices< const subview_cube_slices > { static constexpr bool value = true; }; // // // template struct is_Gen { static constexpr bool value = false; }; template struct is_Gen< Gen > { static constexpr bool value = true; }; template struct is_Gen< const Gen > { static constexpr bool value = true; }; template struct is_Op { static constexpr bool value = false; }; template struct is_Op< Op > { static constexpr bool value = true; }; template struct is_Op< const Op > { static constexpr bool value = true; }; template struct is_CubeToMatOp { static constexpr bool value = false; }; template struct is_CubeToMatOp< CubeToMatOp > { static constexpr bool value = true; }; template struct is_CubeToMatOp< const CubeToMatOp > { static constexpr bool value = true; }; template struct is_SpToDOp { static constexpr bool value = false; }; template struct is_SpToDOp< SpToDOp > { static constexpr bool value = true; }; template struct is_SpToDOp< const SpToDOp > { static constexpr bool value = true; }; template struct is_SpToDGlue { static constexpr bool value = false; }; template struct is_SpToDGlue< SpToDGlue > { static constexpr bool value = true; }; template struct is_SpToDGlue< const SpToDGlue > { static constexpr bool value = true; }; template struct is_eOp { static constexpr bool value = false; }; template struct is_eOp< eOp > { static constexpr bool value = true; }; template struct is_eOp< const eOp > { static constexpr bool value = true; }; template struct is_mtOp { static constexpr bool value = false; }; template struct is_mtOp< mtOp > { static constexpr bool value = true; }; template struct is_mtOp< const mtOp > { static constexpr bool value = true; }; template struct is_Glue { static constexpr bool value = false; }; template struct is_Glue< Glue > { static constexpr bool value = true; }; template struct is_Glue< const Glue > { static constexpr bool value = true; }; template struct is_eGlue { static constexpr bool value = false; }; template struct is_eGlue< eGlue > { static constexpr bool value = true; }; template struct is_eGlue< const eGlue > { static constexpr bool value = true; }; template struct is_mtGlue { static constexpr bool value = false; }; template struct is_mtGlue< mtGlue > { static constexpr bool value = true; }; template struct is_mtGlue< const mtGlue > { static constexpr bool value = true; }; // // template struct is_glue_times { static constexpr bool value = false; }; template struct is_glue_times< Glue > { static constexpr bool value = true; }; template struct is_glue_times< const Glue > { static constexpr bool value = true; }; template struct is_glue_times_diag { static constexpr bool value = false; }; template struct is_glue_times_diag< Glue > { static constexpr bool value = true; }; template struct is_glue_times_diag< const Glue > { static constexpr bool value = true; }; template struct is_op_diagmat { static constexpr bool value = false; }; template struct is_op_diagmat< Op > { static constexpr bool value = true; }; template struct is_op_diagmat< const Op > { static constexpr bool value = true; }; // // template struct is_GenCube { static constexpr bool value = false; }; template struct is_GenCube< GenCube > { static constexpr bool value = true; }; template struct is_OpCube { static constexpr bool value = false; }; template struct is_OpCube< OpCube > { static constexpr bool value = true; }; template struct is_eOpCube { static constexpr bool value = false; }; template struct is_eOpCube< eOpCube > { static constexpr bool value = true; }; template struct is_mtOpCube { static constexpr bool value = false; }; template struct is_mtOpCube< mtOpCube > { static constexpr bool value = true; }; template struct is_GlueCube { static constexpr bool value = false; }; template struct is_GlueCube< GlueCube > { static constexpr bool value = true; }; template struct is_eGlueCube { static constexpr bool value = false; }; template struct is_eGlueCube< eGlueCube > { static constexpr bool value = true; }; template struct is_mtGlueCube { static constexpr bool value = false; }; template struct is_mtGlueCube< mtGlueCube > { static constexpr bool value = true; }; // // // template struct is_arma_type2 { static constexpr bool value = is_Mat::value || is_Gen::value || is_Op::value || is_Glue::value || is_eOp::value || is_eGlue::value || is_mtOp::value || is_mtGlue::value || is_diagview::value || is_subview::value || is_subview_row::value || is_subview_col::value || is_subview_cols::value || is_subview_elem1::value || is_subview_elem2::value || is_CubeToMatOp::value || is_SpToDOp::value || is_SpToDGlue::value ; }; // due to rather baroque C++ rules for proving constant expressions, // certain compilers may get confused with the combination of conditional inheritance, nested classes and the shenanigans in is_Mat_fixed_only. // below we explicitly ensure the type is forced to be const, which seems to eliminate the confusion. template struct is_arma_type { static constexpr bool value = is_arma_type2::value; }; template struct is_arma_cube_type { static constexpr bool value = is_Cube::value || is_GenCube::value || is_OpCube::value || is_eOpCube::value || is_mtOpCube::value || is_GlueCube::value || is_eGlueCube::value || is_mtGlueCube::value || is_subview_cube::value || is_subview_cube_slices::value ; }; // // // template struct is_SpMat { static constexpr bool value = false; }; template struct is_SpMat< SpMat > { static constexpr bool value = true; }; template struct is_SpMat< SpCol > { static constexpr bool value = true; }; template struct is_SpMat< SpRow > { static constexpr bool value = true; }; template struct is_SpRow { static constexpr bool value = false; }; template struct is_SpRow< SpRow > { static constexpr bool value = true; }; template struct is_SpCol { static constexpr bool value = false; }; template struct is_SpCol< SpCol > { static constexpr bool value = true; }; template struct is_SpSubview { static constexpr bool value = false; }; template struct is_SpSubview< SpSubview > { static constexpr bool value = true; }; template struct is_SpSubview_col { static constexpr bool value = false; }; template struct is_SpSubview_col< SpSubview_col > { static constexpr bool value = true; }; template struct is_SpSubview_col_list { static constexpr bool value = false; }; template struct is_SpSubview_col_list< SpSubview_col_list > { static constexpr bool value = true; }; template struct is_SpSubview_row { static constexpr bool value = false; }; template struct is_SpSubview_row< SpSubview_row > { static constexpr bool value = true; }; template struct is_spdiagview { static constexpr bool value = false; }; template struct is_spdiagview< spdiagview > { static constexpr bool value = true; }; template struct is_SpOp { static constexpr bool value = false; }; template struct is_SpOp< SpOp > { static constexpr bool value = true; }; template struct is_SpGlue { static constexpr bool value = false; }; template struct is_SpGlue< SpGlue > { static constexpr bool value = true; }; template struct is_mtSpOp { static constexpr bool value = false; }; template struct is_mtSpOp< mtSpOp > { static constexpr bool value = true; }; template struct is_mtSpGlue { static constexpr bool value = false; }; template struct is_mtSpGlue< mtSpGlue > { static constexpr bool value = true; }; template struct is_mtSpReduceOp { static constexpr bool value = false; }; template struct is_mtSpReduceOp< mtSpReduceOp > { static constexpr bool value = true; }; template struct is_arma_sparse_type { static constexpr bool value = is_SpMat::value || is_SpSubview::value || is_SpSubview_col::value || is_SpSubview_col_list::value || is_SpSubview_row::value || is_spdiagview::value || is_SpOp::value || is_SpGlue::value || is_mtSpOp::value || is_mtSpGlue::value || is_mtSpReduceOp::value ; }; // // // template struct is_same_type { static constexpr bool value = false; static constexpr bool yes = false; static constexpr bool no = true; }; template struct is_same_type { static constexpr bool value = true; static constexpr bool yes = true; static constexpr bool no = false; }; // // // template struct is_u8 { static constexpr bool value = false; }; template<> struct is_u8 { static constexpr bool value = true; }; template struct is_s8 { static constexpr bool value = false; }; template<> struct is_s8 { static constexpr bool value = true; }; template struct is_u16 { static constexpr bool value = false; }; template<> struct is_u16 { static constexpr bool value = true; }; template struct is_s16 { static constexpr bool value = false; }; template<> struct is_s16 { static constexpr bool value = true; }; template struct is_u32 { static constexpr bool value = false; }; template<> struct is_u32 { static constexpr bool value = true; }; template struct is_s32 { static constexpr bool value = false; }; template<> struct is_s32 { static constexpr bool value = true; }; template struct is_u64 { static constexpr bool value = false; }; template<> struct is_u64 { static constexpr bool value = true; }; template struct is_s64 { static constexpr bool value = false; }; template<> struct is_s64 { static constexpr bool value = true; }; template struct is_ulng_t { static constexpr bool value = false; }; template<> struct is_ulng_t { static constexpr bool value = true; }; template struct is_slng_t { static constexpr bool value = false; }; template<> struct is_slng_t { static constexpr bool value = true; }; template struct is_ulng_t_32 { static constexpr bool value = false; }; template<> struct is_ulng_t_32 { static constexpr bool value = (sizeof(ulng_t) == 4); }; template struct is_slng_t_32 { static constexpr bool value = false; }; template<> struct is_slng_t_32 { static constexpr bool value = (sizeof(slng_t) == 4); }; template struct is_ulng_t_64 { static constexpr bool value = false; }; template<> struct is_ulng_t_64 { static constexpr bool value = (sizeof(ulng_t) == 8); }; template struct is_slng_t_64 { static constexpr bool value = false; }; template<> struct is_slng_t_64 { static constexpr bool value = (sizeof(slng_t) == 8); }; template struct is_uword { static constexpr bool value = false; }; template<> struct is_uword { static constexpr bool value = true; }; template struct is_sword { static constexpr bool value = false; }; template<> struct is_sword { static constexpr bool value = true; }; template struct is_float { static constexpr bool value = false; }; template<> struct is_float { static constexpr bool value = true; }; template struct is_double { static constexpr bool value = false; }; template<> struct is_double { static constexpr bool value = true; }; template struct is_real { static constexpr bool value = false; static constexpr bool yes = false; static constexpr bool no = true; }; template<> struct is_real { static constexpr bool value = true; static constexpr bool yes = true; static constexpr bool no = false; }; template<> struct is_real { static constexpr bool value = true; static constexpr bool yes = true; static constexpr bool no = false; }; template struct is_cx { static constexpr bool value = false; static constexpr bool yes = false; static constexpr bool no = true; }; // template<> template struct is_cx< std::complex > { static constexpr bool value = true; static constexpr bool yes = true; static constexpr bool no = false; }; template struct is_cx_float { static constexpr bool value = false; static constexpr bool yes = false; static constexpr bool no = true; }; template<> struct is_cx_float< std::complex > { static constexpr bool value = true; static constexpr bool yes = true; static constexpr bool no = false; }; template struct is_cx_double { static constexpr bool value = false; static constexpr bool yes = false; static constexpr bool no = true; }; template<> struct is_cx_double< std::complex > { static constexpr bool value = true; static constexpr bool yes = true; static constexpr bool no = false; }; template struct is_supported_elem_type { static constexpr bool value = \ is_u8::value || is_s8::value || is_u16::value || is_s16::value || is_u32::value || is_s32::value || is_u64::value || is_s64::value || is_ulng_t::value || is_slng_t::value || is_float::value || is_double::value || is_cx_float::value || is_cx_double::value; }; template struct is_supported_blas_type { static constexpr bool value = \ is_float::value || is_double::value || is_cx_float::value || is_cx_double::value; }; template struct has_blas_float_bug { #if defined(ARMA_BLAS_FLOAT_BUG) static constexpr bool value = is_float::result>::value; #else static constexpr bool value = false; #endif }; template struct is_signed { static constexpr bool value = true; }; template<> struct is_signed { static constexpr bool value = false; }; template<> struct is_signed { static constexpr bool value = false; }; template<> struct is_signed { static constexpr bool value = false; }; template<> struct is_signed { static constexpr bool value = false; }; template<> struct is_signed { static constexpr bool value = false; }; template struct is_non_integral { static constexpr bool value = false; }; template<> struct is_non_integral< float > { static constexpr bool value = true; }; template<> struct is_non_integral< double > { static constexpr bool value = true; }; template<> struct is_non_integral< std::complex > { static constexpr bool value = true; }; template<> struct is_non_integral< std::complex > { static constexpr bool value = true; }; // class arma_junk_class; template struct force_different_type { typedef T1 T1_result; typedef T2 T2_result; }; template struct force_different_type { typedef T1 T1_result; typedef arma_junk_class T2_result; }; // template struct resolves_to_vector_default { static constexpr bool value = false; static constexpr bool yes = false; static constexpr bool no = true; }; template struct resolves_to_vector_test { static constexpr bool value = (T1::is_col || T1::is_row || T1::is_xvec); static constexpr bool yes = (T1::is_col || T1::is_row || T1::is_xvec); static constexpr bool no = ((T1::is_col || T1::is_row || T1::is_xvec) == false); }; template struct resolves_to_vector_redirect {}; template struct resolves_to_vector_redirect { typedef resolves_to_vector_default result; }; template struct resolves_to_vector_redirect { typedef resolves_to_vector_test result; }; template struct resolves_to_vector : public resolves_to_vector_redirect::value>::result {}; template struct resolves_to_sparse_vector : public resolves_to_vector_redirect::value>::result {}; // template struct resolves_to_rowvector_default { static constexpr bool value = false; }; template struct resolves_to_rowvector_test { static constexpr bool value = T1::is_row; }; template struct resolves_to_rowvector_redirect {}; template struct resolves_to_rowvector_redirect { typedef resolves_to_rowvector_default result; }; template struct resolves_to_rowvector_redirect { typedef resolves_to_rowvector_test result; }; template struct resolves_to_rowvector : public resolves_to_rowvector_redirect::value>::result {}; // template struct resolves_to_colvector_default { static constexpr bool value = false; }; template struct resolves_to_colvector_test { static constexpr bool value = T1::is_col; }; template struct resolves_to_colvector_redirect {}; template struct resolves_to_colvector_redirect { typedef resolves_to_colvector_default result; }; template struct resolves_to_colvector_redirect { typedef resolves_to_colvector_test result; }; template struct resolves_to_colvector : public resolves_to_colvector_redirect::value>::result {}; template struct is_outer_product { static constexpr bool value = false; }; template struct is_outer_product< Glue > { static constexpr bool value = (resolves_to_colvector::value && resolves_to_rowvector::value); }; template struct has_op_inv_any { static constexpr bool value = false; }; template struct has_op_inv_any< Op > { static constexpr bool value = true; }; template struct has_op_inv_any< Op > { static constexpr bool value = true; }; template struct has_op_inv_any< Op > { static constexpr bool value = true; }; template struct has_op_inv_any< Op > { static constexpr bool value = true; }; template struct has_op_inv_any< Glue, T2, glue_times> > { static constexpr bool value = true; }; template struct has_op_inv_any< Glue, T2, glue_times> > { static constexpr bool value = true; }; template struct has_op_inv_any< Glue, T2, glue_times> > { static constexpr bool value = true; }; template struct has_op_inv_any< Glue, T2, glue_times> > { static constexpr bool value = true; }; template struct has_op_inv_any< Glue, glue_times> > { static constexpr bool value = true; }; template struct has_op_inv_any< Glue, glue_times> > { static constexpr bool value = true; }; template struct has_op_inv_any< Glue, glue_times> > { static constexpr bool value = true; }; template struct has_op_inv_any< Glue, glue_times> > { static constexpr bool value = true; }; template struct has_nested_op_traits { using yes = char[1]; using no = char[2]; template static yes& check(typename X::template traits*); template static no& check(...); static constexpr bool value = ( sizeof(check(0)) == sizeof(yes) ); }; template struct has_nested_glue_traits { using yes = char[1]; using no = char[2]; template static yes& check(typename X::template traits*); template static no& check(...); static constexpr bool value = ( sizeof(check(0)) == sizeof(yes) ); }; template struct is_sym_expr { static constexpr bool eval(const T1&) { return false; } }; template struct is_sym_expr< Glue< Mat, Op, op_htrans>, glue_times > > { static arma_inline bool eval(const Glue< Mat, Op, op_htrans>, glue_times >& expr) { const Mat& X = expr.A; const Mat& Y = expr.B.m; return (&X == &Y); } }; template struct is_sym_expr< Glue< Op, op_htrans>, Mat, glue_times > > { static arma_inline bool eval(const Glue< Op, op_htrans>, Mat, glue_times >& expr) { const Mat& X = expr.A.m; const Mat& Y = expr.B; return (&X == &Y); } }; template struct is_sym_expr< Op > { static arma_inline bool eval(const Op&) { return true; } }; template struct is_sym_expr< Op > { static arma_inline bool eval(const Op&) { return true; } }; //! @} RcppArmadillo/inst/include/armadillo_bits/spop_trimat_bones.hpp0000644000176200001440000000352114301267044024632 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup spop_trimat //! @{ class spop_trimat : public traits_op_default { public: template inline static void apply_noalias(SpMat& out, const SpProxy& P, const bool upper); template inline static void apply(SpMat& out, const SpOp& in); }; class spop_trimatu_ext : public traits_op_default { public: template inline static void apply_noalias(SpMat& out, const SpMat& A, const uword row_offset, const uword col_offset); template inline static void apply(SpMat& out, const SpOp& in); }; class spop_trimatl_ext : public traits_op_default { public: template inline static void apply_noalias(SpMat& out, const SpMat& A, const uword row_offset, const uword col_offset); template inline static void apply(SpMat& out, const SpOp& in); }; //! @} RcppArmadillo/inst/include/armadillo_bits/fn_logmat.hpp0000644000176200001440000000663414635324415023067 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_logmat //! @{ template arma_warn_unused arma_inline typename enable_if2< (is_supported_blas_type::value && is_cx::no), const mtOp, T1, op_logmat> >::result logmat(const Base& X, const uword n_iters = 100u) { arma_debug_sigprint(); return mtOp, T1, op_logmat>(X.get_ref(), n_iters, uword(0)); } template arma_warn_unused arma_inline typename enable_if2< (is_supported_blas_type::value && is_cx::yes), const Op >::result logmat(const Base& X, const uword n_iters = 100u) { arma_debug_sigprint(); return Op(X.get_ref(), n_iters, uword(0)); } template inline typename enable_if2< (is_supported_blas_type::value && is_cx::no), bool >::result logmat(Mat< std::complex >& Y, const Base& X, const uword n_iters = 100u) { arma_debug_sigprint(); const bool status = op_logmat::apply_direct(Y, X.get_ref(), n_iters); if(status == false) { Y.soft_reset(); arma_warn(3, "logmat(): transformation failed"); } return status; } template inline typename enable_if2< (is_supported_blas_type::value && is_cx::yes), bool >::result logmat(Mat& Y, const Base& X, const uword n_iters = 100u) { arma_debug_sigprint(); const bool status = op_logmat_cx::apply_direct(Y, X.get_ref(), n_iters); if(status == false) { Y.soft_reset(); arma_warn(3, "logmat(): transformation failed"); } return status; } // template arma_warn_unused arma_inline typename enable_if2< is_supported_blas_type::value, const Op >::result logmat_sympd(const Base& X) { arma_debug_sigprint(); return Op(X.get_ref()); } template inline typename enable_if2< is_supported_blas_type::value, bool >::result logmat_sympd(Mat& Y, const Base& X) { arma_debug_sigprint(); const bool status = op_logmat_sympd::apply_direct(Y, X.get_ref()); if(status == false) { Y.soft_reset(); arma_warn(3, "logmat_sympd(): transformation failed"); } return status; } //! @} RcppArmadillo/inst/include/armadillo_bits/op_var_bones.hpp0000644000176200001440000000350415030507611023555 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_var //! @{ class op_var : public traits_op_xvec { public: template inline static void apply(Mat& out, const mtOp& in); template inline static void apply_noalias(Mat::result>& out, const Mat& X, const uword norm_type, const uword dim); // template inline static typename T1::pod_type var_vec(const T1& X, const uword norm_type = 0); // template inline static eT direct_var(const eT* X, const uword N, const uword norm_type = 0); template inline static eT direct_var_robust(const eT* X, const uword N, const uword norm_type = 0); // template inline static T direct_var(const std::complex* const X, const uword N, const uword norm_type = 0); template inline static T direct_var_robust(const std::complex* const X, const uword N, const uword norm_type = 0); }; //! @} RcppArmadillo/inst/include/armadillo_bits/fn_chol.hpp0000644000176200001440000000770114635324415022525 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_chol //! @{ template arma_warn_unused inline typename enable_if2< is_supported_blas_type::value, const Op >::result chol ( const Base& X, const char* layout = "upper" ) { arma_debug_sigprint(); const char sig = (layout != nullptr) ? layout[0] : char(0); arma_conform_check( ((sig != 'u') && (sig != 'l')), "chol(): layout must be \"upper\" or \"lower\"" ); return Op(X.get_ref(), ((sig == 'u') ? 0 : 1), 0 ); } template inline typename enable_if2< is_supported_blas_type::value, bool >::result chol ( Mat& out, const Base& X, const char* layout = "upper" ) { arma_debug_sigprint(); const char sig = (layout != nullptr) ? layout[0] : char(0); arma_conform_check( ((sig != 'u') && (sig != 'l')), "chol(): layout must be \"upper\" or \"lower\"" ); const bool status = op_chol::apply_direct(out, X.get_ref(), ((sig == 'u') ? 0 : 1)); if(status == false) { out.soft_reset(); arma_warn(3, "chol(): decomposition failed"); } return status; } template inline typename enable_if2< is_supported_blas_type::value, bool >::result chol ( Mat& out, Mat& P, const Base& X, const char* layout = "upper", const char* P_mode = "matrix" ) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const char sig_layout = (layout != nullptr) ? layout[0] : char(0); const char sig_P_mode = (P_mode != nullptr) ? P_mode[0] : char(0); arma_conform_check( ((sig_layout != 'u') && (sig_layout != 'l')), "chol(): argument 'layout' must be \"upper\" or \"lower\"" ); arma_conform_check( ((sig_P_mode != 'm') && (sig_P_mode != 'v')), "chol(): argument 'P_mode' must be \"vector\" or \"matrix\"" ); out = X.get_ref(); arma_conform_check( (out.is_square() == false), "chol(): given matrix must be square sized", [&](){ out.soft_reset(); } ); if(out.is_empty()) { P.reset(); return true; } if((arma_config::check_conform) && (auxlib::rudimentary_sym_check(out) == false)) { if(is_cx::no ) { arma_warn(1, "chol(): given matrix is not symmetric"); } if(is_cx::yes) { arma_warn(1, "chol(): given matrix is not hermitian"); } } bool status = false; if(sig_P_mode == 'v') { status = auxlib::chol_pivot(out, P, ((sig_layout == 'u') ? 0 : 1)); } else if(sig_P_mode == 'm') { Mat P_vec; status = auxlib::chol_pivot(out, P_vec, ((sig_layout == 'u') ? 0 : 1)); if(status) { // construct P const uword N = P_vec.n_rows; P.zeros(N,N); for(uword i=0; i < N; ++i) { P.at(P_vec[i], i) = uword(1); } } } if(status == false) { out.soft_reset(); P.soft_reset(); arma_warn(3, "chol(): decomposition failed"); } return status; } //! @} RcppArmadillo/inst/include/armadillo_bits/glue_times_meat.hpp0000644000176200001440000010721715002153114024244 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup glue_times //! @{ template template inline void glue_times_redirect2_helper::apply(Mat& out, const Glue& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const partial_unwrap U1(X.A); const partial_unwrap U2(X.B); const typename partial_unwrap::stored_type& A = U1.M; const typename partial_unwrap::stored_type& B = U2.M; constexpr bool use_alpha = partial_unwrap::do_times || partial_unwrap::do_times; const eT alpha = use_alpha ? (U1.get_val() * U2.get_val()) : eT(0); if( (is_cx::no) && (resolves_to_rowvector::value && resolves_to_colvector::value) ) { arma_debug_print("glue_times: dot product optimisation"); arma_conform_assert_mul_size(A, B, U1.do_trans, U2.do_trans, "matrix multiplication"); const eT val = op_dot::direct_dot(A.n_elem, A.memptr(), B.memptr()); out.set_size(1,1); out[0] = (use_alpha) ? (val * alpha) : (val); return; } const bool alias = U1.is_alias(out) || U2.is_alias(out); if(alias == false) { glue_times::apply < eT, partial_unwrap::do_trans, partial_unwrap::do_trans, use_alpha > (out, A, B, alpha); } else { Mat tmp; glue_times::apply < eT, partial_unwrap::do_trans, partial_unwrap::do_trans, use_alpha > (tmp, A, B, alpha); out.steal_mem(tmp); } } template inline void glue_times_redirect2_helper::apply(Mat& out, const Glue& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; if(arma_config::optimise_invexpr && (strip_inv::do_inv_gen || strip_inv::do_inv_spd)) { // replace inv(A)*B with solve(A,B) arma_debug_print("glue_times_redirect<2>::apply(): detected inv(A)*B"); const strip_inv A_strip(X.A); typedef typename strip_inv::stored_type T1_stripped; if( (is_cx::no) && (strip_inv::do_inv_gen) && (is_Mat::value) && (is_Mat::value) ) { const unwrap UA(A_strip.M); const unwrap UB(X.B); const typename unwrap::stored_type& A = UA.M; const typename unwrap::stored_type& B = UB.M; const uword N = A.n_rows; if( (N > 0) && (N <= uword(3)) && (N == A.n_cols) && (N == B.n_rows) && (void_ptr(&out) != void_ptr(&B)) ) { arma_debug_print("glue_times_redirect<2>::apply(): inv tiny matrix optimisation"); Mat AA(N, N, arma_nozeros_indicator()); arrayops::copy(AA.memptr(), A.memptr(), AA.n_elem); bool inv_status = false; if(N == 1) { const eT a = AA[0]; AA[0] = eT(1) / a; inv_status = (a != eT(0)); } if(N == 2) { inv_status = op_inv_gen_full::apply_tiny_2x2(AA); } if(N == 3) { inv_status = op_inv_gen_full::apply_tiny_3x3(AA); } if(inv_status) { glue_times::apply(out, AA, B, eT(0)); return; } arma_debug_print("glue_times_redirect<2>::apply(): inv tiny matrix optimisation failed"); // fallthrough if optimisation failed } } Mat A = A_strip.M; arma_conform_check( (A.is_square() == false), "inv(): given matrix must be square sized" ); if( (strip_inv::do_inv_spd) && (arma_config::check_conform) && (auxlib::rudimentary_sym_check(A) == false) ) { if(is_cx::no ) { arma_warn(1, "inv_sympd(): given matrix is not symmetric"); } if(is_cx::yes) { arma_warn(1, "inv_sympd(): given matrix is not hermitian"); } } const unwrap_check B_tmp(X.B, out); const Mat& B = B_tmp.M; arma_conform_assert_mul_size(A, B, "matrix multiplication"); const bool is_sym = (strip_inv::do_inv_spd) ? false : ( arma_config::optimise_sym && (auxlib::crippled_lapack(A) == false) && (is_sym_expr::eval(X.A) || sym_helper::is_approx_sym(A, uword(100))) ); const bool status = (strip_inv::do_inv_spd) ? auxlib::solve_sympd_fast(out, A, B) : ( (is_sym) ? auxlib::solve_sym_fast(out, A, B) : auxlib::solve_square_fast(out, A, B) ); if(status == false) { out.soft_reset(); arma_stop_runtime_error("matrix multiplication: problem with matrix inverse; suggest to use solve() instead"); } return; } if(arma_config::optimise_invexpr && strip_inv::do_inv_spd) { // replace A*inv_sympd(B) with trans( solve(trans(B),trans(A)) ) // transpose of B is avoided as B is explicitly marked as symmetric arma_debug_print("glue_times_redirect<2>::apply(): detected A*inv_sympd(B)"); const Mat At = trans(X.A); const strip_inv B_strip(X.B); Mat B = B_strip.M; arma_conform_check( (B.is_square() == false), "inv_sympd(): given matrix must be square sized" ); if( (arma_config::check_conform) && (auxlib::rudimentary_sym_check(B) == false) ) { if(is_cx::no ) { arma_warn(1, "inv_sympd(): given matrix is not symmetric"); } if(is_cx::yes) { arma_warn(1, "inv_sympd(): given matrix is not hermitian"); } } arma_conform_assert_mul_size(At.n_cols, At.n_rows, B.n_rows, B.n_cols, "matrix multiplication"); const bool status = auxlib::solve_sympd_fast(out, B, At); if(status == false) { out.soft_reset(); arma_stop_runtime_error("matrix multiplication: problem with matrix inverse; suggest to use solve() instead"); } out = trans(out); return; } glue_times_redirect2_helper::apply(out, X); } template template inline void glue_times_redirect3_helper::apply(Mat& out, const Glue< Glue, T3, glue_times>& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; // we have exactly 3 objects // hence we can safely expand X as X.A.A, X.A.B and X.B const partial_unwrap U1(X.A.A); const partial_unwrap U2(X.A.B); const partial_unwrap U3(X.B ); const typename partial_unwrap::stored_type& A = U1.M; const typename partial_unwrap::stored_type& B = U2.M; const typename partial_unwrap::stored_type& C = U3.M; constexpr bool use_alpha = partial_unwrap::do_times || partial_unwrap::do_times || partial_unwrap::do_times; const eT alpha = use_alpha ? (U1.get_val() * U2.get_val() * U3.get_val()) : eT(0); const bool alias = U1.is_alias(out) || U2.is_alias(out) || U3.is_alias(out); if(alias == false) { glue_times::apply < eT, partial_unwrap::do_trans, partial_unwrap::do_trans, partial_unwrap::do_trans, use_alpha > (out, A, B, C, alpha); } else { Mat tmp; glue_times::apply < eT, partial_unwrap::do_trans, partial_unwrap::do_trans, partial_unwrap::do_trans, use_alpha > (tmp, A, B, C, alpha); out.steal_mem(tmp); } } template inline void glue_times_redirect3_helper::apply(Mat& out, const Glue< Glue, T3, glue_times>& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; if(arma_config::optimise_invexpr && (strip_inv::do_inv_gen || strip_inv::do_inv_spd)) { // replace inv(A)*B*C with solve(A,B*C); arma_debug_print("glue_times_redirect<3>::apply(): detected inv(A)*B*C"); const strip_inv A_strip(X.A.A); Mat A = A_strip.M; arma_conform_check( (A.is_square() == false), "inv(): given matrix must be square sized" ); const partial_unwrap U2(X.A.B); const partial_unwrap U3(X.B ); const typename partial_unwrap::stored_type& B = U2.M; const typename partial_unwrap::stored_type& C = U3.M; constexpr bool use_alpha = partial_unwrap::do_times || partial_unwrap::do_times; const eT alpha = use_alpha ? (U2.get_val() * U3.get_val()) : eT(0); Mat BC; glue_times::apply < eT, partial_unwrap::do_trans, partial_unwrap::do_trans, use_alpha > (BC, B, C, alpha); arma_conform_assert_mul_size(A, BC, "matrix multiplication"); if( (strip_inv::do_inv_spd) && (arma_config::check_conform) && (auxlib::rudimentary_sym_check(A) == false) ) { if(is_cx::no ) { arma_warn(1, "inv_sympd(): given matrix is not symmetric"); } if(is_cx::yes) { arma_warn(1, "inv_sympd(): given matrix is not hermitian"); } } const bool is_sym = (strip_inv::do_inv_spd) ? false : ( arma_config::optimise_sym && (auxlib::crippled_lapack(A) == false) && (is_sym_expr::eval(X.A.A) || sym_helper::is_approx_sym(A, uword(100))) ); const bool status = (strip_inv::do_inv_spd) ? auxlib::solve_sympd_fast(out, A, BC) : ( (is_sym) ? auxlib::solve_sym_fast(out, A, BC) : auxlib::solve_square_fast(out, A, BC) ); if(status == false) { out.soft_reset(); arma_stop_runtime_error("matrix multiplication: problem with matrix inverse; suggest to use solve() instead"); } return; } if(arma_config::optimise_invexpr && (strip_inv::do_inv_gen || strip_inv::do_inv_spd)) { // replace A*inv(B)*C with A*solve(B,C) arma_debug_print("glue_times_redirect<3>::apply(): detected A*inv(B)*C"); const strip_inv B_strip(X.A.B); Mat B = B_strip.M; arma_conform_check( (B.is_square() == false), "inv(): given matrix must be square sized" ); const quasi_unwrap U3(X.B); const Mat& C = U3.M; arma_conform_assert_mul_size(B, C, "matrix multiplication"); if( (strip_inv::do_inv_spd) && (arma_config::check_conform) && (auxlib::rudimentary_sym_check(B) == false) ) { if(is_cx::no ) { arma_warn(1, "inv_sympd(): given matrix is not symmetric"); } if(is_cx::yes) { arma_warn(1, "inv_sympd(): given matrix is not hermitian"); } } Mat solve_result; const bool is_sym = (strip_inv::do_inv_spd) ? false : ( arma_config::optimise_sym && (auxlib::crippled_lapack(B) == false) && (is_sym_expr::eval(X.A.B) || sym_helper::is_approx_sym(B, uword(100))) ); const bool status = (strip_inv::do_inv_spd) ? auxlib::solve_sympd_fast(solve_result, B, C) : ( (is_sym) ? auxlib::solve_sym_fast(solve_result, B, C) : auxlib::solve_square_fast(solve_result, B, C) ); if(status == false) { out.soft_reset(); arma_stop_runtime_error("matrix multiplication: problem with matrix inverse; suggest to use solve() instead"); return; } const partial_unwrap U1(X.A.A); const typename partial_unwrap::stored_type& A = U1.M; constexpr bool use_alpha = partial_unwrap::do_times; const eT alpha = use_alpha ? U1.get_val() : eT(0); if(U1.is_alias(out)) { Mat tmp; glue_times::apply::do_trans, false, use_alpha>(tmp, A, solve_result, alpha); out.steal_mem(tmp); } else { glue_times::apply::do_trans, false, use_alpha>(out, A, solve_result, alpha); } return; } glue_times_redirect3_helper::apply(out, X); } template template inline void glue_times_redirect::apply(Mat& out, const Glue& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const partial_unwrap U1(X.A); const partial_unwrap U2(X.B); const typename partial_unwrap::stored_type& A = U1.M; const typename partial_unwrap::stored_type& B = U2.M; constexpr bool use_alpha = partial_unwrap::do_times || partial_unwrap::do_times; const eT alpha = use_alpha ? (U1.get_val() * U2.get_val()) : eT(0); const bool alias = U1.is_alias(out) || U2.is_alias(out); if(alias == false) { glue_times::apply < eT, partial_unwrap::do_trans, partial_unwrap::do_trans, use_alpha > (out, A, B, alpha); } else { Mat tmp; glue_times::apply < eT, partial_unwrap::do_trans, partial_unwrap::do_trans, use_alpha > (tmp, A, B, alpha); out.steal_mem(tmp); } } template inline void glue_times_redirect<2>::apply(Mat& out, const Glue& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; glue_times_redirect2_helper< is_supported_blas_type::value >::apply(out, X); } template inline void glue_times_redirect<3>::apply(Mat& out, const Glue< Glue, T3, glue_times>& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; glue_times_redirect3_helper< is_supported_blas_type::value >::apply(out, X); } template inline void glue_times_redirect<4>::apply(Mat& out, const Glue< Glue< Glue, T3, glue_times>, T4, glue_times>& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; // there is exactly 4 objects // hence we can safely expand X as X.A.A.A, X.A.A.B, X.A.B and X.B const partial_unwrap U1(X.A.A.A); const partial_unwrap U2(X.A.A.B); const partial_unwrap U3(X.A.B ); const partial_unwrap U4(X.B ); const typename partial_unwrap::stored_type& A = U1.M; const typename partial_unwrap::stored_type& B = U2.M; const typename partial_unwrap::stored_type& C = U3.M; const typename partial_unwrap::stored_type& D = U4.M; constexpr bool use_alpha = partial_unwrap::do_times || partial_unwrap::do_times || partial_unwrap::do_times || partial_unwrap::do_times; const eT alpha = use_alpha ? (U1.get_val() * U2.get_val() * U3.get_val() * U4.get_val()) : eT(0); const bool alias = U1.is_alias(out) || U2.is_alias(out) || U3.is_alias(out) || U4.is_alias(out); if(alias == false) { glue_times::apply < eT, partial_unwrap::do_trans, partial_unwrap::do_trans, partial_unwrap::do_trans, partial_unwrap::do_trans, use_alpha > (out, A, B, C, D, alpha); } else { Mat tmp; glue_times::apply < eT, partial_unwrap::do_trans, partial_unwrap::do_trans, partial_unwrap::do_trans, partial_unwrap::do_trans, use_alpha > (tmp, A, B, C, D, alpha); out.steal_mem(tmp); } } template inline void glue_times::apply(Mat& out, const Glue& X) { arma_debug_sigprint(); constexpr uword N_mat = 1 + depth_lhs< glue_times, Glue >::num; arma_debug_print(arma_str::format("glue_times::apply(): N_mat: %u") % N_mat); glue_times_redirect::apply(out, X); } template inline void glue_times::apply_inplace(Mat& out, const T1& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; Mat tmp = out * X; out.steal_mem(tmp); } template inline void glue_times::apply_inplace_plus(Mat& out, const Glue& X, const sword sign) { arma_debug_sigprint(); typedef typename T1::elem_type eT; typedef typename get_pod_type::result T; if( X.is_alias(out) || (is_outer_product::value) || (has_op_inv_any::value) || (has_op_inv_any::value) ) { // handle aliasing and partial workaround for corner cases const Mat tmp(X); if(sign > sword(0)) { out += tmp; } else { out -= tmp; } return; } const partial_unwrap U1(X.A); const partial_unwrap U2(X.B); typedef typename partial_unwrap::stored_type TA; typedef typename partial_unwrap::stored_type TB; const TA& A = U1.M; const TB& B = U2.M; constexpr bool do_trans_A = partial_unwrap::do_trans; constexpr bool do_trans_B = partial_unwrap::do_trans; const bool use_alpha = partial_unwrap::do_times || partial_unwrap::do_times || (sign < sword(0)); const eT alpha = use_alpha ? ( U1.get_val() * U2.get_val() * ( (sign > sword(0)) ? eT(1) : eT(-1) ) ) : eT(0); arma_conform_assert_mul_size(A, B, do_trans_A, do_trans_B, "matrix multiplication"); const uword result_n_rows = (do_trans_A == false) ? (TA::is_row ? 1 : A.n_rows) : (TA::is_col ? 1 : A.n_cols); const uword result_n_cols = (do_trans_B == false) ? (TB::is_col ? 1 : B.n_cols) : (TB::is_row ? 1 : B.n_rows); arma_conform_assert_same_size(out.n_rows, out.n_cols, result_n_rows, result_n_cols, ( (sign > sword(0)) ? "addition" : "subtraction" ) ); if(out.n_elem == 0) { return; } if( (do_trans_A == false) && (do_trans_B == false) && (use_alpha == false) ) { if( ((A.n_rows == 1) || (TA::is_row)) && (is_cx::no) ) { gemv::apply(out.memptr(), B, A.memptr(), alpha, eT(1)); } else if( (B.n_cols == 1) || (TB::is_col) ) { gemv::apply(out.memptr(), A, B.memptr(), alpha, eT(1)); } else { gemm::apply(out, A, B, alpha, eT(1)); } } else if( (do_trans_A == false) && (do_trans_B == false) && (use_alpha == true) ) { if( ((A.n_rows == 1) || (TA::is_row)) && (is_cx::no) ) { gemv::apply(out.memptr(), B, A.memptr(), alpha, eT(1)); } else if( (B.n_cols == 1) || (TB::is_col) ) { gemv::apply(out.memptr(), A, B.memptr(), alpha, eT(1)); } else { gemm::apply(out, A, B, alpha, eT(1)); } } else if( (do_trans_A == true) && (do_trans_B == false) && (use_alpha == false) ) { if( ((A.n_cols == 1) || (TA::is_col)) && (is_cx::no) ) { gemv::apply(out.memptr(), B, A.memptr(), alpha, eT(1)); } else if( (B.n_cols == 1) || (TB::is_col) ) { gemv::apply(out.memptr(), A, B.memptr(), alpha, eT(1)); } else if( (void_ptr(&A) == void_ptr(&B)) && (is_cx::no) ) { syrk::apply(out, A, alpha, eT(1)); } else if( (void_ptr(&A) == void_ptr(&B)) && (is_cx::yes) ) { herk::apply(out, A, T(0), T(1)); } else { gemm::apply(out, A, B, alpha, eT(1)); } } else if( (do_trans_A == true) && (do_trans_B == false) && (use_alpha == true) ) { if( ((A.n_cols == 1) || (TA::is_col)) && (is_cx::no) ) { gemv::apply(out.memptr(), B, A.memptr(), alpha, eT(1)); } else if( (B.n_cols == 1) || (TB::is_col) ) { gemv::apply(out.memptr(), A, B.memptr(), alpha, eT(1)); } else if( (void_ptr(&A) == void_ptr(&B)) && (is_cx::no) ) { syrk::apply(out, A, alpha, eT(1)); } else { gemm::apply(out, A, B, alpha, eT(1)); } } else if( (do_trans_A == false) && (do_trans_B == true) && (use_alpha == false) ) { if( ((A.n_rows == 1) || (TA::is_row)) && (is_cx::no) ) { gemv::apply(out.memptr(), B, A.memptr(), alpha, eT(1)); } else if( ((B.n_rows == 1) || (TB::is_row)) && (is_cx::no) ) { gemv::apply(out.memptr(), A, B.memptr(), alpha, eT(1)); } else if( (void_ptr(&A) == void_ptr(&B)) && (is_cx::no) ) { syrk::apply(out, A, alpha, eT(1)); } else if( (void_ptr(&A) == void_ptr(&B)) && (is_cx::yes) ) { herk::apply(out, A, T(0), T(1)); } else { gemm::apply(out, A, B, alpha, eT(1)); } } else if( (do_trans_A == false) && (do_trans_B == true) && (use_alpha == true) ) { if( ((A.n_rows == 1) || (TA::is_row)) && (is_cx::no) ) { gemv::apply(out.memptr(), B, A.memptr(), alpha, eT(1)); } else if( ((B.n_rows == 1) || (TB::is_row)) && (is_cx::no) ) { gemv::apply(out.memptr(), A, B.memptr(), alpha, eT(1)); } else if( (void_ptr(&A) == void_ptr(&B)) && (is_cx::no) ) { syrk::apply(out, A, alpha, eT(1)); } else { gemm::apply(out, A, B, alpha, eT(1)); } } else if( (do_trans_A == true) && (do_trans_B == true) && (use_alpha == false) ) { if( ((A.n_cols == 1) || (TA::is_col)) && (is_cx::no) ) { gemv::apply(out.memptr(), B, A.memptr(), alpha, eT(1)); } else if( ((B.n_rows == 1) || (TB::is_row)) && (is_cx::no) ) { gemv::apply(out.memptr(), A, B.memptr(), alpha, eT(1)); } else { gemm::apply(out, A, B, alpha, eT(1)); } } else if( (do_trans_A == true) && (do_trans_B == true) && (use_alpha == true) ) { if( ((A.n_cols == 1) || (TA::is_col)) && (is_cx::no) ) { gemv::apply(out.memptr(), B, A.memptr(), alpha, eT(1)); } else if( ((B.n_rows == 1) || (TB::is_row)) && (is_cx::no) ) { gemv::apply(out.memptr(), A, B.memptr(), alpha, eT(1)); } else { gemm::apply(out, A, B, alpha, eT(1)); } } } template arma_inline uword glue_times::mul_storage_cost(const TA& A, const TB& B) { const uword final_A_n_rows = (do_trans_A == false) ? ( TA::is_row ? 1 : A.n_rows ) : ( TA::is_col ? 1 : A.n_cols ); const uword final_B_n_cols = (do_trans_B == false) ? ( TB::is_col ? 1 : B.n_cols ) : ( TB::is_row ? 1 : B.n_rows ); return final_A_n_rows * final_B_n_cols; } template < typename eT, const bool do_trans_A, const bool do_trans_B, const bool use_alpha, typename TA, typename TB > inline void glue_times::apply ( Mat& out, const TA& A, const TB& B, const eT alpha ) { arma_debug_sigprint(); //arma_conform_assert_mul_size(A, B, do_trans_A, do_trans_B, "matrix multiplication"); arma_conform_assert_trans_mul_size(A.n_rows, A.n_cols, B.n_rows, B.n_cols, "matrix multiplication"); const uword final_n_rows = (do_trans_A == false) ? (TA::is_row ? 1 : A.n_rows) : (TA::is_col ? 1 : A.n_cols); const uword final_n_cols = (do_trans_B == false) ? (TB::is_col ? 1 : B.n_cols) : (TB::is_row ? 1 : B.n_rows); out.set_size(final_n_rows, final_n_cols); if( (A.n_elem == 0) || (B.n_elem == 0) ) { out.zeros(); return; } if( (do_trans_A == false) && (do_trans_B == false) && (use_alpha == false) ) { if( ((A.n_rows == 1) || (TA::is_row)) && (is_cx::no) ) { gemv::apply(out.memptr(), B, A.memptr()); } else if( (B.n_cols == 1) || (TB::is_col) ) { gemv::apply(out.memptr(), A, B.memptr()); } else { gemm::apply(out, A, B ); } } else if( (do_trans_A == false) && (do_trans_B == false) && (use_alpha == true) ) { if( ((A.n_rows == 1) || (TA::is_row)) && (is_cx::no) ) { gemv::apply(out.memptr(), B, A.memptr(), alpha); } else if( (B.n_cols == 1) || (TB::is_col) ) { gemv::apply(out.memptr(), A, B.memptr(), alpha); } else { gemm::apply(out, A, B, alpha); } } else if( (do_trans_A == true) && (do_trans_B == false) && (use_alpha == false) ) { if( ((A.n_cols == 1) || (TA::is_col)) && (is_cx::no) ) { gemv::apply(out.memptr(), B, A.memptr()); } else if( (B.n_cols == 1) || (TB::is_col) ) { gemv::apply(out.memptr(), A, B.memptr()); } else if( (void_ptr(&A) == void_ptr(&B)) && (is_cx::no) ) { syrk::apply(out, A ); } else if( (void_ptr(&A) == void_ptr(&B)) && (is_cx::yes) ) { herk::apply(out, A ); } else { gemm::apply(out, A, B ); } } else if( (do_trans_A == true) && (do_trans_B == false) && (use_alpha == true) ) { if( ((A.n_cols == 1) || (TA::is_col)) && (is_cx::no) ) { gemv::apply(out.memptr(), B, A.memptr(), alpha); } else if( (B.n_cols == 1) || (TB::is_col) ) { gemv::apply(out.memptr(), A, B.memptr(), alpha); } else if( (void_ptr(&A) == void_ptr(&B)) && (is_cx::no) ) { syrk::apply(out, A, alpha); } else { gemm::apply(out, A, B, alpha); } } else if( (do_trans_A == false) && (do_trans_B == true) && (use_alpha == false) ) { if( ((A.n_rows == 1) || (TA::is_row)) && (is_cx::no) ) { gemv::apply(out.memptr(), B, A.memptr()); } else if( ((B.n_rows == 1) || (TB::is_row)) && (is_cx::no) ) { gemv::apply(out.memptr(), A, B.memptr()); } else if( (void_ptr(&A) == void_ptr(&B)) && (is_cx::no) ) { syrk::apply(out, A ); } else if( (void_ptr(&A) == void_ptr(&B)) && (is_cx::yes) ) { herk::apply(out, A ); } else { gemm::apply(out, A, B ); } } else if( (do_trans_A == false) && (do_trans_B == true) && (use_alpha == true) ) { if( ((A.n_rows == 1) || (TA::is_row)) && (is_cx::no) ) { gemv::apply(out.memptr(), B, A.memptr(), alpha); } else if( ((B.n_rows == 1) || (TB::is_row)) && (is_cx::no) ) { gemv::apply(out.memptr(), A, B.memptr(), alpha); } else if( (void_ptr(&A) == void_ptr(&B)) && (is_cx::no) ) { syrk::apply(out, A, alpha); } else { gemm::apply(out, A, B, alpha); } } else if( (do_trans_A == true) && (do_trans_B == true) && (use_alpha == false) ) { if( ((A.n_cols == 1) || (TA::is_col)) && (is_cx::no) ) { gemv::apply(out.memptr(), B, A.memptr()); } else if( ((B.n_rows == 1) || (TB::is_row)) && (is_cx::no) ) { gemv::apply(out.memptr(), A, B.memptr()); } else { gemm::apply(out, A, B ); } } else if( (do_trans_A == true) && (do_trans_B == true) && (use_alpha == true) ) { if( ((A.n_cols == 1) || (TA::is_col)) && (is_cx::no) ) { gemv::apply(out.memptr(), B, A.memptr(), alpha); } else if( ((B.n_rows == 1) || (TB::is_row)) && (is_cx::no) ) { gemv::apply(out.memptr(), A, B.memptr(), alpha); } else { gemm::apply(out, A, B, alpha); } } } template < typename eT, const bool do_trans_A, const bool do_trans_B, const bool do_trans_C, const bool use_alpha, typename TA, typename TB, typename TC > inline void glue_times::apply ( Mat& out, const TA& A, const TB& B, const TC& C, const eT alpha ) { arma_debug_sigprint(); Mat tmp; const uword storage_cost_AB = glue_times::mul_storage_cost(A, B); const uword storage_cost_BC = glue_times::mul_storage_cost(B, C); if(storage_cost_AB <= storage_cost_BC) { // out = (A*B)*C glue_times::apply(tmp, A, B, alpha); glue_times::apply(out, tmp, C, eT(0)); } else { // out = A*(B*C) glue_times::apply(tmp, B, C, alpha); glue_times::apply(out, A, tmp, eT(0)); } } template < typename eT, const bool do_trans_A, const bool do_trans_B, const bool do_trans_C, const bool do_trans_D, const bool use_alpha, typename TA, typename TB, typename TC, typename TD > inline void glue_times::apply ( Mat& out, const TA& A, const TB& B, const TC& C, const TD& D, const eT alpha ) { arma_debug_sigprint(); Mat tmp; const uword storage_cost_AC = glue_times::mul_storage_cost(A, C); const uword storage_cost_BD = glue_times::mul_storage_cost(B, D); if(storage_cost_AC <= storage_cost_BD) { // out = (A*B*C)*D glue_times::apply(tmp, A, B, C, alpha); glue_times::apply(out, tmp, D, eT(0)); } else { // out = A*(B*C*D) glue_times::apply(tmp, B, C, D, alpha); glue_times::apply(out, A, tmp, eT(0)); } } // // glue_times_diag template inline void glue_times_diag::apply(Mat& actual_out, const Glue& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const strip_diagmat S1(X.A); const strip_diagmat S2(X.B); typedef typename strip_diagmat::stored_type T1_stripped; typedef typename strip_diagmat::stored_type T2_stripped; if( (strip_diagmat::do_diagmat == true) && (strip_diagmat::do_diagmat == false) ) { arma_debug_print("glue_times_diag::apply(): diagmat(A) * B"); const diagmat_proxy A(S1.M); const quasi_unwrap UB(X.B); const Mat& B = UB.M; const uword A_n_rows = A.n_rows; const uword A_n_cols = A.n_cols; const uword A_length = (std::min)(A_n_rows, A_n_cols); const uword B_n_rows = B.n_rows; const uword B_n_cols = B.n_cols; arma_conform_assert_mul_size(A_n_rows, A_n_cols, B_n_rows, B_n_cols, "matrix multiplication"); const bool is_alias = (A.is_alias(actual_out) || UB.is_alias(actual_out)); if(is_alias) { arma_debug_print("glue_times_diag::apply(): aliasing detected"); } Mat tmp; Mat& out = (is_alias) ? tmp : actual_out; out.zeros(A_n_rows, B_n_cols); for(uword col=0; col < B_n_cols; ++col) { eT* out_coldata = out.colptr(col); const eT* B_coldata = B.colptr(col); for(uword i=0; i < A_length; ++i) { out_coldata[i] = A[i] * B_coldata[i]; } } if(is_alias) { actual_out.steal_mem(tmp); } } else if( (strip_diagmat::do_diagmat == false) && (strip_diagmat::do_diagmat == true) ) { arma_debug_print("glue_times_diag::apply(): A * diagmat(B)"); const quasi_unwrap UA(X.A); const Mat& A = UA.M; const diagmat_proxy B(S2.M); const uword A_n_rows = A.n_rows; const uword A_n_cols = A.n_cols; const uword B_n_rows = B.n_rows; const uword B_n_cols = B.n_cols; const uword B_length = (std::min)(B_n_rows, B_n_cols); arma_conform_assert_mul_size(A_n_rows, A_n_cols, B_n_rows, B_n_cols, "matrix multiplication"); const bool is_alias = (UA.is_alias(actual_out) || B.is_alias(actual_out)); if(is_alias) { arma_debug_print("glue_times_diag::apply(): aliasing detected"); } Mat tmp; Mat& out = (is_alias) ? tmp : actual_out; out.zeros(A_n_rows, B_n_cols); for(uword col=0; col < B_length; ++col) { const eT val = B[col]; eT* out_coldata = out.colptr(col); const eT* A_coldata = A.colptr(col); for(uword i=0; i < A_n_rows; ++i) { out_coldata[i] = A_coldata[i] * val; } } if(is_alias) { actual_out.steal_mem(tmp); } } else if( (strip_diagmat::do_diagmat == true) && (strip_diagmat::do_diagmat == true) ) { arma_debug_print("glue_times_diag::apply(): diagmat(A) * diagmat(B)"); const diagmat_proxy A(S1.M); const diagmat_proxy B(S2.M); arma_conform_assert_mul_size(A.n_rows, A.n_cols, B.n_rows, B.n_cols, "matrix multiplication"); const bool is_alias = (A.is_alias(actual_out) || B.is_alias(actual_out)); if(is_alias) { arma_debug_print("glue_times_diag::apply(): aliasing detected"); } Mat tmp; Mat& out = (is_alias) ? tmp : actual_out; out.zeros(A.n_rows, B.n_cols); const uword A_length = (std::min)(A.n_rows, A.n_cols); const uword B_length = (std::min)(B.n_rows, B.n_cols); const uword N = (std::min)(A_length, B_length); for(uword i=0; i < N; ++i) { out.at(i,i) = A[i] * B[i]; } if(is_alias) { actual_out.steal_mem(tmp); } } } //! @} RcppArmadillo/inst/include/armadillo_bits/GlueCube_meat.hpp0000644000176200001440000000235014631567470023617 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup GlueCube //! @{ template inline GlueCube::GlueCube(const BaseCube& in_A, const BaseCube& in_B) : A(in_A.get_ref()) , B(in_B.get_ref()) { arma_debug_sigprint(); } template inline GlueCube::~GlueCube() { arma_debug_sigprint(); } //! @} RcppArmadillo/inst/include/armadillo_bits/op_inv_spd_meat.hpp0000644000176200001440000002327014713753317024266 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_inv_spd //! @{ template inline void op_inv_spd_default::apply(Mat& out, const Op& X) { arma_debug_sigprint(); const bool status = op_inv_spd_default::apply_direct(out, X.m); if(status == false) { out.soft_reset(); arma_stop_runtime_error("inv_sympd(): matrix is singular or not positive definite"); } } template inline bool op_inv_spd_default::apply_direct(Mat& out, const Base& expr) { arma_debug_sigprint(); return op_inv_spd_full::apply_direct(out, expr, uword(0)); } // template inline void op_inv_spd_full::apply(Mat& out, const Op& X) { arma_debug_sigprint(); const uword flags = X.aux_uword_a; const bool status = op_inv_spd_full::apply_direct(out, X.m, flags); if(status == false) { out.soft_reset(); arma_stop_runtime_error("inv_sympd(): matrix is singular or not positive definite"); } } template inline bool op_inv_spd_full::apply_direct(Mat& out, const Base& expr, const uword flags) { arma_debug_sigprint(); typedef typename T1::elem_type eT; typedef typename T1::pod_type T; if(has_user_flags == true ) { arma_debug_print("op_inv_spd_full: has_user_flags = true"); } if(has_user_flags == false) { arma_debug_print("op_inv_spd_full: has_user_flags = false"); } const bool fast = has_user_flags && bool(flags & inv_opts::flag_fast ); const bool allow_approx = has_user_flags && bool(flags & inv_opts::flag_allow_approx); const bool no_ugly = has_user_flags && bool(flags & inv_opts::flag_no_ugly ); if(has_user_flags) { arma_debug_print("op_inv_spd_full: enabled flags:"); if(fast ) { arma_debug_print("fast"); } if(allow_approx) { arma_debug_print("allow_approx"); } if(no_ugly ) { arma_debug_print("no_ugly"); } arma_conform_check( (fast && allow_approx), "inv_sympd(): options 'fast' and 'allow_approx' are mutually exclusive" ); arma_conform_check( (fast && no_ugly ), "inv_sympd(): options 'fast' and 'no_ugly' are mutually exclusive" ); arma_conform_check( (no_ugly && allow_approx), "inv_sympd(): options 'no_ugly' and 'allow_approx' are mutually exclusive" ); } if(no_ugly) { op_inv_spd_state inv_state; const bool status = op_inv_spd_rcond::apply_direct(out, inv_state, expr); // workaround for bug in gcc 4.8 const uword local_size = inv_state.size; const T local_rcond = inv_state.rcond; if((status == false) || (local_rcond < ((std::max)(local_size, uword(1)) * std::numeric_limits::epsilon())) || arma_isnan(local_rcond)) { return false; } return true; } if(allow_approx) { op_inv_spd_state inv_state; Mat tmp; const bool status = op_inv_spd_rcond::apply_direct(tmp, inv_state, expr); // workaround for bug in gcc 4.8 const uword local_size = inv_state.size; const T local_rcond = inv_state.rcond; if((status == false) || (local_rcond < ((std::max)(local_size, uword(1)) * std::numeric_limits::epsilon())) || arma_isnan(local_rcond)) { const Mat A = expr.get_ref(); if(inv_state.is_diag) { return op_pinv::apply_diag(out, A, T(0)); } return op_pinv::apply_sym(out, A, T(0), uword(0)); } out.steal_mem(tmp); return true; } out = expr.get_ref(); arma_conform_check( (out.is_square() == false), "inv_sympd(): given matrix must be square sized", [&](){ out.soft_reset(); } ); if((arma_config::check_conform) && (arma_config::warn_level > 0)) { if(auxlib::rudimentary_sym_check(out) == false) { if(is_cx::no ) { arma_warn(1, "inv_sympd(): given matrix is not symmetric"); } if(is_cx::yes) { arma_warn(1, "inv_sympd(): given matrix is not hermitian"); } } else if((is_cx::yes) && (sym_helper::check_diag_imag(out) == false)) { arma_warn(1, "inv_sympd(): imaginary components on diagonal are non-zero"); } } const uword N = out.n_rows; if(N == 0) { return true; } if(is_cx::no) { if(N == 1) { const T a = access::tmp_real(out[0]); out[0] = eT(T(1) / a); return (a > T(0)); } else if(N == 2) { const bool status = op_inv_spd_full::apply_tiny_2x2(out); if(status) { return true; } } // fallthrough if optimisation failed } if(is_op_diagmat::value || out.is_diagmat()) { arma_debug_print("op_inv_spd_full: diag optimisation"); eT* colmem = out.memptr(); for(uword i=0; i inline bool op_inv_spd_full::apply_tiny_2x2(Mat& X) { arma_debug_sigprint(); typedef typename get_pod_type::result T; // NOTE: assuming matrix X is square sized // NOTE: assuming matrix X is symmetric // NOTE: assuming matrix X is real constexpr T det_min = std::numeric_limits::epsilon(); constexpr T det_max = T(1) / std::numeric_limits::epsilon(); eT* Xm = X.memptr(); T a = access::tmp_real(Xm[0]); T c = access::tmp_real(Xm[1]); T d = access::tmp_real(Xm[3]); const T det_val = (a*d - c*c); // positive definite iff all leading principal minors are positive // a = first leading principal minor (top-left 1x1 submatrix) // det_val = second leading principal minor (top-left 2x2 submatrix) if(a <= T(0)) { return false; } // NOTE: since det_min is positive, this also checks whether det_val is positive if((det_val < det_min) || (det_val > det_max) || arma_isnan(det_val)) { return false; } d /= det_val; c /= det_val; a /= det_val; Xm[0] = d; Xm[1] = -c; Xm[2] = -c; Xm[3] = a; return true; } // template inline bool op_inv_spd_rcond::apply_direct(Mat& out, op_inv_spd_state& out_state, const Base& expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; typedef typename T1::pod_type T; out = expr.get_ref(); out_state.size = out.n_rows; out_state.rcond = T(0); arma_conform_check( (out.is_square() == false), "inv_sympd(): given matrix must be square sized", [&](){ out.soft_reset(); } ); if((arma_config::check_conform) && (arma_config::warn_level > 0)) { if(auxlib::rudimentary_sym_check(out) == false) { if(is_cx::no ) { arma_warn(1, "inv_sympd(): given matrix is not symmetric"); } if(is_cx::yes) { arma_warn(1, "inv_sympd(): given matrix is not hermitian"); } } else if((is_cx::yes) && (sym_helper::check_diag_imag(out) == false)) { arma_warn(1, "inv_sympd(): imaginary components on diagonal are non-zero"); } } if(is_op_diagmat::value || out.is_diagmat()) { arma_debug_print("op_inv_spd_rcond: diag optimisation"); out_state.is_diag = true; eT* colmem = out.memptr(); T max_abs_src_val = T(0); T max_abs_inv_val = T(0); const uword N = out.n_rows; for(uword i=0; i max_abs_src_val) ? abs_src_val : max_abs_src_val; max_abs_inv_val = (abs_inv_val > max_abs_inv_val) ? abs_inv_val : max_abs_inv_val; colmem += N; } out_state.rcond = T(1) / (max_abs_src_val * max_abs_inv_val); return true; } if(auxlib::crippled_lapack(out)) { arma_debug_print("op_inv_spd_rcond: workaround for crippled lapack"); Mat tmp = out; bool sympd_state = false; auxlib::inv_sympd(out, sympd_state); if(sympd_state == false) { out.soft_reset(); out_state.rcond = T(0); return false; } out_state.rcond = auxlib::rcond(tmp); if(out_state.rcond == T(0)) { out.soft_reset(); return false; } return true; } return auxlib::inv_sympd_rcond(out, out_state.rcond); } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_ones.hpp0000644000176200001440000000742214631567470022552 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_ones //! @{ arma_warn_unused arma_inline const Gen ones(const uword n_elem) { arma_debug_sigprint(); return Gen(n_elem, 1); } template arma_warn_unused arma_inline const Gen ones(const uword n_elem, const arma_empty_class junk1 = arma_empty_class(), const typename arma_Mat_Col_Row_only::result* junk2 = nullptr) { arma_debug_sigprint(); arma_ignore(junk1); arma_ignore(junk2); const uword n_rows = (is_Row::value) ? uword(1) : n_elem; const uword n_cols = (is_Row::value) ? n_elem : uword(1); return Gen(n_rows, n_cols); } arma_warn_unused arma_inline const Gen ones(const uword n_rows, const uword n_cols) { arma_debug_sigprint(); return Gen(n_rows, n_cols); } arma_warn_unused arma_inline const Gen ones(const SizeMat& s) { arma_debug_sigprint(); return Gen(s.n_rows, s.n_cols); } template arma_warn_unused inline const Gen ones(const uword n_rows, const uword n_cols, const typename arma_Mat_Col_Row_only::result* junk = nullptr) { arma_debug_sigprint(); arma_ignore(junk); if(is_Col::value) { arma_conform_check( (n_cols != 1), "ones(): incompatible size" ); } if(is_Row::value) { arma_conform_check( (n_rows != 1), "ones(): incompatible size" ); } return Gen(n_rows, n_cols); } template arma_warn_unused inline const Gen ones(const SizeMat& s, const typename arma_Mat_Col_Row_only::result* junk = nullptr) { arma_debug_sigprint(); arma_ignore(junk); return ones(s.n_rows, s.n_cols); } arma_warn_unused arma_inline const GenCube ones(const uword n_rows, const uword n_cols, const uword n_slices) { arma_debug_sigprint(); return GenCube(n_rows, n_cols, n_slices); } arma_warn_unused arma_inline const GenCube ones(const SizeCube& s) { arma_debug_sigprint(); return GenCube(s.n_rows, s.n_cols, s.n_slices); } template arma_warn_unused arma_inline const GenCube ones(const uword n_rows, const uword n_cols, const uword n_slices, const typename arma_Cube_only::result* junk = nullptr) { arma_debug_sigprint(); arma_ignore(junk); return GenCube(n_rows, n_cols, n_slices); } template arma_warn_unused arma_inline const GenCube ones(const SizeCube& s, const typename arma_Cube_only::result* junk = nullptr) { arma_debug_sigprint(); arma_ignore(junk); return GenCube(s.n_rows, s.n_cols, s.n_slices); } //! @} RcppArmadillo/inst/include/armadillo_bits/op_reverse_bones.hpp0000644000176200001440000000231014301267043024434 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_reverse //! @{ class op_reverse : public traits_op_default { public: template inline static void apply(Mat& out, const Op& in); }; class op_reverse_vec : public traits_op_passthru { public: template inline static void apply(Mat& out, const Op& in); }; //! @} RcppArmadillo/inst/include/armadillo_bits/fn_trig.hpp0000644000176200001440000002064714631567470022557 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_trig //! @{ // single argument trigonometric functions: // cos family: cos, acos, cosh, acosh // sin family: sin, asin, sinh, asinh // tan family: tan, atan, tanh, atanh // // misc functions: // sinc // // dual argument trigonometric functions: // atan2 // hypot // // cos template arma_warn_unused arma_inline typename enable_if2< is_arma_type::value, const eOp >::result cos(const T1& A) { arma_debug_sigprint(); return eOp(A); } template arma_warn_unused arma_inline const eOpCube cos(const BaseCube& A) { arma_debug_sigprint(); return eOpCube(A.get_ref()); } // // acos template arma_warn_unused arma_inline typename enable_if2< is_arma_type::value, const eOp >::result acos(const T1& A) { arma_debug_sigprint(); return eOp(A); } template arma_warn_unused arma_inline const eOpCube acos(const BaseCube& A) { arma_debug_sigprint(); return eOpCube(A.get_ref()); } // // cosh template arma_warn_unused arma_inline typename enable_if2< is_arma_type::value, const eOp >::result cosh(const T1& A) { arma_debug_sigprint(); return eOp(A); } template arma_warn_unused arma_inline const eOpCube cosh(const BaseCube& A) { arma_debug_sigprint(); return eOpCube(A.get_ref()); } // // acosh template arma_warn_unused arma_inline typename enable_if2< is_arma_type::value, const eOp >::result acosh(const T1& A) { arma_debug_sigprint(); return eOp(A); } template arma_warn_unused arma_inline const eOpCube acosh(const BaseCube& A) { arma_debug_sigprint(); return eOpCube(A.get_ref()); } // // sin template arma_warn_unused arma_inline typename enable_if2< is_arma_type::value, const eOp >::result sin(const T1& A) { arma_debug_sigprint(); return eOp(A); } template arma_warn_unused arma_inline const eOpCube sin(const BaseCube& A) { arma_debug_sigprint(); return eOpCube(A.get_ref()); } // // asin template arma_warn_unused arma_inline typename enable_if2< is_arma_type::value, const eOp >::result asin(const T1& A) { arma_debug_sigprint(); return eOp(A); } template arma_warn_unused arma_inline const eOpCube asin(const BaseCube& A) { arma_debug_sigprint(); return eOpCube(A.get_ref()); } // // sinh template arma_warn_unused arma_inline typename enable_if2< is_arma_type::value, const eOp >::result sinh(const T1& A) { arma_debug_sigprint(); return eOp(A); } template arma_warn_unused arma_inline const eOpCube sinh(const BaseCube& A) { arma_debug_sigprint(); return eOpCube(A.get_ref()); } // // asinh template arma_warn_unused arma_inline typename enable_if2< is_arma_type::value, const eOp >::result asinh(const T1& A) { arma_debug_sigprint(); return eOp(A); } template arma_warn_unused arma_inline const eOpCube asinh(const BaseCube& A) { arma_debug_sigprint(); return eOpCube(A.get_ref()); } // // tan template arma_warn_unused arma_inline typename enable_if2< is_arma_type::value, const eOp >::result tan(const T1& A) { arma_debug_sigprint(); return eOp(A); } template arma_warn_unused arma_inline const eOpCube tan(const BaseCube& A) { arma_debug_sigprint(); return eOpCube(A.get_ref()); } // // atan template arma_warn_unused arma_inline typename enable_if2< is_arma_type::value, const eOp >::result atan(const T1& A) { arma_debug_sigprint(); return eOp(A); } template arma_warn_unused arma_inline const eOpCube atan(const BaseCube& A) { arma_debug_sigprint(); return eOpCube(A.get_ref()); } // // tanh template arma_warn_unused arma_inline typename enable_if2< is_arma_type::value, const eOp >::result tanh(const T1& A) { arma_debug_sigprint(); return eOp(A); } template arma_warn_unused arma_inline const eOpCube tanh(const BaseCube& A) { arma_debug_sigprint(); return eOpCube(A.get_ref()); } // // atanh template arma_warn_unused arma_inline typename enable_if2< is_arma_type::value, const eOp >::result atanh(const T1& A) { arma_debug_sigprint(); return eOp(A); } template arma_warn_unused arma_inline const eOpCube atanh(const BaseCube& A) { arma_debug_sigprint(); return eOpCube(A.get_ref()); } // // sinc template arma_warn_unused arma_inline typename arma_scalar_only::result sinc(const T x) { return arma_sinc(x); } template arma_warn_unused arma_inline typename enable_if2< is_arma_type::value, const eOp >::result sinc(const T1& A) { arma_debug_sigprint(); return eOp(A); } template arma_warn_unused arma_inline const eOpCube sinc(const BaseCube& A) { arma_debug_sigprint(); return eOpCube(A.get_ref()); } // // atan2 template arma_warn_unused arma_inline typename enable_if2 < (is_arma_type::value && is_arma_type::value && is_real::value && is_same_type::value), const Glue >::result atan2(const T1& Y, const T2& X) { arma_debug_sigprint(); return Glue(Y, X); } template arma_warn_unused arma_inline typename enable_if2< is_real::value, const GlueCube >::result atan2(const BaseCube& Y, const BaseCube& X) { arma_debug_sigprint(); return GlueCube(Y.get_ref(), X.get_ref()); } // // hypot template arma_warn_unused arma_inline typename enable_if2 < (is_arma_type::value && is_arma_type::value && is_real::value && is_same_type::value), const Glue >::result hypot(const T1& X, const T2& Y) { arma_debug_sigprint(); return Glue(X, Y); } template arma_warn_unused arma_inline typename enable_if2< is_real::value, const GlueCube >::result hypot(const BaseCube& X, const BaseCube& Y) { arma_debug_sigprint(); return GlueCube(X.get_ref(), Y.get_ref()); } //! @} RcppArmadillo/inst/include/armadillo_bits/subview_field_meat.hpp0000644000176200001440000003013414654406643024753 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup subview_field //! @{ template inline subview_field::~subview_field() { arma_debug_sigprint(); } template arma_inline subview_field::subview_field ( const field& in_f, const uword in_row1, const uword in_col1, const uword in_n_rows, const uword in_n_cols ) : f(in_f) , aux_row1(in_row1) , aux_col1(in_col1) , aux_slice1(0) , n_rows(in_n_rows) , n_cols(in_n_cols) , n_slices( (in_f.n_slices > 0) ? uword(1) : uword(0) ) , n_elem(in_n_rows*in_n_cols*n_slices) { arma_debug_sigprint(); } template arma_inline subview_field::subview_field ( const field& in_f, const uword in_row1, const uword in_col1, const uword in_slice1, const uword in_n_rows, const uword in_n_cols, const uword in_n_slices ) : f(in_f) , aux_row1(in_row1) , aux_col1(in_col1) , aux_slice1(in_slice1) , n_rows(in_n_rows) , n_cols(in_n_cols) , n_slices(in_n_slices) , n_elem(in_n_rows*in_n_cols*in_n_slices) { arma_debug_sigprint(); } template inline void subview_field::operator= (const field& x) { arma_debug_sigprint(); subview_field& t = *this; arma_conform_check( (t.n_rows != x.n_rows) || (t.n_cols != x.n_cols) || (t.n_slices != x.n_slices), "incompatible field dimensions" ); if(t.n_slices == 1) { for(uword col=0; col < t.n_cols; ++col) for(uword row=0; row < t.n_rows; ++row) { t.at(row,col) = x.at(row,col); } } else { for(uword slice=0; slice < t.n_slices; ++slice) for(uword col=0; col < t.n_cols; ++col ) for(uword row=0; row < t.n_rows; ++row ) { t.at(row,col,slice) = x.at(row,col,slice); } } } //! x.subfield(...) = y.subfield(...) template inline void subview_field::operator= (const subview_field& x) { arma_debug_sigprint(); if(check_overlap(x)) { const field tmp(x); (*this).operator=(tmp); return; } subview_field& t = *this; arma_conform_check( (t.n_rows != x.n_rows) || (t.n_cols != x.n_cols) || (t.n_slices != x.n_slices), "incompatible field dimensions" ); if(t.n_slices == 1) { for(uword col=0; col < t.n_cols; ++col) for(uword row=0; row < t.n_rows; ++row) { t.at(row,col) = x.at(row,col); } } else { for(uword slice=0; slice < t.n_slices; ++slice) for(uword col=0; col < t.n_cols; ++col ) for(uword row=0; row < t.n_rows; ++row ) { t.at(row,col,slice) = x.at(row,col,slice); } } } template arma_inline oT& subview_field::operator[](const uword i) { const uword n_elem_slice = n_rows*n_cols; const uword in_slice = i / n_elem_slice; const uword offset = in_slice * n_elem_slice; const uword j = i - offset; const uword in_col = j / n_rows; const uword in_row = j % n_rows; const uword index = (in_slice + aux_slice1)*(f.n_rows*f.n_cols) + (in_col + aux_col1)*f.n_rows + aux_row1 + in_row; return *((const_cast< field& >(f)).mem[index]); } template arma_inline const oT& subview_field::operator[](const uword i) const { const uword n_elem_slice = n_rows*n_cols; const uword in_slice = i / n_elem_slice; const uword offset = in_slice * n_elem_slice; const uword j = i - offset; const uword in_col = j / n_rows; const uword in_row = j % n_rows; const uword index = (in_slice + aux_slice1)*(f.n_rows*f.n_cols) + (in_col + aux_col1)*f.n_rows + aux_row1 + in_row; return *(f.mem[index]); } template arma_inline oT& subview_field::operator()(const uword i) { arma_conform_check_bounds( (i >= n_elem), "subview_field::operator(): index out of bounds" ); return operator[](i); } template arma_inline const oT& subview_field::operator()(const uword i) const { arma_conform_check_bounds( (i >= n_elem), "subview_field::operator(): index out of bounds" ); return operator[](i); } template arma_inline oT& subview_field::operator()(const uword in_row, const uword in_col) { return operator()(in_row, in_col, 0); } template arma_inline const oT& subview_field::operator()(const uword in_row, const uword in_col) const { return operator()(in_row, in_col, 0); } template arma_inline oT& subview_field::operator()(const uword in_row, const uword in_col, const uword in_slice) { arma_conform_check_bounds( ((in_row >= n_rows) || (in_col >= n_cols) || (in_slice >= n_slices)), "subview_field::operator(): index out of bounds" ); const uword index = (in_slice + aux_slice1)*(f.n_rows*f.n_cols) + (in_col + aux_col1)*f.n_rows + aux_row1 + in_row; return *((const_cast< field& >(f)).mem[index]); } template arma_inline const oT& subview_field::operator()(const uword in_row, const uword in_col, const uword in_slice) const { arma_conform_check_bounds( ((in_row >= n_rows) || (in_col >= n_cols) || (in_slice >= n_slices)), "subview_field::operator(): index out of bounds" ); const uword index = (in_slice + aux_slice1)*(f.n_rows*f.n_cols) + (in_col + aux_col1)*f.n_rows + aux_row1 + in_row; return *(f.mem[index]); } template arma_inline oT& subview_field::at(const uword in_row, const uword in_col) { return at(in_row, in_col, 0); } template arma_inline const oT& subview_field::at(const uword in_row, const uword in_col) const { return at(in_row, in_col, 0); } template arma_inline oT& subview_field::at(const uword in_row, const uword in_col, const uword in_slice) { const uword index = (in_slice + aux_slice1)*(f.n_rows*f.n_cols) + (in_col + aux_col1)*f.n_rows + aux_row1 + in_row; return *((const_cast< field& >(f)).mem[index]); } template arma_inline const oT& subview_field::at(const uword in_row, const uword in_col, const uword in_slice) const { const uword index = (in_slice + aux_slice1)*(f.n_rows*f.n_cols) + (in_col + aux_col1)*f.n_rows + aux_row1 + in_row; return *(f.mem[index]); } template arma_inline bool subview_field::is_empty() const { return (n_elem == 0); } template inline bool subview_field::check_overlap(const subview_field& x) const { const subview_field& t = *this; if(&t.f != &x.f) { return false; } else { if( (t.n_elem == 0) || (x.n_elem == 0) ) { return false; } else { const uword t_row_start = t.aux_row1; const uword t_row_end_p1 = t_row_start + t.n_rows; const uword t_col_start = t.aux_col1; const uword t_col_end_p1 = t_col_start + t.n_cols; const uword t_slice_start = t.aux_slice1; const uword t_slice_end_p1 = t_slice_start + t.n_slices; const uword x_row_start = x.aux_row1; const uword x_row_end_p1 = x_row_start + x.n_rows; const uword x_col_start = x.aux_col1; const uword x_col_end_p1 = x_col_start + x.n_cols; const uword x_slice_start = x.aux_slice1; const uword x_slice_end_p1 = x_slice_start + x.n_slices; const bool outside_rows = ( (x_row_start >= t_row_end_p1 ) || (t_row_start >= x_row_end_p1 ) ); const bool outside_cols = ( (x_col_start >= t_col_end_p1 ) || (t_col_start >= x_col_end_p1 ) ); const bool outside_slices = ( (x_slice_start >= t_slice_end_p1) || (t_slice_start >= x_slice_end_p1) ); return ( (outside_rows == false) && (outside_cols == false) && (outside_slices == false) ); } } } template inline void subview_field::print(const std::string extra_text) const { arma_debug_sigprint(); if(extra_text.length() != 0) { const std::streamsize orig_width = get_cout_stream().width(); get_cout_stream() << extra_text << '\n'; get_cout_stream().width(orig_width); } arma_ostream::print(get_cout_stream(), *this); } template inline void subview_field::print(std::ostream& user_stream, const std::string extra_text) const { arma_debug_sigprint(); if(extra_text.length() != 0) { const std::streamsize orig_width = user_stream.width(); user_stream << extra_text << '\n'; user_stream.width(orig_width); } arma_ostream::print(user_stream, *this); } template template inline void subview_field::for_each(functor F) { arma_debug_sigprint(); subview_field& t = *this; if(t.n_slices == 1) { for(uword col=0; col < t.n_cols; ++col) for(uword row=0; row < t.n_rows; ++row) { F( t.at(row,col) ); } } else { for(uword slice=0; slice < t.n_slices; ++slice) for(uword col=0; col < t.n_cols; ++col ) for(uword row=0; row < t.n_rows; ++row ) { F( t.at(row,col,slice) ); } } } template template inline void subview_field::for_each(functor F) const { arma_debug_sigprint(); const subview_field& t = *this; if(t.n_slices == 1) { for(uword col=0; col < t.n_cols; ++col) for(uword row=0; row < t.n_rows; ++row) { F( t.at(row,col) ); } } else { for(uword slice=0; slice < t.n_slices; ++slice) for(uword col=0; col < t.n_cols; ++col ) for(uword row=0; row < t.n_rows; ++row ) { F( t.at(row,col,slice) ); } } } template inline void subview_field::fill(const oT& x) { arma_debug_sigprint(); subview_field& t = *this; if(t.n_slices == 1) { for(uword col=0; col < t.n_cols; ++col) for(uword row=0; row < t.n_rows; ++row) { t.at(row,col) = x; } } else { for(uword slice=0; slice < t.n_slices; ++slice) for(uword col=0; col < t.n_cols; ++col ) for(uword row=0; row < t.n_rows; ++row ) { t.at(row,col,slice) = x; } } } //! X = Y.subfield(...) template inline void subview_field::extract(field& actual_out, const subview_field& in) { arma_debug_sigprint(); // const bool alias = (&actual_out == &in.f); field* tmp = (alias) ? new field : nullptr; field& out = (alias) ? (*tmp) : actual_out; // const uword n_rows = in.n_rows; const uword n_cols = in.n_cols; const uword n_slices = in.n_slices; out.set_size(n_rows, n_cols, n_slices); arma_debug_print(arma_str::format("out.n_rows: %u; out.n_cols: %u; out.n_slices: %u; in.f.n_rows: %u; in.f.n_cols: %u; in.f.n_slices: %u") % out.n_rows % out.n_cols % out.n_slices % in.f.n_rows % in.f.n_cols % in.f.n_slices); if(n_slices == 1) { for(uword col = 0; col < n_cols; ++col) for(uword row = 0; row < n_rows; ++row) { out.at(row,col) = in.at(row,col); } } else { for(uword slice = 0; slice < n_slices; ++slice) for(uword col = 0; col < n_cols; ++col ) for(uword row = 0; row < n_rows; ++row ) { out.at(row,col,slice) = in.at(row,col,slice); } } if(alias) { actual_out = out; delete tmp; } } //! @} RcppArmadillo/inst/include/armadillo_bits/sym_helper.hpp0000644000176200001440000003055415030507611023255 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup sym_helper //! @{ namespace sym_helper { // computationally inexpensive algorithm to guess whether a matrix is positive definite: // (1) ensure the matrix is symmetric/hermitian (within a tolerance) // (2) ensure the diagonal entries are real and greater than zero // (3) ensure that the value with largest modulus is on the main diagonal // (4) ensure rudimentary diagonal dominance: (real(A_ii) + real(A_jj)) > 2*abs(real(A_ij)) // the above conditions are necessary, but not sufficient; // doing it properly would be too computationally expensive for our purposes // more info: // http://mathworld.wolfram.com/PositiveDefiniteMatrix.html // http://mathworld.wolfram.com/DiagonallyDominantMatrix.html template inline typename enable_if2::no, bool>::result guess_sympd_worker(const Mat& A) { arma_debug_sigprint(); // NOTE: assuming A is square-sized const eT tol = eT(100) * std::numeric_limits::epsilon(); // allow some leeway const uword N = A.n_rows; const eT* A_mem = A.memptr(); const eT* A_col = A_mem; bool diag_below_tol = true; eT max_diag = eT(0); for(uword j=0; j < N; ++j) { const eT A_jj = A_col[j]; if( A_jj <= eT(0)) { return false; } if(arma_isnonfinite(A_jj)) { return false; } if(A_jj >= tol) { diag_below_tol = false; } max_diag = (A_jj > max_diag) ? A_jj : max_diag; A_col += N; } if(diag_below_tol) { return false; } // assume matrix is suspect if all diagonal elements are close to zero A_col = A_mem; const uword Nm1 = N-1; const uword Np1 = N+1; for(uword j=0; j < Nm1; ++j) { const eT A_jj = A_col[j]; const uword jp1 = j+1; const eT* A_ji_ptr = &(A_mem[j + jp1*N]); // &(A.at(j,jp1)); const eT* A_ii_ptr = &(A_mem[jp1 + jp1*N]); for(uword i=jp1; i < N; ++i) { const eT A_ij = A_col[i]; const eT A_ji = (*A_ji_ptr); const eT A_ij_abs = (std::abs)(A_ij); const eT A_ji_abs = (std::abs)(A_ji); // if( (A_ij_abs >= max_diag) || (A_ji_abs >= max_diag) ) { return false; } if(A_ij_abs >= max_diag) { return false; } const eT A_delta = (std::abs)(A_ij - A_ji); const eT A_abs_max = (std::max)(A_ij_abs, A_ji_abs); if( (A_delta > tol) && (A_delta > (A_abs_max*tol)) ) { return false; } const eT A_ii = (*A_ii_ptr); if( (A_ij_abs + A_ij_abs) >= (A_ii + A_jj) ) { return false; } A_ji_ptr += N; A_ii_ptr += Np1; } A_col += N; } return true; } template inline typename enable_if2::yes, bool>::result guess_sympd_worker(const Mat& A) { arma_debug_sigprint(); // NOTE: assuming A is square-sized // NOTE: the function name is required for overloading, but is a misnomer: it processes complex hermitian matrices typedef typename get_pod_type::result T; const T tol = T(100) * std::numeric_limits::epsilon(); // allow some leeway const uword N = A.n_rows; const eT* A_mem = A.memptr(); const eT* A_col = A_mem; bool diag_below_tol = true; T max_diag = T(0); for(uword j=0; j < N; ++j) { const eT& A_jj = A_col[j]; const T A_jj_r = std::real(A_jj ); const T A_jj_i = std::imag(A_jj ); const T A_jj_rabs = std::abs(A_jj_r); const T A_jj_iabs = std::abs(A_jj_i); if( A_jj_r <= T(0) ) { return false; } // real should be positive if(arma_isnonfinite(A_jj_r)) { return false; } if(A_jj_iabs > tol ) { return false; } // imag should be approx zero if(A_jj_iabs > A_jj_rabs) { return false; } // corner case: real and imag are close to zero, and imag is dominant if(A_jj_r >= tol) { diag_below_tol = false; } max_diag = (A_jj_r > max_diag) ? A_jj_r : max_diag; A_col += N; } if(diag_below_tol) { return false; } // assume matrix is suspect if all diagonal elements are close to zero const T square_max_diag = max_diag * max_diag; if(arma_isnonfinite(square_max_diag)) { return false; } A_col = A_mem; const uword Nm1 = N-1; const uword Np1 = N+1; for(uword j=0; j < Nm1; ++j) { const uword jp1 = j+1; const eT* A_ji_ptr = &(A_mem[j + jp1*N]); // &(A.at(j,jp1)); const eT* A_ii_ptr = &(A_mem[jp1 + jp1*N]); const T A_jj_real = std::real(A_col[j]); for(uword i=jp1; i < N; ++i) { const eT& A_ij = A_col[i]; const T A_ij_real = std::real(A_ij); const T A_ij_imag = std::imag(A_ij); // avoid using std::abs(), as that is time consuming due to division and std::sqrt() const T square_A_ij_abs = (A_ij_real * A_ij_real) + (A_ij_imag * A_ij_imag); if(arma_isnonfinite(square_A_ij_abs)) { return false; } if(square_A_ij_abs >= square_max_diag) { return false; } const T A_ij_real_abs = (std::abs)(A_ij_real); const T A_ij_imag_abs = (std::abs)(A_ij_imag); const eT& A_ji = (*A_ji_ptr); const T A_ji_real = std::real(A_ji); const T A_ji_imag = std::imag(A_ji); const T A_ji_real_abs = (std::abs)(A_ji_real); const T A_ji_imag_abs = (std::abs)(A_ji_imag); const T A_real_delta = (std::abs)(A_ij_real - A_ji_real); const T A_real_abs_max = (std::max)(A_ij_real_abs, A_ji_real_abs); if( (A_real_delta > tol) && (A_real_delta > (A_real_abs_max*tol)) ) { return false; } const T A_imag_delta = (std::abs)(A_ij_imag + A_ji_imag); // take into account complex conjugate const T A_imag_abs_max = (std::max)(A_ij_imag_abs, A_ji_imag_abs); if( (A_imag_delta > tol) && (A_imag_delta > (A_imag_abs_max*tol)) ) { return false; } const T A_ii_real = std::real(*A_ii_ptr); if( (A_ij_real_abs + A_ij_real_abs) >= (A_ii_real + A_jj_real) ) { return false; } A_ji_ptr += N; A_ii_ptr += Np1; } A_col += N; } return true; } template inline bool guess_sympd(const Mat& A) { arma_debug_sigprint(); // analyse matrices with size >= 4x4 if((A.n_rows != A.n_cols) || (A.n_rows < uword(4))) { return false; } return guess_sympd_worker(A); } template inline bool guess_sympd(const Mat& A, const uword min_n_rows) { arma_debug_sigprint(); if((A.n_rows != A.n_cols) || (A.n_rows < min_n_rows)) { return false; } return guess_sympd_worker(A); } // template inline typename enable_if2::no, bool>::result is_approx_sym_worker(const Mat& A) { arma_debug_sigprint(); const eT tol = eT(100) * std::numeric_limits::epsilon(); // allow some leeway const uword N = A.n_rows; const eT* A_mem = A.memptr(); const eT* A_col = A_mem; bool diag_below_tol = true; for(uword j=0; j < N; ++j) { const eT A_jj = A_col[j]; if(arma_isnonfinite(A_jj)) { return false; } if(std::abs(A_jj) >= tol) { diag_below_tol = false; } A_col += N; } if(diag_below_tol) { return false; } // assume matrix is suspect if all diagonal elements are close to zero A_col = A_mem; const uword Nm1 = N-1; for(uword j=0; j < Nm1; ++j) { const uword jp1 = j+1; const eT* A_ji_ptr = &(A_mem[j + jp1*N]); // &(A.at(j,jp1)); for(uword i=jp1; i < N; ++i) { const eT A_ij = A_col[i]; const eT A_ji = (*A_ji_ptr); const eT A_ij_abs = (std::abs)(A_ij); const eT A_ji_abs = (std::abs)(A_ji); const eT A_delta = (std::abs)(A_ij - A_ji); const eT A_abs_max = (std::max)(A_ij_abs, A_ji_abs); if( (A_delta > tol) && (A_delta > (A_abs_max*tol)) ) { return false; } A_ji_ptr += N; } A_col += N; } return true; } template inline typename enable_if2::yes, bool>::result is_approx_sym_worker(const Mat& A) { arma_debug_sigprint(); // NOTE: the function name is required for overloading, but is a misnomer: it processes complex hermitian matrices typedef typename get_pod_type::result T; const T tol = T(100) * std::numeric_limits::epsilon(); // allow some leeway const uword N = A.n_rows; const eT* A_mem = A.memptr(); const eT* A_col = A_mem; bool diag_below_tol = true; // ensure diagonal has approx real-only elements for(uword j=0; j < N; ++j) { const eT& A_jj = A_col[j]; const T A_jj_r = std::real(A_jj ); const T A_jj_i = std::imag(A_jj ); const T A_jj_rabs = std::abs(A_jj_r); const T A_jj_iabs = std::abs(A_jj_i); if(A_jj_iabs > tol ) { return false; } // imag should be approx zero if(A_jj_iabs > A_jj_rabs) { return false; } // corner case: real and imag are close to zero, and imag is dominant if(arma_isnonfinite(A_jj_r)) { return false; } if(A_jj_rabs >= tol) { diag_below_tol = false; } A_col += N; } if(diag_below_tol) { return false; } // assume matrix is suspect if all diagonal elements are close to zero A_col = A_mem; const uword Nm1 = N-1; for(uword j=0; j < Nm1; ++j) { const uword jp1 = j+1; const eT* A_ji_ptr = &(A_mem[j + jp1*N]); // &(A.at(j,jp1)); for(uword i=jp1; i < N; ++i) { const eT& A_ij = A_col[i]; const T A_ij_real = std::real(A_ij); const T A_ij_imag = std::imag(A_ij); const T A_ij_real_abs = (std::abs)(A_ij_real); const T A_ij_imag_abs = (std::abs)(A_ij_imag); const eT& A_ji = (*A_ji_ptr); const T A_ji_real = std::real(A_ji); const T A_ji_imag = std::imag(A_ji); const T A_ji_real_abs = (std::abs)(A_ji_real); const T A_ji_imag_abs = (std::abs)(A_ji_imag); const T A_real_delta = (std::abs)(A_ij_real - A_ji_real); const T A_real_abs_max = (std::max)(A_ij_real_abs, A_ji_real_abs); if( (A_real_delta > tol) && (A_real_delta > (A_real_abs_max*tol)) ) { return false; } const T A_imag_delta = (std::abs)(A_ij_imag + A_ji_imag); // take into account complex conjugate const T A_imag_abs_max = (std::max)(A_ij_imag_abs, A_ji_imag_abs); if( (A_imag_delta > tol) && (A_imag_delta > (A_imag_abs_max*tol)) ) { return false; } A_ji_ptr += N; } A_col += N; } return true; } template inline bool is_approx_sym(const Mat& A) { arma_debug_sigprint(); // analyse matrices with size >= 4x4 if((A.n_rows != A.n_cols) || (A.n_rows < uword(4))) { return false; } return is_approx_sym_worker(A); } template inline bool is_approx_sym(const Mat& A, const uword min_n_rows) { arma_debug_sigprint(); if((A.n_rows != A.n_cols) || (A.n_rows < min_n_rows)) { return false; } return is_approx_sym_worker(A); } // template inline bool check_diag_imag(const Mat& A) { arma_debug_sigprint(); // NOTE: assuming matrix A is square-sized typedef typename get_pod_type::result T; const T tol = T(10000) * std::numeric_limits::epsilon(); // allow some leeway const eT* colmem = A.memptr(); const uword N = A.n_rows; for(uword i=0; i tol) { return false; } colmem += N; } return true; } } // end of namespace sym_helper //! @} RcppArmadillo/inst/include/armadillo_bits/fn_randu.hpp0000644000176200001440000001705314631567470022720 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_randu //! @{ // scalars arma_warn_unused inline double randu() { arma_debug_sigprint(); return double(arma_rng::randu()); } template arma_warn_unused inline typename arma_real_or_cx_only::result randu() { arma_debug_sigprint(); return eT(arma_rng::randu()); } arma_warn_unused inline double randu(const distr_param& param) { arma_debug_sigprint(); if(param.state == 0) { return double(arma_rng::randu()); } double a = double(0); double b = double(1); param.get_double_vals(a,b); arma_conform_check( (a >= b), "randu(): incorrect distribution parameters; a must be less than b" ); const double val = double(arma_rng::randu()); return ((val * (b - a)) + a); } template arma_warn_unused inline typename arma_real_or_cx_only::result randu(const distr_param& param) { arma_debug_sigprint(); if(param.state == 0) { return eT(arma_rng::randu()); } double a = double(0); double b = double(1); param.get_double_vals(a,b); arma_conform_check( (a >= b), "randu(): incorrect distribution parameters; a must be less than b" ); eT val = eT(0); arma_rng::randu::fill(&val, 1, a, b); // using fill() as eT can be complex return val; } // vectors arma_warn_unused inline vec randu(const uword n_elem, const distr_param& param = distr_param()) { arma_debug_sigprint(); vec out(n_elem, arma_nozeros_indicator()); if(param.state == 0) { arma_rng::randu::fill(out.memptr(), n_elem); } else { double a = double(0); double b = double(1); param.get_double_vals(a,b); arma_conform_check( (a >= b), "randu(): incorrect distribution parameters; a must be less than b" ); arma_rng::randu::fill(out.memptr(), n_elem, a, b); } return out; } template arma_warn_unused inline obj_type randu(const uword n_elem, const distr_param& param = distr_param(), const typename arma_Mat_Col_Row_only::result* junk = nullptr) { arma_debug_sigprint(); arma_ignore(junk); typedef typename obj_type::elem_type eT; const uword n_rows = (is_Row::value) ? uword(1) : n_elem; const uword n_cols = (is_Row::value) ? n_elem : uword(1); obj_type out(n_rows, n_cols, arma_nozeros_indicator()); if(param.state == 0) { arma_rng::randu::fill(out.memptr(), out.n_elem); } else { double a = double(0); double b = double(1); param.get_double_vals(a,b); arma_conform_check( (a >= b), "randu(): incorrect distribution parameters; a must be less than b" ); arma_rng::randu::fill(out.memptr(), out.n_elem, a, b); } return out; } // matrices arma_warn_unused inline mat randu(const uword n_rows, const uword n_cols, const distr_param& param = distr_param()) { arma_debug_sigprint(); mat out(n_rows, n_cols, arma_nozeros_indicator()); if(param.state == 0) { arma_rng::randu::fill(out.memptr(), out.n_elem); } else { double a = double(0); double b = double(1); param.get_double_vals(a,b); arma_conform_check( (a >= b), "randu(): incorrect distribution parameters; a must be less than b" ); arma_rng::randu::fill(out.memptr(), out.n_elem, a, b); } return out; } arma_warn_unused inline mat randu(const SizeMat& s, const distr_param& param = distr_param()) { arma_debug_sigprint(); return randu(s.n_rows, s.n_cols, param); } template arma_warn_unused inline obj_type randu(const uword n_rows, const uword n_cols, const distr_param& param = distr_param(), const typename arma_Mat_Col_Row_only::result* junk = nullptr) { arma_debug_sigprint(); arma_ignore(junk); typedef typename obj_type::elem_type eT; if(is_Col::value) { arma_conform_check( (n_cols != 1), "randu(): incompatible size" ); } if(is_Row::value) { arma_conform_check( (n_rows != 1), "randu(): incompatible size" ); } obj_type out(n_rows, n_cols, arma_nozeros_indicator()); if(param.state == 0) { arma_rng::randu::fill(out.memptr(), out.n_elem); } else { double a = double(0); double b = double(1); param.get_double_vals(a,b); arma_conform_check( (a >= b), "randu(): incorrect distribution parameters; a must be less than b" ); arma_rng::randu::fill(out.memptr(), out.n_elem, a, b); } return out; } template arma_warn_unused inline obj_type randu(const SizeMat& s, const distr_param& param = distr_param(), const typename arma_Mat_Col_Row_only::result* junk = nullptr) { arma_debug_sigprint(); arma_ignore(junk); return randu(s.n_rows, s.n_cols, param); } // cubes arma_warn_unused inline cube randu(const uword n_rows, const uword n_cols, const uword n_slices, const distr_param& param = distr_param()) { arma_debug_sigprint(); cube out(n_rows, n_cols, n_slices, arma_nozeros_indicator()); if(param.state == 0) { arma_rng::randu::fill(out.memptr(), out.n_elem); } else { double a = double(0); double b = double(1); param.get_double_vals(a,b); arma_conform_check( (a >= b), "randu(): incorrect distribution parameters; a must be less than b" ); arma_rng::randu::fill(out.memptr(), out.n_elem, a, b); } return out; } arma_warn_unused inline cube randu(const SizeCube& s, const distr_param& param = distr_param()) { arma_debug_sigprint(); return randu(s.n_rows, s.n_cols, s.n_slices, param); } template arma_warn_unused inline cube_type randu(const uword n_rows, const uword n_cols, const uword n_slices, const distr_param& param = distr_param(), const typename arma_Cube_only::result* junk = nullptr) { arma_debug_sigprint(); arma_ignore(junk); typedef typename cube_type::elem_type eT; cube_type out(n_rows, n_cols, n_slices, arma_nozeros_indicator()); if(param.state == 0) { arma_rng::randu::fill(out.memptr(), out.n_elem); } else { double a = double(0); double b = double(1); param.get_double_vals(a,b); arma_conform_check( (a >= b), "randu(): incorrect distribution parameters; a must be less than b" ); arma_rng::randu::fill(out.memptr(), out.n_elem, a, b); } return out; } template arma_warn_unused inline cube_type randu(const SizeCube& s, const distr_param& param = distr_param(), const typename arma_Cube_only::result* junk = nullptr) { arma_debug_sigprint(); arma_ignore(junk); return randu(s.n_rows, s.n_cols, s.n_slices, param); } //! @} RcppArmadillo/inst/include/armadillo_bits/mtGlue_meat.hpp0000644000176200001440000000327514715372502023361 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup mtGlue //! @{ template inline mtGlue::mtGlue(const T1& in_A, const T2& in_B) : A(in_A) , B(in_B) { arma_debug_sigprint(); } template inline mtGlue::mtGlue(const T1& in_A, const T2& in_B, const uword in_aux_uword) : A(in_A) , B(in_B) , aux_uword(in_aux_uword) { arma_debug_sigprint(); } template inline mtGlue::~mtGlue() { arma_debug_sigprint(); } template template inline bool mtGlue::is_alias(const Mat& X) const { arma_debug_sigprint(); return (A.is_alias(X) || B.is_alias(X)); } //! @} RcppArmadillo/inst/include/armadillo_bits/podarray_meat.hpp0000644000176200001440000001160215030507611023726 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup podarray //! @{ template inline podarray::~podarray() { arma_debug_sigprint_this(this); if(n_elem > podarray_prealloc_n_elem::val ) { memory::release( mem ); } } template inline podarray::podarray() : n_elem(0 ) , mem (nullptr) { arma_debug_sigprint_this(this); } template inline podarray::podarray(const podarray& x) : n_elem(x.n_elem) { arma_debug_sigprint(); const uword x_n_elem = x.n_elem; init_cold(x_n_elem); arrayops::copy( memptr(), x.memptr(), x_n_elem ); } template inline const podarray& podarray::operator=(const podarray& x) { arma_debug_sigprint(); if(this != &x) { const uword x_n_elem = x.n_elem; init_warm(x_n_elem); arrayops::copy( memptr(), x.memptr(), x_n_elem ); } return *this; } template arma_inline podarray::podarray(const uword new_n_elem) : n_elem(new_n_elem) { arma_debug_sigprint_this(this); init_cold(new_n_elem); } template template inline podarray::podarray(const uword new_n_elem, const arma_initmode_indicator&) : n_elem(new_n_elem) { arma_debug_sigprint_this(this); init_cold(new_n_elem); if(do_zeros) { arma_debug_print("podarray::constructor: zeroing memory"); arrayops::fill_zeros(memptr(), n_elem); } } template arma_inline eT podarray::operator[] (const uword i) const { return mem[i]; } template arma_inline eT& podarray::operator[] (const uword i) { return mem[i]; } template arma_inline eT podarray::operator() (const uword i) const { arma_conform_check_bounds( (i >= n_elem), "podarray::operator(): index out of bounds" ); return mem[i]; } template arma_inline eT& podarray::operator() (const uword i) { arma_conform_check_bounds( (i >= n_elem), "podarray::operator(): index out of bounds" ); return mem[i]; } template inline void podarray::set_min_size(const uword min_n_elem) { arma_debug_sigprint(); if(min_n_elem > n_elem) { init_warm(min_n_elem); } } template inline void podarray::set_size(const uword new_n_elem) { arma_debug_sigprint(); init_warm(new_n_elem); } template inline void podarray::reset() { arma_debug_sigprint(); init_warm(0); } template inline void podarray::fill(const eT val) { arma_debug_sigprint(); arrayops::inplace_set(memptr(), val, n_elem); } template inline void podarray::zeros() { arma_debug_sigprint(); arrayops::fill_zeros(memptr(), n_elem); } template inline void podarray::zeros(const uword new_n_elem) { arma_debug_sigprint(); init_warm(new_n_elem); arrayops::fill_zeros(memptr(), n_elem); } template arma_inline eT* podarray::memptr() { return mem; } template arma_inline const eT* podarray::memptr() const { return mem; } template inline void podarray::copy_row(const Mat& A, const uword row) { arma_debug_sigprint(); const uword n_rows = A.n_rows; const uword n_cols = A.n_cols; init_warm(n_cols); const eT* A_mem = &(A.at(row,0)); eT* out_mem = memptr(); for(uword i=0; i < n_cols; ++i) { out_mem[i] = (*A_mem); A_mem += n_rows; } } template inline void podarray::init_cold(const uword new_n_elem) { arma_debug_sigprint(); mem = (new_n_elem <= podarray_prealloc_n_elem::val) ? mem_local : memory::acquire(new_n_elem); } template inline void podarray::init_warm(const uword new_n_elem) { arma_debug_sigprint(); if(n_elem == new_n_elem) { return; } if(n_elem > podarray_prealloc_n_elem::val) { memory::release( mem ); } mem = (new_n_elem <= podarray_prealloc_n_elem::val) ? mem_local : memory::acquire(new_n_elem); access::rw(n_elem) = new_n_elem; } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_normalise.hpp0000644000176200001440000000504014631567470023571 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_normalise //! @{ template arma_warn_unused inline typename enable_if2 < is_arma_type::value && resolves_to_vector::yes, const Op >::result normalise ( const T1& X, const uword p = uword(2), const arma_empty_class junk1 = arma_empty_class(), const typename arma_real_or_cx_only::result* junk2 = nullptr ) { arma_debug_sigprint(); arma_ignore(junk1); arma_ignore(junk2); return Op(X, p, 0); } template arma_warn_unused inline typename enable_if2 < is_arma_type::value && resolves_to_vector::no, const Op >::result normalise ( const T1& X, const uword p = uword(2), const uword dim = 0, const typename arma_real_or_cx_only::result* junk = nullptr ) { arma_debug_sigprint(); arma_ignore(junk); return Op(X, p, dim); } template arma_warn_unused inline const SpOp normalise ( const SpBase& expr, const uword p = uword(2), const uword dim = 0, const typename arma_real_or_cx_only::result* junk = nullptr ) { arma_debug_sigprint(); arma_ignore(junk); return SpOp(expr.get_ref(), p, dim); } //! for compatibility purposes: allows compiling user code designed for earlier versions of Armadillo template arma_warn_unused arma_inline typename enable_if2 < is_supported_blas_type::value, Col >::result normalise(const T& val) { Col out(1, arma_nozeros_indicator()); out[0] = (val != T(0)) ? T(val / (std::abs)(val)) : T(val); return out; } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_any.hpp0000644000176200001440000000354614631567470022400 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_any //! @{ template arma_warn_unused inline typename enable_if2 < is_arma_type::value && resolves_to_vector::yes, bool >::result any(const T1& X) { arma_debug_sigprint(); return op_any::any_vec(X); } template arma_warn_unused arma_inline typename enable_if2 < is_arma_type::value && resolves_to_vector::no, const mtOp >::result any(const T1& X) { arma_debug_sigprint(); return mtOp(X, 0, 0); } template arma_warn_unused arma_inline typename enable_if2 < is_arma_type::value, const mtOp >::result any(const T1& X, const uword dim) { arma_debug_sigprint(); return mtOp(X, dim, 0); } //! for compatibility purposes: allows compiling user code designed for earlier versions of Armadillo template arma_warn_unused arma_inline typename enable_if2 < is_supported_elem_type::value, bool >::result any(const T& val) { return (val != T(0)); } //! @} RcppArmadillo/inst/include/armadillo_bits/glue_cov_meat.hpp0000644000176200001440000000405514631567470023733 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup glue_cov //! @{ template inline void glue_cov::apply(Mat& out, const Glue& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword norm_type = X.aux_uword; const unwrap UA(X.A); const unwrap UB(X.B); const Mat& A = UA.M; const Mat& B = UB.M; const Mat& AA = (A.n_rows == 1) ? Mat(const_cast(A.memptr()), A.n_cols, A.n_rows, false, false) : Mat(const_cast(A.memptr()), A.n_rows, A.n_cols, false, false); const Mat& BB = (B.n_rows == 1) ? Mat(const_cast(B.memptr()), B.n_cols, B.n_rows, false, false) : Mat(const_cast(B.memptr()), B.n_rows, B.n_cols, false, false); arma_conform_assert_mul_size(AA, BB, true, false, "cov()"); if( (A.n_elem == 0) || (B.n_elem == 0) ) { out.reset(); return; } const uword N = AA.n_rows; const eT norm_val = (norm_type == 0) ? ( (N > 1) ? eT(N-1) : eT(1) ) : eT(N); const Mat tmp1 = AA.each_row() - mean(AA,0); const Mat tmp2 = BB.each_row() - mean(BB,0); out = tmp1.t() * tmp2; out /= norm_val; } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_find.hpp0000644000176200001440000002351715030507611022512 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_find //! @{ template arma_warn_unused inline typename enable_if2 < is_arma_type::value, const mtOp >::result find(const T1& X) { arma_debug_sigprint(); return mtOp(X); } template arma_warn_unused inline const mtOp find(const Base& X, const uword k, const char* direction = "first") { arma_debug_sigprint(); const char sig = (direction != nullptr) ? direction[0] : char(0); arma_conform_check ( ( (sig != 'f') && (sig != 'F') && (sig != 'l') && (sig != 'L') ), "find(): direction must be \"first\" or \"last\"" ); const uword type = ( (sig == 'f') || (sig == 'F') ) ? 0 : 1; return mtOp(X.get_ref(), k, type); } // template arma_warn_unused inline uvec find(const BaseCube& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const unwrap_cube tmp(X.get_ref()); const Mat R( const_cast< eT* >(tmp.M.memptr()), tmp.M.n_elem, 1, false ); return find(R); } template arma_warn_unused inline uvec find(const BaseCube& X, const uword k, const char* direction = "first") { arma_debug_sigprint(); typedef typename T1::elem_type eT; const unwrap_cube tmp(X.get_ref()); const Mat R( const_cast< eT* >(tmp.M.memptr()), tmp.M.n_elem, 1, false ); return find(R, k, direction); } template arma_warn_unused inline uvec find(const mtOpCube& X, const uword k = 0, const char* direction = "first") { arma_debug_sigprint(); typedef typename T1::elem_type eT; const unwrap_cube tmp(X.m); const Mat R( const_cast< eT* >(tmp.M.memptr()), tmp.M.n_elem, 1, false ); return find( mtOp, op_rel_type>(R, X.aux), k, direction ); } template arma_warn_unused inline uvec find(const mtGlueCube& X, const uword k = 0, const char* direction = "first") { arma_debug_sigprint(); typedef typename T1::elem_type eT1; typedef typename T2::elem_type eT2; const unwrap_cube tmp1(X.A); const unwrap_cube tmp2(X.B); arma_conform_assert_same_size( tmp1.M, tmp2.M, "relational operator" ); const Mat R1( const_cast< eT1* >(tmp1.M.memptr()), tmp1.M.n_elem, 1, false ); const Mat R2( const_cast< eT2* >(tmp2.M.memptr()), tmp2.M.n_elem, 1, false ); return find( mtGlue, Mat, glue_rel_type>(R1, R2), k, direction ); } // template arma_warn_unused inline Col find(const SpBase& X, const uword k = 0) { arma_debug_sigprint(); const SpProxy P(X.get_ref()); const uword n_rows = P.get_n_rows(); const uword n_nz = P.get_n_nonzero(); Mat tmp(n_nz, 1, arma_nozeros_indicator()); uword* tmp_mem = tmp.memptr(); typename SpProxy::const_iterator_type it = P.begin(); for(uword i=0; i out; const uword count = (k == 0) ? uword(n_nz) : uword( (std::min)(n_nz, k) ); out.steal_mem_col(tmp, count); return out; } template arma_warn_unused inline Col find(const SpBase& X, const uword k, const char* direction) { arma_debug_sigprint(); arma_ignore(X); arma_ignore(k); arma_ignore(direction); arma_check(true, "find(SpBase,k,direction): not implemented yet"); // TODO Col out; return out; } // template arma_warn_unused inline typename enable_if2 < is_arma_type::value, const mtOp >::result find_finite(const T1& X) { arma_debug_sigprint(); return mtOp(X); } template arma_warn_unused inline typename enable_if2 < is_arma_type::value, const mtOp >::result find_nonfinite(const T1& X) { arma_debug_sigprint(); return mtOp(X); } template arma_warn_unused inline typename enable_if2 < is_arma_type::value, const mtOp >::result find_nan(const T1& X) { arma_debug_sigprint(); return mtOp(X); } template arma_warn_unused inline typename enable_if2 < is_arma_type::value, const mtOp >::result find_nonnan(const T1& X) { arma_debug_sigprint(); return mtOp(X); } // template arma_warn_unused inline uvec find_finite(const BaseCube& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const unwrap_cube tmp(X.get_ref()); const Mat R( const_cast< eT* >(tmp.M.memptr()), tmp.M.n_elem, 1, false ); return find_finite(R); } template arma_warn_unused inline uvec find_nonfinite(const BaseCube& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const unwrap_cube tmp(X.get_ref()); const Mat R( const_cast< eT* >(tmp.M.memptr()), tmp.M.n_elem, 1, false ); return find_nonfinite(R); } template arma_warn_unused inline uvec find_nan(const BaseCube& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const unwrap_cube tmp(X.get_ref()); const Mat R( const_cast< eT* >(tmp.M.memptr()), tmp.M.n_elem, 1, false ); return find_nan(R); } template arma_warn_unused inline uvec find_nonnan(const BaseCube& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const unwrap_cube tmp(X.get_ref()); const Mat R( const_cast< eT* >(tmp.M.memptr()), tmp.M.n_elem, 1, false ); return find_nonnan(R); } // template arma_warn_unused inline Col find_finite(const SpBase& X) { arma_debug_sigprint(); const SpProxy P(X.get_ref()); const uword n_rows = P.get_n_rows(); const uword n_nz = P.get_n_nonzero(); Mat tmp(n_nz, 1, arma_nozeros_indicator()); uword* tmp_mem = tmp.memptr(); typename SpProxy::const_iterator_type it = P.begin(); uword count = 0; for(uword i=0; i out; if(count > 0) { out.steal_mem_col(tmp, count); } return out; } template arma_warn_unused inline Col find_nonfinite(const SpBase& X) { arma_debug_sigprint(); const SpProxy P(X.get_ref()); const uword n_rows = P.get_n_rows(); const uword n_nz = P.get_n_nonzero(); Mat tmp(n_nz, 1, arma_nozeros_indicator()); uword* tmp_mem = tmp.memptr(); typename SpProxy::const_iterator_type it = P.begin(); uword count = 0; for(uword i=0; i out; if(count > 0) { out.steal_mem_col(tmp, count); } return out; } template arma_warn_unused inline Col find_nan(const SpBase& X) { arma_debug_sigprint(); const SpProxy P(X.get_ref()); const uword n_rows = P.get_n_rows(); const uword n_nz = P.get_n_nonzero(); Mat tmp(n_nz, 1, arma_nozeros_indicator()); uword* tmp_mem = tmp.memptr(); typename SpProxy::const_iterator_type it = P.begin(); uword count = 0; for(uword i=0; i out; if(count > 0) { out.steal_mem_col(tmp, count); } return out; } template arma_warn_unused inline Col find_nonnan(const SpBase& X) { arma_debug_sigprint(); const SpProxy P(X.get_ref()); const uword n_rows = P.get_n_rows(); const uword n_nz = P.get_n_nonzero(); Mat tmp(n_nz, 1, arma_nozeros_indicator()); uword* tmp_mem = tmp.memptr(); typename SpProxy::const_iterator_type it = P.begin(); uword count = 0; for(uword i=0; i out; if(count > 0) { out.steal_mem_col(tmp, count); } return out; } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_polyfit.hpp0000644000176200001440000000335214635324415023264 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_polyfit //! @{ template inline typename enable_if2 < is_supported_blas_type::value, bool >::result polyfit(Mat& out, const Base& X, const Base& Y, const uword N) { arma_debug_sigprint(); const bool status = glue_polyfit::apply_direct(out, X.get_ref(), Y.get_ref(), N); if(status == false) { out.soft_reset(); arma_warn(3, "polyfit(): failed"); } return status; } template arma_warn_unused inline typename enable_if2 < is_supported_blas_type::value, const Glue >::result polyfit(const Base& X, const Base& Y, const uword N) { arma_debug_sigprint(); return Glue(X.get_ref(), Y.get_ref(), N); } //! @} RcppArmadillo/inst/include/armadillo_bits/Cube_meat.hpp0000644000176200001440000037526115030507611023001 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup Cube //! @{ template inline Cube::~Cube() { arma_debug_sigprint_this(this); delete_mat(); if( (mem_state == 0) && (n_alloc > 0) ) { arma_debug_print("Cube::destructor: releasing memory"); memory::release( access::rw(mem) ); } // try to expose buggy user code that accesses deleted objects access::rw(mem) = nullptr; arma_type_check(( is_supported_elem_type::value == false )); } template inline Cube::Cube() : n_rows(0) , n_cols(0) , n_elem_slice(0) , n_slices(0) , n_elem(0) , n_alloc(0) , mem_state(0) , mem() { arma_debug_sigprint_this(this); } //! construct the cube to have user specified dimensions template inline Cube::Cube(const uword in_n_rows, const uword in_n_cols, const uword in_n_slices) : n_rows(in_n_rows) , n_cols(in_n_cols) , n_elem_slice(in_n_rows*in_n_cols) , n_slices(in_n_slices) , n_elem(in_n_rows*in_n_cols*in_n_slices) , n_alloc() , mem_state(0) , mem() { arma_debug_sigprint_this(this); init_cold(); arma_debug_print("Cube::constructor: zeroing memory"); arrayops::fill_zeros(memptr(), n_elem); } template inline Cube::Cube(const SizeCube& s) : n_rows(s.n_rows) , n_cols(s.n_cols) , n_elem_slice(s.n_rows*s.n_cols) , n_slices(s.n_slices) , n_elem(s.n_rows*s.n_cols*s.n_slices) , n_alloc() , mem_state(0) , mem() { arma_debug_sigprint_this(this); init_cold(); arma_debug_print("Cube::constructor: zeroing memory"); arrayops::fill_zeros(memptr(), n_elem); } //! internal use only template template inline Cube::Cube(const uword in_n_rows, const uword in_n_cols, const uword in_n_slices, const arma_initmode_indicator&) : n_rows(in_n_rows) , n_cols(in_n_cols) , n_elem_slice(in_n_rows*in_n_cols) , n_slices(in_n_slices) , n_elem(in_n_rows*in_n_cols*in_n_slices) , n_alloc() , mem_state(0) , mem() { arma_debug_sigprint_this(this); init_cold(); if(do_zeros) { arma_debug_print("Cube::constructor: zeroing memory"); arrayops::fill_zeros(memptr(), n_elem); } else { arma_debug_print("Cube::constructor: not zeroing memory"); } } //! internal use only template template inline Cube::Cube(const SizeCube& s, const arma_initmode_indicator&) : n_rows(s.n_rows) , n_cols(s.n_cols) , n_elem_slice(s.n_rows*s.n_cols) , n_slices(s.n_slices) , n_elem(s.n_rows*s.n_cols*s.n_slices) , n_alloc() , mem_state(0) , mem() { arma_debug_sigprint_this(this); init_cold(); if(do_zeros) { arma_debug_print("Cube::constructor: zeroing memory"); arrayops::fill_zeros(memptr(), n_elem); } else { arma_debug_print("Cube::constructor: not zeroing memory"); } } //! construct the cube to have user specified dimensions and fill with specified pattern template template inline Cube::Cube(const uword in_n_rows, const uword in_n_cols, const uword in_n_slices, const fill::fill_class&) : n_rows(in_n_rows) , n_cols(in_n_cols) , n_elem_slice(in_n_rows*in_n_cols) , n_slices(in_n_slices) , n_elem(in_n_rows*in_n_cols*in_n_slices) , n_alloc() , mem_state(0) , mem() { arma_debug_sigprint_this(this); init_cold(); if(is_same_type::yes) { (*this).zeros(); } if(is_same_type::yes) { (*this).ones(); } if(is_same_type::yes) { (*this).randu(); } if(is_same_type::yes) { (*this).randn(); } arma_static_check( (is_same_type::yes), "Cube::Cube(): unsupported fill type" ); } template template inline Cube::Cube(const SizeCube& s, const fill::fill_class&) : n_rows(s.n_rows) , n_cols(s.n_cols) , n_elem_slice(s.n_rows*s.n_cols) , n_slices(s.n_slices) , n_elem(s.n_rows*s.n_cols*s.n_slices) , n_alloc() , mem_state(0) , mem() { arma_debug_sigprint_this(this); init_cold(); if(is_same_type::yes) { (*this).zeros(); } if(is_same_type::yes) { (*this).ones(); } if(is_same_type::yes) { (*this).randu(); } if(is_same_type::yes) { (*this).randn(); } arma_static_check( (is_same_type::yes), "Cube::Cube(): unsupported fill type" ); } //! construct the cube to have user specified dimensions and fill with specified value template inline Cube::Cube(const uword in_n_rows, const uword in_n_cols, const uword in_n_slices, const fill::scalar_holder f) : n_rows(in_n_rows) , n_cols(in_n_cols) , n_elem_slice(in_n_rows*in_n_cols) , n_slices(in_n_slices) , n_elem(in_n_rows*in_n_cols*in_n_slices) , n_alloc() , mem_state(0) , mem() { arma_debug_sigprint_this(this); init_cold(); (*this).fill(f.scalar); } template inline Cube::Cube(const SizeCube& s, const fill::scalar_holder f) : n_rows(s.n_rows) , n_cols(s.n_cols) , n_elem_slice(s.n_rows*s.n_cols) , n_slices(s.n_slices) , n_elem(s.n_rows*s.n_cols*s.n_slices) , n_alloc() , mem_state(0) , mem() { arma_debug_sigprint_this(this); init_cold(); (*this).fill(f.scalar); } template inline Cube::Cube(Cube&& in_cube) : n_rows(0) , n_cols(0) , n_elem_slice(0) , n_slices(0) , n_elem(0) , n_alloc(0) , mem_state(0) , mem() { arma_debug_sigprint(arma_str::format("this: %x; in_cube: %x") % this % &in_cube); (*this).steal_mem(in_cube, true); } template inline Cube& Cube::operator=(Cube&& in_cube) { arma_debug_sigprint(arma_str::format("this: %x; in_cube: %x") % this % &in_cube); (*this).steal_mem(in_cube, true); return *this; } template inline void Cube::init_cold() { arma_debug_sigprint( arma_str::format("n_rows: %u; n_cols: %u; n_slices: %u") % n_rows % n_cols % n_slices ); #if defined(ARMA_64BIT_WORD) const char* error_message = "Cube::init(): requested size is too large"; #else const char* error_message = "Cube::init(): requested size is too large; suggest to enable ARMA_64BIT_WORD"; #endif arma_conform_check ( ( ( (n_rows > 0x0FFF) || (n_cols > 0x0FFF) || (n_slices > 0xFF) ) ? ( (double(n_rows) * double(n_cols) * double(n_slices)) > double(ARMA_MAX_UWORD) ) : false ), error_message ); if(n_elem <= Cube_prealloc::mem_n_elem) { if(n_elem > 0) { arma_debug_print("Cube::init(): using local memory"); } access::rw(mem) = (n_elem == 0) ? nullptr : mem_local; access::rw(n_alloc) = 0; } else { arma_debug_print("Cube::init(): acquiring memory"); access::rw(mem) = memory::acquire(n_elem); access::rw(n_alloc) = n_elem; } create_mat(); } template inline void Cube::init_warm(const uword in_n_rows, const uword in_n_cols, const uword in_n_slices) { arma_debug_sigprint( arma_str::format("in_n_rows: %u; in_n_cols: %u; in_n_slices: %u") % in_n_rows % in_n_cols % in_n_slices ); if( (n_rows == in_n_rows) && (n_cols == in_n_cols) && (n_slices == in_n_slices) ) { return; } const uword t_mem_state = mem_state; bool err_state = false; char* err_msg = nullptr; const char* error_message_1 = "Cube::init(): size is fixed and hence cannot be changed"; arma_conform_set_error( err_state, err_msg, (t_mem_state == 3), error_message_1 ); #if defined(ARMA_64BIT_WORD) const char* error_message_2 = "Cube::init(): requested size is too large"; #else const char* error_message_2 = "Cube::init(): requested size is too large; suggest to enable ARMA_64BIT_WORD"; #endif arma_conform_set_error ( err_state, err_msg, ( ( (in_n_rows > 0x0FFF) || (in_n_cols > 0x0FFF) || (in_n_slices > 0xFF) ) ? ( (double(in_n_rows) * double(in_n_cols) * double(in_n_slices)) > double(ARMA_MAX_UWORD) ) : false ), error_message_2 ); arma_conform_check(err_state, err_msg); const uword old_n_elem = n_elem; const uword new_n_elem = in_n_rows * in_n_cols * in_n_slices; if(old_n_elem == new_n_elem) { arma_debug_print("Cube::init(): reusing memory"); delete_mat(); access::rw(n_rows) = in_n_rows; access::rw(n_cols) = in_n_cols; access::rw(n_elem_slice) = in_n_rows*in_n_cols; access::rw(n_slices) = in_n_slices; create_mat(); return; } arma_conform_check( (t_mem_state == 2), "Cube::init(): mismatch between size of auxiliary memory and requested size" ); delete_mat(); if(new_n_elem <= Cube_prealloc::mem_n_elem) { if(n_alloc > 0) { arma_debug_print("Cube::init(): releasing memory"); memory::release( access::rw(mem) ); } if(new_n_elem > 0) { arma_debug_print("Cube::init(): using local memory"); } access::rw(mem) = (new_n_elem == 0) ? nullptr : mem_local; access::rw(n_alloc) = 0; } else // condition: new_n_elem > Cube_prealloc::mem_n_elem { if(new_n_elem > n_alloc) { if(n_alloc > 0) { arma_debug_print("Cube::init(): releasing memory"); memory::release( access::rw(mem) ); // in case memory::acquire() throws an exception access::rw(mem) = nullptr; access::rw(n_rows) = 0; access::rw(n_cols) = 0; access::rw(n_elem_slice) = 0; access::rw(n_slices) = 0; access::rw(n_elem) = 0; access::rw(n_alloc) = 0; } arma_debug_print("Cube::init(): acquiring memory"); access::rw(mem) = memory::acquire(new_n_elem); access::rw(n_alloc) = new_n_elem; } else // condition: new_n_elem <= n_alloc { arma_debug_print("Cube::init(): reusing memory"); } } access::rw(n_rows) = in_n_rows; access::rw(n_cols) = in_n_cols; access::rw(n_elem_slice) = in_n_rows*in_n_cols; access::rw(n_slices) = in_n_slices; access::rw(n_elem) = new_n_elem; access::rw(mem_state) = 0; create_mat(); } //! for constructing a complex cube out of two non-complex cubes template template inline void Cube::init ( const BaseCube::pod_type,T1>& X, const BaseCube::pod_type,T2>& Y ) { arma_debug_sigprint(); typedef typename T1::elem_type T; arma_type_check(( is_cx::no )); //!< compile-time abort if eT is not std::complex arma_type_check(( is_cx< T>::yes )); //!< compile-time abort if T is std::complex arma_type_check(( is_same_type< std::complex, eT >::no )); //!< compile-time abort if types are not compatible const ProxyCube PX(X.get_ref()); const ProxyCube PY(Y.get_ref()); arma_conform_assert_same_size(PX, PY, "Cube()"); const uword local_n_rows = PX.get_n_rows(); const uword local_n_cols = PX.get_n_cols(); const uword local_n_slices = PX.get_n_slices(); init_warm(local_n_rows, local_n_cols, local_n_slices); eT* out_mem = (*this).memptr(); constexpr bool use_at = ( ProxyCube::use_at || ProxyCube::use_at ); if(use_at == false) { typedef typename ProxyCube::ea_type ea_type1; typedef typename ProxyCube::ea_type ea_type2; const uword N = n_elem; ea_type1 A = PX.get_ea(); ea_type2 B = PY.get_ea(); for(uword i=0; i(A[i], B[i]); } } else { for(uword uslice = 0; uslice < local_n_slices; ++uslice) for(uword ucol = 0; ucol < local_n_cols; ++ucol ) for(uword urow = 0; urow < local_n_rows; ++urow ) { *out_mem = std::complex( PX.at(urow,ucol,uslice), PY.at(urow,ucol,uslice) ); out_mem++; } } } template inline void Cube::delete_mat() { arma_debug_sigprint(); if((n_slices > 0) && (mat_ptrs != nullptr)) { for(uword s=0; s < n_slices; ++s) { raw_mat_ptr_type mat_ptr = raw_mat_ptr_type(mat_ptrs[s]); // explicit cast to indicate load from std::atomic*> if(mat_ptr != nullptr) { arma_debug_print( arma_str::format("Cube::delete_mat(): destroying matrix %u") % s ); delete mat_ptr; mat_ptrs[s] = nullptr; } } if( (mem_state <= 2) && (n_slices > Cube_prealloc::mat_ptrs_size) ) { arma_debug_print("Cube::delete_mat(): freeing mat_ptrs array"); delete [] mat_ptrs; mat_ptrs = nullptr; } } } template inline void Cube::create_mat() { arma_debug_sigprint(); if(n_slices == 0) { mat_ptrs = nullptr; return; } if(mem_state <= 2) { if(n_slices <= Cube_prealloc::mat_ptrs_size) { arma_debug_print("Cube::create_mat(): using local memory for mat_ptrs array"); mat_ptrs = mat_ptrs_local; } else { arma_debug_print("Cube::create_mat(): allocating mat_ptrs array"); mat_ptrs = new(std::nothrow) atomic_mat_ptr_type[n_slices]; arma_check_bad_alloc( (mat_ptrs == nullptr), "Cube::create_mat(): out of memory" ); } } for(uword s=0; s < n_slices; ++s) { mat_ptrs[s] = nullptr; } } template inline Mat* Cube::create_mat_ptr(const uword in_slice) const { arma_debug_sigprint(); arma_debug_print( arma_str::format("Cube::create_mat_ptr(): creating matrix %u") % in_slice ); const eT* mat_mem = (n_elem_slice > 0) ? slice_memptr(in_slice) : nullptr; Mat* mat_ptr = new(std::nothrow) Mat('j', mat_mem, n_rows, n_cols); return mat_ptr; } template inline Mat* Cube::get_mat_ptr(const uword in_slice) const { arma_debug_sigprint(); raw_mat_ptr_type mat_ptr = nullptr; #if defined(ARMA_USE_OPENMP) { #pragma omp atomic read mat_ptr = mat_ptrs[in_slice]; } #elif defined(ARMA_USE_STD_MUTEX) { mat_ptr = mat_ptrs[in_slice].load(); } #else { mat_ptr = mat_ptrs[in_slice]; } #endif if(mat_ptr == nullptr) { #if defined(ARMA_USE_OPENMP) { #pragma omp critical (arma_Cube_mat_ptrs) { #pragma omp atomic read mat_ptr = mat_ptrs[in_slice]; if(mat_ptr == nullptr) { mat_ptr = create_mat_ptr(in_slice); } #pragma omp atomic write mat_ptrs[in_slice] = mat_ptr; } } #elif defined(ARMA_USE_STD_MUTEX) { const std::lock_guard lock(mat_mutex); mat_ptr = mat_ptrs[in_slice].load(); if(mat_ptr == nullptr) { mat_ptr = create_mat_ptr(in_slice); } mat_ptrs[in_slice].store(mat_ptr); } #else { mat_ptr = create_mat_ptr(in_slice); mat_ptrs[in_slice] = mat_ptr; } #endif arma_check_bad_alloc( (mat_ptr == nullptr), "Cube::get_mat_ptr(): out of memory" ); } return mat_ptr; } //! Set the cube to be equal to the specified scalar. //! NOTE: the size of the cube will be 1x1x1 template inline Cube& Cube::operator=(const eT val) { arma_debug_sigprint(); init_warm(1,1,1); access::rw(mem[0]) = val; return *this; } //! In-place addition of a scalar to all elements of the cube template inline Cube& Cube::operator+=(const eT val) { arma_debug_sigprint(); arrayops::inplace_plus( memptr(), val, n_elem ); return *this; } //! In-place subtraction of a scalar from all elements of the cube template inline Cube& Cube::operator-=(const eT val) { arma_debug_sigprint(); arrayops::inplace_minus( memptr(), val, n_elem ); return *this; } //! In-place multiplication of all elements of the cube with a scalar template inline Cube& Cube::operator*=(const eT val) { arma_debug_sigprint(); arrayops::inplace_mul( memptr(), val, n_elem ); return *this; } //! In-place division of all elements of the cube with a scalar template inline Cube& Cube::operator/=(const eT val) { arma_debug_sigprint(); arrayops::inplace_div( memptr(), val, n_elem ); return *this; } //! construct a cube from a given cube template inline Cube::Cube(const Cube& x) : n_rows(x.n_rows) , n_cols(x.n_cols) , n_elem_slice(x.n_elem_slice) , n_slices(x.n_slices) , n_elem(x.n_elem) , n_alloc() , mem_state(0) , mem() { arma_debug_sigprint_this(this); arma_debug_sigprint(arma_str::format("this: %x; in_cube: %x") % this % &x); init_cold(); arrayops::copy( memptr(), x.mem, n_elem ); } //! construct a cube from a given cube template inline Cube& Cube::operator=(const Cube& x) { arma_debug_sigprint(arma_str::format("this: %x; in_cube: %x") % this % &x); if(this != &x) { init_warm(x.n_rows, x.n_cols, x.n_slices); arrayops::copy( memptr(), x.mem, n_elem ); } else { arma_debug_print("Cube::operator=(): copy omitted"); } return *this; } //! construct a cube from a given auxiliary array of eTs. //! if copy_aux_mem is true, new memory is allocated and the array is copied. //! if copy_aux_mem is false, the auxiliary array is used directly (without allocating memory and copying). template inline Cube::Cube(eT* aux_mem, const uword aux_n_rows, const uword aux_n_cols, const uword aux_n_slices, const bool copy_aux_mem, const bool strict, const bool prealloc_mat) : n_rows ( aux_n_rows ) , n_cols ( aux_n_cols ) , n_elem_slice( aux_n_rows*aux_n_cols ) , n_slices ( aux_n_slices ) , n_elem ( aux_n_rows*aux_n_cols*aux_n_slices ) , n_alloc ( 0 ) , mem_state ( copy_aux_mem ? 0 : (strict ? 2 : 1) ) , mem ( copy_aux_mem ? nullptr : aux_mem ) { arma_debug_sigprint_this(this); arma_ignore(prealloc_mat); // kept only for compatibility with old user code if(copy_aux_mem) { init_cold(); arrayops::copy( memptr(), aux_mem, n_elem ); } else { create_mat(); } } //! construct a cube from a given auxiliary read-only array of eTs. //! the array is copied. template inline Cube::Cube(const eT* aux_mem, const uword aux_n_rows, const uword aux_n_cols, const uword aux_n_slices) : n_rows(aux_n_rows) , n_cols(aux_n_cols) , n_elem_slice(aux_n_rows*aux_n_cols) , n_slices(aux_n_slices) , n_elem(aux_n_rows*aux_n_cols*aux_n_slices) , n_alloc() , mem_state(0) , mem() { arma_debug_sigprint_this(this); init_cold(); arrayops::copy( memptr(), aux_mem, n_elem ); } //! in-place cube addition template inline Cube& Cube::operator+=(const Cube& m) { arma_debug_sigprint(); arma_conform_assert_same_size(*this, m, "addition"); arrayops::inplace_plus( memptr(), m.memptr(), n_elem ); return *this; } //! in-place cube subtraction template inline Cube& Cube::operator-=(const Cube& m) { arma_debug_sigprint(); arma_conform_assert_same_size(*this, m, "subtraction"); arrayops::inplace_minus( memptr(), m.memptr(), n_elem ); return *this; } //! in-place element-wise cube multiplication template inline Cube& Cube::operator%=(const Cube& m) { arma_debug_sigprint(); arma_conform_assert_same_size(*this, m, "element-wise multiplication"); arrayops::inplace_mul( memptr(), m.memptr(), n_elem ); return *this; } //! in-place element-wise cube division template inline Cube& Cube::operator/=(const Cube& m) { arma_debug_sigprint(); arma_conform_assert_same_size(*this, m, "element-wise division"); arrayops::inplace_div( memptr(), m.memptr(), n_elem ); return *this; } //! for constructing a complex cube out of two non-complex cubes template template inline Cube::Cube ( const BaseCube::pod_type,T1>& A, const BaseCube::pod_type,T2>& B ) : n_rows(0) , n_cols(0) , n_elem_slice(0) , n_slices(0) , n_elem(0) , n_alloc(0) , mem_state(0) , mem() { arma_debug_sigprint_this(this); init(A,B); } //! construct a cube from a subview_cube instance (eg. construct a cube from a delayed subcube operation) template inline Cube::Cube(const subview_cube& X) : n_rows(X.n_rows) , n_cols(X.n_cols) , n_elem_slice(X.n_elem_slice) , n_slices(X.n_slices) , n_elem(X.n_elem) , n_alloc() , mem_state(0) , mem() { arma_debug_sigprint_this(this); init_cold(); subview_cube::extract(*this, X); } //! construct a cube from a subview_cube instance (eg. construct a cube from a delayed subcube operation) template inline Cube& Cube::operator=(const subview_cube& X) { arma_debug_sigprint(); const bool alias = (this == &(X.m)); if(alias == false) { init_warm(X.n_rows, X.n_cols, X.n_slices); subview_cube::extract(*this, X); } else { Cube tmp(X); steal_mem(tmp); } return *this; } //! in-place cube addition (using a subcube on the right-hand-side) template inline Cube& Cube::operator+=(const subview_cube& X) { arma_debug_sigprint(); subview_cube::plus_inplace(*this, X); return *this; } //! in-place cube subtraction (using a subcube on the right-hand-side) template inline Cube& Cube::operator-=(const subview_cube& X) { arma_debug_sigprint(); subview_cube::minus_inplace(*this, X); return *this; } //! in-place element-wise cube multiplication (using a subcube on the right-hand-side) template inline Cube& Cube::operator%=(const subview_cube& X) { arma_debug_sigprint(); subview_cube::schur_inplace(*this, X); return *this; } //! in-place element-wise cube division (using a subcube on the right-hand-side) template inline Cube& Cube::operator/=(const subview_cube& X) { arma_debug_sigprint(); subview_cube::div_inplace(*this, X); return *this; } template template inline Cube::Cube(const subview_cube_slices& X) : n_rows(0) , n_cols(0) , n_elem_slice(0) , n_slices(0) , n_elem(0) , n_alloc(0) , mem_state(0) , mem() { arma_debug_sigprint_this(this); subview_cube_slices::extract(*this, X); } template template inline Cube& Cube::operator=(const subview_cube_slices& X) { arma_debug_sigprint(); const bool alias = (this == &(X.m)); if(alias == false) { subview_cube_slices::extract(*this, X); } else { Cube tmp(X); steal_mem(tmp); } return *this; } template template inline Cube& Cube::operator+=(const subview_cube_slices& X) { arma_debug_sigprint(); subview_cube_slices::plus_inplace(*this, X); return *this; } template template inline Cube& Cube::operator-=(const subview_cube_slices& X) { arma_debug_sigprint(); subview_cube_slices::minus_inplace(*this, X); return *this; } template template inline Cube& Cube::operator%=(const subview_cube_slices& X) { arma_debug_sigprint(); subview_cube_slices::schur_inplace(*this, X); return *this; } template template inline Cube& Cube::operator/=(const subview_cube_slices& X) { arma_debug_sigprint(); subview_cube_slices::div_inplace(*this, X); return *this; } //! creation of subview_cube (subcube comprised of specified row) template arma_inline subview_cube Cube::row(const uword in_row) { arma_debug_sigprint(); arma_conform_check_bounds( (in_row >= n_rows), "Cube::row(): index out of bounds" ); return (*this).rows(in_row, in_row); } //! creation of subview_cube (subcube comprised of specified row) template arma_inline const subview_cube Cube::row(const uword in_row) const { arma_debug_sigprint(); arma_conform_check_bounds( (in_row >= n_rows), "Cube::row(): index out of bounds" ); return (*this).rows(in_row, in_row); } //! creation of subview_cube (subcube comprised of specified column) template arma_inline subview_cube Cube::col(const uword in_col) { arma_debug_sigprint(); arma_conform_check_bounds( (in_col >= n_cols), "Cube::col(): index out of bounds" ); return (*this).cols(in_col, in_col); } //! creation of subview_cube (subcube comprised of specified column) template arma_inline const subview_cube Cube::col(const uword in_col) const { arma_debug_sigprint(); arma_conform_check_bounds( (in_col >= n_cols), "Cube::col(): index out of bounds" ); return (*this).cols(in_col, in_col); } //! provide the reference to the matrix representing a single slice template inline Mat& Cube::slice(const uword in_slice) { arma_debug_sigprint(); arma_conform_check_bounds( (in_slice >= n_slices), "Cube::slice(): index out of bounds" ); return *(get_mat_ptr(in_slice)); } //! provide the reference to the matrix representing a single slice template inline const Mat& Cube::slice(const uword in_slice) const { arma_debug_sigprint(); arma_conform_check_bounds( (in_slice >= n_slices), "Cube::slice(): index out of bounds" ); return *(get_mat_ptr(in_slice)); } //! creation of subview_cube (subcube comprised of specified rows) template arma_inline subview_cube Cube::rows(const uword in_row1, const uword in_row2) { arma_debug_sigprint(); arma_conform_check_bounds ( (in_row1 > in_row2) || (in_row2 >= n_rows), "Cube::rows(): indices out of bounds or incorrectly used" ); const uword subcube_n_rows = in_row2 - in_row1 + 1; return subview_cube(*this, in_row1, 0, 0, subcube_n_rows, n_cols, n_slices); } //! creation of subview_cube (subcube comprised of specified rows) template arma_inline const subview_cube Cube::rows(const uword in_row1, const uword in_row2) const { arma_debug_sigprint(); arma_conform_check_bounds ( (in_row1 > in_row2) || (in_row2 >= n_rows), "Cube::rows(): indices out of bounds or incorrectly used" ); const uword subcube_n_rows = in_row2 - in_row1 + 1; return subview_cube(*this, in_row1, 0, 0, subcube_n_rows, n_cols, n_slices); } //! creation of subview_cube (subcube comprised of specified columns) template arma_inline subview_cube Cube::cols(const uword in_col1, const uword in_col2) { arma_debug_sigprint(); arma_conform_check_bounds ( (in_col1 > in_col2) || (in_col2 >= n_cols), "Cube::cols(): indices out of bounds or incorrectly used" ); const uword subcube_n_cols = in_col2 - in_col1 + 1; return subview_cube(*this, 0, in_col1, 0, n_rows, subcube_n_cols, n_slices); } //! creation of subview_cube (subcube comprised of specified columns) template arma_inline const subview_cube Cube::cols(const uword in_col1, const uword in_col2) const { arma_debug_sigprint(); arma_conform_check_bounds ( (in_col1 > in_col2) || (in_col2 >= n_cols), "Cube::cols(): indices out of bounds or incorrectly used" ); const uword subcube_n_cols = in_col2 - in_col1 + 1; return subview_cube(*this, 0, in_col1, 0, n_rows, subcube_n_cols, n_slices); } //! creation of subview_cube (subcube comprised of specified slices) template arma_inline subview_cube Cube::slices(const uword in_slice1, const uword in_slice2) { arma_debug_sigprint(); arma_conform_check_bounds ( (in_slice1 > in_slice2) || (in_slice2 >= n_slices), "Cube::slices(): indices out of bounds or incorrectly used" ); const uword subcube_n_slices = in_slice2 - in_slice1 + 1; return subview_cube(*this, 0, 0, in_slice1, n_rows, n_cols, subcube_n_slices); } //! creation of subview_cube (subcube comprised of specified slices) template arma_inline const subview_cube Cube::slices(const uword in_slice1, const uword in_slice2) const { arma_debug_sigprint(); arma_conform_check_bounds ( (in_slice1 > in_slice2) || (in_slice2 >= n_slices), "Cube::slices(): indices out of bounds or incorrectly used" ); const uword subcube_n_slices = in_slice2 - in_slice1 + 1; return subview_cube(*this, 0, 0, in_slice1, n_rows, n_cols, subcube_n_slices); } //! creation of subview_cube (generic subcube) template arma_inline subview_cube Cube::subcube(const uword in_row1, const uword in_col1, const uword in_slice1, const uword in_row2, const uword in_col2, const uword in_slice2) { arma_debug_sigprint(); arma_conform_check_bounds ( (in_row1 > in_row2) || (in_col1 > in_col2) || (in_slice1 > in_slice2) || (in_row2 >= n_rows) || (in_col2 >= n_cols) || (in_slice2 >= n_slices), "Cube::subcube(): indices out of bounds or incorrectly used" ); const uword subcube_n_rows = in_row2 - in_row1 + 1; const uword subcube_n_cols = in_col2 - in_col1 + 1; const uword subcube_n_slices = in_slice2 - in_slice1 + 1; return subview_cube(*this, in_row1, in_col1, in_slice1, subcube_n_rows, subcube_n_cols, subcube_n_slices); } //! creation of subview_cube (generic subcube) template arma_inline const subview_cube Cube::subcube(const uword in_row1, const uword in_col1, const uword in_slice1, const uword in_row2, const uword in_col2, const uword in_slice2) const { arma_debug_sigprint(); arma_conform_check_bounds ( (in_row1 > in_row2) || (in_col1 > in_col2) || (in_slice1 > in_slice2) || (in_row2 >= n_rows) || (in_col2 >= n_cols) || (in_slice2 >= n_slices), "Cube::subcube(): indices out of bounds or incorrectly used" ); const uword subcube_n_rows = in_row2 - in_row1 + 1; const uword subcube_n_cols = in_col2 - in_col1 + 1; const uword subcube_n_slices = in_slice2 - in_slice1 + 1; return subview_cube(*this, in_row1, in_col1, in_slice1, subcube_n_rows, subcube_n_cols, subcube_n_slices); } //! creation of subview_cube (generic subcube) template inline subview_cube Cube::subcube(const uword in_row1, const uword in_col1, const uword in_slice1, const SizeCube& s) { arma_debug_sigprint(); const uword l_n_rows = n_rows; const uword l_n_cols = n_cols; const uword l_n_slices = n_slices; const uword s_n_rows = s.n_rows; const uword s_n_cols = s.n_cols; const uword s_n_slices = s.n_slices; arma_conform_check_bounds ( ( in_row1 >= l_n_rows) || ( in_col1 >= l_n_cols) || ( in_slice1 >= l_n_slices) || ((in_row1 + s_n_rows) > l_n_rows) || ((in_col1 + s_n_cols) > l_n_cols) || ((in_slice1 + s_n_slices) > l_n_slices), "Cube::subcube(): indices or size out of bounds" ); return subview_cube(*this, in_row1, in_col1, in_slice1, s_n_rows, s_n_cols, s_n_slices); } //! creation of subview_cube (generic subcube) template inline const subview_cube Cube::subcube(const uword in_row1, const uword in_col1, const uword in_slice1, const SizeCube& s) const { arma_debug_sigprint(); const uword l_n_rows = n_rows; const uword l_n_cols = n_cols; const uword l_n_slices = n_slices; const uword s_n_rows = s.n_rows; const uword s_n_cols = s.n_cols; const uword s_n_slices = s.n_slices; arma_conform_check_bounds ( ( in_row1 >= l_n_rows) || ( in_col1 >= l_n_cols) || ( in_slice1 >= l_n_slices) || ((in_row1 + s_n_rows) > l_n_rows) || ((in_col1 + s_n_cols) > l_n_cols) || ((in_slice1 + s_n_slices) > l_n_slices), "Cube::subcube(): indices or size out of bounds" ); return subview_cube(*this, in_row1, in_col1, in_slice1, s_n_rows, s_n_cols, s_n_slices); } //! creation of subview_cube (generic subcube) template inline subview_cube Cube::subcube(const span& row_span, const span& col_span, const span& slice_span) { arma_debug_sigprint(); const bool row_all = row_span.whole; const bool col_all = col_span.whole; const bool slice_all = slice_span.whole; const uword local_n_rows = n_rows; const uword local_n_cols = n_cols; const uword local_n_slices = n_slices; const uword in_row1 = row_all ? 0 : row_span.a; const uword in_row2 = row_span.b; const uword subcube_n_rows = row_all ? local_n_rows : in_row2 - in_row1 + 1; const uword in_col1 = col_all ? 0 : col_span.a; const uword in_col2 = col_span.b; const uword subcube_n_cols = col_all ? local_n_cols : in_col2 - in_col1 + 1; const uword in_slice1 = slice_all ? 0 : slice_span.a; const uword in_slice2 = slice_span.b; const uword subcube_n_slices = slice_all ? local_n_slices : in_slice2 - in_slice1 + 1; arma_conform_check_bounds ( ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows)) ) || ( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= local_n_cols)) ) || ( slice_all ? false : ((in_slice1 > in_slice2) || (in_slice2 >= local_n_slices)) ) , "Cube::subcube(): indices out of bounds or incorrectly used" ); return subview_cube(*this, in_row1, in_col1, in_slice1, subcube_n_rows, subcube_n_cols, subcube_n_slices); } //! creation of subview_cube (generic subcube) template inline const subview_cube Cube::subcube(const span& row_span, const span& col_span, const span& slice_span) const { arma_debug_sigprint(); const bool row_all = row_span.whole; const bool col_all = col_span.whole; const bool slice_all = slice_span.whole; const uword local_n_rows = n_rows; const uword local_n_cols = n_cols; const uword local_n_slices = n_slices; const uword in_row1 = row_all ? 0 : row_span.a; const uword in_row2 = row_span.b; const uword subcube_n_rows = row_all ? local_n_rows : in_row2 - in_row1 + 1; const uword in_col1 = col_all ? 0 : col_span.a; const uword in_col2 = col_span.b; const uword subcube_n_cols = col_all ? local_n_cols : in_col2 - in_col1 + 1; const uword in_slice1 = slice_all ? 0 : slice_span.a; const uword in_slice2 = slice_span.b; const uword subcube_n_slices = slice_all ? local_n_slices : in_slice2 - in_slice1 + 1; arma_conform_check_bounds ( ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows)) ) || ( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= local_n_cols)) ) || ( slice_all ? false : ((in_slice1 > in_slice2) || (in_slice2 >= local_n_slices)) ) , "Cube::subcube(): indices out of bounds or incorrectly used" ); return subview_cube(*this, in_row1, in_col1, in_slice1, subcube_n_rows, subcube_n_cols, subcube_n_slices); } template inline subview_cube Cube::operator()(const span& row_span, const span& col_span, const span& slice_span) { arma_debug_sigprint(); return (*this).subcube(row_span, col_span, slice_span); } template inline const subview_cube Cube::operator()(const span& row_span, const span& col_span, const span& slice_span) const { arma_debug_sigprint(); return (*this).subcube(row_span, col_span, slice_span); } template inline subview_cube Cube::operator()(const uword in_row1, const uword in_col1, const uword in_slice1, const SizeCube& s) { arma_debug_sigprint(); return (*this).subcube(in_row1, in_col1, in_slice1, s); } template inline const subview_cube Cube::operator()(const uword in_row1, const uword in_col1, const uword in_slice1, const SizeCube& s) const { arma_debug_sigprint(); return (*this).subcube(in_row1, in_col1, in_slice1, s); } template arma_inline subview_cube Cube::tube(const uword in_row1, const uword in_col1) { arma_debug_sigprint(); arma_conform_check_bounds ( ((in_row1 >= n_rows) || (in_col1 >= n_cols)), "Cube::tube(): indices out of bounds" ); return subview_cube(*this, in_row1, in_col1, 0, 1, 1, n_slices); } template arma_inline const subview_cube Cube::tube(const uword in_row1, const uword in_col1) const { arma_debug_sigprint(); arma_conform_check_bounds ( ((in_row1 >= n_rows) || (in_col1 >= n_cols)), "Cube::tube(): indices out of bounds" ); return subview_cube(*this, in_row1, in_col1, 0, 1, 1, n_slices); } template arma_inline subview_cube Cube::tube(const uword in_row1, const uword in_col1, const uword in_row2, const uword in_col2) { arma_debug_sigprint(); arma_conform_check_bounds ( (in_row1 > in_row2) || (in_col1 > in_col2) || (in_row2 >= n_rows) || (in_col2 >= n_cols), "Cube::tube(): indices out of bounds or incorrectly used" ); const uword subcube_n_rows = in_row2 - in_row1 + 1; const uword subcube_n_cols = in_col2 - in_col1 + 1; return subview_cube(*this, in_row1, in_col1, 0, subcube_n_rows, subcube_n_cols, n_slices); } template arma_inline const subview_cube Cube::tube(const uword in_row1, const uword in_col1, const uword in_row2, const uword in_col2) const { arma_debug_sigprint(); arma_conform_check_bounds ( (in_row1 > in_row2) || (in_col1 > in_col2) || (in_row2 >= n_rows) || (in_col2 >= n_cols), "Cube::tube(): indices out of bounds or incorrectly used" ); const uword subcube_n_rows = in_row2 - in_row1 + 1; const uword subcube_n_cols = in_col2 - in_col1 + 1; return subview_cube(*this, in_row1, in_col1, 0, subcube_n_rows, subcube_n_cols, n_slices); } template arma_inline subview_cube Cube::tube(const uword in_row1, const uword in_col1, const SizeMat& s) { arma_debug_sigprint(); const uword l_n_rows = n_rows; const uword l_n_cols = n_cols; const uword s_n_rows = s.n_rows; const uword s_n_cols = s.n_cols; arma_conform_check_bounds ( ((in_row1 >= l_n_rows) || (in_col1 >= l_n_cols) || ((in_row1 + s_n_rows) > l_n_rows) || ((in_col1 + s_n_cols) > l_n_cols)), "Cube::tube(): indices or size out of bounds" ); return subview_cube(*this, in_row1, in_col1, 0, s_n_rows, s_n_cols, n_slices); } template arma_inline const subview_cube Cube::tube(const uword in_row1, const uword in_col1, const SizeMat& s) const { arma_debug_sigprint(); const uword l_n_rows = n_rows; const uword l_n_cols = n_cols; const uword s_n_rows = s.n_rows; const uword s_n_cols = s.n_cols; arma_conform_check_bounds ( ((in_row1 >= l_n_rows) || (in_col1 >= l_n_cols) || ((in_row1 + s_n_rows) > l_n_rows) || ((in_col1 + s_n_cols) > l_n_cols)), "Cube::tube(): indices or size out of bounds" ); return subview_cube(*this, in_row1, in_col1, 0, s_n_rows, s_n_cols, n_slices); } template inline subview_cube Cube::tube(const span& row_span, const span& col_span) { arma_debug_sigprint(); const bool row_all = row_span.whole; const bool col_all = col_span.whole; const uword local_n_rows = n_rows; const uword local_n_cols = n_cols; const uword in_row1 = row_all ? 0 : row_span.a; const uword in_row2 = row_span.b; const uword subcube_n_rows = row_all ? local_n_rows : in_row2 - in_row1 + 1; const uword in_col1 = col_all ? 0 : col_span.a; const uword in_col2 = col_span.b; const uword subcube_n_cols = col_all ? local_n_cols : in_col2 - in_col1 + 1; arma_conform_check_bounds ( ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows)) ) || ( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= local_n_cols)) ) , "Cube::tube(): indices out of bounds or incorrectly used" ); return subview_cube(*this, in_row1, in_col1, 0, subcube_n_rows, subcube_n_cols, n_slices); } template inline const subview_cube Cube::tube(const span& row_span, const span& col_span) const { arma_debug_sigprint(); const bool row_all = row_span.whole; const bool col_all = col_span.whole; const uword local_n_rows = n_rows; const uword local_n_cols = n_cols; const uword in_row1 = row_all ? 0 : row_span.a; const uword in_row2 = row_span.b; const uword subcube_n_rows = row_all ? local_n_rows : in_row2 - in_row1 + 1; const uword in_col1 = col_all ? 0 : col_span.a; const uword in_col2 = col_span.b; const uword subcube_n_cols = col_all ? local_n_cols : in_col2 - in_col1 + 1; arma_conform_check_bounds ( ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows)) ) || ( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= local_n_cols)) ) , "Cube::tube(): indices out of bounds or incorrectly used" ); return subview_cube(*this, in_row1, in_col1, 0, subcube_n_rows, subcube_n_cols, n_slices); } template inline subview_cube Cube::head_slices(const uword N) { arma_debug_sigprint(); arma_conform_check_bounds( (N > n_slices), "Cube::head_slices(): size out of bounds" ); return subview_cube(*this, 0, 0, 0, n_rows, n_cols, N); } template inline const subview_cube Cube::head_slices(const uword N) const { arma_debug_sigprint(); arma_conform_check_bounds( (N > n_slices), "Cube::head_slices(): size out of bounds" ); return subview_cube(*this, 0, 0, 0, n_rows, n_cols, N); } template inline subview_cube Cube::tail_slices(const uword N) { arma_debug_sigprint(); arma_conform_check_bounds( (N > n_slices), "Cube::tail_slices(): size out of bounds" ); const uword start_slice = n_slices - N; return subview_cube(*this, 0, 0, start_slice, n_rows, n_cols, N); } template inline const subview_cube Cube::tail_slices(const uword N) const { arma_debug_sigprint(); arma_conform_check_bounds( (N > n_slices), "Cube::tail_slices(): size out of bounds" ); const uword start_slice = n_slices - N; return subview_cube(*this, 0, 0, start_slice, n_rows, n_cols, N); } template template arma_inline subview_elem1 Cube::elem(const Base& a) { arma_debug_sigprint(); return subview_elem1(*this, a); } template template arma_inline const subview_elem1 Cube::elem(const Base& a) const { arma_debug_sigprint(); return subview_elem1(*this, a); } template template arma_inline subview_elem1 Cube::operator()(const Base& a) { arma_debug_sigprint(); return subview_elem1(*this, a); } template template arma_inline const subview_elem1 Cube::operator()(const Base& a) const { arma_debug_sigprint(); return subview_elem1(*this, a); } template arma_inline subview_cube_each1 Cube::each_slice() { arma_debug_sigprint(); return subview_cube_each1(*this); } template arma_inline const subview_cube_each1 Cube::each_slice() const { arma_debug_sigprint(); return subview_cube_each1(*this); } template template inline subview_cube_each2 Cube::each_slice(const Base& indices) { arma_debug_sigprint(); return subview_cube_each2(*this, indices); } template template inline const subview_cube_each2 Cube::each_slice(const Base& indices) const { arma_debug_sigprint(); return subview_cube_each2(*this, indices); } //! apply a lambda function to each slice, where each slice is interpreted as a matrix template inline Cube& Cube::each_slice(const std::function< void(Mat&) >& F) { arma_debug_sigprint(); for(uword slice_id=0; slice_id < n_slices; ++slice_id) { Mat tmp('j', slice_memptr(slice_id), n_rows, n_cols); F(tmp); } return *this; } template inline const Cube& Cube::each_slice(const std::function< void(const Mat&) >& F) const { arma_debug_sigprint(); for(uword slice_id=0; slice_id < n_slices; ++slice_id) { const Mat tmp('j', slice_memptr(slice_id), n_rows, n_cols); F(tmp); } return *this; } template inline Cube& Cube::each_slice(const std::function< void(Mat&) >& F, const bool use_mp) { arma_debug_sigprint(); if((use_mp == false) || (arma_config::openmp == false)) { return (*this).each_slice(F); } #if defined(ARMA_USE_OPENMP) { const uword local_n_slices = n_slices; const int n_threads = mp_thread_limit::get(); #pragma omp parallel for schedule(static) num_threads(n_threads) for(uword slice_id=0; slice_id < local_n_slices; ++slice_id) { Mat tmp('j', slice_memptr(slice_id), n_rows, n_cols); F(tmp); } } #endif return *this; } template inline const Cube& Cube::each_slice(const std::function< void(const Mat&) >& F, const bool use_mp) const { arma_debug_sigprint(); if((use_mp == false) || (arma_config::openmp == false)) { return (*this).each_slice(F); } #if defined(ARMA_USE_OPENMP) { const uword local_n_slices = n_slices; const int n_threads = mp_thread_limit::get(); #pragma omp parallel for schedule(static) num_threads(n_threads) for(uword slice_id=0; slice_id < local_n_slices; ++slice_id) { Mat tmp('j', slice_memptr(slice_id), n_rows, n_cols); F(tmp); } } #endif return *this; } template template inline subview_cube_slices Cube::slices(const Base& indices) { arma_debug_sigprint(); return subview_cube_slices(*this, indices); } template template inline const subview_cube_slices Cube::slices(const Base& indices) const { arma_debug_sigprint(); return subview_cube_slices(*this, indices); } //! remove specified row template inline void Cube::shed_row(const uword row_num) { arma_debug_sigprint(); arma_conform_check_bounds( row_num >= n_rows, "Cube::shed_row(): index out of bounds" ); shed_rows(row_num, row_num); } //! remove specified column template inline void Cube::shed_col(const uword col_num) { arma_debug_sigprint(); arma_conform_check_bounds( col_num >= n_cols, "Cube::shed_col(): index out of bounds" ); shed_cols(col_num, col_num); } //! remove specified slice template inline void Cube::shed_slice(const uword slice_num) { arma_debug_sigprint(); arma_conform_check_bounds( slice_num >= n_slices, "Cube::shed_slice(): index out of bounds" ); shed_slices(slice_num, slice_num); } //! remove specified rows template inline void Cube::shed_rows(const uword in_row1, const uword in_row2) { arma_debug_sigprint(); arma_conform_check_bounds ( (in_row1 > in_row2) || (in_row2 >= n_rows), "Cube::shed_rows(): indices out of bounds or incorrectly used" ); const uword n_keep_front = in_row1; const uword n_keep_back = n_rows - (in_row2 + 1); Cube X(n_keep_front + n_keep_back, n_cols, n_slices, arma_nozeros_indicator()); if(n_keep_front > 0) { X.rows( 0, (n_keep_front-1) ) = rows( 0, (in_row1-1) ); } if(n_keep_back > 0) { X.rows( n_keep_front, (n_keep_front+n_keep_back-1) ) = rows( (in_row2+1), (n_rows-1) ); } steal_mem(X); } //! remove specified columns template inline void Cube::shed_cols(const uword in_col1, const uword in_col2) { arma_debug_sigprint(); arma_conform_check_bounds ( (in_col1 > in_col2) || (in_col2 >= n_cols), "Cube::shed_cols(): indices out of bounds or incorrectly used" ); const uword n_keep_front = in_col1; const uword n_keep_back = n_cols - (in_col2 + 1); Cube X(n_rows, n_keep_front + n_keep_back, n_slices, arma_nozeros_indicator()); if(n_keep_front > 0) { X.cols( 0, (n_keep_front-1) ) = cols( 0, (in_col1-1) ); } if(n_keep_back > 0) { X.cols( n_keep_front, (n_keep_front+n_keep_back-1) ) = cols( (in_col2+1), (n_cols-1) ); } steal_mem(X); } //! remove specified slices template inline void Cube::shed_slices(const uword in_slice1, const uword in_slice2) { arma_debug_sigprint(); arma_conform_check_bounds ( (in_slice1 > in_slice2) || (in_slice2 >= n_slices), "Cube::shed_slices(): indices out of bounds or incorrectly used" ); const uword n_keep_front = in_slice1; const uword n_keep_back = n_slices - (in_slice2 + 1); Cube X(n_rows, n_cols, n_keep_front + n_keep_back, arma_nozeros_indicator()); if(n_keep_front > 0) { X.slices( 0, (n_keep_front-1) ) = slices( 0, (in_slice1-1) ); } if(n_keep_back > 0) { X.slices( n_keep_front, (n_keep_front+n_keep_back-1) ) = slices( (in_slice2+1), (n_slices-1) ); } steal_mem(X); } //! remove specified slices template template inline void Cube::shed_slices(const Base& indices) { arma_debug_sigprint(); const quasi_unwrap U(indices.get_ref()); const Mat& tmp1 = U.M; arma_conform_check( ((tmp1.is_vec() == false) && (tmp1.is_empty() == false)), "Cube::shed_slices(): list of indices must be a vector" ); if(tmp1.is_empty()) { return; } const Col tmp2(const_cast(tmp1.memptr()), tmp1.n_elem, false, false); const Col& slices_to_shed = (tmp2.is_sorted("strictascend") == false) ? Col(unique(tmp2)) : Col(const_cast(tmp2.memptr()), tmp2.n_elem, false, false); const uword* slices_to_shed_mem = slices_to_shed.memptr(); const uword N = slices_to_shed.n_elem; if(arma_config::check_conform) { for(uword i=0; i= n_slices), "Cube::shed_slices(): indices out of bounds" ); } } Col tmp3(n_slices, arma_nozeros_indicator()); uword* tmp3_mem = tmp3.memptr(); uword i = 0; uword count = 0; for(uword j=0; j < n_slices; ++j) { if(i < N) { if( j != slices_to_shed_mem[i] ) { tmp3_mem[count] = j; ++count; } else { ++i; } } else { tmp3_mem[count] = j; ++count; } } const Col slices_to_keep(tmp3.memptr(), count, false, false); Cube X = (*this).slices(slices_to_keep); steal_mem(X); } template inline void Cube::insert_rows(const uword row_num, const uword N, const bool set_to_zero) { arma_debug_sigprint(); arma_ignore(set_to_zero); (*this).insert_rows(row_num, N); } template inline void Cube::insert_rows(const uword row_num, const uword N) { arma_debug_sigprint(); const uword t_n_rows = n_rows; const uword A_n_rows = row_num; const uword B_n_rows = t_n_rows - row_num; // insertion at row_num == n_rows is in effect an append operation arma_conform_check_bounds( (row_num > t_n_rows), "Cube::insert_rows(): index out of bounds" ); if(N == 0) { return; } Cube out(t_n_rows + N, n_cols, n_slices, arma_nozeros_indicator()); if(A_n_rows > 0) { out.rows(0, A_n_rows-1) = rows(0, A_n_rows-1); } if(B_n_rows > 0) { out.rows(row_num + N, t_n_rows + N - 1) = rows(row_num, t_n_rows-1); } out.rows(row_num, row_num + N - 1).zeros(); steal_mem(out); } template inline void Cube::insert_cols(const uword col_num, const uword N, const bool set_to_zero) { arma_debug_sigprint(); arma_ignore(set_to_zero); (*this).insert_cols(col_num, N); } template inline void Cube::insert_cols(const uword col_num, const uword N) { arma_debug_sigprint(); const uword t_n_cols = n_cols; const uword A_n_cols = col_num; const uword B_n_cols = t_n_cols - col_num; // insertion at col_num == n_cols is in effect an append operation arma_conform_check_bounds( (col_num > t_n_cols), "Cube::insert_cols(): index out of bounds" ); if(N == 0) { return; } Cube out(n_rows, t_n_cols + N, n_slices, arma_nozeros_indicator()); if(A_n_cols > 0) { out.cols(0, A_n_cols-1) = cols(0, A_n_cols-1); } if(B_n_cols > 0) { out.cols(col_num + N, t_n_cols + N - 1) = cols(col_num, t_n_cols-1); } out.cols(col_num, col_num + N - 1).zeros(); steal_mem(out); } template inline void Cube::insert_slices(const uword slice_num, const uword N, const bool set_to_zero) { arma_debug_sigprint(); arma_ignore(set_to_zero); (*this).insert_slices(slice_num, N); } template inline void Cube::insert_slices(const uword slice_num, const uword N) { arma_debug_sigprint(); const uword t_n_slices = n_slices; const uword A_n_slices = slice_num; const uword B_n_slices = t_n_slices - slice_num; // insertion at slice_num == n_slices is in effect an append operation arma_conform_check_bounds( (slice_num > t_n_slices), "Cube::insert_slices(): index out of bounds" ); if(N == 0) { return; } Cube out(n_rows, n_cols, t_n_slices + N, arma_nozeros_indicator()); if(A_n_slices > 0) { out.slices(0, A_n_slices-1) = slices(0, A_n_slices-1); } if(B_n_slices > 0) { out.slices(slice_num + N, t_n_slices + N - 1) = slices(slice_num, t_n_slices-1); } //out.slices(slice_num, slice_num + N - 1).zeros(); for(uword i=slice_num; i < (slice_num + N); ++i) { arrayops::fill_zeros(out.slice_memptr(i), out.n_elem_slice); } steal_mem(out); } template template inline void Cube::insert_rows(const uword row_num, const BaseCube& X) { arma_debug_sigprint(); const unwrap_cube tmp(X.get_ref()); const Cube& C = tmp.M; const uword N = C.n_rows; const uword t_n_rows = n_rows; const uword A_n_rows = row_num; const uword B_n_rows = t_n_rows - row_num; // insertion at row_num == n_rows is in effect an append operation arma_conform_check_bounds( (row_num > t_n_rows), "Cube::insert_rows(): index out of bounds" ); arma_conform_check ( ( (C.n_cols != n_cols) || (C.n_slices != n_slices) ), "Cube::insert_rows(): given object has incompatible dimensions" ); if(N == 0) { return; } Cube out(t_n_rows + N, n_cols, n_slices, arma_nozeros_indicator()); if(A_n_rows > 0) { out.rows(0, A_n_rows-1) = rows(0, A_n_rows-1); } if(B_n_rows > 0) { out.rows(row_num + N, t_n_rows + N - 1) = rows(row_num, t_n_rows - 1); } out.rows(row_num, row_num + N - 1) = C; steal_mem(out); } template template inline void Cube::insert_cols(const uword col_num, const BaseCube& X) { arma_debug_sigprint(); const unwrap_cube tmp(X.get_ref()); const Cube& C = tmp.M; const uword N = C.n_cols; const uword t_n_cols = n_cols; const uword A_n_cols = col_num; const uword B_n_cols = t_n_cols - col_num; // insertion at col_num == n_cols is in effect an append operation arma_conform_check_bounds( (col_num > t_n_cols), "Cube::insert_cols(): index out of bounds" ); arma_conform_check ( ( (C.n_rows != n_rows) || (C.n_slices != n_slices) ), "Cube::insert_cols(): given object has incompatible dimensions" ); if(N == 0) { return; } Cube out(n_rows, t_n_cols + N, n_slices, arma_nozeros_indicator()); if(A_n_cols > 0) { out.cols(0, A_n_cols-1) = cols(0, A_n_cols-1); } if(B_n_cols > 0) { out.cols(col_num + N, t_n_cols + N - 1) = cols(col_num, t_n_cols - 1); } out.cols(col_num, col_num + N - 1) = C; steal_mem(out); } //! insert the given object at the specified slice position; //! the given object must have the same number of rows and columns as the cube template template inline void Cube::insert_slices(const uword slice_num, const BaseCube& X) { arma_debug_sigprint(); const unwrap_cube tmp(X.get_ref()); const Cube& C = tmp.M; const uword N = C.n_slices; const uword t_n_slices = n_slices; const uword A_n_slices = slice_num; const uword B_n_slices = t_n_slices - slice_num; // insertion at slice_num == n_slices is in effect an append operation arma_conform_check_bounds( (slice_num > t_n_slices), "Cube::insert_slices(): index out of bounds" ); arma_conform_check ( ( (C.n_rows != n_rows) || (C.n_cols != n_cols) ), "Cube::insert_slices(): given object has incompatible dimensions" ); if(N == 0) { return; } Cube out(n_rows, n_cols, t_n_slices + N, arma_nozeros_indicator()); if(A_n_slices > 0) { out.slices(0, A_n_slices-1) = slices(0, A_n_slices-1); } if(B_n_slices > 0) { out.slices(slice_num + N, t_n_slices + N - 1) = slices(slice_num, t_n_slices - 1); } out.slices(slice_num, slice_num + N - 1) = C; steal_mem(out); } template template inline void Cube::insert_slices(const uword slice_num, const Base& X) { arma_debug_sigprint(); const quasi_unwrap U(X.get_ref()); const Cube C(const_cast(U.M.memptr()), U.M.n_rows, U.M.n_cols, uword(1), false, true); (*this).insert_slices(slice_num, C); } //! create a cube from GenCube, ie. run the previously delayed element generation operations template template inline Cube::Cube(const GenCube& X) : n_rows(X.n_rows) , n_cols(X.n_cols) , n_elem_slice(X.n_rows*X.n_cols) , n_slices(X.n_slices) , n_elem(X.n_rows*X.n_cols*X.n_slices) , n_alloc() , mem_state(0) , mem() { arma_debug_sigprint_this(this); init_cold(); X.apply(*this); } template template inline Cube& Cube::operator=(const GenCube& X) { arma_debug_sigprint(); init_warm(X.n_rows, X.n_cols, X.n_slices); X.apply(*this); return *this; } template template inline Cube& Cube::operator+=(const GenCube& X) { arma_debug_sigprint(); X.apply_inplace_plus(*this); return *this; } template template inline Cube& Cube::operator-=(const GenCube& X) { arma_debug_sigprint(); X.apply_inplace_minus(*this); return *this; } template template inline Cube& Cube::operator%=(const GenCube& X) { arma_debug_sigprint(); X.apply_inplace_schur(*this); return *this; } template template inline Cube& Cube::operator/=(const GenCube& X) { arma_debug_sigprint(); X.apply_inplace_div(*this); return *this; } //! create a cube from OpCube, ie. run the previously delayed unary operations template template inline Cube::Cube(const OpCube& X) : n_rows(0) , n_cols(0) , n_elem_slice(0) , n_slices(0) , n_elem(0) , n_alloc(0) , mem_state(0) , mem() { arma_debug_sigprint_this(this); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); op_type::apply(*this, X); } //! create a cube from OpCube, ie. run the previously delayed unary operations template template inline Cube& Cube::operator=(const OpCube& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); op_type::apply(*this, X); return *this; } //! in-place cube addition, with the right-hand-side operand having delayed operations template template inline Cube& Cube::operator+=(const OpCube& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); const Cube m(X); return (*this).operator+=(m); } //! in-place cube subtraction, with the right-hand-side operand having delayed operations template template inline Cube& Cube::operator-=(const OpCube& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); const Cube m(X); return (*this).operator-=(m); } //! in-place cube element-wise multiplication, with the right-hand-side operand having delayed operations template template inline Cube& Cube::operator%=(const OpCube& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); const Cube m(X); return (*this).operator%=(m); } //! in-place cube element-wise division, with the right-hand-side operand having delayed operations template template inline Cube& Cube::operator/=(const OpCube& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); const Cube m(X); return (*this).operator/=(m); } //! create a cube from eOpCube, ie. run the previously delayed unary operations template template inline Cube::Cube(const eOpCube& X) : n_rows(X.get_n_rows()) , n_cols(X.get_n_cols()) , n_elem_slice(X.get_n_elem_slice()) , n_slices(X.get_n_slices()) , n_elem(X.get_n_elem()) , n_alloc() , mem_state(0) , mem() { arma_debug_sigprint_this(this); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); init_cold(); if(is_same_type::value) { constexpr bool eT_non_int = is_non_integral::value; if( X.aux == eT(2) ) { eop_square::apply(*this, reinterpret_cast< const eOpCube& >(X)); return; } if(eT_non_int && (X.aux == eT(0.5))) { eop_sqrt::apply(*this, reinterpret_cast< const eOpCube& >(X)); return; } } eop_type::apply(*this, X); } //! create a cube from eOpCube, ie. run the previously delayed unary operations template template inline Cube& Cube::operator=(const eOpCube& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); const bool bad_alias = ( X.P.has_subview && X.P.is_alias(*this) ); if(bad_alias) { Cube tmp(X); steal_mem(tmp); return *this; } init_warm(X.get_n_rows(), X.get_n_cols(), X.get_n_slices()); if(is_same_type::value) { constexpr bool eT_non_int = is_non_integral::value; if( X.aux == eT(2) ) { eop_square::apply(*this, reinterpret_cast< const eOpCube& >(X)); return *this; } if(eT_non_int && (X.aux == eT(0.5))) { eop_sqrt::apply(*this, reinterpret_cast< const eOpCube& >(X)); return *this; } } eop_type::apply(*this, X); return *this; } //! in-place cube addition, with the right-hand-side operand having delayed operations template template inline Cube& Cube::operator+=(const eOpCube& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); const bool bad_alias = ( X.P.has_subview && X.P.is_alias(*this) ); if(bad_alias) { const Cube tmp(X); return (*this).operator+=(tmp); } if(is_same_type::value) { constexpr bool eT_non_int = is_non_integral::value; if( X.aux == eT(2) ) { eop_square::apply_inplace_plus(*this, reinterpret_cast< const eOpCube& >(X)); return *this; } if(eT_non_int && (X.aux == eT(0.5))) { eop_sqrt::apply_inplace_plus(*this, reinterpret_cast< const eOpCube& >(X)); return *this; } } eop_type::apply_inplace_plus(*this, X); return *this; } //! in-place cube subtraction, with the right-hand-side operand having delayed operations template template inline Cube& Cube::operator-=(const eOpCube& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); const bool bad_alias = ( X.P.has_subview && X.P.is_alias(*this) ); if(bad_alias) { const Cube tmp(X); return (*this).operator-=(tmp); } if(is_same_type::value) { constexpr bool eT_non_int = is_non_integral::value; if( X.aux == eT(2) ) { eop_square::apply_inplace_minus(*this, reinterpret_cast< const eOpCube& >(X)); return *this; } if(eT_non_int && (X.aux == eT(0.5))) { eop_sqrt::apply_inplace_minus(*this, reinterpret_cast< const eOpCube& >(X)); return *this; } } eop_type::apply_inplace_minus(*this, X); return *this; } //! in-place cube element-wise multiplication, with the right-hand-side operand having delayed operations template template inline Cube& Cube::operator%=(const eOpCube& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); const bool bad_alias = ( X.P.has_subview && X.P.is_alias(*this) ); if(bad_alias) { const Cube tmp(X); return (*this).operator%=(tmp); } if(is_same_type::value) { constexpr bool eT_non_int = is_non_integral::value; if( X.aux == eT(2) ) { eop_square::apply_inplace_schur(*this, reinterpret_cast< const eOpCube& >(X)); return *this; } if(eT_non_int && (X.aux == eT(0.5))) { eop_sqrt::apply_inplace_schur(*this, reinterpret_cast< const eOpCube& >(X)); return *this; } } eop_type::apply_inplace_schur(*this, X); return *this; } //! in-place cube element-wise division, with the right-hand-side operand having delayed operations template template inline Cube& Cube::operator/=(const eOpCube& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); const bool bad_alias = ( X.P.has_subview && X.P.is_alias(*this) ); if(bad_alias) { const Cube tmp(X); return (*this).operator/=(tmp); } if(is_same_type::value) { constexpr bool eT_non_int = is_non_integral::value; if( X.aux == eT(2) ) { eop_square::apply_inplace_div(*this, reinterpret_cast< const eOpCube& >(X)); return *this; } if(eT_non_int && (X.aux == eT(0.5))) { eop_sqrt::apply_inplace_div(*this, reinterpret_cast< const eOpCube& >(X)); return *this; } } eop_type::apply_inplace_div(*this, X); return *this; } template template inline Cube::Cube(const mtOpCube& X) : n_rows(0) , n_cols(0) , n_elem_slice(0) , n_slices(0) , n_elem(0) , n_alloc(0) , mem_state(0) , mem() { arma_debug_sigprint_this(this); op_type::apply(*this, X); } template template inline Cube& Cube::operator=(const mtOpCube& X) { arma_debug_sigprint(); op_type::apply(*this, X); return *this; } template template inline Cube& Cube::operator+=(const mtOpCube& X) { arma_debug_sigprint(); const Cube m(X); return (*this).operator+=(m); } template template inline Cube& Cube::operator-=(const mtOpCube& X) { arma_debug_sigprint(); const Cube m(X); return (*this).operator-=(m); } template template inline Cube& Cube::operator%=(const mtOpCube& X) { arma_debug_sigprint(); const Cube m(X); return (*this).operator%=(m); } template template inline Cube& Cube::operator/=(const mtOpCube& X) { arma_debug_sigprint(); const Cube m(X); return (*this).operator/=(m); } //! create a cube from GlueCube, ie. run the previously delayed binary operations template template inline Cube::Cube(const GlueCube& X) : n_rows(0) , n_cols(0) , n_elem_slice(0) , n_slices(0) , n_elem(0) , n_alloc(0) , mem_state(0) , mem() { arma_debug_sigprint_this(this); this->operator=(X); } //! create a cube from GlueCube, ie. run the previously delayed binary operations template template inline Cube& Cube::operator=(const GlueCube& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); arma_type_check(( is_same_type< eT, typename T2::elem_type >::no )); glue_type::apply(*this, X); return *this; } //! in-place cube addition, with the right-hand-side operands having delayed operations template template inline Cube& Cube::operator+=(const GlueCube& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); arma_type_check(( is_same_type< eT, typename T2::elem_type >::no )); const Cube m(X); return (*this).operator+=(m); } //! in-place cube subtraction, with the right-hand-side operands having delayed operations template template inline Cube& Cube::operator-=(const GlueCube& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); arma_type_check(( is_same_type< eT, typename T2::elem_type >::no )); const Cube m(X); return (*this).operator-=(m); } //! in-place cube element-wise multiplication, with the right-hand-side operands having delayed operations template template inline Cube& Cube::operator%=(const GlueCube& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); arma_type_check(( is_same_type< eT, typename T2::elem_type >::no )); const Cube m(X); return (*this).operator%=(m); } //! in-place cube element-wise division, with the right-hand-side operands having delayed operations template template inline Cube& Cube::operator/=(const GlueCube& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); arma_type_check(( is_same_type< eT, typename T2::elem_type >::no )); const Cube m(X); return (*this).operator/=(m); } //! create a cube from eGlueCube, ie. run the previously delayed binary operations template template inline Cube::Cube(const eGlueCube& X) : n_rows(X.get_n_rows()) , n_cols(X.get_n_cols()) , n_elem_slice(X.get_n_elem_slice()) , n_slices(X.get_n_slices()) , n_elem(X.get_n_elem()) , n_alloc() , mem_state(0) , mem() { arma_debug_sigprint_this(this); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); arma_type_check(( is_same_type< eT, typename T2::elem_type >::no )); init_cold(); eglue_type::apply(*this, X); } //! create a cube from eGlueCube, ie. run the previously delayed binary operations template template inline Cube& Cube::operator=(const eGlueCube& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); arma_type_check(( is_same_type< eT, typename T2::elem_type >::no )); const bool bad_alias = ( (X.P1.has_subview && X.P1.is_alias(*this)) || (X.P2.has_subview && X.P2.is_alias(*this)) ); if(bad_alias) { Cube tmp(X); steal_mem(tmp); return *this; } init_warm(X.get_n_rows(), X.get_n_cols(), X.get_n_slices()); eglue_type::apply(*this, X); return *this; } //! in-place cube addition, with the right-hand-side operands having delayed operations template template inline Cube& Cube::operator+=(const eGlueCube& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); arma_type_check(( is_same_type< eT, typename T2::elem_type >::no )); const bool bad_alias = ( (X.P1.has_subview && X.P1.is_alias(*this)) || (X.P2.has_subview && X.P2.is_alias(*this)) ); if(bad_alias) { const Cube tmp(X); return (*this).operator+=(tmp); } eglue_type::apply_inplace_plus(*this, X); return *this; } //! in-place cube subtraction, with the right-hand-side operands having delayed operations template template inline Cube& Cube::operator-=(const eGlueCube& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); arma_type_check(( is_same_type< eT, typename T2::elem_type >::no )); const bool bad_alias = ( (X.P1.has_subview && X.P1.is_alias(*this)) || (X.P2.has_subview && X.P2.is_alias(*this)) ); if(bad_alias) { const Cube tmp(X); return (*this).operator-=(tmp); } eglue_type::apply_inplace_minus(*this, X); return *this; } //! in-place cube element-wise multiplication, with the right-hand-side operands having delayed operations template template inline Cube& Cube::operator%=(const eGlueCube& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); arma_type_check(( is_same_type< eT, typename T2::elem_type >::no )); const bool bad_alias = ( (X.P1.has_subview && X.P1.is_alias(*this)) || (X.P2.has_subview && X.P2.is_alias(*this)) ); if(bad_alias) { const Cube tmp(X); return (*this).operator%=(tmp); } eglue_type::apply_inplace_schur(*this, X); return *this; } //! in-place cube element-wise division, with the right-hand-side operands having delayed operations template template inline Cube& Cube::operator/=(const eGlueCube& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); arma_type_check(( is_same_type< eT, typename T2::elem_type >::no )); const bool bad_alias = ( (X.P1.has_subview && X.P1.is_alias(*this)) || (X.P2.has_subview && X.P2.is_alias(*this)) ); if(bad_alias) { const Cube tmp(X); return (*this).operator/=(tmp); } eglue_type::apply_inplace_div(*this, X); return *this; } template template inline Cube::Cube(const mtGlueCube& X) : n_rows(0) , n_cols(0) , n_elem_slice(0) , n_slices(0) , n_elem(0) , n_alloc(0) , mem_state(0) , mem() { arma_debug_sigprint_this(this); glue_type::apply(*this, X); } template template inline Cube& Cube::operator=(const mtGlueCube& X) { arma_debug_sigprint(); glue_type::apply(*this, X); return *this; } template template inline Cube& Cube::operator+=(const mtGlueCube& X) { arma_debug_sigprint(); const Cube m(X); return (*this).operator+=(m); } template template inline Cube& Cube::operator-=(const mtGlueCube& X) { arma_debug_sigprint(); const Cube m(X); return (*this).operator-=(m); } template template inline Cube& Cube::operator%=(const mtGlueCube& X) { arma_debug_sigprint(); const Cube m(X); return (*this).operator%=(m); } template template inline Cube& Cube::operator/=(const mtGlueCube& X) { arma_debug_sigprint(); const Cube m(X); return (*this).operator/=(m); } //! linear element accessor (treats the cube as a vector); no bounds check; assumes memory is aligned template arma_inline const eT& Cube::at_alt(const uword i) const { const eT* mem_aligned = mem; memory::mark_as_aligned(mem_aligned); return mem_aligned[i]; } //! linear element accessor (treats the cube as a vector); bounds checking not done when ARMA_DONT_CHECK_CONFORMANCE is defined template arma_inline eT& Cube::operator() (const uword i) { arma_conform_check_bounds( (i >= n_elem), "Cube::operator(): index out of bounds" ); return access::rw(mem[i]); } //! linear element accessor (treats the cube as a vector); bounds checking not done when ARMA_DONT_CHECK_CONFORMANCE is defined template arma_inline const eT& Cube::operator() (const uword i) const { arma_conform_check_bounds( (i >= n_elem), "Cube::operator(): index out of bounds" ); return mem[i]; } //! linear element accessor (treats the cube as a vector); no bounds check. template arma_inline eT& Cube::operator[] (const uword i) { return access::rw(mem[i]); } //! linear element accessor (treats the cube as a vector); no bounds check template arma_inline const eT& Cube::operator[] (const uword i) const { return mem[i]; } //! linear element accessor (treats the cube as a vector); no bounds check. template arma_inline eT& Cube::at(const uword i) { return access::rw(mem[i]); } //! linear element accessor (treats the cube as a vector); no bounds check template arma_inline const eT& Cube::at(const uword i) const { return mem[i]; } //! element accessor; bounds checking not done when ARMA_DONT_CHECK_CONFORMANCE is defined template arma_inline eT& Cube::operator() (const uword in_row, const uword in_col, const uword in_slice) { arma_conform_check_bounds ( (in_row >= n_rows) || (in_col >= n_cols) || (in_slice >= n_slices) , "Cube::operator(): index out of bounds" ); return access::rw(mem[in_slice*n_elem_slice + in_col*n_rows + in_row]); } //! element accessor; bounds checking not done when ARMA_DONT_CHECK_CONFORMANCE is defined template arma_inline const eT& Cube::operator() (const uword in_row, const uword in_col, const uword in_slice) const { arma_conform_check_bounds ( (in_row >= n_rows) || (in_col >= n_cols) || (in_slice >= n_slices) , "Cube::operator(): index out of bounds" ); return mem[in_slice*n_elem_slice + in_col*n_rows + in_row]; } #if defined(__cpp_multidimensional_subscript) //! element accessor; no bounds check template arma_inline eT& Cube::operator[] (const uword in_row, const uword in_col, const uword in_slice) { return access::rw( mem[in_slice*n_elem_slice + in_col*n_rows + in_row] ); } //! element accessor; no bounds check template arma_inline const eT& Cube::operator[] (const uword in_row, const uword in_col, const uword in_slice) const { return mem[in_slice*n_elem_slice + in_col*n_rows + in_row]; } #endif //! element accessor; no bounds check template arma_inline eT& Cube::at(const uword in_row, const uword in_col, const uword in_slice) { return access::rw( mem[in_slice*n_elem_slice + in_col*n_rows + in_row] ); } //! element accessor; no bounds check template arma_inline const eT& Cube::at(const uword in_row, const uword in_col, const uword in_slice) const { return mem[in_slice*n_elem_slice + in_col*n_rows + in_row]; } //! prefix ++ template arma_inline const Cube& Cube::operator++() { Cube_aux::prefix_pp(*this); return *this; } //! postfix ++ (must not return the object by reference) template arma_inline void Cube::operator++(int) { Cube_aux::postfix_pp(*this); } //! prefix -- template arma_inline const Cube& Cube::operator--() { Cube_aux::prefix_mm(*this); return *this; } //! postfix -- (must not return the object by reference) template arma_inline void Cube::operator--(int) { Cube_aux::postfix_mm(*this); } //! returns true if the cube has no elements template arma_inline bool Cube::is_empty() const { return (n_elem == 0); } template inline bool Cube::internal_is_finite() const { arma_debug_sigprint(); return arrayops::is_finite(memptr(), n_elem); } template inline bool Cube::internal_has_inf() const { arma_debug_sigprint(); return arrayops::has_inf(memptr(), n_elem); } template inline bool Cube::internal_has_nan() const { arma_debug_sigprint(); return arrayops::has_nan(memptr(), n_elem); } template inline bool Cube::internal_has_nonfinite() const { arma_debug_sigprint(); return (arrayops::is_finite(memptr(), n_elem) == false); } //! returns true if the given index is currently in range template arma_inline bool Cube::in_range(const uword i) const { return (i < n_elem); } //! returns true if the given start and end indices are currently in range template arma_inline bool Cube::in_range(const span& x) const { arma_debug_sigprint(); if(x.whole) { return true; } else { const uword a = x.a; const uword b = x.b; return ( (a <= b) && (b < n_elem) ); } } //! returns true if the given location is currently in range template arma_inline bool Cube::in_range(const uword in_row, const uword in_col, const uword in_slice) const { return ( (in_row < n_rows) && (in_col < n_cols) && (in_slice < n_slices) ); } template inline bool Cube::in_range(const span& row_span, const span& col_span, const span& slice_span) const { arma_debug_sigprint(); const uword in_row1 = row_span.a; const uword in_row2 = row_span.b; const uword in_col1 = col_span.a; const uword in_col2 = col_span.b; const uword in_slice1 = slice_span.a; const uword in_slice2 = slice_span.b; const bool rows_ok = row_span.whole ? true : ( (in_row1 <= in_row2) && (in_row2 < n_rows) ); const bool cols_ok = col_span.whole ? true : ( (in_col1 <= in_col2) && (in_col2 < n_cols) ); const bool slices_ok = slice_span.whole ? true : ( (in_slice1 <= in_slice2) && (in_slice2 < n_slices) ); return ( rows_ok && cols_ok && slices_ok ); } template inline bool Cube::in_range(const uword in_row, const uword in_col, const uword in_slice, const SizeCube& s) const { const uword l_n_rows = n_rows; const uword l_n_cols = n_cols; const uword l_n_slices = n_slices; if( ( in_row >= l_n_rows) || ( in_col >= l_n_cols) || ( in_slice >= l_n_slices) || ((in_row + s.n_rows) > l_n_rows) || ((in_col + s.n_cols) > l_n_cols) || ((in_slice + s.n_slices) > l_n_slices) ) { return false; } else { return true; } } //! returns a pointer to array of eTs used by the cube template arma_inline eT* Cube::memptr() { return const_cast(mem); } //! returns a pointer to array of eTs used by the cube template arma_inline const eT* Cube::memptr() const { return mem; } //! returns a pointer to array of eTs used by the specified slice in the cube template arma_inline eT* Cube::slice_memptr(const uword uslice) { return const_cast( &mem[ uslice*n_elem_slice ] ); } //! returns a pointer to array of eTs used by the specified slice in the cube template arma_inline const eT* Cube::slice_memptr(const uword uslice) const { return &mem[ uslice*n_elem_slice ]; } //! returns a pointer to array of eTs used by the specified slice in the cube template arma_inline eT* Cube::slice_colptr(const uword uslice, const uword col) { return const_cast( &mem[ uslice*n_elem_slice + col*n_rows] ); } //! returns a pointer to array of eTs used by the specified slice in the cube template arma_inline const eT* Cube::slice_colptr(const uword uslice, const uword col) const { return &mem[ uslice*n_elem_slice + col*n_rows ]; } //! change the cube to have user specified dimensions (data is not preserved) template inline Cube& Cube::set_size(const uword new_n_rows, const uword new_n_cols, const uword new_n_slices) { arma_debug_sigprint(); init_warm(new_n_rows, new_n_cols, new_n_slices); return *this; } //! change the cube to have user specified dimensions (data is preserved) template inline Cube& Cube::reshape(const uword new_n_rows, const uword new_n_cols, const uword new_n_slices) { arma_debug_sigprint(); op_reshape::apply_cube_inplace((*this), new_n_rows, new_n_cols, new_n_slices); return *this; } //! change the cube to have user specified dimensions (data is preserved) template inline Cube& Cube::resize(const uword new_n_rows, const uword new_n_cols, const uword new_n_slices) { arma_debug_sigprint(); op_resize::apply_cube_inplace((*this), new_n_rows, new_n_cols, new_n_slices); return *this; } template inline Cube& Cube::set_size(const SizeCube& s) { arma_debug_sigprint(); init_warm(s.n_rows, s.n_cols, s.n_slices); return *this; } template inline Cube& Cube::reshape(const SizeCube& s) { arma_debug_sigprint(); op_reshape::apply_cube_inplace((*this), s.n_rows, s.n_cols, s.n_slices); return *this; } template inline Cube& Cube::resize(const SizeCube& s) { arma_debug_sigprint(); op_resize::apply_cube_inplace((*this), s.n_rows, s.n_cols, s.n_slices); return *this; } //! change the cube (without preserving data) to have the same dimensions as the given cube template template inline Cube& Cube::copy_size(const Cube& m) { arma_debug_sigprint(); init_warm(m.n_rows, m.n_cols, m.n_slices); return *this; } //! apply a functor to each element template template inline Cube& Cube::for_each(functor F) { arma_debug_sigprint(); eT* data = memptr(); const uword N = n_elem; uword ii, jj; for(ii=0, jj=1; jj < N; ii+=2, jj+=2) { F(data[ii]); F(data[jj]); } if(ii < N) { F(data[ii]); } return *this; } template template inline const Cube& Cube::for_each(functor F) const { arma_debug_sigprint(); const eT* data = memptr(); const uword N = n_elem; uword ii, jj; for(ii=0, jj=1; jj < N; ii+=2, jj+=2) { F(data[ii]); F(data[jj]); } if(ii < N) { F(data[ii]); } return *this; } //! transform each element in the cube using a functor template template inline Cube& Cube::transform(functor F) { arma_debug_sigprint(); eT* out_mem = memptr(); const uword N = n_elem; uword ii, jj; for(ii=0, jj=1; jj < N; ii+=2, jj+=2) { eT tmp_ii = out_mem[ii]; eT tmp_jj = out_mem[jj]; tmp_ii = eT( F(tmp_ii) ); tmp_jj = eT( F(tmp_jj) ); out_mem[ii] = tmp_ii; out_mem[jj] = tmp_jj; } if(ii < N) { out_mem[ii] = eT( F(out_mem[ii]) ); } return *this; } //! imbue (fill) the cube with values provided by a functor template template inline Cube& Cube::imbue(functor F) { arma_debug_sigprint(); eT* out_mem = memptr(); const uword N = n_elem; uword ii, jj; for(ii=0, jj=1; jj < N; ii+=2, jj+=2) { const eT tmp_ii = eT( F() ); const eT tmp_jj = eT( F() ); out_mem[ii] = tmp_ii; out_mem[jj] = tmp_jj; } if(ii < N) { out_mem[ii] = eT( F() ); } return *this; } template inline Cube& Cube::replace(const eT old_val, const eT new_val) { arma_debug_sigprint(); arrayops::replace(memptr(), n_elem, old_val, new_val); return *this; } template inline Cube& Cube::clean(const typename get_pod_type::result threshold) { arma_debug_sigprint(); arrayops::clean(memptr(), n_elem, threshold); return *this; } template inline Cube& Cube::clamp(const eT min_val, const eT max_val) { arma_debug_sigprint(); if(is_cx::no) { arma_conform_check( (access::tmp_real(min_val) > access::tmp_real(max_val)), "Cube::clamp(): min_val must be less than max_val" ); } else { arma_conform_check( (access::tmp_real(min_val) > access::tmp_real(max_val)), "Cube::clamp(): real(min_val) must be less than real(max_val)" ); arma_conform_check( (access::tmp_imag(min_val) > access::tmp_imag(max_val)), "Cube::clamp(): imag(min_val) must be less than imag(max_val)" ); } arrayops::clamp(memptr(), n_elem, min_val, max_val); return *this; } //! fill the cube with the specified value template inline Cube& Cube::fill(const eT val) { arma_debug_sigprint(); arrayops::inplace_set( memptr(), val, n_elem ); return *this; } template inline Cube& Cube::zeros() { arma_debug_sigprint(); arrayops::fill_zeros(memptr(), n_elem); return *this; } template inline Cube& Cube::zeros(const uword new_n_rows, const uword new_n_cols, const uword new_n_slices) { arma_debug_sigprint(); set_size(new_n_rows, new_n_cols, new_n_slices); return (*this).zeros(); } template inline Cube& Cube::zeros(const SizeCube& s) { arma_debug_sigprint(); return (*this).zeros(s.n_rows, s.n_cols, s.n_slices); } template inline Cube& Cube::ones() { arma_debug_sigprint(); return (*this).fill(eT(1)); } template inline Cube& Cube::ones(const uword new_n_rows, const uword new_n_cols, const uword new_n_slices) { arma_debug_sigprint(); set_size(new_n_rows, new_n_cols, new_n_slices); return (*this).fill(eT(1)); } template inline Cube& Cube::ones(const SizeCube& s) { arma_debug_sigprint(); return (*this).ones(s.n_rows, s.n_cols, s.n_slices); } template inline Cube& Cube::randu() { arma_debug_sigprint(); arma_rng::randu::fill( memptr(), n_elem ); return *this; } template inline Cube& Cube::randu(const uword new_n_rows, const uword new_n_cols, const uword new_n_slices) { arma_debug_sigprint(); set_size(new_n_rows, new_n_cols, new_n_slices); return (*this).randu(); } template inline Cube& Cube::randu(const SizeCube& s) { arma_debug_sigprint(); return (*this).randu(s.n_rows, s.n_cols, s.n_slices); } template inline Cube& Cube::randn() { arma_debug_sigprint(); arma_rng::randn::fill( memptr(), n_elem ); return *this; } template inline Cube& Cube::randn(const uword new_n_rows, const uword new_n_cols, const uword new_n_slices) { arma_debug_sigprint(); set_size(new_n_rows, new_n_cols, new_n_slices); return (*this).randn(); } template inline Cube& Cube::randn(const SizeCube& s) { arma_debug_sigprint(); return (*this).randn(s.n_rows, s.n_cols, s.n_slices); } template inline void Cube::reset() { arma_debug_sigprint(); init_warm(0,0,0); } template inline void Cube::soft_reset() { arma_debug_sigprint(); // don't change the size if the cube has a fixed size if(mem_state <= 1) { reset(); } else { zeros(); } } template template inline void Cube::set_real(const BaseCube::pod_type,T1>& X) { arma_debug_sigprint(); Cube_aux::set_real(*this, X); } template template inline void Cube::set_imag(const BaseCube::pod_type,T1>& X) { arma_debug_sigprint(); Cube_aux::set_imag(*this, X); } template inline eT Cube::min() const { arma_debug_sigprint(); if(n_elem == 0) { arma_conform_check(true, "Cube::min(): object has no elements"); return Datum::nan; } return op_min::direct_min(memptr(), n_elem); } template inline eT Cube::max() const { arma_debug_sigprint(); if(n_elem == 0) { arma_conform_check(true, "Cube::max(): object has no elements"); return Datum::nan; } return op_max::direct_max(memptr(), n_elem); } template inline eT Cube::min(uword& index_of_min_val) const { arma_debug_sigprint(); if(n_elem == 0) { arma_conform_check(true, "Cube::min(): object has no elements"); index_of_min_val = uword(0); return Datum::nan; } return op_min::direct_min(memptr(), n_elem, index_of_min_val); } template inline eT Cube::max(uword& index_of_max_val) const { arma_debug_sigprint(); if(n_elem == 0) { arma_conform_check(true, "Cube::max(): object has no elements"); index_of_max_val = uword(0); return Datum::nan; } return op_max::direct_max(memptr(), n_elem, index_of_max_val); } template inline eT Cube::min(uword& row_of_min_val, uword& col_of_min_val, uword& slice_of_min_val) const { arma_debug_sigprint(); if(n_elem == 0) { arma_conform_check(true, "Cube::min(): object has no elements"); row_of_min_val = uword(0); col_of_min_val = uword(0); slice_of_min_val = uword(0); return Datum::nan; } uword i; eT val = op_min::direct_min(memptr(), n_elem, i); const uword in_slice = i / n_elem_slice; const uword offset = in_slice * n_elem_slice; const uword j = i - offset; row_of_min_val = j % n_rows; col_of_min_val = j / n_rows; slice_of_min_val = in_slice; return val; } template inline eT Cube::max(uword& row_of_max_val, uword& col_of_max_val, uword& slice_of_max_val) const { arma_debug_sigprint(); if(n_elem == 0) { arma_conform_check(true, "Cube::max(): object has no elements"); row_of_max_val = uword(0); col_of_max_val = uword(0); slice_of_max_val = uword(0); return Datum::nan; } uword i; eT val = op_max::direct_max(memptr(), n_elem, i); const uword in_slice = i / n_elem_slice; const uword offset = in_slice * n_elem_slice; const uword j = i - offset; row_of_max_val = j % n_rows; col_of_max_val = j / n_rows; slice_of_max_val = in_slice; return val; } //! save the cube to a file template inline bool Cube::save(const std::string name, const file_type type) const { arma_debug_sigprint(); bool save_okay = false; switch(type) { case raw_ascii: save_okay = diskio::save_raw_ascii(*this, name); break; case arma_ascii: save_okay = diskio::save_arma_ascii(*this, name); break; case raw_binary: save_okay = diskio::save_raw_binary(*this, name); break; case arma_binary: save_okay = diskio::save_arma_binary(*this, name); break; case ppm_binary: save_okay = diskio::save_ppm_binary(*this, name); break; case hdf5_binary: return (*this).save(hdf5_name(name)); break; case hdf5_binary_trans: // kept for compatibility with earlier versions of Armadillo return (*this).save(hdf5_name(name, std::string(), hdf5_opts::trans)); break; default: arma_warn(1, "Cube::save(): unsupported file type"); save_okay = false; } if(save_okay == false) { arma_warn(3, "Cube::save(): write failed; file: ", name); } return save_okay; } template inline bool Cube::save(const hdf5_name& spec, const file_type type) const { arma_debug_sigprint(); // handling of hdf5_binary_trans kept for compatibility with earlier versions of Armadillo if( (type != hdf5_binary) && (type != hdf5_binary_trans) ) { arma_stop_runtime_error("Cube::save(): unsupported file type for hdf5_name()"); return false; } const bool do_trans = bool(spec.opts.flags & hdf5_opts::flag_trans ) || (type == hdf5_binary_trans); const bool append = bool(spec.opts.flags & hdf5_opts::flag_append ); const bool replace = bool(spec.opts.flags & hdf5_opts::flag_replace); if(append && replace) { arma_stop_runtime_error("Cube::save(): only one of 'append' or 'replace' options can be used"); return false; } bool save_okay = false; std::string err_msg; if(do_trans) { Cube tmp; op_strans_cube::apply_noalias(tmp, (*this)); save_okay = diskio::save_hdf5_binary(tmp, spec, err_msg); } else { save_okay = diskio::save_hdf5_binary(*this, spec, err_msg); } if(save_okay == false) { if(err_msg.length() > 0) { arma_warn(3, "Cube::save(): ", err_msg, "; file: ", spec.filename); } else { arma_warn(3, "Cube::save(): write failed; file: ", spec.filename); } } return save_okay; } //! save the cube to a stream template inline bool Cube::save(std::ostream& os, const file_type type) const { arma_debug_sigprint(); bool save_okay = false; switch(type) { case raw_ascii: save_okay = diskio::save_raw_ascii(*this, os); break; case arma_ascii: save_okay = diskio::save_arma_ascii(*this, os); break; case raw_binary: save_okay = diskio::save_raw_binary(*this, os); break; case arma_binary: save_okay = diskio::save_arma_binary(*this, os); break; case ppm_binary: save_okay = diskio::save_ppm_binary(*this, os); break; default: arma_warn(1, "Cube::save(): unsupported file type"); save_okay = false; } if(save_okay == false) { arma_warn(3, "Cube::save(): stream write failed"); } return save_okay; } //! load a cube from a file template inline bool Cube::load(const std::string name, const file_type type) { arma_debug_sigprint(); bool load_okay = false; std::string err_msg; switch(type) { case auto_detect: load_okay = diskio::load_auto_detect(*this, name, err_msg); break; case raw_ascii: load_okay = diskio::load_raw_ascii(*this, name, err_msg); break; case arma_ascii: load_okay = diskio::load_arma_ascii(*this, name, err_msg); break; case raw_binary: load_okay = diskio::load_raw_binary(*this, name, err_msg); break; case arma_binary: load_okay = diskio::load_arma_binary(*this, name, err_msg); break; case ppm_binary: load_okay = diskio::load_ppm_binary(*this, name, err_msg); break; case hdf5_binary: return (*this).load(hdf5_name(name)); break; case hdf5_binary_trans: // kept for compatibility with earlier versions of Armadillo return (*this).load(hdf5_name(name, std::string(), hdf5_opts::trans)); break; default: arma_warn(1, "Cube::load(): unsupported file type"); load_okay = false; } if(load_okay == false) { (*this).soft_reset(); if(err_msg.length() > 0) { arma_warn(3, "Cube::load(): ", err_msg, "; file: ", name); } else { arma_warn(3, "Cube::load(): read failed; file: ", name); } } return load_okay; } template inline bool Cube::load(const hdf5_name& spec, const file_type type) { arma_debug_sigprint(); if( (type != hdf5_binary) && (type != hdf5_binary_trans) ) { arma_stop_runtime_error("Cube::load(): unsupported file type for hdf5_name()"); return false; } bool load_okay = false; std::string err_msg; const bool do_trans = bool(spec.opts.flags & hdf5_opts::flag_trans) || (type == hdf5_binary_trans); if(do_trans) { Cube tmp; load_okay = diskio::load_hdf5_binary(tmp, spec, err_msg); if(load_okay) { op_strans_cube::apply_noalias((*this), tmp); } } else { load_okay = diskio::load_hdf5_binary(*this, spec, err_msg); } if(load_okay == false) { (*this).soft_reset(); if(err_msg.length() > 0) { arma_warn(3, "Cube::load(): ", err_msg, "; file: ", spec.filename); } else { arma_warn(3, "Cube::load(): read failed; file: ", spec.filename); } } return load_okay; } //! load a cube from a stream template inline bool Cube::load(std::istream& is, const file_type type) { arma_debug_sigprint(); bool load_okay = false; std::string err_msg; switch(type) { case auto_detect: load_okay = diskio::load_auto_detect(*this, is, err_msg); break; case raw_ascii: load_okay = diskio::load_raw_ascii(*this, is, err_msg); break; case arma_ascii: load_okay = diskio::load_arma_ascii(*this, is, err_msg); break; case raw_binary: load_okay = diskio::load_raw_binary(*this, is, err_msg); break; case arma_binary: load_okay = diskio::load_arma_binary(*this, is, err_msg); break; case ppm_binary: load_okay = diskio::load_ppm_binary(*this, is, err_msg); break; default: arma_warn(1, "Cube::load(): unsupported file type"); load_okay = false; } if(load_okay == false) { (*this).soft_reset(); if(err_msg.length() > 0) { arma_warn(3, "Cube::load(): ", err_msg); } else { arma_warn(3, "Cube::load(): stream read failed"); } } return load_okay; } template inline bool Cube::quiet_save(const std::string name, const file_type type) const { arma_debug_sigprint(); return (*this).save(name, type); } template inline bool Cube::quiet_save(const hdf5_name& spec, const file_type type) const { arma_debug_sigprint(); return (*this).save(spec, type); } template inline bool Cube::quiet_save(std::ostream& os, const file_type type) const { arma_debug_sigprint(); return (*this).save(os, type); } template inline bool Cube::quiet_load(const std::string name, const file_type type) { arma_debug_sigprint(); return (*this).load(name, type); } template inline bool Cube::quiet_load(const hdf5_name& spec, const file_type type) { arma_debug_sigprint(); return (*this).load(spec, type); } template inline bool Cube::quiet_load(std::istream& is, const file_type type) { arma_debug_sigprint(); return (*this).load(is, type); } template inline typename Cube::iterator Cube::begin() { arma_debug_sigprint(); return memptr(); } template inline typename Cube::const_iterator Cube::begin() const { arma_debug_sigprint(); return memptr(); } template inline typename Cube::const_iterator Cube::cbegin() const { arma_debug_sigprint(); return memptr(); } template inline typename Cube::iterator Cube::end() { arma_debug_sigprint(); return memptr() + n_elem; } template inline typename Cube::const_iterator Cube::end() const { arma_debug_sigprint(); return memptr() + n_elem; } template inline typename Cube::const_iterator Cube::cend() const { arma_debug_sigprint(); return memptr() + n_elem; } template inline typename Cube::slice_iterator Cube::begin_slice(const uword slice_num) { arma_debug_sigprint(); arma_conform_check_bounds( (slice_num >= n_slices), "begin_slice(): index out of bounds" ); return slice_memptr(slice_num); } template inline typename Cube::const_slice_iterator Cube::begin_slice(const uword slice_num) const { arma_debug_sigprint(); arma_conform_check_bounds( (slice_num >= n_slices), "begin_slice(): index out of bounds" ); return slice_memptr(slice_num); } template inline typename Cube::slice_iterator Cube::end_slice(const uword slice_num) { arma_debug_sigprint(); arma_conform_check_bounds( (slice_num >= n_slices), "end_slice(): index out of bounds" ); return slice_memptr(slice_num) + n_elem_slice; } template inline typename Cube::const_slice_iterator Cube::end_slice(const uword slice_num) const { arma_debug_sigprint(); arma_conform_check_bounds( (slice_num >= n_slices), "end_slice(): index out of bounds" ); return slice_memptr(slice_num) + n_elem_slice; } //! resets this cube to an empty matrix template inline void Cube::clear() { reset(); } //! returns true if the cube has no elements template inline bool Cube::empty() const { return (n_elem == 0); } //! returns the number of elements in this cube template inline uword Cube::size() const { return n_elem; } template inline eT& Cube::front() { arma_conform_check( (n_elem == 0), "Cube::front(): cube is empty" ); return access::rw(mem[0]); } template inline const eT& Cube::front() const { arma_conform_check( (n_elem == 0), "Cube::front(): cube is empty" ); return mem[0]; } template inline eT& Cube::back() { arma_conform_check( (n_elem == 0), "Cube::back(): cube is empty" ); return access::rw(mem[n_elem-1]); } template inline const eT& Cube::back() const { arma_conform_check( (n_elem == 0), "Cube::back(): cube is empty" ); return mem[n_elem-1]; } template inline void Cube::swap(Cube& B) { Cube& A = (*this); arma_debug_sigprint(arma_str::format("A: %x; B: %x") % &A % &B); if( (A.mem_state == 0) && (B.mem_state == 0) && (A.n_elem > Cube_prealloc::mem_n_elem) && (B.n_elem > Cube_prealloc::mem_n_elem) ) { A.delete_mat(); B.delete_mat(); std::swap( access::rw(A.n_rows), access::rw(B.n_rows) ); std::swap( access::rw(A.n_cols), access::rw(B.n_cols) ); std::swap( access::rw(A.n_elem_slice), access::rw(B.n_elem_slice) ); std::swap( access::rw(A.n_slices), access::rw(B.n_slices) ); std::swap( access::rw(A.n_elem), access::rw(B.n_elem) ); std::swap( access::rw(A.mem), access::rw(B.mem) ); A.create_mat(); B.create_mat(); } else if( (A.mem_state == 0) && (B.mem_state == 0) && (A.n_elem <= Cube_prealloc::mem_n_elem) && (B.n_elem <= Cube_prealloc::mem_n_elem) ) { A.delete_mat(); B.delete_mat(); std::swap( access::rw(A.n_rows), access::rw(B.n_rows) ); std::swap( access::rw(A.n_cols), access::rw(B.n_cols) ); std::swap( access::rw(A.n_elem_slice), access::rw(B.n_elem_slice) ); std::swap( access::rw(A.n_slices), access::rw(B.n_slices) ); std::swap( access::rw(A.n_elem), access::rw(B.n_elem) ); const uword N = (std::max)(A.n_elem, B.n_elem); eT* A_mem = A.memptr(); eT* B_mem = B.memptr(); for(uword i=0; i C = A; A.steal_mem(B); B.steal_mem(C); } else { Cube C = B; B.steal_mem(A); A.steal_mem(C); } } } //! try to steal the memory from a given cube; //! if memory can't be stolen, copy the given cube template inline void Cube::steal_mem(Cube& x) { arma_debug_sigprint(); (*this).steal_mem(x, false); } template inline void Cube::steal_mem(Cube& x, const bool is_move) { arma_debug_sigprint(); if(this == &x) { return; } if( (mem_state <= 1) && ( (x.n_alloc > Cube_prealloc::mem_n_elem) || (x.mem_state == 1) || (is_move && (x.mem_state == 2)) ) ) { arma_debug_print("Cube::steal_mem(): stealing memory"); reset(); const uword x_n_slices = x.n_slices; access::rw(n_rows) = x.n_rows; access::rw(n_cols) = x.n_cols; access::rw(n_elem_slice) = x.n_elem_slice; access::rw(n_slices) = x_n_slices; access::rw(n_elem) = x.n_elem; access::rw(n_alloc) = x.n_alloc; access::rw(mem_state) = x.mem_state; access::rw(mem) = x.mem; if(x_n_slices > Cube_prealloc::mat_ptrs_size) { arma_debug_print("Cube::steal_mem(): stealing mat_ptrs array"); mat_ptrs = x.mat_ptrs; x.mat_ptrs = nullptr; } else { arma_debug_print("Cube::steal_mem(): copying mat_ptrs array"); mat_ptrs = mat_ptrs_local; for(uword i=0; i < x_n_slices; ++i) { mat_ptrs[i] = raw_mat_ptr_type(x.mat_ptrs[i]); // cast required by std::atomic x.mat_ptrs[i] = nullptr; } } access::rw(x.n_rows) = 0; access::rw(x.n_cols) = 0; access::rw(x.n_elem_slice) = 0; access::rw(x.n_slices) = 0; access::rw(x.n_elem) = 0; access::rw(x.n_alloc) = 0; access::rw(x.mem_state) = 0; access::rw(x.mem) = nullptr; } else { arma_debug_print("Cube::steal_mem(): copying memory"); (*this).operator=(x); if( (is_move) && (x.mem_state == 0) && (x.n_alloc <= Cube_prealloc::mem_n_elem) ) { x.reset(); } } } // // Cube::fixed template template arma_inline void Cube::fixed::mem_setup() { arma_debug_sigprint(); if(fixed_n_elem > 0) { access::rw(Cube::n_rows) = fixed_n_rows; access::rw(Cube::n_cols) = fixed_n_cols; access::rw(Cube::n_elem_slice) = fixed_n_rows * fixed_n_cols; access::rw(Cube::n_slices) = fixed_n_slices; access::rw(Cube::n_elem) = fixed_n_elem; access::rw(Cube::n_alloc) = 0; access::rw(Cube::mem_state) = 3; access::rw(Cube::mem) = (fixed_n_elem > Cube_prealloc::mem_n_elem) ? mem_local_extra : mem_local; Cube::mat_ptrs = (fixed_n_slices > Cube_prealloc::mat_ptrs_size) ? mat_ptrs_local_extra : mat_ptrs_local; create_mat(); } else { access::rw(Cube::n_rows) = 0; access::rw(Cube::n_cols) = 0; access::rw(Cube::n_elem_slice) = 0; access::rw(Cube::n_slices) = 0; access::rw(Cube::n_elem) = 0; access::rw(Cube::n_alloc) = 0; access::rw(Cube::mem_state) = 3; access::rw(Cube::mem) = nullptr; Cube::mat_ptrs = nullptr; } } template template inline Cube::fixed::fixed() { arma_debug_sigprint_this(this); mem_setup(); arma_debug_print("Cube::fixed::constructor: zeroing memory"); eT* mem_use = (use_extra) ? &(mem_local_extra[0]) : &(mem_local[0]); arrayops::fill_zeros(mem_use, fixed_n_elem); } template template inline Cube::fixed::fixed(const fixed& X) { arma_debug_sigprint_this(this); mem_setup(); eT* dest = (use_extra) ? mem_local_extra : mem_local; const eT* src = (use_extra) ? X.mem_local_extra : X.mem_local; arrayops::copy( dest, src, fixed_n_elem ); } template template inline Cube::fixed::fixed(const fill::scalar_holder f) { arma_debug_sigprint_this(this); mem_setup(); (*this).fill(f.scalar); } template template template inline Cube::fixed::fixed(const fill::fill_class&) { arma_debug_sigprint_this(this); mem_setup(); if(is_same_type::yes) { Cube::zeros(); } if(is_same_type::yes) { Cube::ones(); } if(is_same_type::yes) { Cube::randu(); } if(is_same_type::yes) { Cube::randn(); } arma_static_check( (is_same_type::yes), "Cube::fixed::fixed(): unsupported fill type" ); } template template template inline Cube::fixed::fixed(const BaseCube& A) { arma_debug_sigprint_this(this); mem_setup(); Cube::operator=(A.get_ref()); } template template template inline Cube::fixed::fixed(const BaseCube& A, const BaseCube& B) { arma_debug_sigprint_this(this); mem_setup(); Cube::init(A,B); } template template inline Cube& Cube::fixed::operator=(const fixed& X) { arma_debug_sigprint(); eT* dest = (use_extra) ? mem_local_extra : mem_local; const eT* src = (use_extra) ? X.mem_local_extra : X.mem_local; arrayops::copy( dest, src, fixed_n_elem ); return *this; } template template arma_inline eT& Cube::fixed::operator[] (const uword i) { return (use_extra) ? mem_local_extra[i] : mem_local[i]; } template template arma_inline const eT& Cube::fixed::operator[] (const uword i) const { return (use_extra) ? mem_local_extra[i] : mem_local[i]; } template template arma_inline eT& Cube::fixed::at(const uword i) { return (use_extra) ? mem_local_extra[i] : mem_local[i]; } template template arma_inline const eT& Cube::fixed::at(const uword i) const { return (use_extra) ? mem_local_extra[i] : mem_local[i]; } template template arma_inline eT& Cube::fixed::operator() (const uword i) { arma_conform_check_bounds( (i >= fixed_n_elem), "Cube::operator(): index out of bounds" ); return (use_extra) ? mem_local_extra[i] : mem_local[i]; } template template arma_inline const eT& Cube::fixed::operator() (const uword i) const { arma_conform_check_bounds( (i >= fixed_n_elem), "Cube::operator(): index out of bounds" ); return (use_extra) ? mem_local_extra[i] : mem_local[i]; } #if defined(__cpp_multidimensional_subscript) template template arma_inline eT& Cube::fixed::operator[] (const uword in_row, const uword in_col, const uword in_slice) { const uword i = in_slice*fixed_n_elem_slice + in_col*fixed_n_rows + in_row; return (use_extra) ? mem_local_extra[i] : mem_local[i]; } template template arma_inline const eT& Cube::fixed::operator[] (const uword in_row, const uword in_col, const uword in_slice) const { const uword i = in_slice*fixed_n_elem_slice + in_col*fixed_n_rows + in_row; return (use_extra) ? mem_local_extra[i] : mem_local[i]; } #endif template template arma_inline eT& Cube::fixed::at(const uword in_row, const uword in_col, const uword in_slice) { const uword i = in_slice*fixed_n_elem_slice + in_col*fixed_n_rows + in_row; return (use_extra) ? mem_local_extra[i] : mem_local[i]; } template template arma_inline const eT& Cube::fixed::at(const uword in_row, const uword in_col, const uword in_slice) const { const uword i = in_slice*fixed_n_elem_slice + in_col*fixed_n_rows + in_row; return (use_extra) ? mem_local_extra[i] : mem_local[i]; } template template arma_inline eT& Cube::fixed::operator() (const uword in_row, const uword in_col, const uword in_slice) { arma_conform_check_bounds ( (in_row >= fixed_n_rows ) || (in_col >= fixed_n_cols ) || (in_slice >= fixed_n_slices) , "operator(): index out of bounds" ); const uword i = in_slice*fixed_n_elem_slice + in_col*fixed_n_rows + in_row; return (use_extra) ? mem_local_extra[i] : mem_local[i]; } template template arma_inline const eT& Cube::fixed::operator() (const uword in_row, const uword in_col, const uword in_slice) const { arma_conform_check_bounds ( (in_row >= fixed_n_rows ) || (in_col >= fixed_n_cols ) || (in_slice >= fixed_n_slices) , "Cube::operator(): index out of bounds" ); const uword i = in_slice*fixed_n_elem_slice + in_col*fixed_n_rows + in_row; return (use_extra) ? mem_local_extra[i] : mem_local[i]; } // // Cube_aux //! prefix ++ template arma_inline void Cube_aux::prefix_pp(Cube& x) { eT* memptr = x.memptr(); const uword n_elem = x.n_elem; uword i,j; for(i=0, j=1; j arma_inline void Cube_aux::prefix_pp(Cube< std::complex >& x) { x += T(1); } //! postfix ++ template arma_inline void Cube_aux::postfix_pp(Cube& x) { eT* memptr = x.memptr(); const uword n_elem = x.n_elem; uword i,j; for(i=0, j=1; j arma_inline void Cube_aux::postfix_pp(Cube< std::complex >& x) { x += T(1); } //! prefix -- template arma_inline void Cube_aux::prefix_mm(Cube& x) { eT* memptr = x.memptr(); const uword n_elem = x.n_elem; uword i,j; for(i=0, j=1; j arma_inline void Cube_aux::prefix_mm(Cube< std::complex >& x) { x -= T(1); } //! postfix -- template arma_inline void Cube_aux::postfix_mm(Cube& x) { eT* memptr = x.memptr(); const uword n_elem = x.n_elem; uword i,j; for(i=0, j=1; j arma_inline void Cube_aux::postfix_mm(Cube< std::complex >& x) { x -= T(1); } template inline void Cube_aux::set_real(Cube& out, const BaseCube& X) { arma_debug_sigprint(); const unwrap_cube tmp(X.get_ref()); const Cube& A = tmp.M; arma_conform_assert_same_size( out, A, "Cube::set_real()" ); out = A; } template inline void Cube_aux::set_imag(Cube&, const BaseCube&) { arma_debug_sigprint(); } template inline void Cube_aux::set_real(Cube< std::complex >& out, const BaseCube& X) { arma_debug_sigprint(); typedef typename std::complex eT; const ProxyCube P(X.get_ref()); const uword local_n_rows = P.get_n_rows(); const uword local_n_cols = P.get_n_cols(); const uword local_n_slices = P.get_n_slices(); arma_conform_assert_same_size ( out.n_rows, out.n_cols, out.n_slices, local_n_rows, local_n_cols, local_n_slices, "Cube::set_real()" ); eT* out_mem = out.memptr(); if(ProxyCube::use_at == false) { typedef typename ProxyCube::ea_type ea_type; ea_type A = P.get_ea(); const uword N = out.n_elem; for(uword i=0; i inline void Cube_aux::set_imag(Cube< std::complex >& out, const BaseCube& X) { arma_debug_sigprint(); typedef typename std::complex eT; const ProxyCube P(X.get_ref()); const uword local_n_rows = P.get_n_rows(); const uword local_n_cols = P.get_n_cols(); const uword local_n_slices = P.get_n_slices(); arma_conform_assert_same_size ( out.n_rows, out.n_cols, out.n_slices, local_n_rows, local_n_cols, local_n_slices, "Cube::set_imag()" ); eT* out_mem = out.memptr(); if(ProxyCube::use_at == false) { typedef typename ProxyCube::ea_type ea_type; ea_type A = P.get_ea(); const uword N = out.n_elem; for(uword i=0; i class subview_cube_slices : public BaseCube< eT, subview_cube_slices > { public: typedef eT elem_type; typedef typename get_pod_type::result pod_type; arma_aligned const Cube& m; arma_aligned const Base& base_si; protected: arma_inline subview_cube_slices(const Cube& in_m, const Base& in_si); public: inline ~subview_cube_slices(); inline subview_cube_slices() = delete; inline void inplace_rand(const uword rand_mode); template inline void inplace_op(const eT val); template inline void inplace_op(const BaseCube& x); inline void fill(const eT val); inline void zeros(); inline void ones(); inline void randu(); inline void randn(); inline void operator+= (const eT val); inline void operator-= (const eT val); inline void operator*= (const eT val); inline void operator/= (const eT val); // deliberately returning void template inline void operator_equ(const subview_cube_slices& x); template inline void operator= (const subview_cube_slices& x); inline void operator= (const subview_cube_slices& x); template inline void operator+= (const subview_cube_slices& x); template inline void operator-= (const subview_cube_slices& x); template inline void operator%= (const subview_cube_slices& x); template inline void operator/= (const subview_cube_slices& x); template inline void operator= (const BaseCube& x); template inline void operator+= (const BaseCube& x); template inline void operator-= (const BaseCube& x); template inline void operator%= (const BaseCube& x); template inline void operator/= (const BaseCube& x); inline static void extract(Cube& out, const subview_cube_slices& in); inline static void plus_inplace(Cube& out, const subview_cube_slices& in); inline static void minus_inplace(Cube& out, const subview_cube_slices& in); inline static void schur_inplace(Cube& out, const subview_cube_slices& in); inline static void div_inplace(Cube& out, const subview_cube_slices& in); friend class Cube; }; //! @} RcppArmadillo/inst/include/armadillo_bits/spop_omit_bones.hpp0000644000176200001440000000223515030507611024300 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup spop_omit //! @{ class spop_omit : public traits_op_col { public: template inline static void apply(SpMat& out, const SpOp& in); template inline static void apply_noalias(SpMat& out, const SpProxy& P, functor is_omitted); }; //! @} RcppArmadillo/inst/include/armadillo_bits/Col_meat.hpp0000644000176200001440000011407014723642672022644 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup Col //! @{ //! construct an empty column vector template inline Col::Col() : Mat(arma_vec_indicator(), 1) { arma_debug_sigprint(); } template inline Col::Col(const Col& X) : Mat(arma_vec_indicator(), X.n_elem, 1, 1) { arma_debug_sigprint(); arrayops::copy((*this).memptr(), X.memptr(), X.n_elem); } //! construct a column vector with the specified number of n_elem template inline Col::Col(const uword in_n_elem) : Mat(arma_vec_indicator(), in_n_elem, 1, 1) { arma_debug_sigprint(); arma_debug_print("Col::constructor: zeroing memory"); arrayops::fill_zeros(Mat::memptr(), Mat::n_elem); } template inline Col::Col(const uword in_n_rows, const uword in_n_cols) : Mat(arma_vec_indicator(), 0, 0, 1) { arma_debug_sigprint(); Mat::init_warm(in_n_rows, in_n_cols); arma_debug_print("Col::constructor: zeroing memory"); arrayops::fill_zeros(Mat::memptr(), Mat::n_elem); } template inline Col::Col(const SizeMat& s) : Mat(arma_vec_indicator(), 0, 0, 1) { arma_debug_sigprint(); Mat::init_warm(s.n_rows, s.n_cols); arma_debug_print("Col::constructor: zeroing memory"); arrayops::fill_zeros(Mat::memptr(), Mat::n_elem); } //! internal use only template template inline Col::Col(const uword in_n_elem, const arma_initmode_indicator&) : Mat(arma_vec_indicator(), in_n_elem, 1, 1) { arma_debug_sigprint(); if(do_zeros) { arma_debug_print("Col::constructor: zeroing memory"); arrayops::fill_zeros(Mat::memptr(), Mat::n_elem); } else { arma_debug_print("Col::constructor: not zeroing memory"); } } //! internal use only template template inline Col::Col(const uword in_n_rows, const uword in_n_cols, const arma_initmode_indicator&) : Mat(arma_vec_indicator(), 0, 0, 1) { arma_debug_sigprint(); Mat::init_warm(in_n_rows, in_n_cols); if(do_zeros) { arma_debug_print("Col::constructor: zeroing memory"); arrayops::fill_zeros(Mat::memptr(), Mat::n_elem); } else { arma_debug_print("Col::constructor: not zeroing memory"); } } //! internal use only template template inline Col::Col(const SizeMat& s, const arma_initmode_indicator&) : Mat(arma_vec_indicator(), 0, 0, 1) { arma_debug_sigprint(); Mat::init_warm(s.n_rows, s.n_cols); if(do_zeros) { arma_debug_print("Col::constructor: zeroing memory"); arrayops::fill_zeros(Mat::memptr(), Mat::n_elem); } else { arma_debug_print("Col::constructor: not zeroing memory"); } } template template inline Col::Col(const uword in_n_elem, const fill::fill_class& f) : Mat(arma_vec_indicator(), in_n_elem, 1, 1) { arma_debug_sigprint(); (*this).fill(f); } template template inline Col::Col(const uword in_n_rows, const uword in_n_cols, const fill::fill_class& f) : Mat(arma_vec_indicator(), 0, 0, 1) { arma_debug_sigprint(); Mat::init_warm(in_n_rows, in_n_cols); (*this).fill(f); } template template inline Col::Col(const SizeMat& s, const fill::fill_class& f) : Mat(arma_vec_indicator(), 0, 0, 1) { arma_debug_sigprint(); Mat::init_warm(s.n_rows, s.n_cols); (*this).fill(f); } template inline Col::Col(const uword in_n_elem, const fill::scalar_holder f) : Mat(arma_vec_indicator(), in_n_elem, 1, 1) { arma_debug_sigprint(); (*this).fill(f.scalar); } template inline Col::Col(const uword in_n_rows, const uword in_n_cols, const fill::scalar_holder f) : Mat(arma_vec_indicator(), 0, 0, 1) { arma_debug_sigprint(); Mat::init_warm(in_n_rows, in_n_cols); (*this).fill(f.scalar); } template inline Col::Col(const SizeMat& s, const fill::scalar_holder f) : Mat(arma_vec_indicator(), 0, 0, 1) { arma_debug_sigprint(); Mat::init_warm(s.n_rows, s.n_cols); (*this).fill(f.scalar); } template inline Col::Col(const char* text) : Mat(arma_vec_indicator(), 1) { arma_debug_sigprint(); (*this).operator=(text); } template inline Col& Col::operator=(const char* text) { arma_debug_sigprint(); Mat tmp(text); arma_conform_check( ((tmp.n_elem > 0) && (tmp.is_vec() == false)), "Mat::init(): requested size is not compatible with column vector layout" ); access::rw(tmp.n_rows) = tmp.n_elem; access::rw(tmp.n_cols) = 1; (*this).steal_mem(tmp); return *this; } template inline Col::Col(const std::string& text) : Mat(arma_vec_indicator(), 1) { arma_debug_sigprint(); (*this).operator=(text); } template inline Col& Col::operator=(const std::string& text) { arma_debug_sigprint(); Mat tmp(text); arma_conform_check( ((tmp.n_elem > 0) && (tmp.is_vec() == false)), "Mat::init(): requested size is not compatible with column vector layout" ); access::rw(tmp.n_rows) = tmp.n_elem; access::rw(tmp.n_cols) = 1; (*this).steal_mem(tmp); return *this; } //! create a column vector from std::vector template inline Col::Col(const std::vector& x) : Mat(arma_vec_indicator(), uword(x.size()), 1, 1) { arma_debug_sigprint_this(this); const uword N = uword(x.size()); if(N > 0) { arrayops::copy( Mat::memptr(), &(x[0]), N ); } } //! create a column vector from std::vector template inline Col& Col::operator=(const std::vector& x) { arma_debug_sigprint(); const uword N = uword(x.size()); Mat::init_warm(N, 1); if(N > 0) { arrayops::copy( Mat::memptr(), &(x[0]), N ); } return *this; } template inline Col::Col(const std::initializer_list& list) : Mat(arma_vec_indicator(), uword(list.size()), 1, 1) { arma_debug_sigprint_this(this); const uword N = uword(list.size()); if(N > 0) { arrayops::copy( Mat::memptr(), list.begin(), N ); } } template inline Col& Col::operator=(const std::initializer_list& list) { arma_debug_sigprint(); const uword N = uword(list.size()); Mat::init_warm(N, 1); if(N > 0) { arrayops::copy( Mat::memptr(), list.begin(), N ); } return *this; } template inline Col::Col(Col&& X) : Mat(arma_vec_indicator(), 1) { arma_debug_sigprint(arma_str::format("this: %x; X: %x") % this % &X); access::rw(Mat::n_rows) = X.n_rows; access::rw(Mat::n_cols) = 1; access::rw(Mat::n_elem) = X.n_elem; access::rw(Mat::n_alloc) = X.n_alloc; if( (X.n_alloc > arma_config::mat_prealloc) || (X.mem_state == 1) || (X.mem_state == 2) ) { access::rw(Mat::mem_state) = X.mem_state; access::rw(Mat::mem) = X.mem; access::rw(X.n_rows) = 0; access::rw(X.n_cols) = 1; access::rw(X.n_elem) = 0; access::rw(X.n_alloc) = 0; access::rw(X.mem_state) = 0; access::rw(X.mem) = nullptr; } else // condition: (X.n_alloc <= arma_config::mat_prealloc) || (X.mem_state == 0) || (X.mem_state == 3) { (*this).init_cold(); arrayops::copy( (*this).memptr(), X.mem, X.n_elem ); if( (X.mem_state == 0) && (X.n_alloc <= arma_config::mat_prealloc) ) { access::rw(X.n_rows) = 0; access::rw(X.n_cols) = 1; access::rw(X.n_elem) = 0; access::rw(X.mem) = nullptr; } } } template inline Col& Col::operator=(Col&& X) { arma_debug_sigprint(arma_str::format("this: %x; X: %x") % this % &X); (*this).steal_mem(X, true); return *this; } // template // inline // Col::Col(Mat&& X) // : Mat(arma_vec_indicator(), 1) // { // arma_debug_sigprint(arma_str::format("this: %x; X: %x") % this % &X); // // if(X.n_cols != 1) { const Mat& XX = X; Mat::operator=(XX); return; } // // access::rw(Mat::n_rows) = X.n_rows; // access::rw(Mat::n_cols) = 1; // access::rw(Mat::n_elem) = X.n_elem; // access::rw(Mat::n_alloc) = X.n_alloc; // // if( (X.n_alloc > arma_config::mat_prealloc) || (X.mem_state == 1) || (X.mem_state == 2) ) // { // access::rw(Mat::mem_state) = X.mem_state; // access::rw(Mat::mem) = X.mem; // // access::rw(X.n_rows) = 0; // access::rw(X.n_elem) = 0; // access::rw(X.n_alloc) = 0; // access::rw(X.mem_state) = 0; // access::rw(X.mem) = nullptr; // } // else // condition: (X.n_alloc <= arma_config::mat_prealloc) || (X.mem_state == 0) || (X.mem_state == 3) // { // (*this).init_cold(); // // arrayops::copy( (*this).memptr(), X.mem, X.n_elem ); // // if( (X.mem_state == 0) && (X.n_alloc <= arma_config::mat_prealloc) ) // { // access::rw(X.n_rows) = 0; // access::rw(X.n_elem) = 0; // access::rw(X.mem) = nullptr; // } // } // } // // // // template // inline // Col& // Col::operator=(Mat&& X) // { // arma_debug_sigprint(arma_str::format("this: %x; X: %x") % this % &X); // // if(X.n_cols != 1) { const Mat& XX = X; Mat::operator=(XX); return *this; } // // (*this).steal_mem(X, true); // // return *this; // } template inline Col& Col::operator=(const eT val) { arma_debug_sigprint(); Mat::operator=(val); return *this; } template inline Col& Col::operator=(const Col& X) { arma_debug_sigprint(); Mat::operator=(X); return *this; } template template inline Col::Col(const Base& X) : Mat(arma_vec_indicator(), 1) { arma_debug_sigprint(); Mat::operator=(X.get_ref()); } template template inline Col& Col::operator=(const Base& X) { arma_debug_sigprint(); Mat::operator=(X.get_ref()); return *this; } template template inline Col::Col(const SpBase& X) : Mat(arma_vec_indicator(), 1) { arma_debug_sigprint_this(this); Mat::operator=(X.get_ref()); } template template inline Col& Col::operator=(const SpBase& X) { arma_debug_sigprint(); Mat::operator=(X.get_ref()); return *this; } //! construct a column vector from a given auxiliary array of eTs template inline Col::Col(eT* aux_mem, const uword aux_length, const bool copy_aux_mem, const bool strict) : Mat(aux_mem, aux_length, 1, copy_aux_mem, strict) { arma_debug_sigprint(); access::rw(Mat::vec_state) = 1; } //! construct a column vector from a given auxiliary array of eTs template inline Col::Col(const eT* aux_mem, const uword aux_length) : Mat(aux_mem, aux_length, 1) { arma_debug_sigprint(); access::rw(Mat::vec_state) = 1; } template template inline Col::Col ( const Base::pod_type, T1>& A, const Base::pod_type, T2>& B ) { arma_debug_sigprint(); access::rw(Mat::vec_state) = 1; Mat::init(A,B); } template template inline Col::Col(const BaseCube& X) { arma_debug_sigprint(); access::rw(Mat::vec_state) = 1; Mat::operator=(X); } template template inline Col& Col::operator=(const BaseCube& X) { arma_debug_sigprint(); Mat::operator=(X); return *this; } template inline Col::Col(const subview_cube& X) { arma_debug_sigprint(); access::rw(Mat::vec_state) = 1; Mat::operator=(X); } template inline Col& Col::operator=(const subview_cube& X) { arma_debug_sigprint(); Mat::operator=(X); return *this; } template inline mat_injector< Col > Col::operator<<(const eT val) { return mat_injector< Col >(*this, val); } template arma_inline const Op,op_htrans> Col::t() const { return Op,op_htrans>(*this); } template arma_inline const Op,op_htrans> Col::ht() const { return Op,op_htrans>(*this); } template arma_inline const Op,op_strans> Col::st() const { return Op,op_strans>(*this); } template arma_inline const Op,op_strans> Col::as_row() const { return Op,op_strans>(*this); } template arma_inline subview_col Col::row(const uword in_row1) { arma_debug_sigprint(); arma_conform_check_bounds( (in_row1 >= Mat::n_rows), "Col::row(): indices out of bounds or incorrectly used" ); return subview_col(*this, 0, in_row1, 1); } template arma_inline const subview_col Col::row(const uword in_row1) const { arma_debug_sigprint(); arma_conform_check_bounds( (in_row1 >= Mat::n_rows), "Col::row(): indices out of bounds or incorrectly used" ); return subview_col(*this, 0, in_row1, 1); } template arma_inline subview_col Col::rows(const uword in_row1, const uword in_row2) { arma_debug_sigprint(); arma_conform_check_bounds( ( (in_row1 > in_row2) || (in_row2 >= Mat::n_rows) ), "Col::rows(): indices out of bounds or incorrectly used" ); const uword subview_n_rows = in_row2 - in_row1 + 1; return subview_col(*this, 0, in_row1, subview_n_rows); } template arma_inline const subview_col Col::rows(const uword in_row1, const uword in_row2) const { arma_debug_sigprint(); arma_conform_check_bounds( ( (in_row1 > in_row2) || (in_row2 >= Mat::n_rows) ), "Col::rows(): indices out of bounds or incorrectly used" ); const uword subview_n_rows = in_row2 - in_row1 + 1; return subview_col(*this, 0, in_row1, subview_n_rows); } template arma_inline subview_col Col::subvec(const uword in_row1, const uword in_row2) { arma_debug_sigprint(); arma_conform_check_bounds( ( (in_row1 > in_row2) || (in_row2 >= Mat::n_rows) ), "Col::subvec(): indices out of bounds or incorrectly used" ); const uword subview_n_rows = in_row2 - in_row1 + 1; return subview_col(*this, 0, in_row1, subview_n_rows); } template arma_inline const subview_col Col::subvec(const uword in_row1, const uword in_row2) const { arma_debug_sigprint(); arma_conform_check_bounds( ( (in_row1 > in_row2) || (in_row2 >= Mat::n_rows) ), "Col::subvec(): indices out of bounds or incorrectly used" ); const uword subview_n_rows = in_row2 - in_row1 + 1; return subview_col(*this, 0, in_row1, subview_n_rows); } template arma_inline subview_col Col::rows(const span& row_span) { arma_debug_sigprint(); return subvec(row_span); } template arma_inline const subview_col Col::rows(const span& row_span) const { arma_debug_sigprint(); return subvec(row_span); } template arma_inline subview_col Col::subvec(const span& row_span) { arma_debug_sigprint(); const bool row_all = row_span.whole; const uword local_n_rows = Mat::n_rows; const uword in_row1 = row_all ? 0 : row_span.a; const uword in_row2 = row_span.b; const uword subvec_n_rows = row_all ? local_n_rows : in_row2 - in_row1 + 1; arma_conform_check_bounds( ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows)) ), "Col::subvec(): indices out of bounds or incorrectly used" ); return subview_col(*this, 0, in_row1, subvec_n_rows); } template arma_inline const subview_col Col::subvec(const span& row_span) const { arma_debug_sigprint(); const bool row_all = row_span.whole; const uword local_n_rows = Mat::n_rows; const uword in_row1 = row_all ? 0 : row_span.a; const uword in_row2 = row_span.b; const uword subvec_n_rows = row_all ? local_n_rows : in_row2 - in_row1 + 1; arma_conform_check_bounds( ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows)) ), "Col::subvec(): indices out of bounds or incorrectly used" ); return subview_col(*this, 0, in_row1, subvec_n_rows); } template arma_inline subview_col Col::operator()(const span& row_span) { arma_debug_sigprint(); return subvec(row_span); } template arma_inline const subview_col Col::operator()(const span& row_span) const { arma_debug_sigprint(); return subvec(row_span); } template arma_inline subview_col Col::subvec(const uword start_row, const SizeMat& s) { arma_debug_sigprint(); arma_conform_check( (s.n_cols != 1), "Col::subvec(): given size does not specify a column vector" ); arma_conform_check_bounds( ( (start_row >= Mat::n_rows) || ((start_row + s.n_rows) > Mat::n_rows) ), "Col::subvec(): size out of bounds" ); return subview_col(*this, 0, start_row, s.n_rows); } template arma_inline const subview_col Col::subvec(const uword start_row, const SizeMat& s) const { arma_debug_sigprint(); arma_conform_check( (s.n_cols != 1), "Col::subvec(): given size does not specify a column vector" ); arma_conform_check_bounds( ( (start_row >= Mat::n_rows) || ((start_row + s.n_rows) > Mat::n_rows) ), "Col::subvec(): size out of bounds" ); return subview_col(*this, 0, start_row, s.n_rows); } template arma_inline subview_col Col::head(const uword N) { arma_debug_sigprint(); arma_conform_check_bounds( (N > Mat::n_rows), "Col::head(): size out of bounds" ); return subview_col(*this, 0, 0, N); } template arma_inline const subview_col Col::head(const uword N) const { arma_debug_sigprint(); arma_conform_check_bounds( (N > Mat::n_rows), "Col::head(): size out of bounds" ); return subview_col(*this, 0, 0, N); } template arma_inline subview_col Col::tail(const uword N) { arma_debug_sigprint(); arma_conform_check_bounds( (N > Mat::n_rows), "Col::tail(): size out of bounds" ); const uword start_row = Mat::n_rows - N; return subview_col(*this, 0, start_row, N); } template arma_inline const subview_col Col::tail(const uword N) const { arma_debug_sigprint(); arma_conform_check_bounds( (N > Mat::n_rows), "Col::tail(): size out of bounds" ); const uword start_row = Mat::n_rows - N; return subview_col(*this, 0, start_row, N); } template arma_inline subview_col Col::head_rows(const uword N) { arma_debug_sigprint(); return (*this).head(N); } template arma_inline const subview_col Col::head_rows(const uword N) const { arma_debug_sigprint(); return (*this).head(N); } template arma_inline subview_col Col::tail_rows(const uword N) { arma_debug_sigprint(); return (*this).tail(N); } template arma_inline const subview_col Col::tail_rows(const uword N) const { arma_debug_sigprint(); return (*this).tail(N); } //! remove specified row template inline void Col::shed_row(const uword row_num) { arma_debug_sigprint(); arma_conform_check_bounds( row_num >= Mat::n_rows, "Col::shed_row(): index out of bounds" ); shed_rows(row_num, row_num); } //! remove specified rows template inline void Col::shed_rows(const uword in_row1, const uword in_row2) { arma_debug_sigprint(); arma_conform_check_bounds ( (in_row1 > in_row2) || (in_row2 >= Mat::n_rows), "Col::shed_rows(): indices out of bounds or incorrectly used" ); const uword n_keep_front = in_row1; const uword n_keep_back = Mat::n_rows - (in_row2 + 1); Col X(n_keep_front + n_keep_back, arma_nozeros_indicator()); eT* X_mem = X.memptr(); const eT* t_mem = (*this).memptr(); if(n_keep_front > 0) { arrayops::copy( X_mem, t_mem, n_keep_front ); } if(n_keep_back > 0) { arrayops::copy( &(X_mem[n_keep_front]), &(t_mem[in_row2+1]), n_keep_back); } Mat::steal_mem(X); } //! remove specified rows template template inline void Col::shed_rows(const Base& indices) { arma_debug_sigprint(); Mat::shed_rows(indices); } template inline void Col::insert_rows(const uword row_num, const uword N, const bool set_to_zero) { arma_debug_sigprint(); arma_ignore(set_to_zero); (*this).insert_rows(row_num, N); } template inline void Col::insert_rows(const uword row_num, const uword N) { arma_debug_sigprint(); const uword t_n_rows = Mat::n_rows; const uword A_n_rows = row_num; const uword B_n_rows = t_n_rows - row_num; // insertion at row_num == n_rows is in effect an append operation arma_conform_check_bounds( (row_num > t_n_rows), "Col::insert_rows(): index out of bounds" ); if(N == 0) { return; } Col out(t_n_rows + N, arma_nozeros_indicator()); eT* out_mem = out.memptr(); const eT* t_mem = (*this).memptr(); if(A_n_rows > 0) { arrayops::copy( out_mem, t_mem, A_n_rows ); } if(B_n_rows > 0) { arrayops::copy( &(out_mem[row_num + N]), &(t_mem[row_num]), B_n_rows ); } arrayops::fill_zeros( &(out_mem[row_num]), N ); Mat::steal_mem(out); } //! insert the given object at the specified row position; //! the given object must have one column template template inline void Col::insert_rows(const uword row_num, const Base& X) { arma_debug_sigprint(); Mat::insert_rows(row_num, X); } template arma_inline eT& Col::at(const uword i) { return access::rw(Mat::mem[i]); } template arma_inline const eT& Col::at(const uword i) const { return Mat::mem[i]; } template arma_inline eT& Col::at(const uword in_row, const uword) { return access::rw( Mat::mem[in_row] ); } template arma_inline const eT& Col::at(const uword in_row, const uword) const { return Mat::mem[in_row]; } template inline typename Col::row_iterator Col::begin_row(const uword row_num) { arma_debug_sigprint(); arma_conform_check_bounds( (row_num >= Mat::n_rows), "Col::begin_row(): index out of bounds" ); return Mat::memptr() + row_num; } template inline typename Col::const_row_iterator Col::begin_row(const uword row_num) const { arma_debug_sigprint(); arma_conform_check_bounds( (row_num >= Mat::n_rows), "Col::begin_row(): index out of bounds" ); return Mat::memptr() + row_num; } template inline typename Col::row_iterator Col::end_row(const uword row_num) { arma_debug_sigprint(); arma_conform_check_bounds( (row_num >= Mat::n_rows), "Col::end_row(): index out of bounds" ); return Mat::memptr() + row_num + 1; } template inline typename Col::const_row_iterator Col::end_row(const uword row_num) const { arma_debug_sigprint(); arma_conform_check_bounds( (row_num >= Mat::n_rows), "Col::end_row(): index out of bounds" ); return Mat::memptr() + row_num + 1; } template template arma_inline Col::fixed::fixed() : Col( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local_extra : Mat::mem_local) ) { arma_debug_sigprint_this(this); arma_debug_print("Col::fixed::constructor: zeroing memory"); eT* mem_use = (use_extra) ? &(mem_local_extra[0]) : &(Mat::mem_local[0]); arrayops::inplace_set_fixed( mem_use, eT(0) ); } template template arma_inline Col::fixed::fixed(const fixed& X) : Col( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local_extra : Mat::mem_local) ) { arma_debug_sigprint_this(this); eT* dest = (use_extra) ? mem_local_extra : Mat::mem_local; const eT* src = (use_extra) ? X.mem_local_extra : X.mem_local; arrayops::copy( dest, src, fixed_n_elem ); } template template arma_inline Col::fixed::fixed(const subview_cube& X) : Col( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local_extra : Mat::mem_local) ) { arma_debug_sigprint_this(this); Col::operator=(X); } template template inline Col::fixed::fixed(const fill::scalar_holder f) : Col( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local_extra : Mat::mem_local) ) { arma_debug_sigprint_this(this); (*this).fill(f.scalar); } template template template inline Col::fixed::fixed(const fill::fill_class&) : Col( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local_extra : Mat::mem_local) ) { arma_debug_sigprint_this(this); if(is_same_type::yes) { (*this).zeros(); } if(is_same_type::yes) { (*this).ones(); } if(is_same_type::yes) { Mat::eye(); } if(is_same_type::yes) { Mat::randu(); } if(is_same_type::yes) { Mat::randn(); } } template template template arma_inline Col::fixed::fixed(const Base& A) : Col( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local_extra : Mat::mem_local) ) { arma_debug_sigprint_this(this); Col::operator=(A.get_ref()); } template template template arma_inline Col::fixed::fixed(const Base& A, const Base& B) : Col( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local_extra : Mat::mem_local) ) { arma_debug_sigprint_this(this); Col::init(A,B); } template template inline Col::fixed::fixed(const eT* aux_mem) : Col( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local_extra : Mat::mem_local) ) { arma_debug_sigprint_this(this); eT* dest = (use_extra) ? mem_local_extra : Mat::mem_local; arrayops::copy( dest, aux_mem, fixed_n_elem ); } template template inline Col::fixed::fixed(const char* text) : Col( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local_extra : Mat::mem_local) ) { arma_debug_sigprint_this(this); Col::operator=(text); } template template inline Col::fixed::fixed(const std::string& text) : Col( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local_extra : Mat::mem_local) ) { arma_debug_sigprint_this(this); Col::operator=(text); } template template template Col& Col::fixed::operator=(const Base& A) { arma_debug_sigprint(); Col::operator=(A.get_ref()); return *this; } template template Col& Col::fixed::operator=(const eT val) { arma_debug_sigprint(); Col::operator=(val); return *this; } template template Col& Col::fixed::operator=(const char* text) { arma_debug_sigprint(); Col::operator=(text); return *this; } template template Col& Col::fixed::operator=(const std::string& text) { arma_debug_sigprint(); Col::operator=(text); return *this; } template template Col& Col::fixed::operator=(const subview_cube& X) { arma_debug_sigprint(); Col::operator=(X); return *this; } template template inline Col::fixed::fixed(const std::initializer_list& list) : Col( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local_extra : Mat::mem_local) ) { arma_debug_sigprint_this(this); (*this).operator=(list); } template template inline Col& Col::fixed::operator=(const std::initializer_list& list) { arma_debug_sigprint(); const uword N = uword(list.size()); arma_conform_check( (N > fixed_n_elem), "Col::fixed: initialiser list is too long" ); eT* this_mem = (*this).memptr(); arrayops::copy( this_mem, list.begin(), N ); for(uword iq=N; iq < fixed_n_elem; ++iq) { this_mem[iq] = eT(0); } return *this; } template template arma_inline Col& Col::fixed::operator=(const fixed& X) { arma_debug_sigprint(); if(this != &X) { eT* dest = (use_extra) ? mem_local_extra : Mat::mem_local; const eT* src = (use_extra) ? X.mem_local_extra : X.mem_local; arrayops::copy( dest, src, fixed_n_elem ); } return *this; } #if defined(ARMA_GOOD_COMPILER) template template template inline Col& Col::fixed::operator=(const eOp& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); const bool bad_alias = (eOp::proxy_type::has_subview && X.P.is_alias(*this)); if(bad_alias == false) { arma_conform_assert_same_size(fixed_n_elem, uword(1), X.get_n_rows(), X.get_n_cols(), "Col::fixed::operator="); eop_type::apply(*this, X); } else { arma_debug_print("bad_alias = true"); Col tmp(X); (*this) = tmp; } return *this; } template template template inline Col& Col::fixed::operator=(const eGlue& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); arma_type_check(( is_same_type< eT, typename T2::elem_type >::no )); const bool bad_alias = ( (eGlue::proxy1_type::has_subview && X.P1.is_alias(*this)) || (eGlue::proxy2_type::has_subview && X.P2.is_alias(*this)) ); if(bad_alias == false) { arma_conform_assert_same_size(fixed_n_elem, uword(1), X.get_n_rows(), X.get_n_cols(), "Col::fixed::operator="); eglue_type::apply(*this, X); } else { arma_debug_print("bad_alias = true"); Col tmp(X); (*this) = tmp; } return *this; } #endif template template arma_inline const Op< typename Col::template fixed::Col_fixed_type, op_htrans > Col::fixed::t() const { return Op< typename Col::template fixed::Col_fixed_type, op_htrans >(*this); } template template arma_inline const Op< typename Col::template fixed::Col_fixed_type, op_htrans > Col::fixed::ht() const { return Op< typename Col::template fixed::Col_fixed_type, op_htrans >(*this); } template template arma_inline const Op< typename Col::template fixed::Col_fixed_type, op_strans > Col::fixed::st() const { return Op< typename Col::template fixed::Col_fixed_type, op_strans >(*this); } template template arma_inline const eT& Col::fixed::at_alt(const uword ii) const { #if defined(ARMA_HAVE_ALIGNED_ATTRIBUTE) return (use_extra) ? mem_local_extra[ii] : Mat::mem_local[ii]; #else const eT* mem_aligned = (use_extra) ? mem_local_extra : Mat::mem_local; memory::mark_as_aligned(mem_aligned); return mem_aligned[ii]; #endif } template template arma_inline eT& Col::fixed::operator[] (const uword ii) { return (use_extra) ? mem_local_extra[ii] : Mat::mem_local[ii]; } template template arma_inline const eT& Col::fixed::operator[] (const uword ii) const { return (use_extra) ? mem_local_extra[ii] : Mat::mem_local[ii]; } template template arma_inline eT& Col::fixed::at(const uword ii) { return (use_extra) ? mem_local_extra[ii] : Mat::mem_local[ii]; } template template arma_inline const eT& Col::fixed::at(const uword ii) const { return (use_extra) ? mem_local_extra[ii] : Mat::mem_local[ii]; } template template arma_inline eT& Col::fixed::operator() (const uword ii) { arma_conform_check_bounds( (ii >= fixed_n_elem), "Col::operator(): index out of bounds" ); return (use_extra) ? mem_local_extra[ii] : Mat::mem_local[ii]; } template template arma_inline const eT& Col::fixed::operator() (const uword ii) const { arma_conform_check_bounds( (ii >= fixed_n_elem), "Col::operator(): index out of bounds" ); return (use_extra) ? mem_local_extra[ii] : Mat::mem_local[ii]; } template template arma_inline eT& Col::fixed::at(const uword in_row, const uword) { return (use_extra) ? mem_local_extra[in_row] : Mat::mem_local[in_row]; } template template arma_inline const eT& Col::fixed::at(const uword in_row, const uword) const { return (use_extra) ? mem_local_extra[in_row] : Mat::mem_local[in_row]; } template template arma_inline eT& Col::fixed::operator() (const uword in_row, const uword in_col) { arma_conform_check_bounds( ((in_row >= fixed_n_elem) || (in_col > 0)), "Col::operator(): index out of bounds" ); return (use_extra) ? mem_local_extra[in_row] : Mat::mem_local[in_row]; } template template arma_inline const eT& Col::fixed::operator() (const uword in_row, const uword in_col) const { arma_conform_check_bounds( ((in_row >= fixed_n_elem) || (in_col > 0)), "Col::operator(): index out of bounds" ); return (use_extra) ? mem_local_extra[in_row] : Mat::mem_local[in_row]; } template template arma_inline eT* Col::fixed::memptr() { return (use_extra) ? mem_local_extra : Mat::mem_local; } template template arma_inline const eT* Col::fixed::memptr() const { return (use_extra) ? mem_local_extra : Mat::mem_local; } template template inline const Col& Col::fixed::fill(const eT val) { arma_debug_sigprint(); eT* mem_use = (use_extra) ? &(mem_local_extra[0]) : &(Mat::mem_local[0]); arrayops::inplace_set_fixed( mem_use, val ); return *this; } template template inline const Col& Col::fixed::zeros() { arma_debug_sigprint(); eT* mem_use = (use_extra) ? &(mem_local_extra[0]) : &(Mat::mem_local[0]); arrayops::inplace_set_fixed( mem_use, eT(0) ); return *this; } template template inline const Col& Col::fixed::ones() { arma_debug_sigprint(); eT* mem_use = (use_extra) ? &(mem_local_extra[0]) : &(Mat::mem_local[0]); arrayops::inplace_set_fixed( mem_use, eT(1) ); return *this; } template inline Col::Col(const arma_fixed_indicator&, const uword in_n_elem, const eT* in_mem) : Mat(arma_fixed_indicator(), in_n_elem, 1, 1, in_mem) { arma_debug_sigprint_this(this); } #if defined(ARMA_EXTRA_COL_MEAT) #include ARMA_INCFILE_WRAP(ARMA_EXTRA_COL_MEAT) #endif //! @} RcppArmadillo/inst/include/armadillo_bits/xvec_htrans_bones.hpp0000644000176200001440000000312614301267044024616 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup xvec_htrans //! @{ template class xvec_htrans : public Base< eT, xvec_htrans > { public: typedef eT elem_type; typedef typename get_pod_type::result pod_type; static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = true; arma_aligned const eT* const mem; const uword n_rows; const uword n_cols; const uword n_elem; inline explicit xvec_htrans(const eT* const in_mem, const uword in_n_rows, const uword in_n_cols); inline void extract(Mat& out) const; inline eT operator[](const uword ii) const; inline eT at_alt (const uword ii) const; inline eT at (const uword in_row, const uword in_col) const; }; //! @} RcppArmadillo/inst/include/armadillo_bits/unwrap_spmat.hpp0000644000176200001440000001054214635324415023632 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup unwrap_spmat //! @{ template struct unwrap_spmat { typedef typename T1::elem_type eT; typedef SpMat stored_type; inline unwrap_spmat(const T1& A) : M(A) { arma_debug_sigprint(); } const SpMat M; template constexpr bool is_alias(const SpMat&) const { return false; } }; template struct unwrap_spmat< SpMat > { typedef SpMat stored_type; inline unwrap_spmat(const SpMat& A) : M(A) { arma_debug_sigprint(); M.sync(); } const SpMat& M; template arma_inline bool is_alias(const SpMat& X) const { return (is_same_type::yes) && (void_ptr(&M) == void_ptr(&X)); } }; template struct unwrap_spmat< SpRow > { typedef SpRow stored_type; inline unwrap_spmat(const SpRow& A) : M(A) { arma_debug_sigprint(); M.sync(); } const SpRow& M; template arma_inline bool is_alias(const SpMat& X) const { return (is_same_type::yes) && (void_ptr(&M) == void_ptr(&X)); } }; template struct unwrap_spmat< SpCol > { typedef SpCol stored_type; inline unwrap_spmat(const SpCol& A) : M(A) { arma_debug_sigprint(); M.sync(); } const SpCol& M; template arma_inline bool is_alias(const SpMat& X) const { return (is_same_type::yes) && (void_ptr(&M) == void_ptr(&X)); } }; template struct unwrap_spmat< SpOp > { typedef typename T1::elem_type eT; typedef SpMat stored_type; inline unwrap_spmat(const SpOp& A) : M(A) { arma_debug_sigprint(); } const SpMat M; template constexpr bool is_alias(const SpMat&) const { return false; } }; template struct unwrap_spmat< SpGlue > { typedef typename T1::elem_type eT; typedef SpMat stored_type; inline unwrap_spmat(const SpGlue& A) : M(A) { arma_debug_sigprint(); } const SpMat M; template constexpr bool is_alias(const SpMat&) const { return false; } }; template struct unwrap_spmat< mtSpOp > { typedef SpMat stored_type; inline unwrap_spmat(const mtSpOp& A) : M(A) { arma_debug_sigprint(); } const SpMat M; template constexpr bool is_alias(const SpMat&) const { return false; } }; template struct unwrap_spmat< mtSpGlue > { typedef SpMat stored_type; inline unwrap_spmat(const mtSpGlue& A) : M(A) { arma_debug_sigprint(); } const SpMat M; template constexpr bool is_alias(const SpMat&) const { return false; } }; template struct unwrap_spmat< mtSpReduceOp > { typedef SpMat stored_type; inline unwrap_spmat(const mtSpReduceOp& A) : M(A) { arma_debug_sigprint(); } const SpMat M; template constexpr bool is_alias(const SpMat&) const { return false; } }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_shift_meat.hpp0000644000176200001440000001125614631567470023744 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_shift //! @{ template inline void op_shift_vec::apply(Mat& out, const Op& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const quasi_unwrap U(in.m); const uword len = in.aux_uword_a; const uword neg = in.aux_uword_b; const uword dim = (T1::is_xvec) ? uword(U.M.is_rowvec() ? 1 : 0) : uword((T1::is_row) ? 1 : 0); if(U.is_alias(out)) { Mat tmp; op_shift::apply_noalias(tmp, U.M, len, neg, dim); out.steal_mem(tmp); } else { op_shift::apply_noalias(out, U.M, len, neg, dim); } } template inline void op_shift::apply_noalias(Mat& out, const Mat& X, const uword len, const uword neg, const uword dim) { arma_debug_sigprint(); arma_conform_check_bounds( ((dim == 0) && (len >= X.n_rows)), "shift(): shift amount out of bounds" ); arma_conform_check_bounds( ((dim == 1) && (len >= X.n_cols)), "shift(): shift amount out of bounds" ); if(len == 0) { out = X; return; } out.copy_size(X); const uword X_n_rows = X.n_rows; const uword X_n_cols = X.n_cols; if(dim == 0) { if(neg == 0) { for(uword col=0; col < X_n_cols; ++col) { eT* out_ptr = out.colptr(col); const eT* X_ptr = X.colptr(col); for(uword out_row=len, row=0; row < (X_n_rows - len); ++row, ++out_row) { out_ptr[out_row] = X_ptr[row]; } for(uword out_row=0, row=(X_n_rows - len); row < X_n_rows; ++row, ++out_row) { out_ptr[out_row] = X_ptr[row]; } } } else if(neg == 1) { for(uword col=0; col < X_n_cols; ++col) { eT* out_ptr = out.colptr(col); const eT* X_ptr = X.colptr(col); for(uword out_row=0, row=len; row < X_n_rows; ++row, ++out_row) { out_ptr[out_row] = X_ptr[row]; } for(uword out_row=(X_n_rows-len), row=0; row < len; ++row, ++out_row) { out_ptr[out_row] = X_ptr[row]; } } } } else if(dim == 1) { if(neg == 0) { if(X_n_rows == 1) { eT* out_ptr = out.memptr(); const eT* X_ptr = X.memptr(); for(uword out_col=len, col=0; col < (X_n_cols - len); ++col, ++out_col) { out_ptr[out_col] = X_ptr[col]; } for(uword out_col=0, col=(X_n_cols - len); col < X_n_cols; ++col, ++out_col) { out_ptr[out_col] = X_ptr[col]; } } else { for(uword out_col=len, col=0; col < (X_n_cols - len); ++col, ++out_col) { arrayops::copy( out.colptr(out_col), X.colptr(col), X_n_rows ); } for(uword out_col=0, col=(X_n_cols - len); col < X_n_cols; ++col, ++out_col) { arrayops::copy( out.colptr(out_col), X.colptr(col), X_n_rows ); } } } else if(neg == 1) { if(X_n_rows == 1) { eT* out_ptr = out.memptr(); const eT* X_ptr = X.memptr(); for(uword out_col=0, col=len; col < X_n_cols; ++col, ++out_col) { out_ptr[out_col] = X_ptr[col]; } for(uword out_col=(X_n_cols-len), col=0; col < len; ++col, ++out_col) { out_ptr[out_col] = X_ptr[col]; } } else { for(uword out_col=0, col=len; col < X_n_cols; ++col, ++out_col) { arrayops::copy( out.colptr(out_col), X.colptr(col), X_n_rows ); } for(uword out_col=(X_n_cols-len), col=0; col < len; ++col, ++out_col) { arrayops::copy( out.colptr(out_col), X.colptr(col), X_n_rows ); } } } } } //! @} RcppArmadillo/inst/include/armadillo_bits/SpToDGlue_meat.hpp0000644000176200001440000000222514631567470023733 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup SpToDGlue //! @{ template inline SpToDGlue::SpToDGlue(const T1& in_A, const T2& in_B) : A(in_A) , B(in_B) { arma_debug_sigprint(); } template inline SpToDGlue::~SpToDGlue() { arma_debug_sigprint(); } //! @} RcppArmadillo/inst/include/armadillo_bits/operator_ostream.hpp0000644000176200001440000000602014631567470024501 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup operator_ostream //! @{ template inline std::ostream& operator<< (std::ostream& o, const Base& X) { arma_debug_sigprint(); const unwrap tmp(X.get_ref()); arma_ostream::print(o, tmp.M, true); return o; } template inline std::ostream& operator<< (std::ostream& o, const SpBase& X) { arma_debug_sigprint(); const unwrap_spmat tmp(X.get_ref()); arma_ostream::print(o, tmp.M, true); return o; } template inline std::ostream& operator<< (std::ostream& o, const SpValProxy& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; o << eT(X); return o; } template inline std::ostream& operator<< (std::ostream& o, const MapMat_val& X) { arma_debug_sigprint(); o << eT(X); return o; } template inline std::ostream& operator<< (std::ostream& o, const SpMat_MapMat_val& X) { arma_debug_sigprint(); o << eT(X); return o; } template inline std::ostream& operator<< (std::ostream& o, const SpSubview_MapMat_val& X) { arma_debug_sigprint(); o << eT(X); return o; } template inline std::ostream& operator<< (std::ostream& o, const BaseCube& X) { arma_debug_sigprint(); const unwrap_cube tmp(X.get_ref()); arma_ostream::print(o, tmp.M, true); return o; } //! Print the contents of a field to the specified stream. template inline std::ostream& operator<< (std::ostream& o, const field& X) { arma_debug_sigprint(); arma_ostream::print(o, X); return o; } //! Print the contents of a subfield to the specified stream template inline std::ostream& operator<< (std::ostream& o, const subview_field& X) { arma_debug_sigprint(); arma_ostream::print(o, X); return o; } inline std::ostream& operator<< (std::ostream& o, const SizeMat& S) { arma_debug_sigprint(); arma_ostream::print(o, S); return o; } inline std::ostream& operator<< (std::ostream& o, const SizeCube& S) { arma_debug_sigprint(); arma_ostream::print(o, S); return o; } //! @} RcppArmadillo/inst/include/armadillo_bits/op_expmat_bones.hpp0000644000176200001440000000273514301267043024272 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_expmat //! @{ class op_expmat : public traits_op_default { public: template inline static void apply(Mat& out, const Op& expr); template inline static bool apply_direct(Mat& out, const Base& X); }; class op_expmat_sym : public traits_op_default { public: template inline static void apply(Mat& out, const Op& in); template inline static bool apply_direct(Mat& out, const Base& expr); }; //! @} RcppArmadillo/inst/include/armadillo_bits/MapMat_meat.hpp0000644000176200001440000010006215030507611023263 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup MapMat //! @{ template inline MapMat::~MapMat() { arma_debug_sigprint_this(this); if(map_ptr) { (*map_ptr).clear(); delete map_ptr; } // try to expose buggy user code that accesses deleted objects map_ptr = nullptr; arma_type_check(( is_supported_elem_type::value == false )); } template inline MapMat::MapMat() : n_rows (0) , n_cols (0) , n_elem (0) , map_ptr(nullptr) { arma_debug_sigprint_this(this); init_cold(); } template inline MapMat::MapMat(const uword in_n_rows, const uword in_n_cols) : n_rows (in_n_rows) , n_cols (in_n_cols) , n_elem (in_n_rows * in_n_cols) , map_ptr(nullptr) { arma_debug_sigprint_this(this); init_cold(); } template inline MapMat::MapMat(const SizeMat& s) : n_rows (s.n_rows) , n_cols (s.n_cols) , n_elem (s.n_rows * s.n_cols) , map_ptr(nullptr) { arma_debug_sigprint_this(this); init_cold(); } template inline MapMat::MapMat(const MapMat& x) : n_rows (0) , n_cols (0) , n_elem (0) , map_ptr(nullptr) { arma_debug_sigprint_this(this); init_cold(); (*this).operator=(x); } template inline void MapMat::operator=(const MapMat& x) { arma_debug_sigprint(); if(this == &x) { arma_debug_print("MapMat::operator=(): copy omitted"); return; } access::rw(n_rows) = x.n_rows; access::rw(n_cols) = x.n_cols; access::rw(n_elem) = x.n_elem; (*map_ptr) = *(x.map_ptr); } template inline MapMat::MapMat(const SpMat& x) : n_rows (0) , n_cols (0) , n_elem (0) , map_ptr(nullptr) { arma_debug_sigprint_this(this); init_cold(); (*this).operator=(x); } template inline void MapMat::operator=(const SpMat& x) { arma_debug_sigprint(); const uword x_n_rows = x.n_rows; const uword x_n_cols = x.n_cols; (*this).zeros(x_n_rows, x_n_cols); if(x.n_nonzero == 0) { return; } const eT* x_values = x.values; const uword* x_row_indices = x.row_indices; const uword* x_col_ptrs = x.col_ptrs; map_type& map_ref = (*map_ptr); for(uword col = 0; col < x_n_cols; ++col) { const uword start = x_col_ptrs[col ]; const uword end = x_col_ptrs[col + 1]; for(uword i = start; i < end; ++i) { const uword row = x_row_indices[i]; const eT val = x_values[i]; const uword index = (x_n_rows * col) + row; map_ref.emplace_hint(map_ref.cend(), index, val); } } } template inline MapMat::MapMat(MapMat&& x) : n_rows (x.n_rows ) , n_cols (x.n_cols ) , n_elem (x.n_elem ) , map_ptr(x.map_ptr) { arma_debug_sigprint_this(this); access::rw(x.n_rows) = 0; access::rw(x.n_cols) = 0; access::rw(x.n_elem) = 0; access::rw(x.map_ptr) = nullptr; } template inline void MapMat::operator=(MapMat&& x) { arma_debug_sigprint(); if(this == &x) { return; } reset(); if(map_ptr) { delete map_ptr; } access::rw(n_rows) = x.n_rows; access::rw(n_cols) = x.n_cols; access::rw(n_elem) = x.n_elem; access::rw(map_ptr) = x.map_ptr; access::rw(x.n_rows) = 0; access::rw(x.n_cols) = 0; access::rw(x.n_elem) = 0; access::rw(x.map_ptr) = nullptr; } template inline void MapMat::reset() { arma_debug_sigprint(); access::rw(n_rows) = 0; access::rw(n_cols) = 0; access::rw(n_elem) = 0; if((*map_ptr).empty() == false) { (*map_ptr).clear(); } } template inline void MapMat::set_size(const uword in_n_rows) { arma_debug_sigprint(); init_warm(in_n_rows, 1); } template inline void MapMat::set_size(const uword in_n_rows, const uword in_n_cols) { arma_debug_sigprint(); init_warm(in_n_rows, in_n_cols); } template inline void MapMat::set_size(const SizeMat& s) { arma_debug_sigprint(); init_warm(s.n_rows, s.n_cols); } template inline void MapMat::zeros() { arma_debug_sigprint(); (*map_ptr).clear(); } template inline void MapMat::zeros(const uword in_n_rows) { arma_debug_sigprint(); init_warm(in_n_rows, 1); (*map_ptr).clear(); } template inline void MapMat::zeros(const uword in_n_rows, const uword in_n_cols) { arma_debug_sigprint(); init_warm(in_n_rows, in_n_cols); (*map_ptr).clear(); } template inline void MapMat::zeros(const SizeMat& s) { arma_debug_sigprint(); init_warm(s.n_rows, s.n_cols); (*map_ptr).clear(); } template inline void MapMat::eye() { arma_debug_sigprint(); (*this).eye(n_rows, n_cols); } template inline void MapMat::eye(const uword in_n_rows, const uword in_n_cols) { arma_debug_sigprint(); zeros(in_n_rows, in_n_cols); const uword N = (std::min)(in_n_rows, in_n_cols); map_type& map_ref = (*map_ptr); for(uword i=0; i inline void MapMat::eye(const SizeMat& s) { arma_debug_sigprint(); (*this).eye(s.n_rows, s.n_cols); } template inline void MapMat::speye() { arma_debug_sigprint(); (*this).eye(); } template inline void MapMat::speye(const uword in_n_rows, const uword in_n_cols) { arma_debug_sigprint(); (*this).eye(in_n_rows, in_n_cols); } template inline void MapMat::speye(const SizeMat& s) { arma_debug_sigprint(); (*this).eye(s); } template arma_inline MapMat_val MapMat::operator[](const uword index) { return MapMat_val(*this, index); } template inline eT MapMat::operator[](const uword index) const { map_type& map_ref = (*map_ptr); typename map_type::const_iterator it = map_ref.find(index); typename map_type::const_iterator it_end = map_ref.end(); return (it != it_end) ? eT((*it).second) : eT(0); } template arma_inline MapMat_val MapMat::operator()(const uword index) { arma_conform_check_bounds( (index >= n_elem), "MapMat::operator(): index out of bounds" ); return MapMat_val(*this, index); } template inline eT MapMat::operator()(const uword index) const { arma_conform_check_bounds( (index >= n_elem), "MapMat::operator(): index out of bounds" ); map_type& map_ref = (*map_ptr); typename map_type::const_iterator it = map_ref.find(index); typename map_type::const_iterator it_end = map_ref.end(); return (it != it_end) ? eT((*it).second) : eT(0); } template arma_inline MapMat_val MapMat::at(const uword in_row, const uword in_col) { const uword index = (n_rows * in_col) + in_row; return MapMat_val(*this, index); } template inline eT MapMat::at(const uword in_row, const uword in_col) const { const uword index = (n_rows * in_col) + in_row; map_type& map_ref = (*map_ptr); typename map_type::const_iterator it = map_ref.find(index); typename map_type::const_iterator it_end = map_ref.end(); return (it != it_end) ? eT((*it).second) : eT(0); } template arma_inline MapMat_val MapMat::operator()(const uword in_row, const uword in_col) { arma_conform_check_bounds( ((in_row >= n_rows) || (in_col >= n_cols)), "MapMat::operator(): index out of bounds" ); const uword index = (n_rows * in_col) + in_row; return MapMat_val(*this, index); } template inline eT MapMat::operator()(const uword in_row, const uword in_col) const { arma_conform_check_bounds( ((in_row >= n_rows) || (in_col >= n_cols)), "MapMat::operator(): index out of bounds" ); const uword index = (n_rows * in_col) + in_row; map_type& map_ref = (*map_ptr); typename map_type::const_iterator it = map_ref.find(index); typename map_type::const_iterator it_end = map_ref.end(); return (it != it_end) ? eT((*it).second) : eT(0); } template inline bool MapMat::is_empty() const { return (n_elem == 0); } template inline bool MapMat::is_vec() const { return ( (n_rows == 1) || (n_cols == 1) ); } template inline bool MapMat::is_rowvec() const { return (n_rows == 1); } //! returns true if the object can be interpreted as a column vector template inline bool MapMat::is_colvec() const { return (n_cols == 1); } template inline bool MapMat::is_square() const { return (n_rows == n_cols); } // this function is for debugging purposes only template inline void MapMat::sprandu(const uword in_n_rows, const uword in_n_cols, const double density) { arma_debug_sigprint(); zeros(in_n_rows, in_n_cols); const uword N = uword(density * double(n_elem)); const Col vals(N, fill::randu); const Col indx = linspace< Col >(0, ((n_elem > 0) ? uword(n_elem-1) : uword(0)) , N); const eT* vals_mem = vals.memptr(); const uword* indx_mem = indx.memptr(); map_type& map_ref = (*map_ptr); for(uword i=0; i < N; ++i) { const uword index = indx_mem[i]; const eT val = vals_mem[i]; map_ref.emplace_hint(map_ref.cend(), index, val); } } // this function is for debugging purposes only template inline void MapMat::print(const std::string& extra_text) const { arma_debug_sigprint(); if(extra_text.length() != 0) { const std::streamsize orig_width = get_cout_stream().width(); get_cout_stream() << extra_text << '\n'; get_cout_stream().width(orig_width); } map_type& map_ref = (*map_ptr); const uword n_nonzero = uword(map_ref.size()); const double density = (n_elem > 0) ? ((double(n_nonzero) / double(n_elem))*double(100)) : double(0); get_cout_stream() << "[matrix size: " << n_rows << 'x' << n_cols << "; n_nonzero: " << n_nonzero << "; density: " << density << "%]\n\n"; if(n_nonzero > 0) { typename map_type::const_iterator it = map_ref.begin(); for(uword i=0; i < n_nonzero; ++i) { const std::pair& entry = (*it); const uword index = entry.first; const eT val = entry.second; const uword row = index % n_rows; const uword col = index / n_rows; get_cout_stream() << '(' << row << ", " << col << ") "; get_cout_stream() << val << '\n'; ++it; } } get_cout_stream().flush(); } template inline uword MapMat::get_n_nonzero() const { arma_debug_sigprint(); return uword((*map_ptr).size()); } template inline void MapMat::get_locval_format(umat& locs, Col& vals) const { arma_debug_sigprint(); map_type& map_ref = (*map_ptr); typename map_type::const_iterator it = map_ref.begin(); const uword N = uword(map_ref.size()); locs.set_size(2,N); vals.set_size(N); eT* vals_mem = vals.memptr(); for(uword i=0; i& entry = (*it); const uword index = entry.first; const eT val = entry.second; const uword row = index % n_rows; const uword col = index / n_rows; uword* locs_colptr = locs.colptr(i); locs_colptr[0] = row; locs_colptr[1] = col; vals_mem[i] = val; ++it; } } template inline void MapMat::init_cold() { arma_debug_sigprint(); // ensure that n_elem can hold the result of (n_rows * n_cols) #if defined(ARMA_64BIT_WORD) const char* error_message = "MapMat(): requested size is too large"; #else const char* error_message = "MapMat(): requested size is too large; suggest to enable ARMA_64BIT_WORD"; #endif arma_conform_check ( ( ( (n_rows > ARMA_MAX_UHWORD) || (n_cols > ARMA_MAX_UHWORD) ) ? ( (double(n_rows) * double(n_cols)) > double(ARMA_MAX_UWORD) ) : false ), error_message ); map_ptr = new (std::nothrow) map_type; arma_check_bad_alloc( (map_ptr == nullptr), "MapMat(): out of memory" ); } template inline void MapMat::init_warm(const uword in_n_rows, const uword in_n_cols) { arma_debug_sigprint(); if( (n_rows == in_n_rows) && (n_cols == in_n_cols)) { return; } // ensure that n_elem can hold the result of (n_rows * n_cols) #if defined(ARMA_64BIT_WORD) const char* error_message = "MapMat(): requested size is too large"; #else const char* error_message = "MapMat(): requested size is too large; suggest to enable ARMA_64BIT_WORD"; #endif arma_conform_check ( ( ( (in_n_rows > ARMA_MAX_UHWORD) || (in_n_cols > ARMA_MAX_UHWORD) ) ? ( (double(in_n_rows) * double(in_n_cols)) > double(ARMA_MAX_UWORD) ) : false ), error_message ); const uword new_n_elem = in_n_rows * in_n_cols; access::rw(n_rows) = in_n_rows; access::rw(n_cols) = in_n_cols; access::rw(n_elem) = new_n_elem; if(new_n_elem == 0) { (*map_ptr).clear(); } } template arma_inline void MapMat::set_val(const uword index, const eT& in_val) { arma_debug_sigprint(); if(in_val != eT(0)) { map_type& map_ref = (*map_ptr); if( (map_ref.empty() == false) && (index > uword(map_ref.crbegin()->first)) ) { map_ref.emplace_hint(map_ref.cend(), index, in_val); } else { map_ref.operator[](index) = in_val; } } else { (*this).erase_val(index); } } template inline void MapMat::erase_val(const uword index) { arma_debug_sigprint(); map_type& map_ref = (*map_ptr); typename map_type::iterator it = map_ref.find(index); typename map_type::iterator it_end = map_ref.end(); if(it != it_end) { map_ref.erase(it); } } // MapMat_val template arma_inline MapMat_val::MapMat_val(MapMat& in_parent, const uword in_index) : parent(in_parent) , index (in_index ) { arma_debug_sigprint(); } template arma_inline MapMat_val::operator eT() const { arma_debug_sigprint(); const MapMat& const_parent = parent; return const_parent.operator[](index); } template arma_inline typename get_pod_type::result MapMat_val::real() const { arma_debug_sigprint(); typedef typename get_pod_type::result T; const MapMat& const_parent = parent; return T( access::tmp_real( const_parent.operator[](index) ) ); } template arma_inline typename get_pod_type::result MapMat_val::imag() const { arma_debug_sigprint(); typedef typename get_pod_type::result T; const MapMat& const_parent = parent; return T( access::tmp_imag( const_parent.operator[](index) ) ); } template arma_inline void MapMat_val::operator=(const MapMat_val& x) { arma_debug_sigprint(); const eT in_val = eT(x); parent.set_val(index, in_val); } template arma_inline void MapMat_val::operator=(const eT in_val) { arma_debug_sigprint(); parent.set_val(index, in_val); } template arma_inline void MapMat_val::operator+=(const eT in_val) { arma_debug_sigprint(); typename MapMat::map_type& map_ref = *(parent.map_ptr); if(in_val != eT(0)) { eT& val = map_ref.operator[](index); // creates the element if it doesn't exist val += in_val; if(val == eT(0)) { map_ref.erase(index); } } } template arma_inline void MapMat_val::operator-=(const eT in_val) { arma_debug_sigprint(); typename MapMat::map_type& map_ref = *(parent.map_ptr); if(in_val != eT(0)) { eT& val = map_ref.operator[](index); // creates the element if it doesn't exist val -= in_val; if(val == eT(0)) { map_ref.erase(index); } } } template arma_inline void MapMat_val::operator*=(const eT in_val) { arma_debug_sigprint(); typename MapMat::map_type& map_ref = *(parent.map_ptr); typename MapMat::map_type::iterator it = map_ref.find(index); typename MapMat::map_type::iterator it_end = map_ref.end(); if(it != it_end) { eT& val = (*it).second; val *= in_val; if(val == eT(0)) { map_ref.erase(it); } } else { const eT val = eT(0) * in_val; // in case in_val is inf or nan if(val != eT(0)) { parent.set_val(index, val); } } } template arma_inline void MapMat_val::operator/=(const eT in_val) { arma_debug_sigprint(); typename MapMat::map_type& map_ref = *(parent.map_ptr); typename MapMat::map_type::iterator it = map_ref.find(index); typename MapMat::map_type::iterator it_end = map_ref.end(); if(it != it_end) { eT& val = (*it).second; val /= in_val; if(val == eT(0)) { map_ref.erase(it); } } else { const eT val = eT(0) / in_val; // in case in_val is zero or nan if(val != eT(0)) { parent.set_val(index, val); } } } template arma_inline void MapMat_val::operator++() { arma_debug_sigprint(); typename MapMat::map_type& map_ref = *(parent.map_ptr); eT& val = map_ref.operator[](index); // creates the element if it doesn't exist val += eT(1); // can't use ++, as eT can be std::complex if(val == eT(0)) { map_ref.erase(index); } } template arma_inline void MapMat_val::operator++(int) { arma_debug_sigprint(); (*this).operator++(); } template arma_inline void MapMat_val::operator--() { arma_debug_sigprint(); typename MapMat::map_type& map_ref = *(parent.map_ptr); eT& val = map_ref.operator[](index); // creates the element if it doesn't exist val -= eT(1); // can't use --, as eT can be std::complex if(val == eT(0)) { map_ref.erase(index); } } template arma_inline void MapMat_val::operator--(int) { arma_debug_sigprint(); (*this).operator--(); } // SpMat_MapMat_val template arma_inline SpMat_MapMat_val::SpMat_MapMat_val(SpMat& in_s_parent, MapMat& in_m_parent, const uword in_row, const uword in_col) : s_parent(in_s_parent) , m_parent(in_m_parent) , row (in_row ) , col (in_col ) { arma_debug_sigprint(); } template inline SpMat_MapMat_val::operator eT() const { arma_debug_sigprint(); const SpMat& const_s_parent = s_parent; // declare as const for clarity of intent return const_s_parent.get_value(row,col); } template inline typename get_pod_type::result SpMat_MapMat_val::real() const { arma_debug_sigprint(); typedef typename get_pod_type::result T; const SpMat& const_s_parent = s_parent; // declare as const for clarity of intent return T( access::tmp_real( const_s_parent.get_value(row,col) ) ); } template inline typename get_pod_type::result SpMat_MapMat_val::imag() const { arma_debug_sigprint(); typedef typename get_pod_type::result T; const SpMat& const_s_parent = s_parent; // declare as const for clarity of intent return T( access::tmp_imag( const_s_parent.get_value(row,col) ) ); } template inline SpMat_MapMat_val& SpMat_MapMat_val::operator=(const SpMat_MapMat_val& x) { arma_debug_sigprint(); const eT in_val = eT(x); return (*this).operator=(in_val); } template inline SpMat_MapMat_val& SpMat_MapMat_val::operator=(const eT in_val) { arma_debug_sigprint(); #if defined(ARMA_USE_OPENMP) { #pragma omp critical (arma_SpMat_cache) { (*this).set(in_val); } } #elif defined(ARMA_USE_STD_MUTEX) { const std::lock_guard lock(s_parent.cache_mutex); (*this).set(in_val); } #else { (*this).set(in_val); } #endif return *this; } template inline SpMat_MapMat_val& SpMat_MapMat_val::operator+=(const eT in_val) { arma_debug_sigprint(); if(in_val == eT(0)) { return *this; } #if defined(ARMA_USE_OPENMP) { #pragma omp critical (arma_SpMat_cache) { (*this).add(in_val); } } #elif defined(ARMA_USE_STD_MUTEX) { const std::lock_guard lock(s_parent.cache_mutex); (*this).add(in_val); } #else { (*this).add(in_val); } #endif return *this; } template inline SpMat_MapMat_val& SpMat_MapMat_val::operator-=(const eT in_val) { arma_debug_sigprint(); if(in_val == eT(0)) { return *this; } #if defined(ARMA_USE_OPENMP) { #pragma omp critical (arma_SpMat_cache) { (*this).sub(in_val); } } #elif defined(ARMA_USE_STD_MUTEX) { const std::lock_guard lock(s_parent.cache_mutex); (*this).sub(in_val); } #else { (*this).sub(in_val); } #endif return *this; } template inline SpMat_MapMat_val& SpMat_MapMat_val::operator*=(const eT in_val) { arma_debug_sigprint(); #if defined(ARMA_USE_OPENMP) { #pragma omp critical (arma_SpMat_cache) { (*this).mul(in_val); } } #elif defined(ARMA_USE_STD_MUTEX) { const std::lock_guard lock(s_parent.cache_mutex); (*this).mul(in_val); } #else { (*this).mul(in_val); } #endif return *this; } template inline SpMat_MapMat_val& SpMat_MapMat_val::operator/=(const eT in_val) { arma_debug_sigprint(); #if defined(ARMA_USE_OPENMP) { #pragma omp critical (arma_SpMat_cache) { (*this).div(in_val); } } #elif defined(ARMA_USE_STD_MUTEX) { const std::lock_guard lock(s_parent.cache_mutex); (*this).div(in_val); } #else { (*this).div(in_val); } #endif return *this; } template inline SpMat_MapMat_val& SpMat_MapMat_val::operator++() { arma_debug_sigprint(); return (*this).operator+=( eT(1) ); } template inline eT SpMat_MapMat_val::operator++(int) { arma_debug_sigprint(); const eT old_val = eT(*this); (*this).operator+=( eT(1) ); return old_val; } template inline SpMat_MapMat_val& SpMat_MapMat_val::operator--() { arma_debug_sigprint(); return (*this).operator-=( eT(1) ); } template inline eT SpMat_MapMat_val::operator--(int) { arma_debug_sigprint(); const eT old_val = eT(*this); (*this).operator-=( eT(1) ); return old_val; } template inline void SpMat_MapMat_val::set(const eT in_val) { arma_debug_sigprint(); const bool done = (s_parent.sync_state == 0) ? s_parent.try_set_value_csc(row, col, in_val) : false; if(done == false) { s_parent.sync_cache_simple(); const uword index = (m_parent.n_rows * col) + row; m_parent.set_val(index, in_val); s_parent.sync_state = 1; access::rw(s_parent.n_nonzero) = m_parent.get_n_nonzero(); } } template inline void SpMat_MapMat_val::add(const eT in_val) { arma_debug_sigprint(); const bool done = (s_parent.sync_state == 0) ? s_parent.try_add_value_csc(row, col, in_val) : false; if(done == false) { s_parent.sync_cache_simple(); const uword index = (m_parent.n_rows * col) + row; typename MapMat::map_type& map_ref = *(m_parent.map_ptr); eT& val = map_ref.operator[](index); // creates the element if it doesn't exist val += in_val; if(val == eT(0)) { map_ref.erase(index); } s_parent.sync_state = 1; access::rw(s_parent.n_nonzero) = m_parent.get_n_nonzero(); } } template inline void SpMat_MapMat_val::sub(const eT in_val) { arma_debug_sigprint(); const bool done = (s_parent.sync_state == 0) ? s_parent.try_sub_value_csc(row, col, in_val) : false; if(done == false) { s_parent.sync_cache_simple(); const uword index = (m_parent.n_rows * col) + row; typename MapMat::map_type& map_ref = *(m_parent.map_ptr); eT& val = map_ref.operator[](index); // creates the element if it doesn't exist val -= in_val; if(val == eT(0)) { map_ref.erase(index); } s_parent.sync_state = 1; access::rw(s_parent.n_nonzero) = m_parent.get_n_nonzero(); } } template inline void SpMat_MapMat_val::mul(const eT in_val) { arma_debug_sigprint(); const bool done = (s_parent.sync_state == 0) ? s_parent.try_mul_value_csc(row, col, in_val) : false; if(done == false) { s_parent.sync_cache_simple(); const uword index = (m_parent.n_rows * col) + row; typename MapMat::map_type& map_ref = *(m_parent.map_ptr); typename MapMat::map_type::iterator it = map_ref.find(index); typename MapMat::map_type::iterator it_end = map_ref.end(); if(it != it_end) { eT& val = (*it).second; val *= in_val; if(val == eT(0)) { map_ref.erase(it); } s_parent.sync_state = 1; access::rw(s_parent.n_nonzero) = m_parent.get_n_nonzero(); } else { const eT result = eT(0) * in_val; // in case in_val is inf or nan if(result != eT(0)) { m_parent.set_val(index, result); s_parent.sync_state = 1; access::rw(s_parent.n_nonzero) = m_parent.get_n_nonzero(); } } } } template inline void SpMat_MapMat_val::div(const eT in_val) { arma_debug_sigprint(); const bool done = (s_parent.sync_state == 0) ? s_parent.try_div_value_csc(row, col, in_val) : false; if(done == false) { s_parent.sync_cache_simple(); const uword index = (m_parent.n_rows * col) + row; typename MapMat::map_type& map_ref = *(m_parent.map_ptr); typename MapMat::map_type::iterator it = map_ref.find(index); typename MapMat::map_type::iterator it_end = map_ref.end(); if(it != it_end) { eT& val = (*it).second; val /= in_val; if(val == eT(0)) { map_ref.erase(it); } s_parent.sync_state = 1; access::rw(s_parent.n_nonzero) = m_parent.get_n_nonzero(); } else { const eT result = eT(0) / in_val; // in case in_val is zero or nan if(result != eT(0)) { m_parent.set_val(index, result); s_parent.sync_state = 1; access::rw(s_parent.n_nonzero) = m_parent.get_n_nonzero(); } } } } // SpSubview_MapMat_val template arma_inline SpSubview_MapMat_val::SpSubview_MapMat_val(SpSubview& in_sv_parent, MapMat& in_m_parent, const uword in_row, const uword in_col) : SpMat_MapMat_val(access::rw(in_sv_parent.m), in_m_parent, in_row, in_col) , sv_parent(in_sv_parent) { arma_debug_sigprint(); } template inline SpSubview_MapMat_val& SpSubview_MapMat_val::operator=(const SpSubview_MapMat_val& x) { arma_debug_sigprint(); const eT in_val = eT(x); return (*this).operator=(in_val); } template inline SpSubview_MapMat_val& SpSubview_MapMat_val::operator=(const eT in_val) { arma_debug_sigprint(); const uword old_n_nonzero = sv_parent.m.n_nonzero; SpMat_MapMat_val::operator=(in_val); if(sv_parent.m.n_nonzero > old_n_nonzero) { access::rw(sv_parent.n_nonzero)++; } if(sv_parent.m.n_nonzero < old_n_nonzero) { access::rw(sv_parent.n_nonzero)--; } return *this; } template inline SpSubview_MapMat_val& SpSubview_MapMat_val::operator+=(const eT in_val) { arma_debug_sigprint(); const uword old_n_nonzero = sv_parent.m.n_nonzero; SpMat_MapMat_val::operator+=(in_val); if(sv_parent.m.n_nonzero > old_n_nonzero) { access::rw(sv_parent.n_nonzero)++; } if(sv_parent.m.n_nonzero < old_n_nonzero) { access::rw(sv_parent.n_nonzero)--; } return *this; } template inline SpSubview_MapMat_val& SpSubview_MapMat_val::operator-=(const eT in_val) { arma_debug_sigprint(); const uword old_n_nonzero = sv_parent.m.n_nonzero; SpMat_MapMat_val::operator-=(in_val); if(sv_parent.m.n_nonzero > old_n_nonzero) { access::rw(sv_parent.n_nonzero)++; } if(sv_parent.m.n_nonzero < old_n_nonzero) { access::rw(sv_parent.n_nonzero)--; } return *this; } template inline SpSubview_MapMat_val& SpSubview_MapMat_val::operator*=(const eT in_val) { arma_debug_sigprint(); const uword old_n_nonzero = sv_parent.m.n_nonzero; SpMat_MapMat_val::operator*=(in_val); if(sv_parent.m.n_nonzero > old_n_nonzero) { access::rw(sv_parent.n_nonzero)++; } if(sv_parent.m.n_nonzero < old_n_nonzero) { access::rw(sv_parent.n_nonzero)--; } return *this; } template inline SpSubview_MapMat_val& SpSubview_MapMat_val::operator/=(const eT in_val) { arma_debug_sigprint(); const uword old_n_nonzero = sv_parent.m.n_nonzero; SpMat_MapMat_val::operator/=(in_val); if(sv_parent.m.n_nonzero > old_n_nonzero) { access::rw(sv_parent.n_nonzero)++; } if(sv_parent.m.n_nonzero < old_n_nonzero) { access::rw(sv_parent.n_nonzero)--; } return *this; } template inline SpSubview_MapMat_val& SpSubview_MapMat_val::operator++() { arma_debug_sigprint(); const uword old_n_nonzero = sv_parent.m.n_nonzero; SpMat_MapMat_val::operator++(); if(sv_parent.m.n_nonzero > old_n_nonzero) { access::rw(sv_parent.n_nonzero)++; } if(sv_parent.m.n_nonzero < old_n_nonzero) { access::rw(sv_parent.n_nonzero)--; } return *this; } template inline eT SpSubview_MapMat_val::operator++(int) { arma_debug_sigprint(); const uword old_n_nonzero = sv_parent.m.n_nonzero; const eT old_val = SpMat_MapMat_val::operator++(int(0)); if(sv_parent.m.n_nonzero > old_n_nonzero) { access::rw(sv_parent.n_nonzero)++; } if(sv_parent.m.n_nonzero < old_n_nonzero) { access::rw(sv_parent.n_nonzero)--; } return old_val; } template inline SpSubview_MapMat_val& SpSubview_MapMat_val::operator--() { arma_debug_sigprint(); const uword old_n_nonzero = sv_parent.m.n_nonzero; SpMat_MapMat_val::operator--(); if(sv_parent.m.n_nonzero > old_n_nonzero) { access::rw(sv_parent.n_nonzero)++; } if(sv_parent.m.n_nonzero < old_n_nonzero) { access::rw(sv_parent.n_nonzero)--; } return *this; } template inline eT SpSubview_MapMat_val::operator--(int) { arma_debug_sigprint(); const uword old_n_nonzero = sv_parent.m.n_nonzero; const eT old_val = SpMat_MapMat_val::operator--(int(0)); if(sv_parent.m.n_nonzero > old_n_nonzero) { access::rw(sv_parent.n_nonzero)++; } if(sv_parent.m.n_nonzero < old_n_nonzero) { access::rw(sv_parent.n_nonzero)--; } return old_val; } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_orth_null.hpp0000644000176200001440000000464314635324415023610 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_orth_null //! @{ template arma_warn_unused arma_inline typename enable_if2< is_real::value, const Op >::result orth(const Base& X, const typename T1::pod_type tol = 0.0) { arma_debug_sigprint(); typedef typename T1::elem_type eT; return Op(X.get_ref(), eT(tol)); } template inline typename enable_if2< is_real::value, bool >::result orth(Mat& out, const Base& X, const typename T1::pod_type tol = 0.0) { arma_debug_sigprint(); const bool status = op_orth::apply_direct(out, X.get_ref(), tol); if(status == false) { out.soft_reset(); arma_warn(3, "orth(): svd failed"); } return status; } // template arma_warn_unused arma_inline typename enable_if2< is_real::value, const Op >::result null(const Base& X, const typename T1::pod_type tol = 0.0) { arma_debug_sigprint(); typedef typename T1::elem_type eT; return Op(X.get_ref(), eT(tol)); } template inline typename enable_if2< is_real::value, bool >::result null(Mat& out, const Base& X, const typename T1::pod_type tol = 0.0) { arma_debug_sigprint(); const bool status = op_null::apply_direct(out, X.get_ref(), tol); if(status == false) { out.soft_reset(); arma_warn(3, "null(): svd failed"); } return status; } //! @} RcppArmadillo/inst/include/armadillo_bits/operator_cube_minus.hpp0000644000176200001440000001121514631567470025162 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup operator_cube_minus //! @{ //! unary - template arma_inline const eOpCube operator- ( const BaseCube& X ) { arma_debug_sigprint(); return eOpCube(X.get_ref()); } //! BaseCube - scalar template arma_inline const eOpCube operator- ( const BaseCube& X, const typename T1::elem_type k ) { arma_debug_sigprint(); return eOpCube(X.get_ref(), k); } //! scalar - BaseCube template arma_inline const eOpCube operator- ( const typename T1::elem_type k, const BaseCube& X ) { arma_debug_sigprint(); return eOpCube(X.get_ref(), k); } //! complex scalar - non-complex BaseCube (experimental) template arma_inline const mtOpCube, T1, op_cx_scalar_minus_pre> operator- ( const std::complex& k, const BaseCube& X ) { arma_debug_sigprint(); return mtOpCube, T1, op_cx_scalar_minus_pre>('j', X.get_ref(), k); } //! non-complex BaseCube - complex scalar (experimental) template arma_inline const mtOpCube, T1, op_cx_scalar_minus_post> operator- ( const BaseCube& X, const std::complex& k ) { arma_debug_sigprint(); return mtOpCube, T1, op_cx_scalar_minus_post>('j', X.get_ref(), k); } //! subtraction of BaseCube objects with same element type template arma_inline const eGlueCube operator- ( const BaseCube& X, const BaseCube& Y ) { arma_debug_sigprint(); return eGlueCube(X.get_ref(), Y.get_ref()); } //! subtraction of BaseCube objects with different element types template inline const mtGlueCube::result, T1, T2, glue_mixed_minus> operator- ( const BaseCube< typename force_different_type::T1_result, T1>& X, const BaseCube< typename force_different_type::T2_result, T2>& Y ) { arma_debug_sigprint(); typedef typename T1::elem_type eT1; typedef typename T2::elem_type eT2; typedef typename promote_type::result out_eT; promote_type::check(); return mtGlueCube( X.get_ref(), Y.get_ref() ); } template arma_inline Cube operator- ( const subview_cube_each1& X, const Base& Y ) { arma_debug_sigprint(); return subview_cube_each1_aux::operator_minus(X, Y.get_ref()); } template arma_inline Cube operator- ( const Base& X, const subview_cube_each1& Y ) { arma_debug_sigprint(); return subview_cube_each1_aux::operator_minus(X.get_ref(), Y); } template arma_inline Cube operator- ( const subview_cube_each2& X, const Base& Y ) { arma_debug_sigprint(); return subview_cube_each2_aux::operator_minus(X, Y.get_ref()); } template arma_inline Cube operator- ( const Base& X, const subview_cube_each2& Y ) { arma_debug_sigprint(); return subview_cube_each2_aux::operator_minus(X.get_ref(), Y); } //! @} RcppArmadillo/inst/include/armadillo_bits/newarp_DoubleShiftQR_bones.hpp0000644000176200001440000000476714301267043026334 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ namespace newarp { template class DoubleShiftQR { private: uword n; // Dimension of the matrix Mat mat_H; // A copy of the matrix to be factorised eT shift_s; // Shift constant eT shift_t; // Shift constant Mat ref_u; // Householder reflectors Col ref_nr; // How many rows does each reflector affects // 3 - A general reflector // 2 - A Givens rotation // 1 - An identity transformation const eT prec; // Approximately zero const eT eps_rel; const eT eps_abs; bool computed; // Whether matrix has been factorised inline void compute_reflector(const eT& x1, const eT& x2, const eT& x3, uword ind); arma_inline void compute_reflector(const eT* x, uword ind); // Update the block X = H(il:iu, il:iu) inline void update_block(uword il, uword iu); // P = I - 2 * u * u' = P' // PX = X - 2 * u * (u'X) inline void apply_PX(Mat& X, uword oi, uword oj, uword nrow, uword ncol, uword u_ind); // x is a pointer to a vector // Px = x - 2 * dot(x, u) * u inline void apply_PX(eT* x, uword u_ind); // XP = X - 2 * (X * u) * u' inline void apply_XP(Mat& X, uword oi, uword oj, uword nrow, uword ncol, uword u_ind); public: inline DoubleShiftQR(uword size); inline DoubleShiftQR(const Mat& mat_obj, eT s, eT t); inline void compute(const Mat& mat_obj, eT s, eT t); inline Mat matrix_QtHQ(); inline void apply_QtY(Col& y); inline void apply_YQ(Mat& Y); }; } // namespace newarp RcppArmadillo/inst/include/armadillo_bits/eOpCube_meat.hpp0000644000176200001440000000743114631567470023453 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup eOpCube //! @{ template inline eOpCube::eOpCube(const BaseCube& in_m) : P (in_m.get_ref()) { arma_debug_sigprint(); } template inline eOpCube::eOpCube(const BaseCube& in_m, const typename T1::elem_type in_aux) : P (in_m.get_ref()) , aux (in_aux) { arma_debug_sigprint(); } template inline eOpCube::eOpCube(const BaseCube& in_m, const uword in_aux_uword_a, const uword in_aux_uword_b) : P (in_m.get_ref()) , aux_uword_a (in_aux_uword_a) , aux_uword_b (in_aux_uword_b) { arma_debug_sigprint(); } template inline eOpCube::eOpCube(const BaseCube& in_m, const uword in_aux_uword_a, const uword in_aux_uword_b, const uword in_aux_uword_c) : P (in_m.get_ref()) , aux_uword_a (in_aux_uword_a) , aux_uword_b (in_aux_uword_b) , aux_uword_c (in_aux_uword_c) { arma_debug_sigprint(); } template inline eOpCube::eOpCube(const BaseCube& in_m, const typename T1::elem_type in_aux, const uword in_aux_uword_a, const uword in_aux_uword_b, const uword in_aux_uword_c) : P (in_m.get_ref()) , aux (in_aux) , aux_uword_a (in_aux_uword_a) , aux_uword_b (in_aux_uword_b) , aux_uword_c (in_aux_uword_c) { arma_debug_sigprint(); } template inline eOpCube::~eOpCube() { arma_debug_sigprint(); } template arma_inline uword eOpCube::get_n_rows() const { return P.get_n_rows(); } template arma_inline uword eOpCube::get_n_cols() const { return P.get_n_cols(); } template arma_inline uword eOpCube::get_n_elem_slice() const { return P.get_n_elem_slice(); } template arma_inline uword eOpCube::get_n_slices() const { return P.get_n_slices(); } template arma_inline uword eOpCube::get_n_elem() const { return P.get_n_elem(); } template arma_inline typename T1::elem_type eOpCube::operator[] (const uword i) const { return eop_core::process(P[i], aux); } template arma_inline typename T1::elem_type eOpCube::at(const uword row, const uword col, const uword slice) const { return eop_core::process(P.at(row, col, slice), aux); } template arma_inline typename T1::elem_type eOpCube::at_alt(const uword i) const { return eop_core::process(P.at_alt(i), aux); } //! @} RcppArmadillo/inst/include/armadillo_bits/GlueCube_bones.hpp0000644000176200001440000000267614301267043023775 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup GlueCube //! @{ //! analog of the Glue class, intended for Cube objects template class GlueCube : public BaseCube< typename T1::elem_type, GlueCube > { public: typedef typename T1::elem_type elem_type; typedef typename get_pod_type::result pod_type; inline GlueCube(const BaseCube& in_A, const BaseCube& in_B); inline ~GlueCube(); const T1& A; //!< first operand; must be derived from BaseCube const T2& B; //!< second operand; must be derived from BaseCube }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_max_meat.hpp0000644000176200001440000006560714720640014023406 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_max //! @{ template inline void op_max::apply(Mat& out, const Op& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword dim = in.aux_uword_a; arma_conform_check( (dim > 1), "max(): parameter 'dim' must be 0 or 1" ); const quasi_unwrap U(in.m); const Mat& X = U.M; if(U.is_alias(out) == false) { op_max::apply_noalias(out, X, dim); } else { Mat tmp; op_max::apply_noalias(tmp, X, dim); out.steal_mem(tmp); } } template inline void op_max::apply_noalias(Mat& out, const Mat& X, const uword dim, const typename arma_not_cx::result* junk) { arma_debug_sigprint(); arma_ignore(junk); const uword X_n_rows = X.n_rows; const uword X_n_cols = X.n_cols; if(dim == 0) { arma_debug_print("op_max::apply(): dim = 0"); out.set_size((X_n_rows > 0) ? 1 : 0, X_n_cols); if(X_n_rows == 0) { return; } eT* out_mem = out.memptr(); for(uword col=0; col 0) ? 1 : 0); if(X_n_cols == 0) { return; } eT* out_mem = out.memptr(); arrayops::copy(out_mem, X.colptr(0), X_n_rows); for(uword col=1; col out_mem[row]) { out_mem[row] = col_val; } } } } } template inline void op_max::apply_noalias(Mat& out, const Mat& X, const uword dim, const typename arma_cx_only::result* junk) { arma_debug_sigprint(); arma_ignore(junk); const uword X_n_rows = X.n_rows; const uword X_n_cols = X.n_cols; if(dim == 0) { arma_debug_print("op_max::apply(): dim = 0"); out.set_size((X_n_rows > 0) ? 1 : 0, X_n_cols); if(X_n_rows == 0) { return; } eT* out_mem = out.memptr(); for(uword col=0; col 0) ? 1 : 0); if(X_n_cols == 0) { return; } eT* out_mem = out.memptr(); for(uword row=0; row inline void op_max::apply(Cube& out, const OpCube& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword dim = in.aux_uword_a; arma_conform_check( (dim > 2), "max(): parameter 'dim' must be 0 or 1 or 2" ); const unwrap_cube U(in.m); if(U.is_alias(out) == false) { op_max::apply_noalias(out, U.M, dim); } else { Cube tmp; op_max::apply_noalias(tmp, U.M, dim); out.steal_mem(tmp); } } template inline void op_max::apply_noalias(Cube& out, const Cube& X, const uword dim, const typename arma_not_cx::result* junk) { arma_debug_sigprint(); arma_ignore(junk); const uword X_n_rows = X.n_rows; const uword X_n_cols = X.n_cols; const uword X_n_slices = X.n_slices; if(dim == 0) { arma_debug_print("op_max::apply(): dim = 0"); out.set_size((X_n_rows > 0) ? 1 : 0, X_n_cols, X_n_slices); if(X_n_rows == 0) { return; } for(uword slice=0; slice < X_n_slices; ++slice) { eT* out_mem = out.slice_memptr(slice); for(uword col=0; col < X_n_cols; ++col) { out_mem[col] = op_max::direct_max( X.slice_colptr(slice,col), X_n_rows ); } } } else if(dim == 1) { arma_debug_print("op_max::apply(): dim = 1"); out.set_size(X_n_rows, (X_n_cols > 0) ? 1 : 0, X_n_slices); if(X_n_cols == 0) { return; } for(uword slice=0; slice < X_n_slices; ++slice) { eT* out_mem = out.slice_memptr(slice); arrayops::copy(out_mem, X.slice_colptr(slice,0), X_n_rows); for(uword col=1; col < X_n_cols; ++col) { const eT* col_mem = X.slice_colptr(slice,col); for(uword row=0; row < X_n_rows; ++row) { const eT col_val = col_mem[row]; if(col_val > out_mem[row]) { out_mem[row] = col_val; } } } } } else if(dim == 2) { arma_debug_print("op_max::apply(): dim = 2"); out.set_size(X_n_rows, X_n_cols, (X_n_slices > 0) ? 1 : 0); if(X_n_slices == 0) { return; } const uword N = X.n_elem_slice; eT* out_mem = out.slice_memptr(0); arrayops::copy(out_mem, X.slice_memptr(0), N); for(uword slice=1; slice < X_n_slices; ++slice) { const eT* X_mem = X.slice_memptr(slice); for(uword i=0; i < N; ++i) { const eT val = X_mem[i]; if(val > out_mem[i]) { out_mem[i] = val; } } } } } template inline void op_max::apply_noalias(Cube& out, const Cube& X, const uword dim, const typename arma_cx_only::result* junk) { arma_debug_sigprint(); arma_ignore(junk); const uword X_n_rows = X.n_rows; const uword X_n_cols = X.n_cols; const uword X_n_slices = X.n_slices; if(dim == 0) { arma_debug_print("op_max::apply(): dim = 0"); out.set_size((X_n_rows > 0) ? 1 : 0, X_n_cols, X_n_slices); if(X_n_rows == 0) { return; } for(uword slice=0; slice < X_n_slices; ++slice) { eT* out_mem = out.slice_memptr(slice); for(uword col=0; col < X_n_cols; ++col) { out_mem[col] = op_max::direct_max( X.slice_colptr(slice,col), X_n_rows ); } } } else if(dim == 1) { arma_debug_print("op_max::apply(): dim = 1"); out.set_size(X_n_rows, (X_n_cols > 0) ? 1 : 0, X_n_slices); if(X_n_cols == 0) { return; } for(uword slice=0; slice < X_n_slices; ++slice) { eT* out_mem = out.slice_memptr(slice); const Mat tmp('j', X.slice_memptr(slice), X_n_rows, X_n_cols); for(uword row=0; row < X_n_rows; ++row) { out_mem[row] = op_max::direct_max(tmp, row); } } } else if(dim == 2) { arma_debug_print("op_max::apply(): dim = 2"); out.set_size(X_n_rows, X_n_cols, (X_n_slices > 0) ? 1 : 0); if(X_n_slices == 0) { return; } const uword N = X.n_elem_slice; eT* out_mem = out.slice_memptr(0); arrayops::copy(out_mem, X.slice_memptr(0), N); for(uword slice=1; slice < X_n_slices; ++slice) { const eT* X_mem = X.slice_memptr(slice); for(uword i=0; i < N; ++i) { const eT& val = X_mem[i]; if(std::abs(val) > std::abs(out_mem[i])) { out_mem[i] = val; } } } } } template inline eT op_max::direct_max(const eT* const X, const uword n_elem) { arma_debug_sigprint(); eT max_val_i = priv::most_neg(); eT max_val_j = priv::most_neg(); uword i,j; for(i=0, j=1; j max_val_i) { max_val_i = X_i; } if(X_j > max_val_j) { max_val_j = X_j; } } if(i < n_elem) { const eT X_i = X[i]; if(X_i > max_val_i) { max_val_i = X_i; } } return (max_val_i > max_val_j) ? max_val_i : max_val_j; } template inline eT op_max::direct_max(const eT* const X, const uword n_elem, uword& index_of_max_val) { arma_debug_sigprint(); eT best_val = priv::most_neg(); uword best_index = 0; for(uword i=0; i < n_elem; ++i) { const eT val = X[i]; if(val > best_val) { best_val = val; best_index = i; } } index_of_max_val = best_index; return best_val; } template inline eT op_max::direct_max(const Mat& X, const uword row) { arma_debug_sigprint(); const uword X_n_cols = X.n_cols; eT max_val_i = priv::most_neg(); eT max_val_j = priv::most_neg(); uword i,j; for(i=0, j=1; j < X_n_cols; i+=2, j+=2) { const eT tmp_i = X.at(row,i); const eT tmp_j = X.at(row,j); if(tmp_i > max_val_i) { max_val_i = tmp_i; } if(tmp_j > max_val_j) { max_val_j = tmp_j; } } if(i < X_n_cols) { const eT tmp_i = X.at(row,i); if(tmp_i > max_val_i) { max_val_i = tmp_i; } } return (max_val_i > max_val_j) ? max_val_i : max_val_j; } template inline eT op_max::max(const subview& X) { arma_debug_sigprint(); if(X.n_elem == 0) { arma_conform_check(true, "max(): object has no elements"); return Datum::nan; } const uword X_n_rows = X.n_rows; const uword X_n_cols = X.n_cols; if(X_n_rows == 1) { eT max_val_i = priv::most_neg(); eT max_val_j = priv::most_neg(); const Mat& A = X.m; const uword start_row = X.aux_row1; const uword start_col = X.aux_col1; const uword end_col_p1 = start_col + X_n_cols; uword i,j; for(i=start_col, j=start_col+1; j < end_col_p1; i+=2, j+=2) { const eT tmp_i = A.at(start_row, i); const eT tmp_j = A.at(start_row, j); if(tmp_i > max_val_i) { max_val_i = tmp_i; } if(tmp_j > max_val_j) { max_val_j = tmp_j; } } if(i < end_col_p1) { const eT tmp_i = A.at(start_row, i); if(tmp_i > max_val_i) { max_val_i = tmp_i; } } return (max_val_i > max_val_j) ? max_val_i : max_val_j; } eT max_val = priv::most_neg(); for(uword col=0; col < X_n_cols; ++col) { max_val = (std::max)(max_val, op_max::direct_max(X.colptr(col), X_n_rows)); } return max_val; } template inline typename arma_not_cx::result op_max::max(const Base& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const Proxy P(X.get_ref()); const uword n_elem = P.get_n_elem(); if(n_elem == 0) { arma_conform_check(true, "max(): object has no elements"); return Datum::nan; } eT max_val_i = priv::most_neg(); eT max_val_j = priv::most_neg(); if(Proxy::use_at == false) { typedef typename Proxy::ea_type ea_type; ea_type A = P.get_ea(); uword i,j; for(i=0, j=1; j max_val_i) { max_val_i = tmp_i; } if(tmp_j > max_val_j) { max_val_j = tmp_j; } } if(i < n_elem) { const eT tmp_i = A[i]; if(tmp_i > max_val_i) { max_val_i = tmp_i; } } } else { const uword n_rows = P.get_n_rows(); const uword n_cols = P.get_n_cols(); if(n_rows == 1) { uword i,j; for(i=0, j=1; j < n_cols; i+=2, j+=2) { const eT tmp_i = P.at(0,i); const eT tmp_j = P.at(0,j); if(tmp_i > max_val_i) { max_val_i = tmp_i; } if(tmp_j > max_val_j) { max_val_j = tmp_j; } } if(i < n_cols) { const eT tmp_i = P.at(0,i); if(tmp_i > max_val_i) { max_val_i = tmp_i; } } } else { for(uword col=0; col < n_cols; ++col) { uword i,j; for(i=0, j=1; j < n_rows; i+=2, j+=2) { const eT tmp_i = P.at(i,col); const eT tmp_j = P.at(j,col); if(tmp_i > max_val_i) { max_val_i = tmp_i; } if(tmp_j > max_val_j) { max_val_j = tmp_j; } } if(i < n_rows) { const eT tmp_i = P.at(i,col); if(tmp_i > max_val_i) { max_val_i = tmp_i; } } } } } return (max_val_i > max_val_j) ? max_val_i : max_val_j; } template inline typename arma_not_cx::result op_max::max(const BaseCube& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const ProxyCube P(X.get_ref()); const uword n_elem = P.get_n_elem(); if(n_elem == 0) { arma_conform_check(true, "max(): object has no elements"); return Datum::nan; } eT max_val = priv::most_neg(); if(ProxyCube::use_at == false) { eT max_val_i = priv::most_neg(); eT max_val_j = priv::most_neg(); typedef typename ProxyCube::ea_type ea_type; ea_type A = P.get_ea(); uword i,j; for(i=0, j=1; j max_val_i) { max_val_i = tmp_i; } if(tmp_j > max_val_j) { max_val_j = tmp_j; } } if(i < n_elem) { const eT tmp_i = A[i]; if(tmp_i > max_val_i) { max_val_i = tmp_i; } } max_val = (max_val_i > max_val_j) ? max_val_i : max_val_j; } else { const uword n_rows = P.get_n_rows(); const uword n_cols = P.get_n_cols(); const uword n_slices = P.get_n_slices(); for(uword slice=0; slice < n_slices; ++slice) for(uword col=0; col < n_cols; ++col ) for(uword row=0; row < n_rows; ++row ) { const eT tmp = P.at(row,col,slice); if(tmp > max_val) { max_val = tmp; } } } return max_val; } template inline typename arma_not_cx::result op_max::max_with_index(const Proxy& P, uword& index_of_max_val) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword n_elem = P.get_n_elem(); if(n_elem == 0) { arma_conform_check(true, "max(): object has no elements"); index_of_max_val = 0; return Datum::nan; } eT best_val = priv::most_neg(); uword best_index = 0; if(Proxy::use_at == false) { typedef typename Proxy::ea_type ea_type; ea_type A = P.get_ea(); for(uword i=0; i best_val) { best_val = tmp; best_index = i; } } } else { const uword n_rows = P.get_n_rows(); const uword n_cols = P.get_n_cols(); if(n_rows == 1) { for(uword i=0; i < n_cols; ++i) { const eT tmp = P.at(0,i); if(tmp > best_val) { best_val = tmp; best_index = i; } } } else if(n_cols == 1) { for(uword i=0; i < n_rows; ++i) { const eT tmp = P.at(i,0); if(tmp > best_val) { best_val = tmp; best_index = i; } } } else { uword count = 0; for(uword col=0; col < n_cols; ++col) for(uword row=0; row < n_rows; ++row) { const eT tmp = P.at(row,col); if(tmp > best_val) { best_val = tmp; best_index = count; } ++count; } } } index_of_max_val = best_index; return best_val; } template inline typename arma_not_cx::result op_max::max_with_index(const ProxyCube& P, uword& index_of_max_val) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword n_elem = P.get_n_elem(); if(n_elem == 0) { arma_conform_check(true, "max(): object has no elements"); index_of_max_val = 0; return Datum::nan; } eT best_val = priv::most_neg(); uword best_index = 0; if(ProxyCube::use_at == false) { typedef typename ProxyCube::ea_type ea_type; ea_type A = P.get_ea(); for(uword i=0; i < n_elem; ++i) { const eT tmp = A[i]; if(tmp > best_val) { best_val = tmp; best_index = i; } } } else { const uword n_rows = P.get_n_rows(); const uword n_cols = P.get_n_cols(); const uword n_slices = P.get_n_slices(); uword count = 0; for(uword slice=0; slice < n_slices; ++slice) for(uword col=0; col < n_cols; ++col ) for(uword row=0; row < n_rows; ++row ) { const eT tmp = P.at(row,col,slice); if(tmp > best_val) { best_val = tmp; best_index = count; } ++count; } } index_of_max_val = best_index; return best_val; } template inline std::complex op_max::direct_max(const std::complex* const X, const uword n_elem) { arma_debug_sigprint(); uword index = 0; T max_val = priv::most_neg(); for(uword i=0; i max_val) { max_val = tmp_val; index = i; } } return X[index]; } template inline std::complex op_max::direct_max(const std::complex* const X, const uword n_elem, uword& index_of_max_val) { arma_debug_sigprint(); uword index = 0; T max_val = priv::most_neg(); for(uword i=0; i max_val) { max_val = tmp_val; index = i; } } index_of_max_val = index; return X[index]; } template inline std::complex op_max::direct_max(const Mat< std::complex >& X, const uword row) { arma_debug_sigprint(); const uword X_n_cols = X.n_cols; uword index = 0; T max_val = priv::most_neg(); for(uword col=0; col max_val) { max_val = tmp_val; index = col; } } return X.at(row,index); } template inline std::complex op_max::max(const subview< std::complex >& X) { arma_debug_sigprint(); typedef typename std::complex eT; if(X.n_elem == 0) { arma_conform_check(true, "max(): object has no elements"); return Datum::nan; } const Mat& A = X.m; const uword X_n_rows = X.n_rows; const uword X_n_cols = X.n_cols; const uword start_row = X.aux_row1; const uword start_col = X.aux_col1; const uword end_row_p1 = start_row + X_n_rows; const uword end_col_p1 = start_col + X_n_cols; T max_val = priv::most_neg(); uword best_row = 0; uword best_col = 0; if(X_n_rows == 1) { best_col = 0; for(uword col=start_col; col < end_col_p1; ++col) { const T tmp_val = std::abs( A.at(start_row, col) ); if(tmp_val > max_val) { max_val = tmp_val; best_col = col; } } best_row = start_row; } else { for(uword col=start_col; col < end_col_p1; ++col) for(uword row=start_row; row < end_row_p1; ++row) { const T tmp_val = std::abs( A.at(row, col) ); if(tmp_val > max_val) { max_val = tmp_val; best_row = row; best_col = col; } } } return A.at(best_row, best_col); } template inline typename arma_cx_only::result op_max::max(const Base& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; typedef typename get_pod_type::result T; const Proxy P(X.get_ref()); const uword n_elem = P.get_n_elem(); if(n_elem == 0) { arma_conform_check(true, "max(): object has no elements"); return Datum::nan; } T max_val = priv::most_neg(); if(Proxy::use_at == false) { typedef typename Proxy::ea_type ea_type; ea_type A = P.get_ea(); uword index = 0; for(uword i=0; i max_val) { max_val = tmp; index = i; } } return( A[index] ); } else { const uword n_rows = P.get_n_rows(); const uword n_cols = P.get_n_cols(); uword best_row = 0; uword best_col = 0; if(n_rows == 1) { for(uword col=0; col < n_cols; ++col) { const T tmp = std::abs(P.at(0,col)); if(tmp > max_val) { max_val = tmp; best_col = col; } } } else { for(uword col=0; col < n_cols; ++col) for(uword row=0; row < n_rows; ++row) { const T tmp = std::abs(P.at(row,col)); if(tmp > max_val) { max_val = tmp; best_row = row; best_col = col; } } } return P.at(best_row, best_col); } } template inline typename arma_cx_only::result op_max::max(const BaseCube& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; typedef typename get_pod_type::result T; const ProxyCube P(X.get_ref()); const uword n_elem = P.get_n_elem(); if(n_elem == 0) { arma_conform_check(true, "max(): object has no elements"); return Datum::nan; } T max_val = priv::most_neg(); if(ProxyCube::use_at == false) { typedef typename ProxyCube::ea_type ea_type; ea_type A = P.get_ea(); uword index = 0; for(uword i=0; i max_val) { max_val = tmp; index = i; } } return( A[index] ); } else { const uword n_rows = P.get_n_rows(); const uword n_cols = P.get_n_cols(); const uword n_slices = P.get_n_slices(); eT max_val_orig = eT(0); for(uword slice=0; slice < n_slices; ++slice) for(uword col=0; col < n_cols; ++col ) for(uword row=0; row < n_rows; ++row ) { const eT tmp_orig = P.at(row,col,slice); const T tmp = std::abs(tmp_orig); if(tmp > max_val) { max_val = tmp; max_val_orig = tmp_orig; } } return max_val_orig; } } template inline typename arma_cx_only::result op_max::max_with_index(const Proxy& P, uword& index_of_max_val) { arma_debug_sigprint(); typedef typename T1::elem_type eT; typedef typename get_pod_type::result T; const uword n_elem = P.get_n_elem(); if(n_elem == 0) { arma_conform_check(true, "max(): object has no elements"); index_of_max_val = 0; return Datum::nan; } T best_val = priv::most_neg(); if(Proxy::use_at == false) { typedef typename Proxy::ea_type ea_type; ea_type A = P.get_ea(); uword best_index = 0; for(uword i=0; i best_val) { best_val = tmp; best_index = i; } } index_of_max_val = best_index; return( A[best_index] ); } else { const uword n_rows = P.get_n_rows(); const uword n_cols = P.get_n_cols(); uword best_row = 0; uword best_col = 0; uword best_index = 0; if(n_rows == 1) { for(uword col=0; col < n_cols; ++col) { const T tmp = std::abs(P.at(0,col)); if(tmp > best_val) { best_val = tmp; best_col = col; } } best_index = best_col; } else if(n_cols == 1) { for(uword row=0; row < n_rows; ++row) { const T tmp = std::abs(P.at(row,0)); if(tmp > best_val) { best_val = tmp; best_row = row; } } best_index = best_row; } else { uword count = 0; for(uword col=0; col < n_cols; ++col) for(uword row=0; row < n_rows; ++row) { const T tmp = std::abs(P.at(row,col)); if(tmp > best_val) { best_val = tmp; best_row = row; best_col = col; best_index = count; } ++count; } } index_of_max_val = best_index; return P.at(best_row, best_col); } } template inline typename arma_cx_only::result op_max::max_with_index(const ProxyCube& P, uword& index_of_max_val) { arma_debug_sigprint(); typedef typename T1::elem_type eT; typedef typename get_pod_type::result T; const uword n_elem = P.get_n_elem(); if(n_elem == 0) { arma_conform_check(true, "max(): object has no elements"); index_of_max_val = 0; return Datum::nan; } T best_val = priv::most_neg(); if(ProxyCube::use_at == false) { typedef typename ProxyCube::ea_type ea_type; ea_type A = P.get_ea(); uword best_index = 0; for(uword i=0; i < n_elem; ++i) { const T tmp = std::abs(A[i]); if(tmp > best_val) { best_val = tmp; best_index = i; } } index_of_max_val = best_index; return( A[best_index] ); } else { const uword n_rows = P.get_n_rows(); const uword n_cols = P.get_n_cols(); const uword n_slices = P.get_n_slices(); eT best_val_orig = eT(0); uword best_index = 0; uword count = 0; for(uword slice=0; slice < n_slices; ++slice) for(uword col=0; col < n_cols; ++col ) for(uword row=0; row < n_rows; ++row ) { const eT tmp_orig = P.at(row,col,slice); const T tmp = std::abs(tmp_orig); if(tmp > best_val) { best_val = tmp; best_val_orig = tmp_orig; best_index = count; } ++count; } index_of_max_val = best_index; return best_val_orig; } } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_eigs_sym.hpp0000644000176200001440000001707414635324415023423 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_eigs_sym //! @{ //! eigenvalues of symmetric real sparse matrix X template arma_warn_unused inline typename enable_if2< is_real::value, Col >::result eigs_sym ( const SpBase& X, const uword n_eigvals, const char* form = "lm", const eigs_opts opts = eigs_opts() ) { arma_debug_sigprint(); Mat eigvec; Col eigval; sp_auxlib::form_type form_val = sp_auxlib::interpret_form_str(form); const bool status = sp_auxlib::eigs_sym(eigval, eigvec, X, n_eigvals, form_val, opts); if(status == false) { eigval.soft_reset(); arma_stop_runtime_error("eigs_sym(): decomposition failed"); } return eigval; } //! this form is deprecated; use eigs_sym(X, n_eigvals, form, opts) instead template arma_deprecated inline typename enable_if2< is_real::value, Col >::result eigs_sym ( const SpBase& X, const uword n_eigvals, const char* form, const typename T1::elem_type tol ) { arma_debug_sigprint(); eigs_opts opts; opts.tol = tol; return eigs_sym(X, n_eigvals, form, opts); } template arma_warn_unused inline typename enable_if2< is_real::value, Col >::result eigs_sym ( const SpBase& X, const uword n_eigvals, const double sigma, const eigs_opts opts = eigs_opts() ) { arma_debug_sigprint(); typedef typename T1::pod_type T; Mat eigvec; Col eigval; const bool status = sp_auxlib::eigs_sym(eigval, eigvec, X, n_eigvals, T(sigma), opts); if(status == false) { eigval.soft_reset(); arma_stop_runtime_error("eigs_sym(): decomposition failed"); } return eigval; } //! eigenvalues of symmetric real sparse matrix X template inline typename enable_if2< is_real::value, bool >::result eigs_sym ( Col& eigval, const SpBase& X, const uword n_eigvals, const char* form = "lm", const eigs_opts opts = eigs_opts() ) { arma_debug_sigprint(); Mat eigvec; sp_auxlib::form_type form_val = sp_auxlib::interpret_form_str(form); const bool status = sp_auxlib::eigs_sym(eigval, eigvec, X, n_eigvals, form_val, opts); if(status == false) { eigval.soft_reset(); arma_warn(3, "eigs_sym(): decomposition failed"); } return status; } //! this form is deprecated; use eigs_sym(eigval, X, n_eigvals, form, opts) instead template arma_deprecated inline typename enable_if2< is_real::value, bool >::result eigs_sym ( Col& eigval, const SpBase& X, const uword n_eigvals, const char* form, const typename T1::elem_type tol ) { arma_debug_sigprint(); eigs_opts opts; opts.tol = tol; return eigs_sym(eigval, X, n_eigvals, form, opts); } template inline typename enable_if2< is_real::value, bool >::result eigs_sym ( Col& eigval, const SpBase& X, const uword n_eigvals, const double sigma, const eigs_opts opts = eigs_opts() ) { arma_debug_sigprint(); typedef typename T1::pod_type T; Mat eigvec; const bool status = sp_auxlib::eigs_sym(eigval, eigvec, X, n_eigvals, T(sigma), opts); if(status == false) { eigval.soft_reset(); arma_warn(3, "eigs_sym(): decomposition failed"); } return status; } //! eigenvalues and eigenvectors of symmetric real sparse matrix X template inline typename enable_if2< is_real::value, bool >::result eigs_sym ( Col& eigval, Mat& eigvec, const SpBase& X, const uword n_eigvals, const char* form = "lm", const eigs_opts opts = eigs_opts() ) { arma_debug_sigprint(); arma_conform_check( void_ptr(&eigval) == void_ptr(&eigvec), "eigs_sym(): parameter 'eigval' is an alias of parameter 'eigvec'" ); sp_auxlib::form_type form_val = sp_auxlib::interpret_form_str(form); const bool status = sp_auxlib::eigs_sym(eigval, eigvec, X, n_eigvals, form_val, opts); if(status == false) { eigval.soft_reset(); eigvec.soft_reset(); arma_warn(3, "eigs_sym(): decomposition failed"); } return status; } //! this form is deprecated; use eigs_sym(eigval, eigvec, X, n_eigvals, form, opts) instead template arma_deprecated inline typename enable_if2< is_real::value, bool >::result eigs_sym ( Col& eigval, Mat& eigvec, const SpBase& X, const uword n_eigvals, const char* form, const typename T1::elem_type tol ) { arma_debug_sigprint(); eigs_opts opts; opts.tol = tol; return eigs_sym(eigval, eigvec, X, n_eigvals, form, opts); } template inline typename enable_if2< is_real::value, bool >::result eigs_sym ( Col& eigval, Mat& eigvec, const SpBase& X, const uword n_eigvals, const double sigma, const eigs_opts opts = eigs_opts() ) { arma_debug_sigprint(); typedef typename T1::pod_type T; arma_conform_check( void_ptr(&eigval) == void_ptr(&eigvec), "eigs_sym(): parameter 'eigval' is an alias of parameter 'eigvec'" ); const bool status = sp_auxlib::eigs_sym(eigval, eigvec, X, n_eigvals, T(sigma), opts); if(status == false) { eigval.soft_reset(); eigvec.soft_reset(); arma_warn(3, "eigs_sym(): decomposition failed"); } return status; } //! @} RcppArmadillo/inst/include/armadillo_bits/mtSpGlue_meat.hpp0000644000176200001440000000267014631567470023671 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup mtSpGlue //! @{ template inline mtSpGlue::mtSpGlue(const T1& in_A, const T2& in_B) : A(in_A) , B(in_B) { arma_debug_sigprint(); } template inline mtSpGlue::~mtSpGlue() { arma_debug_sigprint(); } template template arma_inline bool mtSpGlue::is_alias(const SpMat& X) const { return (A.is_alias(X) || B.is_alias(X)); } //! @} RcppArmadillo/inst/include/armadillo_bits/span.hpp0000644000176200001440000000321314301267044022042 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup span //! @{ struct span_alt {}; template class span_base { public: static const span_alt all; }; template const span_alt span_base::all = span_alt(); class span : public span_base<> { public: uword a; uword b; bool whole; inline span() : a(0) , b(0) , whole(true) { } inline span(const span_alt&) : a(0) , b(0) , whole(true) { } inline explicit span(const uword in_a) : a(in_a) , b(in_a) , whole(false) { } // the "explicit" keyword is required here to prevent automatic conversion of {a,b} // into an instance of span() when submatrices are specified inline explicit span(const uword in_a, const uword in_b) : a(in_a) , b(in_b) , whole(false) { } }; //! @} RcppArmadillo/inst/include/armadillo_bits/fn_cross.hpp0000644000176200001440000000235714631567470022741 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_cross //! @{ //! cross product (only valid for 3 dimensional vectors) template arma_warn_unused inline typename enable_if2 < is_arma_type::value && is_arma_type::value && is_same_type::value, const Glue >::result cross(const T1& X, const T2& Y) { arma_debug_sigprint(); return Glue(X, Y); } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_cumsum.hpp0000644000176200001440000000334114631567470023113 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_cumsum //! @{ template arma_warn_unused arma_inline typename enable_if2 < is_arma_type::value && resolves_to_vector::yes, const Op >::result cumsum(const T1& X) { arma_debug_sigprint(); return Op(X); } template arma_warn_unused arma_inline typename enable_if2 < is_arma_type::value && resolves_to_vector::no, const Op >::result cumsum(const T1& X) { arma_debug_sigprint(); return Op(X, 0, 0); } template arma_warn_unused arma_inline typename enable_if2 < is_arma_type::value, const Op >::result cumsum(const T1& X, const uword dim) { arma_debug_sigprint(); return Op(X, dim, 0); } template arma_warn_unused arma_inline typename arma_scalar_only::result cumsum(const T& x) { return x; } //! @} RcppArmadillo/inst/include/armadillo_bits/arma_rel_comparators.hpp0000644000176200001440000001065714301267043025306 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup arma_rel_comparators //! @{ template struct arma_lt_comparator { arma_inline bool operator() (const eT a, const eT b) const { return (a < b); } }; template struct arma_gt_comparator { arma_inline bool operator() (const eT a, const eT b) const { return (a > b); } }; template struct arma_leq_comparator { arma_inline bool operator() (const eT a, const eT b) const { return (a <= b); } }; template struct arma_geq_comparator { arma_inline bool operator() (const eT a, const eT b) const { return (a >= b); } }; template struct arma_lt_comparator< std::complex > { typedef typename std::complex eT; inline bool operator() (const eT& a, const eT& b) const { return (std::abs(a) < std::abs(b)); } // inline // bool // operator() (const eT& a, const eT& b) const // { // const T abs_a = std::abs(a); // const T abs_b = std::abs(b); // // return ( (abs_a != abs_b) ? (abs_a < abs_b) : (std::arg(a) < std::arg(b)) ); // } // inline // bool // operator() (const eT& a, const eT& b) const // { // const T a_real = a.real(); // const T a_imag = a.imag(); // // const T a_mag_squared = a_real*a_real + a_imag*a_imag; // // const T b_real = b.real(); // const T b_imag = b.imag(); // // const T b_mag_squared = b_real*b_real + b_imag*b_imag; // // if( (a_mag_squared != T(0)) && (b_mag_squared != T(0)) && std::isfinite(a_mag_squared) && std::isfinite(b_mag_squared) ) // { // return ( (a_mag_squared != b_mag_squared) ? (a_mag_squared < b_mag_squared) : (std::arg(a) < std::arg(b)) ); // } // else // { // const T abs_a = std::abs(a); // const T abs_b = std::abs(b); // // return ( (abs_a != abs_b) ? (abs_a < abs_b) : (std::arg(a) < std::arg(b)) ); // } // } }; template struct arma_gt_comparator< std::complex > { typedef typename std::complex eT; inline bool operator() (const eT& a, const eT& b) const { return (std::abs(a) > std::abs(b)); } // inline // bool // operator() (const eT& a, const eT& b) const // { // const T abs_a = std::abs(a); // const T abs_b = std::abs(b); // // return ( (abs_a != abs_b) ? (abs_a > abs_b) : (std::arg(a) > std::arg(b)) ); // } // inline // bool // operator() (const eT& a, const eT& b) const // { // const T a_real = a.real(); // const T a_imag = a.imag(); // // const T a_mag_squared = a_real*a_real + a_imag*a_imag; // // const T b_real = b.real(); // const T b_imag = b.imag(); // // const T b_mag_squared = b_real*b_real + b_imag*b_imag; // // if( (a_mag_squared != T(0)) && (b_mag_squared != T(0)) && std::isfinite(a_mag_squared) && std::isfinite(b_mag_squared) ) // { // return ( (a_mag_squared != b_mag_squared) ? (a_mag_squared > b_mag_squared) : (std::arg(a) > std::arg(b)) ); // } // else // { // const T abs_a = std::abs(a); // const T abs_b = std::abs(b); // // return ( (abs_a != abs_b) ? (abs_a > abs_b) : (std::arg(a) > std::arg(b)) ); // } // } }; template struct arma_leq_comparator< std::complex > { typedef typename std::complex eT; inline bool operator() (const eT& a, const eT& b) const { return (std::abs(a) <= std::abs(b)); } }; template struct arma_geq_comparator< std::complex > { typedef typename std::complex eT; inline bool operator() (const eT& a, const eT& b) const { return (std::abs(a) >= std::abs(b)); } }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_sort_bones.hpp0000644000176200001440000000301314752446051023761 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_sort //! @{ class op_sort : public traits_op_default { public: template inline static void direct_sort(eT* X, const uword N, const uword sort_mode = 0); template inline static void direct_sort_ascending(eT* X, const uword N); template inline static void apply_noalias(Mat& out, const Mat& X, const uword sort_mode, const uword dim); template inline static void apply(Mat& out, const Op& in); }; class op_sort_vec : public traits_op_passthru { public: template inline static void apply(Mat& out, const Op& in); }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_strans_meat.hpp0000644000176200001440000002500114752446051024125 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_strans //! @{ //! for tiny square matrices (size <= 4x4) template inline void op_strans::apply_mat_noalias_tinysq(Mat& out, const TA& A) { const eT* Am = A.memptr(); eT* outm = out.memptr(); switch(A.n_rows) { case 1: { outm[0] = Am[0]; } break; case 2: { outm[pos::n2] = Am[pos::n2]; outm[pos::n2] = Am[pos::n2]; outm[pos::n2] = Am[pos::n2]; outm[pos::n2] = Am[pos::n2]; } break; case 3: { outm[pos::n3] = Am[pos::n3]; outm[pos::n3] = Am[pos::n3]; outm[pos::n3] = Am[pos::n3]; outm[pos::n3] = Am[pos::n3]; outm[pos::n3] = Am[pos::n3]; outm[pos::n3] = Am[pos::n3]; outm[pos::n3] = Am[pos::n3]; outm[pos::n3] = Am[pos::n3]; outm[pos::n3] = Am[pos::n3]; } break; case 4: { outm[pos::n4] = Am[pos::n4]; outm[pos::n4] = Am[pos::n4]; outm[pos::n4] = Am[pos::n4]; outm[pos::n4] = Am[pos::n4]; outm[pos::n4] = Am[pos::n4]; outm[pos::n4] = Am[pos::n4]; outm[pos::n4] = Am[pos::n4]; outm[pos::n4] = Am[pos::n4]; outm[pos::n4] = Am[pos::n4]; outm[pos::n4] = Am[pos::n4]; outm[pos::n4] = Am[pos::n4]; outm[pos::n4] = Am[pos::n4]; outm[pos::n4] = Am[pos::n4]; outm[pos::n4] = Am[pos::n4]; outm[pos::n4] = Am[pos::n4]; outm[pos::n4] = Am[pos::n4]; } break; default: ; } } template inline void op_strans::block_worker(eT* Y, const eT* X, const uword X_n_rows, const uword Y_n_rows, const uword n_rows, const uword n_cols) { for(uword row = 0; row < n_rows; ++row) { const uword Y_offset = row * Y_n_rows; for(uword col = 0; col < n_cols; ++col) { const uword X_offset = col * X_n_rows; Y[col + Y_offset] = X[row + X_offset]; } } } template inline void op_strans::apply_mat_noalias_large(Mat& out, const Mat& A) { arma_debug_sigprint(); const uword n_rows = A.n_rows; const uword n_cols = A.n_cols; const uword block_size = 64; const uword n_rows_base = block_size * (n_rows / block_size); const uword n_cols_base = block_size * (n_cols / block_size); const uword n_rows_extra = n_rows - n_rows_base; const uword n_cols_extra = n_cols - n_cols_base; const eT* X = A.memptr(); eT* Y = out.memptr(); for(uword row = 0; row < n_rows_base; row += block_size) { const uword Y_offset = row * n_cols; for(uword col = 0; col < n_cols_base; col += block_size) { const uword X_offset = col * n_rows; op_strans::block_worker(&Y[col + Y_offset], &X[row + X_offset], n_rows, n_cols, block_size, block_size); } const uword X_offset = n_cols_base * n_rows; op_strans::block_worker(&Y[n_cols_base + Y_offset], &X[row + X_offset], n_rows, n_cols, block_size, n_cols_extra); } if(n_rows_extra == 0) { return; } const uword Y_offset = n_rows_base * n_cols; for(uword col = 0; col < n_cols_base; col += block_size) { const uword X_offset = col * n_rows; op_strans::block_worker(&Y[col + Y_offset], &X[n_rows_base + X_offset], n_rows, n_cols, n_rows_extra, block_size); } const uword X_offset = n_cols_base * n_rows; op_strans::block_worker(&Y[n_cols_base + Y_offset], &X[n_rows_base + X_offset], n_rows, n_cols, n_rows_extra, n_cols_extra); } //! Immediate transpose of a dense matrix template inline void op_strans::apply_mat_noalias(Mat& out, const TA& A) { arma_debug_sigprint(); const uword A_n_cols = A.n_cols; const uword A_n_rows = A.n_rows; out.set_size(A_n_cols, A_n_rows); if( (TA::is_row) || (TA::is_col) || (A_n_cols == 1) || (A_n_rows == 1) ) { arrayops::copy( out.memptr(), A.memptr(), A.n_elem ); } else { if( (A_n_rows <= 4) && (A_n_rows == A_n_cols) ) { op_strans::apply_mat_noalias_tinysq(out, A); } else if( (A_n_rows >= 512) && (A_n_cols >= 512) ) { op_strans::apply_mat_noalias_large(out, A); } else { eT* outptr = out.memptr(); for(uword k=0; k < A_n_rows; ++k) { const eT* Aptr = &(A.at(k,0)); uword j; for(j=1; j < A_n_cols; j+=2) { const eT tmp_i = (*Aptr); Aptr += A_n_rows; const eT tmp_j = (*Aptr); Aptr += A_n_rows; (*outptr) = tmp_i; outptr++; (*outptr) = tmp_j; outptr++; } if((j-1) < A_n_cols) { (*outptr) = (*Aptr); outptr++;; } } } } } template inline void op_strans::apply_mat_inplace(Mat& out) { arma_debug_sigprint(); const uword n_rows = out.n_rows; const uword n_cols = out.n_cols; if(n_rows == n_cols) { arma_debug_print("op_strans::apply_mat_inplace(): square matrix"); const uword N = n_rows; for(uword k=0; k < N; ++k) { eT* colptr = &(out.at(k,k)); eT* rowptr = colptr; colptr++; rowptr += N; uword j; for(j=(k+2); j < N; j+=2) { std::swap( (*rowptr), (*colptr) ); rowptr += N; colptr++; std::swap( (*rowptr), (*colptr) ); rowptr += N; colptr++; } if((j-1) < N) { std::swap( (*rowptr), (*colptr) ); } } } else { if( ((n_rows == 1) || (n_cols == 1)) && (out.vec_state == 0) && (out.mem_state == 0) ) { arma_debug_print("op_strans::apply_mat_inplace(): swapping n_rows and n_cols"); access::rw(out.n_rows) = n_cols; access::rw(out.n_cols) = n_rows; } else { Mat tmp; op_strans::apply_mat_noalias(tmp, out); out.steal_mem(tmp); } } } template inline void op_strans::apply_mat(Mat& out, const TA& A) { arma_debug_sigprint(); if(&out != &A) { op_strans::apply_mat_noalias(out, A); } else { op_strans::apply_mat_inplace(out); } } template inline void op_strans::apply_proxy(Mat& out, const Proxy& P) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword n_rows = P.get_n_rows(); const uword n_cols = P.get_n_cols(); if( (resolves_to_vector::yes) && (Proxy::use_at == false) ) { out.set_size(n_cols, n_rows); eT* out_mem = out.memptr(); const uword n_elem = P.get_n_elem(); typename Proxy::ea_type Pea = P.get_ea(); uword i,j; for(i=0, j=1; j < n_elem; i+=2, j+=2) { const eT tmp_i = Pea[i]; const eT tmp_j = Pea[j]; out_mem[i] = tmp_i; out_mem[j] = tmp_j; } if(i < n_elem) { out_mem[i] = Pea[i]; } } else // general matrix transpose { out.set_size(n_cols, n_rows); eT* outptr = out.memptr(); for(uword k=0; k < n_rows; ++k) { uword j; for(j=1; j < n_cols; j+=2) { const uword i = j-1; const eT tmp_i = P.at(k,i); const eT tmp_j = P.at(k,j); (*outptr) = tmp_i; outptr++; (*outptr) = tmp_j; outptr++; } const uword i = j-1; if(i < n_cols) { (*outptr) = P.at(k,i); outptr++; } } } } template inline void op_strans::apply_direct(Mat& out, const T1& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; // allow detection of in-place transpose if(is_Mat::value) { const unwrap U(X); op_strans::apply_mat(out, U.M); } else if((is_Mat::stored_type>::value) || (is_subview_col::value) || (arma_config::openmp && Proxy::use_mp)) { const quasi_unwrap U(X); if(U.is_alias(out)) { Mat tmp; op_strans::apply_mat_noalias(tmp, U.M); out.steal_mem(tmp); } else { op_strans::apply_mat_noalias(out, U.M); } } else { const Proxy P(X); if(P.is_alias(out)) { Mat tmp; op_strans::apply_proxy(tmp, P); out.steal_mem(tmp); } else { op_strans::apply_proxy(out, P); } } } template inline void op_strans::apply(Mat& out, const Op& in) { arma_debug_sigprint(); op_strans::apply_direct(out, in.m); } // // // template inline void op_strans_cube::apply_noalias(Cube& out, const Cube& X) { out.set_size(X.n_cols, X.n_rows, X.n_slices); for(uword s=0; s < X.n_slices; ++s) { Mat out_slice( out.slice_memptr(s), X.n_cols, X.n_rows, false, true ); const Mat X_slice( const_cast(X.slice_memptr(s)), X.n_rows, X.n_cols, false, true ); op_strans::apply_mat_noalias(out_slice, X_slice); } } //! @} RcppArmadillo/inst/include/armadillo_bits/glue_mixed_bones.hpp0000644000176200001440000000600214301267043024407 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup glue_mixed //! @{ class glue_mixed_times { public: template struct traits { static constexpr bool is_row = T1::is_row; static constexpr bool is_col = T2::is_col; static constexpr bool is_xvec = false; }; template inline static void apply(Mat::eT>& out, const mtGlue::eT, T1, T2, glue_mixed_times>& X); }; class glue_mixed_plus : public traits_glue_or { public: template inline static void apply(Mat::eT>& out, const mtGlue::eT, T1, T2, glue_mixed_plus>& X); template inline static void apply(Cube::eT>& out, const mtGlueCube::eT, T1, T2, glue_mixed_plus>& X); }; class glue_mixed_minus : public traits_glue_or { public: template inline static void apply(Mat::eT>& out, const mtGlue::eT, T1, T2, glue_mixed_minus>& X); template inline static void apply(Cube::eT>& out, const mtGlueCube::eT, T1, T2, glue_mixed_minus>& X); }; class glue_mixed_div : public traits_glue_or { public: template inline static void apply(Mat::eT>& out, const mtGlue::eT, T1, T2, glue_mixed_div>& X); template inline static void apply(Cube::eT>& out, const mtGlueCube::eT, T1, T2, glue_mixed_div>& X); }; class glue_mixed_schur : public traits_glue_or { public: template inline static void apply(Mat::eT>& out, const mtGlue::eT, T1, T2, glue_mixed_schur>& X); template inline static void apply(Cube::eT>& out, const mtGlueCube::eT, T1, T2, glue_mixed_schur>& X); }; //! @} RcppArmadillo/inst/include/armadillo_bits/subview_bones.hpp0000644000176200001440000006106114715372502023765 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup subview //! @{ //! Class for storing data required to construct or apply operations to a submatrix //! (ie. where the submatrix starts and ends as well as a reference/pointer to the original matrix), template class subview : public Base< eT, subview > { public: typedef eT elem_type; typedef typename get_pod_type::result pod_type; arma_aligned const Mat& m; static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = false; const uword aux_row1; const uword aux_col1; const uword n_rows; const uword n_cols; const uword n_elem; protected: arma_inline subview(const Mat& in_m, const uword in_row1, const uword in_col1, const uword in_n_rows, const uword in_n_cols); public: inline ~subview(); inline subview() = delete; inline subview(const subview& in); inline subview( subview&& in); template inline void inplace_op(const eT val ); template inline void inplace_op(const Base& x, const char* identifier); template inline void inplace_op(const subview& x, const char* identifier); // deliberately returning void inline void operator= (const eT val); inline void operator+= (const eT val); inline void operator-= (const eT val); inline void operator*= (const eT val); inline void operator/= (const eT val); inline void operator= (const subview& x); inline void operator+= (const subview& x); inline void operator-= (const subview& x); inline void operator%= (const subview& x); inline void operator/= (const subview& x); template inline void operator= (const Base& x); template inline void operator+= (const Base& x); template inline void operator-= (const Base& x); template inline void operator%= (const Base& x); template inline void operator/= (const Base& x); template inline void operator= (const SpBase& x); template inline void operator+= (const SpBase& x); template inline void operator-= (const SpBase& x); template inline void operator%= (const SpBase& x); template inline void operator/= (const SpBase& x); template inline typename enable_if2< is_same_type::value, void>::result operator=(const Gen& x); inline void operator=(const std::initializer_list& list); inline void operator=(const std::initializer_list< std::initializer_list >& list); inline static void extract(Mat& out, const subview& in); inline static void plus_inplace(Mat& out, const subview& in); inline static void minus_inplace(Mat& out, const subview& in); inline static void schur_inplace(Mat& out, const subview& in); inline static void div_inplace(Mat& out, const subview& in); template inline void for_each(functor F); template inline void for_each(functor F) const; template inline void transform(functor F); template inline void imbue(functor F); inline void replace(const eT old_val, const eT new_val); inline void clean(const pod_type threshold); inline void clamp(const eT min_val, const eT max_val); inline void fill(const eT val); inline void zeros(); inline void ones(); inline void eye(); inline void randu(); inline void randn(); arma_warn_unused inline eT at_alt (const uword ii) const; arma_warn_unused inline eT& operator[](const uword ii); arma_warn_unused inline eT operator[](const uword ii) const; arma_warn_unused inline eT& operator()(const uword ii); arma_warn_unused inline eT operator()(const uword ii) const; arma_warn_unused inline eT& operator()(const uword in_row, const uword in_col); arma_warn_unused inline eT operator()(const uword in_row, const uword in_col) const; arma_warn_unused inline eT& at(const uword in_row, const uword in_col); arma_warn_unused inline eT at(const uword in_row, const uword in_col) const; arma_warn_unused inline eT& front(); arma_warn_unused inline eT front() const; arma_warn_unused inline eT& back(); arma_warn_unused inline eT back() const; arma_inline eT* colptr(const uword in_col); arma_inline const eT* colptr(const uword in_col) const; template inline bool check_overlap(const subview& x) const; arma_warn_unused inline bool is_vec() const; arma_warn_unused inline bool is_finite() const; arma_warn_unused inline bool is_zero(const pod_type tol = 0) const; arma_warn_unused inline bool has_inf() const; arma_warn_unused inline bool has_nan() const; arma_warn_unused inline bool has_nonfinite() const; inline subview_row row(const uword row_num); inline const subview_row row(const uword row_num) const; inline subview_row operator()(const uword row_num, const span& col_span); inline const subview_row operator()(const uword row_num, const span& col_span) const; inline subview_col col(const uword col_num); inline const subview_col col(const uword col_num) const; inline subview_col operator()(const span& row_span, const uword col_num); inline const subview_col operator()(const span& row_span, const uword col_num) const; inline Col unsafe_col(const uword col_num); inline const Col unsafe_col(const uword col_num) const; inline subview rows(const uword in_row1, const uword in_row2); inline const subview rows(const uword in_row1, const uword in_row2) const; inline subview cols(const uword in_col1, const uword in_col2); inline const subview cols(const uword in_col1, const uword in_col2) const; inline subview submat(const uword in_row1, const uword in_col1, const uword in_row2, const uword in_col2); inline const subview submat(const uword in_row1, const uword in_col1, const uword in_row2, const uword in_col2) const; inline subview submat (const span& row_span, const span& col_span); inline const subview submat (const span& row_span, const span& col_span) const; inline subview operator()(const span& row_span, const span& col_span); inline const subview operator()(const span& row_span, const span& col_span) const; inline subview_each1< subview, 0 > each_col(); inline subview_each1< subview, 1 > each_row(); template inline subview_each2< subview, 0, T1 > each_col(const Base& indices); template inline subview_each2< subview, 1, T1 > each_row(const Base& indices); inline void each_col(const std::function< void( Col&) >& F); inline void each_col(const std::function< void(const Col&) >& F) const; inline void each_row(const std::function< void( Row&) >& F); inline void each_row(const std::function< void(const Row&) >& F) const; inline diagview diag(const sword in_id = 0); inline const diagview diag(const sword in_id = 0) const; inline void swap_rows(const uword in_row1, const uword in_row2); inline void swap_cols(const uword in_col1, const uword in_col2); template inline bool is_alias(const Mat& X) const; class const_iterator; class iterator { public: inline iterator(); inline iterator(const iterator& X); inline iterator(subview& in_sv, const uword in_row, const uword in_col); arma_warn_unused inline eT& operator*(); inline iterator& operator++(); arma_warn_unused inline iterator operator++(int); arma_warn_unused inline bool operator==(const iterator& rhs) const; arma_warn_unused inline bool operator!=(const iterator& rhs) const; arma_warn_unused inline bool operator==(const const_iterator& rhs) const; arma_warn_unused inline bool operator!=(const const_iterator& rhs) const; typedef std::forward_iterator_tag iterator_category; typedef eT value_type; typedef std::ptrdiff_t difference_type; // TODO: not certain on this one typedef eT* pointer; typedef eT& reference; arma_aligned Mat* M; arma_aligned eT* current_ptr; arma_aligned uword current_row; arma_aligned uword current_col; arma_aligned const uword aux_row1; arma_aligned const uword aux_row2_p1; }; class const_iterator { public: inline const_iterator(); inline const_iterator(const iterator& X); inline const_iterator(const const_iterator& X); inline const_iterator(const subview& in_sv, const uword in_row, const uword in_col); arma_warn_unused inline const eT& operator*(); inline const_iterator& operator++(); arma_warn_unused inline const_iterator operator++(int); arma_warn_unused inline bool operator==(const iterator& rhs) const; arma_warn_unused inline bool operator!=(const iterator& rhs) const; arma_warn_unused inline bool operator==(const const_iterator& rhs) const; arma_warn_unused inline bool operator!=(const const_iterator& rhs) const; // So that we satisfy the STL iterator types. typedef std::forward_iterator_tag iterator_category; typedef eT value_type; typedef std::ptrdiff_t difference_type; // TODO: not certain on this one typedef const eT* pointer; typedef const eT& reference; arma_aligned const Mat* M; arma_aligned const eT* current_ptr; arma_aligned uword current_row; arma_aligned uword current_col; arma_aligned const uword aux_row1; arma_aligned const uword aux_row2_p1; }; class const_row_iterator; class row_iterator { public: inline row_iterator(); inline row_iterator(const row_iterator& X); inline row_iterator(subview& in_sv, const uword in_row, const uword in_col); arma_warn_unused inline eT& operator* (); inline row_iterator& operator++(); arma_warn_unused inline row_iterator operator++(int); arma_warn_unused inline bool operator!=(const row_iterator& X) const; arma_warn_unused inline bool operator==(const row_iterator& X) const; arma_warn_unused inline bool operator!=(const const_row_iterator& X) const; arma_warn_unused inline bool operator==(const const_row_iterator& X) const; typedef std::forward_iterator_tag iterator_category; typedef eT value_type; typedef std::ptrdiff_t difference_type; // TODO: not certain on this one typedef eT* pointer; typedef eT& reference; arma_aligned Mat* M; arma_aligned uword current_row; arma_aligned uword current_col; arma_aligned const uword aux_col1; arma_aligned const uword aux_col2_p1; }; class const_row_iterator { public: inline const_row_iterator(); inline const_row_iterator(const row_iterator& X); inline const_row_iterator(const const_row_iterator& X); inline const_row_iterator(const subview& in_sv, const uword in_row, const uword in_col); arma_warn_unused inline const eT& operator*() const; inline const_row_iterator& operator++(); arma_warn_unused inline const_row_iterator operator++(int); arma_warn_unused inline bool operator!=(const row_iterator& X) const; arma_warn_unused inline bool operator==(const row_iterator& X) const; arma_warn_unused inline bool operator!=(const const_row_iterator& X) const; arma_warn_unused inline bool operator==(const const_row_iterator& X) const; typedef std::forward_iterator_tag iterator_category; typedef eT value_type; typedef std::ptrdiff_t difference_type; // TODO: not certain on this one typedef const eT* pointer; typedef const eT& reference; arma_aligned const Mat* M; arma_aligned uword current_row; arma_aligned uword current_col; arma_aligned const uword aux_col1; arma_aligned const uword aux_col2_p1; }; inline iterator begin(); inline const_iterator begin() const; inline const_iterator cbegin() const; inline iterator end(); inline const_iterator end() const; inline const_iterator cend() const; friend class Mat; }; template class subview_col : public subview { public: typedef eT elem_type; typedef typename get_pod_type::result pod_type; static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; const eT* colmem; inline void operator= (const subview& x); inline void operator= (const subview_col& x); inline void operator= (const eT val); inline void operator= (const std::initializer_list& list); template inline void operator= (const Base& x); template inline void operator= (const SpBase& x); template inline typename enable_if2< is_same_type::value, void>::result operator=(const Gen& x); arma_warn_unused arma_inline const Op,op_htrans> t() const; arma_warn_unused arma_inline const Op,op_htrans> ht() const; arma_warn_unused arma_inline const Op,op_strans> st() const; arma_warn_unused arma_inline const Op,op_strans> as_row() const; inline void fill(const eT val); inline void zeros(); inline void ones(); arma_inline eT at_alt (const uword i) const; arma_inline eT& operator[](const uword i); arma_inline eT operator[](const uword i) const; inline eT& operator()(const uword i); inline eT operator()(const uword i) const; inline eT& operator()(const uword in_row, const uword in_col); inline eT operator()(const uword in_row, const uword in_col) const; inline eT& at(const uword in_row, const uword in_col); inline eT at(const uword in_row, const uword in_col) const; arma_inline eT* colptr(const uword in_col); arma_inline const eT* colptr(const uword in_col) const; inline subview_col rows(const uword in_row1, const uword in_row2); inline const subview_col rows(const uword in_row1, const uword in_row2) const; inline subview_col subvec(const uword in_row1, const uword in_row2); inline const subview_col subvec(const uword in_row1, const uword in_row2) const; inline subview_col subvec(const uword start_row, const SizeMat& s); inline const subview_col subvec(const uword start_row, const SizeMat& s) const; inline subview_col head(const uword N); inline const subview_col head(const uword N) const; inline subview_col tail(const uword N); inline const subview_col tail(const uword N) const; arma_warn_unused inline eT min() const; arma_warn_unused inline eT max() const; arma_frown("use .index_min() instead") inline eT min(uword& index_of_min_val) const; arma_frown("use .index_max() instead") inline eT max(uword& index_of_max_val) const; arma_warn_unused inline uword index_min() const; arma_warn_unused inline uword index_max() const; inline subview_col(const subview_col& in); inline subview_col( subview_col&& in); protected: inline subview_col(const Mat& in_m, const uword in_col); inline subview_col(const Mat& in_m, const uword in_col, const uword in_row1, const uword in_n_rows); inline subview_col() = delete; friend class Mat; friend class Col; friend class subview; }; template class subview_cols : public subview { public: typedef eT elem_type; typedef typename get_pod_type::result pod_type; static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = false; inline subview_cols(const subview_cols& in); inline subview_cols( subview_cols&& in); inline void operator= (const subview& x); inline void operator= (const subview_cols& x); inline void operator= (const eT val); inline void operator= (const std::initializer_list& list); inline void operator= (const std::initializer_list< std::initializer_list >& list); template inline void operator= (const Base& x); template inline void operator= (const SpBase& x); template inline typename enable_if2< is_same_type::value, void>::result operator=(const Gen& x); arma_warn_unused arma_inline const Op,op_htrans> t() const; arma_warn_unused arma_inline const Op,op_htrans> ht() const; arma_warn_unused arma_inline const Op,op_strans> st() const; arma_warn_unused arma_inline const Op,op_vectorise_col> as_col() const; arma_warn_unused inline eT at_alt (const uword ii) const; arma_warn_unused inline eT& operator[](const uword ii); arma_warn_unused inline eT operator[](const uword ii) const; arma_warn_unused inline eT& operator()(const uword ii); arma_warn_unused inline eT operator()(const uword ii) const; arma_warn_unused inline eT& operator()(const uword in_row, const uword in_col); arma_warn_unused inline eT operator()(const uword in_row, const uword in_col) const; arma_warn_unused inline eT& at(const uword in_row, const uword in_col); arma_warn_unused inline eT at(const uword in_row, const uword in_col) const; arma_inline eT* colptr(const uword in_col); arma_inline const eT* colptr(const uword in_col) const; protected: inline subview_cols(const Mat& in_m, const uword in_col1, const uword in_n_cols); inline subview_cols() = delete; friend class Mat; friend class subview; }; template class subview_row : public subview { public: typedef eT elem_type; typedef typename get_pod_type::result pod_type; static constexpr bool is_row = true; static constexpr bool is_col = false; static constexpr bool is_xvec = false; inline void operator= (const subview& x); inline void operator= (const subview_row& x); inline void operator= (const eT val); inline void operator= (const std::initializer_list& list); template inline void operator= (const Base& x); template inline void operator= (const SpBase& x); template inline typename enable_if2< is_same_type::value, void>::result operator=(const Gen& x); arma_warn_unused arma_inline const Op,op_htrans> t() const; arma_warn_unused arma_inline const Op,op_htrans> ht() const; arma_warn_unused arma_inline const Op,op_strans> st() const; arma_warn_unused arma_inline const Op,op_strans> as_col() const; inline eT at_alt (const uword i) const; inline eT& operator[](const uword i); inline eT operator[](const uword i) const; inline eT& operator()(const uword i); inline eT operator()(const uword i) const; inline eT& operator()(const uword in_row, const uword in_col); inline eT operator()(const uword in_row, const uword in_col) const; inline eT& at(const uword in_row, const uword in_col); inline eT at(const uword in_row, const uword in_col) const; inline subview_row cols(const uword in_col1, const uword in_col2); inline const subview_row cols(const uword in_col1, const uword in_col2) const; inline subview_row subvec(const uword in_col1, const uword in_col2); inline const subview_row subvec(const uword in_col1, const uword in_col2) const; inline subview_row subvec(const uword start_col, const SizeMat& s); inline const subview_row subvec(const uword start_col, const SizeMat& s) const; inline subview_row head(const uword N); inline const subview_row head(const uword N) const; inline subview_row tail(const uword N); inline const subview_row tail(const uword N) const; arma_warn_unused inline uword index_min() const; arma_warn_unused inline uword index_max() const; inline typename subview::row_iterator begin(); inline typename subview::const_row_iterator begin() const; inline typename subview::const_row_iterator cbegin() const; inline typename subview::row_iterator end(); inline typename subview::const_row_iterator end() const; inline typename subview::const_row_iterator cend() const; inline subview_row(const subview_row& in); inline subview_row( subview_row&& in); protected: inline subview_row(const Mat& in_m, const uword in_row); inline subview_row(const Mat& in_m, const uword in_row, const uword in_col1, const uword in_n_cols); inline subview_row() = delete; friend class Mat; friend class Row; friend class subview; }; template class subview_row_strans : public Base< eT, subview_row_strans > { public: typedef eT elem_type; typedef typename get_pod_type::result pod_type; static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; arma_aligned const subview_row& sv_row; const uword n_rows; // equal to n_elem const uword n_elem; static constexpr uword n_cols = 1; inline explicit subview_row_strans(const subview_row& in_sv_row); inline void extract(Mat& out) const; inline eT at_alt (const uword i) const; inline eT operator[](const uword i) const; inline eT operator()(const uword i) const; inline eT operator()(const uword in_row, const uword in_col) const; inline eT at(const uword in_row, const uword in_col) const; }; template class subview_row_htrans : public Base< eT, subview_row_htrans > { public: typedef eT elem_type; typedef typename get_pod_type::result pod_type; static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; arma_aligned const subview_row& sv_row; const uword n_rows; // equal to n_elem const uword n_elem; static constexpr uword n_cols = 1; inline explicit subview_row_htrans(const subview_row& in_sv_row); inline void extract(Mat& out) const; inline eT at_alt (const uword i) const; inline eT operator[](const uword i) const; inline eT operator()(const uword i) const; inline eT operator()(const uword in_row, const uword in_col) const; inline eT at(const uword in_row, const uword in_col) const; }; //! @} RcppArmadillo/inst/include/armadillo_bits/fn_repmat.hpp0000644000176200001440000000251214631567470023071 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_repmat //! @{ template arma_warn_unused arma_inline typename enable_if2 < is_arma_type::value, const Op >::result repmat(const T1& A, const uword r, const uword c) { arma_debug_sigprint(); return Op(A, r, c); } template arma_warn_unused arma_inline const SpOp repmat(const SpBase& A, const uword r, const uword c) { arma_debug_sigprint(); return SpOp(A.get_ref(), r, c); } //! @} RcppArmadillo/inst/include/armadillo_bits/arma_static_check.hpp0000644000176200001440000000212514301267043024525 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup arma_static_check //! @{ #undef arma_static_check #define arma_static_check(condition, message) static_assert( !(condition), message ) #undef arma_type_check #define arma_type_check(condition) static_assert( !(condition), "error: type mismatch or unsupported type" ) //! @} RcppArmadillo/inst/include/armadillo_bits/fn_det.hpp0000644000176200001440000000364614635324415022360 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_det //! @{ template arma_warn_unused inline typename enable_if2< is_supported_blas_type::value, typename T1::elem_type >::result det(const Base& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; eT out_val = eT(0); const bool status = op_det::apply_direct(out_val, X.get_ref()); if(status == false) { out_val = eT(0); arma_stop_runtime_error("det(): failed to find determinant"); } return out_val; } template inline typename enable_if2< is_supported_blas_type::value, bool >::result det(typename T1::elem_type& out_val, const Base& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const bool status = op_det::apply_direct(out_val, X.get_ref()); if(status == false) { out_val = eT(0); arma_warn(3, "det(): failed to find determinant"); } return status; } template arma_warn_unused arma_inline typename arma_scalar_only::result det(const T& x) { return x; } //! @} RcppArmadillo/inst/include/armadillo_bits/wall_clock_meat.hpp0000644000176200001440000000310314634016465024227 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup wall_clock //! @{ inline wall_clock::wall_clock() { arma_debug_sigprint(); chrono_time1 = std::chrono::steady_clock::now(); // warmup } inline wall_clock::~wall_clock() { arma_debug_sigprint(); } inline void wall_clock::tic() { arma_debug_sigprint(); valid = true; chrono_time1 = std::chrono::steady_clock::now(); } inline double wall_clock::toc() { arma_debug_sigprint(); const std::chrono::steady_clock::time_point chrono_time2 = std::chrono::steady_clock::now(); typedef std::chrono::duration duration_type; // TODO: check this const duration_type chrono_span = std::chrono::duration_cast< duration_type >(chrono_time2 - chrono_time1); return (valid) ? double(chrono_span.count()) : double(0); } //! @} RcppArmadillo/inst/include/armadillo_bits/op_wishrnd_bones.hpp0000644000176200001440000000377114301267043024453 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_wishrnd //! @{ class op_wishrnd : public traits_op_default { public: template inline static void apply(Mat& out, const Op& expr); template inline static bool apply_direct(Mat& out, const Base& X, const typename T1::elem_type df, const uword mode); template inline static bool apply_noalias_mode1(Mat& out, const Mat& S, const eT df); template inline static bool apply_noalias_mode2(Mat& out, const Mat& D, const eT df); }; class op_iwishrnd : public traits_op_default { public: template inline static void apply(Mat& out, const Op& expr); template inline static bool apply_direct(Mat& out, const Base& X, const typename T1::elem_type df, const uword mode); template inline static bool apply_noalias_mode1(Mat& out, const Mat& T, const eT df); template inline static bool apply_noalias_mode2(Mat& out, const Mat& Dinv, const eT df); }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_diagmat_bones.hpp0000644000176200001440000000400614301267043024373 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_diagmat //! @{ class op_diagmat : public traits_op_default { public: template inline static void apply(Mat& out, const Op& X); template inline static void apply(Mat& out, const Proxy& P); template inline static void apply(Mat& out, const Op< Glue, op_diagmat>& X); template inline static void apply_times(Mat& out, const T1& X, const T2& Y, const typename arma_not_cx::result* junk = nullptr); template inline static void apply_times(Mat& out, const T1& X, const T2& Y, const typename arma_cx_only::result* junk = nullptr); }; class op_diagmat2 : public traits_op_default { public: template inline static void apply(Mat& out, const Op& X); template inline static void apply(Mat& out, const Proxy& P, const uword row_offset, const uword col_offset); }; //! @} RcppArmadillo/inst/include/armadillo_bits/spop_misc_bones.hpp0000644000176200001440000001250015030507611024257 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup spop_misc //! @{ class spop_scalar_times : public traits_op_passthru { public: template inline static void apply(SpMat& out, const SpOp& in); }; class spop_cx_scalar_times : public traits_op_passthru { public: template inline static void apply(SpMat< std::complex >& out, const mtSpOp< std::complex, T1, spop_cx_scalar_times>& in); }; class spop_square : public traits_op_passthru { public: template inline static void apply(SpMat& out, const SpOp& in); }; class spop_sqrt : public traits_op_passthru { public: template inline static void apply(SpMat& out, const SpOp& in); }; class spop_cbrt : public traits_op_passthru { public: template inline static void apply(SpMat& out, const SpOp& in); }; class spop_abs : public traits_op_passthru { public: template inline static void apply(SpMat& out, const SpOp& in); }; class spop_cx_abs : public traits_op_passthru { public: template inline static void apply(SpMat& out, const mtSpOp& in); }; class spop_arg : public traits_op_passthru { public: template inline static void apply(SpMat& out, const SpOp& in); }; class spop_cx_arg : public traits_op_passthru { public: template inline static void apply(SpMat& out, const mtSpOp& in); }; class spop_real : public traits_op_passthru { public: template inline static void apply(SpMat& out, const mtSpOp& in); }; class spop_imag : public traits_op_passthru { public: template inline static void apply(SpMat& out, const mtSpOp& in); }; class spop_conj : public traits_op_passthru { public: template inline static void apply(SpMat& out, const SpOp& in); }; class spop_repelem : public traits_op_default { public: template inline static void apply(SpMat& out, const SpOp& in); }; class spop_reshape : public traits_op_default { public: template inline static void apply(SpMat& out, const SpOp& in); }; class spop_resize : public traits_op_default { public: template inline static void apply(SpMat& out, const SpOp& in); }; class spop_floor : public traits_op_passthru { public: template inline static void apply(SpMat& out, const SpOp& in); }; class spop_ceil : public traits_op_passthru { public: template inline static void apply(SpMat& out, const SpOp& in); }; class spop_round : public traits_op_passthru { public: template inline static void apply(SpMat& out, const SpOp& in); }; class spop_trunc : public traits_op_passthru { public: template inline static void apply(SpMat& out, const SpOp& in); }; class spop_sign : public traits_op_passthru { public: template inline static void apply(SpMat& out, const SpOp& in); }; class spop_flipud : public traits_op_passthru { public: template inline static void apply(SpMat& out, const SpOp& in); }; class spop_fliplr : public traits_op_passthru { public: template inline static void apply(SpMat& out, const SpOp& in); }; class spop_replace : public traits_op_passthru { public: template inline static void apply(SpMat& out, const mtSpOp& in); }; //! @} RcppArmadillo/inst/include/armadillo_bits/newarp_SymEigsSolver_meat.hpp0000644000176200001440000003226214631567470026260 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ namespace newarp { template inline void SymEigsSolver::fill_rand(eT* dest, const uword N, const uword seed_val) { arma_debug_sigprint(); typedef typename std::mt19937_64::result_type seed_type; local_rng.seed( seed_type(seed_val) ); std::uniform_real_distribution dist(-1.0, +1.0); for(uword i=0; i < N; ++i) { dest[i] = eT(dist(local_rng)); } } template inline void SymEigsSolver::factorise_from(uword from_k, uword to_m, const Col& fk) { arma_debug_sigprint(); if(to_m <= from_k) { return; } fac_f = fk; Col w(dim_n, arma_zeros_indicator()); // Norm of f eT beta = norm(fac_f); // Used to test beta~=0 const eT beta_thresh = eps * eop_aux::sqrt(dim_n); // Keep the upperleft k x k submatrix of H and set other elements to 0 fac_H.tail_cols(ncv - from_k).zeros(); fac_H.submat(span(from_k, ncv - 1), span(0, from_k - 1)).zeros(); for(uword i = from_k; i <= to_m - 1; i++) { bool restart = false; // If beta = 0, then the next V is not full rank // We need to generate a new residual vector that is orthogonal // to the current V, which we call a restart if(beta < near0) { // // Generate new random vector for fac_f // blas_int idist = 2; // blas_int iseed[4] = {1, 3, 5, 7}; // iseed[0] = (i + 100) % 4095; // blas_int n = dim_n; // lapack::larnv(&idist, &iseed[0], &n, fac_f.memptr()); // Generate new random vector for fac_f fill_rand(fac_f.memptr(), dim_n, i+1); // f <- f - V * V' * f, so that f is orthogonal to V Mat Vs(fac_V.memptr(), dim_n, i, false); // First i columns Col Vf = Vs.t() * fac_f; fac_f -= Vs * Vf; // beta <- ||f|| beta = norm(fac_f); restart = true; } // v <- f / ||f|| Col v(fac_V.colptr(i), dim_n, false); // The (i+1)-th column v = fac_f / beta; // Note that H[i+1, i] equals to the unrestarted beta fac_H(i, i - 1) = restart ? eT(0) : beta; // w <- A * v, v = fac_V.col(i) op.perform_op(v.memptr(), w.memptr()); nmatop++; fac_H(i - 1, i) = fac_H(i, i - 1); // Due to symmetry eT Hii = dot(v, w); fac_H(i, i) = Hii; // f <- w - V * V' * w = w - H[i+1, i] * V{i} - H[i+1, i+1] * V{i+1} // If restarting, we know that H[i+1, i] = 0 if(restart) { fac_f = w - Hii * v; } else { fac_f = w - fac_H(i, i - 1) * fac_V.col(i - 1) - Hii * v; } beta = norm(fac_f); // f/||f|| is going to be the next column of V, so we need to test // whether V' * (f/||f||) ~= 0 Mat Vs(fac_V.memptr(), dim_n, i + 1, false); // First i+1 columns Col Vf = Vs.t() * fac_f; eT ortho_err = abs(Vf).max(); // If not, iteratively correct the residual uword count = 0; while(count < 5 && ortho_err > eps * beta) { // There is an edge case: when beta=||f|| is close to zero, f mostly consists // of rounding errors, so the test [ortho_err < eps * beta] is very // likely to fail. In particular, if beta=0, then the test is ensured to fail. // Hence when this happens, we force f to be zero, and then restart in the // next iteration. if(beta < beta_thresh) { fac_f.zeros(); beta = eT(0); break; } // f <- f - V * Vf fac_f -= Vs * Vf; // h <- h + Vf fac_H(i - 1, i) += Vf[i - 1]; fac_H(i, i - 1) = fac_H(i - 1, i); fac_H(i, i) += Vf[i]; // beta <- ||f|| beta = norm(fac_f); Vf = Vs.t() * fac_f; ortho_err = abs(Vf).max(); count++; } } } template inline void SymEigsSolver::restart(uword k) { arma_debug_sigprint(); if(k >= ncv) { return; } TridiagQR decomp; Mat Q(ncv, ncv, fill::eye); for(uword i = k; i < ncv; i++) { // QR decomposition of H-mu*I, mu is the shift fac_H.diag() -= ritz_val(i); decomp.compute(fac_H); // Q -> Q * Qi decomp.apply_YQ(Q); // H -> Q'HQ // Since QR = H - mu * I, we have H = QR + mu * I // and therefore Q'HQ = RQ + mu * I fac_H = decomp.matrix_RQ(); fac_H.diag() += ritz_val(i); } // V -> VQ, only need to update the first k+1 columns // Q has some elements being zero // The first (ncv - k + i) elements of the i-th column of Q are non-zero Mat Vs(dim_n, k + 1, arma_nozeros_indicator()); uword nnz; for(uword i = 0; i < k; i++) { nnz = ncv - k + i + 1; Mat V(fac_V.memptr(), dim_n, nnz, false); Col q(Q.colptr(i), nnz, false); // OLD CODE: // Vs.col(i) = V * q; // NEW CODE: Col v(Vs.colptr(i), dim_n, false, true); v = V * q; } Vs.col(k) = fac_V * Q.col(k); fac_V.head_cols(k + 1) = Vs; Col fk = fac_f * Q(ncv - 1, k - 1) + fac_V.col(k) * fac_H(k, k - 1); factorise_from(k, ncv, fk); retrieve_ritzpair(); } template inline uword SymEigsSolver::num_converged(eT tol) { arma_debug_sigprint(); // thresh = tol * max(approx0, abs(theta)), theta for ritz value const eT f_norm = norm(fac_f); for(uword i = 0; i < nev; i++) { eT thresh = tol * (std::max)(eps23, std::abs(ritz_val(i))); eT resid = std::abs(ritz_est(i)) * f_norm; ritz_conv[i] = (resid < thresh); } return std::count(ritz_conv.begin(), ritz_conv.end(), true); } template inline uword SymEigsSolver::nev_adjusted(uword nconv) { arma_debug_sigprint(); uword nev_new = nev; for(uword i = nev; i < ncv; i++) { if(std::abs(ritz_est(i)) < near0) { nev_new++; } } // Adjust nev_new, according to dsaup2.f line 677~684 in ARPACK nev_new += (std::min)(nconv, (ncv - nev_new) / 2); if(nev_new >= ncv) { nev_new = ncv - 1; } if(nev_new == 1) { if(ncv >= 6) { nev_new = ncv / 2; } else if(ncv > 2) { nev_new = 2; } } return nev_new; } template inline void SymEigsSolver::retrieve_ritzpair() { arma_debug_sigprint(); TridiagEigen decomp(fac_H); Col evals = decomp.eigenvalues(); Mat evecs = decomp.eigenvectors(); SortEigenvalue sorting(evals.memptr(), evals.n_elem); std::vector ind = sorting.index(); // For BOTH_ENDS, the eigenvalues are sorted according // to the LARGEST_ALGE rule, so we need to move those smallest // values to the left // The order would be // Largest => Smallest => 2nd largest => 2nd smallest => ... // We keep this order since the first k values will always be // the wanted collection, no matter k is nev_updated (used in restart()) // or is nev (used in sort_ritzpair()) if(SelectionRule == EigsSelect::BOTH_ENDS) { std::vector ind_copy(ind); for(uword i = 0; i < ncv; i++) { // If i is even, pick values from the left (large values) // If i is odd, pick values from the right (small values) ind[i] = (i % 2 == 0) ? ind_copy[i / 2] : ind_copy[ncv - 1 - i / 2]; } } // Copy the ritz values and vectors to ritz_val and ritz_vec, respectively for(uword i = 0; i < ncv; i++) { ritz_val(i) = evals(ind[i]); ritz_est(i) = evecs(ncv - 1, ind[i]); } for(uword i = 0; i < nev; i++) { ritz_vec.col(i) = evecs.col(ind[i]); } } template inline void SymEigsSolver::sort_ritzpair() { arma_debug_sigprint(); // SortEigenvalue sorting(ritz_val.memptr(), nev); // Sort Ritz values in ascending algebraic, to be consistent with ARPACK SortEigenvalue sorting(ritz_val.memptr(), nev); std::vector ind = sorting.index(); Col new_ritz_val(ncv, arma_zeros_indicator() ); Mat new_ritz_vec(ncv, nev, arma_nozeros_indicator()); std::vector new_ritz_conv(nev); for(uword i = 0; i < nev; i++) { new_ritz_val(i) = ritz_val(ind[i]); new_ritz_vec.col(i) = ritz_vec.col(ind[i]); new_ritz_conv[i] = ritz_conv[ind[i]]; } ritz_val.swap(new_ritz_val); ritz_vec.swap(new_ritz_vec); ritz_conv.swap(new_ritz_conv); } template inline SymEigsSolver::SymEigsSolver(const OpType& op_, uword nev_, uword ncv_) : op(op_) , nev(nev_) , dim_n(op.n_rows) , ncv(ncv_ > dim_n ? dim_n : ncv_) , nmatop(0) , niter(0) , eps(std::numeric_limits::epsilon()) , eps23(std::pow(eps, eT(2.0) / 3)) , near0(std::numeric_limits::min() * eT(10)) { arma_debug_sigprint(); arma_conform_check( (nev_ < 1 || nev_ > dim_n - 1), "newarp::SymEigsSolver: nev must satisfy 1 <= nev <= n - 1, n is the size of matrix" ); arma_conform_check( (ncv_ <= nev_ || ncv_ > dim_n), "newarp::SymEigsSolver: ncv must satisfy nev < ncv <= n, n is the size of matrix" ); } template inline void SymEigsSolver::init(eT* init_resid) { arma_debug_sigprint(); // Reset all matrices/vectors to zero fac_V.zeros(dim_n, ncv); fac_H.zeros(ncv, ncv); fac_f.zeros(dim_n); ritz_val.zeros(ncv); ritz_vec.zeros(ncv, nev); ritz_est.zeros(ncv); ritz_conv.assign(nev, false); nmatop = 0; niter = 0; Col r(init_resid, dim_n, false); // The first column of fac_V Col v(fac_V.colptr(0), dim_n, false); eT rnorm = norm(r); arma_check( (rnorm < near0), "newarp::SymEigsSolver::init(): initial residual vector cannot be zero" ); v = r / rnorm; Col w(dim_n, arma_zeros_indicator()); op.perform_op(v.memptr(), w.memptr()); nmatop++; fac_H(0, 0) = dot(v, w); fac_f = w - v * fac_H(0, 0); // In some cases f is zero in exact arithmetics, but due to rounding errors // it may contain tiny fluctuations. When this happens, we force f to be zero if(abs(fac_f).max() < eps) { fac_f.zeros(); } } template inline void SymEigsSolver::init() { arma_debug_sigprint(); // podarray init_resid(dim_n); // blas_int idist = 2; // Uniform(-1, 1) // blas_int iseed[4] = {1, 3, 5, 7}; // Fixed random seed // blas_int n = dim_n; // lapack::larnv(&idist, &iseed[0], &n, init_resid.memptr()); // init(init_resid.memptr()); podarray init_resid(dim_n); fill_rand(init_resid.memptr(), dim_n, 0); init(init_resid.memptr()); } template inline uword SymEigsSolver::compute(uword maxit, eT tol) { arma_debug_sigprint(); // The m-step Arnoldi factorisation factorise_from(1, ncv, fac_f); retrieve_ritzpair(); // Restarting uword i, nconv = 0, nev_adj; for(i = 0; i < maxit; i++) { nconv = num_converged(tol); if(nconv >= nev) { break; } nev_adj = nev_adjusted(nconv); restart(nev_adj); } // Sorting results sort_ritzpair(); niter = i + 1; return (std::min)(nev, nconv); } template inline Col SymEigsSolver::eigenvalues() { arma_debug_sigprint(); uword nconv = std::count(ritz_conv.begin(), ritz_conv.end(), true); Col res(nconv, arma_zeros_indicator()); if(nconv > 0) { uword j = 0; for(uword i=0; i < nev; i++) { if(ritz_conv[i]) { res(j) = ritz_val(i); j++; } } } return res; } template inline Mat SymEigsSolver::eigenvectors(uword nvec) { arma_debug_sigprint(); uword nconv = std::count(ritz_conv.begin(), ritz_conv.end(), true); nvec = (std::min)(nvec, nconv); Mat res(dim_n, nvec); if(nvec > 0) { Mat ritz_vec_conv(ncv, nvec, arma_zeros_indicator()); uword j = 0; for(uword i=0; i < nev && j < nvec; i++) { if(ritz_conv[i]) { ritz_vec_conv.col(j) = ritz_vec.col(i); j++; } } res = fac_V * ritz_vec_conv; } return res; } } // namespace newarp RcppArmadillo/inst/include/armadillo_bits/op_det_meat.hpp0000644000176200001440000001103014631567470023371 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_det //! @{ template inline bool op_det::apply_direct(typename T1::elem_type& out_val, const Base& expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; typedef typename T1::pod_type T; if(strip_diagmat::do_diagmat) { const strip_diagmat strip(expr.get_ref()); out_val = op_det::apply_diagmat(strip.M); return true; } if(strip_trimat::do_trimat) { const strip_trimat strip(expr.get_ref()); out_val = op_det::apply_trimat(strip.M); return true; } Mat A(expr.get_ref()); arma_conform_check( (A.is_square() == false), "det(): given matrix must be square sized" ); const uword N = A.n_rows; if(N == 0) { out_val = eT(1); return true; } if(N == 1) { out_val = A[0]; return true; } if((is_cx::no) && (N <= 3)) { constexpr T det_min = std::numeric_limits::epsilon(); constexpr T det_max = T(1) / std::numeric_limits::epsilon(); eT det_val = eT(0); if(N == 2) { det_val = op_det::apply_tiny_2x2(A); } if(N == 3) { det_val = op_det::apply_tiny_3x3(A); } const T abs_det_val = std::abs(det_val); if((abs_det_val > det_min) && (abs_det_val < det_max)) { out_val = det_val; return true; } // fallthrough if det_val is suspect } if(A.is_diagmat()) { out_val = op_det::apply_diagmat(A); return true; } const bool is_triu = trimat_helper::is_triu(A); const bool is_tril = is_triu ? false : trimat_helper::is_tril(A); if(is_triu || is_tril) { out_val = op_det::apply_trimat(A); return true; } return auxlib::det(out_val, A); } template inline typename T1::elem_type op_det::apply_diagmat(const Base& expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const diagmat_proxy A(expr.get_ref()); arma_conform_check( (A.n_rows != A.n_cols), "det(): given matrix must be square sized" ); const uword N = (std::min)(A.n_rows, A.n_cols); eT val = eT(1); for(uword i=0; i inline typename T1::elem_type op_det::apply_trimat(const Base& expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const Proxy P(expr.get_ref()); const uword N = P.get_n_rows(); arma_conform_check( (N != P.get_n_cols()), "det(): given matrix must be square sized" ); eT val = eT(1); for(uword i=0; i inline eT op_det::apply_tiny_2x2(const Mat& X) { arma_debug_sigprint(); const eT* Xm = X.memptr(); return ( Xm[pos<0,0>::n2]*Xm[pos<1,1>::n2] - Xm[pos<0,1>::n2]*Xm[pos<1,0>::n2] ); } template inline eT op_det::apply_tiny_3x3(const Mat& X) { arma_debug_sigprint(); const eT* Xm = X.memptr(); // const double tmp1 = X.at(0,0) * X.at(1,1) * X.at(2,2); // const double tmp2 = X.at(0,1) * X.at(1,2) * X.at(2,0); // const double tmp3 = X.at(0,2) * X.at(1,0) * X.at(2,1); // const double tmp4 = X.at(2,0) * X.at(1,1) * X.at(0,2); // const double tmp5 = X.at(2,1) * X.at(1,2) * X.at(0,0); // const double tmp6 = X.at(2,2) * X.at(1,0) * X.at(0,1); // return (tmp1+tmp2+tmp3) - (tmp4+tmp5+tmp6); const eT val1 = Xm[pos<0,0>::n3]*(Xm[pos<2,2>::n3]*Xm[pos<1,1>::n3] - Xm[pos<2,1>::n3]*Xm[pos<1,2>::n3]); const eT val2 = Xm[pos<1,0>::n3]*(Xm[pos<2,2>::n3]*Xm[pos<0,1>::n3] - Xm[pos<2,1>::n3]*Xm[pos<0,2>::n3]); const eT val3 = Xm[pos<2,0>::n3]*(Xm[pos<1,2>::n3]*Xm[pos<0,1>::n3] - Xm[pos<1,1>::n3]*Xm[pos<0,2>::n3]); return ( val1 - val2 + val3 ); } //! @} RcppArmadillo/inst/include/armadillo_bits/op_pinv_meat.hpp0000644000176200001440000001713714713753317023605 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_pinv //! @{ template inline void op_pinv_default::apply(Mat& out, const Op& in) { arma_debug_sigprint(); const bool status = op_pinv_default::apply_direct(out, in.m); if(status == false) { out.soft_reset(); arma_stop_runtime_error("pinv(): svd failed"); } } template inline bool op_pinv_default::apply_direct(Mat& out, const Base& expr) { arma_debug_sigprint(); typedef typename T1::pod_type T; constexpr T tol = T(0); constexpr uword method_id = uword(0); return op_pinv::apply_direct(out, expr, tol, method_id); } // template inline void op_pinv::apply(Mat& out, const Op& in) { arma_debug_sigprint(); typedef typename T1::pod_type T; const T tol = access::tmp_real(in.aux); const uword method_id = in.aux_uword_a; const bool status = op_pinv::apply_direct(out, in.m, tol, method_id); if(status == false) { out.soft_reset(); arma_stop_runtime_error("pinv(): svd failed"); } } template inline bool op_pinv::apply_direct(Mat& out, const Base& expr, typename T1::pod_type tol, const uword method_id) { arma_debug_sigprint(); typedef typename T1::elem_type eT; typedef typename T1::pod_type T; arma_conform_check((tol < T(0)), "pinv(): tolerance must be >= 0"); // method_id = 0 -> default setting // method_id = 1 -> use standard algorithm // method_id = 2 -> use divide and conquer algorithm Mat A(expr.get_ref()); if(A.is_empty()) { out.set_size(A.n_cols,A.n_rows); return true; } if(is_op_diagmat::value || A.is_diagmat()) { arma_debug_print("op_pinv: diag optimisation"); return op_pinv::apply_diag(out, A, tol); } bool do_sym = false; const bool is_sym_size_ok = (A.n_rows == A.n_cols) && (A.n_rows > (is_cx::yes ? uword(20) : uword(40))); if( (is_sym_size_ok) && (arma_config::optimise_sym) && (auxlib::crippled_lapack(A) == false) ) { do_sym = is_sym_expr::eval(expr.get_ref()); if(do_sym == false) { do_sym = sym_helper::is_approx_sym(A); } } if(do_sym) { arma_debug_print("op_pinv: symmetric/hermitian optimisation"); return op_pinv::apply_sym(out, A, tol, method_id); } return op_pinv::apply_gen(out, A, tol, method_id); } template inline bool op_pinv::apply_diag(Mat& out, const Mat& A, typename get_pod_type::result tol) { arma_debug_sigprint(); typedef typename get_pod_type::result T; out.zeros(A.n_cols, A.n_rows); const uword N = (std::min)(A.n_rows, A.n_cols); podarray diag_abs_vals(N); T max_abs_Aii = T(0); for(uword i=0; i max_abs_Aii) ? abs_Aii : max_abs_Aii; } if(tol == T(0)) { tol = (std::max)(A.n_rows, A.n_cols) * max_abs_Aii * std::numeric_limits::epsilon(); } for(uword i=0; i= tol) { const eT Aii = A.at(i,i); if(Aii != eT(0)) { out.at(i,i) = eT(eT(1) / Aii); } } } return true; } template inline bool op_pinv::apply_sym(Mat& out, const Mat& A, typename get_pod_type::result tol, const uword method_id) { arma_debug_sigprint(); typedef typename get_pod_type::result T; Col< T> eigval; Mat eigvec; const bool status = ((method_id == uword(0)) || (method_id == uword(2))) ? auxlib::eig_sym_dc(eigval, eigvec, A) : auxlib::eig_sym(eigval, eigvec, A); if(status == false) { return false; } if(eigval.n_elem == 0) { out.zeros(A.n_cols, A.n_rows); return true; } Col abs_eigval = arma::abs(eigval); const uvec indices = sort_index(abs_eigval, "descend"); abs_eigval = abs_eigval.elem(indices); eigval = eigval.elem(indices); eigvec = eigvec.cols(indices); // set tolerance to default if it hasn't been specified if(tol == T(0)) { tol = (std::max)(A.n_rows, A.n_cols) * abs_eigval[0] * std::numeric_limits::epsilon(); } uword count = 0; for(uword i=0; i < abs_eigval.n_elem; ++i) { count += (abs_eigval[i] >= tol) ? uword(1) : uword(0); } if(count == 0) { out.zeros(A.n_cols, A.n_rows); return true; } Col eigval2(count, arma_nozeros_indicator()); uword count2 = 0; for(uword i=0; i < eigval.n_elem; ++i) { const T abs_val = abs_eigval[i]; const T val = eigval[i]; if(abs_val >= tol) { eigval2[count2] = (val != T(0)) ? T(T(1) / val) : T(0); ++count2; } } const Mat eigvec_use(eigvec.memptr(), eigvec.n_rows, count, false); out = (eigvec_use * diagmat(eigval2)).eval() * eigvec_use.t(); return true; } template inline bool op_pinv::apply_gen(Mat& out, Mat& A, typename get_pod_type::result tol, const uword method_id) { arma_debug_sigprint(); typedef typename get_pod_type::result T; const uword n_rows = A.n_rows; const uword n_cols = A.n_cols; // economical SVD decomposition Mat U; Col< T> s; Mat V; if(n_cols > n_rows) { A = trans(A); } const bool status = ((method_id == uword(0)) || (method_id == uword(2))) ? auxlib::svd_dc_econ(U, s, V, A) : auxlib::svd_econ(U, s, V, A, 'b'); if(status == false) { return false; } // set tolerance to default if it hasn't been specified if( (tol == T(0)) && (s.n_elem > 0) ) { tol = (std::max)(n_rows, n_cols) * s[0] * std::numeric_limits::epsilon(); } uword count = 0; for(uword i=0; i < s.n_elem; ++i) { count += (s[i] >= tol) ? uword(1) : uword(0); } if(count == 0) { out.zeros(n_cols, n_rows); return true; } Col s2(count, arma_nozeros_indicator()); uword count2 = 0; for(uword i=0; i < s.n_elem; ++i) { const T val = s[i]; if(val >= tol) { s2[count2] = (val > T(0)) ? T(T(1) / val) : T(0); ++count2; } } const Mat U_use(U.memptr(), U.n_rows, count, false); const Mat V_use(V.memptr(), V.n_rows, count, false); Mat tmp; if(n_rows >= n_cols) { // out = ( (V.n_cols > count) ? V.cols(0,count-1) : V ) * diagmat(s2) * trans( (U.n_cols > count) ? U.cols(0,count-1) : U ); tmp = V_use * diagmat(s2); out = tmp * trans(U_use); } else { // out = ( (U.n_cols > count) ? U.cols(0,count-1) : U ) * diagmat(s2) * trans( (V.n_cols > count) ? V.cols(0,count-1) : V ); tmp = U_use * diagmat(s2); out = tmp * trans(V_use); } return true; } //! @} RcppArmadillo/inst/include/armadillo_bits/op_orth_null_meat.hpp0000644000176200001440000001000314631567470024622 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_orth_null //! @{ template inline void op_orth::apply(Mat& out, const Op& expr) { arma_debug_sigprint(); typedef typename T1::pod_type T; const T tol = access::tmp_real(expr.aux); const bool status = op_orth::apply_direct(out, expr.m, tol); if(status == false) { out.soft_reset(); arma_stop_runtime_error("orth(): svd failed"); } } template inline bool op_orth::apply_direct(Mat& out, const Base& expr, typename T1::pod_type tol) { arma_debug_sigprint(); typedef typename T1::elem_type eT; typedef typename T1::pod_type T; arma_conform_check((tol < T(0)), "orth(): tolerance must be >= 0"); Mat A(expr.get_ref()); Mat U; Col< T> s; Mat V; const bool status = auxlib::svd_dc(U, s, V, A); V.reset(); if(status == false) { return false; } if(s.is_empty()) { out.reset(); return true; } const uword s_n_elem = s.n_elem; const T* s_mem = s.memptr(); // set tolerance to default if it hasn't been specified if(tol == T(0)) { tol = (std::max)(A.n_rows, A.n_cols) * s_mem[0] * std::numeric_limits::epsilon(); } uword count = 0; for(uword i=0; i < s_n_elem; ++i) { count += (s_mem[i] > tol) ? uword(1) : uword(0); } if(count > 0) { out = U.head_cols(count); // out *= eT(-1); } else { out.set_size(A.n_rows, 0); } return true; } // template inline void op_null::apply(Mat& out, const Op& expr) { arma_debug_sigprint(); typedef typename T1::pod_type T; const T tol = access::tmp_real(expr.aux); const bool status = op_null::apply_direct(out, expr.m, tol); if(status == false) { out.soft_reset(); arma_stop_runtime_error("null(): svd failed"); } } template inline bool op_null::apply_direct(Mat& out, const Base& expr, typename T1::pod_type tol) { arma_debug_sigprint(); typedef typename T1::elem_type eT; typedef typename T1::pod_type T; arma_conform_check((tol < T(0)), "null(): tolerance must be >= 0"); Mat A(expr.get_ref()); Mat U; Col< T> s; Mat V; const bool status = auxlib::svd_dc(U, s, V, A); U.reset(); if(status == false) { return false; } if(s.is_empty()) { out.reset(); return true; } const uword s_n_elem = s.n_elem; const T* s_mem = s.memptr(); // set tolerance to default if it hasn't been specified if(tol == T(0)) { tol = (std::max)(A.n_rows, A.n_cols) * s_mem[0] * std::numeric_limits::epsilon(); } uword count = 0; for(uword i=0; i < s_n_elem; ++i) { count += (s_mem[i] > tol) ? uword(1) : uword(0); } if(count < A.n_cols) { out = V.tail_cols(A.n_cols - count); const uword out_n_elem = out.n_elem; eT* out_mem = out.memptr(); for(uword i=0; i::epsilon()) { out_mem[i] = eT(0); } } } else { out.set_size(A.n_cols, 0); } return true; } //! @} RcppArmadillo/inst/include/armadillo_bits/arrayops_bones.hpp0000644000176200001440000001400414301267043024126 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup arrayops //! @{ class arrayops { public: template arma_inline static void copy(eT* dest, const eT* src, const uword n_elem); template inline static void fill_zeros(eT* dest, const uword n_elem); template arma_hot inline static void replace(eT* mem, const uword n_elem, const eT old_val, const eT new_val); template arma_hot inline static void clean(eT* mem, const uword n_elem, const eT abs_limit, const typename arma_not_cx::result* junk = nullptr); template arma_hot inline static void clean(std::complex* mem, const uword n_elem, const T abs_limit); template inline static void clamp(eT* mem, const uword n_elem, const eT min_val, const eT max_val, const typename arma_not_cx::result* junk = nullptr); template inline static void clamp(std::complex* mem, const uword n_elem, const std::complex& min_val, const std::complex& max_val); // // array = convert(array) template arma_inline static void convert_cx_scalar(out_eT& out, const in_eT& in, const typename arma_not_cx::result* junk1 = nullptr, const typename arma_not_cx< in_eT>::result* junk2 = nullptr); template arma_inline static void convert_cx_scalar(out_eT& out, const std::complex& in, const typename arma_not_cx::result* junk = nullptr); template arma_inline static void convert_cx_scalar(std::complex& out, const std::complex< in_T>& in); template arma_hot inline static void convert(out_eT* dest, const in_eT* src, const uword n_elem); template arma_hot inline static void convert_cx(out_eT* dest, const in_eT* src, const uword n_elem); // // array op= array template arma_hot inline static void inplace_plus(eT* dest, const eT* src, const uword n_elem); template arma_hot inline static void inplace_minus(eT* dest, const eT* src, const uword n_elem); template arma_hot inline static void inplace_mul(eT* dest, const eT* src, const uword n_elem); template arma_hot inline static void inplace_div(eT* dest, const eT* src, const uword n_elem); template arma_hot inline static void inplace_plus_base(eT* dest, const eT* src, const uword n_elem); template arma_hot inline static void inplace_minus_base(eT* dest, const eT* src, const uword n_elem); template arma_hot inline static void inplace_mul_base(eT* dest, const eT* src, const uword n_elem); template arma_hot inline static void inplace_div_base(eT* dest, const eT* src, const uword n_elem); // // array op= scalar template arma_hot inline static void inplace_set(eT* dest, const eT val, const uword n_elem); template arma_hot inline static void inplace_set_simple(eT* dest, const eT val, const uword n_elem); template arma_hot inline static void inplace_set_base(eT* dest, const eT val, const uword n_elem); template arma_hot inline static void inplace_set_fixed(eT* dest, const eT val); template arma_hot inline static void inplace_plus(eT* dest, const eT val, const uword n_elem); template arma_hot inline static void inplace_minus(eT* dest, const eT val, const uword n_elem); template arma_hot inline static void inplace_mul(eT* dest, const eT val, const uword n_elem); template arma_hot inline static void inplace_div(eT* dest, const eT val, const uword n_elem); template arma_hot inline static void inplace_plus_base(eT* dest, const eT val, const uword n_elem); template arma_hot inline static void inplace_minus_base(eT* dest, const eT val, const uword n_elem); template arma_hot inline static void inplace_mul_base(eT* dest, const eT val, const uword n_elem); template arma_hot inline static void inplace_div_base(eT* dest, const eT val, const uword n_elem); // // scalar = op(array) template arma_hot inline static eT accumulate(const eT* src, const uword n_elem); template arma_hot inline static eT product(const eT* src, const uword n_elem); template arma_hot inline static bool is_zero(const eT* mem, const uword n_elem, const eT abs_limit, const typename arma_not_cx::result* junk = nullptr); template arma_hot inline static bool is_zero(const std::complex* mem, const uword n_elem, const T abs_limit); template arma_hot inline static bool is_finite(const eT* src, const uword n_elem); template arma_hot inline static bool has_inf(const eT* src, const uword n_elem); template arma_hot inline static bool has_nan(const eT* src, const uword n_elem); }; //! @} RcppArmadillo/inst/include/armadillo_bits/operator_relational.hpp0000644000176200001440000003200514635324415025155 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup operator_relational //! @{ // < : lt // > : gt // <= : lteq // >= : gteq // == : eq // != : noteq // && : and // || : or template inline typename enable_if2 < (is_arma_type::value && is_arma_type::value && (is_cx::no) && (is_cx::no)), const mtGlue >::result operator< (const T1& X, const T2& Y) { arma_debug_sigprint(); return mtGlue( X, Y ); } template inline typename enable_if2 < (is_arma_type::value && is_arma_type::value && (is_cx::no) && (is_cx::no)), const mtGlue >::result operator> (const T1& X, const T2& Y) { arma_debug_sigprint(); return mtGlue( X, Y ); } template inline typename enable_if2 < (is_arma_type::value && is_arma_type::value && (is_cx::no) && (is_cx::no)), const mtGlue >::result operator<= (const T1& X, const T2& Y) { arma_debug_sigprint(); return mtGlue( X, Y ); } template inline typename enable_if2 < (is_arma_type::value && is_arma_type::value && (is_cx::no) && (is_cx::no)), const mtGlue >::result operator>= (const T1& X, const T2& Y) { arma_debug_sigprint(); return mtGlue( X, Y ); } template inline typename enable_if2 < (is_arma_type::value && is_arma_type::value), const mtGlue >::result operator== (const T1& X, const T2& Y) { arma_debug_sigprint(); return mtGlue( X, Y ); } template inline typename enable_if2 < (is_arma_type::value && is_arma_type::value), const mtGlue >::result operator!= (const T1& X, const T2& Y) { arma_debug_sigprint(); return mtGlue( X, Y ); } template inline typename enable_if2 < (is_arma_type::value && is_arma_type::value && (is_cx::no) && (is_cx::no)), const mtGlue >::result operator&& (const T1& X, const T2& Y) { arma_debug_sigprint(); return mtGlue( X, Y ); } template inline typename enable_if2 < (is_arma_type::value && is_arma_type::value && (is_cx::no) && (is_cx::no)), const mtGlue >::result operator|| (const T1& X, const T2& Y) { arma_debug_sigprint(); return mtGlue( X, Y ); } // // // template inline typename enable_if2 < (is_arma_type::value && (is_cx::no)), const mtOp >::result operator< (const typename T1::elem_type val, const T1& X) { arma_debug_sigprint(); return mtOp(X, val); } template inline typename enable_if2 < (is_arma_type::value && (is_cx::no)), const mtOp >::result operator< (const T1& X, const typename T1::elem_type val) { arma_debug_sigprint(); return mtOp(X, val); } template inline typename enable_if2 < (is_arma_type::value && (is_cx::no)), const mtOp >::result operator> (const typename T1::elem_type val, const T1& X) { arma_debug_sigprint(); return mtOp(X, val); } template inline typename enable_if2 < (is_arma_type::value && (is_cx::no)), const mtOp >::result operator> (const T1& X, const typename T1::elem_type val) { arma_debug_sigprint(); return mtOp(X, val); } template inline typename enable_if2 < (is_arma_type::value && (is_cx::no)), const mtOp >::result operator<= (const typename T1::elem_type val, const T1& X) { arma_debug_sigprint(); return mtOp(X, val); } template inline typename enable_if2 < (is_arma_type::value && (is_cx::no)), const mtOp >::result operator<= (const T1& X, const typename T1::elem_type val) { arma_debug_sigprint(); return mtOp(X, val); } template inline typename enable_if2 < (is_arma_type::value && (is_cx::no)), const mtOp >::result operator>= (const typename T1::elem_type val, const T1& X) { arma_debug_sigprint(); return mtOp(X, val); } template inline typename enable_if2 < (is_arma_type::value && (is_cx::no)), const mtOp >::result operator>= (const T1& X, const typename T1::elem_type val) { arma_debug_sigprint(); return mtOp(X, val); } template inline typename enable_if2 < is_arma_type::value, const mtOp >::result operator== (const typename T1::elem_type val, const T1& X) { arma_debug_sigprint(); return mtOp(X, val); } template inline typename enable_if2 < is_arma_type::value, const mtOp >::result operator== (const T1& X, const typename T1::elem_type val) { arma_debug_sigprint(); return mtOp(X, val); } template inline typename enable_if2 < is_arma_type::value, const mtOp >::result operator!= (const typename T1::elem_type val, const T1& X) { arma_debug_sigprint(); return mtOp(X, val); } template inline typename enable_if2 < is_arma_type::value, const mtOp >::result operator!= (const T1& X, const typename T1::elem_type val) { arma_debug_sigprint(); return mtOp(X, val); } // template inline typename enable_if2 < (is_arma_sparse_type::value && is_arma_sparse_type::value && (is_cx::no) && (is_cx::no)), const mtSpGlue >::result operator< (const T1& X, const T2& Y) { arma_debug_sigprint(); // TODO: ensure T1::elem_type and T2::elem_type are the same return mtSpGlue( X, Y ); } template inline typename enable_if2 < (is_arma_sparse_type::value && is_arma_sparse_type::value && (is_cx::no) && (is_cx::no)), const mtSpGlue >::result operator> (const T1& X, const T2& Y) { arma_debug_sigprint(); // TODO: ensure T1::elem_type and T2::elem_type are the same return mtSpGlue( X, Y ); } template inline typename enable_if2 < (is_arma_sparse_type::value && is_arma_sparse_type::value && (is_cx::no) && (is_cx::no)), const mtSpGlue >::result operator&& (const T1& X, const T2& Y) { arma_debug_sigprint(); // TODO: ensure T1::elem_type and T2::elem_type are the same return mtSpGlue( X, Y ); } template inline typename enable_if2 < (is_arma_sparse_type::value && is_arma_sparse_type::value && (is_cx::no) && (is_cx::no)), const mtSpGlue >::result operator|| (const T1& X, const T2& Y) { arma_debug_sigprint(); // TODO: ensure T1::elem_type and T2::elem_type are the same return mtSpGlue( X, Y ); } // // // template inline typename enable_if2 < (is_arma_sparse_type::value && (is_cx::no)), const mtSpOp >::result operator< (const typename T1::elem_type val, const T1& X) { arma_debug_sigprint(); return mtSpOp(X, val); } template inline typename enable_if2 < (is_arma_sparse_type::value && (is_cx::no)), const mtSpOp >::result operator< (const T1& X, const typename T1::elem_type val) { arma_debug_sigprint(); return mtSpOp(X, val); } template inline typename enable_if2 < (is_arma_sparse_type::value && (is_cx::no)), const mtSpOp >::result operator> (const typename T1::elem_type val, const T1& X) { arma_debug_sigprint(); return mtSpOp(X, val); } template inline typename enable_if2 < (is_arma_sparse_type::value && (is_cx::no)), const mtSpOp >::result operator> (const T1& X, const typename T1::elem_type val) { arma_debug_sigprint(); return mtSpOp(X, val); } template inline typename enable_if2 < (is_arma_sparse_type::value && (is_cx::no)), const mtSpOp >::result operator<= (const typename T1::elem_type val, const T1& X) { arma_debug_sigprint(); return mtSpOp(X, val); } template inline typename enable_if2 < (is_arma_sparse_type::value && (is_cx::no)), const mtSpOp >::result operator<= (const T1& X, const typename T1::elem_type val) { arma_debug_sigprint(); return mtSpOp(X, val); } template inline typename enable_if2 < (is_arma_sparse_type::value && (is_cx::no)), const mtSpOp >::result operator>= (const typename T1::elem_type val, const T1& X) { arma_debug_sigprint(); return mtSpOp(X, val); } template inline typename enable_if2 < (is_arma_sparse_type::value && (is_cx::no)), const mtSpOp >::result operator>= (const T1& X, const typename T1::elem_type val) { arma_debug_sigprint(); return mtSpOp(X, val); } template inline typename enable_if2 < is_arma_sparse_type::value, const mtSpOp >::result operator== (const typename T1::elem_type val, const T1& X) { arma_debug_sigprint(); return mtSpOp(X, val); } template inline typename enable_if2 < is_arma_sparse_type::value, const mtSpOp >::result operator== (const T1& X, const typename T1::elem_type val) { arma_debug_sigprint(); return mtSpOp(X, val); } template inline typename enable_if2 < is_arma_sparse_type::value, const mtSpOp >::result operator!= (const typename T1::elem_type val, const T1& X) { arma_debug_sigprint(); return mtSpOp(X, val); } template inline typename enable_if2 < is_arma_sparse_type::value, const mtSpOp >::result operator!= (const T1& X, const typename T1::elem_type val) { arma_debug_sigprint(); return mtSpOp(X, val); } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_hist.hpp0000644000176200001440000000374314631567470022557 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_hist //! @{ template arma_warn_unused arma_inline typename enable_if2 < is_arma_type::value && is_cx::no, const mtOp >::result hist(const T1& A, const uword n_bins = 10) { arma_debug_sigprint(); return mtOp(A, n_bins, 0); } template arma_warn_unused arma_inline typename enable_if2 < is_arma_type::value && is_arma_type::value && is_cx::no && is_same_type::value, const mtGlue >::result hist(const T1& X, const T2& Y) { arma_debug_sigprint(); return mtGlue(X, Y); } template arma_warn_unused arma_inline typename enable_if2 < is_arma_type::value && is_arma_type::value && is_cx::no && is_same_type::value, const mtGlue >::result hist(const T1& X, const T2& Y, const uword dim) { arma_debug_sigprint(); return mtGlue(X, Y, dim); } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_mean.hpp0000644000176200001440000000551214634016465022520 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_mean //! @{ template arma_warn_unused inline typename enable_if2< is_arma_type::value && resolves_to_vector::yes, typename T1::elem_type >::result mean(const T1& X) { arma_debug_sigprint(); return op_mean::mean_all(X); } template arma_warn_unused arma_inline typename enable_if2< is_arma_type::value && resolves_to_vector::no, const Op >::result mean(const T1& X) { arma_debug_sigprint(); return Op(X, 0, 0); } template arma_warn_unused arma_inline typename enable_if2< is_arma_type::value, const Op >::result mean(const T1& X, const uword dim) { arma_debug_sigprint(); return Op(X, dim, 0); } template arma_warn_unused arma_inline typename arma_scalar_only::result mean(const T& x) { return x; } template arma_warn_unused arma_inline const OpCube mean ( const BaseCube& X, const uword dim = 0 ) { arma_debug_sigprint(); return OpCube(X.get_ref(), dim, 0); } template arma_warn_unused inline typename enable_if2 < is_arma_sparse_type::value && resolves_to_sparse_vector::yes, typename T1::elem_type >::result mean(const T1& x) { arma_debug_sigprint(); return op_sp_mean::mean_all(x); } template arma_warn_unused inline typename enable_if2 < is_arma_sparse_type::value && resolves_to_sparse_vector::no, const mtSpReduceOp >::result mean(const T1& x) { arma_debug_sigprint(); return mtSpReduceOp(x, 0, 0); } template arma_warn_unused inline typename enable_if2 < is_arma_sparse_type::value, const mtSpReduceOp >::result mean(const T1& x, const uword dim) { arma_debug_sigprint(); return mtSpReduceOp(x, dim, 0); } //! @} RcppArmadillo/inst/include/armadillo_bits/op_cov_bones.hpp0000644000176200001440000000220514301267043023553 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_cov //! @{ class op_cov : public traits_op_default { public: template inline static void apply(Mat& out, const Op< T1, op_cov>& in); template inline static void apply(Mat& out, const Op< Op, op_cov>& in); }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_any_meat.hpp0000644000176200001440000002542414752446051023413 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_any //! @{ template inline bool op_any::any_vec_helper(const Base& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const Proxy P(X.get_ref()); const uword n_elem = P.get_n_elem(); if(Proxy::use_at == false) { typename Proxy::ea_type Pea = P.get_ea(); for(uword i=0; i inline bool op_any::any_vec_helper(const subview& X) { arma_debug_sigprint(); const uword X_n_rows = X.n_rows; const uword X_n_cols = X.n_cols; if(X_n_rows == 1) { for(uword col=0; col < X_n_cols; ++col) { if(X.at(0,col) != eT(0)) { return true; } } } else { for(uword col=0; col < X_n_cols; ++col) { const eT* X_colmem = X.colptr(col); for(uword row=0; row < X_n_rows; ++row) { if(X_colmem[row] != eT(0)) { return true; } } } } return false; } template inline bool op_any::any_vec_helper(const Op& X) { arma_debug_sigprint(); return op_any::any_vec_helper(X.m); } template inline bool op_any::any_vec_helper ( const mtOp& X, const typename arma_op_rel_only::result* junk1, const typename arma_not_cx::result* junk2 ) { arma_debug_sigprint(); arma_ignore(junk1); arma_ignore(junk2); typedef typename T1::elem_type eT; const eT val = X.aux; const Proxy P(X.m); if(Proxy::use_at == false) { typename Proxy::ea_type Pea = P.get_ea(); const uword n_elem = P.get_n_elem(); for(uword i=0; i < n_elem; ++i) { const eT tmp = Pea[i]; if(is_same_type::yes) { if(val < tmp) { return true; } } else if(is_same_type::yes) { if(tmp < val) { return true; } } else if(is_same_type::yes) { if(val > tmp) { return true; } } else if(is_same_type::yes) { if(tmp > val) { return true; } } else if(is_same_type::yes) { if(val <= tmp) { return true; } } else if(is_same_type::yes) { if(tmp <= val) { return true; } } else if(is_same_type::yes) { if(val >= tmp) { return true; } } else if(is_same_type::yes) { if(tmp >= val) { return true; } } else if(is_same_type::yes) { if(tmp == val) { return true; } } else if(is_same_type::yes) { if(tmp != val) { return true; } } } } else { const uword n_rows = P.get_n_rows(); const uword n_cols = P.get_n_cols(); for(uword col=0; col < n_cols; ++col) for(uword row=0; row < n_rows; ++row) { const eT tmp = P.at(row,col); if(is_same_type::yes) { if(val < tmp) { return true; } } else if(is_same_type::yes) { if(tmp < val) { return true; } } else if(is_same_type::yes) { if(val > tmp) { return true; } } else if(is_same_type::yes) { if(tmp > val) { return true; } } else if(is_same_type::yes) { if(val <= tmp) { return true; } } else if(is_same_type::yes) { if(tmp <= val) { return true; } } else if(is_same_type::yes) { if(val >= tmp) { return true; } } else if(is_same_type::yes) { if(tmp >= val) { return true; } } else if(is_same_type::yes) { if(tmp == val) { return true; } } else if(is_same_type::yes) { if(tmp != val) { return true; } } } } return false; } template inline bool op_any::any_vec_helper ( const mtGlue& X, const typename arma_glue_rel_only::result* junk1, const typename arma_not_cx::result* junk2, const typename arma_not_cx::result* junk3 ) { arma_debug_sigprint(); arma_ignore(junk1); arma_ignore(junk2); arma_ignore(junk3); typedef typename T1::elem_type eT1; typedef typename T2::elem_type eT2; typedef typename Proxy::ea_type ea_type1; typedef typename Proxy::ea_type ea_type2; const Proxy A(X.A); const Proxy B(X.B); arma_conform_assert_same_size(A, B, "relational operator"); constexpr bool use_at = (Proxy::use_at || Proxy::use_at); if(use_at == false) { ea_type1 PA = A.get_ea(); ea_type2 PB = B.get_ea(); const uword n_elem = A.get_n_elem(); for(uword i=0; i::yes) { if(tmp1 < tmp2) { return true; } } else if(is_same_type::yes) { if(tmp1 > tmp2) { return true; } } else if(is_same_type::yes) { if(tmp1 <= tmp2) { return true; } } else if(is_same_type::yes) { if(tmp1 >= tmp2) { return true; } } else if(is_same_type::yes) { if(tmp1 == tmp2) { return true; } } else if(is_same_type::yes) { if(tmp1 != tmp2) { return true; } } else if(is_same_type::yes) { if(tmp1 && tmp2) { return true; } } else if(is_same_type::yes) { if(tmp1 || tmp2) { return true; } } } } else { const uword n_rows = A.get_n_rows(); const uword n_cols = A.get_n_cols(); for(uword col=0; col < n_cols; ++col) for(uword row=0; row < n_rows; ++row) { const eT1 tmp1 = A.at(row,col); const eT2 tmp2 = B.at(row,col); if(is_same_type::yes) { if(tmp1 < tmp2) { return true; } } else if(is_same_type::yes) { if(tmp1 > tmp2) { return true; } } else if(is_same_type::yes) { if(tmp1 <= tmp2) { return true; } } else if(is_same_type::yes) { if(tmp1 >= tmp2) { return true; } } else if(is_same_type::yes) { if(tmp1 == tmp2) { return true; } } else if(is_same_type::yes) { if(tmp1 != tmp2) { return true; } } else if(is_same_type::yes) { if(tmp1 && tmp2) { return true; } } else if(is_same_type::yes) { if(tmp1 || tmp2) { return true; } } } } return false; } template inline bool op_any::any_vec(T1& X) { arma_debug_sigprint(); return op_any::any_vec_helper(X); } template inline void op_any::apply_mat_noalias(Mat& out, const Mat& X, const uword dim) { arma_debug_sigprint(); const uword n_rows = X.n_rows; const uword n_cols = X.n_cols; if(dim == 0) // traverse rows (ie. process each column) { out.zeros(1, n_cols); uword* out_mem = out.memptr(); for(uword col=0; col < n_cols; ++col) { const eT* colmem = X.colptr(col); for(uword row=0; row < n_rows; ++row) { if(colmem[row] != eT(0)) { out_mem[col] = uword(1); break; } } } } else { out.zeros(n_rows, 1); uword* out_mem = out.memptr(); for(uword col=0; col < n_cols; ++col) { const eT* colmem = X.colptr(col); for(uword row=0; row < n_rows; ++row) { if(colmem[row] != eT(0)) { out_mem[row] = uword(1); } } } } } template inline void op_any::apply_proxy_noalias(Mat& out, const Proxy& P, const uword dim) { arma_debug_sigprint(); typedef typename Proxy::elem_type eT; const uword n_rows = P.get_n_rows(); const uword n_cols = P.get_n_cols(); if(dim == 0) // traverse rows (ie. process each column) { out.zeros(1, n_cols); uword* out_mem = out.memptr(); for(uword col=0; col < n_cols; ++col) { for(uword row=0; row < n_rows; ++row) { if(P.at(row,col) != eT(0)) { out_mem[col] = uword(1); break; } } } } else { out.zeros(n_rows, 1); uword* out_mem = out.memptr(); for(uword col=0; col < n_cols; ++col) { for(uword row=0; row < n_rows; ++row) { if(P.at(row,col) != eT(0)) { out_mem[row] = uword(1); } } } } } template inline void op_any::apply(Mat& out, const mtOp& X) { arma_debug_sigprint(); const uword dim = X.aux_uword_a; if( (is_Mat::value) || (is_Mat::stored_type>::value) || (arma_config::openmp && Proxy::use_mp) ) { const quasi_unwrap U(X.m); if(U.is_alias(out) == false) { op_any::apply_mat_noalias(out, U.M, dim); } else { Mat tmp; op_any::apply_mat_noalias(tmp, U.M, dim); out.steal_mem(tmp); } } else { const Proxy P(X.m); if(P.is_alias(out) == false) { op_any::apply_proxy_noalias(out, P, dim); } else { Mat tmp; op_any::apply_proxy_noalias(tmp, P, dim); out.steal_mem(tmp); } } } //! @} RcppArmadillo/inst/include/armadillo_bits/op_cumsum_bones.hpp0000644000176200001440000000246314301267043024303 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_cumsum //! @{ class op_cumsum : public traits_op_default { public: template inline static void apply_noalias(Mat& out, const Mat& X, const uword dim); template inline static void apply(Mat& out, const Op& in); }; class op_cumsum_vec : public traits_op_passthru { public: template inline static void apply(Mat& out, const Op& in); }; //! @} RcppArmadillo/inst/include/armadillo_bits/mul_herk.hpp0000644000176200001440000003260114654406643022725 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup herk //! @{ class herk_helper { public: template inline static void inplace_conj_copy_upper_tri_to_lower_tri(Mat& C) { // under the assumption that C is a square matrix const uword N = C.n_rows; for(uword k=0; k < N; ++k) { eT* colmem = C.colptr(k); for(uword i=(k+1); i < N; ++i) { colmem[i] = std::conj( C.at(k,i) ); } } } template arma_hot inline static eT dot_conj_row(const uword n_elem, const eT* const A, const Mat& B, const uword row) { arma_debug_sigprint(); typedef typename get_pod_type::result T; T val_real = T(0); T val_imag = T(0); for(uword i=0; i& X = A[i]; const std::complex& Y = B.at(row,i); const T a = X.real(); const T b = X.imag(); const T c = Y.real(); const T d = Y.imag(); val_real += (a*c) + (b*d); val_imag += (b*c) - (a*d); } return std::complex(val_real, val_imag); } }; template class herk_vec { public: template arma_hot inline static void apply ( Mat< std::complex >& C, const TA& A, const T alpha = T(1), const T beta = T(0) ) { arma_debug_sigprint(); typedef std::complex eT; const uword A_n_rows = A.n_rows; const uword A_n_cols = A.n_cols; // for beta != 0, C is assumed to be hermitian // do_trans_A == false -> C = alpha * A * A^H + beta*C // do_trans_A == true -> C = alpha * A^H * A + beta*C const eT* A_mem = A.memptr(); if(do_trans_A == false) { if(A_n_rows == 1) { const eT acc = op_cdot::direct_cdot(A_n_cols, A_mem, A_mem); if( (use_alpha == false) && (use_beta == false) ) { C[0] = acc; } else if( (use_alpha == true ) && (use_beta == false) ) { C[0] = alpha*acc; } else if( (use_alpha == false) && (use_beta == true ) ) { C[0] = acc + beta*C[0]; } else if( (use_alpha == true ) && (use_beta == true ) ) { C[0] = alpha*acc + beta*C[0]; } } else for(uword row_A=0; row_A < A_n_rows; ++row_A) { const eT& A_rowdata = A_mem[row_A]; for(uword k=row_A; k < A_n_rows; ++k) { const eT acc = A_rowdata * std::conj( A_mem[k] ); if( (use_alpha == false) && (use_beta == false) ) { C.at(row_A, k) = acc; if(row_A != k) { C.at(k, row_A) = std::conj(acc); } } else if( (use_alpha == true) && (use_beta == false) ) { const eT val = alpha*acc; C.at(row_A, k) = val; if(row_A != k) { C.at(k, row_A) = std::conj(val); } } else if( (use_alpha == false) && (use_beta == true) ) { C.at(row_A, k) = acc + beta*C.at(row_A, k); if(row_A != k) { C.at(k, row_A) = std::conj(acc) + beta*C.at(k, row_A); } } else if( (use_alpha == true) && (use_beta == true) ) { const eT val = alpha*acc; C.at(row_A, k) = val + beta*C.at(row_A, k); if(row_A != k) { C.at(k, row_A) = std::conj(val) + beta*C.at(k, row_A); } } } } } else if(do_trans_A == true) { if(A_n_cols == 1) { const eT acc = op_cdot::direct_cdot(A_n_rows, A_mem, A_mem); if( (use_alpha == false) && (use_beta == false) ) { C[0] = acc; } else if( (use_alpha == true ) && (use_beta == false) ) { C[0] = alpha*acc; } else if( (use_alpha == false) && (use_beta == true ) ) { C[0] = acc + beta*C[0]; } else if( (use_alpha == true ) && (use_beta == true ) ) { C[0] = alpha*acc + beta*C[0]; } } else for(uword col_A=0; col_A < A_n_cols; ++col_A) { // col_A is interpreted as row_A when storing the results in matrix C const eT A_coldata = std::conj( A_mem[col_A] ); for(uword k=col_A; k < A_n_cols ; ++k) { const eT acc = A_coldata * A_mem[k]; if( (use_alpha == false) && (use_beta == false) ) { C.at(col_A, k) = acc; if(col_A != k) { C.at(k, col_A) = std::conj(acc); } } else if( (use_alpha == true ) && (use_beta == false) ) { const eT val = alpha*acc; C.at(col_A, k) = val; if(col_A != k) { C.at(k, col_A) = std::conj(val); } } else if( (use_alpha == false) && (use_beta == true ) ) { C.at(col_A, k) = acc + beta*C.at(col_A, k); if(col_A != k) { C.at(k, col_A) = std::conj(acc) + beta*C.at(k, col_A); } } else if( (use_alpha == true ) && (use_beta == true ) ) { const eT val = alpha*acc; C.at(col_A, k) = val + beta*C.at(col_A, k); if(col_A != k) { C.at(k, col_A) = std::conj(val) + beta*C.at(k, col_A); } } } } } } }; template class herk_emul { public: template arma_hot inline static void apply ( Mat< std::complex >& C, const TA& A, const T alpha = T(1), const T beta = T(0) ) { arma_debug_sigprint(); typedef std::complex eT; // do_trans_A == false -> C = alpha * A * A^H + beta*C // do_trans_A == true -> C = alpha * A^H * A + beta*C if(do_trans_A == false) { Mat AA; op_htrans::apply_mat_noalias(AA, A); herk_emul::apply(C, AA, alpha, beta); } else if(do_trans_A == true) { const uword A_n_rows = A.n_rows; const uword A_n_cols = A.n_cols; for(uword col_A=0; col_A < A_n_cols; ++col_A) { // col_A is interpreted as row_A when storing the results in matrix C const eT* A_coldata = A.colptr(col_A); for(uword k=col_A; k < A_n_cols ; ++k) { const eT acc = op_cdot::direct_cdot(A_n_rows, A_coldata, A.colptr(k)); if( (use_alpha == false) && (use_beta == false) ) { C.at(col_A, k) = acc; if(col_A != k) { C.at(k, col_A) = std::conj(acc); } } else if( (use_alpha == true) && (use_beta == false) ) { const eT val = alpha*acc; C.at(col_A, k) = val; if(col_A != k) { C.at(k, col_A) = std::conj(val); } } else if( (use_alpha == false) && (use_beta == true) ) { C.at(col_A, k) = acc + beta*C.at(col_A, k); if(col_A != k) { C.at(k, col_A) = std::conj(acc) + beta*C.at(k, col_A); } } else if( (use_alpha == true) && (use_beta == true) ) { const eT val = alpha*acc; C.at(col_A, k) = val + beta*C.at(col_A, k); if(col_A != k) { C.at(k, col_A) = std::conj(val) + beta*C.at(k, col_A); } } } } } } }; template class herk { public: template inline static void apply_blas_type( Mat>& C, const TA& A, const T alpha = T(1), const T beta = T(0) ) { arma_debug_sigprint(); const uword threshold = 16; if(A.is_vec()) { // work around poor handling of vectors by herk() in standard BLAS herk_vec::apply(C,A,alpha,beta); return; } if( (A.n_elem <= threshold) ) { herk_emul::apply(C,A,alpha,beta); } else { #if defined(ARMA_USE_ATLAS) { if(use_beta == true) { typedef typename std::complex eT; // use a temporary matrix, as we can't assume that matrix C is already symmetric Mat D(C.n_rows, C.n_cols, arma_nozeros_indicator()); herk::apply_blas_type(D,A,alpha); // NOTE: assuming beta=1; this is okay for now, as currently glue_times only uses beta=1 arrayops::inplace_plus(C.memptr(), D.memptr(), C.n_elem); return; } atlas::cblas_herk ( atlas_CblasColMajor, atlas_CblasUpper, (do_trans_A) ? atlas_CblasConjTrans : atlas_CblasNoTrans, C.n_cols, (do_trans_A) ? A.n_rows : A.n_cols, (use_alpha) ? alpha : T(1), A.mem, (do_trans_A) ? A.n_rows : C.n_cols, (use_beta) ? beta : T(0), C.memptr(), C.n_cols ); herk_helper::inplace_conj_copy_upper_tri_to_lower_tri(C); } #elif defined(ARMA_USE_BLAS) { if(use_beta == true) { typedef typename std::complex eT; // use a temporary matrix, as we can't assume that matrix C is already symmetric Mat D(C.n_rows, C.n_cols, arma_nozeros_indicator()); herk::apply_blas_type(D,A,alpha); // NOTE: assuming beta=1; this is okay for now, as currently glue_times only uses beta=1 arrayops::inplace_plus(C.memptr(), D.memptr(), C.n_elem); return; } arma_debug_print("blas::herk()"); const char uplo = 'U'; const char trans_A = (do_trans_A) ? 'C' : 'N'; const blas_int n = blas_int(C.n_cols); const blas_int k = (do_trans_A) ? blas_int(A.n_rows) : blas_int(A.n_cols); const T local_alpha = (use_alpha) ? alpha : T(1); const T local_beta = (use_beta) ? beta : T(0); const blas_int lda = (do_trans_A) ? k : n; arma_debug_print( arma_str::format("blas::herk(): trans_A: %c") % trans_A ); blas::herk ( &uplo, &trans_A, &n, &k, &local_alpha, A.mem, &lda, &local_beta, C.memptr(), &n // &ldc ); herk_helper::inplace_conj_copy_upper_tri_to_lower_tri(C); } #else { herk_emul::apply(C,A,alpha,beta); } #endif } } template inline static void apply( Mat& C, const TA& A, const eT alpha = eT(1), const eT beta = eT(0), const typename arma_not_cx::result* junk = nullptr ) { arma_ignore(C); arma_ignore(A); arma_ignore(alpha); arma_ignore(beta); arma_ignore(junk); // herk() cannot be used by non-complex matrices return; } template arma_inline static void apply ( Mat< std::complex >& C, const TA& A, const float alpha = float(1), const float beta = float(0) ) { herk::apply_blas_type(C,A,alpha,beta); } template arma_inline static void apply ( Mat< std::complex >& C, const TA& A, const double alpha = double(1), const double beta = double(0) ) { herk::apply_blas_type(C,A,alpha,beta); } }; //! @} RcppArmadillo/inst/include/armadillo_bits/unwrap_cube.hpp0000644000176200001440000000513614631567470023435 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup unwrap_cube //! @{ template struct unwrap_cube { typedef typename T1::elem_type eT; inline unwrap_cube(const T1& A) : M(A) { arma_debug_sigprint(); } const Cube M; template constexpr bool is_alias(const Cube&) const { return false; } }; template struct unwrap_cube< Cube > { inline unwrap_cube(const Cube& A) : M(A) { arma_debug_sigprint(); } const Cube& M; template arma_inline bool is_alias(const Cube& X) const { return (void_ptr(&M) == void_ptr(&X)); } }; // // // template struct unwrap_cube_check { typedef typename T1::elem_type eT; inline unwrap_cube_check(const T1& A, const Cube&) : M(A) { arma_debug_sigprint(); arma_type_check(( is_arma_cube_type::value == false )); } inline unwrap_cube_check(const T1& A, const bool) : M(A) { arma_debug_sigprint(); arma_type_check(( is_arma_cube_type::value == false )); } const Cube M; }; template struct unwrap_cube_check< Cube > { inline unwrap_cube_check(const Cube& A, const Cube& B) : M_local( (&A == &B) ? new Cube(A) : nullptr ) , M ( (&A == &B) ? (*M_local) : A ) { arma_debug_sigprint(); } inline unwrap_cube_check(const Cube& A, const bool is_alias) : M_local( is_alias ? new Cube(A) : nullptr ) , M ( is_alias ? (*M_local) : A ) { arma_debug_sigprint(); } inline ~unwrap_cube_check() { arma_debug_sigprint(); if(M_local) { delete M_local; } } // the order below is important const Cube* M_local; const Cube& M; }; //! @} RcppArmadillo/inst/include/armadillo_bits/fn_clamp.hpp0000644000176200001440000000665314631567470022707 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_clamp //! @{ template arma_warn_unused inline typename enable_if2 < is_arma_type::value && is_cx::no, const mtOp >::result clamp(const T1& X, const typename T1::elem_type min_val, const typename T1::elem_type max_val) { arma_debug_sigprint(); return mtOp(mtOp_dual_aux_indicator(), X, min_val, max_val); } template arma_warn_unused inline typename enable_if2 < is_arma_type::value && is_cx::yes, const mtOp >::result clamp(const T1& X, const typename T1::elem_type min_val, const typename T1::elem_type max_val) { arma_debug_sigprint(); return mtOp(mtOp_dual_aux_indicator(), X, min_val, max_val); } template arma_warn_unused inline const mtOpCube clamp(const BaseCube& X, const typename T1::elem_type min_val, const typename T1::elem_type max_val, typename arma_not_cx::result* junk = nullptr) { arma_debug_sigprint(); arma_ignore(junk); return mtOpCube(mtOpCube_dual_aux_indicator(), X.get_ref(), min_val, max_val); } template arma_warn_unused inline const mtOpCube clamp(const BaseCube& X, const typename T1::elem_type min_val, const typename T1::elem_type max_val, typename arma_cx_only::result* junk = nullptr) { arma_debug_sigprint(); arma_ignore(junk); return mtOpCube(mtOpCube_dual_aux_indicator(), X.get_ref(), min_val, max_val); } template arma_warn_unused inline SpMat clamp(const SpBase& X, const typename T1::elem_type min_val, const typename T1::elem_type max_val) { arma_debug_sigprint(); typedef typename T1::elem_type eT; if(is_cx::no) { arma_conform_check( (access::tmp_real(min_val) > access::tmp_real(max_val)), "clamp(): min_val must be less than max_val" ); } else { arma_conform_check( (access::tmp_real(min_val) > access::tmp_real(max_val)), "clamp(): real(min_val) must be less than real(max_val)" ); arma_conform_check( (access::tmp_imag(min_val) > access::tmp_imag(max_val)), "clamp(): imag(min_val) must be less than imag(max_val)" ); } SpMat out = X.get_ref(); out.clamp(min_val, max_val); return out; } //! @} RcppArmadillo/inst/include/armadillo_bits/op_pinv_bones.hpp0000644000176200001440000000366614301267043023754 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_pinv //! @{ class op_pinv_default : public traits_op_default { public: template inline static void apply(Mat& out, const Op& in); template inline static bool apply_direct(Mat& out, const Base& expr); }; class op_pinv : public traits_op_default { public: template inline static void apply(Mat& out, const Op& in); template inline static bool apply_direct(Mat& out, const Base& expr, typename T1::pod_type tol, const uword method_id); template inline static bool apply_diag(Mat& out, const Mat& A, typename get_pod_type::result tol); template inline static bool apply_sym (Mat& out, const Mat& A, typename get_pod_type::result tol, const uword method_id); template inline static bool apply_gen (Mat& out, Mat& A, typename get_pod_type::result tol, const uword method_id); }; //! @} RcppArmadillo/inst/include/armadillo_bits/glue_toeplitz_meat.hpp0000644000176200001440000000363214631567470025016 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup glue_toeplitz //! @{ template inline void glue_toeplitz::apply(Mat& out, const Glue& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const unwrap_check tmp1(in.A, out); const unwrap_check tmp2(in.B, out); const Mat& A = tmp1.M; const Mat& B = tmp2.M; arma_conform_check ( ( ((A.is_vec() == false) && (A.is_empty() == false)) || ((B.is_vec() == false) && (B.is_empty() == false)) ), "toeplitz(): given object must be a vector" ); const uword A_N = A.n_elem; const uword B_N = B.n_elem; const eT* A_mem = A.memptr(); const eT* B_mem = B.memptr(); out.set_size(A_N, B_N); if( out.is_empty() ) { return; } for(uword col=0; col < B_N; ++col) { eT* col_mem = out.colptr(col); uword i = 0; for(uword row=col; row < A_N; ++row, ++i) { col_mem[row] = A_mem[i]; } } for(uword row=0; row < A_N; ++row) { uword i = 1; for(uword col=(row+1); col < B_N; ++col, ++i) { out.at(row,col) = B_mem[i]; } } } //! @} RcppArmadillo/inst/include/armadillo_bits/gmm_misc_bones.hpp0000644000176200001440000000732314374704744024105 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup gmm_misc //! @{ struct gmm_dist_mode { const uword id; inline constexpr explicit gmm_dist_mode(const uword in_id) : id(in_id) {} }; inline bool operator==(const gmm_dist_mode& a, const gmm_dist_mode& b) { return (a.id == b.id); } inline bool operator!=(const gmm_dist_mode& a, const gmm_dist_mode& b) { return (a.id != b.id); } struct gmm_dist_eucl : public gmm_dist_mode { inline constexpr gmm_dist_eucl() : gmm_dist_mode(1) {} }; struct gmm_dist_maha : public gmm_dist_mode { inline constexpr gmm_dist_maha() : gmm_dist_mode(2) {} }; struct gmm_dist_prob : public gmm_dist_mode { inline constexpr gmm_dist_prob() : gmm_dist_mode(3) {} }; static constexpr gmm_dist_eucl eucl_dist; static constexpr gmm_dist_maha maha_dist; static constexpr gmm_dist_prob prob_dist; struct gmm_seed_mode { const uword id; inline constexpr explicit gmm_seed_mode(const uword in_id) : id(in_id) {} }; inline bool operator==(const gmm_seed_mode& a, const gmm_seed_mode& b) { return (a.id == b.id); } inline bool operator!=(const gmm_seed_mode& a, const gmm_seed_mode& b) { return (a.id != b.id); } struct gmm_seed_keep_existing : public gmm_seed_mode { inline constexpr gmm_seed_keep_existing() : gmm_seed_mode(1) {} }; struct gmm_seed_static_subset : public gmm_seed_mode { inline constexpr gmm_seed_static_subset() : gmm_seed_mode(2) {} }; struct gmm_seed_static_spread : public gmm_seed_mode { inline constexpr gmm_seed_static_spread() : gmm_seed_mode(3) {} }; struct gmm_seed_random_subset : public gmm_seed_mode { inline constexpr gmm_seed_random_subset() : gmm_seed_mode(4) {} }; struct gmm_seed_random_spread : public gmm_seed_mode { inline constexpr gmm_seed_random_spread() : gmm_seed_mode(5) {} }; static constexpr gmm_seed_keep_existing keep_existing; static constexpr gmm_seed_static_subset static_subset; static constexpr gmm_seed_static_spread static_spread; static constexpr gmm_seed_random_subset random_subset; static constexpr gmm_seed_random_spread random_spread; namespace gmm_priv { template class gmm_diag; template class gmm_full; struct gmm_empty_arg {}; // running_mean_scalar template class running_mean_scalar { public: inline running_mean_scalar(); inline running_mean_scalar(const running_mean_scalar& in_rms); inline const running_mean_scalar& operator=(const running_mean_scalar& in_rms); arma_hot inline void operator() (const eT X); inline void reset(); inline uword count() const; inline eT mean() const; private: arma_aligned uword counter; arma_aligned eT r_mean; }; // distance template struct distance {}; template struct distance { arma_inline static eT eval(const uword N, const eT* A, const eT* B, const eT*); }; template struct distance { arma_inline static eT eval(const uword N, const eT* A, const eT* B, const eT* C); }; } //! @} RcppArmadillo/inst/include/armadillo_bits/op_chol_bones.hpp0000644000176200001440000000223614301267043023715 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_chol //! @{ class op_chol : public traits_op_default { public: template inline static void apply(Mat& out, const Op& X); template inline static bool apply_direct(Mat& out, const Base& A_expr, const uword layout); }; //! @} RcppArmadillo/inst/include/armadillo_bits/fn_cond_rcond.hpp0000644000176200001440000000325414631567470023715 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_cond //! @{ template arma_warn_unused inline typename enable_if2::value, typename T1::pod_type>::result cond(const Base& X) { arma_debug_sigprint(); return op_cond::apply(X.get_ref()); } template arma_warn_unused inline typename enable_if2::value, typename T1::pod_type>::result rcond(const Base& X) { arma_debug_sigprint(); return op_rcond::apply(X.get_ref()); } // template // arma_warn_unused // inline // typename enable_if2::value, typename T1::pod_type>::result // rcond(const SpBase& X) // { // arma_debug_sigprint(); // // return sp_auxlib::rcond(X.get_ref()); // } //! @} RcppArmadillo/inst/include/armadillo_bits/arma_ostream_meat.hpp0000644000176200001440000007032115030507611024562 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup arma_ostream //! @{ inline arma_ostream_state::arma_ostream_state(const std::ostream& o) : orig_flags (o.flags()) , orig_precision(o.precision()) , orig_width (o.width()) , orig_fill (o.fill()) { } inline void arma_ostream_state::restore(std::ostream& o) const { o.flags (orig_flags); o.precision(orig_precision); o.width (orig_width); o.fill (orig_fill); } // // template inline std::streamsize arma_ostream::modify_stream(std::ostream& o, const eT* data, const uword n_elem) { o.unsetf(ios::showbase); o.unsetf(ios::uppercase); o.unsetf(ios::showpos); o.fill(' '); std::streamsize cell_width; bool use_layout_B = false; bool use_layout_C = false; bool use_layout_D = false; for(uword i=0; i 4) && (is_same_type::yes || is_same_type::yes) >::geq(val, eT(+10000000000)) ) || ( cond_rel< (sizeof(eT) > 4) && is_same_type::yes >::leq(val, eT(-10000000000)) ) ) { use_layout_D = true; break; } if( ( val >= eT(+100) ) || //( (is_signed::value) && (val <= eT(-100)) ) || //( (is_non_integral::value) && (val > eT(0)) && (val <= eT(+1e-4)) ) || //( (is_non_integral::value) && (is_signed::value) && (val < eT(0)) && (val >= eT(-1e-4)) ) ( cond_rel< is_signed::value >::leq(val, eT(-100)) ) || ( cond_rel< is_non_integral::value >::gt(val, eT(0)) && cond_rel< is_non_integral::value >::leq(val, eT(+1e-4)) ) || ( cond_rel< is_non_integral::value && is_signed::value >::lt(val, eT(0)) && cond_rel< is_non_integral::value && is_signed::value >::geq(val, eT(-1e-4)) ) ) { use_layout_C = true; break; } if( // (val >= eT(+10)) || ( (is_signed::value) && (val <= eT(-10)) ) (val >= eT(+10)) || ( cond_rel< is_signed::value >::leq(val, eT(-10)) ) ) { use_layout_B = true; } } if(use_layout_D) { o.setf(ios::scientific); o.setf(ios::right); o.unsetf(ios::fixed); o.precision(4); cell_width = 21; } else if(use_layout_C) { o.setf(ios::scientific); o.setf(ios::right); o.unsetf(ios::fixed); o.precision(4); cell_width = 13; } else if(use_layout_B) { o.unsetf(ios::scientific); o.setf(ios::right); o.setf(ios::fixed); o.precision(4); cell_width = 10; } else { o.unsetf(ios::scientific); o.setf(ios::right); o.setf(ios::fixed); o.precision(4); cell_width = 9; } return cell_width; } //! "better than nothing" settings for complex numbers template inline std::streamsize arma_ostream::modify_stream(std::ostream& o, const std::complex* data, const uword n_elem) { arma_ignore(data); arma_ignore(n_elem); o.unsetf(ios::showbase); o.unsetf(ios::uppercase); o.fill(' '); o.setf(ios::scientific); o.setf(ios::showpos); o.setf(ios::right); o.unsetf(ios::fixed); std::streamsize cell_width; o.precision(3); cell_width = 2 + 2*(1 + 3 + o.precision() + 5) + 1; return cell_width; } template inline std::streamsize arma_ostream::modify_stream(std::ostream& o, typename SpMat::const_iterator begin, const uword n_elem, const typename arma_not_cx::result* junk) { arma_debug_sigprint(); arma_ignore(junk); o.unsetf(ios::showbase); o.unsetf(ios::uppercase); o.unsetf(ios::showpos); o.fill(' '); std::streamsize cell_width; bool use_layout_B = false; bool use_layout_C = false; for(typename SpMat::const_iterator it = begin; it.pos() < n_elem; ++it) { const eT val = (*it); if(arma_isnonfinite(val)) { continue; } if( val >= eT(+100) || ( (is_signed::value) && (val <= eT(-100)) ) || ( (is_non_integral::value) && (val > eT(0)) && (val <= eT(+1e-4)) ) || ( (is_non_integral::value) && (is_signed::value) && (val < eT(0)) && (val >= eT(-1e-4)) ) ) { use_layout_C = true; break; } if( (val >= eT(+10)) || ( (is_signed::value) && (val <= eT(-10)) ) ) { use_layout_B = true; } } if(use_layout_C) { o.setf(ios::scientific); o.setf(ios::right); o.unsetf(ios::fixed); o.precision(4); cell_width = 13; } else if(use_layout_B) { o.unsetf(ios::scientific); o.setf(ios::right); o.setf(ios::fixed); o.precision(4); cell_width = 10; } else { o.unsetf(ios::scientific); o.setf(ios::right); o.setf(ios::fixed); o.precision(4); cell_width = 9; } return cell_width; } //! "better than nothing" settings for complex numbers template inline std::streamsize arma_ostream::modify_stream(std::ostream& o, typename SpMat::const_iterator begin, const uword n_elem, const typename arma_cx_only::result* junk) { arma_ignore(begin); arma_ignore(n_elem); arma_ignore(junk); o.unsetf(ios::showbase); o.unsetf(ios::uppercase); o.fill(' '); o.setf(ios::scientific); o.setf(ios::showpos); o.setf(ios::right); o.unsetf(ios::fixed); std::streamsize cell_width; o.precision(3); cell_width = 2 + 2*(1 + 3 + o.precision() + 5) + 1; return cell_width; } template inline void arma_ostream::print_elem_zero(std::ostream& o, const bool modify) { typedef typename promote_type::result promoted_eT; if(modify) { const ios::fmtflags save_flags = o.flags(); const std::streamsize save_precision = o.precision(); o.unsetf(ios::scientific); o.setf(ios::fixed); o.precision(0); o << promoted_eT(0); o.flags(save_flags); o.precision(save_precision); } else { o << promoted_eT(0); } } template inline void arma_ostream::print_elem(std::ostream& o, const eT& x, const bool modify) { if(x == eT(0)) { arma_ostream::print_elem_zero(o, modify); } else { arma_ostream::raw_print_elem(o, x); } } template inline void arma_ostream::raw_print_elem(std::ostream& o, const eT& x) { if(is_signed::value) { typedef typename promote_type::result promoted_eT; if(arma_isfinite(x)) { o << promoted_eT(x); } else { o << ( arma_isinf(x) ? ((x <= eT(0)) ? "-inf" : "inf") : "nan" ); } } else { typedef typename promote_type::result promoted_eT; o << promoted_eT(x); } } template inline void arma_ostream::print_elem(std::ostream& o, const std::complex& x, const bool modify) { if( (x.real() == T(0)) && (x.imag() == T(0)) && (modify) ) { o << "(0,0)"; } else { arma_ostream::raw_print_elem(o, x); } } template inline void arma_ostream::raw_print_elem(std::ostream& o, const std::complex& x) { std::ostringstream ss; ss.flags(o.flags()); //ss.imbue(o.getloc()); ss.precision(o.precision()); ss << '('; const T a = x.real(); if(arma_isfinite(a)) { ss << a; } else { ss << ( arma_isinf(a) ? ((a <= T(0)) ? "-inf" : "+inf") : "nan" ); } ss << ','; const T b = x.imag(); if(arma_isfinite(b)) { ss << b; } else { ss << ( arma_isinf(b) ? ((b <= T(0)) ? "-inf" : "+inf") : "nan" ); } ss << ')'; o << ss.str(); } //! Print a matrix to the specified stream template inline void arma_ostream::print(std::ostream& o, const Mat& m, const bool modify) { arma_debug_sigprint(); const arma_ostream_state stream_state(o); const std::streamsize cell_width = modify ? arma_ostream::modify_stream(o, m.memptr(), m.n_elem) : o.width(); const uword m_n_rows = m.n_rows; const uword m_n_cols = m.n_cols; if(m.is_empty() == false) { if(m_n_cols > 0) { if(cell_width > 0) { for(uword row=0; row < m_n_rows; ++row) { for(uword col=0; col < m_n_cols; ++col) { // the cell width appears to be reset after each element is printed, // hence we need to restore it o.width(cell_width); arma_ostream::print_elem(o, m.at(row,col), modify); } o << '\n'; } } else { for(uword row=0; row < m_n_rows; ++row) { for(uword col=0; col < m_n_cols-1; ++col) { arma_ostream::print_elem(o, m.at(row,col), modify); o << ' '; } arma_ostream::print_elem(o, m.at(row, m_n_cols-1), modify); o << '\n'; } } } } else { if(modify) { o.unsetf(ios::showbase); o.unsetf(ios::uppercase); o.unsetf(ios::showpos); o.setf(ios::fixed); } o << "[matrix size: " << m_n_rows << 'x' << m_n_cols << "]\n"; } o.flush(); stream_state.restore(o); } //! Print a cube to the specified stream template inline void arma_ostream::print(std::ostream& o, const Cube& x, const bool modify) { arma_debug_sigprint(); const arma_ostream_state stream_state(o); if(x.is_empty() == false) { for(uword slice=0; slice < x.n_slices; ++slice) { const Mat tmp(const_cast(x.slice_memptr(slice)), x.n_rows, x.n_cols, false); o << "[cube slice: " << slice << ']' << '\n'; arma_ostream::print(o, tmp, modify); if((slice+1) < x.n_slices) { o << '\n'; } } } else { if(modify) { o.unsetf(ios::showbase); o.unsetf(ios::uppercase); o.unsetf(ios::showpos); o.setf(ios::fixed); } o << "[cube size: " << x.n_rows << 'x' << x.n_cols << 'x' << x.n_slices << "]\n"; } stream_state.restore(o); } //! Print a field to the specified stream //! Assumes type oT can be printed, ie. oT has std::ostream& operator<< (std::ostream&, const oT&) template inline void arma_ostream::print(std::ostream& o, const field& x) { arma_debug_sigprint(); const arma_ostream_state stream_state(o); const std::streamsize cell_width = o.width(); const uword x_n_rows = x.n_rows; const uword x_n_cols = x.n_cols; const uword x_n_slices = x.n_slices; if(x.is_empty() == false) { if(x_n_slices == 1) { for(uword col=0; col < x_n_cols; ++col) { o << "[field column: " << col << ']' << '\n'; for(uword row=0; row < x_n_rows; ++row) { o.width(cell_width); o << x.at(row,col) << '\n'; } o << '\n'; } } else { for(uword slice=0; slice < x_n_slices; ++slice) { o << "[field slice: " << slice << ']' << '\n'; for(uword col=0; col < x_n_cols; ++col) { o << "[field column: " << col << ']' << '\n'; for(uword row=0; row < x_n_rows; ++row) { o.width(cell_width); o << x.at(row,col,slice) << '\n'; } o << '\n'; } o << '\n'; } } } else { o.unsetf(ios::showbase); o.unsetf(ios::uppercase); o.unsetf(ios::showpos); o.setf(ios::fixed); o << "[field size: " << x_n_rows << 'x' << x_n_cols << 'x' << x_n_slices << "]\n"; } o.flush(); stream_state.restore(o); } //! Print a subfield to the specified stream //! Assumes type oT can be printed, ie. oT has std::ostream& operator<< (std::ostream&, const oT&) template inline void arma_ostream::print(std::ostream& o, const subview_field& x) { arma_debug_sigprint(); const arma_ostream_state stream_state(o); const std::streamsize cell_width = o.width(); const uword x_n_rows = x.n_rows; const uword x_n_cols = x.n_cols; const uword x_n_slices = x.n_slices; if(x.is_empty() == false) { if(x_n_slices == 1) { for(uword col=0; col < x_n_cols; ++col) { o << "[field column: " << col << ']' << '\n'; for(uword row=0; row inline void arma_ostream::print_dense(std::ostream& o, const SpMat& m, const bool modify) { arma_debug_sigprint(); const arma_ostream_state stream_state(o); std::streamsize cell_width = o.width(); if(modify) { if(m.n_nonzero > 0) { cell_width = arma_ostream::modify_stream(o, m.begin(), m.n_nonzero); } else { eT tmp[1]; tmp[0] = eT(0); cell_width = arma_ostream::modify_stream(o, &tmp[0], 1); } } const uword m_n_rows = m.n_rows; const uword m_n_cols = m.n_cols; if(m.is_empty() == false) { if(m_n_cols > 0) { if(cell_width > 0) { for(uword row=0; row < m_n_rows; ++row) { for(uword col=0; col < m_n_cols; ++col) { // the cell width appears to be reset after each element is printed, // hence we need to restore it o.width(cell_width); arma_ostream::print_elem(o, m.at(row,col), modify); } o << '\n'; } } else { for(uword row=0; row < m_n_rows; ++row) { for(uword col=0; col < m_n_cols-1; ++col) { arma_ostream::print_elem(o, m.at(row,col), modify); o << ' '; } arma_ostream::print_elem(o, m.at(row, m_n_cols-1), modify); o << '\n'; } } } } else { if(modify) { o.unsetf(ios::showbase); o.unsetf(ios::uppercase); o.unsetf(ios::showpos); o.setf(ios::fixed); } o << "[matrix size: " << m_n_rows << 'x' << m_n_cols << "]\n"; } o.flush(); stream_state.restore(o); } template inline void arma_ostream::print(std::ostream& o, const SpMat& m, const bool modify) { arma_debug_sigprint(); const arma_ostream_state stream_state(o); o.unsetf(ios::showbase); o.unsetf(ios::uppercase); o.unsetf(ios::showpos); o.unsetf(ios::scientific); o.setf(ios::right); o.setf(ios::fixed); const uword m_n_nonzero = m.n_nonzero; const double density = (m.n_elem > 0) ? (double(m_n_nonzero) / double(m.n_elem) * double(100)) : double(0); o << "[matrix size: " << m.n_rows << 'x' << m.n_cols << "; n_nonzero: " << m_n_nonzero; if(density == double(0)) { o.precision(0); } else if(density >= (double(10.0)-std::numeric_limits::epsilon())) { o.precision(1); } else if(density > (double(0.01)-std::numeric_limits::epsilon())) { o.precision(2); } else if(density > (double(0.001)-std::numeric_limits::epsilon())) { o.precision(3); } else if(density > (double(0.0001)-std::numeric_limits::epsilon())) { o.precision(4); } else { o.unsetf(ios::fixed); o.setf(ios::scientific); o.precision(2); } o << "; density: " << density << "%]\n\n"; if(modify == false) { stream_state.restore(o); } if(m_n_nonzero > 0) { const std::streamsize cell_width = modify ? arma_ostream::modify_stream(o, m.begin(), m_n_nonzero) : o.width(); typename SpMat::const_iterator it = m.begin(); typename SpMat::const_iterator it_end = m.end(); while(it != it_end) { const uword row = it.row(); const uword col = it.col(); // TODO: change the maximum number of spaces before and after each location to be dependent on n_rows and n_cols if(row < 10) { o << " "; } else if(row < 100) { o << " "; } else if(row < 1000) { o << " "; } else if(row < 10000) { o << " "; } else if(row < 100000) { o << " "; } else if(row < 1000000) { o << ' '; } o << '(' << row << ", " << col << ") "; if(col < 10) { o << " "; } else if(col < 100) { o << " "; } else if(col < 1000) { o << " "; } else if(col < 10000) { o << " "; } else if(col < 100000) { o << " "; } else if(col < 1000000) { o << ' '; } if(cell_width > 0) { o.width(cell_width); } arma_ostream::print_elem(o, eT(*it), modify); o << '\n'; ++it; } o << '\n'; } o.flush(); stream_state.restore(o); } inline void arma_ostream::print(std::ostream& o, const SizeMat& S) { arma_debug_sigprint(); const arma_ostream_state stream_state(o); o.unsetf(ios::showbase); o.unsetf(ios::uppercase); o.unsetf(ios::showpos); o.setf(ios::fixed); o << S.n_rows << 'x' << S.n_cols; stream_state.restore(o); } inline void arma_ostream::print(std::ostream& o, const SizeCube& S) { arma_debug_sigprint(); const arma_ostream_state stream_state(o); o.unsetf(ios::showbase); o.unsetf(ios::uppercase); o.unsetf(ios::showpos); o.setf(ios::fixed); o << S.n_rows << 'x' << S.n_cols << 'x' << S.n_slices; stream_state.restore(o); } template inline void arma_ostream::brief_print(std::ostream& o, const Mat& m, const bool print_size) { arma_debug_sigprint(); const arma_ostream_state stream_state(o); if(print_size) { o.unsetf(ios::showbase); o.unsetf(ios::uppercase); o.unsetf(ios::showpos); o.setf(ios::fixed); o << "[matrix size: " << m.n_rows << 'x' << m.n_cols << "]\n"; } if(m.n_elem == 0) { o.flush(); stream_state.restore(o); return; } if((m.n_rows <= 5) && (m.n_cols <= 5)) { arma_ostream::print(o, m, true); return; } const bool print_row_ellipsis = (m.n_rows >= 6); const bool print_col_ellipsis = (m.n_cols >= 6); if( (print_row_ellipsis == true) && (print_col_ellipsis == true) ) { Mat X(4, 4, arma_nozeros_indicator()); X( span(0,2), span(0,2) ) = m( span(0,2), span(0,2) ); // top left submatrix X( 3, span(0,2) ) = m( m.n_rows-1, span(0,2) ); // truncated last row X( span(0,2), 3 ) = m( span(0,2), m.n_cols-1 ); // truncated last column X( 3, 3 ) = m( m.n_rows-1, m.n_cols-1 ); // bottom right element const std::streamsize cell_width = arma_ostream::modify_stream(o, X.memptr(), X.n_elem); for(uword row=0; row <= 2; ++row) { for(uword col=0; col <= 2; ++col) { o.width(cell_width); arma_ostream::print_elem(o, X.at(row,col), true); } o.width(6); o << "..."; o.width(cell_width); arma_ostream::print_elem(o, X.at(row,3), true); o << '\n'; } for(uword col=0; col <= 2; ++col) { o.width(cell_width); o << ':'; } o.width(6); o << "..."; o.width(cell_width); o << ':' << '\n'; const uword row = 3; { for(uword col=0; col <= 2; ++col) { o.width(cell_width); arma_ostream::print_elem(o, X.at(row,col), true); } o.width(6); o << "..."; o.width(cell_width); arma_ostream::print_elem(o, X.at(row,3), true); o << '\n'; } } if( (print_row_ellipsis == true) && (print_col_ellipsis == false) ) { Mat X(4, m.n_cols, arma_nozeros_indicator()); X( span(0,2), span::all ) = m( span(0,2), span::all ); // top X( 3, span::all ) = m( m.n_rows-1, span::all ); // bottom const std::streamsize cell_width = arma_ostream::modify_stream(o, X.memptr(), X.n_elem); for(uword row=0; row <= 2; ++row) // first 3 rows { for(uword col=0; col < m.n_cols; ++col) { o.width(cell_width); arma_ostream::print_elem(o, X.at(row,col), true); } o << '\n'; } for(uword col=0; col < m.n_cols; ++col) { o.width(cell_width); o << ':'; } o.width(cell_width); o << '\n'; const uword row = 3; { for(uword col=0; col < m.n_cols; ++col) { o.width(cell_width); arma_ostream::print_elem(o, X.at(row,col), true); } } o << '\n'; } if( (print_row_ellipsis == false) && (print_col_ellipsis == true) ) { Mat X(m.n_rows, 4, arma_nozeros_indicator()); X( span::all, span(0,2) ) = m( span::all, span(0,2) ); // left X( span::all, 3 ) = m( span::all, m.n_cols-1 ); // right const std::streamsize cell_width = arma_ostream::modify_stream(o, X.memptr(), X.n_elem); for(uword row=0; row < m.n_rows; ++row) { for(uword col=0; col <= 2; ++col) { o.width(cell_width); arma_ostream::print_elem(o, X.at(row,col), true); } o.width(6); o << "..."; o.width(cell_width); arma_ostream::print_elem(o, X.at(row,3), true); o << '\n'; } } o.flush(); stream_state.restore(o); } template inline void arma_ostream::brief_print(std::ostream& o, const Cube& x) { arma_debug_sigprint(); const arma_ostream_state stream_state(o); o.unsetf(ios::showbase); o.unsetf(ios::uppercase); o.unsetf(ios::showpos); o.setf(ios::fixed); o << "[cube size: " << x.n_rows << 'x' << x.n_cols << 'x' << x.n_slices << "]\n"; if(x.n_elem == 0) { o.flush(); stream_state.restore(o); return; } if(x.n_slices <= 3) { for(uword slice=0; slice < x.n_slices; ++slice) { const Mat tmp(const_cast(x.slice_memptr(slice)), x.n_rows, x.n_cols, false); o << "[cube slice: " << slice << ']' << '\n'; arma_ostream::brief_print(o, tmp, false); if((slice+1) < x.n_slices) { o << '\n'; } } } else { for(uword slice=0; slice <= 1; ++slice) { const Mat tmp(const_cast(x.slice_memptr(slice)), x.n_rows, x.n_cols, false); o << "[cube slice: " << slice << ']' << '\n'; arma_ostream::brief_print(o, tmp, false); o << '\n'; } o << "[cube slice: ...]\n\n"; const uword slice = x.n_slices-1; { const Mat tmp(const_cast(x.slice_memptr(slice)), x.n_rows, x.n_cols, false); o << "[cube slice: " << slice << ']' << '\n'; arma_ostream::brief_print(o, tmp, false); } } stream_state.restore(o); } template inline void arma_ostream::brief_print(std::ostream& o, const SpMat& m) { arma_debug_sigprint(); if(m.n_nonzero <= 10) { arma_ostream::print(o, m, true); return; } const arma_ostream_state stream_state(o); o.unsetf(ios::showbase); o.unsetf(ios::uppercase); o.unsetf(ios::showpos); o.unsetf(ios::scientific); o.setf(ios::right); o.setf(ios::fixed); const uword m_n_nonzero = m.n_nonzero; const double density = (m.n_elem > 0) ? (double(m_n_nonzero) / double(m.n_elem) * double(100)) : double(0); o << "[matrix size: " << m.n_rows << 'x' << m.n_cols << "; n_nonzero: " << m_n_nonzero; if(density == double(0)) { o.precision(0); } else if(density >= (double(10.0)-std::numeric_limits::epsilon())) { o.precision(1); } else if(density > (double(0.01)-std::numeric_limits::epsilon())) { o.precision(2); } else if(density > (double(0.001)-std::numeric_limits::epsilon())) { o.precision(3); } else if(density > (double(0.0001)-std::numeric_limits::epsilon())) { o.precision(4); } else { o.unsetf(ios::fixed); o.setf(ios::scientific); o.precision(2); } o << "; density: " << density << "%]\n\n"; // get the first 9 elements and the last element typename SpMat::const_iterator it = m.begin(); typename SpMat::const_iterator it_end = m.end(); uvec storage_row(10); uvec storage_col(10); Col storage_val(10); uword count = 0; while( (it != it_end) && (count < 9) ) { storage_row(count) = it.row(); storage_col(count) = it.col(); storage_val(count) = (*it); ++it; ++count; } it = it_end; --it; storage_row(count) = it.row(); storage_col(count) = it.col(); storage_val(count) = (*it); const std::streamsize cell_width = arma_ostream::modify_stream(o, storage_val.memptr(), 10); for(uword i=0; i < 9; ++i) { const uword row = storage_row(i); const uword col = storage_col(i); if(row < 10) { o << " "; } else if(row < 100) { o << " "; } else if(row < 1000) { o << " "; } else if(row < 10000) { o << " "; } else if(row < 100000) { o << " "; } else if(row < 1000000) { o << ' '; } o << '(' << row << ", " << col << ") "; if(col < 10) { o << " "; } else if(col < 100) { o << " "; } else if(col < 1000) { o << " "; } else if(col < 10000) { o << " "; } else if(col < 100000) { o << " "; } else if(col < 1000000) { o << ' '; } if(cell_width > 0) { o.width(cell_width); } arma_ostream::print_elem(o, storage_val(i), true); o << '\n'; } o << " (:, :) "; if(cell_width > 0) { o.width(cell_width); } o << "...\n"; const uword i = 9; { const uword row = storage_row(i); const uword col = storage_col(i); if(row < 10) { o << " "; } else if(row < 100) { o << " "; } else if(row < 1000) { o << " "; } else if(row < 10000) { o << " "; } else if(row < 100000) { o << " "; } else if(row < 1000000) { o << ' '; } o << '(' << row << ", " << col << ") "; if(col < 10) { o << " "; } else if(col < 100) { o << " "; } else if(col < 1000) { o << " "; } else if(col < 10000) { o << " "; } else if(col < 100000) { o << " "; } else if(col < 1000000) { o << ' '; } if(cell_width > 0) { o.width(cell_width); } arma_ostream::print_elem(o, storage_val(i), true); o << '\n'; } o.flush(); stream_state.restore(o); } //! @} RcppArmadillo/inst/include/armadillo_bits/SpMat_bones.hpp0000644000176200001440000010676415013306507023331 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup SpMat //! @{ //! Sparse matrix class, with data stored in compressed sparse column (CSC) format template class SpMat : public SpBase< eT, SpMat > { public: typedef eT elem_type; //!< the type of elements stored in the matrix typedef typename get_pod_type::result pod_type; //!< if eT is std::complex, pod_type is T; otherwise pod_type is eT static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = false; const uword n_rows; //!< number of rows (read-only) const uword n_cols; //!< number of columns (read-only) const uword n_elem; //!< number of elements (read-only) const uword n_nonzero; //!< number of nonzero elements (read-only) const uword vec_state; //!< 0: matrix; 1: column vector; 2: row vector // The memory used to store the values of the matrix. // In accordance with the CSC format, this stores only the actual values. // The correct locations of the values are assembled from the row indices and column pointers. // // The length of this array is (n_nonzero + 1). // The final value values[n_nonzero] must be zero to ensure integrity of iterators. // Use mem_resize(new_n_nonzero) to resize this array. // // WARNING: the 'values' array is only valid after sync() is called; // WARNING: there is a separate cache for fast element insertion arma_aligned const eT* const values; // The row indices of each value. row_indices[i] is the row of values[i]. // // The length of this array is (n_nonzero + 1). // The final value row_indices[n_nonzero] must be zero to ensure integrity of iterators. // Use mem_resize(new_n_nonzero) to resize this array. // // WARNING: the 'row_indices' array is only valid after sync() is called; // WARNING: there is a separate cache for fast element insertion arma_aligned const uword* const row_indices; // The column pointers. This stores the index of the first item in column i. // That is, values[col_ptrs[i]] is the first value in column i, // and it is in the row indicated by row_indices[col_ptrs[i]]. // // The length of this array is (n_cols + 2). // The element col_ptrs[n_cols] must be equal to n_nonzero. // The element col_ptrs[n_cols + 1] must be an invalid very large value to ensure integrity of iterators. // // The col_ptrs array is set by the init() function // (which is called by constructors, set_size() and other functions that change the matrix size). // // WARNING: the 'col_ptrs' array is only valid after sync() is called; // WARNING: there is a separate cache for fast element insertion arma_aligned const uword* const col_ptrs; inline SpMat(); inline ~SpMat(); inline explicit SpMat(const uword in_rows, const uword in_cols); inline explicit SpMat(const SizeMat& s); inline SpMat(const char* text); inline SpMat& operator=(const char* text); inline SpMat(const std::string& text); inline SpMat& operator=(const std::string& text); inline SpMat(const SpMat& x); inline SpMat(SpMat&& m); inline SpMat& operator=(SpMat&& m); inline explicit SpMat(const MapMat& x); inline SpMat& operator= (const MapMat& x); template inline SpMat(const Base& rowind, const Base& colptr, const Base& values, const uword n_rows, const uword n_cols, const bool check_for_zeros = true); template inline SpMat(const Base& locations, const Base& values, const bool sort_locations = true); template inline SpMat(const Base& locations, const Base& values, const uword n_rows, const uword n_cols, const bool sort_locations = true, const bool check_for_zeros = true); template inline SpMat(const bool add_values, const Base& locations, const Base& values, const uword n_rows, const uword n_cols, const bool sort_locations = true, const bool check_for_zeros = true); inline SpMat& operator= (const eT val); //! sets size to 1x1 inline SpMat& operator*=(const eT val); inline SpMat& operator/=(const eT val); // operator+=(val) and operator-=(val) are not defined as they don't make sense for sparse matrices inline SpMat& operator= (const SpMat& m); inline SpMat& operator+=(const SpMat& m); inline SpMat& operator-=(const SpMat& m); inline SpMat& operator*=(const SpMat& m); inline SpMat& operator%=(const SpMat& m); inline SpMat& operator/=(const SpMat& m); template inline explicit SpMat(const Base& m); template inline SpMat& operator= (const Base& m); template inline SpMat& operator+=(const Base& m); template inline SpMat& operator-=(const Base& m); template inline SpMat& operator*=(const Base& m); template inline SpMat& operator/=(const Base& m); template inline SpMat& operator%=(const Base& m); template inline explicit SpMat(const Op& expr); template inline SpMat& operator= (const Op& expr); template inline SpMat& operator+=(const Op& expr); template inline SpMat& operator-=(const Op& expr); template inline SpMat& operator*=(const Op& expr); template inline SpMat& operator/=(const Op& expr); template inline SpMat& operator%=(const Op& expr); //! construction of complex matrix out of two non-complex matrices template inline explicit SpMat(const SpBase& A, const SpBase& B); inline SpMat(const SpSubview& X); inline SpMat& operator= (const SpSubview& X); inline SpMat& operator+=(const SpSubview& X); inline SpMat& operator-=(const SpSubview& X); inline SpMat& operator*=(const SpSubview& X); inline SpMat& operator%=(const SpSubview& X); inline SpMat& operator/=(const SpSubview& X); template inline SpMat(const SpSubview_col_list& X); template inline SpMat& operator= (const SpSubview_col_list& X); template inline SpMat& operator+=(const SpSubview_col_list& X); template inline SpMat& operator-=(const SpSubview_col_list& X); template inline SpMat& operator*=(const SpSubview_col_list& X); template inline SpMat& operator%=(const SpSubview_col_list& X); template inline SpMat& operator/=(const SpSubview_col_list& X); inline SpMat(const spdiagview& X); inline SpMat& operator= (const spdiagview& X); inline SpMat& operator+=(const spdiagview& X); inline SpMat& operator-=(const spdiagview& X); inline SpMat& operator*=(const spdiagview& X); inline SpMat& operator%=(const spdiagview& X); inline SpMat& operator/=(const spdiagview& X); template inline SpMat(const SpOp& X); template inline SpMat& operator= (const SpOp& X); template inline SpMat& operator+=(const SpOp& X); template inline SpMat& operator-=(const SpOp& X); template inline SpMat& operator*=(const SpOp& X); template inline SpMat& operator%=(const SpOp& X); template inline SpMat& operator/=(const SpOp& X); template inline SpMat(const SpGlue& X); template inline SpMat& operator= (const SpGlue& X); template inline SpMat& operator+=(const SpGlue& X); template inline SpMat& operator-=(const SpGlue& X); template inline SpMat& operator*=(const SpGlue& X); template inline SpMat& operator%=(const SpGlue& X); template inline SpMat& operator/=(const SpGlue& X); template inline SpMat(const mtSpOp& X); template inline SpMat& operator= (const mtSpOp& X); template inline SpMat& operator+=(const mtSpOp& X); template inline SpMat& operator-=(const mtSpOp& X); template inline SpMat& operator*=(const mtSpOp& X); template inline SpMat& operator%=(const mtSpOp& X); template inline SpMat& operator/=(const mtSpOp& X); template inline SpMat(const mtSpGlue& X); template inline SpMat& operator= (const mtSpGlue& X); template inline SpMat& operator+=(const mtSpGlue& X); template inline SpMat& operator-=(const mtSpGlue& X); template inline SpMat& operator*=(const mtSpGlue& X); template inline SpMat& operator%=(const mtSpGlue& X); template inline SpMat& operator/=(const mtSpGlue& X); template inline SpMat(const mtSpReduceOp& X); template inline SpMat& operator= (const mtSpReduceOp& X); template inline SpMat& operator+=(const mtSpReduceOp& X); template inline SpMat& operator-=(const mtSpReduceOp& X); template inline SpMat& operator*=(const mtSpReduceOp& X); template inline SpMat& operator%=(const mtSpReduceOp& X); template inline SpMat& operator/=(const mtSpReduceOp& X); arma_inline SpSubview_row row(const uword row_num); arma_inline const SpSubview_row row(const uword row_num) const; inline SpSubview_row operator()(const uword row_num, const span& col_span); inline const SpSubview_row operator()(const uword row_num, const span& col_span) const; arma_inline SpSubview_col col(const uword col_num); arma_inline const SpSubview_col col(const uword col_num) const; inline SpSubview_col operator()(const span& row_span, const uword col_num); inline const SpSubview_col operator()(const span& row_span, const uword col_num) const; arma_inline SpSubview rows(const uword in_row1, const uword in_row2); arma_inline const SpSubview rows(const uword in_row1, const uword in_row2) const; arma_inline SpSubview cols(const uword in_col1, const uword in_col2); arma_inline const SpSubview cols(const uword in_col1, const uword in_col2) const; arma_inline SpSubview submat(const uword in_row1, const uword in_col1, const uword in_row2, const uword in_col2); arma_inline const SpSubview submat(const uword in_row1, const uword in_col1, const uword in_row2, const uword in_col2) const; arma_inline SpSubview submat(const uword in_row1, const uword in_col1, const SizeMat& s); arma_inline const SpSubview submat(const uword in_row1, const uword in_col1, const SizeMat& s) const; inline SpSubview submat (const span& row_span, const span& col_span); inline const SpSubview submat (const span& row_span, const span& col_span) const; inline SpSubview operator()(const span& row_span, const span& col_span); inline const SpSubview operator()(const span& row_span, const span& col_span) const; arma_inline SpSubview operator()(const uword in_row1, const uword in_col1, const SizeMat& s); arma_inline const SpSubview operator()(const uword in_row1, const uword in_col1, const SizeMat& s) const; inline SpSubview head_rows(const uword N); inline const SpSubview head_rows(const uword N) const; inline SpSubview tail_rows(const uword N); inline const SpSubview tail_rows(const uword N) const; inline SpSubview head_cols(const uword N); inline const SpSubview head_cols(const uword N) const; inline SpSubview tail_cols(const uword N); inline const SpSubview tail_cols(const uword N) const; template arma_inline SpSubview_col_list cols(const Base& ci); template arma_inline const SpSubview_col_list cols(const Base& ci) const; inline spdiagview diag(const sword in_id = 0); inline const spdiagview diag(const sword in_id = 0) const; inline void swap_rows(const uword in_row1, const uword in_row2); inline void swap_cols(const uword in_col1, const uword in_col2); inline void shed_row(const uword row_num); inline void shed_col(const uword col_num); inline void shed_rows(const uword in_row1, const uword in_row2); inline void shed_cols(const uword in_col1, const uword in_col2); // access the i-th element; if there is nothing at element i, 0 is returned arma_warn_unused arma_inline SpMat_MapMat_val operator[] (const uword i); arma_warn_unused arma_inline eT operator[] (const uword i) const; arma_warn_unused arma_inline SpMat_MapMat_val at (const uword i); arma_warn_unused arma_inline eT at (const uword i) const; arma_warn_unused arma_inline SpMat_MapMat_val operator() (const uword i); arma_warn_unused arma_inline eT operator() (const uword i) const; // access the element at the given row and column; if there is nothing at that position, 0 is returned #if defined(__cpp_multidimensional_subscript) arma_warn_unused arma_inline SpMat_MapMat_val operator[] (const uword in_row, const uword in_col); arma_warn_unused arma_inline eT operator[] (const uword in_row, const uword in_col) const; #endif arma_warn_unused arma_inline SpMat_MapMat_val at (const uword in_row, const uword in_col); arma_warn_unused arma_inline eT at (const uword in_row, const uword in_col) const; arma_warn_unused arma_inline SpMat_MapMat_val operator() (const uword in_row, const uword in_col); arma_warn_unused arma_inline eT operator() (const uword in_row, const uword in_col) const; arma_warn_unused arma_inline bool is_empty() const; arma_warn_unused arma_inline bool is_vec() const; arma_warn_unused arma_inline bool is_rowvec() const; arma_warn_unused arma_inline bool is_colvec() const; arma_warn_unused arma_inline bool is_square() const; arma_warn_unused inline bool is_symmetric() const; arma_warn_unused inline bool is_symmetric(const typename get_pod_type::result tol) const; arma_warn_unused inline bool is_hermitian() const; arma_warn_unused inline bool is_hermitian(const typename get_pod_type::result tol) const; arma_warn_unused inline bool internal_is_finite() const; arma_warn_unused inline bool internal_has_inf() const; arma_warn_unused inline bool internal_has_nan() const; arma_warn_unused inline bool internal_has_nonfinite() const; arma_warn_unused arma_inline bool in_range(const uword i) const; arma_warn_unused arma_inline bool in_range(const span& x) const; arma_warn_unused arma_inline bool in_range(const uword in_row, const uword in_col) const; arma_warn_unused arma_inline bool in_range(const span& row_span, const uword in_col) const; arma_warn_unused arma_inline bool in_range(const uword in_row, const span& col_span) const; arma_warn_unused arma_inline bool in_range(const span& row_span, const span& col_span) const; arma_warn_unused arma_inline bool in_range(const uword in_row, const uword in_col, const SizeMat& s) const; template inline SpMat& copy_size(const SpMat& m); template inline SpMat& copy_size(const Mat& m); inline SpMat& set_size(const uword in_elem); inline SpMat& set_size(const uword in_rows, const uword in_cols); inline SpMat& set_size(const SizeMat& s); inline SpMat& resize(const uword in_rows, const uword in_cols); inline SpMat& resize(const SizeMat& s); inline SpMat& reshape(const uword in_rows, const uword in_cols); inline SpMat& reshape(const SizeMat& s); inline void reshape_helper_generic(const uword in_rows, const uword in_cols); //! internal use only inline void reshape_helper_intovec(); //! internal use only template inline SpMat& for_each(functor F); template inline const SpMat& for_each(functor F) const; template inline SpMat& transform(functor F); inline SpMat& replace(const eT old_val, const eT new_val); inline SpMat& clean(const pod_type threshold); inline SpMat& clamp(const eT min_val, const eT max_val); inline SpMat& zeros(); inline SpMat& zeros(const uword in_elem); inline SpMat& zeros(const uword in_rows, const uword in_cols); inline SpMat& zeros(const SizeMat& s); inline SpMat& eye(); inline SpMat& eye(const uword in_rows, const uword in_cols); inline SpMat& eye(const SizeMat& s); inline SpMat& speye(); inline SpMat& speye(const uword in_rows, const uword in_cols); inline SpMat& speye(const SizeMat& s); inline SpMat& sprandu(const uword in_rows, const uword in_cols, const double density); inline SpMat& sprandu(const SizeMat& s, const double density); inline SpMat& sprandn(const uword in_rows, const uword in_cols, const double density); inline SpMat& sprandn(const SizeMat& s, const double density); inline void reset(); inline void reset_cache(); //! don't use this unless you're writing internal Armadillo code inline void reserve(const uword in_rows, const uword in_cols, const uword new_n_nonzero); //! don't use this unless you're writing internal Armadillo code inline SpMat(const arma_reserve_indicator&, const uword in_rows, const uword in_cols, const uword new_n_nonzero); //! don't use this unless you're writing internal Armadillo code template inline SpMat(const arma_layout_indicator&, const SpMat& x); template inline void set_real(const SpBase& X); template inline void set_imag(const SpBase& X); // saving and loading // TODO: implement auto_detect for sparse matrices arma_cold inline bool save(const std::string name, const file_type type = arma_binary) const; arma_cold inline bool save(const csv_name& spec, const file_type type = csv_ascii) const; arma_cold inline bool save( std::ostream& os, const file_type type = arma_binary) const; arma_cold inline bool load(const std::string name, const file_type type = arma_binary); arma_cold inline bool load(const csv_name& spec, const file_type type = csv_ascii); arma_cold inline bool load( std::istream& is, const file_type type = arma_binary); arma_frown("use save() instead") inline bool quiet_save(const std::string name, const file_type type = arma_binary) const; arma_frown("use save() instead") inline bool quiet_save( std::ostream& os, const file_type type = arma_binary) const; arma_frown("use load() instead") inline bool quiet_load(const std::string name, const file_type type = arma_binary); arma_frown("use load() instead") inline bool quiet_load( std::istream& is, const file_type type = arma_binary); // necessary forward declarations class iterator_base; class iterator; class const_iterator; class row_iterator; class const_row_iterator; // iterator_base provides basic operators but not how to compare or how to iterate class iterator_base { public: inline iterator_base(); inline iterator_base(const SpMat& in_M); inline iterator_base(const SpMat& in_M, const uword col, const uword pos); arma_inline eT operator*() const; // don't hold location internally; call "dummy" methods to get that information arma_inline uword row() const { return M->row_indices[internal_pos]; } arma_inline uword col() const { return internal_col; } arma_inline uword pos() const { return internal_pos; } arma_aligned const SpMat* M; arma_aligned uword internal_col; arma_aligned uword internal_pos; typedef std::bidirectional_iterator_tag iterator_category; typedef eT value_type; typedef std::ptrdiff_t difference_type; // TODO: not certain on this one typedef const eT* pointer; typedef const eT& reference; }; class const_iterator : public iterator_base { public: inline const_iterator(); inline const_iterator(const SpMat& in_M, uword initial_pos = 0); // assumes initial_pos is valid inline const_iterator(const SpMat& in_M, uword in_row, uword in_col); // iterator will be at the first nonzero value after the given position (using forward columnwise traversal) inline const_iterator(const SpMat& in_M, uword in_row, uword in_col, uword in_pos); // if the exact position of the iterator is known; in_row is a dummy argument inline const_iterator(const const_iterator& other); inline const_iterator& operator= (const const_iterator& other) = default; arma_hot inline const_iterator& operator++(); arma_warn_unused inline const_iterator operator++(int); arma_hot inline const_iterator& operator--(); arma_warn_unused inline const_iterator operator--(int); arma_hot inline bool operator==(const const_iterator& rhs) const; arma_hot inline bool operator!=(const const_iterator& rhs) const; arma_hot inline bool operator==(const typename SpSubview::const_iterator& rhs) const; arma_hot inline bool operator!=(const typename SpSubview::const_iterator& rhs) const; arma_hot inline bool operator==(const const_row_iterator& rhs) const; arma_hot inline bool operator!=(const const_row_iterator& rhs) const; arma_hot inline bool operator==(const typename SpSubview::const_row_iterator& rhs) const; arma_hot inline bool operator!=(const typename SpSubview::const_row_iterator& rhs) const; }; /** * So that we can iterate over nonzero values, we need an iterator implementation. * This can't be as simple as for Mat, which is just a pointer to an eT. * If a value is set to 0 using this iterator, the iterator is no longer valid! */ class iterator : public const_iterator { public: inline iterator() : const_iterator() { } inline iterator(SpMat& in_M, uword initial_pos = 0) : const_iterator(in_M, initial_pos) { } inline iterator(SpMat& in_M, uword in_row, uword in_col) : const_iterator(in_M, in_row, in_col) { } inline iterator(SpMat& in_M, uword in_row, uword in_col, uword in_pos) : const_iterator(in_M, in_row, in_col, in_pos) { } inline iterator (const iterator& other) : const_iterator(other) { } inline iterator& operator=(const iterator& other) = default; arma_hot inline SpValProxy< SpMat > operator*(); // overloads needed for return type correctness arma_hot inline iterator& operator++(); arma_warn_unused inline iterator operator++(int); arma_hot inline iterator& operator--(); arma_warn_unused inline iterator operator--(int); // this has a different value_type than iterator_base typedef SpValProxy< SpMat > value_type; typedef const SpValProxy< SpMat >* pointer; typedef const SpValProxy< SpMat >& reference; }; class const_row_iterator : public iterator_base { public: inline const_row_iterator(); inline const_row_iterator(const SpMat& in_M, uword initial_pos = 0); inline const_row_iterator(const SpMat& in_M, uword in_row, uword in_col); inline const_row_iterator(const const_row_iterator& other); inline const_row_iterator& operator= (const const_row_iterator& other) = default; arma_hot inline const_row_iterator& operator++(); arma_warn_unused inline const_row_iterator operator++(int); arma_hot inline const_row_iterator& operator--(); arma_warn_unused inline const_row_iterator operator--(int); uword internal_row; // hold row internally uword actual_pos; // hold the true position we are at in the matrix, as column-major indexing arma_inline eT operator*() const { return iterator_base::M->values[actual_pos]; } arma_inline uword row() const { return internal_row; } arma_hot inline bool operator==(const const_iterator& rhs) const; arma_hot inline bool operator!=(const const_iterator& rhs) const; arma_hot inline bool operator==(const typename SpSubview::const_iterator& rhs) const; arma_hot inline bool operator!=(const typename SpSubview::const_iterator& rhs) const; arma_hot inline bool operator==(const const_row_iterator& rhs) const; arma_hot inline bool operator!=(const const_row_iterator& rhs) const; arma_hot inline bool operator==(const typename SpSubview::const_row_iterator& rhs) const; arma_hot inline bool operator!=(const typename SpSubview::const_row_iterator& rhs) const; }; class row_iterator : public const_row_iterator { public: inline row_iterator() : const_row_iterator() {} inline row_iterator(SpMat& in_M, uword initial_pos = 0) : const_row_iterator(in_M, initial_pos) { } inline row_iterator(SpMat& in_M, uword in_row, uword in_col) : const_row_iterator(in_M, in_row, in_col) { } inline row_iterator(const row_iterator& other) : const_row_iterator(other) { } inline row_iterator& operator= (const row_iterator& other) = default; arma_hot inline SpValProxy< SpMat > operator*(); // overloads required for return type correctness arma_hot inline row_iterator& operator++(); arma_warn_unused inline row_iterator operator++(int); arma_hot inline row_iterator& operator--(); arma_warn_unused inline row_iterator operator--(int); // this has a different value_type than iterator_base typedef SpValProxy< SpMat > value_type; typedef const SpValProxy< SpMat >* pointer; typedef const SpValProxy< SpMat >& reference; }; typedef iterator col_iterator; typedef const_iterator const_col_iterator; typedef iterator row_col_iterator; typedef const_iterator const_row_col_iterator; inline iterator begin(); inline const_iterator begin() const; inline const_iterator cbegin() const; inline iterator end(); inline const_iterator end() const; inline const_iterator cend() const; inline col_iterator begin_col(const uword col_num); inline const_col_iterator begin_col(const uword col_num) const; inline col_iterator begin_col_no_sync(const uword col_num); inline const_col_iterator begin_col_no_sync(const uword col_num) const; inline col_iterator end_col(const uword col_num); inline const_col_iterator end_col(const uword col_num) const; inline col_iterator end_col_no_sync(const uword col_num); inline const_col_iterator end_col_no_sync(const uword col_num) const; inline row_iterator begin_row(const uword row_num = 0); inline const_row_iterator begin_row(const uword row_num = 0) const; inline row_iterator end_row(); inline const_row_iterator end_row() const; inline row_iterator end_row(const uword row_num); inline const_row_iterator end_row(const uword row_num) const; inline row_col_iterator begin_row_col(); inline const_row_col_iterator begin_row_col() const; inline row_col_iterator end_row_col(); inline const_row_col_iterator end_row_col() const; inline void clear(); inline bool empty() const; inline uword size() const; arma_warn_unused arma_inline SpMat_MapMat_val front(); arma_warn_unused arma_inline eT front() const; arma_warn_unused arma_inline SpMat_MapMat_val back(); arma_warn_unused arma_inline eT back() const; // Resize memory. // If the new size is larger, the column pointers and new memory still need to be correctly set. // If the new size is smaller, the first new_n_nonzero elements will be copied. // n_nonzero is updated. inline void mem_resize(const uword new_n_nonzero); //! synchronise CSC from cache inline void sync() const; //! don't use this unless you're writing internal Armadillo code inline void remove_zeros(); //! don't use this unless you're writing internal Armadillo code inline void steal_mem(SpMat& X); //! don't use this unless you're writing internal Armadillo code inline void steal_mem_simple(SpMat& X); //! don't use this unless you're writing internal Armadillo code template< typename T1, typename Functor> inline void init_xform (const SpBase& x, const Functor& func); template inline void init_xform_mt(const SpBase& x, const Functor& func); //! don't use this unless you're writing internal Armadillo code arma_inline bool is_alias(const SpMat& X) const; protected: inline void init(uword in_rows, uword in_cols, const uword new_n_nonzero = 0); arma_cold inline void init_cold(uword in_rows, uword in_cols, const uword new_n_nonzero = 0); inline void init(const std::string& text); inline void init(const SpMat& x); inline void init(const MapMat& x); inline void init_simple(const SpMat& x); inline void init_batch_std(const Mat& locations, const Mat& values, const bool sort_locations); inline void init_batch_add(const Mat& locations, const Mat& values, const bool sort_locations); inline SpMat(const arma_vec_indicator&, const uword in_vec_state); inline SpMat(const arma_vec_indicator&, const uword in_n_rows, const uword in_n_cols, const uword in_vec_state); private: arma_warn_unused arma_hot inline const eT* find_value_csc(const uword in_row, const uword in_col) const; arma_warn_unused arma_hot inline eT get_value(const uword i ) const; arma_warn_unused arma_hot inline eT get_value(const uword in_row, const uword in_col) const; arma_warn_unused arma_hot inline eT get_value_csc(const uword i ) const; arma_warn_unused arma_hot inline eT get_value_csc(const uword in_row, const uword in_col) const; arma_warn_unused arma_hot inline bool try_set_value_csc(const uword in_row, const uword in_col, const eT in_val); arma_warn_unused arma_hot inline bool try_add_value_csc(const uword in_row, const uword in_col, const eT in_val); arma_warn_unused arma_hot inline bool try_sub_value_csc(const uword in_row, const uword in_col, const eT in_val); arma_warn_unused arma_hot inline bool try_mul_value_csc(const uword in_row, const uword in_col, const eT in_val); arma_warn_unused arma_hot inline bool try_div_value_csc(const uword in_row, const uword in_col, const eT in_val); arma_warn_unused inline eT& insert_element(const uword in_row, const uword in_col, const eT in_val = eT(0)); inline void delete_element(const uword in_row, const uword in_col); // cache related arma_aligned mutable MapMat cache; arma_aligned mutable state_type sync_state; // 0: cache needs to be updated from CSC (ie. CSC has more recent data) // 1: CSC needs to be updated from cache (ie. cache has more recent data) // 2: no update required (ie. CSC and cache contain the same data) #if defined(ARMA_USE_STD_MUTEX) arma_aligned mutable std::mutex cache_mutex; #endif arma_inline void invalidate_cache() const; arma_inline void invalidate_csc() const; inline void sync_cache() const; inline void sync_cache_simple() const; inline void sync_csc() const; inline void sync_csc_simple() const; friend class SpValProxy< SpMat >; // allow SpValProxy to call insert_element() and delete_element() friend class SpSubview; friend class SpRow; friend class SpCol; friend class SpMat_MapMat_val; friend class SpSubview_MapMat_val; friend class spdiagview; template friend class SpSubview_col_list; public: #if defined(ARMA_EXTRA_SPMAT_PROTO) #include ARMA_INCFILE_WRAP(ARMA_EXTRA_SPMAT_PROTO) #endif }; class SpMat_aux { public: template inline static void set_real(SpMat& out, const SpBase& X); template inline static void set_real(SpMat< std::complex >& out, const SpBase< T,T1>& X); template inline static void set_imag(SpMat& out, const SpBase& X); template inline static void set_imag(SpMat< std::complex >& out, const SpBase< T,T1>& X); }; #define ARMA_HAS_SPMAT //! @} RcppArmadillo/inst/include/armadillo_bits/arma_rng.hpp0000644000176200001440000005640214752446051022706 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup arma_rng //! @{ #undef ARMA_USE_CXX11_RNG #define ARMA_USE_CXX11_RNG #undef ARMA_USE_THREAD_LOCAL #define ARMA_USE_THREAD_LOCAL #if (defined(ARMA_RNG_ALT) || defined(ARMA_DONT_USE_CXX11_RNG)) #undef ARMA_USE_CXX11_RNG #endif #if defined(ARMA_DONT_USE_THREAD_LOCAL) #undef ARMA_USE_THREAD_LOCAL #endif // NOTE: ARMA_WARMUP_PRODUCER enables a workaround // NOTE: for thread_local issue on macOS 11 and/or AppleClang 12.0 // NOTE: see https://gitlab.com/conradsnicta/armadillo-code/-/issues/173 // NOTE: if this workaround causes problems, please report it and // NOTE: disable the workaround by commenting out the code block below: #if defined(__APPLE__) || defined(__apple_build_version__) #undef ARMA_WARMUP_PRODUCER #define ARMA_WARMUP_PRODUCER #endif #if defined(ARMA_DONT_WARMUP_PRODUCER) #undef ARMA_WARMUP_PRODUCER #endif // NOTE: workaround for another thread_local issue on macOS // NOTE: where GCC (not Clang) may not have support for thread_local #if (defined(__APPLE__) && defined(__GNUG__) && !defined(__clang__)) #undef ARMA_USE_THREAD_LOCAL #endif // NOTE: disable use of thread_local on MinGW et al; // NOTE: i don't have the patience to keep looking into these broken platforms #if (defined(__MINGW32__) || defined(__MINGW64__) || defined(__CYGWIN__) || defined(__MSYS__) || defined(__MSYS2__)) #undef ARMA_USE_THREAD_LOCAL #endif #if defined(ARMA_FORCE_USE_THREAD_LOCAL) #undef ARMA_USE_THREAD_LOCAL #define ARMA_USE_THREAD_LOCAL #endif #if (!defined(ARMA_USE_THREAD_LOCAL)) #undef ARMA_GUARD_PRODUCER #define ARMA_GUARD_PRODUCER #endif #if (defined(ARMA_DONT_GUARD_PRODUCER) || (!defined(ARMA_USE_STD_MUTEX))) #undef ARMA_GUARD_PRODUCER #endif class arma_rng { public: #if defined(ARMA_RNG_ALT) typedef arma_rng_alt::seed_type seed_type; #elif defined(ARMA_USE_CXX11_RNG) typedef std::mt19937_64::result_type seed_type; #else typedef arma_rng_cxx03::seed_type seed_type; #endif #if defined(ARMA_RNG_ALT) static constexpr int rng_method = 2; #elif defined(ARMA_USE_CXX11_RNG) static constexpr int rng_method = 1; #else static constexpr int rng_method = 0; #endif #if defined(ARMA_USE_CXX11_RNG) inline static std::mt19937_64& get_producer(); inline static void warmup_producer(std::mt19937_64& producer); inline static void lock_producer(); inline static void unlock_producer(); #if defined(ARMA_GUARD_PRODUCER) inline static std::mutex& get_producer_mutex(); #endif #endif inline static void set_seed(const seed_type val); inline static void set_seed_random(); template struct randi; template struct randu; template struct randn; template struct randg; }; #if defined(ARMA_USE_CXX11_RNG) inline std::mt19937_64& arma_rng::get_producer() { #if defined(ARMA_USE_THREAD_LOCAL) // use a thread-safe RNG, with each thread having its own unique starting seed static std::atomic mt19937_64_producer_counter(0); static thread_local std::mt19937_64 mt19937_64_producer( std::mt19937_64::default_seed + mt19937_64_producer_counter++ ); arma_rng::warmup_producer(mt19937_64_producer); #else // use a plain RNG in case we don't have thread_local static std::mt19937_64 mt19937_64_producer( std::mt19937_64::default_seed ); arma_rng::warmup_producer(mt19937_64_producer); #endif return mt19937_64_producer; } inline void arma_rng::warmup_producer(std::mt19937_64& producer) { #if defined(ARMA_WARMUP_PRODUCER) static std::atomic_flag warmup_done = ATOMIC_FLAG_INIT; // init to false if(warmup_done.test_and_set() == false) { typename std::mt19937_64::result_type junk = producer(); arma_ignore(junk); } #else arma_ignore(producer); #endif } inline void arma_rng::lock_producer() { #if defined(ARMA_GUARD_PRODUCER) std::mutex& producer_mutex = arma_rng::get_producer_mutex(); producer_mutex.lock(); #endif } inline void arma_rng::unlock_producer() { #if defined(ARMA_GUARD_PRODUCER) std::mutex& producer_mutex = arma_rng::get_producer_mutex(); producer_mutex.unlock(); #endif } #if defined(ARMA_GUARD_PRODUCER) inline std::mutex& arma_rng::get_producer_mutex() { static std::mutex producer_mutex; return producer_mutex; } #endif #endif inline void arma_rng::set_seed(const arma_rng::seed_type val) { #if defined(ARMA_RNG_ALT) { arma_rng_alt::set_seed(val); } #elif defined(ARMA_USE_CXX11_RNG) { arma_rng::lock_producer(); arma_rng::get_producer().seed(val); arma_rng::unlock_producer(); } #else { arma_rng_cxx03::set_seed(val); } #endif } arma_cold inline void arma_rng::set_seed_random() { seed_type seed1 = seed_type(0); seed_type seed2 = seed_type(0); seed_type seed3 = seed_type(0); seed_type seed4 = seed_type(0); bool have_seed = false; try { std::random_device rd; if(rd.entropy() > double(0)) { seed1 = static_cast( rd() ); } have_seed = (seed1 != seed_type(0)); } catch(...) {} if(have_seed == false) { try { char tmp[sizeof(seed_type)] = {}; std::ifstream f("/dev/urandom", std::ifstream::binary); if(f.good()) { f.read(&(tmp[0]), sizeof(seed_type)); } if(f.good()) { std::memcpy(&seed2, &(tmp[0]), sizeof(seed_type)); } have_seed = (seed2 != seed_type(0)); } catch(...) {} } if(have_seed == false) { // get better-than-nothing seeds in case reading /dev/urandom failed const std::chrono::system_clock::time_point tp_now = std::chrono::system_clock::now(); auto since_epoch_usec = std::chrono::duration_cast(tp_now.time_since_epoch()).count(); seed3 = static_cast( since_epoch_usec & 0xFFFF ); unsigned char* a = (unsigned char*)std::malloc(std::size_t(4096)); unsigned char b[sizeof(unsigned char*)] = {}; if(a != nullptr) { std::memcpy(&(b[0]), &a, sizeof(unsigned char*)); for(size_t i=0; i struct arma_rng::randi { inline operator eT () { #if defined(ARMA_RNG_ALT) { return eT( arma_rng_alt::randi_val() ); } #elif defined(ARMA_USE_CXX11_RNG) { constexpr double scale = double(std::numeric_limits::max()) / double(std::mt19937_64::max()); arma_rng::lock_producer(); const eT out = eT(double(arma_rng::get_producer()()) * scale); arma_rng::unlock_producer(); return out; } #else { return eT( arma_rng_cxx03::randi_val() ); } #endif } inline static int max_val() { #if defined(ARMA_RNG_ALT) { return arma_rng_alt::randi_max_val(); } #elif defined(ARMA_USE_CXX11_RNG) { return std::numeric_limits::max(); } #else { return arma_rng_cxx03::randi_max_val(); } #endif } inline static void fill(eT* mem, const uword N, const int a, const int b) { #if defined(ARMA_RNG_ALT) { arma_rng_alt::randi_fill(mem, N, a, b); } #elif defined(ARMA_USE_CXX11_RNG) { std::uniform_int_distribution local_i_distr(a, b); std::mt19937_64& producer = arma_rng::get_producer(); arma_rng::lock_producer(); for(uword i=0; i local_i_distr(a, b); local_engine.seed( local_seed_type(std::rand()) ); for(uword i=0; i struct arma_rng::randu { inline operator eT () { #if defined(ARMA_RNG_ALT) { return eT( arma_rng_alt::randu_val() ); } #elif defined(ARMA_USE_CXX11_RNG) { constexpr double scale = double(1.0) / double(std::mt19937_64::max()); arma_rng::lock_producer(); const eT out = eT( double(arma_rng::get_producer()()) * scale ); arma_rng::unlock_producer(); return out; } #else { return eT( arma_rng_cxx03::randu_val() ); } #endif } inline static void fill(eT* mem, const uword N) { #if defined(ARMA_RNG_ALT) { for(uword i=0; i < N; ++i) { mem[i] = eT( arma_rng_alt::randu_val() ); } } #elif defined(ARMA_USE_CXX11_RNG) { std::uniform_real_distribution local_u_distr; std::mt19937_64& producer = arma_rng::get_producer(); arma_rng::lock_producer(); for(uword i=0; i < N; ++i) { mem[i] = eT( local_u_distr(producer) ); } arma_rng::unlock_producer(); } #else { if(N == uword(1)) { mem[0] = eT( arma_rng_cxx03::randu_val() ); return; } typedef typename std::mt19937_64::result_type local_seed_type; std::mt19937_64 local_engine; std::uniform_real_distribution local_u_distr; local_engine.seed( local_seed_type(std::rand()) ); for(uword i=0; i < N; ++i) { mem[i] = eT( local_u_distr(local_engine) ); } } #endif } inline static void fill(eT* mem, const uword N, const double a, const double b) { #if defined(ARMA_RNG_ALT) { const double r = b - a; for(uword i=0; i < N; ++i) { mem[i] = eT( arma_rng_alt::randu_val() * r + a ); } } #elif defined(ARMA_USE_CXX11_RNG) { std::uniform_real_distribution local_u_distr(a,b); std::mt19937_64& producer = arma_rng::get_producer(); arma_rng::lock_producer(); for(uword i=0; i < N; ++i) { mem[i] = eT( local_u_distr(producer) ); } arma_rng::unlock_producer(); } #else { if(N == uword(1)) { mem[0] = eT( arma_rng_cxx03::randu_val() * (b - a) + a ); return; } typedef typename std::mt19937_64::result_type local_seed_type; std::mt19937_64 local_engine; std::uniform_real_distribution local_u_distr(a,b); local_engine.seed( local_seed_type(std::rand()) ); for(uword i=0; i < N; ++i) { mem[i] = eT( local_u_distr(local_engine) ); } } #endif } }; template struct arma_rng::randu< std::complex > { arma_inline operator std::complex () { #if defined(ARMA_RNG_ALT) { const T a = T( arma_rng_alt::randu_val() ); const T b = T( arma_rng_alt::randu_val() ); return std::complex(a, b); } #elif defined(ARMA_USE_CXX11_RNG) { std::uniform_real_distribution local_u_distr; std::mt19937_64& producer = arma_rng::get_producer(); arma_rng::lock_producer(); const T a = T( local_u_distr(producer) ); const T b = T( local_u_distr(producer) ); arma_rng::unlock_producer(); return std::complex(a, b); } #else { const T a = T( arma_rng_cxx03::randu_val() ); const T b = T( arma_rng_cxx03::randu_val() ); return std::complex(a, b); } #endif } inline static void fill(std::complex* mem, const uword N) { #if defined(ARMA_RNG_ALT) { for(uword i=0; i < N; ++i) { const T a = T( arma_rng_alt::randu_val() ); const T b = T( arma_rng_alt::randu_val() ); mem[i] = std::complex(a, b); } } #elif defined(ARMA_USE_CXX11_RNG) { std::uniform_real_distribution local_u_distr; std::mt19937_64& producer = arma_rng::get_producer(); arma_rng::lock_producer(); for(uword i=0; i < N; ++i) { const T a = T( local_u_distr(producer) ); const T b = T( local_u_distr(producer) ); mem[i] = std::complex(a, b); } arma_rng::unlock_producer(); } #else { if(N == uword(1)) { const T a = T( arma_rng_cxx03::randu_val() ); const T b = T( arma_rng_cxx03::randu_val() ); mem[0] = std::complex(a, b); return; } typedef typename std::mt19937_64::result_type local_seed_type; std::mt19937_64 local_engine; std::uniform_real_distribution local_u_distr; local_engine.seed( local_seed_type(std::rand()) ); for(uword i=0; i < N; ++i) { const T a = T( local_u_distr(local_engine) ); const T b = T( local_u_distr(local_engine) ); mem[i] = std::complex(a, b); } } #endif } inline static void fill(std::complex* mem, const uword N, const double a, const double b) { #if defined(ARMA_RNG_ALT) { const double r = b - a; for(uword i=0; i < N; ++i) { const T tmp1 = T( arma_rng_alt::randu_val() * r + a ); const T tmp2 = T( arma_rng_alt::randu_val() * r + a ); mem[i] = std::complex(tmp1, tmp2); } } #elif defined(ARMA_USE_CXX11_RNG) { std::uniform_real_distribution local_u_distr(a,b); std::mt19937_64& producer = arma_rng::get_producer(); arma_rng::lock_producer(); for(uword i=0; i < N; ++i) { const T tmp1 = T( local_u_distr(producer) ); const T tmp2 = T( local_u_distr(producer) ); mem[i] = std::complex(tmp1, tmp2); } arma_rng::unlock_producer(); } #else { if(N == uword(1)) { const double r = b - a; const T tmp1 = T( arma_rng_cxx03::randu_val() * r + a); const T tmp2 = T( arma_rng_cxx03::randu_val() * r + a); mem[0] = std::complex(tmp1, tmp2); return; } typedef typename std::mt19937_64::result_type local_seed_type; std::mt19937_64 local_engine; std::uniform_real_distribution local_u_distr(a,b); local_engine.seed( local_seed_type(std::rand()) ); for(uword i=0; i < N; ++i) { const T tmp1 = T( local_u_distr(local_engine) ); const T tmp2 = T( local_u_distr(local_engine) ); mem[i] = std::complex(tmp1, tmp2); } } #endif } }; // template struct arma_rng::randn { inline operator eT () const { #if defined(ARMA_RNG_ALT) { return eT( arma_rng_alt::randn_val() ); } #elif defined(ARMA_USE_CXX11_RNG) { std::normal_distribution local_n_distr; arma_rng::lock_producer(); const eT out = eT( local_n_distr(arma_rng::get_producer()) ); arma_rng::unlock_producer(); return out; } #else { return eT( arma_rng_cxx03::randn_val() ); } #endif } inline static void dual_val(eT& out1, eT& out2) { #if defined(ARMA_RNG_ALT) { arma_rng_alt::randn_dual_val(out1, out2); } #elif defined(ARMA_USE_CXX11_RNG) { std::normal_distribution local_n_distr; std::mt19937_64& producer = arma_rng::get_producer(); arma_rng::lock_producer(); out1 = eT( local_n_distr(producer) ); out2 = eT( local_n_distr(producer) ); arma_rng::unlock_producer(); } #else { arma_rng_cxx03::randn_dual_val(out1, out2); } #endif } inline static void fill(eT* mem, const uword N) { #if defined(ARMA_RNG_ALT) { // NOTE: old method to avoid regressions in user code that assumes specific sequence uword i, j; for(i=0, j=1; j < N; i+=2, j+=2) { arma_rng_alt::randn_dual_val( mem[i], mem[j] ); } if(i < N) { mem[i] = eT( arma_rng_alt::randn_val() ); } } #elif defined(ARMA_USE_CXX11_RNG) { std::normal_distribution local_n_distr; std::mt19937_64& producer = arma_rng::get_producer(); arma_rng::lock_producer(); for(uword i=0; i < N; ++i) { mem[i] = eT( local_n_distr(producer) ); } arma_rng::unlock_producer(); } #else { if(N == uword(1)) { mem[0] = eT( arma_rng_cxx03::randn_val() ); return; } typedef typename std::mt19937_64::result_type local_seed_type; std::mt19937_64 local_engine; std::normal_distribution local_n_distr; local_engine.seed( local_seed_type(std::rand()) ); for(uword i=0; i < N; ++i) { mem[i] = eT( local_n_distr(local_engine) ); } } #endif } inline static void fill(eT* mem, const uword N, const double mu, const double sd) { #if defined(ARMA_RNG_ALT) { // NOTE: old method to avoid regressions in user code that assumes specific sequence uword i, j; for(i=0, j=1; j < N; i+=2, j+=2) { eT val_i = eT(0); eT val_j = eT(0); arma_rng_alt::randn_dual_val( val_i, val_j ); mem[i] = (val_i * sd) + mu; mem[j] = (val_j * sd) + mu; } if(i < N) { const eT val_i = eT( arma_rng_alt::randn_val() ); mem[i] = (val_i * sd) + mu; } } #elif defined(ARMA_USE_CXX11_RNG) { std::normal_distribution local_n_distr(mu, sd); std::mt19937_64& producer = arma_rng::get_producer(); arma_rng::lock_producer(); for(uword i=0; i < N; ++i) { mem[i] = eT( local_n_distr(producer) ); } arma_rng::unlock_producer(); } #else { if(N == uword(1)) { const eT val = eT( arma_rng_cxx03::randn_val() ); mem[0] = (val * sd) + mu; return; } typedef typename std::mt19937_64::result_type local_seed_type; std::mt19937_64 local_engine; std::normal_distribution local_n_distr(mu, sd); local_engine.seed( local_seed_type(std::rand()) ); for(uword i=0; i < N; ++i) { mem[i] = eT( local_n_distr(local_engine) ); } } #endif } }; template struct arma_rng::randn< std::complex > { inline operator std::complex () const { #if defined(_MSC_VER) // attempt at workaround for MSVC bug // does MS even test their so-called compilers before release? T a; T b; #else T a(0); T b(0); #endif arma_rng::randn::dual_val(a, b); return std::complex(a, b); } inline static void dual_val(std::complex& out1, std::complex& out2) { #if defined(_MSC_VER) T a; T b; #else T a(0); T b(0); #endif arma_rng::randn::dual_val(a,b); out1 = std::complex(a,b); arma_rng::randn::dual_val(a,b); out2 = std::complex(a,b); } inline static void fill(std::complex* mem, const uword N) { #if defined(ARMA_RNG_ALT) { for(uword i=0; i < N; ++i) { mem[i] = std::complex( arma_rng::randn< std::complex >() ); } } #elif defined(ARMA_USE_CXX11_RNG) { std::normal_distribution local_n_distr; std::mt19937_64& producer = arma_rng::get_producer(); arma_rng::lock_producer(); for(uword i=0; i < N; ++i) { const T a = T( local_n_distr(producer) ); const T b = T( local_n_distr(producer) ); mem[i] = std::complex(a,b); } arma_rng::unlock_producer(); } #else { if(N == uword(1)) { T a = T(0); T b = T(0); arma_rng_cxx03::randn_dual_val(a,b); mem[0] = std::complex(a,b); return; } typedef typename std::mt19937_64::result_type local_seed_type; std::mt19937_64 local_engine; std::normal_distribution local_n_distr; local_engine.seed( local_seed_type(std::rand()) ); for(uword i=0; i < N; ++i) { const T a = T( local_n_distr(local_engine) ); const T b = T( local_n_distr(local_engine) ); mem[i] = std::complex(a,b); } } #endif } inline static void fill(std::complex* mem, const uword N, const double mu, const double sd) { arma_rng::randn< std::complex >::fill(mem, N); if( (mu == double(0)) && (sd == double(1)) ) { return; } for(uword i=0; i& val = mem[i]; mem[i] = std::complex( ((val.real() * sd) + mu), ((val.imag() * sd) + mu) ); } } }; // template struct arma_rng::randg { inline static void fill(eT* mem, const uword N, const double a, const double b) { #if defined(ARMA_USE_CXX11_RNG) { std::gamma_distribution local_g_distr(a,b); std::mt19937_64& producer = arma_rng::get_producer(); arma_rng::lock_producer(); for(uword i=0; i local_g_distr(a,b); local_engine.seed( local_seed_type(arma_rng::randi()) ); for(uword i=0; i inline void glue_kron::direct_kron(Mat& out, const Mat& A, const Mat& B) { arma_debug_sigprint(); const uword A_rows = A.n_rows; const uword A_cols = A.n_cols; const uword B_rows = B.n_rows; const uword B_cols = B.n_cols; out.set_size(A_rows*B_rows, A_cols*B_cols); if(out.is_empty()) { return; } for(uword j = 0; j < A_cols; j++) { for(uword i = 0; i < A_rows; i++) { out.submat(i*B_rows, j*B_cols, (i+1)*B_rows-1, (j+1)*B_cols-1) = A.at(i,j) * B; } } } //! \brief //! different types of input matrices //! A -> complex, B -> basic element type template inline void glue_kron::direct_kron(Mat< std::complex >& out, const Mat< std::complex >& A, const Mat& B) { arma_debug_sigprint(); typedef typename std::complex eT; const uword A_rows = A.n_rows; const uword A_cols = A.n_cols; const uword B_rows = B.n_rows; const uword B_cols = B.n_cols; out.set_size(A_rows*B_rows, A_cols*B_cols); if(out.is_empty()) { return; } Mat tmp_B = conv_to< Mat >::from(B); for(uword j = 0; j < A_cols; j++) { for(uword i = 0; i < A_rows; i++) { out.submat(i*B_rows, j*B_cols, (i+1)*B_rows-1, (j+1)*B_cols-1) = A.at(i,j) * tmp_B; } } } //! \brief //! different types of input matrices //! A -> basic element type, B -> complex template inline void glue_kron::direct_kron(Mat< std::complex >& out, const Mat& A, const Mat< std::complex >& B) { arma_debug_sigprint(); const uword A_rows = A.n_rows; const uword A_cols = A.n_cols; const uword B_rows = B.n_rows; const uword B_cols = B.n_cols; out.set_size(A_rows*B_rows, A_cols*B_cols); if(out.is_empty()) { return; } for(uword j = 0; j < A_cols; j++) { for(uword i = 0; i < A_rows; i++) { out.submat(i*B_rows, j*B_cols, (i+1)*B_rows-1, (j+1)*B_cols-1) = A.at(i,j) * B; } } } //! \brief //! apply Kronecker product for two objects with same element type template inline void glue_kron::apply(Mat& out, const Glue& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const quasi_unwrap UA(X.A); const quasi_unwrap UB(X.B); if(UA.is_alias(out) || UB.is_alias(out)) { Mat tmp; glue_kron::direct_kron(tmp, UA.M, UB.M); out.steal_mem(tmp); } else { glue_kron::direct_kron(out, UA.M, UB.M); } } //! @} RcppArmadillo/inst/include/armadillo_bits/newarp_cx_attrib.hpp0000644000176200001440000000255414301267043024442 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ namespace newarp { //! Tiny functions to check attributes of complex numbers struct cx_attrib { template arma_inline static bool is_real (const std::complex& v, const T eps) { return (std::abs(v.imag()) <= eps); } template arma_inline static bool is_complex(const std::complex& v, const T eps) { return (std::abs(v.imag()) > eps); } template arma_inline static bool is_conj(const std::complex& v1, const std::complex& v2, const T eps) { return (std::abs(v1 - std::conj(v2)) <= eps); } }; } // namespace newarp RcppArmadillo/inst/include/armadillo_bits/def_fftw3.hpp0000644000176200001440000000313214603256156022757 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ #if defined(ARMA_USE_FFTW3) && !defined(FFTW3_H) // prefix for single precision: fftwf_ // prefix for double precision: fftw_ typedef void fftwf_complex; typedef void fftw_complex; typedef void_ptr fftwf_plan; typedef void_ptr fftw_plan; extern "C" { // single precision (float) fftwf_plan fftwf_plan_dft_1d(int N, fftwf_complex* input, fftwf_complex* output, int fftw3_sign, unsigned int fftw3_flags); void fftwf_execute(fftwf_plan plan); void fftwf_destroy_plan(fftwf_plan plan); void fftwf_cleanup(); // double precision (double) fftw_plan fftw_plan_dft_1d(int N, fftw_complex* input, fftw_complex* output, int fftw3_sign, unsigned int fftw3_flags); void fftw_execute(fftw_plan plan); void fftw_destroy_plan(fftw_plan plan); void fftw_cleanup(); } #endif RcppArmadillo/inst/include/armadillo_bits/op_diagvec_bones.hpp0000644000176200001440000000362614301267043024376 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_diagvec //! @{ class op_diagvec : public traits_op_col { public: template inline static void apply(Mat& out, const Op& X); template inline static void apply_proxy(Mat& out, const Proxy& P); template inline static void apply(Mat& out, const Op< Glue, op_diagvec>& X, const typename arma_not_cx::result* junk = nullptr); template inline static void apply(Mat& out, const Op< Glue, op_diagvec>& X, const typename arma_cx_only::result* junk = nullptr); }; class op_diagvec2 : public traits_op_col { public: template inline static void apply(Mat& out, const Op& X); template inline static void apply_proxy(Mat& out, const Proxy& P, const uword row_offset, const uword col_offset); }; //! @} RcppArmadillo/inst/include/armadillo_bits/translate_blas.hpp0000644000176200001440000002476114570616207024121 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ #if defined(ARMA_USE_BLAS) //! \namespace blas namespace for BLAS functions namespace blas { template inline void gemv(const char* transA, const blas_int* m, const blas_int* n, const eT* alpha, const eT* A, const blas_int* ldA, const eT* x, const blas_int* incx, const eT* beta, eT* y, const blas_int* incy) { arma_type_check((is_supported_blas_type::value == false)); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) { if( is_float::value) { typedef float T; arma_fortran(arma_sgemv)(transA, m, n, (const T*)alpha, (const T*)A, ldA, (const T*)x, incx, (const T*)beta, (T*)y, incy, 1); } else if( is_double::value) { typedef double T; arma_fortran(arma_dgemv)(transA, m, n, (const T*)alpha, (const T*)A, ldA, (const T*)x, incx, (const T*)beta, (T*)y, incy, 1); } else if( is_cx_float::value) { typedef blas_cxf T; arma_fortran(arma_cgemv)(transA, m, n, (const T*)alpha, (const T*)A, ldA, (const T*)x, incx, (const T*)beta, (T*)y, incy, 1); } else if(is_cx_double::value) { typedef blas_cxd T; arma_fortran(arma_zgemv)(transA, m, n, (const T*)alpha, (const T*)A, ldA, (const T*)x, incx, (const T*)beta, (T*)y, incy, 1); } } #else { if( is_float::value) { typedef float T; arma_fortran(arma_sgemv)(transA, m, n, (const T*)alpha, (const T*)A, ldA, (const T*)x, incx, (const T*)beta, (T*)y, incy); } else if( is_double::value) { typedef double T; arma_fortran(arma_dgemv)(transA, m, n, (const T*)alpha, (const T*)A, ldA, (const T*)x, incx, (const T*)beta, (T*)y, incy); } else if( is_cx_float::value) { typedef blas_cxf T; arma_fortran(arma_cgemv)(transA, m, n, (const T*)alpha, (const T*)A, ldA, (const T*)x, incx, (const T*)beta, (T*)y, incy); } else if(is_cx_double::value) { typedef blas_cxd T; arma_fortran(arma_zgemv)(transA, m, n, (const T*)alpha, (const T*)A, ldA, (const T*)x, incx, (const T*)beta, (T*)y, incy); } } #endif } template inline void gemm(const char* transA, const char* transB, const blas_int* m, const blas_int* n, const blas_int* k, const eT* alpha, const eT* A, const blas_int* ldA, const eT* B, const blas_int* ldB, const eT* beta, eT* C, const blas_int* ldC) { arma_type_check((is_supported_blas_type::value == false)); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) { if( is_float::value) { typedef float T; arma_fortran(arma_sgemm)(transA, transB, m, n, k, (const T*)alpha, (const T*)A, ldA, (const T*)B, ldB, (const T*)beta, (T*)C, ldC, 1, 1); } else if( is_double::value) { typedef double T; arma_fortran(arma_dgemm)(transA, transB, m, n, k, (const T*)alpha, (const T*)A, ldA, (const T*)B, ldB, (const T*)beta, (T*)C, ldC, 1, 1); } else if( is_cx_float::value) { typedef blas_cxf T; arma_fortran(arma_cgemm)(transA, transB, m, n, k, (const T*)alpha, (const T*)A, ldA, (const T*)B, ldB, (const T*)beta, (T*)C, ldC, 1, 1); } else if(is_cx_double::value) { typedef blas_cxd T; arma_fortran(arma_zgemm)(transA, transB, m, n, k, (const T*)alpha, (const T*)A, ldA, (const T*)B, ldB, (const T*)beta, (T*)C, ldC, 1, 1); } } #else { if( is_float::value) { typedef float T; arma_fortran(arma_sgemm)(transA, transB, m, n, k, (const T*)alpha, (const T*)A, ldA, (const T*)B, ldB, (const T*)beta, (T*)C, ldC); } else if( is_double::value) { typedef double T; arma_fortran(arma_dgemm)(transA, transB, m, n, k, (const T*)alpha, (const T*)A, ldA, (const T*)B, ldB, (const T*)beta, (T*)C, ldC); } else if( is_cx_float::value) { typedef blas_cxf T; arma_fortran(arma_cgemm)(transA, transB, m, n, k, (const T*)alpha, (const T*)A, ldA, (const T*)B, ldB, (const T*)beta, (T*)C, ldC); } else if(is_cx_double::value) { typedef blas_cxd T; arma_fortran(arma_zgemm)(transA, transB, m, n, k, (const T*)alpha, (const T*)A, ldA, (const T*)B, ldB, (const T*)beta, (T*)C, ldC); } } #endif } template inline void syrk(const char* uplo, const char* transA, const blas_int* n, const blas_int* k, const eT* alpha, const eT* A, const blas_int* ldA, const eT* beta, eT* C, const blas_int* ldC) { arma_type_check((is_supported_blas_type::value == false)); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) { if( is_float::value) { typedef float T; arma_fortran(arma_ssyrk)(uplo, transA, n, k, (const T*)alpha, (const T*)A, ldA, (const T*)beta, (T*)C, ldC, 1, 1); } else if(is_double::value) { typedef double T; arma_fortran(arma_dsyrk)(uplo, transA, n, k, (const T*)alpha, (const T*)A, ldA, (const T*)beta, (T*)C, ldC, 1, 1); } } #else { if( is_float::value) { typedef float T; arma_fortran(arma_ssyrk)(uplo, transA, n, k, (const T*)alpha, (const T*)A, ldA, (const T*)beta, (T*)C, ldC); } else if(is_double::value) { typedef double T; arma_fortran(arma_dsyrk)(uplo, transA, n, k, (const T*)alpha, (const T*)A, ldA, (const T*)beta, (T*)C, ldC); } } #endif } template inline void herk(const char* uplo, const char* transA, const blas_int* n, const blas_int* k, const T* alpha, const std::complex* A, const blas_int* ldA, const T* beta, std::complex* C, const blas_int* ldC) { arma_type_check((is_supported_blas_type::value == false)); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) { if( is_float::value) { typedef float TT; typedef blas_cxf cx_TT; arma_fortran(arma_cherk)(uplo, transA, n, k, (const TT*)alpha, (const cx_TT*)A, ldA, (const TT*)beta, (cx_TT*)C, ldC, 1, 1); } else if(is_double::value) { typedef double TT; typedef blas_cxd cx_TT; arma_fortran(arma_zherk)(uplo, transA, n, k, (const TT*)alpha, (const cx_TT*)A, ldA, (const TT*)beta, (cx_TT*)C, ldC, 1, 1); } } #else { if( is_float::value) { typedef float TT; typedef blas_cxf cx_TT; arma_fortran(arma_cherk)(uplo, transA, n, k, (const TT*)alpha, (const cx_TT*)A, ldA, (const TT*)beta, (cx_TT*)C, ldC); } else if(is_double::value) { typedef double TT; typedef blas_cxd cx_TT; arma_fortran(arma_zherk)(uplo, transA, n, k, (const TT*)alpha, (const cx_TT*)A, ldA, (const TT*)beta, (cx_TT*)C, ldC); } } #endif } template inline eT dot(const uword n_elem, const eT* x, const eT* y) { arma_type_check((is_supported_blas_type::value == false)); if(is_float::value) { #if defined(ARMA_BLAS_FLOAT_BUG) { if(n_elem == 0) { return eT(0); } const char trans = 'T'; const blas_int m = blas_int(n_elem); const blas_int n = 1; const blas_int inc = 1; const eT alpha = eT(1); const eT beta = eT(0); eT result[2]; // paranoia: using two elements instead of one result[0] = eT(0); result[1] = eT(0); blas::gemv(&trans, &m, &n, &alpha, x, &m, y, &inc, &beta, &result[0], &inc); return result[0]; } #else { blas_int n = blas_int(n_elem); blas_int inc = 1; typedef float T; return eT( arma_fortran(arma_sdot)(&n, (const T*)x, &inc, (const T*)y, &inc) ); } #endif } else if(is_double::value) { blas_int n = blas_int(n_elem); blas_int inc = 1; typedef double T; return eT( arma_fortran(arma_ddot)(&n, (const T*)x, &inc, (const T*)y, &inc) ); } else if( (is_cx_float::value) || (is_cx_double::value) ) { if(n_elem == 0) { return eT(0); } // using gemv() workaround due to compatibility issues with cdotu() and zdotu() const char trans = 'T'; const blas_int m = blas_int(n_elem); const blas_int n = 1; const blas_int inc = 1; const eT alpha = eT(1); const eT beta = eT(0); eT result[2]; // paranoia: using two elements instead of one result[0] = eT(0); result[1] = eT(0); blas::gemv(&trans, &m, &n, &alpha, x, &m, y, &inc, &beta, &result[0], &inc); return result[0]; } return eT(0); } template arma_inline eT asum(const uword n_elem, const eT* x) { arma_type_check((is_supported_blas_type::value == false)); if(is_float::value) { // WARNING: sasum() from Accelerate framework (macOS) may return 'double' instead of 'float' blas_int n = blas_int(n_elem); blas_int inc = 1; typedef float T; return arma_fortran(arma_sasum)(&n, (const T*)x, &inc); } else if(is_double::value) { blas_int n = blas_int(n_elem); blas_int inc = 1; typedef double T; return arma_fortran(arma_dasum)(&n, (const T*)x, &inc); } return eT(0); } template arma_inline eT nrm2(const uword n_elem, const eT* x) { arma_type_check((is_supported_blas_type::value == false)); if(is_float::value) { // WARNING: snrm2() from Accelerate framework (macOS) may return 'double' instead of 'float' blas_int n = blas_int(n_elem); blas_int inc = 1; typedef float T; return arma_fortran(arma_snrm2)(&n, (const T*)x, &inc); } else if(is_double::value) { blas_int n = blas_int(n_elem); blas_int inc = 1; typedef double T; return arma_fortran(arma_dnrm2)(&n, (const T*)x, &inc); } return eT(0); } } // namespace blas #endif RcppArmadillo/inst/include/armadillo_bits/subview_field_bones.hpp0000644000176200001440000000664314473136607025142 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup subview_field //! @{ //! Class for storing data required to construct or apply operations to a subfield //! (ie. where the subfield starts and ends as well as a reference/pointer to the original field), template class subview_field { public: typedef oT object_type; const field& f; const uword aux_row1; const uword aux_col1; const uword aux_slice1; const uword n_rows; const uword n_cols; const uword n_slices; const uword n_elem; protected: arma_inline subview_field(const field& in_f, const uword in_row1, const uword in_col1, const uword in_n_rows, const uword in_n_cols); arma_inline subview_field(const field& in_f, const uword in_row1, const uword in_col1, const uword in_slice1, const uword in_n_rows, const uword in_n_cols, const uword in_n_slices); public: inline ~subview_field(); inline subview_field() = delete; inline void operator= (const field& x); inline void operator= (const subview_field& x); arma_warn_unused arma_inline oT& operator[](const uword i); arma_warn_unused arma_inline const oT& operator[](const uword i) const; arma_warn_unused arma_inline oT& operator()(const uword i); arma_warn_unused arma_inline const oT& operator()(const uword i) const; arma_warn_unused arma_inline oT& at(const uword row, const uword col); arma_warn_unused arma_inline const oT& at(const uword row, const uword col) const; arma_warn_unused arma_inline oT& at(const uword row, const uword col, const uword slice); arma_warn_unused arma_inline const oT& at(const uword row, const uword col, const uword slice) const; arma_warn_unused arma_inline oT& operator()(const uword row, const uword col); arma_warn_unused arma_inline const oT& operator()(const uword row, const uword col) const; arma_warn_unused arma_inline oT& operator()(const uword row, const uword col, const uword slice); arma_warn_unused arma_inline const oT& operator()(const uword row, const uword col, const uword slice) const; arma_warn_unused arma_inline bool is_empty() const; inline bool check_overlap(const subview_field& x) const; inline void print(const std::string extra_text = "") const; inline void print(std::ostream& user_stream, const std::string extra_text = "") const; template inline void for_each(functor F); template inline void for_each(functor F) const; inline void fill(const oT& x); inline static void extract(field& out, const subview_field& in); friend class field; }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_sp_diagvec_meat.hpp0000644000176200001440000000332214634016465024722 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_sp_diagvec //! @{ template inline void op_sp_diagvec::apply(Mat& out, const mtSpReduceOp& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const unwrap_spmat U(in.m); const SpMat& X = U.M; const uword a = in.aux_uword_a; const uword b = in.aux_uword_b; const uword row_offset = (b > 0) ? a : 0; const uword col_offset = (b == 0) ? a : 0; arma_conform_check_bounds ( ((row_offset > 0) && (row_offset >= X.n_rows)) || ((col_offset > 0) && (col_offset >= X.n_cols)), "diagvec(): requested diagonal out of bounds" ); const uword len = (std::min)(X.n_rows - row_offset, X.n_cols - col_offset); out.set_size(len, 1); eT* out_mem = out.memptr(); for(uword i=0; i < len; ++i) { out_mem[i] = X.at(i + row_offset, i + col_offset); } } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_spsolve.hpp0000644000176200001440000001251514635324415023272 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_spsolve //! @{ template inline bool spsolve_helper ( Mat& out, const SpBase& A, const Base& B, const char* solver, const spsolve_opts_base& settings, const typename arma_blas_type_only::result* junk = nullptr ) { arma_debug_sigprint(); arma_ignore(junk); typedef typename T1::pod_type T; typedef typename T1::elem_type eT; const char sig = (solver != nullptr) ? solver[0] : char(0); arma_conform_check( ((sig != 'l') && (sig != 's')), "spsolve(): unknown solver" ); T rcond = T(0); bool status = false; superlu_opts superlu_opts_default; // if(is_float ::value) { superlu_opts_default.refine = superlu_opts::REF_SINGLE; } // if(is_double::value) { superlu_opts_default.refine = superlu_opts::REF_DOUBLE; } const superlu_opts& opts = (settings.id == 1) ? static_cast(settings) : superlu_opts_default; arma_conform_check( ( (opts.pivot_thresh < double(0)) || (opts.pivot_thresh > double(1)) ), "spsolve(): pivot_thresh must be in the [0,1] interval" ); if(sig == 's') // SuperLU solver { if( (opts.equilibrate == false) && (opts.refine == superlu_opts::REF_NONE) ) { status = sp_auxlib::spsolve_simple(out, A.get_ref(), B.get_ref(), opts); } else { status = sp_auxlib::spsolve_refine(out, rcond, A.get_ref(), B.get_ref(), opts); } } else if(sig == 'l') // brutal LAPACK solver { if( (settings.id != 0) && ((opts.symmetric) || (opts.pivot_thresh != double(1))) ) { arma_warn(1, "spsolve(): ignoring settings not applicable to LAPACK based solver"); } Mat AA; bool conversion_ok = false; try { Mat tmp(A.get_ref()); // conversion from sparse to dense can throw std::bad_alloc AA.steal_mem(tmp); conversion_ok = true; } catch(...) { arma_warn(1, "spsolve(): not enough memory to use LAPACK based solver"); } if(conversion_ok) { arma_conform_check( (AA.n_rows != AA.n_cols), "spsolve(): matrix A must be square sized" ); uword flags = solve_opts::flag_none; if(opts.refine != superlu_opts::REF_NONE) { flags |= solve_opts::flag_refine; } if(opts.equilibrate == true ) { flags |= solve_opts::flag_equilibrate; } if(opts.allow_ugly == true ) { flags |= solve_opts::flag_allow_ugly; } status = glue_solve_gen_full::apply(out, AA, B.get_ref(), flags); } } if( (status == false) && (rcond > T(0)) ) { arma_warn(2, "spsolve(): system is singular (rcond: ", rcond, ")"); } if( (status == true) && (rcond > T(0)) && (rcond < std::numeric_limits::epsilon()) ) { arma_warn(2, "solve(): solution computed, but system is singular to working precision (rcond: ", rcond, ")"); } return status; } // template inline bool spsolve ( Mat& out, const SpBase& A, const Base& B, const char* solver = "superlu", const spsolve_opts_base& settings = spsolve_opts_none(), const typename arma_blas_type_only::result* junk = nullptr ) { arma_debug_sigprint(); arma_ignore(junk); const bool status = spsolve_helper(out, A.get_ref(), B.get_ref(), solver, settings); if(status == false) { out.soft_reset(); arma_warn(3, "spsolve(): solution not found"); } return status; } template arma_warn_unused inline Mat spsolve ( const SpBase& A, const Base& B, const char* solver = "superlu", const spsolve_opts_base& settings = spsolve_opts_none(), const typename arma_blas_type_only::result* junk = nullptr ) { arma_debug_sigprint(); arma_ignore(junk); typedef typename T1::elem_type eT; Mat out; const bool status = spsolve_helper(out, A.get_ref(), B.get_ref(), solver, settings); if(status == false) { out.soft_reset(); arma_stop_runtime_error("spsolve(): solution not found"); } return out; } //! @} RcppArmadillo/inst/include/armadillo_bits/typedef_elem_check.hpp0000644000176200001440000000377214301267044024712 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup typedef_elem //! @{ namespace junk { struct arma_elem_size_test { arma_static_check( (sizeof(u8) != 1), "error: type 'u8' has unsupported size" ); arma_static_check( (sizeof(s8) != 1), "error: type 's8' has unsupported size" ); arma_static_check( (sizeof(u16) != 2), "error: type 'u16' has unsupported size" ); arma_static_check( (sizeof(s16) != 2), "error: type 's16' has unsupported size" ); arma_static_check( (sizeof(u32) != 4), "error: type 'u32' has unsupported size" ); arma_static_check( (sizeof(s32) != 4), "error: type 's32' has unsupported size" ); arma_static_check( (sizeof(u64) != 8), "error: type 'u64' has unsupported size" ); arma_static_check( (sizeof(s64) != 8), "error: type 's64' has unsupported size" ); arma_static_check( (sizeof(float) != 4), "error: type 'float' has unsupported size" ); arma_static_check( (sizeof(double) != 8), "error: type 'double' has unsupported size" ); arma_static_check( (sizeof(std::complex) != 8), "type 'std::complex' has unsupported size" ); arma_static_check( (sizeof(std::complex) != 16), "type 'std::complex' has unsupported size" ); }; } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_strans.hpp0000644000176200001440000000510114631567470023110 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_strans //! @{ template arma_warn_unused arma_inline const Op strans ( const T1& X, const typename enable_if< is_arma_type::value >::result* junk1 = nullptr, const typename arma_cx_only::result* junk2 = nullptr ) { arma_debug_sigprint(); arma_ignore(junk1); arma_ignore(junk2); return Op(X); } // NOTE: for non-complex objects, deliberately returning op_htrans instead of op_strans, // NOTE: due to currently more optimisations available when using op_htrans, especially by glue_times template arma_warn_unused arma_inline const Op strans ( const T1& X, const typename enable_if< is_arma_type::value >::result* junk1 = nullptr, const typename arma_not_cx::result* junk2 = nullptr ) { arma_debug_sigprint(); arma_ignore(junk1); arma_ignore(junk2); return Op(X); } // // handling of sparse matrices template arma_warn_unused arma_inline const SpOp strans ( const T1& X, const typename enable_if< is_arma_sparse_type::value >::result* junk1 = nullptr, const typename arma_cx_only::result* junk2 = nullptr ) { arma_debug_sigprint(); arma_ignore(junk1); arma_ignore(junk2); return SpOp(X); } template arma_warn_unused arma_inline const SpOp strans ( const T1& X, const typename enable_if< is_arma_sparse_type::value >::result* junk1 = nullptr, const typename arma_not_cx::result* junk2 = nullptr ) { arma_debug_sigprint(); arma_ignore(junk1); arma_ignore(junk2); return SpOp(X); } //! @} RcppArmadillo/inst/include/armadillo_bits/glue_trapz_bones.hpp0000644000176200001440000000313514301267043024445 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup glue_trapz //! @{ class glue_trapz { public: template struct traits { static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = true; }; template inline static void apply(Mat& out, const Glue& in); template inline static void apply_noalias(Mat& out, const Mat& X, const Mat& Y, const uword dim); }; class op_trapz : public traits_op_xvec { public: template inline static void apply(Mat& out, const Op& in); template inline static void apply_noalias(Mat& out, const Mat& Y, const uword dim); }; //! @} RcppArmadillo/inst/include/armadillo_bits/fn_vectorise.hpp0000644000176200001440000000450714631567470023612 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_vectorise //! @{ template arma_warn_unused inline typename enable_if2 < is_arma_type::value, const Op >::result vectorise(const T1& X) { arma_debug_sigprint(); return Op(X); } template arma_warn_unused inline typename enable_if2 < is_arma_type::value, const Op >::result vectorise(const T1& X, const uword dim) { arma_debug_sigprint(); arma_conform_check( (dim > 1), "vectorise(): parameter 'dim' must be 0 or 1" ); return Op(X, dim, 0); } template arma_warn_unused inline CubeToMatOp vectorise(const BaseCube& X) { arma_debug_sigprint(); return CubeToMatOp(X.get_ref()); } //! Vectorization for sparse objects. template arma_warn_unused inline typename enable_if2 < is_arma_sparse_type::value, const SpOp >::result vectorise(const T1& X) { arma_debug_sigprint(); return SpOp(X); } //! Vectorization for sparse objects. template arma_warn_unused inline typename enable_if2 < is_arma_sparse_type::value, const SpOp >::result vectorise(const T1& X, const uword dim) { arma_debug_sigprint(); arma_conform_check( (dim > 1), "vectorise(): parameter 'dim' must be 0 or 1" ); return SpOp(X, dim, 0); } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_randi.hpp0000644000176200001440000001307614631567470022705 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_randi //! @{ template arma_warn_unused inline obj_type randi(const uword n_rows, const uword n_cols, const distr_param& param = distr_param(), const typename arma_Mat_Col_Row_only::result* junk = nullptr) { arma_debug_sigprint(); arma_ignore(junk); typedef typename obj_type::elem_type eT; if(is_Col::value) { arma_conform_check( (n_cols != 1), "randi(): incompatible size" ); } else if(is_Row::value) { arma_conform_check( (n_rows != 1), "randi(): incompatible size" ); } int a = 0; int b = arma_rng::randi::max_val(); param.get_int_vals(a,b); arma_conform_check( (a > b), "randi(): incorrect distribution parameters; a must be less than b" ); obj_type out(n_rows, n_cols, arma_nozeros_indicator()); arma_rng::randi::fill(out.memptr(), out.n_elem, a, b); return out; } template arma_warn_unused inline obj_type randi(const SizeMat& s, const distr_param& param = distr_param(), const typename arma_Mat_Col_Row_only::result* junk = nullptr) { arma_debug_sigprint(); arma_ignore(junk); return randi(s.n_rows, s.n_cols, param); } template arma_warn_unused inline obj_type randi(const uword n_elem, const distr_param& param = distr_param(), const arma_empty_class junk1 = arma_empty_class(), const typename arma_Mat_Col_Row_only::result* junk2 = nullptr) { arma_debug_sigprint(); arma_ignore(junk1); arma_ignore(junk2); if(is_Row::value) { return randi(1, n_elem, param); } else { return randi(n_elem, 1, param); } } arma_warn_unused inline imat randi(const uword n_rows, const uword n_cols, const distr_param& param = distr_param()) { arma_debug_sigprint(); return randi(n_rows, n_cols, param); } arma_warn_unused inline imat randi(const SizeMat& s, const distr_param& param = distr_param()) { arma_debug_sigprint(); return randi(s.n_rows, s.n_cols, param); } arma_warn_unused inline ivec randi(const uword n_elem, const distr_param& param = distr_param()) { arma_debug_sigprint(); return randi(n_elem, uword(1), param); } arma_warn_unused inline sword randi(const distr_param& param) { arma_debug_sigprint(); int a = 0; int b = arma_rng::randi::max_val(); param.get_int_vals(a,b); arma_conform_check( (a > b), "randi(): incorrect distribution parameters; a must be less than b" ); sword out_val = sword(0); arma_rng::randi::fill(&out_val, uword(1), a, b); return out_val; } template arma_warn_unused inline typename arma_scalar_only::result randi(const distr_param& param) { arma_debug_sigprint(); int a = 0; int b = arma_rng::randi::max_val(); param.get_int_vals(a,b); arma_conform_check( (a > b), "randi(): incorrect distribution parameters; a must be less than b" ); eT out_val = eT(0); arma_rng::randi::fill(&out_val, uword(1), a, b); return out_val; } arma_warn_unused inline sword randi() { arma_debug_sigprint(); return sword( arma_rng::randi() ); } template arma_warn_unused inline typename arma_scalar_only::result randi() { arma_debug_sigprint(); return eT( arma_rng::randi() ); } template arma_warn_unused inline cube_type randi(const uword n_rows, const uword n_cols, const uword n_slices, const distr_param& param = distr_param(), const typename arma_Cube_only::result* junk = nullptr) { arma_debug_sigprint(); arma_ignore(junk); typedef typename cube_type::elem_type eT; int a = 0; int b = arma_rng::randi::max_val(); param.get_int_vals(a,b); arma_conform_check( (a > b), "randi(): incorrect distribution parameters; a must be less than b" ); cube_type out(n_rows, n_cols, n_slices, arma_nozeros_indicator()); arma_rng::randi::fill(out.memptr(), out.n_elem, a, b); return out; } template arma_warn_unused inline cube_type randi(const SizeCube& s, const distr_param& param = distr_param(), const typename arma_Cube_only::result* junk = nullptr) { arma_debug_sigprint(); arma_ignore(junk); return randi(s.n_rows, s.n_cols, s.n_slices, param); } arma_warn_unused inline icube randi(const uword n_rows, const uword n_cols, const uword n_slices, const distr_param& param = distr_param()) { arma_debug_sigprint(); return randi(n_rows, n_cols, n_slices, param); } arma_warn_unused inline icube randi(const SizeCube& s, const distr_param& param = distr_param()) { arma_debug_sigprint(); return randi(s.n_rows, s.n_cols, s.n_slices, param); } //! @} RcppArmadillo/inst/include/armadillo_bits/SpBase_meat.hpp0000644000176200001440000004464515030507611023277 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup SpBase //! @{ template arma_inline const derived& SpBase::get_ref() const { return static_cast(*this); } template arma_inline bool SpBase::is_alias(const SpMat& X) const { return (*this).get_ref().is_alias(X); } template inline const SpOp SpBase::t() const { return SpOp( (*this).get_ref() ); } template inline const SpOp SpBase::ht() const { return SpOp( (*this).get_ref() ); } template inline const SpOp SpBase::st() const { return SpOp( (*this).get_ref() ); } template inline void SpBase::print(const std::string extra_text) const { arma_debug_sigprint(); const unwrap_spmat tmp( (*this).get_ref() ); if(extra_text.length() != 0) { const std::streamsize orig_width = get_cout_stream().width(); get_cout_stream() << extra_text << '\n'; get_cout_stream().width(orig_width); } arma_ostream::print(get_cout_stream(), tmp.M, true); } template inline void SpBase::print(std::ostream& user_stream, const std::string extra_text) const { arma_debug_sigprint(); const unwrap_spmat tmp( (*this).get_ref() ); if(extra_text.length() != 0) { const std::streamsize orig_width = user_stream.width(); user_stream << extra_text << '\n'; user_stream.width(orig_width); } arma_ostream::print(user_stream, tmp.M, true); } template inline void SpBase::raw_print(const std::string extra_text) const { arma_debug_sigprint(); const unwrap_spmat tmp( (*this).get_ref() ); if(extra_text.length() != 0) { const std::streamsize orig_width = get_cout_stream().width(); get_cout_stream() << extra_text << '\n'; get_cout_stream().width(orig_width); } arma_ostream::print(get_cout_stream(), tmp.M, false); } template inline void SpBase::raw_print(std::ostream& user_stream, const std::string extra_text) const { arma_debug_sigprint(); const unwrap_spmat tmp( (*this).get_ref() ); if(extra_text.length() != 0) { const std::streamsize orig_width = user_stream.width(); user_stream << extra_text << '\n'; user_stream.width(orig_width); } arma_ostream::print(user_stream, tmp.M, false); } template inline void SpBase::print_dense(const std::string extra_text) const { arma_debug_sigprint(); const unwrap_spmat tmp( (*this).get_ref() ); if(extra_text.length() != 0) { const std::streamsize orig_width = get_cout_stream().width(); get_cout_stream() << extra_text << '\n'; get_cout_stream().width(orig_width); } arma_ostream::print_dense(get_cout_stream(), tmp.M, true); } template inline void SpBase::print_dense(std::ostream& user_stream, const std::string extra_text) const { arma_debug_sigprint(); const unwrap_spmat tmp( (*this).get_ref() ); if(extra_text.length() != 0) { const std::streamsize orig_width = user_stream.width(); user_stream << extra_text << '\n'; user_stream.width(orig_width); } arma_ostream::print_dense(user_stream, tmp.M, true); } template inline void SpBase::raw_print_dense(const std::string extra_text) const { arma_debug_sigprint(); const unwrap_spmat tmp( (*this).get_ref() ); if(extra_text.length() != 0) { const std::streamsize orig_width = get_cout_stream().width(); get_cout_stream() << extra_text << '\n'; get_cout_stream().width(orig_width); } arma_ostream::print_dense(get_cout_stream(), tmp.M, false); } template inline void SpBase::raw_print_dense(std::ostream& user_stream, const std::string extra_text) const { arma_debug_sigprint(); const unwrap_spmat tmp( (*this).get_ref() ); if(extra_text.length() != 0) { const std::streamsize orig_width = user_stream.width(); user_stream << extra_text << '\n'; user_stream.width(orig_width); } arma_ostream::print_dense(user_stream, tmp.M, false); } template inline void SpBase::brief_print(const std::string extra_text) const { arma_debug_sigprint(); const unwrap_spmat tmp( (*this).get_ref() ); if(extra_text.length() != 0) { const std::streamsize orig_width = get_cout_stream().width(); get_cout_stream() << extra_text << '\n'; get_cout_stream().width(orig_width); } arma_ostream::brief_print(get_cout_stream(), tmp.M); } template inline void SpBase::brief_print(std::ostream& user_stream, const std::string extra_text) const { arma_debug_sigprint(); const unwrap_spmat tmp( (*this).get_ref() ); if(extra_text.length() != 0) { const std::streamsize orig_width = user_stream.width(); user_stream << extra_text << '\n'; user_stream.width(orig_width); } arma_ostream::brief_print(user_stream, tmp.M); } // // extra functions defined in SpBase_eval_SpMat template inline const derived& SpBase_eval_SpMat::eval() const { arma_debug_sigprint(); return static_cast(*this); } // // extra functions defined in SpBase_eval_expr template inline SpMat SpBase_eval_expr::eval() const { arma_debug_sigprint(); return SpMat( static_cast(*this) ); } template inline elem_type SpBase::min() const { return op_sp_min::min( (*this).get_ref() ); } template inline elem_type SpBase::max() const { return op_sp_max::max( (*this).get_ref() ); } template inline elem_type SpBase::min(uword& index_of_min_val) const { const SpProxy P( (*this).get_ref() ); return op_sp_min::min_with_index(P, index_of_min_val); } template inline elem_type SpBase::max(uword& index_of_max_val) const { const SpProxy P( (*this).get_ref() ); return op_sp_max::max_with_index(P, index_of_max_val); } template inline elem_type SpBase::min(uword& row_of_min_val, uword& col_of_min_val) const { const SpProxy P( (*this).get_ref() ); uword index = 0; const elem_type val = op_sp_min::min_with_index(P, index); const uword local_n_rows = P.get_n_rows(); row_of_min_val = index % local_n_rows; col_of_min_val = index / local_n_rows; return val; } template inline elem_type SpBase::max(uword& row_of_max_val, uword& col_of_max_val) const { const SpProxy P( (*this).get_ref() ); uword index = 0; const elem_type val = op_sp_max::max_with_index(P, index); const uword local_n_rows = P.get_n_rows(); row_of_max_val = index % local_n_rows; col_of_max_val = index / local_n_rows; return val; } template inline uword SpBase::index_min() const { const SpProxy P( (*this).get_ref() ); uword index = 0; if(P.get_n_elem() == 0) { arma_conform_check(true, "index_min(): object has no elements"); } else { op_sp_min::min_with_index(P, index); } return index; } template inline uword SpBase::index_max() const { const SpProxy P( (*this).get_ref() ); uword index = 0; if(P.get_n_elem() == 0) { arma_conform_check(true, "index_max(): object has no elements"); } else { op_sp_max::max_with_index(P, index); } return index; } template inline bool SpBase::is_symmetric() const { arma_debug_sigprint(); const unwrap_spmat tmp( (*this).get_ref() ); return tmp.M.is_symmetric(); } template inline bool SpBase::is_symmetric(const typename get_pod_type::result tol) const { arma_debug_sigprint(); const unwrap_spmat tmp( (*this).get_ref() ); return tmp.M.is_symmetric(tol); } template inline bool SpBase::is_hermitian() const { arma_debug_sigprint(); const unwrap_spmat tmp( (*this).get_ref() ); return tmp.M.is_hermitian(); } template inline bool SpBase::is_hermitian(const typename get_pod_type::result tol) const { arma_debug_sigprint(); const unwrap_spmat tmp( (*this).get_ref() ); return tmp.M.is_hermitian(tol); } template inline bool SpBase::is_zero(const typename get_pod_type::result tol) const { arma_debug_sigprint(); typedef typename get_pod_type::result T; arma_conform_check( (tol < T(0)), "is_zero(): parameter 'tol' must be >= 0" ); const SpProxy P( (*this).get_ref() ); if(P.get_n_elem() == 0) { return false; } if(P.get_n_nonzero() == 0) { return true; } if(is_SpMat::stored_type>::value) { const unwrap_spmat::stored_type> U(P.Q); return arrayops::is_zero(U.M.values, U.M.n_nonzero, tol); } typename SpProxy::const_iterator_type it = P.begin(); typename SpProxy::const_iterator_type it_end = P.end(); if(is_cx::yes) { while(it != it_end) { const elem_type val = (*it); const T val_real = access::tmp_real(val); const T val_imag = access::tmp_imag(val); if(eop_aux::arma_abs(val_real) > tol) { return false; } if(eop_aux::arma_abs(val_imag) > tol) { return false; } ++it; } } else // not complex { while(it != it_end) { if(eop_aux::arma_abs(*it) > tol) { return false; } ++it; } } return true; } template inline bool SpBase::is_trimatu() const { arma_debug_sigprint(); const SpProxy P( (*this).get_ref() ); if(P.get_n_rows() != P.get_n_cols()) { return false; } typename SpProxy::const_iterator_type it = P.begin(); typename SpProxy::const_iterator_type it_end = P.end(); while(it != it_end) { if(it.row() > it.col()) { return false; } ++it; } return true; } template inline bool SpBase::is_trimatl() const { arma_debug_sigprint(); const SpProxy P( (*this).get_ref() ); if(P.get_n_rows() != P.get_n_cols()) { return false; } typename SpProxy::const_iterator_type it = P.begin(); typename SpProxy::const_iterator_type it_end = P.end(); while(it != it_end) { if(it.row() < it.col()) { return false; } ++it; } return true; } template inline bool SpBase::is_diagmat() const { arma_debug_sigprint(); const SpProxy P( (*this).get_ref() ); typename SpProxy::const_iterator_type it = P.begin(); typename SpProxy::const_iterator_type it_end = P.end(); while(it != it_end) { if(it.row() != it.col()) { return false; } ++it; } return true; } template inline bool SpBase::is_empty() const { arma_debug_sigprint(); const SpProxy P( (*this).get_ref() ); return (P.get_n_elem() == uword(0)); } template inline bool SpBase::is_square() const { arma_debug_sigprint(); const SpProxy P( (*this).get_ref() ); return (P.get_n_rows() == P.get_n_cols()); } template inline bool SpBase::is_vec() const { arma_debug_sigprint(); if( (SpProxy::is_row) || (SpProxy::is_col) || (SpProxy::is_xvec) ) { return true; } const SpProxy P( (*this).get_ref() ); return ( (P.get_n_rows() == uword(1)) || (P.get_n_cols() == uword(1)) ); } template inline bool SpBase::is_colvec() const { arma_debug_sigprint(); if(SpProxy::is_col) { return true; } const SpProxy P( (*this).get_ref() ); return (P.get_n_cols() == uword(1)); } template inline bool SpBase::is_rowvec() const { arma_debug_sigprint(); if(SpProxy::is_row) { return true; } const SpProxy P( (*this).get_ref() ); return (P.get_n_rows() == uword(1)); } template inline bool SpBase::is_finite() const { arma_debug_sigprint(); if(arma_config::fast_math_warn) { arma_warn(1, "is_finite(): detection of non-finite values is not reliable in fast math mode"); } if(is_SpMat::stored_type>::value) { const unwrap_spmat U( (*this).get_ref() ); return U.M.internal_is_finite(); } else { const SpProxy P( (*this).get_ref() ); typename SpProxy::const_iterator_type it = P.begin(); typename SpProxy::const_iterator_type it_end = P.end(); while(it != it_end) { if(arma_isnonfinite(*it)) { return false; } ++it; } } return true; } template inline bool SpBase::has_inf() const { arma_debug_sigprint(); if(arma_config::fast_math_warn) { arma_warn(1, "has_inf(): detection of non-finite values is not reliable in fast math mode"); } if(is_SpMat::stored_type>::value) { const unwrap_spmat U( (*this).get_ref() ); return U.M.internal_has_inf(); } else { const SpProxy P( (*this).get_ref() ); typename SpProxy::const_iterator_type it = P.begin(); typename SpProxy::const_iterator_type it_end = P.end(); while(it != it_end) { if(arma_isinf(*it)) { return true; } ++it; } } return false; } template inline bool SpBase::has_nan() const { arma_debug_sigprint(); if(arma_config::fast_math_warn) { arma_warn(1, "has_nan(): detection of non-finite values is not reliable in fast math mode"); } if(is_SpMat::stored_type>::value) { const unwrap_spmat U( (*this).get_ref() ); return U.M.internal_has_nan(); } else { const SpProxy P( (*this).get_ref() ); typename SpProxy::const_iterator_type it = P.begin(); typename SpProxy::const_iterator_type it_end = P.end(); while(it != it_end) { if(arma_isnan(*it)) { return true; } ++it; } } return false; } template inline bool SpBase::has_nonfinite() const { arma_debug_sigprint(); if(arma_config::fast_math_warn) { arma_warn(1, "has_nonfinite(): detection of non-finite values is not reliable in fast math mode"); } if(is_SpMat::stored_type>::value) { const unwrap_spmat U( (*this).get_ref() ); return U.M.internal_has_nonfinite(); } else { const SpProxy P( (*this).get_ref() ); typename SpProxy::const_iterator_type it = P.begin(); typename SpProxy::const_iterator_type it_end = P.end(); while(it != it_end) { if(arma_isnonfinite(*it)) { return true; } ++it; } } return false; } template inline const SpOp SpBase::as_col() const { return SpOp( (*this).get_ref() ); } template inline const SpOp SpBase::as_row() const { return SpOp( (*this).get_ref() ); } template inline const SpToDOp SpBase::as_dense() const { return SpToDOp( (*this).get_ref() ); } //! @} RcppArmadillo/inst/include/armadillo_bits/op_resize_meat.hpp0000644000176200001440000001155614752446051024126 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_resize //! @{ template inline void op_resize::apply(Mat& out, const Op& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword new_n_rows = in.aux_uword_a; const uword new_n_cols = in.aux_uword_b; if(is_Mat::value) { const unwrap U(in.m); const Mat& A = U.M; if(&out == &A) { op_resize::apply_mat_inplace(out, new_n_rows, new_n_cols); } else { op_resize::apply_mat_noalias(out, A, new_n_rows, new_n_cols); } } else { const quasi_unwrap U(in.m); if(U.is_alias(out)) { Mat tmp; op_resize::apply_mat_noalias(tmp, U.M, new_n_rows, new_n_cols); out.steal_mem(tmp); } else { op_resize::apply_mat_noalias(out, U.M, new_n_rows, new_n_cols); } } } template inline void op_resize::apply_mat_inplace(Mat& A, const uword new_n_rows, const uword new_n_cols) { arma_debug_sigprint(); if( (A.n_rows == new_n_rows) && (A.n_cols == new_n_cols) ) { return; } arma_conform_check( (A.vec_state == 1) && (new_n_cols != 1), "resize(): requested size is not compatible with column vector layout" ); arma_conform_check( (A.vec_state == 2) && (new_n_rows != 1), "resize(): requested size is not compatible with row vector layout" ); if(A.is_empty()) { A.zeros(new_n_rows, new_n_cols); return; } Mat B(new_n_rows, new_n_cols, arma_nozeros_indicator()); op_resize::apply_mat_noalias(B, A, new_n_rows, new_n_cols); A.steal_mem(B); } template inline void op_resize::apply_mat_noalias(Mat& out, const Mat& A, const uword new_n_rows, const uword new_n_cols) { arma_debug_sigprint(); out.set_size(new_n_rows, new_n_cols); if( (new_n_rows > A.n_rows) || (new_n_cols > A.n_cols) ) { out.zeros(); } if( (out.n_elem > 0) && (A.n_elem > 0) ) { const uword end_row = (std::min)(new_n_rows, A.n_rows) - 1; const uword end_col = (std::min)(new_n_cols, A.n_cols) - 1; out.submat(0, 0, end_row, end_col) = A.submat(0, 0, end_row, end_col); } } // template inline void op_resize::apply(Cube& out, const OpCube& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword new_n_rows = in.aux_uword_a; const uword new_n_cols = in.aux_uword_b; const uword new_n_slices = in.aux_uword_c; const unwrap_cube tmp(in.m); const Cube& A = tmp.M; if(&out == &A) { op_resize::apply_cube_inplace(out, new_n_rows, new_n_cols, new_n_slices); } else { op_resize::apply_cube_noalias(out, A, new_n_rows, new_n_cols, new_n_slices); } } template inline void op_resize::apply_cube_inplace(Cube& A, const uword new_n_rows, const uword new_n_cols, const uword new_n_slices) { arma_debug_sigprint(); if( (A.n_rows == new_n_rows) && (A.n_cols == new_n_cols) && (A.n_slices == new_n_slices) ) { return; } if(A.is_empty()) { A.zeros(new_n_rows, new_n_cols, new_n_slices); return; } Cube B(new_n_rows, new_n_cols, new_n_slices, arma_nozeros_indicator()); op_resize::apply_cube_noalias(B, A, new_n_rows, new_n_cols, new_n_slices); A.steal_mem(B); } template inline void op_resize::apply_cube_noalias(Cube& out, const Cube& A, const uword new_n_rows, const uword new_n_cols, const uword new_n_slices) { arma_debug_sigprint(); out.set_size(new_n_rows, new_n_cols, new_n_slices); if( (new_n_rows > A.n_rows) || (new_n_cols > A.n_cols) || (new_n_slices > A.n_slices) ) { out.zeros(); } if( (out.n_elem > 0) && (A.n_elem > 0) ) { const uword end_row = (std::min)(new_n_rows, A.n_rows) - 1; const uword end_col = (std::min)(new_n_cols, A.n_cols) - 1; const uword end_slice = (std::min)(new_n_slices, A.n_slices) - 1; out.subcube(0, 0, 0, end_row, end_col, end_slice) = A.subcube(0, 0, 0, end_row, end_col, end_slice); } } //! @} RcppArmadillo/inst/include/armadillo_bits/op_prod_bones.hpp0000644000176200001440000000244414301267043023735 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_prod //! @{ class op_prod : public traits_op_xvec { public: template inline static void apply_noalias(Mat& out, const Mat& X, const uword dim); template inline static void apply(Mat& out, const Op& in); template inline static eT prod(const subview& S); template inline static typename T1::elem_type prod(const Base& X); }; //! @} RcppArmadillo/inst/include/armadillo_bits/unwrap.hpp0000644000176200001440000015742714752446051022445 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup unwrap //! @{ // TODO: document the conditions and restrictions for the use of each unwrap variant: // TODO: unwrap, unwrap_check, quasi_unwrap, partial_unwrap template struct unwrap_default { typedef typename T1::elem_type eT; typedef Mat stored_type; inline unwrap_default(const T1& A) : M(A) { arma_debug_sigprint(); } const Mat M; }; template struct unwrap_fixed { typedef T1 stored_type; inline explicit unwrap_fixed(const T1& A) : M(A) { arma_debug_sigprint(); } const T1& M; }; template struct unwrap_redirect {}; template struct unwrap_redirect { typedef unwrap_default result; }; template struct unwrap_redirect { typedef unwrap_fixed result; }; template struct unwrap : public unwrap_redirect::value>::result { inline unwrap(const T1& A) : unwrap_redirect::value>::result(A) { } }; template struct unwrap< Mat > { typedef Mat stored_type; inline unwrap(const Mat& A) : M(A) { arma_debug_sigprint(); } const Mat& M; }; template struct unwrap< Row > { typedef Row stored_type; inline unwrap(const Row& A) : M(A) { arma_debug_sigprint(); } const Row& M; }; template struct unwrap< Col > { typedef Col stored_type; inline unwrap(const Col& A) : M(A) { arma_debug_sigprint(); } const Col& M; }; template struct unwrap< subview_col > { typedef Col stored_type; inline unwrap(const subview_col& A) : M(A.colmem, A.n_rows) { arma_debug_sigprint(); } const Col M; }; template struct unwrap< subview_cols > { typedef Mat stored_type; inline unwrap(const subview_cols& A) : M(A.colptr(0), A.n_rows, A.n_cols) { arma_debug_sigprint(); } const Mat M; }; template struct unwrap< mtGlue > { typedef Mat stored_type; inline unwrap(const mtGlue& A) : M(A) { arma_debug_sigprint(); } const Mat M; }; template struct unwrap< mtOp > { typedef Mat stored_type; inline unwrap(const mtOp& A) : M(A) { arma_debug_sigprint(); } const Mat M; }; // // // template struct quasi_unwrap_default { typedef typename T1::elem_type eT; inline quasi_unwrap_default(const T1& A) : M(A) { arma_debug_sigprint(); } // NOTE: DO NOT DIRECTLY CHECK FOR ALIASING BY TAKING THE ADDRESS OF THE "M" OBJECT IN ANY quasi_unwrap CLASS !!! Mat M; static constexpr bool is_const = false; static constexpr bool has_subview = false; static constexpr bool has_orig_mem = false; template constexpr bool is_alias(const Mat&) const { return false; } }; template struct quasi_unwrap_fixed { typedef typename T1::elem_type eT; inline explicit quasi_unwrap_fixed(const T1& A) : M(A) { arma_debug_sigprint(); } const T1& M; static constexpr bool is_const = true; static constexpr bool has_subview = false; static constexpr bool has_orig_mem = true; template arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&M) == void_ptr(&X)); } }; template struct quasi_unwrap_redirect {}; template struct quasi_unwrap_redirect { typedef quasi_unwrap_default result; }; template struct quasi_unwrap_redirect { typedef quasi_unwrap_fixed result; }; template struct quasi_unwrap : public quasi_unwrap_redirect::value>::result { typedef typename quasi_unwrap_redirect::value>::result quasi_unwrap_extra; inline quasi_unwrap(const T1& A) : quasi_unwrap_extra(A) { } static constexpr bool is_const = quasi_unwrap_extra::is_const; static constexpr bool has_subview = quasi_unwrap_extra::has_subview; static constexpr bool has_orig_mem = quasi_unwrap_extra::has_orig_mem; using quasi_unwrap_extra::M; using quasi_unwrap_extra::is_alias; }; template struct quasi_unwrap< Mat > { inline quasi_unwrap(const Mat& A) : M(A) { arma_debug_sigprint(); } const Mat& M; static constexpr bool is_const = true; static constexpr bool has_subview = false; static constexpr bool has_orig_mem = true; template arma_inline bool is_alias(const Mat& X) const { return (is_same_type::yes) && (void_ptr(&M) == void_ptr(&X)); } }; template struct quasi_unwrap< Row > { inline quasi_unwrap(const Row& A) : M(A) { arma_debug_sigprint(); } const Row& M; static constexpr bool is_const = true; static constexpr bool has_subview = false; static constexpr bool has_orig_mem = true; template arma_inline bool is_alias(const Mat& X) const { return (is_same_type::yes) && (void_ptr(&M) == void_ptr(&X)); } }; template struct quasi_unwrap< Col > { inline quasi_unwrap(const Col& A) : M(A) { arma_debug_sigprint(); } const Col& M; static constexpr bool is_const = true; static constexpr bool has_subview = false; static constexpr bool has_orig_mem = true; template arma_inline bool is_alias(const Mat& X) const { return (is_same_type::yes) && (void_ptr(&M) == void_ptr(&X)); } }; template struct quasi_unwrap< subview > { inline quasi_unwrap(const subview& A) : sv( A ) , M ( A, ((A.aux_row1 == 0) && (A.n_rows == A.m.n_rows)) ) // reuse memory if the subview is a contiguous chunk { arma_debug_sigprint(); } const subview& sv; const Mat M; static constexpr bool is_const = true; static constexpr bool has_subview = true; static constexpr bool has_orig_mem = false; // NOTE: set to false as this is the general case; original memory is only used when the subview is a contiguous chunk template arma_inline bool is_alias(const Mat& X) const { return (is_same_type::yes) && ( ((sv.aux_row1 == 0) && (sv.n_rows == sv.m.n_rows)) ? (void_ptr(&(sv.m)) == void_ptr(&X)) : false ); } }; template struct quasi_unwrap< subview_row > { inline quasi_unwrap(const subview_row& A) : M(A) { arma_debug_sigprint(); } Row M; static constexpr bool is_const = false; static constexpr bool has_subview = false; static constexpr bool has_orig_mem = false; template constexpr bool is_alias(const Mat&) const { return false; } }; template struct quasi_unwrap< subview_col > { inline quasi_unwrap(const subview_col& A) : orig( A.m ) , M ( const_cast( A.colmem ), A.n_rows, false, false ) { arma_debug_sigprint(); } const Mat& orig; const Col M; static constexpr bool is_const = true; static constexpr bool has_subview = true; static constexpr bool has_orig_mem = true; template arma_inline bool is_alias(const Mat& X) const { return (is_same_type::yes) && (void_ptr(&orig) == void_ptr(&X)); } }; template struct quasi_unwrap< subview_cols > { inline quasi_unwrap(const subview_cols& A) : orig( A.m ) , M ( const_cast( A.colptr(0) ), A.n_rows, A.n_cols, false, false ) { arma_debug_sigprint(); } const Mat& orig; const Mat M; static constexpr bool is_const = true; static constexpr bool has_subview = true; static constexpr bool has_orig_mem = true; template arma_inline bool is_alias(const Mat& X) const { return (is_same_type::yes) && (void_ptr(&orig) == void_ptr(&X)); } }; template struct quasi_unwrap< mtGlue > { inline quasi_unwrap(const mtGlue& A) : M(A) { arma_debug_sigprint(); } Mat M; static constexpr bool is_const = false; static constexpr bool has_subview = false; static constexpr bool has_orig_mem = false; template constexpr bool is_alias(const Mat&) const { return false; } }; template struct quasi_unwrap< mtOp > { inline quasi_unwrap(const mtOp& A) : M(A) { arma_debug_sigprint(); } Mat M; static constexpr bool is_const = false; static constexpr bool has_subview = false; static constexpr bool has_orig_mem = false; template constexpr bool is_alias(const Mat&) const { return false; } }; template struct quasi_unwrap< Op > { typedef typename T1::elem_type eT; inline quasi_unwrap(const Op& A) : U( A.m ) , M( const_cast(U.M.memptr()), U.M.n_elem, 1, false, false ) { arma_debug_sigprint(); } const quasi_unwrap U; const Mat M; static constexpr bool is_const = true; static constexpr bool has_subview = true; static constexpr bool has_orig_mem = true; template arma_inline bool is_alias(const Mat& X) const { return U.is_alias(X); } }; template struct quasi_unwrap< Op, op_strans> > { inline quasi_unwrap(const Op, op_strans>& A) : orig(A.m) , M (const_cast(A.m.memptr()), A.m.n_elem, false, false) { arma_debug_sigprint(); } const Col& orig; const Row M; static constexpr bool is_const = true; static constexpr bool has_subview = true; static constexpr bool has_orig_mem = true; template arma_inline bool is_alias(const Mat& X) const { return (is_same_type::yes) && (void_ptr(&orig) == void_ptr(&X)); } }; template struct quasi_unwrap< Op, op_strans> > { inline quasi_unwrap(const Op, op_strans>& A) : orig(A.m) , M (const_cast(A.m.memptr()), A.m.n_elem, false, false) { arma_debug_sigprint(); } const Row& orig; const Col M; static constexpr bool is_const = true; static constexpr bool has_subview = true; static constexpr bool has_orig_mem = true; template arma_inline bool is_alias(const Mat& X) const { return (is_same_type::yes) && (void_ptr(&orig) == void_ptr(&X)); } }; template struct quasi_unwrap< Op, op_strans> > { inline quasi_unwrap(const Op, op_strans>& A) : orig( A.m.m ) , M ( const_cast( A.m.colmem ), A.m.n_rows, false, false ) { arma_debug_sigprint(); } const Mat& orig; const Row M; static constexpr bool is_const = true; static constexpr bool has_subview = true; static constexpr bool has_orig_mem = true; template arma_inline bool is_alias(const Mat& X) const { return (is_same_type::yes) && (void_ptr(&X) == void_ptr(&orig)); } }; template struct quasi_unwrap_Col_htrans { inline quasi_unwrap_Col_htrans(const T1&) {} }; template struct quasi_unwrap_Col_htrans< Op, op_htrans> > { inline quasi_unwrap_Col_htrans(const Op, op_htrans>& A) : orig(A.m) , M (const_cast(A.m.memptr()), A.m.n_elem, false, false) { arma_debug_sigprint(); } const Col& orig; const Row M; static constexpr bool is_const = true; static constexpr bool has_subview = true; static constexpr bool has_orig_mem = true; template arma_inline bool is_alias(const Mat& X) const { return (is_same_type::yes) && (void_ptr(&orig) == void_ptr(&X)); } }; template struct quasi_unwrap_Col_htrans_redirect {}; template struct quasi_unwrap_Col_htrans_redirect { typedef quasi_unwrap_default result; }; template struct quasi_unwrap_Col_htrans_redirect { typedef quasi_unwrap_Col_htrans result; }; template struct quasi_unwrap< Op, op_htrans> > : public quasi_unwrap_Col_htrans_redirect< Op, op_htrans>, is_cx::value >::result { typedef typename quasi_unwrap_Col_htrans_redirect< Op, op_htrans>, is_cx::value >::result quasi_unwrap_Col_htrans_extra; inline quasi_unwrap(const Op, op_htrans>& A) : quasi_unwrap_Col_htrans_extra(A) { } static constexpr bool is_const = quasi_unwrap_Col_htrans_extra::is_const; static constexpr bool has_subview = quasi_unwrap_Col_htrans_extra::has_subview; static constexpr bool has_orig_mem = quasi_unwrap_Col_htrans_extra::has_orig_mem; using quasi_unwrap_Col_htrans_extra::M; using quasi_unwrap_Col_htrans_extra::is_alias; }; template struct quasi_unwrap_Row_htrans { inline quasi_unwrap_Row_htrans(const T1&) {} }; template struct quasi_unwrap_Row_htrans< Op, op_htrans> > { inline quasi_unwrap_Row_htrans(const Op, op_htrans>& A) : orig(A.m) , M (const_cast(A.m.memptr()), A.m.n_elem, false, false) { arma_debug_sigprint(); } const Row& orig; const Col M; static constexpr bool is_const = true; static constexpr bool has_subview = true; static constexpr bool has_orig_mem = true; template arma_inline bool is_alias(const Mat& X) const { return (is_same_type::yes) && (void_ptr(&orig) == void_ptr(&X)); } }; template struct quasi_unwrap_Row_htrans_redirect {}; template struct quasi_unwrap_Row_htrans_redirect { typedef quasi_unwrap_default result; }; template struct quasi_unwrap_Row_htrans_redirect { typedef quasi_unwrap_Row_htrans result; }; template struct quasi_unwrap< Op, op_htrans> > : public quasi_unwrap_Row_htrans_redirect< Op, op_htrans>, is_cx::value >::result { typedef typename quasi_unwrap_Row_htrans_redirect< Op, op_htrans>, is_cx::value >::result quasi_unwrap_Row_htrans_extra; inline quasi_unwrap(const Op, op_htrans>& A) : quasi_unwrap_Row_htrans_extra(A) { } static constexpr bool is_const = quasi_unwrap_Row_htrans_extra::is_const; static constexpr bool has_subview = quasi_unwrap_Row_htrans_extra::has_subview; static constexpr bool has_orig_mem = quasi_unwrap_Row_htrans_extra::has_orig_mem; using quasi_unwrap_Row_htrans_extra::M; using quasi_unwrap_Row_htrans_extra::is_alias; }; template struct quasi_unwrap_subview_col_htrans { inline quasi_unwrap_subview_col_htrans(const T1&) {} }; template struct quasi_unwrap_subview_col_htrans< Op, op_htrans> > { inline quasi_unwrap_subview_col_htrans(const Op, op_htrans>& A) : orig(A.m.m) , M (const_cast(A.m.colmem), A.m.n_rows, false, false) { arma_debug_sigprint(); } const Mat& orig; const Row M; static constexpr bool is_const = true; static constexpr bool has_subview = true; static constexpr bool has_orig_mem = true; template arma_inline bool is_alias(const Mat& X) const { return (is_same_type::yes) && (void_ptr(&orig) == void_ptr(&X)); } }; template struct quasi_unwrap_subview_col_htrans_redirect {}; template struct quasi_unwrap_subview_col_htrans_redirect { typedef quasi_unwrap_default result; }; template struct quasi_unwrap_subview_col_htrans_redirect { typedef quasi_unwrap_subview_col_htrans result; }; template struct quasi_unwrap< Op, op_htrans> > : public quasi_unwrap_subview_col_htrans_redirect< Op, op_htrans>, is_cx::value >::result { typedef typename quasi_unwrap_subview_col_htrans_redirect< Op, op_htrans>, is_cx::value >::result quasi_unwrap_subview_col_htrans_extra; inline quasi_unwrap(const Op, op_htrans>& A) : quasi_unwrap_subview_col_htrans_extra(A) { } static constexpr bool is_const = quasi_unwrap_subview_col_htrans_extra::is_const; static constexpr bool has_subview = quasi_unwrap_subview_col_htrans_extra::has_subview; static constexpr bool has_orig_mem = quasi_unwrap_subview_col_htrans_extra::has_orig_mem; using quasi_unwrap_subview_col_htrans_extra::M; using quasi_unwrap_subview_col_htrans_extra::is_alias; }; template struct quasi_unwrap< CubeToMatOp > { typedef typename T1::elem_type eT; inline quasi_unwrap(const CubeToMatOp& A) : U( A.m ) , M( const_cast(U.M.memptr()), U.M.n_elem, 1, false, true ) { arma_debug_sigprint(); } const unwrap_cube U; const Mat M; static constexpr bool is_const = true; static constexpr bool has_subview = true; static constexpr bool has_orig_mem = true; template constexpr bool is_alias(const Mat&) const { return false; } }; template struct quasi_unwrap< SpToDOp, op_sp_nonzeros> > { inline quasi_unwrap(const SpToDOp, op_sp_nonzeros>& A) : orig( A.m ) , M( const_cast(orig.values), orig.n_nonzero, 1, false, true ) { arma_debug_sigprint(); } const SpMat& orig; const Mat M; static constexpr bool is_const = true; static constexpr bool has_subview = true; static constexpr bool has_orig_mem = true; template constexpr bool is_alias(const Mat&) const { return false; } }; // // // template struct unwrap_check_default { typedef typename T1::elem_type eT; typedef Mat stored_type; inline unwrap_check_default(const T1& A, const Mat&) : M(A) { arma_debug_sigprint(); } inline unwrap_check_default(const T1& A, const bool) : M(A) { arma_debug_sigprint(); } const Mat M; }; template struct unwrap_check_fixed { typedef typename T1::elem_type eT; typedef T1 stored_type; inline unwrap_check_fixed(const T1& A, const Mat& B) : M_local( (&A == &B) ? new T1(A) : nullptr ) , M ( (&A == &B) ? *M_local : A ) { arma_debug_sigprint(); } inline unwrap_check_fixed(const T1& A, const bool is_alias) : M_local( is_alias ? new T1(A) : nullptr ) , M ( is_alias ? *M_local : A ) { arma_debug_sigprint(); } inline ~unwrap_check_fixed() { arma_debug_sigprint(); if(M_local) { delete M_local; } } // the order below is important const T1* M_local; const T1& M; }; template struct unwrap_check_redirect {}; template struct unwrap_check_redirect { typedef unwrap_check_default result; }; template struct unwrap_check_redirect { typedef unwrap_check_fixed result; }; template struct unwrap_check : public unwrap_check_redirect::value>::result { inline unwrap_check(const T1& A, const Mat& B) : unwrap_check_redirect::value>::result(A, B) { } inline unwrap_check(const T1& A, const bool is_alias) : unwrap_check_redirect::value>::result(A, is_alias) { } }; template struct unwrap_check< Mat > { typedef Mat stored_type; inline unwrap_check(const Mat& A, const Mat& B) : M_local( (&A == &B) ? new Mat(A) : nullptr ) , M ( (&A == &B) ? (*M_local) : A ) { arma_debug_sigprint(); } inline unwrap_check(const Mat& A, const bool is_alias) : M_local( is_alias ? new Mat(A) : nullptr ) , M ( is_alias ? (*M_local) : A ) { arma_debug_sigprint(); } inline ~unwrap_check() { arma_debug_sigprint(); if(M_local) { delete M_local; } } // the order below is important const Mat* M_local; const Mat& M; }; template struct unwrap_check< Row > { typedef Row stored_type; inline unwrap_check(const Row& A, const Mat& B) : M_local( (&A == &B) ? new Row(A) : nullptr ) , M ( (&A == &B) ? (*M_local) : A ) { arma_debug_sigprint(); } inline unwrap_check(const Row& A, const bool is_alias) : M_local( is_alias ? new Row(A) : nullptr ) , M ( is_alias ? (*M_local) : A ) { arma_debug_sigprint(); } inline ~unwrap_check() { arma_debug_sigprint(); if(M_local) { delete M_local; } } // the order below is important const Row* M_local; const Row& M; }; template struct unwrap_check< Col > { typedef Col stored_type; inline unwrap_check(const Col& A, const Mat& B) : M_local( (&A == &B) ? new Col(A) : nullptr ) , M ( (&A == &B) ? (*M_local) : A ) { arma_debug_sigprint(); } inline unwrap_check(const Col& A, const bool is_alias) : M_local( is_alias ? new Col(A) : nullptr ) , M ( is_alias ? (*M_local) : A ) { arma_debug_sigprint(); } inline ~unwrap_check() { arma_debug_sigprint(); if(M_local) { delete M_local; } } // the order below is important const Col* M_local; const Col& M; }; // // // template struct unwrap_check_mixed { typedef typename T1::elem_type eT1; template inline unwrap_check_mixed(const T1& A, const Mat&) : M(A) { arma_debug_sigprint(); } //template inline unwrap_check_mixed(const T1& A, const bool) : M(A) { arma_debug_sigprint(); } const Mat M; }; template struct unwrap_check_mixed< Mat > { template inline unwrap_check_mixed(const Mat& A, const Mat& B) : M_local( ((is_same_type::yes) && (void_ptr(&A) == void_ptr(&B))) ? new Mat(A) : nullptr ) , M ( ((is_same_type::yes) && (void_ptr(&A) == void_ptr(&B))) ? (*M_local) : A ) { arma_debug_sigprint(); } //template inline unwrap_check_mixed(const Mat& A, const bool is_alias) : M_local( is_alias ? new Mat(A) : nullptr ) , M ( is_alias ? (*M_local) : A ) { arma_debug_sigprint(); } inline ~unwrap_check_mixed() { arma_debug_sigprint(); if(M_local) { delete M_local; } } // the order below is important const Mat* M_local; const Mat& M; }; template struct unwrap_check_mixed< Row > { template inline unwrap_check_mixed(const Row& A, const Mat& B) : M_local( ((is_same_type::yes) && (void_ptr(&A) == void_ptr(&B))) ? new Row(A) : nullptr ) , M ( ((is_same_type::yes) && (void_ptr(&A) == void_ptr(&B))) ? (*M_local) : A ) { arma_debug_sigprint(); } //template inline unwrap_check_mixed(const Row& A, const bool is_alias) : M_local( is_alias ? new Row(A) : nullptr ) , M ( is_alias ? (*M_local) : A ) { arma_debug_sigprint(); } inline ~unwrap_check_mixed() { arma_debug_sigprint(); if(M_local) { delete M_local; } } // the order below is important const Row* M_local; const Row& M; }; template struct unwrap_check_mixed< Col > { template inline unwrap_check_mixed(const Col& A, const Mat& B) : M_local( ((is_same_type::yes) && (void_ptr(&A) == void_ptr(&B))) ? new Col(A) : nullptr ) , M ( ((is_same_type::yes) && (void_ptr(&A) == void_ptr(&B))) ? (*M_local) : A ) { arma_debug_sigprint(); } //template inline unwrap_check_mixed(const Col& A, const bool is_alias) : M_local( is_alias ? new Col(A) : nullptr ) , M ( is_alias ? (*M_local) : A ) { arma_debug_sigprint(); } inline ~unwrap_check_mixed() { arma_debug_sigprint(); if(M_local) { delete M_local; } } // the order below is important const Col* M_local; const Col& M; }; // // // template struct partial_unwrap_default { typedef typename T1::elem_type eT; typedef Mat stored_type; inline partial_unwrap_default(const T1& A) : M(A) { arma_debug_sigprint(); } constexpr eT get_val() const { return eT(1); } template constexpr bool is_alias(const Mat&) const { return false; } static constexpr bool do_trans = false; static constexpr bool do_times = false; static constexpr bool is_fast = false; const Mat M; }; template struct partial_unwrap_fixed { typedef typename T1::elem_type eT; typedef T1 stored_type; inline explicit partial_unwrap_fixed(const T1& A) : M(A) { arma_debug_sigprint(); } constexpr eT get_val() const { return eT(1); } template arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&X) == void_ptr(&M)); } static constexpr bool do_trans = false; static constexpr bool do_times = false; static constexpr bool is_fast = true; const T1& M; }; template struct partial_unwrap_redirect {}; template struct partial_unwrap_redirect { typedef partial_unwrap_default result; }; template struct partial_unwrap_redirect { typedef partial_unwrap_fixed result; }; template struct partial_unwrap : public partial_unwrap_redirect::value>::result { inline partial_unwrap(const T1& A) : partial_unwrap_redirect< T1, is_Mat_fixed::value>::result(A) { } }; template struct partial_unwrap< Mat > { typedef Mat stored_type; inline partial_unwrap(const Mat& A) : M(A) { arma_debug_sigprint(); } constexpr eT get_val() const { return eT(1); } template arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&X) == void_ptr(&M)); } static constexpr bool do_trans = false; static constexpr bool do_times = false; static constexpr bool is_fast = true; const Mat& M; }; template struct partial_unwrap< Row > { typedef Row stored_type; inline partial_unwrap(const Row& A) : M(A) { arma_debug_sigprint(); } constexpr eT get_val() const { return eT(1); } template arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&X) == void_ptr(&M)); } static constexpr bool do_trans = false; static constexpr bool do_times = false; static constexpr bool is_fast = true; const Row& M; }; template struct partial_unwrap< Col > { typedef Col stored_type; inline partial_unwrap(const Col& A) : M(A) { arma_debug_sigprint(); } constexpr eT get_val() const { return eT(1); } template arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&X) == void_ptr(&M)); } static constexpr bool do_trans = false; static constexpr bool do_times = false; static constexpr bool is_fast = true; const Col& M; }; template struct partial_unwrap< subview > { typedef Mat stored_type; inline partial_unwrap(const subview& A) : sv( A ) , M ( A, ((A.aux_row1 == 0) && (A.n_rows == A.m.n_rows)) ) // reuse memory if the subview is a contiguous chunk { arma_debug_sigprint(); } constexpr eT get_val() const { return eT(1); } template arma_inline bool is_alias(const Mat& X) const { return ( ((sv.aux_row1 == 0) && (sv.n_rows == sv.m.n_rows)) ? (void_ptr(&(sv.m)) == void_ptr(&X)) : false ); } static constexpr bool do_trans = false; static constexpr bool do_times = false; static constexpr bool is_fast = false; // can't determine at compile time that memory is reused const subview& sv; const Mat M; }; template struct partial_unwrap< subview_col > { typedef Col stored_type; inline partial_unwrap(const subview_col& A) : orig( A.m ) , M ( const_cast( A.colmem ), A.n_rows, false, false ) { arma_debug_sigprint(); } constexpr eT get_val() const { return eT(1); } template arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&X) == void_ptr(&orig)); } static constexpr bool do_trans = false; static constexpr bool do_times = false; static constexpr bool is_fast = true; const Mat& orig; const Col M; }; template struct partial_unwrap< subview_cols > { typedef Mat stored_type; inline partial_unwrap(const subview_cols& A) : orig( A.m ) , M ( const_cast( A.colptr(0) ), A.n_rows, A.n_cols, false, false ) { arma_debug_sigprint(); } constexpr eT get_val() const { return eT(1); } template arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&X) == void_ptr(&orig)); } static constexpr bool do_trans = false; static constexpr bool do_times = false; static constexpr bool is_fast = true; const Mat& orig; const Mat M; }; template struct partial_unwrap< subview_row > { typedef Row stored_type; inline partial_unwrap(const subview_row& A) : M(A) { arma_debug_sigprint(); } constexpr eT get_val() const { return eT(1); } template constexpr bool is_alias(const Mat&) const { return false; } static constexpr bool do_trans = false; static constexpr bool do_times = false; static constexpr bool is_fast = false; const Row M; }; template struct partial_unwrap_htrans_default { typedef typename T1::elem_type eT; typedef Mat stored_type; inline partial_unwrap_htrans_default(const Op& A) : M(A.m) { arma_debug_sigprint(); } constexpr eT get_val() const { return eT(1); } template constexpr bool is_alias(const Mat&) const { return false; } static constexpr bool do_trans = true; static constexpr bool do_times = false; static constexpr bool is_fast = false; const Mat M; }; template struct partial_unwrap_htrans_fixed { typedef typename T1::elem_type eT; typedef T1 stored_type; inline explicit partial_unwrap_htrans_fixed(const Op& A) : M(A.m) { arma_debug_sigprint(); } constexpr eT get_val() const { return eT(1); } template arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&X) == void_ptr(&M)); } static constexpr bool do_trans = true; static constexpr bool do_times = false; static constexpr bool is_fast = true; const T1& M; }; template struct partial_unwrap_htrans_redirect {}; template struct partial_unwrap_htrans_redirect { typedef partial_unwrap_htrans_default result; }; template struct partial_unwrap_htrans_redirect { typedef partial_unwrap_htrans_fixed result; }; template struct partial_unwrap< Op > : public partial_unwrap_htrans_redirect::value>::result { inline partial_unwrap(const Op& A) : partial_unwrap_htrans_redirect::value>::result(A) { } }; template struct partial_unwrap< Op< Mat, op_htrans> > { typedef Mat stored_type; inline partial_unwrap(const Op< Mat, op_htrans>& A) : M(A.m) { arma_debug_sigprint(); } constexpr eT get_val() const { return eT(1); } template arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&X) == void_ptr(&M)); } static constexpr bool do_trans = true; static constexpr bool do_times = false; static constexpr bool is_fast = true; const Mat& M; }; template struct partial_unwrap< Op< Row, op_htrans> > { typedef Row stored_type; inline partial_unwrap(const Op< Row, op_htrans>& A) : M(A.m) { arma_debug_sigprint(); } constexpr eT get_val() const { return eT(1); } template arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&X) == void_ptr(&M)); } static constexpr bool do_trans = true; static constexpr bool do_times = false; static constexpr bool is_fast = true; const Row& M; }; template struct partial_unwrap< Op< Col, op_htrans> > { typedef Col stored_type; inline partial_unwrap(const Op< Col, op_htrans>& A) : M(A.m) { arma_debug_sigprint(); } constexpr eT get_val() const { return eT(1); } template arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&X) == void_ptr(&M)); } static constexpr bool do_trans = true; static constexpr bool do_times = false; static constexpr bool is_fast = true; const Col& M; }; template struct partial_unwrap< Op< subview, op_htrans> > { typedef Mat stored_type; inline partial_unwrap(const Op< subview, op_htrans>& A) : sv( A.m ) , M ( A.m, ((A.m.aux_row1 == 0) && (A.m.n_rows == A.m.m.n_rows)) ) // reuse memory if the subview is a contiguous chunk { arma_debug_sigprint(); } constexpr eT get_val() const { return eT(1); } template arma_inline bool is_alias(const Mat& X) const { return ( ((sv.aux_row1 == 0) && (sv.n_rows == sv.m.n_rows)) ? (void_ptr(&(sv.m)) == void_ptr(&X)) : false ); } static constexpr bool do_trans = true; static constexpr bool do_times = false; static constexpr bool is_fast = false; // can't determine at compile time that memory is reused const subview& sv; const Mat M; }; template struct partial_unwrap< Op< subview_cols, op_htrans> > { typedef Mat stored_type; inline partial_unwrap(const Op< subview_cols, op_htrans>& A) : orig( A.m.m ) , M ( const_cast( A.m.colptr(0) ), A.m.n_rows, A.m.n_cols, false, false ) { arma_debug_sigprint(); } constexpr eT get_val() const { return eT(1); } template arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&orig) == void_ptr(&X)); } static constexpr bool do_trans = true; static constexpr bool do_times = false; static constexpr bool is_fast = true; const Mat& orig; const Mat M; }; template struct partial_unwrap< Op< subview_col, op_htrans> > { typedef Col stored_type; inline partial_unwrap(const Op< subview_col, op_htrans>& A) : orig( A.m.m ) , M ( const_cast( A.m.colmem ), A.m.n_rows, false, false ) { arma_debug_sigprint(); } constexpr eT get_val() const { return eT(1); } template arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&X) == void_ptr(&orig)); } static constexpr bool do_trans = true; static constexpr bool do_times = false; static constexpr bool is_fast = true; const Mat& orig; const Col M; }; template struct partial_unwrap< Op< subview_row, op_htrans> > { typedef Row stored_type; inline partial_unwrap(const Op< subview_row, op_htrans>& A) : M(A.m) { arma_debug_sigprint(); } constexpr eT get_val() const { return eT(1); } template constexpr bool is_alias(const Mat&) const { return false; } static constexpr bool do_trans = true; static constexpr bool do_times = false; static constexpr bool is_fast = false; const Row M; }; template struct partial_unwrap_htrans2_default { typedef typename T1::elem_type eT; typedef Mat stored_type; inline partial_unwrap_htrans2_default(const Op& A) : val(A.aux) , M (A.m) { arma_debug_sigprint(); } arma_inline eT get_val() const { return val; } template constexpr bool is_alias(const Mat&) const { return false; } static constexpr bool do_trans = true; static constexpr bool do_times = true; static constexpr bool is_fast = false; const eT val; const Mat M; }; template struct partial_unwrap_htrans2_fixed { typedef typename T1::elem_type eT; typedef T1 stored_type; inline explicit partial_unwrap_htrans2_fixed(const Op& A) : val(A.aux) , M (A.m) { arma_debug_sigprint(); } arma_inline eT get_val() const { return val; } template arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&X) == void_ptr(&M)); } static constexpr bool do_trans = true; static constexpr bool do_times = true; static constexpr bool is_fast = true; const eT val; const T1& M; }; template struct partial_unwrap_htrans2_redirect {}; template struct partial_unwrap_htrans2_redirect { typedef partial_unwrap_htrans2_default result; }; template struct partial_unwrap_htrans2_redirect { typedef partial_unwrap_htrans2_fixed result; }; template struct partial_unwrap< Op > : public partial_unwrap_htrans2_redirect::value>::result { inline partial_unwrap(const Op& A) : partial_unwrap_htrans2_redirect::value>::result(A) { } }; template struct partial_unwrap< Op< Mat, op_htrans2> > { typedef Mat stored_type; inline partial_unwrap(const Op< Mat, op_htrans2>& A) : val(A.aux) , M (A.m) { arma_debug_sigprint(); } inline eT get_val() const { return val; } template arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&X) == void_ptr(&M)); } static constexpr bool do_trans = true; static constexpr bool do_times = true; static constexpr bool is_fast = true; const eT val; const Mat& M; }; template struct partial_unwrap< Op< Row, op_htrans2> > { typedef Row stored_type; inline partial_unwrap(const Op< Row, op_htrans2>& A) : val(A.aux) , M (A.m) { arma_debug_sigprint(); } inline eT get_val() const { return val; } template arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&X) == void_ptr(&M)); } static constexpr bool do_trans = true; static constexpr bool do_times = true; static constexpr bool is_fast = true; const eT val; const Row& M; }; template struct partial_unwrap< Op< Col, op_htrans2> > { typedef Col stored_type; inline partial_unwrap(const Op< Col, op_htrans2>& A) : val(A.aux) , M (A.m) { arma_debug_sigprint(); } inline eT get_val() const { return val; } template arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&X) == void_ptr(&M)); } static constexpr bool do_trans = true; static constexpr bool do_times = true; static constexpr bool is_fast = true; const eT val; const Col& M; }; template struct partial_unwrap< Op< subview, op_htrans2> > { typedef Mat stored_type; inline partial_unwrap(const Op< subview, op_htrans2>& A) : sv ( A.m ) , val( A.aux ) , M ( A.m, ((A.m.aux_row1 == 0) && (A.m.n_rows == A.m.m.n_rows)) ) // reuse memory if the subview is a contiguous chunk { arma_debug_sigprint(); } inline eT get_val() const { return val; } template arma_inline bool is_alias(const Mat& X) const { return ( ((sv.aux_row1 == 0) && (sv.n_rows == sv.m.n_rows)) ? (void_ptr(&(sv.m)) == void_ptr(&X)) : false ); } static constexpr bool do_trans = true; static constexpr bool do_times = true; static constexpr bool is_fast = false; // can't determine at compile time that memory is reused const subview& sv; const eT val; const Mat M; }; template struct partial_unwrap< Op< subview_cols, op_htrans2> > { typedef Mat stored_type; inline partial_unwrap(const Op< subview_cols, op_htrans2>& A) : orig( A.m.m ) , val ( A.aux ) , M ( const_cast( A.m.colptr(0) ), A.m.n_rows, A.m.n_cols, false, false ) { arma_debug_sigprint(); } inline eT get_val() const { return val; } template arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&orig) == void_ptr(&X)); } static constexpr bool do_trans = true; static constexpr bool do_times = true; static constexpr bool is_fast = true; const Mat& orig; const eT val; const Mat M; }; template struct partial_unwrap< Op< subview_col, op_htrans2> > { typedef Col stored_type; inline partial_unwrap(const Op< subview_col, op_htrans2>& A) : orig( A.m.m ) , val ( A.aux ) , M ( const_cast( A.m.colmem ), A.m.n_rows, false, false ) { arma_debug_sigprint(); } inline eT get_val() const { return val; } template arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&X) == void_ptr(&orig)); } static constexpr bool do_trans = true; static constexpr bool do_times = true; static constexpr bool is_fast = true; const Mat& orig; const eT val; const Col M; }; template struct partial_unwrap< Op< subview_row, op_htrans2> > { typedef Row stored_type; inline partial_unwrap(const Op< subview_row, op_htrans2>& A) : val(A.aux) , M (A.m ) { arma_debug_sigprint(); } arma_inline eT get_val() const { return val; } template constexpr bool is_alias(const Mat&) const { return false; } static constexpr bool do_trans = true; static constexpr bool do_times = true; static constexpr bool is_fast = false; const eT val; const Row M; }; template struct partial_unwrap_scalar_times_default { typedef typename T1::elem_type eT; typedef Mat stored_type; inline partial_unwrap_scalar_times_default(const eOp& A) : val(A.aux) , M (A.P.Q) { arma_debug_sigprint(); } arma_inline eT get_val() const { return val; } template constexpr bool is_alias(const Mat&) const { return false; } static constexpr bool do_trans = false; static constexpr bool do_times = true; static constexpr bool is_fast = false; const eT val; const Mat M; }; template struct partial_unwrap_scalar_times_fixed { typedef typename T1::elem_type eT; typedef T1 stored_type; inline explicit partial_unwrap_scalar_times_fixed(const eOp& A) : val(A.aux) , M (A.P.Q) { arma_debug_sigprint(); } arma_inline eT get_val() const { return val; } template arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&X) == void_ptr(&M)); } static constexpr bool do_trans = false; static constexpr bool do_times = true; static constexpr bool is_fast = true; const eT val; const T1& M; }; template struct partial_unwrap_scalar_times_redirect {}; template struct partial_unwrap_scalar_times_redirect { typedef partial_unwrap_scalar_times_default result; }; template struct partial_unwrap_scalar_times_redirect { typedef partial_unwrap_scalar_times_fixed result; }; template struct partial_unwrap< eOp > : public partial_unwrap_scalar_times_redirect::value>::result { typedef typename T1::elem_type eT; inline partial_unwrap(const eOp& A) : partial_unwrap_scalar_times_redirect< T1, is_Mat_fixed::value>::result(A) { } }; template struct partial_unwrap< eOp, eop_scalar_times> > { typedef Mat stored_type; inline partial_unwrap(const eOp,eop_scalar_times>& A) : val(A.aux) , M (A.P.Q) { arma_debug_sigprint(); } inline eT get_val() const { return val; } template arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&X) == void_ptr(&M)); } static constexpr bool do_trans = false; static constexpr bool do_times = true; static constexpr bool is_fast = true; const eT val; const Mat& M; }; template struct partial_unwrap< eOp, eop_scalar_times> > { typedef Row stored_type; inline partial_unwrap(const eOp,eop_scalar_times>& A) : val(A.aux) , M (A.P.Q) { arma_debug_sigprint(); } inline eT get_val() const { return val; } template arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&X) == void_ptr(&M)); } static constexpr bool do_trans = false; static constexpr bool do_times = true; static constexpr bool is_fast = true; const eT val; const Row& M; }; template struct partial_unwrap< eOp, eop_scalar_times> > { typedef Col stored_type; inline partial_unwrap(const eOp,eop_scalar_times>& A) : val(A.aux) , M (A.P.Q) { arma_debug_sigprint(); } inline eT get_val() const { return val; } template arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&X) == void_ptr(&M)); } static constexpr bool do_trans = false; static constexpr bool do_times = true; static constexpr bool is_fast = true; const eT val; const Col& M; }; template struct partial_unwrap< eOp, eop_scalar_times> > { typedef Col stored_type; inline partial_unwrap(const eOp,eop_scalar_times>& A) : orig( A.P.Q.m ) , val ( A.aux ) , M ( const_cast( A.P.Q.colmem ), A.P.Q.n_rows, false, false ) { arma_debug_sigprint(); } arma_inline eT get_val() const { return val; } template arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&X) == void_ptr(&orig)); } static constexpr bool do_trans = false; static constexpr bool do_times = true; static constexpr bool is_fast = true; const Mat& orig; const eT val; const Col M; }; template struct partial_unwrap< eOp, eop_scalar_times> > { typedef Row stored_type; inline partial_unwrap(const eOp,eop_scalar_times>& A) : val(A.aux) , M (A.P.Q) { arma_debug_sigprint(); } arma_inline eT get_val() const { return val; } template constexpr bool is_alias(const Mat&) const { return false; } static constexpr bool do_trans = false; static constexpr bool do_times = true; static constexpr bool is_fast = false; const eT val; const Row M; }; template struct partial_unwrap_neg_default { typedef typename T1::elem_type eT; typedef Mat stored_type; inline partial_unwrap_neg_default(const eOp& A) : M(A.P.Q) { arma_debug_sigprint(); } constexpr eT get_val() const { return eT(-1); } template constexpr bool is_alias(const Mat&) const { return false; } static constexpr bool do_trans = false; static constexpr bool do_times = true; static constexpr bool is_fast = false; const Mat M; }; template struct partial_unwrap_neg_fixed { typedef typename T1::elem_type eT; typedef T1 stored_type; inline explicit partial_unwrap_neg_fixed(const eOp& A) : M(A.P.Q) { arma_debug_sigprint(); } constexpr eT get_val() const { return eT(-1); } template arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&X) == void_ptr(&M)); } static constexpr bool do_trans = false; static constexpr bool do_times = true; static constexpr bool is_fast = true; const T1& M; }; template struct partial_unwrap_neg_redirect {}; template struct partial_unwrap_neg_redirect { typedef partial_unwrap_neg_default result; }; template struct partial_unwrap_neg_redirect { typedef partial_unwrap_neg_fixed result; }; template struct partial_unwrap< eOp > : public partial_unwrap_neg_redirect::value>::result { typedef typename T1::elem_type eT; inline partial_unwrap(const eOp& A) : partial_unwrap_neg_redirect< T1, is_Mat_fixed::value>::result(A) { } }; template struct partial_unwrap< eOp, eop_neg> > { typedef Mat stored_type; inline partial_unwrap(const eOp,eop_neg>& A) : M(A.P.Q) { arma_debug_sigprint(); } constexpr eT get_val() const { return eT(-1); } template arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&X) == void_ptr(&M)); } static constexpr bool do_trans = false; static constexpr bool do_times = true; static constexpr bool is_fast = true; const Mat& M; }; template struct partial_unwrap< eOp, eop_neg> > { typedef Row stored_type; inline partial_unwrap(const eOp,eop_neg>& A) : M(A.P.Q) { arma_debug_sigprint(); } constexpr eT get_val() const { return eT(-1); } template arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&X) == void_ptr(&M)); } static constexpr bool do_trans = false; static constexpr bool do_times = true; static constexpr bool is_fast = true; const Row& M; }; template struct partial_unwrap< eOp, eop_neg> > { typedef Col stored_type; inline partial_unwrap(const eOp,eop_neg>& A) : M(A.P.Q) { arma_debug_sigprint(); } constexpr eT get_val() const { return eT(-1); } template arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&X) == void_ptr(&M)); } static constexpr bool do_trans = false; static constexpr bool do_times = true; static constexpr bool is_fast = true; const Col& M; }; template struct partial_unwrap< eOp, eop_neg> > { typedef Col stored_type; inline partial_unwrap(const eOp,eop_neg>& A) : orig( A.P.Q.m ) , M ( const_cast( A.P.Q.colmem ), A.P.Q.n_rows, false, false ) { arma_debug_sigprint(); } constexpr eT get_val() const { return eT(-1); } template arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&X) == void_ptr(&orig)); } static constexpr bool do_trans = false; static constexpr bool do_times = true; static constexpr bool is_fast = true; const Mat& orig; const Col M; }; template struct partial_unwrap< eOp, eop_neg> > { typedef Row stored_type; inline partial_unwrap(const eOp,eop_neg>& A) : M(A.P.Q) { arma_debug_sigprint(); } constexpr eT get_val() const { return eT(-1); } template constexpr bool is_alias(const Mat&) const { return false; } static constexpr bool do_trans = false; static constexpr bool do_times = true; static constexpr bool is_fast = false; const Row M; }; // // // template struct sv_keep_unwrap { typedef typename T1::elem_type eT; typedef Mat stored_type; inline sv_keep_unwrap(const T1& A) : M(A) { arma_debug_sigprint(); } const Mat M; }; template struct sv_keep_unwrap< subview > { typedef subview stored_type; inline sv_keep_unwrap(const subview& A) : M(A) { arma_debug_sigprint(); } const subview& M; }; template struct sv_keep_unwrap< subview_row > { typedef subview_row stored_type; inline sv_keep_unwrap(const subview_row& A) : M(A) { arma_debug_sigprint(); } const subview_row& M; }; template struct sv_keep_unwrap< subview_col > { typedef subview_col stored_type; inline sv_keep_unwrap(const subview_col& A) : M(A) { arma_debug_sigprint(); } const subview_col& M; }; template struct sv_keep_unwrap< Mat > { typedef Mat stored_type; inline sv_keep_unwrap(const Mat& A) : M(A) { arma_debug_sigprint(); } const Mat& M; }; template struct sv_keep_unwrap< Row > { typedef Row stored_type; inline sv_keep_unwrap(const Row& A) : M(A) { arma_debug_sigprint(); } const Row& M; }; template struct sv_keep_unwrap< Col > { typedef Col stored_type; inline sv_keep_unwrap(const Col& A) : M(A) { arma_debug_sigprint(); } const Col& M; }; //! @} RcppArmadillo/inst/include/armadillo_bits/newarp_SparseGenRealShiftSolve_bones.hpp0000644000176200001440000000305014301267043030343 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ namespace newarp { //! Define matrix operations on existing matrix objects template class SparseGenRealShiftSolve { private: #if defined(ARMA_USE_SUPERLU) // The following objects are read-only in perform_op() mutable superlu_supermatrix_wrangler l; mutable superlu_supermatrix_wrangler u; mutable superlu_array_wrangler perm_c; mutable superlu_array_wrangler perm_r; #endif public: bool valid = false; const uword n_rows; // number of rows of the underlying matrix const uword n_cols; // number of columns of the underlying matrix inline SparseGenRealShiftSolve(const SpMat& mat_obj, const eT shift); inline void perform_op(eT* x_in, eT* y_out) const; }; } // namespace newarp RcppArmadillo/inst/include/armadillo_bits/op_dotext_meat.hpp0000644000176200001440000000732414631567470024137 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_dotext //! @{ template inline eT op_dotext::direct_rowvec_mat_colvec ( const eT* A_mem, const Mat& B, const eT* C_mem ) { arma_debug_sigprint(); const uword cost_AB = B.n_cols; const uword cost_BC = B.n_rows; if(cost_AB <= cost_BC) { podarray tmp(B.n_cols); for(uword col=0; col tmp(B.n_rows); for(uword row=0; row inline eT op_dotext::direct_rowvec_transmat_colvec ( const eT* A_mem, const Mat& B, const eT* C_mem ) { arma_debug_sigprint(); const uword cost_AB = B.n_rows; const uword cost_BC = B.n_cols; if(cost_AB <= cost_BC) { podarray tmp(B.n_rows); for(uword row=0; row tmp(B.n_cols); for(uword col=0; col inline eT op_dotext::direct_rowvec_diagmat_colvec ( const eT* A_mem, const Mat& B, const eT* C_mem ) { arma_debug_sigprint(); eT val = eT(0); for(uword i=0; i inline eT op_dotext::direct_rowvec_invdiagmat_colvec ( const eT* A_mem, const Mat& B, const eT* C_mem ) { arma_debug_sigprint(); eT val = eT(0); for(uword i=0; i inline eT op_dotext::direct_rowvec_invdiagvec_colvec ( const eT* A_mem, const Mat& B, const eT* C_mem ) { arma_debug_sigprint(); const eT* B_mem = B.mem; eT val = eT(0); for(uword i=0; i inline SparseGenRealShiftSolve::SparseGenRealShiftSolve(const SpMat& mat_obj, const eT shift) #if defined(ARMA_USE_SUPERLU) : perm_c(mat_obj.n_cols + 1) , perm_r(mat_obj.n_rows + 1) , n_rows(mat_obj.n_rows) , n_cols(mat_obj.n_cols) #else : n_rows(0) , n_cols(0) #endif { arma_debug_sigprint(); #if defined(ARMA_USE_SUPERLU) { // Derived from sp_auxlib::run_aupd_shiftinvert() superlu_opts superlu_opts_default; superlu::superlu_options_t options; sp_auxlib::set_superlu_opts(options, superlu_opts_default); superlu::GlobalLU_t Glu; arrayops::fill_zeros(reinterpret_cast(&Glu), sizeof(superlu::GlobalLU_t)); superlu_supermatrix_wrangler x; superlu_supermatrix_wrangler xC; superlu_array_wrangler etree(mat_obj.n_cols+1); // Copy A-shift*I to x const bool status_x = sp_auxlib::copy_to_supermatrix_with_shift(x.get_ref(), mat_obj, shift); if(status_x == false) { arma_stop_runtime_error("newarp::SparseGenRealShiftSolve::SparseGenRealShiftSolve(): could not construct SuperLU matrix"); return; } int panel_size = superlu::sp_ispec_environ(1); int relax = superlu::sp_ispec_environ(2); int slu_info = 0; // Return code int lwork = 0; // lwork = 0: allocate space internally by system malloc superlu_stat_wrangler stat; arma_debug_print("superlu::gstrf()"); superlu::get_permutation_c(options.ColPerm, x.get_ptr(), perm_c.get_ptr()); superlu::sp_preorder_mat(&options, x.get_ptr(), perm_c.get_ptr(), etree.get_ptr(), xC.get_ptr()); superlu::gstrf(&options, xC.get_ptr(), relax, panel_size, etree.get_ptr(), NULL, lwork, perm_c.get_ptr(), perm_r.get_ptr(), l.get_ptr(), u.get_ptr(), &Glu, stat.get_ptr(), &slu_info); if(slu_info != 0) { arma_warn(2, "matrix is singular to working precision"); return; } eT x_norm_val = sp_auxlib::norm1(x.get_ptr()); eT x_rcond = sp_auxlib::lu_rcond(l.get_ptr(), u.get_ptr(), x_norm_val); if( (x_rcond < std::numeric_limits::epsilon()) || arma_isnan(x_rcond) ) { if(x_rcond == eT(0)) { arma_warn(2, "matrix is singular to working precision"); } else { arma_warn(2, "matrix is singular to working precision (rcond: ", x_rcond, ")"); } return; } valid = true; } #else { arma_ignore(mat_obj); arma_ignore(shift); } #endif } // Perform the shift-solve operation \f$y=(A-\sigma I)^{-1}x\f$. // y_out = inv(A - sigma * I) * x_in template inline void SparseGenRealShiftSolve::perform_op(eT* x_in, eT* y_out) const { arma_debug_sigprint(); #if defined(ARMA_USE_SUPERLU) { const Col x(x_in , n_cols, false, true); Col y(y_out, n_rows, false, true); // Derived from sp_auxlib::run_aupd_shiftinvert() y = x; superlu_supermatrix_wrangler out_slu; const bool status_out_slu = sp_auxlib::wrap_to_supermatrix(out_slu.get_ref(), y); if(status_out_slu == false) { arma_stop_runtime_error("newarp::SparseGenRealShiftSolve::perform_op(): could not construct SuperLU matrix"); return; } superlu_stat_wrangler stat; int info = 0; arma_debug_print("superlu::gstrs()"); superlu::gstrs(superlu::NOTRANS, l.get_ptr(), u.get_ptr(), perm_c.get_ptr(), perm_r.get_ptr(), out_slu.get_ptr(), stat.get_ptr(), &info); if(info != 0) { arma_stop_runtime_error("newarp::SparseGenRealShiftSolve::perform_op(): could not solve linear equation"); return; } // No need to modify memory further since it was all done in-place. } #else { arma_ignore(x_in); arma_ignore(y_out); } #endif } } // namespace newarp RcppArmadillo/inst/include/armadillo_bits/glue_polyval_bones.hpp0000644000176200001440000000250714301267043024775 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup glue_polyval //! @{ class glue_polyval { public: template struct traits { static constexpr bool is_row = T2::is_row; static constexpr bool is_col = T2::is_col; static constexpr bool is_xvec = T2::is_xvec; }; template inline static void apply_noalias(Mat& out, const Mat& P, const Mat& X); template inline static void apply(Mat& out, const Glue& expr); }; //! @} RcppArmadillo/inst/include/armadillo_bits/glue_mixed_meat.hpp0000644000176200001440000003573714631567470024265 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup glue_mixed //! @{ //! matrix multiplication with different element types template inline void glue_mixed_times::apply(Mat::eT>& out, const mtGlue::eT, T1, T2, glue_mixed_times>& X) { arma_debug_sigprint(); typedef typename T1::elem_type in_eT1; typedef typename T2::elem_type in_eT2; typedef typename eT_promoter::eT out_eT; const partial_unwrap tmp1(X.A); const partial_unwrap tmp2(X.B); const typename partial_unwrap::stored_type& A = tmp1.M; const typename partial_unwrap::stored_type& B = tmp2.M; constexpr bool use_alpha = partial_unwrap::do_times || partial_unwrap::do_times; const out_eT alpha = use_alpha ? (upgrade_val::apply(tmp1.get_val()) * upgrade_val::apply(tmp2.get_val())) : out_eT(0); const bool do_trans_A = partial_unwrap::do_trans; const bool do_trans_B = partial_unwrap::do_trans; arma_conform_assert_trans_mul_size(A.n_rows, A.n_cols, B.n_rows, B.n_cols, "matrix multiplication"); const uword out_n_rows = (do_trans_A == false) ? A.n_rows : A.n_cols; const uword out_n_cols = (do_trans_B == false) ? B.n_cols : B.n_rows; const bool alias = tmp1.is_alias(out) || tmp2.is_alias(out); if(alias == false) { out.set_size(out_n_rows, out_n_cols); gemm_mixed::apply(out, A, B, alpha); } else { Mat tmp(out_n_rows, out_n_cols, arma_nozeros_indicator()); gemm_mixed::apply(tmp, A, B, alpha); out.steal_mem(tmp); } } //! matrix addition with different element types template inline void glue_mixed_plus::apply(Mat::eT>& out, const mtGlue::eT, T1, T2, glue_mixed_plus>& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT1; typedef typename T2::elem_type eT2; typedef typename promote_type::result out_eT; promote_type::check(); const Proxy A(X.A); const Proxy B(X.B); arma_conform_assert_same_size(A, B, "addition"); const uword n_rows = A.get_n_rows(); const uword n_cols = A.get_n_cols(); out.set_size(n_rows, n_cols); out_eT* out_mem = out.memptr(); const uword n_elem = out.n_elem; constexpr bool use_at = (Proxy::use_at || Proxy::use_at); if(use_at == false) { typename Proxy::ea_type AA = A.get_ea(); typename Proxy::ea_type BB = B.get_ea(); if(memory::is_aligned(out_mem)) { memory::mark_as_aligned(out_mem); for(uword i=0; i::apply(AA[i]) + upgrade_val::apply(BB[i]); } } else { for(uword i=0; i::apply(AA[i]) + upgrade_val::apply(BB[i]); } } } else { for(uword col=0; col < n_cols; ++col) for(uword row=0; row < n_rows; ++row) { (*out_mem) = upgrade_val::apply(A.at(row,col)) + upgrade_val::apply(B.at(row,col)); out_mem++; } } } //! matrix subtraction with different element types template inline void glue_mixed_minus::apply(Mat::eT>& out, const mtGlue::eT, T1, T2, glue_mixed_minus>& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT1; typedef typename T2::elem_type eT2; typedef typename promote_type::result out_eT; promote_type::check(); const Proxy A(X.A); const Proxy B(X.B); arma_conform_assert_same_size(A, B, "subtraction"); const uword n_rows = A.get_n_rows(); const uword n_cols = A.get_n_cols(); out.set_size(n_rows, n_cols); out_eT* out_mem = out.memptr(); const uword n_elem = out.n_elem; constexpr bool use_at = (Proxy::use_at || Proxy::use_at); if(use_at == false) { typename Proxy::ea_type AA = A.get_ea(); typename Proxy::ea_type BB = B.get_ea(); if(memory::is_aligned(out_mem)) { memory::mark_as_aligned(out_mem); for(uword i=0; i::apply(AA[i]) - upgrade_val::apply(BB[i]); } } else { for(uword i=0; i::apply(AA[i]) - upgrade_val::apply(BB[i]); } } } else { for(uword col=0; col < n_cols; ++col) for(uword row=0; row < n_rows; ++row) { (*out_mem) = upgrade_val::apply(A.at(row,col)) - upgrade_val::apply(B.at(row,col)); out_mem++; } } } //! element-wise matrix division with different element types template inline void glue_mixed_div::apply(Mat::eT>& out, const mtGlue::eT, T1, T2, glue_mixed_div>& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT1; typedef typename T2::elem_type eT2; typedef typename promote_type::result out_eT; promote_type::check(); const Proxy A(X.A); const Proxy B(X.B); arma_conform_assert_same_size(A, B, "element-wise division"); const uword n_rows = A.get_n_rows(); const uword n_cols = A.get_n_cols(); out.set_size(n_rows, n_cols); out_eT* out_mem = out.memptr(); const uword n_elem = out.n_elem; constexpr bool use_at = (Proxy::use_at || Proxy::use_at); if(use_at == false) { typename Proxy::ea_type AA = A.get_ea(); typename Proxy::ea_type BB = B.get_ea(); if(memory::is_aligned(out_mem)) { memory::mark_as_aligned(out_mem); for(uword i=0; i::apply(AA[i]) / upgrade_val::apply(BB[i]); } } else { for(uword i=0; i::apply(AA[i]) / upgrade_val::apply(BB[i]); } } } else { for(uword col=0; col < n_cols; ++col) for(uword row=0; row < n_rows; ++row) { (*out_mem) = upgrade_val::apply(A.at(row,col)) / upgrade_val::apply(B.at(row,col)); out_mem++; } } } //! element-wise matrix multiplication with different element types template inline void glue_mixed_schur::apply(Mat::eT>& out, const mtGlue::eT, T1, T2, glue_mixed_schur>& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT1; typedef typename T2::elem_type eT2; typedef typename promote_type::result out_eT; promote_type::check(); const Proxy A(X.A); const Proxy B(X.B); arma_conform_assert_same_size(A, B, "element-wise multiplication"); const uword n_rows = A.get_n_rows(); const uword n_cols = A.get_n_cols(); out.set_size(n_rows, n_cols); out_eT* out_mem = out.memptr(); const uword n_elem = out.n_elem; constexpr bool use_at = (Proxy::use_at || Proxy::use_at); if(use_at == false) { typename Proxy::ea_type AA = A.get_ea(); typename Proxy::ea_type BB = B.get_ea(); if(memory::is_aligned(out_mem)) { memory::mark_as_aligned(out_mem); for(uword i=0; i::apply(AA[i]) * upgrade_val::apply(BB[i]); } } else { for(uword i=0; i::apply(AA[i]) * upgrade_val::apply(BB[i]); } } } else { for(uword col=0; col < n_cols; ++col) for(uword row=0; row < n_rows; ++row) { (*out_mem) = upgrade_val::apply(A.at(row,col)) * upgrade_val::apply(B.at(row,col)); out_mem++; } } } // // // //! cube addition with different element types template inline void glue_mixed_plus::apply(Cube::eT>& out, const mtGlueCube::eT, T1, T2, glue_mixed_plus>& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT1; typedef typename T2::elem_type eT2; typedef typename promote_type::result out_eT; promote_type::check(); const ProxyCube A(X.A); const ProxyCube B(X.B); arma_conform_assert_same_size(A, B, "addition"); const uword n_rows = A.get_n_rows(); const uword n_cols = A.get_n_cols(); const uword n_slices = A.get_n_slices(); out.set_size(n_rows, n_cols, n_slices); out_eT* out_mem = out.memptr(); const uword n_elem = out.n_elem; constexpr bool use_at = (ProxyCube::use_at || ProxyCube::use_at); if(use_at == false) { typename ProxyCube::ea_type AA = A.get_ea(); typename ProxyCube::ea_type BB = B.get_ea(); for(uword i=0; i::apply(AA[i]) + upgrade_val::apply(BB[i]); } } else { for(uword slice = 0; slice < n_slices; ++slice) for(uword col = 0; col < n_cols; ++col ) for(uword row = 0; row < n_rows; ++row ) { (*out_mem) = upgrade_val::apply(A.at(row,col,slice)) + upgrade_val::apply(B.at(row,col,slice)); out_mem++; } } } //! cube subtraction with different element types template inline void glue_mixed_minus::apply(Cube::eT>& out, const mtGlueCube::eT, T1, T2, glue_mixed_minus>& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT1; typedef typename T2::elem_type eT2; typedef typename promote_type::result out_eT; promote_type::check(); const ProxyCube A(X.A); const ProxyCube B(X.B); arma_conform_assert_same_size(A, B, "subtraction"); const uword n_rows = A.get_n_rows(); const uword n_cols = A.get_n_cols(); const uword n_slices = A.get_n_slices(); out.set_size(n_rows, n_cols, n_slices); out_eT* out_mem = out.memptr(); const uword n_elem = out.n_elem; constexpr bool use_at = (ProxyCube::use_at || ProxyCube::use_at); if(use_at == false) { typename ProxyCube::ea_type AA = A.get_ea(); typename ProxyCube::ea_type BB = B.get_ea(); for(uword i=0; i::apply(AA[i]) - upgrade_val::apply(BB[i]); } } else { for(uword slice = 0; slice < n_slices; ++slice) for(uword col = 0; col < n_cols; ++col ) for(uword row = 0; row < n_rows; ++row ) { (*out_mem) = upgrade_val::apply(A.at(row,col,slice)) - upgrade_val::apply(B.at(row,col,slice)); out_mem++; } } } //! element-wise cube division with different element types template inline void glue_mixed_div::apply(Cube::eT>& out, const mtGlueCube::eT, T1, T2, glue_mixed_div>& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT1; typedef typename T2::elem_type eT2; typedef typename promote_type::result out_eT; promote_type::check(); const ProxyCube A(X.A); const ProxyCube B(X.B); arma_conform_assert_same_size(A, B, "element-wise division"); const uword n_rows = A.get_n_rows(); const uword n_cols = A.get_n_cols(); const uword n_slices = A.get_n_slices(); out.set_size(n_rows, n_cols, n_slices); out_eT* out_mem = out.memptr(); const uword n_elem = out.n_elem; constexpr bool use_at = (ProxyCube::use_at || ProxyCube::use_at); if(use_at == false) { typename ProxyCube::ea_type AA = A.get_ea(); typename ProxyCube::ea_type BB = B.get_ea(); for(uword i=0; i::apply(AA[i]) / upgrade_val::apply(BB[i]); } } else { for(uword slice = 0; slice < n_slices; ++slice) for(uword col = 0; col < n_cols; ++col ) for(uword row = 0; row < n_rows; ++row ) { (*out_mem) = upgrade_val::apply(A.at(row,col,slice)) / upgrade_val::apply(B.at(row,col,slice)); out_mem++; } } } //! element-wise cube multiplication with different element types template inline void glue_mixed_schur::apply(Cube::eT>& out, const mtGlueCube::eT, T1, T2, glue_mixed_schur>& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT1; typedef typename T2::elem_type eT2; typedef typename promote_type::result out_eT; promote_type::check(); const ProxyCube A(X.A); const ProxyCube B(X.B); arma_conform_assert_same_size(A, B, "element-wise multiplication"); const uword n_rows = A.get_n_rows(); const uword n_cols = A.get_n_cols(); const uword n_slices = A.get_n_slices(); out.set_size(n_rows, n_cols, n_slices); out_eT* out_mem = out.memptr(); const uword n_elem = out.n_elem; constexpr bool use_at = (ProxyCube::use_at || ProxyCube::use_at); if(use_at == false) { typename ProxyCube::ea_type AA = A.get_ea(); typename ProxyCube::ea_type BB = B.get_ea(); for(uword i=0; i::apply(AA[i]) * upgrade_val::apply(BB[i]); } } else { for(uword slice = 0; slice < n_slices; ++slice) for(uword col = 0; col < n_cols; ++col ) for(uword row = 0; row < n_rows; ++row ) { (*out_mem) = upgrade_val::apply(A.at(row,col,slice)) * upgrade_val::apply(B.at(row,col,slice)); out_mem++; } } } //! @} RcppArmadillo/inst/include/armadillo_bits/op_cx_scalar_meat.hpp0000644000176200001440000003001714631567470024562 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_cx_scalar //! @{ template inline void op_cx_scalar_times::apply ( Mat< typename std::complex >& out, const mtOp, T1, op_cx_scalar_times>& X ) { arma_debug_sigprint(); typedef typename std::complex eT; const Proxy A(X.m); const uword n_rows = A.get_n_rows(); const uword n_cols = A.get_n_cols(); out.set_size(n_rows, n_cols); const eT k = X.aux_out_eT; eT* out_mem = out.memptr(); if(Proxy::use_at == false) { const uword n_elem = A.get_n_elem(); for(uword i=0; i inline void op_cx_scalar_plus::apply ( Mat< typename std::complex >& out, const mtOp, T1, op_cx_scalar_plus>& X ) { arma_debug_sigprint(); typedef typename std::complex eT; const Proxy A(X.m); const uword n_rows = A.get_n_rows(); const uword n_cols = A.get_n_cols(); out.set_size(n_rows, n_cols); const eT k = X.aux_out_eT; eT* out_mem = out.memptr(); if(Proxy::use_at == false) { const uword n_elem = A.get_n_elem(); for(uword i=0; i inline void op_cx_scalar_minus_pre::apply ( Mat< typename std::complex >& out, const mtOp, T1, op_cx_scalar_minus_pre>& X ) { arma_debug_sigprint(); typedef typename std::complex eT; const Proxy A(X.m); const uword n_rows = A.get_n_rows(); const uword n_cols = A.get_n_cols(); out.set_size(n_rows, n_cols); const eT k = X.aux_out_eT; eT* out_mem = out.memptr(); if(Proxy::use_at == false) { const uword n_elem = A.get_n_elem(); for(uword i=0; i inline void op_cx_scalar_minus_post::apply ( Mat< typename std::complex >& out, const mtOp, T1, op_cx_scalar_minus_post>& X ) { arma_debug_sigprint(); typedef typename std::complex eT; const Proxy A(X.m); const uword n_rows = A.get_n_rows(); const uword n_cols = A.get_n_cols(); out.set_size(n_rows, n_cols); const eT k = X.aux_out_eT; eT* out_mem = out.memptr(); if(Proxy::use_at == false) { const uword n_elem = A.get_n_elem(); for(uword i=0; i inline void op_cx_scalar_div_pre::apply ( Mat< typename std::complex >& out, const mtOp, T1, op_cx_scalar_div_pre>& X ) { arma_debug_sigprint(); typedef typename std::complex eT; const Proxy A(X.m); const uword n_rows = A.get_n_rows(); const uword n_cols = A.get_n_cols(); out.set_size(n_rows, n_cols); const eT k = X.aux_out_eT; eT* out_mem = out.memptr(); if(Proxy::use_at == false) { const uword n_elem = A.get_n_elem(); for(uword i=0; i inline void op_cx_scalar_div_post::apply ( Mat< typename std::complex >& out, const mtOp, T1, op_cx_scalar_div_post>& X ) { arma_debug_sigprint(); typedef typename std::complex eT; const Proxy A(X.m); const uword n_rows = A.get_n_rows(); const uword n_cols = A.get_n_cols(); out.set_size(n_rows, n_cols); const eT k = X.aux_out_eT; eT* out_mem = out.memptr(); if(Proxy::use_at == false) { const uword n_elem = A.get_n_elem(); for(uword i=0; i inline void op_cx_scalar_times::apply ( Cube< typename std::complex >& out, const mtOpCube, T1, op_cx_scalar_times>& X ) { arma_debug_sigprint(); typedef typename std::complex eT; const ProxyCube A(X.m); const uword n_rows = A.get_n_rows(); const uword n_cols = A.get_n_cols(); const uword n_slices = A.get_n_slices(); out.set_size(n_rows, n_cols, n_slices); const eT k = X.aux_out_eT; const uword n_elem = out.n_elem; eT* out_mem = out.memptr(); if(ProxyCube::use_at == false) { for(uword i=0; i inline void op_cx_scalar_plus::apply ( Cube< typename std::complex >& out, const mtOpCube, T1, op_cx_scalar_plus>& X ) { arma_debug_sigprint(); typedef typename std::complex eT; const ProxyCube A(X.m); const uword n_rows = A.get_n_rows(); const uword n_cols = A.get_n_cols(); const uword n_slices = A.get_n_slices(); out.set_size(n_rows, n_cols, n_slices); const eT k = X.aux_out_eT; const uword n_elem = out.n_elem; eT* out_mem = out.memptr(); if(ProxyCube::use_at == false) { for(uword i=0; i inline void op_cx_scalar_minus_pre::apply ( Cube< typename std::complex >& out, const mtOpCube, T1, op_cx_scalar_minus_pre>& X ) { arma_debug_sigprint(); typedef typename std::complex eT; const ProxyCube A(X.m); const uword n_rows = A.get_n_rows(); const uword n_cols = A.get_n_cols(); const uword n_slices = A.get_n_slices(); out.set_size(n_rows, n_cols, n_slices); const eT k = X.aux_out_eT; const uword n_elem = out.n_elem; eT* out_mem = out.memptr(); if(ProxyCube::use_at == false) { for(uword i=0; i inline void op_cx_scalar_minus_post::apply ( Cube< typename std::complex >& out, const mtOpCube, T1, op_cx_scalar_minus_post>& X ) { arma_debug_sigprint(); typedef typename std::complex eT; const ProxyCube A(X.m); const uword n_rows = A.get_n_rows(); const uword n_cols = A.get_n_cols(); const uword n_slices = A.get_n_slices(); out.set_size(n_rows, n_cols, n_slices); const eT k = X.aux_out_eT; const uword n_elem = out.n_elem; eT* out_mem = out.memptr(); if(ProxyCube::use_at == false) { for(uword i=0; i inline void op_cx_scalar_div_pre::apply ( Cube< typename std::complex >& out, const mtOpCube, T1, op_cx_scalar_div_pre>& X ) { arma_debug_sigprint(); typedef typename std::complex eT; const ProxyCube A(X.m); const uword n_rows = A.get_n_rows(); const uword n_cols = A.get_n_cols(); const uword n_slices = A.get_n_slices(); out.set_size(n_rows, n_cols, n_slices); const eT k = X.aux_out_eT; const uword n_elem = out.n_elem; eT* out_mem = out.memptr(); if(ProxyCube::use_at == false) { for(uword i=0; i inline void op_cx_scalar_div_post::apply ( Cube< typename std::complex >& out, const mtOpCube, T1, op_cx_scalar_div_post>& X ) { arma_debug_sigprint(); typedef typename std::complex eT; const ProxyCube A(X.m); const uword n_rows = A.get_n_rows(); const uword n_cols = A.get_n_cols(); const uword n_slices = A.get_n_slices(); out.set_size(n_rows, n_cols, n_slices); const eT k = X.aux_out_eT; const uword n_elem = out.n_elem; eT* out_mem = out.memptr(); if(ProxyCube::use_at == false) { for(uword i=0; i. // For real calls, rwork is ignored; it's only necessary in the complex case. template inline void naupd(blas_int* ido, char* bmat, blas_int* n, char* which, blas_int* nev, eeT* tol, eT* resid, blas_int* ncv, eT* v, blas_int* ldv, blas_int* iparam, blas_int* ipntr, eT* workd, eT* workl, blas_int* lworkl, eeT* rwork, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_float::value) { typedef float T; arma_ignore(rwork); arma_fortran(arma_snaupd)(ido, bmat, n, which, nev, (T*) tol, (T*) resid, ncv, (T*) v, ldv, iparam, ipntr, (T*) workd, (T*) workl, lworkl, info, 1, 1); } else if( is_double::value) { typedef double T; arma_ignore(rwork); arma_fortran(arma_dnaupd)(ido, bmat, n, which, nev, (T*) tol, (T*) resid, ncv, (T*) v, ldv, iparam, ipntr, (T*) workd, (T*) workl, lworkl, info, 1, 1); } else if( is_cx_float::value) { typedef cx_float T; typedef float xT; arma_fortran(arma_cnaupd)(ido, bmat, n, which, nev, (xT*) tol, (T*) resid, ncv, (T*) v, ldv, iparam, ipntr, (T*) workd, (T*) workl, lworkl, (xT*) rwork, info, 1, 1); } else if(is_cx_double::value) { typedef cx_double T; typedef double xT; arma_fortran(arma_znaupd)(ido, bmat, n, which, nev, (xT*) tol, (T*) resid, ncv, (T*) v, ldv, iparam, ipntr, (T*) workd, (T*) workl, lworkl, (xT*) rwork, info, 1, 1); } #else if( is_float::value) { typedef float T; arma_ignore(rwork); arma_fortran(arma_snaupd)(ido, bmat, n, which, nev, (T*) tol, (T*) resid, ncv, (T*) v, ldv, iparam, ipntr, (T*) workd, (T*) workl, lworkl, info); } else if( is_double::value) { typedef double T; arma_ignore(rwork); arma_fortran(arma_dnaupd)(ido, bmat, n, which, nev, (T*) tol, (T*) resid, ncv, (T*) v, ldv, iparam, ipntr, (T*) workd, (T*) workl, lworkl, info); } else if( is_cx_float::value) { typedef cx_float T; typedef float xT; arma_fortran(arma_cnaupd)(ido, bmat, n, which, nev, (xT*) tol, (T*) resid, ncv, (T*) v, ldv, iparam, ipntr, (T*) workd, (T*) workl, lworkl, (xT*) rwork, info); } else if(is_cx_double::value) { typedef cx_double T; typedef double xT; arma_fortran(arma_znaupd)(ido, bmat, n, which, nev, (xT*) tol, (T*) resid, ncv, (T*) v, ldv, iparam, ipntr, (T*) workd, (T*) workl, lworkl, (xT*) rwork, info); } #endif } //! The use of two template types is necessary here because the compiler will //! instantiate this method for complex types (where eT != eeT) but that in //! practice that is never actually used. template inline void saupd(blas_int* ido, char* bmat, blas_int* n, char* which, blas_int* nev, eeT* tol, eT* resid, blas_int* ncv, eT* v, blas_int* ldv, blas_int* iparam, blas_int* ipntr, eT* workd, eT* workl, blas_int* lworkl, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_float::value) { typedef float T; arma_fortran(arma_ssaupd)(ido, bmat, n, which, nev, (T*) tol, (T*) resid, ncv, (T*) v, ldv, iparam, ipntr, (T*) workd, (T*) workl, lworkl, info, 1, 1); } else if(is_double::value) { typedef double T; arma_fortran(arma_dsaupd)(ido, bmat, n, which, nev, (T*) tol, (T*) resid, ncv, (T*) v, ldv, iparam, ipntr, (T*) workd, (T*) workl, lworkl, info, 1, 1); } #else if( is_float::value) { typedef float T; arma_fortran(arma_ssaupd)(ido, bmat, n, which, nev, (T*) tol, (T*) resid, ncv, (T*) v, ldv, iparam, ipntr, (T*) workd, (T*) workl, lworkl, info); } else if(is_double::value) { typedef double T; arma_fortran(arma_dsaupd)(ido, bmat, n, which, nev, (T*) tol, (T*) resid, ncv, (T*) v, ldv, iparam, ipntr, (T*) workd, (T*) workl, lworkl, info); } #endif } template inline void seupd(blas_int* rvec, char* howmny, blas_int* select, eT* d, eT* z, blas_int* ldz, eT* sigma, char* bmat, blas_int* n, char* which, blas_int* nev, eT* tol, eT* resid, blas_int* ncv, eT* v, blas_int* ldv, blas_int* iparam, blas_int* ipntr, eT* workd, eT* workl, blas_int* lworkl, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_float::value) { typedef float T; arma_fortran(arma_sseupd)(rvec, howmny, select, (T*) d, (T*) z, ldz, (T*) sigma, bmat, n, which, nev, (T*) tol, (T*) resid, ncv, (T*) v, ldv, iparam, ipntr, (T*) workd, (T*) workl, lworkl, info, 1, 1, 1); } else if(is_double::value) { typedef double T; arma_fortran(arma_dseupd)(rvec, howmny, select, (T*) d, (T*) z, ldz, (T*) sigma, bmat, n, which, nev, (T*) tol, (T*) resid, ncv, (T*) v, ldv, iparam, ipntr, (T*) workd, (T*) workl, lworkl, info, 1, 1, 1); } #else if( is_float::value) { typedef float T; arma_fortran(arma_sseupd)(rvec, howmny, select, (T*) d, (T*) z, ldz, (T*) sigma, bmat, n, which, nev, (T*) tol, (T*) resid, ncv, (T*) v, ldv, iparam, ipntr, (T*) workd, (T*) workl, lworkl, info); } else if(is_double::value) { typedef double T; arma_fortran(arma_dseupd)(rvec, howmny, select, (T*) d, (T*) z, ldz, (T*) sigma, bmat, n, which, nev, (T*) tol, (T*) resid, ncv, (T*) v, ldv, iparam, ipntr, (T*) workd, (T*) workl, lworkl, info); } #endif } // for complex versions, pass d for dr, and null for di; pass sigma for // sigmar, and null for sigmai; rwork isn't used for non-complex versions template inline void neupd(blas_int* rvec, char* howmny, blas_int* select, eT* dr, eT* di, eT* z, blas_int* ldz, eT* sigmar, eT* sigmai, eT* workev, char* bmat, blas_int* n, char* which, blas_int* nev, eeT* tol, eT* resid, blas_int* ncv, eT* v, blas_int* ldv, blas_int* iparam, blas_int* ipntr, eT* workd, eT* workl, blas_int* lworkl, eeT* rwork, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_float::value) { typedef float T; arma_ignore(rwork); arma_fortran(arma_sneupd)(rvec, howmny, select, (T*) dr, (T*) di, (T*) z, ldz, (T*) sigmar, (T*) sigmai, (T*) workev, bmat, n, which, nev, (T*) tol, (T*) resid, ncv, (T*) v, ldv, iparam, ipntr, (T*) workd, (T*) workl, lworkl, info, 1, 1, 1); } else if( is_double::value) { typedef double T; arma_ignore(rwork); arma_fortran(arma_dneupd)(rvec, howmny, select, (T*) dr, (T*) di, (T*) z, ldz, (T*) sigmar, (T*) sigmai, (T*) workev, bmat, n, which, nev, (T*) tol, (T*) resid, ncv, (T*) v, ldv, iparam, ipntr, (T*) workd, (T*) workl, lworkl, info, 1, 1, 1); } else if( is_cx_float::value) { typedef cx_float T; typedef float xT; arma_fortran(arma_cneupd)(rvec, howmny, select, (T*) dr, (T*) z, ldz, (T*) sigmar, (T*) workev, bmat, n, which, nev, (xT*) tol, (T*) resid, ncv, (T*) v, ldv, iparam, ipntr, (T*) workd, (T*) workl, lworkl, (xT*) rwork, info, 1, 1, 1); } else if(is_cx_double::value) { typedef cx_double T; typedef double xT; arma_fortran(arma_zneupd)(rvec, howmny, select, (T*) dr, (T*) z, ldz, (T*) sigmar, (T*) workev, bmat, n, which, nev, (xT*) tol, (T*) resid, ncv, (T*) v, ldv, iparam, ipntr, (T*) workd, (T*) workl, lworkl, (xT*) rwork, info, 1, 1, 1); } #else if( is_float::value) { typedef float T; arma_ignore(rwork); arma_fortran(arma_sneupd)(rvec, howmny, select, (T*) dr, (T*) di, (T*) z, ldz, (T*) sigmar, (T*) sigmai, (T*) workev, bmat, n, which, nev, (T*) tol, (T*) resid, ncv, (T*) v, ldv, iparam, ipntr, (T*) workd, (T*) workl, lworkl, info); } else if( is_double::value) { typedef double T; arma_ignore(rwork); arma_fortran(arma_dneupd)(rvec, howmny, select, (T*) dr, (T*) di, (T*) z, ldz, (T*) sigmar, (T*) sigmai, (T*) workev, bmat, n, which, nev, (T*) tol, (T*) resid, ncv, (T*) v, ldv, iparam, ipntr, (T*) workd, (T*) workl, lworkl, info); } else if( is_cx_float::value) { typedef cx_float T; typedef float xT; arma_fortran(arma_cneupd)(rvec, howmny, select, (T*) dr, (T*) z, ldz, (T*) sigmar, (T*) workev, bmat, n, which, nev, (xT*) tol, (T*) resid, ncv, (T*) v, ldv, iparam, ipntr, (T*) workd, (T*) workl, lworkl, (xT*) rwork, info); } else if(is_cx_double::value) { typedef cx_double T; typedef double xT; arma_fortran(arma_zneupd)(rvec, howmny, select, (T*) dr, (T*) z, ldz, (T*) sigmar, (T*) workev, bmat, n, which, nev, (xT*) tol, (T*) resid, ncv, (T*) v, ldv, iparam, ipntr, (T*) workd, (T*) workl, lworkl, (xT*) rwork, info); } #endif } } // namespace arpack #endif RcppArmadillo/inst/include/armadillo_bits/mtOp_bones.hpp0000644000176200001440000000462214752446051023222 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup mtOp //! @{ struct mtOp_dual_aux_indicator {}; template class mtOp : public Base< out_eT, mtOp > { public: typedef out_eT elem_type; typedef typename get_pod_type::result pod_type; typedef typename T1::elem_type in_eT; static constexpr bool is_row = op_type::template traits::is_row; static constexpr bool is_col = op_type::template traits::is_col; static constexpr bool is_xvec = op_type::template traits::is_xvec; inline explicit mtOp(const T1& in_m); inline mtOp(const T1& in_m, const in_eT in_aux); inline mtOp(const T1& in_m, const uword in_aux_uword_a, const uword in_aux_uword_b); inline mtOp(const T1& in_m, const in_eT in_aux, const uword in_aux_uword_a, const uword in_aux_uword_b); inline mtOp(const char junk, const T1& in_m, const out_eT in_aux); inline mtOp(const mtOp_dual_aux_indicator&, const T1& in_m, const in_eT in_aux_a, const out_eT in_aux_b); inline ~mtOp(); template inline bool is_alias(const Mat& X) const; const T1& m; //!< the operand; must be derived from Base in_eT aux; //!< auxiliary data, using the element type as used by T1 out_eT aux_out_eT; //!< auxiliary data, using the element type as specified by the out_eT template parameter uword aux_uword_a; //!< auxiliary data, uword format uword aux_uword_b; //!< auxiliary data, uword format }; //! @} RcppArmadillo/inst/include/armadillo_bits/def_lapack.hpp0000644000176200001440000036560715030507611023171 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ #if defined(ARMA_USE_LAPACK) #if defined(dgetrf) || defined(DGETRF) #pragma message ("WARNING: detected possible interference with definitions of LAPACK functions;") #pragma message ("WARNING: include the armadillo header before any other header as a workaround") #endif #if defined(ARMA_LAPACK_NOEXCEPT) #undef ARMA_NOEXCEPT #define ARMA_NOEXCEPT noexcept #else #undef ARMA_NOEXCEPT #define ARMA_NOEXCEPT #endif #if !defined(ARMA_BLAS_CAPITALS) #define arma_sgetrf sgetrf #define arma_dgetrf dgetrf #define arma_cgetrf cgetrf #define arma_zgetrf zgetrf #define arma_sgetrs sgetrs #define arma_dgetrs dgetrs #define arma_cgetrs cgetrs #define arma_zgetrs zgetrs #define arma_sgetri sgetri #define arma_dgetri dgetri #define arma_cgetri cgetri #define arma_zgetri zgetri #define arma_strtri strtri #define arma_dtrtri dtrtri #define arma_ctrtri ctrtri #define arma_ztrtri ztrtri #define arma_sgeev sgeev #define arma_dgeev dgeev #define arma_cgeev cgeev #define arma_zgeev zgeev #define arma_sgeevx sgeevx #define arma_dgeevx dgeevx #define arma_cgeevx cgeevx #define arma_zgeevx zgeevx #define arma_ssyev ssyev #define arma_dsyev dsyev #define arma_cheev cheev #define arma_zheev zheev #define arma_ssyevd ssyevd #define arma_dsyevd dsyevd #define arma_cheevd cheevd #define arma_zheevd zheevd #define arma_sggev sggev #define arma_dggev dggev #define arma_cggev cggev #define arma_zggev zggev #define arma_spotrf spotrf #define arma_dpotrf dpotrf #define arma_cpotrf cpotrf #define arma_zpotrf zpotrf #define arma_spotrs spotrs #define arma_dpotrs dpotrs #define arma_cpotrs cpotrs #define arma_zpotrs zpotrs #define arma_spbtrf spbtrf #define arma_dpbtrf dpbtrf #define arma_cpbtrf cpbtrf #define arma_zpbtrf zpbtrf #define arma_spotri spotri #define arma_dpotri dpotri #define arma_cpotri cpotri #define arma_zpotri zpotri #define arma_sgeqrf sgeqrf #define arma_dgeqrf dgeqrf #define arma_cgeqrf cgeqrf #define arma_zgeqrf zgeqrf #define arma_sgeqp3 sgeqp3 #define arma_dgeqp3 dgeqp3 #define arma_cgeqp3 cgeqp3 #define arma_zgeqp3 zgeqp3 #define arma_sorgqr sorgqr #define arma_dorgqr dorgqr #define arma_cungqr cungqr #define arma_zungqr zungqr #define arma_sgesvd sgesvd #define arma_dgesvd dgesvd #define arma_cgesvd cgesvd #define arma_zgesvd zgesvd #define arma_sgesdd sgesdd #define arma_dgesdd dgesdd #define arma_cgesdd cgesdd #define arma_zgesdd zgesdd #define arma_sgesv sgesv #define arma_dgesv dgesv #define arma_cgesv cgesv #define arma_zgesv zgesv #define arma_sgesvx sgesvx #define arma_dgesvx dgesvx #define arma_cgesvx cgesvx #define arma_zgesvx zgesvx #define arma_sposv sposv #define arma_dposv dposv #define arma_cposv cposv #define arma_zposv zposv #define arma_sposvx sposvx #define arma_dposvx dposvx #define arma_cposvx cposvx #define arma_zposvx zposvx #define arma_sgels sgels #define arma_dgels dgels #define arma_cgels cgels #define arma_zgels zgels #define arma_sgelsd sgelsd #define arma_dgelsd dgelsd #define arma_cgelsd cgelsd #define arma_zgelsd zgelsd #define arma_strtrs strtrs #define arma_dtrtrs dtrtrs #define arma_ctrtrs ctrtrs #define arma_ztrtrs ztrtrs #define arma_sgbtrf sgbtrf #define arma_dgbtrf dgbtrf #define arma_cgbtrf cgbtrf #define arma_zgbtrf zgbtrf #define arma_sgbtrs sgbtrs #define arma_dgbtrs dgbtrs #define arma_cgbtrs cgbtrs #define arma_zgbtrs zgbtrs #define arma_sgbsv sgbsv #define arma_dgbsv dgbsv #define arma_cgbsv cgbsv #define arma_zgbsv zgbsv #define arma_sgbsvx sgbsvx #define arma_dgbsvx dgbsvx #define arma_cgbsvx cgbsvx #define arma_zgbsvx zgbsvx #define arma_sgtsv sgtsv #define arma_dgtsv dgtsv #define arma_cgtsv cgtsv #define arma_zgtsv zgtsv #define arma_sgtsvx sgtsvx #define arma_dgtsvx dgtsvx #define arma_cgtsvx cgtsvx #define arma_zgtsvx zgtsvx #define arma_sgees sgees #define arma_dgees dgees #define arma_cgees cgees #define arma_zgees zgees #define arma_strsyl strsyl #define arma_dtrsyl dtrsyl #define arma_ctrsyl ctrsyl #define arma_ztrsyl ztrsyl #define arma_sgges sgges #define arma_dgges dgges #define arma_cgges cgges #define arma_zgges zgges #define arma_slange slange #define arma_dlange dlange #define arma_clange clange #define arma_zlange zlange #define arma_slansy slansy #define arma_dlansy dlansy #define arma_clansy clansy #define arma_zlansy zlansy #define arma_clanhe clanhe #define arma_zlanhe zlanhe #define arma_slangb slangb #define arma_dlangb dlangb #define arma_clangb clangb #define arma_zlangb zlangb #define arma_sgecon sgecon #define arma_dgecon dgecon #define arma_cgecon cgecon #define arma_zgecon zgecon #define arma_spocon spocon #define arma_dpocon dpocon #define arma_cpocon cpocon #define arma_zpocon zpocon #define arma_strcon strcon #define arma_dtrcon dtrcon #define arma_ctrcon ctrcon #define arma_ztrcon ztrcon #define arma_sgbcon sgbcon #define arma_dgbcon dgbcon #define arma_cgbcon cgbcon #define arma_zgbcon zgbcon #define arma_ilaenv ilaenv #define arma_slahqr slahqr #define arma_dlahqr dlahqr #define arma_sstedc sstedc #define arma_dstedc dstedc #define arma_strevc strevc #define arma_dtrevc dtrevc #define arma_sgehrd sgehrd #define arma_dgehrd dgehrd #define arma_cgehrd cgehrd #define arma_zgehrd zgehrd #define arma_spstrf spstrf #define arma_dpstrf dpstrf #define arma_cpstrf cpstrf #define arma_zpstrf zpstrf #define arma_ssytrf ssytrf #define arma_dsytrf dsytrf #define arma_chetrf chetrf #define arma_zhetrf zhetrf #define arma_ssytrs ssytrs #define arma_dsytrs dsytrs #define arma_chetrs chetrs #define arma_zhetrs zhetrs #define arma_ssytri ssytri #define arma_dsytri dsytri #define arma_chetri chetri #define arma_zhetri zhetri #define arma_ssycon ssycon #define arma_dsycon dsycon #define arma_checon checon #define arma_zhecon zhecon #define arma_sgebal sgebal #define arma_dgebal dgebal #define arma_cgebal cgebal #define arma_zgebal zgebal #else #define arma_sgetrf SGETRF #define arma_dgetrf DGETRF #define arma_cgetrf CGETRF #define arma_zgetrf ZGETRF #define arma_sgetrs SGETRS #define arma_dgetrs DGETRS #define arma_cgetrs CGETRS #define arma_zgetrs ZGETRS #define arma_sgetri SGETRI #define arma_dgetri DGETRI #define arma_cgetri CGETRI #define arma_zgetri ZGETRI #define arma_strtri STRTRI #define arma_dtrtri DTRTRI #define arma_ctrtri CTRTRI #define arma_ztrtri ZTRTRI #define arma_sgeev SGEEV #define arma_dgeev DGEEV #define arma_cgeev CGEEV #define arma_zgeev ZGEEV #define arma_sgeevx SGEEVX #define arma_dgeevx DGEEVX #define arma_cgeevx CGEEVX #define arma_zgeevx ZGEEVX #define arma_ssyev SSYEV #define arma_dsyev DSYEV #define arma_cheev CHEEV #define arma_zheev ZHEEV #define arma_ssyevd SSYEVD #define arma_dsyevd DSYEVD #define arma_cheevd CHEEVD #define arma_zheevd ZHEEVD #define arma_sggev SGGEV #define arma_dggev DGGEV #define arma_cggev CGGEV #define arma_zggev ZGGEV #define arma_spotrf SPOTRF #define arma_dpotrf DPOTRF #define arma_cpotrf CPOTRF #define arma_zpotrf ZPOTRF #define arma_spotrs SPOTRS #define arma_dpotrs DPOTRS #define arma_cpotrs CPOTRS #define arma_zpotrs ZPOTRS #define arma_spbtrf SPBTRF #define arma_dpbtrf DPBTRF #define arma_cpbtrf CPBTRF #define arma_zpbtrf ZPBTRF #define arma_spotri SPOTRI #define arma_dpotri DPOTRI #define arma_cpotri CPOTRI #define arma_zpotri ZPOTRI #define arma_sgeqrf SGEQRF #define arma_dgeqrf DGEQRF #define arma_cgeqrf CGEQRF #define arma_zgeqrf ZGEQRF #define arma_sgeqp3 SGEQP3 #define arma_dgeqp3 DGEQP3 #define arma_cgeqp3 CGEQP3 #define arma_zgeqp3 ZGEQP3 #define arma_sorgqr SORGQR #define arma_dorgqr DORGQR #define arma_cungqr CUNGQR #define arma_zungqr ZUNGQR #define arma_sgesvd SGESVD #define arma_dgesvd DGESVD #define arma_cgesvd CGESVD #define arma_zgesvd ZGESVD #define arma_sgesdd SGESDD #define arma_dgesdd DGESDD #define arma_cgesdd CGESDD #define arma_zgesdd ZGESDD #define arma_sgesv SGESV #define arma_dgesv DGESV #define arma_cgesv CGESV #define arma_zgesv ZGESV #define arma_sgesvx SGESVX #define arma_dgesvx DGESVX #define arma_cgesvx CGESVX #define arma_zgesvx ZGESVX #define arma_sposv SPOSV #define arma_dposv DPOSV #define arma_cposv CPOSV #define arma_zposv ZPOSV #define arma_sposvx SPOSVX #define arma_dposvx DPOSVX #define arma_cposvx CPOSVX #define arma_zposvx ZPOSVX #define arma_sgels SGELS #define arma_dgels DGELS #define arma_cgels CGELS #define arma_zgels ZGELS #define arma_sgelsd SGELSD #define arma_dgelsd DGELSD #define arma_cgelsd CGELSD #define arma_zgelsd ZGELSD #define arma_strtrs STRTRS #define arma_dtrtrs DTRTRS #define arma_ctrtrs CTRTRS #define arma_ztrtrs ZTRTRS #define arma_sgbtrf SGBTRF #define arma_dgbtrf DGBTRF #define arma_cgbtrf CGBTRF #define arma_zgbtrf ZGBTRF #define arma_sgbtrs SGBTRS #define arma_dgbtrs DGBTRS #define arma_cgbtrs CGBTRS #define arma_zgbtrs ZGBTRS #define arma_sgbsv SGBSV #define arma_dgbsv DGBSV #define arma_cgbsv CGBSV #define arma_zgbsv ZGBSV #define arma_sgbsvx SGBSVX #define arma_dgbsvx DGBSVX #define arma_cgbsvx CGBSVX #define arma_zgbsvx ZGBSVX #define arma_sgtsv SGTSV #define arma_dgtsv DGTSV #define arma_cgtsv CGTSV #define arma_zgtsv ZGTSV #define arma_sgtsvx SGTSVX #define arma_dgtsvx DGTSVX #define arma_cgtsvx CGTSVX #define arma_zgtsvx ZGTSVX #define arma_sgees SGEES #define arma_dgees DGEES #define arma_cgees CGEES #define arma_zgees ZGEES #define arma_strsyl STRSYL #define arma_dtrsyl DTRSYL #define arma_ctrsyl CTRSYL #define arma_ztrsyl ZTRSYL #define arma_sgges SGGES #define arma_dgges DGGES #define arma_cgges CGGES #define arma_zgges ZGGES #define arma_slange SLANGE #define arma_dlange DLANGE #define arma_clange CLANGE #define arma_zlange ZLANGE #define arma_slansy SLANSY #define arma_dlansy DLANSY #define arma_clansy CLANSY #define arma_zlansy ZLANSY #define arma_clanhe CLANHE #define arma_zlanhe ZLANHE #define arma_slangb SLANGB #define arma_dlangb DLANGB #define arma_clangb CLANGB #define arma_zlangb ZLANGB #define arma_sgecon SGECON #define arma_dgecon DGECON #define arma_cgecon CGECON #define arma_zgecon ZGECON #define arma_spocon SPOCON #define arma_dpocon DPOCON #define arma_cpocon CPOCON #define arma_zpocon ZPOCON #define arma_strcon STRCON #define arma_dtrcon DTRCON #define arma_ctrcon CTRCON #define arma_ztrcon ZTRCON #define arma_sgbcon SGBCON #define arma_dgbcon DGBCON #define arma_cgbcon CGBCON #define arma_zgbcon ZGBCON #define arma_ilaenv ILAENV #define arma_slahqr SLAHQR #define arma_dlahqr DLAHQR #define arma_sstedc SSTEDC #define arma_dstedc DSTEDC #define arma_strevc STREVC #define arma_dtrevc DTREVC #define arma_sgehrd SGEHRD #define arma_dgehrd DGEHRD #define arma_cgehrd CGEHRD #define arma_zgehrd ZGEHRD #define arma_spstrf SPSTRF #define arma_dpstrf DPSTRF #define arma_cpstrf CPSTRF #define arma_zpstrf ZPSTRF #define arma_ssytrf SSYTRF #define arma_dsytrf DSYTRF #define arma_chetrf CHETRF #define arma_zhetrf ZHETRF #define arma_ssytrs SSYTRS #define arma_dsytrs DSYTRS #define arma_chetrs CHETRS #define arma_zhetrs ZHETRS #define arma_ssytri SSYTRI #define arma_dsytri DSYTRI #define arma_chetri CHETRI #define arma_zhetri ZHETRI #define arma_ssycon SSYCON #define arma_dsycon DSYCON #define arma_checon CHECON #define arma_zhecon ZHECON #define arma_sgebal SGEBAL #define arma_dgebal DGEBAL #define arma_cgebal CGEBAL #define arma_zgebal ZGEBAL #endif typedef blas_int (*fn_select_s2) (const float*, const float* ); typedef blas_int (*fn_select_s3) (const float*, const float*, const float*); typedef blas_int (*fn_select_d2) (const double*, const double* ); typedef blas_int (*fn_select_d3) (const double*, const double*, const double*); typedef blas_int (*fn_select_c1) (const blas_cxf* ); typedef blas_int (*fn_select_c2) (const blas_cxf*, const blas_cxf*); typedef blas_int (*fn_select_z1) (const blas_cxd* ); typedef blas_int (*fn_select_z2) (const blas_cxd*, const blas_cxd*); // NOTE: "For arguments of CHARACTER type, the character length is passed as a hidden argument at the end of the argument list." // NOTE: https://gcc.gnu.org/onlinedocs/gfortran/Argument-passing-conventions.html extern "C" { #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) // LU decomposition void arma_fortran(arma_sgetrf)(const blas_int* m, const blas_int* n, float* a, const blas_int* lda, blas_int* ipiv, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dgetrf)(const blas_int* m, const blas_int* n, double* a, const blas_int* lda, blas_int* ipiv, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_cgetrf)(const blas_int* m, const blas_int* n, blas_cxf* a, const blas_int* lda, blas_int* ipiv, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_zgetrf)(const blas_int* m, const blas_int* n, blas_cxd* a, const blas_int* lda, blas_int* ipiv, blas_int* info) ARMA_NOEXCEPT; // solve system of linear equations using pre-computed LU decomposition void arma_fortran(arma_sgetrs)(const char* trans, const blas_int* n, const blas_int* nrhs, const float* a, const blas_int* lda, const blas_int* ipiv, float* b, const blas_int* ldb, blas_int* info, const blas_len trans_len) ARMA_NOEXCEPT; void arma_fortran(arma_dgetrs)(const char* trans, const blas_int* n, const blas_int* nrhs, const double* a, const blas_int* lda, const blas_int* ipiv, double* b, const blas_int* ldb, blas_int* info, const blas_len trans_len) ARMA_NOEXCEPT; void arma_fortran(arma_cgetrs)(const char* trans, const blas_int* n, const blas_int* nrhs, const blas_cxf* a, const blas_int* lda, const blas_int* ipiv, blas_cxf* b, const blas_int* ldb, blas_int* info, const blas_len trans_len) ARMA_NOEXCEPT; void arma_fortran(arma_zgetrs)(const char* trans, const blas_int* n, const blas_int* nrhs, const blas_cxd* a, const blas_int* lda, const blas_int* ipiv, blas_cxd* b, const blas_int* ldb, blas_int* info, const blas_len trans_len) ARMA_NOEXCEPT; // matrix inversion (using pre-computed LU decomposition) void arma_fortran(arma_sgetri)(const blas_int* n, float* a, const blas_int* lda, const blas_int* ipiv, float* work, const blas_int* lwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dgetri)(const blas_int* n, double* a, const blas_int* lda, const blas_int* ipiv, double* work, const blas_int* lwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_cgetri)(const blas_int* n, blas_cxf* a, const blas_int* lda, const blas_int* ipiv, blas_cxf* work, const blas_int* lwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_zgetri)(const blas_int* n, blas_cxd* a, const blas_int* lda, const blas_int* ipiv, blas_cxd* work, const blas_int* lwork, blas_int* info) ARMA_NOEXCEPT; // matrix inversion (triangular matrices) void arma_fortran(arma_strtri)(const char* uplo, const char* diag, const blas_int* n, float* a, const blas_int* lda, blas_int* info, blas_len uplo_len, blas_len diag_len) ARMA_NOEXCEPT; void arma_fortran(arma_dtrtri)(const char* uplo, const char* diag, const blas_int* n, double* a, const blas_int* lda, blas_int* info, blas_len uplo_len, blas_len diag_len) ARMA_NOEXCEPT; void arma_fortran(arma_ctrtri)(const char* uplo, const char* diag, const blas_int* n, blas_cxf* a, const blas_int* lda, blas_int* info, blas_len uplo_len, blas_len diag_len) ARMA_NOEXCEPT; void arma_fortran(arma_ztrtri)(const char* uplo, const char* diag, const blas_int* n, blas_cxd* a, const blas_int* lda, blas_int* info, blas_len uplo_len, blas_len diag_len) ARMA_NOEXCEPT; // eigen decomposition of general matrix (real) void arma_fortran(arma_sgeev)(const char* jobvl, const char* jobvr, const blas_int* n, float* a, const blas_int* lda, float* wr, float* wi, float* vl, const blas_int* ldvl, float* vr, const blas_int* ldvr, float* work, const blas_int* lwork, blas_int* info, blas_len jobvl_len, blas_len jobvr_len) ARMA_NOEXCEPT; void arma_fortran(arma_dgeev)(const char* jobvl, const char* jobvr, const blas_int* n, double* a, const blas_int* lda, double* wr, double* wi, double* vl, const blas_int* ldvl, double* vr, const blas_int* ldvr, double* work, const blas_int* lwork, blas_int* info, blas_len jobvl_len, blas_len jobvr_len) ARMA_NOEXCEPT; // eigen decomposition of general matrix (complex) void arma_fortran(arma_cgeev)(const char* jobvl, const char* jobvr, const blas_int* n, blas_cxf* a, const blas_int* lda, blas_cxf* w, blas_cxf* vl, const blas_int* ldvl, blas_cxf* vr, const blas_int* ldvr, blas_cxf* work, const blas_int* lwork, float* rwork, blas_int* info, blas_len jobvl_len, blas_len jobvr_len) ARMA_NOEXCEPT; void arma_fortran(arma_zgeev)(const char* jobvl, const char* jobvr, const blas_int* n, blas_cxd* a, const blas_int* lda, blas_cxd* w, blas_cxd* vl, const blas_int* ldvl, blas_cxd* vr, const blas_int* ldvr, blas_cxd* work, const blas_int* lwork, double* rwork, blas_int* info, blas_len jobvl_len, blas_len jobvr_len) ARMA_NOEXCEPT; // eigen decomposition of general matrix (real; advanced form) void arma_fortran(arma_sgeevx)(const char* balanc, const char* jobvl, const char* jobvr, const char* sense, const blas_int* n, float* a, const blas_int* lda, float* wr, float* wi, float* vl, const blas_int* ldvl, float* vr, const blas_int* ldvr, blas_int* ilo, blas_int* ihi, float* scale, float* abnrm, float* rconde, float* rcondv, float* work, const blas_int* lwork, blas_int* iwork, blas_int* info, blas_len balanc_len, blas_len jobvl_len, blas_len jobvr_len, blas_len sense_len) ARMA_NOEXCEPT; void arma_fortran(arma_dgeevx)(const char* balanc, const char* jobvl, const char* jobvr, const char* sense, const blas_int* n, double* a, const blas_int* lda, double* wr, double* wi, double* vl, const blas_int* ldvl, double* vr, const blas_int* ldvr, blas_int* ilo, blas_int* ihi, double* scale, double* abnrm, double* rconde, double* rcondv, double* work, const blas_int* lwork, blas_int* iwork, blas_int* info, blas_len balanc_len, blas_len jobvl_len, blas_len jobvr_len, blas_len sense_len) ARMA_NOEXCEPT; // eigen decomposition of general matrix (complex; advanced form) void arma_fortran(arma_cgeevx)(const char* balanc, const char* jobvl, const char* jobvr, const char* sense, const blas_int* n, blas_cxf* a, const blas_int* lda, blas_cxf* w, blas_cxf* vl, const blas_int* ldvl, blas_cxf* vr, const blas_int* ldvr, blas_int* ilo, blas_int* ihi, float* scale, float* abnrm, float* rconde, float* rcondv, blas_cxf* work, const blas_int* lwork, float* rwork, const blas_int* info, blas_len balanc_len, blas_len jobvl_len, blas_len jobvr_len, blas_len sense_len) ARMA_NOEXCEPT; void arma_fortran(arma_zgeevx)(const char* balanc, const char* jobvl, const char* jobvr, const char* sense, const blas_int* n, blas_cxd* a, const blas_int* lda, blas_cxd* w, blas_cxd* vl, const blas_int* ldvl, blas_cxd* vr, const blas_int* ldvr, blas_int* ilo, blas_int* ihi, double* scale, double* abnrm, double* rconde, double* rcondv, blas_cxd* work, const blas_int* lwork, double* rwork, const blas_int* info, blas_len balanc_len, blas_len jobvl_len, blas_len jobvr_len, blas_len sense_len) ARMA_NOEXCEPT; // eigen decomposition of symmetric real matrices void arma_fortran(arma_ssyev)(const char* jobz, const char* uplo, const blas_int* n, float* a, const blas_int* lda, float* w, float* work, const blas_int* lwork, blas_int* info, blas_len jobz_len, blas_len uplo_len) ARMA_NOEXCEPT; void arma_fortran(arma_dsyev)(const char* jobz, const char* uplo, const blas_int* n, double* a, const blas_int* lda, double* w, double* work, const blas_int* lwork, blas_int* info, blas_len jobz_len, blas_len uplo_len) ARMA_NOEXCEPT; // eigen decomposition of hermitian matrices (complex) void arma_fortran(arma_cheev)(const char* jobz, const char* uplo, const blas_int* n, blas_cxf* a, const blas_int* lda, float* w, blas_cxf* work, const blas_int* lwork, float* rwork, blas_int* info, blas_len jobz_len, blas_len uplo_len) ARMA_NOEXCEPT; void arma_fortran(arma_zheev)(const char* jobz, const char* uplo, const blas_int* n, blas_cxd* a, const blas_int* lda, double* w, blas_cxd* work, const blas_int* lwork, double* rwork, blas_int* info, blas_len jobz_len, blas_len uplo_len) ARMA_NOEXCEPT; // eigen decomposition of symmetric real matrices by divide and conquer void arma_fortran(arma_ssyevd)(const char* jobz, const char* uplo, const blas_int* n, float* a, const blas_int* lda, float* w, float* work, const blas_int* lwork, blas_int* iwork, const blas_int* liwork, blas_int* info, blas_len jobz_len, blas_len uplo_len) ARMA_NOEXCEPT; void arma_fortran(arma_dsyevd)(const char* jobz, const char* uplo, const blas_int* n, double* a, const blas_int* lda, double* w, double* work, const blas_int* lwork, blas_int* iwork, const blas_int* liwork, blas_int* info, blas_len jobz_len, blas_len uplo_len) ARMA_NOEXCEPT; // eigen decomposition of hermitian matrices (complex) by divide and conquer void arma_fortran(arma_cheevd)(const char* jobz, const char* uplo, const blas_int* n, blas_cxf* a, const blas_int* lda, float* w, blas_cxf* work, const blas_int* lwork, float* rwork, const blas_int* lrwork, blas_int* iwork, const blas_int* liwork, blas_int* info, blas_len jobz_len, blas_len uplo_len) ARMA_NOEXCEPT; void arma_fortran(arma_zheevd)(const char* jobz, const char* uplo, const blas_int* n, blas_cxd* a, const blas_int* lda, double* w, blas_cxd* work, const blas_int* lwork, double* rwork, const blas_int* lrwork, blas_int* iwork, const blas_int* liwork, blas_int* info, blas_len jobz_len, blas_len uplo_len) ARMA_NOEXCEPT; // eigen decomposition of general real matrix pair void arma_fortran(arma_sggev)(const char* jobvl, const char* jobvr, const blas_int* n, float* a, const blas_int* lda, float* b, const blas_int* ldb, float* alphar, float* alphai, float* beta, float* vl, const blas_int* ldvl, float* vr, const blas_int* ldvr, float* work, const blas_int* lwork, blas_int* info, blas_len jobvl_len, blas_len jobvr_len) ARMA_NOEXCEPT; void arma_fortran(arma_dggev)(const char* jobvl, const char* jobvr, const blas_int* n, double* a, const blas_int* lda, double* b, const blas_int* ldb, double* alphar, double* alphai, double* beta, double* vl, const blas_int* ldvl, double* vr, const blas_int* ldvr, double* work, const blas_int* lwork, blas_int* info, blas_len jobvl_len, blas_len jobvr_len) ARMA_NOEXCEPT; // eigen decomposition of general complex matrix pair void arma_fortran(arma_cggev)(const char* jobvl, const char* jobvr, const blas_int* n, blas_cxf* a, const blas_int* lda, blas_cxf* b, const blas_int* ldb, blas_cxf* alpha, blas_cxf* beta, blas_cxf* vl, const blas_int* ldvl, blas_cxf* vr, const blas_int* ldvr, blas_cxf* work, const blas_int* lwork, float* rwork, blas_int* info, blas_len jobvl_len, blas_len jobvr_len) ARMA_NOEXCEPT; void arma_fortran(arma_zggev)(const char* jobvl, const char* jobvr, const blas_int* n, blas_cxd* a, const blas_int* lda, blas_cxd* b, const blas_int* ldb, blas_cxd* alpha, blas_cxd* beta, blas_cxd* vl, const blas_int* ldvl, blas_cxd* vr, const blas_int* ldvr, blas_cxd* work, const blas_int* lwork, double* rwork, blas_int* info, blas_len jobvl_len, blas_len jobvr_len) ARMA_NOEXCEPT; // Cholesky decomposition void arma_fortran(arma_spotrf)(const char* uplo, const blas_int* n, float* a, const blas_int* lda, blas_int* info, blas_len uplo_len) ARMA_NOEXCEPT; void arma_fortran(arma_dpotrf)(const char* uplo, const blas_int* n, double* a, const blas_int* lda, blas_int* info, blas_len uplo_len) ARMA_NOEXCEPT; void arma_fortran(arma_cpotrf)(const char* uplo, const blas_int* n, blas_cxf* a, const blas_int* lda, blas_int* info, blas_len uplo_len) ARMA_NOEXCEPT; void arma_fortran(arma_zpotrf)(const char* uplo, const blas_int* n, blas_cxd* a, const blas_int* lda, blas_int* info, blas_len uplo_len) ARMA_NOEXCEPT; // solve system of linear equations using pre-computed Cholesky decomposition void arma_fortran(arma_spotrs)(const char* uplo, const blas_int* n, const blas_int* nrhs, const float* a, const blas_int* lda, float* b, const blas_int* ldb, blas_int* info, blas_len uplo_len) ARMA_NOEXCEPT; void arma_fortran(arma_dpotrs)(const char* uplo, const blas_int* n, const blas_int* nrhs, const double* a, const blas_int* lda, double* b, const blas_int* ldb, blas_int* info, blas_len uplo_len) ARMA_NOEXCEPT; void arma_fortran(arma_cpotrs)(const char* uplo, const blas_int* n, const blas_int* nrhs, const blas_cxf* a, const blas_int* lda, blas_cxf* b, const blas_int* ldb, blas_int* info, blas_len uplo_len) ARMA_NOEXCEPT; void arma_fortran(arma_zpotrs)(const char* uplo, const blas_int* n, const blas_int* nrhs, const blas_cxd* a, const blas_int* lda, blas_cxd* b, const blas_int* ldb, blas_int* info, blas_len uplo_len) ARMA_NOEXCEPT; // Cholesky decomposition (band matrices) void arma_fortran(arma_spbtrf)(const char* uplo, const blas_int* n, const blas_int* kd, float* ab, const blas_int* ldab, blas_int* info, blas_len uplo_len) ARMA_NOEXCEPT; void arma_fortran(arma_dpbtrf)(const char* uplo, const blas_int* n, const blas_int* kd, double* ab, const blas_int* ldab, blas_int* info, blas_len uplo_len) ARMA_NOEXCEPT; void arma_fortran(arma_cpbtrf)(const char* uplo, const blas_int* n, const blas_int* kd, blas_cxf* ab, const blas_int* ldab, blas_int* info, blas_len uplo_len) ARMA_NOEXCEPT; void arma_fortran(arma_zpbtrf)(const char* uplo, const blas_int* n, const blas_int* kd, blas_cxd* ab, const blas_int* ldab, blas_int* info, blas_len uplo_len) ARMA_NOEXCEPT; // matrix inversion (using pre-computed Cholesky decomposition) void arma_fortran(arma_spotri)(const char* uplo, const blas_int* n, float* a, const blas_int* lda, blas_int* info, blas_len uplo_len) ARMA_NOEXCEPT; void arma_fortran(arma_dpotri)(const char* uplo, const blas_int* n, double* a, const blas_int* lda, blas_int* info, blas_len uplo_len) ARMA_NOEXCEPT; void arma_fortran(arma_cpotri)(const char* uplo, const blas_int* n, blas_cxf* a, const blas_int* lda, blas_int* info, blas_len uplo_len) ARMA_NOEXCEPT; void arma_fortran(arma_zpotri)(const char* uplo, const blas_int* n, blas_cxd* a, const blas_int* lda, blas_int* info, blas_len uplo_len) ARMA_NOEXCEPT; // QR decomposition void arma_fortran(arma_sgeqrf)(const blas_int* m, const blas_int* n, float* a, const blas_int* lda, float* tau, float* work, const blas_int* lwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dgeqrf)(const blas_int* m, const blas_int* n, double* a, const blas_int* lda, double* tau, double* work, const blas_int* lwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_cgeqrf)(const blas_int* m, const blas_int* n, blas_cxf* a, const blas_int* lda, blas_cxf* tau, blas_cxf* work, const blas_int* lwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_zgeqrf)(const blas_int* m, const blas_int* n, blas_cxd* a, const blas_int* lda, blas_cxd* tau, blas_cxd* work, const blas_int* lwork, blas_int* info) ARMA_NOEXCEPT; // QR decomposition with pivoting (real matrices) void arma_fortran(arma_sgeqp3)(const blas_int* m, const blas_int* n, float* a, const blas_int* lda, blas_int* jpvt, float* tau, float* work, const blas_int* lwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dgeqp3)(const blas_int* m, const blas_int* n, double* a, const blas_int* lda, blas_int* jpvt, double* tau, double* work, const blas_int* lwork, blas_int* info) ARMA_NOEXCEPT; // QR decomposition with pivoting (complex matrices) void arma_fortran(arma_cgeqp3)(const blas_int* m, const blas_int* n, blas_cxf* a, const blas_int* lda, blas_int* jpvt, blas_cxf* tau, blas_cxf* work, const blas_int* lwork, float* rwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_zgeqp3)(const blas_int* m, const blas_int* n, blas_cxd* a, const blas_int* lda, blas_int* jpvt, blas_cxd* tau, blas_cxd* work, const blas_int* lwork, double* rwork, blas_int* info) ARMA_NOEXCEPT; // Q matrix calculation from QR decomposition (real matrices) void arma_fortran(arma_sorgqr)(const blas_int* m, const blas_int* n, const blas_int* k, float* a, const blas_int* lda, const float* tau, float* work, const blas_int* lwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dorgqr)(const blas_int* m, const blas_int* n, const blas_int* k, double* a, const blas_int* lda, const double* tau, double* work, const blas_int* lwork, blas_int* info) ARMA_NOEXCEPT; // Q matrix calculation from QR decomposition (complex matrices) void arma_fortran(arma_cungqr)(const blas_int* m, const blas_int* n, const blas_int* k, blas_cxf* a, const blas_int* lda, const blas_cxf* tau, blas_cxf* work, const blas_int* lwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_zungqr)(const blas_int* m, const blas_int* n, const blas_int* k, blas_cxd* a, const blas_int* lda, const blas_cxd* tau, blas_cxd* work, const blas_int* lwork, blas_int* info) ARMA_NOEXCEPT; // SVD (real matrices) void arma_fortran(arma_sgesvd)(const char* jobu, const char* jobvt, const blas_int* m, const blas_int* n, float* a, const blas_int* lda, float* s, float* u, const blas_int* ldu, float* vt, const blas_int* ldvt, float* work, const blas_int* lwork, blas_int* info, blas_len jobu_len, blas_len jobvt_len) ARMA_NOEXCEPT; void arma_fortran(arma_dgesvd)(const char* jobu, const char* jobvt, const blas_int* m, const blas_int* n, double* a, const blas_int* lda, double* s, double* u, const blas_int* ldu, double* vt, const blas_int* ldvt, double* work, const blas_int* lwork, blas_int* info, blas_len jobu_len, blas_len jobvt_len) ARMA_NOEXCEPT; // SVD (complex matrices) void arma_fortran(arma_cgesvd)(const char* jobu, const char* jobvt, const blas_int* m, const blas_int* n, blas_cxf* a, const blas_int* lda, float* s, blas_cxf* u, const blas_int* ldu, blas_cxf* vt, const blas_int* ldvt, blas_cxf* work, const blas_int* lwork, float* rwork, blas_int* info, blas_len jobu_len, blas_len jobvt_len) ARMA_NOEXCEPT; void arma_fortran(arma_zgesvd)(const char* jobu, const char* jobvt, const blas_int* m, const blas_int* n, blas_cxd* a, const blas_int* lda, double* s, blas_cxd* u, const blas_int* ldu, blas_cxd* vt, const blas_int* ldvt, blas_cxd* work, const blas_int* lwork, double* rwork, blas_int* info, blas_len jobu_len, blas_len jobvt_len) ARMA_NOEXCEPT; // SVD (real matrices) by divide and conquer void arma_fortran(arma_sgesdd)(const char* jobz, const blas_int* m, const blas_int* n, float* a, const blas_int* lda, float* s, float* u, const blas_int* ldu, float* vt, const blas_int* ldvt, float* work, const blas_int* lwork, blas_int* iwork, blas_int* info, blas_len jobz_len) ARMA_NOEXCEPT; void arma_fortran(arma_dgesdd)(const char* jobz, const blas_int* m, const blas_int* n, double* a, const blas_int* lda, double* s, double* u, const blas_int* ldu, double* vt, const blas_int* ldvt, double* work, const blas_int* lwork, blas_int* iwork, blas_int* info, blas_len jobz_len) ARMA_NOEXCEPT; // SVD (complex matrices) by divide and conquer void arma_fortran(arma_cgesdd)(const char* jobz, const blas_int* m, const blas_int* n, blas_cxf* a, const blas_int* lda, float* s, blas_cxf* u, const blas_int* ldu, blas_cxf* vt, const blas_int* ldvt, blas_cxf* work, const blas_int* lwork, float* rwork, blas_int* iwork, blas_int* info, blas_len jobz_len) ARMA_NOEXCEPT; void arma_fortran(arma_zgesdd)(const char* jobz, const blas_int* m, const blas_int* n, blas_cxd* a, const blas_int* lda, double* s, blas_cxd* u, const blas_int* ldu, blas_cxd* vt, const blas_int* ldvt, blas_cxd* work, const blas_int* lwork, double* rwork, blas_int* iwork, blas_int* info, blas_len jobz_len) ARMA_NOEXCEPT; // solve system of linear equations (general square matrix) void arma_fortran(arma_sgesv)(const blas_int* n, const blas_int* nrhs, float* a, const blas_int* lda, blas_int* ipiv, float* b, const blas_int* ldb, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dgesv)(const blas_int* n, const blas_int* nrhs, double* a, const blas_int* lda, blas_int* ipiv, double* b, const blas_int* ldb, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_cgesv)(const blas_int* n, const blas_int* nrhs, blas_cxf* a, const blas_int* lda, blas_int* ipiv, blas_cxf* b, const blas_int* ldb, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_zgesv)(const blas_int* n, const blas_int* nrhs, blas_cxd* a, const blas_int* lda, blas_int* ipiv, blas_cxd* b, const blas_int* ldb, blas_int* info) ARMA_NOEXCEPT; // solve system of linear equations (general square matrix, advanced form, real matrices) void arma_fortran(arma_sgesvx)(const char* fact, const char* trans, const blas_int* n, const blas_int* nrhs, float* a, const blas_int* lda, float* af, const blas_int* ldaf, blas_int* ipiv, char* equed, float* r, float* c, float* b, const blas_int* ldb, float* x, const blas_int* ldx, float* rcond, float* ferr, float* berr, float* work, blas_int* iwork, blas_int* info, blas_len fact_len, blas_len trans_len, blas_len equed_len) ARMA_NOEXCEPT; void arma_fortran(arma_dgesvx)(const char* fact, const char* trans, const blas_int* n, const blas_int* nrhs, double* a, const blas_int* lda, double* af, const blas_int* ldaf, blas_int* ipiv, char* equed, double* r, double* c, double* b, const blas_int* ldb, double* x, const blas_int* ldx, double* rcond, double* ferr, double* berr, double* work, blas_int* iwork, blas_int* info, blas_len fact_len, blas_len trans_len, blas_len equed_len) ARMA_NOEXCEPT; // solve system of linear equations (general square matrix, advanced form, complex matrices) void arma_fortran(arma_cgesvx)(const char* fact, const char* trans, const blas_int* n, const blas_int* nrhs, blas_cxf* a, const blas_int* lda, blas_cxf* af, const blas_int* ldaf, blas_int* ipiv, char* equed, float* r, float* c, blas_cxf* b, const blas_int* ldb, blas_cxf* x, const blas_int* ldx, float* rcond, float* ferr, float* berr, blas_cxf* work, float* rwork, blas_int* info, blas_len fact_len, blas_len trans_len, blas_len equed_len) ARMA_NOEXCEPT; void arma_fortran(arma_zgesvx)(const char* fact, const char* trans, const blas_int* n, const blas_int* nrhs, blas_cxd* a, const blas_int* lda, blas_cxd* af, const blas_int* ldaf, blas_int* ipiv, char* equed, double* r, double* c, blas_cxd* b, const blas_int* ldb, blas_cxd* x, const blas_int* ldx, double* rcond, double* ferr, double* berr, blas_cxd* work, double* rwork, blas_int* info, blas_len fact_len, blas_len trans_len, blas_len equed_len) ARMA_NOEXCEPT; // solve system of linear equations (symmetric positive definite matrix) void arma_fortran(arma_sposv)(const char* uplo, const blas_int* n, const blas_int* nrhs, float* a, const blas_int* lda, float* b, const blas_int* ldb, blas_int* info, blas_len uplo_len) ARMA_NOEXCEPT; void arma_fortran(arma_dposv)(const char* uplo, const blas_int* n, const blas_int* nrhs, double* a, const blas_int* lda, double* b, const blas_int* ldb, blas_int* info, blas_len uplo_len) ARMA_NOEXCEPT; void arma_fortran(arma_cposv)(const char* uplo, const blas_int* n, const blas_int* nrhs, blas_cxf* a, const blas_int* lda, blas_cxf* b, const blas_int* ldb, blas_int* info, blas_len uplo_len) ARMA_NOEXCEPT; void arma_fortran(arma_zposv)(const char* uplo, const blas_int* n, const blas_int* nrhs, blas_cxd* a, const blas_int* lda, blas_cxd* b, const blas_int* ldb, blas_int* info, blas_len uplo_len) ARMA_NOEXCEPT; // solve system of linear equations (symmetric positive definite matrix, advanced form, real matrices) void arma_fortran(arma_sposvx)(const char* fact, const char* uplo, const blas_int* n, const blas_int* nrhs, float* a, const blas_int* lda, float* af, const blas_int* ldaf, char* equed, float* s, float* b, const blas_int* ldb, float* x, const blas_int* ldx, float* rcond, float* ferr, float* berr, float* work, blas_int* iwork, blas_int* info, blas_len fact_len, blas_len uplo_len, blas_len equed_len) ARMA_NOEXCEPT; void arma_fortran(arma_dposvx)(const char* fact, const char* uplo, const blas_int* n, const blas_int* nrhs, double* a, const blas_int* lda, double* af, const blas_int* ldaf, char* equed, double* s, double* b, const blas_int* ldb, double* x, const blas_int* ldx, double* rcond, double* ferr, double* berr, double* work, blas_int* iwork, blas_int* info, blas_len fact_len, blas_len uplo_len, blas_len equed_len) ARMA_NOEXCEPT; // solve system of linear equations (hermitian positive definite matrix, advanced form, complex matrices) void arma_fortran(arma_cposvx)(const char* fact, const char* uplo, const blas_int* n, const blas_int* nrhs, blas_cxf* a, const blas_int* lda, blas_cxf* af, const blas_int* ldaf, char* equed, float* s, blas_cxf* b, const blas_int* ldb, blas_cxf* x, const blas_int* ldx, float* rcond, float* ferr, float* berr, blas_cxf* work, float* rwork, blas_int* info, blas_len fact_len, blas_len uplo_len, blas_len equed_len) ARMA_NOEXCEPT; void arma_fortran(arma_zposvx)(const char* fact, const char* uplo, const blas_int* n, const blas_int* nrhs, blas_cxd* a, const blas_int* lda, blas_cxd* af, const blas_int* ldaf, char* equed, double* s, blas_cxd* b, const blas_int* ldb, blas_cxd* x, const blas_int* ldx, double* rcond, double* ferr, double* berr, blas_cxd* work, double* rwork, blas_int* info, blas_len fact_len, blas_len uplo_len, blas_len equed_len) ARMA_NOEXCEPT; // solve over/under-determined system of linear equations void arma_fortran(arma_sgels)(const char* trans, const blas_int* m, const blas_int* n, const blas_int* nrhs, float* a, const blas_int* lda, float* b, const blas_int* ldb, float* work, const blas_int* lwork, blas_int* info, blas_len trans_len) ARMA_NOEXCEPT; void arma_fortran(arma_dgels)(const char* trans, const blas_int* m, const blas_int* n, const blas_int* nrhs, double* a, const blas_int* lda, double* b, const blas_int* ldb, double* work, const blas_int* lwork, blas_int* info, blas_len trans_len) ARMA_NOEXCEPT; void arma_fortran(arma_cgels)(const char* trans, const blas_int* m, const blas_int* n, const blas_int* nrhs, blas_cxf* a, const blas_int* lda, blas_cxf* b, const blas_int* ldb, blas_cxf* work, const blas_int* lwork, blas_int* info, blas_len trans_len) ARMA_NOEXCEPT; void arma_fortran(arma_zgels)(const char* trans, const blas_int* m, const blas_int* n, const blas_int* nrhs, blas_cxd* a, const blas_int* lda, blas_cxd* b, const blas_int* ldb, blas_cxd* work, const blas_int* lwork, blas_int* info, blas_len trans_len) ARMA_NOEXCEPT; // approximately solve system of linear equations using svd (real) void arma_fortran(arma_sgelsd)(const blas_int* m, const blas_int* n, const blas_int* nrhs, float* a, const blas_int* lda, float* b, const blas_int* ldb, float* S, const float* rcond, blas_int* rank, float* work, const blas_int* lwork, blas_int* iwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dgelsd)(const blas_int* m, const blas_int* n, const blas_int* nrhs, double* a, const blas_int* lda, double* b, const blas_int* ldb, double* S, const double* rcond, blas_int* rank, double* work, const blas_int* lwork, blas_int* iwork, blas_int* info) ARMA_NOEXCEPT; // approximately solve system of linear equations using svd (complex) void arma_fortran(arma_cgelsd)(const blas_int* m, const blas_int* n, const blas_int* nrhs, blas_cxf* a, const blas_int* lda, blas_cxf* b, const blas_int* ldb, float* S, const float* rcond, blas_int* rank, blas_cxf* work, const blas_int* lwork, float* rwork, blas_int* iwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_zgelsd)(const blas_int* m, const blas_int* n, const blas_int* nrhs, blas_cxd* a, const blas_int* lda, blas_cxd* b, const blas_int* ldb, double* S, const double* rcond, blas_int* rank, blas_cxd* work, const blas_int* lwork, double* rwork, blas_int* iwork, blas_int* info) ARMA_NOEXCEPT; // solve system of linear equations (triangular matrix) void arma_fortran(arma_strtrs)(const char* uplo, const char* trans, const char* diag, const blas_int* n, const blas_int* nrhs, const float* a, const blas_int* lda, float* b, const blas_int* ldb, blas_int* info, blas_len uplo_len, blas_len trans_len, blas_len diag_len) ARMA_NOEXCEPT; void arma_fortran(arma_dtrtrs)(const char* uplo, const char* trans, const char* diag, const blas_int* n, const blas_int* nrhs, const double* a, const blas_int* lda, double* b, const blas_int* ldb, blas_int* info, blas_len uplo_len, blas_len trans_len, blas_len diag_len) ARMA_NOEXCEPT; void arma_fortran(arma_ctrtrs)(const char* uplo, const char* trans, const char* diag, const blas_int* n, const blas_int* nrhs, const blas_cxf* a, const blas_int* lda, blas_cxf* b, const blas_int* ldb, blas_int* info, blas_len uplo_len, blas_len trans_len, blas_len diag_len) ARMA_NOEXCEPT; void arma_fortran(arma_ztrtrs)(const char* uplo, const char* trans, const char* diag, const blas_int* n, const blas_int* nrhs, const blas_cxd* a, const blas_int* lda, blas_cxd* b, const blas_int* ldb, blas_int* info, blas_len uplo_len, blas_len trans_len, blas_len diag_len) ARMA_NOEXCEPT; // LU factorisation (general band matrix) void arma_fortran(arma_sgbtrf)(const blas_int* m, const blas_int* n, const blas_int* kl, const blas_int* ku, float* ab, const blas_int* ldab, blas_int* ipiv, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dgbtrf)(const blas_int* m, const blas_int* n, const blas_int* kl, const blas_int* ku, double* ab, const blas_int* ldab, blas_int* ipiv, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_cgbtrf)(const blas_int* m, const blas_int* n, const blas_int* kl, const blas_int* ku, blas_cxf* ab, const blas_int* ldab, blas_int* ipiv, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_zgbtrf)(const blas_int* m, const blas_int* n, const blas_int* kl, const blas_int* ku, blas_cxd* ab, const blas_int* ldab, blas_int* ipiv, blas_int* info) ARMA_NOEXCEPT; // solve system of linear equations using pre-computed LU decomposition (general band matrix) void arma_fortran(arma_sgbtrs)(const char* trans, const blas_int* n, const blas_int* kl, const blas_int* ku, const blas_int* nrhs, const float* ab, const blas_int* ldab, const blas_int* ipiv, float* b, const blas_int* ldb, blas_int* info, blas_len trans_len) ARMA_NOEXCEPT; void arma_fortran(arma_dgbtrs)(const char* trans, const blas_int* n, const blas_int* kl, const blas_int* ku, const blas_int* nrhs, const double* ab, const blas_int* ldab, const blas_int* ipiv, double* b, const blas_int* ldb, blas_int* info, blas_len trans_len) ARMA_NOEXCEPT; void arma_fortran(arma_cgbtrs)(const char* trans, const blas_int* n, const blas_int* kl, const blas_int* ku, const blas_int* nrhs, const blas_cxf* ab, const blas_int* ldab, const blas_int* ipiv, blas_cxf* b, const blas_int* ldb, blas_int* info, blas_len trans_len) ARMA_NOEXCEPT; void arma_fortran(arma_zgbtrs)(const char* trans, const blas_int* n, const blas_int* kl, const blas_int* ku, const blas_int* nrhs, const blas_cxd* ab, const blas_int* ldab, const blas_int* ipiv, blas_cxd* b, const blas_int* ldb, blas_int* info, blas_len trans_len) ARMA_NOEXCEPT; // solve system of linear equations (general band matrix) void arma_fortran(arma_sgbsv)(const blas_int* n, const blas_int* kl, const blas_int* ku, const blas_int* nrhs, float* ab, const blas_int* ldab, blas_int* ipiv, float* b, const blas_int* ldb, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dgbsv)(const blas_int* n, const blas_int* kl, const blas_int* ku, const blas_int* nrhs, double* ab, const blas_int* ldab, blas_int* ipiv, double* b, const blas_int* ldb, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_cgbsv)(const blas_int* n, const blas_int* kl, const blas_int* ku, const blas_int* nrhs, blas_cxf* ab, const blas_int* ldab, blas_int* ipiv, blas_cxf* b, const blas_int* ldb, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_zgbsv)(const blas_int* n, const blas_int* kl, const blas_int* ku, const blas_int* nrhs, blas_cxd* ab, const blas_int* ldab, blas_int* ipiv, blas_cxd* b, const blas_int* ldb, blas_int* info) ARMA_NOEXCEPT; // solve system of linear equations (general band matrix, advanced form, real matrices) void arma_fortran(arma_sgbsvx)(const char* fact, const char* trans, const blas_int* n, const blas_int* kl, const blas_int* ku, const blas_int* nrhs, float* ab, const blas_int* ldab, float* afb, const blas_int* ldafb, blas_int* ipiv, char* equed, float* r, float* c, float* b, const blas_int* ldb, float* x, const blas_int* ldx, float* rcond, float* ferr, float* berr, float* work, blas_int* iwork, blas_int* info, blas_len fact_len, blas_len trans_len, blas_len equed_len) ARMA_NOEXCEPT; void arma_fortran(arma_dgbsvx)(const char* fact, const char* trans, const blas_int* n, const blas_int* kl, const blas_int* ku, const blas_int* nrhs, double* ab, const blas_int* ldab, double* afb, const blas_int* ldafb, blas_int* ipiv, char* equed, double* r, double* c, double* b, const blas_int* ldb, double* x, const blas_int* ldx, double* rcond, double* ferr, double* berr, double* work, blas_int* iwork, blas_int* info, blas_len fact_len, blas_len trans_len, blas_len equed_len) ARMA_NOEXCEPT; // solve system of linear equations (general band matrix, advanced form, complex matrices) void arma_fortran(arma_cgbsvx)(const char* fact, const char* trans, const blas_int* n, const blas_int* kl, const blas_int* ku, const blas_int* nrhs, blas_cxf* ab, const blas_int* ldab, blas_cxf* afb, const blas_int* ldafb, blas_int* ipiv, char* equed, float* r, float* c, blas_cxf* b, const blas_int* ldb, blas_cxf* x, const blas_int* ldx, float* rcond, float* ferr, float* berr, blas_cxf* work, float* rwork, blas_int* info, blas_len fact_len, blas_len trans_len, blas_len equed_len) ARMA_NOEXCEPT; void arma_fortran(arma_zgbsvx)(const char* fact, const char* trans, const blas_int* n, const blas_int* kl, const blas_int* ku, const blas_int* nrhs, blas_cxd* ab, const blas_int* ldab, blas_cxd* afb, const blas_int* ldafb, blas_int* ipiv, char* equed, double* r, double* c, blas_cxd* b, const blas_int* ldb, blas_cxd* x, const blas_int* ldx, double* rcond, double* ferr, double* berr, blas_cxd* work, double* rwork, blas_int* info, blas_len fact_len, blas_len trans_len, blas_len equed_len) ARMA_NOEXCEPT; // solve system of linear equations (tridiagonal band matrix) void arma_fortran(arma_sgtsv)(const blas_int* n, const blas_int* nrhs, float* dl, float* d, float* du, float* b, const blas_int* ldb, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dgtsv)(const blas_int* n, const blas_int* nrhs, double* dl, double* d, double* du, double* b, const blas_int* ldb, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_cgtsv)(const blas_int* n, const blas_int* nrhs, blas_cxf* dl, blas_cxf* d, blas_cxf* du, blas_cxf* b, const blas_int* ldb, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_zgtsv)(const blas_int* n, const blas_int* nrhs, blas_cxd* dl, blas_cxd* d, blas_cxd* du, blas_cxd* b, const blas_int* ldb, blas_int* info) ARMA_NOEXCEPT; // solve system of linear equations (tridiagonal band matrix, advanced form, real matrices) void arma_fortran(arma_sgtsvx)(const char* fact, const char* trans, const blas_int* n, const blas_int* nrhs, const float* dl, const float* d, const float* du, float* dlf, float* df, float* duf, float* du2, blas_int* ipiv, const float* b, const blas_int* ldb, float* x, const blas_int* ldx, float* rcond, float* ferr, float* berr, float* work, blas_int* iwork, blas_int* info, blas_len fact_len, blas_len trans_len) ARMA_NOEXCEPT; void arma_fortran(arma_dgtsvx)(const char* fact, const char* trans, const blas_int* n, const blas_int* nrhs, const double* dl, const double* d, const double* du, double* dlf, double* df, double* duf, double* du2, blas_int* ipiv, const double* b, const blas_int* ldb, double* x, const blas_int* ldx, double* rcond, double* ferr, double* berr, double* work, blas_int* iwork, blas_int* info, blas_len fact_len, blas_len trans_len) ARMA_NOEXCEPT; // solve system of linear equations (tridiagonal band matrix, advanced form, complex matrices) void arma_fortran(arma_cgtsvx)(const char* fact, const char* trans, const blas_int* n, const blas_int* nrhs, const blas_cxf* dl, const blas_cxf* d, const blas_cxf* du, blas_cxf* dlf, blas_cxf* df, blas_cxf* duf, blas_cxf* du2, blas_int* ipiv, const blas_cxf* b, const blas_int* ldb, blas_cxf* x, const blas_int* ldx, float* rcond, float* ferr, float* berr, blas_cxf* work, float* rwork, blas_int* info, blas_len fact_len, blas_len trans_len) ARMA_NOEXCEPT; void arma_fortran(arma_zgtsvx)(const char* fact, const char* trans, const blas_int* n, const blas_int* nrhs, const blas_cxd* dl, const blas_cxd* d, const blas_cxd* du, blas_cxd* dlf, blas_cxd* df, blas_cxd* duf, blas_cxd* du2, blas_int* ipiv, const blas_cxd* b, const blas_int* ldb, blas_cxd* x, const blas_int* ldx, double* rcond, double* ferr, double* berr, blas_cxd* work, double* rwork, blas_int* info, blas_len fact_len, blas_len trans_len) ARMA_NOEXCEPT; // Schur decomposition (real matrices) void arma_fortran(arma_sgees)(const char* jobvs, const char* sort, fn_select_s2 select, const blas_int* n, float* a, const blas_int* lda, blas_int* sdim, float* wr, float* wi, float* vs, const blas_int* ldvs, float* work, const blas_int* lwork, blas_int* bwork, blas_int* info, blas_len jobvs_len, blas_len sort_len) ARMA_NOEXCEPT; void arma_fortran(arma_dgees)(const char* jobvs, const char* sort, fn_select_d2 select, const blas_int* n, double* a, const blas_int* lda, blas_int* sdim, double* wr, double* wi, double* vs, const blas_int* ldvs, double* work, const blas_int* lwork, blas_int* bwork, blas_int* info, blas_len jobvs_len, blas_len sort_len) ARMA_NOEXCEPT; // Schur decomposition (complex matrices) void arma_fortran(arma_cgees)(const char* jobvs, const char* sort, fn_select_c1 select, const blas_int* n, blas_cxf* a, const blas_int* lda, blas_int* sdim, blas_cxf* w, blas_cxf* vs, const blas_int* ldvs, blas_cxf* work, const blas_int* lwork, float* rwork, blas_int* bwork, blas_int* info, blas_len jobvs_len, blas_len sort_len) ARMA_NOEXCEPT; void arma_fortran(arma_zgees)(const char* jobvs, const char* sort, fn_select_z1 select, const blas_int* n, blas_cxd* a, const blas_int* lda, blas_int* sdim, blas_cxd* w, blas_cxd* vs, const blas_int* ldvs, blas_cxd* work, const blas_int* lwork, double* rwork, blas_int* bwork, blas_int* info, blas_len jobvs_len, blas_len sort_len) ARMA_NOEXCEPT; // solve a Sylvester equation ax + xb = c, with a and b assumed to be in Schur form void arma_fortran(arma_strsyl)(const char* transa, const char* transb, const blas_int* isgn, const blas_int* m, const blas_int* n, const float* a, const blas_int* lda, const float* b, const blas_int* ldb, float* c, const blas_int* ldc, float* scale, blas_int* info, blas_len transa_len, blas_len transb_len) ARMA_NOEXCEPT; void arma_fortran(arma_dtrsyl)(const char* transa, const char* transb, const blas_int* isgn, const blas_int* m, const blas_int* n, const double* a, const blas_int* lda, const double* b, const blas_int* ldb, double* c, const blas_int* ldc, double* scale, blas_int* info, blas_len transa_len, blas_len transb_len) ARMA_NOEXCEPT; void arma_fortran(arma_ctrsyl)(const char* transa, const char* transb, const blas_int* isgn, const blas_int* m, const blas_int* n, const blas_cxf* a, const blas_int* lda, const blas_cxf* b, const blas_int* ldb, blas_cxf* c, const blas_int* ldc, float* scale, blas_int* info, blas_len transa_len, blas_len transb_len) ARMA_NOEXCEPT; void arma_fortran(arma_ztrsyl)(const char* transa, const char* transb, const blas_int* isgn, const blas_int* m, const blas_int* n, const blas_cxd* a, const blas_int* lda, const blas_cxd* b, const blas_int* ldb, blas_cxd* c, const blas_int* ldc, double* scale, blas_int* info, blas_len transa_len, blas_len transb_len) ARMA_NOEXCEPT; // QZ decomposition (real matrices) void arma_fortran(arma_sgges)(const char* jobvsl, const char* jobvsr, const char* sort, fn_select_s3 selctg, const blas_int* n, float* a, const blas_int* lda, float* b, const blas_int* ldb, blas_int* sdim, float* alphar, float* alphai, float* beta, float* vsl, const blas_int* ldvsl, float* vsr, const blas_int* ldvsr, float* work, const blas_int* lwork, blas_int* bwork, blas_int* info, blas_len jobvsl_len, blas_len jobvsr_len, blas_len sort_len) ARMA_NOEXCEPT; void arma_fortran(arma_dgges)(const char* jobvsl, const char* jobvsr, const char* sort, fn_select_d3 selctg, const blas_int* n, double* a, const blas_int* lda, double* b, const blas_int* ldb, blas_int* sdim, double* alphar, double* alphai, double* beta, double* vsl, const blas_int* ldvsl, double* vsr, const blas_int* ldvsr, double* work, const blas_int* lwork, blas_int* bwork, blas_int* info, blas_len jobvsl_len, blas_len jobvsr_len, blas_len sort_len) ARMA_NOEXCEPT; // QZ decomposition (complex matrices) void arma_fortran(arma_cgges)(const char* jobvsl, const char* jobvsr, const char* sort, fn_select_c2 selctg, const blas_int* n, blas_cxf* a, const blas_int* lda, blas_cxf* b, const blas_int* ldb, blas_int* sdim, blas_cxf* alpha, blas_cxf* beta, blas_cxf* vsl, const blas_int* ldvsl, blas_cxf* vsr, const blas_int* ldvsr, blas_cxf* work, const blas_int* lwork, float* rwork, blas_int* bwork, blas_int* info, blas_len jobvsl_len, blas_len jobvsr_len, blas_len sort_len) ARMA_NOEXCEPT; void arma_fortran(arma_zgges)(const char* jobvsl, const char* jobvsr, const char* sort, fn_select_z2 selctg, const blas_int* n, blas_cxd* a, const blas_int* lda, blas_cxd* b, const blas_int* ldb, blas_int* sdim, blas_cxd* alpha, blas_cxd* beta, blas_cxd* vsl, const blas_int* ldvsl, blas_cxd* vsr, const blas_int* ldvsr, blas_cxd* work, const blas_int* lwork, double* rwork, blas_int* bwork, blas_int* info, blas_len jobvsl_len, blas_len jobvsr_len, blas_len sort_len) ARMA_NOEXCEPT; // 1-norm (general matrix) float arma_fortran(arma_slange)(const char* norm, const blas_int* m, const blas_int* n, const float* a, const blas_int* lda, float* work, blas_len norm_len) ARMA_NOEXCEPT; double arma_fortran(arma_dlange)(const char* norm, const blas_int* m, const blas_int* n, const double* a, const blas_int* lda, double* work, blas_len norm_len) ARMA_NOEXCEPT; float arma_fortran(arma_clange)(const char* norm, const blas_int* m, const blas_int* n, const blas_cxf* a, const blas_int* lda, float* work, blas_len norm_len) ARMA_NOEXCEPT; double arma_fortran(arma_zlange)(const char* norm, const blas_int* m, const blas_int* n, const blas_cxd* a, const blas_int* lda, double* work, blas_len norm_len) ARMA_NOEXCEPT; // 1-norm (real symmetric matrix) float arma_fortran(arma_slansy)(const char* norm, const char* uplo, const blas_int* n, const float* a, const blas_int* lda, float* work, blas_len norm_len, blas_len uplo_len) ARMA_NOEXCEPT; double arma_fortran(arma_dlansy)(const char* norm, const char* uplo, const blas_int* n, const double* a, const blas_int* lda, double* work, blas_len norm_len, blas_len uplo_len) ARMA_NOEXCEPT; float arma_fortran(arma_clansy)(const char* norm, const char* uplo, const blas_int* n, const blas_cxf* a, const blas_int* lda, float* work, blas_len norm_len, blas_len uplo_len) ARMA_NOEXCEPT; double arma_fortran(arma_zlansy)(const char* norm, const char* uplo, const blas_int* n, const blas_cxd* a, const blas_int* lda, double* work, blas_len norm_len, blas_len uplo_len) ARMA_NOEXCEPT; // 1-norm (complex hermitian matrix) float arma_fortran(arma_clanhe)(const char* norm, const char* uplo, const blas_int* n, const blas_cxf* a, const blas_int* lda, float* work, blas_len norm_len, blas_len uplo_len) ARMA_NOEXCEPT; double arma_fortran(arma_zlanhe)(const char* norm, const char* uplo, const blas_int* n, const blas_cxd* a, const blas_int* lda, double* work, blas_len norm_len, blas_len uplo_len) ARMA_NOEXCEPT; // 1-norm (band matrix) float arma_fortran(arma_slangb)(const char* norm, const blas_int* n, const blas_int* kl, const blas_int* ku, const float* ab, const blas_int* ldab, float* work, blas_len norm_len) ARMA_NOEXCEPT; double arma_fortran(arma_dlangb)(const char* norm, const blas_int* n, const blas_int* kl, const blas_int* ku, const double* ab, const blas_int* ldab, double* work, blas_len norm_len) ARMA_NOEXCEPT; float arma_fortran(arma_clangb)(const char* norm, const blas_int* n, const blas_int* kl, const blas_int* ku, const blas_cxf* ab, const blas_int* ldab, float* work, blas_len norm_len) ARMA_NOEXCEPT; double arma_fortran(arma_zlangb)(const char* norm, const blas_int* n, const blas_int* kl, const blas_int* ku, const blas_cxd* ab, const blas_int* ldab, double* work, blas_len norm_len) ARMA_NOEXCEPT; // reciprocal of condition number (real, generic matrix) void arma_fortran(arma_sgecon)(const char* norm, const blas_int* n, const float* a, const blas_int* lda, const float* anorm, float* rcond, float* work, blas_int* iwork, blas_int* info, blas_len norm_len) ARMA_NOEXCEPT; void arma_fortran(arma_dgecon)(const char* norm, const blas_int* n, const double* a, const blas_int* lda, const double* anorm, double* rcond, double* work, blas_int* iwork, blas_int* info, blas_len norm_len) ARMA_NOEXCEPT; // reciprocal of condition number (complex, generic matrix) void arma_fortran(arma_cgecon)(const char* norm, const blas_int* n, const blas_cxf* a, const blas_int* lda, const float* anorm, float* rcond, blas_cxf* work, float* rwork, blas_int* info, blas_len norm_len) ARMA_NOEXCEPT; void arma_fortran(arma_zgecon)(const char* norm, const blas_int* n, const blas_cxd* a, const blas_int* lda, const double* anorm, double* rcond, blas_cxd* work, double* rwork, blas_int* info, blas_len norm_len) ARMA_NOEXCEPT; // reciprocal of condition number (real, symmetric positive definite matrix) void arma_fortran(arma_spocon)(const char* uplo, const blas_int* n, const float* a, const blas_int* lda, const float* anorm, float* rcond, float* work, blas_int* iwork, blas_int* info, blas_len uplo_len) ARMA_NOEXCEPT; void arma_fortran(arma_dpocon)(const char* uplo, const blas_int* n, const double* a, const blas_int* lda, const double* anorm, double* rcond, double* work, blas_int* iwork, blas_int* info, blas_len uplo_len) ARMA_NOEXCEPT; // reciprocal of condition number (complex, hermitian positive definite matrix) void arma_fortran(arma_cpocon)(const char* uplo, const blas_int* n, const blas_cxf* a, const blas_int* lda, const float* anorm, float* rcond, blas_cxf* work, float* rwork, blas_int* info, blas_len uplo_len) ARMA_NOEXCEPT; void arma_fortran(arma_zpocon)(const char* uplo, const blas_int* n, const blas_cxd* a, const blas_int* lda, const double* anorm, double* rcond, blas_cxd* work, double* rwork, blas_int* info, blas_len uplo_len) ARMA_NOEXCEPT; // reciprocal of condition number (real, triangular matrix) void arma_fortran(arma_strcon)(const char* norm, const char* uplo, const char* diag, const blas_int* n, const float* a, const blas_int* lda, float* rcond, float* work, blas_int* iwork, blas_int* info, blas_len norm_len, blas_len uplo_len, blas_len diag_len) ARMA_NOEXCEPT; void arma_fortran(arma_dtrcon)(const char* norm, const char* uplo, const char* diag, const blas_int* n, const double* a, const blas_int* lda, double* rcond, double* work, blas_int* iwork, blas_int* info, blas_len norm_len, blas_len uplo_len, blas_len diag_len) ARMA_NOEXCEPT; // reciprocal of condition number (complex, triangular matrix) void arma_fortran(arma_ctrcon)(const char* norm, const char* uplo, const char* diag, const blas_int* n, const blas_cxf* a, const blas_int* lda, float* rcond, blas_cxf* work, float* rwork, blas_int* info, blas_len norm_len, blas_len uplo_len, blas_len diag_len) ARMA_NOEXCEPT; void arma_fortran(arma_ztrcon)(const char* norm, const char* uplo, const char* diag, const blas_int* n, const blas_cxd* a, const blas_int* lda, double* rcond, blas_cxd* work, double* rwork, blas_int* info, blas_len norm_len, blas_len uplo_len, blas_len diag_len) ARMA_NOEXCEPT; // reciprocal of condition number (real, band matrix) void arma_fortran(arma_sgbcon)(const char* norm, const blas_int* n, const blas_int* kl, const blas_int* ku, const float* ab, const blas_int* ldab, const blas_int* ipiv, const float* anorm, float* rcond, float* work, blas_int* iwork, blas_int* info, blas_len norm_len) ARMA_NOEXCEPT; void arma_fortran(arma_dgbcon)(const char* norm, const blas_int* n, const blas_int* kl, const blas_int* ku, const double* ab, const blas_int* ldab, const blas_int* ipiv, const double* anorm, double* rcond, double* work, blas_int* iwork, blas_int* info, blas_len norm_len) ARMA_NOEXCEPT; // reciprocal of condition number (complex, band matrix) void arma_fortran(arma_cgbcon)(const char* norm, const blas_int* n, const blas_int* kl, const blas_int* ku, const blas_cxf* ab, const blas_int* ldab, const blas_int* ipiv, const float* anorm, float* rcond, blas_cxf* work, float* rwork, blas_int* info, blas_len norm_len) ARMA_NOEXCEPT; void arma_fortran(arma_zgbcon)(const char* norm, const blas_int* n, const blas_int* kl, const blas_int* ku, const blas_cxd* ab, const blas_int* ldab, const blas_int* ipiv, const double* anorm, double* rcond, blas_cxd* work, double* rwork, blas_int* info, blas_len norm_len) ARMA_NOEXCEPT; // obtain parameters according to the local configuration of lapack blas_int arma_fortran(arma_ilaenv)(const blas_int* ispec, const char* name, const char* opts, const blas_int* n1, const blas_int* n2, const blas_int* n3, const blas_int* n4, blas_len name_len, blas_len opts_len) ARMA_NOEXCEPT; // calculate eigenvalues of an upper Hessenberg matrix void arma_fortran(arma_slahqr)(const blas_int* wantt, const blas_int* wantz, const blas_int* n, const blas_int* ilo, const blas_int* ihi, float* h, const blas_int* ldh, float* wr, float* wi, const blas_int* iloz, const blas_int* ihiz, float* z, const blas_int* ldz, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dlahqr)(const blas_int* wantt, const blas_int* wantz, const blas_int* n, const blas_int* ilo, const blas_int* ihi, double* h, const blas_int* ldh, double* wr, double* wi, const blas_int* iloz, const blas_int* ihiz, double* z, const blas_int* ldz, blas_int* info) ARMA_NOEXCEPT; // calculate eigenvalues of a symmetric tridiagonal matrix void arma_fortran(arma_sstedc)(const char* compz, const blas_int* n, float* d, float* e, float* z, const blas_int* ldz, float* work, const blas_int* lwork, blas_int* iwork, const blas_int* liwork, blas_int* info, blas_len compz_len) ARMA_NOEXCEPT; void arma_fortran(arma_dstedc)(const char* compz, const blas_int* n, double* d, double* e, double* z, const blas_int* ldz, double* work, const blas_int* lwork, blas_int* iwork, const blas_int* liwork, blas_int* info, blas_len compz_len) ARMA_NOEXCEPT; // calculate eigenvectors of a Schur form matrix void arma_fortran(arma_strevc)(const char* side, const char* howmny, blas_int* select, const blas_int* n, const float* t, const blas_int* ldt, float* vl, const blas_int* ldvl, float* vr, const blas_int* ldvr, const blas_int* mm, blas_int* m, float* work, blas_int* info, blas_len side_len, blas_len howmny_len) ARMA_NOEXCEPT; void arma_fortran(arma_dtrevc)(const char* side, const char* howmny, blas_int* select, const blas_int* n, const double* t, const blas_int* ldt, double* vl, const blas_int* ldvl, double* vr, const blas_int* ldvr, const blas_int* mm, blas_int* m, double* work, blas_int* info, blas_len side_len, blas_len howmny_len) ARMA_NOEXCEPT; // hessenberg decomposition void arma_fortran(arma_sgehrd)(const blas_int* n, const blas_int* ilo, const blas_int* ihi, float* a, const blas_int* lda, float* tao, float* work, const blas_int* lwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dgehrd)(const blas_int* n, const blas_int* ilo, const blas_int* ihi, double* a, const blas_int* lda, double* tao, double* work, const blas_int* lwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_cgehrd)(const blas_int* n, const blas_int* ilo, const blas_int* ihi, blas_cxf* a, const blas_int* lda, blas_cxf* tao, blas_cxf* work, const blas_int* lwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_zgehrd)(const blas_int* n, const blas_int* ilo, const blas_int* ihi, blas_cxd* a, const blas_int* lda, blas_cxd* tao, blas_cxd* work, const blas_int* lwork, blas_int* info) ARMA_NOEXCEPT; // pivoted cholesky void arma_fortran(arma_spstrf)(const char* uplo, const blas_int* n, float* a, const blas_int* lda, blas_int* piv, blas_int* rank, const float* tol, float* work, blas_int* info, blas_len uplo_len) ARMA_NOEXCEPT; void arma_fortran(arma_dpstrf)(const char* uplo, const blas_int* n, double* a, const blas_int* lda, blas_int* piv, blas_int* rank, const double* tol, double* work, blas_int* info, blas_len uplo_len) ARMA_NOEXCEPT; void arma_fortran(arma_cpstrf)(const char* uplo, const blas_int* n, blas_cxf* a, const blas_int* lda, blas_int* piv, blas_int* rank, const float* tol, float* work, blas_int* info, blas_len uplo_len) ARMA_NOEXCEPT; void arma_fortran(arma_zpstrf)(const char* uplo, const blas_int* n, blas_cxd* a, const blas_int* lda, blas_int* piv, blas_int* rank, const double* tol, double* work, blas_int* info, blas_len uplo_len) ARMA_NOEXCEPT; // factorisation of symmetric matrix (real) void arma_fortran(arma_ssytrf)(const char* uplo, const blas_int* n, float* a, const blas_int* lda, blas_int* ipiv, float* work, const blas_int* lwork, blas_int* info, blas_len uplo_len) ARMA_NOEXCEPT; void arma_fortran(arma_dsytrf)(const char* uplo, const blas_int* n, double* a, const blas_int* lda, blas_int* ipiv, double* work, const blas_int* lwork, blas_int* info, blas_len uplo_len) ARMA_NOEXCEPT; // factorisation of hermitian matrix (complex) void arma_fortran(arma_chetrf)(const char* uplo, const blas_int* n, blas_cxf* a, const blas_int* lda, blas_int* ipiv, blas_cxf* work, const blas_int* lwork, blas_int* info, blas_len uplo_len) ARMA_NOEXCEPT; void arma_fortran(arma_zhetrf)(const char* uplo, const blas_int* n, blas_cxd* a, const blas_int* lda, blas_int* ipiv, blas_cxd* work, const blas_int* lwork, blas_int* info, blas_len uplo_len) ARMA_NOEXCEPT; // solve system using pre-computed factorisation (real) void arma_fortran(arma_ssytrs)(const char* uplo, const blas_int* n, const blas_int* nrhs, const float* a, const blas_int* lda, const blas_int* ipiv, float* b, const blas_int* ldb, blas_int* info, blas_len uplo_len) ARMA_NOEXCEPT; void arma_fortran(arma_dsytrs)(const char* uplo, const blas_int* n, const blas_int* nrhs, const double* a, const blas_int* lda, const blas_int* ipiv, double* b, const blas_int* ldb, blas_int* info, blas_len uplo_len) ARMA_NOEXCEPT; // solve system using pre-computed factorisation (complex) void arma_fortran(arma_chetrs)(const char* uplo, const blas_int* n, const blas_int* nrhs, const blas_cxf* a, const blas_int* lda, const blas_int* ipiv, blas_cxf* b, const blas_int* ldb, blas_int* info, blas_len uplo_len) ARMA_NOEXCEPT; void arma_fortran(arma_zhetrs)(const char* uplo, const blas_int* n, const blas_int* nrhs, const blas_cxd* a, const blas_int* lda, const blas_int* ipiv, blas_cxd* b, const blas_int* ldb, blas_int* info, blas_len uplo_len) ARMA_NOEXCEPT; // inverse of symmetric matrix using pre-computed factorisation (real) void arma_fortran(arma_ssytri)(const char* uplo, const blas_int* n, float* a, const blas_int* lda, const blas_int* ipiv, float* work, blas_int* info, blas_len uplo_len) ARMA_NOEXCEPT; void arma_fortran(arma_dsytri)(const char* uplo, const blas_int* n, double* a, const blas_int* lda, const blas_int* ipiv, double* work, blas_int* info, blas_len uplo_len) ARMA_NOEXCEPT; // inverse of hermitian matrix using pre-computed factorisation (complex) void arma_fortran(arma_chetri)(const char* uplo, const blas_int* n, blas_cxf* a, const blas_int* lda, const blas_int* ipiv, blas_cxf* work, blas_int* info, blas_len uplo_len) ARMA_NOEXCEPT; void arma_fortran(arma_zhetri)(const char* uplo, const blas_int* n, blas_cxd* a, const blas_int* lda, const blas_int* ipiv, blas_cxd* work, blas_int* info, blas_len uplo_len) ARMA_NOEXCEPT; // rcond of symmetric matrix using pre-computed factorisation (real) void arma_fortran(arma_ssycon)(const char* uplo, const blas_int* n, const float* a, const blas_int* lda, const blas_int* ipiv, const float* anorm, float* rcond, float* work, blas_int* iwork, blas_int* info, blas_len uplo_len) ARMA_NOEXCEPT; void arma_fortran(arma_dsycon)(const char* uplo, const blas_int* n, const double* a, const blas_int* lda, const blas_int* ipiv, const double* anorm, double* rcond, double* work, blas_int* iwork, blas_int* info, blas_len uplo_len) ARMA_NOEXCEPT; // rcond of hermitian matrix using pre-computed factorisation (complex) void arma_fortran(arma_checon)(const char* uplo, const blas_int* n, const blas_cxf* a, const blas_int* lda, const blas_int* ipiv, const float* anorm, float* rcond, blas_cxf* work, blas_int* info, blas_len uplo_len) ARMA_NOEXCEPT; void arma_fortran(arma_zhecon)(const char* uplo, const blas_int* n, const blas_cxd* a, const blas_int* lda, const blas_int* ipiv, const double* anorm, double* rcond, blas_cxd* work, blas_int* info, blas_len uplo_len) ARMA_NOEXCEPT; // matrix balance void arma_fortran(arma_sgebal)(const char* job, const blas_int* n, float* a, const blas_int* lda, blas_int* ilo, blas_int* ihi, float* scale, blas_int* info, blas_len job_len) ARMA_NOEXCEPT; void arma_fortran(arma_dgebal)(const char* job, const blas_int* n, double* a, const blas_int* lda, blas_int* ilo, blas_int* ihi, double* scale, blas_int* info, blas_len job_len) ARMA_NOEXCEPT; void arma_fortran(arma_cgebal)(const char* job, const blas_int* n, blas_cxf* a, const blas_int* lda, blas_int* ilo, blas_int* ihi, float* scale, blas_int* info, blas_len job_len) ARMA_NOEXCEPT; void arma_fortran(arma_zgebal)(const char* job, const blas_int* n, blas_cxd* a, const blas_int* lda, blas_int* ilo, blas_int* ihi, double* scale, blas_int* info, blas_len job_len) ARMA_NOEXCEPT; #else // prototypes without hidden arguments // LU decomposition void arma_fortran(arma_sgetrf)(const blas_int* m, const blas_int* n, float* a, const blas_int* lda, blas_int* ipiv, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dgetrf)(const blas_int* m, const blas_int* n, double* a, const blas_int* lda, blas_int* ipiv, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_cgetrf)(const blas_int* m, const blas_int* n, blas_cxf* a, const blas_int* lda, blas_int* ipiv, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_zgetrf)(const blas_int* m, const blas_int* n, blas_cxd* a, const blas_int* lda, blas_int* ipiv, blas_int* info) ARMA_NOEXCEPT; // solve system of linear equations using pre-computed LU decomposition void arma_fortran(arma_sgetrs)(const char* trans, const blas_int* n, const blas_int* nrhs, const float* a, const blas_int* lda, const blas_int* ipiv, float* b, const blas_int* ldb, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dgetrs)(const char* trans, const blas_int* n, const blas_int* nrhs, const double* a, const blas_int* lda, const blas_int* ipiv, double* b, const blas_int* ldb, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_cgetrs)(const char* trans, const blas_int* n, const blas_int* nrhs, const blas_cxf* a, const blas_int* lda, const blas_int* ipiv, blas_cxf* b, const blas_int* ldb, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_zgetrs)(const char* trans, const blas_int* n, const blas_int* nrhs, const blas_cxd* a, const blas_int* lda, const blas_int* ipiv, blas_cxd* b, const blas_int* ldb, blas_int* info) ARMA_NOEXCEPT; // matrix inversion (using pre-computed LU decomposition) void arma_fortran(arma_sgetri)(const blas_int* n, float* a, const blas_int* lda, const blas_int* ipiv, float* work, const blas_int* lwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dgetri)(const blas_int* n, double* a, const blas_int* lda, const blas_int* ipiv, double* work, const blas_int* lwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_cgetri)(const blas_int* n, blas_cxf* a, const blas_int* lda, const blas_int* ipiv, blas_cxf* work, const blas_int* lwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_zgetri)(const blas_int* n, blas_cxd* a, const blas_int* lda, const blas_int* ipiv, blas_cxd* work, const blas_int* lwork, blas_int* info) ARMA_NOEXCEPT; // matrix inversion (triangular matrices) void arma_fortran(arma_strtri)(const char* uplo, const char* diag, const blas_int* n, float* a, const blas_int* lda, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dtrtri)(const char* uplo, const char* diag, const blas_int* n, double* a, const blas_int* lda, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_ctrtri)(const char* uplo, const char* diag, const blas_int* n, blas_cxf* a, const blas_int* lda, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_ztrtri)(const char* uplo, const char* diag, const blas_int* n, blas_cxd* a, const blas_int* lda, blas_int* info) ARMA_NOEXCEPT; // eigen decomposition of general matrix (real) void arma_fortran(arma_sgeev)(const char* jobvl, const char* jobvr, const blas_int* n, float* a, const blas_int* lda, float* wr, float* wi, float* vl, const blas_int* ldvl, float* vr, const blas_int* ldvr, float* work, const blas_int* lwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dgeev)(const char* jobvl, const char* jobvr, const blas_int* n, double* a, const blas_int* lda, double* wr, double* wi, double* vl, const blas_int* ldvl, double* vr, const blas_int* ldvr, double* work, const blas_int* lwork, blas_int* info) ARMA_NOEXCEPT; // eigen decomposition of general matrix (complex) void arma_fortran(arma_cgeev)(const char* jobvl, const char* jobvr, const blas_int* n, blas_cxf* a, const blas_int* lda, blas_cxf* w, blas_cxf* vl, const blas_int* ldvl, blas_cxf* vr, const blas_int* ldvr, blas_cxf* work, const blas_int* lwork, float* rwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_zgeev)(const char* jobvl, const char* jobvr, const blas_int* n, blas_cxd* a, const blas_int* lda, blas_cxd* w, blas_cxd* vl, const blas_int* ldvl, blas_cxd* vr, const blas_int* ldvr, blas_cxd* work, const blas_int* lwork, double* rwork, blas_int* info) ARMA_NOEXCEPT; // eigen decomposition of general matrix (real; advanced form) void arma_fortran(arma_sgeevx)(const char* balanc, const char* jobvl, const char* jobvr, const char* sense, const blas_int* n, float* a, const blas_int* lda, float* wr, float* wi, float* vl, const blas_int* ldvl, float* vr, const blas_int* ldvr, blas_int* ilo, blas_int* ihi, float* scale, float* abnrm, float* rconde, float* rcondv, float* work, const blas_int* lwork, blas_int* iwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dgeevx)(const char* balanc, const char* jobvl, const char* jobvr, const char* sense, const blas_int* n, double* a, const blas_int* lda, double* wr, double* wi, double* vl, const blas_int* ldvl, double* vr, const blas_int* ldvr, blas_int* ilo, blas_int* ihi, double* scale, double* abnrm, double* rconde, double* rcondv, double* work, const blas_int* lwork, blas_int* iwork, blas_int* info) ARMA_NOEXCEPT; // eigen decomposition of general matrix (complex; advanced form) void arma_fortran(arma_cgeevx)(const char* balanc, const char* jobvl, const char* jobvr, const char* sense, const blas_int* n, blas_cxf* a, const blas_int* lda, blas_cxf* w, blas_cxf* vl, const blas_int* ldvl, blas_cxf* vr, const blas_int* ldvr, blas_int* ilo, blas_int* ihi, float* scale, float* abnrm, float* rconde, float* rcondv, blas_cxf* work, const blas_int* lwork, float* rwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_zgeevx)(const char* balanc, const char* jobvl, const char* jobvr, const char* sense, const blas_int* n, blas_cxd* a, const blas_int* lda, blas_cxd* w, blas_cxd* vl, const blas_int* ldvl, blas_cxd* vr, const blas_int* ldvr, blas_int* ilo, blas_int* ihi, double* scale, double* abnrm, double* rconde, double* rcondv, blas_cxd* work, const blas_int* lwork, double* rwork, blas_int* info) ARMA_NOEXCEPT; // eigen decomposition of symmetric real matrices void arma_fortran(arma_ssyev)(const char* jobz, const char* uplo, const blas_int* n, float* a, const blas_int* lda, float* w, float* work, const blas_int* lwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dsyev)(const char* jobz, const char* uplo, const blas_int* n, double* a, const blas_int* lda, double* w, double* work, const blas_int* lwork, blas_int* info) ARMA_NOEXCEPT; // eigen decomposition of hermitian matrices (complex) void arma_fortran(arma_cheev)(const char* jobz, const char* uplo, const blas_int* n, blas_cxf* a, const blas_int* lda, float* w, blas_cxf* work, const blas_int* lwork, float* rwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_zheev)(const char* jobz, const char* uplo, const blas_int* n, blas_cxd* a, const blas_int* lda, double* w, blas_cxd* work, const blas_int* lwork, double* rwork, blas_int* info) ARMA_NOEXCEPT; // eigen decomposition of symmetric real matrices by divide and conquer void arma_fortran(arma_ssyevd)(const char* jobz, const char* uplo, const blas_int* n, float* a, const blas_int* lda, float* w, float* work, const blas_int* lwork, blas_int* iwork, const blas_int* liwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dsyevd)(const char* jobz, const char* uplo, const blas_int* n, double* a, const blas_int* lda, double* w, double* work, const blas_int* lwork, blas_int* iwork, const blas_int* liwork, blas_int* info) ARMA_NOEXCEPT; // eigen decomposition of hermitian matrices (complex) by divide and conquer void arma_fortran(arma_cheevd)(const char* jobz, const char* uplo, const blas_int* n, blas_cxf* a, const blas_int* lda, float* w, blas_cxf* work, const blas_int* lwork, float* rwork, const blas_int* lrwork, blas_int* iwork, const blas_int* liwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_zheevd)(const char* jobz, const char* uplo, const blas_int* n, blas_cxd* a, const blas_int* lda, double* w, blas_cxd* work, const blas_int* lwork, double* rwork, const blas_int* lrwork, blas_int* iwork, const blas_int* liwork, blas_int* info) ARMA_NOEXCEPT; // eigen decomposition of general real matrix pair void arma_fortran(arma_sggev)(const char* jobvl, const char* jobvr, const blas_int* n, float* a, const blas_int* lda, float* b, const blas_int* ldb, float* alphar, float* alphai, float* beta, float* vl, const blas_int* ldvl, float* vr, const blas_int* ldvr, float* work, const blas_int* lwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dggev)(const char* jobvl, const char* jobvr, const blas_int* n, double* a, const blas_int* lda, double* b, const blas_int* ldb, double* alphar, double* alphai, double* beta, double* vl, const blas_int* ldvl, double* vr, const blas_int* ldvr, double* work, const blas_int* lwork, blas_int* info) ARMA_NOEXCEPT; // eigen decomposition of general complex matrix pair void arma_fortran(arma_cggev)(const char* jobvl, const char* jobvr, const blas_int* n, blas_cxf* a, const blas_int* lda, blas_cxf* b, const blas_int* ldb, blas_cxf* alpha, blas_cxf* beta, blas_cxf* vl, const blas_int* ldvl, blas_cxf* vr, const blas_int* ldvr, blas_cxf* work, const blas_int* lwork, float* rwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_zggev)(const char* jobvl, const char* jobvr, const blas_int* n, blas_cxd* a, const blas_int* lda, blas_cxd* b, const blas_int* ldb, blas_cxd* alpha, blas_cxd* beta, blas_cxd* vl, const blas_int* ldvl, blas_cxd* vr, const blas_int* ldvr, blas_cxd* work, const blas_int* lwork, double* rwork, blas_int* info) ARMA_NOEXCEPT; // Cholesky decomposition void arma_fortran(arma_spotrf)(const char* uplo, const blas_int* n, float* a, const blas_int* lda, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dpotrf)(const char* uplo, const blas_int* n, double* a, const blas_int* lda, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_cpotrf)(const char* uplo, const blas_int* n, blas_cxf* a, const blas_int* lda, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_zpotrf)(const char* uplo, const blas_int* n, blas_cxd* a, const blas_int* lda, blas_int* info) ARMA_NOEXCEPT; // solve system of linear equations with pre-computed Cholesky decomposition void arma_fortran(arma_spotrs)(const char* uplo, const blas_int* n, const blas_int* nrhs, const float* a, const blas_int* lda, float* b, const blas_int* ldb, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dpotrs)(const char* uplo, const blas_int* n, const blas_int* nrhs, const double* a, const blas_int* lda, double* b, const blas_int* ldb, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_cpotrs)(const char* uplo, const blas_int* n, const blas_int* nrhs, const blas_cxf* a, const blas_int* lda, blas_cxf* b, const blas_int* ldb, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_zpotrs)(const char* uplo, const blas_int* n, const blas_int* nrhs, const blas_cxd* a, const blas_int* lda, blas_cxd* b, const blas_int* ldb, blas_int* info) ARMA_NOEXCEPT; // Cholesky decomposition (band matrices) void arma_fortran(arma_spbtrf)(const char* uplo, const blas_int* n, const blas_int* kd, float* ab, const blas_int* ldab, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dpbtrf)(const char* uplo, const blas_int* n, const blas_int* kd, double* ab, const blas_int* ldab, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_cpbtrf)(const char* uplo, const blas_int* n, const blas_int* kd, blas_cxf* ab, const blas_int* ldab, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_zpbtrf)(const char* uplo, const blas_int* n, const blas_int* kd, blas_cxd* ab, const blas_int* ldab, blas_int* info) ARMA_NOEXCEPT; // matrix inversion (using pre-computed Cholesky decomposition) void arma_fortran(arma_spotri)(const char* uplo, const blas_int* n, float* a, const blas_int* lda, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dpotri)(const char* uplo, const blas_int* n, double* a, const blas_int* lda, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_cpotri)(const char* uplo, const blas_int* n, blas_cxf* a, const blas_int* lda, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_zpotri)(const char* uplo, const blas_int* n, blas_cxd* a, const blas_int* lda, blas_int* info) ARMA_NOEXCEPT; // QR decomposition void arma_fortran(arma_sgeqrf)(const blas_int* m, const blas_int* n, float* a, const blas_int* lda, float* tau, float* work, const blas_int* lwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dgeqrf)(const blas_int* m, const blas_int* n, double* a, const blas_int* lda, double* tau, double* work, const blas_int* lwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_cgeqrf)(const blas_int* m, const blas_int* n, blas_cxf* a, const blas_int* lda, blas_cxf* tau, blas_cxf* work, const blas_int* lwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_zgeqrf)(const blas_int* m, const blas_int* n, blas_cxd* a, const blas_int* lda, blas_cxd* tau, blas_cxd* work, const blas_int* lwork, blas_int* info) ARMA_NOEXCEPT; // QR decomposition with pivoting (real matrices) void arma_fortran(arma_sgeqp3)(const blas_int* m, const blas_int* n, float* a, const blas_int* lda, blas_int* jpvt, float* tau, float* work, const blas_int* lwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dgeqp3)(const blas_int* m, const blas_int* n, double* a, const blas_int* lda, blas_int* jpvt, double* tau, double* work, const blas_int* lwork, blas_int* info) ARMA_NOEXCEPT; // QR decomposition with pivoting (complex matrices) void arma_fortran(arma_cgeqp3)(const blas_int* m, const blas_int* n, blas_cxf* a, const blas_int* lda, blas_int* jpvt, blas_cxf* tau, blas_cxf* work, const blas_int* lwork, float* rwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_zgeqp3)(const blas_int* m, const blas_int* n, blas_cxd* a, const blas_int* lda, blas_int* jpvt, blas_cxd* tau, blas_cxd* work, const blas_int* lwork, double* rwork, blas_int* info) ARMA_NOEXCEPT; // Q matrix calculation from QR decomposition (real matrices) void arma_fortran(arma_sorgqr)(const blas_int* m, const blas_int* n, const blas_int* k, float* a, const blas_int* lda, const float* tau, float* work, const blas_int* lwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dorgqr)(const blas_int* m, const blas_int* n, const blas_int* k, double* a, const blas_int* lda, const double* tau, double* work, const blas_int* lwork, blas_int* info) ARMA_NOEXCEPT; // Q matrix calculation from QR decomposition (complex matrices) void arma_fortran(arma_cungqr)(const blas_int* m, const blas_int* n, const blas_int* k, blas_cxf* a, const blas_int* lda, const blas_cxf* tau, blas_cxf* work, const blas_int* lwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_zungqr)(const blas_int* m, const blas_int* n, const blas_int* k, blas_cxd* a, const blas_int* lda, const blas_cxd* tau, blas_cxd* work, const blas_int* lwork, blas_int* info) ARMA_NOEXCEPT; // SVD (real matrices) void arma_fortran(arma_sgesvd)(const char* jobu, const char* jobvt, const blas_int* m, const blas_int* n, float* a, const blas_int* lda, float* s, float* u, const blas_int* ldu, float* vt, const blas_int* ldvt, float* work, const blas_int* lwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dgesvd)(const char* jobu, const char* jobvt, const blas_int* m, const blas_int* n, double* a, const blas_int* lda, double* s, double* u, const blas_int* ldu, double* vt, const blas_int* ldvt, double* work, const blas_int* lwork, blas_int* info) ARMA_NOEXCEPT; // SVD (complex matrices) void arma_fortran(arma_cgesvd)(const char* jobu, const char* jobvt, const blas_int* m, const blas_int* n, blas_cxf* a, const blas_int* lda, float* s, blas_cxf* u, const blas_int* ldu, blas_cxf* vt, const blas_int* ldvt, blas_cxf* work, const blas_int* lwork, float* rwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_zgesvd)(const char* jobu, const char* jobvt, const blas_int* m, const blas_int* n, blas_cxd* a, const blas_int* lda, double* s, blas_cxd* u, const blas_int* ldu, blas_cxd* vt, const blas_int* ldvt, blas_cxd* work, const blas_int* lwork, double* rwork, blas_int* info) ARMA_NOEXCEPT; // SVD (real matrices) by divide and conquer void arma_fortran(arma_sgesdd)(const char* jobz, const blas_int* m, const blas_int* n, float* a, const blas_int* lda, float* s, float* u, const blas_int* ldu, float* vt, const blas_int* ldvt, float* work, const blas_int* lwork, blas_int* iwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dgesdd)(const char* jobz, const blas_int* m, const blas_int* n, double* a, const blas_int* lda, double* s, double* u, const blas_int* ldu, double* vt, const blas_int* ldvt, double* work, const blas_int* lwork, blas_int* iwork, blas_int* info) ARMA_NOEXCEPT; // SVD (complex matrices) by divide and conquer void arma_fortran(arma_cgesdd)(const char* jobz, const blas_int* m, const blas_int* n, blas_cxf* a, const blas_int* lda, float* s, blas_cxf* u, const blas_int* ldu, blas_cxf* vt, const blas_int* ldvt, blas_cxf* work, const blas_int* lwork, float* rwork, blas_int* iwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_zgesdd)(const char* jobz, const blas_int* m, const blas_int* n, blas_cxd* a, const blas_int* lda, double* s, blas_cxd* u, const blas_int* ldu, blas_cxd* vt, const blas_int* ldvt, blas_cxd* work, const blas_int* lwork, double* rwork, blas_int* iwork, blas_int* info) ARMA_NOEXCEPT; // solve system of linear equations (general square matrix) void arma_fortran(arma_sgesv)(const blas_int* n, const blas_int* nrhs, float* a, const blas_int* lda, blas_int* ipiv, float* b, const blas_int* ldb, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dgesv)(const blas_int* n, const blas_int* nrhs, double* a, const blas_int* lda, blas_int* ipiv, double* b, const blas_int* ldb, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_cgesv)(const blas_int* n, const blas_int* nrhs, blas_cxf* a, const blas_int* lda, blas_int* ipiv, blas_cxf* b, const blas_int* ldb, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_zgesv)(const blas_int* n, const blas_int* nrhs, blas_cxd* a, const blas_int* lda, blas_int* ipiv, blas_cxd* b, const blas_int* ldb, blas_int* info) ARMA_NOEXCEPT; // solve system of linear equations (general square matrix, advanced form, real matrices) void arma_fortran(arma_sgesvx)(const char* fact, const char* trans, const blas_int* n, const blas_int* nrhs, float* a, const blas_int* lda, float* af, const blas_int* ldaf, blas_int* ipiv, char* equed, float* r, float* c, float* b, const blas_int* ldb, float* x, const blas_int* ldx, float* rcond, float* ferr, float* berr, float* work, blas_int* iwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dgesvx)(const char* fact, const char* trans, const blas_int* n, const blas_int* nrhs, double* a, const blas_int* lda, double* af, const blas_int* ldaf, blas_int* ipiv, char* equed, double* r, double* c, double* b, const blas_int* ldb, double* x, const blas_int* ldx, double* rcond, double* ferr, double* berr, double* work, blas_int* iwork, blas_int* info) ARMA_NOEXCEPT; // solve system of linear equations (general square matrix, advanced form, complex matrices) void arma_fortran(arma_cgesvx)(const char* fact, const char* trans, const blas_int* n, const blas_int* nrhs, blas_cxf* a, const blas_int* lda, blas_cxf* af, const blas_int* ldaf, blas_int* ipiv, char* equed, float* r, float* c, blas_cxf* b, const blas_int* ldb, blas_cxf* x, const blas_int* ldx, float* rcond, float* ferr, float* berr, blas_cxf* work, float* rwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_zgesvx)(const char* fact, const char* trans, const blas_int* n, const blas_int* nrhs, blas_cxd* a, const blas_int* lda, blas_cxd* af, const blas_int* ldaf, blas_int* ipiv, char* equed, double* r, double* c, blas_cxd* b, const blas_int* ldb, blas_cxd* x, const blas_int* ldx, double* rcond, double* ferr, double* berr, blas_cxd* work, double* rwork, blas_int* info) ARMA_NOEXCEPT; // solve system of linear equations (symmetric positive definite matrix) void arma_fortran(arma_sposv)(const char* uplo, const blas_int* n, const blas_int* nrhs, float* a, const blas_int* lda, float* b, const blas_int* ldb, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dposv)(const char* uplo, const blas_int* n, const blas_int* nrhs, double* a, const blas_int* lda, double* b, const blas_int* ldb, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_cposv)(const char* uplo, const blas_int* n, const blas_int* nrhs, blas_cxf* a, const blas_int* lda, blas_cxf* b, const blas_int* ldb, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_zposv)(const char* uplo, const blas_int* n, const blas_int* nrhs, blas_cxd* a, const blas_int* lda, blas_cxd* b, const blas_int* ldb, blas_int* info) ARMA_NOEXCEPT; // solve system of linear equations (symmetric positive definite matrix, advanced form, real matrices) void arma_fortran(arma_sposvx)(const char* fact, const char* uplo, const blas_int* n, const blas_int* nrhs, float* a, const blas_int* lda, float* af, const blas_int* ldaf, char* equed, float* s, float* b, const blas_int* ldb, float* x, const blas_int* ldx, float* rcond, float* ferr, float* berr, float* work, blas_int* iwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dposvx)(const char* fact, const char* uplo, const blas_int* n, const blas_int* nrhs, double* a, const blas_int* lda, double* af, const blas_int* ldaf, char* equed, double* s, double* b, const blas_int* ldb, double* x, const blas_int* ldx, double* rcond, double* ferr, double* berr, double* work, blas_int* iwork, blas_int* info) ARMA_NOEXCEPT; // solve system of linear equations (hermitian positive definite matrix, advanced form, complex matrices) void arma_fortran(arma_cposvx)(const char* fact, const char* uplo, const blas_int* n, const blas_int* nrhs, blas_cxf* a, const blas_int* lda, blas_cxf* af, const blas_int* ldaf, char* equed, float* s, blas_cxf* b, const blas_int* ldb, blas_cxf* x, const blas_int* ldx, float* rcond, float* ferr, float* berr, blas_cxf* work, float* rwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_zposvx)(const char* fact, const char* uplo, const blas_int* n, const blas_int* nrhs, blas_cxd* a, const blas_int* lda, blas_cxd* af, const blas_int* ldaf, char* equed, double* s, blas_cxd* b, const blas_int* ldb, blas_cxd* x, const blas_int* ldx, double* rcond, double* ferr, double* berr, blas_cxd* work, double* rwork, blas_int* info) ARMA_NOEXCEPT; // solve over/under-determined system of linear equations void arma_fortran(arma_sgels)(const char* trans, const blas_int* m, const blas_int* n, const blas_int* nrhs, float* a, const blas_int* lda, float* b, const blas_int* ldb, float* work, const blas_int* lwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dgels)(const char* trans, const blas_int* m, const blas_int* n, const blas_int* nrhs, double* a, const blas_int* lda, double* b, const blas_int* ldb, double* work, const blas_int* lwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_cgels)(const char* trans, const blas_int* m, const blas_int* n, const blas_int* nrhs, blas_cxf* a, const blas_int* lda, blas_cxf* b, const blas_int* ldb, blas_cxf* work, const blas_int* lwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_zgels)(const char* trans, const blas_int* m, const blas_int* n, const blas_int* nrhs, blas_cxd* a, const blas_int* lda, blas_cxd* b, const blas_int* ldb, blas_cxd* work, const blas_int* lwork, blas_int* info) ARMA_NOEXCEPT; // approximately solve system of linear equations using svd (real) void arma_fortran(arma_sgelsd)(const blas_int* m, const blas_int* n, const blas_int* nrhs, float* a, const blas_int* lda, float* b, const blas_int* ldb, float* S, const float* rcond, blas_int* rank, float* work, const blas_int* lwork, blas_int* iwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dgelsd)(const blas_int* m, const blas_int* n, const blas_int* nrhs, double* a, const blas_int* lda, double* b, const blas_int* ldb, double* S, const double* rcond, blas_int* rank, double* work, const blas_int* lwork, blas_int* iwork, blas_int* info) ARMA_NOEXCEPT; // approximately solve system of linear equations using svd (complex) void arma_fortran(arma_cgelsd)(const blas_int* m, const blas_int* n, const blas_int* nrhs, blas_cxf* a, const blas_int* lda, blas_cxf* b, const blas_int* ldb, float* S, const float* rcond, blas_int* rank, blas_cxf* work, const blas_int* lwork, float* rwork, blas_int* iwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_zgelsd)(const blas_int* m, const blas_int* n, const blas_int* nrhs, blas_cxd* a, const blas_int* lda, blas_cxd* b, const blas_int* ldb, double* S, const double* rcond, blas_int* rank, blas_cxd* work, const blas_int* lwork, double* rwork, blas_int* iwork, blas_int* info) ARMA_NOEXCEPT; // solve system of linear equations (triangular matrix) void arma_fortran(arma_strtrs)(const char* uplo, const char* trans, const char* diag, const blas_int* n, const blas_int* nrhs, const float* a, const blas_int* lda, float* b, const blas_int* ldb, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dtrtrs)(const char* uplo, const char* trans, const char* diag, const blas_int* n, const blas_int* nrhs, const double* a, const blas_int* lda, double* b, const blas_int* ldb, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_ctrtrs)(const char* uplo, const char* trans, const char* diag, const blas_int* n, const blas_int* nrhs, const blas_cxf* a, const blas_int* lda, blas_cxf* b, const blas_int* ldb, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_ztrtrs)(const char* uplo, const char* trans, const char* diag, const blas_int* n, const blas_int* nrhs, const blas_cxd* a, const blas_int* lda, blas_cxd* b, const blas_int* ldb, blas_int* info) ARMA_NOEXCEPT; // LU factorisation (general band matrix) void arma_fortran(arma_sgbtrf)(const blas_int* m, const blas_int* n, const blas_int* kl, const blas_int* ku, float* ab, const blas_int* ldab, blas_int* ipiv, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dgbtrf)(const blas_int* m, const blas_int* n, const blas_int* kl, const blas_int* ku, double* ab, const blas_int* ldab, blas_int* ipiv, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_cgbtrf)(const blas_int* m, const blas_int* n, const blas_int* kl, const blas_int* ku, blas_cxf* ab, const blas_int* ldab, blas_int* ipiv, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_zgbtrf)(const blas_int* m, const blas_int* n, const blas_int* kl, const blas_int* ku, blas_cxd* ab, const blas_int* ldab, blas_int* ipiv, blas_int* info) ARMA_NOEXCEPT; // solve system of linear equations using pre-computed LU decomposition (general band matrix) void arma_fortran(arma_sgbtrs)(const char* trans, const blas_int* n, const blas_int* kl, const blas_int* ku, const blas_int* nrhs, const float* ab, const blas_int* ldab, const blas_int* ipiv, float* b, const blas_int* ldb, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dgbtrs)(const char* trans, const blas_int* n, const blas_int* kl, const blas_int* ku, const blas_int* nrhs, const double* ab, const blas_int* ldab, const blas_int* ipiv, double* b, const blas_int* ldb, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_cgbtrs)(const char* trans, const blas_int* n, const blas_int* kl, const blas_int* ku, const blas_int* nrhs, const blas_cxf* ab, const blas_int* ldab, const blas_int* ipiv, blas_cxf* b, const blas_int* ldb, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_zgbtrs)(const char* trans, const blas_int* n, const blas_int* kl, const blas_int* ku, const blas_int* nrhs, const blas_cxd* ab, const blas_int* ldab, const blas_int* ipiv, blas_cxd* b, const blas_int* ldb, blas_int* info) ARMA_NOEXCEPT; // solve system of linear equations (general band matrix) void arma_fortran(arma_sgbsv)(const blas_int* n, const blas_int* kl, const blas_int* ku, const blas_int* nrhs, float* ab, const blas_int* ldab, blas_int* ipiv, float* b, const blas_int* ldb, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dgbsv)(const blas_int* n, const blas_int* kl, const blas_int* ku, const blas_int* nrhs, double* ab, const blas_int* ldab, blas_int* ipiv, double* b, const blas_int* ldb, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_cgbsv)(const blas_int* n, const blas_int* kl, const blas_int* ku, const blas_int* nrhs, blas_cxf* ab, const blas_int* ldab, blas_int* ipiv, blas_cxf* b, const blas_int* ldb, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_zgbsv)(const blas_int* n, const blas_int* kl, const blas_int* ku, const blas_int* nrhs, blas_cxd* ab, const blas_int* ldab, blas_int* ipiv, blas_cxd* b, const blas_int* ldb, blas_int* info) ARMA_NOEXCEPT; // solve system of linear equations (general band matrix, advanced form, real matrices) void arma_fortran(arma_sgbsvx)(const char* fact, const char* trans, const blas_int* n, const blas_int* kl, const blas_int* ku, const blas_int* nrhs, float* ab, const blas_int* ldab, float* afb, const blas_int* ldafb, blas_int* ipiv, char* equed, float* r, float* c, float* b, const blas_int* ldb, float* x, const blas_int* ldx, float* rcond, float* ferr, float* berr, float* work, blas_int* iwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dgbsvx)(const char* fact, const char* trans, const blas_int* n, const blas_int* kl, const blas_int* ku, const blas_int* nrhs, double* ab, const blas_int* ldab, double* afb, const blas_int* ldafb, blas_int* ipiv, char* equed, double* r, double* c, double* b, const blas_int* ldb, double* x, const blas_int* ldx, double* rcond, double* ferr, double* berr, double* work, blas_int* iwork, blas_int* info) ARMA_NOEXCEPT; // solve system of linear equations (general band matrix, advanced form, complex matrices) void arma_fortran(arma_cgbsvx)(const char* fact, const char* trans, const blas_int* n, const blas_int* kl, const blas_int* ku, const blas_int* nrhs, blas_cxf* ab, const blas_int* ldab, blas_cxf* afb, const blas_int* ldafb, blas_int* ipiv, char* equed, float* r, float* c, blas_cxf* b, const blas_int* ldb, blas_cxf* x, const blas_int* ldx, float* rcond, float* ferr, float* berr, blas_cxf* work, float* rwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_zgbsvx)(const char* fact, const char* trans, const blas_int* n, const blas_int* kl, const blas_int* ku, const blas_int* nrhs, blas_cxd* ab, const blas_int* ldab, blas_cxd* afb, const blas_int* ldafb, blas_int* ipiv, char* equed, double* r, double* c, blas_cxd* b, const blas_int* ldb, blas_cxd* x, const blas_int* ldx, double* rcond, double* ferr, double* berr, blas_cxd* work, double* rwork, blas_int* info) ARMA_NOEXCEPT; // solve system of linear equations (tridiagonal band matrix) void arma_fortran(arma_sgtsv)(const blas_int* n, const blas_int* nrhs, float* dl, float* d, float* du, float* b, const blas_int* ldb, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dgtsv)(const blas_int* n, const blas_int* nrhs, double* dl, double* d, double* du, double* b, const blas_int* ldb, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_cgtsv)(const blas_int* n, const blas_int* nrhs, blas_cxf* dl, blas_cxf* d, blas_cxf* du, blas_cxf* b, const blas_int* ldb, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_zgtsv)(const blas_int* n, const blas_int* nrhs, blas_cxd* dl, blas_cxd* d, blas_cxd* du, blas_cxd* b, const blas_int* ldb, blas_int* info) ARMA_NOEXCEPT; // solve system of linear equations (tridiagonal band matrix, advanced form, real matrices) void arma_fortran(arma_sgtsvx)(const char* fact, const char* trans, const blas_int* n, const blas_int* nrhs, const float* dl, const float* d, const float* du, float* dlf, float* df, float* duf, float* du2, blas_int* ipiv, const float* b, const blas_int* ldb, float* x, const blas_int* ldx, float* rcond, float* ferr, float* berr, float* work, blas_int* iwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dgtsvx)(const char* fact, const char* trans, const blas_int* n, const blas_int* nrhs, const double* dl, const double* d, const double* du, double* dlf, double* df, double* duf, double* du2, blas_int* ipiv, const double* b, const blas_int* ldb, double* x, const blas_int* ldx, double* rcond, double* ferr, double* berr, double* work, blas_int* iwork, blas_int* info) ARMA_NOEXCEPT; // solve system of linear equations (tridiagonal band matrix, advanced form, complex matrices) void arma_fortran(arma_cgtsvx)(const char* fact, const char* trans, const blas_int* n, const blas_int* nrhs, const blas_cxf* dl, const blas_cxf* d, const blas_cxf* du, blas_cxf* dlf, blas_cxf* df, blas_cxf* duf, blas_cxf* du2, blas_int* ipiv, const blas_cxf* b, const blas_int* ldb, blas_cxf* x, const blas_int* ldx, float* rcond, float* ferr, float* berr, blas_cxf* work, float* rwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_zgtsvx)(const char* fact, const char* trans, const blas_int* n, const blas_int* nrhs, const blas_cxd* dl, const blas_cxd* d, const blas_cxd* du, blas_cxd* dlf, blas_cxd* df, blas_cxd* duf, blas_cxd* du2, blas_int* ipiv, const blas_cxd* b, const blas_int* ldb, blas_cxd* x, const blas_int* ldx, double* rcond, double* ferr, double* berr, blas_cxd* work, double* rwork, blas_int* info) ARMA_NOEXCEPT; // Schur decomposition (real matrices) void arma_fortran(arma_sgees)(const char* jobvs, const char* sort, fn_select_s2 select, const blas_int* n, float* a, const blas_int* lda, blas_int* sdim, float* wr, float* wi, float* vs, const blas_int* ldvs, float* work, const blas_int* lwork, blas_int* bwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dgees)(const char* jobvs, const char* sort, fn_select_d2 select, const blas_int* n, double* a, const blas_int* lda, blas_int* sdim, double* wr, double* wi, double* vs, const blas_int* ldvs, double* work, const blas_int* lwork, blas_int* bwork, blas_int* info) ARMA_NOEXCEPT; // Schur decomposition (complex matrices) void arma_fortran(arma_cgees)(const char* jobvs, const char* sort, fn_select_c1 select, const blas_int* n, blas_cxf* a, const blas_int* lda, blas_int* sdim, blas_cxf* w, blas_cxf* vs, const blas_int* ldvs, blas_cxf* work, const blas_int* lwork, float* rwork, blas_int* bwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_zgees)(const char* jobvs, const char* sort, fn_select_z1 select, const blas_int* n, blas_cxd* a, const blas_int* lda, blas_int* sdim, blas_cxd* w, blas_cxd* vs, const blas_int* ldvs, blas_cxd* work, const blas_int* lwork, double* rwork, blas_int* bwork, blas_int* info) ARMA_NOEXCEPT; // solve a Sylvester equation ax + xb = c, with a and b assumed to be in Schur form void arma_fortran(arma_strsyl)(const char* transa, const char* transb, const blas_int* isgn, const blas_int* m, const blas_int* n, const float* a, const blas_int* lda, const float* b, const blas_int* ldb, float* c, const blas_int* ldc, float* scale, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dtrsyl)(const char* transa, const char* transb, const blas_int* isgn, const blas_int* m, const blas_int* n, const double* a, const blas_int* lda, const double* b, const blas_int* ldb, double* c, const blas_int* ldc, double* scale, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_ctrsyl)(const char* transa, const char* transb, const blas_int* isgn, const blas_int* m, const blas_int* n, const blas_cxf* a, const blas_int* lda, const blas_cxf* b, const blas_int* ldb, blas_cxf* c, const blas_int* ldc, float* scale, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_ztrsyl)(const char* transa, const char* transb, const blas_int* isgn, const blas_int* m, const blas_int* n, const blas_cxd* a, const blas_int* lda, const blas_cxd* b, const blas_int* ldb, blas_cxd* c, const blas_int* ldc, double* scale, blas_int* info) ARMA_NOEXCEPT; // QZ decomposition (real matrices) void arma_fortran(arma_sgges)(const char* jobvsl, const char* jobvsr, const char* sort, fn_select_s3 selctg, const blas_int* n, float* a, const blas_int* lda, float* b, const blas_int* ldb, blas_int* sdim, float* alphar, float* alphai, float* beta, float* vsl, const blas_int* ldvsl, float* vsr, const blas_int* ldvsr, float* work, const blas_int* lwork, blas_int* bwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dgges)(const char* jobvsl, const char* jobvsr, const char* sort, fn_select_d3 selctg, const blas_int* n, double* a, const blas_int* lda, double* b, const blas_int* ldb, blas_int* sdim, double* alphar, double* alphai, double* beta, double* vsl, const blas_int* ldvsl, double* vsr, const blas_int* ldvsr, double* work, const blas_int* lwork, blas_int* bwork, blas_int* info) ARMA_NOEXCEPT; // QZ decomposition (complex matrices) void arma_fortran(arma_cgges)(const char* jobvsl, const char* jobvsr, const char* sort, fn_select_c2 selctg, const blas_int* n, blas_cxf* a, const blas_int* lda, blas_cxf* b, const blas_int* ldb, blas_int* sdim, blas_cxf* alpha, blas_cxf* beta, blas_cxf* vsl, const blas_int* ldvsl, blas_cxf* vsr, const blas_int* ldvsr, blas_cxf* work, const blas_int* lwork, float* rwork, blas_int* bwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_zgges)(const char* jobvsl, const char* jobvsr, const char* sort, fn_select_z2 selctg, const blas_int* n, blas_cxd* a, const blas_int* lda, blas_cxd* b, const blas_int* ldb, blas_int* sdim, blas_cxd* alpha, blas_cxd* beta, blas_cxd* vsl, const blas_int* ldvsl, blas_cxd* vsr, const blas_int* ldvsr, blas_cxd* work, const blas_int* lwork, double* rwork, blas_int* bwork, blas_int* info) ARMA_NOEXCEPT; // 1-norm (general matrix) float arma_fortran(arma_slange)(const char* norm, const blas_int* m, const blas_int* n, const float* a, const blas_int* lda, float* work) ARMA_NOEXCEPT; double arma_fortran(arma_dlange)(const char* norm, const blas_int* m, const blas_int* n, const double* a, const blas_int* lda, double* work) ARMA_NOEXCEPT; float arma_fortran(arma_clange)(const char* norm, const blas_int* m, const blas_int* n, const blas_cxf* a, const blas_int* lda, float* work) ARMA_NOEXCEPT; double arma_fortran(arma_zlange)(const char* norm, const blas_int* m, const blas_int* n, const blas_cxd* a, const blas_int* lda, double* work) ARMA_NOEXCEPT; // 1-norm (real symmetric matrix) float arma_fortran(arma_slansy)(const char* norm, const char* uplo, const blas_int* n, const float* a, const blas_int* lda, float* work) ARMA_NOEXCEPT; double arma_fortran(arma_dlansy)(const char* norm, const char* uplo, const blas_int* n, const double* a, const blas_int* lda, double* work) ARMA_NOEXCEPT; float arma_fortran(arma_clansy)(const char* norm, const char* uplo, const blas_int* n, const blas_cxf* a, const blas_int* lda, float* work) ARMA_NOEXCEPT; double arma_fortran(arma_zlansy)(const char* norm, const char* uplo, const blas_int* n, const blas_cxd* a, const blas_int* lda, double* work) ARMA_NOEXCEPT; // 1-norm (complex hermitian matrix) float arma_fortran(arma_clanhe)(const char* norm, const char* uplo, const blas_int* n, const blas_cxf* a, const blas_int* lda, float* work) ARMA_NOEXCEPT; double arma_fortran(arma_zlanhe)(const char* norm, const char* uplo, const blas_int* n, const blas_cxd* a, const blas_int* lda, double* work) ARMA_NOEXCEPT; // 1-norm (band matrix) float arma_fortran(arma_slangb)(const char* norm, const blas_int* n, const blas_int* kl, const blas_int* ku, const float* ab, const blas_int* ldab, float* work) ARMA_NOEXCEPT; double arma_fortran(arma_dlangb)(const char* norm, const blas_int* n, const blas_int* kl, const blas_int* ku, const double* ab, const blas_int* ldab, double* work) ARMA_NOEXCEPT; float arma_fortran(arma_clangb)(const char* norm, const blas_int* n, const blas_int* kl, const blas_int* ku, const blas_cxf* ab, const blas_int* ldab, float* work) ARMA_NOEXCEPT; double arma_fortran(arma_zlangb)(const char* norm, const blas_int* n, const blas_int* kl, const blas_int* ku, const blas_cxd* ab, const blas_int* ldab, double* work) ARMA_NOEXCEPT; // reciprocal of condition number (real, generic matrix) void arma_fortran(arma_sgecon)(const char* norm, const blas_int* n, const float* a, const blas_int* lda, const float* anorm, float* rcond, float* work, blas_int* iwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dgecon)(const char* norm, const blas_int* n, const double* a, const blas_int* lda, const double* anorm, double* rcond, double* work, blas_int* iwork, blas_int* info) ARMA_NOEXCEPT; // reciprocal of condition number (complex, generic matrix) void arma_fortran(arma_cgecon)(const char* norm, const blas_int* n, const blas_cxf* a, const blas_int* lda, const float* anorm, float* rcond, blas_cxf* work, float* rwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_zgecon)(const char* norm, const blas_int* n, const blas_cxd* a, const blas_int* lda, const double* anorm, double* rcond, blas_cxd* work, double* rwork, blas_int* info) ARMA_NOEXCEPT; // reciprocal of condition number (real, symmetric positive definite matrix) void arma_fortran(arma_spocon)(const char* uplo, const blas_int* n, const float* a, const blas_int* lda, const float* anorm, float* rcond, float* work, blas_int* iwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dpocon)(const char* uplo, const blas_int* n, const double* a, const blas_int* lda, const double* anorm, double* rcond, double* work, blas_int* iwork, blas_int* info) ARMA_NOEXCEPT; // reciprocal of condition number (complex, hermitian positive definite matrix) void arma_fortran(arma_cpocon)(const char* uplo, const blas_int* n, const blas_cxf* a, const blas_int* lda, const float* anorm, float* rcond, blas_cxf* work, float* rwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_zpocon)(const char* uplo, const blas_int* n, const blas_cxd* a, const blas_int* lda, const double* anorm, double* rcond, blas_cxd* work, double* rwork, blas_int* info) ARMA_NOEXCEPT; // reciprocal of condition number (real, triangular matrix) void arma_fortran(arma_strcon)(const char* norm, const char* uplo, const char* diag, const blas_int* n, const float* a, const blas_int* lda, float* rcond, float* work, blas_int* iwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dtrcon)(const char* norm, const char* uplo, const char* diag, const blas_int* n, const double* a, const blas_int* lda, double* rcond, double* work, blas_int* iwork, blas_int* info) ARMA_NOEXCEPT; // reciprocal of condition number (complex, triangular matrix) void arma_fortran(arma_ctrcon)(const char* norm, const char* uplo, const char* diag, const blas_int* n, const blas_cxf* a, const blas_int* lda, float* rcond, blas_cxf* work, float* rwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_ztrcon)(const char* norm, const char* uplo, const char* diag, const blas_int* n, const blas_cxd* a, const blas_int* lda, double* rcond, blas_cxd* work, double* rwork, blas_int* info) ARMA_NOEXCEPT; // reciprocal of condition number (real, band matrix) void arma_fortran(arma_sgbcon)(const char* norm, const blas_int* n, const blas_int* kl, const blas_int* ku, const float* ab, const blas_int* ldab, const blas_int* ipiv, const float* anorm, float* rcond, float* work, blas_int* iwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dgbcon)(const char* norm, const blas_int* n, const blas_int* kl, const blas_int* ku, const double* ab, const blas_int* ldab, const blas_int* ipiv, const double* anorm, double* rcond, double* work, blas_int* iwork, blas_int* info) ARMA_NOEXCEPT; // reciprocal of condition number (complex, band matrix) void arma_fortran(arma_cgbcon)(const char* norm, const blas_int* n, const blas_int* kl, const blas_int* ku, const blas_cxf* ab, const blas_int* ldab, const blas_int* ipiv, const float* anorm, float* rcond, blas_cxf* work, float* rwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_zgbcon)(const char* norm, const blas_int* n, const blas_int* kl, const blas_int* ku, const blas_cxd* ab, const blas_int* ldab, const blas_int* ipiv, const double* anorm, double* rcond, blas_cxd* work, double* rwork, blas_int* info) ARMA_NOEXCEPT; // obtain parameters according to the local configuration of lapack // NOTE: DO NOT USE THIS FORM; kept only for compatibility // NOTE: this function takes 'name' and 'opts' argumments, which are strings with length != 1; their length needs to be given via "hidden" parameters, which this form lacks blas_int arma_fortran(arma_ilaenv)(const blas_int* ispec, const char* name, const char* opts, const blas_int* n1, const blas_int* n2, const blas_int* n3, const blas_int* n4) ARMA_NOEXCEPT; // calculate eigenvalues of an upper Hessenberg matrix void arma_fortran(arma_slahqr)(const blas_int* wantt, const blas_int* wantz, const blas_int* n, const blas_int* ilo, const blas_int* ihi, float* h, const blas_int* ldh, float* wr, float* wi, const blas_int* iloz, const blas_int* ihiz, float* z, const blas_int* ldz, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dlahqr)(const blas_int* wantt, const blas_int* wantz, const blas_int* n, const blas_int* ilo, const blas_int* ihi, double* h, const blas_int* ldh, double* wr, double* wi, const blas_int* iloz, const blas_int* ihiz, double* z, const blas_int* ldz, blas_int* info) ARMA_NOEXCEPT; // calculate eigenvalues of a symmetric tridiagonal matrix void arma_fortran(arma_sstedc)(const char* compz, const blas_int* n, float* d, float* e, float* z, const blas_int* ldz, float* work, const blas_int* lwork, blas_int* iwork, const blas_int* liwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dstedc)(const char* compz, const blas_int* n, double* d, double* e, double* z, const blas_int* ldz, double* work, const blas_int* lwork, blas_int* iwork, const blas_int* liwork, blas_int* info) ARMA_NOEXCEPT; // calculate eigenvectors of a Schur form matrix void arma_fortran(arma_strevc)(const char* side, const char* howmny, blas_int* select, const blas_int* n, const float* t, const blas_int* ldt, float* vl, const blas_int* ldvl, float* vr, const blas_int* ldvr, const blas_int* mm, blas_int* m, float* work, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dtrevc)(const char* side, const char* howmny, blas_int* select, const blas_int* n, const double* t, const blas_int* ldt, double* vl, const blas_int* ldvl, double* vr, const blas_int* ldvr, const blas_int* mm, blas_int* m, double* work, blas_int* info) ARMA_NOEXCEPT; // hessenberg decomposition void arma_fortran(arma_sgehrd)(const blas_int* n, const blas_int* ilo, const blas_int* ihi, float* a, const blas_int* lda, float* tao, float* work, const blas_int* lwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dgehrd)(const blas_int* n, const blas_int* ilo, const blas_int* ihi, double* a, const blas_int* lda, double* tao, double* work, const blas_int* lwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_cgehrd)(const blas_int* n, const blas_int* ilo, const blas_int* ihi, blas_cxf* a, const blas_int* lda, blas_cxf* tao, blas_cxf* work, const blas_int* lwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_zgehrd)(const blas_int* n, const blas_int* ilo, const blas_int* ihi, blas_cxd* a, const blas_int* lda, blas_cxd* tao, blas_cxd* work, const blas_int* lwork, blas_int* info) ARMA_NOEXCEPT; // pivoted cholesky void arma_fortran(arma_spstrf)(const char* uplo, const blas_int* n, float* a, const blas_int* lda, blas_int* piv, blas_int* rank, const float* tol, float* work, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dpstrf)(const char* uplo, const blas_int* n, double* a, const blas_int* lda, blas_int* piv, blas_int* rank, const double* tol, double* work, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_cpstrf)(const char* uplo, const blas_int* n, blas_cxf* a, const blas_int* lda, blas_int* piv, blas_int* rank, const float* tol, float* work, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_zpstrf)(const char* uplo, const blas_int* n, blas_cxd* a, const blas_int* lda, blas_int* piv, blas_int* rank, const double* tol, double* work, blas_int* info) ARMA_NOEXCEPT; // factorisation of symmetric matrix (real) void arma_fortran(arma_ssytrf)(const char* uplo, const blas_int* n, float* a, const blas_int* lda, blas_int* ipiv, float* work, const blas_int* lwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dsytrf)(const char* uplo, const blas_int* n, double* a, const blas_int* lda, blas_int* ipiv, double* work, const blas_int* lwork, blas_int* info) ARMA_NOEXCEPT; // factorisation of hermitian matrix (complex) void arma_fortran(arma_chetrf)(const char* uplo, const blas_int* n, blas_cxf* a, const blas_int* lda, blas_int* ipiv, blas_cxf* work, const blas_int* lwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_zhetrf)(const char* uplo, const blas_int* n, blas_cxd* a, const blas_int* lda, blas_int* ipiv, blas_cxd* work, const blas_int* lwork, blas_int* info) ARMA_NOEXCEPT; // solve system using pre-computed factorisation (real) void arma_fortran(arma_ssytrs)(const char* uplo, const blas_int* n, const blas_int* nrhs, const float* a, const blas_int* lda, const blas_int* ipiv, float* b, const blas_int* ldb, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dsytrs)(const char* uplo, const blas_int* n, const blas_int* nrhs, const double* a, const blas_int* lda, const blas_int* ipiv, double* b, const blas_int* ldb, blas_int* info) ARMA_NOEXCEPT; // solve system using pre-computed factorisation (complex) void arma_fortran(arma_zhetrs)(const char* uplo, const blas_int* n, const blas_int* nrhs, const blas_cxd* a, const blas_int* lda, const blas_int* ipiv, blas_cxd* b, const blas_int* ldb, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_chetrs)(const char* uplo, const blas_int* n, const blas_int* nrhs, const blas_cxf* a, const blas_int* lda, const blas_int* ipiv, blas_cxf* b, const blas_int* ldb, blas_int* info) ARMA_NOEXCEPT; // inverse of symmetric matrix using pre-computed factorisation (real) void arma_fortran(arma_ssytri)(const char* uplo, const blas_int* n, float* a, const blas_int* lda, const blas_int* ipiv, float* work, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dsytri)(const char* uplo, const blas_int* n, double* a, const blas_int* lda, const blas_int* ipiv, double* work, blas_int* info) ARMA_NOEXCEPT; // inverse of hermitian matrix using pre-computed factorisation (complex) void arma_fortran(arma_chetri)(const char* uplo, const blas_int* n, blas_cxf* a, const blas_int* lda, const blas_int* ipiv, blas_cxf* work, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_zhetri)(const char* uplo, const blas_int* n, blas_cxd* a, const blas_int* lda, const blas_int* ipiv, blas_cxd* work, blas_int* info) ARMA_NOEXCEPT; // rcond of symmetric matrix using pre-computed factorisation (real) void arma_fortran(arma_ssycon)(const char* uplo, const blas_int* n, const float* a, const blas_int* lda, const blas_int* ipiv, const float* anorm, float* rcond, float* work, blas_int* iwork, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dsycon)(const char* uplo, const blas_int* n, const double* a, const blas_int* lda, const blas_int* ipiv, const double* anorm, double* rcond, double* work, blas_int* iwork, blas_int* info) ARMA_NOEXCEPT; // rcond of hermitian matrix using pre-computed factorisation (complex) void arma_fortran(arma_checon)(const char* uplo, const blas_int* n, const blas_cxf* a, const blas_int* lda, const blas_int* ipiv, const float* anorm, float* rcond, blas_cxf* work, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_zhecon)(const char* uplo, const blas_int* n, const blas_cxd* a, const blas_int* lda, const blas_int* ipiv, const double* anorm, double* rcond, blas_cxd* work, blas_int* info) ARMA_NOEXCEPT; // matrix balance void arma_fortran(arma_sgebal)(const char* job, const blas_int* n, float* a, const blas_int* lda, blas_int* ilo, blas_int* ihi, float* scale, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_dgebal)(const char* job, const blas_int* n, double* a, const blas_int* lda, blas_int* ilo, blas_int* ihi, double* scale, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_cgebal)(const char* job, const blas_int* n, blas_cxf* a, const blas_int* lda, blas_int* ilo, blas_int* ihi, float* scale, blas_int* info) ARMA_NOEXCEPT; void arma_fortran(arma_zgebal)(const char* job, const blas_int* n, blas_cxd* a, const blas_int* lda, blas_int* ilo, blas_int* ihi, double* scale, blas_int* info) ARMA_NOEXCEPT; #endif } #undef ARMA_NOEXCEPT #endif RcppArmadillo/inst/include/armadillo_bits/glue_quantile_bones.hpp0000644000176200001440000000337514301267043025135 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup glue_quantile //! @{ class glue_quantile : public traits_glue_default { public: template inline static void worker(eTb* out_mem, Col& Y, const Mat& P); template inline static void apply_noalias(Mat& out, const Mat& X, const Mat& P, const uword dim); template inline static void apply(Mat& out, const mtGlue& expr); }; class glue_quantile_default { public: template struct traits { static constexpr bool is_row = T1::is_row; static constexpr bool is_col = T1::is_col; static constexpr bool is_xvec = T1::is_xvec; }; template inline static void apply(Mat& out, const mtGlue& expr); }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_symmat_meat.hpp0000644000176200001440000001443314631567470024141 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_symmat //! @{ template inline void op_symmatu::apply(Mat& out, const Op& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const unwrap tmp(in.m); const Mat& A = tmp.M; arma_conform_check( (A.is_square() == false), "symmatu(): given matrix must be square sized" ); const uword N = A.n_rows; if(&out != &A) { out.copy_size(A); // upper triangular: copy the diagonal and the elements above the diagonal for(uword i=0; i inline void op_symmatl::apply(Mat& out, const Op& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const unwrap tmp(in.m); const Mat& A = tmp.M; arma_conform_check( (A.is_square() == false), "symmatl(): given matrix must be square sized" ); const uword N = A.n_rows; if(&out != &A) { out.copy_size(A); // lower triangular: copy the diagonal and the elements below the diagonal for(uword i=0; i inline void op_symmatu_cx::apply(Mat& out, const Op& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const unwrap tmp(in.m); const Mat& A = tmp.M; arma_conform_check( (A.is_square() == false), "symmatu(): given matrix must be square sized" ); const uword N = A.n_rows; const bool do_conj = (in.aux_uword_b == 1); if(&out != &A) { out.copy_size(A); // upper triangular: copy the diagonal and the elements above the diagonal for(uword i=0; i inline void op_symmatl_cx::apply(Mat& out, const Op& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const unwrap tmp(in.m); const Mat& A = tmp.M; arma_conform_check( (A.is_square() == false), "symmatl(): given matrix must be square sized" ); const uword N = A.n_rows; const bool do_conj = (in.aux_uword_b == 1); if(&out != &A) { out.copy_size(A); // lower triangular: copy the diagonal and the elements below the diagonal for(uword i=0; i arma_warn_unused inline const Op cov(const Base& X, const uword norm_type = 0) { arma_debug_sigprint(); arma_conform_check( (norm_type > 1), "cov(): parameter 'norm_type' must be 0 or 1" ); return Op(X.get_ref(), norm_type, 0); } template arma_warn_unused inline const Glue cov(const Base& A, const Base& B, const uword norm_type = 0) { arma_debug_sigprint(); arma_conform_check( (norm_type > 1), "cov(): parameter 'norm_type' must be 0 or 1" ); return Glue(A.get_ref(), B.get_ref(), norm_type); } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_trace.hpp0000644000176200001440000003757214631567470022715 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_trace //! @{ template arma_warn_unused inline typename T1::elem_type trace(const Base& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const Proxy P(X.get_ref()); const uword N = (std::min)(P.get_n_rows(), P.get_n_cols()); eT val1 = eT(0); eT val2 = eT(0); uword i,j; for(i=0, j=1; j arma_warn_unused inline typename T1::elem_type trace(const Op& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const diagmat_proxy A(X.m); const uword N = (std::min)(A.n_rows, A.n_cols); eT val = eT(0); for(uword i=0; i arma_warn_unused inline typename enable_if2< is_cx::no, typename T1::elem_type>::result trace(const Glue& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const partial_unwrap tmp1(X.A); const partial_unwrap tmp2(X.B); const typename partial_unwrap::stored_type& A = tmp1.M; const typename partial_unwrap::stored_type& B = tmp2.M; const bool use_alpha = partial_unwrap::do_times || partial_unwrap::do_times; const eT alpha = use_alpha ? (tmp1.get_val() * tmp2.get_val()) : eT(0); arma_conform_assert_trans_mul_size< partial_unwrap::do_trans, partial_unwrap::do_trans >(A.n_rows, A.n_cols, B.n_rows, B.n_cols, "matrix multiplication"); if( (A.n_elem == 0) || (B.n_elem == 0) ) { return eT(0); } const uword A_n_rows = A.n_rows; const uword A_n_cols = A.n_cols; const uword B_n_rows = B.n_rows; const uword B_n_cols = B.n_cols; eT acc = eT(0); if( (partial_unwrap::do_trans == false) && (partial_unwrap::do_trans == false) ) { const uword N = (std::min)(A_n_rows, B_n_cols); eT acc1 = eT(0); eT acc2 = eT(0); for(uword k=0; k < N; ++k) { const eT* B_colptr = B.colptr(k); // condition: A_n_cols = B_n_rows uword j; for(j=1; j < A_n_cols; j+=2) { const uword i = (j-1); const eT tmp_i = B_colptr[i]; const eT tmp_j = B_colptr[j]; acc1 += A.at(k, i) * tmp_i; acc2 += A.at(k, j) * tmp_j; } const uword i = (j-1); if(i < A_n_cols) { acc1 += A.at(k, i) * B_colptr[i]; } } acc = (acc1 + acc2); } else if( (partial_unwrap::do_trans == true ) && (partial_unwrap::do_trans == false) ) { const uword N = (std::min)(A_n_cols, B_n_cols); for(uword k=0; k < N; ++k) { const eT* A_colptr = A.colptr(k); const eT* B_colptr = B.colptr(k); // condition: A_n_rows = B_n_rows acc += op_dot::direct_dot(A_n_rows, A_colptr, B_colptr); } } else if( (partial_unwrap::do_trans == false) && (partial_unwrap::do_trans == true ) ) { const uword N = (std::min)(A_n_rows, B_n_rows); for(uword k=0; k < N; ++k) { // condition: A_n_cols = B_n_cols for(uword i=0; i < A_n_cols; ++i) { acc += A.at(k,i) * B.at(k,i); } } } else if( (partial_unwrap::do_trans == true ) && (partial_unwrap::do_trans == true ) ) { const uword N = (std::min)(A_n_cols, B_n_rows); for(uword k=0; k < N; ++k) { const eT* A_colptr = A.colptr(k); // condition: A_n_rows = B_n_cols for(uword i=0; i < A_n_rows; ++i) { acc += A_colptr[i] * B.at(k,i); } } } return (use_alpha) ? (alpha * acc) : acc; } //! speedup for trace(A*B); complex elements template arma_warn_unused inline typename enable_if2< is_cx::yes, typename T1::elem_type>::result trace(const Glue& X) { arma_debug_sigprint(); typedef typename T1::pod_type T; typedef typename T1::elem_type eT; const partial_unwrap tmp1(X.A); const partial_unwrap tmp2(X.B); const typename partial_unwrap::stored_type& A = tmp1.M; const typename partial_unwrap::stored_type& B = tmp2.M; const bool use_alpha = partial_unwrap::do_times || partial_unwrap::do_times; const eT alpha = use_alpha ? (tmp1.get_val() * tmp2.get_val()) : eT(0); arma_conform_assert_trans_mul_size< partial_unwrap::do_trans, partial_unwrap::do_trans >(A.n_rows, A.n_cols, B.n_rows, B.n_cols, "matrix multiplication"); if( (A.n_elem == 0) || (B.n_elem == 0) ) { return eT(0); } const uword A_n_rows = A.n_rows; const uword A_n_cols = A.n_cols; const uword B_n_rows = B.n_rows; const uword B_n_cols = B.n_cols; eT acc = eT(0); if( (partial_unwrap::do_trans == false) && (partial_unwrap::do_trans == false) ) { const uword N = (std::min)(A_n_rows, B_n_cols); T acc_real = T(0); T acc_imag = T(0); for(uword k=0; k < N; ++k) { const eT* B_colptr = B.colptr(k); // condition: A_n_cols = B_n_rows for(uword i=0; i < A_n_cols; ++i) { // acc += A.at(k, i) * B_colptr[i]; const std::complex& xx = A.at(k, i); const std::complex& yy = B_colptr[i]; const T a = xx.real(); const T b = xx.imag(); const T c = yy.real(); const T d = yy.imag(); acc_real += (a*c) - (b*d); acc_imag += (a*d) + (b*c); } } acc = std::complex(acc_real, acc_imag); } else if( (partial_unwrap::do_trans == true) && (partial_unwrap::do_trans == false) ) { const uword N = (std::min)(A_n_cols, B_n_cols); T acc_real = T(0); T acc_imag = T(0); for(uword k=0; k < N; ++k) { const eT* A_colptr = A.colptr(k); const eT* B_colptr = B.colptr(k); // condition: A_n_rows = B_n_rows for(uword i=0; i < A_n_rows; ++i) { // acc += std::conj(A_colptr[i]) * B_colptr[i]; const std::complex& xx = A_colptr[i]; const std::complex& yy = B_colptr[i]; const T a = xx.real(); const T b = xx.imag(); const T c = yy.real(); const T d = yy.imag(); // take into account the complex conjugate of xx acc_real += (a*c) + (b*d); acc_imag += (a*d) - (b*c); } } acc = std::complex(acc_real, acc_imag); } else if( (partial_unwrap::do_trans == false) && (partial_unwrap::do_trans == true) ) { const uword N = (std::min)(A_n_rows, B_n_rows); T acc_real = T(0); T acc_imag = T(0); for(uword k=0; k < N; ++k) { // condition: A_n_cols = B_n_cols for(uword i=0; i < A_n_cols; ++i) { // acc += A.at(k,i) * std::conj(B.at(k,i)); const std::complex& xx = A.at(k, i); const std::complex& yy = B.at(k, i); const T a = xx.real(); const T b = xx.imag(); const T c = yy.real(); const T d = -yy.imag(); // take the conjugate acc_real += (a*c) - (b*d); acc_imag += (a*d) + (b*c); } } acc = std::complex(acc_real, acc_imag); } else if( (partial_unwrap::do_trans == true) && (partial_unwrap::do_trans == true) ) { const uword N = (std::min)(A_n_cols, B_n_rows); T acc_real = T(0); T acc_imag = T(0); for(uword k=0; k < N; ++k) { const eT* A_colptr = A.colptr(k); // condition: A_n_rows = B_n_cols for(uword i=0; i < A_n_rows; ++i) { // acc += std::conj(A_colptr[i]) * std::conj(B.at(k,i)); const std::complex& xx = A_colptr[i]; const std::complex& yy = B.at(k, i); const T a = xx.real(); const T b = -xx.imag(); // take the conjugate const T c = yy.real(); const T d = -yy.imag(); // take the conjugate acc_real += (a*c) - (b*d); acc_imag += (a*d) + (b*c); } } acc = std::complex(acc_real, acc_imag); } return (use_alpha) ? eT(alpha * acc) : eT(acc); } //! trace of sparse object; generic version template arma_warn_unused inline typename T1::elem_type trace(const SpBase& expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const SpProxy P(expr.get_ref()); const uword N = (std::min)(P.get_n_rows(), P.get_n_cols()); eT acc = eT(0); if( (is_SpMat::stored_type>::value) && (P.get_n_nonzero() >= 5*N) ) { const unwrap_spmat::stored_type> U(P.Q); const SpMat& X = U.M; for(uword i=0; i < N; ++i) { acc += X.at(i,i); // use binary search } } else { typename SpProxy::const_iterator_type it = P.begin(); const uword P_n_nz = P.get_n_nonzero(); for(uword i=0; i < P_n_nz; ++i) { if(it.row() == it.col()) { acc += (*it); } ++it; } } return acc; } //! trace of sparse object; speedup for trace(A + B) template arma_warn_unused inline typename T1::elem_type trace(const SpGlue& expr) { arma_debug_sigprint(); const unwrap_spmat UA(expr.A); const unwrap_spmat UB(expr.B); arma_conform_assert_same_size(UA.M.n_rows, UA.M.n_cols, UB.M.n_rows, UB.M.n_cols, "addition"); return (trace(UA.M) + trace(UB.M)); } //! trace of sparse object; speedup for trace(A - B) template arma_warn_unused inline typename T1::elem_type trace(const SpGlue& expr) { arma_debug_sigprint(); const unwrap_spmat UA(expr.A); const unwrap_spmat UB(expr.B); arma_conform_assert_same_size(UA.M.n_rows, UA.M.n_cols, UB.M.n_rows, UB.M.n_cols, "subtraction"); return (trace(UA.M) - trace(UB.M)); } //! trace of sparse object; speedup for trace(A % B) template arma_warn_unused inline typename T1::elem_type trace(const SpGlue& expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const unwrap_spmat UA(expr.A); const unwrap_spmat UB(expr.B); const SpMat& A = UA.M; const SpMat& B = UB.M; arma_conform_assert_same_size(A.n_rows, A.n_cols, B.n_rows, B.n_cols, "element-wise multiplication"); const uword N = (std::min)(A.n_rows, A.n_cols); eT acc = eT(0); for(uword i=0; i arma_warn_unused inline typename T1::elem_type trace(const SpGlue& expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; // better-than-nothing implementation const unwrap_spmat UA(expr.A); const unwrap_spmat UB(expr.B); const SpMat& A = UA.M; const SpMat& B = UB.M; arma_conform_assert_mul_size(A.n_rows, A.n_cols, B.n_rows, B.n_cols, "matrix multiplication"); if( (A.n_nonzero == 0) || (B.n_nonzero == 0) ) { return eT(0); } const uword N = (std::min)(A.n_rows, B.n_cols); eT acc = eT(0); // TODO: the threshold may need tuning for complex matrices if( (A.n_nonzero >= 5*N) || (B.n_nonzero >= 5*N) ) { for(uword k=0; k < N; ++k) { typename SpMat::const_col_iterator B_it = B.begin_col_no_sync(k); typename SpMat::const_col_iterator B_it_end = B.end_col_no_sync(k); while(B_it != B_it_end) { const eT B_val = (*B_it); const uword i = B_it.row(); acc += A.at(k,i) * B_val; ++B_it; } } } else { const SpMat AB = A * B; acc = trace(AB); } return acc; } //! trace of sparse object; speedup for trace(A.t()*B); non-complex elements template arma_warn_unused inline typename enable_if2< is_cx::no, typename T1::elem_type>::result trace(const SpGlue, T2, spglue_times>& expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const unwrap_spmat UA(expr.A.m); const unwrap_spmat UB(expr.B); const SpMat& A = UA.M; const SpMat& B = UB.M; // NOTE: deliberately swapped A.n_rows and A.n_cols to take into account the requested transpose operation arma_conform_assert_mul_size(A.n_cols, A.n_rows, B.n_rows, B.n_cols, "matrix multiplication"); if( (A.n_nonzero == 0) || (B.n_nonzero == 0) ) { return eT(0); } const uword N = (std::min)(A.n_cols, B.n_cols); eT acc = eT(0); if( (A.n_nonzero >= 5*N) || (B.n_nonzero >= 5*N) ) { for(uword k=0; k < N; ++k) { typename SpMat::const_col_iterator B_it = B.begin_col_no_sync(k); typename SpMat::const_col_iterator B_it_end = B.end_col_no_sync(k); while(B_it != B_it_end) { const eT B_val = (*B_it); const uword i = B_it.row(); acc += A.at(i,k) * B_val; ++B_it; } } } else { const SpMat AtB = A.t() * B; acc = trace(AtB); } return acc; } //! trace of sparse object; speedup for trace(A.t()*B); complex elements template arma_warn_unused inline typename enable_if2< is_cx::yes, typename T1::elem_type>::result trace(const SpGlue, T2, spglue_times>& expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const unwrap_spmat UA(expr.A.m); const unwrap_spmat UB(expr.B); const SpMat& A = UA.M; const SpMat& B = UB.M; // NOTE: deliberately swapped A.n_rows and A.n_cols to take into account the requested transpose operation arma_conform_assert_mul_size(A.n_cols, A.n_rows, B.n_rows, B.n_cols, "matrix multiplication"); if( (A.n_nonzero == 0) || (B.n_nonzero == 0) ) { return eT(0); } const uword N = (std::min)(A.n_cols, B.n_cols); eT acc = eT(0); // TODO: the threshold may need tuning for complex matrices if( (A.n_nonzero >= 5*N) || (B.n_nonzero >= 5*N) ) { for(uword k=0; k < N; ++k) { typename SpMat::const_col_iterator B_it = B.begin_col_no_sync(k); typename SpMat::const_col_iterator B_it_end = B.end_col_no_sync(k); while(B_it != B_it_end) { const eT B_val = (*B_it); const uword i = B_it.row(); acc += std::conj(A.at(i,k)) * B_val; ++B_it; } } } else { const SpMat AtB = A.t() * B; acc = trace(AtB); } return acc; } //! @} RcppArmadillo/inst/include/armadillo_bits/sp_auxlib_bones.hpp0000644000176200001440000002255714770765377024317 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup sp_auxlib //! @{ //! wrapper for accessing external functions in ARPACK and SuperLU class sp_auxlib { public: enum form_type { form_none, form_lm, form_sm, form_lr, form_la, form_sr, form_li, form_si, form_sa, form_sigma }; inline static form_type interpret_form_str(const char* form_str); // // eigs_sym() for real matrices template inline static bool eigs_sym(Col& eigval, Mat& eigvec, const SpBase& X, const uword n_eigvals, const form_type form_val, const eigs_opts& opts); template inline static bool eigs_sym(Col& eigval, Mat& eigvec, const SpBase& X, const uword n_eigvals, const eT sigma, const eigs_opts& opts); template inline static bool eigs_sym_newarp(Col& eigval, Mat& eigvec, const SpMat& X, const uword n_eigvals, const form_type form_val, const eigs_opts& opts); template inline static bool eigs_sym_newarp(Col& eigval, Mat& eigvec, const SpMat& X, const uword n_eigvals, const eT sigma, const eigs_opts& opts); template inline static bool eigs_sym_arpack(Col& eigval, Mat& eigvec, const SpMat& X, const uword n_eigvals, const form_type form_val, const eT sigma, const eigs_opts& opts); // // eigs_gen() for real matrices template inline static bool eigs_gen(Col< std::complex >& eigval, Mat< std::complex >& eigvec, const SpBase& X, const uword n_eigvals, const form_type form_val, const eigs_opts& opts); template inline static bool eigs_gen(Col< std::complex >& eigval, Mat< std::complex >& eigvec, const SpBase& X, const uword n_eigvals, const std::complex sigma, const eigs_opts& opts); template inline static bool eigs_gen_newarp(Col< std::complex >& eigval, Mat< std::complex >& eigvec, const SpMat& X, const uword n_eigvals, const form_type form_val, const eigs_opts& opts); template inline static bool eigs_gen_arpack(Col< std::complex >& eigval, Mat< std::complex >& eigvec, const SpMat& X, const uword n_eigvals, const form_type form_val, const std::complex sigma, const eigs_opts& opts); // // eigs_gen() for complex matrices template inline static bool eigs_gen(Col< std::complex >& eigval, Mat< std::complex >& eigvec, const SpBase< std::complex, T1>& X, const uword n_eigvals, const form_type form_val, const eigs_opts& opts); template inline static bool eigs_gen(Col< std::complex >& eigval, Mat< std::complex >& eigvec, const SpBase< std::complex, T1>& X, const uword n_eigvals, const std::complex sigma, const eigs_opts& opts); template inline static bool eigs_gen(Col< std::complex >& eigval, Mat< std::complex >& eigvec, const SpMat< std::complex >& X, const uword n_eigvals, const form_type form_val, const std::complex sigma, const eigs_opts& opts); // // spsolve() via SuperLU template inline static bool spsolve_simple(Mat& out, const SpBase& A, const Base& B, const superlu_opts& user_opts); template inline static bool spsolve_refine(Mat& out, typename T1::pod_type& out_rcond, const SpBase& A, const Base& B, const superlu_opts& user_opts); // // support functions #if defined(ARMA_USE_SUPERLU) template inline static typename get_pod_type::result norm1(superlu::SuperMatrix* A); template inline static typename get_pod_type::result lu_rcond(superlu::SuperMatrix* L, superlu::SuperMatrix* U, typename get_pod_type::result norm_val); inline static void set_superlu_opts(superlu::superlu_options_t& options, const superlu_opts& user_opts); template inline static bool copy_to_supermatrix(superlu::SuperMatrix& out, const SpMat& A); template inline static bool copy_to_supermatrix_with_shift(superlu::SuperMatrix& out, const SpMat& A, const eT shift); // // for debugging only // template // inline static void copy_to_spmat(SpMat& out, const superlu::SuperMatrix& A); template inline static bool wrap_to_supermatrix(superlu::SuperMatrix& out, const Mat& A); inline static void destroy_supermatrix(superlu::SuperMatrix& out); #endif private: // calls arpack saupd()/naupd() because the code is so similar for each // all of the extra variables are later used by seupd()/neupd(), but those // functions are very different and we can't combine their code template inline static void run_aupd_plain ( const uword n_eigvals, char* which, const SpMat& X, const SpMat& Xst, const bool sym, blas_int& n, eT& tol, blas_int& maxiter, podarray& resid, blas_int& ncv, podarray& v, blas_int& ldv, podarray& iparam, podarray& ipntr, podarray& workd, podarray& workl, blas_int& lworkl, podarray& rwork, blas_int& info ); template inline static void run_aupd_shiftinvert ( const uword n_eigvals, const T sigma, const SpMat& X, const bool sym, blas_int& n, eT& tol, blas_int& maxiter, podarray& resid, blas_int& ncv, podarray& v, blas_int& ldv, podarray& iparam, podarray& ipntr, podarray& workd, podarray& workl, blas_int& lworkl, podarray& rwork, blas_int& info ); template inline static bool rudimentary_sym_check(const SpMat& X); template inline static bool rudimentary_sym_check(const SpMat< std::complex >& X); }; template struct eigs_randu_filler { std::mt19937_64 local_engine; std::uniform_real_distribution local_u_distr; inline eigs_randu_filler(); inline void fill(podarray& X, const uword N); }; template struct eigs_randu_filler< std::complex > { std::mt19937_64 local_engine; std::uniform_real_distribution local_u_distr; inline eigs_randu_filler(); inline void fill(podarray< std::complex >& X, const uword N); }; #if defined(ARMA_USE_SUPERLU) class superlu_supermatrix_wrangler { private: bool used = false; arma_aligned superlu::SuperMatrix m; public: inline ~superlu_supermatrix_wrangler(); inline superlu_supermatrix_wrangler(); inline superlu_supermatrix_wrangler(const superlu_supermatrix_wrangler&) = delete; inline void operator= (const superlu_supermatrix_wrangler&) = delete; inline superlu::SuperMatrix& get_ref(); inline superlu::SuperMatrix* get_ptr(); }; class superlu_stat_wrangler { private: arma_aligned superlu::SuperLUStat_t stat; public: inline ~superlu_stat_wrangler(); inline superlu_stat_wrangler(); inline superlu_stat_wrangler(const superlu_stat_wrangler&) = delete; inline void operator= (const superlu_stat_wrangler&) = delete; inline superlu::SuperLUStat_t* get_ptr(); }; template class superlu_array_wrangler { private: arma_aligned eT* mem = nullptr; public: inline ~superlu_array_wrangler(); inline superlu_array_wrangler(); inline superlu_array_wrangler(const uword n_elem); inline void set_size(const uword n_elem); inline void reset(); inline superlu_array_wrangler(const superlu_array_wrangler&) = delete; inline void operator= (const superlu_array_wrangler&) = delete; inline eT* get_ptr(); }; template class superlu_worker { private: bool factorisation_valid = false; superlu_supermatrix_wrangler* l = nullptr; superlu_supermatrix_wrangler* u = nullptr; superlu_array_wrangler perm_c; superlu_array_wrangler perm_r; superlu_stat_wrangler stat; public: inline ~superlu_worker(); inline superlu_worker(); inline bool factorise(typename get_pod_type::result& out_rcond, const SpMat& A, const superlu_opts& user_opts); inline bool solve(Mat& X, const Mat& B); inline superlu_worker(const superlu_worker&) = delete; inline void operator= (const superlu_worker&) = delete; }; #endif //! @} RcppArmadillo/inst/include/armadillo_bits/op_index_min_bones.hpp0000644000176200001440000000341714301267043024744 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_index_min //! @{ class op_index_min : public traits_op_xvec { public: // dense matrices template inline static void apply(Mat& out, const mtOp& in); template inline static void apply_noalias(Mat& out, const Mat& X, const uword dim); // cubes template inline static void apply(Cube& out, const mtOpCube& in); template inline static void apply_noalias(Cube& out, const Cube& X, const uword dim, const typename arma_not_cx::result* junk = nullptr); template inline static void apply_noalias(Cube& out, const Cube& X, const uword dim, const typename arma_cx_only::result* junk = nullptr); // sparse matrices template inline static void apply(Mat& out, const SpBase& expr, const uword dim); }; //! @} RcppArmadillo/inst/include/armadillo_bits/diskio_bones.hpp0000644000176200001440000003501114473136607023564 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup diskio //! @{ //! class for saving and loading matrices and fields - INTERNAL USE ONLY! class diskio { public: arma_deprecated inline static file_type guess_file_type(std::istream& f); private: template friend class Mat; template friend class Cube; template friend class SpMat; template friend class field; friend class Mat_aux; friend class Cube_aux; friend class SpMat_aux; friend class field_aux; template arma_cold inline static std::string gen_txt_header(const Mat&); template arma_cold inline static std::string gen_bin_header(const Mat&); template arma_cold inline static std::string gen_bin_header(const SpMat&); template arma_cold inline static std::string gen_txt_header(const Cube&); template arma_cold inline static std::string gen_bin_header(const Cube&); arma_cold inline static file_type guess_file_type_internal(std::istream& f); arma_cold inline static std::string gen_tmp_name(const std::string& x); arma_cold inline static bool safe_rename(const std::string& old_name, const std::string& new_name); arma_cold inline static bool is_readable(const std::string& name); arma_cold inline static void sanitise_token(std::string& token); template inline static bool convert_token(eT& val, const std::string& token); template inline static bool convert_token(std::complex& val, const std::string& token); template inline static bool convert_token_strict(eT& val, const std::string& token); template inline static std::streamsize prepare_stream(std::ostream& f); // // matrix saving template inline static bool save_raw_ascii (const Mat& x, const std::string& final_name); template inline static bool save_raw_binary (const Mat& x, const std::string& final_name); template inline static bool save_arma_ascii (const Mat& x, const std::string& final_name); template inline static bool save_csv_ascii (const Mat& x, const std::string& final_name, const field& header, const bool with_header, const char separator); template inline static bool save_coord_ascii(const Mat& x, const std::string& final_name); template inline static bool save_arma_binary(const Mat& x, const std::string& final_name); template inline static bool save_pgm_binary (const Mat& x, const std::string& final_name); template inline static bool save_pgm_binary (const Mat< std::complex >& x, const std::string& final_name); template inline static bool save_hdf5_binary(const Mat& x, const hdf5_name& spec, std::string& err_msg); template inline static bool save_raw_ascii (const Mat& x, std::ostream& f); template inline static bool save_raw_binary (const Mat& x, std::ostream& f); template inline static bool save_arma_ascii (const Mat& x, std::ostream& f); template inline static bool save_csv_ascii (const Mat& x, std::ostream& f, const char separator); template inline static bool save_csv_ascii (const Mat< std::complex >& x, std::ostream& f, const char separator); template inline static bool save_coord_ascii(const Mat& x, std::ostream& f); template inline static bool save_coord_ascii(const Mat< std::complex >& x, std::ostream& f); template inline static bool save_arma_binary(const Mat& x, std::ostream& f); template inline static bool save_pgm_binary (const Mat& x, std::ostream& f); template inline static bool save_pgm_binary (const Mat< std::complex >& x, std::ostream& f); // // matrix loading template inline static bool load_raw_ascii (Mat& x, const std::string& name, std::string& err_msg); template inline static bool load_raw_binary (Mat& x, const std::string& name, std::string& err_msg); template inline static bool load_arma_ascii (Mat& x, const std::string& name, std::string& err_msg); template inline static bool load_csv_ascii (Mat& x, const std::string& name, std::string& err_msg, field& header, const bool with_header, const char separator, const bool strict); template inline static bool load_coord_ascii(Mat& x, const std::string& name, std::string& err_msg); template inline static bool load_arma_binary(Mat& x, const std::string& name, std::string& err_msg); template inline static bool load_pgm_binary (Mat& x, const std::string& name, std::string& err_msg); template inline static bool load_pgm_binary (Mat< std::complex >& x, const std::string& name, std::string& err_msg); template inline static bool load_hdf5_binary(Mat& x, const hdf5_name& spec, std::string& err_msg); template inline static bool load_auto_detect(Mat& x, const std::string& name, std::string& err_msg); template inline static bool load_raw_ascii (Mat& x, std::istream& f, std::string& err_msg); template inline static bool load_raw_binary (Mat& x, std::istream& f, std::string& err_msg); template inline static bool load_arma_ascii (Mat& x, std::istream& f, std::string& err_msg); template inline static bool load_csv_ascii (Mat& x, std::istream& f, std::string& err_msg, const char separator, const bool strict); template inline static bool load_csv_ascii (Mat< std::complex >& x, std::istream& f, std::string& err_msg, const char separator, const bool strict); template inline static bool load_coord_ascii(Mat& x, std::istream& f, std::string& err_msg); template inline static bool load_coord_ascii(Mat< std::complex >& x, std::istream& f, std::string& err_msg); template inline static bool load_arma_binary(Mat& x, std::istream& f, std::string& err_msg); template inline static bool load_pgm_binary (Mat& x, std::istream& is, std::string& err_msg); template inline static bool load_pgm_binary (Mat< std::complex >& x, std::istream& is, std::string& err_msg); template inline static bool load_auto_detect(Mat& x, std::istream& f, std::string& err_msg); inline static void pnm_skip_comments(std::istream& f); // // sparse matrix saving template inline static bool save_csv_ascii (const SpMat& x, const std::string& final_name, const field& header, const bool with_header, const char separator); template inline static bool save_coord_ascii(const SpMat& x, const std::string& final_name); template inline static bool save_arma_binary(const SpMat& x, const std::string& final_name); template inline static bool save_csv_ascii (const SpMat& x, std::ostream& f, const char separator); template inline static bool save_csv_ascii (const SpMat< std::complex >& x, std::ostream& f, const char separator); template inline static bool save_coord_ascii(const SpMat& x, std::ostream& f); template inline static bool save_coord_ascii(const SpMat< std::complex >& x, std::ostream& f); template inline static bool save_arma_binary(const SpMat& x, std::ostream& f); // // sparse matrix loading template inline static bool load_csv_ascii (SpMat& x, const std::string& name, std::string& err_msg, field& header, const bool with_header, const char separator); template inline static bool load_coord_ascii(SpMat& x, const std::string& name, std::string& err_msg); template inline static bool load_arma_binary(SpMat& x, const std::string& name, std::string& err_msg); template inline static bool load_csv_ascii (SpMat& x, std::istream& f, std::string& err_msg, const char separator); template inline static bool load_csv_ascii (SpMat< std::complex >& x, std::istream& f, std::string& err_msg, const char separator); template inline static bool load_coord_ascii(SpMat& x, std::istream& f, std::string& err_msg); template inline static bool load_coord_ascii(SpMat< std::complex >& x, std::istream& f, std::string& err_msg); template inline static bool load_arma_binary(SpMat& x, std::istream& f, std::string& err_msg); // // cube saving template inline static bool save_raw_ascii (const Cube& x, const std::string& name); template inline static bool save_raw_binary (const Cube& x, const std::string& name); template inline static bool save_arma_ascii (const Cube& x, const std::string& name); template inline static bool save_arma_binary(const Cube& x, const std::string& name); template inline static bool save_hdf5_binary(const Cube& x, const hdf5_name& spec, std::string& err_msg); template inline static bool save_raw_ascii (const Cube& x, std::ostream& f); template inline static bool save_raw_binary (const Cube& x, std::ostream& f); template inline static bool save_arma_ascii (const Cube& x, std::ostream& f); template inline static bool save_arma_binary(const Cube& x, std::ostream& f); // // cube loading template inline static bool load_raw_ascii (Cube& x, const std::string& name, std::string& err_msg); template inline static bool load_raw_binary (Cube& x, const std::string& name, std::string& err_msg); template inline static bool load_arma_ascii (Cube& x, const std::string& name, std::string& err_msg); template inline static bool load_arma_binary(Cube& x, const std::string& name, std::string& err_msg); template inline static bool load_hdf5_binary(Cube& x, const hdf5_name& spec, std::string& err_msg); template inline static bool load_auto_detect(Cube& x, const std::string& name, std::string& err_msg); template inline static bool load_raw_ascii (Cube& x, std::istream& f, std::string& err_msg); template inline static bool load_raw_binary (Cube& x, std::istream& f, std::string& err_msg); template inline static bool load_arma_ascii (Cube& x, std::istream& f, std::string& err_msg); template inline static bool load_arma_binary(Cube& x, std::istream& f, std::string& err_msg); template inline static bool load_auto_detect(Cube& x, std::istream& f, std::string& err_msg); // // field saving and loading template inline static bool save_arma_binary(const field& x, const std::string& name); template inline static bool save_arma_binary(const field& x, std::ostream& f); template inline static bool load_arma_binary( field& x, const std::string& name, std::string& err_msg); template inline static bool load_arma_binary( field& x, std::istream& f, std::string& err_msg); template inline static bool load_auto_detect( field& x, const std::string& name, std::string& err_msg); template inline static bool load_auto_detect( field& x, std::istream& f, std::string& err_msg); inline static bool save_std_string(const field& x, const std::string& name); inline static bool save_std_string(const field& x, std::ostream& f); inline static bool load_std_string( field& x, const std::string& name, std::string& err_msg); inline static bool load_std_string( field& x, std::istream& f, std::string& err_msg); // // handling of PPM images by cubes template inline static bool save_ppm_binary(const Cube& x, const std::string& final_name); template inline static bool save_ppm_binary(const Cube& x, std::ostream& f); template inline static bool load_ppm_binary( Cube& x, const std::string& final_name, std::string& err_msg); template inline static bool load_ppm_binary( Cube& x, std::istream& f, std::string& err_msg); // // handling of PPM images by fields template inline static bool save_ppm_binary(const field& x, const std::string& final_name); template inline static bool save_ppm_binary(const field& x, std::ostream& f); template inline static bool load_ppm_binary( field& x, const std::string& final_name, std::string& err_msg); template inline static bool load_ppm_binary( field& x, std::istream& f, std::string& err_msg); }; //! @} RcppArmadillo/inst/include/armadillo_bits/fn_sprandn.hpp0000644000176200001440000000547714631567470023263 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_sprandn //! @{ //! Generate a sparse matrix with a randomly selected subset of the elements //! set to random values from a Gaussian distribution with zero mean and unit variance template arma_warn_unused inline obj_type sprandn ( const uword n_rows, const uword n_cols, const double density, const typename arma_SpMat_SpCol_SpRow_only::result* junk = nullptr ) { arma_debug_sigprint(); arma_ignore(junk); if(is_SpCol::value) { arma_conform_check( (n_cols != 1), "sprandn(): incompatible size" ); } else if(is_SpRow::value) { arma_conform_check( (n_rows != 1), "sprandn(): incompatible size" ); } obj_type out; out.sprandn(n_rows, n_cols, density); return out; } template arma_warn_unused inline obj_type sprandn(const SizeMat& s, const double density, const typename arma_SpMat_SpCol_SpRow_only::result* junk = nullptr) { arma_debug_sigprint(); arma_ignore(junk); return sprandn(s.n_rows, s.n_cols, density); } arma_warn_unused inline sp_mat sprandn(const uword n_rows, const uword n_cols, const double density) { arma_debug_sigprint(); sp_mat out; out.sprandn(n_rows, n_cols, density); return out; } arma_warn_unused inline sp_mat sprandn(const SizeMat& s, const double density) { arma_debug_sigprint(); sp_mat out; out.sprandn(s.n_rows, s.n_cols, density); return out; } //! Generate a sparse matrix with the non-zero values in the same locations as in the given sparse matrix X, //! with the non-zero values set to random values from a Gaussian distribution with zero mean and unit variance template arma_warn_unused inline SpMat sprandn(const SpBase& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; SpMat out( X.get_ref() ); arma_rng::randn::fill( access::rwp(out.values), out.n_nonzero ); return out; } //! @} RcppArmadillo/inst/include/armadillo_bits/Base_meat.hpp0000644000176200001440000005250015030507611022761 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup Base //! @{ template arma_inline const derived& Base::get_ref() const { return static_cast(*this); } template inline void Base::print(const std::string extra_text) const { arma_debug_sigprint(); const quasi_unwrap tmp( (*this).get_ref() ); if(extra_text.length() != 0) { const std::streamsize orig_width = get_cout_stream().width(); get_cout_stream() << extra_text << '\n'; get_cout_stream().width(orig_width); } arma_ostream::print(get_cout_stream(), tmp.M, true); } template inline void Base::print(std::ostream& user_stream, const std::string extra_text) const { arma_debug_sigprint(); const quasi_unwrap tmp( (*this).get_ref() ); if(extra_text.length() != 0) { const std::streamsize orig_width = user_stream.width(); user_stream << extra_text << '\n'; user_stream.width(orig_width); } arma_ostream::print(user_stream, tmp.M, true); } template inline void Base::raw_print(const std::string extra_text) const { arma_debug_sigprint(); const quasi_unwrap tmp( (*this).get_ref() ); if(extra_text.length() != 0) { const std::streamsize orig_width = get_cout_stream().width(); get_cout_stream() << extra_text << '\n'; get_cout_stream().width(orig_width); } arma_ostream::print(get_cout_stream(), tmp.M, false); } template inline void Base::raw_print(std::ostream& user_stream, const std::string extra_text) const { arma_debug_sigprint(); const quasi_unwrap tmp( (*this).get_ref() ); if(extra_text.length() != 0) { const std::streamsize orig_width = user_stream.width(); user_stream << extra_text << '\n'; user_stream.width(orig_width); } arma_ostream::print(user_stream, tmp.M, false); } template inline void Base::brief_print(const std::string extra_text) const { arma_debug_sigprint(); const quasi_unwrap tmp( (*this).get_ref() ); if(extra_text.length() != 0) { const std::streamsize orig_width = get_cout_stream().width(); get_cout_stream() << extra_text << '\n'; get_cout_stream().width(orig_width); } arma_ostream::brief_print(get_cout_stream(), tmp.M); } template inline void Base::brief_print(std::ostream& user_stream, const std::string extra_text) const { arma_debug_sigprint(); const quasi_unwrap tmp( (*this).get_ref() ); if(extra_text.length() != 0) { const std::streamsize orig_width = user_stream.width(); user_stream << extra_text << '\n'; user_stream.width(orig_width); } arma_ostream::brief_print(user_stream, tmp.M); } template inline elem_type Base::min() const { return op_min::min( (*this).get_ref() ); } template inline elem_type Base::max() const { return op_max::max( (*this).get_ref() ); } template inline elem_type Base::min(uword& index_of_min_val) const { const Proxy P( (*this).get_ref() ); return op_min::min_with_index(P, index_of_min_val); } template inline elem_type Base::max(uword& index_of_max_val) const { const Proxy P( (*this).get_ref() ); return op_max::max_with_index(P, index_of_max_val); } template inline elem_type Base::min(uword& row_of_min_val, uword& col_of_min_val) const { const Proxy P( (*this).get_ref() ); uword index = 0; const elem_type val = op_min::min_with_index(P, index); const uword local_n_rows = P.get_n_rows(); row_of_min_val = index % local_n_rows; col_of_min_val = index / local_n_rows; return val; } template inline elem_type Base::max(uword& row_of_max_val, uword& col_of_max_val) const { const Proxy P( (*this).get_ref() ); uword index = 0; const elem_type val = op_max::max_with_index(P, index); const uword local_n_rows = P.get_n_rows(); row_of_max_val = index % local_n_rows; col_of_max_val = index / local_n_rows; return val; } template inline uword Base::index_min() const { const Proxy P( (*this).get_ref() ); uword index = 0; if(P.get_n_elem() == 0) { arma_conform_check(true, "index_min(): object has no elements"); } else { op_min::min_with_index(P, index); } return index; } template inline uword Base::index_max() const { const Proxy P( (*this).get_ref() ); uword index = 0; if(P.get_n_elem() == 0) { arma_conform_check(true, "index_max(): object has no elements"); } else { op_max::max_with_index(P, index); } return index; } template inline bool Base::is_symmetric() const { arma_debug_sigprint(); const quasi_unwrap U( (*this).get_ref() ); const Mat& A = U.M; if(A.n_rows != A.n_cols) { return false; } if(A.n_elem <= 1 ) { return true; } const uword N = A.n_rows; const uword Nm1 = N-1; const elem_type* A_col = A.memptr(); for(uword j=0; j < Nm1; ++j) { const uword jp1 = j+1; const elem_type* A_row = &(A.at(j,jp1)); for(uword i=jp1; i < N; ++i) { if(A_col[i] != (*A_row)) { return false; } A_row += N; } A_col += N; } return true; } template inline bool Base::is_symmetric(const typename get_pod_type::result tol) const { arma_debug_sigprint(); typedef typename get_pod_type::result T; if(tol == T(0)) { return (*this).is_symmetric(); } arma_conform_check( (tol < T(0)), "is_symmetric(): parameter 'tol' must be >= 0" ); const quasi_unwrap U( (*this).get_ref() ); const Mat& A = U.M; if(A.n_rows != A.n_cols) { return false; } if(A.n_elem <= 1 ) { return true; } const T norm_A = as_scalar( arma::max(sum(abs(A), 1), 0) ); if(norm_A == T(0)) { return true; } const T norm_A_Ast = as_scalar( arma::max(sum(abs(A - A.st()), 1), 0) ); return ( (norm_A_Ast / norm_A) <= tol ); } template inline bool Base::is_hermitian() const { arma_debug_sigprint(); typedef typename get_pod_type::result T; const quasi_unwrap U( (*this).get_ref() ); const Mat& A = U.M; if(A.n_rows != A.n_cols) { return false; } if(A.n_elem == 0 ) { return true; } const uword N = A.n_rows; const elem_type* A_col = A.memptr(); for(uword j=0; j < N; ++j) { if( access::tmp_imag(A_col[j]) != T(0) ) { return false; } A_col += N; } A_col = A.memptr(); const uword Nm1 = N-1; for(uword j=0; j < Nm1; ++j) { const uword jp1 = j+1; const elem_type* A_row = &(A.at(j,jp1)); for(uword i=jp1; i < N; ++i) { if(A_col[i] != access::alt_conj(*A_row)) { return false; } A_row += N; } A_col += N; } return true; } template inline bool Base::is_hermitian(const typename get_pod_type::result tol) const { arma_debug_sigprint(); typedef typename get_pod_type::result T; if(tol == T(0)) { return (*this).is_hermitian(); } arma_conform_check( (tol < T(0)), "is_hermitian(): parameter 'tol' must be >= 0" ); const quasi_unwrap U( (*this).get_ref() ); const Mat& A = U.M; if(A.n_rows != A.n_cols) { return false; } if(A.n_elem == 0 ) { return true; } const T norm_A = as_scalar( arma::max(sum(abs(A), 1), 0) ); if(norm_A == T(0)) { return true; } const T norm_A_At = as_scalar( arma::max(sum(abs(A - A.t()), 1), 0) ); return ( (norm_A_At / norm_A) <= tol ); } template inline bool Base::is_zero(const typename get_pod_type::result tol) const { arma_debug_sigprint(); typedef typename get_pod_type::result T; arma_conform_check( (tol < T(0)), "is_zero(): parameter 'tol' must be >= 0" ); if(Proxy::use_at || is_Mat::stored_type>::value) { const quasi_unwrap U( (*this).get_ref() ); return arrayops::is_zero( U.M.memptr(), U.M.n_elem, tol ); } const Proxy P( (*this).get_ref() ); const uword n_elem = P.get_n_elem(); if(n_elem == 0) { return false; } const typename Proxy::ea_type Pea = P.get_ea(); if(is_cx::yes) { for(uword i=0; i tol) { return false; } if(eop_aux::arma_abs(val_imag) > tol) { return false; } } } else // not complex { for(uword i=0; i tol) { return false; } } } return true; } template inline bool Base::is_trimatu() const { arma_debug_sigprint(); const quasi_unwrap U( (*this).get_ref() ); if(U.M.n_rows != U.M.n_cols) { return false; } if(U.M.n_elem <= 1) { return true; } return trimat_helper::is_triu(U.M); } template inline bool Base::is_trimatl() const { arma_debug_sigprint(); const quasi_unwrap U( (*this).get_ref() ); if(U.M.n_rows != U.M.n_cols) { return false; } if(U.M.n_elem <= 1) { return true; } return trimat_helper::is_tril(U.M); } template inline bool Base::is_diagmat() const { arma_debug_sigprint(); const quasi_unwrap U( (*this).get_ref() ); const Mat& A = U.M; if(A.n_elem <= 1) { return true; } // NOTE: we're NOT assuming the matrix has a square size const uword A_n_rows = A.n_rows; const uword A_n_cols = A.n_cols; const elem_type* A_mem = A.memptr(); if(A_mem[1] != elem_type(0)) { return false; } // if we got to this point, do a thorough check for(uword A_col=0; A_col < A_n_cols; ++A_col) { for(uword A_row=0; A_row < A_n_rows; ++A_row) { if( (A_mem[A_row] != elem_type(0)) && (A_row != A_col) ) { return false; } } A_mem += A_n_rows; } return true; } template inline bool Base::is_empty() const { arma_debug_sigprint(); const Proxy P( (*this).get_ref() ); return (P.get_n_elem() == uword(0)); } template inline bool Base::is_square() const { arma_debug_sigprint(); const Proxy P( (*this).get_ref() ); return (P.get_n_rows() == P.get_n_cols()); } template inline bool Base::is_vec() const { arma_debug_sigprint(); if( (Proxy::is_row) || (Proxy::is_col) || (Proxy::is_xvec) ) { return true; } const Proxy P( (*this).get_ref() ); return ( (P.get_n_rows() == uword(1)) || (P.get_n_cols() == uword(1)) ); } template inline bool Base::is_colvec() const { arma_debug_sigprint(); if(Proxy::is_col) { return true; } const Proxy P( (*this).get_ref() ); return (P.get_n_cols() == uword(1)); } template inline bool Base::is_rowvec() const { arma_debug_sigprint(); if(Proxy::is_row) { return true; } const Proxy P( (*this).get_ref() ); return (P.get_n_rows() == uword(1)); } template inline bool Base::is_finite() const { arma_debug_sigprint(); if(arma_config::fast_math_warn) { arma_warn(1, "is_finite(): detection of non-finite values is not reliable in fast math mode"); } if(is_Mat::stored_type>::value) { const quasi_unwrap U( (*this).get_ref() ); return arrayops::is_finite( U.M.memptr(), U.M.n_elem ); } else { const Proxy P( (*this).get_ref() ); if(Proxy::use_at == false) { const typename Proxy::ea_type Pea = P.get_ea(); const uword n_elem = P.get_n_elem(); for(uword i=0; i inline bool Base::has_inf() const { arma_debug_sigprint(); if(arma_config::fast_math_warn) { arma_warn(1, "has_inf(): detection of non-finite values is not reliable in fast math mode"); } if(is_Mat::stored_type>::value) { const quasi_unwrap U( (*this).get_ref() ); return arrayops::has_inf( U.M.memptr(), U.M.n_elem ); } else { const Proxy P( (*this).get_ref() ); if(Proxy::use_at == false) { const typename Proxy::ea_type Pea = P.get_ea(); const uword n_elem = P.get_n_elem(); for(uword i=0; i inline bool Base::has_nan() const { arma_debug_sigprint(); if(arma_config::fast_math_warn) { arma_warn(1, "has_nan(): detection of non-finite values is not reliable in fast math mode"); } if(is_Mat::stored_type>::value) { const quasi_unwrap U( (*this).get_ref() ); return arrayops::has_nan( U.M.memptr(), U.M.n_elem ); } else { const Proxy P( (*this).get_ref() ); if(Proxy::use_at == false) { const typename Proxy::ea_type Pea = P.get_ea(); const uword n_elem = P.get_n_elem(); for(uword i=0; i inline bool Base::has_nonfinite() const { arma_debug_sigprint(); if(arma_config::fast_math_warn) { arma_warn(1, "has_nonfinite(): detection of non-finite values is not reliable in fast math mode"); } if(is_Mat::stored_type>::value) { const quasi_unwrap U( (*this).get_ref() ); return (arrayops::is_finite( U.M.memptr(), U.M.n_elem ) == false); } else { const Proxy P( (*this).get_ref() ); if(Proxy::use_at == false) { const typename Proxy::ea_type Pea = P.get_ea(); const uword n_elem = P.get_n_elem(); for(uword i=0; i inline const Op Base::as_col() const { return Op( (*this).get_ref() ); } template inline const Op Base::as_row() const { return Op( (*this).get_ref() ); } // // extra functions defined in Base_extra_yes template inline const Op Base_extra_yes::i() const { return Op(static_cast(*this)); } template inline bool Base_extra_yes::is_sympd() const { arma_debug_sigprint(); typedef typename get_pod_type::result T; Mat X = static_cast(*this); // default value for tol const T tol = T(100) * std::numeric_limits::epsilon() * norm(X, "fro"); if(X.is_hermitian(tol) == false) { return false; } if(X.is_empty()) { return false; } X.diag() -= elem_type(tol); return auxlib::chol_simple(X); } template inline bool Base_extra_yes::is_sympd(typename get_pod_type::result tol) const { arma_debug_sigprint(); typedef typename get_pod_type::result T; arma_conform_check( (tol < T(0)), "is_sympd(): parameter 'tol' must be >= 0" ); Mat X = static_cast(*this); if(X.is_hermitian(tol) == false) { return false; } if(X.is_empty()) { return false; } X.diag() -= elem_type(tol); return auxlib::chol_simple(X); } // // extra functions defined in Base_eval_Mat template arma_inline const derived& Base_eval_Mat::eval() const { arma_debug_sigprint(); return static_cast(*this); } // // extra functions defined in Base_eval_expr template inline Mat Base_eval_expr::eval() const { arma_debug_sigprint(); return Mat( static_cast(*this) ); } // // extra functions defined in Base_trans_cx template arma_inline const Op Base_trans_cx::t() const { return Op( static_cast(*this) ); } template arma_inline const Op Base_trans_cx::ht() const { return Op( static_cast(*this) ); } template arma_inline const Op Base_trans_cx::st() const { return Op( static_cast(*this) ); } // // extra functions defined in Base_trans_default template arma_inline const Op Base_trans_default::t() const { return Op( static_cast(*this) ); } template arma_inline const Op Base_trans_default::ht() const { return Op( static_cast(*this) ); } template arma_inline const Op Base_trans_default::st() const { return Op( static_cast(*this) ); } //! @} RcppArmadillo/inst/include/armadillo_bits/Gen_meat.hpp0000644000176200001440000001344214770765377022653 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup Gen //! @{ template arma_inline Gen::Gen(const uword in_n_rows, const uword in_n_cols) : n_rows(in_n_rows) , n_cols(in_n_cols) { arma_debug_sigprint(); } template arma_inline Gen::~Gen() { arma_debug_sigprint(); } template arma_inline typename T1::elem_type Gen::operator[](const uword ii) const { typedef typename T1::elem_type eT; if(is_same_type::yes) { return eT(0); } else if(is_same_type::yes) { return eT(1); } else if(is_same_type::yes) { return ((ii % n_rows) == (ii / n_rows)) ? eT(1) : eT(0); } return eT(0); // prevent pedantic compiler warnings } template arma_inline typename T1::elem_type Gen::at(const uword r, const uword c) const { typedef typename T1::elem_type eT; if(is_same_type::yes) { return eT(0); } else if(is_same_type::yes) { return eT(1); } else if(is_same_type::yes) { return (r == c) ? eT(1) : eT(0); } return eT(0); // prevent pedantic compiler warnings } template arma_inline typename T1::elem_type Gen::at_alt(const uword ii) const { return operator[](ii); } template inline void Gen::apply(Mat& out) const { arma_debug_sigprint(); // NOTE: we're assuming that the matrix has already been set to the correct size; // this is done by either the Mat constructor or operator=() if(is_same_type::yes) { out.zeros(); } else if(is_same_type::yes) { out.ones(); } else if(is_same_type::yes) { out.eye(); } } template inline void Gen::apply_inplace_plus(Mat& out) const { arma_debug_sigprint(); arma_conform_assert_same_size(out.n_rows, out.n_cols, n_rows, n_cols, "addition"); typedef typename T1::elem_type eT; if(is_same_type::yes) { arrayops::inplace_plus(out.memptr(), eT(1), out.n_elem); } else if(is_same_type::yes) { const uword N = (std::min)(n_rows, n_cols); for(uword ii=0; ii < N; ++ii) { out.at(ii,ii) += eT(1); } } } template inline void Gen::apply_inplace_minus(Mat& out) const { arma_debug_sigprint(); arma_conform_assert_same_size(out.n_rows, out.n_cols, n_rows, n_cols, "subtraction"); typedef typename T1::elem_type eT; if(is_same_type::yes) { arrayops::inplace_minus(out.memptr(), eT(1), out.n_elem); } else if(is_same_type::yes) { const uword N = (std::min)(n_rows, n_cols); for(uword ii=0; ii < N; ++ii) { out.at(ii,ii) -= eT(1); } } } template inline void Gen::apply_inplace_schur(Mat& out) const { arma_debug_sigprint(); arma_conform_assert_same_size(out.n_rows, out.n_cols, n_rows, n_cols, "element-wise multiplication"); typedef typename T1::elem_type eT; if(is_same_type::yes) { arrayops::inplace_mul(out.memptr(), eT(0), out.n_elem); // NOTE: not using arrayops::fill_zeros(), as 'out' may have NaN elements } else if(is_same_type::yes) { for(uword c=0; c < n_cols; ++c) for(uword r=0; r < n_rows; ++r) { if(r != c) { out.at(r,c) *= eT(0); } } } } template inline void Gen::apply_inplace_div(Mat& out) const { arma_debug_sigprint(); arma_conform_assert_same_size(out.n_rows, out.n_cols, n_rows, n_cols, "element-wise division"); typedef typename T1::elem_type eT; if(is_same_type::yes) { arrayops::inplace_div(out.memptr(), eT(0), out.n_elem); } else if(is_same_type::yes) { for(uword c=0; c < n_cols; ++c) for(uword r=0; r < n_rows; ++r) { if(r != c) { out.at(r,c) /= eT(0); } } } } template inline void Gen::apply(subview& out) const { arma_debug_sigprint(); // NOTE: we're assuming that the submatrix has the same dimensions as the Gen object // this is checked by subview::operator=() if(is_same_type::yes) { out.zeros(); } else if(is_same_type::yes) { out.ones(); } else if(is_same_type::yes) { out.eye(); } } //! @} RcppArmadillo/inst/include/armadillo_bits/subview_cube_meat.hpp0000644000176200001440000020446414770765377024632 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup subview_cube //! @{ template inline subview_cube::~subview_cube() { arma_debug_sigprint_this(this); } template arma_inline subview_cube::subview_cube ( const Cube& in_m, const uword in_row1, const uword in_col1, const uword in_slice1, const uword in_n_rows, const uword in_n_cols, const uword in_n_slices ) : m (in_m) , aux_row1 (in_row1) , aux_col1 (in_col1) , aux_slice1 (in_slice1) , n_rows (in_n_rows) , n_cols (in_n_cols) , n_elem_slice(in_n_rows * in_n_cols) , n_slices (in_n_slices) , n_elem (n_elem_slice * in_n_slices) { arma_debug_sigprint_this(this); } template inline subview_cube::subview_cube(const subview_cube& in) : m (in.m ) , aux_row1 (in.aux_row1 ) , aux_col1 (in.aux_col1 ) , aux_slice1 (in.aux_slice1 ) , n_rows (in.n_rows ) , n_cols (in.n_cols ) , n_elem_slice(in.n_elem_slice) , n_slices (in.n_slices ) , n_elem (in.n_elem ) { arma_debug_sigprint(arma_str::format("this: %x; in: %x") % this % &in); } template inline subview_cube::subview_cube(subview_cube&& in) : m (in.m ) , aux_row1 (in.aux_row1 ) , aux_col1 (in.aux_col1 ) , aux_slice1 (in.aux_slice1 ) , n_rows (in.n_rows ) , n_cols (in.n_cols ) , n_elem_slice(in.n_elem_slice) , n_slices (in.n_slices ) , n_elem (in.n_elem ) { arma_debug_sigprint(arma_str::format("this: %x; in: %x") % this % &in); // for paranoia access::rw(in.aux_row1 ) = 0; access::rw(in.aux_col1 ) = 0; access::rw(in.aux_slice1 ) = 0; access::rw(in.n_rows ) = 0; access::rw(in.n_cols ) = 0; access::rw(in.n_elem_slice) = 0; access::rw(in.n_slices ) = 0; access::rw(in.n_elem ) = 0; } template template inline void subview_cube::inplace_op(const eT val) { arma_debug_sigprint(); subview_cube& t = *this; const uword t_n_rows = t.n_rows; const uword t_n_cols = t.n_cols; const uword t_n_slices = t.n_slices; for(uword s=0; s < t_n_slices; ++s) for(uword c=0; c < t_n_cols; ++c) { if(is_same_type::yes) { arrayops::inplace_plus ( slice_colptr(s,c), val, t_n_rows ); } if(is_same_type::yes) { arrayops::inplace_minus( slice_colptr(s,c), val, t_n_rows ); } if(is_same_type::yes) { arrayops::inplace_mul ( slice_colptr(s,c), val, t_n_rows ); } if(is_same_type::yes) { arrayops::inplace_div ( slice_colptr(s,c), val, t_n_rows ); } } } template template inline void subview_cube::inplace_op(const BaseCube& in, const char* identifier) { arma_debug_sigprint(); const ProxyCube P(in.get_ref()); subview_cube& t = *this; const uword t_n_rows = t.n_rows; const uword t_n_cols = t.n_cols; const uword t_n_slices = t.n_slices; arma_conform_assert_same_size(t, P, identifier); const bool use_mp = arma_config::openmp && ProxyCube::use_mp && mp_gate::eval(t.n_elem); const bool has_overlap = P.has_overlap(t); if(has_overlap) { arma_debug_print("aliasing or overlap detected"); } if( (is_Cube::stored_type>::value) || (use_mp) || (has_overlap) ) { const unwrap_cube_check::stored_type> tmp(P.Q, has_overlap); const Cube& B = tmp.M; if( (is_same_type::yes) && (t.aux_row1 == 0) && (t_n_rows == t.m.n_rows) ) { for(uword s=0; s < t_n_slices; ++s) { arrayops::copy( t.slice_colptr(s,0), B.slice_colptr(s,0), t.n_elem_slice ); } } else { for(uword s=0; s < t_n_slices; ++s) for(uword c=0; c < t_n_cols; ++c) { if(is_same_type::yes) { arrayops::copy ( t.slice_colptr(s,c), B.slice_colptr(s,c), t_n_rows ); } if(is_same_type::yes) { arrayops::inplace_plus ( t.slice_colptr(s,c), B.slice_colptr(s,c), t_n_rows ); } if(is_same_type::yes) { arrayops::inplace_minus( t.slice_colptr(s,c), B.slice_colptr(s,c), t_n_rows ); } if(is_same_type::yes) { arrayops::inplace_mul ( t.slice_colptr(s,c), B.slice_colptr(s,c), t_n_rows ); } if(is_same_type::yes) { arrayops::inplace_div ( t.slice_colptr(s,c), B.slice_colptr(s,c), t_n_rows ); } } } } else // use the Proxy { if(ProxyCube::use_at) { for(uword s=0; s < t_n_slices; ++s) for(uword c=0; c < t_n_cols; ++c) { eT* t_col_data = t.slice_colptr(s,c); for(uword r=0; r < t_n_rows; ++r) { const eT tmp = P.at(r,c,s); if(is_same_type::yes) { (*t_col_data) = tmp; t_col_data++; } if(is_same_type::yes) { (*t_col_data) += tmp; t_col_data++; } if(is_same_type::yes) { (*t_col_data) -= tmp; t_col_data++; } if(is_same_type::yes) { (*t_col_data) *= tmp; t_col_data++; } if(is_same_type::yes) { (*t_col_data) /= tmp; t_col_data++; } } } } else { typename ProxyCube::ea_type Pea = P.get_ea(); uword count = 0; for(uword s=0; s < t_n_slices; ++s) for(uword c=0; c < t_n_cols; ++c) { eT* t_col_data = t.slice_colptr(s,c); for(uword r=0; r < t_n_rows; ++r) { const eT tmp = Pea[count]; count++; if(is_same_type::yes) { (*t_col_data) = tmp; t_col_data++; } if(is_same_type::yes) { (*t_col_data) += tmp; t_col_data++; } if(is_same_type::yes) { (*t_col_data) -= tmp; t_col_data++; } if(is_same_type::yes) { (*t_col_data) *= tmp; t_col_data++; } if(is_same_type::yes) { (*t_col_data) /= tmp; t_col_data++; } } } } } } template template inline void subview_cube::inplace_op(const subview_cube& x, const char* identifier) { arma_debug_sigprint(); if(check_overlap(x)) { const Cube tmp(x); if(is_same_type::yes) { (*this).operator= (tmp); } if(is_same_type::yes) { (*this).operator+=(tmp); } if(is_same_type::yes) { (*this).operator-=(tmp); } if(is_same_type::yes) { (*this).operator%=(tmp); } if(is_same_type::yes) { (*this).operator/=(tmp); } return; } subview_cube& t = *this; arma_conform_assert_same_size(t, x, identifier); const uword t_n_rows = t.n_rows; const uword t_n_cols = t.n_cols; const uword t_n_slices = t.n_slices; for(uword s=0; s < t_n_slices; ++s) for(uword c=0; c < t_n_cols; ++c) { if(is_same_type::yes) { arrayops::copy ( t.slice_colptr(s,c), x.slice_colptr(s,c), t_n_rows ); } if(is_same_type::yes) { arrayops::inplace_plus ( t.slice_colptr(s,c), x.slice_colptr(s,c), t_n_rows ); } if(is_same_type::yes) { arrayops::inplace_minus( t.slice_colptr(s,c), x.slice_colptr(s,c), t_n_rows ); } if(is_same_type::yes) { arrayops::inplace_mul ( t.slice_colptr(s,c), x.slice_colptr(s,c), t_n_rows ); } if(is_same_type::yes) { arrayops::inplace_div ( t.slice_colptr(s,c), x.slice_colptr(s,c), t_n_rows ); } } } template inline void subview_cube::operator= (const eT val) { arma_debug_sigprint(); if(n_elem != 1) { arma_conform_assert_same_size(n_rows, n_cols, n_slices, 1, 1, 1, "copy into subcube"); } Cube& Q = const_cast< Cube& >(m); Q.at(aux_row1, aux_col1, aux_slice1) = val; } template inline void subview_cube::operator+= (const eT val) { arma_debug_sigprint(); inplace_op(val); } template inline void subview_cube::operator-= (const eT val) { arma_debug_sigprint(); inplace_op(val); } template inline void subview_cube::operator*= (const eT val) { arma_debug_sigprint(); inplace_op(val); } template inline void subview_cube::operator/= (const eT val) { arma_debug_sigprint(); inplace_op(val); } template template inline void subview_cube::operator= (const BaseCube& in) { arma_debug_sigprint(); inplace_op(in, "copy into subcube"); } template template inline void subview_cube::operator+= (const BaseCube& in) { arma_debug_sigprint(); inplace_op(in, "addition"); } template template inline void subview_cube::operator-= (const BaseCube& in) { arma_debug_sigprint(); inplace_op(in, "subtraction"); } template template inline void subview_cube::operator%= (const BaseCube& in) { arma_debug_sigprint(); inplace_op(in, "element-wise multiplication"); } template template inline void subview_cube::operator/= (const BaseCube& in) { arma_debug_sigprint(); inplace_op(in, "element-wise division"); } //! x.subcube(...) = y.subcube(...) template inline void subview_cube::operator= (const subview_cube& x) { arma_debug_sigprint(); inplace_op(x, "copy into subcube"); } template inline void subview_cube::operator+= (const subview_cube& x) { arma_debug_sigprint(); inplace_op(x, "addition"); } template inline void subview_cube::operator-= (const subview_cube& x) { arma_debug_sigprint(); inplace_op(x, "subtraction"); } template inline void subview_cube::operator%= (const subview_cube& x) { arma_debug_sigprint(); inplace_op(x, "element-wise multiplication"); } template inline void subview_cube::operator/= (const subview_cube& x) { arma_debug_sigprint(); inplace_op(x, "element-wise division"); } template template inline void subview_cube::operator= (const Base& in) { arma_debug_sigprint(); const quasi_unwrap tmp(in.get_ref()); const Mat& x = tmp.M; subview_cube& t = *this; const uword t_n_rows = t.n_rows; const uword t_n_cols = t.n_cols; const uword t_n_slices = t.n_slices; const uword x_n_rows = x.n_rows; const uword x_n_cols = x.n_cols; if( ((x_n_rows == 1) || (x_n_cols == 1)) && (t_n_rows == 1) && (t_n_cols == 1) && (x.n_elem == t_n_slices) ) { Cube& Q = const_cast< Cube& >(t.m); const uword t_aux_row1 = t.aux_row1; const uword t_aux_col1 = t.aux_col1; const uword t_aux_slice1 = t.aux_slice1; const eT* x_mem = x.memptr(); uword i,j; for(i=0, j=1; j < t_n_slices; i+=2, j+=2) { const eT tmp_i = x_mem[i]; const eT tmp_j = x_mem[j]; Q.at(t_aux_row1, t_aux_col1, t_aux_slice1 + i) = tmp_i; Q.at(t_aux_row1, t_aux_col1, t_aux_slice1 + j) = tmp_j; } if(i < t_n_slices) { Q.at(t_aux_row1, t_aux_col1, t_aux_slice1 + i) = x_mem[i]; } } else if( (t_n_rows == x_n_rows) && (t_n_cols == x_n_cols) && (t_n_slices == 1) ) { // interpret the matrix as a cube with one slice for(uword col = 0; col < t_n_cols; ++col) { arrayops::copy( t.slice_colptr(0, col), x.colptr(col), t_n_rows ); } } else if( (t_n_rows == x_n_rows) && (t_n_cols == 1) && (t_n_slices == x_n_cols) ) { for(uword i=0; i < t_n_slices; ++i) { arrayops::copy( t.slice_colptr(i, 0), x.colptr(i), t_n_rows ); } } else if( (t_n_rows == 1) && (t_n_cols == x_n_rows) && (t_n_slices == x_n_cols) ) { Cube& Q = const_cast< Cube& >(t.m); const uword t_aux_row1 = t.aux_row1; const uword t_aux_col1 = t.aux_col1; const uword t_aux_slice1 = t.aux_slice1; for(uword slice=0; slice < t_n_slices; ++slice) { const uword mod_slice = t_aux_slice1 + slice; const eT* x_colptr = x.colptr(slice); uword i,j; for(i=0, j=1; j < t_n_cols; i+=2, j+=2) { const eT tmp_i = x_colptr[i]; const eT tmp_j = x_colptr[j]; Q.at(t_aux_row1, t_aux_col1 + i, mod_slice) = tmp_i; Q.at(t_aux_row1, t_aux_col1 + j, mod_slice) = tmp_j; } if(i < t_n_cols) { Q.at(t_aux_row1, t_aux_col1 + i, mod_slice) = x_colptr[i]; } } } else { if(arma_config::check_conform) { arma_stop_logic_error( arma_incompat_size_string(t, x, "copy into subcube") ); } } } template template inline void subview_cube::operator+= (const Base& in) { arma_debug_sigprint(); const quasi_unwrap tmp(in.get_ref()); const Mat& x = tmp.M; subview_cube& t = *this; const uword t_n_rows = t.n_rows; const uword t_n_cols = t.n_cols; const uword t_n_slices = t.n_slices; const uword x_n_rows = x.n_rows; const uword x_n_cols = x.n_cols; if( ((x_n_rows == 1) || (x_n_cols == 1)) && (t_n_rows == 1) && (t_n_cols == 1) && (x.n_elem == t_n_slices) ) { Cube& Q = const_cast< Cube& >(t.m); const uword t_aux_row1 = t.aux_row1; const uword t_aux_col1 = t.aux_col1; const uword t_aux_slice1 = t.aux_slice1; const eT* x_mem = x.memptr(); uword i,j; for(i=0, j=1; j < t_n_slices; i+=2, j+=2) { const eT tmp_i = x_mem[i]; const eT tmp_j = x_mem[j]; Q.at(t_aux_row1, t_aux_col1, t_aux_slice1 + i) += tmp_i; Q.at(t_aux_row1, t_aux_col1, t_aux_slice1 + j) += tmp_j; } if(i < t_n_slices) { Q.at(t_aux_row1, t_aux_col1, t_aux_slice1 + i) += x_mem[i]; } } else if( (t_n_rows == x_n_rows) && (t_n_cols == x_n_cols) && (t_n_slices == 1) ) { for(uword col = 0; col < t_n_cols; ++col) { arrayops::inplace_plus( t.slice_colptr(0, col), x.colptr(col), t_n_rows ); } } else if( (t_n_rows == x_n_rows) && (t_n_cols == 1) && (t_n_slices == x_n_cols) ) { for(uword i=0; i < t_n_slices; ++i) { arrayops::inplace_plus( t.slice_colptr(i, 0), x.colptr(i), t_n_rows ); } } else if( (t_n_rows == 1) && (t_n_cols == x_n_rows) && (t_n_slices == x_n_cols) ) { Cube& Q = const_cast< Cube& >(t.m); const uword t_aux_row1 = t.aux_row1; const uword t_aux_col1 = t.aux_col1; const uword t_aux_slice1 = t.aux_slice1; for(uword slice=0; slice < t_n_slices; ++slice) { const uword mod_slice = t_aux_slice1 + slice; const eT* x_colptr = x.colptr(slice); uword i,j; for(i=0, j=1; j < t_n_cols; i+=2, j+=2) { const eT tmp_i = x_colptr[i]; const eT tmp_j = x_colptr[j]; Q.at(t_aux_row1, t_aux_col1 + i, mod_slice) += tmp_i; Q.at(t_aux_row1, t_aux_col1 + j, mod_slice) += tmp_j; } if(i < t_n_cols) { Q.at(t_aux_row1, t_aux_col1 + i, mod_slice) += x_colptr[i]; } } } else { if(arma_config::check_conform) { arma_stop_logic_error( arma_incompat_size_string(t, x, "addition") ); } } } template template inline void subview_cube::operator-= (const Base& in) { arma_debug_sigprint(); const quasi_unwrap tmp(in.get_ref()); const Mat& x = tmp.M; subview_cube& t = *this; const uword t_n_rows = t.n_rows; const uword t_n_cols = t.n_cols; const uword t_n_slices = t.n_slices; const uword x_n_rows = x.n_rows; const uword x_n_cols = x.n_cols; if( ((x_n_rows == 1) || (x_n_cols == 1)) && (t_n_rows == 1) && (t_n_cols == 1) && (x.n_elem == t_n_slices) ) { Cube& Q = const_cast< Cube& >(t.m); const uword t_aux_row1 = t.aux_row1; const uword t_aux_col1 = t.aux_col1; const uword t_aux_slice1 = t.aux_slice1; const eT* x_mem = x.memptr(); uword i,j; for(i=0, j=1; j < t_n_slices; i+=2, j+=2) { const eT tmp_i = x_mem[i]; const eT tmp_j = x_mem[j]; Q.at(t_aux_row1, t_aux_col1, t_aux_slice1 + i) -= tmp_i; Q.at(t_aux_row1, t_aux_col1, t_aux_slice1 + j) -= tmp_j; } if(i < t_n_slices) { Q.at(t_aux_row1, t_aux_col1, t_aux_slice1 + i) -= x_mem[i]; } } else if( (t_n_rows == x_n_rows) && (t_n_cols == x_n_cols) && (t_n_slices == 1) ) { for(uword col = 0; col < t_n_cols; ++col) { arrayops::inplace_minus( t.slice_colptr(0, col), x.colptr(col), t_n_rows ); } } else if( (t_n_rows == x_n_rows) && (t_n_cols == 1) && (t_n_slices == x_n_cols) ) { for(uword i=0; i < t_n_slices; ++i) { arrayops::inplace_minus( t.slice_colptr(i, 0), x.colptr(i), t_n_rows ); } } else if( (t_n_rows == 1) && (t_n_cols == x_n_rows) && (t_n_slices == x_n_cols) ) { Cube& Q = const_cast< Cube& >(t.m); const uword t_aux_row1 = t.aux_row1; const uword t_aux_col1 = t.aux_col1; const uword t_aux_slice1 = t.aux_slice1; for(uword slice=0; slice < t_n_slices; ++slice) { const uword mod_slice = t_aux_slice1 + slice; const eT* x_colptr = x.colptr(slice); uword i,j; for(i=0, j=1; j < t_n_cols; i+=2, j+=2) { const eT tmp_i = x_colptr[i]; const eT tmp_j = x_colptr[j]; Q.at(t_aux_row1, t_aux_col1 + i, mod_slice) -= tmp_i; Q.at(t_aux_row1, t_aux_col1 + j, mod_slice) -= tmp_j; } if(i < t_n_cols) { Q.at(t_aux_row1, t_aux_col1 + i, mod_slice) -= x_colptr[i]; } } } else { if(arma_config::check_conform) { arma_stop_logic_error( arma_incompat_size_string(t, x, "subtraction") ); } } } template template inline void subview_cube::operator%= (const Base& in) { arma_debug_sigprint(); const quasi_unwrap tmp(in.get_ref()); const Mat& x = tmp.M; subview_cube& t = *this; const uword t_n_rows = t.n_rows; const uword t_n_cols = t.n_cols; const uword t_n_slices = t.n_slices; const uword x_n_rows = x.n_rows; const uword x_n_cols = x.n_cols; if( ((x_n_rows == 1) || (x_n_cols == 1)) && (t_n_rows == 1) && (t_n_cols == 1) && (x.n_elem == t_n_slices) ) { Cube& Q = const_cast< Cube& >(t.m); const uword t_aux_row1 = t.aux_row1; const uword t_aux_col1 = t.aux_col1; const uword t_aux_slice1 = t.aux_slice1; const eT* x_mem = x.memptr(); uword i,j; for(i=0, j=1; j < t_n_slices; i+=2, j+=2) { const eT tmp_i = x_mem[i]; const eT tmp_j = x_mem[j]; Q.at(t_aux_row1, t_aux_col1, t_aux_slice1 + i) *= tmp_i; Q.at(t_aux_row1, t_aux_col1, t_aux_slice1 + j) *= tmp_j; } if(i < t_n_slices) { Q.at(t_aux_row1, t_aux_col1, t_aux_slice1 + i) *= x_mem[i]; } } else if( (t_n_rows == x_n_rows) && (t_n_cols == x_n_cols) && (t_n_slices == 1) ) { for(uword col = 0; col < t_n_cols; ++col) { arrayops::inplace_mul( t.slice_colptr(0, col), x.colptr(col), t_n_rows ); } } else if( (t_n_rows == x_n_rows) && (t_n_cols == 1) && (t_n_slices == x_n_cols) ) { for(uword i=0; i < t_n_slices; ++i) { arrayops::inplace_mul( t.slice_colptr(i, 0), x.colptr(i), t_n_rows ); } } else if( (t_n_rows == 1) && (t_n_cols == x_n_rows) && (t_n_slices == x_n_cols) ) { Cube& Q = const_cast< Cube& >(t.m); const uword t_aux_row1 = t.aux_row1; const uword t_aux_col1 = t.aux_col1; const uword t_aux_slice1 = t.aux_slice1; for(uword slice=0; slice < t_n_slices; ++slice) { const uword mod_slice = t_aux_slice1 + slice; const eT* x_colptr = x.colptr(slice); uword i,j; for(i=0, j=1; j < t_n_cols; i+=2, j+=2) { const eT tmp_i = x_colptr[i]; const eT tmp_j = x_colptr[j]; Q.at(t_aux_row1, t_aux_col1 + i, mod_slice) *= tmp_i; Q.at(t_aux_row1, t_aux_col1 + j, mod_slice) *= tmp_j; } if(i < t_n_cols) { Q.at(t_aux_row1, t_aux_col1 + i, mod_slice) *= x_colptr[i]; } } } else { if(arma_config::check_conform) { arma_stop_logic_error( arma_incompat_size_string(t, x, "element-wise multiplication") ); } } } template template inline void subview_cube::operator/= (const Base& in) { arma_debug_sigprint(); const quasi_unwrap tmp(in.get_ref()); const Mat& x = tmp.M; subview_cube& t = *this; const uword t_n_rows = t.n_rows; const uword t_n_cols = t.n_cols; const uword t_n_slices = t.n_slices; const uword x_n_rows = x.n_rows; const uword x_n_cols = x.n_cols; if( ((x_n_rows == 1) || (x_n_cols == 1)) && (t_n_rows == 1) && (t_n_cols == 1) && (x.n_elem == t_n_slices) ) { Cube& Q = const_cast< Cube& >(t.m); const uword t_aux_row1 = t.aux_row1; const uword t_aux_col1 = t.aux_col1; const uword t_aux_slice1 = t.aux_slice1; const eT* x_mem = x.memptr(); uword i,j; for(i=0, j=1; j < t_n_slices; i+=2, j+=2) { const eT tmp_i = x_mem[i]; const eT tmp_j = x_mem[j]; Q.at(t_aux_row1, t_aux_col1, t_aux_slice1 + i) /= tmp_i; Q.at(t_aux_row1, t_aux_col1, t_aux_slice1 + j) /= tmp_j; } if(i < t_n_slices) { Q.at(t_aux_row1, t_aux_col1, t_aux_slice1 + i) /= x_mem[i]; } } else if( (t_n_rows == x_n_rows) && (t_n_cols == x_n_cols) && (t_n_slices == 1) ) { for(uword col = 0; col < t_n_cols; ++col) { arrayops::inplace_div( t.slice_colptr(0, col), x.colptr(col), t_n_rows ); } } else if( (t_n_rows == x_n_rows) && (t_n_cols == 1) && (t_n_slices == x_n_cols) ) { for(uword i=0; i < t_n_slices; ++i) { arrayops::inplace_div( t.slice_colptr(i, 0), x.colptr(i), t_n_rows ); } } else if( (t_n_rows == 1) && (t_n_cols == x_n_rows) && (t_n_slices == x_n_cols) ) { Cube& Q = const_cast< Cube& >(t.m); const uword t_aux_row1 = t.aux_row1; const uword t_aux_col1 = t.aux_col1; const uword t_aux_slice1 = t.aux_slice1; for(uword slice=0; slice < t_n_slices; ++slice) { const uword mod_slice = t_aux_slice1 + slice; const eT* x_colptr = x.colptr(slice); uword i,j; for(i=0, j=1; j < t_n_cols; i+=2, j+=2) { const eT tmp_i = x_colptr[i]; const eT tmp_j = x_colptr[j]; Q.at(t_aux_row1, t_aux_col1 + i, mod_slice) /= tmp_i; Q.at(t_aux_row1, t_aux_col1 + j, mod_slice) /= tmp_j; } if(i < t_n_cols) { Q.at(t_aux_row1, t_aux_col1 + i, mod_slice) /= x_colptr[i]; } } } else { if(arma_config::check_conform) { arma_stop_logic_error( arma_incompat_size_string(t, x, "element-wise division") ); } } } template template inline void subview_cube::operator= (const GenCube& in) { arma_debug_sigprint(); arma_conform_assert_same_size(n_rows, n_cols, n_slices, in.n_rows, in.n_cols, in.n_slices, "copy into subcube"); in.apply(*this); } //! apply a functor to each element template template inline void subview_cube::for_each(functor F) { arma_debug_sigprint(); Cube& Q = const_cast< Cube& >(m); const uword start_col = aux_col1; const uword start_row = aux_row1; const uword start_slice = aux_slice1; const uword end_col_plus1 = start_col + n_cols; const uword end_row_plus1 = start_row + n_rows; const uword end_slice_plus1 = start_slice + n_slices; for(uword uslice = start_slice; uslice < end_slice_plus1; ++uslice) for(uword ucol = start_col; ucol < end_col_plus1; ++ucol ) for(uword urow = start_row; urow < end_row_plus1; ++urow ) { F( Q.at(urow, ucol, uslice) ); } } template template inline void subview_cube::for_each(functor F) const { arma_debug_sigprint(); const Cube& Q = m; const uword start_col = aux_col1; const uword start_row = aux_row1; const uword start_slice = aux_slice1; const uword end_col_plus1 = start_col + n_cols; const uword end_row_plus1 = start_row + n_rows; const uword end_slice_plus1 = start_slice + n_slices; for(uword uslice = start_slice; uslice < end_slice_plus1; ++uslice) for(uword ucol = start_col; ucol < end_col_plus1; ++ucol ) for(uword urow = start_row; urow < end_row_plus1; ++urow ) { F( Q.at(urow, ucol, uslice) ); } } //! transform each element in the subview using a functor template template inline void subview_cube::transform(functor F) { arma_debug_sigprint(); Cube& Q = const_cast< Cube& >(m); const uword start_col = aux_col1; const uword start_row = aux_row1; const uword start_slice = aux_slice1; const uword end_col_plus1 = start_col + n_cols; const uword end_row_plus1 = start_row + n_rows; const uword end_slice_plus1 = start_slice + n_slices; for(uword uslice = start_slice; uslice < end_slice_plus1; ++uslice) for(uword ucol = start_col; ucol < end_col_plus1; ++ucol ) for(uword urow = start_row; urow < end_row_plus1; ++urow ) { Q.at(urow, ucol, uslice) = eT( F( Q.at(urow, ucol, uslice) ) ); } } //! imbue (fill) the subview with values provided by a functor template template inline void subview_cube::imbue(functor F) { arma_debug_sigprint(); Cube& Q = const_cast< Cube& >(m); const uword start_col = aux_col1; const uword start_row = aux_row1; const uword start_slice = aux_slice1; const uword end_col_plus1 = start_col + n_cols; const uword end_row_plus1 = start_row + n_rows; const uword end_slice_plus1 = start_slice + n_slices; for(uword uslice = start_slice; uslice < end_slice_plus1; ++uslice) for(uword ucol = start_col; ucol < end_col_plus1; ++ucol ) for(uword urow = start_row; urow < end_row_plus1; ++urow ) { Q.at(urow, ucol, uslice) = eT( F() ); } } //! apply a lambda function to each slice, where each slice is interpreted as a matrix template inline void subview_cube::each_slice(const std::function< void(Mat&) >& F) { arma_debug_sigprint(); Mat tmp1(n_rows, n_cols, arma_nozeros_indicator()); Mat tmp2('j', tmp1.memptr(), n_rows, n_cols); for(uword slice_id=0; slice_id < n_slices; ++slice_id) { for(uword col_id=0; col_id < n_cols; ++col_id) { arrayops::copy( tmp1.colptr(col_id), slice_colptr(slice_id, col_id), n_rows ); } F(tmp2); for(uword col_id=0; col_id < n_cols; ++col_id) { arrayops::copy( slice_colptr(slice_id, col_id), tmp1.colptr(col_id), n_rows ); } } } template inline void subview_cube::each_slice(const std::function< void(const Mat&) >& F) const { arma_debug_sigprint(); Mat tmp1(n_rows, n_cols, arma_nozeros_indicator()); const Mat tmp2('j', tmp1.memptr(), n_rows, n_cols); for(uword slice_id=0; slice_id < n_slices; ++slice_id) { for(uword col_id=0; col_id < n_cols; ++col_id) { arrayops::copy( tmp1.colptr(col_id), slice_colptr(slice_id, col_id), n_rows ); } F(tmp2); } } template inline void subview_cube::replace(const eT old_val, const eT new_val) { arma_debug_sigprint(); const uword local_n_rows = n_rows; const uword local_n_cols = n_cols; const uword local_n_slices = n_slices; for(uword slice = 0; slice < local_n_slices; ++slice) { for(uword col = 0; col < local_n_cols; ++col) { arrayops::replace(slice_colptr(slice,col), local_n_rows, old_val, new_val); } } } template inline void subview_cube::clean(const typename get_pod_type::result threshold) { arma_debug_sigprint(); const uword local_n_rows = n_rows; const uword local_n_cols = n_cols; const uword local_n_slices = n_slices; for(uword slice = 0; slice < local_n_slices; ++slice) { for(uword col = 0; col < local_n_cols; ++col) { arrayops::clean( slice_colptr(slice,col), local_n_rows, threshold ); } } } template inline void subview_cube::clamp(const eT min_val, const eT max_val) { arma_debug_sigprint(); if(is_cx::no) { arma_conform_check( (access::tmp_real(min_val) > access::tmp_real(max_val)), "subview_cube::clamp(): min_val must be less than max_val" ); } else { arma_conform_check( (access::tmp_real(min_val) > access::tmp_real(max_val)), "subview_cube::clamp(): real(min_val) must be less than real(max_val)" ); arma_conform_check( (access::tmp_imag(min_val) > access::tmp_imag(max_val)), "subview_cube::clamp(): imag(min_val) must be less than imag(max_val)" ); } const uword local_n_rows = n_rows; const uword local_n_cols = n_cols; const uword local_n_slices = n_slices; for(uword slice = 0; slice < local_n_slices; ++slice) { for(uword col = 0; col < local_n_cols; ++col) { arrayops::clamp( slice_colptr(slice,col), local_n_rows, min_val, max_val ); } } } template inline void subview_cube::fill(const eT val) { arma_debug_sigprint(); const uword local_n_rows = n_rows; const uword local_n_cols = n_cols; const uword local_n_slices = n_slices; for(uword slice = 0; slice < local_n_slices; ++slice) { for(uword col = 0; col < local_n_cols; ++col) { arrayops::inplace_set( slice_colptr(slice,col), val, local_n_rows ); } } } template inline void subview_cube::zeros() { arma_debug_sigprint(); const uword local_n_rows = n_rows; const uword local_n_cols = n_cols; const uword local_n_slices = n_slices; for(uword slice = 0; slice < local_n_slices; ++slice) { for(uword col = 0; col < local_n_cols; ++col) { arrayops::fill_zeros( slice_colptr(slice,col), local_n_rows ); } } } template inline void subview_cube::ones() { arma_debug_sigprint(); fill(eT(1)); } template inline void subview_cube::randu() { arma_debug_sigprint(); const uword local_n_rows = n_rows; const uword local_n_cols = n_cols; const uword local_n_slices = n_slices; for(uword slice = 0; slice < local_n_slices; ++slice) { for(uword col = 0; col < local_n_cols; ++col) { arma_rng::randu::fill( slice_colptr(slice,col), local_n_rows ); } } } template inline void subview_cube::randn() { arma_debug_sigprint(); const uword local_n_rows = n_rows; const uword local_n_cols = n_cols; const uword local_n_slices = n_slices; for(uword slice = 0; slice < local_n_slices; ++slice) { for(uword col = 0; col < local_n_cols; ++col) { arma_rng::randn::fill( slice_colptr(slice,col), local_n_rows ); } } } template inline bool subview_cube::is_finite() const { arma_debug_sigprint(); if(arma_config::fast_math_warn) { arma_warn(1, "is_finite(): detection of non-finite values is not reliable in fast math mode"); } const uword local_n_rows = n_rows; const uword local_n_cols = n_cols; const uword local_n_slices = n_slices; for(uword slice = 0; slice < local_n_slices; ++slice) { for(uword col = 0; col < local_n_cols; ++col) { if(arrayops::is_finite(slice_colptr(slice,col), local_n_rows) == false) { return false; } } } return true; } template inline bool subview_cube::is_zero(const typename get_pod_type::result tol) const { arma_debug_sigprint(); const uword local_n_rows = n_rows; const uword local_n_cols = n_cols; const uword local_n_slices = n_slices; for(uword slice = 0; slice < local_n_slices; ++slice) { for(uword col = 0; col < local_n_cols; ++col) { if(arrayops::is_zero(slice_colptr(slice,col), local_n_rows, tol) == false) { return false; } } } return true; } template inline bool subview_cube::has_inf() const { arma_debug_sigprint(); if(arma_config::fast_math_warn) { arma_warn(1, "has_inf(): detection of non-finite values is not reliable in fast math mode"); } const uword local_n_rows = n_rows; const uword local_n_cols = n_cols; const uword local_n_slices = n_slices; for(uword slice = 0; slice < local_n_slices; ++slice) { for(uword col = 0; col < local_n_cols; ++col) { if(arrayops::has_inf(slice_colptr(slice,col), local_n_rows)) { return true; } } } return false; } template inline bool subview_cube::has_nan() const { arma_debug_sigprint(); if(arma_config::fast_math_warn) { arma_warn(1, "has_nan(): detection of non-finite values is not reliable in fast math mode"); } const uword local_n_rows = n_rows; const uword local_n_cols = n_cols; const uword local_n_slices = n_slices; for(uword slice = 0; slice < local_n_slices; ++slice) { for(uword col = 0; col < local_n_cols; ++col) { if(arrayops::has_nan(slice_colptr(slice,col), local_n_rows)) { return true; } } } return false; } template inline bool subview_cube::has_nonfinite() const { arma_debug_sigprint(); if(arma_config::fast_math_warn) { arma_warn(1, "has_nonfinite(): detection of non-finite values is not reliable in fast math mode"); } const uword local_n_rows = n_rows; const uword local_n_cols = n_cols; const uword local_n_slices = n_slices; for(uword slice = 0; slice < local_n_slices; ++slice) { for(uword col = 0; col < local_n_cols; ++col) { if(arrayops::is_finite(slice_colptr(slice,col), local_n_rows) == false) { return true; } } } return false; } template inline eT subview_cube::at_alt(const uword i) const { return operator[](i); } template inline eT& subview_cube::operator[](const uword i) { const uword in_slice = i / n_elem_slice; const uword offset = in_slice * n_elem_slice; const uword j = i - offset; const uword in_col = j / n_rows; const uword in_row = j % n_rows; const uword index = (in_slice + aux_slice1)*m.n_elem_slice + (in_col + aux_col1)*m.n_rows + aux_row1 + in_row; return access::rw( (const_cast< Cube& >(m)).mem[index] ); } template inline eT subview_cube::operator[](const uword i) const { const uword in_slice = i / n_elem_slice; const uword offset = in_slice * n_elem_slice; const uword j = i - offset; const uword in_col = j / n_rows; const uword in_row = j % n_rows; const uword index = (in_slice + aux_slice1)*m.n_elem_slice + (in_col + aux_col1)*m.n_rows + aux_row1 + in_row; return m.mem[index]; } template inline eT& subview_cube::operator()(const uword i) { arma_conform_check_bounds( (i >= n_elem), "subview_cube::operator(): index out of bounds" ); const uword in_slice = i / n_elem_slice; const uword offset = in_slice * n_elem_slice; const uword j = i - offset; const uword in_col = j / n_rows; const uword in_row = j % n_rows; const uword index = (in_slice + aux_slice1)*m.n_elem_slice + (in_col + aux_col1)*m.n_rows + aux_row1 + in_row; return access::rw( (const_cast< Cube& >(m)).mem[index] ); } template inline eT subview_cube::operator()(const uword i) const { arma_conform_check_bounds( (i >= n_elem), "subview_cube::operator(): index out of bounds" ); const uword in_slice = i / n_elem_slice; const uword offset = in_slice * n_elem_slice; const uword j = i - offset; const uword in_col = j / n_rows; const uword in_row = j % n_rows; const uword index = (in_slice + aux_slice1)*m.n_elem_slice + (in_col + aux_col1)*m.n_rows + aux_row1 + in_row; return m.mem[index]; } template arma_inline eT& subview_cube::operator()(const uword in_row, const uword in_col, const uword in_slice) { arma_conform_check_bounds( ( (in_row >= n_rows) || (in_col >= n_cols) || (in_slice >= n_slices) ), "subview_cube::operator(): location out of bounds" ); const uword index = (in_slice + aux_slice1)*m.n_elem_slice + (in_col + aux_col1)*m.n_rows + aux_row1 + in_row; return access::rw( (const_cast< Cube& >(m)).mem[index] ); } template arma_inline eT subview_cube::operator()(const uword in_row, const uword in_col, const uword in_slice) const { arma_conform_check_bounds( ( (in_row >= n_rows) || (in_col >= n_cols) || (in_slice >= n_slices) ), "subview_cube::operator(): location out of bounds" ); const uword index = (in_slice + aux_slice1)*m.n_elem_slice + (in_col + aux_col1)*m.n_rows + aux_row1 + in_row; return m.mem[index]; } template arma_inline eT& subview_cube::at(const uword in_row, const uword in_col, const uword in_slice) { const uword index = (in_slice + aux_slice1)*m.n_elem_slice + (in_col + aux_col1)*m.n_rows + aux_row1 + in_row; return access::rw( (const_cast< Cube& >(m)).mem[index] ); } template arma_inline eT subview_cube::at(const uword in_row, const uword in_col, const uword in_slice) const { const uword index = (in_slice + aux_slice1)*m.n_elem_slice + (in_col + aux_col1)*m.n_rows + aux_row1 + in_row; return m.mem[index]; } template arma_inline eT* subview_cube::slice_colptr(const uword in_slice, const uword in_col) { return & access::rw((const_cast< Cube& >(m)).mem[ (in_slice + aux_slice1)*m.n_elem_slice + (in_col + aux_col1)*m.n_rows + aux_row1 ]); } template arma_inline const eT* subview_cube::slice_colptr(const uword in_slice, const uword in_col) const { return & m.mem[ (in_slice + aux_slice1)*m.n_elem_slice + (in_col + aux_col1)*m.n_rows + aux_row1 ]; } template template inline bool subview_cube::check_overlap(const subview_cube& x) const { if(is_same_type::value == false) { return false; } const subview_cube& t = (*this); if(void_ptr(&(t.m)) != void_ptr(&(x.m))) { return false; } if( (t.n_elem == 0) || (x.n_elem == 0) ) { return false; } const uword t_row_start = t.aux_row1; const uword t_row_end_p1 = t_row_start + t.n_rows; const uword t_col_start = t.aux_col1; const uword t_col_end_p1 = t_col_start + t.n_cols; const uword t_slice_start = t.aux_slice1; const uword t_slice_end_p1 = t_slice_start + t.n_slices; const uword x_row_start = x.aux_row1; const uword x_row_end_p1 = x_row_start + x.n_rows; const uword x_col_start = x.aux_col1; const uword x_col_end_p1 = x_col_start + x.n_cols; const uword x_slice_start = x.aux_slice1; const uword x_slice_end_p1 = x_slice_start + x.n_slices; const bool outside_rows = ( (x_row_start >= t_row_end_p1 ) || (t_row_start >= x_row_end_p1 ) ); const bool outside_cols = ( (x_col_start >= t_col_end_p1 ) || (t_col_start >= x_col_end_p1 ) ); const bool outside_slices = ( (x_slice_start >= t_slice_end_p1) || (t_slice_start >= x_slice_end_p1) ); return ( (outside_rows == false) && (outside_cols == false) && (outside_slices == false) ); } template inline bool subview_cube::check_overlap(const Mat& x) const { const subview_cube& t = *this; const uword t_aux_slice1 = t.aux_slice1; const uword t_aux_slice2_plus_1 = t_aux_slice1 + t.n_slices; for(uword slice = t_aux_slice1; slice < t_aux_slice2_plus_1; ++slice) { if(t.m.mat_ptrs[slice] != nullptr) { const Mat& y = *(t.m.mat_ptrs[slice]); if( x.memptr() == y.memptr() ) { return true; } } } return false; } //! cube X = Y.subcube(...) template inline void subview_cube::extract(Cube& out, const subview_cube& in) { arma_debug_sigprint(); // NOTE: we're assuming that the cube has already been set to the correct size and there is no aliasing; // size setting and alias checking is done by either the Cube constructor or operator=() const uword n_rows = in.n_rows; const uword n_cols = in.n_cols; const uword n_slices = in.n_slices; arma_debug_print(arma_str::format("out.n_rows: %u; out.n_cols: %u; out.n_slices: %u; in.m.n_rows: %u; in.m.n_cols: %u; in.m.n_slices: %u") % out.n_rows % out.n_cols % out.n_slices % in.m.n_rows % in.m.n_cols % in.m.n_slices); if( (in.aux_row1 == 0) && (n_rows == in.m.n_rows) ) { for(uword s=0; s < n_slices; ++s) { arrayops::copy( out.slice_colptr(s,0), in.slice_colptr(s,0), in.n_elem_slice ); } return; } for(uword s=0; s < n_slices; ++s) for(uword c=0; c < n_cols; ++c) { arrayops::copy( out.slice_colptr(s,c), in.slice_colptr(s,c), n_rows ); } } //! cube X += Y.subcube(...) template inline void subview_cube::plus_inplace(Cube& out, const subview_cube& in) { arma_debug_sigprint(); arma_conform_assert_same_size(out, in, "addition"); const uword n_rows = out.n_rows; const uword n_cols = out.n_cols; const uword n_slices = out.n_slices; for(uword slice = 0; slice inline void subview_cube::minus_inplace(Cube& out, const subview_cube& in) { arma_debug_sigprint(); arma_conform_assert_same_size(out, in, "subtraction"); const uword n_rows = out.n_rows; const uword n_cols = out.n_cols; const uword n_slices = out.n_slices; for(uword slice = 0; slice inline void subview_cube::schur_inplace(Cube& out, const subview_cube& in) { arma_debug_sigprint(); arma_conform_assert_same_size(out, in, "element-wise multiplication"); const uword n_rows = out.n_rows; const uword n_cols = out.n_cols; const uword n_slices = out.n_slices; for(uword slice = 0; slice inline void subview_cube::div_inplace(Cube& out, const subview_cube& in) { arma_debug_sigprint(); arma_conform_assert_same_size(out, in, "element-wise division"); const uword n_rows = out.n_rows; const uword n_cols = out.n_cols; const uword n_slices = out.n_slices; for(uword slice = 0; slice inline void subview_cube::extract(Mat& out, const subview_cube& in) { arma_debug_sigprint(); arma_conform_assert_cube_as_mat(out, in, "copy into matrix", false); const uword in_n_rows = in.n_rows; const uword in_n_cols = in.n_cols; const uword in_n_slices = in.n_slices; const uword out_vec_state = out.vec_state; if(in_n_slices == 1) { out.set_size(in_n_rows, in_n_cols); for(uword col=0; col < in_n_cols; ++col) { arrayops::copy( out.colptr(col), in.slice_colptr(0, col), in_n_rows ); } } else { if(out_vec_state == 0) { if(in_n_cols == 1) { out.set_size(in_n_rows, in_n_slices); for(uword i=0; i < in_n_slices; ++i) { arrayops::copy( out.colptr(i), in.slice_colptr(i, 0), in_n_rows ); } } else if(in_n_rows == 1) { const Cube& Q = in.m; const uword in_aux_row1 = in.aux_row1; const uword in_aux_col1 = in.aux_col1; const uword in_aux_slice1 = in.aux_slice1; out.set_size(in_n_cols, in_n_slices); for(uword slice=0; slice < in_n_slices; ++slice) { const uword mod_slice = in_aux_slice1 + slice; eT* out_colptr = out.colptr(slice); uword i,j; for(i=0, j=1; j < in_n_cols; i+=2, j+=2) { const eT tmp_i = Q.at(in_aux_row1, in_aux_col1 + i, mod_slice); const eT tmp_j = Q.at(in_aux_row1, in_aux_col1 + j, mod_slice); out_colptr[i] = tmp_i; out_colptr[j] = tmp_j; } if(i < in_n_cols) { out_colptr[i] = Q.at(in_aux_row1, in_aux_col1 + i, mod_slice); } } } } else { out.set_size(in_n_slices); eT* out_mem = out.memptr(); const Cube& Q = in.m; const uword in_aux_row1 = in.aux_row1; const uword in_aux_col1 = in.aux_col1; const uword in_aux_slice1 = in.aux_slice1; for(uword i=0; i inline void subview_cube::plus_inplace(Mat& out, const subview_cube& in) { arma_debug_sigprint(); arma_conform_assert_cube_as_mat(out, in, "addition", true); const uword in_n_rows = in.n_rows; const uword in_n_cols = in.n_cols; const uword in_n_slices = in.n_slices; const uword out_n_rows = out.n_rows; const uword out_n_cols = out.n_cols; const uword out_vec_state = out.vec_state; if(in_n_slices == 1) { if( (arma_config::check_conform) && ((out_n_rows != in_n_rows) || (out_n_cols != in_n_cols)) ) { std::ostringstream tmp; tmp << "in-place addition: " << out_n_rows << 'x' << out_n_cols << " output matrix is incompatible with " << in_n_rows << 'x' << in_n_cols << 'x' << in_n_slices << " cube interpreted as " << in_n_rows << 'x' << in_n_cols << " matrix"; arma_stop_logic_error(tmp.str()); } for(uword col=0; col < in_n_cols; ++col) { arrayops::inplace_plus( out.colptr(col), in.slice_colptr(0, col), in_n_rows ); } } else { if(out_vec_state == 0) { if( (in_n_rows == out_n_rows) && (in_n_cols == 1) && (in_n_slices == out_n_cols) ) { for(uword i=0; i < in_n_slices; ++i) { arrayops::inplace_plus( out.colptr(i), in.slice_colptr(i, 0), in_n_rows ); } } else if( (in_n_rows == 1) && (in_n_cols == out_n_rows) && (in_n_slices == out_n_cols) ) { const Cube& Q = in.m; const uword in_aux_row1 = in.aux_row1; const uword in_aux_col1 = in.aux_col1; const uword in_aux_slice1 = in.aux_slice1; for(uword slice=0; slice < in_n_slices; ++slice) { const uword mod_slice = in_aux_slice1 + slice; eT* out_colptr = out.colptr(slice); uword i,j; for(i=0, j=1; j < in_n_cols; i+=2, j+=2) { const eT tmp_i = Q.at(in_aux_row1, in_aux_col1 + i, mod_slice); const eT tmp_j = Q.at(in_aux_row1, in_aux_col1 + j, mod_slice); out_colptr[i] += tmp_i; out_colptr[j] += tmp_j; } if(i < in_n_cols) { out_colptr[i] += Q.at(in_aux_row1, in_aux_col1 + i, mod_slice); } } } } else { eT* out_mem = out.memptr(); const Cube& Q = in.m; const uword in_aux_row1 = in.aux_row1; const uword in_aux_col1 = in.aux_col1; const uword in_aux_slice1 = in.aux_slice1; for(uword i=0; i inline void subview_cube::minus_inplace(Mat& out, const subview_cube& in) { arma_debug_sigprint(); arma_conform_assert_cube_as_mat(out, in, "subtraction", true); const uword in_n_rows = in.n_rows; const uword in_n_cols = in.n_cols; const uword in_n_slices = in.n_slices; const uword out_n_rows = out.n_rows; const uword out_n_cols = out.n_cols; const uword out_vec_state = out.vec_state; if(in_n_slices == 1) { if( (arma_config::check_conform) && ((out_n_rows != in_n_rows) || (out_n_cols != in_n_cols)) ) { std::ostringstream tmp; tmp << "in-place subtraction: " << out_n_rows << 'x' << out_n_cols << " output matrix is incompatible with " << in_n_rows << 'x' << in_n_cols << 'x' << in_n_slices << " cube interpreted as " << in_n_rows << 'x' << in_n_cols << " matrix"; arma_stop_logic_error(tmp.str()); } for(uword col=0; col < in_n_cols; ++col) { arrayops::inplace_minus( out.colptr(col), in.slice_colptr(0, col), in_n_rows ); } } else { if(out_vec_state == 0) { if( (in_n_rows == out_n_rows) && (in_n_cols == 1) && (in_n_slices == out_n_cols) ) { for(uword i=0; i < in_n_slices; ++i) { arrayops::inplace_minus( out.colptr(i), in.slice_colptr(i, 0), in_n_rows ); } } else if( (in_n_rows == 1) && (in_n_cols == out_n_rows) && (in_n_slices == out_n_cols) ) { const Cube& Q = in.m; const uword in_aux_row1 = in.aux_row1; const uword in_aux_col1 = in.aux_col1; const uword in_aux_slice1 = in.aux_slice1; for(uword slice=0; slice < in_n_slices; ++slice) { const uword mod_slice = in_aux_slice1 + slice; eT* out_colptr = out.colptr(slice); uword i,j; for(i=0, j=1; j < in_n_cols; i+=2, j+=2) { const eT tmp_i = Q.at(in_aux_row1, in_aux_col1 + i, mod_slice); const eT tmp_j = Q.at(in_aux_row1, in_aux_col1 + j, mod_slice); out_colptr[i] -= tmp_i; out_colptr[j] -= tmp_j; } if(i < in_n_cols) { out_colptr[i] -= Q.at(in_aux_row1, in_aux_col1 + i, mod_slice); } } } } else { eT* out_mem = out.memptr(); const Cube& Q = in.m; const uword in_aux_row1 = in.aux_row1; const uword in_aux_col1 = in.aux_col1; const uword in_aux_slice1 = in.aux_slice1; for(uword i=0; i inline void subview_cube::schur_inplace(Mat& out, const subview_cube& in) { arma_debug_sigprint(); arma_conform_assert_cube_as_mat(out, in, "element-wise multiplication", true); const uword in_n_rows = in.n_rows; const uword in_n_cols = in.n_cols; const uword in_n_slices = in.n_slices; const uword out_n_rows = out.n_rows; const uword out_n_cols = out.n_cols; const uword out_vec_state = out.vec_state; if(in_n_slices == 1) { if( (arma_config::check_conform) && ((out_n_rows != in_n_rows) || (out_n_cols != in_n_cols)) ) { std::ostringstream tmp; tmp << "in-place element-wise multiplication: " << out_n_rows << 'x' << out_n_cols << " output matrix is incompatible with " << in_n_rows << 'x' << in_n_cols << 'x' << in_n_slices << " cube interpreted as " << in_n_rows << 'x' << in_n_cols << " matrix"; arma_stop_logic_error(tmp.str()); } for(uword col=0; col < in_n_cols; ++col) { arrayops::inplace_mul( out.colptr(col), in.slice_colptr(0, col), in_n_rows ); } } else { if(out_vec_state == 0) { if( (in_n_rows == out_n_rows) && (in_n_cols == 1) && (in_n_slices == out_n_cols) ) { for(uword i=0; i < in_n_slices; ++i) { arrayops::inplace_mul( out.colptr(i), in.slice_colptr(i, 0), in_n_rows ); } } else if( (in_n_rows == 1) && (in_n_cols == out_n_rows) && (in_n_slices == out_n_cols) ) { const Cube& Q = in.m; const uword in_aux_row1 = in.aux_row1; const uword in_aux_col1 = in.aux_col1; const uword in_aux_slice1 = in.aux_slice1; for(uword slice=0; slice < in_n_slices; ++slice) { const uword mod_slice = in_aux_slice1 + slice; eT* out_colptr = out.colptr(slice); uword i,j; for(i=0, j=1; j < in_n_cols; i+=2, j+=2) { const eT tmp_i = Q.at(in_aux_row1, in_aux_col1 + i, mod_slice); const eT tmp_j = Q.at(in_aux_row1, in_aux_col1 + j, mod_slice); out_colptr[i] *= tmp_i; out_colptr[j] *= tmp_j; } if(i < in_n_cols) { out_colptr[i] *= Q.at(in_aux_row1, in_aux_col1 + i, mod_slice); } } } } else { eT* out_mem = out.memptr(); const Cube& Q = in.m; const uword in_aux_row1 = in.aux_row1; const uword in_aux_col1 = in.aux_col1; const uword in_aux_slice1 = in.aux_slice1; for(uword i=0; i inline void subview_cube::div_inplace(Mat& out, const subview_cube& in) { arma_debug_sigprint(); arma_conform_assert_cube_as_mat(out, in, "element-wise division", true); const uword in_n_rows = in.n_rows; const uword in_n_cols = in.n_cols; const uword in_n_slices = in.n_slices; const uword out_n_rows = out.n_rows; const uword out_n_cols = out.n_cols; const uword out_vec_state = out.vec_state; if(in_n_slices == 1) { if( (arma_config::check_conform) && ((out_n_rows != in_n_rows) || (out_n_cols != in_n_cols)) ) { std::ostringstream tmp; tmp << "in-place element-wise division: " << out_n_rows << 'x' << out_n_cols << " output matrix is incompatible with " << in_n_rows << 'x' << in_n_cols << 'x' << in_n_slices << " cube interpreted as " << in_n_rows << 'x' << in_n_cols << " matrix"; arma_stop_logic_error(tmp.str()); } for(uword col=0; col < in_n_cols; ++col) { arrayops::inplace_div( out.colptr(col), in.slice_colptr(0, col), in_n_rows ); } } else { if(out_vec_state == 0) { if( (in_n_rows == out_n_rows) && (in_n_cols == 1) && (in_n_slices == out_n_cols) ) { for(uword i=0; i < in_n_slices; ++i) { arrayops::inplace_div( out.colptr(i), in.slice_colptr(i, 0), in_n_rows ); } } else if( (in_n_rows == 1) && (in_n_cols == out_n_rows) && (in_n_slices == out_n_cols) ) { const Cube& Q = in.m; const uword in_aux_row1 = in.aux_row1; const uword in_aux_col1 = in.aux_col1; const uword in_aux_slice1 = in.aux_slice1; for(uword slice=0; slice < in_n_slices; ++slice) { const uword mod_slice = in_aux_slice1 + slice; eT* out_colptr = out.colptr(slice); uword i,j; for(i=0, j=1; j < in_n_cols; i+=2, j+=2) { const eT tmp_i = Q.at(in_aux_row1, in_aux_col1 + i, mod_slice); const eT tmp_j = Q.at(in_aux_row1, in_aux_col1 + j, mod_slice); out_colptr[i] /= tmp_i; out_colptr[j] /= tmp_j; } if(i < in_n_cols) { out_colptr[i] /= Q.at(in_aux_row1, in_aux_col1 + i, mod_slice); } } } } else { eT* out_mem = out.memptr(); const Cube& Q = in.m; const uword in_aux_row1 = in.aux_row1; const uword in_aux_col1 = in.aux_col1; const uword in_aux_slice1 = in.aux_slice1; for(uword i=0; i inline typename subview_cube::iterator subview_cube::begin() { return iterator(*this, aux_row1, aux_col1, aux_slice1); } template inline typename subview_cube::const_iterator subview_cube::begin() const { return const_iterator(*this, aux_row1, aux_col1, aux_slice1); } template inline typename subview_cube::const_iterator subview_cube::cbegin() const { return const_iterator(*this, aux_row1, aux_col1, aux_slice1); } template inline typename subview_cube::iterator subview_cube::end() { return iterator(*this, aux_row1, aux_col1, aux_slice1 + n_slices); } template inline typename subview_cube::const_iterator subview_cube::end() const { return const_iterator(*this, aux_row1, aux_col1, aux_slice1 + n_slices); } template inline typename subview_cube::const_iterator subview_cube::cend() const { return const_iterator(*this, aux_row1, aux_col1, aux_slice1 + n_slices); } // // // template inline subview_cube::iterator::iterator() : M (nullptr) , current_ptr (nullptr) , current_row (0 ) , current_col (0 ) , current_slice(0 ) , aux_row1 (0 ) , aux_col1 (0 ) , aux_row2_p1 (0 ) , aux_col2_p1 (0 ) { arma_debug_sigprint(); // Technically this iterator is invalid (it does not point to a valid element) } template inline subview_cube::iterator::iterator(const iterator& X) : M (X.M ) , current_ptr (X.current_ptr ) , current_row (X.current_row ) , current_col (X.current_col ) , current_slice(X.current_slice) , aux_row1 (X.aux_row1 ) , aux_col1 (X.aux_col1 ) , aux_row2_p1 (X.aux_row2_p1 ) , aux_col2_p1 (X.aux_col2_p1 ) { arma_debug_sigprint(); } template inline subview_cube::iterator::iterator(subview_cube& in_sv, const uword in_row, const uword in_col, const uword in_slice) : M (&(const_cast< Cube& >(in_sv.m))) , current_ptr (&(M->at(in_row,in_col,in_slice)) ) , current_row (in_row ) , current_col (in_col ) , current_slice(in_slice ) , aux_row1 (in_sv.aux_row1 ) , aux_col1 (in_sv.aux_col1 ) , aux_row2_p1 (in_sv.aux_row1 + in_sv.n_rows ) , aux_col2_p1 (in_sv.aux_col1 + in_sv.n_cols ) { arma_debug_sigprint(); } template inline eT& subview_cube::iterator::operator*() { return (*current_ptr); } template inline typename subview_cube::iterator& subview_cube::iterator::operator++() { current_row++; if(current_row == aux_row2_p1) { current_row = aux_row1; current_col++; if(current_col == aux_col2_p1) { current_col = aux_col1; current_slice++; } current_ptr = &( (*M).at(current_row,current_col,current_slice) ); } else { current_ptr++; } return *this; } template inline typename subview_cube::iterator subview_cube::iterator::operator++(int) { typename subview_cube::iterator temp(*this); ++(*this); return temp; } template inline bool subview_cube::iterator::operator==(const iterator& rhs) const { return (current_ptr == rhs.current_ptr); } template inline bool subview_cube::iterator::operator!=(const iterator& rhs) const { return (current_ptr != rhs.current_ptr); } template inline bool subview_cube::iterator::operator==(const const_iterator& rhs) const { return (current_ptr == rhs.current_ptr); } template inline bool subview_cube::iterator::operator!=(const const_iterator& rhs) const { return (current_ptr != rhs.current_ptr); } // // // template inline subview_cube::const_iterator::const_iterator() : M (nullptr) , current_ptr (nullptr) , current_row (0 ) , current_col (0 ) , current_slice(0 ) , aux_row1 (0 ) , aux_col1 (0 ) , aux_row2_p1 (0 ) , aux_col2_p1 (0 ) { arma_debug_sigprint(); // Technically this iterator is invalid (it does not point to a valid element) } template inline subview_cube::const_iterator::const_iterator(const iterator& X) : M (X.M ) , current_ptr (X.current_ptr ) , current_row (X.current_row ) , current_col (X.current_col ) , current_slice(X.current_slice) , aux_row1 (X.aux_row1 ) , aux_col1 (X.aux_col1 ) , aux_row2_p1 (X.aux_row2_p1 ) , aux_col2_p1 (X.aux_col2_p1 ) { arma_debug_sigprint(); } template inline subview_cube::const_iterator::const_iterator(const const_iterator& X) : M (X.M ) , current_ptr (X.current_ptr ) , current_row (X.current_row ) , current_col (X.current_col ) , current_slice(X.current_slice) , aux_row1 (X.aux_row1 ) , aux_col1 (X.aux_col1 ) , aux_row2_p1 (X.aux_row2_p1 ) , aux_col2_p1 (X.aux_col2_p1 ) { arma_debug_sigprint(); } template inline subview_cube::const_iterator::const_iterator(const subview_cube& in_sv, const uword in_row, const uword in_col, const uword in_slice) : M (&(in_sv.m) ) , current_ptr (&(M->at(in_row,in_col,in_slice))) , current_row (in_row ) , current_col (in_col ) , current_slice(in_slice ) , aux_row1 (in_sv.aux_row1 ) , aux_col1 (in_sv.aux_col1 ) , aux_row2_p1 (in_sv.aux_row1 + in_sv.n_rows ) , aux_col2_p1 (in_sv.aux_col1 + in_sv.n_cols ) { arma_debug_sigprint(); } template inline const eT& subview_cube::const_iterator::operator*() { return (*current_ptr); } template inline typename subview_cube::const_iterator& subview_cube::const_iterator::operator++() { current_row++; if(current_row == aux_row2_p1) { current_row = aux_row1; current_col++; if(current_col == aux_col2_p1) { current_col = aux_col1; current_slice++; } current_ptr = &( (*M).at(current_row,current_col,current_slice) ); } else { current_ptr++; } return *this; } template inline typename subview_cube::const_iterator subview_cube::const_iterator::operator++(int) { typename subview_cube::const_iterator temp(*this); ++(*this); return temp; } template inline bool subview_cube::const_iterator::operator==(const iterator& rhs) const { return (current_ptr == rhs.current_ptr); } template inline bool subview_cube::const_iterator::operator!=(const iterator& rhs) const { return (current_ptr != rhs.current_ptr); } template inline bool subview_cube::const_iterator::operator==(const const_iterator& rhs) const { return (current_ptr == rhs.current_ptr); } template inline bool subview_cube::const_iterator::operator!=(const const_iterator& rhs) const { return (current_ptr != rhs.current_ptr); } //! @} RcppArmadillo/inst/include/armadillo_bits/op_diagmat_meat.hpp0000644000176200001440000004726514631567470024246 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_diagmat //! @{ template inline void op_diagmat::apply(Mat& out, const Op& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; if(is_Mat::value) { // allow detection of in-place operation const unwrap U(X.m); const Mat& A = U.M; if(&out != &A) // no aliasing { const Proxy< Mat > P(A); op_diagmat::apply(out, P); } else // we have aliasing { const uword n_rows = out.n_rows; const uword n_cols = out.n_cols; if((n_rows == 1) || (n_cols == 1)) // create diagonal matrix from vector { const eT* out_mem = out.memptr(); const uword N = out.n_elem; Mat tmp(N,N, arma_zeros_indicator()); for(uword i=0; i P(X.m); if(P.is_alias(out)) { Mat tmp; op_diagmat::apply(tmp, P); out.steal_mem(tmp); } else { op_diagmat::apply(out, P); } } } template inline void op_diagmat::apply(Mat& out, const Proxy& P) { arma_debug_sigprint(); const uword n_rows = P.get_n_rows(); const uword n_cols = P.get_n_cols(); const uword n_elem = P.get_n_elem(); if(n_elem == 0) { out.reset(); return; } const bool P_is_vec = (T1::is_row) || (T1::is_col) || (n_rows == 1) || (n_cols == 1); if(P_is_vec) { out.zeros(n_elem, n_elem); if(Proxy::use_at == false) { typename Proxy::ea_type Pea = P.get_ea(); for(uword i=0; i < n_elem; ++i) { out.at(i,i) = Pea[i]; } } else { if(n_rows == 1) { for(uword i=0; i < n_elem; ++i) { out.at(i,i) = P.at(0,i); } } else { for(uword i=0; i < n_elem; ++i) { out.at(i,i) = P.at(i,0); } } } } else // P represents a matrix { out.zeros(n_rows, n_cols); const uword N = (std::min)(n_rows, n_cols); for(uword i=0; i inline void op_diagmat::apply(Mat& out, const Op< Glue, op_diagmat>& X) { arma_debug_sigprint(); op_diagmat::apply_times(out, X.m.A, X.m.B); } template inline void op_diagmat::apply_times(Mat& actual_out, const T1& X, const T2& Y, const typename arma_not_cx::result* junk) { arma_debug_sigprint(); arma_ignore(junk); typedef typename T1::elem_type eT; const partial_unwrap UA(X); const partial_unwrap UB(Y); const typename partial_unwrap::stored_type& A = UA.M; const typename partial_unwrap::stored_type& B = UB.M; arma_conform_assert_trans_mul_size< partial_unwrap::do_trans, partial_unwrap::do_trans >(A.n_rows, A.n_cols, B.n_rows, B.n_cols, "matrix multiplication"); constexpr bool use_alpha = partial_unwrap::do_times || partial_unwrap::do_times; const eT alpha = use_alpha ? (UA.get_val() * UB.get_val()) : eT(0); const uword A_n_rows = A.n_rows; const uword A_n_cols = A.n_cols; const uword B_n_rows = B.n_rows; const uword B_n_cols = B.n_cols; // check if the multiplication results in a vector if( (partial_unwrap::do_trans == false) && (partial_unwrap::do_trans == false) ) { if((A_n_rows == 1) || (B_n_cols == 1)) { arma_debug_print("trans_A = false; trans_B = false; vector result"); const Mat C = A*B; const eT* C_mem = C.memptr(); const uword N = C.n_elem; actual_out.zeros(N,N); for(uword i=0; i::do_trans == true ) && (partial_unwrap::do_trans == false) ) { if((A_n_cols == 1) || (B_n_cols == 1)) { arma_debug_print("trans_A = true; trans_B = false; vector result"); const Mat C = trans(A)*B; const eT* C_mem = C.memptr(); const uword N = C.n_elem; actual_out.zeros(N,N); for(uword i=0; i::do_trans == false) && (partial_unwrap::do_trans == true ) ) { if((A_n_rows == 1) || (B_n_rows == 1)) { arma_debug_print("trans_A = false; trans_B = true; vector result"); const Mat C = A*trans(B); const eT* C_mem = C.memptr(); const uword N = C.n_elem; actual_out.zeros(N,N); for(uword i=0; i::do_trans == true ) && (partial_unwrap::do_trans == true ) ) { if((A_n_cols == 1) || (B_n_rows == 1)) { arma_debug_print("trans_A = true; trans_B = true; vector result"); const Mat C = trans(A)*trans(B); const eT* C_mem = C.memptr(); const uword N = C.n_elem; actual_out.zeros(N,N); for(uword i=0; i tmp; Mat& out = (is_alias) ? tmp : actual_out; if( (partial_unwrap::do_trans == false) && (partial_unwrap::do_trans == false) ) { arma_debug_print("trans_A = false; trans_B = false; matrix result"); out.zeros(A_n_rows, B_n_cols); const uword N = (std::min)(A_n_rows, B_n_cols); for(uword k=0; k < N; ++k) { eT acc1 = eT(0); eT acc2 = eT(0); const eT* B_colptr = B.colptr(k); // condition: A_n_cols = B_n_rows uword j; for(j=1; j < A_n_cols; j+=2) { const uword i = (j-1); const eT tmp_i = B_colptr[i]; const eT tmp_j = B_colptr[j]; acc1 += A.at(k, i) * tmp_i; acc2 += A.at(k, j) * tmp_j; } const uword i = (j-1); if(i < A_n_cols) { acc1 += A.at(k, i) * B_colptr[i]; } const eT acc = acc1 + acc2; out.at(k,k) = (use_alpha) ? eT(alpha * acc) : eT(acc); } } else if( (partial_unwrap::do_trans == true ) && (partial_unwrap::do_trans == false) ) { arma_debug_print("trans_A = true; trans_B = false; matrix result"); out.zeros(A_n_cols, B_n_cols); const uword N = (std::min)(A_n_cols, B_n_cols); for(uword k=0; k < N; ++k) { const eT* A_colptr = A.colptr(k); const eT* B_colptr = B.colptr(k); // condition: A_n_rows = B_n_rows const eT acc = op_dot::direct_dot(A_n_rows, A_colptr, B_colptr); out.at(k,k) = (use_alpha) ? eT(alpha * acc) : eT(acc); } } else if( (partial_unwrap::do_trans == false) && (partial_unwrap::do_trans == true ) ) { arma_debug_print("trans_A = false; trans_B = true; matrix result"); out.zeros(A_n_rows, B_n_rows); const uword N = (std::min)(A_n_rows, B_n_rows); for(uword k=0; k < N; ++k) { eT acc = eT(0); // condition: A_n_cols = B_n_cols for(uword i=0; i < A_n_cols; ++i) { acc += A.at(k,i) * B.at(k,i); } out.at(k,k) = (use_alpha) ? eT(alpha * acc) : eT(acc); } } else if( (partial_unwrap::do_trans == true ) && (partial_unwrap::do_trans == true ) ) { arma_debug_print("trans_A = true; trans_B = true; matrix result"); out.zeros(A_n_cols, B_n_rows); const uword N = (std::min)(A_n_cols, B_n_rows); for(uword k=0; k < N; ++k) { eT acc = eT(0); const eT* A_colptr = A.colptr(k); // condition: A_n_rows = B_n_cols for(uword i=0; i < A_n_rows; ++i) { acc += A_colptr[i] * B.at(k,i); } out.at(k,k) = (use_alpha) ? eT(alpha * acc) : eT(acc); } } if(is_alias) { actual_out.steal_mem(tmp); } } template inline void op_diagmat::apply_times(Mat& actual_out, const T1& X, const T2& Y, const typename arma_cx_only::result* junk) { arma_debug_sigprint(); arma_ignore(junk); typedef typename T1::pod_type T; typedef typename T1::elem_type eT; const partial_unwrap UA(X); const partial_unwrap UB(Y); const typename partial_unwrap::stored_type& A = UA.M; const typename partial_unwrap::stored_type& B = UB.M; arma_conform_assert_trans_mul_size< partial_unwrap::do_trans, partial_unwrap::do_trans >(A.n_rows, A.n_cols, B.n_rows, B.n_cols, "matrix multiplication"); constexpr bool use_alpha = partial_unwrap::do_times || partial_unwrap::do_times; const eT alpha = use_alpha ? (UA.get_val() * UB.get_val()) : eT(0); const uword A_n_rows = A.n_rows; const uword A_n_cols = A.n_cols; const uword B_n_rows = B.n_rows; const uword B_n_cols = B.n_cols; // check if the multiplication results in a vector if( (partial_unwrap::do_trans == false) && (partial_unwrap::do_trans == false) ) { if((A_n_rows == 1) || (B_n_cols == 1)) { arma_debug_print("trans_A = false; trans_B = false; vector result"); const Mat C = A*B; const eT* C_mem = C.memptr(); const uword N = C.n_elem; actual_out.zeros(N,N); for(uword i=0; i::do_trans == true ) && (partial_unwrap::do_trans == false) ) { if((A_n_cols == 1) || (B_n_cols == 1)) { arma_debug_print("trans_A = true; trans_B = false; vector result"); const Mat C = trans(A)*B; const eT* C_mem = C.memptr(); const uword N = C.n_elem; actual_out.zeros(N,N); for(uword i=0; i::do_trans == false) && (partial_unwrap::do_trans == true ) ) { if((A_n_rows == 1) || (B_n_rows == 1)) { arma_debug_print("trans_A = false; trans_B = true; vector result"); const Mat C = A*trans(B); const eT* C_mem = C.memptr(); const uword N = C.n_elem; actual_out.zeros(N,N); for(uword i=0; i::do_trans == true ) && (partial_unwrap::do_trans == true ) ) { if((A_n_cols == 1) || (B_n_rows == 1)) { arma_debug_print("trans_A = true; trans_B = true; vector result"); const Mat C = trans(A)*trans(B); const eT* C_mem = C.memptr(); const uword N = C.n_elem; actual_out.zeros(N,N); for(uword i=0; i tmp; Mat& out = (is_alias) ? tmp : actual_out; if( (partial_unwrap::do_trans == false) && (partial_unwrap::do_trans == false) ) { arma_debug_print("trans_A = false; trans_B = false; matrix result"); out.zeros(A_n_rows, B_n_cols); const uword N = (std::min)(A_n_rows, B_n_cols); for(uword k=0; k < N; ++k) { T acc_real = T(0); T acc_imag = T(0); const eT* B_colptr = B.colptr(k); // condition: A_n_cols = B_n_rows for(uword i=0; i < A_n_cols; ++i) { // acc += A.at(k, i) * B_colptr[i]; const std::complex& xx = A.at(k, i); const std::complex& yy = B_colptr[i]; const T a = xx.real(); const T b = xx.imag(); const T c = yy.real(); const T d = yy.imag(); acc_real += (a*c) - (b*d); acc_imag += (a*d) + (b*c); } const eT acc = std::complex(acc_real, acc_imag); out.at(k,k) = (use_alpha) ? eT(alpha * acc) : eT(acc); } } else if( (partial_unwrap::do_trans == true) && (partial_unwrap::do_trans == false) ) { arma_debug_print("trans_A = true; trans_B = false; matrix result"); out.zeros(A_n_cols, B_n_cols); const uword N = (std::min)(A_n_cols, B_n_cols); for(uword k=0; k < N; ++k) { T acc_real = T(0); T acc_imag = T(0); const eT* A_colptr = A.colptr(k); const eT* B_colptr = B.colptr(k); // condition: A_n_rows = B_n_rows for(uword i=0; i < A_n_rows; ++i) { // acc += std::conj(A_colptr[i]) * B_colptr[i]; const std::complex& xx = A_colptr[i]; const std::complex& yy = B_colptr[i]; const T a = xx.real(); const T b = xx.imag(); const T c = yy.real(); const T d = yy.imag(); // take into account the complex conjugate of xx acc_real += (a*c) + (b*d); acc_imag += (a*d) - (b*c); } const eT acc = std::complex(acc_real, acc_imag); out.at(k,k) = (use_alpha) ? eT(alpha * acc) : eT(acc); } } else if( (partial_unwrap::do_trans == false) && (partial_unwrap::do_trans == true) ) { arma_debug_print("trans_A = false; trans_B = true; matrix result"); out.zeros(A_n_rows, B_n_rows); const uword N = (std::min)(A_n_rows, B_n_rows); for(uword k=0; k < N; ++k) { T acc_real = T(0); T acc_imag = T(0); // condition: A_n_cols = B_n_cols for(uword i=0; i < A_n_cols; ++i) { // acc += A.at(k,i) * std::conj(B.at(k,i)); const std::complex& xx = A.at(k, i); const std::complex& yy = B.at(k, i); const T a = xx.real(); const T b = xx.imag(); const T c = yy.real(); const T d = -yy.imag(); // take the conjugate acc_real += (a*c) - (b*d); acc_imag += (a*d) + (b*c); } const eT acc = std::complex(acc_real, acc_imag); out.at(k,k) = (use_alpha) ? eT(alpha * acc) : eT(acc); } } else if( (partial_unwrap::do_trans == true) && (partial_unwrap::do_trans == true) ) { arma_debug_print("trans_A = true; trans_B = true; matrix result"); out.zeros(A_n_cols, B_n_rows); const uword N = (std::min)(A_n_cols, B_n_rows); for(uword k=0; k < N; ++k) { T acc_real = T(0); T acc_imag = T(0); const eT* A_colptr = A.colptr(k); // condition: A_n_rows = B_n_cols for(uword i=0; i < A_n_rows; ++i) { // acc += std::conj(A_colptr[i]) * std::conj(B.at(k,i)); const std::complex& xx = A_colptr[i]; const std::complex& yy = B.at(k, i); const T a = xx.real(); const T b = -xx.imag(); // take the conjugate const T c = yy.real(); const T d = -yy.imag(); // take the conjugate acc_real += (a*c) - (b*d); acc_imag += (a*d) + (b*c); } const eT acc = std::complex(acc_real, acc_imag); out.at(k,k) = (use_alpha) ? eT(alpha * acc) : eT(acc); } } if(is_alias) { actual_out.steal_mem(tmp); } } // // // template inline void op_diagmat2::apply(Mat& out, const Op& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword row_offset = X.aux_uword_a; const uword col_offset = X.aux_uword_b; const Proxy P(X.m); if(P.is_alias(out)) { Mat tmp; op_diagmat2::apply(tmp, P, row_offset, col_offset); out.steal_mem(tmp); } else { op_diagmat2::apply(out, P, row_offset, col_offset); } } template inline void op_diagmat2::apply(Mat& out, const Proxy& P, const uword row_offset, const uword col_offset) { arma_debug_sigprint(); const uword n_rows = P.get_n_rows(); const uword n_cols = P.get_n_cols(); const uword n_elem = P.get_n_elem(); if(n_elem == 0) { out.reset(); return; } const bool P_is_vec = (T1::is_row) || (T1::is_col) || (n_rows == 1) || (n_cols == 1); if(P_is_vec) { const uword n_pad = (std::max)(row_offset, col_offset); out.zeros(n_elem + n_pad, n_elem + n_pad); if(Proxy::use_at == false) { typename Proxy::ea_type Pea = P.get_ea(); for(uword i=0; i < n_elem; ++i) { out.at(row_offset + i, col_offset + i) = Pea[i]; } } else { if(n_rows == 1) { for(uword i=0; i < n_elem; ++i) { out.at(row_offset + i, col_offset + i) = P.at(0,i); } } else { for(uword i=0; i < n_elem; ++i) { out.at(row_offset + i, col_offset + i) = P.at(i,0); } } } } else // P represents a matrix { arma_conform_check_bounds ( ((row_offset > 0) && (row_offset >= n_rows)) || ((col_offset > 0) && (col_offset >= n_cols)), "diagmat(): requested diagonal out of bounds" ); out.zeros(n_rows, n_cols); const uword N = (std::min)(n_rows - row_offset, n_cols - col_offset); for(uword i=0; i struct Base_extra_yes { arma_warn_unused inline const Op i() const; //!< matrix inverse arma_warn_unused inline bool is_sympd() const; arma_warn_unused inline bool is_sympd(typename get_pod_type::result tol) const; }; template struct Base_extra_no { }; template struct Base_extra {}; template struct Base_extra { typedef Base_extra_yes result; }; template struct Base_extra { typedef Base_extra_no result; }; template struct Base_eval_Mat { arma_warn_unused arma_inline const derived& eval() const; }; template struct Base_eval_expr { arma_warn_unused inline Mat eval() const; //!< force the immediate evaluation of a delayed expression }; template struct Base_eval {}; template struct Base_eval { typedef Base_eval_Mat result; }; template struct Base_eval { typedef Base_eval_expr result; }; template struct Base_trans_cx { arma_warn_unused arma_inline const Op t() const; arma_warn_unused arma_inline const Op ht() const; arma_warn_unused arma_inline const Op st() const; // simple transpose: no complex conjugates }; template struct Base_trans_default { arma_warn_unused arma_inline const Op t() const; arma_warn_unused arma_inline const Op ht() const; arma_warn_unused arma_inline const Op st() const; // return op_htrans instead of op_strans, as it's handled better by matrix multiplication code }; template struct Base_trans {}; template struct Base_trans { typedef Base_trans_cx result; }; template struct Base_trans { typedef Base_trans_default result; }; //! Class for static polymorphism, modelled after the "Curiously Recurring Template Pattern" (CRTP). //! Used for type-safe downcasting in functions that restrict their input(s) to be classes that are //! derived from Base (eg. Mat, Op, Glue, diagview, subview). //! A Base object can be converted to a Mat object by the unwrap class. template struct Base : public Base_extra::value>::result , public Base_eval::value>::result , public Base_trans::value>::result { arma_inline const derived& get_ref() const; arma_cold inline void print( const std::string extra_text = "") const; arma_cold inline void print(std::ostream& user_stream, const std::string extra_text = "") const; arma_cold inline void raw_print( const std::string extra_text = "") const; arma_cold inline void raw_print(std::ostream& user_stream, const std::string extra_text = "") const; arma_cold inline void brief_print( const std::string extra_text = "") const; arma_cold inline void brief_print(std::ostream& user_stream, const std::string extra_text = "") const; arma_warn_unused inline elem_type min() const; arma_warn_unused inline elem_type max() const; arma_frown("use .index_min() instead") inline elem_type min(uword& index_of_min_val) const; arma_frown("use .index_max() instead") inline elem_type max(uword& index_of_max_val) const; arma_frown("use .index_min() with ind2sub() instead") inline elem_type min(uword& row_of_min_val, uword& col_of_min_val) const; arma_frown("use .index_max() with ind2sub() instead") inline elem_type max(uword& row_of_max_val, uword& col_of_max_val) const; arma_warn_unused inline uword index_min() const; arma_warn_unused inline uword index_max() const; arma_warn_unused inline bool is_symmetric() const; arma_warn_unused inline bool is_symmetric(const typename get_pod_type::result tol) const; arma_warn_unused inline bool is_hermitian() const; arma_warn_unused inline bool is_hermitian(const typename get_pod_type::result tol) const; arma_warn_unused inline bool is_zero(const typename get_pod_type::result tol = 0) const; arma_warn_unused inline bool is_trimatu() const; arma_warn_unused inline bool is_trimatl() const; arma_warn_unused inline bool is_diagmat() const; arma_warn_unused inline bool is_empty() const; arma_warn_unused inline bool is_square() const; arma_warn_unused inline bool is_vec() const; arma_warn_unused inline bool is_colvec() const; arma_warn_unused inline bool is_rowvec() const; arma_warn_unused inline bool is_finite() const; arma_warn_unused inline bool has_inf() const; arma_warn_unused inline bool has_nan() const; arma_warn_unused inline bool has_nonfinite() const; arma_warn_unused inline const Op as_col() const; arma_warn_unused inline const Op as_row() const; }; //! @} RcppArmadillo/inst/include/armadillo_bits/subview_meat.hpp0000644000176200001440000032532614770765377023635 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup subview //! @{ template inline subview::~subview() { arma_debug_sigprint_this(this); } template inline subview::subview(const Mat& in_m, const uword in_row1, const uword in_col1, const uword in_n_rows, const uword in_n_cols) : m (in_m ) , aux_row1(in_row1 ) , aux_col1(in_col1 ) , n_rows (in_n_rows) , n_cols (in_n_cols) , n_elem (in_n_rows*in_n_cols) { arma_debug_sigprint_this(this); } template inline subview::subview(const subview& in) : m (in.m ) , aux_row1(in.aux_row1) , aux_col1(in.aux_col1) , n_rows (in.n_rows ) , n_cols (in.n_cols ) , n_elem (in.n_elem ) { arma_debug_sigprint(arma_str::format("this: %x; in: %x") % this % &in); } template inline subview::subview(subview&& in) : m (in.m ) , aux_row1(in.aux_row1) , aux_col1(in.aux_col1) , n_rows (in.n_rows ) , n_cols (in.n_cols ) , n_elem (in.n_elem ) { arma_debug_sigprint(arma_str::format("this: %x; in: %x") % this % &in); // for paranoia access::rw(in.aux_row1) = 0; access::rw(in.aux_col1) = 0; access::rw(in.n_rows ) = 0; access::rw(in.n_cols ) = 0; access::rw(in.n_elem ) = 0; } template template inline void subview::inplace_op(const eT val) { arma_debug_sigprint(); subview& s = *this; const uword s_n_rows = s.n_rows; const uword s_n_cols = s.n_cols; if(s_n_rows == 1) { Mat& A = const_cast< Mat& >(s.m); const uword A_n_rows = A.n_rows; eT* Aptr = &(A.at(s.aux_row1,s.aux_col1)); uword jj; for(jj=1; jj < s_n_cols; jj+=2) { if(is_same_type::yes) { (*Aptr) += val; Aptr += A_n_rows; (*Aptr) += val; Aptr += A_n_rows; } if(is_same_type::yes) { (*Aptr) -= val; Aptr += A_n_rows; (*Aptr) -= val; Aptr += A_n_rows; } if(is_same_type::yes) { (*Aptr) *= val; Aptr += A_n_rows; (*Aptr) *= val; Aptr += A_n_rows; } if(is_same_type::yes) { (*Aptr) /= val; Aptr += A_n_rows; (*Aptr) /= val; Aptr += A_n_rows; } } if((jj-1) < s_n_cols) { if(is_same_type::yes) { (*Aptr) += val; } if(is_same_type::yes) { (*Aptr) -= val; } if(is_same_type::yes) { (*Aptr) *= val; } if(is_same_type::yes) { (*Aptr) /= val; } } } else { for(uword ucol=0; ucol < s_n_cols; ++ucol) { if(is_same_type::yes) { arrayops::inplace_plus ( colptr(ucol), val, s_n_rows ); } if(is_same_type::yes) { arrayops::inplace_minus( colptr(ucol), val, s_n_rows ); } if(is_same_type::yes) { arrayops::inplace_mul ( colptr(ucol), val, s_n_rows ); } if(is_same_type::yes) { arrayops::inplace_div ( colptr(ucol), val, s_n_rows ); } } } } template template inline void subview::inplace_op(const Base& in, const char* identifier) { arma_debug_sigprint(); const Proxy P(in.get_ref()); subview& s = *this; const uword s_n_rows = s.n_rows; const uword s_n_cols = s.n_cols; arma_conform_assert_same_size(s, P, identifier); const bool use_mp = arma_config::openmp && Proxy::use_mp && mp_gate::eval(s.n_elem); const bool has_overlap = P.has_overlap(s); if(has_overlap) { arma_debug_print("aliasing or overlap detected"); } if( (is_Mat::stored_type>::value) || (use_mp) || (has_overlap) ) { const unwrap_check::stored_type> tmp(P.Q, has_overlap); const Mat& B = tmp.M; if(s_n_rows == 1) { Mat& A = const_cast< Mat& >(m); const uword A_n_rows = A.n_rows; eT* Aptr = &(A.at(aux_row1,aux_col1)); const eT* Bptr = B.memptr(); uword jj; for(jj=1; jj < s_n_cols; jj+=2) { const eT tmp1 = (*Bptr); Bptr++; const eT tmp2 = (*Bptr); Bptr++; if(is_same_type::yes) { (*Aptr) = tmp1; Aptr += A_n_rows; (*Aptr) = tmp2; Aptr += A_n_rows; } if(is_same_type::yes) { (*Aptr) += tmp1; Aptr += A_n_rows; (*Aptr) += tmp2; Aptr += A_n_rows; } if(is_same_type::yes) { (*Aptr) -= tmp1; Aptr += A_n_rows; (*Aptr) -= tmp2; Aptr += A_n_rows; } if(is_same_type::yes) { (*Aptr) *= tmp1; Aptr += A_n_rows; (*Aptr) *= tmp2; Aptr += A_n_rows; } if(is_same_type::yes) { (*Aptr) /= tmp1; Aptr += A_n_rows; (*Aptr) /= tmp2; Aptr += A_n_rows; } } if((jj-1) < s_n_cols) { if(is_same_type::yes) { (*Aptr) = (*Bptr); } if(is_same_type::yes) { (*Aptr) += (*Bptr); } if(is_same_type::yes) { (*Aptr) -= (*Bptr); } if(is_same_type::yes) { (*Aptr) *= (*Bptr); } if(is_same_type::yes) { (*Aptr) /= (*Bptr); } } } else // not a row vector { if((s.aux_row1 == 0) && (s_n_rows == s.m.n_rows)) { if(is_same_type::yes) { arrayops::copy ( s.colptr(0), B.memptr(), s.n_elem ); } if(is_same_type::yes) { arrayops::inplace_plus ( s.colptr(0), B.memptr(), s.n_elem ); } if(is_same_type::yes) { arrayops::inplace_minus( s.colptr(0), B.memptr(), s.n_elem ); } if(is_same_type::yes) { arrayops::inplace_mul ( s.colptr(0), B.memptr(), s.n_elem ); } if(is_same_type::yes) { arrayops::inplace_div ( s.colptr(0), B.memptr(), s.n_elem ); } } else { for(uword ucol=0; ucol < s_n_cols; ++ucol) { if(is_same_type::yes) { arrayops::copy ( s.colptr(ucol), B.colptr(ucol), s_n_rows ); } if(is_same_type::yes) { arrayops::inplace_plus ( s.colptr(ucol), B.colptr(ucol), s_n_rows ); } if(is_same_type::yes) { arrayops::inplace_minus( s.colptr(ucol), B.colptr(ucol), s_n_rows ); } if(is_same_type::yes) { arrayops::inplace_mul ( s.colptr(ucol), B.colptr(ucol), s_n_rows ); } if(is_same_type::yes) { arrayops::inplace_div ( s.colptr(ucol), B.colptr(ucol), s_n_rows ); } } } } } else // use the Proxy { if(s_n_rows == 1) { Mat& A = const_cast< Mat& >(m); const uword A_n_rows = A.n_rows; eT* Aptr = &(A.at(aux_row1,aux_col1)); uword jj; for(jj=1; jj < s_n_cols; jj+=2) { const uword ii = (jj-1); const eT tmp1 = (Proxy::use_at) ? P.at(0,ii) : P[ii]; const eT tmp2 = (Proxy::use_at) ? P.at(0,jj) : P[jj]; if(is_same_type::yes) { (*Aptr) = tmp1; Aptr += A_n_rows; (*Aptr) = tmp2; Aptr += A_n_rows; } if(is_same_type::yes) { (*Aptr) += tmp1; Aptr += A_n_rows; (*Aptr) += tmp2; Aptr += A_n_rows; } if(is_same_type::yes) { (*Aptr) -= tmp1; Aptr += A_n_rows; (*Aptr) -= tmp2; Aptr += A_n_rows; } if(is_same_type::yes) { (*Aptr) *= tmp1; Aptr += A_n_rows; (*Aptr) *= tmp2; Aptr += A_n_rows; } if(is_same_type::yes) { (*Aptr) /= tmp1; Aptr += A_n_rows; (*Aptr) /= tmp2; Aptr += A_n_rows; } } const uword ii = (jj-1); if(ii < s_n_cols) { if(is_same_type::yes) { (*Aptr) = (Proxy::use_at) ? P.at(0,ii) : P[ii]; } if(is_same_type::yes) { (*Aptr) += (Proxy::use_at) ? P.at(0,ii) : P[ii]; } if(is_same_type::yes) { (*Aptr) -= (Proxy::use_at) ? P.at(0,ii) : P[ii]; } if(is_same_type::yes) { (*Aptr) *= (Proxy::use_at) ? P.at(0,ii) : P[ii]; } if(is_same_type::yes) { (*Aptr) /= (Proxy::use_at) ? P.at(0,ii) : P[ii]; } } } else // not a row vector { if(Proxy::use_at) { for(uword ucol=0; ucol < s_n_cols; ++ucol) { eT* s_col_data = s.colptr(ucol); uword jj; for(jj=1; jj < s_n_rows; jj+=2) { const uword ii = (jj-1); const eT tmp1 = P.at(ii,ucol); const eT tmp2 = P.at(jj,ucol); if(is_same_type::yes) { (*s_col_data) = tmp1; s_col_data++; (*s_col_data) = tmp2; s_col_data++; } if(is_same_type::yes) { (*s_col_data) += tmp1; s_col_data++; (*s_col_data) += tmp2; s_col_data++; } if(is_same_type::yes) { (*s_col_data) -= tmp1; s_col_data++; (*s_col_data) -= tmp2; s_col_data++; } if(is_same_type::yes) { (*s_col_data) *= tmp1; s_col_data++; (*s_col_data) *= tmp2; s_col_data++; } if(is_same_type::yes) { (*s_col_data) /= tmp1; s_col_data++; (*s_col_data) /= tmp2; s_col_data++; } } const uword ii = (jj-1); if(ii < s_n_rows) { if(is_same_type::yes) { (*s_col_data) = P.at(ii,ucol); } if(is_same_type::yes) { (*s_col_data) += P.at(ii,ucol); } if(is_same_type::yes) { (*s_col_data) -= P.at(ii,ucol); } if(is_same_type::yes) { (*s_col_data) *= P.at(ii,ucol); } if(is_same_type::yes) { (*s_col_data) /= P.at(ii,ucol); } } } } else { typename Proxy::ea_type Pea = P.get_ea(); uword count = 0; for(uword ucol=0; ucol < s_n_cols; ++ucol) { eT* s_col_data = s.colptr(ucol); uword jj; for(jj=1; jj < s_n_rows; jj+=2) { const eT tmp1 = Pea[count]; count++; const eT tmp2 = Pea[count]; count++; if(is_same_type::yes) { (*s_col_data) = tmp1; s_col_data++; (*s_col_data) = tmp2; s_col_data++; } if(is_same_type::yes) { (*s_col_data) += tmp1; s_col_data++; (*s_col_data) += tmp2; s_col_data++; } if(is_same_type::yes) { (*s_col_data) -= tmp1; s_col_data++; (*s_col_data) -= tmp2; s_col_data++; } if(is_same_type::yes) { (*s_col_data) *= tmp1; s_col_data++; (*s_col_data) *= tmp2; s_col_data++; } if(is_same_type::yes) { (*s_col_data) /= tmp1; s_col_data++; (*s_col_data) /= tmp2; s_col_data++; } } if((jj-1) < s_n_rows) { if(is_same_type::yes) { (*s_col_data) = Pea[count]; count++; } if(is_same_type::yes) { (*s_col_data) += Pea[count]; count++; } if(is_same_type::yes) { (*s_col_data) -= Pea[count]; count++; } if(is_same_type::yes) { (*s_col_data) *= Pea[count]; count++; } if(is_same_type::yes) { (*s_col_data) /= Pea[count]; count++; } } } } } } } template template inline void subview::inplace_op(const subview& x, const char* identifier) { arma_debug_sigprint(); if(check_overlap(x)) { const Mat tmp(x); if(is_same_type::yes) { (*this).operator= (tmp); } if(is_same_type::yes) { (*this).operator+=(tmp); } if(is_same_type::yes) { (*this).operator-=(tmp); } if(is_same_type::yes) { (*this).operator%=(tmp); } if(is_same_type::yes) { (*this).operator/=(tmp); } return; } subview& s = *this; arma_conform_assert_same_size(s, x, identifier); const uword s_n_cols = s.n_cols; const uword s_n_rows = s.n_rows; if(s_n_rows == 1) { Mat& A = const_cast< Mat& >(s.m); const Mat& B = x.m; const uword A_n_rows = A.n_rows; const uword B_n_rows = B.n_rows; eT* Aptr = &(A.at(s.aux_row1,s.aux_col1)); const eT* Bptr = &(B.at(x.aux_row1,x.aux_col1)); uword jj; for(jj=1; jj < s_n_cols; jj+=2) { const eT tmp1 = (*Bptr); Bptr += B_n_rows; const eT tmp2 = (*Bptr); Bptr += B_n_rows; if(is_same_type::yes) { (*Aptr) = tmp1; Aptr += A_n_rows; (*Aptr) = tmp2; Aptr += A_n_rows; } if(is_same_type::yes) { (*Aptr) += tmp1; Aptr += A_n_rows; (*Aptr) += tmp2; Aptr += A_n_rows; } if(is_same_type::yes) { (*Aptr) -= tmp1; Aptr += A_n_rows; (*Aptr) -= tmp2; Aptr += A_n_rows; } if(is_same_type::yes) { (*Aptr) *= tmp1; Aptr += A_n_rows; (*Aptr) *= tmp2; Aptr += A_n_rows; } if(is_same_type::yes) { (*Aptr) /= tmp1; Aptr += A_n_rows; (*Aptr) /= tmp2; Aptr += A_n_rows; } } if((jj-1) < s_n_cols) { if(is_same_type::yes) { (*Aptr) = (*Bptr); } if(is_same_type::yes) { (*Aptr) += (*Bptr); } if(is_same_type::yes) { (*Aptr) -= (*Bptr); } if(is_same_type::yes) { (*Aptr) *= (*Bptr); } if(is_same_type::yes) { (*Aptr) /= (*Bptr); } } } else { for(uword ucol=0; ucol < s_n_cols; ++ucol) { if(is_same_type::yes) { arrayops::copy ( s.colptr(ucol), x.colptr(ucol), s_n_rows ); } if(is_same_type::yes) { arrayops::inplace_plus ( s.colptr(ucol), x.colptr(ucol), s_n_rows ); } if(is_same_type::yes) { arrayops::inplace_minus( s.colptr(ucol), x.colptr(ucol), s_n_rows ); } if(is_same_type::yes) { arrayops::inplace_mul ( s.colptr(ucol), x.colptr(ucol), s_n_rows ); } if(is_same_type::yes) { arrayops::inplace_div ( s.colptr(ucol), x.colptr(ucol), s_n_rows ); } } } } template inline void subview::operator= (const eT val) { arma_debug_sigprint(); if(n_elem != 1) { arma_conform_assert_same_size(n_rows, n_cols, 1, 1, "copy into submatrix"); } Mat& X = const_cast< Mat& >(m); X.at(aux_row1, aux_col1) = val; } template inline void subview::operator+= (const eT val) { arma_debug_sigprint(); inplace_op(val); } template inline void subview::operator-= (const eT val) { arma_debug_sigprint(); inplace_op(val); } template inline void subview::operator*= (const eT val) { arma_debug_sigprint(); inplace_op(val); } template inline void subview::operator/= (const eT val) { arma_debug_sigprint(); inplace_op(val); } template inline void subview::operator= (const subview& x) { arma_debug_sigprint(); inplace_op(x, "copy into submatrix"); } template inline void subview::operator+= (const subview& x) { arma_debug_sigprint(); inplace_op(x, "addition"); } template inline void subview::operator-= (const subview& x) { arma_debug_sigprint(); inplace_op(x, "subtraction"); } template inline void subview::operator%= (const subview& x) { arma_debug_sigprint(); inplace_op(x, "element-wise multiplication"); } template inline void subview::operator/= (const subview& x) { arma_debug_sigprint(); inplace_op(x, "element-wise division"); } template template inline void subview::operator= (const Base& in) { arma_debug_sigprint(); inplace_op(in, "copy into submatrix"); } template template inline void subview::operator+= (const Base& in) { arma_debug_sigprint(); inplace_op(in, "addition"); } template template inline void subview::operator-= (const Base& in) { arma_debug_sigprint(); inplace_op(in, "subtraction"); } template template inline void subview::operator%= (const Base& in) { arma_debug_sigprint(); inplace_op(in, "element-wise multiplication"); } template template inline void subview::operator/= (const Base& in) { arma_debug_sigprint(); inplace_op(in, "element-wise division"); } template template inline void subview::operator=(const SpBase& x) { arma_debug_sigprint(); const SpProxy p(x.get_ref()); arma_conform_assert_same_size(n_rows, n_cols, p.get_n_rows(), p.get_n_cols(), "copy into submatrix"); // Clear the subview. zeros(); // Iterate through the sparse subview and set the nonzero values appropriately. typename SpProxy::const_iterator_type cit = p.begin(); typename SpProxy::const_iterator_type cit_end = p.end(); while(cit != cit_end) { at(cit.row(), cit.col()) = *cit; ++cit; } } template template inline void subview::operator+=(const SpBase& x) { arma_debug_sigprint(); const SpProxy p(x.get_ref()); arma_conform_assert_same_size(n_rows, n_cols, p.get_n_rows(), p.get_n_cols(), "addition"); // Iterate through the sparse subview and add its values. typename SpProxy::const_iterator_type cit = p.begin(); typename SpProxy::const_iterator_type cit_end = p.end(); while(cit != cit_end) { at(cit.row(), cit.col()) += *cit; ++cit; } } template template inline void subview::operator-=(const SpBase& x) { arma_debug_sigprint(); const SpProxy p(x.get_ref()); arma_conform_assert_same_size(n_rows, n_cols, p.get_n_rows(), p.get_n_cols(), "subtraction"); // Iterate through the sparse subview and subtract its values. typename SpProxy::const_iterator_type cit = p.begin(); typename SpProxy::const_iterator_type cit_end = p.end(); while(cit != cit_end) { at(cit.row(), cit.col()) -= *cit; ++cit; } } template template inline void subview::operator%=(const SpBase& x) { arma_debug_sigprint(); const uword s_n_rows = (*this).n_rows; const uword s_n_cols = (*this).n_cols; const SpProxy p(x.get_ref()); arma_conform_assert_same_size(s_n_rows, s_n_cols, p.get_n_rows(), p.get_n_cols(), "element-wise multiplication"); if(n_elem == 0) { return; } if(p.get_n_nonzero() == 0) { (*this).zeros(); return; } // Iterate over nonzero values. // Any zero values in the sparse expression will result in a zero in our subview. typename SpProxy::const_iterator_type cit = p.begin(); typename SpProxy::const_iterator_type cit_end = p.end(); uword r = 0; uword c = 0; while(cit != cit_end) { const uword cit_row = cit.row(); const uword cit_col = cit.col(); while( ((r == cit_row) && (c == cit_col)) == false ) { at(r,c) = eT(0); r++; if(r >= s_n_rows) { r = 0; c++; } } at(r, c) *= (*cit); ++cit; r++; if(r >= s_n_rows) { r = 0; c++; } } } template template inline void subview::operator/=(const SpBase& x) { arma_debug_sigprint(); const SpProxy p(x.get_ref()); arma_conform_assert_same_size(n_rows, n_cols, p.get_n_rows(), p.get_n_cols(), "element-wise division"); // This is probably going to fill your subview with a bunch of NaNs, // so I'm not going to bother to implement it fast. // You can have slow NaNs. They're fine too. for(uword c = 0; c < n_cols; ++c) for(uword r = 0; r < n_rows; ++r) { at(r, c) /= p.at(r, c); } } template template inline typename enable_if2< is_same_type::value, void>::result subview::operator= (const Gen& in) { arma_debug_sigprint(); arma_conform_assert_same_size(n_rows, n_cols, in.n_rows, in.n_cols, "copy into submatrix"); in.apply(*this); } template inline void subview::operator=(const std::initializer_list& list) { arma_debug_sigprint(); arma_conform_check( (is_vec() == false), "copy into submatrix: size mismatch" ); const uword N = uword(list.size()); if(n_rows == 1) { arma_conform_assert_same_size(1, n_cols, 1, N, "copy into submatrix"); auto it = list.begin(); for(uword ii=0; ii < N; ++ii) { (*this).at(0,ii) = (*it); ++it; } } else if(n_cols == 1) { arma_conform_assert_same_size(n_rows, 1, N, 1, "copy into submatrix"); arrayops::copy( (*this).colptr(0), list.begin(), N ); } } template inline void subview::operator=(const std::initializer_list< std::initializer_list >& list) { arma_debug_sigprint(); const Mat tmp(list); (*this).operator=(tmp); } //! apply a functor to each element template template inline void subview::for_each(functor F) { arma_debug_sigprint(); Mat& X = const_cast< Mat& >(m); if(n_rows == 1) { const uword urow = aux_row1; const uword start_col = aux_col1; const uword end_col_plus1 = start_col + n_cols; for(uword ucol = start_col; ucol < end_col_plus1; ++ucol) { F( X.at(urow, ucol) ); } } else { const uword start_col = aux_col1; const uword start_row = aux_row1; const uword end_col_plus1 = start_col + n_cols; const uword end_row_plus1 = start_row + n_rows; for(uword ucol = start_col; ucol < end_col_plus1; ++ucol) for(uword urow = start_row; urow < end_row_plus1; ++urow) { F( X.at(urow, ucol) ); } } } template template inline void subview::for_each(functor F) const { arma_debug_sigprint(); const Mat& X = m; if(n_rows == 1) { const uword urow = aux_row1; const uword start_col = aux_col1; const uword end_col_plus1 = start_col + n_cols; for(uword ucol = start_col; ucol < end_col_plus1; ++ucol) { F( X.at(urow, ucol) ); } } else { const uword start_col = aux_col1; const uword start_row = aux_row1; const uword end_col_plus1 = start_col + n_cols; const uword end_row_plus1 = start_row + n_rows; for(uword ucol = start_col; ucol < end_col_plus1; ++ucol) for(uword urow = start_row; urow < end_row_plus1; ++urow) { F( X.at(urow, ucol) ); } } } //! transform each element in the subview using a functor template template inline void subview::transform(functor F) { arma_debug_sigprint(); Mat& X = const_cast< Mat& >(m); if(n_rows == 1) { const uword urow = aux_row1; const uword start_col = aux_col1; const uword end_col_plus1 = start_col + n_cols; for(uword ucol = start_col; ucol < end_col_plus1; ++ucol) { X.at(urow, ucol) = eT( F( X.at(urow, ucol) ) ); } } else { const uword start_col = aux_col1; const uword start_row = aux_row1; const uword end_col_plus1 = start_col + n_cols; const uword end_row_plus1 = start_row + n_rows; for(uword ucol = start_col; ucol < end_col_plus1; ++ucol) for(uword urow = start_row; urow < end_row_plus1; ++urow) { X.at(urow, ucol) = eT( F( X.at(urow, ucol) ) ); } } } //! imbue (fill) the subview with values provided by a functor template template inline void subview::imbue(functor F) { arma_debug_sigprint(); Mat& X = const_cast< Mat& >(m); if(n_rows == 1) { const uword urow = aux_row1; const uword start_col = aux_col1; const uword end_col_plus1 = start_col + n_cols; for(uword ucol = start_col; ucol < end_col_plus1; ++ucol) { X.at(urow, ucol) = eT( F() ); } } else { const uword start_col = aux_col1; const uword start_row = aux_row1; const uword end_col_plus1 = start_col + n_cols; const uword end_row_plus1 = start_row + n_rows; for(uword ucol = start_col; ucol < end_col_plus1; ++ucol) for(uword urow = start_row; urow < end_row_plus1; ++urow) { X.at(urow, ucol) = eT( F() ); } } } template inline void subview::replace(const eT old_val, const eT new_val) { arma_debug_sigprint(); subview& s = *this; const uword s_n_cols = s.n_cols; const uword s_n_rows = s.n_rows; if(s_n_rows == 1) { Mat& A = const_cast< Mat& >(s.m); const uword A_n_rows = A.n_rows; eT* Aptr = &(A.at(s.aux_row1,s.aux_col1)); if(arma_isnan(old_val)) { for(uword ucol=0; ucol < s_n_cols; ++ucol) { (*Aptr) = (arma_isnan(*Aptr)) ? new_val : (*Aptr); Aptr += A_n_rows; } } else { for(uword ucol=0; ucol < s_n_cols; ++ucol) { (*Aptr) = ((*Aptr) == old_val) ? new_val : (*Aptr); Aptr += A_n_rows; } } } else { for(uword ucol=0; ucol < s_n_cols; ++ucol) { arrayops::replace(s.colptr(ucol), s_n_rows, old_val, new_val); } } } template inline void subview::clean(const typename get_pod_type::result threshold) { arma_debug_sigprint(); subview& s = *this; const uword s_n_cols = s.n_cols; const uword s_n_rows = s.n_rows; for(uword ucol=0; ucol < s_n_cols; ++ucol) { arrayops::clean( s.colptr(ucol), s_n_rows, threshold ); } } template inline void subview::clamp(const eT min_val, const eT max_val) { arma_debug_sigprint(); if(is_cx::no) { arma_conform_check( (access::tmp_real(min_val) > access::tmp_real(max_val)), "subview::clamp(): min_val must be less than max_val" ); } else { arma_conform_check( (access::tmp_real(min_val) > access::tmp_real(max_val)), "subview::clamp(): real(min_val) must be less than real(max_val)" ); arma_conform_check( (access::tmp_imag(min_val) > access::tmp_imag(max_val)), "subview::clamp(): imag(min_val) must be less than imag(max_val)" ); } subview& s = *this; const uword s_n_cols = s.n_cols; const uword s_n_rows = s.n_rows; for(uword ucol=0; ucol < s_n_cols; ++ucol) { arrayops::clamp( s.colptr(ucol), s_n_rows, min_val, max_val ); } } template inline void subview::fill(const eT val) { arma_debug_sigprint(); subview& s = *this; const uword s_n_cols = s.n_cols; const uword s_n_rows = s.n_rows; if(s_n_rows == 1) { Mat& A = const_cast< Mat& >(s.m); const uword A_n_rows = A.n_rows; eT* Aptr = &(A.at(s.aux_row1,s.aux_col1)); uword jj; for(jj=1; jj < s_n_cols; jj+=2) { (*Aptr) = val; Aptr += A_n_rows; (*Aptr) = val; Aptr += A_n_rows; } if((jj-1) < s_n_cols) { (*Aptr) = val; } } else { if( (s.aux_row1 == 0) && (s_n_rows == s.m.n_rows) ) { arrayops::inplace_set( s.colptr(0), val, s.n_elem ); } else { for(uword ucol=0; ucol < s_n_cols; ++ucol) { arrayops::inplace_set( s.colptr(ucol), val, s_n_rows ); } } } } template inline void subview::zeros() { arma_debug_sigprint(); (*this).fill(eT(0)); } template inline void subview::ones() { arma_debug_sigprint(); (*this).fill(eT(1)); } template inline void subview::eye() { arma_debug_sigprint(); (*this).zeros(); const uword N = (std::min)(n_rows, n_cols); for(uword ii=0; ii < N; ++ii) { at(ii,ii) = eT(1); } } template inline void subview::randu() { arma_debug_sigprint(); subview& s = (*this); const uword s_n_rows = s.n_rows; const uword s_n_cols = s.n_cols; if(s_n_rows == 1) { podarray tmp(s_n_cols); eT* tmp_mem = tmp.memptr(); arma_rng::randu::fill( tmp_mem, s_n_cols ); for(uword ii=0; ii < s_n_cols; ++ii) { at(0,ii) = tmp_mem[ii]; } } else { if( (s.aux_row1 == 0) && (s_n_rows == s.m.n_rows) ) { arma_rng::randu::fill( s.colptr(0), s.n_elem ); } else { for(uword ii=0; ii < s_n_cols; ++ii) { arma_rng::randu::fill( s.colptr(ii), s_n_rows ); } } } } template inline void subview::randn() { arma_debug_sigprint(); subview& s = (*this); const uword s_n_rows = s.n_rows; const uword s_n_cols = s.n_cols; if(s_n_rows == 1) { podarray tmp(s_n_cols); eT* tmp_mem = tmp.memptr(); arma_rng::randn::fill( tmp_mem, s_n_cols ); for(uword ii=0; ii < s_n_cols; ++ii) { at(0,ii) = tmp_mem[ii]; } } else { if( (s.aux_row1 == 0) && (s_n_rows == s.m.n_rows) ) { arma_rng::randn::fill( s.colptr(0), s.n_elem ); } else { for(uword ii=0; ii < s_n_cols; ++ii) { arma_rng::randn::fill( s.colptr(ii), s_n_rows ); } } } } template inline eT subview::at_alt(const uword ii) const { return operator[](ii); } template inline eT& subview::operator[](const uword ii) { const uword in_col = ii / n_rows; const uword in_row = ii % n_rows; const uword index = (in_col + aux_col1)*m.n_rows + aux_row1 + in_row; return access::rw( (const_cast< Mat& >(m)).mem[index] ); } template inline eT subview::operator[](const uword ii) const { const uword in_col = ii / n_rows; const uword in_row = ii % n_rows; const uword index = (in_col + aux_col1)*m.n_rows + aux_row1 + in_row; return m.mem[index]; } template inline eT& subview::operator()(const uword ii) { arma_conform_check_bounds( (ii >= n_elem), "subview::operator(): index out of bounds" ); const uword in_col = ii / n_rows; const uword in_row = ii % n_rows; const uword index = (in_col + aux_col1)*m.n_rows + aux_row1 + in_row; return access::rw( (const_cast< Mat& >(m)).mem[index] ); } template inline eT subview::operator()(const uword ii) const { arma_conform_check_bounds( (ii >= n_elem), "subview::operator(): index out of bounds" ); const uword in_col = ii / n_rows; const uword in_row = ii % n_rows; const uword index = (in_col + aux_col1)*m.n_rows + aux_row1 + in_row; return m.mem[index]; } template inline eT& subview::operator()(const uword in_row, const uword in_col) { arma_conform_check_bounds( ((in_row >= n_rows) || (in_col >= n_cols)), "subview::operator(): index out of bounds" ); const uword index = (in_col + aux_col1)*m.n_rows + aux_row1 + in_row; return access::rw( (const_cast< Mat& >(m)).mem[index] ); } template inline eT subview::operator()(const uword in_row, const uword in_col) const { arma_conform_check_bounds( ((in_row >= n_rows) || (in_col >= n_cols)), "subview::operator(): index out of bounds" ); const uword index = (in_col + aux_col1)*m.n_rows + aux_row1 + in_row; return m.mem[index]; } template inline eT& subview::at(const uword in_row, const uword in_col) { const uword index = (in_col + aux_col1)*m.n_rows + aux_row1 + in_row; return access::rw( (const_cast< Mat& >(m)).mem[index] ); } template inline eT subview::at(const uword in_row, const uword in_col) const { const uword index = (in_col + aux_col1)*m.n_rows + aux_row1 + in_row; return m.mem[index]; } template inline eT& subview::front() { const uword index = aux_col1*m.n_rows + aux_row1; return access::rw( (const_cast< Mat& >(m)).mem[index] ); } template inline eT subview::front() const { const uword index = aux_col1*m.n_rows + aux_row1; return m.mem[index]; } template inline eT& subview::back() { const uword in_row = n_rows - 1; const uword in_col = n_cols - 1; const uword index = (in_col + aux_col1)*m.n_rows + aux_row1 + in_row; return access::rw( (const_cast< Mat& >(m)).mem[index] ); } template inline eT subview::back() const { const uword in_row = n_rows - 1; const uword in_col = n_cols - 1; const uword index = (in_col + aux_col1)*m.n_rows + aux_row1 + in_row; return m.mem[index]; } template arma_inline eT* subview::colptr(const uword in_col) { return & access::rw((const_cast< Mat& >(m)).mem[ (in_col + aux_col1)*m.n_rows + aux_row1 ]); } template arma_inline const eT* subview::colptr(const uword in_col) const { return & m.mem[ (in_col + aux_col1)*m.n_rows + aux_row1 ]; } template template inline bool subview::check_overlap(const subview& x) const { if(is_same_type::value == false) { return false; } const subview& s = (*this); if(void_ptr(&(s.m)) != void_ptr(&(x.m))) { return false; } if( (s.n_elem == 0) || (x.n_elem == 0) ) { return false; } const uword s_row_start = s.aux_row1; const uword s_row_end_p1 = s_row_start + s.n_rows; const uword s_col_start = s.aux_col1; const uword s_col_end_p1 = s_col_start + s.n_cols; const uword x_row_start = x.aux_row1; const uword x_row_end_p1 = x_row_start + x.n_rows; const uword x_col_start = x.aux_col1; const uword x_col_end_p1 = x_col_start + x.n_cols; const bool outside_rows = ( (x_row_start >= s_row_end_p1) || (s_row_start >= x_row_end_p1) ); const bool outside_cols = ( (x_col_start >= s_col_end_p1) || (s_col_start >= x_col_end_p1) ); return ( (outside_rows == false) && (outside_cols == false) ); } template inline bool subview::is_vec() const { return ( (n_rows == 1) || (n_cols == 1) ); } template inline bool subview::is_finite() const { arma_debug_sigprint(); if(arma_config::fast_math_warn) { arma_warn(1, "is_finite(): detection of non-finite values is not reliable in fast math mode"); } const uword local_n_rows = n_rows; const uword local_n_cols = n_cols; for(uword ii=0; ii inline bool subview::is_zero(const typename get_pod_type::result tol) const { arma_debug_sigprint(); const uword local_n_rows = n_rows; const uword local_n_cols = n_cols; for(uword ii=0; ii inline bool subview::has_inf() const { arma_debug_sigprint(); if(arma_config::fast_math_warn) { arma_warn(1, "has_inf(): detection of non-finite values is not reliable in fast math mode"); } const uword local_n_rows = n_rows; const uword local_n_cols = n_cols; for(uword ii=0; ii inline bool subview::has_nan() const { arma_debug_sigprint(); if(arma_config::fast_math_warn) { arma_warn(1, "has_nan(): detection of non-finite values is not reliable in fast math mode"); } const uword local_n_rows = n_rows; const uword local_n_cols = n_cols; for(uword ii=0; ii inline bool subview::has_nonfinite() const { arma_debug_sigprint(); if(arma_config::fast_math_warn) { arma_warn(1, "has_nonfinite(): detection of non-finite values is not reliable in fast math mode"); } const uword local_n_rows = n_rows; const uword local_n_cols = n_cols; for(uword ii=0; ii inline void subview::extract(Mat& out, const subview& in) { arma_debug_sigprint(); // NOTE: we're assuming that the matrix has already been set to the correct size and there is no aliasing; // size setting and alias checking is done by either the Mat constructor or operator=() const uword n_rows = in.n_rows; // number of rows in the subview const uword n_cols = in.n_cols; // number of columns in the subview arma_debug_print(arma_str::format("out.n_rows: %u; out.n_cols: %u; in.m.n_rows: %u; in.m.n_cols: %u") % out.n_rows % out.n_cols % in.m.n_rows % in.m.n_cols ); if(in.is_vec()) { if(n_cols == 1) // a column vector { arma_debug_print("subview::extract(): copying col"); // in.colptr(0) is the first column of the subview, taking into account any row offset arrayops::copy( out.memptr(), in.colptr(0), n_rows ); } else if(n_rows == 1) // a row vector { arma_debug_print("subview::extract(): copying row)"); eT* out_mem = out.memptr(); const uword X_n_rows = in.m.n_rows; const eT* Xptr = &(in.m.at(in.aux_row1,in.aux_col1)); uword j; for(j=1; j < n_cols; j+=2) { const eT tmp1 = (*Xptr); Xptr += X_n_rows; const eT tmp2 = (*Xptr); Xptr += X_n_rows; (*out_mem) = tmp1; out_mem++; (*out_mem) = tmp2; out_mem++; } if((j-1) < n_cols) { (*out_mem) = (*Xptr); } } } else // general submatrix { arma_debug_print("subview::extract(): general submatrix"); if( (in.aux_row1 == 0) && (n_rows == in.m.n_rows) ) { arrayops::copy( out.memptr(), in.colptr(0), in.n_elem ); } else { for(uword col=0; col < n_cols; ++col) { arrayops::copy( out.colptr(col), in.colptr(col), n_rows ); } } } } //! X += Y.submat(...) template inline void subview::plus_inplace(Mat& out, const subview& in) { arma_debug_sigprint(); arma_conform_assert_same_size(out, in, "addition"); const uword n_rows = in.n_rows; const uword n_cols = in.n_cols; if(n_rows == 1) { eT* out_mem = out.memptr(); const Mat& X = in.m; const uword row = in.aux_row1; const uword start_col = in.aux_col1; uword i,j; for(i=0, j=1; j < n_cols; i+=2, j+=2) { const eT tmp1 = X.at(row, start_col+i); const eT tmp2 = X.at(row, start_col+j); out_mem[i] += tmp1; out_mem[j] += tmp2; } if(i < n_cols) { out_mem[i] += X.at(row, start_col+i); } } else { for(uword col=0; col < n_cols; ++col) { arrayops::inplace_plus(out.colptr(col), in.colptr(col), n_rows); } } } //! X -= Y.submat(...) template inline void subview::minus_inplace(Mat& out, const subview& in) { arma_debug_sigprint(); arma_conform_assert_same_size(out, in, "subtraction"); const uword n_rows = in.n_rows; const uword n_cols = in.n_cols; if(n_rows == 1) { eT* out_mem = out.memptr(); const Mat& X = in.m; const uword row = in.aux_row1; const uword start_col = in.aux_col1; uword i,j; for(i=0, j=1; j < n_cols; i+=2, j+=2) { const eT tmp1 = X.at(row, start_col+i); const eT tmp2 = X.at(row, start_col+j); out_mem[i] -= tmp1; out_mem[j] -= tmp2; } if(i < n_cols) { out_mem[i] -= X.at(row, start_col+i); } } else { for(uword col=0; col < n_cols; ++col) { arrayops::inplace_minus(out.colptr(col), in.colptr(col), n_rows); } } } //! X %= Y.submat(...) template inline void subview::schur_inplace(Mat& out, const subview& in) { arma_debug_sigprint(); arma_conform_assert_same_size(out, in, "element-wise multiplication"); const uword n_rows = in.n_rows; const uword n_cols = in.n_cols; if(n_rows == 1) { eT* out_mem = out.memptr(); const Mat& X = in.m; const uword row = in.aux_row1; const uword start_col = in.aux_col1; uword i,j; for(i=0, j=1; j < n_cols; i+=2, j+=2) { const eT tmp1 = X.at(row, start_col+i); const eT tmp2 = X.at(row, start_col+j); out_mem[i] *= tmp1; out_mem[j] *= tmp2; } if(i < n_cols) { out_mem[i] *= X.at(row, start_col+i); } } else { for(uword col=0; col < n_cols; ++col) { arrayops::inplace_mul(out.colptr(col), in.colptr(col), n_rows); } } } //! X /= Y.submat(...) template inline void subview::div_inplace(Mat& out, const subview& in) { arma_debug_sigprint(); arma_conform_assert_same_size(out, in, "element-wise division"); const uword n_rows = in.n_rows; const uword n_cols = in.n_cols; if(n_rows == 1) { eT* out_mem = out.memptr(); const Mat& X = in.m; const uword row = in.aux_row1; const uword start_col = in.aux_col1; uword i,j; for(i=0, j=1; j < n_cols; i+=2, j+=2) { const eT tmp1 = X.at(row, start_col+i); const eT tmp2 = X.at(row, start_col+j); out_mem[i] /= tmp1; out_mem[j] /= tmp2; } if(i < n_cols) { out_mem[i] /= X.at(row, start_col+i); } } else { for(uword col=0; col < n_cols; ++col) { arrayops::inplace_div(out.colptr(col), in.colptr(col), n_rows); } } } //! creation of subview (row vector) template inline subview_row subview::row(const uword row_num) { arma_debug_sigprint(); arma_conform_check_bounds( row_num >= n_rows, "subview::row(): out of bounds" ); const uword base_row = aux_row1 + row_num; return subview_row(m, base_row, aux_col1, n_cols); } //! creation of subview (row vector) template inline const subview_row subview::row(const uword row_num) const { arma_debug_sigprint(); arma_conform_check_bounds( row_num >= n_rows, "subview::row(): out of bounds" ); const uword base_row = aux_row1 + row_num; return subview_row(m, base_row, aux_col1, n_cols); } template inline subview_row subview::operator()(const uword row_num, const span& col_span) { arma_debug_sigprint(); const bool col_all = col_span.whole; const uword local_n_cols = n_cols; const uword in_col1 = col_all ? 0 : col_span.a; const uword in_col2 = col_span.b; const uword submat_n_cols = col_all ? local_n_cols : in_col2 - in_col1 + 1; const uword base_col1 = aux_col1 + in_col1; const uword base_row = aux_row1 + row_num; arma_conform_check_bounds ( (row_num >= n_rows) || ( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= local_n_cols)) ) , "subview::operator(): indices out of bounds or incorrectly used" ); return subview_row(m, base_row, base_col1, submat_n_cols); } template inline const subview_row subview::operator()(const uword row_num, const span& col_span) const { arma_debug_sigprint(); const bool col_all = col_span.whole; const uword local_n_cols = n_cols; const uword in_col1 = col_all ? 0 : col_span.a; const uword in_col2 = col_span.b; const uword submat_n_cols = col_all ? local_n_cols : in_col2 - in_col1 + 1; const uword base_col1 = aux_col1 + in_col1; const uword base_row = aux_row1 + row_num; arma_conform_check_bounds ( (row_num >= n_rows) || ( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= local_n_cols)) ) , "subview::operator(): indices out of bounds or incorrectly used" ); return subview_row(m, base_row, base_col1, submat_n_cols); } //! creation of subview (column vector) template inline subview_col subview::col(const uword col_num) { arma_debug_sigprint(); arma_conform_check_bounds( col_num >= n_cols, "subview::col(): out of bounds" ); const uword base_col = aux_col1 + col_num; return subview_col(m, base_col, aux_row1, n_rows); } //! creation of subview (column vector) template inline const subview_col subview::col(const uword col_num) const { arma_debug_sigprint(); arma_conform_check_bounds( col_num >= n_cols, "subview::col(): out of bounds" ); const uword base_col = aux_col1 + col_num; return subview_col(m, base_col, aux_row1, n_rows); } template inline subview_col subview::operator()(const span& row_span, const uword col_num) { arma_debug_sigprint(); const bool row_all = row_span.whole; const uword local_n_rows = n_rows; const uword in_row1 = row_all ? 0 : row_span.a; const uword in_row2 = row_span.b; const uword submat_n_rows = row_all ? local_n_rows : in_row2 - in_row1 + 1; const uword base_row1 = aux_row1 + in_row1; const uword base_col = aux_col1 + col_num; arma_conform_check_bounds ( (col_num >= n_cols) || ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows)) ) , "subview::operator(): indices out of bounds or incorrectly used" ); return subview_col(m, base_col, base_row1, submat_n_rows); } template inline const subview_col subview::operator()(const span& row_span, const uword col_num) const { arma_debug_sigprint(); const bool row_all = row_span.whole; const uword local_n_rows = n_rows; const uword in_row1 = row_all ? 0 : row_span.a; const uword in_row2 = row_span.b; const uword submat_n_rows = row_all ? local_n_rows : in_row2 - in_row1 + 1; const uword base_row1 = aux_row1 + in_row1; const uword base_col = aux_col1 + col_num; arma_conform_check_bounds ( (col_num >= n_cols) || ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows)) ) , "subview::operator(): indices out of bounds or incorrectly used" ); return subview_col(m, base_col, base_row1, submat_n_rows); } //! create a Col object which uses memory from an existing matrix object. //! this approach is currently not alias safe //! and does not take into account that the parent matrix object could be deleted. //! if deleted memory is accessed by the created Col object, //! it will cause memory corruption and/or a crash template inline Col subview::unsafe_col(const uword col_num) { arma_debug_sigprint(); arma_conform_check_bounds( col_num >= n_cols, "subview::unsafe_col(): out of bounds" ); return Col(colptr(col_num), n_rows, false, true); } //! create a Col object which uses memory from an existing matrix object. //! this approach is currently not alias safe //! and does not take into account that the parent matrix object could be deleted. //! if deleted memory is accessed by the created Col object, //! it will cause memory corruption and/or a crash template inline const Col subview::unsafe_col(const uword col_num) const { arma_debug_sigprint(); arma_conform_check_bounds( col_num >= n_cols, "subview::unsafe_col(): out of bounds" ); return Col(const_cast(colptr(col_num)), n_rows, false, true); } //! creation of subview (submatrix comprised of specified row vectors) template inline subview subview::rows(const uword in_row1, const uword in_row2) { arma_debug_sigprint(); arma_conform_check_bounds ( (in_row1 > in_row2) || (in_row2 >= n_rows), "subview::rows(): indices out of bounds or incorrectly used" ); const uword subview_n_rows = in_row2 - in_row1 + 1; const uword base_row1 = aux_row1 + in_row1; return subview(m, base_row1, aux_col1, subview_n_rows, n_cols ); } //! creation of subview (submatrix comprised of specified row vectors) template inline const subview subview::rows(const uword in_row1, const uword in_row2) const { arma_debug_sigprint(); arma_conform_check_bounds ( (in_row1 > in_row2) || (in_row2 >= n_rows), "subview::rows(): indices out of bounds or incorrectly used" ); const uword subview_n_rows = in_row2 - in_row1 + 1; const uword base_row1 = aux_row1 + in_row1; return subview(m, base_row1, aux_col1, subview_n_rows, n_cols ); } //! creation of subview (submatrix comprised of specified column vectors) template inline subview subview::cols(const uword in_col1, const uword in_col2) { arma_debug_sigprint(); arma_conform_check_bounds ( (in_col1 > in_col2) || (in_col2 >= n_cols), "subview::cols(): indices out of bounds or incorrectly used" ); const uword subview_n_cols = in_col2 - in_col1 + 1; const uword base_col1 = aux_col1 + in_col1; return subview(m, aux_row1, base_col1, n_rows, subview_n_cols); } //! creation of subview (submatrix comprised of specified column vectors) template inline const subview subview::cols(const uword in_col1, const uword in_col2) const { arma_debug_sigprint(); arma_conform_check_bounds ( (in_col1 > in_col2) || (in_col2 >= n_cols), "subview::cols(): indices out of bounds or incorrectly used" ); const uword subview_n_cols = in_col2 - in_col1 + 1; const uword base_col1 = aux_col1 + in_col1; return subview(m, aux_row1, base_col1, n_rows, subview_n_cols); } //! creation of subview (submatrix) template inline subview subview::submat(const uword in_row1, const uword in_col1, const uword in_row2, const uword in_col2) { arma_debug_sigprint(); arma_conform_check_bounds ( (in_row1 > in_row2) || (in_col1 > in_col2) || (in_row2 >= n_rows) || (in_col2 >= n_cols), "subview::submat(): indices out of bounds or incorrectly used" ); const uword subview_n_rows = in_row2 - in_row1 + 1; const uword subview_n_cols = in_col2 - in_col1 + 1; const uword base_row1 = aux_row1 + in_row1; const uword base_col1 = aux_col1 + in_col1; return subview(m, base_row1, base_col1, subview_n_rows, subview_n_cols); } //! creation of subview (generic submatrix) template inline const subview subview::submat(const uword in_row1, const uword in_col1, const uword in_row2, const uword in_col2) const { arma_debug_sigprint(); arma_conform_check_bounds ( (in_row1 > in_row2) || (in_col1 > in_col2) || (in_row2 >= n_rows) || (in_col2 >= n_cols), "subview::submat(): indices out of bounds or incorrectly used" ); const uword subview_n_rows = in_row2 - in_row1 + 1; const uword subview_n_cols = in_col2 - in_col1 + 1; const uword base_row1 = aux_row1 + in_row1; const uword base_col1 = aux_col1 + in_col1; return subview(m, base_row1, base_col1, subview_n_rows, subview_n_cols); } //! creation of subview (submatrix) template inline subview subview::submat(const span& row_span, const span& col_span) { arma_debug_sigprint(); const bool row_all = row_span.whole; const bool col_all = col_span.whole; const uword local_n_rows = n_rows; const uword local_n_cols = n_cols; const uword in_row1 = row_all ? 0 : row_span.a; const uword in_row2 = row_span.b; const uword submat_n_rows = row_all ? local_n_rows : in_row2 - in_row1 + 1; const uword in_col1 = col_all ? 0 : col_span.a; const uword in_col2 = col_span.b; const uword submat_n_cols = col_all ? local_n_cols : in_col2 - in_col1 + 1; arma_conform_check_bounds ( ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows)) ) || ( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= local_n_cols)) ) , "subview::submat(): indices out of bounds or incorrectly used" ); const uword base_row1 = aux_row1 + in_row1; const uword base_col1 = aux_col1 + in_col1; return subview(m, base_row1, base_col1, submat_n_rows, submat_n_cols); } //! creation of subview (generic submatrix) template inline const subview subview::submat(const span& row_span, const span& col_span) const { arma_debug_sigprint(); const bool row_all = row_span.whole; const bool col_all = col_span.whole; const uword local_n_rows = n_rows; const uword local_n_cols = n_cols; const uword in_row1 = row_all ? 0 : row_span.a; const uword in_row2 = row_span.b; const uword submat_n_rows = row_all ? local_n_rows : in_row2 - in_row1 + 1; const uword in_col1 = col_all ? 0 : col_span.a; const uword in_col2 = col_span.b; const uword submat_n_cols = col_all ? local_n_cols : in_col2 - in_col1 + 1; arma_conform_check_bounds ( ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows)) ) || ( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= local_n_cols)) ) , "subview::submat(): indices out of bounds or incorrectly used" ); const uword base_row1 = aux_row1 + in_row1; const uword base_col1 = aux_col1 + in_col1; return subview(m, base_row1, base_col1, submat_n_rows, submat_n_cols); } template inline subview subview::operator()(const span& row_span, const span& col_span) { arma_debug_sigprint(); return (*this).submat(row_span, col_span); } template inline const subview subview::operator()(const span& row_span, const span& col_span) const { arma_debug_sigprint(); return (*this).submat(row_span, col_span); } template inline subview_each1< subview, 0 > subview::each_col() { arma_debug_sigprint(); return subview_each1< subview, 0 >(*this); } template inline subview_each1< subview, 1 > subview::each_row() { arma_debug_sigprint(); return subview_each1< subview, 1 >(*this); } template template inline subview_each2< subview, 0, T1 > subview::each_col(const Base& indices) { arma_debug_sigprint(); return subview_each2< subview, 0, T1 >(*this, indices); } template template inline subview_each2< subview, 1, T1 > subview::each_row(const Base& indices) { arma_debug_sigprint(); return subview_each2< subview, 1, T1 >(*this, indices); } //! apply a lambda function to each column, where each column is interpreted as a column vector template inline void subview::each_col(const std::function< void(Col&) >& F) { arma_debug_sigprint(); for(uword ii=0; ii < n_cols; ++ii) { Col tmp(colptr(ii), n_rows, false, true); F(tmp); } } template inline void subview::each_col(const std::function< void(const Col&) >& F) const { arma_debug_sigprint(); for(uword ii=0; ii < n_cols; ++ii) { const Col tmp(colptr(ii), n_rows, false, true); F(tmp); } } //! apply a lambda function to each row, where each row is interpreted as a row vector template inline void subview::each_row(const std::function< void(Row&) >& F) { arma_debug_sigprint(); podarray array1(n_cols); podarray array2(n_cols); Row tmp1( array1.memptr(), n_cols, false, true ); Row tmp2( array2.memptr(), n_cols, false, true ); eT* tmp1_mem = tmp1.memptr(); eT* tmp2_mem = tmp2.memptr(); uword ii, jj; for(ii=0, jj=1; jj < n_rows; ii+=2, jj+=2) { for(uword col_id = 0; col_id < n_cols; ++col_id) { const eT* col_mem = colptr(col_id); tmp1_mem[col_id] = col_mem[ii]; tmp2_mem[col_id] = col_mem[jj]; } F(tmp1); F(tmp2); for(uword col_id = 0; col_id < n_cols; ++col_id) { eT* col_mem = colptr(col_id); col_mem[ii] = tmp1_mem[col_id]; col_mem[jj] = tmp2_mem[col_id]; } } if(ii < n_rows) { tmp1 = (*this).row(ii); F(tmp1); (*this).row(ii) = tmp1; } } template inline void subview::each_row(const std::function< void(const Row&) >& F) const { arma_debug_sigprint(); podarray array1(n_cols); podarray array2(n_cols); Row tmp1( array1.memptr(), n_cols, false, true ); Row tmp2( array2.memptr(), n_cols, false, true ); eT* tmp1_mem = tmp1.memptr(); eT* tmp2_mem = tmp2.memptr(); uword ii, jj; for(ii=0, jj=1; jj < n_rows; ii+=2, jj+=2) { for(uword col_id = 0; col_id < n_cols; ++col_id) { const eT* col_mem = colptr(col_id); tmp1_mem[col_id] = col_mem[ii]; tmp2_mem[col_id] = col_mem[jj]; } F(tmp1); F(tmp2); } if(ii < n_rows) { tmp1 = (*this).row(ii); F(tmp1); } } //! creation of diagview (diagonal) template inline diagview subview::diag(const sword in_id) { arma_debug_sigprint(); const uword row_offset = (in_id < 0) ? uword(-in_id) : 0; const uword col_offset = (in_id > 0) ? uword( in_id) : 0; arma_conform_check_bounds ( ((row_offset > 0) && (row_offset >= n_rows)) || ((col_offset > 0) && (col_offset >= n_cols)), "subview::diag(): requested diagonal out of bounds" ); const uword len = (std::min)(n_rows - row_offset, n_cols - col_offset); const uword base_row_offset = aux_row1 + row_offset; const uword base_col_offset = aux_col1 + col_offset; return diagview(m, base_row_offset, base_col_offset, len); } //! creation of diagview (diagonal) template inline const diagview subview::diag(const sword in_id) const { arma_debug_sigprint(); const uword row_offset = uword( (in_id < 0) ? -in_id : 0 ); const uword col_offset = uword( (in_id > 0) ? in_id : 0 ); arma_conform_check_bounds ( ((row_offset > 0) && (row_offset >= n_rows)) || ((col_offset > 0) && (col_offset >= n_cols)), "subview::diag(): requested diagonal out of bounds" ); const uword len = (std::min)(n_rows - row_offset, n_cols - col_offset); const uword base_row_offset = aux_row1 + row_offset; const uword base_col_offset = aux_col1 + col_offset; return diagview(m, base_row_offset, base_col_offset, len); } template inline void subview::swap_rows(const uword in_row1, const uword in_row2) { arma_debug_sigprint(); arma_conform_check_bounds ( (in_row1 >= n_rows) || (in_row2 >= n_rows), "subview::swap_rows(): out of bounds" ); eT* mem = (const_cast< Mat& >(m)).memptr(); if(n_elem > 0) { const uword m_n_rows = m.n_rows; for(uword ucol=0; ucol < n_cols; ++ucol) { const uword offset = (aux_col1 + ucol) * m_n_rows; const uword pos1 = aux_row1 + in_row1 + offset; const uword pos2 = aux_row1 + in_row2 + offset; std::swap( access::rw(mem[pos1]), access::rw(mem[pos2]) ); } } } template inline void subview::swap_cols(const uword in_col1, const uword in_col2) { arma_debug_sigprint(); arma_conform_check_bounds ( (in_col1 >= n_cols) || (in_col2 >= n_cols), "subview::swap_cols(): out of bounds" ); if(n_elem > 0) { eT* ptr1 = colptr(in_col1); eT* ptr2 = colptr(in_col2); for(uword urow=0; urow < n_rows; ++urow) { std::swap( ptr1[urow], ptr2[urow] ); } } } template template inline bool subview::is_alias(const Mat& X) const { arma_debug_sigprint(); return m.is_alias(X); } template inline typename subview::iterator subview::begin() { return iterator(*this, aux_row1, aux_col1); } template inline typename subview::const_iterator subview::begin() const { return const_iterator(*this, aux_row1, aux_col1); } template inline typename subview::const_iterator subview::cbegin() const { return const_iterator(*this, aux_row1, aux_col1); } template inline typename subview::iterator subview::end() { return iterator(*this, aux_row1, aux_col1 + n_cols); } template inline typename subview::const_iterator subview::end() const { return const_iterator(*this, aux_row1, aux_col1 + n_cols); } template inline typename subview::const_iterator subview::cend() const { return const_iterator(*this, aux_row1, aux_col1 + n_cols); } // // // template inline subview::iterator::iterator() : M (nullptr) , current_ptr(nullptr) , current_row(0 ) , current_col(0 ) , aux_row1 (0 ) , aux_row2_p1(0 ) { arma_debug_sigprint(); // Technically this iterator is invalid (it does not point to a valid element) } template inline subview::iterator::iterator(const iterator& X) : M (X.M ) , current_ptr(X.current_ptr) , current_row(X.current_row) , current_col(X.current_col) , aux_row1 (X.aux_row1 ) , aux_row2_p1(X.aux_row2_p1) { arma_debug_sigprint(); } template inline subview::iterator::iterator(subview& in_sv, const uword in_row, const uword in_col) : M (&(const_cast< Mat& >(in_sv.m))) , current_ptr(&(M->at(in_row,in_col)) ) , current_row(in_row ) , current_col(in_col ) , aux_row1 (in_sv.aux_row1 ) , aux_row2_p1(in_sv.aux_row1 + in_sv.n_rows ) { arma_debug_sigprint(); } template inline eT& subview::iterator::operator*() { return (*current_ptr); } template inline typename subview::iterator& subview::iterator::operator++() { current_row++; if(current_row == aux_row2_p1) { current_row = aux_row1; current_col++; current_ptr = &( (*M).at(current_row,current_col) ); } else { current_ptr++; } return *this; } template inline typename subview::iterator subview::iterator::operator++(int) { typename subview::iterator temp(*this); ++(*this); return temp; } template inline bool subview::iterator::operator==(const iterator& rhs) const { return (current_ptr == rhs.current_ptr); } template inline bool subview::iterator::operator!=(const iterator& rhs) const { return (current_ptr != rhs.current_ptr); } template inline bool subview::iterator::operator==(const const_iterator& rhs) const { return (current_ptr == rhs.current_ptr); } template inline bool subview::iterator::operator!=(const const_iterator& rhs) const { return (current_ptr != rhs.current_ptr); } // // // template inline subview::const_iterator::const_iterator() : M (nullptr) , current_ptr(nullptr) , current_row(0 ) , current_col(0 ) , aux_row1 (0 ) , aux_row2_p1(0 ) { arma_debug_sigprint(); // Technically this iterator is invalid (it does not point to a valid element) } template inline subview::const_iterator::const_iterator(const iterator& X) : M (X.M ) , current_ptr(X.current_ptr) , current_row(X.current_row) , current_col(X.current_col) , aux_row1 (X.aux_row1 ) , aux_row2_p1(X.aux_row2_p1) { arma_debug_sigprint(); } template inline subview::const_iterator::const_iterator(const const_iterator& X) : M (X.M ) , current_ptr(X.current_ptr) , current_row(X.current_row) , current_col(X.current_col) , aux_row1 (X.aux_row1 ) , aux_row2_p1(X.aux_row2_p1) { arma_debug_sigprint(); } template inline subview::const_iterator::const_iterator(const subview& in_sv, const uword in_row, const uword in_col) : M (&(in_sv.m) ) , current_ptr(&(M->at(in_row,in_col)) ) , current_row(in_row ) , current_col(in_col ) , aux_row1 (in_sv.aux_row1 ) , aux_row2_p1(in_sv.aux_row1 + in_sv.n_rows) { arma_debug_sigprint(); } template inline const eT& subview::const_iterator::operator*() { return (*current_ptr); } template inline typename subview::const_iterator& subview::const_iterator::operator++() { current_row++; if(current_row == aux_row2_p1) { current_row = aux_row1; current_col++; current_ptr = &( (*M).at(current_row,current_col) ); } else { current_ptr++; } return *this; } template inline typename subview::const_iterator subview::const_iterator::operator++(int) { typename subview::const_iterator temp(*this); ++(*this); return temp; } template inline bool subview::const_iterator::operator==(const iterator& rhs) const { return (current_ptr == rhs.current_ptr); } template inline bool subview::const_iterator::operator!=(const iterator& rhs) const { return (current_ptr != rhs.current_ptr); } template inline bool subview::const_iterator::operator==(const const_iterator& rhs) const { return (current_ptr == rhs.current_ptr); } template inline bool subview::const_iterator::operator!=(const const_iterator& rhs) const { return (current_ptr != rhs.current_ptr); } // // // template inline subview::row_iterator::row_iterator() : M (nullptr) , current_row(0 ) , current_col(0 ) , aux_col1 (0 ) , aux_col2_p1(0 ) { arma_debug_sigprint(); // Technically this iterator is invalid (it does not point to a valid element) } template inline subview::row_iterator::row_iterator(const row_iterator& X) : M (X.M ) , current_row(X.current_row) , current_col(X.current_col) , aux_col1 (X.aux_col1 ) , aux_col2_p1(X.aux_col2_p1) { arma_debug_sigprint(); } template inline subview::row_iterator::row_iterator(subview& in_sv, const uword in_row, const uword in_col) : M (&(const_cast< Mat& >(in_sv.m))) , current_row(in_row ) , current_col(in_col ) , aux_col1 (in_sv.aux_col1 ) , aux_col2_p1(in_sv.aux_col1 + in_sv.n_cols ) { arma_debug_sigprint(); } template inline eT& subview::row_iterator::operator*() { return M->at(current_row,current_col); } template inline typename subview::row_iterator& subview::row_iterator::operator++() { current_col++; if(current_col == aux_col2_p1) { current_col = aux_col1; current_row++; } return *this; } template inline typename subview::row_iterator subview::row_iterator::operator++(int) { typename subview::row_iterator temp(*this); ++(*this); return temp; } template inline bool subview::row_iterator::operator==(const row_iterator& rhs) const { return ( (current_row == rhs.current_row) && (current_col == rhs.current_col) ); } template inline bool subview::row_iterator::operator!=(const row_iterator& rhs) const { return ( (current_row != rhs.current_row) || (current_col != rhs.current_col) ); } template inline bool subview::row_iterator::operator==(const const_row_iterator& rhs) const { return ( (current_row == rhs.current_row) && (current_col == rhs.current_col) ); } template inline bool subview::row_iterator::operator!=(const const_row_iterator& rhs) const { return ( (current_row != rhs.current_row) || (current_col != rhs.current_col) ); } // // // template inline subview::const_row_iterator::const_row_iterator() : M (nullptr) , current_row(0 ) , current_col(0 ) , aux_col1 (0 ) , aux_col2_p1(0 ) { arma_debug_sigprint(); // Technically this iterator is invalid (it does not point to a valid element) } template inline subview::const_row_iterator::const_row_iterator(const row_iterator& X) : M (X.M ) , current_row(X.current_row) , current_col(X.current_col) , aux_col1 (X.aux_col1 ) , aux_col2_p1(X.aux_col2_p1) { arma_debug_sigprint(); } template inline subview::const_row_iterator::const_row_iterator(const const_row_iterator& X) : M (X.M ) , current_row(X.current_row) , current_col(X.current_col) , aux_col1 (X.aux_col1 ) , aux_col2_p1(X.aux_col2_p1) { arma_debug_sigprint(); } template inline subview::const_row_iterator::const_row_iterator(const subview& in_sv, const uword in_row, const uword in_col) : M (&(in_sv.m) ) , current_row(in_row ) , current_col(in_col ) , aux_col1 (in_sv.aux_col1 ) , aux_col2_p1(in_sv.aux_col1 + in_sv.n_cols) { arma_debug_sigprint(); } template inline const eT& subview::const_row_iterator::operator*() const { return M->at(current_row,current_col); } template inline typename subview::const_row_iterator& subview::const_row_iterator::operator++() { current_col++; if(current_col == aux_col2_p1) { current_col = aux_col1; current_row++; } return *this; } template inline typename subview::const_row_iterator subview::const_row_iterator::operator++(int) { typename subview::const_row_iterator temp(*this); ++(*this); return temp; } template inline bool subview::const_row_iterator::operator==(const row_iterator& rhs) const { return ( (current_row == rhs.current_row) && (current_col == rhs.current_col) ); } template inline bool subview::const_row_iterator::operator!=(const row_iterator& rhs) const { return ( (current_row != rhs.current_row) || (current_col != rhs.current_col) ); } template inline bool subview::const_row_iterator::operator==(const const_row_iterator& rhs) const { return ( (current_row == rhs.current_row) && (current_col == rhs.current_col) ); } template inline bool subview::const_row_iterator::operator!=(const const_row_iterator& rhs) const { return ( (current_row != rhs.current_row) || (current_col != rhs.current_col) ); } // // // template inline subview_col::subview_col(const Mat& in_m, const uword in_col) : subview(in_m, 0, in_col, in_m.n_rows, 1) , colmem(subview::colptr(0)) { arma_debug_sigprint(); } template inline subview_col::subview_col(const Mat& in_m, const uword in_col, const uword in_row1, const uword in_n_rows) : subview(in_m, in_row1, in_col, in_n_rows, 1) , colmem(subview::colptr(0)) { arma_debug_sigprint(); } template inline subview_col::subview_col(const subview_col& in) : subview(in) // interprets 'subview_col' as 'subview' , colmem(in.colmem) { arma_debug_sigprint(); } template inline subview_col::subview_col(subview_col&& in) : subview(std::move(in)) // interprets 'subview_col' as 'subview' , colmem(in.colmem) { arma_debug_sigprint(); access::rw(in.colmem) = nullptr; } template inline void subview_col::operator=(const subview& X) { arma_debug_sigprint(); subview::operator=(X); } template inline void subview_col::operator=(const subview_col& X) { arma_debug_sigprint(); subview::operator=(X); // interprets 'subview_col' as 'subview' } template inline void subview_col::operator=(const std::initializer_list& list) { arma_debug_sigprint(); const uword N = uword(list.size()); arma_conform_assert_same_size(subview::n_rows, subview::n_cols, N, 1, "copy into submatrix"); arrayops::copy( access::rwp(colmem), list.begin(), N ); } template inline void subview_col::operator=(const eT val) { arma_debug_sigprint(); if(subview::n_elem != 1) { arma_conform_assert_same_size(subview::n_rows, subview::n_cols, 1, 1, "copy into submatrix"); } access::rw( colmem[0] ) = val; } template template inline void subview_col::operator=(const Base& expr) { arma_debug_sigprint(); if(is_Mat::value) { const unwrap U(expr.get_ref()); arma_conform_assert_same_size(subview::n_rows, uword(1), U.M.n_rows, U.M.n_cols, "copy into submatrix"); arrayops::copy(const_cast(colmem), U.M.memptr(), subview::n_rows); } else { subview::operator=(expr); } } template template inline void subview_col::operator=(const SpBase& X) { arma_debug_sigprint(); subview::operator=(X.get_ref()); } template template inline typename enable_if2< is_same_type::value, void>::result subview_col::operator= (const Gen& in) { arma_debug_sigprint(); arma_conform_assert_same_size(subview::n_rows, uword(1), in.n_rows, (in.is_col ? uword(1) : in.n_cols), "copy into submatrix"); in.apply(*this); } template arma_inline const Op,op_htrans> subview_col::t() const { return Op,op_htrans>(*this); } template arma_inline const Op,op_htrans> subview_col::ht() const { return Op,op_htrans>(*this); } template arma_inline const Op,op_strans> subview_col::st() const { return Op,op_strans>(*this); } template arma_inline const Op,op_strans> subview_col::as_row() const { return Op,op_strans>(*this); } template inline void subview_col::fill(const eT val) { arma_debug_sigprint(); arrayops::inplace_set( access::rwp(colmem), val, subview::n_rows ); } template inline void subview_col::zeros() { arma_debug_sigprint(); arrayops::fill_zeros( access::rwp(colmem), subview::n_rows ); } template inline void subview_col::ones() { arma_debug_sigprint(); arrayops::inplace_set( access::rwp(colmem), eT(1), subview::n_rows ); } template arma_inline eT subview_col::at_alt(const uword ii) const { const eT* colmem_aligned = colmem; memory::mark_as_aligned(colmem_aligned); return colmem_aligned[ii]; } template arma_inline eT& subview_col::operator[](const uword ii) { return access::rw( colmem[ii] ); } template arma_inline eT subview_col::operator[](const uword ii) const { return colmem[ii]; } template inline eT& subview_col::operator()(const uword ii) { arma_conform_check_bounds( (ii >= subview::n_elem), "subview::operator(): index out of bounds" ); return access::rw( colmem[ii] ); } template inline eT subview_col::operator()(const uword ii) const { arma_conform_check_bounds( (ii >= subview::n_elem), "subview::operator(): index out of bounds" ); return colmem[ii]; } template inline eT& subview_col::operator()(const uword in_row, const uword in_col) { arma_conform_check_bounds( ((in_row >= subview::n_rows) || (in_col > 0)), "subview::operator(): index out of bounds" ); return access::rw( colmem[in_row] ); } template inline eT subview_col::operator()(const uword in_row, const uword in_col) const { arma_conform_check_bounds( ((in_row >= subview::n_rows) || (in_col > 0)), "subview::operator(): index out of bounds" ); return colmem[in_row]; } template inline eT& subview_col::at(const uword in_row, const uword) { return access::rw( colmem[in_row] ); } template inline eT subview_col::at(const uword in_row, const uword) const { return colmem[in_row]; } template arma_inline eT* subview_col::colptr(const uword) { return const_cast(colmem); } template arma_inline const eT* subview_col::colptr(const uword) const { return colmem; } template inline subview_col subview_col::rows(const uword in_row1, const uword in_row2) { arma_debug_sigprint(); arma_conform_check_bounds( ( (in_row1 > in_row2) || (in_row2 >= subview::n_rows) ), "subview_col::rows(): indices out of bounds or incorrectly used" ); const uword subview_n_rows = in_row2 - in_row1 + 1; const uword base_row1 = this->aux_row1 + in_row1; return subview_col(this->m, this->aux_col1, base_row1, subview_n_rows); } template inline const subview_col subview_col::rows(const uword in_row1, const uword in_row2) const { arma_debug_sigprint(); arma_conform_check_bounds( ( (in_row1 > in_row2) || (in_row2 >= subview::n_rows) ), "subview_col::rows(): indices out of bounds or incorrectly used" ); const uword subview_n_rows = in_row2 - in_row1 + 1; const uword base_row1 = this->aux_row1 + in_row1; return subview_col(this->m, this->aux_col1, base_row1, subview_n_rows); } template inline subview_col subview_col::subvec(const uword in_row1, const uword in_row2) { arma_debug_sigprint(); arma_conform_check_bounds( ( (in_row1 > in_row2) || (in_row2 >= subview::n_rows) ), "subview_col::subvec(): indices out of bounds or incorrectly used" ); const uword subview_n_rows = in_row2 - in_row1 + 1; const uword base_row1 = this->aux_row1 + in_row1; return subview_col(this->m, this->aux_col1, base_row1, subview_n_rows); } template inline const subview_col subview_col::subvec(const uword in_row1, const uword in_row2) const { arma_debug_sigprint(); arma_conform_check_bounds( ( (in_row1 > in_row2) || (in_row2 >= subview::n_rows) ), "subview_col::subvec(): indices out of bounds or incorrectly used" ); const uword subview_n_rows = in_row2 - in_row1 + 1; const uword base_row1 = this->aux_row1 + in_row1; return subview_col(this->m, this->aux_col1, base_row1, subview_n_rows); } template inline subview_col subview_col::subvec(const uword start_row, const SizeMat& s) { arma_debug_sigprint(); arma_conform_check( (s.n_cols != 1), "subview_col::subvec(): given size does not specify a column vector" ); arma_conform_check_bounds( ( (start_row >= subview::n_rows) || ((start_row + s.n_rows) > subview::n_rows) ), "subview_col::subvec(): size out of bounds" ); const uword base_row1 = this->aux_row1 + start_row; return subview_col(this->m, this->aux_col1, base_row1, s.n_rows); } template inline const subview_col subview_col::subvec(const uword start_row, const SizeMat& s) const { arma_debug_sigprint(); arma_conform_check( (s.n_cols != 1), "subview_col::subvec(): given size does not specify a column vector" ); arma_conform_check_bounds( ( (start_row >= subview::n_rows) || ((start_row + s.n_rows) > subview::n_rows) ), "subview_col::subvec(): size out of bounds" ); const uword base_row1 = this->aux_row1 + start_row; return subview_col(this->m, this->aux_col1, base_row1, s.n_rows); } template inline subview_col subview_col::head(const uword N) { arma_debug_sigprint(); arma_conform_check_bounds( (N > subview::n_rows), "subview_col::head(): size out of bounds" ); return subview_col(this->m, this->aux_col1, this->aux_row1, N); } template inline const subview_col subview_col::head(const uword N) const { arma_debug_sigprint(); arma_conform_check_bounds( (N > subview::n_rows), "subview_col::head(): size out of bounds" ); return subview_col(this->m, this->aux_col1, this->aux_row1, N); } template inline subview_col subview_col::tail(const uword N) { arma_debug_sigprint(); arma_conform_check_bounds( (N > subview::n_rows), "subview_col::tail(): size out of bounds" ); const uword start_row = subview::aux_row1 + subview::n_rows - N; return subview_col(this->m, this->aux_col1, start_row, N); } template inline const subview_col subview_col::tail(const uword N) const { arma_debug_sigprint(); arma_conform_check_bounds( (N > subview::n_rows), "subview_col::tail(): size out of bounds" ); const uword start_row = subview::aux_row1 + subview::n_rows - N; return subview_col(this->m, this->aux_col1, start_row, N); } template inline eT subview_col::min() const { arma_debug_sigprint(); if(subview::n_elem == 0) { arma_conform_check(true, "min(): object has no elements"); return Datum::nan; } return op_min::direct_min(colmem, subview::n_elem); } template inline eT subview_col::max() const { arma_debug_sigprint(); if(subview::n_elem == 0) { arma_conform_check(true, "max(): object has no elements"); return Datum::nan; } return op_max::direct_max(colmem, subview::n_elem); } template inline eT subview_col::min(uword& index_of_min_val) const { arma_debug_sigprint(); if(subview::n_elem == 0) { arma_conform_check(true, "min(): object has no elements"); index_of_min_val = uword(0); return Datum::nan; } else { return op_min::direct_min(colmem, subview::n_elem, index_of_min_val); } } template inline eT subview_col::max(uword& index_of_max_val) const { arma_debug_sigprint(); if(subview::n_elem == 0) { arma_conform_check(true, "max(): object has no elements"); index_of_max_val = uword(0); return Datum::nan; } else { return op_max::direct_max(colmem, subview::n_elem, index_of_max_val); } } template inline uword subview_col::index_min() const { arma_debug_sigprint(); uword index = 0; if(subview::n_elem == 0) { arma_conform_check(true, "index_min(): object has no elements"); } else { op_min::direct_min(colmem, subview::n_elem, index); } return index; } template inline uword subview_col::index_max() const { arma_debug_sigprint(); uword index = 0; if(subview::n_elem == 0) { arma_conform_check(true, "index_max(): object has no elements"); } else { op_max::direct_max(colmem, subview::n_elem, index); } return index; } // // // template inline subview_cols::subview_cols(const Mat& in_m, const uword in_col1, const uword in_n_cols) : subview(in_m, 0, in_col1, in_m.n_rows, in_n_cols) { arma_debug_sigprint(); } template inline subview_cols::subview_cols(const subview_cols& in) : subview(in) // interprets 'subview_cols' as 'subview' { arma_debug_sigprint(); } template inline subview_cols::subview_cols(subview_cols&& in) : subview(std::move(in)) // interprets 'subview_cols' as 'subview' { arma_debug_sigprint(); } template inline void subview_cols::operator=(const subview& X) { arma_debug_sigprint(); subview::operator=(X); } template inline void subview_cols::operator=(const subview_cols& X) { arma_debug_sigprint(); subview::operator=(X); // interprets 'subview_cols' as 'subview' } template inline void subview_cols::operator=(const std::initializer_list& list) { arma_debug_sigprint(); subview::operator=(list); } template inline void subview_cols::operator=(const std::initializer_list< std::initializer_list >& list) { arma_debug_sigprint(); subview::operator=(list); } template inline void subview_cols::operator=(const eT val) { arma_debug_sigprint(); subview::operator=(val); } template template inline void subview_cols::operator=(const Base& X) { arma_debug_sigprint(); subview::operator=(X.get_ref()); } template template inline void subview_cols::operator=(const SpBase& X) { arma_debug_sigprint(); subview::operator=(X.get_ref()); } template template inline typename enable_if2< is_same_type::value, void>::result subview_cols::operator= (const Gen& in) { arma_debug_sigprint(); subview::operator=(in); } template arma_inline const Op,op_htrans> subview_cols::t() const { return Op,op_htrans>(*this); } template arma_inline const Op,op_htrans> subview_cols::ht() const { return Op,op_htrans>(*this); } template arma_inline const Op,op_strans> subview_cols::st() const { return Op,op_strans>(*this); } template arma_inline const Op,op_vectorise_col> subview_cols::as_col() const { return Op,op_vectorise_col>(*this); } template inline eT subview_cols::at_alt(const uword ii) const { return operator[](ii); } template inline eT& subview_cols::operator[](const uword ii) { const uword index = subview::aux_col1 * subview::m.n_rows + ii; return access::rw( (const_cast< Mat& >(subview::m)).mem[index] ); } template inline eT subview_cols::operator[](const uword ii) const { const uword index = subview::aux_col1 * subview::m.n_rows + ii; return subview::m.mem[index]; } template inline eT& subview_cols::operator()(const uword ii) { arma_conform_check_bounds( (ii >= subview::n_elem), "subview::operator(): index out of bounds" ); const uword index = subview::aux_col1 * subview::m.n_rows + ii; return access::rw( (const_cast< Mat& >(subview::m)).mem[index] ); } template inline eT subview_cols::operator()(const uword ii) const { arma_conform_check_bounds( (ii >= subview::n_elem), "subview::operator(): index out of bounds" ); const uword index = subview::aux_col1 * subview::m.n_rows + ii; return subview::m.mem[index]; } template inline eT& subview_cols::operator()(const uword in_row, const uword in_col) { arma_conform_check_bounds( ((in_row >= subview::n_rows) || (in_col >= subview::n_cols)), "subview::operator(): index out of bounds" ); const uword index = (in_col + subview::aux_col1) * subview::m.n_rows + in_row; return access::rw( (const_cast< Mat& >(subview::m)).mem[index] ); } template inline eT subview_cols::operator()(const uword in_row, const uword in_col) const { arma_conform_check_bounds( ((in_row >= subview::n_rows) || (in_col >= subview::n_cols)), "subview::operator(): index out of bounds" ); const uword index = (in_col + subview::aux_col1) * subview::m.n_rows + in_row; return subview::m.mem[index]; } template inline eT& subview_cols::at(const uword in_row, const uword in_col) { const uword index = (in_col + subview::aux_col1) * subview::m.n_rows + in_row; return access::rw( (const_cast< Mat& >(subview::m)).mem[index] ); } template inline eT subview_cols::at(const uword in_row, const uword in_col) const { const uword index = (in_col + subview::aux_col1) * subview::m.n_rows + in_row; return subview::m.mem[index]; } template arma_inline eT* subview_cols::colptr(const uword in_col) { return & access::rw((const_cast< Mat& >(subview::m)).mem[ (in_col + subview::aux_col1) * subview::m.n_rows ]); } template arma_inline const eT* subview_cols::colptr(const uword in_col) const { return & subview::m.mem[ (in_col + subview::aux_col1) * subview::m.n_rows ]; } // // // template inline subview_row::subview_row(const Mat& in_m, const uword in_row) : subview(in_m, in_row, 0, 1, in_m.n_cols) { arma_debug_sigprint(); } template inline subview_row::subview_row(const Mat& in_m, const uword in_row, const uword in_col1, const uword in_n_cols) : subview(in_m, in_row, in_col1, 1, in_n_cols) { arma_debug_sigprint(); } template inline subview_row::subview_row(const subview_row& in) : subview(in) // interprets 'subview_row' as 'subview' { arma_debug_sigprint(); } template inline subview_row::subview_row(subview_row&& in) : subview(std::move(in)) // interprets 'subview_row' as 'subview' { arma_debug_sigprint(); } template inline void subview_row::operator=(const subview& X) { arma_debug_sigprint(); subview::operator=(X); } template inline void subview_row::operator=(const subview_row& X) { arma_debug_sigprint(); subview::operator=(X); // interprets 'subview_row' as 'subview' } template inline void subview_row::operator=(const eT val) { arma_debug_sigprint(); subview::operator=(val); // interprets 'subview_row' as 'subview' } template inline void subview_row::operator=(const std::initializer_list& list) { arma_debug_sigprint(); const uword N = uword(list.size()); arma_conform_assert_same_size(subview::n_rows, subview::n_cols, 1, N, "copy into submatrix"); auto it = list.begin(); for(uword ii=0; ii < N; ++ii) { (*this).operator[](ii) = (*it); ++it; } } template template inline void subview_row::operator=(const Base& X) { arma_debug_sigprint(); subview::operator=(X); } template template inline void subview_row::operator=(const SpBase& X) { arma_debug_sigprint(); subview::operator=(X.get_ref()); } template template inline typename enable_if2< is_same_type::value, void>::result subview_row::operator= (const Gen& in) { arma_debug_sigprint(); arma_conform_assert_same_size(uword(1), subview::n_cols, (in.is_row ? uword(1) : in.n_rows), in.n_cols, "copy into submatrix"); in.apply(*this); } template arma_inline const Op,op_htrans> subview_row::t() const { return Op,op_htrans>(*this); } template arma_inline const Op,op_htrans> subview_row::ht() const { return Op,op_htrans>(*this); } template arma_inline const Op,op_strans> subview_row::st() const { return Op,op_strans>(*this); } template arma_inline const Op,op_strans> subview_row::as_col() const { return Op,op_strans>(*this); } template inline eT subview_row::at_alt(const uword ii) const { const uword index = (ii + (subview::aux_col1))*(subview::m).n_rows + (subview::aux_row1); return subview::m.mem[index]; } template inline eT& subview_row::operator[](const uword ii) { const uword index = (ii + (subview::aux_col1))*(subview::m).n_rows + (subview::aux_row1); return access::rw( (const_cast< Mat& >(subview::m)).mem[index] ); } template inline eT subview_row::operator[](const uword ii) const { const uword index = (ii + (subview::aux_col1))*(subview::m).n_rows + (subview::aux_row1); return subview::m.mem[index]; } template inline eT& subview_row::operator()(const uword ii) { arma_conform_check_bounds( (ii >= subview::n_elem), "subview::operator(): index out of bounds" ); const uword index = (ii + (subview::aux_col1))*(subview::m).n_rows + (subview::aux_row1); return access::rw( (const_cast< Mat& >(subview::m)).mem[index] ); } template inline eT subview_row::operator()(const uword ii) const { arma_conform_check_bounds( (ii >= subview::n_elem), "subview::operator(): index out of bounds" ); const uword index = (ii + (subview::aux_col1))*(subview::m).n_rows + (subview::aux_row1); return subview::m.mem[index]; } template inline eT& subview_row::operator()(const uword in_row, const uword in_col) { arma_conform_check_bounds( ((in_row > 0) || (in_col >= subview::n_cols)), "subview::operator(): index out of bounds" ); const uword index = (in_col + (subview::aux_col1))*(subview::m).n_rows + (subview::aux_row1); return access::rw( (const_cast< Mat& >(subview::m)).mem[index] ); } template inline eT subview_row::operator()(const uword in_row, const uword in_col) const { arma_conform_check_bounds( ((in_row > 0) || (in_col >= subview::n_cols)), "subview::operator(): index out of bounds" ); const uword index = (in_col + (subview::aux_col1))*(subview::m).n_rows + (subview::aux_row1); return subview::m.mem[index]; } template inline eT& subview_row::at(const uword, const uword in_col) { const uword index = (in_col + (subview::aux_col1))*(subview::m).n_rows + (subview::aux_row1); return access::rw( (const_cast< Mat& >(subview::m)).mem[index] ); } template inline eT subview_row::at(const uword, const uword in_col) const { const uword index = (in_col + (subview::aux_col1))*(subview::m).n_rows + (subview::aux_row1); return subview::m.mem[index]; } template inline subview_row subview_row::cols(const uword in_col1, const uword in_col2) { arma_debug_sigprint(); arma_conform_check_bounds( ( (in_col1 > in_col2) || (in_col2 >= subview::n_cols) ), "subview_row::cols(): indices out of bounds or incorrectly used" ); const uword subview_n_cols = in_col2 - in_col1 + 1; const uword base_col1 = this->aux_col1 + in_col1; return subview_row(this->m, this->aux_row1, base_col1, subview_n_cols); } template inline const subview_row subview_row::cols(const uword in_col1, const uword in_col2) const { arma_debug_sigprint(); arma_conform_check_bounds( ( (in_col1 > in_col2) || (in_col2 >= subview::n_cols) ), "subview_row::cols(): indices out of bounds or incorrectly used" ); const uword subview_n_cols = in_col2 - in_col1 + 1; const uword base_col1 = this->aux_col1 + in_col1; return subview_row(this->m, this->aux_row1, base_col1, subview_n_cols); } template inline subview_row subview_row::subvec(const uword in_col1, const uword in_col2) { arma_debug_sigprint(); arma_conform_check_bounds( ( (in_col1 > in_col2) || (in_col2 >= subview::n_cols) ), "subview_row::subvec(): indices out of bounds or incorrectly used" ); const uword subview_n_cols = in_col2 - in_col1 + 1; const uword base_col1 = this->aux_col1 + in_col1; return subview_row(this->m, this->aux_row1, base_col1, subview_n_cols); } template inline const subview_row subview_row::subvec(const uword in_col1, const uword in_col2) const { arma_debug_sigprint(); arma_conform_check_bounds( ( (in_col1 > in_col2) || (in_col2 >= subview::n_cols) ), "subview_row::subvec(): indices out of bounds or incorrectly used" ); const uword subview_n_cols = in_col2 - in_col1 + 1; const uword base_col1 = this->aux_col1 + in_col1; return subview_row(this->m, this->aux_row1, base_col1, subview_n_cols); } template inline subview_row subview_row::subvec(const uword start_col, const SizeMat& s) { arma_debug_sigprint(); arma_conform_check( (s.n_rows != 1), "subview_row::subvec(): given size does not specify a row vector" ); arma_conform_check_bounds( ( (start_col >= subview::n_cols) || ((start_col + s.n_cols) > subview::n_cols) ), "subview_row::subvec(): size out of bounds" ); const uword base_col1 = this->aux_col1 + start_col; return subview_row(this->m, this->aux_row1, base_col1, s.n_cols); } template inline const subview_row subview_row::subvec(const uword start_col, const SizeMat& s) const { arma_debug_sigprint(); arma_conform_check( (s.n_rows != 1), "subview_row::subvec(): given size does not specify a row vector" ); arma_conform_check_bounds( ( (start_col >= subview::n_cols) || ((start_col + s.n_cols) > subview::n_cols) ), "subview_row::subvec(): size out of bounds" ); const uword base_col1 = this->aux_col1 + start_col; return subview_row(this->m, this->aux_row1, base_col1, s.n_cols); } template inline subview_row subview_row::head(const uword N) { arma_debug_sigprint(); arma_conform_check_bounds( (N > subview::n_cols), "subview_row::head(): size out of bounds" ); return subview_row(this->m, this->aux_row1, this->aux_col1, N); } template inline const subview_row subview_row::head(const uword N) const { arma_debug_sigprint(); arma_conform_check_bounds( (N > subview::n_cols), "subview_row::head(): size out of bounds" ); return subview_row(this->m, this->aux_row1, this->aux_col1, N); } template inline subview_row subview_row::tail(const uword N) { arma_debug_sigprint(); arma_conform_check_bounds( (N > subview::n_cols), "subview_row::tail(): size out of bounds" ); const uword start_col = subview::aux_col1 + subview::n_cols - N; return subview_row(this->m, this->aux_row1, start_col, N); } template inline const subview_row subview_row::tail(const uword N) const { arma_debug_sigprint(); arma_conform_check_bounds( (N > subview::n_cols), "subview_row::tail(): size out of bounds" ); const uword start_col = subview::aux_col1 + subview::n_cols - N; return subview_row(this->m, this->aux_row1, start_col, N); } template inline uword subview_row::index_min() const { const Proxy< subview_row > P(*this); uword index = 0; if(P.get_n_elem() == 0) { arma_conform_check(true, "index_min(): object has no elements"); } else { op_min::min_with_index(P, index); } return index; } template inline uword subview_row::index_max() const { const Proxy< subview_row > P(*this); uword index = 0; if(P.get_n_elem() == 0) { arma_conform_check(true, "index_max(): object has no elements"); } else { op_max::max_with_index(P, index); } return index; } template inline typename subview::row_iterator subview_row::begin() { return typename subview::row_iterator(*this, subview::aux_row1, subview::aux_col1); } template inline typename subview::const_row_iterator subview_row::begin() const { return typename subview::const_row_iterator(*this, subview::aux_row1, subview::aux_col1); } template inline typename subview::const_row_iterator subview_row::cbegin() const { return typename subview::const_row_iterator(*this, subview::aux_row1, subview::aux_col1); } template inline typename subview::row_iterator subview_row::end() { return typename subview::row_iterator(*this, subview::aux_row1 + subview::n_rows, subview::aux_col1); } template inline typename subview::const_row_iterator subview_row::end() const { return typename subview::const_row_iterator(*this, subview::aux_row1 + subview::n_rows, subview::aux_col1); } template inline typename subview::const_row_iterator subview_row::cend() const { return typename subview::const_row_iterator(*this, subview::aux_row1 + subview::n_rows, subview::aux_col1); } // // // template inline subview_row_strans::subview_row_strans(const subview_row& in_sv_row) : sv_row(in_sv_row ) , n_rows(in_sv_row.n_cols) , n_elem(in_sv_row.n_elem) { arma_debug_sigprint(); } template inline void subview_row_strans::extract(Mat& out) const { arma_debug_sigprint(); // NOTE: this function assumes that matrix 'out' has already been set to the correct size const Mat& X = sv_row.m; eT* out_mem = out.memptr(); const uword row = sv_row.aux_row1; const uword start_col = sv_row.aux_col1; const uword sv_row_n_cols = sv_row.n_cols; uword ii,jj; for(ii=0, jj=1; jj < sv_row_n_cols; ii+=2, jj+=2) { const eT tmp1 = X.at(row, start_col+ii); const eT tmp2 = X.at(row, start_col+jj); out_mem[ii] = tmp1; out_mem[jj] = tmp2; } if(ii < sv_row_n_cols) { out_mem[ii] = X.at(row, start_col+ii); } } template inline eT subview_row_strans::at_alt(const uword ii) const { return sv_row[ii]; } template inline eT subview_row_strans::operator[](const uword ii) const { return sv_row[ii]; } template inline eT subview_row_strans::operator()(const uword ii) const { return sv_row(ii); } template inline eT subview_row_strans::operator()(const uword in_row, const uword in_col) const { return sv_row(in_col, in_row); // deliberately swapped } template inline eT subview_row_strans::at(const uword in_row, const uword) const { return sv_row.at(0, in_row); // deliberately swapped } // // // template inline subview_row_htrans::subview_row_htrans(const subview_row& in_sv_row) : sv_row(in_sv_row ) , n_rows(in_sv_row.n_cols) , n_elem(in_sv_row.n_elem) { arma_debug_sigprint(); } template inline void subview_row_htrans::extract(Mat& out) const { arma_debug_sigprint(); // NOTE: this function assumes that matrix 'out' has already been set to the correct size const Mat& X = sv_row.m; eT* out_mem = out.memptr(); const uword row = sv_row.aux_row1; const uword start_col = sv_row.aux_col1; const uword sv_row_n_cols = sv_row.n_cols; for(uword ii=0; ii < sv_row_n_cols; ++ii) { out_mem[ii] = access::alt_conj( X.at(row, start_col+ii) ); } } template inline eT subview_row_htrans::at_alt(const uword ii) const { return access::alt_conj( sv_row[ii] ); } template inline eT subview_row_htrans::operator[](const uword ii) const { return access::alt_conj( sv_row[ii] ); } template inline eT subview_row_htrans::operator()(const uword ii) const { return access::alt_conj( sv_row(ii) ); } template inline eT subview_row_htrans::operator()(const uword in_row, const uword in_col) const { return access::alt_conj( sv_row(in_col, in_row) ); // deliberately swapped } template inline eT subview_row_htrans::at(const uword in_row, const uword) const { return access::alt_conj( sv_row.at(0, in_row) ); // deliberately swapped } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_join.hpp0000644000176200001440000002536114631567470022547 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_join //! @{ template arma_warn_unused inline typename enable_if2 < (is_arma_type::value && is_arma_type::value && is_same_type::value), const Glue >::result join_cols(const T1& A, const T2& B) { arma_debug_sigprint(); return Glue(A, B); } template arma_warn_unused inline Mat join_cols(const Base& A, const Base& B, const Base& C) { arma_debug_sigprint(); Mat out; glue_join_cols::apply(out, A.get_ref(), B.get_ref(), C.get_ref()); return out; } template arma_warn_unused inline Mat join_cols(const Base& A, const Base& B, const Base& C, const Base& D) { arma_debug_sigprint(); Mat out; glue_join_cols::apply(out, A.get_ref(), B.get_ref(), C.get_ref(), D.get_ref()); return out; } template arma_warn_unused inline typename enable_if2 < (is_arma_type::value && is_arma_type::value && is_same_type::value), const Glue >::result join_vert(const T1& A, const T2& B) { arma_debug_sigprint(); return Glue(A, B); } template arma_warn_unused inline Mat join_vert(const Base& A, const Base& B, const Base& C) { arma_debug_sigprint(); Mat out; glue_join_cols::apply(out, A.get_ref(), B.get_ref(), C.get_ref()); return out; } template arma_warn_unused inline Mat join_vert(const Base& A, const Base& B, const Base& C, const Base& D) { arma_debug_sigprint(); Mat out; glue_join_cols::apply(out, A.get_ref(), B.get_ref(), C.get_ref(), D.get_ref()); return out; } template arma_warn_unused inline typename enable_if2 < (is_arma_type::value && is_arma_type::value && is_same_type::value), const Glue >::result join_rows(const T1& A, const T2& B) { arma_debug_sigprint(); return Glue(A, B); } template arma_warn_unused inline Mat join_rows(const Base& A, const Base& B, const Base& C) { arma_debug_sigprint(); Mat out; glue_join_rows::apply(out, A.get_ref(), B.get_ref(), C.get_ref()); return out; } template arma_warn_unused inline Mat join_rows(const Base& A, const Base& B, const Base& C, const Base& D) { arma_debug_sigprint(); Mat out; glue_join_rows::apply(out, A.get_ref(), B.get_ref(), C.get_ref(), D.get_ref()); return out; } template arma_warn_unused inline typename enable_if2 < (is_arma_type::value && is_arma_type::value && is_same_type::value), const Glue >::result join_horiz(const T1& A, const T2& B) { arma_debug_sigprint(); return Glue(A, B); } template arma_warn_unused inline Mat join_horiz(const Base& A, const Base& B, const Base& C) { arma_debug_sigprint(); Mat out; glue_join_rows::apply(out, A.get_ref(), B.get_ref(), C.get_ref()); return out; } template arma_warn_unused inline Mat join_horiz(const Base& A, const Base& B, const Base& C, const Base& D) { arma_debug_sigprint(); Mat out; glue_join_rows::apply(out, A.get_ref(), B.get_ref(), C.get_ref(), D.get_ref()); return out; } // // for cubes template arma_warn_unused inline const GlueCube join_slices(const BaseCube& A, const BaseCube& B) { arma_debug_sigprint(); return GlueCube(A.get_ref(), B.get_ref()); } template arma_warn_unused inline Cube join_slices(const Base& A, const Base& B) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const quasi_unwrap UA(A.get_ref()); const quasi_unwrap UB(B.get_ref()); arma_conform_assert_same_size(UA.M.n_rows, UA.M.n_cols, UB.M.n_rows, UB.M.n_cols, "join_slices(): incompatible dimensions"); Cube out(UA.M.n_rows, UA.M.n_cols, 2, arma_nozeros_indicator()); arrayops::copy(out.slice_memptr(0), UA.M.memptr(), UA.M.n_elem); arrayops::copy(out.slice_memptr(1), UB.M.memptr(), UB.M.n_elem); return out; } template arma_warn_unused inline Cube join_slices(const Base& A, const BaseCube& B) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const quasi_unwrap U(A.get_ref()); const Cube M(const_cast(U.M.memptr()), U.M.n_rows, U.M.n_cols, 1, false); return join_slices(M,B); } template arma_warn_unused inline Cube join_slices(const BaseCube& A, const Base& B) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const quasi_unwrap U(B.get_ref()); const Cube M(const_cast(U.M.memptr()), U.M.n_rows, U.M.n_cols, 1, false); return join_slices(A,M); } // // for sparse matrices template arma_warn_unused inline const SpGlue join_cols(const SpBase& A, const SpBase& B) { arma_debug_sigprint(); return SpGlue(A.get_ref(), B.get_ref()); } template arma_warn_unused inline SpMat join_cols(const SpBase& A, const SpBase& B, const SpBase& C) { arma_debug_sigprint(); SpMat out; spglue_join_cols::apply(out, A.get_ref(), B.get_ref(), C.get_ref()); return out; } template arma_warn_unused inline SpMat join_cols(const SpBase& A, const SpBase& B, const SpBase& C, const SpBase& D) { arma_debug_sigprint(); SpMat out; spglue_join_cols::apply(out, A.get_ref(), B.get_ref(), C.get_ref(), D.get_ref()); return out; } template arma_warn_unused inline const SpGlue join_vert(const SpBase& A, const SpBase& B) { arma_debug_sigprint(); return SpGlue(A.get_ref(), B.get_ref()); } template arma_warn_unused inline SpMat join_vert(const SpBase& A, const SpBase& B, const SpBase& C) { arma_debug_sigprint(); SpMat out; spglue_join_cols::apply(out, A.get_ref(), B.get_ref(), C.get_ref()); return out; } template arma_warn_unused inline SpMat join_vert(const SpBase& A, const SpBase& B, const SpBase& C, const SpBase& D) { arma_debug_sigprint(); SpMat out; spglue_join_cols::apply(out, A.get_ref(), B.get_ref(), C.get_ref(), D.get_ref()); return out; } template arma_warn_unused inline const SpGlue join_rows(const SpBase& A, const SpBase& B) { arma_debug_sigprint(); return SpGlue(A.get_ref(), B.get_ref()); } template arma_warn_unused inline SpMat join_rows(const SpBase& A, const SpBase& B, const SpBase& C) { arma_debug_sigprint(); SpMat out; spglue_join_rows::apply(out, A.get_ref(), B.get_ref(), C.get_ref()); return out; } template arma_warn_unused inline SpMat join_rows(const SpBase& A, const SpBase& B, const SpBase& C, const SpBase& D) { arma_debug_sigprint(); SpMat out; spglue_join_rows::apply(out, A.get_ref(), B.get_ref(), C.get_ref(), D.get_ref()); return out; } template arma_warn_unused inline const SpGlue join_horiz(const SpBase& A, const SpBase& B) { arma_debug_sigprint(); return SpGlue(A.get_ref(), B.get_ref()); } template arma_warn_unused inline SpMat join_horiz(const SpBase& A, const SpBase& B, const SpBase& C) { arma_debug_sigprint(); SpMat out; spglue_join_rows::apply(out, A.get_ref(), B.get_ref(), C.get_ref()); return out; } template arma_warn_unused inline SpMat join_horiz(const SpBase& A, const SpBase& B, const SpBase& C, const SpBase& D) { arma_debug_sigprint(); SpMat out; spglue_join_rows::apply(out, A.get_ref(), B.get_ref(), C.get_ref(), D.get_ref()); return out; } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_trimat.hpp0000644000176200001440000000623714631567470023111 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_trimat //! @{ template arma_warn_unused arma_inline const Op trimatu(const Base& X) { arma_debug_sigprint(); return Op(X.get_ref(), 0, 0); } template arma_warn_unused arma_inline const Op trimatl(const Base& X) { arma_debug_sigprint(); return Op(X.get_ref(), 1, 0); } template arma_warn_unused arma_inline const SpOp trimatu(const SpBase& X) { arma_debug_sigprint(); return SpOp(X.get_ref(), 0, 0); } template arma_warn_unused arma_inline const SpOp trimatl(const SpBase& X) { arma_debug_sigprint(); return SpOp(X.get_ref(), 1, 0); } // template arma_warn_unused arma_inline const Op trimatl(const Base& X, const sword k) { arma_debug_sigprint(); const uword row_offset = (k < 0) ? uword(-k) : uword(0); const uword col_offset = (k > 0) ? uword( k) : uword(0); return Op(X.get_ref(), row_offset, col_offset); } template arma_warn_unused arma_inline const Op trimatu(const Base& X, const sword k) { arma_debug_sigprint(); const uword row_offset = (k < 0) ? uword(-k) : uword(0); const uword col_offset = (k > 0) ? uword( k) : uword(0); return Op(X.get_ref(), row_offset, col_offset); } template arma_warn_unused arma_inline const SpOp trimatu(const SpBase& X, const sword k) { arma_debug_sigprint(); const uword row_offset = (k < 0) ? uword(-k) : uword(0); const uword col_offset = (k > 0) ? uword( k) : uword(0); return SpOp(X.get_ref(), row_offset, col_offset); } template arma_warn_unused arma_inline const SpOp trimatl(const SpBase& X, const sword k) { arma_debug_sigprint(); const uword row_offset = (k < 0) ? uword(-k) : uword(0); const uword col_offset = (k > 0) ? uword( k) : uword(0); return SpOp(X.get_ref(), row_offset, col_offset); } //! @} RcppArmadillo/inst/include/armadillo_bits/operator_cube_plus.hpp0000644000176200001440000001131314631567470025011 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup operator_cube_plus //! @{ //! unary plus operation (does nothing, but is required for completeness) template arma_inline const BaseCube& operator+ ( const BaseCube& X ) { arma_debug_sigprint(); return X; } //! BaseCube + scalar template arma_inline const eOpCube operator+ ( const BaseCube& X, const typename T1::elem_type k ) { arma_debug_sigprint(); return eOpCube(X.get_ref(), k); } //! scalar + BaseCube template arma_inline const eOpCube operator+ ( const typename T1::elem_type k, const BaseCube& X ) { arma_debug_sigprint(); return eOpCube(X.get_ref(), k); } //! non-complex BaseCube + complex scalar (experimental) template arma_inline const mtOpCube, T1, op_cx_scalar_plus> operator+ ( const BaseCube& X, const std::complex& k ) { arma_debug_sigprint(); return mtOpCube, T1, op_cx_scalar_plus>('j', X.get_ref(), k); } //! complex scalar + non-complex BaseCube (experimental) template arma_inline const mtOpCube, T1, op_cx_scalar_plus> operator+ ( const std::complex& k, const BaseCube& X ) { arma_debug_sigprint(); return mtOpCube, T1, op_cx_scalar_plus>('j', X.get_ref(), k); // NOTE: order is swapped } //! addition of BaseCube objects with same element type template arma_inline const eGlueCube operator+ ( const BaseCube& X, const BaseCube& Y ) { arma_debug_sigprint(); return eGlueCube(X.get_ref(), Y.get_ref()); } //! addition of BaseCube objects with different element types template inline const mtGlueCube::result, T1, T2, glue_mixed_plus> operator+ ( const BaseCube< typename force_different_type::T1_result, T1>& X, const BaseCube< typename force_different_type::T2_result, T2>& Y ) { arma_debug_sigprint(); typedef typename T1::elem_type eT1; typedef typename T2::elem_type eT2; typedef typename promote_type::result out_eT; promote_type::check(); return mtGlueCube( X.get_ref(), Y.get_ref() ); } template arma_inline Cube operator+ ( const subview_cube_each1& X, const Base& Y ) { arma_debug_sigprint(); return subview_cube_each1_aux::operator_plus(X, Y.get_ref()); } template arma_inline Cube operator+ ( const Base& X, const subview_cube_each1& Y ) { arma_debug_sigprint(); return subview_cube_each1_aux::operator_plus(Y, X.get_ref()); // NOTE: swapped order } template arma_inline Cube operator+ ( const subview_cube_each2& X, const Base& Y ) { arma_debug_sigprint(); return subview_cube_each2_aux::operator_plus(X, Y.get_ref()); } template arma_inline Cube operator+ ( const Base& X, const subview_cube_each2& Y ) { arma_debug_sigprint(); return subview_cube_each2_aux::operator_plus(Y, X.get_ref()); // NOTE: swapped order } //! @} RcppArmadillo/inst/include/armadillo_bits/op_nonzeros_meat.hpp0000644000176200001440000000435015030507611024462 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_nonzeros //! @{ template inline void op_nonzeros::apply_noalias(Mat& out, const Proxy& P) { arma_debug_sigprint(); typedef typename T1::elem_type eT; constexpr eT eT_zero = eT(0); const uword N_max = P.get_n_elem(); Mat tmp(N_max, 1, arma_nozeros_indicator()); eT* tmp_mem = tmp.memptr(); uword N_nz = 0; if(Proxy::use_at == false) { typename Proxy::ea_type Pea = P.get_ea(); for(uword i=0; i inline void op_nonzeros::apply(Mat& out, const Op& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const Proxy P(X.m); if(P.get_n_elem() == 0) { out.set_size(0,1); return; } if(P.is_alias(out)) { Mat tmp; op_nonzeros::apply_noalias(tmp, P); out.steal_mem(tmp); } else { op_nonzeros::apply_noalias(out, P); } } //! @} RcppArmadillo/inst/include/armadillo_bits/translate_atlas.hpp0000644000176200001440000001701314301267044024265 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ #if defined(ARMA_USE_ATLAS) // TODO: remove support for ATLAS in next major version //! \namespace atlas namespace for ATLAS functions namespace atlas { template inline static const eT& tmp_real(const eT& X) { return X; } template inline static const T tmp_real(const std::complex& X) { return X.real(); } template arma_inline eT cblas_asum(const int N, const eT* X) { arma_type_check((is_supported_blas_type::value == false)); if(is_float::value) { typedef float T; return eT( arma_wrapper(cblas_sasum)(N, (const T*)X, 1) ); } else if(is_double::value) { typedef double T; return eT( arma_wrapper(cblas_dasum)(N, (const T*)X, 1) ); } return eT(0); } template arma_inline eT cblas_nrm2(const int N, const eT* X) { arma_type_check((is_supported_blas_type::value == false)); if(is_float::value) { typedef float T; return eT( arma_wrapper(cblas_snrm2)(N, (const T*)X, 1) ); } else if(is_double::value) { typedef double T; return eT( arma_wrapper(cblas_dnrm2)(N, (const T*)X, 1) ); } return eT(0); } template arma_inline eT cblas_dot(const int N, const eT* X, const eT* Y) { arma_type_check((is_supported_blas_type::value == false)); if(is_float::value) { typedef float T; return eT( arma_wrapper(cblas_sdot)(N, (const T*)X, 1, (const T*)Y, 1) ); } else if(is_double::value) { typedef double T; return eT( arma_wrapper(cblas_ddot)(N, (const T*)X, 1, (const T*)Y, 1) ); } return eT(0); } template arma_inline eT cblas_cx_dot(const int N, const eT* X, const eT* Y) { arma_type_check((is_supported_blas_type::value == false)); if(is_cx_float::value) { typedef typename std::complex T; T out; arma_wrapper(cblas_cdotu_sub)(N, (const T*)X, 1, (const T*)Y, 1, &out); return eT(out); } else if(is_cx_double::value) { typedef typename std::complex T; T out; arma_wrapper(cblas_zdotu_sub)(N, (const T*)X, 1, (const T*)Y, 1, &out); return eT(out); } return eT(0); } template inline void cblas_gemv ( const atlas_CBLAS_LAYOUT layout, const atlas_CBLAS_TRANS TransA, const int M, const int N, const eT alpha, const eT *A, const int lda, const eT *X, const int incX, const eT beta, eT *Y, const int incY ) { arma_type_check((is_supported_blas_type::value == false)); if(is_float::value) { typedef float T; arma_wrapper(cblas_sgemv)(layout, TransA, M, N, (const T)tmp_real(alpha), (const T*)A, lda, (const T*)X, incX, (const T)tmp_real(beta), (T*)Y, incY); } else if(is_double::value) { typedef double T; arma_wrapper(cblas_dgemv)(layout, TransA, M, N, (const T)tmp_real(alpha), (const T*)A, lda, (const T*)X, incX, (const T)tmp_real(beta), (T*)Y, incY); } else if(is_cx_float::value) { typedef std::complex T; arma_wrapper(cblas_cgemv)(layout, TransA, M, N, (const T*)&alpha, (const T*)A, lda, (const T*)X, incX, (const T*)&beta, (T*)Y, incY); } else if(is_cx_double::value) { typedef std::complex T; arma_wrapper(cblas_zgemv)(layout, TransA, M, N, (const T*)&alpha, (const T*)A, lda, (const T*)X, incX, (const T*)&beta, (T*)Y, incY); } } template inline void cblas_gemm ( const atlas_CBLAS_LAYOUT layout, const atlas_CBLAS_TRANS TransA, const atlas_CBLAS_TRANS TransB, const int M, const int N, const int K, const eT alpha, const eT *A, const int lda, const eT *B, const int ldb, const eT beta, eT *C, const int ldc ) { arma_type_check((is_supported_blas_type::value == false)); if(is_float::value) { typedef float T; arma_wrapper(cblas_sgemm)(layout, TransA, TransB, M, N, K, (const T)tmp_real(alpha), (const T*)A, lda, (const T*)B, ldb, (const T)tmp_real(beta), (T*)C, ldc); } else if(is_double::value) { typedef double T; arma_wrapper(cblas_dgemm)(layout, TransA, TransB, M, N, K, (const T)tmp_real(alpha), (const T*)A, lda, (const T*)B, ldb, (const T)tmp_real(beta), (T*)C, ldc); } else if(is_cx_float::value) { typedef std::complex T; arma_wrapper(cblas_cgemm)(layout, TransA, TransB, M, N, K, (const T*)&alpha, (const T*)A, lda, (const T*)B, ldb, (const T*)&beta, (T*)C, ldc); } else if(is_cx_double::value) { typedef std::complex T; arma_wrapper(cblas_zgemm)(layout, TransA, TransB, M, N, K, (const T*)&alpha, (const T*)A, lda, (const T*)B, ldb, (const T*)&beta, (T*)C, ldc); } } template inline void cblas_syrk ( const atlas_CBLAS_LAYOUT layout, const atlas_CBLAS_UPLO Uplo, const atlas_CBLAS_TRANS Trans, const int N, const int K, const eT alpha, const eT* A, const int lda, const eT beta, eT* C, const int ldc ) { arma_type_check((is_supported_blas_type::value == false)); if(is_float::value) { typedef float T; arma_wrapper(cblas_ssyrk)(layout, Uplo, Trans, N, K, (const T)alpha, (const T*)A, lda, (const T)beta, (T*)C, ldc); } else if(is_double::value) { typedef double T; arma_wrapper(cblas_dsyrk)(layout, Uplo, Trans, N, K, (const T)alpha, (const T*)A, lda, (const T)beta, (T*)C, ldc); } } template inline void cblas_herk ( const atlas_CBLAS_LAYOUT layout, const atlas_CBLAS_UPLO Uplo, const atlas_CBLAS_TRANS Trans, const int N, const int K, const T alpha, const std::complex* A, const int lda, const T beta, std::complex* C, const int ldc ) { arma_type_check((is_supported_blas_type::value == false)); if(is_float::value) { typedef float TT; typedef std::complex cx_TT; arma_wrapper(cblas_cherk)(layout, Uplo, Trans, N, K, (const TT)alpha, (const cx_TT*)A, lda, (const TT)beta, (cx_TT*)C, ldc); } else if(is_double::value) { typedef double TT; typedef std::complex cx_TT; arma_wrapper(cblas_zherk)(layout, Uplo, Trans, N, K, (const TT)alpha, (const cx_TT*)A, lda, (const TT)beta, (cx_TT*)C, ldc); } } } #endif RcppArmadillo/inst/include/armadillo_bits/field_bones.hpp0000644000176200001440000004162214752446051023367 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup field //! @{ //! A lightweight 1D/2D/3D container for arbitrary objects //! (the objects must have a copy constructor) template class field { public: typedef oT object_type; const uword n_rows; //!< number of rows (read-only) const uword n_cols; //!< number of columns (read-only) const uword n_slices; //!< number of slices (read-only) const uword n_elem; //!< number of elements (read-only) private: arma_aligned oT** mem; //!< pointers to stored objects public: inline ~field(); inline field(); inline field(const field& x); inline field& operator=(const field& x); inline field(const subview_field& x); inline field& operator=(const subview_field& x); inline explicit field(const uword n_elem_in); inline explicit field(const uword n_rows_in, const uword n_cols_in); inline explicit field(const uword n_rows_in, const uword n_cols_in, const uword n_slices_in); inline explicit field(const SizeMat& s); inline explicit field(const SizeCube& s); inline field& set_size(const uword n_elem_in); inline field& set_size(const uword n_rows_in, const uword n_cols_in); inline field& set_size(const uword n_rows_in, const uword n_cols_in, const uword n_slices_in); inline field& set_size(const SizeMat& s); inline field& set_size(const SizeCube& s); inline field& reshape(const uword n_elem_in); inline field& reshape(const uword n_rows_in, const uword n_cols_in); inline field& reshape(const uword n_rows_in, const uword n_cols_in, const uword n_slices_in); inline field& reshape(const SizeMat& s); inline field& reshape(const SizeCube& s); inline field& resize(const uword n_elem_in); inline field& resize(const uword n_rows_in, const uword n_cols_in); inline field& resize(const uword n_rows_in, const uword n_cols_in, const uword n_slices_in); inline field& resize(const SizeMat& s); inline field& resize(const SizeCube& s); inline field(const std::vector& x); inline field& operator=(const std::vector& x); inline field(const std::initializer_list& list); inline field& operator=(const std::initializer_list& list); inline field(const std::initializer_list< std::initializer_list >& list); inline field& operator=(const std::initializer_list< std::initializer_list >& list); inline field(field&& X); inline field& operator=(field&& X); template inline field& copy_size(const field& x); arma_warn_unused arma_inline oT& operator[](const uword i); arma_warn_unused arma_inline const oT& operator[](const uword i) const; arma_warn_unused arma_inline oT& at(const uword i); arma_warn_unused arma_inline const oT& at(const uword i) const; arma_warn_unused arma_inline oT& operator()(const uword i); arma_warn_unused arma_inline const oT& operator()(const uword i) const; #if defined(__cpp_multidimensional_subscript) arma_warn_unused arma_inline oT& operator[](const uword row, const uword col); arma_warn_unused arma_inline const oT& operator[](const uword row, const uword col) const; #endif arma_warn_unused arma_inline oT& at(const uword row, const uword col); arma_warn_unused arma_inline const oT& at(const uword row, const uword col) const; #if defined(__cpp_multidimensional_subscript) arma_warn_unused arma_inline oT& operator[](const uword row, const uword col, const uword slice); arma_warn_unused arma_inline const oT& operator[](const uword row, const uword col, const uword slice) const; #endif arma_warn_unused arma_inline oT& at(const uword row, const uword col, const uword slice); arma_warn_unused arma_inline const oT& at(const uword row, const uword col, const uword slice) const; arma_warn_unused arma_inline oT& operator()(const uword row, const uword col); arma_warn_unused arma_inline const oT& operator()(const uword row, const uword col) const; arma_warn_unused arma_inline oT& operator()(const uword row, const uword col, const uword slice); arma_warn_unused arma_inline const oT& operator()(const uword row, const uword col, const uword slice) const; arma_warn_unused arma_inline oT& front(); arma_warn_unused arma_inline const oT& front() const; arma_warn_unused arma_inline oT& back(); arma_warn_unused arma_inline const oT& back() const; arma_frown("use braced initialiser list instead") inline field_injector operator<<(const oT& val); arma_frown("use braced initialiser list instead") inline field_injector operator<<(const injector_end_of_row<>& x); inline subview_field row(const uword row_num); inline const subview_field row(const uword row_num) const; inline subview_field col(const uword col_num); inline const subview_field col(const uword col_num) const; inline subview_field slice(const uword slice_num); inline const subview_field slice(const uword slice_num) const; inline subview_field rows(const uword in_row1, const uword in_row2); inline const subview_field rows(const uword in_row1, const uword in_row2) const; inline subview_field cols(const uword in_col1, const uword in_col2); inline const subview_field cols(const uword in_col1, const uword in_col2) const; inline subview_field slices(const uword in_slice1, const uword in_slice2); inline const subview_field slices(const uword in_slice1, const uword in_slice2) const; inline subview_field subfield(const uword in_row1, const uword in_col1, const uword in_row2, const uword in_col2); inline const subview_field subfield(const uword in_row1, const uword in_col1, const uword in_row2, const uword in_col2) const; inline subview_field subfield(const uword in_row1, const uword in_col1, const uword in_slice1, const uword in_row2, const uword in_col2, const uword in_slice2); inline const subview_field subfield(const uword in_row1, const uword in_col1, const uword in_slice1, const uword in_row2, const uword in_col2, const uword in_slice2) const; inline subview_field subfield(const uword in_row1, const uword in_col1, const SizeMat& s); inline const subview_field subfield(const uword in_row1, const uword in_col1, const SizeMat& s) const; inline subview_field subfield(const uword in_row1, const uword in_col1, const uword in_slice1, const SizeCube& s); inline const subview_field subfield(const uword in_row1, const uword in_col1, const uword in_slice1, const SizeCube& s) const; inline subview_field subfield(const span& row_span, const span& col_span); inline const subview_field subfield(const span& row_span, const span& col_span) const; inline subview_field subfield(const span& row_span, const span& col_span, const span& slice_span); inline const subview_field subfield(const span& row_span, const span& col_span, const span& slice_span) const; inline subview_field operator()(const span& row_span, const span& col_span); inline const subview_field operator()(const span& row_span, const span& col_span) const; inline subview_field operator()(const span& row_span, const span& col_span, const span& slice_span); inline const subview_field operator()(const span& row_span, const span& col_span, const span& slice_span) const; inline subview_field operator()(const uword in_row1, const uword in_col1, const SizeMat& s); inline const subview_field operator()(const uword in_row1, const uword in_col1, const SizeMat& s) const; inline subview_field operator()(const uword in_row1, const uword in_col1, const uword in_slice1, const SizeCube& s); inline const subview_field operator()(const uword in_row1, const uword in_col1, const uword in_slice1, const SizeCube& s) const; arma_cold inline void print( const std::string extra_text = "") const; arma_cold inline void print(std::ostream& user_stream, const std::string extra_text = "") const; inline field& for_each(const std::function< void( oT&) >& F); inline const field& for_each(const std::function< void(const oT&) >& F) const; inline field& fill(const oT& x); inline void reset(); inline void reset_objects(); arma_warn_unused arma_inline bool is_empty() const; arma_warn_unused arma_inline bool in_range(const uword i) const; arma_warn_unused arma_inline bool in_range(const span& x) const; arma_warn_unused arma_inline bool in_range(const uword in_row, const uword in_col) const; arma_warn_unused arma_inline bool in_range(const span& row_span, const uword in_col) const; arma_warn_unused arma_inline bool in_range(const uword in_row, const span& col_span) const; arma_warn_unused arma_inline bool in_range(const span& row_span, const span& col_span) const; arma_warn_unused arma_inline bool in_range(const uword in_row, const uword in_col, const SizeMat& s) const; arma_warn_unused arma_inline bool in_range(const uword in_row, const uword in_col, const uword in_slice) const; arma_warn_unused arma_inline bool in_range(const span& row_span, const span& col_span, const span& slice_span) const; arma_warn_unused arma_inline bool in_range(const uword in_row, const uword in_col, const uword in_slice, const SizeCube& s) const; arma_cold inline bool save(const std::string name, const file_type type = arma_binary) const; arma_cold inline bool save( std::ostream& os, const file_type type = arma_binary) const; arma_cold inline bool load(const std::string name, const file_type type = auto_detect); arma_cold inline bool load( std::istream& is, const file_type type = auto_detect); arma_deprecated inline bool quiet_save(const std::string name, const file_type type = arma_binary) const; arma_deprecated inline bool quiet_save( std::ostream& os, const file_type type = arma_binary) const; arma_deprecated inline bool quiet_load(const std::string name, const file_type type = auto_detect); arma_deprecated inline bool quiet_load( std::istream& is, const file_type type = auto_detect); // for container-like functionality typedef oT value_type; typedef uword size_type; class iterator { public: inline iterator(field& in_M, const bool at_end = false); inline oT& operator* (); inline iterator& operator++(); inline void operator++(int); inline iterator& operator--(); inline void operator--(int); inline bool operator!=(const iterator& X) const; inline bool operator==(const iterator& X) const; arma_aligned field& M; arma_aligned uword i; }; class const_iterator { public: const_iterator(const field& in_M, const bool at_end = false); const_iterator(const iterator& X); inline const oT& operator*() const; inline const_iterator& operator++(); inline void operator++(int); inline const_iterator& operator--(); inline void operator--(int); inline bool operator!=(const const_iterator& X) const; inline bool operator==(const const_iterator& X) const; arma_aligned const field& M; arma_aligned uword i; }; inline iterator begin(); inline const_iterator begin() const; inline const_iterator cbegin() const; inline iterator end(); inline const_iterator end() const; inline const_iterator cend() const; inline void clear(); inline bool empty() const; inline uword size() const; private: inline void init(const field& x); inline void init(const uword n_rows_in, const uword n_cols_in); inline void init(const uword n_rows_in, const uword n_cols_in, const uword n_slices_in); inline void delete_objects(); inline void create_objects(); friend class field_aux; friend class subview_field; public: #if defined(ARMA_EXTRA_FIELD_PROTO) #include ARMA_INCFILE_WRAP(ARMA_EXTRA_FIELD_PROTO) #endif }; class field_aux { public: template inline static void reset_objects(field< oT >& x); template inline static void reset_objects(field< Mat >& x); template inline static void reset_objects(field< Col >& x); template inline static void reset_objects(field< Row >& x); template inline static void reset_objects(field< Cube >& x); inline static void reset_objects(field< std::string >& x); template inline static bool save(const field< oT >& x, const std::string& name, const file_type type, std::string& err_msg); template inline static bool save(const field< oT >& x, std::ostream& os, const file_type type, std::string& err_msg); template inline static bool load( field< oT >& x, const std::string& name, const file_type type, std::string& err_msg); template inline static bool load( field< oT >& x, std::istream& is, const file_type type, std::string& err_msg); template inline static bool save(const field< Mat >& x, const std::string& name, const file_type type, std::string& err_msg); template inline static bool save(const field< Mat >& x, std::ostream& os, const file_type type, std::string& err_msg); template inline static bool load( field< Mat >& x, const std::string& name, const file_type type, std::string& err_msg); template inline static bool load( field< Mat >& x, std::istream& is, const file_type type, std::string& err_msg); template inline static bool save(const field< Col >& x, const std::string& name, const file_type type, std::string& err_msg); template inline static bool save(const field< Col >& x, std::ostream& os, const file_type type, std::string& err_msg); template inline static bool load( field< Col >& x, const std::string& name, const file_type type, std::string& err_msg); template inline static bool load( field< Col >& x, std::istream& is, const file_type type, std::string& err_msg); template inline static bool save(const field< Row >& x, const std::string& name, const file_type type, std::string& err_msg); template inline static bool save(const field< Row >& x, std::ostream& os, const file_type type, std::string& err_msg); template inline static bool load( field< Row >& x, const std::string& name, const file_type type, std::string& err_msg); template inline static bool load( field< Row >& x, std::istream& is, const file_type type, std::string& err_msg); template inline static bool save(const field< Cube >& x, const std::string& name, const file_type type, std::string& err_msg); template inline static bool save(const field< Cube >& x, std::ostream& os, const file_type type, std::string& err_msg); template inline static bool load( field< Cube >& x, const std::string& name, const file_type type, std::string& err_msg); template inline static bool load( field< Cube >& x, std::istream& is, const file_type type, std::string& err_msg); inline static bool save(const field< std::string >& x, const std::string& name, const file_type type, std::string& err_msg); inline static bool save(const field< std::string >& x, std::ostream& os, const file_type type, std::string& err_msg); inline static bool load( field< std::string >& x, const std::string& name, const file_type type, std::string& err_msg); inline static bool load( field< std::string >& x, std::istream& is, const file_type type, std::string& err_msg); }; //! @} RcppArmadillo/inst/include/armadillo_bits/fn_shift.hpp0000644000176200001440000000566115030507611022707 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_shift //! @{ // TODO: deprecate shift() in favour of circshift() template arma_warn_unused arma_inline typename enable_if2 < is_arma_type::value && resolves_to_vector::yes, const Op >::result shift ( const T1& X, const sword N ) { arma_debug_sigprint(); const uword len = (N < 0) ? uword(-N) : uword(N); const uword neg = (N < 0) ? uword( 1) : uword(0); return Op(X, len, neg); } template arma_warn_unused inline typename enable_if2 < is_arma_type::value && resolves_to_vector::no, Mat >::result shift ( const T1& X, const sword N ) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword len = (N < 0) ? uword(-N) : uword(N); const uword neg = (N < 0) ? uword( 1) : uword(0); quasi_unwrap U(X); Mat out; op_shift::apply_noalias(out, U.M, len, neg, 0); return out; } template arma_warn_unused inline typename enable_if2 < (is_arma_type::value), Mat >::result shift ( const T1& X, const sword N, const uword dim ) { arma_debug_sigprint(); typedef typename T1::elem_type eT; arma_conform_check( (dim > 1), "shift(): parameter 'dim' must be 0 or 1" ); const uword len = (N < 0) ? uword(-N) : uword(N); const uword neg = (N < 0) ? uword( 1) : uword(0); quasi_unwrap U(X); Mat out; op_shift::apply_noalias(out, U.M, len, neg, dim); return out; } // template arma_warn_unused inline SpMat shift ( const SpBase& expr, const sword N, const uword dim = 0 ) { arma_debug_sigprint(); typedef typename T1::elem_type eT; arma_conform_check( (dim > 1), "shift(): parameter 'dim' must be 0 or 1" ); const uword len = (N < 0) ? uword(-N) : uword(N); const uword neg = (N < 0) ? uword( 1) : uword(0); unwrap_spmat U(expr.get_ref()); SpMat out; spop_shift::apply_noalias(out, U.M, len, neg, dim); return out; } //! @} RcppArmadillo/inst/include/armadillo_bits/diagview_meat.hpp0000644000176200001440000005421215030507611023710 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup diagview //! @{ template inline diagview::~diagview() { arma_debug_sigprint_this(this); } template arma_inline diagview::diagview(const Mat& in_m, const uword in_row_offset, const uword in_col_offset, const uword in_len) : m (in_m ) , row_offset(in_row_offset) , col_offset(in_col_offset) , n_rows (in_len ) , n_elem (in_len ) { arma_debug_sigprint_this(this); } template inline diagview::diagview(const diagview& in) : m (in.m ) , row_offset(in.row_offset) , col_offset(in.col_offset) , n_rows (in.n_rows ) , n_elem (in.n_elem ) { arma_debug_sigprint(arma_str::format("this: %x; in: %x") % this % &in); } template inline diagview::diagview(diagview&& in) : m (in.m ) , row_offset(in.row_offset) , col_offset(in.col_offset) , n_rows (in.n_rows ) , n_elem (in.n_elem ) { arma_debug_sigprint(arma_str::format("this: %x; in: %x") % this % &in); // for paranoia access::rw(in.row_offset) = 0; access::rw(in.col_offset) = 0; access::rw(in.n_rows ) = 0; access::rw(in.n_elem ) = 0; } //! set a diagonal of our matrix using a diagonal from a foreign matrix template inline void diagview::operator= (const diagview& x) { arma_debug_sigprint(); diagview& d = *this; arma_conform_check( (d.n_elem != x.n_elem), "diagview: diagonals have incompatible lengths" ); Mat& d_m = const_cast< Mat& >(d.m); const Mat& x_m = x.m; if(&d_m != &x_m) { const uword d_n_elem = d.n_elem; const uword d_row_offset = d.row_offset; const uword d_col_offset = d.col_offset; const uword x_row_offset = x.row_offset; const uword x_col_offset = x.col_offset; uword ii,jj; for(ii=0, jj=1; jj < d_n_elem; ii+=2, jj+=2) { const eT tmp_i = x_m.at(ii + x_row_offset, ii + x_col_offset); const eT tmp_j = x_m.at(jj + x_row_offset, jj + x_col_offset); d_m.at(ii + d_row_offset, ii + d_col_offset) = tmp_i; d_m.at(jj + d_row_offset, jj + d_col_offset) = tmp_j; } if(ii < d_n_elem) { d_m.at(ii + d_row_offset, ii + d_col_offset) = x_m.at(ii + x_row_offset, ii + x_col_offset); } } else { const Mat tmp = x; (*this).operator=(tmp); } } template inline void diagview::operator+=(const eT val) { arma_debug_sigprint(); Mat& t_m = const_cast< Mat& >(m); const uword t_n_elem = n_elem; const uword t_row_offset = row_offset; const uword t_col_offset = col_offset; for(uword ii=0; ii < t_n_elem; ++ii) { t_m.at( ii + t_row_offset, ii + t_col_offset) += val; } } template inline void diagview::operator-=(const eT val) { arma_debug_sigprint(); Mat& t_m = const_cast< Mat& >(m); const uword t_n_elem = n_elem; const uword t_row_offset = row_offset; const uword t_col_offset = col_offset; for(uword ii=0; ii < t_n_elem; ++ii) { t_m.at( ii + t_row_offset, ii + t_col_offset) -= val; } } template inline void diagview::operator*=(const eT val) { arma_debug_sigprint(); Mat& t_m = const_cast< Mat& >(m); const uword t_n_elem = n_elem; const uword t_row_offset = row_offset; const uword t_col_offset = col_offset; for(uword ii=0; ii < t_n_elem; ++ii) { t_m.at( ii + t_row_offset, ii + t_col_offset) *= val; } } template inline void diagview::operator/=(const eT val) { arma_debug_sigprint(); Mat& t_m = const_cast< Mat& >(m); const uword t_n_elem = n_elem; const uword t_row_offset = row_offset; const uword t_col_offset = col_offset; for(uword ii=0; ii < t_n_elem; ++ii) { t_m.at( ii + t_row_offset, ii + t_col_offset) /= val; } } //! set a diagonal of our matrix using data from a foreign object template template inline void diagview::operator= (const Base& o) { arma_debug_sigprint(); diagview& d = *this; Mat& d_m = const_cast< Mat& >(d.m); const uword d_n_elem = d.n_elem; const uword d_row_offset = d.row_offset; const uword d_col_offset = d.col_offset; const Proxy P( o.get_ref() ); arma_conform_check ( ( (d_n_elem != P.get_n_elem()) || ((P.get_n_rows() != 1) && (P.get_n_cols() != 1)) ), "diagview: given object has incompatible size" ); const bool have_alias = P.is_alias(d_m); if(have_alias) { arma_debug_print("aliasing detected"); } if( (is_Mat::stored_type>::value) || (Proxy::use_at) || (have_alias) ) { const unwrap_check::stored_type> tmp(P.Q, have_alias); const Mat& x = tmp.M; const eT* x_mem = x.memptr(); uword ii,jj; for(ii=0, jj=1; jj < d_n_elem; ii+=2, jj+=2) { const eT tmp_i = x_mem[ii]; const eT tmp_j = x_mem[jj]; d_m.at( ii + d_row_offset, ii + d_col_offset) = tmp_i; d_m.at( jj + d_row_offset, jj + d_col_offset) = tmp_j; } if(ii < d_n_elem) { d_m.at( ii + d_row_offset, ii + d_col_offset) = x_mem[ii]; } } else { typename Proxy::ea_type Pea = P.get_ea(); uword ii,jj; for(ii=0, jj=1; jj < d_n_elem; ii+=2, jj+=2) { const eT tmp_i = Pea[ii]; const eT tmp_j = Pea[jj]; d_m.at( ii + d_row_offset, ii + d_col_offset) = tmp_i; d_m.at( jj + d_row_offset, jj + d_col_offset) = tmp_j; } if(ii < d_n_elem) { d_m.at( ii + d_row_offset, ii + d_col_offset) = Pea[ii]; } } } template template inline void diagview::operator+=(const Base& o) { arma_debug_sigprint(); diagview& d = *this; Mat& d_m = const_cast< Mat& >(d.m); const uword d_n_elem = d.n_elem; const uword d_row_offset = d.row_offset; const uword d_col_offset = d.col_offset; const Proxy P( o.get_ref() ); arma_conform_check ( ( (d_n_elem != P.get_n_elem()) || ((P.get_n_rows() != 1) && (P.get_n_cols() != 1)) ), "diagview: given object has incompatible size" ); const bool have_alias = P.is_alias(d_m); if(have_alias) { arma_debug_print("aliasing detected"); } if( (is_Mat::stored_type>::value) || (Proxy::use_at) || (have_alias) ) { const unwrap_check::stored_type> tmp(P.Q, have_alias); const Mat& x = tmp.M; const eT* x_mem = x.memptr(); uword ii,jj; for(ii=0, jj=1; jj < d_n_elem; ii+=2, jj+=2) { const eT tmp_i = x_mem[ii]; const eT tmp_j = x_mem[jj]; d_m.at( ii + d_row_offset, ii + d_col_offset) += tmp_i; d_m.at( jj + d_row_offset, jj + d_col_offset) += tmp_j; } if(ii < d_n_elem) { d_m.at( ii + d_row_offset, ii + d_col_offset) += x_mem[ii]; } } else { typename Proxy::ea_type Pea = P.get_ea(); uword ii,jj; for(ii=0, jj=1; jj < d_n_elem; ii+=2, jj+=2) { const eT tmp_i = Pea[ii]; const eT tmp_j = Pea[jj]; d_m.at( ii + d_row_offset, ii + d_col_offset) += tmp_i; d_m.at( jj + d_row_offset, jj + d_col_offset) += tmp_j; } if(ii < d_n_elem) { d_m.at( ii + d_row_offset, ii + d_col_offset) += Pea[ii]; } } } template template inline void diagview::operator-=(const Base& o) { arma_debug_sigprint(); diagview& d = *this; Mat& d_m = const_cast< Mat& >(d.m); const uword d_n_elem = d.n_elem; const uword d_row_offset = d.row_offset; const uword d_col_offset = d.col_offset; const Proxy P( o.get_ref() ); arma_conform_check ( ( (d_n_elem != P.get_n_elem()) || ((P.get_n_rows() != 1) && (P.get_n_cols() != 1)) ), "diagview: given object has incompatible size" ); const bool have_alias = P.is_alias(d_m); if(have_alias) { arma_debug_print("aliasing detected"); } if( (is_Mat::stored_type>::value) || (Proxy::use_at) || (have_alias) ) { const unwrap_check::stored_type> tmp(P.Q, have_alias); const Mat& x = tmp.M; const eT* x_mem = x.memptr(); uword ii,jj; for(ii=0, jj=1; jj < d_n_elem; ii+=2, jj+=2) { const eT tmp_i = x_mem[ii]; const eT tmp_j = x_mem[jj]; d_m.at( ii + d_row_offset, ii + d_col_offset) -= tmp_i; d_m.at( jj + d_row_offset, jj + d_col_offset) -= tmp_j; } if(ii < d_n_elem) { d_m.at( ii + d_row_offset, ii + d_col_offset) -= x_mem[ii]; } } else { typename Proxy::ea_type Pea = P.get_ea(); uword ii,jj; for(ii=0, jj=1; jj < d_n_elem; ii+=2, jj+=2) { const eT tmp_i = Pea[ii]; const eT tmp_j = Pea[jj]; d_m.at( ii + d_row_offset, ii + d_col_offset) -= tmp_i; d_m.at( jj + d_row_offset, jj + d_col_offset) -= tmp_j; } if(ii < d_n_elem) { d_m.at( ii + d_row_offset, ii + d_col_offset) -= Pea[ii]; } } } template template inline void diagview::operator%=(const Base& o) { arma_debug_sigprint(); diagview& d = *this; Mat& d_m = const_cast< Mat& >(d.m); const uword d_n_elem = d.n_elem; const uword d_row_offset = d.row_offset; const uword d_col_offset = d.col_offset; const Proxy P( o.get_ref() ); arma_conform_check ( ( (d_n_elem != P.get_n_elem()) || ((P.get_n_rows() != 1) && (P.get_n_cols() != 1)) ), "diagview: given object has incompatible size" ); const bool have_alias = P.is_alias(d_m); if(have_alias) { arma_debug_print("aliasing detected"); } if( (is_Mat::stored_type>::value) || (Proxy::use_at) || (have_alias) ) { const unwrap_check::stored_type> tmp(P.Q, have_alias); const Mat& x = tmp.M; const eT* x_mem = x.memptr(); uword ii,jj; for(ii=0, jj=1; jj < d_n_elem; ii+=2, jj+=2) { const eT tmp_i = x_mem[ii]; const eT tmp_j = x_mem[jj]; d_m.at( ii + d_row_offset, ii + d_col_offset) *= tmp_i; d_m.at( jj + d_row_offset, jj + d_col_offset) *= tmp_j; } if(ii < d_n_elem) { d_m.at( ii + d_row_offset, ii + d_col_offset) *= x_mem[ii]; } } else { typename Proxy::ea_type Pea = P.get_ea(); uword ii,jj; for(ii=0, jj=1; jj < d_n_elem; ii+=2, jj+=2) { const eT tmp_i = Pea[ii]; const eT tmp_j = Pea[jj]; d_m.at( ii + d_row_offset, ii + d_col_offset) *= tmp_i; d_m.at( jj + d_row_offset, jj + d_col_offset) *= tmp_j; } if(ii < d_n_elem) { d_m.at( ii + d_row_offset, ii + d_col_offset) *= Pea[ii]; } } } template template inline void diagview::operator/=(const Base& o) { arma_debug_sigprint(); diagview& d = *this; Mat& d_m = const_cast< Mat& >(d.m); const uword d_n_elem = d.n_elem; const uword d_row_offset = d.row_offset; const uword d_col_offset = d.col_offset; const Proxy P( o.get_ref() ); arma_conform_check ( ( (d_n_elem != P.get_n_elem()) || ((P.get_n_rows() != 1) && (P.get_n_cols() != 1)) ), "diagview: given object has incompatible size" ); const bool have_alias = P.is_alias(d_m); if(have_alias) { arma_debug_print("aliasing detected"); } if( (is_Mat::stored_type>::value) || (Proxy::use_at) || (have_alias) ) { const unwrap_check::stored_type> tmp(P.Q, have_alias); const Mat& x = tmp.M; const eT* x_mem = x.memptr(); uword ii,jj; for(ii=0, jj=1; jj < d_n_elem; ii+=2, jj+=2) { const eT tmp_i = x_mem[ii]; const eT tmp_j = x_mem[jj]; d_m.at( ii + d_row_offset, ii + d_col_offset) /= tmp_i; d_m.at( jj + d_row_offset, jj + d_col_offset) /= tmp_j; } if(ii < d_n_elem) { d_m.at( ii + d_row_offset, ii + d_col_offset) /= x_mem[ii]; } } else { typename Proxy::ea_type Pea = P.get_ea(); uword ii,jj; for(ii=0, jj=1; jj < d_n_elem; ii+=2, jj+=2) { const eT tmp_i = Pea[ii]; const eT tmp_j = Pea[jj]; d_m.at( ii + d_row_offset, ii + d_col_offset) /= tmp_i; d_m.at( jj + d_row_offset, jj + d_col_offset) /= tmp_j; } if(ii < d_n_elem) { d_m.at( ii + d_row_offset, ii + d_col_offset) /= Pea[ii]; } } } //! extract a diagonal and store it as a column vector template inline void diagview::extract(Mat& out, const diagview& in) { arma_debug_sigprint(); // NOTE: we're assuming that the matrix has already been set to the correct size and there is no aliasing; // size setting and alias checking is done by either the Mat constructor or operator=() const Mat& in_m = in.m; const uword in_n_elem = in.n_elem; const uword in_row_offset = in.row_offset; const uword in_col_offset = in.col_offset; eT* out_mem = out.memptr(); uword i,j; for(i=0, j=1; j < in_n_elem; i+=2, j+=2) { const eT tmp_i = in_m.at( i + in_row_offset, i + in_col_offset ); const eT tmp_j = in_m.at( j + in_row_offset, j + in_col_offset ); out_mem[i] = tmp_i; out_mem[j] = tmp_j; } if(i < in_n_elem) { out_mem[i] = in_m.at( i + in_row_offset, i + in_col_offset ); } } //! X += Y.diag() template inline void diagview::plus_inplace(Mat& out, const diagview& in) { arma_debug_sigprint(); arma_conform_assert_same_size(out.n_rows, out.n_cols, in.n_rows, in.n_cols, "addition"); const Mat& in_m = in.m; const uword in_n_elem = in.n_elem; const uword in_row_offset = in.row_offset; const uword in_col_offset = in.col_offset; eT* out_mem = out.memptr(); uword i,j; for(i=0, j=1; j < in_n_elem; i+=2, j+=2) { const eT tmp_i = in_m.at( i + in_row_offset, i + in_col_offset ); const eT tmp_j = in_m.at( j + in_row_offset, j + in_col_offset ); out_mem[i] += tmp_i; out_mem[j] += tmp_j; } if(i < in_n_elem) { out_mem[i] += in_m.at( i + in_row_offset, i + in_col_offset ); } } //! X -= Y.diag() template inline void diagview::minus_inplace(Mat& out, const diagview& in) { arma_debug_sigprint(); arma_conform_assert_same_size(out.n_rows, out.n_cols, in.n_rows, in.n_cols, "subtraction"); const Mat& in_m = in.m; const uword in_n_elem = in.n_elem; const uword in_row_offset = in.row_offset; const uword in_col_offset = in.col_offset; eT* out_mem = out.memptr(); uword i,j; for(i=0, j=1; j < in_n_elem; i+=2, j+=2) { const eT tmp_i = in_m.at( i + in_row_offset, i + in_col_offset ); const eT tmp_j = in_m.at( j + in_row_offset, j + in_col_offset ); out_mem[i] -= tmp_i; out_mem[j] -= tmp_j; } if(i < in_n_elem) { out_mem[i] -= in_m.at( i + in_row_offset, i + in_col_offset ); } } //! X %= Y.diag() template inline void diagview::schur_inplace(Mat& out, const diagview& in) { arma_debug_sigprint(); arma_conform_assert_same_size(out.n_rows, out.n_cols, in.n_rows, in.n_cols, "element-wise multiplication"); const Mat& in_m = in.m; const uword in_n_elem = in.n_elem; const uword in_row_offset = in.row_offset; const uword in_col_offset = in.col_offset; eT* out_mem = out.memptr(); uword i,j; for(i=0, j=1; j < in_n_elem; i+=2, j+=2) { const eT tmp_i = in_m.at( i + in_row_offset, i + in_col_offset ); const eT tmp_j = in_m.at( j + in_row_offset, j + in_col_offset ); out_mem[i] *= tmp_i; out_mem[j] *= tmp_j; } if(i < in_n_elem) { out_mem[i] *= in_m.at( i + in_row_offset, i + in_col_offset ); } } //! X /= Y.diag() template inline void diagview::div_inplace(Mat& out, const diagview& in) { arma_debug_sigprint(); arma_conform_assert_same_size(out.n_rows, out.n_cols, in.n_rows, in.n_cols, "element-wise division"); const Mat& in_m = in.m; const uword in_n_elem = in.n_elem; const uword in_row_offset = in.row_offset; const uword in_col_offset = in.col_offset; eT* out_mem = out.memptr(); uword i,j; for(i=0, j=1; j < in_n_elem; i+=2, j+=2) { const eT tmp_i = in_m.at( i + in_row_offset, i + in_col_offset ); const eT tmp_j = in_m.at( j + in_row_offset, j + in_col_offset ); out_mem[i] /= tmp_i; out_mem[j] /= tmp_j; } if(i < in_n_elem) { out_mem[i] /= in_m.at( i + in_row_offset, i + in_col_offset ); } } template arma_inline eT diagview::at_alt(const uword ii) const { return m.at(ii+row_offset, ii+col_offset); } template arma_inline eT& diagview::operator[](const uword ii) { return (const_cast< Mat& >(m)).at(ii+row_offset, ii+col_offset); } template arma_inline eT diagview::operator[](const uword ii) const { return m.at(ii+row_offset, ii+col_offset); } template arma_inline eT& diagview::at(const uword ii) { return (const_cast< Mat& >(m)).at(ii+row_offset, ii+col_offset); } template arma_inline eT diagview::at(const uword ii) const { return m.at(ii+row_offset, ii+col_offset); } template arma_inline eT& diagview::operator()(const uword ii) { arma_conform_check_bounds( (ii >= n_elem), "diagview::operator(): out of bounds" ); return (const_cast< Mat& >(m)).at(ii+row_offset, ii+col_offset); } template arma_inline eT diagview::operator()(const uword ii) const { arma_conform_check_bounds( (ii >= n_elem), "diagview::operator(): out of bounds" ); return m.at(ii+row_offset, ii+col_offset); } template arma_inline eT& diagview::at(const uword row, const uword) { return (const_cast< Mat& >(m)).at(row+row_offset, row+col_offset); } template arma_inline eT diagview::at(const uword row, const uword) const { return m.at(row+row_offset, row+col_offset); } template arma_inline eT& diagview::operator()(const uword row, const uword col) { arma_conform_check_bounds( ((row >= n_elem) || (col > 0)), "diagview::operator(): out of bounds" ); return (const_cast< Mat& >(m)).at(row+row_offset, row+col_offset); } template arma_inline eT diagview::operator()(const uword row, const uword col) const { arma_conform_check_bounds( ((row >= n_elem) || (col > 0)), "diagview::operator(): out of bounds" ); return m.at(row+row_offset, row+col_offset); } template inline void diagview::replace(const eT old_val, const eT new_val) { arma_debug_sigprint(); Mat& x = const_cast< Mat& >(m); const uword local_n_elem = n_elem; if(arma_isnan(old_val)) { for(uword ii=0; ii < local_n_elem; ++ii) { eT& val = x.at(ii+row_offset, ii+col_offset); val = (arma_isnan(val)) ? new_val : val; } } else { for(uword ii=0; ii < local_n_elem; ++ii) { eT& val = x.at(ii+row_offset, ii+col_offset); val = (val == old_val) ? new_val : val; } } } template inline void diagview::clean(const typename get_pod_type::result threshold) { arma_debug_sigprint(); Mat tmp(*this); tmp.clean(threshold); (*this).operator=(tmp); } template inline void diagview::clamp(const eT min_val, const eT max_val) { arma_debug_sigprint(); Mat tmp(*this); tmp.clamp(min_val, max_val); (*this).operator=(tmp); } template inline void diagview::fill(const eT val) { arma_debug_sigprint(); Mat& x = const_cast< Mat& >(m); const uword local_n_elem = n_elem; for(uword ii=0; ii < local_n_elem; ++ii) { x.at(ii+row_offset, ii+col_offset) = val; } } template inline void diagview::zeros() { arma_debug_sigprint(); (*this).fill(eT(0)); } template inline void diagview::ones() { arma_debug_sigprint(); (*this).fill(eT(1)); } template inline void diagview::randu() { arma_debug_sigprint(); Mat& x = const_cast< Mat& >(m); const uword local_n_elem = n_elem; Col tmp(local_n_elem, arma_nozeros_indicator()); tmp.randu(); for(uword ii=0; ii < local_n_elem; ++ii) { x.at(ii+row_offset, ii+col_offset) = tmp[ii]; } } template inline void diagview::randn() { arma_debug_sigprint(); Mat& x = const_cast< Mat& >(m); const uword local_n_elem = n_elem; Col tmp(local_n_elem, arma_nozeros_indicator()); tmp.randn(); for(uword ii=0; ii < local_n_elem; ++ii) { x.at(ii+row_offset, ii+col_offset) = tmp[ii]; } } template template inline bool diagview::is_alias(const Mat& X) const { arma_debug_sigprint(); return m.is_alias(X); } //! @} RcppArmadillo/inst/include/armadillo_bits/op_median_meat.hpp0000644000176200001440000001726615030507543024060 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_median //! @{ template inline void op_median::apply(Mat& out, const Op& expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const quasi_unwrap U(expr.m); const uword dim = expr.aux_uword_a; arma_conform_check( U.M.internal_has_nan(), "median(): detected NaN" ); arma_conform_check( (dim > 1), "median(): parameter 'dim' must be 0 or 1" ); if(U.is_alias(out)) { Mat tmp; op_median::apply_noalias(tmp, U.M, dim); out.steal_mem(tmp); } else { op_median::apply_noalias(out, U.M, dim); } } template inline void op_median::apply_noalias(Mat& out, const Mat& X, const uword dim, const typename arma_not_cx::result* junk) { arma_debug_sigprint(); arma_ignore(junk); const uword X_n_rows = X.n_rows; const uword X_n_cols = X.n_cols; if(dim == 0) // in each column { arma_debug_print("op_median::apply(): dim = 0"); out.set_size((X_n_rows > 0) ? 1 : 0, X_n_cols); if(X_n_rows > 0) { std::vector tmp_vec(X_n_rows); for(uword col=0; col < X_n_cols; ++col) { arrayops::copy( &(tmp_vec[0]), X.colptr(col), X_n_rows ); out[col] = op_median::direct_median(tmp_vec); } } } else if(dim == 1) // in each row { arma_debug_print("op_median::apply(): dim = 1"); out.set_size(X_n_rows, (X_n_cols > 0) ? 1 : 0); if(X_n_cols > 0) { std::vector tmp_vec(X_n_cols); for(uword row=0; row < X_n_rows; ++row) { for(uword col=0; col < X_n_cols; ++col) { tmp_vec[col] = X.at(row,col); } out[row] = op_median::direct_median(tmp_vec); } } } } template inline void op_median::apply_noalias(Mat& out, const Mat& X, const uword dim, const typename arma_cx_only::result* junk) { arma_debug_sigprint(); arma_ignore(junk); typedef typename get_pod_type::result T; const uword X_n_rows = X.n_rows; const uword X_n_cols = X.n_cols; if(dim == 0) // in each column { arma_debug_print("op_median::apply(): dim = 0"); out.set_size((X_n_rows > 0) ? 1 : 0, X_n_cols); if(X_n_rows > 0) { std::vector< arma_cx_median_packet > tmp_vec(X_n_rows); for(uword col=0; col 0) ? 1 : 0); if(X_n_cols > 0) { std::vector< arma_cx_median_packet > tmp_vec(X_n_cols); for(uword row=0; row inline typename T1::elem_type op_median::median_vec ( const T1& X, const typename arma_not_cx::result* junk ) { arma_debug_sigprint(); arma_ignore(junk); typedef typename T1::elem_type eT; const quasi_unwrap U(X); const uword n_elem = U.M.n_elem; if(n_elem == 0) { arma_conform_check(true, "median(): object has no elements"); return Datum::nan; } arma_conform_check( U.M.internal_has_nan(), "median(): detected NaN" ); std::vector tmp_vec(n_elem); arrayops::copy( &(tmp_vec[0]), U.M.memptr(), n_elem ); return op_median::direct_median(tmp_vec); } template inline typename T1::elem_type op_median::median_vec ( const T1& X, const typename arma_cx_only::result* junk ) { arma_debug_sigprint(); arma_ignore(junk); typedef typename T1::elem_type eT; typedef typename T1::pod_type T; const quasi_unwrap U(X); const uword n_elem = U.M.n_elem; if(n_elem == 0) { arma_conform_check(true, "median(): object has no elements"); return Datum::nan; } arma_conform_check( U.M.internal_has_nan(), "median(): detected NaN" ); std::vector< arma_cx_median_packet > tmp_vec(n_elem); const eT* A = U.M.memptr(); for(uword i=0; i inline eT op_median::direct_median(std::vector& X) { arma_debug_sigprint(); const uword n_elem = uword(X.size()); const uword half = n_elem/2; typename std::vector::iterator first = X.begin(); typename std::vector::iterator nth = first + half; typename std::vector::iterator pastlast = X.end(); std::nth_element(first, nth, pastlast); if((n_elem % 2) == 0) // even number of elements { typename std::vector::iterator start = X.begin(); typename std::vector::iterator pastend = start + half; const eT val1 = (*nth); const eT val2 = (*(std::max_element(start, pastend))); return op_mean::robust_mean(val1, val2); } else // odd number of elements { return (*nth); } } template inline void op_median::direct_cx_median_index ( uword& out_index1, uword& out_index2, std::vector< arma_cx_median_packet >& X ) { arma_debug_sigprint(); typedef arma_cx_median_packet eT; const uword n_elem = uword(X.size()); const uword half = n_elem/2; typename std::vector::iterator first = X.begin(); typename std::vector::iterator nth = first + half; typename std::vector::iterator pastlast = X.end(); std::nth_element(first, nth, pastlast); out_index1 = (*nth).index; if((n_elem % 2) == 0) // even number of elements { typename std::vector::iterator start = X.begin(); typename std::vector::iterator pastend = start + half; out_index2 = (*(std::max_element(start, pastend))).index; } else // odd number of elements { out_index2 = out_index1; } } //! @} RcppArmadillo/inst/include/armadillo_bits/op_sp_min_meat.hpp0000644000176200001440000003774114634016465024117 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_sp_min //! @{ template inline void op_sp_min::apply(Mat& out, const mtSpReduceOp& in) { arma_debug_sigprint(); const uword dim = in.aux_uword_a; arma_conform_check( (dim > 1), "min(): parameter 'dim' must be 0 or 1" ); const SpProxy p(in.m); const uword p_n_rows = p.get_n_rows(); const uword p_n_cols = p.get_n_cols(); if( (p_n_rows == 0) || (p_n_cols == 0) || (p.get_n_nonzero() == 0) ) { if(dim == 0) { out.zeros((p_n_rows > 0) ? 1 : 0, p_n_cols); } if(dim == 1) { out.zeros(p_n_rows, (p_n_cols > 0) ? 1 : 0); } return; } op_sp_min::apply_proxy(out, p, dim); } template inline void op_sp_min::apply_proxy ( Mat& out, const SpProxy& p, const uword dim, const typename arma_not_cx::result* junk ) { arma_debug_sigprint(); arma_ignore(junk); typedef typename T1::elem_type eT; typename SpProxy::const_iterator_type it = p.begin(); typename SpProxy::const_iterator_type it_end = p.end(); const uword p_n_cols = p.get_n_cols(); const uword p_n_rows = p.get_n_rows(); if(dim == 0) // find the minimum in each column { out.zeros(1, p_n_cols); urowvec count(p_n_cols, arma_zeros_indicator()); while(it != it_end) { const uword col = it.col(); out[col] = (count[col] == 0) ? (*it) : (std::min)(out[col], (*it)); count[col]++; ++it; } for(uword col=0; col inline typename T1::elem_type op_sp_min::vector_min ( const T1& x, const typename arma_not_cx::result* junk ) { arma_debug_sigprint(); arma_ignore(junk); typedef typename T1::elem_type eT; const SpProxy p(x); if(p.get_n_elem() == 0) { arma_conform_check(true, "min(): object has no elements"); return Datum::nan; } if(p.get_n_nonzero() == 0) { return eT(0); } if(SpProxy::use_iterator == false) { // direct access of values if(p.get_n_nonzero() == p.get_n_elem()) { return op_min::direct_min(p.get_values(), p.get_n_nonzero()); } else { return (std::min)(eT(0), op_min::direct_min(p.get_values(), p.get_n_nonzero())); } } else { // use iterator typename SpProxy::const_iterator_type it = p.begin(); typename SpProxy::const_iterator_type it_end = p.end(); eT result = (*it); ++it; while(it != it_end) { if((*it) < result) { result = (*it); } ++it; } if(p.get_n_nonzero() == p.get_n_elem()) { return result; } else { return (std::min)(eT(0), result); } } } template inline typename arma_not_cx::result op_sp_min::min(const SpBase& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const SpProxy P(X.get_ref()); const uword n_elem = P.get_n_elem(); const uword n_nonzero = P.get_n_nonzero(); if(n_elem == 0) { arma_conform_check(true, "min(): object has no elements"); return Datum::nan; } eT min_val = priv::most_pos(); if(SpProxy::use_iterator) { // We have to iterate over the elements. typedef typename SpProxy::const_iterator_type it_type; it_type it = P.begin(); it_type it_end = P.end(); while(it != it_end) { if((*it) < min_val) { min_val = *it; } ++it; } } else { // We can do direct access of the values, row_indices, and col_ptrs. // We don't need the location of the min value, so we can just call out to // other functions... min_val = op_min::direct_min(P.get_values(), n_nonzero); } if(n_elem == n_nonzero) { return min_val; } else { return (std::min)(eT(0), min_val); } } template inline typename arma_not_cx::result op_sp_min::min_with_index(const SpProxy& P, uword& index_of_min_val) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword n_elem = P.get_n_elem(); const uword n_nonzero = P.get_n_nonzero(); const uword n_rows = P.get_n_rows(); if(n_elem == 0) { arma_conform_check(true, "min(): object has no elements"); index_of_min_val = uword(0); return Datum::nan; } eT min_val = priv::most_pos(); if(SpProxy::use_iterator) { // We have to iterate over the elements. typedef typename SpProxy::const_iterator_type it_type; it_type it = P.begin(); it_type it_end = P.end(); while(it != it_end) { if((*it) < min_val) { min_val = *it; index_of_min_val = it.row() + it.col() * n_rows; } ++it; } } else { // We can do direct access. min_val = op_min::direct_min(P.get_values(), n_nonzero, index_of_min_val); // Convert to actual position in matrix. const uword row = P.get_row_indices()[index_of_min_val]; uword col = 0; while(P.get_col_ptrs()[++col] < index_of_min_val + 1) { } index_of_min_val = (col - 1) * n_rows + row; } if(n_elem != n_nonzero) { min_val = (std::min)(eT(0), min_val); // If the min_val is a nonzero element, we need its actual position in the matrix. if(min_val == eT(0)) { // Find first zero element. uword last_row = 0; uword last_col = 0; typedef typename SpProxy::const_iterator_type it_type; it_type it = P.begin(); it_type it_end = P.end(); while(it != it_end) { // Have we moved more than one position from the last place? if((it.col() == last_col) && (it.row() - last_row > 1)) { index_of_min_val = it.col() * n_rows + last_row + 1; break; } else if((it.col() >= last_col + 1) && (last_row < n_rows - 1)) { index_of_min_val = last_col * n_rows + last_row + 1; break; } else if((it.col() == last_col + 1) && (it.row() > 0)) { index_of_min_val = it.col() * n_rows; break; } else if(it.col() > last_col + 1) { index_of_min_val = (last_col + 1) * n_rows; break; } last_row = it.row(); last_col = it.col(); ++it; } } } return min_val; } template inline void op_sp_min::apply_proxy ( Mat& out, const SpProxy& p, const uword dim, const typename arma_cx_only::result* junk ) { arma_debug_sigprint(); arma_ignore(junk); typedef typename T1::elem_type eT; typedef typename get_pod_type::result T; typename SpProxy::const_iterator_type it = p.begin(); typename SpProxy::const_iterator_type it_end = p.end(); const uword p_n_cols = p.get_n_cols(); const uword p_n_rows = p.get_n_rows(); if(dim == 0) // find the minimum in each column { out.zeros(1, p_n_cols); Row absval(p_n_cols, arma_zeros_indicator()); urowvec count(p_n_cols, arma_zeros_indicator()); while(it != it_end) { const uword col = it.col(); const eT& v = (*it); const T a = std::abs(v); if(count[col] == 0) { absval[col] = a; out[col] = v; } else { if(a < absval[col]) { absval[col] = a; out[col] = v; } } count[col]++; ++it; } for(uword col=0; col < p_n_cols; ++col) { if(count[col] < p_n_rows) { if(T(0) < absval[col]) { out[col] = eT(0); } } } } else if(dim == 1) // find the minimum in each row { out.zeros(p_n_rows, 1); Col absval(p_n_rows, arma_zeros_indicator()); ucolvec count(p_n_rows, arma_zeros_indicator()); while(it != it_end) { const uword row = it.row(); const eT& v = (*it); const T a = std::abs(v); if(count[row] == 0) { absval[row] = a; out[row] = v; } else { if(a < absval[row]) { absval[row] = a; out[row] = v; } } count[row]++; ++it; } for(uword row=0; row < p_n_rows; ++row) { if(count[row] < p_n_cols) { if(T(0) < absval[row]) { out[row] = eT(0); } } } } } template inline typename T1::elem_type op_sp_min::vector_min ( const T1& x, const typename arma_cx_only::result* junk ) { arma_debug_sigprint(); arma_ignore(junk); typedef typename T1::elem_type eT; typedef typename get_pod_type::result T; const SpProxy p(x); if(p.get_n_elem() == 0) { arma_conform_check(true, "min(): object has no elements"); return Datum::nan; } if(p.get_n_nonzero() == 0) { return eT(0); } if(SpProxy::use_iterator == false) { // direct access of values if(p.get_n_nonzero() == p.get_n_elem()) { return op_min::direct_min(p.get_values(), p.get_n_nonzero()); } else { const eT val1 = eT(0); const eT val2 = op_min::direct_min(p.get_values(), p.get_n_nonzero()); return ( std::abs(val1) < std::abs(val2) ) ? val1 : val2; } } else { // use iterator typename SpProxy::const_iterator_type it = p.begin(); typename SpProxy::const_iterator_type it_end = p.end(); eT best_val_orig = *it; T best_val_abs = std::abs(best_val_orig); ++it; while(it != it_end) { eT val_orig = *it; T val_abs = std::abs(val_orig); if(val_abs < best_val_abs) { best_val_abs = val_abs; best_val_orig = val_orig; } ++it; } if(p.get_n_nonzero() == p.get_n_elem()) { return best_val_orig; } else { const eT val1 = eT(0); return ( std::abs(val1) < best_val_abs ) ? val1 : best_val_orig; } } } template inline typename arma_cx_only::result op_sp_min::min(const SpBase& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; typedef typename get_pod_type::result T; const SpProxy P(X.get_ref()); const uword n_elem = P.get_n_elem(); const uword n_nonzero = P.get_n_nonzero(); if(n_elem == 0) { arma_conform_check(true, "min(): object has no elements"); return Datum::nan; } T min_val = priv::most_pos(); eT ret_val; if(SpProxy::use_iterator) { // We have to iterate over the elements. typedef typename SpProxy::const_iterator_type it_type; it_type it = P.begin(); it_type it_end = P.end(); while(it != it_end) { const T tmp_val = std::abs(*it); if(tmp_val < min_val) { min_val = tmp_val; ret_val = *it; } ++it; } } else { // We can do direct access of the values, row_indices, and col_ptrs. // We don't need the location of the min value, so we can just call out to // other functions... ret_val = op_min::direct_min(P.get_values(), n_nonzero); min_val = std::abs(ret_val); } if(n_elem == n_nonzero) { return ret_val; } else { return (T(0) < min_val) ? eT(0) : ret_val; } } template inline typename arma_cx_only::result op_sp_min::min_with_index(const SpProxy& P, uword& index_of_min_val) { arma_debug_sigprint(); typedef typename T1::elem_type eT; typedef typename get_pod_type::result T; const uword n_elem = P.get_n_elem(); const uword n_nonzero = P.get_n_nonzero(); const uword n_rows = P.get_n_rows(); if(n_elem == 0) { arma_conform_check(true, "min(): object has no elements"); index_of_min_val = uword(0); return Datum::nan; } T min_val = priv::most_pos(); if(SpProxy::use_iterator) { // We have to iterate over the elements. typedef typename SpProxy::const_iterator_type it_type; it_type it = P.begin(); it_type it_end = P.end(); while(it != it_end) { const T tmp_val = std::abs(*it); if(tmp_val < min_val) { min_val = tmp_val; index_of_min_val = it.row() + it.col() * n_rows; } ++it; } } else { // We can do direct access. min_val = std::abs(op_min::direct_min(P.get_values(), n_nonzero, index_of_min_val)); // Convert to actual position in matrix. const uword row = P.get_row_indices()[index_of_min_val]; uword col = 0; while(P.get_col_ptrs()[++col] < index_of_min_val + 1) { } index_of_min_val = (col - 1) * n_rows + row; } if(n_elem != n_nonzero) { min_val = (std::min)(T(0), min_val); // If the min_val is a nonzero element, we need its actual position in the matrix. if(min_val == T(0)) { // Find first zero element. uword last_row = 0; uword last_col = 0; typedef typename SpProxy::const_iterator_type it_type; it_type it = P.begin(); it_type it_end = P.end(); while(it != it_end) { // Have we moved more than one position from the last place? if((it.col() == last_col) && (it.row() - last_row > 1)) { index_of_min_val = it.col() * n_rows + last_row + 1; break; } else if((it.col() >= last_col + 1) && (last_row < n_rows - 1)) { index_of_min_val = last_col * n_rows + last_row + 1; break; } else if((it.col() == last_col + 1) && (it.row() > 0)) { index_of_min_val = it.col() * n_rows; break; } else if(it.col() > last_col + 1) { index_of_min_val = (last_col + 1) * n_rows; break; } last_row = it.row(); last_col = it.col(); ++it; } } } return P[index_of_min_val]; } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_sort_index.hpp0000644000176200001440000000513715030507611023746 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_sort_index //! @{ template arma_warn_unused arma_inline const mtOp sort_index ( const Base& X ) { arma_debug_sigprint(); return mtOp(X.get_ref(), uword(0), uword(0)); } template arma_warn_unused inline typename enable_if2 < ( (is_arma_type::value) && (is_same_type::value) ), const mtOp >::result sort_index ( const T1& X, const T2* sort_direction ) { arma_debug_sigprint(); const char sig = (sort_direction != nullptr) ? sort_direction[0] : char(0); arma_conform_check( ((sig != 'a') && (sig != 'd')), "sort_index(): unknown sort direction" ); return mtOp(X, ((sig == 'a') ? uword(0) : uword(1)), uword(0)); } // // DO NOT USE: kept only for compatibility with old user code template arma_warn_unused arma_inline const mtOp stable_sort_index ( const Base& X ) { arma_debug_sigprint(); return mtOp(X.get_ref(), uword(0), uword(0)); } // DO NOT USE: kept only for compatibility with old user code template arma_warn_unused inline typename enable_if2 < ( (is_arma_type::value) && (is_same_type::value) ), const mtOp >::result stable_sort_index ( const T1& X, const T2* sort_direction ) { arma_debug_sigprint(); const char sig = (sort_direction != nullptr) ? sort_direction[0] : char(0); arma_conform_check( ((sig != 'a') && (sig != 'd')), "stable_sort_index(): unknown sort direction" ); return mtOp(X, ((sig == 'a') ? uword(0) : uword(1)), uword(0)); } //! @} RcppArmadillo/inst/include/armadillo_bits/op_find_unique_meat.hpp0000644000176200001440000000602114631567470025127 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_find_unique //! @{ template inline bool op_find_unique::apply_helper(Mat& out, const Proxy& P, const bool ascending_indices) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword n_elem = P.get_n_elem(); if(n_elem == 0) { out.set_size(0,1); return true; } if(n_elem == 1) { out.set_size(1,1); out[0] = 0; return true; } uvec indices(n_elem, arma_nozeros_indicator()); std::vector< arma_find_unique_packet > packet_vec(n_elem); if(Proxy::use_at == false) { typename Proxy::ea_type Pea = P.get_ea(); for(uword i=0; i comparator; std::sort( packet_vec.begin(), packet_vec.end(), comparator ); uword* indices_mem = indices.memptr(); indices_mem[0] = packet_vec[0].index; uword count = 1; for(uword i=1; i < n_elem; ++i) { const eT diff = packet_vec[i-1].val - packet_vec[i].val; if(diff != eT(0)) { indices_mem[count] = packet_vec[i].index; ++count; } } out.steal_mem_col(indices,count); if(ascending_indices) { std::sort(out.begin(), out.end()); } return true; } template inline void op_find_unique::apply(Mat& out, const mtOp& in) { arma_debug_sigprint(); const Proxy P(in.m); const bool ascending_indices = (in.aux_uword_a == uword(1)); const bool all_non_nan = op_find_unique::apply_helper(out, P, ascending_indices); if(all_non_nan == false) { arma_conform_check( true, "find_unique(): detected NaN" ); out.reset(); } } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_resize.hpp0000644000176200001440000000666314752446051023110 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_resize //! @{ template arma_warn_unused inline const Op resize(const Base& X, const uword in_n_rows, const uword in_n_cols) { arma_debug_sigprint(); return Op(X.get_ref(), in_n_rows, in_n_cols); } template arma_warn_unused inline const Op resize(const Base& X, const SizeMat& s) { arma_debug_sigprint(); return Op(X.get_ref(), s.n_rows, s.n_cols); } template arma_warn_unused inline const OpCube resize(const BaseCube& X, const uword in_n_rows, const uword in_n_cols, const uword in_n_slices) { arma_debug_sigprint(); return OpCube(X.get_ref(), in_n_rows, in_n_cols, in_n_slices); } template arma_warn_unused inline const OpCube resize(const BaseCube& X, const SizeCube& s) { arma_debug_sigprint(); return OpCube(X.get_ref(), s.n_rows, s.n_cols, s.n_slices); } template arma_warn_unused inline const SpOp resize(const SpBase& X, const uword in_n_rows, const uword in_n_cols) { arma_debug_sigprint(); return SpOp(X.get_ref(), in_n_rows, in_n_cols); } template arma_warn_unused inline const SpOp resize(const SpBase& X, const SizeMat& s) { arma_debug_sigprint(); return SpOp(X.get_ref(), s.n_rows, s.n_cols); } template arma_warn_unused inline field resize(const field& A, const uword in_n_rows, const uword in_n_cols, const uword in_n_slices = uword(1)) { arma_debug_sigprint(); // better-than-nothing implementation field B(in_n_rows, in_n_cols, in_n_slices); if((B.n_elem > 0) && (A.n_elem > 0)) { const uword end_row = (std::min)(in_n_rows, A.n_rows ) - 1; const uword end_col = (std::min)(in_n_cols, A.n_cols ) - 1; const uword end_slice = (std::min)(in_n_slices, A.n_slices) - 1; B.subfield(0, 0, 0, end_row, end_col, end_slice) = A.subfield(0, 0, 0, end_row, end_col, end_slice); } return B; } template arma_warn_unused inline field resize(const field& A, const SizeMat& s) { arma_debug_sigprint(); return resize(A, s.n_rows, s.n_cols); } template arma_warn_unused inline field resize(const field& A, const SizeCube& s) { arma_debug_sigprint(); return resize(A, s.n_rows, s.n_cols, s.n_slices); } //! @} RcppArmadillo/inst/include/armadillo_bits/spop_symmat_meat.hpp0000644000176200001440000000456114631567470024505 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup spop_symmat //! @{ template inline void spop_symmat::apply(SpMat& out, const SpOp& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const unwrap_spmat U(in.m); const SpMat& X = U.M; arma_conform_check( (X.n_rows != X.n_cols), "symmatu()/symmatl(): given matrix must be square sized" ); if(X.n_nonzero == uword(0)) { out.zeros(X.n_rows, X.n_cols); return; } const bool upper = (in.aux_uword_a == 0); const SpMat A = (upper) ? trimatu(X) : trimatl(X); // in this case trimatu() and trimatl() return the same type const SpMat B = A.st(); spglue_merge::symmat_merge(out, A, B); } template inline void spop_symmat_cx::apply(SpMat& out, const SpOp& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const unwrap_spmat U(in.m); const SpMat& X = U.M; arma_conform_check( (X.n_rows != X.n_cols), "symmatu()/symmatl(): given matrix must be square sized" ); if(X.n_nonzero == uword(0)) { out.zeros(X.n_rows, X.n_cols); return; } const bool upper = (in.aux_uword_a == 0); const bool do_conj = (in.aux_uword_b == 1); const SpMat A = (upper) ? trimatu(X) : trimatl(X); // in this case trimatu() and trimatl() return the same type if(do_conj) { const SpMat B = A.t(); spglue_merge::symmat_merge(out, A, B); } else { const SpMat B = A.st(); spglue_merge::symmat_merge(out, A, B); } } //! @} RcppArmadillo/inst/include/armadillo_bits/glue_polyval_meat.hpp0000644000176200001440000000370014631567470024626 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup glue_polyval //! @{ template inline void glue_polyval::apply_noalias(Mat& out, const Mat& P, const Mat& X) { arma_debug_sigprint(); out.set_size(X.n_rows, X.n_cols); const eT* P_mem = P.memptr(); const uword P_n_elem = P.n_elem; out.fill(P_mem[0]); for(uword i=1; i < P_n_elem; ++i) { out = out % X + P_mem[i]; } } template inline void glue_polyval::apply(Mat& out, const Glue& expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const quasi_unwrap UP(expr.A); const quasi_unwrap UX(expr.B); const Mat& P = UP.M; const Mat& X = UX.M; arma_conform_check( ((P.is_vec() == false) && (P.is_empty() == false)), "polyval(): argument P must be a vector" ); if(P.is_empty() || X.is_empty()) { out.zeros(X.n_rows, X.n_cols); return; } if(UP.is_alias(out) || UX.is_alias(out)) { Mat tmp; glue_polyval::apply_noalias(tmp, P, X); out.steal_mem(tmp); } else { glue_polyval::apply_noalias(out, P, X); } } //! @} RcppArmadillo/inst/include/armadillo_bits/newarp_DenseGenMatProd_meat.hpp0000644000176200001440000000254014631567470026460 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ namespace newarp { template inline DenseGenMatProd::DenseGenMatProd(const Mat& mat_obj) : op_mat(mat_obj) , n_rows(mat_obj.n_rows) , n_cols(mat_obj.n_cols) { arma_debug_sigprint(); } // Perform the matrix-vector multiplication operation \f$y=Ax\f$. // y_out = A * x_in template inline void DenseGenMatProd::perform_op(eT* x_in, eT* y_out) const { arma_debug_sigprint(); const Col x(x_in , n_cols, false, true); Col y(y_out, n_rows, false, true); y = op_mat * x; } } // namespace newarp RcppArmadillo/inst/include/armadillo_bits/op_chol_meat.hpp0000644000176200001440000000426414635324415023547 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_chol //! @{ template inline void op_chol::apply(Mat& out, const Op& X) { arma_debug_sigprint(); const bool status = op_chol::apply_direct(out, X.m, X.aux_uword_a); if(status == false) { out.soft_reset(); arma_stop_runtime_error("chol(): decomposition failed"); } } template inline bool op_chol::apply_direct(Mat& out, const Base& A_expr, const uword layout) { arma_debug_sigprint(); typedef typename T1::elem_type eT; out = A_expr.get_ref(); arma_conform_check( (out.is_square() == false), "chol(): given matrix must be square sized", [&](){ out.soft_reset(); } ); if(out.is_empty()) { return true; } if((arma_config::check_conform) && (auxlib::rudimentary_sym_check(out) == false)) { if(is_cx::no ) { arma_warn(1, "chol(): given matrix is not symmetric"); } if(is_cx::yes) { arma_warn(1, "chol(): given matrix is not hermitian"); } } uword KD = 0; const bool is_band = arma_config::optimise_band && ((auxlib::crippled_lapack(out)) ? false : ((layout == 0) ? band_helper::is_band_upper(KD, out, uword(32)) : band_helper::is_band_lower(KD, out, uword(32)))); const bool status = (is_band) ? auxlib::chol_band(out, KD, layout) : auxlib::chol(out, layout); return status; } //! @} RcppArmadillo/inst/include/armadillo_bits/sp_auxlib_meat.hpp0000644000176200001440000025147715002153114024105 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup sp_auxlib //! @{ inline sp_auxlib::form_type sp_auxlib::interpret_form_str(const char* form_str) { arma_debug_sigprint(); // the order of the 3 if statements below is important if( form_str == nullptr ) { return form_none; } if( form_str[0] == char(0) ) { return form_none; } if( form_str[1] == char(0) ) { return form_none; } const char c1 = form_str[0]; const char c2 = form_str[1]; if(c1 == 'l') { if(c2 == 'm') { return form_lm; } if(c2 == 'r') { return form_lr; } if(c2 == 'i') { return form_li; } if(c2 == 'a') { return form_la; } } else if(c1 == 's') { if(c2 == 'm') { return form_sm; } if(c2 == 'r') { return form_sr; } if(c2 == 'i') { return form_si; } if(c2 == 'a') { return form_sa; } } return form_none; } //! immediate eigendecomposition of symmetric real sparse object template inline bool sp_auxlib::eigs_sym(Col& eigval, Mat& eigvec, const SpBase& X, const uword n_eigvals, const form_type form_val, const eigs_opts& opts) { arma_debug_sigprint(); const unwrap_spmat U(X.get_ref()); arma_conform_check( (U.M.is_square() == false), "eigs_sym(): given matrix must be square sized" ); if((arma_config::check_conform) && (sp_auxlib::rudimentary_sym_check(U.M) == false)) { if(is_cx::no ) { arma_warn(1, "eigs_sym(): given matrix is not symmetric"); } if(is_cx::yes) { arma_warn(1, "eigs_sym(): given matrix is not hermitian"); } } if(arma_config::check_nonfinite && U.M.internal_has_nonfinite()) { arma_warn(3, "eigs_sym(): detected non-finite elements"); return false; } // TODO: investigate optional redirection of "sm" to ARPACK as it's capable of shift-invert; // TODO: in shift-invert mode, "sm" maps to "lm" of the shift-inverted matrix (with sigma = 0) #if defined(ARMA_USE_NEWARP) { return sp_auxlib::eigs_sym_newarp(eigval, eigvec, U.M, n_eigvals, form_val, opts); } #elif defined(ARMA_USE_ARPACK) { constexpr eT sigma = eT(0); return sp_auxlib::eigs_sym_arpack(eigval, eigvec, U.M, n_eigvals, form_val, sigma, opts); } #else { arma_ignore(eigval); arma_ignore(eigvec); arma_ignore(n_eigvals); arma_ignore(form_val); arma_ignore(opts); arma_stop_logic_error("eigs_sym(): use of NEWARP or ARPACK must be enabled"); return false; } #endif } //! immediate eigendecomposition of symmetric real sparse object template inline bool sp_auxlib::eigs_sym(Col& eigval, Mat& eigvec, const SpBase& X, const uword n_eigvals, const eT sigma, const eigs_opts& opts) { arma_debug_sigprint(); const unwrap_spmat U(X.get_ref()); arma_conform_check( (U.M.is_square() == false), "eigs_sym(): given matrix must be square sized" ); if((arma_config::check_conform) && (sp_auxlib::rudimentary_sym_check(U.M) == false)) { if(is_cx::no ) { arma_warn(1, "eigs_sym(): given matrix is not symmetric"); } if(is_cx::yes) { arma_warn(1, "eigs_sym(): given matrix is not hermitian"); } } if(arma_config::check_nonfinite && U.M.internal_has_nonfinite()) { arma_warn(3, "eigs_sym(): detected non-finite elements"); return false; } #if (defined(ARMA_USE_NEWARP) && defined(ARMA_USE_SUPERLU)) { return sp_auxlib::eigs_sym_newarp(eigval, eigvec, U.M, n_eigvals, sigma, opts); } #elif (defined(ARMA_USE_ARPACK) && defined(ARMA_USE_SUPERLU)) { constexpr form_type form_val = form_sigma; return sp_auxlib::eigs_sym_arpack(eigval, eigvec, U.M, n_eigvals, form_val, sigma, opts); } #else { arma_ignore(eigval); arma_ignore(eigvec); arma_ignore(n_eigvals); arma_ignore(sigma); arma_ignore(opts); arma_stop_logic_error("eigs_sym(): use of NEWARP or ARPACK as well as SuperLU must be enabled to use 'sigma'"); return false; } #endif } template inline bool sp_auxlib::eigs_sym_newarp(Col& eigval, Mat& eigvec, const SpMat& X, const uword n_eigvals, const form_type form_val, const eigs_opts& opts) { arma_debug_sigprint(); #if defined(ARMA_USE_NEWARP) { arma_conform_check( (form_val != form_lm) && (form_val != form_sm) && (form_val != form_la) && (form_val != form_sa), "eigs_sym(): unknown form specified" ); if(X.is_square() == false) { return false; } const newarp::SparseGenMatProd op(X); arma_conform_check( (n_eigvals >= op.n_rows), "eigs_sym(): n_eigvals must be less than the number of rows in the matrix" ); // If the matrix is empty, the case is trivial. if( (op.n_cols == 0) || (n_eigvals == 0) ) // We already know n_cols == n_rows. { eigval.reset(); eigvec.reset(); return true; } uword n = op.n_rows; // Use max(2*k+1, 20) as default subspace dimension for the sym case; MATLAB uses max(2*k, 20), but we need to be backward-compatible. uword ncv_default = uword( ((2*n_eigvals+1)>(20)) ? (2*n_eigvals+1) : (20) ); // Use opts.subdim only if it's within the limits, otherwise cap it. uword ncv = ncv_default; if(opts.subdim != 0) { if(opts.subdim < (n_eigvals + 1)) { arma_warn(1, "eigs_sym(): opts.subdim must be greater than k; using k+1 instead of ", opts.subdim); ncv = uword(n_eigvals + 1); } else if(opts.subdim > n) { arma_warn(1, "eigs_sym(): opts.subdim cannot be greater than n_rows; using n_rows instead of ", opts.subdim); ncv = n; } else { ncv = uword(opts.subdim); } } // Re-check that we are within the limits if(ncv < (n_eigvals + 1)) { ncv = (n_eigvals + 1); } if(ncv > n ) { ncv = n; } eT tol = (std::max)(eT(opts.tol), std::numeric_limits::epsilon()); uword maxiter = uword(opts.maxiter); // eigval.set_size(n_eigvals); // eigvec.set_size(n, n_eigvals); bool status = true; uword nconv = 0; try { if(form_val == form_lm) { newarp::SymEigsSolver< eT, newarp::EigsSelect::LARGEST_MAGN, newarp::SparseGenMatProd > eigs(op, n_eigvals, ncv); eigs.init(); nconv = eigs.compute(maxiter, tol); eigval = eigs.eigenvalues(); eigvec = eigs.eigenvectors(); } else if(form_val == form_sm) { newarp::SymEigsSolver< eT, newarp::EigsSelect::SMALLEST_MAGN, newarp::SparseGenMatProd > eigs(op, n_eigvals, ncv); eigs.init(); nconv = eigs.compute(maxiter, tol); eigval = eigs.eigenvalues(); eigvec = eigs.eigenvectors(); } else if(form_val == form_la) { newarp::SymEigsSolver< eT, newarp::EigsSelect::LARGEST_ALGE, newarp::SparseGenMatProd > eigs(op, n_eigvals, ncv); eigs.init(); nconv = eigs.compute(maxiter, tol); eigval = eigs.eigenvalues(); eigvec = eigs.eigenvectors(); } else if(form_val == form_sa) { newarp::SymEigsSolver< eT, newarp::EigsSelect::SMALLEST_ALGE, newarp::SparseGenMatProd > eigs(op, n_eigvals, ncv); eigs.init(); nconv = eigs.compute(maxiter, tol); eigval = eigs.eigenvalues(); eigvec = eigs.eigenvectors(); } } catch(const std::runtime_error&) { status = false; } if(status == true) { if(nconv == 0) { status = false; } } return status; } #else { arma_ignore(eigval); arma_ignore(eigvec); arma_ignore(X); arma_ignore(n_eigvals); arma_ignore(form_val); arma_ignore(opts); return false; } #endif } template inline bool sp_auxlib::eigs_sym_newarp(Col& eigval, Mat& eigvec, const SpMat& X, const uword n_eigvals, const eT sigma, const eigs_opts& opts) { arma_debug_sigprint(); #if defined(ARMA_USE_NEWARP) { if(X.is_square() == false) { return false; } const newarp::SparseGenRealShiftSolve op(X, sigma); if(op.valid == false) { return false; } arma_conform_check( (n_eigvals >= op.n_rows), "eigs_sym(): n_eigvals must be less than the number of rows in the matrix" ); // If the matrix is empty, the case is trivial. if( (op.n_cols == 0) || (n_eigvals == 0) ) // We already know n_cols == n_rows. { eigval.reset(); eigvec.reset(); return true; } uword n = op.n_rows; // Use max(2*k+1, 20) as default subspace dimension for the sym case; MATLAB uses max(2*k, 20), but we need to be backward-compatible. uword ncv_default = uword( ((2*n_eigvals+1)>(20)) ? (2*n_eigvals+1) : (20) ); // Use opts.subdim only if it's within the limits, otherwise cap it. uword ncv = ncv_default; if(opts.subdim != 0) { if(opts.subdim < (n_eigvals + 1)) { arma_warn(1, "eigs_sym(): opts.subdim must be greater than k; using k+1 instead of ", opts.subdim); ncv = uword(n_eigvals + 1); } else if(opts.subdim > n) { arma_warn(1, "eigs_sym(): opts.subdim cannot be greater than n_rows; using n_rows instead of ", opts.subdim); ncv = n; } else { ncv = uword(opts.subdim); } } // Re-check that we are within the limits if(ncv < (n_eigvals + 1)) { ncv = (n_eigvals + 1); } if(ncv > n ) { ncv = n; } eT tol = (std::max)(eT(opts.tol), std::numeric_limits::epsilon()); uword maxiter = uword(opts.maxiter); // eigval.set_size(n_eigvals); // eigvec.set_size(n, n_eigvals); bool status = true; uword nconv = 0; try { newarp::SymEigsShiftSolver< eT, newarp::EigsSelect::LARGEST_MAGN, newarp::SparseGenRealShiftSolve > eigs(op, n_eigvals, ncv, sigma); eigs.init(); nconv = eigs.compute(maxiter, tol); eigval = eigs.eigenvalues(); eigvec = eigs.eigenvectors(); } catch(const std::runtime_error&) { status = false; } if(status == true) { if(nconv == 0) { status = false; } } return status; } #else { arma_ignore(eigval); arma_ignore(eigvec); arma_ignore(X); arma_ignore(n_eigvals); arma_ignore(sigma); arma_ignore(opts); return false; } #endif } template inline bool sp_auxlib::eigs_sym_arpack(Col& eigval, Mat& eigvec, const SpMat& X, const uword n_eigvals, const form_type form_val, const eT sigma, const eigs_opts& opts) { arma_debug_sigprint(); #if defined(ARMA_USE_ARPACK) { arma_conform_check( (form_val != form_lm) && (form_val != form_sm) && (form_val != form_la) && (form_val != form_sa) && (form_val != form_sigma), "eigs_sym(): unknown form specified" ); if(X.is_square() == false) { return false; } char which_sm[3] = "SM"; char which_lm[3] = "LM"; char which_sa[3] = "SA"; char which_la[3] = "LA"; char* which; switch(form_val) { case form_sm: which = which_sm; break; case form_lm: which = which_lm; break; case form_sa: which = which_sa; break; case form_la: which = which_la; break; default: which = which_lm; break; } // Make sure we aren't asking for every eigenvalue. // The _saupd() functions allow asking for one more eigenvalue than the _naupd() functions. arma_conform_check( (n_eigvals >= X.n_rows), "eigs_sym(): n_eigvals must be less than the number of rows in the matrix" ); // If the matrix is empty, the case is trivial. if( (X.n_cols == 0) || (n_eigvals == 0) ) // We already know n_cols == n_rows. { eigval.reset(); eigvec.reset(); return true; } // Set up variables that get used for neupd(). blas_int n, ncv, ncv_default, ldv, lworkl, info, maxiter; eT tol = eT(opts.tol); maxiter = blas_int(opts.maxiter); podarray resid, v, workd, workl; podarray iparam, ipntr; podarray rwork; // Not used in this case. n = blas_int(X.n_rows); // The size of the matrix. // Use max(2*k+1, 20) as default subspace dimension for the sym case; MATLAB uses max(2*k, 20), but we need to be backward-compatible. ncv_default = blas_int( ((2*n_eigvals+1)>(20)) ? (2*n_eigvals+1) : (20) ); // Use opts.subdim only if it's within the limits ncv = ncv_default; if(opts.subdim != 0) { if(opts.subdim < (n_eigvals + 1)) { arma_warn(1, "eigs_sym(): opts.subdim must be greater than k; using k+1 instead of ", opts.subdim); ncv = blas_int(n_eigvals + 1); } else if(blas_int(opts.subdim) > n) { arma_warn(1, "eigs_sym(): opts.subdim cannot be greater than n_rows; using n_rows instead of ", opts.subdim); ncv = n; } else { ncv = blas_int(opts.subdim); } } if(use_sigma) //if(form_val == form_sigma) { run_aupd_shiftinvert(n_eigvals, sigma, X, true /* sym, not gen */, n, tol, maxiter, resid, ncv, v, ldv, iparam, ipntr, workd, workl, lworkl, rwork, info); } else { const SpMat Xst = X.st(); run_aupd_plain(n_eigvals, which, X, Xst, true /* sym, not gen */, n, tol, maxiter, resid, ncv, v, ldv, iparam, ipntr, workd, workl, lworkl, rwork, info); } if(info != 0) { return false; } // The process has converged, and now we need to recover the actual eigenvectors using seupd() blas_int rvec = 1; // .TRUE blas_int nev = blas_int(n_eigvals); char howmny = 'A'; char bmat = 'I'; // We are considering the standard eigenvalue problem. podarray select(ncv, arma_zeros_indicator()); // Logical array of dimension NCV. blas_int ldz = n; // seupd() will output directly into the eigval and eigvec objects. eigval.zeros( n_eigvals); eigvec.zeros(n, n_eigvals); arpack::seupd(&rvec, &howmny, select.memptr(), eigval.memptr(), eigvec.memptr(), &ldz, (eT*) &sigma, &bmat, &n, which, &nev, &tol, resid.memptr(), &ncv, v.memptr(), &ldv, iparam.memptr(), ipntr.memptr(), workd.memptr(), workl.memptr(), &lworkl, &info); // Check for errors. if(info != 0) { arma_warn(1, "eigs_sym(): ARPACK error ", info, " in seupd()"); return false; } return (info == 0); } #else { arma_ignore(eigval); arma_ignore(eigvec); arma_ignore(X); arma_ignore(n_eigvals); arma_ignore(form_val); arma_ignore(sigma); arma_ignore(opts); return false; } #endif } //! immediate eigendecomposition of non-symmetric real sparse object template inline bool sp_auxlib::eigs_gen(Col< std::complex >& eigval, Mat< std::complex >& eigvec, const SpBase& X, const uword n_eigvals, const form_type form_val, const eigs_opts& opts) { arma_debug_sigprint(); const unwrap_spmat U(X.get_ref()); arma_conform_check( (U.M.is_square() == false), "eigs_gen(): given matrix must be square sized" ); if(arma_config::check_nonfinite && U.M.internal_has_nonfinite()) { arma_warn(3, "eigs_gen(): detected non-finite elements"); return false; } // TODO: investigate optional redirection of "sm" to ARPACK as it's capable of shift-invert; // TODO: in shift-invert mode, "sm" maps to "lm" of the shift-inverted matrix (with sigma = 0) #if defined(ARMA_USE_NEWARP) { return sp_auxlib::eigs_gen_newarp(eigval, eigvec, U.M, n_eigvals, form_val, opts); } #elif defined(ARMA_USE_ARPACK) { constexpr std::complex sigma = T(0); return sp_auxlib::eigs_gen_arpack(eigval, eigvec, U.M, n_eigvals, form_val, sigma, opts); } #else { arma_ignore(eigval); arma_ignore(eigvec); arma_ignore(n_eigvals); arma_ignore(form_val); arma_ignore(opts); arma_stop_logic_error("eigs_gen(): use of NEWARP or ARPACK must be enabled"); return false; } #endif } //! immediate eigendecomposition of non-symmetric real sparse object template inline bool sp_auxlib::eigs_gen(Col< std::complex >& eigval, Mat< std::complex >& eigvec, const SpBase& X, const uword n_eigvals, const std::complex sigma, const eigs_opts& opts) { arma_debug_sigprint(); const unwrap_spmat U(X.get_ref()); arma_conform_check( (U.M.is_square() == false), "eigs_gen(): given matrix must be square sized" ); if(arma_config::check_nonfinite && U.M.internal_has_nonfinite()) { arma_warn(3, "eigs_gen(): detected non-finite elements"); return false; } #if (defined(ARMA_USE_ARPACK) && defined(ARMA_USE_SUPERLU)) { constexpr form_type form_val = form_sigma; return sp_auxlib::eigs_gen_arpack(eigval, eigvec, U.M, n_eigvals, form_val, sigma, opts); } #else { arma_ignore(eigval); arma_ignore(eigvec); arma_ignore(n_eigvals); arma_ignore(sigma); arma_ignore(opts); arma_stop_logic_error("eigs_gen(): use of ARPACK and SuperLU must be enabled to use 'sigma'"); return false; } #endif } template inline bool sp_auxlib::eigs_gen_newarp(Col< std::complex >& eigval, Mat< std::complex >& eigvec, const SpMat& X, const uword n_eigvals, const form_type form_val, const eigs_opts& opts) { arma_debug_sigprint(); #if defined(ARMA_USE_NEWARP) { arma_conform_check( (form_val != form_lm) && (form_val != form_sm) && (form_val != form_lr) && (form_val != form_sr) && (form_val != form_li) && (form_val != form_si), "eigs_gen(): unknown form specified" ); if(X.is_square() == false) { return false; } const newarp::SparseGenMatProd op(X); arma_conform_check( (n_eigvals + 1 >= op.n_rows), "eigs_gen(): n_eigvals + 1 must be less than the number of rows in the matrix" ); // If the matrix is empty, the case is trivial. if( (op.n_cols == 0) || (n_eigvals == 0) ) // We already know n_cols == n_rows. { eigval.reset(); eigvec.reset(); return true; } uword n = op.n_rows; // Use max(2*k+1, 20) as default subspace dimension for the gen case; same as MATLAB. uword ncv_default = uword( ((2*n_eigvals+1)>(20)) ? (2*n_eigvals+1) : (20) ); // Use opts.subdim only if it's within the limits uword ncv = ncv_default; if(opts.subdim != 0) { if(opts.subdim < (n_eigvals + 3)) { arma_warn(1, "eigs_gen(): opts.subdim must be greater than k+2; using k+3 instead of ", opts.subdim); ncv = uword(n_eigvals + 3); } else if(opts.subdim > n) { arma_warn(1, "eigs_gen(): opts.subdim cannot be greater than n_rows; using n_rows instead of ", opts.subdim); ncv = n; } else { ncv = uword(opts.subdim); } } // Re-check that we are within the limits if(ncv < (n_eigvals + 3)) { ncv = (n_eigvals + 3); } if(ncv > n ) { ncv = n; } T tol = (std::max)(T(opts.tol), std::numeric_limits::epsilon()); uword maxiter = uword(opts.maxiter); // eigval.set_size(n_eigvals); // eigvec.set_size(n, n_eigvals); bool status = true; uword nconv = 0; try { if(form_val == form_lm) { newarp::GenEigsSolver< T, newarp::EigsSelect::LARGEST_MAGN, newarp::SparseGenMatProd > eigs(op, n_eigvals, ncv); eigs.init(); nconv = eigs.compute(maxiter, tol); eigval = eigs.eigenvalues(); eigvec = eigs.eigenvectors(); } else if(form_val == form_sm) { newarp::GenEigsSolver< T, newarp::EigsSelect::SMALLEST_MAGN, newarp::SparseGenMatProd > eigs(op, n_eigvals, ncv); eigs.init(); nconv = eigs.compute(maxiter, tol); eigval = eigs.eigenvalues(); eigvec = eigs.eigenvectors(); } else if(form_val == form_lr) { newarp::GenEigsSolver< T, newarp::EigsSelect::LARGEST_REAL, newarp::SparseGenMatProd > eigs(op, n_eigvals, ncv); eigs.init(); nconv = eigs.compute(maxiter, tol); eigval = eigs.eigenvalues(); eigvec = eigs.eigenvectors(); } else if(form_val == form_sr) { newarp::GenEigsSolver< T, newarp::EigsSelect::SMALLEST_REAL, newarp::SparseGenMatProd > eigs(op, n_eigvals, ncv); eigs.init(); nconv = eigs.compute(maxiter, tol); eigval = eigs.eigenvalues(); eigvec = eigs.eigenvectors(); } else if(form_val == form_li) { newarp::GenEigsSolver< T, newarp::EigsSelect::LARGEST_IMAG, newarp::SparseGenMatProd > eigs(op, n_eigvals, ncv); eigs.init(); nconv = eigs.compute(maxiter, tol); eigval = eigs.eigenvalues(); eigvec = eigs.eigenvectors(); } else if(form_val == form_si) { newarp::GenEigsSolver< T, newarp::EigsSelect::SMALLEST_IMAG, newarp::SparseGenMatProd > eigs(op, n_eigvals, ncv); eigs.init(); nconv = eigs.compute(maxiter, tol); eigval = eigs.eigenvalues(); eigvec = eigs.eigenvectors(); } } catch(const std::runtime_error&) { status = false; } if(status == true) { if(nconv == 0) { status = false; } } return status; } #else { arma_ignore(eigval); arma_ignore(eigvec); arma_ignore(X); arma_ignore(n_eigvals); arma_ignore(form_val); arma_ignore(opts); return false; } #endif } template inline bool sp_auxlib::eigs_gen_arpack(Col< std::complex >& eigval, Mat< std::complex >& eigvec, const SpMat& X, const uword n_eigvals, const form_type form_val, const std::complex sigma, const eigs_opts& opts) { arma_debug_sigprint(); #if defined(ARMA_USE_ARPACK) { arma_conform_check( (form_val != form_lm) && (form_val != form_sm) && (form_val != form_lr) && (form_val != form_sr) && (form_val != form_li) && (form_val != form_si) && (form_val != form_sigma), "eigs_gen(): unknown form specified" ); if(X.is_square() == false) { return false; } char which_lm[3] = "LM"; char which_sm[3] = "SM"; char which_lr[3] = "LR"; char which_sr[3] = "SR"; char which_li[3] = "LI"; char which_si[3] = "SI"; char* which; switch(form_val) { case form_lm: which = which_lm; break; case form_sm: which = which_sm; break; case form_lr: which = which_lr; break; case form_sr: which = which_sr; break; case form_li: which = which_li; break; case form_si: which = which_si; break; default: which = which_lm; } // Make sure we aren't asking for every eigenvalue. arma_conform_check( (n_eigvals + 1 >= X.n_rows), "eigs_gen(): n_eigvals + 1 must be less than the number of rows in the matrix" ); // If the matrix is empty, the case is trivial. if( (X.n_cols == 0) || (n_eigvals == 0) ) // We already know n_cols == n_rows. { eigval.reset(); eigvec.reset(); return true; } // Set up variables that get used for neupd(). blas_int n, ncv, ncv_default, ldv, lworkl, info, maxiter; T tol = T(opts.tol); maxiter = blas_int(opts.maxiter); podarray resid, v, workd, workl; podarray iparam, ipntr; podarray rwork; // Not used in the real case. n = blas_int(X.n_rows); // The size of the matrix. // Use max(2*k+1, 20) as default subspace dimension for the gen case; same as MATLAB. ncv_default = blas_int( ((2*n_eigvals+1)>(20)) ? (2*n_eigvals+1) : (20) ); // Use opts.subdim only if it's within the limits ncv = ncv_default; if(opts.subdim != 0) { if(opts.subdim < (n_eigvals + 3)) { arma_warn(1, "eigs_gen(): opts.subdim must be greater than k+2; using k+3 instead of ", opts.subdim); ncv = blas_int(n_eigvals + 3); } else if(blas_int(opts.subdim) > n) { arma_warn(1, "eigs_gen(): opts.subdim cannot be greater than n_rows; using n_rows instead of ", opts.subdim); ncv = n; } else { ncv = blas_int(opts.subdim); } } // WARNING!!! // We are still not able to apply truly complex shifts to real matrices, // in which case the OP that ARPACK wants is different (see [s/d]naupd). // Also, if sigma contains a non-zero imaginary part, retrieving the eigenvalues // becomes utterly messy (see [s/d]eupd, remark #3). // We should never get to the point in which the imaginary part of sigma is non-zero; // the user-facing functions currently convert X from real to complex if a complex sigma is detected. // The check here is just for extra safety, and as a reminder of what's missing. T sigmar = real(sigma); T sigmai = imag(sigma); if(use_sigma) //if(form_val == form_sigma) { if(sigmai != T(0)) { arma_stop_logic_error("eigs_gen(): complex 'sigma' not applicable to real matrix"); return false; } run_aupd_shiftinvert(n_eigvals, sigmar, X, false /* gen, not sym */, n, tol, maxiter, resid, ncv, v, ldv, iparam, ipntr, workd, workl, lworkl, rwork, info); } else { const SpMat Xst = X.st(); run_aupd_plain(n_eigvals, which, X, Xst, false /* gen, not sym */, n, tol, maxiter, resid, ncv, v, ldv, iparam, ipntr, workd, workl, lworkl, rwork, info); } if(info != 0) { return false; } // The process has converged, and now we need to recover the actual eigenvectors using neupd(). blas_int rvec = 1; // .TRUE blas_int nev = blas_int(n_eigvals); char howmny = 'A'; char bmat = 'I'; // We are considering the standard eigenvalue problem. podarray select(ncv, arma_zeros_indicator()); // logical array of dimension NCV podarray dr(nev + 1, arma_zeros_indicator()); // real array of dimension NEV + 1 podarray di(nev + 1, arma_zeros_indicator()); // real array of dimension NEV + 1 podarray z(n * (nev + 1), arma_zeros_indicator()); // real N by NEV array if HOWMNY = 'A' podarray workev(3 * ncv, arma_zeros_indicator()); blas_int ldz = n; arpack::neupd(&rvec, &howmny, select.memptr(), dr.memptr(), di.memptr(), z.memptr(), &ldz, (T*) &sigmar, (T*) &sigmai, workev.memptr(), &bmat, &n, which, &nev, &tol, resid.memptr(), &ncv, v.memptr(), &ldv, iparam.memptr(), ipntr.memptr(), workd.memptr(), workl.memptr(), &lworkl, rwork.memptr(), &info); // Check for errors. if(info != 0) { arma_warn(1, "eigs_gen(): ARPACK error ", info, " in neupd()"); return false; } // Put it into the outputs. eigval.set_size(n_eigvals); eigvec.zeros(n, n_eigvals); for(uword i = 0; i < n_eigvals; ++i) { eigval[i] = std::complex(dr[i], di[i]); } // Now recover the eigenvectors. for(uword i = 0; i < n_eigvals; ++i) { // ARPACK ?neupd lays things out kinda odd in memory; // so does LAPACK ?geev -- see auxlib::eig_gen() if((i < n_eigvals - 1) && (eigval[i] == std::conj(eigval[i + 1]))) { for(uword j = 0; j < uword(n); ++j) { eigvec.at(j, i) = std::complex(z[n * i + j], z[n * (i + 1) + j]); eigvec.at(j, i + 1) = std::complex(z[n * i + j], -z[n * (i + 1) + j]); } ++i; // Skip the next one. } else if((i == n_eigvals - 1) && (std::complex(eigval[i]).imag() != 0.0)) { // We don't have the matched conjugate eigenvalue. for(uword j = 0; j < uword(n); ++j) { eigvec.at(j, i) = std::complex(z[n * i + j], z[n * (i + 1) + j]); } } else { // The eigenvector is entirely real. for(uword j = 0; j < uword(n); ++j) { eigvec.at(j, i) = std::complex(z[n * i + j], T(0)); } } } return (info == 0); } #else { arma_ignore(eigval); arma_ignore(eigvec); arma_ignore(X); arma_ignore(n_eigvals); arma_ignore(form_val); arma_ignore(sigma); arma_ignore(opts); return false; } #endif } //! immediate eigendecomposition of non-symmetric complex sparse object template inline bool sp_auxlib::eigs_gen(Col< std::complex >& eigval, Mat< std::complex >& eigvec, const SpBase< std::complex, T1>& X_expr, const uword n_eigvals, const form_type form_val, const eigs_opts& opts) { arma_debug_sigprint(); const unwrap_spmat U(X_expr.get_ref()); arma_conform_check( (U.M.is_square() == false), "eigs_gen(): given matrix must be square sized" ); if(arma_config::check_nonfinite && U.M.internal_has_nonfinite()) { arma_warn(3, "eigs_gen(): detected non-finite elements"); return false; } constexpr std::complex sigma = T(0); return sp_auxlib::eigs_gen(eigval, eigvec, U.M, n_eigvals, form_val, sigma, opts); } //! immediate eigendecomposition of non-symmetric complex sparse object template inline bool sp_auxlib::eigs_gen(Col< std::complex >& eigval, Mat< std::complex >& eigvec, const SpBase< std::complex, T1>& X, const uword n_eigvals, const std::complex sigma, const eigs_opts& opts) { arma_debug_sigprint(); const unwrap_spmat U(X.get_ref()); arma_conform_check( (U.M.is_square() == false), "eigs_gen(): given matrix must be square sized" ); if(arma_config::check_nonfinite && U.M.internal_has_nonfinite()) { arma_warn(3, "eigs_gen(): detected non-finite elements"); return false; } #if (defined(ARMA_USE_ARPACK) && defined(ARMA_USE_SUPERLU)) { constexpr form_type form_val = form_sigma; return sp_auxlib::eigs_gen(eigval, eigvec, U.M, n_eigvals, form_val, sigma, opts); } #else { arma_ignore(eigval); arma_ignore(eigvec); arma_ignore(n_eigvals); arma_ignore(sigma); arma_ignore(opts); arma_stop_logic_error("eigs_gen(): use of ARPACK and SuperLU must be enabled to use 'sigma'"); return false; } #endif } template inline bool sp_auxlib::eigs_gen(Col< std::complex >& eigval, Mat< std::complex >& eigvec, const SpMat< std::complex >& X, const uword n_eigvals, const form_type form_val, const std::complex sigma, const eigs_opts& opts) { arma_debug_sigprint(); #if defined(ARMA_USE_ARPACK) { // typedef typename std::complex eT; arma_conform_check( (form_val != form_lm) && (form_val != form_sm) && (form_val != form_lr) && (form_val != form_sr) && (form_val != form_li) && (form_val != form_si) && (form_val != form_sigma), "eigs_gen(): unknown form specified" ); if(X.is_square() == false) { return false; } char which_lm[3] = "LM"; char which_sm[3] = "SM"; char which_lr[3] = "LR"; char which_sr[3] = "SR"; char which_li[3] = "LI"; char which_si[3] = "SI"; char* which; switch(form_val) { case form_lm: which = which_lm; break; case form_sm: which = which_sm; break; case form_lr: which = which_lr; break; case form_sr: which = which_sr; break; case form_li: which = which_li; break; case form_si: which = which_si; break; default: which = which_lm; } // Make sure we aren't asking for every eigenvalue. arma_conform_check( (n_eigvals + 1 >= X.n_rows), "eigs_gen(): n_eigvals + 1 must be less than the number of rows in the matrix" ); // If the matrix is empty, the case is trivial. if( (X.n_cols == 0) || (n_eigvals == 0) ) // We already know n_cols == n_rows. { eigval.reset(); eigvec.reset(); return true; } // Set up variables that get used for neupd(). blas_int n, ncv, ncv_default, ldv, lworkl, info, maxiter; T tol = T(opts.tol); maxiter = blas_int(opts.maxiter); podarray< std::complex > resid, v, workd, workl; podarray iparam, ipntr; podarray rwork; n = blas_int(X.n_rows); // The size of the matrix. // Use max(2*k+1, 20) as default subspace dimension for the gen case; same as MATLAB. ncv_default = blas_int( ((2*n_eigvals+1)>(20)) ? (2*n_eigvals+1) : (20) ); // Use opts.subdim only if it's within the limits ncv = ncv_default; if(opts.subdim != 0) { if(opts.subdim < (n_eigvals + 3)) { arma_warn(1, "eigs_gen(): opts.subdim must be greater than k+2; using k+3 instead of ", opts.subdim); ncv = blas_int(n_eigvals + 3); } else if(blas_int(opts.subdim) > n) { arma_warn(1, "eigs_gen(): opts.subdim cannot be greater than n_rows; using n_rows instead of ", opts.subdim); ncv = n; } else { ncv = blas_int(opts.subdim); } } if(use_sigma) //if(form_val == form_sigma) { run_aupd_shiftinvert(n_eigvals, sigma, X, false /* gen, not sym */, n, tol, maxiter, resid, ncv, v, ldv, iparam, ipntr, workd, workl, lworkl, rwork, info); } else { const SpMat< std::complex > Xst = X.st(); run_aupd_plain(n_eigvals, which, X, Xst, false /* gen, not sym */, n, tol, maxiter, resid, ncv, v, ldv, iparam, ipntr, workd, workl, lworkl, rwork, info); } if(info != 0) { return false; } // The process has converged, and now we need to recover the actual eigenvectors using neupd(). blas_int rvec = 1; // .TRUE blas_int nev = blas_int(n_eigvals); char howmny = 'A'; char bmat = 'I'; // We are considering the standard eigenvalue problem. podarray select(ncv, arma_zeros_indicator()); // logical array of dimension NCV podarray> d(nev + 1, arma_zeros_indicator()); // complex array of dimension NEV + 1 podarray> z(n * nev, arma_zeros_indicator()); // complex N by NEV array if HOWMNY = 'A' podarray> workev(2 * ncv, arma_zeros_indicator()); blas_int ldz = n; // Prepare the outputs; neupd() will write directly to them. eigval.zeros(n_eigvals); eigvec.zeros(n, n_eigvals); arpack::neupd(&rvec, &howmny, select.memptr(), eigval.memptr(), (std::complex*) NULL, eigvec.memptr(), &ldz, (std::complex*) &sigma, (std::complex*) NULL, workev.memptr(), &bmat, &n, which, &nev, &tol, resid.memptr(), &ncv, v.memptr(), &ldv, iparam.memptr(), ipntr.memptr(), workd.memptr(), workl.memptr(), &lworkl, rwork.memptr(), &info); // Check for errors. if(info != 0) { arma_warn(1, "eigs_gen(): ARPACK error ", info, " in neupd()"); return false; } return (info == 0); } #else { arma_ignore(eigval); arma_ignore(eigvec); arma_ignore(X); arma_ignore(n_eigvals); arma_ignore(form_val); arma_ignore(sigma); arma_ignore(opts); arma_stop_logic_error("eigs_gen(): use of ARPACK must be enabled for decomposition of complex matrices"); return false; } #endif } template inline bool sp_auxlib::spsolve_simple(Mat& X, const SpBase& A_expr, const Base& B_expr, const superlu_opts& user_opts) { arma_debug_sigprint(); #if defined(ARMA_USE_SUPERLU) { typedef typename T1::elem_type eT; superlu::superlu_options_t options; sp_auxlib::set_superlu_opts(options, user_opts); const unwrap_spmat tmp1(A_expr.get_ref()); const SpMat& A = tmp1.M; X = B_expr.get_ref(); // superlu::gssv() uses X as input (the B matrix) and as output (the solution) if(A.is_square() == false) { X.soft_reset(); arma_stop_logic_error("spsolve(): solving under-determined / over-determined systems is currently not supported"); return false; } arma_conform_check( (A.n_rows != X.n_rows), "spsolve(): number of rows in the given objects must be the same", [&](){ X.soft_reset(); } ); if(A.is_empty() || X.is_empty()) { X.zeros(A.n_cols, X.n_cols); return true; } if(A.n_nonzero == uword(0)) { X.soft_reset(); return false; } if(arma_config::check_nonfinite && (A.internal_has_nonfinite() || X.internal_has_nonfinite())) { arma_warn(3, "spsolve(): detected non-finite elements"); return false; } if(arma_config::check_conform) { bool overflow = false; overflow = (A.n_nonzero > INT_MAX); overflow = (A.n_rows > INT_MAX) || overflow; overflow = (A.n_cols > INT_MAX) || overflow; overflow = (X.n_rows > INT_MAX) || overflow; overflow = (X.n_cols > INT_MAX) || overflow; if(overflow) { arma_stop_runtime_error("spsolve(): integer overflow: matrix dimensions are too large for integer type used by SuperLU"); return false; } } superlu_supermatrix_wrangler x; superlu_supermatrix_wrangler a; const bool status_x = wrap_to_supermatrix(x.get_ref(), X); const bool status_a = copy_to_supermatrix(a.get_ref(), A); if( (status_x == false) || (status_a == false) ) { X.soft_reset(); return false; } superlu_supermatrix_wrangler l; superlu_supermatrix_wrangler u; // paranoia: use SuperLU's memory allocation, in case it reallocs superlu_array_wrangler perm_c(A.n_cols+1); // extra paranoia: increase array length by 1 superlu_array_wrangler perm_r(A.n_rows+1); superlu_stat_wrangler stat; superlu::int_t info = 0; // Return code. arma_debug_print("superlu::gssv()"); superlu::gssv(&options, a.get_ptr(), perm_c.get_ptr(), perm_r.get_ptr(), l.get_ptr(), u.get_ptr(), x.get_ptr(), stat.get_ptr(), &info); // Process the return code. if( (info > 0) && (info <= superlu::int_t(A.n_cols)) ) { // std::ostringstream tmp; // tmp << "spsolve(): could not solve system; LU factorisation completed, but detected zero in U(" << (info-1) << ',' << (info-1) << ')'; // arma_warn(1, tmp.str()); } else if(info > superlu::int_t(A.n_cols)) { arma_warn(1, "spsolve(): memory allocation failure"); } else if(info < 0) { arma_warn(1, "spsolve(): unknown SuperLU error code from gssv(): ", info); } // No need to extract the data from x, since it's using the same memory as X return (info == 0); } #else { arma_ignore(X); arma_ignore(A_expr); arma_ignore(B_expr); arma_ignore(user_opts); arma_stop_logic_error("spsolve(): use of SuperLU must be enabled"); return false; } #endif } template inline bool sp_auxlib::spsolve_refine(Mat& X, typename T1::pod_type& out_rcond, const SpBase& A_expr, const Base& B_expr, const superlu_opts& user_opts) { arma_debug_sigprint(); #if defined(ARMA_USE_SUPERLU) { typedef typename T1::pod_type T; typedef typename T1::elem_type eT; superlu::superlu_options_t options; sp_auxlib::set_superlu_opts(options, user_opts); const unwrap_spmat tmp1(A_expr.get_ref()); const SpMat& A = tmp1.M; const unwrap tmp2(B_expr.get_ref()); const Mat& B_unwrap = tmp2.M; const bool B_is_modified = ( (user_opts.equilibrate) || (&B_unwrap == &X) ); Mat B_copy; if(B_is_modified) { B_copy = B_unwrap; } const Mat& B = (B_is_modified) ? B_copy : B_unwrap; if(A.is_square() == false) { X.soft_reset(); arma_stop_logic_error("spsolve(): solving under-determined / over-determined systems is currently not supported"); return false; } arma_conform_check( (A.n_rows != B.n_rows), "spsolve(): number of rows in the given objects must be the same", [&](){ X.soft_reset(); } ); X.zeros(A.n_cols, B.n_cols); // set the elements to zero, as we don't trust the SuperLU spaghetti code if(A.is_empty() || B.is_empty()) { return true; } if(A.n_nonzero == uword(0)) { X.soft_reset(); return false; } if(arma_config::check_nonfinite && (A.internal_has_nonfinite() || B.internal_has_nonfinite())) { arma_warn(3, "spsolve(): detected non-finite elements"); return false; } if(arma_config::check_conform) { bool overflow; overflow = (A.n_nonzero > INT_MAX); overflow = (A.n_rows > INT_MAX) || overflow; overflow = (A.n_cols > INT_MAX) || overflow; overflow = (B.n_rows > INT_MAX) || overflow; overflow = (B.n_cols > INT_MAX) || overflow; overflow = (X.n_rows > INT_MAX) || overflow; overflow = (X.n_cols > INT_MAX) || overflow; if(overflow) { arma_stop_runtime_error("spsolve(): integer overflow: matrix dimensions are too large for integer type used by SuperLU"); return false; } } superlu_supermatrix_wrangler x; superlu_supermatrix_wrangler a; superlu_supermatrix_wrangler b; const bool status_x = wrap_to_supermatrix(x.get_ref(), X); const bool status_a = copy_to_supermatrix(a.get_ref(), A); // NOTE: superlu::gssvx() modifies 'a' if equilibration is enabled const bool status_b = wrap_to_supermatrix(b.get_ref(), B); // NOTE: superlu::gssvx() modifies 'b' if equilibration is enabled if( (status_x == false) || (status_a == false) || (status_b == false) ) { X.soft_reset(); return false; } superlu_supermatrix_wrangler l; superlu_supermatrix_wrangler u; // paranoia: use SuperLU's memory allocation, in case it reallocs superlu_array_wrangler perm_c(A.n_cols+1); // extra paranoia: increase array length by 1 superlu_array_wrangler perm_r(A.n_rows+1); superlu_array_wrangler etree(A.n_cols+1); superlu_array_wrangler R(A.n_rows+1); superlu_array_wrangler C(A.n_cols+1); superlu_array_wrangler ferr(B.n_cols+1); superlu_array_wrangler berr(B.n_cols+1); superlu::GlobalLU_t glu; arrayops::fill_zeros(reinterpret_cast(&glu), sizeof(superlu::GlobalLU_t)); superlu::mem_usage_t mu; arrayops::fill_zeros(reinterpret_cast(&mu), sizeof(superlu::mem_usage_t)); superlu_stat_wrangler stat; char equed[8] = {}; // extra characters for paranoia T rpg = T(0); T rcond = T(0); char work[8] = {}; superlu::int_t lwork = 0; // 0 means superlu will allocate memory superlu::int_t info = 0; // Return code. arma_debug_print("superlu::gssvx()"); superlu::gssvx(&options, a.get_ptr(), perm_c.get_ptr(), perm_r.get_ptr(), etree.get_ptr(), equed, R.get_ptr(), C.get_ptr(), l.get_ptr(), u.get_ptr(), &work[0], lwork, b.get_ptr(), x.get_ptr(), &rpg, &rcond, ferr.get_ptr(), berr.get_ptr(), &glu, &mu, stat.get_ptr(), &info); bool status = false; // Process the return code. if(info == 0) { status = true; } if( (info > 0) && (info <= superlu::int_t(A.n_cols)) ) { // std::ostringstream tmp; // tmp << "spsolve(): could not solve system; LU factorisation completed, but detected zero in U(" << (info-1) << ',' << (info-1) << ')'; // arma_warn(1, tmp.str()); } else if( (info == superlu::int_t(A.n_cols+1)) && (user_opts.allow_ugly) ) { arma_warn(2, "spsolve(): system is singular to working precision (rcond: ", rcond, ")"); status = true; } else if(info > superlu::int_t(A.n_cols+1)) { arma_warn(1, "spsolve(): memory allocation failure"); } else if(info < 0) { arma_warn(1, "spsolve(): unknown SuperLU error code from gssvx(): ", info); } // No need to extract the data from x, since it's using the same memory as X out_rcond = rcond; return status; } #else { arma_ignore(X); arma_ignore(out_rcond); arma_ignore(A_expr); arma_ignore(B_expr); arma_ignore(user_opts); arma_stop_logic_error("spsolve(): use of SuperLU must be enabled"); return false; } #endif } #if defined(ARMA_USE_SUPERLU) template inline typename get_pod_type::result sp_auxlib::norm1(superlu::SuperMatrix* A) { arma_debug_sigprint(); char norm_id = '1'; arma_debug_print("superlu::langs()"); return superlu::langs(&norm_id, A); } template inline typename get_pod_type::result sp_auxlib::lu_rcond(superlu::SuperMatrix* L, superlu::SuperMatrix* U, typename get_pod_type::result norm_val) { arma_debug_sigprint(); typedef typename get_pod_type::result T; char norm_id = '1'; T rcond_out = T(0); int info = int(0); superlu_stat_wrangler stat; arma_debug_print("superlu::gscon()"); superlu::gscon(&norm_id, L, U, norm_val, &rcond_out, stat.get_ptr(), &info); return (info == 0) ? T(rcond_out) : T(0); } inline void sp_auxlib::set_superlu_opts(superlu::superlu_options_t& options, const superlu_opts& user_opts) { arma_debug_sigprint(); // default options as the starting point superlu::set_default_opts(&options); // our settings options.Trans = superlu::NOTRANS; options.ConditionNumber = superlu::YES; // process user_opts if(user_opts.equilibrate == true) { options.Equil = superlu::YES; } if(user_opts.equilibrate == false) { options.Equil = superlu::NO; } if(user_opts.symmetric == true) { options.SymmetricMode = superlu::YES; } if(user_opts.symmetric == false) { options.SymmetricMode = superlu::NO; } options.DiagPivotThresh = user_opts.pivot_thresh; if(user_opts.permutation == superlu_opts::NATURAL) { options.ColPerm = superlu::NATURAL; } if(user_opts.permutation == superlu_opts::MMD_ATA) { options.ColPerm = superlu::MMD_ATA; } if(user_opts.permutation == superlu_opts::MMD_AT_PLUS_A) { options.ColPerm = superlu::MMD_AT_PLUS_A; } if(user_opts.permutation == superlu_opts::COLAMD) { options.ColPerm = superlu::COLAMD; } if(user_opts.refine == superlu_opts::REF_NONE) { options.IterRefine = superlu::NOREFINE; } if(user_opts.refine == superlu_opts::REF_SINGLE) { options.IterRefine = superlu::SLU_SINGLE; } if(user_opts.refine == superlu_opts::REF_DOUBLE) { options.IterRefine = superlu::SLU_DOUBLE; } if(user_opts.refine == superlu_opts::REF_EXTRA) { options.IterRefine = superlu::SLU_EXTRA; } } template inline bool sp_auxlib::copy_to_supermatrix(superlu::SuperMatrix& out, const SpMat& A) { arma_debug_sigprint(); // We store in column-major CSC. out.Stype = superlu::SLU_NC; if( is_float::value) { out.Dtype = superlu::SLU_S; } else if( is_double::value) { out.Dtype = superlu::SLU_D; } else if( is_cx_float::value) { out.Dtype = superlu::SLU_C; } else if(is_cx_double::value) { out.Dtype = superlu::SLU_Z; } out.Mtype = superlu::SLU_GE; // Just a general matrix. We don't know more now. // We have to actually create the object which stores the data. // This gets cleaned by destroy_supermatrix(). // We have to use SuperLU's problematic memory allocation routines since they are // not guaranteed to be new and delete. See the comments in def_superlu.hpp superlu::NCformat* nc = (superlu::NCformat*)superlu::malloc(sizeof(superlu::NCformat)); if(nc == nullptr) { return false; } A.sync(); nc->nnz = A.n_nonzero; nc->nzval = (void*) superlu::malloc(sizeof(eT) * A.n_nonzero ); nc->colptr = (superlu::int_t*)superlu::malloc(sizeof(superlu::int_t) * (A.n_cols + 1)); nc->rowind = (superlu::int_t*)superlu::malloc(sizeof(superlu::int_t) * A.n_nonzero ); if( (nc->nzval == nullptr) || (nc->colptr == nullptr) || (nc->rowind == nullptr) ) { return false; } // Fill the matrix. arrayops::copy((eT*) nc->nzval, A.values, A.n_nonzero); // // These have to be copied by hand, because the types may differ. // for(uword i = 0; i <= A.n_cols; ++i) { nc->colptr[i] = (int_t) A.col_ptrs[i]; } // for(uword i = 0; i < A.n_nonzero; ++i) { nc->rowind[i] = (int_t) A.row_indices[i]; } arrayops::convert(nc->colptr, A.col_ptrs, A.n_cols+1 ); arrayops::convert(nc->rowind, A.row_indices, A.n_nonzero); out.nrow = superlu::int_t(A.n_rows); out.ncol = superlu::int_t(A.n_cols); out.Store = (void*) nc; return true; } // memory efficient implementation of out = A - shift*I, where A is a square matrix template inline bool sp_auxlib::copy_to_supermatrix_with_shift(superlu::SuperMatrix& out, const SpMat& A, const eT shift) { arma_debug_sigprint(); arma_conform_check( (A.is_square() == false), "sp_auxlib::copy_to_supermatrix_with_shift(): given matrix must be square sized" ); if(shift == eT(0)) { arma_debug_print("sp_auxlib::copy_to_supermatrix_with_shift(): shift is zero; redirecting to sp_auxlib::copy_to_supermatrix()"); return sp_auxlib::copy_to_supermatrix(out, A); } // We store in column-major CSC. out.Stype = superlu::SLU_NC; if( is_float::value) { out.Dtype = superlu::SLU_S; } else if( is_double::value) { out.Dtype = superlu::SLU_D; } else if( is_cx_float::value) { out.Dtype = superlu::SLU_C; } else if(is_cx_double::value) { out.Dtype = superlu::SLU_Z; } out.Mtype = superlu::SLU_GE; // Just a general matrix. We don't know more now. // We have to actually create the object which stores the data. // This gets cleaned by destroy_supermatrix(). superlu::NCformat* nc = (superlu::NCformat*)superlu::malloc(sizeof(superlu::NCformat)); if(nc == nullptr) { return false; } A.sync(); uword n_nonzero_diag_old = 0; uword n_nonzero_diag_new = 0; const uword n_search_cols = (std::min)(A.n_rows, A.n_cols); for(uword j=0; j < n_search_cols; ++j) { const uword col_offset = A.col_ptrs[j ]; const uword next_col_offset = A.col_ptrs[j + 1]; const uword* start_ptr = &(A.row_indices[ col_offset]); const uword* end_ptr = &(A.row_indices[next_col_offset]); const uword wanted_row = j; const uword* pos_ptr = std::lower_bound(start_ptr, end_ptr, wanted_row); // binary search if( (pos_ptr != end_ptr) && ((*pos_ptr) == wanted_row) ) { // element on the main diagonal is non-zero ++n_nonzero_diag_old; const uword offset = uword(pos_ptr - start_ptr); const uword index = offset + col_offset; const eT new_val = A.values[index] - shift; if(new_val != eT(0)) { ++n_nonzero_diag_new; } } else { // element on the main diagonal is zero, but sigma is non-zero, // so the number of new non-zero elements on the diagonal is increased ++n_nonzero_diag_new; } } const uword out_n_nonzero = A.n_nonzero - n_nonzero_diag_old + n_nonzero_diag_new; arma_debug_print( arma_str::format("A.n_nonzero: %u") % A.n_nonzero ); arma_debug_print( arma_str::format("n_nonzero_diag_old: %u") % n_nonzero_diag_old ); arma_debug_print( arma_str::format("n_nonzero_diag_new: %u") % n_nonzero_diag_new ); arma_debug_print( arma_str::format("out_n_nonzero: %u") % out_n_nonzero ); nc->nnz = out_n_nonzero; nc->nzval = (void*) superlu::malloc(sizeof(eT) * out_n_nonzero ); nc->colptr = (superlu::int_t*)superlu::malloc(sizeof(superlu::int_t) * (A.n_cols + 1)); nc->rowind = (superlu::int_t*)superlu::malloc(sizeof(superlu::int_t) * out_n_nonzero ); if( (nc->nzval == nullptr) || (nc->colptr == nullptr) || (nc->rowind == nullptr) ) { return false; } // fill the matrix column by column, and insert diagonal elements when necessary nc->colptr[0] = 0; eT* values_current = (eT*) nc->nzval; superlu::int_t* rowind_current = nc->rowind; uword count = 0; for(uword j=0; j < A.n_cols; ++j) { const uword idx_start = A.col_ptrs[j ]; const uword idx_end = A.col_ptrs[j + 1]; const eT* values_start = values_current; uword i = idx_start; // elements in the upper triangular part, excluding the main diagonal for(; (i < idx_end) && (A.row_indices[i] < j); ++i) { (*values_current) = A.values[i]; (*rowind_current) = superlu::int_t(A.row_indices[i]); ++values_current; ++rowind_current; ++count; } // elements on the main diagonal if( (i < idx_end) && (A.row_indices[i] == j) ) { // A(j,j) is non-zero const eT new_diag_val = A.values[i] - shift; if(new_diag_val != eT(0)) { (*values_current) = new_diag_val; (*rowind_current) = superlu::int_t(j); ++values_current; ++rowind_current; ++count; } ++i; } else { // A(j,j) is zero, so insert a new element if(j < n_search_cols) { (*values_current) = -shift; (*rowind_current) = superlu::int_t(j); ++values_current; ++rowind_current; ++count; } } // elements in the lower triangular part, excluding the main diagonal for(; i < idx_end; ++i) { (*values_current) = A.values[i]; (*rowind_current) = superlu::int_t(A.row_indices[i]); ++values_current; ++rowind_current; ++count; } // number of non-zero elements in the j-th column of out const uword nnz_col = values_current - values_start; nc->colptr[j + 1] = superlu::int_t(nc->colptr[j] + nnz_col); } arma_debug_print( arma_str::format("count: %u") % count ); arma_check( (count != out_n_nonzero), "internal error: sp_auxlib::copy_to_supermatrix_with_shift(): count != out_n_nonzero" ); out.nrow = superlu::int_t(A.n_rows); out.ncol = superlu::int_t(A.n_cols); out.Store = (void*) nc; return true; } // // for debugging only // template // inline // void // sp_auxlib::copy_to_spmat(SpMat& out, const superlu::SuperMatrix& A) // { // arma_debug_sigprint(); // // bool type_matched = false; // // if( is_float::value) { type_matched = (A.Dtype == superlu::SLU_S); } // else if( is_double::value) { type_matched = (A.Dtype == superlu::SLU_D); } // else if( is_cx_float::value) { type_matched = (A.Dtype == superlu::SLU_C); } // else if(is_cx_double::value) { type_matched = (A.Dtype == superlu::SLU_Z); } // // arma_conform_check( (type_matched == false), "copy_to_spmat(): type mismatch" ); // arma_conform_check( (A.Mtype != superlu::SLU_GE), "copy_to_spmat(): unknown layout" ); // // // NOTE: the l and u instances of SuperMatrix resulting from superlu::gstrf() // // NOTE: do not have the superlu::SLU_GE layout // // const superlu::NCformat* nc = (const superlu::NCformat*)(A.Store); // // if(nc == nullptr) { out.reset(); return; } // // if( (nc->nzval == nullptr) || (nc->colptr == nullptr) || (nc->rowind == nullptr) ) { out.reset(); return; } // // const uword A_n_rows = uword(A.nrow ); // const uword A_n_cols = uword(A.ncol ); // const uword A_n_nonzero = uword(nc->nnz); // // if(A_n_nonzero == 0) { out.zeros(A_n_rows, A_n_cols); return; } // // out.reserve(A_n_rows, A_n_cols, A_n_nonzero); // // arrayops::copy(access::rwp(out.values), (const eT*)(nc->nzval), A_n_nonzero); // // arrayops::convert(access::rwp(out.col_ptrs), nc->colptr, A_n_cols+1 ); // arrayops::convert(access::rwp(out.row_indices), nc->rowind, A_n_nonzero); // // out.remove_zeros(); // in case SuperLU has bugs and stores zeros in sparse matrices // } template inline bool sp_auxlib::wrap_to_supermatrix(superlu::SuperMatrix& out, const Mat& A) { arma_debug_sigprint(); // NOTE: this function re-uses memory from matrix A // This is being stored as a dense matrix. out.Stype = superlu::SLU_DN; if( is_float::value) { out.Dtype = superlu::SLU_S; } else if( is_double::value) { out.Dtype = superlu::SLU_D; } else if( is_cx_float::value) { out.Dtype = superlu::SLU_C; } else if(is_cx_double::value) { out.Dtype = superlu::SLU_Z; } out.Mtype = superlu::SLU_GE; // We have to create the object that stores the data. superlu::DNformat* dn = (superlu::DNformat*)superlu::malloc(sizeof(superlu::DNformat)); if(dn == nullptr) { return false; } dn->lda = A.n_rows; dn->nzval = (void*) A.memptr(); // re-use memory instead of copying out.nrow = A.n_rows; out.ncol = A.n_cols; out.Store = (void*) dn; return true; } inline void sp_auxlib::destroy_supermatrix(superlu::SuperMatrix& out) { arma_debug_sigprint(); // Clean up. if(out.Stype == superlu::SLU_NC) { superlu::destroy_compcol_mat(&out); } else if(out.Stype == superlu::SLU_NCP) { superlu::destroy_compcolperm_mat(&out); } else if(out.Stype == superlu::SLU_DN) { // superlu::destroy_dense_mat(&out); // since dn->nzval is set to re-use memory from a Mat object (which manages its own memory), // we cannot simply call superlu::destroy_dense_mat(). // Only the out.Store structure can be freed. superlu::DNformat* dn = (superlu::DNformat*) out.Store; if(dn != nullptr) { superlu::free(dn); } } else if(out.Stype == superlu::SLU_SC) { superlu::destroy_supernode_mat(&out); } else { // Uh, crap. std::ostringstream tmp; tmp << "sp_auxlib::destroy_supermatrix(): unhandled Stype" << std::endl; tmp << "Stype val: " << out.Stype << std::endl; tmp << "Stype name: "; if(out.Stype == superlu::SLU_NC) { tmp << "SLU_NC"; } if(out.Stype == superlu::SLU_NCP) { tmp << "SLU_NCP"; } if(out.Stype == superlu::SLU_NR) { tmp << "SLU_NR"; } if(out.Stype == superlu::SLU_SC) { tmp << "SLU_SC"; } if(out.Stype == superlu::SLU_SCP) { tmp << "SLU_SCP"; } if(out.Stype == superlu::SLU_SR) { tmp << "SLU_SR"; } if(out.Stype == superlu::SLU_DN) { tmp << "SLU_DN"; } if(out.Stype == superlu::SLU_NR_loc) { tmp << "SLU_NR_loc"; } arma_warn(1, tmp.str()); arma_stop_runtime_error("internal error: sp_auxlib::destroy_supermatrix()"); } } #endif template inline void sp_auxlib::run_aupd_plain ( const uword n_eigvals, char* which, const SpMat& X, const SpMat& Xst, const bool sym, blas_int& n, eT& tol, blas_int& maxiter, podarray& resid, blas_int& ncv, podarray& v, blas_int& ldv, podarray& iparam, podarray& ipntr, podarray& workd, podarray& workl, blas_int& lworkl, podarray& rwork, blas_int& info ) { #if defined(ARMA_USE_ARPACK) { // ARPACK provides a "reverse communication interface" which is an // entertainingly archaic FORTRAN software engineering technique that // basically means that we call saupd()/naupd() and it tells us with some // return code what we need to do next (usually a matrix-vector product) and // then call it again. So this results in some type of iterative process // where we call saupd()/naupd() many times. blas_int ido = 0; // This must be 0 for the first call. char bmat = 'I'; // We are considering the standard eigenvalue problem. n = X.n_rows; // The size of the matrix (should already be set outside). blas_int nev = n_eigvals; // resid.zeros(n); eigs_randu_filler randu_filler; randu_filler.fill(resid, n); // use deterministic starting point // Two constraints on NCV: (NCV > NEV) for sym problems or // (NCV > NEV + 2) for gen problems and (NCV <= N) // // We're calling either arpack::saupd() or arpack::naupd(), // which have slightly different minimum constraint and recommended value for NCV: // http://www.caam.rice.edu/software/ARPACK/UG/node136.html // http://www.caam.rice.edu/software/ARPACK/UG/node138.html if(ncv < (nev + (sym ? 1 : 3))) { ncv = (nev + (sym ? 1 : 3)); } if(ncv > n ) { ncv = n; } v.zeros(n * ncv); // Array N by NCV (output). rwork.zeros(ncv); // Work array of size NCV for complex calls. ldv = n; // "Leading dimension of V exactly as declared in the calling program." // IPARAM: integer array of length 11. iparam.zeros(11); iparam(0) = 1; // Exact shifts (not provided by us). iparam(2) = maxiter; // Maximum iterations; all the examples use 300, but they were written in the ancient times. iparam(6) = 1; // Mode 1: A * x = lambda * x. // IPNTR: integer array of length 14 (output). ipntr.zeros(14); // Real work array used in the basic Arnoldi iteration for reverse communication. workd.zeros(3 * n); // lworkl must be at least 3 * NCV^2 + 6 * NCV. lworkl = 3 * (ncv * ncv) + 6 * ncv; // Real work array of length lworkl. workl.zeros(lworkl); // info = 0; // resid to be filled with random values by ARPACK (non-deterministic) info = 1; // resid is already filled with random values (deterministic) // All the parameters have been set or created. Time to loop a lot. while(ido != 99) { // Call saupd() or naupd() with the current parameters. if(sym) { arma_debug_print("arpack::saupd()"); arpack::saupd(&ido, &bmat, &n, which, &nev, &tol, resid.memptr(), &ncv, v.memptr(), &ldv, iparam.memptr(), ipntr.memptr(), workd.memptr(), workl.memptr(), &lworkl, &info); } else { arma_debug_print("arpack::naupd()"); arpack::naupd(&ido, &bmat, &n, which, &nev, &tol, resid.memptr(), &ncv, v.memptr(), &ldv, iparam.memptr(), ipntr.memptr(), workd.memptr(), workl.memptr(), &lworkl, rwork.memptr(), &info); } // What do we do now? switch (ido) { case -1: // fallthrough case 1: { // We need to calculate the matrix-vector multiplication y = OP * x // where x is of length n and starts at workd(ipntr(0)), // and y is of length n and starts at workd(ipntr(1)). // We have to subtract one from FORTRAN pointers. Row out(workd.memptr() + ipntr(1) - 1, n, false, true); Row in(workd.memptr() + ipntr(0) - 1, n, false, true); out = in * Xst; // using transposed version break; } case 99: // Nothing to do here, things have converged. break; default: { return; // Parent frame can look at the value of info. } } } // The process has ended; check the return code. if( (info != 0) && (info != 1) ) { // Print warnings if there was a failure. if(sym) { arma_warn(1, "eigs_sym(): ARPACK error ", info, " in saupd()"); } else { arma_warn(1, "eigs_gen(): ARPACK error ", info, " in naupd()"); } return; // Parent frame can look at the value of info. } } #else { arma_ignore(n_eigvals); arma_ignore(which); arma_ignore(X); arma_ignore(sym); arma_ignore(n); arma_ignore(tol); arma_ignore(maxiter); arma_ignore(resid); arma_ignore(ncv); arma_ignore(v); arma_ignore(ldv); arma_ignore(iparam); arma_ignore(ipntr); arma_ignore(workd); arma_ignore(workl); arma_ignore(lworkl); arma_ignore(rwork); arma_ignore(info); } #endif } // Here 'sigma' is 'T', but should be 'eT'. // Applying complex shifts to real matrices is currently not directly implemented template inline void sp_auxlib::run_aupd_shiftinvert ( const uword n_eigvals, const T sigma, const SpMat& X, const bool sym, blas_int& n, eT& tol, blas_int& maxiter, podarray& resid, blas_int& ncv, podarray& v, blas_int& ldv, podarray& iparam, podarray& ipntr, podarray& workd, podarray& workl, blas_int& lworkl, podarray& rwork, blas_int& info ) { // TODO: inconsistent use of type names: T can be complex while eT can be real #if (defined(ARMA_USE_ARPACK) && defined(ARMA_USE_SUPERLU)) { char which_lm[3] = "LM"; char* which = which_lm; // NOTE: which_lm is the assumed operation when using shift-invert blas_int ido = 0; // This must be 0 for the first call. char bmat = 'I'; // We are considering the standard eigenvalue problem. n = X.n_rows; // The size of the matrix (should already be set outside). blas_int nev = n_eigvals; // resid.zeros(n); eigs_randu_filler randu_filler; randu_filler.fill(resid, n); // use deterministic starting point // Two constraints on NCV: (NCV > NEV) for sym problems or // (NCV > NEV + 2) for gen problems and (NCV <= N) // // We're calling either arpack::saupd() or arpack::naupd(), // which have slightly different minimum constraint and recommended value for NCV: // http://www.caam.rice.edu/software/ARPACK/UG/node136.html // http://www.caam.rice.edu/software/ARPACK/UG/node138.html if(ncv < (nev + (sym ? 1 : 3))) { ncv = (nev + (sym ? 1 : 3)); } if(ncv > n ) { ncv = n; } v.zeros(n * ncv); // Array N by NCV (output). rwork.zeros(ncv); // Work array of size NCV for complex calls. ldv = n; // "Leading dimension of V exactly as declared in the calling program." // IPARAM: integer array of length 11. iparam.zeros(11); iparam(0) = 1; // Exact shifts (not provided by us). iparam(2) = maxiter; // Maximum iterations; all the examples use 300, but they were written in the ancient times. // iparam(6) = 1; // Mode 1: A * x = lambda * x. // Change IPARAM for shift-invert iparam(6) = 3; // Mode 3: A * x = lambda * M * x, M symmetric semi-definite. OP = inv[A - sigma*M]*M (A complex) or Real_Part{ inv[A - sigma*M]*M } (A real) and B = M. // IPNTR: integer array of length 14 (output). ipntr.zeros(14); // Real work array used in the basic Arnoldi iteration for reverse communication. workd.zeros(3 * n); // lworkl must be at least 3 * NCV^2 + 6 * NCV. lworkl = 3 * (ncv * ncv) + 6 * ncv; // Real work array of length lworkl. workl.zeros(lworkl); // info = 0; // resid to be filled with random values by ARPACK (non-deterministic) info = 1; // resid is already filled with random values (deterministic) superlu_opts superlu_opts_default; superlu::superlu_options_t options; sp_auxlib::set_superlu_opts(options, superlu_opts_default); superlu::trans_t trans = superlu::NOTRANS; superlu::GlobalLU_t Glu; /* Not needed on return. */ arrayops::fill_zeros(reinterpret_cast(&Glu), sizeof(superlu::GlobalLU_t)); superlu_supermatrix_wrangler x; superlu_supermatrix_wrangler xC; const bool status_x = sp_auxlib::copy_to_supermatrix_with_shift(x.get_ref(), X, sigma); if(status_x == false) { arma_stop_runtime_error("run_aupd_shiftinvert(): could not construct SuperLU matrix"); info = blas_int(-1); return; } // // for debugging only // if(true) // { // cout << "*** testing output of copy_to_supermatrix_with_shift()" << endl; // cout << "*** sigma: " << sigma << endl; // // SpMat Y(X); // Y.diag() -= sigma; // // SpMat Z; // // sp_auxlib::copy_to_spmat(Z, x.get_ref()); // // cout << "*** size(Y): " << arma::size(Y) << endl; // cout << "*** size(Z): " << arma::size(Z) << endl; // cout << "*** accu(abs(Y)): " << accu(abs(Y)) << endl; // cout << "*** accu(abs(Z)): " << accu(abs(Z)) << endl; // // if(arma::size(Y) == arma::size(Z)) // { // cout << "*** error: " << accu(abs(Y-Z)) << endl; // } // } superlu_supermatrix_wrangler l; superlu_supermatrix_wrangler u; superlu_array_wrangler perm_c(X.n_cols+1); // paranoia: increase array length by 1 superlu_array_wrangler perm_r(X.n_rows+1); superlu_array_wrangler etree(X.n_cols+1); superlu_stat_wrangler stat; int panel_size = superlu::sp_ispec_environ(1); int relax = superlu::sp_ispec_environ(2); superlu::int_t lwork = 0; superlu::int_t slu_info = 0; // Return code. arma_debug_print("superlu::gstrf()"); superlu::get_permutation_c(options.ColPerm, x.get_ptr(), perm_c.get_ptr()); superlu::sp_preorder_mat(&options, x.get_ptr(), perm_c.get_ptr(), etree.get_ptr(), xC.get_ptr()); superlu::gstrf(&options, xC.get_ptr(), relax, panel_size, etree.get_ptr(), NULL, lwork, perm_c.get_ptr(), perm_r.get_ptr(), l.get_ptr(), u.get_ptr(), &Glu, stat.get_ptr(), &slu_info); if(slu_info != 0) { arma_warn(2, "matrix is singular to working precision"); info = blas_int(-1); return; } // NOTE: potential problem with inconsistent/mismatched use of eT and T types eT x_norm_val = sp_auxlib::norm1(x.get_ptr()); eT x_rcond = sp_auxlib::lu_rcond(l.get_ptr(), u.get_ptr(), x_norm_val); if( (x_rcond < std::numeric_limits::epsilon()) || arma_isnan(x_rcond) ) { arma_warn(2, "matrix is singular to working precision (rcond: ", x_rcond, ")"); info = blas_int(-1); return; } // All the parameters have been set or created. Time to loop a lot. while(ido != 99) { // Call saupd() or naupd() with the current parameters. if(sym) { arma_debug_print("arpack::saupd()"); arpack::saupd(&ido, &bmat, &n, which, &nev, &tol, resid.memptr(), &ncv, v.memptr(), &ldv, iparam.memptr(), ipntr.memptr(), workd.memptr(), workl.memptr(), &lworkl, &info); } else { arma_debug_print("arpack::naupd()"); arpack::naupd(&ido, &bmat, &n, which, &nev, &tol, resid.memptr(), &ncv, v.memptr(), &ldv, iparam.memptr(), ipntr.memptr(), workd.memptr(), workl.memptr(), &lworkl, rwork.memptr(), &info); } // What do we do now? switch (ido) { case -1: // fallthrough case 1: { // We need to calculate the matrix-vector multiplication y = OP * x // where x is of length n and starts at workd(ipntr(0)), // and y is of length n and starts at workd(ipntr(1)). // We have to subtract one from FORTRAN pointers. Col out(workd.memptr() + ipntr(1) - 1, n, false, true); Col in(workd.memptr() + ipntr(0) - 1, n, false, true); // Consider getting the LU factorization from ZGSTRF, and then // solve the system L*U*out = in (possibly with permutation matrix?) // Instead of "spsolve(out,X,in)" we call gstrf above and gstrs below out = in; superlu_supermatrix_wrangler out_slu; const bool status_out_slu = sp_auxlib::wrap_to_supermatrix(out_slu.get_ref(), out); if(status_out_slu == false) { arma_stop_runtime_error("run_aupd_shiftinvert(): could not construct SuperLU matrix"); return; } arma_debug_print("superlu::gstrs()"); superlu::gstrs(trans, l.get_ptr(), u.get_ptr(), perm_c.get_ptr(), perm_r.get_ptr(), out_slu.get_ptr(), stat.get_ptr(), &info); // No need to modify memory further since it was all done in-place. break; } case 99: // Nothing to do here, things have converged. break; default: { return; // Parent frame can look at the value of info. } } } // The process has ended; check the return code. if( (info != 0) && (info != 1) ) { // Print warnings if there was a failure. if(sym) { arma_warn(2, "eigs_sym(): ARPACK error ", info, " in saupd()"); } else { arma_warn(2, "eigs_gen(): ARPACK error ", info, " in naupd()"); } return; // Parent frame can look at the value of info. } } #else { arma_ignore(n_eigvals); arma_ignore(sigma); arma_ignore(X); arma_ignore(sym); arma_ignore(n); arma_ignore(tol); arma_ignore(maxiter); arma_ignore(resid); arma_ignore(ncv); arma_ignore(v); arma_ignore(ldv); arma_ignore(iparam); arma_ignore(ipntr); arma_ignore(workd); arma_ignore(workl); arma_ignore(lworkl); arma_ignore(rwork); arma_ignore(info); } #endif } template inline bool sp_auxlib::rudimentary_sym_check(const SpMat& X) { arma_debug_sigprint(); if(X.n_rows != X.n_cols) { return false; } const eT tol = eT(10000) * std::numeric_limits::epsilon(); // allow some leeway typename SpMat::const_iterator it = X.begin(); typename SpMat::const_iterator it_end = X.end(); const uword n_check_limit = (std::max)( uword(2), uword(X.n_nonzero/100) ); uword n_check = 1; while( (it != it_end) && (n_check <= n_check_limit) ) { const uword it_row = it.row(); const uword it_col = it.col(); if(it_row != it_col) { const eT A = (*it); const eT B = X.at( it_col, it_row ); // deliberately swapped const eT C = (std::max)(std::abs(A), std::abs(B)); const eT delta = std::abs(A - B); if(( (delta <= tol) || (delta <= (C * tol)) ) == false) { return false; } ++n_check; } ++it; } return true; } template inline bool sp_auxlib::rudimentary_sym_check(const SpMat< std::complex >& X) { arma_debug_sigprint(); // NOTE: the function name is a misnomer, as it checks for hermitian complex matrices; // NOTE: for simplicity of use, the function name is the same as for real matrices typedef typename std::complex eT; if(X.n_rows != X.n_cols) { return false; } const T tol = T(10000) * std::numeric_limits::epsilon(); // allow some leeway typename SpMat::const_iterator it = X.begin(); typename SpMat::const_iterator it_end = X.end(); const uword n_check_limit = (std::max)( uword(2), uword(X.n_nonzero/100) ); uword n_check = 1; while( (it != it_end) && (n_check <= n_check_limit) ) { const uword it_row = it.row(); const uword it_col = it.col(); if(it_row != it_col) { const eT A = (*it); const eT B = X.at( it_col, it_row ); // deliberately swapped const T C_real = (std::max)(std::abs(A.real()), std::abs(B.real())); const T C_imag = (std::max)(std::abs(A.imag()), std::abs(B.imag())); const T delta_real = std::abs(A.real() - B.real()); const T delta_imag = std::abs(A.imag() + B.imag()); // take into account the conjugate const bool okay_real = ( (delta_real <= tol) || (delta_real <= (C_real * tol)) ); const bool okay_imag = ( (delta_imag <= tol) || (delta_imag <= (C_imag * tol)) ); if( (okay_real == false) || (okay_imag == false) ) { return false; } ++n_check; } else { const eT A = (*it); if(std::abs(A.imag()) > tol) { return false; } } ++it; } return true; } // template inline eigs_randu_filler::eigs_randu_filler() { arma_debug_sigprint(); typedef typename std::mt19937_64::result_type local_seed_type; local_engine.seed(local_seed_type(123)); typedef typename std::uniform_real_distribution::param_type local_param_type; local_u_distr.param(local_param_type(-1.0, +1.0)); } template inline void eigs_randu_filler::fill(podarray& X, const uword N) { arma_debug_sigprint(); X.set_size(N); eT* X_mem = X.memptr(); for(uword i=0; i inline eigs_randu_filler< std::complex >::eigs_randu_filler() { arma_debug_sigprint(); typedef typename std::mt19937_64::result_type local_seed_type; local_engine.seed(local_seed_type(123)); typedef typename std::uniform_real_distribution::param_type local_param_type; local_u_distr.param(local_param_type(-1.0, +1.0)); } template inline void eigs_randu_filler< std::complex >::fill(podarray< std::complex >& X, const uword N) { arma_debug_sigprint(); typedef typename std::complex eT; X.set_size(N); eT* X_mem = X.memptr(); for(uword i=0; i(&m); bool all_zero = true; for(size_t i=0; i < sizeof(superlu::SuperMatrix); ++i) { if(m_char[i] != char(0)) { all_zero = false; break; } } if(all_zero == false) { sp_auxlib::destroy_supermatrix(m); } } inline superlu_supermatrix_wrangler::superlu_supermatrix_wrangler() { arma_debug_sigprint_this(this); arrayops::fill_zeros(reinterpret_cast(&m), sizeof(superlu::SuperMatrix)); } inline superlu::SuperMatrix& superlu_supermatrix_wrangler::get_ref() { used = true; return m; } inline superlu::SuperMatrix* superlu_supermatrix_wrangler::get_ptr() { used = true; return &m; } // inline superlu_stat_wrangler::~superlu_stat_wrangler() { arma_debug_sigprint_this(this); superlu::free_stat(&stat); } inline superlu_stat_wrangler::superlu_stat_wrangler() { arma_debug_sigprint_this(this); arrayops::fill_zeros(reinterpret_cast(&stat), sizeof(superlu::SuperLUStat_t)); superlu::init_stat(&stat); } inline superlu::SuperLUStat_t* superlu_stat_wrangler::get_ptr() { return &stat; } // template inline superlu_array_wrangler::~superlu_array_wrangler() { arma_debug_sigprint_this(this); (*this).reset(); } template inline superlu_array_wrangler::superlu_array_wrangler() : mem(nullptr) { arma_debug_sigprint_this(this); } template inline superlu_array_wrangler::superlu_array_wrangler(const uword n_elem) : mem(nullptr) { arma_debug_sigprint_this(this); (*this).set_size(n_elem); } template inline void superlu_array_wrangler::set_size(const uword n_elem) { arma_debug_sigprint(); if(mem != nullptr) { (*this).reset(); } mem = (eT*)(superlu::malloc(n_elem * sizeof(eT))); arma_check_bad_alloc( (mem == nullptr), "superlu::malloc(): out of memory" ); arrayops::fill_zeros(mem, n_elem); } template inline void superlu_array_wrangler::reset() { arma_debug_sigprint(); if(mem != nullptr) { superlu::free(mem); mem = nullptr; } } template inline eT* superlu_array_wrangler::get_ptr() { return mem; } // template inline superlu_worker::~superlu_worker() { arma_debug_sigprint_this(this); if(l != nullptr) { delete l; l = nullptr; } if(u != nullptr) { delete u; u = nullptr; } } template inline superlu_worker::superlu_worker() { arma_debug_sigprint_this(this); } template inline bool superlu_worker::factorise(typename get_pod_type::result& out_rcond, const SpMat& A, const superlu_opts& user_opts) { arma_debug_sigprint(); typedef typename get_pod_type::result T; factorisation_valid = false; if(l != nullptr) { delete l; l = nullptr; } if(u != nullptr) { delete u; u = nullptr; } l = new(std::nothrow) superlu_supermatrix_wrangler; u = new(std::nothrow) superlu_supermatrix_wrangler; if( (l == nullptr) || (u == nullptr) ) { arma_warn(3, "superlu_worker()::factorise(): could not construct SuperLU matrix"); return false; } superlu_supermatrix_wrangler& l_ref = (*l); superlu_supermatrix_wrangler& u_ref = (*u); superlu::superlu_options_t options; sp_auxlib::set_superlu_opts(options, user_opts); superlu_supermatrix_wrangler AA; superlu_supermatrix_wrangler AAc; const bool status_AA = sp_auxlib::copy_to_supermatrix(AA.get_ref(), A); if(status_AA == false) { arma_warn(3, "superlu_worker()::factorise(): could not construct SuperLU matrix"); return false; } (*this).perm_c.set_size(A.n_cols+1); // paranoia: increase array length by 1 (*this).perm_r.set_size(A.n_rows+1); superlu_array_wrangler etree(A.n_cols+1); superlu::GlobalLU_t Glu; arrayops::fill_zeros(reinterpret_cast(&Glu), sizeof(superlu::GlobalLU_t)); int panel_size = superlu::sp_ispec_environ(1); int relax = superlu::sp_ispec_environ(2); superlu::int_t lwork = 0; superlu::int_t info = 0; arma_debug_print("superlu::superlu::get_permutation_c()"); superlu::get_permutation_c(options.ColPerm, AA.get_ptr(), perm_c.get_ptr()); arma_debug_print("superlu::superlu::sp_preorder_mat()"); superlu::sp_preorder_mat(&options, AA.get_ptr(), perm_c.get_ptr(), etree.get_ptr(), AAc.get_ptr()); arma_debug_print("superlu::gstrf()"); superlu::gstrf(&options, AAc.get_ptr(), relax, panel_size, etree.get_ptr(), NULL, lwork, perm_c.get_ptr(), perm_r.get_ptr(), l_ref.get_ptr(), u_ref.get_ptr(), &Glu, stat.get_ptr(), &info); if(info != 0) { arma_warn(3, "superlu_worker()::factorise(): LU factorisation failed"); return false; } const T AA_norm = sp_auxlib::norm1(AA.get_ptr()); const T AA_rcond = sp_auxlib::lu_rcond(l_ref.get_ptr(), u_ref.get_ptr(), AA_norm); out_rcond = AA_rcond; if(arma_isnan(AA_rcond)) { return false; } // if(AA_rcond == T(0)) { return false; } factorisation_valid = true; return true; } template inline bool superlu_worker::solve(Mat& X, const Mat& B) { arma_debug_sigprint(); if(factorisation_valid == false) { return false; } if( (l == nullptr) || (u == nullptr) ) { return false; } superlu_supermatrix_wrangler& l_ref = (*l); superlu_supermatrix_wrangler& u_ref = (*u); X = B; superlu_supermatrix_wrangler XX; const bool status_XX = sp_auxlib::wrap_to_supermatrix(XX.get_ref(), X); if(status_XX == false) { arma_warn(3, "superlu_worker()::solve(): could not construct SuperLU matrix"); return false; } superlu::trans_t trans = superlu::NOTRANS; int info = 0; arma_debug_print("superlu::gstrs()"); superlu::gstrs(trans, l_ref.get_ptr(), u_ref.get_ptr(), perm_c.get_ptr(), perm_r.get_ptr(), XX.get_ptr(), stat.get_ptr(), &info); return (info == 0); } #endif //! @} RcppArmadillo/inst/include/armadillo_bits/spglue_merge_bones.hpp0000644000176200001440000000246014413016473024752 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup spglue_merge //! @{ class spglue_merge { public: template inline static void subview_merge(SpSubview& sv, const SpMat& B); template inline static void subview_merge(SpSubview& sv, const Mat& B); template inline static void symmat_merge(SpMat& out, const SpMat& A, const SpMat& B); template inline static void diagview_merge(SpMat& out, const SpMat& A, const SpMat& B); }; //! @} RcppArmadillo/inst/include/armadillo_bits/fn_misc.hpp0000644000176200001440000003071515030507611022523 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_misc //! @{ template arma_warn_unused inline typename enable_if2 < is_Mat::value, out_type >::result linspace ( const typename out_type::pod_type start, const typename out_type::pod_type end, const uword num = 100u ) { arma_debug_sigprint(); typedef typename out_type::elem_type eT; typedef typename out_type::pod_type T; out_type x; if(num == 1) { x.set_size(1); x[0] = eT(end); } else if(num >= 2) { x.set_size(num); eT* x_mem = x.memptr(); const uword num_m1 = num - 1; if(is_non_integral::value) { const T delta = (end-start)/T(num_m1); for(uword i=0; i= start) ? double(end-start)/double(num_m1) : -double(start-end)/double(num_m1); for(uword i=0; i(start, end, num); } template arma_warn_unused inline typename enable_if2 < (is_Mat::value && is_real::value), out_type >::result logspace ( const typename out_type::pod_type A, const typename out_type::pod_type B, const uword N = 50u ) { arma_debug_sigprint(); typedef typename out_type::elem_type eT; typedef typename out_type::pod_type T; out_type x = linspace(A,B,N); const uword n_elem = x.n_elem; eT* x_mem = x.memptr(); for(uword i=0; i < n_elem; ++i) { x_mem[i] = std::pow(T(10), x_mem[i]); } return x; } arma_warn_unused inline vec logspace(const double A, const double B, const uword N = 50u) { arma_debug_sigprint(); return logspace(A, B, N); } //! kept for compatibility with old user code template arma_frown("change arma::is_finite(val) to std::isfinite(val)") inline bool is_finite(const eT x, const typename arma_scalar_only::result* junk = nullptr) { arma_ignore(junk); return arma_isfinite(x); } //! kept for compatibility with old user code template arma_frown("change arma::is_finite(X) to X.is_finite()") inline bool is_finite(const Base& X) { arma_debug_sigprint(); return X.is_finite(); } //! kept for compatibility with old user code template arma_frown("change arma::is_finite(X) to X.is_finite()") inline bool is_finite(const SpBase& X) { arma_debug_sigprint(); return X.is_finite(); } //! kept for compatibility with old user code template arma_frown("change arma::is_finite(X) to X.is_finite()") inline bool is_finite(const BaseCube& X) { arma_debug_sigprint(); return X.is_finite(); } template inline void swap(Mat& A, Mat& B) { arma_debug_sigprint(); A.swap(B); } template inline void swap(Cube& A, Cube& B) { arma_debug_sigprint(); A.swap(B); } arma_warn_unused inline uvec ind2sub(const SizeMat& s, const uword i) { arma_debug_sigprint(); const uword s_n_rows = s.n_rows; arma_conform_check( (i >= (s_n_rows * s.n_cols) ), "ind2sub(): index out of range" ); const uword row = i % s_n_rows; const uword col = i / s_n_rows; uvec out(2, arma_nozeros_indicator()); uword* out_mem = out.memptr(); out_mem[0] = row; out_mem[1] = col; return out; } template arma_warn_unused inline typename enable_if2< (is_arma_type::value && is_same_type::yes), umat >::result ind2sub(const SizeMat& s, const T1& indices) { arma_debug_sigprint(); const uword s_n_rows = s.n_rows; const uword s_n_elem = s_n_rows * s.n_cols; const Proxy P(indices); const uword P_n_rows = P.get_n_rows(); const uword P_n_cols = P.get_n_cols(); const uword P_n_elem = P.get_n_elem(); const bool P_is_empty = (P_n_elem == 0); const bool P_is_vec = ((P_n_rows == 1) || (P_n_cols == 1)); arma_conform_check( ((P_is_empty == false) && (P_is_vec == false)), "ind2sub(): parameter 'indices' must be a vector" ); umat out(2, P_n_elem, arma_nozeros_indicator()); if(Proxy::use_at == false) { typename Proxy::ea_type Pea = P.get_ea(); for(uword count=0; count < P_n_elem; ++count) { const uword i = Pea[count]; arma_conform_check( (i >= s_n_elem), "ind2sub(): index out of range" ); const uword row = i % s_n_rows; const uword col = i / s_n_rows; uword* out_colptr = out.colptr(count); out_colptr[0] = row; out_colptr[1] = col; } } else { if(P_n_rows == 1) { for(uword count=0; count < P_n_cols; ++count) { const uword i = P.at(0,count); arma_conform_check( (i >= s_n_elem), "ind2sub(): index out of range" ); const uword row = i % s_n_rows; const uword col = i / s_n_rows; uword* out_colptr = out.colptr(count); out_colptr[0] = row; out_colptr[1] = col; } } else if(P_n_cols == 1) { for(uword count=0; count < P_n_rows; ++count) { const uword i = P.at(count,0); arma_conform_check( (i >= s_n_elem), "ind2sub(): index out of range" ); const uword row = i % s_n_rows; const uword col = i / s_n_rows; uword* out_colptr = out.colptr(count); out_colptr[0] = row; out_colptr[1] = col; } } } return out; } arma_warn_unused inline uvec ind2sub(const SizeCube& s, const uword i) { arma_debug_sigprint(); const uword s_n_rows = s.n_rows; const uword s_n_elem_slice = s_n_rows * s.n_cols; arma_conform_check( (i >= (s_n_elem_slice * s.n_slices) ), "ind2sub(): index out of range" ); const uword slice = i / s_n_elem_slice; const uword j = i - (slice * s_n_elem_slice); const uword row = j % s_n_rows; const uword col = j / s_n_rows; uvec out(3, arma_nozeros_indicator()); uword* out_mem = out.memptr(); out_mem[0] = row; out_mem[1] = col; out_mem[2] = slice; return out; } template arma_warn_unused inline typename enable_if2< (is_arma_type::value && is_same_type::yes), umat >::result ind2sub(const SizeCube& s, const T1& indices) { arma_debug_sigprint(); const uword s_n_rows = s.n_rows; const uword s_n_elem_slice = s_n_rows * s.n_cols; const uword s_n_elem = s.n_slices * s_n_elem_slice; const quasi_unwrap U(indices); arma_conform_check( ((U.M.is_empty() == false) && (U.M.is_vec() == false)), "ind2sub(): parameter 'indices' must be a vector" ); const uword U_n_elem = U.M.n_elem; const uword* U_mem = U.M.memptr(); umat out(3, U_n_elem, arma_nozeros_indicator()); for(uword count=0; count < U_n_elem; ++count) { const uword i = U_mem[count]; arma_conform_check( (i >= s_n_elem), "ind2sub(): index out of range" ); const uword slice = i / s_n_elem_slice; const uword j = i - (slice * s_n_elem_slice); const uword row = j % s_n_rows; const uword col = j / s_n_rows; uword* out_colptr = out.colptr(count); out_colptr[0] = row; out_colptr[1] = col; out_colptr[2] = slice; } return out; } arma_warn_unused arma_inline uword sub2ind(const SizeMat& s, const uword row, const uword col) { arma_debug_sigprint(); const uword s_n_rows = s.n_rows; arma_conform_check( ((row >= s_n_rows) || (col >= s.n_cols)), "sub2ind(): subscript out of range" ); return uword(row + col*s_n_rows); } template arma_warn_unused inline uvec sub2ind(const SizeMat& s, const Base& subscripts) { arma_debug_sigprint(); const uword s_n_rows = s.n_rows; const uword s_n_cols = s.n_cols; const quasi_unwrap U(subscripts.get_ref()); arma_conform_check( (U.M.n_rows != 2), "sub2ind(): matrix of subscripts must have 2 rows" ); const uword U_M_n_cols = U.M.n_cols; uvec out(U_M_n_cols, arma_nozeros_indicator()); uword* out_mem = out.memptr(); const uword* U_M_mem = U.M.memptr(); for(uword count=0; count < U_M_n_cols; ++count) { const uword row = U_M_mem[0]; const uword col = U_M_mem[1]; U_M_mem += 2; // next column arma_conform_check( ((row >= s_n_rows) || (col >= s_n_cols)), "sub2ind(): subscript out of range" ); out_mem[count] = uword(row + col*s_n_rows); } return out; } arma_warn_unused arma_inline uword sub2ind(const SizeCube& s, const uword row, const uword col, const uword slice) { arma_debug_sigprint(); const uword s_n_rows = s.n_rows; const uword s_n_cols = s.n_cols; arma_conform_check( ((row >= s_n_rows) || (col >= s_n_cols) || (slice >= s.n_slices)), "sub2ind(): subscript out of range" ); return uword( (slice * s_n_rows * s_n_cols) + (col * s_n_rows) + row ); } template arma_warn_unused inline uvec sub2ind(const SizeCube& s, const Base& subscripts) { arma_debug_sigprint(); const uword s_n_rows = s.n_rows; const uword s_n_cols = s.n_cols; const uword s_n_slices = s.n_slices; const quasi_unwrap U(subscripts.get_ref()); arma_conform_check( (U.M.n_rows != 3), "sub2ind(): matrix of subscripts must have 3 rows" ); const uword U_M_n_cols = U.M.n_cols; uvec out(U_M_n_cols, arma_nozeros_indicator()); uword* out_mem = out.memptr(); const uword* U_M_mem = U.M.memptr(); for(uword count=0; count < U_M_n_cols; ++count) { const uword row = U_M_mem[0]; const uword col = U_M_mem[1]; const uword slice = U_M_mem[2]; U_M_mem += 3; // next column arma_conform_check( ((row >= s_n_rows) || (col >= s_n_cols) || (slice >= s_n_slices)), "sub2ind(): subscript out of range" ); out_mem[count] = uword( (slice * s_n_rows * s_n_cols) + (col * s_n_rows) + row ); } return out; } template arma_inline typename enable_if2 < (is_arma_type::value && is_same_type::value), const Glue >::result affmul(const T1& A, const T2& B) { arma_debug_sigprint(); return Glue(A,B); } namespace priv { // internal use only template arma_warn_unused inline typename arma_real_only::result internal_log_add_exp(eT log_a, eT log_b) { if(log_a < log_b) { std::swap(log_a, log_b); } const eT negdelta = log_b - log_a; if( (negdelta < Datum::log_min) || arma_isnonfinite(negdelta) ) { return log_a; } else { return (log_a + std::log1p(std::exp(negdelta))); } } } // DO NOT USE; kept only for compatibility with old user code template arma_deprecated inline typename arma_real_only::result log_add_exp(eT log_a, eT log_b) { return priv::internal_log_add_exp(log_a, log_b); } // DO NOT USE; kept only for compatibility with old user code template arma_deprecated inline typename arma_real_only::result log_add(eT log_a, eT log_b) { return priv::internal_log_add_exp(log_a, log_b); } //! @} RcppArmadillo/inst/include/armadillo_bits/arma_rng_cxx03.hpp0000644000176200001440000000747114301267043023725 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup arma_rng_cxx03 //! @{ class arma_rng_cxx03 { public: typedef unsigned int seed_type; inline static void set_seed(const seed_type val); arma_inline static int randi_val(); arma_inline static double randu_val(); inline static double randn_val(); template inline static void randn_dual_val(eT& out1, eT& out2); template inline static void randi_fill(eT* mem, const uword N, const int a, const int b); inline static int randi_max_val(); }; inline void arma_rng_cxx03::set_seed(const arma_rng_cxx03::seed_type val) { std::srand(val); } arma_inline int arma_rng_cxx03::randi_val() { #if (RAND_MAX == 32767) { // NOTE: this is a better-than-nothing solution // NOTE: see also arma_rng_cxx03::randi_max_val() u32 val1 = u32(std::rand()); u32 val2 = u32(std::rand()); val1 <<= 15; return (val1 | val2); } #else { return std::rand(); } #endif } arma_inline double arma_rng_cxx03::randu_val() { return double( double(randi_val()) * ( double(1) / double(randi_max_val()) ) ); } inline double arma_rng_cxx03::randn_val() { // polar form of the Box-Muller transformation: // http://en.wikipedia.org/wiki/Box-Muller_transformation // http://en.wikipedia.org/wiki/Marsaglia_polar_method double tmp1 = double(0); double tmp2 = double(0); double w = double(0); do { tmp1 = double(2) * double(randi_val()) * (double(1) / double(randi_max_val())) - double(1); tmp2 = double(2) * double(randi_val()) * (double(1) / double(randi_max_val())) - double(1); w = tmp1*tmp1 + tmp2*tmp2; } while( w >= double(1) ); return double( tmp1 * std::sqrt( (double(-2) * std::log(w)) / w) ); } template inline void arma_rng_cxx03::randn_dual_val(eT& out1, eT& out2) { // make sure we are internally using at least floats typedef typename promote_type::result eTp; eTp tmp1 = eTp(0); eTp tmp2 = eTp(0); eTp w = eTp(0); do { tmp1 = eTp(2) * eTp(randi_val()) * (eTp(1) / eTp(randi_max_val())) - eTp(1); tmp2 = eTp(2) * eTp(randi_val()) * (eTp(1) / eTp(randi_max_val())) - eTp(1); w = tmp1*tmp1 + tmp2*tmp2; } while( w >= eTp(1) ); const eTp k = std::sqrt( (eTp(-2) * std::log(w)) / w); out1 = eT(tmp1*k); out2 = eT(tmp2*k); } template inline void arma_rng_cxx03::randi_fill(eT* mem, const uword N, const int a, const int b) { if( (a == 0) && (b == RAND_MAX) ) { for(uword i=0; i arma_warn_unused inline typename enable_if2< is_arma_type::value && resolves_to_vector::yes, typename T1::elem_type >::result max(const T1& X) { arma_debug_sigprint(); return op_max::max(X); } template arma_warn_unused arma_inline typename enable_if2< is_arma_type::value && resolves_to_vector::no, const Op >::result max(const T1& X) { arma_debug_sigprint(); return Op(X, 0, 0); } template arma_warn_unused arma_inline typename enable_if2< is_arma_type::value, const Op >::result max(const T1& X, const uword dim) { arma_debug_sigprint(); return Op(X, dim, 0); } template arma_warn_unused arma_inline typename arma_scalar_only::result max(const T& x) { return x; } //! element-wise maximum template arma_warn_unused arma_inline typename enable_if2 < ( is_arma_type::value && is_arma_type::value && is_same_type::value ), const Glue >::result max ( const T1& X, const T2& Y ) { arma_debug_sigprint(); return Glue(X, Y); } template arma_warn_unused arma_inline const OpCube max ( const BaseCube& X, const uword dim = 0 ) { arma_debug_sigprint(); return OpCube(X.get_ref(), dim, 0); } template arma_warn_unused arma_inline const GlueCube max ( const BaseCube& X, const BaseCube& Y ) { arma_debug_sigprint(); return GlueCube(X.get_ref(), Y.get_ref()); } template arma_warn_unused inline typename enable_if2 < is_arma_sparse_type::value && resolves_to_sparse_vector::yes, typename T1::elem_type >::result max(const T1& x) { arma_debug_sigprint(); return op_sp_max::vector_max(x); } template arma_warn_unused inline typename enable_if2 < is_arma_sparse_type::value && resolves_to_sparse_vector::no, const mtSpReduceOp >::result max(const T1& X) { arma_debug_sigprint(); return mtSpReduceOp(X, 0, 0); } template arma_warn_unused inline typename enable_if2 < is_arma_sparse_type::value, const mtSpReduceOp >::result max(const T1& X, const uword dim) { arma_debug_sigprint(); return mtSpReduceOp(X, dim, 0); } // elementwise sparse max template arma_warn_unused inline typename enable_if2 < (is_arma_sparse_type::value && is_arma_sparse_type::value && is_same_type::value), const SpGlue >::result max(const T1& x, const T2& y) { arma_debug_sigprint(); return SpGlue(x, y); } //! elementwise max of dense and sparse objects with the same element type template inline typename enable_if2 < (is_arma_type::value && is_arma_sparse_type::value && is_same_type::value), Mat >::result max ( const T1& x, const T2& y ) { arma_debug_sigprint(); Mat out; spglue_max::dense_sparse_max(out, x, y); return out; } //! elementwise max of sparse and dense objects with the same element type template inline typename enable_if2 < (is_arma_sparse_type::value && is_arma_type::value && is_same_type::value), Mat >::result max ( const T1& x, const T2& y ) { arma_debug_sigprint(); Mat out; // Just call the other order (these operations are commutative) // TODO: if there is a matrix size mismatch, the debug assert will print the matrix sizes in wrong order spglue_max::dense_sparse_max(out, y, x); return out; } arma_warn_unused inline uword max(const SizeMat& s) { return (std::max)(s.n_rows, s.n_cols); } arma_warn_unused inline uword max(const SizeCube& s) { return (std::max)( (std::max)(s.n_rows, s.n_cols), s.n_slices ); } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_repelem.hpp0000644000176200001440000000252114631567470023232 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_repelem //! @{ template arma_warn_unused arma_inline typename enable_if2 < is_arma_type::value, const Op >::result repelem(const T1& A, const uword r, const uword c) { arma_debug_sigprint(); return Op(A, r, c); } template arma_warn_unused arma_inline const SpOp repelem(const SpBase& A, const uword r, const uword c) { arma_debug_sigprint(); return SpOp(A.get_ref(), r, c); } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_range.hpp0000644000176200001440000000306314631567470022677 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_range //! @{ template arma_warn_unused inline typename enable_if2< is_arma_type::value && resolves_to_vector::yes, typename T1::elem_type >::result range(const T1& X) { arma_debug_sigprint(); return op_range::vector_range(X); } template arma_warn_unused arma_inline typename enable_if2< is_arma_type::value && resolves_to_vector::no, const Op >::result range(const T1& X) { arma_debug_sigprint(); return Op(X, 0, 0); } template arma_warn_unused arma_inline typename enable_if2< is_arma_type::value, const Op >::result range(const T1& X, const uword dim) { arma_debug_sigprint(); return Op(X, dim, 0); } //! @} RcppArmadillo/inst/include/armadillo_bits/operator_cube_schur.hpp0000644000176200001440000000615714631567470025164 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup operator_cube_schur //! @{ // operator %, which we define it to do a schur product (element-wise multiplication) //! element-wise multiplication of BaseCube objects with same element type template arma_inline const eGlueCube operator% ( const BaseCube& X, const BaseCube& Y ) { arma_debug_sigprint(); return eGlueCube(X.get_ref(), Y.get_ref()); } //! element-wise multiplication of BaseCube objects with different element types template inline const mtGlueCube::result, T1, T2, glue_mixed_schur> operator% ( const BaseCube< typename force_different_type::T1_result, T1>& X, const BaseCube< typename force_different_type::T2_result, T2>& Y ) { arma_debug_sigprint(); typedef typename T1::elem_type eT1; typedef typename T2::elem_type eT2; typedef typename promote_type::result out_eT; promote_type::check(); return mtGlueCube( X.get_ref(), Y.get_ref() ); } template arma_inline Cube operator% ( const subview_cube_each1& X, const Base& Y ) { arma_debug_sigprint(); return subview_cube_each1_aux::operator_schur(X, Y.get_ref()); } template arma_inline Cube operator% ( const Base& X, const subview_cube_each1& Y ) { arma_debug_sigprint(); return subview_cube_each1_aux::operator_schur(Y, X.get_ref()); // NOTE: swapped order } template arma_inline Cube operator% ( const subview_cube_each2& X, const Base& Y ) { arma_debug_sigprint(); return subview_cube_each2_aux::operator_schur(X, Y.get_ref()); } template arma_inline Cube operator% ( const Base& X, const subview_cube_each2& Y ) { arma_debug_sigprint(); return subview_cube_each2_aux::operator_schur(Y, X.get_ref()); // NOTE: swapped order } //! @} RcppArmadillo/inst/include/armadillo_bits/mtOpCube_bones.hpp0000644000176200001440000000443114752446051024017 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup mtOpCube //! @{ struct mtOpCube_dual_aux_indicator {}; template class mtOpCube : public BaseCube< out_eT, mtOpCube > { public: typedef out_eT elem_type; typedef typename get_pod_type::result pod_type; typedef typename T1::elem_type in_eT; inline explicit mtOpCube(const T1& in_m); inline mtOpCube(const T1& in_m, const in_eT in_aux); inline mtOpCube(const T1& in_m, const uword in_aux_uword_a, const uword in_aux_uword_b, const uword in_aux_uword_c); inline mtOpCube(const T1& in_m, const in_eT in_aux, const uword in_aux_uword_a, const uword in_aux_uword_b, const uword in_aux_uword_c); inline mtOpCube(const char junk, const T1& in_m, const out_eT in_aux); inline mtOpCube(const mtOpCube_dual_aux_indicator&, const T1& in_m, const in_eT in_aux_a, const out_eT in_aux_b); inline ~mtOpCube(); const T1& m; //!< the operand; must be derived from BaseCube in_eT aux; //!< auxiliary data, using the element type as used by T1 out_eT aux_out_eT; //!< auxiliary data, using the element type as specified by the out_eT template parameter uword aux_uword_a; //!< auxiliary data, uword format uword aux_uword_b; //!< auxiliary data, uword format uword aux_uword_c; //!< auxiliary data, uword format }; //! @} RcppArmadillo/inst/include/armadillo_bits/spop_repmat_bones.hpp0000644000176200001440000000223514301267044024623 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup spop_repmat //! @{ class spop_repmat : public traits_op_default { public: template inline static void apply(SpMat& out, const SpOp& X); template inline static void apply_noalias(SpMat& out, const uword A_n_rows, const uword A_n_cols, const SpMat& B); }; //! @} RcppArmadillo/inst/include/armadillo_bits/glue_powext_bones.hpp0000644000176200001440000000527114312055467024645 0ustar liggesusers // SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup glue_powext //! @{ class glue_powext : public traits_glue_or { public: template inline static void apply(Mat& out, const Glue& X); template inline static void apply(Mat& out, const Mat& A, const Mat& B); template inline static Mat apply(const subview_each1& X, const Base& Y); // template inline static void apply(Cube& out, const GlueCube& X); template inline static void apply(Cube& out, const Cube& A, const Cube& B); template inline static Cube apply(const subview_cube_each1& X, const Base& Y); }; class glue_powext_cx : public traits_glue_or { public: template inline static void apply(Mat& out, const mtGlue& X); template inline static void apply(Mat< std::complex >& out, const Mat< std::complex >& A, const Mat& B); template inline static Mat apply(const subview_each1& X, const Base& Y); // template inline static void apply(Cube& out, const mtGlueCube& X); template inline static void apply(Cube< std::complex >& out, const Cube< std::complex >& A, const Cube& B); template inline static Cube< std::complex > apply(const subview_cube_each1< std::complex >& X, const Base& Y); }; //! @} RcppArmadillo/inst/include/armadillo_bits/Col_bones.hpp0000644000176200001440000002636514723642672023035 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup Col //! @{ //! Class for column vectors (matrices with only one column) template class Col : public Mat { public: typedef eT elem_type; typedef typename get_pod_type::result pod_type; static constexpr bool is_col = true; static constexpr bool is_row = false; static constexpr bool is_xvec = false; inline Col(); inline Col(const Col& X); inline explicit Col(const uword n_elem); inline explicit Col(const uword in_rows, const uword in_cols); inline explicit Col(const SizeMat& s); template inline explicit Col(const uword n_elem, const arma_initmode_indicator&); template inline explicit Col(const uword in_rows, const uword in_cols, const arma_initmode_indicator&); template inline explicit Col(const SizeMat& s, const arma_initmode_indicator&); template inline Col(const uword n_elem, const fill::fill_class& f); template inline Col(const uword in_rows, const uword in_cols, const fill::fill_class& f); template inline Col(const SizeMat& s, const fill::fill_class& f); inline Col(const uword N, const fill::scalar_holder f); inline Col(const uword in_rows, const uword in_cols, const fill::scalar_holder f); inline Col(const SizeMat& s, const fill::scalar_holder f); inline Col(const char* text); inline Col& operator=(const char* text); inline Col(const std::string& text); inline Col& operator=(const std::string& text); inline Col(const std::vector& x); inline Col& operator=(const std::vector& x); inline Col(const std::initializer_list& list); inline Col& operator=(const std::initializer_list& list); inline Col(Col&& m); inline Col& operator=(Col&& m); // inline Col(Mat&& m); // inline Col& operator=(Mat&& m); inline Col& operator=(const eT val); inline Col& operator=(const Col& m); template inline Col(const Base& X); template inline Col& operator=(const Base& X); template inline explicit Col(const SpBase& X); template inline Col& operator=(const SpBase& X); inline Col( eT* aux_mem, const uword aux_length, const bool copy_aux_mem = true, const bool strict = false); inline Col(const eT* aux_mem, const uword aux_length); template inline explicit Col(const Base& A, const Base& B); template inline Col(const BaseCube& X); template inline Col& operator=(const BaseCube& X); inline Col(const subview_cube& X); inline Col& operator=(const subview_cube& X); arma_frown("use braced initialiser list instead") inline mat_injector operator<<(const eT val); arma_warn_unused arma_inline const Op,op_htrans> t() const; arma_warn_unused arma_inline const Op,op_htrans> ht() const; arma_warn_unused arma_inline const Op,op_strans> st() const; arma_warn_unused arma_inline const Op,op_strans> as_row() const; arma_inline subview_col row(const uword row_num); arma_inline const subview_col row(const uword row_num) const; using Mat::rows; using Mat::operator(); arma_inline subview_col rows(const uword in_row1, const uword in_row2); arma_inline const subview_col rows(const uword in_row1, const uword in_row2) const; arma_inline subview_col subvec(const uword in_row1, const uword in_row2); arma_inline const subview_col subvec(const uword in_row1, const uword in_row2) const; arma_inline subview_col rows(const span& row_span); arma_inline const subview_col rows(const span& row_span) const; arma_inline subview_col subvec(const span& row_span); arma_inline const subview_col subvec(const span& row_span) const; arma_inline subview_col operator()(const span& row_span); arma_inline const subview_col operator()(const span& row_span) const; arma_inline subview_col subvec(const uword start_row, const SizeMat& s); arma_inline const subview_col subvec(const uword start_row, const SizeMat& s) const; arma_inline subview_col head(const uword N); arma_inline const subview_col head(const uword N) const; arma_inline subview_col tail(const uword N); arma_inline const subview_col tail(const uword N) const; arma_inline subview_col head_rows(const uword N); arma_inline const subview_col head_rows(const uword N) const; arma_inline subview_col tail_rows(const uword N); arma_inline const subview_col tail_rows(const uword N) const; inline void shed_row (const uword row_num); inline void shed_rows(const uword in_row1, const uword in_row2); template inline void shed_rows(const Base& indices); arma_deprecated inline void insert_rows(const uword row_num, const uword N, const bool set_to_zero); inline void insert_rows(const uword row_num, const uword N); template inline void insert_rows(const uword row_num, const Base& X); arma_warn_unused arma_inline eT& at(const uword i); arma_warn_unused arma_inline const eT& at(const uword i) const; arma_warn_unused arma_inline eT& at(const uword in_row, const uword in_col); arma_warn_unused arma_inline const eT& at(const uword in_row, const uword in_col) const; typedef eT* row_iterator; typedef const eT* const_row_iterator; inline row_iterator begin_row(const uword row_num); inline const_row_iterator begin_row(const uword row_num) const; inline row_iterator end_row (const uword row_num); inline const_row_iterator end_row (const uword row_num) const; template class fixed; protected: inline Col(const arma_fixed_indicator&, const uword in_n_elem, const eT* in_mem); public: #if defined(ARMA_EXTRA_COL_PROTO) #include ARMA_INCFILE_WRAP(ARMA_EXTRA_COL_PROTO) #endif }; template template class Col::fixed : public Col { private: using Mat::mem_local; static constexpr bool use_extra = (fixed_n_elem > arma_config::mat_prealloc); arma_align_mem eT mem_local_extra[ (use_extra) ? fixed_n_elem : 1 ]; public: typedef fixed Col_fixed_type; typedef eT elem_type; typedef typename get_pod_type::result pod_type; static constexpr bool is_col = true; static constexpr bool is_row = false; static constexpr bool is_xvec = false; static const uword n_rows; // value provided below the class definition static const uword n_cols; // value provided below the class definition static const uword n_elem; // value provided below the class definition arma_inline fixed(); arma_inline fixed(const fixed& X); inline fixed(const subview_cube& X); inline fixed(const fill::scalar_holder f); template inline fixed(const fill::fill_class& f); template inline fixed(const Base& A); template inline fixed(const Base& A, const Base& B); inline fixed(const eT* aux_mem); inline fixed(const char* text); inline fixed(const std::string& text); template inline Col& operator=(const Base& A); inline Col& operator=(const eT val); inline Col& operator=(const char* text); inline Col& operator=(const std::string& text); inline Col& operator=(const subview_cube& X); using Col::operator(); inline fixed(const std::initializer_list& list); inline Col& operator=(const std::initializer_list& list); arma_inline Col& operator=(const fixed& X); #if defined(ARMA_GOOD_COMPILER) template inline Col& operator=(const eOp& X); template inline Col& operator=(const eGlue& X); #endif arma_warn_unused arma_inline const Op< Col_fixed_type, op_htrans > t() const; arma_warn_unused arma_inline const Op< Col_fixed_type, op_htrans > ht() const; arma_warn_unused arma_inline const Op< Col_fixed_type, op_strans > st() const; arma_warn_unused arma_inline const eT& at_alt (const uword i) const; arma_warn_unused arma_inline eT& operator[] (const uword i); arma_warn_unused arma_inline const eT& operator[] (const uword i) const; arma_warn_unused arma_inline eT& at (const uword i); arma_warn_unused arma_inline const eT& at (const uword i) const; arma_warn_unused arma_inline eT& operator() (const uword i); arma_warn_unused arma_inline const eT& operator() (const uword i) const; arma_warn_unused arma_inline eT& at (const uword in_row, const uword in_col); arma_warn_unused arma_inline const eT& at (const uword in_row, const uword in_col) const; arma_warn_unused arma_inline eT& operator() (const uword in_row, const uword in_col); arma_warn_unused arma_inline const eT& operator() (const uword in_row, const uword in_col) const; arma_warn_unused arma_inline eT* memptr(); arma_warn_unused arma_inline const eT* memptr() const; inline const Col& fill(const eT val); inline const Col& zeros(); inline const Col& ones(); }; // these definitions are outside of the class due to bizarre C++ rules; // C++17 has inline variables to address this shortcoming template template const uword Col::fixed::n_rows = fixed_n_elem; template template const uword Col::fixed::n_cols = 1u; template template const uword Col::fixed::n_elem = fixed_n_elem; //! @} RcppArmadillo/inst/include/armadillo_bits/op_cumprod_bones.hpp0000644000176200001440000000247014301267043024441 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_cumprod //! @{ class op_cumprod : public traits_op_default { public: template inline static void apply_noalias(Mat& out, const Mat& X, const uword dim); template inline static void apply(Mat& out, const Op& in); }; class op_cumprod_vec : public traits_op_passthru { public: template inline static void apply(Mat& out, const Op& in); }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_diff_meat.hpp0000644000176200001440000001163614631567470023541 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_diff //! @{ template inline void op_diff::apply_noalias(Mat& out, const Mat& X, const uword k, const uword dim) { arma_debug_sigprint(); uword n_rows = X.n_rows; uword n_cols = X.n_cols; if(dim == 0) { if(n_rows <= k) { out.set_size(0,n_cols); return; } --n_rows; out.set_size(n_rows,n_cols); for(uword col=0; col < n_cols; ++col) { eT* out_colmem = out.colptr(col); const eT* X_colmem = X.colptr(col); for(uword row=0; row < n_rows; ++row) { const eT val0 = X_colmem[row ]; const eT val1 = X_colmem[row+1]; out_colmem[row] = val1 - val0; } } if(k >= 2) { for(uword iter=2; iter <= k; ++iter) { --n_rows; for(uword col=0; col < n_cols; ++col) { eT* colmem = out.colptr(col); for(uword row=0; row < n_rows; ++row) { const eT val0 = colmem[row ]; const eT val1 = colmem[row+1]; colmem[row] = val1 - val0; } } } out = out( span(0,n_rows-1), span::all ); } } else if(dim == 1) { if(n_cols <= k) { out.set_size(n_rows,0); return; } --n_cols; out.set_size(n_rows,n_cols); if(n_rows == 1) { const eT* X_mem = X.memptr(); eT* out_mem = out.memptr(); for(uword col=0; col < n_cols; ++col) { const eT val0 = X_mem[col ]; const eT val1 = X_mem[col+1]; out_mem[col] = val1 - val0; } } else { for(uword col=0; col < n_cols; ++col) { eT* out_col_mem = out.colptr(col); const eT* X_col0_mem = X.colptr(col ); const eT* X_col1_mem = X.colptr(col+1); for(uword row=0; row < n_rows; ++row) { out_col_mem[row] = X_col1_mem[row] - X_col0_mem[row]; } } } if(k >= 2) { for(uword iter=2; iter <= k; ++iter) { --n_cols; if(n_rows == 1) { eT* out_mem = out.memptr(); for(uword col=0; col < n_cols; ++col) { const eT val0 = out_mem[col ]; const eT val1 = out_mem[col+1]; out_mem[col] = val1 - val0; } } else { for(uword col=0; col < n_cols; ++col) { eT* col0_mem = out.colptr(col ); const eT* col1_mem = out.colptr(col+1); for(uword row=0; row < n_rows; ++row) { col0_mem[row] = col1_mem[row] - col0_mem[row]; } } } } out = out( span::all, span(0,n_cols-1) ); } } } template inline void op_diff::apply(Mat& out, const Op& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword k = in.aux_uword_a; const uword dim = in.aux_uword_b; arma_conform_check( (dim > 1), "diff(): parameter 'dim' must be 0 or 1" ); if(k == 0) { out = in.m; return; } const quasi_unwrap U(in.m); if(U.is_alias(out)) { Mat tmp; op_diff::apply_noalias(tmp, U.M, k, dim); out.steal_mem(tmp); } else { op_diff::apply_noalias(out, U.M, k, dim); } } template inline void op_diff_vec::apply(Mat& out, const Op& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword k = in.aux_uword_a; if(k == 0) { out = in.m; return; } const quasi_unwrap U(in.m); const uword dim = (T1::is_xvec) ? uword(U.M.is_rowvec() ? 1 : 0) : uword((T1::is_row) ? 1 : 0); if(U.is_alias(out)) { Mat tmp; op_diff::apply_noalias(tmp, U.M, k, dim); out.steal_mem(tmp); } else { op_diff::apply_noalias(out, U.M, k, dim); } } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_histc.hpp0000644000176200001440000000326314631567470022717 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_histc //! @{ template arma_warn_unused arma_inline typename enable_if2 < is_arma_type::value && is_arma_type::value && is_cx::no && is_same_type::value, const mtGlue >::result histc(const T1& X, const T2& Y) { arma_debug_sigprint(); return mtGlue(X, Y); } template arma_warn_unused arma_inline typename enable_if2 < is_arma_type::value && is_arma_type::value && is_cx::no && is_same_type::value, const mtGlue >::result histc(const T1& X, const T2& Y, const uword dim) { arma_debug_sigprint(); return mtGlue(X, Y, dim); } //! @} RcppArmadillo/inst/include/armadillo_bits/spop_norm_meat.hpp0000644000176200001440000000701114631567470024137 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_norm //! @{ template inline typename get_pod_type::result spop_norm::mat_norm_1(const SpMat& X) { arma_debug_sigprint(); // TODO: this can be sped up with a dedicated implementation return as_scalar( max( sum(abs(X), 0), 1) ); } template inline typename get_pod_type::result spop_norm::mat_norm_2(const SpMat& X, const typename arma_real_only::result* junk) { arma_debug_sigprint(); arma_ignore(junk); // norm = sqrt( largest eigenvalue of (A^H)*A ), where ^H is the conjugate transpose // http://math.stackexchange.com/questions/4368/computing-the-largest-eigenvalue-of-a-very-large-sparse-matrix typedef typename get_pod_type::result T; const SpMat& A = X; const SpMat B = trans(A); const SpMat C = (A.n_rows <= A.n_cols) ? (A*B) : (B*A); Col eigval; eigs_sym(eigval, C, 1); const T out_square_val = (eigval.n_elem > 0) ? T(eigval[0]) : T(0); return (out_square_val <= T(0)) ? T(0) : T(std::sqrt(out_square_val)); } template inline typename get_pod_type::result spop_norm::mat_norm_2(const SpMat& X, const typename arma_cx_only::result* junk) { arma_debug_sigprint(); arma_ignore(junk); typedef typename get_pod_type::result T; // we're calling eigs_gen(), which currently requires ARPACK #if !defined(ARMA_USE_ARPACK) { arma_stop_logic_error("norm(): use of ARPACK must be enabled for norm of complex matrices"); return T(0); } #endif const SpMat& A = X; const SpMat B = trans(A); const SpMat C = (A.n_rows <= A.n_cols) ? (A*B) : (B*A); Col eigval; eigs_gen(eigval, C, 1); const T out_square_val = (eigval.n_elem > 0) ? T(std::real(eigval[0])) : T(0); return (out_square_val <= T(0)) ? T(0) : T(std::sqrt(out_square_val)); } template inline typename get_pod_type::result spop_norm::mat_norm_inf(const SpMat& X) { arma_debug_sigprint(); // TODO: this can be sped up with a dedicated implementation return as_scalar( max( sum(abs(X), 1), 0) ); } template inline typename get_pod_type::result spop_norm::vec_norm_k(const eT* mem, const uword N, const uword k) { arma_debug_sigprint(); arma_conform_check( (k == 0), "norm(): unsupported vector norm type" ); // create a fake dense vector to allow reuse of code for dense vectors Col fake_vector( access::rwp(mem), N, false ); const Proxy< Col > P_fake_vector(fake_vector); if(k == uword(1)) { return op_norm::vec_norm_1(P_fake_vector); } if(k == uword(2)) { return op_norm::vec_norm_2(P_fake_vector); } return op_norm::vec_norm_k(P_fake_vector, int(k)); } //! @} RcppArmadillo/inst/include/armadillo_bits/spop_reverse_meat.hpp0000644000176200001440000000777714631567470024662 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup spop_reverse //! @{ template inline void spop_reverse::apply_spmat(SpMat& out, const SpMat& X, const uword dim) { arma_debug_sigprint(); const uword X_n_rows = X.n_rows; const uword X_n_cols = X.n_cols; const uword X_n_rows_m1 = X_n_rows - 1; const uword X_n_cols_m1 = X_n_cols - 1; const uword N = X.n_nonzero; if(N == uword(0)) { out.zeros(X_n_rows, X_n_cols); return; } umat locs(2, N, arma_nozeros_indicator()); uword* locs_mem = locs.memptr(); typename SpMat::const_iterator it = X.begin(); if(dim == 0) { for(uword i=0; i < N; ++i) { const uword row = it.row(); const uword col = it.col(); (*locs_mem) = X_n_rows_m1 - row; locs_mem++; (*locs_mem) = col; locs_mem++; ++it; } } else if(dim == 1) { for(uword i=0; i < N; ++i) { const uword row = it.row(); const uword col = it.col(); (*locs_mem) = row; locs_mem++; (*locs_mem) = X_n_cols_m1 - col; locs_mem++; ++it; } } const Col vals(const_cast(X.values), N, false); SpMat tmp(locs, vals, X_n_rows, X_n_cols, true, false); out.steal_mem(tmp); } template inline void spop_reverse::apply_proxy(SpMat& out, const T1& X, const uword dim) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const SpProxy P(X); const uword P_n_rows = P.get_n_rows(); const uword P_n_cols = P.get_n_cols(); const uword P_n_rows_m1 = P_n_rows - 1; const uword P_n_cols_m1 = P_n_cols - 1; const uword N = P.get_n_nonzero(); if(N == uword(0)) { out.zeros(P_n_rows, P_n_cols); return; } umat locs(2, N, arma_nozeros_indicator()); Col vals( N, arma_nozeros_indicator()); uword* locs_mem = locs.memptr(); eT* vals_mem = vals.memptr(); typename SpProxy::const_iterator_type it = P.begin(); if(dim == 0) { for(uword i=0; i < N; ++i) { const uword row = it.row(); const uword col = it.col(); (*locs_mem) = P_n_rows_m1 - row; locs_mem++; (*locs_mem) = col; locs_mem++; (*vals_mem) = (*it); vals_mem++; ++it; } } else if(dim == 1) { for(uword i=0; i < N; ++i) { const uword row = it.row(); const uword col = it.col(); (*locs_mem) = row; locs_mem++; (*locs_mem) = P_n_cols_m1 - col; locs_mem++; (*vals_mem) = (*it); vals_mem++; ++it; } } SpMat tmp(locs, vals, P_n_rows, P_n_cols, true, false); out.steal_mem(tmp); } template inline void spop_reverse::apply(SpMat& out, const SpOp& in) { arma_debug_sigprint(); const uword dim = in.aux_uword_a; arma_conform_check( (dim > 1), "reverse(): parameter 'dim' must be 0 or 1" ); if(is_SpMat::value) { const unwrap_spmat tmp(in.m); spop_reverse::apply_spmat(out, tmp.M, dim); } else { spop_reverse::apply_proxy(out, in.m, dim); } } //! @} RcppArmadillo/inst/include/armadillo_bits/newarp_GenEigsSolver_meat.hpp0000644000176200001440000003053714631567470026224 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ namespace newarp { template inline void GenEigsSolver::fill_rand(eT* dest, const uword N, const uword seed_val) { arma_debug_sigprint(); typedef typename std::mt19937_64::result_type seed_type; local_rng.seed( seed_type(seed_val) ); std::uniform_real_distribution dist(-1.0, +1.0); for(uword i=0; i < N; ++i) { dest[i] = eT(dist(local_rng)); } } template inline void GenEigsSolver::factorise_from(uword from_k, uword to_m, const Col& fk) { arma_debug_sigprint(); if(to_m <= from_k) { return; } fac_f = fk; Col w(dim_n, arma_zeros_indicator()); eT beta = norm(fac_f); // Keep the upperleft k x k submatrix of H and set other elements to 0 fac_H.tail_cols(ncv - from_k).zeros(); fac_H.submat(span(from_k, ncv - 1), span(0, from_k - 1)).zeros(); for(uword i = from_k; i <= to_m - 1; i++) { bool restart = false; // If beta = 0, then the next V is not full rank // We need to generate a new residual vector that is orthogonal // to the current V, which we call a restart if(beta < eps) { // // Generate new random vector for fac_f // blas_int idist = 2; // blas_int iseed[4] = {1, 3, 5, 7}; // iseed[0] = (i + 100) % 4095; // blas_int n = dim_n; // lapack::larnv(&idist, &iseed[0], &n, fac_f.memptr()); // Generate new random vector for fac_f fill_rand(fac_f.memptr(), dim_n, i+1); // f <- f - V * V' * f, so that f is orthogonal to V Mat Vs(fac_V.memptr(), dim_n, i, false); // First i columns Col Vf = Vs.t() * fac_f; fac_f -= Vs * Vf; // beta <- ||f|| beta = norm(fac_f); restart = true; } // v <- f / ||f|| fac_V.col(i) = fac_f / beta; // The (i+1)-th column // Note that H[i+1, i] equals to the unrestarted beta if(restart) { fac_H(i, i - 1) = 0.0; } else { fac_H(i, i - 1) = beta; } // w <- A * v, v = fac_V.col(i) op.perform_op(fac_V.colptr(i), w.memptr()); nmatop++; // First i+1 columns of V Mat Vs(fac_V.memptr(), dim_n, i + 1, false); // h = fac_H(0:i, i) Col h(fac_H.colptr(i), i + 1, false); // h <- V' * w h = Vs.t() * w; // f <- w - V * h fac_f = w - Vs * h; beta = norm(fac_f); if(beta > 0.717 * norm(h)) { continue; } // f/||f|| is going to be the next column of V, so we need to test // whether V' * (f/||f||) ~= 0 Col Vf = Vs.t() * fac_f; // If not, iteratively correct the residual uword count = 0; while(count < 5 && abs(Vf).max() > approx0 * beta) { // f <- f - V * Vf fac_f -= Vs * Vf; // h <- h + Vf h += Vf; // beta <- ||f|| beta = norm(fac_f); Vf = Vs.t() * fac_f; count++; } } } template inline void GenEigsSolver::restart(uword k) { arma_debug_sigprint(); if(k >= ncv) { return; } DoubleShiftQR decomp_ds(ncv); UpperHessenbergQR decomp; Mat Q(ncv, ncv, fill::eye); for(uword i = k; i < ncv; i++) { if(cx_attrib::is_complex(ritz_val(i), eT(0)) && (i < (ncv - 1)) && cx_attrib::is_conj(ritz_val(i), ritz_val(i + 1), eT(0))) { // H - mu * I = Q1 * R1 // H <- R1 * Q1 + mu * I = Q1' * H * Q1 // H - conj(mu) * I = Q2 * R2 // H <- R2 * Q2 + conj(mu) * I = Q2' * H * Q2 // // (H - mu * I) * (H - conj(mu) * I) = Q1 * Q2 * R2 * R1 = Q * R eT s = 2 * ritz_val(i).real(); eT t = std::norm(ritz_val(i)); decomp_ds.compute(fac_H, s, t); // Q -> Q * Qi decomp_ds.apply_YQ(Q); // H -> Q'HQ fac_H = decomp_ds.matrix_QtHQ(); i++; } else { // QR decomposition of H - mu * I, mu is real fac_H.diag() -= ritz_val(i).real(); decomp.compute(fac_H); // Q -> Q * Qi decomp.apply_YQ(Q); // H -> Q'HQ = RQ + mu * I fac_H = decomp.matrix_RQ(); fac_H.diag() += ritz_val(i).real(); } } // V -> VQ // Q has some elements being zero // The first (ncv - k + i) elements of the i-th column of Q are non-zero Mat Vs(dim_n, k + 1, arma_nozeros_indicator()); uword nnz; for(uword i = 0; i < k; i++) { nnz = ncv - k + i + 1; Mat V(fac_V.memptr(), dim_n, nnz, false); Col q(Q.colptr(i), nnz, false); Col v(Vs.colptr(i), dim_n, false); v = V * q; } Vs.col(k) = fac_V * Q.col(k); fac_V.head_cols(k + 1) = Vs; Col fk = fac_f * Q(ncv - 1, k - 1) + fac_V.col(k) * fac_H(k, k - 1); factorise_from(k, ncv, fk); retrieve_ritzpair(); } template inline uword GenEigsSolver::num_converged(eT tol) { arma_debug_sigprint(); // thresh = tol * max(prec, abs(theta)), theta for ritz value const eT f_norm = arma::norm(fac_f); for(uword i = 0; i < nev; i++) { eT thresh = tol * (std::max)(approx0, std::abs(ritz_val(i))); eT resid = std::abs(ritz_est(i)) * f_norm; ritz_conv[i] = (resid < thresh); } return std::count(ritz_conv.begin(), ritz_conv.end(), true); } template inline uword GenEigsSolver::nev_adjusted(uword nconv) { arma_debug_sigprint(); uword nev_new = nev; for(uword i = nev; i < ncv; i++) { if(std::abs(ritz_est(i)) < eps) { nev_new++; } } // Adjust nev_new again, according to dnaup2.f line 660~674 in ARPACK nev_new += (std::min)(nconv, (ncv - nev_new) / 2); if(nev_new == 1 && ncv >= 6) { nev_new = ncv / 2; } else if(nev_new == 1 && ncv > 3) { nev_new = 2; } if(nev_new > ncv - 2) { nev_new = ncv - 2; } // Increase nev by one if ritz_val[nev - 1] and // ritz_val[nev] are conjugate pairs if(cx_attrib::is_complex(ritz_val(nev_new - 1), eps) && cx_attrib::is_conj(ritz_val(nev_new - 1), ritz_val(nev_new), eps)) { nev_new++; } return nev_new; } template inline void GenEigsSolver::retrieve_ritzpair() { arma_debug_sigprint(); UpperHessenbergEigen decomp(fac_H); Col< std::complex > evals = decomp.eigenvalues(); Mat< std::complex > evecs = decomp.eigenvectors(); SortEigenvalue< std::complex, SelectionRule > sorting(evals.memptr(), evals.n_elem); std::vector ind = sorting.index(); // Copy the ritz values and vectors to ritz_val and ritz_vec, respectively for(uword i = 0; i < ncv; i++) { ritz_val(i) = evals(ind[i]); ritz_est(i) = evecs(ncv - 1, ind[i]); } for(uword i = 0; i < nev; i++) { ritz_vec.col(i) = evecs.col(ind[i]); } } template inline void GenEigsSolver::sort_ritzpair() { arma_debug_sigprint(); // SortEigenvalue< std::complex, EigsSelect::LARGEST_MAGN > sorting(ritz_val.memptr(), nev); // sort Ritz values according to SelectionRule, to be consistent with ARPACK SortEigenvalue< std::complex, SelectionRule > sorting(ritz_val.memptr(), nev); std::vector ind = sorting.index(); Col< std::complex > new_ritz_val(ncv, arma_zeros_indicator() ); Mat< std::complex > new_ritz_vec(ncv, nev, arma_nozeros_indicator()); std::vector new_ritz_conv(nev); for(uword i = 0; i < nev; i++) { new_ritz_val(i) = ritz_val(ind[i]); new_ritz_vec.col(i) = ritz_vec.col(ind[i]); new_ritz_conv[i] = ritz_conv[ind[i]]; } ritz_val.swap(new_ritz_val); ritz_vec.swap(new_ritz_vec); ritz_conv.swap(new_ritz_conv); } template inline GenEigsSolver::GenEigsSolver(const OpType& op_, uword nev_, uword ncv_) : op(op_) , nev(nev_) , dim_n(op.n_rows) , ncv(ncv_ > dim_n ? dim_n : ncv_) , nmatop(0) , niter(0) , eps(std::numeric_limits::epsilon()) , approx0(std::pow(eps, eT(2.0) / 3)) { arma_debug_sigprint(); arma_conform_check( (nev_ < 1 || nev_ > dim_n - 2), "newarp::GenEigsSolver: nev must satisfy 1 <= nev <= n - 2, n is the size of matrix" ); arma_conform_check( (ncv_ < nev_ + 2 || ncv_ > dim_n), "newarp::GenEigsSolver: ncv must satisfy nev + 2 <= ncv <= n, n is the size of matrix" ); } template inline void GenEigsSolver::init(eT* init_resid) { arma_debug_sigprint(); // Reset all matrices/vectors to zero fac_V.zeros(dim_n, ncv); fac_H.zeros(ncv, ncv); fac_f.zeros(dim_n); ritz_val.zeros(ncv); ritz_vec.zeros(ncv, nev); ritz_est.zeros(ncv); ritz_conv.assign(nev, false); nmatop = 0; niter = 0; Col r(init_resid, dim_n, false); // The first column of fac_V Col v(fac_V.colptr(0), dim_n, false); eT rnorm = norm(r); arma_check( (rnorm < eps), "newarp::GenEigsSolver::init(): initial residual vector cannot be zero" ); v = r / rnorm; Col w(dim_n, arma_zeros_indicator()); op.perform_op(v.memptr(), w.memptr()); nmatop++; fac_H(0, 0) = dot(v, w); fac_f = w - v * fac_H(0, 0); } template inline void GenEigsSolver::init() { arma_debug_sigprint(); // podarray init_resid(dim_n); // blas_int idist = 2; // Uniform(-1, 1) // blas_int iseed[4] = {1, 3, 5, 7}; // Fixed random seed // blas_int n = dim_n; // lapack::larnv(&idist, &iseed[0], &n, init_resid.memptr()); // init(init_resid.memptr()); podarray init_resid(dim_n); fill_rand(init_resid.memptr(), dim_n, 0); init(init_resid.memptr()); } template inline uword GenEigsSolver::compute(uword maxit, eT tol) { arma_debug_sigprint(); // The m-step Arnoldi factorisation factorise_from(1, ncv, fac_f); retrieve_ritzpair(); // Restarting uword i, nconv = 0, nev_adj; for(i = 0; i < maxit; i++) { nconv = num_converged(tol); if(nconv >= nev) { break; } nev_adj = nev_adjusted(nconv); restart(nev_adj); } // Sorting results sort_ritzpair(); niter = i + 1; return (std::min)(nev, nconv); } template inline Col< std::complex > GenEigsSolver::eigenvalues() { arma_debug_sigprint(); uword nconv = std::count(ritz_conv.begin(), ritz_conv.end(), true); Col< std::complex > res(nconv, arma_zeros_indicator()); if(nconv > 0) { uword j = 0; for(uword i = 0; i < nev; i++) { if(ritz_conv[i]) { res(j) = ritz_val(i); j++; } } } return res; } template inline Mat< std::complex > GenEigsSolver::eigenvectors(uword nvec) { arma_debug_sigprint(); uword nconv = std::count(ritz_conv.begin(), ritz_conv.end(), true); nvec = (std::min)(nvec, nconv); Mat< std::complex > res(dim_n, nvec); if(nvec > 0) { Mat< std::complex > ritz_vec_conv(ncv, nvec, arma_zeros_indicator()); uword j = 0; for(uword i = 0; (i < nev) && (j < nvec); i++) { if(ritz_conv[i]) { ritz_vec_conv.col(j) = ritz_vec.col(i); j++; } } res = fac_V * ritz_vec_conv; } return res; } } // namespace newarp RcppArmadillo/inst/include/armadillo_bits/arma_str.hpp0000644000176200001440000002244014433774144022726 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup arma_str //! @{ namespace arma_str { class char_buffer { public: static constexpr uword n_chars_prealloc = 1024; char* mem = nullptr; uword n_chars = 0; char local_mem[n_chars_prealloc]; inline ~char_buffer() { if(n_chars > n_chars_prealloc) { std::free(mem); } mem = nullptr; n_chars = 0; } inline char_buffer() { mem = &(local_mem[0]); n_chars = n_chars_prealloc; if(n_chars > 0) { mem[0] = char(0); } } inline void set_size(const uword new_n_chars) { if(n_chars > n_chars_prealloc) { std::free(mem); } mem = (new_n_chars <= n_chars_prealloc) ? &(local_mem[0]) : (char*)std::malloc(new_n_chars); n_chars = (new_n_chars <= n_chars_prealloc) ? n_chars_prealloc : new_n_chars; if(n_chars > 0) { mem[0] = char(0); } } }; class format { public: const std::string fmt; inline format(const char* in_fmt) : fmt(in_fmt) { } inline format(const std::string& in_fmt) : fmt(in_fmt) { } private: format(); }; template class basic_format { public: const T1& A; const T2& B; inline basic_format(const T1& in_A, const T2& in_B) : A(in_A) , B(in_B) { } private: basic_format(); }; template inline basic_format< format, T2 > operator% (const format& X, const T2& arg) { return basic_format< format, T2 >(X, arg); } template inline basic_format< basic_format, T3 > operator% (const basic_format& X, const T3& arg) { return basic_format< basic_format, T3 >(X, arg); } template inline std::string str(const basic_format< format, T2>& X) { std::string out; char_buffer buf; bool status = false; while(status == false) { int required_size = (std::snprintf)(buf.mem, size_t(buf.n_chars), X.A.fmt.c_str(), X.B); if(required_size < 0) { break; } if(uword(required_size) >= buf.n_chars) { if(buf.n_chars > char_buffer::n_chars_prealloc) { break; } buf.set_size(1 + uword(required_size)); } else { status = true; } if(status) { out = buf.mem; } } return out; } template inline std::string str(const basic_format< basic_format< format, T2>, T3>& X) { char_buffer buf; std::string out; bool status = false; while(status == false) { int required_size = (std::snprintf)(buf.mem, size_t(buf.n_chars), X.A.A.fmt.c_str(), X.A.B, X.B); if(required_size < 0) { break; } if(uword(required_size) >= buf.n_chars) { if(buf.n_chars > char_buffer::n_chars_prealloc) { break; } buf.set_size(1 + uword(required_size)); } else { status = true; } if(status) { out = buf.mem; } } return out; } template inline std::string str(const basic_format< basic_format< basic_format< format, T2>, T3>, T4>& X) { char_buffer buf; std::string out; bool status = false; while(status == false) { int required_size = (std::snprintf)(buf.mem, size_t(buf.n_chars), X.A.A.A.fmt.c_str(), X.A.A.B, X.A.B, X.B); if(required_size < 0) { break; } if(uword(required_size) >= buf.n_chars) { if(buf.n_chars > char_buffer::n_chars_prealloc) { break; } buf.set_size(1 + uword(required_size)); } else { status = true; } if(status) { out = buf.mem; } } return out; } template inline std::string str(const basic_format< basic_format< basic_format< basic_format< format, T2>, T3>, T4>, T5>& X) { char_buffer buf; std::string out; bool status = false; while(status == false) { int required_size = (std::snprintf)(buf.mem, size_t(buf.n_chars), X.A.A.A.A.fmt.c_str(), X.A.A.A.B, X.A.A.B, X.A.B, X.B); if(required_size < 0) { break; } if(uword(required_size) >= buf.n_chars) { if(buf.n_chars > char_buffer::n_chars_prealloc) { break; } buf.set_size(1 + uword(required_size)); } else { status = true; } if(status) { out = buf.mem; } } return out; } template inline std::string str(const basic_format< basic_format< basic_format< basic_format< basic_format< format, T2>, T3>, T4>, T5>, T6>& X) { char_buffer buf; std::string out; bool status = false; while(status == false) { int required_size = (std::snprintf)(buf.mem, size_t(buf.n_chars), X.A.A.A.A.A.fmt.c_str(), X.A.A.A.A.B, X.A.A.A.B, X.A.A.B, X.A.B, X.B); if(required_size < 0) { break; } if(uword(required_size) >= buf.n_chars) { if(buf.n_chars > char_buffer::n_chars_prealloc) { break; } buf.set_size(1 + uword(required_size)); } else { status = true; } if(status) { out = buf.mem; } } return out; } template inline std::string str(const basic_format< basic_format< basic_format< basic_format< basic_format< basic_format< format, T2>, T3>, T4>, T5>, T6>, T7>& X) { char_buffer buf; std::string out; bool status = false; while(status == false) { int required_size = (std::snprintf)(buf.mem, size_t(buf.n_chars), X.A.A.A.A.A.A.fmt.c_str(), X.A.A.A.A.A.B, X.A.A.A.A.B, X.A.A.A.B, X.A.A.B, X.A.B, X.B); if(required_size < 0) { break; } if(uword(required_size) >= buf.n_chars) { if(buf.n_chars > char_buffer::n_chars_prealloc) { break; } buf.set_size(1 + uword(required_size)); } else { status = true; } if(status) { out = buf.mem; } } return out; } template struct format_metaprog { static constexpr uword depth = 0; inline static const std::string& get_fmt(const T1& X) { return X.A; } }; //template<> template struct format_metaprog< basic_format > { static constexpr uword depth = 1 + format_metaprog::depth; inline static const std::string& get_fmt(const T1& X) { return format_metaprog::get_fmt(X.A); } }; template inline std::string str(const basic_format& X) { return format_metaprog< basic_format >::get_fmt(X.A); } template inline std::ostream& operator<< (std::ostream& o, const basic_format& X) { o << str(X); return o; } template struct string_only { }; template<> struct string_only { typedef std::string result; }; template struct char_only { }; template<> struct char_only { typedef char result; }; template struct basic_format_only { }; template struct basic_format_only< basic_format > { typedef basic_format result; }; template inline static const T1& str_wrapper(const T1& x, const typename string_only::result* junk = nullptr) { arma_ignore(junk); return x; } template inline static const T1* str_wrapper(const T1* x, const typename char_only::result* junk = nullptr) { arma_ignore(junk); return x; } template inline static std::string str_wrapper(const T1& x, const typename basic_format_only::result* junk = nullptr) { arma_ignore(junk); return str(x); } } //! @} RcppArmadillo/inst/include/armadillo_bits/mtGlueCube_meat.hpp0000644000176200001440000000273214631567470024164 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup mtGlueCube //! @{ template inline mtGlueCube::mtGlueCube(const T1& in_A, const T2& in_B) : A(in_A) , B(in_B) { arma_debug_sigprint(); } template inline mtGlueCube::mtGlueCube(const T1& in_A, const T2& in_B, const uword in_aux_uword) : A(in_A) , B(in_B) , aux_uword(in_aux_uword) { arma_debug_sigprint(); } template inline mtGlueCube::~mtGlueCube() { arma_debug_sigprint(); } //! @} RcppArmadillo/inst/include/armadillo_bits/mtGlue_bones.hpp0000644000176200001440000000343214752446051023536 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup mtGlue //! @{ template class mtGlue : public Base< out_eT, mtGlue > { public: typedef out_eT elem_type; typedef typename get_pod_type::result pod_type; static constexpr bool is_row = glue_type::template traits::is_row; static constexpr bool is_col = glue_type::template traits::is_col; static constexpr bool is_xvec = glue_type::template traits::is_xvec; arma_inline mtGlue(const T1& in_A, const T2& in_B); arma_inline mtGlue(const T1& in_A, const T2& in_B, const uword in_aux_uword); arma_inline ~mtGlue(); template inline bool is_alias(const Mat& X) const; const T1& A; //!< first operand; must be derived from Base const T2& B; //!< second operand; must be derived from Base uword aux_uword; //!< storage of auxiliary data, uword format }; //! @} RcppArmadillo/inst/include/armadillo_bits/restrictors.hpp0000644000176200001440000002451714635324415023504 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup restrictors //! @{ // structures for template based restrictions of input/output arguments // (part of the SFINAE approach) // http://en.wikipedia.org/wiki/SFINAE template struct arma_scalar_only { }; template<> struct arma_scalar_only< u8 > { typedef u8 result; }; template<> struct arma_scalar_only< s8 > { typedef s8 result; }; template<> struct arma_scalar_only< u16 > { typedef u16 result; }; template<> struct arma_scalar_only< s16 > { typedef s16 result; }; template<> struct arma_scalar_only< u32 > { typedef u32 result; }; template<> struct arma_scalar_only< s32 > { typedef s32 result; }; template<> struct arma_scalar_only< u64 > { typedef u64 result; }; template<> struct arma_scalar_only< s64 > { typedef s64 result; }; template<> struct arma_scalar_only< ulng_t > { typedef ulng_t result; }; template<> struct arma_scalar_only< slng_t > { typedef slng_t result; }; template<> struct arma_scalar_only< float > { typedef float result; }; template<> struct arma_scalar_only< double > { typedef double result; }; template<> struct arma_scalar_only< cx_float > { typedef cx_float result; }; template<> struct arma_scalar_only< cx_double > { typedef cx_double result; }; template struct arma_integral_only { }; template<> struct arma_integral_only< u8 > { typedef u8 result; }; template<> struct arma_integral_only< s8 > { typedef s8 result; }; template<> struct arma_integral_only< u16 > { typedef u16 result; }; template<> struct arma_integral_only< s16 > { typedef s16 result; }; template<> struct arma_integral_only< u32 > { typedef u32 result; }; template<> struct arma_integral_only< s32 > { typedef s32 result; }; template<> struct arma_integral_only< u64 > { typedef u64 result; }; template<> struct arma_integral_only< s64 > { typedef s64 result; }; template<> struct arma_integral_only< ulng_t > { typedef ulng_t result; }; template<> struct arma_integral_only< slng_t > { typedef slng_t result; }; template struct arma_unsigned_integral_only { }; template<> struct arma_unsigned_integral_only< u8 > { typedef u8 result; }; template<> struct arma_unsigned_integral_only< u16 > { typedef u16 result; }; template<> struct arma_unsigned_integral_only< u32 > { typedef u32 result; }; template<> struct arma_unsigned_integral_only< u64 > { typedef u64 result; }; template<> struct arma_unsigned_integral_only< ulng_t > { typedef ulng_t result; }; template struct arma_signed_integral_only { }; template<> struct arma_signed_integral_only< s8 > { typedef s8 result; }; template<> struct arma_signed_integral_only< s16 > { typedef s16 result; }; template<> struct arma_signed_integral_only< s32 > { typedef s32 result; }; template<> struct arma_signed_integral_only< s64 > { typedef s64 result; }; template<> struct arma_signed_integral_only< slng_t > { typedef slng_t result; }; template struct arma_signed_only { }; template<> struct arma_signed_only< s8 > { typedef s8 result; }; template<> struct arma_signed_only< s16 > { typedef s16 result; }; template<> struct arma_signed_only< s32 > { typedef s32 result; }; template<> struct arma_signed_only< s64 > { typedef s64 result; }; template<> struct arma_signed_only< slng_t > { typedef slng_t result; }; template<> struct arma_signed_only< float > { typedef float result; }; template<> struct arma_signed_only< double > { typedef double result; }; template<> struct arma_signed_only< cx_float > { typedef cx_float result; }; template<> struct arma_signed_only< cx_double > { typedef cx_double result; }; template struct arma_real_only { }; template<> struct arma_real_only< float > { typedef float result; }; template<> struct arma_real_only< double > { typedef double result; }; template struct arma_real_or_cx_only { }; template<> struct arma_real_or_cx_only< float > { typedef float result; }; template<> struct arma_real_or_cx_only< double > { typedef double result; }; template<> struct arma_real_or_cx_only< cx_float > { typedef cx_float result; }; template<> struct arma_real_or_cx_only< cx_double > { typedef cx_double result; }; template struct arma_cx_only { }; template<> struct arma_cx_only< cx_float > { typedef cx_float result; }; template<> struct arma_cx_only< cx_double > { typedef cx_double result; }; template struct arma_not_cx { typedef T result; }; template struct arma_not_cx< std::complex > { }; template struct arma_blas_type_only { }; template<> struct arma_blas_type_only< float > { typedef float result; }; template<> struct arma_blas_type_only< double > { typedef double result; }; template<> struct arma_blas_type_only< cx_float > { typedef cx_float result; }; template<> struct arma_blas_type_only< cx_double > { typedef cx_double result; }; template struct arma_not_blas_type { typedef T result; }; template<> struct arma_not_blas_type< float > { }; template<> struct arma_not_blas_type< double > { }; template<> struct arma_not_blas_type< cx_float > { }; template<> struct arma_not_blas_type< cx_double > { }; template struct arma_op_rel_only { }; template<> struct arma_op_rel_only< op_rel_lt_pre > { typedef int result; }; template<> struct arma_op_rel_only< op_rel_lt_post > { typedef int result; }; template<> struct arma_op_rel_only< op_rel_gt_pre > { typedef int result; }; template<> struct arma_op_rel_only< op_rel_gt_post > { typedef int result; }; template<> struct arma_op_rel_only< op_rel_lteq_pre > { typedef int result; }; template<> struct arma_op_rel_only< op_rel_lteq_post > { typedef int result; }; template<> struct arma_op_rel_only< op_rel_gteq_pre > { typedef int result; }; template<> struct arma_op_rel_only< op_rel_gteq_post > { typedef int result; }; template<> struct arma_op_rel_only< op_rel_eq > { typedef int result; }; template<> struct arma_op_rel_only< op_rel_noteq > { typedef int result; }; template struct arma_not_op_rel { typedef int result; }; template<> struct arma_not_op_rel< op_rel_lt_pre > { }; template<> struct arma_not_op_rel< op_rel_lt_post > { }; template<> struct arma_not_op_rel< op_rel_gt_pre > { }; template<> struct arma_not_op_rel< op_rel_gt_post > { }; template<> struct arma_not_op_rel< op_rel_lteq_pre > { }; template<> struct arma_not_op_rel< op_rel_lteq_post > { }; template<> struct arma_not_op_rel< op_rel_gteq_pre > { }; template<> struct arma_not_op_rel< op_rel_gteq_post > { }; template<> struct arma_not_op_rel< op_rel_eq > { }; template<> struct arma_not_op_rel< op_rel_noteq > { }; template struct arma_glue_rel_only { }; template<> struct arma_glue_rel_only< glue_rel_lt > { typedef int result; }; template<> struct arma_glue_rel_only< glue_rel_gt > { typedef int result; }; template<> struct arma_glue_rel_only< glue_rel_lteq > { typedef int result; }; template<> struct arma_glue_rel_only< glue_rel_gteq > { typedef int result; }; template<> struct arma_glue_rel_only< glue_rel_eq > { typedef int result; }; template<> struct arma_glue_rel_only< glue_rel_noteq > { typedef int result; }; template<> struct arma_glue_rel_only< glue_rel_and > { typedef int result; }; template<> struct arma_glue_rel_only< glue_rel_or > { typedef int result; }; template struct arma_spop_rel_only { }; template<> struct arma_spop_rel_only< spop_rel_lt_pre > { typedef int result; }; template<> struct arma_spop_rel_only< spop_rel_lt_post > { typedef int result; }; template<> struct arma_spop_rel_only< spop_rel_gt_pre > { typedef int result; }; template<> struct arma_spop_rel_only< spop_rel_gt_post > { typedef int result; }; template<> struct arma_spop_rel_only< spop_rel_lteq_pre > { typedef int result; }; template<> struct arma_spop_rel_only< spop_rel_lteq_post > { typedef int result; }; template<> struct arma_spop_rel_only< spop_rel_gteq_pre > { typedef int result; }; template<> struct arma_spop_rel_only< spop_rel_gteq_post > { typedef int result; }; template<> struct arma_spop_rel_only< spop_rel_eq > { typedef int result; }; template<> struct arma_spop_rel_only< spop_rel_noteq > { typedef int result; }; template struct arma_Mat_Col_Row_only { }; template struct arma_Mat_Col_Row_only< Mat > { typedef Mat result; }; template struct arma_Mat_Col_Row_only< Col > { typedef Col result; }; template struct arma_Mat_Col_Row_only< Row > { typedef Row result; }; template struct arma_Cube_only { }; template struct arma_Cube_only< Cube > { typedef Cube result; }; template struct arma_SpMat_SpCol_SpRow_only { }; template struct arma_SpMat_SpCol_SpRow_only< SpMat > { typedef SpMat result; }; template struct arma_SpMat_SpCol_SpRow_only< SpCol > { typedef SpCol result; }; template struct arma_SpMat_SpCol_SpRow_only< SpRow > { typedef SpRow result; }; template struct enable_if { }; template<> struct enable_if { typedef int result; }; template struct enable_if2 { }; template< typename result_type > struct enable_if2 { typedef result_type result; }; //! @} RcppArmadillo/inst/include/armadillo_bits/csv_name.hpp0000644000176200001440000001111614374704744022712 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup diskio //! @{ namespace csv_opts { typedef unsigned int flag_type; struct opts { const flag_type flags; inline constexpr explicit opts(const flag_type in_flags); inline const opts operator+(const opts& rhs) const; }; inline constexpr opts::opts(const flag_type in_flags) : flags(in_flags) {} inline const opts opts::operator+(const opts& rhs) const { const opts result( flags | rhs.flags ); return result; } // The values below (eg. 1u << 0) are for internal Armadillo use only. // The values can change without notice. static constexpr flag_type flag_none = flag_type(0 ); static constexpr flag_type flag_trans = flag_type(1u << 0); static constexpr flag_type flag_no_header = flag_type(1u << 1); static constexpr flag_type flag_with_header = flag_type(1u << 2); static constexpr flag_type flag_semicolon = flag_type(1u << 3); static constexpr flag_type flag_strict = flag_type(1u << 4); struct opts_none : public opts { inline constexpr opts_none() : opts(flag_none ) {} }; struct opts_trans : public opts { inline constexpr opts_trans() : opts(flag_trans ) {} }; struct opts_no_header : public opts { inline constexpr opts_no_header() : opts(flag_no_header ) {} }; struct opts_with_header : public opts { inline constexpr opts_with_header() : opts(flag_with_header) {} }; struct opts_semicolon : public opts { inline constexpr opts_semicolon() : opts(flag_semicolon ) {} }; struct opts_strict : public opts { inline constexpr opts_strict() : opts(flag_strict ) {} }; static constexpr opts_none none; static constexpr opts_trans trans; static constexpr opts_no_header no_header; static constexpr opts_with_header with_header; static constexpr opts_semicolon semicolon; static constexpr opts_strict strict; } struct csv_name { typedef field header_type; const std::string filename; const csv_opts::opts opts; header_type header_junk; const header_type& header_ro; header_type& header_rw; inline csv_name(const std::string& in_filename) : filename (in_filename ) , opts (csv_opts::no_header) , header_ro(header_junk ) , header_rw(header_junk ) {} inline csv_name(const std::string& in_filename, const csv_opts::opts& in_opts) : filename (in_filename ) , opts (csv_opts::no_header + in_opts) , header_ro(header_junk ) , header_rw(header_junk ) {} inline csv_name(const std::string& in_filename, field& in_header) : filename (in_filename ) , opts (csv_opts::with_header) , header_ro(in_header ) , header_rw(in_header ) {} inline csv_name(const std::string& in_filename, const field& in_header) : filename (in_filename ) , opts (csv_opts::with_header) , header_ro(in_header ) , header_rw(header_junk ) {} inline csv_name(const std::string& in_filename, field& in_header, const csv_opts::opts& in_opts) : filename (in_filename ) , opts (csv_opts::with_header + in_opts) , header_ro(in_header ) , header_rw(in_header ) {} inline csv_name(const std::string& in_filename, const field& in_header, const csv_opts::opts& in_opts) : filename (in_filename ) , opts (csv_opts::with_header + in_opts) , header_ro(in_header ) , header_rw(header_junk ) {} }; //! @} RcppArmadillo/inst/include/armadillo_bits/glue_atan2_meat.hpp0000644000176200001440000001305014631567470024144 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup glue_atan2 //! @{ template inline void glue_atan2::apply(Mat& out, const Glue& expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const Proxy P1(expr.A); const Proxy P2(expr.B); arma_assert_same_size(P1, P2, "atan2()"); const bool bad_alias = ( (Proxy::has_subview && P1.is_alias(out)) || (Proxy::has_subview && P2.is_alias(out)) ); if(bad_alias == false) { glue_atan2::apply_noalias(out, P1, P2); } else { Mat tmp; glue_atan2::apply_noalias(tmp, P1, P2); out.steal_mem(tmp); } } template inline void glue_atan2::apply_noalias(Mat& out, const Proxy& P1, const Proxy& P2) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword n_rows = P1.get_n_rows(); const uword n_cols = P1.get_n_cols(); const uword n_elem = P1.get_n_elem(); out.set_size(n_rows, n_cols); eT* out_mem = out.memptr(); const bool use_mp = arma_config::openmp && mp_gate::use_mp || Proxy::use_mp)>::eval(n_elem); constexpr bool use_at = Proxy::use_at || Proxy::use_at; if(use_at == false) { typename Proxy::ea_type eaP1 = P1.get_ea(); typename Proxy::ea_type eaP2 = P2.get_ea(); if(use_mp) { #if defined(ARMA_USE_OPENMP) { const int n_threads = mp_thread_limit::get(); #pragma omp parallel for schedule(static) num_threads(n_threads) for(uword i=0; i::stored_type> U1(P1.Q); const unwrap::stored_type> U2(P2.Q); out = arma::atan2(U1.M, U2.M); } else { for(uword col=0; col < n_cols; ++col) for(uword row=0; row < n_rows; ++row) { *out_mem = std::atan2( P1.at(row,col), P2.at(row,col) ); out_mem++; } } } } template inline void glue_atan2::apply(Cube& out, const GlueCube& expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const ProxyCube P1(expr.A); const ProxyCube P2(expr.B); arma_assert_same_size(P1, P2, "atan2()"); const bool bad_alias = ( (ProxyCube::has_subview && P1.is_alias(out)) || (ProxyCube::has_subview && P2.is_alias(out)) ); if(bad_alias == false) { glue_atan2::apply_noalias(out, P1, P2); } else { Cube tmp; glue_atan2::apply_noalias(tmp, P1, P2); out.steal_mem(tmp); } } template inline void glue_atan2::apply_noalias(Cube& out, const ProxyCube& P1, const ProxyCube& P2) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword n_rows = P1.get_n_rows(); const uword n_cols = P1.get_n_cols(); const uword n_slices = P1.get_n_slices(); const uword n_elem = P1.get_n_elem(); out.set_size(n_rows, n_cols, n_slices); eT* out_mem = out.memptr(); const bool use_mp = arma_config::openmp && mp_gate::use_mp || ProxyCube::use_mp)>::eval(n_elem); constexpr bool use_at = ProxyCube::use_at || ProxyCube::use_at; if(use_at == false) { typename ProxyCube::ea_type eaP1 = P1.get_ea(); typename ProxyCube::ea_type eaP2 = P2.get_ea(); if(use_mp) { #if defined(ARMA_USE_OPENMP) { const int n_threads = mp_thread_limit::get(); #pragma omp parallel for schedule(static) num_threads(n_threads) for(uword i=0; i::stored_type> U1(P1.Q); const unwrap_cube::stored_type> U2(P2.Q); out = arma::atan2(U1.M, U2.M); } else { for(uword slice=0; slice < n_slices; ++slice) for(uword col=0; col < n_cols; ++col ) for(uword row=0; row < n_rows; ++row ) { *out_mem = std::atan2( P1.at(row,col,slice), P2.at(row,col,slice) ); out_mem++; } } } } //! @} RcppArmadillo/inst/include/armadillo_bits/spop_symmat_bones.hpp0000644000176200001440000000232214301267044024642 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup spop_symmat //! @{ class spop_symmat : public traits_op_default { public: template inline static void apply(SpMat& out, const SpOp& in); }; class spop_symmat_cx : public traits_op_default { public: template inline static void apply(SpMat& out, const SpOp& in); }; //! @} RcppArmadillo/inst/include/armadillo_bits/spop_diagmat_meat.hpp0000644000176200001440000002454514631567470024605 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup spop_diagmat //! @{ template inline void spop_diagmat::apply(SpMat& out, const SpOp& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; if(in.is_alias(out) == false) { spop_diagmat::apply_noalias(out, in.m); } else { SpMat tmp; spop_diagmat::apply_noalias(tmp, in.m); out.steal_mem(tmp); } } template inline void spop_diagmat::apply_noalias(SpMat& out, const SpBase& expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const SpProxy P(expr.get_ref()); const uword P_n_rows = P.get_n_rows(); const uword P_n_cols = P.get_n_cols(); const uword P_n_nz = P.get_n_nonzero(); const bool P_is_vec = (P_n_rows == 1) || (P_n_cols == 1); if(P_is_vec) // generate a diagonal matrix out of a vector { const uword N = (P_n_rows == 1) ? P_n_cols : P_n_rows; out.zeros(N, N); if(P_n_nz == 0) { return; } typename SpProxy::const_iterator_type it = P.begin(); if(P_n_cols == 1) { for(uword i=0; i < P_n_nz; ++i) { const uword row = it.row(); out.at(row,row) = (*it); ++it; } } else if(P_n_rows == 1) { for(uword i=0; i < P_n_nz; ++i) { const uword col = it.col(); out.at(col,col) = (*it); ++it; } } } else // generate a diagonal matrix out of a matrix { out.zeros(P_n_rows, P_n_cols); const uword N = (std::min)(P_n_rows, P_n_cols); if( (is_SpMat::stored_type>::value) && (P_n_nz >= 5*N) ) { const unwrap_spmat::stored_type> U(P.Q); const SpMat& X = U.M; for(uword i=0; i < N; ++i) { const eT val = X.at(i,i); // use binary search if(val != eT(0)) { out.at(i,i) = val; } } } else { if(P_n_nz == 0) { return; } typename SpProxy::const_iterator_type it = P.begin(); for(uword i=0; i < P_n_nz; ++i) { const uword row = it.row(); const uword col = it.col(); if(row == col) { out.at(row,row) = (*it); } ++it; } } } } template inline void spop_diagmat::apply_noalias(SpMat& out, const SpGlue& expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const unwrap_spmat UA(expr.A); const unwrap_spmat UB(expr.B); const SpMat& A = UA.M; const SpMat& B = UB.M; arma_conform_assert_same_size(A.n_rows, A.n_cols, B.n_rows, B.n_cols, "addition"); const bool is_vec = (A.n_rows == 1) || (A.n_cols == 1); if(is_vec) // generate a diagonal matrix out of a vector { const uword N = (A.n_rows == 1) ? A.n_cols : A.n_rows; out.zeros(N,N); if(A.n_rows == 1) { for(uword i=0; i < N; ++i) { out.at(i,i) = A.at(0,i) + B.at(0,i); } } else { for(uword i=0; i < N; ++i) { out.at(i,i) = A.at(i,0) + B.at(i,0); } } } else // generate a diagonal matrix out of a matrix { SpMat AA; spop_diagmat::apply_noalias(AA, A); SpMat BB; spop_diagmat::apply_noalias(BB, B); out = AA + BB; } } template inline void spop_diagmat::apply_noalias(SpMat& out, const SpGlue& expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const unwrap_spmat UA(expr.A); const unwrap_spmat UB(expr.B); const SpMat& A = UA.M; const SpMat& B = UB.M; arma_conform_assert_same_size(A.n_rows, A.n_cols, B.n_rows, B.n_cols, "subtraction"); const bool is_vec = (A.n_rows == 1) || (A.n_cols == 1); if(is_vec) // generate a diagonal matrix out of a vector { const uword N = (A.n_rows == 1) ? A.n_cols : A.n_rows; out.zeros(N,N); if(A.n_rows == 1) { for(uword i=0; i < N; ++i) { out.at(i,i) = A.at(0,i) - B.at(0,i); } } else { for(uword i=0; i < N; ++i) { out.at(i,i) = A.at(i,0) - B.at(i,0); } } } else // generate a diagonal matrix out of a matrix { SpMat AA; spop_diagmat::apply_noalias(AA, A); SpMat BB; spop_diagmat::apply_noalias(BB, B); out = AA - BB; } } template inline void spop_diagmat::apply_noalias(SpMat& out, const SpGlue& expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const unwrap_spmat UA(expr.A); const unwrap_spmat UB(expr.B); const SpMat& A = UA.M; const SpMat& B = UB.M; arma_conform_assert_same_size(A.n_rows, A.n_cols, B.n_rows, B.n_cols, "element-wise multiplication"); const bool is_vec = (A.n_rows == 1) || (A.n_cols == 1); if(is_vec) // generate a diagonal matrix out of a vector { const uword N = (A.n_rows == 1) ? A.n_cols : A.n_rows; out.zeros(N,N); if(A.n_rows == 1) { for(uword i=0; i < N; ++i) { out.at(i,i) = A.at(0,i) * B.at(0,i); } } else { for(uword i=0; i < N; ++i) { out.at(i,i) = A.at(i,0) * B.at(i,0); } } } else // generate a diagonal matrix out of a matrix { SpMat AA; spop_diagmat::apply_noalias(AA, A); SpMat BB; spop_diagmat::apply_noalias(BB, B); out = AA % BB; } } template inline void spop_diagmat::apply_noalias(SpMat& out, const SpGlue& expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const unwrap_spmat UA(expr.A); const unwrap_spmat UB(expr.B); const SpMat& A = UA.M; const SpMat& B = UB.M; arma_conform_assert_mul_size(A.n_rows, A.n_cols, B.n_rows, B.n_cols, "matrix multiplication"); const uword C_n_rows = A.n_rows; const uword C_n_cols = B.n_cols; const bool is_vec = (C_n_rows == 1) || (C_n_cols == 1); if(is_vec) // generate a diagonal matrix out of a vector { const SpMat C = A*B; spop_diagmat::apply_noalias(out, C); } else // generate a diagonal matrix out of a matrix { const uword N = (std::min)(C_n_rows, C_n_cols); if( (A.n_nonzero >= 5*N) || (B.n_nonzero >= 5*N) ) { out.zeros(C_n_rows, C_n_cols); for(uword k=0; k < N; ++k) { typename SpMat::const_col_iterator B_it = B.begin_col_no_sync(k); typename SpMat::const_col_iterator B_it_end = B.end_col_no_sync(k); eT acc = eT(0); while(B_it != B_it_end) { const eT B_val = (*B_it); const uword i = B_it.row(); acc += A.at(k,i) * B_val; ++B_it; } out(k,k) = acc; } } else { const SpMat C = A*B; spop_diagmat::apply_noalias(out, C); } } } // // template inline void spop_diagmat2::apply(SpMat& out, const SpOp& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword row_offset = in.aux_uword_a; const uword col_offset = in.aux_uword_b; const unwrap_spmat U(in.m); if(U.is_alias(out)) { SpMat tmp; spop_diagmat2::apply_noalias(tmp, U.M, row_offset, col_offset); out.steal_mem(tmp); } else { spop_diagmat2::apply_noalias(out, U.M, row_offset, col_offset); } } template inline void spop_diagmat2::apply_noalias(SpMat& out, const SpMat& X, const uword row_offset, const uword col_offset) { arma_debug_sigprint(); const uword n_rows = X.n_rows; const uword n_cols = X.n_cols; const uword n_elem = X.n_elem; if(n_elem == 0) { out.reset(); return; } const bool X_is_vec = (n_rows == 1) || (n_cols == 1); if(X_is_vec) // generate a diagonal matrix out of a vector { const uword n_pad = (std::max)(row_offset, col_offset); out.zeros(n_elem + n_pad, n_elem + n_pad); const uword X_n_nz = X.n_nonzero; if(X_n_nz == 0) { return; } typename SpMat::const_iterator it = X.begin(); if(n_cols == 1) { for(uword i=0; i < X_n_nz; ++i) { const uword row = it.row(); out.at(row_offset + row, col_offset + row) = (*it); ++it; } } else if(n_rows == 1) { for(uword i=0; i < X_n_nz; ++i) { const uword col = it.col(); out.at(row_offset + col, col_offset + col) = (*it); ++it; } } } else // generate a diagonal matrix out of a matrix { arma_conform_check_bounds ( ((row_offset > 0) && (row_offset >= n_rows)) || ((col_offset > 0) && (col_offset >= n_cols)), "diagmat(): requested diagonal out of bounds" ); out.zeros(n_rows, n_cols); if(X.n_nonzero == 0) { return; } const uword N = (std::min)(n_rows - row_offset, n_cols - col_offset); for(uword i=0; i inline void op_trimat::fill_zeros(Mat& out, const bool upper) { arma_debug_sigprint(); const uword N = out.n_rows; if(upper) { // upper triangular: set all elements below the diagonal to zero for(uword i=0; i inline void op_trimat::apply(Mat& out, const Op& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const bool upper = (in.aux_uword_a == 0); // allow detection of in-place operation if(is_Mat::value) { const unwrap U(in.m); if(&out == &(U.M)) { arma_conform_check( (U.M.is_square() == false), "trimatu()/trimatl(): given matrix must be square sized" ); op_trimat::fill_zeros(out, upper); } else { op_trimat::apply_mat_noalias(out, U.M, upper); } } else if((is_Mat::stored_type>::value) || (arma_config::openmp && Proxy::use_mp)) { const quasi_unwrap U(in.m); if(U.is_alias(out)) { Mat tmp; op_trimat::apply_mat_noalias(tmp, U.M, upper); out.steal_mem(tmp); } else { op_trimat::apply_mat_noalias(out, U.M, upper); } } else { const Proxy P(in.m); if(P.is_alias(out)) { Mat tmp; op_trimat::apply_proxy_noalias(tmp, P, upper); out.steal_mem(tmp); } else { op_trimat::apply_proxy_noalias(out, P, upper); } } } template inline void op_trimat::apply_mat_noalias(Mat& out, const Mat& A, const bool upper) { arma_debug_sigprint(); arma_conform_check( (A.is_square() == false), "trimatu()/trimatl(): given matrix must be square sized" ); out.copy_size(A); const uword N = A.n_rows; if(upper) { // upper triangular: copy the diagonal and the elements above the diagonal for(uword i=0; i inline void op_trimat::apply_proxy_noalias(Mat& out, const Proxy& P, const bool upper) { arma_debug_sigprint(); arma_conform_check( (P.get_n_rows() != P.get_n_cols()), "trimatu()/trimatl(): given matrix must be square sized" ); const uword N = P.get_n_rows(); out.set_size(N,N); if(upper) { for(uword j=0; j < N; ++j) for(uword i=0; i < (j+1); ++i) { out.at(i,j) = P.at(i,j); } } else { for(uword j=0; j inline void op_trimatu_ext::apply(Mat& out, const Op& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const unwrap tmp(in.m); const Mat& A = tmp.M; arma_conform_check( (A.is_square() == false), "trimatu(): given matrix must be square sized" ); const uword row_offset = in.aux_uword_a; const uword col_offset = in.aux_uword_b; const uword n_rows = A.n_rows; const uword n_cols = A.n_cols; arma_conform_check_bounds( ((row_offset > 0) && (row_offset >= n_rows)) || ((col_offset > 0) && (col_offset >= n_cols)), "trimatu(): requested diagonal is out of bounds" ); if(&out != &A) { out.copy_size(A); const uword N = (std::min)(n_rows - row_offset, n_cols - col_offset); for(uword i=0; i < n_cols; ++i) { const uword col = i + col_offset; if(i < N) { const uword end_row = i + row_offset; for(uword row=0; row <= end_row; ++row) { out.at(row,col) = A.at(row,col); } } else { if(col < n_cols) { arrayops::copy(out.colptr(col), A.colptr(col), n_rows); } } } } op_trimatu_ext::fill_zeros(out, row_offset, col_offset); } template inline void op_trimatu_ext::fill_zeros(Mat& out, const uword row_offset, const uword col_offset) { arma_debug_sigprint(); const uword n_rows = out.n_rows; const uword n_cols = out.n_cols; const uword N = (std::min)(n_rows - row_offset, n_cols - col_offset); for(uword col=0; col < col_offset; ++col) { arrayops::fill_zeros(out.colptr(col), n_rows); } for(uword i=0; i < N; ++i) { const uword start_row = i + row_offset + 1; const uword col = i + col_offset; for(uword row=start_row; row < n_rows; ++row) { out.at(row,col) = eT(0); } } } // template inline void op_trimatl_ext::apply(Mat& out, const Op& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const unwrap tmp(in.m); const Mat& A = tmp.M; arma_conform_check( (A.is_square() == false), "trimatl(): given matrix must be square sized" ); const uword row_offset = in.aux_uword_a; const uword col_offset = in.aux_uword_b; const uword n_rows = A.n_rows; const uword n_cols = A.n_cols; arma_conform_check_bounds( ((row_offset > 0) && (row_offset >= n_rows)) || ((col_offset > 0) && (col_offset >= n_cols)), "trimatl(): requested diagonal is out of bounds" ); if(&out != &A) { out.copy_size(A); const uword N = (std::min)(n_rows - row_offset, n_cols - col_offset); for(uword col=0; col < col_offset; ++col) { arrayops::copy( out.colptr(col), A.colptr(col), n_rows ); } for(uword i=0; i inline void op_trimatl_ext::fill_zeros(Mat& out, const uword row_offset, const uword col_offset) { arma_debug_sigprint(); const uword n_rows = out.n_rows; const uword n_cols = out.n_cols; const uword N = (std::min)(n_rows - row_offset, n_cols - col_offset); for(uword i=0; i < n_cols; ++i) { const uword col = i + col_offset; if(i < N) { const uword end_row = i + row_offset; for(uword row=0; row < end_row; ++row) { out.at(row,col) = eT(0); } } else { if(col < n_cols) { arrayops::fill_zeros(out.colptr(col), n_rows); } } } } //! @} RcppArmadillo/inst/include/armadillo_bits/glue_hist_meat.hpp0000644000176200001440000001422514631567470024113 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup glue_hist //! @{ template inline void glue_hist::apply_noalias(Mat& out, const Mat& X, const Mat& C, const uword dim) { arma_debug_sigprint(); arma_conform_check( ((C.is_vec() == false) && (C.is_empty() == false)), "hist(): parameter 'centers' must be a vector" ); const uword X_n_rows = X.n_rows; const uword X_n_cols = X.n_cols; const uword C_n_elem = C.n_elem; if( C_n_elem == 0 ) { out.reset(); return; } arma_conform_check ( ((Col(const_cast(C.memptr()), C_n_elem, false, false)).is_sorted("strictascend") == false), "hist(): given 'centers' vector does not contain monotonically increasing values" ); const eT* C_mem = C.memptr(); const eT center_0 = C_mem[0]; if(dim == 0) { out.zeros(C_n_elem, X_n_cols); for(uword col=0; col < X_n_cols; ++col) { const eT* X_coldata = X.colptr(col); uword* out_coldata = out.colptr(col); for(uword row=0; row < X_n_rows; ++row) { const eT val = X_coldata[row]; if(arma_isfinite(val)) { eT opt_dist = (center_0 >= val) ? (center_0 - val) : (val - center_0); uword opt_index = 0; for(uword j=1; j < C_n_elem; ++j) { const eT center = C_mem[j]; const eT dist = (center >= val) ? (center - val) : (val - center); if(dist < opt_dist) { opt_dist = dist; opt_index = j; } else { break; } } out_coldata[opt_index]++; } else { // -inf if(val < eT(0)) { out_coldata[0]++; } // +inf if(val > eT(0)) { out_coldata[C_n_elem-1]++; } // ignore NaN } } } } else if(dim == 1) { out.zeros(X_n_rows, C_n_elem); if(X_n_rows == 1) { const uword X_n_elem = X.n_elem; const eT* X_mem = X.memptr(); uword* out_mem = out.memptr(); for(uword i=0; i < X_n_elem; ++i) { const eT val = X_mem[i]; if(is_finite(val)) { eT opt_dist = (val >= center_0) ? (val - center_0) : (center_0 - val); uword opt_index = 0; for(uword j=1; j < C_n_elem; ++j) { const eT center = C_mem[j]; const eT dist = (val >= center) ? (val - center) : (center - val); if(dist < opt_dist) { opt_dist = dist; opt_index = j; } else { break; } } out_mem[opt_index]++; } else { // -inf if(val < eT(0)) { out_mem[0]++; } // +inf if(val > eT(0)) { out_mem[C_n_elem-1]++; } // ignore NaN } } } else { for(uword row=0; row < X_n_rows; ++row) { for(uword col=0; col < X_n_cols; ++col) { const eT val = X.at(row,col); if(arma_isfinite(val)) { eT opt_dist = (center_0 >= val) ? (center_0 - val) : (val - center_0); uword opt_index = 0; for(uword j=1; j < C_n_elem; ++j) { const eT center = C_mem[j]; const eT dist = (center >= val) ? (center - val) : (val - center); if(dist < opt_dist) { opt_dist = dist; opt_index = j; } else { break; } } out.at(row,opt_index)++; } else { // -inf if(val < eT(0)) { out.at(row,0)++; } // +inf if(val > eT(0)) { out.at(row,C_n_elem-1)++; } // ignore NaN } } } } } } template inline void glue_hist::apply(Mat& out, const mtGlue& expr) { arma_debug_sigprint(); const uword dim = expr.aux_uword; arma_conform_check( (dim > 1), "hist(): parameter 'dim' must be 0 or 1" ); const quasi_unwrap UA(expr.A); const quasi_unwrap UB(expr.B); if(UA.is_alias(out) || UB.is_alias(out)) { Mat tmp; glue_hist::apply_noalias(tmp, UA.M, UB.M, dim); out.steal_mem(tmp); } else { glue_hist::apply_noalias(out, UA.M, UB.M, dim); } } template inline void glue_hist_default::apply(Mat& out, const mtGlue& expr) { arma_debug_sigprint(); const quasi_unwrap UA(expr.A); const quasi_unwrap UB(expr.B); const uword dim = (T1::is_xvec) ? uword(UA.M.is_rowvec() ? 1 : 0) : uword((T1::is_row) ? 1 : 0); if(UA.is_alias(out) || UB.is_alias(out)) { Mat tmp; glue_hist::apply_noalias(tmp, UA.M, UB.M, dim); out.steal_mem(tmp); } else { glue_hist::apply_noalias(out, UA.M, UB.M, dim); } } //! @} RcppArmadillo/inst/include/armadillo_bits/glue_max_meat.hpp0000644000176200001440000001030414631567470023723 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup glue_max //! @{ template inline void glue_max::apply(Mat& out, const Glue& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const Proxy PA(X.A); const Proxy PB(X.B); if( (PA.is_alias(out) && PA.has_subview) || (PB.is_alias(out) && PB.has_subview) ) { Mat tmp; glue_max::apply(tmp, PA, PB); out.steal_mem(tmp); } else { glue_max::apply(out, PA, PB); } } template inline void glue_max::apply(Mat& out, const Proxy& PA, const Proxy& PB) { arma_debug_sigprint(); const uword n_rows = PA.get_n_rows(); const uword n_cols = PA.get_n_cols(); arma_conform_assert_same_size(n_rows, n_cols, PB.get_n_rows(), PB.get_n_cols(), "element-wise max()"); const arma_gt_comparator comparator; out.set_size(n_rows, n_cols); eT* out_mem = out.memptr(); if( (Proxy::use_at == false) && (Proxy::use_at == false) ) { typename Proxy::ea_type A = PA.get_ea(); typename Proxy::ea_type B = PB.get_ea(); const uword N = PA.get_n_elem(); for(uword i=0; i inline void glue_max::apply(Cube& out, const GlueCube& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const ProxyCube PA(X.A); const ProxyCube PB(X.B); if( (PA.is_alias(out) && PA.has_subview) || (PB.is_alias(out) && PB.has_subview) ) { Cube tmp; glue_max::apply(tmp, PA, PB); out.steal_mem(tmp); } else { glue_max::apply(out, PA, PB); } } template inline void glue_max::apply(Cube& out, const ProxyCube& PA, const ProxyCube& PB) { arma_debug_sigprint(); const uword n_rows = PA.get_n_rows(); const uword n_cols = PA.get_n_cols(); const uword n_slices = PA.get_n_slices(); arma_conform_assert_same_size(n_rows, n_cols, n_slices, PB.get_n_rows(), PB.get_n_cols(), PB.get_n_slices(), "element-wise max()"); const arma_gt_comparator comparator; out.set_size(n_rows, n_cols, n_slices); eT* out_mem = out.memptr(); if( (ProxyCube::use_at == false) && (ProxyCube::use_at == false) ) { typename ProxyCube::ea_type A = PA.get_ea(); typename ProxyCube::ea_type B = PB.get_ea(); const uword N = PA.get_n_elem(); for(uword i=0; i inline void op_inv_gen_default::apply(Mat& out, const Op& X) { arma_debug_sigprint(); const bool status = op_inv_gen_default::apply_direct(out, X.m, "inv()"); if(status == false) { out.soft_reset(); arma_stop_runtime_error("inv(): matrix is singular"); } } template inline bool op_inv_gen_default::apply_direct(Mat& out, const Base& expr, const char* caller_sig) { arma_debug_sigprint(); return op_inv_gen_full::apply_direct(out, expr, caller_sig, uword(0)); } // template inline void op_inv_gen_full::apply(Mat& out, const Op& X) { arma_debug_sigprint(); const uword flags = X.aux_uword_a; const bool status = op_inv_gen_full::apply_direct(out, X.m, "inv()", flags); if(status == false) { out.soft_reset(); arma_stop_runtime_error("inv(): matrix is singular"); } } template inline bool op_inv_gen_full::apply_direct(Mat& out, const Base& expr, const char* caller_sig, const uword flags) { arma_debug_sigprint(); typedef typename T1::elem_type eT; typedef typename T1::pod_type T; if(has_user_flags == true ) { arma_debug_print("op_inv_gen_full: has_user_flags = true"); } if(has_user_flags == false) { arma_debug_print("op_inv_gen_full: has_user_flags = false"); } const bool fast = has_user_flags && bool(flags & inv_opts::flag_fast ); const bool allow_approx = has_user_flags && bool(flags & inv_opts::flag_allow_approx); const bool no_ugly = has_user_flags && bool(flags & inv_opts::flag_no_ugly ); if(has_user_flags) { arma_debug_print("op_inv_gen_full: enabled flags:"); if(fast ) { arma_debug_print("fast"); } if(allow_approx) { arma_debug_print("allow_approx"); } if(no_ugly ) { arma_debug_print("no_ugly"); } arma_conform_check( (fast && allow_approx), "inv(): options 'fast' and 'allow_approx' are mutually exclusive" ); arma_conform_check( (fast && no_ugly ), "inv(): options 'fast' and 'no_ugly' are mutually exclusive" ); arma_conform_check( (no_ugly && allow_approx), "inv(): options 'no_ugly' and 'allow_approx' are mutually exclusive" ); } if(no_ugly) { op_inv_gen_state inv_state; const bool status = op_inv_gen_rcond::apply_direct(out, inv_state, expr); // workaround for bug in gcc 4.8 const uword local_size = inv_state.size; const T local_rcond = inv_state.rcond; if((status == false) || (local_rcond < ((std::max)(local_size, uword(1)) * std::numeric_limits::epsilon())) || arma_isnan(local_rcond)) { return false; } return true; } if(allow_approx) { op_inv_gen_state inv_state; Mat tmp; const bool status = op_inv_gen_rcond::apply_direct(tmp, inv_state, expr); // workaround for bug in gcc 4.8 const uword local_size = inv_state.size; const T local_rcond = inv_state.rcond; if((status == false) || (local_rcond < ((std::max)(local_size, uword(1)) * std::numeric_limits::epsilon())) || arma_isnan(local_rcond)) { Mat A = expr.get_ref(); if(inv_state.is_diag) { return op_pinv::apply_diag(out, A, T(0) ); } if(inv_state.is_sym ) { return op_pinv::apply_sym (out, A, T(0), uword(0)); } return op_pinv::apply_gen(out, A, T(0), uword(0)); } out.steal_mem(tmp); return true; } out = expr.get_ref(); arma_conform_check( (out.is_square() == false), caller_sig, ": given matrix must be square sized", [&](){ out.soft_reset(); } ); const uword N = out.n_rows; if(N == 0) { return true; } if(is_cx::no) { if(N == 1) { const eT a = out[0]; out[0] = eT(1) / a; return (a != eT(0)); } else if(N == 2) { const bool status = op_inv_gen_full::apply_tiny_2x2(out); if(status) { return true; } } else if(N == 3) { const bool status = op_inv_gen_full::apply_tiny_3x3(out); if(status) { return true; } } // fallthrough if optimisation failed } if(is_op_diagmat::value || out.is_diagmat()) { arma_debug_print("op_inv_gen_full: diag optimisation"); eT* colmem = out.memptr(); for(uword i=0; i strip(expr.get_ref()); const bool is_triu_expr = strip.do_triu; const bool is_tril_expr = strip.do_tril; const bool is_triu_mat = (is_triu_expr || is_tril_expr) ? false : ( trimat_helper::is_triu(out)); const bool is_tril_mat = (is_triu_expr || is_tril_expr) ? false : ((is_triu_mat) ? false : trimat_helper::is_tril(out)); if(is_triu_expr || is_tril_expr || is_triu_mat || is_tril_mat) { arma_debug_print("op_inv_gen_full: tri optimisation"); return auxlib::inv_tr(out, ((is_triu_expr || is_triu_mat) ? uword(0) : uword(1))); } if( (arma_config::optimise_sym) && (auxlib::crippled_lapack(out) == false) && ( is_sym_expr::eval(expr.get_ref()) || sym_helper::is_approx_sym(out, uword(100)) ) ) { arma_debug_print("op_inv_gen_full: symmetric/hermitian optimisation"); return auxlib::inv_sym(out); } return auxlib::inv(out); } template inline bool op_inv_gen_full::apply_tiny_2x2(Mat& X) { arma_debug_sigprint(); typedef typename get_pod_type::result T; // NOTE: assuming matrix X is square sized constexpr T det_min = std::numeric_limits::epsilon(); constexpr T det_max = T(1) / std::numeric_limits::epsilon(); eT* Xm = X.memptr(); const eT a = Xm[pos<0,0>::n2]; const eT b = Xm[pos<0,1>::n2]; const eT c = Xm[pos<1,0>::n2]; const eT d = Xm[pos<1,1>::n2]; const eT det_val = (a*d - b*c); const T abs_det_val = std::abs(det_val); if((abs_det_val < det_min) || (abs_det_val > det_max) || arma_isnan(det_val)) { return false; } Xm[pos<0,0>::n2] = d / det_val; Xm[pos<0,1>::n2] = -b / det_val; Xm[pos<1,0>::n2] = -c / det_val; Xm[pos<1,1>::n2] = a / det_val; return true; } template inline bool op_inv_gen_full::apply_tiny_3x3(Mat& X) { arma_debug_sigprint(); typedef typename get_pod_type::result T; // NOTE: assuming matrix X is square sized constexpr T det_min = std::numeric_limits::epsilon(); constexpr T det_max = T(1) / std::numeric_limits::epsilon(); Mat Y(3, 3, arma_nozeros_indicator()); eT* Xm = X.memptr(); eT* Ym = Y.memptr(); const eT det_val = op_det::apply_tiny_3x3(X); const T abs_det_val = std::abs(det_val); if((abs_det_val < det_min) || (abs_det_val > det_max) || arma_isnan(det_val)) { return false; } Ym[pos<0,0>::n3] = (Xm[pos<2,2>::n3]*Xm[pos<1,1>::n3] - Xm[pos<2,1>::n3]*Xm[pos<1,2>::n3]) / det_val; Ym[pos<1,0>::n3] = -(Xm[pos<2,2>::n3]*Xm[pos<1,0>::n3] - Xm[pos<2,0>::n3]*Xm[pos<1,2>::n3]) / det_val; Ym[pos<2,0>::n3] = (Xm[pos<2,1>::n3]*Xm[pos<1,0>::n3] - Xm[pos<2,0>::n3]*Xm[pos<1,1>::n3]) / det_val; Ym[pos<0,1>::n3] = -(Xm[pos<2,2>::n3]*Xm[pos<0,1>::n3] - Xm[pos<2,1>::n3]*Xm[pos<0,2>::n3]) / det_val; Ym[pos<1,1>::n3] = (Xm[pos<2,2>::n3]*Xm[pos<0,0>::n3] - Xm[pos<2,0>::n3]*Xm[pos<0,2>::n3]) / det_val; Ym[pos<2,1>::n3] = -(Xm[pos<2,1>::n3]*Xm[pos<0,0>::n3] - Xm[pos<2,0>::n3]*Xm[pos<0,1>::n3]) / det_val; Ym[pos<0,2>::n3] = (Xm[pos<1,2>::n3]*Xm[pos<0,1>::n3] - Xm[pos<1,1>::n3]*Xm[pos<0,2>::n3]) / det_val; Ym[pos<1,2>::n3] = -(Xm[pos<1,2>::n3]*Xm[pos<0,0>::n3] - Xm[pos<1,0>::n3]*Xm[pos<0,2>::n3]) / det_val; Ym[pos<2,2>::n3] = (Xm[pos<1,1>::n3]*Xm[pos<0,0>::n3] - Xm[pos<1,0>::n3]*Xm[pos<0,1>::n3]) / det_val; const eT check_val = Xm[pos<0,0>::n3]*Ym[pos<0,0>::n3] + Xm[pos<0,1>::n3]*Ym[pos<1,0>::n3] + Xm[pos<0,2>::n3]*Ym[pos<2,0>::n3]; const T max_diff = (is_float::value) ? T(1e-4) : T(1e-10); // empirically determined; may need tuning if(std::abs(T(1) - check_val) >= max_diff) { return false; } arrayops::copy(Xm, Ym, uword(3*3)); return true; } template inline bool op_inv_gen_rcond::apply_direct(Mat& out, op_inv_gen_state& out_state, const Base& expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; typedef typename T1::pod_type T; out = expr.get_ref(); out_state.size = out.n_rows; out_state.rcond = T(0); arma_conform_check( (out.is_square() == false), "inv(): given matrix must be square sized", [&](){ out.soft_reset(); } ); if(is_op_diagmat::value || out.is_diagmat()) { arma_debug_print("op_inv_gen_rcond: diag optimisation"); out_state.is_diag = true; eT* colmem = out.memptr(); T max_abs_src_val = T(0); T max_abs_inv_val = T(0); const uword N = out.n_rows; for(uword i=0; i max_abs_src_val) ? abs_src_val : max_abs_src_val; max_abs_inv_val = (abs_inv_val > max_abs_inv_val) ? abs_inv_val : max_abs_inv_val; colmem += N; } out_state.rcond = T(1) / (max_abs_src_val * max_abs_inv_val); return true; } const strip_trimat strip(expr.get_ref()); const bool is_triu_expr = strip.do_triu; const bool is_tril_expr = strip.do_tril; const bool is_triu_mat = (is_triu_expr || is_tril_expr) ? false : ( trimat_helper::is_triu(out)); const bool is_tril_mat = (is_triu_expr || is_tril_expr) ? false : ((is_triu_mat) ? false : trimat_helper::is_tril(out)); if(is_triu_expr || is_tril_expr || is_triu_mat || is_tril_mat) { arma_debug_print("op_inv_gen_rcond: tri optimisation"); return auxlib::inv_tr_rcond(out, out_state.rcond, ((is_triu_expr || is_triu_mat) ? uword(0) : uword(1))); } if( (arma_config::optimise_sym) && (auxlib::crippled_lapack(out) == false) && ( is_sym_expr::eval(expr.get_ref()) || sym_helper::is_approx_sym(out, uword(100)) ) ) { arma_debug_print("op_inv_gen_rcond: symmetric/hermitian optimisation"); out_state.is_sym = true; return auxlib::inv_sym_rcond(out, out_state.rcond); } return auxlib::inv_rcond(out, out_state.rcond); } //! @} RcppArmadillo/inst/include/armadillo_bits/spop_diagmat_bones.hpp0000644000176200001440000000413414301267044024741 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup spop_diagmat //! @{ class spop_diagmat : public traits_op_default { public: template inline static void apply(SpMat& out, const SpOp& in); template inline static void apply_noalias(SpMat& out, const SpBase& expr); template inline static void apply_noalias(SpMat& out, const SpGlue& expr); template inline static void apply_noalias(SpMat& out, const SpGlue& expr); template inline static void apply_noalias(SpMat& out, const SpGlue& expr); template inline static void apply_noalias(SpMat& out, const SpGlue& expr); }; class spop_diagmat2 : public traits_op_default { public: template inline static void apply(SpMat& out, const SpOp& in); template inline static void apply_noalias(SpMat& out, const SpMat& X, const uword row_offset, const uword col_offset); }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_sp_max_meat.hpp0000644000176200001440000003634114634016465024114 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_sp_max //! @{ template inline void op_sp_max::apply(Mat& out, const mtSpReduceOp& in) { arma_debug_sigprint(); const uword dim = in.aux_uword_a; arma_conform_check( (dim > 1), "max(): parameter 'dim' must be 0 or 1" ); const SpProxy p(in.m); const uword p_n_rows = p.get_n_rows(); const uword p_n_cols = p.get_n_cols(); if( (p_n_rows == 0) || (p_n_cols == 0) || (p.get_n_nonzero() == 0) ) { if(dim == 0) { out.zeros((p_n_rows > 0) ? 1 : 0, p_n_cols); } if(dim == 1) { out.zeros(p_n_rows, (p_n_cols > 0) ? 1 : 0); } return; } op_sp_max::apply_proxy(out, p, dim); } template inline void op_sp_max::apply_proxy ( Mat& out, const SpProxy& p, const uword dim, const typename arma_not_cx::result* junk ) { arma_debug_sigprint(); arma_ignore(junk); typedef typename T1::elem_type eT; typename SpProxy::const_iterator_type it = p.begin(); typename SpProxy::const_iterator_type it_end = p.end(); const uword p_n_cols = p.get_n_cols(); const uword p_n_rows = p.get_n_rows(); if(dim == 0) // find the maximum in each column { out.zeros(1, p_n_cols); urowvec count(p_n_cols, arma_zeros_indicator()); while(it != it_end) { const uword col = it.col(); out[col] = (count[col] == 0) ? (*it) : (std::max)(out[col], (*it)); count[col]++; ++it; } for(uword col=0; col inline typename T1::elem_type op_sp_max::vector_max ( const T1& x, const typename arma_not_cx::result* junk ) { arma_debug_sigprint(); arma_ignore(junk); typedef typename T1::elem_type eT; const SpProxy p(x); if(p.get_n_elem() == 0) { arma_conform_check(true, "max(): object has no elements"); return Datum::nan; } if(p.get_n_nonzero() == 0) { return eT(0); } if(SpProxy::use_iterator == false) { // direct access of values if(p.get_n_nonzero() == p.get_n_elem()) { return op_max::direct_max(p.get_values(), p.get_n_nonzero()); } else { return (std::max)(eT(0), op_max::direct_max(p.get_values(), p.get_n_nonzero())); } } else { // use iterator typename SpProxy::const_iterator_type it = p.begin(); typename SpProxy::const_iterator_type it_end = p.end(); eT result = (*it); ++it; while(it != it_end) { if((*it) > result) { result = (*it); } ++it; } if(p.get_n_nonzero() == p.get_n_elem()) { return result; } else { return (std::max)(eT(0), result); } } } template inline typename arma_not_cx::result op_sp_max::max(const SpBase& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const SpProxy P(X.get_ref()); const uword n_elem = P.get_n_elem(); const uword n_nonzero = P.get_n_nonzero(); if(n_elem == 0) { arma_conform_check(true, "max(): object has no elements"); return Datum::nan; } eT max_val = priv::most_neg(); if(SpProxy::use_iterator) { // We have to iterate over the elements. typedef typename SpProxy::const_iterator_type it_type; it_type it = P.begin(); it_type it_end = P.end(); while(it != it_end) { if((*it) > max_val) { max_val = *it; } ++it; } } else { // We can do direct access of the values, row_indices, and col_ptrs. // We don't need the location of the max value, so we can just call out to // other functions... max_val = op_max::direct_max(P.get_values(), n_nonzero); } if(n_elem == n_nonzero) { return max_val; } else { return (std::max)(eT(0), max_val); } } template inline typename arma_not_cx::result op_sp_max::max_with_index(const SpProxy& P, uword& index_of_max_val) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword n_elem = P.get_n_elem(); const uword n_nonzero = P.get_n_nonzero(); const uword n_rows = P.get_n_rows(); if(n_elem == 0) { arma_conform_check(true, "max(): object has no elements"); index_of_max_val = uword(0); return Datum::nan; } eT max_val = priv::most_neg(); if(SpProxy::use_iterator) { // We have to iterate over the elements. typedef typename SpProxy::const_iterator_type it_type; it_type it = P.begin(); it_type it_end = P.end(); while(it != it_end) { if((*it) > max_val) { max_val = *it; index_of_max_val = it.row() + it.col() * n_rows; } ++it; } } else { // We can do direct access. max_val = op_max::direct_max(P.get_values(), n_nonzero, index_of_max_val); // Convert to actual position in matrix. const uword row = P.get_row_indices()[index_of_max_val]; uword col = 0; while(P.get_col_ptrs()[++col] <= index_of_max_val) { } index_of_max_val = (col - 1) * n_rows + row; } if(n_elem != n_nonzero) { max_val = (std::max)(eT(0), max_val); // If the max_val is a nonzero element, we need its actual position in the matrix. if(max_val == eT(0)) { // Find first zero element. uword last_row = 0; uword last_col = 0; typedef typename SpProxy::const_iterator_type it_type; it_type it = P.begin(); it_type it_end = P.end(); while(it != it_end) { // Have we moved more than one position from the last place? if((it.col() == last_col) && (it.row() - last_row > 1)) { index_of_max_val = it.col() * n_rows + last_row + 1; break; } else if((it.col() >= last_col + 1) && (last_row < n_rows - 1)) { index_of_max_val = last_col * n_rows + last_row + 1; break; } else if((it.col() == last_col + 1) && (it.row() > 0)) { index_of_max_val = it.col() * n_rows; break; } else if(it.col() > last_col + 1) { index_of_max_val = (last_col + 1) * n_rows; break; } last_row = it.row(); last_col = it.col(); ++it; } } } return max_val; } template inline void op_sp_max::apply_proxy ( Mat& out, const SpProxy& p, const uword dim, const typename arma_cx_only::result* junk ) { arma_debug_sigprint(); arma_ignore(junk); typedef typename T1::elem_type eT; typedef typename get_pod_type::result T; typename SpProxy::const_iterator_type it = p.begin(); typename SpProxy::const_iterator_type it_end = p.end(); const uword p_n_cols = p.get_n_cols(); const uword p_n_rows = p.get_n_rows(); if(dim == 0) // find the maximum in each column { out.zeros(1, p_n_cols); Row absval(p_n_cols, arma_zeros_indicator()); while(it != it_end) { const uword col = it.col(); const eT& v = (*it); const T a = std::abs(v); if(a > absval[col]) { absval[col] = a; out[col] = v; } ++it; } } else if(dim == 1) // find the maximum in each row { out.zeros(p_n_rows, 1); Col absval(p_n_rows, arma_zeros_indicator()); while(it != it_end) { const uword row = it.row(); const eT& v = (*it); const T a = std::abs(v); if(a > absval[row]) { absval[row] = a; out[row] = v; } ++it; } } } template inline typename T1::elem_type op_sp_max::vector_max ( const T1& x, const typename arma_cx_only::result* junk ) { arma_debug_sigprint(); arma_ignore(junk); typedef typename T1::elem_type eT; typedef typename get_pod_type::result T; const SpProxy p(x); if(p.get_n_elem() == 0) { arma_conform_check(true, "max(): object has no elements"); return Datum::nan; } if(p.get_n_nonzero() == 0) { return eT(0); } if(SpProxy::use_iterator == false) { // direct access of values if(p.get_n_nonzero() == p.get_n_elem()) { return op_max::direct_max(p.get_values(), p.get_n_nonzero()); } else { const eT val1 = eT(0); const eT val2 = op_max::direct_max(p.get_values(), p.get_n_nonzero()); return ( std::abs(val1) >= std::abs(val2) ) ? val1 : val2; } } else { // use iterator typename SpProxy::const_iterator_type it = p.begin(); typename SpProxy::const_iterator_type it_end = p.end(); eT best_val_orig = *it; T best_val_abs = std::abs(best_val_orig); ++it; while(it != it_end) { eT val_orig = *it; T val_abs = std::abs(val_orig); if(val_abs > best_val_abs) { best_val_abs = val_abs; best_val_orig = val_orig; } ++it; } if(p.get_n_nonzero() == p.get_n_elem()) { return best_val_orig; } else { const eT val1 = eT(0); return ( std::abs(val1) >= best_val_abs ) ? val1 : best_val_orig; } } } template inline typename arma_cx_only::result op_sp_max::max(const SpBase& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; typedef typename get_pod_type::result T; const SpProxy P(X.get_ref()); const uword n_elem = P.get_n_elem(); const uword n_nonzero = P.get_n_nonzero(); if(n_elem == 0) { arma_conform_check(true, "max(): object has no elements"); return Datum::nan; } T max_val = priv::most_neg(); eT ret_val; if(SpProxy::use_iterator) { // We have to iterate over the elements. typedef typename SpProxy::const_iterator_type it_type; it_type it = P.begin(); it_type it_end = P.end(); while(it != it_end) { const T tmp_val = std::abs(*it); if(tmp_val > max_val) { max_val = tmp_val; ret_val = *it; } ++it; } } else { // We can do direct access of the values, row_indices, and col_ptrs. // We don't need the location of the max value, so we can just call out to // other functions... ret_val = op_max::direct_max(P.get_values(), n_nonzero); max_val = std::abs(ret_val); } if(n_elem == n_nonzero) { return max_val; } else { return (T(0) > max_val) ? eT(0) : ret_val; } } template inline typename arma_cx_only::result op_sp_max::max_with_index(const SpProxy& P, uword& index_of_max_val) { arma_debug_sigprint(); typedef typename T1::elem_type eT; typedef typename get_pod_type::result T; const uword n_elem = P.get_n_elem(); const uword n_nonzero = P.get_n_nonzero(); const uword n_rows = P.get_n_rows(); if(n_elem == 0) { arma_conform_check(true, "max(): object has no elements"); index_of_max_val = uword(0); return Datum::nan; } T max_val = priv::most_neg(); if(SpProxy::use_iterator) { // We have to iterate over the elements. typedef typename SpProxy::const_iterator_type it_type; it_type it = P.begin(); it_type it_end = P.end(); while(it != it_end) { const T tmp_val = std::abs(*it); if(tmp_val > max_val) { max_val = tmp_val; index_of_max_val = it.row() + it.col() * n_rows; } ++it; } } else { // We can do direct access. max_val = std::abs(op_max::direct_max(P.get_values(), n_nonzero, index_of_max_val)); // Convert to actual position in matrix. const uword row = P.get_row_indices()[index_of_max_val]; uword col = 0; while(P.get_col_ptrs()[++col] <= index_of_max_val) { } index_of_max_val = (col - 1) * n_rows + row; } if(n_elem != n_nonzero) { max_val = (std::max)(T(0), max_val); // If the max_val is a nonzero element, we need its actual position in the matrix. if(max_val == T(0)) { // Find first zero element. uword last_row = 0; uword last_col = 0; typedef typename SpProxy::const_iterator_type it_type; it_type it = P.begin(); it_type it_end = P.end(); while(it != it_end) { // Have we moved more than one position from the last place? if((it.col() == last_col) && (it.row() - last_row > 1)) { index_of_max_val = it.col() * n_rows + last_row + 1; break; } else if((it.col() >= last_col + 1) && (last_row < n_rows - 1)) { index_of_max_val = last_col * n_rows + last_row + 1; break; } else if((it.col() == last_col + 1) && (it.row() > 0)) { index_of_max_val = it.col() * n_rows; break; } else if(it.col() > last_col + 1) { index_of_max_val = (last_col + 1) * n_rows; break; } last_row = it.row(); last_col = it.col(); ++it; } } } return P[index_of_max_val]; } //! @} RcppArmadillo/inst/include/armadillo_bits/subview_cube_bones.hpp0000644000176200001440000002243014443051300024744 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup subview_cube //! @{ //! Class for storing data required to construct or apply operations to a subcube //! (ie. where the subcube starts and ends as well as a reference/pointer to the original cube), template class subview_cube : public BaseCube< eT, subview_cube > { public: typedef eT elem_type; typedef typename get_pod_type::result pod_type; arma_aligned const Cube& m; const uword aux_row1; const uword aux_col1; const uword aux_slice1; const uword n_rows; const uword n_cols; const uword n_elem_slice; const uword n_slices; const uword n_elem; protected: arma_inline subview_cube(const Cube& in_m, const uword in_row1, const uword in_col1, const uword in_slice1, const uword in_n_rows, const uword in_n_cols, const uword in_n_slices); public: inline ~subview_cube(); inline subview_cube() = delete; inline subview_cube(const subview_cube& in); inline subview_cube( subview_cube&& in); template inline void inplace_op(const eT val ); template inline void inplace_op(const BaseCube& x, const char* identifier); template inline void inplace_op(const subview_cube& x, const char* identifier); inline void operator= (const eT val); inline void operator+= (const eT val); inline void operator-= (const eT val); inline void operator*= (const eT val); inline void operator/= (const eT val); // deliberately returning void template inline void operator= (const BaseCube& x); template inline void operator+= (const BaseCube& x); template inline void operator-= (const BaseCube& x); template inline void operator%= (const BaseCube& x); template inline void operator/= (const BaseCube& x); inline void operator= (const subview_cube& x); inline void operator+= (const subview_cube& x); inline void operator-= (const subview_cube& x); inline void operator%= (const subview_cube& x); inline void operator/= (const subview_cube& x); template inline void operator= (const Base& x); template inline void operator+= (const Base& x); template inline void operator-= (const Base& x); template inline void operator%= (const Base& x); template inline void operator/= (const Base& x); template inline void operator=(const GenCube& x); inline static void extract(Cube& out, const subview_cube& in); inline static void plus_inplace(Cube& out, const subview_cube& in); inline static void minus_inplace(Cube& out, const subview_cube& in); inline static void schur_inplace(Cube& out, const subview_cube& in); inline static void div_inplace(Cube& out, const subview_cube& in); inline static void extract(Mat& out, const subview_cube& in); inline static void plus_inplace(Mat& out, const subview_cube& in); inline static void minus_inplace(Mat& out, const subview_cube& in); inline static void schur_inplace(Mat& out, const subview_cube& in); inline static void div_inplace(Mat& out, const subview_cube& in); template inline void for_each(functor F); template inline void for_each(functor F) const; template inline void transform(functor F); template inline void imbue(functor F); inline void each_slice(const std::function< void( Mat&) >& F); inline void each_slice(const std::function< void(const Mat&) >& F) const; inline void replace(const eT old_val, const eT new_val); inline void clean(const pod_type threshold); inline void clamp(const eT min_val, const eT max_val); inline void fill(const eT val); inline void zeros(); inline void ones(); inline void randu(); inline void randn(); arma_warn_unused inline bool is_finite() const; arma_warn_unused inline bool is_zero(const pod_type tol = 0) const; arma_warn_unused inline bool has_inf() const; arma_warn_unused inline bool has_nan() const; arma_warn_unused inline bool has_nonfinite() const; inline eT at_alt (const uword i) const; inline eT& operator[](const uword i); inline eT operator[](const uword i) const; inline eT& operator()(const uword i); inline eT operator()(const uword i) const; arma_inline eT& operator()(const uword in_row, const uword in_col, const uword in_slice); arma_inline eT operator()(const uword in_row, const uword in_col, const uword in_slice) const; arma_inline eT& at(const uword in_row, const uword in_col, const uword in_slice); arma_inline eT at(const uword in_row, const uword in_col, const uword in_slice) const; arma_inline eT* slice_colptr(const uword in_slice, const uword in_col); arma_inline const eT* slice_colptr(const uword in_slice, const uword in_col) const; template inline bool check_overlap(const subview_cube& x) const; inline bool check_overlap(const Mat& x) const; class const_iterator; class iterator { public: inline iterator(); inline iterator(const iterator& X); inline iterator(subview_cube& in_sv, const uword in_row, const uword in_col, const uword in_slice); arma_warn_unused inline eT& operator*(); inline iterator& operator++(); arma_warn_unused inline iterator operator++(int); arma_warn_unused inline bool operator==(const iterator& rhs) const; arma_warn_unused inline bool operator!=(const iterator& rhs) const; arma_warn_unused inline bool operator==(const const_iterator& rhs) const; arma_warn_unused inline bool operator!=(const const_iterator& rhs) const; typedef std::forward_iterator_tag iterator_category; typedef eT value_type; typedef std::ptrdiff_t difference_type; // TODO: not certain on this one typedef eT* pointer; typedef eT& reference; arma_aligned Cube* M; arma_aligned eT* current_ptr; arma_aligned uword current_row; arma_aligned uword current_col; arma_aligned uword current_slice; arma_aligned const uword aux_row1; arma_aligned const uword aux_col1; arma_aligned const uword aux_row2_p1; arma_aligned const uword aux_col2_p1; }; class const_iterator { public: inline const_iterator(); inline const_iterator(const iterator& X); inline const_iterator(const const_iterator& X); inline const_iterator(const subview_cube& in_sv, const uword in_row, const uword in_col, const uword in_slice); arma_warn_unused inline const eT& operator*(); inline const_iterator& operator++(); arma_warn_unused inline const_iterator operator++(int); arma_warn_unused inline bool operator==(const iterator& rhs) const; arma_warn_unused inline bool operator!=(const iterator& rhs) const; arma_warn_unused inline bool operator==(const const_iterator& rhs) const; arma_warn_unused inline bool operator!=(const const_iterator& rhs) const; // So that we satisfy the STL iterator types. typedef std::forward_iterator_tag iterator_category; typedef eT value_type; typedef std::ptrdiff_t difference_type; // TODO: not certain on this one typedef const eT* pointer; typedef const eT& reference; arma_aligned const Cube* M; arma_aligned const eT* current_ptr; arma_aligned uword current_row; arma_aligned uword current_col; arma_aligned uword current_slice; arma_aligned const uword aux_row1; arma_aligned const uword aux_col1; arma_aligned const uword aux_row2_p1; arma_aligned const uword aux_col2_p1; }; inline iterator begin(); inline const_iterator begin() const; inline const_iterator cbegin() const; inline iterator end(); inline const_iterator end() const; inline const_iterator cend() const; friend class Mat; friend class Cube; }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_any_bones.hpp0000644000176200001440000000443014752446051023565 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_any //! @{ class op_any : public traits_op_xvec { public: template static inline bool any_vec_helper(const Base& X); template static inline bool any_vec_helper(const subview& X); template static inline bool any_vec_helper(const Op& X); template static inline bool any_vec_helper ( const mtOp& X, const typename arma_op_rel_only::result* junk1 = nullptr, const typename arma_not_cx::result* junk2 = nullptr ); template static inline bool any_vec_helper ( const mtGlue& X, const typename arma_glue_rel_only::result* junk1 = nullptr, const typename arma_not_cx::result* junk2 = nullptr, const typename arma_not_cx::result* junk3 = nullptr ); template static inline bool any_vec(T1& X); template static inline void apply_mat_noalias(Mat& out, const Mat& X, const uword dim); template static inline void apply_proxy_noalias(Mat& out, const Proxy& P, const uword dim); template static inline void apply(Mat& out, const mtOp& X); }; //! @} RcppArmadillo/inst/include/armadillo_bits/operator_minus.hpp0000644000176200001440000002534114713753317024167 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup operator_minus //! @{ //! unary - template arma_inline typename enable_if2< is_arma_type::value, const eOp >::result operator- (const T1& X) { arma_debug_sigprint(); return eOp(X); } // //! unary - // template // arma_inline // typename // enable_if2< (is_arma_type::value && is_signed::value), const eOp >::result // operator- // (const T1& X) // { // arma_debug_sigprint(); // // return eOp(X); // } // // // // template // arma_inline // typename enable_if2< (is_arma_type::value && (is_signed::value == false)), const eOp >::result // operator- // (const T1& X) // { // arma_debug_sigprint(); // // typedef typename T1::elem_type eT; // // return eOp(X, eT(-1)); // } //! Base - scalar template arma_inline typename enable_if2< is_arma_type::value, const eOp >::result operator- ( const T1& X, const typename T1::elem_type k ) { arma_debug_sigprint(); return eOp(X, k); } //! scalar - Base template arma_inline typename enable_if2< is_arma_type::value, const eOp >::result operator- ( const typename T1::elem_type k, const T1& X ) { arma_debug_sigprint(); return eOp(X, k); } //! complex scalar - non-complex Base template arma_inline typename enable_if2 < (is_arma_type::value && is_cx::no), const mtOp, T1, op_cx_scalar_minus_pre> >::result operator- ( const std::complex& k, const T1& X ) { arma_debug_sigprint(); return mtOp, T1, op_cx_scalar_minus_pre>('j', X, k); } //! non-complex Base - complex scalar template arma_inline typename enable_if2 < (is_arma_type::value && is_cx::no), const mtOp, T1, op_cx_scalar_minus_post> >::result operator- ( const T1& X, const std::complex& k ) { arma_debug_sigprint(); return mtOp, T1, op_cx_scalar_minus_post>('j', X, k); } //! subtraction of Base objects with same element type template arma_inline typename enable_if2 < is_arma_type::value && is_arma_type::value && is_same_type::value, const eGlue >::result operator- ( const T1& X, const T2& Y ) { arma_debug_sigprint(); return eGlue(X, Y); } //! subtraction of Base objects with different element types template inline typename enable_if2 < (is_arma_type::value && is_arma_type::value && (is_same_type::no)), const mtGlue::result, T1, T2, glue_mixed_minus> >::result operator- ( const T1& X, const T2& Y ) { arma_debug_sigprint(); typedef typename T1::elem_type eT1; typedef typename T2::elem_type eT2; typedef typename promote_type::result out_eT; promote_type::check(); return mtGlue( X, Y ); } //! unary "-" for sparse objects template inline typename enable_if2 < is_arma_sparse_type::value && is_signed::value, SpOp >::result operator- (const T1& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; return SpOp(X, eT(-1)); } //! subtraction of two sparse objects template inline typename enable_if2 < (is_arma_sparse_type::value && is_arma_sparse_type::value && is_same_type::value), const SpGlue >::result operator- ( const T1& X, const T2& Y ) { arma_debug_sigprint(); return SpGlue(X,Y); } //! subtraction of one sparse and one dense object template inline typename enable_if2 < (is_arma_sparse_type::value && is_arma_type::value && is_same_type::value), Mat >::result operator- ( const T1& x, const T2& y ) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const SpProxy pa(x); const quasi_unwrap UB(y); const Mat& B = UB.M; Mat result = -B; arma_conform_assert_same_size( pa.get_n_rows(), pa.get_n_cols(), result.n_rows, result.n_cols, "subtraction" ); typename SpProxy::const_iterator_type it = pa.begin(); typename SpProxy::const_iterator_type it_end = pa.end(); for(; it != it_end; ++it) { const uword r = it.row(); const uword c = it.col(); result.at(r, c) = (*it) - B.at(r,c); } return result; } //! subtraction of one dense and one sparse object template inline typename enable_if2 < (is_arma_type::value && is_arma_sparse_type::value && is_same_type::value), Mat >::result operator- ( const T1& x, const T2& y ) { arma_debug_sigprint(); Mat result(x); const SpProxy pb(y); arma_conform_assert_same_size( result.n_rows, result.n_cols, pb.get_n_rows(), pb.get_n_cols(), "subtraction" ); typename SpProxy::const_iterator_type it = pb.begin(); typename SpProxy::const_iterator_type it_end = pb.end(); while(it != it_end) { result.at(it.row(), it.col()) -= (*it); ++it; } return result; } //! subtraction of two sparse objects with different element types template inline typename enable_if2 < (is_arma_sparse_type::value && is_arma_sparse_type::value && is_same_type::no), const mtSpGlue< typename promote_type::result, T1, T2, spglue_minus_mixed > >::result operator- ( const T1& X, const T2& Y ) { arma_debug_sigprint(); typedef typename T1::elem_type eT1; typedef typename T2::elem_type eT2; typedef typename promote_type::result out_eT; promote_type::check(); return mtSpGlue( X, Y ); } //! subtraction of sparse and non-sparse objects with different element types template inline typename enable_if2 < (is_arma_sparse_type::value && is_arma_type::value && is_same_type::no), Mat< typename promote_type::result > >::result operator- ( const T1& x, const T2& y ) { arma_debug_sigprint(); Mat< typename promote_type::result > out; spglue_minus_mixed::sparse_minus_dense(out, x, y); return out; } //! subtraction of sparse and non-sparse objects with different element types template inline typename enable_if2 < (is_arma_type::value && is_arma_sparse_type::value && is_same_type::no), Mat< typename promote_type::result > >::result operator- ( const T1& x, const T2& y ) { arma_debug_sigprint(); Mat< typename promote_type::result > out; spglue_minus_mixed::dense_minus_sparse(out, x, y); return out; } //! sparse - scalar template arma_inline typename enable_if2< is_arma_sparse_type::value, const SpToDOp >::result operator- ( const T1& X, const typename T1::elem_type k ) { arma_debug_sigprint(); return SpToDOp(X, k); } //! scalar - sparse template arma_inline typename enable_if2< is_arma_sparse_type::value, const SpToDOp >::result operator- ( const typename T1::elem_type k, const T1& X ) { arma_debug_sigprint(); return SpToDOp(X, k); } template arma_inline Mat operator- ( const subview_each1& X, const Base& Y ) { arma_debug_sigprint(); return subview_each1_aux::operator_minus(X, Y.get_ref()); } template arma_inline Mat operator- ( const Base& X, const subview_each1& Y ) { arma_debug_sigprint(); return subview_each1_aux::operator_minus(X.get_ref(), Y); } template arma_inline Mat operator- ( const subview_each2& X, const Base& Y ) { arma_debug_sigprint(); return subview_each2_aux::operator_minus(X, Y.get_ref()); } template arma_inline Mat operator- ( const Base& X, const subview_each2& Y ) { arma_debug_sigprint(); return subview_each2_aux::operator_minus(X.get_ref(), Y); } //! @} RcppArmadillo/inst/include/armadillo_bits/op_repelem_bones.hpp0000644000176200001440000000225314301267043024420 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_repelem //! @{ class op_repelem : public traits_op_default { public: template inline static void apply_noalias(Mat& out, const obj& X, const uword copies_per_row, const uword copies_per_col); template inline static void apply(Mat& out, const Op& in); }; //! @} RcppArmadillo/inst/include/armadillo_bits/glue_relational_meat.hpp0000644000176200001440000001745614631567470025307 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup glue_relational //! @{ #undef operator_rel #undef operator_str #undef arma_applier_mat #undef arma_applier_cube #define arma_applier_mat(operator_rel, operator_str) \ {\ const Proxy P1(X.A);\ const Proxy P2(X.B);\ \ arma_conform_assert_same_size(P1, P2, operator_str);\ \ const bool bad_alias = (Proxy::has_subview && P1.is_alias(out)) || (Proxy::has_subview && P2.is_alias(out));\ \ if(bad_alias == false)\ {\ \ const uword n_rows = P1.get_n_rows();\ const uword n_cols = P1.get_n_cols();\ \ out.set_size(n_rows, n_cols);\ \ uword* out_mem = out.memptr();\ \ constexpr bool use_at = (Proxy::use_at || Proxy::use_at);\ \ if(use_at == false)\ {\ typename Proxy::ea_type A = P1.get_ea();\ typename Proxy::ea_type B = P2.get_ea();\ \ const uword n_elem = out.n_elem;\ \ for(uword i=0; i::stored_type> tmp1(P1.Q, P1.is_alias(out));\ const unwrap_check::stored_type> tmp2(P2.Q, P2.is_alias(out));\ \ out = (tmp1.M) operator_rel (tmp2.M);\ }\ } #define arma_applier_cube(operator_rel, operator_str) \ {\ const ProxyCube P1(X.A);\ const ProxyCube P2(X.B);\ \ arma_conform_assert_same_size(P1, P2, operator_str);\ \ const bool bad_alias = (ProxyCube::has_subview && P1.is_alias(out)) || (ProxyCube::has_subview && P2.is_alias(out));\ \ if(bad_alias == false)\ {\ \ const uword n_rows = P1.get_n_rows();\ const uword n_cols = P1.get_n_cols();\ const uword n_slices = P1.get_n_slices();\ \ out.set_size(n_rows, n_cols, n_slices);\ \ uword* out_mem = out.memptr();\ \ constexpr bool use_at = (ProxyCube::use_at || ProxyCube::use_at);\ \ if(use_at == false)\ {\ typename ProxyCube::ea_type A = P1.get_ea();\ typename ProxyCube::ea_type B = P2.get_ea();\ \ const uword n_elem = out.n_elem;\ \ for(uword i=0; i::stored_type> tmp1(P1.Q);\ const unwrap_cube::stored_type> tmp2(P2.Q);\ \ out = (tmp1.M) operator_rel (tmp2.M);\ }\ } template inline void glue_rel_lt::apply ( Mat & out, const mtGlue& X ) { arma_debug_sigprint(); arma_applier_mat(<, "operator<"); } template inline void glue_rel_gt::apply ( Mat & out, const mtGlue& X ) { arma_debug_sigprint(); arma_applier_mat(>, "operator>"); } template inline void glue_rel_lteq::apply ( Mat & out, const mtGlue& X ) { arma_debug_sigprint(); arma_applier_mat(<=, "operator<="); } template inline void glue_rel_gteq::apply ( Mat & out, const mtGlue& X ) { arma_debug_sigprint(); arma_applier_mat(>=, "operator>="); } template inline void glue_rel_eq::apply ( Mat & out, const mtGlue& X ) { arma_debug_sigprint(); arma_applier_mat(==, "operator=="); } template inline void glue_rel_noteq::apply ( Mat & out, const mtGlue& X ) { arma_debug_sigprint(); arma_applier_mat(!=, "operator!="); } template inline void glue_rel_and::apply ( Mat & out, const mtGlue& X ) { arma_debug_sigprint(); arma_applier_mat(&&, "operator&&"); } template inline void glue_rel_or::apply ( Mat & out, const mtGlue& X ) { arma_debug_sigprint(); arma_applier_mat(||, "operator||"); } // // // template inline void glue_rel_lt::apply ( Cube & out, const mtGlueCube& X ) { arma_debug_sigprint(); arma_applier_cube(<, "operator<"); } template inline void glue_rel_gt::apply ( Cube & out, const mtGlueCube& X ) { arma_debug_sigprint(); arma_applier_cube(>, "operator>"); } template inline void glue_rel_lteq::apply ( Cube & out, const mtGlueCube& X ) { arma_debug_sigprint(); arma_applier_cube(<=, "operator<="); } template inline void glue_rel_gteq::apply ( Cube & out, const mtGlueCube& X ) { arma_debug_sigprint(); arma_applier_cube(>=, "operator>="); } template inline void glue_rel_eq::apply ( Cube & out, const mtGlueCube& X ) { arma_debug_sigprint(); arma_applier_cube(==, "operator=="); } template inline void glue_rel_noteq::apply ( Cube & out, const mtGlueCube& X ) { arma_debug_sigprint(); arma_applier_cube(!=, "operator!="); } template inline void glue_rel_and::apply ( Cube & out, const mtGlueCube& X ) { arma_debug_sigprint(); arma_applier_cube(&&, "operator&&"); } template inline void glue_rel_or::apply ( Cube & out, const mtGlueCube& X ) { arma_debug_sigprint(); arma_applier_cube(||, "operator||"); } #undef arma_applier_mat #undef arma_applier_cube //! @} RcppArmadillo/inst/include/armadillo_bits/mul_syrk.hpp0000644000176200001440000003062714654406643022772 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup syrk //! @{ class syrk_helper { public: template inline static void inplace_copy_upper_tri_to_lower_tri(Mat& C) { // under the assumption that C is a square matrix const uword N = C.n_rows; for(uword k=0; k < N; ++k) { eT* colmem = C.colptr(k); uword i, j; for(i=(k+1), j=(k+2); j < N; i+=2, j+=2) { const eT tmp_i = C.at(k,i); const eT tmp_j = C.at(k,j); colmem[i] = tmp_i; colmem[j] = tmp_j; } if(i < N) { colmem[i] = C.at(k,i); } } } }; //! partial emulation of BLAS function syrk(), specialised for A being a vector template class syrk_vec { public: template arma_hot inline static void apply ( Mat& C, const TA& A, const eT alpha = eT(1), const eT beta = eT(0) ) { arma_debug_sigprint(); const uword A_n1 = (do_trans_A == false) ? A.n_rows : A.n_cols; const uword A_n2 = (do_trans_A == false) ? A.n_cols : A.n_rows; const eT* A_mem = A.memptr(); if(A_n1 == 1) { const eT acc1 = op_dot::direct_dot(A_n2, A_mem, A_mem); if( (use_alpha == false) && (use_beta == false) ) { C[0] = acc1; } else if( (use_alpha == true ) && (use_beta == false) ) { C[0] = alpha*acc1; } else if( (use_alpha == false) && (use_beta == true ) ) { C[0] = acc1 + beta*C[0]; } else if( (use_alpha == true ) && (use_beta == true ) ) { C[0] = alpha*acc1 + beta*C[0]; } } else for(uword k=0; k < A_n1; ++k) { const eT A_k = A_mem[k]; uword i,j; for(i=(k), j=(k+1); j < A_n1; i+=2, j+=2) { const eT acc1 = A_k * A_mem[i]; const eT acc2 = A_k * A_mem[j]; if( (use_alpha == false) && (use_beta == false) ) { C.at(k, i) = acc1; C.at(k, j) = acc2; C.at(i, k) = acc1; C.at(j, k) = acc2; } else if( (use_alpha == true ) && (use_beta == false) ) { const eT val1 = alpha*acc1; const eT val2 = alpha*acc2; C.at(k, i) = val1; C.at(k, j) = val2; C.at(i, k) = val1; C.at(j, k) = val2; } else if( (use_alpha == false) && (use_beta == true) ) { C.at(k, i) = acc1 + beta*C.at(k, i); C.at(k, j) = acc2 + beta*C.at(k, j); if(i != k) { C.at(i, k) = acc1 + beta*C.at(i, k); } C.at(j, k) = acc2 + beta*C.at(j, k); } else if( (use_alpha == true ) && (use_beta == true) ) { const eT val1 = alpha*acc1; const eT val2 = alpha*acc2; C.at(k, i) = val1 + beta*C.at(k, i); C.at(k, j) = val2 + beta*C.at(k, j); if(i != k) { C.at(i, k) = val1 + beta*C.at(i, k); } C.at(j, k) = val2 + beta*C.at(j, k); } } if(i < A_n1) { const eT acc1 = A_k * A_mem[i]; if( (use_alpha == false) && (use_beta == false) ) { C.at(k, i) = acc1; C.at(i, k) = acc1; } else if( (use_alpha == true) && (use_beta == false) ) { const eT val1 = alpha*acc1; C.at(k, i) = val1; C.at(i, k) = val1; } else if( (use_alpha == false) && (use_beta == true) ) { C.at(k, i) = acc1 + beta*C.at(k, i); if(i != k) { C.at(i, k) = acc1 + beta*C.at(i, k); } } else if( (use_alpha == true) && (use_beta == true) ) { const eT val1 = alpha*acc1; C.at(k, i) = val1 + beta*C.at(k, i); if(i != k) { C.at(i, k) = val1 + beta*C.at(i, k); } } } } } }; //! partial emulation of BLAS function syrk() template class syrk_emul { public: template arma_hot inline static void apply ( Mat& C, const TA& A, const eT alpha = eT(1), const eT beta = eT(0) ) { arma_debug_sigprint(); // do_trans_A == false -> C = alpha * A * A^T + beta*C // do_trans_A == true -> C = alpha * A^T * A + beta*C if(do_trans_A == false) { Mat AA; op_strans::apply_mat_noalias(AA, A); syrk_emul::apply(C, AA, alpha, beta); } else if(do_trans_A == true) { const uword A_n_rows = A.n_rows; const uword A_n_cols = A.n_cols; for(uword col_A=0; col_A < A_n_cols; ++col_A) { // col_A is interpreted as row_A when storing the results in matrix C const eT* A_coldata = A.colptr(col_A); for(uword k=col_A; k < A_n_cols; ++k) { const eT acc = op_dot::direct_dot_arma(A_n_rows, A_coldata, A.colptr(k)); if( (use_alpha == false) && (use_beta == false) ) { C.at(col_A, k) = acc; C.at(k, col_A) = acc; } else if( (use_alpha == true ) && (use_beta == false) ) { const eT val = alpha*acc; C.at(col_A, k) = val; C.at(k, col_A) = val; } else if( (use_alpha == false) && (use_beta == true ) ) { C.at(col_A, k) = acc + beta*C.at(col_A, k); if(col_A != k) { C.at(k, col_A) = acc + beta*C.at(k, col_A); } } else if( (use_alpha == true ) && (use_beta == true ) ) { const eT val = alpha*acc; C.at(col_A, k) = val + beta*C.at(col_A, k); if(col_A != k) { C.at(k, col_A) = val + beta*C.at(k, col_A); } } } } } } }; template class syrk { public: template inline static void apply_blas_type( Mat& C, const TA& A, const eT alpha = eT(1), const eT beta = eT(0) ) { arma_debug_sigprint(); if(A.is_vec()) { // work around poor handling of vectors by syrk() in standard BLAS syrk_vec::apply(C,A,alpha,beta); return; } const uword threshold = (is_cx::yes ? 16u : 48u); if( A.n_elem <= threshold ) { syrk_emul::apply(C,A,alpha,beta); } else { #if defined(ARMA_USE_ATLAS) { if(use_beta == true) { // use a temporary matrix, as we can't assume that matrix C is already symmetric Mat D(C.n_rows, C.n_cols, arma_nozeros_indicator()); syrk::apply_blas_type(D,A,alpha); // NOTE: assuming beta=1; this is okay for now, as currently glue_times only uses beta=1 arrayops::inplace_plus(C.memptr(), D.memptr(), C.n_elem); return; } atlas::cblas_syrk ( atlas_CblasColMajor, atlas_CblasUpper, (do_trans_A) ? atlas_CblasTrans : atlas_CblasNoTrans, C.n_cols, (do_trans_A) ? A.n_rows : A.n_cols, (use_alpha) ? alpha : eT(1), A.mem, (do_trans_A) ? A.n_rows : C.n_cols, (use_beta) ? beta : eT(0), C.memptr(), C.n_cols ); syrk_helper::inplace_copy_upper_tri_to_lower_tri(C); } #elif defined(ARMA_USE_BLAS) { if(use_beta == true) { // use a temporary matrix, as we can't assume that matrix C is already symmetric Mat D(C.n_rows, C.n_cols, arma_nozeros_indicator()); syrk::apply_blas_type(D,A,alpha); // NOTE: assuming beta=1; this is okay for now, as currently glue_times only uses beta=1 arrayops::inplace_plus(C.memptr(), D.memptr(), C.n_elem); return; } arma_debug_print("blas::syrk()"); const char uplo = 'U'; const char trans_A = (do_trans_A) ? 'T' : 'N'; const blas_int n = blas_int(C.n_cols); const blas_int k = (do_trans_A) ? blas_int(A.n_rows) : blas_int(A.n_cols); const eT local_alpha = (use_alpha) ? alpha : eT(1); const eT local_beta = (use_beta) ? beta : eT(0); const blas_int lda = (do_trans_A) ? k : n; arma_debug_print( arma_str::format("blas::syrk(): trans_A: %c") % trans_A ); blas::syrk ( &uplo, &trans_A, &n, &k, &local_alpha, A.mem, &lda, &local_beta, C.memptr(), &n // &ldc ); syrk_helper::inplace_copy_upper_tri_to_lower_tri(C); } #else { syrk_emul::apply(C,A,alpha,beta); } #endif } } template inline static void apply( Mat& C, const TA& A, const eT alpha = eT(1), const eT beta = eT(0) ) { if(is_cx::no) { if(A.is_vec()) { syrk_vec::apply(C,A,alpha,beta); } else { syrk_emul::apply(C,A,alpha,beta); } } else { // handling of complex matrix by syrk_emul() is not yet implemented return; } } template arma_inline static void apply ( Mat& C, const TA& A, const float alpha = float(1), const float beta = float(0) ) { syrk::apply_blas_type(C,A,alpha,beta); } template arma_inline static void apply ( Mat& C, const TA& A, const double alpha = double(1), const double beta = double(0) ) { syrk::apply_blas_type(C,A,alpha,beta); } template arma_inline static void apply ( Mat< std::complex >& C, const TA& A, const std::complex alpha = std::complex(1), const std::complex beta = std::complex(0) ) { arma_ignore(C); arma_ignore(A); arma_ignore(alpha); arma_ignore(beta); // handling of complex matrix by syrk() is not yet implemented return; } template arma_inline static void apply ( Mat< std::complex >& C, const TA& A, const std::complex alpha = std::complex(1), const std::complex beta = std::complex(0) ) { arma_ignore(C); arma_ignore(A); arma_ignore(alpha); arma_ignore(beta); // handling of complex matrix by syrk() is not yet implemented return; } }; //! @} RcppArmadillo/inst/include/armadillo_bits/running_stat_meat.hpp0000644000176200001440000002040615030507611024622 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup running_stat //! @{ template inline arma_counter::~arma_counter() { arma_debug_sigprint_this(this); } template inline arma_counter::arma_counter() : d_count( eT(0)) , i_count(uword(0)) { arma_debug_sigprint_this(this); } template inline const arma_counter& arma_counter::operator++() { if(i_count < ARMA_MAX_UWORD) { i_count++; } else { d_count += eT(ARMA_MAX_UWORD); i_count = 1; } return *this; } template inline void arma_counter::operator++(int) { operator++(); } template inline void arma_counter::reset() { d_count = eT(0); i_count = uword(0); } template inline eT arma_counter::value() const { return d_count + eT(i_count); } template inline eT arma_counter::value_plus_1() const { if(i_count < ARMA_MAX_UWORD) { return d_count + eT(i_count + 1); } else { return d_count + eT(ARMA_MAX_UWORD) + eT(1); } } template inline eT arma_counter::value_minus_1() const { if(i_count > 0) { return d_count + eT(i_count - 1); } else { return d_count - eT(1); } } // template inline running_stat::~running_stat() { arma_debug_sigprint_this(this); } template inline running_stat::running_stat() : r_mean ( eT(0)) , r_var (typename running_stat::T(0)) , min_val ( eT(0)) , max_val ( eT(0)) , min_val_norm(typename running_stat::T(0)) , max_val_norm(typename running_stat::T(0)) { arma_debug_sigprint_this(this); } //! update statistics to reflect new sample template inline void running_stat::operator() (const typename running_stat::T sample) { arma_debug_sigprint(); if(arma_isnonfinite(sample)) { arma_warn(3, "running_stat: non-finite sample ignored" ); return; } running_stat_aux::update_stats(*this, sample); } //! update statistics to reflect new sample (version for complex numbers) template inline void running_stat::operator() (const std::complex< typename running_stat::T >& sample) { arma_debug_sigprint(); if(arma_isnonfinite(sample)) { arma_warn(3, "running_stat: non-finite sample ignored" ); return; } running_stat_aux::update_stats(*this, sample); } //! set all statistics to zero template inline void running_stat::reset() { arma_debug_sigprint(); // typedef typename running_stat::T T; counter.reset(); r_mean = eT(0); r_var = T(0); min_val = eT(0); max_val = eT(0); min_val_norm = T(0); max_val_norm = T(0); } //! mean or average value template inline eT running_stat::mean() const { arma_debug_sigprint(); return r_mean; } //! variance template inline typename running_stat::T running_stat::var(const uword norm_type) const { arma_debug_sigprint(); const T N = counter.value(); if(N > T(1)) { if(norm_type == 0) { return r_var; } else { const T N_minus_1 = counter.value_minus_1(); return (N_minus_1/N) * r_var; } } else { return T(0); } } //! standard deviation template inline typename running_stat::T running_stat::stddev(const uword norm_type) const { arma_debug_sigprint(); return std::sqrt( (*this).var(norm_type) ); } //! minimum value template inline eT running_stat::min() const { arma_debug_sigprint(); return min_val; } //! maximum value template inline eT running_stat::max() const { arma_debug_sigprint(); return max_val; } template inline eT running_stat::range() const { arma_debug_sigprint(); return (max_val - min_val); } //! number of samples so far template inline typename get_pod_type::result running_stat::count() const { arma_debug_sigprint(); return counter.value(); } //! update statistics to reflect new sample (version for non-complex numbers, non-complex sample) template inline void running_stat_aux::update_stats(running_stat& x, const eT sample, const typename arma_not_cx::result* junk) { arma_debug_sigprint(); arma_ignore(junk); typedef typename running_stat::T T; const T N = x.counter.value(); if(N > T(0)) { if(sample < x.min_val) { x.min_val = sample; } if(sample > x.max_val) { x.max_val = sample; } const T N_plus_1 = x.counter.value_plus_1(); const T N_minus_1 = x.counter.value_minus_1(); // note: variance has to be updated before the mean const eT tmp = sample - x.r_mean; x.r_var = N_minus_1/N * x.r_var + (tmp*tmp)/N_plus_1; x.r_mean = x.r_mean + (sample - x.r_mean)/N_plus_1; //x.r_mean = (N/N_plus_1)*x.r_mean + sample/N_plus_1; //x.r_mean = (x.r_mean + sample/N) * N/N_plus_1; } else { x.r_mean = sample; x.min_val = sample; x.max_val = sample; // r_var is initialised to zero // in the constructor and reset() } x.counter++; } //! update statistics to reflect new sample (version for non-complex numbers, complex sample) template inline void running_stat_aux::update_stats(running_stat& x, const std::complex& sample, const typename arma_not_cx::result* junk) { arma_debug_sigprint(); arma_ignore(junk); running_stat_aux::update_stats(x, std::real(sample)); } //! update statistics to reflect new sample (version for complex numbers, non-complex sample) template inline void running_stat_aux::update_stats(running_stat& x, const typename eT::value_type sample, const typename arma_cx_only::result* junk) { arma_debug_sigprint(); arma_ignore(junk); typedef typename eT::value_type T; running_stat_aux::update_stats(x, std::complex(sample)); } //! alter statistics to reflect new sample (version for complex numbers, complex sample) template inline void running_stat_aux::update_stats(running_stat& x, const eT& sample, const typename arma_cx_only::result* junk) { arma_debug_sigprint(); arma_ignore(junk); typedef typename eT::value_type T; const T sample_norm = std::norm(sample); const T N = x.counter.value(); if(N > T(0)) { if(sample_norm < x.min_val_norm) { x.min_val_norm = sample_norm; x.min_val = sample; } if(sample_norm > x.max_val_norm) { x.max_val_norm = sample_norm; x.max_val = sample; } const T N_plus_1 = x.counter.value_plus_1(); const T N_minus_1 = x.counter.value_minus_1(); x.r_var = N_minus_1/N * x.r_var + std::norm(sample - x.r_mean)/N_plus_1; x.r_mean = x.r_mean + (sample - x.r_mean)/N_plus_1; //x.r_mean = (N/N_plus_1)*x.r_mean + sample/N_plus_1; //x.r_mean = (x.r_mean + sample/N) * N/N_plus_1; } else { x.r_mean = sample; x.min_val = sample; x.max_val = sample; x.min_val_norm = sample_norm; x.max_val_norm = sample_norm; // r_var is initialised to zero // in the constructor and reset() } x.counter++; } //! @} RcppArmadillo/inst/include/armadillo_bits/glue_powext_meat.hpp0000644000176200001440000003562314631567470024477 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup glue_powext //! @{ template inline void glue_powext::apply(Mat& out, const Glue& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const quasi_unwrap UA(X.A); const quasi_unwrap UB(X.B); const Mat& A = UA.M; const Mat& B = UB.M; arma_conform_assert_same_size(A, B, "element-wise pow()"); const bool UA_bad_alias = UA.is_alias(out) && (UA.has_subview); // allow inplace operation const bool UB_bad_alias = UB.is_alias(out); if(UA_bad_alias || UB_bad_alias) { Mat tmp; glue_powext::apply(tmp, A, B); out.steal_mem(tmp); } else { glue_powext::apply(out, A, B); } } template inline void glue_powext::apply(Mat& out, const Mat& A, const Mat& B) { arma_debug_sigprint(); out.set_size(A.n_rows, A.n_cols); const uword N = out.n_elem; eT* out_mem = out.memptr(); const eT* A_mem = A.memptr(); const eT* B_mem = B.memptr(); if( arma_config::openmp && mp_gate::eval(N) ) { #if defined(ARMA_USE_OPENMP) { const int n_threads = mp_thread_limit::get(); #pragma omp parallel for schedule(static) num_threads(n_threads) for(uword i=0; i inline Mat glue_powext::apply ( const subview_each1& X, const Base& Y ) { arma_debug_sigprint(); typedef typename parent::elem_type eT; const parent& A = X.P; const uword A_n_rows = A.n_rows; const uword A_n_cols = A.n_cols; Mat out(A_n_rows, A_n_cols, arma_nozeros_indicator()); const quasi_unwrap tmp(Y.get_ref()); const Mat& B = tmp.M; X.check_size(B); const eT* B_mem = B.memptr(); if(mode == 0) // each column { if( arma_config::openmp && mp_gate::eval(A.n_elem) ) { #if defined(ARMA_USE_OPENMP) { const int n_threads = int( (std::min)(uword(mp_thread_limit::get()), A_n_cols) ); #pragma omp parallel for schedule(static) num_threads(n_threads) for(uword i=0; i < A_n_cols; ++i) { const eT* A_mem = A.colptr(i); eT* out_mem = out.colptr(i); for(uword row=0; row < A_n_rows; ++row) { out_mem[row] = eop_aux::pow(A_mem[row], B_mem[row]); } } } #endif } else { for(uword i=0; i < A_n_cols; ++i) { const eT* A_mem = A.colptr(i); eT* out_mem = out.colptr(i); for(uword row=0; row < A_n_rows; ++row) { out_mem[row] = eop_aux::pow(A_mem[row], B_mem[row]); } } } } if(mode == 1) // each row { if( arma_config::openmp && mp_gate::eval(A.n_elem) ) { #if defined(ARMA_USE_OPENMP) { const int n_threads = int( (std::min)(uword(mp_thread_limit::get()), A_n_cols) ); #pragma omp parallel for schedule(static) num_threads(n_threads) for(uword i=0; i < A_n_cols; ++i) { const eT* A_mem = A.colptr(i); eT* out_mem = out.colptr(i); const eT B_val = B_mem[i]; for(uword row=0; row < A_n_rows; ++row) { out_mem[row] = eop_aux::pow(A_mem[row], B_val); } } } #endif } else { for(uword i=0; i < A_n_cols; ++i) { const eT* A_mem = A.colptr(i); eT* out_mem = out.colptr(i); const eT B_val = B_mem[i]; for(uword row=0; row < A_n_rows; ++row) { out_mem[row] = eop_aux::pow(A_mem[row], B_val); } } } } return out; } template inline void glue_powext::apply(Cube& out, const GlueCube& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const unwrap_cube UA(X.A); const unwrap_cube UB(X.B); const Cube& A = UA.M; const Cube& B = UB.M; arma_conform_assert_same_size(A, B, "element-wise pow()"); if(UB.is_alias(out)) { Cube tmp; glue_powext::apply(tmp, A, B); out.steal_mem(tmp); } else { glue_powext::apply(out, A, B); } } template inline void glue_powext::apply(Cube& out, const Cube& A, const Cube& B) { arma_debug_sigprint(); out.set_size(A.n_rows, A.n_cols, A.n_slices); const uword N = out.n_elem; eT* out_mem = out.memptr(); const eT* A_mem = A.memptr(); const eT* B_mem = B.memptr(); if( arma_config::openmp && mp_gate::eval(N) ) { #if defined(ARMA_USE_OPENMP) { const int n_threads = mp_thread_limit::get(); #pragma omp parallel for schedule(static) num_threads(n_threads) for(uword i=0; i inline Cube glue_powext::apply ( const subview_cube_each1& X, const Base& Y ) { arma_debug_sigprint(); const Cube& A = X.P; const uword A_n_rows = A.n_rows; const uword A_n_cols = A.n_cols; const uword A_n_slices = A.n_slices; Cube out(A_n_rows, A_n_cols, A_n_slices, arma_nozeros_indicator()); const quasi_unwrap tmp(Y.get_ref()); const Mat& B = tmp.M; X.check_size(B); const eT* B_mem = B.memptr(); const uword B_n_elem = B.n_elem; if( arma_config::openmp && mp_gate::eval(A.n_elem) ) { #if defined(ARMA_USE_OPENMP) { const int n_threads = int( (std::min)(uword(mp_thread_limit::get()), A_n_slices) ); #pragma omp parallel for schedule(static) num_threads(n_threads) for(uword s=0; s < A_n_slices; ++s) { const eT* A_slice_mem = A.slice_memptr(s); eT* out_slice_mem = out.slice_memptr(s); for(uword i=0; i < B_n_elem; ++i) { out_slice_mem[i] = eop_aux::pow(A_slice_mem[i], B_mem[i]); } } } #endif } else { for(uword s=0; s < A_n_slices; ++s) { const eT* A_slice_mem = A.slice_memptr(s); eT* out_slice_mem = out.slice_memptr(s); for(uword i=0; i < B_n_elem; ++i) { out_slice_mem[i] = eop_aux::pow(A_slice_mem[i], B_mem[i]); } } } return out; } // template inline void glue_powext_cx::apply(Mat& out, const mtGlue& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; typedef typename T1::pod_type T; const quasi_unwrap UA(X.A); const quasi_unwrap UB(X.B); const Mat& A = UA.M; const Mat< T>& B = UB.M; arma_conform_assert_same_size(A, B, "element-wise pow()"); if(UA.is_alias(out) && (UA.has_subview)) { Mat tmp; glue_powext_cx::apply(tmp, A, B); out.steal_mem(tmp); } else { glue_powext_cx::apply(out, A, B); } } template inline void glue_powext_cx::apply(Mat< std::complex >& out, const Mat< std::complex >& A, const Mat& B) { arma_debug_sigprint(); typedef typename std::complex eT; out.set_size(A.n_rows, A.n_cols); const uword N = out.n_elem; eT* out_mem = out.memptr(); const eT* A_mem = A.memptr(); const T* B_mem = B.memptr(); if( arma_config::openmp && mp_gate::eval(N) ) { #if defined(ARMA_USE_OPENMP) { const int n_threads = mp_thread_limit::get(); #pragma omp parallel for schedule(static) num_threads(n_threads) for(uword i=0; i inline Mat glue_powext_cx::apply ( const subview_each1& X, const Base& Y ) { arma_debug_sigprint(); typedef typename parent::elem_type eT; typedef typename parent::pod_type T; const parent& A = X.P; const uword A_n_rows = A.n_rows; const uword A_n_cols = A.n_cols; Mat out(A_n_rows, A_n_cols, arma_nozeros_indicator()); const quasi_unwrap tmp(Y.get_ref()); const Mat& B = tmp.M; X.check_size(B); const T* B_mem = B.memptr(); if(mode == 0) // each column { if( arma_config::openmp && mp_gate::eval(A.n_elem) ) { #if defined(ARMA_USE_OPENMP) { const int n_threads = int( (std::min)(uword(mp_thread_limit::get()), A_n_cols) ); #pragma omp parallel for schedule(static) num_threads(n_threads) for(uword i=0; i < A_n_cols; ++i) { const eT* A_mem = A.colptr(i); eT* out_mem = out.colptr(i); for(uword row=0; row < A_n_rows; ++row) { out_mem[row] = std::pow(A_mem[row], B_mem[row]); } } } #endif } else { for(uword i=0; i < A_n_cols; ++i) { const eT* A_mem = A.colptr(i); eT* out_mem = out.colptr(i); for(uword row=0; row < A_n_rows; ++row) { out_mem[row] = std::pow(A_mem[row], B_mem[row]); } } } } if(mode == 1) // each row { if( arma_config::openmp && mp_gate::eval(A.n_elem) ) { #if defined(ARMA_USE_OPENMP) { const int n_threads = int( (std::min)(uword(mp_thread_limit::get()), A_n_cols) ); #pragma omp parallel for schedule(static) num_threads(n_threads) for(uword i=0; i < A_n_cols; ++i) { const eT* A_mem = A.colptr(i); eT* out_mem = out.colptr(i); const eT B_val = B_mem[i]; for(uword row=0; row < A_n_rows; ++row) { out_mem[row] = std::pow(A_mem[row], B_val); } } } #endif } else { for(uword i=0; i < A_n_cols; ++i) { const eT* A_mem = A.colptr(i); eT* out_mem = out.colptr(i); const eT B_val = B_mem[i]; for(uword row=0; row < A_n_rows; ++row) { out_mem[row] = std::pow(A_mem[row], B_val); } } } } return out; } template inline void glue_powext_cx::apply(Cube& out, const mtGlueCube& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; typedef typename get_pod_type::result T; const unwrap_cube UA(X.A); const unwrap_cube UB(X.B); const Cube& A = UA.M; const Cube< T>& B = UB.M; arma_conform_assert_same_size(A, B, "element-wise pow()"); glue_powext_cx::apply(out, A, B); } template inline void glue_powext_cx::apply(Cube< std::complex >& out, const Cube< std::complex >& A, const Cube& B) { arma_debug_sigprint(); typedef typename std::complex eT; out.set_size(A.n_rows, A.n_cols, A.n_slices); const uword N = out.n_elem; eT* out_mem = out.memptr(); const eT* A_mem = A.memptr(); const T* B_mem = B.memptr(); if( arma_config::openmp && mp_gate::eval(N) ) { #if defined(ARMA_USE_OPENMP) { const int n_threads = mp_thread_limit::get(); #pragma omp parallel for schedule(static) num_threads(n_threads) for(uword i=0; i inline Cube< std::complex > glue_powext_cx::apply ( const subview_cube_each1< std::complex >& X, const Base& Y ) { arma_debug_sigprint(); typedef typename std::complex eT; const Cube& A = X.P; const uword A_n_rows = A.n_rows; const uword A_n_cols = A.n_cols; const uword A_n_slices = A.n_slices; Cube out(A_n_rows, A_n_cols, A_n_slices, arma_nozeros_indicator()); const quasi_unwrap tmp(Y.get_ref()); const Mat& B = tmp.M; X.check_size(B); const T* B_mem = B.memptr(); const uword B_n_elem = B.n_elem; if( arma_config::openmp && mp_gate::eval(A.n_elem) ) { #if defined(ARMA_USE_OPENMP) { const int n_threads = int( (std::min)(uword(mp_thread_limit::get()), A_n_slices) ); #pragma omp parallel for schedule(static) num_threads(n_threads) for(uword s=0; s < A_n_slices; ++s) { const eT* A_slice_mem = A.slice_memptr(s); eT* out_slice_mem = out.slice_memptr(s); for(uword i=0; i < B_n_elem; ++i) { out_slice_mem[i] = std::pow(A_slice_mem[i], B_mem[i]); } } } #endif } else { for(uword s=0; s < A_n_slices; ++s) { const eT* A_slice_mem = A.slice_memptr(s); eT* out_slice_mem = out.slice_memptr(s); for(uword i=0; i < B_n_elem; ++i) { out_slice_mem[i] = std::pow(A_slice_mem[i], B_mem[i]); } } } return out; } //! @} RcppArmadillo/inst/include/armadillo_bits/CubeToMatOp_bones.hpp0000644000176200001440000000330014752446051024415 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup CubeToMatOp //! @{ template class CubeToMatOp : public Base< typename T1::elem_type, CubeToMatOp > { public: typedef typename T1::elem_type elem_type; typedef typename get_pod_type::result pod_type; inline explicit CubeToMatOp(const T1& in_m); inline CubeToMatOp(const T1& in_m, const uword in_aux_uword); inline ~CubeToMatOp(); const T1& m; //!< the operand; must be derived from BaseCube uword aux_uword; //!< auxiliary data, uword format template constexpr bool is_alias(const Mat&) const { return false; } static constexpr bool is_row = op_type::template traits::is_row; static constexpr bool is_col = op_type::template traits::is_col; static constexpr bool is_xvec = op_type::template traits::is_xvec; }; //! @} RcppArmadillo/inst/include/armadillo_bits/fn_size.hpp0000644000176200001440000001367114770765377022575 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_size //! @{ arma_warn_unused inline const SizeMat size(const uword n_rows, const uword n_cols) { arma_debug_sigprint(); return SizeMat(n_rows, n_cols); } template arma_warn_unused inline const SizeMat size(const Base& X) { arma_debug_sigprint(); const Proxy P(X.get_ref()); return SizeMat( P.get_n_rows(), P.get_n_cols() ); } // explicit overload to workaround ADL issues with C++17 std::size() template arma_warn_unused inline const SizeMat size(const Mat& X) { arma_debug_sigprint(); return SizeMat( X.n_rows, X.n_cols ); } // explicit overload to workaround ADL issues with C++17 std::size() template arma_warn_unused inline const SizeMat size(const Row& X) { arma_debug_sigprint(); return SizeMat( X.n_rows, X.n_cols ); } // explicit overload to workaround ADL issues with C++17 std::size() template arma_warn_unused inline const SizeMat size(const Col& X) { arma_debug_sigprint(); return SizeMat( X.n_rows, X.n_cols ); } arma_warn_unused inline const SizeMat size(const arma::span& row_span, const arma::span& col_span) { arma_debug_sigprint(); uword n_rows = 0; uword n_cols = 0; if(row_span.whole || col_span.whole) { arma_conform_check(true, "size(): span::all not supported"); } else { if((row_span.a > row_span.b) || (col_span.a > col_span.b)) { arma_conform_check_bounds(true, "size(): span indices incorrectly used"); } else { n_rows = row_span.b - row_span.a + 1; n_cols = col_span.b - col_span.a + 1; } } return SizeMat(n_rows, n_cols); } template arma_warn_unused inline uword size(const Base& X, const uword dim) { arma_debug_sigprint(); const Proxy P(X.get_ref()); return SizeMat( P.get_n_rows(), P.get_n_cols() )( dim ); } arma_warn_unused inline const SizeCube size(const uword n_rows, const uword n_cols, const uword n_slices) { arma_debug_sigprint(); return SizeCube(n_rows, n_cols, n_slices); } template arma_warn_unused inline const SizeCube size(const BaseCube& X) { arma_debug_sigprint(); const ProxyCube P(X.get_ref()); return SizeCube( P.get_n_rows(), P.get_n_cols(), P.get_n_slices() ); } // explicit overload to workaround ADL issues with C++17 std::size() template arma_warn_unused inline const SizeCube size(const Cube& X) { arma_debug_sigprint(); return SizeCube( X.n_rows, X.n_cols, X.n_slices ); } template arma_warn_unused inline uword size(const BaseCube& X, const uword dim) { arma_debug_sigprint(); const ProxyCube P(X.get_ref()); return SizeCube( P.get_n_rows(), P.get_n_cols(), P.get_n_slices() )( dim ); } arma_warn_unused inline const SizeCube size(const arma::span& row_span, const arma::span& col_span, const arma::span& slice_span) { arma_debug_sigprint(); uword n_rows = 0; uword n_cols = 0; uword n_slices = 0; if(row_span.whole || col_span.whole || slice_span.whole) { arma_conform_check(true, "size(): span::all not supported"); } else { if((row_span.a > row_span.b) || (col_span.a > col_span.b) || (slice_span.a > slice_span.b)) { arma_conform_check_bounds(true, "size(): span indices incorrectly used"); } else { n_rows = row_span.b - row_span.a + 1; n_cols = col_span.b - col_span.a + 1; n_slices = slice_span.b - slice_span.a + 1; } } return SizeCube(n_rows, n_cols, n_slices); } template arma_warn_unused inline const SizeMat size(const SpBase& X) { arma_debug_sigprint(); const SpProxy P(X.get_ref()); return SizeMat( P.get_n_rows(), P.get_n_cols() ); } // explicit overload to workaround ADL issues with C++17 std::size() template arma_warn_unused inline const SizeMat size(const SpMat& X) { arma_debug_sigprint(); return SizeMat( X.n_rows, X.n_cols ); } template arma_warn_unused inline uword size(const SpBase& X, const uword dim) { arma_debug_sigprint(); const SpProxy P(X.get_ref()); return SizeMat( P.get_n_rows(), P.get_n_cols() )( dim ); } template arma_warn_unused inline const SizeCube size(const field& X) { arma_debug_sigprint(); return SizeCube( X.n_rows, X.n_cols, X.n_slices ); } template arma_warn_unused inline uword size(const field& X, const uword dim) { arma_debug_sigprint(); return SizeCube( X.n_rows, X.n_cols, X.n_slices )( dim ); } template arma_warn_unused inline const SizeCube size(const subview_field& X) { arma_debug_sigprint(); return SizeCube( X.n_rows, X.n_cols, X.n_slices ); } template arma_warn_unused inline uword size(const subview_field& X, const uword dim) { arma_debug_sigprint(); return SizeCube( X.n_rows, X.n_cols, X.n_slices )( dim ); } //! @} RcppArmadillo/inst/include/armadillo_bits/include_superlu.hpp0000644000176200001440000002564215002153114024304 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 AND BSD-3-Clause // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // ------------------------------------------------------------------------ // // This file includes portions of SuperLU 7.0 software, // licensed under the following conditions. // // Copyright (c) 2003, The Regents of the University of California, through // Lawrence Berkeley National Laboratory (subject to receipt of any required // approvals from U.S. Dept. of Energy) // // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // (1) Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // (2) Redistributions in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // (3) Neither the name of Lawrence Berkeley National Laboratory, U.S. Dept. of // Energy nor the names of its contributors may be used to endorse or promote // products derived from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE // OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, // EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // ------------------------------------------------------------------------ #if defined(ARMA_USE_SUPERLU) #undef ARMA_SLU_HEADERS_FOUND // Since we need to support float, double, cx_float and cx_double, // as well as preserve the sanity of the user, // we cannot simply include all the SuperLU headers due to their messy state // (duplicate definitions, pollution of global namespace, bizarro defines). // As such we are forced to include only a subset of the headers // and manually specify a few SuperLU structures and function prototypes. // // CAVEAT: // This code requires SuperLU version 7.0, and assumes that newer 7.x versions have no API changes. namespace arma { namespace superlu { // superlu_config.h uses either int or int64_t as int_t #if defined(ARMA_SUPERLU_64BIT_INT) #if defined(INT64_MAX) typedef std::int64_t int_t; #else typedef long long int_t; #endif #else typedef int int_t; #endif } } #if defined(ARMA_USE_SUPERLU_HEADERS) || defined(ARMA_SUPERLU_INCLUDE_DIR) namespace arma { namespace superlu { // Include supermatrix.h. This gives us SuperMatrix. // Put it in the superlu namespace. // For versions of SuperLU I am familiar with, supermatrix.h does not include any other files. // Therefore, putting it in the superlu namespace is reasonably safe. // This same reasoning is true for superlu_enum_consts.h. #undef ARMA_SLU_HEADER_A #undef ARMA_SLU_HEADER_B #if defined(ARMA_SUPERLU_INCLUDE_DIR) #undef ARMA_SLU_STR1 #undef ARMA_SLU_STR2 #define ARMA_SLU_STR1(x) x #define ARMA_SLU_STR2(x) ARMA_SLU_STR1(x) #define ARMA_SLU_HEADER_A ARMA_SLU_STR2(ARMA_SUPERLU_INCLUDE_DIR)ARMA_SLU_STR2(supermatrix.h) #define ARMA_SLU_HEADER_B ARMA_SLU_STR2(ARMA_SUPERLU_INCLUDE_DIR)ARMA_SLU_STR2(superlu_enum_consts.h) #else #define ARMA_SLU_HEADER_A supermatrix.h #define ARMA_SLU_HEADER_B superlu_enum_consts.h #endif #if defined(__has_include) #if __has_include(ARMA_INCFILE_WRAP(ARMA_SLU_HEADER_A)) && __has_include(ARMA_INCFILE_WRAP(ARMA_SLU_HEADER_B)) #include ARMA_INCFILE_WRAP(ARMA_SLU_HEADER_A) #include ARMA_INCFILE_WRAP(ARMA_SLU_HEADER_B) #define ARMA_SLU_HEADERS_FOUND #endif #else #include ARMA_INCFILE_WRAP(ARMA_SLU_HEADER_A) #include ARMA_INCFILE_WRAP(ARMA_SLU_HEADER_B) #define ARMA_SLU_HEADERS_FOUND #endif #undef ARMA_SLU_STR1 #undef ARMA_SLU_STR2 #undef ARMA_SLU_HEADER_A #undef ARMA_SLU_HEADER_B #if defined(ARMA_SLU_HEADERS_FOUND) typedef struct { int* panel_histo; double* utime; float* ops; // NOTE: orig definition is flops_t* ops, where flops_t = float int TinyPivots; int RefineSteps; int expansions; } SuperLUStat_t; typedef struct { fact_t Fact; yes_no_t Equil; colperm_t ColPerm; trans_t Trans; IterRefine_t IterRefine; double DiagPivotThresh; yes_no_t SymmetricMode; yes_no_t PivotGrowth; yes_no_t ConditionNumber; rowperm_t RowPerm; int ILU_DropRule; double ILU_DropTol; double ILU_FillFactor; norm_t ILU_Norm; double ILU_FillTol; milu_t ILU_MILU; double ILU_MILU_Dim; yes_no_t ParSymbFact; yes_no_t ReplaceTinyPivot; yes_no_t SolveInitialized; yes_no_t RefineInitialized; yes_no_t PrintStat; int nnzL, nnzU; int num_lookaheads; yes_no_t lookahead_etree; yes_no_t SymPattern; } superlu_options_t; typedef struct { float for_lu; float total_needed; } mem_usage_t; typedef struct e_node { int_t size; void* mem; } ExpHeader; typedef struct { int_t size; int_t used; int_t top1; int_t top2; void* array; } LU_stack_t; typedef struct { int* xsup; int* supno; int_t* lsub; int_t* xlsub; void* lusup; int_t* xlusup; void* ucol; int_t* usub; int_t* xusub; int_t nzlmax; int_t nzumax; int_t nzlumax; int n; LU_space_t MemModel; int num_expansions; ExpHeader* expanders; LU_stack_t stack; } GlobalLU_t; #endif } } #endif #if defined(ARMA_USE_SUPERLU_HEADERS) && !defined(ARMA_SLU_HEADERS_FOUND) #undef ARMA_USE_SUPERLU #pragma message ("WARNING: use of SuperLU disabled; required headers not found") #endif #endif #if defined(ARMA_USE_SUPERLU) && !defined(ARMA_SLU_HEADERS_FOUND) // Not using any SuperLU headers, so define all required enums and structs. #if defined(ARMA_SUPERLU_INCLUDE_DIR) #pragma message ("WARNING: SuperLU headers not found; using built-in definitions") #endif namespace arma { namespace superlu { typedef enum { SLU_NC, SLU_NCP, SLU_NR, SLU_SC, SLU_SCP, SLU_SR, SLU_DN, SLU_NR_loc } Stype_t; typedef enum { SLU_S, SLU_D, SLU_C, SLU_Z } Dtype_t; typedef enum { SLU_GE, SLU_TRLU, SLU_TRUU, SLU_TRL, SLU_TRU, SLU_SYL, SLU_SYU, SLU_HEL, SLU_HEU } Mtype_t; typedef struct { Stype_t Stype; Dtype_t Dtype; Mtype_t Mtype; int_t nrow; int_t ncol; void* Store; } SuperMatrix; typedef struct { int* panel_histo; double* utime; float* ops; // NOTE: orig definition is flops_t* ops, where flops_t = float int TinyPivots; int RefineSteps; int expansions; } SuperLUStat_t; typedef enum {NO, YES} yes_no_t; typedef enum {DOFACT, SamePattern, SamePattern_SameRowPerm, FACTORED} fact_t; typedef enum {NOROWPERM, LargeDiag_MC64, LargeDiag_HWPM, MY_PERMR} rowperm_t; typedef enum {NATURAL, MMD_ATA, MMD_AT_PLUS_A, COLAMD, METIS_AT_PLUS_A, PARMETIS, METIS_ATA, ZOLTAN, MY_PERMC} colperm_t; typedef enum {NOTRANS, TRANS, CONJ} trans_t; typedef enum {NOREFINE, SLU_SINGLE=1, SLU_DOUBLE, SLU_EXTRA} IterRefine_t; typedef enum {SYSTEM, USER} LU_space_t; typedef enum {ONE_NORM, TWO_NORM, INF_NORM} norm_t; typedef enum {SILU, SMILU_1, SMILU_2, SMILU_3} milu_t; typedef struct { fact_t Fact; yes_no_t Equil; colperm_t ColPerm; trans_t Trans; IterRefine_t IterRefine; double DiagPivotThresh; yes_no_t SymmetricMode; yes_no_t PivotGrowth; yes_no_t ConditionNumber; rowperm_t RowPerm; int ILU_DropRule; double ILU_DropTol; double ILU_FillFactor; norm_t ILU_Norm; double ILU_FillTol; milu_t ILU_MILU; double ILU_MILU_Dim; yes_no_t ParSymbFact; yes_no_t ReplaceTinyPivot; yes_no_t SolveInitialized; yes_no_t RefineInitialized; yes_no_t PrintStat; int nnzL, nnzU; int num_lookaheads; yes_no_t lookahead_etree; yes_no_t SymPattern; } superlu_options_t; typedef struct { float for_lu; float total_needed; } mem_usage_t; typedef struct { int_t nnz; void* nzval; int_t* rowind; int_t* colptr; } NCformat; typedef struct { int_t lda; void* nzval; } DNformat; typedef struct e_node { int_t size; void* mem; } ExpHeader; typedef struct { int_t size; int_t used; int_t top1; int_t top2; void* array; } LU_stack_t; typedef struct { int* xsup; int* supno; int_t* lsub; int_t* xlsub; void* lusup; int_t* xlusup; void* ucol; int_t* usub; int_t* xusub; int_t nzlmax; int_t nzumax; int_t nzlumax; int n; LU_space_t MemModel; int num_expansions; ExpHeader* expanders; LU_stack_t stack; } GlobalLU_t; } } #undef ARMA_SLU_HEADERS_FOUND #endif RcppArmadillo/inst/include/armadillo_bits/op_sp_min_bones.hpp0000644000176200001440000000460714634016465024272 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_sp_min //! @{ class op_sp_min : public traits_op_xvec { public: template inline static void apply(Mat& out, const mtSpReduceOp& in); // template inline static void apply_proxy(Mat& out, const SpProxy& p, const uword dim, const typename arma_not_cx::result* junk = nullptr); template inline static typename T1::elem_type vector_min(const T1& X, const typename arma_not_cx::result* junk = nullptr); template inline static typename arma_not_cx::result min(const SpBase& X); template inline static typename arma_not_cx::result min_with_index(const SpProxy& P, uword& index_of_min_val); // template inline static void apply_proxy(Mat& out, const SpProxy& p, const uword dim, const typename arma_cx_only::result* junk = nullptr); template inline static typename T1::elem_type vector_min(const T1& X, const typename arma_cx_only::result* junk = nullptr); template inline static typename arma_cx_only::result min(const SpBase& X); template inline static typename arma_cx_only::result min_with_index(const SpProxy& P, uword& index_of_min_val); }; //! @} RcppArmadillo/inst/include/armadillo_bits/arrayops_meat.hpp0000644000176200001440000004646315030507611023762 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup arrayops //! @{ template arma_inline void arrayops::copy(eT* dest, const eT* src, const uword n_elem) { if( (dest == src) || (n_elem == 0) ) { return; } std::memcpy(dest, src, n_elem*sizeof(eT)); } template inline void arrayops::fill_zeros(eT* dest, const uword n_elem) { typedef typename get_pod_type::result pod_type; if(n_elem == 0) { return; } if(std::numeric_limits::is_integer || std::numeric_limits::is_iec559) { std::memset((void*)dest, 0, sizeof(eT)*n_elem); } else { arrayops::inplace_set_simple(dest, eT(0), n_elem); } } template inline void arrayops::replace(eT* mem, const uword n_elem, const eT old_val, const eT new_val) { if(arma_isnan(old_val)) { for(uword i=0; i inline void arrayops::clean(eT* mem, const uword n_elem, const eT abs_limit, const typename arma_not_cx::result* junk) { arma_ignore(junk); for(uword i=0; i inline void arrayops::clean(std::complex* mem, const uword n_elem, const T abs_limit) { typedef typename std::complex eT; for(uword i=0; i(T(0), val_imag); } else if(std::abs(val_imag) <= abs_limit) { val = std::complex(val_real, T(0)); } } } template inline void arrayops::clamp(eT* mem, const uword n_elem, const eT min_val, const eT max_val, const typename arma_not_cx::result* junk) { arma_ignore(junk); for(uword i=0; i max_val) ? max_val : val); } } template inline void arrayops::clamp(std::complex* mem, const uword n_elem, const std::complex& min_val, const std::complex& max_val) { typedef typename std::complex eT; const T min_val_real = std::real(min_val); const T min_val_imag = std::imag(min_val); const T max_val_real = std::real(max_val); const T max_val_imag = std::imag(max_val); for(uword i=0; i max_val_real) ? max_val_real : val_real); val_imag = (val_imag < min_val_imag) ? min_val_imag : ((val_imag > max_val_imag) ? max_val_imag : val_imag); val = std::complex(val_real,val_imag); } } template arma_inline void arrayops::convert_cx_scalar ( out_eT& out, const in_eT& in, const typename arma_not_cx::result* junk1, const typename arma_not_cx< in_eT>::result* junk2 ) { arma_ignore(junk1); arma_ignore(junk2); out = out_eT(in); } template arma_inline void arrayops::convert_cx_scalar ( out_eT& out, const std::complex& in, const typename arma_not_cx::result* junk ) { arma_ignore(junk); const in_T val = in.real(); const bool conversion_ok = (std::is_integral::value && std::is_floating_point::value) ? arma_isfinite(val) : true; out = conversion_ok ? out_eT(val) : out_eT(0); } template arma_inline void arrayops::convert_cx_scalar ( std::complex& out, const std::complex< in_T>& in ) { typedef std::complex out_eT; out = out_eT(in); } template inline void arrayops::convert(out_eT* dest, const in_eT* src, const uword n_elem) { if(is_same_type::value) { const out_eT* src2 = (const out_eT*)src; arrayops::copy(dest, src2, n_elem); return; } const bool check_finite = (std::is_integral::value && std::is_floating_point::value); uword j; for(j=1; j::value) ? out_eT( tmp_i ) : ( cond_rel< is_signed::value >::lt(tmp_i, in_eT(0)) ? out_eT(0) : out_eT(tmp_i) ) ) : out_eT(0); dest++; (*dest) = ok_j ? ( (is_signed::value) ? out_eT( tmp_j ) : ( cond_rel< is_signed::value >::lt(tmp_j, in_eT(0)) ? out_eT(0) : out_eT(tmp_j) ) ) : out_eT(0); dest++; } if((j-1) < n_elem) { const in_eT tmp_i = (*src); // dest[i] = out_eT( tmp_i ); const bool ok_i = check_finite ? arma_isfinite(tmp_i) : true; (*dest) = ok_i ? ( (is_signed::value) ? out_eT( tmp_i ) : ( cond_rel< is_signed::value >::lt(tmp_i, in_eT(0)) ? out_eT(0) : out_eT(tmp_i) ) ) : out_eT(0); } } template inline void arrayops::convert_cx(out_eT* dest, const in_eT* src, const uword n_elem) { if(is_same_type::value) { const out_eT* src2 = (const out_eT*)src; arrayops::copy(dest, src2, n_elem); return; } uword j; for(j=1; j inline void arrayops::inplace_plus(eT* dest, const eT* src, const uword n_elem) { if(memory::is_aligned(dest)) { memory::mark_as_aligned(dest); if(memory::is_aligned(src)) { memory::mark_as_aligned(src); arrayops::inplace_plus_base(dest, src, n_elem); } else { arrayops::inplace_plus_base(dest, src, n_elem); } } else { if(memory::is_aligned(src)) { memory::mark_as_aligned(src); arrayops::inplace_plus_base(dest, src, n_elem); } else { arrayops::inplace_plus_base(dest, src, n_elem); } } } template inline void arrayops::inplace_minus(eT* dest, const eT* src, const uword n_elem) { if(memory::is_aligned(dest)) { memory::mark_as_aligned(dest); if(memory::is_aligned(src)) { memory::mark_as_aligned(src); arrayops::inplace_minus_base(dest, src, n_elem); } else { arrayops::inplace_minus_base(dest, src, n_elem); } } else { if(memory::is_aligned(src)) { memory::mark_as_aligned(src); arrayops::inplace_minus_base(dest, src, n_elem); } else { arrayops::inplace_minus_base(dest, src, n_elem); } } } template inline void arrayops::inplace_mul(eT* dest, const eT* src, const uword n_elem) { if(memory::is_aligned(dest)) { memory::mark_as_aligned(dest); if(memory::is_aligned(src)) { memory::mark_as_aligned(src); arrayops::inplace_mul_base(dest, src, n_elem); } else { arrayops::inplace_mul_base(dest, src, n_elem); } } else { if(memory::is_aligned(src)) { memory::mark_as_aligned(src); arrayops::inplace_mul_base(dest, src, n_elem); } else { arrayops::inplace_mul_base(dest, src, n_elem); } } } template inline void arrayops::inplace_div(eT* dest, const eT* src, const uword n_elem) { if(memory::is_aligned(dest)) { memory::mark_as_aligned(dest); if(memory::is_aligned(src)) { memory::mark_as_aligned(src); arrayops::inplace_div_base(dest, src, n_elem); } else { arrayops::inplace_div_base(dest, src, n_elem); } } else { if(memory::is_aligned(src)) { memory::mark_as_aligned(src); arrayops::inplace_div_base(dest, src, n_elem); } else { arrayops::inplace_div_base(dest, src, n_elem); } } } template inline void arrayops::inplace_plus_base(eT* dest, const eT* src, const uword n_elem) { #if defined(ARMA_SIMPLE_LOOPS) { for(uword i=0; i inline void arrayops::inplace_minus_base(eT* dest, const eT* src, const uword n_elem) { #if defined(ARMA_SIMPLE_LOOPS) { for(uword i=0; i inline void arrayops::inplace_mul_base(eT* dest, const eT* src, const uword n_elem) { #if defined(ARMA_SIMPLE_LOOPS) { for(uword i=0; i inline void arrayops::inplace_div_base(eT* dest, const eT* src, const uword n_elem) { #if defined(ARMA_SIMPLE_LOOPS) { for(uword i=0; i inline void arrayops::inplace_set(eT* dest, const eT val, const uword n_elem) { if(val == eT(0)) { arrayops::fill_zeros(dest, n_elem); } else { arrayops::inplace_set_simple(dest, val, n_elem); } } template inline void arrayops::inplace_set_simple(eT* dest, const eT val, const uword n_elem) { if(memory::is_aligned(dest)) { memory::mark_as_aligned(dest); arrayops::inplace_set_base(dest, val, n_elem); } else { arrayops::inplace_set_base(dest, val, n_elem); } } template inline void arrayops::inplace_set_base(eT* dest, const eT val, const uword n_elem) { #if defined(ARMA_SIMPLE_LOOPS) { for(uword i=0; i inline void arrayops::inplace_set_fixed(eT* dest, const eT val) { for(uword i=0; i inline void arrayops::inplace_plus(eT* dest, const eT val, const uword n_elem) { if(memory::is_aligned(dest)) { memory::mark_as_aligned(dest); arrayops::inplace_plus_base(dest, val, n_elem); } else { arrayops::inplace_plus_base(dest, val, n_elem); } } template inline void arrayops::inplace_minus(eT* dest, const eT val, const uword n_elem) { if(memory::is_aligned(dest)) { memory::mark_as_aligned(dest); arrayops::inplace_minus_base(dest, val, n_elem); } else { arrayops::inplace_minus_base(dest, val, n_elem); } } template inline void arrayops::inplace_mul(eT* dest, const eT val, const uword n_elem) { if(memory::is_aligned(dest)) { memory::mark_as_aligned(dest); arrayops::inplace_mul_base(dest, val, n_elem); } else { arrayops::inplace_mul_base(dest, val, n_elem); } } template inline void arrayops::inplace_div(eT* dest, const eT val, const uword n_elem) { if(memory::is_aligned(dest)) { memory::mark_as_aligned(dest); arrayops::inplace_div_base(dest, val, n_elem); } else { arrayops::inplace_div_base(dest, val, n_elem); } } template inline void arrayops::inplace_plus_base(eT* dest, const eT val, const uword n_elem) { #if defined(ARMA_SIMPLE_LOOPS) { for(uword i=0; i inline void arrayops::inplace_minus_base(eT* dest, const eT val, const uword n_elem) { #if defined(ARMA_SIMPLE_LOOPS) { for(uword i=0; i inline void arrayops::inplace_mul_base(eT* dest, const eT val, const uword n_elem) { #if defined(ARMA_SIMPLE_LOOPS) { for(uword i=0; i inline void arrayops::inplace_div_base(eT* dest, const eT val, const uword n_elem) { #if defined(ARMA_SIMPLE_LOOPS) { for(uword i=0; i inline eT arrayops::accumulate(const eT* src, const uword n_elem) { #if defined(__FAST_MATH__) { eT acc = eT(0); if(memory::is_aligned(src)) { memory::mark_as_aligned(src); for(uword i=0; i inline eT arrayops::product(const eT* src, const uword n_elem) { eT val1 = eT(1); eT val2 = eT(1); uword i,j; for(i=0, j=1; j inline bool arrayops::is_zero(const eT* mem, const uword n_elem, const eT abs_limit, const typename arma_not_cx::result* junk) { arma_ignore(junk); if(n_elem == 0) { return false; } if(abs_limit == eT(0)) { for(uword i=0; i abs_limit) { return false; } } } return true; } template inline bool arrayops::is_zero(const std::complex* mem, const uword n_elem, const T abs_limit) { typedef typename std::complex eT; if(n_elem == 0) { return false; } if(abs_limit == T(0)) { for(uword i=0; i abs_limit) { return false; } if(std::abs(std::imag(val)) > abs_limit) { return false; } } } return true; } template inline bool arrayops::is_finite(const eT* src, const uword n_elem) { uword j; for(j=1; j inline bool arrayops::has_inf(const eT* src, const uword n_elem) { uword j; for(j=1; j inline bool arrayops::has_nan(const eT* src, const uword n_elem) { uword j; for(j=1; j inline static void apply(Mat& out, const Op& in); }; class op_shift : public traits_op_default { public: template inline static void apply_noalias(Mat& out, const Mat& X, const uword len, const uword neg, const uword dim); }; //! @} RcppArmadillo/inst/include/armadillo_bits/subview_elem1_bones.hpp0000644000176200001440000001007314715372502025045 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup subview_elem1 //! @{ template class subview_elem1 : public Base< eT, subview_elem1 > { public: typedef eT elem_type; typedef typename get_pod_type::result pod_type; static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; arma_aligned const Mat fake_m; arma_aligned const Mat& m; arma_aligned const Base& a; protected: arma_inline subview_elem1(const Mat& in_m, const Base& in_a); arma_inline subview_elem1(const Cube& in_q, const Base& in_a); public: inline ~subview_elem1(); inline subview_elem1() = delete; template inline void inplace_op(const eT val); template inline void inplace_op(const subview_elem1& x ); template inline void inplace_op(const Base& x ); arma_inline const Op,op_htrans> t() const; arma_inline const Op,op_htrans> ht() const; arma_inline const Op,op_strans> st() const; inline void replace(const eT old_val, const eT new_val); inline void clean(const pod_type threshold); inline void clamp(const eT min_val, const eT max_val); inline void fill(const eT val); inline void zeros(); inline void ones(); inline void randu(); inline void randn(); inline void operator+= (const eT val); inline void operator-= (const eT val); inline void operator*= (const eT val); inline void operator/= (const eT val); // deliberately returning void template inline void operator_equ(const subview_elem1& x); template inline void operator= (const subview_elem1& x); inline void operator= (const subview_elem1& x); template inline void operator+= (const subview_elem1& x); template inline void operator-= (const subview_elem1& x); template inline void operator%= (const subview_elem1& x); template inline void operator/= (const subview_elem1& x); template inline void operator= (const Base& x); template inline void operator+= (const Base& x); template inline void operator-= (const Base& x); template inline void operator%= (const Base& x); template inline void operator/= (const Base& x); inline static void extract(Mat& out, const subview_elem1& in); template inline static void mat_inplace_op(Mat& out, const subview_elem1& in); inline static void plus_inplace(Mat& out, const subview_elem1& in); inline static void minus_inplace(Mat& out, const subview_elem1& in); inline static void schur_inplace(Mat& out, const subview_elem1& in); inline static void div_inplace(Mat& out, const subview_elem1& in); template inline bool is_alias(const Mat& X) const; friend class Mat; friend class Cube; }; //! @} RcppArmadillo/inst/include/armadillo_bits/operator_times.hpp0000644000176200001440000002505714631567470024163 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup operator_times //! @{ //! Base * scalar template arma_inline typename enable_if2< is_arma_type::value, const eOp >::result operator* (const T1& X, const typename T1::elem_type k) { arma_debug_sigprint(); return eOp(X,k); } //! scalar * Base template arma_inline typename enable_if2< is_arma_type::value, const eOp >::result operator* (const typename T1::elem_type k, const T1& X) { arma_debug_sigprint(); return eOp(X,k); // NOTE: order is swapped } //! non-complex Base * complex scalar template arma_inline typename enable_if2 < (is_arma_type::value && is_cx::no), const mtOp, T1, op_cx_scalar_times> >::result operator* ( const T1& X, const std::complex& k ) { arma_debug_sigprint(); return mtOp, T1, op_cx_scalar_times>('j', X, k); } //! complex scalar * non-complex Base template arma_inline typename enable_if2 < (is_arma_type::value && is_cx::no), const mtOp, T1, op_cx_scalar_times> >::result operator* ( const std::complex& k, const T1& X ) { arma_debug_sigprint(); return mtOp, T1, op_cx_scalar_times>('j', X, k); } //! scalar * trans(T1) template arma_inline const Op operator* (const typename T1::elem_type k, const Op& X) { arma_debug_sigprint(); return Op(X.m, k); } //! trans(T1) * scalar template arma_inline const Op operator* (const Op& X, const typename T1::elem_type k) { arma_debug_sigprint(); return Op(X.m, k); } //! Base * diagmat template arma_inline typename enable_if2 < (is_arma_type::value && is_same_type::value), const Glue, glue_times_diag> >::result operator* (const T1& X, const Op& Y) { arma_debug_sigprint(); return Glue, glue_times_diag>(X, Y); } //! diagmat * Base template arma_inline typename enable_if2 < (is_arma_type::value && is_same_type::value), const Glue, T2, glue_times_diag> >::result operator* (const Op& X, const T2& Y) { arma_debug_sigprint(); return Glue, T2, glue_times_diag>(X, Y); } //! diagmat * diagmat template inline Mat< typename promote_type::result > operator* (const Op& X, const Op& Y) { arma_debug_sigprint(); typedef typename T1::elem_type eT1; typedef typename T2::elem_type eT2; typedef typename promote_type::result out_eT; promote_type::check(); const diagmat_proxy A(X.m); const diagmat_proxy B(Y.m); arma_conform_assert_mul_size(A.n_rows, A.n_cols, B.n_rows, B.n_cols, "matrix multiplication"); Mat out(A.n_rows, B.n_cols, arma_zeros_indicator()); const uword A_length = (std::min)(A.n_rows, A.n_cols); const uword B_length = (std::min)(B.n_rows, B.n_cols); const uword N = (std::min)(A_length, B_length); for(uword i=0; i::apply( A[i] ) * upgrade_val::apply( B[i] ); } return out; } //! multiplication of Base objects with same element type template arma_inline typename enable_if2 < is_arma_type::value && is_arma_type::value && is_same_type::value, const Glue >::result operator* (const T1& X, const T2& Y) { arma_debug_sigprint(); return Glue(X, Y); } //! multiplication of Base objects with different element types template inline typename enable_if2 < (is_arma_type::value && is_arma_type::value && (is_same_type::no)), const mtGlue< typename promote_type::result, T1, T2, glue_mixed_times > >::result operator* ( const T1& X, const T2& Y ) { arma_debug_sigprint(); typedef typename T1::elem_type eT1; typedef typename T2::elem_type eT2; typedef typename promote_type::result out_eT; promote_type::check(); return mtGlue( X, Y ); } //! sparse multiplied by scalar template inline typename enable_if2 < is_arma_sparse_type::value, SpOp >::result operator* ( const T1& X, const typename T1::elem_type k ) { arma_debug_sigprint(); return SpOp(X, k); } template inline typename enable_if2 < is_arma_sparse_type::value, SpOp >::result operator* ( const typename T1::elem_type k, const T1& X ) { arma_debug_sigprint(); return SpOp(X, k); } //! non-complex sparse * complex scalar template arma_inline typename enable_if2 < (is_arma_sparse_type::value && is_cx::no), const mtSpOp, T1, spop_cx_scalar_times> >::result operator* ( const T1& X, const std::complex& k ) { arma_debug_sigprint(); return mtSpOp, T1, spop_cx_scalar_times>('j', X, k); } //! complex scalar * non-complex sparse template arma_inline typename enable_if2 < (is_arma_sparse_type::value && is_cx::no), const mtSpOp, T1, spop_cx_scalar_times> >::result operator* ( const std::complex& k, const T1& X ) { arma_debug_sigprint(); return mtSpOp, T1, spop_cx_scalar_times>('j', X, k); } //! multiplication of two sparse objects template inline typename enable_if2 < (is_arma_sparse_type::value && is_arma_sparse_type::value && is_same_type::value), const SpGlue >::result operator* ( const T1& x, const T2& y ) { arma_debug_sigprint(); return SpGlue(x, y); } //! multiplication of one sparse and one dense object template inline typename enable_if2 < (is_arma_sparse_type::value && is_arma_type::value && is_same_type::value), const SpToDGlue >::result operator* ( const T1& x, const T2& y ) { arma_debug_sigprint(); return SpToDGlue(x, y); } //! multiplication of one dense and one sparse object template inline typename enable_if2 < (is_arma_type::value && is_arma_sparse_type::value && is_same_type::value), const SpToDGlue >::result operator* ( const T1& x, const T2& y ) { arma_debug_sigprint(); return SpToDGlue(x, y); } //! multiplication of two sparse objects with different element types template inline typename enable_if2 < (is_arma_sparse_type::value && is_arma_sparse_type::value && (is_same_type::no)), const mtSpGlue< typename promote_type::result, T1, T2, spglue_times_mixed > >::result operator* ( const T1& X, const T2& Y ) { arma_debug_sigprint(); typedef typename T1::elem_type eT1; typedef typename T2::elem_type eT2; typedef typename promote_type::result out_eT; promote_type::check(); return mtSpGlue( X, Y ); } //! multiplication of one sparse and one dense object with different element types template inline typename enable_if2 < (is_arma_sparse_type::value && is_arma_type::value && is_same_type::no), Mat< typename promote_type::result > >::result operator* ( const T1& X, const T2& Y ) { arma_debug_sigprint(); Mat< typename promote_type::result > out; glue_times_sparse_dense::apply_mixed(out, X, Y); return out; } //! multiplication of one dense and one sparse object with different element types template inline typename enable_if2 < (is_arma_type::value && is_arma_sparse_type::value && is_same_type::no), Mat< typename promote_type::result > >::result operator* ( const T1& X, const T2& Y ) { arma_debug_sigprint(); Mat< typename promote_type::result > out; glue_times_dense_sparse::apply_mixed(out, X, Y); return out; } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_mvnrnd.hpp0000644000176200001440000000524014635324415023100 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_mvnrnd //! @{ template arma_warn_unused inline typename enable_if2 < is_real::value, const Glue >::result mvnrnd(const Base& M, const Base& C) { arma_debug_sigprint(); return Glue(M.get_ref(), C.get_ref()); } template arma_warn_unused inline typename enable_if2 < is_real::value, const Glue >::result mvnrnd(const Base& M, const Base& C, const uword N) { arma_debug_sigprint(); return Glue(M.get_ref(), C.get_ref(), N); } template inline typename enable_if2 < is_real::value, bool >::result mvnrnd(Mat& out, const Base& M, const Base& C) { arma_debug_sigprint(); const bool status = glue_mvnrnd::apply_direct(out, M.get_ref(), C.get_ref(), uword(1)); if(status == false) { out.soft_reset(); arma_warn(3, "mvnrnd(): given covariance matrix is not symmetric positive semi-definite"); } return status; } template inline typename enable_if2 < is_real::value, bool >::result mvnrnd(Mat& out, const Base& M, const Base& C, const uword N) { arma_debug_sigprint(); const bool status = glue_mvnrnd::apply_direct(out, M.get_ref(), C.get_ref(), N); if(status == false) { out.soft_reset(); arma_warn(3, "mvnrnd(): given covariance matrix is not symmetric positive semi-definite"); } return status; } //! @} RcppArmadillo/inst/include/armadillo_bits/diagmat_proxy.hpp0000644000176200001440000002253614631567470023775 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup diagmat_proxy //! @{ template class diagmat_proxy_default { public: typedef typename T1::elem_type elem_type; typedef typename get_pod_type::result pod_type; inline diagmat_proxy_default(const T1& X) : P ( X ) , P_is_vec( (resolves_to_vector::yes) || (P.get_n_rows() == 1) || (P.get_n_cols() == 1) ) , P_is_col( T1::is_col || (P.get_n_cols() == 1) ) , n_rows ( P_is_vec ? P.get_n_elem() : P.get_n_rows() ) , n_cols ( P_is_vec ? P.get_n_elem() : P.get_n_cols() ) { arma_debug_sigprint(); } arma_inline elem_type operator[](const uword i) const { if(Proxy::use_at == false) { return P_is_vec ? P[i] : P.at(i,i); } else { if(P_is_vec) { return (P_is_col) ? P.at(i,0) : P.at(0,i); } else { return P.at(i,i); } } } arma_inline elem_type at(const uword row, const uword col) const { if(row == col) { if(Proxy::use_at == false) { return (P_is_vec) ? P[row] : P.at(row,row); } else { if(P_is_vec) { return (P_is_col) ? P.at(row,0) : P.at(0,row); } else { return P.at(row,row); } } } else { return elem_type(0); } } inline bool is_alias(const Mat& X) const { return P.is_alias(X); } const Proxy P; const bool P_is_vec; const bool P_is_col; const uword n_rows; const uword n_cols; }; template class diagmat_proxy_fixed { public: typedef typename T1::elem_type elem_type; typedef typename get_pod_type::result pod_type; inline diagmat_proxy_fixed(const T1& X) : P(X) { arma_debug_sigprint(); } arma_inline elem_type operator[](const uword i) const { return (P_is_vec) ? P[i] : P.at(i,i); } arma_inline elem_type at(const uword row, const uword col) const { if(row == col) { return (P_is_vec) ? P[row] : P.at(row,row); } else { return elem_type(0); } } arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&X) == void_ptr(&P)); } const T1& P; //// this may require T1::n_elem etc to be declared as static constexpr inline variables (C++17) //// see also the notes in Mat::fixed // static constexpr bool P_is_vec = (T1::n_rows == 1) || (T1::n_cols == 1); // static constexpr uword n_rows = P_is_vec ? T1::n_elem : T1::n_rows; // static constexpr uword n_cols = P_is_vec ? T1::n_elem : T1::n_cols; static const bool P_is_vec = (T1::n_rows == 1) || (T1::n_cols == 1); static const uword n_rows = P_is_vec ? T1::n_elem : T1::n_rows; static const uword n_cols = P_is_vec ? T1::n_elem : T1::n_cols; }; template struct diagmat_proxy_redirect {}; template struct diagmat_proxy_redirect { typedef diagmat_proxy_default result; }; template struct diagmat_proxy_redirect { typedef diagmat_proxy_fixed result; }; template class diagmat_proxy : public diagmat_proxy_redirect::value>::result { public: inline diagmat_proxy(const T1& X) : diagmat_proxy_redirect::value>::result(X) { } }; template class diagmat_proxy< Mat > { public: typedef eT elem_type; typedef typename get_pod_type::result pod_type; inline diagmat_proxy(const Mat& X) : P ( X ) , P_is_vec( (X.n_rows == 1) || (X.n_cols == 1) ) , n_rows ( P_is_vec ? X.n_elem : X.n_rows ) , n_cols ( P_is_vec ? X.n_elem : X.n_cols ) { arma_debug_sigprint(); } arma_inline elem_type operator[] (const uword i) const { return P_is_vec ? P[i] : P.at(i,i); } arma_inline elem_type at (const uword row, const uword col) const { return (row == col) ? ( P_is_vec ? P[row] : P.at(row,row) ) : elem_type(0); } arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&X) == void_ptr(&P)); } const Mat& P; const bool P_is_vec; const uword n_rows; const uword n_cols; }; template class diagmat_proxy< Row > { public: typedef eT elem_type; typedef typename get_pod_type::result pod_type; inline diagmat_proxy(const Row& X) : P(X) , n_rows(X.n_elem) , n_cols(X.n_elem) { arma_debug_sigprint(); } arma_inline elem_type operator[] (const uword i) const { return P[i]; } arma_inline elem_type at (const uword row, const uword col) const { return (row == col) ? P[row] : elem_type(0); } arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&X) == void_ptr(&P)); } static constexpr bool P_is_vec = true; const Row& P; const uword n_rows; const uword n_cols; }; template class diagmat_proxy< Col > { public: typedef eT elem_type; typedef typename get_pod_type::result pod_type; inline diagmat_proxy(const Col& X) : P(X) , n_rows(X.n_elem) , n_cols(X.n_elem) { arma_debug_sigprint(); } arma_inline elem_type operator[] (const uword i) const { return P[i]; } arma_inline elem_type at (const uword row, const uword col) const { return (row == col) ? P[row] : elem_type(0); } arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&X) == void_ptr(&P)); } static constexpr bool P_is_vec = true; const Col& P; const uword n_rows; const uword n_cols; }; template class diagmat_proxy< subview_row > { public: typedef eT elem_type; typedef typename get_pod_type::result pod_type; inline diagmat_proxy(const subview_row& X) : P(X) , n_rows(X.n_elem) , n_cols(X.n_elem) { arma_debug_sigprint(); } arma_inline elem_type operator[] (const uword i) const { return P[i]; } arma_inline elem_type at (const uword row, const uword col) const { return (row == col) ? P[row] : elem_type(0); } arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&X) == void_ptr(&(P.m))); } static constexpr bool P_is_vec = true; const subview_row& P; const uword n_rows; const uword n_cols; }; template class diagmat_proxy< subview_col > { public: typedef eT elem_type; typedef typename get_pod_type::result pod_type; inline diagmat_proxy(const subview_col& X) : P(X) , n_rows(X.n_elem) , n_cols(X.n_elem) { arma_debug_sigprint(); } arma_inline elem_type operator[] (const uword i) const { return P[i]; } arma_inline elem_type at (const uword row, const uword col) const { return (row == col) ? P[row] : elem_type(0); } arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&X) == void_ptr(&(P.m))); } static constexpr bool P_is_vec = true; const subview_col& P; const uword n_rows; const uword n_cols; }; template class diagmat_proxy< Glue > { public: typedef typename T1::elem_type elem_type; typedef typename get_pod_type::result pod_type; inline diagmat_proxy(const Glue& X) { op_diagmat::apply_times(P, X.A, X.B); n_rows = P.n_rows; n_cols = P.n_cols; arma_debug_sigprint(); } arma_inline elem_type operator[] (const uword i) const { return P.at(i,i); } arma_inline elem_type at (const uword row, const uword col) const { return (row == col) ? P.at(row,row) : elem_type(0); } constexpr bool is_alias(const Mat&) const { return false; } static constexpr bool P_is_vec = false; Mat P; uword n_rows; uword n_cols; }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_logmat_meat.hpp0000644000176200001440000003213114713753317024103 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_logmat //! @{ // Partly based on algorithm 11.9 (inverse scaling and squaring algorithm with Schur decomposition) in: // Nicholas J. Higham. // Functions of Matrices: Theory and Computation. // SIAM, 2008. // ISBN 978-0-89871-646-7 template inline void op_logmat::apply(Mat< std::complex >& out, const mtOp,T1,op_logmat>& in) { arma_debug_sigprint(); const bool status = op_logmat::apply_direct(out, in.m, in.aux_uword_a); if(status == false) { out.soft_reset(); arma_stop_runtime_error("logmat(): transformation failed"); } } template inline bool op_logmat::apply_direct(Mat< std::complex >& out, const Op& expr, const uword) { arma_debug_sigprint(); typedef typename T1::elem_type T; const diagmat_proxy P(expr.m); arma_conform_check( (P.n_rows != P.n_cols), "logmat(): given matrix must be square sized" ); const uword N = P.n_rows; out.zeros(N,N); // aliasing can't happen as op_logmat is defined as cx_mat = op(mat) for(uword i=0; i= T(0)) { out.at(i,i) = std::log(val); } else { out.at(i,i) = std::log( std::complex(val) ); } } return true; } template inline bool op_logmat::apply_direct(Mat< std::complex >& out, const Base& expr, const uword n_iters) { arma_debug_sigprint(); typedef typename T1::elem_type in_T; typedef typename std::complex out_T; const quasi_unwrap expr_unwrap(expr.get_ref()); const Mat& A = expr_unwrap.M; arma_conform_check( (A.is_square() == false), "logmat(): given matrix must be square sized" ); if(A.n_elem == 0) { out.reset(); return true; } else if(A.n_elem == 1) { out.set_size(1,1); out[0] = std::log( std::complex( A[0] ) ); return true; } if(A.is_diagmat()) { arma_debug_print("op_logmat: diag optimisation"); const uword N = A.n_rows; out.zeros(N,N); // aliasing can't happen as op_logmat is defined as cx_mat = op(mat) for(uword i=0; i= in_T(0)) { out.at(i,i) = std::log(val); } else { out.at(i,i) = std::log( out_T(val) ); } } return true; } const bool try_sympd = arma_config::optimise_sym && sym_helper::guess_sympd(A); if(try_sympd) { arma_debug_print("op_logmat: attempting sympd optimisation"); // if matrix A is sympd, all its eigenvalues are positive Col eigval; Mat eigvec; const bool eig_status = eig_sym_helper(eigval, eigvec, A, 'd', "logmat()"); if(eig_status) { // ensure each eigenvalue is > 0 const uword N = eigval.n_elem; const in_T* eigval_mem = eigval.memptr(); bool all_pos = true; for(uword i=0; i >::from( eigvec * diagmat(eigval) * eigvec.t() ); return true; } } arma_debug_print("op_logmat: sympd optimisation failed"); // fallthrough if eigen decomposition failed or an eigenvalue is <= 0 } Mat S(A.n_rows, A.n_cols, arma_nozeros_indicator()); const in_T* Amem = A.memptr(); out_T* Smem = S.memptr(); const uword n_elem = A.n_elem; for(uword i=0; i( Amem[i] ); } return op_logmat_cx::apply_common(out, S, n_iters); } template inline void op_logmat_cx::apply(Mat& out, const Op& in) { arma_debug_sigprint(); const bool status = op_logmat_cx::apply_direct(out, in.m, in.aux_uword_a); if(status == false) { out.soft_reset(); arma_stop_runtime_error("logmat(): transformation failed"); } } template inline bool op_logmat_cx::apply_direct(Mat& out, const Op& expr, const uword) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const diagmat_proxy P(expr.m); bool status = false; if(P.is_alias(out)) { Mat tmp; status = op_logmat_cx::apply_direct_noalias(tmp, P); out.steal_mem(tmp); } else { status = op_logmat_cx::apply_direct_noalias(out, P); } return status; } template inline bool op_logmat_cx::apply_direct_noalias(Mat& out, const diagmat_proxy& P) { arma_debug_sigprint(); arma_conform_check( (P.n_rows != P.n_cols), "logmat(): given matrix must be square sized" ); const uword N = P.n_rows; out.zeros(N,N); for(uword i=0; i inline bool op_logmat_cx::apply_direct(Mat& out, const Base& expr, const uword n_iters) { arma_debug_sigprint(); typedef typename T1::pod_type T; typedef typename T1::elem_type eT; Mat S = expr.get_ref(); arma_conform_check( (S.n_rows != S.n_cols), "logmat(): given matrix must be square sized" ); if(S.n_elem == 0) { out.reset(); return true; } else if(S.n_elem == 1) { out.set_size(1,1); out[0] = std::log(S[0]); return true; } if(S.is_diagmat()) { arma_debug_print("op_logmat_cx: diag optimisation"); const uword N = S.n_rows; out.zeros(N,N); // aliasing can't happen as S is generated for(uword i=0; i eigval; Mat eigvec; const bool eig_status = eig_sym_helper(eigval, eigvec, S, 'd', "logmat()"); if(eig_status) { // ensure each eigenvalue is > 0 const uword N = eigval.n_elem; const T* eigval_mem = eigval.memptr(); bool all_pos = true; for(uword i=0; i inline bool op_logmat_cx::apply_common(Mat< std::complex >& out, Mat< std::complex >& S, const uword n_iters) { arma_debug_sigprint(); typedef typename std::complex eT; Mat U; const bool schur_ok = auxlib::schur(U,S); if(schur_ok == false) { arma_debug_print("logmat(): schur decomposition failed"); return false; } // NOTE: theta[0] and theta[1] not really used double theta[] = { 1.10e-5, 1.82e-3, 1.6206284795015624e-2, 5.3873532631381171e-2, 1.1352802267628681e-1, 1.8662860613541288e-1, 2.642960831111435e-1 }; const uword N = S.n_rows; uword p = 0; uword m = 6; uword iter = 0; while(iter < n_iters) { const T tau = norm( (S - eye< Mat >(N,N)), 1 ); if(tau <= theta[6]) { p++; uword j1 = 0; uword j2 = 0; for(uword i=2; i<=6; ++i) { if( tau <= theta[i]) { j1 = i; break; } } for(uword i=2; i<=6; ++i) { if((tau/2.0) <= theta[i]) { j2 = i; break; } } // sanity check, for development purposes only arma_conform_check( (j2 > j1), "internal error: op_logmat::apply_direct(): j2 > j1" ); if( ((j1 - j2) <= 1) || (p == 2) ) { m = j1; break; } } const bool sqrtmat_ok = op_sqrtmat_cx::apply_direct(S,S); if(sqrtmat_ok == false) { arma_debug_print("logmat(): sqrtmat() failed"); return false; } iter++; } if(iter >= n_iters) { arma_warn(2, "logmat(): reached max iterations without full convergence"); } S.diag() -= eT(1); if(m >= 1) { const bool helper_ok = op_logmat_cx::helper(S,m); if(helper_ok == false) { return false; } } out = U * S * U.t(); out *= eT(eop_aux::pow(double(2), double(iter))); return true; } template inline bool op_logmat_cx::helper(Mat& A, const uword m) { arma_debug_sigprint(); if(A.internal_has_nonfinite()) { return false; } const vec indices = regspace(1,m-1); mat tmp(m, m, arma_zeros_indicator()); tmp.diag(-1) = indices / sqrt(square(2.0*indices) - 1.0); tmp.diag(+1) = indices / sqrt(square(2.0*indices) - 1.0); vec eigval; mat eigvec; const bool eig_ok = eig_sym_helper(eigval, eigvec, tmp, 'd', "logmat()"); if(eig_ok == false) { arma_debug_print("logmat(): eig_sym() failed"); return false; } const vec nodes = (eigval + 1.0) / 2.0; const vec weights = square(eigvec.row(0).t()); const uword N = A.n_rows; Mat B(N, N, arma_zeros_indicator()); Mat X; for(uword i=0; i < m; ++i) { // B += weights(i) * solve( (nodes(i)*A + eye< Mat >(N,N)), A ); //const bool solve_ok = solve( X, (nodes(i)*A + eye< Mat >(N,N)), A, solve_opts::fast ); const bool solve_ok = solve( X, trimatu(nodes(i)*A + eye< Mat >(N,N)), A, solve_opts::no_approx ); if(solve_ok == false) { arma_debug_print("logmat(): solve() failed"); return false; } B += weights(i) * X; } A = B; return true; } template inline void op_logmat_sympd::apply(Mat& out, const Op& in) { arma_debug_sigprint(); const bool status = op_logmat_sympd::apply_direct(out, in.m); if(status == false) { out.soft_reset(); arma_stop_runtime_error("logmat_sympd(): transformation failed"); } } template inline bool op_logmat_sympd::apply_direct(Mat& out, const Base& expr) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { typedef typename T1::pod_type T; typedef typename T1::elem_type eT; const unwrap U(expr.get_ref()); const Mat& X = U.M; arma_conform_check( (X.is_square() == false), "logmat_sympd(): given matrix must be square sized" ); if((arma_config::check_conform) && (arma_config::warn_level > 0) && (is_cx::yes) && (sym_helper::check_diag_imag(X) == false)) { arma_warn(1, "logmat_sympd(): imaginary components on diagonal are non-zero"); } if(is_op_diagmat::value || X.is_diagmat()) { arma_debug_print("op_logmat_sympd: diag optimisation"); out = X; eT* colmem = out.memptr(); const uword N = X.n_rows; for(uword i=0; i eigval; Mat eigvec; const bool status = eig_sym_helper(eigval, eigvec, X, 'd', "logmat_sympd()"); if(status == false) { return false; } const uword N = eigval.n_elem; const T* eigval_mem = eigval.memptr(); bool all_pos = true; for(uword i=0; i inline bool svd ( Col& S, const Base& X, const typename arma_blas_type_only::result* junk = nullptr ) { arma_debug_sigprint(); arma_ignore(junk); typedef typename T1::elem_type eT; Mat A(X.get_ref()); const bool status = auxlib::svd_dc(S, A); if(status == false) { S.soft_reset(); arma_warn(3, "svd(): decomposition failed"); } return status; } template arma_warn_unused inline Col svd ( const Base& X, const typename arma_blas_type_only::result* junk = nullptr ) { arma_debug_sigprint(); arma_ignore(junk); typedef typename T1::elem_type eT; typedef typename T1::pod_type T; Col out; Mat A(X.get_ref()); const bool status = auxlib::svd_dc(out, A); if(status == false) { out.soft_reset(); arma_stop_runtime_error("svd(): decomposition failed"); } return out; } template inline bool svd ( Mat& U, Col& S, Mat& V, const Base& X, const char* method = "dc", const typename arma_blas_type_only::result* junk = nullptr ) { arma_debug_sigprint(); arma_ignore(junk); typedef typename T1::elem_type eT; arma_conform_check ( ( ((void*)(&U) == (void*)(&S)) || (&U == &V) || ((void*)(&S) == (void*)(&V)) ), "svd(): two or more output objects are the same object" ); const char sig = (method != nullptr) ? method[0] : char(0); arma_conform_check( ((sig != 's') && (sig != 'd')), "svd(): unknown method specified" ); Mat A(X.get_ref()); const bool status = (sig == 'd') ? auxlib::svd_dc(U, S, V, A) : auxlib::svd(U, S, V, A); if(status == false) { U.soft_reset(); S.soft_reset(); V.soft_reset(); arma_warn(3, "svd(): decomposition failed"); } return status; } template inline bool svd_econ ( Mat& U, Col& S, Mat& V, const Base& X, const char mode, const char* method = "dc", const typename arma_blas_type_only::result* junk = nullptr ) { arma_debug_sigprint(); arma_ignore(junk); typedef typename T1::elem_type eT; arma_conform_check ( ( ((void*)(&U) == (void*)(&S)) || (&U == &V) || ((void*)(&S) == (void*)(&V)) ), "svd_econ(): two or more output objects are the same object" ); arma_conform_check ( ( (mode != 'l') && (mode != 'r') && (mode != 'b') ), "svd_econ(): parameter 'mode' is incorrect" ); const char sig = (method != nullptr) ? method[0] : char(0); arma_conform_check( ((sig != 's') && (sig != 'd')), "svd_econ(): unknown method specified" ); Mat A(X.get_ref()); const bool status = ((mode == 'b') && (sig == 'd')) ? auxlib::svd_dc_econ(U, S, V, A) : auxlib::svd_econ(U, S, V, A, mode); if(status == false) { U.soft_reset(); S.soft_reset(); V.soft_reset(); arma_warn(3, "svd_econ(): decomposition failed"); } return status; } template inline bool svd_econ ( Mat& U, Col& S, Mat& V, const Base& X, const char* mode = "both", const char* method = "dc", const typename arma_blas_type_only::result* junk = nullptr ) { arma_debug_sigprint(); arma_ignore(junk); return svd_econ(U, S, V, X, ((mode != nullptr) ? mode[0] : char(0)), method); } //! @} RcppArmadillo/inst/include/armadillo_bits/spop_strans_bones.hpp0000644000176200001440000000277114301267044024652 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup spop_strans //! @{ //! simple transpose operation (no complex conjugates) for sparse matrices class spop_strans { public: template struct traits { static constexpr bool is_row = T1::is_col; // deliberately swapped static constexpr bool is_col = T1::is_row; static constexpr bool is_xvec = T1::is_xvec; }; template inline static void apply_noalias(SpMat& B, const SpMat& A); template inline static void apply(SpMat& out, const SpOp& in); template inline static void apply(SpMat& out, const SpOp& in); }; //! @} RcppArmadillo/inst/include/armadillo_bits/fft_engine_kissfft.hpp0000644000176200001440000002357714631567470024771 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 AND BSD-3-Clause // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // ------------------------------------------------------------------------ // // This file includes portions of Kiss FFT software, // licensed under the following conditions. // // Copyright (c) 2003-2010 Mark Borgerding // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, // are permitted provided that the following conditions are met: // // * Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // // * Redistributions in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // // * Neither the author nor the names of any contributors may be used to // endorse or promote products derived from this software without specific // prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE // OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, // EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // ------------------------------------------------------------------------ //! \addtogroup fft_engine_kissfft //! @{ template class fft_engine_kissfft { public: typedef typename get_pod_type::result T; const uword N; podarray coeffs_array; podarray tmp_array; podarray residue; podarray radix; template inline uword calc_radix() { uword i = 0; for(uword n = N, r=4; n >= 2; ++i) { while( (n % r) > 0 ) { switch(r) { case 2: r = 3; break; case 4: r = 2; break; default: r += 2; break; } if(r*r > n) { r = n; } } n /= r; if(fill) { residue[i] = n; radix[i] = r; } } return i; } inline fft_engine_kissfft(const uword in_N) : N(in_N) { arma_debug_sigprint(); const uword len = calc_radix(); residue.set_size(len); radix.set_size(len); calc_radix(); // calculate the constant coefficients coeffs_array.set_size(N); cx_type* coeffs = coeffs_array.memptr(); const T k = T( (inverse) ? +2 : -2 ) * std::acos( T(-1) ) / T(N); for(uword i=0; i < N; ++i) { coeffs[i] = std::exp( cx_type(T(0), i*k) ); } } arma_hot inline void butterfly_2(cx_type* Y, const uword stride, const uword m) const { // arma_debug_sigprint(); const cx_type* coeffs = coeffs_array.memptr(); for(uword i=0; i < m; ++i) { const cx_type t = Y[i+m] * coeffs[i*stride]; Y[i+m] = Y[i] - t; Y[i ] += t; } } arma_hot inline void butterfly_3(cx_type* Y, const uword stride, const uword m) const { // arma_debug_sigprint(); arma_aligned cx_type tmp[5]; const cx_type* coeffs1 = coeffs_array.memptr(); const cx_type* coeffs2 = coeffs1; const T coeff_sm_imag = coeffs1[stride*m].imag(); const uword n = m*2; // TODO: rearrange the indices within tmp[] into a more sane order for(uword i = m; i > 0; --i) { tmp[1] = Y[m] * (*coeffs1); tmp[2] = Y[n] * (*coeffs2); tmp[0] = tmp[1] - tmp[2]; tmp[0] *= coeff_sm_imag; tmp[3] = tmp[1] + tmp[2]; Y[m] = cx_type( (Y[0].real() - (T(0.5)*tmp[3].real())), (Y[0].imag() - (T(0.5)*tmp[3].imag())) ); Y[0] += tmp[3]; Y[n] = cx_type( (Y[m].real() + tmp[0].imag()), (Y[m].imag() - tmp[0].real()) ); Y[m] += cx_type( -tmp[0].imag(), tmp[0].real() ); Y++; coeffs1 += stride; coeffs2 += stride*2; } } arma_hot inline void butterfly_4(cx_type* Y, const uword stride, const uword m) const { // arma_debug_sigprint(); arma_aligned cx_type tmp[7]; const cx_type* coeffs = coeffs_array.memptr(); const uword m2 = m*2; const uword m3 = m*3; // TODO: rearrange the indices within tmp[] into a more sane order for(uword i=0; i < m; ++i) { tmp[0] = Y[i + m ] * coeffs[i*stride ]; tmp[2] = Y[i + m3] * coeffs[i*stride*3]; tmp[3] = tmp[0] + tmp[2]; //tmp[4] = tmp[0] - tmp[2]; //tmp[4] = (inverse) ? cx_type( -(tmp[4].imag()), tmp[4].real() ) : cx_type( tmp[4].imag(), -tmp[4].real() ); tmp[4] = (inverse) ? cx_type( (tmp[2].imag() - tmp[0].imag()), (tmp[0].real() - tmp[2].real()) ) : cx_type( (tmp[0].imag() - tmp[2].imag()), (tmp[2].real() - tmp[0].real()) ); tmp[1] = Y[i + m2] * coeffs[i*stride*2]; tmp[5] = Y[i] - tmp[1]; Y[i ] += tmp[1]; Y[i + m2] = Y[i] - tmp[3]; Y[i ] += tmp[3]; Y[i + m ] = tmp[5] + tmp[4]; Y[i + m3] = tmp[5] - tmp[4]; } } arma_hot inline void butterfly_5(cx_type* Y, const uword stride, const uword m) const { // arma_debug_sigprint(); arma_aligned cx_type tmp[13]; const cx_type* coeffs = coeffs_array.memptr(); const T a_real = coeffs[stride*1*m].real(); const T a_imag = coeffs[stride*1*m].imag(); const T b_real = coeffs[stride*2*m].real(); const T b_imag = coeffs[stride*2*m].imag(); cx_type* Y0 = Y; cx_type* Y1 = Y + 1*m; cx_type* Y2 = Y + 2*m; cx_type* Y3 = Y + 3*m; cx_type* Y4 = Y + 4*m; for(uword i=0; i < m; ++i) { tmp[0] = (*Y0); tmp[1] = (*Y1) * coeffs[stride*1*i]; tmp[2] = (*Y2) * coeffs[stride*2*i]; tmp[3] = (*Y3) * coeffs[stride*3*i]; tmp[4] = (*Y4) * coeffs[stride*4*i]; tmp[7] = tmp[1] + tmp[4]; tmp[8] = tmp[2] + tmp[3]; tmp[9] = tmp[2] - tmp[3]; tmp[10] = tmp[1] - tmp[4]; (*Y0) += tmp[7]; (*Y0) += tmp[8]; tmp[5] = tmp[0] + cx_type( ( (tmp[7].real() * a_real) + (tmp[8].real() * b_real) ), ( (tmp[7].imag() * a_real) + (tmp[8].imag() * b_real) ) ); tmp[6] = cx_type( ( (tmp[10].imag() * a_imag) + (tmp[9].imag() * b_imag) ), ( -(tmp[10].real() * a_imag) - (tmp[9].real() * b_imag) ) ); (*Y1) = tmp[5] - tmp[6]; (*Y4) = tmp[5] + tmp[6]; tmp[11] = tmp[0] + cx_type( ( (tmp[7].real() * b_real) + (tmp[8].real() * a_real) ), ( (tmp[7].imag() * b_real) + (tmp[8].imag() * a_real) ) ); tmp[12] = cx_type( ( -(tmp[10].imag() * b_imag) + (tmp[9].imag() * a_imag) ), ( (tmp[10].real() * b_imag) - (tmp[9].real() * a_imag) ) ); (*Y2) = tmp[11] + tmp[12]; (*Y3) = tmp[11] - tmp[12]; Y0++; Y1++; Y2++; Y3++; Y4++; } } arma_hot inline void butterfly_N(cx_type* Y, const uword stride, const uword m, const uword r) { // arma_debug_sigprint(); const cx_type* coeffs = coeffs_array.memptr(); tmp_array.set_min_size(r); cx_type* tmp = tmp_array.memptr(); for(uword u=0; u < m; ++u) { uword k = u; for(uword v=0; v < r; ++v) { tmp[v] = Y[k]; k += m; } k = u; for(uword v=0; v < r; ++v) { Y[k] = tmp[0]; uword j = 0; for(uword w=1; w < r; ++w) { j += stride * k; if(j >= N) { j -= N; } Y[k] += tmp[w] * coeffs[j]; } k += m; } } } inline void run(cx_type* Y, const cx_type* X, const uword stage = 0, const uword stride = 1) { arma_debug_sigprint(); const uword m = residue[stage]; const uword r = radix[stage]; const cx_type *Y_end = Y + r*m; if(m == 1) { for(cx_type* Yi = Y; Yi != Y_end; Yi++, X += stride) { (*Yi) = (*X); } } else { const uword next_stage = stage + 1; const uword next_stride = stride * r; for(cx_type* Yi = Y; Yi != Y_end; Yi += m, X += stride) { run(Yi, X, next_stage, next_stride); } } switch(r) { case 2: butterfly_2(Y, stride, m ); break; case 3: butterfly_3(Y, stride, m ); break; case 4: butterfly_4(Y, stride, m ); break; case 5: butterfly_5(Y, stride, m ); break; default: butterfly_N(Y, stride, m, r); break; } } }; //! @} RcppArmadillo/inst/include/armadillo_bits/fn_expmat.hpp0000644000176200001440000000437514635324415023102 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_expmat //! @{ template arma_warn_unused inline typename enable_if2 < is_real::value, const Op >::result expmat(const Base& A) { arma_debug_sigprint(); return Op(A.get_ref()); } template inline typename enable_if2 < is_real::value, bool >::result expmat(Mat& B, const Base& A) { arma_debug_sigprint(); const bool status = op_expmat::apply_direct(B, A); if(status == false) { B.soft_reset(); arma_warn(3, "expmat(): given matrix appears ill-conditioned"); } return status; } // template arma_warn_unused arma_inline typename enable_if2< is_supported_blas_type::value, const Op >::result expmat_sym(const Base& X) { arma_debug_sigprint(); return Op(X.get_ref()); } template inline typename enable_if2< is_supported_blas_type::value, bool >::result expmat_sym(Mat& Y, const Base& X) { arma_debug_sigprint(); const bool status = op_expmat_sym::apply_direct(Y, X.get_ref()); if(status == false) { Y.soft_reset(); arma_warn(3, "expmat_sym(): transformation failed"); } return status; } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_kmeans.hpp0000644000176200001440000000305714631567470023064 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_kmeans //! @{ template inline typename enable_if2::value, bool>::result kmeans ( Mat& means, const Base& data, const uword k, const gmm_seed_mode& seed_mode, const uword n_iter, const bool print_mode ) { arma_debug_sigprint(); typedef typename T1::elem_type eT; gmm_priv::gmm_diag model; const bool status = model.kmeans_wrapper(means, data.get_ref(), k, seed_mode, n_iter, print_mode); if(status) { means = model.means; } else { means.soft_reset(); } return status; } //! @} RcppArmadillo/inst/include/armadillo_bits/glue_polyfit_meat.hpp0000644000176200001440000000654614631567470024641 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup glue_polyfit //! @{ template inline bool glue_polyfit::apply_noalias(Mat& out, const Col& X, const Col& Y, const uword N) { arma_debug_sigprint(); // create Vandermonde matrix Mat V(X.n_elem, N+1, arma_nozeros_indicator()); V.tail_cols(1).ones(); for(uword i=1; i <= N; ++i) { const uword j = N-i; Col V_col_j (V.colptr(j ), V.n_rows, false, false); Col V_col_jp1(V.colptr(j+1), V.n_rows, false, false); V_col_j = V_col_jp1 % X; } Mat Q; Mat R; const bool status1 = auxlib::qr_econ(Q, R, V); if(status1 == false) { return false; } const bool status2 = auxlib::solve_trimat_fast(out, R, (Q.t() * Y), uword(0)); if(status2 == false) { return false; } return true; } template inline bool glue_polyfit::apply_direct(Mat& out, const Base& X_expr, const Base& Y_expr, const uword N) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const quasi_unwrap UX(X_expr.get_ref()); const quasi_unwrap UY(Y_expr.get_ref()); const Mat& X = UX.M; const Mat& Y = UY.M; arma_conform_check ( ( ((X.is_vec() == false) && (X.is_empty() == false)) || ((Y.is_vec() == false) && (Y.is_empty() == false)) ), "polyfit(): given object must be a vector" ); arma_conform_check( (X.n_elem != Y.n_elem), "polyfit(): given vectors must have the same number of elements" ); if(X.n_elem == 0) { out.reset(); return true; } arma_conform_check( (N >= X.n_elem), "polyfit(): N must be less than the number of elements in X" ); const Col X_as_colvec( const_cast(X.memptr()), X.n_elem, false, false); const Col Y_as_colvec( const_cast(Y.memptr()), Y.n_elem, false, false); bool status = false; if(UX.is_alias(out) || UY.is_alias(out)) { Mat tmp; status = glue_polyfit::apply_noalias(tmp, X_as_colvec, Y_as_colvec, N); out.steal_mem(tmp); } else { status = glue_polyfit::apply_noalias(out, X_as_colvec, Y_as_colvec, N); } return status; } template inline void glue_polyfit::apply(Mat& out, const Glue& expr) { arma_debug_sigprint(); const bool status = glue_polyfit::apply_direct(out, expr.A, expr.B, expr.aux_uword); if(status == false) { out.soft_reset(); arma_stop_runtime_error("polyfit(): failed"); } } //! @} RcppArmadillo/inst/include/armadillo_bits/newarp_TridiagEigen_bones.hpp0000644000176200001440000000346214301267043026203 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ namespace newarp { //! Calculate the eigenvalues and eigenvectors of a symmetric tridiagonal matrix. //! This class is a wrapper of the Lapack functions `_steqr`. template class TridiagEigen { private: blas_int n; Col main_diag; // Main diagonal elements of the matrix Col sub_diag; // Sub-diagonal elements of the matrix Mat evecs; // To store eigenvectors bool computed; public: //! Default constructor. Computation can //! be performed later by calling the compute() method. inline TridiagEigen(); //! Constructor to create an object that calculates the eigenvalues //! and eigenvectors of a symmetric tridiagonal matrix `mat_obj`. inline TridiagEigen(const Mat& mat_obj); //! Compute the eigenvalue decomposition of a symmetric tridiagonal matrix. inline void compute(const Mat& mat_obj); //! Retrieve the eigenvalues. inline Col eigenvalues(); //! Retrieve the eigenvectors. inline Mat eigenvectors(); }; } // namespace newarp RcppArmadillo/inst/include/armadillo_bits/op_htrans_bones.hpp0000644000176200001440000000717314301267043024274 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_htrans //! @{ //! 'hermitian transpose' operation class op_htrans { public: template struct traits { static constexpr bool is_row = T1::is_col; // deliberately swapped static constexpr bool is_col = T1::is_row; static constexpr bool is_xvec = T1::is_xvec; }; template arma_hot inline static void apply_mat_noalias(Mat& out, const Mat& A, const typename arma_not_cx::result* junk = nullptr); template arma_hot inline static void apply_mat_noalias(Mat& out, const Mat& A, const typename arma_cx_only::result* junk = nullptr); // template arma_hot inline static void block_worker(std::complex* Y, const std::complex* X, const uword X_n_rows, const uword Y_n_rows, const uword n_rows, const uword n_cols); template arma_hot inline static void apply_mat_noalias_large(Mat< std::complex >& out, const Mat< std::complex >& A); // template arma_hot inline static void apply_mat_inplace(Mat& out, const typename arma_not_cx::result* junk = nullptr); template arma_hot inline static void apply_mat_inplace(Mat& out, const typename arma_cx_only::result* junk = nullptr); // template inline static void apply_mat(Mat& out, const Mat& A, const typename arma_not_cx::result* junk = nullptr); template inline static void apply_mat(Mat& out, const Mat& A, const typename arma_cx_only::result* junk = nullptr); // template inline static void apply_proxy(Mat& out, const Proxy& P); // template inline static void apply_direct(Mat& out, const T1& X); template inline static void apply(Mat& out, const Op& in, const typename arma_not_cx::result* junk = nullptr); template inline static void apply(Mat& out, const Op& in, const typename arma_cx_only::result* junk = nullptr); }; class op_htrans2 { public: template struct traits { static constexpr bool is_row = T1::is_col; // deliberately swapped static constexpr bool is_col = T1::is_row; static constexpr bool is_xvec = T1::is_xvec; }; template inline static void apply(Mat& out, const Op& in, const typename arma_not_cx::result* junk = nullptr); template inline static void apply(Mat& out, const Op& in, const typename arma_cx_only::result* junk = nullptr); }; //! @} RcppArmadillo/inst/include/armadillo_bits/glue_trapz_meat.hpp0000644000176200001440000000726214631567470024307 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup glue_trapz //! @{ template inline void glue_trapz::apply(Mat& out, const Glue& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword dim = in.aux_uword; const quasi_unwrap UX(in.A); const quasi_unwrap UY(in.B); if( UX.is_alias(out) || UY.is_alias(out) ) { Mat tmp; glue_trapz::apply_noalias(tmp, UX.M, UY.M, dim); out.steal_mem(tmp); } else { glue_trapz::apply_noalias(out, UX.M, UY.M, dim); } } template inline void glue_trapz::apply_noalias(Mat& out, const Mat& X, const Mat& Y, const uword dim) { arma_debug_sigprint(); arma_conform_check( (dim > 1), "trapz(): argument 'dim' must be 0 or 1" ); arma_conform_check( ((X.is_vec() == false) && (X.is_empty() == false)), "trapz(): argument 'X' must be a vector" ); const uword N = X.n_elem; if(dim == 0) { arma_conform_check( (N != Y.n_rows), "trapz(): length of X must equal the number of rows in Y when dim=0" ); } else if(dim == 1) { arma_conform_check( (N != Y.n_cols), "trapz(): length of X must equal the number of columns in Y when dim=1" ); } if(N <= 1) { if(dim == 0) { out.zeros(1, Y.n_cols); } else if(dim == 1) { out.zeros(Y.n_rows, 1); } return; } const Col vec_X( const_cast(X.memptr()), X.n_elem, false, true ); const Col diff_X = diff(vec_X); if(dim == 0) { const Row diff_X_t( const_cast(diff_X.memptr()), diff_X.n_elem, false, true ); out = diff_X_t * (0.5 * (Y.rows(0, N-2) + Y.rows(1, N-1))); } else if(dim == 1) { out = (0.5 * (Y.cols(0, N-2) + Y.cols(1, N-1))) * diff_X; } } template inline void op_trapz::apply(Mat& out, const Op& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword dim = in.aux_uword_a; const quasi_unwrap UY(in.m); if(UY.is_alias(out)) { Mat tmp; op_trapz::apply_noalias(tmp, UY.M, dim); out.steal_mem(tmp); } else { op_trapz::apply_noalias(out, UY.M, dim); } } template inline void op_trapz::apply_noalias(Mat& out, const Mat& Y, const uword dim) { arma_debug_sigprint(); arma_conform_check( (dim > 1), "trapz(): argument 'dim' must be 0 or 1" ); uword N = 0; if(dim == 0) { N = Y.n_rows; } else if(dim == 1) { N = Y.n_cols; } if(N <= 1) { if(dim == 0) { out.zeros(1, Y.n_cols); } else if(dim == 1) { out.zeros(Y.n_rows, 1); } return; } if(dim == 0) { out = sum( (0.5 * (Y.rows(0, N-2) + Y.rows(1, N-1))), 0 ); } else if(dim == 1) { out = sum( (0.5 * (Y.cols(0, N-2) + Y.cols(1, N-1))), 1 ); } } //! @} RcppArmadillo/inst/include/armadillo_bits/op_vectorise_meat.hpp0000644000176200001440000002114114752446051024617 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_vectorise //! @{ template inline void op_vectorise_col::apply(Mat& out, const Op& in) { arma_debug_sigprint(); op_vectorise_col::apply_direct(out, in.m); } template inline void op_vectorise_col::apply_direct(Mat& out, const T1& expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; // allow detection of in-place operation if(is_Mat::value) { const unwrap U(expr); if(&out == &(U.M)) { // output matrix is the same as the input matrix out.set_size(out.n_elem, 1); // set_size() doesn't destroy data as long as the number of elements in the matrix remains the same } else { out.set_size(U.M.n_elem, 1); arrayops::copy(out.memptr(), U.M.memptr(), U.M.n_elem); } } else if(is_subview::value) { const subview& sv = reinterpret_cast< const subview& >(expr); if(&out == &(sv.m)) { Mat tmp; op_vectorise_col::apply_subview(tmp, sv); out.steal_mem(tmp); } else { op_vectorise_col::apply_subview(out, sv); } } else if((is_Mat::stored_type>::value) || (arma_config::openmp && Proxy::use_mp)) { const quasi_unwrap U(expr); if(U.is_alias(out)) { Mat tmp(U.M.memptr(), U.M.n_elem, 1); out.steal_mem(tmp); } else { out.set_size(U.M.n_elem, 1); arrayops::copy(out.memptr(), U.M.memptr(), U.M.n_elem); } } else { const Proxy P(expr); if(P.is_alias(out)) { Mat tmp; op_vectorise_col::apply_proxy(tmp, P); out.steal_mem(tmp); } else { op_vectorise_col::apply_proxy(out, P); } } } template inline void op_vectorise_col::apply_subview(Mat& out, const subview& sv) { arma_debug_sigprint(); const uword sv_n_rows = sv.n_rows; const uword sv_n_cols = sv.n_cols; out.set_size(sv.n_elem, 1); eT* out_mem = out.memptr(); for(uword col=0; col < sv_n_cols; ++col) { arrayops::copy(out_mem, sv.colptr(col), sv_n_rows); out_mem += sv_n_rows; } } template inline void op_vectorise_col::apply_proxy(Mat& out, const Proxy& P) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword N = P.get_n_elem(); out.set_size(N, 1); eT* outmem = out.memptr(); if(Proxy::use_at == false) { // TODO: add handling of aligned access ? typename Proxy::ea_type A = P.get_ea(); uword i,j; for(i=0, j=1; j < N; i+=2, j+=2) { const eT tmp_i = A[i]; const eT tmp_j = A[j]; outmem[i] = tmp_i; outmem[j] = tmp_j; } if(i < N) { outmem[i] = A[i]; } } else { const uword n_rows = P.get_n_rows(); const uword n_cols = P.get_n_cols(); if(n_rows == 1) { for(uword i=0; i < n_cols; ++i) { outmem[i] = P.at(0,i); } } else { for(uword col=0; col < n_cols; ++col) for(uword row=0; row < n_rows; ++row) { *outmem = P.at(row,col); outmem++; } } } } template inline void op_vectorise_row::apply(Mat& out, const Op& in) { arma_debug_sigprint(); op_vectorise_row::apply_direct(out, in.m); } template inline void op_vectorise_row::apply_direct(Mat& out, const T1& expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const Proxy P(expr); if(P.is_alias(out)) { Mat tmp; op_vectorise_row::apply_proxy(tmp, P); out.steal_mem(tmp); } else { op_vectorise_row::apply_proxy(out, P); } } template inline void op_vectorise_row::apply_proxy(Mat& out, const Proxy& P) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword n_rows = P.get_n_rows(); const uword n_cols = P.get_n_cols(); const uword n_elem = P.get_n_elem(); out.set_size(1, n_elem); eT* outmem = out.memptr(); if(n_cols == 1) { if(is_Mat::stored_type>::value) { const unwrap::stored_type> tmp(P.Q); arrayops::copy(out.memptr(), tmp.M.memptr(), n_elem); } else { for(uword i=0; i < n_elem; ++i) { outmem[i] = P.at(i,0); } } } else { for(uword row=0; row < n_rows; ++row) { uword i,j; for(i=0, j=1; j < n_cols; i+=2, j+=2) { const eT tmp_i = P.at(row,i); const eT tmp_j = P.at(row,j); *outmem = tmp_i; outmem++; *outmem = tmp_j; outmem++; } if(i < n_cols) { *outmem = P.at(row,i); outmem++; } } } } template inline void op_vectorise_all::apply(Mat& out, const Op& in) { arma_debug_sigprint(); const uword dim = in.aux_uword_a; if(dim == 0) { op_vectorise_col::apply_direct(out, in.m); } else { op_vectorise_row::apply_direct(out, in.m); } } // template inline void op_vectorise_cube_col::apply(Mat& out, const CubeToMatOp& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; if(is_same_type< T1, subview_cube >::yes) { op_vectorise_cube_col::apply_subview(out, reinterpret_cast< const subview_cube& >(in.m)); } else { if((is_Cube::value) || (is_Cube::stored_type>::value) || (arma_config::openmp && ProxyCube::use_mp)) { op_vectorise_cube_col::apply_unwrap(out, in.m); } else { op_vectorise_cube_col::apply_proxy(out, in.m); } } } template inline void op_vectorise_cube_col::apply_subview(Mat& out, const subview_cube& sv) { arma_debug_sigprint(); const uword sv_nr = sv.n_rows; const uword sv_nc = sv.n_cols; const uword sv_ns = sv.n_slices; out.set_size(sv.n_elem, 1); eT* out_mem = out.memptr(); for(uword s=0; s < sv_ns; ++s) for(uword c=0; c < sv_nc; ++c) { arrayops::copy(out_mem, sv.slice_colptr(s,c), sv_nr); out_mem += sv_nr; } } template inline void op_vectorise_cube_col::apply_unwrap(Mat& out, const T1& expr) { arma_debug_sigprint(); const unwrap_cube U(expr); out.set_size(U.M.n_elem, 1); arrayops::copy(out.memptr(), U.M.memptr(), U.M.n_elem); } template inline void op_vectorise_cube_col::apply_proxy(Mat& out, const T1& expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const ProxyCube P(expr); const uword N = P.get_n_elem(); out.set_size(N, 1); eT* outmem = out.memptr(); if(ProxyCube::use_at == false) { typename ProxyCube::ea_type A = P.get_ea(); uword i,j; for(i=0, j=1; j < N; i+=2, j+=2) { const eT tmp_i = A[i]; const eT tmp_j = A[j]; outmem[i] = tmp_i; outmem[j] = tmp_j; } if(i < N) { outmem[i] = A[i]; } } else { const uword nr = P.get_n_rows(); const uword nc = P.get_n_cols(); const uword ns = P.get_n_slices(); for(uword s=0; s < ns; ++s) for(uword c=0; c < nc; ++c) for(uword r=0; r < nr; ++r) { *outmem = P.at(r,c,s); outmem++; } } } //! @} RcppArmadillo/inst/include/armadillo_bits/op_roots_meat.hpp0000644000176200001440000000636114631567470023776 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_roots //! @{ template inline void op_roots::apply(Mat< std::complex >& out, const mtOp, T1, op_roots>& expr) { arma_debug_sigprint(); const bool status = op_roots::apply_direct(out, expr.m); if(status == false) { out.soft_reset(); arma_stop_runtime_error("roots(): eigen decomposition failed"); } } template inline bool op_roots::apply_direct(Mat< std::complex >& out, const Base& X) { arma_debug_sigprint(); typedef std::complex out_eT; const quasi_unwrap U(X.get_ref()); bool status = false; if(U.is_alias(out)) { Mat tmp; status = op_roots::apply_noalias(tmp, U.M); out.steal_mem(tmp); } else { status = op_roots::apply_noalias(out, U.M); } return status; } template inline bool op_roots::apply_noalias(Mat< std::complex::result> >& out, const Mat& X) { arma_debug_sigprint(); typedef typename get_pod_type::result T; typedef std::complex::result> out_eT; arma_conform_check( (X.is_vec() == false), "roots(): given object must be a vector" ); if(X.internal_has_nonfinite()) { return false; } // treat X as a column vector const Col Y( const_cast(X.memptr()), X.n_elem, false, false); const T Y_max = (Y.is_empty() == false) ? T(max(abs(Y))) : T(0); if(Y_max == T(0)) { out.set_size(1,0); return true; } const uvec indices = find( Y / Y_max ); const uword n_tail_zeros = (indices.n_elem > 0) ? uword( (Y.n_elem-1) - indices[indices.n_elem-1] ) : uword(0); const Col Z = Y.subvec( indices[0], indices[indices.n_elem-1] ); if(Z.n_elem >= uword(2)) { Mat tmp; if(Z.n_elem == uword(2)) { tmp.set_size(1,1); tmp[0] = -Z[1] / Z[0]; } else { tmp = diagmat(ones< Col >(Z.n_elem - 2), -1); tmp.row(0) = strans(-Z.subvec(1, Z.n_elem-1) / Z[0]); } Mat junk; const bool status = auxlib::eig_gen(out, junk, false, tmp); if(status == false) { return false; } if(n_tail_zeros > 0) { out.resize(out.n_rows + n_tail_zeros, 1); } } else { out.zeros(n_tail_zeros,1); } return true; } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_svds.hpp0000644000176200001440000002222714635324415022557 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_svds //! @{ template inline bool svds_helper ( Mat& U, Col& S, Mat& V, const SpBase& X, const uword k, const typename T1::pod_type tol, const bool calc_UV, const typename arma_real_only::result* junk = nullptr ) { arma_debug_sigprint(); arma_ignore(junk); typedef typename T1::elem_type eT; typedef typename T1::pod_type T; arma_conform_check ( ( ((void*)(&U) == (void*)(&S)) || (&U == &V) || ((void*)(&S) == (void*)(&V)) ), "svds(): two or more output objects are the same object" ); arma_conform_check( (tol < T(0)), "svds(): tol must be >= 0" ); const unwrap_spmat tmp(X.get_ref()); const SpMat& A = tmp.M; const uword kk = (std::min)( (std::min)(A.n_rows, A.n_cols), k ); const T A_max = (A.n_nonzero > 0) ? T(max(abs(Col(const_cast(A.values), A.n_nonzero, false)))) : T(0); if(A_max == T(0)) { // TODO: use reset instead ? S.zeros(kk); if(calc_UV) { U.eye(A.n_rows, kk); V.eye(A.n_cols, kk); } } else { SpMat C( (A.n_rows + A.n_cols), (A.n_rows + A.n_cols) ); SpMat B = A / A_max; SpMat Bt = B.t(); C(0, A.n_rows, arma::size(B) ) = B; C(A.n_rows, 0, arma::size(Bt)) = Bt; Bt.reset(); B.reset(); Col eigval; Mat eigvec; eigs_opts opts; opts.tol = (tol / Datum::sqrt2); const bool status = eigs_sym(eigval, eigvec, C, kk, "la", opts); if(status == false) { U.soft_reset(); S.soft_reset(); V.soft_reset(); return false; } const T A_norm = max(eigval); const T tol2 = tol / Datum::sqrt2 * A_norm; uvec indices = find(eigval > tol2); if(indices.n_elem > kk) { indices = indices.subvec(0,kk-1); } else if(indices.n_elem < kk) { const uvec indices2 = find(abs(eigval) <= tol2); const uword N_extra = (std::min)( indices2.n_elem, (kk - indices.n_elem) ); if(N_extra > 0) { indices = join_cols(indices, indices2.subvec(0,N_extra-1)); } } const uvec sorted_indices = sort_index(eigval, "descend"); S = eigval.elem(sorted_indices); S *= A_max; if(calc_UV) { uvec U_row_indices(A.n_rows, arma_nozeros_indicator()); for(uword i=0; i < A.n_rows; ++i) { U_row_indices[i] = i; } uvec V_row_indices(A.n_cols, arma_nozeros_indicator()); for(uword i=0; i < A.n_cols; ++i) { V_row_indices[i] = i + A.n_rows; } U = Datum::sqrt2 * eigvec(U_row_indices, sorted_indices); V = Datum::sqrt2 * eigvec(V_row_indices, sorted_indices); } } if(S.n_elem < k) { arma_warn(1, "svds(): found fewer singular values than specified"); } return true; } template inline bool svds_helper ( Mat& U, Col& S, Mat& V, const SpBase& X, const uword k, const typename T1::pod_type tol, const bool calc_UV, const typename arma_cx_only::result* junk = nullptr ) { arma_debug_sigprint(); arma_ignore(junk); typedef typename T1::elem_type eT; typedef typename T1::pod_type T; if(arma_config::arpack == false) { arma_stop_logic_error("svds(): use of ARPACK must be enabled for decomposition of complex matrices"); return false; } arma_conform_check ( ( ((void*)(&U) == (void*)(&S)) || (&U == &V) || ((void*)(&S) == (void*)(&V)) ), "svds(): two or more output objects are the same object" ); arma_conform_check( (tol < T(0)), "svds(): tol must be >= 0" ); const unwrap_spmat tmp(X.get_ref()); const SpMat& A = tmp.M; const uword kk = (std::min)( (std::min)(A.n_rows, A.n_cols), k ); const T A_max = (A.n_nonzero > 0) ? T(max(abs(Col(const_cast(A.values), A.n_nonzero, false)))) : T(0); if(A_max == T(0)) { // TODO: use reset instead ? S.zeros(kk); if(calc_UV) { U.eye(A.n_rows, kk); V.eye(A.n_cols, kk); } } else { SpMat C( (A.n_rows + A.n_cols), (A.n_rows + A.n_cols) ); SpMat B = A / A_max; SpMat Bt = B.t(); C(0, A.n_rows, arma::size(B) ) = B; C(A.n_rows, 0, arma::size(Bt)) = Bt; Bt.reset(); B.reset(); Col eigval_tmp; Mat eigvec; eigs_opts opts; opts.tol = (tol / Datum::sqrt2); const bool status = eigs_gen(eigval_tmp, eigvec, C, kk, "lr", opts); if(status == false) { U.soft_reset(); S.soft_reset(); V.soft_reset(); return false; } const Col eigval = real(eigval_tmp); const T A_norm = max(eigval); const T tol2 = tol / Datum::sqrt2 * A_norm; uvec indices = find(eigval > tol2); if(indices.n_elem > kk) { indices = indices.subvec(0,kk-1); } else if(indices.n_elem < kk) { const uvec indices2 = find(abs(eigval) <= tol2); const uword N_extra = (std::min)( indices2.n_elem, (kk - indices.n_elem) ); if(N_extra > 0) { indices = join_cols(indices, indices2.subvec(0,N_extra-1)); } } const uvec sorted_indices = sort_index(eigval, "descend"); S = eigval.elem(sorted_indices); S *= A_max; if(calc_UV) { uvec U_row_indices(A.n_rows, arma_nozeros_indicator()); for(uword i=0; i < A.n_rows; ++i) { U_row_indices[i] = i; } uvec V_row_indices(A.n_cols, arma_nozeros_indicator()); for(uword i=0; i < A.n_cols; ++i) { V_row_indices[i] = i + A.n_rows; } U = Datum::sqrt2 * eigvec(U_row_indices, sorted_indices); V = Datum::sqrt2 * eigvec(V_row_indices, sorted_indices); } } if(S.n_elem < k) { arma_warn(1, "svds(): found fewer singular values than specified"); } return true; } //! find the k largest singular values and corresponding singular vectors of sparse matrix X template inline bool svds ( Mat& U, Col& S, Mat& V, const SpBase& X, const uword k, const typename T1::pod_type tol = 0.0, const typename arma_real_or_cx_only::result* junk = nullptr ) { arma_debug_sigprint(); arma_ignore(junk); const bool status = svds_helper(U, S, V, X.get_ref(), k, tol, true); if(status == false) { arma_warn(3, "svds(): decomposition failed"); } return status; } //! find the k largest singular values of sparse matrix X template inline bool svds ( Col& S, const SpBase& X, const uword k, const typename T1::pod_type tol = 0.0, const typename arma_real_or_cx_only::result* junk = nullptr ) { arma_debug_sigprint(); arma_ignore(junk); Mat U; Mat V; const bool status = svds_helper(U, S, V, X.get_ref(), k, tol, false); if(status == false) { arma_warn(3, "svds(): decomposition failed"); } return status; } //! find the k largest singular values of sparse matrix X template arma_warn_unused inline Col svds ( const SpBase& X, const uword k, const typename T1::pod_type tol = 0.0, const typename arma_real_or_cx_only::result* junk = nullptr ) { arma_debug_sigprint(); arma_ignore(junk); Col S; Mat U; Mat V; const bool status = svds_helper(U, S, V, X.get_ref(), k, tol, false); if(status == false) { arma_stop_runtime_error("svds(): decomposition failed"); } return S; } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_solve.hpp0000644000176200001440000001245714635324415022734 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_solve //! @{ // // solve_gen template arma_warn_unused inline typename enable_if2< is_supported_blas_type::value, const Glue >::result solve ( const Base& A, const Base& B ) { arma_debug_sigprint(); return Glue(A.get_ref(), B.get_ref()); } template inline typename enable_if2< is_supported_blas_type::value, bool >::result solve ( Mat& out, const Base& A, const Base& B ) { arma_debug_sigprint(); const bool status = glue_solve_gen_default::apply(out, A.get_ref(), B.get_ref()); if(status == false) { out.soft_reset(); arma_warn(3, "solve(): solution not found"); } return status; } template arma_warn_unused inline typename enable_if2< is_supported_blas_type::value, const Glue >::result solve ( const Base& A, const Base& B, const solve_opts::opts& opts ) { arma_debug_sigprint(); return Glue(A.get_ref(), B.get_ref(), opts.flags); } template inline typename enable_if2< is_supported_blas_type::value, bool >::result solve ( Mat& out, const Base& A, const Base& B, const solve_opts::opts& opts ) { arma_debug_sigprint(); const bool status = glue_solve_gen_full::apply(out, A.get_ref(), B.get_ref(), opts.flags); if(status == false) { out.soft_reset(); arma_warn(3, "solve(): solution not found"); } return status; } // // solve_tri template arma_warn_unused inline typename enable_if2< is_supported_blas_type::value, const Glue >::result solve ( const Op& A, const Base& B ) { arma_debug_sigprint(); uword flags = uword(0); if(A.aux_uword_a == 0) { flags |= solve_opts::flag_triu; } if(A.aux_uword_a == 1) { flags |= solve_opts::flag_tril; } return Glue(A.m, B.get_ref(), flags); } template arma_warn_unused inline typename enable_if2< is_supported_blas_type::value, const Glue >::result solve ( const Op& A, const Base& B, const solve_opts::opts& opts ) { arma_debug_sigprint(); uword flags = opts.flags; if(A.aux_uword_a == 0) { flags |= solve_opts::flag_triu; } if(A.aux_uword_a == 1) { flags |= solve_opts::flag_tril; } return Glue(A.m, B.get_ref(), flags); } template inline typename enable_if2< is_supported_blas_type::value, bool >::result solve ( Mat& out, const Op& A, const Base& B ) { arma_debug_sigprint(); uword flags = uword(0); if(A.aux_uword_a == 0) { flags |= solve_opts::flag_triu; } if(A.aux_uword_a == 1) { flags |= solve_opts::flag_tril; } const bool status = glue_solve_tri_default::apply(out, A.m, B.get_ref(), flags); if(status == false) { out.soft_reset(); arma_warn(3, "solve(): solution not found"); } return status; } template inline typename enable_if2< is_supported_blas_type::value, bool >::result solve ( Mat& out, const Op& A, const Base& B, const solve_opts::opts& opts ) { arma_debug_sigprint(); uword flags = opts.flags; if(A.aux_uword_a == 0) { flags |= solve_opts::flag_triu; } if(A.aux_uword_a == 1) { flags |= solve_opts::flag_tril; } const bool status = glue_solve_tri_full::apply(out, A.m, B.get_ref(), flags); if(status == false) { out.soft_reset(); arma_warn(3, "solve(): solution not found"); } return status; } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_stddev.hpp0000644000176200001440000000566414634016465023101 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_stddev //! @{ template arma_warn_unused inline typename enable_if2 < is_arma_type::value && resolves_to_vector::yes, typename T1::pod_type >::result stddev(const T1& X, const uword norm_type = 0) { arma_debug_sigprint(); return op_stddev::stddev_vec(X, norm_type); } template arma_warn_unused inline typename enable_if2 < is_arma_type::value && resolves_to_vector::no, const mtOp >::result stddev(const T1& X, const uword norm_type = 0) { arma_debug_sigprint(); return mtOp(X, norm_type, 0); } template arma_warn_unused inline typename enable_if2 < is_arma_type::value, const mtOp >::result stddev(const T1& X, const uword norm_type, const uword dim) { arma_debug_sigprint(); return mtOp(X, norm_type, dim); } template arma_warn_unused inline typename arma_scalar_only::result stddev(const T&) { return T(0); } template arma_warn_unused inline typename enable_if2 < is_arma_sparse_type::value && resolves_to_sparse_vector::yes, typename T1::pod_type >::result stddev(const T1& X, const uword norm_type = 0) { arma_debug_sigprint(); return op_sp_stddev::stddev_vec(X, norm_type); } template arma_warn_unused inline typename enable_if2 < is_arma_sparse_type::value && resolves_to_sparse_vector::no, const mtSpReduceOp >::result stddev(const T1& X, const uword norm_type = 0) { arma_debug_sigprint(); return mtSpReduceOp(X, norm_type, 0); } template arma_warn_unused inline typename enable_if2 < is_arma_sparse_type::value, const mtSpReduceOp >::result stddev(const T1& X, const uword norm_type, const uword dim) { arma_debug_sigprint(); return mtSpReduceOp(X, norm_type, dim); } //! @} RcppArmadillo/inst/include/armadillo_bits/op_toeplitz_meat.hpp0000644000176200001440000000530214631567470024474 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_toeplitz //! @{ template inline void op_toeplitz::apply(Mat& out, const Op& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const unwrap_check tmp(in.m, out); const Mat& X = tmp.M; arma_conform_check( ((X.is_vec() == false) && (X.is_empty() == false)), "toeplitz(): given object must be a vector" ); const uword N = X.n_elem; const eT* X_mem = X.memptr(); out.set_size(N,N); for(uword col=0; col < N; ++col) { eT* col_mem = out.colptr(col); uword i; i = col; for(uword row=0; row < col; ++row, --i) { col_mem[row] = X_mem[i]; } i = 0; for(uword row=col; row < N; ++row, ++i) { col_mem[row] = X_mem[i]; } } } template inline void op_toeplitz_c::apply(Mat& out, const Op& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const unwrap_check tmp(in.m, out); const Mat& X = tmp.M; arma_conform_check( ((X.is_vec() == false) && (X.is_empty() == false)), "circ_toeplitz(): given object must be a vector" ); const uword N = X.n_elem; const eT* X_mem = X.memptr(); out.set_size(N,N); if(X.is_rowvec()) { for(uword row=0; row < N; ++row) { uword i; i = row; for(uword col=0; col < row; ++col, --i) { out.at(row,col) = X_mem[N-i]; } i = 0; for(uword col=row; col < N; ++col, ++i) { out.at(row,col) = X_mem[i]; } } } else { for(uword col=0; col < N; ++col) { eT* col_mem = out.colptr(col); uword i; i = col; for(uword row=0; row < col; ++row, --i) { col_mem[row] = X_mem[N-i]; } i = 0; for(uword row=col; row < N; ++row, ++i) { col_mem[row] = X_mem[i]; } } } } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_sqrtmat.hpp0000644000176200001440000000643514635324415023276 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_sqrtmat //! @{ template arma_warn_unused arma_inline typename enable_if2< (is_supported_blas_type::value && is_cx::no), const mtOp, T1, op_sqrtmat> >::result sqrtmat(const Base& X) { arma_debug_sigprint(); return mtOp, T1, op_sqrtmat>(X.get_ref()); } template arma_warn_unused arma_inline typename enable_if2< (is_supported_blas_type::value && is_cx::yes), const Op >::result sqrtmat(const Base& X) { arma_debug_sigprint(); return Op(X.get_ref()); } template inline typename enable_if2< (is_supported_blas_type::value && is_cx::no), bool >::result sqrtmat(Mat< std::complex >& Y, const Base& X) { arma_debug_sigprint(); const bool status = op_sqrtmat::apply_direct(Y, X.get_ref()); if(status == false) { arma_warn(3, "sqrtmat(): given matrix is singular; may not have a square root"); } return status; } template inline typename enable_if2< (is_supported_blas_type::value && is_cx::yes), bool >::result sqrtmat(Mat& Y, const Base& X) { arma_debug_sigprint(); const bool status = op_sqrtmat_cx::apply_direct(Y, X.get_ref()); if(status == false) { arma_warn(3, "sqrtmat(): given matrix is singular; may not have a square root"); } return status; } // template arma_warn_unused arma_inline typename enable_if2< is_supported_blas_type::value, const Op >::result sqrtmat_sympd(const Base& X) { arma_debug_sigprint(); return Op(X.get_ref()); } template inline typename enable_if2< is_supported_blas_type::value, bool >::result sqrtmat_sympd(Mat& Y, const Base& X) { arma_debug_sigprint(); const bool status = op_sqrtmat_sympd::apply_direct(Y, X.get_ref()); if(status == false) { Y.soft_reset(); arma_warn(3, "sqrtmat_sympd(): transformation failed"); } return status; } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_hess.hpp0000644000176200001440000000714214635324415022541 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_hess //! @{ template inline bool hess ( Mat& H, const Base& X, const typename arma_blas_type_only::result* junk = nullptr ) { arma_debug_sigprint(); arma_ignore(junk); typedef typename T1::elem_type eT; Col tao; const bool status = auxlib::hess(H, X.get_ref(), tao); if(H.n_rows > 2) { for(uword i=0; i < H.n_rows-2; ++i) { H(span(i+2, H.n_rows-1), i).zeros(); } } if(status == false) { H.soft_reset(); arma_warn(3, "hess(): decomposition failed"); } return status; } template arma_warn_unused inline Mat hess ( const Base& X, const typename arma_blas_type_only::result* junk = nullptr ) { arma_debug_sigprint(); arma_ignore(junk); typedef typename T1::elem_type eT; Mat H; Col tao; const bool status = auxlib::hess(H, X.get_ref(), tao); if(H.n_rows > 2) { for(uword i=0; i < H.n_rows-2; ++i) { H(span(i+2, H.n_rows-1), i).zeros(); } } if(status == false) { H.soft_reset(); arma_stop_runtime_error("hess(): decomposition failed"); } return H; } template inline bool hess ( Mat& U, Mat& H, const Base& X, const typename arma_blas_type_only::result* junk = nullptr ) { arma_debug_sigprint(); arma_ignore(junk); arma_conform_check( void_ptr(&U) == void_ptr(&H), "hess(): 'U' is an alias of 'H'" ); typedef typename T1::elem_type eT; Col tao; const bool status = auxlib::hess(H, X.get_ref(), tao); if(H.n_rows == 0) { U.reset(); } else if(H.n_rows == 1) { U.ones(1, 1); } else if(H.n_rows == 2) { U.eye(2, 2); } else { U.eye(size(H)); Col v; for(uword i=0; i < H.n_rows-2; ++i) { // TODO: generate v in a more efficient manner; // TODO: the .ones() operation is an overkill, as most of v is overwritten afterwards v.ones(H.n_rows-i-1); v(span(1, H.n_rows-i-2)) = H(span(i+2, H.n_rows-1), i); U(span::all, span(i+1, H.n_rows-1)) -= tao(i) * (U(span::all, span(i+1, H.n_rows-1)) * v * v.t()); } U(span::all, H.n_rows-1) = U(span::all, H.n_rows-1) * (eT(1) - tao(H.n_rows-2)); for(uword i=0; i < H.n_rows-2; ++i) { H(span(i+2, H.n_rows-1), i).zeros(); } } if(status == false) { U.soft_reset(); H.soft_reset(); arma_warn(3, "hess(): decomposition failed"); } return status; } //! @} RcppArmadillo/inst/include/armadillo_bits/op_sp_as_dense_bones.hpp0000644000176200001440000000203014634016465025254 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_sp_as_dense //! @{ class op_sp_as_dense : public traits_op_passthru { public: template inline static void apply(Mat& out, const SpToDOp& expr); }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_cumsum_meat.hpp0000644000176200001440000000721214631567470024135 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_cumsum //! @{ template inline void op_cumsum::apply_noalias(Mat& out, const Mat& X, const uword dim) { arma_debug_sigprint(); uword n_rows = X.n_rows; uword n_cols = X.n_cols; out.set_size(n_rows,n_cols); if(out.n_elem == 0) { return; } if(dim == 0) { if(n_cols == 1) { const eT* X_mem = X.memptr(); eT* out_mem = out.memptr(); eT acc = eT(0); for(uword row=0; row < n_rows; ++row) { acc += X_mem[row]; out_mem[row] = acc; } } else { for(uword col=0; col < n_cols; ++col) { const eT* X_colmem = X.colptr(col); eT* out_colmem = out.colptr(col); eT acc = eT(0); for(uword row=0; row < n_rows; ++row) { acc += X_colmem[row]; out_colmem[row] = acc; } } } } else if(dim == 1) { if(n_rows == 1) { const eT* X_mem = X.memptr(); eT* out_mem = out.memptr(); eT acc = eT(0); for(uword col=0; col < n_cols; ++col) { acc += X_mem[col]; out_mem[col] = acc; } } else { if(n_cols > 0) { arrayops::copy( out.colptr(0), X.colptr(0), n_rows ); for(uword col=1; col < n_cols; ++col) { const eT* out_colmem_prev = out.colptr(col-1); eT* out_colmem = out.colptr(col ); const eT* X_colmem = X.colptr(col ); for(uword row=0; row < n_rows; ++row) { out_colmem[row] = out_colmem_prev[row] + X_colmem[row]; } } } } } } template inline void op_cumsum::apply(Mat& out, const Op& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword dim = in.aux_uword_a; arma_conform_check( (dim > 1), "cumsum(): parameter 'dim' must be 0 or 1" ); const quasi_unwrap U(in.m); if(U.is_alias(out)) { Mat tmp; op_cumsum::apply_noalias(tmp, U.M, dim); out.steal_mem(tmp); } else { op_cumsum::apply_noalias(out, U.M, dim); } } template inline void op_cumsum_vec::apply(Mat& out, const Op& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const quasi_unwrap U(in.m); const uword dim = (T1::is_xvec) ? uword(U.M.is_rowvec() ? 1 : 0) : uword((T1::is_row) ? 1 : 0); if(U.is_alias(out)) { Mat tmp; op_cumsum::apply_noalias(tmp, U.M, dim); out.steal_mem(tmp); } else { op_cumsum::apply_noalias(out, U.M, dim); } } //! @} RcppArmadillo/inst/include/armadillo_bits/op_sp_as_dense_meat.hpp0000644000176200001440000000201114634016465025073 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_sp_as_dense //! @{ template inline void op_sp_as_dense::apply(Mat& out, const SpToDOp& expr) { arma_debug_sigprint(); out = expr.m; } //! @} RcppArmadillo/inst/include/armadillo_bits/op_repmat_meat.hpp0000644000176200001440000000644514631567470024123 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_repmat //! @{ template inline void op_repmat::apply_noalias(Mat& out, const obj& X, const uword copies_per_row, const uword copies_per_col) { arma_debug_sigprint(); typedef typename obj::elem_type eT; const uword X_n_rows = obj::is_row ? uword(1) : X.n_rows; const uword X_n_cols = obj::is_col ? uword(1) : X.n_cols; out.set_size(X_n_rows * copies_per_row, X_n_cols * copies_per_col); const uword out_n_rows = out.n_rows; const uword out_n_cols = out.n_cols; // if( (out_n_rows > 0) && (out_n_cols > 0) ) // { // for(uword col = 0; col < out_n_cols; col += X_n_cols) // for(uword row = 0; row < out_n_rows; row += X_n_rows) // { // out.submat(row, col, row+X_n_rows-1, col+X_n_cols-1) = X; // } // } if( (out_n_rows > 0) && (out_n_cols > 0) ) { if(copies_per_row != 1) { for(uword col_copy=0; col_copy < copies_per_col; ++col_copy) { const uword out_col_offset = X_n_cols * col_copy; for(uword col=0; col < X_n_cols; ++col) { eT* out_colptr = out.colptr(col + out_col_offset); const eT* X_colptr = X.colptr(col); for(uword row_copy=0; row_copy < copies_per_row; ++row_copy) { const uword out_row_offset = X_n_rows * row_copy; arrayops::copy( &out_colptr[out_row_offset], X_colptr, X_n_rows ); } } } } else { for(uword col_copy=0; col_copy < copies_per_col; ++col_copy) { const uword out_col_offset = X_n_cols * col_copy; for(uword col=0; col < X_n_cols; ++col) { eT* out_colptr = out.colptr(col + out_col_offset); const eT* X_colptr = X.colptr(col); arrayops::copy( out_colptr, X_colptr, X_n_rows ); } } } } } template inline void op_repmat::apply(Mat& out, const Op& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword copies_per_row = in.aux_uword_a; const uword copies_per_col = in.aux_uword_b; const quasi_unwrap U(in.m); if(U.is_alias(out)) { Mat tmp; op_repmat::apply_noalias(tmp, U.M, copies_per_row, copies_per_col); out.steal_mem(tmp); } else { op_repmat::apply_noalias(out, U.M, copies_per_row, copies_per_col); } } //! @} RcppArmadillo/inst/include/armadillo_bits/cond_rel_meat.hpp0000644000176200001440000000377514301267043023710 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup cond_rel //! @{ template<> template arma_inline bool cond_rel::lt(const eT A, const eT B) { return (A < B); } template<> template arma_inline bool cond_rel::lt(const eT, const eT) { return false; } template<> template arma_inline bool cond_rel::gt(const eT A, const eT B) { return (A > B); } template<> template arma_inline bool cond_rel::gt(const eT, const eT) { return false; } template<> template arma_inline bool cond_rel::leq(const eT A, const eT B) { return (A <= B); } template<> template arma_inline bool cond_rel::leq(const eT, const eT) { return false; } template<> template arma_inline bool cond_rel::geq(const eT A, const eT B) { return (A >= B); } template<> template arma_inline bool cond_rel::geq(const eT, const eT) { return false; } template<> template arma_inline eT cond_rel::make_neg(const eT val) { return -val; } template<> template arma_inline eT cond_rel::make_neg(const eT) { return eT(0); } //! @} RcppArmadillo/inst/include/armadillo_bits/spglue_plus_meat.hpp0000644000176200001440000001627014631567470024474 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup spglue_plus //! @{ template inline void spglue_plus::apply(SpMat& out, const SpGlue& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const SpProxy pa(X.A); const SpProxy pb(X.B); const bool is_alias = pa.is_alias(out) || pb.is_alias(out); if(is_alias == false) { spglue_plus::apply_noalias(out, pa, pb); } else { SpMat tmp; spglue_plus::apply_noalias(tmp, pa, pb); out.steal_mem(tmp); } } template inline void spglue_plus::apply_noalias(SpMat& out, const SpProxy& pa, const SpProxy& pb) { arma_debug_sigprint(); arma_conform_assert_same_size(pa.get_n_rows(), pa.get_n_cols(), pb.get_n_rows(), pb.get_n_cols(), "addition"); if(pa.get_n_nonzero() == 0) { out = pb.Q; return; } if(pb.get_n_nonzero() == 0) { out = pa.Q; return; } const uword max_n_nonzero = pa.get_n_nonzero() + pb.get_n_nonzero(); // Resize memory to upper bound out.reserve(pa.get_n_rows(), pa.get_n_cols(), max_n_nonzero); // Now iterate across both matrices. typename SpProxy::const_iterator_type x_it = pa.begin(); typename SpProxy::const_iterator_type x_end = pa.end(); typename SpProxy::const_iterator_type y_it = pb.begin(); typename SpProxy::const_iterator_type y_end = pb.end(); uword count = 0; while( (x_it != x_end) || (y_it != y_end) ) { eT out_val; const uword x_it_col = x_it.col(); const uword x_it_row = x_it.row(); const uword y_it_col = y_it.col(); const uword y_it_row = y_it.row(); bool use_y_loc = false; if(x_it == y_it) { out_val = (*x_it) + (*y_it); ++x_it; ++y_it; } else { if((x_it_col < y_it_col) || ((x_it_col == y_it_col) && (x_it_row < y_it_row))) // if y is closer to the end { out_val = (*x_it); ++x_it; } else { out_val = (*y_it); ++y_it; use_y_loc = true; } } if(out_val != eT(0)) { access::rw(out.values[count]) = out_val; const uword out_row = (use_y_loc == false) ? x_it_row : y_it_row; const uword out_col = (use_y_loc == false) ? x_it_col : y_it_col; access::rw(out.row_indices[count]) = out_row; access::rw(out.col_ptrs[out_col + 1])++; ++count; } arma_check( (count > max_n_nonzero), "internal error: spglue_plus::apply_noalias(): count > max_n_nonzero" ); } const uword out_n_cols = out.n_cols; uword* col_ptrs = access::rwp(out.col_ptrs); // Fix column pointers to be cumulative. for(uword c = 1; c <= out_n_cols; ++c) { col_ptrs[c] += col_ptrs[c - 1]; } if(count < max_n_nonzero) { if(count <= (max_n_nonzero/2)) { out.mem_resize(count); } else { // quick resize without reallocating memory and copying data access::rw( out.n_nonzero) = count; access::rw( out.values[count]) = eT(0); access::rw(out.row_indices[count]) = uword(0); } } } template inline void spglue_plus::apply_noalias(SpMat& out, const SpMat& A, const SpMat& B) { arma_debug_sigprint(); const SpProxy< SpMat > pa(A); const SpProxy< SpMat > pb(B); spglue_plus::apply_noalias(out, pa, pb); } // template inline void spglue_plus_mixed::apply(SpMat::eT>& out, const mtSpGlue::eT, T1, T2, spglue_plus_mixed>& expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT1; typedef typename T2::elem_type eT2; typedef typename promote_type::result out_eT; promote_type::check(); if( (is_same_type::no) && (is_same_type::yes) ) { // upgrade T1 const unwrap_spmat UA(expr.A); const unwrap_spmat UB(expr.B); const SpMat& A = UA.M; const SpMat& B = UB.M; SpMat AA(arma_layout_indicator(), A); for(uword i=0; i < A.n_nonzero; ++i) { access::rw(AA.values[i]) = out_eT(A.values[i]); } const SpMat& BB = reinterpret_cast< const SpMat& >(B); out = AA + BB; } else if( (is_same_type::yes) && (is_same_type::no) ) { // upgrade T2 const unwrap_spmat UA(expr.A); const unwrap_spmat UB(expr.B); const SpMat& A = UA.M; const SpMat& B = UB.M; const SpMat& AA = reinterpret_cast< const SpMat& >(A); SpMat BB(arma_layout_indicator(), B); for(uword i=0; i < B.n_nonzero; ++i) { access::rw(BB.values[i]) = out_eT(B.values[i]); } out = AA + BB; } else { // upgrade T1 and T2 const unwrap_spmat UA(expr.A); const unwrap_spmat UB(expr.B); const SpMat& A = UA.M; const SpMat& B = UB.M; SpMat AA(arma_layout_indicator(), A); SpMat BB(arma_layout_indicator(), B); for(uword i=0; i < A.n_nonzero; ++i) { access::rw(AA.values[i]) = out_eT(A.values[i]); } for(uword i=0; i < B.n_nonzero; ++i) { access::rw(BB.values[i]) = out_eT(B.values[i]); } out = AA + BB; } } template inline void spglue_plus_mixed::dense_plus_sparse(Mat< typename promote_type::result>& out, const T1& X, const T2& Y) { arma_debug_sigprint(); typedef typename T1::elem_type eT1; typedef typename T2::elem_type eT2; typedef typename promote_type::result out_eT; promote_type::check(); if(is_same_type::no) { out = conv_to< Mat >::from(X); } else { const quasi_unwrap UA(X); const Mat& A = UA.M; out = reinterpret_cast< const Mat& >(A); } const SpProxy pb(Y); arma_conform_assert_same_size( out.n_rows, out.n_cols, pb.get_n_rows(), pb.get_n_cols(), "addition" ); typename SpProxy::const_iterator_type it = pb.begin(); typename SpProxy::const_iterator_type it_end = pb.end(); while(it != it_end) { out.at(it.row(), it.col()) += out_eT(*it); ++it; } } //! @} RcppArmadillo/inst/include/armadillo_bits/op_sqrtmat_bones.hpp0000644000176200001440000000453314301267043024465 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_sqrtmat //! @{ class op_sqrtmat : public traits_op_default { public: template inline static void apply(Mat< std::complex >& out, const mtOp,T1,op_sqrtmat>& in); template inline static bool apply_direct(Mat< std::complex >& out, const Op& expr); template inline static bool apply_direct(Mat< std::complex >& out, const Base& expr); }; class op_sqrtmat_cx : public traits_op_default { public: template inline static void apply(Mat& out, const Op& in); template inline static bool apply_direct(Mat& out, const Op& expr); template inline static bool apply_direct_noalias(Mat& out, const diagmat_proxy& P); template inline static bool apply_direct(Mat& out, const Base& expr); template inline static bool helper(Mat< std::complex >& S); }; class op_sqrtmat_sympd : public traits_op_default { public: template inline static void apply(Mat& out, const Op& in); template inline static bool apply_direct(Mat& out, const Base& expr); }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_fft_meat.hpp0000644000176200001440000001730514770765377023421 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_fft //! @{ #if defined(ARMA_USE_FFTW3) template class fft_engine_wrapper { public: static constexpr uword threshold = 512; fft_engine_kissfft* worker_kissfft = nullptr; fft_engine_fftw3 * worker_fftw3 = nullptr; inline ~fft_engine_wrapper() { arma_debug_sigprint(); if(worker_kissfft != nullptr) { delete worker_kissfft; } if(worker_fftw3 != nullptr) { delete worker_fftw3; } } inline fft_engine_wrapper(const uword N_samples, const uword N_exec) { arma_debug_sigprint(); const bool use_fftw3 = N_samples >= (threshold / N_exec); worker_kissfft = (use_fftw3 == false) ? new fft_engine_kissfft(N_samples) : nullptr; worker_fftw3 = (use_fftw3 == true ) ? new fft_engine_fftw3 (N_samples) : nullptr; } inline void run(cx_type* Y, const cx_type* X) { arma_debug_sigprint(); if(worker_kissfft != nullptr) { (*worker_kissfft).run(Y,X); } else if(worker_fftw3 != nullptr) { (*worker_fftw3).run(Y,X); } } }; #endif // // op_fft_real template inline void op_fft_real::apply( Mat< std::complex >& out, const mtOp,T1,op_fft_real>& in ) { arma_debug_sigprint(); typedef typename T1::pod_type in_eT; typedef typename std::complex out_eT; // no need to worry about aliasing, as we're going from a real object to complex complex, which by definition cannot alias const quasi_unwrap U(in.m); const Mat& X = U.M; const uword n_rows = X.n_rows; const uword n_cols = X.n_cols; const uword n_elem = X.n_elem; const bool is_vec = ( (n_rows == 1) || (n_cols == 1) ); const uword N_orig = (is_vec) ? n_elem : n_rows; const uword N_user = (in.aux_uword_b == 0) ? in.aux_uword_a : N_orig; #if defined(ARMA_USE_FFTW3) const uword N_exec = (is_vec) ? uword(1) : n_cols; fft_engine_wrapper worker(N_user, N_exec); #else fft_engine_kissfft worker(N_user); #endif if(is_vec) { (n_cols == 1) ? out.set_size(N_user, 1) : out.set_size(1, N_user); if( (out.n_elem == 0) || (N_orig == 0) ) { out.zeros(); return; } if( (N_user == 1) && (N_orig >= 1) ) { out[0] = out_eT( X[0] ); return; } podarray data(N_user, arma_zeros_indicator()); out_eT* data_mem = data.memptr(); const in_eT* X_mem = X.memptr(); const uword N = (std::min)(N_user, N_orig); for(uword i=0; i < N; ++i) { data_mem[i].real(X_mem[i]); } worker.run( out.memptr(), data_mem ); } else { // process each column separately out.set_size(N_user, n_cols); if( (out.n_elem == 0) || (N_orig == 0) ) { out.zeros(); return; } if( (N_user == 1) && (N_orig >= 1) ) { for(uword col=0; col < n_cols; ++col) { out.at(0,col).real( X.at(0,col) ); } return; } podarray data(N_user, arma_zeros_indicator()); out_eT* data_mem = data.memptr(); const uword N = (std::min)(N_user, N_orig); for(uword col=0; col < n_cols; ++col) { for(uword i=0; i < N; ++i) { data_mem[i].real( X.at(i, col) ); } worker.run( out.colptr(col), data_mem ); } } } // // op_fft_cx template inline void op_fft_cx::apply(Mat& out, const Op& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const quasi_unwrap U(in.m); if(U.is_alias(out)) { Mat tmp; op_fft_cx::apply_noalias(tmp, U.M, in.aux_uword_a, in.aux_uword_b); out.steal_mem(tmp); } else { op_fft_cx::apply_noalias(out, U.M, in.aux_uword_a, in.aux_uword_b); } } template inline void op_fft_cx::apply_noalias(Mat& out, const Mat& X, const uword a, const uword b) { arma_debug_sigprint(); const uword n_rows = X.n_rows; const uword n_cols = X.n_cols; const uword n_elem = X.n_elem; const bool is_vec = ( (n_rows == 1) || (n_cols == 1) ); const uword N_orig = (is_vec) ? n_elem : n_rows; const uword N_user = (b == 0) ? a : N_orig; #if defined(ARMA_USE_FFTW3) const uword N_exec = (is_vec) ? uword(1) : n_cols; fft_engine_wrapper worker(N_user, N_exec); #else fft_engine_kissfft worker(N_user); #endif if(is_vec) { (n_cols == 1) ? out.set_size(N_user, 1) : out.set_size(1, N_user); if( (out.n_elem == 0) || (N_orig == 0) ) { out.zeros(); return; } if( (N_user == 1) && (N_orig >= 1) ) { out[0] = X[0]; return; } if(N_user > N_orig) { podarray data(N_user); eT* data_mem = data.memptr(); arrayops::fill_zeros( &data_mem[N_orig], (N_user - N_orig) ); arrayops::copy(data_mem, X.memptr(), (std::min)(N_user, N_orig)); worker.run( out.memptr(), data_mem ); } else { worker.run( out.memptr(), X.memptr() ); } } else { // process each column separately out.set_size(N_user, n_cols); if( (out.n_elem == 0) || (N_orig == 0) ) { out.zeros(); return; } if( (N_user == 1) && (N_orig >= 1) ) { for(uword col=0; col < n_cols; ++col) { out.at(0,col) = X.at(0,col); } return; } if(N_user > N_orig) { podarray data(N_user); eT* data_mem = data.memptr(); arrayops::fill_zeros( &data_mem[N_orig], (N_user - N_orig) ); const uword N = (std::min)(N_user, N_orig); for(uword col=0; col < n_cols; ++col) { arrayops::copy(data_mem, X.colptr(col), N); worker.run( out.colptr(col), data_mem ); } } else { for(uword col=0; col < n_cols; ++col) { worker.run( out.colptr(col), X.colptr(col) ); } } } // correct the scaling for the inverse transform if(inverse) { typedef typename get_pod_type::result T; const T k = T(1) / T(N_user); eT* out_mem = out.memptr(); const uword out_n_elem = out.n_elem; for(uword i=0; i < out_n_elem; ++i) { out_mem[i] *= k; } } } // // op_ifft_cx template inline void op_ifft_cx::apply(Mat& out, const Op& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const quasi_unwrap U(in.m); if(U.is_alias(out)) { Mat tmp; op_fft_cx::apply_noalias(tmp, U.M, in.aux_uword_a, in.aux_uword_b); out.steal_mem(tmp); } else { op_fft_cx::apply_noalias(out, U.M, in.aux_uword_a, in.aux_uword_b); } } //! @} RcppArmadillo/inst/include/armadillo_bits/op_mean_bones.hpp0000644000176200001440000000425415030507611023710 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_mean //! @{ //! Class for finding mean values of a matrix class op_mean : public traits_op_xvec { public: // dense matrices template inline static void apply(Mat& out, const Op& in); template inline static void apply_noalias(Mat& out, const Mat& X, const uword dim); // cubes template inline static void apply(Cube& out, const OpCube& in); template inline static void apply_noalias(Cube& out, const Cube& X, const uword dim); // template inline static eT direct_mean(const eT* X_mem, const uword N); template inline static eT direct_mean_robust(const eT old_mean, const eT* X_mem, const uword N); // template inline static typename T1::elem_type mean_all(const T1& X); template inline static typename T1::elem_type mean_all(const Op& X); template inline static eT mean_all_omit(const eT* X_mem, const uword N, functor is_omitted); // template arma_inline static eT robust_mean(const eT A, const eT B); template arma_inline static std::complex robust_mean(const std::complex& A, const std::complex& B); }; //! @} RcppArmadillo/inst/include/armadillo_bits/fn_as_scalar.hpp0000644000176200001440000002741414634016465023535 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_as_scalar //! @{ struct as_scalar_errmsg { arma_cold arma_noinline static std::string incompat_size_string(const uword n_rows, const uword n_cols) { std::ostringstream tmp; tmp << "as_scalar(): expected 1x1 matrix; got " << n_rows << 'x' << n_cols; return tmp.str(); } arma_cold arma_noinline static std::string incompat_size_string(const uword n_rows, const uword n_cols, const uword n_slices) { std::ostringstream tmp; tmp << "as_scalar(): expected 1x1x1 cube; got " << n_rows << 'x' << n_cols << 'x' << n_slices; return tmp.str(); } }; template struct as_scalar_redirect { template inline static typename T1::elem_type apply(const T1& X); }; template<> struct as_scalar_redirect<2> { template inline static typename T1::elem_type apply(const Glue& X); inline static void check_size(const uword A_n_rows, const uword A_n_cols, const uword B_n_rows, const uword B_n_cols); }; template<> struct as_scalar_redirect<3> { template inline static typename T1::elem_type apply(const Glue< Glue, T3, glue_times>& X); }; template template inline typename T1::elem_type as_scalar_redirect::apply(const T1& X) { arma_debug_sigprint(); const Proxy P(X); if( (arma_config::check_conform) && (P.get_n_elem() != 1) ) { arma_conform_check_bounds( true, as_scalar_errmsg::incompat_size_string(P.get_n_rows(), P.get_n_cols()) ); } return (Proxy::use_at) ? P.at(0,0) : P[0]; } template inline typename T1::elem_type as_scalar_redirect<2>::apply(const Glue& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; // T1 must result in a matrix with one row // T2 must result in a matrix with one column // element type must non-complex constexpr bool proxy_is_mat = (is_Mat::stored_type>::value && is_Mat::stored_type>::value); constexpr bool use_at = (Proxy::use_at) || (Proxy::use_at); constexpr bool fast_unwrap = (partial_unwrap::is_fast && partial_unwrap::is_fast); if(proxy_is_mat || use_at || fast_unwrap) { const partial_unwrap tmp1(X.A); const partial_unwrap tmp2(X.B); typedef typename partial_unwrap::stored_type TA; typedef typename partial_unwrap::stored_type TB; const TA& A = tmp1.M; const TB& B = tmp2.M; const uword A_n_rows = (tmp1.do_trans == false) ? (TA::is_row ? 1 : A.n_rows) : (TA::is_col ? 1 : A.n_cols); const uword A_n_cols = (tmp1.do_trans == false) ? (TA::is_col ? 1 : A.n_cols) : (TA::is_row ? 1 : A.n_rows); const uword B_n_rows = (tmp2.do_trans == false) ? (TB::is_row ? 1 : B.n_rows) : (TB::is_col ? 1 : B.n_cols); const uword B_n_cols = (tmp2.do_trans == false) ? (TB::is_col ? 1 : B.n_cols) : (TB::is_row ? 1 : B.n_rows); if( (arma_config::check_conform) && ((A_n_rows != 1) || (B_n_cols != 1) || (A_n_cols != B_n_rows)) ) { as_scalar_redirect<2>::check_size(A_n_rows, A_n_cols, B_n_rows, B_n_cols); } const eT val = op_dot::direct_dot(A.n_elem, A.memptr(), B.memptr()); return (tmp1.do_times || tmp2.do_times) ? (val * tmp1.get_val() * tmp2.get_val()) : val; } else { const Proxy PA(X.A); const Proxy PB(X.B); const uword A_n_rows = PA.get_n_rows(); const uword A_n_cols = PA.get_n_cols(); const uword B_n_rows = PB.get_n_rows(); const uword B_n_cols = PB.get_n_cols(); if( (arma_config::check_conform) && ((A_n_rows != 1) || (B_n_cols != 1) || (A_n_cols != B_n_rows)) ) { as_scalar_redirect<2>::check_size(A_n_rows, A_n_cols, B_n_rows, B_n_cols); } return op_dot::apply_proxy_linear(PA,PB); } } inline void as_scalar_redirect<2>::check_size(const uword A_n_rows, const uword A_n_cols, const uword B_n_rows, const uword B_n_cols) { arma_conform_assert_mul_size(A_n_rows, A_n_cols, B_n_rows, B_n_cols, "matrix multiplication"); arma_conform_check_bounds( ((A_n_rows != 1) || (B_n_cols != 1)), as_scalar_errmsg::incompat_size_string(A_n_rows, B_n_cols) ); } template inline typename T1::elem_type as_scalar_redirect<3>::apply(const Glue< Glue, T3, glue_times >& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; // T1 * T2 must result in a matrix with one row // T3 must result in a matrix with one column // element type must non-complex typedef typename strip_inv ::stored_type T2_stripped_1; typedef typename strip_diagmat::stored_type T2_stripped_2; const strip_inv strip1(X.A.B); const strip_diagmat strip2(strip1.M); constexpr bool tmp2_do_inv_gen = strip1.do_inv_gen && arma_config::optimise_invexpr; constexpr bool tmp2_do_diagmat = strip2.do_diagmat; if(tmp2_do_diagmat == false) { const Mat tmp(X); if( (arma_config::check_conform) && (tmp.n_elem != 1) ) { arma_conform_check_bounds(true, as_scalar_errmsg::incompat_size_string(tmp.n_rows, tmp.n_cols) ); } return tmp[0]; } else { const partial_unwrap tmp1(X.A.A); const partial_unwrap tmp2(strip2.M); const partial_unwrap tmp3(X.B); const Mat& A = tmp1.M; const Mat& B = tmp2.M; const Mat& C = tmp3.M; const uword A_n_rows = (tmp1.do_trans == false) ? A.n_rows : A.n_cols; const uword A_n_cols = (tmp1.do_trans == false) ? A.n_cols : A.n_rows; const bool B_is_vec = B.is_vec(); const uword B_n_rows = (B_is_vec) ? B.n_elem : ( (tmp2.do_trans == false) ? B.n_rows : B.n_cols ); const uword B_n_cols = (B_is_vec) ? B.n_elem : ( (tmp2.do_trans == false) ? B.n_cols : B.n_rows ); const uword C_n_rows = (tmp3.do_trans == false) ? C.n_rows : C.n_cols; const uword C_n_cols = (tmp3.do_trans == false) ? C.n_cols : C.n_rows; const eT val = tmp1.get_val() * tmp2.get_val() * tmp3.get_val(); arma_conform_check_bounds ( (A_n_rows != 1) || (C_n_cols != 1) || (A_n_cols != B_n_rows) || (B_n_cols != C_n_rows) , "as_scalar(): expected 1x1 matrix" ); if(B_is_vec) { if(tmp2_do_inv_gen) { return val * op_dotext::direct_rowvec_invdiagvec_colvec(A.mem, B, C.mem); } else { return val * op_dot::direct_dot(A.n_elem, A.mem, B.mem, C.mem); } } else { if(tmp2_do_inv_gen) { return val * op_dotext::direct_rowvec_invdiagmat_colvec(A.mem, B, C.mem); } else { return val * op_dotext::direct_rowvec_diagmat_colvec(A.mem, B, C.mem); } } } } template inline typename T1::elem_type as_scalar_diag(const Base& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const unwrap tmp(X.get_ref()); const Mat& A = tmp.M; arma_conform_check_bounds( (A.n_elem != 1), "as_scalar(): expected 1x1 matrix" ); return A.mem[0]; } template inline typename T1::elem_type as_scalar_diag(const Glue< Glue, T3, glue_times >& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; // T1 * T2 must result in a matrix with one row // T3 must result in a matrix with one column typedef typename strip_diagmat::stored_type T2_stripped; const strip_diagmat strip(X.A.B); const partial_unwrap tmp1(X.A.A); const partial_unwrap tmp2(strip.M); const partial_unwrap tmp3(X.B); const Mat& A = tmp1.M; const Mat& B = tmp2.M; const Mat& C = tmp3.M; const uword A_n_rows = (tmp1.do_trans == false) ? A.n_rows : A.n_cols; const uword A_n_cols = (tmp1.do_trans == false) ? A.n_cols : A.n_rows; const bool B_is_vec = B.is_vec(); const uword B_n_rows = (B_is_vec) ? B.n_elem : ( (tmp2.do_trans == false) ? B.n_rows : B.n_cols ); const uword B_n_cols = (B_is_vec) ? B.n_elem : ( (tmp2.do_trans == false) ? B.n_cols : B.n_rows ); const uword C_n_rows = (tmp3.do_trans == false) ? C.n_rows : C.n_cols; const uword C_n_cols = (tmp3.do_trans == false) ? C.n_cols : C.n_rows; const eT val = tmp1.get_val() * tmp2.get_val() * tmp3.get_val(); arma_conform_check_bounds ( (A_n_rows != 1) || (C_n_cols != 1) || (A_n_cols != B_n_rows) || (B_n_cols != C_n_rows) , "as_scalar(): expected 1x1 matrix" ); if(B_is_vec) { return val * op_dot::direct_dot(A.n_elem, A.mem, B.mem, C.mem); } else { return val * op_dotext::direct_rowvec_diagmat_colvec(A.mem, B, C.mem); } } template arma_warn_unused inline typename T1::elem_type as_scalar(const Glue& X, const typename arma_not_cx::result* junk = nullptr) { arma_debug_sigprint(); arma_ignore(junk); if(is_glue_times_diag::value) { return as_scalar_diag(X); } constexpr uword N_mat = 1 + depth_lhs< glue_times, Glue >::num; arma_debug_print(arma_str::format("N_mat: %u") % N_mat); return as_scalar_redirect::apply(X); } template arma_warn_unused inline typename T1::elem_type as_scalar(const Base& X) { arma_debug_sigprint(); const Proxy P(X.get_ref()); if( (arma_config::check_conform) && (P.get_n_elem() != 1) ) { arma_conform_check_bounds( true, as_scalar_errmsg::incompat_size_string(P.get_n_rows(), P.get_n_cols()) ); } return (Proxy::use_at) ? P.at(0,0) : P[0]; } template arma_warn_unused inline typename T1::elem_type as_scalar(const BaseCube& X) { arma_debug_sigprint(); const ProxyCube P(X.get_ref()); if( (arma_config::check_conform) && (P.get_n_elem() != 1) ) { arma_conform_check_bounds( true, as_scalar_errmsg::incompat_size_string(P.get_n_rows(), P.get_n_cols(), P.get_n_slices()) ); } return (ProxyCube::use_at) ? P.at(0,0,0) : P[0]; } template arma_warn_unused arma_inline typename arma_scalar_only::result as_scalar(const T& x) { return x; } template arma_warn_unused inline typename T1::elem_type as_scalar(const SpBase& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const unwrap_spmat tmp(X.get_ref()); const SpMat& A = tmp.M; if( (arma_config::check_conform) && (A.n_elem != 1) ) { arma_conform_check_bounds(true, as_scalar_errmsg::incompat_size_string(A.n_rows, A.n_cols) ); } return A.at(0,0); } //! @} RcppArmadillo/inst/include/armadillo_bits/glue_conv_bones.hpp0000644000176200001440000000317514301267043024256 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup glue_conv //! @{ class glue_conv { public: template struct traits { static constexpr bool is_row = T1::is_row; static constexpr bool is_col = T1::is_col; static constexpr bool is_xvec = T1::is_xvec; }; template inline static void apply(Mat& out, const Mat& A, const Mat& B, const bool A_is_col); template inline static void apply(Mat& out, const Glue& X); }; class glue_conv2 : public traits_glue_default { public: template inline static void apply(Mat& out, const Mat& A, const Mat& B); template inline static void apply(Mat& out, const Glue& expr); }; //! @} RcppArmadillo/inst/include/armadillo_bits/SizeMat_meat.hpp0000644000176200001440000000527614631567470023512 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup SizeMat //! @{ inline SizeMat::SizeMat(const uword in_n_rows, const uword in_n_cols) : n_rows(in_n_rows) , n_cols(in_n_cols) { arma_debug_sigprint(); } inline uword SizeMat::operator[](const uword dim) const { if(dim == 0) { return n_rows; } if(dim == 1) { return n_cols; } return uword(1); } inline uword SizeMat::operator()(const uword dim) const { if(dim == 0) { return n_rows; } if(dim == 1) { return n_cols; } arma_conform_check_bounds(true, "size(): index out of bounds"); return uword(1); } inline bool SizeMat::operator==(const SizeMat& s) const { if(n_rows != s.n_rows) { return false; } if(n_cols != s.n_cols) { return false; } return true; } inline bool SizeMat::operator!=(const SizeMat& s) const { if(n_rows != s.n_rows) { return true; } if(n_cols != s.n_cols) { return true; } return false; } inline SizeMat SizeMat::operator+(const SizeMat& s) const { return SizeMat( (n_rows + s.n_rows), (n_cols + s.n_cols) ); } inline SizeMat SizeMat::operator-(const SizeMat& s) const { const uword out_n_rows = (n_rows > s.n_rows) ? (n_rows - s.n_rows) : uword(0); const uword out_n_cols = (n_cols > s.n_cols) ? (n_cols - s.n_cols) : uword(0); return SizeMat(out_n_rows, out_n_cols); } inline SizeMat SizeMat::operator+(const uword val) const { return SizeMat( (n_rows + val), (n_cols + val) ); } inline SizeMat SizeMat::operator-(const uword val) const { const uword out_n_rows = (n_rows > val) ? (n_rows - val) : uword(0); const uword out_n_cols = (n_cols > val) ? (n_cols - val) : uword(0); return SizeMat(out_n_rows, out_n_cols); } inline SizeMat SizeMat::operator*(const uword val) const { return SizeMat( (n_rows * val), (n_cols * val) ); } inline SizeMat SizeMat::operator/(const uword val) const { return SizeMat( (n_rows / val), (n_cols / val) ); } //! @} RcppArmadillo/inst/include/armadillo_bits/operator_schur.hpp0000644000176200001440000002145214631567470024161 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup operator_schur //! @{ // operator %, which we define it to do a schur product (element-wise multiplication) //! element-wise multiplication of user-accessible Armadillo objects with same element type template arma_inline typename enable_if2 < is_arma_type::value && is_arma_type::value && is_same_type::value, const eGlue >::result operator% ( const T1& X, const T2& Y ) { arma_debug_sigprint(); return eGlue(X, Y); } //! element-wise multiplication of user-accessible Armadillo objects with different element types template inline typename enable_if2 < (is_arma_type::value && is_arma_type::value && (is_same_type::no)), const mtGlue::result, T1, T2, glue_mixed_schur> >::result operator% ( const T1& X, const T2& Y ) { arma_debug_sigprint(); typedef typename T1::elem_type eT1; typedef typename T2::elem_type eT2; typedef typename promote_type::result out_eT; promote_type::check(); return mtGlue( X, Y ); } //! element-wise multiplication of two sparse matrices template inline typename enable_if2 < (is_arma_sparse_type::value && is_arma_sparse_type::value && is_same_type::value), SpGlue >::result operator% ( const T1& x, const T2& y ) { arma_debug_sigprint(); return SpGlue(x, y); } //! element-wise multiplication of one dense and one sparse object template inline typename enable_if2 < (is_arma_type::value && is_arma_sparse_type::value && is_same_type::value), SpMat >::result operator% ( const T1& x, const T2& y ) { arma_debug_sigprint(); SpMat out; spglue_schur_misc::dense_schur_sparse(out, x, y); return out; } //! element-wise multiplication of one sparse and one dense object template inline typename enable_if2 < (is_arma_sparse_type::value && is_arma_type::value && is_same_type::value), SpMat >::result operator% ( const T1& x, const T2& y ) { arma_debug_sigprint(); SpMat out; // Just call the other order (these operations are commutative) // TODO: if there is a matrix size mismatch, the debug assert will print the matrix sizes in wrong order spglue_schur_misc::dense_schur_sparse(out, y, x); return out; } //! optimization: sparse % (sparse +/- scalar) can be done without forming the dense result of the (sparse +/- scalar) term template inline typename enable_if2 < ( is_arma_sparse_type::value && is_arma_sparse_type::value && is_same_type::yes && (is_same_type::value || is_same_type::value || is_same_type::value) ), SpMat >::result operator% ( const T1& x, const SpToDOp& y ) { arma_debug_sigprint(); SpMat out; op_type::apply_inside_schur(out, x, y); return out; } //! optimization: (sparse +/- scalar) % sparse can be done without forming the dense result of the (sparse +/- scalar) term template inline typename enable_if2 < ( is_arma_sparse_type::value && is_arma_sparse_type::value && is_same_type::yes && (is_same_type::value || is_same_type::value || is_same_type::value) ), SpMat >::result operator% ( const SpToDOp& x, const T2& y ) { arma_debug_sigprint(); SpMat out; // Just call the other order (these operations are commutative) // TODO: if there is a matrix size mismatch, the debug assert will print the matrix sizes in wrong order op_type::apply_inside_schur(out, y, x); return out; } //! element-wise multiplication of two sparse objects with different element types template inline typename enable_if2 < (is_arma_sparse_type::value && is_arma_sparse_type::value && is_same_type::no), const mtSpGlue< typename promote_type::result, T1, T2, spglue_schur_mixed > >::result operator% ( const T1& X, const T2& Y ) { arma_debug_sigprint(); typedef typename T1::elem_type eT1; typedef typename T2::elem_type eT2; typedef typename promote_type::result out_eT; promote_type::check(); return mtSpGlue( X, Y ); } //! element-wise multiplication of one dense and one sparse object with different element types template inline typename enable_if2 < (is_arma_type::value && is_arma_sparse_type::value && is_same_type::no), SpMat< typename promote_type::result > >::result operator% ( const T1& x, const T2& y ) { arma_debug_sigprint(); SpMat< typename promote_type::result > out; spglue_schur_mixed::dense_schur_sparse(out, x, y); return out; } //! element-wise multiplication of one sparse and one dense object with different element types template inline typename enable_if2 < (is_arma_sparse_type::value && is_arma_type::value && is_same_type::no), SpMat< typename promote_type::result > >::result operator% ( const T1& x, const T2& y ) { arma_debug_sigprint(); SpMat< typename promote_type::result > out; // Just call the other order (these operations are commutative) // TODO: if there is a matrix size mismatch, the debug assert will print the matrix sizes in wrong order spglue_schur_mixed::dense_schur_sparse(out, y, x); return out; } template inline Mat operator% ( const subview_each1& X, const Base& Y ) { arma_debug_sigprint(); return subview_each1_aux::operator_schur(X, Y.get_ref()); } template arma_inline Mat operator% ( const Base& X, const subview_each1& Y ) { arma_debug_sigprint(); return subview_each1_aux::operator_schur(Y, X.get_ref()); // NOTE: swapped order } template inline Mat operator% ( const subview_each2& X, const Base& Y ) { arma_debug_sigprint(); return subview_each2_aux::operator_schur(X, Y.get_ref()); } template arma_inline Mat operator% ( const Base& X, const subview_each2& Y ) { arma_debug_sigprint(); return subview_each2_aux::operator_schur(Y, X.get_ref()); // NOTE: swapped order } //! @} RcppArmadillo/inst/include/armadillo_bits/glue_intersect_bones.hpp0000644000176200001440000000274414301267043025312 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup glue_intersect //! @{ class glue_intersect { public: template struct traits { static constexpr bool is_row = (T1::is_row && T2::is_row); static constexpr bool is_col = (T1::is_col || T2::is_col); static constexpr bool is_xvec = false; }; template inline static void apply(Mat& out, const Glue& X); template inline static void apply(Mat& out, uvec& iA, uvec& iB, const Base& A_expr, const Base& B_expr, const bool calc_indx); }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_sp_vecnorm_bones.hpp0000644000176200001440000000310014634016465025143 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_sp_vecnorm //! @{ class op_sp_vecnorm : public traits_op_xvec { public: template inline static void apply(Mat& out, const mtSpReduceOp& expr); template inline static void apply_direct(Mat< typename get_pod_type::result >& out, const SpMat& X, const uword k); }; // class op_sp_vecnorm_ext : public traits_op_xvec { public: template inline static void apply(Mat& out, const mtSpReduceOp& expr); template inline static void apply_direct(Mat< typename get_pod_type::result >& out, const SpMat& X, const uword method_id); }; //! @} RcppArmadillo/inst/include/armadillo_bits/glue_max_bones.hpp0000644000176200001440000000272414301267043024075 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup glue_max //! @{ class glue_max : public traits_glue_or { public: // dense matrices template inline static void apply(Mat& out, const Glue& X); template inline static void apply(Mat& out, const Proxy& PA, const Proxy& PB); // cubes template inline static void apply(Cube& out, const GlueCube& X); template inline static void apply(Cube& out, const ProxyCube& PA, const ProxyCube& PB); }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_row_as_mat_meat.hpp0000644000176200001440000000325714631567470024764 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_row_as_mat //! @{ template inline void op_row_as_mat::apply(Mat& out, const CubeToMatOp& expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const unwrap_cube U(expr.m); const Cube& A = U.M; const uword in_row = expr.aux_uword; arma_conform_check_bounds( (in_row >= A.n_rows), "Cube::row_as_mat(): index out of bounds" ); const uword A_n_cols = A.n_cols; const uword A_n_rows = A.n_rows; const uword A_n_slices = A.n_slices; out.set_size(A_n_slices, A_n_cols); for(uword s=0; s < A_n_slices; ++s) { const eT* A_mem = &(A.at(in_row, 0, s)); eT* out_mem = &(out.at(s,0)); for(uword c=0; c < A_n_cols; ++c) { (*out_mem) = (*A_mem); A_mem += A_n_rows; out_mem += A_n_slices; } } } //! @} RcppArmadillo/inst/include/armadillo_bits/op_index_max_bones.hpp0000644000176200001440000000341714301267043024746 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_index_max //! @{ class op_index_max : public traits_op_xvec { public: // dense matrices template inline static void apply(Mat& out, const mtOp& in); template inline static void apply_noalias(Mat& out, const Mat& X, const uword dim); // cubes template inline static void apply(Cube& out, const mtOpCube& in); template inline static void apply_noalias(Cube& out, const Cube& X, const uword dim, const typename arma_not_cx::result* junk = nullptr); template inline static void apply_noalias(Cube& out, const Cube& X, const uword dim, const typename arma_cx_only::result* junk = nullptr); // sparse matrices template inline static void apply(Mat& out, const SpBase& expr, const uword dim); }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_shuffle_bones.hpp0000644000176200001440000000246214301267043024425 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_shuffle //! @{ class op_shuffle : public traits_op_default { public: template inline static void apply_direct(Mat& out, const Mat& X, const uword dim); template inline static void apply(Mat& out, const Op& in); }; class op_shuffle_vec : public traits_op_passthru { public: template inline static void apply(Mat& out, const Op& in); }; //! @} RcppArmadillo/inst/include/armadillo_bits/spglue_relational_bones.hpp0000644000176200001440000000427014301267044026004 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup spglue_relational //! @{ class spglue_rel_lt : public traits_glue_or { public: template inline static void apply(SpMat& out, const mtSpGlue& X); template inline static void apply_noalias(SpMat& out, const SpProxy& PA, const SpProxy& PB); }; class spglue_rel_gt : public traits_glue_or { public: template inline static void apply(SpMat& out, const mtSpGlue& X); template inline static void apply_noalias(SpMat& out, const SpProxy& PA, const SpProxy& PB); }; class spglue_rel_and : public traits_glue_or { public: template inline static void apply(SpMat& out, const mtSpGlue& X); template inline static void apply_noalias(SpMat& out, const SpProxy& PA, const SpProxy& PB); }; class spglue_rel_or : public traits_glue_or { public: template inline static void apply(SpMat& out, const mtSpGlue& X); template inline static void apply_noalias(SpMat& out, const SpProxy& PA, const SpProxy& PB); }; //! @} RcppArmadillo/inst/include/armadillo_bits/glue_kron_bones.hpp0000644000176200001440000000325714301267043024263 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup glue_kron //! @{ class glue_kron { public: template struct traits { static constexpr bool is_row = (T1::is_row && T2::is_row); static constexpr bool is_col = (T1::is_col && T2::is_col); static constexpr bool is_xvec = false; }; template inline static void direct_kron(Mat& out, const Mat& A, const Mat& B); template inline static void direct_kron(Mat< std::complex >& out, const Mat< std::complex >& A, const Mat& B); template inline static void direct_kron(Mat< std::complex >& out, const Mat& A, const Mat< std::complex >& B); template inline static void apply(Mat& out, const Glue& X); }; //! @} RcppArmadillo/inst/include/armadillo_bits/fn_sort.hpp0000644000176200001440000000605214631567470022573 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_sort //! @{ template arma_warn_unused arma_inline typename enable_if2 < is_arma_type::value && resolves_to_vector::yes, const Op >::result sort ( const T1& X ) { arma_debug_sigprint(); return Op(X, 0, 0); } template arma_warn_unused arma_inline typename enable_if2 < is_arma_type::value && resolves_to_vector::no, const Op >::result sort ( const T1& X ) { arma_debug_sigprint(); return Op(X, 0, 0); } template arma_warn_unused inline typename enable_if2 < is_arma_type::value && resolves_to_vector::yes && is_same_type::value, const Op >::result sort ( const T1& X, const T2* sort_direction ) { arma_debug_sigprint(); const char sig = (sort_direction != nullptr) ? sort_direction[0] : char(0); arma_conform_check( (sig != 'a') && (sig != 'd'), "sort(): unknown sort direction" ); const uword sort_type = (sig == 'a') ? 0 : 1; return Op(X, sort_type, 0); } template arma_warn_unused inline typename enable_if2 < is_arma_type::value && resolves_to_vector::no && is_same_type::value, const Op >::result sort ( const T1& X, const T2* sort_direction ) { arma_debug_sigprint(); const char sig = (sort_direction != nullptr) ? sort_direction[0] : char(0); arma_conform_check( (sig != 'a') && (sig != 'd'), "sort(): unknown sort direction" ); const uword sort_type = (sig == 'a') ? 0 : 1; return Op(X, sort_type, 0); } template arma_warn_unused inline typename enable_if2 < ( (is_arma_type::value) && (is_same_type::value) ), const Op >::result sort ( const T1& X, const T2* sort_direction, const uword dim ) { arma_debug_sigprint(); const char sig = (sort_direction != nullptr) ? sort_direction[0] : char(0); arma_conform_check( (sig != 'a') && (sig != 'd'), "sort(): unknown sort direction" ); const uword sort_type = (sig == 'a') ? 0 : 1; return Op(X, sort_type, dim); } //! @} RcppArmadillo/inst/include/armadillo_bits/spglue_relational_meat.hpp0000644000176200001440000003155114631567470025642 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup spglue_relational //! @{ template inline void spglue_rel_lt::apply(SpMat& out, const mtSpGlue& X) { arma_debug_sigprint(); const SpProxy PA(X.A); const SpProxy PB(X.B); const bool is_alias = PA.is_alias(out) || PB.is_alias(out); if(is_alias == false) { spglue_rel_lt::apply_noalias(out, PA, PB); } else { SpMat tmp; spglue_rel_lt::apply_noalias(tmp, PA, PB); out.steal_mem(tmp); } } template inline void spglue_rel_lt::apply_noalias(SpMat& out, const SpProxy& PA, const SpProxy& PB) { arma_debug_sigprint(); typedef typename T1::elem_type eT; arma_conform_assert_same_size(PA.get_n_rows(), PA.get_n_cols(), PB.get_n_rows(), PB.get_n_cols(), "operator<"); const uword max_n_nonzero = PA.get_n_nonzero() + PB.get_n_nonzero(); // Resize memory to upper bound out.reserve(PA.get_n_rows(), PA.get_n_cols(), max_n_nonzero); // Now iterate across both matrices. typename SpProxy::const_iterator_type x_it = PA.begin(); typename SpProxy::const_iterator_type x_end = PA.end(); typename SpProxy::const_iterator_type y_it = PB.begin(); typename SpProxy::const_iterator_type y_end = PB.end(); uword count = 0; while( (x_it != x_end) || (y_it != y_end) ) { uword out_val; const uword x_it_col = x_it.col(); const uword x_it_row = x_it.row(); const uword y_it_col = y_it.col(); const uword y_it_row = y_it.row(); bool use_y_loc = false; if(x_it == y_it) { out_val = ((*x_it) < (*y_it)) ? uword(1) : uword(0); ++x_it; ++y_it; } else { if((x_it_col < y_it_col) || ((x_it_col == y_it_col) && (x_it_row < y_it_row))) // if y is closer to the end { out_val = ((*x_it) < eT(0)) ? uword(1) : uword(0); ++x_it; } else { out_val = (eT(0) < (*y_it)) ? uword(1) : uword(0); ++y_it; use_y_loc = true; } } if(out_val != uword(0)) { access::rw(out.values[count]) = out_val; const uword out_row = (use_y_loc == false) ? x_it_row : y_it_row; const uword out_col = (use_y_loc == false) ? x_it_col : y_it_col; access::rw(out.row_indices[count]) = out_row; access::rw(out.col_ptrs[out_col + 1])++; ++count; } arma_check( (count > max_n_nonzero), "internal error: spglue_rel_lt::apply_noalias(): count > max_n_nonzero" ); } const uword out_n_cols = out.n_cols; uword* col_ptrs = access::rwp(out.col_ptrs); // Fix column pointers to be cumulative. for(uword c = 1; c <= out_n_cols; ++c) { col_ptrs[c] += col_ptrs[c - 1]; } if(count < max_n_nonzero) { if(count <= (max_n_nonzero/2)) { out.mem_resize(count); } else { // quick resize without reallocating memory and copying data access::rw( out.n_nonzero) = count; access::rw( out.values[count]) = eT(0); access::rw(out.row_indices[count]) = uword(0); } } } // template inline void spglue_rel_gt::apply(SpMat& out, const mtSpGlue& X) { arma_debug_sigprint(); const SpProxy PA(X.A); const SpProxy PB(X.B); const bool is_alias = PA.is_alias(out) || PB.is_alias(out); if(is_alias == false) { spglue_rel_gt::apply_noalias(out, PA, PB); } else { SpMat tmp; spglue_rel_gt::apply_noalias(tmp, PA, PB); out.steal_mem(tmp); } } template inline void spglue_rel_gt::apply_noalias(SpMat& out, const SpProxy& PA, const SpProxy& PB) { arma_debug_sigprint(); typedef typename T1::elem_type eT; arma_conform_assert_same_size(PA.get_n_rows(), PA.get_n_cols(), PB.get_n_rows(), PB.get_n_cols(), "operator>"); const uword max_n_nonzero = PA.get_n_nonzero() + PB.get_n_nonzero(); // Resize memory to upper bound out.reserve(PA.get_n_rows(), PA.get_n_cols(), max_n_nonzero); // Now iterate across both matrices. typename SpProxy::const_iterator_type x_it = PA.begin(); typename SpProxy::const_iterator_type x_end = PA.end(); typename SpProxy::const_iterator_type y_it = PB.begin(); typename SpProxy::const_iterator_type y_end = PB.end(); uword count = 0; while( (x_it != x_end) || (y_it != y_end) ) { uword out_val; const uword x_it_col = x_it.col(); const uword x_it_row = x_it.row(); const uword y_it_col = y_it.col(); const uword y_it_row = y_it.row(); bool use_y_loc = false; if(x_it == y_it) { out_val = ((*x_it) > (*y_it)) ? uword(1) : uword(0); ++x_it; ++y_it; } else { if((x_it_col < y_it_col) || ((x_it_col == y_it_col) && (x_it_row < y_it_row))) // if y is closer to the end { out_val = ((*x_it) > eT(0)) ? uword(1) : uword(0); ++x_it; } else { out_val = (eT(0) > (*y_it)) ? uword(1) : uword(0); ++y_it; use_y_loc = true; } } if(out_val != uword(0)) { access::rw(out.values[count]) = out_val; const uword out_row = (use_y_loc == false) ? x_it_row : y_it_row; const uword out_col = (use_y_loc == false) ? x_it_col : y_it_col; access::rw(out.row_indices[count]) = out_row; access::rw(out.col_ptrs[out_col + 1])++; ++count; } arma_check( (count > max_n_nonzero), "internal error: spglue_rel_gt::apply_noalias(): count > max_n_nonzero" ); } const uword out_n_cols = out.n_cols; uword* col_ptrs = access::rwp(out.col_ptrs); // Fix column pointers to be cumulative. for(uword c = 1; c <= out_n_cols; ++c) { col_ptrs[c] += col_ptrs[c - 1]; } if(count < max_n_nonzero) { if(count <= (max_n_nonzero/2)) { out.mem_resize(count); } else { // quick resize without reallocating memory and copying data access::rw( out.n_nonzero) = count; access::rw( out.values[count]) = eT(0); access::rw(out.row_indices[count]) = uword(0); } } } // template inline void spglue_rel_and::apply(SpMat& out, const mtSpGlue& X) { arma_debug_sigprint(); const SpProxy PA(X.A); const SpProxy PB(X.B); const bool is_alias = PA.is_alias(out) || PB.is_alias(out); if(is_alias == false) { spglue_rel_and::apply_noalias(out, PA, PB); } else { SpMat tmp; spglue_rel_and::apply_noalias(tmp, PA, PB); out.steal_mem(tmp); } } template inline void spglue_rel_and::apply_noalias(SpMat& out, const SpProxy& PA, const SpProxy& PB) { arma_debug_sigprint(); typedef typename T1::elem_type eT; arma_conform_assert_same_size(PA.get_n_rows(), PA.get_n_cols(), PB.get_n_rows(), PB.get_n_cols(), "operator&&"); if( (PA.get_n_nonzero() == 0) || (PB.get_n_nonzero() == 0) ) { out.zeros(PA.get_n_rows(), PA.get_n_cols()); return; } const uword max_n_nonzero = (std::min)(PA.get_n_nonzero(), PB.get_n_nonzero()); // Resize memory to upper bound out.reserve(PA.get_n_rows(), PA.get_n_cols(), max_n_nonzero); // Now iterate across both matrices. typename SpProxy::const_iterator_type x_it = PA.begin(); typename SpProxy::const_iterator_type x_end = PA.end(); typename SpProxy::const_iterator_type y_it = PB.begin(); typename SpProxy::const_iterator_type y_end = PB.end(); uword count = 0; while( (x_it != x_end) || (y_it != y_end) ) { const uword x_it_row = x_it.row(); const uword x_it_col = x_it.col(); const uword y_it_row = y_it.row(); const uword y_it_col = y_it.col(); if(x_it == y_it) { access::rw(out.values[count]) = uword(1); access::rw(out.row_indices[count]) = x_it_row; access::rw(out.col_ptrs[x_it_col + 1])++; ++count; ++x_it; ++y_it; } else { if((x_it_col < y_it_col) || ((x_it_col == y_it_col) && (x_it_row < y_it_row))) // if y is closer to the end { ++x_it; } else { ++y_it; } } arma_check( (count > max_n_nonzero), "internal error: spglue_rel_and::apply_noalias(): count > max_n_nonzero" ); } const uword out_n_cols = out.n_cols; uword* col_ptrs = access::rwp(out.col_ptrs); // Fix column pointers to be cumulative. for(uword c = 1; c <= out_n_cols; ++c) { col_ptrs[c] += col_ptrs[c - 1]; } if(count < max_n_nonzero) { if(count <= (max_n_nonzero/2)) { out.mem_resize(count); } else { // quick resize without reallocating memory and copying data access::rw( out.n_nonzero) = count; access::rw( out.values[count]) = eT(0); access::rw(out.row_indices[count]) = uword(0); } } } // template inline void spglue_rel_or::apply(SpMat& out, const mtSpGlue& X) { arma_debug_sigprint(); const SpProxy PA(X.A); const SpProxy PB(X.B); const bool is_alias = PA.is_alias(out) || PB.is_alias(out); if(is_alias == false) { spglue_rel_or::apply_noalias(out, PA, PB); } else { SpMat tmp; spglue_rel_or::apply_noalias(tmp, PA, PB); out.steal_mem(tmp); } } template inline void spglue_rel_or::apply_noalias(SpMat& out, const SpProxy& PA, const SpProxy& PB) { arma_debug_sigprint(); typedef typename T1::elem_type eT; arma_conform_assert_same_size(PA.get_n_rows(), PA.get_n_cols(), PB.get_n_rows(), PB.get_n_cols(), "operator||"); const uword max_n_nonzero = PA.get_n_nonzero() + PB.get_n_nonzero(); // Resize memory to upper bound out.reserve(PA.get_n_rows(), PA.get_n_cols(), max_n_nonzero); // Now iterate across both matrices. typename SpProxy::const_iterator_type x_it = PA.begin(); typename SpProxy::const_iterator_type x_end = PA.end(); typename SpProxy::const_iterator_type y_it = PB.begin(); typename SpProxy::const_iterator_type y_end = PB.end(); uword count = 0; while( (x_it != x_end) || (y_it != y_end) ) { const uword x_it_col = x_it.col(); const uword x_it_row = x_it.row(); const uword y_it_col = y_it.col(); const uword y_it_row = y_it.row(); bool use_y_loc = false; if(x_it == y_it) { ++x_it; ++y_it; } else { if((x_it_col < y_it_col) || ((x_it_col == y_it_col) && (x_it_row < y_it_row))) // if y is closer to the end { ++x_it; } else { ++y_it; use_y_loc = true; } } access::rw(out.values[count]) = uword(1); const uword out_row = (use_y_loc == false) ? x_it_row : y_it_row; const uword out_col = (use_y_loc == false) ? x_it_col : y_it_col; access::rw(out.row_indices[count]) = out_row; access::rw(out.col_ptrs[out_col + 1])++; ++count; arma_check( (count > max_n_nonzero), "internal error: spglue_rel_or::apply_noalias(): count > max_n_nonzero" ); } const uword out_n_cols = out.n_cols; uword* col_ptrs = access::rwp(out.col_ptrs); // Fix column pointers to be cumulative. for(uword c = 1; c <= out_n_cols; ++c) { col_ptrs[c] += col_ptrs[c - 1]; } if(count < max_n_nonzero) { if(count <= (max_n_nonzero/2)) { out.mem_resize(count); } else { // quick resize without reallocating memory and copying data access::rw( out.n_nonzero) = count; access::rw( out.values[count]) = eT(0); access::rw(out.row_indices[count]) = uword(0); } } } //! @} RcppArmadillo/inst/include/armadillo_bits/mtSpReduceOp_meat.hpp0000644000176200001440000000267414634016465024503 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup mtSpReduceOp //! @{ template inline mtSpReduceOp::mtSpReduceOp(const T1& in_m) : m(in_m) { arma_debug_sigprint(); } template inline mtSpReduceOp::mtSpReduceOp(const T1& in_m, const uword in_aux_uword_a, const uword in_aux_uword_b) : m(in_m) , aux_uword_a(in_aux_uword_a) , aux_uword_b(in_aux_uword_b) { arma_debug_sigprint(); } template inline mtSpReduceOp::~mtSpReduceOp() { arma_debug_sigprint(); } //! @} RcppArmadillo/inst/include/armadillo_bits/SpProxy.hpp0000644000176200001440000010235014752446051022536 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup SpProxy //! @{ // TODO: clarify and check which variables and functions are valid when 'use_iterator' is either true or false // within each specialisation of the Proxy class: // // elem_type = type of the elements obtained from object Q // pod_type = underlying type of elements if elem_type is std::complex // stored_type = type of Q object // // const_iterator_type = type of iterator provided by begin() and begin_col() // const_row_iterator_type = type of iterator provided by begin_row() // // use_iterator = boolean to indicate that provided iterators must be used for accessing elements // Q_is_generated = boolean to indicate Q object was generated by SpProxy // // is_row = boolean to indicate Q object can be treated a row vector // is_col = boolean to indicate Q object can be treated a column vector // is_xvec = boolean to indicate Q object is a vector with unknown orientation // // Q = object that can be unwrapped via unwrap_spmat family of classes (ie. Q must be convertible to SpMat) // // get_n_rows() = return number of rows in Q // get_n_cols() = return number of columns in Q // get_n_elem() = return number of elements in Q // get_n_nonzero() = return number of non-zero elements in Q // // operator[i] = linear element accessor; valid only if the 'use_iterator' boolean is false // at(row,col) = access elements via (row,col); valid only if the 'use_iterator' boolean is false // // get_values() = return pointer to CSC values array in Q; valid only if the 'use_iterator' boolean is false // get_row_indices() = return pointer to CSC row indices array in Q; valid only if the 'use_iterator' boolean is false // get_col_ptrs() = return pointer to CSC column pointers array in Q; valid only if the 'use_iterator' boolean is false // // begin() = column-wise iterator indicating first element in Q // begin_col(col_num) = column-wise iterator indicating first element in column 'col_num' in Q // begin_row(row_num = 0) = row-wise iterator indicating first element in row 'row_num' in Q // // end() = column-wise iterator indicating "one-past-end" element in Q // end_row() = row-wise iterator indicating "one-past-end" element in Q // end_row(row_num) = row-wise iterator indicating "one-past-end" element in row 'row_num' in Q // // is_alias(X) = return true/false to indicate Q object aliases matrix X template struct SpProxy< SpMat > { typedef eT elem_type; typedef typename get_pod_type::result pod_type; typedef SpMat stored_type; typedef typename SpMat::const_iterator const_iterator_type; typedef typename SpMat::const_row_iterator const_row_iterator_type; static constexpr bool use_iterator = false; static constexpr bool Q_is_generated = false; static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = false; const SpMat& Q; inline explicit SpProxy(const SpMat& A) : Q(A) { arma_debug_sigprint(); Q.sync(); } arma_inline uword get_n_rows() const { return Q.n_rows; } arma_inline uword get_n_cols() const { return Q.n_cols; } arma_inline uword get_n_elem() const { return Q.n_elem; } arma_inline uword get_n_nonzero() const { return Q.n_nonzero; } arma_inline elem_type operator[](const uword i) const { return Q[i]; } arma_inline elem_type at (const uword row, const uword col) const { return Q.at(row, col); } arma_inline const eT* get_values() const { return Q.values; } arma_inline const uword* get_row_indices() const { return Q.row_indices; } arma_inline const uword* get_col_ptrs() const { return Q.col_ptrs; } arma_inline const_iterator_type begin() const { return Q.begin(); } arma_inline const_iterator_type begin_col(const uword col_num) const { return Q.begin_col(col_num); } arma_inline const_row_iterator_type begin_row(const uword row_num = 0) const { return Q.begin_row(row_num); } arma_inline const_iterator_type end() const { return Q.end(); } arma_inline const_row_iterator_type end_row() const { return Q.end_row(); } arma_inline const_row_iterator_type end_row(const uword row_num) const { return Q.end_row(row_num); } template arma_inline bool is_alias(const SpMat& X) const { return (is_same_type::yes) && (void_ptr(&Q) == void_ptr(&X)); } }; template struct SpProxy< SpCol > { typedef eT elem_type; typedef typename get_pod_type::result pod_type; typedef SpCol stored_type; typedef typename SpCol::const_iterator const_iterator_type; typedef typename SpCol::const_row_iterator const_row_iterator_type; static constexpr bool use_iterator = false; static constexpr bool Q_is_generated = false; static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; const SpCol& Q; inline explicit SpProxy(const SpCol& A) : Q(A) { arma_debug_sigprint(); Q.sync(); } arma_inline uword get_n_rows() const { return Q.n_rows; } constexpr uword get_n_cols() const { return 1; } arma_inline uword get_n_elem() const { return Q.n_elem; } arma_inline uword get_n_nonzero() const { return Q.n_nonzero; } arma_inline elem_type operator[](const uword i) const { return Q[i]; } arma_inline elem_type at (const uword row, const uword col) const { return Q.at(row, col); } arma_inline const eT* get_values() const { return Q.values; } arma_inline const uword* get_row_indices() const { return Q.row_indices; } arma_inline const uword* get_col_ptrs() const { return Q.col_ptrs; } arma_inline const_iterator_type begin() const { return Q.begin(); } arma_inline const_iterator_type begin_col(const uword) const { return Q.begin(); } arma_inline const_row_iterator_type begin_row(const uword row_num = 0) const { return Q.begin_row(row_num); } arma_inline const_iterator_type end() const { return Q.end(); } arma_inline const_row_iterator_type end_row() const { return Q.end_row(); } arma_inline const_row_iterator_type end_row(const uword row_num) const { return Q.end_row(row_num); } template arma_inline bool is_alias(const SpMat& X) const { return (is_same_type::yes) && (void_ptr(&Q) == void_ptr(&X)); } }; template struct SpProxy< SpRow > { typedef eT elem_type; typedef typename get_pod_type::result pod_type; typedef SpRow stored_type; typedef typename SpRow::const_iterator const_iterator_type; typedef typename SpRow::const_row_iterator const_row_iterator_type; static constexpr bool use_iterator = false; static constexpr bool Q_is_generated = false; static constexpr bool is_row = true; static constexpr bool is_col = false; static constexpr bool is_xvec = false; const SpRow& Q; inline explicit SpProxy(const SpRow& A) : Q(A) { arma_debug_sigprint(); Q.sync(); } constexpr uword get_n_rows() const { return 1; } arma_inline uword get_n_cols() const { return Q.n_cols; } arma_inline uword get_n_elem() const { return Q.n_elem; } arma_inline uword get_n_nonzero() const { return Q.n_nonzero; } arma_inline elem_type operator[](const uword i) const { return Q[i]; } arma_inline elem_type at (const uword row, const uword col) const { return Q.at(row, col); } arma_inline const eT* get_values() const { return Q.values; } arma_inline const uword* get_row_indices() const { return Q.row_indices; } arma_inline const uword* get_col_ptrs() const { return Q.col_ptrs; } arma_inline const_iterator_type begin() const { return Q.begin(); } arma_inline const_iterator_type begin_col(const uword col_num) const { return Q.begin_col(col_num); } arma_inline const_row_iterator_type begin_row(const uword row_num = 0) const { return Q.begin_row(row_num); } arma_inline const_iterator_type end() const { return Q.end(); } arma_inline const_row_iterator_type end_row() const { return Q.end_row(); } arma_inline const_row_iterator_type end_row(const uword row_num) const { return Q.end_row(row_num); } template arma_inline bool is_alias(const SpMat& X) const { return (is_same_type::yes) && (void_ptr(&Q) == void_ptr(&X)); } }; template struct SpProxy< SpSubview > { typedef eT elem_type; typedef typename get_pod_type::result pod_type; typedef SpSubview stored_type; typedef typename SpSubview::const_iterator const_iterator_type; typedef typename SpSubview::const_row_iterator const_row_iterator_type; static constexpr bool use_iterator = true; static constexpr bool Q_is_generated = false; static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = false; const SpSubview& Q; inline explicit SpProxy(const SpSubview& A) : Q(A) { arma_debug_sigprint(); Q.m.sync(); } arma_inline uword get_n_rows() const { return Q.n_rows; } arma_inline uword get_n_cols() const { return Q.n_cols; } arma_inline uword get_n_elem() const { return Q.n_elem; } arma_inline uword get_n_nonzero() const { return Q.n_nonzero; } arma_inline elem_type operator[](const uword i) const { return Q[i]; } arma_inline elem_type at (const uword row, const uword col) const { return Q.at(row, col); } arma_inline const eT* get_values() const { return Q.m.values; } arma_inline const uword* get_row_indices() const { return Q.m.row_indices; } arma_inline const uword* get_col_ptrs() const { return Q.m.col_ptrs; } arma_inline const_iterator_type begin() const { return Q.begin(); } arma_inline const_iterator_type begin_col(const uword col_num) const { return Q.begin_col(col_num); } arma_inline const_row_iterator_type begin_row(const uword row_num = 0) const { return Q.begin_row(row_num); } arma_inline const_iterator_type end() const { return Q.end(); } arma_inline const_row_iterator_type end_row() const { return Q.end_row(); } arma_inline const_row_iterator_type end_row(const uword row_num) const { return Q.end_row(row_num); } template arma_inline bool is_alias(const SpMat& X) const { return (is_same_type::yes) && (void_ptr(&Q.m) == void_ptr(&X)); } }; template struct SpProxy< SpSubview_col > { typedef eT elem_type; typedef typename get_pod_type::result pod_type; typedef SpSubview_col stored_type; typedef typename SpSubview::const_iterator const_iterator_type; typedef typename SpSubview::const_row_iterator const_row_iterator_type; static constexpr bool use_iterator = true; static constexpr bool Q_is_generated = false; static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; const SpSubview_col& Q; inline explicit SpProxy(const SpSubview_col& A) : Q(A) { arma_debug_sigprint(); Q.m.sync(); } arma_inline uword get_n_rows() const { return Q.n_rows; } constexpr uword get_n_cols() const { return 1; } arma_inline uword get_n_elem() const { return Q.n_elem; } arma_inline uword get_n_nonzero() const { return Q.n_nonzero; } arma_inline elem_type operator[](const uword i) const { return Q.at(i, 0); } arma_inline elem_type at (const uword row, const uword) const { return Q.at(row, 0); } arma_inline const eT* get_values() const { return Q.m.values; } arma_inline const uword* get_row_indices() const { return Q.m.row_indices; } arma_inline const uword* get_col_ptrs() const { return Q.m.col_ptrs; } arma_inline const_iterator_type begin() const { return Q.begin(); } arma_inline const_iterator_type begin_col(const uword col_num) const { return Q.begin_col(col_num); } arma_inline const_row_iterator_type begin_row(const uword row_num = 0) const { return Q.begin_row(row_num); } arma_inline const_iterator_type end() const { return Q.end(); } arma_inline const_row_iterator_type end_row() const { return Q.end_row(); } arma_inline const_row_iterator_type end_row(const uword row_num) const { return Q.end_row(row_num); } template arma_inline bool is_alias(const SpMat& X) const { return (is_same_type::yes) && (void_ptr(&Q.m) == void_ptr(&X)); } }; template struct SpProxy< SpSubview_col_list > { typedef eT elem_type; typedef typename get_pod_type::result pod_type; typedef SpMat stored_type; typedef typename SpMat::const_iterator const_iterator_type; typedef typename SpMat::const_row_iterator const_row_iterator_type; static constexpr bool use_iterator = false; static constexpr bool Q_is_generated = true; static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = false; const SpMat Q; inline explicit SpProxy(const SpSubview_col_list& A) : Q(A) { arma_debug_sigprint(); } arma_inline uword get_n_rows() const { return Q.n_rows; } arma_inline uword get_n_cols() const { return Q.n_cols; } arma_inline uword get_n_elem() const { return Q.n_elem; } arma_inline uword get_n_nonzero() const { return Q.n_nonzero; } arma_inline elem_type operator[](const uword i) const { return Q[i]; } arma_inline elem_type at (const uword row, const uword col) const { return Q.at(row, col); } arma_inline const eT* get_values() const { return Q.values; } arma_inline const uword* get_row_indices() const { return Q.row_indices; } arma_inline const uword* get_col_ptrs() const { return Q.col_ptrs; } arma_inline const_iterator_type begin() const { return Q.begin(); } arma_inline const_iterator_type begin_col(const uword col_num) const { return Q.begin_col(col_num); } arma_inline const_row_iterator_type begin_row(const uword row_num = 0) const { return Q.begin_row(row_num); } arma_inline const_iterator_type end() const { return Q.end(); } arma_inline const_row_iterator_type end_row() const { return Q.end_row(); } arma_inline const_row_iterator_type end_row(const uword row_num) const { return Q.end_row(row_num); } template constexpr bool is_alias(const SpMat&) const { return false; } }; template struct SpProxy< SpSubview_row > { typedef eT elem_type; typedef typename get_pod_type::result pod_type; typedef SpSubview_row stored_type; typedef typename SpSubview::const_iterator const_iterator_type; typedef typename SpSubview::const_row_iterator const_row_iterator_type; static constexpr bool use_iterator = true; static constexpr bool Q_is_generated = false; static constexpr bool is_row = true; static constexpr bool is_col = false; static constexpr bool is_xvec = false; const SpSubview_row& Q; inline explicit SpProxy(const SpSubview_row& A) : Q(A) { arma_debug_sigprint(); Q.m.sync(); } constexpr uword get_n_rows() const { return 1; } arma_inline uword get_n_cols() const { return Q.n_cols; } arma_inline uword get_n_elem() const { return Q.n_elem; } arma_inline uword get_n_nonzero() const { return Q.n_nonzero; } arma_inline elem_type operator[](const uword i) const { return Q.at(0, i ); } arma_inline elem_type at (const uword, const uword col) const { return Q.at(0, col); } arma_inline const eT* get_values() const { return Q.m.values; } arma_inline const uword* get_row_indices() const { return Q.m.row_indices; } arma_inline const uword* get_col_ptrs() const { return Q.m.col_ptrs; } arma_inline const_iterator_type begin() const { return Q.begin(); } arma_inline const_iterator_type begin_col(const uword col_num) const { return Q.begin_col(col_num); } arma_inline const_row_iterator_type begin_row(const uword row_num = 0) const { return Q.begin_row(row_num); } arma_inline const_iterator_type end() const { return Q.end(); } arma_inline const_row_iterator_type end_row() const { return Q.end_row(); } arma_inline const_row_iterator_type end_row(const uword row_num) const { return Q.end_row(row_num); } template arma_inline bool is_alias(const SpMat& X) const { return (is_same_type::yes) && (void_ptr(&Q.m) == void_ptr(&X)); } }; template struct SpProxy< spdiagview > { typedef eT elem_type; typedef typename get_pod_type::result pod_type; typedef SpMat stored_type; typedef typename SpMat::const_iterator const_iterator_type; typedef typename SpMat::const_row_iterator const_row_iterator_type; static constexpr bool use_iterator = false; static constexpr bool Q_is_generated = true; static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; const SpMat Q; inline explicit SpProxy(const spdiagview& A) : Q(A) { arma_debug_sigprint(); } arma_inline uword get_n_rows() const { return Q.n_rows; } constexpr uword get_n_cols() const { return 1; } arma_inline uword get_n_elem() const { return Q.n_elem; } arma_inline uword get_n_nonzero() const { return Q.n_nonzero; } arma_inline elem_type operator[](const uword i) const { return Q[i]; } arma_inline elem_type at (const uword row, const uword col) const { return Q.at(row, col); } arma_inline const eT* get_values() const { return Q.values; } arma_inline const uword* get_row_indices() const { return Q.row_indices; } arma_inline const uword* get_col_ptrs() const { return Q.col_ptrs; } arma_inline const_iterator_type begin() const { return Q.begin(); } arma_inline const_iterator_type begin_col(const uword col_num) const { return Q.begin_col(col_num); } arma_inline const_row_iterator_type begin_row(const uword row_num = 0) const { return Q.begin_row(row_num); } arma_inline const_iterator_type end() const { return Q.end(); } arma_inline const_row_iterator_type end_row() const { return Q.end_row(); } arma_inline const_row_iterator_type end_row(const uword row_num) const { return Q.end_row(row_num); } template constexpr bool is_alias(const SpMat&) const { return false; } }; template struct SpProxy< SpOp > { typedef typename T1::elem_type elem_type; typedef typename T1::elem_type eT; typedef typename get_pod_type::result pod_type; typedef SpMat stored_type; typedef typename SpMat::const_iterator const_iterator_type; typedef typename SpMat::const_row_iterator const_row_iterator_type; static constexpr bool use_iterator = false; static constexpr bool Q_is_generated = true; static constexpr bool is_row = SpOp::is_row; static constexpr bool is_col = SpOp::is_col; static constexpr bool is_xvec = SpOp::is_xvec; const SpMat Q; inline explicit SpProxy(const SpOp& A) : Q(A) { arma_debug_sigprint(); } arma_inline uword get_n_rows() const { return is_row ? 1 : Q.n_rows; } arma_inline uword get_n_cols() const { return is_col ? 1 : Q.n_cols; } arma_inline uword get_n_elem() const { return Q.n_elem; } arma_inline uword get_n_nonzero() const { return Q.n_nonzero; } arma_inline elem_type operator[](const uword i) const { return Q[i]; } arma_inline elem_type at (const uword row, const uword col) const { return Q.at(row, col); } arma_inline const eT* get_values() const { return Q.values; } arma_inline const uword* get_row_indices() const { return Q.row_indices; } arma_inline const uword* get_col_ptrs() const { return Q.col_ptrs; } arma_inline const_iterator_type begin() const { return Q.begin(); } arma_inline const_iterator_type begin_col(const uword col_num) const { return Q.begin_col(col_num); } arma_inline const_row_iterator_type begin_row(const uword row_num = 0) const { return Q.begin_row(row_num); } arma_inline const_iterator_type end() const { return Q.end(); } arma_inline const_row_iterator_type end_row() const { return Q.end_row(); } arma_inline const_row_iterator_type end_row(const uword row_num) const { return Q.end_row(row_num); } template constexpr bool is_alias(const SpMat&) const { return false; } }; template struct SpProxy< SpGlue > { typedef typename T1::elem_type elem_type; typedef typename T1::elem_type eT; typedef typename get_pod_type::result pod_type; typedef SpMat stored_type; typedef typename SpMat::const_iterator const_iterator_type; typedef typename SpMat::const_row_iterator const_row_iterator_type; static constexpr bool use_iterator = false; static constexpr bool Q_is_generated = true; static constexpr bool is_row = SpGlue::is_row; static constexpr bool is_col = SpGlue::is_col; static constexpr bool is_xvec = SpGlue::is_xvec; const SpMat Q; inline explicit SpProxy(const SpGlue& A) : Q(A) { arma_debug_sigprint(); } arma_inline uword get_n_rows() const { return is_row ? 1 : Q.n_rows; } arma_inline uword get_n_cols() const { return is_col ? 1 : Q.n_cols; } arma_inline uword get_n_elem() const { return Q.n_elem; } arma_inline uword get_n_nonzero() const { return Q.n_nonzero; } arma_inline elem_type operator[](const uword i) const { return Q[i]; } arma_inline elem_type at (const uword row, const uword col) const { return Q.at(row, col); } arma_inline const eT* get_values() const { return Q.values; } arma_inline const uword* get_row_indices() const { return Q.row_indices; } arma_inline const uword* get_col_ptrs() const { return Q.col_ptrs; } arma_inline const_iterator_type begin() const { return Q.begin(); } arma_inline const_iterator_type begin_col(const uword col_num) const { return Q.begin_col(col_num); } arma_inline const_row_iterator_type begin_row(const uword row_num = 0) const { return Q.begin_row(row_num); } arma_inline const_iterator_type end() const { return Q.end(); } arma_inline const_row_iterator_type end_row() const { return Q.end_row(); } arma_inline const_row_iterator_type end_row(const uword row_num) const { return Q.end_row(row_num); } template constexpr bool is_alias(const SpMat&) const { return false; } }; template struct SpProxy< mtSpOp > { typedef out_eT elem_type; typedef typename get_pod_type::result pod_type; typedef SpMat stored_type; typedef typename SpMat::const_iterator const_iterator_type; typedef typename SpMat::const_row_iterator const_row_iterator_type; static constexpr bool use_iterator = false; static constexpr bool Q_is_generated = true; static constexpr bool is_row = mtSpOp::is_row; static constexpr bool is_col = mtSpOp::is_col; static constexpr bool is_xvec = mtSpOp::is_xvec; const SpMat Q; inline explicit SpProxy(const mtSpOp& A) : Q(A) { arma_debug_sigprint(); } arma_inline uword get_n_rows() const { return is_row ? 1 : Q.n_rows; } arma_inline uword get_n_cols() const { return is_col ? 1 : Q.n_cols; } arma_inline uword get_n_elem() const { return Q.n_elem; } arma_inline uword get_n_nonzero() const { return Q.n_nonzero; } arma_inline elem_type operator[](const uword i) const { return Q[i]; } arma_inline elem_type at (const uword row, const uword col) const { return Q.at(row, col); } arma_inline const out_eT* get_values() const { return Q.values; } arma_inline const uword* get_row_indices() const { return Q.row_indices; } arma_inline const uword* get_col_ptrs() const { return Q.col_ptrs; } arma_inline const_iterator_type begin() const { return Q.begin(); } arma_inline const_iterator_type begin_col(const uword col_num) const { return Q.begin_col(col_num); } arma_inline const_row_iterator_type begin_row(const uword row_num = 0) const { return Q.begin_row(row_num); } arma_inline const_iterator_type end() const { return Q.end(); } arma_inline const_row_iterator_type end_row() const { return Q.end_row(); } arma_inline const_row_iterator_type end_row(const uword row_num) const { return Q.end_row(row_num); } template constexpr bool is_alias(const SpMat&) const { return false; } }; template struct SpProxy< mtSpGlue > { typedef out_eT elem_type; typedef typename get_pod_type::result pod_type; typedef SpMat stored_type; typedef typename SpMat::const_iterator const_iterator_type; typedef typename SpMat::const_row_iterator const_row_iterator_type; static constexpr bool use_iterator = false; static constexpr bool Q_is_generated = true; static constexpr bool is_row = mtSpGlue::is_row; static constexpr bool is_col = mtSpGlue::is_col; static constexpr bool is_xvec = mtSpGlue::is_xvec; const SpMat Q; inline explicit SpProxy(const mtSpGlue& A) : Q(A) { arma_debug_sigprint(); } arma_inline uword get_n_rows() const { return is_row ? 1 : Q.n_rows; } arma_inline uword get_n_cols() const { return is_col ? 1 : Q.n_cols; } arma_inline uword get_n_elem() const { return Q.n_elem; } arma_inline uword get_n_nonzero() const { return Q.n_nonzero; } arma_inline elem_type operator[](const uword i) const { return Q[i]; } arma_inline elem_type at (const uword row, const uword col) const { return Q.at(row, col); } arma_inline const out_eT* get_values() const { return Q.values; } arma_inline const uword* get_row_indices() const { return Q.row_indices; } arma_inline const uword* get_col_ptrs() const { return Q.col_ptrs; } arma_inline const_iterator_type begin() const { return Q.begin(); } arma_inline const_iterator_type begin_col(const uword col_num) const { return Q.begin_col(col_num); } arma_inline const_row_iterator_type begin_row(const uword row_num = 0) const { return Q.begin_row(row_num); } arma_inline const_iterator_type end() const { return Q.end(); } arma_inline const_row_iterator_type end_row() const { return Q.end_row(); } arma_inline const_row_iterator_type end_row(const uword row_num) const { return Q.end_row(row_num); } template constexpr bool is_alias(const SpMat&) const { return false; } }; template struct SpProxy< mtSpReduceOp > { typedef out_eT elem_type; typedef typename get_pod_type::result pod_type; typedef SpMat stored_type; typedef typename SpMat::const_iterator const_iterator_type; typedef typename SpMat::const_row_iterator const_row_iterator_type; static constexpr bool use_iterator = false; static constexpr bool Q_is_generated = true; static constexpr bool is_row = mtSpReduceOp::is_row; static constexpr bool is_col = mtSpReduceOp::is_col; static constexpr bool is_xvec = mtSpReduceOp::is_xvec; const SpMat Q; inline explicit SpProxy(const mtSpReduceOp& A) : Q(A) { arma_debug_sigprint(); } arma_inline uword get_n_rows() const { return is_row ? 1 : Q.n_rows; } arma_inline uword get_n_cols() const { return is_col ? 1 : Q.n_cols; } arma_inline uword get_n_elem() const { return Q.n_elem; } arma_inline uword get_n_nonzero() const { return Q.n_nonzero; } arma_inline elem_type operator[](const uword i) const { return Q[i]; } arma_inline elem_type at (const uword row, const uword col) const { return Q.at(row, col); } arma_inline const out_eT* get_values() const { return Q.values; } arma_inline const uword* get_row_indices() const { return Q.row_indices; } arma_inline const uword* get_col_ptrs() const { return Q.col_ptrs; } arma_inline const_iterator_type begin() const { return Q.begin(); } arma_inline const_iterator_type begin_col(const uword col_num) const { return Q.begin_col(col_num); } arma_inline const_row_iterator_type begin_row(const uword row_num = 0) const { return Q.begin_row(row_num); } arma_inline const_iterator_type end() const { return Q.end(); } arma_inline const_row_iterator_type end_row() const { return Q.end_row(); } arma_inline const_row_iterator_type end_row(const uword row_num) const { return Q.end_row(row_num); } template constexpr bool is_alias(const SpMat&) const { return false; } }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_trimat_bones.hpp0000644000176200001440000000421214770765377024313 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_trimat //! @{ // NOTE: don't split op_trimat into separate op_trimatu and op_trimatl classes, // NOTE: as several instances elsewhere rely on trimatu() and trimatl() producing the same type class op_trimat : public traits_op_default { public: template inline static void fill_zeros(Mat& A, const bool upper); // template inline static void apply(Mat& out, const Op& in); template inline static void apply_mat_noalias(Mat& out, const Mat& A, const bool upper); template inline static void apply_proxy_noalias(Mat& out, const Proxy& P, const bool upper); }; class op_trimatu_ext : public traits_op_default { public: template inline static void apply(Mat& out, const Op& in); template inline static void fill_zeros(Mat& A, const uword row_offset, const uword col_offset); }; class op_trimatl_ext : public traits_op_default { public: template inline static void apply(Mat& out, const Op& in); template inline static void fill_zeros(Mat& A, const uword row_offset, const uword col_offset); }; //! @} RcppArmadillo/inst/include/armadillo_bits/CubeToMatOp_meat.hpp0000644000176200001440000000245014631567470024247 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup CubeToMatOp //! @{ template inline CubeToMatOp::CubeToMatOp(const T1& in_m) : m(in_m) { arma_debug_sigprint(); } template inline CubeToMatOp::CubeToMatOp(const T1& in_m, const uword in_aux_uword) : m(in_m) , aux_uword(in_aux_uword) { arma_debug_sigprint(); } template inline CubeToMatOp::~CubeToMatOp() { arma_debug_sigprint(); } //! @} RcppArmadillo/inst/include/armadillo_bits/op_sp_mean_bones.hpp0000644000176200001440000000442714634016465024427 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_sp_mean //! @{ //! Class for finding mean values of a sparse matrix class op_sp_mean : public traits_op_xvec { public: // Apply mean into an output sparse matrix (or vector). template inline static void apply(Mat& out, const mtSpReduceOp& in); template inline static void apply_fast(Mat& out, const SpProxy& p, const uword dim); template inline static void apply_slow(Mat& out, const SpProxy& p, const uword dim); // Take direct mean of a set of values. Length of array and number of values can be different. template inline static eT direct_mean(const eT* const X, const uword length, const uword N); template inline static eT direct_mean_robust(const eT* const X, const uword length, const uword N); template inline static typename T1::elem_type mean_all(const SpBase& X); template inline static typename T1::elem_type mean_all(const SpOp& expr); // Take the mean using an iterator. template inline static eT iterator_mean(T1& it, const T1& end, const uword n_zero, const eT junk); template inline static eT iterator_mean_robust(T1& it, const T1& end, const uword n_zero, const eT junk); }; //! @} RcppArmadillo/inst/include/armadillo_bits/fn_var.hpp0000644000176200001440000000557314634016465022377 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_var //! @{ template arma_warn_unused inline typename enable_if2 < is_arma_type::value && resolves_to_vector::yes, typename T1::pod_type >::result var(const T1& X, const uword norm_type = 0) { arma_debug_sigprint(); return op_var::var_vec(X, norm_type); } template arma_warn_unused inline typename enable_if2 < is_arma_type::value && resolves_to_vector::no, const mtOp >::result var(const T1& X, const uword norm_type = 0) { arma_debug_sigprint(); return mtOp(X, norm_type, 0); } template arma_warn_unused inline typename enable_if2 < is_arma_type::value, const mtOp >::result var(const T1& X, const uword norm_type, const uword dim) { arma_debug_sigprint(); return mtOp(X, norm_type, dim); } template arma_warn_unused inline typename arma_scalar_only::result var(const T&) { return T(0); } template arma_warn_unused inline typename enable_if2 < is_arma_sparse_type::value && resolves_to_sparse_vector::yes, typename T1::pod_type >::result var(const T1& X, const uword norm_type = 0) { arma_debug_sigprint(); return op_sp_var::var_vec(X, norm_type); } template arma_warn_unused inline typename enable_if2 < is_arma_sparse_type::value && resolves_to_sparse_vector::no, const mtSpReduceOp >::result var(const T1& X, const uword norm_type = 0) { arma_debug_sigprint(); return mtSpReduceOp(X, norm_type, 0); } template arma_warn_unused inline typename enable_if2 < is_arma_sparse_type::value, const mtSpReduceOp >::result var(const T1& X, const uword norm_type, const uword dim) { arma_debug_sigprint(); return mtSpReduceOp(X, norm_type, dim); } //! @} RcppArmadillo/inst/include/armadillo_bits/op_sp_mean_meat.hpp0000644000176200001440000002057014634016465024244 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_sp_mean //! @{ template inline void op_sp_mean::apply(Mat& out, const mtSpReduceOp& in) { arma_debug_sigprint(); const uword dim = in.aux_uword_a; arma_conform_check( (dim > 1), "mean(): parameter 'dim' must be 0 or 1" ); const SpProxy p(in.m); const uword p_n_rows = p.get_n_rows(); const uword p_n_cols = p.get_n_cols(); if( (p_n_rows == 0) || (p_n_cols == 0) || (p.get_n_nonzero() == 0) ) { if(dim == 0) { out.zeros((p_n_rows > 0) ? 1 : 0, p_n_cols); } if(dim == 1) { out.zeros(p_n_rows, (p_n_cols > 0) ? 1 : 0); } return; } op_sp_mean::apply_fast(out, p, dim); } template inline void op_sp_mean::apply_fast ( Mat& out, const SpProxy& p, const uword dim ) { arma_debug_sigprint(); typedef typename T1::elem_type eT; typedef typename T1::pod_type T; const uword p_n_rows = p.get_n_rows(); const uword p_n_cols = p.get_n_cols(); if(dim == 0) // find the mean in each column { arma_debug_print("op_sp_mean::apply_fast(): dim = 0"); out.zeros(1, p_n_cols); eT* out_mem = out.memptr(); if(SpProxy::use_iterator) { typename SpProxy::const_iterator_type it = p.begin(); const uword N = p.get_n_nonzero(); for(uword i=0; i < N; ++i) { out_mem[it.col()] += (*it); ++it; } out /= T(p_n_rows); } else { for(uword col = 0; col < p_n_cols; ++col) { out_mem[col] = arrayops::accumulate ( &p.get_values()[p.get_col_ptrs()[col]], p.get_col_ptrs()[col + 1] - p.get_col_ptrs()[col] ) / T(p_n_rows); } } } else if(dim == 1) // find the mean in each row { arma_debug_print("op_sp_mean::apply_fast(): dim = 1"); out.zeros(p_n_rows, 1); eT* out_mem = out.memptr(); typename SpProxy::const_iterator_type it = p.begin(); const uword N = p.get_n_nonzero(); for(uword i=0; i < N; ++i) { out_mem[it.row()] += (*it); ++it; } out /= T(p_n_cols); } if(out.internal_has_nonfinite()) { op_sp_mean::apply_slow(out, p, dim); } } template inline void op_sp_mean::apply_slow ( Mat& out, const SpProxy& p, const uword dim ) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword p_n_rows = p.get_n_rows(); const uword p_n_cols = p.get_n_cols(); if(dim == 0) // find the mean in each column { arma_debug_print("op_sp_mean::apply_slow(): dim = 0"); out.zeros(1, p_n_cols); for(uword col = 0; col < p_n_cols; ++col) { // Do we have to use an iterator or can we use memory directly? if(SpProxy::use_iterator) { typename SpProxy::const_iterator_type it = p.begin_col(col); typename SpProxy::const_iterator_type end = p.begin_col(col + 1); const uword n_zero = p_n_rows - (end.pos() - it.pos()); out.at(0,col) = op_sp_mean::iterator_mean(it, end, n_zero, eT(0)); } else { out.at(0,col) = op_sp_mean::direct_mean ( &p.get_values()[p.get_col_ptrs()[col]], p.get_col_ptrs()[col + 1] - p.get_col_ptrs()[col], p_n_rows ); } } } else if(dim == 1) // find the mean in each row { arma_debug_print("op_sp_mean::apply_slow(): dim = 1"); out.zeros(p_n_rows, 1); for(uword row = 0; row < p_n_rows; ++row) { // We must use an iterator regardless of how it is stored. typename SpProxy::const_row_iterator_type it = p.begin_row(row); typename SpProxy::const_row_iterator_type end = p.end_row(row); const uword n_zero = p_n_cols - (end.pos() - it.pos()); out.at(row,0) = op_sp_mean::iterator_mean(it, end, n_zero, eT(0)); } } } template inline eT op_sp_mean::direct_mean ( const eT* const X, const uword length, const uword N ) { arma_debug_sigprint(); typedef typename get_pod_type::result T; const eT result = ((length > 0) && (N > 0)) ? eT(arrayops::accumulate(X, length) / T(N)) : eT(0); return arma_isfinite(result) ? result : op_sp_mean::direct_mean_robust(X, length, N); } template inline eT op_sp_mean::direct_mean_robust ( const eT* const X, const uword length, const uword N ) { arma_debug_sigprint(); typedef typename get_pod_type::result T; uword i, j; eT r_mean = eT(0); const uword diff = (N - length); // number of zeros for(i = 0, j = 1; j < length; i += 2, j += 2) { const eT Xi = X[i]; const eT Xj = X[j]; r_mean += (Xi - r_mean) / T(diff + j); r_mean += (Xj - r_mean) / T(diff + j + 1); } if(i < length) { const eT Xi = X[i]; r_mean += (Xi - r_mean) / T(diff + i + 1); } return r_mean; } template inline typename T1::elem_type op_sp_mean::mean_all(const SpBase& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; SpProxy p(X.get_ref()); if(p.get_n_elem() == 0) { arma_conform_check(true, "mean(): object has no elements"); return Datum::nan; } if(SpProxy::use_iterator) { typename SpProxy::const_iterator_type it = p.begin(); typename SpProxy::const_iterator_type end = p.end(); return op_sp_mean::iterator_mean(it, end, p.get_n_elem() - p.get_n_nonzero(), typename T1::elem_type(0)); } else // use_iterator == false; that is, we can directly access the values array { return op_sp_mean::direct_mean(p.get_values(), p.get_n_nonzero(), p.get_n_elem()); } } template inline typename T1::elem_type op_sp_mean::mean_all(const SpOp& expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; constexpr bool is_vectorise = \ (is_same_type::yes) || (is_same_type::yes) || (is_same_type::yes); if(is_vectorise) { return op_sp_mean::mean_all(expr.m); } const SpMat tmp = expr; return op_sp_mean::mean_all(tmp); } template inline eT op_sp_mean::iterator_mean(T1& it, const T1& end, const uword n_zero, const eT junk) { arma_debug_sigprint(); arma_ignore(junk); typedef typename get_pod_type::result T; eT acc = eT(0); T1 backup_it(it); // in case we have to use robust iterator_mean const uword it_begin_pos = it.pos(); while(it != end) { acc += (*it); ++it; } const uword count = n_zero + (it.pos() - it_begin_pos); const eT result = (count > 0) ? eT(acc / T(count)) : eT(0); return arma_isfinite(result) ? result : op_sp_mean::iterator_mean_robust(backup_it, end, n_zero, eT(0)); } template inline eT op_sp_mean::iterator_mean_robust(T1& it, const T1& end, const uword n_zero, const eT junk) { arma_debug_sigprint(); arma_ignore(junk); typedef typename get_pod_type::result T; eT r_mean = eT(0); const uword it_begin_pos = it.pos(); while(it != end) { r_mean += ((*it - r_mean) / T(n_zero + (it.pos() - it_begin_pos) + 1)); ++it; } return r_mean; } //! @} RcppArmadillo/inst/include/armadillo_bits/op_sp_var_bones.hpp0000644000176200001440000000505414634016465024274 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_sp_var //! @{ //! Class for finding variance values of a sparse matrix class op_sp_var : public traits_op_xvec { public: template inline static void apply(Mat& out, const mtSpReduceOp& in); template inline static void apply_slow(Mat& out, const SpProxy& p, const uword norm_type, const uword dim); // Calculate variance of a sparse vector, where we can directly use the memory. template inline static typename T1::pod_type var_vec(const T1& X, const uword norm_type = 0); // Calculate the variance directly. Because this is for sparse matrices, we // specify both the number of elements in the array (the length of the array) // as well as the actual number of elements when zeros are included. template inline static eT direct_var(const eT* const X, const uword length, const uword N, const uword norm_type = 0); // For complex numbers. template inline static T direct_var(const std::complex* const X, const uword length, const uword N, const uword norm_type = 0); // Calculate the variance using iterators, for non-complex numbers. template inline static eT iterator_var(T1& it, const T1& end, const uword n_zero, const uword norm_type, const eT junk1, const typename arma_not_cx::result* junk2 = nullptr); // Calculate the variance using iterators, for complex numbers. template inline static typename get_pod_type::result iterator_var(T1& it, const T1& end, const uword n_zero, const uword norm_type, const eT junk1, const typename arma_cx_only::result* junk2 = nullptr); }; //! @} RcppArmadillo/inst/include/armadillo_bits/SpGlue_bones.hpp0000644000176200001440000000333114301267043023466 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup SpGlue //! @{ template class SpGlue : public SpBase< typename T1::elem_type, SpGlue > { public: typedef typename T1::elem_type elem_type; typedef typename get_pod_type::result pod_type; static constexpr bool is_row = spglue_type::template traits::is_row; static constexpr bool is_col = spglue_type::template traits::is_col; static constexpr bool is_xvec = spglue_type::template traits::is_xvec; inline SpGlue(const T1& in_A, const T2& in_B); inline SpGlue(const T1& in_A, const T2& in_B, const elem_type in_aux); inline ~SpGlue(); arma_inline bool is_alias(const SpMat& X) const; const T1& A; //!< first operand; must be derived from SpBase const T2& B; //!< second operand; must be derived from SpBase elem_type aux; }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_sort_meat.hpp0000644000176200001440000001705715030507611023604 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_sort //! @{ template inline void op_sort::direct_sort(eT* X, const uword n_elem, const uword sort_mode) { arma_debug_sigprint(); if(sort_mode == 0) { arma_lt_comparator comparator; std::sort(&X[0], &X[n_elem], comparator); } else { arma_gt_comparator comparator; std::sort(&X[0], &X[n_elem], comparator); } } template inline void op_sort::direct_sort_ascending(eT* X, const uword n_elem) { arma_debug_sigprint(); arma_lt_comparator comparator; std::sort(&X[0], &X[n_elem], comparator); } template inline void op_sort::apply_noalias(Mat& out, const Mat& X, const uword sort_mode, const uword dim) { arma_debug_sigprint(); if(X.n_elem <= 1) { out = X; return; } if(is_cx::yes) { arma_debug_print("op_sort::apply(): complex version"); if(dim == 0) // sort the contents of each column { arma_debug_print("op_sort::apply(): dim = 0"); const uword n_rows = X.n_rows; const uword n_cols = X.n_cols; out.set_size(n_rows, n_cols); uvec indices; for(uword col=0; col < n_cols; ++col) { const Col X_col( const_cast(X.colptr(col)), n_rows, false ); const Proxy< Col > P(X_col); const bool all_non_nan = op_sort_index::apply_helper(indices, P, sort_mode); if(all_non_nan == false) { out.soft_reset(); arma_conform_check(true, "sort(): detected NaN"); return; } const uword* indices_mem = indices.memptr(); const eT* X_col_mem = X_col.memptr(); eT* out_col_mem = out.colptr(col); for(uword i=0; i < n_rows; ++i) { out_col_mem[i] = X_col_mem[ indices_mem[i] ]; } } } else if(dim == 1) // sort the contents of each row { arma_debug_print("op_sort::apply(): dim = 1"); Mat Y; op_strans::apply_mat_noalias(Y, X); const uword n_rows = Y.n_rows; const uword n_cols = Y.n_cols; Mat tmp(n_rows, n_cols); uvec indices; for(uword col=0; col < n_cols; ++col) { const Col Y_col( const_cast(Y.colptr(col)), n_rows, false ); const Proxy< Col > P(Y_col); const bool all_non_nan = op_sort_index::apply_helper(indices, P, sort_mode); if(all_non_nan == false) { out.soft_reset(); arma_conform_check(true, "sort(): detected NaN"); return; } const uword* indices_mem = indices.memptr(); const eT* Y_col_mem = Y_col.memptr(); eT* tmp_col_mem = tmp.colptr(col); for(uword i=0; i < n_rows; ++i) { tmp_col_mem[i] = Y_col_mem[ indices_mem[i] ]; } } op_strans::apply_mat_noalias(out, tmp); } } else { arma_debug_print("op_sort::apply(): plain version"); if(dim == 0) // sort the contents of each column { arma_debug_print("op_sort::apply(): dim = 0"); out = X; const uword n_rows = out.n_rows; const uword n_cols = out.n_cols; for(uword col=0; col < n_cols; ++col) { op_sort::direct_sort( out.colptr(col), n_rows, sort_mode ); } } else if(dim == 1) // sort the contents of each row { if(X.n_rows == 1) // a row vector { arma_debug_print("op_sort::apply(): dim = 1, vector specific"); out = X; op_sort::direct_sort(out.memptr(), out.n_elem, sort_mode); } else // not a row vector { arma_debug_print("op_sort::apply(): dim = 1, generic"); Mat Y; op_strans::apply_mat_noalias(Y, X); const uword n_rows = Y.n_rows; const uword n_cols = Y.n_cols; for(uword col=0; col < n_cols; ++col) { op_sort::direct_sort( Y.colptr(col), n_rows, sort_mode ); } op_strans::apply_mat_noalias(out, Y); } } } } template inline void op_sort::apply(Mat& out, const Op& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const quasi_unwrap U(in.m); const Mat& X = U.M; const uword sort_mode = in.aux_uword_a; const uword dim = in.aux_uword_b; arma_conform_check( (sort_mode > 1), "sort(): parameter 'sort_mode' must be 0 or 1" ); arma_conform_check( (dim > 1), "sort(): parameter 'dim' must be 0 or 1" ); if(U.is_alias(out)) { Mat tmp; op_sort::apply_noalias(tmp, X, sort_mode, dim); out.steal_mem(tmp); } else { op_sort::apply_noalias(out, X, sort_mode, dim); } } template inline void op_sort_vec::apply(Mat& out, const Op& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const unwrap U(in.m); // not using quasi_unwrap, to ensure there is no aliasing with subviews const Mat& X = U.M; const uword sort_mode = in.aux_uword_a; arma_conform_check( (sort_mode > 1), "sort(): parameter 'sort_mode' must be 0 or 1" ); if(X.n_elem <= 1) { out = X; return; } if(is_cx::yes) { uvec indices; const Proxy< Mat > P(X); const bool all_non_nan = op_sort_index::apply_helper(indices, P, sort_mode); if(all_non_nan == false) { out.soft_reset(); arma_conform_check(true, "sort(): detected NaN"); return; } const uword N = indices.n_elem; arma_check( (N != X.n_elem), "internal error: op_sort_vec::apply(): N != X.n_elem" ); Mat tmp(X.n_rows, X.n_cols, arma_nozeros_indicator()); // in case there is aliasing const uword* indices_mem = indices.memptr(); const eT* X_mem = X.memptr(); eT* tmp_mem = tmp.memptr(); for(uword i=0; i < N; ++i) { tmp_mem[i] = X_mem[ indices_mem[i] ]; } out.steal_mem(tmp); } else { out = X; // not checking for aliasing, to allow inplace sorting of vectors eT* out_mem = out.memptr(); eT* start_ptr = out_mem; eT* endp1_ptr = &out_mem[out.n_elem]; if(sort_mode == 0) { arma_lt_comparator comparator; std::sort(start_ptr, endp1_ptr, comparator); } else { arma_gt_comparator comparator; std::sort(start_ptr, endp1_ptr, comparator); } } } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_sylvester.hpp0000644000176200001440000000711515030507611023626 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_syl_lyap //! @{ //! find the solution of the Sylvester equation AX + XB = C template inline bool sylvester ( Mat & out, const Base& in_A, const Base& in_B, const Base& in_C, const typename arma_blas_type_only::result* junk = nullptr ) { arma_debug_sigprint(); arma_ignore(junk); typedef typename T1::elem_type eT; const unwrap_check tmp_A(in_A.get_ref(), out); const unwrap_check tmp_B(in_B.get_ref(), out); const unwrap_check tmp_C(in_C.get_ref(), out); const Mat& A = tmp_A.M; const Mat& B = tmp_B.M; const Mat& C = tmp_C.M; const bool status = auxlib::sylvester(out, A, B, C); if(status == false) { out.soft_reset(); arma_warn(3, "sylvester(): solution not found"); } return status; } // kept for compatibility with old user code template arma_frown("use sylvester() instead") inline bool syl ( Mat & out, const Base& in_A, const Base& in_B, const Base& in_C, const typename arma_blas_type_only::result* junk = nullptr ) { arma_ignore(junk); return sylvester(out, in_A, in_B, in_C); } template arma_warn_unused inline Mat sylvester ( const Base& in_A, const Base& in_B, const Base& in_C, const typename arma_blas_type_only::result* junk = nullptr ) { arma_debug_sigprint(); arma_ignore(junk); typedef typename T1::elem_type eT; const unwrap tmp_A( in_A.get_ref() ); const unwrap tmp_B( in_B.get_ref() ); const unwrap tmp_C( in_C.get_ref() ); const Mat& A = tmp_A.M; const Mat& B = tmp_B.M; const Mat& C = tmp_C.M; Mat out; const bool status = auxlib::sylvester(out, A, B, C); if(status == false) { out.soft_reset(); arma_stop_runtime_error("sylvester(): solution not found"); } return out; } // kept for compatibility with old user code template arma_frown("use sylvester() instead") inline Mat syl ( const Base& in_A, const Base& in_B, const Base& in_C, const typename arma_blas_type_only::result* junk = nullptr ) { arma_ignore(junk); return sylvester(in_A, in_B, in_C); } //! @} RcppArmadillo/inst/include/armadillo_bits/spop_misc_meat.hpp0000644000176200001440000002464615030507611024115 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup spop_misc //! @{ namespace priv { template struct functor_scalar_times { const eT k; functor_scalar_times(const eT in_k) : k(in_k) {} arma_inline eT operator()(const eT val) const { return val * k; } }; } template inline void spop_scalar_times::apply(SpMat& out, const SpOp& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; out.init_xform(in.m, priv::functor_scalar_times(in.aux)); } namespace priv { template struct functor_cx_scalar_times { typedef std::complex out_eT; const out_eT k; functor_cx_scalar_times(const out_eT in_k) : k(in_k) {} arma_inline out_eT operator()(const T val) const { return val * k; } }; } template inline void spop_cx_scalar_times::apply(SpMat< std::complex >& out, const mtSpOp< std::complex, T1, spop_cx_scalar_times >& in) { arma_debug_sigprint(); typedef typename T1::pod_type T; out.init_xform_mt(in.m, priv::functor_cx_scalar_times(in.aux_out_eT)); } namespace priv { struct functor_square { template arma_inline eT operator()(const eT val) const { return val*val; } }; } template inline void spop_square::apply(SpMat& out, const SpOp& in) { arma_debug_sigprint(); out.init_xform(in.m, priv::functor_square()); } namespace priv { struct functor_sqrt { template arma_inline eT operator()(const eT val) const { return eop_aux::sqrt(val); } }; } template inline void spop_sqrt::apply(SpMat& out, const SpOp& in) { arma_debug_sigprint(); out.init_xform(in.m, priv::functor_sqrt()); } namespace priv { struct functor_cbrt { template arma_inline eT operator()(const eT val) const { return eop_aux::cbrt(val); } }; } template inline void spop_cbrt::apply(SpMat& out, const SpOp& in) { arma_debug_sigprint(); out.init_xform(in.m, priv::functor_cbrt()); } namespace priv { struct functor_abs { template arma_inline eT operator()(const eT val) const { return eop_aux::arma_abs(val); } }; } template inline void spop_abs::apply(SpMat& out, const SpOp& in) { arma_debug_sigprint(); out.init_xform(in.m, priv::functor_abs()); } namespace priv { struct functor_cx_abs { template arma_inline T operator()(const std::complex& val) const { return std::abs(val); } }; } template inline void spop_cx_abs::apply(SpMat& out, const mtSpOp& in) { arma_debug_sigprint(); out.init_xform_mt(in.m, priv::functor_cx_abs()); } namespace priv { struct functor_arg { template arma_inline eT operator()(const eT val) const { return arma_arg::eval(val); } }; } template inline void spop_arg::apply(SpMat& out, const SpOp& in) { arma_debug_sigprint(); out.init_xform(in.m, priv::functor_arg()); } namespace priv { struct functor_cx_arg { template arma_inline T operator()(const std::complex& val) const { return std::arg(val); } }; } template inline void spop_cx_arg::apply(SpMat& out, const mtSpOp& in) { arma_debug_sigprint(); out.init_xform_mt(in.m, priv::functor_cx_arg()); } namespace priv { struct functor_real { template arma_inline T operator()(const std::complex& val) const { return val.real(); } }; } template inline void spop_real::apply(SpMat& out, const mtSpOp& in) { arma_debug_sigprint(); out.init_xform_mt(in.m, priv::functor_real()); } namespace priv { struct functor_imag { template arma_inline eT operator()(const eT ) const { return eT(0); } template arma_inline T operator()(const std::complex& val) const { return val.imag(); } }; } template inline void spop_imag::apply(SpMat& out, const mtSpOp& in) { arma_debug_sigprint(); if(is_cx::no) { const SpProxy P(in.m); out.zeros(P.get_n_rows(), P.get_n_cols()); } else { out.init_xform_mt(in.m, priv::functor_imag()); } } namespace priv { struct functor_conj { template arma_inline eT operator()(const eT val) const { return eop_aux::conj(val); } }; } template inline void spop_conj::apply(SpMat& out, const SpOp& in) { arma_debug_sigprint(); out.init_xform(in.m, priv::functor_conj()); } template inline void spop_repelem::apply(SpMat& out, const SpOp& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const unwrap_spmat U(in.m); const SpMat& X = U.M; const uword copies_per_row = in.aux_uword_a; const uword copies_per_col = in.aux_uword_b; const uword out_n_rows = X.n_rows * copies_per_row; const uword out_n_cols = X.n_cols * copies_per_col; const uword out_nnz = X.n_nonzero * copies_per_row * copies_per_col; if( (out_n_rows > 0) && (out_n_cols > 0) && (out_nnz > 0) ) { Mat locs(2, out_nnz, arma_nozeros_indicator()); Col vals( out_nnz, arma_nozeros_indicator()); uword* locs_mem = locs.memptr(); eT* vals_mem = vals.memptr(); typename SpMat::const_iterator X_it = X.begin(); typename SpMat::const_iterator X_end = X.end(); for(; X_it != X_end; ++X_it) { const uword col_base = copies_per_col * X_it.col(); const uword row_base = copies_per_row * X_it.row(); const eT X_val = (*X_it); for(uword cols = 0; cols < copies_per_col; cols++) for(uword rows = 0; rows < copies_per_row; rows++) { (*locs_mem) = row_base + rows; ++locs_mem; (*locs_mem) = col_base + cols; ++locs_mem; (*vals_mem) = X_val; ++vals_mem; } } out = SpMat(locs, vals, out_n_rows, out_n_cols); } else { out.zeros(out_n_rows, out_n_cols); } } template inline void spop_reshape::apply(SpMat& out, const SpOp& in) { arma_debug_sigprint(); out = in.m; out.reshape(in.aux_uword_a, in.aux_uword_b); } template inline void spop_resize::apply(SpMat& out, const SpOp& in) { arma_debug_sigprint(); out = in.m; out.resize(in.aux_uword_a, in.aux_uword_b); } namespace priv { struct functor_floor { template arma_inline eT operator()(const eT val) const { return eop_aux::floor(val); } }; } template inline void spop_floor::apply(SpMat& out, const SpOp& in) { arma_debug_sigprint(); out.init_xform(in.m, priv::functor_floor()); } namespace priv { struct functor_ceil { template arma_inline eT operator()(const eT val) const { return eop_aux::ceil(val); } }; } template inline void spop_ceil::apply(SpMat& out, const SpOp& in) { arma_debug_sigprint(); out.init_xform(in.m, priv::functor_ceil()); } namespace priv { struct functor_round { template arma_inline eT operator()(const eT val) const { return eop_aux::round(val); } }; } template inline void spop_round::apply(SpMat& out, const SpOp& in) { arma_debug_sigprint(); out.init_xform(in.m, priv::functor_round()); } namespace priv { struct functor_trunc { template arma_inline eT operator()(const eT val) const { return eop_aux::trunc(val); } }; } template inline void spop_trunc::apply(SpMat& out, const SpOp& in) { arma_debug_sigprint(); out.init_xform(in.m, priv::functor_trunc()); } namespace priv { struct functor_sign { template arma_inline eT operator()(const eT val) const { return arma_sign(val); } }; } template inline void spop_sign::apply(SpMat& out, const SpOp& in) { arma_debug_sigprint(); out.init_xform(in.m, priv::functor_sign()); } template inline void spop_flipud::apply(SpMat& out, const SpOp& in) { arma_debug_sigprint(); out = reverse(in.m, 0); } template inline void spop_fliplr::apply(SpMat& out, const SpOp& in) { arma_debug_sigprint(); out = reverse(in.m, 1); } template inline void spop_replace::apply(SpMat& out, const mtSpOp& in) { arma_debug_sigprint(); const eT old_val = in.aux; const eT new_val = in.aux_out_eT; out = in.m; out.replace(old_val, new_val); } //! @} RcppArmadillo/inst/include/armadillo_bits/SpValProxy_meat.hpp0000644000176200001440000001357115013306507024205 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup SpValProxy //! @{ //! SpValProxy implementation. template arma_inline SpValProxy::SpValProxy(uword in_row, uword in_col, T1& in_parent, eT* in_val_ptr) : row(in_row) , col(in_col) , val_ptr(in_val_ptr) , parent(in_parent) { // Nothing to do. } template arma_inline SpValProxy& SpValProxy::operator=(const SpValProxy& rhs) { return (*this).operator=(eT(rhs)); } template template arma_inline SpValProxy& SpValProxy::operator=(const SpValProxy& rhs) { return (*this).operator=(eT(rhs)); } template inline SpValProxy& SpValProxy::operator=(const eT rhs) { if(rhs != eT(0)) // A nonzero element is being assigned. { if(val_ptr) { // The value exists and merely needs to be updated. *val_ptr = rhs; parent.invalidate_cache(); } else { // The value is nonzero and must be inserted. val_ptr = &parent.insert_element(row, col, rhs); } } else // A zero is being assigned.~ { if(val_ptr) { // The element exists, but we need to remove it, because it is being set to 0. parent.delete_element(row, col); val_ptr = nullptr; } // If the element does not exist, we do not need to do anything at all. } return *this; } template inline SpValProxy& SpValProxy::operator+=(const eT rhs) { if(val_ptr) { // The value already exists and merely needs to be updated. *val_ptr += rhs; parent.invalidate_cache(); check_zero(); } else { if(rhs != eT(0)) { // The value does not exist and must be inserted. val_ptr = &parent.insert_element(row, col, rhs); } } return *this; } template inline SpValProxy& SpValProxy::operator-=(const eT rhs) { if(val_ptr) { // The value already exists and merely needs to be updated. *val_ptr -= rhs; parent.invalidate_cache(); check_zero(); } else { if(rhs != eT(0)) { // The value does not exist and must be inserted. val_ptr = &parent.insert_element(row, col, -rhs); } } return *this; } template inline SpValProxy& SpValProxy::operator*=(const eT rhs) { if(val_ptr) { *val_ptr *= rhs; parent.invalidate_cache(); check_zero(); } else { const eT val = eT(0) * rhs; // in case rhs is inf or nan if(val != eT(0)) { val_ptr = &parent.insert_element(row, col, val); } } return *this; } template inline SpValProxy& SpValProxy::operator/=(const eT rhs) { if(val_ptr) { *val_ptr /= rhs; parent.invalidate_cache(); check_zero(); } else { const eT val = eT(0) / rhs; // in case rhs is zero or nan if(val != eT(0)) { val_ptr = &parent.insert_element(row, col, val); } } return *this; } template inline SpValProxy& SpValProxy::operator++() { if(val_ptr) { (*val_ptr) += eT(1); parent.invalidate_cache(); check_zero(); } else { val_ptr = &parent.insert_element(row, col, eT(1)); } return *this; } template inline SpValProxy& SpValProxy::operator--() { if(val_ptr) { (*val_ptr) -= eT(1); parent.invalidate_cache(); check_zero(); } else { val_ptr = &parent.insert_element(row, col, eT(-1)); } return *this; } template inline typename T1::elem_type SpValProxy::operator++(const int) { if(val_ptr) { (*val_ptr) += eT(1); parent.invalidate_cache(); check_zero(); } else { val_ptr = &parent.insert_element(row, col, eT(1)); } if(val_ptr) // It may have changed to now be 0. { return *(val_ptr) - eT(1); } else { return eT(0); } } template inline typename T1::elem_type SpValProxy::operator--(const int) { if(val_ptr) { (*val_ptr) -= eT(1); parent.invalidate_cache(); check_zero(); } else { val_ptr = &parent.insert_element(row, col, eT(-1)); } if(val_ptr) // It may have changed to now be 0. { return *(val_ptr) + eT(1); } else { return eT(0); } } template arma_inline SpValProxy::operator eT() const { return (val_ptr) ? eT(*val_ptr) : eT(0); } template arma_inline typename get_pod_type::eT>::result SpValProxy::real() const { typedef typename get_pod_type::result T; return T( access::tmp_real( (val_ptr) ? eT(*val_ptr) : eT(0) ) ); } template arma_inline typename get_pod_type::eT>::result SpValProxy::imag() const { typedef typename get_pod_type::result T; return T( access::tmp_imag( (val_ptr) ? eT(*val_ptr) : eT(0) ) ); } template arma_inline void SpValProxy::check_zero() { if(*val_ptr == eT(0)) { parent.delete_element(row, col); val_ptr = nullptr; } } //! @} RcppArmadillo/inst/include/armadillo_bits/op_rank_meat.hpp0000644000176200001440000001103314713753317023551 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_rank //! @{ template inline bool op_rank::apply(uword& out, const Base& expr, const typename T1::pod_type tol) { arma_debug_sigprint(); typedef typename T1::elem_type eT; Mat A(expr.get_ref()); if(A.is_empty()) { out = uword(0); return true; } if(is_op_diagmat::value || A.is_diagmat()) { arma_debug_print("op_rank::apply(): diag optimisation"); return op_rank::apply_diag(out, A, tol); } bool do_sym = false; const bool is_sym_size_ok = (A.n_rows == A.n_cols) && (A.n_rows > (is_cx::yes ? uword(20) : uword(40))); // for consistency with op_pinv if( (is_sym_size_ok) && (arma_config::optimise_sym) && (auxlib::crippled_lapack(A) == false) ) { do_sym = is_sym_expr::eval(expr.get_ref()); if(do_sym == false) { do_sym = sym_helper::is_approx_sym(A); } } if(do_sym) { arma_debug_print("op_rank::apply(): symmetric/hermitian optimisation"); return op_rank::apply_sym(out, A, tol); } return op_rank::apply_gen(out, A, tol); } template inline bool op_rank::apply_diag(uword& out, Mat& A, typename get_pod_type::result tol) { arma_debug_sigprint(); typedef typename get_pod_type::result T; const uword N = (std::min)(A.n_rows, A.n_cols); podarray diag_abs_vals(N); T max_abs_Aii = T(0); for(uword i=0; i max_abs_Aii) ? abs_Aii : max_abs_Aii; } // set tolerance to default if it hasn't been specified if(tol == T(0)) { tol = (std::max)(A.n_rows, A.n_cols) * max_abs_Aii * std::numeric_limits::epsilon(); } uword count = 0; for(uword i=0; i tol) ? uword(1) : uword(0); } out = count; return true; } template inline bool op_rank::apply_sym(uword& out, Mat& A, typename get_pod_type::result tol) { arma_debug_sigprint(); typedef typename get_pod_type::result T; if(A.is_square() == false) { out = uword(0); return false; } Col v; const bool status = auxlib::eig_sym(v, A); if(status == false) { out = uword(0); return false; } const uword v_n_elem = v.n_elem; T* v_mem = v.memptr(); if(v_n_elem == 0) { out = uword(0); return true; } T max_abs_v = T(0); for(uword i=0; i < v_n_elem; ++i) { const T val = std::abs(v_mem[i]); v_mem[i] = val; if(val > max_abs_v) { max_abs_v = val; } } // set tolerance to default if it hasn't been specified if(tol == T(0)) { tol = (std::max)(A.n_rows, A.n_cols) * max_abs_v * std::numeric_limits::epsilon(); } uword count = 0; for(uword i=0; i < v_n_elem; ++i) { count += (v_mem[i] > tol) ? uword(1) : uword(0); } out = count; return true; } template inline bool op_rank::apply_gen(uword& out, Mat& A, typename get_pod_type::result tol) { arma_debug_sigprint(); typedef typename get_pod_type::result T; Col s; const bool status = auxlib::svd_dc(s, A); if(status == false) { out = uword(0); return false; } const uword s_n_elem = s.n_elem; const T* s_mem = s.memptr(); if(s_n_elem == 0) { out = uword(0); return true; } // set tolerance to default if it hasn't been specified if(tol == T(0)) { tol = (std::max)(A.n_rows, A.n_cols) * s_mem[0] * std::numeric_limits::epsilon(); } uword count = 0; for(uword i=0; i < s_n_elem; ++i) { count += (s_mem[i] > tol) ? uword(1) : uword(0); } out = count; return true; } //! @} RcppArmadillo/inst/include/armadillo_bits/trimat_helper.hpp0000644000176200001440000000602214631567470023755 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup trimat_helper //! @{ namespace trimat_helper { template inline bool is_triu(const Mat& A) { arma_debug_sigprint(); // NOTE: assuming that A has a square size const uword N = A.n_rows; const uword Nm1 = N-1; if(N < 2) { return false; } const eT* A_col = A.memptr(); const eT eT_zero = eT(0); // quickly check element at bottom-left if(A_col[Nm1] != eT_zero) { return false; } // if we got to this point, do a thorough check for(uword j=0; j < Nm1; ++j) { for(uword i=(j+1); i < N; ++i) { const eT A_ij = A_col[i]; if(A_ij != eT_zero) { return false; } } A_col += N; } return true; } template inline bool is_tril(const Mat& A) { arma_debug_sigprint(); // NOTE: assuming that A has a square size const uword N = A.n_rows; if(N < 2) { return false; } const eT eT_zero = eT(0); // quickly check element at top-right const eT* A_colNm1 = A.colptr(N-1); if(A_colNm1[0] != eT_zero) { return false; } // if we got to this point, do a thorough check const eT* A_col = A.memptr() + N; for(uword j=1; j < N; ++j) { for(uword i=0; i < j; ++i) { const eT A_ij = A_col[i]; if(A_ij != eT_zero) { return false; } } A_col += N; } return true; } template inline bool has_nonfinite_tril(const Mat& A) { arma_debug_sigprint(); // NOTE: assuming that A has a square size const eT* colptr = A.memptr(); const uword N = A.n_rows; for(uword i=0; i inline bool has_nonfinite_triu(const Mat& A) { arma_debug_sigprint(); // NOTE: assuming that A has a square size const eT* colptr = A.memptr(); const uword N = A.n_rows; for(uword i=0; i inline static void apply_noalias(Mat& out, const Mat& X, const Mat& C, const uword dim); template inline static void apply(Mat& out, const mtGlue& expr); }; class glue_hist_default { public: template struct traits { static constexpr bool is_row = T1::is_row; static constexpr bool is_col = T1::is_col; static constexpr bool is_xvec = T1::is_xvec; }; template inline static void apply(Mat& out, const mtGlue& expr); }; //! @} RcppArmadillo/inst/include/armadillo_bits/typedef_elem.hpp0000644000176200001440000001122014713753317023552 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup typedef_elem //! @{ #if (defined(ARMA_U8_TYPE) && defined(ARMA_S8_TYPE)) typedef ARMA_U8_TYPE u8; typedef ARMA_S8_TYPE s8; #else #if UCHAR_MAX >= 0xff typedef unsigned char u8; typedef char s8; #elif defined(UINT8_MAX) typedef uint8_t u8; typedef int8_t s8; #else #error "don't know how to typedef 'u8' on this system" #endif #endif // NOTE: "char" can be either "signed char" or "unsigned char" // NOTE: https://en.wikipedia.org/wiki/C_data_types #if USHRT_MAX >= 0xffff typedef unsigned short u16; typedef short s16; #elif defined(UINT16_MAX) typedef uint16_t u16; typedef int16_t s16; #else #error "don't know how to typedef 'u16' on this system" #endif #if UINT_MAX >= 0xffffffff typedef unsigned int u32; typedef int s32; #elif defined(UINT32_MAX) typedef uint32_t u32; typedef int32_t s32; #else #error "don't know how to typedef 'u32' on this system" #endif #if ULLONG_MAX >= 0xffffffffffffffff typedef unsigned long long u64; typedef long long s64; #elif defined(UINT64_MAX) typedef uint64_t u64; typedef int64_t s64; #else #error "don't know how to typedef 'u64' on this system" #endif // for compatibility with earlier versions of Armadillo typedef unsigned long ulng_t; typedef long slng_t; #if defined(ARMA_64BIT_WORD) typedef u64 uword; typedef s64 sword; typedef u32 uhword; typedef s32 shword; #define ARMA_MAX_UWORD 0xffffffffffffffff #define ARMA_MAX_UHWORD 0xffffffff #else typedef u32 uword; typedef s32 sword; typedef u16 uhword; typedef s16 shword; #define ARMA_MAX_UWORD 0xffffffff #define ARMA_MAX_UHWORD 0xffff #endif typedef std::complex cx_float; typedef std::complex cx_double; typedef void* void_ptr; // #if defined(ARMA_BLAS_64BIT_INT) typedef long long blas_int; #define ARMA_MAX_BLAS_INT 0x7fffffffffffffffULL #else typedef int blas_int; #define ARMA_MAX_BLAS_INT 0x7fffffffU #endif // #if defined(ARMA_USE_MKL_TYPES) // for compatibility with MKL typedef MKL_Complex8 blas_cxf; typedef MKL_Complex16 blas_cxd; #else // standard BLAS and LAPACK prototypes use "void*" pointers for complex arrays typedef void blas_cxf; typedef void blas_cxd; #endif // // NOTE: blas_len is the fortran type for "hidden" arguments that specify the length of character arguments; // NOTE: it varies across compilers, compiler versions and systems (eg. 32 bit vs 64 bit); // NOTE: the default setting of "size_t" is an educated guess. // NOTE: --- // NOTE: for gcc / gfortran: https://gcc.gnu.org/onlinedocs/gfortran/Argument-passing-conventions.html // NOTE: gcc 7 and earlier: int // NOTE: gcc 8 and 9: size_t // NOTE: --- // NOTE: for ifort (intel fortran compiler): // NOTE: "Intel Fortran Compiler User and Reference Guides", Document Number: 304970-006US, 2009, p. 301 // NOTE: http://www.complexfluids.ethz.ch/MK/ifort.pdf // NOTE: the type is unsigned 4-byte integer on 32 bit systems // NOTE: the type is unsigned 8-byte integer on 64 bit systems // NOTE: --- // NOTE: for NAG fortran: https://www.nag.co.uk/nagware/np/r62_doc/manual/compiler_11_1.html#AUTOTOC_11_1 // NOTE: Chrlen = usually int, or long long on 64-bit Windows // NOTE: --- // TODO: flang: https://github.com/flang-compiler/flang/wiki // TODO: other compilers: http://fortranwiki.org/fortran/show/Compilers #if !defined(ARMA_FORTRAN_CHARLEN_TYPE) #if defined(__GNUC__) && !defined(__clang__) #if (__GNUC__ <= 7) #define ARMA_FORTRAN_CHARLEN_TYPE int #else #define ARMA_FORTRAN_CHARLEN_TYPE size_t #endif #else // TODO: determine the type for other compilers #define ARMA_FORTRAN_CHARLEN_TYPE size_t #endif #endif typedef ARMA_FORTRAN_CHARLEN_TYPE blas_len; //! @} RcppArmadillo/inst/include/armadillo_bits/fn_qr.hpp0000644000176200001440000000645014635324415022222 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_qr //! @{ //! QR decomposition template inline bool qr ( Mat& Q, Mat& R, const Base& X, const typename arma_blas_type_only::result* junk = nullptr ) { arma_debug_sigprint(); arma_ignore(junk); arma_conform_check( (&Q == &R), "qr(): Q and R are the same object" ); const bool status = auxlib::qr(Q, R, X); if(status == false) { Q.soft_reset(); R.soft_reset(); arma_warn(3, "qr(): decomposition failed"); } return status; } //! economical QR decomposition template inline bool qr_econ ( Mat& Q, Mat& R, const Base& X, const typename arma_blas_type_only::result* junk = nullptr ) { arma_debug_sigprint(); arma_ignore(junk); arma_conform_check( (&Q == &R), "qr_econ(): Q and R are the same object" ); const bool status = auxlib::qr_econ(Q, R, X); if(status == false) { Q.soft_reset(); R.soft_reset(); arma_warn(3, "qr_econ(): decomposition failed"); } return status; } //! QR decomposition with pivoting template inline typename enable_if2< is_supported_blas_type::value, bool >::result qr ( Mat& Q, Mat& R, Mat& P, const Base& X, const char* P_mode = "matrix" ) { arma_debug_sigprint(); arma_conform_check( (&Q == &R), "qr(): Q and R are the same object" ); const char sig = (P_mode != nullptr) ? P_mode[0] : char(0); arma_conform_check( ((sig != 'm') && (sig != 'v')), "qr(): argument 'P_mode' must be \"vector\" or \"matrix\"" ); bool status = false; if(sig == 'v') { status = auxlib::qr_pivot(Q, R, P, X); } else if(sig == 'm') { Mat P_vec; status = auxlib::qr_pivot(Q, R, P_vec, X); if(status) { // construct P const uword N = P_vec.n_rows; P.zeros(N,N); for(uword row=0; row < N; ++row) { P.at(P_vec[row], row) = uword(1); } } } if(status == false) { Q.soft_reset(); R.soft_reset(); P.soft_reset(); arma_warn(3, "qr(): decomposition failed"); } return status; } //! @} RcppArmadillo/inst/include/armadillo_bits/op_expmat_meat.hpp0000644000176200001440000001477015030507611024112 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_expmat //! @{ //! implementation based on: //! Cleve Moler, Charles Van Loan. //! Nineteen Dubious Ways to Compute the Exponential of a Matrix, Twenty-Five Years Later. //! SIAM Review, Vol. 45, No. 1, 2003, pp. 3-49. //! http://dx.doi.org/10.1137/S00361445024180 template inline void op_expmat::apply(Mat& out, const Op& expr) { arma_debug_sigprint(); const bool status = op_expmat::apply_direct(out, expr.m); if(status == false) { out.soft_reset(); arma_stop_runtime_error("expmat(): given matrix appears ill-conditioned"); } } template inline bool op_expmat::apply_direct(Mat& out, const Base& expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; typedef typename T1::pod_type T; if(is_op_diagmat::value) { out = expr.get_ref(); // force the evaluation of diagmat() arma_conform_check( (out.is_square() == false), "expmat(): given matrix must be square sized", [&](){ out.soft_reset(); } ); const uword N = (std::min)(out.n_rows, out.n_cols); for(uword i=0; i A = expr.get_ref(); arma_conform_check( (A.is_square() == false), "expmat(): given matrix must be square sized" ); if(A.is_diagmat()) { arma_debug_print("op_expmat: diag optimisation"); const uword N = (std::min)(A.n_rows, A.n_cols); out.zeros(N,N); for(uword i=0; i eigval; Mat eigvec; const bool eig_status = eig_sym_helper(eigval, eigvec, A, 'd', "expmat()"); if(eig_status == false) { return false; } eigval = exp(eigval); out = eigvec * diagmat(eigval) * eigvec.t(); return true; } // trace reduction const eT diag_shift = arma::trace(A) / T(A.n_rows); const eT exp_diag_shift = std::exp(diag_shift); const bool do_trace_reduction = arma_isfinite(diag_shift) && arma_isfinite(exp_diag_shift) && (exp_diag_shift != eT(0)) && ( (is_cx::yes) ? (std::abs(diag_shift) > T(0)) : (access::tmp_real(diag_shift) > T(0)) ); if(do_trace_reduction) { arma_debug_print("op_expmat: diag_shift: ", diag_shift); A.diag() -= diag_shift; } const T norm_val = arma::norm(A, "inf"); if(arma_isnonfinite(norm_val)) { return false; } int exponent = int(0); std::frexp(norm_val, &exponent); const uword s = (std::min)( uword( (std::max)(int(0), exponent) ), uword(1023) ); arma_debug_print("op_expmat: s: ", s); A /= eT(eop_aux::pow(double(2), double(s))); T c = T(0.5); Mat E(A.n_rows, A.n_rows, fill::eye); E += c * A; Mat D(A.n_rows, A.n_rows, fill::eye); D -= c * A; Mat X = A; bool positive = true; const uword N = 8; for(uword i = 2; i <= N; ++i) { c = c * T(N - i + 1) / T(i * (2*N - i + 1)); X = A * X; E += c * X; if(positive) { D += c * X; } else { D -= c * X; } positive = (positive) ? false : true; } if( (D.internal_has_nonfinite()) || (E.internal_has_nonfinite()) ) { return false; } const bool status = solve(out, D, E, solve_opts::no_approx); if(status == false) { return false; } for(uword i=0; i < s; ++i) { out = out * out; } // inverse trace reduction if(do_trace_reduction) { out *= exp_diag_shift; } return true; } template inline void op_expmat_sym::apply(Mat& out, const Op& in) { arma_debug_sigprint(); const bool status = op_expmat_sym::apply_direct(out, in.m); if(status == false) { out.soft_reset(); arma_stop_runtime_error("expmat_sym(): transformation failed"); } } template inline bool op_expmat_sym::apply_direct(Mat& out, const Base& expr) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { typedef typename T1::elem_type eT; typedef typename T1::pod_type T; const unwrap U(expr.get_ref()); const Mat& X = U.M; arma_conform_check( (X.is_square() == false), "expmat_sym(): given matrix must be square sized" ); if((arma_config::check_conform) && (arma_config::warn_level > 0) && (is_cx::yes) && (sym_helper::check_diag_imag(X) == false)) { arma_warn(1, "inv_sympd(): imaginary components on diagonal are non-zero"); } if(is_op_diagmat::value || X.is_diagmat()) { arma_debug_print("op_expmat_sym: diag optimisation"); out = X; eT* colmem = out.memptr(); const uword N = X.n_rows; for(uword i=0; i eigval; Mat eigvec; const bool status = eig_sym_helper(eigval, eigvec, X, 'd', "expmat_sym()"); if(status == false) { return false; } eigval = exp(eigval); out = eigvec * diagmat(eigval) * eigvec.t(); return true; } #else { arma_ignore(out); arma_ignore(expr); arma_stop_logic_error("expmat_sym(): use of LAPACK must be enabled"); return false; } #endif } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_log_normpdf.hpp0000644000176200001440000001261614631567470024115 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_log_normpdf //! @{ template inline typename enable_if2< (is_real::value), void >::result log_normpdf_helper(Mat& out, const Base& X_expr, const Base& M_expr, const Base& S_expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; if(Proxy::use_at || Proxy::use_at || Proxy::use_at) { const quasi_unwrap UX(X_expr.get_ref()); const quasi_unwrap UM(M_expr.get_ref()); const quasi_unwrap US(S_expr.get_ref()); log_normpdf_helper(out, UX.M, UM.M, US.M); return; } const Proxy PX(X_expr.get_ref()); const Proxy PM(M_expr.get_ref()); const Proxy PS(S_expr.get_ref()); arma_conform_check( ( (PX.get_n_rows() != PM.get_n_rows()) || (PX.get_n_cols() != PM.get_n_cols()) || (PM.get_n_rows() != PS.get_n_rows()) || (PM.get_n_cols() != PS.get_n_cols()) ), "log_normpdf(): size mismatch" ); out.set_size(PX.get_n_rows(), PX.get_n_cols()); eT* out_mem = out.memptr(); const uword N = PX.get_n_elem(); typename Proxy::ea_type X_ea = PX.get_ea(); typename Proxy::ea_type M_ea = PM.get_ea(); typename Proxy::ea_type S_ea = PS.get_ea(); const bool use_mp = arma_config::openmp && mp_gate::eval(N); if(use_mp) { #if defined(ARMA_USE_OPENMP) { const int n_threads = mp_thread_limit::get(); #pragma omp parallel for schedule(static) num_threads(n_threads) for(uword i=0; i::log_sqrt2pi); } } #endif } else { for(uword i=0; i::log_sqrt2pi); } } } template arma_warn_unused inline typename enable_if2< (is_real::value), eT >::result log_normpdf(const eT x) { const eT out = (eT(-0.5) * (x*x)) - Datum::log_sqrt2pi; return out; } template arma_warn_unused inline typename enable_if2< (is_real::value), eT >::result log_normpdf(const eT x, const eT mu, const eT sigma) { const eT tmp = (x - mu) / sigma; const eT out = (eT(-0.5) * (tmp*tmp)) - (std::log(sigma) + Datum::log_sqrt2pi); return out; } template arma_warn_unused inline typename enable_if2< (is_real::value), Mat >::result log_normpdf(const eT x, const Base& M_expr, const Base& S_expr) { arma_debug_sigprint(); const quasi_unwrap UM(M_expr.get_ref()); const Mat& M = UM.M; Mat out; log_normpdf_helper(out, x*ones< Mat >(arma::size(M)), M, S_expr.get_ref()); return out; } template arma_warn_unused inline typename enable_if2< (is_real::value), Mat >::result log_normpdf(const Base& X_expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const quasi_unwrap UX(X_expr.get_ref()); const Mat& X = UX.M; Mat out; log_normpdf_helper(out, X, zeros< Mat >(arma::size(X)), ones< Mat >(arma::size(X))); return out; } template arma_warn_unused inline typename enable_if2< (is_real::value), Mat >::result log_normpdf(const Base& X_expr, const typename T1::elem_type mu, const typename T1::elem_type sigma) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const quasi_unwrap UX(X_expr.get_ref()); const Mat& X = UX.M; Mat out; log_normpdf_helper(out, X, mu*ones< Mat >(arma::size(X)), sigma*ones< Mat >(arma::size(X))); return out; } template arma_warn_unused inline typename enable_if2< (is_real::value), Mat >::result log_normpdf(const Base& X_expr, const Base& M_expr, const Base& S_expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; Mat out; log_normpdf_helper(out, X_expr.get_ref(), M_expr.get_ref(), S_expr.get_ref()); return out; } //! @} RcppArmadillo/inst/include/armadillo_bits/xvec_htrans_meat.hpp0000644000176200001440000000414114631567470024450 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup xvec_htrans //! @{ template inline xvec_htrans::xvec_htrans(const eT* const in_mem, const uword in_n_rows, const uword in_n_cols) : mem (in_mem ) , n_rows(in_n_cols ) // deliberately swapped , n_cols(in_n_rows ) , n_elem(in_n_rows*in_n_cols) { arma_debug_sigprint(); } template inline void xvec_htrans::extract(Mat& out) const { arma_debug_sigprint(); // NOTE: this function assumes that matrix 'out' has already been set to the correct size const eT* in_mem = mem; eT* out_mem = out.memptr(); const uword N = n_elem; for(uword ii=0; ii < N; ++ii) { out_mem[ii] = access::alt_conj( in_mem[ii] ); } } template inline eT xvec_htrans::operator[](const uword ii) const { return access::alt_conj( mem[ii] ); } template inline eT xvec_htrans::at_alt(const uword ii) const { return access::alt_conj( mem[ii] ); } template inline eT xvec_htrans::at(const uword in_row, const uword in_col) const { //return (n_rows == 1) ? access::alt_conj( mem[in_col] ) : access::alt_conj( mem[in_row] ); return access::alt_conj( mem[in_row + in_col] ); // either in_row or in_col must be zero, as we're storing a vector } //! @} RcppArmadillo/inst/include/armadillo_bits/SizeCube_bones.hpp0000644000176200001440000000306014301267043023777 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup SizeCube //! @{ class SizeCube { public: const uword n_rows; const uword n_cols; const uword n_slices; inline explicit SizeCube(const uword in_n_rows, const uword in_n_cols, const uword in_n_slices); inline uword operator[](const uword dim) const; inline uword operator()(const uword dim) const; inline bool operator==(const SizeCube& s) const; inline bool operator!=(const SizeCube& s) const; inline SizeCube operator+(const SizeCube& s) const; inline SizeCube operator-(const SizeCube& s) const; inline SizeCube operator+(const uword val) const; inline SizeCube operator-(const uword val) const; inline SizeCube operator*(const uword val) const; inline SizeCube operator/(const uword val) const; }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_resize_bones.hpp0000644000176200001440000000332614301267043024272 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_resize //! @{ class op_resize : public traits_op_default { public: template inline static void apply(Mat& out, const Op& in); template inline static void apply_mat_inplace(Mat& A, const uword new_n_rows, const uword new_n_cols); template inline static void apply_mat_noalias(Mat& out, const Mat& A, const uword new_n_rows, const uword new_n_cols); // template inline static void apply(Cube& out, const OpCube& in); template inline static void apply_cube_inplace(Cube& A, const uword new_n_rows, const uword new_n_cols, const uword new_n_slices); template inline static void apply_cube_noalias(Cube& out, const Cube& A, const uword new_n_rows, const uword new_n_cols, const uword new_n_slices); }; //! @} RcppArmadillo/inst/include/armadillo_bits/fn_inv.hpp0000644000176200001440000000616314635324415022375 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_inv //! @{ template arma_warn_unused arma_inline typename enable_if2< is_supported_blas_type::value, const Op >::result inv ( const Base& X ) { arma_debug_sigprint(); return Op(X.get_ref()); } template inline typename enable_if2< is_supported_blas_type::value, bool >::result inv ( Mat& out, const Base& X ) { arma_debug_sigprint(); const bool status = op_inv_gen_default::apply_direct(out, X.get_ref(), "inv()"); if(status == false) { out.soft_reset(); arma_warn(3, "inv(): matrix is singular"); } return status; } template arma_warn_unused arma_inline typename enable_if2< is_supported_blas_type::value, const Op >::result inv ( const Base& X, const inv_opts::opts& opts ) { arma_debug_sigprint(); return Op(X.get_ref(), opts.flags, uword(0)); } template inline typename enable_if2< is_supported_blas_type::value, bool >::result inv ( Mat& out, const Base& X, const inv_opts::opts& opts ) { arma_debug_sigprint(); const bool status = op_inv_gen_full::apply_direct(out, X.get_ref(), "inv()", opts.flags); if(status == false) { out.soft_reset(); arma_warn(3, "inv(): matrix is singular"); } return status; } template inline typename enable_if2< is_supported_blas_type::value, bool >::result inv ( Mat& out_inv, typename T1::pod_type& out_rcond, const Base& X ) { arma_debug_sigprint(); typedef typename T1::pod_type T; op_inv_gen_state inv_state; const bool status = op_inv_gen_rcond::apply_direct(out_inv, inv_state, X.get_ref()); out_rcond = inv_state.rcond; if(status == false) { out_rcond = T(0); out_inv.soft_reset(); arma_warn(3, "inv(): matrix is singular"); } return status; } //! @} RcppArmadillo/inst/include/armadillo_bits/op_norm2est_bones.hpp0000644000176200001440000000340414433774144024552 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_norm2est //! @{ template struct norm2est_randu_filler { std::mt19937_64 local_engine; std::uniform_real_distribution local_u_distr; inline norm2est_randu_filler(); inline void fill(eT* mem, const uword N); }; template struct norm2est_randu_filler< std::complex > { std::mt19937_64 local_engine; std::uniform_real_distribution local_u_distr; inline norm2est_randu_filler(); inline void fill(std::complex* mem, const uword N); }; class op_norm2est : public traits_op_default { public: template inline static typename T1::pod_type norm2est(const Base& X, const typename T1::pod_type tolerance, const uword max_iter); template inline static typename T1::pod_type norm2est(const SpBase& X, const typename T1::pod_type tolerance, const uword max_iter); }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_sort_index_meat.hpp0000644000176200001440000000617215030507611024767 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_sort_index //! @{ template inline bool op_sort_index::apply_helper(Mat& out, const Proxy& P, const uword sort_mode) { arma_debug_sigprint(); typedef typename T1::elem_type eT; typedef typename T1::pod_type T; const uword n_elem = P.get_n_elem(); out.set_size(n_elem, 1); const arma_sort_index_helper_prepare prepare; std::vector< arma_sort_index_packet > packet_vec(n_elem); if(Proxy::use_at == false) { const typename Proxy::ea_type Pea = P.get_ea(); for(uword i=0; i < n_elem; ++i) { const eT val = Pea[i]; if(arma_isnan(val)) { return false; } packet_vec[i].val = prepare(val); packet_vec[i].index = i; } } else { const uword n_rows = P.get_n_rows(); const uword n_cols = P.get_n_cols(); uword i = 0; for(uword col=0; col < n_cols; ++col) for(uword row=0; row < n_rows; ++row) { const eT val = P.at(row,col); if(arma_isnan(val)) { return false; } packet_vec[i].val = prepare(val); packet_vec[i].index = i; ++i; } } if(sort_mode == 0) { // ascend arma_sort_index_helper_ascend comparator; std::stable_sort( packet_vec.begin(), packet_vec.end(), comparator ); } else { // descend arma_sort_index_helper_descend comparator; std::stable_sort( packet_vec.begin(), packet_vec.end(), comparator ); } uword* out_mem = out.memptr(); for(uword i=0; i inline void op_sort_index::apply(Mat& out, const mtOp& in) { arma_debug_sigprint(); const Proxy P(in.m); if(P.get_n_elem() == 0) { out.set_size(0,1); return; } const uword sort_mode = in.aux_uword_a; bool all_non_nan = false; if(P.is_alias(out)) { Mat tmp; all_non_nan = op_sort_index::apply_helper(tmp, P, sort_mode); out.steal_mem(tmp); } else { all_non_nan = op_sort_index::apply_helper(out, P, sort_mode); } if(all_non_nan == false) { out.soft_reset(); } arma_conform_check( (all_non_nan == false), "sort_index(): detected NaN" ); } //! @} RcppArmadillo/inst/include/armadillo_bits/cond_rel_bones.hpp0000644000176200001440000000247214301267043024061 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup cond_rel //! @{ // // for preventing pedantic compiler warnings template class cond_rel { public: template arma_inline static bool lt(const eT A, const eT B); template arma_inline static bool gt(const eT A, const eT B); template arma_inline static bool leq(const eT A, const eT B); template arma_inline static bool geq(const eT A, const eT B); template arma_inline static eT make_neg(const eT val); }; //! @} RcppArmadillo/inst/include/armadillo_bits/spglue_min_bones.hpp0000644000176200001440000000330614301267044024434 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup spglue_min //! @{ class spglue_min : public traits_glue_or { public: template inline static void apply(SpMat& out, const SpGlue& X); template inline static void apply_noalias(SpMat& out, const SpProxy& pa, const SpProxy& pb); template inline static void apply_noalias(SpMat& out, const SpMat& A, const SpMat& B); template inline static void dense_sparse_min(Mat& out, const Base& X, const SpBase& Y); template inline static typename enable_if2::no, eT>::result elem_min(const eT& a, const eT& b); template inline static typename enable_if2::yes, eT>::result elem_min(const eT& a, const eT& b); }; //! @} RcppArmadillo/inst/include/armadillo_bits/Mat_bones.hpp0000644000176200001440000013474314723743416023037 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup Mat //! @{ //! Dense matrix class template class Mat : public Base< eT, Mat > { public: typedef eT elem_type; //!< the type of elements stored in the matrix typedef typename get_pod_type::result pod_type; //!< if eT is std::complex, pod_type is T; otherwise pod_type is eT const uword n_rows; //!< number of rows (read-only) const uword n_cols; //!< number of columns (read-only) const uword n_elem; //!< number of elements (read-only) const uword n_alloc; //!< number of allocated elements (read-only); NOTE: n_alloc can be 0, even if n_elem > 0 const uhword vec_state; //!< 0: matrix layout; 1: column vector layout; 2: row vector layout const uhword mem_state; // mem_state = 0: normal matrix which manages its own memory // mem_state = 1: use auxiliary memory until a size change // mem_state = 2: use auxiliary memory and don't allow the number of elements to be changed // mem_state = 3: fixed size (eg. via template based size specification) arma_aligned const eT* const mem; //!< pointer to the memory used for storing elements (memory is read-only) protected: arma_align_mem eT mem_local[ arma_config::mat_prealloc ]; // local storage, for small vectors and matrices public: static constexpr bool is_col = false; static constexpr bool is_row = false; static constexpr bool is_xvec = false; inline ~Mat(); inline Mat(); inline explicit Mat(const uword in_n_rows, const uword in_n_cols); inline explicit Mat(const SizeMat& s); template inline explicit Mat(const uword in_n_rows, const uword in_n_cols, const arma_initmode_indicator&); template inline explicit Mat(const SizeMat& s, const arma_initmode_indicator&); template inline Mat(const uword in_n_rows, const uword in_n_cols, const fill::fill_class& f); template inline Mat(const SizeMat& s, const fill::fill_class& f); inline Mat(const uword in_n_rows, const uword in_n_cols, const fill::scalar_holder f); inline Mat(const SizeMat& s, const fill::scalar_holder f); arma_cold inline Mat(const char* text); arma_cold inline Mat& operator=(const char* text); arma_cold inline Mat(const std::string& text); arma_cold inline Mat& operator=(const std::string& text); inline Mat(const std::vector& x); inline Mat& operator=(const std::vector& x); inline Mat(const std::initializer_list& list); inline Mat& operator=(const std::initializer_list& list); inline Mat(const std::initializer_list< std::initializer_list >& list); inline Mat& operator=(const std::initializer_list< std::initializer_list >& list); inline Mat(Mat&& m); inline Mat& operator=(Mat&& m); inline Mat( eT* aux_mem, const uword aux_n_rows, const uword aux_n_cols, const bool copy_aux_mem = true, const bool strict = false); inline Mat(const eT* aux_mem, const uword aux_n_rows, const uword aux_n_cols); inline Mat& operator= (const eT val); inline Mat& operator+=(const eT val); inline Mat& operator-=(const eT val); inline Mat& operator*=(const eT val); inline Mat& operator/=(const eT val); inline Mat(const Mat& m); inline Mat& operator= (const Mat& m); inline Mat& operator+=(const Mat& m); inline Mat& operator-=(const Mat& m); inline Mat& operator*=(const Mat& m); inline Mat& operator%=(const Mat& m); inline Mat& operator/=(const Mat& m); template inline Mat(const BaseCube& X); template inline Mat& operator= (const BaseCube& X); template inline Mat& operator+=(const BaseCube& X); template inline Mat& operator-=(const BaseCube& X); template inline Mat& operator*=(const BaseCube& X); template inline Mat& operator%=(const BaseCube& X); template inline Mat& operator/=(const BaseCube& X); template inline explicit Mat(const Base& A, const Base& B); inline explicit Mat(const subview& X, const bool use_colmem); // only to be used by the quasi_unwrap class inline Mat(const subview& X); inline Mat& operator= (const subview& X); inline Mat& operator+=(const subview& X); inline Mat& operator-=(const subview& X); inline Mat& operator*=(const subview& X); inline Mat& operator%=(const subview& X); inline Mat& operator/=(const subview& X); inline Mat(const subview_row_strans& X); // subview_row_strans can only be generated by the Proxy class inline Mat(const subview_row_htrans& X); // subview_row_htrans can only be generated by the Proxy class inline Mat(const xvec_htrans& X); // xvec_htrans can only be generated by the Proxy class template inline Mat(const xtrans_mat& X); // xtrans_mat can only be generated by the Proxy class inline Mat(const subview_cube& X); inline Mat& operator= (const subview_cube& X); inline Mat& operator+=(const subview_cube& X); inline Mat& operator-=(const subview_cube& X); inline Mat& operator*=(const subview_cube& X); inline Mat& operator%=(const subview_cube& X); inline Mat& operator/=(const subview_cube& X); inline Mat(const diagview& X); inline Mat& operator= (const diagview& X); inline Mat& operator+=(const diagview& X); inline Mat& operator-=(const diagview& X); inline Mat& operator*=(const diagview& X); inline Mat& operator%=(const diagview& X); inline Mat& operator/=(const diagview& X); template inline Mat(const subview_elem1& X); template inline Mat& operator= (const subview_elem1& X); template inline Mat& operator+=(const subview_elem1& X); template inline Mat& operator-=(const subview_elem1& X); template inline Mat& operator*=(const subview_elem1& X); template inline Mat& operator%=(const subview_elem1& X); template inline Mat& operator/=(const subview_elem1& X); template inline Mat(const subview_elem2& X); template inline Mat& operator= (const subview_elem2& X); template inline Mat& operator+=(const subview_elem2& X); template inline Mat& operator-=(const subview_elem2& X); template inline Mat& operator*=(const subview_elem2& X); template inline Mat& operator%=(const subview_elem2& X); template inline Mat& operator/=(const subview_elem2& X); // Operators on sparse matrices (and subviews) template inline explicit Mat(const SpBase& m); template inline Mat& operator= (const SpBase& m); template inline Mat& operator+=(const SpBase& m); template inline Mat& operator-=(const SpBase& m); template inline Mat& operator*=(const SpBase& m); template inline Mat& operator%=(const SpBase& m); template inline Mat& operator/=(const SpBase& m); inline explicit Mat(const SpSubview& X); inline Mat& operator= (const SpSubview& X); inline Mat& operator+=(const SpSubview& X); inline Mat& operator-=(const SpSubview& X); inline explicit Mat(const spdiagview& X); inline Mat& operator= (const spdiagview& X); inline Mat& operator+=(const spdiagview& X); inline Mat& operator-=(const spdiagview& X); inline Mat& operator*=(const spdiagview& X); inline Mat& operator%=(const spdiagview& X); inline Mat& operator/=(const spdiagview& X); arma_frown("use braced initialiser list instead") inline mat_injector operator<<(const eT val); arma_frown("use braced initialiser list instead") inline mat_injector operator<<(const injector_end_of_row<>& x); arma_inline subview_row row(const uword row_num); arma_inline const subview_row row(const uword row_num) const; inline subview_row operator()(const uword row_num, const span& col_span); inline const subview_row operator()(const uword row_num, const span& col_span) const; arma_inline subview_col col(const uword col_num); arma_inline const subview_col col(const uword col_num) const; inline subview_col operator()(const span& row_span, const uword col_num); inline const subview_col operator()(const span& row_span, const uword col_num) const; inline Col unsafe_col(const uword col_num); inline const Col unsafe_col(const uword col_num) const; arma_inline subview rows(const uword in_row1, const uword in_row2); arma_inline const subview rows(const uword in_row1, const uword in_row2) const; arma_inline subview_cols cols(const uword in_col1, const uword in_col2); arma_inline const subview_cols cols(const uword in_col1, const uword in_col2) const; inline subview rows(const span& row_span); inline const subview rows(const span& row_span) const; arma_inline subview_cols cols(const span& col_span); arma_inline const subview_cols cols(const span& col_span) const; arma_inline subview submat(const uword in_row1, const uword in_col1, const uword in_row2, const uword in_col2); arma_inline const subview submat(const uword in_row1, const uword in_col1, const uword in_row2, const uword in_col2) const; arma_inline subview submat(const uword in_row1, const uword in_col1, const SizeMat& s); arma_inline const subview submat(const uword in_row1, const uword in_col1, const SizeMat& s) const; inline subview submat (const span& row_span, const span& col_span); inline const subview submat (const span& row_span, const span& col_span) const; inline subview operator()(const span& row_span, const span& col_span); inline const subview operator()(const span& row_span, const span& col_span) const; inline subview operator()(const uword in_row1, const uword in_col1, const SizeMat& s); inline const subview operator()(const uword in_row1, const uword in_col1, const SizeMat& s) const; inline subview head_rows(const uword N); inline const subview head_rows(const uword N) const; inline subview tail_rows(const uword N); inline const subview tail_rows(const uword N) const; inline subview_cols head_cols(const uword N); inline const subview_cols head_cols(const uword N) const; inline subview_cols tail_cols(const uword N); inline const subview_cols tail_cols(const uword N) const; template arma_inline subview_elem1 elem(const Base& a); template arma_inline const subview_elem1 elem(const Base& a) const; template arma_inline subview_elem1 operator()(const Base& a); template arma_inline const subview_elem1 operator()(const Base& a) const; template arma_inline subview_elem2 elem(const Base& ri, const Base& ci); template arma_inline const subview_elem2 elem(const Base& ri, const Base& ci) const; template arma_inline subview_elem2 submat(const Base& ri, const Base& ci); template arma_inline const subview_elem2 submat(const Base& ri, const Base& ci) const; template arma_inline subview_elem2 operator()(const Base& ri, const Base& ci); template arma_inline const subview_elem2 operator()(const Base& ri, const Base& ci) const; template arma_inline subview_elem2 rows(const Base& ri); template arma_inline const subview_elem2 rows(const Base& ri) const; template arma_inline subview_elem2 cols(const Base& ci); template arma_inline const subview_elem2 cols(const Base& ci) const; arma_inline subview_each1< Mat, 0 > each_col(); arma_inline subview_each1< Mat, 1 > each_row(); arma_inline const subview_each1< Mat, 0 > each_col() const; arma_inline const subview_each1< Mat, 1 > each_row() const; template inline subview_each2< Mat, 0, T1 > each_col(const Base& indices); template inline subview_each2< Mat, 1, T1 > each_row(const Base& indices); template inline const subview_each2< Mat, 0, T1 > each_col(const Base& indices) const; template inline const subview_each2< Mat, 1, T1 > each_row(const Base& indices) const; inline Mat& each_col(const std::function< void( Col&) >& F); inline const Mat& each_col(const std::function< void(const Col&) >& F) const; inline Mat& each_row(const std::function< void( Row&) >& F); inline const Mat& each_row(const std::function< void(const Row&) >& F) const; arma_inline diagview diag(const sword in_id = 0); arma_inline const diagview diag(const sword in_id = 0) const; inline void swap_rows(const uword in_row1, const uword in_row2); inline void swap_cols(const uword in_col1, const uword in_col2); inline void shed_row(const uword row_num); inline void shed_col(const uword col_num); inline void shed_rows(const uword in_row1, const uword in_row2); inline void shed_cols(const uword in_col1, const uword in_col2); template inline void shed_rows(const Base& indices); template inline void shed_cols(const Base& indices); arma_frown("use insert_rows(row_num, N) instead") inline void insert_rows(const uword row_num, const uword N, const bool set_to_zero); arma_frown("use insert_cols(col_num, N) instead") inline void insert_cols(const uword col_num, const uword N, const bool set_to_zero); inline void insert_rows(const uword row_num, const uword N); inline void insert_cols(const uword col_num, const uword N); template inline void insert_rows(const uword row_num, const Base& X); template inline void insert_cols(const uword col_num, const Base& X); template inline Mat(const Gen& X); template inline Mat& operator= (const Gen& X); template inline Mat& operator+=(const Gen& X); template inline Mat& operator-=(const Gen& X); template inline Mat& operator*=(const Gen& X); template inline Mat& operator%=(const Gen& X); template inline Mat& operator/=(const Gen& X); template inline Mat(const Op& X); template inline Mat& operator= (const Op& X); template inline Mat& operator+=(const Op& X); template inline Mat& operator-=(const Op& X); template inline Mat& operator*=(const Op& X); template inline Mat& operator%=(const Op& X); template inline Mat& operator/=(const Op& X); template inline Mat(const eOp& X); template inline Mat& operator= (const eOp& X); template inline Mat& operator+=(const eOp& X); template inline Mat& operator-=(const eOp& X); template inline Mat& operator*=(const eOp& X); template inline Mat& operator%=(const eOp& X); template inline Mat& operator/=(const eOp& X); template inline Mat(const mtOp& X); template inline Mat& operator= (const mtOp& X); template inline Mat& operator+=(const mtOp& X); template inline Mat& operator-=(const mtOp& X); template inline Mat& operator*=(const mtOp& X); template inline Mat& operator%=(const mtOp& X); template inline Mat& operator/=(const mtOp& X); template inline Mat(const CubeToMatOp& X); template inline Mat& operator= (const CubeToMatOp& X); template inline Mat& operator+=(const CubeToMatOp& X); template inline Mat& operator-=(const CubeToMatOp& X); template inline Mat& operator*=(const CubeToMatOp& X); template inline Mat& operator%=(const CubeToMatOp& X); template inline Mat& operator/=(const CubeToMatOp& X); template inline Mat(const SpToDOp& X); template inline Mat& operator= (const SpToDOp& X); template inline Mat& operator+=(const SpToDOp& X); template inline Mat& operator-=(const SpToDOp& X); template inline Mat& operator*=(const SpToDOp& X); template inline Mat& operator%=(const SpToDOp& X); template inline Mat& operator/=(const SpToDOp& X); template inline explicit Mat(const mtSpReduceOp& X); template inline Mat& operator= (const mtSpReduceOp& X); template inline Mat& operator+=(const mtSpReduceOp& X); template inline Mat& operator-=(const mtSpReduceOp& X); template inline Mat& operator*=(const mtSpReduceOp& X); template inline Mat& operator%=(const mtSpReduceOp& X); template inline Mat& operator/=(const mtSpReduceOp& X); template inline Mat(const Glue& X); template inline Mat& operator= (const Glue& X); template inline Mat& operator+=(const Glue& X); template inline Mat& operator-=(const Glue& X); template inline Mat& operator*=(const Glue& X); template inline Mat& operator%=(const Glue& X); template inline Mat& operator/=(const Glue& X); template inline Mat& operator+=(const Glue& X); template inline Mat& operator-=(const Glue& X); template inline Mat(const eGlue& X); template inline Mat& operator= (const eGlue& X); template inline Mat& operator+=(const eGlue& X); template inline Mat& operator-=(const eGlue& X); template inline Mat& operator*=(const eGlue& X); template inline Mat& operator%=(const eGlue& X); template inline Mat& operator/=(const eGlue& X); template inline Mat(const mtGlue& X); template inline Mat& operator= (const mtGlue& X); template inline Mat& operator+=(const mtGlue& X); template inline Mat& operator-=(const mtGlue& X); template inline Mat& operator*=(const mtGlue& X); template inline Mat& operator%=(const mtGlue& X); template inline Mat& operator/=(const mtGlue& X); template inline Mat(const SpToDGlue& X); template inline Mat& operator= (const SpToDGlue& X); template inline Mat& operator+=(const SpToDGlue& X); template inline Mat& operator-=(const SpToDGlue& X); template inline Mat& operator*=(const SpToDGlue& X); template inline Mat& operator%=(const SpToDGlue& X); template inline Mat& operator/=(const SpToDGlue& X); arma_warn_unused arma_inline const eT& at_alt (const uword ii) const; arma_warn_unused arma_inline eT& operator[] (const uword ii); arma_warn_unused arma_inline const eT& operator[] (const uword ii) const; arma_warn_unused arma_inline eT& at (const uword ii); arma_warn_unused arma_inline const eT& at (const uword ii) const; arma_warn_unused arma_inline eT& operator() (const uword ii); arma_warn_unused arma_inline const eT& operator() (const uword ii) const; #if defined(__cpp_multidimensional_subscript) arma_warn_unused arma_inline eT& operator[] (const uword in_row, const uword in_col); arma_warn_unused arma_inline const eT& operator[] (const uword in_row, const uword in_col) const; #endif arma_warn_unused arma_inline eT& at (const uword in_row, const uword in_col); arma_warn_unused arma_inline const eT& at (const uword in_row, const uword in_col) const; arma_warn_unused arma_inline eT& operator() (const uword in_row, const uword in_col); arma_warn_unused arma_inline const eT& operator() (const uword in_row, const uword in_col) const; arma_inline const Mat& operator++(); arma_inline void operator++(int); arma_inline const Mat& operator--(); arma_inline void operator--(int); arma_warn_unused arma_inline bool is_empty() const; arma_warn_unused arma_inline bool is_vec() const; arma_warn_unused arma_inline bool is_rowvec() const; arma_warn_unused arma_inline bool is_colvec() const; arma_warn_unused arma_inline bool is_square() const; arma_warn_unused inline bool internal_is_finite() const; arma_warn_unused inline bool internal_has_inf() const; arma_warn_unused inline bool internal_has_nan() const; arma_warn_unused inline bool internal_has_nonfinite() const; arma_warn_unused inline bool is_sorted(const char* direction = "ascend") const; arma_warn_unused inline bool is_sorted(const char* direction, const uword dim) const; template arma_warn_unused inline bool is_sorted_helper(const comparator& comp, const uword dim) const; arma_warn_unused arma_inline bool in_range(const uword ii) const; arma_warn_unused arma_inline bool in_range(const span& x ) const; arma_warn_unused arma_inline bool in_range(const uword in_row, const uword in_col) const; arma_warn_unused arma_inline bool in_range(const span& row_span, const uword in_col) const; arma_warn_unused arma_inline bool in_range(const uword in_row, const span& col_span) const; arma_warn_unused arma_inline bool in_range(const span& row_span, const span& col_span) const; arma_warn_unused arma_inline bool in_range(const uword in_row, const uword in_col, const SizeMat& s) const; arma_warn_unused arma_inline eT* colptr(const uword in_col); arma_warn_unused arma_inline const eT* colptr(const uword in_col) const; arma_warn_unused arma_inline eT* memptr(); arma_warn_unused arma_inline const eT* memptr() const; template inline Mat& copy_size(const Base& X); inline Mat& set_size(const uword new_n_elem); inline Mat& set_size(const uword new_n_rows, const uword new_n_cols); inline Mat& set_size(const SizeMat& s); inline Mat& resize(const uword new_n_elem); inline Mat& resize(const uword new_n_rows, const uword new_n_cols); inline Mat& resize(const SizeMat& s); inline Mat& reshape(const uword new_n_rows, const uword new_n_cols); inline Mat& reshape(const SizeMat& s); arma_frown("use reshape(n_rows, n_cols) instead") inline void reshape(const uword new_n_rows, const uword new_n_cols, const uword dim); //!< NOTE: don't use this form: it will be removed template inline Mat& for_each(functor F); template inline const Mat& for_each(functor F) const; template inline Mat& transform(functor F); template inline Mat& imbue(functor F); inline Mat& replace(const eT old_val, const eT new_val); inline Mat& clean(const pod_type threshold); inline Mat& clamp(const eT min_val, const eT max_val); inline Mat& fill(const eT val); template inline Mat& fill(const fill::fill_class& f); inline Mat& zeros(); inline Mat& zeros(const uword new_n_elem); inline Mat& zeros(const uword new_n_rows, const uword new_n_cols); inline Mat& zeros(const SizeMat& s); inline Mat& ones(); inline Mat& ones(const uword new_n_elem); inline Mat& ones(const uword new_n_rows, const uword new_n_cols); inline Mat& ones(const SizeMat& s); inline Mat& randu(); inline Mat& randu(const uword new_n_elem); inline Mat& randu(const uword new_n_rows, const uword new_n_cols); inline Mat& randu(const SizeMat& s); inline Mat& randn(); inline Mat& randn(const uword new_n_elem); inline Mat& randn(const uword new_n_rows, const uword new_n_cols); inline Mat& randn(const SizeMat& s); inline Mat& eye(); inline Mat& eye(const uword new_n_rows, const uword new_n_cols); inline Mat& eye(const SizeMat& s); arma_cold inline void reset(); arma_cold inline void soft_reset(); template inline void set_real(const Base& X); template inline void set_imag(const Base& X); arma_warn_unused inline eT min() const; arma_warn_unused inline eT max() const; arma_frown("use .index_min() instead") inline eT min(uword& index_of_min_val) const; arma_frown("use .index_max() instead") inline eT max(uword& index_of_max_val) const; arma_frown("use .index_min() with ind2sub() instead") inline eT min(uword& row_of_min_val, uword& col_of_min_val) const; arma_frown("use .index_max() with ind2sub() instead") inline eT max(uword& row_of_max_val, uword& col_of_max_val) const; arma_cold inline bool save(const std::string name, const file_type type = arma_binary) const; arma_cold inline bool save(const hdf5_name& spec, const file_type type = hdf5_binary) const; arma_cold inline bool save(const csv_name& spec, const file_type type = csv_ascii) const; arma_cold inline bool save( std::ostream& os, const file_type type = arma_binary) const; arma_cold inline bool load(const std::string name, const file_type type = auto_detect); arma_cold inline bool load(const hdf5_name& spec, const file_type type = hdf5_binary); arma_cold inline bool load(const csv_name& spec, const file_type type = csv_ascii); arma_cold inline bool load( std::istream& is, const file_type type = auto_detect); arma_frown("use save() instead") inline bool quiet_save(const std::string name, const file_type type = arma_binary) const; arma_frown("use save() instead") inline bool quiet_save(const hdf5_name& spec, const file_type type = hdf5_binary) const; arma_frown("use save() instead") inline bool quiet_save(const csv_name& spec, const file_type type = csv_ascii) const; arma_frown("use save() instead") inline bool quiet_save( std::ostream& os, const file_type type = arma_binary) const; arma_frown("use load() instead") inline bool quiet_load(const std::string name, const file_type type = auto_detect); arma_frown("use load() instead") inline bool quiet_load(const hdf5_name& spec, const file_type type = hdf5_binary); arma_frown("use load() instead") inline bool quiet_load(const csv_name& spec, const file_type type = csv_ascii); arma_frown("use load() instead") inline bool quiet_load( std::istream& is, const file_type type = auto_detect); // for container-like functionality typedef eT value_type; typedef uword size_type; typedef eT* iterator; typedef const eT* const_iterator; typedef eT* col_iterator; typedef const eT* const_col_iterator; class const_row_iterator; class row_iterator { public: inline row_iterator(); inline row_iterator(const row_iterator& X); inline row_iterator(Mat& in_M, const uword in_row, const uword in_col); arma_warn_unused inline eT& operator* (); inline row_iterator& operator++(); arma_warn_unused inline row_iterator operator++(int); inline row_iterator& operator--(); arma_warn_unused inline row_iterator operator--(int); arma_warn_unused inline bool operator!=(const row_iterator& X) const; arma_warn_unused inline bool operator==(const row_iterator& X) const; arma_warn_unused inline bool operator!=(const const_row_iterator& X) const; arma_warn_unused inline bool operator==(const const_row_iterator& X) const; typedef std::bidirectional_iterator_tag iterator_category; typedef eT value_type; typedef std::ptrdiff_t difference_type; // TODO: not certain on this one typedef eT* pointer; typedef eT& reference; arma_aligned Mat* M; arma_aligned uword current_row; arma_aligned uword current_col; }; class const_row_iterator { public: inline const_row_iterator(); inline const_row_iterator(const row_iterator& X); inline const_row_iterator(const const_row_iterator& X); inline const_row_iterator(const Mat& in_M, const uword in_row, const uword in_col); arma_warn_unused inline const eT& operator*() const; inline const_row_iterator& operator++(); arma_warn_unused inline const_row_iterator operator++(int); inline const_row_iterator& operator--(); arma_warn_unused inline const_row_iterator operator--(int); arma_warn_unused inline bool operator!=(const row_iterator& X) const; arma_warn_unused inline bool operator==(const row_iterator& X) const; arma_warn_unused inline bool operator!=(const const_row_iterator& X) const; arma_warn_unused inline bool operator==(const const_row_iterator& X) const; typedef std::bidirectional_iterator_tag iterator_category; typedef eT value_type; typedef std::ptrdiff_t difference_type; // TODO: not certain on this one typedef const eT* pointer; typedef const eT& reference; arma_aligned const Mat* M; arma_aligned uword current_row; arma_aligned uword current_col; }; class const_row_col_iterator; class row_col_iterator { public: inline row_col_iterator(); inline row_col_iterator(const row_col_iterator& in_it); inline row_col_iterator(Mat& in_M, const uword row = 0, const uword col = 0); arma_warn_unused inline eT& operator*(); inline row_col_iterator& operator++(); arma_warn_unused inline row_col_iterator operator++(int); inline row_col_iterator& operator--(); arma_warn_unused inline row_col_iterator operator--(int); arma_warn_unused inline uword row() const; arma_warn_unused inline uword col() const; arma_warn_unused inline bool operator==(const row_col_iterator& rhs) const; arma_warn_unused inline bool operator!=(const row_col_iterator& rhs) const; arma_warn_unused inline bool operator==(const const_row_col_iterator& rhs) const; arma_warn_unused inline bool operator!=(const const_row_col_iterator& rhs) const; typedef std::bidirectional_iterator_tag iterator_category; typedef eT value_type; typedef std::ptrdiff_t difference_type; // TODO: not certain on this one typedef eT* pointer; typedef eT& reference; arma_aligned Mat* M; arma_aligned eT* current_ptr; arma_aligned uword current_col; arma_aligned uword current_row; }; class const_row_col_iterator { public: inline const_row_col_iterator(); inline const_row_col_iterator(const row_col_iterator& in_it); inline const_row_col_iterator(const const_row_col_iterator& in_it); inline const_row_col_iterator(const Mat& in_M, const uword row = 0, const uword col = 0); arma_warn_unused inline const eT& operator*() const; inline const_row_col_iterator& operator++(); arma_warn_unused inline const_row_col_iterator operator++(int); inline const_row_col_iterator& operator--(); arma_warn_unused inline const_row_col_iterator operator--(int); arma_warn_unused inline uword row() const; arma_warn_unused inline uword col() const; arma_warn_unused inline bool operator==(const const_row_col_iterator& rhs) const; arma_warn_unused inline bool operator!=(const const_row_col_iterator& rhs) const; arma_warn_unused inline bool operator==(const row_col_iterator& rhs) const; arma_warn_unused inline bool operator!=(const row_col_iterator& rhs) const; // So that we satisfy the STL iterator types. typedef std::bidirectional_iterator_tag iterator_category; typedef eT value_type; typedef std::ptrdiff_t difference_type; // TODO: not certain on this one typedef const eT* pointer; typedef const eT& reference; arma_aligned const Mat* M; arma_aligned const eT* current_ptr; arma_aligned uword current_col; arma_aligned uword current_row; }; inline iterator begin(); inline const_iterator begin() const; inline const_iterator cbegin() const; inline iterator end(); inline const_iterator end() const; inline const_iterator cend() const; inline col_iterator begin_col(const uword col_num); inline const_col_iterator begin_col(const uword col_num) const; inline col_iterator end_col (const uword col_num); inline const_col_iterator end_col (const uword col_num) const; inline row_iterator begin_row(const uword row_num); inline const_row_iterator begin_row(const uword row_num) const; inline row_iterator end_row (const uword row_num); inline const_row_iterator end_row (const uword row_num) const; inline row_col_iterator begin_row_col(); inline const_row_col_iterator begin_row_col() const; inline row_col_iterator end_row_col(); inline const_row_col_iterator end_row_col() const; inline void clear(); inline bool empty() const; inline uword size() const; arma_warn_unused inline eT& front(); arma_warn_unused inline const eT& front() const; arma_warn_unused inline eT& back(); arma_warn_unused inline const eT& back() const; inline void swap(Mat& B); inline void steal_mem(Mat& X); //!< don't use this unless you're writing code internal to Armadillo inline void steal_mem(Mat& X, const bool is_move); //!< don't use this unless you're writing code internal to Armadillo inline void steal_mem_col(Mat& X, const uword max_n_rows); template arma_inline bool is_alias(const Mat& X) const; //!< don't use this unless you're writing code internal to Armadillo template class fixed; protected: inline void init_cold(); inline void init_warm(uword in_n_rows, uword in_n_cols); arma_cold inline void init(const std::string& text); inline void init(const std::initializer_list& list); inline void init(const std::initializer_list< std::initializer_list >& list); template inline void init(const Base& A, const Base& B); inline Mat(const char junk, const eT* aux_mem, const uword aux_n_rows, const uword aux_n_cols); inline Mat(const arma_vec_indicator&, const uhword in_vec_state); inline Mat(const arma_vec_indicator&, const uword in_n_rows, const uword in_n_cols, const uhword in_vec_state); inline Mat(const arma_fixed_indicator&, const uword in_n_rows, const uword in_n_cols, const uhword in_vec_state, const eT* in_mem); friend class Cube; friend class subview_cube; friend class glue_join; friend class op_strans; friend class op_htrans; friend class op_resize; friend class op_mean; friend class op_max; friend class op_min; public: #if defined(ARMA_EXTRA_MAT_PROTO) #include ARMA_INCFILE_WRAP(ARMA_EXTRA_MAT_PROTO) #endif }; template template class Mat::fixed : public Mat { private: using Mat::mem_local; static constexpr uword fixed_n_elem = fixed_n_rows * fixed_n_cols; static constexpr bool use_extra = (fixed_n_elem > arma_config::mat_prealloc); arma_align_mem eT mem_local_extra[ (use_extra) ? fixed_n_elem : 1 ]; public: typedef fixed Mat_fixed_type; typedef eT elem_type; typedef typename get_pod_type::result pod_type; static constexpr bool is_col = (fixed_n_cols == 1); static constexpr bool is_row = (fixed_n_rows == 1); static constexpr bool is_xvec = false; static const uword n_rows; // value provided below the class definition static const uword n_cols; // value provided below the class definition static const uword n_elem; // value provided below the class definition arma_inline fixed(); arma_inline fixed(const fixed& X); inline fixed(const fill::scalar_holder f); template inline fixed(const fill::fill_class& f); template inline fixed(const Base& A); template inline fixed(const Base& A, const Base& B); inline fixed(const eT* aux_mem); inline fixed(const char* text); inline fixed(const std::string& text); using Mat::operator=; using Mat::operator(); inline fixed(const std::initializer_list& list); inline Mat& operator=(const std::initializer_list& list); inline fixed(const std::initializer_list< std::initializer_list >& list); inline Mat& operator=(const std::initializer_list< std::initializer_list >& list); arma_inline Mat& operator=(const fixed& X); #if defined(ARMA_GOOD_COMPILER) template inline Mat& operator=(const eOp& X); template inline Mat& operator=(const eGlue& X); #endif arma_warn_unused arma_inline const Op< Mat_fixed_type, op_htrans > t() const; arma_warn_unused arma_inline const Op< Mat_fixed_type, op_htrans > ht() const; arma_warn_unused arma_inline const Op< Mat_fixed_type, op_strans > st() const; arma_warn_unused arma_inline const eT& at_alt (const uword i) const; arma_warn_unused arma_inline eT& operator[] (const uword i); arma_warn_unused arma_inline const eT& operator[] (const uword i) const; arma_warn_unused arma_inline eT& at (const uword i); arma_warn_unused arma_inline const eT& at (const uword i) const; arma_warn_unused arma_inline eT& operator() (const uword i); arma_warn_unused arma_inline const eT& operator() (const uword i) const; #if defined(__cpp_multidimensional_subscript) arma_warn_unused arma_inline eT& operator[] (const uword in_row, const uword in_col); arma_warn_unused arma_inline const eT& operator[] (const uword in_row, const uword in_col) const; #endif arma_warn_unused arma_inline eT& at (const uword in_row, const uword in_col); arma_warn_unused arma_inline const eT& at (const uword in_row, const uword in_col) const; arma_warn_unused arma_inline eT& operator() (const uword in_row, const uword in_col); arma_warn_unused arma_inline const eT& operator() (const uword in_row, const uword in_col) const; arma_warn_unused arma_inline eT* colptr(const uword in_col); arma_warn_unused arma_inline const eT* colptr(const uword in_col) const; arma_warn_unused arma_inline eT* memptr(); arma_warn_unused arma_inline const eT* memptr() const; arma_warn_unused arma_inline bool is_vec() const; inline const Mat& fill(const eT val); inline const Mat& zeros(); inline const Mat& ones(); }; // these definitions are outside of the class due to bizarre C++ rules; // C++17 has inline variables to address this shortcoming template template const uword Mat::fixed::n_rows = fixed_n_rows; template template const uword Mat::fixed::n_cols = fixed_n_cols; template template const uword Mat::fixed::n_elem = fixed_n_rows * fixed_n_cols; class Mat_aux { public: template inline static void prefix_pp(Mat& x); template inline static void prefix_pp(Mat< std::complex >& x); template inline static void postfix_pp(Mat& x); template inline static void postfix_pp(Mat< std::complex >& x); template inline static void prefix_mm(Mat& x); template inline static void prefix_mm(Mat< std::complex >& x); template inline static void postfix_mm(Mat& x); template inline static void postfix_mm(Mat< std::complex >& x); template inline static void set_real(Mat& out, const Base& X); template inline static void set_real(Mat< std::complex >& out, const Base< T,T1>& X); template inline static void set_imag(Mat& out, const Base& X); template inline static void set_imag(Mat< std::complex >& out, const Base< T,T1>& X); }; //! @} RcppArmadillo/inst/include/armadillo_bits/band_helper.hpp0000644000176200001440000002255414770765377023403 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup band_helper //! @{ namespace band_helper { template inline bool is_band(uword& out_KL, uword& out_KU, const Mat& A, const uword N_min) { arma_debug_sigprint(); // NOTE: assuming that A has a square size // NOTE: assuming that N_min is >= 4 const uword N = A.n_rows; if(N < N_min) { return false; } // first, quickly check bottom-left and top-right corners const eT eT_zero = eT(0); const eT* A_col0 = A.memptr(); const eT* A_col1 = A_col0 + N; if( (A_col0[N-2] != eT_zero) || (A_col0[N-1] != eT_zero) || (A_col1[N-2] != eT_zero) || (A_col1[N-1] != eT_zero) ) { return false; } const eT* A_colNm2 = A.colptr(N-2); const eT* A_colNm1 = A_colNm2 + N; if( (A_colNm2[0] != eT_zero) || (A_colNm2[1] != eT_zero) || (A_colNm1[0] != eT_zero) || (A_colNm1[1] != eT_zero) ) { return false; } // if we reached this point, go through the entire matrix to work out number of subdiagonals and superdiagonals const uword n_nonzero_threshold = (N*N)/4; // empirically determined uword KL = 0; // number of subdiagonals uword KU = 0; // number of superdiagonals const eT* A_colptr = A.memptr(); for(uword col=0; col < N; ++col) { uword first_nonzero_row = col; uword last_nonzero_row = col; for(uword row=0; row < col; ++row) { if( A_colptr[row] != eT_zero ) { first_nonzero_row = row; break; } } for(uword row=(col+1); row < N; ++row) { last_nonzero_row = (A_colptr[row] != eT_zero) ? row : last_nonzero_row; } const uword L_count = last_nonzero_row - col; const uword U_count = col - first_nonzero_row; if( (L_count > KL) || (U_count > KU) ) { KL = (std::max)(KL, L_count); KU = (std::max)(KU, U_count); const uword n_nonzero = N*(KL+KU+1) - (KL*(KL+1) + KU*(KU+1))/2; // return as soon as we know that it's not worth analysing the matrix any further if(n_nonzero > n_nonzero_threshold) { return false; } } A_colptr += N; } out_KL = KL; out_KU = KU; return true; } template inline bool is_band_lower(uword& out_KD, const Mat& A, const uword N_min) { arma_debug_sigprint(); // NOTE: assuming that A has a square size // NOTE: assuming that N_min is >= 4 const uword N = A.n_rows; if(N < N_min) { return false; } // first, quickly check bottom-left corner const eT eT_zero = eT(0); const eT* A_col0 = A.memptr(); const eT* A_col1 = A_col0 + N; if( (A_col0[N-2] != eT_zero) || (A_col0[N-1] != eT_zero) || (A_col1[N-2] != eT_zero) || (A_col1[N-1] != eT_zero) ) { return false; } // if we reached this point, go through the bottom triangle to work out number of subdiagonals const uword n_nonzero_threshold = ( N*N - (N*(N-1))/2 ) / 4; // empirically determined uword KL = 0; // number of subdiagonals const eT* A_colptr = A.memptr(); for(uword col=0; col < N; ++col) { uword last_nonzero_row = col; for(uword row=(col+1); row < N; ++row) { last_nonzero_row = (A_colptr[row] != eT_zero) ? row : last_nonzero_row; } const uword L_count = last_nonzero_row - col; if(L_count > KL) { KL = L_count; const uword n_nonzero = N*(KL+1) - (KL*(KL+1))/2; // return as soon as we know that it's not worth analysing the matrix any further if(n_nonzero > n_nonzero_threshold) { return false; } } A_colptr += N; } out_KD = KL; return true; } template inline bool is_band_upper(uword& out_KD, const Mat& A, const uword N_min) { arma_debug_sigprint(); // NOTE: assuming that A has a square size // NOTE: assuming that N_min is >= 4 const uword N = A.n_rows; if(N < N_min) { return false; } // first, quickly check top-right corner const eT eT_zero = eT(0); const eT* A_colNm2 = A.colptr(N-2); const eT* A_colNm1 = A_colNm2 + N; if( (A_colNm2[0] != eT_zero) || (A_colNm2[1] != eT_zero) || (A_colNm1[0] != eT_zero) || (A_colNm1[1] != eT_zero) ) { return false; } // if we reached this point, go through the entire matrix to work out number of superdiagonals const uword n_nonzero_threshold = ( N*N - (N*(N-1))/2 ) / 4; // empirically determined uword KU = 0; // number of superdiagonals const eT* A_colptr = A.memptr(); for(uword col=0; col < N; ++col) { uword first_nonzero_row = col; for(uword row=0; row < col; ++row) { if( A_colptr[row] != eT_zero ) { first_nonzero_row = row; break; } } const uword U_count = col - first_nonzero_row; if(U_count > KU) { KU = U_count; const uword n_nonzero = N*(KU+1) - (KU*(KU+1))/2; // return as soon as we know that it's not worth analysing the matrix any further if(n_nonzero > n_nonzero_threshold) { return false; } } A_colptr += N; } out_KD = KU; return true; } template inline void compress(Mat& AB, const Mat& A, const uword KL, const uword KU, const bool use_offset) { arma_debug_sigprint(); // NOTE: assuming that A has a square size // band matrix storage format // http://www.netlib.org/lapack/lug/node124.html // for ?gbsv, matrix AB size: 2*KL+KU+1 x N; band representation of A stored in rows KL+1 to 2*KL+KU+1 (note: fortran counts from 1) // for ?gbsvx, matrix AB size: KL+KU+1 x N; band representation of A stored in rows 1 to KL+KU+1 (note: fortran counts from 1) // // the +1 in the above formulas is to take into account the main diagonal const uword AB_n_rows = (use_offset) ? uword(2*KL + KU + 1) : uword(KL + KU + 1); const uword N = A.n_rows; AB.set_size(AB_n_rows, N); if(A.is_empty()) { AB.zeros(); return; } if(AB_n_rows == uword(1)) { eT* AB_mem = AB.memptr(); for(uword i=0; i KU) ? uword(j - KU) : uword(0); const uword A_row_endp1 = (std::min)(N, j+KL+1); const uword length = A_row_endp1 - A_row_start; const uword AB_row_start = (KU > j) ? (KU - j) : uword(0); const eT* A_colptr = A.colptr(j) + A_row_start; eT* AB_colptr = AB.colptr(j) + AB_row_start + ( (use_offset) ? KL : uword(0) ); arrayops::copy( AB_colptr, A_colptr, length ); } } } template inline void uncompress(Mat& A, const Mat& AB, const uword KL, const uword KU, const bool use_offset) { arma_debug_sigprint(); const uword AB_n_rows = AB.n_rows; const uword N = AB.n_cols; arma_conform_check( (AB_n_rows != ((use_offset) ? uword(2*KL + KU + 1) : uword(KL + KU + 1))), "band_helper::uncompress(): detected inconsistency" ); A.zeros(N,N); // assuming there is no aliasing between A and AB if(AB_n_rows == uword(1)) { const eT* AB_mem = AB.memptr(); for(uword i=0; i KU) ? uword(j - KU) : uword(0); const uword A_row_endp1 = (std::min)(N, j+KL+1); const uword length = A_row_endp1 - A_row_start; const uword AB_row_start = (KU > j) ? (KU - j) : uword(0); const eT* AB_colptr = AB.colptr(j) + AB_row_start + ( (use_offset) ? KL : uword(0) ); eT* A_colptr = A.colptr(j) + A_row_start; arrayops::copy( A_colptr, AB_colptr, length ); } } } template inline void extract_tridiag(Mat& out, const Mat& A) { arma_debug_sigprint(); // NOTE: assuming that A has a square size and is at least 2x2 const uword N = A.n_rows; out.set_size(N, 3); // assuming there is no aliasing between 'out' and 'A' if(N < 2) { return; } eT* DL = out.colptr(0); eT* DD = out.colptr(1); eT* DU = out.colptr(2); DD[0] = A[0]; DL[0] = A[1]; const uword Nm1 = N-1; const uword Nm2 = N-2; for(uword i=0; i < Nm2; ++i) { const uword ip1 = i+1; const eT* data = &(A.at(i, ip1)); const eT tmp0 = data[0]; const eT tmp1 = data[1]; const eT tmp2 = data[2]; DL[ip1] = tmp2; DD[ip1] = tmp1; DU[i ] = tmp0; } const eT* data = &(A.at(Nm2, Nm1)); DL[Nm1] = 0; DU[Nm2] = data[0]; DU[Nm1] = 0; DD[Nm1] = data[1]; } } // end of namespace band_helper //! @} RcppArmadillo/inst/include/armadillo_bits/glue_intersect_meat.hpp0000644000176200001440000000662614631567470025152 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup glue_intersect //! @{ template inline void glue_intersect::apply(Mat& out, const Glue& X) { arma_debug_sigprint(); uvec iA; uvec iB; glue_intersect::apply(out, iA, iB, X.A, X.B, false); } template inline void glue_intersect::apply(Mat& out, uvec& iA, uvec& iB, const Base& A_expr, const Base& B_expr, const bool calc_indx) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const quasi_unwrap UA(A_expr.get_ref()); const quasi_unwrap UB(B_expr.get_ref()); if(UA.M.is_empty() || UB.M.is_empty()) { out.reset(); iA.reset(); iB.reset(); return; } uvec A_uniq_indx; uvec B_uniq_indx; Mat A_uniq; Mat B_uniq; if(calc_indx) { A_uniq_indx = find_unique(UA.M); B_uniq_indx = find_unique(UB.M); A_uniq = UA.M.elem(A_uniq_indx); B_uniq = UB.M.elem(B_uniq_indx); } else { A_uniq = unique(UA.M); B_uniq = unique(UB.M); } const uword C_n_elem = A_uniq.n_elem + B_uniq.n_elem; Col C(C_n_elem, arma_nozeros_indicator()); arrayops::copy(C.memptr(), A_uniq.memptr(), A_uniq.n_elem); arrayops::copy(C.memptr() + A_uniq.n_elem, B_uniq.memptr(), B_uniq.n_elem); uvec C_sorted_indx; Col C_sorted; if(calc_indx) { C_sorted_indx = stable_sort_index(C); C_sorted = C.elem(C_sorted_indx); } else { C_sorted = sort(C); } const eT* C_sorted_mem = C_sorted.memptr(); uvec jj(C_n_elem, arma_nozeros_indicator()); // worst case length uword* jj_mem = jj.memptr(); uword jj_count = 0; for(uword i=0; i < (C_n_elem-1); ++i) { if( C_sorted_mem[i] == C_sorted_mem[i+1] ) { jj_mem[jj_count] = i; ++jj_count; } } if(jj_count == 0) { out.reset(); iA.reset(); iB.reset(); return; } const uvec ii(jj.memptr(), jj_count, false); if(UA.M.is_rowvec() && UB.M.is_rowvec()) { out.set_size(1, ii.n_elem); Mat out_alias(out.memptr(), ii.n_elem, 1, false, true); // NOTE: this relies on .elem() not changing the size of the output and not reallocating memory for the output out_alias = C_sorted.elem(ii); } else { out = C_sorted.elem(ii); } if(calc_indx) { iA = A_uniq_indx.elem(C_sorted_indx.elem(ii ) ); iB = B_uniq_indx.elem(C_sorted_indx.elem(ii+1) - A_uniq.n_elem); } } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_chi2rnd.hpp0000644000176200001440000000651214631567470023136 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_chi2rnd //! @{ arma_warn_unused inline double chi2rnd(const double df) { arma_debug_sigprint(); op_chi2rnd_varying_df generator; return generator(df); } template arma_warn_unused inline typename arma_real_only::result chi2rnd(const eT df) { arma_debug_sigprint(); op_chi2rnd_varying_df generator; return generator(df); } template arma_warn_unused inline typename enable_if2 < (is_arma_type::value && is_real::value), const Op >::result chi2rnd(const T1& expr) { arma_debug_sigprint(); return Op(expr); } template arma_warn_unused inline typename enable_if2 < (is_Mat::value && is_real::value), obj_type >::result chi2rnd(const typename obj_type::elem_type df, const uword n_rows, const uword n_cols) { arma_debug_sigprint(); if(is_Col::value) { arma_conform_check( (n_cols != 1), "chi2rnd(): incompatible size" ); } else if(is_Row::value) { arma_conform_check( (n_rows != 1), "chi2rnd(): incompatible size" ); } obj_type out(n_rows, n_cols, arma_nozeros_indicator()); op_chi2rnd::fill_constant_df(out, df); return out; } template arma_warn_unused inline typename enable_if2 < (is_Mat::value && is_real::value), obj_type >::result chi2rnd(const typename obj_type::elem_type df, const SizeMat& s) { arma_debug_sigprint(); return chi2rnd(df, s.n_rows, s.n_cols); } template arma_warn_unused inline typename enable_if2 < (is_Mat::value && is_real::value), obj_type >::result chi2rnd(const typename obj_type::elem_type df, const uword n_elem) { arma_debug_sigprint(); if(is_Row::value) { return chi2rnd(df, 1, n_elem); } else { return chi2rnd(df, n_elem, 1); } } arma_warn_unused inline mat chi2rnd(const double df, const uword n_rows, const uword n_cols) { arma_debug_sigprint(); return chi2rnd(df, n_rows, n_cols); } arma_warn_unused inline mat chi2rnd(const double df, const SizeMat& s) { arma_debug_sigprint(); return chi2rnd(df, s.n_rows, s.n_cols); } arma_warn_unused inline vec chi2rnd(const double df, const uword n_elem) { arma_debug_sigprint(); return chi2rnd(df, n_elem, 1); } //! @} RcppArmadillo/inst/include/armadillo_bits/op_sqrtmat_meat.hpp0000644000176200001440000002725414713753317024325 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_sqrtmat //! @{ //! implementation partly based on: //! N. J. Higham. //! A New sqrtm for Matlab. //! Numerical Analysis Report No. 336, January 1999. //! Department of Mathematics, University of Manchester. //! ISSN 1360-1725 //! http://www.maths.manchester.ac.uk/~higham/narep/narep336.ps.gz template inline void op_sqrtmat::apply(Mat< std::complex >& out, const mtOp,T1,op_sqrtmat>& in) { arma_debug_sigprint(); const bool status = op_sqrtmat::apply_direct(out, in.m); if(status == false) { arma_warn(3, "sqrtmat(): given matrix is singular; may not have a square root"); } } template inline bool op_sqrtmat::apply_direct(Mat< std::complex >& out, const Op& expr) { arma_debug_sigprint(); typedef typename T1::elem_type T; const diagmat_proxy P(expr.m); arma_conform_check( (P.n_rows != P.n_cols), "sqrtmat(): given matrix must be square sized" ); const uword N = P.n_rows; out.zeros(N,N); bool singular = false; for(uword i=0; i= T(0)) { singular = (singular || (val == T(0))); out.at(i,i) = std::sqrt(val); } else { out.at(i,i) = std::sqrt( std::complex(val) ); } } return (singular) ? false : true; } template inline bool op_sqrtmat::apply_direct(Mat< std::complex >& out, const Base& expr) { arma_debug_sigprint(); typedef typename T1::elem_type in_T; typedef typename std::complex out_T; const quasi_unwrap expr_unwrap(expr.get_ref()); const Mat& A = expr_unwrap.M; arma_conform_check( (A.is_square() == false), "sqrtmat(): given matrix must be square sized" ); if(A.n_elem == 0) { out.reset(); return true; } else if(A.n_elem == 1) { out.set_size(1,1); out[0] = std::sqrt( std::complex( A[0] ) ); return true; } if(A.is_diagmat()) { arma_debug_print("op_sqrtmat: diag optimisation"); const uword N = A.n_rows; out.zeros(N,N); // aliasing can't happen as op_sqrtmat is defined as cx_mat = op(mat) for(uword i=0; i= in_T(0)) { out.at(i,i) = std::sqrt(val); } else { out.at(i,i) = std::sqrt( out_T(val) ); } } return true; } const bool try_sympd = arma_config::optimise_sym && sym_helper::guess_sympd(A); if(try_sympd) { arma_debug_print("op_sqrtmat: attempting sympd optimisation"); // if matrix A is sympd, all its eigenvalues are positive Col eigval; Mat eigvec; const bool eig_status = eig_sym_helper(eigval, eigvec, A, 'd', "sqrtmat()"); if(eig_status) { // ensure each eigenvalue is > 0 const uword N = eigval.n_elem; const in_T* eigval_mem = eigval.memptr(); bool all_pos = true; for(uword i=0; i >::from( eigvec * diagmat(eigval) * eigvec.t() ); return true; } } arma_debug_print("op_sqrtmat: sympd optimisation failed"); // fallthrough if eigen decomposition failed or an eigenvalue is <= 0 } Mat U; Mat S(A.n_rows, A.n_cols, arma_nozeros_indicator()); const in_T* Amem = A.memptr(); out_T* Smem = S.memptr(); const uword n_elem = A.n_elem; for(uword i=0; i( Amem[i] ); } const bool schur_ok = auxlib::schur(U,S); if(schur_ok == false) { arma_debug_print("sqrtmat(): schur decomposition failed"); out.soft_reset(); return false; } const bool status = op_sqrtmat_cx::helper(S); const Mat X = U*S; S.reset(); out = X*U.t(); return status; } template inline void op_sqrtmat_cx::apply(Mat& out, const Op& in) { arma_debug_sigprint(); const bool status = op_sqrtmat_cx::apply_direct(out, in.m); if(status == false) { arma_warn(3, "sqrtmat(): given matrix is singular; may not have a square root"); } } template inline bool op_sqrtmat_cx::apply_direct(Mat& out, const Op& expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const diagmat_proxy P(expr.m); bool status = false; if(P.is_alias(out)) { Mat tmp; status = op_sqrtmat_cx::apply_direct_noalias(tmp, P); out.steal_mem(tmp); } else { status = op_sqrtmat_cx::apply_direct_noalias(out, P); } return status; } template inline bool op_sqrtmat_cx::apply_direct_noalias(Mat& out, const diagmat_proxy& P) { arma_debug_sigprint(); typedef typename T1::elem_type eT; arma_conform_check( (P.n_rows != P.n_cols), "sqrtmat(): given matrix must be square sized" ); const uword N = P.n_rows; out.zeros(N,N); const eT zero = eT(0); bool singular = false; for(uword i=0; i inline bool op_sqrtmat_cx::apply_direct(Mat& out, const Base& expr) { arma_debug_sigprint(); typedef typename T1::pod_type T; typedef typename T1::elem_type eT; Mat U; Mat S = expr.get_ref(); arma_conform_check( (S.n_rows != S.n_cols), "sqrtmat(): given matrix must be square sized" ); if(S.n_elem == 0) { out.reset(); return true; } else if(S.n_elem == 1) { out.set_size(1,1); out[0] = std::sqrt(S[0]); return true; } if(S.is_diagmat()) { arma_debug_print("op_sqrtmat_cx: diag optimisation"); const uword N = S.n_rows; out.zeros(N,N); // aliasing can't happen as S is generated for(uword i=0; i eigval; Mat eigvec; const bool eig_status = eig_sym_helper(eigval, eigvec, S, 'd', "sqrtmat()"); if(eig_status) { // ensure each eigenvalue is > 0 const uword N = eigval.n_elem; const T* eigval_mem = eigval.memptr(); bool all_pos = true; for(uword i=0; i X = U*S; S.reset(); out = X*U.t(); return status; } template inline bool op_sqrtmat_cx::helper(Mat< std::complex >& S) { typedef typename std::complex eT; if(S.is_empty()) { return true; } const uword N = S.n_rows; const eT zero = eT(0); eT& S_00 = S[0]; bool singular = (S_00 == zero); S_00 = std::sqrt(S_00); for(uword j=1; j < N; ++j) { eT* S_j = S.colptr(j); eT& S_jj = S_j[j]; singular = (singular || (S_jj == zero)); S_jj = std::sqrt(S_jj); for(uword ii=0; ii <= (j-1); ++ii) { const uword i = (j-1) - ii; const eT* S_i = S.colptr(i); //S_j[i] /= (S_i[i] + S_j[j]); S_j[i] /= (S_i[i] + S_jj); for(uword k=0; k < i; ++k) { S_j[k] -= S_i[k] * S_j[i]; } } } return (singular) ? false : true; } template inline void op_sqrtmat_sympd::apply(Mat& out, const Op& in) { arma_debug_sigprint(); const bool status = op_sqrtmat_sympd::apply_direct(out, in.m); if(status == false) { out.soft_reset(); arma_stop_runtime_error("sqrtmat_sympd(): transformation failed"); } } template inline bool op_sqrtmat_sympd::apply_direct(Mat& out, const Base& expr) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { typedef typename T1::elem_type eT; typedef typename T1::pod_type T; const unwrap U(expr.get_ref()); const Mat& X = U.M; arma_conform_check( (X.is_square() == false), "sqrtmat_sympd(): given matrix must be square sized" ); if((arma_config::check_conform) && (is_cx::yes) && (sym_helper::check_diag_imag(X) == false)) { arma_warn(1, "sqrtmat_sympd(): imaginary components on the diagonal are non-zero"); } if(is_op_diagmat::value || X.is_diagmat()) { arma_debug_print("op_sqrtmat_sympd: diag optimisation"); out = X; eT* colmem = out.memptr(); const uword N = X.n_rows; for(uword i=0; i eigval; Mat eigvec; const bool status = eig_sym_helper(eigval, eigvec, X, 'd', "sqrtmat_sympd()"); if(status == false) { return false; } const uword N = eigval.n_elem; const T* eigval_mem = eigval.memptr(); bool all_pos = true; for(uword i=0; i arma_warn_unused arma_inline typename enable_if2 < is_arma_type::value && resolves_to_vector::yes, const Op >::result cumprod(const T1& X) { arma_debug_sigprint(); return Op(X); } template arma_warn_unused arma_inline typename enable_if2 < is_arma_type::value && resolves_to_vector::no, const Op >::result cumprod(const T1& X) { arma_debug_sigprint(); return Op(X, 0, 0); } template arma_warn_unused arma_inline typename enable_if2 < is_arma_type::value, const Op >::result cumprod(const T1& X, const uword dim) { arma_debug_sigprint(); return Op(X, dim, 0); } template arma_warn_unused arma_inline typename arma_scalar_only::result cumprod(const T& x) { return x; } //! @} RcppArmadillo/inst/include/armadillo_bits/op_prod_meat.hpp0000644000176200001440000001035714631567470023574 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_prod //! @{ template inline void op_prod::apply_noalias(Mat& out, const Mat& X, const uword dim) { arma_debug_sigprint(); const uword X_n_rows = X.n_rows; const uword X_n_cols = X.n_cols; if(dim == 0) // traverse across rows (ie. find the product in each column) { out.set_size(1, X_n_cols); eT* out_mem = out.memptr(); for(uword col=0; col < X_n_cols; ++col) { out_mem[col] = arrayops::product(X.colptr(col), X_n_rows); } } else // traverse across columns (ie. find the product in each row) { out.ones(X_n_rows, 1); eT* out_mem = out.memptr(); for(uword col=0; col < X_n_cols; ++col) { const eT* X_col_mem = X.colptr(col); for(uword row=0; row < X_n_rows; ++row) { out_mem[row] *= X_col_mem[row]; } } } } template inline void op_prod::apply(Mat& out, const Op& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword dim = in.aux_uword_a; arma_conform_check( (dim > 1), "prod(): parameter 'dim' must be 0 or 1" ); const quasi_unwrap U(in.m); if(U.is_alias(out)) { Mat tmp; op_prod::apply_noalias(tmp, U.M, dim); out.steal_mem(tmp); } else { op_prod::apply_noalias(out, U.M, dim); } } template inline eT op_prod::prod(const subview& X) { arma_debug_sigprint(); eT val = eT(1); const uword X_n_rows = X.n_rows; const uword X_n_cols = X.n_cols; if(X_n_rows == 1) { const Mat& A = X.m; const uword start_row = X.aux_row1; const uword start_col = X.aux_col1; const uword end_col_p1 = start_col + X_n_cols; uword i,j; for(i=start_col, j=start_col+1; j < end_col_p1; i+=2, j+=2) { val *= A.at(start_row, i); val *= A.at(start_row, j); } if(i < end_col_p1) { val *= A.at(start_row, i); } } else { for(uword col=0; col < X_n_cols; ++col) { val *= arrayops::product( X.colptr(col), X_n_rows ); } } return val; } template inline typename T1::elem_type op_prod::prod(const Base& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const Proxy P(X.get_ref()); eT val = eT(1); if(Proxy::use_at == false) { typedef typename Proxy::ea_type ea_type; const ea_type A = P.get_ea(); const uword n_elem = P.get_n_elem(); uword i,j; for(i=0, j=1; j < n_elem; i+=2, j+=2) { val *= A[i]; val *= A[j]; } if(i < n_elem) { val *= A[i]; } } else { const uword n_rows = P.get_n_rows(); const uword n_cols = P.get_n_cols(); if(n_rows == 1) { uword i,j; for(i=0, j=1; j < n_cols; i+=2, j+=2) { val *= P.at(0,i); val *= P.at(0,j); } if(i < n_cols) { val *= P.at(0,i); } } else { for(uword col=0; col < n_cols; ++col) { uword i,j; for(i=0, j=1; j < n_rows; i+=2, j+=2) { val *= P.at(i,col); val *= P.at(j,col); } if(i < n_rows) { val *= P.at(i,col); } } } } return val; } //! @} RcppArmadillo/inst/include/armadillo_bits/newarp_TridiagEigen_meat.hpp0000644000176200001440000000660214631567470026037 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ namespace newarp { template inline TridiagEigen::TridiagEigen() : n(0) , computed(false) { arma_debug_sigprint(); } template inline TridiagEigen::TridiagEigen(const Mat& mat_obj) : n(mat_obj.n_rows) , computed(false) { arma_debug_sigprint(); compute(mat_obj); } template inline void TridiagEigen::compute(const Mat& mat_obj) { arma_debug_sigprint(); arma_conform_check( (mat_obj.is_square() == false), "newarp::TridiagEigen::compute(): matrix must be square" ); n = blas_int(mat_obj.n_rows); main_diag = mat_obj.diag(); sub_diag = mat_obj.diag(-1); evecs.set_size(n, n); char compz = 'I'; blas_int lwork_min = 1 + 4*n + n*n; blas_int liwork_min = 3 + 5*n; blas_int info = blas_int(0); blas_int lwork_proposed = 0; blas_int liwork_proposed = 0; if(n >= 32) { eT work_query[2] = {}; blas_int lwork_query = blas_int(-1); blas_int iwork_query[2] = {}; blas_int liwork_query = blas_int(-1); arma_debug_print("lapack::stedc()"); lapack::stedc(&compz, &n, main_diag.memptr(), sub_diag.memptr(), evecs.memptr(), &n, &work_query[0], &lwork_query, &iwork_query[0], &liwork_query, &info); if(info != 0) { arma_stop_runtime_error("lapack::stedc(): couldn't get size of work arrays"); return; } lwork_proposed = static_cast( work_query[0] ); liwork_proposed = iwork_query[0]; } blas_int lwork = (std::max)( lwork_min, lwork_proposed); blas_int liwork = (std::max)(liwork_min, liwork_proposed); podarray work( static_cast( lwork) ); podarray iwork( static_cast(liwork) ); arma_debug_print("lapack::stedc()"); lapack::stedc(&compz, &n, main_diag.memptr(), sub_diag.memptr(), evecs.memptr(), &n, work.memptr(), &lwork, iwork.memptr(), &liwork, &info); if(info != 0) { arma_stop_runtime_error("lapack::stedc(): failed to compute all eigenvalues"); return; } computed = true; } template inline Col TridiagEigen::eigenvalues() { arma_debug_sigprint(); arma_conform_check( (computed == false), "newarp::TridiagEigen::eigenvalues(): need to call compute() first" ); // After calling compute(), main_diag will contain the eigenvalues. return main_diag; } template inline Mat TridiagEigen::eigenvectors() { arma_debug_sigprint(); arma_conform_check( (computed == false), "newarp::TridiagEigen::eigenvectors(): need to call compute() first" ); return evecs; } } // namespace newarp RcppArmadillo/inst/include/armadillo_bits/fn_eig_pair.hpp0000644000176200001440000001030014635324415023344 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_eig_pair //! @{ template arma_warn_unused inline typename enable_if2< is_supported_blas_type::value, Col< std::complex > >::result eig_pair ( const Base& A_expr, const Base& B_expr ) { arma_debug_sigprint(); typedef typename T1::pod_type T; Col< std::complex > eigvals; Mat< std::complex > eigvecs; const bool status = auxlib::eig_pair(eigvals, eigvecs, false, A_expr.get_ref(), B_expr.get_ref()); if(status == false) { eigvals.soft_reset(); arma_stop_runtime_error("eig_pair(): decomposition failed"); } return eigvals; } template inline typename enable_if2< is_supported_blas_type::value, bool >::result eig_pair ( Col< std::complex >& eigvals, const Base< typename T1::elem_type, T1 >& A_expr, const Base< typename T1::elem_type, T2 >& B_expr ) { arma_debug_sigprint(); typedef typename T1::pod_type T; Mat< std::complex > eigvecs; const bool status = auxlib::eig_pair(eigvals, eigvecs, false, A_expr.get_ref(), B_expr.get_ref()); if(status == false) { eigvals.soft_reset(); arma_warn(3, "eig_pair(): decomposition failed"); } return status; } template inline typename enable_if2< is_supported_blas_type::value, bool >::result eig_pair ( Col< std::complex >& eigvals, Mat< std::complex >& eigvecs, const Base< typename T1::elem_type, T1 >& A_expr, const Base< typename T1::elem_type, T2 >& B_expr ) { arma_debug_sigprint(); arma_conform_check( (void_ptr(&eigvals) == void_ptr(&eigvecs)), "eig_pair(): parameter 'eigval' is an alias of parameter 'eigvec'" ); const bool status = auxlib::eig_pair(eigvals, eigvecs, true, A_expr.get_ref(), B_expr.get_ref()); if(status == false) { eigvals.soft_reset(); eigvecs.soft_reset(); arma_warn(3, "eig_pair(): decomposition failed"); } return status; } template inline typename enable_if2< is_supported_blas_type::value, bool >::result eig_pair ( Col< std::complex >& eigvals, Mat< std::complex >& leigvecs, Mat< std::complex >& reigvecs, const Base< typename T1::elem_type, T1 >& A_expr, const Base< typename T1::elem_type, T2 >& B_expr ) { arma_debug_sigprint(); arma_conform_check( (void_ptr(&eigvals) == void_ptr(&leigvecs)), "eig_pair(): parameter 'eigval' is an alias of parameter 'leigvec'" ); arma_conform_check( (void_ptr(&eigvals) == void_ptr(&reigvecs)), "eig_pair(): parameter 'eigval' is an alias of parameter 'reigvec'" ); arma_conform_check( (void_ptr(&leigvecs) == void_ptr(&reigvecs)), "eig_pair(): parameter 'leigvec' is an alias of parameter 'reigvec'" ); const bool status = auxlib::eig_pair_twosided(eigvals, leigvecs, reigvecs, A_expr.get_ref(), B_expr.get_ref()); if(status == false) { eigvals.soft_reset(); leigvecs.soft_reset(); reigvecs.soft_reset(); arma_warn(3, "eig_pair(): decomposition failed"); } return status; } //! @} RcppArmadillo/inst/include/armadillo_bits/operator_cube_times.hpp0000644000176200001440000000540614631567470025155 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup operator_cube_times //! @{ //! BaseCube * scalar template arma_inline const eOpCube operator* ( const BaseCube& X, const typename T1::elem_type k ) { arma_debug_sigprint(); return eOpCube(X.get_ref(), k); } //! scalar * BaseCube template arma_inline const eOpCube operator* ( const typename T1::elem_type k, const BaseCube& X ) { arma_debug_sigprint(); return eOpCube(X.get_ref(), k); } //! non-complex BaseCube * complex scalar (experimental) template arma_inline const mtOpCube, T1, op_cx_scalar_times> operator* ( const BaseCube& X, const std::complex& k ) { arma_debug_sigprint(); return mtOpCube, T1, op_cx_scalar_times>('j', X.get_ref(), k); } //! complex scalar * non-complex BaseCube (experimental) template arma_inline const mtOpCube, T1, op_cx_scalar_times> operator* ( const std::complex& k, const BaseCube& X ) { arma_debug_sigprint(); return mtOpCube, T1, op_cx_scalar_times>('j', X.get_ref(), k); } template arma_inline Cube operator* ( const subview_cube_each1& X, const Base& Y ) { arma_debug_sigprint(); return subview_cube_each1_aux::operator_times(X, Y.get_ref()); } template arma_inline Cube operator* ( const Base& X, const subview_cube_each1& Y ) { arma_debug_sigprint(); return subview_cube_each1_aux::operator_times(X.get_ref(), Y); } //! @} RcppArmadillo/inst/include/armadillo_bits/op_flip_bones.hpp0000644000176200001440000000315514301267043023723 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_flip //! @{ class op_flipud : public traits_op_passthru { public: template inline static void apply(Mat& out, const Op& in); template inline static void apply_direct(Mat& out, const Mat& X); template inline static void apply_proxy_noalias(Mat& out, const Proxy& P); }; class op_fliplr : public traits_op_passthru { public: template inline static void apply(Mat& out, const Op& in); template inline static void apply_direct(Mat& out, const Mat& X); template inline static void apply_proxy_noalias(Mat& out, const Proxy& P); }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_mean_meat.hpp0000644000176200001440000002255715030651223023535 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_mean //! @{ template inline void op_mean::apply(Mat& out, const Op& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword dim = in.aux_uword_a; arma_conform_check( (dim > 1), "mean(): parameter 'dim' must be 0 or 1" ); const quasi_unwrap U(in.m); if(U.is_alias(out)) { Mat tmp; op_mean::apply_noalias(tmp, U.M, dim); out.steal_mem(tmp); } else { op_mean::apply_noalias(out, U.M, dim); } } template inline void op_mean::apply_noalias(Mat& out, const Mat& X, const uword dim) { arma_debug_sigprint(); typedef typename get_pod_type::result T; const uword X_n_rows = X.n_rows; const uword X_n_cols = X.n_cols; if(dim == 0) { out.set_size((X_n_rows > 0) ? 1 : 0, X_n_cols); if(X_n_rows == 0) { return; } eT* out_mem = out.memptr(); for(uword col=0; col < X_n_cols; ++col) { out_mem[col] = op_mean::direct_mean( X.colptr(col), X_n_rows ); } } else if(dim == 1) { out.zeros(X_n_rows, (X_n_cols > 0) ? 1 : 0); if(X_n_cols == 0) { return; } eT* out_mem = out.memptr(); for(uword col=0; col < X_n_cols; ++col) { const eT* col_mem = X.colptr(col); for(uword row=0; row < X_n_rows; ++row) { out_mem[row] += col_mem[row]; } } out /= T(X_n_cols); if(out.internal_has_nonfinite()) { podarray tmp; for(uword row=0; row < X_n_rows; ++row) { const eT old_mean = out_mem[row]; if(arma_isnonfinite(old_mean)) { tmp.copy_row(X, row); out_mem[row] = op_mean::direct_mean_robust(old_mean, tmp.memptr(), tmp.n_elem); } } } } } // template inline void op_mean::apply(Cube& out, const OpCube& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword dim = in.aux_uword_a; arma_conform_check( (dim > 2), "mean(): parameter 'dim' must be 0 or 1 or 2" ); const unwrap_cube U(in.m); if(U.is_alias(out)) { Cube tmp; op_mean::apply_noalias(tmp, U.M, dim); out.steal_mem(tmp); } else { op_mean::apply_noalias(out, U.M, dim); } } template inline void op_mean::apply_noalias(Cube& out, const Cube& X, const uword dim) { arma_debug_sigprint(); typedef typename get_pod_type::result T; const uword X_n_rows = X.n_rows; const uword X_n_cols = X.n_cols; const uword X_n_slices = X.n_slices; if(dim == 0) { out.set_size((X_n_rows > 0) ? 1 : 0, X_n_cols, X_n_slices); if(X_n_rows == 0) { return; } for(uword slice=0; slice < X_n_slices; ++slice) { eT* out_mem = out.slice_memptr(slice); for(uword col=0; col < X_n_cols; ++col) { out_mem[col] = op_mean::direct_mean( X.slice_colptr(slice,col), X_n_rows ); } } } else if(dim == 1) { out.zeros(X_n_rows, (X_n_cols > 0) ? 1 : 0, X_n_slices); if(X_n_cols == 0) { return; } for(uword slice=0; slice < X_n_slices; ++slice) { eT* out_mem = out.slice_memptr(slice); for(uword col=0; col < X_n_cols; ++col) { const eT* col_mem = X.slice_colptr(slice,col); for(uword row=0; row < X_n_rows; ++row) { out_mem[row] += col_mem[row]; } } for(uword row=0; row < X_n_rows; ++row) { out_mem[row] /= T(X_n_cols); } if(arrayops::is_finite(out_mem, X_n_rows) == false) { const Mat tmp_mat('j', X.slice_memptr(slice), X_n_rows, X_n_cols); podarray tmp_vec; for(uword row=0; row < X_n_rows; ++row) { const eT old_mean = out_mem[row]; if(arma_isnonfinite(old_mean)) { tmp_vec.copy_row(tmp_mat, row); out_mem[row] = op_mean::direct_mean_robust(old_mean, tmp_vec.memptr(), tmp_vec.n_elem); } } } } } else if(dim == 2) { out.zeros(X_n_rows, X_n_cols, (X_n_slices > 0) ? 1 : 0); if(X_n_slices == 0) { return; } eT* out_mem = out.memptr(); for(uword slice=0; slice < X_n_slices; ++slice) { arrayops::inplace_plus(out_mem, X.slice_memptr(slice), X.n_elem_slice ); } out /= T(X_n_slices); if(out.internal_has_nonfinite()) { podarray tmp(X_n_slices); for(uword col=0; col < X_n_cols; ++col) for(uword row=0; row < X_n_rows; ++row) { const eT old_mean = out.at(row,col,0); if(arma_isnonfinite(old_mean)) { for(uword slice=0; slice < X_n_slices; ++slice) { tmp[slice] = X.at(row,col,slice); } out.at(row,col,0) = op_mean::direct_mean_robust(old_mean, tmp.memptr(), tmp.n_elem); } } } } } // template inline eT op_mean::direct_mean(const eT* X_mem, const uword N) { arma_debug_sigprint(); typedef typename get_pod_type::result T; const eT mean = arrayops::accumulate(X_mem, N) / T(N); return arma_isfinite(mean) ? mean : op_mean::direct_mean_robust(mean, X_mem, N); } template inline eT op_mean::direct_mean_robust(const eT old_mean, const eT* X_mem, const uword N) { arma_debug_sigprint(); // use an adapted form of the mean finding algorithm from the running_stat class typedef typename get_pod_type::result T; if(arrayops::is_finite(X_mem, N) == false) { return old_mean; } eT r_mean = eT(0); for(uword i=0; i < N; ++i) { r_mean = r_mean + (X_mem[i] - r_mean) / T(i+1); } return r_mean; } // template inline typename T1::elem_type op_mean::mean_all(const T1& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const quasi_unwrap U(X); if(U.M.n_elem == 0) { arma_conform_check(true, "mean(): object has no elements"); return Datum::nan; } return op_mean::direct_mean(U.M.memptr(), U.M.n_elem); } template inline typename T1::elem_type op_mean::mean_all(const Op& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword omit_mode = in.aux_uword_a; if(arma_config::fast_math_warn) { if(omit_mode == 1) { arma_warn(1, "omit_nan(): detection of NaN is not reliable in fast math mode"); } if(omit_mode == 2) { arma_warn(1, "omit_nonfinite(): detection of non-finite values is not reliable in fast math mode"); } } const quasi_unwrap U(in.m); if(U.M.n_elem == 0) { arma_conform_check(true, "mean(): object has no elements"); return Datum::nan; } auto is_omitted_1 = [](const eT& x) -> bool { return arma_isnan(x); }; auto is_omitted_2 = [](const eT& x) -> bool { return arma_isnonfinite(x); }; eT result = eT(0); if(omit_mode == 1) { result = op_mean::mean_all_omit(U.M.memptr(), U.M.n_elem, is_omitted_1); } if(omit_mode == 2) { result = op_mean::mean_all_omit(U.M.memptr(), U.M.n_elem, is_omitted_2); } return result; } template inline eT op_mean::mean_all_omit(const eT* X_mem, const uword N, functor is_omitted) { arma_debug_sigprint(); typedef typename get_pod_type::result T; uword count = 0; eT acc = eT(0); for(uword i=0; i < N; ++i) { const eT val = X_mem[i]; if(is_omitted(val) == false) { acc += val; ++count; } } acc /= T(count); if(arma_isfinite(acc)) { return acc; } // handle possible overflow eT r_mean = eT(0); count = 0; for(uword i=0; i < N; ++i) { const eT val = X_mem[i]; if(is_omitted(val) == false) { r_mean = r_mean + (val - r_mean) / T(count+1); // kept as count+1 to use same algorithm as op_mean::direct_mean_robust() ++count; } } return r_mean; } // template arma_inline eT op_mean::robust_mean(const eT A, const eT B) { return (arma_isfinite(A) && arma_isfinite(B)) ? eT( A + (B - A)/eT(2) ) : eT( (A+B)/eT(2) ); } template arma_inline std::complex op_mean::robust_mean(const std::complex& A, const std::complex& B) { typedef typename std::complex eT; return (arma_isfinite(A) && arma_isfinite(B)) ? eT( A + (B - A)/T(2) ) : eT( (A+B)/T(2) ); } //! @} RcppArmadillo/inst/include/armadillo_bits/newarp_UpperHessenbergQR_bones.hpp0000644000176200001440000000503614301267043027213 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ namespace newarp { //! Perform the QR decomposition of an upper Hessenberg matrix. template class UpperHessenbergQR { protected: uword n; Mat mat_T; // Gi = [ cos[i] sin[i]] // [-sin[i] cos[i]] // Q = G1 * G2 * ... * G_{n-1} Col rot_cos; Col rot_sin; bool computed; public: //! Default constructor. Computation can //! be performed later by calling the compute() method. inline UpperHessenbergQR(); //! Constructor to create an object that performs and stores the //! QR decomposition of an upper Hessenberg matrix `mat_obj`. inline UpperHessenbergQR(const Mat& mat_obj); //! Conduct the QR factorisation of an upper Hessenberg matrix. virtual void compute(const Mat& mat_obj); //! Return the \f$RQ\f$ matrix, the multiplication of \f$R\f$ and \f$Q\f$, //! which is an upper Hessenberg matrix. virtual Mat matrix_RQ(); //! Apply the \f$Q\f$ matrix to another matrix \f$Y\f$. inline void apply_YQ(Mat& Y); }; //! Perform the QR decomposition of a tridiagonal matrix, a special //! case of upper Hessenberg matrices. template class TridiagQR : public UpperHessenbergQR { public: //! Default constructor. Computation can //! be performed later by calling the compute() method. inline TridiagQR(); //! Constructor to create an object that performs and stores the //! QR decomposition of a tridiagonal matrix `mat_obj`. inline TridiagQR(const Mat& mat_obj); //! Conduct the QR factorisation of a tridiagonal matrix. inline void compute(const Mat& mat_obj); //! Return the \f$RQ\f$ matrix, the multiplication of \f$R\f$ and \f$Q\f$, //! which is a tridiagonal matrix. inline Mat matrix_RQ(); }; } // namespace newarp RcppArmadillo/inst/include/armadillo_bits/fn_balance.hpp0000644000176200001440000000677415030507611023165 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_balance //! @{ template inline typename enable_if2< is_supported_blas_type::value, bool >::result balance(Col& S, Col& P, Mat& B, const Base& A, const char* method = "both") { arma_debug_sigprint(); arma_conform_check( (void_ptr(&S) == void_ptr(&B)), "eig_gen(): parameter 'S' is an alias of parameter 'B'" ); const char sig = (method != nullptr) ? method[0] : char(0); if( (sig != 'b') && (sig != 's') && (sig != 'p') ) { arma_stop_logic_error("balance(): unsupported method"); } const bool do_scale = (sig == 'b') || (sig == 's'); const bool do_perm = (sig == 'b') || (sig == 'p'); const bool calc_SP = true; B = A.get_ref(); if(B.is_square() == false) { B.soft_reset(); arma_stop_logic_error("balance(): given matrix must be square sized"); return false; } const bool status = auxlib::balance(S, P, B, calc_SP, do_scale, do_perm); if(status == false) { S.soft_reset(); P.soft_reset(); B.soft_reset(); arma_warn(3, "balance(): transformation failed"); } return status; } template inline typename enable_if2< is_supported_blas_type::value, bool >::result balance(Mat& B, const Base& A, const char* method = "both") { arma_debug_sigprint(); typedef typename T1::pod_type T; const char sig = (method != nullptr) ? method[0] : char(0); if( (sig != 'b') && (sig != 's') && (sig != 'p') ) { arma_stop_logic_error("balance(): unsupported method"); } const bool do_scale = (sig == 'b') || (sig == 's'); const bool do_perm = (sig == 'b') || (sig == 'p'); const bool calc_SP = false; B = A.get_ref(); if(B.is_square() == false) { B.soft_reset(); arma_stop_logic_error("balance(): given matrix must be square sized"); return false; } Col S; Col P; const bool status = auxlib::balance(S, P, B, calc_SP, do_scale, do_perm); if(status == false) { B.soft_reset(); arma_warn(3, "balance(): transformation failed"); } return status; } template inline typename enable_if2< is_supported_blas_type::value, Mat >::result balance(const Base& A, const char* method = "both") { arma_debug_sigprint(); typedef typename T1::elem_type eT; Mat B; const bool status = balance(B, A, method); if(status == false) { arma_stop_runtime_error("balance(): transformation failed"); } return B; } //! @} RcppArmadillo/inst/include/armadillo_bits/op_all_bones.hpp0000644000176200001440000000443014752446051023546 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_all //! @{ class op_all : public traits_op_xvec { public: template static inline bool all_vec_helper(const Base& X); template static inline bool all_vec_helper(const subview& X); template static inline bool all_vec_helper(const Op& X); template static inline bool all_vec_helper ( const mtOp& X, const typename arma_op_rel_only::result* junk1 = nullptr, const typename arma_not_cx::result* junk2 = nullptr ); template static inline bool all_vec_helper ( const mtGlue& X, const typename arma_glue_rel_only::result* junk1 = nullptr, const typename arma_not_cx::result* junk2 = nullptr, const typename arma_not_cx::result* junk3 = nullptr ); template static inline bool all_vec(T1& X); template static inline void apply_mat_noalias(Mat& out, const Mat& X, const uword dim); template static inline void apply_proxy_noalias(Mat& out, const Proxy& P, const uword dim); template static inline void apply(Mat& out, const mtOp& X); }; //! @} RcppArmadillo/inst/include/armadillo_bits/SpRow_meat.hpp0000644000176200001440000002274114634016465023200 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup SpRow //! @{ template inline SpRow::SpRow() : SpMat(arma_vec_indicator(), 2) { arma_debug_sigprint(); } template inline SpRow::SpRow(const uword in_n_elem) : SpMat(arma_vec_indicator(), 1, in_n_elem, 2) { arma_debug_sigprint(); } template inline SpRow::SpRow(const uword in_n_rows, const uword in_n_cols) : SpMat(arma_vec_indicator(), in_n_rows, in_n_cols, 2) { arma_debug_sigprint(); } template inline SpRow::SpRow(const SizeMat& s) : SpMat(arma_vec_indicator(), 0, 0, 2) { arma_debug_sigprint(); SpMat::init(s.n_rows, s.n_cols); } template inline SpRow::SpRow(const char* text) : SpMat(arma_vec_indicator(), 2) { arma_debug_sigprint(); SpMat::init(std::string(text)); } template inline SpRow& SpRow::operator=(const char* text) { arma_debug_sigprint(); SpMat::init(std::string(text)); return *this; } template inline SpRow::SpRow(const std::string& text) : SpMat(arma_vec_indicator(), 2) { arma_debug_sigprint(); SpMat::init(text); } template inline SpRow& SpRow::operator=(const std::string& text) { arma_debug_sigprint(); SpMat::init(text); return *this; } template inline SpRow& SpRow::operator=(const eT val) { arma_debug_sigprint(); SpMat::operator=(val); return *this; } template template inline SpRow::SpRow(const Base& X) : SpMat(arma_vec_indicator(), 2) { arma_debug_sigprint(); SpMat::operator=(X.get_ref()); } template inline SpRow::SpRow(const Row& X) : SpMat(arma_vec_indicator(), 2) { arma_debug_sigprint(); SpMat::operator=(X); } template template inline SpRow& SpRow::operator=(const Base& X) { arma_debug_sigprint(); SpMat::operator=(X.get_ref()); return *this; } template template inline SpRow::SpRow(const SpBase& X) : SpMat(arma_vec_indicator(), 2) { arma_debug_sigprint(); SpMat::operator=(X.get_ref()); } template template inline SpRow& SpRow::operator=(const SpBase& X) { arma_debug_sigprint(); SpMat::operator=(X.get_ref()); return *this; } template template inline SpRow::SpRow ( const SpBase::pod_type, T1>& A, const SpBase::pod_type, T2>& B ) : SpMat(arma_vec_indicator(), 2) { arma_debug_sigprint(); SpMat::init(A,B); } template inline const SpOp,spop_htrans> SpRow::t() const { return SpOp,spop_htrans>(*this); } template inline const SpOp,spop_htrans> SpRow::ht() const { return SpOp,spop_htrans>(*this); } template inline const SpOp,spop_strans> SpRow::st() const { return SpOp,spop_strans>(*this); } template inline const SpToDOp,op_sp_as_dense> SpRow::as_dense() const { return SpToDOp,op_sp_as_dense>(*this); } //! remove specified columns template inline void SpRow::shed_col(const uword col_num) { arma_debug_sigprint(); arma_conform_check_bounds( col_num >= SpMat::n_cols, "SpRow::shed_col(): out of bounds" ); shed_cols(col_num, col_num); } //! remove specified columns template inline void SpRow::shed_cols(const uword in_col1, const uword in_col2) { arma_debug_sigprint(); arma_conform_check_bounds ( (in_col1 > in_col2) || (in_col2 >= SpMat::n_cols), "SpRow::shed_cols(): indices out of bounds or incorrectly used" ); SpMat::sync_csc(); const uword diff = (in_col2 - in_col1 + 1); // This is doubleplus easy because we have all the column pointers stored. const uword start = SpMat::col_ptrs[in_col1]; const uword end = SpMat::col_ptrs[in_col2 + 1]; if(start != end) { const uword elem_diff = end - start; eT* new_values = memory::acquire (SpMat::n_nonzero - elem_diff); uword* new_row_indices = memory::acquire(SpMat::n_nonzero - elem_diff); // Copy first set of elements, if necessary. if(start > 0) { arrayops::copy(new_values, SpMat::values, start); arrayops::copy(new_row_indices, SpMat::row_indices, start); } // Copy last set of elements, if necessary. if(end != SpMat::n_nonzero) { arrayops::copy(new_values + start, SpMat::values + end, (SpMat::n_nonzero - end)); arrayops::copy(new_row_indices + start, SpMat::row_indices + end, (SpMat::n_nonzero - end)); } memory::release(SpMat::values); memory::release(SpMat::row_indices); access::rw(SpMat::values) = new_values; access::rw(SpMat::row_indices) = new_row_indices; access::rw(SpMat::n_nonzero) -= elem_diff; } // Update column pointers. uword* new_col_ptrs = memory::acquire(SpMat::n_cols - diff + 1); // Copy first part of column pointers. if(in_col1 > 0) { arrayops::copy(new_col_ptrs, SpMat::col_ptrs, in_col1); } // Copy last part of column pointers (and adjust their values as necessary). if(in_col2 < SpMat::n_cols - 1) { arrayops::copy(new_col_ptrs + in_col1, SpMat::col_ptrs + in_col2 + 1, SpMat::n_cols - in_col2); // Modify their values. arrayops::inplace_minus(new_col_ptrs + in_col1, (end - start), SpMat::n_cols - in_col2); } memory::release(SpMat::col_ptrs); access::rw(SpMat::col_ptrs) = new_col_ptrs; access::rw(SpMat::n_cols) -= diff; access::rw(SpMat::n_elem) -= diff; SpMat::invalidate_cache(); } // //! insert N cols at the specified col position, // //! optionally setting the elements of the inserted cols to zero // template // inline // void // SpRow::insert_cols(const uword col_num, const uword N, const bool set_to_zero) // { // arma_debug_sigprint(); // // // insertion at col_num == n_cols is in effect an append operation // arma_conform_check_bounds( (col_num > SpMat::n_cols), "SpRow::insert_cols(): out of bounds" ); // // arma_conform_check( (set_to_zero == false), "SpRow::insert_cols(): cannot set elements to nonzero values" ); // // uword newVal = (col_num == 0) ? 0 : SpMat::col_ptrs[col_num]; // SpMat::col_ptrs.insert(col_num, N, newVal); // uword* new_col_ptrs = memory::acquire(SpMat::n_cols + N); // // arrayops::copy(new_col_ptrs, SpMat::col_ptrs, col_num); // // uword fill_value = (col_num == 0) ? 0 : SpMat::col_ptrs[col_num - 1]; // arrayops::inplace_set(new_col_ptrs + col_num, fill_value, N); // // arrayops::copy(new_col_ptrs + col_num + N, SpMat::col_ptrs + col_num, SpMat::n_cols - col_num); // // access::rw(SpMat::n_cols) += N; // access::rw(SpMat::n_elem) += N; // } template inline typename SpRow::row_iterator SpRow::begin_row(const uword row_num) { arma_debug_sigprint(); // Since this is a row, row_num can only be 0. But the option is provided for // compatibility. arma_conform_check_bounds((row_num >= 1), "SpRow::begin_row(): index out of bounds"); return SpMat::begin(); } template inline typename SpRow::const_row_iterator SpRow::begin_row(const uword row_num) const { arma_debug_sigprint(); // Since this is a row, row_num can only be 0. But the option is provided for // compatibility. arma_conform_check_bounds((row_num >= 1), "SpRow::begin_row(): index out of bounds"); return SpMat::begin(); } template inline typename SpRow::row_iterator SpRow::end_row(const uword row_num) { arma_debug_sigprint(); // Since this is a row, row_num can only be 0. But the option is provided for // compatibility. arma_conform_check_bounds((row_num >= 1), "SpRow::end_row(): index out of bounds"); return SpMat::end(); } template inline typename SpRow::const_row_iterator SpRow::end_row(const uword row_num) const { arma_debug_sigprint(); // Since this is a row, row_num can only be 0. But the option is provided for // compatibility. arma_conform_check_bounds((row_num >= 1), "SpRow::end_row(): index out of bounds"); return SpMat::end(); } #if defined(ARMA_EXTRA_SPROW_MEAT) #include ARMA_INCFILE_WRAP(ARMA_EXTRA_SPROW_MEAT) #endif //! @} RcppArmadillo/inst/include/armadillo_bits/op_row_as_mat_bones.hpp0000644000176200001440000000202714374704744025137 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_row_as_mat //! @{ class op_row_as_mat : public traits_op_default { public: template inline static void apply(Mat& out, const CubeToMatOp& expr); }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_var_meat.hpp0000644000176200001440000001466315030507611023405 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_var //! @{ template inline void op_var::apply(Mat& out, const mtOp& in) { arma_debug_sigprint(); typedef typename T1::pod_type out_eT; const uword norm_type = in.aux_uword_a; const uword dim = in.aux_uword_b; arma_conform_check( (norm_type > 1), "var(): parameter 'norm_type' must be 0 or 1" ); arma_conform_check( (dim > 1), "var(): parameter 'dim' must be 0 or 1" ); const quasi_unwrap U(in.m); if(U.is_alias(out)) { Mat tmp; op_var::apply_noalias(tmp, U.M, norm_type, dim); out.steal_mem(tmp); } else { op_var::apply_noalias(out, U.M, norm_type, dim); } } template inline void op_var::apply_noalias(Mat::result>& out, const Mat& X, const uword norm_type, const uword dim) { arma_debug_sigprint(); typedef typename get_pod_type::result out_eT; const uword X_n_rows = X.n_rows; const uword X_n_cols = X.n_cols; if(dim == 0) { arma_debug_print("op_var::apply_noalias(): dim = 0"); out.set_size((X_n_rows > 0) ? 1 : 0, X_n_cols); if(X_n_rows > 0) { out_eT* out_mem = out.memptr(); for(uword col=0; col < X_n_cols; ++col) { out_mem[col] = op_var::direct_var( X.colptr(col), X_n_rows, norm_type ); } } } else if(dim == 1) { arma_debug_print("op_var::apply_noalias(): dim = 1"); out.set_size(X_n_rows, (X_n_cols > 0) ? 1 : 0); if(X_n_cols > 0) { out_eT* out_mem = out.memptr(); podarray tmp; for(uword row=0; row < X_n_rows; ++row) { tmp.copy_row(X, row); out_mem[row] = op_var::direct_var( tmp.memptr(), tmp.n_elem, norm_type ); } } } } template inline typename T1::pod_type op_var::var_vec(const T1& X, const uword norm_type) { arma_debug_sigprint(); typedef typename T1::pod_type T; arma_conform_check( (norm_type > 1), "var(): parameter 'norm_type' must be 0 or 1" ); const quasi_unwrap U(X); if(U.M.n_elem == 0) { arma_conform_check(true, "var(): object has no elements"); return Datum::nan; } return op_var::direct_var(U.M.memptr(), U.M.n_elem, norm_type); } //! find the variance of an array template inline eT op_var::direct_var(const eT* X, const uword n_elem, const uword norm_type) { arma_debug_sigprint(); if(n_elem >= 2) { const eT acc1 = op_mean::direct_mean(X, n_elem); if(arma_isnonfinite(acc1)) { return Datum::nan; } eT acc2 = eT(0); eT acc3 = eT(0); uword i,j; for(i=0, j=1; j inline eT op_var::direct_var_robust(const eT* X, const uword n_elem, const uword norm_type) { arma_debug_sigprint(); if(n_elem > 1) { eT r_mean = X[0]; eT r_var = eT(0); for(uword i=1; i inline T op_var::direct_var(const std::complex* const X, const uword n_elem, const uword norm_type) { arma_debug_sigprint(); typedef typename std::complex eT; if(n_elem >= 2) { const eT acc1 = op_mean::direct_mean(X, n_elem); if(arma_isnonfinite(acc1)) { return Datum::nan; } T acc2 = T(0); eT acc3 = eT(0); for(uword i=0; i inline T op_var::direct_var_robust(const std::complex* const X, const uword n_elem, const uword norm_type) { arma_debug_sigprint(); typedef typename std::complex eT; if(n_elem > 1) { eT r_mean = X[0]; T r_var = T(0); for(uword i=1; i arma_warn_unused arma_inline typename enable_if2< is_arma_type::value, const Op >::result flipud(const T1& X) { arma_debug_sigprint(); return Op(X); } template arma_warn_unused arma_inline typename enable_if2< is_arma_type::value, const Op >::result fliplr(const T1& X) { arma_debug_sigprint(); return Op(X); } template arma_warn_unused arma_inline const SpOp flipud(const SpBase& X) { arma_debug_sigprint(); return SpOp(X.get_ref()); } template arma_warn_unused arma_inline const SpOp fliplr(const SpBase& X) { arma_debug_sigprint(); return SpOp(X.get_ref()); } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_inv_sympd.hpp0000644000176200001440000000634514635324415023613 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_inv_sympd //! @{ template arma_warn_unused arma_inline typename enable_if2< is_supported_blas_type::value, const Op >::result inv_sympd ( const Base& X ) { arma_debug_sigprint(); return Op(X.get_ref()); } template inline typename enable_if2< is_supported_blas_type::value, bool >::result inv_sympd ( Mat& out, const Base& X ) { arma_debug_sigprint(); const bool status = op_inv_spd_default::apply_direct(out, X.get_ref()); if(status == false) { out.soft_reset(); arma_warn(3, "inv_sympd(): matrix is singular or not positive definite"); } return status; } template arma_warn_unused arma_inline typename enable_if2< is_supported_blas_type::value, const Op >::result inv_sympd ( const Base& X, const inv_opts::opts& opts ) { arma_debug_sigprint(); return Op(X.get_ref(), opts.flags, uword(0)); } template inline typename enable_if2< is_supported_blas_type::value, bool >::result inv_sympd ( Mat& out, const Base& X, const inv_opts::opts& opts ) { arma_debug_sigprint(); const bool status = op_inv_spd_full::apply_direct(out, X.get_ref(), opts.flags); if(status == false) { out.soft_reset(); arma_warn(3, "inv_sympd(): matrix is singular or not positive definite"); } return status; } template inline typename enable_if2< is_supported_blas_type::value, bool >::result inv_sympd ( Mat& out_inv, typename T1::pod_type& out_rcond, const Base& X ) { arma_debug_sigprint(); typedef typename T1::pod_type T; op_inv_spd_state inv_state; const bool status = op_inv_spd_rcond::apply_direct(out_inv, inv_state, X.get_ref()); out_rcond = inv_state.rcond; if(status == false) { out_rcond = T(0); out_inv.soft_reset(); arma_warn(3, "inv_sympd(): matrix is singular or not positive definite"); } return status; } //! @} RcppArmadillo/inst/include/armadillo_bits/op_norm2est_meat.hpp0000644000176200001440000001422115030507611024354 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_norm2est //! @{ template inline norm2est_randu_filler::norm2est_randu_filler() { arma_debug_sigprint(); typedef typename std::mt19937_64::result_type local_seed_type; local_engine.seed(local_seed_type(123)); typedef typename std::uniform_real_distribution::param_type local_param_type; local_u_distr.param(local_param_type(-1.0, +1.0)); } template inline void norm2est_randu_filler::fill(eT* mem, const uword N) { arma_debug_sigprint(); for(uword i=0; i inline norm2est_randu_filler< std::complex >::norm2est_randu_filler() { arma_debug_sigprint(); typedef typename std::mt19937_64::result_type local_seed_type; local_engine.seed(local_seed_type(123)); typedef typename std::uniform_real_distribution::param_type local_param_type; local_u_distr.param(local_param_type(-1.0, +1.0)); } template inline void norm2est_randu_filler< std::complex >::fill(std::complex* mem, const uword N) { arma_debug_sigprint(); for(uword i=0; i& mem_i = mem[i]; mem_i.real( T(local_u_distr(local_engine)) ); mem_i.imag( T(local_u_distr(local_engine)) ); } } // // // template inline typename T1::pod_type op_norm2est::norm2est ( const Base& X, const typename T1::pod_type tolerance, const uword max_iter ) { arma_debug_sigprint(); typedef typename T1::pod_type T; typedef typename T1::elem_type eT; arma_conform_check( (tolerance < T(0)), "norm2est(): parameter 'tolerance' must be > 0" ); arma_conform_check( (max_iter == uword(0)), "norm2est(): parameter 'max_iter' must be > 0" ); const T tol = (tolerance == T(0)) ? T(1e-6) : T(tolerance); const quasi_unwrap U(X.get_ref()); const Mat& A = U.M; if(A.n_elem == 0) { return T(0); } if(A.internal_has_nonfinite()) { arma_warn(1, "norm2est(): given matrix has non-finite elements"); } if((A.n_rows == 1) || (A.n_cols == 1)) { return op_norm::vec_norm_2( Proxy< Mat >(A) ); } norm2est_randu_filler randu_filler; Col x(A.n_rows, fill::none); Col y(A.n_cols, fill::none); randu_filler.fill(y.memptr(), y.n_elem); T est_old = 0; T est_cur = 0; for(uword i=0; i >(x) ); if( (x_norm == T(0)) || arma_isnonfinite(x_norm) || x.internal_has_nonfinite() ) { randu_filler.fill(x.memptr(), x.n_elem); x_norm = op_norm::vec_norm_2( Proxy< Col >(x) ); } if(x_norm != T(0)) { x /= x_norm; } y = A.t() * x; est_old = est_cur; est_cur = op_norm::vec_norm_2( Proxy< Col >(y) ); arma_debug_print(arma_str::format("norm2est(): est_old: %e") % est_old); arma_debug_print(arma_str::format("norm2est(): est_cur: %e") % est_cur); if(arma_isnonfinite(est_cur)) { return est_old; } if( ((std::abs)(est_cur - est_old)) <= (tol * (std::max)(est_cur,est_old)) ) { break; } } return est_cur; } // // // template inline typename T1::pod_type op_norm2est::norm2est ( const SpBase& X, const typename T1::pod_type tolerance, const uword max_iter ) { arma_debug_sigprint(); typedef typename T1::pod_type T; typedef typename T1::elem_type eT; arma_conform_check( (tolerance < T(0)), "norm2est(): parameter 'tolerance' must be > 0" ); arma_conform_check( (max_iter == uword(0)), "norm2est(): parameter 'max_iter' must be > 0" ); const T tol = (tolerance == T(0)) ? T(1e-6) : T(tolerance); const unwrap_spmat U(X.get_ref()); const SpMat& A = U.M; if(A.n_nonzero == 0) { return T(0); } if(A.internal_has_nonfinite()) { arma_warn(1, "norm2est(): given matrix has non-finite elements"); } if((A.n_rows == 1) || (A.n_cols == 1)) { return spop_norm::vec_norm_k(A.values, A.n_nonzero, 2); } norm2est_randu_filler randu_filler; Mat x(A.n_rows, 1, fill::none); Mat y(A.n_cols, 1, fill::none); randu_filler.fill(y.memptr(), y.n_elem); T est_old = 0; T est_cur = 0; for(uword i=0; i >(x) ); if( (x_norm == T(0)) || arma_isnonfinite(x_norm) || x.internal_has_nonfinite() ) { randu_filler.fill(x.memptr(), x.n_elem); x_norm = op_norm::vec_norm_2( Proxy< Mat >(x) ); } if(x_norm != T(0)) { x /= x_norm; } y = A.t() * x; est_old = est_cur; est_cur = op_norm::vec_norm_2( Proxy< Mat >(y) ); arma_debug_print(arma_str::format("norm2est(): est_old: %e") % est_old); arma_debug_print(arma_str::format("norm2est(): est_cur: %e") % est_cur); if(arma_isnonfinite(est_cur)) { return est_old; } if( ((std::abs)(est_cur - est_old)) <= (tol * (std::max)(est_cur,est_old)) ) { break; } } return est_cur; } //! @} RcppArmadillo/inst/include/armadillo_bits/arma_config.hpp0000644000176200001440000001377414634016465023373 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup arma_config //! @{ struct arma_config { #if defined(ARMA_MAT_PREALLOC) static constexpr uword mat_prealloc = (sword(ARMA_MAT_PREALLOC) > 0) ? uword(ARMA_MAT_PREALLOC) : 1; #else static constexpr uword mat_prealloc = 16; #endif #if defined(ARMA_OPENMP_THRESHOLD) static constexpr uword mp_threshold = (sword(ARMA_OPENMP_THRESHOLD) > 0) ? uword(ARMA_OPENMP_THRESHOLD) : 320; #else static constexpr uword mp_threshold = 320; #endif #if defined(ARMA_OPENMP_THREADS) static constexpr uword mp_threads = (sword(ARMA_OPENMP_THREADS) > 0) ? uword(ARMA_OPENMP_THREADS) : 8; #else static constexpr uword mp_threads = 8; #endif #if defined(ARMA_OPTIMISE_BAND) static constexpr bool optimise_band = true; #else static constexpr bool optimise_band = false; #endif #if defined(ARMA_OPTIMISE_SYM) static constexpr bool optimise_sym = true; #else static constexpr bool optimise_sym = false; #endif #if defined(ARMA_OPTIMISE_INVEXPR) static constexpr bool optimise_invexpr = true; #else static constexpr bool optimise_invexpr = false; #endif #if defined(ARMA_CHECK_CONFORMANCE) static constexpr bool check_conform = true; #else static constexpr bool check_conform = false; #endif #if defined(ARMA_CHECK_NONFINITE) static constexpr bool check_nonfinite = true; #else static constexpr bool check_nonfinite = false; #endif #if defined(ARMA_USE_LAPACK) static constexpr bool lapack = true; #else static constexpr bool lapack = false; #endif #if defined(ARMA_USE_BLAS) static constexpr bool blas = true; #else static constexpr bool blas = false; #endif #if defined(ARMA_USE_ATLAS) static constexpr bool atlas = true; #else static constexpr bool atlas = false; #endif #if defined(ARMA_USE_NEWARP) static constexpr bool newarp = true; #else static constexpr bool newarp = false; #endif #if defined(ARMA_USE_ARPACK) static constexpr bool arpack = true; #else static constexpr bool arpack = false; #endif #if defined(ARMA_USE_SUPERLU) static constexpr bool superlu = true; #else static constexpr bool superlu = false; #endif #if defined(ARMA_USE_HDF5) static constexpr bool hdf5 = true; #else static constexpr bool hdf5 = false; #endif #if defined(ARMA_GOOD_COMPILER) static constexpr bool good_comp = true; #else static constexpr bool good_comp = false; #endif #if ( \ defined(ARMA_EXTRA_MAT_PROTO) || defined(ARMA_EXTRA_MAT_MEAT) \ || defined(ARMA_EXTRA_COL_PROTO) || defined(ARMA_EXTRA_COL_MEAT) \ || defined(ARMA_EXTRA_ROW_PROTO) || defined(ARMA_EXTRA_ROW_MEAT) \ || defined(ARMA_EXTRA_CUBE_PROTO) || defined(ARMA_EXTRA_CUBE_MEAT) \ || defined(ARMA_EXTRA_FIELD_PROTO) || defined(ARMA_EXTRA_FIELD_MEAT) \ || defined(ARMA_EXTRA_SPMAT_PROTO) || defined(ARMA_EXTRA_SPMAT_MEAT) \ || defined(ARMA_EXTRA_SPCOL_PROTO) || defined(ARMA_EXTRA_SPCOL_MEAT) \ || defined(ARMA_EXTRA_SPROW_PROTO) || defined(ARMA_EXTRA_SPROW_MEAT) \ || defined(ARMA_ALIEN_MEM_ALLOC_FUNCTION) \ || defined(ARMA_ALIEN_MEM_FREE_FUNCTION) \ ) static constexpr bool extra_code = true; #else static constexpr bool extra_code = false; #endif #if defined(ARMA_HAVE_CXX14) static constexpr bool cxx14 = true; #else static constexpr bool cxx14 = false; #endif #if defined(ARMA_HAVE_CXX17) static constexpr bool cxx17 = true; #else static constexpr bool cxx17 = false; #endif #if defined(ARMA_HAVE_CXX20) static constexpr bool cxx20 = true; #else static constexpr bool cxx20 = false; #endif #if defined(ARMA_HAVE_CXX23) static constexpr bool cxx23 = true; #else static constexpr bool cxx23 = false; #endif #if defined(ARMA_USE_STD_MUTEX) static constexpr bool std_mutex = true; #else static constexpr bool std_mutex = false; #endif #if (defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200112L)) static constexpr bool posix = true; #else static constexpr bool posix = false; #endif #if defined(ARMA_USE_WRAPPER) static constexpr bool wrapper = true; #else static constexpr bool wrapper = false; #endif #if defined(ARMA_USE_OPENMP) static constexpr bool openmp = true; #else static constexpr bool openmp = false; #endif #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) static constexpr bool hidden_args = true; #else static constexpr bool hidden_args = false; #endif #if defined(ARMA_FAST_MATH) static constexpr bool fast_math = true; #else static constexpr bool fast_math = false; #endif #if defined(ARMA_FAST_MATH) && !defined(ARMA_DONT_PRINT_FAST_MATH_WARNING) static constexpr bool fast_math_warn = true; #else static constexpr bool fast_math_warn = false; #endif #if (!defined(ARMA_DONT_TREAT_TEXT_AS_BINARY)) static constexpr bool text_as_binary = true; #else static constexpr bool text_as_binary = false; #endif static constexpr uword warn_level = (sword(ARMA_WARN_LEVEL) > 0) ? uword(ARMA_WARN_LEVEL) : 0; }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_vectorise_bones.hpp0000644000176200001440000000470514301267043024776 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_vectorise //! @{ class op_vectorise_col : public traits_op_col { public: template inline static void apply(Mat& out, const Op& in); template inline static void apply_direct(Mat& out, const T1& expr); template inline static void apply_subview(Mat& out, const subview& sv); template inline static void apply_proxy(Mat& out, const Proxy& P); }; class op_vectorise_row : public traits_op_row { public: template inline static void apply(Mat& out, const Op& in); template inline static void apply_direct(Mat& out, const T1& expr); template inline static void apply_proxy(Mat& out, const Proxy& P); }; class op_vectorise_all : public traits_op_xvec { public: template inline static void apply(Mat& out, const Op& in); }; class op_vectorise_cube_col : public traits_op_col { public: template inline static void apply(Mat& out, const CubeToMatOp& in); template inline static void apply_subview(Mat& out, const subview_cube& sv); template inline static void apply_unwrap(Mat& out, const T1& expr); template inline static void apply_proxy(Mat& out, const T1& expr); }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_rcond_bones.hpp0000644000176200001440000000177214301267043024101 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_rcond //! @{ class op_rcond : public traits_op_default { public: template static inline typename T1::pod_type apply(const Base& X); }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_range_bones.hpp0000644000176200001440000000231314301267043024060 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_range //! @{ class op_range : public traits_op_xvec { public: template inline static void apply(Mat& out, const Op& in); template inline static void apply_noalias(Mat& out, const Mat& X, const uword dim); template inline static typename T1::elem_type vector_range(const T1& expr); }; //! @} RcppArmadillo/inst/include/armadillo_bits/xtrans_mat_meat.hpp0000644000176200001440000000374414631567470024314 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup xtrans_mat //! @{ template inline xtrans_mat::xtrans_mat(const Mat& in_X) : X (in_X ) , n_rows(in_X.n_cols) // deliberately swapped , n_cols(in_X.n_rows) , n_elem(in_X.n_elem) { arma_debug_sigprint(); } template inline void xtrans_mat::extract(Mat& out) const { arma_debug_sigprint(); really_do_conj ? op_htrans::apply_mat(out, X) : op_strans::apply_mat(out, X); } template inline eT xtrans_mat::operator[](const uword ii) const { if(Y.n_elem > 0) { return Y[ii]; } else { really_do_conj ? op_htrans::apply_mat(Y, X) : op_strans::apply_mat(Y, X); return Y[ii]; } } template inline eT xtrans_mat::at_alt(const uword ii) const { return (*this).operator[](ii); } template arma_inline eT xtrans_mat::at(const uword in_row, const uword in_col) const { return really_do_conj ? eT(access::alt_conj(X.at(in_col, in_row))) : eT(X.at(in_col, in_row)); // in_row and in_col deliberately swapped above } //! @} RcppArmadillo/inst/include/armadillo_bits/op_inv_spd_bones.hpp0000644000176200001440000000402314476055675024451 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_inv_spd //! @{ class op_inv_spd_default : public traits_op_default { public: template inline static void apply(Mat& out, const Op& in); template inline static bool apply_direct(Mat& out, const Base& expr); }; class op_inv_spd_full : public traits_op_default { public: template inline static void apply(Mat& out, const Op& in); template inline static bool apply_direct(Mat& out, const Base& expr, const uword flags); template arma_cold inline static bool apply_tiny_2x2(Mat& X); }; template struct op_inv_spd_state { uword size = uword(0); T rcond = T(0); bool is_diag = false; }; class op_inv_spd_rcond : public traits_op_default { public: template inline static bool apply_direct(Mat& out_inv, op_inv_spd_state& out_state, const Base& expr); }; //! @} RcppArmadillo/inst/include/armadillo_bits/subview_cube_each_bones.hpp0000644000176200001440000001172514711673611025746 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup subview_cube_each //! @{ template class subview_cube_each_common { public: const Cube& P; template inline void check_size(const Mat& A) const; protected: arma_inline subview_cube_each_common(const Cube& in_p); inline subview_cube_each_common() = delete; template arma_cold inline const std::string incompat_size_string(const Mat& A) const; }; // NOTE: deliberately not derived from BaseCube template class subview_cube_each1 : public subview_cube_each_common { protected: arma_inline subview_cube_each1(const Cube& in_p); inline subview_cube_each1() = delete; public: inline ~subview_cube_each1(); // deliberately returning void template inline void operator= (const Base& x); template inline void operator+= (const Base& x); template inline void operator-= (const Base& x); template inline void operator%= (const Base& x); template inline void operator/= (const Base& x); template inline void operator*= (const Base& x); friend class Cube; }; // NOTE: deliberately not derived from BaseCube template class subview_cube_each2 : public subview_cube_each_common { protected: inline subview_cube_each2(const Cube& in_p, const Base& in_indices); inline subview_cube_each2() = delete; public: const Base& base_indices; inline void check_indices(const Mat& indices) const; inline ~subview_cube_each2(); // deliberately returning void template inline void operator= (const Base& x); template inline void operator+= (const Base& x); template inline void operator-= (const Base& x); template inline void operator%= (const Base& x); template inline void operator/= (const Base& x); friend class Cube; }; class subview_cube_each1_aux { public: template static inline Cube operator_plus(const subview_cube_each1& X, const Base& Y); template static inline Cube operator_minus(const subview_cube_each1& X, const Base& Y); template static inline Cube operator_minus(const Base& X, const subview_cube_each1& Y); template static inline Cube operator_schur(const subview_cube_each1& X, const Base& Y); template static inline Cube operator_div(const subview_cube_each1& X,const Base& Y); template static inline Cube operator_div(const Base& X, const subview_cube_each1& Y); template static inline Cube operator_times(const subview_cube_each1& X,const Base& Y); template static inline Cube operator_times(const Base& X, const subview_cube_each1& Y); }; class subview_cube_each2_aux { public: template static inline Cube operator_plus(const subview_cube_each2& X, const Base& Y); template static inline Cube operator_minus(const subview_cube_each2& X, const Base& Y); template static inline Cube operator_minus(const Base& X, const subview_cube_each2& Y); template static inline Cube operator_schur(const subview_cube_each2& X, const Base& Y); template static inline Cube operator_div(const subview_cube_each2& X, const Base& Y); template static inline Cube operator_div(const Base& X, const subview_cube_each2& Y); // TODO: operator_times }; //! @} RcppArmadillo/inst/include/armadillo_bits/running_stat_bones.hpp0000644000176200001440000000600014301267044024777 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup running_stat //! @{ template class arma_counter { public: inline ~arma_counter(); inline arma_counter(); inline const arma_counter& operator++(); inline void operator++(int); inline void reset(); inline eT value() const; inline eT value_plus_1() const; inline eT value_minus_1() const; private: arma_aligned eT d_count; arma_aligned uword i_count; }; //! Class for keeping statistics of a continuously sampled process / signal. //! Useful if the storage of individual samples is not necessary or desired. //! Also useful if the number of samples is not known beforehand or exceeds //! available memory. template class running_stat { public: typedef typename get_pod_type::result T; inline ~running_stat(); inline running_stat(); inline void operator() (const T sample); inline void operator() (const std::complex& sample); inline void reset(); inline eT mean() const; inline T var (const uword norm_type = 0) const; inline T stddev(const uword norm_type = 0) const; inline eT min() const; inline eT max() const; inline eT range() const; inline T count() const; // // private: arma_aligned arma_counter counter; arma_aligned eT r_mean; arma_aligned T r_var; arma_aligned eT min_val; arma_aligned eT max_val; arma_aligned T min_val_norm; arma_aligned T max_val_norm; friend class running_stat_aux; }; class running_stat_aux { public: template inline static void update_stats(running_stat& x, const eT sample, const typename arma_not_cx::result* junk = nullptr); template inline static void update_stats(running_stat& x, const std::complex& sample, const typename arma_not_cx::result* junk = nullptr); template inline static void update_stats(running_stat& x, const typename eT::value_type sample, const typename arma_cx_only::result* junk = nullptr); template inline static void update_stats(running_stat& x, const eT& sample, const typename arma_cx_only::result* junk = nullptr); }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_omit_meat.hpp0000644000176200001440000001325215030507611023556 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_omit //! @{ template inline void op_omit::apply(Mat& out, const Op& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword omit_mode = in.aux_uword_a; if(arma_config::fast_math_warn) { if(omit_mode == 1) { arma_warn(1, "omit_nan(): detection of NaN is not reliable in fast math mode"); } if(omit_mode == 2) { arma_warn(1, "omit_nonfinite(): detection of non-finite values is not reliable in fast math mode"); } } auto is_omitted_1 = [](const eT& x) -> bool { return arma_isnan(x); }; auto is_omitted_2 = [](const eT& x) -> bool { return arma_isnonfinite(x); }; if(omit_mode == 1) { op_omit::apply(out, in.m, is_omitted_1); } if(omit_mode == 2) { op_omit::apply(out, in.m, is_omitted_2); } } template inline void op_omit::apply(Mat& out, const T1& X, functor is_omitted) { arma_debug_sigprint(); typedef typename T1::elem_type eT; if(is_Mat::value || is_subview_col::value || is_Mat::stored_type>::value || Proxy::use_mp) { const quasi_unwrap U(X); const eT* X_mem = U.M.memptr(); const uword N = U.M.n_elem; Mat Y(N, 1, arma_nozeros_indicator()); eT* Y_mem = Y.memptr(); uword count = 0; for(uword i=0; i < N; ++i) { const eT val = X_mem[i]; if(is_omitted(val) == false) { Y_mem[count] = val; ++count; } } out.steal_mem_col(Y, count); } else { const Proxy P(X); const uword N = P.get_n_elem(); Mat Y(N, 1, arma_nozeros_indicator()); eT* Y_mem = Y.memptr(); uword count = 0; if(Proxy::use_at == false) { const typename Proxy::ea_type Pea = P.get_ea(); for(uword i=0; i < N; ++i) { const eT val = Pea[i]; if(is_omitted(val) == false) { Y_mem[count] = val; ++count; } } } else { const uword n_rows = P.get_n_rows(); const uword n_cols = P.get_n_cols(); for(uword c=0; c < n_cols; ++c) for(uword r=0; r < n_rows; ++r) { const eT val = P.at(r,c); if(is_omitted(val) == false) { Y_mem[count] = val; ++count; } } } out.steal_mem_col(Y, count); } } // template inline void op_omit_cube::apply(Mat& out, const CubeToMatOp& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword omit_mode = in.aux_uword; if(arma_config::fast_math_warn) { if(omit_mode == 1) { arma_warn(1, "omit_nan(): detection of NaN is not reliable in fast math mode"); } if(omit_mode == 2) { arma_warn(1, "omit_nonfinite(): detection of non-finite values is not reliable in fast math mode"); } } auto is_omitted_1 = [](const eT& x) -> bool { return arma_isnan(x); }; auto is_omitted_2 = [](const eT& x) -> bool { return arma_isnonfinite(x); }; if(omit_mode == 1) { op_omit_cube::apply(out, in.m, is_omitted_1); } if(omit_mode == 2) { op_omit_cube::apply(out, in.m, is_omitted_2); } } template inline void op_omit_cube::apply(Mat& out, const T1& X, functor is_omitted) { arma_debug_sigprint(); typedef typename T1::elem_type eT; if(is_Cube::value || is_Cube::stored_type>::value || ProxyCube::use_mp) { const unwrap_cube U(X); const eT* X_mem = U.M.memptr(); const uword N = U.M.n_elem; Mat Y(N, 1, arma_nozeros_indicator()); eT* Y_mem = Y.memptr(); uword count = 0; for(uword i=0; i < N; ++i) { const eT val = X_mem[i]; if(is_omitted(val) == false) { Y_mem[count] = val; ++count; } } out.steal_mem_col(Y, count); } else { const ProxyCube P(X); const uword N = P.get_n_elem(); Mat Y(N, 1, arma_nozeros_indicator()); eT* Y_mem = Y.memptr(); uword count = 0; if(ProxyCube::use_at == false) { const typename ProxyCube::ea_type Pea = P.get_ea(); for(uword i=0; i < N; ++i) { const eT val = Pea[i]; if(is_omitted(val) == false) { Y_mem[count] = val; ++count; } } } else { const uword n_r = P.get_n_rows(); const uword n_c = P.get_n_cols(); const uword n_s = P.get_n_slices(); for(uword s=0; s < n_s; ++s) for(uword c=0; c < n_c; ++c) for(uword r=0; r < n_r; ++r) { const eT val = P.at(r,c,s); if(is_omitted(val) == false) { Y_mem[count] = val; ++count; } } } out.steal_mem_col(Y, count); } } //! @} RcppArmadillo/inst/include/armadillo_bits/op_hist_meat.hpp0000644000176200001440000000604415030507611023556 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_hist //! @{ template inline void op_hist::apply_noalias(Mat& out, const Mat& A, const uword n_bins, const uword dim) { arma_debug_sigprint(); arma_conform_check( ((A.is_vec() == false) && (A.is_empty() == false)), "hist(): only vectors are supported when automatically determining bin centers" ); if(n_bins == 0) { out.reset(); return; } uword A_n_elem = A.n_elem; const eT* A_mem = A.memptr(); eT min_val = priv::most_pos(); eT max_val = priv::most_neg(); uword i,j; for(i=0, j=1; j < A_n_elem; i+=2, j+=2) { const eT val_i = A_mem[i]; const eT val_j = A_mem[j]; if(min_val > val_i) { min_val = val_i; } if(min_val > val_j) { min_val = val_j; } if(max_val < val_i) { max_val = val_i; } if(max_val < val_j) { max_val = val_j; } } if(i < A_n_elem) { const eT val_i = A_mem[i]; if(min_val > val_i) { min_val = val_i; } if(max_val < val_i) { max_val = val_i; } } if(min_val == max_val) { min_val -= (n_bins/2); max_val += (n_bins/2); } if(arma_isnonfinite(min_val)) { min_val = priv::most_neg(); } if(arma_isnonfinite(max_val)) { max_val = priv::most_pos(); } Col c(n_bins, arma_nozeros_indicator()); eT* c_mem = c.memptr(); for(uword ii=0; ii < n_bins; ++ii) { c_mem[ii] = (0.5 + ii) / double(n_bins); } c = ((max_val - min_val) * c) + min_val; glue_hist::apply_noalias(out, A, c, dim); } template inline void op_hist::apply(Mat& out, const mtOp& X) { arma_debug_sigprint(); const uword n_bins = X.aux_uword_a; const quasi_unwrap U(X.m); const uword dim = (T1::is_xvec) ? uword(U.M.is_rowvec() ? 1 : 0) : uword((T1::is_row) ? 1 : 0); if(is_non_integral::value) { if(U.is_alias(out)) { Mat tmp; op_hist::apply_noalias(tmp, U.M, n_bins, dim); out.steal_mem(tmp); } else { op_hist::apply_noalias(out, U.M, n_bins, dim); } } else { Mat converted = conv_to< Mat >::from(U.M); op_hist::apply_noalias(out, converted, n_bins, dim); } } //! @} RcppArmadillo/inst/include/armadillo_bits/op_cor_bones.hpp0000644000176200001440000000220514301267043023547 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_cor //! @{ class op_cor : public traits_op_default { public: template inline static void apply(Mat& out, const Op< T1, op_cor>& in); template inline static void apply(Mat& out, const Op< Op, op_cor>& in); }; //! @} RcppArmadillo/inst/include/armadillo_bits/fn_randg.hpp0000644000176200001440000001277414631567470022707 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_randg //! @{ template arma_warn_unused inline obj_type randg(const uword n_rows, const uword n_cols, const distr_param& param = distr_param(), const typename arma_Mat_Col_Row_only::result* junk = nullptr) { arma_debug_sigprint(); arma_ignore(junk); typedef typename obj_type::elem_type eT; if(is_Col::value) { arma_conform_check( (n_cols != 1), "randg(): incompatible size" ); } else if(is_Row::value) { arma_conform_check( (n_rows != 1), "randg(): incompatible size" ); } double a = double(1); double b = double(1); param.get_double_vals(a,b); arma_conform_check( ((a <= double(0)) || (b <= double(0))), "randg(): incorrect distribution parameters; a and b must be greater than zero" ); obj_type out(n_rows, n_cols, arma_nozeros_indicator()); arma_rng::randg::fill(out.memptr(), out.n_elem, a, b); return out; } template arma_warn_unused inline obj_type randg(const SizeMat& s, const distr_param& param = distr_param(), const typename arma_Mat_Col_Row_only::result* junk = nullptr) { arma_debug_sigprint(); arma_ignore(junk); return randg(s.n_rows, s.n_cols, param); } template arma_warn_unused inline obj_type randg(const uword n_elem, const distr_param& param = distr_param(), const arma_empty_class junk1 = arma_empty_class(), const typename arma_Mat_Col_Row_only::result* junk2 = nullptr) { arma_debug_sigprint(); arma_ignore(junk1); arma_ignore(junk2); const uword n_rows = (is_Row::value) ? uword(1) : n_elem; const uword n_cols = (is_Row::value) ? n_elem : uword(1); return randg(n_rows, n_cols, param); } arma_warn_unused inline mat randg(const uword n_rows, const uword n_cols, const distr_param& param = distr_param()) { arma_debug_sigprint(); return randg(n_rows, n_cols, param); } arma_warn_unused inline mat randg(const SizeMat& s, const distr_param& param = distr_param()) { arma_debug_sigprint(); return randg(s.n_rows, s.n_cols, param); } arma_warn_unused inline vec randg(const uword n_elem, const distr_param& param = distr_param()) { arma_debug_sigprint(); return randg(n_elem, uword(1), param); } arma_warn_unused inline double randg(const distr_param& param = distr_param()) { arma_debug_sigprint(); double a = double(1); double b = double(1); param.get_double_vals(a,b); arma_conform_check( ((a <= double(0)) || (b <= double(0))), "randg(): incorrect distribution parameters; a and b must be greater than zero" ); double out_val = double(0); arma_rng::randg::fill(&out_val, uword(1), a, b); return out_val; } template arma_warn_unused inline typename arma_real_or_cx_only::result randg(const distr_param& param = distr_param()) { arma_debug_sigprint(); double a = double(1); double b = double(1); param.get_double_vals(a,b); arma_conform_check( ((a <= double(0)) || (b <= double(0))), "randg(): incorrect distribution parameters; a and b must be greater than zero" ); eT out_val = eT(0); arma_rng::randg::fill(&out_val, uword(1), a, b); return out_val; } template arma_warn_unused inline cube_type randg(const uword n_rows, const uword n_cols, const uword n_slices, const distr_param& param = distr_param(), const typename arma_Cube_only::result* junk = nullptr) { arma_debug_sigprint(); arma_ignore(junk); typedef typename cube_type::elem_type eT; double a = double(1); double b = double(1); param.get_double_vals(a,b); arma_conform_check( ((a <= double(0)) || (b <= double(0))), "randg(): incorrect distribution parameters; a and b must be greater than zero" ); cube_type out(n_rows, n_cols, n_slices, arma_nozeros_indicator()); arma_rng::randg::fill(out.memptr(), out.n_elem, a, b); return out; } template arma_warn_unused inline cube_type randg(const SizeCube& s, const distr_param& param = distr_param(), const typename arma_Cube_only::result* junk = nullptr) { arma_debug_sigprint(); arma_ignore(junk); return randg(s.n_rows, s.n_cols, s.n_slices, param); } arma_warn_unused inline cube randg(const uword n_rows, const uword n_cols, const uword n_slices, const distr_param& param = distr_param()) { arma_debug_sigprint(); return randg(n_rows, n_cols, n_slices, param); } arma_warn_unused inline cube randg(const SizeCube& s, const distr_param& param = distr_param()) { arma_debug_sigprint(); return randg(s.n_rows, s.n_cols, s.n_slices, param); } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_cor.hpp0000644000176200001440000000303214631567470022362 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_cor //! @{ template arma_warn_unused inline const Op cor(const Base& X, const uword norm_type = 0) { arma_debug_sigprint(); arma_conform_check( (norm_type > 1), "cor(): parameter 'norm_type' must be 0 or 1" ); return Op(X.get_ref(), norm_type, 0); } template arma_warn_unused inline const Glue cor(const Base& A, const Base& B, const uword norm_type = 0) { arma_debug_sigprint(); arma_conform_check( (norm_type > 1), "cor(): parameter 'norm_type' must be 0 or 1" ); return Glue(A.get_ref(), B.get_ref(), norm_type); } //! @} RcppArmadillo/inst/include/armadillo_bits/eop_core_bones.hpp0000644000176200001440000001641014560505601024066 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup eop_core //! @{ template class eop_core { public: // matrices template arma_hot inline static void apply(outT& out, const eOp& x); template arma_hot inline static void apply_inplace_plus (Mat& out, const eOp& x); template arma_hot inline static void apply_inplace_minus(Mat& out, const eOp& x); template arma_hot inline static void apply_inplace_schur(Mat& out, const eOp& x); template arma_hot inline static void apply_inplace_div (Mat& out, const eOp& x); // cubes template arma_hot inline static void apply(Cube& out, const eOpCube& x); template arma_hot inline static void apply_inplace_plus (Cube& out, const eOpCube& x); template arma_hot inline static void apply_inplace_minus(Cube& out, const eOpCube& x); template arma_hot inline static void apply_inplace_schur(Cube& out, const eOpCube& x); template arma_hot inline static void apply_inplace_div (Cube& out, const eOpCube& x); // common template arma_inline static eT process(const eT val, const eT k); }; struct eop_use_mp_true { static constexpr bool use_mp = true; }; struct eop_use_mp_false { static constexpr bool use_mp = false; }; class eop_neg : public eop_core , public eop_use_mp_false {}; class eop_scalar_plus : public eop_core , public eop_use_mp_false {}; class eop_scalar_minus_pre : public eop_core , public eop_use_mp_false {}; class eop_scalar_minus_post : public eop_core , public eop_use_mp_false {}; class eop_scalar_times : public eop_core , public eop_use_mp_false {}; class eop_scalar_div_pre : public eop_core , public eop_use_mp_false {}; class eop_scalar_div_post : public eop_core , public eop_use_mp_false {}; class eop_square : public eop_core , public eop_use_mp_false {}; class eop_sqrt : public eop_core , public eop_use_mp_true {}; class eop_pow : public eop_core , public eop_use_mp_false {}; // for pow(), use_mp is selectively enabled in eop_core_meat.hpp class eop_log : public eop_core , public eop_use_mp_true {}; class eop_log2 : public eop_core , public eop_use_mp_true {}; class eop_log10 : public eop_core , public eop_use_mp_true {}; class eop_trunc_log : public eop_core , public eop_use_mp_true {}; class eop_log1p : public eop_core , public eop_use_mp_true {}; class eop_exp : public eop_core , public eop_use_mp_true {}; class eop_exp2 : public eop_core , public eop_use_mp_true {}; class eop_exp10 : public eop_core , public eop_use_mp_true {}; class eop_trunc_exp : public eop_core , public eop_use_mp_true {}; class eop_expm1 : public eop_core , public eop_use_mp_true {}; class eop_cos : public eop_core , public eop_use_mp_true {}; class eop_sin : public eop_core , public eop_use_mp_true {}; class eop_tan : public eop_core , public eop_use_mp_true {}; class eop_acos : public eop_core , public eop_use_mp_true {}; class eop_asin : public eop_core , public eop_use_mp_true {}; class eop_atan : public eop_core , public eop_use_mp_true {}; class eop_cosh : public eop_core , public eop_use_mp_true {}; class eop_sinh : public eop_core , public eop_use_mp_true {}; class eop_tanh : public eop_core , public eop_use_mp_true {}; class eop_acosh : public eop_core , public eop_use_mp_true {}; class eop_asinh : public eop_core , public eop_use_mp_true {}; class eop_atanh : public eop_core , public eop_use_mp_true {}; class eop_sinc : public eop_core , public eop_use_mp_true {}; class eop_eps : public eop_core , public eop_use_mp_true {}; class eop_abs : public eop_core , public eop_use_mp_false {}; class eop_arg : public eop_core , public eop_use_mp_false {}; class eop_conj : public eop_core , public eop_use_mp_false {}; class eop_floor : public eop_core , public eop_use_mp_false {}; class eop_ceil : public eop_core , public eop_use_mp_false {}; class eop_round : public eop_core , public eop_use_mp_false {}; class eop_trunc : public eop_core , public eop_use_mp_false {}; class eop_sign : public eop_core , public eop_use_mp_false {}; class eop_cbrt : public eop_core , public eop_use_mp_true {}; class eop_erf : public eop_core , public eop_use_mp_true {}; class eop_erfc : public eop_core , public eop_use_mp_true {}; class eop_lgamma : public eop_core , public eop_use_mp_true {}; class eop_tgamma : public eop_core , public eop_use_mp_true {}; // the classes below are currently not used; reserved for potential future use class eop_log_approx {}; class eop_exp_approx {}; class eop_approx_log {}; class eop_approx_exp {}; //! @} RcppArmadillo/inst/include/armadillo_bits/op_cor_meat.hpp0000644000176200001440000000577214631567470023420 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_cor //! @{ template inline void op_cor::apply(Mat& out, const Op& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword norm_type = in.aux_uword_a; const unwrap U(in.m); const Mat& A = U.M; if(A.n_elem == 0) { out.reset(); return; } if(A.n_elem == 1) { out.set_size(1,1); out[0] = eT(1); return; } const Mat& AA = (A.n_rows == 1) ? Mat(const_cast(A.memptr()), A.n_cols, A.n_rows, false, false) : Mat(const_cast(A.memptr()), A.n_rows, A.n_cols, false, false); const uword N = AA.n_rows; const eT norm_val = (norm_type == 0) ? ( (N > 1) ? eT(N-1) : eT(1) ) : eT(N); const Mat tmp = AA.each_row() - mean(AA,0); out = tmp.t() * tmp; out /= norm_val; const Col s = sqrt(out.diag()); out /= (s * s.t()); // TODO: check for zeros in s? } template inline void op_cor::apply(Mat& out, const Op< Op, op_cor>& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword norm_type = in.aux_uword_a; if(is_cx::yes) { const Mat tmp = in.m; // force the evaluation of Op out = cor(tmp, norm_type); } else { const unwrap U(in.m.m); const Mat& A = U.M; if(A.n_elem == 0) { out.reset(); return; } if(A.n_elem == 1) { out.set_size(1,1); out[0] = eT(1); return; } const Mat& AA = (A.n_cols == 1) ? Mat(const_cast(A.memptr()), A.n_cols, A.n_rows, false, false) : Mat(const_cast(A.memptr()), A.n_rows, A.n_cols, false, false); const uword N = AA.n_cols; const eT norm_val = (norm_type == 0) ? ( (N > 1) ? eT(N-1) : eT(1) ) : eT(N); const Mat tmp = AA.each_col() - mean(AA,1); out = tmp * tmp.t(); out /= norm_val; const Col s = sqrt(out.diag()); out /= (s * s.t()); // TODO: check for zeros in s? } } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_diagmat.hpp0000644000176200001440000000424714631567470023216 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_diagmat //! @{ //! interpret a matrix or a vector as a diagonal matrix (ie. off-diagonal entries are zero) template arma_warn_unused arma_inline typename enable_if2 < is_arma_type::value, const Op >::result diagmat(const T1& X) { arma_debug_sigprint(); return Op(X); } //! create a matrix with the k-th diagonal set to the given vector template arma_warn_unused arma_inline typename enable_if2 < is_arma_type::value, const Op >::result diagmat(const T1& X, const sword k) { arma_debug_sigprint(); const uword row_offset = (k < 0) ? uword(-k) : uword(0); const uword col_offset = (k > 0) ? uword( k) : uword(0); return Op(X, row_offset, col_offset); } template arma_warn_unused inline const SpOp diagmat(const SpBase& X) { arma_debug_sigprint(); return SpOp(X.get_ref()); } template arma_warn_unused inline const SpOp diagmat(const SpBase& X, const sword k) { arma_debug_sigprint(); const uword row_offset = (k < 0) ? uword(-k) : uword(0); const uword col_offset = (k > 0) ? uword( k) : uword(0); return SpOp(X.get_ref(), row_offset, col_offset); } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_fft2.hpp0000644000176200001440000000614714631567470022452 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_fft2 //! @{ // 2D FFT & 2D IFFT template arma_warn_unused inline typename enable_if2 < is_arma_type::value, Mat< std::complex > >::result fft2(const T1& A) { arma_debug_sigprint(); // not exactly efficient, but "better-than-nothing" implementation typedef typename T1::pod_type T; Mat< std::complex > B = fft(A); // for square matrices, strans() will work out that an inplace transpose can be done, // hence we can potentially avoid creating a temporary matrix B = strans(B); return strans( fft(B) ); } template arma_warn_unused inline typename enable_if2 < is_arma_type::value, Mat< std::complex > >::result fft2(const T1& A, const uword n_rows, const uword n_cols) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const quasi_unwrap tmp(A); const Mat& B = tmp.M; const bool do_resize = (B.n_rows != n_rows) || (B.n_cols != n_cols); return (do_resize) ? fft2(resize(B,n_rows,n_cols)) : fft2(B); } template arma_warn_unused inline typename enable_if2 < (is_arma_type::value && (is_cx_float::yes || is_cx_double::yes)), Mat< std::complex > >::result ifft2(const T1& A) { arma_debug_sigprint(); // not exactly efficient, but "better-than-nothing" implementation typedef typename T1::pod_type T; Mat< std::complex > B = ifft(A); // for square matrices, strans() will work out that an inplace transpose can be done, // hence we can potentially avoid creating a temporary matrix B = strans(B); return strans( ifft(B) ); } template arma_warn_unused inline typename enable_if2 < (is_arma_type::value && (is_cx_float::yes || is_cx_double::yes)), Mat< std::complex > >::result ifft2(const T1& A, const uword n_rows, const uword n_cols) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const quasi_unwrap tmp(A); const Mat& B = tmp.M; const bool do_resize = (B.n_rows != n_rows) || (B.n_cols != n_cols); return (do_resize) ? ifft2(resize(B,n_rows,n_cols)) : ifft2(B); } //! @} RcppArmadillo/inst/include/armadillo_bits/SpGlue_meat.hpp0000644000176200001440000000312314631567470023322 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup SpGlue //! @{ template inline SpGlue::SpGlue(const T1& in_A, const T2& in_B) : A(in_A) , B(in_B) { arma_debug_sigprint(); } template inline SpGlue::SpGlue(const T1& in_A, const T2& in_B, const typename T1::elem_type in_aux) : A(in_A) , B(in_B) , aux(in_aux) { arma_debug_sigprint(); } template inline SpGlue::~SpGlue() { arma_debug_sigprint(); } template arma_inline bool SpGlue::is_alias(const SpMat& X) const { return (A.is_alias(X) || B.is_alias(X)); } //! @} RcppArmadillo/inst/include/armadillo_bits/op_col_as_mat_meat.hpp0000644000176200001440000000274414631567470024732 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_col_as_mat //! @{ template inline void op_col_as_mat::apply(Mat& out, const CubeToMatOp& expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const unwrap_cube U(expr.m); const Cube& A = U.M; const uword in_col = expr.aux_uword; arma_conform_check_bounds( (in_col >= A.n_cols), "Cube::col_as_mat(): index out of bounds" ); const uword A_n_rows = A.n_rows; const uword A_n_slices = A.n_slices; out.set_size(A_n_rows, A_n_slices); for(uword s=0; s < A_n_slices; ++s) { arrayops::copy(out.colptr(s), A.slice_colptr(s, in_col), A_n_rows); } } //! @} RcppArmadillo/inst/include/armadillo_bits/op_min_meat.hpp0000644000176200001440000006560714720640014023404 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_min //! @{ template inline void op_min::apply(Mat& out, const Op& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword dim = in.aux_uword_a; arma_conform_check( (dim > 1), "min(): parameter 'dim' must be 0 or 1" ); const quasi_unwrap U(in.m); const Mat& X = U.M; if(U.is_alias(out) == false) { op_min::apply_noalias(out, X, dim); } else { Mat tmp; op_min::apply_noalias(tmp, X, dim); out.steal_mem(tmp); } } template inline void op_min::apply_noalias(Mat& out, const Mat& X, const uword dim, const typename arma_not_cx::result* junk) { arma_debug_sigprint(); arma_ignore(junk); const uword X_n_rows = X.n_rows; const uword X_n_cols = X.n_cols; if(dim == 0) { arma_debug_print("op_min::apply(): dim = 0"); out.set_size((X_n_rows > 0) ? 1 : 0, X_n_cols); if(X_n_rows == 0) { return; } eT* out_mem = out.memptr(); for(uword col=0; col 0) ? 1 : 0); if(X_n_cols == 0) { return; } eT* out_mem = out.memptr(); arrayops::copy(out_mem, X.colptr(0), X_n_rows); for(uword col=1; col inline void op_min::apply_noalias(Mat& out, const Mat& X, const uword dim, const typename arma_cx_only::result* junk) { arma_debug_sigprint(); arma_ignore(junk); const uword X_n_rows = X.n_rows; const uword X_n_cols = X.n_cols; if(dim == 0) { arma_debug_print("op_min::apply(): dim = 0"); out.set_size((X_n_rows > 0) ? 1 : 0, X_n_cols); if(X_n_rows == 0) { return; } eT* out_mem = out.memptr(); for(uword col=0; col 0) ? 1 : 0); if(X_n_cols == 0) { return; } eT* out_mem = out.memptr(); for(uword row=0; row inline void op_min::apply(Cube& out, const OpCube& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword dim = in.aux_uword_a; arma_conform_check( (dim > 2), "min(): parameter 'dim' must be 0 or 1 or 2" ); const unwrap_cube U(in.m); if(U.is_alias(out) == false) { op_min::apply_noalias(out, U.M, dim); } else { Cube tmp; op_min::apply_noalias(tmp, U.M, dim); out.steal_mem(tmp); } } template inline void op_min::apply_noalias(Cube& out, const Cube& X, const uword dim, const typename arma_not_cx::result* junk) { arma_debug_sigprint(); arma_ignore(junk); const uword X_n_rows = X.n_rows; const uword X_n_cols = X.n_cols; const uword X_n_slices = X.n_slices; if(dim == 0) { arma_debug_print("op_min::apply(): dim = 0"); out.set_size((X_n_rows > 0) ? 1 : 0, X_n_cols, X_n_slices); if(X_n_rows == 0) { return; } for(uword slice=0; slice < X_n_slices; ++slice) { eT* out_mem = out.slice_memptr(slice); for(uword col=0; col < X_n_cols; ++col) { out_mem[col] = op_min::direct_min( X.slice_colptr(slice,col), X_n_rows ); } } } else if(dim == 1) { arma_debug_print("op_min::apply(): dim = 1"); out.set_size(X_n_rows, (X_n_cols > 0) ? 1 : 0, X_n_slices); if(X_n_cols == 0) { return; } for(uword slice=0; slice < X_n_slices; ++slice) { eT* out_mem = out.slice_memptr(slice); arrayops::copy(out_mem, X.slice_colptr(slice,0), X_n_rows); for(uword col=1; col < X_n_cols; ++col) { const eT* col_mem = X.slice_colptr(slice,col); for(uword row=0; row < X_n_rows; ++row) { const eT col_val = col_mem[row]; if(col_val < out_mem[row]) { out_mem[row] = col_val; } } } } } else if(dim == 2) { arma_debug_print("op_min::apply(): dim = 2"); out.set_size(X_n_rows, X_n_cols, (X_n_slices > 0) ? 1 : 0); if(X_n_slices == 0) { return; } const uword N = X.n_elem_slice; eT* out_mem = out.slice_memptr(0); arrayops::copy(out_mem, X.slice_memptr(0), N); for(uword slice=1; slice < X_n_slices; ++slice) { const eT* X_mem = X.slice_memptr(slice); for(uword i=0; i < N; ++i) { const eT val = X_mem[i]; if(val < out_mem[i]) { out_mem[i] = val; } } } } } template inline void op_min::apply_noalias(Cube& out, const Cube& X, const uword dim, const typename arma_cx_only::result* junk) { arma_debug_sigprint(); arma_ignore(junk); const uword X_n_rows = X.n_rows; const uword X_n_cols = X.n_cols; const uword X_n_slices = X.n_slices; if(dim == 0) { arma_debug_print("op_min::apply(): dim = 0"); out.set_size((X_n_rows > 0) ? 1 : 0, X_n_cols, X_n_slices); if(X_n_rows == 0) { return; } for(uword slice=0; slice < X_n_slices; ++slice) { eT* out_mem = out.slice_memptr(slice); for(uword col=0; col < X_n_cols; ++col) { out_mem[col] = op_min::direct_min( X.slice_colptr(slice,col), X_n_rows ); } } } else if(dim == 1) { arma_debug_print("op_min::apply(): dim = 1"); out.set_size(X_n_rows, (X_n_cols > 0) ? 1 : 0, X_n_slices); if(X_n_cols == 0) { return; } for(uword slice=0; slice < X_n_slices; ++slice) { eT* out_mem = out.slice_memptr(slice); const Mat tmp('j', X.slice_memptr(slice), X_n_rows, X_n_cols); for(uword row=0; row < X_n_rows; ++row) { out_mem[row] = op_min::direct_min(tmp, row); } } } else if(dim == 2) { arma_debug_print("op_min::apply(): dim = 2"); out.set_size(X_n_rows, X_n_cols, (X_n_slices > 0) ? 1 : 0); if(X_n_slices == 0) { return; } const uword N = X.n_elem_slice; eT* out_mem = out.slice_memptr(0); arrayops::copy(out_mem, X.slice_memptr(0), N); for(uword slice=1; slice < X_n_slices; ++slice) { const eT* X_mem = X.slice_memptr(slice); for(uword i=0; i < N; ++i) { const eT& val = X_mem[i]; if(std::abs(val) < std::abs(out_mem[i])) { out_mem[i] = val; } } } } } template inline eT op_min::direct_min(const eT* const X, const uword n_elem) { arma_debug_sigprint(); eT min_val_i = priv::most_pos(); eT min_val_j = priv::most_pos(); uword i,j; for(i=0, j=1; j inline eT op_min::direct_min(const eT* const X, const uword n_elem, uword& index_of_min_val) { arma_debug_sigprint(); eT best_val = priv::most_pos(); uword best_index = 0; for(uword i=0; i < n_elem; ++i) { const eT val = X[i]; if(val < best_val) { best_val = val; best_index = i; } } index_of_min_val = best_index; return best_val; } template inline eT op_min::direct_min(const Mat& X, const uword row) { arma_debug_sigprint(); const uword X_n_cols = X.n_cols; eT min_val_i = priv::most_pos(); eT min_val_j = priv::most_pos(); uword i,j; for(i=0, j=1; j < X_n_cols; i+=2, j+=2) { const eT tmp_i = X.at(row,i); const eT tmp_j = X.at(row,j); if(tmp_i < min_val_i) { min_val_i = tmp_i; } if(tmp_j < min_val_j) { min_val_j = tmp_j; } } if(i < X_n_cols) { const eT tmp_i = X.at(row,i); if(tmp_i < min_val_i) { min_val_i = tmp_i; } } return (min_val_i < min_val_j) ? min_val_i : min_val_j; } template inline eT op_min::min(const subview& X) { arma_debug_sigprint(); if(X.n_elem == 0) { arma_conform_check(true, "min(): object has no elements"); return Datum::nan; } const uword X_n_rows = X.n_rows; const uword X_n_cols = X.n_cols; if(X_n_rows == 1) { eT min_val_i = priv::most_pos(); eT min_val_j = priv::most_pos(); const Mat& A = X.m; const uword start_row = X.aux_row1; const uword start_col = X.aux_col1; const uword end_col_p1 = start_col + X_n_cols; uword i,j; for(i=start_col, j=start_col+1; j < end_col_p1; i+=2, j+=2) { const eT tmp_i = A.at(start_row, i); const eT tmp_j = A.at(start_row, j); if(tmp_i < min_val_i) { min_val_i = tmp_i; } if(tmp_j < min_val_j) { min_val_j = tmp_j; } } if(i < end_col_p1) { const eT tmp_i = A.at(start_row, i); if(tmp_i < min_val_i) { min_val_i = tmp_i; } } return (min_val_i < min_val_j) ? min_val_i : min_val_j; } eT min_val = priv::most_pos(); for(uword col=0; col < X_n_cols; ++col) { min_val = (std::min)(min_val, op_min::direct_min(X.colptr(col), X_n_rows)); } return min_val; } template inline typename arma_not_cx::result op_min::min(const Base& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const Proxy P(X.get_ref()); const uword n_elem = P.get_n_elem(); if(n_elem == 0) { arma_conform_check(true, "min(): object has no elements"); return Datum::nan; } eT min_val_i = priv::most_pos(); eT min_val_j = priv::most_pos(); if(Proxy::use_at == false) { typedef typename Proxy::ea_type ea_type; ea_type A = P.get_ea(); uword i,j; for(i=0, j=1; j inline typename arma_not_cx::result op_min::min(const BaseCube& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const ProxyCube P(X.get_ref()); const uword n_elem = P.get_n_elem(); if(n_elem == 0) { arma_conform_check(true, "min(): object has no elements"); return Datum::nan; } eT min_val = priv::most_pos(); if(ProxyCube::use_at == false) { eT min_val_i = priv::most_pos(); eT min_val_j = priv::most_pos(); typedef typename ProxyCube::ea_type ea_type; ea_type A = P.get_ea(); uword i,j; for(i=0, j=1; j inline typename arma_not_cx::result op_min::min_with_index(const Proxy& P, uword& index_of_min_val) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword n_elem = P.get_n_elem(); if(n_elem == 0) { arma_conform_check(true, "min(): object has no elements"); index_of_min_val = 0; return Datum::nan; } eT best_val = priv::most_pos(); uword best_index = 0; if(Proxy::use_at == false) { typedef typename Proxy::ea_type ea_type; ea_type A = P.get_ea(); for(uword i=0; i inline typename arma_not_cx::result op_min::min_with_index(const ProxyCube& P, uword& index_of_min_val) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword n_elem = P.get_n_elem(); if(n_elem == 0) { arma_conform_check(true, "min(): object has no elements"); index_of_min_val = 0; return Datum::nan; } eT best_val = priv::most_pos(); uword best_index = 0; if(ProxyCube::use_at == false) { typedef typename ProxyCube::ea_type ea_type; ea_type A = P.get_ea(); for(uword i=0; i < n_elem; ++i) { const eT tmp = A[i]; if(tmp < best_val) { best_val = tmp; best_index = i; } } } else { const uword n_rows = P.get_n_rows(); const uword n_cols = P.get_n_cols(); const uword n_slices = P.get_n_slices(); uword count = 0; for(uword slice=0; slice < n_slices; ++slice) for(uword col=0; col < n_cols; ++col ) for(uword row=0; row < n_rows; ++row ) { const eT tmp = P.at(row,col,slice); if(tmp < best_val) { best_val = tmp; best_index = count; } ++count; } } index_of_min_val = best_index; return best_val; } template inline std::complex op_min::direct_min(const std::complex* const X, const uword n_elem) { arma_debug_sigprint(); uword index = 0; T min_val = priv::most_pos(); for(uword i=0; i inline std::complex op_min::direct_min(const std::complex* const X, const uword n_elem, uword& index_of_min_val) { arma_debug_sigprint(); uword index = 0; T min_val = priv::most_pos(); for(uword i=0; i inline std::complex op_min::direct_min(const Mat< std::complex >& X, const uword row) { arma_debug_sigprint(); const uword X_n_cols = X.n_cols; uword index = 0; T min_val = priv::most_pos(); for(uword col=0; col inline std::complex op_min::min(const subview< std::complex >& X) { arma_debug_sigprint(); typedef typename std::complex eT; if(X.n_elem == 0) { arma_conform_check(true, "min(): object has no elements"); return Datum::nan; } const Mat& A = X.m; const uword X_n_rows = X.n_rows; const uword X_n_cols = X.n_cols; const uword start_row = X.aux_row1; const uword start_col = X.aux_col1; const uword end_row_p1 = start_row + X_n_rows; const uword end_col_p1 = start_col + X_n_cols; T min_val = priv::most_pos(); uword best_row = 0; uword best_col = 0; if(X_n_rows == 1) { best_col = 0; for(uword col=start_col; col < end_col_p1; ++col) { const T tmp_val = std::abs( A.at(start_row, col) ); if(tmp_val < min_val) { min_val = tmp_val; best_col = col; } } best_row = start_row; } else { for(uword col=start_col; col < end_col_p1; ++col) for(uword row=start_row; row < end_row_p1; ++row) { const T tmp_val = std::abs( A.at(row, col) ); if(tmp_val < min_val) { min_val = tmp_val; best_row = row; best_col = col; } } } return A.at(best_row, best_col); } template inline typename arma_cx_only::result op_min::min(const Base& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; typedef typename get_pod_type::result T; const Proxy P(X.get_ref()); const uword n_elem = P.get_n_elem(); if(n_elem == 0) { arma_conform_check(true, "min(): object has no elements"); return Datum::nan; } T min_val = priv::most_pos(); if(Proxy::use_at == false) { typedef typename Proxy::ea_type ea_type; ea_type A = P.get_ea(); uword index = 0; for(uword i=0; i inline typename arma_cx_only::result op_min::min(const BaseCube& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; typedef typename get_pod_type::result T; const ProxyCube P(X.get_ref()); const uword n_elem = P.get_n_elem(); if(n_elem == 0) { arma_conform_check(true, "min(): object has no elements"); return Datum::nan; } T min_val = priv::most_pos(); if(ProxyCube::use_at == false) { typedef typename ProxyCube::ea_type ea_type; ea_type A = P.get_ea(); uword index = 0; for(uword i=0; i inline typename arma_cx_only::result op_min::min_with_index(const Proxy& P, uword& index_of_min_val) { arma_debug_sigprint(); typedef typename T1::elem_type eT; typedef typename get_pod_type::result T; const uword n_elem = P.get_n_elem(); if(n_elem == 0) { arma_conform_check(true, "min(): object has no elements"); index_of_min_val = 0; return Datum::nan; } T best_val = priv::most_pos(); if(Proxy::use_at == false) { typedef typename Proxy::ea_type ea_type; ea_type A = P.get_ea(); uword best_index = 0; for(uword i=0; i inline typename arma_cx_only::result op_min::min_with_index(const ProxyCube& P, uword& index_of_min_val) { arma_debug_sigprint(); typedef typename T1::elem_type eT; typedef typename get_pod_type::result T; const uword n_elem = P.get_n_elem(); if(n_elem == 0) { arma_conform_check(true, "min(): object has no elements"); index_of_min_val = 0; return Datum::nan; } T best_val = priv::most_pos(); if(ProxyCube::use_at == false) { typedef typename ProxyCube::ea_type ea_type; ea_type A = P.get_ea(); uword best_index = 0; for(uword i=0; i < n_elem; ++i) { const T tmp = std::abs(A[i]); if(tmp < best_val) { best_val = tmp; best_index = i; } } index_of_min_val = best_index; return( A[best_index] ); } else { const uword n_rows = P.get_n_rows(); const uword n_cols = P.get_n_cols(); const uword n_slices = P.get_n_slices(); eT best_val_orig = eT(0); uword best_index = 0; uword count = 0; for(uword slice=0; slice < n_slices; ++slice) for(uword col=0; col < n_cols; ++col ) for(uword row=0; row < n_rows; ++row ) { const eT tmp_orig = P.at(row,col,slice); const T tmp = std::abs(tmp_orig); if(tmp < best_val) { best_val = tmp; best_val_orig = tmp_orig; best_index = count; } ++count; } index_of_min_val = best_index; return best_val_orig; } } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_n_unique.hpp0000644000176200001440000000637214631567470023434 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_n_unique //! @{ //! \brief //! Get the number of unique nonzero elements in two sparse matrices. //! This is very useful for determining the amount of memory necessary before //! a sparse matrix operation on two matrices. template inline uword n_unique ( const SpBase& x, const SpBase& y, const op_n_unique_type junk ) { arma_debug_sigprint(); const SpProxy pa(x.get_ref()); const SpProxy pb(y.get_ref()); return n_unique(pa,pb,junk); } template arma_hot inline uword n_unique ( const SpProxy& pa, const SpProxy& pb, const op_n_unique_type junk ) { arma_debug_sigprint(); arma_ignore(junk); typename SpProxy::const_iterator_type x_it = pa.begin(); typename SpProxy::const_iterator_type x_it_end = pa.end(); typename SpProxy::const_iterator_type y_it = pb.begin(); typename SpProxy::const_iterator_type y_it_end = pb.end(); uword total_n_nonzero = 0; while( (x_it != x_it_end) || (y_it != y_it_end) ) { if(x_it == y_it) { if(op_n_unique_type::eval((*x_it), (*y_it)) != typename T1::elem_type(0)) { ++total_n_nonzero; } ++x_it; ++y_it; } else { if((x_it.col() < y_it.col()) || ((x_it.col() == y_it.col()) && (x_it.row() < y_it.row()))) // if y is closer to the end { if(op_n_unique_type::eval((*x_it), typename T1::elem_type(0)) != typename T1::elem_type(0)) { ++total_n_nonzero; } ++x_it; } else // x is closer to the end { if(op_n_unique_type::eval(typename T1::elem_type(0), (*y_it)) != typename T1::elem_type(0)) { ++total_n_nonzero; } ++y_it; } } } return total_n_nonzero; } // Simple operators. struct op_n_unique_add { template inline static eT eval(const eT& l, const eT& r) { return (l + r); } }; struct op_n_unique_sub { template inline static eT eval(const eT& l, const eT& r) { return (l - r); } }; struct op_n_unique_mul { template inline static eT eval(const eT& l, const eT& r) { return (l * r); } }; struct op_n_unique_count { template inline static eT eval(const eT&, const eT&) { return eT(1); } }; //! @} RcppArmadillo/inst/include/armadillo_bits/eGlue_meat.hpp0000644000176200001440000000767314715372502023173 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup eGlue //! @{ template arma_inline eGlue::~eGlue() { arma_debug_sigprint(); } template arma_inline eGlue::eGlue(const T1& in_A, const T2& in_B) : P1(in_A) , P2(in_B) { arma_debug_sigprint(); // arma_conform_assert_same_size( P1, P2, eglue_type::text() ); arma_conform_assert_same_size ( P1.get_n_rows(), P1.get_n_cols(), P2.get_n_rows(), P2.get_n_cols(), eglue_type::text() ); } template template inline bool eGlue::is_alias(const Mat& X) const { return (P1.is_alias(X) || P2.is_alias(X)); } template arma_inline uword eGlue::get_n_rows() const { return is_row ? 1 : P1.get_n_rows(); } template arma_inline uword eGlue::get_n_cols() const { return is_col ? 1 : P1.get_n_cols(); } template arma_inline uword eGlue::get_n_elem() const { return P1.get_n_elem(); } template arma_inline typename T1::elem_type eGlue::operator[] (const uword ii) const { // the optimiser will keep only one return statement typedef typename T1::elem_type eT; if(is_same_type::yes) { return P1[ii] + P2[ii]; } else if(is_same_type::yes) { return P1[ii] - P2[ii]; } else if(is_same_type::yes) { return P1[ii] / P2[ii]; } else if(is_same_type::yes) { return P1[ii] * P2[ii]; } else return eT(0); } template arma_inline typename T1::elem_type eGlue::at(const uword row, const uword col) const { // the optimiser will keep only one return statement typedef typename T1::elem_type eT; if(is_same_type::yes) { return P1.at(row,col) + P2.at(row,col); } else if(is_same_type::yes) { return P1.at(row,col) - P2.at(row,col); } else if(is_same_type::yes) { return P1.at(row,col) / P2.at(row,col); } else if(is_same_type::yes) { return P1.at(row,col) * P2.at(row,col); } else return eT(0); } template arma_inline typename T1::elem_type eGlue::at_alt(const uword ii) const { // the optimiser will keep only one return statement typedef typename T1::elem_type eT; if(is_same_type::yes) { return P1.at_alt(ii) + P2.at_alt(ii); } else if(is_same_type::yes) { return P1.at_alt(ii) - P2.at_alt(ii); } else if(is_same_type::yes) { return P1.at_alt(ii) / P2.at_alt(ii); } else if(is_same_type::yes) { return P1.at_alt(ii) * P2.at_alt(ii); } else return eT(0); } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_sprandu.hpp0000644000176200001440000000543514631567470023264 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_sprandu //! @{ //! Generate a sparse matrix with a randomly selected subset of the elements //! set to random values in the [0,1] interval (uniform distribution) template arma_warn_unused inline obj_type sprandu ( const uword n_rows, const uword n_cols, const double density, const typename arma_SpMat_SpCol_SpRow_only::result* junk = nullptr ) { arma_debug_sigprint(); arma_ignore(junk); if(is_SpCol::value) { arma_conform_check( (n_cols != 1), "sprandu(): incompatible size" ); } else if(is_SpRow::value) { arma_conform_check( (n_rows != 1), "sprandu(): incompatible size" ); } obj_type out; out.sprandu(n_rows, n_cols, density); return out; } template arma_warn_unused inline obj_type sprandu(const SizeMat& s, const double density, const typename arma_SpMat_SpCol_SpRow_only::result* junk = nullptr) { arma_debug_sigprint(); arma_ignore(junk); return sprandu(s.n_rows, s.n_cols, density); } arma_warn_unused inline sp_mat sprandu(const uword n_rows, const uword n_cols, const double density) { arma_debug_sigprint(); sp_mat out; out.sprandu(n_rows, n_cols, density); return out; } arma_warn_unused inline sp_mat sprandu(const SizeMat& s, const double density) { arma_debug_sigprint(); sp_mat out; out.sprandu(s.n_rows, s.n_cols, density); return out; } //! Generate a sparse matrix with the non-zero values in the same locations as in the given sparse matrix X, //! with the non-zero values set to random values in the [0,1] interval (uniform distribution) template arma_warn_unused inline SpMat sprandu(const SpBase& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; SpMat out( X.get_ref() ); arma_rng::randu::fill( access::rwp(out.values), out.n_nonzero ); return out; } //! @} RcppArmadillo/inst/include/armadillo_bits/def_atlas.hpp0000644000176200001440000001226214301267043023026 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ // TODO: remove support for ATLAS in next major version #if defined(ARMA_USE_ATLAS) typedef enum { atlas_CblasRowMajor = 101, atlas_CblasColMajor = 102 } atlas_CBLAS_LAYOUT; typedef enum { atlas_CblasNoTrans = 111, atlas_CblasTrans = 112, atlas_CblasConjTrans = 113 } atlas_CBLAS_TRANS; typedef enum { atlas_CblasUpper = 121, atlas_CblasLower = 122 } atlas_CBLAS_UPLO; extern "C" { float arma_wrapper(cblas_sasum)(const int N, const float *X, const int incX); double arma_wrapper(cblas_dasum)(const int N, const double *X, const int incX); float arma_wrapper(cblas_snrm2)(const int N, const float *X, const int incX); double arma_wrapper(cblas_dnrm2)(const int N, const double *X, const int incX); float arma_wrapper(cblas_sdot)(const int N, const float *X, const int incX, const float *Y, const int incY); double arma_wrapper(cblas_ddot)(const int N, const double *X, const int incX, const double *Y, const int incY); void arma_wrapper(cblas_cdotu_sub)(const int N, const void *X, const int incX, const void *Y, const int incY, void *dotu); void arma_wrapper(cblas_zdotu_sub)(const int N, const void *X, const int incX, const void *Y, const int incY, void *dotu); void arma_wrapper(cblas_sgemv)(const atlas_CBLAS_LAYOUT layout, const atlas_CBLAS_TRANS TransA, const int M, const int N, const float alpha, const float *A, const int lda, const float *X, const int incX, const float beta, float *Y, const int incY); void arma_wrapper(cblas_dgemv)(const atlas_CBLAS_LAYOUT layout, const atlas_CBLAS_TRANS TransA, const int M, const int N, const double alpha, const double *A, const int lda, const double *X, const int incX, const double beta, double *Y, const int incY); void arma_wrapper(cblas_cgemv)(const atlas_CBLAS_LAYOUT layout, const atlas_CBLAS_TRANS TransA, const int M, const int N, const void *alpha, const void *A, const int lda, const void *X, const int incX, const void *beta, void *Y, const int incY); void arma_wrapper(cblas_zgemv)(const atlas_CBLAS_LAYOUT layout, const atlas_CBLAS_TRANS TransA, const int M, const int N, const void *alpha, const void *A, const int lda, const void *X, const int incX, const void *beta, void *Y, const int incY); void arma_wrapper(cblas_sgemm)(const atlas_CBLAS_LAYOUT layout, const atlas_CBLAS_TRANS TransA, const atlas_CBLAS_TRANS TransB, const int M, const int N, const int K, const float alpha, const float *A, const int lda, const float *B, const int ldb, const float beta, float *C, const int ldc); void arma_wrapper(cblas_dgemm)(const atlas_CBLAS_LAYOUT layout, const atlas_CBLAS_TRANS TransA, const atlas_CBLAS_TRANS TransB, const int M, const int N, const int K, const double alpha, const double *A, const int lda, const double *B, const int ldb, const double beta, double *C, const int ldc); void arma_wrapper(cblas_cgemm)(const atlas_CBLAS_LAYOUT layout, const atlas_CBLAS_TRANS TransA, const atlas_CBLAS_TRANS TransB, const int M, const int N, const int K, const void *alpha, const void *A, const int lda, const void *B, const int ldb, const void *beta, void *C, const int ldc); void arma_wrapper(cblas_zgemm)(const atlas_CBLAS_LAYOUT layout, const atlas_CBLAS_TRANS TransA, const atlas_CBLAS_TRANS TransB, const int M, const int N, const int K, const void *alpha, const void *A, const int lda, const void *B, const int ldb, const void *beta, void *C, const int ldc); void arma_wrapper(cblas_ssyrk)(const atlas_CBLAS_LAYOUT layout, const atlas_CBLAS_UPLO Uplo, const atlas_CBLAS_TRANS Trans, const int N, const int K, const float alpha, const float *A, const int lda, const float beta, float *C, const int ldc); void arma_wrapper(cblas_dsyrk)(const atlas_CBLAS_LAYOUT layout, const atlas_CBLAS_UPLO Uplo, const atlas_CBLAS_TRANS Trans, const int N, const int K, const double alpha, const double *A, const int lda, const double beta, double *C, const int ldc); void arma_wrapper(cblas_cherk)(const atlas_CBLAS_LAYOUT layout, const atlas_CBLAS_UPLO Uplo, const atlas_CBLAS_TRANS Trans, const int N, const int K, const float alpha, const void *A, const int lda, const float beta, void *C, const int ldc); void arma_wrapper(cblas_zherk)(const atlas_CBLAS_LAYOUT layout, const atlas_CBLAS_UPLO Uplo, const atlas_CBLAS_TRANS Trans, const int N, const int K, const double alpha, const void *A, const int lda, const double beta, void *C, const int ldc); } #endif RcppArmadillo/inst/include/armadillo_bits/Row_bones.hpp0000644000176200001440000002635214723642672023063 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup Row //! @{ //! Class for row vectors (matrices with only one row) template class Row : public Mat { public: typedef eT elem_type; typedef typename get_pod_type::result pod_type; static constexpr bool is_col = false; static constexpr bool is_row = true; static constexpr bool is_xvec = false; inline Row(); inline Row(const Row& X); inline explicit Row(const uword N); inline explicit Row(const uword in_rows, const uword in_cols); inline explicit Row(const SizeMat& s); template inline explicit Row(const uword N, const arma_initmode_indicator&); template inline explicit Row(const uword in_rows, const uword in_cols, const arma_initmode_indicator&); template inline explicit Row(const SizeMat& s, const arma_initmode_indicator&); template inline Row(const uword n_elem, const fill::fill_class& f); template inline Row(const uword in_rows, const uword in_cols, const fill::fill_class& f); template inline Row(const SizeMat& s, const fill::fill_class& f); inline Row(const uword N, const fill::scalar_holder f); inline Row(const uword in_rows, const uword in_cols, const fill::scalar_holder f); inline Row(const SizeMat& s, const fill::scalar_holder f); inline Row(const char* text); inline Row& operator=(const char* text); inline Row(const std::string& text); inline Row& operator=(const std::string& text); inline Row(const std::vector& x); inline Row& operator=(const std::vector& x); inline Row(const std::initializer_list& list); inline Row& operator=(const std::initializer_list& list); inline Row(Row&& m); inline Row& operator=(Row&& m); // inline Row(Mat&& m); // inline Row& operator=(Mat&& m); inline Row& operator=(const eT val); inline Row& operator=(const Row& X); template inline Row(const Base& X); template inline Row& operator=(const Base& X); template inline explicit Row(const SpBase& X); template inline Row& operator=(const SpBase& X); inline Row( eT* aux_mem, const uword aux_length, const bool copy_aux_mem = true, const bool strict = false); inline Row(const eT* aux_mem, const uword aux_length); template inline explicit Row(const Base& A, const Base& B); template inline Row(const BaseCube& X); template inline Row& operator=(const BaseCube& X); inline Row(const subview_cube& X); inline Row& operator=(const subview_cube& X); arma_frown("use braced initialiser list instead") inline mat_injector operator<<(const eT val); arma_warn_unused arma_inline const Op,op_htrans> t() const; arma_warn_unused arma_inline const Op,op_htrans> ht() const; arma_warn_unused arma_inline const Op,op_strans> st() const; arma_warn_unused arma_inline const Op,op_strans> as_col() const; arma_inline subview_row col(const uword col_num); arma_inline const subview_row col(const uword col_num) const; using Mat::cols; using Mat::operator(); arma_inline subview_row cols(const uword in_col1, const uword in_col2); arma_inline const subview_row cols(const uword in_col1, const uword in_col2) const; arma_inline subview_row subvec(const uword in_col1, const uword in_col2); arma_inline const subview_row subvec(const uword in_col1, const uword in_col2) const; arma_inline subview_row cols(const span& col_span); arma_inline const subview_row cols(const span& col_span) const; arma_inline subview_row subvec(const span& col_span); arma_inline const subview_row subvec(const span& col_span) const; arma_inline subview_row operator()(const span& col_span); arma_inline const subview_row operator()(const span& col_span) const; arma_inline subview_row subvec(const uword start_col, const SizeMat& s); arma_inline const subview_row subvec(const uword start_col, const SizeMat& s) const; arma_inline subview_row head(const uword N); arma_inline const subview_row head(const uword N) const; arma_inline subview_row tail(const uword N); arma_inline const subview_row tail(const uword N) const; arma_inline subview_row head_cols(const uword N); arma_inline const subview_row head_cols(const uword N) const; arma_inline subview_row tail_cols(const uword N); arma_inline const subview_row tail_cols(const uword N) const; inline void shed_col (const uword col_num); inline void shed_cols(const uword in_col1, const uword in_col2); template inline void shed_cols(const Base& indices); arma_deprecated inline void insert_cols(const uword col_num, const uword N, const bool set_to_zero); inline void insert_cols(const uword col_num, const uword N); template inline void insert_cols(const uword col_num, const Base& X); arma_warn_unused arma_inline eT& at(const uword i); arma_warn_unused arma_inline const eT& at(const uword i) const; arma_warn_unused arma_inline eT& at(const uword in_row, const uword in_col); arma_warn_unused arma_inline const eT& at(const uword in_row, const uword in_col) const; typedef eT* row_iterator; typedef const eT* const_row_iterator; inline row_iterator begin_row(const uword row_num); inline const_row_iterator begin_row(const uword row_num) const; inline row_iterator end_row (const uword row_num); inline const_row_iterator end_row (const uword row_num) const; template class fixed; protected: inline Row(const arma_fixed_indicator&, const uword in_n_elem, const eT* in_mem); public: #if defined(ARMA_EXTRA_ROW_PROTO) #include ARMA_INCFILE_WRAP(ARMA_EXTRA_ROW_PROTO) #endif }; template template class Row::fixed : public Row { private: using Mat::mem_local; static constexpr bool use_extra = (fixed_n_elem > arma_config::mat_prealloc); arma_align_mem eT mem_local_extra[ (use_extra) ? fixed_n_elem : 1 ]; public: typedef fixed Row_fixed_type; typedef eT elem_type; typedef typename get_pod_type::result pod_type; static constexpr bool is_col = false; static constexpr bool is_row = true; static constexpr bool is_xvec = false; static const uword n_rows; // value provided below the class definition static const uword n_cols; // value provided below the class definition static const uword n_elem; // value provided below the class definition arma_inline fixed(); arma_inline fixed(const fixed& X); inline fixed(const subview_cube& X); inline fixed(const fill::scalar_holder f); template inline fixed(const fill::fill_class& f); template inline fixed(const Base& A); template inline fixed(const Base& A, const Base& B); inline fixed(const eT* aux_mem); inline fixed(const char* text); inline fixed(const std::string& text); template inline Row& operator=(const Base& A); inline Row& operator=(const eT val); inline Row& operator=(const char* text); inline Row& operator=(const std::string& text); inline Row& operator=(const subview_cube& X); using Row::operator(); inline fixed(const std::initializer_list& list); inline Row& operator=(const std::initializer_list& list); arma_inline Row& operator=(const fixed& X); #if defined(ARMA_GOOD_COMPILER) template inline Row& operator=(const eOp& X); template inline Row& operator=(const eGlue& X); #endif arma_warn_unused arma_inline const Op< Row_fixed_type, op_htrans > t() const; arma_warn_unused arma_inline const Op< Row_fixed_type, op_htrans > ht() const; arma_warn_unused arma_inline const Op< Row_fixed_type, op_strans > st() const; arma_warn_unused arma_inline const eT& at_alt (const uword i) const; arma_warn_unused arma_inline eT& operator[] (const uword i); arma_warn_unused arma_inline const eT& operator[] (const uword i) const; arma_warn_unused arma_inline eT& at (const uword i); arma_warn_unused arma_inline const eT& at (const uword i) const; arma_warn_unused arma_inline eT& operator() (const uword i); arma_warn_unused arma_inline const eT& operator() (const uword i) const; arma_warn_unused arma_inline eT& at (const uword in_row, const uword in_col); arma_warn_unused arma_inline const eT& at (const uword in_row, const uword in_col) const; arma_warn_unused arma_inline eT& operator() (const uword in_row, const uword in_col); arma_warn_unused arma_inline const eT& operator() (const uword in_row, const uword in_col) const; arma_warn_unused arma_inline eT* memptr(); arma_warn_unused arma_inline const eT* memptr() const; inline const Row& fill(const eT val); inline const Row& zeros(); inline const Row& ones(); }; // these definitions are outside of the class due to bizarre C++ rules; // C++17 has inline variables to address this shortcoming template template const uword Row::fixed::n_rows = 1u; template template const uword Row::fixed::n_cols = fixed_n_elem; template template const uword Row::fixed::n_elem = fixed_n_elem; //! @} RcppArmadillo/inst/include/armadillo_bits/op_index_min_meat.hpp0000644000176200001440000002351514631567470024602 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_index_min //! @{ template inline void op_index_min::apply(Mat& out, const mtOp& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword dim = in.aux_uword_a; arma_conform_check( (dim > 1), "index_min(): parameter 'dim' must be 0 or 1" ); const quasi_unwrap U(in.m); const Mat& X = U.M; if(U.is_alias(out) == false) { op_index_min::apply_noalias(out, X, dim); } else { Mat tmp; op_index_min::apply_noalias(tmp, X, dim); out.steal_mem(tmp); } } template inline void op_index_min::apply_noalias(Mat& out, const Mat& X, const uword dim) { arma_debug_sigprint(); typedef typename get_pod_type::result T; const uword X_n_rows = X.n_rows; const uword X_n_cols = X.n_cols; if(dim == 0) { arma_debug_print("op_index_min::apply(): dim = 0"); out.set_size((X_n_rows > 0) ? 1 : 0, X_n_cols); if(X_n_rows == 0) { return; } uword* out_mem = out.memptr(); for(uword col=0; col < X_n_cols; ++col) { op_min::direct_min( X.colptr(col), X_n_rows, out_mem[col] ); } } else if(dim == 1) { arma_debug_print("op_index_min::apply(): dim = 1"); out.zeros(X_n_rows, (X_n_cols > 0) ? 1 : 0); if(X_n_cols == 0) { return; } uword* out_mem = out.memptr(); Col tmp(X_n_rows, arma_nozeros_indicator()); T* tmp_mem = tmp.memptr(); if(is_cx::yes) { const eT* col_mem = X.colptr(0); for(uword row=0; row < X_n_rows; ++row) { tmp_mem[row] = eop_aux::arma_abs(col_mem[row]); } } else { arrayops::copy(tmp_mem, (T*)(X.colptr(0)), X_n_rows); } for(uword col=1; col < X_n_cols; ++col) { const eT* col_mem = X.colptr(col); for(uword row=0; row < X_n_rows; ++row) { T& min_val = tmp_mem[row]; T col_val = (is_cx::yes) ? T(eop_aux::arma_abs(col_mem[row])) : T(access::tmp_real(col_mem[row])); if(min_val > col_val) { min_val = col_val; out_mem[row] = col; } } } } } template inline void op_index_min::apply(Cube& out, const mtOpCube& in) { arma_debug_sigprint(); const uword dim = in.aux_uword_a; arma_conform_check( (dim > 2), "index_min(): parameter 'dim' must be 0 or 1 or 2" ); const unwrap_cube U(in.m); if(U.is_alias(out) == false) { op_index_min::apply_noalias(out, U.M, dim); } else { Cube tmp; op_index_min::apply_noalias(tmp, U.M, dim); out.steal_mem(tmp); } } template inline void op_index_min::apply_noalias(Cube& out, const Cube& X, const uword dim, const typename arma_not_cx::result* junk) { arma_debug_sigprint(); arma_ignore(junk); const uword X_n_rows = X.n_rows; const uword X_n_cols = X.n_cols; const uword X_n_slices = X.n_slices; if(dim == 0) { arma_debug_print("op_index_min::apply(): dim = 0"); out.set_size((X_n_rows > 0) ? 1 : 0, X_n_cols, X_n_slices); if(out.is_empty() || X.is_empty()) { return; } for(uword slice=0; slice < X_n_slices; ++slice) { uword* out_mem = out.slice_memptr(slice); for(uword col=0; col < X_n_cols; ++col) { op_min::direct_min( X.slice_colptr(slice,col), X_n_rows, out_mem[col] ); } } } else if(dim == 1) { arma_debug_print("op_index_min::apply(): dim = 1"); out.zeros(X_n_rows, (X_n_cols > 0) ? 1 : 0, X_n_slices); if(out.is_empty() || X.is_empty()) { return; } Col tmp(X_n_rows, arma_nozeros_indicator()); eT* tmp_mem = tmp.memptr(); for(uword slice=0; slice < X_n_slices; ++slice) { uword* out_mem = out.slice_memptr(slice); arrayops::copy(tmp_mem, X.slice_colptr(slice,0), X_n_rows); for(uword col=1; col < X_n_cols; ++col) { const eT* col_mem = X.slice_colptr(slice,col); for(uword row=0; row < X_n_rows; ++row) { const eT val = col_mem[row]; if(val < tmp_mem[row]) { tmp_mem[row] = val; out_mem[row] = col; } } } } } else if(dim == 2) { arma_debug_print("op_index_min::apply(): dim = 2"); out.zeros(X_n_rows, X_n_cols, (X_n_slices > 0) ? 1 : 0); if(out.is_empty() || X.is_empty()) { return; } Mat tmp(X.slice_memptr(0), X_n_rows, X_n_cols); // copy slice 0 eT* tmp_mem = tmp.memptr(); uword* out_mem = out.memptr(); const uword N = X.n_elem_slice; for(uword slice=1; slice < X_n_slices; ++slice) { const eT* X_slice_mem = X.slice_memptr(slice); for(uword i=0; i < N; ++i) { const eT val = X_slice_mem[i]; if(val < tmp_mem[i]) { tmp_mem[i] = val; out_mem[i] = slice; } } } } } template inline void op_index_min::apply_noalias(Cube& out, const Cube& X, const uword dim, const typename arma_cx_only::result* junk) { arma_debug_sigprint(); arma_ignore(junk); typedef typename get_pod_type::result T; const uword X_n_rows = X.n_rows; const uword X_n_cols = X.n_cols; const uword X_n_slices = X.n_slices; if(dim == 0) { arma_debug_print("op_index_min::apply(): dim = 0"); out.set_size((X_n_rows > 0) ? 1 : 0, X_n_cols, X_n_slices); if(out.is_empty() || X.is_empty()) { return; } for(uword slice=0; slice < X_n_slices; ++slice) { uword* out_mem = out.slice_memptr(slice); for(uword col=0; col < X_n_cols; ++col) { op_min::direct_min( X.slice_colptr(slice,col), X_n_rows, out_mem[col] ); } } } else if(dim == 1) { arma_debug_print("op_index_min::apply(): dim = 1"); out.zeros(X_n_rows, (X_n_cols > 0) ? 1 : 0, X_n_slices); if(out.is_empty() || X.is_empty()) { return; } Col tmp(X_n_rows, arma_nozeros_indicator()); T* tmp_mem = tmp.memptr(); for(uword slice=0; slice < X_n_slices; ++slice) { uword* out_mem = out.slice_memptr(slice); const eT* col0_mem = X.slice_colptr(slice,0); for(uword row=0; row < X_n_rows; ++row) { tmp_mem[row] = std::abs( col0_mem[row] ); } for(uword col=1; col < X_n_cols; ++col) { const eT* col_mem = X.slice_colptr(slice,col); for(uword row=0; row < X_n_rows; ++row) { const T val = std::abs( col_mem[row] ); if(val < tmp_mem[row]) { tmp_mem[row] = val; out_mem[row] = col; } } } } } else if(dim == 2) { arma_debug_print("op_index_min::apply(): dim = 2"); out.zeros(X_n_rows, X_n_cols, (X_n_slices > 0) ? 1 : 0); if(out.is_empty() || X.is_empty()) { return; } uword* out_mem = out.memptr(); Mat tmp(X_n_rows, X_n_cols, arma_nozeros_indicator()); T* tmp_mem = tmp.memptr(); const eT* X_slice0_mem = X.slice_memptr(0); const uword N = X.n_elem_slice; for(uword i=0; i inline void op_index_min::apply(Mat& out, const SpBase& expr, const uword dim) { arma_debug_sigprint(); typedef typename T1::elem_type eT; arma_conform_check( (dim > 1), "index_min(): parameter 'dim' must be 0 or 1" ); const unwrap_spmat U(expr.get_ref()); const SpMat& X = U.M; const uword X_n_rows = X.n_rows; const uword X_n_cols = X.n_cols; if(dim == 0) { arma_debug_print("op_index_min::apply(): dim = 0"); out.set_size((X_n_rows > 0) ? 1 : 0, X_n_cols); if(X_n_rows == 0) { return; } uword* out_mem = out.memptr(); for(uword col=0; col < X_n_cols; ++col) { out_mem[col] = X.col(col).index_min(); } } else if(dim == 1) { arma_debug_print("op_index_min::apply(): dim = 1"); out.set_size(X_n_rows, (X_n_cols > 0) ? 1 : 0); if(X_n_cols == 0) { return; } uword* out_mem = out.memptr(); const SpMat Xt = X.st(); for(uword row=0; row < X_n_rows; ++row) { out_mem[row] = Xt.col(row).index_min(); } } } //! @} RcppArmadillo/inst/include/armadillo_bits/mtOpCube_meat.hpp0000644000176200001440000000522114631567470023642 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup mtOpCube //! @{ template inline mtOpCube::mtOpCube(const T1& in_m) : m(in_m) { arma_debug_sigprint(); } template inline mtOpCube::mtOpCube(const T1& in_m, const typename T1::elem_type in_aux) : m(in_m) , aux(in_aux) { arma_debug_sigprint(); } template inline mtOpCube::mtOpCube(const T1& in_m, const uword in_aux_uword_a, const uword in_aux_uword_b, const uword in_aux_uword_c) : m(in_m) , aux_uword_a(in_aux_uword_a) , aux_uword_b(in_aux_uword_b) , aux_uword_c(in_aux_uword_c) { arma_debug_sigprint(); } template inline mtOpCube::mtOpCube(const T1& in_m, const typename T1::elem_type in_aux, const uword in_aux_uword_a, const uword in_aux_uword_b, const uword in_aux_uword_c) : m(in_m) , aux(in_aux) , aux_uword_a(in_aux_uword_a) , aux_uword_b(in_aux_uword_b) , aux_uword_c(in_aux_uword_c) { arma_debug_sigprint(); } template inline mtOpCube::mtOpCube(const char junk, const T1& in_m, const out_eT in_aux) : m(in_m) , aux_out_eT(in_aux) { arma_debug_sigprint(); arma_ignore(junk); } template inline mtOpCube::mtOpCube(const mtOpCube_dual_aux_indicator&, const T1& in_m, const typename T1::elem_type in_aux_a, const out_eT in_aux_b) : m (in_m ) , aux (in_aux_a) , aux_out_eT(in_aux_b) { arma_debug_sigprint(); } template inline mtOpCube::~mtOpCube() { arma_debug_sigprint(); } //! @} RcppArmadillo/inst/include/armadillo_bits/distr_param.hpp0000644000176200001440000000342414301267043023411 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup distr_param //! @{ class distr_param { public: const uword state; private: int a_int; int b_int; double a_double; double b_double; public: inline distr_param() : state (0) , a_int (0) , b_int (0) , a_double(0) , b_double(0) { } inline explicit distr_param(const int a, const int b) : state (1) , a_int (a) , b_int (b) , a_double(double(a)) , b_double(double(b)) { } inline explicit distr_param(const double a, const double b) : state (2) , a_int (int(a)) , b_int (int(b)) , a_double(a) , b_double(b) { } inline void get_int_vals(int& out_a, int& out_b) const { if(state == 0) { return; } out_a = a_int; out_b = b_int; } inline void get_double_vals(double& out_a, double& out_b) const { if(state == 0) { return; } out_a = a_double; out_b = b_double; } }; //! @} RcppArmadillo/inst/include/armadillo_bits/spop_trimat_meat.hpp0000644000176200001440000002154014631567470024467 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup spop_trimat //! @{ template inline void spop_trimat::apply_noalias(SpMat& out, const SpProxy& P, const bool upper) { arma_debug_sigprint(); typename SpProxy::const_iterator_type it = P.begin(); const uword old_n_nonzero = P.get_n_nonzero(); uword new_n_nonzero = 0; if(upper) { // upper triangular: count elements on the diagonal and above the diagonal for(uword i=0; i < old_n_nonzero; ++i) { new_n_nonzero += (it.row() <= it.col()) ? uword(1) : uword(0); ++it; } } else { // lower triangular: count elements on the diagonal and below the diagonal for(uword i=0; i < old_n_nonzero; ++i) { new_n_nonzero += (it.row() >= it.col()) ? uword(1) : uword(0); ++it; } } const uword n_rows = P.get_n_rows(); const uword n_cols = P.get_n_cols(); out.reserve(n_rows, n_cols, new_n_nonzero); uword new_index = 0; it = P.begin(); if(upper) { // upper triangular: copy elements on the diagonal and above the diagonal for(uword i=0; i < old_n_nonzero; ++i) { const uword row = it.row(); const uword col = it.col(); if(row <= col) { access::rw(out.values[new_index]) = (*it); access::rw(out.row_indices[new_index]) = row; access::rw(out.col_ptrs[col + 1])++; ++new_index; } ++it; } } else { // lower triangular: copy elements on the diagonal and below the diagonal for(uword i=0; i < old_n_nonzero; ++i) { const uword row = it.row(); const uword col = it.col(); if(row >= col) { access::rw(out.values[new_index]) = (*it); access::rw(out.row_indices[new_index]) = row; access::rw(out.col_ptrs[col + 1])++; ++new_index; } ++it; } } for(uword i=0; i < n_cols; ++i) { access::rw(out.col_ptrs[i + 1]) += out.col_ptrs[i]; } } template inline void spop_trimat::apply(SpMat& out, const SpOp& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const SpProxy P(in.m); arma_conform_check( (P.get_n_rows() != P.get_n_cols()), "trimatu()/trimatl(): given matrix must be square sized" ); const bool upper = (in.aux_uword_a == 0); if(P.is_alias(out)) { SpMat tmp; spop_trimat::apply_noalias(tmp, P, upper); out.steal_mem(tmp); } else { spop_trimat::apply_noalias(out, P, upper); } } // template inline void spop_trimatu_ext::apply_noalias(SpMat& out, const SpMat& A, const uword row_offset, const uword col_offset) { arma_debug_sigprint(); const uword n_rows = A.n_rows; const uword n_cols = A.n_cols; arma_conform_check_bounds( ((row_offset > 0) && (row_offset >= n_rows)) || ((col_offset > 0) && (col_offset >= n_cols)), "trimatu(): requested diagonal is out of bounds" ); if(A.n_nonzero == 0) { out.zeros(n_rows, n_cols); return; } out.reserve(n_rows, n_cols, A.n_nonzero); // upper bound on n_nonzero uword count = 0; const uword N = (std::min)(n_rows - row_offset, n_cols - col_offset); for(uword i=0; i < n_cols; ++i) { const uword col = i + col_offset; if(i < N) { typename SpMat::const_col_iterator it = A.begin_col_no_sync(col); typename SpMat::const_col_iterator it_end = A.end_col_no_sync(col); const uword end_row = i + row_offset; for(; it != it_end; ++it) { const uword it_row = it.row(); if(it_row <= end_row) { const uword it_col = it.col(); access::rw(out.values[count]) = (*it); access::rw(out.row_indices[count]) = it_row; access::rw(out.col_ptrs[it_col + 1])++; ++count; } else { break; } } } else { if(col < n_cols) { typename SpMat::const_col_iterator it = A.begin_col_no_sync(col); typename SpMat::const_col_iterator it_end = A.end_col_no_sync(col); for(; it != it_end; ++it) { const uword it_row = it.row(); const uword it_col = it.col(); access::rw(out.values[count]) = (*it); access::rw(out.row_indices[count]) = it_row; access::rw(out.col_ptrs[it_col + 1])++; ++count; } } } } for(uword i=0; i < n_cols; ++i) { access::rw(out.col_ptrs[i + 1]) += out.col_ptrs[i]; } if(count < A.n_nonzero) { out.mem_resize(count); } } template inline void spop_trimatu_ext::apply(SpMat& out, const SpOp& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const unwrap_spmat U(in.m); const SpMat& A = U.M; arma_conform_check( (A.is_square() == false), "trimatu(): given matrix must be square sized" ); const uword row_offset = in.aux_uword_a; const uword col_offset = in.aux_uword_b; if(U.is_alias(out)) { SpMat tmp; spop_trimatu_ext::apply_noalias(tmp, A, row_offset, col_offset); out.steal_mem(tmp); } else { spop_trimatu_ext::apply_noalias(out, A, row_offset, col_offset); } } // template inline void spop_trimatl_ext::apply_noalias(SpMat& out, const SpMat& A, const uword row_offset, const uword col_offset) { arma_debug_sigprint(); const uword n_rows = A.n_rows; const uword n_cols = A.n_cols; arma_conform_check_bounds( ((row_offset > 0) && (row_offset >= n_rows)) || ((col_offset > 0) && (col_offset >= n_cols)), "trimatl(): requested diagonal is out of bounds" ); if(A.n_nonzero == 0) { out.zeros(n_rows, n_cols); return; } out.reserve(n_rows, n_cols, A.n_nonzero); // upper bound on n_nonzero uword count = 0; if(col_offset > 0) { typename SpMat::const_col_iterator it = A.begin_col_no_sync(0); typename SpMat::const_col_iterator it_end = A.end_col_no_sync(col_offset-1); for(; it != it_end; ++it) { const uword it_row = it.row(); const uword it_col = it.col(); access::rw(out.values[count]) = (*it); access::rw(out.row_indices[count]) = it_row; access::rw(out.col_ptrs[it_col + 1])++; ++count; } } const uword N = (std::min)(n_rows - row_offset, n_cols - col_offset); for(uword i=0; i < N; ++i) { const uword start_row = i + row_offset; const uword col = i + col_offset; typename SpMat::const_col_iterator it = A.begin_col_no_sync(col); typename SpMat::const_col_iterator it_end = A.end_col_no_sync(col); for(; it != it_end; ++it) { const uword it_row = it.row(); if(it_row >= start_row) { const uword it_col = it.col(); access::rw(out.values[count]) = (*it); access::rw(out.row_indices[count]) = it_row; access::rw(out.col_ptrs[it_col + 1])++; ++count; } } } for(uword i=0; i < n_cols; ++i) { access::rw(out.col_ptrs[i + 1]) += out.col_ptrs[i]; } if(count < A.n_nonzero) { out.mem_resize(count); } } template inline void spop_trimatl_ext::apply(SpMat& out, const SpOp& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const unwrap_spmat U(in.m); const SpMat& A = U.M; arma_conform_check( (A.is_square() == false), "trimatl(): given matrix must be square sized" ); const uword row_offset = in.aux_uword_a; const uword col_offset = in.aux_uword_b; if(U.is_alias(out)) { SpMat tmp; spop_trimatl_ext::apply_noalias(tmp, A, row_offset, col_offset); out.steal_mem(tmp); } else { spop_trimatl_ext::apply_noalias(out, A, row_offset, col_offset); } } //! @} RcppArmadillo/inst/include/armadillo_bits/operator_cube_div.hpp0000644000176200001440000001064414631567470024616 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup operator_cube_div //! @{ //! BaseCube / scalar template arma_inline const eOpCube operator/ ( const BaseCube& X, const typename T1::elem_type k ) { arma_debug_sigprint(); return eOpCube(X.get_ref(), k); } //! scalar / BaseCube template arma_inline const eOpCube operator/ ( const typename T1::elem_type k, const BaseCube& X ) { arma_debug_sigprint(); return eOpCube(X.get_ref(), k); } //! complex scalar / non-complex BaseCube (experimental) template arma_inline const mtOpCube, T1, op_cx_scalar_div_pre> operator/ ( const std::complex& k, const BaseCube& X ) { arma_debug_sigprint(); return mtOpCube, T1, op_cx_scalar_div_pre>('j', X.get_ref(), k); } //! non-complex BaseCube / complex scalar (experimental) template arma_inline const mtOpCube, T1, op_cx_scalar_div_post> operator/ ( const BaseCube& X, const std::complex& k ) { arma_debug_sigprint(); return mtOpCube, T1, op_cx_scalar_div_post>('j', X.get_ref(), k); } //! element-wise division of BaseCube objects with same element type template arma_inline const eGlueCube operator/ ( const BaseCube& X, const BaseCube& Y ) { arma_debug_sigprint(); return eGlueCube(X.get_ref(), Y.get_ref()); } //! element-wise division of BaseCube objects with different element types template inline const mtGlueCube::result, T1, T2, glue_mixed_div> operator/ ( const BaseCube< typename force_different_type::T1_result, T1>& X, const BaseCube< typename force_different_type::T2_result, T2>& Y ) { arma_debug_sigprint(); typedef typename T1::elem_type eT1; typedef typename T2::elem_type eT2; typedef typename promote_type::result out_eT; promote_type::check(); return mtGlueCube( X.get_ref(), Y.get_ref() ); } template arma_inline Cube operator/ ( const subview_cube_each1& X, const Base& Y ) { arma_debug_sigprint(); return subview_cube_each1_aux::operator_div(X, Y.get_ref()); } template arma_inline Cube operator/ ( const Base& X, const subview_cube_each1& Y ) { arma_debug_sigprint(); return subview_cube_each1_aux::operator_div(X.get_ref(), Y); } template arma_inline Cube operator/ ( const subview_cube_each2& X, const Base& Y ) { arma_debug_sigprint(); return subview_cube_each2_aux::operator_div(X, Y.get_ref()); } template arma_inline Cube operator/ ( const Base& X, const subview_cube_each2& Y ) { arma_debug_sigprint(); return subview_cube_each2_aux::operator_div(X.get_ref(), Y); } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_eigs_gen.hpp0000644000176200001440000002732014635324415023357 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_eigs_gen //! @{ //! eigenvalues of general sparse matrix X template arma_warn_unused inline typename enable_if2< is_real::value, Col< std::complex > >::result eigs_gen ( const SpBase& X, const uword n_eigvals, const char* form = "lm", const eigs_opts opts = eigs_opts() ) { arma_debug_sigprint(); typedef typename T1::pod_type T; Mat< std::complex > eigvec; Col< std::complex > eigval; sp_auxlib::form_type form_val = sp_auxlib::interpret_form_str(form); const bool status = sp_auxlib::eigs_gen(eigval, eigvec, X, n_eigvals, form_val, opts); if(status == false) { eigval.soft_reset(); arma_stop_runtime_error("eigs_gen(): decomposition failed"); } return eigval; } //! this form is deprecated; use eigs_gen(X, n_eigvals, form, opts) instead template arma_deprecated inline typename enable_if2< is_real::value, Col< std::complex > >::result eigs_gen ( const SpBase& X, const uword n_eigvals, const char* form, const typename T1::pod_type tol ) { arma_debug_sigprint(); eigs_opts opts; opts.tol = tol; return eigs_gen(X, n_eigvals, form, opts); } template arma_warn_unused inline typename enable_if2< is_real::value, Col< std::complex > >::result eigs_gen ( const SpBase& X, const uword n_eigvals, const std::complex sigma, const eigs_opts opts = eigs_opts() ) { arma_debug_sigprint(); typedef typename T1::pod_type T; Mat< std::complex > eigvec; Col< std::complex > eigval; bool status = false; // If X is real and sigma is truly complex, treat X as complex. // The reason is that we are still not able to apply truly complex shifts to real matrices if( (is_real::yes) && (std::imag(sigma) != T(0)) ) { status = sp_auxlib::eigs_gen(eigval, eigvec, conv_to< SpMat< std::complex > >::from(X), n_eigvals, sigma, opts); } else { status = sp_auxlib::eigs_gen(eigval, eigvec, X, n_eigvals, sigma, opts); } if(status == false) { eigval.soft_reset(); arma_stop_runtime_error("eigs_gen(): decomposition failed"); } return eigval; } template arma_warn_unused inline typename enable_if2< is_real::value, Col< std::complex > >::result eigs_gen ( const SpBase& X, const uword n_eigvals, const double sigma, const eigs_opts opts = eigs_opts() ) { arma_debug_sigprint(); typedef typename T1::pod_type T; Mat< std::complex > eigvec; Col< std::complex > eigval; const bool status = sp_auxlib::eigs_gen(eigval, eigvec, X, n_eigvals, std::complex(T(sigma)), opts); if(status == false) { eigval.soft_reset(); arma_stop_runtime_error("eigs_gen(): decomposition failed"); } return eigval; } //! eigenvalues of general sparse matrix X template inline typename enable_if2< is_real::value, bool >::result eigs_gen ( Col< std::complex >& eigval, const SpBase& X, const uword n_eigvals, const char* form = "lm", const eigs_opts opts = eigs_opts() ) { arma_debug_sigprint(); typedef typename T1::pod_type T; Mat< std::complex > eigvec; sp_auxlib::form_type form_val = sp_auxlib::interpret_form_str(form); const bool status = sp_auxlib::eigs_gen(eigval, eigvec, X, n_eigvals, form_val, opts); if(status == false) { eigval.soft_reset(); arma_warn(3, "eigs_gen(): decomposition failed"); } return status; } //! this form is deprecated; use eigs_gen(eigval, X, n_eigvals, form, opts) instead template arma_deprecated inline typename enable_if2< is_real::value, bool >::result eigs_gen ( Col< std::complex >& eigval, const SpBase& X, const uword n_eigvals, const char* form, const typename T1::pod_type tol ) { arma_debug_sigprint(); eigs_opts opts; opts.tol = tol; return eigs_gen(eigval, X, n_eigvals, form, opts); } template inline typename enable_if2< is_real::value, bool >::result eigs_gen ( Col< std::complex >& eigval, const SpBase& X, const uword n_eigvals, const std::complex sigma, const eigs_opts opts = eigs_opts() ) { arma_debug_sigprint(); typedef typename T1::pod_type T; Mat< std::complex > eigvec; bool status = false; // If X is real and sigma is truly complex, treat X as complex. // The reason is that we are still not able to apply truly complex shifts to real matrices if( (is_real::yes) && (std::imag(sigma) != T(0)) ) { status = sp_auxlib::eigs_gen(eigval, eigvec, conv_to< SpMat< std::complex > >::from(X), n_eigvals, sigma, opts); } else { status = sp_auxlib::eigs_gen(eigval, eigvec, X, n_eigvals, sigma, opts); } if(status == false) { eigval.soft_reset(); arma_warn(3, "eigs_gen(): decomposition failed"); } return status; } template inline typename enable_if2< is_real::value, bool >::result eigs_gen ( Col< std::complex >& eigval, const SpBase& X, const uword n_eigvals, const double sigma, const eigs_opts opts = eigs_opts() ) { arma_debug_sigprint(); typedef typename T1::pod_type T; Mat< std::complex > eigvec; const bool status = sp_auxlib::eigs_gen(eigval, eigvec, X, n_eigvals, std::complex(T(sigma)), opts); if(status == false) { eigval.soft_reset(); arma_warn(3, "eigs_gen(): decomposition failed"); } return status; } //! eigenvalues and eigenvectors of general sparse matrix X template inline typename enable_if2< is_real::value, bool >::result eigs_gen ( Col< std::complex >& eigval, Mat< std::complex >& eigvec, const SpBase& X, const uword n_eigvals, const char* form = "lm", const eigs_opts opts = eigs_opts() ) { arma_debug_sigprint(); // typedef typename T1::pod_type T; arma_conform_check( void_ptr(&eigval) == void_ptr(&eigvec), "eigs_gen(): parameter 'eigval' is an alias of parameter 'eigvec'" ); sp_auxlib::form_type form_val = sp_auxlib::interpret_form_str(form); const bool status = sp_auxlib::eigs_gen(eigval, eigvec, X, n_eigvals, form_val, opts); if(status == false) { eigval.soft_reset(); eigvec.soft_reset(); arma_warn(3, "eigs_gen(): decomposition failed"); } return status; } //! this form is deprecated; use eigs_gen(eigval, eigvec, X, n_eigvals, form, opts) instead template arma_deprecated inline typename enable_if2< is_real::value, bool >::result eigs_gen ( Col< std::complex >& eigval, Mat< std::complex >& eigvec, const SpBase& X, const uword n_eigvals, const char* form, const typename T1::pod_type tol ) { arma_debug_sigprint(); eigs_opts opts; opts.tol = tol; return eigs_gen(eigval, eigvec, X, n_eigvals, form, opts); } template inline typename enable_if2< is_real::value, bool >::result eigs_gen ( Col< std::complex >& eigval, Mat< std::complex >& eigvec, const SpBase& X, const uword n_eigvals, const std::complex sigma, const eigs_opts opts = eigs_opts() ) { arma_debug_sigprint(); typedef typename T1::pod_type T; arma_conform_check( void_ptr(&eigval) == void_ptr(&eigvec), "eigs_gen(): parameter 'eigval' is an alias of parameter 'eigvec'" ); bool status = false; // If X is real and sigma is truly complex, treat X as complex. // The reason is that we are still not able to apply truly complex shifts to real matrices if( (is_real::yes) && (std::imag(sigma) != T(0)) ) { status = sp_auxlib::eigs_gen(eigval, eigvec, conv_to< SpMat< std::complex > >::from(X), n_eigvals, sigma, opts); } else { status = sp_auxlib::eigs_gen(eigval, eigvec, X, n_eigvals, sigma, opts); } if(status == false) { eigval.soft_reset(); eigvec.soft_reset(); arma_warn(3, "eigs_gen(): decomposition failed"); } return status; } template inline typename enable_if2< is_real::value, bool >::result eigs_gen ( Col< std::complex >& eigval, Mat< std::complex >& eigvec, const SpBase& X, const uword n_eigvals, const double sigma, const eigs_opts opts = eigs_opts() ) { arma_debug_sigprint(); typedef typename T1::pod_type T; arma_conform_check( void_ptr(&eigval) == void_ptr(&eigvec), "eigs_gen(): parameter 'eigval' is an alias of parameter 'eigvec'" ); const bool status = sp_auxlib::eigs_gen(eigval, eigvec, X, n_eigvals, std::complex(T(sigma)), opts); if(status == false) { eigval.soft_reset(); eigvec.soft_reset(); arma_warn(3, "eigs_gen(): decomposition failed"); } return status; } //! @} RcppArmadillo/inst/include/armadillo_bits/op_cx_scalar_bones.hpp0000644000176200001440000000777614301267043024745 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_cx_scalar //! @{ class op_cx_scalar_times : public traits_op_passthru { public: template inline static void apply ( Mat< typename std::complex >& out, const mtOp, T1, op_cx_scalar_times>& X ); template inline static void apply ( Cube< typename std::complex >& out, const mtOpCube, T1, op_cx_scalar_times>& X ); }; class op_cx_scalar_plus : public traits_op_passthru { public: template inline static void apply ( Mat< typename std::complex >& out, const mtOp, T1, op_cx_scalar_plus>& X ); template inline static void apply ( Cube< typename std::complex >& out, const mtOpCube, T1, op_cx_scalar_plus>& X ); }; class op_cx_scalar_minus_pre : public traits_op_passthru { public: template inline static void apply ( Mat< typename std::complex >& out, const mtOp, T1, op_cx_scalar_minus_pre>& X ); template inline static void apply ( Cube< typename std::complex >& out, const mtOpCube, T1, op_cx_scalar_minus_pre>& X ); }; class op_cx_scalar_minus_post : public traits_op_passthru { public: template inline static void apply ( Mat< typename std::complex >& out, const mtOp, T1, op_cx_scalar_minus_post>& X ); template inline static void apply ( Cube< typename std::complex >& out, const mtOpCube, T1, op_cx_scalar_minus_post>& X ); }; class op_cx_scalar_div_pre : public traits_op_passthru { public: template inline static void apply ( Mat< typename std::complex >& out, const mtOp, T1, op_cx_scalar_div_pre>& X ); template inline static void apply ( Cube< typename std::complex >& out, const mtOpCube, T1, op_cx_scalar_div_pre>& X ); }; class op_cx_scalar_div_post : public traits_op_passthru { public: template inline static void apply ( Mat< typename std::complex >& out, const mtOp, T1, op_cx_scalar_div_post>& X ); template inline static void apply ( Cube< typename std::complex >& out, const mtOpCube, T1, op_cx_scalar_div_post>& X ); }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_col_as_mat_bones.hpp0000644000176200001440000000202714374704744025105 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_col_as_mat //! @{ class op_col_as_mat : public traits_op_default { public: template inline static void apply(Mat& out, const CubeToMatOp& expr); }; //! @} RcppArmadillo/inst/include/armadillo_bits/newarp_DoubleShiftQR_meat.hpp0000644000176200001440000002233614631567470026161 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ namespace newarp { template inline void DoubleShiftQR::compute_reflector(const eT& x1, const eT& x2, const eT& x3, uword ind) { arma_debug_sigprint(); // In general case the reflector affects 3 rows ref_nr(ind) = 3; eT x2x3 = eT(0); // If x3 is zero, decrease nr by 1 if(std::abs(x3) < prec) { // If x2 is also zero, nr will be 1, and we can exit this function if(std::abs(x2) < prec) { ref_nr(ind) = 1; return; } else { ref_nr(ind) = 2; } x2x3 = std::abs(x2); } else { x2x3 = arma_hypot(x2, x3); } // x1' = x1 - rho * ||x|| // rho = -sign(x1), if x1 == 0, we choose rho = 1 eT x1_new = x1 - ((x1 <= 0) - (x1 > 0)) * arma_hypot(x1, x2x3); eT x_norm = arma_hypot(x1_new, x2x3); // Double check the norm of new x if(x_norm < prec) { ref_nr(ind) = 1; return; } ref_u(0, ind) = x1_new / x_norm; ref_u(1, ind) = x2 / x_norm; ref_u(2, ind) = x3 / x_norm; } template arma_inline void DoubleShiftQR::compute_reflector(const eT* x, uword ind) { arma_debug_sigprint(); compute_reflector(x[0], x[1], x[2], ind); } template inline void DoubleShiftQR::update_block(uword il, uword iu) { arma_debug_sigprint(); // Block size uword bsize = iu - il + 1; // If block size == 1, there is no need to apply reflectors if(bsize == 1) { ref_nr(il) = 1; return; } // For block size == 2, do a Givens rotation on M = X * X - s * X + t * I if(bsize == 2) { // m00 = x00 * (x00 - s) + x01 * x10 + t eT m00 = mat_H(il, il) * (mat_H(il, il) - shift_s) + mat_H(il, il + 1) * mat_H(il + 1, il) + shift_t; // m10 = x10 * (x00 + x11 - s) eT m10 = mat_H(il + 1, il) * (mat_H(il, il) + mat_H(il + 1, il + 1) - shift_s); // This causes nr=2 compute_reflector(m00, m10, 0, il); // Apply the reflector to X apply_PX(mat_H, il, il, 2, n - il, il); apply_XP(mat_H, 0, il, il + 2, 2, il); ref_nr(il + 1) = 1; return; } // For block size >=3, use the regular strategy eT m00 = mat_H(il, il) * (mat_H(il, il) - shift_s) + mat_H(il, il + 1) * mat_H(il + 1, il) + shift_t; eT m10 = mat_H(il + 1, il) * (mat_H(il, il) + mat_H(il + 1, il + 1) - shift_s); // m20 = x21 * x10 eT m20 = mat_H(il + 2, il + 1) * mat_H(il + 1, il); compute_reflector(m00, m10, m20, il); // Apply the first reflector apply_PX(mat_H, il, il, 3, n - il, il); apply_XP(mat_H, 0, il, il + (std::min)(bsize, uword(4)), 3, il); // Calculate the following reflectors // If entering this loop, block size is at least 4. for(uword i = 1; i < bsize - 2; i++) { compute_reflector(mat_H.colptr(il + i - 1) + il + i, il + i); // Apply the reflector to X apply_PX(mat_H, il + i, il + i - 1, 3, n + 1 - il - i, il + i); apply_XP(mat_H, 0, il + i, il + (std::min)(bsize, uword(i + 4)), 3, il + i); } // The last reflector // This causes nr=2 compute_reflector(mat_H(iu - 1, iu - 2), mat_H(iu, iu - 2), 0, iu - 1); // Apply the reflector to X apply_PX(mat_H, iu - 1, iu - 2, 2, n + 2 - iu, iu - 1); apply_XP(mat_H, 0, iu - 1, il + bsize, 2, iu - 1); ref_nr(iu) = 1; } template inline void DoubleShiftQR::apply_PX(Mat& X, uword oi, uword oj, uword nrow, uword ncol, uword u_ind) { arma_debug_sigprint(); if(ref_nr(u_ind) == 1) { return; } // Householder reflectors at index u_ind Col u(ref_u.colptr(u_ind), 3, false); const uword stride = X.n_rows; const eT u0_2 = 2 * u(0); const eT u1_2 = 2 * u(1); eT* xptr = &X(oi, oj); if(ref_nr(u_ind) == 2 || nrow == 2) { for(uword i = 0; i < ncol; i++, xptr += stride) { eT tmp = u0_2 * xptr[0] + u1_2 * xptr[1]; xptr[0] -= tmp * u(0); xptr[1] -= tmp * u(1); } } else { const eT u2_2 = 2 * u(2); for(uword i = 0; i < ncol; i++, xptr += stride) { eT tmp = u0_2 * xptr[0] + u1_2 * xptr[1] + u2_2 * xptr[2]; xptr[0] -= tmp * u(0); xptr[1] -= tmp * u(1); xptr[2] -= tmp * u(2); } } } template inline void DoubleShiftQR::apply_PX(eT* x, uword u_ind) { arma_debug_sigprint(); if(ref_nr(u_ind) == 1) { return; } eT u0 = ref_u(0, u_ind), u1 = ref_u(1, u_ind), u2 = ref_u(2, u_ind); // When the reflector only contains two elements, u2 has been set to zero bool nr_is_2 = (ref_nr(u_ind) == 2); eT dot2 = x[0] * u0 + x[1] * u1 + (nr_is_2 ? 0 : (x[2] * u2)); dot2 *= 2; x[0] -= dot2 * u0; x[1] -= dot2 * u1; if(!nr_is_2) { x[2] -= dot2 * u2; } } template inline void DoubleShiftQR::apply_XP(Mat& X, uword oi, uword oj, uword nrow, uword ncol, uword u_ind) { arma_debug_sigprint(); if(ref_nr(u_ind) == 1) { return; } // Householder reflectors at index u_ind Col u(ref_u.colptr(u_ind), 3, false); uword stride = X.n_rows; const eT u0_2 = 2 * u(0); const eT u1_2 = 2 * u(1); eT* X0 = &X(oi, oj); eT* X1 = X0 + stride; // X0 => X(oi, oj), X1 => X(oi, oj + 1) if(ref_nr(u_ind) == 2 || ncol == 2) { // tmp = 2 * u0 * X0 + 2 * u1 * X1 // X0 => X0 - u0 * tmp // X1 => X1 - u1 * tmp for(uword i = 0; i < nrow; i++) { eT tmp = u0_2 * X0[i] + u1_2 * X1[i]; X0[i] -= tmp * u(0); X1[i] -= tmp * u(1); } } else { eT* X2 = X1 + stride; // X2 => X(oi, oj + 2) const eT u2_2 = 2 * u(2); for(uword i = 0; i < nrow; i++) { eT tmp = u0_2 * X0[i] + u1_2 * X1[i] + u2_2 * X2[i]; X0[i] -= tmp * u(0); X1[i] -= tmp * u(1); X2[i] -= tmp * u(2); } } } template inline DoubleShiftQR::DoubleShiftQR(uword size) : n(size) , prec(std::numeric_limits::epsilon()) , eps_rel(prec) , eps_abs(prec) , computed(false) { arma_debug_sigprint(); } template inline DoubleShiftQR::DoubleShiftQR(const Mat& mat_obj, eT s, eT t) : n(mat_obj.n_rows) , mat_H(n, n) , shift_s(s) , shift_t(t) , ref_u(3, n) , ref_nr(n) , prec(std::numeric_limits::epsilon()) , eps_rel(prec) , eps_abs(prec) , computed(false) { arma_debug_sigprint(); compute(mat_obj, s, t); } template void DoubleShiftQR::compute(const Mat& mat_obj, eT s, eT t) { arma_debug_sigprint(); arma_conform_check( (mat_obj.is_square() == false), "newarp::DoubleShiftQR::compute(): matrix must be square" ); n = mat_obj.n_rows; mat_H.set_size(n, n); shift_s = s; shift_t = t; ref_u.set_size(3, n); ref_nr.set_size(n); // Make a copy of mat_obj mat_H = mat_obj; // Obtain the indices of zero elements in the subdiagonal, // so that H can be divided into several blocks std::vector zero_ind; zero_ind.reserve(n - 1); zero_ind.push_back(0); eT* Hii = mat_H.memptr(); for(uword i = 0; i < n - 2; i++, Hii += (n + 1)) { // Hii[1] => mat_H(i + 1, i) const eT h = std::abs(Hii[1]); if(h <= eps_abs || h <= eps_rel * (std::abs(Hii[0]) + std::abs(Hii[n + 1]))) { Hii[1] = 0; zero_ind.push_back(i + 1); } // Make sure mat_H is upper Hessenberg // Zero the elements below mat_H(i + 1, i) std::fill(Hii + 2, Hii + n - i, eT(0)); } zero_ind.push_back(n); for(std::vector::size_type i = 0; i < zero_ind.size() - 1; i++) { uword start = zero_ind[i]; uword end = zero_ind[i + 1] - 1; // Compute refelctors from each block X update_block(start, end); } computed = true; } template Mat DoubleShiftQR::matrix_QtHQ() { arma_debug_sigprint(); arma_conform_check( (computed == false), "newarp::DoubleShiftQR::matrix_QtHQ(): need to call compute() first" ); return mat_H; } template inline void DoubleShiftQR::apply_QtY(Col& y) { arma_debug_sigprint(); arma_conform_check( (computed == false), "newarp::DoubleShiftQR::apply_QtY(): need to call compute() first" ); eT* y_ptr = y.memptr(); for(uword i = 0; i < n - 1; i++, y_ptr++) { apply_PX(y_ptr, i); } } template inline void DoubleShiftQR::apply_YQ(Mat& Y) { arma_debug_sigprint(); arma_conform_check( (computed == false), "newarp::DoubleShiftQR::apply_YQ(): need to call compute() first" ); uword nrow = Y.n_rows; for(uword i = 0; i < n - 2; i++) { apply_XP(Y, 0, i, nrow, 3, i); } apply_XP(Y, 0, n - 2, nrow, 2, n - 2); } } // namespace newarp RcppArmadillo/inst/include/armadillo_bits/glue_affmul_bones.hpp0000644000176200001440000000340614301267043024560 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup glue_affmul //! @{ class glue_affmul { public: template struct traits { static constexpr bool is_row = T1::is_row; static constexpr bool is_col = T2::is_col; static constexpr bool is_xvec = false; }; template inline static void apply(Mat& out, const Glue& X); template inline static void apply_noalias(Mat& out, const T1& A, const T2& B); template inline static void apply_noalias_square(Mat& out, const T1& A, const T2& B); template inline static void apply_noalias_rectangle(Mat& out, const T1& A, const T2& B); template inline static void apply_noalias_generic(Mat& out, const T1& A, const T2& B); }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_sort_index_bones.hpp0000644000176200001440000000507015030507611025143 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_sort_index //! @{ class op_sort_index : public traits_op_col { public: template static inline bool apply_helper(Mat& out, const Proxy& P, const uword sort_mode); template static inline void apply(Mat& out, const mtOp& in); }; template struct arma_sort_index_packet { eT val; uword index; }; template struct arma_sort_index_helper_ascend { arma_inline bool operator() (const arma_sort_index_packet& A, const arma_sort_index_packet& B) const { return (A.val < B.val); } }; template struct arma_sort_index_helper_descend { arma_inline bool operator() (const arma_sort_index_packet& A, const arma_sort_index_packet& B) const { return (A.val > B.val); } }; template struct arma_sort_index_helper_ascend< std::complex > { typedef typename std::complex eT; inline bool operator() (const arma_sort_index_packet& A, const arma_sort_index_packet& B) const { return (std::abs(A.val) < std::abs(B.val)); } }; template struct arma_sort_index_helper_descend< std::complex > { typedef typename std::complex eT; inline bool operator() (const arma_sort_index_packet& A, const arma_sort_index_packet& B) const { return (std::abs(A.val) > std::abs(B.val)); } }; // template struct arma_sort_index_helper_prepare { arma_inline eT operator() (const eT val) const { return val; } }; template struct arma_sort_index_helper_prepare< std::complex > { arma_inline T operator() (const std::complex& val) const { return std::abs(val); } }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_toeplitz_bones.hpp0000644000176200001440000000231014301267043024633 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_toeplitz //! @{ class op_toeplitz : public traits_op_default { public: template inline static void apply(Mat& out, const Op& in); }; class op_toeplitz_c : public traits_op_default { public: template inline static void apply(Mat& out, const Op& in); }; //! @} RcppArmadillo/inst/include/armadillo_bits/gmm_full_bones.hpp0000644000176200001440000001562114301267043024076 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup gmm_full //! @{ namespace gmm_priv { template class gmm_full { public: arma_aligned const Mat means; arma_aligned const Cube fcovs; arma_aligned const Row hefts; // // inline ~gmm_full(); inline gmm_full(); inline gmm_full(const gmm_full& x); inline gmm_full& operator=(const gmm_full& x); inline explicit gmm_full(const gmm_diag& x); inline gmm_full& operator=(const gmm_diag& x); inline gmm_full(const uword in_n_dims, const uword in_n_gaus); inline void reset(const uword in_n_dims, const uword in_n_gaus); inline void reset(); template inline void set_params(const Base& in_means, const BaseCube& in_fcovs, const Base& in_hefts); template inline void set_means(const Base & in_means); template inline void set_fcovs(const BaseCube& in_fcovs); template inline void set_hefts(const Base & in_hefts); inline uword n_dims() const; inline uword n_gaus() const; inline bool load(const std::string name); inline bool save(const std::string name) const; inline Col generate() const; inline Mat generate(const uword N) const; template inline eT log_p(const T1& expr, const gmm_empty_arg& junk1 = gmm_empty_arg(), typename enable_if<((is_arma_type::value) && (resolves_to_colvector::value == true ))>::result* junk2 = nullptr) const; template inline eT log_p(const T1& expr, const uword gaus_id, typename enable_if<((is_arma_type::value) && (resolves_to_colvector::value == true ))>::result* junk2 = nullptr) const; template inline Row log_p(const T1& expr, const gmm_empty_arg& junk1 = gmm_empty_arg(), typename enable_if<((is_arma_type::value) && (resolves_to_colvector::value == false))>::result* junk2 = nullptr) const; template inline Row log_p(const T1& expr, const uword gaus_id, typename enable_if<((is_arma_type::value) && (resolves_to_colvector::value == false))>::result* junk2 = nullptr) const; template inline eT sum_log_p(const Base& expr) const; template inline eT sum_log_p(const Base& expr, const uword gaus_id) const; template inline eT avg_log_p(const Base& expr) const; template inline eT avg_log_p(const Base& expr, const uword gaus_id) const; template inline uword assign(const T1& expr, const gmm_dist_mode& dist, typename enable_if<((is_arma_type::value) && (resolves_to_colvector::value == true ))>::result* junk = nullptr) const; template inline urowvec assign(const T1& expr, const gmm_dist_mode& dist, typename enable_if<((is_arma_type::value) && (resolves_to_colvector::value == false))>::result* junk = nullptr) const; template inline urowvec raw_hist(const Base& expr, const gmm_dist_mode& dist_mode) const; template inline Row norm_hist(const Base& expr, const gmm_dist_mode& dist_mode) const; template inline bool learn ( const Base& data, const uword n_gaus, const gmm_dist_mode& dist_mode, const gmm_seed_mode& seed_mode, const uword km_iter, const uword em_iter, const eT var_floor, const bool print_mode ); // protected: arma_aligned Cube inv_fcovs; arma_aligned Row log_det_etc; arma_aligned Row log_hefts; arma_aligned Col mah_aux; arma_aligned Cube chol_fcovs; // inline void init(const gmm_full& x); inline void init(const gmm_diag& x); inline void init(const uword in_n_dim, const uword in_n_gaus); inline void init_constants(const bool calc_chol = true); inline umat internal_gen_boundaries(const uword N) const; inline eT internal_scalar_log_p(const eT* x ) const; inline eT internal_scalar_log_p(const eT* x, const uword gaus_id) const; inline Row internal_vec_log_p(const Mat& X ) const; inline Row internal_vec_log_p(const Mat& X, const uword gaus_id) const; inline eT internal_sum_log_p(const Mat& X ) const; inline eT internal_sum_log_p(const Mat& X, const uword gaus_id) const; inline eT internal_avg_log_p(const Mat& X ) const; inline eT internal_avg_log_p(const Mat& X, const uword gaus_id) const; inline uword internal_scalar_assign(const Mat& X, const gmm_dist_mode& dist_mode) const; inline void internal_vec_assign(urowvec& out, const Mat& X, const gmm_dist_mode& dist_mode) const; inline void internal_raw_hist(urowvec& hist, const Mat& X, const gmm_dist_mode& dist_mode) const; // template inline void generate_initial_means(const Mat& X, const gmm_seed_mode& seed); template inline void generate_initial_params(const Mat& X, const eT var_floor); template inline bool km_iterate(const Mat& X, const uword max_iter, const bool verbose); // inline bool em_iterate(const Mat& X, const uword max_iter, const eT var_floor, const bool verbose); inline void em_update_params(const Mat& X, const umat& boundaries, field< Mat >& t_acc_means, field< Cube >& t_acc_fcovs, field< Col >& t_acc_norm_lhoods, field< Col >& t_gaus_log_lhoods, Col& t_progress_log_lhoods, const eT var_floor); inline void em_generate_acc(const Mat& X, const uword start_index, const uword end_index, Mat& acc_means, Cube& acc_fcovs, Col& acc_norm_lhoods, Col& gaus_log_lhoods, eT& progress_log_lhood) const; inline void em_fix_params(const eT var_floor); }; } typedef gmm_priv::gmm_full gmm_full; typedef gmm_priv::gmm_full fgmm_full; //! @} RcppArmadillo/inst/include/armadillo_bits/fn_roots.hpp0000644000176200001440000000321514635324415022742 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_roots //! @{ template arma_warn_unused inline typename enable_if2 < is_supported_blas_type::value, const mtOp, T1, op_roots> >::result roots(const Base& X) { arma_debug_sigprint(); return mtOp, T1, op_roots>(X.get_ref()); } template inline typename enable_if2 < is_supported_blas_type::value, bool >::result roots(Mat< std::complex >& out, const Base& X) { arma_debug_sigprint(); const bool status = op_roots::apply_direct(out, X.get_ref()); if(status == false) { out.soft_reset(); arma_warn(3, "roots(): eigen decomposition failed"); } return status; } //! @} RcppArmadillo/inst/include/armadillo_bits/SizeMat_bones.hpp0000644000176200001440000000276214301267043023652 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup SizeMat //! @{ class SizeMat { public: const uword n_rows; const uword n_cols; inline explicit SizeMat(const uword in_n_rows, const uword in_n_cols); inline uword operator[](const uword dim) const; inline uword operator()(const uword dim) const; inline bool operator==(const SizeMat& s) const; inline bool operator!=(const SizeMat& s) const; inline SizeMat operator+(const SizeMat& s) const; inline SizeMat operator-(const SizeMat& s) const; inline SizeMat operator+(const uword val) const; inline SizeMat operator-(const uword val) const; inline SizeMat operator*(const uword val) const; inline SizeMat operator/(const uword val) const; }; //! @} RcppArmadillo/inst/include/armadillo_bits/spop_htrans_meat.hpp0000644000176200001440000000307414631567470024470 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup spop_htrans //! @{ template inline void spop_htrans::apply(SpMat& out, const SpOp& in, const typename arma_not_cx::result* junk) { arma_debug_sigprint(); arma_ignore(junk); spop_strans::apply(out, in); } template inline void spop_htrans::apply(SpMat& out, const SpOp& in, const typename arma_cx_only::result* junk) { arma_debug_sigprint(); arma_ignore(junk); typedef typename T1::elem_type eT; spop_strans::apply(out, in); const uword N = out.n_nonzero; for(uword i=0; i inline uword op_find::helper ( Mat& indices, const Base& X ) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const Proxy A(X.get_ref()); const uword n_elem = A.get_n_elem(); indices.set_size(n_elem, 1); uword* indices_mem = indices.memptr(); uword n_nz = 0; if(Proxy::use_at == false) { typename Proxy::ea_type PA = A.get_ea(); for(uword i=0; i inline uword op_find::helper ( Mat& indices, const mtOp& X, const typename arma_op_rel_only::result* junk1, const typename arma_not_cx::result* junk2 ) { arma_debug_sigprint(); arma_ignore(junk1); arma_ignore(junk2); typedef typename T1::elem_type eT; const eT val = X.aux; if((is_same_type::yes || is_same_type::yes) && arma_config::check_conform && arma_isnan(val)) { arma_warn(1, "find(): NaN is not equal to anything; suggest to use find_nonfinite() instead"); } const Proxy A(X.m); const uword n_elem = A.get_n_elem(); indices.set_size(n_elem, 1); uword* indices_mem = indices.memptr(); uword n_nz = 0; if(Proxy::use_at == false) { typename Proxy::ea_type PA = A.get_ea(); uword i,j; for(i=0, j=1; j < n_elem; i+=2, j+=2) { const eT tpi = PA[i]; const eT tpj = PA[j]; bool not_zero_i; bool not_zero_j; if(is_same_type::yes) { not_zero_i = (val < tpi); } else if(is_same_type::yes) { not_zero_i = (tpi < val); } else if(is_same_type::yes) { not_zero_i = (val > tpi); } else if(is_same_type::yes) { not_zero_i = (tpi > val); } else if(is_same_type::yes) { not_zero_i = (val <= tpi); } else if(is_same_type::yes) { not_zero_i = (tpi <= val); } else if(is_same_type::yes) { not_zero_i = (val >= tpi); } else if(is_same_type::yes) { not_zero_i = (tpi >= val); } else if(is_same_type::yes) { not_zero_i = (tpi == val); } else if(is_same_type::yes) { not_zero_i = (tpi != val); } else { not_zero_i = false; } if(is_same_type::yes) { not_zero_j = (val < tpj); } else if(is_same_type::yes) { not_zero_j = (tpj < val); } else if(is_same_type::yes) { not_zero_j = (val > tpj); } else if(is_same_type::yes) { not_zero_j = (tpj > val); } else if(is_same_type::yes) { not_zero_j = (val <= tpj); } else if(is_same_type::yes) { not_zero_j = (tpj <= val); } else if(is_same_type::yes) { not_zero_j = (val >= tpj); } else if(is_same_type::yes) { not_zero_j = (tpj >= val); } else if(is_same_type::yes) { not_zero_j = (tpj == val); } else if(is_same_type::yes) { not_zero_j = (tpj != val); } else { not_zero_j = false; } if(not_zero_i) { indices_mem[n_nz] = i; ++n_nz; } if(not_zero_j) { indices_mem[n_nz] = j; ++n_nz; } } if(i < n_elem) { bool not_zero; const eT tmp = PA[i]; if(is_same_type::yes) { not_zero = (val < tmp); } else if(is_same_type::yes) { not_zero = (tmp < val); } else if(is_same_type::yes) { not_zero = (val > tmp); } else if(is_same_type::yes) { not_zero = (tmp > val); } else if(is_same_type::yes) { not_zero = (val <= tmp); } else if(is_same_type::yes) { not_zero = (tmp <= val); } else if(is_same_type::yes) { not_zero = (val >= tmp); } else if(is_same_type::yes) { not_zero = (tmp >= val); } else if(is_same_type::yes) { not_zero = (tmp == val); } else if(is_same_type::yes) { not_zero = (tmp != val); } else { not_zero = false; } if(not_zero) { indices_mem[n_nz] = i; ++n_nz; } } } else { const uword n_rows = A.get_n_rows(); const uword n_cols = A.get_n_cols(); uword i = 0; for(uword col=0; col < n_cols; ++col) for(uword row=0; row < n_rows; ++row) { const eT tmp = A.at(row,col); bool not_zero; if(is_same_type::yes) { not_zero = (val < tmp); } else if(is_same_type::yes) { not_zero = (tmp < val); } else if(is_same_type::yes) { not_zero = (val > tmp); } else if(is_same_type::yes) { not_zero = (tmp > val); } else if(is_same_type::yes) { not_zero = (val <= tmp); } else if(is_same_type::yes) { not_zero = (tmp <= val); } else if(is_same_type::yes) { not_zero = (val >= tmp); } else if(is_same_type::yes) { not_zero = (tmp >= val); } else if(is_same_type::yes) { not_zero = (tmp == val); } else if(is_same_type::yes) { not_zero = (tmp != val); } else { not_zero = false; } if(not_zero) { indices_mem[n_nz] = i; ++n_nz; } ++i; } } return n_nz; } template inline uword op_find::helper ( Mat& indices, const mtOp& X, const typename arma_op_rel_only::result* junk1, const typename arma_cx_only::result* junk2 ) { arma_debug_sigprint(); arma_ignore(junk1); arma_ignore(junk2); typedef typename T1::elem_type eT; typedef typename Proxy::ea_type ea_type; const eT val = X.aux; if((is_same_type::yes || is_same_type::yes) && arma_config::check_conform && arma_isnan(val)) { arma_warn(1, "find(): NaN is not equal to anything; suggest to use find_nonfinite() instead"); } const Proxy A(X.m); const uword n_elem = A.get_n_elem(); indices.set_size(n_elem, 1); uword* indices_mem = indices.memptr(); uword n_nz = 0; if(Proxy::use_at == false) { ea_type PA = A.get_ea(); for(uword i=0; i::yes) { not_zero = (tmp == val); } else if(is_same_type::yes) { not_zero = (tmp != val); } else { not_zero = false; } if(not_zero) { indices_mem[n_nz] = i; ++n_nz; } } } else { const uword n_rows = A.get_n_rows(); const uword n_cols = A.get_n_cols(); uword i = 0; for(uword col=0; col::yes) { not_zero = (tmp == val); } else if(is_same_type::yes) { not_zero = (tmp != val); } else { not_zero = false; } if(not_zero) { indices_mem[n_nz] = i; ++n_nz; } i++; } } return n_nz; } template inline uword op_find::helper ( Mat& indices, const mtGlue& X, const typename arma_glue_rel_only::result* junk1, const typename arma_not_cx::result* junk2, const typename arma_not_cx::result* junk3 ) { arma_debug_sigprint(); arma_ignore(junk1); arma_ignore(junk2); arma_ignore(junk3); typedef typename T1::elem_type eT1; typedef typename T2::elem_type eT2; typedef typename Proxy::ea_type ea_type1; typedef typename Proxy::ea_type ea_type2; const Proxy A(X.A); const Proxy B(X.B); arma_conform_assert_same_size(A, B, "relational operator"); const uword n_elem = A.get_n_elem(); indices.set_size(n_elem, 1); uword* indices_mem = indices.memptr(); uword n_nz = 0; if((Proxy::use_at == false) && (Proxy::use_at == false)) { ea_type1 PA = A.get_ea(); ea_type2 PB = B.get_ea(); for(uword i=0; i::yes) { not_zero = (tmp1 < tmp2); } else if(is_same_type::yes) { not_zero = (tmp1 > tmp2); } else if(is_same_type::yes) { not_zero = (tmp1 <= tmp2); } else if(is_same_type::yes) { not_zero = (tmp1 >= tmp2); } else if(is_same_type::yes) { not_zero = (tmp1 == tmp2); } else if(is_same_type::yes) { not_zero = (tmp1 != tmp2); } else if(is_same_type::yes) { not_zero = (tmp1 && tmp2); } else if(is_same_type::yes) { not_zero = (tmp1 || tmp2); } else { not_zero = false; } if(not_zero) { indices_mem[n_nz] = i; ++n_nz; } } } else { const uword n_rows = A.get_n_rows(); const uword n_cols = A.get_n_cols(); uword i = 0; for(uword col=0; col < n_cols; ++col) for(uword row=0; row < n_rows; ++row) { const eT1 tmp1 = A.at(row,col); const eT2 tmp2 = B.at(row,col); bool not_zero; if(is_same_type::yes) { not_zero = (tmp1 < tmp2); } else if(is_same_type::yes) { not_zero = (tmp1 > tmp2); } else if(is_same_type::yes) { not_zero = (tmp1 <= tmp2); } else if(is_same_type::yes) { not_zero = (tmp1 >= tmp2); } else if(is_same_type::yes) { not_zero = (tmp1 == tmp2); } else if(is_same_type::yes) { not_zero = (tmp1 != tmp2); } else if(is_same_type::yes) { not_zero = (tmp1 && tmp2); } else if(is_same_type::yes) { not_zero = (tmp1 || tmp2); } else { not_zero = false; } if(not_zero) { indices_mem[n_nz] = i; ++n_nz; } i++; } } return n_nz; } template inline uword op_find::helper ( Mat& indices, const mtGlue& X, const typename arma_glue_rel_only::result* junk1, const typename arma_cx_only::result* junk2, const typename arma_cx_only::result* junk3 ) { arma_debug_sigprint(); arma_ignore(junk1); arma_ignore(junk2); arma_ignore(junk3); typedef typename Proxy::ea_type ea_type1; typedef typename Proxy::ea_type ea_type2; const Proxy A(X.A); const Proxy B(X.B); arma_conform_assert_same_size(A, B, "relational operator"); const uword n_elem = A.get_n_elem(); indices.set_size(n_elem, 1); uword* indices_mem = indices.memptr(); uword n_nz = 0; if((Proxy::use_at == false) && (Proxy::use_at == false)) { ea_type1 PA = A.get_ea(); ea_type2 PB = B.get_ea(); for(uword i=0; i::yes) { not_zero = (PA[i] == PB[i]); } else if(is_same_type::yes) { not_zero = (PA[i] != PB[i]); } else { not_zero = false; } if(not_zero) { indices_mem[n_nz] = i; ++n_nz; } } } else { const uword n_rows = A.get_n_rows(); const uword n_cols = A.get_n_cols(); uword i = 0; for(uword col=0; col::yes) { not_zero = (A.at(row,col) == B.at(row,col)); } else if(is_same_type::yes) { not_zero = (A.at(row,col) != B.at(row,col)); } else { not_zero = false; } if(not_zero) { indices_mem[n_nz] = i; ++n_nz; } i++; } } return n_nz; } template inline void op_find::apply(Mat& out, const mtOp& X) { arma_debug_sigprint(); const uword k = X.aux_uword_a; const uword type = X.aux_uword_b; Mat indices; const uword n_nz = op_find::helper(indices, X.m); if(n_nz > 0) { if(type == 0) // "first" { out = (k > 0 && k <= n_nz) ? indices.rows(0, k-1 ) : indices.rows(0, n_nz-1); } else // "last" { out = (k > 0 && k <= n_nz) ? indices.rows(n_nz-k, n_nz-1) : indices.rows(0, n_nz-1); } } else { out.set_size(0,1); // empty column vector } } // template inline void op_find_simple::apply(Mat& out, const mtOp& X) { arma_debug_sigprint(); Mat indices; const uword n_nz = op_find::helper(indices, X.m); out.steal_mem_col(indices, n_nz); } // template inline void op_find_finite::apply(Mat& out, const mtOp& X) { arma_debug_sigprint(); if(arma_config::fast_math_warn) { arma_warn(1, "find_finite(): detection of non-finite values is not reliable in fast math mode"); } const Proxy P(X.m); const uword n_elem = P.get_n_elem(); Mat indices(n_elem, 1, arma_nozeros_indicator()); uword* indices_mem = indices.memptr(); uword count = 0; if(Proxy::use_at == false) { const typename Proxy::ea_type Pea = P.get_ea(); for(uword i=0; i inline void op_find_nonfinite::apply(Mat& out, const mtOp& X) { arma_debug_sigprint(); if(arma_config::fast_math_warn) { arma_warn(1, "find_nonfinite(): detection of non-finite values is not reliable in fast math mode"); } const Proxy P(X.m); const uword n_elem = P.get_n_elem(); Mat indices(n_elem, 1, arma_nozeros_indicator()); uword* indices_mem = indices.memptr(); uword count = 0; if(Proxy::use_at == false) { const typename Proxy::ea_type Pea = P.get_ea(); for(uword i=0; i inline void op_find_nan::apply(Mat& out, const mtOp& X) { arma_debug_sigprint(); if(arma_config::fast_math_warn) { arma_warn(1, "find_nan(): detection of non-finite values is not reliable in fast math mode"); } const Proxy P(X.m); const uword n_elem = P.get_n_elem(); Mat indices(n_elem, 1, arma_nozeros_indicator()); uword* indices_mem = indices.memptr(); uword count = 0; if(Proxy::use_at == false) { const typename Proxy::ea_type Pea = P.get_ea(); for(uword i=0; i inline void op_find_nonnan::apply(Mat& out, const mtOp& X) { arma_debug_sigprint(); if(arma_config::fast_math_warn) { arma_warn(1, "find_nonnan(): detection of non-finite values is not reliable in fast math mode"); } const Proxy P(X.m); const uword n_elem = P.get_n_elem(); Mat indices(n_elem, 1, arma_nozeros_indicator()); uword* indices_mem = indices.memptr(); uword count = 0; if(Proxy::use_at == false) { const typename Proxy::ea_type Pea = P.get_ea(); for(uword i=0; i < n_elem; ++i) { if( arma_isnan(Pea[i]) == false ) { indices_mem[count] = i; ++count; } } } else { const uword n_rows = P.get_n_rows(); const uword n_cols = P.get_n_cols(); uword i = 0; for(uword col=0; col < n_cols; ++col) for(uword row=0; row < n_rows; ++row) { if( arma_isnan(P.at(row,col)) == false ) { indices_mem[count] = i; ++count; } ++i; } } out.steal_mem_col(indices, count); } //! @} RcppArmadillo/inst/include/armadillo_bits/op_sp_diagvec_bones.hpp0000644000176200001440000000205514634016465025104 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_sp_diagvec //! @{ class op_sp_diagvec : public traits_op_col { public: template inline static void apply(Mat& out, const mtSpReduceOp& in); }; //! @} RcppArmadillo/inst/include/armadillo_bits/fn_wishrnd.hpp0000644000176200001440000001063114635324415023252 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_wishrnd //! @{ template arma_warn_unused inline typename enable_if2 < is_real::value, const Op >::result wishrnd(const Base& S, typename T1::elem_type df) { arma_debug_sigprint(); return Op(S.get_ref(), df, uword(1), uword(0)); } template arma_warn_unused inline typename enable_if2 < is_real::value, const Op >::result wishrnd(const Base& S, typename T1::elem_type df, const Base& D) { arma_debug_sigprint(); arma_ignore(S); return Op(D.get_ref(), df, uword(2), uword(0)); } template inline typename enable_if2 < is_real::value, bool >::result wishrnd(Mat& W, const Base& S, typename T1::elem_type df) { arma_debug_sigprint(); const bool status = op_wishrnd::apply_direct(W, S.get_ref(), df, uword(1)); if(status == false) { W.soft_reset(); arma_warn(3, "wishrnd(): given matrix is not symmetric positive definite"); } return status; } template inline typename enable_if2 < is_real::value, bool >::result wishrnd(Mat& W, const Base& S, typename T1::elem_type df, const Base& D) { arma_debug_sigprint(); arma_ignore(S); const bool status = op_wishrnd::apply_direct(W, D.get_ref(), df, uword(2)); if(status == false) { W.soft_reset(); arma_warn(3, "wishrnd(): problem with given 'D' matrix"); } return status; } // template arma_warn_unused inline typename enable_if2 < is_real::value, const Op >::result iwishrnd(const Base& T, typename T1::elem_type df) { arma_debug_sigprint(); return Op(T.get_ref(), df, uword(1), uword(0)); } template arma_warn_unused inline typename enable_if2 < is_real::value, const Op >::result iwishrnd(const Base& T, typename T1::elem_type df, const Base& Dinv) { arma_debug_sigprint(); arma_ignore(T); return Op(Dinv.get_ref(), df, uword(2), uword(0)); } template inline typename enable_if2 < is_real::value, bool >::result iwishrnd(Mat& W, const Base& T, typename T1::elem_type df) { arma_debug_sigprint(); const bool status = op_iwishrnd::apply_direct(W, T.get_ref(), df, uword(1)); if(status == false) { W.soft_reset(); arma_warn(3, "iwishrnd(): given matrix is not symmetric positive definite and/or df is too low"); } return status; } template inline typename enable_if2 < is_real::value, bool >::result iwishrnd(Mat& W, const Base& T, typename T1::elem_type df, const Base& Dinv) { arma_debug_sigprint(); arma_ignore(T); const bool status = op_iwishrnd::apply_direct(W, Dinv.get_ref(), df, uword(2)); if(status == false) { W.soft_reset(); arma_warn(3, "wishrnd(): problem with given 'Dinv' matrix and/or df is too low"); } return status; } //! @} RcppArmadillo/inst/include/armadillo_bits/newarp_SparseGenMatProd_meat.hpp0000644000176200001440000000312214631567470026654 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ namespace newarp { template inline SparseGenMatProd::SparseGenMatProd(const SpMat& mat_obj) : op_mat(mat_obj) , n_rows(mat_obj.n_rows) , n_cols(mat_obj.n_cols) { arma_debug_sigprint(); op_mat_st = op_mat.st(); // pre-calculate transpose } // Perform the matrix-vector multiplication operation \f$y=Ax\f$. // y_out = A * x_in template inline void SparseGenMatProd::perform_op(eT* x_in, eT* y_out) const { arma_debug_sigprint(); // // OLD METHOD // // const Col x(x_in , n_cols, false, true); // Col y(y_out, n_rows, false, true); // // y = op_mat * x; // NEW METHOD const Row x(x_in , n_cols, false, true); Row y(y_out, n_rows, false, true); y = x * op_mat_st; } } // namespace newarp RcppArmadillo/inst/include/armadillo_bits/spglue_kron_bones.hpp0000644000176200001440000000254714301267044024630 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup spglue_kron //! @{ class spglue_kron { public: template struct traits { static constexpr bool is_row = (T1::is_row && T2::is_row); static constexpr bool is_col = (T1::is_col && T2::is_col); static constexpr bool is_xvec = false; }; template inline static void apply(SpMat& out, const SpGlue& X); template inline static void apply_noalias(SpMat& out, const SpMat& A, const SpMat& B); }; //! @} RcppArmadillo/inst/include/armadillo_bits/strip.hpp0000644000176200001440000000752514631567470022270 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup strip //! @{ template struct strip_diagmat { typedef T1 stored_type; inline strip_diagmat(const T1& X) : M(X) { arma_debug_sigprint(); } static constexpr bool do_diagmat = false; const T1& M; }; template struct strip_diagmat< Op > { typedef T1 stored_type; inline strip_diagmat(const Op& X) : M(X.m) { arma_debug_sigprint(); } static constexpr bool do_diagmat = true; const T1& M; }; template struct strip_inv { typedef T1 stored_type; inline strip_inv(const T1& X) : M(X) { arma_debug_sigprint(); } const T1& M; static constexpr bool do_inv_gen = false; static constexpr bool do_inv_spd = false; }; template struct strip_inv< Op > { typedef T1 stored_type; inline strip_inv(const Op& X) : M(X.m) { arma_debug_sigprint(); } const T1& M; static constexpr bool do_inv_gen = true; static constexpr bool do_inv_spd = false; }; template struct strip_inv< Op > { typedef T1 stored_type; inline strip_inv(const Op& X) : M(X.m) { arma_debug_sigprint(); } const T1& M; static constexpr bool do_inv_gen = false; static constexpr bool do_inv_spd = true; }; template struct strip_trimat { typedef T1 stored_type; const T1& M; static constexpr bool do_trimat = false; static constexpr bool do_triu = false; static constexpr bool do_tril = false; inline strip_trimat(const T1& X) : M(X) { arma_debug_sigprint(); } }; template struct strip_trimat< Op > { typedef T1 stored_type; const T1& M; static constexpr bool do_trimat = true; const bool do_triu; const bool do_tril; inline strip_trimat(const Op& X) : M(X.m) , do_triu(X.aux_uword_a == 0) , do_tril(X.aux_uword_a == 1) { arma_debug_sigprint(); } }; // template struct sp_strip_trans { typedef T1 stored_type; inline sp_strip_trans(const T1& X) : M(X) { arma_debug_sigprint(); } static constexpr bool do_htrans = false; static constexpr bool do_strans = false; const T1& M; }; template struct sp_strip_trans< SpOp > { typedef T1 stored_type; inline sp_strip_trans(const SpOp& X) : M(X.m) { arma_debug_sigprint(); } static constexpr bool do_htrans = true; static constexpr bool do_strans = false; const T1& M; }; template struct sp_strip_trans< SpOp > { typedef T1 stored_type; inline sp_strip_trans(const SpOp& X) : M(X.m) { arma_debug_sigprint(); } static constexpr bool do_htrans = false; static constexpr bool do_strans = true; const T1& M; }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_range_meat.hpp0000644000176200001440000000433014631567470023716 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_range //! @{ template inline void op_range::apply(Mat& out, const Op& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword dim = in.aux_uword_a; arma_conform_check( (dim > 1), "range(): parameter 'dim' must be 0 or 1" ); const quasi_unwrap U(in.m); const Mat& X = U.M; if(U.is_alias(out) == false) { op_range::apply_noalias(out, X, dim); } else { Mat tmp; op_range::apply_noalias(tmp, X, dim); out.steal_mem(tmp); } } template inline void op_range::apply_noalias(Mat& out, const Mat& X, const uword dim) { arma_debug_sigprint(); // TODO: replace with dedicated implementation which finds min and max at the same time out = max(X,dim) - min(X,dim); } template inline typename T1::elem_type op_range::vector_range(const T1& expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const quasi_unwrap U(expr); const Mat& X = U.M; const eT* X_mem = X.memptr(); const uword N = X.n_elem; if(N == 0) { arma_conform_check(true, "range(): object has no elements"); return Datum::nan; } // TODO: replace with dedicated implementation which finds min and max at the same time return op_max::direct_max(X_mem, N) - op_min::direct_min(X_mem, N); } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_kron.hpp0000644000176200001440000000457414631567470022564 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_kron //! @{ template arma_warn_unused arma_inline const Glue kron(const Base& A, const Base& B) { arma_debug_sigprint(); return Glue(A.get_ref(), B.get_ref()); } template arma_warn_unused inline Mat::eT> kron(const Base,T1>& X, const Base& Y) { arma_debug_sigprint(); typedef typename std::complex eT1; promote_type::check(); const quasi_unwrap tmp1(X.get_ref()); const quasi_unwrap tmp2(Y.get_ref()); const Mat& A = tmp1.M; const Mat& B = tmp2.M; Mat out; glue_kron::direct_kron(out, A, B); return out; } template arma_warn_unused inline Mat::eT> kron(const Base& X, const Base,T2>& Y) { arma_debug_sigprint(); typedef typename std::complex eT2; promote_type::check(); const quasi_unwrap tmp1(X.get_ref()); const quasi_unwrap tmp2(Y.get_ref()); const Mat& A = tmp1.M; const Mat& B = tmp2.M; Mat out; glue_kron::direct_kron(out, A, B); return out; } template arma_warn_unused arma_inline const SpGlue kron(const SpBase& A, const SpBase& B) { arma_debug_sigprint(); return SpGlue(A.get_ref(), B.get_ref()); } //! @} RcppArmadillo/inst/include/armadillo_bits/op_repelem_meat.hpp0000644000176200001440000000526114631567470024257 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_repelem //! @{ template inline void op_repelem::apply_noalias(Mat& out, const obj& X, const uword copies_per_row, const uword copies_per_col) { arma_debug_sigprint(); typedef typename obj::elem_type eT; const uword X_n_rows = obj::is_row ? uword(1) : X.n_rows; const uword X_n_cols = obj::is_col ? uword(1) : X.n_cols; out.set_size(X_n_rows * copies_per_row, X_n_cols * copies_per_col); if(out.n_elem == 0) { return; } for(uword col=0; col < X_n_cols; ++col) { const uword out_col_offset = col * copies_per_col; eT* out_colptr_first = out.colptr(out_col_offset); for(uword row=0; row < X_n_rows; ++row) { const uword out_row_offset = row * copies_per_row; const eT copy_value = X.at(row, col); for(uword row_copy=0; row_copy < copies_per_row; ++row_copy) { out_colptr_first[out_row_offset + row_copy] = copy_value; } if(copies_per_col != 1) { for(uword col_copy=1; col_copy < copies_per_col; ++col_copy) { eT* out_colptr = out.colptr(out_col_offset + col_copy); arrayops::copy(&out_colptr[out_row_offset], &out_colptr_first[out_row_offset], copies_per_row); } } } } } template inline void op_repelem::apply(Mat& out, const Op& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword copies_per_row = in.aux_uword_a; const uword copies_per_col = in.aux_uword_b; const quasi_unwrap U(in.m); if(U.is_alias(out)) { Mat tmp; op_repelem::apply_noalias(tmp, U.M, copies_per_row, copies_per_col); out.steal_mem(tmp); } else { op_repelem::apply_noalias(out, U.M, copies_per_row, copies_per_col); } } //! @} RcppArmadillo/inst/include/armadillo_bits/eop_aux.hpp0000644000176200001440000003633414770765377022601 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup eop_aux //! @{ //! use of the SFINAE approach to work around compiler limitations //! http://en.wikipedia.org/wiki/SFINAE class eop_aux { public: template arma_inline static typename arma_integral_only::result acos (const eT x) { return eT( std::acos(double(x)) ); } template arma_inline static typename arma_integral_only::result asin (const eT x) { return eT( std::asin(double(x)) ); } template arma_inline static typename arma_integral_only::result atan (const eT x) { return eT( std::atan(double(x)) ); } template arma_inline static typename arma_real_only::result acos (const eT x) { return std::acos(x); } template arma_inline static typename arma_real_only::result asin (const eT x) { return std::asin(x); } template arma_inline static typename arma_real_only::result atan (const eT x) { return std::atan(x); } template arma_inline static typename arma_cx_only::result acos (const eT x) { return std::acos(x); } template arma_inline static typename arma_cx_only::result asin (const eT x) { return std::asin(x); } template arma_inline static typename arma_cx_only::result atan (const eT x) { return std::atan(x); } template arma_inline static typename arma_integral_only::result acosh (const eT x) { return eT( std::acosh(double(x)) ); } template arma_inline static typename arma_integral_only::result asinh (const eT x) { return eT( std::asinh(double(x)) ); } template arma_inline static typename arma_integral_only::result atanh (const eT x) { return eT( std::atanh(double(x)) ); } template arma_inline static typename arma_real_or_cx_only::result acosh (const eT x) { return std::acosh(x); } template arma_inline static typename arma_real_or_cx_only::result asinh (const eT x) { return std::asinh(x); } template arma_inline static typename arma_real_or_cx_only::result atanh (const eT x) { return std::atanh(x); } template arma_inline static typename arma_not_cx::result conj(const eT x) { return x; } template arma_inline static std::complex conj(const std::complex& x) { return std::conj(x); } template arma_inline static typename arma_integral_only::result sqrt (const eT x) { return eT( std::sqrt (double(x)) ); } template arma_inline static typename arma_integral_only::result log10 (const eT x) { return eT( std::log10(double(x)) ); } template arma_inline static typename arma_integral_only::result log (const eT x) { return eT( std::log (double(x)) ); } template arma_inline static typename arma_integral_only::result exp (const eT x) { return eT( std::exp (double(x)) ); } template arma_inline static typename arma_integral_only::result cos (const eT x) { return eT( std::cos (double(x)) ); } template arma_inline static typename arma_integral_only::result sin (const eT x) { return eT( std::sin (double(x)) ); } template arma_inline static typename arma_integral_only::result tan (const eT x) { return eT( std::tan (double(x)) ); } template arma_inline static typename arma_integral_only::result cosh (const eT x) { return eT( std::cosh (double(x)) ); } template arma_inline static typename arma_integral_only::result sinh (const eT x) { return eT( std::sinh (double(x)) ); } template arma_inline static typename arma_integral_only::result tanh (const eT x) { return eT( std::tanh (double(x)) ); } template arma_inline static typename arma_real_or_cx_only::result sqrt (const eT x) { return std::sqrt (x); } template arma_inline static typename arma_real_or_cx_only::result log10 (const eT x) { return std::log10(x); } template arma_inline static typename arma_real_or_cx_only::result log (const eT x) { return std::log (x); } template arma_inline static typename arma_real_or_cx_only::result exp (const eT x) { return std::exp (x); } template arma_inline static typename arma_real_or_cx_only::result cos (const eT x) { return std::cos (x); } template arma_inline static typename arma_real_or_cx_only::result sin (const eT x) { return std::sin (x); } template arma_inline static typename arma_real_or_cx_only::result tan (const eT x) { return std::tan (x); } template arma_inline static typename arma_real_or_cx_only::result cosh (const eT x) { return std::cosh (x); } template arma_inline static typename arma_real_or_cx_only::result sinh (const eT x) { return std::sinh (x); } template arma_inline static typename arma_real_or_cx_only::result tanh (const eT x) { return std::tanh (x); } template arma_inline static typename arma_unsigned_integral_only::result neg (const eT x) { return static_cast(-1 * x); } // TODO: not sure how to best handle this template arma_inline static typename arma_signed_only::result neg (const eT x) { return -x; } template arma_inline static typename arma_integral_only::result floor (const eT x) { return x; } template arma_inline static typename arma_real_only::result floor (const eT x) { return std::floor(x); } template arma_inline static typename arma_cx_only::result floor (const eT& x) { return eT( std::floor(x.real()), std::floor(x.imag()) ); } template arma_inline static typename arma_integral_only::result ceil (const eT x) { return x; } template arma_inline static typename arma_real_only::result ceil (const eT x) { return std::ceil(x); } template arma_inline static typename arma_cx_only::result ceil (const eT& x) { return eT( std::ceil(x.real()), std::ceil(x.imag()) ); } template arma_inline static typename arma_integral_only::result round (const eT x) { return x; } template arma_inline static typename arma_real_only::result round (const eT x) { return std::round(x); } template arma_inline static typename arma_cx_only::result round (const eT& x) { return eT( std::round(x.real()), std::round(x.imag()) ); } template arma_inline static typename arma_integral_only::result trunc (const eT x) { return x; } template arma_inline static typename arma_real_only::result trunc (const eT x) { return std::trunc(x); } template arma_inline static typename arma_cx_only::result trunc (const eT& x) { return eT( std::trunc(x.real()), std::trunc(x.imag()) ); } template arma_inline static typename arma_integral_only::result log2 (const eT x) { return eT( std::log2(double(x)) ); } template arma_inline static typename arma_real_only::result log2 (const eT x) { return std::log2(x); } template arma_inline static typename arma_cx_only::result log2 (const eT& x) { typedef typename get_pod_type::result T; return std::log(x) / T(0.69314718055994530942); } template arma_inline static typename arma_integral_only::result log1p (const eT x) { return eT( std::log1p(double(x)) ); } template arma_inline static typename arma_real_only::result log1p (const eT x) { return std::log1p(x); } template arma_inline static typename arma_cx_only::result log1p (const eT& x) { arma_ignore(x); return eT(0); } template arma_inline static typename arma_integral_only::result exp2 (const eT x) { return eT( std::exp2(double(x)) ); } template arma_inline static typename arma_real_only::result exp2 (const eT x) { return std::exp2(x); } template arma_inline static typename arma_cx_only::result exp2 (const eT& x) { typedef typename get_pod_type::result T; return std::pow( T(2), x); } template arma_inline static typename arma_integral_only::result exp10 (const eT x) { return eT( std::pow(double(10), double(x)) ); } template arma_inline static typename arma_real_or_cx_only::result exp10 (const eT x) { typedef typename get_pod_type::result T; return std::pow( T(10), x); } template arma_inline static typename arma_integral_only::result expm1 (const eT x) { return eT( std::expm1(double(x)) ); } template arma_inline static typename arma_real_only::result expm1 (const eT x) { return std::expm1(x); } template arma_inline static typename arma_cx_only::result expm1 (const eT& x) { arma_ignore(x); return eT(0); } template arma_inline static typename arma_unsigned_integral_only::result arma_abs (const eT x) { return x; } template arma_inline static typename arma_signed_integral_only::result arma_abs (const eT x) { return std::abs(x); } template arma_inline static typename arma_real_only::result arma_abs (const eT x) { return std::abs(x); } template arma_inline static typename arma_real_only< T>::result arma_abs (const std::complex& x) { return std::abs(x); } template arma_inline static typename arma_integral_only::result cbrt (const eT x) { return eT( std::cbrt(double(x)) ); } template arma_inline static typename arma_real_only::result cbrt (const eT x) { return std::cbrt(x); } template arma_inline static typename arma_cx_only::result cbrt (const eT& x) { arma_ignore(x); return eT(0); } template arma_inline static typename arma_integral_only::result erf (const eT x) { return eT( std::erf(double(x)) ); } template arma_inline static typename arma_real_only::result erf (const eT x) { return std::erf(x); } template arma_inline static typename arma_cx_only::result erf (const eT& x) { arma_ignore(x); return eT(0); } template arma_inline static typename arma_integral_only::result erfc (const eT x) { return eT( std::erfc(double(x)) ); } template arma_inline static typename arma_real_only::result erfc (const eT x) { return std::erfc(x); } template arma_inline static typename arma_cx_only::result erfc (const eT& x) { arma_ignore(x); return eT(0); } template arma_inline static typename arma_integral_only::result lgamma (const eT x) { return eT( std::lgamma(double(x)) ); } template arma_inline static typename arma_real_only::result lgamma (const eT x) { return std::lgamma(x); } template arma_inline static typename arma_cx_only::result lgamma (const eT& x) { arma_ignore(x); return eT(0); } template arma_inline static typename arma_integral_only::result tgamma (const eT x) { return eT( std::tgamma(double(x)) ); } template arma_inline static typename arma_real_only::result tgamma (const eT x) { return std::tgamma(x); } template arma_inline static typename arma_cx_only::result tgamma (const eT& x) { arma_ignore(x); return eT(0); } template arma_inline static typename arma_integral_only::result pow (const T1 base, const T2 exponent) { return T1( std::pow( double(base), double(exponent) ) ); } template arma_inline static typename arma_real_or_cx_only::result pow (const T1 base, const T2 exponent) { return T1( std::pow( base, exponent ) ); } template arma_inline static typename arma_integral_only::result direct_eps(const eT) { return eT(0); } template inline static typename arma_real_only::result direct_eps(const eT x) { //arma_debug_sigprint(); // according to IEEE Standard for Floating-Point Arithmetic (IEEE 754) // the mantissa length for double is 53 bits = std::numeric_limits::digits // the mantissa length for float is 24 bits = std::numeric_limits::digits //return std::pow( std::numeric_limits::radix, (std::floor(std::log10(std::abs(x))/std::log10(std::numeric_limits::radix))-(std::numeric_limits::digits-1)) ); const eT radix_eT = eT(std::numeric_limits::radix); const eT digits_m1_eT = eT(std::numeric_limits::digits - 1); // return std::pow( radix_eT, eT(std::floor(std::log10(std::abs(x))/std::log10(radix_eT)) - digits_m1_eT) ); return eop_aux::pow( radix_eT, eT(std::floor(std::log10(std::abs(x))/std::log10(radix_eT)) - digits_m1_eT) ); } template inline static typename arma_real_only::result direct_eps(const std::complex& x) { //arma_debug_sigprint(); //return std::pow( std::numeric_limits::radix, (std::floor(std::log10(std::abs(x))/std::log10(std::numeric_limits::radix))-(std::numeric_limits::digits-1)) ); const T radix_T = T(std::numeric_limits::radix); const T digits_m1_T = T(std::numeric_limits::digits - 1); return std::pow( radix_T, T(std::floor(std::log10(std::abs(x))/std::log10(radix_T)) - digits_m1_T) ); } }; //! @} RcppArmadillo/inst/include/armadillo_bits/fn_reshape.hpp0000644000176200001440000000775314752446051023237 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_reshape //! @{ template arma_warn_unused inline typename enable_if2< is_arma_type::value, const Op >::result reshape(const T1& X, const uword new_n_rows, const uword new_n_cols) { arma_debug_sigprint(); return Op(X, new_n_rows, new_n_cols); } template arma_warn_unused inline typename enable_if2< is_arma_type::value, const Op >::result reshape(const T1& X, const SizeMat& s) { arma_debug_sigprint(); return Op(X, s.n_rows, s.n_cols); } template arma_frown("don't use this form: it will be removed") inline Mat reshape(const Base& X, const uword new_n_rows, const uword new_n_cols, const uword dim) { arma_debug_sigprint(); typedef typename T1::elem_type eT; arma_conform_check( (dim > 1), "reshape(): parameter 'dim' must be 0 or 1" ); const quasi_unwrap U(X.get_ref()); const Mat& A = U.M; Mat out; if(dim == 0) { op_reshape::apply_mat_noalias(out, A, new_n_rows, new_n_cols); } else if(dim == 1) { Mat tmp; op_strans::apply_mat_noalias(tmp, A); op_reshape::apply_mat_noalias(out, tmp, new_n_rows, new_n_cols); } return out; } template arma_warn_unused inline const OpCube reshape(const BaseCube& X, const uword new_n_rows, const uword new_n_cols, const uword new_n_slices) { arma_debug_sigprint(); return OpCube(X.get_ref(), new_n_rows, new_n_cols, new_n_slices); } template arma_warn_unused inline const OpCube reshape(const BaseCube& X, const SizeCube& s) { arma_debug_sigprint(); return OpCube(X.get_ref(), s.n_rows, s.n_cols, s.n_slices); } template arma_warn_unused inline const SpOp reshape(const SpBase& X, const uword new_n_rows, const uword new_n_cols) { arma_debug_sigprint(); return SpOp(X.get_ref(), new_n_rows, new_n_cols); } template arma_warn_unused inline const SpOp reshape(const SpBase& X, const SizeMat& s) { arma_debug_sigprint(); return SpOp(X.get_ref(), s.n_rows, s.n_cols); } // template arma_warn_unused inline field reshape(const field& A, const uword new_n_rows, const uword new_n_cols, const uword new_n_slices = uword(1)) { arma_debug_sigprint(); field B(new_n_rows, new_n_cols, new_n_slices); const uword n_elem_to_copy = (std::min)(A.n_elem, B.n_elem); for(uword i=0; i < n_elem_to_copy; ++i) { B.at(i) = A.at(i); } return B; } template arma_warn_unused inline field reshape(const field& A, const SizeMat& s) { arma_debug_sigprint(); return reshape(A, s.n_rows, s.n_cols); } template arma_warn_unused inline field reshape(const field& A, const SizeCube& s) { arma_debug_sigprint(); return reshape(A, s.n_rows, s.n_cols, s.n_slices); } //! @} RcppArmadillo/inst/include/armadillo_bits/op_symmat_bones.hpp0000644000176200001440000000307614301267043024305 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_symmat //! @{ class op_symmatu : public traits_op_default { public: template inline static void apply(Mat& out, const Op& in); }; class op_symmatl : public traits_op_default { public: template inline static void apply(Mat& out, const Op& in); }; class op_symmatu_cx : public traits_op_default { public: template inline static void apply(Mat& out, const Op& in); }; class op_symmatl_cx : public traits_op_default { public: template inline static void apply(Mat& out, const Op& in); }; //! @} RcppArmadillo/inst/include/armadillo_bits/BaseCube_bones.hpp0000644000176200001440000000626714443051300023745 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup BaseCube //! @{ template struct BaseCube_eval_Cube { arma_warn_unused arma_inline const derived& eval() const; }; template struct BaseCube_eval_expr { arma_warn_unused inline Cube eval() const; //!< force the immediate evaluation of a delayed expression }; template struct BaseCube_eval {}; template struct BaseCube_eval { typedef BaseCube_eval_Cube result; }; template struct BaseCube_eval { typedef BaseCube_eval_expr result; }; //! Analog of the Base class, intended for cubes template struct BaseCube : public BaseCube_eval::value>::result { arma_inline const derived& get_ref() const; arma_cold inline void print( const std::string extra_text = "") const; arma_cold inline void print(std::ostream& user_stream, const std::string extra_text = "") const; arma_cold inline void raw_print( const std::string extra_text = "") const; arma_cold inline void raw_print(std::ostream& user_stream, const std::string extra_text = "") const; arma_cold inline void brief_print( const std::string extra_text = "") const; arma_cold inline void brief_print(std::ostream& user_stream, const std::string extra_text = "") const; arma_warn_unused inline elem_type min() const; arma_warn_unused inline elem_type max() const; arma_warn_unused inline uword index_min() const; arma_warn_unused inline uword index_max() const; arma_warn_unused inline bool is_zero(const typename get_pod_type::result tol = 0) const; arma_warn_unused inline bool is_empty() const; arma_warn_unused inline bool is_finite() const; arma_warn_unused inline bool has_inf() const; arma_warn_unused inline bool has_nan() const; arma_warn_unused inline bool has_nonfinite() const; arma_warn_unused inline const CubeToMatOp row_as_mat(const uword in_row) const; arma_warn_unused inline const CubeToMatOp col_as_mat(const uword in_col) const; }; //! @} RcppArmadillo/inst/include/armadillo_bits/fn_pinv.hpp0000644000176200001440000000525214635324415022553 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_pinv //! @{ template arma_warn_unused inline typename enable_if2< is_real::value, const Op >::result pinv ( const Base& X ) { arma_debug_sigprint(); return Op(X.get_ref()); } template arma_warn_unused inline typename enable_if2< is_real::value, const Op >::result pinv ( const Base& X, const typename T1::pod_type tol, const char* method = nullptr ) { arma_debug_sigprint(); typedef typename T1::elem_type eT; uword method_id = 0; // default setting if(method != nullptr) { const char sig = method[0]; arma_conform_check( ((sig != 's') && (sig != 'd')), "pinv(): unknown method specified" ); if(sig == 's') { method_id = 1; } if(sig == 'd') { method_id = 2; } } return Op(X.get_ref(), eT(tol), method_id, uword(0)); } template inline typename enable_if2< is_real::value, bool >::result pinv ( Mat& out, const Base& X, const typename T1::pod_type tol = 0.0, const char* method = nullptr ) { arma_debug_sigprint(); uword method_id = 0; // default setting if(method != nullptr) { const char sig = method[0]; arma_conform_check( ((sig != 's') && (sig != 'd')), "pinv(): unknown method specified" ); if(sig == 's') { method_id = 1; } if(sig == 'd') { method_id = 2; } } const bool status = op_pinv::apply_direct(out, X.get_ref(), tol, method_id); if(status == false) { out.soft_reset(); arma_warn(3, "pinv(): svd failed"); } return status; } //! @} RcppArmadillo/inst/include/armadillo_bits/hdf5_misc.hpp0000644000176200001440000004674514374704744023000 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup hdf5_misc //! @{ #if defined(ARMA_USE_HDF5) namespace hdf5_misc { //! Given a certain type, find the corresponding HDF5 datatype. This can't be //! done entirely at compile time, unfortunately, because the H5T_* macros //! depend on function calls. template< typename eT > inline hid_t get_hdf5_type() { return -1; // Return invalid. } //! Specializations for each valid element type //! (taken from all the possible typedefs of {u8, s8, ..., u64, s64} and the other native types. //! We can't use the actual u8/s8 typedefs because their relations to the H5T_... types are unclear. template<> inline hid_t get_hdf5_type< unsigned char >() { return H5Tcopy(H5T_NATIVE_UCHAR); } template<> inline hid_t get_hdf5_type< char >() { return H5Tcopy(H5T_NATIVE_CHAR); } template<> inline hid_t get_hdf5_type< short >() { return H5Tcopy(H5T_NATIVE_SHORT); } template<> inline hid_t get_hdf5_type< unsigned short >() { return H5Tcopy(H5T_NATIVE_USHORT); } template<> inline hid_t get_hdf5_type< int >() { return H5Tcopy(H5T_NATIVE_INT); } template<> inline hid_t get_hdf5_type< unsigned int >() { return H5Tcopy(H5T_NATIVE_UINT); } template<> inline hid_t get_hdf5_type< long >() { return H5Tcopy(H5T_NATIVE_LONG); } template<> inline hid_t get_hdf5_type< unsigned long >() { return H5Tcopy(H5T_NATIVE_ULONG); } template<> inline hid_t get_hdf5_type< long long >() { return H5Tcopy(H5T_NATIVE_LLONG); } template<> inline hid_t get_hdf5_type< unsigned long long >() { return H5Tcopy(H5T_NATIVE_ULLONG); } template<> inline hid_t get_hdf5_type< float >() { return H5Tcopy(H5T_NATIVE_FLOAT); } template<> inline hid_t get_hdf5_type< double >() { return H5Tcopy(H5T_NATIVE_DOUBLE); } //! Utility hid_t since HOFFSET() won't work with std::complex. template struct hdf5_complex_t { eT real; eT imag; }; template<> inline hid_t get_hdf5_type< std::complex >() { hid_t type = H5Tcreate(H5T_COMPOUND, sizeof(hdf5_complex_t)); H5Tinsert(type, "real", HOFFSET(hdf5_complex_t, real), H5T_NATIVE_FLOAT); H5Tinsert(type, "imag", HOFFSET(hdf5_complex_t, imag), H5T_NATIVE_FLOAT); return type; } template<> inline hid_t get_hdf5_type< std::complex >() { hid_t type = H5Tcreate(H5T_COMPOUND, sizeof(hdf5_complex_t)); H5Tinsert(type, "real", HOFFSET(hdf5_complex_t, real), H5T_NATIVE_DOUBLE); H5Tinsert(type, "imag", HOFFSET(hdf5_complex_t, imag), H5T_NATIVE_DOUBLE); return type; } // Compare datatype against all supported types. inline bool is_supported_arma_hdf5_type(hid_t datatype) { hid_t search_type; bool is_equal; // start with most likely used types: double, complex, float, complex search_type = get_hdf5_type(); is_equal = ( H5Tequal(datatype, search_type) > 0 ); H5Tclose(search_type); if(is_equal) { return true; } search_type = get_hdf5_type< std::complex >(); is_equal = ( H5Tequal(datatype, search_type) > 0 ); H5Tclose(search_type); if(is_equal) { return true; } search_type = get_hdf5_type(); is_equal = ( H5Tequal(datatype, search_type) > 0 ); H5Tclose(search_type); if(is_equal) { return true; } search_type = get_hdf5_type< std::complex >(); is_equal = ( H5Tequal(datatype, search_type) > 0 ); H5Tclose(search_type); if(is_equal) { return true; } // remaining supported types: u8, s8, u16, s16, u32, s32, u64, s64, ulng_t, slng_t search_type = get_hdf5_type(); is_equal = ( H5Tequal(datatype, search_type) > 0 ); H5Tclose(search_type); if(is_equal) { return true; } search_type = get_hdf5_type(); is_equal = ( H5Tequal(datatype, search_type) > 0 ); H5Tclose(search_type); if(is_equal) { return true; } search_type = get_hdf5_type(); is_equal = ( H5Tequal(datatype, search_type) > 0 ); H5Tclose(search_type); if(is_equal) { return true; } search_type = get_hdf5_type(); is_equal = ( H5Tequal(datatype, search_type) > 0 ); H5Tclose(search_type); if(is_equal) { return true; } search_type = get_hdf5_type(); is_equal = ( H5Tequal(datatype, search_type) > 0 ); H5Tclose(search_type); if(is_equal) { return true; } search_type = get_hdf5_type(); is_equal = ( H5Tequal(datatype, search_type) > 0 ); H5Tclose(search_type); if(is_equal) { return true; } search_type = get_hdf5_type(); is_equal = ( H5Tequal(datatype, search_type) > 0 ); H5Tclose(search_type); if(is_equal) { return true; } search_type = get_hdf5_type(); is_equal = ( H5Tequal(datatype, search_type) > 0 ); H5Tclose(search_type); if(is_equal) { return true; } search_type = get_hdf5_type(); is_equal = ( H5Tequal(datatype, search_type) > 0 ); H5Tclose(search_type); if(is_equal) { return true; } search_type = get_hdf5_type(); is_equal = ( H5Tequal(datatype, search_type) > 0 ); H5Tclose(search_type); if(is_equal) { return true; } return false; } //! Auxiliary functions and structs for search_hdf5_file. struct hdf5_search_info { const std::vector& names; int num_dims; bool exact; hid_t best_match; size_t best_match_position; // Position of best match in names vector. }; inline herr_t hdf5_search_callback ( hid_t loc_id, const char* name, const H5O_info_t* info, void* operator_data // hdf5_search_info ) { hdf5_search_info* search_info = (hdf5_search_info*) operator_data; // We are looking for datasets. if(info->type == H5O_TYPE_DATASET) { // Check type of dataset to see if we could even load it. hid_t dataset = H5Dopen(loc_id, name, H5P_DEFAULT); hid_t datatype = H5Dget_type(dataset); const bool is_supported = is_supported_arma_hdf5_type(datatype); H5Tclose(datatype); H5Dclose(dataset); if(is_supported == false) { // Forget about it and move on. return 0; } // Now we have to check against our set of names. // Only check names which could be better. for(size_t string_pos = 0; string_pos < search_info->best_match_position; ++string_pos) { // name is the full path (/path/to/dataset); names[string_pos] may be // "dataset", "/to/dataset", or "/path/to/dataset". // So if we count the number of forward slashes in names[string_pos], // and then simply take the last substring of name containing that number of slashes, // we can do the comparison. // Count the number of forward slashes in names[string_pos]. uword name_count = 0; for(uword i = 0; i < search_info->names[string_pos].length(); ++i) { if((search_info->names[string_pos])[i] == '/') { ++name_count; } } // Count the number of forward slashes in the full name. uword count = 0; const std::string str = std::string(name); for(uword i = 0; i < str.length(); ++i) { if(str[i] == '/') { ++count; } } // Is the full string the same? if(str == search_info->names[string_pos]) { // We found it exactly. hid_t match_candidate = H5Dopen(loc_id, name, H5P_DEFAULT); if(match_candidate < 0) { return -1; } // Ensure that the dataset is valid and of the correct dimensionality. hid_t filespace = H5Dget_space(match_candidate); int num_dims = H5Sget_simple_extent_ndims(filespace); if(num_dims <= search_info->num_dims) { // Valid dataset -- we'll keep it. // If we already have an existing match we have to close it. if(search_info->best_match != -1) { H5Dclose(search_info->best_match); } search_info->best_match_position = string_pos; search_info->best_match = match_candidate; } H5Sclose(filespace); // There is no possibility of anything better, so terminate the search. return 1; } // If we are asking for more slashes than we have, this can't be a match. // Skip to below, where we decide whether or not to keep it anyway based // on the exactness condition of the search. if(count <= name_count) { size_t start_pos = (count == 0) ? 0 : std::string::npos; while(count > 0) { // Move pointer to previous slash. start_pos = str.rfind('/', start_pos); // Break if we've run out of slashes. if(start_pos == std::string::npos) { break; } --count; } // Now take the substring (this may end up being the full string). const std::string substring = str.substr(start_pos); // Are they the same? if(substring == search_info->names[string_pos]) { // We have found the object; it must be better than our existing match. hid_t match_candidate = H5Dopen(loc_id, name, H5P_DEFAULT); // arma_check(match_candidate < 0, "Mat::load(): cannot open an HDF5 dataset"); if(match_candidate < 0) { return -1; } // Ensure that the dataset is valid and of the correct dimensionality. hid_t filespace = H5Dget_space(match_candidate); int num_dims = H5Sget_simple_extent_ndims(filespace); if(num_dims <= search_info->num_dims) { // Valid dataset -- we'll keep it. // If we already have an existing match we have to close it. if(search_info->best_match != -1) { H5Dclose(search_info->best_match); } search_info->best_match_position = string_pos; search_info->best_match = match_candidate; } H5Sclose(filespace); } } // If they are not the same, but we have not found anything and we don't need an exact match, take this. if((search_info->exact == false) && (search_info->best_match == -1)) { hid_t match_candidate = H5Dopen(loc_id, name, H5P_DEFAULT); // arma_check(match_candidate < 0, "Mat::load(): cannot open an HDF5 dataset"); if(match_candidate < 0) { return -1; } hid_t filespace = H5Dget_space(match_candidate); int num_dims = H5Sget_simple_extent_ndims(filespace); if(num_dims <= search_info->num_dims) { // Valid dataset -- we'll keep it. search_info->best_match = H5Dopen(loc_id, name, H5P_DEFAULT); } H5Sclose(filespace); } } } return 0; } //! Search an HDF5 file for the given dataset names. //! If 'exact' is true, failure to find a dataset in the list of names means that -1 is returned. //! If 'exact' is false and no datasets are found, -1 is returned. //! The number of dimensions is used to help prune down invalid datasets; //! 2 dimensions is a matrix, 1 dimension is a vector, and 3 dimensions is a cube. //! If the number of dimensions in a dataset is less than or equal to num_dims, //! it will be considered -- for instance, a one-dimensional HDF5 vector can be loaded as a single-column matrix. inline hid_t search_hdf5_file ( const std::vector& names, hid_t hdf5_file, int num_dims = 2, bool exact = false ) { hdf5_search_info search_info = { names, num_dims, exact, -1, names.size() }; // We'll use the H5Ovisit to track potential entries. herr_t status = H5Ovisit(hdf5_file, H5_INDEX_NAME, H5_ITER_NATIVE, hdf5_search_callback, void_ptr(&search_info)); // Return the best match; it will be -1 if there was a problem. return (status < 0) ? -1 : search_info.best_match; } //! Load an HDF5 matrix into an array of type specified by datatype, //! then convert that into the desired array 'dest'. //! This should only be called when eT is not the datatype. template inline hid_t load_and_convert_hdf5 ( eT *dest, hid_t dataset, hid_t datatype, uword n_elem ) { // We can't use nice template specializations here // as the determination of the type of 'datatype' must be done at runtime. // So we end up with this ugliness... hid_t search_type; bool is_equal; // u8 search_type = get_hdf5_type(); is_equal = (H5Tequal(datatype, search_type) > 0); H5Tclose(search_type); if(is_equal) { Col v(n_elem, arma_nozeros_indicator()); hid_t status = H5Dread(dataset, datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, void_ptr(v.memptr())); arrayops::convert(dest, v.memptr(), n_elem); return status; } // s8 search_type = get_hdf5_type(); is_equal = (H5Tequal(datatype, search_type) > 0); H5Tclose(search_type); if(is_equal) { Col v(n_elem, arma_nozeros_indicator()); hid_t status = H5Dread(dataset, datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, void_ptr(v.memptr())); arrayops::convert(dest, v.memptr(), n_elem); return status; } // u16 search_type = get_hdf5_type(); is_equal = (H5Tequal(datatype, search_type) > 0); H5Tclose(search_type); if(is_equal) { Col v(n_elem, arma_nozeros_indicator()); hid_t status = H5Dread(dataset, datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, void_ptr(v.memptr())); arrayops::convert(dest, v.memptr(), n_elem); return status; } // s16 search_type = get_hdf5_type(); is_equal = (H5Tequal(datatype, search_type) > 0); H5Tclose(search_type); if(is_equal) { Col v(n_elem, arma_nozeros_indicator()); hid_t status = H5Dread(dataset, datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, void_ptr(v.memptr())); arrayops::convert(dest, v.memptr(), n_elem); return status; } // u32 search_type = get_hdf5_type(); is_equal = (H5Tequal(datatype, search_type) > 0); H5Tclose(search_type); if(is_equal) { Col v(n_elem, arma_nozeros_indicator()); hid_t status = H5Dread(dataset, datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, void_ptr(v.memptr())); arrayops::convert(dest, v.memptr(), n_elem); return status; } // s32 search_type = get_hdf5_type(); is_equal = (H5Tequal(datatype, search_type) > 0); H5Tclose(search_type); if(is_equal) { Col v(n_elem, arma_nozeros_indicator()); hid_t status = H5Dread(dataset, datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, void_ptr(v.memptr())); arrayops::convert(dest, v.memptr(), n_elem); return status; } // u64 search_type = get_hdf5_type(); is_equal = (H5Tequal(datatype, search_type) > 0); H5Tclose(search_type); if(is_equal) { Col v(n_elem, arma_nozeros_indicator()); hid_t status = H5Dread(dataset, datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, void_ptr(v.memptr())); arrayops::convert(dest, v.memptr(), n_elem); return status; } // s64 search_type = get_hdf5_type(); is_equal = (H5Tequal(datatype, search_type) > 0); H5Tclose(search_type); if(is_equal) { Col v(n_elem, arma_nozeros_indicator()); hid_t status = H5Dread(dataset, datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, void_ptr(v.memptr())); arrayops::convert(dest, v.memptr(), n_elem); return status; } // ulng_t search_type = get_hdf5_type(); is_equal = (H5Tequal(datatype, search_type) > 0); H5Tclose(search_type); if(is_equal) { Col v(n_elem, arma_nozeros_indicator()); hid_t status = H5Dread(dataset, datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, void_ptr(v.memptr())); arrayops::convert(dest, v.memptr(), n_elem); return status; } // slng_t search_type = get_hdf5_type(); is_equal = (H5Tequal(datatype, search_type) > 0); H5Tclose(search_type); if(is_equal) { Col v(n_elem, arma_nozeros_indicator()); hid_t status = H5Dread(dataset, datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, void_ptr(v.memptr())); arrayops::convert(dest, v.memptr(), n_elem); return status; } // float search_type = get_hdf5_type(); is_equal = (H5Tequal(datatype, search_type) > 0); H5Tclose(search_type); if(is_equal) { Col v(n_elem, arma_nozeros_indicator()); hid_t status = H5Dread(dataset, datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, void_ptr(v.memptr())); arrayops::convert(dest, v.memptr(), n_elem); return status; } // double search_type = get_hdf5_type(); is_equal = (H5Tequal(datatype, search_type) > 0); H5Tclose(search_type); if(is_equal) { Col v(n_elem, arma_nozeros_indicator()); hid_t status = H5Dread(dataset, datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, void_ptr(v.memptr())); arrayops::convert(dest, v.memptr(), n_elem); return status; } // complex float search_type = get_hdf5_type< std::complex >(); is_equal = (H5Tequal(datatype, search_type) > 0); H5Tclose(search_type); if(is_equal) { if(is_cx::no) { return -1; // can't read complex data into non-complex matrix/cube } Col< std::complex > v(n_elem, arma_nozeros_indicator()); hid_t status = H5Dread(dataset, datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, void_ptr(v.memptr())); arrayops::convert_cx(dest, v.memptr(), n_elem); return status; } // complex double search_type = get_hdf5_type< std::complex >(); is_equal = (H5Tequal(datatype, search_type) > 0); H5Tclose(search_type); if(is_equal) { if(is_cx::no) { return -1; // can't read complex data into non-complex matrix/cube } Col< std::complex > v(n_elem, arma_nozeros_indicator()); hid_t status = H5Dread(dataset, datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, void_ptr(v.memptr())); arrayops::convert_cx(dest, v.memptr(), n_elem); return status; } return -1; // Failure. } struct hdf5_suspend_printing_errors { #if (ARMA_WARN_LEVEL >= 3) inline hdf5_suspend_printing_errors() {} #else herr_t (*old_client_func)(hid_t, void*); void* old_client_data; inline hdf5_suspend_printing_errors() { // Save old error handler. H5Eget_auto(H5E_DEFAULT, &old_client_func, &old_client_data); // Disable annoying HDF5 error messages. H5Eset_auto(H5E_DEFAULT, NULL, NULL); } inline ~hdf5_suspend_printing_errors() { H5Eset_auto(H5E_DEFAULT, old_client_func, old_client_data); } #endif }; } // namespace hdf5_misc #endif // #if defined(ARMA_USE_HDF5) //! @} RcppArmadillo/inst/include/armadillo_bits/fn_all.hpp0000644000176200001440000000354614631567470022361 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_all //! @{ template arma_warn_unused inline typename enable_if2 < is_arma_type::value && resolves_to_vector::yes, bool >::result all(const T1& X) { arma_debug_sigprint(); return op_all::all_vec(X); } template arma_warn_unused arma_inline typename enable_if2 < is_arma_type::value && resolves_to_vector::no, const mtOp >::result all(const T1& X) { arma_debug_sigprint(); return mtOp(X, 0, 0); } template arma_warn_unused arma_inline typename enable_if2 < is_arma_type::value, const mtOp >::result all(const T1& X, const uword dim) { arma_debug_sigprint(); return mtOp(X, dim, 0); } //! for compatibility purposes: allows compiling user code designed for earlier versions of Armadillo template arma_warn_unused arma_inline typename enable_if2 < is_supported_elem_type::value, bool >::result all(const T& val) { return (val != T(0)); } //! @} RcppArmadillo/inst/include/armadillo_bits/glue_polyfit_bones.hpp0000644000176200001440000000303614301267043024773 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup glue_polyfit //! @{ class glue_polyfit { public: template struct traits { static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; }; template inline static bool apply_noalias(Mat& out, const Col& X, const Col& Y, const uword N); template inline static bool apply_direct(Mat& out, const Base& X_expr, const Base& Y_expr, const uword N); template inline static void apply(Mat& out, const Glue& expr); }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_log_det_bones.hpp0000644000176200001440000000315414301267043024405 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_log_det //! @{ class op_log_det : public traits_op_default { public: template inline static bool apply_direct(typename T1::elem_type& out_val, typename T1::pod_type& out_sign, const Base& expr); template inline static bool apply_diagmat(typename T1::elem_type& out_val, typename T1::pod_type& out_sign, const Base& expr); template inline static bool apply_trimat(typename T1::elem_type& out_val, typename T1::pod_type& out_sign, const Base& expr); }; class op_log_det_sympd : public traits_op_default { public: template inline static bool apply_direct(typename T1::pod_type& out_val, const Base& expr); }; //! @} RcppArmadillo/inst/include/armadillo_bits/fn_inplace_trans.hpp0000644000176200001440000000465414631567470024434 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_inplace_trans //! @{ template inline typename enable_if2 < is_cx::no, void >::result inplace_htrans ( Mat& X, const char* method = "std" ) { arma_debug_sigprint(); inplace_strans(X, method); } template inline typename enable_if2 < is_cx::yes, void >::result inplace_htrans ( Mat& X, const char* method = "std" ) { arma_debug_sigprint(); const char sig = (method != nullptr) ? method[0] : char(0); arma_conform_check( ((sig != 's') && (sig != 'l')), "inplace_htrans(): unknown method specified" ); const bool low_memory = (sig == 'l'); if( (low_memory == false) || (X.n_rows == X.n_cols) ) { op_htrans::apply_mat_inplace(X); } else { inplace_strans(X, method); X = conj(X); } } template inline typename enable_if2 < is_cx::no, void >::result inplace_trans ( Mat& X, const char* method = "std" ) { arma_debug_sigprint(); const char sig = (method != nullptr) ? method[0] : char(0); arma_conform_check( ((sig != 's') && (sig != 'l')), "inplace_trans(): unknown method specified" ); inplace_strans(X, method); } template inline typename enable_if2 < is_cx::yes, void >::result inplace_trans ( Mat& X, const char* method = "std" ) { arma_debug_sigprint(); const char sig = (method != nullptr) ? method[0] : char(0); arma_conform_check( ((sig != 's') && (sig != 'l')), "inplace_trans(): unknown method specified" ); inplace_htrans(X, method); } //! @} RcppArmadillo/inst/include/armadillo_bits/op_omit_bones.hpp0000644000176200001440000000272115030507611023735 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_omit //! @{ class op_omit : public traits_op_col { public: template inline static void apply(Mat& out, const Op& in); template inline static void apply(Mat& out, const T1& X, functor is_omitted); }; class op_omit_cube : public traits_op_col { public: template inline static void apply(Mat& out, const CubeToMatOp& in); template inline static void apply(Mat& out, const T1& X, functor is_omitted); }; //! @} RcppArmadillo/inst/include/armadillo_bits/subview_each_bones.hpp0000644000176200001440000001372714711673611024754 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup subview_each //! @{ template class subview_each_common { public: typedef typename parent::elem_type eT; const parent& P; template inline void check_size(const Mat& A) const; protected: arma_inline subview_each_common(const parent& in_P); inline subview_each_common() = delete; arma_inline const Mat& get_mat_ref_helper(const Mat & X) const; arma_inline const Mat& get_mat_ref_helper(const subview& X) const; arma_inline const Mat& get_mat_ref() const; template arma_cold inline const std::string incompat_size_string(const Mat& A) const; }; // NOTE: deliberately not derived from Base template class subview_each1 : public subview_each_common { protected: arma_inline subview_each1(const parent& in_P); public: typedef typename parent::elem_type eT; inline ~subview_each1(); inline subview_each1() = delete; // deliberately returning void template inline void operator= (const Base& x); template inline void operator+= (const Base& x); template inline void operator-= (const Base& x); template inline void operator%= (const Base& x); template inline void operator/= (const Base& x); friend class Mat; friend class subview; }; // NOTE: deliberately not derived from Base template class subview_each2 : public subview_each_common { protected: inline subview_each2(const parent& in_P, const Base& in_indices); public: const Base& base_indices; typedef typename parent::elem_type eT; inline void check_indices(const Mat& indices) const; inline ~subview_each2(); inline subview_each2() = delete; // deliberately returning void template inline void operator= (const Base& x); template inline void operator+= (const Base& x); template inline void operator-= (const Base& x); template inline void operator%= (const Base& x); template inline void operator/= (const Base& x); friend class Mat; friend class subview; }; class subview_each1_aux { public: template static inline Mat operator_plus(const subview_each1& X, const Base& Y); template static inline Mat operator_minus(const subview_each1& X, const Base& Y); template static inline Mat operator_minus(const Base& X, const subview_each1& Y); template static inline Mat operator_schur(const subview_each1& X, const Base& Y); template static inline Mat operator_div(const subview_each1& X,const Base& Y); template static inline Mat operator_div(const Base& X, const subview_each1& Y); }; class subview_each2_aux { public: template static inline Mat operator_plus(const subview_each2& X, const Base& Y); template static inline Mat operator_minus(const subview_each2& X, const Base& Y); template static inline Mat operator_minus(const Base& X, const subview_each2& Y); template static inline Mat operator_schur(const subview_each2& X, const Base& Y); template static inline Mat operator_div(const subview_each2& X, const Base& Y); template static inline Mat operator_div(const Base& X, const subview_each2& Y); }; //! @} RcppArmadillo/inst/include/armadillo_bits/OpCube_bones.hpp0000644000176200001440000000415614752446051023462 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup OpCube //! @{ template class OpCube : public BaseCube< typename T1::elem_type, OpCube > { public: typedef typename T1::elem_type elem_type; typedef typename get_pod_type::result pod_type; inline explicit OpCube(const BaseCube& in_m); inline OpCube(const BaseCube& in_m, const elem_type in_aux); inline OpCube(const BaseCube& in_m, const elem_type in_aux, const uword in_aux_uword_a, const uword in_aux_uword_b, const uword in_aux_uword_c); inline OpCube(const BaseCube& in_m, const uword in_aux_uword_a, const uword in_aux_uword_b); inline OpCube(const BaseCube& in_m, const uword in_aux_uword_a, const uword in_aux_uword_b, const uword in_aux_uword_c); inline ~OpCube(); const T1& m; //!< the operand; must be derived from BaseCube elem_type aux; //!< auxiliary data, using the element type as used by T1 uword aux_uword_a; //!< auxiliary data, uword format uword aux_uword_b; //!< auxiliary data, uword format uword aux_uword_c; //!< auxiliary data, uword format }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_sp_plus_meat.hpp0000644000176200001440000000532614634016465024311 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_sp_plus //! @{ template inline void op_sp_plus::apply(Mat& out, const SpToDOp& in) { arma_debug_sigprint(); const SpProxy P(in.m); out.set_size(P.get_n_rows(), P.get_n_cols()); out.fill(in.aux); out += P.Q; } // used for the optimization of sparse % (sparse + scalar) template inline void op_sp_plus::apply_inside_schur(SpMat& out, const T2& x, const SpToDOp& y) { arma_debug_sigprint(); const SpProxy P2(x); const SpProxy P3(y.m); arma_conform_assert_same_size(P2.get_n_rows(), P2.get_n_cols(), P3.get_n_rows(), P3.get_n_cols(), "element-wise multiplication"); out.zeros(P2.get_n_rows(), P2.get_n_cols()); typename SpProxy::const_iterator_type it = P2.begin(); typename SpProxy::const_iterator_type it_end = P2.end(); const eT k = y.aux; for(; it != it_end; ++it) { const uword it_row = it.row(); const uword it_col = it.col(); out.at(it_row, it_col) = (*it) * (P3.at(it_row, it_col) + k); } } // used for the optimization of sparse / (sparse + scalar) template inline void op_sp_plus::apply_inside_div(SpMat& out, const T2& x, const SpToDOp& y) { arma_debug_sigprint(); const SpProxy P2(x); const SpProxy P3(y.m); arma_conform_assert_same_size(P2.get_n_rows(), P2.get_n_cols(), P3.get_n_rows(), P3.get_n_cols(), "element-wise division"); out.zeros(P2.get_n_rows(), P2.get_n_cols()); typename SpProxy::const_iterator_type it = P2.begin(); typename SpProxy::const_iterator_type it_end = P2.end(); const eT k = y.aux; for(; it != it_end; ++it) { const uword it_row = it.row(); const uword it_col = it.col(); out.at(it_row, it_col) = (*it) / (P3.at(it_row, it_col) + k); } } //! @} RcppArmadillo/inst/include/armadillo_bits/subview_each_meat.hpp0000644000176200001440000007356614634016465024605 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup subview_each //! @{ // // // subview_each_common template inline subview_each_common::subview_each_common(const parent& in_P) : P(in_P) { arma_debug_sigprint(); } template arma_inline const Mat& subview_each_common::get_mat_ref_helper(const Mat& X) const { return X; } template arma_inline const Mat& subview_each_common::get_mat_ref_helper(const subview& X) const { return X.m; } template arma_inline const Mat& subview_each_common::get_mat_ref() const { return get_mat_ref_helper(P); } template template inline void subview_each_common::check_size(const Mat& A) const { if(arma_config::check_conform) { if(mode == 0) { if( (A.n_rows != P.n_rows) || (A.n_cols != 1) ) { arma_stop_logic_error( incompat_size_string(A) ); } } else { if( (A.n_rows != 1) || (A.n_cols != P.n_cols) ) { arma_stop_logic_error( incompat_size_string(A) ); } } } } template template inline const std::string subview_each_common::incompat_size_string(const Mat& A) const { std::ostringstream tmp; if(mode == 0) { tmp << "each_col(): incompatible size; expected " << P.n_rows << "x1" << ", got " << A.n_rows << 'x' << A.n_cols; } else { tmp << "each_row(): incompatible size; expected 1x" << P.n_cols << ", got " << A.n_rows << 'x' << A.n_cols; } return tmp.str(); } // // // subview_each1 template inline subview_each1::~subview_each1() { arma_debug_sigprint(); } template inline subview_each1::subview_each1(const parent& in_P) : subview_each_common::subview_each_common(in_P) { arma_debug_sigprint(); } template template inline void subview_each1::operator= (const Base& in) { arma_debug_sigprint(); parent& p = access::rw(subview_each_common::P); const unwrap_check tmp( in.get_ref(), (*this).get_mat_ref() ); const Mat& A = tmp.M; subview_each_common::check_size(A); const eT* A_mem = A.memptr(); const uword p_n_rows = p.n_rows; const uword p_n_cols = p.n_cols; if(mode == 0) // each column { for(uword i=0; i < p_n_cols; ++i) { arrayops::copy( p.colptr(i), A_mem, p_n_rows ); } } else // each row { for(uword i=0; i < p_n_cols; ++i) { arrayops::inplace_set( p.colptr(i), A_mem[i], p_n_rows); } } } template template inline void subview_each1::operator+= (const Base& in) { arma_debug_sigprint(); parent& p = access::rw(subview_each_common::P); const unwrap_check tmp( in.get_ref(), (*this).get_mat_ref() ); const Mat& A = tmp.M; subview_each_common::check_size(A); const eT* A_mem = A.memptr(); const uword p_n_rows = p.n_rows; const uword p_n_cols = p.n_cols; if(mode == 0) // each column { for(uword i=0; i < p_n_cols; ++i) { arrayops::inplace_plus( p.colptr(i), A_mem, p_n_rows ); } } else // each row { for(uword i=0; i < p_n_cols; ++i) { arrayops::inplace_plus( p.colptr(i), A_mem[i], p_n_rows); } } } template template inline void subview_each1::operator-= (const Base& in) { arma_debug_sigprint(); parent& p = access::rw(subview_each_common::P); const unwrap_check tmp( in.get_ref(), (*this).get_mat_ref() ); const Mat& A = tmp.M; subview_each_common::check_size(A); const eT* A_mem = A.memptr(); const uword p_n_rows = p.n_rows; const uword p_n_cols = p.n_cols; if(mode == 0) // each column { for(uword i=0; i < p_n_cols; ++i) { arrayops::inplace_minus( p.colptr(i), A_mem, p_n_rows ); } } else // each row { for(uword i=0; i < p_n_cols; ++i) { arrayops::inplace_minus( p.colptr(i), A_mem[i], p_n_rows); } } } template template inline void subview_each1::operator%= (const Base& in) { arma_debug_sigprint(); parent& p = access::rw(subview_each_common::P); const unwrap_check tmp( in.get_ref(), (*this).get_mat_ref() ); const Mat& A = tmp.M; subview_each_common::check_size(A); const eT* A_mem = A.memptr(); const uword p_n_rows = p.n_rows; const uword p_n_cols = p.n_cols; if(mode == 0) // each column { for(uword i=0; i < p_n_cols; ++i) { arrayops::inplace_mul( p.colptr(i), A_mem, p_n_rows ); } } else // each row { for(uword i=0; i < p_n_cols; ++i) { arrayops::inplace_mul( p.colptr(i), A_mem[i], p_n_rows); } } } template template inline void subview_each1::operator/= (const Base& in) { arma_debug_sigprint(); parent& p = access::rw(subview_each_common::P); const unwrap_check tmp( in.get_ref(), (*this).get_mat_ref() ); const Mat& A = tmp.M; subview_each_common::check_size(A); const eT* A_mem = A.memptr(); const uword p_n_rows = p.n_rows; const uword p_n_cols = p.n_cols; if(mode == 0) // each column { for(uword i=0; i < p_n_cols; ++i) { arrayops::inplace_div( p.colptr(i), A_mem, p_n_rows ); } } else // each row { for(uword i=0; i < p_n_cols; ++i) { arrayops::inplace_div( p.colptr(i), A_mem[i], p_n_rows); } } } // // // subview_each2 template inline subview_each2::~subview_each2() { arma_debug_sigprint(); } template inline subview_each2::subview_each2(const parent& in_P, const Base& in_indices) : subview_each_common::subview_each_common(in_P) , base_indices(in_indices) { arma_debug_sigprint(); } template inline void subview_each2::check_indices(const Mat& indices) const { if(mode == 0) { arma_conform_check( ((indices.is_vec() == false) && (indices.is_empty() == false)), "each_col(): list of indices must be a vector" ); } else { arma_conform_check( ((indices.is_vec() == false) && (indices.is_empty() == false)), "each_row(): list of indices must be a vector" ); } } template template inline void subview_each2::operator= (const Base& in) { arma_debug_sigprint(); parent& p = access::rw(subview_each_common::P); const unwrap_check tmp( in.get_ref(), (*this).get_mat_ref() ); const Mat& A = tmp.M; subview_each_common::check_size(A); const unwrap_check_mixed U( base_indices.get_ref(), (*this).get_mat_ref() ); check_indices(U.M); const eT* A_mem = A.memptr(); const uword p_n_rows = p.n_rows; const uword p_n_cols = p.n_cols; const uword* indices_mem = U.M.memptr(); const uword N = U.M.n_elem; if(mode == 0) // each column { for(uword i=0; i < N; ++i) { const uword col = indices_mem[i]; arma_conform_check_bounds( (col >= p_n_cols), "each_col(): index out of bounds" ); arrayops::copy( p.colptr(col), A_mem, p_n_rows ); } } else // each row { for(uword i=0; i < N; ++i) { const uword row = indices_mem[i]; arma_conform_check_bounds( (row >= p_n_rows), "each_row(): index out of bounds" ); for(uword col=0; col < p_n_cols; ++col) { p.at(row,col) = A_mem[col]; } } } } template template inline void subview_each2::operator+= (const Base& in) { arma_debug_sigprint(); parent& p = access::rw(subview_each_common::P); const unwrap_check tmp( in.get_ref(), (*this).get_mat_ref() ); const Mat& A = tmp.M; subview_each_common::check_size(A); const unwrap_check_mixed U( base_indices.get_ref(), (*this).get_mat_ref() ); check_indices(U.M); const uword p_n_rows = p.n_rows; const uword p_n_cols = p.n_cols; const uword* indices_mem = U.M.memptr(); const uword N = U.M.n_elem; if(mode == 0) // each column { const eT* A_mem = A.memptr(); for(uword i=0; i < N; ++i) { const uword col = indices_mem[i]; arma_conform_check_bounds( (col >= p_n_cols), "each_col(): index out of bounds" ); arrayops::inplace_plus( p.colptr(col), A_mem, p_n_rows ); } } else // each row { for(uword i=0; i < N; ++i) { const uword row = indices_mem[i]; arma_conform_check_bounds( (row >= p_n_rows), "each_row(): index out of bounds" ); p.row(row) += A; } } } template template inline void subview_each2::operator-= (const Base& in) { arma_debug_sigprint(); parent& p = access::rw(subview_each_common::P); const unwrap_check tmp( in.get_ref(), (*this).get_mat_ref() ); const Mat& A = tmp.M; subview_each_common::check_size(A); const unwrap_check_mixed U( base_indices.get_ref(), (*this).get_mat_ref() ); check_indices(U.M); const uword p_n_rows = p.n_rows; const uword p_n_cols = p.n_cols; const uword* indices_mem = U.M.memptr(); const uword N = U.M.n_elem; if(mode == 0) // each column { const eT* A_mem = A.memptr(); for(uword i=0; i < N; ++i) { const uword col = indices_mem[i]; arma_conform_check_bounds( (col >= p_n_cols), "each_col(): index out of bounds" ); arrayops::inplace_minus( p.colptr(col), A_mem, p_n_rows ); } } else // each row { for(uword i=0; i < N; ++i) { const uword row = indices_mem[i]; arma_conform_check_bounds( (row >= p_n_rows), "each_row(): index out of bounds" ); p.row(row) -= A; } } } template template inline void subview_each2::operator%= (const Base& in) { arma_debug_sigprint(); parent& p = access::rw(subview_each_common::P); const unwrap_check tmp( in.get_ref(), (*this).get_mat_ref() ); const Mat& A = tmp.M; subview_each_common::check_size(A); const unwrap_check_mixed U( base_indices.get_ref(), (*this).get_mat_ref() ); check_indices(U.M); const uword p_n_rows = p.n_rows; const uword p_n_cols = p.n_cols; const uword* indices_mem = U.M.memptr(); const uword N = U.M.n_elem; if(mode == 0) // each column { const eT* A_mem = A.memptr(); for(uword i=0; i < N; ++i) { const uword col = indices_mem[i]; arma_conform_check_bounds( (col >= p_n_cols), "each_col(): index out of bounds" ); arrayops::inplace_mul( p.colptr(col), A_mem, p_n_rows ); } } else // each row { for(uword i=0; i < N; ++i) { const uword row = indices_mem[i]; arma_conform_check_bounds( (row >= p_n_rows), "each_row(): index out of bounds" ); p.row(row) %= A; } } } template template inline void subview_each2::operator/= (const Base& in) { arma_debug_sigprint(); parent& p = access::rw(subview_each_common::P); const unwrap_check tmp( in.get_ref(), (*this).get_mat_ref() ); const Mat& A = tmp.M; subview_each_common::check_size(A); const unwrap_check_mixed U( base_indices.get_ref(), (*this).get_mat_ref() ); check_indices(U.M); const uword p_n_rows = p.n_rows; const uword p_n_cols = p.n_cols; const uword* indices_mem = U.M.memptr(); const uword N = U.M.n_elem; if(mode == 0) // each column { const eT* A_mem = A.memptr(); for(uword i=0; i < N; ++i) { const uword col = indices_mem[i]; arma_conform_check_bounds( (col >= p_n_cols), "each_col(): index out of bounds" ); arrayops::inplace_div( p.colptr(col), A_mem, p_n_rows ); } } else // each row { for(uword i=0; i < N; ++i) { const uword row = indices_mem[i]; arma_conform_check_bounds( (row >= p_n_rows), "each_row(): index out of bounds" ); p.row(row) /= A; } } } // // // subview_each1_aux template inline Mat subview_each1_aux::operator_plus ( const subview_each1& X, const Base& Y ) { arma_debug_sigprint(); typedef typename parent::elem_type eT; const parent& p = X.P; const uword p_n_rows = p.n_rows; const uword p_n_cols = p.n_cols; Mat out(p_n_rows, p_n_cols, arma_nozeros_indicator()); const quasi_unwrap tmp(Y.get_ref()); const Mat& A = tmp.M; X.check_size(A); const eT* A_mem = A.memptr(); if(mode == 0) // each column { for(uword i=0; i < p_n_cols; ++i) { const eT* p_mem = p.colptr(i); eT* out_mem = out.colptr(i); for(uword row=0; row < p_n_rows; ++row) { out_mem[row] = p_mem[row] + A_mem[row]; } } } if(mode == 1) // each row { for(uword i=0; i < p_n_cols; ++i) { const eT* p_mem = p.colptr(i); eT* out_mem = out.colptr(i); const eT A_val = A_mem[i]; for(uword row=0; row < p_n_rows; ++row) { out_mem[row] = p_mem[row] + A_val; } } } return out; } template inline Mat subview_each1_aux::operator_minus ( const subview_each1& X, const Base& Y ) { arma_debug_sigprint(); typedef typename parent::elem_type eT; const parent& p = X.P; const uword p_n_rows = p.n_rows; const uword p_n_cols = p.n_cols; Mat out(p_n_rows, p_n_cols, arma_nozeros_indicator()); const quasi_unwrap tmp(Y.get_ref()); const Mat& A = tmp.M; X.check_size(A); const eT* A_mem = A.memptr(); if(mode == 0) // each column { for(uword i=0; i < p_n_cols; ++i) { const eT* p_mem = p.colptr(i); eT* out_mem = out.colptr(i); for(uword row=0; row < p_n_rows; ++row) { out_mem[row] = p_mem[row] - A_mem[row]; } } } if(mode == 1) // each row { for(uword i=0; i < p_n_cols; ++i) { const eT* p_mem = p.colptr(i); eT* out_mem = out.colptr(i); const eT A_val = A_mem[i]; for(uword row=0; row < p_n_rows; ++row) { out_mem[row] = p_mem[row] - A_val; } } } return out; } template inline Mat subview_each1_aux::operator_minus ( const Base& X, const subview_each1& Y ) { arma_debug_sigprint(); typedef typename parent::elem_type eT; const parent& p = Y.P; const uword p_n_rows = p.n_rows; const uword p_n_cols = p.n_cols; Mat out(p_n_rows, p_n_cols, arma_nozeros_indicator()); const quasi_unwrap tmp(X.get_ref()); const Mat& A = tmp.M; Y.check_size(A); const eT* A_mem = A.memptr(); if(mode == 0) // each column { for(uword i=0; i < p_n_cols; ++i) { const eT* p_mem = p.colptr(i); eT* out_mem = out.colptr(i); for(uword row=0; row < p_n_rows; ++row) { out_mem[row] = A_mem[row] - p_mem[row]; } } } if(mode == 1) // each row { for(uword i=0; i < p_n_cols; ++i) { const eT* p_mem = p.colptr(i); eT* out_mem = out.colptr(i); const eT A_val = A_mem[i]; for(uword row=0; row < p_n_rows; ++row) { out_mem[row] = A_val - p_mem[row]; } } } return out; } template inline Mat subview_each1_aux::operator_schur ( const subview_each1& X, const Base& Y ) { arma_debug_sigprint(); typedef typename parent::elem_type eT; const parent& p = X.P; const uword p_n_rows = p.n_rows; const uword p_n_cols = p.n_cols; Mat out(p_n_rows, p_n_cols, arma_nozeros_indicator()); const quasi_unwrap tmp(Y.get_ref()); const Mat& A = tmp.M; X.check_size(A); const eT* A_mem = A.memptr(); if(mode == 0) // each column { for(uword i=0; i < p_n_cols; ++i) { const eT* p_mem = p.colptr(i); eT* out_mem = out.colptr(i); for(uword row=0; row < p_n_rows; ++row) { out_mem[row] = p_mem[row] * A_mem[row]; } } } if(mode == 1) // each row { for(uword i=0; i < p_n_cols; ++i) { const eT* p_mem = p.colptr(i); eT* out_mem = out.colptr(i); const eT A_val = A_mem[i]; for(uword row=0; row < p_n_rows; ++row) { out_mem[row] = p_mem[row] * A_val; } } } return out; } template inline Mat subview_each1_aux::operator_div ( const subview_each1& X, const Base& Y ) { arma_debug_sigprint(); typedef typename parent::elem_type eT; const parent& p = X.P; const uword p_n_rows = p.n_rows; const uword p_n_cols = p.n_cols; Mat out(p_n_rows, p_n_cols, arma_nozeros_indicator()); const quasi_unwrap tmp(Y.get_ref()); const Mat& A = tmp.M; X.check_size(A); const eT* A_mem = A.memptr(); if(mode == 0) // each column { for(uword i=0; i < p_n_cols; ++i) { const eT* p_mem = p.colptr(i); eT* out_mem = out.colptr(i); for(uword row=0; row < p_n_rows; ++row) { out_mem[row] = p_mem[row] / A_mem[row]; } } } if(mode == 1) // each row { for(uword i=0; i < p_n_cols; ++i) { const eT* p_mem = p.colptr(i); eT* out_mem = out.colptr(i); const eT A_val = A_mem[i]; for(uword row=0; row < p_n_rows; ++row) { out_mem[row] = p_mem[row] / A_val; } } } return out; } template inline Mat subview_each1_aux::operator_div ( const Base& X, const subview_each1& Y ) { arma_debug_sigprint(); typedef typename parent::elem_type eT; const parent& p = Y.P; const uword p_n_rows = p.n_rows; const uword p_n_cols = p.n_cols; Mat out(p_n_rows, p_n_cols, arma_nozeros_indicator()); const quasi_unwrap tmp(X.get_ref()); const Mat& A = tmp.M; Y.check_size(A); const eT* A_mem = A.memptr(); if(mode == 0) // each column { for(uword i=0; i < p_n_cols; ++i) { const eT* p_mem = p.colptr(i); eT* out_mem = out.colptr(i); for(uword row=0; row < p_n_rows; ++row) { out_mem[row] = A_mem[row] / p_mem[row]; } } } if(mode == 1) // each row { for(uword i=0; i < p_n_cols; ++i) { const eT* p_mem = p.colptr(i); eT* out_mem = out.colptr(i); const eT A_val = A_mem[i]; for(uword row=0; row < p_n_rows; ++row) { out_mem[row] = A_val / p_mem[row]; } } } return out; } // // // subview_each2_aux template inline Mat subview_each2_aux::operator_plus ( const subview_each2& X, const Base& Y ) { arma_debug_sigprint(); typedef typename parent::elem_type eT; const parent& p = X.P; const uword p_n_rows = p.n_rows; const uword p_n_cols = p.n_cols; Mat out = p; const quasi_unwrap tmp(Y.get_ref()); const Mat& A = tmp.M; const unwrap U(X.base_indices.get_ref()); X.check_size(A); X.check_indices(U.M); const uword* indices_mem = U.M.memptr(); const uword N = U.M.n_elem; if(mode == 0) // process columns { const eT* A_mem = A.memptr(); for(uword i=0; i < N; ++i) { const uword col = indices_mem[i]; arma_conform_check_bounds( (col >= p_n_cols), "each_col(): index out of bounds" ); arrayops::inplace_plus( out.colptr(col), A_mem, p_n_rows ); } } if(mode == 1) // process rows { for(uword i=0; i < N; ++i) { const uword row = indices_mem[i]; arma_conform_check_bounds( (row >= p_n_rows), "each_row(): index out of bounds" ); out.row(row) += A; } } return out; } template inline Mat subview_each2_aux::operator_minus ( const subview_each2& X, const Base& Y ) { arma_debug_sigprint(); typedef typename parent::elem_type eT; const parent& p = X.P; const uword p_n_rows = p.n_rows; const uword p_n_cols = p.n_cols; Mat out = p; const quasi_unwrap tmp(Y.get_ref()); const Mat& A = tmp.M; const unwrap U(X.base_indices.get_ref()); X.check_size(A); X.check_indices(U.M); const uword* indices_mem = U.M.memptr(); const uword N = U.M.n_elem; if(mode == 0) // process columns { const eT* A_mem = A.memptr(); for(uword i=0; i < N; ++i) { const uword col = indices_mem[i]; arma_conform_check_bounds( (col >= p_n_cols), "each_col(): index out of bounds" ); arrayops::inplace_minus( out.colptr(col), A_mem, p_n_rows ); } } if(mode == 1) // process rows { for(uword i=0; i < N; ++i) { const uword row = indices_mem[i]; arma_conform_check_bounds( (row >= p_n_rows), "each_row(): index out of bounds" ); out.row(row) -= A; } } return out; } template inline Mat subview_each2_aux::operator_minus ( const Base& X, const subview_each2& Y ) { arma_debug_sigprint(); typedef typename parent::elem_type eT; const parent& p = Y.P; const uword p_n_rows = p.n_rows; const uword p_n_cols = p.n_cols; Mat out = p; const quasi_unwrap tmp(X.get_ref()); const Mat& A = tmp.M; const unwrap U(Y.base_indices.get_ref()); Y.check_size(A); Y.check_indices(U.M); const uword* indices_mem = U.M.memptr(); const uword N = U.M.n_elem; if(mode == 0) // process columns { const eT* A_mem = A.memptr(); for(uword i=0; i < N; ++i) { const uword col = indices_mem[i]; arma_conform_check_bounds( (col >= p_n_cols), "each_col(): index out of bounds" ); const eT* p_mem = p.colptr(col); eT* out_mem = out.colptr(col); for(uword row=0; row < p_n_rows; ++row) { out_mem[row] = A_mem[row] - p_mem[row]; } } } if(mode == 1) // process rows { for(uword i=0; i < N; ++i) { const uword row = indices_mem[i]; arma_conform_check_bounds( (row >= p_n_rows), "each_row(): index out of bounds" ); out.row(row) = A - p.row(row); } } return out; } template inline Mat subview_each2_aux::operator_schur ( const subview_each2& X, const Base& Y ) { arma_debug_sigprint(); typedef typename parent::elem_type eT; const parent& p = X.P; const uword p_n_rows = p.n_rows; const uword p_n_cols = p.n_cols; Mat out = p; const quasi_unwrap tmp(Y.get_ref()); const Mat& A = tmp.M; const unwrap U(X.base_indices.get_ref()); X.check_size(A); X.check_indices(U.M); const uword* indices_mem = U.M.memptr(); const uword N = U.M.n_elem; if(mode == 0) // process columns { const eT* A_mem = A.memptr(); for(uword i=0; i < N; ++i) { const uword col = indices_mem[i]; arma_conform_check_bounds( (col >= p_n_cols), "each_col(): index out of bounds" ); arrayops::inplace_mul( out.colptr(col), A_mem, p_n_rows ); } } if(mode == 1) // process rows { for(uword i=0; i < N; ++i) { const uword row = indices_mem[i]; arma_conform_check_bounds( (row >= p_n_rows), "each_row(): index out of bounds" ); out.row(row) %= A; } } return out; } template inline Mat subview_each2_aux::operator_div ( const subview_each2& X, const Base& Y ) { arma_debug_sigprint(); typedef typename parent::elem_type eT; const parent& p = X.P; const uword p_n_rows = p.n_rows; const uword p_n_cols = p.n_cols; Mat out = p; const quasi_unwrap tmp(Y.get_ref()); const Mat& A = tmp.M; const unwrap U(X.base_indices.get_ref()); X.check_size(A); X.check_indices(U.M); const uword* indices_mem = U.M.memptr(); const uword N = U.M.n_elem; if(mode == 0) // process columns { const eT* A_mem = A.memptr(); for(uword i=0; i < N; ++i) { const uword col = indices_mem[i]; arma_conform_check_bounds( (col >= p_n_cols), "each_col(): index out of bounds" ); arrayops::inplace_div( out.colptr(col), A_mem, p_n_rows ); } } if(mode == 1) // process rows { for(uword i=0; i < N; ++i) { const uword row = indices_mem[i]; arma_conform_check_bounds( (row >= p_n_rows), "each_row(): index out of bounds" ); out.row(row) /= A; } } return out; } template inline Mat subview_each2_aux::operator_div ( const Base& X, const subview_each2& Y ) { arma_debug_sigprint(); typedef typename parent::elem_type eT; const parent& p = Y.P; const uword p_n_rows = p.n_rows; const uword p_n_cols = p.n_cols; Mat out = p; const quasi_unwrap tmp(X.get_ref()); const Mat& A = tmp.M; const unwrap U(Y.base_indices.get_ref()); Y.check_size(A); Y.check_indices(U.M); const uword* indices_mem = U.M.memptr(); const uword N = U.M.n_elem; if(mode == 0) // process columns { const eT* A_mem = A.memptr(); for(uword i=0; i < N; ++i) { const uword col = indices_mem[i]; arma_conform_check_bounds( (col >= p_n_cols), "each_col(): index out of bounds" ); const eT* p_mem = p.colptr(col); eT* out_mem = out.colptr(col); for(uword row=0; row < p_n_rows; ++row) { out_mem[row] = A_mem[row] / p_mem[row]; } } } if(mode == 1) // process rows { for(uword i=0; i < N; ++i) { const uword row = indices_mem[i]; arma_conform_check_bounds( (row >= p_n_rows), "each_row(): index out of bounds" ); out.row(row) = A / p.row(row); } } return out; } //! @} RcppArmadillo/inst/include/armadillo_bits/fill.hpp0000644000176200001440000001222414374704744022046 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fill //! @{ namespace fill { struct fill_none {}; struct fill_zeros {}; struct fill_ones {}; struct fill_eye {}; struct fill_randu {}; struct fill_randn {}; template struct fill_class { inline constexpr fill_class() {} }; static constexpr fill_class none; static constexpr fill_class zeros; static constexpr fill_class ones; static constexpr fill_class eye; static constexpr fill_class randu; static constexpr fill_class randn; // template struct allow_conversion { static constexpr bool value = true; }; template<> struct allow_conversion, double> { static constexpr bool value = false; }; template<> struct allow_conversion, float > { static constexpr bool value = false; }; template<> struct allow_conversion, u64 > { static constexpr bool value = false; }; template<> struct allow_conversion, s64 > { static constexpr bool value = false; }; template<> struct allow_conversion, u32 > { static constexpr bool value = false; }; template<> struct allow_conversion, s32 > { static constexpr bool value = false; }; template<> struct allow_conversion, u16 > { static constexpr bool value = false; }; template<> struct allow_conversion, s16 > { static constexpr bool value = false; }; template<> struct allow_conversion, u8 > { static constexpr bool value = false; }; template<> struct allow_conversion, s8 > { static constexpr bool value = false; }; template<> struct allow_conversion, double> { static constexpr bool value = false; }; template<> struct allow_conversion, float > { static constexpr bool value = false; }; template<> struct allow_conversion, u64 > { static constexpr bool value = false; }; template<> struct allow_conversion, s64 > { static constexpr bool value = false; }; template<> struct allow_conversion, u32 > { static constexpr bool value = false; }; template<> struct allow_conversion, s32 > { static constexpr bool value = false; }; template<> struct allow_conversion, u16 > { static constexpr bool value = false; }; template<> struct allow_conversion, s16 > { static constexpr bool value = false; }; template<> struct allow_conversion, u8 > { static constexpr bool value = false; }; template<> struct allow_conversion, s8 > { static constexpr bool value = false; }; // template inline bool isfinite_wrapper(eT ) { return true; } template<> inline bool isfinite_wrapper(float x) { return std::isfinite(x); } template<> inline bool isfinite_wrapper(double x) { return std::isfinite(x); } template inline bool isfinite_wrapper(std::complex& x) { return std::isfinite(x.real()) && std::isfinite(x.imag()); } // template struct scalar_holder { const scalar_type1 scalar; inline explicit scalar_holder(const scalar_type1& in_scalar) : scalar(in_scalar) {} inline scalar_holder() = delete; template < typename scalar_type2, typename arma::enable_if2::value, int>::result = 0 > inline operator scalar_holder() const { const bool ok_conversion = (std::is_integral::value && std::is_floating_point::value) ? isfinite_wrapper(scalar) : true; return scalar_holder( ok_conversion ? scalar_type2(scalar) : scalar_type2(0) ); } }; // template inline typename enable_if2< is_supported_elem_type::value, scalar_holder >::result value(const scalar_type& in_scalar) { return scalar_holder(in_scalar); } } //! @} RcppArmadillo/inst/include/armadillo_bits/debug.hpp0000644000176200001440000010525614635324415022207 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup debug //! @{ inline std::ostream& get_cout_stream() { return (ARMA_COUT_STREAM); } inline std::ostream& get_cerr_stream() { return (ARMA_CERR_STREAM); } arma_deprecated inline std::ostream& get_stream_err1() { return get_cerr_stream(); } arma_deprecated inline std::ostream& get_stream_err2() { return get_cerr_stream(); } arma_frown("this function does nothing; instead use ARMA_COUT_STREAM or ARMA_WARN_LEVEL; see documentation") inline void set_cout_stream(const std::ostream&) { } arma_frown("this function does nothing; instead use ARMA_CERR_STREAM or ARMA_WARN_LEVEL; see documentation") inline void set_cerr_stream(const std::ostream&) { } arma_frown("this function does nothing; instead use ARMA_CERR_STREAM or ARMA_WARN_LEVEL; see documentation") inline void set_stream_err1(const std::ostream&) { } arma_frown("this function does nothing; instead use ARMA_CERR_STREAM or ARMA_WARN_LEVEL; see documentation") inline void set_stream_err2(const std::ostream&) { } template arma_frown("this function does nothing; instead use ARMA_COUT_STREAM or ARMA_WARN_LEVEL; see documentation") inline std::ostream& arma_cout_stream(std::ostream*) { return (ARMA_COUT_STREAM); } template arma_frown("this function does nothing; instead use ARMA_CERR_STREAM or ARMA_WARN_LEVEL; see documentation") inline std::ostream& arma_cerr_stream(std::ostream*) { return (ARMA_CERR_STREAM); } //! print a message to get_cerr_stream() and throw logic_error exception template arma_cold arma_noinline static void arma_stop_logic_error(const T1& x) { #if defined(ARMA_PRINT_EXCEPTIONS) { get_cerr_stream() << "\nerror: " << x << std::endl; } #endif throw std::logic_error( std::string(x) ); } arma_cold arma_noinline static void arma_stop_logic_error(const char* x, const char* y) { arma_stop_logic_error( std::string(x) + std::string(y) ); } //! print a message to get_cerr_stream() and throw out_of_range exception template arma_cold arma_noinline static void arma_stop_bounds_error(const T1& x) { #if defined(ARMA_PRINT_EXCEPTIONS) { get_cerr_stream() << "\nerror: " << x << std::endl; } #endif throw std::out_of_range( std::string(x) ); } //! print a message to get_cerr_stream() and throw bad_alloc exception template arma_cold arma_noinline static void arma_stop_bad_alloc(const T1& x) { #if defined(ARMA_PRINT_EXCEPTIONS) { get_cerr_stream() << "\nerror: " << x << std::endl; } #else { arma_ignore(x); } #endif throw std::bad_alloc(); } //! print a message to get_cerr_stream() and throw runtime_error exception template arma_cold arma_noinline static void arma_stop_runtime_error(const T1& x) { #if defined(ARMA_PRINT_EXCEPTIONS) { get_cerr_stream() << "\nerror: " << x << std::endl; } #endif throw std::runtime_error( std::string(x) ); } // // arma_print arma_cold inline void arma_print() { get_cerr_stream() << std::endl; } template arma_cold arma_noinline static void arma_print(const T1& x) { get_cerr_stream() << x << std::endl; } template arma_cold arma_noinline static void arma_print(const T1& x, const T2& y) { get_cerr_stream() << x << y << std::endl; } template arma_cold arma_noinline static void arma_print(const T1& x, const T2& y, const T3& z) { get_cerr_stream() << x << y << z << std::endl; } // // arma_sigprint //! print a message to the cerr stream with a preceding @ character. //! used for printing the signature of a function //! (see the arma_debug_sigprint macro) inline void arma_sigprint(const char* x) { get_cerr_stream() << "@ " << x; } // // arma_bktprint inline void arma_bktprint() { get_cerr_stream() << std::endl; } template inline void arma_bktprint(const T1& x) { get_cerr_stream() << " [" << x << ']' << std::endl; } template inline void arma_bktprint(const T1& x, const T2& y) { get_cerr_stream() << " [" << x << y << ']' << std::endl; } // // arma_thisprint inline void arma_thisprint(const void* this_ptr) { get_cerr_stream() << " [this: " << this_ptr << ']' << std::endl; } // // arma_plain_warn //! print a message to the warn stream template arma_cold arma_noinline static void arma_plain_warn(const T1& arg1) { get_cerr_stream() << "\nwarning: " << arg1 << std::endl; } template arma_cold arma_noinline static void arma_plain_warn(const T1& arg1, const T2& arg2) { get_cerr_stream() << "\nwarning: " << arg1 << arg2 << std::endl; } template arma_cold arma_noinline static void arma_plain_warn(const T1& arg1, const T2& arg2, const T3& arg3) { get_cerr_stream() << "\nwarning: " << arg1 << arg2 << arg3 << std::endl; } template arma_cold arma_noinline static void arma_plain_warn(const T1& arg1, const T2& arg2, const T3& arg3, const T4& arg4) { get_cerr_stream() << "\nwarning: " << arg1 << arg2 << arg3 << arg4 << std::endl; } // // arma_warn template inline void arma_warn(const uword level, const T1& arg1) { constexpr uword config_level = (sword(ARMA_WARN_LEVEL) > 0) ? uword(ARMA_WARN_LEVEL) : uword(0); if((config_level > 0) && (level <= config_level)) { arma_plain_warn(arg1); } } template inline void arma_warn(const uword level, const T1& arg1, const T2& arg2) { constexpr uword config_level = (sword(ARMA_WARN_LEVEL) > 0) ? uword(ARMA_WARN_LEVEL) : uword(0); if((config_level > 0) && (level <= config_level)) { arma_plain_warn(arg1,arg2); } } template inline void arma_warn(const uword level, const T1& arg1, const T2& arg2, const T3& arg3) { constexpr uword config_level = (sword(ARMA_WARN_LEVEL) > 0) ? uword(ARMA_WARN_LEVEL) : uword(0); if((config_level > 0) && (level <= config_level)) { arma_plain_warn(arg1,arg2,arg3); } } template inline void arma_warn(const uword level, const T1& arg1, const T2& arg2, const T3& arg3, const T4& arg4) { constexpr uword config_level = (sword(ARMA_WARN_LEVEL) > 0) ? uword(ARMA_WARN_LEVEL) : uword(0); if((config_level > 0) && (level <= config_level)) { arma_plain_warn(arg1,arg2,arg3,arg4); } } // // arma_check //! if state is true, abort program template arma_hot inline void arma_check(const bool state, const T1& x) { if(state) { arma_stop_logic_error(arma_str::str_wrapper(x)); } } template arma_hot inline void arma_check(const bool state, const char* x, const Functor& fn) { if(state) { fn(); arma_stop_logic_error(x); } } arma_hot inline void arma_check(const bool state, const char* x, const char* y) { if(state) { arma_stop_logic_error(x,y); } } template arma_hot inline void arma_check(const bool state, const char* x, const char* y, const Functor& fn) { if(state) { fn(); arma_stop_logic_error(x,y); } } template arma_hot inline void arma_check_bounds(const bool state, const T1& x) { if(state) { arma_stop_bounds_error(arma_str::str_wrapper(x)); } } template arma_hot inline void arma_check_bad_alloc(const bool state, const T1& x) { if(state) { arma_stop_bad_alloc(x); } } // // arma_set_error arma_hot arma_inline void arma_set_error(bool& err_state, char*& err_msg, const bool expression, const char* message) { if(expression) { err_state = true; err_msg = const_cast(message); } } // // functions for generating strings indicating size errors arma_cold arma_noinline static std::string arma_incompat_size_string(const uword A_n_rows, const uword A_n_cols, const uword B_n_rows, const uword B_n_cols, const char* x) { std::ostringstream tmp; tmp << x << ": incompatible matrix dimensions: " << A_n_rows << 'x' << A_n_cols << " and " << B_n_rows << 'x' << B_n_cols; return tmp.str(); } arma_cold arma_noinline static std::string arma_incompat_size_string(const uword A_n_rows, const uword A_n_cols, const uword A_n_slices, const uword B_n_rows, const uword B_n_cols, const uword B_n_slices, const char* x) { std::ostringstream tmp; tmp << x << ": incompatible cube dimensions: " << A_n_rows << 'x' << A_n_cols << 'x' << A_n_slices << " and " << B_n_rows << 'x' << B_n_cols << 'x' << B_n_slices; return tmp.str(); } template arma_cold arma_noinline static std::string arma_incompat_size_string(const subview_cube& Q, const Mat& A, const char* x) { std::ostringstream tmp; tmp << x << ": interpreting matrix as cube with dimensions: " << A.n_rows << 'x' << A.n_cols << 'x' << 1 << " or " << A.n_rows << 'x' << 1 << 'x' << A.n_cols << " or " << 1 << 'x' << A.n_rows << 'x' << A.n_cols << " is incompatible with cube dimensions: " << Q.n_rows << 'x' << Q.n_cols << 'x' << Q.n_slices; return tmp.str(); } // // functions for checking whether two dense matrices have the same dimensions arma_hot arma_inline void arma_assert_same_size(const uword A_n_rows, const uword A_n_cols, const uword B_n_rows, const uword B_n_cols, const char* x) { if( (A_n_rows != B_n_rows) || (A_n_cols != B_n_cols) ) { arma_stop_logic_error( arma_incompat_size_string(A_n_rows, A_n_cols, B_n_rows, B_n_cols, x) ); } } //! stop if given matrices do not have the same size template arma_hot inline void arma_assert_same_size(const Mat& A, const Mat& B, const char* x) { const uword A_n_rows = A.n_rows; const uword A_n_cols = A.n_cols; const uword B_n_rows = B.n_rows; const uword B_n_cols = B.n_cols; if( (A_n_rows != B_n_rows) || (A_n_cols != B_n_cols) ) { arma_stop_logic_error( arma_incompat_size_string(A_n_rows, A_n_cols, B_n_rows, B_n_cols, x) ); } } //! stop if given proxies do not have the same size template arma_hot inline void arma_assert_same_size(const Proxy& A, const Proxy& B, const char* x) { const uword A_n_rows = A.get_n_rows(); const uword A_n_cols = A.get_n_cols(); const uword B_n_rows = B.get_n_rows(); const uword B_n_cols = B.get_n_cols(); if( (A_n_rows != B_n_rows) || (A_n_cols != B_n_cols) ) { arma_stop_logic_error( arma_incompat_size_string(A_n_rows, A_n_cols, B_n_rows, B_n_cols, x) ); } } template arma_hot inline void arma_assert_same_size(const subview& A, const subview& B, const char* x) { const uword A_n_rows = A.n_rows; const uword A_n_cols = A.n_cols; const uword B_n_rows = B.n_rows; const uword B_n_cols = B.n_cols; if( (A_n_rows != B_n_rows) || (A_n_cols != B_n_cols) ) { arma_stop_logic_error( arma_incompat_size_string(A_n_rows, A_n_cols, B_n_rows, B_n_cols, x) ); } } template arma_hot inline void arma_assert_same_size(const Mat& A, const subview& B, const char* x) { const uword A_n_rows = A.n_rows; const uword A_n_cols = A.n_cols; const uword B_n_rows = B.n_rows; const uword B_n_cols = B.n_cols; if( (A_n_rows != B_n_rows) || (A_n_cols != B_n_cols) ) { arma_stop_logic_error( arma_incompat_size_string(A_n_rows, A_n_cols, B_n_rows, B_n_cols, x) ); } } template arma_hot inline void arma_assert_same_size(const subview& A, const Mat& B, const char* x) { const uword A_n_rows = A.n_rows; const uword A_n_cols = A.n_cols; const uword B_n_rows = B.n_rows; const uword B_n_cols = B.n_cols; if( (A_n_rows != B_n_rows) || (A_n_cols != B_n_cols) ) { arma_stop_logic_error( arma_incompat_size_string(A_n_rows, A_n_cols, B_n_rows, B_n_cols, x) ); } } template arma_hot inline void arma_assert_same_size(const Mat& A, const Proxy& B, const char* x) { const uword A_n_rows = A.n_rows; const uword A_n_cols = A.n_cols; const uword B_n_rows = B.get_n_rows(); const uword B_n_cols = B.get_n_cols(); if( (A_n_rows != B_n_rows) || (A_n_cols != B_n_cols) ) { arma_stop_logic_error( arma_incompat_size_string(A_n_rows, A_n_cols, B_n_rows, B_n_cols, x) ); } } template arma_hot inline void arma_assert_same_size(const Proxy& A, const Mat& B, const char* x) { const uword A_n_rows = A.get_n_rows(); const uword A_n_cols = A.get_n_cols(); const uword B_n_rows = B.n_rows; const uword B_n_cols = B.n_cols; if( (A_n_rows != B_n_rows) || (A_n_cols != B_n_cols) ) { arma_stop_logic_error( arma_incompat_size_string(A_n_rows, A_n_cols, B_n_rows, B_n_cols, x) ); } } template arma_hot inline void arma_assert_same_size(const Proxy& A, const subview& B, const char* x) { const uword A_n_rows = A.get_n_rows(); const uword A_n_cols = A.get_n_cols(); const uword B_n_rows = B.n_rows; const uword B_n_cols = B.n_cols; if( (A_n_rows != B_n_rows) || (A_n_cols != B_n_cols) ) { arma_stop_logic_error( arma_incompat_size_string(A_n_rows, A_n_cols, B_n_rows, B_n_cols, x) ); } } template arma_hot inline void arma_assert_same_size(const subview& A, const Proxy& B, const char* x) { const uword A_n_rows = A.n_rows; const uword A_n_cols = A.n_cols; const uword B_n_rows = B.get_n_rows(); const uword B_n_cols = B.get_n_cols(); if( (A_n_rows != B_n_rows) || (A_n_cols != B_n_cols) ) { arma_stop_logic_error( arma_incompat_size_string(A_n_rows, A_n_cols, B_n_rows, B_n_cols, x) ); } } // // functions for checking whether two sparse matrices have the same dimensions template arma_hot inline void arma_assert_same_size(const SpMat& A, const SpMat& B, const char* x) { const uword A_n_rows = A.n_rows; const uword A_n_cols = A.n_cols; const uword B_n_rows = B.n_rows; const uword B_n_cols = B.n_cols; if( (A_n_rows != B_n_rows) || (A_n_cols != B_n_cols) ) { arma_stop_logic_error( arma_incompat_size_string(A_n_rows, A_n_cols, B_n_rows, B_n_cols, x) ); } } // // functions for checking whether two cubes have the same dimensions arma_hot inline void arma_assert_same_size(const uword A_n_rows, const uword A_n_cols, const uword A_n_slices, const uword B_n_rows, const uword B_n_cols, const uword B_n_slices, const char* x) { if( (A_n_rows != B_n_rows) || (A_n_cols != B_n_cols) || (A_n_slices != B_n_slices) ) { arma_stop_logic_error( arma_incompat_size_string(A_n_rows, A_n_cols, A_n_slices, B_n_rows, B_n_cols, B_n_slices, x) ); } } //! stop if given cubes do not have the same size template arma_hot inline void arma_assert_same_size(const Cube& A, const Cube& B, const char* x) { if( (A.n_rows != B.n_rows) || (A.n_cols != B.n_cols) || (A.n_slices != B.n_slices) ) { arma_stop_logic_error( arma_incompat_size_string(A.n_rows, A.n_cols, A.n_slices, B.n_rows, B.n_cols, B.n_slices, x) ); } } template arma_hot inline void arma_assert_same_size(const Cube& A, const subview_cube& B, const char* x) { if( (A.n_rows != B.n_rows) || (A.n_cols != B.n_cols) || (A.n_slices != B.n_slices) ) { arma_stop_logic_error( arma_incompat_size_string(A.n_rows, A.n_cols, A.n_slices, B.n_rows, B.n_cols, B.n_slices, x) ); } } template arma_hot inline void arma_assert_same_size(const subview_cube& A, const Cube& B, const char* x) { if( (A.n_rows != B.n_rows) || (A.n_cols != B.n_cols) || (A.n_slices != B.n_slices) ) { arma_stop_logic_error( arma_incompat_size_string(A.n_rows, A.n_cols, A.n_slices, B.n_rows, B.n_cols, B.n_slices, x) ); } } template arma_hot inline void arma_assert_same_size(const subview_cube& A, const subview_cube& B, const char* x) { if( (A.n_rows != B.n_rows) || (A.n_cols != B.n_cols) || (A.n_slices != B.n_slices)) { arma_stop_logic_error( arma_incompat_size_string(A.n_rows, A.n_cols, A.n_slices, B.n_rows, B.n_cols, B.n_slices, x) ); } } template arma_hot inline void arma_assert_same_size(const subview_cube& A, const ProxyCube& B, const char* x) { const uword A_n_rows = A.n_rows; const uword A_n_cols = A.n_cols; const uword A_n_slices = A.n_slices; const uword B_n_rows = B.get_n_rows(); const uword B_n_cols = B.get_n_cols(); const uword B_n_slices = B.get_n_slices(); if( (A_n_rows != B_n_rows) || (A_n_cols != B_n_cols) || (A_n_slices != B_n_slices) ) { arma_stop_logic_error( arma_incompat_size_string(A_n_rows, A_n_cols, A_n_slices, B_n_rows, B_n_cols, B_n_slices, x) ); } } //! stop if given cube proxies do not have the same size template arma_hot inline void arma_assert_same_size(const ProxyCube& A, const ProxyCube& B, const char* x) { const uword A_n_rows = A.get_n_rows(); const uword A_n_cols = A.get_n_cols(); const uword A_n_slices = A.get_n_slices(); const uword B_n_rows = B.get_n_rows(); const uword B_n_cols = B.get_n_cols(); const uword B_n_slices = B.get_n_slices(); if( (A_n_rows != B_n_rows) || (A_n_cols != B_n_cols) || (A_n_slices != B_n_slices)) { arma_stop_logic_error( arma_incompat_size_string(A_n_rows, A_n_cols, A_n_slices, B_n_rows, B_n_cols, B_n_slices, x) ); } } // // functions for checking whether a cube or subcube can be interpreted as a matrix (ie. single slice) template arma_hot inline void arma_assert_same_size(const Cube& A, const Mat& B, const char* x) { if( (A.n_rows != B.n_rows) || (A.n_cols != B.n_cols) || (A.n_slices != 1) ) { arma_stop_logic_error( arma_incompat_size_string(A.n_rows, A.n_cols, A.n_slices, B.n_rows, B.n_cols, 1, x) ); } } template arma_hot inline void arma_assert_same_size(const Mat& A, const Cube& B, const char* x) { if( (A.n_rows != B.n_rows) || (A.n_cols != B.n_cols) || (1 != B.n_slices) ) { arma_stop_logic_error( arma_incompat_size_string(A.n_rows, A.n_cols, 1, B.n_rows, B.n_cols, B.n_slices, x) ); } } template arma_hot inline void arma_assert_same_size(const subview_cube& A, const Mat& B, const char* x) { if( (A.n_rows != B.n_rows) || (A.n_cols != B.n_cols) || (A.n_slices != 1) ) { arma_stop_logic_error( arma_incompat_size_string(A.n_rows, A.n_cols, A.n_slices, B.n_rows, B.n_cols, 1, x) ); } } template arma_hot inline void arma_assert_same_size(const Mat& A, const subview_cube& B, const char* x) { if( (A.n_rows != B.n_rows) || (A.n_cols != B.n_cols) || (1 != B.n_slices) ) { arma_stop_logic_error( arma_incompat_size_string(A.n_rows, A.n_cols, 1, B.n_rows, B.n_cols, B.n_slices, x) ); } } template inline void arma_assert_cube_as_mat(const Mat& M, const T1& Q, const char* x, const bool check_compat_size) { const uword Q_n_rows = Q.n_rows; const uword Q_n_cols = Q.n_cols; const uword Q_n_slices = Q.n_slices; const uword M_vec_state = M.vec_state; if(M_vec_state == 0) { if( ( (Q_n_rows == 1) || (Q_n_cols == 1) || (Q_n_slices == 1) ) == false ) { std::ostringstream tmp; tmp << x << ": can't interpret cube with dimensions " << Q_n_rows << 'x' << Q_n_cols << 'x' << Q_n_slices << " as a matrix; one of the dimensions must be 1"; arma_stop_logic_error( tmp.str() ); } } else { if(Q_n_slices == 1) { if( (M_vec_state == 1) && (Q_n_cols != 1) ) { std::ostringstream tmp; tmp << x << ": can't interpret cube with dimensions " << Q_n_rows << 'x' << Q_n_cols << 'x' << Q_n_slices << " as a column vector"; arma_stop_logic_error( tmp.str() ); } if( (M_vec_state == 2) && (Q_n_rows != 1) ) { std::ostringstream tmp; tmp << x << ": can't interpret cube with dimensions " << Q_n_rows << 'x' << Q_n_cols << 'x' << Q_n_slices << " as a row vector"; arma_stop_logic_error( tmp.str() ); } } else { if( (Q_n_cols != 1) && (Q_n_rows != 1) ) { std::ostringstream tmp; tmp << x << ": can't interpret cube with dimensions " << Q_n_rows << 'x' << Q_n_cols << 'x' << Q_n_slices << " as a vector"; arma_stop_logic_error( tmp.str() ); } } } if(check_compat_size) { const uword M_n_rows = M.n_rows; const uword M_n_cols = M.n_cols; if(M_vec_state == 0) { if( ( ( (Q_n_rows == M_n_rows) && (Q_n_cols == M_n_cols) ) || ( (Q_n_rows == M_n_rows) && (Q_n_slices == M_n_cols) ) || ( (Q_n_cols == M_n_rows) && (Q_n_slices == M_n_cols) ) ) == false ) { std::ostringstream tmp; tmp << x << ": can't interpret cube with dimensions " << Q_n_rows << 'x' << Q_n_cols << 'x' << Q_n_slices << " as a matrix with dimensions " << M_n_rows << 'x' << M_n_cols; arma_stop_logic_error( tmp.str() ); } } else { if(Q_n_slices == 1) { if( (M_vec_state == 1) && (Q_n_rows != M_n_rows) ) { std::ostringstream tmp; tmp << x << ": can't interpret cube with dimensions " << Q_n_rows << 'x' << Q_n_cols << 'x' << Q_n_slices << " as a column vector with dimensions " << M_n_rows << 'x' << M_n_cols; arma_stop_logic_error( tmp.str() ); } if( (M_vec_state == 2) && (Q_n_cols != M_n_cols) ) { std::ostringstream tmp; tmp << x << ": can't interpret cube with dimensions " << Q_n_rows << 'x' << Q_n_cols << 'x' << Q_n_slices << " as a row vector with dimensions " << M_n_rows << 'x' << M_n_cols; arma_stop_logic_error( tmp.str() ); } } else { if( ( (M_n_cols == Q_n_slices) || (M_n_rows == Q_n_slices) ) == false ) { std::ostringstream tmp; tmp << x << ": can't interpret cube with dimensions " << Q_n_rows << 'x' << Q_n_cols << 'x' << Q_n_slices << " as a vector with dimensions " << M_n_rows << 'x' << M_n_cols; arma_stop_logic_error( tmp.str() ); } } } } } // // functions for checking whether two matrices have dimensions that are compatible with the matrix multiply operation arma_hot inline void arma_assert_mul_size(const uword A_n_rows, const uword A_n_cols, const uword B_n_rows, const uword B_n_cols, const char* x) { if(A_n_cols != B_n_rows) { arma_stop_logic_error( arma_incompat_size_string(A_n_rows, A_n_cols, B_n_rows, B_n_cols, x) ); } } //! stop if given matrices are incompatible for multiplication template arma_hot inline void arma_assert_mul_size(const Mat& A, const Mat& B, const char* x) { const uword A_n_cols = A.n_cols; const uword B_n_rows = B.n_rows; if(A_n_cols != B_n_rows) { arma_stop_logic_error( arma_incompat_size_string(A.n_rows, A_n_cols, B_n_rows, B.n_cols, x) ); } } //! stop if given matrices are incompatible for multiplication template arma_hot inline void arma_assert_mul_size(const Mat& A, const Mat& B, const bool do_trans_A, const bool do_trans_B, const char* x) { const uword final_A_n_cols = (do_trans_A == false) ? A.n_cols : A.n_rows; const uword final_B_n_rows = (do_trans_B == false) ? B.n_rows : B.n_cols; if(final_A_n_cols != final_B_n_rows) { const uword final_A_n_rows = (do_trans_A == false) ? A.n_rows : A.n_cols; const uword final_B_n_cols = (do_trans_B == false) ? B.n_cols : B.n_rows; arma_stop_logic_error( arma_incompat_size_string(final_A_n_rows, final_A_n_cols, final_B_n_rows, final_B_n_cols, x) ); } } template arma_hot inline void arma_assert_trans_mul_size(const uword A_n_rows, const uword A_n_cols, const uword B_n_rows, const uword B_n_cols, const char* x) { const uword final_A_n_cols = (do_trans_A == false) ? A_n_cols : A_n_rows; const uword final_B_n_rows = (do_trans_B == false) ? B_n_rows : B_n_cols; if(final_A_n_cols != final_B_n_rows) { const uword final_A_n_rows = (do_trans_A == false) ? A_n_rows : A_n_cols; const uword final_B_n_cols = (do_trans_B == false) ? B_n_cols : B_n_rows; arma_stop_logic_error( arma_incompat_size_string(final_A_n_rows, final_A_n_cols, final_B_n_rows, final_B_n_cols, x) ); } } template arma_hot inline void arma_assert_mul_size(const Mat& A, const subview& B, const char* x) { if(A.n_cols != B.n_rows) { arma_stop_logic_error( arma_incompat_size_string(A.n_rows, A.n_cols, B.n_rows, B.n_cols, x) ); } } template arma_hot inline void arma_assert_mul_size(const subview& A, const Mat& B, const char* x) { if(A.n_cols != B.n_rows) { arma_stop_logic_error( arma_incompat_size_string(A.n_rows, A.n_cols, B.n_rows, B.n_cols, x) ); } } template arma_hot inline void arma_assert_mul_size(const subview& A, const subview& B, const char* x) { if(A.n_cols != B.n_rows) { arma_stop_logic_error( arma_incompat_size_string(A.n_rows, A.n_cols, B.n_rows, B.n_cols, x) ); } } template arma_hot inline void arma_assert_blas_size(const T1& A) { if(sizeof(uword) >= sizeof(blas_int)) { bool overflow; overflow = (A.n_rows > ARMA_MAX_BLAS_INT); overflow = (A.n_cols > ARMA_MAX_BLAS_INT) || overflow; if(overflow) { arma_stop_runtime_error("integer overflow: matrix dimensions are too large for integer type used by BLAS and LAPACK"); } } } template arma_hot inline void arma_assert_blas_size(const T1& A, const T2& B) { if(sizeof(uword) >= sizeof(blas_int)) { bool overflow; overflow = (A.n_rows > ARMA_MAX_BLAS_INT); overflow = (A.n_cols > ARMA_MAX_BLAS_INT) || overflow; overflow = (B.n_rows > ARMA_MAX_BLAS_INT) || overflow; overflow = (B.n_cols > ARMA_MAX_BLAS_INT) || overflow; if(overflow) { arma_stop_runtime_error("integer overflow: matrix dimensions are too large for integer type used by BLAS and LAPACK"); } } } // TODO: remove support for ATLAS in next major version template arma_hot inline void arma_assert_atlas_size(const T1& A) { if(sizeof(uword) >= sizeof(int)) { bool overflow; overflow = (A.n_rows > INT_MAX); overflow = (A.n_cols > INT_MAX) || overflow; if(overflow) { arma_stop_runtime_error("integer overflow: matrix dimensions are too large for integer type used by ATLAS"); } } } // TODO: remove support for ATLAS in next major version template arma_hot inline void arma_assert_atlas_size(const T1& A, const T2& B) { if(sizeof(uword) >= sizeof(int)) { bool overflow; overflow = (A.n_rows > INT_MAX); overflow = (A.n_cols > INT_MAX) || overflow; overflow = (B.n_rows > INT_MAX) || overflow; overflow = (B.n_cols > INT_MAX) || overflow; if(overflow) { arma_stop_runtime_error("integer overflow: matrix dimensions are too large for integer type used by ATLAS"); } } } // // macros // #define ARMA_STRING1(x) #x // #define ARMA_STRING2(x) ARMA_STRING1(x) // #define ARMA_FILELINE __FILE__ ": " ARMA_STRING2(__LINE__) #if defined(ARMA_CHECK_CONFORMANCE) #define arma_conform_check arma_check #define arma_conform_check_bounds arma_check_bounds #define arma_conform_set_error arma_set_error #define arma_conform_assert_same_size arma_assert_same_size #define arma_conform_assert_mul_size arma_assert_mul_size #define arma_conform_assert_trans_mul_size arma_assert_trans_mul_size #define arma_conform_assert_cube_as_mat arma_assert_cube_as_mat #define arma_conform_assert_blas_size arma_assert_blas_size #define arma_conform_assert_atlas_size arma_assert_atlas_size #else #define arma_conform_check true ? (void)0 : arma_check #define arma_conform_check_bounds true ? (void)0 : arma_check_bounds #define arma_conform_set_error true ? (void)0 : arma_set_error #define arma_conform_assert_same_size true ? (void)0 : arma_assert_same_size #define arma_conform_assert_mul_size true ? (void)0 : arma_assert_mul_size #define arma_conform_assert_trans_mul_size true ? (void)0 : arma_assert_trans_mul_size #define arma_conform_assert_cube_as_mat true ? (void)0 : arma_assert_cube_as_mat #define arma_conform_assert_blas_size true ? (void)0 : arma_assert_blas_size #define arma_conform_assert_atlas_size true ? (void)0 : arma_assert_atlas_size #endif #if defined(ARMA_DEBUG) #define arma_debug_sigprint arma_sigprint(ARMA_FNSIG); arma_bktprint #define arma_debug_sigprint_this arma_sigprint(ARMA_FNSIG); arma_thisprint #define arma_debug_print arma_print // for compatibility with earlier versions of Armadillo #define arma_extra_debug_sigprint arma_sigprint(ARMA_FNSIG); arma_bktprint #define arma_extra_debug_sigprint_this arma_sigprint(ARMA_FNSIG); arma_thisprint #define arma_extra_debug_print arma_print #else #define arma_debug_sigprint true ? (void)0 : arma_bktprint #define arma_debug_sigprint_this true ? (void)0 : arma_thisprint #define arma_debug_print true ? (void)0 : arma_print // for compatibility with earlier versions of Armadillo #define arma_extra_debug_sigprint true ? (void)0 : arma_bktprint #define arma_extra_debug_sigprint_this true ? (void)0 : arma_thisprint #define arma_extra_debug_print true ? (void)0 : arma_print #endif // for compatibility with earlier versions of Armadillo arma_frown("use arma_conform_check() instead") inline void arma_debug_check(bool state, const char* msg) { arma_conform_check(state, msg); } #if defined(ARMA_DEBUG) namespace junk { class arma_first_debug_message { public: inline arma_first_debug_message() { const char* nickname = ARMA_VERSION_NAME; std::ostream& out = get_cerr_stream(); out << "@ ---" << '\n'; out << "@ Armadillo " << arma_version::major << '.' << arma_version::minor << '.' << arma_version::patch << " (" << nickname << ')'; out << "\n@ arma_config::wrapper = " << arma_config::wrapper; out << "\n@ arma_config::cxx14 = " << arma_config::cxx14; out << "\n@ arma_config::cxx17 = " << arma_config::cxx17; out << "\n@ arma_config::cxx20 = " << arma_config::cxx20; out << "\n@ arma_config::cxx23 = " << arma_config::cxx23; out << "\n@ arma_config::std_mutex = " << arma_config::std_mutex; out << "\n@ arma_config::posix = " << arma_config::posix; out << "\n@ arma_config::openmp = " << arma_config::openmp; out << "\n@ arma_config::lapack = " << arma_config::lapack; out << "\n@ arma_config::blas = " << arma_config::blas; out << "\n@ arma_config::newarp = " << arma_config::newarp; out << "\n@ arma_config::arpack = " << arma_config::arpack; out << "\n@ arma_config::superlu = " << arma_config::superlu; out << "\n@ arma_config::atlas = " << arma_config::atlas; out << "\n@ arma_config::hdf5 = " << arma_config::hdf5; out << "\n@ arma_config::good_comp = " << arma_config::good_comp; out << "\n@ arma_config::extra_code = " << arma_config::extra_code; out << "\n@ arma_config::hidden_args = " << arma_config::hidden_args; out << "\n@ arma_config::mat_prealloc = " << arma_config::mat_prealloc; out << "\n@ arma_config::mp_threshold = " << arma_config::mp_threshold; out << "\n@ arma_config::mp_threads = " << arma_config::mp_threads; out << "\n@ arma_config::optimise_band = " << arma_config::optimise_band; out << "\n@ arma_config::optimise_sym = " << arma_config::optimise_sym; out << "\n@ arma_config::optimise_invexpr = " << arma_config::optimise_invexpr; out << "\n@ arma_config::check_conform = " << arma_config::check_conform; out << "\n@ arma_config::check_nonfinite = " << arma_config::check_nonfinite; out << "\n@ arma_config::fast_math = " << arma_config::fast_math; out << "\n@ sizeof(void*) = " << sizeof(void*); out << "\n@ sizeof(int) = " << sizeof(int); out << "\n@ sizeof(long) = " << sizeof(long); out << "\n@ sizeof(uword) = " << sizeof(uword); out << "\n@ sizeof(blas_int) = " << sizeof(blas_int); out << "\n@ ---" << std::endl; } }; static arma_first_debug_message arma_first_debug_message_run; } #endif //! @} RcppArmadillo/inst/include/armadillo_bits/fn_eig_sym.hpp0000644000176200001440000001023414635324415023227 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_eig_sym //! @{ //! Eigenvalues of real/complex symmetric/hermitian matrix X template inline typename enable_if2< is_supported_blas_type::value, bool >::result eig_sym ( Col& eigval, const Base& X ) { arma_debug_sigprint(); typedef typename T1::elem_type eT; Mat A(X.get_ref()); const bool status = auxlib::eig_sym(eigval, A); if(status == false) { eigval.soft_reset(); arma_warn(3, "eig_sym(): decomposition failed"); } return status; } //! Eigenvalues of real/complex symmetric/hermitian matrix X template arma_warn_unused inline typename enable_if2< is_supported_blas_type::value, Col >::result eig_sym ( const Base& X ) { arma_debug_sigprint(); typedef typename T1::elem_type eT; typedef typename T1::pod_type T; Col< T> eigval; Mat A(X.get_ref()); const bool status = auxlib::eig_sym(eigval, A); if(status == false) { eigval.reset(); arma_stop_runtime_error("eig_sym(): decomposition failed"); } return eigval; } //! internal helper function template inline bool eig_sym_helper ( Col::result>& eigval, Mat& eigvec, const Mat& X, const char method_sig, const char* caller_sig ) { arma_debug_sigprint(); if((arma_config::check_conform) && (auxlib::rudimentary_sym_check(X) == false)) { if(is_cx::no ) { arma_warn(1, caller_sig, ": given matrix is not symmetric"); } if(is_cx::yes) { arma_warn(1, caller_sig, ": given matrix is not hermitian"); } } bool status = false; if(method_sig == 'd') { status = auxlib::eig_sym_dc(eigval, eigvec, X); } if(status == false) { status = auxlib::eig_sym(eigval, eigvec, X); } return status; } //! Eigenvalues and eigenvectors of real/complex symmetric/hermitian matrix X template inline typename enable_if2< is_supported_blas_type::value, bool >::result eig_sym ( Col& eigval, Mat& eigvec, const Base& expr, const char* method = "dc" ) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const char sig = (method != nullptr) ? method[0] : char(0); arma_conform_check( ((sig != 's') && (sig != 'd')), "eig_sym(): unknown method specified" ); arma_conform_check( void_ptr(&eigval) == void_ptr(&eigvec), "eig_sym(): parameter 'eigval' is an alias of parameter 'eigvec'" ); const quasi_unwrap U(expr.get_ref()); const bool is_alias = U.is_alias(eigvec); Mat eigvec_tmp; Mat& eigvec_out = (is_alias == false) ? eigvec : eigvec_tmp; const bool status = eig_sym_helper(eigval, eigvec_out, U.M, sig, "eig_sym()"); if(status == false) { eigval.soft_reset(); eigvec.soft_reset(); arma_warn(3, "eig_sym(): decomposition failed"); } else { if(is_alias) { eigvec.steal_mem(eigvec_tmp); } } return status; } //! @} RcppArmadillo/inst/include/armadillo_bits/mtGlueCube_bones.hpp0000644000176200001440000000300614752446051024332 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup mtGlueCube //! @{ template class mtGlueCube : public BaseCube< out_eT, mtGlueCube > { public: typedef out_eT elem_type; typedef typename get_pod_type::result pod_type; arma_inline mtGlueCube(const T1& in_A, const T2& in_B); arma_inline mtGlueCube(const T1& in_A, const T2& in_B, const uword in_aux_uword); arma_inline ~mtGlueCube(); const T1& A; //!< first operand; must be derived from BaseCube const T2& B; //!< second operand; must be derived from BaseCube uword aux_uword; //!< storage of auxiliary data, uword format }; //! @} RcppArmadillo/inst/include/armadillo_bits/SpSubview_col_list_meat.hpp0000644000176200001440000003326415013306507025736 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup SpSubview_col_list //! @{ template inline SpSubview_col_list::~SpSubview_col_list() { arma_debug_sigprint(); } template arma_inline SpSubview_col_list::SpSubview_col_list ( const SpMat& in_m, const Base& in_ci ) : m (in_m ) , U_ci(in_ci.get_ref()) { arma_debug_sigprint(); const umat& ci = U_ci.M; const uword* ci_mem = ci.memptr(); const uword ci_n_elem = ci.n_elem; arma_conform_check ( ( (ci.is_vec() == false) && (ci.is_empty() == false) ), "SpMat::cols(): given object must be a vector" ); for(uword ci_count=0; ci_count < ci_n_elem; ++ci_count) { const uword i = ci_mem[ci_count]; arma_conform_check_bounds( (i >= in_m.n_cols), "SpMat::cols(): index out of bounds" ); } } //! apply a functor to each element template template inline void SpSubview_col_list::for_each(functor F) { arma_debug_sigprint(); SpMat tmp(*this); tmp.for_each(F); (*this).operator=(tmp); } template template inline void SpSubview_col_list::for_each(functor F) const { arma_debug_sigprint(); const SpMat tmp(*this); tmp.for_each(F); } //! transform each element using a functor template template inline void SpSubview_col_list::transform(functor F) { arma_debug_sigprint(); SpMat tmp(*this); tmp.transform(F); (*this).operator=(tmp); } template inline void SpSubview_col_list::replace(const eT old_val, const eT new_val) { arma_debug_sigprint(); SpMat tmp(*this); tmp.replace(old_val, new_val); (*this).operator=(tmp); } template inline void SpSubview_col_list::clean(const typename get_pod_type::result threshold) { arma_debug_sigprint(); SpMat tmp(*this); tmp.clean(threshold); (*this).operator=(tmp); } template inline void SpSubview_col_list::fill(const eT val) { arma_debug_sigprint(); Mat tmp(m.n_rows, U_ci.M.n_elem, arma_nozeros_indicator()); tmp.fill(val); (*this).operator=(tmp); } template inline void SpSubview_col_list::zeros() { arma_debug_sigprint(); SpMat& m_local = const_cast< SpMat& >(m); const umat& ci = U_ci.M; const uword* ci_mem = ci.memptr(); const uword ci_n_elem = ci.n_elem; m_local.sync_csc(); m_local.invalidate_cache(); for(uword ci_count=0; ci_count < ci_n_elem; ++ci_count) { const uword i = ci_mem[ci_count]; const uword col_n_nonzero = m_local.col_ptrs[i+1] - m_local.col_ptrs[i]; uword offset = m_local.col_ptrs[i]; for(uword j=0; j < col_n_nonzero; ++j) { access::rw(m_local.values[offset]) = eT(0); ++offset; } } m_local.remove_zeros(); } template inline void SpSubview_col_list::ones() { arma_debug_sigprint(); const Mat tmp(m.n_rows, U_ci.M.n_elem, fill::ones); (*this).operator=(tmp); } template inline void SpSubview_col_list::operator+= (const eT val) { arma_debug_sigprint(); const SpMat tmp1(*this); Mat tmp2(tmp1.n_rows, tmp1.n_cols, arma_nozeros_indicator()); tmp2.fill(val); const Mat tmp3 = tmp1 + tmp2; (*this).operator=(tmp3); } template inline void SpSubview_col_list::operator-= (const eT val) { arma_debug_sigprint(); const SpMat tmp1(*this); Mat tmp2(tmp1.n_rows, tmp1.n_cols, arma_nozeros_indicator()); tmp2.fill(val); const Mat tmp3 = tmp1 - tmp2; (*this).operator=(tmp3); } template inline void SpSubview_col_list::operator*= (const eT val) { arma_debug_sigprint(); SpMat& m_local = const_cast< SpMat& >(m); const umat& ci = U_ci.M; const uword* ci_mem = ci.memptr(); const uword ci_n_elem = ci.n_elem; m_local.sync_csc(); m_local.invalidate_cache(); bool has_zero = false; for(uword ci_count=0; ci_count < ci_n_elem; ++ci_count) { const uword i = ci_mem[ci_count]; const uword col_n_nonzero = m_local.col_ptrs[i+1] - m_local.col_ptrs[i]; uword offset = m_local.col_ptrs[i]; for(uword j=0; j < col_n_nonzero; ++j) { eT& m_local_val = access::rw(m_local.values[offset]); m_local_val *= val; if(m_local_val == eT(0)) { has_zero = true; } ++offset; } } if(has_zero) { m_local.remove_zeros(); } } template inline void SpSubview_col_list::operator/= (const eT val) { arma_debug_sigprint(); const SpMat tmp1(*this); Mat tmp2(tmp1.n_rows, tmp1.n_cols, arma_nozeros_indicator()); tmp2.fill(val); const SpMat tmp3 = tmp1 / tmp2; (*this).operator=(tmp3); } template template inline void SpSubview_col_list::operator= (const Base& x) { arma_debug_sigprint(); const quasi_unwrap U(x.get_ref()); const Mat& X = U.M; SpMat& m_local = const_cast< SpMat& >(m); const umat& ci = U_ci.M; const uword* ci_mem = ci.memptr(); const uword ci_n_elem = ci.n_elem; arma_conform_assert_same_size( m_local.n_rows, ci_n_elem, X.n_rows, X.n_cols, "SpMat::cols()" ); const uword X_n_elem = X.n_elem; const eT* X_mem = X.memptr(); uword X_n_nonzero = 0; for(uword i=0; i < X_n_elem; ++i) { X_n_nonzero += (X_mem[i] != eT(0)) ? uword(1) : uword(0); } SpMat Y(arma_reserve_indicator(), X.n_rows, m_local.n_cols, X_n_nonzero); uword count = 0; for(uword ci_count=0; ci_count < ci_n_elem; ++ci_count) { const uword i = ci_mem[ci_count]; for(uword row=0; row < X.n_rows; ++row) { const eT X_val = (*X_mem); ++X_mem; if(X_val != eT(0)) { access::rw(Y.row_indices[count]) = row; access::rw(Y.values [count]) = X_val; ++count; ++access::rw(Y.col_ptrs[i + 1]); } } } // fix the column pointers for(uword i = 0; i < Y.n_cols; ++i) { access::rw(Y.col_ptrs[i+1]) += Y.col_ptrs[i]; } (*this).zeros(); SpMat tmp = m_local + Y; m_local.steal_mem(tmp); } template template inline void SpSubview_col_list::operator+= (const Base& x) { arma_debug_sigprint(); const Mat tmp = SpMat(*this) + x.get_ref(); (*this).operator=(tmp); } template template inline void SpSubview_col_list::operator-= (const Base& x) { arma_debug_sigprint(); const Mat tmp = SpMat(*this) - x.get_ref(); (*this).operator=(tmp); } template template inline void SpSubview_col_list::operator%= (const Base& x) { arma_debug_sigprint(); const SpMat tmp = SpMat(*this) % x.get_ref(); (*this).operator=(tmp); } template template inline void SpSubview_col_list::operator/= (const Base& x) { arma_debug_sigprint(); const SpMat tmp = SpMat(*this) / x.get_ref(); (*this).operator=(tmp); } template inline void SpSubview_col_list::operator= (const SpSubview_col_list& x) { arma_debug_sigprint(); const SpMat tmp(x); (*this).operator=(tmp); } template template inline void SpSubview_col_list::operator= (const SpSubview_col_list& x) { arma_debug_sigprint(); const SpMat tmp(x); (*this).operator=(tmp); } template template inline void SpSubview_col_list::operator= (const SpBase& x) { arma_debug_sigprint(); const unwrap_spmat U(x.get_ref()); const SpMat& X = U.M; if(U.is_alias(m)) { const SpMat tmp(X); (*this).operator=(tmp); return; } SpMat& m_local = const_cast< SpMat& >(m); const umat& ci = U_ci.M; const uword* ci_mem = ci.memptr(); const uword ci_n_elem = ci.n_elem; arma_conform_assert_same_size( m_local.n_rows, ci_n_elem, X.n_rows, X.n_cols, "SpMat::cols()" ); SpMat Y(arma_reserve_indicator(), X.n_rows, m_local.n_cols, X.n_nonzero); uword count = 0; for(uword ci_count=0; ci_count < ci_n_elem; ++ci_count) { const uword i = ci_mem[ci_count]; typename SpMat::const_col_iterator X_col_it = X.begin_col(ci_count); typename SpMat::const_col_iterator X_col_it_end = X.end_col(ci_count); while(X_col_it != X_col_it_end) { access::rw(Y.row_indices[count]) = X_col_it.row(); access::rw(Y.values [count]) = (*X_col_it); ++count; ++access::rw(Y.col_ptrs[i + 1]); ++X_col_it; } } // fix the column pointers for(uword i = 0; i < Y.n_cols; ++i) { access::rw(Y.col_ptrs[i+1]) += Y.col_ptrs[i]; } (*this).zeros(); SpMat tmp = m_local + Y; m_local.steal_mem(tmp); } template template inline void SpSubview_col_list::operator+= (const SpBase& x) { arma_debug_sigprint(); const SpMat tmp = SpMat(*this) + x.get_ref(); (*this).operator=(tmp); } template template inline void SpSubview_col_list::operator-= (const SpBase& x) { arma_debug_sigprint(); const SpMat tmp = SpMat(*this) - x.get_ref(); (*this).operator=(tmp); } template template inline void SpSubview_col_list::operator%= (const SpBase& x) { arma_debug_sigprint(); const SpMat tmp = SpMat(*this) % x.get_ref(); (*this).operator=(tmp); } template template inline void SpSubview_col_list::operator/= (const SpBase& x) { arma_debug_sigprint(); SpMat tmp(*this); tmp /= x.get_ref(); (*this).operator=(tmp); } // // template inline void SpSubview_col_list::extract(SpMat& out, const SpSubview_col_list& in) { arma_debug_sigprint(); // NOTE: aliasing is handled by SpMat::operator=(const SpSubview_col_list& in) const umat& ci = in.U_ci.M; const uword* ci_mem = ci.memptr(); const uword ci_n_elem = ci.n_elem; const SpMat& in_m = in.m; in_m.sync_csc(); uword total_n_nonzero = 0; for(uword ci_count=0; ci_count < ci_n_elem; ++ci_count) { const uword i = ci_mem[ci_count]; const uword col_n_nonzero = in_m.col_ptrs[i+1] - in_m.col_ptrs[i]; total_n_nonzero += col_n_nonzero; } out.reserve(in.m.n_rows, ci_n_elem, total_n_nonzero); uword out_n_nonzero = 0; uword out_col_count = 0; for(uword ci_count=0; ci_count < ci_n_elem; ++ci_count) { const uword i = ci_mem[ci_count]; const uword col_n_nonzero = in_m.col_ptrs[i+1] - in_m.col_ptrs[i]; uword offset = in_m.col_ptrs[i]; for(uword j=0; j < col_n_nonzero; ++j) { const eT val = in_m.values [ offset ]; const uword row = in_m.row_indices[ offset ]; ++offset; access::rw(out.values [out_n_nonzero]) = val; access::rw(out.row_indices[out_n_nonzero]) = row; access::rw(out.col_ptrs[out_col_count+1])++; ++out_n_nonzero; } ++out_col_count; } // fix the column pointers for(uword i = 0; i < out.n_cols; ++i) { access::rw(out.col_ptrs[i+1]) += out.col_ptrs[i]; } } template inline void SpSubview_col_list::plus_inplace(SpMat& out, const SpSubview_col_list& in) { arma_debug_sigprint(); const SpMat tmp(in); out += tmp; } template inline void SpSubview_col_list::minus_inplace(SpMat& out, const SpSubview_col_list& in) { arma_debug_sigprint(); const SpMat tmp(in); out -= tmp; } template inline void SpSubview_col_list::schur_inplace(SpMat& out, const SpSubview_col_list& in) { arma_debug_sigprint(); const SpMat tmp(in); out %= tmp; } template inline void SpSubview_col_list::div_inplace(SpMat& out, const SpSubview_col_list& in) { arma_debug_sigprint(); const SpMat tmp(in); out /= tmp; } //! @} RcppArmadillo/inst/include/armadillo_bits/translate_fftw3.hpp0000644000176200001440000000447114603256156024225 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ #if defined(ARMA_USE_FFTW3) namespace fftw3 { template arma_inline void_ptr plan_dft_1d(int N, eT* input, eT* output, int fftw3_sign, unsigned int fftw3_flags) { arma_type_check((is_cx::value == false)); if(is_cx_float::value) { return fftwf_plan_dft_1d(N, (fftwf_complex*)(input), (fftwf_complex*)(output), fftw3_sign, fftw3_flags); } else if(is_cx_double::value) { return fftw_plan_dft_1d(N, (fftw_complex*)(input), (fftw_complex*)(output), fftw3_sign, fftw3_flags); } return nullptr; } template arma_inline void execute(void_ptr plan) { arma_type_check((is_cx::value == false)); if(is_cx_float::value) { fftwf_execute(fftwf_plan(plan)); } else if(is_cx_double::value) { fftw_execute(fftw_plan(plan)); } } template arma_inline void destroy_plan(void_ptr plan) { arma_type_check((is_cx::value == false)); if(is_cx_float::value) { fftwf_destroy_plan(fftwf_plan(plan)); } else if(is_cx_double::value) { fftw_destroy_plan(fftw_plan(plan)); } } template arma_inline void cleanup() { arma_type_check((is_cx::value == false)); if(is_cx_float::value) { fftwf_cleanup(); } else if(is_cx_double::value) { fftw_cleanup(); } } } #endif RcppArmadillo/inst/include/armadillo_bits/op_wishrnd_meat.hpp0000644000176200001440000001513514631567470024305 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_wishrnd //! @{ // implementation based on: // Yu-Cheng Ku and Peter Bloomfield. // Generating Random Wishart Matrices with Fractional Degrees of Freedom in OX. // Oxmetrics User Conference, 2010. template inline void op_wishrnd::apply(Mat& out, const Op& expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const eT df = expr.aux; const uword mode = expr.aux_uword_a; const bool status = op_wishrnd::apply_direct(out, expr.m, df, mode); if(status == false) { out.soft_reset(); arma_stop_runtime_error("wishrnd(): given matrix is not symmetric positive definite"); } } template inline bool op_wishrnd::apply_direct(Mat& out, const Base& X, const typename T1::elem_type df, const uword mode) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const quasi_unwrap U(X.get_ref()); bool status = false; if(U.is_alias(out)) { Mat tmp; if(mode == 1) { status = op_wishrnd::apply_noalias_mode1(tmp, U.M, df); } if(mode == 2) { status = op_wishrnd::apply_noalias_mode2(tmp, U.M, df); } out.steal_mem(tmp); } else { if(mode == 1) { status = op_wishrnd::apply_noalias_mode1(out, U.M, df); } if(mode == 2) { status = op_wishrnd::apply_noalias_mode2(out, U.M, df); } } return status; } template inline bool op_wishrnd::apply_noalias_mode1(Mat& out, const Mat& S, const eT df) { arma_debug_sigprint(); arma_conform_check( (S.is_square() == false), "wishrnd(): given matrix must be square sized" ); if(S.is_empty()) { out.reset(); return true; } if(auxlib::rudimentary_sym_check(S) == false) { return false; } Mat D; const bool status = op_chol::apply_direct(D, S, 0); if(status == false) { return false; } return op_wishrnd::apply_noalias_mode2(out, D, df); } template inline bool op_wishrnd::apply_noalias_mode2(Mat& out, const Mat& D, const eT df) { arma_debug_sigprint(); arma_conform_check( (df <= eT(0)), "df must be greater than zero" ); arma_conform_check( (D.is_square() == false), "wishrnd(): given matrix must be square sized" ); if(D.is_empty()) { out.reset(); return true; } const uword N = D.n_rows; if(df < eT(N)) { arma_debug_print("simple generator"); const uword df_floor = uword(std::floor(df)); const Mat tmp = (randn< Mat >(df_floor, N)) * D; out = tmp.t() * tmp; } else { arma_debug_print("standard generator"); op_chi2rnd_varying_df chi2rnd_generator; Mat A(N, N, arma_zeros_indicator()); for(uword i=0; i::fill( A.colptr(i), i ); } const Mat tmp = A * D; A.reset(); out = tmp.t() * tmp; } return true; } // template inline void op_iwishrnd::apply(Mat& out, const Op& expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const eT df = expr.aux; const uword mode = expr.aux_uword_a; const bool status = op_iwishrnd::apply_direct(out, expr.m, df, mode); if(status == false) { out.soft_reset(); arma_stop_runtime_error("iwishrnd(): given matrix is not symmetric positive definite and/or df is too low"); } } template inline bool op_iwishrnd::apply_direct(Mat& out, const Base& X, const typename T1::elem_type df, const uword mode) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const quasi_unwrap U(X.get_ref()); bool status = false; if(U.is_alias(out)) { Mat tmp; if(mode == 1) { status = op_iwishrnd::apply_noalias_mode1(tmp, U.M, df); } if(mode == 2) { status = op_iwishrnd::apply_noalias_mode2(tmp, U.M, df); } out.steal_mem(tmp); } else { if(mode == 1) { status = op_iwishrnd::apply_noalias_mode1(out, U.M, df); } if(mode == 2) { status = op_iwishrnd::apply_noalias_mode2(out, U.M, df); } } return status; } template inline bool op_iwishrnd::apply_noalias_mode1(Mat& out, const Mat& T, const eT df) { arma_debug_sigprint(); arma_conform_check( (T.is_square() == false), "iwishrnd(): given matrix must be square sized" ); if(T.is_empty()) { out.reset(); return true; } if(auxlib::rudimentary_sym_check(T) == false) { return false; } Mat Tinv; Mat Dinv; const bool inv_status = auxlib::inv_sympd(Tinv, T); if(inv_status == false) { return false; } const bool chol_status = op_chol::apply_direct(Dinv, Tinv, 0); if(chol_status == false) { return false; } return op_iwishrnd::apply_noalias_mode2(out, Dinv, df); } template inline bool op_iwishrnd::apply_noalias_mode2(Mat& out, const Mat& Dinv, const eT df) { arma_debug_sigprint(); arma_conform_check( (df <= eT(0)), "df must be greater than zero" ); arma_conform_check( (Dinv.is_square() == false), "iwishrnd(): given matrix must be square sized" ); if(Dinv.is_empty()) { out.reset(); return true; } Mat tmp; const bool wishrnd_status = op_wishrnd::apply_noalias_mode2(tmp, Dinv, df); if(wishrnd_status == false) { return false; } const bool inv_status1 = auxlib::inv_sympd(out, tmp); const bool inv_status2 = (inv_status1) ? bool(true) : bool(auxlib::inv(out, tmp)); if(inv_status2 == false) { return false; } return true; } //! @} RcppArmadillo/inst/include/armadillo_bits/spop_strans_meat.hpp0000644000176200001440000000607714631567470024511 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup spop_strans //! @{ template inline void spop_strans::apply_noalias(SpMat& B, const SpMat& A) { arma_debug_sigprint(); B.reserve(A.n_cols, A.n_rows, A.n_nonzero); // deliberately swapped if(A.n_nonzero == 0) { return; } // This follows the TRANSP algorithm described in // 'Sparse Matrix Multiplication Package (SMMP)' // (R.E. Bank and C.C. Douglas, 2001) const uword m = A.n_rows; const uword n = A.n_cols; const eT* a = A.values; eT* b = access::rwp(B.values); const uword* ia = A.col_ptrs; const uword* ja = A.row_indices; uword* ib = access::rwp(B.col_ptrs); uword* jb = access::rwp(B.row_indices); // // ib is already zeroed, as B is freshly constructed // // for(uword i=0; i < (m+1); ++i) // { // ib[i] = 0; // } for(uword i=0; i < n; ++i) { for(uword j = ia[i]; j < ia[i+1]; ++j) { ib[ ja[j] + 1 ]++; } } for(uword i=0; i < m; ++i) { ib[i+1] += ib[i]; } for(uword i=0; i < n; ++i) { for(uword j = ia[i]; j < ia[i+1]; ++j) { const uword jj = ja[j]; const uword ib_jj = ib[jj]; jb[ib_jj] = i; b[ib_jj] = a[j]; ib[jj]++; } } for(uword i = m-1; i >= 1; --i) { ib[i] = ib[i-1]; } ib[0] = 0; } template inline void spop_strans::apply(SpMat& out, const SpOp& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const unwrap_spmat U(in.m); if(U.is_alias(out)) { SpMat tmp; spop_strans::apply_noalias(tmp, U.M); out.steal_mem(tmp); } else { spop_strans::apply_noalias(out, U.M); } } //! for transpose of non-complex matrices, redirected from spop_htrans::apply() template inline void spop_strans::apply(SpMat& out, const SpOp& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const unwrap_spmat U(in.m); if(U.is_alias(out)) { SpMat tmp; spop_strans::apply_noalias(tmp, U.M); out.steal_mem(tmp); } else { spop_strans::apply_noalias(out, U.M); } } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_unique.hpp0000644000176200001440000000251214631567470023107 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_unique //! @{ template arma_warn_unused inline typename enable_if2 < is_arma_type::value && resolves_to_vector::yes, const Op >::result unique(const T1& A) { arma_debug_sigprint(); return Op(A); } template arma_warn_unused inline typename enable_if2 < is_arma_type::value && resolves_to_vector::no, const Op >::result unique(const T1& A) { arma_debug_sigprint(); return Op(A); } //! @} RcppArmadillo/inst/include/armadillo_bits/operator_plus.hpp0000644000176200001440000002340614713753317024017 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup operator_plus //! @{ //! unary plus operation (does nothing, but is required for completeness) template arma_inline typename enable_if2< is_arma_type::value, const T1& >::result operator+ (const T1& X) { arma_debug_sigprint(); return X; } //! Base + scalar template arma_inline typename enable_if2< is_arma_type::value, const eOp >::result operator+ (const T1& X, const typename T1::elem_type k) { arma_debug_sigprint(); return eOp(X, k); } //! scalar + Base template arma_inline typename enable_if2< is_arma_type::value, const eOp >::result operator+ (const typename T1::elem_type k, const T1& X) { arma_debug_sigprint(); return eOp(X, k); // NOTE: order is swapped } //! non-complex Base + complex scalar template arma_inline typename enable_if2 < (is_arma_type::value && is_cx::no), const mtOp, T1, op_cx_scalar_plus> >::result operator+ ( const T1& X, const std::complex& k ) { arma_debug_sigprint(); return mtOp, T1, op_cx_scalar_plus>('j', X, k); } //! complex scalar + non-complex Base template arma_inline typename enable_if2 < (is_arma_type::value && is_cx::no), const mtOp, T1, op_cx_scalar_plus> >::result operator+ ( const std::complex& k, const T1& X ) { arma_debug_sigprint(); return mtOp, T1, op_cx_scalar_plus>('j', X, k); // NOTE: order is swapped } //! addition of user-accessible Armadillo objects with same element type template arma_inline typename enable_if2 < is_arma_type::value && is_arma_type::value && is_same_type::value, const eGlue >::result operator+ ( const T1& X, const T2& Y ) { arma_debug_sigprint(); return eGlue(X, Y); } //! addition of user-accessible Armadillo objects with different element types template inline typename enable_if2 < (is_arma_type::value && is_arma_type::value && (is_same_type::no)), const mtGlue::result, T1, T2, glue_mixed_plus> >::result operator+ ( const T1& X, const T2& Y ) { arma_debug_sigprint(); typedef typename T1::elem_type eT1; typedef typename T2::elem_type eT2; typedef typename promote_type::result out_eT; promote_type::check(); return mtGlue( X, Y ); } //! addition of two sparse objects template inline typename enable_if2 < (is_arma_sparse_type::value && is_arma_sparse_type::value && is_same_type::value), SpGlue >::result operator+ ( const T1& x, const T2& y ) { arma_debug_sigprint(); return SpGlue(x, y); } //! addition of one dense and one sparse object template inline typename enable_if2 < (is_arma_type::value && is_arma_sparse_type::value && is_same_type::value), Mat >::result operator+ ( const T1& x, const T2& y ) { arma_debug_sigprint(); Mat result(x); const SpProxy pb(y); arma_conform_assert_same_size( result.n_rows, result.n_cols, pb.get_n_rows(), pb.get_n_cols(), "addition" ); typename SpProxy::const_iterator_type it = pb.begin(); typename SpProxy::const_iterator_type it_end = pb.end(); while(it != it_end) { result.at(it.row(), it.col()) += (*it); ++it; } return result; } //! addition of one sparse and one dense object template inline typename enable_if2 < (is_arma_sparse_type::value && is_arma_type::value && is_same_type::value), Mat >::result operator+ ( const T1& x, const T2& y ) { arma_debug_sigprint(); const SpProxy pa(x); Mat result(y); arma_conform_assert_same_size( pa.get_n_rows(), pa.get_n_cols(), result.n_rows, result.n_cols, "addition" ); typename SpProxy::const_iterator_type it = pa.begin(); typename SpProxy::const_iterator_type it_end = pa.end(); while(it != it_end) { result.at(it.row(), it.col()) += (*it); ++it; } return result; } //! addition of two sparse objects with different element types template inline typename enable_if2 < (is_arma_sparse_type::value && is_arma_sparse_type::value && is_same_type::no), const mtSpGlue< typename promote_type::result, T1, T2, spglue_plus_mixed > >::result operator+ ( const T1& X, const T2& Y ) { arma_debug_sigprint(); typedef typename T1::elem_type eT1; typedef typename T2::elem_type eT2; typedef typename promote_type::result out_eT; promote_type::check(); return mtSpGlue( X, Y ); } //! addition of sparse and non-sparse objects with different element types template inline typename enable_if2 < (is_arma_type::value && is_arma_sparse_type::value && is_same_type::no), Mat< typename promote_type::result > >::result operator+ ( const T1& x, const T2& y ) { arma_debug_sigprint(); Mat< typename promote_type::result > out; spglue_plus_mixed::dense_plus_sparse(out, x, y); return out; } //! addition of sparse and non-sparse objects with different element types template inline typename enable_if2 < (is_arma_sparse_type::value && is_arma_type::value && is_same_type::no), Mat< typename promote_type::result > >::result operator+ ( const T1& x, const T2& y ) { arma_debug_sigprint(); Mat< typename promote_type::result > out; // Just call the other order (these operations are commutative) // TODO: if there is a matrix size mismatch, the debug assert will print the matrix sizes in wrong order spglue_plus_mixed::dense_plus_sparse(out, y, x); return out; } //! addition of sparse object with scalar template inline typename enable_if2< is_arma_sparse_type::value, const SpToDOp >::result operator+ ( const T1& X, const typename T1::elem_type k ) { arma_debug_sigprint(); return SpToDOp(X, k); } template inline typename enable_if2< is_arma_sparse_type::value, const SpToDOp >::result operator+ ( const typename T1::elem_type k, const T1& X ) { arma_debug_sigprint(); return SpToDOp(X, k); // NOTE: swapped order } template arma_inline Mat operator+ ( const subview_each1& X, const Base& Y ) { arma_debug_sigprint(); return subview_each1_aux::operator_plus(X, Y.get_ref()); } template arma_inline Mat operator+ ( const Base& X, const subview_each1& Y ) { arma_debug_sigprint(); return subview_each1_aux::operator_plus(Y, X.get_ref()); // NOTE: swapped order } template arma_inline Mat operator+ ( const subview_each2& X, const Base& Y ) { arma_debug_sigprint(); return subview_each2_aux::operator_plus(X, Y.get_ref()); } template arma_inline Mat operator+ ( const Base& X, const subview_each2& Y ) { arma_debug_sigprint(); return subview_each2_aux::operator_plus(Y, X.get_ref()); // NOTE: swapped order } //! @} RcppArmadillo/inst/include/armadillo_bits/op_sp_plus_bones.hpp0000644000176200001440000000300214634016465024456 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_sp_plus //! @{ // Add a scalar to a sparse matrix; this will return a dense matrix. class op_sp_plus : public traits_op_passthru { public: template inline static void apply(Mat& out, const SpToDOp& in); // used for the optimization of sparse % (sparse + scalar) template inline static void apply_inside_schur(SpMat& out, const T2& x, const SpToDOp& y); // used for the optimization of sparse / (sparse + scalar) template inline static void apply_inside_div(SpMat& out, const T2& x, const SpToDOp& y); }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_strans_bones.hpp0000644000176200001440000000530114301267043024276 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_strans //! @{ //! 'matrix transpose' operation (simple transpose, ie. without taking the conjugate of the elements) class op_strans { public: template struct traits { static constexpr bool is_row = T1::is_col; // deliberately swapped static constexpr bool is_col = T1::is_row; static constexpr bool is_xvec = T1::is_xvec; }; template struct pos { static constexpr uword n2 = (do_flip == false) ? (row + col*2) : (col + row*2); static constexpr uword n3 = (do_flip == false) ? (row + col*3) : (col + row*3); static constexpr uword n4 = (do_flip == false) ? (row + col*4) : (col + row*4); }; template arma_cold inline static void apply_mat_noalias_tinysq(Mat& out, const TA& A); template arma_hot inline static void block_worker(eT* Y, const eT* X, const uword X_n_rows, const uword Y_n_rows, const uword n_rows, const uword n_cols); template arma_hot inline static void apply_mat_noalias_large(Mat& out, const Mat& A); template arma_hot inline static void apply_mat_noalias(Mat& out, const TA& A); template arma_hot inline static void apply_mat_inplace(Mat& out); template inline static void apply_mat(Mat& out, const TA& A); template inline static void apply_proxy(Mat& out, const Proxy& P); template inline static void apply_direct(Mat& out, const T1& X); template inline static void apply(Mat& out, const Op& in); }; class op_strans_cube { public: template inline static void apply_noalias(Cube& out, const Cube& X); }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_sp_sum_meat.hpp0000644000176200001440000000770615002412117024116 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_sp_sum //! @{ template inline void op_sp_sum::apply(Mat& out, const mtSpReduceOp& in) { arma_debug_sigprint(); // NOTE: assuming that eT is the same as T1::elem_type const uword dim = in.aux_uword_a; arma_conform_check( (dim > 1), "sum(): parameter 'dim' must be 0 or 1" ); const SpProxy p(in.m); const uword p_n_rows = p.get_n_rows(); const uword p_n_cols = p.get_n_cols(); if(dim == 0) { out.zeros(1, p_n_cols); } if(dim == 1) { out.zeros(p_n_rows, 1); } if(p.get_n_nonzero() == 0) { return; } eT* out_mem = out.memptr(); if(dim == 0) // find the sum in each column { if(SpProxy::use_iterator) { typename SpProxy::const_iterator_type it = p.begin(); const uword N = p.get_n_nonzero(); for(uword i=0; i < N; ++i) { out_mem[it.col()] += (*it); ++it; } } else { const eT* values = p.get_values(); const uword* colptrs = p.get_col_ptrs(); for(uword col = 0; col < p_n_cols; ++col) { const eT* coldata = &(values[ colptrs[col] ]); const uword N = colptrs[col + 1] - colptrs[col]; out_mem[col] = arrayops::accumulate(coldata, N); } } } else if(dim == 1) // find the sum in each row { typename SpProxy::const_iterator_type it = p.begin(); const uword N = p.get_n_nonzero(); for(uword i=0; i < N; ++i) { out_mem[it.row()] += (*it); ++it; } } } template inline void op_sp_sum::apply(Mat& out, const mtSpReduceOp, op_sp_sum>& in) { arma_debug_sigprint(); // NOTE: assuming that eT is the same as T1::elem_type const uword dim = in.aux_uword_a; arma_conform_check( (dim > 1), "sum(): parameter 'dim' must be 0 or 1" ); const SpProxy p(in.m.m); const uword p_n_rows = p.get_n_rows(); const uword p_n_cols = p.get_n_cols(); if(dim == 0) { out.zeros(1, p_n_cols); } if(dim == 1) { out.zeros(p_n_rows, 1); } if(p.get_n_nonzero() == 0) { return; } eT* out_mem = out.memptr(); if(dim == 0) // find the sum of squares in each column { if(SpProxy::use_iterator) { typename SpProxy::const_iterator_type it = p.begin(); const uword N = p.get_n_nonzero(); for(uword i=0; i < N; ++i) { const eT val = (*it); out_mem[it.col()] += (val*val); ++it; } } else { const eT* values = p.get_values(); const uword* colptrs = p.get_col_ptrs(); for(uword col = 0; col < p_n_cols; ++col) { const eT* coldata = &(values[ colptrs[col] ]); const uword N = colptrs[col + 1] - colptrs[col]; out_mem[col] = op_dot::direct_dot(N, coldata, coldata); } } } else if(dim == 1) // find the sum of squares in each row { typename SpProxy::const_iterator_type it = p.begin(); const uword N = p.get_n_nonzero(); for(uword i=0; i < N; ++i) { const eT val = (*it); out_mem[it.row()] += (val*val); ++it; } } } //! @} RcppArmadillo/inst/include/armadillo_bits/fft_engine_fftw3.hpp0000644000176200001440000001112114770765377024341 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // ------------------------------------------------------------------------ //! \addtogroup fft_engine_fftw3 //! @{ #if defined(ARMA_USE_FFTW3) struct fft_engine_fftw3_aux { #if defined(ARMA_USE_STD_MUTEX) static inline std::mutex& get_plan_mutex() { static std::mutex plan_mutex; return plan_mutex; } #endif }; template class fft_engine_fftw3 { public: constexpr static int fftw3_sign_forward = -1; constexpr static int fftw3_sign_backward = +1; constexpr static unsigned int fftw3_flag_destroy = (1u << 0); constexpr static unsigned int fftw3_flag_preserve = (1u << 4); constexpr static unsigned int fftw3_flag_estimate = (1u << 6); const uword N; void_ptr fftw3_plan; podarray X_work; // for storing copy of input (can be overwritten by FFTW3) podarray Y_work; // for storing output inline void finish() { arma_debug_sigprint(); if(fftw3_plan != nullptr) { arma_debug_print("fft_engine_fftw3::finish(): destroying plan"); fftw3::destroy_plan(fftw3_plan); } // arma_debug_print("fft_engine_fftw3::finish(): cleanup"); // fftw3::cleanup(); // NOTE: this also removes any wisdom acquired by FFTW3 } inline ~fft_engine_fftw3() { arma_debug_sigprint(); #if defined(ARMA_USE_OPENMP) { #pragma omp critical (arma_fft_engine_fftw3) { (*this).finish(); } } #elif defined(ARMA_USE_STD_MUTEX) { std::mutex& plan_mutex = fft_engine_fftw3_aux::get_plan_mutex(); const std::lock_guard lock(plan_mutex); (*this).finish(); } #else { (*this).finish(); } #endif } inline fft_engine_fftw3(const uword in_N) : N (in_N ) , fftw3_plan(nullptr) { arma_debug_sigprint(); if(N == 0) { return; } if(N > uword(std::numeric_limits::max())) { arma_stop_runtime_error("integer overflow: FFT size too large for integer type used by FFTW3"); } arma_debug_print("fft_engine_fftw3::constructor: allocating work arrays"); X_work.set_size(N); Y_work.set_size(N); const int fftw3_sign = (inverse) ? fftw3_sign_backward : fftw3_sign_forward; const int fftw3_flags = fftw3_flag_destroy | fftw3_flag_estimate; arma_debug_print("fft_engine_fftw3::constructor: generating 1D plan"); // only fftw3::execute() is thread safe, as per FFTW docs: // https://www.fftw.org/fftw3_doc/Thread-safety.html #if defined(ARMA_USE_OPENMP) { #pragma omp critical (arma_fft_engine_fftw3) { fftw3_plan = fftw3::plan_dft_1d(N, X_work.memptr(), Y_work.memptr(), fftw3_sign, fftw3_flags); } } #elif defined(ARMA_USE_STD_MUTEX) { std::mutex& plan_mutex = fft_engine_fftw3_aux::get_plan_mutex(); const std::lock_guard lock(plan_mutex); fftw3_plan = fftw3::plan_dft_1d(N, X_work.memptr(), Y_work.memptr(), fftw3_sign, fftw3_flags); } #else { fftw3_plan = fftw3::plan_dft_1d(N, X_work.memptr(), Y_work.memptr(), fftw3_sign, fftw3_flags); } #endif if(fftw3_plan == nullptr) { arma_stop_runtime_error("fft_engine_fftw3::constructor: failed to create plan"); } } inline void run(cx_type* Y, const cx_type* X) { arma_debug_sigprint(); if(fftw3_plan == nullptr) { return; } arma_debug_print("fft_engine_fftw3::run(): copying input array"); arrayops::copy(X_work.memptr(), X, N); arma_debug_print("fft_engine_fftw3::run(): executing plan"); fftw3::execute(fftw3_plan); arma_debug_print("fft_engine_fftw3::run(): copying output array"); arrayops::copy(Y, Y_work.memptr(), N); } }; #endif //! @} RcppArmadillo/inst/include/armadillo_bits/spop_relational_meat.hpp0000644000176200001440000002543114641441754025321 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup spop_relational //! @{ // NOTE: in general, relational operations between sparse matrices and scalars // NOTE: have the risk of producing sparse matrices with most elements as non-zeros. // NOTE: these operations should only be used as an argument to the accu() function, // NOTE: which aims to omit the generation of intermediate sparse matrices. #undef operator_rel #undef arma_applier_spmat_pre #undef arma_applier_spmat_post #define arma_applier_spmat_pre(operator_rel)\ {\ const uword zero_comp_val = (k operator_rel eT(0)) ? uword(1) : uword(0);\ \ const uword n_cols = A.n_cols;\ const uword n_rows = A.n_rows;\ const uword n_elem = A.n_elem;\ \ Mat tmp(n_rows, n_cols);\ \ typename SpMat::const_iterator it = A.begin();\ typename SpMat::const_iterator it_end = A.end();\ \ uword last_pos = 0;\ uword offset = 0;\ \ for(; it != it_end; ++it)\ {\ const uword cur_pos = it.row() + n_rows * it.col();\ \ if((cur_pos - last_pos) > offset)\ {\ arrayops::inplace_set( (tmp.memptr() + last_pos + offset), zero_comp_val, (cur_pos - last_pos - offset) );\ }\ \ tmp.at(cur_pos) = (k operator_rel (*it)) ? uword(1) : uword(0);\ \ last_pos = cur_pos;\ offset = 1;\ }\ \ if(last_pos < n_elem)\ {\ arrayops::inplace_set( (tmp.memptr() + last_pos + offset), zero_comp_val, (n_elem - last_pos - offset) );\ }\ \ out = tmp;\ } #define arma_applier_spmat_post(operator_rel)\ {\ const uword zero_comp_val = (eT(0) operator_rel k) ? uword(1) : uword(0);\ \ const uword n_cols = A.n_cols;\ const uword n_rows = A.n_rows;\ const uword n_elem = A.n_elem;\ \ Mat tmp(n_rows, n_cols);\ \ typename SpMat::const_iterator it = A.begin();\ typename SpMat::const_iterator it_end = A.end();\ \ uword last_pos = 0;\ uword offset = 0;\ \ for(; it != it_end; ++it)\ {\ const uword cur_pos = it.row() + n_rows * it.col();\ \ if((cur_pos - last_pos) > offset)\ {\ arrayops::inplace_set( (tmp.memptr() + last_pos + offset), zero_comp_val, (cur_pos - last_pos - offset) );\ }\ \ tmp.at(cur_pos) = ((*it) operator_rel k) ? uword(1) : uword(0);\ \ last_pos = cur_pos;\ offset = 1;\ }\ \ if(last_pos < n_elem)\ {\ arrayops::inplace_set( (tmp.memptr() + last_pos + offset), zero_comp_val, (n_elem - last_pos - offset) );\ }\ \ out = tmp;\ } template inline void spop_rel_lt_pre::apply(SpMat& out, const mtSpOp& X) { arma_debug_sigprint(); // operation: scalar < spmat typedef typename T1::elem_type eT; const eT k = X.aux; const unwrap_spmat U(X.m); const SpMat& A = U.M; if(k > eT(0)) { arma_debug_print("optimisation: k > 0"); SpMat tmp(A.n_rows, A.n_cols); typename SpMat::const_iterator it = A.begin(); typename SpMat::const_iterator it_end = A.end(); for(; it != it_end; ++it) { if( k < (*it) ) { tmp.at(it.row(), it.col()) = uword(1); } } out.steal_mem(tmp); } else { arma_applier_spmat_pre( < ); } } template inline void spop_rel_gt_pre::apply(SpMat& out, const mtSpOp& X) { arma_debug_sigprint(); // operation: scalar > spmat typedef typename T1::elem_type eT; const eT k = X.aux; const unwrap_spmat U(X.m); const SpMat& A = U.M; if(k < eT(0)) { arma_debug_print("optimisation: k < 0"); SpMat tmp(A.n_rows, A.n_cols); typename SpMat::const_iterator it = A.begin(); typename SpMat::const_iterator it_end = A.end(); for(; it != it_end; ++it) { if( k > (*it) ) { tmp.at(it.row(), it.col()) = uword(1); } } out.steal_mem(tmp); } else { arma_applier_spmat_pre( > ); } } template inline void spop_rel_lteq_pre::apply(SpMat& out, const mtSpOp& X) { arma_debug_sigprint(); // operation: scalar <= spmat typedef typename T1::elem_type eT; const eT k = X.aux; const unwrap_spmat U(X.m); const SpMat& A = U.M; if(k > eT(0)) { arma_debug_print("optimisation: k > 0"); SpMat tmp(A.n_rows, A.n_cols); typename SpMat::const_iterator it = A.begin(); typename SpMat::const_iterator it_end = A.end(); for(; it != it_end; ++it) { if( k <= (*it) ) { tmp.at(it.row(), it.col()) = uword(1); } } out.steal_mem(tmp); } else { arma_applier_spmat_pre( <= ); } } template inline void spop_rel_gteq_pre::apply(SpMat& out, const mtSpOp& X) { arma_debug_sigprint(); // operation: scalar >= spmat typedef typename T1::elem_type eT; const eT k = X.aux; const unwrap_spmat U(X.m); const SpMat& A = U.M; if(k < eT(0)) { arma_debug_print("optimisation: k < 0"); SpMat tmp(A.n_rows, A.n_cols); typename SpMat::const_iterator it = A.begin(); typename SpMat::const_iterator it_end = A.end(); for(; it != it_end; ++it) { if( k >= (*it) ) { tmp.at(it.row(), it.col()) = uword(1); } } out.steal_mem(tmp); } else { arma_applier_spmat_pre( >= ); } } template inline void spop_rel_lt_post::apply(SpMat& out, const mtSpOp& X) { arma_debug_sigprint(); // operation: spmat < scalar typedef typename T1::elem_type eT; const eT k = X.aux; const unwrap_spmat U(X.m); const SpMat& A = U.M; if(k < eT(0)) { arma_debug_print("optimisation: k < 0"); SpMat tmp(A.n_rows, A.n_cols); typename SpMat::const_iterator it = A.begin(); typename SpMat::const_iterator it_end = A.end(); for(; it != it_end; ++it) { if( (*it) < k ) { tmp.at(it.row(), it.col()) = uword(1); } } out.steal_mem(tmp); } else { arma_applier_spmat_post( < ); } } template inline void spop_rel_gt_post::apply(SpMat& out, const mtSpOp& X) { arma_debug_sigprint(); // operation: spmat > scalar typedef typename T1::elem_type eT; const eT k = X.aux; const unwrap_spmat U(X.m); const SpMat& A = U.M; if(k > eT(0)) { arma_debug_print("optimisation: k > 0"); SpMat tmp(A.n_rows, A.n_cols); typename SpMat::const_iterator it = A.begin(); typename SpMat::const_iterator it_end = A.end(); for(; it != it_end; ++it) { if( (*it) > k ) { tmp.at(it.row(), it.col()) = uword(1); } } out.steal_mem(tmp); } else { arma_applier_spmat_post( > ); } } template inline void spop_rel_lteq_post::apply(SpMat& out, const mtSpOp& X) { arma_debug_sigprint(); // operation: spmat <= scalar typedef typename T1::elem_type eT; const eT k = X.aux; const unwrap_spmat U(X.m); const SpMat& A = U.M; if(k < eT(0)) { arma_debug_print("optimisation: k < 0"); SpMat tmp(A.n_rows, A.n_cols); typename SpMat::const_iterator it = A.begin(); typename SpMat::const_iterator it_end = A.end(); for(; it != it_end; ++it) { if( (*it) <= k ) { tmp.at(it.row(), it.col()) = uword(1); } } out.steal_mem(tmp); } else { arma_applier_spmat_post( <= ); } } template inline void spop_rel_gteq_post::apply(SpMat& out, const mtSpOp& X) { arma_debug_sigprint(); // operation: spmat >= scalar typedef typename T1::elem_type eT; const eT k = X.aux; const unwrap_spmat U(X.m); const SpMat& A = U.M; if(k > eT(0)) { arma_debug_print("optimisation: k > 0"); SpMat tmp(A.n_rows, A.n_cols); typename SpMat::const_iterator it = A.begin(); typename SpMat::const_iterator it_end = A.end(); for(; it != it_end; ++it) { if( (*it) >= k ) { tmp.at(it.row(), it.col()) = uword(1); } } out.steal_mem(tmp); } else { arma_applier_spmat_post( >= ); } } template inline void spop_rel_eq::apply(SpMat& out, const mtSpOp& X) { arma_debug_sigprint(); // operation: spmat == scalar typedef typename T1::elem_type eT; const eT k = X.aux; const unwrap_spmat U(X.m); const SpMat& A = U.M; if(k != eT(0)) { arma_debug_print("optimisation: k != 0"); SpMat tmp(A.n_rows, A.n_cols); typename SpMat::const_iterator it = A.begin(); typename SpMat::const_iterator it_end = A.end(); for(; it != it_end; ++it) { if( (*it) == k ) { tmp.at(it.row(), it.col()) = uword(1); } } out.steal_mem(tmp); } else { arma_applier_spmat_post( == ); } } template inline void spop_rel_noteq::apply(SpMat& out, const mtSpOp& X) { arma_debug_sigprint(); // operation: spmat != scalar typedef typename T1::elem_type eT; const eT k = X.aux; const unwrap_spmat U(X.m); const SpMat& A = U.M; if(k == eT(0)) { arma_debug_print("optimisation: k = 0"); SpMat tmp(A.n_rows, A.n_cols); typename SpMat::const_iterator it = A.begin(); typename SpMat::const_iterator it_end = A.end(); for(; it != it_end; ++it) { tmp.at(it.row(), it.col()) = uword(1); } out.steal_mem(tmp); } else { arma_applier_spmat_post( != ); } } #undef arma_applier_spmat_pre #undef arma_applier_spmat_post //! @} RcppArmadillo/inst/include/armadillo_bits/hdf5_name.hpp0000644000176200001440000000531514374704744022751 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup diskio //! @{ namespace hdf5_opts { typedef unsigned int flag_type; struct opts { const flag_type flags; inline constexpr explicit opts(const flag_type in_flags); inline const opts operator+(const opts& rhs) const; }; inline constexpr opts::opts(const flag_type in_flags) : flags(in_flags) {} inline const opts opts::operator+(const opts& rhs) const { const opts result( flags | rhs.flags ); return result; } // The values below (eg. 1u << 0) are for internal Armadillo use only. // The values can change without notice. static constexpr flag_type flag_none = flag_type(0 ); static constexpr flag_type flag_trans = flag_type(1u << 0); static constexpr flag_type flag_append = flag_type(1u << 1); static constexpr flag_type flag_replace = flag_type(1u << 2); struct opts_none : public opts { inline constexpr opts_none() : opts(flag_none ) {} }; struct opts_trans : public opts { inline constexpr opts_trans() : opts(flag_trans ) {} }; struct opts_append : public opts { inline constexpr opts_append() : opts(flag_append ) {} }; struct opts_replace : public opts { inline constexpr opts_replace() : opts(flag_replace) {} }; static constexpr opts_none none; static constexpr opts_trans trans; static constexpr opts_append append; static constexpr opts_replace replace; } struct hdf5_name { const std::string filename; const std::string dsname; const hdf5_opts::opts opts; inline hdf5_name(const std::string& in_filename) : filename(in_filename ) , dsname (std::string() ) , opts (hdf5_opts::none) {} inline hdf5_name(const std::string& in_filename, const std::string& in_dsname, const hdf5_opts::opts& in_opts = hdf5_opts::none) : filename(in_filename) , dsname (in_dsname ) , opts (in_opts ) {} }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_sp_nonzeros_bones.hpp0000644000176200001440000000202314634016465025352 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_sp_nonzeros //! @{ class op_sp_nonzeros : public traits_op_col { public: template static inline void apply(Mat& out, const SpToDOp& X); }; //! @} RcppArmadillo/inst/include/armadillo_bits/translate_lapack.hpp0000644000176200001440000026751615030507611024430 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ #if defined(ARMA_USE_LAPACK) //! \namespace lapack namespace for LAPACK functions namespace lapack { template inline void getrf(blas_int* m, blas_int* n, eT* a, blas_int* lda, blas_int* ipiv, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); if( is_float::value) { typedef float T; arma_fortran(arma_sgetrf)(m, n, (T*)a, lda, ipiv, info); } else if( is_double::value) { typedef double T; arma_fortran(arma_dgetrf)(m, n, (T*)a, lda, ipiv, info); } else if( is_cx_float::value) { typedef blas_cxf T; arma_fortran(arma_cgetrf)(m, n, (T*)a, lda, ipiv, info); } else if(is_cx_double::value) { typedef blas_cxd T; arma_fortran(arma_zgetrf)(m, n, (T*)a, lda, ipiv, info); } } template inline void getrs(char* trans, blas_int* n, blas_int* nrhs, eT* a, blas_int* lda, blas_int* ipiv, eT* b, blas_int* ldb, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_float::value) { typedef float T; arma_fortran(arma_sgetrs)(trans, n, nrhs, (T*)a, lda, ipiv, (T*)b, ldb, info, 1); } else if( is_double::value) { typedef double T; arma_fortran(arma_dgetrs)(trans, n, nrhs, (T*)a, lda, ipiv, (T*)b, ldb, info, 1); } else if( is_cx_float::value) { typedef blas_cxf T; arma_fortran(arma_cgetrs)(trans, n, nrhs, (T*)a, lda, ipiv, (T*)b, ldb, info, 1); } else if(is_cx_double::value) { typedef blas_cxd T; arma_fortran(arma_zgetrs)(trans, n, nrhs, (T*)a, lda, ipiv, (T*)b, ldb, info, 1); } #else if( is_float::value) { typedef float T; arma_fortran(arma_sgetrs)(trans, n, nrhs, (T*)a, lda, ipiv, (T*)b, ldb, info); } else if( is_double::value) { typedef double T; arma_fortran(arma_dgetrs)(trans, n, nrhs, (T*)a, lda, ipiv, (T*)b, ldb, info); } else if( is_cx_float::value) { typedef blas_cxf T; arma_fortran(arma_cgetrs)(trans, n, nrhs, (T*)a, lda, ipiv, (T*)b, ldb, info); } else if(is_cx_double::value) { typedef blas_cxd T; arma_fortran(arma_zgetrs)(trans, n, nrhs, (T*)a, lda, ipiv, (T*)b, ldb, info); } #endif } template inline void getri(blas_int* n, eT* a, blas_int* lda, blas_int* ipiv, eT* work, blas_int* lwork, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); if( is_float::value) { typedef float T; arma_fortran(arma_sgetri)(n, (T*)a, lda, ipiv, (T*)work, lwork, info); } else if( is_double::value) { typedef double T; arma_fortran(arma_dgetri)(n, (T*)a, lda, ipiv, (T*)work, lwork, info); } else if( is_cx_float::value) { typedef blas_cxf T; arma_fortran(arma_cgetri)(n, (T*)a, lda, ipiv, (T*)work, lwork, info); } else if(is_cx_double::value) { typedef blas_cxd T; arma_fortran(arma_zgetri)(n, (T*)a, lda, ipiv, (T*)work, lwork, info); } } template inline void trtri(char* uplo, char* diag, blas_int* n, eT* a, blas_int* lda, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_float::value) { typedef float T; arma_fortran(arma_strtri)(uplo, diag, n, (T*)a, lda, info, 1, 1); } else if( is_double::value) { typedef double T; arma_fortran(arma_dtrtri)(uplo, diag, n, (T*)a, lda, info, 1, 1); } else if( is_cx_float::value) { typedef blas_cxf T; arma_fortran(arma_ctrtri)(uplo, diag, n, (T*)a, lda, info, 1, 1); } else if(is_cx_double::value) { typedef blas_cxd T; arma_fortran(arma_ztrtri)(uplo, diag, n, (T*)a, lda, info, 1, 1); } #else if( is_float::value) { typedef float T; arma_fortran(arma_strtri)(uplo, diag, n, (T*)a, lda, info); } else if( is_double::value) { typedef double T; arma_fortran(arma_dtrtri)(uplo, diag, n, (T*)a, lda, info); } else if( is_cx_float::value) { typedef blas_cxf T; arma_fortran(arma_ctrtri)(uplo, diag, n, (T*)a, lda, info); } else if(is_cx_double::value) { typedef blas_cxd T; arma_fortran(arma_ztrtri)(uplo, diag, n, (T*)a, lda, info); } #endif } template inline void geev(char* jobvl, char* jobvr, blas_int* n, eT* a, blas_int* lda, eT* wr, eT* wi, eT* vl, blas_int* ldvl, eT* vr, blas_int* ldvr, eT* work, blas_int* lwork, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_float::value) { typedef float T; arma_fortran(arma_sgeev)(jobvl, jobvr, n, (T*)a, lda, (T*)wr, (T*)wi, (T*)vl, ldvl, (T*)vr, ldvr, (T*)work, lwork, info, 1, 1); } else if(is_double::value) { typedef double T; arma_fortran(arma_dgeev)(jobvl, jobvr, n, (T*)a, lda, (T*)wr, (T*)wi, (T*)vl, ldvl, (T*)vr, ldvr, (T*)work, lwork, info, 1, 1); } #else if( is_float::value) { typedef float T; arma_fortran(arma_sgeev)(jobvl, jobvr, n, (T*)a, lda, (T*)wr, (T*)wi, (T*)vl, ldvl, (T*)vr, ldvr, (T*)work, lwork, info); } else if(is_double::value) { typedef double T; arma_fortran(arma_dgeev)(jobvl, jobvr, n, (T*)a, lda, (T*)wr, (T*)wi, (T*)vl, ldvl, (T*)vr, ldvr, (T*)work, lwork, info); } #endif } template inline void cx_geev(char* jobvl, char* jobvr, blas_int* n, eT* a, blas_int* lda, eT* w, eT* vl, blas_int* ldvl, eT* vr, blas_int* ldvr, eT* work, blas_int* lwork, typename eT::value_type* rwork, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_cx_float::value) { typedef float T; typedef blas_cxf cx_T; arma_fortran(arma_cgeev)(jobvl, jobvr, n, (cx_T*)a, lda, (cx_T*)w, (cx_T*)vl, ldvl, (cx_T*)vr, ldvr, (cx_T*)work, lwork, (T*)rwork, info, 1, 1); } else if(is_cx_double::value) { typedef double T; typedef blas_cxd cx_T; arma_fortran(arma_zgeev)(jobvl, jobvr, n, (cx_T*)a, lda, (cx_T*)w, (cx_T*)vl, ldvl, (cx_T*)vr, ldvr, (cx_T*)work, lwork, (T*)rwork, info, 1, 1); } #else if( is_cx_float::value) { typedef float T; typedef blas_cxf cx_T; arma_fortran(arma_cgeev)(jobvl, jobvr, n, (cx_T*)a, lda, (cx_T*)w, (cx_T*)vl, ldvl, (cx_T*)vr, ldvr, (cx_T*)work, lwork, (T*)rwork, info); } else if(is_cx_double::value) { typedef double T; typedef blas_cxd cx_T; arma_fortran(arma_zgeev)(jobvl, jobvr, n, (cx_T*)a, lda, (cx_T*)w, (cx_T*)vl, ldvl, (cx_T*)vr, ldvr, (cx_T*)work, lwork, (T*)rwork, info); } #endif } template inline void geevx(char* balanc, char* jobvl, char* jobvr, char* sense, blas_int* n, eT* a, blas_int* lda, eT* wr, eT* wi, eT* vl, blas_int* ldvl, eT* vr, blas_int* ldvr, blas_int* ilo, blas_int* ihi, eT* scale, eT* abnrm, eT* rconde, eT* rcondv, eT* work, blas_int* lwork, blas_int* iwork, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_float::value) { typedef float T; arma_fortran(arma_sgeevx)(balanc, jobvl, jobvr, sense, n, (T*)(a), lda, (T*)(wr), (T*)(wi), (T*)(vl), ldvl, (T*)(vr), ldvr, ilo, ihi, (T*)(scale), (T*)(abnrm), (T*)(rconde), (T*)(rcondv), (T*)(work), lwork, iwork, info, 1, 1, 1, 1); } else if(is_double::value) { typedef double T; arma_fortran(arma_dgeevx)(balanc, jobvl, jobvr, sense, n, (T*)(a), lda, (T*)(wr), (T*)(wi), (T*)(vl), ldvl, (T*)(vr), ldvr, ilo, ihi, (T*)(scale), (T*)(abnrm), (T*)(rconde), (T*)(rcondv), (T*)(work), lwork, iwork, info, 1, 1, 1, 1); } #else if( is_float::value) { typedef float T; arma_fortran(arma_sgeevx)(balanc, jobvl, jobvr, sense, n, (T*)(a), lda, (T*)(wr), (T*)(wi), (T*)(vl), ldvl, (T*)(vr), ldvr, ilo, ihi, (T*)(scale), (T*)(abnrm), (T*)(rconde), (T*)(rcondv), (T*)(work), lwork, iwork, info); } else if(is_double::value) { typedef double T; arma_fortran(arma_dgeevx)(balanc, jobvl, jobvr, sense, n, (T*)(a), lda, (T*)(wr), (T*)(wi), (T*)(vl), ldvl, (T*)(vr), ldvr, ilo, ihi, (T*)(scale), (T*)(abnrm), (T*)(rconde), (T*)(rcondv), (T*)(work), lwork, iwork, info); } #endif } template inline void cx_geevx(char* balanc, char* jobvl, char* jobvr, char* sense, blas_int* n, eT* a, blas_int* lda, eT* w, eT* vl, blas_int* ldvl, eT* vr, blas_int* ldvr, blas_int* ilo, blas_int* ihi, typename eT::value_type* scale, typename eT::value_type* abnrm, typename eT::value_type* rconde, typename eT::value_type* rcondv, eT* work, blas_int* lwork, typename eT::value_type* rwork, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_cx_float::value) { typedef float T; typedef blas_cxf cx_T; arma_fortran(arma_cgeevx)(balanc, jobvl, jobvr, sense, n, (cx_T*)(a), lda, (cx_T*)(w), (cx_T*)(vl), ldvl, (cx_T*)(vr), ldvr, ilo, ihi, (T*)(scale), (T*)(abnrm), (T*)(rconde), (T*)(rcondv), (cx_T*)(work), lwork, (T*)(rwork), info, 1, 1, 1, 1); } else if(is_cx_double::value) { typedef double T; typedef blas_cxd cx_T; arma_fortran(arma_zgeevx)(balanc, jobvl, jobvr, sense, n, (cx_T*)(a), lda, (cx_T*)(w), (cx_T*)(vl), ldvl, (cx_T*)(vr), ldvr, ilo, ihi, (T*)(scale), (T*)(abnrm), (T*)(rconde), (T*)(rcondv), (cx_T*)(work), lwork, (T*)(rwork), info, 1, 1, 1, 1); } #else if( is_cx_float::value) { typedef float T; typedef blas_cxf cx_T; arma_fortran(arma_cgeevx)(balanc, jobvl, jobvr, sense, n, (cx_T*)(a), lda, (cx_T*)(w), (cx_T*)(vl), ldvl, (cx_T*)(vr), ldvr, ilo, ihi, (T*)(scale), (T*)(abnrm), (T*)(rconde), (T*)(rcondv), (cx_T*)(work), lwork, (T*)(rwork), info); } else if(is_cx_double::value) { typedef double T; typedef blas_cxd cx_T; arma_fortran(arma_zgeevx)(balanc, jobvl, jobvr, sense, n, (cx_T*)(a), lda, (cx_T*)(w), (cx_T*)(vl), ldvl, (cx_T*)(vr), ldvr, ilo, ihi, (T*)(scale), (T*)(abnrm), (T*)(rconde), (T*)(rcondv), (cx_T*)(work), lwork, (T*)(rwork), info); } #endif } template inline void syev(char* jobz, char* uplo, blas_int* n, eT* a, blas_int* lda, eT* w, eT* work, blas_int* lwork, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_float::value) { typedef float T; arma_fortran(arma_ssyev)(jobz, uplo, n, (T*)a, lda, (T*)w, (T*)work, lwork, info, 1, 1); } else if(is_double::value) { typedef double T; arma_fortran(arma_dsyev)(jobz, uplo, n, (T*)a, lda, (T*)w, (T*)work, lwork, info, 1, 1); } #else if( is_float::value) { typedef float T; arma_fortran(arma_ssyev)(jobz, uplo, n, (T*)a, lda, (T*)w, (T*)work, lwork, info); } else if(is_double::value) { typedef double T; arma_fortran(arma_dsyev)(jobz, uplo, n, (T*)a, lda, (T*)w, (T*)work, lwork, info); } #endif } template inline void heev ( char* jobz, char* uplo, blas_int* n, eT* a, blas_int* lda, typename eT::value_type* w, eT* work, blas_int* lwork, typename eT::value_type* rwork, blas_int* info ) { arma_type_check(( is_supported_blas_type::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_cx_float::value) { typedef float T; typedef blas_cxf cx_T; arma_fortran(arma_cheev)(jobz, uplo, n, (cx_T*)a, lda, (T*)w, (cx_T*)work, lwork, (T*)rwork, info, 1, 1); } else if(is_cx_double::value) { typedef double T; typedef blas_cxd cx_T; arma_fortran(arma_zheev)(jobz, uplo, n, (cx_T*)a, lda, (T*)w, (cx_T*)work, lwork, (T*)rwork, info, 1, 1); } #else if( is_cx_float::value) { typedef float T; typedef blas_cxf cx_T; arma_fortran(arma_cheev)(jobz, uplo, n, (cx_T*)a, lda, (T*)w, (cx_T*)work, lwork, (T*)rwork, info); } else if(is_cx_double::value) { typedef double T; typedef blas_cxd cx_T; arma_fortran(arma_zheev)(jobz, uplo, n, (cx_T*)a, lda, (T*)w, (cx_T*)work, lwork, (T*)rwork, info); } #endif } template inline void syevd(char* jobz, char* uplo, blas_int* n, eT* a, blas_int* lda, eT* w, eT* work, blas_int* lwork, blas_int* iwork, blas_int* liwork, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_float::value) { typedef float T; arma_fortran(arma_ssyevd)(jobz, uplo, n, (T*)a, lda, (T*)w, (T*)work, lwork, iwork, liwork, info, 1, 1); } else if(is_double::value) { typedef double T; arma_fortran(arma_dsyevd)(jobz, uplo, n, (T*)a, lda, (T*)w, (T*)work, lwork, iwork, liwork, info, 1, 1); } #else if( is_float::value) { typedef float T; arma_fortran(arma_ssyevd)(jobz, uplo, n, (T*)a, lda, (T*)w, (T*)work, lwork, iwork, liwork, info); } else if(is_double::value) { typedef double T; arma_fortran(arma_dsyevd)(jobz, uplo, n, (T*)a, lda, (T*)w, (T*)work, lwork, iwork, liwork, info); } #endif } template inline void heevd ( char* jobz, char* uplo, blas_int* n, eT* a, blas_int* lda, typename eT::value_type* w, eT* work, blas_int* lwork, typename eT::value_type* rwork, blas_int* lrwork, blas_int* iwork, blas_int* liwork, blas_int* info ) { arma_type_check(( is_supported_blas_type::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_cx_float::value) { typedef float T; typedef blas_cxf cx_T; arma_fortran(arma_cheevd)(jobz, uplo, n, (cx_T*)a, lda, (T*)w, (cx_T*)work, lwork, (T*)rwork, lrwork, iwork, liwork, info, 1, 1); } else if(is_cx_double::value) { typedef double T; typedef blas_cxd cx_T; arma_fortran(arma_zheevd)(jobz, uplo, n, (cx_T*)a, lda, (T*)w, (cx_T*)work, lwork, (T*)rwork, lrwork, iwork, liwork, info, 1, 1); } #else if( is_cx_float::value) { typedef float T; typedef blas_cxf cx_T; arma_fortran(arma_cheevd)(jobz, uplo, n, (cx_T*)a, lda, (T*)w, (cx_T*)work, lwork, (T*)rwork, lrwork, iwork, liwork, info); } else if(is_cx_double::value) { typedef double T; typedef blas_cxd cx_T; arma_fortran(arma_zheevd)(jobz, uplo, n, (cx_T*)a, lda, (T*)w, (cx_T*)work, lwork, (T*)rwork, lrwork, iwork, liwork, info); } #endif } template inline void ggev ( char* jobvl, char* jobvr, blas_int* n, eT* a, blas_int* lda, eT* b, blas_int* ldb, eT* alphar, eT* alphai, eT* beta, eT* vl, blas_int* ldvl, eT* vr, blas_int* ldvr, eT* work, blas_int* lwork, blas_int* info ) { arma_type_check(( is_supported_blas_type::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_float::value) { typedef float T; arma_fortran(arma_sggev)(jobvl, jobvr, n, (T*)a, lda, (T*)b, ldb, (T*)alphar, (T*)alphai, (T*)beta, (T*)vl, ldvl, (T*)vr, ldvr, (T*)work, lwork, info, 1, 1); } else if(is_double::value) { typedef double T; arma_fortran(arma_dggev)(jobvl, jobvr, n, (T*)a, lda, (T*)b, ldb, (T*)alphar, (T*)alphai, (T*)beta, (T*)vl, ldvl, (T*)vr, ldvr, (T*)work, lwork, info, 1, 1); } #else if( is_float::value) { typedef float T; arma_fortran(arma_sggev)(jobvl, jobvr, n, (T*)a, lda, (T*)b, ldb, (T*)alphar, (T*)alphai, (T*)beta, (T*)vl, ldvl, (T*)vr, ldvr, (T*)work, lwork, info); } else if(is_double::value) { typedef double T; arma_fortran(arma_dggev)(jobvl, jobvr, n, (T*)a, lda, (T*)b, ldb, (T*)alphar, (T*)alphai, (T*)beta, (T*)vl, ldvl, (T*)vr, ldvr, (T*)work, lwork, info); } #endif } template inline void cx_ggev ( char* jobvl, char* jobvr, blas_int* n, eT* a, blas_int* lda, eT* b, blas_int* ldb, eT* alpha, eT* beta, eT* vl, blas_int* ldvl, eT* vr, blas_int* ldvr, eT* work, blas_int* lwork, typename eT::value_type* rwork, blas_int* info ) { arma_type_check(( is_supported_blas_type::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_cx_float::value) { typedef float T; typedef blas_cxf cx_T; arma_fortran(arma_cggev)(jobvl, jobvr, n, (cx_T*)a, lda, (cx_T*)b, ldb, (cx_T*)alpha, (cx_T*)beta, (cx_T*)vl, ldvl, (cx_T*)vr, ldvr, (cx_T*)work, lwork, (T*)rwork, info, 1, 1); } else if(is_cx_double::value) { typedef double T; typedef blas_cxd cx_T; arma_fortran(arma_zggev)(jobvl, jobvr, n, (cx_T*)a, lda, (cx_T*)b, ldb, (cx_T*)alpha, (cx_T*)beta, (cx_T*)vl, ldvl, (cx_T*)vr, ldvr, (cx_T*)work, lwork, (T*)rwork, info, 1, 1); } #else if( is_cx_float::value) { typedef float T; typedef blas_cxf cx_T; arma_fortran(arma_cggev)(jobvl, jobvr, n, (cx_T*)a, lda, (cx_T*)b, ldb, (cx_T*)alpha, (cx_T*)beta, (cx_T*)vl, ldvl, (cx_T*)vr, ldvr, (cx_T*)work, lwork, (T*)rwork, info); } else if(is_cx_double::value) { typedef double T; typedef blas_cxd cx_T; arma_fortran(arma_zggev)(jobvl, jobvr, n, (cx_T*)a, lda, (cx_T*)b, ldb, (cx_T*)alpha, (cx_T*)beta, (cx_T*)vl, ldvl, (cx_T*)vr, ldvr, (cx_T*)work, lwork, (T*)rwork, info); } #endif } template inline void potrf(char* uplo, blas_int* n, eT* a, blas_int* lda, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_float::value) { typedef float T; arma_fortran(arma_spotrf)(uplo, n, (T*)a, lda, info, 1); } else if( is_double::value) { typedef double T; arma_fortran(arma_dpotrf)(uplo, n, (T*)a, lda, info, 1); } else if( is_cx_float::value) { typedef blas_cxf T; arma_fortran(arma_cpotrf)(uplo, n, (T*)a, lda, info, 1); } else if(is_cx_double::value) { typedef blas_cxd T; arma_fortran(arma_zpotrf)(uplo, n, (T*)a, lda, info, 1); } #else if( is_float::value) { typedef float T; arma_fortran(arma_spotrf)(uplo, n, (T*)a, lda, info); } else if( is_double::value) { typedef double T; arma_fortran(arma_dpotrf)(uplo, n, (T*)a, lda, info); } else if( is_cx_float::value) { typedef blas_cxf T; arma_fortran(arma_cpotrf)(uplo, n, (T*)a, lda, info); } else if(is_cx_double::value) { typedef blas_cxd T; arma_fortran(arma_zpotrf)(uplo, n, (T*)a, lda, info); } #endif } template inline void potrs(char* uplo, blas_int* n, const blas_int* nrhs, eT* a, blas_int* lda, eT* b, blas_int* ldb, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_float::value) { typedef float T; arma_fortran(arma_spotrs)(uplo, n, nrhs, (T*)a, lda, (T*)b, ldb, info, 1); } else if( is_double::value) { typedef double T; arma_fortran(arma_dpotrs)(uplo, n, nrhs, (T*)a, lda, (T*)b, ldb, info, 1); } else if( is_cx_float::value) { typedef blas_cxf T; arma_fortran(arma_cpotrs)(uplo, n, nrhs, (T*)a, lda, (T*)b, ldb, info, 1); } else if(is_cx_double::value) { typedef blas_cxd T; arma_fortran(arma_zpotrs)(uplo, n, nrhs, (T*)a, lda, (T*)b, ldb, info, 1); } #else if( is_float::value) { typedef float T; arma_fortran(arma_spotrs)(uplo, n, nrhs, (T*)a, lda, (T*)b, ldb, info); } else if( is_double::value) { typedef double T; arma_fortran(arma_dpotrs)(uplo, n, nrhs, (T*)a, lda, (T*)b, ldb, info); } else if( is_cx_float::value) { typedef blas_cxf T; arma_fortran(arma_cpotrs)(uplo, n, nrhs, (T*)a, lda, (T*)b, ldb, info); } else if(is_cx_double::value) { typedef blas_cxd T; arma_fortran(arma_zpotrs)(uplo, n, nrhs, (T*)a, lda, (T*)b, ldb, info); } #endif } template inline void pbtrf(char* uplo, blas_int* n, blas_int* kd, eT* ab, blas_int* ldab, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_float::value) { typedef float T; arma_fortran(arma_spbtrf)(uplo, n, kd, (T*)ab, ldab, info, 1); } else if( is_double::value) { typedef double T; arma_fortran(arma_dpbtrf)(uplo, n, kd, (T*)ab, ldab, info, 1); } else if( is_cx_float::value) { typedef blas_cxf T; arma_fortran(arma_cpbtrf)(uplo, n, kd, (T*)ab, ldab, info, 1); } else if(is_cx_double::value) { typedef blas_cxd T; arma_fortran(arma_zpbtrf)(uplo, n, kd, (T*)ab, ldab, info, 1); } #else if( is_float::value) { typedef float T; arma_fortran(arma_spbtrf)(uplo, n, kd, (T*)ab, ldab, info); } else if( is_double::value) { typedef double T; arma_fortran(arma_dpbtrf)(uplo, n, kd, (T*)ab, ldab, info); } else if( is_cx_float::value) { typedef blas_cxf T; arma_fortran(arma_cpbtrf)(uplo, n, kd, (T*)ab, ldab, info); } else if(is_cx_double::value) { typedef blas_cxd T; arma_fortran(arma_zpbtrf)(uplo, n, kd, (T*)ab, ldab, info); } #endif } template inline void potri(char* uplo, blas_int* n, eT* a, blas_int* lda, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_float::value) { typedef float T; arma_fortran(arma_spotri)(uplo, n, (T*)a, lda, info, 1); } else if( is_double::value) { typedef double T; arma_fortran(arma_dpotri)(uplo, n, (T*)a, lda, info, 1); } else if( is_cx_float::value) { typedef blas_cxf T; arma_fortran(arma_cpotri)(uplo, n, (T*)a, lda, info, 1); } else if(is_cx_double::value) { typedef blas_cxd T; arma_fortran(arma_zpotri)(uplo, n, (T*)a, lda, info, 1); } #else if( is_float::value) { typedef float T; arma_fortran(arma_spotri)(uplo, n, (T*)a, lda, info); } else if( is_double::value) { typedef double T; arma_fortran(arma_dpotri)(uplo, n, (T*)a, lda, info); } else if( is_cx_float::value) { typedef blas_cxf T; arma_fortran(arma_cpotri)(uplo, n, (T*)a, lda, info); } else if(is_cx_double::value) { typedef blas_cxd T; arma_fortran(arma_zpotri)(uplo, n, (T*)a, lda, info); } #endif } template inline void geqrf(blas_int* m, blas_int* n, eT* a, blas_int* lda, eT* tau, eT* work, blas_int* lwork, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); if( is_float::value) { typedef float T; arma_fortran(arma_sgeqrf)(m, n, (T*)a, lda, (T*)tau, (T*)work, lwork, info); } else if( is_double::value) { typedef double T; arma_fortran(arma_dgeqrf)(m, n, (T*)a, lda, (T*)tau, (T*)work, lwork, info); } else if( is_cx_float::value) { typedef blas_cxf T; arma_fortran(arma_cgeqrf)(m, n, (T*)a, lda, (T*)tau, (T*)work, lwork, info); } else if(is_cx_double::value) { typedef blas_cxd T; arma_fortran(arma_zgeqrf)(m, n, (T*)a, lda, (T*)tau, (T*)work, lwork, info); } } template inline void geqp3(blas_int* m, blas_int* n, eT* a, blas_int* lda, blas_int* jpvt, eT* tau, eT* work, blas_int* lwork, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); if( is_float::value) { typedef float T; arma_fortran(arma_sgeqp3)(m, n, (T*)a, lda, jpvt, (T*)tau, (T*)work, lwork, info); } else if(is_double::value) { typedef double T; arma_fortran(arma_dgeqp3)(m, n, (T*)a, lda, jpvt, (T*)tau, (T*)work, lwork, info); } } template inline void cx_geqp3(blas_int* m, blas_int* n, eT* a, blas_int* lda, blas_int* jpvt, eT* tau, eT* work, blas_int* lwork, typename eT::value_type* rwork, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); if( is_cx_float::value) { typedef float T; typedef blas_cxf cx_T; arma_fortran(arma_cgeqp3)(m, n, (cx_T*)a, lda, jpvt, (cx_T*)tau, (cx_T*)work, lwork, (T*)rwork, info); } else if(is_cx_double::value) { typedef double T; typedef blas_cxd cx_T; arma_fortran(arma_zgeqp3)(m, n, (cx_T*)a, lda, jpvt, (cx_T*)tau, (cx_T*)work, lwork, (T*)rwork, info); } } template inline void orgqr(blas_int* m, blas_int* n, blas_int* k, eT* a, blas_int* lda, eT* tau, eT* work, blas_int* lwork, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); if( is_float::value) { typedef float T; arma_fortran(arma_sorgqr)(m, n, k, (T*)a, lda, (T*)tau, (T*)work, lwork, info); } else if(is_double::value) { typedef double T; arma_fortran(arma_dorgqr)(m, n, k, (T*)a, lda, (T*)tau, (T*)work, lwork, info); } } template inline void ungqr(blas_int* m, blas_int* n, blas_int* k, eT* a, blas_int* lda, eT* tau, eT* work, blas_int* lwork, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); if( is_cx_float::value) { typedef blas_cxf T; arma_fortran(arma_cungqr)(m, n, k, (T*)a, lda, (T*)tau, (T*)work, lwork, info); } else if(is_cx_double::value) { typedef blas_cxd T; arma_fortran(arma_zungqr)(m, n, k, (T*)a, lda, (T*)tau, (T*)work, lwork, info); } } template inline void gesvd ( char* jobu, char* jobvt, blas_int* m, blas_int* n, eT* a, blas_int* lda, eT* s, eT* u, blas_int* ldu, eT* vt, blas_int* ldvt, eT* work, blas_int* lwork, blas_int* info ) { arma_type_check(( is_supported_blas_type::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_float::value) { typedef float T; arma_fortran(arma_sgesvd)(jobu, jobvt, m, n, (T*)a, lda, (T*)s, (T*)u, ldu, (T*)vt, ldvt, (T*)work, lwork, info, 1, 1); } else if(is_double::value) { typedef double T; arma_fortran(arma_dgesvd)(jobu, jobvt, m, n, (T*)a, lda, (T*)s, (T*)u, ldu, (T*)vt, ldvt, (T*)work, lwork, info, 1, 1); } #else if( is_float::value) { typedef float T; arma_fortran(arma_sgesvd)(jobu, jobvt, m, n, (T*)a, lda, (T*)s, (T*)u, ldu, (T*)vt, ldvt, (T*)work, lwork, info); } else if(is_double::value) { typedef double T; arma_fortran(arma_dgesvd)(jobu, jobvt, m, n, (T*)a, lda, (T*)s, (T*)u, ldu, (T*)vt, ldvt, (T*)work, lwork, info); } #endif } template inline void cx_gesvd ( char* jobu, char* jobvt, blas_int* m, blas_int* n, std::complex* a, blas_int* lda, T* s, std::complex* u, blas_int* ldu, std::complex* vt, blas_int* ldvt, std::complex* work, blas_int* lwork, T* rwork, blas_int* info ) { arma_type_check(( is_supported_blas_type::value == false )); arma_type_check(( is_supported_blas_type< std::complex >::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_float::value) { typedef float bT; typedef blas_cxf cx_bT; arma_fortran(arma_cgesvd)(jobu, jobvt, m, n, (cx_bT*)a, lda, (bT*)s, (cx_bT*)u, ldu, (cx_bT*)vt, ldvt, (cx_bT*)work, lwork, (bT*)rwork, info, 1, 1); } else if(is_double::value) { typedef double bT; typedef blas_cxd cx_bT; arma_fortran(arma_zgesvd)(jobu, jobvt, m, n, (cx_bT*)a, lda, (bT*)s, (cx_bT*)u, ldu, (cx_bT*)vt, ldvt, (cx_bT*)work, lwork, (bT*)rwork, info, 1, 1); } #else if( is_float::value) { typedef float bT; typedef blas_cxf cx_bT; arma_fortran(arma_cgesvd)(jobu, jobvt, m, n, (cx_bT*)a, lda, (bT*)s, (cx_bT*)u, ldu, (cx_bT*)vt, ldvt, (cx_bT*)work, lwork, (bT*)rwork, info); } else if(is_double::value) { typedef double bT; typedef blas_cxd cx_bT; arma_fortran(arma_zgesvd)(jobu, jobvt, m, n, (cx_bT*)a, lda, (bT*)s, (cx_bT*)u, ldu, (cx_bT*)vt, ldvt, (cx_bT*)work, lwork, (bT*)rwork, info); } #endif } template inline void gesdd ( char* jobz, blas_int* m, blas_int* n, eT* a, blas_int* lda, eT* s, eT* u, blas_int* ldu, eT* vt, blas_int* ldvt, eT* work, blas_int* lwork, blas_int* iwork, blas_int* info ) { arma_type_check(( is_supported_blas_type::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_float::value) { typedef float T; arma_fortran(arma_sgesdd)(jobz, m, n, (T*)a, lda, (T*)s, (T*)u, ldu, (T*)vt, ldvt, (T*)work, lwork, iwork, info, 1); } else if(is_double::value) { typedef double T; arma_fortran(arma_dgesdd)(jobz, m, n, (T*)a, lda, (T*)s, (T*)u, ldu, (T*)vt, ldvt, (T*)work, lwork, iwork, info, 1); } #else if( is_float::value) { typedef float T; arma_fortran(arma_sgesdd)(jobz, m, n, (T*)a, lda, (T*)s, (T*)u, ldu, (T*)vt, ldvt, (T*)work, lwork, iwork, info); } else if(is_double::value) { typedef double T; arma_fortran(arma_dgesdd)(jobz, m, n, (T*)a, lda, (T*)s, (T*)u, ldu, (T*)vt, ldvt, (T*)work, lwork, iwork, info); } #endif } template inline void cx_gesdd ( char* jobz, blas_int* m, blas_int* n, std::complex* a, blas_int* lda, T* s, std::complex* u, blas_int* ldu, std::complex* vt, blas_int* ldvt, std::complex* work, blas_int* lwork, T* rwork, blas_int* iwork, blas_int* info ) { arma_type_check(( is_supported_blas_type::value == false )); arma_type_check(( is_supported_blas_type< std::complex >::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_float::value) { typedef float bT; typedef blas_cxf cx_bT; arma_fortran(arma_cgesdd)(jobz, m, n, (cx_bT*)a, lda, (bT*)s, (cx_bT*)u, ldu, (cx_bT*)vt, ldvt, (cx_bT*)work, lwork, (bT*)rwork, iwork, info, 1); } else if(is_double::value) { typedef double bT; typedef blas_cxd cx_bT; arma_fortran(arma_zgesdd)(jobz, m, n, (cx_bT*)a, lda, (bT*)s, (cx_bT*)u, ldu, (cx_bT*)vt, ldvt, (cx_bT*)work, lwork, (bT*)rwork, iwork, info, 1); } #else if( is_float::value) { typedef float bT; typedef blas_cxf cx_bT; arma_fortran(arma_cgesdd)(jobz, m, n, (cx_bT*)a, lda, (bT*)s, (cx_bT*)u, ldu, (cx_bT*)vt, ldvt, (cx_bT*)work, lwork, (bT*)rwork, iwork, info); } else if(is_double::value) { typedef double bT; typedef blas_cxd cx_bT; arma_fortran(arma_zgesdd)(jobz, m, n, (cx_bT*)a, lda, (bT*)s, (cx_bT*)u, ldu, (cx_bT*)vt, ldvt, (cx_bT*)work, lwork, (bT*)rwork, iwork, info); } #endif } template inline void gesv(blas_int* n, blas_int* nrhs, eT* a, blas_int* lda, blas_int* ipiv, eT* b, blas_int* ldb, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); if( is_float::value) { typedef float T; arma_fortran(arma_sgesv)(n, nrhs, (T*)a, lda, ipiv, (T*)b, ldb, info); } else if( is_double::value) { typedef double T; arma_fortran(arma_dgesv)(n, nrhs, (T*)a, lda, ipiv, (T*)b, ldb, info); } else if( is_cx_float::value) { typedef blas_cxf T; arma_fortran(arma_cgesv)(n, nrhs, (T*)a, lda, ipiv, (T*)b, ldb, info); } else if(is_cx_double::value) { typedef blas_cxd T; arma_fortran(arma_zgesv)(n, nrhs, (T*)a, lda, ipiv, (T*)b, ldb, info); } } template inline void gesvx(char* fact, char* trans, blas_int* n, blas_int* nrhs, eT* a, blas_int* lda, eT* af, blas_int* ldaf, blas_int* ipiv, char* equed, eT* r, eT* c, eT* b, blas_int* ldb, eT* x, blas_int* ldx, eT* rcond, eT* ferr, eT* berr, eT* work, blas_int* iwork, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_float::value) { typedef float T; arma_fortran(arma_sgesvx)(fact, trans, n, nrhs, (T*)a, lda, (T*)af, ldaf, ipiv, equed, (T*)r, (T*)c, (T*)b, ldb, (T*)x, ldx, (T*)rcond, (T*)ferr, (T*)berr, (T*)work, iwork, info, 1, 1, 1); } else if(is_double::value) { typedef double T; arma_fortran(arma_dgesvx)(fact, trans, n, nrhs, (T*)a, lda, (T*)af, ldaf, ipiv, equed, (T*)r, (T*)c, (T*)b, ldb, (T*)x, ldx, (T*)rcond, (T*)ferr, (T*)berr, (T*)work, iwork, info, 1, 1, 1); } #else if( is_float::value) { typedef float T; arma_fortran(arma_sgesvx)(fact, trans, n, nrhs, (T*)a, lda, (T*)af, ldaf, ipiv, equed, (T*)r, (T*)c, (T*)b, ldb, (T*)x, ldx, (T*)rcond, (T*)ferr, (T*)berr, (T*)work, iwork, info); } else if(is_double::value) { typedef double T; arma_fortran(arma_dgesvx)(fact, trans, n, nrhs, (T*)a, lda, (T*)af, ldaf, ipiv, equed, (T*)r, (T*)c, (T*)b, ldb, (T*)x, ldx, (T*)rcond, (T*)ferr, (T*)berr, (T*)work, iwork, info); } #endif } template inline void cx_gesvx(char* fact, char* trans, blas_int* n, blas_int* nrhs, eT* a, blas_int* lda, eT* af, blas_int* ldaf, blas_int* ipiv, char* equed, T* r, T* c, eT* b, blas_int* ldb, eT* x, blas_int* ldx, T* rcond, T* ferr, T* berr, eT* work, T* rwork, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_cx_float::value) { typedef float pod_T; typedef blas_cxf cx_T; arma_fortran(arma_cgesvx)(fact, trans, n, nrhs, (cx_T*)a, lda, (cx_T*)af, ldaf, ipiv, equed, (pod_T*)r, (pod_T*)c, (cx_T*)b, ldb, (cx_T*)x, ldx, (pod_T*)rcond, (pod_T*)ferr, (pod_T*)berr, (cx_T*)work, (pod_T*)rwork, info, 1, 1, 1); } else if(is_cx_double::value) { typedef double pod_T; typedef blas_cxd cx_T; arma_fortran(arma_zgesvx)(fact, trans, n, nrhs, (cx_T*)a, lda, (cx_T*)af, ldaf, ipiv, equed, (pod_T*)r, (pod_T*)c, (cx_T*)b, ldb, (cx_T*)x, ldx, (pod_T*)rcond, (pod_T*)ferr, (pod_T*)berr, (cx_T*)work, (pod_T*)rwork, info, 1, 1, 1); } #else if( is_cx_float::value) { typedef float pod_T; typedef blas_cxf cx_T; arma_fortran(arma_cgesvx)(fact, trans, n, nrhs, (cx_T*)a, lda, (cx_T*)af, ldaf, ipiv, equed, (pod_T*)r, (pod_T*)c, (cx_T*)b, ldb, (cx_T*)x, ldx, (pod_T*)rcond, (pod_T*)ferr, (pod_T*)berr, (cx_T*)work, (pod_T*)rwork, info); } else if(is_cx_double::value) { typedef double pod_T; typedef blas_cxd cx_T; arma_fortran(arma_zgesvx)(fact, trans, n, nrhs, (cx_T*)a, lda, (cx_T*)af, ldaf, ipiv, equed, (pod_T*)r, (pod_T*)c, (cx_T*)b, ldb, (cx_T*)x, ldx, (pod_T*)rcond, (pod_T*)ferr, (pod_T*)berr, (cx_T*)work, (pod_T*)rwork, info); } #endif } template inline void posv(char* uplo, blas_int* n, blas_int* nrhs, eT* a, blas_int* lda, eT* b, blas_int* ldb, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_float::value) { typedef float T; arma_fortran(arma_sposv)(uplo, n, nrhs, (T*)a, lda, (T*)b, ldb, info, 1); } else if( is_double::value) { typedef double T; arma_fortran(arma_dposv)(uplo, n, nrhs, (T*)a, lda, (T*)b, ldb, info, 1); } else if( is_cx_float::value) { typedef blas_cxf T; arma_fortran(arma_cposv)(uplo, n, nrhs, (T*)a, lda, (T*)b, ldb, info, 1); } else if(is_cx_double::value) { typedef blas_cxd T; arma_fortran(arma_zposv)(uplo, n, nrhs, (T*)a, lda, (T*)b, ldb, info, 1); } #else if( is_float::value) { typedef float T; arma_fortran(arma_sposv)(uplo, n, nrhs, (T*)a, lda, (T*)b, ldb, info); } else if( is_double::value) { typedef double T; arma_fortran(arma_dposv)(uplo, n, nrhs, (T*)a, lda, (T*)b, ldb, info); } else if( is_cx_float::value) { typedef blas_cxf T; arma_fortran(arma_cposv)(uplo, n, nrhs, (T*)a, lda, (T*)b, ldb, info); } else if(is_cx_double::value) { typedef blas_cxd T; arma_fortran(arma_zposv)(uplo, n, nrhs, (T*)a, lda, (T*)b, ldb, info); } #endif } template inline void posvx(char* fact, char* uplo, blas_int* n, blas_int* nrhs, eT* a, blas_int* lda, eT* af, blas_int* ldaf, char* equed, eT* s, eT* b, blas_int* ldb, eT* x, blas_int* ldx, eT* rcond, eT* ferr, eT* berr, eT* work, blas_int* iwork, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_float::value) { typedef float T; arma_fortran(arma_sposvx)(fact, uplo, n, nrhs, (T*)a, lda, (T*)af, ldaf, equed, (T*)s, (T*)b, ldb, (T*)x, ldx, (T*)rcond, (T*)ferr, (T*)berr, (T*)work, iwork, info, 1, 1, 1); } else if(is_double::value) { typedef double T; arma_fortran(arma_dposvx)(fact, uplo, n, nrhs, (T*)a, lda, (T*)af, ldaf, equed, (T*)s, (T*)b, ldb, (T*)x, ldx, (T*)rcond, (T*)ferr, (T*)berr, (T*)work, iwork, info, 1, 1, 1); } #else if( is_float::value) { typedef float T; arma_fortran(arma_sposvx)(fact, uplo, n, nrhs, (T*)a, lda, (T*)af, ldaf, equed, (T*)s, (T*)b, ldb, (T*)x, ldx, (T*)rcond, (T*)ferr, (T*)berr, (T*)work, iwork, info); } else if(is_double::value) { typedef double T; arma_fortran(arma_dposvx)(fact, uplo, n, nrhs, (T*)a, lda, (T*)af, ldaf, equed, (T*)s, (T*)b, ldb, (T*)x, ldx, (T*)rcond, (T*)ferr, (T*)berr, (T*)work, iwork, info); } #endif } template inline void cx_posvx(char* fact, char* uplo, blas_int* n, blas_int* nrhs, eT* a, blas_int* lda, eT* af, blas_int* ldaf, char* equed, T* s, eT* b, blas_int* ldb, eT* x, blas_int* ldx, T* rcond, T* ferr, T* berr, eT* work, T* rwork, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_cx_float::value) { typedef float pod_T; typedef blas_cxf cx_T; arma_fortran(arma_cposvx)(fact, uplo, n, nrhs, (cx_T*)a, lda, (cx_T*)af, ldaf, equed, (pod_T*)s, (cx_T*)b, ldb, (cx_T*)x, ldx, (pod_T*)rcond, (pod_T*)ferr, (pod_T*)berr, (cx_T*)work, (pod_T*)rwork, info, 1, 1, 1); } else if(is_cx_double::value) { typedef double pod_T; typedef blas_cxd cx_T; arma_fortran(arma_zposvx)(fact, uplo, n, nrhs, (cx_T*)a, lda, (cx_T*)af, ldaf, equed, (pod_T*)s, (cx_T*)b, ldb, (cx_T*)x, ldx, (pod_T*)rcond, (pod_T*)ferr, (pod_T*)berr, (cx_T*)work, (pod_T*)rwork, info, 1, 1, 1); } #else if( is_cx_float::value) { typedef float pod_T; typedef blas_cxf cx_T; arma_fortran(arma_cposvx)(fact, uplo, n, nrhs, (cx_T*)a, lda, (cx_T*)af, ldaf, equed, (pod_T*)s, (cx_T*)b, ldb, (cx_T*)x, ldx, (pod_T*)rcond, (pod_T*)ferr, (pod_T*)berr, (cx_T*)work, (pod_T*)rwork, info); } else if(is_cx_double::value) { typedef double pod_T; typedef blas_cxd cx_T; arma_fortran(arma_zposvx)(fact, uplo, n, nrhs, (cx_T*)a, lda, (cx_T*)af, ldaf, equed, (pod_T*)s, (cx_T*)b, ldb, (cx_T*)x, ldx, (pod_T*)rcond, (pod_T*)ferr, (pod_T*)berr, (cx_T*)work, (pod_T*)rwork, info); } #endif } template inline void gels(char* trans, blas_int* m, blas_int* n, blas_int* nrhs, eT* a, blas_int* lda, eT* b, blas_int* ldb, eT* work, blas_int* lwork, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_float::value) { typedef float T; arma_fortran(arma_sgels)(trans, m, n, nrhs, (T*)a, lda, (T*)b, ldb, (T*)work, lwork, info, 1); } else if( is_double::value) { typedef double T; arma_fortran(arma_dgels)(trans, m, n, nrhs, (T*)a, lda, (T*)b, ldb, (T*)work, lwork, info, 1); } else if( is_cx_float::value) { typedef blas_cxf T; arma_fortran(arma_cgels)(trans, m, n, nrhs, (T*)a, lda, (T*)b, ldb, (T*)work, lwork, info, 1); } else if(is_cx_double::value) { typedef blas_cxd T; arma_fortran(arma_zgels)(trans, m, n, nrhs, (T*)a, lda, (T*)b, ldb, (T*)work, lwork, info, 1); } #else if( is_float::value) { typedef float T; arma_fortran(arma_sgels)(trans, m, n, nrhs, (T*)a, lda, (T*)b, ldb, (T*)work, lwork, info); } else if( is_double::value) { typedef double T; arma_fortran(arma_dgels)(trans, m, n, nrhs, (T*)a, lda, (T*)b, ldb, (T*)work, lwork, info); } else if( is_cx_float::value) { typedef blas_cxf T; arma_fortran(arma_cgels)(trans, m, n, nrhs, (T*)a, lda, (T*)b, ldb, (T*)work, lwork, info); } else if(is_cx_double::value) { typedef blas_cxd T; arma_fortran(arma_zgels)(trans, m, n, nrhs, (T*)a, lda, (T*)b, ldb, (T*)work, lwork, info); } #endif } template inline void gelsd(blas_int* m, blas_int* n, blas_int* nrhs, eT* a, blas_int* lda, eT* b, blas_int* ldb, eT* S, eT* rcond, blas_int* rank, eT* work, blas_int* lwork, blas_int* iwork, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); if( is_float::value) { typedef float T; arma_fortran(arma_sgelsd)(m, n, nrhs, (T*)a, lda, (T*)b, ldb, (T*)S, (T*)rcond, rank, (T*)work, lwork, iwork, info); } else if(is_double::value) { typedef double T; arma_fortran(arma_dgelsd)(m, n, nrhs, (T*)a, lda, (T*)b, ldb, (T*)S, (T*)rcond, rank, (T*)work, lwork, iwork, info); } } template inline void cx_gelsd(blas_int* m, blas_int* n, blas_int* nrhs, std::complex* a, blas_int* lda, std::complex* b, blas_int* ldb, T* S, T* rcond, blas_int* rank, std::complex* work, blas_int* lwork, T* rwork, blas_int* iwork, blas_int* info) { typedef typename std::complex eT; arma_type_check(( is_supported_blas_type::value == false )); if( is_cx_float::value) { typedef float pod_T; typedef blas_cxf cx_T; arma_fortran(arma_cgelsd)(m, n, nrhs, (cx_T*)a, lda, (cx_T*)b, ldb, (pod_T*)S, (pod_T*)rcond, rank, (cx_T*)work, lwork, (pod_T*)rwork, iwork, info); } else if(is_cx_double::value) { typedef double pod_T; typedef blas_cxd cx_T; arma_fortran(arma_zgelsd)(m, n, nrhs, (cx_T*)a, lda, (cx_T*)b, ldb, (pod_T*)S, (pod_T*)rcond, rank, (cx_T*)work, lwork, (pod_T*)rwork, iwork, info); } } template inline void trtrs(char* uplo, char* trans, char* diag, blas_int* n, blas_int* nrhs, const eT* a, blas_int* lda, eT* b, blas_int* ldb, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_float::value) { typedef float T; arma_fortran(arma_strtrs)(uplo, trans, diag, n, nrhs, (T*)a, lda, (T*)b, ldb, info, 1, 1, 1); } else if( is_double::value) { typedef double T; arma_fortran(arma_dtrtrs)(uplo, trans, diag, n, nrhs, (T*)a, lda, (T*)b, ldb, info, 1, 1, 1); } else if( is_cx_float::value) { typedef blas_cxf T; arma_fortran(arma_ctrtrs)(uplo, trans, diag, n, nrhs, (T*)a, lda, (T*)b, ldb, info, 1, 1, 1); } else if(is_cx_double::value) { typedef blas_cxd T; arma_fortran(arma_ztrtrs)(uplo, trans, diag, n, nrhs, (T*)a, lda, (T*)b, ldb, info, 1, 1, 1); } #else if( is_float::value) { typedef float T; arma_fortran(arma_strtrs)(uplo, trans, diag, n, nrhs, (T*)a, lda, (T*)b, ldb, info); } else if( is_double::value) { typedef double T; arma_fortran(arma_dtrtrs)(uplo, trans, diag, n, nrhs, (T*)a, lda, (T*)b, ldb, info); } else if( is_cx_float::value) { typedef blas_cxf T; arma_fortran(arma_ctrtrs)(uplo, trans, diag, n, nrhs, (T*)a, lda, (T*)b, ldb, info); } else if(is_cx_double::value) { typedef blas_cxd T; arma_fortran(arma_ztrtrs)(uplo, trans, diag, n, nrhs, (T*)a, lda, (T*)b, ldb, info); } #endif } template inline void gbtrf(blas_int* m, blas_int* n, blas_int* kl, blas_int* ku, eT* ab, blas_int* ldab, blas_int* ipiv, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); if( is_float::value) { typedef float T; arma_fortran(arma_sgbtrf)(m, n, kl, ku, (T*)ab, ldab, ipiv, info); } else if( is_double::value) { typedef double T; arma_fortran(arma_dgbtrf)(m, n, kl, ku, (T*)ab, ldab, ipiv, info); } else if( is_cx_float::value) { typedef blas_cxf T; arma_fortran(arma_cgbtrf)(m, n, kl, ku, (T*)ab, ldab, ipiv, info); } else if(is_cx_double::value) { typedef blas_cxd T; arma_fortran(arma_zgbtrf)(m, n, kl, ku, (T*)ab, ldab, ipiv, info); } } template inline void gbtrs(char* trans, blas_int* n, blas_int* kl, blas_int* ku, blas_int* nrhs, eT* ab, blas_int* ldab, blas_int* ipiv, eT* b, blas_int* ldb, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_float::value) { typedef float T; arma_fortran(arma_sgbtrs)(trans, n, kl, ku, nrhs, (T*)ab, ldab, ipiv, (T*)b, ldb, info, 1); } else if( is_double::value) { typedef double T; arma_fortran(arma_dgbtrs)(trans, n, kl, ku, nrhs, (T*)ab, ldab, ipiv, (T*)b, ldb, info, 1); } else if( is_cx_float::value) { typedef blas_cxf T; arma_fortran(arma_cgbtrs)(trans, n, kl, ku, nrhs, (T*)ab, ldab, ipiv, (T*)b, ldb, info, 1); } else if(is_cx_double::value) { typedef blas_cxd T; arma_fortran(arma_zgbtrs)(trans, n, kl, ku, nrhs, (T*)ab, ldab, ipiv, (T*)b, ldb, info, 1); } #else if( is_float::value) { typedef float T; arma_fortran(arma_sgbtrs)(trans, n, kl, ku, nrhs, (T*)ab, ldab, ipiv, (T*)b, ldb, info); } else if( is_double::value) { typedef double T; arma_fortran(arma_dgbtrs)(trans, n, kl, ku, nrhs, (T*)ab, ldab, ipiv, (T*)b, ldb, info); } else if( is_cx_float::value) { typedef blas_cxf T; arma_fortran(arma_cgbtrs)(trans, n, kl, ku, nrhs, (T*)ab, ldab, ipiv, (T*)b, ldb, info); } else if(is_cx_double::value) { typedef blas_cxd T; arma_fortran(arma_zgbtrs)(trans, n, kl, ku, nrhs, (T*)ab, ldab, ipiv, (T*)b, ldb, info); } #endif } template inline void gbsv(blas_int* n, blas_int* kl, blas_int* ku, blas_int* nrhs, eT* ab, blas_int* ldab, blas_int* ipiv, eT* b, blas_int* ldb, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); if( is_float::value) { typedef float T; arma_fortran(arma_sgbsv)(n, kl, ku, nrhs, (T*)ab, ldab, ipiv, (T*)b, ldb, info); } else if( is_double::value) { typedef double T; arma_fortran(arma_dgbsv)(n, kl, ku, nrhs, (T*)ab, ldab, ipiv, (T*)b, ldb, info); } else if( is_cx_float::value) { typedef blas_cxf T; arma_fortran(arma_cgbsv)(n, kl, ku, nrhs, (T*)ab, ldab, ipiv, (T*)b, ldb, info); } else if(is_cx_double::value) { typedef blas_cxd T; arma_fortran(arma_zgbsv)(n, kl, ku, nrhs, (T*)ab, ldab, ipiv, (T*)b, ldb, info); } } template inline void gbsvx(char* fact, char* trans, blas_int* n, blas_int* kl, blas_int* ku, blas_int* nrhs, eT* ab, blas_int* ldab, eT* afb, blas_int* ldafb, blas_int* ipiv, char* equed, eT* r, eT* c, eT* b, blas_int* ldb, eT* x, blas_int* ldx, eT* rcond, eT* ferr, eT* berr, eT* work, blas_int* iwork, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_float::value) { typedef float T; arma_fortran(arma_sgbsvx)(fact, trans, n, kl, ku, nrhs, (T*)ab, ldab, (T*)afb, ldafb, ipiv, equed, (T*)r, (T*)c, (T*)b, ldb, (T*)x, ldx, (T*)rcond, (T*)ferr, (T*)berr, (T*)work, iwork, info, 1, 1, 1); } else if(is_double::value) { typedef double T; arma_fortran(arma_dgbsvx)(fact, trans, n, kl, ku, nrhs, (T*)ab, ldab, (T*)afb, ldafb, ipiv, equed, (T*)r, (T*)c, (T*)b, ldb, (T*)x, ldx, (T*)rcond, (T*)ferr, (T*)berr, (T*)work, iwork, info, 1, 1, 1); } #else if( is_float::value) { typedef float T; arma_fortran(arma_sgbsvx)(fact, trans, n, kl, ku, nrhs, (T*)ab, ldab, (T*)afb, ldafb, ipiv, equed, (T*)r, (T*)c, (T*)b, ldb, (T*)x, ldx, (T*)rcond, (T*)ferr, (T*)berr, (T*)work, iwork, info); } else if(is_double::value) { typedef double T; arma_fortran(arma_dgbsvx)(fact, trans, n, kl, ku, nrhs, (T*)ab, ldab, (T*)afb, ldafb, ipiv, equed, (T*)r, (T*)c, (T*)b, ldb, (T*)x, ldx, (T*)rcond, (T*)ferr, (T*)berr, (T*)work, iwork, info); } #endif } template inline void cx_gbsvx(char* fact, char* trans, blas_int* n, blas_int* kl, blas_int* ku, blas_int* nrhs, eT* ab, blas_int* ldab, eT* afb, blas_int* ldafb, blas_int* ipiv, char* equed, T* r, T* c, eT* b, blas_int* ldb, eT* x, blas_int* ldx, T* rcond, T* ferr, T* berr, eT* work, T* rwork, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_cx_float::value) { typedef float pod_T; typedef blas_cxf cx_T; arma_fortran(arma_cgbsvx)(fact, trans, n, kl, ku, nrhs, (cx_T*)ab, ldab, (cx_T*)afb, ldafb, ipiv, equed, (pod_T*)r, (pod_T*)c, (cx_T*)b, ldb, (cx_T*)x, ldx, (pod_T*)rcond, (pod_T*)ferr, (pod_T*)berr, (cx_T*)work, (pod_T*)rwork, info, 1, 1, 1); } else if(is_cx_double::value) { typedef double pod_T; typedef blas_cxd cx_T; arma_fortran(arma_zgbsvx)(fact, trans, n, kl, ku, nrhs, (cx_T*)ab, ldab, (cx_T*)afb, ldafb, ipiv, equed, (pod_T*)r, (pod_T*)c, (cx_T*)b, ldb, (cx_T*)x, ldx, (pod_T*)rcond, (pod_T*)ferr, (pod_T*)berr, (cx_T*)work, (pod_T*)rwork, info, 1, 1, 1); } #else if( is_cx_float::value) { typedef float pod_T; typedef blas_cxf cx_T; arma_fortran(arma_cgbsvx)(fact, trans, n, kl, ku, nrhs, (cx_T*)ab, ldab, (cx_T*)afb, ldafb, ipiv, equed, (pod_T*)r, (pod_T*)c, (cx_T*)b, ldb, (cx_T*)x, ldx, (pod_T*)rcond, (pod_T*)ferr, (pod_T*)berr, (cx_T*)work, (pod_T*)rwork, info); } else if(is_cx_double::value) { typedef double pod_T; typedef blas_cxd cx_T; arma_fortran(arma_zgbsvx)(fact, trans, n, kl, ku, nrhs, (cx_T*)ab, ldab, (cx_T*)afb, ldafb, ipiv, equed, (pod_T*)r, (pod_T*)c, (cx_T*)b, ldb, (cx_T*)x, ldx, (pod_T*)rcond, (pod_T*)ferr, (pod_T*)berr, (cx_T*)work, (pod_T*)rwork, info); } #endif } template inline void gtsv(blas_int* n, blas_int* nrhs, eT* dl, eT* d, eT* du, eT* b, blas_int* ldb, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); if( is_float::value) { typedef float T; arma_fortran(arma_sgtsv)(n, nrhs, (T*)dl, (T*)d, (T*)du, (T*)b, ldb, info); } else if( is_double::value) { typedef double T; arma_fortran(arma_dgtsv)(n, nrhs, (T*)dl, (T*)d, (T*)du, (T*)b, ldb, info); } else if( is_cx_float::value) { typedef blas_cxf T; arma_fortran(arma_cgtsv)(n, nrhs, (T*)dl, (T*)d, (T*)du, (T*)b, ldb, info); } else if(is_cx_double::value) { typedef blas_cxd T; arma_fortran(arma_zgtsv)(n, nrhs, (T*)dl, (T*)d, (T*)du, (T*)b, ldb, info); } } template inline void gtsvx(char* fact, char* trans, blas_int* n, blas_int* nrhs, eT* dl, eT* d, eT* du, eT* dlf, eT* df, eT* duf, eT* du2, blas_int* ipiv, eT* b, blas_int* ldb, eT* x, blas_int* ldx, eT* rcond, eT* ferr, eT* berr, eT* work, blas_int* iwork, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_float::value) { typedef float T; arma_fortran(arma_sgtsvx)(fact, trans, n, nrhs, (T*)dl, (T*)d, (T*)du, (T*)dlf, (T*)df, (T*)duf, (T*)du2, ipiv, (T*)b, ldb, (T*)x, ldx, (T*)rcond, (T*)ferr, (T*)berr, (T*)work, iwork, info, 1, 1); } else if(is_double::value) { typedef double T; arma_fortran(arma_dgtsvx)(fact, trans, n, nrhs, (T*)dl, (T*)d, (T*)du, (T*)dlf, (T*)df, (T*)duf, (T*)du2, ipiv, (T*)b, ldb, (T*)x, ldx, (T*)rcond, (T*)ferr, (T*)berr, (T*)work, iwork, info, 1, 1); } #else if( is_float::value) { typedef float T; arma_fortran(arma_sgtsvx)(fact, trans, n, nrhs, (T*)dl, (T*)d, (T*)du, (T*)dlf, (T*)df, (T*)duf, (T*)du2, ipiv, (T*)b, ldb, (T*)x, ldx, (T*)rcond, (T*)ferr, (T*)berr, (T*)work, iwork, info); } else if(is_double::value) { typedef double T; arma_fortran(arma_dgtsvx)(fact, trans, n, nrhs, (T*)dl, (T*)d, (T*)du, (T*)dlf, (T*)df, (T*)duf, (T*)du2, ipiv, (T*)b, ldb, (T*)x, ldx, (T*)rcond, (T*)ferr, (T*)berr, (T*)work, iwork, info); } #endif } template inline void cx_gtsvx(char* fact, char* trans, blas_int* n, blas_int* nrhs, eT* dl, eT* d, eT* du, eT* dlf, eT* df, eT* duf, eT* du2, blas_int* ipiv, eT* b, blas_int* ldb, eT* x, blas_int* ldx, T* rcond, T* ferr, T* berr, eT* work, T* rwork, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_cx_float::value) { typedef float pod_T; typedef blas_cxf cx_T; arma_fortran(arma_cgtsvx)(fact, trans, n, nrhs, (cx_T*)dl, (cx_T*)d, (cx_T*)du, (cx_T*)dlf, (cx_T*)df, (cx_T*)duf, (cx_T*)du2, ipiv, (cx_T*)b, ldb, (cx_T*)x, ldx, (pod_T*)rcond, (pod_T*)ferr, (pod_T*)berr, (cx_T*)work, (pod_T*)rwork, info, 1, 1); } else if(is_cx_double::value) { typedef double pod_T; typedef blas_cxd cx_T; arma_fortran(arma_zgtsvx)(fact, trans, n, nrhs, (cx_T*)dl, (cx_T*)d, (cx_T*)du, (cx_T*)dlf, (cx_T*)df, (cx_T*)duf, (cx_T*)du2, ipiv, (cx_T*)b, ldb, (cx_T*)x, ldx, (pod_T*)rcond, (pod_T*)ferr, (pod_T*)berr, (cx_T*)work, (pod_T*)rwork, info, 1, 1); } #else if( is_cx_float::value) { typedef float pod_T; typedef blas_cxf cx_T; arma_fortran(arma_cgtsvx)(fact, trans, n, nrhs, (cx_T*)dl, (cx_T*)d, (cx_T*)du, (cx_T*)dlf, (cx_T*)df, (cx_T*)duf, (cx_T*)du2, ipiv, (cx_T*)b, ldb, (cx_T*)x, ldx, (pod_T*)rcond, (pod_T*)ferr, (pod_T*)berr, (cx_T*)work, (pod_T*)rwork, info); } else if(is_cx_double::value) { typedef double pod_T; typedef blas_cxd cx_T; arma_fortran(arma_zgtsvx)(fact, trans, n, nrhs, (cx_T*)dl, (cx_T*)d, (cx_T*)du, (cx_T*)dlf, (cx_T*)df, (cx_T*)duf, (cx_T*)du2, ipiv, (cx_T*)b, ldb, (cx_T*)x, ldx, (pod_T*)rcond, (pod_T*)ferr, (pod_T*)berr, (cx_T*)work, (pod_T*)rwork, info); } #endif } template inline void gees(char* jobvs, char* sort, void* select, blas_int* n, eT* a, blas_int* lda, blas_int* sdim, eT* wr, eT* wi, eT* vs, blas_int* ldvs, eT* work, blas_int* lwork, blas_int* bwork, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_float::value) { typedef float T; arma_fortran(arma_sgees)(jobvs, sort, (fn_select_s2)select, n, (T*)a, lda, sdim, (T*)wr, (T*)wi, (T*)vs, ldvs, (T*)work, lwork, bwork, info, 1, 1); } else if(is_double::value) { typedef double T; arma_fortran(arma_dgees)(jobvs, sort, (fn_select_d2)select, n, (T*)a, lda, sdim, (T*)wr, (T*)wi, (T*)vs, ldvs, (T*)work, lwork, bwork, info, 1, 1); } #else if( is_float::value) { typedef float T; arma_fortran(arma_sgees)(jobvs, sort, (fn_select_s2)select, n, (T*)a, lda, sdim, (T*)wr, (T*)wi, (T*)vs, ldvs, (T*)work, lwork, bwork, info); } else if(is_double::value) { typedef double T; arma_fortran(arma_dgees)(jobvs, sort, (fn_select_d2)select, n, (T*)a, lda, sdim, (T*)wr, (T*)wi, (T*)vs, ldvs, (T*)work, lwork, bwork, info); } #endif } template inline void cx_gees(char* jobvs, char* sort, void* select, blas_int* n, std::complex* a, blas_int* lda, blas_int* sdim, std::complex* w, std::complex* vs, blas_int* ldvs, std::complex* work, blas_int* lwork, T* rwork, blas_int* bwork, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); arma_type_check(( is_supported_blas_type< std::complex >::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_float::value) { typedef float bT; typedef blas_cxf cT; arma_fortran(arma_cgees)(jobvs, sort, (fn_select_c1)select, n, (cT*)a, lda, sdim, (cT*)w, (cT*)vs, ldvs, (cT*)work, lwork, (bT*)rwork, bwork, info, 1, 1); } else if(is_double::value) { typedef double bT; typedef blas_cxd cT; arma_fortran(arma_zgees)(jobvs, sort, (fn_select_z1)select, n, (cT*)a, lda, sdim, (cT*)w, (cT*)vs, ldvs, (cT*)work, lwork, (bT*)rwork, bwork, info, 1, 1); } #else if( is_float::value) { typedef float bT; typedef blas_cxf cT; arma_fortran(arma_cgees)(jobvs, sort, (fn_select_c1)select, n, (cT*)a, lda, sdim, (cT*)w, (cT*)vs, ldvs, (cT*)work, lwork, (bT*)rwork, bwork, info); } else if(is_double::value) { typedef double bT; typedef blas_cxd cT; arma_fortran(arma_zgees)(jobvs, sort, (fn_select_z1)select, n, (cT*)a, lda, sdim, (cT*)w, (cT*)vs, ldvs, (cT*)work, lwork, (bT*)rwork, bwork, info); } #endif } template inline void trsyl(char* transa, char* transb, blas_int* isgn, blas_int* m, blas_int* n, const eT* a, blas_int* lda, const eT* b, blas_int* ldb, eT* c, blas_int* ldc, eT* scale, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_float::value) { typedef float T; arma_fortran(arma_strsyl)(transa, transb, isgn, m, n, (T*)a, lda, (T*)b, ldb, (T*)c, ldc, (T*)scale, info, 1, 1); } else if( is_double::value) { typedef double T; arma_fortran(arma_dtrsyl)(transa, transb, isgn, m, n, (T*)a, lda, (T*)b, ldb, (T*)c, ldc, (T*)scale, info, 1, 1); } else if( is_cx_float::value) { typedef blas_cxf T; arma_fortran(arma_ctrsyl)(transa, transb, isgn, m, n, (T*)a, lda, (T*)b, ldb, (T*)c, ldc, (float*)scale, info, 1, 1); } else if(is_cx_double::value) { typedef blas_cxd T; arma_fortran(arma_ztrsyl)(transa, transb, isgn, m, n, (T*)a, lda, (T*)b, ldb, (T*)c, ldc, (double*)scale, info, 1, 1); } #else if( is_float::value) { typedef float T; arma_fortran(arma_strsyl)(transa, transb, isgn, m, n, (T*)a, lda, (T*)b, ldb, (T*)c, ldc, (T*)scale, info); } else if( is_double::value) { typedef double T; arma_fortran(arma_dtrsyl)(transa, transb, isgn, m, n, (T*)a, lda, (T*)b, ldb, (T*)c, ldc, (T*)scale, info); } else if( is_cx_float::value) { typedef blas_cxf T; arma_fortran(arma_ctrsyl)(transa, transb, isgn, m, n, (T*)a, lda, (T*)b, ldb, (T*)c, ldc, (float*)scale, info); } else if(is_cx_double::value) { typedef blas_cxd T; arma_fortran(arma_ztrsyl)(transa, transb, isgn, m, n, (T*)a, lda, (T*)b, ldb, (T*)c, ldc, (double*)scale, info); } #endif } template inline void gges ( char* jobvsl, char* jobvsr, char* sort, void* selctg, blas_int* n, eT* a, blas_int* lda, eT* b, blas_int* ldb, blas_int* sdim, eT* alphar, eT* alphai, eT* beta, eT* vsl, blas_int* ldvsl, eT* vsr, blas_int* ldvsr, eT* work, blas_int* lwork, blas_int* bwork, blas_int* info ) { arma_type_check(( is_supported_blas_type::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_float::value) { typedef float T; arma_fortran(arma_sgges)(jobvsl, jobvsr, sort, (fn_select_s3)selctg, n, (T*)a, lda, (T*)b, ldb, sdim, (T*)alphar, (T*)alphai, (T*)beta, (T*)vsl, ldvsl, (T*)vsr, ldvsr, (T*)work, lwork, bwork, info, 1, 1, 1); } else if(is_double::value) { typedef double T; arma_fortran(arma_dgges)(jobvsl, jobvsr, sort, (fn_select_d3)selctg, n, (T*)a, lda, (T*)b, ldb, sdim, (T*)alphar, (T*)alphai, (T*)beta, (T*)vsl, ldvsl, (T*)vsr, ldvsr, (T*)work, lwork, bwork, info, 1, 1, 1); } #else if( is_float::value) { typedef float T; arma_fortran(arma_sgges)(jobvsl, jobvsr, sort, (fn_select_s3)selctg, n, (T*)a, lda, (T*)b, ldb, sdim, (T*)alphar, (T*)alphai, (T*)beta, (T*)vsl, ldvsl, (T*)vsr, ldvsr, (T*)work, lwork, bwork, info); } else if(is_double::value) { typedef double T; arma_fortran(arma_dgges)(jobvsl, jobvsr, sort, (fn_select_d3)selctg, n, (T*)a, lda, (T*)b, ldb, sdim, (T*)alphar, (T*)alphai, (T*)beta, (T*)vsl, ldvsl, (T*)vsr, ldvsr, (T*)work, lwork, bwork, info); } #endif } template inline void cx_gges ( char* jobvsl, char* jobvsr, char* sort, void* selctg, blas_int* n, eT* a, blas_int* lda, eT* b, blas_int* ldb, blas_int* sdim, eT* alpha, eT* beta, eT* vsl, blas_int* ldvsl, eT* vsr, blas_int* ldvsr, eT* work, blas_int* lwork, typename eT::value_type* rwork, blas_int* bwork, blas_int* info ) { arma_type_check(( is_supported_blas_type::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_cx_float::value) { typedef float T; typedef blas_cxf cx_T; arma_fortran(arma_cgges)(jobvsl, jobvsr, sort, (fn_select_c2)selctg, n, (cx_T*)a, lda, (cx_T*)b, ldb, sdim, (cx_T*)alpha, (cx_T*)beta, (cx_T*)vsl, ldvsl, (cx_T*)vsr, ldvsr, (cx_T*)work, lwork, (T*)rwork, bwork, info, 1, 1, 1); } else if(is_cx_double::value) { typedef double T; typedef blas_cxd cx_T; arma_fortran(arma_zgges)(jobvsl, jobvsr, sort, (fn_select_z2)selctg, n, (cx_T*)a, lda, (cx_T*)b, ldb, sdim, (cx_T*)alpha, (cx_T*)beta, (cx_T*)vsl, ldvsl, (cx_T*)vsr, ldvsr, (cx_T*)work, lwork, (T*)rwork, bwork, info, 1, 1, 1); } #else if( is_cx_float::value) { typedef float T; typedef blas_cxf cx_T; arma_fortran(arma_cgges)(jobvsl, jobvsr, sort, (fn_select_c2)selctg, n, (cx_T*)a, lda, (cx_T*)b, ldb, sdim, (cx_T*)alpha, (cx_T*)beta, (cx_T*)vsl, ldvsl, (cx_T*)vsr, ldvsr, (cx_T*)work, lwork, (T*)rwork, bwork, info); } else if(is_cx_double::value) { typedef double T; typedef blas_cxd cx_T; arma_fortran(arma_zgges)(jobvsl, jobvsr, sort, (fn_select_z2)selctg, n, (cx_T*)a, lda, (cx_T*)b, ldb, sdim, (cx_T*)alpha, (cx_T*)beta, (cx_T*)vsl, ldvsl, (cx_T*)vsr, ldvsr, (cx_T*)work, lwork, (T*)rwork, bwork, info); } #endif } template inline typename get_pod_type::result lange(char* norm, blas_int* m, blas_int* n, eT* a, blas_int* lda, typename get_pod_type::result* work) { arma_type_check(( is_supported_blas_type::value == false )); typedef typename get_pod_type::result out_T; #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_float::value) { typedef float pod_T; typedef float T; return out_T( arma_fortran(arma_slange)(norm, m, n, (T*)a, lda, (pod_T*)work, 1) ); } else if( is_double::value) { typedef double pod_T; typedef double T; return out_T( arma_fortran(arma_dlange)(norm, m, n, (T*)a, lda, (pod_T*)work, 1) ); } else if( is_cx_float::value) { typedef float pod_T; typedef blas_cxf T; return out_T( arma_fortran(arma_clange)(norm, m, n, (T*)a, lda, (pod_T*)work, 1) ); } else if(is_cx_double::value) { typedef double pod_T; typedef blas_cxd T; return out_T( arma_fortran(arma_zlange)(norm, m, n, (T*)a, lda, (pod_T*)work, 1) ); } #else if( is_float::value) { typedef float pod_T; typedef float T; return out_T( arma_fortran(arma_slange)(norm, m, n, (T*)a, lda, (pod_T*)work) ); } else if( is_double::value) { typedef double pod_T; typedef double T; return out_T( arma_fortran(arma_dlange)(norm, m, n, (T*)a, lda, (pod_T*)work) ); } else if( is_cx_float::value) { typedef float pod_T; typedef blas_cxf T; return out_T( arma_fortran(arma_clange)(norm, m, n, (T*)a, lda, (pod_T*)work) ); } else if(is_cx_double::value) { typedef double pod_T; typedef blas_cxd T; return out_T( arma_fortran(arma_zlange)(norm, m, n, (T*)a, lda, (pod_T*)work) ); } #endif return out_T(0); } template inline typename get_pod_type::result lansy(char* norm, char* uplo, blas_int* n, eT* a, blas_int* lda, typename get_pod_type::result* work) { arma_type_check(( is_supported_blas_type::value == false )); typedef typename get_pod_type::result out_T; #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_float::value) { typedef float pod_T; typedef float T; return out_T( arma_fortran(arma_slansy)(norm, uplo, n, (T*)a, lda, (pod_T*)work, 1, 1) ); } else if( is_double::value) { typedef double pod_T; typedef double T; return out_T( arma_fortran(arma_dlansy)(norm, uplo, n, (T*)a, lda, (pod_T*)work, 1, 1) ); } else if( is_cx_float::value) { typedef float pod_T; typedef blas_cxf T; return out_T( arma_fortran(arma_clansy)(norm, uplo, n, (T*)a, lda, (pod_T*)work, 1, 1) ); } else if(is_cx_double::value) { typedef double pod_T; typedef blas_cxd T; return out_T( arma_fortran(arma_zlansy)(norm, uplo, n, (T*)a, lda, (pod_T*)work, 1, 1) ); } #else if( is_float::value) { typedef float pod_T; typedef float T; return out_T( arma_fortran(arma_slansy)(norm, uplo, n, (T*)a, lda, (pod_T*)work) ); } else if( is_double::value) { typedef double pod_T; typedef double T; return out_T( arma_fortran(arma_dlansy)(norm, uplo, n, (T*)a, lda, (pod_T*)work) ); } else if( is_cx_float::value) { typedef float pod_T; typedef blas_cxf T; return out_T( arma_fortran(arma_clansy)(norm, uplo, n, (T*)a, lda, (pod_T*)work) ); } else if(is_cx_double::value) { typedef double pod_T; typedef blas_cxd T; return out_T( arma_fortran(arma_zlansy)(norm, uplo, n, (T*)a, lda, (pod_T*)work) ); } #endif return out_T(0); } template inline typename get_pod_type::result lanhe(char* norm, char* uplo, blas_int* n, eT* a, blas_int* lda, typename get_pod_type::result* work) { arma_type_check(( is_supported_blas_type::value == false )); typedef typename get_pod_type::result out_T; #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_cx_float::value) { typedef float pod_T; typedef blas_cxf T; return out_T( arma_fortran(arma_clanhe)(norm, uplo, n, (T*)a, lda, (pod_T*)work, 1, 1) ); } else if(is_cx_double::value) { typedef double pod_T; typedef blas_cxd T; return out_T( arma_fortran(arma_zlanhe)(norm, uplo, n, (T*)a, lda, (pod_T*)work, 1, 1) ); } #else if( is_cx_float::value) { typedef float pod_T; typedef blas_cxf T; return out_T( arma_fortran(arma_clanhe)(norm, uplo, n, (T*)a, lda, (pod_T*)work) ); } else if(is_cx_double::value) { typedef double pod_T; typedef blas_cxd T; return out_T( arma_fortran(arma_zlanhe)(norm, uplo, n, (T*)a, lda, (pod_T*)work) ); } #endif return out_T(0); } template inline typename get_pod_type::result langb(char* norm, blas_int* n, blas_int* kl, blas_int* ku, eT* ab, blas_int* ldab, typename get_pod_type::result* work) { arma_type_check(( is_supported_blas_type::value == false )); typedef typename get_pod_type::result out_T; #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_float::value) { typedef float pod_T; typedef float T; return out_T( arma_fortran(arma_slangb)(norm, n, kl, ku, (T*)ab, ldab, (pod_T*)work, 1) ); } else if( is_double::value) { typedef double pod_T; typedef double T; return out_T( arma_fortran(arma_dlangb)(norm, n, kl, ku, (T*)ab, ldab, (pod_T*)work, 1) ); } else if( is_cx_float::value) { typedef float pod_T; typedef blas_cxf T; return out_T( arma_fortran(arma_clangb)(norm, n, kl, ku, (T*)ab, ldab, (pod_T*)work, 1) ); } else if(is_cx_double::value) { typedef double pod_T; typedef blas_cxd T; return out_T( arma_fortran(arma_zlangb)(norm, n, kl, ku, (T*)ab, ldab, (pod_T*)work, 1) ); } #else if( is_float::value) { typedef float pod_T; typedef float T; return out_T( arma_fortran(arma_slangb)(norm, n, kl, ku, (T*)ab, ldab, (pod_T*)work) ); } else if( is_double::value) { typedef double pod_T; typedef double T; return out_T( arma_fortran(arma_dlangb)(norm, n, kl, ku, (T*)ab, ldab, (pod_T*)work) ); } else if( is_cx_float::value) { typedef float pod_T; typedef blas_cxf T; return out_T( arma_fortran(arma_clangb)(norm, n, kl, ku, (T*)ab, ldab, (pod_T*)work) ); } else if(is_cx_double::value) { typedef double pod_T; typedef blas_cxd T; return out_T( arma_fortran(arma_zlangb)(norm, n, kl, ku, (T*)ab, ldab, (pod_T*)work) ); } #endif return out_T(0); } template inline void gecon(char* norm, blas_int* n, const eT* a, blas_int* lda, const eT* anorm, eT* rcond, eT* work, blas_int* iwork, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_float::value) { typedef float T; arma_fortran(arma_sgecon)(norm, n, (T*)a, lda, (T*)anorm, (T*)rcond, (T*)work, iwork, info, 1); } else if(is_double::value) { typedef double T; arma_fortran(arma_dgecon)(norm, n, (T*)a, lda, (T*)anorm, (T*)rcond, (T*)work, iwork, info, 1); } #else if( is_float::value) { typedef float T; arma_fortran(arma_sgecon)(norm, n, (T*)a, lda, (T*)anorm, (T*)rcond, (T*)work, iwork, info); } else if(is_double::value) { typedef double T; arma_fortran(arma_dgecon)(norm, n, (T*)a, lda, (T*)anorm, (T*)rcond, (T*)work, iwork, info); } #endif } template inline void cx_gecon(char* norm, blas_int* n, const std::complex* a, blas_int* lda, const T* anorm, T* rcond, std::complex* work, T* rwork, blas_int* info) { typedef typename std::complex eT; arma_type_check(( is_supported_blas_type::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_cx_float::value) { typedef float pod_T; typedef blas_cxf cx_T; arma_fortran(arma_cgecon)(norm, n, (cx_T*)a, lda, (pod_T*)anorm, (pod_T*)rcond, (cx_T*)work, (pod_T*)rwork, info, 1); } else if(is_cx_double::value) { typedef double pod_T; typedef blas_cxd cx_T; arma_fortran(arma_zgecon)(norm, n, (cx_T*)a, lda, (pod_T*)anorm, (pod_T*)rcond, (cx_T*)work, (pod_T*)rwork, info, 1); } #else if( is_cx_float::value) { typedef float pod_T; typedef blas_cxf cx_T; arma_fortran(arma_cgecon)(norm, n, (cx_T*)a, lda, (pod_T*)anorm, (pod_T*)rcond, (cx_T*)work, (pod_T*)rwork, info); } else if(is_cx_double::value) { typedef double pod_T; typedef blas_cxd cx_T; arma_fortran(arma_zgecon)(norm, n, (cx_T*)a, lda, (pod_T*)anorm, (pod_T*)rcond, (cx_T*)work, (pod_T*)rwork, info); } #endif } template inline void pocon(char* uplo, blas_int* n, const eT* a, blas_int* lda, const eT* anorm, eT* rcond, eT* work, blas_int* iwork, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_float::value) { typedef float T; arma_fortran(arma_spocon)(uplo, n, (T*)a, lda, (T*)anorm, (T*)rcond, (T*)work, iwork, info, 1); } else if(is_double::value) { typedef double T; arma_fortran(arma_dpocon)(uplo, n, (T*)a, lda, (T*)anorm, (T*)rcond, (T*)work, iwork, info, 1); } #else if( is_float::value) { typedef float T; arma_fortran(arma_spocon)(uplo, n, (T*)a, lda, (T*)anorm, (T*)rcond, (T*)work, iwork, info); } else if(is_double::value) { typedef double T; arma_fortran(arma_dpocon)(uplo, n, (T*)a, lda, (T*)anorm, (T*)rcond, (T*)work, iwork, info); } #endif } template inline void cx_pocon(char* uplo, blas_int* n, const std::complex* a, blas_int* lda, const T* anorm, T* rcond, std::complex* work, T* rwork, blas_int* info) { typedef typename std::complex eT; arma_type_check(( is_supported_blas_type::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_cx_float::value) { typedef float pod_T; typedef blas_cxf cx_T; arma_fortran(arma_cpocon)(uplo, n, (cx_T*)a, lda, (pod_T*)anorm, (pod_T*)rcond, (cx_T*)work, (pod_T*)rwork, info, 1); } else if(is_cx_double::value) { typedef double pod_T; typedef blas_cxd cx_T; arma_fortran(arma_zpocon)(uplo, n, (cx_T*)a, lda, (pod_T*)anorm, (pod_T*)rcond, (cx_T*)work, (pod_T*)rwork, info, 1); } #else if( is_cx_float::value) { typedef float pod_T; typedef blas_cxf cx_T; arma_fortran(arma_cpocon)(uplo, n, (cx_T*)a, lda, (pod_T*)anorm, (pod_T*)rcond, (cx_T*)work, (pod_T*)rwork, info); } else if(is_cx_double::value) { typedef double pod_T; typedef blas_cxd cx_T; arma_fortran(arma_zpocon)(uplo, n, (cx_T*)a, lda, (pod_T*)anorm, (pod_T*)rcond, (cx_T*)work, (pod_T*)rwork, info); } #endif } template inline void trcon(char* norm, char* uplo, char* diag, blas_int* n, const eT* a, blas_int* lda, eT* rcond, eT* work, blas_int* iwork, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_float::value) { typedef float T; arma_fortran(arma_strcon)(norm, uplo, diag, n, (T*)a, lda, (T*)rcond, (T*)work, iwork, info, 1, 1, 1); } else if(is_double::value) { typedef double T; arma_fortran(arma_dtrcon)(norm, uplo, diag, n, (T*)a, lda, (T*)rcond, (T*)work, iwork, info, 1, 1, 1); } #else if( is_float::value) { typedef float T; arma_fortran(arma_strcon)(norm, uplo, diag, n, (T*)a, lda, (T*)rcond, (T*)work, iwork, info); } else if(is_double::value) { typedef double T; arma_fortran(arma_dtrcon)(norm, uplo, diag, n, (T*)a, lda, (T*)rcond, (T*)work, iwork, info); } #endif } template inline void cx_trcon(char* norm, char* uplo, char* diag, blas_int* n, const std::complex* a, blas_int* lda, T* rcond, std::complex* work, T* rwork, blas_int* info) { typedef typename std::complex eT; arma_type_check(( is_supported_blas_type::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_cx_float::value) { typedef float pod_T; typedef blas_cxf cx_T; arma_fortran(arma_ctrcon)(norm, uplo, diag, n, (cx_T*)a, lda, (pod_T*)rcond, (cx_T*)work, (pod_T*)rwork, info, 1, 1, 1); } else if(is_cx_double::value) { typedef double pod_T; typedef blas_cxd cx_T; arma_fortran(arma_ztrcon)(norm, uplo, diag, n, (cx_T*)a, lda, (pod_T*)rcond, (cx_T*)work, (pod_T*)rwork, info, 1, 1, 1); } #else if( is_cx_float::value) { typedef float pod_T; typedef blas_cxf cx_T; arma_fortran(arma_ctrcon)(norm, uplo, diag, n, (cx_T*)a, lda, (pod_T*)rcond, (cx_T*)work, (pod_T*)rwork, info); } else if(is_cx_double::value) { typedef double pod_T; typedef blas_cxd cx_T; arma_fortran(arma_ztrcon)(norm, uplo, diag, n, (cx_T*)a, lda, (pod_T*)rcond, (cx_T*)work, (pod_T*)rwork, info); } #endif } template inline void gbcon(char* norm, blas_int* n, blas_int* kl, blas_int* ku, const eT* ab, blas_int* ldab, const blas_int* ipiv, const eT* anorm, eT* rcond, eT* work, blas_int* iwork, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_float::value) { typedef float T; arma_fortran(arma_sgbcon)(norm, n, kl, ku, (T*)ab, ldab, ipiv, (T*)anorm, (T*)rcond, (T*)work, iwork, info, 1); } else if(is_double::value) { typedef double T; arma_fortran(arma_dgbcon)(norm, n, kl, ku, (T*)ab, ldab, ipiv, (T*)anorm, (T*)rcond, (T*)work, iwork, info, 1); } #else if( is_float::value) { typedef float T; arma_fortran(arma_sgbcon)(norm, n, kl, ku, (T*)ab, ldab, ipiv, (T*)anorm, (T*)rcond, (T*)work, iwork, info); } else if(is_double::value) { typedef double T; arma_fortran(arma_dgbcon)(norm, n, kl, ku, (T*)ab, ldab, ipiv, (T*)anorm, (T*)rcond, (T*)work, iwork, info); } #endif } template inline void cx_gbcon(char* norm, blas_int* n, blas_int* kl, blas_int* ku, const std::complex* ab, blas_int* ldab, const blas_int* ipiv, const T* anorm, T* rcond, std::complex* work, T* rwork, blas_int* info) { typedef typename std::complex eT; arma_type_check(( is_supported_blas_type::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_cx_float::value) { typedef float pod_T; typedef blas_cxf cx_T; arma_fortran(arma_cgbcon)(norm, n, kl, ku, (cx_T*)ab, ldab, ipiv, (pod_T*)anorm, (pod_T*)rcond, (cx_T*)work, (pod_T*)rwork, info, 1); } else if(is_cx_double::value) { typedef double pod_T; typedef blas_cxd cx_T; arma_fortran(arma_zgbcon)(norm, n, kl, ku, (cx_T*)ab, ldab, ipiv, (pod_T*)anorm, (pod_T*)rcond, (cx_T*)work, (pod_T*)rwork, info, 1); } #else if( is_cx_float::value) { typedef float pod_T; typedef blas_cxf cx_T; arma_fortran(arma_cgbcon)(norm, n, kl, ku, (cx_T*)ab, ldab, ipiv, (pod_T*)anorm, (pod_T*)rcond, (cx_T*)work, (pod_T*)rwork, info); } else if(is_cx_double::value) { typedef double pod_T; typedef blas_cxd cx_T; arma_fortran(arma_zgbcon)(norm, n, kl, ku, (cx_T*)ab, ldab, ipiv, (pod_T*)anorm, (pod_T*)rcond, (cx_T*)work, (pod_T*)rwork, info); } #endif } inline blas_int laenv(blas_int* ispec, char* name, char* opts, blas_int* n1, blas_int* n2, blas_int* n3, blas_int* n4, blas_len name_len, blas_len opts_len) { #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) return arma_fortran(arma_ilaenv)(ispec, name, opts, n1, n2, n3, n4, name_len, opts_len); #else arma_ignore(name_len); arma_ignore(opts_len); return arma_fortran(arma_ilaenv)(ispec, name, opts, n1, n2, n3, n4); // not advised! #endif } template inline void lahqr(blas_int* wantt, blas_int* wantz, blas_int* n, blas_int* ilo, blas_int* ihi, eT* h, blas_int* ldh, eT* wr, eT* wi, blas_int* iloz, blas_int* ihiz, eT* z, blas_int* ldz, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); if( is_float::value) { typedef float T; arma_fortran(arma_slahqr)(wantt, wantz, n, ilo, ihi, (T*)h, ldh, (T*)wr, (T*)wi, iloz, ihiz, (T*)z, ldz, info); } else if(is_double::value) { typedef double T; arma_fortran(arma_dlahqr)(wantt, wantz, n, ilo, ihi, (T*)h, ldh, (T*)wr, (T*)wi, iloz, ihiz, (T*)z, ldz, info); } } template inline void stedc(char* compz, blas_int* n, eT* d, eT* e, eT* z, blas_int* ldz, eT* work, blas_int* lwork, blas_int* iwork, blas_int* liwork, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_float::value) { typedef float T; arma_fortran(arma_sstedc)(compz, n, (T*)d, (T*)e, (T*)z, ldz, (T*)work, lwork, iwork, liwork, info, 1); } else if(is_double::value) { typedef double T; arma_fortran(arma_dstedc)(compz, n, (T*)d, (T*)e, (T*)z, ldz, (T*)work, lwork, iwork, liwork, info, 1); } #else if( is_float::value) { typedef float T; arma_fortran(arma_sstedc)(compz, n, (T*)d, (T*)e, (T*)z, ldz, (T*)work, lwork, iwork, liwork, info); } else if(is_double::value) { typedef double T; arma_fortran(arma_dstedc)(compz, n, (T*)d, (T*)e, (T*)z, ldz, (T*)work, lwork, iwork, liwork, info); } #endif } template inline void trevc(char* side, char* howmny, blas_int* select, blas_int* n, eT* t, blas_int* ldt, eT* vl, blas_int* ldvl, eT* vr, blas_int* ldvr, blas_int* mm, blas_int* m, eT* work, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_float::value) { typedef float T; arma_fortran(arma_strevc)(side, howmny, select, n, (T*)t, ldt, (T*)vl, ldvl, (T*)vr, ldvr, mm, m, (T*)work, info, 1, 1); } else if(is_double::value) { typedef double T; arma_fortran(arma_dtrevc)(side, howmny, select, n, (T*)t, ldt, (T*)vl, ldvl, (T*)vr, ldvr, mm, m, (T*)work, info, 1, 1); } #else if( is_float::value) { typedef float T; arma_fortran(arma_strevc)(side, howmny, select, n, (T*)t, ldt, (T*)vl, ldvl, (T*)vr, ldvr, mm, m, (T*)work, info); } else if(is_double::value) { typedef double T; arma_fortran(arma_dtrevc)(side, howmny, select, n, (T*)t, ldt, (T*)vl, ldvl, (T*)vr, ldvr, mm, m, (T*)work, info); } #endif } template inline void gehrd(blas_int* n, blas_int* ilo, blas_int* ihi, eT* a, blas_int* lda, eT* tao, eT* work, blas_int* lwork, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); if( is_float::value) { typedef float T; arma_fortran(arma_sgehrd)(n, ilo, ihi, (T*)a, lda, (T*)tao, (T*)work, lwork, info); } else if( is_double::value) { typedef double T; arma_fortran(arma_dgehrd)(n, ilo, ihi, (T*)a, lda, (T*)tao, (T*)work, lwork, info); } else if( is_cx_float::value) { typedef blas_cxf T; arma_fortran(arma_cgehrd)(n, ilo, ihi, (T*)a, lda, (T*)tao, (T*)work, lwork, info); } else if(is_cx_double::value) { typedef blas_cxd T; arma_fortran(arma_zgehrd)(n, ilo, ihi, (T*)a, lda, (T*)tao, (T*)work, lwork, info); } } template inline void pstrf(const char* uplo, const blas_int* n, eT* a, const blas_int* lda, blas_int* piv, blas_int* rank, const typename get_pod_type::result* tol, const typename get_pod_type::result* work, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_float::value) { typedef float pod_T; typedef float T; arma_fortran(arma_spstrf)(uplo, n, (T*)a, lda, piv, rank, (const pod_T*)tol, (pod_T*)work, info, 1); } else if( is_double::value) { typedef double pod_T; typedef double T; arma_fortran(arma_dpstrf)(uplo, n, (T*)a, lda, piv, rank, (const pod_T*)tol, (pod_T*)work, info, 1); } else if( is_cx_float::value) { typedef float pod_T; typedef blas_cxf T; arma_fortran(arma_cpstrf)(uplo, n, (T*)a, lda, piv, rank, (const pod_T*)tol, (pod_T*)work, info, 1); } else if(is_cx_double::value) { typedef double pod_T; typedef blas_cxd T; arma_fortran(arma_zpstrf)(uplo, n, (T*)a, lda, piv, rank, (const pod_T*)tol, (pod_T*)work, info, 1); } #else if( is_float::value) { typedef float pod_T; typedef float T; arma_fortran(arma_spstrf)(uplo, n, (T*)a, lda, piv, rank, (const pod_T*)tol, (pod_T*)work, info); } else if( is_double::value) { typedef double pod_T; typedef double T; arma_fortran(arma_dpstrf)(uplo, n, (T*)a, lda, piv, rank, (const pod_T*)tol, (pod_T*)work, info); } else if( is_cx_float::value) { typedef float pod_T; typedef blas_cxf T; arma_fortran(arma_cpstrf)(uplo, n, (T*)a, lda, piv, rank, (const pod_T*)tol, (pod_T*)work, info); } else if(is_cx_double::value) { typedef double pod_T; typedef blas_cxd T; arma_fortran(arma_zpstrf)(uplo, n, (T*)a, lda, piv, rank, (const pod_T*)tol, (pod_T*)work, info); } #endif } template inline void sytrf(const char* uplo, const blas_int* n, eT* a, const blas_int* lda, blas_int* ipiv, eT* work, const blas_int* lwork, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_float::value) { typedef float T; arma_fortran(arma_ssytrf)(uplo, n, (T*)a, lda, ipiv, (T*)work, lwork, info, 1); } else if(is_double::value) { typedef double T; arma_fortran(arma_dsytrf)(uplo, n, (T*)a, lda, ipiv, (T*)work, lwork, info, 1); } #else if( is_float::value) { typedef float T; arma_fortran(arma_ssytrf)(uplo, n, (T*)a, lda, ipiv, (T*)work, lwork, info); } else if(is_double::value) { typedef double T; arma_fortran(arma_dsytrf)(uplo, n, (T*)a, lda, ipiv, (T*)work, lwork, info); } #endif } template inline void hetrf(const char* uplo, const blas_int* n, eT* a, const blas_int* lda, blas_int* ipiv, eT* work, const blas_int* lwork, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_cx_float::value) { typedef blas_cxf T; arma_fortran(arma_chetrf)(uplo, n, (T*)a, lda, ipiv, (T*)work, lwork, info, 1); } else if(is_cx_double::value) { typedef blas_cxd T; arma_fortran(arma_zhetrf)(uplo, n, (T*)a, lda, ipiv, (T*)work, lwork, info, 1); } #else if( is_cx_float::value) { typedef blas_cxf T; arma_fortran(arma_chetrf)(uplo, n, (T*)a, lda, ipiv, (T*)work, lwork, info); } else if(is_cx_double::value) { typedef blas_cxd T; arma_fortran(arma_zhetrf)(uplo, n, (T*)a, lda, ipiv, (T*)work, lwork, info); } #endif } template inline void sytrs(const char* uplo, const blas_int* n, const blas_int* nrhs, const eT* a, const blas_int* lda, const blas_int* ipiv, eT* b, const blas_int* ldb, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_float::value) { typedef float T; arma_fortran(arma_ssytrs)(uplo, n, nrhs, (T*)a, lda, ipiv, (T*)b, ldb, info, 1); } else if(is_double::value) { typedef double T; arma_fortran(arma_dsytrs)(uplo, n, nrhs, (T*)a, lda, ipiv, (T*)b, ldb, info, 1); } #else if( is_float::value) { typedef float T; arma_fortran(arma_ssytrs)(uplo, n, nrhs, (T*)a, lda, ipiv, (T*)b, ldb, info); } else if(is_double::value) { typedef double T; arma_fortran(arma_dsytrs)(uplo, n, nrhs, (T*)a, lda, ipiv, (T*)b, ldb, info); } #endif } template inline void hetrs(const char* uplo, const blas_int* n, const blas_int* nrhs, const eT* a, const blas_int* lda, const blas_int* ipiv, eT* b, const blas_int* ldb, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_cx_float::value) { typedef blas_cxf T; arma_fortran(arma_chetrs)(uplo, n, nrhs, (T*)a, lda, ipiv, (T*)b, ldb, info, 1); } else if(is_cx_double::value) { typedef blas_cxd T; arma_fortran(arma_zhetrs)(uplo, n, nrhs, (T*)a, lda, ipiv, (T*)b, ldb, info, 1); } #else if( is_cx_float::value) { typedef blas_cxf T; arma_fortran(arma_chetrs)(uplo, n, nrhs, (T*)a, lda, ipiv, (T*)b, ldb, info); } else if(is_cx_double::value) { typedef blas_cxd T; arma_fortran(arma_zhetrs)(uplo, n, nrhs, (T*)a, lda, ipiv, (T*)b, ldb, info); } #endif } template inline void sytri(const char* uplo, const blas_int* n, eT* a, const blas_int* lda, const blas_int* ipiv, eT* work, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_float::value) { typedef float T; arma_fortran(arma_ssytri)(uplo, n, (T*)a, lda, ipiv, (T*)work, info, 1); } else if(is_double::value) { typedef double T; arma_fortran(arma_dsytri)(uplo, n, (T*)a, lda, ipiv, (T*)work, info, 1); } #else if( is_float::value) { typedef float T; arma_fortran(arma_ssytri)(uplo, n, (T*)a, lda, ipiv, (T*)work, info); } else if(is_double::value) { typedef double T; arma_fortran(arma_dsytri)(uplo, n, (T*)a, lda, ipiv, (T*)work, info); } #endif } template inline void hetri(const char* uplo, const blas_int* n, eT* a, const blas_int* lda, const blas_int* ipiv, eT* work, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_cx_float::value) { typedef blas_cxf T; arma_fortran(arma_chetri)(uplo, n, (T*)a, lda, ipiv, (T*)work, info, 1); } else if(is_cx_double::value) { typedef blas_cxd T; arma_fortran(arma_zhetri)(uplo, n, (T*)a, lda, ipiv, (T*)work, info, 1); } #else if( is_cx_float::value) { typedef blas_cxf T; arma_fortran(arma_chetri)(uplo, n, (T*)a, lda, ipiv, (T*)work, info); } else if(is_cx_double::value) { typedef blas_cxd T; arma_fortran(arma_zhetri)(uplo, n, (T*)a, lda, ipiv, (T*)work, info); } #endif } template inline void sycon(const char* uplo, const blas_int* n, const eT* a, const blas_int* lda, const blas_int* ipiv, const eT* anorm, eT* rcond, eT* work, blas_int* iwork, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_float::value) { typedef float T; arma_fortran(arma_ssycon)(uplo, n, (const T*)a, lda, ipiv, (const T*)anorm, (T*)rcond, (T*)work, iwork, info, 1); } else if(is_double::value) { typedef double T; arma_fortran(arma_dsycon)(uplo, n, (const T*)a, lda, ipiv, (const T*)anorm, (T*)rcond, (T*)work, iwork, info, 1); } #else if( is_float::value) { typedef float T; arma_fortran(arma_ssycon)(uplo, n, (const T*)a, lda, ipiv, (const T*)anorm, (T*)rcond, (T*)work, iwork, info); } else if(is_double::value) { typedef double T; arma_fortran(arma_dsycon)(uplo, n, (const T*)a, lda, ipiv, (const T*)anorm, (T*)rcond, (T*)work, iwork, info); } #endif } template inline void hecon(const char* uplo, const blas_int* n, const std::complex* a, const blas_int* lda, const blas_int* ipiv, const T* anorm, T* rcond, std::complex* work, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_float::value) { typedef float pod_T; typedef blas_cxf cx_T; arma_fortran(arma_checon)(uplo, n, (const cx_T*)a, lda, ipiv, (const pod_T*)anorm, (pod_T*)rcond, (cx_T*)work, info, 1); } else if(is_double::value) { typedef double pod_T; typedef blas_cxd cx_T; arma_fortran(arma_zhecon)(uplo, n, (const cx_T*)a, lda, ipiv, (const pod_T*)anorm, (pod_T*)rcond, (cx_T*)work, info, 1); } #else if( is_float::value) { typedef float pod_T; typedef blas_cxf cx_T; arma_fortran(arma_checon)(uplo, n, (const cx_T*)a, lda, ipiv, (const pod_T*)anorm, (pod_T*)rcond, (cx_T*)work, info); } else if(is_double::value) { typedef double pod_T; typedef blas_cxd cx_T; arma_fortran(arma_zhecon)(uplo, n, (const cx_T*)a, lda, ipiv, (const pod_T*)anorm, (pod_T*)rcond, (cx_T*)work, info); } #endif } template inline void gebal(const char* job, const blas_int* n, eT* a, const blas_int* lda, blas_int* ilo, blas_int* ihi, typename get_pod_type::result* scale, blas_int* info) { arma_type_check(( is_supported_blas_type::value == false )); #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) if( is_float::value) { typedef float pod_T; typedef float T; arma_fortran(arma_sgebal)(job, n, (T*)a, lda, ilo, ihi, (pod_T*)scale, info, 1); } else if( is_double::value) { typedef double pod_T; typedef double T; arma_fortran(arma_dgebal)(job, n, (T*)a, lda, ilo, ihi, (pod_T*)scale, info, 1); } else if( is_cx_float::value) { typedef float pod_T; typedef blas_cxf T; arma_fortran(arma_cgebal)(job, n, (T*)a, lda, ilo, ihi, (pod_T*)scale, info, 1); } else if(is_cx_double::value) { typedef double pod_T; typedef blas_cxd T; arma_fortran(arma_zgebal)(job, n, (T*)a, lda, ilo, ihi, (pod_T*)scale, info, 1); } #else if( is_float::value) { typedef float pod_T; typedef float T; arma_fortran(arma_sgebal)(job, n, (T*)a, lda, ilo, ihi, (pod_T*)scale, info); } else if( is_double::value) { typedef double pod_T; typedef double T; arma_fortran(arma_dgebal)(job, n, (T*)a, lda, ilo, ihi, (pod_T*)scale, info); } else if( is_cx_float::value) { typedef float pod_T; typedef blas_cxf T; arma_fortran(arma_cgebal)(job, n, (T*)a, lda, ilo, ihi, (pod_T*)scale, info); } else if(is_cx_double::value) { typedef double pod_T; typedef blas_cxd T; arma_fortran(arma_zgebal)(job, n, (T*)a, lda, ilo, ihi, (pod_T*)scale, info); } #endif } } #endif RcppArmadillo/inst/include/armadillo_bits/fn_interp1.hpp0000644000176200001440000002177714770765377023213 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_interp1 //! @{ template inline void interp1_helper_nearest(const Mat& XG, const Mat& YG, const Mat& XI, Mat& YI, const eT extrap_val) { arma_debug_sigprint(); const eT XG_min = XG.min(); const eT XG_max = XG.max(); YI.copy_size(XI); const eT* XG_mem = XG.memptr(); const eT* YG_mem = YG.memptr(); const eT* XI_mem = XI.memptr(); eT* YI_mem = YI.memptr(); const uword NG = XG.n_elem; const uword NI = XI.n_elem; uword best_j = 0; for(uword i=0; i::inf; const eT XI_val = XI_mem[i]; if((XI_val < XG_min) || (XI_val > XG_max)) { YI_mem[i] = extrap_val; } else if(arma_isnan(XI_val)) { YI_mem[i] = Datum::nan; } else { // XG and XI are guaranteed to be sorted in ascending manner, // so start searching XG from last known optimum position for(uword j=best_j; j= eT(0)) ? tmp : -tmp; if(err >= best_err) { // error is going up, so we have found the optimum position break; } else { best_err = err; best_j = j; // remember the optimum position } } YI_mem[i] = YG_mem[best_j]; } } } template inline void interp1_helper_linear(const Mat& XG, const Mat& YG, const Mat& XI, Mat& YI, const eT extrap_val) { arma_debug_sigprint(); const eT XG_min = XG.min(); const eT XG_max = XG.max(); YI.copy_size(XI); const eT* XG_mem = XG.memptr(); const eT* YG_mem = YG.memptr(); const eT* XI_mem = XI.memptr(); eT* YI_mem = YI.memptr(); const uword NG = XG.n_elem; const uword NI = XI.n_elem; uword a_best_j = 0; uword b_best_j = 0; for(uword i=0; i XG_max)) { YI_mem[i] = extrap_val; } else if(arma_isnan(XI_val)) { YI_mem[i] = Datum::nan; } else { // XG and XI are guaranteed to be sorted in ascending manner, // so start searching XG from last known optimum position eT a_best_err = Datum::inf; eT b_best_err = Datum::inf; for(uword j=a_best_j; j= eT(0)) ? tmp : -tmp; if(err >= a_best_err) { break; } else { a_best_err = err; a_best_j = j; } } if( (XG_mem[a_best_j] - XI_val) <= eT(0) ) { // a_best_j is to the left of the interpolated position b_best_j = ( (a_best_j+1) < NG) ? (a_best_j+1) : a_best_j; } else { // a_best_j is to the right of the interpolated position b_best_j = (a_best_j >= 1) ? (a_best_j-1) : a_best_j; } b_best_err = std::abs( XG_mem[b_best_j] - XI_val ); if(a_best_j > b_best_j) { std::swap(a_best_j, b_best_j ); std::swap(a_best_err, b_best_err); } const eT weight = (a_best_err > eT(0)) ? (a_best_err / (a_best_err + b_best_err)) : eT(0); YI_mem[i] = (eT(1) - weight)*YG_mem[a_best_j] + (weight)*YG_mem[b_best_j]; } } } template inline void interp1_helper(const Mat& X, const Mat& Y, const Mat& XI, Mat& YI, const uword sig, const eT extrap_val) { arma_debug_sigprint(); arma_conform_check( ((X.is_vec() == false) || (Y.is_vec() == false) || (XI.is_vec() == false)), "interp1(): currently only vectors are supported" ); arma_conform_check( (X.n_elem != Y.n_elem), "interp1(): X and Y must have the same number of elements" ); arma_conform_check( (X.n_elem < 2), "interp1(): X must have at least two unique elements" ); // sig = 10: nearest neighbour // sig = 11: nearest neighbour, assume monotonic increase in X and XI // // sig = 20: linear // sig = 21: linear, assume monotonic increase in X and XI if(sig == 11) { interp1_helper_nearest(X, Y, XI, YI, extrap_val); return; } if(sig == 21) { interp1_helper_linear (X, Y, XI, YI, extrap_val); return; } uvec X_indices; try { X_indices = find_unique(X,false); } catch(...) { } // NOTE: find_unique(X,false) provides indices of elements sorted in ascending order // NOTE: find_unique(X,false) will reset X_indices if X has NaN const uword N_subset = X_indices.n_elem; arma_conform_check( (N_subset < 2), "interp1(): X must have at least two unique elements" ); Mat X_sanitised(N_subset, 1, arma_nozeros_indicator()); Mat Y_sanitised(N_subset, 1, arma_nozeros_indicator()); eT* X_sanitised_mem = X_sanitised.memptr(); eT* Y_sanitised_mem = Y_sanitised.memptr(); const eT* X_mem = X.memptr(); const eT* Y_mem = Y.memptr(); const uword* X_indices_mem = X_indices.memptr(); for(uword i=0; i XI_tmp; uvec XI_indices; const bool XI_is_sorted = XI.is_sorted(); // NOTE: .is_sorted() currently doesn't detect NaN if(XI_is_sorted == false) { XI_indices = sort_index(XI); // NOTE: sort_index() will throw if XI has NaN const uword N = XI.n_elem; XI_tmp.copy_size(XI); const uword* XI_indices_mem = XI_indices.memptr(); const eT* XI_mem = XI.memptr(); eT* XI_tmp_mem = XI_tmp.memptr(); for(uword i=0; i& XI_sorted = (XI_is_sorted) ? XI : XI_tmp; // NOTE: XI_sorted may have NaN if(sig == 10) { interp1_helper_nearest(X_sanitised, Y_sanitised, XI_sorted, YI, extrap_val); } else if(sig == 20) { interp1_helper_linear (X_sanitised, Y_sanitised, XI_sorted, YI, extrap_val); } if( (XI_is_sorted == false) && (YI.n_elem > 0) ) { Mat YI_unsorted; YI_unsorted.copy_size(YI); const eT* YI_mem = YI.memptr(); eT* YI_unsorted_mem = YI_unsorted.memptr(); const uword N = XI_sorted.n_elem; const uword* XI_indices_mem = XI_indices.memptr(); for(uword i=0; i inline typename enable_if2 < is_real::value, void >::result interp1 ( const Base& X, const Base& Y, const Base& XI, Mat& YI, const char* method = "linear", const typename T1::elem_type extrap_val = Datum::nan ) { arma_debug_sigprint(); typedef typename T1::elem_type eT; uword sig = 0; if(method != nullptr) if(method[0] != char(0)) if(method[1] != char(0)) { const char c1 = method[0]; const char c2 = method[1]; if(c1 == 'n') { sig = 10; } // nearest neighbour else if(c1 == 'l') { sig = 20; } // linear else { if( (c1 == '*') && (c2 == 'n') ) { sig = 11; } // nearest neighbour, assume monotonic increase in X and XI if( (c1 == '*') && (c2 == 'l') ) { sig = 21; } // linear, assume monotonic increase in X and XI } } arma_conform_check( (sig == 0), "interp1(): unsupported interpolation type" ); const quasi_unwrap X_tmp( X.get_ref()); const quasi_unwrap Y_tmp( Y.get_ref()); const quasi_unwrap XI_tmp(XI.get_ref()); if( X_tmp.is_alias(YI) || Y_tmp.is_alias(YI) || XI_tmp.is_alias(YI) ) { Mat tmp; interp1_helper(X_tmp.M, Y_tmp.M, XI_tmp.M, tmp, sig, extrap_val); YI.steal_mem(tmp); } else { interp1_helper(X_tmp.M, Y_tmp.M, XI_tmp.M, YI, sig, extrap_val); } } //! @} RcppArmadillo/inst/include/armadillo_bits/glue_histc_bones.hpp0000644000176200001440000000303114301267043024412 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup glue_histc //! @{ class glue_histc : public traits_glue_default { public: template inline static void apply_noalias(Mat& C, const Mat& A, const Mat& B, const uword dim); template inline static void apply(Mat& C, const mtGlue& expr); }; class glue_histc_default { public: template struct traits { static constexpr bool is_row = T1::is_row; static constexpr bool is_col = T1::is_col; static constexpr bool is_xvec = T1::is_xvec; }; template inline static void apply(Mat& C, const mtGlue& expr); }; //! @} RcppArmadillo/inst/include/armadillo_bits/Gen_bones.hpp0000644000176200001440000000442714752446051023017 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup Gen //! @{ //! support class for generator functions (zeros, ones, eye) template class Gen : public Base< typename T1::elem_type, Gen > { public: typedef typename T1::elem_type elem_type; typedef typename get_pod_type::result pod_type; static constexpr bool use_at = (is_same_type::value); static constexpr bool is_simple = (is_same_type::value) || (is_same_type::value); static constexpr bool is_row = T1::is_row; static constexpr bool is_col = T1::is_col; static constexpr bool is_xvec = T1::is_xvec; const uword n_rows; const uword n_cols; arma_inline Gen(const uword in_n_rows, const uword in_n_cols); arma_inline ~Gen(); arma_inline elem_type operator[] (const uword ii) const; arma_inline elem_type at (const uword r, const uword c) const; arma_inline elem_type at_alt (const uword ii) const; inline void apply (Mat& out) const; inline void apply_inplace_plus (Mat& out) const; inline void apply_inplace_minus(Mat& out) const; inline void apply_inplace_schur(Mat& out) const; inline void apply_inplace_div (Mat& out) const; inline void apply(subview& out) const; template constexpr bool is_alias(const Mat&) const { return false; } }; //! @} RcppArmadillo/inst/include/armadillo_bits/wall_clock_bones.hpp0000644000176200001440000000232614603256156024414 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup wall_clock //! @{ //! Class for measuring time intervals class wall_clock { public: inline wall_clock(); inline ~wall_clock(); inline void tic(); //!< start the timer arma_warn_unused inline double toc(); //!< return the number of seconds since the last call to tic() private: std::chrono::steady_clock::time_point chrono_time1; bool valid = false; }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_powmat_meat.hpp0000644000176200001440000001575614713753317024145 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_powmat //! @{ template inline void op_powmat::apply(Mat& out, const Op& expr) { arma_debug_sigprint(); const uword y = expr.aux_uword_a; const bool y_neg = (expr.aux_uword_b == uword(1)); const bool status = op_powmat::apply_direct(out, expr.m, y, y_neg); if(status == false) { out.soft_reset(); arma_stop_runtime_error("powmat(): transformation failed"); } } template inline bool op_powmat::apply_direct(Mat& out, const Base& X, const uword y, const bool y_neg) { arma_debug_sigprint(); typedef typename T1::elem_type eT; if(y_neg) { if(y == uword(1)) { return op_inv_gen_default::apply_direct(out, X.get_ref(), "powmat()"); } else { Mat X_inv; const bool inv_status = op_inv_gen_default::apply_direct(X_inv, X.get_ref(), "powmat()"); if(inv_status == false) { return false; } op_powmat::apply_direct_positive(out, X_inv, y); } } else { const quasi_unwrap U(X.get_ref()); arma_conform_check( (U.M.is_square() == false), "powmat(): given matrix must be square sized" ); op_powmat::apply_direct_positive(out, U.M, y); } return true; } template inline void op_powmat::apply_direct_positive(Mat& out, const Mat& X, const uword y) { arma_debug_sigprint(); const uword N = X.n_rows; if(y == uword(0)) { out.eye(N,N); return; } if(y == uword(1)) { out = X; return; } if(X.is_diagmat()) { arma_debug_print("op_powmat: diag optimisation"); podarray tmp(N); // use temporary array in case we have aliasing for(uword i=0; i tmp = X*X; out = X*tmp; } else if(y == uword(4)) { const Mat tmp = X*X; out = tmp*tmp; } else if(y == uword(5)) { const Mat tmp = X*X; out = X*tmp*tmp; } else { Mat tmp = X; out = X; uword z = y-1; while(z > 0) { if(z & 1) { out = tmp * out; } z /= uword(2); if(z > 0) { tmp = tmp * tmp; } } } } } template inline void op_powmat_cx::apply(Mat< std::complex >& out, const mtOp,T1,op_powmat_cx>& expr) { arma_debug_sigprint(); typedef typename T1::pod_type in_T; const in_T y = std::real(expr.aux_out_eT); const bool status = op_powmat_cx::apply_direct(out, expr.m, y); if(status == false) { out.soft_reset(); arma_stop_runtime_error("powmat(): transformation failed"); } } template inline bool op_powmat_cx::apply_direct(Mat< std::complex >& out, const Base& X, const typename T1::pod_type y) { arma_debug_sigprint(); typedef typename T1::elem_type in_eT; typedef typename T1::pod_type in_T; typedef std::complex out_eT; if( y == in_T(int(y)) ) { arma_debug_print("op_powmat_cx::apply_direct(): integer exponent detected; redirecting to op_powmat"); const uword y_val = (y < int(0)) ? uword(-y) : uword(y); const bool y_neg = (y < int(0)); Mat tmp; const bool status = op_powmat::apply_direct(tmp, X.get_ref(), y_val, y_neg); if(status == false) { return false; } out = conv_to< Mat >::from(tmp); return true; } const quasi_unwrap U(X.get_ref()); const Mat& A = U.M; arma_conform_check( (A.is_square() == false), "powmat(): given matrix must be square sized" ); const uword N = A.n_rows; if(A.is_diagmat()) { arma_debug_print("op_powmat_cx: diag optimisation"); podarray tmp(N); // use temporary array in case we have aliasing for(uword i=0; i(A.at(i,i)), y ); } out.zeros(N,N); for(uword i=0; i eigval; Mat eigvec; const bool eig_status = eig_sym(eigval, eigvec, A); if(eig_status) { bool all_pos = true; for(uword i=0; i tmp = eigvec * diagmat(eigval); out = conv_to< Mat >::from(tmp * eigvec.t()); } else { arma_debug_print("op_powmat_cx: all_pos = false"); Col cx_eigval_pow(N, arma_nozeros_indicator()); for(uword i=0; i(eigval[i]), y ); } const Mat cx_eigvec = conv_to< Mat >::from(eigvec); const Mat tmp = cx_eigvec * diagmat(cx_eigval_pow); out = tmp * cx_eigvec.t(); } return true; } arma_debug_print("op_powmat_cx: symmetric/hermitian optimisation failed"); // fallthrough if optimisation failed } bool powmat_status = false; Col eigval; Mat eigvec; const bool eig_status = eig_gen(eigval, eigvec, A); if(eig_status) { eigval = pow(eigval, y); Mat eigvec_t = trans(eigvec); Mat tmp = diagmat(conj(eigval)) * eigvec_t; const bool solve_status = auxlib::solve_square_fast(out, eigvec_t, tmp); if(solve_status) { out = trans(out); powmat_status = true; } } return powmat_status; } //! @} RcppArmadillo/inst/include/armadillo_bits/op_cond_bones.hpp0000644000176200001440000000245514301267043023716 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_cond //! @{ class op_cond : public traits_op_default { public: template static inline typename T1::pod_type apply(const Base& X); template static inline typename get_pod_type::result apply_diag(const Mat& A); template static inline typename get_pod_type::result apply_sym ( Mat& A); template static inline typename get_pod_type::result apply_gen ( Mat& A); }; //! @} RcppArmadillo/inst/include/armadillo_bits/newarp_UpperHessenbergEigen_meat.hpp0000644000176200001440000001047114631567470027554 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ namespace newarp { template inline UpperHessenbergEigen::UpperHessenbergEigen() : n_rows(0) , computed(false) { arma_debug_sigprint(); } template inline UpperHessenbergEigen::UpperHessenbergEigen(const Mat& mat_obj) : n_rows(mat_obj.n_rows) , computed(false) { arma_debug_sigprint(); compute(mat_obj); } template inline void UpperHessenbergEigen::compute(const Mat& mat_obj) { arma_debug_sigprint(); arma_conform_check( (mat_obj.is_square() == false), "newarp::UpperHessenbergEigen::compute(): matrix must be square" ); n_rows = mat_obj.n_rows; mat_Z.set_size(n_rows, n_rows); mat_T.set_size(n_rows, n_rows); evals.set_size(n_rows); mat_Z.eye(); mat_T = mat_obj; blas_int want_T = blas_int(1); blas_int want_Z = blas_int(1); blas_int n = blas_int(n_rows); blas_int ilo = blas_int(1); blas_int ihi = blas_int(n_rows); blas_int iloz = blas_int(1); blas_int ihiz = blas_int(n_rows); blas_int info = blas_int(0); podarray wr(n_rows); podarray wi(n_rows); arma_debug_print("lapack::lahqr()"); lapack::lahqr(&want_T, &want_Z, &n, &ilo, &ihi, mat_T.memptr(), &n, wr.memptr(), wi.memptr(), &iloz, &ihiz, mat_Z.memptr(), &n, &info); if(info != 0) { arma_stop_runtime_error("lapack::lahqr(): failed to compute all eigenvalues"); return; } for(uword i=0; i < n_rows; i++) { evals(i) = std::complex(wr[i], wi[i]); } char side = 'R'; char howmny = 'B'; blas_int m = blas_int(0); podarray work(3*n); arma_debug_print("lapack::trevc()"); lapack::trevc(&side, &howmny, (blas_int*) NULL, &n, mat_T.memptr(), &n, (eT*) NULL, &n, mat_Z.memptr(), &n, &n, &m, work.memptr(), &info); if(info != 0) { arma_stop_runtime_error("lapack::trevc(): illegal value"); return; } computed = true; } template inline Col< std::complex > UpperHessenbergEigen::eigenvalues() { arma_debug_sigprint(); arma_conform_check( (computed == false), "newarp::UpperHessenbergEigen::eigenvalues(): need to call compute() first" ); return evals; } template inline Mat< std::complex > UpperHessenbergEigen::eigenvectors() { arma_debug_sigprint(); arma_conform_check( (computed == false), "newarp::UpperHessenbergEigen::eigenvectors(): need to call compute() first" ); // Lapack will set the imaginary parts of real eigenvalues to be exact zero Mat< std::complex > evecs(n_rows, n_rows, arma_zeros_indicator()); std::complex* col_ptr = evecs.memptr(); for(uword i=0; i < n_rows; i++) { if(cx_attrib::is_real(evals(i), eT(0))) { // for real eigenvector, normalise and copy const eT z_norm = norm(mat_Z.col(i)); for(uword j=0; j < n_rows; j++) { col_ptr[j] = std::complex(mat_Z(j, i) / z_norm, eT(0)); } col_ptr += n_rows; } else { // complex eigenvectors are stored in consecutive columns const eT r2 = dot(mat_Z.col(i ), mat_Z.col(i )); const eT i2 = dot(mat_Z.col(i+1), mat_Z.col(i+1)); const eT z_norm = std::sqrt(r2 + i2); const eT* z_ptr = mat_Z.colptr(i); for(uword j=0; j < n_rows; j++) { col_ptr[j ] = std::complex(z_ptr[j] / z_norm, z_ptr[j + n_rows] / z_norm); col_ptr[j + n_rows] = std::conj(col_ptr[j]); } i++; col_ptr += 2 * n_rows; } } return evecs; } } // namespace newarp RcppArmadillo/inst/include/armadillo_bits/injector_bones.hpp0000644000176200001440000000376014413016473024115 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup injector //! @{ template class mat_injector { public: typedef typename T1::elem_type elem_type; arma_cold inline void insert(const elem_type val) const; arma_cold inline void end_of_row() const; arma_cold inline ~mat_injector(); private: inline mat_injector(T1& in_X, const elem_type val); inline mat_injector(T1& in_X, const injector_end_of_row<>&); T1& parent; mutable std::vector values; mutable std::vector rowend; friend class Mat; friend class Row; friend class Col; }; // template class field_injector { public: typedef typename T1::object_type object_type; arma_cold inline void insert(const object_type& val) const; arma_cold inline void end_of_row() const; arma_cold inline ~field_injector(); private: inline field_injector(T1& in_X, const object_type& val); inline field_injector(T1& in_X, const injector_end_of_row<>&); T1& parent; mutable std::vector values; mutable std::vector rowend; friend class field; }; //! @} RcppArmadillo/inst/include/armadillo_bits/constants.hpp0000644000176200001440000002525614631567470023144 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup constants //! @{ namespace priv { class Datum_helper { public: template static typename arma_real_only::result nan(typename arma_real_only::result* junk = nullptr) { arma_ignore(junk); return (std::numeric_limits::has_quiet_NaN) ? eT(std::numeric_limits::quiet_NaN()) : eT(0); } template static typename arma_cx_only::result nan(typename arma_cx_only::result* junk = nullptr) { arma_ignore(junk); typedef typename get_pod_type::result T; return eT( Datum_helper::nan(), Datum_helper::nan() ); } template static typename arma_integral_only::result nan(typename arma_integral_only::result* junk = nullptr) { arma_ignore(junk); return eT(0); } template static typename arma_real_only::result inf(typename arma_real_only::result* junk = nullptr) { arma_ignore(junk); return (std::numeric_limits::has_infinity) ? eT(std::numeric_limits::infinity()) : eT(std::numeric_limits::max()); } template static typename arma_cx_only::result inf(typename arma_cx_only::result* junk = nullptr) { arma_ignore(junk); typedef typename get_pod_type::result T; return eT( Datum_helper::inf(), Datum_helper::inf() ); } template static typename arma_integral_only::result inf(typename arma_integral_only::result* junk = nullptr) { arma_ignore(junk); return std::numeric_limits::max(); } }; } //! various constants. //! Physical constants taken from NIST 2018 CODATA values, and some from WolframAlpha (values provided as of 2009-06-23) //! http://physics.nist.gov/cuu/Constants //! http://www.wolframalpha.com //! See also http://en.wikipedia.org/wiki/Physical_constant template class Datum { public: static const eT pi; //!< ratio of any circle's circumference to its diameter static const eT tau; //!< ratio of any circle's circumference to its radius (replacement of 2*pi) static const eT e; //!< base of the natural logarithm static const eT euler; //!< Euler's constant, aka Euler-Mascheroni constant static const eT gratio; //!< golden ratio static const eT sqrt2; //!< square root of 2 static const eT sqrt2pi; //!< square root of 2*pi static const eT log_sqrt2pi; //!< log of square root of 2*pi static const eT eps; //!< the difference between 1 and the least value greater than 1 that is representable static const eT log_min; //!< log of the minimum representable value static const eT log_max; //!< log of the maximum representable value static const eT nan; //!< "not a number" static const eT inf; //!< infinity // static const eT m_u; //!< atomic mass constant (in kg) static const eT N_A; //!< Avogadro constant static const eT k; //!< Boltzmann constant (in joules per kelvin) static const eT k_evk; //!< Boltzmann constant (in eV/K) static const eT a_0; //!< Bohr radius (in meters) static const eT mu_B; //!< Bohr magneton static const eT Z_0; //!< characteristic impedance of vacuum (in ohms) static const eT G_0; //!< conductance quantum (in siemens) static const eT k_e; //!< Coulomb's constant (in meters per farad) static const eT eps_0; //!< electric constant (in farads per meter) static const eT m_e; //!< electron mass (in kg) static const eT eV; //!< electron volt (in joules) static const eT ec; //!< elementary charge (in coulombs) static const eT F; //!< Faraday constant (in coulombs) static const eT alpha; //!< fine-structure constant static const eT alpha_inv; //!< inverse fine-structure constant static const eT K_J; //!< Josephson constant static const eT mu_0; //!< magnetic constant (in henries per meter) static const eT phi_0; //!< magnetic flux quantum (in webers) static const eT R; //!< molar gas constant (in joules per mole kelvin) static const eT G; //!< Newtonian constant of gravitation (in newton square meters per kilogram squared) static const eT h; //!< Planck constant (in joule seconds) static const eT h_bar; //!< Planck constant over 2 pi, aka reduced Planck constant (in joule seconds) static const eT m_p; //!< proton mass (in kg) static const eT R_inf; //!< Rydberg constant (in reciprocal meters) static const eT c_0; //!< speed of light in vacuum (in meters per second) static const eT sigma; //!< Stefan-Boltzmann constant static const eT R_k; //!< von Klitzing constant (in ohms) static const eT b; //!< Wien wavelength displacement law constant }; // the long lengths of the constants are for future support of "long double" // and any smart compiler that does high-precision computation at compile-time template const eT Datum::pi = eT(3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679); template const eT Datum::tau = eT(6.2831853071795864769252867665590057683943387987502116419498891846156328125724179972560696506842341359); template const eT Datum::e = eT(2.7182818284590452353602874713526624977572470936999595749669676277240766303535475945713821785251664274); template const eT Datum::euler = eT(0.5772156649015328606065120900824024310421593359399235988057672348848677267776646709369470632917467495); template const eT Datum::gratio = eT(1.6180339887498948482045868343656381177203091798057628621354486227052604628189024497072072041893911374); template const eT Datum::sqrt2 = eT(1.4142135623730950488016887242096980785696718753769480731766797379907324784621070388503875343276415727); template const eT Datum::sqrt2pi = eT(2.5066282746310005024157652848110452530069867406099383166299235763422936546078419749465958383780572661); template const eT Datum::log_sqrt2pi = eT(0.9189385332046727417803297364056176398613974736377834128171515404827656959272603976947432986359541976); template const eT Datum::eps = std::numeric_limits::epsilon(); template const eT Datum::log_min = std::log(std::numeric_limits::min()); template const eT Datum::log_max = std::log(std::numeric_limits::max()); template const eT Datum::nan = priv::Datum_helper::nan(); template const eT Datum::inf = priv::Datum_helper::inf(); template const eT Datum::m_u = eT(1.66053906892e-27); template const eT Datum::N_A = eT(6.02214076e23); template const eT Datum::k = eT(1.380649e-23); template const eT Datum::k_evk = eT(8.617333262e-5); template const eT Datum::a_0 = eT(5.29177210544e-11); template const eT Datum::mu_B = eT(9.2740100657e-24); template const eT Datum::Z_0 = eT(376.730313412); template const eT Datum::G_0 = eT(7.748091729e-5); template const eT Datum::k_e = eT(8.9875517923e9); template const eT Datum::eps_0 = eT(8.8541878128e-12); template const eT Datum::m_e = eT(9.1093837139e-31); template const eT Datum::eV = eT(1.602176634e-19); template const eT Datum::ec = eT(1.602176634e-19); template const eT Datum::F = eT(96485.33212); template const eT Datum::alpha = eT(7.2973525643e-3); template const eT Datum::alpha_inv = eT(137.035999177); template const eT Datum::K_J = eT(483597.8484e9); template const eT Datum::mu_0 = eT(1.25663706212e-6); template const eT Datum::phi_0 = eT(2.067833848e-15); template const eT Datum::R = eT(8.314462618); template const eT Datum::G = eT(6.67430e-11); template const eT Datum::h = eT(6.62607015e-34); template const eT Datum::h_bar = eT(1.054571817e-34); template const eT Datum::m_p = eT(1.67262192595e-27); template const eT Datum::R_inf = eT(10973731.568157); template const eT Datum::c_0 = eT(299792458.0); template const eT Datum::sigma = eT(5.670374419e-8); template const eT Datum::R_k = eT(25812.80745); template const eT Datum::b = eT(2.897771955e-3); typedef Datum fdatum; typedef Datum datum; namespace priv { template static constexpr typename arma_real_only::result most_neg() { return (std::numeric_limits::has_infinity) ? -(std::numeric_limits::infinity()) : std::numeric_limits::lowest(); } template static constexpr typename arma_integral_only::result most_neg() { return std::numeric_limits::lowest(); } template static constexpr typename arma_real_only::result most_pos() { return (std::numeric_limits::has_infinity) ? std::numeric_limits::infinity() : std::numeric_limits::max(); } template static constexpr typename arma_integral_only::result most_pos() { return std::numeric_limits::max(); } } //! @} RcppArmadillo/inst/include/armadillo_bits/SizeCube_meat.hpp0000644000176200001440000000642114631567470023640 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup SizeCube //! @{ inline SizeCube::SizeCube(const uword in_n_rows, const uword in_n_cols, const uword in_n_slices) : n_rows (in_n_rows ) , n_cols (in_n_cols ) , n_slices(in_n_slices) { arma_debug_sigprint(); } inline uword SizeCube::operator[](const uword dim) const { if(dim == 0) { return n_rows; } if(dim == 1) { return n_cols; } if(dim == 2) { return n_slices; } return uword(1); } inline uword SizeCube::operator()(const uword dim) const { if(dim == 0) { return n_rows; } if(dim == 1) { return n_cols; } if(dim == 2) { return n_slices; } arma_conform_check_bounds(true, "size(): index out of bounds"); return uword(1); } inline bool SizeCube::operator==(const SizeCube& s) const { if(n_rows != s.n_rows ) { return false; } if(n_cols != s.n_cols ) { return false; } if(n_slices != s.n_slices) { return false; } return true; } inline bool SizeCube::operator!=(const SizeCube& s) const { if(n_rows != s.n_rows ) { return true; } if(n_cols != s.n_cols ) { return true; } if(n_slices != s.n_slices) { return true; } return false; } inline SizeCube SizeCube::operator+(const SizeCube& s) const { return SizeCube( (n_rows + s.n_rows), (n_cols + s.n_cols), (n_slices + s.n_slices) ); } inline SizeCube SizeCube::operator-(const SizeCube& s) const { const uword out_n_rows = (n_rows > s.n_rows ) ? (n_rows - s.n_rows ) : uword(0); const uword out_n_cols = (n_cols > s.n_cols ) ? (n_cols - s.n_cols ) : uword(0); const uword out_n_slices = (n_slices > s.n_slices) ? (n_slices - s.n_slices) : uword(0); return SizeCube(out_n_rows, out_n_cols, out_n_slices); } inline SizeCube SizeCube::operator+(const uword val) const { return SizeCube( (n_rows + val), (n_cols + val), (n_slices + val) ); } inline SizeCube SizeCube::operator-(const uword val) const { const uword out_n_rows = (n_rows > val) ? (n_rows - val) : uword(0); const uword out_n_cols = (n_cols > val) ? (n_cols - val) : uword(0); const uword out_n_slices = (n_slices > val) ? (n_slices - val) : uword(0); return SizeCube(out_n_rows, out_n_cols, out_n_slices); } inline SizeCube SizeCube::operator*(const uword val) const { return SizeCube( (n_rows * val), (n_cols * val), (n_slices * val) ); } inline SizeCube SizeCube::operator/(const uword val) const { return SizeCube( (n_rows / val), (n_cols / val), (n_slices / val) ); } //! @} RcppArmadillo/inst/include/armadillo_bits/glue_atan2_bones.hpp0000644000176200001440000000300014301267043024301 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup glue_atan2 //! @{ class glue_atan2 : public traits_glue_or { public: // matrices template inline static void apply(Mat& out, const Glue& expr); template inline static void apply_noalias(Mat& out, const Proxy& P1, const Proxy& P2); // cubes template inline static void apply(Cube& out, const GlueCube& expr); template inline static void apply_noalias(Cube& out, const ProxyCube& P1, const ProxyCube& P2); }; //! @} RcppArmadillo/inst/include/armadillo_bits/newarp_SymEigsShiftSolver_meat.hpp0000644000176200001440000000303414631567470027251 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ namespace newarp { template inline void SymEigsShiftSolver::sort_ritzpair() { arma_debug_sigprint(); // First transform back the Ritz values, and then sort for(uword i = 0; i < this->nev; i++) { this->ritz_val(i) = eT(1.0) / this->ritz_val(i) + sigma; } SymEigsSolver::sort_ritzpair(); } template inline SymEigsShiftSolver::SymEigsShiftSolver(const OpType& op_, uword nev_, uword ncv_, const eT sigma_) : SymEigsSolver::SymEigsSolver(op_, nev_, ncv_) , sigma(sigma_) { arma_debug_sigprint(); } } // namespace newarp RcppArmadillo/inst/include/armadillo_bits/op_unique_meat.hpp0000644000176200001440000000707214631567470024136 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_unique //! @{ template inline bool op_unique::apply_helper(Mat& out, const Proxy& P, const bool P_is_row) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword n_elem = P.get_n_elem(); if(n_elem == 0) { if(P_is_row) { out.set_size(1,0); } else { out.set_size(0,1); } return true; } if(n_elem == 1) { const eT tmp = (Proxy::use_at) ? P.at(0,0) : P[0]; out.set_size(1, 1); out[0] = tmp; return true; } Mat X(n_elem, 1, arma_nozeros_indicator()); eT* X_mem = X.memptr(); if(Proxy::use_at == false) { typename Proxy::ea_type Pea = P.get_ea(); for(uword i=0; i comparator; std::sort( X.begin(), X.end(), comparator ); uword N_unique = 1; for(uword i=1; i < n_elem; ++i) { const eT a = X_mem[i-1]; const eT b = X_mem[i ]; const eT diff = a - b; if(diff != eT(0)) { ++N_unique; } } if(P_is_row) { out.set_size(1, N_unique); } else { out.set_size(N_unique, 1); } eT* out_mem = out.memptr(); if(n_elem > 0) { (*out_mem) = X_mem[0]; out_mem++; } for(uword i=1; i < n_elem; ++i) { const eT a = X_mem[i-1]; const eT b = X_mem[i ]; const eT diff = a - b; if(diff != eT(0)) { (*out_mem) = b; out_mem++; } } return true; } template inline void op_unique::apply(Mat& out, const Op& in) { arma_debug_sigprint(); const Proxy P(in.m); const bool all_non_nan = op_unique::apply_helper(out, P, false); arma_conform_check( (all_non_nan == false), "unique(): detected NaN" ); } template inline void op_unique_vec::apply(Mat& out, const Op& in) { arma_debug_sigprint(); const Proxy P(in.m); const bool P_is_row = (T1::is_xvec) ? bool(P.get_n_rows() == 1) : bool(T1::is_row); const bool all_non_nan = op_unique::apply_helper(out, P, P_is_row); arma_conform_check( (all_non_nan == false), "unique(): detected NaN" ); } //! @} RcppArmadillo/inst/include/armadillo_bits/spop_normalise_bones.hpp0000644000176200001440000000221014301267044025315 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup spop_normalise //! @{ class spop_normalise : public traits_op_passthru { public: template inline static void apply(SpMat& out, const SpOp& expr); template inline static void apply_direct(SpMat& out, const SpMat& X, const uword p); }; //! @} RcppArmadillo/inst/include/armadillo_bits/mul_gemm_mixed.hpp0000644000176200001440000002501014770765377024116 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup gemm_mixed //! @{ //! \brief //! Matrix multiplication where the matrices have differing element types. //! Uses caching for speedup. //! Matrix 'C' is assumed to have been set to the correct size (ie. taking into account transposes) template class gemm_mixed_large { public: template arma_hot inline static void apply ( Mat& C, const Mat& A, const Mat& B, const out_eT alpha = out_eT(1), const out_eT beta = out_eT(0) ) { arma_debug_sigprint(); const uword A_n_rows = A.n_rows; const uword A_n_cols = A.n_cols; const uword B_n_rows = B.n_rows; const uword B_n_cols = B.n_cols; if( (do_trans_A == false) && (do_trans_B == false) ) { podarray tmp(A_n_cols); in_eT1* A_rowdata = tmp.memptr(); #if defined(ARMA_USE_OPENMP) const bool use_mp = (B_n_cols >= 2) && (B.n_elem >= 8192) && (mp_thread_limit::in_parallel() == false); #else const bool use_mp = false; #endif if(use_mp) { #if defined(ARMA_USE_OPENMP) { const int n_threads = int( (std::min)( uword(mp_thread_limit::get()), uword(B_n_cols) ) ); for(uword row_A=0; row_A < A_n_rows; ++row_A) { tmp.copy_row(A, row_A); #pragma omp parallel for schedule(static) num_threads(n_threads) for(uword col_B=0; col_B < B_n_cols; ++col_B) { const in_eT2* B_coldata = B.colptr(col_B); out_eT acc = out_eT(0); for(uword i=0; i < B_n_rows; ++i) { acc += upgrade_val::apply(A_rowdata[i]) * upgrade_val::apply(B_coldata[i]); } if( (use_alpha == false) && (use_beta == false) ) { C.at(row_A,col_B) = acc; } else if( (use_alpha == true ) && (use_beta == false) ) { C.at(row_A,col_B) = alpha*acc; } else if( (use_alpha == false) && (use_beta == true ) ) { C.at(row_A,col_B) = acc + beta*C.at(row_A,col_B); } else if( (use_alpha == true ) && (use_beta == true ) ) { C.at(row_A,col_B) = alpha*acc + beta*C.at(row_A,col_B); } } } } #endif } else { for(uword row_A=0; row_A < A_n_rows; ++row_A) { tmp.copy_row(A, row_A); for(uword col_B=0; col_B < B_n_cols; ++col_B) { const in_eT2* B_coldata = B.colptr(col_B); out_eT acc = out_eT(0); for(uword i=0; i < B_n_rows; ++i) { acc += upgrade_val::apply(A_rowdata[i]) * upgrade_val::apply(B_coldata[i]); } if( (use_alpha == false) && (use_beta == false) ) { C.at(row_A,col_B) = acc; } else if( (use_alpha == true ) && (use_beta == false) ) { C.at(row_A,col_B) = alpha*acc; } else if( (use_alpha == false) && (use_beta == true ) ) { C.at(row_A,col_B) = acc + beta*C.at(row_A,col_B); } else if( (use_alpha == true ) && (use_beta == true ) ) { C.at(row_A,col_B) = alpha*acc + beta*C.at(row_A,col_B); } } } } } else if( (do_trans_A == true) && (do_trans_B == false) ) { #if defined(ARMA_USE_OPENMP) const bool use_mp = (B_n_cols >= 2) && (B.n_elem >= 8192) && (mp_thread_limit::in_parallel() == false); #else const bool use_mp = false; #endif if(use_mp) { #if defined(ARMA_USE_OPENMP) { const int n_threads = int( (std::min)( uword(mp_thread_limit::get()), uword(B_n_cols) ) ); for(uword col_A=0; col_A < A_n_cols; ++col_A) { // col_A is interpreted as row_A when storing the results in matrix C const in_eT1* A_coldata = A.colptr(col_A); #pragma omp parallel for schedule(static) num_threads(n_threads) for(uword col_B=0; col_B < B_n_cols; ++col_B) { const in_eT2* B_coldata = B.colptr(col_B); out_eT acc = out_eT(0); for(uword i=0; i < B_n_rows; ++i) { acc += upgrade_val::apply(A_coldata[i]) * upgrade_val::apply(B_coldata[i]); } if( (use_alpha == false) && (use_beta == false) ) { C.at(col_A,col_B) = acc; } else if( (use_alpha == true ) && (use_beta == false) ) { C.at(col_A,col_B) = alpha*acc; } else if( (use_alpha == false) && (use_beta == true ) ) { C.at(col_A,col_B) = acc + beta*C.at(col_A,col_B); } else if( (use_alpha == true ) && (use_beta == true ) ) { C.at(col_A,col_B) = alpha*acc + beta*C.at(col_A,col_B); } } } } #endif } else { for(uword col_A=0; col_A < A_n_cols; ++col_A) { // col_A is interpreted as row_A when storing the results in matrix C const in_eT1* A_coldata = A.colptr(col_A); for(uword col_B=0; col_B < B_n_cols; ++col_B) { const in_eT2* B_coldata = B.colptr(col_B); out_eT acc = out_eT(0); for(uword i=0; i < B_n_rows; ++i) { acc += upgrade_val::apply(A_coldata[i]) * upgrade_val::apply(B_coldata[i]); } if( (use_alpha == false) && (use_beta == false) ) { C.at(col_A,col_B) = acc; } else if( (use_alpha == true ) && (use_beta == false) ) { C.at(col_A,col_B) = alpha*acc; } else if( (use_alpha == false) && (use_beta == true ) ) { C.at(col_A,col_B) = acc + beta*C.at(col_A,col_B); } else if( (use_alpha == true ) && (use_beta == true ) ) { C.at(col_A,col_B) = alpha*acc + beta*C.at(col_A,col_B); } } } } } else if( (do_trans_A == false) && (do_trans_B == true) ) { Mat B_tmp; op_strans::apply_mat_noalias(B_tmp, B); gemm_mixed_large::apply(C, A, B_tmp, alpha, beta); } else if( (do_trans_A == true) && (do_trans_B == true) ) { // mat B_tmp = trans(B); // dgemm_arma::apply(C, A, B_tmp, alpha, beta); // By using the trans(A)*trans(B) = trans(B*A) equivalency, // transpose operations are not needed podarray tmp(B_n_cols); in_eT2* B_rowdata = tmp.memptr(); for(uword row_B=0; row_B < B_n_rows; ++row_B) { tmp.copy_row(B, row_B); for(uword col_A=0; col_A < A_n_cols; ++col_A) { const in_eT1* A_coldata = A.colptr(col_A); out_eT acc = out_eT(0); for(uword i=0; i < A_n_rows; ++i) { acc += upgrade_val::apply(B_rowdata[i]) * upgrade_val::apply(A_coldata[i]); } if( (use_alpha == false) && (use_beta == false) ) { C.at(col_A,row_B) = acc; } else if( (use_alpha == true ) && (use_beta == false) ) { C.at(col_A,row_B) = alpha*acc; } else if( (use_alpha == false) && (use_beta == true ) ) { C.at(col_A,row_B) = acc + beta*C.at(col_A,row_B); } else if( (use_alpha == true ) && (use_beta == true ) ) { C.at(col_A,row_B) = alpha*acc + beta*C.at(col_A,row_B); } } } } } }; //! \brief //! Matrix multiplication where the matrices have differing element types. template class gemm_mixed { public: //! immediate multiplication of matrices A and B, storing the result in C template inline static void apply ( Mat& C, const Mat& A, const Mat& B, const out_eT alpha = out_eT(1), const out_eT beta = out_eT(0) ) { arma_debug_sigprint(); if((is_cx::yes && do_trans_A) || (is_cx::yes && do_trans_B)) { // better-than-nothing handling of hermitian transpose Mat tmp_A; Mat tmp_B; const bool predo_trans_A = ( (do_trans_A == true) && (is_cx::yes) ); const bool predo_trans_B = ( (do_trans_B == true) && (is_cx::yes) ); if(predo_trans_A) { op_htrans::apply_mat_noalias(tmp_A, A); } if(predo_trans_B) { op_htrans::apply_mat_noalias(tmp_B, B); } const Mat& AA = (predo_trans_A == false) ? A : tmp_A; const Mat& BB = (predo_trans_B == false) ? B : tmp_B; gemm_mixed_large<((predo_trans_A) ? false : do_trans_A), ((predo_trans_B) ? false : do_trans_B), use_alpha, use_beta>::apply(C, AA, BB, alpha, beta); } else { gemm_mixed_large::apply(C, A, B, alpha, beta); } } }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_clamp_bones.hpp0000644000176200001440000000556614301267043024075 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_clamp //! @{ class op_clamp : public traits_op_passthru { public: // matrices template inline static void apply(Mat& out, const mtOp& in); template inline static void apply_direct(Mat& out, const Mat& X, const eT min_val, const eT max_val); template inline static void apply_proxy_noalias(Mat& out, const Proxy& P, const typename T1::elem_type min_val, const typename T1::elem_type max_val); // cubes template inline static void apply(Cube& out, const mtOpCube& in); template inline static void apply_direct(Cube& out, const Cube& X, const eT min_val, const eT max_val); template inline static void apply_proxy_noalias(Cube& out, const ProxyCube& P, const typename T1::elem_type min_val, const typename T1::elem_type max_val); }; class op_clamp_cx : public traits_op_passthru { public: // matrices template inline static void apply(Mat& out, const mtOp& in); template inline static void apply_direct(Mat& out, const Mat& X, const eT min_val, const eT max_val); template inline static void apply_proxy_noalias(Mat& out, const Proxy& P, const typename T1::elem_type min_val, const typename T1::elem_type max_val); // cubes template inline static void apply(Cube& out, const mtOpCube& in); template inline static void apply_direct(Cube& out, const Cube& X, const eT min_val, const eT max_val); template inline static void apply_proxy_noalias(Cube& out, const ProxyCube& P, const typename T1::elem_type min_val, const typename T1::elem_type max_val); }; //! @} RcppArmadillo/inst/include/armadillo_bits/fn_reverse.hpp0000644000176200001440000000355514631567470023264 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_reverse //! @{ template arma_warn_unused inline typename enable_if2 < is_arma_type::value && resolves_to_vector::yes, const Op >::result reverse ( const T1& X ) { arma_debug_sigprint(); return Op(X); } template arma_warn_unused inline typename enable_if2 < is_arma_type::value && resolves_to_vector::no, const Op >::result reverse ( const T1& X ) { arma_debug_sigprint(); return Op(X, 0, 0); } template arma_warn_unused inline typename enable_if2< is_arma_type::value, const Op >::result reverse ( const T1& X, const uword dim ) { arma_debug_sigprint(); return Op(X, dim, 0); } template arma_warn_unused inline const SpOp reverse ( const SpBase& X, const uword dim = 0 ) { arma_debug_sigprint(); return SpOp(X.get_ref(), dim, 0); } //! @} RcppArmadillo/inst/include/armadillo_bits/glue_cov_bones.hpp0000644000176200001440000000236714301267043024102 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup glue_cov //! @{ class glue_cov { public: template struct traits { static constexpr bool is_row = false; // T1::is_col; // TODO: check static constexpr bool is_col = false; // T2::is_col; // TODO: check static constexpr bool is_xvec = false; }; template inline static void apply(Mat& out, const Glue& X); }; //! @} RcppArmadillo/inst/include/armadillo_bits/fn_diagvec.hpp0000644000176200001440000000340414634016465023200 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_diagvec //! @{ //! extract main diagonal from matrix template arma_warn_unused arma_inline const Op diagvec(const Base& X) { arma_debug_sigprint(); return Op(X.get_ref()); } //! extract arbitrary diagonal from matrix template arma_warn_unused arma_inline const Op diagvec(const Base& X, const sword diag_id) { arma_debug_sigprint(); return Op(X.get_ref(), ((diag_id < 0) ? -diag_id : diag_id), ((diag_id < 0) ? 1 : 0) ); } template arma_warn_unused arma_inline const mtSpReduceOp diagvec(const SpBase& X, const sword diag_id = 0) { arma_debug_sigprint(); return mtSpReduceOp(X.get_ref(), ((diag_id < 0) ? -diag_id : diag_id), ((diag_id < 0) ? 1 : 0) ); } //! @} RcppArmadillo/inst/include/armadillo_bits/arma_forward.hpp0000644000176200001440000003163215030507611023550 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ using std::cout; using std::cerr; using std::endl; using std::ios; using std::size_t; template struct Base; template struct BaseCube; template class Mat; template class Col; template class Row; template class Cube; template class xvec_htrans; template class field; template class xtrans_mat; template class subview; template class subview_col; template class subview_cols; template class subview_row; template class subview_row_strans; template class subview_row_htrans; template class subview_cube; template class subview_field; template class SpValProxy; template class SpMat; template class SpCol; template class SpRow; template class SpSubview; template class SpSubview_col; template class SpSubview_row; template class diagview; template class spdiagview; template class MapMat; template class MapMat_val; template class SpMat_MapMat_val; template class SpSubview_MapMat_val; template class subview_elem1; template class subview_elem2; template class subview_each1; template class subview_each2; template class subview_cube_each1; template class subview_cube_each2; template class subview_cube_slices; template class SpSubview_col_list; class SizeMat; class SizeCube; class arma_empty_class {}; class diskio; class op_strans; class op_htrans; class op_htrans2; class op_inv_gen_default; class op_inv_spd_default; class op_inv_gen_full; class op_inv_spd_full; class op_diagmat; class op_trimat; class op_vectorise_row; class op_vectorise_col; class op_symmatu; class op_symmatl; class op_omit; class op_row_as_mat; class op_col_as_mat; class glue_times; class glue_times_diag; class glue_rel_lt; class glue_rel_gt; class glue_rel_lteq; class glue_rel_gteq; class glue_rel_eq; class glue_rel_noteq; class glue_rel_and; class glue_rel_or; class op_rel_lt_pre; class op_rel_lt_post; class op_rel_gt_pre; class op_rel_gt_post; class op_rel_lteq_pre; class op_rel_lteq_post; class op_rel_gteq_pre; class op_rel_gteq_post; class op_rel_eq; class op_rel_noteq; class gen_eye; class gen_ones; class gen_zeros; class spop_strans; class spop_htrans; class spop_vectorise_row; class spop_vectorise_col; class spop_square; class spop_rel_lt_pre; class spop_rel_lt_post; class spop_rel_gt_pre; class spop_rel_gt_post; class spop_rel_lteq_pre; class spop_rel_lteq_post; class spop_rel_gteq_pre; class spop_rel_gteq_post; class spop_rel_eq; class spop_rel_noteq; class spglue_plus; class spglue_minus; class spglue_schur; class spglue_times; class spglue_max; class spglue_min; class spglue_rel_lt; class spglue_rel_gt; class op_sp_as_dense; class op_internal_equ; class op_internal_plus; class op_internal_minus; class op_internal_schur; class op_internal_div; struct traits_op_default { template struct traits { static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = false; }; }; struct traits_op_xvec { template struct traits { static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = true; }; }; struct traits_op_col { template struct traits { static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; }; }; struct traits_op_row { template struct traits { static constexpr bool is_row = true; static constexpr bool is_col = false; static constexpr bool is_xvec = false; }; }; struct traits_op_passthru { template struct traits { static constexpr bool is_row = T1::is_row; static constexpr bool is_col = T1::is_col; static constexpr bool is_xvec = T1::is_xvec; }; }; struct traits_glue_default { template struct traits { static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = false; }; }; struct traits_glue_or { template struct traits { static constexpr bool is_row = (T1::is_row || T2::is_row ); static constexpr bool is_col = (T1::is_col || T2::is_col ); static constexpr bool is_xvec = (T1::is_xvec || T2::is_xvec); }; }; template class gemm; template class gemv; template< typename eT, typename gen_type> class Gen; template< typename T1, typename op_type> class Op; template< typename T1, typename eop_type> class eOp; template< typename T1, typename op_type> class SpToDOp; template< typename T1, typename op_type> class CubeToMatOp; template class mtOp; template< typename T1, typename T2, typename glue_type> class Glue; template< typename T1, typename T2, typename eglue_type> class eGlue; template< typename T1, typename T2, typename glue_type> class SpToDGlue; template class mtGlue; template< typename eT, typename gen_type> class GenCube; template< typename T1, typename op_type> class OpCube; template< typename T1, typename eop_type> class eOpCube; template class mtOpCube; template< typename T1, typename T2, typename glue_type> class GlueCube; template< typename T1, typename T2, typename eglue_type> class eGlueCube; template class mtGlueCube; template struct Proxy; template struct ProxyCube; template class diagmat_proxy; template struct unwrap; template struct quasi_unwrap; template struct unwrap_cube; template struct unwrap_spmat; struct state_type { #if defined(ARMA_USE_OPENMP) int state; #elif defined(ARMA_USE_STD_MUTEX) std::atomic state; #else int state; #endif arma_inline state_type() : state(int(0)) {} // openmp: "omp atomic" does an implicit flush on the affected variable // C++11: std::atomic<>::load() and std::atomic<>::store() use std::memory_order_seq_cst by default, which has an implied fence arma_inline operator int () const { int out; #if defined(ARMA_USE_OPENMP) #pragma omp atomic read out = state; #elif defined(ARMA_USE_STD_MUTEX) out = state.load(); #else out = state; #endif return out; } arma_inline void operator= (const int in_state) { #if defined(ARMA_USE_OPENMP) #pragma omp atomic write state = in_state; #elif defined(ARMA_USE_STD_MUTEX) state.store(in_state); #else state = in_state; #endif } }; template< typename T1, typename spop_type> class SpOp; template class mtSpOp; template class mtSpReduceOp; template< typename T1, typename T2, typename spglue_type> class SpGlue; template class mtSpGlue; template struct SpProxy; struct arma_vec_indicator {}; struct arma_fixed_indicator {}; struct arma_reserve_indicator {}; struct arma_layout_indicator {}; template struct arma_initmode_indicator {}; struct arma_zeros_indicator : public arma_initmode_indicator {}; struct arma_nozeros_indicator : public arma_initmode_indicator {}; //! \addtogroup injector //! @{ template struct injector_end_of_row {}; // DEPRECATED: DO NOT USE IN NEW CODE static const injector_end_of_row<> endr = injector_end_of_row<>(); //!< endr indicates "end of row" when using the << operator; //!< similar conceptual meaning to std::endl //! @} //! \addtogroup diskio //! @{ enum struct file_type : unsigned int { file_type_unknown, auto_detect, //!< attempt to automatically detect the file type raw_ascii, //!< raw text (ASCII), without a header arma_ascii, //!< Armadillo text format, with a header specifying matrix type and size csv_ascii, //!< comma separated values (CSV), without a header raw_binary, //!< raw binary format (machine dependent), without a header arma_binary, //!< Armadillo binary format (machine dependent), with a header specifying matrix type and size pgm_binary, //!< Portable Grey Map (greyscale image) ppm_binary, //!< Portable Pixel Map (colour image), used by the field and cube classes hdf5_binary, //!< HDF5: open binary format, not specific to Armadillo, which can store arbitrary data hdf5_binary_trans, //!< [NOTE: DO NOT USE - deprecated] as per hdf5_binary, but save/load the data with columns transposed to rows coord_ascii, //!< simple co-ordinate format for sparse matrices (indices start at zero) ssv_ascii, //!< similar to csv_ascii; uses semicolon (;) instead of comma (,) as the separator }; static constexpr file_type file_type_unknown = file_type::file_type_unknown; static constexpr file_type auto_detect = file_type::auto_detect; static constexpr file_type raw_ascii = file_type::raw_ascii; static constexpr file_type arma_ascii = file_type::arma_ascii; static constexpr file_type csv_ascii = file_type::csv_ascii; static constexpr file_type raw_binary = file_type::raw_binary; static constexpr file_type arma_binary = file_type::arma_binary; static constexpr file_type pgm_binary = file_type::pgm_binary; static constexpr file_type ppm_binary = file_type::ppm_binary; static constexpr file_type hdf5_binary = file_type::hdf5_binary; static constexpr file_type hdf5_binary_trans = file_type::hdf5_binary_trans; static constexpr file_type coord_ascii = file_type::coord_ascii; static constexpr file_type ssv_ascii = file_type::ssv_ascii; struct hdf5_name; struct csv_name; //! @} //! \addtogroup fn_spsolve //! @{ struct spsolve_opts_base { const unsigned int id; inline spsolve_opts_base(const unsigned int in_id) : id(in_id) {} }; struct spsolve_opts_none : public spsolve_opts_base { inline spsolve_opts_none() : spsolve_opts_base(0) {} }; struct superlu_opts : public spsolve_opts_base { typedef enum {NATURAL, MMD_ATA, MMD_AT_PLUS_A, COLAMD} permutation_type; typedef enum {REF_NONE, REF_SINGLE, REF_DOUBLE, REF_EXTRA} refine_type; bool allow_ugly; bool equilibrate; bool symmetric; double pivot_thresh; permutation_type permutation; refine_type refine; inline superlu_opts() : spsolve_opts_base(1) { allow_ugly = false; equilibrate = false; symmetric = false; pivot_thresh = 1.0; permutation = COLAMD; refine = REF_NONE; } }; //! @} //! \ingroup fn_eigs_sym fs_eigs_gen //! @{ struct eigs_opts { double tol; // tolerance unsigned int maxiter; // max iterations unsigned int subdim; // subspace dimension inline eigs_opts() { tol = 0.0; maxiter = 1000; subdim = 0; } }; //! @} RcppArmadillo/inst/include/armadillo_bits/mtSpOp_meat.hpp0000644000176200001440000000457515030507611023342 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup mtSpOp //! @{ template inline mtSpOp::mtSpOp(const T1& in_m) : m(in_m) { arma_debug_sigprint(); } template inline mtSpOp::mtSpOp(const T1& in_m, const typename T1::elem_type in_aux) : m(in_m) , aux(in_aux) { arma_debug_sigprint(); } template inline mtSpOp::mtSpOp(const T1& in_m, const uword in_aux_uword_a, const uword in_aux_uword_b) : m(in_m) , aux_uword_a(in_aux_uword_a) , aux_uword_b(in_aux_uword_b) { arma_debug_sigprint(); } template inline mtSpOp::mtSpOp(const char junk, const T1& in_m, const out_eT in_aux) : m(in_m) , aux_out_eT(in_aux) { arma_ignore(junk); arma_debug_sigprint(); } template inline mtSpOp::mtSpOp(const mtSpOp_dual_aux_indicator&, const T1& in_m, const typename T1::elem_type in_aux_a, const out_eT in_aux_b) : m (in_m ) , aux (in_aux_a) , aux_out_eT(in_aux_b) { arma_debug_sigprint(); } template inline mtSpOp::~mtSpOp() { arma_debug_sigprint(); } template template arma_inline bool mtSpOp::is_alias(const SpMat& X) const { return (void_ptr(&X) == void_ptr(&m)); } //! @} RcppArmadillo/inst/include/armadillo_bits/operator_div.hpp0000644000176200001440000002043314631567470023615 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup operator_div //! @{ //! Base / scalar template arma_inline typename enable_if2< is_arma_type::value, const eOp< T1, eop_scalar_div_post> >::result operator/ ( const T1& X, const typename T1::elem_type k ) { arma_debug_sigprint(); return eOp(X, k); } //! scalar / Base template arma_inline typename enable_if2< is_arma_type::value, const eOp< T1, eop_scalar_div_pre> >::result operator/ ( const typename T1::elem_type k, const T1& X ) { arma_debug_sigprint(); return eOp(X, k); } //! complex scalar / non-complex Base template arma_inline typename enable_if2 < (is_arma_type::value && is_cx::no), const mtOp, T1, op_cx_scalar_div_pre> >::result operator/ ( const std::complex& k, const T1& X ) { arma_debug_sigprint(); return mtOp, T1, op_cx_scalar_div_pre>('j', X, k); } //! non-complex Base / complex scalar template arma_inline typename enable_if2 < (is_arma_type::value && is_cx::no), const mtOp, T1, op_cx_scalar_div_post> >::result operator/ ( const T1& X, const std::complex& k ) { arma_debug_sigprint(); return mtOp, T1, op_cx_scalar_div_post>('j', X, k); } //! element-wise division of Base objects with same element type template arma_inline typename enable_if2 < (is_arma_type::value && is_arma_type::value && is_same_type::value), const eGlue >::result operator/ ( const T1& X, const T2& Y ) { arma_debug_sigprint(); return eGlue(X, Y); } //! element-wise division of Base objects with different element types template inline typename enable_if2 < (is_arma_type::value && is_arma_type::value && (is_same_type::no)), const mtGlue::result, T1, T2, glue_mixed_div> >::result operator/ ( const T1& X, const T2& Y ) { arma_debug_sigprint(); typedef typename T1::elem_type eT1; typedef typename T2::elem_type eT2; typedef typename promote_type::result out_eT; promote_type::check(); return mtGlue( X, Y ); } //! element-wise division of sparse matrix by scalar template inline typename enable_if2< is_arma_sparse_type::value, SpMat >::result operator/ ( const T1& X, const typename T1::elem_type y ) { arma_debug_sigprint(); SpMat result(X); result /= y; return result; } //! element-wise division of one sparse and one dense object template inline typename enable_if2 < (is_arma_sparse_type::value && is_arma_type::value && is_same_type::value), SpMat >::result operator/ ( const T1& x, const T2& y ) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const SpProxy pa(x); const Proxy pb(y); const uword n_rows = pa.get_n_rows(); const uword n_cols = pa.get_n_cols(); arma_conform_assert_same_size(n_rows, n_cols, pb.get_n_rows(), pb.get_n_cols(), "element-wise division"); uword new_n_nonzero = 0; for(uword col=0; col < n_cols; ++col) for(uword row=0; row < n_rows; ++row) { const eT val = pa.at(row,col) / pb.at(row, col); if(val != eT(0)) { ++new_n_nonzero; } } SpMat result(arma_reserve_indicator(), n_rows, n_cols, new_n_nonzero); uword cur_pos = 0; for(uword col=0; col < n_cols; ++col) for(uword row=0; row < n_rows; ++row) { const eT val = pa.at(row,col) / pb.at(row, col); if(val != eT(0)) { access::rw(result.values[cur_pos]) = val; access::rw(result.row_indices[cur_pos]) = row; ++access::rw(result.col_ptrs[col + 1]); ++cur_pos; } } // Fix column pointers for(uword col = 1; col <= result.n_cols; ++col) { access::rw(result.col_ptrs[col]) += result.col_ptrs[col - 1]; } return result; } //! optimization: element-wise division of sparse / (sparse +/- scalar) template inline typename enable_if2 < ( is_arma_sparse_type::value && is_arma_sparse_type::value && is_same_type::yes && (is_same_type::value || is_same_type::value || is_same_type::value) ), SpMat >::result operator/ ( const T1& x, const SpToDOp& y ) { arma_debug_sigprint(); SpMat out; op_type::apply_inside_div(out, x, y); return out; } //! element-wise division of one dense and one sparse object template inline typename enable_if2 < (is_arma_type::value && is_arma_sparse_type::value && is_same_type::value), Mat >::result operator/ ( const T1& x, const T2& y ) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const Proxy pa(x); const SpProxy pb(y); const uword n_rows = pa.get_n_rows(); const uword n_cols = pa.get_n_cols(); arma_conform_assert_same_size(n_rows, n_cols, pb.get_n_rows(), pb.get_n_cols(), "element-wise division"); Mat result(n_rows, n_cols, arma_nozeros_indicator()); for(uword col=0; col < n_cols; ++col) for(uword row=0; row < n_rows; ++row) { result.at(row, col) = pa.at(row, col) / pb.at(row, col); } return result; } template arma_inline Mat operator/ ( const subview_each1& X, const Base& Y ) { arma_debug_sigprint(); return subview_each1_aux::operator_div(X, Y.get_ref()); } template arma_inline Mat operator/ ( const Base& X, const subview_each1& Y ) { arma_debug_sigprint(); return subview_each1_aux::operator_div(X.get_ref(), Y); } template arma_inline Mat operator/ ( const subview_each2& X, const Base& Y ) { arma_debug_sigprint(); return subview_each2_aux::operator_div(X, Y.get_ref()); } template arma_inline Mat operator/ ( const Base& X, const subview_each2& Y ) { arma_debug_sigprint(); return subview_each2_aux::operator_div(X.get_ref(), Y); } //! @} RcppArmadillo/inst/include/armadillo_bits/SpSubview_meat.hpp0000644000176200001440000011743215013306507024046 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup SpSubview //! @{ template inline SpSubview::~SpSubview() { arma_debug_sigprint_this(this); } template inline SpSubview::SpSubview(const SpMat& in_m, const uword in_row1, const uword in_col1, const uword in_n_rows, const uword in_n_cols) : m(in_m) , aux_row1(in_row1) , aux_col1(in_col1) , n_rows(in_n_rows) , n_cols(in_n_cols) , n_elem(in_n_rows * in_n_cols) , n_nonzero(0) { arma_debug_sigprint_this(this); m.sync_csc(); // count the number of non-zeros in the subview uword count = 0; if(n_rows == m.n_rows) { count = m.col_ptrs[aux_col1 + n_cols] - m.col_ptrs[aux_col1]; } else { arma_debug_print("counting non-zeros in sparse subview"); uword lend = m.col_ptrs[in_col1 + in_n_cols]; uword lend_row = in_row1 + in_n_rows; for(uword i = m.col_ptrs[in_col1]; i < lend; ++i) { const uword m_row_indices_i = m.row_indices[i]; const bool condition = (m_row_indices_i >= in_row1) && (m_row_indices_i < lend_row); count += condition ? uword(1) : uword(0); } } access::rw(n_nonzero) = count; } template inline SpSubview::SpSubview(const SpSubview& in) : m (in.m ) , aux_row1 (in.aux_row1 ) , aux_col1 (in.aux_col1 ) , n_rows (in.n_rows ) , n_cols (in.n_cols ) , n_elem (in.n_elem ) , n_nonzero(in.n_nonzero) { arma_debug_sigprint(arma_str::format("this: %x; in: %x") % this % &in); } template inline SpSubview::SpSubview(SpSubview&& in) : m (in.m ) , aux_row1 (in.aux_row1 ) , aux_col1 (in.aux_col1 ) , n_rows (in.n_rows ) , n_cols (in.n_cols ) , n_elem (in.n_elem ) , n_nonzero(in.n_nonzero) { arma_debug_sigprint(arma_str::format("this: %x; in: %x") % this % &in); // for paranoia access::rw(in.aux_row1 ) = 0; access::rw(in.aux_col1 ) = 0; access::rw(in.n_rows ) = 0; access::rw(in.n_cols ) = 0; access::rw(in.n_elem ) = 0; access::rw(in.n_nonzero) = 0; } template inline const SpSubview& SpSubview::operator+=(const eT val) { arma_debug_sigprint(); if(val == eT(0)) { return *this; } Mat tmp( (*this).n_rows, (*this).n_cols, arma_nozeros_indicator() ); tmp.fill(val); return (*this).operator=( (*this) + tmp ); } template inline const SpSubview& SpSubview::operator-=(const eT val) { arma_debug_sigprint(); if(val == eT(0)) { return *this; } Mat tmp( (*this).n_rows, (*this).n_cols, arma_nozeros_indicator() ); tmp.fill(val); return (*this).operator=( (*this) - tmp ); } template inline const SpSubview& SpSubview::operator*=(const eT val) { arma_debug_sigprint(); if((n_elem == 0) || (n_nonzero == 0)) { return *this; } m.sync_csc(); m.invalidate_cache(); const uword lstart_row = aux_row1; const uword lend_row = aux_row1 + n_rows; const uword lstart_col = aux_col1; const uword lend_col = aux_col1 + n_cols; const uword* m_row_indices = m.row_indices; eT* m_values = access::rwp(m.values); bool has_zero = false; for(uword c = lstart_col; c < lend_col; ++c) { const uword r_start = m.col_ptrs[c ]; const uword r_end = m.col_ptrs[c + 1]; for(uword r = r_start; r < r_end; ++r) { const uword m_row_indices_r = m_row_indices[r]; if( (m_row_indices_r >= lstart_row) && (m_row_indices_r < lend_row) ) { eT& m_values_r = m_values[r]; m_values_r *= val; if(m_values_r == eT(0)) { has_zero = true; } } } } if(has_zero) { const uword old_m_n_nonzero = m.n_nonzero; access::rw(m).remove_zeros(); if(m.n_nonzero != old_m_n_nonzero) { access::rw(n_nonzero) = n_nonzero - (old_m_n_nonzero - m.n_nonzero); } } return *this; } template inline const SpSubview& SpSubview::operator/=(const eT val) { arma_debug_sigprint(); arma_conform_check( (val == eT(0)), "element-wise division: division by zero" ); m.sync_csc(); m.invalidate_cache(); const uword lstart_row = aux_row1; const uword lend_row = aux_row1 + n_rows; const uword lstart_col = aux_col1; const uword lend_col = aux_col1 + n_cols; const uword* m_row_indices = m.row_indices; eT* m_values = access::rwp(m.values); bool has_zero = false; for(uword c = lstart_col; c < lend_col; ++c) { const uword r_start = m.col_ptrs[c ]; const uword r_end = m.col_ptrs[c + 1]; for(uword r = r_start; r < r_end; ++r) { const uword m_row_indices_r = m_row_indices[r]; if( (m_row_indices_r >= lstart_row) && (m_row_indices_r < lend_row) ) { eT& m_values_r = m_values[r]; m_values_r /= val; if(m_values_r == eT(0)) { has_zero = true; } } } } if(has_zero) { const uword old_m_n_nonzero = m.n_nonzero; access::rw(m).remove_zeros(); if(m.n_nonzero != old_m_n_nonzero) { access::rw(n_nonzero) = n_nonzero - (old_m_n_nonzero - m.n_nonzero); } } return *this; } template template inline const SpSubview& SpSubview::operator=(const Base& in) { arma_debug_sigprint(); if(is_same_type< T1, Gen, gen_zeros> >::yes) { const Proxy P(in.get_ref()); arma_conform_assert_same_size(n_rows, n_cols, P.get_n_rows(), P.get_n_cols(), "insertion into sparse submatrix"); (*this).zeros(); return *this; } if(is_same_type< T1, Gen, gen_eye> >::yes) { const Proxy P(in.get_ref()); arma_conform_assert_same_size(n_rows, n_cols, P.get_n_rows(), P.get_n_cols(), "insertion into sparse submatrix"); (*this).eye(); return *this; } const quasi_unwrap U(in.get_ref()); arma_conform_assert_same_size(n_rows, n_cols, U.M.n_rows, U.M.n_cols, "insertion into sparse submatrix"); spglue_merge::subview_merge(*this, U.M); return *this; } template template inline const SpSubview& SpSubview::operator+=(const Base& x) { arma_debug_sigprint(); return (*this).operator=( (*this) + x.get_ref() ); } template template inline const SpSubview& SpSubview::operator-=(const Base& x) { arma_debug_sigprint(); return (*this).operator=( (*this) - x.get_ref() ); } template template inline const SpSubview& SpSubview::operator*=(const Base& x) { arma_debug_sigprint(); SpMat tmp(*this); tmp *= x.get_ref(); return (*this).operator=(tmp); } template template inline const SpSubview& SpSubview::operator%=(const Base& x) { arma_debug_sigprint(); SpSubview& sv = (*this); const quasi_unwrap U(x.get_ref()); const Mat& B = U.M; arma_conform_assert_same_size(sv.n_rows, sv.n_cols, B.n_rows, B.n_cols, "element-wise multiplication"); SpMat& sv_m = access::rw(sv.m); sv_m.sync_csc(); sv_m.invalidate_cache(); const uword m_row_start = sv.aux_row1; const uword m_row_end = sv.aux_row1 + sv.n_rows - 1; const uword m_col_start = sv.aux_col1; const uword m_col_end = sv.aux_col1 + sv.n_cols - 1; constexpr eT zero = eT(0); bool has_zero = false; uword count = 0; for(uword m_col = m_col_start; m_col <= m_col_end; ++m_col) { const uword sv_col = m_col - m_col_start; const uword index_start = sv_m.col_ptrs[m_col ]; const uword index_end = sv_m.col_ptrs[m_col + 1]; for(uword i=index_start; i < index_end; ++i) { const uword m_row = sv_m.row_indices[i]; if(m_row < m_row_start) { continue; } if(m_row > m_row_end ) { break; } const uword sv_row = m_row - m_row_start; eT& m_val = access::rw(sv_m.values[i]); const eT result = m_val * B.at(sv_row, sv_col); m_val = result; if(result == zero) { has_zero = true; } else { ++count; } } } if(has_zero) { sv_m.remove_zeros(); } access::rw(sv.n_nonzero) = count; return (*this); } template template inline const SpSubview& SpSubview::operator/=(const Base& x) { arma_debug_sigprint(); const SpSubview& A = (*this); const quasi_unwrap U(x.get_ref()); const Mat& B = U.M; arma_conform_assert_same_size(A.n_rows, A.n_cols, B.n_rows, B.n_cols, "element-wise division"); bool result_ok = true; constexpr eT zero = eT(0); const uword B_n_rows = B.n_rows; const uword B_n_cols = B.n_cols; for(uword c=0; c < B_n_cols; ++c) { for(uword r=0; r < B_n_rows; ++r) { // a zero in B and A at the same location implies the division result is NaN; // hence a zero in A (not stored) needs to be changed into a non-zero // for efficiency, an element in B is checked before checking the corresponding element in A if((B.at(r,c) == zero) && (A.at(r,c) == zero)) { result_ok = false; break; } } if(result_ok == false) { break; } } if(result_ok) { const_iterator cit = A.begin(); const_iterator cit_end = A.end(); while(cit != cit_end) { const eT tmp = (*cit) / B.at(cit.row(), cit.col()); if(tmp == zero) { result_ok = false; break; } ++cit; } } if(result_ok) { iterator it = (*this).begin(); iterator it_end = (*this).end(); while(it != it_end) { (*it) /= B.at(it.row(), it.col()); ++it; } } else { (*this).operator=( (*this) / B ); } return (*this); } template inline const SpSubview& SpSubview::operator=(const SpSubview& x) { arma_debug_sigprint(); return (*this).operator_equ_common(x); } template template inline const SpSubview& SpSubview::operator=(const SpBase& x) { arma_debug_sigprint(); return (*this).operator_equ_common( x.get_ref() ); } template template inline const SpSubview& SpSubview::operator_equ_common(const SpBase& in) { arma_debug_sigprint(); const unwrap_spmat U(in.get_ref()); arma_conform_assert_same_size(n_rows, n_cols, U.M.n_rows, U.M.n_cols, "insertion into sparse submatrix"); if(U.is_alias(m)) { const SpMat tmp(U.M); spglue_merge::subview_merge(*this, tmp); } else { spglue_merge::subview_merge(*this, U.M); } return *this; } template template inline const SpSubview& SpSubview::operator+=(const SpBase& x) { arma_debug_sigprint(); // TODO: implement dedicated machinery return (*this).operator=( (*this) + x.get_ref() ); } template template inline const SpSubview& SpSubview::operator-=(const SpBase& x) { arma_debug_sigprint(); // TODO: implement dedicated machinery return (*this).operator=( (*this) - x.get_ref() ); } template template inline const SpSubview& SpSubview::operator*=(const SpBase& x) { arma_debug_sigprint(); return (*this).operator=( (*this) * x.get_ref() ); } template template inline const SpSubview& SpSubview::operator%=(const SpBase& x) { arma_debug_sigprint(); // TODO: implement dedicated machinery return (*this).operator=( (*this) % x.get_ref() ); } template template inline const SpSubview& SpSubview::operator/=(const SpBase& x) { arma_debug_sigprint(); // NOTE: use of this function is not advised; it is implemented only for completeness SpProxy p(x.get_ref()); arma_conform_assert_same_size(n_rows, n_cols, p.get_n_rows(), p.get_n_cols(), "element-wise division"); if(p.is_alias(m) == false) { for(uword lcol = 0; lcol < n_cols; ++lcol) for(uword lrow = 0; lrow < n_rows; ++lrow) { at(lrow,lcol) /= p.at(lrow,lcol); } } else { const SpMat tmp(p.Q); (*this).operator/=(tmp); } return *this; } //! apply a functor to each element template template inline void SpSubview::for_each(functor F) { arma_debug_sigprint(); m.sync_csc(); m.invalidate_cache(); const uword lstart_row = aux_row1; const uword lend_row = aux_row1 + n_rows; const uword lstart_col = aux_col1; const uword lend_col = aux_col1 + n_cols; const uword* m_row_indices = m.row_indices; eT* m_values = access::rwp(m.values); bool has_zero = false; for(uword c = lstart_col; c < lend_col; ++c) { const uword r_start = m.col_ptrs[c ]; const uword r_end = m.col_ptrs[c + 1]; for(uword r = r_start; r < r_end; ++r) { const uword m_row_indices_r = m_row_indices[r]; if( (m_row_indices_r >= lstart_row) && (m_row_indices_r < lend_row) ) { eT& m_values_r = m_values[r]; F(m_values_r); if(m_values_r == eT(0)) { has_zero = true; } } } } if(has_zero) { const uword old_m_n_nonzero = m.n_nonzero; access::rw(m).remove_zeros(); if(m.n_nonzero != old_m_n_nonzero) { access::rw(n_nonzero) = n_nonzero - (old_m_n_nonzero - m.n_nonzero); } } } template template inline void SpSubview::for_each(functor F) const { arma_debug_sigprint(); m.sync_csc(); const uword lstart_row = aux_row1; const uword lend_row = aux_row1 + n_rows; const uword lstart_col = aux_col1; const uword lend_col = aux_col1 + n_cols; const uword* m_row_indices = m.row_indices; for(uword c = lstart_col; c < lend_col; ++c) { const uword r_start = m.col_ptrs[c ]; const uword r_end = m.col_ptrs[c + 1]; for(uword r = r_start; r < r_end; ++r) { const uword m_row_indices_r = m_row_indices[r]; if( (m_row_indices_r >= lstart_row) && (m_row_indices_r < lend_row) ) { F(m.values[r]); } } } } //! transform each element using a functor template template inline void SpSubview::transform(functor F) { arma_debug_sigprint(); m.sync_csc(); m.invalidate_cache(); const uword lstart_row = aux_row1; const uword lend_row = aux_row1 + n_rows; const uword lstart_col = aux_col1; const uword lend_col = aux_col1 + n_cols; const uword* m_row_indices = m.row_indices; eT* m_values = access::rwp(m.values); bool has_zero = false; for(uword c = lstart_col; c < lend_col; ++c) { const uword r_start = m.col_ptrs[c ]; const uword r_end = m.col_ptrs[c + 1]; for(uword r = r_start; r < r_end; ++r) { const uword m_row_indices_r = m_row_indices[r]; if( (m_row_indices_r >= lstart_row) && (m_row_indices_r < lend_row) ) { eT& m_values_r = m_values[r]; m_values_r = eT( F(m_values_r) ); if(m_values_r == eT(0)) { has_zero = true; } } } } if(has_zero) { const uword old_m_n_nonzero = m.n_nonzero; access::rw(m).remove_zeros(); if(m.n_nonzero != old_m_n_nonzero) { access::rw(n_nonzero) = n_nonzero - (old_m_n_nonzero - m.n_nonzero); } } } template inline void SpSubview::replace(const eT old_val, const eT new_val) { arma_debug_sigprint(); if(old_val == eT(0)) { if(new_val != eT(0)) { Mat tmp(*this); tmp.replace(old_val, new_val); (*this).operator=(tmp); } return; } m.sync_csc(); m.invalidate_cache(); const uword lstart_row = aux_row1; const uword lend_row = aux_row1 + n_rows; const uword lstart_col = aux_col1; const uword lend_col = aux_col1 + n_cols; const uword* m_row_indices = m.row_indices; eT* m_values = access::rwp(m.values); if(arma_isnan(old_val)) { for(uword c = lstart_col; c < lend_col; ++c) { const uword r_start = m.col_ptrs[c ]; const uword r_end = m.col_ptrs[c + 1]; for(uword r = r_start; r < r_end; ++r) { const uword m_row_indices_r = m_row_indices[r]; if( (m_row_indices_r >= lstart_row) && (m_row_indices_r < lend_row) ) { eT& val = m_values[r]; val = (arma_isnan(val)) ? new_val : val; } } } } else { for(uword c = lstart_col; c < lend_col; ++c) { const uword r_start = m.col_ptrs[c ]; const uword r_end = m.col_ptrs[c + 1]; for(uword r = r_start; r < r_end; ++r) { const uword m_row_indices_r = m_row_indices[r]; if( (m_row_indices_r >= lstart_row) && (m_row_indices_r < lend_row) ) { eT& val = m_values[r]; val = (val == old_val) ? new_val : val; } } } } if(new_val == eT(0)) { access::rw(m).remove_zeros(); } } template inline void SpSubview::clean(const typename get_pod_type::result threshold) { arma_debug_sigprint(); if((n_elem == 0) || (n_nonzero == 0)) { return; } // TODO: replace with a more efficient implementation SpMat tmp(*this); tmp.clean(threshold); if(is_cx::yes) { (*this).operator=(tmp); } else if(tmp.n_nonzero != n_nonzero) { (*this).operator=(tmp); } } template inline void SpSubview::clamp(const eT min_val, const eT max_val) { arma_debug_sigprint(); if(is_cx::no) { arma_conform_check( (access::tmp_real(min_val) > access::tmp_real(max_val)), "SpSubview::clamp(): min_val must be less than max_val" ); } else { arma_conform_check( (access::tmp_real(min_val) > access::tmp_real(max_val)), "SpSubview::clamp(): real(min_val) must be less than real(max_val)" ); arma_conform_check( (access::tmp_imag(min_val) > access::tmp_imag(max_val)), "SpSubview::clamp(): imag(min_val) must be less than imag(max_val)" ); } if((n_elem == 0) || (n_nonzero == 0)) { return; } // TODO: replace with a more efficient implementation SpMat tmp(*this); tmp.clamp(min_val, max_val); (*this).operator=(tmp); } template inline void SpSubview::fill(const eT val) { arma_debug_sigprint(); if(val != eT(0)) { Mat tmp( (*this).n_rows, (*this).n_cols, arma_nozeros_indicator() ); tmp.fill(val); (*this).operator=(tmp); } else { (*this).zeros(); } } template inline void SpSubview::zeros() { arma_debug_sigprint(); if((n_elem == 0) || (n_nonzero == 0)) { return; } if((m.n_nonzero - n_nonzero) == 0) { access::rw(m).zeros(); access::rw(n_nonzero) = 0; return; } SpMat tmp(arma_reserve_indicator(), m.n_rows, m.n_cols, m.n_nonzero - n_nonzero); const uword sv_row_start = aux_row1; const uword sv_col_start = aux_col1; const uword sv_row_end = aux_row1 + n_rows - 1; const uword sv_col_end = aux_col1 + n_cols - 1; typename SpMat::const_iterator m_it = m.begin(); typename SpMat::const_iterator m_it_end = m.end(); uword tmp_count = 0; for(; m_it != m_it_end; ++m_it) { const uword m_it_row = m_it.row(); const uword m_it_col = m_it.col(); const bool inside_box = ((m_it_row >= sv_row_start) && (m_it_row <= sv_row_end)) && ((m_it_col >= sv_col_start) && (m_it_col <= sv_col_end)); if(inside_box == false) { access::rw(tmp.values[tmp_count]) = (*m_it); access::rw(tmp.row_indices[tmp_count]) = m_it_row; access::rw(tmp.col_ptrs[m_it_col + 1])++; ++tmp_count; } } for(uword i=0; i < tmp.n_cols; ++i) { access::rw(tmp.col_ptrs[i + 1]) += tmp.col_ptrs[i]; } access::rw(m).steal_mem(tmp); access::rw(n_nonzero) = 0; } template inline void SpSubview::ones() { arma_debug_sigprint(); (*this).fill(eT(1)); } template inline void SpSubview::eye() { arma_debug_sigprint(); SpMat tmp; tmp.eye( (*this).n_rows, (*this).n_cols ); (*this).operator=(tmp); } template inline void SpSubview::randu() { arma_debug_sigprint(); Mat tmp( (*this).n_rows, (*this).n_cols, fill::randu ); (*this).operator=(tmp); } template inline void SpSubview::randn() { arma_debug_sigprint(); Mat tmp( (*this).n_rows, (*this).n_cols, fill::randn ); (*this).operator=(tmp); } template inline SpSubview_MapMat_val SpSubview::operator[](const uword i) { const uword lrow = i % n_rows; const uword lcol = i / n_rows; return (*this).at(lrow, lcol); } template inline eT SpSubview::operator[](const uword i) const { const uword lrow = i % n_rows; const uword lcol = i / n_rows; return (*this).at(lrow, lcol); } template inline SpSubview_MapMat_val SpSubview::operator()(const uword i) { arma_conform_check_bounds( (i >= n_elem), "SpSubview::operator(): index out of bounds" ); const uword lrow = i % n_rows; const uword lcol = i / n_rows; return (*this).at(lrow, lcol); } template inline eT SpSubview::operator()(const uword i) const { arma_conform_check_bounds( (i >= n_elem), "SpSubview::operator(): index out of bounds" ); const uword lrow = i % n_rows; const uword lcol = i / n_rows; return (*this).at(lrow, lcol); } template inline SpSubview_MapMat_val SpSubview::operator()(const uword in_row, const uword in_col) { arma_conform_check_bounds( (in_row >= n_rows) || (in_col >= n_cols), "SpSubview::operator(): index out of bounds" ); return (*this).at(in_row, in_col); } template inline eT SpSubview::operator()(const uword in_row, const uword in_col) const { arma_conform_check_bounds( (in_row >= n_rows) || (in_col >= n_cols), "SpSubview::operator(): index out of bounds" ); return (*this).at(in_row, in_col); } template inline SpSubview_MapMat_val SpSubview::at(const uword i) { const uword lrow = i % n_rows; const uword lcol = i / n_cols; return (*this).at(lrow, lcol); } template inline eT SpSubview::at(const uword i) const { const uword lrow = i % n_rows; const uword lcol = i / n_cols; return (*this).at(lrow, lcol); } template inline SpSubview_MapMat_val SpSubview::at(const uword in_row, const uword in_col) { return SpSubview_MapMat_val((*this), m.cache, aux_row1 + in_row, aux_col1 + in_col); } template inline eT SpSubview::at(const uword in_row, const uword in_col) const { return m.at(aux_row1 + in_row, aux_col1 + in_col); } template inline bool SpSubview::check_overlap(const SpSubview& x) const { const SpSubview& t = *this; if(&t.m != &x.m) { return false; } else { if( (t.n_elem == 0) || (x.n_elem == 0) ) { return false; } else { const uword t_row_start = t.aux_row1; const uword t_row_end_p1 = t_row_start + t.n_rows; const uword t_col_start = t.aux_col1; const uword t_col_end_p1 = t_col_start + t.n_cols; const uword x_row_start = x.aux_row1; const uword x_row_end_p1 = x_row_start + x.n_rows; const uword x_col_start = x.aux_col1; const uword x_col_end_p1 = x_col_start + x.n_cols; const bool outside_rows = ( (x_row_start >= t_row_end_p1) || (t_row_start >= x_row_end_p1) ); const bool outside_cols = ( (x_col_start >= t_col_end_p1) || (t_col_start >= x_col_end_p1) ); return ( (outside_rows == false) && (outside_cols == false) ); } } } template inline bool SpSubview::is_vec() const { return ( (n_rows == 1) || (n_cols == 1) ); } template inline SpSubview_row SpSubview::row(const uword row_num) { arma_debug_sigprint(); arma_conform_check_bounds(row_num >= n_rows, "SpSubview::row(): out of bounds"); return SpSubview_row(const_cast< SpMat& >(m), row_num + aux_row1, aux_col1, n_cols); } template inline const SpSubview_row SpSubview::row(const uword row_num) const { arma_debug_sigprint(); arma_conform_check_bounds(row_num >= n_rows, "SpSubview::row(): out of bounds"); return SpSubview_row(m, row_num + aux_row1, aux_col1, n_cols); } template inline SpSubview_col SpSubview::col(const uword col_num) { arma_debug_sigprint(); arma_conform_check_bounds(col_num >= n_cols, "SpSubview::col(): out of bounds"); return SpSubview_col(const_cast< SpMat& >(m), col_num + aux_col1, aux_row1, n_rows); } template inline const SpSubview_col SpSubview::col(const uword col_num) const { arma_debug_sigprint(); arma_conform_check_bounds(col_num >= n_cols, "SpSubview::col(): out of bounds"); return SpSubview_col(m, col_num + aux_col1, aux_row1, n_rows); } template inline SpSubview SpSubview::rows(const uword in_row1, const uword in_row2) { arma_debug_sigprint(); arma_conform_check_bounds ( (in_row1 > in_row2) || (in_row2 >= n_rows), "SpSubview::rows(): indices out of bounds or incorrectly used" ); return submat(in_row1, 0, in_row2, n_cols - 1); } template inline const SpSubview SpSubview::rows(const uword in_row1, const uword in_row2) const { arma_debug_sigprint(); arma_conform_check_bounds ( (in_row1 > in_row2) || (in_row2 >= n_rows), "SpSubview::rows(): indices out of bounds or incorrectly used" ); return submat(in_row1, 0, in_row2, n_cols - 1); } template inline SpSubview SpSubview::cols(const uword in_col1, const uword in_col2) { arma_debug_sigprint(); arma_conform_check_bounds ( (in_col1 > in_col2) || (in_col2 >= n_cols), "SpSubview::cols(): indices out of bounds or incorrectly used" ); return submat(0, in_col1, n_rows - 1, in_col2); } template inline const SpSubview SpSubview::cols(const uword in_col1, const uword in_col2) const { arma_debug_sigprint(); arma_conform_check_bounds ( (in_col1 > in_col2) || (in_col2 >= n_cols), "SpSubview::cols(): indices out of bounds or incorrectly used" ); return submat(0, in_col1, n_rows - 1, in_col2); } template inline SpSubview SpSubview::submat(const uword in_row1, const uword in_col1, const uword in_row2, const uword in_col2) { arma_debug_sigprint(); arma_conform_check_bounds ( (in_row1 > in_row2) || (in_col1 > in_col2) || (in_row2 >= n_rows) || (in_col2 >= n_cols), "SpSubview::submat(): indices out of bounds or incorrectly used" ); return access::rw(m).submat(in_row1 + aux_row1, in_col1 + aux_col1, in_row2 + aux_row1, in_col2 + aux_col1); } template inline const SpSubview SpSubview::submat(const uword in_row1, const uword in_col1, const uword in_row2, const uword in_col2) const { arma_debug_sigprint(); arma_conform_check_bounds ( (in_row1 > in_row2) || (in_col1 > in_col2) || (in_row2 >= n_rows) || (in_col2 >= n_cols), "SpSubview::submat(): indices out of bounds or incorrectly used" ); return m.submat(in_row1 + aux_row1, in_col1 + aux_col1, in_row2 + aux_row1, in_col2 + aux_col1); } template inline SpSubview SpSubview::submat(const span& row_span, const span& col_span) { arma_debug_sigprint(); const bool row_all = row_span.whole; const bool col_all = row_span.whole; const uword in_row1 = row_all ? 0 : row_span.a; const uword in_row2 = row_all ? n_rows : row_span.b; const uword in_col1 = col_all ? 0 : col_span.a; const uword in_col2 = col_all ? n_cols : col_span.b; arma_conform_check_bounds ( ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= n_rows))) || ( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= n_cols))), "SpSubview::submat(): indices out of bounds or incorrectly used" ); return submat(in_row1, in_col1, in_row2, in_col2); } template inline const SpSubview SpSubview::submat(const span& row_span, const span& col_span) const { arma_debug_sigprint(); const bool row_all = row_span.whole; const bool col_all = row_span.whole; const uword in_row1 = row_all ? 0 : row_span.a; const uword in_row2 = row_all ? n_rows - 1 : row_span.b; const uword in_col1 = col_all ? 0 : col_span.a; const uword in_col2 = col_all ? n_cols - 1 : col_span.b; arma_conform_check_bounds ( ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= n_rows))) || ( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= n_cols))), "SpSubview::submat(): indices out of bounds or incorrectly used" ); return submat(in_row1, in_col1, in_row2, in_col2); } template inline SpSubview SpSubview::operator()(const uword row_num, const span& col_span) { arma_debug_sigprint(); return submat(span(row_num, row_num), col_span); } template inline const SpSubview SpSubview::operator()(const uword row_num, const span& col_span) const { arma_debug_sigprint(); return submat(span(row_num, row_num), col_span); } template inline SpSubview SpSubview::operator()(const span& row_span, const uword col_num) { arma_debug_sigprint(); return submat(row_span, span(col_num, col_num)); } template inline const SpSubview SpSubview::operator()(const span& row_span, const uword col_num) const { arma_debug_sigprint(); return submat(row_span, span(col_num, col_num)); } template inline SpSubview SpSubview::operator()(const span& row_span, const span& col_span) { arma_debug_sigprint(); return submat(row_span, col_span); } template inline const SpSubview SpSubview::operator()(const span& row_span, const span& col_span) const { arma_debug_sigprint(); return submat(row_span, col_span); } template inline void SpSubview::swap_rows(const uword in_row1, const uword in_row2) { arma_debug_sigprint(); arma_conform_check((in_row1 >= n_rows) || (in_row2 >= n_rows), "SpSubview::swap_rows(): invalid row index"); const uword lstart_col = aux_col1; const uword lend_col = aux_col1 + n_cols; for(uword c = lstart_col; c < lend_col; ++c) { const eT val = access::rw(m).at(in_row1 + aux_row1, c); access::rw(m).at(in_row2 + aux_row1, c) = eT( access::rw(m).at(in_row1 + aux_row1, c) ); access::rw(m).at(in_row1 + aux_row1, c) = val; } } template inline void SpSubview::swap_cols(const uword in_col1, const uword in_col2) { arma_debug_sigprint(); arma_conform_check((in_col1 >= n_cols) || (in_col2 >= n_cols), "SpSubview::swap_cols(): invalid column index"); const uword lstart_row = aux_row1; const uword lend_row = aux_row1 + n_rows; for(uword r = lstart_row; r < lend_row; ++r) { const eT val = access::rw(m).at(r, in_col1 + aux_col1); access::rw(m).at(r, in_col1 + aux_col1) = eT( access::rw(m).at(r, in_col2 + aux_col1) ); access::rw(m).at(r, in_col2 + aux_col1) = val; } } template inline typename SpSubview::iterator SpSubview::begin() { m.sync_csc(); return iterator(*this); } template inline typename SpSubview::const_iterator SpSubview::begin() const { m.sync_csc(); return const_iterator(*this); } template inline typename SpSubview::const_iterator SpSubview::cbegin() const { m.sync_csc(); return const_iterator(*this); } template inline typename SpSubview::iterator SpSubview::begin_col(const uword col_num) { m.sync_csc(); return iterator(*this, 0, col_num); } template inline typename SpSubview::const_iterator SpSubview::begin_col(const uword col_num) const { m.sync_csc(); return const_iterator(*this, 0, col_num); } template inline typename SpSubview::row_iterator SpSubview::begin_row(const uword row_num) { m.sync_csc(); return row_iterator(*this, row_num, 0); } template inline typename SpSubview::const_row_iterator SpSubview::begin_row(const uword row_num) const { m.sync_csc(); return const_row_iterator(*this, row_num, 0); } template inline typename SpSubview::iterator SpSubview::end() { m.sync_csc(); return iterator(*this, 0, n_cols, n_nonzero, m.n_nonzero - n_nonzero); } template inline typename SpSubview::const_iterator SpSubview::end() const { m.sync_csc(); return const_iterator(*this, 0, n_cols, n_nonzero, m.n_nonzero - n_nonzero); } template inline typename SpSubview::const_iterator SpSubview::cend() const { m.sync_csc(); return const_iterator(*this, 0, n_cols, n_nonzero, m.n_nonzero - n_nonzero); } template inline typename SpSubview::row_iterator SpSubview::end_row() { m.sync_csc(); return row_iterator(*this, n_nonzero); } template inline typename SpSubview::const_row_iterator SpSubview::end_row() const { m.sync_csc(); return const_row_iterator(*this, n_nonzero); } template inline typename SpSubview::row_iterator SpSubview::end_row(const uword row_num) { m.sync_csc(); return row_iterator(*this, row_num + 1, 0); } template inline typename SpSubview::const_row_iterator SpSubview::end_row(const uword row_num) const { m.sync_csc(); return const_row_iterator(*this, row_num + 1, 0); } template arma_inline bool SpSubview::is_alias(const SpMat& X) const { return m.is_alias(X); } template inline eT& SpSubview::insert_element(const uword in_row, const uword in_col, const eT in_val) { arma_debug_sigprint(); // This may not actually insert an element. const uword old_n_nonzero = m.n_nonzero; eT& retval = access::rw(m).insert_element(in_row + aux_row1, in_col + aux_col1, in_val); // Update n_nonzero (if necessary). access::rw(n_nonzero) += (m.n_nonzero - old_n_nonzero); return retval; } template inline void SpSubview::delete_element(const uword in_row, const uword in_col) { arma_debug_sigprint(); // This may not actually delete an element. const uword old_n_nonzero = m.n_nonzero; access::rw(m).delete_element(in_row + aux_row1, in_col + aux_col1); access::rw(n_nonzero) -= (old_n_nonzero - m.n_nonzero); } template inline void SpSubview::invalidate_cache() const { arma_debug_sigprint(); m.invalidate_cache(); } // // // template inline SpSubview_col::SpSubview_col(const SpMat& in_m, const uword in_col) : SpSubview(in_m, 0, in_col, in_m.n_rows, 1) { arma_debug_sigprint(); } template inline SpSubview_col::SpSubview_col(const SpMat& in_m, const uword in_col, const uword in_row1, const uword in_n_rows) : SpSubview(in_m, in_row1, in_col, in_n_rows, 1) { arma_debug_sigprint(); } template inline void SpSubview_col::operator=(const SpSubview& x) { arma_debug_sigprint(); SpSubview::operator=(x); } template inline void SpSubview_col::operator=(const SpSubview_col& x) { arma_debug_sigprint(); SpSubview::operator=(x); // interprets 'SpSubview_col' as 'SpSubview' } template template inline void SpSubview_col::operator=(const SpBase& x) { arma_debug_sigprint(); SpSubview::operator=(x); } template template inline void SpSubview_col::operator=(const Base& x) { arma_debug_sigprint(); SpSubview::operator=(x); } template inline const SpOp,spop_htrans> SpSubview_col::t() const { return SpOp,spop_htrans>(*this); } template inline const SpOp,spop_htrans> SpSubview_col::ht() const { return SpOp,spop_htrans>(*this); } template inline const SpOp,spop_strans> SpSubview_col::st() const { return SpOp,spop_strans>(*this); } template inline const SpToDOp,op_sp_as_dense> SpSubview_col::as_dense() const { return SpToDOp,op_sp_as_dense>(*this); } // // // template inline SpSubview_row::SpSubview_row(const SpMat& in_m, const uword in_row) : SpSubview(in_m, in_row, 0, 1, in_m.n_cols) { arma_debug_sigprint(); } template inline SpSubview_row::SpSubview_row(const SpMat& in_m, const uword in_row, const uword in_col1, const uword in_n_cols) : SpSubview(in_m, in_row, in_col1, 1, in_n_cols) { arma_debug_sigprint(); } template inline void SpSubview_row::operator=(const SpSubview& x) { arma_debug_sigprint(); SpSubview::operator=(x); } template inline void SpSubview_row::operator=(const SpSubview_row& x) { arma_debug_sigprint(); SpSubview::operator=(x); // interprets 'SpSubview_row' as 'SpSubview' } template template inline void SpSubview_row::operator=(const SpBase& x) { arma_debug_sigprint(); SpSubview::operator=(x); } template template inline void SpSubview_row::operator=(const Base& x) { arma_debug_sigprint(); SpSubview::operator=(x); } template inline const SpOp,spop_htrans> SpSubview_row::t() const { return SpOp,spop_htrans>(*this); } template inline const SpOp,spop_htrans> SpSubview_row::ht() const { return SpOp,spop_htrans>(*this); } template inline const SpOp,spop_strans> SpSubview_row::st() const { return SpOp,spop_strans>(*this); } template inline const SpToDOp,op_sp_as_dense> SpSubview_row::as_dense() const { return SpToDOp,op_sp_as_dense>(*this); } //! @} RcppArmadillo/inst/include/armadillo_bits/glue_times_bones.hpp0000644000176200001440000001236714301267043024435 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup glue_times //! @{ //! \brief //! Template metaprogram depth_lhs //! calculates the number of Glue instances on the left hand side argument of Glue //! ie. it recursively expands each Tx, until the type of Tx is not "Glue<..,.., glue_type>" (i.e the "glue_type" changes) template struct depth_lhs { static constexpr uword num = 0; }; template struct depth_lhs< glue_type, Glue > { static constexpr uword num = 1 + depth_lhs::num; }; template struct glue_times_redirect2_helper { template arma_hot inline static void apply(Mat& out, const Glue& X); }; template<> struct glue_times_redirect2_helper { template arma_hot inline static void apply(Mat& out, const Glue& X); }; template struct glue_times_redirect3_helper { template arma_hot inline static void apply(Mat& out, const Glue< Glue,T3,glue_times>& X); }; template<> struct glue_times_redirect3_helper { template arma_hot inline static void apply(Mat& out, const Glue< Glue,T3,glue_times>& X); }; template struct glue_times_redirect { template arma_hot inline static void apply(Mat& out, const Glue& X); }; template<> struct glue_times_redirect<2> { template arma_hot inline static void apply(Mat& out, const Glue& X); }; template<> struct glue_times_redirect<3> { template arma_hot inline static void apply(Mat& out, const Glue< Glue,T3,glue_times>& X); }; template<> struct glue_times_redirect<4> { template arma_hot inline static void apply(Mat& out, const Glue< Glue< Glue, T3, glue_times>, T4, glue_times>& X); }; //! Class which implements the immediate multiplication of two or more matrices class glue_times { public: template struct traits { static constexpr bool is_row = T1::is_row; static constexpr bool is_col = T2::is_col; static constexpr bool is_xvec = false; }; template arma_hot inline static void apply(Mat& out, const Glue& X); template arma_hot inline static void apply_inplace(Mat& out, const T1& X); template arma_hot inline static void apply_inplace_plus(Mat& out, const Glue& X, const sword sign); // template arma_inline static uword mul_storage_cost(const TA& A, const TB& B); template arma_hot inline static void apply(Mat& out, const TA& A, const TB& B, const eT val); template arma_hot inline static void apply(Mat& out, const TA& A, const TB& B, const TC& C, const eT val); template arma_hot inline static void apply(Mat& out, const TA& A, const TB& B, const TC& C, const TD& D, const eT val); }; class glue_times_diag { public: template struct traits { static constexpr bool is_row = T1::is_row; static constexpr bool is_col = T2::is_col; static constexpr bool is_xvec = false; }; template arma_hot inline static void apply(Mat& out, const Glue& X); }; //! @} RcppArmadillo/inst/include/armadillo_bits/glue_join_bones.hpp0000644000176200001440000000552714301267043024253 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup glue_join //! @{ class glue_join_cols { public: template struct traits { static constexpr bool is_row = false; static constexpr bool is_col = (T1::is_col && T2::is_col); static constexpr bool is_xvec = false; }; template inline static void apply(Mat& out, const Glue& X); template inline static void apply_noalias(Mat& out, const Proxy& A, const Proxy& B); template inline static void apply(Mat& out, const Base& A, const Base& B, const Base& C); template inline static void apply(Mat& out, const Base& A, const Base& B, const Base& C, const Base& D); }; class glue_join_rows { public: template struct traits { static constexpr bool is_row = (T1::is_row && T2::is_row); static constexpr bool is_col = false; static constexpr bool is_xvec = false; }; template inline static void apply(Mat& out, const Glue& X); template inline static void apply_noalias(Mat& out, const Proxy& A, const Proxy& B); template inline static void apply(Mat& out, const Base& A, const Base& B, const Base& C); template inline static void apply(Mat& out, const Base& A, const Base& B, const Base& C, const Base& D); }; class glue_join_slices { public: template inline static void apply(Cube& out, const GlueCube& X); }; //! @} RcppArmadillo/inst/include/armadillo_bits/glue_quantile_meat.hpp0000644000176200001440000001345414631567470024771 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup glue_quantile //! @{ template inline void glue_quantile::worker(eTb* out_mem, Col& Y, const Mat& P) { arma_debug_sigprint(); // NOTE: assuming out_mem is an array with P.n_elem elements // TODO: ignore non-finite values ? // algorithm based on "Definition 5" in: // Rob J. Hyndman and Yanan Fan. // Sample Quantiles in Statistical Packages. // The American Statistician, Vol. 50, No. 4, pp. 361-365, 1996. // http://doi.org/10.2307/2684934 const eTb* P_mem = P.memptr(); const uword P_n_elem = P.n_elem; const eTb alpha = 0.5; const eTb N = eTb(Y.n_elem); const eTb P_min = (eTb(1) - alpha) / N; const eTb P_max = (N - alpha) / N; for(uword i=0; i < P_n_elem; ++i) { const eTb P_i = P_mem[i]; eTb out_val = eTb(0); if(P_i < P_min) { out_val = (P_i < eTb(0)) ? eTb(-std::numeric_limits::infinity()) : eTb(Y.min()); } else if(P_i > P_max) { out_val = (P_i > eTb(1)) ? eTb( std::numeric_limits::infinity()) : eTb(Y.max()); } else { const uword k = uword(std::floor(N * P_i + alpha)); const eTb P_k = (eTb(k) - alpha) / N; const eTb w = (P_i - P_k) * N; eTa* Y_k_ptr = Y.begin() + uword(k); std::nth_element( Y.begin(), Y_k_ptr, Y.end() ); const eTa Y_k_val = (*Y_k_ptr); eTa* Y_km1_ptr = Y.begin() + uword(k-1); // std::nth_element( Y.begin(), Y_km1_ptr, Y.end() ); std::nth_element( Y.begin(), Y_km1_ptr, Y_k_ptr ); const eTa Y_km1_val = (*Y_km1_ptr); out_val = ((eTb(1) - w) * Y_km1_val) + (w * Y_k_val); } out_mem[i] = out_val; } } template inline void glue_quantile::apply_noalias(Mat& out, const Mat& X, const Mat& P, const uword dim) { arma_debug_sigprint(); arma_conform_check( ((P.is_vec() == false) && (P.is_empty() == false)), "quantile(): parameter 'P' must be a vector" ); if(X.is_empty()) { out.reset(); return; } const uword X_n_rows = X.n_rows; const uword X_n_cols = X.n_cols; const uword P_n_elem = P.n_elem; if(dim == 0) { out.set_size(P_n_elem, X_n_cols); if(out.is_empty()) { return; } Col Y(X_n_rows, arma_nozeros_indicator()); if(X_n_cols == 1) { arrayops::copy(Y.memptr(), X.memptr(), X_n_rows); glue_quantile::worker(out.memptr(), Y, P); } else { for(uword col=0; col < X_n_cols; ++col) { arrayops::copy(Y.memptr(), X.colptr(col), X_n_rows); glue_quantile::worker(out.colptr(col), Y, P); } } } else if(dim == 1) { out.set_size(X_n_rows, P_n_elem); if(out.is_empty()) { return; } Col Y(X_n_cols, arma_nozeros_indicator()); if(X_n_rows == 1) { arrayops::copy(Y.memptr(), X.memptr(), X_n_cols); glue_quantile::worker(out.memptr(), Y, P); } else { Col tmp(P_n_elem, arma_nozeros_indicator()); eTb* tmp_mem = tmp.memptr(); for(uword row=0; row < X_n_rows; ++row) { eTa* Y_mem = Y.memptr(); for(uword col=0; col < X_n_cols; ++col) { Y_mem[col] = X.at(row,col); } glue_quantile::worker(tmp_mem, Y, P); for(uword i=0; i < P_n_elem; ++i) { out.at(row,i) = tmp_mem[i]; } } } } } template inline void glue_quantile::apply(Mat& out, const mtGlue& expr) { arma_debug_sigprint(); typedef typename T2::elem_type eTb; const uword dim = expr.aux_uword; arma_conform_check( (dim > 1), "quantile(): parameter 'dim' must be 0 or 1" ); const quasi_unwrap UA(expr.A); const quasi_unwrap UB(expr.B); arma_conform_check((UA.M.internal_has_nan() || UB.M.internal_has_nan()), "quantile(): detected NaN"); if(UA.is_alias(out) || UB.is_alias(out)) { Mat tmp; glue_quantile::apply_noalias(tmp, UA.M, UB.M, dim); out.steal_mem(tmp); } else { glue_quantile::apply_noalias(out, UA.M, UB.M, dim); } } template inline void glue_quantile_default::apply(Mat& out, const mtGlue& expr) { arma_debug_sigprint(); typedef typename T2::elem_type eTb; const quasi_unwrap UA(expr.A); const quasi_unwrap UB(expr.B); const uword dim = (T1::is_xvec) ? uword(UA.M.is_rowvec() ? 1 : 0) : uword((T1::is_row) ? 1 : 0); arma_conform_check((UA.M.internal_has_nan() || UB.M.internal_has_nan()), "quantile(): detected NaN"); if(UA.is_alias(out) || UB.is_alias(out)) { Mat tmp; glue_quantile::apply_noalias(tmp, UA.M, UB.M, dim); out.steal_mem(tmp); } else { glue_quantile::apply_noalias(out, UA.M, UB.M, dim); } } //! @} RcppArmadillo/inst/include/armadillo_bits/op_princomp_bones.hpp0000644000176200001440000000405214301267043024615 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_princomp //! @{ class op_princomp : public traits_op_default { public: template inline static bool direct_princomp ( Mat& coeff_out, Mat& score_out, Col& latent_out, Col& tsquared_out, const Base& X ); template inline static bool direct_princomp ( Mat& coeff_out, Mat& score_out, Col& latent_out, const Base& X ); template inline static bool direct_princomp ( Mat& coeff_out, Mat& score_out, const Base& X ); template inline static bool direct_princomp ( Mat& coeff_out, const Base& X ); template inline static void apply(Mat& out, const Op& in); }; //! @} RcppArmadillo/inst/include/armadillo_bits/GenCube_meat.hpp0000644000176200001440000001113614770765377023450 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup GenCube //! @{ template arma_inline GenCube::GenCube(const uword in_n_rows, const uword in_n_cols, const uword in_n_slices) : n_rows (in_n_rows ) , n_cols (in_n_cols ) , n_slices(in_n_slices) { arma_debug_sigprint(); } template arma_inline GenCube::~GenCube() { arma_debug_sigprint(); } template arma_inline eT GenCube::operator[](const uword) const { if(is_same_type::yes) { return eT(0); } else if(is_same_type::yes) { return eT(1); } return eT(0); // prevent pedantic compiler warnings } template arma_inline eT GenCube::at(const uword, const uword, const uword) const { if(is_same_type::yes) { return eT(0); } else if(is_same_type::yes) { return eT(1); } return eT(0); // prevent pedantic compiler warnings } template arma_inline eT GenCube::at_alt(const uword) const { if(is_same_type::yes) { return eT(0); } else if(is_same_type::yes) { return eT(1); } return eT(0); // prevent pedantic compiler warnings } template inline void GenCube::apply(Cube& out) const { arma_debug_sigprint(); // NOTE: we're assuming that the cube has already been set to the correct size; // this is done by either the Cube constructor or operator=() if(is_same_type::yes) { out.zeros(); } else if(is_same_type::yes) { out.ones(); } } template inline void GenCube::apply_inplace_plus(Cube& out) const { arma_debug_sigprint(); arma_conform_assert_same_size(out.n_rows, out.n_cols, out.n_slices, n_rows, n_cols, n_slices, "addition"); if(is_same_type::yes) { arrayops::inplace_plus(out.memptr(), eT(1), out.n_elem); } } template inline void GenCube::apply_inplace_minus(Cube& out) const { arma_debug_sigprint(); arma_conform_assert_same_size(out.n_rows, out.n_cols, out.n_slices, n_rows, n_cols, n_slices, "subtraction"); if(is_same_type::yes) { arrayops::inplace_minus(out.memptr(), eT(1), out.n_elem); } } template inline void GenCube::apply_inplace_schur(Cube& out) const { arma_debug_sigprint(); arma_conform_assert_same_size(out.n_rows, out.n_cols, out.n_slices, n_rows, n_cols, n_slices, "element-wise multiplication"); if(is_same_type::yes) { arrayops::inplace_mul(out.memptr(), eT(0), out.n_elem); // NOTE: not using arrayops::fill_zeros(), as 'out' may have NaN elements } } template inline void GenCube::apply_inplace_div(Cube& out) const { arma_debug_sigprint(); arma_conform_assert_same_size(out.n_rows, out.n_cols, out.n_slices, n_rows, n_cols, n_slices, "element-wise division"); if(is_same_type::yes) { arrayops::inplace_div(out.memptr(), eT(0), out.n_elem); } } template inline void GenCube::apply(subview_cube& out) const { arma_debug_sigprint(); // NOTE: we're assuming that the subcube has the same dimensions as the GenCube object // this is checked by subview_cube::operator=() if(is_same_type::yes) { out.zeros(); } else if(is_same_type::yes) { out.ones(); } } //! @} RcppArmadillo/inst/include/armadillo_bits/SpSubview_iterators_meat.hpp0000644000176200001440000007631615013306507026147 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup SpSubview //! @{ /////////////////////////////////////////////////////////////////////////////// // SpSubview::iterator_base implementation // /////////////////////////////////////////////////////////////////////////////// template inline SpSubview::iterator_base::iterator_base(const SpSubview& in_M) : M(&in_M) , internal_col(0) , internal_pos(0) { // Technically this iterator is invalid (it may not point to a valid element) } template inline SpSubview::iterator_base::iterator_base(const SpSubview& in_M, const uword in_col, const uword in_pos) : M(&in_M) , internal_col(in_col) , internal_pos(in_pos) { // Nothing to do. } /////////////////////////////////////////////////////////////////////////////// // SpSubview::const_iterator implementation // /////////////////////////////////////////////////////////////////////////////// template inline SpSubview::const_iterator::const_iterator(const SpSubview& in_M, const uword initial_pos) : iterator_base(in_M, 0, initial_pos) { // Corner case for empty subviews. if(in_M.n_nonzero == 0) { iterator_base::internal_col = in_M.n_cols; skip_pos = in_M.m.n_nonzero; return; } // Figure out the row and column of the position. // lskip_pos holds the number of values which aren't part of this subview. const uword aux_col = iterator_base::M->aux_col1; const uword aux_row = iterator_base::M->aux_row1; const uword ln_rows = iterator_base::M->n_rows; const uword ln_cols = iterator_base::M->n_cols; uword cur_pos = 0; // off by one because we might be searching for pos 0 uword lskip_pos = iterator_base::M->m.col_ptrs[aux_col]; uword cur_col = 0; while(cur_pos < (iterator_base::internal_pos + 1)) { // Have we stepped forward a column (or multiple columns)? while(((lskip_pos + cur_pos) >= iterator_base::M->m.col_ptrs[cur_col + aux_col + 1]) && (cur_col < ln_cols)) { ++cur_col; } // See if the current position is in the subview. const uword row_index = iterator_base::M->m.row_indices[cur_pos + lskip_pos]; if(row_index < aux_row) { ++lskip_pos; // not valid } else if(row_index < (aux_row + ln_rows)) { ++cur_pos; // valid, in the subview } else { // skip to end of column const uword next_colptr = iterator_base::M->m.col_ptrs[cur_col + aux_col + 1]; lskip_pos += (next_colptr - (cur_pos + lskip_pos)); } } iterator_base::internal_col = cur_col; skip_pos = lskip_pos; } template inline SpSubview::const_iterator::const_iterator(const SpSubview& in_M, const uword in_row, const uword in_col) : iterator_base(in_M, in_col, 0) { // Corner case for empty subviews. if(in_M.n_nonzero == 0) { // We must be at the last position. iterator_base::internal_col = in_M.n_cols; skip_pos = in_M.m.n_nonzero; return; } // We have a destination we want to be just after, but don't know what position that is. // Because we have to count the points in this subview and not in this subview, this becomes a little difficult and slow. const uword aux_col = iterator_base::M->aux_col1; const uword aux_row = iterator_base::M->aux_row1; const uword ln_rows = iterator_base::M->n_rows; const uword ln_cols = iterator_base::M->n_cols; uword cur_pos = 0; skip_pos = iterator_base::M->m.col_ptrs[aux_col]; uword cur_col = 0; // Skip any empty columns. while(((skip_pos + cur_pos) >= iterator_base::M->m.col_ptrs[cur_col + aux_col + 1]) && (cur_col < ln_cols)) { ++cur_col; } while(cur_col < in_col) { // See if the current position is in the subview. const uword row_index = iterator_base::M->m.row_indices[cur_pos + skip_pos]; if(row_index < aux_row) { ++skip_pos; } else if(row_index < (aux_row + ln_rows)) { ++cur_pos; } else { // skip to end of column const uword next_colptr = iterator_base::M->m.col_ptrs[cur_col + aux_col + 1]; skip_pos += (next_colptr - (cur_pos + skip_pos)); } // Have we stepped forward a column (or multiple columns)? while(((skip_pos + cur_pos) >= iterator_base::M->m.col_ptrs[cur_col + aux_col + 1]) && (cur_col < ln_cols)) { ++cur_col; } } // Now we are either on the right column or ahead of it. if(cur_col == in_col) { // We have to find the right row index. uword row_index = iterator_base::M->m.row_indices[cur_pos + skip_pos]; while((row_index < (in_row + aux_row))) { if(row_index < aux_row) { ++skip_pos; } else { ++cur_pos; } // Ensure we didn't step forward a column; if we did, we need to stop. while(((skip_pos + cur_pos) >= iterator_base::M->m.col_ptrs[cur_col + aux_col + 1]) && (cur_col < ln_cols)) { ++cur_col; } if(cur_col != in_col) { break; } row_index = iterator_base::M->m.row_indices[cur_pos + skip_pos]; } } // Now we need to find the next valid position in the subview. uword row_index; while(true) { const uword next_colptr = iterator_base::M->m.col_ptrs[cur_col + aux_col + 1]; row_index = iterator_base::M->m.row_indices[cur_pos + skip_pos]; // Are we at the last position? if(cur_col >= ln_cols) { cur_col = ln_cols; // Make sure we will be pointing at the last element in the parent matrix. skip_pos = iterator_base::M->m.n_nonzero - iterator_base::M->n_nonzero; break; } if(row_index < aux_row) { ++skip_pos; } else if(row_index < (aux_row + ln_rows)) { break; // found } else { skip_pos += (next_colptr - (cur_pos + skip_pos)); } // Did we move any columns? while(((skip_pos + cur_pos) >= iterator_base::M->m.col_ptrs[cur_col + aux_col + 1]) && (cur_col < ln_cols)) { ++cur_col; } } // It is possible we have moved another column. while(((skip_pos + cur_pos) >= iterator_base::M->m.col_ptrs[cur_col + aux_col + 1]) && (cur_col < ln_cols)) { ++cur_col; } iterator_base::internal_pos = cur_pos; iterator_base::internal_col = cur_col; } template inline SpSubview::const_iterator::const_iterator(const SpSubview& in_M, uword in_row, uword in_col, uword in_pos, uword in_skip_pos) : iterator_base(in_M, in_col, in_pos) , skip_pos(in_skip_pos) { arma_ignore(in_row); // Nothing to do. } template inline SpSubview::const_iterator::const_iterator(const const_iterator& other) : iterator_base(*other.M, other.internal_col, other.internal_pos) , skip_pos(other.skip_pos) { // Nothing to do. } template arma_inline eT SpSubview::const_iterator::operator*() const { return iterator_base::M->m.values[iterator_base::internal_pos + skip_pos]; } template inline typename SpSubview::const_iterator& SpSubview::const_iterator::operator++() { const uword aux_col = iterator_base::M->aux_col1; const uword aux_row = iterator_base::M->aux_row1; const uword ln_rows = iterator_base::M->n_rows; const uword ln_cols = iterator_base::M->n_cols; uword cur_col = iterator_base::internal_col; uword cur_pos = iterator_base::internal_pos + 1; uword lskip_pos = skip_pos; uword row_index; while(true) { const uword next_colptr = iterator_base::M->m.col_ptrs[cur_col + aux_col + 1]; row_index = iterator_base::M->m.row_indices[cur_pos + lskip_pos]; // Did we move any columns? while((cur_col < ln_cols) && ((lskip_pos + cur_pos) >= iterator_base::M->m.col_ptrs[cur_col + aux_col + 1])) { ++cur_col; } // Are we at the last position? if(cur_col >= ln_cols) { cur_col = ln_cols; // Make sure we will be pointing at the last element in the parent matrix. lskip_pos = iterator_base::M->m.n_nonzero - iterator_base::M->n_nonzero; break; } if(row_index < aux_row) { ++lskip_pos; } else if(row_index < (aux_row + ln_rows)) { break; // found } else { lskip_pos += (next_colptr - (cur_pos + lskip_pos)); } } iterator_base::internal_pos = cur_pos; iterator_base::internal_col = cur_col; skip_pos = lskip_pos; return *this; } template inline typename SpSubview::const_iterator SpSubview::const_iterator::operator++(int) { typename SpSubview::const_iterator tmp(*this); ++(*this); return tmp; } template inline typename SpSubview::const_iterator& SpSubview::const_iterator::operator--() { const uword aux_col = iterator_base::M->aux_col1; const uword aux_row = iterator_base::M->aux_row1; const uword ln_rows = iterator_base::M->n_rows; uword cur_col = iterator_base::internal_col; uword cur_pos = iterator_base::internal_pos - 1; // Special condition for end of iterator. if((skip_pos + cur_pos + 1) == iterator_base::M->m.n_nonzero) { // We are at the last element. So we need to set skip_pos back to what it // would be if we didn't manually modify it back in operator++(). skip_pos = iterator_base::M->m.col_ptrs[cur_col + aux_col] - iterator_base::internal_pos; } uword row_index; while(true) { const uword colptr = iterator_base::M->m.col_ptrs[cur_col + aux_col]; row_index = iterator_base::M->m.row_indices[cur_pos + skip_pos]; // Did we move back any columns? while((skip_pos + cur_pos) < iterator_base::M->m.col_ptrs[cur_col + aux_col]) { --cur_col; } if(row_index < aux_row) { skip_pos -= (colptr - (cur_pos + skip_pos) + 1); } else if(row_index < (aux_row + ln_rows)) { break; // found } else { --skip_pos; } } iterator_base::internal_pos = cur_pos; iterator_base::internal_col = cur_col; return *this; } template inline typename SpSubview::const_iterator SpSubview::const_iterator::operator--(int) { typename SpSubview::const_iterator tmp(*this); --(*this); return tmp; } template inline bool SpSubview::const_iterator::operator==(const const_iterator& rhs) const { return (rhs.row() == (*this).row()) && (rhs.col() == iterator_base::internal_col); } template inline bool SpSubview::const_iterator::operator!=(const const_iterator& rhs) const { return (rhs.row() != (*this).row()) || (rhs.col() != iterator_base::internal_col); } template inline bool SpSubview::const_iterator::operator==(const typename SpMat::const_iterator& rhs) const { return (rhs.row() == (*this).row()) && (rhs.col() == iterator_base::internal_col); } template inline bool SpSubview::const_iterator::operator!=(const typename SpMat::const_iterator& rhs) const { return (rhs.row() != (*this).row()) || (rhs.col() != iterator_base::internal_col); } template inline bool SpSubview::const_iterator::operator==(const const_row_iterator& rhs) const { return (rhs.row() == (*this).row()) && (rhs.col() == iterator_base::internal_col); } template inline bool SpSubview::const_iterator::operator!=(const const_row_iterator& rhs) const { return (rhs.row() != (*this).row()) || (rhs.col() != iterator_base::internal_col); } template inline bool SpSubview::const_iterator::operator==(const typename SpMat::const_row_iterator& rhs) const { return (rhs.row() == (*this).row()) && (rhs.col() == iterator_base::internal_col); } template inline bool SpSubview::const_iterator::operator!=(const typename SpMat::const_row_iterator& rhs) const { return (rhs.row() != (*this).row()) || (rhs.col() != iterator_base::internal_col); } /////////////////////////////////////////////////////////////////////////////// // SpSubview::iterator implementation // /////////////////////////////////////////////////////////////////////////////// template inline SpValProxy< SpSubview > SpSubview::iterator::operator*() { return SpValProxy< SpSubview >( const_iterator::row(), iterator_base::col(), access::rw(*iterator_base::M), &(access::rw(iterator_base::M->m.values[iterator_base::internal_pos + const_iterator::skip_pos]))); } template inline typename SpSubview::iterator& SpSubview::iterator::operator++() { const_iterator::operator++(); return *this; } template inline typename SpSubview::iterator SpSubview::iterator::operator++(int) { typename SpSubview::iterator tmp(*this); const_iterator::operator++(); return tmp; } template inline typename SpSubview::iterator& SpSubview::iterator::operator--() { const_iterator::operator--(); return *this; } template inline typename SpSubview::iterator SpSubview::iterator::operator--(int) { typename SpSubview::iterator tmp(*this); const_iterator::operator--(); return tmp; } /////////////////////////////////////////////////////////////////////////////// // SpSubview::const_row_iterator implementation // /////////////////////////////////////////////////////////////////////////////// template inline SpSubview::const_row_iterator::const_row_iterator() : iterator_base() , internal_row(0) , actual_pos(0) { } template inline SpSubview::const_row_iterator::const_row_iterator(const SpSubview& in_M, uword initial_pos) : iterator_base(in_M, 0, initial_pos) , internal_row(0) , actual_pos(0) { // Corner case for the end of a subview. if(initial_pos == in_M.n_nonzero) { iterator_base::internal_col = 0; internal_row = in_M.n_rows; return; } const uword aux_col = iterator_base::M->aux_col1; const uword aux_row = iterator_base::M->aux_row1; // We don't count zeros in our position count, so we have to find the nonzero // value corresponding to the given initial position, and we also have to skip // any nonzero elements that aren't a part of the subview. uword cur_pos = std::numeric_limits::max(); uword cur_actual_pos = 0; // Since we don't know where the elements are in each row, we have to loop // across all columns looking for elements in row 0 and add to our sum, then // in row 1, and so forth, until we get to the desired position. for(uword row = 0; row < iterator_base::M->n_rows; ++row) { for(uword col = 0; col < iterator_base::M->n_cols; ++col) { // Find the first element with row greater than or equal to row + aux_row. const uword col_offset = iterator_base::M->m.col_ptrs[col + aux_col ]; const uword next_col_offset = iterator_base::M->m.col_ptrs[col + aux_col + 1]; const uword* start_ptr = &iterator_base::M->m.row_indices[ col_offset]; const uword* end_ptr = &iterator_base::M->m.row_indices[next_col_offset]; if(start_ptr != end_ptr) { const uword* pos_ptr = std::lower_bound(start_ptr, end_ptr, row + aux_row); const uword offset = uword(pos_ptr - start_ptr); if(iterator_base::M->m.row_indices[col_offset + offset] == row + aux_row) { cur_actual_pos = col_offset + offset; // Increment position portably. if(cur_pos == std::numeric_limits::max()) cur_pos = 0; else ++cur_pos; // Do we terminate? if(cur_pos == initial_pos) { internal_row = row; iterator_base::internal_col = col; iterator_base::internal_pos = cur_pos; actual_pos = cur_actual_pos; return; } } } } } // This shouldn't happen. iterator_base::internal_pos = iterator_base::M->n_nonzero; iterator_base::internal_col = 0; internal_row = iterator_base::M->n_rows; actual_pos = iterator_base::M->n_nonzero; } template inline SpSubview::const_row_iterator::const_row_iterator(const SpSubview& in_M, uword in_row, uword in_col) : iterator_base(in_M, in_col, 0) , internal_row(0) , actual_pos(0) { // Start our search in the given row. We need to find two things: // // 1. The first nonzero element (iterating by rows) after (in_row, in_col). // 2. The number of nonzero elements (iterating by rows) that come before // (in_row, in_col). // // We'll find these simultaneously, though we will have to loop over all // columns. const uword aux_col = iterator_base::M->aux_col1; const uword aux_row = iterator_base::M->aux_row1; // This will hold the total number of points in the subview with rows less // than in_row. uword cur_pos = 0; uword cur_min_row = iterator_base::M->n_rows; uword cur_min_col = 0; uword cur_actual_pos = 0; for(uword col = 0; col < iterator_base::M->n_cols; ++col) { // Find the first element with row greater than or equal to in_row. const uword col_offset = iterator_base::M->m.col_ptrs[col + aux_col ]; const uword next_col_offset = iterator_base::M->m.col_ptrs[col + aux_col + 1]; const uword* start_ptr = &iterator_base::M->m.row_indices[ col_offset]; const uword* end_ptr = &iterator_base::M->m.row_indices[next_col_offset]; if(start_ptr != end_ptr) { // First let us find the first element that is in the subview. const uword* first_subview_ptr = std::lower_bound(start_ptr, end_ptr, aux_row); if(first_subview_ptr != end_ptr && (*first_subview_ptr) < aux_row + iterator_base::M->n_rows) { // There exists at least one element in the subview. const uword* pos_ptr = std::lower_bound(first_subview_ptr, end_ptr, aux_row + in_row); // This is the number of elements in the subview with row index less // than in_row. cur_pos += uword(pos_ptr - first_subview_ptr); if(pos_ptr != end_ptr && (*pos_ptr) < aux_row + iterator_base::M->n_rows) { // This is the row index of the first element in the column with row // index greater than or equal to in_row + aux_row. if((*pos_ptr) - aux_row < cur_min_row) { // If we are in the desired row but before the desired column, we // can't take this. if(col >= in_col) { cur_min_row = (*pos_ptr) - aux_row; cur_min_col = col; cur_actual_pos = col_offset + (pos_ptr - start_ptr); } } } } } } // Now we know what the minimum row is. internal_row = cur_min_row; iterator_base::internal_col = cur_min_col; iterator_base::internal_pos = cur_pos; actual_pos = cur_actual_pos; } template inline SpSubview::const_row_iterator::const_row_iterator(const const_row_iterator& other) : iterator_base(*other.M, other.internal_col, other.internal_pos) , internal_row(other.internal_row) , actual_pos(other.actual_pos) { // Nothing to do. } template inline typename SpSubview::const_row_iterator& SpSubview::const_row_iterator::operator++() { // We just need to find the next nonzero element. ++iterator_base::internal_pos; // If we have exceeded the bounds, update accordingly. if(iterator_base::internal_pos >= iterator_base::M->n_nonzero) { internal_row = iterator_base::M->n_rows; iterator_base::internal_col = 0; actual_pos = iterator_base::M->n_nonzero; return *this; } const uword aux_col = iterator_base::M->aux_col1; const uword aux_row = iterator_base::M->aux_row1; const uword M_n_cols = iterator_base::M->n_cols; // Otherwise, we need to search. We have to loop over all of the columns in // the subview. uword next_min_row = iterator_base::M->n_rows; uword next_min_col = 0; uword next_actual_pos = 0; for(uword col = iterator_base::internal_col + 1; col < M_n_cols; ++col) { // Find the first element with row greater than or equal to row. const uword col_offset = iterator_base::M->m.col_ptrs[col + aux_col ]; const uword next_col_offset = iterator_base::M->m.col_ptrs[col + aux_col + 1]; const uword* start_ptr = &iterator_base::M->m.row_indices[ col_offset]; const uword* end_ptr = &iterator_base::M->m.row_indices[next_col_offset]; if(start_ptr != end_ptr) { // Find the first element in the column with row greater than or equal to // the current row. Since this is a subview, it's possible that we may // find rows past the end of the subview. const uword* pos_ptr = std::lower_bound(start_ptr, end_ptr, internal_row + aux_row); if(pos_ptr != end_ptr) { // We found something; is the row index correct? if((*pos_ptr) == internal_row + aux_row && (*pos_ptr) < aux_row + iterator_base::M->n_rows) { // Exact match---so we are done. iterator_base::internal_col = col; actual_pos = col_offset + (pos_ptr - start_ptr); return *this; } else if((*pos_ptr) < next_min_row + aux_row && (*pos_ptr) < aux_row + iterator_base::M->n_rows) { // The first element in this column is in a subsequent row, but it's // the minimum row we've seen so far. next_min_row = (*pos_ptr) - aux_row; next_min_col = col; next_actual_pos = col_offset + (pos_ptr - start_ptr); } else if((*pos_ptr) == next_min_row + aux_row && col < next_min_col && (*pos_ptr) < aux_row + iterator_base::M->n_rows) { // The first element in this column is in a subsequent row that we // already have another element for, but the column index is less so // this element will come first. next_min_col = col; next_actual_pos = col_offset + (pos_ptr - start_ptr); } } } } // Restart the search in the next row. for(uword col = 0; col <= iterator_base::internal_col; ++col) { // Find the first element with row greater than or equal to row + 1. const uword col_offset = iterator_base::M->m.col_ptrs[col + aux_col ]; const uword next_col_offset = iterator_base::M->m.col_ptrs[col + aux_col + 1]; const uword* start_ptr = &iterator_base::M->m.row_indices[ col_offset]; const uword* end_ptr = &iterator_base::M->m.row_indices[next_col_offset]; if(start_ptr != end_ptr) { const uword* pos_ptr = std::lower_bound(start_ptr, end_ptr, internal_row + aux_row + 1); if(pos_ptr != end_ptr) { // We found something in the column, but is the row index correct? if((*pos_ptr) == internal_row + aux_row + 1 && (*pos_ptr) < aux_row + iterator_base::M->n_rows) { // Exact match---so we are done. iterator_base::internal_col = col; internal_row++; actual_pos = col_offset + (pos_ptr - start_ptr); return *this; } else if((*pos_ptr) < next_min_row + aux_row && (*pos_ptr) < aux_row + iterator_base::M->n_rows) { // The first element in this column is in a subsequent row, but it's // the minimum row we've seen so far. next_min_row = (*pos_ptr) - aux_row; next_min_col = col; next_actual_pos = col_offset + (pos_ptr - start_ptr); } else if((*pos_ptr) == next_min_row + aux_row && col < next_min_col && (*pos_ptr) < aux_row + iterator_base::M->n_rows) { // We've found a better column. next_min_col = col; next_actual_pos = col_offset + (pos_ptr - start_ptr); } } } } iterator_base::internal_col = next_min_col; internal_row = next_min_row; actual_pos = next_actual_pos; return *this; } template inline typename SpSubview::const_row_iterator SpSubview::const_row_iterator::operator++(int) { typename SpSubview::const_row_iterator tmp(*this); ++(*this); return tmp; } template inline typename SpSubview::const_row_iterator& SpSubview::const_row_iterator::operator--() { if(iterator_base::internal_pos == 0) { // We are already at the beginning. return *this; } iterator_base::internal_pos--; const uword aux_col = iterator_base::M->aux_col1; const uword aux_row = iterator_base::M->aux_row1; // We have to search backwards. uword max_row = 0; uword max_col = 0; uword next_actual_pos = 0; for(uword col = iterator_base::internal_col; col >= 1; --col) { // Find the first element with row greater than or equal to in_row + 1. const uword col_offset = iterator_base::M->m.col_ptrs[col + aux_col - 1]; const uword next_col_offset = iterator_base::M->m.col_ptrs[col + aux_col ]; const uword* start_ptr = &iterator_base::M->m.row_indices[ col_offset]; const uword* end_ptr = &iterator_base::M->m.row_indices[next_col_offset]; if(start_ptr != end_ptr) { // There are elements in this column. const uword* pos_ptr = std::lower_bound(start_ptr, end_ptr, internal_row + aux_row + 1); if(pos_ptr != start_ptr) { if(*(pos_ptr - 1) > max_row + aux_row) { // There are elements in this column with row index < internal_row. max_row = *(pos_ptr - 1) - aux_row; max_col = col - 1; next_actual_pos = col_offset + (pos_ptr - 1 - start_ptr); } else if(*(pos_ptr - 1) == max_row + aux_row && (col - 1) >= max_col) { max_col = col - 1; next_actual_pos = col_offset + (pos_ptr - 1 - start_ptr); } } } } for(uword col = iterator_base::M->n_cols - 1; col >= iterator_base::internal_col; --col) { // Find the first element with row greater than or equal to row + 1. const uword col_offset = iterator_base::M->m.col_ptrs[col + aux_col ]; const uword next_col_offset = iterator_base::M->m.col_ptrs[col + aux_col + 1]; const uword* start_ptr = &iterator_base::M->m.row_indices[ col_offset]; const uword* end_ptr = &iterator_base::M->m.row_indices[next_col_offset]; if(start_ptr != end_ptr) { // There are elements in this column. const uword* pos_ptr = std::lower_bound(start_ptr, end_ptr, internal_row + aux_row); if(pos_ptr != start_ptr) { // There are elements in this column with row index < internal_row. if(*(pos_ptr - 1) > max_row + aux_row) { max_row = *(pos_ptr - 1) - aux_row; max_col = col; next_actual_pos = col_offset + (pos_ptr - 1 - start_ptr); } else if(*(pos_ptr - 1) == max_row + aux_row && col >= max_col) { max_col = col; next_actual_pos = col_offset + (pos_ptr - 1 - start_ptr); } } } if(col == 0) // Catch edge case that the loop termination condition won't. { break; } } iterator_base::internal_col = max_col; internal_row = max_row; actual_pos = next_actual_pos; return *this; } template inline typename SpSubview::const_row_iterator SpSubview::const_row_iterator::operator--(int) { typename SpSubview::const_row_iterator tmp(*this); --(*this); return tmp; } template inline bool SpSubview::const_row_iterator::operator==(const const_iterator& rhs) const { return (rhs.row() == row()) && (rhs.col() == iterator_base::internal_col); } template inline bool SpSubview::const_row_iterator::operator!=(const const_iterator& rhs) const { return (rhs.row() != row()) || (rhs.col() != iterator_base::internal_col); } template inline bool SpSubview::const_row_iterator::operator==(const typename SpMat::const_iterator& rhs) const { return (rhs.row() == row()) && (rhs.col() == iterator_base::internal_col); } template inline bool SpSubview::const_row_iterator::operator!=(const typename SpMat::const_iterator& rhs) const { return (rhs.row() != row()) || (rhs.col() != iterator_base::internal_col); } template inline bool SpSubview::const_row_iterator::operator==(const const_row_iterator& rhs) const { return (rhs.row() == row()) && (rhs.col() == iterator_base::internal_col); } template inline bool SpSubview::const_row_iterator::operator!=(const const_row_iterator& rhs) const { return (rhs.row() != row()) || (rhs.col() != iterator_base::internal_col); } template inline bool SpSubview::const_row_iterator::operator==(const typename SpMat::const_row_iterator& rhs) const { return (rhs.row() == row()) && (rhs.col() == iterator_base::internal_col); } template inline bool SpSubview::const_row_iterator::operator!=(const typename SpMat::const_row_iterator& rhs) const { return (rhs.row() != row()) || (rhs.col() != iterator_base::internal_col); } /////////////////////////////////////////////////////////////////////////////// // SpSubview::row_iterator implementation // /////////////////////////////////////////////////////////////////////////////// template inline SpValProxy< SpSubview > SpSubview::row_iterator::operator*() { return SpValProxy< SpSubview >( const_row_iterator::internal_row, iterator_base::internal_col, access::rw(*iterator_base::M), &access::rw(iterator_base::M->m.values[const_row_iterator::actual_pos])); } template inline typename SpSubview::row_iterator& SpSubview::row_iterator::operator++() { const_row_iterator::operator++(); return *this; } template inline typename SpSubview::row_iterator SpSubview::row_iterator::operator++(int) { typename SpSubview::row_iterator tmp(*this); ++(*this); return tmp; } template inline typename SpSubview::row_iterator& SpSubview::row_iterator::operator--() { const_row_iterator::operator--(); return *this; } template inline typename SpSubview::row_iterator SpSubview::row_iterator::operator--(int) { typename SpSubview::row_iterator tmp(*this); --(*this); return tmp; } //! @} RcppArmadillo/inst/include/armadillo_bits/op_sp_minus_bones.hpp0000644000176200001440000000437014634016465024637 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_sp_minus //! @{ // Subtract a sparse object from a scalar; the output will be a dense object. class op_sp_minus_pre : public traits_op_passthru { public: template inline static void apply(Mat& out, const SpToDOp& in); // used for the optimization of sparse % (scalar - sparse) template inline static void apply_inside_schur(SpMat& out, const T2& x, const SpToDOp& y); // used for the optimization of sparse / (scalar - sparse) template inline static void apply_inside_div(SpMat& out, const T2& x, const SpToDOp& y); }; // Subtract a scalar from a sparse object; the output will be a dense object. class op_sp_minus_post : public traits_op_passthru { public: template inline static void apply(Mat& out, const SpToDOp& in); // used for the optimization of sparse % (sparse - scalar) template inline static void apply_inside_schur(SpMat& out, const T2& x, const SpToDOp& y); // used for the optimization of sparse / (sparse - scalar) template inline static void apply_inside_div(SpMat& out, const T2& x, const SpToDOp& y); }; //! @} RcppArmadillo/inst/include/armadillo_bits/mtSpGlue_bones.hpp0000644000176200001440000000321414301267043024027 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup mtSpGlue //! @{ template class mtSpGlue : public SpBase< out_eT, mtSpGlue > { public: typedef out_eT elem_type; typedef typename get_pod_type::result pod_type; static constexpr bool is_row = spglue_type::template traits::is_row; static constexpr bool is_col = spglue_type::template traits::is_col; static constexpr bool is_xvec = spglue_type::template traits::is_xvec; inline mtSpGlue(const T1& in_A, const T2& in_B); inline ~mtSpGlue(); template arma_inline bool is_alias(const SpMat& X) const; const T1& A; //!< first operand; must be derived from SpBase const T2& B; //!< second operand; must be derived from SpBase }; //! @} RcppArmadillo/inst/include/armadillo_bits/glue_hypot_meat.hpp0000644000176200001440000001004414631567470024302 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup glue_hypot //! @{ template inline void glue_hypot::apply(Mat& out, const Glue& expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const Proxy P1(expr.A); const Proxy P2(expr.B); arma_assert_same_size(P1, P2, "hypot()"); const bool bad_alias = ( (Proxy::has_subview && P1.is_alias(out)) || (Proxy::has_subview && P2.is_alias(out)) ); if(bad_alias == false) { glue_hypot::apply_noalias(out, P1, P2); } else { Mat tmp; glue_hypot::apply_noalias(tmp, P1, P2); out.steal_mem(tmp); } } template inline void glue_hypot::apply_noalias(Mat& out, const Proxy& P1, const Proxy& P2) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword n_rows = P1.get_n_rows(); const uword n_cols = P1.get_n_cols(); out.set_size(n_rows, n_cols); eT* out_mem = out.memptr(); if( (Proxy::use_at == false) && (Proxy::use_at == false) ) { typename Proxy::ea_type eaP1 = P1.get_ea(); typename Proxy::ea_type eaP2 = P2.get_ea(); const uword N = P1.get_n_elem(); for(uword i=0; i inline void glue_hypot::apply(Cube& out, const GlueCube& expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const ProxyCube P1(expr.A); const ProxyCube P2(expr.B); arma_assert_same_size(P1, P2, "hypot()"); const bool bad_alias = ( (ProxyCube::has_subview && P1.is_alias(out)) || (ProxyCube::has_subview && P2.is_alias(out)) ); if(bad_alias == false) { glue_hypot::apply_noalias(out, P1, P2); } else { Cube tmp; glue_hypot::apply_noalias(tmp, P1, P2); out.steal_mem(tmp); } } template inline void glue_hypot::apply_noalias(Cube& out, const ProxyCube& P1, const ProxyCube& P2) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword n_rows = P1.get_n_rows(); const uword n_cols = P1.get_n_cols(); const uword n_slices = P1.get_n_slices(); out.set_size(n_rows, n_cols, n_slices); eT* out_mem = out.memptr(); if( (ProxyCube::use_at == false) && (ProxyCube::use_at == false) ) { typename ProxyCube::ea_type eaP1 = P1.get_ea(); typename ProxyCube::ea_type eaP2 = P2.get_ea(); const uword N = P1.get_n_elem(); for(uword i=0; i static inline void apply_noalias(Mat& out, const Proxy& P); template static inline void apply(Mat& out, const Op& X); }; //! @} RcppArmadillo/inst/include/armadillo_bits/spop_relational_bones.hpp0000644000176200001440000000535014635324415025474 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup spop_relational //! @{ class spop_rel_lt_pre : public traits_op_passthru { public: template inline static void apply(SpMat& out, const mtSpOp& X); }; class spop_rel_lt_post : public traits_op_passthru { public: template inline static void apply(SpMat& out, const mtSpOp& X); }; class spop_rel_gt_pre : public traits_op_passthru { public: template inline static void apply(SpMat& out, const mtSpOp& X); }; class spop_rel_gt_post : public traits_op_passthru { public: template inline static void apply(SpMat& out, const mtSpOp& X); }; class spop_rel_lteq_pre : public traits_op_passthru { public: template inline static void apply(SpMat& out, const mtSpOp& X); }; class spop_rel_lteq_post : public traits_op_passthru { public: template inline static void apply(SpMat& out, const mtSpOp& X); }; class spop_rel_gteq_pre : public traits_op_passthru { public: template inline static void apply(SpMat& out, const mtSpOp& X); }; class spop_rel_gteq_post : public traits_op_passthru { public: template inline static void apply(SpMat& out, const mtSpOp& X); }; class spop_rel_eq : public traits_op_passthru { public: template inline static void apply(SpMat& out, const mtSpOp& X); }; class spop_rel_noteq : public traits_op_passthru { public: template inline static void apply(SpMat& out, const mtSpOp& X); }; //! @} RcppArmadillo/inst/include/armadillo_bits/subview_elem2_meat.hpp0000644000176200001440000006625015030507611024666 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup subview_elem2 //! @{ template inline subview_elem2::~subview_elem2() { arma_debug_sigprint(); } template arma_inline subview_elem2::subview_elem2 ( const Mat& in_m, const Base& in_ri, const Base& in_ci, const bool in_all_rows, const bool in_all_cols ) : m (in_m ) , base_ri (in_ri ) , base_ci (in_ci ) , all_rows (in_all_rows) , all_cols (in_all_cols) { arma_debug_sigprint(); } template template inline void subview_elem2::inplace_op(const eT val) { arma_debug_sigprint(); Mat& m_local = const_cast< Mat& >(m); const uword m_n_rows = m_local.n_rows; const uword m_n_cols = m_local.n_cols; if( (all_rows == false) && (all_cols == false) ) { const unwrap_check_mixed tmp1(base_ri.get_ref(), m_local); const unwrap_check_mixed tmp2(base_ci.get_ref(), m_local); const umat& ri = tmp1.M; const umat& ci = tmp2.M; arma_conform_check ( ( ((ri.is_vec() == false) && (ri.is_empty() == false)) || ((ci.is_vec() == false) && (ci.is_empty() == false)) ), "Mat::elem(): given object must be a vector" ); const uword* ri_mem = ri.memptr(); const uword ri_n_elem = ri.n_elem; const uword* ci_mem = ci.memptr(); const uword ci_n_elem = ci.n_elem; for(uword ci_count=0; ci_count < ci_n_elem; ++ci_count) { const uword col = ci_mem[ci_count]; arma_conform_check_bounds( (col >= m_n_cols), "Mat::elem(): index out of bounds" ); for(uword ri_count=0; ri_count < ri_n_elem; ++ri_count) { const uword row = ri_mem[ri_count]; arma_conform_check_bounds( (row >= m_n_rows), "Mat::elem(): index out of bounds" ); if(is_same_type::yes) { m_local.at(row,col) = val; } if(is_same_type::yes) { m_local.at(row,col) += val; } if(is_same_type::yes) { m_local.at(row,col) -= val; } if(is_same_type::yes) { m_local.at(row,col) *= val; } if(is_same_type::yes) { m_local.at(row,col) /= val; } } } } else if( (all_rows == true) && (all_cols == false) ) { const unwrap_check_mixed tmp2(base_ci.get_ref(), m_local); const umat& ci = tmp2.M; arma_conform_check ( ( (ci.is_vec() == false) && (ci.is_empty() == false) ), "Mat::elem(): given object must be a vector" ); const uword* ci_mem = ci.memptr(); const uword ci_n_elem = ci.n_elem; for(uword ci_count=0; ci_count < ci_n_elem; ++ci_count) { const uword col = ci_mem[ci_count]; arma_conform_check_bounds( (col >= m_n_cols), "Mat::elem(): index out of bounds" ); eT* colptr = m_local.colptr(col); if(is_same_type::yes) { arrayops::inplace_set (colptr, val, m_n_rows); } if(is_same_type::yes) { arrayops::inplace_plus (colptr, val, m_n_rows); } if(is_same_type::yes) { arrayops::inplace_minus(colptr, val, m_n_rows); } if(is_same_type::yes) { arrayops::inplace_mul (colptr, val, m_n_rows); } if(is_same_type::yes) { arrayops::inplace_div (colptr, val, m_n_rows); } } } else if( (all_rows == false) && (all_cols == true) ) { const unwrap_check_mixed tmp1(base_ri.get_ref(), m_local); const umat& ri = tmp1.M; arma_conform_check ( ( (ri.is_vec() == false) && (ri.is_empty() == false) ), "Mat::elem(): given object must be a vector" ); const uword* ri_mem = ri.memptr(); const uword ri_n_elem = ri.n_elem; for(uword col=0; col < m_n_cols; ++col) { for(uword ri_count=0; ri_count < ri_n_elem; ++ri_count) { const uword row = ri_mem[ri_count]; arma_conform_check_bounds( (row >= m_n_rows), "Mat::elem(): index out of bounds" ); if(is_same_type::yes) { m_local.at(row,col) = val; } if(is_same_type::yes) { m_local.at(row,col) += val; } if(is_same_type::yes) { m_local.at(row,col) -= val; } if(is_same_type::yes) { m_local.at(row,col) *= val; } if(is_same_type::yes) { m_local.at(row,col) /= val; } } } } } template template inline void subview_elem2::inplace_op(const Base& x) { arma_debug_sigprint(); Mat& m_local = const_cast< Mat& >(m); const uword m_n_rows = m_local.n_rows; const uword m_n_cols = m_local.n_cols; const unwrap_check tmp(x.get_ref(), m_local); const Mat& X = tmp.M; if( (all_rows == false) && (all_cols == false) ) { const unwrap_check_mixed tmp1(base_ri.get_ref(), m_local); const unwrap_check_mixed tmp2(base_ci.get_ref(), m_local); const umat& ri = tmp1.M; const umat& ci = tmp2.M; arma_conform_check ( ( ((ri.is_vec() == false) && (ri.is_empty() == false)) || ((ci.is_vec() == false) && (ci.is_empty() == false)) ), "Mat::elem(): given object must be a vector" ); const uword* ri_mem = ri.memptr(); const uword ri_n_elem = ri.n_elem; const uword* ci_mem = ci.memptr(); const uword ci_n_elem = ci.n_elem; arma_conform_assert_same_size( ri_n_elem, ci_n_elem, X.n_rows, X.n_cols, "Mat::elem()" ); for(uword ci_count=0; ci_count < ci_n_elem; ++ci_count) { const uword col = ci_mem[ci_count]; arma_conform_check_bounds( (col >= m_n_cols), "Mat::elem(): index out of bounds" ); for(uword ri_count=0; ri_count < ri_n_elem; ++ri_count) { const uword row = ri_mem[ri_count]; arma_conform_check_bounds( (row >= m_n_rows), "Mat::elem(): index out of bounds" ); if(is_same_type::yes) { m_local.at(row,col) = X.at(ri_count, ci_count); } if(is_same_type::yes) { m_local.at(row,col) += X.at(ri_count, ci_count); } if(is_same_type::yes) { m_local.at(row,col) -= X.at(ri_count, ci_count); } if(is_same_type::yes) { m_local.at(row,col) *= X.at(ri_count, ci_count); } if(is_same_type::yes) { m_local.at(row,col) /= X.at(ri_count, ci_count); } } } } else if( (all_rows == true) && (all_cols == false) ) { const unwrap_check_mixed tmp2(base_ci.get_ref(), m_local); const umat& ci = tmp2.M; arma_conform_check ( ( (ci.is_vec() == false) && (ci.is_empty() == false) ), "Mat::elem(): given object must be a vector" ); const uword* ci_mem = ci.memptr(); const uword ci_n_elem = ci.n_elem; arma_conform_assert_same_size( m_n_rows, ci_n_elem, X.n_rows, X.n_cols, "Mat::elem()" ); for(uword ci_count=0; ci_count < ci_n_elem; ++ci_count) { const uword col = ci_mem[ci_count]; arma_conform_check_bounds( (col >= m_n_cols), "Mat::elem(): index out of bounds" ); eT* m_colptr = m_local.colptr(col); const eT* X_colptr = X.colptr(ci_count); if(is_same_type::yes) { arrayops::copy (m_colptr, X_colptr, m_n_rows); } if(is_same_type::yes) { arrayops::inplace_plus (m_colptr, X_colptr, m_n_rows); } if(is_same_type::yes) { arrayops::inplace_minus(m_colptr, X_colptr, m_n_rows); } if(is_same_type::yes) { arrayops::inplace_mul (m_colptr, X_colptr, m_n_rows); } if(is_same_type::yes) { arrayops::inplace_div (m_colptr, X_colptr, m_n_rows); } } } else if( (all_rows == false) && (all_cols == true) ) { const unwrap_check_mixed tmp1(base_ri.get_ref(), m_local); const umat& ri = tmp1.M; arma_conform_check ( ( (ri.is_vec() == false) && (ri.is_empty() == false) ), "Mat::elem(): given object must be a vector" ); const uword* ri_mem = ri.memptr(); const uword ri_n_elem = ri.n_elem; arma_conform_assert_same_size( ri_n_elem, m_n_cols, X.n_rows, X.n_cols, "Mat::elem()" ); for(uword col=0; col < m_n_cols; ++col) { for(uword ri_count=0; ri_count < ri_n_elem; ++ri_count) { const uword row = ri_mem[ri_count]; arma_conform_check_bounds( (row >= m_n_rows), "Mat::elem(): index out of bounds" ); if(is_same_type::yes) { m_local.at(row,col) = X.at(ri_count, col); } if(is_same_type::yes) { m_local.at(row,col) += X.at(ri_count, col); } if(is_same_type::yes) { m_local.at(row,col) -= X.at(ri_count, col); } if(is_same_type::yes) { m_local.at(row,col) *= X.at(ri_count, col); } if(is_same_type::yes) { m_local.at(row,col) /= X.at(ri_count, col); } } } } } template inline void subview_elem2::randu() { arma_debug_sigprint(); Mat& m_local = const_cast< Mat& >(m); const uword m_n_rows = m_local.n_rows; const uword m_n_cols = m_local.n_cols; if( (all_rows == false) && (all_cols == false) ) { const unwrap_check_mixed U1(base_ri.get_ref(), m_local); const unwrap_check_mixed U2(base_ci.get_ref(), m_local); const umat& ri = U1.M; const umat& ci = U2.M; arma_conform_check ( ( ((ri.is_vec() == false) && (ri.is_empty() == false)) || ((ci.is_vec() == false) && (ci.is_empty() == false)) ), "Mat::elem(): given object must be a vector" ); const uword* ri_mem = ri.memptr(); const uword ri_n_elem = ri.n_elem; const uword* ci_mem = ci.memptr(); const uword ci_n_elem = ci.n_elem; podarray tmp(ri_n_elem); eT* tmp_mem = tmp.memptr(); for(uword ci_count=0; ci_count < ci_n_elem; ++ci_count) { const uword col = ci_mem[ci_count]; arma_conform_check_bounds( (col >= m_n_cols), "Mat::elem(): index out of bounds" ); arma_rng::randu::fill(tmp_mem, ri_n_elem); for(uword ri_count=0; ri_count < ri_n_elem; ++ri_count) { const uword row = ri_mem[ri_count]; arma_conform_check_bounds( (row >= m_n_rows), "Mat::elem(): index out of bounds" ); m_local.at(row,col) = tmp_mem[ri_count]; } } } else if( (all_rows == true) && (all_cols == false) ) { const unwrap_check_mixed U2(base_ci.get_ref(), m_local); const umat& ci = U2.M; arma_conform_check ( ( (ci.is_vec() == false) && (ci.is_empty() == false) ), "Mat::elem(): given object must be a vector" ); const uword* ci_mem = ci.memptr(); const uword ci_n_elem = ci.n_elem; for(uword ci_count=0; ci_count < ci_n_elem; ++ci_count) { const uword col = ci_mem[ci_count]; arma_conform_check_bounds( (col >= m_n_cols), "Mat::elem(): index out of bounds" ); arma_rng::randu::fill(m_local.colptr(col), m_n_rows); } } else if( (all_rows == false) && (all_cols == true) ) { const unwrap_check_mixed U1(base_ri.get_ref(), m_local); const umat& ri = U1.M; arma_conform_check ( ( (ri.is_vec() == false) && (ri.is_empty() == false) ), "Mat::elem(): given object must be a vector" ); const uword* ri_mem = ri.memptr(); const uword ri_n_elem = ri.n_elem; podarray tmp(ri_n_elem); eT* tmp_mem = tmp.memptr(); for(uword col=0; col < m_n_cols; ++col) { arma_rng::randu::fill(tmp_mem, ri_n_elem); for(uword ri_count=0; ri_count < ri_n_elem; ++ri_count) { const uword row = ri_mem[ri_count]; arma_conform_check_bounds( (row >= m_n_rows), "Mat::elem(): index out of bounds" ); m_local.at(row,col) = tmp_mem[ri_count]; } } } } template inline void subview_elem2::randn() { arma_debug_sigprint(); Mat& m_local = const_cast< Mat& >(m); const uword m_n_rows = m_local.n_rows; const uword m_n_cols = m_local.n_cols; if( (all_rows == false) && (all_cols == false) ) { const unwrap_check_mixed U1(base_ri.get_ref(), m_local); const unwrap_check_mixed U2(base_ci.get_ref(), m_local); const umat& ri = U1.M; const umat& ci = U2.M; arma_conform_check ( ( ((ri.is_vec() == false) && (ri.is_empty() == false)) || ((ci.is_vec() == false) && (ci.is_empty() == false)) ), "Mat::elem(): given object must be a vector" ); const uword* ri_mem = ri.memptr(); const uword ri_n_elem = ri.n_elem; const uword* ci_mem = ci.memptr(); const uword ci_n_elem = ci.n_elem; podarray tmp(ri_n_elem); eT* tmp_mem = tmp.memptr(); for(uword ci_count=0; ci_count < ci_n_elem; ++ci_count) { const uword col = ci_mem[ci_count]; arma_conform_check_bounds( (col >= m_n_cols), "Mat::elem(): index out of bounds" ); arma_rng::randn::fill(tmp_mem, ri_n_elem); for(uword ri_count=0; ri_count < ri_n_elem; ++ri_count) { const uword row = ri_mem[ri_count]; arma_conform_check_bounds( (row >= m_n_rows), "Mat::elem(): index out of bounds" ); m_local.at(row,col) = tmp_mem[ri_count]; } } } else if( (all_rows == true) && (all_cols == false) ) { const unwrap_check_mixed U2(base_ci.get_ref(), m_local); const umat& ci = U2.M; arma_conform_check ( ( (ci.is_vec() == false) && (ci.is_empty() == false) ), "Mat::elem(): given object must be a vector" ); const uword* ci_mem = ci.memptr(); const uword ci_n_elem = ci.n_elem; for(uword ci_count=0; ci_count < ci_n_elem; ++ci_count) { const uword col = ci_mem[ci_count]; arma_conform_check_bounds( (col >= m_n_cols), "Mat::elem(): index out of bounds" ); arma_rng::randn::fill(m_local.colptr(col), m_n_rows); } } else if( (all_rows == false) && (all_cols == true) ) { const unwrap_check_mixed U1(base_ri.get_ref(), m_local); const umat& ri = U1.M; arma_conform_check ( ( (ri.is_vec() == false) && (ri.is_empty() == false) ), "Mat::elem(): given object must be a vector" ); const uword* ri_mem = ri.memptr(); const uword ri_n_elem = ri.n_elem; podarray tmp(ri_n_elem); eT* tmp_mem = tmp.memptr(); for(uword col=0; col < m_n_cols; ++col) { arma_rng::randn::fill(tmp_mem, ri_n_elem); for(uword ri_count=0; ri_count < ri_n_elem; ++ri_count) { const uword row = ri_mem[ri_count]; arma_conform_check_bounds( (row >= m_n_rows), "Mat::elem(): index out of bounds" ); m_local.at(row,col) = tmp_mem[ri_count]; } } } } // // template inline void subview_elem2::replace(const eT old_val, const eT new_val) { arma_debug_sigprint(); Mat tmp(*this); tmp.replace(old_val, new_val); (*this).operator=(tmp); } template inline void subview_elem2::clean(const pod_type threshold) { arma_debug_sigprint(); Mat tmp(*this); tmp.clean(threshold); (*this).operator=(tmp); } template inline void subview_elem2::clamp(const eT min_val, const eT max_val) { arma_debug_sigprint(); Mat tmp(*this); tmp.clamp(min_val, max_val); (*this).operator=(tmp); } template inline void subview_elem2::fill(const eT val) { arma_debug_sigprint(); inplace_op(val); } template inline void subview_elem2::zeros() { arma_debug_sigprint(); inplace_op(eT(0)); } template inline void subview_elem2::ones() { arma_debug_sigprint(); inplace_op(eT(1)); } template inline void subview_elem2::operator+= (const eT val) { arma_debug_sigprint(); inplace_op(val); } template inline void subview_elem2::operator-= (const eT val) { arma_debug_sigprint(); inplace_op(val); } template inline void subview_elem2::operator*= (const eT val) { arma_debug_sigprint(); inplace_op(val); } template inline void subview_elem2::operator/= (const eT val) { arma_debug_sigprint(); inplace_op(val); } // // template template inline void subview_elem2::operator_equ(const subview_elem2& x) { arma_debug_sigprint(); inplace_op(x); } template template inline void subview_elem2::operator= (const subview_elem2& x) { arma_debug_sigprint(); (*this).operator_equ(x); } //! work around compiler bugs template inline void subview_elem2::operator= (const subview_elem2& x) { arma_debug_sigprint(); (*this).operator_equ(x); } template template inline void subview_elem2::operator+= (const subview_elem2& x) { arma_debug_sigprint(); inplace_op(x); } template template inline void subview_elem2::operator-= (const subview_elem2& x) { arma_debug_sigprint(); inplace_op(x); } template template inline void subview_elem2::operator%= (const subview_elem2& x) { arma_debug_sigprint(); inplace_op(x); } template template inline void subview_elem2::operator/= (const subview_elem2& x) { arma_debug_sigprint(); inplace_op(x); } template template inline void subview_elem2::operator= (const Base& x) { arma_debug_sigprint(); inplace_op(x); } template template inline void subview_elem2::operator+= (const Base& x) { arma_debug_sigprint(); inplace_op(x); } template template inline void subview_elem2::operator-= (const Base& x) { arma_debug_sigprint(); inplace_op(x); } template template inline void subview_elem2::operator%= (const Base& x) { arma_debug_sigprint(); inplace_op(x); } template template inline void subview_elem2::operator/= (const Base& x) { arma_debug_sigprint(); inplace_op(x); } // // template template inline void subview_elem2::operator= (const SpBase& x) { arma_debug_sigprint(); const Mat tmp(x); inplace_op(tmp); } template template inline void subview_elem2::operator+= (const SpBase& x) { arma_debug_sigprint(); const Mat tmp(x); inplace_op(tmp); } template template inline void subview_elem2::operator-= (const SpBase& x) { arma_debug_sigprint(); const Mat tmp(x); inplace_op(tmp); } template template inline void subview_elem2::operator%= (const SpBase& x) { arma_debug_sigprint(); const Mat tmp(x); inplace_op(tmp); } template template inline void subview_elem2::operator/= (const SpBase& x) { arma_debug_sigprint(); const Mat tmp(x); inplace_op(tmp); } // // template inline void subview_elem2::extract(Mat& actual_out, const subview_elem2& in) { arma_debug_sigprint(); Mat& m_local = const_cast< Mat& >(in.m); const uword m_n_rows = m_local.n_rows; const uword m_n_cols = m_local.n_cols; const bool alias = (&actual_out == &m_local); if(alias) { arma_debug_print("subview_elem2::extract(): aliasing detected"); } Mat* tmp_out = alias ? new Mat() : nullptr; Mat& out = alias ? *tmp_out : actual_out; if( (in.all_rows == false) && (in.all_cols == false) ) { const unwrap_check_mixed tmp1(in.base_ri.get_ref(), actual_out); const unwrap_check_mixed tmp2(in.base_ci.get_ref(), actual_out); const umat& ri = tmp1.M; const umat& ci = tmp2.M; arma_conform_check ( ( ((ri.is_vec() == false) && (ri.is_empty() == false)) || ((ci.is_vec() == false) && (ci.is_empty() == false)) ), "Mat::elem(): given object must be a vector" ); const uword* ri_mem = ri.memptr(); const uword ri_n_elem = ri.n_elem; const uword* ci_mem = ci.memptr(); const uword ci_n_elem = ci.n_elem; out.set_size(ri_n_elem, ci_n_elem); eT* out_mem = out.memptr(); uword out_count = 0; for(uword ci_count=0; ci_count < ci_n_elem; ++ci_count) { const uword col = ci_mem[ci_count]; arma_conform_check_bounds( (col >= m_n_cols), "Mat::elem(): index out of bounds" ); for(uword ri_count=0; ri_count < ri_n_elem; ++ri_count) { const uword row = ri_mem[ri_count]; arma_conform_check_bounds( (row >= m_n_rows), "Mat::elem(): index out of bounds" ); out_mem[out_count] = m_local.at(row,col); ++out_count; } } } else if( (in.all_rows == true) && (in.all_cols == false) ) { const unwrap_check_mixed tmp2(in.base_ci.get_ref(), m_local); const umat& ci = tmp2.M; arma_conform_check ( ( (ci.is_vec() == false) && (ci.is_empty() == false) ), "Mat::elem(): given object must be a vector" ); const uword* ci_mem = ci.memptr(); const uword ci_n_elem = ci.n_elem; out.set_size(m_n_rows, ci_n_elem); for(uword ci_count=0; ci_count < ci_n_elem; ++ci_count) { const uword col = ci_mem[ci_count]; arma_conform_check_bounds( (col >= m_n_cols), "Mat::elem(): index out of bounds" ); arrayops::copy( out.colptr(ci_count), m_local.colptr(col), m_n_rows ); } } else if( (in.all_rows == false) && (in.all_cols == true) ) { const unwrap_check_mixed tmp1(in.base_ri.get_ref(), m_local); const umat& ri = tmp1.M; arma_conform_check ( ( (ri.is_vec() == false) && (ri.is_empty() == false) ), "Mat::elem(): given object must be a vector" ); const uword* ri_mem = ri.memptr(); const uword ri_n_elem = ri.n_elem; out.set_size(ri_n_elem, m_n_cols); for(uword col=0; col < m_n_cols; ++col) { for(uword ri_count=0; ri_count < ri_n_elem; ++ri_count) { const uword row = ri_mem[ri_count]; arma_conform_check_bounds( (row >= m_n_rows), "Mat::elem(): index out of bounds" ); out.at(ri_count,col) = m_local.at(row,col); } } } if(alias) { actual_out.steal_mem(out); delete tmp_out; } } // TODO: implement a dedicated function instead of creating a temporary (but lots of potential aliasing issues) template inline void subview_elem2::plus_inplace(Mat& out, const subview_elem2& in) { arma_debug_sigprint(); const Mat tmp(in); out += tmp; } template inline void subview_elem2::minus_inplace(Mat& out, const subview_elem2& in) { arma_debug_sigprint(); const Mat tmp(in); out -= tmp; } template inline void subview_elem2::schur_inplace(Mat& out, const subview_elem2& in) { arma_debug_sigprint(); const Mat tmp(in); out %= tmp; } template inline void subview_elem2::div_inplace(Mat& out, const subview_elem2& in) { arma_debug_sigprint(); const Mat tmp(in); out /= tmp; } template template inline bool subview_elem2::is_alias(const Mat& X) const { arma_debug_sigprint(); return (m.is_alias(X) || base_ri.get_ref().is_alias(X) || base_ci.get_ref().is_alias(X)); } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_normcdf.hpp0000644000176200001440000001232214631567470023231 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_normcdf //! @{ template inline typename enable_if2< (is_real::value), void >::result normcdf_helper(Mat& out, const Base& X_expr, const Base& M_expr, const Base& S_expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; if(Proxy::use_at || Proxy::use_at || Proxy::use_at) { const quasi_unwrap UX(X_expr.get_ref()); const quasi_unwrap UM(M_expr.get_ref()); const quasi_unwrap US(S_expr.get_ref()); normcdf_helper(out, UX.M, UM.M, US.M); return; } const Proxy PX(X_expr.get_ref()); const Proxy PM(M_expr.get_ref()); const Proxy PS(S_expr.get_ref()); arma_conform_check( ( (PX.get_n_rows() != PM.get_n_rows()) || (PX.get_n_cols() != PM.get_n_cols()) || (PM.get_n_rows() != PS.get_n_rows()) || (PM.get_n_cols() != PS.get_n_cols()) ), "normcdf(): size mismatch" ); out.set_size(PX.get_n_rows(), PX.get_n_cols()); eT* out_mem = out.memptr(); const uword N = PX.get_n_elem(); typename Proxy::ea_type X_ea = PX.get_ea(); typename Proxy::ea_type M_ea = PM.get_ea(); typename Proxy::ea_type S_ea = PS.get_ea(); const bool use_mp = arma_config::openmp && mp_gate::eval(N); if(use_mp) { #if defined(ARMA_USE_OPENMP) { const int n_threads = mp_thread_limit::get(); #pragma omp parallel for schedule(static) num_threads(n_threads) for(uword i=0; i::sqrt2)); out_mem[i] = eT(0.5) * std::erfc(tmp); } } #endif } else { for(uword i=0; i::sqrt2)); out_mem[i] = eT(0.5) * std::erfc(tmp); } } } template arma_warn_unused inline typename enable_if2< (is_real::value), eT >::result normcdf(const eT x) { const eT out = eT(0.5) * std::erfc( x / (-Datum::sqrt2) ); return out; } template arma_warn_unused inline typename enable_if2< (is_real::value), eT >::result normcdf(const eT x, const eT mu, const eT sigma) { const eT tmp = (x - mu) / (sigma * (-Datum::sqrt2)); const eT out = eT(0.5) * std::erfc(tmp); return out; } template arma_warn_unused inline typename enable_if2< (is_real::value), Mat >::result normcdf(const eT x, const Base& M_expr, const Base& S_expr) { arma_debug_sigprint(); const quasi_unwrap UM(M_expr.get_ref()); const Mat& M = UM.M; Mat out; normcdf_helper(out, x*ones< Mat >(arma::size(M)), M, S_expr.get_ref()); return out; } template arma_warn_unused inline typename enable_if2< (is_real::value), Mat >::result normcdf(const Base& X_expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const quasi_unwrap UX(X_expr.get_ref()); const Mat& X = UX.M; Mat out; normcdf_helper(out, X, zeros< Mat >(arma::size(X)), ones< Mat >(arma::size(X))); return out; } template arma_warn_unused inline typename enable_if2< (is_real::value), Mat >::result normcdf(const Base& X_expr, const typename T1::elem_type mu, const typename T1::elem_type sigma) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const quasi_unwrap UX(X_expr.get_ref()); const Mat& X = UX.M; Mat out; normcdf_helper(out, X, mu*ones< Mat >(arma::size(X)), sigma*ones< Mat >(arma::size(X))); return out; } template arma_warn_unused inline typename enable_if2< (is_real::value), Mat >::result normcdf(const Base& X_expr, const Base& M_expr, const Base& S_expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; Mat out; normcdf_helper(out, X_expr.get_ref(), M_expr.get_ref(), S_expr.get_ref()); return out; } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_powmat.hpp0000644000176200001440000000552314635324415023107 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_powmat //! @{ template arma_warn_unused inline typename enable_if2< is_supported_blas_type::value, const Op >::result powmat(const Base& X, const int y) { arma_debug_sigprint(); const uword aux_a = (y < int(0)) ? uword(-y) : uword(y); const uword aux_b = (y < int(0)) ? uword(1) : uword(0); return Op(X.get_ref(), aux_a, aux_b); } template inline typename enable_if2< is_supported_blas_type::value, bool >::result powmat ( Mat& out, const Base& X, const int y ) { arma_debug_sigprint(); const uword y_val = (y < int(0)) ? uword(-y) : uword(y); const bool y_neg = (y < int(0)); const bool status = op_powmat::apply_direct(out, X.get_ref(), y_val, y_neg); if(status == false) { out.soft_reset(); arma_warn(3, "powmat(): transformation failed"); } return status; } template arma_warn_unused inline typename enable_if2< is_supported_blas_type::value, const mtOp,T1,op_powmat_cx> >::result powmat(const Base& X, const double y) { arma_debug_sigprint(); typedef std::complex out_eT; return mtOp('j', X.get_ref(), out_eT(y)); } template inline typename enable_if2< is_supported_blas_type::value, bool >::result powmat ( Mat< std::complex >& out, const Base& X, const double y ) { arma_debug_sigprint(); typedef typename T1::pod_type T; const bool status = op_powmat_cx::apply_direct(out, X.get_ref(), T(y)); if(status == false) { out.soft_reset(); arma_warn(3, "powmat(): transformation failed"); } return status; } //! @} RcppArmadillo/inst/include/armadillo_bits/op_rank_bones.hpp0000644000176200001440000000260414301267043023722 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_rank //! @{ class op_rank : public traits_op_default { public: template inline static bool apply(uword& out, const Base& expr, const typename T1::pod_type tol); template inline static bool apply_gen(uword& out, Mat& A, typename get_pod_type::result tol); template inline static bool apply_sym(uword& out, Mat& A, typename get_pod_type::result tol); template inline static bool apply_diag(uword& out, Mat& A, typename get_pod_type::result tol); }; //! @} RcppArmadillo/inst/include/armadillo_bits/fn_nonzeros.hpp0000644000176200001440000000236514634016465023460 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_nonzeros //! @{ template arma_warn_unused inline const Op nonzeros(const Base& X) { arma_debug_sigprint(); return Op(X.get_ref()); } template arma_warn_unused inline const SpToDOp nonzeros(const SpBase& X) { arma_debug_sigprint(); return SpToDOp(X.get_ref()); } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_shuffle.hpp0000644000176200001440000000321314631567470023234 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_shuffle //! @{ template arma_warn_unused arma_inline typename enable_if2 < is_arma_type::value && resolves_to_vector::yes, const Op >::result shuffle ( const T1& X ) { arma_debug_sigprint(); return Op(X); } template arma_warn_unused arma_inline typename enable_if2 < is_arma_type::value && resolves_to_vector::no, const Op >::result shuffle ( const T1& X ) { arma_debug_sigprint(); return Op(X, 0, 0); } template arma_warn_unused arma_inline typename enable_if2 < (is_arma_type::value), const Op >::result shuffle ( const T1& X, const uword dim ) { arma_debug_sigprint(); return Op(X, dim, 0); } //! @} RcppArmadillo/inst/include/armadillo_bits/op_relational_bones.hpp0000644000176200001440000000747114301267043025130 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_relational //! @{ class op_rel_lt_pre : public traits_op_passthru { public: template inline static void apply(Mat& out, const mtOp& X); template inline static void apply(Cube& out, const mtOpCube& X); }; class op_rel_lt_post : public traits_op_passthru { public: template inline static void apply(Mat& out, const mtOp& X); template inline static void apply(Cube& out, const mtOpCube& X); }; class op_rel_gt_pre : public traits_op_passthru { public: template inline static void apply(Mat& out, const mtOp& X); template inline static void apply(Cube& out, const mtOpCube& X); }; class op_rel_gt_post : public traits_op_passthru { public: template inline static void apply(Mat& out, const mtOp& X); template inline static void apply(Cube& out, const mtOpCube& X); }; class op_rel_lteq_pre : public traits_op_passthru { public: template inline static void apply(Mat& out, const mtOp& X); template inline static void apply(Cube& out, const mtOpCube& X); }; class op_rel_lteq_post : public traits_op_passthru { public: template inline static void apply(Mat& out, const mtOp& X); template inline static void apply(Cube& out, const mtOpCube& X); }; class op_rel_gteq_pre : public traits_op_passthru { public: template inline static void apply(Mat& out, const mtOp& X); template inline static void apply(Cube& out, const mtOpCube& X); }; class op_rel_gteq_post : public traits_op_passthru { public: template inline static void apply(Mat& out, const mtOp& X); template inline static void apply(Cube& out, const mtOpCube& X); }; class op_rel_eq : public traits_op_passthru { public: template inline static void apply(Mat& out, const mtOp& X); template inline static void apply(Cube& out, const mtOpCube& X); }; class op_rel_noteq : public traits_op_passthru { public: template inline static void apply(Mat& out, const mtOp& X); template inline static void apply(Cube& out, const mtOpCube& X); }; //! @} RcppArmadillo/inst/include/armadillo_bits/fn_log_det.hpp0000644000176200001440000000671114635324415023215 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_log_det //! @{ //! log determinant of mat template inline bool log_det ( typename T1::elem_type& out_val, typename T1::pod_type& out_sign, const Base& X, const typename arma_blas_type_only::result* junk = nullptr ) { arma_debug_sigprint(); arma_ignore(junk); typedef typename T1::elem_type eT; typedef typename T1::pod_type T; const bool status = op_log_det::apply_direct(out_val, out_sign, X.get_ref()); if(status == false) { out_val = eT(Datum::nan); out_sign = T(0); arma_warn(3, "log_det(): failed to find determinant"); } return status; } template arma_warn_unused inline std::complex log_det ( const Base& X, const typename arma_blas_type_only::result* junk = nullptr ) { arma_debug_sigprint(); arma_ignore(junk); typedef typename T1::elem_type eT; typedef typename T1::pod_type T; eT out_val = eT(0); T out_sign = T(0); const bool status = op_log_det::apply_direct(out_val, out_sign, X.get_ref()); if(status == false) { out_val = eT(Datum::nan); out_sign = T(0); arma_stop_runtime_error("log_det(): failed to find determinant"); } return (out_sign >= T(1)) ? std::complex(out_val) : (out_val + std::complex(T(0),Datum::pi)); } // template inline bool log_det_sympd ( typename T1::pod_type& out_val, const Base& X, const typename arma_blas_type_only::result* junk = nullptr ) { arma_debug_sigprint(); arma_ignore(junk); typedef typename T1::pod_type T; out_val = T(0); const bool status = op_log_det_sympd::apply_direct(out_val, X.get_ref()); if(status == false) { out_val = Datum::nan; arma_warn(3, "log_det_sympd(): given matrix is not symmetric positive definite"); } return status; } template arma_warn_unused inline typename T1::pod_type log_det_sympd ( const Base& X, const typename arma_blas_type_only::result* junk = nullptr ) { arma_debug_sigprint(); arma_ignore(junk); typedef typename T1::pod_type T; T out_val = T(0); const bool status = op_log_det_sympd::apply_direct(out_val, X.get_ref()); if(status == false) { out_val = Datum::nan; arma_stop_runtime_error("log_det_sympd(): given matrix is not symmetric positive definite"); } return out_val; } //! @} RcppArmadillo/inst/include/armadillo_bits/op_fft_bones.hpp0000644000176200001440000000307714374704744023571 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_fft //! @{ class op_fft_real : public traits_op_passthru { public: template inline static void apply( Mat< std::complex >& out, const mtOp,T1,op_fft_real>& in ); }; class op_fft_cx : public traits_op_passthru { public: template inline static void apply( Mat& out, const Op& in ); template inline static void apply_noalias(Mat& out, const Mat& X, const uword a, const uword b); }; class op_ifft_cx : public traits_op_passthru { public: template inline static void apply( Mat& out, const Op& in ); }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_vecnorm_bones.hpp0000644000176200001440000000361614433774144024457 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_vecnorm //! @{ class op_vecnorm : public traits_op_xvec { public: template inline static void apply(Mat& out, const mtOp& in); template inline static void apply_noalias(Mat::result>& out, const Mat& X, const uword k, const uword dim); template inline static void apply_rawmem(typename get_pod_type::result& out_val, const in_eT* mem, const uword N, const uword k); }; class op_vecnorm_ext : public traits_op_xvec { public: template inline static void apply(Mat& out, const mtOp& in); template inline static void apply_noalias(Mat::result>& out, const Mat& X, const uword method_id, const uword dim); template inline static void apply_rawmem(typename get_pod_type::result& out_val, const in_eT* mem, const uword N, const uword method_id); }; //! @} RcppArmadillo/inst/include/armadillo_bits/field_meat.hpp0000644000176200001440000017500615030507611023201 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup field //! @{ template inline field::~field() { arma_debug_sigprint_this(this); delete_objects(); if(n_elem > 0) { delete [] mem; } // try to expose buggy user code that accesses deleted objects mem = nullptr; } template inline field::field() : n_rows(0) , n_cols(0) , n_slices(0) , n_elem(0) , mem(nullptr) { arma_debug_sigprint_this(this); } //! construct a field from a given field template inline field::field(const field& x) : n_rows(0) , n_cols(0) , n_slices(0) , n_elem(0) , mem(nullptr) { arma_debug_sigprint(arma_str::format("this: %x; x: %x") % this % &x); init(x); } //! construct a field from a given field template inline field& field::operator=(const field& x) { arma_debug_sigprint(); init(x); return *this; } //! construct a field from subview_field (eg. construct a field from a delayed subfield operation) template inline field::field(const subview_field& X) : n_rows(0) , n_cols(0) , n_slices(0) , n_elem(0) , mem(nullptr) { arma_debug_sigprint_this(this); this->operator=(X); } //! construct a field from subview_field (eg. construct a field from a delayed subfield operation) template inline field& field::operator=(const subview_field& X) { arma_debug_sigprint(); subview_field::extract(*this, X); return *this; } //! construct the field with the specified number of elements, //! assuming a column-major layout template inline field::field(const uword n_elem_in) : n_rows(0) , n_cols(0) , n_slices(0) , n_elem(0) , mem(nullptr) { arma_debug_sigprint_this(this); init(n_elem_in, 1); } //! construct the field with the specified dimensions template inline field::field(const uword n_rows_in, const uword n_cols_in) : n_rows(0) , n_cols(0) , n_slices(0) , n_elem(0) , mem(nullptr) { arma_debug_sigprint_this(this); init(n_rows_in, n_cols_in); } //! construct the field with the specified dimensions template inline field::field(const uword n_rows_in, const uword n_cols_in, const uword n_slices_in) : n_rows(0) , n_cols(0) , n_slices(0) , n_elem(0) , mem(nullptr) { arma_debug_sigprint_this(this); init(n_rows_in, n_cols_in, n_slices_in); } template inline field::field(const SizeMat& s) : n_rows(0) , n_cols(0) , n_slices(0) , n_elem(0) , mem(nullptr) { arma_debug_sigprint_this(this); init(s.n_rows, s.n_cols); } template inline field::field(const SizeCube& s) : n_rows(0) , n_cols(0) , n_slices(0) , n_elem(0) , mem(nullptr) { arma_debug_sigprint_this(this); init(s.n_rows, s.n_cols, s.n_slices); } //! change the field to have the specified number of elements, //! assuming a column-major layout (data is not preserved) template inline field& field::set_size(const uword n_elem_in) { arma_debug_sigprint(arma_str::format("n_elem_in: %u") % n_elem_in); init(n_elem_in, 1); return *this; } //! change the field to have the specified dimensions (data is not preserved) template inline field& field::set_size(const uword n_rows_in, const uword n_cols_in) { arma_debug_sigprint(arma_str::format("n_rows_in: %u; n_cols_in: %u") % n_rows_in % n_cols_in); init(n_rows_in, n_cols_in); return *this; } //! change the field to have the specified dimensions (data is not preserved) template inline field& field::set_size(const uword n_rows_in, const uword n_cols_in, const uword n_slices_in) { arma_debug_sigprint(arma_str::format("n_rows_in: %u; n_cols_in: %u; n_slices_in: %u") % n_rows_in % n_cols_in % n_slices_in); init(n_rows_in, n_cols_in, n_slices_in); return *this; } template inline field& field::set_size(const SizeMat& s) { arma_debug_sigprint(); init(s.n_rows, s.n_cols); return *this; } template inline field& field::set_size(const SizeCube& s) { arma_debug_sigprint(); init(s.n_rows, s.n_cols, s.n_slices); return *this; } template inline field& field::reshape(const uword n_elem_in) { arma_debug_sigprint(); return (*this).reshape(n_elem_in, 1, 1); } template inline field& field::reshape(const uword n_rows_in, const uword n_cols_in) { arma_debug_sigprint(); return (*this).reshape(n_rows_in, n_cols_in, 1); } template inline field& field::reshape(const uword n_rows_in, const uword n_cols_in, const uword n_slices_in) { arma_debug_sigprint(arma_str::format("n_rows_in: %u; n_cols_in: %u; n_slices_in: %u") % n_rows_in % n_cols_in % n_slices_in); if((n_rows == n_rows_in) && (n_cols == n_cols_in) && (n_slices == n_slices_in)) { // do nothing } else if((n_elem == 0) || ((n_rows == n_cols_in) && (n_cols == n_rows_in) && (n_slices == n_slices_in))) { init(n_rows_in, n_cols_in, n_slices_in); } else { field tmp(n_rows_in, n_cols_in, n_slices_in); const uword n_elem_to_copy = (std::min)((*this).n_elem, tmp.n_elem); for(uword i=0; i < n_elem_to_copy; ++i) { tmp.at(i) = std::move((*this).at(i)); } (*this) = std::move(tmp); } return *this; } template inline field& field::reshape(const SizeMat& s) { arma_debug_sigprint(); return (*this).reshape(s.n_rows, s.n_cols, 1); } template inline field& field::reshape(const SizeCube& s) { arma_debug_sigprint(); return (*this).reshape(s.n_rows, s.n_cols, s.n_slices); } template inline field& field::resize(const uword n_elem_in) { arma_debug_sigprint(); return (*this).resize(n_elem_in, 1, 1); } template inline field& field::resize(const uword n_rows_in, const uword n_cols_in) { arma_debug_sigprint(); return (*this).resize(n_rows_in, n_cols_in, 1); } template inline field& field::resize(const uword n_rows_in, const uword n_cols_in, const uword n_slices_in) { arma_debug_sigprint(arma_str::format("n_rows_in: %u; n_cols_in: %u; n_slices_in: %u") % n_rows_in % n_cols_in % n_slices_in); if((n_rows == n_rows_in) && (n_cols == n_cols_in) && (n_slices == n_slices_in)) { // do nothing } else if(n_elem == 0) { (*this).set_size(n_rows_in, n_cols_in, n_slices_in); } else { // better-than-nothing implementation field tmp(n_rows_in, n_cols_in, n_slices_in); if(tmp.n_elem > 0) { const uword end_row = (std::min)(n_rows_in, n_rows ) - 1; const uword end_col = (std::min)(n_cols_in, n_cols ) - 1; const uword end_slice = (std::min)(n_slices_in, n_slices) - 1; tmp.subfield(0, 0, 0, end_row, end_col, end_slice) = (*this).subfield(0, 0, 0, end_row, end_col, end_slice); } (*this) = std::move(tmp); } return *this; } template inline field& field::resize(const SizeMat& s) { arma_debug_sigprint(); return (*this).resize(s.n_rows, s.n_cols, 1); } template inline field& field::resize(const SizeCube& s) { arma_debug_sigprint(); return (*this).resize(s.n_rows, s.n_cols, s.n_slices); } template inline field::field(const std::vector& x) : n_rows (0) , n_cols (0) , n_slices(0) , n_elem (0) , mem (nullptr) { arma_debug_sigprint_this(this); (*this).operator=(x); } template inline field& field::operator=(const std::vector& x) { arma_debug_sigprint(); const uword N = uword(x.size()); set_size(N, 1); for(uword i=0; i inline field::field(const std::initializer_list& list) : n_rows (0) , n_cols (0) , n_slices(0) , n_elem (0) , mem (nullptr) { arma_debug_sigprint_this(this); (*this).operator=(list); } template inline field& field::operator=(const std::initializer_list& list) { arma_debug_sigprint(); const uword N = uword(list.size()); set_size(1, N); const oT* item_ptr = list.begin(); for(uword i=0; i inline field::field(const std::initializer_list< std::initializer_list >& list) : n_rows (0) , n_cols (0) , n_slices(0) , n_elem (0) , mem (nullptr) { arma_debug_sigprint_this(this); (*this).operator=(list); } template inline field& field::operator=(const std::initializer_list< std::initializer_list >& list) { arma_debug_sigprint(); uword x_n_rows = uword(list.size()); uword x_n_cols = 0; auto it = list.begin(); auto it_end = list.end(); for(; it != it_end; ++it) { x_n_cols = (std::max)(x_n_cols, uword((*it).size())); } field& t = (*this); t.set_size(x_n_rows, x_n_cols); uword row_num = 0; auto row_it = list.begin(); auto row_it_end = list.end(); for(; row_it != row_it_end; ++row_it) { uword col_num = 0; auto col_it = (*row_it).begin(); auto col_it_end = (*row_it).end(); for(; col_it != col_it_end; ++col_it) { t.at(row_num, col_num) = (*col_it); ++col_num; } for(uword c=col_num; c < x_n_cols; ++c) { t.at(row_num, c) = oT(); } ++row_num; } return *this; } template inline field::field(field&& X) : n_rows (X.n_rows ) , n_cols (X.n_cols ) , n_slices(X.n_slices) , n_elem (X.n_elem ) , mem (X.mem ) { arma_debug_sigprint(arma_str::format("this: %x; X: %x") % this % &X); access::rw(X.n_rows ) = 0; access::rw(X.n_cols ) = 0; access::rw(X.n_slices) = 0; access::rw(X.n_elem ) = 0; access::rw(X.mem ) = nullptr; } template inline field& field::operator=(field&& X) { arma_debug_sigprint(arma_str::format("this: %x; X: %x") % this % &X); if(this == &X) { return *this; } reset(); access::rw(n_rows ) = X.n_rows; access::rw(n_cols ) = X.n_cols; access::rw(n_slices) = X.n_slices; access::rw(n_elem ) = X.n_elem; mem = X.mem; access::rw(X.n_rows ) = 0; access::rw(X.n_cols ) = 0; access::rw(X.n_elem ) = 0; access::rw(X.n_slices) = 0; access::rw(X.mem ) = nullptr; return *this; } //! change the field to have the specified dimensions (data is not preserved) template template inline field& field::copy_size(const field& x) { arma_debug_sigprint(); init(x.n_rows, x.n_cols, x.n_slices); return *this; } //! linear element accessor (treats the field as a vector); no bounds check template arma_inline oT& field::operator[] (const uword i) { return (*mem[i]); } //! linear element accessor (treats the field as a vector); no bounds check template arma_inline const oT& field::operator[] (const uword i) const { return (*mem[i]); } //! linear element accessor (treats the field as a vector); no bounds check template arma_inline oT& field::at(const uword i) { return (*mem[i]); } //! linear element accessor (treats the field as a vector); no bounds check template arma_inline const oT& field::at(const uword i) const { return (*mem[i]); } //! linear element accessor (treats the field as a vector); bounds checking not done when ARMA_DONT_CHECK_CONFORMANCE is defined template arma_inline oT& field::operator() (const uword i) { arma_conform_check_bounds( (i >= n_elem), "field::operator(): index out of bounds" ); return (*mem[i]); } //! linear element accessor (treats the field as a vector); bounds checking not done when ARMA_DONT_CHECK_CONFORMANCE is defined template arma_inline const oT& field::operator() (const uword i) const { arma_conform_check_bounds( (i >= n_elem), "field::operator(): index out of bounds" ); return (*mem[i]); } //! element accessor; bounds checking not done when ARMA_DONT_CHECK_CONFORMANCE is defined template arma_inline oT& field::operator() (const uword in_row, const uword in_col) { arma_conform_check_bounds( ((in_row >= n_rows) || (in_col >= n_cols) || (0 >= n_slices) ), "field::operator(): index out of bounds" ); return (*mem[in_row + in_col*n_rows]); } //! element accessor; bounds checking not done when ARMA_DONT_CHECK_CONFORMANCE is defined template arma_inline const oT& field::operator() (const uword in_row, const uword in_col) const { arma_conform_check_bounds( ((in_row >= n_rows) || (in_col >= n_cols) || (0 >= n_slices) ), "field::operator(): index out of bounds" ); return (*mem[in_row + in_col*n_rows]); } //! element accessor; bounds checking not done when ARMA_DONT_CHECK_CONFORMANCE is defined template arma_inline oT& field::operator() (const uword in_row, const uword in_col, const uword in_slice) { arma_conform_check_bounds( ((in_row >= n_rows) || (in_col >= n_cols) || (in_slice >= n_slices)), "field::operator(): index out of bounds" ); return (*mem[in_row + in_col*n_rows + in_slice*(n_rows*n_cols)]); } //! element accessor; bounds checking not done when ARMA_DONT_CHECK_CONFORMANCE is defined template arma_inline const oT& field::operator() (const uword in_row, const uword in_col, const uword in_slice) const { arma_conform_check_bounds( ((in_row >= n_rows) || (in_col >= n_cols) || (in_slice >= n_slices)), "field::operator(): index out of bounds" ); return (*mem[in_row + in_col*n_rows + in_slice*(n_rows*n_cols)]); } #if defined(__cpp_multidimensional_subscript) //! element accessor; no bounds check template arma_inline oT& field::operator[] (const uword in_row, const uword in_col) { return (*mem[in_row + in_col*n_rows]); } //! element accessor; no bounds check template arma_inline const oT& field::operator[] (const uword in_row, const uword in_col) const { return (*mem[in_row + in_col*n_rows]); } #endif //! element accessor; no bounds check template arma_inline oT& field::at(const uword in_row, const uword in_col) { return (*mem[in_row + in_col*n_rows]); } //! element accessor; no bounds check template arma_inline const oT& field::at(const uword in_row, const uword in_col) const { return (*mem[in_row + in_col*n_rows]); } #if defined(__cpp_multidimensional_subscript) //! element accessor; no bounds check template arma_inline oT& field::operator[] (const uword in_row, const uword in_col, const uword in_slice) { return (*mem[in_row + in_col*n_rows + in_slice*(n_rows*n_cols)]); } //! element accessor; no bounds check template arma_inline const oT& field::operator[] (const uword in_row, const uword in_col, const uword in_slice) const { return (*mem[in_row + in_col*n_rows + in_slice*(n_rows*n_cols)]); } #endif //! element accessor; no bounds check template arma_inline oT& field::at(const uword in_row, const uword in_col, const uword in_slice) { return (*mem[in_row + in_col*n_rows + in_slice*(n_rows*n_cols)]); } //! element accessor; no bounds check template arma_inline const oT& field::at(const uword in_row, const uword in_col, const uword in_slice) const { return (*mem[in_row + in_col*n_rows + in_slice*(n_rows*n_cols)]); } template arma_inline oT& field::front() { arma_conform_check( (n_elem == 0), "field::front(): field is empty" ); return (*mem[0]); } template arma_inline const oT& field::front() const { arma_conform_check( (n_elem == 0), "field::front(): field is empty" ); return (*mem[0]); } template arma_inline oT& field::back() { arma_conform_check( (n_elem == 0), "field::back(): field is empty" ); return (*mem[n_elem-1]); } template arma_inline const oT& field::back() const { arma_conform_check( (n_elem == 0), "field::back(): field is empty" ); return (*mem[n_elem-1]); } template inline field_injector< field > field::operator<<(const oT& val) { return field_injector< field >(*this, val); } template inline field_injector< field > field::operator<<(const injector_end_of_row<>& x) { return field_injector< field >(*this, x); } //! creation of subview_field (row of a field) template inline subview_field field::row(const uword row_num) { arma_debug_sigprint(); arma_conform_check( (n_slices >= 2), "field::row(): field must be 2D" ); arma_conform_check_bounds( (row_num >= n_rows), "field::row(): row out of bounds" ); return subview_field(*this, row_num, 0, 1, n_cols); } //! creation of subview_field (row of a field) template inline const subview_field field::row(const uword row_num) const { arma_debug_sigprint(); arma_conform_check( (n_slices >= 2), "field::row(): field must be 2D" ); arma_conform_check_bounds( (row_num >= n_rows), "field::row(): row out of bounds" ); return subview_field(*this, row_num, 0, 1, n_cols); } //! creation of subview_field (column of a field) template inline subview_field field::col(const uword col_num) { arma_debug_sigprint(); arma_conform_check( (n_slices >= 2), "field::col(): field must be 2D" ); arma_conform_check_bounds( (col_num >= n_cols), "field::col(): out of bounds" ); return subview_field(*this, 0, col_num, n_rows, 1); } //! creation of subview_field (column of a field) template inline const subview_field field::col(const uword col_num) const { arma_debug_sigprint(); arma_conform_check( (n_slices >= 2), "field::col(): field must be 2D" ); arma_conform_check_bounds( (col_num >= n_cols), "field::col(): out of bounds" ); return subview_field(*this, 0, col_num, n_rows, 1); } //! creation of subview_field (slice of a field) template inline subview_field field::slice(const uword slice_num) { arma_debug_sigprint(); arma_conform_check_bounds( (slice_num >= n_slices), "field::slice(): out of bounds" ); return subview_field(*this, 0, 0, slice_num, n_rows, n_cols, 1); } //! creation of subview_field (slice of a field) template inline const subview_field field::slice(const uword slice_num) const { arma_debug_sigprint(); arma_conform_check_bounds( (slice_num >= n_slices), "field::slice(): out of bounds" ); return subview_field(*this, 0, 0, slice_num, n_rows, n_cols, 1); } //! creation of subview_field (subfield comprised of specified rows) template inline subview_field field::rows(const uword in_row1, const uword in_row2) { arma_debug_sigprint(); arma_conform_check( (n_slices >= 2), "field::rows(): field must be 2D" ); arma_conform_check_bounds ( ( (in_row1 > in_row2) || (in_row2 >= n_rows) ), "field::rows(): indices out of bounds or incorrectly used" ); const uword sub_n_rows = in_row2 - in_row1 + 1; return subview_field(*this, in_row1, 0, sub_n_rows, n_cols); } //! creation of subview_field (subfield comprised of specified rows) template inline const subview_field field::rows(const uword in_row1, const uword in_row2) const { arma_debug_sigprint(); arma_conform_check( (n_slices >= 2), "field::rows(): field must be 2D" ); arma_conform_check_bounds ( ( (in_row1 > in_row2) || (in_row2 >= n_rows) ), "field::rows(): indices out of bounds or incorrectly used" ); const uword sub_n_rows = in_row2 - in_row1 + 1; return subview_field(*this, in_row1, 0, sub_n_rows, n_cols); } //! creation of subview_field (subfield comprised of specified columns) template inline subview_field field::cols(const uword in_col1, const uword in_col2) { arma_debug_sigprint(); arma_conform_check( (n_slices >= 2), "field::cols(): field must be 2D" ); arma_conform_check_bounds ( ( (in_col1 > in_col2) || (in_col2 >= n_cols) ), "field::cols(): indices out of bounds or incorrectly used" ); const uword sub_n_cols = in_col2 - in_col1 + 1; return subview_field(*this, 0, in_col1, n_rows, sub_n_cols); } //! creation of subview_field (subfield comprised of specified columns) template inline const subview_field field::cols(const uword in_col1, const uword in_col2) const { arma_debug_sigprint(); arma_conform_check( (n_slices >= 2), "field::cols(): field must be 2D" ); arma_conform_check_bounds ( ( (in_col1 > in_col2) || (in_col2 >= n_cols) ), "field::cols(): indices out of bounds or incorrectly used" ); const uword sub_n_cols = in_col2 - in_col1 + 1; return subview_field(*this, 0, in_col1, n_rows, sub_n_cols); } //! creation of subview_field (subfield comprised of specified slices) template inline subview_field field::slices(const uword in_slice1, const uword in_slice2) { arma_debug_sigprint(); arma_conform_check_bounds ( ( (in_slice1 > in_slice2) || (in_slice2 >= n_slices) ), "field::slices(): indices out of bounds or incorrectly used" ); const uword sub_n_slices = in_slice2 - in_slice1 + 1; return subview_field(*this, 0, 0, in_slice1, n_rows, n_cols, sub_n_slices); } //! creation of subview_field (subfield comprised of specified slices) template inline const subview_field field::slices(const uword in_slice1, const uword in_slice2) const { arma_debug_sigprint(); arma_conform_check_bounds ( ( (in_slice1 > in_slice2) || (in_slice2 >= n_slices) ), "field::slices(): indices out of bounds or incorrectly used" ); const uword sub_n_slices = in_slice2 - in_slice1 + 1; return subview_field(*this, 0, 0, in_slice1, n_rows, n_cols, sub_n_slices); } //! creation of subview_field (subfield with arbitrary dimensions) template inline subview_field field::subfield(const uword in_row1, const uword in_col1, const uword in_row2, const uword in_col2) { arma_debug_sigprint(); arma_conform_check( (n_slices >= 2), "field::subfield(): field must be 2D" ); arma_conform_check_bounds ( (in_row1 > in_row2) || (in_col1 > in_col2) || (in_row2 >= n_rows) || (in_col2 >= n_cols), "field::subfield(): indices out of bounds or incorrectly used" ); const uword sub_n_rows = in_row2 - in_row1 + 1; const uword sub_n_cols = in_col2 - in_col1 + 1; return subview_field(*this, in_row1, in_col1, sub_n_rows, sub_n_cols); } //! creation of subview_field (subfield with arbitrary dimensions) template inline const subview_field field::subfield(const uword in_row1, const uword in_col1, const uword in_row2, const uword in_col2) const { arma_debug_sigprint(); arma_conform_check( (n_slices >= 2), "field::subfield(): field must be 2D" ); arma_conform_check_bounds ( (in_row1 > in_row2) || (in_col1 > in_col2) || (in_row2 >= n_rows) || (in_col2 >= n_cols), "field::subfield(): indices out of bounds or incorrectly used" ); const uword sub_n_rows = in_row2 - in_row1 + 1; const uword sub_n_cols = in_col2 - in_col1 + 1; return subview_field(*this, in_row1, in_col1, sub_n_rows, sub_n_cols); } //! creation of subview_field (subfield with arbitrary dimensions) template inline subview_field field::subfield(const uword in_row1, const uword in_col1, const uword in_slice1, const uword in_row2, const uword in_col2, const uword in_slice2) { arma_debug_sigprint(); arma_conform_check_bounds ( (in_row1 > in_row2) || (in_col1 > in_col2) || (in_slice1 > in_slice2) || (in_row2 >= n_rows) || (in_col2 >= n_cols) || (in_slice2 >= n_slices), "field::subfield(): indices out of bounds or incorrectly used" ); const uword sub_n_rows = in_row2 - in_row1 + 1; const uword sub_n_cols = in_col2 - in_col1 + 1; const uword sub_n_slices = in_slice2 - in_slice1 + 1; return subview_field(*this, in_row1, in_col1, in_slice1, sub_n_rows, sub_n_cols, sub_n_slices); } //! creation of subview_field (subfield with arbitrary dimensions) template inline const subview_field field::subfield(const uword in_row1, const uword in_col1, const uword in_slice1, const uword in_row2, const uword in_col2, const uword in_slice2) const { arma_debug_sigprint(); arma_conform_check_bounds ( (in_row1 > in_row2) || (in_col1 > in_col2) || (in_slice1 > in_slice2) || (in_row2 >= n_rows) || (in_col2 >= n_cols) || (in_slice2 >= n_slices), "field::subfield(): indices out of bounds or incorrectly used" ); const uword sub_n_rows = in_row2 - in_row1 + 1; const uword sub_n_cols = in_col2 - in_col1 + 1; const uword sub_n_slices = in_slice2 - in_slice1 + 1; return subview_field(*this, in_row1, in_col1, in_slice1, sub_n_rows, sub_n_cols, sub_n_slices); } //! creation of subview_field (subfield with arbitrary dimensions) template inline subview_field field::subfield(const uword in_row1, const uword in_col1, const SizeMat& s) { arma_debug_sigprint(); arma_conform_check( (n_slices >= 2), "field::subfield(): field must be 2D" ); const uword l_n_rows = n_rows; const uword l_n_cols = n_cols; const uword s_n_rows = s.n_rows; const uword s_n_cols = s.n_cols; arma_conform_check_bounds ( ((in_row1 >= l_n_rows) || (in_col1 >= l_n_cols) || ((in_row1 + s_n_rows) > l_n_rows) || ((in_col1 + s_n_cols) > l_n_cols)), "field::subfield(): indices or size out of bounds" ); return subview_field(*this, in_row1, in_col1, s_n_rows, s_n_cols); } //! creation of subview_field (subfield with arbitrary dimensions) template inline const subview_field field::subfield(const uword in_row1, const uword in_col1, const SizeMat& s) const { arma_debug_sigprint(); arma_conform_check( (n_slices >= 2), "field::subfield(): field must be 2D" ); const uword l_n_rows = n_rows; const uword l_n_cols = n_cols; const uword s_n_rows = s.n_rows; const uword s_n_cols = s.n_cols; arma_conform_check_bounds ( ((in_row1 >= l_n_rows) || (in_col1 >= l_n_cols) || ((in_row1 + s_n_rows) > l_n_rows) || ((in_col1 + s_n_cols) > l_n_cols)), "field::subfield(): indices or size out of bounds" ); return subview_field(*this, in_row1, in_col1, s_n_rows, s_n_cols); } //! creation of subview_field (subfield with arbitrary dimensions) template inline subview_field field::subfield(const uword in_row1, const uword in_col1, const uword in_slice1, const SizeCube& s) { arma_debug_sigprint(); const uword l_n_rows = n_rows; const uword l_n_cols = n_cols; const uword l_n_slices = n_slices; const uword s_n_rows = s.n_rows; const uword s_n_cols = s.n_cols; const uword sub_n_slices = s.n_slices; arma_conform_check_bounds ( ((in_row1 >= l_n_rows) || (in_col1 >= l_n_cols) || (in_slice1 >= l_n_slices) || ((in_row1 + s_n_rows) > l_n_rows) || ((in_col1 + s_n_cols) > l_n_cols) || ((in_slice1 + sub_n_slices) > l_n_slices)), "field::subfield(): indices or size out of bounds" ); return subview_field(*this, in_row1, in_col1, in_slice1, s_n_rows, s_n_cols, sub_n_slices); } //! creation of subview_field (subfield with arbitrary dimensions) template inline const subview_field field::subfield(const uword in_row1, const uword in_col1, const uword in_slice1, const SizeCube& s) const { arma_debug_sigprint(); const uword l_n_rows = n_rows; const uword l_n_cols = n_cols; const uword l_n_slices = n_slices; const uword s_n_rows = s.n_rows; const uword s_n_cols = s.n_cols; const uword sub_n_slices = s.n_slices; arma_conform_check_bounds ( ((in_row1 >= l_n_rows) || (in_col1 >= l_n_cols) || (in_slice1 >= l_n_slices) || ((in_row1 + s_n_rows) > l_n_rows) || ((in_col1 + s_n_cols) > l_n_cols) || ((in_slice1 + sub_n_slices) > l_n_slices)), "field::subfield(): indices or size out of bounds" ); return subview_field(*this, in_row1, in_col1, in_slice1, s_n_rows, s_n_cols, sub_n_slices); } //! creation of subview_field (subfield with arbitrary dimensions) template inline subview_field field::subfield(const span& row_span, const span& col_span) { arma_debug_sigprint(); arma_conform_check( (n_slices >= 2), "field::subfield(): field must be 2D" ); const bool row_all = row_span.whole; const bool col_all = col_span.whole; const uword local_n_rows = n_rows; const uword local_n_cols = n_cols; const uword in_row1 = row_all ? 0 : row_span.a; const uword in_row2 = row_span.b; const uword sub_n_rows = row_all ? local_n_rows : in_row2 - in_row1 + 1; const uword in_col1 = col_all ? 0 : col_span.a; const uword in_col2 = col_span.b; const uword sub_n_cols = col_all ? local_n_cols : in_col2 - in_col1 + 1; arma_conform_check_bounds ( ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows)) ) || ( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= local_n_cols)) ) , "field::subfield(): indices out of bounds or incorrectly used" ); return subview_field(*this, in_row1, in_col1, sub_n_rows, sub_n_cols); } //! creation of subview_field (subfield with arbitrary dimensions) template inline const subview_field field::subfield(const span& row_span, const span& col_span) const { arma_debug_sigprint(); arma_conform_check( (n_slices >= 2), "field::subfield(): field must be 2D" ); const bool row_all = row_span.whole; const bool col_all = col_span.whole; const uword local_n_rows = n_rows; const uword local_n_cols = n_cols; const uword in_row1 = row_all ? 0 : row_span.a; const uword in_row2 = row_span.b; const uword sub_n_rows = row_all ? local_n_rows : in_row2 - in_row1 + 1; const uword in_col1 = col_all ? 0 : col_span.a; const uword in_col2 = col_span.b; const uword sub_n_cols = col_all ? local_n_cols : in_col2 - in_col1 + 1; arma_conform_check_bounds ( ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows)) ) || ( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= local_n_cols)) ) , "field::subfield(): indices out of bounds or incorrectly used" ); return subview_field(*this, in_row1, in_col1, sub_n_rows, sub_n_cols); } //! creation of subview_field (subfield with arbitrary dimensions) template inline subview_field field::subfield(const span& row_span, const span& col_span, const span& slice_span) { arma_debug_sigprint(); const bool row_all = row_span.whole; const bool col_all = col_span.whole; const bool slice_all = slice_span.whole; const uword local_n_rows = n_rows; const uword local_n_cols = n_cols; const uword local_n_slices = n_slices; const uword in_row1 = row_all ? 0 : row_span.a; const uword in_row2 = row_span.b; const uword sub_n_rows = row_all ? local_n_rows : in_row2 - in_row1 + 1; const uword in_col1 = col_all ? 0 : col_span.a; const uword in_col2 = col_span.b; const uword sub_n_cols = col_all ? local_n_cols : in_col2 - in_col1 + 1; const uword in_slice1 = slice_all ? 0 : slice_span.a; const uword in_slice2 = slice_span.b; const uword sub_n_slices = slice_all ? local_n_slices : in_slice2 - in_slice1 + 1; arma_conform_check_bounds ( ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows)) ) || ( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= local_n_cols)) ) || ( slice_all ? false : ((in_slice1 > in_slice2) || (in_slice2 >= local_n_slices)) ) , "field::subfield(): indices out of bounds or incorrectly used" ); return subview_field(*this, in_row1, in_col1, in_slice1, sub_n_rows, sub_n_cols, sub_n_slices); } //! creation of subview_field (subfield with arbitrary dimensions) template inline const subview_field field::subfield(const span& row_span, const span& col_span, const span& slice_span) const { arma_debug_sigprint(); const bool row_all = row_span.whole; const bool col_all = col_span.whole; const bool slice_all = slice_span.whole; const uword local_n_rows = n_rows; const uword local_n_cols = n_cols; const uword local_n_slices = n_slices; const uword in_row1 = row_all ? 0 : row_span.a; const uword in_row2 = row_span.b; const uword sub_n_rows = row_all ? local_n_rows : in_row2 - in_row1 + 1; const uword in_col1 = col_all ? 0 : col_span.a; const uword in_col2 = col_span.b; const uword sub_n_cols = col_all ? local_n_cols : in_col2 - in_col1 + 1; const uword in_slice1 = slice_all ? 0 : slice_span.a; const uword in_slice2 = slice_span.b; const uword sub_n_slices = slice_all ? local_n_slices : in_slice2 - in_slice1 + 1; arma_conform_check_bounds ( ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows)) ) || ( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= local_n_cols)) ) || ( slice_all ? false : ((in_slice1 > in_slice2) || (in_slice2 >= local_n_slices)) ) , "field::subfield(): indices out of bounds or incorrectly used" ); return subview_field(*this, in_row1, in_col1, in_slice1, sub_n_rows, sub_n_cols, sub_n_slices); } template inline subview_field field::operator()(const span& row_span, const span& col_span) { arma_debug_sigprint(); return (*this).subfield(row_span, col_span); } template inline const subview_field field::operator()(const span& row_span, const span& col_span) const { arma_debug_sigprint(); return (*this).subfield(row_span, col_span); } template inline subview_field field::operator()(const span& row_span, const span& col_span, const span& slice_span) { arma_debug_sigprint(); return (*this).subfield(row_span, col_span, slice_span); } template inline const subview_field field::operator()(const span& row_span, const span& col_span, const span& slice_span) const { arma_debug_sigprint(); return (*this).subfield(row_span, col_span, slice_span); } template inline subview_field field::operator()(const uword in_row1, const uword in_col1, const SizeMat& s) { arma_debug_sigprint(); return (*this).subfield(in_row1, in_col1, s); } template inline const subview_field field::operator()(const uword in_row1, const uword in_col1, const SizeMat& s) const { arma_debug_sigprint(); return (*this).subfield(in_row1, in_col1, s); } template inline subview_field field::operator()(const uword in_row1, const uword in_col1, const uword in_slice1, const SizeCube& s) { arma_debug_sigprint(); return (*this).subfield(in_row1, in_col1, in_slice1, s); } template inline const subview_field field::operator()(const uword in_row1, const uword in_col1, const uword in_slice1, const SizeCube& s) const { arma_debug_sigprint(); return (*this).subfield(in_row1, in_col1, in_slice1, s); } //! print contents of the field (to the cout stream), //! optionally preceding with a user specified line of text. //! the field class preserves the stream's flags //! but the associated operator<< function for type oT //! may still modify the stream's parameters. //! NOTE: this function assumes that type oT can be printed, //! ie. the function "std::ostream& operator<< (std::ostream&, const oT&)" //! has been defined. template inline void field::print(const std::string extra_text) const { arma_debug_sigprint(); if(extra_text.length() != 0) { const std::streamsize orig_width = get_cout_stream().width(); get_cout_stream() << extra_text << '\n'; get_cout_stream().width(orig_width); } arma_ostream::print(get_cout_stream(), *this); } //! print contents of the field to a user specified stream, //! optionally preceding with a user specified line of text. //! the field class preserves the stream's flags //! but the associated operator<< function for type oT //! may still modify the stream's parameters. //! NOTE: this function assumes that type oT can be printed, //! ie. the function "std::ostream& operator<< (std::ostream&, const oT&)" //! has been defined. template inline void field::print(std::ostream& user_stream, const std::string extra_text) const { arma_debug_sigprint(); if(extra_text.length() != 0) { const std::streamsize orig_width = user_stream.width(); user_stream << extra_text << '\n'; user_stream.width(orig_width); } arma_ostream::print(user_stream, *this); } //! apply a lambda function to each object template inline field& field::for_each(const std::function< void(oT&) >& F) { arma_debug_sigprint(); for(uword i=0; i < n_elem; ++i) { F(operator[](i)); } return *this; } template inline const field& field::for_each(const std::function< void(const oT&) >& F) const { arma_debug_sigprint(); for(uword i=0; i < n_elem; ++i) { F(operator[](i)); } return *this; } //! fill the field with an object template inline field& field::fill(const oT& x) { arma_debug_sigprint(); field& t = *this; for(uword i=0; i inline void field::reset() { arma_debug_sigprint(); init(0,0,0); } //! reset each object template inline void field::reset_objects() { arma_debug_sigprint(); field_aux::reset_objects(*this); } //! returns true if the field has no objects template arma_inline bool field::is_empty() const { return (n_elem == 0); } //! returns true if the given index is currently in range template arma_inline bool field::in_range(const uword i) const { return (i < n_elem); } //! returns true if the given start and end indices are currently in range template arma_inline bool field::in_range(const span& x) const { arma_debug_sigprint(); if(x.whole) { return true; } else { const uword a = x.a; const uword b = x.b; return ( (a <= b) && (b < n_elem) ); } } //! returns true if the given location is currently in range template arma_inline bool field::in_range(const uword in_row, const uword in_col) const { return ( (in_row < n_rows) && (in_col < n_cols) ); } template arma_inline bool field::in_range(const span& row_span, const uword in_col) const { arma_debug_sigprint(); if(row_span.whole) { return (in_col < n_cols); } else { const uword in_row1 = row_span.a; const uword in_row2 = row_span.b; return ( (in_row1 <= in_row2) && (in_row2 < n_rows) && (in_col < n_cols) ); } } template arma_inline bool field::in_range(const uword in_row, const span& col_span) const { arma_debug_sigprint(); if(col_span.whole) { return (in_row < n_rows); } else { const uword in_col1 = col_span.a; const uword in_col2 = col_span.b; return ( (in_row < n_rows) && (in_col1 <= in_col2) && (in_col2 < n_cols) ); } } template arma_inline bool field::in_range(const span& row_span, const span& col_span) const { arma_debug_sigprint(); const uword in_row1 = row_span.a; const uword in_row2 = row_span.b; const uword in_col1 = col_span.a; const uword in_col2 = col_span.b; const bool rows_ok = row_span.whole ? true : ( (in_row1 <= in_row2) && (in_row2 < n_rows) ); const bool cols_ok = col_span.whole ? true : ( (in_col1 <= in_col2) && (in_col2 < n_cols) ); return ( rows_ok && cols_ok ); } template arma_inline bool field::in_range(const uword in_row, const uword in_col, const SizeMat& s) const { const uword l_n_rows = n_rows; const uword l_n_cols = n_cols; if( (in_row >= l_n_rows) || (in_col >= l_n_cols) || ((in_row + s.n_rows) > l_n_rows) || ((in_col + s.n_cols) > l_n_cols) ) { return false; } else { return true; } } template arma_inline bool field::in_range(const uword in_row, const uword in_col, const uword in_slice) const { return ( (in_row < n_rows) && (in_col < n_cols) && (in_slice < n_slices) ); } template arma_inline bool field::in_range(const span& row_span, const span& col_span, const span& slice_span) const { arma_debug_sigprint(); const uword in_row1 = row_span.a; const uword in_row2 = row_span.b; const uword in_col1 = col_span.a; const uword in_col2 = col_span.b; const uword in_slice1 = slice_span.a; const uword in_slice2 = slice_span.b; const bool rows_ok = row_span.whole ? true : ( (in_row1 <= in_row2 ) && (in_row2 < n_rows ) ); const bool cols_ok = col_span.whole ? true : ( (in_col1 <= in_col2 ) && (in_col2 < n_cols ) ); const bool slices_ok = slice_span.whole ? true : ( (in_slice1 <= in_slice2) && (in_slice2 < n_slices) ); return ( rows_ok && cols_ok && slices_ok ); } template arma_inline bool field::in_range(const uword in_row, const uword in_col, const uword in_slice, const SizeCube& s) const { const uword l_n_rows = n_rows; const uword l_n_cols = n_cols; const uword l_n_slices = n_slices; if( (in_row >= l_n_rows) || (in_col >= l_n_cols) || (in_slice >= l_n_slices) || ((in_row + s.n_rows) > l_n_rows) || ((in_col + s.n_cols) > l_n_cols) || ((in_slice + s.n_slices) > l_n_slices) ) { return false; } else { return true; } } template inline bool field::save(const std::string name, const file_type type) const { arma_debug_sigprint(); std::string err_msg; const bool save_okay = field_aux::save(*this, name, type, err_msg); if(save_okay == false) { if(err_msg.length() > 0) { arma_warn(3, "field::save(): ", err_msg, "; file: ", name); } else { arma_warn(3, "field::save(): write failed; file: ", name); } } return save_okay; } template inline bool field::save(std::ostream& os, const file_type type) const { arma_debug_sigprint(); std::string err_msg; const bool save_okay = field_aux::save(*this, os, type, err_msg); if(save_okay == false) { if(err_msg.length() > 0) { arma_warn(3, "field::save(): ", err_msg); } else { arma_warn(3, "field::save(): stream write failed"); } } return save_okay; } template inline bool field::load(const std::string name, const file_type type) { arma_debug_sigprint(); std::string err_msg; const bool load_okay = field_aux::load(*this, name, type, err_msg); if(load_okay == false) { if(err_msg.length() > 0) { arma_warn(3, "field::load(): ", err_msg, "; file: ", name); } else { arma_warn(3, "field::load(): read failed; file: ", name); } } if(load_okay == false) { (*this).reset(); } return load_okay; } template inline bool field::load(std::istream& is, const file_type type) { arma_debug_sigprint(); std::string err_msg; const bool load_okay = field_aux::load(*this, is, type, err_msg); if(load_okay == false) { if(err_msg.length() > 0) { arma_warn(3, "field::load(): ", err_msg); } else { arma_warn(3, "field::load(): stream read failed"); } } if(load_okay == false) { (*this).reset(); } return load_okay; } template inline bool field::quiet_save(const std::string name, const file_type type) const { arma_debug_sigprint(); return (*this).save(name, type); } template inline bool field::quiet_save(std::ostream& os, const file_type type) const { arma_debug_sigprint(); return (*this).save(os, type); } template inline bool field::quiet_load(const std::string name, const file_type type) { arma_debug_sigprint(); return (*this).load(name, type); } template inline bool field::quiet_load(std::istream& is, const file_type type) { arma_debug_sigprint(); return (*this).load(is, type); } //! construct a field from a given field template inline void field::init(const field& x) { arma_debug_sigprint(); if(this == &x) { arma_debug_print("field::init(): copy omitted"); return; } field& t = (*this); t.init(x.n_rows, x.n_cols, x.n_slices); const uword t_n_elem = t.n_elem; for(uword i=0; i < t_n_elem; ++i) { t.at(i) = x.at(i); } } template inline void field::init(const uword n_rows_in, const uword n_cols_in) { (*this).init(n_rows_in, n_cols_in, 1); } template inline void field::init(const uword n_rows_in, const uword n_cols_in, const uword n_slices_in) { arma_debug_sigprint( arma_str::format("n_rows_in: %u; n_cols_in: %u; n_slices_in: %u") % n_rows_in % n_cols_in % n_slices_in ); #if defined(ARMA_64BIT_WORD) const char* error_message = "field::init(): requested size is too large"; #else const char* error_message = "field::init(): requested size is too large; suggest to enable ARMA_64BIT_WORD"; #endif arma_conform_check ( ( ( (n_rows_in > 0x0FFF) || (n_cols_in > 0x0FFF) || (n_slices_in > 0xFF) ) ? ( (double(n_rows_in) * double(n_cols_in) * double(n_slices_in)) > double(ARMA_MAX_UWORD) ) : false ), error_message ); const uword n_elem_new = n_rows_in * n_cols_in * n_slices_in; if(n_elem == n_elem_new) { // delete_objects(); // create_objects(); access::rw(n_rows) = n_rows_in; access::rw(n_cols) = n_cols_in; access::rw(n_slices) = n_slices_in; } else { delete_objects(); if(n_elem > 0) { delete [] mem; } mem = nullptr; if(n_elem_new > 0) { mem = new(std::nothrow) oT* [n_elem_new]; arma_check_bad_alloc( (mem == nullptr), "field::init(): out of memory" ); } access::rw(n_rows) = n_rows_in; access::rw(n_cols) = n_cols_in; access::rw(n_slices) = n_slices_in; access::rw(n_elem) = n_elem_new; create_objects(); } } template inline void field::delete_objects() { arma_debug_sigprint( arma_str::format("n_elem: %u") % n_elem ); for(uword i=0; i inline void field::create_objects() { arma_debug_sigprint( arma_str::format("n_elem: %u") % n_elem ); for(uword i=0; i inline field::iterator::iterator(field& in_M, const bool at_end) : M(in_M) , i( (at_end == false) ? 0 : in_M.n_elem ) { arma_debug_sigprint(); } template inline oT& field::iterator::operator*() { return M[i]; } template inline typename field::iterator& field::iterator::operator++() { ++i; return *this; } template inline void field::iterator::operator++(int) { operator++(); } template inline typename field::iterator& field::iterator::operator--() { if(i > 0) { --i; } return *this; } template inline void field::iterator::operator--(int) { operator--(); } template inline bool field::iterator::operator!=(const typename field::iterator& X) const { return (i != X.i); } template inline bool field::iterator::operator==(const typename field::iterator& X) const { return (i == X.i); } template inline field::const_iterator::const_iterator(const field& in_M, const bool at_end) : M(in_M) , i( (at_end == false) ? 0 : in_M.n_elem ) { arma_debug_sigprint(); } template inline field::const_iterator::const_iterator(const typename field::iterator& X) : M(X.M) , i(X.i) { arma_debug_sigprint(); } template inline const oT& field::const_iterator::operator*() const { return M[i]; } template inline typename field::const_iterator& field::const_iterator::operator++() { ++i; return *this; } template inline void field::const_iterator::operator++(int) { operator++(); } template inline typename field::const_iterator& field::const_iterator::operator--() { if(i > 0) { --i; } return *this; } template inline void field::const_iterator::operator--(int) { operator--(); } template inline bool field::const_iterator::operator!=(const typename field::const_iterator& X) const { return (i != X.i); } template inline bool field::const_iterator::operator==(const typename field::const_iterator& X) const { return (i == X.i); } template inline typename field::iterator field::begin() { arma_debug_sigprint(); return field::iterator(*this); } template inline typename field::const_iterator field::begin() const { arma_debug_sigprint(); return field::const_iterator(*this); } template inline typename field::const_iterator field::cbegin() const { arma_debug_sigprint(); return field::const_iterator(*this); } template inline typename field::iterator field::end() { arma_debug_sigprint(); return field::iterator(*this, true); } template inline typename field::const_iterator field::end() const { arma_debug_sigprint(); return field::const_iterator(*this, true); } template inline typename field::const_iterator field::cend() const { arma_debug_sigprint(); return field::const_iterator(*this, true); } template inline void field::clear() { reset(); } template inline bool field::empty() const { return (n_elem == 0); } template inline uword field::size() const { return n_elem; } // // // template inline void field_aux::reset_objects(field& x) { arma_debug_sigprint(); x.delete_objects(); x.create_objects(); } template inline void field_aux::reset_objects(field< Mat >& x) { arma_debug_sigprint(); for(uword i=0; i < x.n_elem; ++i) { (*(x.mem[i])).reset(); } } template inline void field_aux::reset_objects(field< Col >& x) { arma_debug_sigprint(); for(uword i=0; i < x.n_elem; ++i) { (*(x.mem[i])).reset(); } } template inline void field_aux::reset_objects(field< Row >& x) { arma_debug_sigprint(); for(uword i=0; i < x.n_elem; ++i) { (*(x.mem[i])).reset(); } } template inline void field_aux::reset_objects(field< Cube >& x) { arma_debug_sigprint(); for(uword i=0; i < x.n_elem; ++i) { (*(x.mem[i])).reset(); } } inline void field_aux::reset_objects(field< std::string >& x) { arma_debug_sigprint(); for(uword i=0; i < x.n_elem; ++i) { (*(x.mem[i])).clear(); } } // // // template inline bool field_aux::save(const field&, const std::string&, const file_type, std::string& err_msg) { arma_debug_sigprint(); err_msg = "saving/loading this type of field is currently not supported"; return false; } template inline bool field_aux::save(const field&, std::ostream&, const file_type, std::string& err_msg) { arma_debug_sigprint(); err_msg = "saving/loading this type of field is currently not supported"; return false; } template inline bool field_aux::load(field&, const std::string&, const file_type, std::string& err_msg) { arma_debug_sigprint(); err_msg = "saving/loading this type of field is currently not supported"; return false; } template inline bool field_aux::load(field&, std::istream&, const file_type, std::string& err_msg) { arma_debug_sigprint(); err_msg = "saving/loading this type of field is currently not supported"; return false; } template inline bool field_aux::save(const field< Mat >& x, const std::string& name, const file_type type, std::string& err_msg) { arma_debug_sigprint(); switch(type) { case arma_binary: return diskio::save_arma_binary(x, name); break; case ppm_binary: return diskio::save_ppm_binary(x, name); break; default: err_msg = "unsupported type"; return false; } } template inline bool field_aux::save(const field< Mat >& x, std::ostream& os, const file_type type, std::string& err_msg) { arma_debug_sigprint(); switch(type) { case arma_binary: return diskio::save_arma_binary(x, os); break; case ppm_binary: return diskio::save_ppm_binary(x, os); break; default: err_msg = "unsupported type"; return false; } } template inline bool field_aux::load(field< Mat >& x, const std::string& name, const file_type type, std::string& err_msg) { arma_debug_sigprint(); switch(type) { case auto_detect: return diskio::load_auto_detect(x, name, err_msg); break; case arma_binary: return diskio::load_arma_binary(x, name, err_msg); break; case ppm_binary: return diskio::load_ppm_binary(x, name, err_msg); break; default: err_msg = "unsupported type"; return false; } } template inline bool field_aux::load(field< Mat >& x, std::istream& is, const file_type type, std::string& err_msg) { arma_debug_sigprint(); switch(type) { case auto_detect: return diskio::load_auto_detect(x, is, err_msg); break; case arma_binary: return diskio::load_arma_binary(x, is, err_msg); break; case ppm_binary: return diskio::load_ppm_binary(x, is, err_msg); break; default: err_msg = "unsupported type"; return false; } } template inline bool field_aux::save(const field< Col >& x, const std::string& name, const file_type type, std::string& err_msg) { arma_debug_sigprint(); switch(type) { case arma_binary: return diskio::save_arma_binary(x, name); break; case ppm_binary: return diskio::save_ppm_binary(x, name); break; default: err_msg = "unsupported type"; return false; } } template inline bool field_aux::save(const field< Col >& x, std::ostream& os, const file_type type, std::string& err_msg) { arma_debug_sigprint(); switch(type) { case arma_binary: return diskio::save_arma_binary(x, os); break; case ppm_binary: return diskio::save_ppm_binary(x, os); break; default: err_msg = "unsupported type"; return false; } } template inline bool field_aux::load(field< Col >& x, const std::string& name, const file_type type, std::string& err_msg) { arma_debug_sigprint(); switch(type) { case auto_detect: return diskio::load_auto_detect(x, name, err_msg); break; case arma_binary: return diskio::load_arma_binary(x, name, err_msg); break; case ppm_binary: return diskio::load_ppm_binary(x, name, err_msg); break; default: err_msg = "unsupported type"; return false; } } template inline bool field_aux::load(field< Col >& x, std::istream& is, const file_type type, std::string& err_msg) { arma_debug_sigprint(); switch(type) { case auto_detect: return diskio::load_auto_detect(x, is, err_msg); break; case arma_binary: return diskio::load_arma_binary(x, is, err_msg); break; case ppm_binary: return diskio::load_ppm_binary(x, is, err_msg); break; default: err_msg = "unsupported type"; return false; } } template inline bool field_aux::save(const field< Row >& x, const std::string& name, const file_type type, std::string& err_msg) { arma_debug_sigprint(); switch(type) { case arma_binary: return diskio::save_arma_binary(x, name); break; case ppm_binary: return diskio::save_ppm_binary(x, name); break; default: err_msg = "unsupported type"; return false; } } template inline bool field_aux::save(const field< Row >& x, std::ostream& os, const file_type type, std::string& err_msg) { arma_debug_sigprint(); switch(type) { case arma_binary: return diskio::save_arma_binary(x, os); break; case ppm_binary: return diskio::save_ppm_binary(x, os); break; default: err_msg = "unsupported type"; return false; } } template inline bool field_aux::load(field< Row >& x, const std::string& name, const file_type type, std::string& err_msg) { arma_debug_sigprint(); switch(type) { case auto_detect: return diskio::load_auto_detect(x, name, err_msg); break; case arma_binary: return diskio::load_arma_binary(x, name, err_msg); break; case ppm_binary: return diskio::load_ppm_binary(x, name, err_msg); break; default: err_msg = "unsupported type"; return false; } } template inline bool field_aux::load(field< Row >& x, std::istream& is, const file_type type, std::string& err_msg) { arma_debug_sigprint(); switch(type) { case auto_detect: return diskio::load_auto_detect(x, is, err_msg); break; case arma_binary: return diskio::load_arma_binary(x, is, err_msg); break; case ppm_binary: return diskio::load_ppm_binary(x, is, err_msg); break; default: err_msg = "unsupported type"; return false; } } template inline bool field_aux::save(const field< Cube >& x, const std::string& name, const file_type type, std::string& err_msg) { arma_debug_sigprint(); switch(type) { case arma_binary: return diskio::save_arma_binary(x, name); break; default: err_msg = "unsupported type"; return false; } } template inline bool field_aux::save(const field< Cube >& x, std::ostream& os, const file_type type, std::string& err_msg) { arma_debug_sigprint(); switch(type) { case arma_binary: return diskio::save_arma_binary(x, os); break; default: err_msg = "unsupported type"; return false; } } template inline bool field_aux::load(field< Cube >& x, const std::string& name, const file_type type, std::string& err_msg) { arma_debug_sigprint(); switch(type) { case auto_detect: case arma_binary: return diskio::load_arma_binary(x, name, err_msg); break; default: err_msg = "unsupported type"; return false; } } template inline bool field_aux::load(field< Cube >& x, std::istream& is, const file_type type, std::string& err_msg) { arma_debug_sigprint(); switch(type) { case auto_detect: case arma_binary: return diskio::load_arma_binary(x, is, err_msg); break; default: err_msg = "unsupported type"; return false; } } inline bool field_aux::save(const field< std::string >& x, const std::string& name, const file_type type, std::string& err_msg) { arma_debug_sigprint(); arma_ignore(type); err_msg.clear(); return diskio::save_std_string(x, name); } inline bool field_aux::save(const field< std::string >& x, std::ostream& os, const file_type type, std::string& err_msg) { arma_debug_sigprint(); arma_ignore(type); err_msg.clear(); return diskio::save_std_string(x, os); } inline bool field_aux::load(field< std::string >& x, const std::string& name, const file_type type, std::string& err_msg) { arma_debug_sigprint(); arma_ignore(type); return diskio::load_std_string(x, name, err_msg); } inline bool field_aux::load(field< std::string >& x, std::istream& is, const file_type type, std::string& err_msg) { arma_debug_sigprint(); arma_ignore(type); return diskio::load_std_string(x, is, err_msg); } #if defined(ARMA_EXTRA_FIELD_MEAT) #include ARMA_INCFILE_WRAP(ARMA_EXTRA_FIELD_MEAT) #endif //! @} RcppArmadillo/inst/include/armadillo_bits/fn_zeros.hpp0000644000176200001440000001112314631567470022741 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_zeros //! @{ arma_warn_unused arma_inline const Gen zeros(const uword n_elem) { arma_debug_sigprint(); return Gen(n_elem, 1); } template arma_warn_unused arma_inline const Gen zeros(const uword n_elem, const arma_empty_class junk1 = arma_empty_class(), const typename arma_Mat_Col_Row_only::result* junk2 = nullptr) { arma_debug_sigprint(); arma_ignore(junk1); arma_ignore(junk2); const uword n_rows = (is_Row::value) ? uword(1) : n_elem; const uword n_cols = (is_Row::value) ? n_elem : uword(1); return Gen(n_rows, n_cols); } arma_warn_unused arma_inline const Gen zeros(const uword n_rows, const uword n_cols) { arma_debug_sigprint(); return Gen(n_rows, n_cols); } arma_warn_unused arma_inline const Gen zeros(const SizeMat& s) { arma_debug_sigprint(); return Gen(s.n_rows, s.n_cols); } template arma_warn_unused arma_inline const Gen zeros(const uword n_rows, const uword n_cols, const typename arma_Mat_Col_Row_only::result* junk = nullptr) { arma_debug_sigprint(); arma_ignore(junk); if(is_Col::value) { arma_conform_check( (n_cols != 1), "zeros(): incompatible size" ); } if(is_Row::value) { arma_conform_check( (n_rows != 1), "zeros(): incompatible size" ); } return Gen(n_rows, n_cols); } template arma_warn_unused arma_inline const Gen zeros(const SizeMat& s, const typename arma_Mat_Col_Row_only::result* junk = nullptr) { arma_debug_sigprint(); arma_ignore(junk); return zeros(s.n_rows, s.n_cols); } arma_warn_unused arma_inline const GenCube zeros(const uword n_rows, const uword n_cols, const uword n_slices) { arma_debug_sigprint(); return GenCube(n_rows, n_cols, n_slices); } arma_warn_unused arma_inline const GenCube zeros(const SizeCube& s) { arma_debug_sigprint(); return GenCube(s.n_rows, s.n_cols, s.n_slices); } template arma_warn_unused arma_inline const GenCube zeros(const uword n_rows, const uword n_cols, const uword n_slices, const typename arma_Cube_only::result* junk = nullptr) { arma_debug_sigprint(); arma_ignore(junk); return GenCube(n_rows, n_cols, n_slices); } template arma_warn_unused arma_inline const GenCube zeros(const SizeCube& s, const typename arma_Cube_only::result* junk = nullptr) { arma_debug_sigprint(); arma_ignore(junk); return GenCube(s.n_rows, s.n_cols, s.n_slices); } template arma_warn_unused inline sp_obj_type zeros(const uword n_rows, const uword n_cols, const typename arma_SpMat_SpCol_SpRow_only::result* junk = nullptr) { arma_debug_sigprint(); arma_ignore(junk); if(is_SpCol::value) { arma_conform_check( (n_cols != 1), "zeros(): incompatible size" ); } if(is_SpRow::value) { arma_conform_check( (n_rows != 1), "zeros(): incompatible size" ); } return sp_obj_type(n_rows, n_cols); } template arma_warn_unused inline sp_obj_type zeros(const SizeMat& s, const typename arma_SpMat_SpCol_SpRow_only::result* junk = nullptr) { arma_debug_sigprint(); arma_ignore(junk); return zeros(s.n_rows, s.n_cols); } //! @} RcppArmadillo/inst/include/armadillo_bits/spop_shift_bones.hpp0000644000176200001440000000204414560505601024447 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup spop_shift //! @{ class spop_shift : public traits_op_default { public: template inline static void apply_noalias(SpMat& out, const SpMat& X, const uword len, const uword neg, const uword dim); }; //! @} RcppArmadillo/inst/include/armadillo_bits/operator_cube_relational.hpp0000644000176200001440000001642614631567470026172 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup operator_cube_relational //! @{ // < : lt // > : gt // <= : lteq // >= : gteq // == : eq // != : noteq // && : and // || : or template inline const mtGlueCube operator< (const BaseCube::result,T1>& X, const BaseCube::result,T2>& Y) { arma_debug_sigprint(); return mtGlueCube( X.get_ref(), Y.get_ref() ); } template inline const mtGlueCube operator> (const BaseCube::result,T1>& X, const BaseCube::result,T2>& Y) { arma_debug_sigprint(); return mtGlueCube( X.get_ref(), Y.get_ref() ); } template inline const mtGlueCube operator<= (const BaseCube::result,T1>& X, const BaseCube::result,T2>& Y) { arma_debug_sigprint(); return mtGlueCube( X.get_ref(), Y.get_ref() ); } template inline const mtGlueCube operator>= (const BaseCube::result,T1>& X, const BaseCube::result,T2>& Y) { arma_debug_sigprint(); return mtGlueCube( X.get_ref(), Y.get_ref() ); } template inline const mtGlueCube operator== (const BaseCube& X, const BaseCube& Y) { arma_debug_sigprint(); return mtGlueCube( X.get_ref(), Y.get_ref() ); } template inline const mtGlueCube operator!= (const BaseCube& X, const BaseCube& Y) { arma_debug_sigprint(); return mtGlueCube( X.get_ref(), Y.get_ref() ); } template inline const mtGlueCube operator&& (const BaseCube::result,T1>& X, const BaseCube::result,T2>& Y) { arma_debug_sigprint(); return mtGlueCube( X.get_ref(), Y.get_ref() ); } template inline const mtGlueCube operator|| (const BaseCube::result,T1>& X, const BaseCube::result,T2>& Y) { arma_debug_sigprint(); return mtGlueCube( X.get_ref(), Y.get_ref() ); } // // // template inline const mtOpCube operator< (const typename arma_not_cx::result val, const BaseCube::result,T1>& X) { arma_debug_sigprint(); return mtOpCube(X.get_ref(), val); } template inline const mtOpCube operator< (const BaseCube::result,T1>& X, const typename arma_not_cx::result val) { arma_debug_sigprint(); return mtOpCube(X.get_ref(), val); } template inline const mtOpCube operator> (const typename arma_not_cx::result val, const BaseCube::result,T1>& X) { arma_debug_sigprint(); return mtOpCube(X.get_ref(), val); } template inline const mtOpCube operator> (const BaseCube::result,T1>& X, const typename arma_not_cx::result val) { arma_debug_sigprint(); return mtOpCube(X.get_ref(), val); } template inline const mtOpCube operator<= (const typename arma_not_cx::result val, const BaseCube::result,T1>& X) { arma_debug_sigprint(); return mtOpCube(X.get_ref(), val); } template inline const mtOpCube operator<= (const BaseCube::result,T1>& X, const typename arma_not_cx::result val) { arma_debug_sigprint(); return mtOpCube(X.get_ref(), val); } template inline const mtOpCube operator>= (const typename arma_not_cx::result val, const BaseCube::result,T1>& X) { arma_debug_sigprint(); return mtOpCube(X.get_ref(), val); } template inline const mtOpCube operator>= (const BaseCube::result,T1>& X, const typename arma_not_cx::result val) { arma_debug_sigprint(); return mtOpCube(X.get_ref(), val); } template inline const mtOpCube operator== (const typename T1::elem_type val, const BaseCube& X) { arma_debug_sigprint(); return mtOpCube(X.get_ref(), val); } template inline const mtOpCube operator== (const BaseCube& X, const typename T1::elem_type val) { arma_debug_sigprint(); return mtOpCube(X.get_ref(), val); } template inline const mtOpCube operator!= (const typename T1::elem_type val, const BaseCube& X) { arma_debug_sigprint(); return mtOpCube(X.get_ref(), val); } template inline const mtOpCube operator!= (const BaseCube& X, const typename T1::elem_type val) { arma_debug_sigprint(); return mtOpCube(X.get_ref(), val); } //! @} RcppArmadillo/inst/include/armadillo_bits/gmm_misc_meat.hpp0000644000176200001440000000605314631567470023723 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup gmm_misc //! @{ namespace gmm_priv { template inline running_mean_scalar::running_mean_scalar() : counter(uword(0)) , r_mean ( eT(0)) { arma_debug_sigprint_this(this); } template inline running_mean_scalar::running_mean_scalar(const running_mean_scalar& in) : counter(in.counter) , r_mean (in.r_mean ) { arma_debug_sigprint_this(this); } template inline const running_mean_scalar& running_mean_scalar::operator=(const running_mean_scalar& in) { arma_debug_sigprint(); counter = in.counter; r_mean = in.r_mean; return *this; } template inline void running_mean_scalar::operator() (const eT X) { arma_debug_sigprint(); counter++; if(counter > 1) { const eT old_r_mean = r_mean; r_mean = old_r_mean + (X - old_r_mean)/counter; } else { r_mean = X; } } template inline void running_mean_scalar::reset() { arma_debug_sigprint(); counter = 0; r_mean = eT(0); } template inline uword running_mean_scalar::count() const { return counter; } template inline eT running_mean_scalar::mean() const { return r_mean; } // // // template arma_inline eT distance::eval(const uword N, const eT* A, const eT* B, const eT*) { eT acc1 = eT(0); eT acc2 = eT(0); uword i,j; for(i=0, j=1; j arma_inline eT distance::eval(const uword N, const eT* A, const eT* B, const eT* C) { eT acc1 = eT(0); eT acc2 = eT(0); uword i,j; for(i=0, j=1; j inline static void apply(SpMat& out, const SpGlue& X); template inline static void apply_noalias(SpMat& result, const SpProxy& pa, const SpProxy& pb); template inline static void apply_noalias(SpMat& out, const SpMat& A, const SpMat& B); }; class spglue_minus_mixed : public traits_glue_or { public: template inline static void apply(SpMat::eT>& out, const mtSpGlue::eT, T1, T2, spglue_minus_mixed>& expr); template inline static void sparse_minus_dense(Mat< typename promote_type::result>& out, const T1& X, const T2& Y); template inline static void dense_minus_sparse(Mat< typename promote_type::result>& out, const T1& X, const T2& Y); }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_sp_stddev_meat.hpp0000644000176200001440000001076514634016465024622 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_sp_stddev //! @{ template inline void op_sp_stddev::apply(Mat& out, const mtSpReduceOp& in) { arma_debug_sigprint(); const uword norm_type = in.aux_uword_a; const uword dim = in.aux_uword_b; arma_conform_check( (norm_type > 1), "stddev(): parameter 'norm_type' must be 0 or 1" ); arma_conform_check( (dim > 1), "stddev(): parameter 'dim' must be 0 or 1" ); const SpProxy p(in.m); const uword p_n_rows = p.get_n_rows(); const uword p_n_cols = p.get_n_cols(); if( (p_n_rows == 0) || (p_n_cols == 0) || (p.get_n_nonzero() == 0) ) { if(dim == 0) { out.zeros((p_n_rows > 0) ? 1 : 0, p_n_cols); } if(dim == 1) { out.zeros(p_n_rows, (p_n_cols > 0) ? 1 : 0); } return; } op_sp_stddev::apply_slow(out, p, norm_type, dim); } template inline void op_sp_stddev::apply_slow ( Mat& out, const SpProxy& p, const uword norm_type, const uword dim ) { arma_debug_sigprint(); typedef typename T1::elem_type in_eT; //typedef typename T1::pod_type out_eT; const uword p_n_rows = p.get_n_rows(); const uword p_n_cols = p.get_n_cols(); if(dim == 0) // find variance in each column { arma_debug_print("op_sp_stddev::apply_slow(): dim = 0"); out.zeros(1, p_n_cols); for(uword col = 0; col < p_n_cols; ++col) { if(SpProxy::use_iterator) { // We must use an iterator; we can't access memory directly. typename SpProxy::const_iterator_type it = p.begin_col(col); typename SpProxy::const_iterator_type end = p.begin_col(col + 1); const uword n_zero = p_n_rows - (end.pos() - it.pos()); // in_eT is used just to get the specialization right (complex / noncomplex) out.at(0, col) = std::sqrt( op_sp_var::iterator_var(it, end, n_zero, norm_type, in_eT(0)) ); } else { // We can use direct memory access to calculate the variance. out.at(0, col) = std::sqrt( op_sp_var::direct_var ( &p.get_values()[p.get_col_ptrs()[col]], p.get_col_ptrs()[col + 1] - p.get_col_ptrs()[col], p_n_rows, norm_type ) ); } } } else if(dim == 1) // find variance in each row { arma_debug_print("op_sp_stddev::apply_slow(): dim = 1"); out.zeros(p_n_rows, 1); for(uword row = 0; row < p_n_rows; ++row) { // We have to use an iterator here regardless of whether or not we can // directly access memory. typename SpProxy::const_row_iterator_type it = p.begin_row(row); typename SpProxy::const_row_iterator_type end = p.end_row(row); const uword n_zero = p_n_cols - (end.pos() - it.pos()); out.at(row, 0) = std::sqrt( op_sp_var::iterator_var(it, end, n_zero, norm_type, in_eT(0)) ); } } } template inline typename T1::pod_type op_sp_stddev::stddev_vec ( const T1& X, const uword norm_type ) { arma_debug_sigprint(); typedef typename T1::pod_type T; arma_conform_check( (norm_type > 1), "stddev(): parameter 'norm_type' must be 0 or 1" ); // conditionally unwrap it into a temporary and then directly operate. const unwrap_spmat tmp(X); if(tmp.M.n_elem == 0) { arma_conform_check(true, "stddev(): object has no elements"); return Datum::nan; } return std::sqrt( op_sp_var::direct_var(tmp.M.values, tmp.M.n_nonzero, tmp.M.n_elem, norm_type) ); } //! @} RcppArmadillo/inst/include/armadillo_bits/spsolve_factoriser_meat.hpp0000644000176200001440000001545714635324415026046 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup spsolve_factoriser //! @{ template inline void spsolve_factoriser::delete_worker() { arma_debug_sigprint(); if(worker_ptr != nullptr) { worker_type* ptr = reinterpret_cast(worker_ptr); delete ptr; worker_ptr = nullptr; } } inline void spsolve_factoriser::cleanup() { arma_debug_sigprint(); #if defined(ARMA_USE_SUPERLU) { if(elem_type_indicator == 1) { delete_worker< superlu_worker< float> >(); } else if(elem_type_indicator == 2) { delete_worker< superlu_worker< double> >(); } else if(elem_type_indicator == 3) { delete_worker< superlu_worker< cx_float> >(); } else if(elem_type_indicator == 4) { delete_worker< superlu_worker >(); } } #endif worker_ptr = nullptr; elem_type_indicator = 0; n_rows = 0; rcond_value = double(0); } inline spsolve_factoriser::~spsolve_factoriser() { arma_debug_sigprint_this(this); cleanup(); } inline spsolve_factoriser::spsolve_factoriser() { arma_debug_sigprint_this(this); } inline void spsolve_factoriser::reset() { arma_debug_sigprint(); cleanup(); } inline double spsolve_factoriser::rcond() const { arma_debug_sigprint(); return rcond_value; } template inline bool spsolve_factoriser::factorise ( const SpBase& A_expr, const spsolve_opts_base& settings, const typename arma_blas_type_only::result* junk ) { arma_debug_sigprint(); arma_ignore(junk); #if defined(ARMA_USE_SUPERLU) { typedef typename T1::elem_type eT; typedef typename get_pod_type::result T; typedef superlu_worker worker_type; // cleanup(); // const unwrap_spmat U(A_expr.get_ref()); const SpMat& A = U.M; if(A.is_square() == false) { arma_warn(1, "spsolve_factoriser::factorise(): solving under-determined / over-determined systems is currently not supported"); return false; } n_rows = A.n_rows; // superlu_opts superlu_opts_default; const superlu_opts& opts = (settings.id == 1) ? static_cast(settings) : superlu_opts_default; if( (opts.pivot_thresh < double(0)) || (opts.pivot_thresh > double(1)) ) { arma_warn(1, "spsolve_factoriser::factorise(): pivot_thresh must be in the [0,1] interval" ); return false; } // worker_ptr = new(std::nothrow) worker_type; if(worker_ptr == nullptr) { arma_warn(3, "spsolve_factoriser::factorise(): could not construct worker object"); return false; } // if( is_float::value) { elem_type_indicator = 1; } else if( is_double::value) { elem_type_indicator = 2; } else if( is_cx_float::value) { elem_type_indicator = 3; } else if(is_cx_double::value) { elem_type_indicator = 4; } // worker_type* local_worker_ptr = reinterpret_cast(worker_ptr); worker_type& local_worker_ref = (*local_worker_ptr); // T local_rcond_value = T(0); const bool status = local_worker_ref.factorise(local_rcond_value, A, opts); rcond_value = double(local_rcond_value); if( (status == false) || arma_isnan(local_rcond_value) || ((opts.allow_ugly == false) && (local_rcond_value < std::numeric_limits::epsilon())) ) { arma_warn(3, "spsolve_factoriser::factorise(): factorisation failed; rcond: ", local_rcond_value); delete_worker(); return false; } return true; } #else { arma_ignore(A_expr); arma_ignore(settings); arma_stop_logic_error("spsolve_factoriser::factorise(): use of SuperLU must be enabled"); return false; } #endif } template inline bool spsolve_factoriser::solve ( Mat& X, const Base& B_expr, const typename arma_blas_type_only::result* junk ) { arma_debug_sigprint(); arma_ignore(junk); #if defined(ARMA_USE_SUPERLU) { typedef typename T1::elem_type eT; typedef superlu_worker worker_type; if(worker_ptr == nullptr) { arma_warn(2, "spsolve_factoriser::solve(): no factorisation available"); X.soft_reset(); return false; } bool type_mismatch = false; if( (is_float::value) && (elem_type_indicator != 1) ) { type_mismatch = true; } else if( (is_double::value) && (elem_type_indicator != 2) ) { type_mismatch = true; } else if( (is_cx_float::value) && (elem_type_indicator != 3) ) { type_mismatch = true; } else if((is_cx_double::value) && (elem_type_indicator != 4) ) { type_mismatch = true; } if(type_mismatch) { arma_warn(1, "spsolve_factoriser::solve(): matrix type mismatch"); X.soft_reset(); return false; } const quasi_unwrap U(B_expr.get_ref()); const Mat& B = U.M; if(n_rows != B.n_rows) { arma_warn(1, "spsolve_factoriser::solve(): matrix size mismatch"); X.soft_reset(); return false; } const bool is_alias = U.is_alias(X); Mat tmp; Mat& out = is_alias ? tmp : X; worker_type* local_worker_ptr = reinterpret_cast(worker_ptr); worker_type& local_worker_ref = (*local_worker_ptr); const bool status = local_worker_ref.solve(out,B); if(is_alias) { X.steal_mem(tmp); } if(status == false) { arma_warn(3, "spsolve_factoriser::solve(): solution not found"); X.soft_reset(); return false; } return true; } #else { arma_ignore(X); arma_ignore(B_expr); arma_stop_logic_error("spsolve_factoriser::solve(): use of SuperLU must be enabled"); return false; } #endif } //! @} RcppArmadillo/inst/include/armadillo_bits/gmm_diag_bones.hpp0000644000176200001440000001613214301267043024036 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup gmm_diag //! @{ namespace gmm_priv { template class gmm_diag { public: arma_aligned const Mat means; arma_aligned const Mat dcovs; arma_aligned const Row hefts; // // inline ~gmm_diag(); inline gmm_diag(); inline gmm_diag(const gmm_diag& x); inline gmm_diag& operator=(const gmm_diag& x); inline explicit gmm_diag(const gmm_full& x); inline gmm_diag& operator=(const gmm_full& x); inline gmm_diag(const uword in_n_dims, const uword in_n_gaus); inline void reset(const uword in_n_dims, const uword in_n_gaus); inline void reset(); template inline void set_params(const Base& in_means, const Base& in_dcovs, const Base& in_hefts); template inline void set_means(const Base& in_means); template inline void set_dcovs(const Base& in_dcovs); template inline void set_hefts(const Base& in_hefts); inline uword n_dims() const; inline uword n_gaus() const; inline bool load(const std::string name); inline bool save(const std::string name) const; inline Col generate() const; inline Mat generate(const uword N) const; template inline eT log_p(const T1& expr, const gmm_empty_arg& junk1 = gmm_empty_arg(), typename enable_if<((is_arma_type::value) && (resolves_to_colvector::value == true ))>::result* junk2 = nullptr) const; template inline eT log_p(const T1& expr, const uword gaus_id, typename enable_if<((is_arma_type::value) && (resolves_to_colvector::value == true ))>::result* junk2 = nullptr) const; template inline Row log_p(const T1& expr, const gmm_empty_arg& junk1 = gmm_empty_arg(), typename enable_if<((is_arma_type::value) && (resolves_to_colvector::value == false))>::result* junk2 = nullptr) const; template inline Row log_p(const T1& expr, const uword gaus_id, typename enable_if<((is_arma_type::value) && (resolves_to_colvector::value == false))>::result* junk2 = nullptr) const; template inline eT sum_log_p(const Base& expr) const; template inline eT sum_log_p(const Base& expr, const uword gaus_id) const; template inline eT avg_log_p(const Base& expr) const; template inline eT avg_log_p(const Base& expr, const uword gaus_id) const; template inline uword assign(const T1& expr, const gmm_dist_mode& dist, typename enable_if<((is_arma_type::value) && (resolves_to_colvector::value == true ))>::result* junk = nullptr) const; template inline urowvec assign(const T1& expr, const gmm_dist_mode& dist, typename enable_if<((is_arma_type::value) && (resolves_to_colvector::value == false))>::result* junk = nullptr) const; template inline urowvec raw_hist(const Base& expr, const gmm_dist_mode& dist_mode) const; template inline Row norm_hist(const Base& expr, const gmm_dist_mode& dist_mode) const; template inline bool learn ( const Base& data, const uword n_gaus, const gmm_dist_mode& dist_mode, const gmm_seed_mode& seed_mode, const uword km_iter, const uword em_iter, const eT var_floor, const bool print_mode ); template inline bool kmeans_wrapper ( Mat& user_means, const Base& data, const uword n_gaus, const gmm_seed_mode& seed_mode, const uword km_iter, const bool print_mode ); // protected: arma_aligned Mat inv_dcovs; arma_aligned Row log_det_etc; arma_aligned Row log_hefts; arma_aligned Col mah_aux; // inline void init(const gmm_diag& x); inline void init(const gmm_full& x); inline void init(const uword in_n_dim, const uword in_n_gaus); inline void init_constants(); inline umat internal_gen_boundaries(const uword N) const; inline eT internal_scalar_log_p(const eT* x ) const; inline eT internal_scalar_log_p(const eT* x, const uword gaus_id) const; inline Row internal_vec_log_p(const Mat& X ) const; inline Row internal_vec_log_p(const Mat& X, const uword gaus_id) const; inline eT internal_sum_log_p(const Mat& X ) const; inline eT internal_sum_log_p(const Mat& X, const uword gaus_id) const; inline eT internal_avg_log_p(const Mat& X ) const; inline eT internal_avg_log_p(const Mat& X, const uword gaus_id) const; inline uword internal_scalar_assign(const Mat& X, const gmm_dist_mode& dist_mode) const; inline void internal_vec_assign(urowvec& out, const Mat& X, const gmm_dist_mode& dist_mode) const; inline void internal_raw_hist(urowvec& hist, const Mat& X, const gmm_dist_mode& dist_mode) const; // template inline void generate_initial_means(const Mat& X, const gmm_seed_mode& seed); template inline void generate_initial_params(const Mat& X, const eT var_floor); template inline bool km_iterate(const Mat& X, const uword max_iter, const bool verbose, const char* signature); // inline bool em_iterate(const Mat& X, const uword max_iter, const eT var_floor, const bool verbose); inline void em_update_params(const Mat& X, const umat& boundaries, field< Mat >& t_acc_means, field< Mat >& t_acc_dcovs, field< Col >& t_acc_norm_lhoods, field< Col >& t_gaus_log_lhoods, Col& t_progress_log_lhoods); inline void em_generate_acc(const Mat& X, const uword start_index, const uword end_index, Mat& acc_means, Mat& acc_dcovs, Col& acc_norm_lhoods, Col& gaus_log_lhoods, eT& progress_log_lhood) const; inline void em_fix_params(const eT var_floor); }; } typedef gmm_priv::gmm_diag gmm_diag; typedef gmm_priv::gmm_diag fgmm_diag; //! @} RcppArmadillo/inst/include/armadillo_bits/newarp_UpperHessenbergQR_meat.hpp0000644000176200001440000001636314631567470027055 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ namespace newarp { template inline UpperHessenbergQR::UpperHessenbergQR() : n(0) , computed(false) { arma_debug_sigprint(); } template inline UpperHessenbergQR::UpperHessenbergQR(const Mat& mat_obj) : n(mat_obj.n_rows) , mat_T(n, n) , rot_cos(n - 1) , rot_sin(n - 1) , computed(false) { arma_debug_sigprint(); compute(mat_obj); } template void UpperHessenbergQR::compute(const Mat& mat_obj) { arma_debug_sigprint(); n = mat_obj.n_rows; mat_T.set_size(n, n); rot_cos.set_size(n - 1); rot_sin.set_size(n - 1); // Make a copy of mat_obj mat_T = mat_obj; eT xi, xj, r, c, s, eps = std::numeric_limits::epsilon(); eT *ptr; for(uword i = 0; i < n - 1; i++) { // Make sure mat_T is upper Hessenberg // Zero the elements below mat_T(i + 1, i) if(i < n - 2) { mat_T(span(i + 2, n - 1), i).zeros(); } xi = mat_T(i, i); // mat_T(i, i) xj = mat_T(i + 1, i); // mat_T(i + 1, i) r = arma_hypot(xi, xj); if(r <= eps) { r = 0; rot_cos(i) = c = 1; rot_sin(i) = s = 0; } else { rot_cos(i) = c = xi / r; rot_sin(i) = s = -xj / r; } // For a complete QR decomposition, // we first obtain the rotation matrix // G = [ cos sin] // [-sin cos] // and then do T[i:(i + 1), i:(n - 1)] = G' * T[i:(i + 1), i:(n - 1)] // mat_T.submat(i, i, i + 1, n - 1) = Gt * mat_T.submat(i, i, i + 1, n - 1); mat_T(i, i) = r; // mat_T(i, i) => r mat_T(i + 1, i) = 0; // mat_T(i + 1, i) => 0 ptr = &mat_T(i, i + 1); // mat_T(i, k), k = i+1, i+2, ..., n-1 for(uword j = i + 1; j < n; j++, ptr += n) { eT tmp = ptr[0]; ptr[0] = c * tmp - s * ptr[1]; ptr[1] = s * tmp + c * ptr[1]; } } computed = true; } template Mat UpperHessenbergQR::matrix_RQ() { arma_debug_sigprint(); arma_conform_check( (computed == false), "newarp::UpperHessenbergQR::matrix_RQ(): need to call compute() first" ); // Make a copy of the R matrix Mat RQ = trimatu(mat_T); for(uword i = 0; i < n - 1; i++) { // RQ[, i:(i + 1)] = RQ[, i:(i + 1)] * Gi // Gi = [ cos[i] sin[i]] // [-sin[i] cos[i]] const eT c = rot_cos(i); const eT s = rot_sin(i); eT *Yi, *Yi1; Yi = RQ.colptr(i); Yi1 = RQ.colptr(i + 1); for(uword j = 0; j < i + 2; j++) { eT tmp = Yi[j]; Yi[j] = c * tmp - s * Yi1[j]; Yi1[j] = s * tmp + c * Yi1[j]; } /* Yi = RQ(span(0, i + 1), i); RQ(span(0, i + 1), i) = (*c) * Yi - (*s) * RQ(span(0, i + 1), i + 1); RQ(span(0, i + 1), i + 1) = (*s) * Yi + (*c) * RQ(span(0, i + 1), i + 1); */ } return RQ; } template inline void UpperHessenbergQR::apply_YQ(Mat& Y) { arma_debug_sigprint(); arma_conform_check( (computed == false), "newarp::UpperHessenbergQR::apply_YQ(): need to call compute() first" ); eT *Y_col_i, *Y_col_i1; uword nrow = Y.n_rows; for(uword i = 0; i < n - 1; i++) { const eT c = rot_cos(i); const eT s = rot_sin(i); Y_col_i = Y.colptr(i); Y_col_i1 = Y.colptr(i + 1); for(uword j = 0; j < nrow; j++) { eT tmp = Y_col_i[j]; Y_col_i[j] = c * tmp - s * Y_col_i1[j]; Y_col_i1[j] = s * tmp + c * Y_col_i1[j]; } } } template inline TridiagQR::TridiagQR() : UpperHessenbergQR() { arma_debug_sigprint(); } template inline TridiagQR::TridiagQR(const Mat& mat_obj) : UpperHessenbergQR() { arma_debug_sigprint(); this->compute(mat_obj); } template inline void TridiagQR::compute(const Mat& mat_obj) { arma_debug_sigprint(); this->n = mat_obj.n_rows; this->mat_T.set_size(this->n, this->n); this->rot_cos.set_size(this->n - 1); this->rot_sin.set_size(this->n - 1); this->mat_T.zeros(); this->mat_T.diag() = mat_obj.diag(); this->mat_T.diag(1) = mat_obj.diag(-1); this->mat_T.diag(-1) = mat_obj.diag(-1); eT xi, xj, r, c, s, tmp, eps = std::numeric_limits::epsilon(); eT *ptr; // A number of pointers to avoid repeated address calculation for(uword i = 0; i < this->n - 1; i++) { xi = this->mat_T(i, i); // mat_T(i, i) xj = this->mat_T(i + 1, i); // mat_T(i + 1, i) r = arma_hypot(xi, xj); if(r <= eps) { r = 0; this->rot_cos(i) = c = 1; this->rot_sin(i) = s = 0; } else { this->rot_cos(i) = c = xi / r; this->rot_sin(i) = s = -xj / r; } // For a complete QR decomposition, // we first obtain the rotation matrix // G = [ cos sin] // [-sin cos] // and then do T[i:(i + 1), i:(i + 2)] = G' * T[i:(i + 1), i:(i + 2)] // Update T[i, i] and T[i + 1, i] // The updated value of T[i, i] is known to be r // The updated value of T[i + 1, i] is known to be 0 this->mat_T(i, i) = r; this->mat_T(i + 1, i) = 0; // Update T[i, i + 1] and T[i + 1, i + 1] // ptr[0] == T[i, i + 1] // ptr[1] == T[i + 1, i + 1] ptr = &(this->mat_T(i, i + 1)); tmp = *ptr; ptr[0] = c * tmp - s * ptr[1]; ptr[1] = s * tmp + c * ptr[1]; if(i < this->n - 2) { // Update T[i, i + 2] and T[i + 1, i + 2] // ptr[0] == T[i, i + 2] == 0 // ptr[1] == T[i + 1, i + 2] ptr = &(this->mat_T(i, i + 2)); ptr[0] = -s * ptr[1]; ptr[1] *= c; } } this->computed = true; } template Mat TridiagQR::matrix_RQ() { arma_debug_sigprint(); arma_conform_check( (this->computed == false), "newarp::TridiagQR::matrix_RQ(): need to call compute() first" ); // Make a copy of the R matrix Mat RQ(this->n, this->n, arma_zeros_indicator()); RQ.diag() = this->mat_T.diag(); RQ.diag(1) = this->mat_T.diag(1); // [m11 m12] will point to RQ[i:(i+1), i:(i+1)] // [m21 m22] eT *m11 = RQ.memptr(), *m12, *m21, *m22, tmp; for(uword i = 0; i < this->n - 1; i++) { const eT c = this->rot_cos(i); const eT s = this->rot_sin(i); m21 = m11 + 1; m12 = m11 + this->n; m22 = m12 + 1; tmp = *m21; // Update diagonal and the below-subdiagonal *m11 = c * (*m11) - s * (*m12); *m21 = c * tmp - s * (*m22); *m22 = s * tmp + c * (*m22); // Move m11 to RQ[i+1, i+1] m11 = m22; } // Copy the below-subdiagonal to above-subdiagonal RQ.diag(1) = RQ.diag(-1); return RQ; } } // namespace newarp RcppArmadillo/inst/include/armadillo_bits/fn_omit.hpp0000644000176200001440000000425615030507611022541 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_omit //! @{ template arma_warn_unused inline typename enable_if2< is_arma_type::value, const Op >::result omit_nan(const T1& X) { arma_debug_sigprint(); return Op(X, 1, 0); } template arma_warn_unused inline typename enable_if2< is_arma_type::value, const Op >::result omit_nonfinite(const T1& X) { arma_debug_sigprint(); return Op(X, 2, 0); } template arma_warn_unused inline CubeToMatOp omit_nan(const BaseCube& X) { arma_debug_sigprint(); return CubeToMatOp(X.get_ref(), 1); } template arma_warn_unused inline CubeToMatOp omit_nonfinite(const BaseCube& X) { arma_debug_sigprint(); return CubeToMatOp(X.get_ref(), 2); } template arma_warn_unused inline typename enable_if2< is_arma_sparse_type::value, const SpOp >::result omit_nan(const T1& X) { arma_debug_sigprint(); return SpOp(X, 1, 0); } template arma_warn_unused inline typename enable_if2< is_arma_sparse_type::value, const SpOp >::result omit_nonfinite(const T1& X) { arma_debug_sigprint(); return SpOp(X, 2, 0); } //! @} RcppArmadillo/inst/include/armadillo_bits/glue_min_meat.hpp0000644000176200001440000001030414631567470023721 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup glue_min //! @{ template inline void glue_min::apply(Mat& out, const Glue& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const Proxy PA(X.A); const Proxy PB(X.B); if( (PA.is_alias(out) && PA.has_subview) || (PB.is_alias(out) && PB.has_subview) ) { Mat tmp; glue_min::apply(tmp, PA, PB); out.steal_mem(tmp); } else { glue_min::apply(out, PA, PB); } } template inline void glue_min::apply(Mat& out, const Proxy& PA, const Proxy& PB) { arma_debug_sigprint(); const uword n_rows = PA.get_n_rows(); const uword n_cols = PA.get_n_cols(); arma_conform_assert_same_size(n_rows, n_cols, PB.get_n_rows(), PB.get_n_cols(), "element-wise min()"); const arma_lt_comparator comparator; out.set_size(n_rows, n_cols); eT* out_mem = out.memptr(); if( (Proxy::use_at == false) && (Proxy::use_at == false) ) { typename Proxy::ea_type A = PA.get_ea(); typename Proxy::ea_type B = PB.get_ea(); const uword N = PA.get_n_elem(); for(uword i=0; i inline void glue_min::apply(Cube& out, const GlueCube& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const ProxyCube PA(X.A); const ProxyCube PB(X.B); if( (PA.is_alias(out) && PA.has_subview) || (PB.is_alias(out) && PB.has_subview) ) { Cube tmp; glue_min::apply(tmp, PA, PB); out.steal_mem(tmp); } else { glue_min::apply(out, PA, PB); } } template inline void glue_min::apply(Cube& out, const ProxyCube& PA, const ProxyCube& PB) { arma_debug_sigprint(); const uword n_rows = PA.get_n_rows(); const uword n_cols = PA.get_n_cols(); const uword n_slices = PA.get_n_slices(); arma_conform_assert_same_size(n_rows, n_cols, n_slices, PB.get_n_rows(), PB.get_n_cols(), PB.get_n_slices(), "element-wise min()"); const arma_lt_comparator comparator; out.set_size(n_rows, n_cols, n_slices); eT* out_mem = out.memptr(); if( (ProxyCube::use_at == false) && (ProxyCube::use_at == false) ) { typename ProxyCube::ea_type A = PA.get_ea(); typename ProxyCube::ea_type B = PB.get_ea(); const uword N = PA.get_n_elem(); for(uword i=0; i inline typename T1::pod_type op_rcond::apply(const Base& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; typedef typename T1::pod_type T; if(strip_trimat::do_trimat) { arma_debug_print("op_rcond::apply(): tri optimisation"); const strip_trimat S(X.get_ref()); const quasi_unwrap::stored_type> U(S.M); arma_conform_check( (U.M.is_square() == false), "rcond(): matrix must be square sized" ); const uword layout = (S.do_triu) ? uword(0) : uword(1); return auxlib::rcond_trimat(U.M, layout); } Mat A = X.get_ref(); arma_conform_check( (A.is_square() == false), "rcond(): matrix must be square sized" ); if(A.is_empty()) { return Datum::inf; } if(is_op_diagmat::value || A.is_diagmat()) { arma_debug_print("op_rcond::apply(): diag optimisation"); const eT* colmem = A.memptr(); const uword N = A.n_rows; T abs_min = Datum::inf; T abs_max = T(0); for(uword i=0; i abs_max) ? abs_val : abs_max; colmem += N; } if((abs_min == T(0)) || (abs_max == T(0))) { return T(0); } return T(abs_min / abs_max); } const bool is_triu = trimat_helper::is_triu(A); const bool is_tril = (is_triu) ? false : trimat_helper::is_tril(A); if(is_triu || is_tril) { arma_debug_print("op_rcond::apply(): tri optimisation"); const uword layout = (is_triu) ? uword(0) : uword(1); return auxlib::rcond_trimat(A, layout); } if( (arma_config::optimise_sym) && (auxlib::crippled_lapack(A) == false) && ( is_sym_expr::eval(X.get_ref()) || sym_helper::is_approx_sym(A, uword(100)) ) ) { arma_debug_print("op_rcond::apply(): symmetric/hermitian optimisation"); return auxlib::rcond_sym(A); } return auxlib::rcond(A); } //! @} RcppArmadillo/inst/include/armadillo_bits/compiler_check.hpp0000644000176200001440000000452014713753317024064 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ #undef ARMA_HAVE_CXX11 #undef ARMA_HAVE_CXX14 #undef ARMA_HAVE_CXX17 #undef ARMA_HAVE_CXX20 #undef ARMA_HAVE_CXX23 #if (__cplusplus >= 201103L) #define ARMA_HAVE_CXX11 #endif #if (__cplusplus >= 201402L) #define ARMA_HAVE_CXX14 #endif #if (__cplusplus >= 201703L) #define ARMA_HAVE_CXX17 #endif #if (__cplusplus >= 202002L) #define ARMA_HAVE_CXX20 #endif #if (__cplusplus >= 202302L) #define ARMA_HAVE_CXX23 #endif // MS really can't get its proverbial shit together #if defined(_MSVC_LANG) #if (_MSVC_LANG >= 201402L) #undef ARMA_HAVE_CXX11 #define ARMA_HAVE_CXX11 #undef ARMA_HAVE_CXX14 #define ARMA_HAVE_CXX14 #endif #if (_MSVC_LANG >= 201703L) #undef ARMA_HAVE_CXX17 #define ARMA_HAVE_CXX17 #endif #if (_MSVC_LANG >= 202002L) #undef ARMA_HAVE_CXX20 #define ARMA_HAVE_CXX20 #endif #if (_MSVC_LANG >= 202302L) #undef ARMA_HAVE_CXX23 #define ARMA_HAVE_CXX23 #endif #endif // warn about ignored option used in old versions of Armadillo #if defined(ARMA_DONT_USE_CXX11) #pragma message ("WARNING: option ARMA_DONT_USE_CXX11 ignored") #endif #if !defined(ARMA_HAVE_CXX11) #error "*** C++11 compiler required; enable C++11 mode in your compiler, or use an earlier version of Armadillo" #endif #if (!defined(ARMA_HAVE_CXX14)) && (!defined(ARMA_IGNORE_DEPRECATED_MARKER)) #pragma message ("INFO: support for C++11 is deprecated; minimum recommended standard is C++14") #endif // for compatibility with earlier versions of Armadillo #undef ARMA_USE_CXX11 #define ARMA_USE_CXX11 RcppArmadillo/inst/include/armadillo_bits/eop_core_meat.hpp0000644000176200001440000007401714770765377023742 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup eop_core //! @{ #undef arma_applier_1u #undef arma_applier_1a #undef arma_applier_2 #undef arma_applier_3 #undef operatorA #undef arma_applier_1_mp #undef arma_applier_2_mp #undef arma_applier_3_mp #if defined(ARMA_SIMPLE_LOOPS) #define arma_applier_1u(operatorA) \ {\ for(uword i=0; i::process(P[i], k);\ }\ } #else #define arma_applier_1u(operatorA) \ {\ uword i,j;\ \ for(i=0, j=1; j::process(tmp_i, k);\ tmp_j = eop_core::process(tmp_j, k);\ \ out_mem[i] operatorA tmp_i;\ out_mem[j] operatorA tmp_j;\ }\ \ if(i < n_elem)\ {\ out_mem[i] operatorA eop_core::process(P[i], k);\ }\ } #endif #if defined(ARMA_SIMPLE_LOOPS) #define arma_applier_1a(operatorA) \ {\ for(uword i=0; i::process(P.at_alt(i), k);\ }\ } #else #define arma_applier_1a(operatorA) \ {\ uword i,j;\ \ for(i=0, j=1; j::process(tmp_i, k);\ tmp_j = eop_core::process(tmp_j, k);\ \ out_mem[i] operatorA tmp_i;\ out_mem[j] operatorA tmp_j;\ }\ \ if(i < n_elem)\ {\ out_mem[i] operatorA eop_core::process(P.at_alt(i), k);\ }\ } #endif #define arma_applier_2(operatorA) \ {\ if(n_rows != 1)\ {\ for(uword col=0; col::process(tmp_i, k);\ tmp_j = eop_core::process(tmp_j, k);\ \ *out_mem operatorA tmp_i; out_mem++;\ *out_mem operatorA tmp_j; out_mem++;\ }\ \ if(i < n_rows)\ {\ *out_mem operatorA eop_core::process(P.at(i,col), k); out_mem++;\ }\ }\ }\ else\ {\ for(uword count=0; count < n_cols; ++count)\ {\ out_mem[count] operatorA eop_core::process(P.at(0,count), k);\ }\ }\ } #define arma_applier_3(operatorA) \ {\ for(uword slice=0; slice::process(tmp_i, k);\ tmp_j = eop_core::process(tmp_j, k);\ \ *out_mem operatorA tmp_i; out_mem++; \ *out_mem operatorA tmp_j; out_mem++; \ }\ \ if(i < n_rows)\ {\ *out_mem operatorA eop_core::process(P.at(i,col,slice), k); out_mem++; \ }\ }\ }\ } #if defined(ARMA_USE_OPENMP) #define arma_applier_1_mp(operatorA) \ {\ const int n_threads = mp_thread_limit::get();\ _Pragma("omp parallel for schedule(static) num_threads(n_threads)")\ for(uword i=0; i::process(P[i], k);\ }\ } #define arma_applier_2_mp(operatorA) \ {\ const int n_threads = mp_thread_limit::get();\ if(n_cols == 1)\ {\ _Pragma("omp parallel for schedule(static) num_threads(n_threads)")\ for(uword count=0; count < n_rows; ++count)\ {\ out_mem[count] operatorA eop_core::process(P.at(count,0), k);\ }\ }\ else\ if(n_rows == 1)\ {\ _Pragma("omp parallel for schedule(static) num_threads(n_threads)")\ for(uword count=0; count < n_cols; ++count)\ {\ out_mem[count] operatorA eop_core::process(P.at(0,count), k);\ }\ }\ else\ {\ _Pragma("omp parallel for schedule(static) num_threads(n_threads)")\ for(uword col=0; col < n_cols; ++col)\ {\ for(uword row=0; row < n_rows; ++row)\ {\ out.at(row,col) operatorA eop_core::process(P.at(row,col), k);\ }\ }\ }\ } #define arma_applier_3_mp(operatorA) \ {\ const int n_threads = mp_thread_limit::get();\ _Pragma("omp parallel for schedule(static) num_threads(n_threads)")\ for(uword slice=0; slice::process(P.at(row,col,slice), k);\ }\ }\ } #else #define arma_applier_1_mp(operatorA) arma_applier_1u(operatorA) #define arma_applier_2_mp(operatorA) arma_applier_2(operatorA) #define arma_applier_3_mp(operatorA) arma_applier_3(operatorA) #endif // // matrices template template inline void eop_core::apply(outT& out, const eOp& x) { arma_debug_sigprint(); typedef typename T1::elem_type eT; // NOTE: we're assuming that the matrix has already been set to the correct size and there is no aliasing; // size setting and alias checking is done by either the Mat constructor or operator=() const eT k = x.aux; eT* out_mem = out.memptr(); const bool use_mp = (arma_config::openmp) && (eOp::use_mp || (is_same_type::value && (is_cx::yes || x.aux != eT(2)))); if(Proxy::use_at == false) { const uword n_elem = x.get_n_elem(); if(use_mp && mp_gate::eval(n_elem)) { typename Proxy::ea_type P = x.P.get_ea(); arma_applier_1_mp(=); } else { if(memory::is_aligned(out_mem)) { memory::mark_as_aligned(out_mem); if(x.P.is_aligned()) { typename Proxy::aligned_ea_type P = x.P.get_aligned_ea(); arma_applier_1a(=); } else { typename Proxy::ea_type P = x.P.get_ea(); arma_applier_1u(=); } } else { typename Proxy::ea_type P = x.P.get_ea(); arma_applier_1u(=); } } } else { const uword n_rows = x.get_n_rows(); const uword n_cols = x.get_n_cols(); const Proxy& P = x.P; if(use_mp && mp_gate::eval(x.get_n_elem())) { arma_applier_2_mp(=); } else { arma_applier_2(=); } } } template template inline void eop_core::apply_inplace_plus(Mat& out, const eOp& x) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword n_rows = x.get_n_rows(); const uword n_cols = x.get_n_cols(); arma_conform_assert_same_size(out.n_rows, out.n_cols, n_rows, n_cols, "addition"); const eT k = x.aux; eT* out_mem = out.memptr(); const bool use_mp = (arma_config::openmp) && (eOp::use_mp || (is_same_type::value && (is_cx::yes || x.aux != eT(2)))); if(Proxy::use_at == false) { const uword n_elem = x.get_n_elem(); if(use_mp && mp_gate::eval(n_elem)) { typename Proxy::ea_type P = x.P.get_ea(); arma_applier_1_mp(+=); } else { if(memory::is_aligned(out_mem)) { memory::mark_as_aligned(out_mem); if(x.P.is_aligned()) { typename Proxy::aligned_ea_type P = x.P.get_aligned_ea(); arma_applier_1a(+=); } else { typename Proxy::ea_type P = x.P.get_ea(); arma_applier_1u(+=); } } else { typename Proxy::ea_type P = x.P.get_ea(); arma_applier_1u(+=); } } } else { const Proxy& P = x.P; if(use_mp && mp_gate::eval(x.get_n_elem())) { arma_applier_2_mp(+=); } else { arma_applier_2(+=); } } } template template inline void eop_core::apply_inplace_minus(Mat& out, const eOp& x) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword n_rows = x.get_n_rows(); const uword n_cols = x.get_n_cols(); arma_conform_assert_same_size(out.n_rows, out.n_cols, n_rows, n_cols, "subtraction"); const eT k = x.aux; eT* out_mem = out.memptr(); const bool use_mp = (arma_config::openmp) && (eOp::use_mp || (is_same_type::value && (is_cx::yes || x.aux != eT(2)))); if(Proxy::use_at == false) { const uword n_elem = x.get_n_elem(); if(use_mp && mp_gate::eval(n_elem)) { typename Proxy::ea_type P = x.P.get_ea(); arma_applier_1_mp(-=); } else { if(memory::is_aligned(out_mem)) { memory::mark_as_aligned(out_mem); if(x.P.is_aligned()) { typename Proxy::aligned_ea_type P = x.P.get_aligned_ea(); arma_applier_1a(-=); } else { typename Proxy::ea_type P = x.P.get_ea(); arma_applier_1u(-=); } } else { typename Proxy::ea_type P = x.P.get_ea(); arma_applier_1u(-=); } } } else { const Proxy& P = x.P; if(use_mp && mp_gate::eval(x.get_n_elem())) { arma_applier_2_mp(-=); } else { arma_applier_2(-=); } } } template template inline void eop_core::apply_inplace_schur(Mat& out, const eOp& x) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword n_rows = x.get_n_rows(); const uword n_cols = x.get_n_cols(); arma_conform_assert_same_size(out.n_rows, out.n_cols, n_rows, n_cols, "element-wise multiplication"); const eT k = x.aux; eT* out_mem = out.memptr(); const bool use_mp = (arma_config::openmp) && (eOp::use_mp || (is_same_type::value && (is_cx::yes || x.aux != eT(2)))); if(Proxy::use_at == false) { const uword n_elem = x.get_n_elem(); if(use_mp && mp_gate::eval(n_elem)) { typename Proxy::ea_type P = x.P.get_ea(); arma_applier_1_mp(*=); } else { if(memory::is_aligned(out_mem)) { memory::mark_as_aligned(out_mem); if(x.P.is_aligned()) { typename Proxy::aligned_ea_type P = x.P.get_aligned_ea(); arma_applier_1a(*=); } else { typename Proxy::ea_type P = x.P.get_ea(); arma_applier_1u(*=); } } else { typename Proxy::ea_type P = x.P.get_ea(); arma_applier_1u(*=); } } } else { const Proxy& P = x.P; if(use_mp && mp_gate::eval(x.get_n_elem())) { arma_applier_2_mp(*=); } else { arma_applier_2(*=); } } } template template inline void eop_core::apply_inplace_div(Mat& out, const eOp& x) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword n_rows = x.get_n_rows(); const uword n_cols = x.get_n_cols(); arma_conform_assert_same_size(out.n_rows, out.n_cols, n_rows, n_cols, "element-wise division"); const eT k = x.aux; eT* out_mem = out.memptr(); const bool use_mp = (arma_config::openmp) && (eOp::use_mp || (is_same_type::value && (is_cx::yes || x.aux != eT(2)))); if(Proxy::use_at == false) { const uword n_elem = x.get_n_elem(); if(use_mp && mp_gate::eval(n_elem)) { typename Proxy::ea_type P = x.P.get_ea(); arma_applier_1_mp(/=); } else { if(memory::is_aligned(out_mem)) { memory::mark_as_aligned(out_mem); if(x.P.is_aligned()) { typename Proxy::aligned_ea_type P = x.P.get_aligned_ea(); arma_applier_1a(/=); } else { typename Proxy::ea_type P = x.P.get_ea(); arma_applier_1u(/=); } } else { typename Proxy::ea_type P = x.P.get_ea(); arma_applier_1u(/=); } } } else { const Proxy& P = x.P; if(use_mp && mp_gate::eval(x.get_n_elem())) { arma_applier_2_mp(/=); } else { arma_applier_2(/=); } } } // // cubes template template inline void eop_core::apply(Cube& out, const eOpCube& x) { arma_debug_sigprint(); typedef typename T1::elem_type eT; // NOTE: we're assuming that the matrix has already been set to the correct size and there is no aliasing; // size setting and alias checking is done by either the Mat constructor or operator=() const eT k = x.aux; eT* out_mem = out.memptr(); const bool use_mp = (arma_config::openmp) && (eOpCube::use_mp || (is_same_type::value && (is_cx::yes || x.aux != eT(2)))); if(ProxyCube::use_at == false) { const uword n_elem = out.n_elem; if(use_mp && mp_gate::eval(n_elem)) { typename ProxyCube::ea_type P = x.P.get_ea(); arma_applier_1_mp(=); } else { if(memory::is_aligned(out_mem)) { memory::mark_as_aligned(out_mem); if(x.P.is_aligned()) { typename ProxyCube::aligned_ea_type P = x.P.get_aligned_ea(); arma_applier_1a(=); } else { typename ProxyCube::ea_type P = x.P.get_ea(); arma_applier_1u(=); } } else { typename ProxyCube::ea_type P = x.P.get_ea(); arma_applier_1u(=); } } } else { const uword n_rows = x.get_n_rows(); const uword n_cols = x.get_n_cols(); const uword n_slices = x.get_n_slices(); const ProxyCube& P = x.P; if(use_mp && mp_gate::eval(x.get_n_elem())) { arma_applier_3_mp(=); } else { arma_applier_3(=); } } } template template inline void eop_core::apply_inplace_plus(Cube& out, const eOpCube& x) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword n_rows = x.get_n_rows(); const uword n_cols = x.get_n_cols(); const uword n_slices = x.get_n_slices(); arma_conform_assert_same_size(out.n_rows, out.n_cols, out.n_slices, n_rows, n_cols, n_slices, "addition"); const eT k = x.aux; eT* out_mem = out.memptr(); const bool use_mp = (arma_config::openmp) && (eOpCube::use_mp || (is_same_type::value && (is_cx::yes || x.aux != eT(2)))); if(ProxyCube::use_at == false) { const uword n_elem = out.n_elem; if(use_mp && mp_gate::eval(n_elem)) { typename ProxyCube::ea_type P = x.P.get_ea(); arma_applier_1_mp(+=); } else { if(memory::is_aligned(out_mem)) { memory::mark_as_aligned(out_mem); if(x.P.is_aligned()) { typename ProxyCube::aligned_ea_type P = x.P.get_aligned_ea(); arma_applier_1a(+=); } else { typename ProxyCube::ea_type P = x.P.get_ea(); arma_applier_1u(+=); } } else { typename ProxyCube::ea_type P = x.P.get_ea(); arma_applier_1u(+=); } } } else { const ProxyCube& P = x.P; if(use_mp && mp_gate::eval(x.get_n_elem())) { arma_applier_3_mp(+=); } else { arma_applier_3(+=); } } } template template inline void eop_core::apply_inplace_minus(Cube& out, const eOpCube& x) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword n_rows = x.get_n_rows(); const uword n_cols = x.get_n_cols(); const uword n_slices = x.get_n_slices(); arma_conform_assert_same_size(out.n_rows, out.n_cols, out.n_slices, n_rows, n_cols, n_slices, "subtraction"); const eT k = x.aux; eT* out_mem = out.memptr(); const bool use_mp = (arma_config::openmp) && (eOpCube::use_mp || (is_same_type::value && (is_cx::yes || x.aux != eT(2)))); if(ProxyCube::use_at == false) { const uword n_elem = out.n_elem; if(use_mp && mp_gate::eval(n_elem)) { typename ProxyCube::ea_type P = x.P.get_ea(); arma_applier_1_mp(-=); } else { if(memory::is_aligned(out_mem)) { memory::mark_as_aligned(out_mem); if(x.P.is_aligned()) { typename ProxyCube::aligned_ea_type P = x.P.get_aligned_ea(); arma_applier_1a(-=); } else { typename ProxyCube::ea_type P = x.P.get_ea(); arma_applier_1u(-=); } } else { typename ProxyCube::ea_type P = x.P.get_ea(); arma_applier_1u(-=); } } } else { const ProxyCube& P = x.P; if(use_mp && mp_gate::eval(x.get_n_elem())) { arma_applier_3_mp(-=); } else { arma_applier_3(-=); } } } template template inline void eop_core::apply_inplace_schur(Cube& out, const eOpCube& x) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword n_rows = x.get_n_rows(); const uword n_cols = x.get_n_cols(); const uword n_slices = x.get_n_slices(); arma_conform_assert_same_size(out.n_rows, out.n_cols, out.n_slices, n_rows, n_cols, n_slices, "element-wise multiplication"); const eT k = x.aux; eT* out_mem = out.memptr(); const bool use_mp = (arma_config::openmp) && (eOpCube::use_mp || (is_same_type::value && (is_cx::yes || x.aux != eT(2)))); if(ProxyCube::use_at == false) { const uword n_elem = out.n_elem; if(use_mp && mp_gate::eval(n_elem)) { typename ProxyCube::ea_type P = x.P.get_ea(); arma_applier_1_mp(*=); } else { if(memory::is_aligned(out_mem)) { memory::mark_as_aligned(out_mem); if(x.P.is_aligned()) { typename ProxyCube::aligned_ea_type P = x.P.get_aligned_ea(); arma_applier_1a(*=); } else { typename ProxyCube::ea_type P = x.P.get_ea(); arma_applier_1u(*=); } } else { typename ProxyCube::ea_type P = x.P.get_ea(); arma_applier_1u(*=); } } } else { const ProxyCube& P = x.P; if(use_mp && mp_gate::eval(x.get_n_elem())) { arma_applier_3_mp(*=); } else { arma_applier_3(*=); } } } template template inline void eop_core::apply_inplace_div(Cube& out, const eOpCube& x) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword n_rows = x.get_n_rows(); const uword n_cols = x.get_n_cols(); const uword n_slices = x.get_n_slices(); arma_conform_assert_same_size(out.n_rows, out.n_cols, out.n_slices, n_rows, n_cols, n_slices, "element-wise division"); const eT k = x.aux; eT* out_mem = out.memptr(); const bool use_mp = (arma_config::openmp) && (eOpCube::use_mp || (is_same_type::value && (is_cx::yes || x.aux != eT(2)))); if(ProxyCube::use_at == false) { const uword n_elem = out.n_elem; if(use_mp && mp_gate::eval(n_elem)) { typename ProxyCube::ea_type P = x.P.get_ea(); arma_applier_1_mp(/=); } else { if(memory::is_aligned(out_mem)) { memory::mark_as_aligned(out_mem); if(x.P.is_aligned()) { typename ProxyCube::aligned_ea_type P = x.P.get_aligned_ea(); arma_applier_1a(/=); } else { typename ProxyCube::ea_type P = x.P.get_ea(); arma_applier_1u(/=); } } else { typename ProxyCube::ea_type P = x.P.get_ea(); arma_applier_1u(/=); } } } else { const ProxyCube& P = x.P; if(use_mp && mp_gate::eval(x.get_n_elem())) { arma_applier_3_mp(/=); } else { arma_applier_3(/=); } } } // // common template template arma_inline eT eop_core::process(const eT, const eT) { arma_stop_logic_error("eop_core::process(): unhandled eop_type"); return eT(0); } template<> template arma_inline eT eop_core::process(const eT val, const eT k) { return val + k; } template<> template arma_inline eT eop_core::process(const eT val, const eT k) { return k - val; } template<> template arma_inline eT eop_core::process(const eT val, const eT k) { return val - k; } template<> template arma_inline eT eop_core::process(const eT val, const eT k) { return val * k; } template<> template arma_inline eT eop_core::process(const eT val, const eT k) { return k / val; } template<> template arma_inline eT eop_core::process(const eT val, const eT k) { return val / k; } template<> template arma_inline eT eop_core::process(const eT val, const eT ) { return val*val; } template<> template arma_inline eT eop_core::process(const eT val, const eT ) { return eop_aux::neg(val); } template<> template arma_inline eT eop_core::process(const eT val, const eT ) { return eop_aux::sqrt(val); } template<> template arma_inline eT eop_core::process(const eT val, const eT ) { return eop_aux::log(val); } template<> template arma_inline eT eop_core::process(const eT val, const eT ) { return eop_aux::log2(val); } template<> template arma_inline eT eop_core::process(const eT val, const eT ) { return eop_aux::log10(val); } template<> template arma_inline eT eop_core::process(const eT val, const eT ) { return arma::trunc_log(val); } template<> template arma_inline eT eop_core::process(const eT val, const eT ) { return eop_aux::log1p(val); } template<> template arma_inline eT eop_core::process(const eT val, const eT ) { return eop_aux::exp(val); } template<> template arma_inline eT eop_core::process(const eT val, const eT ) { return eop_aux::exp2(val); } template<> template arma_inline eT eop_core::process(const eT val, const eT ) { return eop_aux::exp10(val); } template<> template arma_inline eT eop_core::process(const eT val, const eT ) { return arma::trunc_exp(val); } template<> template arma_inline eT eop_core::process(const eT val, const eT ) { return eop_aux::expm1(val); } template<> template arma_inline eT eop_core::process(const eT val, const eT ) { return eop_aux::cos(val); } template<> template arma_inline eT eop_core::process(const eT val, const eT ) { return eop_aux::sin(val); } template<> template arma_inline eT eop_core::process(const eT val, const eT ) { return eop_aux::tan(val); } template<> template arma_inline eT eop_core::process(const eT val, const eT ) { return eop_aux::acos(val); } template<> template arma_inline eT eop_core::process(const eT val, const eT ) { return eop_aux::asin(val); } template<> template arma_inline eT eop_core::process(const eT val, const eT ) { return eop_aux::atan(val); } template<> template arma_inline eT eop_core::process(const eT val, const eT ) { return eop_aux::cosh(val); } template<> template arma_inline eT eop_core::process(const eT val, const eT ) { return eop_aux::sinh(val); } template<> template arma_inline eT eop_core::process(const eT val, const eT ) { return eop_aux::tanh(val); } template<> template arma_inline eT eop_core::process(const eT val, const eT ) { return eop_aux::acosh(val); } template<> template arma_inline eT eop_core::process(const eT val, const eT ) { return eop_aux::asinh(val); } template<> template arma_inline eT eop_core::process(const eT val, const eT ) { return eop_aux::atanh(val); } template<> template arma_inline eT eop_core::process(const eT val, const eT ) { return arma_sinc(val); } template<> template arma_inline eT eop_core::process(const eT val, const eT ) { return eop_aux::direct_eps(val); } template<> template arma_inline eT eop_core::process(const eT val, const eT ) { return eop_aux::arma_abs(val); } template<> template arma_inline eT eop_core::process(const eT val, const eT ) { return arma_arg::eval(val); } template<> template arma_inline eT eop_core::process(const eT val, const eT ) { return eop_aux::conj(val); } template<> template arma_inline eT eop_core::process(const eT val, const eT k) { return eop_aux::pow(val, k); } template<> template arma_inline eT eop_core::process(const eT val, const eT ) { return eop_aux::floor(val); } template<> template arma_inline eT eop_core::process(const eT val, const eT ) { return eop_aux::ceil(val); } template<> template arma_inline eT eop_core::process(const eT val, const eT ) { return eop_aux::round(val); } template<> template arma_inline eT eop_core::process(const eT val, const eT ) { return eop_aux::trunc(val); } template<> template arma_inline eT eop_core::process(const eT val, const eT ) { return arma_sign(val); } template<> template arma_inline eT eop_core::process(const eT val, const eT ) { return eop_aux::cbrt(val); } template<> template arma_inline eT eop_core::process(const eT val, const eT ) { return eop_aux::erf(val); } template<> template arma_inline eT eop_core::process(const eT val, const eT ) { return eop_aux::erfc(val); } template<> template arma_inline eT eop_core::process(const eT val, const eT ) { return eop_aux::lgamma(val); } template<> template arma_inline eT eop_core::process(const eT val, const eT ) { return eop_aux::tgamma(val); } #undef arma_applier_1u #undef arma_applier_1a #undef arma_applier_2 #undef arma_applier_3 #undef arma_applier_1_mp #undef arma_applier_2_mp #undef arma_applier_3_mp //! @} RcppArmadillo/inst/include/armadillo_bits/fn_randn.hpp0000644000176200001440000001734514631567470022715 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_randn //! @{ // scalars arma_warn_unused inline double randn() { arma_debug_sigprint(); return double(arma_rng::randn()); } template arma_warn_unused inline typename arma_real_or_cx_only::result randn() { arma_debug_sigprint(); return eT(arma_rng::randn()); } arma_warn_unused inline double randn(const distr_param& param) { arma_debug_sigprint(); if(param.state == 0) { return double(arma_rng::randn()); } double mu = double(0); double sd = double(1); param.get_double_vals(mu,sd); arma_conform_check( (sd <= double(0)), "randn(): incorrect distribution parameters; standard deviation must be > 0" ); const double val = double(arma_rng::randn()); return ((val * sd) + mu); } template arma_warn_unused inline typename arma_real_or_cx_only::result randn(const distr_param& param) { arma_debug_sigprint(); if(param.state == 0) { return eT(arma_rng::randn()); } double mu = double(0); double sd = double(1); param.get_double_vals(mu,sd); arma_conform_check( (sd <= double(0)), "randn(): incorrect distribution parameters; standard deviation must be > 0" ); eT val = eT(0); arma_rng::randn::fill(&val, 1, mu, sd); // using fill() as eT can be complex return val; } // vectors arma_warn_unused inline vec randn(const uword n_elem, const distr_param& param = distr_param()) { arma_debug_sigprint(); vec out(n_elem, arma_nozeros_indicator()); if(param.state == 0) { arma_rng::randn::fill(out.memptr(), n_elem); } else { double mu = double(0); double sd = double(1); param.get_double_vals(mu,sd); arma_conform_check( (sd <= double(0)), "randn(): incorrect distribution parameters; standard deviation must be > 0" ); arma_rng::randn::fill(out.memptr(), n_elem, mu, sd); } return out; } template arma_warn_unused inline obj_type randn(const uword n_elem, const distr_param& param = distr_param(), const typename arma_Mat_Col_Row_only::result* junk = nullptr) { arma_debug_sigprint(); arma_ignore(junk); typedef typename obj_type::elem_type eT; const uword n_rows = (is_Row::value) ? uword(1) : n_elem; const uword n_cols = (is_Row::value) ? n_elem : uword(1); obj_type out(n_rows, n_cols, arma_nozeros_indicator()); if(param.state == 0) { arma_rng::randn::fill(out.memptr(), out.n_elem); } else { double mu = double(0); double sd = double(1); param.get_double_vals(mu,sd); arma_conform_check( (sd <= double(0)), "randn(): incorrect distribution parameters; standard deviation must be > 0" ); arma_rng::randn::fill(out.memptr(), out.n_elem, mu, sd); } return out; } // matrices arma_warn_unused inline mat randn(const uword n_rows, const uword n_cols, const distr_param& param = distr_param()) { arma_debug_sigprint(); mat out(n_rows, n_cols, arma_nozeros_indicator()); if(param.state == 0) { arma_rng::randn::fill(out.memptr(), out.n_elem); } else { double mu = double(0); double sd = double(1); param.get_double_vals(mu,sd); arma_conform_check( (sd <= double(0)), "randn(): incorrect distribution parameters; standard deviation must be > 0" ); arma_rng::randn::fill(out.memptr(), out.n_elem, mu, sd); } return out; } arma_warn_unused inline mat randn(const SizeMat& s, const distr_param& param = distr_param()) { arma_debug_sigprint(); return randn(s.n_rows, s.n_cols, param); } template arma_warn_unused inline obj_type randn(const uword n_rows, const uword n_cols, const distr_param& param = distr_param(), const typename arma_Mat_Col_Row_only::result* junk = nullptr) { arma_debug_sigprint(); arma_ignore(junk); typedef typename obj_type::elem_type eT; if(is_Col::value) { arma_conform_check( (n_cols != 1), "randn(): incompatible size" ); } if(is_Row::value) { arma_conform_check( (n_rows != 1), "randn(): incompatible size" ); } obj_type out(n_rows, n_cols, arma_nozeros_indicator()); if(param.state == 0) { arma_rng::randn::fill(out.memptr(), out.n_elem); } else { double mu = double(0); double sd = double(1); param.get_double_vals(mu,sd); arma_conform_check( (sd <= double(0)), "randn(): incorrect distribution parameters; standard deviation must be > 0" ); arma_rng::randn::fill(out.memptr(), out.n_elem, mu, sd); } return out; } template arma_warn_unused inline obj_type randn(const SizeMat& s, const distr_param& param = distr_param(), const typename arma_Mat_Col_Row_only::result* junk = nullptr) { arma_debug_sigprint(); arma_ignore(junk); return randn(s.n_rows, s.n_cols, param); } // cubes arma_warn_unused inline cube randn(const uword n_rows, const uword n_cols, const uword n_slices, const distr_param& param = distr_param()) { arma_debug_sigprint(); cube out(n_rows, n_cols, n_slices, arma_nozeros_indicator()); if(param.state == 0) { arma_rng::randn::fill(out.memptr(), out.n_elem); } else { double mu = double(0); double sd = double(1); param.get_double_vals(mu,sd); arma_conform_check( (sd <= double(0)), "randn(): incorrect distribution parameters; standard deviation must be > 0" ); arma_rng::randn::fill(out.memptr(), out.n_elem, mu, sd); } return out; } arma_warn_unused inline cube randn(const SizeCube& s, const distr_param& param = distr_param()) { arma_debug_sigprint(); return randn(s.n_rows, s.n_cols, s.n_slices, param); } template arma_warn_unused inline cube_type randn(const uword n_rows, const uword n_cols, const uword n_slices, const distr_param& param = distr_param(), const typename arma_Cube_only::result* junk = nullptr) { arma_debug_sigprint(); arma_ignore(junk); typedef typename cube_type::elem_type eT; cube_type out(n_rows, n_cols, n_slices, arma_nozeros_indicator()); if(param.state == 0) { arma_rng::randn::fill(out.memptr(), out.n_elem); } else { double mu = double(0); double sd = double(1); param.get_double_vals(mu,sd); arma_conform_check( (sd <= double(0)), "randn(): incorrect distribution parameters; standard deviation must be > 0" ); arma_rng::randn::fill(out.memptr(), out.n_elem, mu, sd); } return out; } template arma_warn_unused inline cube_type randn(const SizeCube& s, const distr_param& param = distr_param(), const typename arma_Cube_only::result* junk = nullptr) { arma_debug_sigprint(); arma_ignore(junk); return randn(s.n_rows, s.n_cols, s.n_slices, param); } //! @} RcppArmadillo/inst/include/armadillo_bits/op_powmat_bones.hpp0000644000176200001440000000332314301267043024275 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_powmat //! @{ class op_powmat : public traits_op_default { public: template inline static void apply(Mat& out, const Op& expr); template inline static bool apply_direct(Mat& out, const Base& X, const uword y, const bool y_neg); template inline static void apply_direct_positive(Mat& out, const Mat& X, const uword y); }; class op_powmat_cx : public traits_op_default { public: template inline static void apply(Mat< std::complex >& out, const mtOp,T1,op_powmat_cx>& expr); template inline static bool apply_direct(Mat< std::complex >& out, const Base& X, const typename T1::pod_type y); }; //! @} RcppArmadillo/inst/include/armadillo_bits/fn_min.hpp0000644000176200001440000001240714634016465022364 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_min //! @{ template arma_warn_unused inline typename enable_if2< is_arma_type::value && resolves_to_vector::yes, typename T1::elem_type >::result min(const T1& X) { arma_debug_sigprint(); return op_min::min(X); } template arma_warn_unused arma_inline typename enable_if2< is_arma_type::value && resolves_to_vector::no, const Op >::result min(const T1& X) { arma_debug_sigprint(); return Op(X, 0, 0); } template arma_warn_unused arma_inline typename enable_if2< is_arma_type::value, const Op >::result min(const T1& X, const uword dim) { arma_debug_sigprint(); return Op(X, dim, 0); } template arma_warn_unused arma_inline typename arma_scalar_only::result min(const T& x) { return x; } //! element-wise minimum template arma_warn_unused arma_inline typename enable_if2 < ( is_arma_type::value && is_arma_type::value && is_same_type::value ), const Glue >::result min ( const T1& X, const T2& Y ) { arma_debug_sigprint(); return Glue(X, Y); } template arma_warn_unused arma_inline const OpCube min ( const BaseCube& X, const uword dim = 0 ) { arma_debug_sigprint(); return OpCube(X.get_ref(), dim, 0); } template arma_warn_unused arma_inline const GlueCube min ( const BaseCube& X, const BaseCube& Y ) { arma_debug_sigprint(); return GlueCube(X.get_ref(), Y.get_ref()); } template arma_warn_unused inline typename enable_if2 < is_arma_sparse_type::value && resolves_to_sparse_vector::yes, typename T1::elem_type >::result min(const T1& x) { arma_debug_sigprint(); return op_sp_min::vector_min(x); } template arma_warn_unused inline typename enable_if2 < is_arma_sparse_type::value && resolves_to_sparse_vector::no, const mtSpReduceOp >::result min(const T1& X) { arma_debug_sigprint(); return mtSpReduceOp(X, 0, 0); } template arma_warn_unused inline typename enable_if2 < is_arma_sparse_type::value, const mtSpReduceOp >::result min(const T1& X, const uword dim) { arma_debug_sigprint(); return mtSpReduceOp(X, dim, 0); } // elementwise sparse min template arma_warn_unused inline typename enable_if2 < (is_arma_sparse_type::value && is_arma_sparse_type::value && is_same_type::value), const SpGlue >::result min(const T1& x, const T2& y) { arma_debug_sigprint(); return SpGlue(x, y); } //! elementwise min of dense and sparse objects with the same element type template inline typename enable_if2 < (is_arma_type::value && is_arma_sparse_type::value && is_same_type::value), Mat >::result min ( const T1& x, const T2& y ) { arma_debug_sigprint(); Mat out; spglue_min::dense_sparse_min(out, x, y); return out; } //! elementwise min of sparse and dense objects with the same element type template inline typename enable_if2 < (is_arma_sparse_type::value && is_arma_type::value && is_same_type::value), Mat >::result min ( const T1& x, const T2& y ) { arma_debug_sigprint(); Mat out; // Just call the other order (these operations are commutative) // TODO: if there is a matrix size mismatch, the debug assert will print the matrix sizes in wrong order spglue_min::dense_sparse_min(out, y, x); return out; } arma_warn_unused inline uword min(const SizeMat& s) { return (std::min)(s.n_rows, s.n_cols); } arma_warn_unused inline uword min(const SizeCube& s) { return (std::min)( (std::min)(s.n_rows, s.n_cols), s.n_slices ); } //! @} RcppArmadillo/inst/include/armadillo_bits/op_sp_sum_bones.hpp0000644000176200001440000000222515002412117024265 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_sp_sum //! @{ class op_sp_sum : public traits_op_xvec { public: template inline static void apply(Mat& out, const mtSpReduceOp& in); template inline static void apply(Mat& out, const mtSpReduceOp, op_sp_sum>& in); }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_chi2rnd_bones.hpp0000644000176200001440000000267014301267043024323 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_chi2rnd //! @{ class op_chi2rnd : public traits_op_passthru { public: template inline static void apply(Mat& out, const Op& in); template inline static void apply_noalias(Mat& out, const Proxy& P); template inline static void fill_constant_df(Mat& out, const eT df); }; template class op_chi2rnd_varying_df { public: arma_aligned std::mt19937_64 motor; inline ~op_chi2rnd_varying_df(); inline op_chi2rnd_varying_df(); inline eT operator()(const eT df); }; //! @} RcppArmadillo/inst/include/armadillo_bits/spop_norm_bones.hpp0000644000176200001440000000305414301267044024306 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup spop_norm //! @{ class spop_norm : public traits_op_default { public: template inline static typename get_pod_type::result mat_norm_1(const SpMat& X); template inline static typename get_pod_type::result mat_norm_2(const SpMat& X, const typename arma_real_only::result* junk = nullptr); template inline static typename get_pod_type::result mat_norm_2(const SpMat& X, const typename arma_cx_only::result* junk = nullptr); template inline static typename get_pod_type::result mat_norm_inf(const SpMat& X); template inline static typename get_pod_type::result vec_norm_k(const eT* mem, const uword N, const uword k); }; //! @} RcppArmadillo/inst/include/armadillo_bits/newarp_UpperHessenbergEigen_bones.hpp0000644000176200001440000000404514301267043027717 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ namespace newarp { //! Calculate the eigenvalues and eigenvectors of an upper Hessenberg matrix. //! This class is uses lapack::lahqr() and lapack::trevc() template class UpperHessenbergEigen { private: uword n_rows; Mat mat_Z; // In the first stage, H = ZTZ', Z is an orthogonal matrix // In the second stage, Z will be overwritten by the eigenvectors of H Mat mat_T; // H = ZTZ', T is a Schur form matrix Col< std::complex > evals; // eigenvalues of H bool computed; public: //! Default constructor. Computation can //! be performed later by calling the compute() method. inline UpperHessenbergEigen(); //! Constructor to create an object that calculates the eigenvalues //! and eigenvectors of an upper Hessenberg matrix `mat_obj`. inline UpperHessenbergEigen(const Mat& mat_obj); //! Compute the eigenvalue decomposition of an upper Hessenberg matrix. inline void compute(const Mat& mat_obj); //! Retrieve the eigenvalues. inline Col< std::complex > eigenvalues(); //! Retrieve the eigenvectors. inline Mat< std::complex > eigenvectors(); }; } // namespace newarp RcppArmadillo/inst/include/armadillo_bits/glue_cor_bones.hpp0000644000176200001440000000236714301267043024076 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup glue_cor //! @{ class glue_cor { public: template struct traits { static constexpr bool is_row = false; // T1::is_col; // TODO: check static constexpr bool is_col = false; // T2::is_col; // TODO: check static constexpr bool is_xvec = false; }; template inline static void apply(Mat& out, const Glue& X); }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_sp_var_meat.hpp0000644000176200001440000002250014634016465024107 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_sp_var //! @{ template inline void op_sp_var::apply(Mat& out, const mtSpReduceOp& in) { arma_debug_sigprint(); const uword norm_type = in.aux_uword_a; const uword dim = in.aux_uword_b; arma_conform_check( (norm_type > 1), "var(): parameter 'norm_type' must be 0 or 1" ); arma_conform_check( (dim > 1), "var(): parameter 'dim' must be 0 or 1" ); const SpProxy p(in.m); const uword p_n_rows = p.get_n_rows(); const uword p_n_cols = p.get_n_cols(); if( (p_n_rows == 0) || (p_n_cols == 0) || (p.get_n_nonzero() == 0) ) { if(dim == 0) { out.zeros((p_n_rows > 0) ? 1 : 0, p_n_cols); } if(dim == 1) { out.zeros(p_n_rows, (p_n_cols > 0) ? 1 : 0); } return; } op_sp_var::apply_slow(out, p, norm_type, dim); } template inline void op_sp_var::apply_slow ( Mat& out, const SpProxy& p, const uword norm_type, const uword dim ) { arma_debug_sigprint(); typedef typename T1::elem_type in_eT; //typedef typename T1::pod_type out_eT; const uword p_n_rows = p.get_n_rows(); const uword p_n_cols = p.get_n_cols(); if(dim == 0) // find variance in each column { arma_debug_print("op_sp_var::apply_slow(): dim = 0"); out.zeros(1, p_n_cols); for(uword col = 0; col < p_n_cols; ++col) { if(SpProxy::use_iterator) { // We must use an iterator; we can't access memory directly. typename SpProxy::const_iterator_type it = p.begin_col(col); typename SpProxy::const_iterator_type end = p.begin_col(col + 1); const uword n_zero = p_n_rows - (end.pos() - it.pos()); // in_eT is used just to get the specialization right (complex / noncomplex) out.at(0, col) = op_sp_var::iterator_var(it, end, n_zero, norm_type, in_eT(0)); } else { // We can use direct memory access to calculate the variance. out.at(0, col) = op_sp_var::direct_var ( &p.get_values()[p.get_col_ptrs()[col]], p.get_col_ptrs()[col + 1] - p.get_col_ptrs()[col], p_n_rows, norm_type ); } } } else if(dim == 1) // find variance in each row { arma_debug_print("op_sp_var::apply_slow(): dim = 1"); out.zeros(p_n_rows, 1); for(uword row = 0; row < p_n_rows; ++row) { // We have to use an iterator here regardless of whether or not we can // directly access memory. typename SpProxy::const_row_iterator_type it = p.begin_row(row); typename SpProxy::const_row_iterator_type end = p.end_row(row); const uword n_zero = p_n_cols - (end.pos() - it.pos()); out.at(row, 0) = op_sp_var::iterator_var(it, end, n_zero, norm_type, in_eT(0)); } } } template inline typename T1::pod_type op_sp_var::var_vec ( const T1& X, const uword norm_type ) { arma_debug_sigprint(); typedef typename T1::elem_type eT; arma_conform_check( (norm_type > 1), "var(): parameter 'norm_type' must be 0 or 1" ); // conditionally unwrap it into a temporary and then directly operate. const unwrap_spmat tmp(X); if(tmp.M.n_elem == 0) { arma_conform_check(true, "var(): object has no elements"); return Datum::nan; } return direct_var(tmp.M.values, tmp.M.n_nonzero, tmp.M.n_elem, norm_type); } template inline eT op_sp_var::direct_var ( const eT* const X, const uword length, const uword N, const uword norm_type ) { arma_debug_sigprint(); if(length >= 2 && N >= 2) { const eT acc1 = op_sp_mean::direct_mean(X, length, N); eT acc2 = eT(0); eT acc3 = eT(0); uword i, j; for(i = 0, j = 1; j < length; i += 2, j += 2) { const eT Xi = X[i]; const eT Xj = X[j]; const eT tmpi = acc1 - Xi; const eT tmpj = acc1 - Xj; acc2 += tmpi * tmpi + tmpj * tmpj; acc3 += tmpi + tmpj; } if(i < length) { const eT Xi = X[i]; const eT tmpi = acc1 - Xi; acc2 += tmpi * tmpi; acc3 += tmpi; } // Now add in all zero elements. acc2 += (N - length) * (acc1 * acc1); acc3 += (N - length) * acc1; const eT norm_val = (norm_type == 0) ? eT(N - 1) : eT(N); const eT var_val = (acc2 - (acc3 * acc3) / eT(N)) / norm_val; return var_val; } else if(length == 1 && N > 1) // if N == 1, then variance is zero. { const eT mean = X[0] / eT(N); const eT val = mean - X[0]; const eT acc2 = (val * val) + (N - length) * (mean * mean); const eT acc3 = val + (N - length) * mean; const eT norm_val = (norm_type == 0) ? eT(N - 1) : eT(N); const eT var_val = (acc2 - (acc3 * acc3) / eT(N)) / norm_val; return var_val; } else { return eT(0); } } template inline T op_sp_var::direct_var ( const std::complex* const X, const uword length, const uword N, const uword norm_type ) { arma_debug_sigprint(); typedef typename std::complex eT; if(length >= 2 && N >= 2) { const eT acc1 = op_sp_mean::direct_mean(X, length, N); T acc2 = T(0); eT acc3 = eT(0); for(uword i = 0; i < length; ++i) { const eT tmp = acc1 - X[i]; acc2 += std::norm(tmp); acc3 += tmp; } // Add zero elements to sums acc2 += std::norm(acc1) * T(N - length); acc3 += acc1 * T(N - length); const T norm_val = (norm_type == 0) ? T(N - 1) : T(N); const T var_val = (acc2 - std::norm(acc3) / T(N)) / norm_val; return var_val; } else if(length == 1 && N > 1) // if N == 1, then variance is zero. { const eT mean = X[0] / T(N); const eT val = mean - X[0]; const T acc2 = std::norm(val) + (N - length) * std::norm(mean); const eT acc3 = val + T(N - length) * mean; const T norm_val = (norm_type == 0) ? T(N - 1) : T(N); const T var_val = (acc2 - std::norm(acc3) / T(N)) / norm_val; return var_val; } else { return T(0); // All elements are zero } } template inline eT op_sp_var::iterator_var ( T1& it, const T1& end, const uword n_zero, const uword norm_type, const eT junk1, const typename arma_not_cx::result* junk2 ) { arma_debug_sigprint(); arma_ignore(junk1); arma_ignore(junk2); T1 new_it(it); // for mean // T1 backup_it(it); // in case we have to call robust iterator_var eT mean = op_sp_mean::iterator_mean(new_it, end, n_zero, eT(0)); eT acc2 = eT(0); eT acc3 = eT(0); const uword it_begin_pos = it.pos(); while(it != end) { const eT tmp = mean - (*it); acc2 += (tmp * tmp); acc3 += (tmp); ++it; } const uword n_nonzero = (it.pos() - it_begin_pos); if(n_nonzero == 0) { return eT(0); } if(n_nonzero + n_zero == 1) { return eT(0); // only one element } // Add in entries for zeros. acc2 += eT(n_zero) * (mean * mean); acc3 += eT(n_zero) * mean; const eT norm_val = (norm_type == 0) ? eT(n_zero + n_nonzero - 1) : eT(n_zero + n_nonzero); const eT var_val = (acc2 - (acc3 * acc3) / eT(n_nonzero + n_zero)) / norm_val; return var_val; } template inline typename get_pod_type::result op_sp_var::iterator_var ( T1& it, const T1& end, const uword n_zero, const uword norm_type, const eT junk1, const typename arma_cx_only::result* junk2 ) { arma_debug_sigprint(); arma_ignore(junk1); arma_ignore(junk2); typedef typename get_pod_type::result T; T1 new_it(it); // for mean // T1 backup_it(it); // in case we have to call robust iterator_var eT mean = op_sp_mean::iterator_mean(new_it, end, n_zero, eT(0)); T acc2 = T(0); eT acc3 = eT(0); const uword it_begin_pos = it.pos(); while(it != end) { eT tmp = mean - (*it); acc2 += std::norm(tmp); acc3 += (tmp); ++it; } const uword n_nonzero = (it.pos() - it_begin_pos); if(n_nonzero == 0) { return T(0); } if(n_nonzero + n_zero == 1) { return T(0); // only one element } // Add in entries for zero elements. acc2 += T(n_zero) * std::norm(mean); acc3 += T(n_zero) * mean; const T norm_val = (norm_type == 0) ? T(n_zero + n_nonzero - 1) : T(n_zero + n_nonzero); const T var_val = (acc2 - std::norm(acc3) / T(n_nonzero + n_zero)) / norm_val; return var_val; } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_elem.hpp0000644000176200001440000005461415030507611022516 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_elem //! @{ // // real template arma_warn_unused arma_inline typename enable_if2< (is_arma_type::value && is_cx::no), const T1& >::result real(const T1& X) { arma_debug_sigprint(); return X; } template arma_warn_unused arma_inline const T1& real(const BaseCube& X) { arma_debug_sigprint(); return X.get_ref(); } template arma_warn_unused arma_inline typename enable_if2< (is_arma_sparse_type::value && is_cx::no), const T1& >::result real(const T1& X) { arma_debug_sigprint(); return X; } template arma_warn_unused inline typename enable_if2< (is_arma_type::value && is_cx::yes), const mtOp >::result real(const T1& X) { arma_debug_sigprint(); return mtOp( X ); } template arma_warn_unused inline const mtOpCube real(const BaseCube, T1>& X) { arma_debug_sigprint(); return mtOpCube( X.get_ref() ); } template arma_warn_unused arma_inline typename enable_if2< (is_arma_sparse_type::value && is_cx::yes), const mtSpOp >::result real(const T1& X) { arma_debug_sigprint(); return mtSpOp(X); } // // imag template arma_warn_unused inline typename enable_if2< is_arma_type::value, const mtOp >::result imag(const T1& X) { arma_debug_sigprint(); return mtOp( X ); } template arma_warn_unused inline const mtOpCube imag(const BaseCube& X) { arma_debug_sigprint(); return mtOpCube( X.get_ref() ); } template arma_warn_unused arma_inline typename enable_if2< is_arma_sparse_type::value, const mtSpOp >::result imag(const T1& X) { arma_debug_sigprint(); return mtSpOp(X); } // // log template arma_warn_unused arma_inline typename enable_if2< is_arma_type::value, const eOp >::result log(const T1& A) { arma_debug_sigprint(); return eOp(A); } template arma_warn_unused arma_inline const eOpCube log(const BaseCube& A) { arma_debug_sigprint(); return eOpCube(A.get_ref()); } // // log2 template arma_warn_unused arma_inline typename enable_if2< is_arma_type::value, const eOp >::result log2(const T1& A) { arma_debug_sigprint(); return eOp(A); } template arma_warn_unused arma_inline const eOpCube log2(const BaseCube& A) { arma_debug_sigprint(); return eOpCube(A.get_ref()); } // // log10 template arma_warn_unused arma_inline typename enable_if2< is_arma_type::value, const eOp >::result log10(const T1& A) { arma_debug_sigprint(); return eOp(A); } template arma_warn_unused arma_inline const eOpCube log10(const BaseCube& A) { arma_debug_sigprint(); return eOpCube(A.get_ref()); } // // log1p template arma_warn_unused arma_inline typename enable_if2< (is_arma_type::value && is_cx::no), const eOp >::result log1p(const T1& A) { arma_debug_sigprint(); return eOp(A); } template arma_warn_unused arma_inline typename enable_if2< is_cx::no, const eOpCube >::result log1p(const BaseCube& A) { arma_debug_sigprint(); return eOpCube(A.get_ref()); } // // exp template arma_warn_unused arma_inline typename enable_if2< is_arma_type::value, const eOp >::result exp(const T1& A) { arma_debug_sigprint(); return eOp(A); } template arma_warn_unused arma_inline const eOpCube exp(const BaseCube& A) { arma_debug_sigprint(); return eOpCube(A.get_ref()); } // exp2 template arma_warn_unused arma_inline typename enable_if2< is_arma_type::value, const eOp >::result exp2(const T1& A) { arma_debug_sigprint(); return eOp(A); } template arma_warn_unused arma_inline const eOpCube exp2(const BaseCube& A) { arma_debug_sigprint(); return eOpCube(A.get_ref()); } // exp10 template arma_warn_unused arma_inline typename enable_if2< is_arma_type::value, const eOp >::result exp10(const T1& A) { arma_debug_sigprint(); return eOp(A); } template arma_warn_unused arma_inline const eOpCube exp10(const BaseCube& A) { arma_debug_sigprint(); return eOpCube(A.get_ref()); } // expm1 template arma_warn_unused arma_inline typename enable_if2< (is_arma_type::value && is_cx::no), const eOp >::result expm1(const T1& A) { arma_debug_sigprint(); return eOp(A); } template arma_warn_unused arma_inline typename enable_if2< is_cx::no, const eOpCube >::result expm1(const BaseCube& A) { arma_debug_sigprint(); return eOpCube(A.get_ref()); } // // abs template arma_warn_unused arma_inline typename enable_if2< (is_arma_type::value && is_cx::no), const eOp >::result abs(const T1& X) { arma_debug_sigprint(); return eOp(X); } template arma_warn_unused arma_inline const eOpCube abs(const BaseCube& X, const typename arma_not_cx::result* junk = nullptr) { arma_debug_sigprint(); arma_ignore(junk); return eOpCube(X.get_ref()); } template arma_warn_unused inline typename enable_if2< (is_arma_type::value && is_cx::yes), const mtOp >::result abs(const T1& X) { arma_debug_sigprint(); return mtOp(X); } template arma_warn_unused inline const mtOpCube abs(const BaseCube< std::complex,T1>& X, const typename arma_cx_only::result* junk = nullptr) { arma_debug_sigprint(); arma_ignore(junk); return mtOpCube( X.get_ref() ); } template arma_warn_unused arma_inline typename enable_if2< (is_arma_sparse_type::value && is_cx::no), const SpOp >::result abs(const T1& X) { arma_debug_sigprint(); return SpOp(X); } template arma_warn_unused arma_inline typename enable_if2< (is_arma_sparse_type::value && is_cx::yes), const mtSpOp >::result abs(const T1& X) { arma_debug_sigprint(); return mtSpOp(X); } // // arg template arma_warn_unused arma_inline typename enable_if2< (is_arma_type::value && is_cx::no), const eOp >::result arg(const T1& X) { arma_debug_sigprint(); return eOp(X); } template arma_warn_unused arma_inline const eOpCube arg(const BaseCube& X, const typename arma_not_cx::result* junk = nullptr) { arma_debug_sigprint(); arma_ignore(junk); return eOpCube(X.get_ref()); } template arma_warn_unused inline typename enable_if2< (is_arma_type::value && is_cx::yes), const mtOp >::result arg(const T1& X) { arma_debug_sigprint(); return mtOp(X); } template arma_warn_unused inline const mtOpCube arg(const BaseCube< std::complex,T1>& X, const typename arma_cx_only::result* junk = nullptr) { arma_debug_sigprint(); arma_ignore(junk); return mtOpCube( X.get_ref() ); } template arma_warn_unused arma_inline typename enable_if2< (is_arma_sparse_type::value && is_cx::no), const SpOp >::result arg(const T1& X) { arma_debug_sigprint(); return SpOp(X); } template arma_warn_unused arma_inline typename enable_if2< (is_arma_sparse_type::value && is_cx::yes), const mtSpOp >::result arg(const T1& X) { arma_debug_sigprint(); return mtSpOp(X); } template arma_warn_unused inline typename enable_if2< is_arma_type::value, const mtOp >::result replace(const T1& X, typename T1::elem_type old_val, typename T1::elem_type new_val) { arma_debug_sigprint(); return mtOp(mtOp_dual_aux_indicator(), X, old_val, new_val); } template arma_warn_unused inline const mtOpCube replace(const BaseCube& X, typename T1::elem_type old_val, typename T1::elem_type new_val) { arma_debug_sigprint(); return mtOpCube(mtOpCube_dual_aux_indicator(), X.get_ref(), old_val, new_val); } template arma_warn_unused inline typename enable_if2< is_arma_sparse_type::value, const mtSpOp >::result replace(const T1& X, typename T1::elem_type old_val, typename T1::elem_type new_val) { arma_debug_sigprint(); return mtSpOp(mtSpOp_dual_aux_indicator(), X, old_val, new_val); } // // square template arma_warn_unused arma_inline typename enable_if2< is_arma_type::value, const eOp >::result square(const T1& A) { arma_debug_sigprint(); return eOp(A); } template arma_warn_unused arma_inline const eOpCube square(const BaseCube& A) { arma_debug_sigprint(); return eOpCube(A.get_ref()); } template arma_warn_unused arma_inline typename enable_if2< is_arma_sparse_type::value, const SpOp >::result square(const T1& X) { arma_debug_sigprint(); return SpOp(X); } // // sqrt template arma_warn_unused arma_inline typename enable_if2< is_arma_type::value, const eOp >::result sqrt(const T1& A) { arma_debug_sigprint(); return eOp(A); } template arma_warn_unused arma_inline const eOpCube sqrt(const BaseCube& A) { arma_debug_sigprint(); return eOpCube(A.get_ref()); } template arma_warn_unused arma_inline typename enable_if2< is_arma_sparse_type::value, const SpOp >::result sqrt(const T1& X) { arma_debug_sigprint(); return SpOp(X); } // // cbrt template arma_warn_unused arma_inline typename enable_if2< (is_arma_type::value && is_cx::no), const eOp >::result cbrt(const T1& A) { arma_debug_sigprint(); return eOp(A); } template arma_warn_unused arma_inline typename enable_if2< is_cx::no, const eOpCube >::result cbrt(const BaseCube& A) { arma_debug_sigprint(); return eOpCube(A.get_ref()); } template arma_warn_unused arma_inline typename enable_if2< (is_arma_sparse_type::value && is_cx::no), const SpOp >::result cbrt(const T1& X) { arma_debug_sigprint(); return SpOp(X); } // // conj template arma_warn_unused arma_inline typename enable_if2< (is_arma_type::value && is_cx::no), const T1& >::result conj(const T1& X) { arma_debug_sigprint(); return X; } template arma_warn_unused arma_inline const T1& conj(const BaseCube& A) { arma_debug_sigprint(); return A.get_ref(); } template arma_warn_unused arma_inline typename enable_if2< (is_arma_sparse_type::value && is_cx::no), const T1& >::result conj(const T1& X) { arma_debug_sigprint(); return X; } template arma_warn_unused arma_inline typename enable_if2< (is_arma_type::value && is_cx::yes), const eOp >::result conj(const T1& A) { arma_debug_sigprint(); return eOp(A); } template arma_warn_unused arma_inline const eOpCube conj(const BaseCube,T1>& A) { arma_debug_sigprint(); return eOpCube(A.get_ref()); } template arma_warn_unused arma_inline typename enable_if2< (is_arma_sparse_type::value && is_cx::yes), const SpOp >::result conj(const T1& X) { arma_debug_sigprint(); return SpOp(X); } // pow template arma_warn_unused arma_inline typename enable_if2< is_arma_type::value, const eOp >::result pow(const T1& A, const typename T1::elem_type exponent) { arma_debug_sigprint(); return eOp(A, exponent); } template arma_warn_unused arma_inline const eOpCube pow(const BaseCube& A, const typename T1::elem_type exponent) { arma_debug_sigprint(); return eOpCube(A.get_ref(), exponent); } // pow, specialised handling (non-complex exponent for complex matrices) template arma_warn_unused arma_inline typename enable_if2< (is_arma_type::value && is_cx::yes), const eOp >::result pow(const T1& A, const typename T1::elem_type::value_type exponent) { arma_debug_sigprint(); typedef typename T1::elem_type eT; return eOp(A, eT(exponent)); } template arma_warn_unused arma_inline const eOpCube pow(const BaseCube,T1>& A, const typename T1::elem_type::value_type exponent) { arma_debug_sigprint(); typedef std::complex eT; return eOpCube(A.get_ref(), eT(exponent)); } // // floor template arma_warn_unused arma_inline typename enable_if2< is_arma_type::value, const eOp >::result floor(const T1& A) { arma_debug_sigprint(); return eOp(A); } template arma_warn_unused arma_inline const eOpCube floor(const BaseCube& A) { arma_debug_sigprint(); return eOpCube(A.get_ref()); } template arma_warn_unused arma_inline typename enable_if2< is_arma_sparse_type::value, const SpOp >::result floor(const T1& X) { arma_debug_sigprint(); return SpOp(X); } // // ceil template arma_warn_unused arma_inline typename enable_if2< is_arma_type::value, const eOp >::result ceil(const T1& A) { arma_debug_sigprint(); return eOp(A); } template arma_warn_unused arma_inline const eOpCube ceil(const BaseCube& A) { arma_debug_sigprint(); return eOpCube(A.get_ref()); } template arma_warn_unused arma_inline typename enable_if2< is_arma_sparse_type::value, const SpOp >::result ceil(const T1& X) { arma_debug_sigprint(); return SpOp(X); } // // round template arma_warn_unused arma_inline typename enable_if2< is_arma_type::value, const eOp >::result round(const T1& A) { arma_debug_sigprint(); return eOp(A); } template arma_warn_unused arma_inline const eOpCube round(const BaseCube& A) { arma_debug_sigprint(); return eOpCube(A.get_ref()); } template arma_warn_unused arma_inline typename enable_if2< is_arma_sparse_type::value, const SpOp >::result round(const T1& X) { arma_debug_sigprint(); return SpOp(X); } // // trunc template arma_warn_unused arma_inline typename enable_if2< is_arma_type::value, const eOp >::result trunc(const T1& A) { arma_debug_sigprint(); return eOp(A); } template arma_warn_unused arma_inline const eOpCube trunc(const BaseCube& A) { arma_debug_sigprint(); return eOpCube(A.get_ref()); } template arma_warn_unused arma_inline typename enable_if2< is_arma_sparse_type::value, const SpOp >::result trunc(const T1& X) { arma_debug_sigprint(); return SpOp(X); } // // sign template arma_warn_unused arma_inline typename arma_scalar_only::result sign(const eT x) { arma_debug_sigprint(); return arma_sign(x); } template arma_warn_unused arma_inline typename enable_if2< is_arma_type::value, const eOp >::result sign(const T1& A) { arma_debug_sigprint(); return eOp(A); } template arma_warn_unused arma_inline const eOpCube sign(const BaseCube& A) { arma_debug_sigprint(); return eOpCube(A.get_ref()); } template arma_warn_unused arma_inline typename enable_if2< is_arma_sparse_type::value, const SpOp >::result sign(const T1& X) { arma_debug_sigprint(); return SpOp(X); } // // erf template arma_warn_unused arma_inline typename enable_if2< (is_arma_type::value && is_cx::no), const eOp >::result erf(const T1& A) { arma_debug_sigprint(); return eOp(A); } template arma_warn_unused arma_inline typename enable_if2< is_cx::no, const eOpCube >::result erf(const BaseCube& A) { arma_debug_sigprint(); return eOpCube(A.get_ref()); } // // erfc template arma_warn_unused arma_inline typename enable_if2< (is_arma_type::value && is_cx::no), const eOp >::result erfc(const T1& A) { arma_debug_sigprint(); return eOp(A); } template arma_warn_unused arma_inline typename enable_if2< is_cx::no, const eOpCube >::result erfc(const BaseCube& A) { arma_debug_sigprint(); return eOpCube(A.get_ref()); } // // lgamma template arma_warn_unused arma_inline typename enable_if2< (is_arma_type::value && is_cx::no), const eOp >::result lgamma(const T1& A) { arma_debug_sigprint(); return eOp(A); } template arma_warn_unused arma_inline typename enable_if2< is_cx::no, const eOpCube >::result lgamma(const BaseCube& A) { arma_debug_sigprint(); return eOpCube(A.get_ref()); } // // tgamma template arma_warn_unused arma_inline typename enable_if2< (is_arma_type::value && is_cx::no), const eOp >::result tgamma(const T1& A) { arma_debug_sigprint(); return eOp(A); } template arma_warn_unused arma_inline typename enable_if2< is_cx::no, const eOpCube >::result tgamma(const BaseCube& A) { arma_debug_sigprint(); return eOpCube(A.get_ref()); } // the functions below are currently unused; reserved for potential future use template void exp_approx(const T1&) { arma_stop_logic_error("unimplemented"); } template void log_approx(const T1&) { arma_stop_logic_error("unimplemented"); } template void approx_exp(const T1&) { arma_stop_logic_error("unimplemented"); } template void approx_log(const T1&) { arma_stop_logic_error("unimplemented"); } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_dot.hpp0000644000176200001440000001664714753644716022411 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_dot //! @{ template arma_warn_unused arma_inline typename enable_if2 < is_arma_type::value && is_arma_type::value && is_same_type::yes, typename T1::elem_type >::result dot ( const T1& A, const T2& B ) { arma_debug_sigprint(); return op_dot::apply(A,B); } template arma_warn_unused inline typename enable_if2 < is_arma_type::value && is_arma_type::value && is_same_type::no, typename promote_type::result >::result dot ( const T1& A, const T2& B ) { arma_debug_sigprint(); return op_dot_mixed::apply(A,B); } template arma_warn_unused inline typename enable_if2 < is_arma_type::value && is_arma_type::value && is_same_type::value, typename T1::elem_type >::result norm_dot ( const T1& A, const T2& B ) { arma_debug_sigprint(); return op_norm_dot::apply(A,B); } // // cdot template arma_warn_unused arma_inline typename enable_if2 < is_arma_type::value && is_arma_type::value && is_same_type::value && is_cx::no, typename T1::elem_type >::result cdot ( const T1& A, const T2& B ) { arma_debug_sigprint(); return op_dot::apply(A,B); } template arma_warn_unused arma_inline typename enable_if2 < is_arma_type::value && is_arma_type::value && is_same_type::value && is_cx::yes, typename T1::elem_type >::result cdot ( const T1& A, const T2& B ) { arma_debug_sigprint(); return op_cdot::apply(A,B); } // convert dot(htrans(x), y) to cdot(x,y) template arma_warn_unused arma_inline typename enable_if2 < is_arma_type::value && is_same_type::value && is_cx::yes, typename T1::elem_type >::result dot ( const Op& A, const T2& B ) { arma_debug_sigprint(); return cdot(A.m, B); } // // for sparse matrices // namespace priv { template arma_hot inline typename T1::elem_type dot_helper(const SpProxy& pa, const SpProxy& pb) { typedef typename T1::elem_type eT; // Iterate over both objects and see when they are the same eT result = eT(0); typename SpProxy::const_iterator_type a_it = pa.begin(); typename SpProxy::const_iterator_type a_end = pa.end(); typename SpProxy::const_iterator_type b_it = pb.begin(); typename SpProxy::const_iterator_type b_end = pb.end(); while((a_it != a_end) && (b_it != b_end)) { if(a_it == b_it) { result += (*a_it) * (*b_it); ++a_it; ++b_it; } else if((a_it.col() < b_it.col()) || ((a_it.col() == b_it.col()) && (a_it.row() < b_it.row()))) { // a_it is "behind" ++a_it; } else { // b_it is "behind" ++b_it; } } return result; } } //! dot product of two sparse objects template arma_warn_unused arma_hot inline typename enable_if2 <(is_arma_sparse_type::value) && (is_arma_sparse_type::value) && (is_same_type::value), typename T1::elem_type >::result dot ( const T1& x, const T2& y ) { arma_debug_sigprint(); const SpProxy pa(x); const SpProxy pb(y); arma_conform_assert_same_size(pa.get_n_rows(), pa.get_n_cols(), pb.get_n_rows(), pb.get_n_cols(), "dot()"); typedef typename T1::elem_type eT; typedef typename SpProxy::stored_type pa_Q_type; typedef typename SpProxy::stored_type pb_Q_type; if( ( (SpProxy::use_iterator == false) && (SpProxy::use_iterator == false) ) && ( (is_SpMat::value == true ) && (is_SpMat::value == true ) ) ) { const unwrap_spmat tmp_a(pa.Q); const unwrap_spmat tmp_b(pb.Q); const SpMat& A = tmp_a.M; const SpMat& B = tmp_b.M; if( &A == &B ) { // We can do it directly! return op_dot::direct_dot(A.n_nonzero, A.values, A.values); } else { return priv::dot_helper(pa,pb); } } else { return priv::dot_helper(pa,pb); } } //! dot product of one dense and one sparse object template arma_warn_unused arma_hot inline typename enable_if2 <(is_arma_type::value) && (is_arma_sparse_type::value) && (is_same_type::value), typename T1::elem_type >::result dot ( const T1& x, const T2& y ) { arma_debug_sigprint(); typedef typename T1::elem_type eT; if(is_SpSubview_col::value) { // TODO: refactor to use C++17 "if constexpr" to avoid reinterpret_cast shenanigans const SpSubview_col& yy = reinterpret_cast< const SpSubview_col& >(y); if(yy.n_rows == yy.m.n_rows) { arma_debug_print("using sparse column vector specialisation"); const quasi_unwrap U(x); arma_conform_assert_same_size(U.M.n_elem, uword(1), yy.n_elem, uword(1), "dot()"); yy.m.sync(); return dense_sparse_helper::dot(U.M.memptr(), yy.m, yy.aux_col1); } } const Proxy pa(x); const SpProxy pb(y); arma_conform_assert_same_size(pa.get_n_rows(), pa.get_n_cols(), pb.get_n_rows(), pb.get_n_cols(), "dot()"); eT result = eT(0); typename SpProxy::const_iterator_type it = pb.begin(); typename SpProxy::const_iterator_type it_end = pb.end(); // use_at == false won't save us operations while(it != it_end) { result += (*it) * pa.at(it.row(), it.col()); ++it; } return result; } //! dot product of one sparse and one dense object template arma_warn_unused arma_hot inline typename enable_if2 <(is_arma_sparse_type::value) && (is_arma_type::value) && (is_same_type::value), typename T1::elem_type >::result dot ( const T1& x, const T2& y ) { arma_debug_sigprint(); // this is commutative return dot(y, x); } //! @} RcppArmadillo/inst/include/armadillo_bits/eOpCube_bones.hpp0000644000176200001440000000561414752446051023627 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup eOpCube //! @{ template class eOpCube : public BaseCube< typename T1::elem_type, eOpCube > { public: typedef typename T1::elem_type elem_type; typedef typename get_pod_type::result pod_type; typedef ProxyCube proxy_type; static constexpr bool use_at = ProxyCube::use_at; static constexpr bool use_mp = ProxyCube::use_mp || eop_type::use_mp; static constexpr bool has_subview = ProxyCube::has_subview; const ProxyCube P; elem_type aux; //!< storage of auxiliary data, user defined format uword aux_uword_a; //!< storage of auxiliary data, uword format uword aux_uword_b; //!< storage of auxiliary data, uword format uword aux_uword_c; //!< storage of auxiliary data, uword format inline ~eOpCube(); inline explicit eOpCube(const BaseCube& in_m); inline eOpCube(const BaseCube& in_m, const elem_type in_aux); inline eOpCube(const BaseCube& in_m, const uword in_aux_uword_a, const uword in_aux_uword_b); inline eOpCube(const BaseCube& in_m, const uword in_aux_uword_a, const uword in_aux_uword_b, const uword in_aux_uword_c); inline eOpCube(const BaseCube& in_m, const elem_type in_aux, const uword in_aux_uword_a, const uword in_aux_uword_b, const uword in_aux_uword_c); arma_inline uword get_n_rows() const; arma_inline uword get_n_cols() const; arma_inline uword get_n_elem_slice() const; arma_inline uword get_n_slices() const; arma_inline uword get_n_elem() const; arma_inline elem_type operator[] (const uword i) const; arma_inline elem_type at (const uword row, const uword col, const uword slice) const; arma_inline elem_type at_alt (const uword i) const; }; //! @} RcppArmadillo/inst/include/armadillo_bits/Glue_meat.hpp0000644000176200001440000000311514715372502023011 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup Glue //! @{ template inline Glue::Glue(const T1& in_A, const T2& in_B) : A(in_A) , B(in_B) { arma_debug_sigprint(); } template inline Glue::Glue(const T1& in_A, const T2& in_B, const uword in_aux_uword) : A(in_A) , B(in_B) , aux_uword(in_aux_uword) { arma_debug_sigprint(); } template inline Glue::~Glue() { arma_debug_sigprint(); } template template inline bool Glue::is_alias(const Mat& X) const { arma_debug_sigprint(); return (A.is_alias(X) || B.is_alias(X)); } //! @} RcppArmadillo/inst/include/armadillo_bits/op_stddev_meat.hpp0000644000176200001440000000637315030507611024105 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_stddev //! @{ template inline void op_stddev::apply(Mat& out, const mtOp& in) { arma_debug_sigprint(); typedef typename T1::pod_type out_eT; const uword norm_type = in.aux_uword_a; const uword dim = in.aux_uword_b; arma_conform_check( (norm_type > 1), "stddev(): parameter 'norm_type' must be 0 or 1" ); arma_conform_check( (dim > 1), "stddev(): parameter 'dim' must be 0 or 1" ); const quasi_unwrap U(in.m); if(U.is_alias(out)) { Mat tmp; op_stddev::apply_noalias(tmp, U.M, norm_type, dim); out.steal_mem(tmp); } else { op_stddev::apply_noalias(out, U.M, norm_type, dim); } } template inline void op_stddev::apply_noalias(Mat::result>& out, const Mat& X, const uword norm_type, const uword dim) { arma_debug_sigprint(); typedef typename get_pod_type::result out_eT; const uword X_n_rows = X.n_rows; const uword X_n_cols = X.n_cols; if(dim == 0) { arma_debug_print("op_stddev::apply_noalias(): dim = 0"); out.set_size((X_n_rows > 0) ? 1 : 0, X_n_cols); if(X_n_rows > 0) { out_eT* out_mem = out.memptr(); for(uword col=0; col < X_n_cols; ++col) { out_mem[col] = std::sqrt( op_var::direct_var( X.colptr(col), X_n_rows, norm_type ) ); } } } else if(dim == 1) { arma_debug_print("op_stddev::apply_noalias(): dim = 1"); out.set_size(X_n_rows, (X_n_cols > 0) ? 1 : 0); if(X_n_cols > 0) { out_eT* out_mem = out.memptr(); podarray tmp; for(uword row=0; row < X_n_rows; ++row) { tmp.copy_row(X, row); out_mem[row] = std::sqrt( op_var::direct_var( tmp.memptr(), tmp.n_elem, norm_type) ); } } } } template inline typename T1::pod_type op_stddev::stddev_vec(const T1& X, const uword norm_type) { arma_debug_sigprint(); typedef typename T1::pod_type T; arma_conform_check( (norm_type > 1), "stddev(): parameter 'norm_type' must be 0 or 1" ); const quasi_unwrap U(X); if(U.M.n_elem == 0) { arma_conform_check(true, "stddev(): object has no elements"); return Datum::nan; } return std::sqrt( op_var::direct_var(U.M.memptr(), U.M.n_elem, norm_type) ); } //! @} RcppArmadillo/inst/include/armadillo_bits/Row_meat.hpp0000644000176200001440000011400014723642672022667 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup Row //! @{ //! construct an empty row vector template inline Row::Row() : Mat(arma_vec_indicator(), 2) { arma_debug_sigprint(); } template inline Row::Row(const Row& X) : Mat(arma_vec_indicator(), 1, X.n_elem, 2) { arma_debug_sigprint(); arrayops::copy((*this).memptr(), X.memptr(), X.n_elem); } //! construct a row vector with the specified number of n_elem template inline Row::Row(const uword in_n_elem) : Mat(arma_vec_indicator(), 1, in_n_elem, 2) { arma_debug_sigprint(); arma_debug_print("Row::constructor: zeroing memory"); arrayops::fill_zeros(Mat::memptr(), Mat::n_elem); } template inline Row::Row(const uword in_n_rows, const uword in_n_cols) : Mat(arma_vec_indicator(), 0, 0, 2) { arma_debug_sigprint(); Mat::init_warm(in_n_rows, in_n_cols); arma_debug_print("Row::constructor: zeroing memory"); arrayops::fill_zeros(Mat::memptr(), Mat::n_elem); } template inline Row::Row(const SizeMat& s) : Mat(arma_vec_indicator(), 0, 0, 2) { arma_debug_sigprint(); Mat::init_warm(s.n_rows, s.n_cols); arma_debug_print("Row::constructor: zeroing memory"); arrayops::fill_zeros(Mat::memptr(), Mat::n_elem); } //! internal use only template template inline Row::Row(const uword in_n_elem, const arma_initmode_indicator&) : Mat(arma_vec_indicator(), 1, in_n_elem, 2) { arma_debug_sigprint(); if(do_zeros) { arma_debug_print("Row::constructor: zeroing memory"); arrayops::fill_zeros(Mat::memptr(), Mat::n_elem); } else { arma_debug_print("Row::constructor: not zeroing memory"); } } //! internal use only template template inline Row::Row(const uword in_n_rows, const uword in_n_cols, const arma_initmode_indicator&) : Mat(arma_vec_indicator(), 0, 0, 2) { arma_debug_sigprint(); Mat::init_warm(in_n_rows, in_n_cols); if(do_zeros) { arma_debug_print("Row::constructor: zeroing memory"); arrayops::fill_zeros(Mat::memptr(), Mat::n_elem); } else { arma_debug_print("Row::constructor: not zeroing memory"); } } //! internal use only template template inline Row::Row(const SizeMat& s, const arma_initmode_indicator&) : Mat(arma_vec_indicator(), 0, 0, 2) { arma_debug_sigprint(); Mat::init_warm(s.n_rows, s.n_cols); if(do_zeros) { arma_debug_print("Row::constructor: zeroing memory"); arrayops::fill_zeros(Mat::memptr(), Mat::n_elem); } else { arma_debug_print("Row::constructor: not zeroing memory"); } } template template inline Row::Row(const uword in_n_elem, const fill::fill_class& f) : Mat(arma_vec_indicator(), 1, in_n_elem, 2) { arma_debug_sigprint(); (*this).fill(f); } template template inline Row::Row(const uword in_n_rows, const uword in_n_cols, const fill::fill_class& f) : Mat(arma_vec_indicator(), 0, 0, 2) { arma_debug_sigprint(); Mat::init_warm(in_n_rows, in_n_cols); (*this).fill(f); } template template inline Row::Row(const SizeMat& s, const fill::fill_class& f) : Mat(arma_vec_indicator(), 0, 0, 2) { arma_debug_sigprint(); Mat::init_warm(s.n_rows, s.n_cols); (*this).fill(f); } template inline Row::Row(const uword in_n_elem, const fill::scalar_holder f) : Mat(arma_vec_indicator(), 1, in_n_elem, 2) { arma_debug_sigprint(); (*this).fill(f.scalar); } template inline Row::Row(const uword in_n_rows, const uword in_n_cols, const fill::scalar_holder f) : Mat(arma_vec_indicator(), 0, 0, 2) { arma_debug_sigprint(); Mat::init_warm(in_n_rows, in_n_cols); (*this).fill(f.scalar); } template inline Row::Row(const SizeMat& s, const fill::scalar_holder f) : Mat(arma_vec_indicator(), 0, 0, 2) { arma_debug_sigprint(); Mat::init_warm(s.n_rows, s.n_cols); (*this).fill(f.scalar); } template inline Row::Row(const char* text) : Mat(arma_vec_indicator(), 2) { arma_debug_sigprint(); (*this).operator=(text); } template inline Row& Row::operator=(const char* text) { arma_debug_sigprint(); Mat tmp(text); arma_conform_check( ((tmp.n_elem > 0) && (tmp.is_vec() == false)), "Mat::init(): requested size is not compatible with row vector layout" ); access::rw(tmp.n_rows) = 1; access::rw(tmp.n_cols) = tmp.n_elem; (*this).steal_mem(tmp); return *this; } template inline Row::Row(const std::string& text) : Mat(arma_vec_indicator(), 2) { arma_debug_sigprint(); (*this).operator=(text); } template inline Row& Row::operator=(const std::string& text) { arma_debug_sigprint(); Mat tmp(text); arma_conform_check( ((tmp.n_elem > 0) && (tmp.is_vec() == false)), "Mat::init(): requested size is not compatible with row vector layout" ); access::rw(tmp.n_rows) = 1; access::rw(tmp.n_cols) = tmp.n_elem; (*this).steal_mem(tmp); return *this; } //! create a row vector from std::vector template inline Row::Row(const std::vector& x) : Mat(arma_vec_indicator(), 1, uword(x.size()), 2) { arma_debug_sigprint_this(this); const uword N = uword(x.size()); if(N > 0) { arrayops::copy( Mat::memptr(), &(x[0]), N ); } } //! create a row vector from std::vector template inline Row& Row::operator=(const std::vector& x) { arma_debug_sigprint(); const uword N = uword(x.size()); Mat::init_warm(1, N); if(N > 0) { arrayops::copy( Mat::memptr(), &(x[0]), N ); } return *this; } template inline Row::Row(const std::initializer_list& list) : Mat(arma_vec_indicator(), 1, uword(list.size()), 2) { arma_debug_sigprint_this(this); const uword N = uword(list.size()); if(N > 0) { arrayops::copy( Mat::memptr(), list.begin(), N ); } } template inline Row& Row::operator=(const std::initializer_list& list) { arma_debug_sigprint(); const uword N = uword(list.size()); Mat::init_warm(1, N); if(N > 0) { arrayops::copy( Mat::memptr(), list.begin(), N ); } return *this; } template inline Row::Row(Row&& X) : Mat(arma_vec_indicator(), 2) { arma_debug_sigprint(arma_str::format("this: %x; X: %x") % this % &X); access::rw(Mat::n_rows) = 1; access::rw(Mat::n_cols) = X.n_cols; access::rw(Mat::n_elem) = X.n_elem; access::rw(Mat::n_alloc) = X.n_alloc; if( (X.n_alloc > arma_config::mat_prealloc) || (X.mem_state == 1) || (X.mem_state == 2) ) { access::rw(Mat::mem_state) = X.mem_state; access::rw(Mat::mem) = X.mem; access::rw(X.n_rows) = 1; access::rw(X.n_cols) = 0; access::rw(X.n_elem) = 0; access::rw(X.n_alloc) = 0; access::rw(X.mem_state) = 0; access::rw(X.mem) = nullptr; } else // condition: (X.n_alloc <= arma_config::mat_prealloc) || (X.mem_state == 0) || (X.mem_state == 3) { (*this).init_cold(); arrayops::copy( (*this).memptr(), X.mem, X.n_elem ); if( (X.mem_state == 0) && (X.n_alloc <= arma_config::mat_prealloc) ) { access::rw(X.n_rows) = 1; access::rw(X.n_cols) = 0; access::rw(X.n_elem) = 0; access::rw(X.mem) = nullptr; } } } template inline Row& Row::operator=(Row&& X) { arma_debug_sigprint(arma_str::format("this: %x; X: %x") % this % &X); (*this).steal_mem(X, true); return *this; } // template // inline // Row::Row(Mat&& X) // : Mat(arma_vec_indicator(), 2) // { // arma_debug_sigprint(arma_str::format("this: %x; X: %x") % this % &X); // // if(X.n_rows != 1) { const Mat& XX = X; Mat::operator=(XX); return; } // // access::rw(Mat::n_rows) = 1; // access::rw(Mat::n_cols) = X.n_cols; // access::rw(Mat::n_elem) = X.n_elem; // access::rw(Mat::n_alloc) = X.n_alloc; // // if( (X.n_alloc > arma_config::mat_prealloc) || (X.mem_state == 1) || (X.mem_state == 2) ) // { // access::rw(Mat::mem_state) = X.mem_state; // access::rw(Mat::mem) = X.mem; // // access::rw(X.n_cols) = 0; // access::rw(X.n_elem) = 0; // access::rw(X.n_alloc) = 0; // access::rw(X.mem_state) = 0; // access::rw(X.mem) = nullptr; // } // else // condition: (X.n_alloc <= arma_config::mat_prealloc) || (X.mem_state == 0) || (X.mem_state == 3) // { // (*this).init_cold(); // // arrayops::copy( (*this).memptr(), X.mem, X.n_elem ); // // if( (X.mem_state == 0) && (X.n_alloc <= arma_config::mat_prealloc) ) // { // access::rw(X.n_cols) = 0; // access::rw(X.n_elem) = 0; // access::rw(X.mem) = nullptr; // } // } // } // // // // template // inline // Row& // Row::operator=(Mat&& X) // { // arma_debug_sigprint(arma_str::format("this: %x; X: %x") % this % &X); // // if(X.n_rows != 1) { const Mat& XX = X; Mat::operator=(XX); return *this; } // // (*this).steal_mem(X, true); // // return *this; // } template inline Row& Row::operator=(const eT val) { arma_debug_sigprint(); Mat::operator=(val); return *this; } template inline Row& Row::operator=(const Row& X) { arma_debug_sigprint(); Mat::operator=(X); return *this; } template template inline Row::Row(const Base& X) : Mat(arma_vec_indicator(), 2) { arma_debug_sigprint(); Mat::operator=(X.get_ref()); } template template inline Row& Row::operator=(const Base& X) { arma_debug_sigprint(); Mat::operator=(X.get_ref()); return *this; } template template inline Row::Row(const SpBase& X) : Mat(arma_vec_indicator(), 2) { arma_debug_sigprint(); Mat::operator=(X.get_ref()); } template template inline Row& Row::operator=(const SpBase& X) { arma_debug_sigprint(); Mat::operator=(X.get_ref()); return *this; } //! construct a row vector from a given auxiliary array template inline Row::Row(eT* aux_mem, const uword aux_length, const bool copy_aux_mem, const bool strict) : Mat(aux_mem, 1, aux_length, copy_aux_mem, strict) { arma_debug_sigprint(); access::rw(Mat::vec_state) = 2; } //! construct a row vector from a given auxiliary array template inline Row::Row(const eT* aux_mem, const uword aux_length) : Mat(aux_mem, 1, aux_length) { arma_debug_sigprint(); access::rw(Mat::vec_state) = 2; } template template inline Row::Row ( const Base::pod_type, T1>& A, const Base::pod_type, T2>& B ) { arma_debug_sigprint(); access::rw(Mat::vec_state) = 2; Mat::init(A,B); } template template inline Row::Row(const BaseCube& X) { arma_debug_sigprint(); access::rw(Mat::vec_state) = 2; Mat::operator=(X); } template template inline Row& Row::operator=(const BaseCube& X) { arma_debug_sigprint(); Mat::operator=(X); return *this; } template inline Row::Row(const subview_cube& X) { arma_debug_sigprint(); access::rw(Mat::vec_state) = 2; Mat::operator=(X); } template inline Row& Row::operator=(const subview_cube& X) { arma_debug_sigprint(); Mat::operator=(X); return *this; } template inline mat_injector< Row > Row::operator<<(const eT val) { return mat_injector< Row >(*this, val); } template arma_inline const Op,op_htrans> Row::t() const { return Op,op_htrans>(*this); } template arma_inline const Op,op_htrans> Row::ht() const { return Op,op_htrans>(*this); } template arma_inline const Op,op_strans> Row::st() const { return Op,op_strans>(*this); } template arma_inline const Op,op_strans> Row::as_col() const { return Op,op_strans>(*this); } template arma_inline subview_row Row::col(const uword in_col1) { arma_debug_sigprint(); arma_conform_check_bounds( (in_col1 >= Mat::n_cols), "Row::col(): indices out of bounds or incorrectly used" ); return subview_row(*this, 0, in_col1, 1); } template arma_inline const subview_row Row::col(const uword in_col1) const { arma_debug_sigprint(); arma_conform_check_bounds( (in_col1 >= Mat::n_cols), "Row::col(): indices out of bounds or incorrectly used" ); return subview_row(*this, 0, in_col1, 1); } template arma_inline subview_row Row::cols(const uword in_col1, const uword in_col2) { arma_debug_sigprint(); arma_conform_check_bounds( ( (in_col1 > in_col2) || (in_col2 >= Mat::n_cols) ), "Row::cols(): indices out of bounds or incorrectly used" ); const uword subview_n_cols = in_col2 - in_col1 + 1; return subview_row(*this, 0, in_col1, subview_n_cols); } template arma_inline const subview_row Row::cols(const uword in_col1, const uword in_col2) const { arma_debug_sigprint(); arma_conform_check_bounds( ( (in_col1 > in_col2) || (in_col2 >= Mat::n_cols) ), "Row::cols(): indices out of bounds or incorrectly used" ); const uword subview_n_cols = in_col2 - in_col1 + 1; return subview_row(*this, 0, in_col1, subview_n_cols); } template arma_inline subview_row Row::subvec(const uword in_col1, const uword in_col2) { arma_debug_sigprint(); arma_conform_check_bounds( ( (in_col1 > in_col2) || (in_col2 >= Mat::n_cols) ), "Row::subvec(): indices out of bounds or incorrectly used" ); const uword subview_n_cols = in_col2 - in_col1 + 1; return subview_row(*this, 0, in_col1, subview_n_cols); } template arma_inline const subview_row Row::subvec(const uword in_col1, const uword in_col2) const { arma_debug_sigprint(); arma_conform_check_bounds( ( (in_col1 > in_col2) || (in_col2 >= Mat::n_cols) ), "Row::subvec(): indices out of bounds or incorrectly used" ); const uword subview_n_cols = in_col2 - in_col1 + 1; return subview_row(*this, 0, in_col1, subview_n_cols); } template arma_inline subview_row Row::cols(const span& col_span) { arma_debug_sigprint(); return subvec(col_span); } template arma_inline const subview_row Row::cols(const span& col_span) const { arma_debug_sigprint(); return subvec(col_span); } template arma_inline subview_row Row::subvec(const span& col_span) { arma_debug_sigprint(); const bool col_all = col_span.whole; const uword local_n_cols = Mat::n_cols; const uword in_col1 = col_all ? 0 : col_span.a; const uword in_col2 = col_span.b; const uword subvec_n_cols = col_all ? local_n_cols : in_col2 - in_col1 + 1; arma_conform_check_bounds( ( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= local_n_cols)) ), "Row::subvec(): indices out of bounds or incorrectly used" ); return subview_row(*this, 0, in_col1, subvec_n_cols); } template arma_inline const subview_row Row::subvec(const span& col_span) const { arma_debug_sigprint(); const bool col_all = col_span.whole; const uword local_n_cols = Mat::n_cols; const uword in_col1 = col_all ? 0 : col_span.a; const uword in_col2 = col_span.b; const uword subvec_n_cols = col_all ? local_n_cols : in_col2 - in_col1 + 1; arma_conform_check_bounds( ( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= local_n_cols)) ), "Row::subvec(): indices out of bounds or incorrectly used" ); return subview_row(*this, 0, in_col1, subvec_n_cols); } template arma_inline subview_row Row::operator()(const span& col_span) { arma_debug_sigprint(); return subvec(col_span); } template arma_inline const subview_row Row::operator()(const span& col_span) const { arma_debug_sigprint(); return subvec(col_span); } template arma_inline subview_row Row::subvec(const uword start_col, const SizeMat& s) { arma_debug_sigprint(); arma_conform_check( (s.n_rows != 1), "Row::subvec(): given size does not specify a row vector" ); arma_conform_check_bounds( ( (start_col >= Mat::n_cols) || ((start_col + s.n_cols) > Mat::n_cols) ), "Row::subvec(): size out of bounds" ); return subview_row(*this, 0, start_col, s.n_cols); } template arma_inline const subview_row Row::subvec(const uword start_col, const SizeMat& s) const { arma_debug_sigprint(); arma_conform_check( (s.n_rows != 1), "Row::subvec(): given size does not specify a row vector" ); arma_conform_check_bounds( ( (start_col >= Mat::n_cols) || ((start_col + s.n_cols) > Mat::n_cols) ), "Row::subvec(): size out of bounds" ); return subview_row(*this, 0, start_col, s.n_cols); } template arma_inline subview_row Row::head(const uword N) { arma_debug_sigprint(); arma_conform_check_bounds( (N > Mat::n_cols), "Row::head(): size out of bounds" ); return subview_row(*this, 0, 0, N); } template arma_inline const subview_row Row::head(const uword N) const { arma_debug_sigprint(); arma_conform_check_bounds( (N > Mat::n_cols), "Row::head(): size out of bounds" ); return subview_row(*this, 0, 0, N); } template arma_inline subview_row Row::tail(const uword N) { arma_debug_sigprint(); arma_conform_check_bounds( (N > Mat::n_cols), "Row::tail(): size out of bounds" ); const uword start_col = Mat::n_cols - N; return subview_row(*this, 0, start_col, N); } template arma_inline const subview_row Row::tail(const uword N) const { arma_debug_sigprint(); arma_conform_check_bounds( (N > Mat::n_cols), "Row::tail(): size out of bounds" ); const uword start_col = Mat::n_cols - N; return subview_row(*this, 0, start_col, N); } template arma_inline subview_row Row::head_cols(const uword N) { arma_debug_sigprint(); return (*this).head(N); } template arma_inline const subview_row Row::head_cols(const uword N) const { arma_debug_sigprint(); return (*this).head(N); } template arma_inline subview_row Row::tail_cols(const uword N) { arma_debug_sigprint(); return (*this).tail(N); } template arma_inline const subview_row Row::tail_cols(const uword N) const { arma_debug_sigprint(); return (*this).tail(N); } //! remove specified columns template inline void Row::shed_col(const uword col_num) { arma_debug_sigprint(); arma_conform_check_bounds( col_num >= Mat::n_cols, "Row::shed_col(): index out of bounds" ); shed_cols(col_num, col_num); } //! remove specified columns template inline void Row::shed_cols(const uword in_col1, const uword in_col2) { arma_debug_sigprint(); arma_conform_check_bounds ( (in_col1 > in_col2) || (in_col2 >= Mat::n_cols), "Row::shed_cols(): indices out of bounds or incorrectly used" ); const uword n_keep_front = in_col1; const uword n_keep_back = Mat::n_cols - (in_col2 + 1); Row X(n_keep_front + n_keep_back, arma_nozeros_indicator()); eT* X_mem = X.memptr(); const eT* t_mem = (*this).memptr(); if(n_keep_front > 0) { arrayops::copy( X_mem, t_mem, n_keep_front ); } if(n_keep_back > 0) { arrayops::copy( &(X_mem[n_keep_front]), &(t_mem[in_col2+1]), n_keep_back); } Mat::steal_mem(X); } //! remove specified columns template template inline void Row::shed_cols(const Base& indices) { arma_debug_sigprint(); Mat::shed_cols(indices); } template inline void Row::insert_cols(const uword col_num, const uword N, const bool set_to_zero) { arma_debug_sigprint(); arma_ignore(set_to_zero); (*this).insert_cols(col_num, N); } template inline void Row::insert_cols(const uword col_num, const uword N) { arma_debug_sigprint(); const uword t_n_cols = Mat::n_cols; const uword A_n_cols = col_num; const uword B_n_cols = t_n_cols - col_num; // insertion at col_num == n_cols is in effect an append operation arma_conform_check_bounds( (col_num > t_n_cols), "Row::insert_cols(): index out of bounds" ); if(N == 0) { return; } Row out(t_n_cols + N, arma_nozeros_indicator()); eT* out_mem = out.memptr(); const eT* t_mem = (*this).memptr(); if(A_n_cols > 0) { arrayops::copy( out_mem, t_mem, A_n_cols ); } if(B_n_cols > 0) { arrayops::copy( &(out_mem[col_num + N]), &(t_mem[col_num]), B_n_cols ); } arrayops::fill_zeros( &(out_mem[col_num]), N ); Mat::steal_mem(out); } //! insert the given object at the specified col position; //! the given object must have one row template template inline void Row::insert_cols(const uword col_num, const Base& X) { arma_debug_sigprint(); Mat::insert_cols(col_num, X); } template arma_inline eT& Row::at(const uword i) { return access::rw(Mat::mem[i]); } template arma_inline const eT& Row::at(const uword i) const { return Mat::mem[i]; } template arma_inline eT& Row::at(const uword, const uword in_col) { return access::rw( Mat::mem[in_col] ); } template arma_inline const eT& Row::at(const uword, const uword in_col) const { return Mat::mem[in_col]; } template inline typename Row::row_iterator Row::begin_row(const uword row_num) { arma_debug_sigprint(); arma_conform_check_bounds( (row_num >= Mat::n_rows), "Row::begin_row(): index out of bounds" ); return Mat::memptr(); } template inline typename Row::const_row_iterator Row::begin_row(const uword row_num) const { arma_debug_sigprint(); arma_conform_check_bounds( (row_num >= Mat::n_rows), "Row::begin_row(): index out of bounds" ); return Mat::memptr(); } template inline typename Row::row_iterator Row::end_row(const uword row_num) { arma_debug_sigprint(); arma_conform_check_bounds( (row_num >= Mat::n_rows), "Row::end_row(): index out of bounds" ); return Mat::memptr() + Mat::n_cols; } template inline typename Row::const_row_iterator Row::end_row(const uword row_num) const { arma_debug_sigprint(); arma_conform_check_bounds( (row_num >= Mat::n_rows), "Row::end_row(): index out of bounds" ); return Mat::memptr() + Mat::n_cols; } template template arma_inline Row::fixed::fixed() : Row( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local_extra : Mat::mem_local) ) { arma_debug_sigprint_this(this); arma_debug_print("Row::fixed::constructor: zeroing memory"); eT* mem_use = (use_extra) ? &(mem_local_extra[0]) : &(Mat::mem_local[0]); arrayops::inplace_set_fixed( mem_use, eT(0) ); } template template arma_inline Row::fixed::fixed(const fixed& X) : Row( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local_extra : Mat::mem_local) ) { arma_debug_sigprint_this(this); eT* dest = (use_extra) ? mem_local_extra : Mat::mem_local; const eT* src = (use_extra) ? X.mem_local_extra : X.mem_local; arrayops::copy( dest, src, fixed_n_elem ); } template template arma_inline Row::fixed::fixed(const subview_cube& X) : Row( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local_extra : Mat::mem_local) ) { arma_debug_sigprint_this(this); Row::operator=(X); } template template inline Row::fixed::fixed(const fill::scalar_holder f) : Row( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local_extra : Mat::mem_local) ) { arma_debug_sigprint_this(this); (*this).fill(f.scalar); } template template template inline Row::fixed::fixed(const fill::fill_class&) : Row( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local_extra : Mat::mem_local) ) { arma_debug_sigprint_this(this); if(is_same_type::yes) { (*this).zeros(); } if(is_same_type::yes) { (*this).ones(); } if(is_same_type::yes) { Mat::eye(); } if(is_same_type::yes) { Mat::randu(); } if(is_same_type::yes) { Mat::randn(); } } template template template arma_inline Row::fixed::fixed(const Base& A) : Row( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local_extra : Mat::mem_local) ) { arma_debug_sigprint_this(this); Row::operator=(A.get_ref()); } template template template arma_inline Row::fixed::fixed(const Base& A, const Base& B) : Row( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local_extra : Mat::mem_local) ) { arma_debug_sigprint_this(this); Row::init(A,B); } template template inline Row::fixed::fixed(const eT* aux_mem) : Row( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local_extra : Mat::mem_local) ) { arma_debug_sigprint_this(this); eT* dest = (use_extra) ? mem_local_extra : Mat::mem_local; arrayops::copy( dest, aux_mem, fixed_n_elem ); } template template inline Row::fixed::fixed(const char* text) : Row( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local_extra : Mat::mem_local) ) { arma_debug_sigprint_this(this); Row::operator=(text); } template template inline Row::fixed::fixed(const std::string& text) : Row( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local_extra : Mat::mem_local) ) { arma_debug_sigprint_this(this); Row::operator=(text); } template template template Row& Row::fixed::operator=(const Base& A) { arma_debug_sigprint(); Row::operator=(A.get_ref()); return *this; } template template Row& Row::fixed::operator=(const eT val) { arma_debug_sigprint(); Row::operator=(val); return *this; } template template Row& Row::fixed::operator=(const char* text) { arma_debug_sigprint(); Row::operator=(text); return *this; } template template Row& Row::fixed::operator=(const std::string& text) { arma_debug_sigprint(); Row::operator=(text); return *this; } template template Row& Row::fixed::operator=(const subview_cube& X) { arma_debug_sigprint(); Row::operator=(X); return *this; } template template inline Row::fixed::fixed(const std::initializer_list& list) : Row( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local_extra : Mat::mem_local) ) { arma_debug_sigprint_this(this); (*this).operator=(list); } template template inline Row& Row::fixed::operator=(const std::initializer_list& list) { arma_debug_sigprint(); const uword N = uword(list.size()); arma_conform_check( (N > fixed_n_elem), "Row::fixed: initialiser list is too long" ); eT* this_mem = (*this).memptr(); arrayops::copy( this_mem, list.begin(), N ); for(uword iq=N; iq < fixed_n_elem; ++iq) { this_mem[iq] = eT(0); } return *this; } template template arma_inline Row& Row::fixed::operator=(const fixed& X) { arma_debug_sigprint(); if(this != &X) { eT* dest = (use_extra) ? mem_local_extra : Mat::mem_local; const eT* src = (use_extra) ? X.mem_local_extra : X.mem_local; arrayops::copy( dest, src, fixed_n_elem ); } return *this; } #if defined(ARMA_GOOD_COMPILER) template template template inline Row& Row::fixed::operator=(const eOp& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); const bool bad_alias = (eOp::proxy_type::has_subview && X.P.is_alias(*this)); if(bad_alias == false) { arma_conform_assert_same_size(uword(1), fixed_n_elem, X.get_n_rows(), X.get_n_cols(), "Row::fixed::operator="); eop_type::apply(*this, X); } else { arma_debug_print("bad_alias = true"); Row tmp(X); (*this) = tmp; } return *this; } template template template inline Row& Row::fixed::operator=(const eGlue& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); arma_type_check(( is_same_type< eT, typename T2::elem_type >::no )); const bool bad_alias = ( (eGlue::proxy1_type::has_subview && X.P1.is_alias(*this)) || (eGlue::proxy2_type::has_subview && X.P2.is_alias(*this)) ); if(bad_alias == false) { arma_conform_assert_same_size(uword(1), fixed_n_elem, X.get_n_rows(), X.get_n_cols(), "Row::fixed::operator="); eglue_type::apply(*this, X); } else { arma_debug_print("bad_alias = true"); Row tmp(X); (*this) = tmp; } return *this; } #endif template template arma_inline const Op< typename Row::template fixed::Row_fixed_type, op_htrans > Row::fixed::t() const { return Op< typename Row::template fixed::Row_fixed_type, op_htrans >(*this); } template template arma_inline const Op< typename Row::template fixed::Row_fixed_type, op_htrans > Row::fixed::ht() const { return Op< typename Row::template fixed::Row_fixed_type, op_htrans >(*this); } template template arma_inline const Op< typename Row::template fixed::Row_fixed_type, op_strans > Row::fixed::st() const { return Op< typename Row::template fixed::Row_fixed_type, op_strans >(*this); } template template arma_inline const eT& Row::fixed::at_alt(const uword ii) const { #if defined(ARMA_HAVE_ALIGNED_ATTRIBUTE) return (use_extra) ? mem_local_extra[ii] : Mat::mem_local[ii]; #else const eT* mem_aligned = (use_extra) ? mem_local_extra : Mat::mem_local; memory::mark_as_aligned(mem_aligned); return mem_aligned[ii]; #endif } template template arma_inline eT& Row::fixed::operator[] (const uword ii) { return (use_extra) ? mem_local_extra[ii] : Mat::mem_local[ii]; } template template arma_inline const eT& Row::fixed::operator[] (const uword ii) const { return (use_extra) ? mem_local_extra[ii] : Mat::mem_local[ii]; } template template arma_inline eT& Row::fixed::at(const uword ii) { return (use_extra) ? mem_local_extra[ii] : Mat::mem_local[ii]; } template template arma_inline const eT& Row::fixed::at(const uword ii) const { return (use_extra) ? mem_local_extra[ii] : Mat::mem_local[ii]; } template template arma_inline eT& Row::fixed::operator() (const uword ii) { arma_conform_check_bounds( (ii >= fixed_n_elem), "Row::operator(): index out of bounds" ); return (use_extra) ? mem_local_extra[ii] : Mat::mem_local[ii]; } template template arma_inline const eT& Row::fixed::operator() (const uword ii) const { arma_conform_check_bounds( (ii >= fixed_n_elem), "Row::operator(): index out of bounds" ); return (use_extra) ? mem_local_extra[ii] : Mat::mem_local[ii]; } template template arma_inline eT& Row::fixed::at(const uword, const uword in_col) { return (use_extra) ? mem_local_extra[in_col] : Mat::mem_local[in_col]; } template template arma_inline const eT& Row::fixed::at(const uword, const uword in_col) const { return (use_extra) ? mem_local_extra[in_col] : Mat::mem_local[in_col]; } template template arma_inline eT& Row::fixed::operator() (const uword in_row, const uword in_col) { arma_conform_check_bounds( ((in_row > 0) || (in_col >= fixed_n_elem)), "Row::operator(): index out of bounds" ); return (use_extra) ? mem_local_extra[in_col] : Mat::mem_local[in_col]; } template template arma_inline const eT& Row::fixed::operator() (const uword in_row, const uword in_col) const { arma_conform_check_bounds( ((in_row > 0) || (in_col >= fixed_n_elem)), "Row::operator(): index out of bounds" ); return (use_extra) ? mem_local_extra[in_col] : Mat::mem_local[in_col]; } template template arma_inline eT* Row::fixed::memptr() { return (use_extra) ? mem_local_extra : Mat::mem_local; } template template arma_inline const eT* Row::fixed::memptr() const { return (use_extra) ? mem_local_extra : Mat::mem_local; } template template inline const Row& Row::fixed::fill(const eT val) { arma_debug_sigprint(); eT* mem_use = (use_extra) ? &(mem_local_extra[0]) : &(Mat::mem_local[0]); arrayops::inplace_set_fixed( mem_use, val ); return *this; } template template inline const Row& Row::fixed::zeros() { arma_debug_sigprint(); eT* mem_use = (use_extra) ? &(mem_local_extra[0]) : &(Mat::mem_local[0]); arrayops::inplace_set_fixed( mem_use, eT(0) ); return *this; } template template inline const Row& Row::fixed::ones() { arma_debug_sigprint(); eT* mem_use = (use_extra) ? &(mem_local_extra[0]) : &(Mat::mem_local[0]); arrayops::inplace_set_fixed( mem_use, eT(1) ); return *this; } template inline Row::Row(const arma_fixed_indicator&, const uword in_n_elem, const eT* in_mem) : Mat(arma_fixed_indicator(), 1, in_n_elem, 2, in_mem) { arma_debug_sigprint_this(this); } #if defined(ARMA_EXTRA_ROW_MEAT) #include ARMA_INCFILE_WRAP(ARMA_EXTRA_ROW_MEAT) #endif //! @} RcppArmadillo/inst/include/armadillo_bits/op_hist_bones.hpp0000644000176200001440000000217514301267043023741 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_hist //! @{ class op_hist : public traits_op_passthru { public: template inline static void apply_noalias(Mat& out, const Mat& A, const uword n_bins, const uword dim); template inline static void apply(Mat& out, const mtOp& X); }; //! @} RcppArmadillo/inst/include/armadillo_bits/spglue_schur_meat.hpp0000644000176200001440000002327015013306507024616 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup spglue_schur //! @{ template inline void spglue_schur::apply(SpMat& out, const SpGlue& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const SpProxy pa(X.A); const SpProxy pb(X.B); const bool is_alias = pa.is_alias(out) || pb.is_alias(out); if(is_alias == false) { spglue_schur::apply_noalias(out, pa, pb); } else { SpMat tmp; spglue_schur::apply_noalias(tmp, pa, pb); out.steal_mem(tmp); } } template inline void spglue_schur::apply_noalias(SpMat& out, const SpProxy& pa, const SpProxy& pb) { arma_debug_sigprint(); arma_conform_assert_same_size(pa.get_n_rows(), pa.get_n_cols(), pb.get_n_rows(), pb.get_n_cols(), "element-wise multiplication"); if( (pa.get_n_nonzero() == 0) && (pb.get_n_nonzero() == 0) ) { out.zeros(pa.get_n_rows(), pa.get_n_cols()); return; } const uword max_n_nonzero = pa.get_n_nonzero() + pb.get_n_nonzero(); // Resize memory to upper bound out.reserve(pa.get_n_rows(), pa.get_n_cols(), max_n_nonzero); // Now iterate across both matrices. typename SpProxy::const_iterator_type x_it = pa.begin(); typename SpProxy::const_iterator_type x_end = pa.end(); typename SpProxy::const_iterator_type y_it = pb.begin(); typename SpProxy::const_iterator_type y_end = pb.end(); uword count = 0; while( (x_it != x_end) || (y_it != y_end) ) { eT out_val; const uword x_it_row = x_it.row(); const uword x_it_col = x_it.col(); const uword y_it_row = y_it.row(); const uword y_it_col = y_it.col(); bool use_y_loc = false; if(x_it == y_it) { out_val = (*x_it) * (*y_it); ++x_it; ++y_it; } else { if((x_it_col < y_it_col) || ((x_it_col == y_it_col) && (x_it_row < y_it_row))) // if y is closer to the end { out_val = (*x_it) * eT(0); // in case (*x_it) is inf or nan ++x_it; } else { out_val = eT(0) * (*y_it); // in case (*y_it) is inf or nan ++y_it; use_y_loc = true; } } if(out_val != eT(0)) { access::rw(out.values[count]) = out_val; const uword out_row = (use_y_loc == false) ? x_it_row : y_it_row; const uword out_col = (use_y_loc == false) ? x_it_col : y_it_col; access::rw(out.row_indices[count]) = out_row; access::rw(out.col_ptrs[out_col + 1])++; ++count; } arma_check( (count > max_n_nonzero), "internal error: spglue_schur::apply_noalias(): count > max_n_nonzero" ); } const uword out_n_cols = out.n_cols; uword* col_ptrs = access::rwp(out.col_ptrs); // Fix column pointers to be cumulative. for(uword c = 1; c <= out_n_cols; ++c) { col_ptrs[c] += col_ptrs[c - 1]; } if(count < max_n_nonzero) { if(count <= (max_n_nonzero/2)) { out.mem_resize(count); } else { // quick resize without reallocating memory and copying data access::rw( out.n_nonzero) = count; access::rw( out.values[count]) = eT(0); access::rw(out.row_indices[count]) = uword(0); } } } template inline void spglue_schur::apply_noalias(SpMat& out, const SpMat& A, const SpMat& B) { arma_debug_sigprint(); const SpProxy< SpMat > pa(A); const SpProxy< SpMat > pb(B); spglue_schur::apply_noalias(out, pa, pb); } // // // template inline void spglue_schur_misc::dense_schur_sparse(SpMat& out, const T1& x, const T2& y) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const Proxy pa(x); const SpProxy pb(y); arma_conform_assert_same_size(pa.get_n_rows(), pa.get_n_cols(), pb.get_n_rows(), pb.get_n_cols(), "element-wise multiplication"); const uword max_n_nonzero = pb.get_n_nonzero(); // Resize memory to upper bound. out.reserve(pa.get_n_rows(), pa.get_n_cols(), max_n_nonzero); uword count = 0; typename SpProxy::const_iterator_type it = pb.begin(); typename SpProxy::const_iterator_type it_end = pb.end(); while(it != it_end) { const uword it_row = it.row(); const uword it_col = it.col(); const eT val = (*it) * pa.at(it_row, it_col); if(val != eT(0)) { access::rw( out.values[count]) = val; access::rw( out.row_indices[count]) = it_row; access::rw(out.col_ptrs[it_col + 1])++; ++count; } ++it; arma_check( (count > max_n_nonzero), "internal error: spglue_schur_misc::dense_schur_sparse(): count > max_n_nonzero" ); } // Fix column pointers. for(uword c = 1; c <= out.n_cols; ++c) { access::rw(out.col_ptrs[c]) += out.col_ptrs[c - 1]; } if(count < max_n_nonzero) { if(count <= (max_n_nonzero/2)) { out.mem_resize(count); } else { // quick resize without reallocating memory and copying data access::rw( out.n_nonzero) = count; access::rw( out.values[count]) = eT(0); access::rw(out.row_indices[count]) = uword(0); } } } // template inline void spglue_schur_mixed::apply(SpMat::eT>& out, const mtSpGlue::eT, T1, T2, spglue_schur_mixed>& expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT1; typedef typename T2::elem_type eT2; typedef typename promote_type::result out_eT; promote_type::check(); if( (is_same_type::no) && (is_same_type::yes) ) { // upgrade T1 const unwrap_spmat UA(expr.A); const unwrap_spmat UB(expr.B); const SpMat& A = UA.M; const SpMat& B = UB.M; SpMat AA(arma_layout_indicator(), A); for(uword i=0; i < A.n_nonzero; ++i) { access::rw(AA.values[i]) = out_eT(A.values[i]); } const SpMat& BB = reinterpret_cast< const SpMat& >(B); out = AA % BB; } else if( (is_same_type::yes) && (is_same_type::no) ) { // upgrade T2 const unwrap_spmat UA(expr.A); const unwrap_spmat UB(expr.B); const SpMat& A = UA.M; const SpMat& B = UB.M; const SpMat& AA = reinterpret_cast< const SpMat& >(A); SpMat BB(arma_layout_indicator(), B); for(uword i=0; i < B.n_nonzero; ++i) { access::rw(BB.values[i]) = out_eT(B.values[i]); } out = AA % BB; } else { // upgrade T1 and T2 const unwrap_spmat UA(expr.A); const unwrap_spmat UB(expr.B); const SpMat& A = UA.M; const SpMat& B = UB.M; SpMat AA(arma_layout_indicator(), A); SpMat BB(arma_layout_indicator(), B); for(uword i=0; i < A.n_nonzero; ++i) { access::rw(AA.values[i]) = out_eT(A.values[i]); } for(uword i=0; i < B.n_nonzero; ++i) { access::rw(BB.values[i]) = out_eT(B.values[i]); } out = AA % BB; } } template inline void spglue_schur_mixed::dense_schur_sparse(SpMat< typename promote_type::result>& out, const T1& X, const T2& Y) { arma_debug_sigprint(); typedef typename T1::elem_type eT1; typedef typename T2::elem_type eT2; typedef typename promote_type::result out_eT; promote_type::check(); const Proxy pa(X); const SpProxy pb(Y); arma_conform_assert_same_size(pa.get_n_rows(), pa.get_n_cols(), pb.get_n_rows(), pb.get_n_cols(), "element-wise multiplication"); // count new size uword new_n_nonzero = 0; typename SpProxy::const_iterator_type it = pb.begin(); typename SpProxy::const_iterator_type it_end = pb.end(); while(it != it_end) { if( (out_eT(*it) * out_eT(pa.at(it.row(), it.col()))) != out_eT(0) ) { ++new_n_nonzero; } ++it; } // Resize memory accordingly. out.reserve(pa.get_n_rows(), pa.get_n_cols(), new_n_nonzero); uword count = 0; typename SpProxy::const_iterator_type it2 = pb.begin(); while(it2 != it_end) { const uword it2_row = it2.row(); const uword it2_col = it2.col(); const out_eT val = out_eT(*it2) * out_eT(pa.at(it2_row, it2_col)); if(val != out_eT(0)) { access::rw( out.values[count]) = val; access::rw( out.row_indices[count]) = it2_row; access::rw(out.col_ptrs[it2_col + 1])++; ++count; } ++it2; } // Fix column pointers. for(uword c = 1; c <= out.n_cols; ++c) { access::rw(out.col_ptrs[c]) += out.col_ptrs[c - 1]; } } //! @} RcppArmadillo/inst/include/armadillo_bits/glue_times_misc_bones.hpp0000644000176200001440000000536614460111315025445 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup glue_times_misc //! @{ class dense_sparse_helper { public: template arma_inline static typename arma_not_cx::result dot(const eT* A_mem, const SpMat& B, const uword col); template arma_inline static typename arma_cx_only::result dot(const eT* A_mem, const SpMat& B, const uword col); }; class glue_times_dense_sparse { public: template struct traits { static constexpr bool is_row = T1::is_row; static constexpr bool is_col = T2::is_col; static constexpr bool is_xvec = false; }; template inline static void apply(Mat& out, const SpToDGlue& expr); template inline static void apply_noalias(Mat& out, const T1& x, const T2& y); template inline static void apply_mixed(Mat< typename promote_type::result >& out, const T1& X, const T2& Y); }; class glue_times_sparse_dense { public: template struct traits { static constexpr bool is_row = T1::is_row; static constexpr bool is_col = T2::is_col; static constexpr bool is_xvec = false; }; template inline static void apply(Mat& out, const SpToDGlue& expr); template inline static void apply_noalias(Mat& out, const T1& x, const T2& y); template inline static void apply_noalias_trans(Mat& out, const T1& x, const T2& y); template inline static void apply_mixed(Mat< typename promote_type::result >& out, const T1& X, const T2& Y); }; //! @} RcppArmadillo/inst/include/armadillo_bits/newarp_DenseGenMatProd_bones.hpp0000644000176200001440000000234614301267043026627 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ namespace newarp { //! Define matrix operations on existing matrix objects template class DenseGenMatProd { private: const Mat& op_mat; public: const uword n_rows; // number of rows of the underlying matrix const uword n_cols; // number of columns of the underlying matrix inline DenseGenMatProd(const Mat& mat_obj); inline void perform_op(eT* x_in, eT* y_out) const; }; } // namespace newarp RcppArmadillo/inst/include/armadillo_bits/op_cov_meat.hpp0000644000176200001440000000515414631567470023416 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_cov //! @{ template inline void op_cov::apply(Mat& out, const Op& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword norm_type = in.aux_uword_a; const unwrap U(in.m); const Mat& A = U.M; if(A.n_elem == 0) { out.reset(); return; } const Mat& AA = (A.n_rows == 1) ? Mat(const_cast(A.memptr()), A.n_cols, A.n_rows, false, false) : Mat(const_cast(A.memptr()), A.n_rows, A.n_cols, false, false); const uword N = AA.n_rows; const eT norm_val = (norm_type == 0) ? ( (N > 1) ? eT(N-1) : eT(1) ) : eT(N); const Mat tmp = AA.each_row() - mean(AA,0); out = tmp.t() * tmp; out /= norm_val; } template inline void op_cov::apply(Mat& out, const Op< Op, op_cov>& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword norm_type = in.aux_uword_a; if(is_cx::yes) { const Mat tmp = in.m; // force the evaluation of Op out = cov(tmp, norm_type); } else { const unwrap U(in.m.m); const Mat& A = U.M; if(A.n_elem == 0) { out.reset(); return; } const Mat& AA = (A.n_cols == 1) ? Mat(const_cast(A.memptr()), A.n_cols, A.n_rows, false, false) : Mat(const_cast(A.memptr()), A.n_rows, A.n_cols, false, false); const uword N = AA.n_cols; const eT norm_val = (norm_type == 0) ? ( (N > 1) ? eT(N-1) : eT(1) ) : eT(N); const Mat tmp = AA.each_col() - mean(AA,1); out = tmp * tmp.t(); out /= norm_val; } } //! @} RcppArmadillo/inst/include/armadillo_bits/op_diagvec_meat.hpp0000644000176200001440000003200014631567470024217 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_diagvec //! @{ template inline void op_diagvec::apply(Mat& out, const Op& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const Proxy P(X.m); if(P.is_alias(out) == false) { op_diagvec::apply_proxy(out, P); } else { Mat tmp; op_diagvec::apply_proxy(tmp, P); out.steal_mem(tmp); } } template inline void op_diagvec::apply_proxy(Mat& out, const Proxy& P) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword n_rows = P.get_n_rows(); const uword n_cols = P.get_n_cols(); const uword len = (std::min)(n_rows, n_cols); out.set_size(len, 1); eT* out_mem = out.memptr(); uword i,j; for(i=0, j=1; j < len; i+=2, j+=2) { const eT tmp_i = P.at(i, i); const eT tmp_j = P.at(j, j); out_mem[i] = tmp_i; out_mem[j] = tmp_j; } if(i < len) { out_mem[i] = P.at(i, i); } } template inline void op_diagvec::apply(Mat& actual_out, const Op< Glue, op_diagvec>& X, const typename arma_not_cx::result* junk) { arma_debug_sigprint(); arma_ignore(junk); typedef typename T1::elem_type eT; const partial_unwrap UA(X.m.A); const partial_unwrap UB(X.m.B); const typename partial_unwrap::stored_type& A = UA.M; const typename partial_unwrap::stored_type& B = UB.M; arma_conform_assert_trans_mul_size< partial_unwrap::do_trans, partial_unwrap::do_trans >(A.n_rows, A.n_cols, B.n_rows, B.n_cols, "matrix multiplication"); if( (A.n_elem == 0) || (B.n_elem == 0) ) { actual_out.reset(); return; } constexpr bool use_alpha = partial_unwrap::do_times || partial_unwrap::do_times; const eT alpha = use_alpha ? (UA.get_val() * UB.get_val()) : eT(0); const bool is_alias = (UA.is_alias(actual_out) || UB.is_alias(actual_out)); Mat tmp; Mat& out = (is_alias) ? tmp : actual_out; const uword A_n_rows = A.n_rows; const uword A_n_cols = A.n_cols; const uword B_n_rows = B.n_rows; const uword B_n_cols = B.n_cols; if( (partial_unwrap::do_trans == false) && (partial_unwrap::do_trans == false) ) { arma_debug_print("trans_A = false; trans_B = false;"); const uword N = (std::min)(A_n_rows, B_n_cols); out.set_size(N,1); eT* out_mem = out.memptr(); for(uword k=0; k < N; ++k) { eT acc1 = eT(0); eT acc2 = eT(0); const eT* B_colptr = B.colptr(k); // condition: A_n_cols = B_n_rows uword j; for(j=1; j < A_n_cols; j+=2) { const uword i = (j-1); const eT tmp_i = B_colptr[i]; const eT tmp_j = B_colptr[j]; acc1 += A.at(k, i) * tmp_i; acc2 += A.at(k, j) * tmp_j; } const uword i = (j-1); if(i < A_n_cols) { acc1 += A.at(k, i) * B_colptr[i]; } const eT acc = acc1 + acc2; out_mem[k] = (use_alpha) ? eT(alpha * acc) : eT(acc); } } else if( (partial_unwrap::do_trans == true ) && (partial_unwrap::do_trans == false) ) { arma_debug_print("trans_A = true; trans_B = false;"); const uword N = (std::min)(A_n_cols, B_n_cols); out.set_size(N,1); eT* out_mem = out.memptr(); for(uword k=0; k < N; ++k) { const eT* A_colptr = A.colptr(k); const eT* B_colptr = B.colptr(k); // condition: A_n_rows = B_n_rows const eT acc = op_dot::direct_dot(A_n_rows, A_colptr, B_colptr); out_mem[k] = (use_alpha) ? eT(alpha * acc) : eT(acc); } } else if( (partial_unwrap::do_trans == false) && (partial_unwrap::do_trans == true ) ) { arma_debug_print("trans_A = false; trans_B = true;"); const uword N = (std::min)(A_n_rows, B_n_rows); out.set_size(N,1); eT* out_mem = out.memptr(); for(uword k=0; k < N; ++k) { eT acc = eT(0); // condition: A_n_cols = B_n_cols for(uword i=0; i < A_n_cols; ++i) { acc += A.at(k,i) * B.at(k,i); } out_mem[k] = (use_alpha) ? eT(alpha * acc) : eT(acc); } } else if( (partial_unwrap::do_trans == true ) && (partial_unwrap::do_trans == true ) ) { arma_debug_print("trans_A = true; trans_B = true;"); const uword N = (std::min)(A_n_cols, B_n_rows); out.set_size(N,1); eT* out_mem = out.memptr(); for(uword k=0; k < N; ++k) { eT acc = eT(0); const eT* A_colptr = A.colptr(k); // condition: A_n_rows = B_n_cols for(uword i=0; i < A_n_rows; ++i) { acc += A_colptr[i] * B.at(k,i); } out_mem[k] = (use_alpha) ? eT(alpha * acc) : eT(acc); } } if(is_alias) { actual_out.steal_mem(tmp); } } template inline void op_diagvec::apply(Mat& actual_out, const Op< Glue, op_diagvec>& X, const typename arma_cx_only::result* junk) { arma_debug_sigprint(); arma_ignore(junk); typedef typename T1::pod_type T; typedef typename T1::elem_type eT; const partial_unwrap UA(X.m.A); const partial_unwrap UB(X.m.B); const typename partial_unwrap::stored_type& A = UA.M; const typename partial_unwrap::stored_type& B = UB.M; arma_conform_assert_trans_mul_size< partial_unwrap::do_trans, partial_unwrap::do_trans >(A.n_rows, A.n_cols, B.n_rows, B.n_cols, "matrix multiplication"); if( (A.n_elem == 0) || (B.n_elem == 0) ) { actual_out.reset(); return; } constexpr bool use_alpha = partial_unwrap::do_times || partial_unwrap::do_times; const eT alpha = use_alpha ? (UA.get_val() * UB.get_val()) : eT(0); const bool is_alias = (UA.is_alias(actual_out) || UB.is_alias(actual_out)); Mat tmp; Mat& out = (is_alias) ? tmp : actual_out; const uword A_n_rows = A.n_rows; const uword A_n_cols = A.n_cols; const uword B_n_rows = B.n_rows; const uword B_n_cols = B.n_cols; if( (partial_unwrap::do_trans == false) && (partial_unwrap::do_trans == false) ) { arma_debug_print("trans_A = false; trans_B = false;"); const uword N = (std::min)(A_n_rows, B_n_cols); out.set_size(N,1); eT* out_mem = out.memptr(); for(uword k=0; k < N; ++k) { T acc_real = T(0); T acc_imag = T(0); const eT* B_colptr = B.colptr(k); // condition: A_n_cols = B_n_rows for(uword i=0; i < A_n_cols; ++i) { // acc += A.at(k, i) * B_colptr[i]; const std::complex& xx = A.at(k, i); const std::complex& yy = B_colptr[i]; const T a = xx.real(); const T b = xx.imag(); const T c = yy.real(); const T d = yy.imag(); acc_real += (a*c) - (b*d); acc_imag += (a*d) + (b*c); } const eT acc = std::complex(acc_real, acc_imag); out_mem[k] = (use_alpha) ? eT(alpha * acc) : eT(acc); } } else if( (partial_unwrap::do_trans == true) && (partial_unwrap::do_trans == false) ) { arma_debug_print("trans_A = true; trans_B = false;"); const uword N = (std::min)(A_n_cols, B_n_cols); out.set_size(N,1); eT* out_mem = out.memptr(); for(uword k=0; k < N; ++k) { T acc_real = T(0); T acc_imag = T(0); const eT* A_colptr = A.colptr(k); const eT* B_colptr = B.colptr(k); // condition: A_n_rows = B_n_rows for(uword i=0; i < A_n_rows; ++i) { // acc += std::conj(A_colptr[i]) * B_colptr[i]; const std::complex& xx = A_colptr[i]; const std::complex& yy = B_colptr[i]; const T a = xx.real(); const T b = xx.imag(); const T c = yy.real(); const T d = yy.imag(); // take into account the complex conjugate of xx acc_real += (a*c) + (b*d); acc_imag += (a*d) - (b*c); } const eT acc = std::complex(acc_real, acc_imag); out_mem[k] = (use_alpha) ? eT(alpha * acc) : eT(acc); } } else if( (partial_unwrap::do_trans == false) && (partial_unwrap::do_trans == true) ) { arma_debug_print("trans_A = false; trans_B = true;"); const uword N = (std::min)(A_n_rows, B_n_rows); out.set_size(N,1); eT* out_mem = out.memptr(); for(uword k=0; k < N; ++k) { T acc_real = T(0); T acc_imag = T(0); // condition: A_n_cols = B_n_cols for(uword i=0; i < A_n_cols; ++i) { // acc += A.at(k,i) * std::conj(B.at(k,i)); const std::complex& xx = A.at(k, i); const std::complex& yy = B.at(k, i); const T a = xx.real(); const T b = xx.imag(); const T c = yy.real(); const T d = -yy.imag(); // take the conjugate acc_real += (a*c) - (b*d); acc_imag += (a*d) + (b*c); } const eT acc = std::complex(acc_real, acc_imag); out_mem[k] = (use_alpha) ? eT(alpha * acc) : eT(acc); } } else if( (partial_unwrap::do_trans == true) && (partial_unwrap::do_trans == true) ) { arma_debug_print("trans_A = true; trans_B = true;"); const uword N = (std::min)(A_n_cols, B_n_rows); out.set_size(N,1); eT* out_mem = out.memptr(); for(uword k=0; k < N; ++k) { T acc_real = T(0); T acc_imag = T(0); const eT* A_colptr = A.colptr(k); // condition: A_n_rows = B_n_cols for(uword i=0; i < A_n_rows; ++i) { // acc += std::conj(A_colptr[i]) * std::conj(B.at(k,i)); const std::complex& xx = A_colptr[i]; const std::complex& yy = B.at(k, i); const T a = xx.real(); const T b = -xx.imag(); // take the conjugate const T c = yy.real(); const T d = -yy.imag(); // take the conjugate acc_real += (a*c) - (b*d); acc_imag += (a*d) + (b*c); } const eT acc = std::complex(acc_real, acc_imag); out_mem[k] = (use_alpha) ? eT(alpha * acc) : eT(acc); } } if(is_alias) { actual_out.steal_mem(tmp); } } // // // template inline void op_diagvec2::apply(Mat& out, const Op& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword a = X.aux_uword_a; const uword b = X.aux_uword_b; const uword row_offset = (b > 0) ? a : 0; const uword col_offset = (b == 0) ? a : 0; const Proxy P(X.m); if(P.is_alias(out) == false) { op_diagvec2::apply_proxy(out, P, row_offset, col_offset); } else { Mat tmp; op_diagvec2::apply_proxy(tmp, P, row_offset, col_offset); out.steal_mem(tmp); } } template inline void op_diagvec2::apply_proxy(Mat& out, const Proxy& P, const uword row_offset, const uword col_offset) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword n_rows = P.get_n_rows(); const uword n_cols = P.get_n_cols(); arma_conform_check_bounds ( ((row_offset > 0) && (row_offset >= n_rows)) || ((col_offset > 0) && (col_offset >= n_cols)), "diagvec(): requested diagonal is out of bounds" ); const uword len = (std::min)(n_rows - row_offset, n_cols - col_offset); out.set_size(len, 1); eT* out_mem = out.memptr(); uword i,j; for(i=0, j=1; j < len; i+=2, j+=2) { const eT tmp_i = P.at( i + row_offset, i + col_offset ); const eT tmp_j = P.at( j + row_offset, j + col_offset ); out_mem[i] = tmp_i; out_mem[j] = tmp_j; } if(i < len) { out_mem[i] = P.at( i + row_offset, i + col_offset ); } } //! @} RcppArmadillo/inst/include/armadillo_bits/op_relational_meat.hpp0000644000176200001440000002365514631567470024767 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_relational //! @{ #undef operator_rel #undef arma_applier_mat_pre #undef arma_applier_mat_post #undef arma_applier_cube_pre #undef arma_applier_cube_post #define arma_applier_mat_pre(operator_rel) \ {\ typedef typename T1::elem_type eT;\ typedef typename Proxy::ea_type ea_type;\ \ const eT val = X.aux;\ \ const Proxy P(X.m);\ \ const uword n_rows = P.get_n_rows();\ const uword n_cols = P.get_n_cols();\ \ const bool bad_alias = ( Proxy::has_subview && P.is_alias(out) );\ \ if(bad_alias == false)\ {\ out.set_size(n_rows, n_cols);\ \ uword* out_mem = out.memptr();\ \ if(Proxy::use_at == false)\ {\ ea_type PA = P.get_ea();\ const uword n_elem = out.n_elem;\ \ for(uword i=0; i tmp(P.Q);\ \ out = (val) operator_rel (tmp);\ }\ } #define arma_applier_mat_post(operator_rel) \ {\ typedef typename T1::elem_type eT;\ typedef typename Proxy::ea_type ea_type;\ \ const eT val = X.aux;\ \ const Proxy P(X.m);\ \ const uword n_rows = P.get_n_rows();\ const uword n_cols = P.get_n_cols();\ \ const bool bad_alias = ( Proxy::has_subview && P.is_alias(out) );\ \ if(bad_alias == false)\ {\ out.set_size(n_rows, n_cols);\ \ uword* out_mem = out.memptr();\ \ if(Proxy::use_at == false)\ {\ ea_type PA = P.get_ea();\ const uword n_elem = out.n_elem;\ \ for(uword i=0; i tmp(P.Q);\ \ out = (tmp) operator_rel (val);\ }\ } #define arma_applier_cube_pre(operator_rel) \ {\ typedef typename T1::elem_type eT;\ typedef typename ProxyCube::ea_type ea_type;\ \ const eT val = X.aux;\ \ const ProxyCube P(X.m);\ \ const uword n_rows = P.get_n_rows();\ const uword n_cols = P.get_n_cols();\ const uword n_slices = P.get_n_slices();\ \ const bool bad_alias = ( ProxyCube::has_subview && P.is_alias(out) );\ \ if(bad_alias == false)\ {\ out.set_size(n_rows, n_cols, n_slices);\ \ uword* out_mem = out.memptr();\ \ if(ProxyCube::use_at == false)\ {\ ea_type PA = P.get_ea();\ const uword n_elem = out.n_elem;\ \ for(uword i=0; i::stored_type> tmp(P.Q);\ \ out = (val) operator_rel (tmp.M);\ }\ } #define arma_applier_cube_post(operator_rel) \ {\ typedef typename T1::elem_type eT;\ typedef typename ProxyCube::ea_type ea_type;\ \ const eT val = X.aux;\ \ const ProxyCube P(X.m);\ \ const uword n_rows = P.get_n_rows();\ const uword n_cols = P.get_n_cols();\ const uword n_slices = P.get_n_slices();\ \ const bool bad_alias = ( ProxyCube::has_subview && P.is_alias(out) );\ \ if(bad_alias == false)\ {\ out.set_size(n_rows, n_cols, n_slices);\ \ uword* out_mem = out.memptr();\ \ if(ProxyCube::use_at == false)\ {\ ea_type PA = P.get_ea();\ const uword n_elem = out.n_elem;\ \ for(uword i=0; i::stored_type> tmp(P.Q);\ \ out = (tmp.M) operator_rel (val);\ }\ } template inline void op_rel_lt_pre::apply(Mat& out, const mtOp& X) { arma_debug_sigprint(); arma_applier_mat_pre( < ); } template inline void op_rel_gt_pre::apply(Mat& out, const mtOp& X) { arma_debug_sigprint(); arma_applier_mat_pre( > ); } template inline void op_rel_lteq_pre::apply(Mat& out, const mtOp& X) { arma_debug_sigprint(); arma_applier_mat_pre( <= ); } template inline void op_rel_gteq_pre::apply(Mat& out, const mtOp& X) { arma_debug_sigprint(); arma_applier_mat_pre( >= ); } template inline void op_rel_lt_post::apply(Mat& out, const mtOp& X) { arma_debug_sigprint(); arma_applier_mat_post( < ); } template inline void op_rel_gt_post::apply(Mat& out, const mtOp& X) { arma_debug_sigprint(); arma_applier_mat_post( > ); } template inline void op_rel_lteq_post::apply(Mat& out, const mtOp& X) { arma_debug_sigprint(); arma_applier_mat_post( <= ); } template inline void op_rel_gteq_post::apply(Mat& out, const mtOp& X) { arma_debug_sigprint(); arma_applier_mat_post( >= ); } template inline void op_rel_eq::apply(Mat& out, const mtOp& X) { arma_debug_sigprint(); arma_applier_mat_post( == ); } template inline void op_rel_noteq::apply(Mat& out, const mtOp& X) { arma_debug_sigprint(); arma_applier_mat_post( != ); } // // // template inline void op_rel_lt_pre::apply(Cube& out, const mtOpCube& X) { arma_debug_sigprint(); arma_applier_cube_pre( < ); } template inline void op_rel_gt_pre::apply(Cube& out, const mtOpCube& X) { arma_debug_sigprint(); arma_applier_cube_pre( > ); } template inline void op_rel_lteq_pre::apply(Cube& out, const mtOpCube& X) { arma_debug_sigprint(); arma_applier_cube_pre( <= ); } template inline void op_rel_gteq_pre::apply(Cube& out, const mtOpCube& X) { arma_debug_sigprint(); arma_applier_cube_pre( >= ); } template inline void op_rel_lt_post::apply(Cube& out, const mtOpCube& X) { arma_debug_sigprint(); arma_applier_cube_post( < ); } template inline void op_rel_gt_post::apply(Cube& out, const mtOpCube& X) { arma_debug_sigprint(); arma_applier_cube_post( > ); } template inline void op_rel_lteq_post::apply(Cube& out, const mtOpCube& X) { arma_debug_sigprint(); arma_applier_cube_post( <= ); } template inline void op_rel_gteq_post::apply(Cube& out, const mtOpCube& X) { arma_debug_sigprint(); arma_applier_cube_post( >= ); } template inline void op_rel_eq::apply(Cube& out, const mtOpCube& X) { arma_debug_sigprint(); arma_applier_cube_post( == ); } template inline void op_rel_noteq::apply(Cube& out, const mtOpCube& X) { arma_debug_sigprint(); arma_applier_cube_post( != ); } #undef arma_applier_mat_pre #undef arma_applier_mat_post #undef arma_applier_cube_pre #undef arma_applier_cube_post //! @} RcppArmadillo/inst/include/armadillo_bits/op_dot_meat.hpp0000644000176200001440000003365014770765377023431 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_dot //! @{ //! for two arrays, generic version for non-complex values template arma_inline typename arma_not_cx::result op_dot::direct_dot_arma(const uword n_elem, const eT* const A, const eT* const B) { arma_debug_sigprint(); #if defined(__FAST_MATH__) { eT val = eT(0); for(uword i=0; i inline typename arma_cx_only::result op_dot::direct_dot_arma(const uword n_elem, const eT* const A, const eT* const B) { arma_debug_sigprint(); typedef typename get_pod_type::result T; T val_real = T(0); T val_imag = T(0); for(uword i=0; i& X = A[i]; const std::complex& Y = B[i]; const T a = X.real(); const T b = X.imag(); const T c = Y.real(); const T d = Y.imag(); val_real += (a*c) - (b*d); val_imag += (a*d) + (b*c); } return std::complex(val_real, val_imag); } //! for two arrays, float and double version template inline typename arma_real_only::result op_dot::direct_dot(const uword n_elem, const eT* const A, const eT* const B) { arma_debug_sigprint(); if(n_elem <= 32u) { return op_dot::direct_dot_arma(n_elem, A, B); } #if defined(ARMA_USE_ATLAS) { arma_debug_print("atlas::cblas_dot()"); return atlas::cblas_dot(n_elem, A, B); } #elif defined(ARMA_USE_BLAS) { arma_debug_print("blas::dot()"); return blas::dot(n_elem, A, B); } #else { return op_dot::direct_dot_arma(n_elem, A, B); } #endif } //! for two arrays, complex version template inline typename arma_cx_only::result op_dot::direct_dot(const uword n_elem, const eT* const A, const eT* const B) { if(n_elem <= 16u) { return op_dot::direct_dot_arma(n_elem, A, B); } #if defined(ARMA_USE_ATLAS) { arma_debug_print("atlas::cblas_cx_dot()"); return atlas::cblas_cx_dot(n_elem, A, B); } #elif defined(ARMA_USE_BLAS) { arma_debug_print("blas::dot()"); return blas::dot(n_elem, A, B); } #else { return op_dot::direct_dot_arma(n_elem, A, B); } #endif } //! for two arrays, integral version template inline typename arma_integral_only::result op_dot::direct_dot(const uword n_elem, const eT* const A, const eT* const B) { return op_dot::direct_dot_arma(n_elem, A, B); } //! for three arrays template inline eT op_dot::direct_dot(const uword n_elem, const eT* const A, const eT* const B, const eT* C) { arma_debug_sigprint(); eT val = eT(0); for(uword i=0; i inline typename T1::elem_type op_dot::apply(const T1& X, const T2& Y) { arma_debug_sigprint(); typedef typename T1::elem_type eT; if(is_subview_row::value && is_subview_row::value) { const subview_row& A = reinterpret_cast< const subview_row& >(X); const subview_row& B = reinterpret_cast< const subview_row& >(Y); if( (A.m.n_rows == 1) && (B.m.n_rows == 1) ) { arma_debug_print("op_dot::apply(): subview_row optimisation"); arma_conform_check( (A.n_elem != B.n_elem), "dot(): objects must have the same number of elements" ); const eT* A_mem = A.m.memptr(); const eT* B_mem = B.m.memptr(); return op_dot::direct_dot(A.n_elem, &A_mem[A.aux_col1], &B_mem[B.aux_col1]); } } if(is_subview::value || is_subview::value) { arma_debug_print("op_dot::apply(): subview optimisation"); const sv_keep_unwrap& UA(X); const sv_keep_unwrap& UB(Y); typedef typename sv_keep_unwrap::stored_type UA_M_type; typedef typename sv_keep_unwrap::stored_type UB_M_type; const UA_M_type& A = UA.M; const UB_M_type& B = UB.M; const uword A_n_rows = A.n_rows; const uword A_n_cols = A.n_cols; if( (A_n_rows == B.n_rows) && (A_n_cols == B.n_cols) ) { eT acc = eT(0); for(uword c=0; c < A_n_cols; ++c) { acc += op_dot::direct_dot(A_n_rows, A.colptr(c), B.colptr(c)); } return acc; } else { const quasi_unwrap UUA(A); const quasi_unwrap UUB(B); arma_conform_check( (UUA.M.n_elem != UUB.M.n_elem), "dot(): objects must have the same number of elements" ); return op_dot::direct_dot(UUA.M.n_elem, UUA.M.memptr(), UUB.M.memptr()); } } // if possible, bypass transposes of non-complex vectors if( (is_cx::no) && (resolves_to_vector::value) && (resolves_to_vector::value) && (partial_unwrap::is_fast) && (partial_unwrap::is_fast) ) { arma_debug_print("op_dot::apply(): vector optimisation"); const partial_unwrap UA(X); const partial_unwrap UB(Y); const typename partial_unwrap::stored_type& A = UA.M; const typename partial_unwrap::stored_type& B = UB.M; arma_conform_check( (A.n_elem != B.n_elem), "dot(): objects must have the same number of elements" ); const eT val = op_dot::direct_dot(A.n_elem, A.memptr(), B.memptr()); return (UA.do_times || UB.do_times) ? (val * UA.get_val() * UB.get_val()) : val; } constexpr bool proxy_is_mat = (is_Mat::stored_type>::value && is_Mat::stored_type>::value); constexpr bool use_at = (Proxy::use_at) || (Proxy::use_at); constexpr bool have_direct_mem = (quasi_unwrap::has_orig_mem) && (quasi_unwrap::has_orig_mem); if(proxy_is_mat || use_at || have_direct_mem) { arma_debug_print("op_dot::apply(): direct_mem optimisation"); const quasi_unwrap A(X); const quasi_unwrap B(Y); arma_conform_check( (A.M.n_elem != B.M.n_elem), "dot(): objects must have the same number of elements" ); return op_dot::direct_dot(A.M.n_elem, A.M.memptr(), B.M.memptr()); } const Proxy PA(X); const Proxy PB(Y); arma_conform_check( (PA.get_n_elem() != PB.get_n_elem()), "dot(): objects must have the same number of elements" ); return op_dot::apply_proxy_linear(PA,PB); } template inline typename arma_not_cx::result op_dot::apply_proxy_linear(const Proxy& PA, const Proxy& PB) { arma_debug_sigprint(); typedef typename T1::elem_type eT; typedef typename Proxy::ea_type ea_type1; typedef typename Proxy::ea_type ea_type2; const uword N = PA.get_n_elem(); ea_type1 A = PA.get_ea(); ea_type2 B = PB.get_ea(); eT val1 = eT(0); eT val2 = eT(0); uword i,j; for(i=0, j=1; j inline typename arma_cx_only::result op_dot::apply_proxy_linear(const Proxy& PA, const Proxy& PB) { arma_debug_sigprint(); typedef typename T1::elem_type eT; typedef typename get_pod_type::result T; typedef typename Proxy::ea_type ea_type1; typedef typename Proxy::ea_type ea_type2; const uword N = PA.get_n_elem(); ea_type1 A = PA.get_ea(); ea_type2 B = PB.get_ea(); T val_real = T(0); T val_imag = T(0); for(uword i=0; i xx = A[i]; const std::complex yy = B[i]; const T a = xx.real(); const T b = xx.imag(); const T c = yy.real(); const T d = yy.imag(); val_real += (a*c) - (b*d); val_imag += (a*d) + (b*c); } return std::complex(val_real, val_imag); } // // op_norm_dot template inline typename T1::elem_type op_norm_dot::apply(const T1& X, const T2& Y) { arma_debug_sigprint(); typedef typename T1::elem_type eT; typedef typename T1::pod_type T; const quasi_unwrap tmp1(X); const quasi_unwrap tmp2(Y); const Col A( const_cast(tmp1.M.memptr()), tmp1.M.n_elem, false ); const Col B( const_cast(tmp2.M.memptr()), tmp2.M.n_elem, false ); arma_conform_check( (A.n_elem != B.n_elem), "norm_dot(): objects must have the same number of elements" ); const T denom = norm(A,2) * norm(B,2); return (denom != T(0)) ? ( op_dot::apply(A,B) / denom ) : eT(0); } // // op_cdot template inline eT op_cdot::direct_cdot_arma(const uword n_elem, const eT* const A, const eT* const B) { arma_debug_sigprint(); typedef typename get_pod_type::result T; T val_real = T(0); T val_imag = T(0); for(uword i=0; i& X = A[i]; const std::complex& Y = B[i]; const T a = X.real(); const T b = X.imag(); const T c = Y.real(); const T d = Y.imag(); val_real += (a*c) + (b*d); val_imag += (a*d) - (b*c); } return std::complex(val_real, val_imag); } template inline eT op_cdot::direct_cdot(const uword n_elem, const eT* const A, const eT* const B) { arma_debug_sigprint(); if(n_elem <= 32u) { return op_cdot::direct_cdot_arma(n_elem, A, B); } #if defined(ARMA_USE_BLAS) { arma_debug_print("blas::gemv()"); // using gemv() workaround due to compatibility issues with cdotc() and zdotc() const char trans = 'C'; const blas_int m = blas_int(n_elem); const blas_int n = 1; //const blas_int lda = (n_elem > 0) ? blas_int(n_elem) : blas_int(1); const blas_int inc = 1; const eT alpha = eT(1); const eT beta = eT(0); eT result[2]; // paranoia: using two elements instead of one //blas::gemv(&trans, &m, &n, &alpha, A, &lda, B, &inc, &beta, &result[0], &inc); blas::gemv(&trans, &m, &n, &alpha, A, &m, B, &inc, &beta, &result[0], &inc); return result[0]; } #else { return op_cdot::direct_cdot_arma(n_elem, A, B); } #endif } template inline typename T1::elem_type op_cdot::apply(const T1& X, const T2& Y) { arma_debug_sigprint(); if(is_Mat::value && is_Mat::value) { return op_cdot::apply_unwrap(X,Y); } else { return op_cdot::apply_proxy(X,Y); } } template inline typename T1::elem_type op_cdot::apply_unwrap(const T1& X, const T2& Y) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const unwrap tmp1(X); const unwrap tmp2(Y); const Mat& A = tmp1.M; const Mat& B = tmp2.M; arma_conform_check( (A.n_elem != B.n_elem), "cdot(): objects must have the same number of elements" ); return op_cdot::direct_cdot( A.n_elem, A.mem, B.mem ); } template inline typename T1::elem_type op_cdot::apply_proxy(const T1& X, const T2& Y) { arma_debug_sigprint(); typedef typename T1::elem_type eT; typedef typename get_pod_type::result T; typedef typename Proxy::ea_type ea_type1; typedef typename Proxy::ea_type ea_type2; constexpr bool use_at = (Proxy::use_at) || (Proxy::use_at); if(use_at == false) { const Proxy PA(X); const Proxy PB(Y); const uword N = PA.get_n_elem(); arma_conform_check( (N != PB.get_n_elem()), "cdot(): objects must have the same number of elements" ); ea_type1 A = PA.get_ea(); ea_type2 B = PB.get_ea(); T val_real = T(0); T val_imag = T(0); for(uword i=0; i AA = A[i]; const std::complex BB = B[i]; const T a = AA.real(); const T b = AA.imag(); const T c = BB.real(); const T d = BB.imag(); val_real += (a*c) + (b*d); val_imag += (a*d) - (b*c); } return std::complex(val_real, val_imag); } else { return op_cdot::apply_unwrap( X, Y ); } } template inline typename promote_type::result op_dot_mixed::apply(const T1& A, const T2& B) { arma_debug_sigprint(); typedef typename T1::elem_type in_eT1; typedef typename T2::elem_type in_eT2; typedef typename promote_type::result out_eT; const Proxy PA(A); const Proxy PB(B); const uword N = PA.get_n_elem(); arma_conform_check( (N != PB.get_n_elem()), "dot(): objects must have the same number of elements" ); out_eT acc = out_eT(0); for(uword i=0; i < N; ++i) { acc += upgrade_val::apply(PA[i]) * upgrade_val::apply(PB[i]); } return acc; } //! @} RcppArmadillo/inst/include/armadillo_bits/SpSubview_bones.hpp0000644000176200001440000004054415013306507024225 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup SpSubview //! @{ template class SpSubview : public SpBase< eT, SpSubview > { public: const SpMat& m; typedef eT elem_type; typedef typename get_pod_type::result pod_type; static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = false; const uword aux_row1; const uword aux_col1; const uword n_rows; const uword n_cols; const uword n_elem; const uword n_nonzero; protected: inline SpSubview(const SpMat& in_m, const uword in_row1, const uword in_col1, const uword in_n_rows, const uword in_n_cols); public: inline ~SpSubview(); inline SpSubview() = delete; inline SpSubview(const SpSubview& in); inline SpSubview( SpSubview&& in); inline const SpSubview& operator+= (const eT val); inline const SpSubview& operator-= (const eT val); inline const SpSubview& operator*= (const eT val); inline const SpSubview& operator/= (const eT val); inline const SpSubview& operator=(const SpSubview& x); template inline const SpSubview& operator= (const Base& x); template inline const SpSubview& operator+=(const Base& x); template inline const SpSubview& operator-=(const Base& x); template inline const SpSubview& operator*=(const Base& x); template inline const SpSubview& operator%=(const Base& x); template inline const SpSubview& operator/=(const Base& x); template inline const SpSubview& operator_equ_common(const SpBase& x); template inline const SpSubview& operator= (const SpBase& x); template inline const SpSubview& operator+=(const SpBase& x); template inline const SpSubview& operator-=(const SpBase& x); template inline const SpSubview& operator*=(const SpBase& x); template inline const SpSubview& operator%=(const SpBase& x); template inline const SpSubview& operator/=(const SpBase& x); /* inline static void extract(SpMat& out, const SpSubview& in); inline static void plus_inplace(Mat& out, const subview& in); inline static void minus_inplace(Mat& out, const subview& in); inline static void schur_inplace(Mat& out, const subview& in); inline static void div_inplace(Mat& out, const subview& in); */ template inline void for_each(functor F); template inline void for_each(functor F) const; template inline void transform(functor F); inline void replace(const eT old_val, const eT new_val); inline void clean(const pod_type threshold); inline void clamp(const eT min_val, const eT max_val); inline void fill(const eT val); inline void zeros(); inline void ones(); inline void eye(); inline void randu(); inline void randn(); arma_warn_unused inline SpSubview_MapMat_val operator[](const uword i); arma_warn_unused inline eT operator[](const uword i) const; arma_warn_unused inline SpSubview_MapMat_val operator()(const uword i); arma_warn_unused inline eT operator()(const uword i) const; arma_warn_unused inline SpSubview_MapMat_val operator()(const uword in_row, const uword in_col); arma_warn_unused inline eT operator()(const uword in_row, const uword in_col) const; arma_warn_unused inline SpSubview_MapMat_val at(const uword i); arma_warn_unused inline eT at(const uword i) const; arma_warn_unused inline SpSubview_MapMat_val at(const uword in_row, const uword in_col); arma_warn_unused inline eT at(const uword in_row, const uword in_col) const; inline bool check_overlap(const SpSubview& x) const; arma_warn_unused inline bool is_vec() const; inline SpSubview_row row(const uword row_num); inline const SpSubview_row row(const uword row_num) const; inline SpSubview_col col(const uword col_num); inline const SpSubview_col col(const uword col_num) const; inline SpSubview rows(const uword in_row1, const uword in_row2); inline const SpSubview rows(const uword in_row1, const uword in_row2) const; inline SpSubview cols(const uword in_col1, const uword in_col2); inline const SpSubview cols(const uword in_col1, const uword in_col2) const; inline SpSubview submat(const uword in_row1, const uword in_col1, const uword in_row2, const uword in_col2); inline const SpSubview submat(const uword in_row1, const uword in_col1, const uword in_row2, const uword in_col2) const; inline SpSubview submat(const span& row_span, const span& col_span); inline const SpSubview submat(const span& row_span, const span& col_span) const; inline SpSubview operator()(const uword row_num, const span& col_span); inline const SpSubview operator()(const uword row_num, const span& col_span) const; inline SpSubview operator()(const span& row_span, const uword col_num); inline const SpSubview operator()(const span& row_span, const uword col_num) const; inline SpSubview operator()(const span& row_span, const span& col_span); inline const SpSubview operator()(const span& row_span, const span& col_span) const; inline void swap_rows(const uword in_row1, const uword in_row2); inline void swap_cols(const uword in_col1, const uword in_col2); // Forward declarations. class iterator_base; class const_iterator; class iterator; class const_row_iterator; class row_iterator; // Similar to SpMat iterators but automatically iterates past and ignores values not in the subview. class iterator_base { public: inline iterator_base(const SpSubview& in_M); inline iterator_base(const SpSubview& in_M, const uword col, const uword pos); arma_inline uword col() const { return internal_col; } arma_inline uword pos() const { return internal_pos; } arma_aligned const SpSubview* M; arma_aligned uword internal_col; arma_aligned uword internal_pos; typedef std::bidirectional_iterator_tag iterator_category; typedef eT value_type; typedef std::ptrdiff_t difference_type; // TODO: not certain on this one typedef const eT* pointer; typedef const eT& reference; }; class const_iterator : public iterator_base { public: inline const_iterator(const SpSubview& in_M, uword initial_pos = 0); inline const_iterator(const SpSubview& in_M, uword in_row, uword in_col); inline const_iterator(const SpSubview& in_M, uword in_row, uword in_col, uword in_pos, uword skip_pos); inline const_iterator(const const_iterator& other); arma_inline eT operator*() const; // Don't hold location internally; call "dummy" methods to get that information. arma_inline uword row() const { return iterator_base::M->m.row_indices[iterator_base::internal_pos + skip_pos] - iterator_base::M->aux_row1; } arma_hot inline const_iterator& operator++(); arma_warn_unused inline const_iterator operator++(int); arma_hot inline const_iterator& operator--(); arma_warn_unused inline const_iterator operator--(int); arma_hot inline bool operator!=(const const_iterator& rhs) const; arma_hot inline bool operator==(const const_iterator& rhs) const; arma_hot inline bool operator!=(const typename SpMat::const_iterator& rhs) const; arma_hot inline bool operator==(const typename SpMat::const_iterator& rhs) const; arma_hot inline bool operator!=(const const_row_iterator& rhs) const; arma_hot inline bool operator==(const const_row_iterator& rhs) const; arma_hot inline bool operator!=(const typename SpMat::const_row_iterator& rhs) const; arma_hot inline bool operator==(const typename SpMat::const_row_iterator& rhs) const; arma_aligned uword skip_pos; // not used in row_iterator or const_row_iterator }; class iterator : public const_iterator { public: inline iterator(SpSubview& in_M, const uword initial_pos = 0) : const_iterator(in_M, initial_pos) { } inline iterator(SpSubview& in_M, const uword in_row, const uword in_col) : const_iterator(in_M, in_row, in_col) { } inline iterator(SpSubview& in_M, const uword in_row, const uword in_col, const uword in_pos, const uword in_skip_pos) : const_iterator(in_M, in_row, in_col, in_pos, in_skip_pos) { } inline iterator(const iterator& other) : const_iterator(other) { } arma_hot inline SpValProxy< SpSubview > operator*(); // overloads needed for return type correctness arma_hot inline iterator& operator++(); arma_warn_unused inline iterator operator++(int); arma_hot inline iterator& operator--(); arma_warn_unused inline iterator operator--(int); // This has a different value_type than iterator_base. typedef SpValProxy< SpSubview > value_type; typedef const SpValProxy< SpSubview >* pointer; typedef const SpValProxy< SpSubview >& reference; }; class const_row_iterator : public iterator_base { public: inline const_row_iterator(); inline const_row_iterator(const SpSubview& in_M, uword initial_pos = 0); inline const_row_iterator(const SpSubview& in_M, uword in_row, uword in_col); inline const_row_iterator(const const_row_iterator& other); arma_hot inline const_row_iterator& operator++(); arma_warn_unused inline const_row_iterator operator++(int); arma_hot inline const_row_iterator& operator--(); arma_warn_unused inline const_row_iterator operator--(int); uword internal_row; // Hold row internally because we use internal_pos differently. uword actual_pos; // Actual position in subview's parent matrix. arma_inline eT operator*() const { return iterator_base::M->m.values[actual_pos]; } arma_inline uword row() const { return internal_row; } arma_hot inline bool operator!=(const const_iterator& rhs) const; arma_hot inline bool operator==(const const_iterator& rhs) const; arma_hot inline bool operator!=(const typename SpMat::const_iterator& rhs) const; arma_hot inline bool operator==(const typename SpMat::const_iterator& rhs) const; arma_hot inline bool operator!=(const const_row_iterator& rhs) const; arma_hot inline bool operator==(const const_row_iterator& rhs) const; arma_hot inline bool operator!=(const typename SpMat::const_row_iterator& rhs) const; arma_hot inline bool operator==(const typename SpMat::const_row_iterator& rhs) const; }; class row_iterator : public const_row_iterator { public: inline row_iterator(SpSubview& in_M, uword initial_pos = 0) : const_row_iterator(in_M, initial_pos) { } inline row_iterator(SpSubview& in_M, uword in_row, uword in_col) : const_row_iterator(in_M, in_row, in_col) { } inline row_iterator(const row_iterator& other) : const_row_iterator(other) { } arma_hot inline SpValProxy< SpSubview > operator*(); // overloads needed for return type correctness arma_hot inline row_iterator& operator++(); arma_warn_unused inline row_iterator operator++(int); arma_hot inline row_iterator& operator--(); arma_warn_unused inline row_iterator operator--(int); // This has a different value_type than iterator_base. typedef SpValProxy< SpSubview > value_type; typedef const SpValProxy< SpSubview >* pointer; typedef const SpValProxy< SpSubview >& reference; }; inline iterator begin(); inline const_iterator begin() const; inline const_iterator cbegin() const; inline iterator begin_col(const uword col_num); inline const_iterator begin_col(const uword col_num) const; inline row_iterator begin_row(const uword row_num = 0); inline const_row_iterator begin_row(const uword row_num = 0) const; inline iterator end(); inline const_iterator end() const; inline const_iterator cend() const; inline row_iterator end_row(); inline const_row_iterator end_row() const; inline row_iterator end_row(const uword row_num); inline const_row_iterator end_row(const uword row_num) const; //! don't use this unless you're writing internal Armadillo code arma_inline bool is_alias(const SpMat& X) const; private: friend class SpMat; friend class SpSubview_col; friend class SpSubview_row; friend class SpValProxy< SpSubview >; // allow SpValProxy to call insert_element() and delete_element() arma_warn_unused inline eT& insert_element(const uword in_row, const uword in_col, const eT in_val = eT(0)); inline void delete_element(const uword in_row, const uword in_col); inline void invalidate_cache() const; }; template class SpSubview_col : public SpSubview { public: typedef eT elem_type; typedef typename get_pod_type::result pod_type; static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; inline void operator= (const SpSubview& x); inline void operator= (const SpSubview_col& x); template inline void operator= (const SpBase& x); template inline void operator= (const Base& x); arma_warn_unused inline const SpOp,spop_htrans> t() const; arma_warn_unused inline const SpOp,spop_htrans> ht() const; arma_warn_unused inline const SpOp,spop_strans> st() const; arma_warn_unused inline const SpToDOp,op_sp_as_dense> as_dense() const; protected: inline SpSubview_col(const SpMat& in_m, const uword in_col); inline SpSubview_col(const SpMat& in_m, const uword in_col, const uword in_row1, const uword in_n_rows); inline SpSubview_col() = delete; private: friend class SpMat; friend class SpSubview; }; template class SpSubview_row : public SpSubview { public: typedef eT elem_type; typedef typename get_pod_type::result pod_type; static constexpr bool is_row = true; static constexpr bool is_col = false; static constexpr bool is_xvec = false; inline void operator= (const SpSubview& x); inline void operator= (const SpSubview_row& x); template inline void operator= (const SpBase& x); template inline void operator= (const Base& x); arma_warn_unused inline const SpOp,spop_htrans> t() const; arma_warn_unused inline const SpOp,spop_htrans> ht() const; arma_warn_unused inline const SpOp,spop_strans> st() const; arma_warn_unused inline const SpToDOp,op_sp_as_dense> as_dense() const; protected: inline SpSubview_row(const SpMat& in_m, const uword in_row); inline SpSubview_row(const SpMat& in_m, const uword in_row, const uword in_col1, const uword in_n_cols); inline SpSubview_row() = delete; private: friend class SpMat; friend class SpSubview; }; //! @} RcppArmadillo/inst/include/armadillo_bits/spglue_merge_meat.hpp0000644000176200001440000003411714631567470024610 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup spglue_merge //! @{ template inline void spglue_merge::subview_merge(SpSubview& sv, const SpMat& B) { arma_debug_sigprint(); if(sv.n_elem == 0) { return; } if(B.n_nonzero == 0) { sv.zeros(); return; } SpMat& A = access::rw(sv.m); const uword merge_n_nonzero = A.n_nonzero - sv.n_nonzero + B.n_nonzero; const uword sv_row_start = sv.aux_row1; const uword sv_col_start = sv.aux_col1; const uword sv_row_end = sv.aux_row1 + sv.n_rows - 1; const uword sv_col_end = sv.aux_col1 + sv.n_cols - 1; if(A.n_nonzero == sv.n_nonzero) { // A is either all zeros or has all of its elements in the subview // so the merge is equivalent to overwrite of A SpMat tmp(arma_reserve_indicator(), A.n_rows, A.n_cols, B.n_nonzero); typename SpMat::const_iterator B_it = B.begin(); typename SpMat::const_iterator B_it_end = B.end(); uword tmp_count = 0; for(; B_it != B_it_end; ++B_it) { access::rw(tmp.values[tmp_count]) = (*B_it); access::rw(tmp.row_indices[tmp_count]) = B_it.row() + sv_row_start; access::rw(tmp.col_ptrs[B_it.col() + sv_col_start + 1])++; ++tmp_count; } for(uword i=0; i < tmp.n_cols; ++i) { access::rw(tmp.col_ptrs[i + 1]) += tmp.col_ptrs[i]; } A.steal_mem(tmp); access::rw(sv.n_nonzero) = B.n_nonzero; return; } if(sv.n_nonzero > (A.n_nonzero/2)) { // A has most of its elements in the subview, // so regenerate A with zeros in the subview region // in order to increase merging efficiency sv.zeros(); } SpMat out(arma_reserve_indicator(), A.n_rows, A.n_cols, merge_n_nonzero); typename SpMat::const_iterator x_it = A.begin(); typename SpMat::const_iterator x_end = A.end(); typename SpMat::const_iterator y_it = B.begin(); typename SpMat::const_iterator y_end = B.end(); uword count = 0; bool x_it_valid = (x_it != x_end); bool y_it_valid = (y_it != y_end); while(x_it_valid || y_it_valid) { eT out_val = eT(0); const uword x_it_row = (x_it_valid) ? uword(x_it.row()) : uword(0); const uword x_it_col = (x_it_valid) ? uword(x_it.col()) : uword(0); const uword y_it_row = (y_it_valid) ? uword(sv_row_start + y_it.row()) : uword(0); const uword y_it_col = (y_it_valid) ? uword(sv_col_start + y_it.col()) : uword(0); bool use_y_loc = false; if(x_it_valid && y_it_valid) { if( (x_it_row == y_it_row) && (x_it_col == y_it_col) ) { out_val = (*y_it); ++x_it; ++y_it; } else { if((x_it_col < y_it_col) || ((x_it_col == y_it_col) && (x_it_row < y_it_row))) // if y is closer to the end { const bool x_inside_box = ((x_it_row >= sv_row_start) && (x_it_row <= sv_row_end)) && ((x_it_col >= sv_col_start) && (x_it_col <= sv_col_end)); out_val = (x_inside_box) ? eT(0) : (*x_it); ++x_it; } else { out_val = (*y_it); ++y_it; use_y_loc = true; } } } else if(x_it_valid) { const bool x_inside_box = ((x_it_row >= sv_row_start) && (x_it_row <= sv_row_end)) && ((x_it_col >= sv_col_start) && (x_it_col <= sv_col_end)); out_val = (x_inside_box) ? eT(0) : (*x_it); ++x_it; } else if(y_it_valid) { out_val = (*y_it); ++y_it; use_y_loc = true; } if(out_val != eT(0)) { access::rw(out.values[count]) = out_val; const uword out_row = (use_y_loc == false) ? x_it_row : y_it_row; const uword out_col = (use_y_loc == false) ? x_it_col : y_it_col; access::rw(out.row_indices[count]) = out_row; access::rw(out.col_ptrs[out_col + 1])++; ++count; } x_it_valid = (x_it != x_end); y_it_valid = (y_it != y_end); } arma_check( (count != merge_n_nonzero), "internal error: spglue_merge::subview_merge(): count != merge_n_nonzero" ); const uword out_n_cols = out.n_cols; uword* col_ptrs = access::rwp(out.col_ptrs); for(uword c = 1; c <= out_n_cols; ++c) { col_ptrs[c] += col_ptrs[c - 1]; } A.steal_mem(out); access::rw(sv.n_nonzero) = B.n_nonzero; } template inline void spglue_merge::subview_merge(SpSubview& sv, const Mat& B) { arma_debug_sigprint(); if(sv.n_elem == 0) { return; } const eT* B_memptr = B.memptr(); const uword B_n_elem = B.n_elem; uword B_n_nonzero = 0; for(uword i=0; i < B_n_elem; ++i) { B_n_nonzero += (B_memptr[i] != eT(0)) ? uword(1) : uword(0); } if(B_n_nonzero == 0) { sv.zeros(); return; } SpMat& A = access::rw(sv.m); const uword merge_n_nonzero = A.n_nonzero - sv.n_nonzero + B_n_nonzero; const uword sv_row_start = sv.aux_row1; const uword sv_col_start = sv.aux_col1; const uword sv_row_end = sv.aux_row1 + sv.n_rows - 1; const uword sv_col_end = sv.aux_col1 + sv.n_cols - 1; if(A.n_nonzero == sv.n_nonzero) { // A is either all zeros or has all of its elements in the subview // so the merge is equivalent to overwrite of A SpMat tmp(arma_reserve_indicator(), A.n_rows, A.n_cols, B_n_nonzero); typename Mat::const_row_col_iterator B_it = B.begin_row_col(); typename Mat::const_row_col_iterator B_it_end = B.end_row_col(); uword tmp_count = 0; for(; B_it != B_it_end; ++B_it) { const eT val = (*B_it); if(val != eT(0)) { access::rw(tmp.values[tmp_count]) = val; access::rw(tmp.row_indices[tmp_count]) = B_it.row() + sv_row_start; access::rw(tmp.col_ptrs[B_it.col() + sv_col_start + 1])++; ++tmp_count; } } for(uword i=0; i < tmp.n_cols; ++i) { access::rw(tmp.col_ptrs[i + 1]) += tmp.col_ptrs[i]; } A.steal_mem(tmp); access::rw(sv.n_nonzero) = B_n_nonzero; return; } if(sv.n_nonzero > (A.n_nonzero/2)) { // A has most of its elements in the subview, // so regenerate A with zeros in the subview region // in order to increase merging efficiency sv.zeros(); } SpMat out(arma_reserve_indicator(), A.n_rows, A.n_cols, merge_n_nonzero); typename SpMat::const_iterator x_it = A.begin(); typename SpMat::const_iterator x_end = A.end(); typename Mat::const_row_col_iterator y_it = B.begin_row_col(); typename Mat::const_row_col_iterator y_end = B.end_row_col(); uword count = 0; bool x_it_valid = (x_it != x_end); bool y_it_valid = (y_it != y_end); while(x_it_valid || y_it_valid) { eT out_val = eT(0); const uword x_it_row = (x_it_valid) ? uword(x_it.row()) : uword(0); const uword x_it_col = (x_it_valid) ? uword(x_it.col()) : uword(0); const uword y_it_row = (y_it_valid) ? uword(sv_row_start + y_it.row()) : uword(0); const uword y_it_col = (y_it_valid) ? uword(sv_col_start + y_it.col()) : uword(0); bool use_y_loc = false; if(x_it_valid && y_it_valid) { if( (x_it_row == y_it_row) && (x_it_col == y_it_col) ) { out_val = (*y_it); ++x_it; ++y_it; } else { if((x_it_col < y_it_col) || ((x_it_col == y_it_col) && (x_it_row < y_it_row))) // if y is closer to the end { const bool x_inside_box = ((x_it_row >= sv_row_start) && (x_it_row <= sv_row_end)) && ((x_it_col >= sv_col_start) && (x_it_col <= sv_col_end)); out_val = (x_inside_box) ? eT(0) : (*x_it); ++x_it; } else { out_val = (*y_it); ++y_it; use_y_loc = true; } } } else if(x_it_valid) { const bool x_inside_box = ((x_it_row >= sv_row_start) && (x_it_row <= sv_row_end)) && ((x_it_col >= sv_col_start) && (x_it_col <= sv_col_end)); out_val = (x_inside_box) ? eT(0) : (*x_it); ++x_it; } else if(y_it_valid) { out_val = (*y_it); ++y_it; use_y_loc = true; } if(out_val != eT(0)) { access::rw(out.values[count]) = out_val; const uword out_row = (use_y_loc == false) ? x_it_row : y_it_row; const uword out_col = (use_y_loc == false) ? x_it_col : y_it_col; access::rw(out.row_indices[count]) = out_row; access::rw(out.col_ptrs[out_col + 1])++; ++count; } x_it_valid = (x_it != x_end); y_it_valid = (y_it != y_end); } arma_check( (count != merge_n_nonzero), "internal error: spglue_merge::subview_merge(): count != merge_n_nonzero" ); const uword out_n_cols = out.n_cols; uword* col_ptrs = access::rwp(out.col_ptrs); for(uword c = 1; c <= out_n_cols; ++c) { col_ptrs[c] += col_ptrs[c - 1]; } A.steal_mem(out); access::rw(sv.n_nonzero) = B_n_nonzero; } template inline void spglue_merge::symmat_merge(SpMat& out, const SpMat& A, const SpMat& B) { arma_debug_sigprint(); out.reserve(A.n_rows, A.n_cols, 2*A.n_nonzero); // worst case scenario typename SpMat::const_iterator x_it = A.begin(); typename SpMat::const_iterator x_end = A.end(); typename SpMat::const_iterator y_it = B.begin(); typename SpMat::const_iterator y_end = B.end(); uword count = 0; while( (x_it != x_end) || (y_it != y_end) ) { eT out_val; const uword x_it_col = x_it.col(); const uword x_it_row = x_it.row(); const uword y_it_col = y_it.col(); const uword y_it_row = y_it.row(); bool use_y_loc = false; if(x_it == y_it) { // this can only happen on the diagonal out_val = (*x_it); ++x_it; ++y_it; } else { if((x_it_col < y_it_col) || ((x_it_col == y_it_col) && (x_it_row < y_it_row))) // if y is closer to the end { out_val = (*x_it); ++x_it; } else { out_val = (*y_it); ++y_it; use_y_loc = true; } } access::rw(out.values[count]) = out_val; const uword out_row = (use_y_loc == false) ? x_it_row : y_it_row; const uword out_col = (use_y_loc == false) ? x_it_col : y_it_col; access::rw(out.row_indices[count]) = out_row; access::rw(out.col_ptrs[out_col + 1])++; ++count; } const uword out_n_cols = out.n_cols; uword* col_ptrs = access::rwp(out.col_ptrs); // Fix column pointers to be cumulative. for(uword c = 1; c <= out_n_cols; ++c) { col_ptrs[c] += col_ptrs[c - 1]; } // quick resize without reallocating memory and copying data access::rw( out.n_nonzero) = count; access::rw( out.values[count]) = eT(0); access::rw(out.row_indices[count]) = uword(0); } template inline void spglue_merge::diagview_merge(SpMat& out, const SpMat& A, const SpMat& B) { arma_debug_sigprint(); // NOTE: assuming that B has non-zero elements only on the main diagonal out.reserve(A.n_rows, A.n_cols, A.n_nonzero + B.n_nonzero); // worst case scenario typename SpMat::const_iterator x_it = A.begin(); typename SpMat::const_iterator x_end = A.end(); typename SpMat::const_iterator y_it = B.begin(); typename SpMat::const_iterator y_end = B.end(); uword count = 0; while( (x_it != x_end) || (y_it != y_end) ) { eT out_val = eT(0); const uword x_it_col = x_it.col(); const uword x_it_row = x_it.row(); const uword y_it_col = y_it.col(); const uword y_it_row = y_it.row(); bool use_y_loc = false; if(x_it == y_it) { // this can only happen on the diagonal out_val = (*y_it); ++x_it; ++y_it; } else { if((x_it_col < y_it_col) || ((x_it_col == y_it_col) && (x_it_row < y_it_row))) // if y is closer to the end { if(x_it_col != x_it_row) { out_val = (*x_it); } // don't take values from the main diagonal of A ++x_it; } else { if(y_it_col == y_it_row) { out_val = (*y_it); use_y_loc = true; } // take values only from the main diagonal of B ++y_it; } } if(out_val != eT(0)) { access::rw(out.values[count]) = out_val; const uword out_row = (use_y_loc == false) ? x_it_row : y_it_row; const uword out_col = (use_y_loc == false) ? x_it_col : y_it_col; access::rw(out.row_indices[count]) = out_row; access::rw(out.col_ptrs[out_col + 1])++; ++count; } } const uword out_n_cols = out.n_cols; uword* col_ptrs = access::rwp(out.col_ptrs); // Fix column pointers to be cumulative. for(uword c = 1; c <= out_n_cols; ++c) { col_ptrs[c] += col_ptrs[c - 1]; } // quick resize without reallocating memory and copying data access::rw( out.n_nonzero) = count; access::rw( out.values[count]) = eT(0); access::rw(out.row_indices[count]) = uword(0); } //! @} RcppArmadillo/inst/include/armadillo_bits/op_flip_meat.hpp0000644000176200001440000001532714631567470023564 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_flip //! @{ template inline void op_flipud::apply(Mat& out, const Op& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; if(is_Mat::value) { // allow detection of in-place operation const unwrap U(in.m); op_flipud::apply_direct(out, U.M); } else { const Proxy P(in.m); if(P.is_alias(out)) { Mat tmp; op_flipud::apply_proxy_noalias(tmp, P); out.steal_mem(tmp); } else { op_flipud::apply_proxy_noalias(out, P); } } } template inline void op_flipud::apply_direct(Mat& out, const Mat& X) { arma_debug_sigprint(); const uword X_n_rows = X.n_rows; const uword X_n_cols = X.n_cols; const uword X_n_rows_m1 = X_n_rows - 1; if(&out != &X) { out.set_size(X_n_rows, X_n_cols); if(X_n_cols == 1) { const eT* X_mem = X.memptr(); eT* out_mem = out.memptr(); for(uword row=0; row < X_n_rows; ++row) { out_mem[X_n_rows_m1 - row] = X_mem[row]; } } else { for(uword col=0; col < X_n_cols; ++col) { const eT* X_colmem = X.colptr(col); eT* out_colmem = out.colptr(col); for(uword row=0; row < X_n_rows; ++row) { out_colmem[X_n_rows_m1 - row] = X_colmem[row]; } } } } else // in-place operation { const uword N = X_n_rows / 2; if(X_n_cols == 1) { eT* out_mem = out.memptr(); for(uword row=0; row < N; ++row) { std::swap(out_mem[X_n_rows_m1 - row], out_mem[row]); } } else { for(uword col=0; col < X_n_cols; ++col) { eT* out_colmem = out.colptr(col); for(uword row=0; row < N; ++row) { std::swap(out_colmem[X_n_rows_m1 - row], out_colmem[row]); } } } } } template inline void op_flipud::apply_proxy_noalias(Mat& out, const Proxy& P) { arma_debug_sigprint(); typedef typename T1::elem_type eT; typedef typename Proxy::stored_type P_stored_type; if(is_Mat::value) { const unwrap U(P.Q); op_flipud::apply_direct(out, U.M); return; } const uword P_n_rows = P.get_n_rows(); const uword P_n_cols = P.get_n_cols(); const uword P_n_rows_m1 = P_n_rows - 1; out.set_size(P_n_rows, P_n_cols); if( ((T1::is_col) || (P_n_cols == 1)) && (Proxy::use_at == false) ) { eT* out_mem = out.memptr(); const typename Proxy::ea_type P_ea = P.get_ea(); for(uword row=0; row < P_n_rows; ++row) { out_mem[P_n_rows_m1 - row] = P_ea[row]; } } else { for(uword col=0; col < P_n_cols; ++col) { eT* out_colmem = out.colptr(col); for(uword row=0; row < P_n_rows; ++row) { out_colmem[P_n_rows_m1 - row] = P.at(row, col); } } } } // template inline void op_fliplr::apply(Mat& out, const Op& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; if(is_Mat::value) { // allow detection of in-place operation const unwrap U(in.m); op_fliplr::apply_direct(out, U.M); } else { const Proxy P(in.m); if(P.is_alias(out)) { Mat tmp; op_fliplr::apply_proxy_noalias(tmp, P); out.steal_mem(tmp); } else { op_fliplr::apply_proxy_noalias(out, P); } } } template inline void op_fliplr::apply_direct(Mat& out, const Mat& X) { arma_debug_sigprint(); const uword X_n_rows = X.n_rows; const uword X_n_cols = X.n_cols; const uword X_n_cols_m1 = X_n_cols - 1; if(&out != &X) { out.set_size(X_n_rows, X_n_cols); if(X_n_rows == 1) { const eT* X_mem = X.memptr(); eT* out_mem = out.memptr(); for(uword col=0; col < X_n_cols; ++col) { out_mem[X_n_cols_m1 - col] = X_mem[col]; } } else { for(uword col=0; col < X_n_cols; ++col) { out.col(X_n_cols_m1 - col) = X.col(col); } } } else // in-place operation { const uword N = X_n_cols / 2; if(X_n_rows == 1) { eT* out_mem = out.memptr(); for(uword col=0; col < N; ++col) { std::swap(out_mem[X_n_cols_m1 - col], out_mem[col]); } } else { for(uword col=0; col < N; ++col) { out.swap_cols(X_n_cols_m1 - col, col); } } } } template inline void op_fliplr::apply_proxy_noalias(Mat& out, const Proxy& P) { arma_debug_sigprint(); typedef typename T1::elem_type eT; typedef typename Proxy::stored_type P_stored_type; if(is_Mat::value) { const unwrap U(P.Q); op_fliplr::apply_direct(out, U.M); return; } const uword P_n_rows = P.get_n_rows(); const uword P_n_cols = P.get_n_cols(); const uword P_n_cols_m1 = P_n_cols - 1; out.set_size(P_n_rows, P_n_cols); if( ((T1::is_row) || (P_n_rows == 1)) && (Proxy::use_at == false) ) { eT* out_mem = out.memptr(); const typename Proxy::ea_type P_ea = P.get_ea(); for(uword col=0; col < P_n_cols; ++col) { out_mem[P_n_cols_m1 - col] = P_ea[col]; } } else { for(uword col=0; col < P_n_cols; ++col) { eT* out_colmem = out.colptr(P_n_cols_m1 - col); for(uword row=0; row < P_n_rows; ++row) { out_colmem[row] = P.at(row,col); } } } } //! @} RcppArmadillo/inst/include/armadillo_bits/eGlueCube_bones.hpp0000644000176200001440000000426514752446051024146 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup eGlueCube //! @{ template class eGlueCube : public BaseCube< typename T1::elem_type, eGlueCube > { public: typedef typename T1::elem_type elem_type; typedef typename get_pod_type::result pod_type; typedef ProxyCube proxy1_type; typedef ProxyCube proxy2_type; static constexpr bool use_at = (ProxyCube::use_at || ProxyCube::use_at ); static constexpr bool use_mp = (ProxyCube::use_mp || ProxyCube::use_mp ); static constexpr bool has_subview = (ProxyCube::has_subview || ProxyCube::has_subview); const ProxyCube P1; const ProxyCube P2; arma_inline ~eGlueCube(); arma_inline eGlueCube(const T1& in_A, const T2& in_B); arma_inline uword get_n_rows() const; arma_inline uword get_n_cols() const; arma_inline uword get_n_elem_slice() const; arma_inline uword get_n_slices() const; arma_inline uword get_n_elem() const; arma_inline elem_type operator[] (const uword i) const; arma_inline elem_type at (const uword row, const uword col, const uword slice) const; arma_inline elem_type at_alt (const uword i) const; }; //! @} RcppArmadillo/inst/include/armadillo_bits/fn_prod.hpp0000644000176200001440000000411614631567470022547 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_prod //! @{ //! \brief //! Delayed product of elements of a matrix along a specified dimension (either rows or columns). //! The result is stored in a dense matrix that has either one column or one row. //! For dim = 0, find the sum of each column (ie. traverse across rows) //! For dim = 1, find the sum of each row (ie. traverse across columns) //! The default is dim = 0. //! NOTE: this function works differently than in Matlab/Octave. template arma_warn_unused inline typename enable_if2< is_arma_type::value && resolves_to_vector::yes, typename T1::elem_type >::result prod(const T1& X) { arma_debug_sigprint(); return op_prod::prod(X); } template arma_warn_unused arma_inline typename enable_if2< is_arma_type::value && resolves_to_vector::no, const Op >::result prod(const T1& X) { arma_debug_sigprint(); return Op(X, 0, 0); } template arma_warn_unused arma_inline typename enable_if2< is_arma_type::value, const Op >::result prod(const T1& X, const uword dim) { arma_debug_sigprint(); return Op(X, dim, 0); } template arma_warn_unused arma_inline typename arma_scalar_only::result prod(const T& x) { return x; } //! @} RcppArmadillo/inst/include/armadillo_bits/mp_misc.hpp0000644000176200001440000000362614301267043022537 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup mp_misc //! @{ template struct mp_gate { arma_inline static bool eval(const uword n_elem) { #if defined(ARMA_USE_OPENMP) { const bool length_ok = (is_cx::yes || use_smaller_thresh) ? (n_elem >= (arma_config::mp_threshold/uword(2))) : (n_elem >= arma_config::mp_threshold); if(length_ok) { if(omp_in_parallel()) { return false; } } return length_ok; } #else { arma_ignore(n_elem); return false; } #endif } }; struct mp_thread_limit { arma_inline static int get() { #if defined(ARMA_USE_OPENMP) int n_threads = (std::min)(int(arma_config::mp_threads), int((std::max)(int(1), int(omp_get_max_threads())))); #else int n_threads = int(1); #endif return n_threads; } arma_inline static bool in_parallel() { #if defined(ARMA_USE_OPENMP) { return bool(omp_in_parallel()); } #else { return false; } #endif } }; //! @} RcppArmadillo/inst/include/armadillo_bits/fn_eps.hpp0000644000176200001440000000437414631567470022400 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_eps //! @{ template arma_warn_unused inline const eOp eps(const Base& X, const typename arma_not_cx::result* junk = nullptr) { arma_debug_sigprint(); arma_ignore(junk); return eOp(X.get_ref()); } template arma_warn_unused inline Mat< typename T1::pod_type > eps(const Base< std::complex, T1>& X, const typename arma_cx_only::result* junk = nullptr) { arma_debug_sigprint(); arma_ignore(junk); typedef typename T1::pod_type T; typedef typename T1::elem_type eT; const unwrap tmp(X.get_ref()); const Mat& A = tmp.M; Mat out(A.n_rows, A.n_cols, arma_nozeros_indicator()); T* out_mem = out.memptr(); const eT* A_mem = A.memptr(); const uword n_elem = A.n_elem; for(uword i=0; i arma_warn_unused arma_inline typename arma_integral_only::result eps(const eT& x) { arma_ignore(x); return eT(0); } template arma_warn_unused arma_inline typename arma_real_only::result eps(const eT& x) { return eop_aux::direct_eps(x); } template arma_warn_unused arma_inline typename arma_real_only::result eps(const std::complex& x) { return eop_aux::direct_eps(x); } //! @} RcppArmadillo/inst/include/armadillo_bits/spop_omit_meat.hpp0000644000176200001440000000627515030507611024130 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup spop_omit //! @{ template inline void spop_omit::apply(SpMat& out, const SpOp& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword omit_mode = in.aux_uword_a; if(arma_config::fast_math_warn) { if(omit_mode == 1) { arma_warn(1, "omit_nan(): detection of NaN is not reliable in fast math mode"); } if(omit_mode == 2) { arma_warn(1, "omit_nonfinite(): detection of non-finite values is not reliable in fast math mode"); } } auto is_omitted_1 = [](const eT& x) -> bool { return arma_isnan(x); }; auto is_omitted_2 = [](const eT& x) -> bool { return arma_isnonfinite(x); }; const SpProxy P(in.m); if(P.is_alias(out)) { SpMat tmp; if(omit_mode == 1) { spop_omit::apply_noalias(tmp, P, is_omitted_1); } if(omit_mode == 2) { spop_omit::apply_noalias(tmp, P, is_omitted_2); } out.steal_mem(tmp); } else { if(omit_mode == 1) { spop_omit::apply_noalias(out, P, is_omitted_1); } if(omit_mode == 2) { spop_omit::apply_noalias(out, P, is_omitted_2); } } } template inline void spop_omit::apply_noalias(SpMat& out, const SpProxy& P, functor is_omitted) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword n_rows = P.get_n_rows(); const uword max_n_nonzero = P.get_n_nonzero(); if(max_n_nonzero == 0) { out.reset(); return; } out.reserve(P.get_n_elem(), 1, max_n_nonzero); typename SpProxy::const_iterator_type it = P.begin(); typename SpProxy::const_iterator_type it_end = P.end(); uword count = 0; for(; it != it_end; ++it) { const eT val = (*it); if(is_omitted(val) == false) { const uword index = it.row() + it.col()*n_rows; access::rw(out.values[count]) = val; access::rw(out.row_indices[count]) = index; access::rw(out.col_ptrs[1])++; ++count; } } if(count < max_n_nonzero) { if(count <= (max_n_nonzero/2)) { out.mem_resize(count); } else { // quick resize without reallocating memory and copying data access::rw( out.n_nonzero) = count; access::rw( out.values[count]) = eT(0); access::rw(out.row_indices[count]) = uword(0); } } } //! @} RcppArmadillo/inst/include/armadillo_bits/spglue_minus_meat.hpp0000644000176200001440000002047314631567470024644 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup spglue_minus //! @{ template inline void spglue_minus::apply(SpMat& out, const SpGlue& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const SpProxy pa(X.A); const SpProxy pb(X.B); const bool is_alias = pa.is_alias(out) || pb.is_alias(out); if(is_alias == false) { spglue_minus::apply_noalias(out, pa, pb); } else { SpMat tmp; spglue_minus::apply_noalias(tmp, pa, pb); out.steal_mem(tmp); } } template inline void spglue_minus::apply_noalias(SpMat& out, const SpProxy& pa, const SpProxy& pb) { arma_debug_sigprint(); arma_conform_assert_same_size(pa.get_n_rows(), pa.get_n_cols(), pb.get_n_rows(), pb.get_n_cols(), "subtraction"); if(pa.get_n_nonzero() == 0) { out = pb.Q; out *= eT(-1); return; } if(pb.get_n_nonzero() == 0) { out = pa.Q; return; } const uword max_n_nonzero = pa.get_n_nonzero() + pb.get_n_nonzero(); // Resize memory to upper bound out.reserve(pa.get_n_rows(), pa.get_n_cols(), max_n_nonzero); // Now iterate across both matrices. typename SpProxy::const_iterator_type x_it = pa.begin(); typename SpProxy::const_iterator_type x_end = pa.end(); typename SpProxy::const_iterator_type y_it = pb.begin(); typename SpProxy::const_iterator_type y_end = pb.end(); uword count = 0; while( (x_it != x_end) || (y_it != y_end) ) { eT out_val; const uword x_it_row = x_it.row(); const uword x_it_col = x_it.col(); const uword y_it_row = y_it.row(); const uword y_it_col = y_it.col(); bool use_y_loc = false; if(x_it == y_it) { out_val = (*x_it) - (*y_it); ++x_it; ++y_it; } else { if((x_it_col < y_it_col) || ((x_it_col == y_it_col) && (x_it_row < y_it_row))) // if y is closer to the end { out_val = (*x_it); ++x_it; } else { out_val = -(*y_it); // take the negative ++y_it; use_y_loc = true; } } if(out_val != eT(0)) { access::rw(out.values[count]) = out_val; const uword out_row = (use_y_loc == false) ? x_it_row : y_it_row; const uword out_col = (use_y_loc == false) ? x_it_col : y_it_col; access::rw(out.row_indices[count]) = out_row; access::rw(out.col_ptrs[out_col + 1])++; ++count; } arma_check( (count > max_n_nonzero), "internal error: spglue_minus::apply_noalias(): count > max_n_nonzero" ); } const uword out_n_cols = out.n_cols; uword* col_ptrs = access::rwp(out.col_ptrs); // Fix column pointers to be cumulative. for(uword c = 1; c <= out_n_cols; ++c) { col_ptrs[c] += col_ptrs[c - 1]; } if(count < max_n_nonzero) { if(count <= (max_n_nonzero/2)) { out.mem_resize(count); } else { // quick resize without reallocating memory and copying data access::rw( out.n_nonzero) = count; access::rw( out.values[count]) = eT(0); access::rw(out.row_indices[count]) = uword(0); } } } template inline void spglue_minus::apply_noalias(SpMat& out, const SpMat& A, const SpMat& B) { arma_debug_sigprint(); const SpProxy< SpMat > pa(A); const SpProxy< SpMat > pb(B); spglue_minus::apply_noalias(out, pa, pb); } // template inline void spglue_minus_mixed::apply(SpMat::eT>& out, const mtSpGlue::eT, T1, T2, spglue_minus_mixed>& expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT1; typedef typename T2::elem_type eT2; typedef typename promote_type::result out_eT; promote_type::check(); if( (is_same_type::no) && (is_same_type::yes) ) { // upgrade T1 const unwrap_spmat UA(expr.A); const unwrap_spmat UB(expr.B); const SpMat& A = UA.M; const SpMat& B = UB.M; SpMat AA(arma_layout_indicator(), A); for(uword i=0; i < A.n_nonzero; ++i) { access::rw(AA.values[i]) = out_eT(A.values[i]); } const SpMat& BB = reinterpret_cast< const SpMat& >(B); out = AA - BB; } else if( (is_same_type::yes) && (is_same_type::no) ) { // upgrade T2 const unwrap_spmat UA(expr.A); const unwrap_spmat UB(expr.B); const SpMat& A = UA.M; const SpMat& B = UB.M; const SpMat& AA = reinterpret_cast< const SpMat& >(A); SpMat BB(arma_layout_indicator(), B); for(uword i=0; i < B.n_nonzero; ++i) { access::rw(BB.values[i]) = out_eT(B.values[i]); } out = AA - BB; } else { // upgrade T1 and T2 const unwrap_spmat UA(expr.A); const unwrap_spmat UB(expr.B); const SpMat& A = UA.M; const SpMat& B = UB.M; SpMat AA(arma_layout_indicator(), A); SpMat BB(arma_layout_indicator(), B); for(uword i=0; i < A.n_nonzero; ++i) { access::rw(AA.values[i]) = out_eT(A.values[i]); } for(uword i=0; i < B.n_nonzero; ++i) { access::rw(BB.values[i]) = out_eT(B.values[i]); } out = AA - BB; } } template inline void spglue_minus_mixed::sparse_minus_dense(Mat< typename promote_type::result>& out, const T1& X, const T2& Y) { arma_debug_sigprint(); typedef typename T1::elem_type eT1; typedef typename T2::elem_type eT2; typedef typename promote_type::result out_eT; promote_type::check(); const quasi_unwrap UB(Y); const Mat& B = UB.M; const uword B_n_elem = B.n_elem; const eT2* B_mem = B.memptr(); out.set_size(B.n_rows, B.n_cols); out_eT* out_mem = out.memptr(); for(uword i=0; i pa(X); arma_conform_assert_same_size( pa.get_n_rows(), pa.get_n_cols(), out.n_rows, out.n_cols, "subtraction" ); typename SpProxy::const_iterator_type it = pa.begin(); typename SpProxy::const_iterator_type it_end = pa.end(); while(it != it_end) { out.at(it.row(), it.col()) += out_eT(*it); ++it; } } template inline void spglue_minus_mixed::dense_minus_sparse(Mat< typename promote_type::result>& out, const T1& X, const T2& Y) { arma_debug_sigprint(); typedef typename T1::elem_type eT1; typedef typename T2::elem_type eT2; typedef typename promote_type::result out_eT; promote_type::check(); if(is_same_type::no) { out = conv_to< Mat >::from(X); } else { const quasi_unwrap UA(X); const Mat& A = UA.M; out = reinterpret_cast< const Mat& >(A); } const SpProxy pb(Y); arma_conform_assert_same_size( out.n_rows, out.n_cols, pb.get_n_rows(), pb.get_n_cols(), "subtraction" ); typename SpProxy::const_iterator_type it = pb.begin(); typename SpProxy::const_iterator_type it_end = pb.end(); while(it != it_end) { out.at(it.row(), it.col()) -= out_eT(*it); ++it; } } //! @} RcppArmadillo/inst/include/armadillo_bits/gmm_full_meat.hpp0000644000176200001440000020531515030507611023715 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup gmm_full //! @{ namespace gmm_priv { template inline gmm_full::~gmm_full() { arma_debug_sigprint_this(this); arma_type_check(( (is_same_type::value == false) && (is_same_type::value == false) )); } template inline gmm_full::gmm_full() { arma_debug_sigprint_this(this); } template inline gmm_full::gmm_full(const gmm_full& x) { arma_debug_sigprint_this(this); init(x); } template inline gmm_full& gmm_full::operator=(const gmm_full& x) { arma_debug_sigprint(); init(x); return *this; } template inline gmm_full::gmm_full(const gmm_diag& x) { arma_debug_sigprint_this(this); init(x); } template inline gmm_full& gmm_full::operator=(const gmm_diag& x) { arma_debug_sigprint(); init(x); return *this; } template inline gmm_full::gmm_full(const uword in_n_dims, const uword in_n_gaus) { arma_debug_sigprint_this(this); init(in_n_dims, in_n_gaus); } template inline void gmm_full::reset() { arma_debug_sigprint(); init(0, 0); } template inline void gmm_full::reset(const uword in_n_dims, const uword in_n_gaus) { arma_debug_sigprint(); init(in_n_dims, in_n_gaus); } template template inline void gmm_full::set_params(const Base& in_means_expr, const BaseCube& in_fcovs_expr, const Base& in_hefts_expr) { arma_debug_sigprint(); const unwrap tmp1(in_means_expr.get_ref()); const unwrap_cube tmp2(in_fcovs_expr.get_ref()); const unwrap tmp3(in_hefts_expr.get_ref()); const Mat & in_means = tmp1.M; const Cube& in_fcovs = tmp2.M; const Mat & in_hefts = tmp3.M; arma_conform_check ( (in_means.n_cols != in_fcovs.n_slices) || (in_means.n_rows != in_fcovs.n_rows) || (in_fcovs.n_rows != in_fcovs.n_cols) || (in_hefts.n_cols != in_means.n_cols) || (in_hefts.n_rows != 1), "gmm_full::set_params(): given parameters have inconsistent and/or wrong sizes" ); arma_conform_check( (in_means.internal_has_nonfinite()), "gmm_full::set_params(): given means have non-finite values" ); arma_conform_check( (in_fcovs.internal_has_nonfinite()), "gmm_full::set_params(): given fcovs have non-finite values" ); arma_conform_check( (in_hefts.internal_has_nonfinite()), "gmm_full::set_params(): given hefts have non-finite values" ); for(uword g=0; g < in_fcovs.n_slices; ++g) { arma_conform_check( (any(diagvec(in_fcovs.slice(g)) <= eT(0))), "gmm_full::set_params(): given fcovs have negative or zero values on diagonals" ); } arma_conform_check( (any(vectorise(in_hefts) < eT(0))), "gmm_full::set_params(): given hefts have negative values" ); const eT s = accu(in_hefts); arma_conform_check( ((s < (eT(1) - eT(0.001))) || (s > (eT(1) + eT(0.001)))), "gmm_full::set_params(): sum of given hefts is not 1" ); access::rw(means) = in_means; access::rw(fcovs) = in_fcovs; access::rw(hefts) = in_hefts; init_constants(); } template template inline void gmm_full::set_means(const Base& in_means_expr) { arma_debug_sigprint(); const unwrap tmp(in_means_expr.get_ref()); const Mat& in_means = tmp.M; arma_conform_check( (arma::size(in_means) != arma::size(means)), "gmm_full::set_means(): given means have incompatible size" ); arma_conform_check( (in_means.internal_has_nonfinite()), "gmm_full::set_means(): given means have non-finite values" ); access::rw(means) = in_means; } template template inline void gmm_full::set_fcovs(const BaseCube& in_fcovs_expr) { arma_debug_sigprint(); const unwrap_cube tmp(in_fcovs_expr.get_ref()); const Cube& in_fcovs = tmp.M; arma_conform_check( (arma::size(in_fcovs) != arma::size(fcovs)), "gmm_full::set_fcovs(): given fcovs have incompatible size" ); arma_conform_check( (in_fcovs.internal_has_nonfinite()), "gmm_full::set_fcovs(): given fcovs have non-finite values" ); for(uword i=0; i < in_fcovs.n_slices; ++i) { arma_conform_check( (any(diagvec(in_fcovs.slice(i)) <= eT(0))), "gmm_full::set_fcovs(): given fcovs have negative or zero values on diagonals" ); } access::rw(fcovs) = in_fcovs; init_constants(); } template template inline void gmm_full::set_hefts(const Base& in_hefts_expr) { arma_debug_sigprint(); const unwrap tmp(in_hefts_expr.get_ref()); const Mat& in_hefts = tmp.M; arma_conform_check( (arma::size(in_hefts) != arma::size(hefts)), "gmm_full::set_hefts(): given hefts have incompatible size" ); arma_conform_check( (in_hefts.internal_has_nonfinite()), "gmm_full::set_hefts(): given hefts have non-finite values" ); arma_conform_check( (any(vectorise(in_hefts) < eT(0))), "gmm_full::set_hefts(): given hefts have negative values" ); const eT s = accu(in_hefts); arma_conform_check( ((s < (eT(1) - eT(0.001))) || (s > (eT(1) + eT(0.001)))), "gmm_full::set_hefts(): sum of given hefts is not 1" ); // make sure all hefts are positive and non-zero const eT* in_hefts_mem = in_hefts.memptr(); eT* hefts_mem = access::rw(hefts).memptr(); for(uword i=0; i < hefts.n_elem; ++i) { hefts_mem[i] = (std::max)( in_hefts_mem[i], std::numeric_limits::min() ); } access::rw(hefts) /= accu(hefts); log_hefts = log(hefts); } template inline uword gmm_full::n_dims() const { return means.n_rows; } template inline uword gmm_full::n_gaus() const { return means.n_cols; } template inline bool gmm_full::load(const std::string name) { arma_debug_sigprint(); field< Mat > storage; bool status = storage.load(name, arma_binary); if( (status == false) || (storage.n_elem < 2) ) { reset(); arma_warn(3, "gmm_full::load(): problem with loading or incompatible format"); return false; } uword count = 0; const Mat& storage_means = storage(count); ++count; const Mat& storage_hefts = storage(count); ++count; const uword N_dims = storage_means.n_rows; const uword N_gaus = storage_means.n_cols; if( (storage.n_elem != (N_gaus + 2)) || (storage_hefts.n_rows != 1) || (storage_hefts.n_cols != N_gaus) ) { reset(); arma_warn(3, "gmm_full::load(): incompatible format"); return false; } reset(N_dims, N_gaus); access::rw(means) = storage_means; access::rw(hefts) = storage_hefts; for(uword g=0; g < N_gaus; ++g) { const Mat& storage_fcov = storage(count); ++count; if( (storage_fcov.n_rows != N_dims) || (storage_fcov.n_cols != N_dims) ) { reset(); arma_warn(3, "gmm_full::load(): incompatible format"); return false; } access::rw(fcovs).slice(g) = storage_fcov; } init_constants(); return true; } template inline bool gmm_full::save(const std::string name) const { arma_debug_sigprint(); const uword N_gaus = means.n_cols; field< Mat > storage(2 + N_gaus); uword count = 0; storage(count) = means; ++count; storage(count) = hefts; ++count; for(uword g=0; g < N_gaus; ++g) { storage(count) = fcovs.slice(g); ++count; } const bool status = storage.save(name, arma_binary); return status; } template inline Col gmm_full::generate() const { arma_debug_sigprint(); const uword N_dims = means.n_rows; const uword N_gaus = means.n_cols; Col out( (N_gaus > 0) ? N_dims : uword(0), arma_nozeros_indicator() ); Col tmp( (N_gaus > 0) ? N_dims : uword(0), fill::randn ); if(N_gaus > 0) { const double val = randu(); double csum = double(0); uword gaus_id = 0; for(uword j=0; j < N_gaus; ++j) { csum += hefts[j]; if(val <= csum) { gaus_id = j; break; } } out = chol_fcovs.slice(gaus_id) * tmp; out += means.col(gaus_id); } return out; } template inline Mat gmm_full::generate(const uword N_vec) const { arma_debug_sigprint(); const uword N_dims = means.n_rows; const uword N_gaus = means.n_cols; Mat out( ( (N_gaus > 0) ? N_dims : uword(0) ), N_vec, arma_nozeros_indicator() ); Mat tmp( ( (N_gaus > 0) ? N_dims : uword(0) ), N_vec, fill::randn ); if(N_gaus > 0) { const eT* hefts_mem = hefts.memptr(); for(uword i=0; i < N_vec; ++i) { const double val = randu(); double csum = double(0); uword gaus_id = 0; for(uword j=0; j < N_gaus; ++j) { csum += hefts_mem[j]; if(val <= csum) { gaus_id = j; break; } } Col out_vec(out.colptr(i), N_dims, false, true); Col tmp_vec(tmp.colptr(i), N_dims, false, true); out_vec = chol_fcovs.slice(gaus_id) * tmp_vec; out_vec += means.col(gaus_id); } } return out; } template template inline eT gmm_full::log_p(const T1& expr, const gmm_empty_arg& junk1, typename enable_if<((is_arma_type::value) && (resolves_to_colvector::value == true))>::result* junk2) const { arma_debug_sigprint(); arma_ignore(junk1); arma_ignore(junk2); const uword N_dims = means.n_rows; const quasi_unwrap U(expr); arma_conform_check( (U.M.n_rows != N_dims), "gmm_full::log_p(): incompatible dimensions" ); return internal_scalar_log_p( U.M.memptr() ); } template template inline eT gmm_full::log_p(const T1& expr, const uword gaus_id, typename enable_if<((is_arma_type::value) && (resolves_to_colvector::value == true))>::result* junk2) const { arma_debug_sigprint(); arma_ignore(junk2); const uword N_dims = means.n_rows; const quasi_unwrap U(expr); arma_conform_check( (U.M.n_rows != N_dims), "gmm_full::log_p(): incompatible dimensions" ); arma_conform_check( (gaus_id >= means.n_cols), "gmm_full::log_p(): specified gaussian is out of range" ); return internal_scalar_log_p( U.M.memptr(), gaus_id ); } template template inline Row gmm_full::log_p(const T1& expr, const gmm_empty_arg& junk1, typename enable_if<((is_arma_type::value) && (resolves_to_colvector::value == false))>::result* junk2) const { arma_debug_sigprint(); arma_ignore(junk1); arma_ignore(junk2); const quasi_unwrap tmp(expr); const Mat& X = tmp.M; return internal_vec_log_p(X); } template template inline Row gmm_full::log_p(const T1& expr, const uword gaus_id, typename enable_if<((is_arma_type::value) && (resolves_to_colvector::value == false))>::result* junk2) const { arma_debug_sigprint(); arma_ignore(junk2); const quasi_unwrap tmp(expr); const Mat& X = tmp.M; return internal_vec_log_p(X, gaus_id); } template template inline eT gmm_full::sum_log_p(const Base& expr) const { arma_debug_sigprint(); const quasi_unwrap tmp(expr.get_ref()); const Mat& X = tmp.M; return internal_sum_log_p(X); } template template inline eT gmm_full::sum_log_p(const Base& expr, const uword gaus_id) const { arma_debug_sigprint(); const quasi_unwrap tmp(expr.get_ref()); const Mat& X = tmp.M; return internal_sum_log_p(X, gaus_id); } template template inline eT gmm_full::avg_log_p(const Base& expr) const { arma_debug_sigprint(); const quasi_unwrap tmp(expr.get_ref()); const Mat& X = tmp.M; return internal_avg_log_p(X); } template template inline eT gmm_full::avg_log_p(const Base& expr, const uword gaus_id) const { arma_debug_sigprint(); const quasi_unwrap tmp(expr.get_ref()); const Mat& X = tmp.M; return internal_avg_log_p(X, gaus_id); } template template inline uword gmm_full::assign(const T1& expr, const gmm_dist_mode& dist, typename enable_if<((is_arma_type::value) && (resolves_to_colvector::value == true))>::result* junk) const { arma_debug_sigprint(); arma_ignore(junk); const quasi_unwrap tmp(expr); const Mat& X = tmp.M; return internal_scalar_assign(X, dist); } template template inline urowvec gmm_full::assign(const T1& expr, const gmm_dist_mode& dist, typename enable_if<((is_arma_type::value) && (resolves_to_colvector::value == false))>::result* junk) const { arma_debug_sigprint(); arma_ignore(junk); urowvec out; const quasi_unwrap tmp(expr); const Mat& X = tmp.M; internal_vec_assign(out, X, dist); return out; } template template inline urowvec gmm_full::raw_hist(const Base& expr, const gmm_dist_mode& dist_mode) const { arma_debug_sigprint(); const unwrap tmp(expr.get_ref()); const Mat& X = tmp.M; arma_conform_check( (X.n_rows != means.n_rows), "gmm_full::raw_hist(): incompatible dimensions" ); arma_conform_check( ((dist_mode != eucl_dist) && (dist_mode != prob_dist)), "gmm_full::raw_hist(): unsupported distance mode" ); urowvec hist; internal_raw_hist(hist, X, dist_mode); return hist; } template template inline Row gmm_full::norm_hist(const Base& expr, const gmm_dist_mode& dist_mode) const { arma_debug_sigprint(); const unwrap tmp(expr.get_ref()); const Mat& X = tmp.M; arma_conform_check( (X.n_rows != means.n_rows), "gmm_full::norm_hist(): incompatible dimensions" ); arma_conform_check( ((dist_mode != eucl_dist) && (dist_mode != prob_dist)), "gmm_full::norm_hist(): unsupported distance mode" ); urowvec hist; internal_raw_hist(hist, X, dist_mode); const uword hist_n_elem = hist.n_elem; const uword* hist_mem = hist.memptr(); eT acc = eT(0); for(uword i=0; i out(hist_n_elem, arma_nozeros_indicator()); eT* out_mem = out.memptr(); for(uword i=0; i template inline bool gmm_full::learn ( const Base& data, const uword N_gaus, const gmm_dist_mode& dist_mode, const gmm_seed_mode& seed_mode, const uword km_iter, const uword em_iter, const eT var_floor, const bool print_mode ) { arma_debug_sigprint(); const bool dist_mode_ok = (dist_mode == eucl_dist) || (dist_mode == maha_dist); const bool seed_mode_ok = \ (seed_mode == keep_existing) || (seed_mode == static_subset) || (seed_mode == static_spread) || (seed_mode == random_subset) || (seed_mode == random_spread); arma_conform_check( (dist_mode_ok == false), "gmm_full::learn(): dist_mode must be eucl_dist or maha_dist" ); arma_conform_check( (seed_mode_ok == false), "gmm_full::learn(): unknown seed_mode" ); arma_conform_check( (var_floor < eT(0) ), "gmm_full::learn(): variance floor is negative" ); const unwrap tmp_X(data.get_ref()); const Mat& X = tmp_X.M; if(X.is_empty() ) { arma_warn(3, "gmm_full::learn(): given matrix is empty" ); return false; } if(X.internal_has_nonfinite()) { arma_warn(3, "gmm_full::learn(): given matrix has non-finite values"); return false; } if(N_gaus == 0) { reset(); return true; } if(dist_mode == maha_dist) { mah_aux = var(X,1,1); const uword mah_aux_n_elem = mah_aux.n_elem; eT* mah_aux_mem = mah_aux.memptr(); for(uword i=0; i < mah_aux_n_elem; ++i) { const eT val = mah_aux_mem[i]; mah_aux_mem[i] = ((val != eT(0)) && arma_isfinite(val)) ? eT(1) / val : eT(1); } } // copy current model, in case of failure by k-means and/or EM const gmm_full orig = (*this); // initial means if(seed_mode == keep_existing) { if(means.is_empty() ) { arma_warn(3, "gmm_full::learn(): no existing means" ); return false; } if(X.n_rows != means.n_rows) { arma_warn(3, "gmm_full::learn(): dimensionality mismatch"); return false; } // TODO: also check for number of vectors? } else { if(X.n_cols < N_gaus) { arma_warn(3, "gmm_full::learn(): number of vectors is less than number of gaussians"); return false; } reset(X.n_rows, N_gaus); if(print_mode) { get_cout_stream() << "gmm_full::learn(): generating initial means\n"; get_cout_stream().flush(); } if(dist_mode == eucl_dist) { generate_initial_means<1>(X, seed_mode); } else if(dist_mode == maha_dist) { generate_initial_means<2>(X, seed_mode); } } // k-means if(km_iter > 0) { const arma_ostream_state stream_state(get_cout_stream()); bool status = false; if(dist_mode == eucl_dist) { status = km_iterate<1>(X, km_iter, print_mode); } else if(dist_mode == maha_dist) { status = km_iterate<2>(X, km_iter, print_mode); } stream_state.restore(get_cout_stream()); if(status == false) { arma_warn(3, "gmm_full::learn(): k-means algorithm failed; not enough data, or too many gaussians requested"); init(orig); return false; } } // initial fcovs const eT var_floor_actual = (eT(var_floor) > eT(0)) ? eT(var_floor) : std::numeric_limits::min(); if(seed_mode != keep_existing) { if(print_mode) { get_cout_stream() << "gmm_full::learn(): generating initial covariances\n"; get_cout_stream().flush(); } if(dist_mode == eucl_dist) { generate_initial_params<1>(X, var_floor_actual); } else if(dist_mode == maha_dist) { generate_initial_params<2>(X, var_floor_actual); } } // EM algorithm if(em_iter > 0) { const arma_ostream_state stream_state(get_cout_stream()); const bool status = em_iterate(X, em_iter, var_floor_actual, print_mode); stream_state.restore(get_cout_stream()); if(status == false) { arma_warn(3, "gmm_full::learn(): EM algorithm failed"); init(orig); return false; } } mah_aux.reset(); init_constants(); return true; } // // // template inline void gmm_full::init(const gmm_full& x) { arma_debug_sigprint(); gmm_full& t = *this; if(&t != &x) { access::rw(t.means) = x.means; access::rw(t.fcovs) = x.fcovs; access::rw(t.hefts) = x.hefts; init_constants(); } } template inline void gmm_full::init(const gmm_diag& x) { arma_debug_sigprint(); access::rw(hefts) = x.hefts; access::rw(means) = x.means; const uword N_dims = x.means.n_rows; const uword N_gaus = x.means.n_cols; access::rw(fcovs).zeros(N_dims,N_dims,N_gaus); for(uword g=0; g < N_gaus; ++g) { Mat& fcov = access::rw(fcovs).slice(g); const eT* dcov_mem = x.dcovs.colptr(g); for(uword d=0; d < N_dims; ++d) { fcov.at(d,d) = dcov_mem[d]; } } init_constants(); } template inline void gmm_full::init(const uword in_n_dims, const uword in_n_gaus) { arma_debug_sigprint(); access::rw(means).zeros(in_n_dims, in_n_gaus); access::rw(fcovs).zeros(in_n_dims, in_n_dims, in_n_gaus); for(uword g=0; g < in_n_gaus; ++g) { access::rw(fcovs).slice(g).diag().ones(); } access::rw(hefts).set_size(in_n_gaus); access::rw(hefts).fill(eT(1) / eT(in_n_gaus)); init_constants(); } template inline void gmm_full::init_constants(const bool calc_chol) { arma_debug_sigprint(); const uword N_dims = means.n_rows; const uword N_gaus = means.n_cols; const eT tmp = (eT(N_dims)/eT(2)) * std::log(Datum::tau); // inv_fcovs.copy_size(fcovs); log_det_etc.set_size(N_gaus); Mat tmp_inv; for(uword g=0; g < N_gaus; ++g) { const Mat& fcov = fcovs.slice(g); Mat& inv_fcov = inv_fcovs.slice(g); //const bool inv_ok = auxlib::inv(tmp_inv, fcov); const bool inv_ok = auxlib::inv_sympd(tmp_inv, fcov); // using inv_sympd() instead of inv() to ensure we can do cholesky decomp via op_chol eT log_det_val = eT(0); eT log_det_sign = eT(0); const bool log_det_status = log_det(log_det_val, log_det_sign, fcov); const bool log_det_ok = ( log_det_status && (arma_isfinite(log_det_val)) && (log_det_sign > eT(0)) ); if(inv_ok && log_det_ok) { inv_fcov = tmp_inv; } else { // last resort: treat the covariance matrix as diagonal inv_fcov.zeros(); log_det_val = eT(0); for(uword d=0; d < N_dims; ++d) { const eT sanitised_val = (std::max)( eT(fcov.at(d,d)), eT(std::numeric_limits::min()) ); inv_fcov.at(d,d) = eT(1) / sanitised_val; log_det_val += std::log(sanitised_val); } } log_det_etc[g] = eT(-1) * ( tmp + eT(0.5) * log_det_val ); } // eT* hefts_mem = access::rw(hefts).memptr(); for(uword g=0; g < N_gaus; ++g) { hefts_mem[g] = (std::max)( hefts_mem[g], std::numeric_limits::min() ); } log_hefts = log(hefts); if(calc_chol) { chol_fcovs.copy_size(fcovs); Mat tmp_chol; for(uword g=0; g < N_gaus; ++g) { const Mat& fcov = fcovs.slice(g); Mat& chol_fcov = chol_fcovs.slice(g); const uword chol_layout = 1; // indicates "lower" const bool chol_ok = op_chol::apply_direct(tmp_chol, fcov, chol_layout); if(chol_ok) { chol_fcov = tmp_chol; } else { // last resort: treat the covariance matrix as diagonal chol_fcov.zeros(); for(uword d=0; d < N_dims; ++d) { const eT sanitised_val = (std::max)( eT(fcov.at(d,d)), eT(std::numeric_limits::min()) ); chol_fcov.at(d,d) = std::sqrt(sanitised_val); } } } } } template inline umat gmm_full::internal_gen_boundaries(const uword N) const { arma_debug_sigprint(); #if defined(ARMA_USE_OPENMP) const uword n_threads_avail = uword(omp_get_max_threads()); const uword n_threads = (n_threads_avail > 0) ? ( (n_threads_avail <= N) ? n_threads_avail : 1 ) : 1; #else static constexpr uword n_threads = 1; #endif // get_cout_stream() << "gmm_full::internal_gen_boundaries(): n_threads: " << n_threads << '\n'; umat boundaries(2, n_threads, arma_nozeros_indicator()); if(N > 0) { const uword chunk_size = N / n_threads; uword count = 0; for(uword t=0; t inline eT gmm_full::internal_scalar_log_p(const eT* x) const { arma_debug_sigprint(); const eT* log_hefts_mem = log_hefts.mem; const uword N_gaus = means.n_cols; if(N_gaus > 0) { eT log_sum = internal_scalar_log_p(x, 0) + log_hefts_mem[0]; for(uword g=1; g < N_gaus; ++g) { const eT log_val = internal_scalar_log_p(x, g) + log_hefts_mem[g]; log_sum = priv::internal_log_add_exp(log_sum, log_val); } return log_sum; } else { return -Datum::inf; } } template inline eT gmm_full::internal_scalar_log_p(const eT* x, const uword g) const { arma_debug_sigprint(); const uword N_dims = means.n_rows; const eT* mean_mem = means.colptr(g); eT outer_acc = eT(0); const eT* inv_fcov_coldata = inv_fcovs.slice(g).memptr(); for(uword i=0; i < N_dims; ++i) { eT inner_acc = eT(0); for(uword j=0; j < N_dims; ++j) { inner_acc += (x[j] - mean_mem[j]) * inv_fcov_coldata[j]; } inv_fcov_coldata += N_dims; outer_acc += inner_acc * (x[i] - mean_mem[i]); } return eT(-0.5)*outer_acc + log_det_etc.mem[g]; } template inline Row gmm_full::internal_vec_log_p(const Mat& X) const { arma_debug_sigprint(); const uword N_dims = means.n_rows; const uword N_samples = X.n_cols; arma_conform_check( (X.n_rows != N_dims), "gmm_full::log_p(): incompatible dimensions" ); Row out(N_samples, arma_nozeros_indicator()); if(N_samples > 0) { #if defined(ARMA_USE_OPENMP) { const umat boundaries = internal_gen_boundaries(N_samples); const uword n_threads = boundaries.n_cols; #pragma omp parallel for schedule(static) for(uword t=0; t < n_threads; ++t) { const uword start_index = boundaries.at(0,t); const uword end_index = boundaries.at(1,t); eT* out_mem = out.memptr(); for(uword i=start_index; i <= end_index; ++i) { out_mem[i] = internal_scalar_log_p( X.colptr(i) ); } } } #else { eT* out_mem = out.memptr(); for(uword i=0; i < N_samples; ++i) { out_mem[i] = internal_scalar_log_p( X.colptr(i) ); } } #endif } return out; } template inline Row gmm_full::internal_vec_log_p(const Mat& X, const uword gaus_id) const { arma_debug_sigprint(); const uword N_dims = means.n_rows; const uword N_samples = X.n_cols; arma_conform_check( (X.n_rows != N_dims), "gmm_full::log_p(): incompatible dimensions" ); arma_conform_check( (gaus_id >= means.n_cols), "gmm_full::log_p(): specified gaussian is out of range" ); Row out(N_samples, arma_nozeros_indicator()); if(N_samples > 0) { #if defined(ARMA_USE_OPENMP) { const umat boundaries = internal_gen_boundaries(N_samples); const uword n_threads = boundaries.n_cols; #pragma omp parallel for schedule(static) for(uword t=0; t < n_threads; ++t) { const uword start_index = boundaries.at(0,t); const uword end_index = boundaries.at(1,t); eT* out_mem = out.memptr(); for(uword i=start_index; i <= end_index; ++i) { out_mem[i] = internal_scalar_log_p( X.colptr(i), gaus_id ); } } } #else { eT* out_mem = out.memptr(); for(uword i=0; i < N_samples; ++i) { out_mem[i] = internal_scalar_log_p( X.colptr(i), gaus_id ); } } #endif } return out; } template inline eT gmm_full::internal_sum_log_p(const Mat& X) const { arma_debug_sigprint(); arma_conform_check( (X.n_rows != means.n_rows), "gmm_full::sum_log_p(): incompatible dimensions" ); const uword N = X.n_cols; if(N == 0) { return (-Datum::inf); } #if defined(ARMA_USE_OPENMP) { const umat boundaries = internal_gen_boundaries(N); const uword n_threads = boundaries.n_cols; Col t_accs(n_threads, arma_zeros_indicator()); #pragma omp parallel for schedule(static) for(uword t=0; t < n_threads; ++t) { const uword start_index = boundaries.at(0,t); const uword end_index = boundaries.at(1,t); eT t_acc = eT(0); for(uword i=start_index; i <= end_index; ++i) { t_acc += internal_scalar_log_p( X.colptr(i) ); } t_accs[t] = t_acc; } return eT(accu(t_accs)); } #else { eT acc = eT(0); for(uword i=0; i inline eT gmm_full::internal_sum_log_p(const Mat& X, const uword gaus_id) const { arma_debug_sigprint(); arma_conform_check( (X.n_rows != means.n_rows), "gmm_full::sum_log_p(): incompatible dimensions" ); arma_conform_check( (gaus_id >= means.n_cols), "gmm_full::sum_log_p(): specified gaussian is out of range" ); const uword N = X.n_cols; if(N == 0) { return (-Datum::inf); } #if defined(ARMA_USE_OPENMP) { const umat boundaries = internal_gen_boundaries(N); const uword n_threads = boundaries.n_cols; Col t_accs(n_threads, arma_zeros_indicator()); #pragma omp parallel for schedule(static) for(uword t=0; t < n_threads; ++t) { const uword start_index = boundaries.at(0,t); const uword end_index = boundaries.at(1,t); eT t_acc = eT(0); for(uword i=start_index; i <= end_index; ++i) { t_acc += internal_scalar_log_p( X.colptr(i), gaus_id ); } t_accs[t] = t_acc; } return eT(accu(t_accs)); } #else { eT acc = eT(0); for(uword i=0; i inline eT gmm_full::internal_avg_log_p(const Mat& X) const { arma_debug_sigprint(); const uword N_dims = means.n_rows; const uword N_samples = X.n_cols; arma_conform_check( (X.n_rows != N_dims), "gmm_full::avg_log_p(): incompatible dimensions" ); if(N_samples == 0) { return (-Datum::inf); } #if defined(ARMA_USE_OPENMP) { const umat boundaries = internal_gen_boundaries(N_samples); const uword n_threads = boundaries.n_cols; field< running_mean_scalar > t_running_means(n_threads); #pragma omp parallel for schedule(static) for(uword t=0; t < n_threads; ++t) { const uword start_index = boundaries.at(0,t); const uword end_index = boundaries.at(1,t); running_mean_scalar& current_running_mean = t_running_means[t]; for(uword i=start_index; i <= end_index; ++i) { current_running_mean( internal_scalar_log_p( X.colptr(i) ) ); } } eT avg = eT(0); for(uword t=0; t < n_threads; ++t) { running_mean_scalar& current_running_mean = t_running_means[t]; const eT w = eT(current_running_mean.count()) / eT(N_samples); avg += w * current_running_mean.mean(); } return avg; } #else { running_mean_scalar running_mean; for(uword i=0; i < N_samples; ++i) { running_mean( internal_scalar_log_p( X.colptr(i) ) ); } return running_mean.mean(); } #endif } template inline eT gmm_full::internal_avg_log_p(const Mat& X, const uword gaus_id) const { arma_debug_sigprint(); const uword N_dims = means.n_rows; const uword N_samples = X.n_cols; arma_conform_check( (X.n_rows != N_dims), "gmm_full::avg_log_p(): incompatible dimensions" ); arma_conform_check( (gaus_id >= means.n_cols), "gmm_full::avg_log_p(): specified gaussian is out of range" ); if(N_samples == 0) { return (-Datum::inf); } #if defined(ARMA_USE_OPENMP) { const umat boundaries = internal_gen_boundaries(N_samples); const uword n_threads = boundaries.n_cols; field< running_mean_scalar > t_running_means(n_threads); #pragma omp parallel for schedule(static) for(uword t=0; t < n_threads; ++t) { const uword start_index = boundaries.at(0,t); const uword end_index = boundaries.at(1,t); running_mean_scalar& current_running_mean = t_running_means[t]; for(uword i=start_index; i <= end_index; ++i) { current_running_mean( internal_scalar_log_p( X.colptr(i), gaus_id) ); } } eT avg = eT(0); for(uword t=0; t < n_threads; ++t) { running_mean_scalar& current_running_mean = t_running_means[t]; const eT w = eT(current_running_mean.count()) / eT(N_samples); avg += w * current_running_mean.mean(); } return avg; } #else { running_mean_scalar running_mean; for(uword i=0; i inline uword gmm_full::internal_scalar_assign(const Mat& X, const gmm_dist_mode& dist_mode) const { arma_debug_sigprint(); const uword N_dims = means.n_rows; const uword N_gaus = means.n_cols; arma_conform_check( (X.n_rows != N_dims), "gmm_full::assign(): incompatible dimensions" ); arma_conform_check( (N_gaus == 0), "gmm_full::assign(): model has no means" ); const eT* X_mem = X.colptr(0); if(dist_mode == eucl_dist) { eT best_dist = Datum::inf; uword best_g = 0; for(uword g=0; g < N_gaus; ++g) { const eT tmp_dist = distance::eval(N_dims, X_mem, means.colptr(g), X_mem); if(tmp_dist <= best_dist) { best_dist = tmp_dist; best_g = g; } } return best_g; } else if(dist_mode == prob_dist) { const eT* log_hefts_mem = log_hefts.memptr(); eT best_p = -Datum::inf; uword best_g = 0; for(uword g=0; g < N_gaus; ++g) { const eT tmp_p = internal_scalar_log_p(X_mem, g) + log_hefts_mem[g]; if(tmp_p >= best_p) { best_p = tmp_p; best_g = g; } } return best_g; } else { arma_conform_check(true, "gmm_full::assign(): unsupported distance mode"); } return uword(0); } template inline void gmm_full::internal_vec_assign(urowvec& out, const Mat& X, const gmm_dist_mode& dist_mode) const { arma_debug_sigprint(); const uword N_dims = means.n_rows; const uword N_gaus = means.n_cols; arma_conform_check( (X.n_rows != N_dims), "gmm_full::assign(): incompatible dimensions" ); const uword X_n_cols = (N_gaus > 0) ? X.n_cols : 0; out.set_size(1,X_n_cols); uword* out_mem = out.memptr(); if(dist_mode == eucl_dist) { #if defined(ARMA_USE_OPENMP) { #pragma omp parallel for schedule(static) for(uword i=0; i::inf; uword best_g = 0; for(uword g=0; g::eval(N_dims, X_colptr, means.colptr(g), X_colptr); if(tmp_dist <= best_dist) { best_dist = tmp_dist; best_g = g; } } out_mem[i] = best_g; } } #else { for(uword i=0; i::inf; uword best_g = 0; for(uword g=0; g::eval(N_dims, X_colptr, means.colptr(g), X_colptr); if(tmp_dist <= best_dist) { best_dist = tmp_dist; best_g = g; } } out_mem[i] = best_g; } } #endif } else if(dist_mode == prob_dist) { #if defined(ARMA_USE_OPENMP) { const umat boundaries = internal_gen_boundaries(X_n_cols); const uword n_threads = boundaries.n_cols; const eT* log_hefts_mem = log_hefts.memptr(); #pragma omp parallel for schedule(static) for(uword t=0; t < n_threads; ++t) { const uword start_index = boundaries.at(0,t); const uword end_index = boundaries.at(1,t); for(uword i=start_index; i <= end_index; ++i) { const eT* X_colptr = X.colptr(i); eT best_p = -Datum::inf; uword best_g = 0; for(uword g=0; g= best_p) { best_p = tmp_p; best_g = g; } } out_mem[i] = best_g; } } } #else { const eT* log_hefts_mem = log_hefts.memptr(); for(uword i=0; i::inf; uword best_g = 0; for(uword g=0; g= best_p) { best_p = tmp_p; best_g = g; } } out_mem[i] = best_g; } } #endif } else { arma_conform_check(true, "gmm_full::assign(): unsupported distance mode"); } } template inline void gmm_full::internal_raw_hist(urowvec& hist, const Mat& X, const gmm_dist_mode& dist_mode) const { arma_debug_sigprint(); const uword N_dims = means.n_rows; const uword N_gaus = means.n_cols; const uword X_n_cols = X.n_cols; hist.zeros(N_gaus); if(N_gaus == 0) { return; } #if defined(ARMA_USE_OPENMP) { const umat boundaries = internal_gen_boundaries(X_n_cols); const uword n_threads = boundaries.n_cols; field thread_hist(n_threads); for(uword t=0; t < n_threads; ++t) { thread_hist(t).zeros(N_gaus); } if(dist_mode == eucl_dist) { #pragma omp parallel for schedule(static) for(uword t=0; t < n_threads; ++t) { uword* thread_hist_mem = thread_hist(t).memptr(); const uword start_index = boundaries.at(0,t); const uword end_index = boundaries.at(1,t); for(uword i=start_index; i <= end_index; ++i) { const eT* X_colptr = X.colptr(i); eT best_dist = Datum::inf; uword best_g = 0; for(uword g=0; g < N_gaus; ++g) { const eT tmp_dist = distance::eval(N_dims, X_colptr, means.colptr(g), X_colptr); if(tmp_dist <= best_dist) { best_dist = tmp_dist; best_g = g; } } thread_hist_mem[best_g]++; } } } else if(dist_mode == prob_dist) { const eT* log_hefts_mem = log_hefts.memptr(); #pragma omp parallel for schedule(static) for(uword t=0; t < n_threads; ++t) { uword* thread_hist_mem = thread_hist(t).memptr(); const uword start_index = boundaries.at(0,t); const uword end_index = boundaries.at(1,t); for(uword i=start_index; i <= end_index; ++i) { const eT* X_colptr = X.colptr(i); eT best_p = -Datum::inf; uword best_g = 0; for(uword g=0; g < N_gaus; ++g) { const eT tmp_p = internal_scalar_log_p(X_colptr, g) + log_hefts_mem[g]; if(tmp_p >= best_p) { best_p = tmp_p; best_g = g; } } thread_hist_mem[best_g]++; } } } // reduction for(uword t=0; t < n_threads; ++t) { hist += thread_hist(t); } } #else { uword* hist_mem = hist.memptr(); if(dist_mode == eucl_dist) { for(uword i=0; i::inf; uword best_g = 0; for(uword g=0; g < N_gaus; ++g) { const eT tmp_dist = distance::eval(N_dims, X_colptr, means.colptr(g), X_colptr); if(tmp_dist <= best_dist) { best_dist = tmp_dist; best_g = g; } } hist_mem[best_g]++; } } else if(dist_mode == prob_dist) { const eT* log_hefts_mem = log_hefts.memptr(); for(uword i=0; i::inf; uword best_g = 0; for(uword g=0; g < N_gaus; ++g) { const eT tmp_p = internal_scalar_log_p(X_colptr, g) + log_hefts_mem[g]; if(tmp_p >= best_p) { best_p = tmp_p; best_g = g; } } hist_mem[best_g]++; } } } #endif } template template inline void gmm_full::generate_initial_means(const Mat& X, const gmm_seed_mode& seed_mode) { arma_debug_sigprint(); const uword N_dims = means.n_rows; const uword N_gaus = means.n_cols; if( (seed_mode == static_subset) || (seed_mode == random_subset) ) { uvec initial_indices; if(seed_mode == static_subset) { initial_indices = linspace(0, X.n_cols-1, N_gaus); } else if(seed_mode == random_subset) { initial_indices = randperm(X.n_cols, N_gaus); } // initial_indices.print("initial_indices:"); access::rw(means) = X.cols(initial_indices); } else if( (seed_mode == static_spread) || (seed_mode == random_spread) ) { // going through all of the samples can be extremely time consuming; // instead, if there are enough samples, randomly choose samples with probability 0.1 const bool use_sampling = ((X.n_cols/uword(100)) > N_gaus); const uword step = (use_sampling) ? uword(10) : uword(1); uword start_index = 0; if(seed_mode == static_spread) { start_index = X.n_cols / 2; } else if(seed_mode == random_spread) { start_index = as_scalar(randi(1, distr_param(0,X.n_cols-1))); } access::rw(means).col(0) = X.unsafe_col(start_index); const eT* mah_aux_mem = mah_aux.memptr(); running_stat rs; for(uword g=1; g < N_gaus; ++g) { eT max_dist = eT(0); uword best_i = uword(0); uword start_i = uword(0); if(use_sampling) { uword start_i_proposed = uword(0); if(seed_mode == static_spread) { start_i_proposed = g % uword(10); } if(seed_mode == random_spread) { start_i_proposed = as_scalar(randi(1, distr_param(0,9))); } if(start_i_proposed < X.n_cols) { start_i = start_i_proposed; } } for(uword i=start_i; i < X.n_cols; i += step) { rs.reset(); const eT* X_colptr = X.colptr(i); bool ignore_i = false; // find the average distance between sample i and the means so far for(uword h = 0; h < g; ++h) { const eT dist = distance::eval(N_dims, X_colptr, means.colptr(h), mah_aux_mem); // ignore sample already selected as a mean if(dist == eT(0)) { ignore_i = true; break; } else { rs(dist); } } if( (rs.mean() >= max_dist) && (ignore_i == false)) { max_dist = eT(rs.mean()); best_i = i; } } // set the mean to the sample that is the furthest away from the means so far access::rw(means).col(g) = X.unsafe_col(best_i); } } // get_cout_stream() << "generate_initial_means():" << '\n'; // means.print(); } template template inline void gmm_full::generate_initial_params(const Mat& X, const eT var_floor) { arma_debug_sigprint(); const uword N_dims = means.n_rows; const uword N_gaus = means.n_cols; const eT* mah_aux_mem = mah_aux.memptr(); const uword X_n_cols = X.n_cols; if(X_n_cols == 0) { return; } // as the covariances are calculated via accumulators, // the means also need to be calculated via accumulators to ensure numerical consistency Mat acc_means(N_dims, N_gaus); Mat acc_dcovs(N_dims, N_gaus); Row acc_hefts(N_gaus, arma_zeros_indicator()); uword* acc_hefts_mem = acc_hefts.memptr(); #if defined(ARMA_USE_OPENMP) { const umat boundaries = internal_gen_boundaries(X_n_cols); const uword n_threads = boundaries.n_cols; field< Mat > t_acc_means(n_threads); field< Mat > t_acc_dcovs(n_threads); field< Row > t_acc_hefts(n_threads); for(uword t=0; t < n_threads; ++t) { t_acc_means(t).zeros(N_dims, N_gaus); t_acc_dcovs(t).zeros(N_dims, N_gaus); t_acc_hefts(t).zeros(N_gaus); } #pragma omp parallel for schedule(static) for(uword t=0; t < n_threads; ++t) { uword* t_acc_hefts_mem = t_acc_hefts(t).memptr(); const uword start_index = boundaries.at(0,t); const uword end_index = boundaries.at(1,t); for(uword i=start_index; i <= end_index; ++i) { const eT* X_colptr = X.colptr(i); eT min_dist = Datum::inf; uword best_g = 0; for(uword g=0; g::eval(N_dims, X_colptr, means.colptr(g), mah_aux_mem); if(dist < min_dist) { min_dist = dist; best_g = g; } } eT* t_acc_mean = t_acc_means(t).colptr(best_g); eT* t_acc_dcov = t_acc_dcovs(t).colptr(best_g); for(uword d=0; d::inf; uword best_g = 0; for(uword g=0; g::eval(N_dims, X_colptr, means.colptr(g), mah_aux_mem); if(dist < min_dist) { min_dist = dist; best_g = g; } } eT* acc_mean = acc_means.colptr(best_g); eT* acc_dcov = acc_dcovs.colptr(best_g); for(uword d=0; d& fcov = access::rw(fcovs).slice(g); fcov.zeros(); for(uword d=0; d= 1) ? tmp : eT(0); fcov.at(d,d) = (acc_heft >= 2) ? eT((acc_dcov[d] / eT(acc_heft)) - (tmp*tmp)) : eT(var_floor); } hefts_mem[g] = eT(acc_heft) / eT(X_n_cols); } em_fix_params(var_floor); } //! multi-threaded implementation of k-means, inspired by MapReduce template template inline bool gmm_full::km_iterate(const Mat& X, const uword max_iter, const bool verbose) { arma_debug_sigprint(); if(verbose) { get_cout_stream().unsetf(ios::showbase); get_cout_stream().unsetf(ios::uppercase); get_cout_stream().unsetf(ios::showpos); get_cout_stream().unsetf(ios::scientific); get_cout_stream().setf(ios::right); get_cout_stream().setf(ios::fixed); } const uword X_n_cols = X.n_cols; if(X_n_cols == 0) { return true; } const uword N_dims = means.n_rows; const uword N_gaus = means.n_cols; const eT* mah_aux_mem = mah_aux.memptr(); Mat acc_means(N_dims, N_gaus, arma_zeros_indicator()); Row acc_hefts( N_gaus, arma_zeros_indicator()); Row last_indx( N_gaus, arma_zeros_indicator()); Mat new_means = means; Mat old_means = means; running_mean_scalar rs_delta; #if defined(ARMA_USE_OPENMP) const umat boundaries = internal_gen_boundaries(X_n_cols); const uword n_threads = boundaries.n_cols; field< Mat > t_acc_means(n_threads); field< Row > t_acc_hefts(n_threads); field< Row > t_last_indx(n_threads); #else const uword n_threads = 1; #endif if(verbose) { get_cout_stream() << "gmm_full::learn(): k-means: n_threads: " << n_threads << '\n'; get_cout_stream().flush(); } for(uword iter=1; iter <= max_iter; ++iter) { #if defined(ARMA_USE_OPENMP) { for(uword t=0; t < n_threads; ++t) { t_acc_means(t).zeros(N_dims, N_gaus); t_acc_hefts(t).zeros(N_gaus); t_last_indx(t).zeros(N_gaus); } #pragma omp parallel for schedule(static) for(uword t=0; t < n_threads; ++t) { Mat& t_acc_means_t = t_acc_means(t); uword* t_acc_hefts_mem = t_acc_hefts(t).memptr(); uword* t_last_indx_mem = t_last_indx(t).memptr(); const uword start_index = boundaries.at(0,t); const uword end_index = boundaries.at(1,t); for(uword i=start_index; i <= end_index; ++i) { const eT* X_colptr = X.colptr(i); eT min_dist = Datum::inf; uword best_g = 0; for(uword g=0; g::eval(N_dims, X_colptr, old_means.colptr(g), mah_aux_mem); if(dist < min_dist) { min_dist = dist; best_g = g; } } eT* t_acc_mean = t_acc_means_t.colptr(best_g); for(uword d=0; d= 1 ) { last_indx(g) = t_last_indx(t)(g); } } } #else { acc_hefts.zeros(); acc_means.zeros(); last_indx.zeros(); uword* acc_hefts_mem = acc_hefts.memptr(); uword* last_indx_mem = last_indx.memptr(); for(uword i=0; i < X_n_cols; ++i) { const eT* X_colptr = X.colptr(i); eT min_dist = Datum::inf; uword best_g = 0; for(uword g=0; g::eval(N_dims, X_colptr, old_means.colptr(g), mah_aux_mem); if(dist < min_dist) { min_dist = dist; best_g = g; } } eT* acc_mean = acc_means.colptr(best_g); for(uword d=0; d= 1) ? (acc_mean[d] / eT(acc_heft)) : eT(0); } } // heuristics to resurrect dead means const uvec dead_gs = find(acc_hefts == uword(0)); if(dead_gs.n_elem > 0) { if(verbose) { get_cout_stream() << "gmm_full::learn(): k-means: recovering from dead means\n"; get_cout_stream().flush(); } uword* last_indx_mem = last_indx.memptr(); const uvec live_gs = sort( find(acc_hefts >= uword(2)), "descend" ); if(live_gs.n_elem == 0) { return false; } uword live_gs_count = 0; for(uword dead_gs_count = 0; dead_gs_count < dead_gs.n_elem; ++dead_gs_count) { const uword dead_g_id = dead_gs(dead_gs_count); uword proposed_i = 0; if(live_gs_count < live_gs.n_elem) { const uword live_g_id = live_gs(live_gs_count); ++live_gs_count; if(live_g_id == dead_g_id) { return false; } // recover by using a sample from a known good mean proposed_i = last_indx_mem[live_g_id]; } else { // recover by using a randomly selected sample (last resort) proposed_i = as_scalar(randi(1, distr_param(0,X_n_cols-1))); } if(proposed_i >= X_n_cols) { return false; } new_means.col(dead_g_id) = X.col(proposed_i); } } rs_delta.reset(); for(uword g=0; g < N_gaus; ++g) { rs_delta( distance::eval(N_dims, old_means.colptr(g), new_means.colptr(g), mah_aux_mem) ); } if(verbose) { get_cout_stream() << "gmm_full::learn(): k-means: iteration: "; get_cout_stream().unsetf(ios::scientific); get_cout_stream().setf(ios::fixed); get_cout_stream().width(std::streamsize(4)); get_cout_stream() << iter; get_cout_stream() << " delta: "; get_cout_stream().unsetf(ios::fixed); //get_cout_stream().setf(ios::scientific); get_cout_stream() << rs_delta.mean() << '\n'; get_cout_stream().flush(); } arma::swap(old_means, new_means); if(rs_delta.mean() <= Datum::eps) { break; } } access::rw(means) = old_means; if(means.internal_has_nonfinite()) { return false; } return true; } //! multi-threaded implementation of Expectation-Maximisation, inspired by MapReduce template inline bool gmm_full::em_iterate(const Mat& X, const uword max_iter, const eT var_floor, const bool verbose) { arma_debug_sigprint(); const uword N_dims = means.n_rows; const uword N_gaus = means.n_cols; if(verbose) { get_cout_stream().unsetf(ios::showbase); get_cout_stream().unsetf(ios::uppercase); get_cout_stream().unsetf(ios::showpos); get_cout_stream().unsetf(ios::scientific); get_cout_stream().setf(ios::right); get_cout_stream().setf(ios::fixed); } const umat boundaries = internal_gen_boundaries(X.n_cols); const uword n_threads = boundaries.n_cols; field< Mat > t_acc_means(n_threads); field< Cube > t_acc_fcovs(n_threads); field< Col > t_acc_norm_lhoods(n_threads); field< Col > t_gaus_log_lhoods(n_threads); Col t_progress_log_lhood(n_threads, arma_nozeros_indicator()); for(uword t=0; t::inf; const bool calc_chol = false; for(uword iter=1; iter <= max_iter; ++iter) { init_constants(calc_chol); em_update_params(X, boundaries, t_acc_means, t_acc_fcovs, t_acc_norm_lhoods, t_gaus_log_lhoods, t_progress_log_lhood, var_floor); em_fix_params(var_floor); const eT new_avg_log_p = accu(t_progress_log_lhood) / eT(t_progress_log_lhood.n_elem); if(verbose) { get_cout_stream() << "gmm_full::learn(): EM: iteration: "; get_cout_stream().unsetf(ios::scientific); get_cout_stream().setf(ios::fixed); get_cout_stream().width(std::streamsize(4)); get_cout_stream() << iter; get_cout_stream() << " avg_log_p: "; get_cout_stream().unsetf(ios::fixed); //get_cout_stream().setf(ios::scientific); get_cout_stream() << new_avg_log_p << '\n'; get_cout_stream().flush(); } if(arma_isnonfinite(new_avg_log_p)) { return false; } if(std::abs(old_avg_log_p - new_avg_log_p) <= Datum::eps) { break; } old_avg_log_p = new_avg_log_p; } for(uword g=0; g < N_gaus; ++g) { const Mat& fcov = fcovs.slice(g); if(any(vectorise(fcov.diag()) <= eT(0))) { return false; } } if(means.internal_has_nonfinite()) { return false; } if(fcovs.internal_has_nonfinite()) { return false; } if(hefts.internal_has_nonfinite()) { return false; } return true; } template inline void gmm_full::em_update_params ( const Mat& X, const umat& boundaries, field< Mat >& t_acc_means, field< Cube >& t_acc_fcovs, field< Col >& t_acc_norm_lhoods, field< Col >& t_gaus_log_lhoods, Col& t_progress_log_lhood, const eT var_floor ) { arma_debug_sigprint(); const uword n_threads = boundaries.n_cols; // em_generate_acc() is the "map" operation, which produces partial accumulators for means, diagonal covariances and hefts #if defined(ARMA_USE_OPENMP) { #pragma omp parallel for schedule(static) for(uword t=0; t& acc_means = t_acc_means[t]; Cube& acc_fcovs = t_acc_fcovs[t]; Col& acc_norm_lhoods = t_acc_norm_lhoods[t]; Col& gaus_log_lhoods = t_gaus_log_lhoods[t]; eT& progress_log_lhood = t_progress_log_lhood[t]; em_generate_acc(X, boundaries.at(0,t), boundaries.at(1,t), acc_means, acc_fcovs, acc_norm_lhoods, gaus_log_lhoods, progress_log_lhood); } } #else { em_generate_acc(X, boundaries.at(0,0), boundaries.at(1,0), t_acc_means[0], t_acc_fcovs[0], t_acc_norm_lhoods[0], t_gaus_log_lhoods[0], t_progress_log_lhood[0]); } #endif const uword N_dims = means.n_rows; const uword N_gaus = means.n_cols; Mat& final_acc_means = t_acc_means[0]; Cube& final_acc_fcovs = t_acc_fcovs[0]; Col& final_acc_norm_lhoods = t_acc_norm_lhoods[0]; // the "reduce" operation, which combines the partial accumulators produced by the separate threads for(uword t=1; t mean_outer(N_dims, N_dims, arma_nozeros_indicator()); //// update each component without sanity checking //for(uword g=0; g < N_gaus; ++g) // { // const eT acc_norm_lhood = (std::max)( final_acc_norm_lhoods[g], std::numeric_limits::min() ); // // hefts_mem[g] = acc_norm_lhood / eT(X.n_cols); // // eT* mean_mem = access::rw(means).colptr(g); // eT* acc_mean_mem = final_acc_means.colptr(g); // // for(uword d=0; d < N_dims; ++d) // { // mean_mem[d] = acc_mean_mem[d] / acc_norm_lhood; // } // // const Col mean(mean_mem, N_dims, false, true); // // mean_outer = mean * mean.t(); // // Mat& fcov = access::rw(fcovs).slice(g); // Mat& acc_fcov = final_acc_fcovs.slice(g); // // fcov = acc_fcov / acc_norm_lhood - mean_outer; // } // conditionally update each component; if only a subset of the hefts was updated, em_fix_params() will sanitise them for(uword g=0; g < N_gaus; ++g) { const eT acc_norm_lhood = (std::max)( final_acc_norm_lhoods[g], std::numeric_limits::min() ); if(arma_isnonfinite(acc_norm_lhood)) { continue; } eT* acc_mean_mem = final_acc_means.colptr(g); for(uword d=0; d < N_dims; ++d) { acc_mean_mem[d] /= acc_norm_lhood; } const Col new_mean(acc_mean_mem, N_dims, false, true); mean_outer = new_mean * new_mean.t(); Mat& acc_fcov = final_acc_fcovs.slice(g); acc_fcov /= acc_norm_lhood; acc_fcov -= mean_outer; for(uword d=0; d < N_dims; ++d) { eT& val = acc_fcov.at(d,d); if(val < var_floor) { val = var_floor; } } if(acc_fcov.internal_has_nonfinite()) { continue; } eT log_det_val = eT(0); eT log_det_sign = eT(0); const bool log_det_status = log_det(log_det_val, log_det_sign, acc_fcov); const bool log_det_ok = ( log_det_status && (arma_isfinite(log_det_val)) && (log_det_sign > eT(0)) ); const bool inv_ok = (log_det_ok) ? bool(auxlib::inv_sympd(mean_outer, acc_fcov)) : bool(false); // mean_outer is used as a junk matrix if(log_det_ok && inv_ok) { hefts_mem[g] = acc_norm_lhood / eT(X.n_cols); eT* mean_mem = access::rw(means).colptr(g); for(uword d=0; d < N_dims; ++d) { mean_mem[d] = acc_mean_mem[d]; } Mat& fcov = access::rw(fcovs).slice(g); fcov = acc_fcov; } } } template inline void gmm_full::em_generate_acc ( const Mat& X, const uword start_index, const uword end_index, Mat& acc_means, Cube& acc_fcovs, Col& acc_norm_lhoods, Col& gaus_log_lhoods, eT& progress_log_lhood ) const { arma_debug_sigprint(); progress_log_lhood = eT(0); acc_means.zeros(); acc_fcovs.zeros(); acc_norm_lhoods.zeros(); gaus_log_lhoods.zeros(); const uword N_dims = means.n_rows; const uword N_gaus = means.n_cols; const eT* log_hefts_mem = log_hefts.memptr(); eT* gaus_log_lhoods_mem = gaus_log_lhoods.memptr(); for(uword i=start_index; i <= end_index; i++) { const eT* x = X.colptr(i); for(uword g=0; g < N_gaus; ++g) { gaus_log_lhoods_mem[g] = internal_scalar_log_p(x, g) + log_hefts_mem[g]; } eT log_lhood_sum = gaus_log_lhoods_mem[0]; for(uword g=1; g < N_gaus; ++g) { log_lhood_sum = priv::internal_log_add_exp(log_lhood_sum, gaus_log_lhoods_mem[g]); } progress_log_lhood += log_lhood_sum; for(uword g=0; g < N_gaus; ++g) { const eT norm_lhood = std::exp(gaus_log_lhoods_mem[g] - log_lhood_sum); acc_norm_lhoods[g] += norm_lhood; eT* acc_mean_mem = acc_means.colptr(g); for(uword d=0; d < N_dims; ++d) { acc_mean_mem[d] += x[d] * norm_lhood; } Mat& acc_fcov = access::rw(acc_fcovs).slice(g); // specialised version of acc_fcov += norm_lhood * (xx * xx.t()); for(uword d=0; d < N_dims; ++d) { const uword dp1 = d+1; const eT xd = x[d]; eT* acc_fcov_col_d = acc_fcov.colptr(d) + d; eT* acc_fcov_row_d = &(acc_fcov.at(d,dp1)); (*acc_fcov_col_d) += norm_lhood * (xd * xd); acc_fcov_col_d++; for(uword e=dp1; e < N_dims; ++e) { const eT val = norm_lhood * (xd * x[e]); (*acc_fcov_col_d) += val; acc_fcov_col_d++; (*acc_fcov_row_d) += val; acc_fcov_row_d += N_dims; } } } } progress_log_lhood /= eT((end_index - start_index) + 1); } template inline void gmm_full::em_fix_params(const eT var_floor) { arma_debug_sigprint(); const uword N_dims = means.n_rows; const uword N_gaus = means.n_cols; const eT var_ceiling = std::numeric_limits::max(); for(uword g=0; g < N_gaus; ++g) { Mat& fcov = access::rw(fcovs).slice(g); for(uword d=0; d < N_dims; ++d) { eT& var_val = fcov.at(d,d); if(var_val < var_floor ) { var_val = var_floor; } else if(var_val > var_ceiling) { var_val = var_ceiling; } else if(arma_isnan(var_val) ) { var_val = eT(1); } } } eT* hefts_mem = access::rw(hefts).memptr(); for(uword g1=0; g1 < N_gaus; ++g1) { if(hefts_mem[g1] > eT(0)) { const eT* means_colptr_g1 = means.colptr(g1); for(uword g2=(g1+1); g2 < N_gaus; ++g2) { if( (hefts_mem[g2] > eT(0)) && (std::abs(hefts_mem[g1] - hefts_mem[g2]) <= std::numeric_limits::epsilon()) ) { const eT dist = distance::eval(N_dims, means_colptr_g1, means.colptr(g2), means_colptr_g1); if(dist == eT(0)) { hefts_mem[g2] = eT(0); } } } } } const eT heft_floor = std::numeric_limits::min(); const eT heft_initial = eT(1) / eT(N_gaus); for(uword i=0; i < N_gaus; ++i) { eT& heft_val = hefts_mem[i]; if(heft_val < heft_floor) { heft_val = heft_floor; } else if(heft_val > eT(1) ) { heft_val = eT(1); } else if(arma_isnan(heft_val) ) { heft_val = heft_initial; } } const eT heft_sum = accu(hefts); if((heft_sum < (eT(1) - Datum::eps)) || (heft_sum > (eT(1) + Datum::eps))) { access::rw(hefts) /= heft_sum; } } } // namespace gmm_priv //! @} RcppArmadillo/inst/include/armadillo_bits/op_dotext_bones.hpp0000644000176200001440000000304314301267043024274 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_dotext //! @{ class op_dotext : public traits_op_default { public: template inline static eT direct_rowvec_mat_colvec (const eT* A_mem, const Mat& B, const eT* C_mem); template inline static eT direct_rowvec_transmat_colvec (const eT* A_mem, const Mat& B, const eT* C_mem); template inline static eT direct_rowvec_diagmat_colvec (const eT* A_mem, const Mat& B, const eT* C_mem); template inline static eT direct_rowvec_invdiagmat_colvec(const eT* A_mem, const Mat& B, const eT* C_mem); template inline static eT direct_rowvec_invdiagvec_colvec(const eT* A_mem, const Mat& B, const eT* C_mem); }; //! @} RcppArmadillo/inst/include/armadillo_bits/fn_trimat_ind.hpp0000644000176200001440000000672414631567470023744 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_trimat_ind //! @{ arma_warn_unused inline uvec trimatu_ind(const SizeMat& s, const sword k = 0) { arma_debug_sigprint(); const uword n_rows = s.n_rows; const uword n_cols = s.n_cols; const uword row_offset = (k < 0) ? uword(-k) : uword(0); const uword col_offset = (k > 0) ? uword( k) : uword(0); arma_conform_check_bounds( ((row_offset > 0) && (row_offset >= n_rows)) || ((col_offset > 0) && (col_offset >= n_cols)), "trimatu_ind(): requested diagonal is out of bounds" ); const uword N = (std::min)(n_rows - row_offset, n_cols - col_offset); uvec tmp(n_rows * n_cols, arma_nozeros_indicator()); // worst case scenario uword* tmp_mem = tmp.memptr(); uword count = 0; for(uword i=0; i < n_cols; ++i) { const uword col = i + col_offset; if(i < N) { const uword end_row = i + row_offset; const uword index_offset = (n_rows * col); for(uword row=0; row <= end_row; ++row) { tmp_mem[count] = index_offset + row; ++count; } } else { if(col < n_cols) { const uword index_offset = (n_rows * col); for(uword row=0; row < n_rows; ++row) { tmp_mem[count] = index_offset + row; ++count; } } } } uvec out; out.steal_mem_col(tmp, count); return out; } arma_warn_unused inline uvec trimatl_ind(const SizeMat& s, const sword k = 0) { arma_debug_sigprint(); const uword n_rows = s.n_rows; const uword n_cols = s.n_cols; const uword row_offset = (k < 0) ? uword(-k) : uword(0); const uword col_offset = (k > 0) ? uword( k) : uword(0); arma_conform_check_bounds( ((row_offset > 0) && (row_offset >= n_rows)) || ((col_offset > 0) && (col_offset >= n_cols)), "trimatl_ind(): requested diagonal is out of bounds" ); const uword N = (std::min)(n_rows - row_offset, n_cols - col_offset); uvec tmp(n_rows * n_cols, arma_nozeros_indicator()); // worst case scenario uword* tmp_mem = tmp.memptr(); uword count = 0; for(uword col=0; col < col_offset; ++col) { const uword index_offset = (n_rows * col); for(uword row=0; row < n_rows; ++row) { tmp_mem[count] = index_offset + row; ++count; } } for(uword i=0; i inline void interp2_helper_nearest(const Mat& XG, const Mat& ZG, const Mat& XI, Mat& ZI, const eT extrap_val, const uword mode) { arma_debug_sigprint(); const eT XG_min = XG.min(); const eT XG_max = XG.max(); // mode = 0: interpolate across rows (eg. expand in vertical direction) // mode = 1: interpolate across columns (eg. expand in horizontal direction) if(mode == 0) { ZI.set_size(XI.n_elem, ZG.n_cols); } if(mode == 1) { ZI.set_size(ZG.n_rows, XI.n_elem); } const eT* XG_mem = XG.memptr(); const eT* XI_mem = XI.memptr(); const uword NG = XG.n_elem; const uword NI = XI.n_elem; uword best_j = 0; for(uword i=0; i::inf; const eT XI_val = XI_mem[i]; if((XI_val < XG_min) || (XI_val > XG_max)) { if(mode == 0) { ZI.row(i).fill(extrap_val); } if(mode == 1) { ZI.col(i).fill(extrap_val); } } else { // XG and XI are guaranteed to be sorted in ascending manner, // so start searching XG from last known optimum position for(uword j=best_j; j= eT(0)) ? tmp : -tmp; if(err >= best_err) { // error is going up, so we have found the optimum position break; } else { best_err = err; best_j = j; // remember the optimum position } } if(mode == 0) { ZI.row(i) = ZG.row(best_j); } if(mode == 1) { ZI.col(i) = ZG.col(best_j); } } } } template inline void interp2_helper_linear(const Mat& XG, const Mat& ZG, const Mat& XI, Mat& ZI, const eT extrap_val, const uword mode) { arma_debug_sigprint(); const eT XG_min = XG.min(); const eT XG_max = XG.max(); // mode = 0: interpolate across rows (eg. expand in vertical direction) // mode = 1: interpolate across columns (eg. expand in horizontal direction) if(mode == 0) { ZI.set_size(XI.n_elem, ZG.n_cols); } if(mode == 1) { ZI.set_size(ZG.n_rows, XI.n_elem); } const eT* XG_mem = XG.memptr(); const eT* XI_mem = XI.memptr(); const uword NG = XG.n_elem; const uword NI = XI.n_elem; uword a_best_j = 0; uword b_best_j = 0; for(uword i=0; i XG_max)) { if(mode == 0) { ZI.row(i).fill(extrap_val); } if(mode == 1) { ZI.col(i).fill(extrap_val); } } else { // XG and XI are guaranteed to be sorted in ascending manner, // so start searching XG from last known optimum position eT a_best_err = Datum::inf; eT b_best_err = Datum::inf; for(uword j=a_best_j; j= eT(0)) ? tmp : -tmp; if(err >= a_best_err) { break; } else { a_best_err = err; a_best_j = j; } } if( (XG_mem[a_best_j] - XI_val) <= eT(0) ) { // a_best_j is to the left of the interpolated position b_best_j = ( (a_best_j+1) < NG) ? (a_best_j+1) : a_best_j; } else { // a_best_j is to the right of the interpolated position b_best_j = (a_best_j >= 1) ? (a_best_j-1) : a_best_j; } b_best_err = std::abs( XG_mem[b_best_j] - XI_val ); if(a_best_j > b_best_j) { std::swap(a_best_j, b_best_j ); std::swap(a_best_err, b_best_err); } const eT weight = (a_best_err > eT(0)) ? (a_best_err / (a_best_err + b_best_err)) : eT(0); if(mode == 0) { ZI.row(i) = (eT(1) - weight)*ZG.row(a_best_j) + (weight)*ZG.row(b_best_j); } if(mode == 1) { ZI.col(i) = (eT(1) - weight)*ZG.col(a_best_j) + (weight)*ZG.col(b_best_j); } } } } template inline typename enable_if2< is_real::value, void >::result interp2 ( const Base& X, const Base& Y, const Base& Z, const Base& XI, const Base& YI, Mat& ZI, const char* method = "linear", const typename T1::elem_type extrap_val = Datum::nan ) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const char sig = (method != nullptr) ? method[0] : char(0); arma_conform_check( ((sig != 'n') && (sig != 'l')), "interp2(): unsupported interpolation type" ); const quasi_unwrap UXG( X.get_ref() ); const quasi_unwrap UYG( Y.get_ref() ); const quasi_unwrap UZG( Z.get_ref() ); const quasi_unwrap UXI( XI.get_ref() ); const quasi_unwrap UYI( YI.get_ref() ); arma_conform_check( (UXG.M.is_vec() == false), "interp2(): X must resolve to a vector" ); arma_conform_check( (UYG.M.is_vec() == false), "interp2(): Y must resolve to a vector" ); arma_conform_check( (UXI.M.is_vec() == false), "interp2(): XI must resolve to a vector" ); arma_conform_check( (UYI.M.is_vec() == false), "interp2(): YI must resolve to a vector" ); arma_conform_check( (UXG.M.n_elem < 2), "interp2(): X must have at least two unique elements" ); arma_conform_check( (UYG.M.n_elem < 2), "interp2(): Y must have at least two unique elements" ); arma_conform_check( (UXG.M.n_elem != UZG.M.n_cols), "interp2(): number of elements in X must equal the number of columns in Z" ); arma_conform_check( (UYG.M.n_elem != UZG.M.n_rows), "interp2(): number of elements in Y must equal the number of rows in Z" ); arma_conform_check( (UXG.M.is_sorted("strictascend") == false), "interp2(): X must be monotonically increasing" ); arma_conform_check( (UYG.M.is_sorted("strictascend") == false), "interp2(): Y must be monotonically increasing" ); arma_conform_check( (UXI.M.is_sorted("strictascend") == false), "interp2(): XI must be monotonically increasing" ); arma_conform_check( (UYI.M.is_sorted("strictascend") == false), "interp2(): YI must be monotonically increasing" ); Mat tmp; if( UXG.is_alias(ZI) || UXI.is_alias(ZI) ) { Mat out; if(sig == 'n') { interp2_helper_nearest(UYG.M, UZG.M, UYI.M, tmp, extrap_val, 0); interp2_helper_nearest(UXG.M, tmp, UXI.M, out, extrap_val, 1); } else if(sig == 'l') { interp2_helper_linear(UYG.M, UZG.M, UYI.M, tmp, extrap_val, 0); interp2_helper_linear(UXG.M, tmp, UXI.M, out, extrap_val, 1); } ZI.steal_mem(out); } else { if(sig == 'n') { interp2_helper_nearest(UYG.M, UZG.M, UYI.M, tmp, extrap_val, 0); interp2_helper_nearest(UXG.M, tmp, UXI.M, ZI, extrap_val, 1); } else if(sig == 'l') { interp2_helper_linear(UYG.M, UZG.M, UYI.M, tmp, extrap_val, 0); interp2_helper_linear(UXG.M, tmp, UXI.M, ZI, extrap_val, 1); } } } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_quantile.hpp0000644000176200001440000000335214631567470023426 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_quantile //! @{ template arma_warn_unused arma_inline typename enable_if2 < is_arma_type::value && is_cx::no && is_real::value, const mtGlue >::result quantile(const T1& X, const Base& P) { arma_debug_sigprint(); return mtGlue(X, P.get_ref()); } template arma_warn_unused arma_inline typename enable_if2 < is_arma_type::value && is_cx::no && is_real::value, const mtGlue >::result quantile(const T1& X, const Base& P, const uword dim) { arma_debug_sigprint(); return mtGlue(X, P.get_ref(), dim); } //! @} RcppArmadillo/inst/include/armadillo_bits/spglue_max_meat.hpp0000644000176200001440000001244514631567470024276 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup spglue_max //! @{ template inline void spglue_max::apply(SpMat& out, const SpGlue& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const SpProxy pa(X.A); const SpProxy pb(X.B); const bool is_alias = pa.is_alias(out) || pb.is_alias(out); if(is_alias == false) { spglue_max::apply_noalias(out, pa, pb); } else { SpMat tmp; spglue_max::apply_noalias(tmp, pa, pb); out.steal_mem(tmp); } } template inline void spglue_max::apply_noalias(SpMat& out, const SpProxy& pa, const SpProxy& pb) { arma_debug_sigprint(); arma_conform_assert_same_size(pa.get_n_rows(), pa.get_n_cols(), pb.get_n_rows(), pb.get_n_cols(), "element-wise max()"); const uword max_n_nonzero = pa.get_n_nonzero() + pb.get_n_nonzero(); // Resize memory to upper bound out.reserve(pa.get_n_rows(), pa.get_n_cols(), max_n_nonzero); // Now iterate across both matrices. typename SpProxy::const_iterator_type x_it = pa.begin(); typename SpProxy::const_iterator_type x_end = pa.end(); typename SpProxy::const_iterator_type y_it = pb.begin(); typename SpProxy::const_iterator_type y_end = pb.end(); uword count = 0; while( (x_it != x_end) || (y_it != y_end) ) { eT out_val; const uword x_it_col = x_it.col(); const uword x_it_row = x_it.row(); const uword y_it_col = y_it.col(); const uword y_it_row = y_it.row(); bool use_y_loc = false; if(x_it == y_it) { out_val = elem_max(eT(*x_it), eT(*y_it)); ++x_it; ++y_it; } else { if((x_it_col < y_it_col) || ((x_it_col == y_it_col) && (x_it_row < y_it_row))) // if y is closer to the end { out_val = elem_max(eT(*x_it), eT(0)); ++x_it; } else { out_val = elem_max(eT(*y_it), eT(0)); ++y_it; use_y_loc = true; } } if(out_val != eT(0)) { access::rw(out.values[count]) = out_val; const uword out_row = (use_y_loc == false) ? x_it_row : y_it_row; const uword out_col = (use_y_loc == false) ? x_it_col : y_it_col; access::rw(out.row_indices[count]) = out_row; access::rw(out.col_ptrs[out_col + 1])++; ++count; } arma_check( (count > max_n_nonzero), "internal error: spglue_max::apply_noalias(): count > max_n_nonzero" ); } const uword out_n_cols = out.n_cols; uword* col_ptrs = access::rwp(out.col_ptrs); // Fix column pointers to be cumulative. for(uword c = 1; c <= out_n_cols; ++c) { col_ptrs[c] += col_ptrs[c - 1]; } if(count < max_n_nonzero) { if(count <= (max_n_nonzero/2)) { out.mem_resize(count); } else { // quick resize without reallocating memory and copying data access::rw( out.n_nonzero) = count; access::rw( out.values[count]) = eT(0); access::rw(out.row_indices[count]) = uword(0); } } } template inline void spglue_max::apply_noalias(SpMat& out, const SpMat& A, const SpMat& B) { arma_debug_sigprint(); const SpProxy< SpMat > pa(A); const SpProxy< SpMat > pb(B); spglue_max::apply_noalias(out, pa, pb); } template inline void spglue_max::dense_sparse_max(Mat& out, const Base& X, const SpBase& Y) { arma_debug_sigprint(); // NOTE: this function assumes there is no aliasing between matrix 'out' and X const Proxy pa(X.get_ref()); const SpProxy pb(Y.get_ref()); const uword n_rows = pa.get_n_rows(); const uword n_cols = pa.get_n_cols(); arma_conform_assert_same_size( n_rows, n_cols, pb.get_n_rows(), pb.get_n_cols(), "element-wise max()" ); out.set_size(n_rows, n_cols); for(uword c=0; c < n_cols; ++c) for(uword r=0; r < n_rows; ++r) { out.at(r,c) = elem_max(pa.at(r,c), pb.at(r,c)); } } //! max of non-complex elements template inline typename enable_if2::no, eT>::result spglue_max::elem_max(const eT& a, const eT& b) { return (std::max)(a, b); } //! max of complex elements template inline typename enable_if2::yes, eT>::result spglue_max::elem_max(const eT& a, const eT& b) { return (std::abs(a) > std::abs(b)) ? a : b; } //! @} RcppArmadillo/inst/include/armadillo_bits/subview_elem2_bones.hpp0000644000176200001440000001027215030507611025037 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup subview_elem2 //! @{ template class subview_elem2 : public Base< eT, subview_elem2 > { public: typedef eT elem_type; typedef typename get_pod_type::result pod_type; static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = false; arma_aligned const Mat& m; arma_aligned const Base& base_ri; arma_aligned const Base& base_ci; const bool all_rows; const bool all_cols; protected: arma_inline subview_elem2(const Mat& in_m, const Base& in_ri, const Base& in_ci, const bool in_all_rows, const bool in_all_cols); public: inline ~subview_elem2(); inline subview_elem2() = delete; template inline void inplace_op(const eT val); template inline void inplace_op(const Base& x); inline void replace(const eT old_val, const eT new_val); inline void clean(const pod_type threshold); inline void clamp(const eT min_val, const eT max_val); inline void fill(const eT val); inline void zeros(); inline void ones(); inline void randu(); inline void randn(); inline void operator+= (const eT val); inline void operator-= (const eT val); inline void operator*= (const eT val); inline void operator/= (const eT val); // deliberately returning void template inline void operator_equ(const subview_elem2& x); template inline void operator= (const subview_elem2& x); inline void operator= (const subview_elem2& x); template inline void operator+= (const subview_elem2& x); template inline void operator-= (const subview_elem2& x); template inline void operator%= (const subview_elem2& x); template inline void operator/= (const subview_elem2& x); template inline void operator= (const Base& x); template inline void operator+= (const Base& x); template inline void operator-= (const Base& x); template inline void operator%= (const Base& x); template inline void operator/= (const Base& x); template inline void operator= (const SpBase& x); template inline void operator+= (const SpBase& x); template inline void operator-= (const SpBase& x); template inline void operator%= (const SpBase& x); template inline void operator/= (const SpBase& x); inline static void extract(Mat& out, const subview_elem2& in); inline static void plus_inplace(Mat& out, const subview_elem2& in); inline static void minus_inplace(Mat& out, const subview_elem2& in); inline static void schur_inplace(Mat& out, const subview_elem2& in); inline static void div_inplace(Mat& out, const subview_elem2& in); template inline bool is_alias(const Mat& X) const; friend class Mat; }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_orth_null_bones.hpp0000644000176200001440000000301414301267043024771 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_orth_null //! @{ class op_orth : public traits_op_default { public: template inline static void apply(Mat& out, const Op& expr); template inline static bool apply_direct(Mat& out, const Base& expr, typename T1::pod_type tol); }; class op_null : public traits_op_default { public: template inline static void apply(Mat& out, const Op& expr); template inline static bool apply_direct(Mat& out, const Base& expr, typename T1::pod_type tol); }; //! @} RcppArmadillo/inst/include/armadillo_bits/newarp_EigsSelect.hpp0000644000176200001440000000434014301267043024505 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ namespace newarp { //! The enumeration of selection rules of desired eigenvalues. struct EigsSelect { enum SELECT_EIGENVALUE { LARGEST_MAGN = 0, //!< Select eigenvalues with largest magnitude. //!< Magnitude means the absolute value for real numbers and norm for complex numbers. //!< Applies to both symmetric and general eigen solvers. LARGEST_REAL, //!< Select eigenvalues with largest real part. Only for general eigen solvers. LARGEST_IMAG, //!< Select eigenvalues with largest imaginary part (in magnitude). Only for general eigen solvers. LARGEST_ALGE, //!< Select eigenvalues with largest algebraic value, considering any negative sign. Only for symmetric eigen solvers. SMALLEST_MAGN, //!< Select eigenvalues with smallest magnitude. Applies to both symmetric and general eigen solvers. SMALLEST_REAL, //!< Select eigenvalues with smallest real part. Only for general eigen solvers. SMALLEST_IMAG, //!< Select eigenvalues with smallest imaginary part (in magnitude). Only for general eigen solvers. SMALLEST_ALGE, //!< Select eigenvalues with smallest algebraic value. Only for symmetric eigen solvers. BOTH_ENDS //!< Select eigenvalues half from each end of the spectrum. //!< When `nev` is odd, compute more from the high end. Only for symmetric eigen solvers. }; }; } // namespace newarp RcppArmadillo/inst/include/armadillo_bits/eglue_core_bones.hpp0000644000176200001440000000576714301267043024417 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup eglue_core //! @{ template struct eglue_core { // matrices template arma_hot inline static void apply(outT& out, const eGlue& x); template arma_hot inline static void apply_inplace_plus (Mat& out, const eGlue& x); template arma_hot inline static void apply_inplace_minus(Mat& out, const eGlue& x); template arma_hot inline static void apply_inplace_schur(Mat& out, const eGlue& x); template arma_hot inline static void apply_inplace_div (Mat& out, const eGlue& x); // cubes template arma_hot inline static void apply(Cube& out, const eGlueCube& x); template arma_hot inline static void apply_inplace_plus (Cube& out, const eGlueCube& x); template arma_hot inline static void apply_inplace_minus(Cube& out, const eGlueCube& x); template arma_hot inline static void apply_inplace_schur(Cube& out, const eGlueCube& x); template arma_hot inline static void apply_inplace_div (Cube& out, const eGlueCube& x); }; class eglue_plus : public eglue_core { public: inline static const char* text() { return "addition"; } }; class eglue_minus : public eglue_core { public: inline static const char* text() { return "subtraction"; } }; class eglue_div : public eglue_core { public: inline static const char* text() { return "element-wise division"; } }; class eglue_schur : public eglue_core { public: inline static const char* text() { return "element-wise multiplication"; } }; //! @} RcppArmadillo/inst/include/armadillo_bits/glue_affmul_meat.hpp0000644000176200001440000003150314631567470024414 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup glue_affmul //! @{ template inline void glue_affmul::apply(Mat& out, const Glue& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const quasi_unwrap U1(X.A); const quasi_unwrap U2(X.B); const bool is_alias = (U1.is_alias(out) || U2.is_alias(out)); if(is_alias == false) { glue_affmul::apply_noalias(out, U1.M, U2.M); } else { Mat tmp; glue_affmul::apply_noalias(tmp, U1.M, U2.M); out.steal_mem(tmp); } } template inline void glue_affmul::apply_noalias(Mat& out, const T1& A, const T2& B) { arma_debug_sigprint(); const uword A_n_cols = A.n_cols; const uword A_n_rows = A.n_rows; const uword B_n_rows = B.n_rows; arma_conform_check( (A_n_cols != B_n_rows+1), "affmul(): size mismatch" ); if(A_n_rows == A_n_cols) { glue_affmul::apply_noalias_square(out, A, B); } else if(A_n_rows == B_n_rows) { glue_affmul::apply_noalias_rectangle(out, A, B); } else { glue_affmul::apply_noalias_generic(out, A, B); } } template inline void glue_affmul::apply_noalias_square(Mat& out, const T1& A, const T2& B) { arma_debug_sigprint(); typedef typename T1::elem_type eT; // assuming that A is square sized, and A.n_cols = B.n_rows+1 const uword N = A.n_rows; const uword B_n_cols = B.n_cols; out.set_size(N, B_n_cols); if(out.n_elem == 0) { return; } const eT* A_mem = A.memptr(); switch(N) { case 0: break; case 1: // A is 1x1 out.fill(A_mem[0]); break; case 2: // A is 2x2 { if(B_n_cols == 1) { const eT* B_mem = B.memptr(); eT* out_mem = out.memptr(); const eT x = B_mem[0]; out_mem[0] = A_mem[0]*x + A_mem[2]; out_mem[1] = A_mem[1]*x + A_mem[3]; } else for(uword col=0; col < B_n_cols; ++col) { const eT* B_mem = B.colptr(col); eT* out_mem = out.colptr(col); const eT x = B_mem[0]; out_mem[0] = A_mem[0]*x + A_mem[2]; out_mem[1] = A_mem[1]*x + A_mem[3]; } } break; case 3: // A is 3x3 { if(B_n_cols == 1) { const eT* B_mem = B.memptr(); eT* out_mem = out.memptr(); const eT x = B_mem[0]; const eT y = B_mem[1]; out_mem[0] = A_mem[0]*x + A_mem[3]*y + A_mem[6]; out_mem[1] = A_mem[1]*x + A_mem[4]*y + A_mem[7]; out_mem[2] = A_mem[2]*x + A_mem[5]*y + A_mem[8]; } else for(uword col=0; col < B_n_cols; ++col) { const eT* B_mem = B.colptr(col); eT* out_mem = out.colptr(col); const eT x = B_mem[0]; const eT y = B_mem[1]; out_mem[0] = A_mem[0]*x + A_mem[3]*y + A_mem[6]; out_mem[1] = A_mem[1]*x + A_mem[4]*y + A_mem[7]; out_mem[2] = A_mem[2]*x + A_mem[5]*y + A_mem[8]; } } break; case 4: // A is 4x4 { if(B_n_cols == 1) { const eT* B_mem = B.memptr(); eT* out_mem = out.memptr(); const eT x = B_mem[0]; const eT y = B_mem[1]; const eT z = B_mem[2]; out_mem[0] = A_mem[ 0]*x + A_mem[ 4]*y + A_mem[ 8]*z + A_mem[12]; out_mem[1] = A_mem[ 1]*x + A_mem[ 5]*y + A_mem[ 9]*z + A_mem[13]; out_mem[2] = A_mem[ 2]*x + A_mem[ 6]*y + A_mem[10]*z + A_mem[14]; out_mem[3] = A_mem[ 3]*x + A_mem[ 7]*y + A_mem[11]*z + A_mem[15]; } else for(uword col=0; col < B_n_cols; ++col) { const eT* B_mem = B.colptr(col); eT* out_mem = out.colptr(col); const eT x = B_mem[0]; const eT y = B_mem[1]; const eT z = B_mem[2]; out_mem[0] = A_mem[ 0]*x + A_mem[ 4]*y + A_mem[ 8]*z + A_mem[12]; out_mem[1] = A_mem[ 1]*x + A_mem[ 5]*y + A_mem[ 9]*z + A_mem[13]; out_mem[2] = A_mem[ 2]*x + A_mem[ 6]*y + A_mem[10]*z + A_mem[14]; out_mem[3] = A_mem[ 3]*x + A_mem[ 7]*y + A_mem[11]*z + A_mem[15]; } } break; case 5: // A is 5x5 { if(B_n_cols == 1) { const eT* B_mem = B.memptr(); eT* out_mem = out.memptr(); const eT x = B_mem[0]; const eT y = B_mem[1]; const eT z = B_mem[2]; const eT w = B_mem[3]; out_mem[0] = A_mem[ 0]*x + A_mem[ 5]*y + A_mem[10]*z + A_mem[15]*w + A_mem[20]; out_mem[1] = A_mem[ 1]*x + A_mem[ 6]*y + A_mem[11]*z + A_mem[16]*w + A_mem[21]; out_mem[2] = A_mem[ 2]*x + A_mem[ 7]*y + A_mem[12]*z + A_mem[17]*w + A_mem[22]; out_mem[3] = A_mem[ 3]*x + A_mem[ 8]*y + A_mem[13]*z + A_mem[18]*w + A_mem[23]; out_mem[4] = A_mem[ 4]*x + A_mem[ 9]*y + A_mem[14]*z + A_mem[19]*w + A_mem[24]; } else for(uword col=0; col < B_n_cols; ++col) { const eT* B_mem = B.colptr(col); eT* out_mem = out.colptr(col); const eT x = B_mem[0]; const eT y = B_mem[1]; const eT z = B_mem[2]; const eT w = B_mem[3]; out_mem[0] = A_mem[ 0]*x + A_mem[ 5]*y + A_mem[10]*z + A_mem[15]*w + A_mem[20]; out_mem[1] = A_mem[ 1]*x + A_mem[ 6]*y + A_mem[11]*z + A_mem[16]*w + A_mem[21]; out_mem[2] = A_mem[ 2]*x + A_mem[ 7]*y + A_mem[12]*z + A_mem[17]*w + A_mem[22]; out_mem[3] = A_mem[ 3]*x + A_mem[ 8]*y + A_mem[13]*z + A_mem[18]*w + A_mem[23]; out_mem[4] = A_mem[ 4]*x + A_mem[ 9]*y + A_mem[14]*z + A_mem[19]*w + A_mem[24]; } } break; default: { if(B_n_cols == 1) { Col tmp(N, arma_nozeros_indicator()); eT* tmp_mem = tmp.memptr(); arrayops::copy(tmp_mem, B.memptr(), N-1); tmp_mem[N-1] = eT(1); out = A * tmp; } else { Mat tmp(N, B_n_cols, arma_nozeros_indicator()); for(uword col=0; col < B_n_cols; ++col) { const eT* B_mem = B.colptr(col); eT* tmp_mem = tmp.colptr(col); arrayops::copy(tmp_mem, B_mem, N-1); tmp_mem[N-1] = eT(1); } out = A * tmp; } } } } template inline void glue_affmul::apply_noalias_rectangle(Mat& out, const T1& A, const T2& B) { arma_debug_sigprint(); typedef typename T1::elem_type eT; // assuming that A.n_rows = A.n_cols-1, and A.n_cols = B.n_rows+1 // (A and B have the same number of rows) const uword A_n_rows = A.n_rows; const uword B_n_cols = B.n_cols; out.set_size(A_n_rows, B_n_cols); if(out.n_elem == 0) { return; } const eT* A_mem = A.memptr(); switch(A_n_rows) { case 0: break; case 1: // A is 1x2 { if(B_n_cols == 1) { const eT* B_mem = B.memptr(); eT* out_mem = out.memptr(); const eT x = B_mem[0]; out_mem[0] = A_mem[0]*x + A_mem[1]; } else for(uword col=0; col < B_n_cols; ++col) { const eT* B_mem = B.colptr(col); eT* out_mem = out.colptr(col); const eT x = B_mem[0]; out_mem[0] = A_mem[0]*x + A_mem[1]; } } break; case 2: // A is 2x3 { if(B_n_cols == 1) { const eT* B_mem = B.memptr(); eT* out_mem = out.memptr(); const eT x = B_mem[0]; const eT y = B_mem[1]; out_mem[0] = A_mem[0]*x + A_mem[2]*y + A_mem[4]; out_mem[1] = A_mem[1]*x + A_mem[3]*y + A_mem[5]; } else for(uword col=0; col < B_n_cols; ++col) { const eT* B_mem = B.colptr(col); eT* out_mem = out.colptr(col); const eT x = B_mem[0]; const eT y = B_mem[1]; out_mem[0] = A_mem[0]*x + A_mem[2]*y + A_mem[4]; out_mem[1] = A_mem[1]*x + A_mem[3]*y + A_mem[5]; } } break; case 3: // A is 3x4 { if(B_n_cols == 1) { const eT* B_mem = B.memptr(); eT* out_mem = out.memptr(); const eT x = B_mem[0]; const eT y = B_mem[1]; const eT z = B_mem[2]; out_mem[0] = A_mem[ 0]*x + A_mem[ 3]*y + A_mem[ 6]*z + A_mem[ 9]; out_mem[1] = A_mem[ 1]*x + A_mem[ 4]*y + A_mem[ 7]*z + A_mem[10]; out_mem[2] = A_mem[ 2]*x + A_mem[ 5]*y + A_mem[ 8]*z + A_mem[11]; } else for(uword col=0; col < B_n_cols; ++col) { const eT* B_mem = B.colptr(col); eT* out_mem = out.colptr(col); const eT x = B_mem[0]; const eT y = B_mem[1]; const eT z = B_mem[2]; out_mem[0] = A_mem[ 0]*x + A_mem[ 3]*y + A_mem[ 6]*z + A_mem[ 9]; out_mem[1] = A_mem[ 1]*x + A_mem[ 4]*y + A_mem[ 7]*z + A_mem[10]; out_mem[2] = A_mem[ 2]*x + A_mem[ 5]*y + A_mem[ 8]*z + A_mem[11]; } } break; case 4: // A is 4x5 { if(B_n_cols == 1) { const eT* B_mem = B.memptr(); eT* out_mem = out.memptr(); const eT x = B_mem[0]; const eT y = B_mem[1]; const eT z = B_mem[2]; const eT w = B_mem[3]; out_mem[0] = A_mem[ 0]*x + A_mem[ 4]*y + A_mem[ 8]*z + A_mem[12]*w + A_mem[16]; out_mem[1] = A_mem[ 1]*x + A_mem[ 5]*y + A_mem[ 9]*z + A_mem[13]*w + A_mem[17]; out_mem[2] = A_mem[ 2]*x + A_mem[ 6]*y + A_mem[10]*z + A_mem[14]*w + A_mem[18]; out_mem[3] = A_mem[ 3]*x + A_mem[ 7]*y + A_mem[11]*z + A_mem[15]*w + A_mem[19]; } else for(uword col=0; col < B_n_cols; ++col) { const eT* B_mem = B.colptr(col); eT* out_mem = out.colptr(col); const eT x = B_mem[0]; const eT y = B_mem[1]; const eT z = B_mem[2]; const eT w = B_mem[3]; out_mem[0] = A_mem[ 0]*x + A_mem[ 4]*y + A_mem[ 8]*z + A_mem[12]*w + A_mem[16]; out_mem[1] = A_mem[ 1]*x + A_mem[ 5]*y + A_mem[ 9]*z + A_mem[13]*w + A_mem[17]; out_mem[2] = A_mem[ 2]*x + A_mem[ 6]*y + A_mem[10]*z + A_mem[14]*w + A_mem[18]; out_mem[3] = A_mem[ 3]*x + A_mem[ 7]*y + A_mem[11]*z + A_mem[15]*w + A_mem[19]; } } break; default: { const uword A_n_cols = A.n_cols; if(B_n_cols == 1) { Col tmp(A_n_cols, arma_nozeros_indicator()); eT* tmp_mem = tmp.memptr(); arrayops::copy(tmp_mem, B.memptr(), A_n_cols-1); tmp_mem[A_n_cols-1] = eT(1); out = A * tmp; } else { Mat tmp(A_n_cols, B_n_cols, arma_nozeros_indicator()); for(uword col=0; col < B_n_cols; ++col) { const eT* B_mem = B.colptr(col); eT* tmp_mem = tmp.colptr(col); arrayops::copy(tmp_mem, B_mem, A_n_cols-1); tmp_mem[A_n_cols-1] = eT(1); } out = A * tmp; } } } } template inline void glue_affmul::apply_noalias_generic(Mat& out, const T1& A, const T2& B) { arma_debug_sigprint(); typedef typename T1::elem_type eT; // assuming that A.n_cols = B.n_rows+1 const uword B_n_rows = B.n_rows; const uword B_n_cols = B.n_cols; Mat tmp(B_n_rows+1, B_n_cols, arma_nozeros_indicator()); for(uword col=0; col < B_n_cols; ++col) { const eT* B_mem = B.colptr(col); eT* tmp_mem = tmp.colptr(col); arrayops::copy(tmp_mem, B_mem, B_n_rows); tmp_mem[B_n_rows] = eT(1); } out = A * tmp; } //! @} RcppArmadillo/inst/include/armadillo_bits/constants_old.hpp0000644000176200001440000001057314374704744023777 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup constants_old //! @{ // DO NOT USE IN NEW CODE !!! // the Math and Phy classes are kept for compatibility with old code; // for new code, use the Datum class instead // eg. instead of math::pi(), use datum::pi template class Math { public: arma_frown("use datum::pi instead") static eT pi() { return eT(Datum::pi); } arma_frown("use datum::e instead") static eT e() { return eT(Datum::e); } arma_frown("use datum::euler instead") static eT euler() { return eT(Datum::euler); } arma_frown("use datum::gratio instead") static eT gratio() { return eT(Datum::gratio); } arma_frown("use datum::sqrt2 instead") static eT sqrt2() { return eT(Datum::sqrt2); } arma_frown("use datum::eps instead") static eT eps() { return eT(Datum::eps); } arma_frown("use datum::log_min instead") static eT log_min() { return eT(Datum::log_min); } arma_frown("use datum::log_max instead") static eT log_max() { return eT(Datum::log_max); } arma_frown("use datum::nan instead") static eT nan() { return eT(Datum::nan); } arma_frown("use datum::inf instead") static eT inf() { return eT(Datum::inf); } }; template class Phy { public: arma_deprecated static eT m_u() { return eT(Datum::m_u); } arma_deprecated static eT N_A() { return eT(Datum::N_A); } arma_deprecated static eT k() { return eT(Datum::k); } arma_deprecated static eT k_evk() { return eT(Datum::k_evk); } arma_deprecated static eT a_0() { return eT(Datum::a_0); } arma_deprecated static eT mu_B() { return eT(Datum::mu_B); } arma_deprecated static eT Z_0() { return eT(Datum::Z_0); } arma_deprecated static eT G_0() { return eT(Datum::G_0); } arma_deprecated static eT k_e() { return eT(Datum::k_e); } arma_deprecated static eT eps_0() { return eT(Datum::eps_0); } arma_deprecated static eT m_e() { return eT(Datum::m_e); } arma_deprecated static eT eV() { return eT(Datum::eV); } arma_deprecated static eT e() { return eT(Datum::ec); } arma_deprecated static eT F() { return eT(Datum::F); } arma_deprecated static eT alpha() { return eT(Datum::alpha); } arma_deprecated static eT alpha_inv() { return eT(Datum::alpha_inv); } arma_deprecated static eT K_J() { return eT(Datum::K_J); } arma_deprecated static eT mu_0() { return eT(Datum::mu_0); } arma_deprecated static eT phi_0() { return eT(Datum::phi_0); } arma_deprecated static eT R() { return eT(Datum::R); } arma_deprecated static eT G() { return eT(Datum::G); } arma_deprecated static eT h() { return eT(Datum::h); } arma_deprecated static eT h_bar() { return eT(Datum::h_bar); } arma_deprecated static eT m_p() { return eT(Datum::m_p); } arma_deprecated static eT R_inf() { return eT(Datum::R_inf); } arma_deprecated static eT c_0() { return eT(Datum::c_0); } arma_deprecated static eT sigma() { return eT(Datum::sigma); } arma_deprecated static eT R_k() { return eT(Datum::R_k); } arma_deprecated static eT b() { return eT(Datum::b); } }; typedef Math fmath; typedef Math math; typedef Phy fphy; typedef Phy phy; //! @} RcppArmadillo/inst/include/armadillo_bits/arma_ostream_bones.hpp0000644000176200001440000000701614456557177024772 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup arma_ostream //! @{ class arma_ostream_state { private: const ios::fmtflags orig_flags; const std::streamsize orig_precision; const std::streamsize orig_width; const char orig_fill; public: inline arma_ostream_state(const std::ostream& o); inline void restore(std::ostream& o) const; }; class arma_ostream { public: template inline static std::streamsize modify_stream(std::ostream& o, const eT* data, const uword n_elem); template inline static std::streamsize modify_stream(std::ostream& o, const std::complex* data, const uword n_elem); template inline static std::streamsize modify_stream(std::ostream& o, typename SpMat::const_iterator begin, const uword n_elem, const typename arma_not_cx::result* junk = nullptr); template inline static std::streamsize modify_stream(std::ostream& o, typename SpMat::const_iterator begin, const uword n_elem, const typename arma_cx_only::result* junk = nullptr); template inline static void print_elem_zero(std::ostream& o, const bool modify); template inline static void print_elem(std::ostream& o, const eT& x, const bool modify); template inline static void raw_print_elem(std::ostream& o, const eT& x); template inline static void print_elem(std::ostream& o, const std::complex& x, const bool modify); template inline static void raw_print_elem(std::ostream& o, const std::complex& x); template arma_cold inline static void print(std::ostream& o, const Mat& m, const bool modify); template arma_cold inline static void print(std::ostream& o, const Cube& m, const bool modify); template arma_cold inline static void print(std::ostream& o, const field& m); template arma_cold inline static void print(std::ostream& o, const subview_field& m); template arma_cold inline static void print_dense(std::ostream& o, const SpMat& m, const bool modify); template arma_cold inline static void print(std::ostream& o, const SpMat& m, const bool modify); arma_cold inline static void print(std::ostream& o, const SizeMat& S); arma_cold inline static void print(std::ostream& o, const SizeCube& S); template arma_cold inline static void brief_print(std::ostream& o, const Mat& m, const bool print_size = true); template arma_cold inline static void brief_print(std::ostream& o, const Cube& m); template arma_cold inline static void brief_print(std::ostream& o, const SpMat& m); }; //! @} RcppArmadillo/inst/include/armadillo_bits/mul_gemm.hpp0000644000176200001440000003077714654406643022735 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup gemm //! @{ //! for tiny square matrices, size <= 4x4 template class gemm_emul_tinysq { public: template arma_cold inline static void apply ( Mat& C, const TA& A, const TB& B, const eT alpha = eT(1), const eT beta = eT(0) ) { arma_debug_sigprint(); switch(A.n_rows) { case 4: gemv_emul_tinysq::apply( C.colptr(3), A, B.colptr(3), alpha, beta ); // fallthrough case 3: gemv_emul_tinysq::apply( C.colptr(2), A, B.colptr(2), alpha, beta ); // fallthrough case 2: gemv_emul_tinysq::apply( C.colptr(1), A, B.colptr(1), alpha, beta ); // fallthrough case 1: gemv_emul_tinysq::apply( C.colptr(0), A, B.colptr(0), alpha, beta ); // fallthrough default: ; } } }; //! emulation of gemm(), for non-complex matrices only, as it assumes only simple transposes (ie. doesn't do hermitian transposes) template class gemm_emul_large { public: template arma_hot inline static void apply ( Mat& C, const TA& A, const TB& B, const eT alpha = eT(1), const eT beta = eT(0) ) { arma_debug_sigprint(); const uword A_n_rows = A.n_rows; const uword A_n_cols = A.n_cols; const uword B_n_rows = B.n_rows; const uword B_n_cols = B.n_cols; if( (do_trans_A == false) && (do_trans_B == false) ) { arma_aligned podarray tmp(A_n_cols); eT* A_rowdata = tmp.memptr(); for(uword row_A=0; row_A < A_n_rows; ++row_A) { tmp.copy_row(A, row_A); for(uword col_B=0; col_B < B_n_cols; ++col_B) { const eT acc = op_dot::direct_dot_arma(B_n_rows, A_rowdata, B.colptr(col_B)); if( (use_alpha == false) && (use_beta == false) ) { C.at(row_A,col_B) = acc; } else if( (use_alpha == true ) && (use_beta == false) ) { C.at(row_A,col_B) = alpha*acc; } else if( (use_alpha == false) && (use_beta == true ) ) { C.at(row_A,col_B) = acc + beta*C.at(row_A,col_B); } else if( (use_alpha == true ) && (use_beta == true ) ) { C.at(row_A,col_B) = alpha*acc + beta*C.at(row_A,col_B); } } } } else if( (do_trans_A == true) && (do_trans_B == false) ) { for(uword col_A=0; col_A < A_n_cols; ++col_A) { // col_A is interpreted as row_A when storing the results in matrix C const eT* A_coldata = A.colptr(col_A); for(uword col_B=0; col_B < B_n_cols; ++col_B) { const eT acc = op_dot::direct_dot_arma(B_n_rows, A_coldata, B.colptr(col_B)); if( (use_alpha == false) && (use_beta == false) ) { C.at(col_A,col_B) = acc; } else if( (use_alpha == true ) && (use_beta == false) ) { C.at(col_A,col_B) = alpha*acc; } else if( (use_alpha == false) && (use_beta == true ) ) { C.at(col_A,col_B) = acc + beta*C.at(col_A,col_B); } else if( (use_alpha == true ) && (use_beta == true ) ) { C.at(col_A,col_B) = alpha*acc + beta*C.at(col_A,col_B); } } } } else if( (do_trans_A == false) && (do_trans_B == true) ) { Mat BB; op_strans::apply_mat_noalias(BB, B); gemm_emul_large::apply(C, A, BB, alpha, beta); } else if( (do_trans_A == true) && (do_trans_B == true) ) { // mat B_tmp = trans(B); // dgemm_arma::apply(C, A, B_tmp, alpha, beta); // By using the trans(A)*trans(B) = trans(B*A) equivalency, // transpose operations are not needed arma_aligned podarray tmp(B.n_cols); eT* B_rowdata = tmp.memptr(); for(uword row_B=0; row_B < B_n_rows; ++row_B) { tmp.copy_row(B, row_B); for(uword col_A=0; col_A < A_n_cols; ++col_A) { const eT acc = op_dot::direct_dot_arma(A_n_rows, B_rowdata, A.colptr(col_A)); if( (use_alpha == false) && (use_beta == false) ) { C.at(col_A,row_B) = acc; } else if( (use_alpha == true ) && (use_beta == false) ) { C.at(col_A,row_B) = alpha*acc; } else if( (use_alpha == false) && (use_beta == true ) ) { C.at(col_A,row_B) = acc + beta*C.at(col_A,row_B); } else if( (use_alpha == true ) && (use_beta == true ) ) { C.at(col_A,row_B) = alpha*acc + beta*C.at(col_A,row_B); } } } } } }; template class gemm_emul { public: template arma_hot inline static void apply ( Mat& C, const TA& A, const TB& B, const eT alpha = eT(1), const eT beta = eT(0), const typename arma_not_cx::result* junk = nullptr ) { arma_debug_sigprint(); arma_ignore(junk); gemm_emul_large::apply(C, A, B, alpha, beta); } template arma_hot inline static void apply ( Mat& C, const Mat& A, const Mat& B, const eT alpha = eT(1), const eT beta = eT(0), const typename arma_cx_only::result* junk = nullptr ) { arma_debug_sigprint(); arma_ignore(junk); // "better than nothing" handling of hermitian transposes for complex number matrices Mat tmp_A; Mat tmp_B; if(do_trans_A) { op_htrans::apply_mat_noalias(tmp_A, A); } if(do_trans_B) { op_htrans::apply_mat_noalias(tmp_B, B); } const Mat& AA = (do_trans_A == false) ? A : tmp_A; const Mat& BB = (do_trans_B == false) ? B : tmp_B; gemm_emul_large::apply(C, AA, BB, alpha, beta); } }; //! \brief //! Wrapper for BLAS dgemm function, using template arguments to control the arguments passed to dgemm. //! Matrix 'C' is assumed to have been set to the correct size (ie. taking into account transposes) template class gemm { public: template inline static void apply_blas_type( Mat& C, const TA& A, const TB& B, const eT alpha = eT(1), const eT beta = eT(0) ) { arma_debug_sigprint(); if( (A.n_rows <= 4) && (A.n_rows == A.n_cols) && (A.n_rows == B.n_rows) && (B.n_rows == B.n_cols) && (is_cx::no) ) { if(do_trans_B == false) { gemm_emul_tinysq::apply(C, A, B, alpha, beta); } else { Mat BB(B.n_rows, B.n_rows, arma_nozeros_indicator()); op_strans::apply_mat_noalias_tinysq(BB, B); gemm_emul_tinysq::apply(C, A, BB, alpha, beta); } } else { #if defined(ARMA_USE_ATLAS) { arma_debug_print("atlas::cblas_gemm()"); arma_conform_assert_atlas_size(A,B); atlas::cblas_gemm ( atlas_CblasColMajor, (do_trans_A) ? ( is_cx::yes ? atlas_CblasConjTrans : atlas_CblasTrans ) : atlas_CblasNoTrans, (do_trans_B) ? ( is_cx::yes ? atlas_CblasConjTrans : atlas_CblasTrans ) : atlas_CblasNoTrans, C.n_rows, C.n_cols, (do_trans_A) ? A.n_rows : A.n_cols, (use_alpha) ? alpha : eT(1), A.mem, (do_trans_A) ? A.n_rows : C.n_rows, B.mem, (do_trans_B) ? C.n_cols : ( (do_trans_A) ? A.n_rows : A.n_cols ), (use_beta) ? beta : eT(0), C.memptr(), C.n_rows ); } #elif defined(ARMA_USE_BLAS) { arma_debug_print("blas::gemm()"); arma_conform_assert_blas_size(A,B); const char trans_A = (do_trans_A) ? ( is_cx::yes ? 'C' : 'T' ) : 'N'; const char trans_B = (do_trans_B) ? ( is_cx::yes ? 'C' : 'T' ) : 'N'; const blas_int m = blas_int(C.n_rows); const blas_int n = blas_int(C.n_cols); const blas_int k = (do_trans_A) ? blas_int(A.n_rows) : blas_int(A.n_cols); const eT local_alpha = (use_alpha) ? alpha : eT(1); const blas_int lda = (do_trans_A) ? k : m; const blas_int ldb = (do_trans_B) ? n : k; const eT local_beta = (use_beta) ? beta : eT(0); arma_debug_print( arma_str::format("blas::gemm(): trans_A: %c") % trans_A ); arma_debug_print( arma_str::format("blas::gemm(): trans_B: %c") % trans_B ); blas::gemm ( &trans_A, &trans_B, &m, &n, &k, &local_alpha, A.mem, &lda, B.mem, &ldb, &local_beta, C.memptr(), &m ); } #else { gemm_emul::apply(C,A,B,alpha,beta); } #endif } } //! immediate multiplication of matrices A and B, storing the result in C template inline static void apply( Mat& C, const TA& A, const TB& B, const eT alpha = eT(1), const eT beta = eT(0) ) { gemm_emul::apply(C,A,B,alpha,beta); } template arma_inline static void apply ( Mat& C, const TA& A, const TB& B, const float alpha = float(1), const float beta = float(0) ) { gemm::apply_blas_type(C,A,B,alpha,beta); } template arma_inline static void apply ( Mat& C, const TA& A, const TB& B, const double alpha = double(1), const double beta = double(0) ) { gemm::apply_blas_type(C,A,B,alpha,beta); } template arma_inline static void apply ( Mat< std::complex >& C, const TA& A, const TB& B, const std::complex alpha = std::complex(1), const std::complex beta = std::complex(0) ) { gemm::apply_blas_type(C,A,B,alpha,beta); } template arma_inline static void apply ( Mat< std::complex >& C, const TA& A, const TB& B, const std::complex alpha = std::complex(1), const std::complex beta = std::complex(0) ) { gemm::apply_blas_type(C,A,B,alpha,beta); } }; //! @} RcppArmadillo/inst/include/armadillo_bits/spsolve_factoriser_bones.hpp0000644000176200001440000000354014413016473026210 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup spsolve_factoriser //! @{ class spsolve_factoriser { private: void_ptr worker_ptr = nullptr; uword elem_type_indicator = 0; uword n_rows = 0; double rcond_value = double(0); template inline void delete_worker(); inline void cleanup(); public: inline ~spsolve_factoriser(); inline spsolve_factoriser(); inline void reset(); inline double rcond() const; template inline bool factorise(const SpBase& A_expr, const spsolve_opts_base& settings = spsolve_opts_none(), const typename arma_blas_type_only::result* junk = nullptr); template inline bool solve(Mat& X, const Base& B_expr, const typename arma_blas_type_only::result* junk = nullptr); inline spsolve_factoriser(const spsolve_factoriser&) = delete; inline void operator= (const spsolve_factoriser&) = delete; }; //! @} RcppArmadillo/inst/include/armadillo_bits/glue_relational_bones.hpp0000644000176200001440000000672014301267043025442 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup glue_relational //! @{ class glue_rel_lt : public traits_glue_or { public: template inline static void apply(Mat & out, const mtGlue& X); template inline static void apply(Cube & out, const mtGlueCube& X); }; class glue_rel_gt : public traits_glue_or { public: template inline static void apply(Mat & out, const mtGlue& X); template inline static void apply(Cube & out, const mtGlueCube& X); }; class glue_rel_lteq : public traits_glue_or { public: template inline static void apply(Mat & out, const mtGlue& X); template inline static void apply(Cube & out, const mtGlueCube& X); }; class glue_rel_gteq : public traits_glue_or { public: template inline static void apply(Mat & out, const mtGlue& X); template inline static void apply(Cube & out, const mtGlueCube& X); }; class glue_rel_eq : public traits_glue_or { public: template inline static void apply(Mat & out, const mtGlue& X); template inline static void apply(Cube & out, const mtGlueCube& X); }; class glue_rel_noteq : public traits_glue_or { public: template inline static void apply(Mat & out, const mtGlue& X); template inline static void apply(Cube & out, const mtGlueCube& X); }; class glue_rel_and : public traits_glue_or { public: template inline static void apply(Mat & out, const mtGlue& X); template inline static void apply(Cube & out, const mtGlueCube& X); }; class glue_rel_or : public traits_glue_or { public: template inline static void apply(Mat & out, const mtGlue& X); template inline static void apply(Cube & out, const mtGlueCube& X); }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_sp_nonzeros_meat.hpp0000644000176200001440000000406015030507611025162 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_sp_nonzeros //! @{ template inline void op_sp_nonzeros::apply(Mat& out, const SpToDOp& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; if(is_SpMat::value || is_SpMat::stored_type>::value) { const unwrap_spmat U(X.m); out.set_size(U.M.n_nonzero,1); arrayops::copy(out.memptr(), U.M.values, U.M.n_nonzero); return; } if(is_SpSubview::value) { const SpSubview& sv = reinterpret_cast< const SpSubview& >(X.m); if(sv.n_rows == sv.m.n_rows) { arma_debug_print("op_sp_nonzeros::apply(): SpSubview optimisation"); const SpMat& m = sv.m; const uword col = sv.aux_col1; const uword N = sv.n_nonzero; out.set_size(N, 1); arrayops::copy(out.memptr(), &(m.values[ m.col_ptrs[col] ]), N); return; } } const SpProxy P(X.m); const uword N = P.get_n_nonzero(); out.set_size(N,1); if(N == 0) { return; } eT* out_mem = out.memptr(); typename SpProxy::const_iterator_type it = P.begin(); for(uword i=0; i arma_warn_unused inline typename enable_if2< is_arma_type::value && resolves_to_vector::yes, uword>::result index_max(const T1& X) { arma_debug_sigprint(); return X.index_max(); } template arma_warn_unused arma_inline typename enable_if2< is_arma_type::value && resolves_to_vector::no, const mtOp >::result index_max(const T1& X) { arma_debug_sigprint(); return mtOp(X, 0, 0); } template arma_warn_unused arma_inline typename enable_if2< is_arma_type::value, const mtOp >::result index_max(const T1& X, const uword dim) { arma_debug_sigprint(); return mtOp(X, dim, 0); } template arma_warn_unused arma_inline const mtOpCube index_max ( const BaseCube& X, const uword dim = 0 ) { arma_debug_sigprint(); return mtOpCube(X.get_ref(), dim, 0, 0); } template arma_warn_unused inline typename enable_if2 < is_arma_sparse_type::value && resolves_to_sparse_vector::yes, typename T1::elem_type >::result index_max(const T1& x) { arma_debug_sigprint(); return x.index_max(); } template arma_warn_unused inline typename enable_if2 < is_arma_sparse_type::value && resolves_to_sparse_vector::no, Mat >::result index_max(const T1& X) { arma_debug_sigprint(); Mat out; op_index_max::apply(out, X, 0); return out; } template arma_warn_unused inline typename enable_if2 < is_arma_sparse_type::value, Mat >::result index_max(const T1& X, const uword dim) { arma_debug_sigprint(); Mat out; op_index_max::apply(out, X, dim); return out; } arma_warn_unused inline uword index_max(const SizeMat& s) { return (s.n_rows >= s.n_cols) ? uword(0) : uword(1); } arma_warn_unused inline uword index_max(const SizeCube& s) { const uword tmp_val = (s.n_rows >= s.n_cols) ? s.n_rows : s.n_cols; const uword tmp_index = (s.n_rows >= s.n_cols) ? uword(0) : uword(1); return (tmp_val >= s.n_slices) ? tmp_index : uword(2); } //! @} RcppArmadillo/inst/include/armadillo_bits/compiler_setup.hpp0000644000176200001440000003633415030507543024146 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ #undef arma_hot #undef arma_cold #undef arma_aligned #undef arma_align_mem #undef arma_warn_unused #undef arma_deprecated #undef arma_frown #undef arma_malloc #undef arma_inline #undef arma_noinline #undef arma_ignore #define arma_hot #define arma_cold #define arma_aligned #define arma_align_mem #define arma_warn_unused #define arma_deprecated #define arma_frown(msg) #define arma_malloc #define arma_inline inline #define arma_noinline #define arma_ignore(variable) ((void)(variable)) #undef arma_fortran_sans_prefix_B #undef arma_fortran_with_prefix_B #if defined(ARMA_BLAS_UNDERSCORE) #define arma_fortran_sans_prefix_B(function) function##_ #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) #define arma_fortran_with_prefix_B(function) wrapper2_##function##_ #else #define arma_fortran_with_prefix_B(function) wrapper_##function##_ #endif #else #define arma_fortran_sans_prefix_B(function) function #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) #define arma_fortran_with_prefix_B(function) wrapper2_##function #else #define arma_fortran_with_prefix_B(function) wrapper_##function #endif #endif #undef arma_fortran #undef arma_wrapper #if defined(ARMA_USE_WRAPPER) #define arma_fortran(function) arma_fortran_with_prefix_B(function) #define arma_wrapper(function) wrapper_##function #else #define arma_fortran(function) arma_fortran_sans_prefix_B(function) #define arma_wrapper(function) function #endif #undef arma_fortran_sans_prefix #undef arma_fortran_with_prefix #define arma_fortran_sans_prefix(function) arma_fortran_sans_prefix_B(function) #define arma_fortran_with_prefix(function) arma_fortran_with_prefix_B(function) #undef ARMA_INCFILE_WRAP #define ARMA_INCFILE_WRAP(x) #if !defined(ARMA_32BIT_WORD) #undef ARMA_64BIT_WORD #define ARMA_64BIT_WORD #endif #if defined(ARMA_64BIT_WORD) && defined(SIZE_MAX) #if (SIZE_MAX < 0xFFFFFFFFFFFFFFFFull) // #pragma message ("WARNING: disabled use of 64 bit integers, as std::size_t is smaller than 64 bits") #undef ARMA_64BIT_WORD #endif #endif // most compilers can't vectorise slightly elaborate loops; // for example clang: http://llvm.org/bugs/show_bug.cgi?id=16358 #undef ARMA_SIMPLE_LOOPS #define ARMA_SIMPLE_LOOPS #undef ARMA_GOOD_COMPILER // posix_memalign() is part of IEEE standard 1003.1 // http://pubs.opengroup.org/onlinepubs/009696899/functions/posix_memalign.html // http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/unistd.h.html // http://sourceforge.net/p/predef/wiki/Standards/ #if ( defined(_POSIX_ADVISORY_INFO) && (_POSIX_ADVISORY_INFO >= 200112L) ) #undef ARMA_HAVE_POSIX_MEMALIGN #define ARMA_HAVE_POSIX_MEMALIGN #endif #if defined(__APPLE__) || defined(__apple_build_version__) // NOTE: Apple accelerate framework has broken implementations of functions that return a float value, // NOTE: such as sdot(), slange(), clange(), slansy(), clanhe(), slangb(), snrm2(), sasum() #undef ARMA_BLAS_FLOAT_BUG #define ARMA_BLAS_FLOAT_BUG // #undef ARMA_HAVE_POSIX_MEMALIGN // NOTE: posix_memalign() is available since macOS 10.6 (late 2009 onwards) #endif #if defined(__MINGW32__) || defined(__CYGWIN__) || defined(_MSC_VER) #undef ARMA_HAVE_POSIX_MEMALIGN #endif #undef ARMA_FNSIG #if defined (__GNUG__) #define ARMA_FNSIG __PRETTY_FUNCTION__ #elif defined (_MSC_VER) #define ARMA_FNSIG __FUNCSIG__ #elif defined(__INTEL_COMPILER) #define ARMA_FNSIG __FUNCTION__ #else #define ARMA_FNSIG __func__ #endif #if !defined(ARMA_ALLOW_FAKE_GCC) #if (defined(__GNUG__) || defined(__GNUC__)) && (defined(__INTEL_COMPILER) || defined(__NVCC__) || defined(__CUDACC__) || defined(__PGI) || defined(__PATHSCALE__) || defined(__ARMCC_VERSION) || defined(__IBMCPP__)) #undef ARMA_DETECTED_FAKE_GCC #define ARMA_DETECTED_FAKE_GCC #pragma message ("WARNING: this compiler is pretending to be GCC but it may not be fully compatible;") #pragma message ("WARNING: to allow this compiler to use GCC features such as data alignment attributes,") #pragma message ("WARNING: #define ARMA_ALLOW_FAKE_GCC before #include ") #endif #endif #if defined(__GNUG__) && (!defined(__clang__) && !defined(ARMA_DETECTED_FAKE_GCC)) // #pragma message ("using GCC extensions") #undef ARMA_GCC_VERSION #define ARMA_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) #if (ARMA_GCC_VERSION < 60100) #error "*** newer compiler required; need gcc 6.1 or newer ***" #endif // gcc 6.1 has proper C++14 support and fixes an OpenMP related bug: // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57580 #if (ARMA_GCC_VERSION < 80100) #pragma message("INFO: support for GCC versions older than 8.1 is deprecated") #endif #if (ARMA_GCC_VERSION >= 170000) #undef ARMA_IGNORE_DEPRECATED_MARKER #endif #define ARMA_GOOD_COMPILER #undef arma_hot #undef arma_cold #undef arma_aligned #undef arma_align_mem #undef arma_warn_unused #undef arma_deprecated #undef arma_frown #undef arma_malloc #undef arma_inline #undef arma_noinline #define arma_hot __attribute__((__hot__)) #define arma_cold __attribute__((__cold__)) #define arma_aligned __attribute__((__aligned__)) #define arma_align_mem __attribute__((__aligned__(16))) #define arma_warn_unused __attribute__((__warn_unused_result__)) #define arma_deprecated __attribute__((__deprecated__)) #define arma_frown(msg) __attribute__((__deprecated__(msg))) #define arma_malloc __attribute__((__malloc__)) #define arma_inline __attribute__((__always_inline__)) inline #define arma_noinline __attribute__((__noinline__)) #undef ARMA_HAVE_ALIGNED_ATTRIBUTE #define ARMA_HAVE_ALIGNED_ATTRIBUTE #undef ARMA_HAVE_GCC_ASSUME_ALIGNED #define ARMA_HAVE_GCC_ASSUME_ALIGNED // gcc's vectoriser can handle elaborate loops #undef ARMA_SIMPLE_LOOPS #if defined(__OPTIMIZE_SIZE__) #define ARMA_SIMPLE_LOOPS #endif #endif // TODO: __INTEL_CLANG_COMPILER indicates the clang based intel compiler, distinct from the classic intel compiler #if !defined(ARMA_ALLOW_FAKE_CLANG) #if defined(__clang__) && (defined(__INTEL_COMPILER) || defined(__NVCC__) || defined(__CUDACC__) || defined(__PGI) || defined(__PATHSCALE__) || defined(__ARMCC_VERSION) || defined(__IBMCPP__)) #undef ARMA_DETECTED_FAKE_CLANG #define ARMA_DETECTED_FAKE_CLANG #pragma message ("WARNING: this compiler is pretending to be Clang but it may not be fully compatible;") #pragma message ("WARNING: to allow this compiler to use Clang features such as data alignment attributes,") #pragma message ("WARNING: #define ARMA_ALLOW_FAKE_CLANG before #include ") #endif #endif #if defined(__clang__) && !defined(ARMA_DETECTED_FAKE_CLANG) // #pragma message ("using Clang extensions") #if defined(__clang_major__) && !defined(__apple_build_version__) #if (__clang_major__ >= 24) #undef ARMA_IGNORE_DEPRECATED_MARKER #endif #endif #define ARMA_GOOD_COMPILER #if !defined(__has_attribute) #define __has_attribute(x) 0 #endif #if __has_attribute(__aligned__) #undef arma_aligned #undef arma_align_mem #define arma_aligned __attribute__((__aligned__)) #define arma_align_mem __attribute__((__aligned__(16))) #undef ARMA_HAVE_ALIGNED_ATTRIBUTE #define ARMA_HAVE_ALIGNED_ATTRIBUTE #endif #if __has_attribute(__warn_unused_result__) #undef arma_warn_unused #define arma_warn_unused __attribute__((__warn_unused_result__)) #endif #if __has_attribute(__deprecated__) #undef arma_deprecated #define arma_deprecated __attribute__((__deprecated__)) #endif #if __has_attribute(__deprecated__) #undef arma_frown #define arma_frown(msg) __attribute__((__deprecated__(msg))) #endif #if __has_attribute(__malloc__) #undef arma_malloc #define arma_malloc __attribute__((__malloc__)) #endif #if __has_attribute(__always_inline__) #undef arma_inline #define arma_inline __attribute__((__always_inline__)) inline #endif #if __has_attribute(__noinline__) #undef arma_noinline #define arma_noinline __attribute__((__noinline__)) #endif #if __has_attribute(__hot__) #undef arma_hot #define arma_hot __attribute__((__hot__)) #endif #if __has_attribute(__cold__) #undef arma_cold #define arma_cold __attribute__((__cold__)) #elif __has_attribute(__minsize__) #undef arma_cold #define arma_cold __attribute__((__minsize__)) #endif #if defined(__has_builtin) && __has_builtin(__builtin_assume_aligned) #undef ARMA_HAVE_GCC_ASSUME_ALIGNED #define ARMA_HAVE_GCC_ASSUME_ALIGNED #endif #endif #if defined(__INTEL_COMPILER) #if (__INTEL_COMPILER == 9999) #error "*** newer compiler required ***" #endif #if (__INTEL_COMPILER < 1600) #error "*** newer compiler required ***" #endif #undef ARMA_HAVE_GCC_ASSUME_ALIGNED #endif #if defined(_MSC_VER) #if (_MSC_VER < 1910) #error "*** newer compiler required ***" #endif #undef arma_deprecated #define arma_deprecated __declspec(deprecated) #undef arma_noinline #define arma_noinline __declspec(noinline) #pragma warning(push) #pragma warning(disable: 4127) // conditional expression is constant #pragma warning(disable: 4146) // unary minus operator applied to unsigned type, result still unsigned #pragma warning(disable: 4180) // qualifier has no meaning #pragma warning(disable: 4244) // possible loss of data when converting types (see also 4305) #pragma warning(disable: 4510) // default constructor could not be generated #pragma warning(disable: 4511) // copy constructor can't be generated #pragma warning(disable: 4512) // assignment operator can't be generated #pragma warning(disable: 4513) // destructor can't be generated #pragma warning(disable: 4514) // unreferenced inline function has been removed #pragma warning(disable: 4519) // default template args are only allowed on a class template (C++11) #pragma warning(disable: 4522) // multiple assignment operators specified #pragma warning(disable: 4623) // default constructor can't be generated #pragma warning(disable: 4624) // destructor can't be generated #pragma warning(disable: 4625) // copy constructor can't be generated #pragma warning(disable: 4626) // assignment operator can't be generated #pragma warning(disable: 4702) // unreachable code #pragma warning(disable: 4710) // function not inlined #pragma warning(disable: 4711) // call was inlined #pragma warning(disable: 4714) // __forceinline can't be inlined #pragma warning(disable: 4800) // value forced to bool #if defined(ARMA_HAVE_CXX17) #pragma warning(disable: 26812) // unscoped enum #pragma warning(disable: 26819) // unannotated fallthrough #endif // #if (_MANAGED == 1) || (_M_CEE == 1) // // // don't do any alignment when compiling in "managed code" mode // // #undef arma_aligned // #define arma_aligned // // #undef arma_align_mem // #define arma_align_mem // // #elif (_MSC_VER >= 1700) // // #undef arma_align_mem // #define arma_align_mem __declspec(align(16)) // // #define ARMA_HAVE_ALIGNED_ATTRIBUTE // // // disable warnings: "structure was padded due to __declspec(align(16))" // #pragma warning(disable: 4324) // // #endif #endif #if defined(ARMA_HAVE_CXX14) #undef arma_deprecated #define arma_deprecated [[deprecated]] #undef arma_frown #define arma_frown(msg) [[deprecated(msg)]] #endif #if defined(ARMA_HAVE_CXX17) #undef arma_warn_unused #define arma_warn_unused [[nodiscard]] #endif #if !defined(ARMA_DONT_USE_OPENMP) #if (defined(_OPENMP) && (_OPENMP >= 201107)) #undef ARMA_USE_OPENMP #define ARMA_USE_OPENMP #endif #endif #if ( defined(ARMA_USE_OPENMP) && (!defined(_OPENMP) || (defined(_OPENMP) && (_OPENMP < 201107))) ) // OpenMP 3.0 required for parallelisation of loops with unsigned integers // OpenMP 3.1 required for atomic read and atomic write #undef ARMA_USE_OPENMP #undef ARMA_PRINT_OPENMP_WARNING #define ARMA_PRINT_OPENMP_WARNING #endif #if defined(ARMA_PRINT_OPENMP_WARNING) && !defined(ARMA_DONT_PRINT_OPENMP_WARNING) #pragma message ("WARNING: use of OpenMP disabled; compiler support for OpenMP 3.1+ not detected") #if (defined(_OPENMP) && (_OPENMP < 201107)) #pragma message ("NOTE: your compiler has an outdated version of OpenMP") #pragma message ("NOTE: consider upgrading to a better compiler") #endif #endif #if (defined(__FAST_MATH__) || (defined(__FINITE_MATH_ONLY__) && (__FINITE_MATH_ONLY__ > 0)) || defined(_M_FP_FAST)) #undef ARMA_FAST_MATH #define ARMA_FAST_MATH #endif #if defined(ARMA_FAST_MATH) && !defined(ARMA_DONT_PRINT_FAST_MATH_WARNING) #pragma message ("WARNING: compiler is in fast math mode; some functions may be unreliable.") #pragma message ("WARNING: to suppress this warning and related warnings,") #pragma message ("WARNING: #define ARMA_DONT_PRINT_FAST_MATH_WARNING before #include ") #endif #if ( (defined(_WIN32) || defined(_WIN64) || defined(_MSC_VER)) && (!defined(__MINGW32__) && !defined(__MINGW64__)) ) #undef ARMA_PRINT_EXCEPTIONS_INTERNAL #define ARMA_PRINT_EXCEPTIONS_INTERNAL #endif #if (defined(ARMA_ALIEN_MEM_ALLOC_FUNCTION) && !defined(ARMA_ALIEN_MEM_FREE_FUNCTION)) || (!defined(ARMA_ALIEN_MEM_ALLOC_FUNCTION) && defined(ARMA_ALIEN_MEM_FREE_FUNCTION)) #error "*** both ARMA_ALIEN_MEM_ALLOC_FUNCTION and ARMA_ALIEN_MEM_FREE_FUNCTION must be defined ***" #endif // cleanup #undef ARMA_DETECTED_FAKE_GCC #undef ARMA_DETECTED_FAKE_CLANG #undef ARMA_GCC_VERSION #undef ARMA_PRINT_OPENMP_WARNING // undefine conflicting macros #if defined(log2) #undef log2 #pragma message ("WARNING: undefined conflicting 'log2' macro") #endif #if defined(check) #undef check #pragma message ("WARNING: undefined conflicting 'check' macro") #endif #if defined(min) || defined(max) #undef min #undef max #pragma message ("WARNING: undefined conflicting 'min' and/or 'max' macros") #endif // https://sourceware.org/bugzilla/show_bug.cgi?id=19239 #undef minor #undef major // WARNING: option 'ARMA_IGNORE_DEPRECATED_MARKER' is not supported when compiling with gcc 17+ or clang 24+ // WARNING: disabling deprecation messages is counter-productive #if defined(ARMA_IGNORE_DEPRECATED_MARKER) #undef arma_deprecated #define arma_deprecated #undef arma_frown #define arma_frown(msg) #endif RcppArmadillo/inst/include/armadillo_bits/mtSpOp_bones.hpp0000644000176200001440000000436315030507611023515 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup mtSpOp //! @{ struct mtSpOp_dual_aux_indicator {}; template class mtSpOp : public SpBase< out_eT, mtSpOp > { public: typedef out_eT elem_type; typedef typename get_pod_type::result pod_type; typedef typename T1::elem_type in_eT; static constexpr bool is_row = spop_type::template traits::is_row; static constexpr bool is_col = spop_type::template traits::is_col; static constexpr bool is_xvec = spop_type::template traits::is_xvec; inline explicit mtSpOp(const T1& in_m); inline mtSpOp(const T1& in_m, const in_eT in_aux); inline mtSpOp(const T1& in_m, const uword aux_uword_a, const uword aux_uword_b); inline mtSpOp(const char junk, const T1& in_m, const out_eT in_aux); inline mtSpOp(const mtSpOp_dual_aux_indicator&, const T1& in_m, const in_eT in_aux_a, const out_eT in_aux_b); inline ~mtSpOp(); template arma_inline bool is_alias(const SpMat& X) const; const T1& m; //!< the operand; must be derived from SpBase in_eT aux; //!< auxiliary data, using the element type as used by T1 out_eT aux_out_eT; //!< auxiliary data, using the element type as specified by the out_eT template parameter uword aux_uword_a; uword aux_uword_b; }; //! @} RcppArmadillo/inst/include/armadillo_bits/fn_spones.hpp0000644000176200001440000000254714631567470023120 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_spones //! @{ //! Generate a sparse matrix with the non-zero values in the same locations as in the given sparse matrix X, //! with the non-zero values set to one template arma_warn_unused inline SpMat spones(const SpBase& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const unwrap_spmat U(X.get_ref()); SpMat out(arma_layout_indicator(), U.M); arrayops::inplace_set( access::rwp(out.values), eT(1), out.n_nonzero ); return out; } //! @} RcppArmadillo/inst/include/armadillo_bits/mtOp_meat.hpp0000644000176200001440000000526214715372502023041 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup mtOp //! @{ template inline mtOp::mtOp(const T1& in_m) : m(in_m) { arma_debug_sigprint(); } template inline mtOp::mtOp(const T1& in_m, const typename T1::elem_type in_aux) : m(in_m) , aux(in_aux) { arma_debug_sigprint(); } template inline mtOp::mtOp(const T1& in_m, const uword in_aux_uword_a, const uword in_aux_uword_b) : m(in_m) , aux_uword_a(in_aux_uword_a) , aux_uword_b(in_aux_uword_b) { arma_debug_sigprint(); } template inline mtOp::mtOp(const T1& in_m, const typename T1::elem_type in_aux, const uword in_aux_uword_a, const uword in_aux_uword_b) : m(in_m) , aux(in_aux) , aux_uword_a(in_aux_uword_a) , aux_uword_b(in_aux_uword_b) { arma_debug_sigprint(); } template inline mtOp::mtOp(const char junk, const T1& in_m, const out_eT in_aux) : m(in_m) , aux_out_eT(in_aux) { arma_ignore(junk); arma_debug_sigprint(); } template inline mtOp::mtOp(const mtOp_dual_aux_indicator&, const T1& in_m, const typename T1::elem_type in_aux_a, const out_eT in_aux_b) : m (in_m ) , aux (in_aux_a) , aux_out_eT(in_aux_b) { arma_debug_sigprint(); } template inline mtOp::~mtOp() { arma_debug_sigprint(); } template template inline bool mtOp::is_alias(const Mat& X) const { arma_debug_sigprint(); return m.is_alias(X); } //! @} RcppArmadillo/inst/include/armadillo_bits/spop_reverse_bones.hpp0000644000176200001440000000240014301267044025000 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup spop_reverse //! @{ class spop_reverse : public traits_op_passthru { public: template inline static void apply_spmat(SpMat& out, const SpMat& X, const uword dim); template inline static void apply_proxy(SpMat& out, const T1& X, const uword dim); template inline static void apply(SpMat& out, const SpOp& in); }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_htrans_meat.hpp0000644000176200001440000002137714752446051024126 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_htrans //! @{ template inline void op_htrans::apply_mat_noalias(Mat& out, const Mat& A, const typename arma_not_cx::result* junk) { arma_debug_sigprint(); arma_ignore(junk); op_strans::apply_mat_noalias(out, A); } template inline void op_htrans::apply_mat_noalias(Mat& out, const Mat& A, const typename arma_cx_only::result* junk) { arma_debug_sigprint(); arma_ignore(junk); const uword A_n_rows = A.n_rows; const uword A_n_cols = A.n_cols; out.set_size(A_n_cols, A_n_rows); if( (A_n_cols == 1) || (A_n_rows == 1) ) { const uword n_elem = A.n_elem; const eT* A_mem = A.memptr(); eT* out_mem = out.memptr(); for(uword i=0; i < n_elem; ++i) { out_mem[i] = std::conj(A_mem[i]); } } else if( (A_n_rows >= 512) && (A_n_cols >= 512) ) { op_htrans::apply_mat_noalias_large(out, A); } else { eT* outptr = out.memptr(); for(uword k=0; k < A_n_rows; ++k) { const eT* Aptr = &(A.at(k,0)); for(uword j=0; j < A_n_cols; ++j) { (*outptr) = std::conj(*Aptr); Aptr += A_n_rows; outptr++; } } } } template inline void op_htrans::block_worker(std::complex* Y, const std::complex* X, const uword X_n_rows, const uword Y_n_rows, const uword n_rows, const uword n_cols) { for(uword row = 0; row < n_rows; ++row) { const uword Y_offset = row * Y_n_rows; for(uword col = 0; col < n_cols; ++col) { const uword X_offset = col * X_n_rows; Y[col + Y_offset] = std::conj(X[row + X_offset]); } } } template inline void op_htrans::apply_mat_noalias_large(Mat< std::complex >& out, const Mat< std::complex >& A) { arma_debug_sigprint(); const uword n_rows = A.n_rows; const uword n_cols = A.n_cols; const uword block_size = 64; const uword n_rows_base = block_size * (n_rows / block_size); const uword n_cols_base = block_size * (n_cols / block_size); const uword n_rows_extra = n_rows - n_rows_base; const uword n_cols_extra = n_cols - n_cols_base; const std::complex* X = A.memptr(); std::complex* Y = out.memptr(); for(uword row = 0; row < n_rows_base; row += block_size) { const uword Y_offset = row * n_cols; for(uword col = 0; col < n_cols_base; col += block_size) { const uword X_offset = col * n_rows; op_htrans::block_worker(&Y[col + Y_offset], &X[row + X_offset], n_rows, n_cols, block_size, block_size); } const uword X_offset = n_cols_base * n_rows; op_htrans::block_worker(&Y[n_cols_base + Y_offset], &X[row + X_offset], n_rows, n_cols, block_size, n_cols_extra); } if(n_rows_extra == 0) { return; } const uword Y_offset = n_rows_base * n_cols; for(uword col = 0; col < n_cols_base; col += block_size) { const uword X_offset = col * n_rows; op_htrans::block_worker(&Y[col + Y_offset], &X[n_rows_base + X_offset], n_rows, n_cols, n_rows_extra, block_size); } const uword X_offset = n_cols_base * n_rows; op_htrans::block_worker(&Y[n_cols_base + Y_offset], &X[n_rows_base + X_offset], n_rows, n_cols, n_rows_extra, n_cols_extra); } template inline void op_htrans::apply_mat_inplace(Mat& out, const typename arma_not_cx::result* junk) { arma_debug_sigprint(); arma_ignore(junk); op_strans::apply_mat_inplace(out); } template inline void op_htrans::apply_mat_inplace(Mat& out, const typename arma_cx_only::result* junk) { arma_debug_sigprint(); arma_ignore(junk); const uword n_rows = out.n_rows; const uword n_cols = out.n_cols; if(n_rows == n_cols) { arma_debug_print("doing in-place hermitian transpose of a square matrix"); for(uword col=0; col < n_cols; ++col) { eT* coldata = out.colptr(col); out.at(col,col) = std::conj( out.at(col,col) ); for(uword row=(col+1); row < n_rows; ++row) { const eT val1 = std::conj(coldata[row]); const eT val2 = std::conj(out.at(col,row)); out.at(col,row) = val1; coldata[row] = val2; } } } else { Mat tmp; op_htrans::apply_mat_noalias(tmp, out); out.steal_mem(tmp); } } template inline void op_htrans::apply_mat(Mat& out, const Mat& A, const typename arma_not_cx::result* junk) { arma_debug_sigprint(); arma_ignore(junk); op_strans::apply_mat(out, A); } template inline void op_htrans::apply_mat(Mat& out, const Mat& A, const typename arma_cx_only::result* junk) { arma_debug_sigprint(); arma_ignore(junk); if(&out != &A) { op_htrans::apply_mat_noalias(out, A); } else { op_htrans::apply_mat_inplace(out); } } template inline void op_htrans::apply_proxy(Mat& out, const Proxy& P) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword n_rows = P.get_n_rows(); const uword n_cols = P.get_n_cols(); if( (resolves_to_vector::yes) && (Proxy::use_at == false) ) { out.set_size(n_cols, n_rows); eT* out_mem = out.memptr(); const uword n_elem = P.get_n_elem(); typename Proxy::ea_type Pea = P.get_ea(); for(uword i=0; i < n_elem; ++i) { out_mem[i] = std::conj(Pea[i]); } } else { out.set_size(n_cols, n_rows); eT* outptr = out.memptr(); for(uword k=0; k < n_rows; ++k) { for(uword j=0; j < n_cols; ++j) { (*outptr) = std::conj(P.at(k,j)); outptr++; } } } } template inline void op_htrans::apply_direct(Mat& out, const T1& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; // allow detection of in-place transpose if(is_Mat::value) { const unwrap U(X); op_htrans::apply_mat(out, U.M); } else if((is_Mat::stored_type>::value) || (arma_config::openmp && Proxy::use_mp)) { const quasi_unwrap U(X); if(U.is_alias(out)) { Mat tmp; op_htrans::apply_mat_noalias(tmp, U.M); out.steal_mem(tmp); } else { op_htrans::apply_mat_noalias(out, U.M); } } else { const Proxy P(X); if(P.is_alias(out)) { Mat tmp; op_htrans::apply_proxy(tmp, P); out.steal_mem(tmp); } else { op_htrans::apply_proxy(out, P); } } } template inline void op_htrans::apply(Mat& out, const Op& in, const typename arma_not_cx::result* junk) { arma_debug_sigprint(); arma_ignore(junk); op_strans::apply_direct(out, in.m); } template inline void op_htrans::apply(Mat& out, const Op& in, const typename arma_cx_only::result* junk) { arma_debug_sigprint(); arma_ignore(junk); op_htrans::apply_direct(out, in.m); } // // op_htrans2 template inline void op_htrans2::apply(Mat& out, const Op& in, const typename arma_not_cx::result* junk) { arma_debug_sigprint(); arma_ignore(junk); op_strans::apply_direct(out, in.m); arrayops::inplace_mul(out.memptr(), in.aux, out.n_elem); } template inline void op_htrans2::apply(Mat& out, const Op& in, const typename arma_cx_only::result* junk) { arma_debug_sigprint(); arma_ignore(junk); op_htrans::apply_direct(out, in.m); arrayops::inplace_mul(out.memptr(), in.aux, out.n_elem); } //! @} RcppArmadillo/inst/include/armadillo_bits/spglue_max_bones.hpp0000644000176200001440000000330614301267044024436 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup spglue_max //! @{ class spglue_max : public traits_glue_or { public: template inline static void apply(SpMat& out, const SpGlue& X); template inline static void apply_noalias(SpMat& out, const SpProxy& pa, const SpProxy& pb); template inline static void apply_noalias(SpMat& out, const SpMat& A, const SpMat& B); template inline static void dense_sparse_max(Mat& out, const Base& X, const SpBase& Y); template inline static typename enable_if2::no, eT>::result elem_max(const eT& a, const eT& b); template inline static typename enable_if2::yes, eT>::result elem_max(const eT& a, const eT& b); }; //! @} RcppArmadillo/inst/include/armadillo_bits/glue_hypot_bones.hpp0000644000176200001440000000300014301267043024437 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup glue_hypot //! @{ class glue_hypot : public traits_glue_or { public: // matrices template inline static void apply(Mat& out, const Glue& expr); template inline static void apply_noalias(Mat& out, const Proxy& P1, const Proxy& P2); // cubes template inline static void apply(Cube& out, const GlueCube& expr); template inline static void apply_noalias(Cube& out, const ProxyCube& P1, const ProxyCube& P2); }; //! @} RcppArmadillo/inst/include/armadillo_bits/fn_sum.hpp0000644000176200001440000000552414634016465022407 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_sum //! @{ template arma_warn_unused inline typename enable_if2< is_arma_type::value && resolves_to_vector::yes, typename T1::elem_type >::result sum(const T1& X) { arma_debug_sigprint(); return accu(X); } template arma_warn_unused arma_inline typename enable_if2< is_arma_type::value && resolves_to_vector::no, const Op >::result sum(const T1& X) { arma_debug_sigprint(); return Op(X, 0, 0); } template arma_warn_unused arma_inline typename enable_if2< is_arma_type::value, const Op >::result sum(const T1& X, const uword dim) { arma_debug_sigprint(); return Op(X, dim, 0); } template arma_warn_unused arma_inline typename arma_scalar_only::result sum(const T& x) { return x; } //! sum of cube template arma_warn_unused arma_inline const OpCube sum ( const BaseCube& X, const uword dim = 0 ) { arma_debug_sigprint(); return OpCube(X.get_ref(), dim, 0); } //! sum of sparse object template arma_warn_unused inline typename enable_if2 < is_arma_sparse_type::value && resolves_to_sparse_vector::yes, typename T1::elem_type >::result sum(const T1& x) { arma_debug_sigprint(); // sum elements return accu(x); } template arma_warn_unused inline typename enable_if2 < is_arma_sparse_type::value && resolves_to_sparse_vector::no, const mtSpReduceOp >::result sum(const T1& x) { arma_debug_sigprint(); return mtSpReduceOp(x, 0, 0); } template arma_warn_unused inline typename enable_if2 < is_arma_sparse_type::value, const mtSpReduceOp >::result sum(const T1& x, const uword dim) { arma_debug_sigprint(); return mtSpReduceOp(x, dim, 0); } //! @} RcppArmadillo/inst/include/armadillo_bits/SpMat_meat.hpp0000644000176200001440000044214515030507611023143 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup SpMat //! @{ /** * Initialize a sparse matrix with size 0x0 (empty). */ template inline SpMat::SpMat() : n_rows(0) , n_cols(0) , n_elem(0) , n_nonzero(0) , vec_state(0) , values(nullptr) , row_indices(nullptr) , col_ptrs(nullptr) { arma_debug_sigprint_this(this); init_cold(0,0); } /** * Clean up the memory of a sparse matrix and destruct it. */ template inline SpMat::~SpMat() { arma_debug_sigprint_this(this); if(values ) { memory::release(access::rw(values)); } if(row_indices) { memory::release(access::rw(row_indices)); } if(col_ptrs ) { memory::release(access::rw(col_ptrs)); } } /** * Constructor with size given. */ template inline SpMat::SpMat(const uword in_rows, const uword in_cols) : n_rows(0) , n_cols(0) , n_elem(0) , n_nonzero(0) , vec_state(0) , values(nullptr) , row_indices(nullptr) , col_ptrs(nullptr) { arma_debug_sigprint_this(this); init_cold(in_rows, in_cols); } template inline SpMat::SpMat(const SizeMat& s) : n_rows(0) , n_cols(0) , n_elem(0) , n_nonzero(0) , vec_state(0) , values(nullptr) , row_indices(nullptr) , col_ptrs(nullptr) { arma_debug_sigprint_this(this); init_cold(s.n_rows, s.n_cols); } template inline SpMat::SpMat(const arma_reserve_indicator&, const uword in_rows, const uword in_cols, const uword new_n_nonzero) : n_rows(0) , n_cols(0) , n_elem(0) , n_nonzero(0) , vec_state(0) , values(nullptr) , row_indices(nullptr) , col_ptrs(nullptr) { arma_debug_sigprint_this(this); init_cold(in_rows, in_cols, new_n_nonzero); } template template inline SpMat::SpMat(const arma_layout_indicator&, const SpMat& x) : n_rows(0) , n_cols(0) , n_elem(0) , n_nonzero(0) , vec_state(0) , values(nullptr) , row_indices(nullptr) , col_ptrs(nullptr) { arma_debug_sigprint_this(this); init_cold(x.n_rows, x.n_cols, x.n_nonzero); if(x.n_nonzero == 0) { return; } if(x.row_indices) { arrayops::copy(access::rwp(row_indices), x.row_indices, x.n_nonzero + 1); } if(x.col_ptrs ) { arrayops::copy(access::rwp(col_ptrs), x.col_ptrs, x.n_cols + 1); } // NOTE: 'values' array is not initialised } /** * Assemble from text. */ template inline SpMat::SpMat(const char* text) : n_rows(0) , n_cols(0) , n_elem(0) , n_nonzero(0) , vec_state(0) , values(nullptr) , row_indices(nullptr) , col_ptrs(nullptr) { arma_debug_sigprint_this(this); init(std::string(text)); } template inline SpMat& SpMat::operator=(const char* text) { arma_debug_sigprint(); init(std::string(text)); return *this; } template inline SpMat::SpMat(const std::string& text) : n_rows(0) , n_cols(0) , n_elem(0) , n_nonzero(0) , vec_state(0) , values(nullptr) , row_indices(nullptr) , col_ptrs(nullptr) { arma_debug_sigprint(); init(text); } template inline SpMat& SpMat::operator=(const std::string& text) { arma_debug_sigprint(); init(text); return *this; } template inline SpMat::SpMat(const SpMat& x) : n_rows(0) , n_cols(0) , n_elem(0) , n_nonzero(0) , vec_state(0) , values(nullptr) , row_indices(nullptr) , col_ptrs(nullptr) { arma_debug_sigprint_this(this); init(x); } template inline SpMat::SpMat(SpMat&& in_mat) : n_rows(0) , n_cols(0) , n_elem(0) , n_nonzero(0) , vec_state(0) , values(nullptr) , row_indices(nullptr) , col_ptrs(nullptr) { arma_debug_sigprint_this(this); arma_debug_sigprint(arma_str::format("this: %x; in_mat: %x") % this % &in_mat); (*this).steal_mem(in_mat); } template inline SpMat& SpMat::operator=(SpMat&& in_mat) { arma_debug_sigprint(arma_str::format("this: %x; in_mat: %x") % this % &in_mat); (*this).steal_mem(in_mat); return *this; } template inline SpMat::SpMat(const MapMat& x) : n_rows(0) , n_cols(0) , n_elem(0) , n_nonzero(0) , vec_state(0) , values(nullptr) , row_indices(nullptr) , col_ptrs(nullptr) { arma_debug_sigprint_this(this); init(x); } template inline SpMat& SpMat::operator=(const MapMat& x) { arma_debug_sigprint(); init(x); return *this; } //! Insert a large number of values at once. //! locations.row[0] should be row indices, locations.row[1] should be column indices, //! and values should be the corresponding values. //! If sort_locations is false, then it is assumed that the locations and values //! are already sorted in column-major ordering. template template inline SpMat::SpMat(const Base& locations_expr, const Base& vals_expr, const bool sort_locations) : n_rows(0) , n_cols(0) , n_elem(0) , n_nonzero(0) , vec_state(0) , values(nullptr) , row_indices(nullptr) , col_ptrs(nullptr) { arma_debug_sigprint_this(this); const quasi_unwrap locs_tmp( locations_expr.get_ref() ); const quasi_unwrap vals_tmp( vals_expr.get_ref() ); const Mat& locs = locs_tmp.M; const Mat& vals = vals_tmp.M; arma_conform_check( (vals.is_vec() == false), "SpMat::SpMat(): given 'values' object must be a vector" ); arma_conform_check( (locs.n_rows != 2), "SpMat::SpMat(): locations matrix must have two rows" ); arma_conform_check( (locs.n_cols != vals.n_elem), "SpMat::SpMat(): number of locations is different than number of values" ); // If there are no elements in the list, max() will fail. if(locs.n_cols == 0) { init_cold(0, 0); return; } // Automatically determine size before pruning zeros. uvec bounds = arma::max(locs, 1); init_cold(bounds[0] + 1, bounds[1] + 1); // Ensure that there are no zeros const uword N_old = vals.n_elem; uword N_new = 0; for(uword i=0; i < N_old; ++i) { N_new += (vals[i] != eT(0)) ? uword(1) : uword(0); } if(N_new != N_old) { Col filtered_vals( N_new, arma_nozeros_indicator()); Mat filtered_locs(2, N_new, arma_nozeros_indicator()); uword index = 0; for(uword i = 0; i < N_old; ++i) { if(vals[i] != eT(0)) { filtered_vals[index] = vals[i]; filtered_locs.at(0, index) = locs.at(0, i); filtered_locs.at(1, index) = locs.at(1, i); ++index; } } init_batch_std(filtered_locs, filtered_vals, sort_locations); } else { init_batch_std(locs, vals, sort_locations); } } //! Insert a large number of values at once. //! locations.row[0] should be row indices, locations.row[1] should be column indices, //! and values should be the corresponding values. //! If sort_locations is false, then it is assumed that the locations and values //! are already sorted in column-major ordering. //! In this constructor the size is explicitly given. template template inline SpMat::SpMat(const Base& locations_expr, const Base& vals_expr, const uword in_n_rows, const uword in_n_cols, const bool sort_locations, const bool check_for_zeros) : n_rows(0) , n_cols(0) , n_elem(0) , n_nonzero(0) , vec_state(0) , values(nullptr) , row_indices(nullptr) , col_ptrs(nullptr) { arma_debug_sigprint_this(this); const quasi_unwrap locs_tmp( locations_expr.get_ref() ); const quasi_unwrap vals_tmp( vals_expr.get_ref() ); const Mat& locs = locs_tmp.M; const Mat& vals = vals_tmp.M; arma_conform_check( (vals.is_vec() == false), "SpMat::SpMat(): given 'values' object must be a vector" ); arma_conform_check( (locs.n_rows != 2), "SpMat::SpMat(): locations matrix must have two rows" ); arma_conform_check( (locs.n_cols != vals.n_elem), "SpMat::SpMat(): number of locations is different than number of values" ); init_cold(in_n_rows, in_n_cols); // Ensure that there are no zeros, unless the user asked not to. if(check_for_zeros) { const uword N_old = vals.n_elem; uword N_new = 0; for(uword i=0; i < N_old; ++i) { N_new += (vals[i] != eT(0)) ? uword(1) : uword(0); } if(N_new != N_old) { Col filtered_vals( N_new, arma_nozeros_indicator()); Mat filtered_locs(2, N_new, arma_nozeros_indicator()); uword index = 0; for(uword i = 0; i < N_old; ++i) { if(vals[i] != eT(0)) { filtered_vals[index] = vals[i]; filtered_locs.at(0, index) = locs.at(0, i); filtered_locs.at(1, index) = locs.at(1, i); ++index; } } init_batch_std(filtered_locs, filtered_vals, sort_locations); } else { init_batch_std(locs, vals, sort_locations); } } else { init_batch_std(locs, vals, sort_locations); } } template template inline SpMat::SpMat(const bool add_values, const Base& locations_expr, const Base& vals_expr, const uword in_n_rows, const uword in_n_cols, const bool sort_locations, const bool check_for_zeros) : n_rows(0) , n_cols(0) , n_elem(0) , n_nonzero(0) , vec_state(0) , values(nullptr) , row_indices(nullptr) , col_ptrs(nullptr) { arma_debug_sigprint_this(this); const quasi_unwrap locs_tmp( locations_expr.get_ref() ); const quasi_unwrap vals_tmp( vals_expr.get_ref() ); const Mat& locs = locs_tmp.M; const Mat& vals = vals_tmp.M; arma_conform_check( (vals.is_vec() == false), "SpMat::SpMat(): given 'values' object must be a vector" ); arma_conform_check( (locs.n_rows != 2), "SpMat::SpMat(): locations matrix must have two rows" ); arma_conform_check( (locs.n_cols != vals.n_elem), "SpMat::SpMat(): number of locations is different than number of values" ); init_cold(in_n_rows, in_n_cols); // Ensure that there are no zeros, unless the user asked not to. if(check_for_zeros) { const uword N_old = vals.n_elem; uword N_new = 0; for(uword i=0; i < N_old; ++i) { N_new += (vals[i] != eT(0)) ? uword(1) : uword(0); } if(N_new != N_old) { Col filtered_vals( N_new, arma_nozeros_indicator()); Mat filtered_locs(2, N_new, arma_nozeros_indicator()); uword index = 0; for(uword i = 0; i < N_old; ++i) { if(vals[i] != eT(0)) { filtered_vals[index] = vals[i]; filtered_locs.at(0, index) = locs.at(0, i); filtered_locs.at(1, index) = locs.at(1, i); ++index; } } add_values ? init_batch_add(filtered_locs, filtered_vals, sort_locations) : init_batch_std(filtered_locs, filtered_vals, sort_locations); } else { add_values ? init_batch_add(locs, vals, sort_locations) : init_batch_std(locs, vals, sort_locations); } } else { add_values ? init_batch_add(locs, vals, sort_locations) : init_batch_std(locs, vals, sort_locations); } } //! Insert a large number of values at once. //! Per CSC format, rowind_expr should be row indices, //! colptr_expr should column ptr indices locations, //! and values should be the corresponding values. //! In this constructor the size is explicitly given. //! Values are assumed to be sorted, and the size //! information is trusted template template inline SpMat::SpMat ( const Base& rowind_expr, const Base& colptr_expr, const Base& values_expr, const uword in_n_rows, const uword in_n_cols, const bool check_for_zeros ) : n_rows(0) , n_cols(0) , n_elem(0) , n_nonzero(0) , vec_state(0) , values(nullptr) , row_indices(nullptr) , col_ptrs(nullptr) { arma_debug_sigprint_this(this); const quasi_unwrap rowind_tmp( rowind_expr.get_ref() ); const quasi_unwrap colptr_tmp( colptr_expr.get_ref() ); const quasi_unwrap vals_tmp( values_expr.get_ref() ); const Mat& rowind = rowind_tmp.M; const Mat& colptr = colptr_tmp.M; const Mat& vals = vals_tmp.M; arma_conform_check( (rowind.is_vec() == false), "SpMat::SpMat(): given 'rowind' object must be a vector" ); arma_conform_check( (colptr.is_vec() == false), "SpMat::SpMat(): given 'colptr' object must be a vector" ); arma_conform_check( (vals.is_vec() == false), "SpMat::SpMat(): given 'values' object must be a vector" ); // Resize to correct number of elements (this also sets n_nonzero) init_cold(in_n_rows, in_n_cols, vals.n_elem); arma_conform_check( (rowind.n_elem != vals.n_elem), "SpMat::SpMat(): number of row indices is not equal to number of values" ); arma_conform_check( (colptr.n_elem != (n_cols+1) ), "SpMat::SpMat(): number of column pointers is not equal to n_cols+1" ); // copy supplied values into sparse matrix -- not checked for consistency arrayops::copy(access::rwp(row_indices), rowind.memptr(), rowind.n_elem ); arrayops::copy(access::rwp(col_ptrs), colptr.memptr(), colptr.n_elem ); arrayops::copy(access::rwp(values), vals.memptr(), vals.n_elem ); // important: set the sentinel as well access::rw(col_ptrs[n_cols + 1]) = std::numeric_limits::max(); // make sure no zeros are stored if(check_for_zeros) { remove_zeros(); } } template inline SpMat& SpMat::operator=(const eT val) { arma_debug_sigprint(); if(val != eT(0)) { // Resize to 1x1 then set that to the right value. init(1, 1, 1); // Sets col_ptrs to 0. // Manually set element. access::rw(values[0]) = val; access::rw(row_indices[0]) = 0; access::rw(col_ptrs[1]) = 1; } else { init(0, 0); } return *this; } template inline SpMat& SpMat::operator*=(const eT val) { arma_debug_sigprint(); sync_csc(); invalidate_cache(); const uword n_nz = n_nonzero; eT* vals = access::rwp(values); bool has_zero = false; for(uword i=0; i inline SpMat& SpMat::operator/=(const eT val) { arma_debug_sigprint(); arma_conform_check( (val == eT(0)), "element-wise division: division by zero" ); sync_csc(); invalidate_cache(); const uword n_nz = n_nonzero; eT* vals = access::rwp(values); bool has_zero = false; for(uword i=0; i inline SpMat& SpMat::operator=(const SpMat& x) { arma_debug_sigprint(); init(x); return *this; } template inline SpMat& SpMat::operator+=(const SpMat& x) { arma_debug_sigprint(); sync_csc(); SpMat out = (*this) + x; steal_mem(out); return *this; } template inline SpMat& SpMat::operator-=(const SpMat& x) { arma_debug_sigprint(); sync_csc(); SpMat out = (*this) - x; steal_mem(out); return *this; } template inline SpMat& SpMat::operator*=(const SpMat& y) { arma_debug_sigprint(); sync_csc(); SpMat z = (*this) * y; steal_mem(z); return *this; } // This is in-place element-wise matrix multiplication. template inline SpMat& SpMat::operator%=(const SpMat& y) { arma_debug_sigprint(); sync_csc(); SpMat z = (*this) % y; steal_mem(z); return *this; } template inline SpMat& SpMat::operator/=(const SpMat& x) { arma_debug_sigprint(); // NOTE: use of this function is not advised; it is implemented only for completeness arma_conform_assert_same_size(n_rows, n_cols, x.n_rows, x.n_cols, "element-wise division"); for(uword c = 0; c < n_cols; ++c) for(uword r = 0; r < n_rows; ++r) { at(r, c) /= x.at(r, c); } return *this; } // Construct a complex matrix out of two non-complex matrices template template inline SpMat::SpMat ( const SpBase::pod_type, T1>& A, const SpBase::pod_type, T2>& B ) : n_rows(0) , n_cols(0) , n_elem(0) , n_nonzero(0) , vec_state(0) , values(nullptr) , row_indices(nullptr) , col_ptrs(nullptr) { arma_debug_sigprint(); typedef typename T1::elem_type T; // Make sure eT is complex and T is not (compile-time check). arma_type_check(( is_cx::no )); arma_type_check(( is_cx< T>::yes )); // Compile-time abort if types are not compatible. arma_type_check(( is_same_type< std::complex, eT >::no )); const unwrap_spmat tmp1(A.get_ref()); const unwrap_spmat tmp2(B.get_ref()); const SpMat& X = tmp1.M; const SpMat& Y = tmp2.M; arma_conform_assert_same_size(X.n_rows, X.n_cols, Y.n_rows, Y.n_cols, "SpMat()"); const uword l_n_rows = X.n_rows; const uword l_n_cols = X.n_cols; // Set size of matrix correctly. init_cold(l_n_rows, l_n_cols, n_unique(X, Y, op_n_unique_count())); // Now on a second iteration, fill it. typename SpMat::const_iterator x_it = X.begin(); typename SpMat::const_iterator x_end = X.end(); typename SpMat::const_iterator y_it = Y.begin(); typename SpMat::const_iterator y_end = Y.end(); uword cur_pos = 0; while((x_it != x_end) || (y_it != y_end)) { if(x_it == y_it) // if we are at the same place { access::rw(values[cur_pos]) = std::complex((T) *x_it, (T) *y_it); access::rw(row_indices[cur_pos]) = x_it.row(); ++access::rw(col_ptrs[x_it.col() + 1]); ++x_it; ++y_it; } else { if((x_it.col() < y_it.col()) || ((x_it.col() == y_it.col()) && (x_it.row() < y_it.row()))) // if y is closer to the end { access::rw(values[cur_pos]) = std::complex((T) *x_it, T(0)); access::rw(row_indices[cur_pos]) = x_it.row(); ++access::rw(col_ptrs[x_it.col() + 1]); ++x_it; } else // x is closer to the end { access::rw(values[cur_pos]) = std::complex(T(0), (T) *y_it); access::rw(row_indices[cur_pos]) = y_it.row(); ++access::rw(col_ptrs[y_it.col() + 1]); ++y_it; } } ++cur_pos; } // Now fix the column pointers; they are supposed to be a sum. for(uword c = 1; c <= n_cols; ++c) { access::rw(col_ptrs[c]) += col_ptrs[c - 1]; } } template template inline SpMat::SpMat(const Base& x) : n_rows(0) , n_cols(0) , n_elem(0) , n_nonzero(0) , vec_state(0) , values(nullptr) , row_indices(nullptr) , col_ptrs(nullptr) { arma_debug_sigprint_this(this); (*this).operator=(x); } template template inline SpMat& SpMat::operator=(const Base& expr) { arma_debug_sigprint(); if(is_same_type< T1, Gen, gen_zeros> >::yes) { const Proxy P(expr.get_ref()); (*this).zeros( P.get_n_rows(), P.get_n_cols() ); return *this; } if(is_same_type< T1, Gen, gen_eye> >::yes) { const Proxy P(expr.get_ref()); (*this).eye( P.get_n_rows(), P.get_n_cols() ); return *this; } const quasi_unwrap tmp(expr.get_ref()); const Mat& x = tmp.M; const uword x_n_rows = x.n_rows; const uword x_n_cols = x.n_cols; const uword x_n_elem = x.n_elem; // Count number of nonzero elements in base object. uword n = 0; const eT* x_mem = x.memptr(); for(uword i=0; i < x_n_elem; ++i) { n += (x_mem[i] != eT(0)) ? uword(1) : uword(0); } init(x_n_rows, x_n_cols, n); if(n == 0) { return *this; } // Now the memory is resized correctly; set nonzero elements. n = 0; for(uword j = 0; j < x_n_cols; ++j) for(uword i = 0; i < x_n_rows; ++i) { const eT val = (*x_mem); x_mem++; if(val != eT(0)) { access::rw(values[n]) = val; access::rw(row_indices[n]) = i; access::rw(col_ptrs[j + 1])++; ++n; } } // Sum column counts to be column pointers. for(uword c = 1; c <= n_cols; ++c) { access::rw(col_ptrs[c]) += col_ptrs[c - 1]; } return *this; } template template inline SpMat& SpMat::operator+=(const Base& x) { arma_debug_sigprint(); sync_csc(); return (*this).operator=( (*this) + x.get_ref() ); } template template inline SpMat& SpMat::operator-=(const Base& x) { arma_debug_sigprint(); sync_csc(); return (*this).operator=( (*this) - x.get_ref() ); } template template inline SpMat& SpMat::operator*=(const Base& x) { arma_debug_sigprint(); sync_csc(); return (*this).operator=( (*this) * x.get_ref() ); } // NOTE: use of this function is not advised; it is implemented only for completeness template template inline SpMat& SpMat::operator/=(const Base& x) { arma_debug_sigprint(); sync_csc(); SpMat tmp = (*this) / x.get_ref(); steal_mem(tmp); return *this; } template template inline SpMat& SpMat::operator%=(const Base& x) { arma_debug_sigprint(); const quasi_unwrap U(x.get_ref()); const Mat& B = U.M; arma_conform_assert_same_size(n_rows, n_cols, B.n_rows, B.n_cols, "element-wise multiplication"); sync_csc(); invalidate_cache(); constexpr eT zero = eT(0); bool has_zero = false; for(uword c=0; c < n_cols; ++c) { const uword index_start = col_ptrs[c ]; const uword index_end = col_ptrs[c + 1]; for(uword i=index_start; i < index_end; ++i) { const uword r = row_indices[i]; eT& val = access::rw(values[i]); const eT result = val * B.at(r,c); val = result; if(result == zero) { has_zero = true; } } } if(has_zero) { remove_zeros(); } return *this; } template template inline SpMat::SpMat(const Op& expr) : n_rows(0) , n_cols(0) , n_elem(0) , n_nonzero(0) , vec_state(0) , values(nullptr) , row_indices(nullptr) , col_ptrs(nullptr) { arma_debug_sigprint_this(this); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); (*this).operator=(expr); } template template inline SpMat& SpMat::operator=(const Op& expr) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); const diagmat_proxy P(expr.m); const uword max_n_nonzero = (std::min)(P.n_rows, P.n_cols); // resize memory to upper bound init(P.n_rows, P.n_cols, max_n_nonzero); uword count = 0; for(uword i=0; i < max_n_nonzero; ++i) { const eT val = P[i]; if(val != eT(0)) { access::rw(values[count]) = val; access::rw(row_indices[count]) = i; access::rw(col_ptrs[i + 1])++; ++count; } } // fix column pointers to be cumulative for(uword i = 1; i < n_cols + 1; ++i) { access::rw(col_ptrs[i]) += col_ptrs[i - 1]; } // quick resize without reallocating memory and copying data access::rw( n_nonzero) = count; access::rw( values[count]) = eT(0); access::rw(row_indices[count]) = uword(0); return *this; } template template inline SpMat& SpMat::operator+=(const Op& expr) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); const SpMat tmp(expr); return (*this).operator+=(tmp); } template template inline SpMat& SpMat::operator-=(const Op& expr) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); const SpMat tmp(expr); return (*this).operator-=(tmp); } template template inline SpMat& SpMat::operator*=(const Op& expr) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); const SpMat tmp(expr); return (*this).operator*=(tmp); } template template inline SpMat& SpMat::operator/=(const Op& expr) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); const SpMat tmp(expr); return (*this).operator/=(tmp); } template template inline SpMat& SpMat::operator%=(const Op& expr) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); const SpMat tmp(expr); return (*this).operator%=(tmp); } /** * Functions on subviews. */ template inline SpMat::SpMat(const SpSubview& X) : n_rows(0) , n_cols(0) , n_elem(0) , n_nonzero(0) , vec_state(0) , values(nullptr) , row_indices(nullptr) , col_ptrs(nullptr) { arma_debug_sigprint_this(this); (*this).operator=(X); } template inline SpMat& SpMat::operator=(const SpSubview& X) { arma_debug_sigprint(); if(X.n_nonzero == 0) { zeros(X.n_rows, X.n_cols); return *this; } X.m.sync_csc(); const bool alias = (this == &(X.m)); if(alias) { SpMat tmp(X); steal_mem(tmp); } else { init(X.n_rows, X.n_cols, X.n_nonzero); if(X.n_rows == X.m.n_rows) { const uword sv_col_start = X.aux_col1; const uword sv_col_end = X.aux_col1 + X.n_cols - 1; typename SpMat::const_col_iterator m_it = X.m.begin_col_no_sync(sv_col_start); typename SpMat::const_col_iterator m_it_end = X.m.end_col_no_sync(sv_col_end); uword count = 0; while(m_it != m_it_end) { const uword m_it_col_adjusted = m_it.col() - sv_col_start; access::rw(row_indices[count]) = m_it.row(); access::rw(values[count]) = (*m_it); ++access::rw(col_ptrs[m_it_col_adjusted + 1]); count++; ++m_it; } } else { typename SpSubview::const_iterator it = X.begin(); typename SpSubview::const_iterator it_end = X.end(); while(it != it_end) { const uword it_pos = it.pos(); access::rw(row_indices[it_pos]) = it.row(); access::rw(values[it_pos]) = (*it); ++access::rw(col_ptrs[it.col() + 1]); ++it; } } // Now sum column pointers. for(uword c = 1; c <= n_cols; ++c) { access::rw(col_ptrs[c]) += col_ptrs[c - 1]; } } return *this; } template inline SpMat& SpMat::operator+=(const SpSubview& X) { arma_debug_sigprint(); sync_csc(); SpMat tmp = (*this) + X; steal_mem(tmp); return *this; } template inline SpMat& SpMat::operator-=(const SpSubview& X) { arma_debug_sigprint(); sync_csc(); SpMat tmp = (*this) - X; steal_mem(tmp); return *this; } template inline SpMat& SpMat::operator*=(const SpSubview& y) { arma_debug_sigprint(); sync_csc(); SpMat z = (*this) * y; steal_mem(z); return *this; } template inline SpMat& SpMat::operator%=(const SpSubview& x) { arma_debug_sigprint(); sync_csc(); SpMat tmp = (*this) % x; steal_mem(tmp); return *this; } template inline SpMat& SpMat::operator/=(const SpSubview& x) { arma_debug_sigprint(); arma_conform_assert_same_size(n_rows, n_cols, x.n_rows, x.n_cols, "element-wise division"); // There is no pretty way to do this. for(uword elem = 0; elem < n_elem; elem++) { at(elem) /= x(elem); } return *this; } template template inline SpMat::SpMat(const SpSubview_col_list& X) : n_rows(0) , n_cols(0) , n_elem(0) , n_nonzero(0) , vec_state(0) , values(nullptr) , row_indices(nullptr) , col_ptrs(nullptr) { arma_debug_sigprint_this(this); SpSubview_col_list::extract(*this, X); } template template inline SpMat& SpMat::operator=(const SpSubview_col_list& X) { arma_debug_sigprint(); const bool alias = (this == &(X.m)); if(alias == false) { SpSubview_col_list::extract(*this, X); } else { SpMat tmp(X); steal_mem(tmp); } return *this; } template template inline SpMat& SpMat::operator+=(const SpSubview_col_list& X) { arma_debug_sigprint(); SpSubview_col_list::plus_inplace(*this, X); return *this; } template template inline SpMat& SpMat::operator-=(const SpSubview_col_list& X) { arma_debug_sigprint(); SpSubview_col_list::minus_inplace(*this, X); return *this; } template template inline SpMat& SpMat::operator*=(const SpSubview_col_list& X) { arma_debug_sigprint(); sync_csc(); SpMat z = (*this) * X; steal_mem(z); return *this; } template template inline SpMat& SpMat::operator%=(const SpSubview_col_list& X) { arma_debug_sigprint(); SpSubview_col_list::schur_inplace(*this, X); return *this; } template template inline SpMat& SpMat::operator/=(const SpSubview_col_list& X) { arma_debug_sigprint(); SpSubview_col_list::div_inplace(*this, X); return *this; } template inline SpMat::SpMat(const spdiagview& X) : n_rows(0) , n_cols(0) , n_elem(0) , n_nonzero(0) , vec_state(0) , values(nullptr) , row_indices(nullptr) , col_ptrs(nullptr) { arma_debug_sigprint_this(this); spdiagview::extract(*this, X); } template inline SpMat& SpMat::operator=(const spdiagview& X) { arma_debug_sigprint(); spdiagview::extract(*this, X); return *this; } template inline SpMat& SpMat::operator+=(const spdiagview& X) { arma_debug_sigprint(); const SpMat tmp(X); return (*this).operator+=(tmp); } template inline SpMat& SpMat::operator-=(const spdiagview& X) { arma_debug_sigprint(); const SpMat tmp(X); return (*this).operator-=(tmp); } template inline SpMat& SpMat::operator*=(const spdiagview& X) { arma_debug_sigprint(); const SpMat tmp(X); return (*this).operator*=(tmp); } template inline SpMat& SpMat::operator%=(const spdiagview& X) { arma_debug_sigprint(); const SpMat tmp(X); return (*this).operator%=(tmp); } template inline SpMat& SpMat::operator/=(const spdiagview& X) { arma_debug_sigprint(); const SpMat tmp(X); return (*this).operator/=(tmp); } template template inline SpMat::SpMat(const SpOp& X) : n_rows(0) , n_cols(0) , n_elem(0) , n_nonzero(0) , vec_state(0) , values(nullptr) // set in application of sparse operation , row_indices(nullptr) , col_ptrs(nullptr) { arma_debug_sigprint_this(this); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); spop_type::apply(*this, X); sync_csc(); // in case apply() used element accessors invalidate_cache(); // in case apply() modified the CSC representation } template template inline SpMat& SpMat::operator=(const SpOp& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); spop_type::apply(*this, X); sync_csc(); // in case apply() used element accessors invalidate_cache(); // in case apply() modified the CSC representation return *this; } template template inline SpMat& SpMat::operator+=(const SpOp& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); sync_csc(); const SpMat m(X); return (*this).operator+=(m); } template template inline SpMat& SpMat::operator-=(const SpOp& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); sync_csc(); const SpMat m(X); return (*this).operator-=(m); } template template inline SpMat& SpMat::operator*=(const SpOp& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); sync_csc(); const SpMat m(X); return (*this).operator*=(m); } template template inline SpMat& SpMat::operator%=(const SpOp& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); sync_csc(); const SpMat m(X); return (*this).operator%=(m); } template template inline SpMat& SpMat::operator/=(const SpOp& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); sync_csc(); const SpMat m(X); return (*this).operator/=(m); } template template inline SpMat::SpMat(const SpGlue& X) : n_rows(0) , n_cols(0) , n_elem(0) , n_nonzero(0) , vec_state(0) , values(nullptr) , row_indices(nullptr) , col_ptrs(nullptr) { arma_debug_sigprint_this(this); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); spglue_type::apply(*this, X); sync_csc(); // in case apply() used element accessors invalidate_cache(); // in case apply() modified the CSC representation } template template inline SpMat& SpMat::operator=(const SpGlue& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); spglue_type::apply(*this, X); sync_csc(); // in case apply() used element accessors invalidate_cache(); // in case apply() modified the CSC representation return *this; } template template inline SpMat& SpMat::operator+=(const SpGlue& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); sync_csc(); const SpMat m(X); return (*this).operator+=(m); } template template inline SpMat& SpMat::operator-=(const SpGlue& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); sync_csc(); const SpMat m(X); return (*this).operator-=(m); } template template inline SpMat& SpMat::operator*=(const SpGlue& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); sync_csc(); const SpMat m(X); return (*this).operator*=(m); } template template inline SpMat& SpMat::operator%=(const SpGlue& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); sync_csc(); const SpMat m(X); return (*this).operator%=(m); } template template inline SpMat& SpMat::operator/=(const SpGlue& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); sync_csc(); const SpMat m(X); return (*this).operator/=(m); } template template inline SpMat::SpMat(const mtSpOp& X) : n_rows(0) , n_cols(0) , n_elem(0) , n_nonzero(0) , vec_state(0) , values(nullptr) , row_indices(nullptr) , col_ptrs(nullptr) { arma_debug_sigprint_this(this); spop_type::apply(*this, X); sync_csc(); // in case apply() used element accessors invalidate_cache(); // in case apply() modified the CSC representation } template template inline SpMat& SpMat::operator=(const mtSpOp& X) { arma_debug_sigprint(); spop_type::apply(*this, X); sync_csc(); // in case apply() used element accessors invalidate_cache(); // in case apply() modified the CSC representation return *this; } template template inline SpMat& SpMat::operator+=(const mtSpOp& X) { arma_debug_sigprint(); sync_csc(); const SpMat m(X); return (*this).operator+=(m); } template template inline SpMat& SpMat::operator-=(const mtSpOp& X) { arma_debug_sigprint(); sync_csc(); const SpMat m(X); return (*this).operator-=(m); } template template inline SpMat& SpMat::operator*=(const mtSpOp& X) { arma_debug_sigprint(); sync_csc(); const SpMat m(X); return (*this).operator*=(m); } template template inline SpMat& SpMat::operator%=(const mtSpOp& X) { arma_debug_sigprint(); sync_csc(); const SpMat m(X); return (*this).operator%=(m); } template template inline SpMat& SpMat::operator/=(const mtSpOp& X) { arma_debug_sigprint(); sync_csc(); const SpMat m(X); return (*this).operator/=(m); } template template inline SpMat::SpMat(const mtSpGlue& X) : n_rows(0) , n_cols(0) , n_elem(0) , n_nonzero(0) , vec_state(0) , values(nullptr) , row_indices(nullptr) , col_ptrs(nullptr) { arma_debug_sigprint_this(this); spglue_type::apply(*this, X); sync_csc(); // in case apply() used element accessors invalidate_cache(); // in case apply() modified the CSC representation } template template inline SpMat& SpMat::operator=(const mtSpGlue& X) { arma_debug_sigprint(); spglue_type::apply(*this, X); sync_csc(); // in case apply() used element accessors invalidate_cache(); // in case apply() modified the CSC representation return *this; } template template inline SpMat& SpMat::operator+=(const mtSpGlue& X) { arma_debug_sigprint(); sync_csc(); const SpMat m(X); return (*this).operator+=(m); } template template inline SpMat& SpMat::operator-=(const mtSpGlue& X) { arma_debug_sigprint(); sync_csc(); const SpMat m(X); return (*this).operator-=(m); } template template inline SpMat& SpMat::operator*=(const mtSpGlue& X) { arma_debug_sigprint(); sync_csc(); const SpMat m(X); return (*this).operator*=(m); } template template inline SpMat& SpMat::operator%=(const mtSpGlue& X) { arma_debug_sigprint(); sync_csc(); const SpMat m(X); return (*this).operator%=(m); } template template inline SpMat& SpMat::operator/=(const mtSpGlue& X) { arma_debug_sigprint(); sync_csc(); const SpMat m(X); return (*this).operator/=(m); } template template inline SpMat::SpMat(const mtSpReduceOp& X) : n_rows(0) , n_cols(0) , n_elem(0) , n_nonzero(0) , vec_state(0) , values(nullptr) , row_indices(nullptr) , col_ptrs(nullptr) { arma_debug_sigprint_this(this); const Mat tmp(X); (*this).operator=(tmp); } template template inline SpMat& SpMat::operator=(const mtSpReduceOp& X) { arma_debug_sigprint(); const Mat tmp(X); return (*this).operator=(tmp); } template template inline SpMat& SpMat::operator+=(const mtSpReduceOp& X) { arma_debug_sigprint(); const Mat tmp(X); return (*this).operator+=(tmp); } template template inline SpMat& SpMat::operator-=(const mtSpReduceOp& X) { arma_debug_sigprint(); const Mat tmp(X); return (*this).operator-=(tmp); } template template inline SpMat& SpMat::operator*=(const mtSpReduceOp& X) { arma_debug_sigprint(); const Mat tmp(X); return (*this).operator*=(tmp); } template template inline SpMat& SpMat::operator%=(const mtSpReduceOp& X) { arma_debug_sigprint(); const Mat tmp(X); return (*this).operator%=(tmp); } template template inline SpMat& SpMat::operator/=(const mtSpReduceOp& X) { arma_debug_sigprint(); const Mat tmp(X); return (*this).operator/=(tmp); } template arma_inline SpSubview_row SpMat::row(const uword row_num) { arma_debug_sigprint(); arma_conform_check_bounds(row_num >= n_rows, "SpMat::row(): out of bounds"); return SpSubview_row(*this, row_num); } template arma_inline const SpSubview_row SpMat::row(const uword row_num) const { arma_debug_sigprint(); arma_conform_check_bounds(row_num >= n_rows, "SpMat::row(): out of bounds"); return SpSubview_row(*this, row_num); } template inline SpSubview_row SpMat::operator()(const uword row_num, const span& col_span) { arma_debug_sigprint(); const bool col_all = col_span.whole; const uword local_n_cols = n_cols; const uword in_col1 = col_all ? 0 : col_span.a; const uword in_col2 = col_span.b; const uword submat_n_cols = col_all ? local_n_cols : in_col2 - in_col1 + 1; arma_conform_check_bounds ( (row_num >= n_rows) || ( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= local_n_cols)) ) , "SpMat::operator(): indices out of bounds or incorrectly used" ); return SpSubview_row(*this, row_num, in_col1, submat_n_cols); } template inline const SpSubview_row SpMat::operator()(const uword row_num, const span& col_span) const { arma_debug_sigprint(); const bool col_all = col_span.whole; const uword local_n_cols = n_cols; const uword in_col1 = col_all ? 0 : col_span.a; const uword in_col2 = col_span.b; const uword submat_n_cols = col_all ? local_n_cols : in_col2 - in_col1 + 1; arma_conform_check_bounds ( (row_num >= n_rows) || ( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= local_n_cols)) ) , "SpMat::operator(): indices out of bounds or incorrectly used" ); return SpSubview_row(*this, row_num, in_col1, submat_n_cols); } template arma_inline SpSubview_col SpMat::col(const uword col_num) { arma_debug_sigprint(); arma_conform_check_bounds(col_num >= n_cols, "SpMat::col(): out of bounds"); return SpSubview_col(*this, col_num); } template arma_inline const SpSubview_col SpMat::col(const uword col_num) const { arma_debug_sigprint(); arma_conform_check_bounds(col_num >= n_cols, "SpMat::col(): out of bounds"); return SpSubview_col(*this, col_num); } template inline SpSubview_col SpMat::operator()(const span& row_span, const uword col_num) { arma_debug_sigprint(); const bool row_all = row_span.whole; const uword local_n_rows = n_rows; const uword in_row1 = row_all ? 0 : row_span.a; const uword in_row2 = row_span.b; const uword submat_n_rows = row_all ? local_n_rows : in_row2 - in_row1 + 1; arma_conform_check_bounds ( (col_num >= n_cols) || ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows)) ) , "SpMat::operator(): indices out of bounds or incorrectly used" ); return SpSubview_col(*this, col_num, in_row1, submat_n_rows); } template inline const SpSubview_col SpMat::operator()(const span& row_span, const uword col_num) const { arma_debug_sigprint(); const bool row_all = row_span.whole; const uword local_n_rows = n_rows; const uword in_row1 = row_all ? 0 : row_span.a; const uword in_row2 = row_span.b; const uword submat_n_rows = row_all ? local_n_rows : in_row2 - in_row1 + 1; arma_conform_check_bounds ( (col_num >= n_cols) || ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows)) ) , "SpMat::operator(): indices out of bounds or incorrectly used" ); return SpSubview_col(*this, col_num, in_row1, submat_n_rows); } template arma_inline SpSubview SpMat::rows(const uword in_row1, const uword in_row2) { arma_debug_sigprint(); arma_conform_check_bounds ( (in_row1 > in_row2) || (in_row2 >= n_rows), "SpMat::rows(): indices out of bounds or incorrectly used" ); const uword subview_n_rows = in_row2 - in_row1 + 1; return SpSubview(*this, in_row1, 0, subview_n_rows, n_cols); } template arma_inline const SpSubview SpMat::rows(const uword in_row1, const uword in_row2) const { arma_debug_sigprint(); arma_conform_check_bounds ( (in_row1 > in_row2) || (in_row2 >= n_rows), "SpMat::rows(): indices out of bounds or incorrectly used" ); const uword subview_n_rows = in_row2 - in_row1 + 1; return SpSubview(*this, in_row1, 0, subview_n_rows, n_cols); } template arma_inline SpSubview SpMat::cols(const uword in_col1, const uword in_col2) { arma_debug_sigprint(); arma_conform_check_bounds ( (in_col1 > in_col2) || (in_col2 >= n_cols), "SpMat::cols(): indices out of bounds or incorrectly used" ); const uword subview_n_cols = in_col2 - in_col1 + 1; return SpSubview(*this, 0, in_col1, n_rows, subview_n_cols); } template arma_inline const SpSubview SpMat::cols(const uword in_col1, const uword in_col2) const { arma_debug_sigprint(); arma_conform_check_bounds ( (in_col1 > in_col2) || (in_col2 >= n_cols), "SpMat::cols(): indices out of bounds or incorrectly used" ); const uword subview_n_cols = in_col2 - in_col1 + 1; return SpSubview(*this, 0, in_col1, n_rows, subview_n_cols); } template arma_inline SpSubview SpMat::submat(const uword in_row1, const uword in_col1, const uword in_row2, const uword in_col2) { arma_debug_sigprint(); arma_conform_check_bounds ( (in_row1 > in_row2) || (in_col1 > in_col2) || (in_row2 >= n_rows) || (in_col2 >= n_cols), "SpMat::submat(): indices out of bounds or incorrectly used" ); const uword subview_n_rows = in_row2 - in_row1 + 1; const uword subview_n_cols = in_col2 - in_col1 + 1; return SpSubview(*this, in_row1, in_col1, subview_n_rows, subview_n_cols); } template arma_inline const SpSubview SpMat::submat(const uword in_row1, const uword in_col1, const uword in_row2, const uword in_col2) const { arma_debug_sigprint(); arma_conform_check_bounds ( (in_row1 > in_row2) || (in_col1 > in_col2) || (in_row2 >= n_rows) || (in_col2 >= n_cols), "SpMat::submat(): indices out of bounds or incorrectly used" ); const uword subview_n_rows = in_row2 - in_row1 + 1; const uword subview_n_cols = in_col2 - in_col1 + 1; return SpSubview(*this, in_row1, in_col1, subview_n_rows, subview_n_cols); } template arma_inline SpSubview SpMat::submat(const uword in_row1, const uword in_col1, const SizeMat& s) { arma_debug_sigprint(); const uword l_n_rows = n_rows; const uword l_n_cols = n_cols; const uword s_n_rows = s.n_rows; const uword s_n_cols = s.n_cols; arma_conform_check_bounds ( ((in_row1 >= l_n_rows) || (in_col1 >= l_n_cols) || ((in_row1 + s_n_rows) > l_n_rows) || ((in_col1 + s_n_cols) > l_n_cols)), "SpMat::submat(): indices or size out of bounds" ); return SpSubview(*this, in_row1, in_col1, s_n_rows, s_n_cols); } template arma_inline const SpSubview SpMat::submat(const uword in_row1, const uword in_col1, const SizeMat& s) const { arma_debug_sigprint(); const uword l_n_rows = n_rows; const uword l_n_cols = n_cols; const uword s_n_rows = s.n_rows; const uword s_n_cols = s.n_cols; arma_conform_check_bounds ( ((in_row1 >= l_n_rows) || (in_col1 >= l_n_cols) || ((in_row1 + s_n_rows) > l_n_rows) || ((in_col1 + s_n_cols) > l_n_cols)), "SpMat::submat(): indices or size out of bounds" ); return SpSubview(*this, in_row1, in_col1, s_n_rows, s_n_cols); } template inline SpSubview SpMat::submat(const span& row_span, const span& col_span) { arma_debug_sigprint(); const bool row_all = row_span.whole; const bool col_all = col_span.whole; const uword local_n_rows = n_rows; const uword local_n_cols = n_cols; const uword in_row1 = row_all ? 0 : row_span.a; const uword in_row2 = row_span.b; const uword submat_n_rows = row_all ? local_n_rows : in_row2 - in_row1 + 1; const uword in_col1 = col_all ? 0 : col_span.a; const uword in_col2 = col_span.b; const uword submat_n_cols = col_all ? local_n_cols : in_col2 - in_col1 + 1; arma_conform_check_bounds ( ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows)) ) || ( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= local_n_cols)) ) , "SpMat::submat(): indices out of bounds or incorrectly used" ); return SpSubview(*this, in_row1, in_col1, submat_n_rows, submat_n_cols); } template inline const SpSubview SpMat::submat(const span& row_span, const span& col_span) const { arma_debug_sigprint(); const bool row_all = row_span.whole; const bool col_all = col_span.whole; const uword local_n_rows = n_rows; const uword local_n_cols = n_cols; const uword in_row1 = row_all ? 0 : row_span.a; const uword in_row2 = row_span.b; const uword submat_n_rows = row_all ? local_n_rows : in_row2 - in_row1 + 1; const uword in_col1 = col_all ? 0 : col_span.a; const uword in_col2 = col_span.b; const uword submat_n_cols = col_all ? local_n_cols : in_col2 - in_col1 + 1; arma_conform_check_bounds ( ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows)) ) || ( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= local_n_cols)) ) , "SpMat::submat(): indices out of bounds or incorrectly used" ); return SpSubview(*this, in_row1, in_col1, submat_n_rows, submat_n_cols); } template inline SpSubview SpMat::operator()(const span& row_span, const span& col_span) { arma_debug_sigprint(); return submat(row_span, col_span); } template inline const SpSubview SpMat::operator()(const span& row_span, const span& col_span) const { arma_debug_sigprint(); return submat(row_span, col_span); } template arma_inline SpSubview SpMat::operator()(const uword in_row1, const uword in_col1, const SizeMat& s) { arma_debug_sigprint(); return (*this).submat(in_row1, in_col1, s); } template arma_inline const SpSubview SpMat::operator()(const uword in_row1, const uword in_col1, const SizeMat& s) const { arma_debug_sigprint(); return (*this).submat(in_row1, in_col1, s); } template inline SpSubview SpMat::head_rows(const uword N) { arma_debug_sigprint(); arma_conform_check_bounds( (N > n_rows), "SpMat::head_rows(): size out of bounds" ); return SpSubview(*this, 0, 0, N, n_cols); } template inline const SpSubview SpMat::head_rows(const uword N) const { arma_debug_sigprint(); arma_conform_check_bounds( (N > n_rows), "SpMat::head_rows(): size out of bounds" ); return SpSubview(*this, 0, 0, N, n_cols); } template inline SpSubview SpMat::tail_rows(const uword N) { arma_debug_sigprint(); arma_conform_check_bounds( (N > n_rows), "SpMat::tail_rows(): size out of bounds" ); const uword start_row = n_rows - N; return SpSubview(*this, start_row, 0, N, n_cols); } template inline const SpSubview SpMat::tail_rows(const uword N) const { arma_debug_sigprint(); arma_conform_check_bounds( (N > n_rows), "SpMat::tail_rows(): size out of bounds" ); const uword start_row = n_rows - N; return SpSubview(*this, start_row, 0, N, n_cols); } template inline SpSubview SpMat::head_cols(const uword N) { arma_debug_sigprint(); arma_conform_check_bounds( (N > n_cols), "SpMat::head_cols(): size out of bounds" ); return SpSubview(*this, 0, 0, n_rows, N); } template inline const SpSubview SpMat::head_cols(const uword N) const { arma_debug_sigprint(); arma_conform_check_bounds( (N > n_cols), "SpMat::head_cols(): size out of bounds" ); return SpSubview(*this, 0, 0, n_rows, N); } template inline SpSubview SpMat::tail_cols(const uword N) { arma_debug_sigprint(); arma_conform_check_bounds( (N > n_cols), "SpMat::tail_cols(): size out of bounds" ); const uword start_col = n_cols - N; return SpSubview(*this, 0, start_col, n_rows, N); } template inline const SpSubview SpMat::tail_cols(const uword N) const { arma_debug_sigprint(); arma_conform_check_bounds( (N > n_cols), "SpMat::tail_cols(): size out of bounds" ); const uword start_col = n_cols - N; return SpSubview(*this, 0, start_col, n_rows, N); } template template arma_inline SpSubview_col_list SpMat::cols(const Base& indices) { arma_debug_sigprint(); return SpSubview_col_list(*this, indices); } template template arma_inline const SpSubview_col_list SpMat::cols(const Base& indices) const { arma_debug_sigprint(); return SpSubview_col_list(*this, indices); } //! creation of spdiagview (diagonal) template inline spdiagview SpMat::diag(const sword in_id) { arma_debug_sigprint(); const uword row_offset = (in_id < 0) ? uword(-in_id) : 0; const uword col_offset = (in_id > 0) ? uword( in_id) : 0; arma_conform_check_bounds ( ((row_offset > 0) && (row_offset >= n_rows)) || ((col_offset > 0) && (col_offset >= n_cols)), "SpMat::diag(): requested diagonal out of bounds" ); const uword len = (std::min)(n_rows - row_offset, n_cols - col_offset); return spdiagview(*this, row_offset, col_offset, len); } //! creation of spdiagview (diagonal) template inline const spdiagview SpMat::diag(const sword in_id) const { arma_debug_sigprint(); const uword row_offset = uword( (in_id < 0) ? -in_id : 0 ); const uword col_offset = uword( (in_id > 0) ? in_id : 0 ); arma_conform_check_bounds ( ((row_offset > 0) && (row_offset >= n_rows)) || ((col_offset > 0) && (col_offset >= n_cols)), "SpMat::diag(): requested diagonal out of bounds" ); const uword len = (std::min)(n_rows - row_offset, n_cols - col_offset); return spdiagview(*this, row_offset, col_offset, len); } template inline void SpMat::swap_rows(const uword in_row1, const uword in_row2) { arma_debug_sigprint(); arma_conform_check_bounds( ((in_row1 >= n_rows) || (in_row2 >= n_rows)), "SpMat::swap_rows(): out of bounds" ); if(in_row1 == in_row2) { return; } sync_csc(); invalidate_cache(); // The easier way to do this, instead of collecting all the elements in one row and then swapping with the other, will be // to iterate over each column of the matrix (since we store in column-major format) and then swap the two elements in the two rows at that time. // We will try to avoid using the at() call since it is expensive, instead preferring to use an iterator to track our position. uword col1 = (in_row1 < in_row2) ? in_row1 : in_row2; uword col2 = (in_row1 < in_row2) ? in_row2 : in_row1; for(uword lcol = 0; lcol < n_cols; lcol++) { // If there is nothing in this column we can ignore it. if(col_ptrs[lcol] == col_ptrs[lcol + 1]) { continue; } // These will represent the positions of the items themselves. uword loc1 = n_nonzero + 1; uword loc2 = n_nonzero + 1; for(uword search_pos = col_ptrs[lcol]; search_pos < col_ptrs[lcol + 1]; search_pos++) { if(row_indices[search_pos] == col1) { loc1 = search_pos; } if(row_indices[search_pos] == col2) { loc2 = search_pos; break; // No need to look any further. } } // There are four cases: we found both elements; we found one element (loc1); we found one element (loc2); we found zero elements. // If we found zero elements no work needs to be done and we can continue to the next column. if((loc1 != (n_nonzero + 1)) && (loc2 != (n_nonzero + 1))) { // This is an easy case: just swap the values. No index modifying necessary. eT tmp = values[loc1]; access::rw(values[loc1]) = values[loc2]; access::rw(values[loc2]) = tmp; } else if(loc1 != (n_nonzero + 1)) // We only found loc1 and not loc2. { // We need to find the correct place to move our value to. It will be forward (not backwards) because in_row2 > in_row1. // Each iteration of the loop swaps the current value (loc1) with (loc1 + 1); in this manner we move our value down to where it should be. while(((loc1 + 1) < col_ptrs[lcol + 1]) && (row_indices[loc1 + 1] < in_row2)) { // Swap both the values and the indices. The column should not change. eT tmp = values[loc1]; access::rw(values[loc1]) = values[loc1 + 1]; access::rw(values[loc1 + 1]) = tmp; uword tmp_index = row_indices[loc1]; access::rw(row_indices[loc1]) = row_indices[loc1 + 1]; access::rw(row_indices[loc1 + 1]) = tmp_index; loc1++; // And increment the counter. } // Now set the row index correctly. access::rw(row_indices[loc1]) = in_row2; } else if(loc2 != (n_nonzero + 1)) { // We need to find the correct place to move our value to. It will be backwards (not forwards) because in_row1 < in_row2. // Each iteration of the loop swaps the current value (loc2) with (loc2 - 1); in this manner we move our value up to where it should be. while(((loc2 - 1) >= col_ptrs[lcol]) && (row_indices[loc2 - 1] > in_row1)) { // Swap both the values and the indices. The column should not change. eT tmp = values[loc2]; access::rw(values[loc2]) = values[loc2 - 1]; access::rw(values[loc2 - 1]) = tmp; uword tmp_index = row_indices[loc2]; access::rw(row_indices[loc2]) = row_indices[loc2 - 1]; access::rw(row_indices[loc2 - 1]) = tmp_index; loc2--; // And decrement the counter. } // Now set the row index correctly. access::rw(row_indices[loc2]) = in_row1; } /* else: no need to swap anything; both values are zero */ } } template inline void SpMat::swap_cols(const uword in_col1, const uword in_col2) { arma_debug_sigprint(); arma_conform_check_bounds( ((in_col1 >= n_cols) || (in_col2 >= n_cols)), "SpMat::swap_cols(): out of bounds" ); if(in_col1 == in_col2) { return; } // TODO: this is a rudimentary implementation const SpMat tmp1 = (*this).col(in_col1); const SpMat tmp2 = (*this).col(in_col2); (*this).col(in_col2) = tmp1; (*this).col(in_col1) = tmp2; // for(uword lrow = 0; lrow < n_rows; ++lrow) // { // const eT tmp = at(lrow, in_col1); // at(lrow, in_col1) = eT( at(lrow, in_col2) ); // at(lrow, in_col2) = tmp; // } } template inline void SpMat::shed_row(const uword row_num) { arma_debug_sigprint(); arma_conform_check_bounds(row_num >= n_rows, "SpMat::shed_row(): out of bounds"); shed_rows (row_num, row_num); } template inline void SpMat::shed_col(const uword col_num) { arma_debug_sigprint(); arma_conform_check_bounds(col_num >= n_cols, "SpMat::shed_col(): out of bounds"); shed_cols(col_num, col_num); } template inline void SpMat::shed_rows(const uword in_row1, const uword in_row2) { arma_debug_sigprint(); arma_conform_check_bounds ( (in_row1 > in_row2) || (in_row2 >= n_rows), "SpMat::shed_rows(): indices out of bounds or incorrectly used" ); sync_csc(); SpMat newmat(n_rows - (in_row2 - in_row1 + 1), n_cols); // First, count the number of elements we will be removing. uword removing = 0; for(uword i = 0; i < n_nonzero; ++i) { const uword lrow = row_indices[i]; if(lrow >= in_row1 && lrow <= in_row2) { ++removing; } } // Obtain counts of the number of points in each column and store them as the // (invalid) column pointers of the new matrix. for(uword i = 1; i < n_cols + 1; ++i) { access::rw(newmat.col_ptrs[i]) = col_ptrs[i] - col_ptrs[i - 1]; } // Now initialize memory for the new matrix. newmat.mem_resize(n_nonzero - removing); // Now, copy over the elements. // i is the index in the old matrix; j is the index in the new matrix. const_iterator it = cbegin(); const_iterator it_end = cend(); uword j = 0; // The index in the new matrix. while(it != it_end) { const uword lrow = it.row(); const uword lcol = it.col(); if(lrow >= in_row1 && lrow <= in_row2) { // This element is being removed. Subtract it from the column counts. --access::rw(newmat.col_ptrs[lcol + 1]); } else { // This element is being kept. We may need to map the row index, // if it is past the section of rows we are removing. if(lrow > in_row2) { access::rw(newmat.row_indices[j]) = lrow - (in_row2 - in_row1 + 1); } else { access::rw(newmat.row_indices[j]) = lrow; } access::rw(newmat.values[j]) = (*it); ++j; // Increment index in new matrix. } ++it; } // Finally, sum the column counts so they are correct column pointers. for(uword i = 1; i < n_cols + 1; ++i) { access::rw(newmat.col_ptrs[i]) += newmat.col_ptrs[i - 1]; } // Now steal the memory of the new matrix. steal_mem(newmat); } template inline void SpMat::shed_cols(const uword in_col1, const uword in_col2) { arma_debug_sigprint(); arma_conform_check_bounds ( (in_col1 > in_col2) || (in_col2 >= n_cols), "SpMat::shed_cols(): indices out of bounds or incorrectly used" ); sync_csc(); invalidate_cache(); // First we find the locations in values and row_indices for the column entries. uword col_beg = col_ptrs[in_col1]; uword col_end = col_ptrs[in_col2 + 1]; // Then we find the number of entries in the column. uword diff = col_end - col_beg; if(diff > 0) { eT* new_values = memory::acquire (n_nonzero + 1 - diff); uword* new_row_indices = memory::acquire(n_nonzero + 1 - diff); // Copy first part. if(col_beg != 0) { arrayops::copy(new_values, values, col_beg); arrayops::copy(new_row_indices, row_indices, col_beg); } // Copy second part. if(col_end != n_nonzero) { arrayops::copy(new_values + col_beg, values + col_end, n_nonzero - col_end); arrayops::copy(new_row_indices + col_beg, row_indices + col_end, n_nonzero - col_end); } // Copy sentry element. new_values[n_nonzero - diff] = values[n_nonzero]; new_row_indices[n_nonzero - diff] = row_indices[n_nonzero]; if(values) { memory::release(access::rw(values)); } if(row_indices) { memory::release(access::rw(row_indices)); } access::rw(values) = new_values; access::rw(row_indices) = new_row_indices; // Update counts and such. access::rw(n_nonzero) -= diff; } // Update column pointers. const uword new_n_cols = n_cols - ((in_col2 - in_col1) + 1); uword* new_col_ptrs = memory::acquire(new_n_cols + 2); new_col_ptrs[new_n_cols + 1] = std::numeric_limits::max(); // Copy first set of columns (no manipulation required). if(in_col1 != 0) { arrayops::copy(new_col_ptrs, col_ptrs, in_col1); } // Copy second set of columns (manipulation required). uword cur_col = in_col1; for(uword i = in_col2 + 1; i <= n_cols; ++i, ++cur_col) { new_col_ptrs[cur_col] = col_ptrs[i] - diff; } if(col_ptrs) { memory::release(access::rw(col_ptrs)); } access::rw(col_ptrs) = new_col_ptrs; // We update the element and column counts, and we're done. access::rw(n_cols) = new_n_cols; access::rw(n_elem) = n_cols * n_rows; } /** * Element access; access the i'th element (works identically to the Mat accessors). * If there is nothing at element i, 0 is returned. */ template arma_inline SpMat_MapMat_val SpMat::operator[](const uword i) { const uword in_col = i / n_rows; const uword in_row = i % n_rows; return SpMat_MapMat_val((*this), cache, in_row, in_col); } template arma_inline eT SpMat::operator[](const uword i) const { return get_value(i); } template arma_inline SpMat_MapMat_val SpMat::at(const uword i) { const uword in_col = i / n_rows; const uword in_row = i % n_rows; return SpMat_MapMat_val((*this), cache, in_row, in_col); } template arma_inline eT SpMat::at(const uword i) const { return get_value(i); } template arma_inline SpMat_MapMat_val SpMat::operator()(const uword i) { arma_conform_check_bounds( (i >= n_elem), "SpMat::operator(): out of bounds" ); const uword in_col = i / n_rows; const uword in_row = i % n_rows; return SpMat_MapMat_val((*this), cache, in_row, in_col); } template arma_inline eT SpMat::operator()(const uword i) const { arma_conform_check_bounds( (i >= n_elem), "SpMat::operator(): out of bounds" ); return get_value(i); } /** * Element access; access the element at row in_rows and column in_col. * If there is nothing at that position, 0 is returned. */ #if defined(__cpp_multidimensional_subscript) template arma_inline SpMat_MapMat_val SpMat::operator[] (const uword in_row, const uword in_col) { return SpMat_MapMat_val((*this), cache, in_row, in_col); } template arma_inline eT SpMat::operator[] (const uword in_row, const uword in_col) const { return get_value(in_row, in_col); } #endif template arma_inline SpMat_MapMat_val SpMat::at(const uword in_row, const uword in_col) { return SpMat_MapMat_val((*this), cache, in_row, in_col); } template arma_inline eT SpMat::at(const uword in_row, const uword in_col) const { return get_value(in_row, in_col); } template arma_inline SpMat_MapMat_val SpMat::operator()(const uword in_row, const uword in_col) { arma_conform_check_bounds( ((in_row >= n_rows) || (in_col >= n_cols)), "SpMat::operator(): out of bounds" ); return SpMat_MapMat_val((*this), cache, in_row, in_col); } template arma_inline eT SpMat::operator()(const uword in_row, const uword in_col) const { arma_conform_check_bounds( ((in_row >= n_rows) || (in_col >= n_cols)), "SpMat::operator(): out of bounds" ); return get_value(in_row, in_col); } /** * Check if matrix is empty (no size, no values). */ template arma_inline bool SpMat::is_empty() const { return (n_elem == 0); } //! returns true if the object can be interpreted as a column or row vector template arma_inline bool SpMat::is_vec() const { return ( (n_rows == 1) || (n_cols == 1) ); } //! returns true if the object can be interpreted as a row vector template arma_inline bool SpMat::is_rowvec() const { return (n_rows == 1); } //! returns true if the object can be interpreted as a column vector template arma_inline bool SpMat::is_colvec() const { return (n_cols == 1); } //! returns true if the object has the same number of non-zero rows and columns template arma_inline bool SpMat::is_square() const { return (n_rows == n_cols); } template inline bool SpMat::is_symmetric() const { arma_debug_sigprint(); const SpMat& A = (*this); if(A.n_rows != A.n_cols) { return false; } const SpMat tmp = A - A.st(); return (tmp.n_nonzero == uword(0)); } template inline bool SpMat::is_symmetric(const typename get_pod_type::result tol) const { arma_debug_sigprint(); typedef typename get_pod_type::result T; if(tol == T(0)) { return (*this).is_symmetric(); } arma_conform_check( (tol < T(0)), "is_symmetric(): parameter 'tol' must be >= 0" ); const SpMat& A = (*this); if(A.n_rows != A.n_cols) { return false; } const T norm_A = as_scalar( arma::max(sum(abs(A), 1), 0) ); if(norm_A == T(0)) { return true; } const T norm_A_Ast = as_scalar( arma::max(sum(abs(A - A.st()), 1), 0) ); return ( (norm_A_Ast / norm_A) <= tol ); } template inline bool SpMat::is_hermitian() const { arma_debug_sigprint(); const SpMat& A = (*this); if(A.n_rows != A.n_cols) { return false; } const SpMat tmp = A - A.t(); return (tmp.n_nonzero == uword(0)); } template inline bool SpMat::is_hermitian(const typename get_pod_type::result tol) const { arma_debug_sigprint(); typedef typename get_pod_type::result T; if(tol == T(0)) { return (*this).is_hermitian(); } arma_conform_check( (tol < T(0)), "is_hermitian(): parameter 'tol' must be >= 0" ); const SpMat& A = (*this); if(A.n_rows != A.n_cols) { return false; } const T norm_A = as_scalar( arma::max(sum(abs(A), 1), 0) ); if(norm_A == T(0)) { return true; } const T norm_A_At = as_scalar( arma::max(sum(abs(A - A.t()), 1), 0) ); return ( (norm_A_At / norm_A) <= tol ); } template inline bool SpMat::internal_is_finite() const { arma_debug_sigprint(); sync_csc(); return arrayops::is_finite(values, n_nonzero); } template inline bool SpMat::internal_has_inf() const { arma_debug_sigprint(); sync_csc(); return arrayops::has_inf(values, n_nonzero); } template inline bool SpMat::internal_has_nan() const { arma_debug_sigprint(); sync_csc(); return arrayops::has_nan(values, n_nonzero); } template inline bool SpMat::internal_has_nonfinite() const { arma_debug_sigprint(); sync_csc(); return (arrayops::is_finite(values, n_nonzero) == false); } //! returns true if the given index is currently in range template arma_inline bool SpMat::in_range(const uword i) const { return (i < n_elem); } //! returns true if the given start and end indices are currently in range template arma_inline bool SpMat::in_range(const span& x) const { arma_debug_sigprint(); if(x.whole) { return true; } else { const uword a = x.a; const uword b = x.b; return ( (a <= b) && (b < n_elem) ); } } //! returns true if the given location is currently in range template arma_inline bool SpMat::in_range(const uword in_row, const uword in_col) const { return ( (in_row < n_rows) && (in_col < n_cols) ); } template arma_inline bool SpMat::in_range(const span& row_span, const uword in_col) const { arma_debug_sigprint(); if(row_span.whole) { return (in_col < n_cols); } else { const uword in_row1 = row_span.a; const uword in_row2 = row_span.b; return ( (in_row1 <= in_row2) && (in_row2 < n_rows) && (in_col < n_cols) ); } } template arma_inline bool SpMat::in_range(const uword in_row, const span& col_span) const { arma_debug_sigprint(); if(col_span.whole) { return (in_row < n_rows); } else { const uword in_col1 = col_span.a; const uword in_col2 = col_span.b; return ( (in_row < n_rows) && (in_col1 <= in_col2) && (in_col2 < n_cols) ); } } template arma_inline bool SpMat::in_range(const span& row_span, const span& col_span) const { arma_debug_sigprint(); const uword in_row1 = row_span.a; const uword in_row2 = row_span.b; const uword in_col1 = col_span.a; const uword in_col2 = col_span.b; const bool rows_ok = row_span.whole ? true : ( (in_row1 <= in_row2) && (in_row2 < n_rows) ); const bool cols_ok = col_span.whole ? true : ( (in_col1 <= in_col2) && (in_col2 < n_cols) ); return ( rows_ok && cols_ok ); } template arma_inline bool SpMat::in_range(const uword in_row, const uword in_col, const SizeMat& s) const { const uword l_n_rows = n_rows; const uword l_n_cols = n_cols; if( (in_row >= l_n_rows) || (in_col >= l_n_cols) || ((in_row + s.n_rows) > l_n_rows) || ((in_col + s.n_cols) > l_n_cols) ) { return false; } else { return true; } } //! Set the size to the size of another matrix. template template inline SpMat& SpMat::copy_size(const SpMat& m) { arma_debug_sigprint(); return set_size(m.n_rows, m.n_cols); } template template inline SpMat& SpMat::copy_size(const Mat& m) { arma_debug_sigprint(); return set_size(m.n_rows, m.n_cols); } template inline SpMat& SpMat::set_size(const uword new_n_elem) { arma_debug_sigprint(); const uword new_n_rows = (vec_state == 2) ? uword(1 ) : uword(new_n_elem); const uword new_n_cols = (vec_state == 2) ? uword(new_n_elem) : uword(1 ); return set_size(new_n_rows, new_n_cols); } template inline SpMat& SpMat::set_size(const uword in_rows, const uword in_cols) { arma_debug_sigprint(); invalidate_cache(); // placed here, as set_size() is used during matrix modification if( (n_rows == in_rows) && (n_cols == in_cols) ) { return *this; } init(in_rows, in_cols); return *this; } template inline SpMat& SpMat::set_size(const SizeMat& s) { arma_debug_sigprint(); return (*this).set_size(s.n_rows, s.n_cols); } template inline SpMat& SpMat::resize(const uword in_rows, const uword in_cols) { arma_debug_sigprint(); if( (n_rows == in_rows) && (n_cols == in_cols) ) { return *this; } if( (n_elem == 0) || (n_nonzero == 0) ) { return set_size(in_rows, in_cols); } SpMat tmp(in_rows, in_cols); if(tmp.n_elem > 0) { sync_csc(); const uword last_row = (std::min)(in_rows, n_rows) - 1; const uword last_col = (std::min)(in_cols, n_cols) - 1; tmp.submat(0, 0, last_row, last_col) = (*this).submat(0, 0, last_row, last_col); } steal_mem(tmp); return *this; } template inline SpMat& SpMat::resize(const SizeMat& s) { arma_debug_sigprint(); return (*this).resize(s.n_rows, s.n_cols); } template inline SpMat& SpMat::reshape(const uword in_rows, const uword in_cols) { arma_debug_sigprint(); arma_check( ((in_rows*in_cols) != n_elem), "SpMat::reshape(): changing the number of elements in a sparse matrix is currently not supported" ); if( (n_rows == in_rows) && (n_cols == in_cols) ) { return *this; } if(vec_state == 1) { arma_conform_check( (in_cols != 1), "SpMat::reshape(): object is a column vector; requested size is not compatible" ); } if(vec_state == 2) { arma_conform_check( (in_rows != 1), "SpMat::reshape(): object is a row vector; requested size is not compatible" ); } if(n_nonzero == 0) { return (*this).zeros(in_rows, in_cols); } if(in_cols == 1) { (*this).reshape_helper_intovec(); } else { (*this).reshape_helper_generic(in_rows, in_cols); } return *this; } template inline SpMat& SpMat::reshape(const SizeMat& s) { arma_debug_sigprint(); return (*this).reshape(s.n_rows, s.n_cols); } template inline void SpMat::reshape_helper_generic(const uword in_rows, const uword in_cols) { arma_debug_sigprint(); sync_csc(); invalidate_cache(); // We have to modify all of the relevant row indices and the relevant column pointers. // Iterate over all the points to do this. We won't be deleting any points, but we will be modifying // columns and rows. We'll have to store a new set of column vectors. uword* new_col_ptrs = memory::acquire(in_cols + 2); new_col_ptrs[in_cols + 1] = std::numeric_limits::max(); uword* new_row_indices = memory::acquire(n_nonzero + 1); access::rw(new_row_indices[n_nonzero]) = 0; arrayops::fill_zeros(new_col_ptrs, in_cols + 1); const_iterator it = cbegin(); const_iterator it_end = cend(); for(; it != it_end; ++it) { uword vector_position = (it.col() * n_rows) + it.row(); new_row_indices[it.pos()] = vector_position % in_rows; ++new_col_ptrs[vector_position / in_rows + 1]; } // Now sum the column counts to get the new column pointers. for(uword i = 1; i <= in_cols; i++) { access::rw(new_col_ptrs[i]) += new_col_ptrs[i - 1]; } // Copy the new row indices. if(row_indices) { memory::release(access::rw(row_indices)); } if(col_ptrs) { memory::release(access::rw(col_ptrs)); } access::rw(row_indices) = new_row_indices; access::rw(col_ptrs) = new_col_ptrs; // Now set the size. access::rw(n_rows) = in_rows; access::rw(n_cols) = in_cols; } template inline void SpMat::reshape_helper_intovec() { arma_debug_sigprint(); sync_csc(); invalidate_cache(); const_iterator it = cbegin(); const uword t_n_rows = n_rows; const uword t_n_nonzero = n_nonzero; for(uword i=0; i < t_n_nonzero; ++i) { const uword t_index = (it.col() * t_n_rows) + it.row(); // ensure the iterator is pointing to the next element // before we overwrite the row index of the current element ++it; access::rw(row_indices[i]) = t_index; } access::rw(row_indices[n_nonzero]) = 0; access::rw(col_ptrs[0]) = 0; access::rw(col_ptrs[1]) = n_nonzero; access::rw(col_ptrs[2]) = std::numeric_limits::max(); access::rw(n_rows) = (n_rows * n_cols); access::rw(n_cols) = 1; } //! apply a functor to each non-zero element template template inline SpMat& SpMat::for_each(functor F) { arma_debug_sigprint(); sync_csc(); const uword N = (*this).n_nonzero; eT* rw_values = access::rwp(values); bool modified = false; bool has_zero = false; for(uword i=0; i < N; ++i) { eT& new_value = rw_values[i]; const eT old_value = new_value; F(new_value); if(new_value != old_value) { modified = true; } if(new_value == eT(0) ) { has_zero = true; } } if(modified) { invalidate_cache(); } if(has_zero) { remove_zeros(); } return *this; } template template inline const SpMat& SpMat::for_each(functor F) const { arma_debug_sigprint(); sync_csc(); const uword N = (*this).n_nonzero; for(uword i=0; i < N; ++i) { F(values[i]); } return *this; } //! transform each non-zero element using a functor template template inline SpMat& SpMat::transform(functor F) { arma_debug_sigprint(); sync_csc(); invalidate_cache(); const uword N = (*this).n_nonzero; eT* rw_values = access::rwp(values); bool has_zero = false; for(uword i=0; i < N; ++i) { eT& rw_values_i = rw_values[i]; rw_values_i = eT( F(rw_values_i) ); if(rw_values_i == eT(0)) { has_zero = true; } } if(has_zero) { remove_zeros(); } return *this; } template inline SpMat& SpMat::replace(const eT old_val, const eT new_val) { arma_debug_sigprint(); if(old_val == eT(0)) { arma_warn(1, "SpMat::replace(): replacement not done, as old_val = 0"); } else { sync_csc(); invalidate_cache(); arrayops::replace(access::rwp(values), n_nonzero, old_val, new_val); if(new_val == eT(0)) { remove_zeros(); } } return *this; } template inline SpMat& SpMat::clean(const typename get_pod_type::result threshold) { arma_debug_sigprint(); if(n_nonzero == 0) { return *this; } sync_csc(); invalidate_cache(); arrayops::clean(access::rwp(values), n_nonzero, threshold); remove_zeros(); return *this; } template inline SpMat& SpMat::clamp(const eT min_val, const eT max_val) { arma_debug_sigprint(); if(is_cx::no) { arma_conform_check( (access::tmp_real(min_val) > access::tmp_real(max_val)), "SpMat::clamp(): min_val must be less than max_val" ); } else { arma_conform_check( (access::tmp_real(min_val) > access::tmp_real(max_val)), "SpMat::clamp(): real(min_val) must be less than real(max_val)" ); arma_conform_check( (access::tmp_imag(min_val) > access::tmp_imag(max_val)), "SpMat::clamp(): imag(min_val) must be less than imag(max_val)" ); } if(n_nonzero == 0) { return *this; } sync_csc(); invalidate_cache(); arrayops::clamp(access::rwp(values), n_nonzero, min_val, max_val); if( (min_val == eT(0)) || (max_val == eT(0)) ) { remove_zeros(); } return *this; } template inline SpMat& SpMat::zeros() { arma_debug_sigprint(); if((n_nonzero == 0) && (values != nullptr)) { invalidate_cache(); } else { init(n_rows, n_cols); } return *this; } template inline SpMat& SpMat::zeros(const uword new_n_elem) { arma_debug_sigprint(); const uword new_n_rows = (vec_state == 2) ? uword(1 ) : uword(new_n_elem); const uword new_n_cols = (vec_state == 2) ? uword(new_n_elem) : uword(1 ); return zeros(new_n_rows, new_n_cols); } template inline SpMat& SpMat::zeros(const uword in_rows, const uword in_cols) { arma_debug_sigprint(); if((n_nonzero == 0) && (n_rows == in_rows) && (n_cols == in_cols) && (values != nullptr)) { invalidate_cache(); } else { init(in_rows, in_cols); } return *this; } template inline SpMat& SpMat::zeros(const SizeMat& s) { arma_debug_sigprint(); return (*this).zeros(s.n_rows, s.n_cols); } template inline SpMat& SpMat::eye() { arma_debug_sigprint(); return (*this).eye(n_rows, n_cols); } template inline SpMat& SpMat::eye(const uword in_rows, const uword in_cols) { arma_debug_sigprint(); const uword N = (std::min)(in_rows, in_cols); init(in_rows, in_cols, N); arrayops::inplace_set(access::rwp(values), eT(1), N); for(uword i = 0; i < N; ++i) { access::rw(row_indices[i]) = i; } for(uword i = 0; i <= N; ++i) { access::rw(col_ptrs[i]) = i; } // take into account non-square matrices for(uword i = (N+1); i <= in_cols; ++i) { access::rw(col_ptrs[i]) = N; } access::rw(n_nonzero) = N; return *this; } template inline SpMat& SpMat::eye(const SizeMat& s) { arma_debug_sigprint(); return (*this).eye(s.n_rows, s.n_cols); } template inline SpMat& SpMat::speye() { arma_debug_sigprint(); return (*this).eye(n_rows, n_cols); } template inline SpMat& SpMat::speye(const uword in_n_rows, const uword in_n_cols) { arma_debug_sigprint(); return (*this).eye(in_n_rows, in_n_cols); } template inline SpMat& SpMat::speye(const SizeMat& s) { arma_debug_sigprint(); return (*this).eye(s.n_rows, s.n_cols); } template inline SpMat& SpMat::sprandu(const uword in_rows, const uword in_cols, const double density) { arma_debug_sigprint(); arma_conform_check( ( (density < double(0)) || (density > double(1)) ), "sprandu(): density must be in the [0,1] interval" ); const uword new_n_nonzero = uword(density * double(in_rows) * double(in_cols) + 0.5); init(in_rows, in_cols, new_n_nonzero); if(new_n_nonzero == 0) { return *this; } arma_rng::randu::fill( access::rwp(values), new_n_nonzero ); uvec indices = linspace( 0u, in_rows*in_cols-1, new_n_nonzero ); // perturb the indices for(uword i=1; i < new_n_nonzero-1; ++i) { const uword index_left = indices[i-1]; const uword index_right = indices[i+1]; const uword center = (index_left + index_right) / 2; const uword delta1 = center - index_left - 1; const uword delta2 = index_right - center - 1; const uword min_delta = (std::min)(delta1, delta2); uword index_new = uword( double(center) + double(min_delta) * (2.0*randu()-1.0) ); // paranoia, but better be safe than sorry if( (index_left < index_new) && (index_new < index_right) ) { indices[i] = index_new; } } for(uword i=0; i inline SpMat& SpMat::sprandu(const SizeMat& s, const double density) { arma_debug_sigprint(); return (*this).sprandu(s.n_rows, s.n_cols, density); } template inline SpMat& SpMat::sprandn(const uword in_rows, const uword in_cols, const double density) { arma_debug_sigprint(); arma_conform_check( ( (density < double(0)) || (density > double(1)) ), "sprandn(): density must be in the [0,1] interval" ); const uword new_n_nonzero = uword(density * double(in_rows) * double(in_cols) + 0.5); init(in_rows, in_cols, new_n_nonzero); if(new_n_nonzero == 0) { return *this; } arma_rng::randn::fill( access::rwp(values), new_n_nonzero ); uvec indices = linspace( 0u, in_rows*in_cols-1, new_n_nonzero ); // perturb the indices for(uword i=1; i < new_n_nonzero-1; ++i) { const uword index_left = indices[i-1]; const uword index_right = indices[i+1]; const uword center = (index_left + index_right) / 2; const uword delta1 = center - index_left - 1; const uword delta2 = index_right - center - 1; const uword min_delta = (std::min)(delta1, delta2); uword index_new = uword( double(center) + double(min_delta) * (2.0*randu()-1.0) ); // paranoia, but better be safe than sorry if( (index_left < index_new) && (index_new < index_right) ) { indices[i] = index_new; } } for(uword i=0; i inline SpMat& SpMat::sprandn(const SizeMat& s, const double density) { arma_debug_sigprint(); return (*this).sprandn(s.n_rows, s.n_cols, density); } template inline void SpMat::reset() { arma_debug_sigprint(); const uword new_n_rows = (vec_state == 2) ? 1 : 0; const uword new_n_cols = (vec_state == 1) ? 1 : 0; init(new_n_rows, new_n_cols); } template inline void SpMat::reset_cache() { arma_debug_sigprint(); sync_csc(); #if defined(ARMA_USE_OPENMP) { #pragma omp critical (arma_SpMat_cache) { cache.reset(); sync_state = 0; } } #elif defined(ARMA_USE_STD_MUTEX) { const std::lock_guard lock(cache_mutex); cache.reset(); sync_state = 0; } #else { cache.reset(); sync_state = 0; } #endif } template inline void SpMat::reserve(const uword in_rows, const uword in_cols, const uword new_n_nonzero) { arma_debug_sigprint(); init(in_rows, in_cols, new_n_nonzero); } template template inline void SpMat::set_real(const SpBase::pod_type,T1>& X) { arma_debug_sigprint(); SpMat_aux::set_real(*this, X); } template template inline void SpMat::set_imag(const SpBase::pod_type,T1>& X) { arma_debug_sigprint(); SpMat_aux::set_imag(*this, X); } //! save the matrix to a file template inline bool SpMat::save(const std::string name, const file_type type) const { arma_debug_sigprint(); sync_csc(); bool save_okay; switch(type) { case csv_ascii: return (*this).save(csv_name(name), type); break; case ssv_ascii: return (*this).save(csv_name(name), type); break; case arma_binary: save_okay = diskio::save_arma_binary(*this, name); break; case coord_ascii: save_okay = diskio::save_coord_ascii(*this, name); break; default: arma_warn(1, "SpMat::save(): unsupported file type"); save_okay = false; } if(save_okay == false) { arma_warn(3, "SpMat::save(): write failed; file: ", name); } return save_okay; } template inline bool SpMat::save(const csv_name& spec, const file_type type) const { arma_debug_sigprint(); if( (type != csv_ascii) && (type != ssv_ascii) ) { arma_stop_runtime_error("SpMat::save(): unsupported file type for csv_name()"); return false; } const bool do_trans = bool(spec.opts.flags & csv_opts::flag_trans ); const bool no_header = bool(spec.opts.flags & csv_opts::flag_no_header ); const bool with_header = bool(spec.opts.flags & csv_opts::flag_with_header) && (no_header == false); const bool use_semicolon = bool(spec.opts.flags & csv_opts::flag_semicolon ) || (type == ssv_ascii); arma_debug_print("SpMat::save(csv_name): enabled flags:"); if(do_trans ) { arma_debug_print("trans"); } if(no_header ) { arma_debug_print("no_header"); } if(with_header ) { arma_debug_print("with_header"); } if(use_semicolon) { arma_debug_print("semicolon"); } const char separator = (use_semicolon) ? char(';') : char(','); if(with_header) { if( (spec.header_ro.n_cols != 1) && (spec.header_ro.n_rows != 1) ) { arma_warn(1, "SpMat::save(): given header must have a vector layout"); return false; } for(uword i=0; i < spec.header_ro.n_elem; ++i) { const std::string& token = spec.header_ro.at(i); if(token.find(separator) != std::string::npos) { arma_warn(1, "SpMat::save(): token within the header contains the separator character: '", token, "'"); return false; } } const uword save_n_cols = (do_trans) ? (*this).n_rows : (*this).n_cols; if(spec.header_ro.n_elem != save_n_cols) { arma_warn(1, "SpMat::save(): size mismatch between header and matrix"); return false; } } bool save_okay = false; if(do_trans) { const SpMat tmp = (*this).st(); save_okay = diskio::save_csv_ascii(tmp, spec.filename, spec.header_ro, with_header, separator); } else { save_okay = diskio::save_csv_ascii(*this, spec.filename, spec.header_ro, with_header, separator); } if(save_okay == false) { arma_warn(3, "SpMat::save(): write failed; file: ", spec.filename); } return save_okay; } //! save the matrix to a stream template inline bool SpMat::save(std::ostream& os, const file_type type) const { arma_debug_sigprint(); sync_csc(); bool save_okay; switch(type) { case csv_ascii: save_okay = diskio::save_csv_ascii(*this, os, char(',')); break; case ssv_ascii: save_okay = diskio::save_csv_ascii(*this, os, char(';')); break; case arma_binary: save_okay = diskio::save_arma_binary(*this, os); break; case coord_ascii: save_okay = diskio::save_coord_ascii(*this, os); break; default: arma_warn(1, "SpMat::save(): unsupported file type"); save_okay = false; } if(save_okay == false) { arma_warn(3, "SpMat::save(): stream write failed"); } return save_okay; } //! load a matrix from a file template inline bool SpMat::load(const std::string name, const file_type type) { arma_debug_sigprint(); invalidate_cache(); bool load_okay; std::string err_msg; switch(type) { // case auto_detect: // load_okay = diskio::load_auto_detect(*this, name, err_msg); // break; case csv_ascii: return (*this).load(csv_name(name), type); break; case ssv_ascii: return (*this).load(csv_name(name), type); break; case arma_binary: load_okay = diskio::load_arma_binary(*this, name, err_msg); break; case coord_ascii: load_okay = diskio::load_coord_ascii(*this, name, err_msg); break; default: arma_warn(1, "SpMat::load(): unsupported file type"); load_okay = false; } if(load_okay == false) { if(err_msg.length() > 0) { arma_warn(3, "SpMat::load(): ", err_msg, "; file: ", name); } else { arma_warn(3, "SpMat::load(): read failed; file: ", name); } } if(load_okay == false) { (*this).reset(); } return load_okay; } template inline bool SpMat::load(const csv_name& spec, const file_type type) { arma_debug_sigprint(); if( (type != csv_ascii) && (type != ssv_ascii) ) { arma_stop_runtime_error("SpMat::load(): unsupported file type for csv_name()"); return false; } const bool do_trans = bool(spec.opts.flags & csv_opts::flag_trans ); const bool no_header = bool(spec.opts.flags & csv_opts::flag_no_header ); const bool with_header = bool(spec.opts.flags & csv_opts::flag_with_header) && (no_header == false); const bool use_semicolon = bool(spec.opts.flags & csv_opts::flag_semicolon ) || (type == ssv_ascii); const bool strict = bool(spec.opts.flags & csv_opts::flag_strict ); arma_debug_print("SpMat::load(csv_name): enabled flags:"); if(do_trans ) { arma_debug_print("trans"); } if(no_header ) { arma_debug_print("no_header"); } if(with_header ) { arma_debug_print("with_header"); } if(use_semicolon) { arma_debug_print("semicolon"); } if(strict ) { arma_debug_print("strict"); } if(strict) { arma_warn(1, "SpMat::load(): option 'strict' not implemented for sparse matrices"); } const char separator = (use_semicolon) ? char(';') : char(','); bool load_okay = false; std::string err_msg; if(do_trans) { SpMat tmp_mat; load_okay = diskio::load_csv_ascii(tmp_mat, spec.filename, err_msg, spec.header_rw, with_header, separator); if(load_okay) { (*this) = tmp_mat.st(); if(with_header) { // field::set_size() preserves data if the number of elements hasn't changed spec.header_rw.set_size(spec.header_rw.n_elem, 1); } } } else { load_okay = diskio::load_csv_ascii(*this, spec.filename, err_msg, spec.header_rw, with_header, separator); } if(load_okay == false) { if(err_msg.length() > 0) { arma_warn(3, "SpMat::load(): ", err_msg, "; file: ", spec.filename); } else { arma_warn(3, "SpMat::load(): read failed; file: ", spec.filename); } } else { const uword load_n_cols = (do_trans) ? (*this).n_rows : (*this).n_cols; if(with_header && (spec.header_rw.n_elem != load_n_cols)) { arma_warn(3, "SpMat::load(): size mismatch between header and matrix"); } } if(load_okay == false) { (*this).reset(); if(with_header) { spec.header_rw.reset(); } } return load_okay; } //! load a matrix from a stream template inline bool SpMat::load(std::istream& is, const file_type type) { arma_debug_sigprint(); invalidate_cache(); bool load_okay; std::string err_msg; switch(type) { // case auto_detect: // load_okay = diskio::load_auto_detect(*this, is, err_msg); // break; case csv_ascii: load_okay = diskio::load_csv_ascii(*this, is, err_msg, char(',')); break; case ssv_ascii: load_okay = diskio::load_csv_ascii(*this, is, err_msg, char(';')); break; case arma_binary: load_okay = diskio::load_arma_binary(*this, is, err_msg); break; case coord_ascii: load_okay = diskio::load_coord_ascii(*this, is, err_msg); break; default: arma_warn(1, "SpMat::load(): unsupported file type"); load_okay = false; } if(load_okay == false) { if(err_msg.length() > 0) { arma_warn(3, "SpMat::load(): ", err_msg); } else { arma_warn(3, "SpMat::load(): stream read failed"); } } if(load_okay == false) { (*this).reset(); } return load_okay; } template inline bool SpMat::quiet_save(const std::string name, const file_type type) const { arma_debug_sigprint(); return (*this).save(name, type); } template inline bool SpMat::quiet_save(std::ostream& os, const file_type type) const { arma_debug_sigprint(); return (*this).save(os, type); } template inline bool SpMat::quiet_load(const std::string name, const file_type type) { arma_debug_sigprint(); return (*this).load(name, type); } template inline bool SpMat::quiet_load(std::istream& is, const file_type type) { arma_debug_sigprint(); return (*this).load(is, type); } /** * Initialize the matrix to the specified size. Data is not preserved, so the matrix is assumed to be entirely sparse (empty). */ template inline void SpMat::init(uword in_rows, uword in_cols, const uword new_n_nonzero) { arma_debug_sigprint(); invalidate_cache(); // placed here, as init() is used during matrix modification // Clean out the existing memory. if(values ) { memory::release(access::rw(values)); } if(row_indices) { memory::release(access::rw(row_indices)); } if(col_ptrs ) { memory::release(access::rw(col_ptrs)); } // in case init_cold() throws an exception access::rw(n_rows) = 0; access::rw(n_cols) = 0; access::rw(n_elem) = 0; access::rw(n_nonzero) = 0; access::rw(values) = nullptr; access::rw(row_indices) = nullptr; access::rw(col_ptrs) = nullptr; init_cold(in_rows, in_cols, new_n_nonzero); } template inline void SpMat::init_cold(uword in_rows, uword in_cols, const uword new_n_nonzero) { arma_debug_sigprint(); // Verify that we are allowed to do this. if(vec_state > 0) { if((in_rows == 0) && (in_cols == 0)) { if(vec_state == 1) { in_cols = 1; } if(vec_state == 2) { in_rows = 1; } } else { if(vec_state == 1) { arma_conform_check( (in_cols != 1), "SpMat::init(): object is a column vector; requested size is not compatible" ); } if(vec_state == 2) { arma_conform_check( (in_rows != 1), "SpMat::init(): object is a row vector; requested size is not compatible" ); } } } #if defined(ARMA_64BIT_WORD) const char* error_message = "SpMat::init(): requested size is too large"; #else const char* error_message = "SpMat::init(): requested size is too large; suggest to enable ARMA_64BIT_WORD"; #endif // Ensure that n_elem can hold the result of (n_rows * n_cols) arma_conform_check ( ( ( (in_rows > ARMA_MAX_UHWORD) || (in_cols > ARMA_MAX_UHWORD) ) ? ( (double(in_rows) * double(in_cols)) > double(ARMA_MAX_UWORD) ) : false ), error_message ); access::rw(col_ptrs) = memory::acquire(in_cols + 2); access::rw(values) = memory::acquire (new_n_nonzero + 1); access::rw(row_indices) = memory::acquire(new_n_nonzero + 1); // fill column pointers with 0, // except for the last element which contains the maximum possible element // (so iterators terminate correctly). arrayops::fill_zeros(access::rwp(col_ptrs), in_cols + 1); access::rw(col_ptrs[in_cols + 1]) = std::numeric_limits::max(); access::rw( values[new_n_nonzero]) = 0; access::rw(row_indices[new_n_nonzero]) = 0; // Set the new size accordingly. access::rw(n_rows) = in_rows; access::rw(n_cols) = in_cols; access::rw(n_elem) = (in_rows * in_cols); access::rw(n_nonzero) = new_n_nonzero; } template inline void SpMat::init(const std::string& text) { arma_debug_sigprint(); Mat tmp(text); if(vec_state == 1) { if((tmp.n_elem > 0) && tmp.is_vec()) { access::rw(tmp.n_rows) = tmp.n_elem; access::rw(tmp.n_cols) = 1; } } if(vec_state == 2) { if((tmp.n_elem > 0) && tmp.is_vec()) { access::rw(tmp.n_rows) = 1; access::rw(tmp.n_cols) = tmp.n_elem; } } (*this).operator=(tmp); } template inline void SpMat::init(const SpMat& x) { arma_debug_sigprint(); if(this == &x) { arma_debug_print("SpMat::init(): copy omitted"); return; } bool init_done = false; #if defined(ARMA_USE_OPENMP) if(x.sync_state == 1) { #pragma omp critical (arma_SpMat_init) if(x.sync_state == 1) { (*this).init(x.cache); init_done = true; } } #elif defined(ARMA_USE_STD_MUTEX) if(x.sync_state == 1) { const std::lock_guard lock(x.cache_mutex); if(x.sync_state == 1) { (*this).init(x.cache); init_done = true; } } #else if(x.sync_state == 1) { (*this).init(x.cache); init_done = true; } #endif if(init_done == false) { (*this).init_simple(x); } } template inline void SpMat::init(const MapMat& x) { arma_debug_sigprint(); const uword x_n_rows = x.n_rows; const uword x_n_cols = x.n_cols; const uword x_n_nz = x.get_n_nonzero(); init(x_n_rows, x_n_cols, x_n_nz); if(x_n_nz == 0) { return; } typename MapMat::map_type& x_map_ref = *(x.map_ptr); typename MapMat::map_type::const_iterator x_it = x_map_ref.begin(); uword x_col = 0; uword x_col_index_start = 0; uword x_col_index_endp1 = x_n_rows; for(uword i=0; i < x_n_nz; ++i) { const std::pair& x_entry = (*x_it); const uword x_index = x_entry.first; const eT x_val = x_entry.second; // have we gone past the current column? if(x_index >= x_col_index_endp1) { x_col = x_index / x_n_rows; x_col_index_start = x_col * x_n_rows; x_col_index_endp1 = x_col_index_start + x_n_rows; } const uword x_row = x_index - x_col_index_start; // // sanity check // // const uword tmp_x_row = x_index % x_n_rows; // const uword tmp_x_col = x_index / x_n_rows; // // if(x_row != tmp_x_row) { cout << "x_row != tmp_x_row" << endl; exit(-1); } // if(x_col != tmp_x_col) { cout << "x_col != tmp_x_col" << endl; exit(-1); } access::rw(values[i]) = x_val; access::rw(row_indices[i]) = x_row; access::rw(col_ptrs[ x_col + 1 ])++; ++x_it; } for(uword i = 0; i < x_n_cols; ++i) { access::rw(col_ptrs[i + 1]) += col_ptrs[i]; } // // OLD METHOD // // for(uword i=0; i < x_n_nz; ++i) // { // const std::pair& x_entry = (*x_it); // // const uword x_index = x_entry.first; // const eT x_val = x_entry.second; // // const uword x_row = x_index % x_n_rows; // const uword x_col = x_index / x_n_rows; // // access::rw(values[i]) = x_val; // access::rw(row_indices[i]) = x_row; // // access::rw(col_ptrs[ x_col + 1 ])++; // // ++x_it; // } // // // for(uword i = 0; i < x_n_cols; ++i) // { // access::rw(col_ptrs[i + 1]) += col_ptrs[i]; // } } template inline void SpMat::init_simple(const SpMat& x) { arma_debug_sigprint(); if(this == &x) { return; } if((x.n_nonzero == 0) && (n_nonzero == 0) && (n_rows == x.n_rows) && (n_cols == x.n_cols) && (values != nullptr)) { invalidate_cache(); } else { init(x.n_rows, x.n_cols, x.n_nonzero); } if(x.n_nonzero != 0) { if(x.values ) { arrayops::copy(access::rwp(values), x.values, x.n_nonzero + 1); } if(x.row_indices) { arrayops::copy(access::rwp(row_indices), x.row_indices, x.n_nonzero + 1); } if(x.col_ptrs ) { arrayops::copy(access::rwp(col_ptrs), x.col_ptrs, x.n_cols + 1); } } } template inline void SpMat::init_batch_std(const Mat& locs, const Mat& vals, const bool sort_locations) { arma_debug_sigprint(); // Resize to correct number of elements. mem_resize(vals.n_elem); // Reset column pointers to zero. arrayops::fill_zeros(access::rwp(col_ptrs), n_cols + 1); bool actually_sorted = true; if(sort_locations) { // check if we really need a time consuming sort const uword locs_n_cols = locs.n_cols; for(uword i = 1; i < locs_n_cols; ++i) { const uword* locs_i = locs.colptr(i ); const uword* locs_im1 = locs.colptr(i-1); const uword row_i = locs_i[0]; const uword col_i = locs_i[1]; const uword row_im1 = locs_im1[0]; const uword col_im1 = locs_im1[1]; if( (col_i < col_im1) || ((col_i == col_im1) && (row_i <= row_im1)) ) { actually_sorted = false; break; } } if(actually_sorted == false) { // see op_sort_index_bones.hpp for the definition of arma_sort_index_packet and arma_sort_index_helper_ascend std::vector< arma_sort_index_packet > packet_vec(locs_n_cols); const uword* locs_mem = locs.memptr(); for(uword i = 0; i < locs_n_cols; ++i) { const uword row = (*locs_mem); locs_mem++; const uword col = (*locs_mem); locs_mem++; packet_vec[i].val = (col * n_rows) + row; packet_vec[i].index = i; } arma_sort_index_helper_ascend comparator; std::sort( packet_vec.begin(), packet_vec.end(), comparator ); // insert the elements in the sorted order for(uword i = 0; i < locs_n_cols; ++i) { const uword index = packet_vec[i].index; const uword* locs_i = locs.colptr(index); const uword row_i = locs_i[0]; const uword col_i = locs_i[1]; arma_conform_check( ( (row_i >= n_rows) || (col_i >= n_cols) ), "SpMat::SpMat(): invalid row or column index" ); if(i > 0) { const uword prev_index = packet_vec[i-1].index; const uword* locs_im1 = locs.colptr(prev_index); const uword row_im1 = locs_im1[0]; const uword col_im1 = locs_im1[1]; arma_conform_check( ( (row_i == row_im1) && (col_i == col_im1) ), "SpMat::SpMat(): detected identical locations" ); } access::rw(values[i]) = vals[index]; access::rw(row_indices[i]) = row_i; access::rw(col_ptrs[ col_i + 1 ])++; } } } if( (sort_locations == false) || (actually_sorted == true) ) { // Now set the values and row indices correctly. // Increment the column pointers in each column (so they are column "counts"). const uword locs_n_cols = locs.n_cols; for(uword i=0; i < locs_n_cols; ++i) { const uword* locs_i = locs.colptr(i); const uword row_i = locs_i[0]; const uword col_i = locs_i[1]; arma_conform_check( ( (row_i >= n_rows) || (col_i >= n_cols) ), "SpMat::SpMat(): invalid row or column index" ); if(i > 0) { const uword* locs_im1 = locs.colptr(i-1); const uword row_im1 = locs_im1[0]; const uword col_im1 = locs_im1[1]; arma_conform_check ( ( (col_i < col_im1) || ((col_i == col_im1) && (row_i < row_im1)) ), "SpMat::SpMat(): out of order points; either pass sort_locations = true, or sort points in column-major ordering" ); arma_conform_check( ( (col_i == col_im1) && (row_i == row_im1) ), "SpMat::SpMat(): detected identical locations" ); } access::rw(values[i]) = vals[i]; access::rw(row_indices[i]) = row_i; access::rw(col_ptrs[ col_i + 1 ])++; } } // Now fix the column pointers. for(uword i = 0; i < n_cols; ++i) { access::rw(col_ptrs[i + 1]) += col_ptrs[i]; } } template inline void SpMat::init_batch_add(const Mat& locs, const Mat& vals, const bool sort_locations) { arma_debug_sigprint(); if(locs.n_cols < 2) { init_batch_std(locs, vals, false); return; } // Reset column pointers to zero. arrayops::fill_zeros(access::rwp(col_ptrs), n_cols + 1); bool actually_sorted = true; if(sort_locations) { // sort_index() uses std::sort() which may use quicksort... so we better // make sure it's not already sorted before taking an O(N^2) sort penalty. for(uword i = 1; i < locs.n_cols; ++i) { const uword* locs_i = locs.colptr(i ); const uword* locs_im1 = locs.colptr(i-1); if( (locs_i[1] < locs_im1[1]) || (locs_i[1] == locs_im1[1] && locs_i[0] <= locs_im1[0]) ) { actually_sorted = false; break; } } if(actually_sorted == false) { // This may not be the fastest possible implementation but it maximizes code reuse. Col abslocs(locs.n_cols, arma_nozeros_indicator()); for(uword i = 0; i < locs.n_cols; ++i) { const uword* locs_i = locs.colptr(i); abslocs[i] = locs_i[1] * n_rows + locs_i[0]; } uvec sorted_indices = sort_index(abslocs); // Ascending sort. // work out the number of unique elements uword n_unique = 1; // first element is unique for(uword i=1; i < sorted_indices.n_elem; ++i) { const uword* locs_i = locs.colptr( sorted_indices[i ] ); const uword* locs_im1 = locs.colptr( sorted_indices[i-1] ); if( (locs_i[1] != locs_im1[1]) || (locs_i[0] != locs_im1[0]) ) { ++n_unique; } } // resize to correct number of elements mem_resize(n_unique); // Now we add the elements in this sorted order. uword count = 0; // first element { const uword i = 0; const uword* locs_i = locs.colptr( sorted_indices[i] ); arma_conform_check( ( (locs_i[0] >= n_rows) || (locs_i[1] >= n_cols) ), "SpMat::SpMat(): invalid row or column index" ); access::rw(values[count]) = vals[ sorted_indices[i] ]; access::rw(row_indices[count]) = locs_i[0]; access::rw(col_ptrs[ locs_i[1] + 1 ])++; } for(uword i=1; i < sorted_indices.n_elem; ++i) { const uword* locs_i = locs.colptr( sorted_indices[i ] ); const uword* locs_im1 = locs.colptr( sorted_indices[i-1] ); arma_conform_check( ( (locs_i[0] >= n_rows) || (locs_i[1] >= n_cols) ), "SpMat::SpMat(): invalid row or column index" ); if( (locs_i[1] == locs_im1[1]) && (locs_i[0] == locs_im1[0]) ) { access::rw(values[count]) += vals[ sorted_indices[i] ]; } else { count++; access::rw(values[count]) = vals[ sorted_indices[i] ]; access::rw(row_indices[count]) = locs_i[0]; access::rw(col_ptrs[ locs_i[1] + 1 ])++; } } } } if( (sort_locations == false) || (actually_sorted == true) ) { // work out the number of unique elements uword n_unique = 1; // first element is unique for(uword i=1; i < locs.n_cols; ++i) { const uword* locs_i = locs.colptr(i ); const uword* locs_im1 = locs.colptr(i-1); if( (locs_i[1] != locs_im1[1]) || (locs_i[0] != locs_im1[0]) ) { ++n_unique; } } // resize to correct number of elements mem_resize(n_unique); // Now set the values and row indices correctly. // Increment the column pointers in each column (so they are column "counts"). uword count = 0; // first element { const uword i = 0; const uword* locs_i = locs.colptr(i); arma_conform_check( ( (locs_i[0] >= n_rows) || (locs_i[1] >= n_cols) ), "SpMat::SpMat(): invalid row or column index" ); access::rw(values[count]) = vals[i]; access::rw(row_indices[count]) = locs_i[0]; access::rw(col_ptrs[ locs_i[1] + 1 ])++; } for(uword i=1; i < locs.n_cols; ++i) { const uword* locs_i = locs.colptr(i ); const uword* locs_im1 = locs.colptr(i-1); arma_conform_check( ( (locs_i[0] >= n_rows) || (locs_i[1] >= n_cols) ), "SpMat::SpMat(): invalid row or column index" ); arma_conform_check ( ( (locs_i[1] < locs_im1[1]) || (locs_i[1] == locs_im1[1] && locs_i[0] < locs_im1[0]) ), "SpMat::SpMat(): out of order points; either pass sort_locations = true, or sort points in column-major ordering" ); if( (locs_i[1] == locs_im1[1]) && (locs_i[0] == locs_im1[0]) ) { access::rw(values[count]) += vals[i]; } else { count++; access::rw(values[count]) = vals[i]; access::rw(row_indices[count]) = locs_i[0]; access::rw(col_ptrs[ locs_i[1] + 1 ])++; } } } // Now fix the column pointers. for(uword i = 0; i < n_cols; ++i) { access::rw(col_ptrs[i + 1]) += col_ptrs[i]; } } //! constructor used by SpRow and SpCol classes template inline SpMat::SpMat(const arma_vec_indicator&, const uword in_vec_state) : n_rows(0) , n_cols(0) , n_elem(0) , n_nonzero(0) , vec_state(in_vec_state) , values(nullptr) , row_indices(nullptr) , col_ptrs(nullptr) { arma_debug_sigprint_this(this); const uword in_n_rows = (in_vec_state == 2) ? 1 : 0; const uword in_n_cols = (in_vec_state == 1) ? 1 : 0; init_cold(in_n_rows, in_n_cols); } //! constructor used by SpRow and SpCol classes template inline SpMat::SpMat(const arma_vec_indicator&, const uword in_n_rows, const uword in_n_cols, const uword in_vec_state) : n_rows(0) , n_cols(0) , n_elem(0) , n_nonzero(0) , vec_state(in_vec_state) , values(nullptr) , row_indices(nullptr) , col_ptrs(nullptr) { arma_debug_sigprint_this(this); init_cold(in_n_rows, in_n_cols); } template inline void SpMat::mem_resize(const uword new_n_nonzero) { arma_debug_sigprint(); invalidate_cache(); // placed here, as mem_resize() is used during matrix modification if(n_nonzero == new_n_nonzero) { return; } eT* new_values = memory::acquire (new_n_nonzero + 1); uword* new_row_indices = memory::acquire(new_n_nonzero + 1); if( (n_nonzero > 0 ) && (new_n_nonzero > 0) ) { // Copy old elements. uword copy_len = (std::min)(n_nonzero, new_n_nonzero); arrayops::copy(new_values, values, copy_len); arrayops::copy(new_row_indices, row_indices, copy_len); } if(values) { memory::release(access::rw(values)); } if(row_indices) { memory::release(access::rw(row_indices)); } access::rw(values) = new_values; access::rw(row_indices) = new_row_indices; // Set the "fake end" of the matrix by setting the last value and row index to 0. // This helps the iterators work correctly. access::rw( values[new_n_nonzero]) = 0; access::rw(row_indices[new_n_nonzero]) = 0; access::rw(n_nonzero) = new_n_nonzero; } template inline void SpMat::sync() const { arma_debug_sigprint(); sync_csc(); } template inline void SpMat::remove_zeros() { arma_debug_sigprint(); sync_csc(); invalidate_cache(); // placed here, as remove_zeros() is used during matrix modification const uword old_n_nonzero = n_nonzero; uword new_n_nonzero = 0; const eT* old_values = values; constexpr eT zero = eT(0); for(uword i=0; i < old_n_nonzero; ++i) { new_n_nonzero += (old_values[i] != zero) ? uword(1) : uword(0); } if(new_n_nonzero != old_n_nonzero) { if(new_n_nonzero == 0) { init(n_rows, n_cols); return; } SpMat tmp(arma_reserve_indicator(), n_rows, n_cols, new_n_nonzero); uword new_index = 0; const_iterator it = cbegin(); const_iterator it_end = cend(); for(; it != it_end; ++it) { const eT val = eT(*it); if(val != zero) { const uword it_row = it.row(); const uword it_col = it.col(); access::rw(tmp.values[new_index]) = val; access::rw(tmp.row_indices[new_index]) = it_row; access::rw(tmp.col_ptrs[it_col + 1])++; ++new_index; } } for(uword i=0; i < n_cols; ++i) { access::rw(tmp.col_ptrs[i + 1]) += tmp.col_ptrs[i]; } steal_mem(tmp); } } // Steal memory from another matrix. template inline void SpMat::steal_mem(SpMat& x) { arma_debug_sigprint(); if(this == &x) { return; } bool layout_ok = false; if((*this).vec_state == x.vec_state) { layout_ok = true; } else { if( ((*this).vec_state == 1) && (x.n_cols == 1) ) { layout_ok = true; } if( ((*this).vec_state == 2) && (x.n_rows == 1) ) { layout_ok = true; } } if(layout_ok) { arma_debug_print("SpMat::steal_mem(): stealing memory"); x.sync_csc(); steal_mem_simple(x); x.invalidate_cache(); invalidate_cache(); } else { arma_debug_print("SpMat::steal_mem(): copying memory"); (*this).operator=(x); } } template inline void SpMat::steal_mem_simple(SpMat& x) { arma_debug_sigprint(); if(this == &x) { return; } if(values ) { memory::release(access::rw(values)); } if(row_indices) { memory::release(access::rw(row_indices)); } if(col_ptrs ) { memory::release(access::rw(col_ptrs)); } access::rw(n_rows) = x.n_rows; access::rw(n_cols) = x.n_cols; access::rw(n_elem) = x.n_elem; access::rw(n_nonzero) = x.n_nonzero; access::rw(values) = x.values; access::rw(row_indices) = x.row_indices; access::rw(col_ptrs) = x.col_ptrs; // Set other matrix to empty. access::rw(x.n_rows) = 0; access::rw(x.n_cols) = 0; access::rw(x.n_elem) = 0; access::rw(x.n_nonzero) = 0; access::rw(x.values) = nullptr; access::rw(x.row_indices) = nullptr; access::rw(x.col_ptrs) = nullptr; } template template inline void SpMat::init_xform(const SpBase& A, const Functor& func) { arma_debug_sigprint(); // if possible, avoid doing a copy and instead apply func to the generated elements if(SpProxy::Q_is_generated) { (*this) = A.get_ref(); const uword nnz = n_nonzero; eT* t_values = access::rwp(values); bool has_zero = false; for(uword i=0; i < nnz; ++i) { eT& t_values_i = t_values[i]; t_values_i = func(t_values_i); if(t_values_i == eT(0)) { has_zero = true; } } if(has_zero) { remove_zeros(); } } else { init_xform_mt(A.get_ref(), func); } } template template inline void SpMat::init_xform_mt(const SpBase& A, const Functor& func) { arma_debug_sigprint(); const SpProxy P(A.get_ref()); if( P.is_alias(*this) || (is_SpMat::stored_type>::value) ) { // NOTE: unwrap_spmat will convert a submatrix to a matrix, which in effect takes care of aliasing with submatrices; // NOTE: however, when more delayed ops are implemented, more elaborate handling of aliasing will be necessary const unwrap_spmat::stored_type> tmp(P.Q); const SpMat& x = tmp.M; if(void_ptr(this) != void_ptr(&x)) { init(x.n_rows, x.n_cols, x.n_nonzero); arrayops::copy(access::rwp(row_indices), x.row_indices, x.n_nonzero + 1); arrayops::copy(access::rwp(col_ptrs), x.col_ptrs, x.n_cols + 1); } // initialise the elements array with a transformed version of the elements from x const uword nnz = n_nonzero; const eT2* x_values = x.values; eT* t_values = access::rwp(values); bool has_zero = false; for(uword i=0; i < nnz; ++i) { eT& t_values_i = t_values[i]; t_values_i = func(x_values[i]); // NOTE: func() must produce a value of type eT (ie. act as a converter between eT2 and eT) if(t_values_i == eT(0)) { has_zero = true; } } if(has_zero) { remove_zeros(); } } else { init(P.get_n_rows(), P.get_n_cols(), P.get_n_nonzero()); typename SpProxy::const_iterator_type it = P.begin(); typename SpProxy::const_iterator_type it_end = P.end(); bool has_zero = false; while(it != it_end) { const eT val = func(*it); // NOTE: func() must produce a value of type eT (ie. act as a converter between eT2 and eT) if(val == eT(0)) { has_zero = true; } const uword it_pos = it.pos(); access::rw(row_indices[it_pos]) = it.row(); access::rw(values[it_pos]) = val; ++access::rw(col_ptrs[it.col() + 1]); ++it; } // Now sum column pointers. for(uword c = 1; c <= n_cols; ++c) { access::rw(col_ptrs[c]) += col_ptrs[c - 1]; } if(has_zero) { remove_zeros(); } } } template arma_inline bool SpMat::is_alias(const SpMat& X) const { return (&X == this); } template inline typename SpMat::iterator SpMat::begin() { arma_debug_sigprint(); sync_csc(); return iterator(*this); } template inline typename SpMat::const_iterator SpMat::begin() const { arma_debug_sigprint(); sync_csc(); return const_iterator(*this); } template inline typename SpMat::const_iterator SpMat::cbegin() const { arma_debug_sigprint(); sync_csc(); return const_iterator(*this); } template inline typename SpMat::iterator SpMat::end() { sync_csc(); return iterator(*this, 0, n_cols, n_nonzero); } template inline typename SpMat::const_iterator SpMat::end() const { sync_csc(); return const_iterator(*this, 0, n_cols, n_nonzero); } template inline typename SpMat::const_iterator SpMat::cend() const { sync_csc(); return const_iterator(*this, 0, n_cols, n_nonzero); } template inline typename SpMat::col_iterator SpMat::begin_col(const uword col_num) { sync_csc(); return col_iterator(*this, 0, col_num); } template inline typename SpMat::const_col_iterator SpMat::begin_col(const uword col_num) const { sync_csc(); return const_col_iterator(*this, 0, col_num); } template inline typename SpMat::col_iterator SpMat::begin_col_no_sync(const uword col_num) { return col_iterator(*this, 0, col_num); } template inline typename SpMat::const_col_iterator SpMat::begin_col_no_sync(const uword col_num) const { return const_col_iterator(*this, 0, col_num); } template inline typename SpMat::col_iterator SpMat::end_col(const uword col_num) { sync_csc(); return col_iterator(*this, 0, col_num + 1); } template inline typename SpMat::const_col_iterator SpMat::end_col(const uword col_num) const { sync_csc(); return const_col_iterator(*this, 0, col_num + 1); } template inline typename SpMat::col_iterator SpMat::end_col_no_sync(const uword col_num) { return col_iterator(*this, 0, col_num + 1); } template inline typename SpMat::const_col_iterator SpMat::end_col_no_sync(const uword col_num) const { return const_col_iterator(*this, 0, col_num + 1); } template inline typename SpMat::row_iterator SpMat::begin_row(const uword row_num) { sync_csc(); return row_iterator(*this, row_num, 0); } template inline typename SpMat::const_row_iterator SpMat::begin_row(const uword row_num) const { sync_csc(); return const_row_iterator(*this, row_num, 0); } template inline typename SpMat::row_iterator SpMat::end_row() { sync_csc(); return row_iterator(*this, n_nonzero); } template inline typename SpMat::const_row_iterator SpMat::end_row() const { sync_csc(); return const_row_iterator(*this, n_nonzero); } template inline typename SpMat::row_iterator SpMat::end_row(const uword row_num) { sync_csc(); return row_iterator(*this, row_num + 1, 0); } template inline typename SpMat::const_row_iterator SpMat::end_row(const uword row_num) const { sync_csc(); return const_row_iterator(*this, row_num + 1, 0); } template inline typename SpMat::row_col_iterator SpMat::begin_row_col() { sync_csc(); return begin(); } template inline typename SpMat::const_row_col_iterator SpMat::begin_row_col() const { sync_csc(); return begin(); } template inline typename SpMat::row_col_iterator SpMat::end_row_col() { sync_csc(); return end(); } template inline typename SpMat::const_row_col_iterator SpMat::end_row_col() const { sync_csc(); return end(); } template inline void SpMat::clear() { (*this).reset(); } template inline bool SpMat::empty() const { return (n_elem == 0); } template inline uword SpMat::size() const { return n_elem; } template arma_inline SpMat_MapMat_val SpMat::front() { arma_conform_check( (n_elem == 0), "SpMat::front(): matrix is empty" ); return SpMat_MapMat_val((*this), cache, 0, 0); } template arma_inline eT SpMat::front() const { arma_conform_check( (n_elem == 0), "SpMat::front(): matrix is empty" ); return get_value(0,0); } template arma_inline SpMat_MapMat_val SpMat::back() { arma_conform_check( (n_elem == 0), "SpMat::back(): matrix is empty" ); return SpMat_MapMat_val((*this), cache, n_rows-1, n_cols-1); } template arma_inline eT SpMat::back() const { arma_conform_check( (n_elem == 0), "SpMat::back(): matrix is empty" ); return get_value(n_rows-1, n_cols-1); } template inline eT SpMat::get_value(const uword i) const { const MapMat& const_cache = cache; // declare as const for clarity of intent // get the element from the cache if it has more recent data than CSC return (sync_state == 1) ? const_cache.operator[](i) : get_value_csc(i); } template inline eT SpMat::get_value(const uword in_row, const uword in_col) const { const MapMat& const_cache = cache; // declare as const for clarity of intent // get the element from the cache if it has more recent data than CSC return (sync_state == 1) ? const_cache.at(in_row, in_col) : get_value_csc(in_row, in_col); } template inline eT SpMat::get_value_csc(const uword i) const { // First convert to the actual location. uword lcol = i / n_rows; // Integer division. uword lrow = i % n_rows; return get_value_csc(lrow, lcol); } template inline const eT* SpMat::find_value_csc(const uword in_row, const uword in_col) const { const uword col_offset = col_ptrs[in_col ]; const uword next_col_offset = col_ptrs[in_col + 1]; const uword* start_ptr = &row_indices[ col_offset]; const uword* end_ptr = &row_indices[next_col_offset]; const uword* pos_ptr = std::lower_bound(start_ptr, end_ptr, in_row); // binary search if( (pos_ptr != end_ptr) && ((*pos_ptr) == in_row) ) { const uword offset = uword(pos_ptr - start_ptr); const uword index = offset + col_offset; return &(values[index]); } return nullptr; } template inline eT SpMat::get_value_csc(const uword in_row, const uword in_col) const { const eT* val_ptr = find_value_csc(in_row, in_col); return (val_ptr != nullptr) ? eT(*val_ptr) : eT(0); } template inline bool SpMat::try_set_value_csc(const uword in_row, const uword in_col, const eT in_val) { const eT* val_ptr = find_value_csc(in_row, in_col); // element not found, ie. it's zero; fail if trying to set it to non-zero value if(val_ptr == nullptr) { return (in_val == eT(0)); } // fail if trying to erase an existing element if(in_val == eT(0)) { return false; } access::rw(*val_ptr) = in_val; invalidate_cache(); return true; } template inline bool SpMat::try_add_value_csc(const uword in_row, const uword in_col, const eT in_val) { const eT* val_ptr = find_value_csc(in_row, in_col); // element not found, ie. it's zero; fail if trying to add a non-zero value if(val_ptr == nullptr) { return (in_val == eT(0)); } const eT new_val = eT(*val_ptr) + in_val; // fail if trying to erase an existing element if(new_val == eT(0)) { return false; } access::rw(*val_ptr) = new_val; invalidate_cache(); return true; } template inline bool SpMat::try_sub_value_csc(const uword in_row, const uword in_col, const eT in_val) { const eT* val_ptr = find_value_csc(in_row, in_col); // element not found, ie. it's zero; fail if trying to subtract a non-zero value if(val_ptr == nullptr) { return (in_val == eT(0)); } const eT new_val = eT(*val_ptr) - in_val; // fail if trying to erase an existing element if(new_val == eT(0)) { return false; } access::rw(*val_ptr) = new_val; invalidate_cache(); return true; } template inline bool SpMat::try_mul_value_csc(const uword in_row, const uword in_col, const eT in_val) { const eT* val_ptr = find_value_csc(in_row, in_col); // element not found, ie. it's zero; succeed if given value is finite; zero multiplied by anything is zero, except for nan and inf if(val_ptr == nullptr) { return arma_isfinite(in_val); } const eT new_val = eT(*val_ptr) * in_val; // fail if trying to erase an existing element if(new_val == eT(0)) { return false; } access::rw(*val_ptr) = new_val; invalidate_cache(); return true; } template inline bool SpMat::try_div_value_csc(const uword in_row, const uword in_col, const eT in_val) { const eT* val_ptr = find_value_csc(in_row, in_col); // element not found, ie. it's zero; succeed if given value is not zero and not nan; zero divided by anything is zero, except for zero and nan if(val_ptr == nullptr) { return ((in_val != eT(0)) && (arma_isnan(in_val) == false)); } const eT new_val = eT(*val_ptr) / in_val; // fail if trying to erase an existing element if(new_val == eT(0)) { return false; } access::rw(*val_ptr) = new_val; invalidate_cache(); return true; } /** * Insert an element at the given position, and return a reference to it. * The element will be set to 0, unless otherwise specified. * If the element already exists, its value will be overwritten. */ template inline eT& SpMat::insert_element(const uword in_row, const uword in_col, const eT val) { arma_debug_sigprint(); sync_csc(); invalidate_cache(); // We will assume the new element does not exist and begin the search for // where to insert it. If we find that it already exists, we will then // overwrite it. uword colptr = col_ptrs[in_col ]; uword next_colptr = col_ptrs[in_col + 1]; uword pos = colptr; // The position in the matrix of this value. if(colptr != next_colptr) { // There are other elements in this column, so we must find where this // element will fit as compared to those. while(pos < next_colptr && in_row > row_indices[pos]) { pos++; } // We aren't inserting into the last position, so it is still possible // that the element may exist. if(pos != next_colptr && row_indices[pos] == in_row) { // It already exists. Then, just overwrite it. access::rw(values[pos]) = val; return access::rw(values[pos]); } } // // Element doesn't exist, so we have to insert it // // We have to update the rest of the column pointers. for(uword i = in_col + 1; i < n_cols + 1; i++) { access::rw(col_ptrs[i])++; // We are only inserting one new element. } const uword old_n_nonzero = n_nonzero; access::rw(n_nonzero)++; // Add to count of nonzero elements. // Allocate larger memory. eT* new_values = memory::acquire (n_nonzero + 1); uword* new_row_indices = memory::acquire(n_nonzero + 1); // Copy things over, before the new element. if(pos > 0) { arrayops::copy(new_values, values, pos); arrayops::copy(new_row_indices, row_indices, pos); } // Insert the new element. new_values[pos] = val; new_row_indices[pos] = in_row; // Copy the rest of things over (including the extra element at the end). arrayops::copy(new_values + pos + 1, values + pos, (old_n_nonzero - pos) + 1); arrayops::copy(new_row_indices + pos + 1, row_indices + pos, (old_n_nonzero - pos) + 1); // Assign new pointers. if(values) { memory::release(access::rw(values)); } if(row_indices) { memory::release(access::rw(row_indices)); } access::rw(values) = new_values; access::rw(row_indices) = new_row_indices; return access::rw(values[pos]); } /** * Delete an element at the given position. */ template inline void SpMat::delete_element(const uword in_row, const uword in_col) { arma_debug_sigprint(); sync_csc(); invalidate_cache(); // We assume the element exists (although... it may not) and look for its // exact position. If it doesn't exist... well, we don't need to do anything. uword colptr = col_ptrs[in_col]; uword next_colptr = col_ptrs[in_col + 1]; if(colptr != next_colptr) { // There's at least one element in this column. // Let's see if we are one of them. for(uword pos = colptr; pos < next_colptr; pos++) { if(in_row == row_indices[pos]) { --access::rw(n_nonzero); // Remove one from the count of nonzero elements. // Found it. Now remove it. // Make new arrays. eT* new_values = memory::acquire (n_nonzero + 1); uword* new_row_indices = memory::acquire(n_nonzero + 1); if(pos > 0) { arrayops::copy(new_values, values, pos); arrayops::copy(new_row_indices, row_indices, pos); } arrayops::copy(new_values + pos, values + pos + 1, (n_nonzero - pos) + 1); arrayops::copy(new_row_indices + pos, row_indices + pos + 1, (n_nonzero - pos) + 1); if(values) { memory::release(access::rw(values)); } if(row_indices) { memory::release(access::rw(row_indices)); } access::rw(values) = new_values; access::rw(row_indices) = new_row_indices; // And lastly, update all the column pointers (decrement by one). for(uword i = in_col + 1; i < n_cols + 1; i++) { --access::rw(col_ptrs[i]); // We only removed one element. } return; // There is nothing left to do. } } } return; // The element does not exist, so there's nothing for us to do. } template arma_inline void SpMat::invalidate_cache() const { arma_debug_sigprint(); if(sync_state == 0) { return; } cache.reset(); sync_state = 0; } template arma_inline void SpMat::invalidate_csc() const { arma_debug_sigprint(); sync_state = 1; } template inline void SpMat::sync_cache() const { arma_debug_sigprint(); // using approach adapted from http://preshing.com/20130930/double-checked-locking-is-fixed-in-cpp11/ // // OpenMP mode: // sync_state uses atomic read/write, which has an implied flush; // flush is also implicitly executed at the entrance and the exit of critical section; // data races are prevented by the 'critical' directive // // C++11 mode: // underlying type for sync_state is std::atomic; // reading and writing to sync_state uses std::memory_order_seq_cst which has an implied fence; // data races are prevented via the mutex #if defined(ARMA_USE_OPENMP) { if(sync_state == 0) { #pragma omp critical (arma_SpMat_cache) { sync_cache_simple(); } } } #elif defined(ARMA_USE_STD_MUTEX) { if(sync_state == 0) { const std::lock_guard lock(cache_mutex); sync_cache_simple(); } } #else { sync_cache_simple(); } #endif } template inline void SpMat::sync_cache_simple() const { arma_debug_sigprint(); if(sync_state == 0) { cache = (*this); sync_state = 2; } } template inline void SpMat::sync_csc() const { arma_debug_sigprint(); #if defined(ARMA_USE_OPENMP) if(sync_state == 1) { #pragma omp critical (arma_SpMat_cache) { sync_csc_simple(); } } #elif defined(ARMA_USE_STD_MUTEX) if(sync_state == 1) { const std::lock_guard lock(cache_mutex); sync_csc_simple(); } #else { sync_csc_simple(); } #endif } template inline void SpMat::sync_csc_simple() const { arma_debug_sigprint(); // method: // 1. construct temporary matrix to prevent the cache from getting zapped // 2. steal memory from the temporary matrix // sync_state is only set to 1 by non-const element access operators, // so the shenanigans with const_cast are to satisfy the compiler // see also the note in sync_cache() above if(sync_state == 1) { SpMat& x = const_cast< SpMat& >(*this); SpMat tmp(cache); x.steal_mem_simple(tmp); sync_state = 2; } } // // SpMat_aux template inline void SpMat_aux::set_real(SpMat& out, const SpBase& X) { arma_debug_sigprint(); const unwrap_spmat tmp(X.get_ref()); const SpMat& A = tmp.M; arma_conform_assert_same_size( out, A, "SpMat::set_real()" ); out = A; } template inline void SpMat_aux::set_imag(SpMat&, const SpBase&) { arma_debug_sigprint(); } template inline void SpMat_aux::set_real(SpMat< std::complex >& out, const SpBase& X) { arma_debug_sigprint(); typedef typename std::complex eT; const unwrap_spmat U(X.get_ref()); const SpMat& Y = U.M; arma_conform_assert_same_size(out, Y, "SpMat::set_real()"); SpMat tmp(Y,arma::imag(out)); // arma:: prefix required due to bugs in GCC 4.4 - 4.6 out.steal_mem(tmp); } template inline void SpMat_aux::set_imag(SpMat< std::complex >& out, const SpBase& X) { arma_debug_sigprint(); typedef typename std::complex eT; const unwrap_spmat U(X.get_ref()); const SpMat& Y = U.M; arma_conform_assert_same_size(out, Y, "SpMat::set_imag()"); SpMat tmp(arma::real(out),Y); // arma:: prefix required due to bugs in GCC 4.4 - 4.6 out.steal_mem(tmp); } #if defined(ARMA_EXTRA_SPMAT_MEAT) #include ARMA_INCFILE_WRAP(ARMA_EXTRA_SPMAT_MEAT) #endif //! @} RcppArmadillo/inst/include/armadillo_bits/op_median_bones.hpp0000644000176200001440000000423214301267043024223 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_median //! @{ template struct arma_cx_median_packet { T val; uword index; }; template arma_inline bool operator< (const arma_cx_median_packet& A, const arma_cx_median_packet& B) { return (A.val < B.val); } class op_median : public traits_op_xvec { public: template inline static void apply(Mat& out, const Op& expr); template inline static void apply_noalias(Mat& out, const Mat& X, const uword dim, const typename arma_not_cx::result* junk = nullptr); template inline static void apply_noalias(Mat& out, const Mat& X, const uword dim, const typename arma_cx_only::result* junk = nullptr); // // template inline static typename T1::elem_type median_vec(const T1& X, const typename arma_not_cx::result* junk = nullptr); template inline static typename T1::elem_type median_vec(const T1& X, const typename arma_cx_only::result* junk = nullptr); // // template inline static eT direct_median(std::vector& X); template inline static void direct_cx_median_index(uword& out_index1, uword& out_index2, std::vector< arma_cx_median_packet >& X); }; //! @} RcppArmadillo/inst/include/armadillo_bits/Op_bones.hpp0000644000176200001440000000466714752446051022672 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup Op //! @{ template struct Op_traits {}; template struct Op_traits { static constexpr bool is_row = op_type::template traits::is_row; static constexpr bool is_col = op_type::template traits::is_col; static constexpr bool is_xvec = op_type::template traits::is_xvec; }; template struct Op_traits { static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = false; }; template class Op : public Base< typename T1::elem_type, Op > , public Op_traits::value> { public: typedef typename T1::elem_type elem_type; typedef typename get_pod_type::result pod_type; inline explicit Op(const T1& in_m); inline Op(const T1& in_m, const elem_type in_aux); inline Op(const T1& in_m, const elem_type in_aux, const uword in_aux_uword_a, const uword in_aux_uword_b); inline Op(const T1& in_m, const uword in_aux_uword_a, const uword in_aux_uword_b); inline ~Op(); template inline bool is_alias(const Mat& X) const; const T1& m; //!< the operand; must be derived from Base elem_type aux; //!< auxiliary data, using the element type as used by T1 uword aux_uword_a; //!< auxiliary data, uword format uword aux_uword_b; //!< auxiliary data, uword format }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_repmat_bones.hpp0000644000176200001440000000225014301267043024254 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_repmat //! @{ class op_repmat : public traits_op_default { public: template inline static void apply_noalias(Mat& out, const obj& X, const uword copies_per_row, const uword copies_per_col); template inline static void apply(Mat& out, const Op& in); }; //! @} RcppArmadillo/inst/include/armadillo_bits/SpCol_bones.hpp0000644000176200001440000000614714634016465023330 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup SpCol //! @{ //! Class for sparse column vectors (matrices with only one column) template class SpCol : public SpMat { public: typedef eT elem_type; typedef typename get_pod_type::result pod_type; static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; inline SpCol(); inline explicit SpCol(const uword n_elem); inline explicit SpCol(const uword in_rows, const uword in_cols); inline explicit SpCol(const SizeMat& s); inline SpCol(const char* text); inline SpCol& operator=(const char* text); inline SpCol(const std::string& text); inline SpCol& operator=(const std::string& text); inline SpCol& operator=(const eT val); inline SpCol(const Col& X); // for backwards compatibility template inline explicit SpCol(const Base& X); template inline SpCol& operator=(const Base& X); template inline SpCol(const SpBase& X); template inline SpCol& operator=(const SpBase& X); template inline explicit SpCol(const SpBase& A, const SpBase& B); arma_warn_unused inline const SpOp,spop_htrans> t() const; arma_warn_unused inline const SpOp,spop_htrans> ht() const; arma_warn_unused inline const SpOp,spop_strans> st() const; arma_warn_unused inline const SpToDOp,op_sp_as_dense> as_dense() const; inline void shed_row (const uword row_num); inline void shed_rows(const uword in_row1, const uword in_row2); // inline void insert_rows(const uword row_num, const uword N, const bool set_to_zero = true); typedef typename SpMat::iterator row_iterator; typedef typename SpMat::const_iterator const_row_iterator; inline row_iterator begin_row(const uword row_num = 0); inline const_row_iterator begin_row(const uword row_num = 0) const; inline row_iterator end_row (const uword row_num = 0); inline const_row_iterator end_row (const uword row_num = 0) const; #if defined(ARMA_EXTRA_SPCOL_PROTO) #include ARMA_INCFILE_WRAP(ARMA_EXTRA_SPCOL_PROTO) #endif }; RcppArmadillo/inst/include/armadillo_bits/op_misc_meat.hpp0000644000176200001440000002326715030507611023550 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_misc //! @{ template inline void op_real::apply( Mat& out, const mtOp& X ) { arma_debug_sigprint(); typedef typename T1::pod_type T; const Proxy P(X.m); const uword n_rows = P.get_n_rows(); const uword n_cols = P.get_n_cols(); out.set_size(n_rows, n_cols); T* out_mem = out.memptr(); if(Proxy::use_at == false) { typedef typename Proxy::ea_type ea_type; const uword n_elem = P.get_n_elem(); ea_type A = P.get_ea(); for(uword i=0; i < n_elem; ++i) { out_mem[i] = std::real( A[i] ); } } else { for(uword col=0; col < n_cols; ++col) for(uword row=0; row < n_rows; ++row) { *out_mem = std::real( P.at(row,col) ); out_mem++; } } } template inline void op_real::apply( Cube& out, const mtOpCube& X ) { arma_debug_sigprint(); typedef typename T1::pod_type T; const ProxyCube P(X.m); const uword n_rows = P.get_n_rows(); const uword n_cols = P.get_n_cols(); const uword n_slices = P.get_n_slices(); out.set_size(n_rows, n_cols, n_slices); T* out_mem = out.memptr(); if(ProxyCube::use_at == false) { typedef typename ProxyCube::ea_type ea_type; const uword n_elem = P.get_n_elem(); ea_type A = P.get_ea(); for(uword i=0; i < n_elem; ++i) { out_mem[i] = std::real( A[i] ); } } else { for(uword slice=0; slice < n_slices; ++slice) for(uword col=0; col < n_cols; ++col ) for(uword row=0; row < n_rows; ++row ) { *out_mem = std::real( P.at(row,col,slice) ); out_mem++; } } } template inline void op_imag::apply( Mat& out, const mtOp& X ) { arma_debug_sigprint(); typedef typename T1::elem_type eT; typedef typename T1::pod_type T; const Proxy P(X.m); if(is_cx::no) { out.zeros(P.get_n_rows(), P.get_n_cols()); return; } // aliasing not possible at this point, as eT must be std::complex const uword n_rows = P.get_n_rows(); const uword n_cols = P.get_n_cols(); out.set_size(n_rows, n_cols); T* out_mem = out.memptr(); if(Proxy::use_at == false) { typedef typename Proxy::ea_type ea_type; const uword n_elem = P.get_n_elem(); ea_type A = P.get_ea(); for(uword i=0; i < n_elem; ++i) { out_mem[i] = access::tmp_imag( A[i] ); } } else { for(uword col=0; col < n_cols; ++col) for(uword row=0; row < n_rows; ++row) { *out_mem = access::tmp_imag( P.at(row,col) ); out_mem++; } } } template inline void op_imag::apply( Cube& out, const mtOpCube& X ) { arma_debug_sigprint(); typedef typename T1::elem_type eT; typedef typename T1::pod_type T; const ProxyCube P(X.m); if(is_cx::no) { out.zeros(P.get_n_rows(), P.get_n_cols(), P.get_n_slices()); return; } // aliasing not possible at this point, as eT must be std::complex const uword n_rows = P.get_n_rows(); const uword n_cols = P.get_n_cols(); const uword n_slices = P.get_n_slices(); out.set_size(n_rows, n_cols, n_slices); T* out_mem = out.memptr(); if(ProxyCube::use_at == false) { typedef typename ProxyCube::ea_type ea_type; const uword n_elem = P.get_n_elem(); ea_type A = P.get_ea(); for(uword i=0; i < n_elem; ++i) { out_mem[i] = access::tmp_imag( A[i] ); } } else { for(uword slice=0; slice < n_slices; ++slice) for(uword col=0; col < n_cols; ++col ) for(uword row=0; row < n_rows; ++row ) { *out_mem = access::tmp_imag( P.at(row,col,slice) ); out_mem++; } } } template inline void op_abs::apply( Mat& out, const mtOp& X ) { arma_debug_sigprint(); typedef typename T1::pod_type T; const Proxy P(X.m); const uword n_rows = P.get_n_rows(); const uword n_cols = P.get_n_cols(); out.set_size(n_rows, n_cols); T* out_mem = out.memptr(); if(Proxy::use_at == false) { typedef typename Proxy::ea_type ea_type; const uword n_elem = P.get_n_elem(); ea_type A = P.get_ea(); #if defined(ARMA_USE_OPENMP) { const int n_threads = mp_thread_limit::get(); #pragma omp parallel for schedule(static) num_threads(n_threads) for(uword i=0; i < n_elem; ++i) { out_mem[i] = std::abs( A[i] ); } } #else { for(uword i=0; i < n_elem; ++i) { out_mem[i] = std::abs( A[i] ); } } #endif } else { for(uword col=0; col < n_cols; ++col) for(uword row=0; row < n_rows; ++row) { *out_mem = std::abs( P.at(row,col) ); out_mem++; } } } template inline void op_abs::apply( Cube& out, const mtOpCube& X ) { arma_debug_sigprint(); typedef typename T1::pod_type T; const ProxyCube P(X.m); const uword n_rows = P.get_n_rows(); const uword n_cols = P.get_n_cols(); const uword n_slices = P.get_n_slices(); out.set_size(n_rows, n_cols, n_slices); T* out_mem = out.memptr(); if(ProxyCube::use_at == false) { typedef typename ProxyCube::ea_type ea_type; const uword n_elem = P.get_n_elem(); ea_type A = P.get_ea(); #if defined(ARMA_USE_OPENMP) { const int n_threads = mp_thread_limit::get(); #pragma omp parallel for schedule(static) num_threads(n_threads) for(uword i=0; i < n_elem; ++i) { out_mem[i] = std::abs( A[i] ); } } #else { for(uword i=0; i < n_elem; ++i) { out_mem[i] = std::abs( A[i] ); } } #endif } else { for(uword slice=0; slice < n_slices; ++slice) for(uword col=0; col < n_cols; ++col ) for(uword row=0; row < n_rows; ++row ) { *out_mem = std::abs( P.at(row,col,slice) ); out_mem++; } } } template inline void op_arg::apply( Mat& out, const mtOp& X ) { arma_debug_sigprint(); typedef typename T1::elem_type eT; typedef typename T1::pod_type T; const Proxy P(X.m); const uword n_rows = P.get_n_rows(); const uword n_cols = P.get_n_cols(); out.set_size(n_rows, n_cols); T* out_mem = out.memptr(); if(Proxy::use_at == false) { typedef typename Proxy::ea_type ea_type; const uword n_elem = P.get_n_elem(); ea_type A = P.get_ea(); for(uword i=0; i < n_elem; ++i) { out_mem[i] = arma_arg::eval( A[i] ); } } else { for(uword col=0; col < n_cols; ++col) for(uword row=0; row < n_rows; ++row) { *out_mem = arma_arg::eval( P.at(row,col) ); out_mem++; } } } template inline void op_arg::apply( Cube& out, const mtOpCube& X ) { arma_debug_sigprint(); typedef typename T1::elem_type eT; typedef typename T1::pod_type T; const ProxyCube P(X.m); const uword n_rows = P.get_n_rows(); const uword n_cols = P.get_n_cols(); const uword n_slices = P.get_n_slices(); out.set_size(n_rows, n_cols, n_slices); T* out_mem = out.memptr(); if(ProxyCube::use_at == false) { typedef typename ProxyCube::ea_type ea_type; const uword n_elem = P.get_n_elem(); ea_type A = P.get_ea(); for(uword i=0; i < n_elem; ++i) { out_mem[i] = arma_arg::eval( A[i] ); } } else { for(uword slice=0; slice < n_slices; ++slice) for(uword col=0; col < n_cols; ++col ) for(uword row=0; row < n_rows; ++row ) { *out_mem = arma_arg::eval( P.at(row,col,slice) ); out_mem++; } } } template inline void op_replace::apply(Mat& out, const mtOp& in) { arma_debug_sigprint(); const eT old_val = in.aux; const eT new_val = in.aux_out_eT; out = in.m; out.replace(old_val, new_val); } template inline void op_replace::apply(Cube& out, const mtOpCube& in) { arma_debug_sigprint(); const eT old_val = in.aux; const eT new_val = in.aux_out_eT; out = in.m; out.replace(old_val, new_val); } //! @} RcppArmadillo/inst/include/armadillo_bits/Cube_bones.hpp0000644000176200001440000007034314723743416023167 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup Cube //! @{ struct Cube_prealloc { static constexpr uword mat_ptrs_size = 4; static constexpr uword mem_n_elem = 64; }; //! Dense cube class template class Cube : public BaseCube< eT, Cube > { public: typedef eT elem_type; //!< the type of elements stored in the cube typedef typename get_pod_type::result pod_type; //!< if eT is std::complex, pod_type is T; otherwise pod_type is eT const uword n_rows; //!< number of rows in each slice (read-only) const uword n_cols; //!< number of columns in each slice (read-only) const uword n_elem_slice; //!< number of elements in each slice (read-only) const uword n_slices; //!< number of slices in the cube (read-only) const uword n_elem; //!< number of elements in the cube (read-only) const uword n_alloc; //!< number of allocated elements (read-only); NOTE: n_alloc can be 0, even if n_elem > 0 const uword mem_state; // mem_state = 0: normal cube which manages its own memory // mem_state = 1: use auxiliary memory until a size change // mem_state = 2: use auxiliary memory and don't allow the number of elements to be changed // mem_state = 3: fixed size (eg. via template based size specification) arma_aligned const eT* const mem; //!< pointer to the memory used for storing elements (memory is read-only) protected: using mat_type = Mat; #if defined(ARMA_USE_OPENMP) using raw_mat_ptr_type = mat_type*; using atomic_mat_ptr_type = mat_type*; #elif defined(ARMA_USE_STD_MUTEX) using raw_mat_ptr_type = mat_type*; using atomic_mat_ptr_type = std::atomic; #else using raw_mat_ptr_type = mat_type*; using atomic_mat_ptr_type = mat_type*; #endif atomic_mat_ptr_type* mat_ptrs = nullptr; #if defined(ARMA_USE_STD_MUTEX) mutable std::mutex mat_mutex; // required for slice() #endif arma_aligned atomic_mat_ptr_type mat_ptrs_local[ Cube_prealloc::mat_ptrs_size ]; arma_align_mem eT mem_local[ Cube_prealloc::mem_n_elem ]; // local storage, for small cubes public: inline ~Cube(); inline Cube(); inline explicit Cube(const uword in_n_rows, const uword in_n_cols, const uword in_n_slices); inline explicit Cube(const SizeCube& s); template inline explicit Cube(const uword in_n_rows, const uword in_n_cols, const uword in_n_slices, const arma_initmode_indicator&); template inline explicit Cube(const SizeCube& s, const arma_initmode_indicator&); template inline Cube(const uword in_n_rows, const uword in_n_cols, const uword in_n_slices, const fill::fill_class& f); template inline Cube(const SizeCube& s, const fill::fill_class& f); inline Cube(const uword in_rows, const uword in_cols, const uword in_slices, const fill::scalar_holder f); inline Cube(const SizeCube& s, const fill::scalar_holder f); inline Cube(Cube&& m); inline Cube& operator=(Cube&& m); inline Cube( eT* aux_mem, const uword aux_n_rows, const uword aux_n_cols, const uword aux_n_slices, const bool copy_aux_mem = true, const bool strict = false, const bool prealloc_mat = false); inline Cube(const eT* aux_mem, const uword aux_n_rows, const uword aux_n_cols, const uword aux_n_slices); inline Cube& operator= (const eT val); inline Cube& operator+=(const eT val); inline Cube& operator-=(const eT val); inline Cube& operator*=(const eT val); inline Cube& operator/=(const eT val); inline Cube(const Cube& m); inline Cube& operator= (const Cube& m); inline Cube& operator+=(const Cube& m); inline Cube& operator-=(const Cube& m); inline Cube& operator%=(const Cube& m); inline Cube& operator/=(const Cube& m); template inline explicit Cube(const BaseCube& A, const BaseCube& B); inline Cube(const subview_cube& X); inline Cube& operator= (const subview_cube& X); inline Cube& operator+=(const subview_cube& X); inline Cube& operator-=(const subview_cube& X); inline Cube& operator%=(const subview_cube& X); inline Cube& operator/=(const subview_cube& X); template inline Cube(const subview_cube_slices& X); template inline Cube& operator= (const subview_cube_slices& X); template inline Cube& operator+=(const subview_cube_slices& X); template inline Cube& operator-=(const subview_cube_slices& X); template inline Cube& operator%=(const subview_cube_slices& X); template inline Cube& operator/=(const subview_cube_slices& X); arma_inline subview_cube row(const uword in_row); arma_inline const subview_cube row(const uword in_row) const; arma_inline subview_cube col(const uword in_col); arma_inline const subview_cube col(const uword in_col) const; inline Mat& slice(const uword in_slice); inline const Mat& slice(const uword in_slice) const; arma_inline subview_cube rows(const uword in_row1, const uword in_row2); arma_inline const subview_cube rows(const uword in_row1, const uword in_row2) const; arma_inline subview_cube cols(const uword in_col1, const uword in_col2); arma_inline const subview_cube cols(const uword in_col1, const uword in_col2) const; arma_inline subview_cube slices(const uword in_slice1, const uword in_slice2); arma_inline const subview_cube slices(const uword in_slice1, const uword in_slice2) const; arma_inline subview_cube subcube(const uword in_row1, const uword in_col1, const uword in_slice1, const uword in_row2, const uword in_col2, const uword in_slice2); arma_inline const subview_cube subcube(const uword in_row1, const uword in_col1, const uword in_slice1, const uword in_row2, const uword in_col2, const uword in_slice2) const; inline subview_cube subcube(const uword in_row1, const uword in_col1, const uword in_slice1, const SizeCube& s); inline const subview_cube subcube(const uword in_row1, const uword in_col1, const uword in_slice1, const SizeCube& s) const; inline subview_cube subcube(const span& row_span, const span& col_span, const span& slice_span); inline const subview_cube subcube(const span& row_span, const span& col_span, const span& slice_span) const; inline subview_cube operator()(const span& row_span, const span& col_span, const span& slice_span); inline const subview_cube operator()(const span& row_span, const span& col_span, const span& slice_span) const; inline subview_cube operator()(const uword in_row1, const uword in_col1, const uword in_slice1, const SizeCube& s); inline const subview_cube operator()(const uword in_row1, const uword in_col1, const uword in_slice1, const SizeCube& s) const; arma_inline subview_cube tube(const uword in_row1, const uword in_col1); arma_inline const subview_cube tube(const uword in_row1, const uword in_col1) const; arma_inline subview_cube tube(const uword in_row1, const uword in_col1, const uword in_row2, const uword in_col2); arma_inline const subview_cube tube(const uword in_row1, const uword in_col1, const uword in_row2, const uword in_col2) const; arma_inline subview_cube tube(const uword in_row1, const uword in_col1, const SizeMat& s); arma_inline const subview_cube tube(const uword in_row1, const uword in_col1, const SizeMat& s) const; inline subview_cube tube(const span& row_span, const span& col_span); inline const subview_cube tube(const span& row_span, const span& col_span) const; inline subview_cube head_slices(const uword N); inline const subview_cube head_slices(const uword N) const; inline subview_cube tail_slices(const uword N); inline const subview_cube tail_slices(const uword N) const; template arma_inline subview_elem1 elem(const Base& a); template arma_inline const subview_elem1 elem(const Base& a) const; template arma_inline subview_elem1 operator()(const Base& a); template arma_inline const subview_elem1 operator()(const Base& a) const; arma_inline subview_cube_each1 each_slice(); arma_inline const subview_cube_each1 each_slice() const; template inline subview_cube_each2 each_slice(const Base& indices); template inline const subview_cube_each2 each_slice(const Base& indices) const; inline Cube& each_slice(const std::function< void( Mat&) >& F); inline const Cube& each_slice(const std::function< void(const Mat&) >& F) const; inline Cube& each_slice(const std::function< void( Mat&) >& F, const bool use_mp); inline const Cube& each_slice(const std::function< void(const Mat&) >& F, const bool use_mp) const; template arma_inline subview_cube_slices slices(const Base& indices); template arma_inline const subview_cube_slices slices(const Base& indices) const; inline void shed_row(const uword row_num); inline void shed_col(const uword col_num); inline void shed_slice(const uword slice_num); inline void shed_rows(const uword in_row1, const uword in_row2); inline void shed_cols(const uword in_col1, const uword in_col2); inline void shed_slices(const uword in_slice1, const uword in_slice2); template inline void shed_slices(const Base& indices); arma_deprecated inline void insert_rows(const uword row_num, const uword N, const bool set_to_zero); arma_deprecated inline void insert_cols(const uword row_num, const uword N, const bool set_to_zero); arma_deprecated inline void insert_slices(const uword slice_num, const uword N, const bool set_to_zero); inline void insert_rows(const uword row_num, const uword N); inline void insert_cols(const uword row_num, const uword N); inline void insert_slices(const uword slice_num, const uword N); template inline void insert_rows(const uword row_num, const BaseCube& X); template inline void insert_cols(const uword col_num, const BaseCube& X); template inline void insert_slices(const uword slice_num, const BaseCube& X); template inline void insert_slices(const uword slice_num, const Base& X); template inline Cube(const GenCube& X); template inline Cube& operator= (const GenCube& X); template inline Cube& operator+=(const GenCube& X); template inline Cube& operator-=(const GenCube& X); template inline Cube& operator%=(const GenCube& X); template inline Cube& operator/=(const GenCube& X); template inline Cube(const OpCube& X); template inline Cube& operator= (const OpCube& X); template inline Cube& operator+=(const OpCube& X); template inline Cube& operator-=(const OpCube& X); template inline Cube& operator%=(const OpCube& X); template inline Cube& operator/=(const OpCube& X); template inline Cube(const eOpCube& X); template inline Cube& operator= (const eOpCube& X); template inline Cube& operator+=(const eOpCube& X); template inline Cube& operator-=(const eOpCube& X); template inline Cube& operator%=(const eOpCube& X); template inline Cube& operator/=(const eOpCube& X); template inline Cube(const mtOpCube& X); template inline Cube& operator= (const mtOpCube& X); template inline Cube& operator+=(const mtOpCube& X); template inline Cube& operator-=(const mtOpCube& X); template inline Cube& operator%=(const mtOpCube& X); template inline Cube& operator/=(const mtOpCube& X); template inline Cube(const GlueCube& X); template inline Cube& operator= (const GlueCube& X); template inline Cube& operator+=(const GlueCube& X); template inline Cube& operator-=(const GlueCube& X); template inline Cube& operator%=(const GlueCube& X); template inline Cube& operator/=(const GlueCube& X); template inline Cube(const eGlueCube& X); template inline Cube& operator= (const eGlueCube& X); template inline Cube& operator+=(const eGlueCube& X); template inline Cube& operator-=(const eGlueCube& X); template inline Cube& operator%=(const eGlueCube& X); template inline Cube& operator/=(const eGlueCube& X); template inline Cube(const mtGlueCube& X); template inline Cube& operator= (const mtGlueCube& X); template inline Cube& operator+=(const mtGlueCube& X); template inline Cube& operator-=(const mtGlueCube& X); template inline Cube& operator%=(const mtGlueCube& X); template inline Cube& operator/=(const mtGlueCube& X); arma_warn_unused arma_inline const eT& at_alt (const uword i) const; arma_warn_unused arma_inline eT& operator[] (const uword i); arma_warn_unused arma_inline const eT& operator[] (const uword i) const; arma_warn_unused arma_inline eT& at(const uword i); arma_warn_unused arma_inline const eT& at(const uword i) const; arma_warn_unused arma_inline eT& operator() (const uword i); arma_warn_unused arma_inline const eT& operator() (const uword i) const; #if defined(__cpp_multidimensional_subscript) arma_warn_unused arma_inline eT& operator[] (const uword in_row, const uword in_col, const uword in_slice); arma_warn_unused arma_inline const eT& operator[] (const uword in_row, const uword in_col, const uword in_slice) const; #endif arma_warn_unused arma_inline eT& at (const uword in_row, const uword in_col, const uword in_slice); arma_warn_unused arma_inline const eT& at (const uword in_row, const uword in_col, const uword in_slice) const; arma_warn_unused arma_inline eT& operator() (const uword in_row, const uword in_col, const uword in_slice); arma_warn_unused arma_inline const eT& operator() (const uword in_row, const uword in_col, const uword in_slice) const; arma_inline const Cube& operator++(); arma_inline void operator++(int); arma_inline const Cube& operator--(); arma_inline void operator--(int); arma_warn_unused arma_inline bool is_empty() const; arma_warn_unused inline bool internal_is_finite() const; arma_warn_unused inline bool internal_has_inf() const; arma_warn_unused inline bool internal_has_nan() const; arma_warn_unused inline bool internal_has_nonfinite() const; arma_warn_unused arma_inline bool in_range(const uword i) const; arma_warn_unused arma_inline bool in_range(const span& x) const; arma_warn_unused arma_inline bool in_range(const uword in_row, const uword in_col, const uword in_slice) const; arma_warn_unused inline bool in_range(const span& row_span, const span& col_span, const span& slice_span) const; arma_warn_unused inline bool in_range(const uword in_row, const uword in_col, const uword in_slice, const SizeCube& s) const; arma_warn_unused arma_inline eT* memptr(); arma_warn_unused arma_inline const eT* memptr() const; arma_warn_unused arma_inline eT* slice_memptr(const uword slice); arma_warn_unused arma_inline const eT* slice_memptr(const uword slice) const; arma_warn_unused arma_inline eT* slice_colptr(const uword in_slice, const uword in_col); arma_warn_unused arma_inline const eT* slice_colptr(const uword in_slice, const uword in_col) const; inline Cube& set_size(const uword new_n_rows, const uword new_n_cols, const uword new_n_slices); inline Cube& set_size(const SizeCube& s); inline Cube& reshape(const uword new_n_rows, const uword new_n_cols, const uword new_n_slices); inline Cube& reshape(const SizeCube& s); inline Cube& resize(const uword new_n_rows, const uword new_n_cols, const uword new_n_slices); inline Cube& resize(const SizeCube& s); template inline Cube& copy_size(const Cube& m); template inline Cube& for_each(functor F); template inline const Cube& for_each(functor F) const; template inline Cube& transform(functor F); template inline Cube& imbue(functor F); inline Cube& replace(const eT old_val, const eT new_val); inline Cube& clean(const pod_type threshold); inline Cube& clamp(const eT min_val, const eT max_val); inline Cube& fill(const eT val); inline Cube& zeros(); inline Cube& zeros(const uword new_n_rows, const uword new_n_cols, const uword new_n_slices); inline Cube& zeros(const SizeCube& s); inline Cube& ones(); inline Cube& ones(const uword new_n_rows, const uword new_n_cols, const uword new_n_slices); inline Cube& ones(const SizeCube& s); inline Cube& randu(); inline Cube& randu(const uword new_n_rows, const uword new_n_cols, const uword new_n_slices); inline Cube& randu(const SizeCube& s); inline Cube& randn(); inline Cube& randn(const uword new_n_rows, const uword new_n_cols, const uword new_n_slices); inline Cube& randn(const SizeCube& s); inline void reset(); inline void soft_reset(); template inline void set_real(const BaseCube& X); template inline void set_imag(const BaseCube& X); arma_warn_unused inline eT min() const; arma_warn_unused inline eT max() const; arma_frown("use .index_min() instead") inline eT min(uword& index_of_min_val) const; arma_frown("use .index_max() instead") inline eT max(uword& index_of_max_val) const; arma_frown("use .index_min() with ind2sub() instead") inline eT min(uword& row_of_min_val, uword& col_of_min_val, uword& slice_of_min_val) const; arma_frown("use .index_max() with ind2sub() instead") inline eT max(uword& row_of_max_val, uword& col_of_max_val, uword& slice_of_max_val) const; arma_cold inline bool save(const std::string name, const file_type type = arma_binary) const; arma_cold inline bool save(const hdf5_name& spec, const file_type type = hdf5_binary) const; arma_cold inline bool save( std::ostream& os, const file_type type = arma_binary) const; arma_cold inline bool load(const std::string name, const file_type type = auto_detect); arma_cold inline bool load(const hdf5_name& spec, const file_type type = hdf5_binary); arma_cold inline bool load( std::istream& is, const file_type type = auto_detect); arma_deprecated inline bool quiet_save(const std::string name, const file_type type = arma_binary) const; arma_deprecated inline bool quiet_save(const hdf5_name& spec, const file_type type = hdf5_binary) const; arma_deprecated inline bool quiet_save( std::ostream& os, const file_type type = arma_binary) const; arma_deprecated inline bool quiet_load(const std::string name, const file_type type = auto_detect); arma_deprecated inline bool quiet_load(const hdf5_name& spec, const file_type type = hdf5_binary); arma_deprecated inline bool quiet_load( std::istream& is, const file_type type = auto_detect); // iterators typedef eT* iterator; typedef const eT* const_iterator; typedef eT* slice_iterator; typedef const eT* const_slice_iterator; inline iterator begin(); inline const_iterator begin() const; inline const_iterator cbegin() const; inline iterator end(); inline const_iterator end() const; inline const_iterator cend() const; inline slice_iterator begin_slice(const uword slice_num); inline const_slice_iterator begin_slice(const uword slice_num) const; inline slice_iterator end_slice(const uword slice_num); inline const_slice_iterator end_slice(const uword slice_num) const; inline void clear(); inline bool empty() const; inline uword size() const; arma_warn_unused inline eT& front(); arma_warn_unused inline const eT& front() const; arma_warn_unused inline eT& back(); arma_warn_unused inline const eT& back() const; inline void swap(Cube& B); inline void steal_mem(Cube& X); //!< don't use this unless you're writing code internal to Armadillo inline void steal_mem(Cube& X, const bool is_move); //!< don't use this unless you're writing code internal to Armadillo template class fixed; protected: inline void init_cold(); inline void init_warm(const uword in_n_rows, const uword in_n_cols, const uword in_n_slices); template inline void init(const BaseCube& A, const BaseCube& B); inline void delete_mat(); inline void create_mat(); inline Mat* create_mat_ptr(const uword in_slice) const; inline Mat* get_mat_ptr(const uword in_slice) const; friend class glue_join; friend class op_reshape; friend class op_resize; friend class subview_cube; public: #if defined(ARMA_EXTRA_CUBE_PROTO) #include ARMA_INCFILE_WRAP(ARMA_EXTRA_CUBE_PROTO) #endif }; template template class Cube::fixed : public Cube { private: using Cube::mat_ptrs_local; using Cube::mem_local; static constexpr uword fixed_n_elem = fixed_n_rows * fixed_n_cols * fixed_n_slices; static constexpr uword fixed_n_elem_slice = fixed_n_rows * fixed_n_cols; static constexpr bool use_extra = (fixed_n_elem > Cube_prealloc::mem_n_elem); arma_aligned atomic_mat_ptr_type mat_ptrs_local_extra[ (fixed_n_slices > Cube_prealloc::mat_ptrs_size) ? fixed_n_slices : 1 ]; arma_align_mem eT mem_local_extra[ use_extra ? fixed_n_elem : 1 ]; arma_inline void mem_setup(); public: inline fixed(); inline fixed(const fixed& X); inline fixed(const fill::scalar_holder f); template inline fixed(const fill::fill_class& f); template inline fixed(const BaseCube& A); template inline fixed(const BaseCube& A, const BaseCube& B); using Cube::operator=; using Cube::operator(); inline Cube& operator=(const fixed& X); arma_warn_unused arma_inline eT& operator[] (const uword i); arma_warn_unused arma_inline const eT& operator[] (const uword i) const; arma_warn_unused arma_inline eT& at (const uword i); arma_warn_unused arma_inline const eT& at (const uword i) const; arma_warn_unused arma_inline eT& operator() (const uword i); arma_warn_unused arma_inline const eT& operator() (const uword i) const; #if defined(__cpp_multidimensional_subscript) arma_warn_unused arma_inline eT& operator[] (const uword in_row, const uword in_col, const uword in_slice); arma_warn_unused arma_inline const eT& operator[] (const uword in_row, const uword in_col, const uword in_slice) const; #endif arma_warn_unused arma_inline eT& at (const uword in_row, const uword in_col, const uword in_slice); arma_warn_unused arma_inline const eT& at (const uword in_row, const uword in_col, const uword in_slice) const; arma_warn_unused arma_inline eT& operator() (const uword in_row, const uword in_col, const uword in_slice); arma_warn_unused arma_inline const eT& operator() (const uword in_row, const uword in_col, const uword in_slice) const; }; class Cube_aux { public: template arma_inline static void prefix_pp(Cube& x); template arma_inline static void prefix_pp(Cube< std::complex >& x); template arma_inline static void postfix_pp(Cube& x); template arma_inline static void postfix_pp(Cube< std::complex >& x); template arma_inline static void prefix_mm(Cube& x); template arma_inline static void prefix_mm(Cube< std::complex >& x); template arma_inline static void postfix_mm(Cube& x); template arma_inline static void postfix_mm(Cube< std::complex >& x); template inline static void set_real(Cube& out, const BaseCube& X); template inline static void set_imag(Cube& out, const BaseCube& X); template inline static void set_real(Cube< std::complex >& out, const BaseCube< T,T1>& X); template inline static void set_imag(Cube< std::complex >& out, const BaseCube< T,T1>& X); }; //! @} RcppArmadillo/inst/include/armadillo_bits/auxlib_bones.hpp0000644000176200001440000005206715030507611023563 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup auxlib //! @{ //! low-level interface functions for accessing LAPACK class auxlib { public: // // inv template inline static bool inv(Mat& A); template inline static bool inv(Mat& out, const Mat& X); template inline static bool inv_rcond(Mat& A, typename get_pod_type::result& out_rcond); template inline static bool inv_tr(Mat& A, const uword layout); template inline static bool inv_tr_rcond(Mat& A, typename get_pod_type::result& out_rcond, const uword layout); template inline static bool inv_sym(Mat& A); template inline static bool inv_sym(Mat< std::complex >& A); template inline static bool inv_sym_rcond(Mat& A, eT& out_rcond); template inline static bool inv_sym_rcond(Mat< std::complex >& A, T& out_rcond); template inline static bool inv_sympd(Mat& A, bool& out_sympd_state); template inline static bool inv_sympd(Mat& out, const Mat& X); template inline static bool inv_sympd_rcond(Mat& A, eT& out_rcond); template inline static bool inv_sympd_rcond(Mat< std::complex >& A, T& out_rcond); // // det and log_det template inline static bool det(eT& out_val, Mat& A); template inline static bool log_det(eT& out_val, typename get_pod_type::result& out_sign, Mat& A); template inline static bool log_det_sympd(typename get_pod_type::result& out_val, Mat& A); // // lu template inline static bool lu(Mat& L, Mat& U, podarray& ipiv, const Base& X); template inline static bool lu(Mat& L, Mat& U, Mat& P, const Base& X); template inline static bool lu(Mat& L, Mat& U, const Base& X); // // eig_gen template inline static bool eig_gen(Mat< std::complex >& vals, Mat< std::complex >& vecs, const bool vecs_on, const Base& expr); template inline static bool eig_gen(Mat< std::complex >& vals, Mat< std::complex >& vecs, const bool vecs_on, const Base< std::complex, T1 >& expr); // // eig_gen_balance template inline static bool eig_gen_balance(Mat< std::complex >& vals, Mat< std::complex >& vecs, const bool vecs_on, const Base& expr); template inline static bool eig_gen_balance(Mat< std::complex >& vals, Mat< std::complex >& vecs, const bool vecs_on, const Base< std::complex, T1 >& expr); // // eig_gen_twosided template inline static bool eig_gen_twosided(Mat< std::complex >& vals, Mat< std::complex >& lvecs, Mat< std::complex >& rvecs, const Base& expr); template inline static bool eig_gen_twosided(Mat< std::complex >& vals, Mat< std::complex >& lvecs, Mat< std::complex >& rvecs, const Base< std::complex, T1 >& expr); // // eig_gen_twosided_balance template inline static bool eig_gen_twosided_balance(Mat< std::complex >& vals, Mat< std::complex >& lvecs, Mat< std::complex >& rvecs, const Base& expr); template inline static bool eig_gen_twosided_balance(Mat< std::complex >& vals, Mat< std::complex >& lvecs, Mat< std::complex >& rvecs, const Base< std::complex, T1 >& expr); // // eig_pair template inline static bool eig_pair(Mat< std::complex >& vals, Mat< std::complex >& vecs, const bool vecs_on, const Base& A_expr, const Base& B_expr); template inline static bool eig_pair(Mat< std::complex >& vals, Mat< std::complex >& vecs, const bool vecs_on, const Base< std::complex, T1 >& A_expr, const Base< std::complex, T2 >& B_expr); // // eig_pair_twosided template inline static bool eig_pair_twosided(Mat< std::complex >& vals, Mat< std::complex >& lvecs, Mat< std::complex >& rvecs, const Base& A_expr, const Base& B_expr); template inline static bool eig_pair_twosided(Mat< std::complex >& vals, Mat< std::complex >& lvecs, Mat< std::complex >& rvecs, const Base< std::complex, T1 >& A_expr, const Base< std::complex, T2 >& B_expr); // // eig_sym template inline static bool eig_sym(Col& eigval, Mat& A); template inline static bool eig_sym(Col& eigval, Mat< std::complex >& A); template inline static bool eig_sym(Col& eigval, Mat& eigvec, const Mat& X); template inline static bool eig_sym(Col& eigval, Mat< std::complex >& eigvec, const Mat< std::complex >& X); template inline static bool eig_sym_dc(Col& eigval, Mat& eigvec, const Mat& X); template inline static bool eig_sym_dc(Col& eigval, Mat< std::complex >& eigvec, const Mat< std::complex >& X); // // chol template inline static bool chol_simple(Mat& X); template inline static bool chol(Mat& X, const uword layout); template inline static bool chol_band(Mat& X, const uword KD, const uword layout); template inline static bool chol_band(Mat< std::complex >& X, const uword KD, const uword layout); template inline static bool chol_band_common(Mat& X, const uword KD, const uword layout); template inline static bool chol_pivot(Mat& X, Mat& P, const uword layout); // // hessenberg decomposition template inline static bool hess(Mat& H, const Base& X, Col& tao); // // qr template inline static bool qr(Mat& Q, Mat& R, const Base& X); template inline static bool qr_econ(Mat& Q, Mat& R, const Base& X); template inline static bool qr_pivot(Mat& Q, Mat& R, Mat& P, const Base& X); template inline static bool qr_pivot(Mat< std::complex >& Q, Mat< std::complex >& R, Mat& P, const Base,T1>& X); // // svd template inline static bool svd(Col& S, Mat& A); template inline static bool svd(Col& S, Mat< std::complex >& A); template inline static bool svd(Mat& U, Col& S, Mat& V, Mat& A); template inline static bool svd(Mat< std::complex >& U, Col& S, Mat< std::complex >& V, Mat< std::complex >& A); template inline static bool svd_econ(Mat& U, Col& S, Mat& V, Mat& A, const char mode); template inline static bool svd_econ(Mat< std::complex >& U, Col& S, Mat< std::complex >& V, Mat< std::complex >& A, const char mode); template inline static bool svd_dc(Col& S, Mat& A); template inline static bool svd_dc(Col& S, Mat< std::complex >& A); template inline static bool svd_dc(Mat& U, Col& S, Mat& V, Mat& A); template inline static bool svd_dc(Mat< std::complex >& U, Col& S, Mat< std::complex >& V, Mat< std::complex >& A); template inline static bool svd_dc_econ(Mat& U, Col& S, Mat& V, Mat& A); template inline static bool svd_dc_econ(Mat< std::complex >& U, Col& S, Mat< std::complex >& V, Mat< std::complex >& A); // // solve template inline static bool solve_square_fast(Mat& out, Mat& A, const Base& B_expr); template inline static bool solve_square_rcond(Mat& out, typename T1::pod_type& out_rcond, Mat& A, const Base& B_expr); template inline static bool solve_square_refine(Mat& out, typename T1::pod_type& out_rcond, Mat& A, const Base& B_expr, const bool equilibrate); template inline static bool solve_square_refine(Mat< std::complex >& out, typename T1::pod_type& out_rcond, Mat< std::complex >& A, const Base,T1>& B_expr, const bool equilibrate); // template inline static bool solve_sym_fast(Mat& out, Mat& A, const Base& B_expr); template inline static bool solve_sym_fast(Mat< std::complex >& out, Mat< std::complex >& A, const Base< std::complex, T1 >& B_expr); template inline static bool solve_sym_rcond(Mat& out, typename T1::pod_type& out_rcond, Mat& A, const Base& B_expr); template inline static bool solve_sym_rcond(Mat< std::complex >& out, typename T1::pod_type& out_rcond, Mat< std::complex >& A, const Base< std::complex,T1>& B_expr); // template inline static bool solve_sympd_fast(Mat& out, Mat& A, const Base& B_expr); template inline static bool solve_sympd_fast_common(Mat& out, Mat& A, const Base& B_expr); template inline static bool solve_sympd_rcond(Mat& out, bool& out_sympd_state, typename T1::pod_type& out_rcond, Mat& A, const Base& B_expr); template inline static bool solve_sympd_rcond(Mat< std::complex >& out, bool& out_sympd_state, typename T1::pod_type& out_rcond, Mat< std::complex >& A, const Base< std::complex,T1>& B_expr); template inline static bool solve_sympd_refine(Mat& out, typename T1::pod_type& out_rcond, Mat& A, const Base& B_expr, const bool equilibrate); template inline static bool solve_sympd_refine(Mat< std::complex >& out, typename T1::pod_type& out_rcond, Mat< std::complex >& A, const Base,T1>& B_expr, const bool equilibrate); // template inline static bool solve_rect_fast(Mat& out, Mat& A, const Base& B_expr); template inline static bool solve_rect_rcond(Mat& out, typename T1::pod_type& out_rcond, Mat& A, const Base& B_expr); // template inline static bool solve_approx_svd(Mat& out, Mat& A, const Base& B_expr); template inline static bool solve_approx_svd(Mat< std::complex >& out, Mat< std::complex >& A, const Base,T1>& B_expr); // template inline static bool solve_trimat_fast(Mat& out, const Mat& A, const Base& B_expr, const uword layout); template inline static bool solve_trimat_rcond(Mat& out, typename T1::pod_type& out_rcond, const Mat& A, const Base& B_expr, const uword layout); // template inline static bool solve_band_fast(Mat& out, Mat& A, const uword KL, const uword KU, const Base& B_expr); template inline static bool solve_band_fast(Mat< std::complex >& out, Mat< std::complex >& A, const uword KL, const uword KU, const Base< std::complex,T1>& B_expr); template inline static bool solve_band_fast_common(Mat& out, const Mat& A, const uword KL, const uword KU, const Base& B_expr); template inline static bool solve_band_rcond(Mat& out, typename T1::pod_type& out_rcond, Mat& A, const uword KL, const uword KU, const Base& B_expr); template inline static bool solve_band_rcond(Mat< std::complex >& out, typename T1::pod_type& out_rcond, Mat< std::complex >& A, const uword KL, const uword KU, const Base< std::complex,T1>& B_expr); template inline static bool solve_band_rcond_common(Mat& out, typename T1::pod_type& out_rcond, const Mat& A, const uword KL, const uword KU, const Base& B_expr); template inline static bool solve_band_refine(Mat& out, typename T1::pod_type& out_rcond, Mat& A, const uword KL, const uword KU, const Base& B_expr, const bool equilibrate); template inline static bool solve_band_refine(Mat< std::complex >& out, typename T1::pod_type& out_rcond, Mat< std::complex >& A, const uword KL, const uword KU, const Base,T1>& B_expr, const bool equilibrate); // template inline static bool solve_tridiag_fast(Mat& out, Mat& A, const Base& B_expr); template inline static bool solve_tridiag_fast(Mat< std::complex >& out, Mat< std::complex >& A, const Base< std::complex,T1>& B_expr); template inline static bool solve_tridiag_fast_common(Mat& out, const Mat& A, const Base& B_expr); // // Schur decomposition template inline static bool schur(Mat& U, Mat& S, const Base& X, const bool calc_U = true); template inline static bool schur(Mat< std::complex >& U, Mat< std::complex >& S, const Base,T1>& X, const bool calc_U = true); template inline static bool schur(Mat< std::complex >& U, Mat< std::complex >& S, const bool calc_U = true); // // solve the Sylvester equation AX + XB = C template inline static bool sylvester(Mat& X, const Mat& A, const Mat& B, const Mat& C); // // QZ decomposition template inline static bool qz(Mat& A, Mat& B, Mat& vsl, Mat& vsr, const Base& X_expr, const Base& Y_expr, const char mode); template inline static bool qz(Mat< std::complex >& A, Mat< std::complex >& B, Mat< std::complex >& vsl, Mat< std::complex >& vsr, const Base< std::complex, T1 >& X_expr, const Base< std::complex, T2 >& Y_expr, const char mode); // // matrix balance template inline static bool balance(Col::result>& S, Col& P, Mat& A, const bool calc_SP, const bool do_scal, const bool do_perm); // // rcond template inline static eT rcond(Mat& A); template inline static T rcond(Mat< std::complex >& A); template inline static eT rcond_sym(Mat& A); template inline static T rcond_sym(Mat< std::complex >& A); template inline static eT rcond_trimat(const Mat& A, const uword layout); template inline static T rcond_trimat(const Mat< std::complex >& A, const uword layout); // // lu_rcond (rcond from pre-computed LU decomposition) template inline static eT lu_rcond(const Mat& A, const eT norm_val); template inline static T lu_rcond(const Mat< std::complex >& A, const T norm_val); template inline static eT lu_rcond_sympd(const Mat& A, const eT norm_val); template inline static T lu_rcond_sympd(const Mat< std::complex >& A, const T norm_val); template inline static eT lu_rcond_band(const Mat& AB, const uword KL, const uword KU, const podarray& ipiv, const eT norm_val); template inline static T lu_rcond_band(const Mat< std::complex >& AB, const uword KL, const uword KU, const podarray& ipiv, const T norm_val); // // misc template inline static bool crippled_lapack(const Base&); template inline static bool rudimentary_sym_check(const Mat& X); template inline static bool rudimentary_sym_check(const Mat< std::complex >& X); template inline static typename get_pod_type::result norm1_gen(const Mat& A); template inline static typename get_pod_type::result norm1_sym(const Mat& A); template inline static typename get_pod_type::result norm1_band(const Mat& A, const uword KL, const uword KU); }; namespace qz_helper { template inline blas_int select_lhp(const T* x_ptr, const T* y_ptr, const T* z_ptr); template inline blas_int select_rhp(const T* x_ptr, const T* y_ptr, const T* z_ptr); template inline blas_int select_iuc(const T* x_ptr, const T* y_ptr, const T* z_ptr); template inline blas_int select_ouc(const T* x_ptr, const T* y_ptr, const T* z_ptr); template inline blas_int cx_select_lhp(const std::complex* x_ptr, const std::complex* y_ptr); template inline blas_int cx_select_rhp(const std::complex* x_ptr, const std::complex* y_ptr); template inline blas_int cx_select_iuc(const std::complex* x_ptr, const std::complex* y_ptr); template inline blas_int cx_select_ouc(const std::complex* x_ptr, const std::complex* y_ptr); template inline void_ptr ptr_cast(blas_int (*function)(const T*, const T*, const T*)); template inline void_ptr ptr_cast(blas_int (*function)(const std::complex*, const std::complex*)); } //! @} RcppArmadillo/inst/include/armadillo_bits/op_sum_meat.hpp0000644000176200001440000003145214752446051023426 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_sum //! @{ template inline void op_sum::apply(Mat& out, const Op& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword dim = in.aux_uword_a; arma_conform_check( (dim > 1), "sum(): parameter 'dim' must be 0 or 1" ); if((is_Mat::value) || (is_Mat::stored_type>::value) || (arma_config::openmp && Proxy::use_mp)) { const quasi_unwrap U(in.m); if(U.is_alias(out)) { Mat tmp; op_sum::apply_mat_noalias(tmp, U.M, dim); out.steal_mem(tmp); } else { op_sum::apply_mat_noalias(out, U.M, dim); } } else { const Proxy P(in.m); if(P.is_alias(out)) { Mat tmp; op_sum::apply_proxy_noalias(tmp, P, dim); out.steal_mem(tmp); } else { op_sum::apply_proxy_noalias(out, P, dim); } } } template inline void op_sum::apply(Mat& out, const Op< eOp, op_sum >& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; typedef eOp inner_expr_type; typedef typename inner_expr_type::proxy_type::stored_type inner_expr_P_stored_type; const uword dim = in.aux_uword_a; arma_conform_check( (dim > 1), "sum(): parameter 'dim' must be 0 or 1" ); if(is_Mat::value) { const quasi_unwrap U(in.m.P.Q); if(U.is_alias(out)) { Mat tmp; op_sum::apply_mat_square_noalias(tmp, U.M, dim); out.steal_mem(tmp); } else { op_sum::apply_mat_square_noalias(out, U.M, dim); } } else if(arma_config::openmp && Proxy::use_mp) { const quasi_unwrap U(in.m); // force evaluation of compound inner expression if(U.is_alias(out)) { Mat tmp; op_sum::apply_mat_noalias(tmp, U.M, dim); out.steal_mem(tmp); } else { op_sum::apply_mat_noalias(out, U.M, dim); } } else { const Proxy P(in.m); if(P.is_alias(out)) { Mat tmp; op_sum::apply_proxy_noalias(tmp, P, dim); out.steal_mem(tmp); } else { op_sum::apply_proxy_noalias(out, P, dim); } } } template inline void op_sum::apply(Mat& out, const Op< eOp, op_sum >& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; if(in.m.aux == eT(2)) { typedef Op< eOp, op_sum > modified_whole_expr_type; op_sum::apply(out, reinterpret_cast(in) ); return; } if((in.m.aux == eT(0.5)) && is_non_integral::value) { typedef Op< eOp, op_sum > modified_whole_expr_type; op_sum::apply(out, reinterpret_cast(in) ); return; } typedef eOp inner_expr_type; typedef typename inner_expr_type::proxy_type::stored_type inner_expr_P_stored_type; const uword dim = in.aux_uword_a; arma_conform_check( (dim > 1), "sum(): parameter 'dim' must be 0 or 1" ); if( (is_Mat::value) || (arma_config::openmp && Proxy::use_mp) ) { const quasi_unwrap U(in.m); // force evaluation of eop_pow if(U.is_alias(out)) { Mat tmp; op_sum::apply_mat_noalias(tmp, U.M, dim); out.steal_mem(tmp); } else { op_sum::apply_mat_noalias(out, U.M, dim); } } else { const Proxy P(in.m); if(P.is_alias(out)) { Mat tmp; op_sum::apply_proxy_noalias(tmp, P, dim); out.steal_mem(tmp); } else { op_sum::apply_proxy_noalias(out, P, dim); } } } template inline void op_sum::apply_mat_noalias(Mat& out, const Mat& X, const uword dim) { arma_debug_sigprint(); const uword X_n_rows = X.n_rows; const uword X_n_cols = X.n_cols; const uword out_n_rows = (dim == 0) ? uword(1) : X_n_rows; const uword out_n_cols = (dim == 0) ? X_n_cols : uword(1); out.set_size(out_n_rows, out_n_cols); if(X.n_elem == 0) { out.zeros(); return; } const eT* X_colptr = X.memptr(); eT* out_mem = out.memptr(); if(dim == 0) { for(uword col=0; col < X_n_cols; ++col) { out_mem[col] = arrayops::accumulate( X_colptr, X_n_rows ); X_colptr += X_n_rows; } } else { arrayops::copy(out_mem, X_colptr, X_n_rows); X_colptr += X_n_rows; for(uword col=1; col < X_n_cols; ++col) { arrayops::inplace_plus( out_mem, X_colptr, X_n_rows ); X_colptr += X_n_rows; } } } template inline void op_sum::apply_mat_square_noalias(Mat& out, const Mat& X, const uword dim) { arma_debug_sigprint(); const uword X_n_rows = X.n_rows; const uword X_n_cols = X.n_cols; const uword out_n_rows = (dim == 0) ? uword(1) : X_n_rows; const uword out_n_cols = (dim == 0) ? X_n_cols : uword(1); out.set_size(out_n_rows, out_n_cols); if(X.n_elem == 0) { out.zeros(); return; } const eT* X_colptr = X.memptr(); eT* out_mem = out.memptr(); if(dim == 0) { for(uword col=0; col < X_n_cols; ++col) { out_mem[col] = op_dot::direct_dot(X_n_rows, X_colptr, X_colptr); X_colptr += X_n_rows; } } else { for(uword row=0; row < X_n_rows; ++row) { const eT tmp = X_colptr[row]; out_mem[row] = tmp*tmp; } X_colptr += X_n_rows; for(uword col=1; col < X_n_cols; ++col) { for(uword row=0; row < X_n_rows; ++row) { const eT tmp = X_colptr[row]; out_mem[row] += tmp*tmp; } X_colptr += X_n_rows; } } } template inline void op_sum::apply_proxy_noalias(Mat& out, const Proxy& P, const uword dim) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword P_n_rows = P.get_n_rows(); const uword P_n_cols = P.get_n_cols(); const uword out_n_rows = (dim == 0) ? uword(1) : P_n_rows; const uword out_n_cols = (dim == 0) ? P_n_cols : uword(1); out.set_size(out_n_rows, out_n_cols); if(P.get_n_elem() == 0) { out.zeros(); return; } eT* out_mem = out.memptr(); if(Proxy::use_at == false) { if(dim == 0) { uword count = 0; for(uword col=0; col < P_n_cols; ++col) { eT val1 = eT(0); eT val2 = eT(0); uword j; for(j=1; j < P_n_rows; j+=2) { val1 += P[count]; ++count; val2 += P[count]; ++count; } if((j-1) < P_n_rows) { val1 += P[count]; ++count; } out_mem[col] = (val1 + val2); } } else { uword count = 0; for(uword row=0; row < P_n_rows; ++row) { out_mem[row] = P[count]; ++count; } for(uword col=1; col < P_n_cols; ++col) for(uword row=0; row < P_n_rows; ++row) { out_mem[row] += P[count]; ++count; } } } else { if(dim == 0) { for(uword col=0; col < P_n_cols; ++col) { eT val1 = eT(0); eT val2 = eT(0); uword i,j; for(i=0, j=1; j < P_n_rows; i+=2, j+=2) { val1 += P.at(i,col); val2 += P.at(j,col); } if(i < P_n_rows) { val1 += P.at(i,col); } out_mem[col] = (val1 + val2); } } else { for(uword row=0; row < P_n_rows; ++row) { out_mem[row] = P.at(row,0); } for(uword col=1; col < P_n_cols; ++col) for(uword row=0; row < P_n_rows; ++row) { out_mem[row] += P.at(row,col); } } } } // // cubes template inline void op_sum::apply(Cube& out, const OpCube& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword dim = in.aux_uword_a; arma_conform_check( (dim > 2), "sum(): parameter 'dim' must be 0 or 1 or 2" ); if((is_Cube::value) || (is_Cube::stored_type>::value) || (arma_config::openmp && ProxyCube::use_mp)) { const unwrap_cube U(in.m); if(U.is_alias(out)) { Cube tmp; op_sum::apply_cube_noalias(tmp, U.M, dim); out.steal_mem(tmp); } else { op_sum::apply_cube_noalias(out, U.M, dim); } } else { const ProxyCube P(in.m); if(P.is_alias(out)) { Cube tmp; op_sum::apply_proxy_noalias(tmp, P, dim); out.steal_mem(tmp); } else { op_sum::apply_proxy_noalias(out, P, dim); } } } template inline void op_sum::apply_cube_noalias(Cube& out, const Cube& X, const uword dim) { arma_debug_sigprint(); const uword X_n_rows = X.n_rows; const uword X_n_cols = X.n_cols; const uword X_n_slices = X.n_slices; if(dim == 0) { out.set_size(1, X_n_cols, X_n_slices); for(uword slice=0; slice < X_n_slices; ++slice) { eT* out_mem = out.slice_memptr(slice); for(uword col=0; col < X_n_cols; ++col) { out_mem[col] = arrayops::accumulate( X.slice_colptr(slice,col), X_n_rows ); } } } else if(dim == 1) { out.zeros(X_n_rows, 1, X_n_slices); for(uword slice=0; slice < X_n_slices; ++slice) { eT* out_mem = out.slice_memptr(slice); for(uword col=0; col < X_n_cols; ++col) { arrayops::inplace_plus( out_mem, X.slice_colptr(slice,col), X_n_rows ); } } } else if(dim == 2) { out.zeros(X_n_rows, X_n_cols, 1); eT* out_mem = out.memptr(); for(uword slice=0; slice < X_n_slices; ++slice) { arrayops::inplace_plus(out_mem, X.slice_memptr(slice), X.n_elem_slice ); } } } template inline void op_sum::apply_proxy_noalias(Cube& out, const ProxyCube& P, const uword dim) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword P_n_rows = P.get_n_rows(); const uword P_n_cols = P.get_n_cols(); const uword P_n_slices = P.get_n_slices(); if(dim == 0) { out.set_size(1, P_n_cols, P_n_slices); for(uword slice=0; slice < P_n_slices; ++slice) { eT* out_mem = out.slice_memptr(slice); for(uword col=0; col < P_n_cols; ++col) { eT val1 = eT(0); eT val2 = eT(0); uword i,j; for(i=0, j=1; j < P_n_rows; i+=2, j+=2) { val1 += P.at(i,col,slice); val2 += P.at(j,col,slice); } if(i < P_n_rows) { val1 += P.at(i,col,slice); } out_mem[col] = (val1 + val2); } } } else if(dim == 1) { out.zeros(P_n_rows, 1, P_n_slices); for(uword slice=0; slice < P_n_slices; ++slice) { eT* out_mem = out.slice_memptr(slice); for(uword col=0; col < P_n_cols; ++col) for(uword row=0; row < P_n_rows; ++row) { out_mem[row] += P.at(row,col,slice); } } } else if(dim == 2) { out.zeros(P_n_rows, P_n_cols, 1); for(uword slice=0; slice < P_n_slices; ++slice) { for(uword col=0; col < P_n_cols; ++col) { eT* out_mem = out.slice_colptr(0,col); for(uword row=0; row < P_n_rows; ++row) { out_mem[row] += P.at(row,col,slice); } } } } } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_trunc_log.hpp0000644000176200001440000000401214631567470023572 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_trunc_log //! @{ template arma_warn_unused inline static typename arma_real_only::result trunc_log(const eT x) { if(std::numeric_limits::is_iec559) { if(x == std::numeric_limits::infinity()) { return Datum::log_max; } else { return (x <= eT(0)) ? Datum::log_min : std::log(x); } } else { return std::log(x); } } template arma_warn_unused inline static typename arma_integral_only::result trunc_log(const eT x) { return eT( trunc_log( double(x) ) ); } template arma_warn_unused inline static std::complex trunc_log(const std::complex& x) { return std::complex( trunc_log( std::abs(x) ), std::arg(x) ); } template arma_warn_unused arma_inline typename enable_if2< is_arma_type::value, const eOp >::result trunc_log(const T1& A) { arma_debug_sigprint(); return eOp(A); } template arma_warn_unused arma_inline const eOpCube trunc_log(const BaseCube& A) { arma_debug_sigprint(); return eOpCube(A.get_ref()); } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_princomp.hpp0000644000176200001440000001060114635324415023420 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_princomp //! @{ //! \brief //! principal component analysis -- 4 arguments version //! coeff_out -> principal component coefficients //! score_out -> projected samples //! latent_out -> eigenvalues of principal vectors //! tsquared_out -> Hotelling's T^2 statistic template inline bool princomp ( Mat& coeff_out, Mat& score_out, Col& latent_out, Col& tsquared_out, const Base& X, const typename arma_blas_type_only::result* junk = nullptr ) { arma_debug_sigprint(); arma_ignore(junk); const bool status = op_princomp::direct_princomp(coeff_out, score_out, latent_out, tsquared_out, X); if(status == false) { coeff_out.soft_reset(); score_out.soft_reset(); latent_out.soft_reset(); tsquared_out.soft_reset(); arma_warn(3, "princomp(): decomposition failed"); } return status; } //! \brief //! principal component analysis -- 3 arguments version //! coeff_out -> principal component coefficients //! score_out -> projected samples //! latent_out -> eigenvalues of principal vectors template inline bool princomp ( Mat& coeff_out, Mat& score_out, Col& latent_out, const Base& X, const typename arma_blas_type_only::result* junk = nullptr ) { arma_debug_sigprint(); arma_ignore(junk); const bool status = op_princomp::direct_princomp(coeff_out, score_out, latent_out, X); if(status == false) { coeff_out.soft_reset(); score_out.soft_reset(); latent_out.soft_reset(); arma_warn(3, "princomp(): decomposition failed"); } return status; } //! \brief //! principal component analysis -- 2 arguments version //! coeff_out -> principal component coefficients //! score_out -> projected samples template inline bool princomp ( Mat& coeff_out, Mat& score_out, const Base& X, const typename arma_blas_type_only::result* junk = nullptr ) { arma_debug_sigprint(); arma_ignore(junk); const bool status = op_princomp::direct_princomp(coeff_out, score_out, X); if(status == false) { coeff_out.soft_reset(); score_out.soft_reset(); arma_warn(3, "princomp(): decomposition failed"); } return status; } //! \brief //! principal component analysis -- 1 argument version //! coeff_out -> principal component coefficients template inline bool princomp ( Mat& coeff_out, const Base& X, const typename arma_blas_type_only::result* junk = nullptr ) { arma_debug_sigprint(); arma_ignore(junk); const bool status = op_princomp::direct_princomp(coeff_out, X); if(status == false) { coeff_out.soft_reset(); arma_warn(3, "princomp(): decomposition failed"); } return status; } template arma_warn_unused inline const Op princomp ( const Base& X, const typename arma_blas_type_only::result* junk = nullptr ) { arma_debug_sigprint(); arma_ignore(junk); return Op(X.get_ref()); } //! @} RcppArmadillo/inst/include/armadillo_bits/newarp_GenEigsSolver_bones.hpp0000644000176200001440000001023614301267043026361 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ namespace newarp { //! This class implements the eigen solver for general real matrices. template class GenEigsSolver { protected: const OpType& op; // object to conduct matrix operation, eg. matrix-vector product const uword nev; // number of eigenvalues requested Col< std::complex > ritz_val; // ritz values // Sort the first nev Ritz pairs in decreasing magnitude order // This is used to return the final results virtual void sort_ritzpair(); private: const uword dim_n; // dimension of matrix A const uword ncv; // number of ritz values uword nmatop; // number of matrix operations called uword niter; // number of restarting iterations Mat fac_V; // V matrix in the Arnoldi factorisation Mat fac_H; // H matrix in the Arnoldi factorisation Col fac_f; // residual in the Arnoldi factorisation Mat< std::complex > ritz_vec; // ritz vectors Col< std::complex > ritz_est; // last row of ritz_vec std::vector ritz_conv; // indicator of the convergence of ritz values const eT eps; // the machine precision // eg. ~= 1e-16 for double type const eT approx0; // a number that is approximately zero // approx0 = eps^(2/3) // used to test the orthogonality of vectors, // and in convergence test, tol*approx0 is // the absolute tolerance std::mt19937_64 local_rng; // local random number generator inline void fill_rand(eT* dest, const uword N, const uword seed_val); // Arnoldi factorisation starting from step-k inline void factorise_from(uword from_k, uword to_m, const Col& fk); // Implicitly restarted Arnoldi factorisation inline void restart(uword k); // Calculate the number of converged Ritz values inline uword num_converged(eT tol); // Return the adjusted nev for restarting inline uword nev_adjusted(uword nconv); // Retrieve and sort ritz values and ritz vectors inline void retrieve_ritzpair(); public: //! Constructor to create a solver object. inline GenEigsSolver(const OpType& op_, uword nev_, uword ncv_); //! Providing the initial residual vector for the algorithm. inline void init(eT* init_resid); //! Providing a random initial residual vector. inline void init(); //! Conducting the major computation procedure. inline uword compute(uword maxit = 1000, eT tol = 1e-10); //! Returning the number of iterations used in the computation. inline int num_iterations() { return niter; } //! Returning the number of matrix operations used in the computation. inline int num_operations() { return nmatop; } //! Returning the converged eigenvalues. inline Col< std::complex > eigenvalues(); //! Returning the eigenvectors associated with the converged eigenvalues. inline Mat< std::complex > eigenvectors(uword nvec); //! Returning all converged eigenvectors. inline Mat< std::complex > eigenvectors() { return eigenvectors(nev); } }; } // namespace newarp RcppArmadillo/inst/include/armadillo_bits/fn_accu.hpp0000644000176200001440000012416615030507611022507 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_accu //! @{ template arma_hot inline typename T1::elem_type accu_proxy_linear(const Proxy& P) { arma_debug_sigprint(); typedef typename T1::elem_type eT; eT val = eT(0); typename Proxy::ea_type Pea = P.get_ea(); const uword n_elem = P.get_n_elem(); if( arma_config::openmp && Proxy::use_mp && mp_gate::eval(n_elem) ) { #if defined(ARMA_USE_OPENMP) { // NOTE: using parallelisation with manual reduction workaround to take into account complex numbers; // NOTE: OpenMP versions lower than 4.0 do not support user-defined reduction const int n_threads_max = mp_thread_limit::get(); const uword n_threads_use = (std::min)(uword(podarray_prealloc_n_elem::val), uword(n_threads_max)); const uword chunk_size = n_elem / n_threads_use; podarray partial_accs(n_threads_use); #pragma omp parallel for schedule(static) num_threads(int(n_threads_use)) for(uword thread_id=0; thread_id < n_threads_use; ++thread_id) { const uword start = (thread_id+0) * chunk_size; const uword endp1 = (thread_id+1) * chunk_size; eT acc = eT(0); for(uword i=start; i < endp1; ++i) { acc += Pea[i]; } partial_accs[thread_id] = acc; } for(uword thread_id=0; thread_id < n_threads_use; ++thread_id) { val += partial_accs[thread_id]; } for(uword i=(n_threads_use*chunk_size); i < n_elem; ++i) { val += Pea[i]; } } #endif } else { #if defined(__FAST_MATH__) { if(P.is_aligned()) { typename Proxy::aligned_ea_type Pea_aligned = P.get_aligned_ea(); for(uword i=0; i arma_hot inline typename T1::elem_type accu_proxy_at_mp(const Proxy& P) { arma_debug_sigprint(); typedef typename T1::elem_type eT; eT val = eT(0); #if defined(ARMA_USE_OPENMP) { const uword n_rows = P.get_n_rows(); const uword n_cols = P.get_n_cols(); if(n_cols == 1) { const int n_threads_max = mp_thread_limit::get(); const uword n_threads_use = (std::min)(uword(podarray_prealloc_n_elem::val), uword(n_threads_max)); const uword chunk_size = n_rows / n_threads_use; podarray partial_accs(n_threads_use); #pragma omp parallel for schedule(static) num_threads(int(n_threads_use)) for(uword thread_id=0; thread_id < n_threads_use; ++thread_id) { const uword start = (thread_id+0) * chunk_size; const uword endp1 = (thread_id+1) * chunk_size; eT acc = eT(0); for(uword i=start; i < endp1; ++i) { acc += P.at(i,0); } partial_accs[thread_id] = acc; } for(uword thread_id=0; thread_id < n_threads_use; ++thread_id) { val += partial_accs[thread_id]; } for(uword i=(n_threads_use*chunk_size); i < n_rows; ++i) { val += P.at(i,0); } } else if(n_rows == 1) { const int n_threads_max = mp_thread_limit::get(); const uword n_threads_use = (std::min)(uword(podarray_prealloc_n_elem::val), uword(n_threads_max)); const uword chunk_size = n_cols / n_threads_use; podarray partial_accs(n_threads_use); #pragma omp parallel for schedule(static) num_threads(int(n_threads_use)) for(uword thread_id=0; thread_id < n_threads_use; ++thread_id) { const uword start = (thread_id+0) * chunk_size; const uword endp1 = (thread_id+1) * chunk_size; eT acc = eT(0); for(uword i=start; i < endp1; ++i) { acc += P.at(0,i); } partial_accs[thread_id] = acc; } for(uword thread_id=0; thread_id < n_threads_use; ++thread_id) { val += partial_accs[thread_id]; } for(uword i=(n_threads_use*chunk_size); i < n_cols; ++i) { val += P.at(0,i); } } else { podarray col_accs(n_cols); const int n_threads = mp_thread_limit::get(); #pragma omp parallel for schedule(static) num_threads(n_threads) for(uword col=0; col < n_cols; ++col) { eT val1 = eT(0); eT val2 = eT(0); uword i,j; for(i=0, j=1; j < n_rows; i+=2, j+=2) { val1 += P.at(i,col); val2 += P.at(j,col); } if(i < n_rows) { val1 += P.at(i,col); } col_accs[col] = val1 + val2; } val = arrayops::accumulate(col_accs.memptr(), n_cols); } } #else { arma_ignore(P); } #endif return val; } template arma_hot inline typename T1::elem_type accu_proxy_at(const Proxy& P) { arma_debug_sigprint(); typedef typename T1::elem_type eT; if(arma_config::openmp && Proxy::use_mp && mp_gate::eval(P.get_n_elem())) { return accu_proxy_at_mp(P); } const uword n_rows = P.get_n_rows(); const uword n_cols = P.get_n_cols(); eT val = eT(0); if(n_rows != 1) { eT val1 = eT(0); eT val2 = eT(0); for(uword col=0; col < n_cols; ++col) { uword i,j; for(i=0, j=1; j < n_rows; i+=2, j+=2) { val1 += P.at(i,col); val2 += P.at(j,col); } if(i < n_rows) { val1 += P.at(i,col); } } val = val1 + val2; } else { for(uword col=0; col < n_cols; ++col) { val += P.at(0,col); } } return val; } //! accumulate the elements of a matrix template arma_warn_unused arma_hot inline typename enable_if2< is_arma_type::value, typename T1::elem_type >::result accu(const T1& X) { arma_debug_sigprint(); if((is_Mat::value) || (is_subview_col::value) || (is_Mat::stored_type>::value)) { const quasi_unwrap U(X); return arrayops::accumulate(U.M.memptr(), U.M.n_elem); } const Proxy P(X); return (Proxy::use_at) ? accu_proxy_at(P) : accu_proxy_linear(P); } template inline typename T1::elem_type accu_op_omit_helper(const Proxy& P, functor is_omitted) { arma_debug_sigprint(); typedef typename T1::elem_type eT; constexpr eT eT_zero = eT(0); eT acc = eT(0); if(Proxy::use_at) { const uword n_rows = P.get_n_rows(); const uword n_cols = P.get_n_cols(); for(uword c=0; c < n_cols; ++c) for(uword r=0; r < n_rows; ++r) { const eT val = P.at(r,c); acc += is_omitted(val) ? eT_zero : val; } } else { typename Proxy::ea_type Pea = P.get_ea(); const uword n_elem = P.get_n_elem(); eT val1 = eT(0); eT val2 = eT(0); uword i,j; for(i=0, j=1; j < n_elem; i+=2, j+=2) { const eT tmp_i = Pea[i]; const eT tmp_j = Pea[j]; val1 += is_omitted(tmp_i) ? eT_zero : tmp_i; val2 += is_omitted(tmp_j) ? eT_zero : tmp_j; } if(i < n_elem) { const eT tmp_i = Pea[i]; val1 += is_omitted(tmp_i) ? eT_zero : tmp_i; } acc = val1 + val2; } return acc; } template arma_warn_unused inline typename T1::elem_type accu(const Op& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword omit_mode = in.aux_uword_a; if(arma_config::fast_math_warn) { if(omit_mode == 1) { arma_warn(1, "omit_nan(): detection of NaN is not reliable in fast math mode"); } if(omit_mode == 2) { arma_warn(1, "omit_nonfinite(): detection of non-finite values is not reliable in fast math mode"); } } auto is_omitted_1 = [](const eT& x) -> bool { return arma_isnan(x); }; auto is_omitted_2 = [](const eT& x) -> bool { return arma_isnonfinite(x); }; const Proxy P(in.m); eT acc = eT(0); if(omit_mode == 1) { acc = accu_op_omit_helper(P, is_omitted_1); } if(omit_mode == 2) { acc = accu_op_omit_helper(P, is_omitted_2); } return acc; } template arma_warn_unused inline typename T1::elem_type accu(const eOp& expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; typedef eOp expr_type; typedef typename expr_type::proxy_type::stored_type expr_P_stored_type; if((is_Mat::value) || (is_subview_col::value)) { const quasi_unwrap U(expr.P.Q); const eT* X_mem = U.M.memptr(); return op_dot::direct_dot(U.M.n_elem, X_mem, X_mem); } const Proxy P(expr); return (Proxy::use_at) ? accu_proxy_at(P) : accu_proxy_linear(P); } template arma_warn_unused inline typename T1::elem_type accu(const eOp& expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; typedef eOp expr_type; if(expr.aux == eT(2)) { typedef eOp modified_expr_type; return accu( reinterpret_cast< const modified_expr_type& >(expr) ); } if((expr.aux == eT(0.5)) && is_non_integral::value) { typedef eOp modified_expr_type; return accu( reinterpret_cast< const modified_expr_type& >(expr) ); } const Proxy P(expr); return (Proxy::use_at) ? accu_proxy_at(P) : accu_proxy_linear(P); } //! explicit handling of multiply-and-accumulate template arma_warn_unused inline typename T1::elem_type accu(const eGlue& expr) { arma_debug_sigprint(); typedef eGlue expr_type; typedef typename expr_type::proxy1_type::stored_type P1_stored_type; typedef typename expr_type::proxy2_type::stored_type P2_stored_type; constexpr bool is_sv = (is_subview::value) || (is_subview::value); if( (is_sv) && (expr.get_n_rows() >= 4) ) { arma_debug_print("accu(): eglue_schur subview optimisation"); typedef typename T1::elem_type eT; const sv_keep_unwrap& UA(expr.P1.Q); const sv_keep_unwrap& UB(expr.P2.Q); typedef typename sv_keep_unwrap::stored_type UA_M_type; typedef typename sv_keep_unwrap::stored_type UB_M_type; const UA_M_type& A = UA.M; const UB_M_type& B = UB.M; // A and B have the same size (checked by the eGlue constructor) const uword A_n_rows = A.n_rows; const uword A_n_cols = A.n_cols; eT acc = eT(0); for(uword c=0; c < A_n_cols; ++c) { acc += op_dot::direct_dot(A_n_rows, A.colptr(c), B.colptr(c)); } return acc; } constexpr bool have_direct_mem_1 = (is_Mat::value) || (is_subview_col::value); constexpr bool have_direct_mem_2 = (is_Mat::value) || (is_subview_col::value); if(have_direct_mem_1 && have_direct_mem_2) { arma_debug_print("accu(): eglue_schur direct_mem optimisation"); const quasi_unwrap tmp1(expr.P1.Q); const quasi_unwrap tmp2(expr.P2.Q); return op_dot::direct_dot(tmp1.M.n_elem, tmp1.M.memptr(), tmp2.M.memptr()); } const Proxy P(expr); return (Proxy::use_at) ? accu_proxy_at(P) : accu_proxy_linear(P); } template arma_warn_unused inline uword accu(const mtOp& X, const typename arma_op_rel_only::result* junk1 = nullptr, const typename arma_not_cx::result* junk2 = nullptr) { arma_debug_sigprint(); arma_ignore(junk1); arma_ignore(junk2); typedef typename T1::elem_type eT; const eT k = X.aux; const Proxy P(X.m); uword count = 0; if(Proxy::use_at == false) { typedef typename Proxy::ea_type ea_type; ea_type A = P.get_ea(); const uword n_elem = P.get_n_elem(); for(uword i=0; i::yes) { condition = (val == k ); } else if(is_same_type::yes) { condition = (val != k ); } else if(is_same_type::yes) { condition = (k < val); } else if(is_same_type::yes) { condition = (val < k ); } else if(is_same_type::yes) { condition = (k > val); } else if(is_same_type::yes) { condition = (val > k ); } else if(is_same_type::yes) { condition = (k <= val); } else if(is_same_type::yes) { condition = (val <= k ); } else if(is_same_type::yes) { condition = (k >= val); } else if(is_same_type::yes) { condition = (val >= k ); } else { condition = false; } count += (condition) ? uword(1) : uword(0); } } else { const uword P_n_cols = P.get_n_cols(); const uword P_n_rows = P.get_n_rows(); for(uword col=0; col < P_n_cols; ++col) for(uword row=0; row < P_n_rows; ++row) { const eT val = P.at(row,col); bool condition; if(is_same_type::yes) { condition = (val == k ); } else if(is_same_type::yes) { condition = (val != k ); } else if(is_same_type::yes) { condition = (k < val); } else if(is_same_type::yes) { condition = (val < k ); } else if(is_same_type::yes) { condition = (k > val); } else if(is_same_type::yes) { condition = (val > k ); } else if(is_same_type::yes) { condition = (k <= val); } else if(is_same_type::yes) { condition = (val <= k ); } else if(is_same_type::yes) { condition = (k >= val); } else if(is_same_type::yes) { condition = (val >= k ); } else { condition = false; } count += (condition) ? uword(1) : uword(0); } } return count; } template arma_warn_unused inline uword accu(const mtOp& X, const typename arma_op_rel_only::result* junk1 = nullptr, const typename arma_cx_only::result* junk2 = nullptr) { arma_debug_sigprint(); arma_ignore(junk1); arma_ignore(junk2); typedef typename T1::elem_type eT; const eT k = X.aux; const Proxy P(X.m); uword count = 0; if(Proxy::use_at == false) { typedef typename Proxy::ea_type ea_type; ea_type A = P.get_ea(); const uword n_elem = P.get_n_elem(); for(uword i=0; i::yes) { condition = (val == k); } else if(is_same_type::yes) { condition = (val != k); } else { condition = false; } count += (condition) ? uword(1) : uword(0); } } else { const uword P_n_cols = P.get_n_cols(); const uword P_n_rows = P.get_n_rows(); for(uword col=0; col < P_n_cols; ++col) for(uword row=0; row < P_n_rows; ++row) { const eT val = P.at(row,col); bool condition; if(is_same_type::yes) { condition = (val == k); } else if(is_same_type::yes) { condition = (val != k); } else { condition = false; } count += (condition) ? uword(1) : uword(0); } } return count; } template arma_warn_unused inline uword accu(const mtGlue& X) { arma_debug_sigprint(); const Proxy PA(X.A); const Proxy PB(X.B); arma_conform_assert_same_size(PA, PB, "operator!="); uword n_nonzero = 0; if( (Proxy::use_at == false) && (Proxy::use_at == false) ) { typedef typename Proxy::ea_type PA_ea_type; typedef typename Proxy::ea_type PB_ea_type; PA_ea_type A = PA.get_ea(); PB_ea_type B = PB.get_ea(); const uword n_elem = PA.get_n_elem(); for(uword i=0; i < n_elem; ++i) { n_nonzero += (A[i] != B[i]) ? uword(1) : uword(0); } } else { const uword PA_n_cols = PA.get_n_cols(); const uword PA_n_rows = PA.get_n_rows(); if(PA_n_rows == 1) { for(uword col=0; col < PA_n_cols; ++col) { n_nonzero += (PA.at(0,col) != PB.at(0,col)) ? uword(1) : uword(0); } } else { for(uword col=0; col < PA_n_cols; ++col) for(uword row=0; row < PA_n_rows; ++row) { n_nonzero += (PA.at(row,col) != PB.at(row,col)) ? uword(1) : uword(0); } } } return n_nonzero; } template arma_warn_unused inline uword accu(const mtGlue& X) { arma_debug_sigprint(); const Proxy PA(X.A); const Proxy PB(X.B); arma_conform_assert_same_size(PA, PB, "operator=="); uword n_nonzero = 0; if( (Proxy::use_at == false) && (Proxy::use_at == false) ) { typedef typename Proxy::ea_type PA_ea_type; typedef typename Proxy::ea_type PB_ea_type; PA_ea_type A = PA.get_ea(); PB_ea_type B = PB.get_ea(); const uword n_elem = PA.get_n_elem(); for(uword i=0; i < n_elem; ++i) { n_nonzero += (A[i] == B[i]) ? uword(1) : uword(0); } } else { const uword PA_n_cols = PA.get_n_cols(); const uword PA_n_rows = PA.get_n_rows(); if(PA_n_rows == 1) { for(uword col=0; col < PA_n_cols; ++col) { n_nonzero += (PA.at(0,col) == PB.at(0,col)) ? uword(1) : uword(0); } } else { for(uword col=0; col < PA_n_cols; ++col) for(uword row=0; row < PA_n_rows; ++row) { n_nonzero += (PA.at(row,col) == PB.at(row,col)) ? uword(1) : uword(0); } } } return n_nonzero; } //! accumulate the elements of a subview (submatrix) template arma_warn_unused arma_hot inline eT accu(const subview& X) { arma_debug_sigprint(); const uword X_n_rows = X.n_rows; const uword X_n_cols = X.n_cols; if(X_n_rows == 1) { const Mat& m = X.m; const uword col_offset = X.aux_col1; const uword row_offset = X.aux_row1; eT val1 = eT(0); eT val2 = eT(0); uword i,j; for(i=0, j=1; j < X_n_cols; i+=2, j+=2) { val1 += m.at(row_offset, col_offset + i); val2 += m.at(row_offset, col_offset + j); } if(i < X_n_cols) { val1 += m.at(row_offset, col_offset + i); } return val1 + val2; } if(X_n_cols == 1) { return arrayops::accumulate( X.colptr(0), X_n_rows ); } eT val = eT(0); for(uword col=0; col < X_n_cols; ++col) { val += arrayops::accumulate( X.colptr(col), X_n_rows ); } return val; } template arma_warn_unused arma_hot inline eT accu(const subview_col& X) { arma_debug_sigprint(); return arrayops::accumulate( X.colmem, X.n_rows ); } // template arma_hot inline typename T1::elem_type accu_cube_proxy_linear(const ProxyCube& P) { arma_debug_sigprint(); typedef typename T1::elem_type eT; eT val = eT(0); typename ProxyCube::ea_type Pea = P.get_ea(); const uword n_elem = P.get_n_elem(); if( arma_config::openmp && ProxyCube::use_mp && mp_gate::eval(n_elem) ) { #if defined(ARMA_USE_OPENMP) { // NOTE: using parallelisation with manual reduction workaround to take into account complex numbers; // NOTE: OpenMP versions lower than 4.0 do not support user-defined reduction const int n_threads_max = mp_thread_limit::get(); const uword n_threads_use = (std::min)(uword(podarray_prealloc_n_elem::val), uword(n_threads_max)); const uword chunk_size = n_elem / n_threads_use; podarray partial_accs(n_threads_use); #pragma omp parallel for schedule(static) num_threads(int(n_threads_use)) for(uword thread_id=0; thread_id < n_threads_use; ++thread_id) { const uword start = (thread_id+0) * chunk_size; const uword endp1 = (thread_id+1) * chunk_size; eT acc = eT(0); for(uword i=start; i < endp1; ++i) { acc += Pea[i]; } partial_accs[thread_id] = acc; } for(uword thread_id=0; thread_id < n_threads_use; ++thread_id) { val += partial_accs[thread_id]; } for(uword i=(n_threads_use*chunk_size); i < n_elem; ++i) { val += Pea[i]; } } #endif } else { #if defined(__FAST_MATH__) { if(P.is_aligned()) { typename ProxyCube::aligned_ea_type Pea_aligned = P.get_aligned_ea(); for(uword i=0; i arma_hot inline typename T1::elem_type accu_cube_proxy_at_mp(const ProxyCube& P) { arma_debug_sigprint(); typedef typename T1::elem_type eT; eT val = eT(0); #if defined(ARMA_USE_OPENMP) { const uword n_rows = P.get_n_rows(); const uword n_cols = P.get_n_cols(); const uword n_slices = P.get_n_slices(); podarray slice_accs(n_slices); const int n_threads = mp_thread_limit::get(); #pragma omp parallel for schedule(static) num_threads(n_threads) for(uword slice = 0; slice < n_slices; ++slice) { eT val1 = eT(0); eT val2 = eT(0); for(uword col = 0; col < n_cols; ++col) { uword i,j; for(i=0, j=1; j arma_hot inline typename T1::elem_type accu_cube_proxy_at(const ProxyCube& P) { arma_debug_sigprint(); typedef typename T1::elem_type eT; if(arma_config::openmp && ProxyCube::use_mp && mp_gate::eval(P.get_n_elem())) { return accu_cube_proxy_at_mp(P); } const uword n_rows = P.get_n_rows(); const uword n_cols = P.get_n_cols(); const uword n_slices = P.get_n_slices(); eT val1 = eT(0); eT val2 = eT(0); for(uword slice = 0; slice < n_slices; ++slice) for(uword col = 0; col < n_cols; ++col ) { uword i,j; for(i=0, j=1; j arma_warn_unused arma_hot inline typename T1::elem_type accu(const BaseCube& X) { arma_debug_sigprint(); if((is_Cube::value) || (is_Cube::stored_type>::value)) { const unwrap_cube U(X.get_ref()); return arrayops::accumulate(U.M.memptr(), U.M.n_elem); } const ProxyCube P(X.get_ref()); return (ProxyCube::use_at) ? accu_cube_proxy_at(P) : accu_cube_proxy_linear(P); } template arma_warn_unused inline typename T1::elem_type accu(const eOpCube& expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; typedef eOpCube expr_type; typedef typename expr_type::proxy_type::stored_type expr_P_stored_type; if(is_Cube::value) { const unwrap_cube U(expr.P.Q); const eT* X_mem = U.M.memptr(); return op_dot::direct_dot(U.M.n_elem, X_mem, X_mem); } const ProxyCube P(expr); return (ProxyCube::use_at) ? accu_cube_proxy_at(P) : accu_cube_proxy_linear(P); } template arma_warn_unused inline typename T1::elem_type accu(const eOpCube& expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; typedef eOpCube expr_type; if(expr.aux == eT(2)) { typedef eOpCube modified_expr_type; return accu( reinterpret_cast< const modified_expr_type& >(expr) ); } if((expr.aux == eT(0.5)) && is_non_integral::value) { typedef eOpCube modified_expr_type; return accu( reinterpret_cast< const modified_expr_type& >(expr) ); } const ProxyCube P(expr); return (ProxyCube::use_at) ? accu_cube_proxy_at(P) : accu_cube_proxy_linear(P); } //! explicit handling of multiply-and-accumulate (cube version) template arma_warn_unused inline typename T1::elem_type accu(const eGlueCube& expr) { arma_debug_sigprint(); typedef eGlueCube expr_type; typedef typename expr_type::proxy1_type::stored_type P1_stored_type; typedef typename expr_type::proxy2_type::stored_type P2_stored_type; if(is_Cube::value && is_Cube::value) { const unwrap_cube tmp1(expr.P1.Q); const unwrap_cube tmp2(expr.P2.Q); return op_dot::direct_dot(tmp1.M.n_elem, tmp1.M.memptr(), tmp2.M.memptr()); } const ProxyCube P(expr); return (ProxyCube::use_at) ? accu_cube_proxy_at(P) : accu_cube_proxy_linear(P); } template inline typename T1::elem_type accu_cube_omit_helper(const ProxyCube& P, functor is_omitted) { arma_debug_sigprint(); typedef typename T1::elem_type eT; constexpr eT eT_zero = eT(0); eT acc = eT(0); if(ProxyCube::use_at) { const uword n_r = P.get_n_rows(); const uword n_c = P.get_n_cols(); const uword n_s = P.get_n_slices(); for(uword s=0; s < n_s; ++s) for(uword c=0; c < n_c; ++c) for(uword r=0; r < n_r; ++r) { const eT val = P.at(r,c,s); acc += is_omitted(val) ? eT_zero : val; } } else { typename ProxyCube::ea_type Pea = P.get_ea(); const uword n_elem = P.get_n_elem(); eT val1 = eT(0); eT val2 = eT(0); uword i,j; for(i=0, j=1; j < n_elem; i+=2, j+=2) { const eT tmp_i = Pea[i]; const eT tmp_j = Pea[j]; val1 += is_omitted(tmp_i) ? eT_zero : tmp_i; val2 += is_omitted(tmp_j) ? eT_zero : tmp_j; } if(i < n_elem) { const eT tmp_i = Pea[i]; val1 += is_omitted(tmp_i) ? eT_zero : tmp_i; } acc = val1 + val2; } return acc; } template arma_warn_unused inline typename T1::elem_type accu(const CubeToMatOp& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const ProxyCube P(in.m); const uword omit_mode = in.aux_uword; if(arma_config::fast_math_warn) { if(omit_mode == 1) { arma_warn(1, "omit_nan(): detection of NaN is not reliable in fast math mode"); } if(omit_mode == 2) { arma_warn(1, "omit_nonfinite(): detection of non-finite values is not reliable in fast math mode"); } } auto is_omitted_1 = [](const eT& x) -> bool { return arma_isnan(x); }; auto is_omitted_2 = [](const eT& x) -> bool { return arma_isnonfinite(x); }; eT acc = eT(0); if(omit_mode == 1) { acc = accu_cube_omit_helper(P, is_omitted_1); } if(omit_mode == 2) { acc = accu_cube_omit_helper(P, is_omitted_2); } return acc; } // template arma_warn_unused inline typename arma_scalar_only::result accu(const T& x) { return x; } //! accumulate values in a sparse object template arma_warn_unused inline typename T1::elem_type accu(const SpBase& expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const SpProxy P(expr.get_ref()); const uword N = P.get_n_nonzero(); if(N == 0) { return eT(0); } if(SpProxy::use_iterator == false) { // direct counting return arrayops::accumulate(P.get_values(), N); } if(is_SpSubview::stored_type>::value) { const SpSubview& sv = reinterpret_cast< const SpSubview& >(P.Q); if(sv.n_rows == sv.m.n_rows) { const SpMat& m = sv.m; const uword col = sv.aux_col1; return arrayops::accumulate(&(m.values[ m.col_ptrs[col] ]), N); } } typename SpProxy::const_iterator_type it = P.begin(); eT val = eT(0); for(uword i=0; i < N; ++i) { val += (*it); ++it; } return val; } //! explicit handling of accu(A + B), where A and B are sparse matrices template arma_warn_unused inline typename T1::elem_type accu(const SpGlue& expr) { arma_debug_sigprint(); const unwrap_spmat UA(expr.A); const unwrap_spmat UB(expr.B); arma_conform_assert_same_size(UA.M.n_rows, UA.M.n_cols, UB.M.n_rows, UB.M.n_cols, "addition"); return (accu(UA.M) + accu(UB.M)); } //! explicit handling of accu(A - B), where A and B are sparse matrices template arma_warn_unused inline typename T1::elem_type accu(const SpGlue& expr) { arma_debug_sigprint(); const unwrap_spmat UA(expr.A); const unwrap_spmat UB(expr.B); arma_conform_assert_same_size(UA.M.n_rows, UA.M.n_cols, UB.M.n_rows, UB.M.n_cols, "subtraction"); return (accu(UA.M) - accu(UB.M)); } //! explicit handling of accu(A % B), where A and B are sparse matrices template arma_warn_unused inline typename T1::elem_type accu(const SpGlue& expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const SpProxy px(expr.A); const SpProxy py(expr.B); arma_conform_assert_same_size(px.get_n_rows(), px.get_n_cols(), py.get_n_rows(), py.get_n_cols(), "element-wise multiplication"); if( (px.get_n_nonzero() == 0) && (py.get_n_nonzero() == 0) ) { return eT(0); } typedef typename SpProxy::stored_type px_Q_type; typedef typename SpProxy::stored_type py_Q_type; if(is_SpMat::value && is_SpMat::value) { const unwrap_spmat UX(px.Q); const unwrap_spmat UY(py.Q); const SpMat& X = UX.M; const SpMat& Y = UY.M; if(&X == &Y) { return op_dot::direct_dot(X.n_nonzero, X.values, X.values); } } typename SpProxy::const_iterator_type x_it = px.begin(); typename SpProxy::const_iterator_type x_it_end = px.end(); typename SpProxy::const_iterator_type y_it = py.begin(); typename SpProxy::const_iterator_type y_it_end = py.end(); eT acc = eT(0); while( (x_it != x_it_end) || (y_it != y_it_end) ) { if(x_it == y_it) { acc += ((*x_it) * (*y_it)); ++x_it; ++y_it; } else { const uword x_it_col = x_it.col(); const uword x_it_row = x_it.row(); const uword y_it_col = y_it.col(); const uword y_it_row = y_it.row(); if((x_it_col < y_it_col) || ((x_it_col == y_it_col) && (x_it_row < y_it_row))) // if y is closer to the end { acc += (*x_it) * eT(0); // in case (*x_it) is inf or nan ++x_it; } else // x is closer to the end { acc += eT(0) * (*y_it); // in case (*y_it) is inf or nan ++y_it; } } } return acc; } template arma_warn_unused inline typename T1::elem_type accu(const SpOp& expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; constexpr bool is_vectorise = \ (is_same_type::yes) || (is_same_type::yes) || (is_same_type::yes); if(is_vectorise) { return accu(expr.m); } const SpMat tmp = expr; return accu(tmp); } template arma_warn_unused inline typename T1::elem_type accu(const SpOp& expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; if(is_SpSubview_col::value) { const SpSubview_col& svcol = reinterpret_cast&>(expr.m); if(svcol.n_nonzero == 0) { return eT(0); } if(svcol.n_rows == svcol.m.n_rows) { arma_debug_print("accu(): SpSubview_col spop_square optimisation"); const SpMat& m = svcol.m; const uword col = svcol.aux_col1; const eT* ptr = &(m.values[ m.col_ptrs[col] ]); return op_dot::direct_dot(svcol.n_nonzero, ptr, ptr); } } const SpProxy P(expr.m); const uword N = P.get_n_nonzero(); if(N == 0) { return eT(0); } if(SpProxy::use_iterator == false) { return op_dot::direct_dot(N, P.get_values(), P.get_values()); } else { typename SpProxy::const_iterator_type it = P.begin(); eT acc = eT(0); for(uword i=0; i < N; ++i) { const eT tmp = (*it); acc += (tmp*tmp); ++it; } return acc; } } template inline typename T1::elem_type accu_spop_omit_helper(const T1& expr, functor is_omitted) { arma_debug_sigprint(); typedef typename T1::elem_type eT; constexpr eT eT_zero = eT(0); if(is_SpSubview_col::value) { const SpSubview_col& svcol = reinterpret_cast&>(expr); if(svcol.n_nonzero == 0) { return eT(0); } if(svcol.n_rows == svcol.m.n_rows) { arma_debug_print("accu_spop_omit_helper(): SpSubview_col optimisation"); const SpMat& m = svcol.m; const uword col = svcol.aux_col1; const eT* vals = &(m.values[ m.col_ptrs[col] ]); const uword N = svcol.n_nonzero; eT acc = eT(0); for(uword i=0; i < N; ++i) { const eT tmp = vals[i]; acc += is_omitted(tmp) ? eT_zero : tmp; } return acc; } } const SpProxy P(expr); const uword N = P.get_n_nonzero(); if(N == 0) { return eT(0); } eT acc = eT(0); if(SpProxy::use_iterator == false) { const eT* vals = P.get_values(); for(uword i=0; i < N; ++i) { const eT tmp = vals[i]; acc += is_omitted(tmp) ? eT_zero : tmp; } } else { typename SpProxy::const_iterator_type it = P.begin(); for(uword i=0; i < N; ++i) { const eT tmp = (*it); acc += is_omitted(tmp) ? eT_zero : tmp; ++it; } } return acc; } template arma_warn_unused inline typename T1::elem_type accu(const SpOp& expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword omit_mode = expr.aux_uword_a; if(arma_config::fast_math_warn) { if(omit_mode == 1) { arma_warn(1, "omit_nan(): detection of NaN is not reliable in fast math mode"); } if(omit_mode == 2) { arma_warn(1, "omit_nonfinite(): detection of non-finite values is not reliable in fast math mode"); } } auto is_omitted_1 = [](const eT& x) -> bool { return arma_isnan(x); }; auto is_omitted_2 = [](const eT& x) -> bool { return arma_isnonfinite(x); }; eT acc = eT(0); if(omit_mode == 1) { acc = accu_spop_omit_helper(expr.m, is_omitted_1); } if(omit_mode == 2) { acc = accu_spop_omit_helper(expr.m, is_omitted_2); } return acc; } template arma_warn_unused inline uword accu(const mtSpOp& X, const typename arma_spop_rel_only::result* junk1 = nullptr, const typename arma_not_cx::result* junk2 = nullptr) { arma_debug_sigprint(); arma_ignore(junk1); arma_ignore(junk2); typedef typename T1::elem_type eT; const eT k = X.aux; const SpProxy P(X.m); const uword n_zeros = P.get_n_elem() - P.get_n_nonzero(); const eT zero = eT(0); // shortcuts if( (is_same_type::yes) && (k == zero) ) { return n_zeros; } if( (is_same_type::yes) && (k == zero) ) { return P.get_n_nonzero(); } // take into account all implicit zeros bool use_n_zeros; if(is_same_type::yes) { use_n_zeros = (zero == k ); } else if(is_same_type::yes) { use_n_zeros = (zero != k ); } else if(is_same_type::yes) { use_n_zeros = (k < zero); } else if(is_same_type::yes) { use_n_zeros = (zero < k ); } else if(is_same_type::yes) { use_n_zeros = (k > zero); } else if(is_same_type::yes) { use_n_zeros = (zero > k ); } else if(is_same_type::yes) { use_n_zeros = (k <= zero); } else if(is_same_type::yes) { use_n_zeros = (zero <= k ); } else if(is_same_type::yes) { use_n_zeros = (k >= zero); } else if(is_same_type::yes) { use_n_zeros = (zero >= k ); } else { use_n_zeros = false; } uword count = (use_n_zeros) ? n_zeros : 0; typename SpProxy::const_iterator_type it = P.begin(); typename SpProxy::const_iterator_type it_end = P.end(); // take into account all non-zero elements for(; it != it_end; ++it) { const eT val = (*it); bool condition; if(is_same_type::yes) { condition = (val == k ); } else if(is_same_type::yes) { condition = (val != k ); } else if(is_same_type::yes) { condition = (k < val); } else if(is_same_type::yes) { condition = (val < k ); } else if(is_same_type::yes) { condition = (k > val); } else if(is_same_type::yes) { condition = (val > k ); } else if(is_same_type::yes) { condition = (k <= val); } else if(is_same_type::yes) { condition = (val <= k ); } else if(is_same_type::yes) { condition = (k >= val); } else if(is_same_type::yes) { condition = (val >= k ); } else { condition = false; } count += (condition) ? uword(1) : uword(0); } return count; } template arma_warn_unused inline uword accu(const mtSpOp& X, const typename arma_spop_rel_only::result* junk1 = nullptr, const typename arma_cx_only::result* junk2 = nullptr) { arma_debug_sigprint(); arma_ignore(junk1); arma_ignore(junk2); typedef typename T1::elem_type eT; const eT k = X.aux; const SpProxy P(X.m); const uword n_zeros = P.get_n_elem() - P.get_n_nonzero(); const eT zero = eT(0); // shortcuts if( (is_same_type::yes) && (k == zero) ) { return n_zeros; } if( (is_same_type::yes) && (k == zero) ) { return P.get_n_nonzero(); } // take into account all implicit zeros bool use_n_zeros; if(is_same_type::yes) { use_n_zeros = (zero == k); } else if(is_same_type::yes) { use_n_zeros = (zero != k); } else { use_n_zeros = false; } uword count = (use_n_zeros) ? n_zeros : 0; typename SpProxy::const_iterator_type it = P.begin(); typename SpProxy::const_iterator_type it_end = P.end(); // take into account all non-zero elements for(; it != it_end; ++it) { const eT val = (*it); bool condition; if(is_same_type::yes) { condition = (val == k); } else if(is_same_type::yes) { condition = (val != k); } else { condition = false; } count += (condition) ? uword(1) : uword(0); } return count; } //! @} RcppArmadillo/inst/include/armadillo_bits/op_cumprod_meat.hpp0000644000176200001440000000722514631567470024301 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_cumprod //! @{ template inline void op_cumprod::apply_noalias(Mat& out, const Mat& X, const uword dim) { arma_debug_sigprint(); uword n_rows = X.n_rows; uword n_cols = X.n_cols; out.set_size(n_rows,n_cols); if(out.n_elem == 0) { return; } if(dim == 0) { if(n_cols == 1) { const eT* X_mem = X.memptr(); eT* out_mem = out.memptr(); eT acc = eT(1); for(uword row=0; row < n_rows; ++row) { acc *= X_mem[row]; out_mem[row] = acc; } } else { for(uword col=0; col < n_cols; ++col) { const eT* X_colmem = X.colptr(col); eT* out_colmem = out.colptr(col); eT acc = eT(1); for(uword row=0; row < n_rows; ++row) { acc *= X_colmem[row]; out_colmem[row] = acc; } } } } else if(dim == 1) { if(n_rows == 1) { const eT* X_mem = X.memptr(); eT* out_mem = out.memptr(); eT acc = eT(1); for(uword col=0; col < n_cols; ++col) { acc *= X_mem[col]; out_mem[col] = acc; } } else { if(n_cols > 0) { arrayops::copy( out.colptr(0), X.colptr(0), n_rows ); for(uword col=1; col < n_cols; ++col) { const eT* out_colmem_prev = out.colptr(col-1); eT* out_colmem = out.colptr(col ); const eT* X_colmem = X.colptr(col ); for(uword row=0; row < n_rows; ++row) { out_colmem[row] = out_colmem_prev[row] * X_colmem[row]; } } } } } } template inline void op_cumprod::apply(Mat& out, const Op& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword dim = in.aux_uword_a; arma_conform_check( (dim > 1), "cumprod(): parameter 'dim' must be 0 or 1" ); const quasi_unwrap U(in.m); if(U.is_alias(out)) { Mat tmp; op_cumprod::apply_noalias(tmp, U.M, dim); out.steal_mem(tmp); } else { op_cumprod::apply_noalias(out, U.M, dim); } } template inline void op_cumprod_vec::apply(Mat& out, const Op& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const quasi_unwrap U(in.m); const uword dim = (T1::is_xvec) ? uword(U.M.is_rowvec() ? 1 : 0) : uword((T1::is_row) ? 1 : 0); if(U.is_alias(out)) { Mat tmp; op_cumprod::apply_noalias(tmp, U.M, dim); out.steal_mem(tmp); } else { op_cumprod::apply_noalias(out, U.M, dim); } } //! @} RcppArmadillo/inst/include/armadillo_bits/op_all_meat.hpp0000644000176200001440000002765014752446051023377 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_all //! @{ template inline bool op_all::all_vec_helper(const Base& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const Proxy P(X.get_ref()); const uword n_elem = P.get_n_elem(); uword count = 0; if(Proxy::use_at == false) { typename Proxy::ea_type Pea = P.get_ea(); for(uword i=0; i inline bool op_all::all_vec_helper(const subview& X) { arma_debug_sigprint(); const uword X_n_rows = X.n_rows; const uword X_n_cols = X.n_cols; uword count = 0; if(X_n_rows == 1) { for(uword col=0; col < X_n_cols; ++col) { count += (X.at(0,col) != eT(0)) ? uword(1) : uword(0); } } else { for(uword col=0; col < X_n_cols; ++col) { const eT* X_colmem = X.colptr(col); for(uword row=0; row < X_n_rows; ++row) { count += (X_colmem[row] != eT(0)) ? uword(1) : uword(0); } } } return (X.n_elem == count); } template inline bool op_all::all_vec_helper(const Op& X) { arma_debug_sigprint(); return op_all::all_vec_helper(X.m); } template inline bool op_all::all_vec_helper ( const mtOp& X, const typename arma_op_rel_only::result* junk1, const typename arma_not_cx::result* junk2 ) { arma_debug_sigprint(); arma_ignore(junk1); arma_ignore(junk2); typedef typename T1::elem_type eT; const eT val = X.aux; const Proxy P(X.m); const uword n_elem = P.get_n_elem(); uword count = 0; if(Proxy::use_at == false) { typename Proxy::ea_type Pea = P.get_ea(); for(uword i=0; i < n_elem; ++i) { const eT tmp = Pea[i]; if(is_same_type::yes) { count += (val < tmp) ? uword(1) : uword(0); } else if(is_same_type::yes) { count += (tmp < val) ? uword(1) : uword(0); } else if(is_same_type::yes) { count += (val > tmp) ? uword(1) : uword(0); } else if(is_same_type::yes) { count += (tmp > val) ? uword(1) : uword(0); } else if(is_same_type::yes) { count += (val <= tmp) ? uword(1) : uword(0); } else if(is_same_type::yes) { count += (tmp <= val) ? uword(1) : uword(0); } else if(is_same_type::yes) { count += (val >= tmp) ? uword(1) : uword(0); } else if(is_same_type::yes) { count += (tmp >= val) ? uword(1) : uword(0); } else if(is_same_type::yes) { count += (tmp == val) ? uword(1) : uword(0); } else if(is_same_type::yes) { count += (tmp != val) ? uword(1) : uword(0); } } } else { const uword n_rows = P.get_n_rows(); const uword n_cols = P.get_n_cols(); for(uword col=0; col < n_cols; ++col) for(uword row=0; row < n_rows; ++row) { const eT tmp = P.at(row,col); if(is_same_type::yes) { if(val < tmp) { ++count; } } else if(is_same_type::yes) { if(tmp < val) { ++count; } } else if(is_same_type::yes) { if(val > tmp) { ++count; } } else if(is_same_type::yes) { if(tmp > val) { ++count; } } else if(is_same_type::yes) { if(val <= tmp) { ++count; } } else if(is_same_type::yes) { if(tmp <= val) { ++count; } } else if(is_same_type::yes) { if(val >= tmp) { ++count; } } else if(is_same_type::yes) { if(tmp >= val) { ++count; } } else if(is_same_type::yes) { if(tmp == val) { ++count; } } else if(is_same_type::yes) { if(tmp != val) { ++count; } } } } return (n_elem == count); } template inline bool op_all::all_vec_helper ( const mtGlue& X, const typename arma_glue_rel_only::result* junk1, const typename arma_not_cx::result* junk2, const typename arma_not_cx::result* junk3 ) { arma_debug_sigprint(); arma_ignore(junk1); arma_ignore(junk2); arma_ignore(junk3); typedef typename T1::elem_type eT1; typedef typename T2::elem_type eT2; typedef typename Proxy::ea_type ea_type1; typedef typename Proxy::ea_type ea_type2; const Proxy A(X.A); const Proxy B(X.B); arma_conform_assert_same_size(A, B, "relational operator"); const uword n_elem = A.get_n_elem(); uword count = 0; constexpr bool use_at = (Proxy::use_at || Proxy::use_at); if(use_at == false) { ea_type1 PA = A.get_ea(); ea_type2 PB = B.get_ea(); for(uword i=0; i::yes) { count += (tmp1 < tmp2) ? uword(1) : uword(0); } else if(is_same_type::yes) { count += (tmp1 > tmp2) ? uword(1) : uword(0); } else if(is_same_type::yes) { count += (tmp1 <= tmp2) ? uword(1) : uword(0); } else if(is_same_type::yes) { count += (tmp1 >= tmp2) ? uword(1) : uword(0); } else if(is_same_type::yes) { count += (tmp1 == tmp2) ? uword(1) : uword(0); } else if(is_same_type::yes) { count += (tmp1 != tmp2) ? uword(1) : uword(0); } else if(is_same_type::yes) { count += (tmp1 && tmp2) ? uword(1) : uword(0); } else if(is_same_type::yes) { count += (tmp1 || tmp2) ? uword(1) : uword(0); } } } else { const uword n_rows = A.get_n_rows(); const uword n_cols = A.get_n_cols(); for(uword col=0; col < n_cols; ++col) for(uword row=0; row < n_rows; ++row) { const eT1 tmp1 = A.at(row,col); const eT2 tmp2 = B.at(row,col); if(is_same_type::yes) { if(tmp1 < tmp2) { ++count; } } else if(is_same_type::yes) { if(tmp1 > tmp2) { ++count; } } else if(is_same_type::yes) { if(tmp1 <= tmp2) { ++count; } } else if(is_same_type::yes) { if(tmp1 >= tmp2) { ++count; } } else if(is_same_type::yes) { if(tmp1 == tmp2) { ++count; } } else if(is_same_type::yes) { if(tmp1 != tmp2) { ++count; } } else if(is_same_type::yes) { if(tmp1 && tmp2) { ++count; } } else if(is_same_type::yes) { if(tmp1 || tmp2) { ++count; } } } } return (n_elem == count); } template inline bool op_all::all_vec(T1& X) { arma_debug_sigprint(); return op_all::all_vec_helper(X); } template inline void op_all::apply_mat_noalias(Mat& out, const Mat& X, const uword dim) { arma_debug_sigprint(); const uword n_rows = X.n_rows; const uword n_cols = X.n_cols; if(dim == 0) // traverse rows (ie. process each column) { out.zeros(1, n_cols); if(out.n_elem == 0) { return; } uword* out_mem = out.memptr(); for(uword col=0; col < n_cols; ++col) { const eT* colmem = X.colptr(col); uword count = 0; for(uword row=0; row < n_rows; ++row) { count += (colmem[row] != eT(0)) ? uword(1) : uword(0); } out_mem[col] = (n_rows == count) ? uword(1) : uword(0); } } else { out.zeros(n_rows, 1); uword* out_mem = out.memptr(); // internal dual use of 'out': keep the counts for each row for(uword col=0; col < n_cols; ++col) { const eT* colmem = X.colptr(col); for(uword row=0; row < n_rows; ++row) { out_mem[row] += (colmem[row] != eT(0)) ? uword(1) : uword(0); } } // see what the counts tell us for(uword row=0; row < n_rows; ++row) { out_mem[row] = (n_cols == out_mem[row]) ? uword(1) : uword(0); } } } template inline void op_all::apply_proxy_noalias(Mat& out, const Proxy& P, const uword dim) { arma_debug_sigprint(); typedef typename Proxy::elem_type eT; const uword n_rows = P.get_n_rows(); const uword n_cols = P.get_n_cols(); if(dim == 0) // traverse rows (ie. process each column) { out.zeros(1, n_cols); if(out.n_elem == 0) { return; } uword* out_mem = out.memptr(); for(uword col=0; col < n_cols; ++col) { uword count = 0; for(uword row=0; row < n_rows; ++row) { if(P.at(row,col) != eT(0)) { ++count; } } out_mem[col] = (n_rows == count) ? uword(1) : uword(0); } } else { out.zeros(n_rows, 1); uword* out_mem = out.memptr(); // internal dual use of 'out': keep the counts for each row for(uword col=0; col < n_cols; ++col) for(uword row=0; row < n_rows; ++row) { if(P.at(row,col) != eT(0)) { ++out_mem[row]; } } // see what the counts tell us for(uword row=0; row < n_rows; ++row) { out_mem[row] = (n_cols == out_mem[row]) ? uword(1) : uword(0); } } } template inline void op_all::apply(Mat& out, const mtOp& X) { arma_debug_sigprint(); const uword dim = X.aux_uword_a; if( (is_Mat::value) || (is_Mat::stored_type>::value) || (arma_config::openmp && Proxy::use_mp) ) { const quasi_unwrap U(X.m); if(U.is_alias(out) == false) { op_all::apply_mat_noalias(out, U.M, dim); } else { Mat tmp; op_all::apply_mat_noalias(tmp, U.M, dim); out.steal_mem(tmp); } } else { const Proxy P(X.m); if(P.is_alias(out) == false) { op_all::apply_proxy_noalias(out, P, dim); } else { Mat tmp; op_all::apply_proxy_noalias(tmp, P, dim); out.steal_mem(tmp); } } } //! @} RcppArmadillo/inst/include/armadillo_bits/op_dot_bones.hpp0000644000176200001440000000704714632077314023572 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_dot //! @{ //! \brief //! dot product operation class op_dot : public traits_op_default { public: template arma_inline static typename arma_not_cx::result direct_dot_arma(const uword n_elem, const eT* const A, const eT* const B); template arma_hot inline static typename arma_cx_only::result direct_dot_arma(const uword n_elem, const eT* const A, const eT* const B); template arma_hot inline static typename arma_real_only::result direct_dot(const uword n_elem, const eT* const A, const eT* const B); template arma_hot inline static typename arma_cx_only::result direct_dot(const uword n_elem, const eT* const A, const eT* const B); template arma_hot inline static typename arma_integral_only::result direct_dot(const uword n_elem, const eT* const A, const eT* const B); template arma_hot inline static eT direct_dot(const uword n_elem, const eT* const A, const eT* const B, const eT* C); template arma_hot inline static typename T1::elem_type apply(const T1& X, const T2& Y); template arma_hot inline static typename arma_not_cx::result apply_proxy_linear(const Proxy& PA, const Proxy& PB); template arma_hot inline static typename arma_cx_only::result apply_proxy_linear(const Proxy& PA, const Proxy& PB); }; //! \brief //! normalised dot product operation class op_norm_dot : public traits_op_default { public: template arma_hot inline static typename T1::elem_type apply(const T1& X, const T2& Y); }; //! \brief //! complex conjugate dot product operation class op_cdot : public traits_op_default { public: template arma_hot inline static eT direct_cdot_arma(const uword n_elem, const eT* const A, const eT* const B); template arma_hot inline static eT direct_cdot(const uword n_elem, const eT* const A, const eT* const B); template arma_hot inline static typename T1::elem_type apply (const T1& X, const T2& Y); template arma_hot inline static typename T1::elem_type apply_unwrap(const T1& X, const T2& Y); template arma_hot inline static typename T1::elem_type apply_proxy (const T1& X, const T2& Y); }; class op_dot_mixed : public traits_op_default { public: template arma_hot inline static typename promote_type::result apply(const T1& A, const T2& B); }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_normalise_bones.hpp0000644000176200001440000000251414301267043024760 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_normalise //! @{ class op_normalise_vec : public traits_op_passthru { public: template inline static void apply(Mat& out, const Op& in); }; class op_normalise_mat : public traits_op_default { public: template inline static void apply(Mat& out, const Op& in); template inline static void apply(Mat& out, const Mat& A, const uword p, const uword dim); }; //! @} RcppArmadillo/inst/include/armadillo_bits/fn_trapz.hpp0000644000176200001440000000266114631567470022746 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_trapz //! @{ template arma_warn_unused inline const Glue trapz ( const Base& X, const Base& Y, const uword dim = 0 ) { arma_debug_sigprint(); return Glue(X.get_ref(), Y.get_ref(), dim); } template arma_warn_unused inline const Op trapz ( const Base& Y, const uword dim = 0 ) { arma_debug_sigprint(); return Op(Y.get_ref(), dim, uword(0)); } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_intersect.hpp0000644000176200001440000000314414631567470023603 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_intersect //! @{ template arma_warn_unused inline typename enable_if2 < ( is_arma_type::value && is_arma_type::value && is_same_type::value ), const Glue >::result intersect ( const T1& A, const T2& B ) { arma_debug_sigprint(); return Glue(A, B); } template inline void intersect ( Mat& C, uvec& iA, uvec& iB, const Base& A, const Base& B ) { arma_debug_sigprint(); glue_intersect::apply(C, iA, iB, A.get_ref(), B.get_ref(), true); } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_inplace_strans.hpp0000644000176200001440000000511514631567470024610 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_inplace_strans //! @{ template inline void inplace_strans ( Mat& X, const char* method = "std" ) { arma_debug_sigprint(); const char sig = (method != nullptr) ? method[0] : char(0); arma_conform_check( ((sig != 's') && (sig != 'l')), "inplace_strans(): unknown method specified" ); const bool low_memory = (sig == 'l'); if( (low_memory == false) || (X.n_rows == X.n_cols) ) { op_strans::apply_mat_inplace(X); } else { // in-place algorithm inspired by: // Fred G. Gustavson, Tadeusz Swirszcz. // In-Place Transposition of Rectangular Matrices. // Applied Parallel Computing. State of the Art in Scientific Computing. // Lecture Notes in Computer Science. Volume 4699, pp. 560-569, 2007. // X.set_size() will check whether we can change the dimensions of X; // X.set_size() will also reuse existing memory, as the number of elements hasn't changed X.set_size(X.n_cols, X.n_rows); const uword m = X.n_cols; const uword n = X.n_rows; std::vector visited(X.n_elem); // TODO: replace std::vector with a better implementation for(uword col = 0; col < m; ++col) for(uword row = 0; row < n; ++row) { const uword pos = col*n + row; if(visited[pos] == false) { uword curr_pos = pos; eT val = X.at(row, col); while(visited[curr_pos] == false) { visited[curr_pos] = true; const uword j = curr_pos / m; const uword i = curr_pos - m * j; const eT tmp = X.at(j, i); X.at(j, i) = val; val = tmp; curr_pos = i*n + j; } } } } } //! @} RcppArmadillo/inst/include/armadillo_bits/subview_cube_each_meat.hpp0000644000176200001440000005416214634016465025572 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup subview_cube_each //! @{ // // // subview_cube_each_common template inline subview_cube_each_common::subview_cube_each_common(const Cube& in_p) : P(in_p) { arma_debug_sigprint(); } template template inline void subview_cube_each_common::check_size(const Mat& A) const { if(arma_config::check_conform) { if( (A.n_rows != P.n_rows) || (A.n_cols != P.n_cols) ) { arma_stop_logic_error( incompat_size_string(A) ); } } } template template inline const std::string subview_cube_each_common::incompat_size_string(const Mat& A) const { std::ostringstream tmp; tmp << "each_slice(): incompatible size; expected " << P.n_rows << 'x' << P.n_cols << ", got " << A.n_rows << 'x' << A.n_cols; return tmp.str(); } // // // subview_cube_each1 template inline subview_cube_each1::~subview_cube_each1() { arma_debug_sigprint(); } template inline subview_cube_each1::subview_cube_each1(const Cube& in_p) : subview_cube_each_common::subview_cube_each_common(in_p) { arma_debug_sigprint(); } template template inline void subview_cube_each1::operator= (const Base& in) { arma_debug_sigprint(); Cube& p = access::rw(subview_cube_each_common::P); const unwrap tmp( in.get_ref() ); const Mat& A = tmp.M; subview_cube_each_common::check_size(A); const uword p_n_slices = p.n_slices; const uword p_n_elem_slice = p.n_elem_slice; const eT* A_mem = A.memptr(); for(uword i=0; i < p_n_slices; ++i) { arrayops::copy( p.slice_memptr(i), A_mem, p_n_elem_slice ); } } template template inline void subview_cube_each1::operator+= (const Base& in) { arma_debug_sigprint(); Cube& p = access::rw(subview_cube_each_common::P); const unwrap tmp( in.get_ref() ); const Mat& A = tmp.M; subview_cube_each_common::check_size(A); const uword p_n_slices = p.n_slices; const uword p_n_elem_slice = p.n_elem_slice; const eT* A_mem = A.memptr(); for(uword i=0; i < p_n_slices; ++i) { arrayops::inplace_plus( p.slice_memptr(i), A_mem, p_n_elem_slice ); } } template template inline void subview_cube_each1::operator-= (const Base& in) { arma_debug_sigprint(); Cube& p = access::rw(subview_cube_each_common::P); const unwrap tmp( in.get_ref() ); const Mat& A = tmp.M; subview_cube_each_common::check_size(A); const uword p_n_slices = p.n_slices; const uword p_n_elem_slice = p.n_elem_slice; const eT* A_mem = A.memptr(); for(uword i=0; i < p_n_slices; ++i) { arrayops::inplace_minus( p.slice_memptr(i), A_mem, p_n_elem_slice ); } } template template inline void subview_cube_each1::operator%= (const Base& in) { arma_debug_sigprint(); Cube& p = access::rw(subview_cube_each_common::P); const unwrap tmp( in.get_ref() ); const Mat& A = tmp.M; subview_cube_each_common::check_size(A); const uword p_n_slices = p.n_slices; const uword p_n_elem_slice = p.n_elem_slice; const eT* A_mem = A.memptr(); for(uword i=0; i < p_n_slices; ++i) { arrayops::inplace_mul( p.slice_memptr(i), A_mem, p_n_elem_slice ); } } template template inline void subview_cube_each1::operator/= (const Base& in) { arma_debug_sigprint(); Cube& p = access::rw(subview_cube_each_common::P); const unwrap tmp( in.get_ref() ); const Mat& A = tmp.M; subview_cube_each_common::check_size(A); const uword p_n_slices = p.n_slices; const uword p_n_elem_slice = p.n_elem_slice; const eT* A_mem = A.memptr(); for(uword i=0; i < p_n_slices; ++i) { arrayops::inplace_div( p.slice_memptr(i), A_mem, p_n_elem_slice ); } } template template inline void subview_cube_each1::operator*= (const Base& in) { arma_debug_sigprint(); Cube& C = access::rw(subview_cube_each_common::P); C = C.each_slice() * in.get_ref(); } // // // subview_cube_each2 template inline subview_cube_each2::~subview_cube_each2() { arma_debug_sigprint(); } template inline subview_cube_each2::subview_cube_each2(const Cube& in_p, const Base& in_indices) : subview_cube_each_common::subview_cube_each_common(in_p) , base_indices(in_indices) { arma_debug_sigprint(); } template inline void subview_cube_each2::check_indices(const Mat& indices) const { arma_conform_check( ((indices.is_vec() == false) && (indices.is_empty() == false)), "each_slice(): list of indices must be a vector" ); } template template inline void subview_cube_each2::operator= (const Base& in) { arma_debug_sigprint(); Cube& p = access::rw(subview_cube_each_common::P); const unwrap tmp( in.get_ref() ); const Mat& A = tmp.M; subview_cube_each_common::check_size(A); const unwrap U( base_indices.get_ref() ); check_indices(U.M); const uword p_n_slices = p.n_slices; const uword p_n_elem_slice = p.n_elem_slice; const uword* indices_mem = U.M.memptr(); const uword N = U.M.n_elem; const eT* A_mem = A.memptr(); for(uword i=0; i < N; ++i) { const uword slice = indices_mem[i]; arma_conform_check_bounds( (slice >= p_n_slices), "each_slice(): index out of bounds" ); arrayops::copy(p.slice_memptr(slice), A_mem, p_n_elem_slice); } } template template inline void subview_cube_each2::operator+= (const Base& in) { arma_debug_sigprint(); Cube& p = access::rw(subview_cube_each_common::P); const unwrap tmp( in.get_ref() ); const Mat& A = tmp.M; subview_cube_each_common::check_size(A); const unwrap U( base_indices.get_ref() ); check_indices(U.M); const uword p_n_slices = p.n_slices; const uword p_n_elem_slice = p.n_elem_slice; const uword* indices_mem = U.M.memptr(); const uword N = U.M.n_elem; const eT* A_mem = A.memptr(); for(uword i=0; i < N; ++i) { const uword slice = indices_mem[i]; arma_conform_check_bounds( (slice >= p_n_slices), "each_slice(): index out of bounds" ); arrayops::inplace_plus(p.slice_memptr(slice), A_mem, p_n_elem_slice); } } template template inline void subview_cube_each2::operator-= (const Base& in) { arma_debug_sigprint(); Cube& p = access::rw(subview_cube_each_common::P); const unwrap tmp( in.get_ref() ); const Mat& A = tmp.M; subview_cube_each_common::check_size(A); const unwrap U( base_indices.get_ref() ); check_indices(U.M); const uword p_n_slices = p.n_slices; const uword p_n_elem_slice = p.n_elem_slice; const uword* indices_mem = U.M.memptr(); const uword N = U.M.n_elem; const eT* A_mem = A.memptr(); for(uword i=0; i < N; ++i) { const uword slice = indices_mem[i]; arma_conform_check_bounds( (slice >= p_n_slices), "each_slice(): index out of bounds" ); arrayops::inplace_minus(p.slice_memptr(slice), A_mem, p_n_elem_slice); } } template template inline void subview_cube_each2::operator%= (const Base& in) { arma_debug_sigprint(); Cube& p = access::rw(subview_cube_each_common::P); const unwrap tmp( in.get_ref() ); const Mat& A = tmp.M; subview_cube_each_common::check_size(A); const unwrap U( base_indices.get_ref() ); check_indices(U.M); const uword p_n_slices = p.n_slices; const uword p_n_elem_slice = p.n_elem_slice; const uword* indices_mem = U.M.memptr(); const uword N = U.M.n_elem; const eT* A_mem = A.memptr(); for(uword i=0; i < N; ++i) { const uword slice = indices_mem[i]; arma_conform_check_bounds( (slice >= p_n_slices), "each_slice(): index out of bounds" ); arrayops::inplace_mul(p.slice_memptr(slice), A_mem, p_n_elem_slice); } } template template inline void subview_cube_each2::operator/= (const Base& in) { arma_debug_sigprint(); Cube& p = access::rw(subview_cube_each_common::P); const unwrap tmp( in.get_ref() ); const Mat& A = tmp.M; subview_cube_each_common::check_size(A); const unwrap U( base_indices.get_ref() ); check_indices(U.M); const uword p_n_slices = p.n_slices; const uword p_n_elem_slice = p.n_elem_slice; const uword* indices_mem = U.M.memptr(); const uword N = U.M.n_elem; const eT* A_mem = A.memptr(); for(uword i=0; i < N; ++i) { const uword slice = indices_mem[i]; arma_conform_check_bounds( (slice >= p_n_slices), "each_slice(): index out of bounds" ); arrayops::inplace_div(p.slice_memptr(slice), A_mem, p_n_elem_slice); } } // // // subview_cube_each1_aux template inline Cube subview_cube_each1_aux::operator_plus ( const subview_cube_each1& X, const Base& Y ) { arma_debug_sigprint(); const Cube& p = X.P; const uword p_n_rows = p.n_rows; const uword p_n_cols = p.n_cols; const uword p_n_slices = p.n_slices; Cube out(p_n_rows, p_n_cols, p_n_slices, arma_nozeros_indicator()); const unwrap tmp(Y.get_ref()); const Mat& A = tmp.M; X.check_size(A); for(uword i=0; i < p_n_slices; ++i) { Mat out_slice( out.slice_memptr(i), p_n_rows, p_n_cols, false, true); const Mat p_slice(const_cast(p.slice_memptr(i)), p_n_rows, p_n_cols, false, true); out_slice = p_slice + A; } return out; } template inline Cube subview_cube_each1_aux::operator_minus ( const subview_cube_each1& X, const Base& Y ) { arma_debug_sigprint(); const Cube& p = X.P; const uword p_n_rows = p.n_rows; const uword p_n_cols = p.n_cols; const uword p_n_slices = p.n_slices; Cube out(p_n_rows, p_n_cols, p_n_slices, arma_nozeros_indicator()); const unwrap tmp(Y.get_ref()); const Mat& A = tmp.M; X.check_size(A); for(uword i=0; i < p_n_slices; ++i) { Mat out_slice( out.slice_memptr(i), p_n_rows, p_n_cols, false, true); const Mat p_slice(const_cast(p.slice_memptr(i)), p_n_rows, p_n_cols, false, true); out_slice = p_slice - A; } return out; } template inline Cube subview_cube_each1_aux::operator_minus ( const Base& X, const subview_cube_each1& Y ) { arma_debug_sigprint(); const Cube& p = Y.P; const uword p_n_rows = p.n_rows; const uword p_n_cols = p.n_cols; const uword p_n_slices = p.n_slices; Cube out(p_n_rows, p_n_cols, p_n_slices, arma_nozeros_indicator()); const unwrap tmp(X.get_ref()); const Mat& A = tmp.M; Y.check_size(A); for(uword i=0; i < p_n_slices; ++i) { Mat out_slice( out.slice_memptr(i), p_n_rows, p_n_cols, false, true); const Mat p_slice(const_cast(p.slice_memptr(i)), p_n_rows, p_n_cols, false, true); out_slice = A - p_slice; } return out; } template inline Cube subview_cube_each1_aux::operator_schur ( const subview_cube_each1& X, const Base& Y ) { arma_debug_sigprint(); const Cube& p = X.P; const uword p_n_rows = p.n_rows; const uword p_n_cols = p.n_cols; const uword p_n_slices = p.n_slices; Cube out(p_n_rows, p_n_cols, p_n_slices, arma_nozeros_indicator()); const unwrap tmp(Y.get_ref()); const Mat& A = tmp.M; X.check_size(A); for(uword i=0; i < p_n_slices; ++i) { Mat out_slice( out.slice_memptr(i), p_n_rows, p_n_cols, false, true); const Mat p_slice(const_cast(p.slice_memptr(i)), p_n_rows, p_n_cols, false, true); out_slice = p_slice % A; } return out; } template inline Cube subview_cube_each1_aux::operator_div ( const subview_cube_each1& X, const Base& Y ) { arma_debug_sigprint(); const Cube& p = X.P; const uword p_n_rows = p.n_rows; const uword p_n_cols = p.n_cols; const uword p_n_slices = p.n_slices; Cube out(p_n_rows, p_n_cols, p_n_slices, arma_nozeros_indicator()); const unwrap tmp(Y.get_ref()); const Mat& A = tmp.M; X.check_size(A); for(uword i=0; i < p_n_slices; ++i) { Mat out_slice( out.slice_memptr(i), p_n_rows, p_n_cols, false, true); const Mat p_slice(const_cast(p.slice_memptr(i)), p_n_rows, p_n_cols, false, true); out_slice = p_slice / A; } return out; } template inline Cube subview_cube_each1_aux::operator_div ( const Base& X, const subview_cube_each1& Y ) { arma_debug_sigprint(); const Cube& p = Y.P; const uword p_n_rows = p.n_rows; const uword p_n_cols = p.n_cols; const uword p_n_slices = p.n_slices; Cube out(p_n_rows, p_n_cols, p_n_slices, arma_nozeros_indicator()); const unwrap tmp(X.get_ref()); const Mat& A = tmp.M; Y.check_size(A); for(uword i=0; i < p_n_slices; ++i) { Mat out_slice( out.slice_memptr(i), p_n_rows, p_n_cols, false, true); const Mat p_slice(const_cast(p.slice_memptr(i)), p_n_rows, p_n_cols, false, true); out_slice = A / p_slice; } return out; } template inline Cube subview_cube_each1_aux::operator_times ( const subview_cube_each1& X, const Base& Y ) { arma_debug_sigprint(); const Cube& C = X.P; const unwrap tmp(Y.get_ref()); const Mat& M = tmp.M; Cube out(C.n_rows, M.n_cols, C.n_slices, arma_nozeros_indicator()); for(uword i=0; i < C.n_slices; ++i) { Mat out_slice( out.slice_memptr(i), C.n_rows, M.n_cols, false, true); const Mat C_slice(const_cast(C.slice_memptr(i)), C.n_rows, C.n_cols, false, true); out_slice = C_slice * M; } return out; } template inline Cube subview_cube_each1_aux::operator_times ( const Base& X, const subview_cube_each1& Y ) { arma_debug_sigprint(); const unwrap tmp(X.get_ref()); const Mat& M = tmp.M; const Cube& C = Y.P; Cube out(M.n_rows, C.n_cols, C.n_slices, arma_nozeros_indicator()); for(uword i=0; i < C.n_slices; ++i) { Mat out_slice( out.slice_memptr(i), M.n_rows, C.n_cols, false, true); const Mat C_slice(const_cast(C.slice_memptr(i)), C.n_rows, C.n_cols, false, true); out_slice = M * C_slice; } return out; } // // // subview_cube_each2_aux template inline Cube subview_cube_each2_aux::operator_plus ( const subview_cube_each2& X, const Base& Y ) { arma_debug_sigprint(); const Cube& p = X.P; const uword p_n_slices = p.n_slices; const uword p_n_elem_slice = p.n_elem_slice; Cube out = p; const unwrap tmp(Y.get_ref()); const Mat& A = tmp.M; const unwrap U(X.base_indices.get_ref()); X.check_size(A); X.check_indices(U.M); const uword* indices_mem = U.M.memptr(); const uword N = U.M.n_elem; const eT* A_mem = A.memptr(); for(uword i=0; i < N; ++i) { const uword slice = indices_mem[i]; arma_conform_check_bounds( (slice >= p_n_slices), "each_slice(): index out of bounds" ); arrayops::inplace_plus(out.slice_memptr(slice), A_mem, p_n_elem_slice); } return out; } template inline Cube subview_cube_each2_aux::operator_minus ( const subview_cube_each2& X, const Base& Y ) { arma_debug_sigprint(); const Cube& p = X.P; const uword p_n_slices = p.n_slices; const uword p_n_elem_slice = p.n_elem_slice; Cube out = p; const unwrap tmp(Y.get_ref()); const Mat& A = tmp.M; const unwrap U(X.base_indices.get_ref()); X.check_size(A); X.check_indices(U.M); const uword* indices_mem = U.M.memptr(); const uword N = U.M.n_elem; const eT* A_mem = A.memptr(); for(uword i=0; i < N; ++i) { const uword slice = indices_mem[i]; arma_conform_check_bounds( (slice >= p_n_slices), "each_slice(): index out of bounds" ); arrayops::inplace_minus(out.slice_memptr(slice), A_mem, p_n_elem_slice); } return out; } template inline Cube subview_cube_each2_aux::operator_minus ( const Base& X, const subview_cube_each2& Y ) { arma_debug_sigprint(); const Cube& p = Y.P; const uword p_n_rows = p.n_rows; const uword p_n_cols = p.n_cols; const uword p_n_slices = p.n_slices; Cube out = p; const unwrap tmp(X.get_ref()); const Mat& A = tmp.M; const unwrap U(Y.base_indices.get_ref()); Y.check_size(A); Y.check_indices(U.M); const uword* indices_mem = U.M.memptr(); const uword N = U.M.n_elem; for(uword i=0; i < N; ++i) { const uword slice = indices_mem[i]; arma_conform_check_bounds( (slice >= p_n_slices), "each_slice(): index out of bounds" ); Mat out_slice( out.slice_memptr(slice), p_n_rows, p_n_cols, false, true); const Mat p_slice(const_cast(p.slice_memptr(slice)), p_n_rows, p_n_cols, false, true); out_slice = A - p_slice; } return out; } template inline Cube subview_cube_each2_aux::operator_schur ( const subview_cube_each2& X, const Base& Y ) { arma_debug_sigprint(); const Cube& p = X.P; const uword p_n_slices = p.n_slices; const uword p_n_elem_slice = p.n_elem_slice; Cube out = p; const unwrap tmp(Y.get_ref()); const Mat& A = tmp.M; const unwrap U(X.base_indices.get_ref()); X.check_size(A); X.check_indices(U.M); const uword* indices_mem = U.M.memptr(); const uword N = U.M.n_elem; const eT* A_mem = A.memptr(); for(uword i=0; i < N; ++i) { const uword slice = indices_mem[i]; arma_conform_check_bounds( (slice >= p_n_slices), "each_slice(): index out of bounds" ); arrayops::inplace_mul(out.slice_memptr(slice), A_mem, p_n_elem_slice); } return out; } template inline Cube subview_cube_each2_aux::operator_div ( const subview_cube_each2& X, const Base& Y ) { arma_debug_sigprint(); const Cube& p = X.P; const uword p_n_slices = p.n_slices; const uword p_n_elem_slice = p.n_elem_slice; Cube out = p; const unwrap tmp(Y.get_ref()); const Mat& A = tmp.M; const unwrap U(X.base_indices.get_ref()); X.check_size(A); X.check_indices(U.M); const uword* indices_mem = U.M.memptr(); const uword N = U.M.n_elem; const eT* A_mem = A.memptr(); for(uword i=0; i < N; ++i) { const uword slice = indices_mem[i]; arma_conform_check_bounds( (slice >= p_n_slices), "each_slice(): index out of bounds" ); arrayops::inplace_div(out.slice_memptr(slice), A_mem, p_n_elem_slice); } return out; } template inline Cube subview_cube_each2_aux::operator_div ( const Base& X, const subview_cube_each2& Y ) { arma_debug_sigprint(); const Cube& p = Y.P; const uword p_n_rows = p.n_rows; const uword p_n_cols = p.n_cols; const uword p_n_slices = p.n_slices; Cube out = p; const unwrap tmp(X.get_ref()); const Mat& A = tmp.M; const unwrap U(Y.base_indices.get_ref()); Y.check_size(A); Y.check_indices(U.M); const uword* indices_mem = U.M.memptr(); const uword N = U.M.n_elem; for(uword i=0; i < N; ++i) { const uword slice = indices_mem[i]; arma_conform_check_bounds( (slice >= p_n_slices), "each_slice(): index out of bounds" ); Mat out_slice( out.slice_memptr(slice), p_n_rows, p_n_cols, false, true); const Mat p_slice(const_cast(p.slice_memptr(slice)), p_n_rows, p_n_cols, false, true); out_slice = A / p_slice; } return out; } //! @} RcppArmadillo/inst/include/armadillo_bits/config.hpp0000644000176200001440000003254615002153114022350 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ #if !defined(ARMA_WARN_LEVEL) #define ARMA_WARN_LEVEL 2 #endif //// The level of warning messages printed to ARMA_CERR_STREAM. //// Must be an integer >= 0. The default value is 2. //// 0 = no warnings; generally not recommended //// 1 = only critical warnings about arguments and/or data which are likely to lead to incorrect results //// 2 = as per level 1, and warnings about poorly conditioned systems (low rcond) detected by solve(), spsolve(), etc //// 3 = as per level 2, and warnings about failed decompositions, failed saving/loading, etc // #define ARMA_USE_WRAPPER //// Comment out the above line if you prefer to directly link with BLAS, LAPACK, etc //// instead of the Armadillo runtime library. //// You will need to link your programs directly with -lopenblas -llapack instead of -larmadillo #if !defined(ARMA_USE_LAPACK) #define ARMA_USE_LAPACK //// Comment out the above line if you don't have LAPACK or a high-speed replacement for LAPACK, //// such as OpenBLAS, Intel MKL, or the Accelerate framework. //// LAPACK is required for matrix decompositions (eg. SVD) and matrix inverse. #endif #if !defined(ARMA_USE_BLAS) #define ARMA_USE_BLAS //// Comment out the above line if you don't have BLAS or a high-speed replacement for BLAS, //// such as OpenBLAS, Intel MKL, or the Accelerate framework. //// BLAS is used for matrix multiplication. //// Without BLAS, matrix multiplication will still work, but might be slower. #endif #if !defined(ARMA_USE_NEWARP) #define ARMA_USE_NEWARP //// Uncomment the above line to enable the built-in partial emulation of ARPACK. //// This is used for eigen decompositions of real (non-complex) sparse matrices, eg. eigs_sym(), svds() #endif #if !defined(ARMA_USE_ARPACK) // #define ARMA_USE_ARPACK //// Uncomment the above line if you have ARPACK or a high-speed replacement for ARPACK. //// ARPACK is required for eigen decompositions of complex sparse matrices #endif #if !defined(ARMA_USE_SUPERLU) // #define ARMA_USE_SUPERLU //// Uncomment the above line if you have SuperLU. //// SuperLU is used for solving sparse linear systems via spsolve() //// Caveat: only SuperLU version 5.2 can be used! #endif #if !defined(ARMA_SUPERLU_INCLUDE_DIR) // #define ARMA_SUPERLU_INCLUDE_DIR /usr/include/ //// If you're using SuperLU and want to explicitly include the SuperLU headers, //// uncomment the above define and specify the appropriate include directory. //// Make sure the directory has a trailing / #endif #if !defined(ARMA_USE_ATLAS) // #define ARMA_USE_ATLAS //// NOTE: support for ATLAS is deprecated and will be removed. #endif #if !defined(ARMA_USE_HDF5) // #define ARMA_USE_HDF5 //// Uncomment the above line to allow the ability to save and load matrices stored in HDF5 format; //// the hdf5.h header file must be available on your system, //// and you will need to link with the hdf5 library (eg. -lhdf5) #endif #if !defined(ARMA_USE_FFTW3) // #define ARMA_USE_FFTW3 //// Uncomment the above line to allow the use of the FFTW3 library by fft() and ifft() functions; //// you will need to link with the FFTW3 library (eg. -lfftw3) #endif #if defined(ARMA_USE_FFTW) #error "use ARMA_USE_FFTW3 instead of ARMA_USE_FFTW" #endif // #define ARMA_BLAS_CAPITALS //// Uncomment the above line if your BLAS and LAPACK libraries have capitalised function names #define ARMA_BLAS_UNDERSCORE //// Uncomment the above line if your BLAS and LAPACK libraries have function names with a trailing underscore. //// Conversely, comment it out if the function names don't have a trailing underscore. // #define ARMA_BLAS_LONG_LONG //// Uncomment the above line if your BLAS and LAPACK libraries use 64 bit integers, ie. "long long" instead of "int" // #define ARMA_BLAS_NOEXCEPT //// Uncomment the above line if you require BLAS functions to have the 'noexcept' specification // #define ARMA_LAPACK_NOEXCEPT //// Uncomment the above line if you require LAPACK functions to have the 'noexcept' specification #define ARMA_USE_FORTRAN_HIDDEN_ARGS //// Comment out the above line to call BLAS and LAPACK functions without using so-called "hidden" arguments. //// Fortran functions (compiled without a BIND(C) declaration) that have char arguments //// (like many BLAS and LAPACK functions) also have associated "hidden" arguments. //// For each char argument, the corresponding "hidden" argument specifies the number of characters. //// These "hidden" arguments are typically tacked onto the end of function definitions. // #define ARMA_USE_TBB_ALLOC //// Uncomment the above line to use Intel TBB scalable_malloc() and scalable_free() instead of standard malloc() and free() // #define ARMA_USE_MKL_ALLOC //// Uncomment the above line to use Intel MKL mkl_malloc() and mkl_free() instead of standard malloc() and free() // #define ARMA_USE_MKL_TYPES //// Uncomment the above line to use Intel MKL types for complex numbers. //// You will need to include appropriate MKL headers before the Armadillo header. //// You may also need to enable or disable the following options: //// ARMA_BLAS_LONG_LONG, ARMA_USE_FORTRAN_HIDDEN_ARGS #if !defined(ARMA_USE_OPENMP) // #define ARMA_USE_OPENMP //// Uncomment the above line to forcefully enable use of OpenMP for parallelisation. //// Note that ARMA_USE_OPENMP is automatically enabled when a compiler supporting OpenMP 3.1 is detected. #endif #if !defined(ARMA_USE_STD_MUTEX) #define ARMA_USE_STD_MUTEX //// Comment out the above line to disable use of std::mutex #endif #if !defined(ARMA_64BIT_WORD) // #define ARMA_64BIT_WORD //// Uncomment the above line if you require matrices/vectors capable of holding more than 4 billion elements. //// Note that ARMA_64BIT_WORD is automatically enabled when std::size_t has 64 bits and ARMA_32BIT_WORD is not defined. #endif #if !defined(ARMA_OPTIMISE_BAND) #define ARMA_OPTIMISE_BAND //// Comment out the above line to disable optimised handling //// of band matrices by solve() and chol() #endif #if !defined(ARMA_OPTIMISE_SYM) #define ARMA_OPTIMISE_SYM //// Comment out the above line to disable optimised handling //// of symmetric/hermitian matrices by various functions: //// solve(), inv(), pinv(), expmat(), logmat(), sqrtmat(), rcond(), rank() #endif #if !defined(ARMA_OPTIMISE_INVEXPR) #define ARMA_OPTIMISE_INVEXPR //// Comment out the above line to disable optimised handling //// of inv() and inv_sympd() within compound expressions #endif #if !defined(ARMA_CHECK_CONFORMANCE) #define ARMA_CHECK_CONFORMANCE //// Comment out the above line to disable conformance checks for bounds and size. //// This is NOT RECOMMENDED. //// It is strongly recommended that conformance checks are enabled during development, //// as this greatly aids in finding mistakes in your code. #endif #if !defined(ARMA_CHECK_NONFINITE) #define ARMA_CHECK_NONFINITE //// Comment out the above line to disable checking for nonfinite matrices #endif #if !defined(ARMA_MAT_PREALLOC) #define ARMA_MAT_PREALLOC 16 #endif //// This is the number of preallocated elements used by matrices and vectors; //// it must be an integer that is at least 1. //// If you mainly use lots of very small vectors (eg. <= 4 elements), //// change the number to the size of your vectors. #if !defined(ARMA_OPENMP_THRESHOLD) #define ARMA_OPENMP_THRESHOLD 320 #endif //// The minimum number of elements in a matrix to allow OpenMP based parallelisation; //// it must be an integer that is at least 1. #if !defined(ARMA_OPENMP_THREADS) #define ARMA_OPENMP_THREADS 8 #endif //// The maximum number of threads to use for OpenMP based parallelisation; //// it must be an integer that is at least 1. // #define ARMA_DEBUG //// Uncomment the above line to see the function traces of how Armadillo evaluates expressions. //// This is mainly useful for debugging of the library. #if defined(ARMA_EXTRA_DEBUG) // for compatibility with earlier versions of Armadillo #undef ARMA_DEBUG #define ARMA_DEBUG #endif #if defined(ARMA_DEFAULT_OSTREAM) #pragma message ("WARNING: support for ARMA_DEFAULT_OSTREAM is deprecated and will be removed;") #pragma message ("WARNING: use ARMA_COUT_STREAM and ARMA_CERR_STREAM instead") #endif #if !defined(ARMA_COUT_STREAM) #if defined(ARMA_DEFAULT_OSTREAM) // for compatibility with earlier versions of Armadillo #define ARMA_COUT_STREAM ARMA_DEFAULT_OSTREAM #else #define ARMA_COUT_STREAM std::cout #endif #endif #if !defined(ARMA_CERR_STREAM) #if defined(ARMA_DEFAULT_OSTREAM) // for compatibility with earlier versions of Armadillo #define ARMA_CERR_STREAM ARMA_DEFAULT_OSTREAM #else #define ARMA_CERR_STREAM std::cerr #endif #endif #if !defined(ARMA_PRINT_EXCEPTIONS) // #define ARMA_PRINT_EXCEPTIONS #if defined(ARMA_PRINT_EXCEPTIONS_INTERNAL) #undef ARMA_PRINT_EXCEPTIONS #define ARMA_PRINT_EXCEPTIONS #endif #endif #if defined(ARMA_DONT_USE_LAPACK) #undef ARMA_USE_LAPACK #endif #if defined(ARMA_DONT_USE_BLAS) #undef ARMA_USE_BLAS #endif #if defined(ARMA_DONT_USE_NEWARP) || !defined(ARMA_USE_LAPACK) #undef ARMA_USE_NEWARP #endif #if defined(ARMA_DONT_USE_ARPACK) #undef ARMA_USE_ARPACK #endif #if defined(ARMA_DONT_USE_SUPERLU) #undef ARMA_USE_SUPERLU #undef ARMA_SUPERLU_INCLUDE_DIR #endif #if defined(ARMA_DONT_USE_ATLAS) #undef ARMA_USE_ATLAS #endif #if defined(ARMA_DONT_USE_HDF5) #undef ARMA_USE_HDF5 #endif #if defined(ARMA_DONT_USE_FFTW3) #undef ARMA_USE_FFTW3 #endif #if defined(ARMA_DONT_USE_WRAPPER) #undef ARMA_USE_WRAPPER #endif #if defined(ARMA_DONT_USE_FORTRAN_HIDDEN_ARGS) #undef ARMA_USE_FORTRAN_HIDDEN_ARGS #endif #if defined(ARMA_DONT_USE_STD_MUTEX) #undef ARMA_USE_STD_MUTEX #endif // for compatibility with earlier versions of Armadillo #if defined(ARMA_DONT_USE_CXX11_MUTEX) #pragma message ("WARNING: support for ARMA_DONT_USE_CXX11_MUTEX is deprecated and will be removed;") #pragma message ("WARNING: use ARMA_DONT_USE_STD_MUTEX instead") #undef ARMA_USE_STD_MUTEX #endif #if defined(ARMA_DONT_USE_OPENMP) #undef ARMA_USE_OPENMP #endif #if defined(ARMA_32BIT_WORD) #undef ARMA_64BIT_WORD #endif #if (defined(ARMA_BLAS_LONG_LONG) && defined(ARMA_USE_WRAPPER)) #pragma message ("WARNING: use of ARMA_BLAS_LONG_LONG in conjunction with ARMA_USE_WRAPPER is not supported") #endif #if (defined(ARMA_BLAS_64BIT_INT) && defined(ARMA_USE_WRAPPER)) #pragma message ("WARNING: use of ARMA_BLAS_64BIT_INT in conjunction with ARMA_USE_WRAPPER is not supported") #endif #if (defined(ARMA_SUPERLU_64BIT_INT) && defined(ARMA_USE_WRAPPER)) #pragma message ("WARNING: use of ARMA_SUPERLU_64BIT_INT in conjunction with ARMA_USE_WRAPPER is not supported") #endif // for compatibility with earlier versions of Armadillo #if defined(ARMA_BLAS_LONG) || defined(ARMA_BLAS_LONG_LONG) #undef ARMA_BLAS_64BIT_INT #define ARMA_BLAS_64BIT_INT #endif #if defined(ARMA_DONT_OPTIMISE_BAND) || defined(ARMA_DONT_OPTIMISE_SOLVE_BAND) #undef ARMA_OPTIMISE_BAND #endif #if defined(ARMA_DONT_OPTIMISE_SYM) || defined(ARMA_DONT_OPTIMISE_SYMPD) || defined(ARMA_DONT_OPTIMISE_SOLVE_SYMPD) #undef ARMA_OPTIMISE_SYM #endif #if defined(ARMA_DONT_OPTIMISE_INVEXPR) #undef ARMA_OPTIMISE_INVEXPR #endif #if defined(ARMA_DONT_CHECK_CONFORMANCE) #if defined(ARMA_CHECK_CONFORMANCE) && (ARMA_WARN_LEVEL >= 2) #pragma message ("WARNING: conformance checks disabled") #endif #undef ARMA_CHECK_CONFORMANCE #endif #if defined(ARMA_DONT_CHECK_NONFINITE) #undef ARMA_CHECK_NONFINITE #endif #if defined(ARMA_DONT_IGNORE_DEPRECATED_MARKER) #undef ARMA_IGNORE_DEPRECATED_MARKER #endif #if defined(ARMA_NO_DEBUG) #undef ARMA_DEBUG #undef ARMA_EXTRA_DEBUG #endif #if defined(ARMA_DEBUG) #undef ARMA_DONT_CHECK_CONFORMANCE #undef ARMA_DONT_CHECK_NONFINITE #undef ARMA_CHECK_CONFORMANCE #define ARMA_CHECK_CONFORMANCE #undef ARMA_CHECK_NONFINITE #define ARMA_CHECK_NONFINITE #undef ARMA_WARN_LEVEL #define ARMA_WARN_LEVEL 3 #undef ARMA_IGNORE_DEPRECATED_MARKER #endif #if defined(ARMA_DONT_PRINT_EXCEPTIONS) #undef ARMA_PRINT_EXCEPTIONS #endif #if defined(ARMA_NO_CRIPPLED_LAPACK) #undef ARMA_CRIPPLED_LAPACK #endif // WARNING: option ARMA_IGNORE_DEPRECATED_MARKER will be removed // WARNING: option ARMA_CRIPPLED_LAPACK will be removed #if defined(ARMA_CRIPPLED_LAPACK) #if (!defined(ARMA_IGNORE_DEPRECATED_MARKER)) #pragma message ("option ARMA_CRIPPLED_LAPACK is deprecated and will be removed") #endif #endif // if Armadillo was installed on this system via CMake and ARMA_USE_WRAPPER is not defined, // ARMA_AUX_LIBS lists the libraries required by Armadillo on this system, and // ARMA_AUX_INCDIRS lists the include directories required by Armadillo on this system. // Do not use these unless you know what you are doing. #define ARMA_AUX_LIBS #define ARMA_AUX_INCDIRS RcppArmadillo/inst/include/armadillo_bits/op_index_max_meat.hpp0000644000176200001440000002351514631567470024604 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_index_max //! @{ template inline void op_index_max::apply(Mat& out, const mtOp& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword dim = in.aux_uword_a; arma_conform_check( (dim > 1), "index_max(): parameter 'dim' must be 0 or 1" ); const quasi_unwrap U(in.m); const Mat& X = U.M; if(U.is_alias(out) == false) { op_index_max::apply_noalias(out, X, dim); } else { Mat tmp; op_index_max::apply_noalias(tmp, X, dim); out.steal_mem(tmp); } } template inline void op_index_max::apply_noalias(Mat& out, const Mat& X, const uword dim) { arma_debug_sigprint(); typedef typename get_pod_type::result T; const uword X_n_rows = X.n_rows; const uword X_n_cols = X.n_cols; if(dim == 0) { arma_debug_print("op_index_max::apply(): dim = 0"); out.set_size((X_n_rows > 0) ? 1 : 0, X_n_cols); if(X_n_rows == 0) { return; } uword* out_mem = out.memptr(); for(uword col=0; col < X_n_cols; ++col) { op_max::direct_max( X.colptr(col), X_n_rows, out_mem[col] ); } } else if(dim == 1) { arma_debug_print("op_index_max::apply(): dim = 1"); out.zeros(X_n_rows, (X_n_cols > 0) ? 1 : 0); if(X_n_cols == 0) { return; } uword* out_mem = out.memptr(); Col tmp(X_n_rows, arma_nozeros_indicator()); T* tmp_mem = tmp.memptr(); if(is_cx::yes) { const eT* col_mem = X.colptr(0); for(uword row=0; row < X_n_rows; ++row) { tmp_mem[row] = eop_aux::arma_abs(col_mem[row]); } } else { arrayops::copy(tmp_mem, (T*)(X.colptr(0)), X_n_rows); } for(uword col=1; col < X_n_cols; ++col) { const eT* col_mem = X.colptr(col); for(uword row=0; row < X_n_rows; ++row) { T& max_val = tmp_mem[row]; T col_val = (is_cx::yes) ? T(eop_aux::arma_abs(col_mem[row])) : T(access::tmp_real(col_mem[row])); if(max_val < col_val) { max_val = col_val; out_mem[row] = col; } } } } } template inline void op_index_max::apply(Cube& out, const mtOpCube& in) { arma_debug_sigprint(); const uword dim = in.aux_uword_a; arma_conform_check( (dim > 2), "index_max(): parameter 'dim' must be 0 or 1 or 2" ); const unwrap_cube U(in.m); if(U.is_alias(out) == false) { op_index_max::apply_noalias(out, U.M, dim); } else { Cube tmp; op_index_max::apply_noalias(tmp, U.M, dim); out.steal_mem(tmp); } } template inline void op_index_max::apply_noalias(Cube& out, const Cube& X, const uword dim, const typename arma_not_cx::result* junk) { arma_debug_sigprint(); arma_ignore(junk); const uword X_n_rows = X.n_rows; const uword X_n_cols = X.n_cols; const uword X_n_slices = X.n_slices; if(dim == 0) { arma_debug_print("op_index_max::apply(): dim = 0"); out.set_size((X_n_rows > 0) ? 1 : 0, X_n_cols, X_n_slices); if(out.is_empty() || X.is_empty()) { return; } for(uword slice=0; slice < X_n_slices; ++slice) { uword* out_mem = out.slice_memptr(slice); for(uword col=0; col < X_n_cols; ++col) { op_max::direct_max( X.slice_colptr(slice,col), X_n_rows, out_mem[col] ); } } } else if(dim == 1) { arma_debug_print("op_index_max::apply(): dim = 1"); out.zeros(X_n_rows, (X_n_cols > 0) ? 1 : 0, X_n_slices); if(out.is_empty() || X.is_empty()) { return; } Col tmp(X_n_rows, arma_nozeros_indicator()); eT* tmp_mem = tmp.memptr(); for(uword slice=0; slice < X_n_slices; ++slice) { uword* out_mem = out.slice_memptr(slice); arrayops::copy(tmp_mem, X.slice_colptr(slice,0), X_n_rows); for(uword col=1; col < X_n_cols; ++col) { const eT* col_mem = X.slice_colptr(slice,col); for(uword row=0; row < X_n_rows; ++row) { const eT val = col_mem[row]; if(val > tmp_mem[row]) { tmp_mem[row] = val; out_mem[row] = col; } } } } } else if(dim == 2) { arma_debug_print("op_index_max::apply(): dim = 2"); out.zeros(X_n_rows, X_n_cols, (X_n_slices > 0) ? 1 : 0); if(out.is_empty() || X.is_empty()) { return; } Mat tmp(X.slice_memptr(0), X_n_rows, X_n_cols); // copy slice 0 eT* tmp_mem = tmp.memptr(); uword* out_mem = out.memptr(); const uword N = X.n_elem_slice; for(uword slice=1; slice < X_n_slices; ++slice) { const eT* X_slice_mem = X.slice_memptr(slice); for(uword i=0; i < N; ++i) { const eT val = X_slice_mem[i]; if(val > tmp_mem[i]) { tmp_mem[i] = val; out_mem[i] = slice; } } } } } template inline void op_index_max::apply_noalias(Cube& out, const Cube& X, const uword dim, const typename arma_cx_only::result* junk) { arma_debug_sigprint(); arma_ignore(junk); typedef typename get_pod_type::result T; const uword X_n_rows = X.n_rows; const uword X_n_cols = X.n_cols; const uword X_n_slices = X.n_slices; if(dim == 0) { arma_debug_print("op_index_max::apply(): dim = 0"); out.set_size((X_n_rows > 0) ? 1 : 0, X_n_cols, X_n_slices); if(out.is_empty() || X.is_empty()) { return; } for(uword slice=0; slice < X_n_slices; ++slice) { uword* out_mem = out.slice_memptr(slice); for(uword col=0; col < X_n_cols; ++col) { op_max::direct_max( X.slice_colptr(slice,col), X_n_rows, out_mem[col] ); } } } else if(dim == 1) { arma_debug_print("op_index_max::apply(): dim = 1"); out.zeros(X_n_rows, (X_n_cols > 0) ? 1 : 0, X_n_slices); if(out.is_empty() || X.is_empty()) { return; } Col tmp(X_n_rows, arma_nozeros_indicator()); T* tmp_mem = tmp.memptr(); for(uword slice=0; slice < X_n_slices; ++slice) { uword* out_mem = out.slice_memptr(slice); const eT* col0_mem = X.slice_colptr(slice,0); for(uword row=0; row < X_n_rows; ++row) { tmp_mem[row] = std::abs( col0_mem[row] ); } for(uword col=1; col < X_n_cols; ++col) { const eT* col_mem = X.slice_colptr(slice,col); for(uword row=0; row < X_n_rows; ++row) { const T val = std::abs( col_mem[row] ); if(val > tmp_mem[row]) { tmp_mem[row] = val; out_mem[row] = col; } } } } } else if(dim == 2) { arma_debug_print("op_index_max::apply(): dim = 2"); out.zeros(X_n_rows, X_n_cols, (X_n_slices > 0) ? 1 : 0); if(out.is_empty() || X.is_empty()) { return; } uword* out_mem = out.memptr(); Mat tmp(X_n_rows, X_n_cols, arma_nozeros_indicator()); T* tmp_mem = tmp.memptr(); const eT* X_slice0_mem = X.slice_memptr(0); const uword N = X.n_elem_slice; for(uword i=0; i tmp_mem[i]) { tmp_mem[i] = val; out_mem[i] = slice; } } } } } template inline void op_index_max::apply(Mat& out, const SpBase& expr, const uword dim) { arma_debug_sigprint(); typedef typename T1::elem_type eT; arma_conform_check( (dim > 1), "index_max(): parameter 'dim' must be 0 or 1" ); const unwrap_spmat U(expr.get_ref()); const SpMat& X = U.M; const uword X_n_rows = X.n_rows; const uword X_n_cols = X.n_cols; if(dim == 0) { arma_debug_print("op_index_max::apply(): dim = 0"); out.set_size((X_n_rows > 0) ? 1 : 0, X_n_cols); if(X_n_rows == 0) { return; } uword* out_mem = out.memptr(); for(uword col=0; col < X_n_cols; ++col) { out_mem[col] = X.col(col).index_max(); } } else if(dim == 1) { arma_debug_print("op_index_max::apply(): dim = 1"); out.set_size(X_n_rows, (X_n_cols > 0) ? 1 : 0); if(X_n_cols == 0) { return; } uword* out_mem = out.memptr(); const SpMat Xt = X.st(); for(uword row=0; row < X_n_rows; ++row) { out_mem[row] = Xt.col(row).index_max(); } } } //! @} RcppArmadillo/inst/include/armadillo_bits/Glue_bones.hpp0000644000176200001440000000441314715372502023173 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup Glue //! @{ template struct Glue_traits {}; template struct Glue_traits { static constexpr bool is_row = glue_type::template traits::is_row; static constexpr bool is_col = glue_type::template traits::is_col; static constexpr bool is_xvec = glue_type::template traits::is_xvec; }; template struct Glue_traits { static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = false; }; template class Glue : public Base< typename T1::elem_type, Glue > , public Glue_traits::value> { public: typedef typename T1::elem_type elem_type; typedef typename get_pod_type::result pod_type; inline Glue(const T1& in_A, const T2& in_B); inline Glue(const T1& in_A, const T2& in_B, const uword in_aux_uword); inline ~Glue(); template inline bool is_alias(const Mat& X) const; const T1& A; //!< first operand; must be derived from Base const T2& B; //!< second operand; must be derived from Base uword aux_uword; //!< storage of auxiliary data, uword format }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_norm_meat.hpp0000644000176200001440000004335414635324415023600 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_norm //! @{ template inline typename T1::pod_type op_norm::vec_norm_1(const Proxy& P, const typename arma_not_cx::result* junk) { arma_debug_sigprint(); arma_ignore(junk); const bool use_direct_mem = (is_Mat::stored_type>::value) || (is_subview_col::stored_type>::value) || (arma_config::openmp && Proxy::use_mp); if(use_direct_mem) { const quasi_unwrap::stored_type> tmp(P.Q); return op_norm::vec_norm_1_direct_std(tmp.M); } typedef typename T1::pod_type T; T acc = T(0); if(Proxy::use_at == false) { typename Proxy::ea_type A = P.get_ea(); const uword N = P.get_n_elem(); T acc1 = T(0); T acc2 = T(0); uword i,j; for(i=0, j=1; j inline typename T1::pod_type op_norm::vec_norm_1(const Proxy& P, const typename arma_cx_only::result* junk) { arma_debug_sigprint(); arma_ignore(junk); typedef typename T1::elem_type eT; typedef typename T1::pod_type T; T acc = T(0); if(Proxy::use_at == false) { typename Proxy::ea_type A = P.get_ea(); const uword N = P.get_n_elem(); for(uword i=0; i& X = A[i]; const T a = X.real(); const T b = X.imag(); acc += std::sqrt( (a*a) + (b*b) ); } } else { const uword n_rows = P.get_n_rows(); const uword n_cols = P.get_n_cols(); if(n_rows == 1) { for(uword col=0; col& X = P.at(0,col); const T a = X.real(); const T b = X.imag(); acc += std::sqrt( (a*a) + (b*b) ); } } else { for(uword col=0; col& X = P.at(row,col); const T a = X.real(); const T b = X.imag(); acc += std::sqrt( (a*a) + (b*b) ); } } } if( (acc != T(0)) && arma_isfinite(acc) ) { return acc; } else { arma_debug_print("detected possible underflow or overflow"); const quasi_unwrap::stored_type> R(P.Q); const uword N = R.M.n_elem; const eT* R_mem = R.M.memptr(); T max_val = priv::most_neg(); for(uword i=0; i& X = R_mem[i]; const T a = std::abs(X.real()); const T b = std::abs(X.imag()); if(a > max_val) { max_val = a; } if(b > max_val) { max_val = b; } } if(max_val == T(0)) { return T(0); } T alt_acc = T(0); for(uword i=0; i& X = R_mem[i]; const T a = X.real() / max_val; const T b = X.imag() / max_val; alt_acc += std::sqrt( (a*a) + (b*b) ); } return ( alt_acc * max_val ); } } template inline eT op_norm::vec_norm_1_direct_std(const Mat& X) { arma_debug_sigprint(); const uword N = X.n_elem; const eT* A = X.memptr(); eT out_val = eT(0); #if defined(ARMA_USE_ATLAS) { arma_debug_print("atlas::cblas_asum()"); out_val = atlas::cblas_asum(N,A); } #elif defined(ARMA_USE_BLAS) { if(has_blas_float_bug::value) { out_val = op_norm::vec_norm_1_direct_mem(N,A); } else { arma_debug_print("blas::asum()"); out_val = blas::asum(N,A); } } #else { out_val = op_norm::vec_norm_1_direct_mem(N,A); } #endif return (out_val <= eT(0)) ? eT(0) : out_val; } template inline eT op_norm::vec_norm_1_direct_mem(const uword N, const eT* A) { arma_debug_sigprint(); #if (defined(ARMA_SIMPLE_LOOPS) || defined(__FAST_MATH__)) { eT acc1 = eT(0); if(memory::is_aligned(A)) { memory::mark_as_aligned(A); for(uword i=0; i inline typename T1::pod_type op_norm::vec_norm_2(const Proxy& P, const typename arma_not_cx::result* junk) { arma_debug_sigprint(); arma_ignore(junk); const bool use_direct_mem = (is_Mat::stored_type>::value) || (is_subview_col::stored_type>::value) || (arma_config::openmp && Proxy::use_mp); if(use_direct_mem) { const quasi_unwrap::stored_type> tmp(P.Q); return op_norm::vec_norm_2_direct_std(tmp.M); } typedef typename T1::pod_type T; T acc = T(0); if(Proxy::use_at == false) { typename Proxy::ea_type A = P.get_ea(); const uword N = P.get_n_elem(); T acc1 = T(0); T acc2 = T(0); uword i,j; for(i=0, j=1; j::stored_type> tmp(P.Q); return op_norm::vec_norm_2_direct_robust(tmp.M); } } template inline typename T1::pod_type op_norm::vec_norm_2(const Proxy& P, const typename arma_cx_only::result* junk) { arma_debug_sigprint(); arma_ignore(junk); typedef typename T1::elem_type eT; typedef typename T1::pod_type T; T acc = T(0); if(Proxy::use_at == false) { typename Proxy::ea_type A = P.get_ea(); const uword N = P.get_n_elem(); for(uword i=0; i& X = A[i]; const T a = X.real(); const T b = X.imag(); acc += (a*a) + (b*b); } } else { const uword n_rows = P.get_n_rows(); const uword n_cols = P.get_n_cols(); if(n_rows == 1) { for(uword col=0; col& X = P.at(0,col); const T a = X.real(); const T b = X.imag(); acc += (a*a) + (b*b); } } else { for(uword col=0; col& X = P.at(row,col); const T a = X.real(); const T b = X.imag(); acc += (a*a) + (b*b); } } } const T sqrt_acc = std::sqrt(acc); if( (sqrt_acc != T(0)) && arma_isfinite(sqrt_acc) ) { return sqrt_acc; } else { arma_debug_print("detected possible underflow or overflow"); const quasi_unwrap::stored_type> R(P.Q); const uword N = R.M.n_elem; const eT* R_mem = R.M.memptr(); T max_val = priv::most_neg(); for(uword i=0; i max_val) { max_val = val_i; } } if(max_val == T(0)) { return T(0); } T alt_acc = T(0); for(uword i=0; i inline eT op_norm::vec_norm_2_direct_std(const Mat& X) { arma_debug_sigprint(); const uword N = X.n_elem; const eT* A = X.memptr(); eT out_val = eT(0); #if defined(ARMA_USE_ATLAS) { arma_debug_print("atlas::cblas_nrm2()"); out_val = atlas::cblas_nrm2(N,A); } #elif defined(ARMA_USE_BLAS) { if(has_blas_float_bug::value) { out_val = op_norm::vec_norm_2_direct_mem(N,A); } else { arma_debug_print("blas::nrm2()"); out_val = blas::nrm2(N,A); } } #else { out_val = op_norm::vec_norm_2_direct_mem(N,A); } #endif if( (out_val != eT(0)) && arma_isfinite(out_val) ) { return (out_val < eT(0)) ? eT(0) : out_val; } else { arma_debug_print("detected possible underflow or overflow"); return op_norm::vec_norm_2_direct_robust(X); } } template inline eT op_norm::vec_norm_2_direct_mem(const uword N, const eT* A) { arma_debug_sigprint(); eT acc = eT(0); #if (defined(ARMA_SIMPLE_LOOPS) || defined(__FAST_MATH__)) { eT acc1 = eT(0); if(memory::is_aligned(A)) { memory::mark_as_aligned(A); for(uword i=0; i inline eT op_norm::vec_norm_2_direct_robust(const Mat& X) { arma_debug_sigprint(); const uword N = X.n_elem; const eT* A = X.memptr(); eT max_val = priv::most_neg(); uword j; for(j=1; j max_val) { max_val = val_i; } if(val_j > max_val) { max_val = val_j; } } if((j-1) < N) { const eT val_i = std::abs(*A); if(val_i > max_val) { max_val = val_i; } } if(max_val == eT(0)) { return eT(0); } const eT* B = X.memptr(); eT acc1 = eT(0); eT acc2 = eT(0); for(j=1; j inline typename T1::pod_type op_norm::vec_norm_k(const Proxy& P, const int k) { arma_debug_sigprint(); typedef typename T1::pod_type T; T acc = T(0); if(Proxy::use_at == false) { typename Proxy::ea_type A = P.get_ea(); const uword N = P.get_n_elem(); for(uword i=0; i inline typename T1::pod_type op_norm::vec_norm_max(const Proxy& P) { arma_debug_sigprint(); typedef typename T1::pod_type T; const uword N = P.get_n_elem(); T max_val = (N != 1) ? priv::most_neg() : std::abs(P[0]); if(Proxy::use_at == false) { typename Proxy::ea_type A = P.get_ea(); uword i,j; for(i=0, j=1; j inline typename T1::pod_type op_norm::vec_norm_min(const Proxy& P) { arma_debug_sigprint(); typedef typename T1::pod_type T; const uword N = P.get_n_elem(); T min_val = (N != 1) ? priv::most_pos() : std::abs(P[0]); if(Proxy::use_at == false) { typename Proxy::ea_type A = P.get_ea(); uword i,j; for(i=0, j=1; j tmp_i) { min_val = tmp_i; } if(min_val > tmp_j) { min_val = tmp_j; } } if(i < N) { const T tmp_i = std::abs(A[i]); if(min_val > tmp_i) { min_val = tmp_i; } } } else { const uword n_rows = P.get_n_rows(); const uword n_cols = P.get_n_cols(); if(n_rows != 1) { for(uword col=0; col < n_cols; ++col) for(uword row=0; row < n_rows; ++row) { const T tmp = std::abs(P.at(row,col)); if(min_val > tmp) { min_val = tmp; } } } else { for(uword col=0; col < n_cols; ++col) { const T tmp = std::abs(P.at(0,col)); if(min_val > tmp) { min_val = tmp; } } } } return min_val; } template inline typename get_pod_type::result op_norm::mat_norm_1(const Mat& X) { arma_debug_sigprint(); // TODO: this can be sped up with a dedicated implementation return as_scalar( max( sum(abs(X), 0), 1) ); } template inline typename get_pod_type::result op_norm::mat_norm_2(const Mat& X) { arma_debug_sigprint(); typedef typename get_pod_type::result T; if(X.internal_has_nonfinite()) { arma_warn(1, "norm(): given matrix has non-finite elements"); } Col S; svd(S, X); const T out_val = (S.n_elem > 0) ? S[0] : T(0); return (out_val <= T(0)) ? T(0) : out_val; } template inline typename get_pod_type::result op_norm::mat_norm_inf(const Mat& X) { arma_debug_sigprint(); // TODO: this can be sped up with a dedicated implementation return as_scalar( max( sum(abs(X), 1), 0) ); } //! @} RcppArmadillo/inst/include/armadillo_bits/MapMat_bones.hpp0000644000176200001440000001720114374704744023465 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup MapMat //! @{ // this class is for internal use only; subject to change and/or removal without notice template class MapMat { public: typedef eT elem_type; //!< the type of elements stored in the matrix typedef typename get_pod_type::result pod_type; //!< if eT is std::complex, pod_type is T; otherwise pod_type is eT static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = false; const uword n_rows; //!< number of rows (read-only) const uword n_cols; //!< number of columns (read-only) const uword n_elem; //!< number of elements (read-only) private: typedef typename std::map map_type; arma_aligned map_type* map_ptr; public: inline ~MapMat(); inline MapMat(); inline explicit MapMat(const uword in_n_rows, const uword in_n_cols); inline explicit MapMat(const SizeMat& s); inline MapMat(const MapMat& x); inline void operator=(const MapMat& x); inline explicit MapMat(const SpMat& x); inline void operator=(const SpMat& x); inline MapMat(MapMat&& x); inline void operator=(MapMat&& x); inline void reset(); inline void set_size(const uword in_n_rows); inline void set_size(const uword in_n_rows, const uword in_n_cols); inline void set_size(const SizeMat& s); inline void zeros(); inline void zeros(const uword in_n_rows); inline void zeros(const uword in_n_rows, const uword in_n_cols); inline void zeros(const SizeMat& s); inline void eye(); inline void eye(const uword in_n_rows, const uword in_n_cols); inline void eye(const SizeMat& s); inline void speye(); inline void speye(const uword in_n_rows, const uword in_n_cols); inline void speye(const SizeMat& s); arma_warn_unused arma_inline MapMat_val operator[](const uword index); arma_warn_unused inline eT operator[](const uword index) const; arma_warn_unused arma_inline MapMat_val operator()(const uword index); arma_warn_unused inline eT operator()(const uword index) const; arma_warn_unused arma_inline MapMat_val at(const uword in_row, const uword in_col); arma_warn_unused inline eT at(const uword in_row, const uword in_col) const; arma_warn_unused arma_inline MapMat_val operator()(const uword in_row, const uword in_col); arma_warn_unused inline eT operator()(const uword in_row, const uword in_col) const; arma_warn_unused inline bool is_empty() const; arma_warn_unused inline bool is_vec() const; arma_warn_unused inline bool is_rowvec() const; arma_warn_unused inline bool is_colvec() const; arma_warn_unused inline bool is_square() const; inline void sprandu(const uword in_n_rows, const uword in_n_cols, const double density); inline void print(const std::string& extra_text) const; inline uword get_n_nonzero() const; inline void get_locval_format(umat& locs, Col& vals) const; private: inline void init_cold(); inline void init_warm(const uword in_n_rows, const uword in_n_cols); arma_inline void set_val(const uword index, const eT& in_val); inline void erase_val(const uword index); friend class SpMat; friend class MapMat_val; friend class SpMat_MapMat_val; friend class SpSubview_MapMat_val; }; template class MapMat_val { private: arma_aligned MapMat& parent; arma_aligned const uword index; inline MapMat_val(MapMat& in_parent, const uword in_index); friend class MapMat; public: arma_inline operator eT() const; arma_inline typename get_pod_type::result real() const; arma_inline typename get_pod_type::result imag() const; arma_inline void operator= (const MapMat_val& x); arma_inline void operator= (const eT in_val); arma_inline void operator+=(const eT in_val); arma_inline void operator-=(const eT in_val); arma_inline void operator*=(const eT in_val); arma_inline void operator/=(const eT in_val); arma_inline void operator++(); arma_inline void operator++(int); arma_inline void operator--(); arma_inline void operator--(int); }; template class SpMat_MapMat_val { private: arma_aligned SpMat& s_parent; arma_aligned MapMat& m_parent; arma_aligned const uword row; arma_aligned const uword col; inline SpMat_MapMat_val(SpMat& in_s_parent, MapMat& in_m_parent, const uword in_row, const uword in_col); friend class SpMat; friend class MapMat; friend class SpSubview_MapMat_val; public: inline operator eT() const; inline typename get_pod_type::result real() const; inline typename get_pod_type::result imag() const; inline SpMat_MapMat_val& operator= (const SpMat_MapMat_val& x); inline SpMat_MapMat_val& operator= (const eT in_val); inline SpMat_MapMat_val& operator+=(const eT in_val); inline SpMat_MapMat_val& operator-=(const eT in_val); inline SpMat_MapMat_val& operator*=(const eT in_val); inline SpMat_MapMat_val& operator/=(const eT in_val); inline SpMat_MapMat_val& operator++(); arma_warn_unused inline eT operator++(int); inline SpMat_MapMat_val& operator--(); arma_warn_unused inline eT operator--(int); inline void set(const eT in_val); inline void add(const eT in_val); inline void sub(const eT in_val); inline void mul(const eT in_val); inline void div(const eT in_val); }; template class SpSubview_MapMat_val : public SpMat_MapMat_val { private: arma_inline SpSubview_MapMat_val(SpSubview& in_sv_parent, MapMat& in_m_parent, const uword in_row, const uword in_col); arma_aligned SpSubview& sv_parent; friend class SpMat; friend class MapMat; friend class SpSubview; friend class SpMat_MapMat_val; public: inline SpSubview_MapMat_val& operator= (const SpSubview_MapMat_val& x); inline SpSubview_MapMat_val& operator= (const eT in_val); inline SpSubview_MapMat_val& operator+=(const eT in_val); inline SpSubview_MapMat_val& operator-=(const eT in_val); inline SpSubview_MapMat_val& operator*=(const eT in_val); inline SpSubview_MapMat_val& operator/=(const eT in_val); inline SpSubview_MapMat_val& operator++(); arma_warn_unused inline eT operator++(int); inline SpSubview_MapMat_val& operator--(); arma_warn_unused inline eT operator--(int); }; //! @} RcppArmadillo/inst/include/armadillo_bits/fn_trans.hpp0000644000176200001440000000372014631567470022732 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_trans //! @{ template arma_warn_unused arma_inline const Op trans ( const T1& X, const typename enable_if< is_arma_type::value >::result* junk = nullptr ) { arma_debug_sigprint(); arma_ignore(junk); return Op(X); } template arma_warn_unused arma_inline const Op htrans ( const T1& X, const typename enable_if< is_arma_type::value >::result* junk = nullptr ) { arma_debug_sigprint(); arma_ignore(junk); return Op(X); } // // handling of sparse matrices template arma_warn_unused arma_inline const SpOp trans ( const T1& X, const typename enable_if< is_arma_sparse_type::value >::result* junk = nullptr ) { arma_debug_sigprint(); arma_ignore(junk); return SpOp(X); } template arma_warn_unused arma_inline const SpOp htrans ( const T1& X, const typename enable_if< is_arma_sparse_type::value >::result* junk = nullptr ) { arma_debug_sigprint(); arma_ignore(junk); return SpOp(X); } //! @} RcppArmadillo/inst/include/armadillo_bits/mul_gemv.hpp0000644000176200001440000003133514654406643022735 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup gemv //! @{ //! for tiny square matrices, size <= 4x4 template class gemv_emul_tinysq { public: template struct pos { static constexpr uword n2 = (do_trans_A == false) ? (row + col*2) : (col + row*2); static constexpr uword n3 = (do_trans_A == false) ? (row + col*3) : (col + row*3); static constexpr uword n4 = (do_trans_A == false) ? (row + col*4) : (col + row*4); }; template arma_inline static void assign(eT* y, const eT acc, const eT alpha, const eT beta) { if(use_beta == false) { y[i] = (use_alpha == false) ? acc : alpha*acc; } else { const eT tmp = y[i]; y[i] = beta*tmp + ( (use_alpha == false) ? acc : alpha*acc ); } } template arma_cold inline static void apply( eT* y, const TA& A, const eT* x, const eT alpha = eT(1), const eT beta = eT(0) ) { arma_debug_sigprint(); const eT* Am = A.memptr(); switch(A.n_rows) { case 1: { const eT acc = Am[0] * x[0]; assign(y, acc, alpha, beta); } break; case 2: { const eT x0 = x[0]; const eT x1 = x[1]; const eT acc0 = Am[pos<0,0>::n2]*x0 + Am[pos<0,1>::n2]*x1; const eT acc1 = Am[pos<1,0>::n2]*x0 + Am[pos<1,1>::n2]*x1; assign(y, acc0, alpha, beta); assign(y, acc1, alpha, beta); } break; case 3: { const eT x0 = x[0]; const eT x1 = x[1]; const eT x2 = x[2]; const eT acc0 = Am[pos<0,0>::n3]*x0 + Am[pos<0,1>::n3]*x1 + Am[pos<0,2>::n3]*x2; const eT acc1 = Am[pos<1,0>::n3]*x0 + Am[pos<1,1>::n3]*x1 + Am[pos<1,2>::n3]*x2; const eT acc2 = Am[pos<2,0>::n3]*x0 + Am[pos<2,1>::n3]*x1 + Am[pos<2,2>::n3]*x2; assign(y, acc0, alpha, beta); assign(y, acc1, alpha, beta); assign(y, acc2, alpha, beta); } break; case 4: { const eT x0 = x[0]; const eT x1 = x[1]; const eT x2 = x[2]; const eT x3 = x[3]; const eT acc0 = Am[pos<0,0>::n4]*x0 + Am[pos<0,1>::n4]*x1 + Am[pos<0,2>::n4]*x2 + Am[pos<0,3>::n4]*x3; const eT acc1 = Am[pos<1,0>::n4]*x0 + Am[pos<1,1>::n4]*x1 + Am[pos<1,2>::n4]*x2 + Am[pos<1,3>::n4]*x3; const eT acc2 = Am[pos<2,0>::n4]*x0 + Am[pos<2,1>::n4]*x1 + Am[pos<2,2>::n4]*x2 + Am[pos<2,3>::n4]*x3; const eT acc3 = Am[pos<3,0>::n4]*x0 + Am[pos<3,1>::n4]*x1 + Am[pos<3,2>::n4]*x2 + Am[pos<3,3>::n4]*x3; assign(y, acc0, alpha, beta); assign(y, acc1, alpha, beta); assign(y, acc2, alpha, beta); assign(y, acc3, alpha, beta); } break; default: ; } } }; class gemv_emul_helper { public: template arma_hot inline static typename arma_not_cx::result dot_row_col( const TA& A, const eT* x, const uword row, const uword N ) { eT acc1 = eT(0); eT acc2 = eT(0); uword i,j; for(i=0, j=1; j < N; i+=2, j+=2) { const eT xi = x[i]; const eT xj = x[j]; acc1 += A.at(row,i) * xi; acc2 += A.at(row,j) * xj; } if(i < N) { acc1 += A.at(row,i) * x[i]; } return (acc1 + acc2); } template arma_hot inline static typename arma_cx_only::result dot_row_col( const TA& A, const eT* x, const uword row, const uword N ) { typedef typename get_pod_type::result T; T val_real = T(0); T val_imag = T(0); for(uword i=0; i& Ai = A.at(row,i); const std::complex& xi = x[i]; const T a = Ai.real(); const T b = Ai.imag(); const T c = xi.real(); const T d = xi.imag(); val_real += (a*c) - (b*d); val_imag += (a*d) + (b*c); } return std::complex(val_real, val_imag); } }; //! \brief //! Partial emulation of BLAS gemv(). //! 'y' is assumed to have been set to the correct size (ie. taking into account the transpose) template class gemv_emul { public: template arma_hot inline static void apply( eT* y, const TA& A, const eT* x, const eT alpha = eT(1), const eT beta = eT(0) ) { arma_debug_sigprint(); const uword A_n_rows = A.n_rows; const uword A_n_cols = A.n_cols; if(do_trans_A == false) { if(A_n_rows == 1) { const eT acc = op_dot::direct_dot_arma(A_n_cols, A.memptr(), x); if( (use_alpha == false) && (use_beta == false) ) { y[0] = acc; } else if( (use_alpha == true ) && (use_beta == false) ) { y[0] = alpha*acc; } else if( (use_alpha == false) && (use_beta == true ) ) { y[0] = acc + beta*y[0]; } else if( (use_alpha == true ) && (use_beta == true ) ) { y[0] = alpha*acc + beta*y[0]; } } else for(uword row=0; row < A_n_rows; ++row) { const eT acc = gemv_emul_helper::dot_row_col(A, x, row, A_n_cols); if( (use_alpha == false) && (use_beta == false) ) { y[row] = acc; } else if( (use_alpha == true ) && (use_beta == false) ) { y[row] = alpha*acc; } else if( (use_alpha == false) && (use_beta == true ) ) { y[row] = acc + beta*y[row]; } else if( (use_alpha == true ) && (use_beta == true ) ) { y[row] = alpha*acc + beta*y[row]; } } } else if(do_trans_A == true) { if(is_cx::no) { for(uword col=0; col < A_n_cols; ++col) { // col is interpreted as row when storing the results in 'y' // const eT* A_coldata = A.colptr(col); // // eT acc = eT(0); // for(uword row=0; row < A_n_rows; ++row) // { // acc += A_coldata[row] * x[row]; // } const eT acc = op_dot::direct_dot_arma(A_n_rows, A.colptr(col), x); if( (use_alpha == false) && (use_beta == false) ) { y[col] = acc; } else if( (use_alpha == true ) && (use_beta == false) ) { y[col] = alpha*acc; } else if( (use_alpha == false) && (use_beta == true ) ) { y[col] = acc + beta*y[col]; } else if( (use_alpha == true ) && (use_beta == true ) ) { y[col] = alpha*acc + beta*y[col]; } } } else { Mat AA; op_htrans::apply_mat_noalias(AA, A); gemv_emul::apply(y, AA, x, alpha, beta); } } } }; //! \brief //! Wrapper for BLAS gemv function, using template arguments to control the arguments passed to gemv. //! 'y' is assumed to have been set to the correct size (ie. taking into account the transpose) template class gemv { public: template inline static void apply_blas_type( eT* y, const TA& A, const eT* x, const eT alpha = eT(1), const eT beta = eT(0) ) { arma_debug_sigprint(); if( (A.n_rows <= 4) && (A.n_rows == A.n_cols) && (is_cx::no) ) { gemv_emul_tinysq::apply(y, A, x, alpha, beta); } else { #if defined(ARMA_USE_ATLAS) { arma_conform_assert_atlas_size(A); if(is_cx::no) { // use gemm() instead of gemv() to work around a speed issue in Atlas 3.8.4 arma_debug_print("atlas::cblas_gemm()"); atlas::cblas_gemm ( atlas_CblasColMajor, (do_trans_A) ? ( is_cx::yes ? atlas_CblasConjTrans : atlas_CblasTrans ) : atlas_CblasNoTrans, atlas_CblasNoTrans, (do_trans_A) ? A.n_cols : A.n_rows, 1, (do_trans_A) ? A.n_rows : A.n_cols, (use_alpha) ? alpha : eT(1), A.mem, A.n_rows, x, (do_trans_A) ? A.n_rows : A.n_cols, (use_beta) ? beta : eT(0), y, (do_trans_A) ? A.n_cols : A.n_rows ); } else { arma_debug_print("atlas::cblas_gemv()"); atlas::cblas_gemv ( atlas_CblasColMajor, (do_trans_A) ? ( is_cx::yes ? atlas_CblasConjTrans : atlas_CblasTrans ) : atlas_CblasNoTrans, A.n_rows, A.n_cols, (use_alpha) ? alpha : eT(1), A.mem, A.n_rows, x, 1, (use_beta) ? beta : eT(0), y, 1 ); } } #elif defined(ARMA_USE_BLAS) { arma_debug_print("blas::gemv()"); arma_conform_assert_blas_size(A); const char trans_A = (do_trans_A) ? ( is_cx::yes ? 'C' : 'T' ) : 'N'; const blas_int m = blas_int(A.n_rows); const blas_int n = blas_int(A.n_cols); const eT local_alpha = (use_alpha) ? alpha : eT(1); //const blas_int lda = A.n_rows; const blas_int inc = blas_int(1); const eT local_beta = (use_beta) ? beta : eT(0); arma_debug_print( arma_str::format("blas::gemv(): trans_A: %c") % trans_A ); blas::gemv ( &trans_A, &m, &n, &local_alpha, A.mem, &m, // lda x, &inc, &local_beta, y, &inc ); } #else { gemv_emul::apply(y,A,x,alpha,beta); } #endif } } template arma_inline static void apply( eT* y, const TA& A, const eT* x, const eT alpha = eT(1), const eT beta = eT(0) ) { gemv_emul::apply(y,A,x,alpha,beta); } template arma_inline static void apply ( float* y, const TA& A, const float* x, const float alpha = float(1), const float beta = float(0) ) { gemv::apply_blas_type(y,A,x,alpha,beta); } template arma_inline static void apply ( double* y, const TA& A, const double* x, const double alpha = double(1), const double beta = double(0) ) { gemv::apply_blas_type(y,A,x,alpha,beta); } template arma_inline static void apply ( std::complex* y, const TA& A, const std::complex* x, const std::complex alpha = std::complex(1), const std::complex beta = std::complex(0) ) { gemv::apply_blas_type(y,A,x,alpha,beta); } template arma_inline static void apply ( std::complex* y, const TA& A, const std::complex* x, const std::complex alpha = std::complex(1), const std::complex beta = std::complex(0) ) { gemv::apply_blas_type(y,A,x,alpha,beta); } }; //! @} RcppArmadillo/inst/include/armadillo_bits/glue_join_meat.hpp0000644000176200001440000002667214631567470024114 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup glue_join //! @{ template inline void glue_join_cols::apply_noalias(Mat& out, const Proxy& A, const Proxy& B) { arma_debug_sigprint(); const uword A_n_rows = A.get_n_rows(); const uword A_n_cols = A.get_n_cols(); const uword B_n_rows = B.get_n_rows(); const uword B_n_cols = B.get_n_cols(); arma_conform_check ( ( (A_n_cols != B_n_cols) && ( (A_n_rows > 0) || (A_n_cols > 0) ) && ( (B_n_rows > 0) || (B_n_cols > 0) ) ), "join_cols() / join_vert(): number of columns must be the same" ); out.set_size( A_n_rows + B_n_rows, (std::max)(A_n_cols, B_n_cols) ); if( out.n_elem > 0 ) { if(A.get_n_elem() > 0) { out.submat(0, 0, A_n_rows-1, out.n_cols-1) = A.Q; } if(B.get_n_elem() > 0) { out.submat(A_n_rows, 0, out.n_rows-1, out.n_cols-1) = B.Q; } } } template inline void glue_join_cols::apply(Mat& out, const Glue& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const Proxy A(X.A); const Proxy B(X.B); if( (A.is_alias(out) == false) && (B.is_alias(out) == false) ) { glue_join_cols::apply_noalias(out, A, B); } else { Mat tmp; glue_join_cols::apply_noalias(tmp, A, B); out.steal_mem(tmp); } } template inline void glue_join_cols::apply(Mat& out, const Base& A_expr, const Base& B_expr, const Base& C_expr) { arma_debug_sigprint(); const quasi_unwrap UA(A_expr.get_ref()); const quasi_unwrap UB(B_expr.get_ref()); const quasi_unwrap UC(C_expr.get_ref()); const Mat& A = UA.M; const Mat& B = UB.M; const Mat& C = UC.M; const uword out_n_rows = A.n_rows + B.n_rows + C.n_rows; const uword out_n_cols = (std::max)((std::max)(A.n_cols, B.n_cols), C.n_cols); arma_conform_check( ((A.n_cols != out_n_cols) && ((A.n_rows > 0) || (A.n_cols > 0))), "join_cols() / join_vert(): number of columns must be the same" ); arma_conform_check( ((B.n_cols != out_n_cols) && ((B.n_rows > 0) || (B.n_cols > 0))), "join_cols() / join_vert(): number of columns must be the same" ); arma_conform_check( ((C.n_cols != out_n_cols) && ((C.n_rows > 0) || (C.n_cols > 0))), "join_cols() / join_vert(): number of columns must be the same" ); out.set_size(out_n_rows, out_n_cols); if(out.n_elem == 0) { return; } uword row_start = 0; uword row_end_p1 = 0; if(A.n_elem > 0) { row_end_p1 += A.n_rows; out.rows(row_start, row_end_p1 - 1) = A; } row_start = row_end_p1; if(B.n_elem > 0) { row_end_p1 += B.n_rows; out.rows(row_start, row_end_p1 - 1) = B; } row_start = row_end_p1; if(C.n_elem > 0) { row_end_p1 += C.n_rows; out.rows(row_start, row_end_p1 - 1) = C; } } template inline void glue_join_cols::apply(Mat& out, const Base& A_expr, const Base& B_expr, const Base& C_expr, const Base& D_expr) { arma_debug_sigprint(); const quasi_unwrap UA(A_expr.get_ref()); const quasi_unwrap UB(B_expr.get_ref()); const quasi_unwrap UC(C_expr.get_ref()); const quasi_unwrap UD(D_expr.get_ref()); const Mat& A = UA.M; const Mat& B = UB.M; const Mat& C = UC.M; const Mat& D = UD.M; const uword out_n_rows = A.n_rows + B.n_rows + C.n_rows + D.n_rows; const uword out_n_cols = (std::max)(((std::max)((std::max)(A.n_cols, B.n_cols), C.n_cols)), D.n_cols); arma_conform_check( ((A.n_cols != out_n_cols) && ((A.n_rows > 0) || (A.n_cols > 0))), "join_cols() / join_vert(): number of columns must be the same" ); arma_conform_check( ((B.n_cols != out_n_cols) && ((B.n_rows > 0) || (B.n_cols > 0))), "join_cols() / join_vert(): number of columns must be the same" ); arma_conform_check( ((C.n_cols != out_n_cols) && ((C.n_rows > 0) || (C.n_cols > 0))), "join_cols() / join_vert(): number of columns must be the same" ); arma_conform_check( ((D.n_cols != out_n_cols) && ((D.n_rows > 0) || (D.n_cols > 0))), "join_cols() / join_vert(): number of columns must be the same" ); out.set_size(out_n_rows, out_n_cols); if(out.n_elem == 0) { return; } uword row_start = 0; uword row_end_p1 = 0; if(A.n_elem > 0) { row_end_p1 += A.n_rows; out.rows(row_start, row_end_p1 - 1) = A; } row_start = row_end_p1; if(B.n_elem > 0) { row_end_p1 += B.n_rows; out.rows(row_start, row_end_p1 - 1) = B; } row_start = row_end_p1; if(C.n_elem > 0) { row_end_p1 += C.n_rows; out.rows(row_start, row_end_p1 - 1) = C; } row_start = row_end_p1; if(D.n_elem > 0) { row_end_p1 += D.n_rows; out.rows(row_start, row_end_p1 - 1) = D; } } template inline void glue_join_rows::apply_noalias(Mat& out, const Proxy& A, const Proxy& B) { arma_debug_sigprint(); const uword A_n_rows = A.get_n_rows(); const uword A_n_cols = A.get_n_cols(); const uword B_n_rows = B.get_n_rows(); const uword B_n_cols = B.get_n_cols(); arma_conform_check ( ( (A_n_rows != B_n_rows) && ( (A_n_rows > 0) || (A_n_cols > 0) ) && ( (B_n_rows > 0) || (B_n_cols > 0) ) ), "join_rows() / join_horiz(): number of rows must be the same" ); out.set_size( (std::max)(A_n_rows, B_n_rows), A_n_cols + B_n_cols ); if( out.n_elem > 0 ) { if(A.get_n_elem() > 0) { out.submat(0, 0, out.n_rows-1, A_n_cols-1) = A.Q; } if(B.get_n_elem() > 0) { out.submat(0, A_n_cols, out.n_rows-1, out.n_cols-1) = B.Q; } } } template inline void glue_join_rows::apply(Mat& out, const Glue& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const Proxy A(X.A); const Proxy B(X.B); if( (A.is_alias(out) == false) && (B.is_alias(out) == false) ) { glue_join_rows::apply_noalias(out, A, B); } else { Mat tmp; glue_join_rows::apply_noalias(tmp, A, B); out.steal_mem(tmp); } } template inline void glue_join_rows::apply(Mat& out, const Base& A_expr, const Base& B_expr, const Base& C_expr) { arma_debug_sigprint(); const quasi_unwrap UA(A_expr.get_ref()); const quasi_unwrap UB(B_expr.get_ref()); const quasi_unwrap UC(C_expr.get_ref()); const Mat& A = UA.M; const Mat& B = UB.M; const Mat& C = UC.M; const uword out_n_rows = (std::max)((std::max)(A.n_rows, B.n_rows), C.n_rows); const uword out_n_cols = A.n_cols + B.n_cols + C.n_cols; arma_conform_check( ((A.n_rows != out_n_rows) && ((A.n_rows > 0) || (A.n_cols > 0))), "join_rows() / join_horiz(): number of rows must be the same" ); arma_conform_check( ((B.n_rows != out_n_rows) && ((B.n_rows > 0) || (B.n_cols > 0))), "join_rows() / join_horiz(): number of rows must be the same" ); arma_conform_check( ((C.n_rows != out_n_rows) && ((C.n_rows > 0) || (C.n_cols > 0))), "join_rows() / join_horiz(): number of rows must be the same" ); out.set_size(out_n_rows, out_n_cols); if(out.n_elem == 0) { return; } uword col_start = 0; uword col_end_p1 = 0; if(A.n_elem > 0) { col_end_p1 += A.n_cols; out.cols(col_start, col_end_p1 - 1) = A; } col_start = col_end_p1; if(B.n_elem > 0) { col_end_p1 += B.n_cols; out.cols(col_start, col_end_p1 - 1) = B; } col_start = col_end_p1; if(C.n_elem > 0) { col_end_p1 += C.n_cols; out.cols(col_start, col_end_p1 - 1) = C; } } template inline void glue_join_rows::apply(Mat& out, const Base& A_expr, const Base& B_expr, const Base& C_expr, const Base& D_expr) { arma_debug_sigprint(); const quasi_unwrap UA(A_expr.get_ref()); const quasi_unwrap UB(B_expr.get_ref()); const quasi_unwrap UC(C_expr.get_ref()); const quasi_unwrap UD(D_expr.get_ref()); const Mat& A = UA.M; const Mat& B = UB.M; const Mat& C = UC.M; const Mat& D = UD.M; const uword out_n_rows = (std::max)(((std::max)((std::max)(A.n_rows, B.n_rows), C.n_rows)), D.n_rows); const uword out_n_cols = A.n_cols + B.n_cols + C.n_cols + D.n_cols; arma_conform_check( ((A.n_rows != out_n_rows) && ((A.n_rows > 0) || (A.n_cols > 0))), "join_rows() / join_horiz(): number of rows must be the same" ); arma_conform_check( ((B.n_rows != out_n_rows) && ((B.n_rows > 0) || (B.n_cols > 0))), "join_rows() / join_horiz(): number of rows must be the same" ); arma_conform_check( ((C.n_rows != out_n_rows) && ((C.n_rows > 0) || (C.n_cols > 0))), "join_rows() / join_horiz(): number of rows must be the same" ); arma_conform_check( ((D.n_rows != out_n_rows) && ((D.n_rows > 0) || (D.n_cols > 0))), "join_rows() / join_horiz(): number of rows must be the same" ); out.set_size(out_n_rows, out_n_cols); if(out.n_elem == 0) { return; } uword col_start = 0; uword col_end_p1 = 0; if(A.n_elem > 0) { col_end_p1 += A.n_cols; out.cols(col_start, col_end_p1 - 1) = A; } col_start = col_end_p1; if(B.n_elem > 0) { col_end_p1 += B.n_cols; out.cols(col_start, col_end_p1 - 1) = B; } col_start = col_end_p1; if(C.n_elem > 0) { col_end_p1 += C.n_cols; out.cols(col_start, col_end_p1 - 1) = C; } col_start = col_end_p1; if(D.n_elem > 0) { col_end_p1 += D.n_cols; out.cols(col_start, col_end_p1 - 1) = D; } } template inline void glue_join_slices::apply(Cube& out, const GlueCube& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const unwrap_cube A_tmp(X.A); const unwrap_cube B_tmp(X.B); const Cube& A = A_tmp.M; const Cube& B = B_tmp.M; if(A.n_elem == 0) { out = B; return; } if(B.n_elem == 0) { out = A; return; } arma_conform_check( ( (A.n_rows != B.n_rows) || (A.n_cols != B.n_cols) ), "join_slices(): size of slices must be the same" ); if( (&out != &A) && (&out != &B) ) { out.set_size(A.n_rows, A.n_cols, A.n_slices + B.n_slices); out.slices(0, A.n_slices-1 ) = A; out.slices(A.n_slices, out.n_slices-1) = B; } else // we have aliasing { Cube C(A.n_rows, A.n_cols, A.n_slices + B.n_slices, arma_nozeros_indicator()); C.slices(0, A.n_slices-1) = A; C.slices(A.n_slices, C.n_slices-1) = B; out.steal_mem(C); } } //! @} RcppArmadillo/inst/include/armadillo_bits/injector_meat.hpp0000644000176200001440000001453214631567470023746 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup injector //! @{ template inline mat_injector::mat_injector(T1& in_parent, const typename mat_injector::elem_type val) : parent(in_parent) { arma_debug_sigprint(); values.reserve(16); rowend.reserve(16); insert(val); } template inline mat_injector::mat_injector(T1& in_parent, const injector_end_of_row<>&) : parent(in_parent) { arma_debug_sigprint(); values.reserve(16); rowend.reserve(16); end_of_row(); } template inline mat_injector::~mat_injector() { arma_debug_sigprint(); const uword N = values.size(); if(N == 0) { return; } uword n_rows = 1; uword n_cols = 0; for(uword i=0; i::value) { arma_conform_check( (n_rows > 1), "matrix initialisation: incompatible dimensions" ); parent.zeros(1,n_cols); uword col = 0; for(uword i=0; i::value) { const bool is_vec = ((n_cols == 1) || (n_rows == 1)); arma_conform_check( (is_vec == false), "matrix initialisation: incompatible dimensions" ); if(n_cols == 1) { parent.zeros(n_rows,1); uword row = 0; for(uword i=0; i 0) && rowend[i-1]) { ++row; } } else { parent.at(row) = values[i]; ++row; } } } else if(n_rows == 1) { parent.zeros(n_cols,1); uword row = 0; for(uword i=0; i inline void mat_injector::insert(const typename mat_injector::elem_type val) const { arma_debug_sigprint(); values.push_back(val ); rowend.push_back(char(0)); } template inline void mat_injector::end_of_row() const { arma_debug_sigprint(); typedef typename mat_injector::elem_type eT; values.push_back( eT(0)); rowend.push_back(char(1)); } template inline const mat_injector& operator<<(const mat_injector& ref, const typename mat_injector::elem_type val) { arma_debug_sigprint(); ref.insert(val); return ref; } template inline const mat_injector& operator<<(const mat_injector& ref, const injector_end_of_row<>&) { arma_debug_sigprint(); ref.end_of_row(); return ref; } // // // template inline field_injector::field_injector(T1& in_parent, const typename field_injector::object_type& val) : parent(in_parent) { arma_debug_sigprint(); insert(val); } template inline field_injector::field_injector(T1& in_parent, const injector_end_of_row<>&) : parent(in_parent) { arma_debug_sigprint(); end_of_row(); } template inline field_injector::~field_injector() { arma_debug_sigprint(); const uword N = values.size(); if(N == 0) { return; } uword n_rows = 1; uword n_cols = 0; for(uword i=0; i inline void field_injector::insert(const typename field_injector::object_type& val) const { arma_debug_sigprint(); values.push_back(val ); rowend.push_back(char(0)); } template inline void field_injector::end_of_row() const { arma_debug_sigprint(); typedef typename field_injector::object_type oT; values.push_back(oT() ); rowend.push_back(char(1)); } template inline const field_injector& operator<<(const field_injector& ref, const typename field_injector::object_type& val) { arma_debug_sigprint(); ref.insert(val); return ref; } template inline const field_injector& operator<<(const field_injector& ref, const injector_end_of_row<>&) { arma_debug_sigprint(); ref.end_of_row(); return ref; } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_powext.hpp0000644000176200001440000000704415030507611023115 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_powext //! @{ template arma_warn_unused inline typename enable_if2 < is_arma_type::value, const Glue >::result pow ( const T1& X, const Base& Y ) { arma_debug_sigprint(); return Glue(X, Y.get_ref()); } template arma_frown("refactor your code to use pow() in conjunction with repmat()") inline Mat pow ( const subview_each1& X, const Base& Y ) { arma_debug_sigprint(); return glue_powext::apply(X,Y); } template arma_warn_unused inline const GlueCube pow ( const BaseCube& X, const BaseCube& Y ) { arma_debug_sigprint(); return GlueCube(X.get_ref(), Y.get_ref()); } template arma_deprecated inline Cube pow ( const subview_cube_each1& X, const Base& Y ) { arma_debug_sigprint(); return glue_powext::apply(X,Y); } // template arma_warn_unused inline typename enable_if2 < ( is_arma_type::value && is_cx::yes ), const mtGlue >::result pow ( const T1& X, const Base& Y ) { arma_debug_sigprint(); return mtGlue(X, Y.get_ref()); } template arma_frown("refactor your code to use pow() in conjunction with repmat()") inline typename enable_if2 < is_cx::yes, Mat >::result pow ( const subview_each1& X, const Base& Y ) { arma_debug_sigprint(); return glue_powext_cx::apply(X,Y); } template arma_warn_unused inline const mtGlueCube pow ( const BaseCube< std::complex, T1>& X, const BaseCube< typename T1::pod_type , T2>& Y ) { arma_debug_sigprint(); return mtGlueCube(X.get_ref(), Y.get_ref()); } template arma_deprecated inline Cube< std::complex > pow ( const subview_cube_each1< std::complex >& X, const Base& Y ) { arma_debug_sigprint(); return glue_powext_cx::apply(X,Y); } //! @} RcppArmadillo/inst/include/armadillo_bits/op_cond_meat.hpp0000644000176200001440000000702014713753317023542 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_cond //! @{ template inline typename T1::pod_type op_cond::apply(const Base& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; typedef typename T1::pod_type T; Mat A(X.get_ref()); if(A.n_elem == 0) { return T(0); } if(is_op_diagmat::value || A.is_diagmat()) { arma_debug_print("op_cond::apply(): diag optimisation"); return op_cond::apply_diag(A); } if(sym_helper::is_approx_sym(A)) { arma_debug_print("op_cond: symmetric/hermitian optimisation"); return op_cond::apply_sym(A); } return op_cond::apply_gen(A); } template inline typename get_pod_type::result op_cond::apply_diag(const Mat& A) { arma_debug_sigprint(); typedef typename get_pod_type::result T; const uword N = (std::min)(A.n_rows, A.n_cols); T abs_min = Datum::inf; T abs_max = T(0); for(uword i=0; i < N; ++i) { const T abs_val = std::abs(A.at(i,i)); if(arma_isnan(abs_val)) { arma_warn(3, "cond(): failed"); return Datum::nan; } abs_min = (abs_val < abs_min) ? abs_val : abs_min; abs_max = (abs_val > abs_max) ? abs_val : abs_max; } if((abs_min == T(0)) || (abs_max == T(0))) { return Datum::inf; } return T(abs_max / abs_min); } template inline typename get_pod_type::result op_cond::apply_sym(Mat& A) { arma_debug_sigprint(); typedef typename get_pod_type::result T; Col eigval; const bool status = auxlib::eig_sym(eigval, A); if(status == false) { arma_warn(3, "cond(): failed"); return Datum::nan; } if(eigval.n_elem == 0) { return T(0); } const T* eigval_mem = eigval.memptr(); T abs_min = std::abs(eigval_mem[0]); T abs_max = abs_min; for(uword i=1; i < eigval.n_elem; ++i) { const T abs_val = std::abs(eigval_mem[i]); abs_min = (abs_val < abs_min) ? abs_val : abs_min; abs_max = (abs_val > abs_max) ? abs_val : abs_max; } if((abs_min == T(0)) || (abs_max == T(0))) { return Datum::inf; } return T(abs_max / abs_min); } template inline typename get_pod_type::result op_cond::apply_gen(Mat& A) { arma_debug_sigprint(); typedef typename get_pod_type::result T; Col S; const bool status = auxlib::svd_dc(S, A); if(status == false) { arma_warn(3, "cond(): failed"); return Datum::nan; } if(S.n_elem == 0) { return T(0); } const T S_max = S[0]; const T S_min = S[S.n_elem-1]; if((S_max == T(0)) || (S_min == T(0))) { return Datum::inf; } return T(S_max / S_min); } //! @} RcppArmadillo/inst/include/armadillo_bits/glue_solve_bones.hpp0000644000176200001440000001515614715372502024451 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup glue_solve //! @{ class glue_solve_gen_default { public: template struct traits { static constexpr bool is_row = false; static constexpr bool is_col = T2::is_col; static constexpr bool is_xvec = false; }; template inline static void apply(Mat& out, const Glue& X); template inline static bool apply(Mat& out, const Base& A_expr, const Base& B_expr); }; class glue_solve_gen_full { public: template struct traits { static constexpr bool is_row = false; static constexpr bool is_col = T2::is_col; static constexpr bool is_xvec = false; }; template inline static void apply(Mat& out, const Glue& X); template inline static bool apply(Mat& out, const Base& A_expr, const Base& B_expr, const uword flags); }; class glue_solve_tri_default { public: template struct traits { static constexpr bool is_row = false; static constexpr bool is_col = T2::is_col; static constexpr bool is_xvec = false; }; template inline static void apply(Mat& out, const Glue& X); template inline static bool apply(Mat& out, const Base& A_expr, const Base& B_expr, const uword flags); }; class glue_solve_tri_full { public: template struct traits { static constexpr bool is_row = false; static constexpr bool is_col = T2::is_col; static constexpr bool is_xvec = false; }; template inline static void apply(Mat& out, const Glue& X); template inline static bool apply(Mat& out, const Base& A_expr, const Base& B_expr, const uword flags); }; namespace solve_opts { struct opts { const uword flags; inline constexpr explicit opts(const uword in_flags); inline const opts operator+(const opts& rhs) const; }; inline constexpr opts::opts(const uword in_flags) : flags(in_flags) {} inline const opts opts::operator+(const opts& rhs) const { const opts result( flags | rhs.flags ); return result; } // The values below (eg. 1u << 1) are for internal Armadillo use only. // The values can change without notice. static constexpr uword flag_none = uword(0 ); static constexpr uword flag_fast = uword(1u << 0); static constexpr uword flag_equilibrate = uword(1u << 1); static constexpr uword flag_no_approx = uword(1u << 2); static constexpr uword flag_triu = uword(1u << 3); static constexpr uword flag_tril = uword(1u << 4); static constexpr uword flag_no_band = uword(1u << 5); static constexpr uword flag_no_sympd = uword(1u << 6); static constexpr uword flag_allow_ugly = uword(1u << 7); static constexpr uword flag_likely_sympd = uword(1u << 8); static constexpr uword flag_refine = uword(1u << 9); static constexpr uword flag_no_trimat = uword(1u << 10); static constexpr uword flag_force_approx = uword(1u << 11); static constexpr uword flag_force_sym = uword(1u << 12); struct opts_none : public opts { inline constexpr opts_none() : opts(flag_none ) {} }; struct opts_fast : public opts { inline constexpr opts_fast() : opts(flag_fast ) {} }; struct opts_equilibrate : public opts { inline constexpr opts_equilibrate() : opts(flag_equilibrate ) {} }; struct opts_no_approx : public opts { inline constexpr opts_no_approx() : opts(flag_no_approx ) {} }; struct opts_triu : public opts { inline constexpr opts_triu() : opts(flag_triu ) {} }; struct opts_tril : public opts { inline constexpr opts_tril() : opts(flag_tril ) {} }; struct opts_no_band : public opts { inline constexpr opts_no_band() : opts(flag_no_band ) {} }; struct opts_no_sympd : public opts { inline constexpr opts_no_sympd() : opts(flag_no_sympd ) {} }; struct opts_allow_ugly : public opts { inline constexpr opts_allow_ugly() : opts(flag_allow_ugly ) {} }; struct opts_likely_sympd : public opts { inline constexpr opts_likely_sympd() : opts(flag_likely_sympd) {} }; struct opts_refine : public opts { inline constexpr opts_refine() : opts(flag_refine ) {} }; struct opts_no_trimat : public opts { inline constexpr opts_no_trimat() : opts(flag_no_trimat ) {} }; struct opts_force_approx : public opts { inline constexpr opts_force_approx() : opts(flag_force_approx) {} }; struct opts_force_sym : public opts { inline constexpr opts_force_sym() : opts(flag_force_sym ) {} }; static constexpr opts_none none; static constexpr opts_fast fast; static constexpr opts_equilibrate equilibrate; static constexpr opts_no_approx no_approx; static constexpr opts_triu triu; static constexpr opts_tril tril; static constexpr opts_no_band no_band; static constexpr opts_no_sympd no_sympd; static constexpr opts_allow_ugly allow_ugly; static constexpr opts_likely_sympd likely_sympd; static constexpr opts_refine refine; static constexpr opts_no_trimat no_trimat; static constexpr opts_force_approx force_approx; static constexpr opts_force_sym force_sym; } //! @} RcppArmadillo/inst/include/armadillo_bits/BaseCube_meat.hpp0000644000176200001440000002550115030507611023561 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup BaseCube //! @{ template arma_inline const derived& BaseCube::get_ref() const { return static_cast(*this); } template inline void BaseCube::print(const std::string extra_text) const { arma_debug_sigprint(); const unwrap_cube tmp( (*this).get_ref() ); if(extra_text.length() != 0) { const std::streamsize orig_width = get_cout_stream().width(); get_cout_stream() << extra_text << '\n'; get_cout_stream().width(orig_width); } arma_ostream::print(get_cout_stream(), tmp.M, true); } template inline void BaseCube::print(std::ostream& user_stream, const std::string extra_text) const { arma_debug_sigprint(); const unwrap_cube tmp( (*this).get_ref() ); if(extra_text.length() != 0) { const std::streamsize orig_width = user_stream.width(); user_stream << extra_text << '\n'; user_stream.width(orig_width); } arma_ostream::print(user_stream, tmp.M, true); } template inline void BaseCube::raw_print(const std::string extra_text) const { arma_debug_sigprint(); const unwrap_cube tmp( (*this).get_ref() ); if(extra_text.length() != 0) { const std::streamsize orig_width = get_cout_stream().width(); get_cout_stream() << extra_text << '\n'; get_cout_stream().width(orig_width); } arma_ostream::print(get_cout_stream(), tmp.M, false); } template inline void BaseCube::raw_print(std::ostream& user_stream, const std::string extra_text) const { arma_debug_sigprint(); const unwrap_cube tmp( (*this).get_ref() ); if(extra_text.length() != 0) { const std::streamsize orig_width = user_stream.width(); user_stream << extra_text << '\n'; user_stream.width(orig_width); } arma_ostream::print(user_stream, tmp.M, false); } template inline void BaseCube::brief_print(const std::string extra_text) const { arma_debug_sigprint(); const unwrap_cube tmp( (*this).get_ref() ); if(extra_text.length() != 0) { const std::streamsize orig_width = get_cout_stream().width(); get_cout_stream() << extra_text << '\n'; get_cout_stream().width(orig_width); } arma_ostream::brief_print(get_cout_stream(), tmp.M); } template inline void BaseCube::brief_print(std::ostream& user_stream, const std::string extra_text) const { arma_debug_sigprint(); const unwrap_cube tmp( (*this).get_ref() ); if(extra_text.length() != 0) { const std::streamsize orig_width = user_stream.width(); user_stream << extra_text << '\n'; user_stream.width(orig_width); } arma_ostream::brief_print(user_stream, tmp.M); } template inline elem_type BaseCube::min() const { return op_min::min( (*this).get_ref() ); } template inline elem_type BaseCube::max() const { return op_max::max( (*this).get_ref() ); } template inline uword BaseCube::index_min() const { const ProxyCube P( (*this).get_ref() ); uword index = 0; if(P.get_n_elem() == 0) { arma_conform_check(true, "index_min(): object has no elements"); } else { op_min::min_with_index(P, index); } return index; } template inline uword BaseCube::index_max() const { const ProxyCube P( (*this).get_ref() ); uword index = 0; if(P.get_n_elem() == 0) { arma_conform_check(true, "index_max(): object has no elements"); } else { op_max::max_with_index(P, index); } return index; } template inline bool BaseCube::is_zero(const typename get_pod_type::result tol) const { arma_debug_sigprint(); typedef typename get_pod_type::result T; arma_conform_check( (tol < T(0)), "is_zero(): parameter 'tol' must be >= 0" ); if(ProxyCube::use_at || is_Cube::stored_type>::value) { const unwrap_cube U( (*this).get_ref() ); return arrayops::is_zero( U.M.memptr(), U.M.n_elem, tol ); } const ProxyCube P( (*this).get_ref() ); const uword n_elem = P.get_n_elem(); if(n_elem == 0) { return false; } const typename ProxyCube::ea_type Pea = P.get_ea(); if(is_cx::yes) { for(uword i=0; i tol) { return false; } if(eop_aux::arma_abs(val_imag) > tol) { return false; } } } else // not complex { for(uword i=0; i < n_elem; ++i) { if(eop_aux::arma_abs(Pea[i]) > tol) { return false; } } } return true; } template inline bool BaseCube::is_empty() const { arma_debug_sigprint(); const ProxyCube P( (*this).get_ref() ); return (P.get_n_elem() == uword(0)); } template inline bool BaseCube::is_finite() const { arma_debug_sigprint(); if(arma_config::fast_math_warn) { arma_warn(1, "is_finite(): detection of non-finite values is not reliable in fast math mode"); } if(is_Cube::stored_type>::value) { const unwrap_cube U( (*this).get_ref() ); return arrayops::is_finite( U.M.memptr(), U.M.n_elem ); } else { const ProxyCube P( (*this).get_ref() ); const uword n_r = P.get_n_rows(); const uword n_c = P.get_n_cols(); const uword n_s = P.get_n_slices(); for(uword s=0; s inline bool BaseCube::has_inf() const { arma_debug_sigprint(); if(arma_config::fast_math_warn) { arma_warn(1, "has_inf(): detection of non-finite values is not reliable in fast math mode"); } if(is_Cube::stored_type>::value) { const unwrap_cube U( (*this).get_ref() ); return arrayops::has_inf( U.M.memptr(), U.M.n_elem ); } else { const ProxyCube P( (*this).get_ref() ); const uword n_r = P.get_n_rows(); const uword n_c = P.get_n_cols(); const uword n_s = P.get_n_slices(); for(uword s=0; s inline bool BaseCube::has_nan() const { arma_debug_sigprint(); if(arma_config::fast_math_warn) { arma_warn(1, "has_nan(): detection of non-finite values is not reliable in fast math mode"); } if(is_Cube::stored_type>::value) { const unwrap_cube U( (*this).get_ref() ); return arrayops::has_nan( U.M.memptr(), U.M.n_elem ); } else { const ProxyCube P( (*this).get_ref() ); const uword n_r = P.get_n_rows(); const uword n_c = P.get_n_cols(); const uword n_s = P.get_n_slices(); for(uword s=0; s inline bool BaseCube::has_nonfinite() const { arma_debug_sigprint(); if(arma_config::fast_math_warn) { arma_warn(1, "has_nonfinite(): detection of non-finite values is not reliable in fast math mode"); } if(is_Cube::stored_type>::value) { const unwrap_cube U( (*this).get_ref() ); return (arrayops::is_finite( U.M.memptr(), U.M.n_elem ) == false); } else { const ProxyCube P( (*this).get_ref() ); const uword n_r = P.get_n_rows(); const uword n_c = P.get_n_cols(); const uword n_s = P.get_n_slices(); for(uword s=0; s inline const CubeToMatOp BaseCube::row_as_mat(const uword in_row) const { return CubeToMatOp( (*this).get_ref(), in_row ); } template inline const CubeToMatOp BaseCube::col_as_mat(const uword in_col) const { return CubeToMatOp( (*this).get_ref(), in_col ); } // // extra functions defined in BaseCube_eval_Cube template arma_inline const derived& BaseCube_eval_Cube::eval() const { arma_debug_sigprint(); return static_cast(*this); } // // extra functions defined in BaseCube_eval_expr template inline Cube BaseCube_eval_expr::eval() const { arma_debug_sigprint(); return Cube( static_cast(*this) ); } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_speye.hpp0000644000176200001440000000407614631567470022735 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_speye //! @{ //! Generate a sparse matrix with the values along the main diagonal set to one template arma_warn_unused inline obj_type speye(const uword n_rows, const uword n_cols, const typename arma_SpMat_SpCol_SpRow_only::result* junk = nullptr) { arma_debug_sigprint(); arma_ignore(junk); if(is_SpCol::value) { arma_conform_check( (n_cols != 1), "speye(): incompatible size" ); } if(is_SpRow::value) { arma_conform_check( (n_rows != 1), "speye(): incompatible size" ); } obj_type out; out.eye(n_rows, n_cols); return out; } template arma_warn_unused inline obj_type speye(const SizeMat& s, const typename arma_SpMat_SpCol_SpRow_only::result* junk = nullptr) { arma_debug_sigprint(); arma_ignore(junk); return speye(s.n_rows, s.n_cols); } // Convenience shortcut method (no template parameter necessary) arma_warn_unused inline sp_mat speye(const uword n_rows, const uword n_cols) { arma_debug_sigprint(); sp_mat out; out.eye(n_rows, n_cols); return out; } arma_warn_unused inline sp_mat speye(const SizeMat& s) { arma_debug_sigprint(); sp_mat out; out.eye(s.n_rows, s.n_cols); return out; } //! @} RcppArmadillo/inst/include/armadillo_bits/spglue_kron_meat.hpp0000644000176200001440000001011314631567470024450 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup spglue_kron //! @{ template inline void spglue_kron::apply(SpMat& out, const SpGlue& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const unwrap_spmat UA(X.A); const unwrap_spmat UB(X.B); if(UA.is_alias(out) || UB.is_alias(out)) { SpMat tmp; spglue_kron::apply_noalias(tmp, UA.M, UB.M); out.steal_mem(tmp); } else { spglue_kron::apply_noalias(out, UA.M, UB.M); } } template inline void spglue_kron::apply_noalias(SpMat& out, const SpMat& A, const SpMat& B) { arma_debug_sigprint(); const uword A_n_rows = A.n_rows; const uword A_n_cols = A.n_cols; const uword B_n_rows = B.n_rows; const uword B_n_cols = B.n_cols; const uword out_n_nonzero = A.n_nonzero * B.n_nonzero; out.reserve(A_n_rows * B_n_rows, A_n_cols * B_n_cols, out_n_nonzero); if(out_n_nonzero == 0) { return; } access::rw(out.col_ptrs[0]) = 0; uword count = 0; for(uword A_col=0; A_col < A_n_cols; ++A_col) for(uword B_col=0; B_col < B_n_cols; ++B_col) { for(uword A_i = A.col_ptrs[A_col]; A_i < A.col_ptrs[A_col+1]; ++A_i) { const uword out_row = A.row_indices[A_i] * B_n_rows; const eT A_val = A.values[A_i]; for(uword B_i = B.col_ptrs[B_col]; B_i < B.col_ptrs[B_col+1]; ++B_i) { access::rw(out.values[count]) = A_val * B.values[B_i]; access::rw(out.row_indices[count]) = out_row + B.row_indices[B_i]; count++; } } access::rw(out.col_ptrs[A_col * B_n_cols + B_col + 1]) = count; } } // template // inline // void // spglue_kron::apply(SpMat& out, const SpGlue& X) // { // arma_debug_sigprint(); // // typedef typename T1::elem_type eT; // // const unwrap_spmat UA(X.A); // const unwrap_spmat UB(X.B); // // const SpMat& A = UA.M; // const SpMat& B = UB.M; // // umat locs(2, A.n_nonzero * B.n_nonzero, arma_nozeros_indicator()); // Col vals( A.n_nonzero * B.n_nonzero, arma_nozeros_indicator()); // // uword* locs_mem = locs.memptr(); // eT* vals_mem = vals.memptr(); // // typename SpMat::const_iterator A_it = A.begin(); // typename SpMat::const_iterator A_it_end = A.end(); // // typename SpMat::const_iterator B_it_start = B.begin(); // typename SpMat::const_iterator B_it_end = B.end(); // // const uword B_n_rows = B.n_rows; // const uword B_n_cols = B.n_cols; // // uword i = 0; // // while(A_it != A_it_end) // { // typename SpMat::const_iterator B_it = B_it_start; // // const uword loc_row = A_it.row() * B_n_rows; // const uword loc_col = A_it.col() * B_n_cols; // // const eT A_val = (*A_it); // // while(B_it != B_it_end) // { // (*locs_mem) = loc_row + B_it.row(); locs_mem++; // (*locs_mem) = loc_col + B_it.col(); locs_mem++; // // vals_mem[i] = A_val * (*B_it); // // ++i; // ++B_it; // } // // ++A_it; // } // // out = SpMat(locs, vals, A.n_rows*B.n_rows, A.n_cols*B.n_cols); // } //! @} RcppArmadillo/inst/include/armadillo_bits/SpValProxy_bones.hpp0000644000176200001440000000524214464473241024372 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup SpValProxy //! @{ // Sparse value proxy class, to prevent inserting 0s into sparse matrices. // T1 must be either SpMat or SpSubview. // This class uses T1::insert_element(), T1::delete_element(), T1::invalidate_cache() template class SpValProxy { public: typedef typename T1::elem_type eT; // Convenience typedef friend class SpMat; friend class SpSubview; /** * Create the sparse value proxy. * Otherwise, pass a pointer to a reference of the value. */ arma_inline SpValProxy(uword row, uword col, T1& in_parent, eT* in_val_ptr = nullptr); inline SpValProxy() = delete; //! For swapping operations. arma_inline SpValProxy& operator=(const SpValProxy& rhs); template arma_inline SpValProxy& operator=(const SpValProxy& rhs); //! Overload all of the potential operators. //! First, the ones that could modify a value. inline SpValProxy& operator= (const eT rhs); inline SpValProxy& operator+=(const eT rhs); inline SpValProxy& operator-=(const eT rhs); inline SpValProxy& operator*=(const eT rhs); inline SpValProxy& operator/=(const eT rhs); inline SpValProxy& operator++(); inline SpValProxy& operator--(); inline eT operator++(const int); inline eT operator--(const int); //! This will work for any other operations that do not modify a value. arma_inline operator eT() const; arma_inline typename get_pod_type::result real() const; arma_inline typename get_pod_type::result imag() const; private: // Deletes the element if it is zero; NOTE: does not check if val_ptr == nullptr arma_inline void check_zero(); arma_aligned const uword row; arma_aligned const uword col; arma_aligned eT* val_ptr; arma_aligned T1& parent; // We will call this object if we need to insert or delete an element. }; //! @} RcppArmadillo/inst/include/armadillo_bits/spdiagview_meat.hpp0000644000176200001440000005501115013306507024253 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup spdiagview //! @{ template inline spdiagview::~spdiagview() { arma_debug_sigprint(); } template arma_inline spdiagview::spdiagview(const SpMat& in_m, const uword in_row_offset, const uword in_col_offset, const uword in_len) : m(in_m) , row_offset(in_row_offset) , col_offset(in_col_offset) , n_rows(in_len) , n_elem(in_len) { arma_debug_sigprint(); } //! set a diagonal of our matrix using a diagonal from a foreign matrix template inline void spdiagview::operator= (const spdiagview& x) { arma_debug_sigprint(); spdiagview& d = *this; arma_conform_check( (d.n_elem != x.n_elem), "spdiagview: diagonals have incompatible lengths" ); SpMat& d_m = const_cast< SpMat& >(d.m); const SpMat& x_m = x.m; if( (&d_m == &x_m) || ((d.row_offset == 0) && (d.col_offset == 0)) ) { const Mat tmp(x); (*this).operator=(tmp); } else { const uword d_n_elem = d.n_elem; const uword d_row_offset = d.row_offset; const uword d_col_offset = d.col_offset; const uword x_row_offset = x.row_offset; const uword x_col_offset = x.col_offset; for(uword i=0; i < d_n_elem; ++i) { d_m.at(i + d_row_offset, i + d_col_offset) = x_m.at(i + x_row_offset, i + x_col_offset); } } } template inline void spdiagview::operator+=(const eT val) { arma_debug_sigprint(); if(val == eT(0)) { return; } SpMat& t_m = const_cast< SpMat& >(m); const uword t_n_elem = n_elem; const uword t_row_offset = row_offset; const uword t_col_offset = col_offset; for(uword i=0; i < t_n_elem; ++i) { t_m.at(i + t_row_offset, i + t_col_offset) += val; } } template inline void spdiagview::operator-=(const eT val) { arma_debug_sigprint(); if(val == eT(0)) { return; } SpMat& t_m = const_cast< SpMat& >(m); const uword t_n_elem = n_elem; const uword t_row_offset = row_offset; const uword t_col_offset = col_offset; for(uword i=0; i < t_n_elem; ++i) { t_m.at(i + t_row_offset, i + t_col_offset) -= val; } } template inline void spdiagview::operator*=(const eT val) { arma_debug_sigprint(); SpMat& t_m = const_cast< SpMat& >(m); const uword t_n_elem = n_elem; const uword t_row_offset = row_offset; const uword t_col_offset = col_offset; for(uword i=0; i < t_n_elem; ++i) { t_m.at(i + t_row_offset, i + t_col_offset) *= val; } } template inline void spdiagview::operator/=(const eT val) { arma_debug_sigprint(); SpMat& t_m = const_cast< SpMat& >(m); const uword t_n_elem = n_elem; const uword t_row_offset = row_offset; const uword t_col_offset = col_offset; for(uword i=0; i < t_n_elem; ++i) { t_m.at(i + t_row_offset, i + t_col_offset) /= val; } } //! set a diagonal of our matrix using data from a foreign object template template inline void spdiagview::operator= (const Base& o) { arma_debug_sigprint(); spdiagview& d = *this; SpMat& d_m = const_cast< SpMat& >(d.m); const uword d_n_elem = d.n_elem; const uword d_row_offset = d.row_offset; const uword d_col_offset = d.col_offset; if(is_same_type< T1, Gen, gen_zeros> >::yes) { const Proxy P(o.get_ref()); arma_conform_check( (d_n_elem != P.get_n_elem()), "spdiagview: given object has incompatible size" ); (*this).zeros(); return; } if(is_same_type< T1, Gen, gen_ones> >::yes) { const Proxy P(o.get_ref()); arma_conform_check( (d_n_elem != P.get_n_elem()), "spdiagview: given object has incompatible size" ); (*this).ones(); return; } const quasi_unwrap U(o.get_ref()); const Mat& x = U.M; const eT* x_mem = x.memptr(); arma_conform_check ( ( (d_n_elem != x.n_elem) || ((x.n_rows != 1) && (x.n_cols != 1)) ), "spdiagview: given object has incompatible size" ); if( (d_row_offset == 0) && (d_col_offset == 0) ) { SpMat tmp1; tmp1.eye(d_m.n_rows, d_m.n_cols); bool has_zero = false; for(uword i=0; i < d_n_elem; ++i) { const eT val = x_mem[i]; access::rw(tmp1.values[i]) = val; if(val == eT(0)) { has_zero = true; } } if(has_zero) { tmp1.remove_zeros(); } if(tmp1.n_nonzero == 0) { (*this).zeros(); return; } SpMat tmp2; spglue_merge::diagview_merge(tmp2, d_m, tmp1); d_m.steal_mem(tmp2); } else { for(uword i=0; i < d_n_elem; ++i) { d_m.at(i + d_row_offset, i + d_col_offset) = x_mem[i]; } } } template template inline void spdiagview::operator+=(const Base& o) { arma_debug_sigprint(); spdiagview& d = *this; SpMat& d_m = const_cast< SpMat& >(d.m); const uword d_n_elem = d.n_elem; const uword d_row_offset = d.row_offset; const uword d_col_offset = d.col_offset; const Proxy P( o.get_ref() ); arma_conform_check ( ( (d_n_elem != P.get_n_elem()) || ((P.get_n_rows() != 1) && (P.get_n_cols() != 1)) ), "spdiagview: given object has incompatible size" ); if( (is_Mat::stored_type>::value) || (Proxy::use_at) ) { const unwrap::stored_type> tmp(P.Q); const Mat& x = tmp.M; const eT* x_mem = x.memptr(); for(uword i=0; i < d_n_elem; ++i) { d_m.at(i + d_row_offset, i + d_col_offset) += x_mem[i]; } } else { typename Proxy::ea_type Pea = P.get_ea(); for(uword i=0; i < d_n_elem; ++i) { d_m.at(i + d_row_offset, i + d_col_offset) += Pea[i]; } } } template template inline void spdiagview::operator-=(const Base& o) { arma_debug_sigprint(); spdiagview& d = *this; SpMat& d_m = const_cast< SpMat& >(d.m); const uword d_n_elem = d.n_elem; const uword d_row_offset = d.row_offset; const uword d_col_offset = d.col_offset; const Proxy P( o.get_ref() ); arma_conform_check ( ( (d_n_elem != P.get_n_elem()) || ((P.get_n_rows() != 1) && (P.get_n_cols() != 1)) ), "spdiagview: given object has incompatible size" ); if( (is_Mat::stored_type>::value) || (Proxy::use_at) ) { const unwrap::stored_type> tmp(P.Q); const Mat& x = tmp.M; const eT* x_mem = x.memptr(); for(uword i=0; i < d_n_elem; ++i) { d_m.at(i + d_row_offset, i + d_col_offset) -= x_mem[i]; } } else { typename Proxy::ea_type Pea = P.get_ea(); for(uword i=0; i < d_n_elem; ++i) { d_m.at(i + d_row_offset, i + d_col_offset) -= Pea[i]; } } } template template inline void spdiagview::operator%=(const Base& o) { arma_debug_sigprint(); spdiagview& d = *this; SpMat& d_m = const_cast< SpMat& >(d.m); const uword d_n_elem = d.n_elem; const uword d_row_offset = d.row_offset; const uword d_col_offset = d.col_offset; const Proxy P( o.get_ref() ); arma_conform_check ( ( (d_n_elem != P.get_n_elem()) || ((P.get_n_rows() != 1) && (P.get_n_cols() != 1)) ), "spdiagview: given object has incompatible size" ); if( (is_Mat::stored_type>::value) || (Proxy::use_at) ) { const unwrap::stored_type> tmp(P.Q); const Mat& x = tmp.M; const eT* x_mem = x.memptr(); for(uword i=0; i < d_n_elem; ++i) { d_m.at(i + d_row_offset, i + d_col_offset) *= x_mem[i]; } } else { typename Proxy::ea_type Pea = P.get_ea(); for(uword i=0; i < d_n_elem; ++i) { d_m.at(i + d_row_offset, i + d_col_offset) *= Pea[i]; } } } template template inline void spdiagview::operator/=(const Base& o) { arma_debug_sigprint(); spdiagview& d = *this; SpMat& d_m = const_cast< SpMat& >(d.m); const uword d_n_elem = d.n_elem; const uword d_row_offset = d.row_offset; const uword d_col_offset = d.col_offset; const Proxy P( o.get_ref() ); arma_conform_check ( ( (d_n_elem != P.get_n_elem()) || ((P.get_n_rows() != 1) && (P.get_n_cols() != 1)) ), "spdiagview: given object has incompatible size" ); if( (is_Mat::stored_type>::value) || (Proxy::use_at) ) { const unwrap::stored_type> tmp(P.Q); const Mat& x = tmp.M; const eT* x_mem = x.memptr(); for(uword i=0; i < d_n_elem; ++i) { d_m.at(i + d_row_offset, i + d_col_offset) /= x_mem[i]; } } else { typename Proxy::ea_type Pea = P.get_ea(); for(uword i=0; i < d_n_elem; ++i) { d_m.at(i + d_row_offset, i + d_col_offset) /= Pea[i]; } } } //! set a diagonal of our matrix using data from a foreign object template template inline void spdiagview::operator= (const SpBase& o) { arma_debug_sigprint(); const unwrap_spmat U( o.get_ref() ); const SpMat& x = U.M; arma_conform_check ( ( (n_elem != x.n_elem) || ((x.n_rows != 1) && (x.n_cols != 1)) ), "spdiagview: given object has incompatible size" ); const Mat tmp(x); (*this).operator=(tmp); } template template inline void spdiagview::operator+=(const SpBase& o) { arma_debug_sigprint(); spdiagview& d = *this; SpMat& d_m = const_cast< SpMat& >(d.m); const uword d_n_elem = d.n_elem; const uword d_row_offset = d.row_offset; const uword d_col_offset = d.col_offset; const SpProxy P( o.get_ref() ); arma_conform_check ( ( (d_n_elem != P.get_n_elem()) || ((P.get_n_rows() != 1) && (P.get_n_cols() != 1)) ), "spdiagview: given object has incompatible size" ); if( SpProxy::use_iterator || P.is_alias(d_m) ) { const SpMat tmp(P.Q); if(tmp.n_cols == 1) { for(uword i=0; i < d_n_elem; ++i) { d_m.at(i + d_row_offset, i + d_col_offset) += tmp.at(i,0); } } else if(tmp.n_rows == 1) { for(uword i=0; i < d_n_elem; ++i) { d_m.at(i + d_row_offset, i + d_col_offset) += tmp.at(0,i); } } } else { if(P.get_n_cols() == 1) { for(uword i=0; i < d_n_elem; ++i) { d_m.at(i + d_row_offset, i + d_col_offset) += P.at(i,0); } } else if(P.get_n_rows() == 1) { for(uword i=0; i < d_n_elem; ++i) { d_m.at(i + d_row_offset, i + d_col_offset) += P.at(0,i); } } } } template template inline void spdiagview::operator-=(const SpBase& o) { arma_debug_sigprint(); spdiagview& d = *this; SpMat& d_m = const_cast< SpMat& >(d.m); const uword d_n_elem = d.n_elem; const uword d_row_offset = d.row_offset; const uword d_col_offset = d.col_offset; const SpProxy P( o.get_ref() ); arma_conform_check ( ( (d_n_elem != P.get_n_elem()) || ((P.get_n_rows() != 1) && (P.get_n_cols() != 1)) ), "spdiagview: given object has incompatible size" ); if( SpProxy::use_iterator || P.is_alias(d_m) ) { const SpMat tmp(P.Q); if(tmp.n_cols == 1) { for(uword i=0; i < d_n_elem; ++i) { d_m.at(i + d_row_offset, i + d_col_offset) -= tmp.at(i,0); } } else if(tmp.n_rows == 1) { for(uword i=0; i < d_n_elem; ++i) { d_m.at(i + d_row_offset, i + d_col_offset) -= tmp.at(0,i); } } } else { if(P.get_n_cols() == 1) { for(uword i=0; i < d_n_elem; ++i) { d_m.at(i + d_row_offset, i + d_col_offset) -= P.at(i,0); } } else if(P.get_n_rows() == 1) { for(uword i=0; i < d_n_elem; ++i) { d_m.at(i + d_row_offset, i + d_col_offset) -= P.at(0,i); } } } } template template inline void spdiagview::operator%=(const SpBase& o) { arma_debug_sigprint(); spdiagview& d = *this; SpMat& d_m = const_cast< SpMat& >(d.m); const uword d_n_elem = d.n_elem; const uword d_row_offset = d.row_offset; const uword d_col_offset = d.col_offset; const SpProxy P( o.get_ref() ); arma_conform_check ( ( (d_n_elem != P.get_n_elem()) || ((P.get_n_rows() != 1) && (P.get_n_cols() != 1)) ), "spdiagview: given object has incompatible size" ); if( SpProxy::use_iterator || P.is_alias(d_m) ) { const SpMat tmp(P.Q); if(tmp.n_cols == 1) { for(uword i=0; i < d_n_elem; ++i) { d_m.at(i + d_row_offset, i + d_col_offset) *= tmp.at(i,0); } } else if(tmp.n_rows == 1) { for(uword i=0; i < d_n_elem; ++i) { d_m.at(i + d_row_offset, i + d_col_offset) *= tmp.at(0,i); } } } else { if(P.get_n_cols() == 1) { for(uword i=0; i < d_n_elem; ++i) { d_m.at(i + d_row_offset, i + d_col_offset) *= P.at(i,0); } } else if(P.get_n_rows() == 1) { for(uword i=0; i < d_n_elem; ++i) { d_m.at(i + d_row_offset, i + d_col_offset) *= P.at(0,i); } } } } template template inline void spdiagview::operator/=(const SpBase& o) { arma_debug_sigprint(); spdiagview& d = *this; SpMat& d_m = const_cast< SpMat& >(d.m); const uword d_n_elem = d.n_elem; const uword d_row_offset = d.row_offset; const uword d_col_offset = d.col_offset; const SpProxy P( o.get_ref() ); arma_conform_check ( ( (d_n_elem != P.get_n_elem()) || ((P.get_n_rows() != 1) && (P.get_n_cols() != 1)) ), "spdiagview: given object has incompatible size" ); if( SpProxy::use_iterator || P.is_alias(d_m) ) { const SpMat tmp(P.Q); if(tmp.n_cols == 1) { for(uword i=0; i < d_n_elem; ++i) { d_m.at(i + d_row_offset, i + d_col_offset) /= tmp.at(i,0); } } else if(tmp.n_rows == 1) { for(uword i=0; i < d_n_elem; ++i) { d_m.at(i + d_row_offset, i + d_col_offset) /= tmp.at(0,i); } } } else { if(P.get_n_cols() == 1) { for(uword i=0; i < d_n_elem; ++i) { d_m.at(i + d_row_offset, i + d_col_offset) /= P.at(i,0); } } else if(P.get_n_rows() == 1) { for(uword i=0; i < d_n_elem; ++i) { d_m.at(i + d_row_offset, i + d_col_offset) /= P.at(0,i); } } } } template inline void spdiagview::extract(SpMat& out, const spdiagview& d) { arma_debug_sigprint(); const SpMat& d_m = d.m; const uword d_n_elem = d.n_elem; const uword d_row_offset = d.row_offset; const uword d_col_offset = d.col_offset; Col cache(d_n_elem, arma_nozeros_indicator()); eT* cache_mem = cache.memptr(); uword d_n_nonzero = 0; for(uword i=0; i < d_n_elem; ++i) { const eT val = d_m.at(i + d_row_offset, i + d_col_offset); cache_mem[i] = val; d_n_nonzero += (val != eT(0)) ? uword(1) : uword(0); } out.reserve(d_n_elem, 1, d_n_nonzero); uword count = 0; for(uword i=0; i < d_n_elem; ++i) { const eT val = cache_mem[i]; if(val != eT(0)) { access::rw(out.row_indices[count]) = i; access::rw(out.values[count]) = val; ++count; } } access::rw(out.col_ptrs[0]) = 0; access::rw(out.col_ptrs[1]) = d_n_nonzero; } //! extract a diagonal and store it as a dense column vector template inline void spdiagview::extract(Mat& out, const spdiagview& in) { arma_debug_sigprint(); // NOTE: we're assuming that the 'out' matrix has already been set to the correct size; // size setting is done by either the Mat constructor or Mat::operator=() const SpMat& in_m = in.m; const uword in_n_elem = in.n_elem; const uword in_row_offset = in.row_offset; const uword in_col_offset = in.col_offset; eT* out_mem = out.memptr(); for(uword i=0; i < in_n_elem; ++i) { out_mem[i] = in_m.at(i + in_row_offset, i + in_col_offset); } } template inline SpMat_MapMat_val spdiagview::operator[](const uword i) { return (const_cast< SpMat& >(m)).at(i+row_offset, i+col_offset); } template inline eT spdiagview::operator[](const uword i) const { return m.at(i+row_offset, i+col_offset); } template inline SpMat_MapMat_val spdiagview::at(const uword i) { return (const_cast< SpMat& >(m)).at(i+row_offset, i+col_offset); } template inline eT spdiagview::at(const uword i) const { return m.at(i+row_offset, i+col_offset); } template inline SpMat_MapMat_val spdiagview::operator()(const uword i) { arma_conform_check_bounds( (i >= n_elem), "spdiagview::operator(): out of bounds" ); return (const_cast< SpMat& >(m)).at(i+row_offset, i+col_offset); } template inline eT spdiagview::operator()(const uword i) const { arma_conform_check_bounds( (i >= n_elem), "spdiagview::operator(): out of bounds" ); return m.at(i+row_offset, i+col_offset); } template inline SpMat_MapMat_val spdiagview::at(const uword row, const uword) { return (const_cast< SpMat& >(m)).at(row+row_offset, row+col_offset); } template inline eT spdiagview::at(const uword row, const uword) const { return m.at(row+row_offset, row+col_offset); } template inline SpMat_MapMat_val spdiagview::operator()(const uword row, const uword col) { arma_conform_check_bounds( ((row >= n_elem) || (col > 0)), "spdiagview::operator(): out of bounds" ); return (const_cast< SpMat& >(m)).at(row+row_offset, row+col_offset); } template inline eT spdiagview::operator()(const uword row, const uword col) const { arma_conform_check_bounds( ((row >= n_elem) || (col > 0)), "spdiagview::operator(): out of bounds" ); return m.at(row+row_offset, row+col_offset); } template inline void spdiagview::replace(const eT old_val, const eT new_val) { arma_debug_sigprint(); if(old_val == eT(0)) { arma_warn(1, "spdiagview::replace(): replacement not done, as old_val = 0"); } else { Mat tmp(*this); tmp.replace(old_val, new_val); (*this).operator=(tmp); } } template inline void spdiagview::clean(const typename get_pod_type::result threshold) { arma_debug_sigprint(); Mat tmp(*this); tmp.clean(threshold); (*this).operator=(tmp); } template inline void spdiagview::clamp(const eT min_val, const eT max_val) { arma_debug_sigprint(); SpMat tmp(*this); tmp.clamp(min_val, max_val); (*this).operator=(tmp); } template inline void spdiagview::fill(const eT val) { arma_debug_sigprint(); if( (row_offset == 0) && (col_offset == 0) && (m.sync_state != 1) ) { if(val == eT(0)) { SpMat tmp(arma_reserve_indicator(), m.n_rows, m.n_cols, m.n_nonzero); // worst case scenario typename SpMat::const_iterator it = m.begin(); typename SpMat::const_iterator it_end = m.end(); uword count = 0; for(; it != it_end; ++it) { const uword row = it.row(); const uword col = it.col(); if(row != col) { access::rw(tmp.values[count]) = (*it); access::rw(tmp.row_indices[count]) = row; access::rw(tmp.col_ptrs[col + 1])++; ++count; } } for(uword i=0; i < tmp.n_cols; ++i) { access::rw(tmp.col_ptrs[i + 1]) += tmp.col_ptrs[i]; } // quick resize without reallocating memory and copying data access::rw( tmp.n_nonzero) = count; access::rw( tmp.values[count]) = eT(0); access::rw(tmp.row_indices[count]) = uword(0); access::rw(m).steal_mem(tmp); } else // val != eT(0) { SpMat tmp1; tmp1.eye(m.n_rows, m.n_cols); if(val != eT(1)) { tmp1 *= val; } SpMat tmp2; spglue_merge::diagview_merge(tmp2, m, tmp1); access::rw(m).steal_mem(tmp2); } } else { SpMat& x = const_cast< SpMat& >(m); const uword local_n_elem = n_elem; for(uword i=0; i < local_n_elem; ++i) { x.at(i+row_offset, i+col_offset) = val; } } } template inline void spdiagview::zeros() { arma_debug_sigprint(); (*this).fill(eT(0)); } template inline void spdiagview::ones() { arma_debug_sigprint(); (*this).fill(eT(1)); } template inline void spdiagview::randu() { arma_debug_sigprint(); SpMat& x = const_cast< SpMat& >(m); const uword local_n_elem = n_elem; Col tmp(local_n_elem, arma_nozeros_indicator()); tmp.randu(); for(uword i=0; i < local_n_elem; ++i) { x.at(i+row_offset, i+col_offset) = tmp[i]; } } template inline void spdiagview::randn() { arma_debug_sigprint(); SpMat& x = const_cast< SpMat& >(m); const uword local_n_elem = n_elem; Col tmp(local_n_elem, arma_nozeros_indicator()); tmp.randn(); for(uword i=0; i < local_n_elem; ++i) { x.at(i+row_offset, i+col_offset) = tmp[i]; } } //! @} RcppArmadillo/inst/include/armadillo_bits/eGlueCube_meat.hpp0000644000176200001440000001014114631567470023761 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup eGlueCube //! @{ template arma_inline eGlueCube::~eGlueCube() { arma_debug_sigprint(); } template arma_inline eGlueCube::eGlueCube(const T1& in_A, const T2& in_B) : P1(in_A) , P2(in_B) { arma_debug_sigprint(); arma_conform_assert_same_size ( P1.get_n_rows(), P1.get_n_cols(), P1.get_n_slices(), P2.get_n_rows(), P2.get_n_cols(), P2.get_n_slices(), eglue_type::text() ); } template arma_inline uword eGlueCube::get_n_rows() const { return P1.get_n_rows(); } template arma_inline uword eGlueCube::get_n_cols() const { return P1.get_n_cols(); } template arma_inline uword eGlueCube::get_n_slices() const { return P1.get_n_slices(); } template arma_inline uword eGlueCube::get_n_elem_slice() const { return P1.get_n_elem_slice(); } template arma_inline uword eGlueCube::get_n_elem() const { return P1.get_n_elem(); } template arma_inline typename T1::elem_type eGlueCube::operator[] (const uword i) const { // the optimiser will keep only one return statement typedef typename T1::elem_type eT; if(is_same_type::yes) { return P1[i] + P2[i]; } else if(is_same_type::yes) { return P1[i] - P2[i]; } else if(is_same_type::yes) { return P1[i] / P2[i]; } else if(is_same_type::yes) { return P1[i] * P2[i]; } else return eT(0); } template arma_inline typename T1::elem_type eGlueCube::at(const uword row, const uword col, const uword slice) const { // the optimiser will keep only one return statement typedef typename T1::elem_type eT; if(is_same_type::yes) { return P1.at(row,col,slice) + P2.at(row,col,slice); } else if(is_same_type::yes) { return P1.at(row,col,slice) - P2.at(row,col,slice); } else if(is_same_type::yes) { return P1.at(row,col,slice) / P2.at(row,col,slice); } else if(is_same_type::yes) { return P1.at(row,col,slice) * P2.at(row,col,slice); } else return eT(0); } template arma_inline typename T1::elem_type eGlueCube::at_alt(const uword i) const { // the optimiser will keep only one return statement typedef typename T1::elem_type eT; if(is_same_type::yes) { return P1.at_alt(i) + P2.at_alt(i); } else if(is_same_type::yes) { return P1.at_alt(i) - P2.at_alt(i); } else if(is_same_type::yes) { return P1.at_alt(i) / P2.at_alt(i); } else if(is_same_type::yes) { return P1.at_alt(i) * P2.at_alt(i); } else return eT(0); } //! @} RcppArmadillo/inst/include/armadillo_bits/SpOp_bones.hpp0000644000176200001440000000357614752446051023173 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup SpOp //! @{ template class SpOp : public SpBase< typename T1::elem_type, SpOp > { public: typedef typename T1::elem_type elem_type; typedef typename get_pod_type::result pod_type; static constexpr bool is_row = op_type::template traits::is_row; static constexpr bool is_col = op_type::template traits::is_col; static constexpr bool is_xvec = op_type::template traits::is_xvec; inline explicit SpOp(const T1& in_m); inline SpOp(const T1& in_m, const elem_type in_aux); inline SpOp(const T1& in_m, const uword in_aux_uword_a, const uword in_aux_uword_b); inline ~SpOp(); arma_inline bool is_alias(const SpMat& X) const; const T1& m; //!< the operand; must be derived from SpBase elem_type aux; //!< auxiliary data, using the element type as used by T1 uword aux_uword_a; //!< auxiliary data, uword format uword aux_uword_b; //!< auxiliary data, uword format }; //! @} RcppArmadillo/inst/include/armadillo_bits/mtSpReduceOp_bones.hpp0000644000176200001440000000527514752446051024662 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup mtSpReduceOp //! @{ // NOTE: mtSpReduceOp is dedicated for reduction operations on sparse matrices, // NOTE: including sum(), min(), max(), mean(), var(), stddev(), // NOTE where the entire sparse matrix is reduced to a vector. // NOTE: // NOTE: Even though it would make more sense for mtSpReduceOp to be derived from Base // NOTE: (as it's more efficient to store the resulting vectors in dense format), // NOTE: mtSpReduceOp is derived from SpBase so the default user-accessible output is in sparse storage format. // NOTE. This is to mimic the behaviour of Octave and to keep compatibility with existing user code. // NOTE: // NOTE: However, for simplicity and efficiency, each mtSpReduceOp op_type::apply() function // NOTE: must output to a dense matrix, ie. apply(Mat, ...). // NOTE: The SpMat class handles mtSpReduceOp by converting the dense output to a sparse representation. // NOTE: The Mat class has an explicit constructor to efficiently handle mtSpReduceOp. template class mtSpReduceOp : public SpBase< out_eT, mtSpReduceOp > { public: typedef out_eT elem_type; typedef typename get_pod_type::result pod_type; typedef typename T1::elem_type in_eT; static constexpr bool is_row = op_type::template traits::is_row; static constexpr bool is_col = op_type::template traits::is_col; static constexpr bool is_xvec = op_type::template traits::is_xvec; inline explicit mtSpReduceOp(const T1& in_m); inline mtSpReduceOp(const T1& in_m, const uword in_aux_uword_a, const uword in_aux_uword_b); inline ~mtSpReduceOp(); const T1& m; //!< the operand; must be derived from SpBase uword aux_uword_a; //!< auxiliary data, uword format uword aux_uword_b; //!< auxiliary data, uword format }; //! @} RcppArmadillo/inst/include/armadillo_bits/upgrade_val.hpp0000644000176200001440000001203114301267044023370 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup upgrade_val //! @{ //! upgrade_val is used to ensure an operation such as multiplication is possible between two types. //! values are upgraded only where necessary. template struct upgrade_val { typedef typename promote_type::result T1_result; typedef typename promote_type::result T2_result; arma_inline static typename promote_type::result apply(const T1 x) { typedef typename promote_type::result out_type; return out_type(x); } arma_inline static typename promote_type::result apply(const T2 x) { typedef typename promote_type::result out_type; return out_type(x); } }; // template<> template struct upgrade_val { typedef T T1_result; typedef T T2_result; arma_inline static const T& apply(const T& x) { return x; } }; //! upgrade a type to allow multiplication with a complex type //! eg. the int in "int * complex" is upgraded to a double // template<> template struct upgrade_val< std::complex, T2 > { typedef std::complex T1_result; typedef T T2_result; arma_inline static const std::complex& apply(const std::complex& x) { return x; } arma_inline static T apply(const T2 x) { return T(x); } }; // template<> template struct upgrade_val< T1, std::complex > { typedef T T1_result; typedef std::complex T2_result; arma_inline static T apply(const T1 x) { return T(x); } arma_inline static const std::complex& apply(const std::complex& x) { return x; } }; //! ensure we don't lose precision when multiplying a complex number with a higher precision real number template<> struct upgrade_val< std::complex, double > { typedef std::complex T1_result; typedef double T2_result; arma_inline static const std::complex apply(const std::complex& x) { return std::complex(x); } arma_inline static double apply(const double x) { return x; } }; template<> struct upgrade_val< double, std::complex > { typedef double T1_result; typedef std::complex T2_result; arma_inline static double apply(const double x) { return x; } arma_inline static const std::complex apply(const std::complex& x) { return std::complex(x); } }; //! ensure we don't lose precision when multiplying complex numbers with different underlying types template<> struct upgrade_val< std::complex, std::complex > { typedef std::complex T1_result; typedef std::complex T2_result; arma_inline static const std::complex apply(const std::complex& x) { return std::complex(x); } arma_inline static const std::complex& apply(const std::complex& x) { return x; } }; template<> struct upgrade_val< std::complex, std::complex > { typedef std::complex T1_result; typedef std::complex T2_result; arma_inline static const std::complex& apply(const std::complex& x) { return x; } arma_inline static const std::complex apply(const std::complex& x) { return std::complex(x); } }; //! work around limitations in the complex class (at least as present in gcc 4.1 & 4.3) template<> struct upgrade_val< std::complex, float > { typedef std::complex T1_result; typedef double T2_result; arma_inline static const std::complex& apply(const std::complex& x) { return x; } arma_inline static double apply(const float x) { return double(x); } }; template<> struct upgrade_val< float, std::complex > { typedef double T1_result; typedef std::complex T2_result; arma_inline static double apply(const float x) { return double(x); } arma_inline static const std::complex& apply(const std::complex& x) { return x; } }; //! @} RcppArmadillo/inst/include/armadillo_bits/fn_vecnorm.hpp0000644000176200001440000002064414634016465023254 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_vecnorm //! @{ template arma_warn_unused inline typename enable_if2 < is_arma_type::value && resolves_to_vector::yes, typename T1::pod_type >::result vecnorm ( const T1& X, const uword k = uword(2), const arma_empty_class junk1 = arma_empty_class(), const typename arma_real_or_cx_only::result* junk2 = nullptr ) { arma_debug_sigprint(); arma_ignore(junk1); arma_ignore(junk2); typedef typename T1::pod_type T; const Proxy P(X); if(P.get_n_elem() == 0) { return T(0); } if(k == uword(1)) { return op_norm::vec_norm_1(P); } if(k == uword(2)) { return op_norm::vec_norm_2(P); } arma_conform_check( (k == 0), "vecnorm(): unsupported vector norm type" ); return op_norm::vec_norm_k(P, int(k)); } template arma_warn_unused inline typename enable_if2 < is_arma_type::value && resolves_to_vector::no, const mtOp >::result vecnorm ( const T1& X, const uword k = uword(2), const arma_empty_class junk1 = arma_empty_class(), const typename arma_real_or_cx_only::result* junk2 = nullptr ) { arma_debug_sigprint(); arma_ignore(junk1); arma_ignore(junk2); const uword dim = 0; return mtOp(X, k, dim); } template arma_warn_unused inline const mtOp vecnorm ( const Base& X, const uword k, const uword dim, const typename arma_real_or_cx_only::result* junk = nullptr ) { arma_debug_sigprint(); arma_ignore(junk); return mtOp(X.get_ref(), k, dim); } // template arma_warn_unused inline typename enable_if2 < is_arma_type::value && resolves_to_vector::yes, typename T1::pod_type >::result vecnorm ( const T1& X, const char* method, const arma_empty_class junk1 = arma_empty_class(), const typename arma_real_or_cx_only::result* junk2 = nullptr ) { arma_debug_sigprint(); arma_ignore(junk1); arma_ignore(junk2); typedef typename T1::pod_type T; const Proxy P(X); if(P.get_n_elem() == 0) { return T(0); } const char sig = (method != nullptr) ? method[0] : char(0); if( (sig == 'i') || (sig == 'I') || (sig == '+') ) { return op_norm::vec_norm_max(P); } if( (sig == '-') ) { return op_norm::vec_norm_min(P); } arma_stop_logic_error("vecnorm(): unsupported vector norm type"); return T(0); } template arma_warn_unused inline typename enable_if2 < is_arma_type::value && resolves_to_vector::no, const mtOp >::result vecnorm ( const T1& X, const char* method, const arma_empty_class junk1 = arma_empty_class(), const typename arma_real_or_cx_only::result* junk2 = nullptr ) { arma_debug_sigprint(); arma_ignore(junk1); arma_ignore(junk2); const char sig = (method != nullptr) ? method[0] : char(0); uword method_id = 0; if( (sig == 'i') || (sig == 'I') || (sig == '+') ) { method_id = 1; } if( (sig == '-') ) { method_id = 2; } const uword dim = 0; return mtOp(X, method_id, dim); } template arma_warn_unused inline const mtOp vecnorm ( const Base& X, const char* method, const uword dim, const typename arma_real_or_cx_only::result* junk = nullptr ) { arma_debug_sigprint(); arma_ignore(junk); const char sig = (method != nullptr) ? method[0] : char(0); uword method_id = 0; if( (sig == 'i') || (sig == 'I') || (sig == '+') ) { method_id = 1; } if( (sig == '-') ) { method_id = 2; } return mtOp(X.get_ref(), method_id, dim); } // // norms for sparse matrices template arma_warn_unused inline typename enable_if2 < is_arma_sparse_type::value && resolves_to_sparse_vector::yes, typename T1::pod_type >::result vecnorm ( const T1& X, const uword k = uword(2), const arma_empty_class junk1 = arma_empty_class(), const typename arma_real_or_cx_only::result* junk2 = nullptr ) { arma_debug_sigprint(); arma_ignore(junk1); arma_ignore(junk2); return arma::norm(X, k); } template arma_warn_unused inline typename enable_if2 < is_arma_sparse_type::value && resolves_to_sparse_vector::no, const mtSpReduceOp >::result vecnorm ( const T1& X, const uword k = uword(2), const arma_empty_class junk1 = arma_empty_class(), const typename arma_real_or_cx_only::result* junk2 = nullptr ) { arma_debug_sigprint(); arma_ignore(junk1); arma_ignore(junk2); const uword dim = 0; return mtSpReduceOp(X, k, dim); } template arma_warn_unused inline const mtSpReduceOp vecnorm ( const SpBase& X, const uword k, const uword dim, const typename arma_real_or_cx_only::result* junk = nullptr ) { arma_debug_sigprint(); arma_ignore(junk); return mtSpReduceOp(X.get_ref(), k, dim); } // template arma_warn_unused inline typename enable_if2 < is_arma_sparse_type::value && resolves_to_sparse_vector::yes, typename T1::pod_type >::result vecnorm ( const T1& X, const char* method, const arma_empty_class junk1 = arma_empty_class(), const typename arma_real_or_cx_only::result* junk2 = nullptr ) { arma_debug_sigprint(); arma_ignore(junk1); arma_ignore(junk2); return arma::norm(X, method); } template arma_warn_unused inline typename enable_if2 < is_arma_sparse_type::value && resolves_to_sparse_vector::no, const mtSpReduceOp >::result vecnorm ( const T1& X, const char* method, const arma_empty_class junk1 = arma_empty_class(), const typename arma_real_or_cx_only::result* junk2 = nullptr ) { arma_debug_sigprint(); arma_ignore(junk1); arma_ignore(junk2); const char sig = (method != nullptr) ? method[0] : char(0); uword method_id = 0; if( (sig == 'i') || (sig == 'I') || (sig == '+') ) { method_id = 1; } if( (sig == '-') ) { method_id = 2; } const uword dim = 0; return mtSpReduceOp(X, method_id, dim); } template arma_warn_unused inline const mtSpReduceOp vecnorm ( const SpBase& X, const char* method, const uword dim, const typename arma_real_or_cx_only::result* junk = nullptr ) { arma_debug_sigprint(); arma_ignore(junk); const char sig = (method != nullptr) ? method[0] : char(0); uword method_id = 0; if( (sig == 'i') || (sig == 'I') || (sig == '+') ) { method_id = 1; } if( (sig == '-') ) { method_id = 2; } return mtSpReduceOp(X.get_ref(), method_id, dim); } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_index_min.hpp0000644000176200001440000000612514631567470023557 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_index_min //! @{ template arma_warn_unused inline typename enable_if2< is_arma_type::value && resolves_to_vector::yes, uword>::result index_min(const T1& X) { arma_debug_sigprint(); return X.index_min(); } template arma_warn_unused arma_inline typename enable_if2< is_arma_type::value && resolves_to_vector::no, const mtOp >::result index_min(const T1& X) { arma_debug_sigprint(); return mtOp(X, 0, 0); } template arma_warn_unused arma_inline typename enable_if2< is_arma_type::value, const mtOp >::result index_min(const T1& X, const uword dim) { arma_debug_sigprint(); return mtOp(X, dim, 0); } template arma_warn_unused arma_inline const mtOpCube index_min ( const BaseCube& X, const uword dim = 0 ) { arma_debug_sigprint(); return mtOpCube(X.get_ref(), dim, 0, 0); } template arma_warn_unused inline typename enable_if2 < is_arma_sparse_type::value && resolves_to_sparse_vector::yes, typename T1::elem_type >::result index_min(const T1& x) { arma_debug_sigprint(); return x.index_min(); } template arma_warn_unused inline typename enable_if2 < is_arma_sparse_type::value && resolves_to_sparse_vector::no, Mat >::result index_min(const T1& X) { arma_debug_sigprint(); Mat out; op_index_min::apply(out, X, 0); return out; } template arma_warn_unused inline typename enable_if2 < is_arma_sparse_type::value, Mat >::result index_min(const T1& X, const uword dim) { arma_debug_sigprint(); Mat out; op_index_min::apply(out, X, dim); return out; } arma_warn_unused inline uword index_min(const SizeMat& s) { return (s.n_rows <= s.n_cols) ? uword(0) : uword(1); } arma_warn_unused inline uword index_min(const SizeCube& s) { const uword tmp_val = (s.n_rows <= s.n_cols) ? s.n_rows : s.n_cols; const uword tmp_index = (s.n_rows <= s.n_cols) ? uword(0) : uword(1); return (tmp_val <= s.n_slices) ? tmp_index : uword(2); } //! @} RcppArmadillo/inst/include/armadillo_bits/op_chi2rnd_meat.hpp0000644000176200001440000000665414631567470024166 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_chi2rnd //! @{ template inline void op_chi2rnd::apply(Mat& out, const Op& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const Proxy P(in.m); if(P.is_alias(out) == false) { op_chi2rnd::apply_noalias(out, P); } else { Mat tmp; op_chi2rnd::apply_noalias(tmp, P); out.steal_mem(tmp); } } template inline void op_chi2rnd::apply_noalias(Mat& out, const Proxy& P) { arma_debug_sigprint(); typedef typename T1::elem_type eT; op_chi2rnd_varying_df generator; const uword n_rows = P.get_n_rows(); const uword n_cols = P.get_n_cols(); out.set_size(n_rows, n_cols); eT* out_mem = out.memptr(); if(Proxy::use_at == false) { const uword N = P.get_n_elem(); typename Proxy::ea_type Pea = P.get_ea(); for(uword i=0; i inline void op_chi2rnd::fill_constant_df(Mat& out, const eT df) { arma_debug_sigprint(); if(df > eT(0)) { typedef std::mt19937_64 motor_type; typedef std::mt19937_64::result_type seed_type; typedef std::chi_squared_distribution distr_type; motor_type motor; motor.seed( seed_type(arma_rng::randi()) ); distr_type distr(df); const uword N = out.n_elem; eT* out_mem = out.memptr(); for(uword i=0; i::nan ); } } // template inline op_chi2rnd_varying_df::~op_chi2rnd_varying_df() { arma_debug_sigprint(); } template inline op_chi2rnd_varying_df::op_chi2rnd_varying_df() { arma_debug_sigprint(); typedef std::mt19937_64::result_type seed_type; motor.seed( seed_type(arma_rng::randi()) ); } template inline eT op_chi2rnd_varying_df::operator()(const eT df) { arma_debug_sigprint(); // as C++11 doesn't seem to provide a way to explicitly set the parameter // of an existing chi_squared_distribution object, // we need to create a new object each time if(df > eT(0)) { std::chi_squared_distribution distr(df); return eT( distr(motor) ); } else { return Datum::nan; } } //! @} RcppArmadillo/inst/include/armadillo_bits/eOp_meat.hpp0000644000176200001440000000624514715372502022647 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup eOp //! @{ template inline eOp::eOp(const T1& in_m) : P(in_m) { arma_debug_sigprint(); } template inline eOp::eOp(const T1& in_m, const typename T1::elem_type in_aux) : P(in_m) , aux(in_aux) { arma_debug_sigprint(); } template inline eOp::eOp(const T1& in_m, const uword in_aux_uword_a, const uword in_aux_uword_b) : P(in_m) , aux_uword_a(in_aux_uword_a) , aux_uword_b(in_aux_uword_b) { arma_debug_sigprint(); } template inline eOp::eOp(const T1& in_m, const typename T1::elem_type in_aux, const uword in_aux_uword_a, const uword in_aux_uword_b) : P(in_m) , aux(in_aux) , aux_uword_a(in_aux_uword_a) , aux_uword_b(in_aux_uword_b) { arma_debug_sigprint(); } template inline eOp::~eOp() { arma_debug_sigprint(); } template template inline bool eOp::is_alias(const Mat& X) const { arma_debug_sigprint(); return P.is_alias(X); } template arma_inline uword eOp::get_n_rows() const { return is_row ? 1 : P.get_n_rows(); } template arma_inline uword eOp::get_n_cols() const { return is_col ? 1 : P.get_n_cols(); } template arma_inline uword eOp::get_n_elem() const { return P.get_n_elem(); } template arma_inline typename T1::elem_type eOp::operator[] (const uword ii) const { return eop_core::process(P[ii], aux); } template arma_inline typename T1::elem_type eOp::at(const uword row, const uword col) const { if(is_row) { return eop_core::process(P.at(0, col), aux); } else if(is_col) { return eop_core::process(P.at(row, 0), aux); } else { return eop_core::process(P.at(row, col), aux); } } template arma_inline typename T1::elem_type eOp::at_alt(const uword ii) const { return eop_core::process(P.at_alt(ii), aux); } //! @} RcppArmadillo/inst/include/armadillo_bits/access.hpp0000644000176200001440000000417014301267043022344 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup access //! @{ class access { public: //! internal function to allow modification of data declared as read-only (use with caution) template constexpr static T1& rw (const T1& x) { return const_cast(x); } template constexpr static T1*& rwp(const T1* const& x) { return const_cast(x); } //! internal function to obtain the real part of either a plain number or a complex number template constexpr static const eT& tmp_real(const eT& X) { return X; } template constexpr static const T tmp_real(const std::complex& X) { return X.real(); } //! internal function to obtain the imag part of either a plain number or a complex number template constexpr static const eT tmp_imag(const eT ) { return eT(0); } template constexpr static const T tmp_imag(const std::complex& X) { return X.imag(); } //! internal function to work around braindead compilers template constexpr static const typename enable_if2::no, const eT&>::result alt_conj(const eT& X) { return X; } template arma_inline static const typename enable_if2::yes, const eT >::result alt_conj(const eT& X) { return std::conj(X); } }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_sum_bones.hpp0000644000176200001440000000405614752446051023606 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_sum //! @{ class op_sum : public traits_op_xvec { public: // dense matrices template inline static void apply(Mat& out, const Op< T1, op_sum >& in); template inline static void apply(Mat& out, const Op< eOp, op_sum >& in); template inline static void apply(Mat& out, const Op< eOp, op_sum >& in); template inline static void apply_mat_noalias(Mat& out, const Mat& X, const uword dim); template inline static void apply_mat_square_noalias(Mat& out, const Mat& X, const uword dim); template inline static void apply_proxy_noalias(Mat& out, const Proxy& P, const uword dim); // cubes template inline static void apply(Cube& out, const OpCube& in); template inline static void apply_cube_noalias(Cube& out, const Cube& X, const uword dim); template inline static void apply_proxy_noalias(Cube& out, const ProxyCube& P, const uword dim); }; //! @} RcppArmadillo/inst/include/armadillo_bits/include_hdf5.hpp0000644000176200001440000000306614374704744023455 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ #if defined(ARMA_USE_HDF5) #undef H5_USE_110_API #define H5_USE_110_API #if defined(__has_include) #if __has_include() #include #else #undef ARMA_USE_HDF5 #pragma message ("WARNING: use of HDF5 disabled; hdf5.h header not found") #endif #else #include #endif #if defined(H5_USE_16_API) || defined(H5_USE_16_API_DEFAULT) #pragma message ("WARNING: use of HDF5 disabled; incompatible configuration: H5_USE_16_API or H5_USE_16_API_DEFAULT") #undef ARMA_USE_HDF5 #endif // // TODO // #if defined(H5_USE_18_API) || defined(H5_USE_18_API_DEFAULT) // #pragma message ("WARNING: detected possibly incompatible configuration of HDF5: H5_USE_18_API or H5_USE_18_API_DEFAULT") // #endif #endif RcppArmadillo/inst/include/armadillo_bits/op_inv_gen_bones.hpp0000644000176200001440000001067714476055675024450 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_inv_gen //! @{ class op_inv_gen_default : public traits_op_default { public: template inline static void apply(Mat& out, const Op& in); template inline static bool apply_direct(Mat& out, const Base& expr, const char* caller_sig); }; class op_inv_gen_full : public traits_op_default { public: template struct pos { static constexpr uword n2 = row + col*2; static constexpr uword n3 = row + col*3; }; template inline static void apply(Mat& out, const Op& in); template inline static bool apply_direct(Mat& out, const Base& expr, const char* caller_sig, const uword flags); template arma_cold inline static bool apply_tiny_2x2(Mat& X); template arma_cold inline static bool apply_tiny_3x3(Mat& X); }; template struct op_inv_gen_state { uword size = uword(0); T rcond = T(0); bool is_diag = false; bool is_sym = false; }; class op_inv_gen_rcond : public traits_op_default { public: template inline static bool apply_direct(Mat& out_inv, op_inv_gen_state& out_state, const Base& expr); }; namespace inv_opts { struct opts { const uword flags; inline constexpr explicit opts(const uword in_flags); inline const opts operator+(const opts& rhs) const; }; inline constexpr opts::opts(const uword in_flags) : flags(in_flags) {} inline const opts opts::operator+(const opts& rhs) const { const opts result( flags | rhs.flags ); return result; } // The values below (eg. 1u << 1) are for internal Armadillo use only. // The values can change without notice. static constexpr uword flag_none = uword(0 ); static constexpr uword flag_fast = uword(1u << 0); static constexpr uword flag_tiny = uword(1u << 0); // deprecated static constexpr uword flag_allow_approx = uword(1u << 1); static constexpr uword flag_likely_sympd = uword(1u << 2); // deprecated static constexpr uword flag_no_sympd = uword(1u << 3); // deprecated static constexpr uword flag_no_ugly = uword(1u << 4); struct opts_none : public opts { inline constexpr opts_none() : opts(flag_none ) {} }; struct opts_fast : public opts { inline constexpr opts_fast() : opts(flag_fast ) {} }; struct opts_tiny : public opts { inline constexpr opts_tiny() : opts(flag_tiny ) {} }; struct opts_allow_approx : public opts { inline constexpr opts_allow_approx() : opts(flag_allow_approx) {} }; struct opts_likely_sympd : public opts { inline constexpr opts_likely_sympd() : opts(flag_likely_sympd) {} }; struct opts_no_sympd : public opts { inline constexpr opts_no_sympd() : opts(flag_no_sympd ) {} }; struct opts_no_ugly : public opts { inline constexpr opts_no_ugly() : opts(flag_no_ugly ) {} }; static constexpr opts_none none; static constexpr opts_fast fast; static constexpr opts_tiny tiny; static constexpr opts_allow_approx allow_approx; static constexpr opts_likely_sympd likely_sympd; static constexpr opts_no_sympd no_sympd; static constexpr opts_no_ugly no_ugly; } //! @} RcppArmadillo/inst/include/armadillo_bits/typedef_mat.hpp0000644000176200001440000000756114301267044023414 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup typedef_mat //! @{ typedef Mat uchar_mat; typedef Col uchar_vec; typedef Col uchar_colvec; typedef Row uchar_rowvec; typedef Cube uchar_cube; typedef Mat u32_mat; typedef Col u32_vec; typedef Col u32_colvec; typedef Row u32_rowvec; typedef Cube u32_cube; typedef Mat s32_mat; typedef Col s32_vec; typedef Col s32_colvec; typedef Row s32_rowvec; typedef Cube s32_cube; typedef Mat u64_mat; typedef Col u64_vec; typedef Col u64_colvec; typedef Row u64_rowvec; typedef Cube u64_cube; typedef Mat s64_mat; typedef Col s64_vec; typedef Col s64_colvec; typedef Row s64_rowvec; typedef Cube s64_cube; typedef Mat umat; typedef Col uvec; typedef Col ucolvec; typedef Row urowvec; typedef Cube ucube; typedef Mat imat; typedef Col ivec; typedef Col icolvec; typedef Row irowvec; typedef Cube icube; typedef Mat fmat; typedef Col fvec; typedef Col fcolvec; typedef Row frowvec; typedef Cube fcube; typedef Mat dmat; typedef Col dvec; typedef Col dcolvec; typedef Row drowvec; typedef Cube dcube; typedef Mat mat; typedef Col vec; typedef Col colvec; typedef Row rowvec; typedef Cube cube; typedef Mat cx_fmat; typedef Col cx_fvec; typedef Col cx_fcolvec; typedef Row cx_frowvec; typedef Cube cx_fcube; typedef Mat cx_dmat; typedef Col cx_dvec; typedef Col cx_dcolvec; typedef Row cx_drowvec; typedef Cube cx_dcube; typedef Mat cx_mat; typedef Col cx_vec; typedef Col cx_colvec; typedef Row cx_rowvec; typedef Cube cx_cube; typedef SpMat sp_umat; typedef SpCol sp_uvec; typedef SpCol sp_ucolvec; typedef SpRow sp_urowvec; typedef SpMat sp_imat; typedef SpCol sp_ivec; typedef SpCol sp_icolvec; typedef SpRow sp_irowvec; typedef SpMat sp_fmat; typedef SpCol sp_fvec; typedef SpCol sp_fcolvec; typedef SpRow sp_frowvec; typedef SpMat sp_dmat; typedef SpCol sp_dvec; typedef SpCol sp_dcolvec; typedef SpRow sp_drowvec; typedef SpMat sp_mat; typedef SpCol sp_vec; typedef SpCol sp_colvec; typedef SpRow sp_rowvec; typedef SpMat sp_cx_fmat; typedef SpCol sp_cx_fvec; typedef SpCol sp_cx_fcolvec; typedef SpRow sp_cx_frowvec; typedef SpMat sp_cx_dmat; typedef SpCol sp_cx_dvec; typedef SpCol sp_cx_dcolvec; typedef SpRow sp_cx_drowvec; typedef SpMat sp_cx_mat; typedef SpCol sp_cx_vec; typedef SpCol sp_cx_colvec; typedef SpRow sp_cx_rowvec; //! @} RcppArmadillo/inst/include/armadillo_bits/gmm_diag_meat.hpp0000644000176200001440000020020015030507611023643 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup gmm_diag //! @{ namespace gmm_priv { template inline gmm_diag::~gmm_diag() { arma_debug_sigprint_this(this); arma_type_check(( (is_same_type::value == false) && (is_same_type::value == false) )); } template inline gmm_diag::gmm_diag() { arma_debug_sigprint_this(this); } template inline gmm_diag::gmm_diag(const gmm_diag& x) { arma_debug_sigprint_this(this); init(x); } template inline gmm_diag& gmm_diag::operator=(const gmm_diag& x) { arma_debug_sigprint(); init(x); return *this; } template inline gmm_diag::gmm_diag(const gmm_full& x) { arma_debug_sigprint_this(this); init(x); } template inline gmm_diag& gmm_diag::operator=(const gmm_full& x) { arma_debug_sigprint(); init(x); return *this; } template inline gmm_diag::gmm_diag(const uword in_n_dims, const uword in_n_gaus) { arma_debug_sigprint_this(this); init(in_n_dims, in_n_gaus); } template inline void gmm_diag::reset() { arma_debug_sigprint(); init(0, 0); } template inline void gmm_diag::reset(const uword in_n_dims, const uword in_n_gaus) { arma_debug_sigprint(); init(in_n_dims, in_n_gaus); } template template inline void gmm_diag::set_params(const Base& in_means_expr, const Base& in_dcovs_expr, const Base& in_hefts_expr) { arma_debug_sigprint(); const unwrap tmp1(in_means_expr.get_ref()); const unwrap tmp2(in_dcovs_expr.get_ref()); const unwrap tmp3(in_hefts_expr.get_ref()); const Mat& in_means = tmp1.M; const Mat& in_dcovs = tmp2.M; const Mat& in_hefts = tmp3.M; arma_conform_check ( (arma::size(in_means) != arma::size(in_dcovs)) || (in_hefts.n_cols != in_means.n_cols) || (in_hefts.n_rows != 1), "gmm_diag::set_params(): given parameters have inconsistent and/or wrong sizes" ); arma_conform_check( (in_means.internal_has_nonfinite()), "gmm_diag::set_params(): given means have non-finite values" ); arma_conform_check( (in_dcovs.internal_has_nonfinite()), "gmm_diag::set_params(): given dcovs have non-finite values" ); arma_conform_check( (in_hefts.internal_has_nonfinite()), "gmm_diag::set_params(): given hefts have non-finite values" ); arma_conform_check( (any(vectorise(in_dcovs) <= eT(0))), "gmm_diag::set_params(): given dcovs have negative or zero values" ); arma_conform_check( (any(vectorise(in_hefts) < eT(0))), "gmm_diag::set_params(): given hefts have negative values" ); const eT s = accu(in_hefts); arma_conform_check( ((s < (eT(1) - eT(0.001))) || (s > (eT(1) + eT(0.001)))), "gmm_diag::set_params(): sum of given hefts is not 1" ); access::rw(means) = in_means; access::rw(dcovs) = in_dcovs; access::rw(hefts) = in_hefts; init_constants(); } template template inline void gmm_diag::set_means(const Base& in_means_expr) { arma_debug_sigprint(); const unwrap tmp(in_means_expr.get_ref()); const Mat& in_means = tmp.M; arma_conform_check( (arma::size(in_means) != arma::size(means)), "gmm_diag::set_means(): given means have incompatible size" ); arma_conform_check( (in_means.internal_has_nonfinite()), "gmm_diag::set_means(): given means have non-finite values" ); access::rw(means) = in_means; } template template inline void gmm_diag::set_dcovs(const Base& in_dcovs_expr) { arma_debug_sigprint(); const unwrap tmp(in_dcovs_expr.get_ref()); const Mat& in_dcovs = tmp.M; arma_conform_check( (arma::size(in_dcovs) != arma::size(dcovs)), "gmm_diag::set_dcovs(): given dcovs have incompatible size" ); arma_conform_check( (in_dcovs.internal_has_nonfinite()), "gmm_diag::set_dcovs(): given dcovs have non-finite values" ); arma_conform_check( (any(vectorise(in_dcovs) <= eT(0))), "gmm_diag::set_dcovs(): given dcovs have negative or zero values" ); access::rw(dcovs) = in_dcovs; init_constants(); } template template inline void gmm_diag::set_hefts(const Base& in_hefts_expr) { arma_debug_sigprint(); const unwrap tmp(in_hefts_expr.get_ref()); const Mat& in_hefts = tmp.M; arma_conform_check( (arma::size(in_hefts) != arma::size(hefts)), "gmm_diag::set_hefts(): given hefts have incompatible size" ); arma_conform_check( (in_hefts.internal_has_nonfinite()), "gmm_diag::set_hefts(): given hefts have non-finite values" ); arma_conform_check( (any(vectorise(in_hefts) < eT(0))), "gmm_diag::set_hefts(): given hefts have negative values" ); const eT s = accu(in_hefts); arma_conform_check( ((s < (eT(1) - eT(0.001))) || (s > (eT(1) + eT(0.001)))), "gmm_diag::set_hefts(): sum of given hefts is not 1" ); // make sure all hefts are positive and non-zero const eT* in_hefts_mem = in_hefts.memptr(); eT* hefts_mem = access::rw(hefts).memptr(); for(uword i=0; i < hefts.n_elem; ++i) { hefts_mem[i] = (std::max)( in_hefts_mem[i], std::numeric_limits::min() ); } access::rw(hefts) /= accu(hefts); log_hefts = log(hefts); } template inline uword gmm_diag::n_dims() const { return means.n_rows; } template inline uword gmm_diag::n_gaus() const { return means.n_cols; } template inline bool gmm_diag::load(const std::string name) { arma_debug_sigprint(); Cube Q; bool status = Q.load(name, arma_binary); if( (status == false) || (Q.n_slices != 2) ) { reset(); arma_warn(3, "gmm_diag::load(): problem with loading or incompatible format"); return false; } if( (Q.n_rows < 2) || (Q.n_cols < 1) ) { reset(); return true; } access::rw(hefts) = Q.slice(0).row(0); access::rw(means) = Q.slice(0).submat(1, 0, Q.n_rows-1, Q.n_cols-1); access::rw(dcovs) = Q.slice(1).submat(1, 0, Q.n_rows-1, Q.n_cols-1); init_constants(); return true; } template inline bool gmm_diag::save(const std::string name) const { arma_debug_sigprint(); Cube Q(means.n_rows + 1, means.n_cols, 2, arma_nozeros_indicator()); if(Q.n_elem > 0) { Q.slice(0).row(0) = hefts; Q.slice(1).row(0).zeros(); // reserved for future use Q.slice(0).submat(1, 0, arma::size(means)) = means; Q.slice(1).submat(1, 0, arma::size(dcovs)) = dcovs; } const bool status = Q.save(name, arma_binary); return status; } template inline Col gmm_diag::generate() const { arma_debug_sigprint(); const uword N_dims = means.n_rows; const uword N_gaus = means.n_cols; Col out( ((N_gaus > 0) ? N_dims : uword(0)), fill::randn ); if(N_gaus > 0) { const double val = randu(); double csum = double(0); uword gaus_id = 0; for(uword j=0; j < N_gaus; ++j) { csum += hefts[j]; if(val <= csum) { gaus_id = j; break; } } out %= sqrt(dcovs.col(gaus_id)); out += means.col(gaus_id); } return out; } template inline Mat gmm_diag::generate(const uword N_vec) const { arma_debug_sigprint(); const uword N_dims = means.n_rows; const uword N_gaus = means.n_cols; Mat out( ( (N_gaus > 0) ? N_dims : uword(0) ), N_vec, fill::randn ); if(N_gaus > 0) { const eT* hefts_mem = hefts.memptr(); const Mat sqrt_dcovs = sqrt(dcovs); for(uword i=0; i < N_vec; ++i) { const double val = randu(); double csum = double(0); uword gaus_id = 0; for(uword j=0; j < N_gaus; ++j) { csum += hefts_mem[j]; if(val <= csum) { gaus_id = j; break; } } subview_col out_col = out.col(i); out_col %= sqrt_dcovs.col(gaus_id); out_col += means.col(gaus_id); } } return out; } template template inline eT gmm_diag::log_p(const T1& expr, const gmm_empty_arg& junk1, typename enable_if<((is_arma_type::value) && (resolves_to_colvector::value == true))>::result* junk2) const { arma_debug_sigprint(); arma_ignore(junk1); arma_ignore(junk2); const quasi_unwrap tmp(expr); arma_conform_check( (tmp.M.n_rows != means.n_rows), "gmm_diag::log_p(): incompatible dimensions" ); return internal_scalar_log_p( tmp.M.memptr() ); } template template inline eT gmm_diag::log_p(const T1& expr, const uword gaus_id, typename enable_if<((is_arma_type::value) && (resolves_to_colvector::value == true))>::result* junk2) const { arma_debug_sigprint(); arma_ignore(junk2); const quasi_unwrap tmp(expr); arma_conform_check( (tmp.M.n_rows != means.n_rows), "gmm_diag::log_p(): incompatible dimensions" ); arma_conform_check( (gaus_id >= means.n_cols), "gmm_diag::log_p(): specified gaussian is out of range" ); return internal_scalar_log_p( tmp.M.memptr(), gaus_id ); } template template inline Row gmm_diag::log_p(const T1& expr, const gmm_empty_arg& junk1, typename enable_if<((is_arma_type::value) && (resolves_to_colvector::value == false))>::result* junk2) const { arma_debug_sigprint(); arma_ignore(junk1); arma_ignore(junk2); const quasi_unwrap tmp(expr); const Mat& X = tmp.M; return internal_vec_log_p(X); } template template inline Row gmm_diag::log_p(const T1& expr, const uword gaus_id, typename enable_if<((is_arma_type::value) && (resolves_to_colvector::value == false))>::result* junk2) const { arma_debug_sigprint(); arma_ignore(junk2); const quasi_unwrap tmp(expr); const Mat& X = tmp.M; return internal_vec_log_p(X, gaus_id); } template template inline eT gmm_diag::sum_log_p(const Base& expr) const { arma_debug_sigprint(); const quasi_unwrap tmp(expr.get_ref()); const Mat& X = tmp.M; return internal_sum_log_p(X); } template template inline eT gmm_diag::sum_log_p(const Base& expr, const uword gaus_id) const { arma_debug_sigprint(); const quasi_unwrap tmp(expr.get_ref()); const Mat& X = tmp.M; return internal_sum_log_p(X, gaus_id); } template template inline eT gmm_diag::avg_log_p(const Base& expr) const { arma_debug_sigprint(); const quasi_unwrap tmp(expr.get_ref()); const Mat& X = tmp.M; return internal_avg_log_p(X); } template template inline eT gmm_diag::avg_log_p(const Base& expr, const uword gaus_id) const { arma_debug_sigprint(); const quasi_unwrap tmp(expr.get_ref()); const Mat& X = tmp.M; return internal_avg_log_p(X, gaus_id); } template template inline uword gmm_diag::assign(const T1& expr, const gmm_dist_mode& dist, typename enable_if<((is_arma_type::value) && (resolves_to_colvector::value == true))>::result* junk) const { arma_debug_sigprint(); arma_ignore(junk); const quasi_unwrap tmp(expr); const Mat& X = tmp.M; return internal_scalar_assign(X, dist); } template template inline urowvec gmm_diag::assign(const T1& expr, const gmm_dist_mode& dist, typename enable_if<((is_arma_type::value) && (resolves_to_colvector::value == false))>::result* junk) const { arma_debug_sigprint(); arma_ignore(junk); urowvec out; const quasi_unwrap tmp(expr); const Mat& X = tmp.M; internal_vec_assign(out, X, dist); return out; } template template inline urowvec gmm_diag::raw_hist(const Base& expr, const gmm_dist_mode& dist_mode) const { arma_debug_sigprint(); const unwrap tmp(expr.get_ref()); const Mat& X = tmp.M; arma_conform_check( (X.n_rows != means.n_rows), "gmm_diag::raw_hist(): incompatible dimensions" ); arma_conform_check( ((dist_mode != eucl_dist) && (dist_mode != prob_dist)), "gmm_diag::raw_hist(): unsupported distance mode" ); urowvec hist; internal_raw_hist(hist, X, dist_mode); return hist; } template template inline Row gmm_diag::norm_hist(const Base& expr, const gmm_dist_mode& dist_mode) const { arma_debug_sigprint(); const unwrap tmp(expr.get_ref()); const Mat& X = tmp.M; arma_conform_check( (X.n_rows != means.n_rows), "gmm_diag::norm_hist(): incompatible dimensions" ); arma_conform_check( ((dist_mode != eucl_dist) && (dist_mode != prob_dist)), "gmm_diag::norm_hist(): unsupported distance mode" ); urowvec hist; internal_raw_hist(hist, X, dist_mode); const uword hist_n_elem = hist.n_elem; const uword* hist_mem = hist.memptr(); eT acc = eT(0); for(uword i=0; i out(hist_n_elem, arma_nozeros_indicator()); eT* out_mem = out.memptr(); for(uword i=0; i template inline bool gmm_diag::learn ( const Base& data, const uword N_gaus, const gmm_dist_mode& dist_mode, const gmm_seed_mode& seed_mode, const uword km_iter, const uword em_iter, const eT var_floor, const bool print_mode ) { arma_debug_sigprint(); const bool dist_mode_ok = (dist_mode == eucl_dist) || (dist_mode == maha_dist); const bool seed_mode_ok = \ (seed_mode == keep_existing) || (seed_mode == static_subset) || (seed_mode == static_spread) || (seed_mode == random_subset) || (seed_mode == random_spread); arma_conform_check( (dist_mode_ok == false), "gmm_diag::learn(): dist_mode must be eucl_dist or maha_dist" ); arma_conform_check( (seed_mode_ok == false), "gmm_diag::learn(): unknown seed_mode" ); arma_conform_check( (var_floor < eT(0) ), "gmm_diag::learn(): variance floor is negative" ); const unwrap tmp_X(data.get_ref()); const Mat& X = tmp_X.M; if(X.is_empty() ) { arma_warn(3, "gmm_diag::learn(): given matrix is empty" ); return false; } if(X.internal_has_nonfinite()) { arma_warn(3, "gmm_diag::learn(): given matrix has non-finite values"); return false; } if(N_gaus == 0) { reset(); return true; } if(dist_mode == maha_dist) { mah_aux = var(X,1,1); const uword mah_aux_n_elem = mah_aux.n_elem; eT* mah_aux_mem = mah_aux.memptr(); for(uword i=0; i < mah_aux_n_elem; ++i) { const eT val = mah_aux_mem[i]; mah_aux_mem[i] = ((val != eT(0)) && arma_isfinite(val)) ? eT(1) / val : eT(1); } } // copy current model, in case of failure by k-means and/or EM const gmm_diag orig = (*this); // initial means if(seed_mode == keep_existing) { if(means.is_empty() ) { arma_warn(3, "gmm_diag::learn(): no existing means" ); return false; } if(X.n_rows != means.n_rows) { arma_warn(3, "gmm_diag::learn(): dimensionality mismatch"); return false; } // TODO: also check for number of vectors? } else { if(X.n_cols < N_gaus) { arma_warn(3, "gmm_diag::learn(): number of vectors is less than number of gaussians"); return false; } reset(X.n_rows, N_gaus); if(print_mode) { get_cout_stream() << "gmm_diag::learn(): generating initial means\n"; get_cout_stream().flush(); } if(dist_mode == eucl_dist) { generate_initial_means<1>(X, seed_mode); } else if(dist_mode == maha_dist) { generate_initial_means<2>(X, seed_mode); } } // k-means if(km_iter > 0) { const arma_ostream_state stream_state(get_cout_stream()); bool status = false; if(dist_mode == eucl_dist) { status = km_iterate<1>(X, km_iter, print_mode, "gmm_diag::learn(): k-means"); } else if(dist_mode == maha_dist) { status = km_iterate<2>(X, km_iter, print_mode, "gmm_diag::learn(): k-means"); } stream_state.restore(get_cout_stream()); if(status == false) { arma_warn(3, "gmm_diag::learn(): k-means algorithm failed; not enough data, or too many gaussians requested"); init(orig); return false; } } // initial dcovs const eT var_floor_actual = (eT(var_floor) > eT(0)) ? eT(var_floor) : std::numeric_limits::min(); if(seed_mode != keep_existing) { if(print_mode) { get_cout_stream() << "gmm_diag::learn(): generating initial covariances\n"; get_cout_stream().flush(); } if(dist_mode == eucl_dist) { generate_initial_params<1>(X, var_floor_actual); } else if(dist_mode == maha_dist) { generate_initial_params<2>(X, var_floor_actual); } } // EM algorithm if(em_iter > 0) { const arma_ostream_state stream_state(get_cout_stream()); const bool status = em_iterate(X, em_iter, var_floor_actual, print_mode); stream_state.restore(get_cout_stream()); if(status == false) { arma_warn(3, "gmm_diag::learn(): EM algorithm failed"); init(orig); return false; } } mah_aux.reset(); init_constants(); return true; } template template inline bool gmm_diag::kmeans_wrapper ( Mat& user_means, const Base& data, const uword N_gaus, const gmm_seed_mode& seed_mode, const uword km_iter, const bool print_mode ) { arma_debug_sigprint(); const bool seed_mode_ok = \ (seed_mode == keep_existing) || (seed_mode == static_subset) || (seed_mode == static_spread) || (seed_mode == random_subset) || (seed_mode == random_spread); arma_conform_check( (seed_mode_ok == false), "kmeans(): unknown seed_mode" ); const unwrap tmp_X(data.get_ref()); const Mat& X = tmp_X.M; if(X.is_empty() ) { arma_warn(3, "kmeans(): given matrix is empty" ); return false; } if(X.internal_has_nonfinite()) { arma_warn(3, "kmeans(): given matrix has non-finite values"); return false; } if(N_gaus == 0) { reset(); return true; } // initial means if(seed_mode == keep_existing) { access::rw(means) = user_means; if(means.is_empty() ) { arma_warn(3, "kmeans(): no existing means" ); return false; } if(X.n_rows != means.n_rows) { arma_warn(3, "kmeans(): dimensionality mismatch"); return false; } // TODO: also check for number of vectors? } else { if(X.n_cols < N_gaus) { arma_warn(3, "kmeans(): number of vectors is less than number of means"); return false; } access::rw(means).zeros(X.n_rows, N_gaus); if(print_mode) { get_cout_stream() << "kmeans(): generating initial means\n"; } generate_initial_means<1>(X, seed_mode); } // k-means if(km_iter > 0) { const arma_ostream_state stream_state(get_cout_stream()); bool status = false; status = km_iterate<1>(X, km_iter, print_mode, "kmeans()"); stream_state.restore(get_cout_stream()); if(status == false) { arma_warn(3, "kmeans(): clustering failed; not enough data, or too many means requested"); return false; } } return true; } // // // template inline void gmm_diag::init(const gmm_diag& x) { arma_debug_sigprint(); gmm_diag& t = *this; if(&t != &x) { access::rw(t.means) = x.means; access::rw(t.dcovs) = x.dcovs; access::rw(t.hefts) = x.hefts; init_constants(); } } template inline void gmm_diag::init(const gmm_full& x) { arma_debug_sigprint(); access::rw(hefts) = x.hefts; access::rw(means) = x.means; const uword N_dims = x.means.n_rows; const uword N_gaus = x.means.n_cols; access::rw(dcovs).zeros(N_dims,N_gaus); for(uword g=0; g < N_gaus; ++g) { const Mat& fcov = x.fcovs.slice(g); eT* dcov_mem = access::rw(dcovs).colptr(g); for(uword d=0; d < N_dims; ++d) { dcov_mem[d] = fcov.at(d,d); } } init_constants(); } template inline void gmm_diag::init(const uword in_n_dims, const uword in_n_gaus) { arma_debug_sigprint(); access::rw(means).zeros(in_n_dims, in_n_gaus); access::rw(dcovs).ones(in_n_dims, in_n_gaus); access::rw(hefts).set_size(in_n_gaus); access::rw(hefts).fill(eT(1) / eT(in_n_gaus)); init_constants(); } template inline void gmm_diag::init_constants() { arma_debug_sigprint(); const uword N_dims = means.n_rows; const uword N_gaus = means.n_cols; // inv_dcovs.copy_size(dcovs); const eT* dcovs_mem = dcovs.memptr(); eT* inv_dcovs_mem = inv_dcovs.memptr(); const uword dcovs_n_elem = dcovs.n_elem; for(uword i=0; i < dcovs_n_elem; ++i) { inv_dcovs_mem[i] = eT(1) / (std::max)( dcovs_mem[i], std::numeric_limits::min() ); } // const eT tmp = (eT(N_dims)/eT(2)) * std::log(Datum::tau); log_det_etc.set_size(N_gaus); for(uword g=0; g < N_gaus; ++g) { const eT* dcovs_colmem = dcovs.colptr(g); eT log_det_val = eT(0); for(uword d=0; d < N_dims; ++d) { log_det_val += std::log( (std::max)( dcovs_colmem[d], std::numeric_limits::min() ) ); } log_det_etc[g] = eT(-1) * ( tmp + eT(0.5) * log_det_val ); } // eT* hefts_mem = access::rw(hefts).memptr(); for(uword g=0; g < N_gaus; ++g) { hefts_mem[g] = (std::max)( hefts_mem[g], std::numeric_limits::min() ); } log_hefts = log(hefts); } template inline umat gmm_diag::internal_gen_boundaries(const uword N) const { arma_debug_sigprint(); #if defined(ARMA_USE_OPENMP) const uword n_threads_avail = (omp_in_parallel()) ? uword(1) : uword(omp_get_max_threads()); const uword n_threads = (n_threads_avail > 0) ? ( (n_threads_avail <= N) ? n_threads_avail : 1 ) : 1; #else static constexpr uword n_threads = 1; #endif // get_cout_stream() << "gmm_diag::internal_gen_boundaries(): n_threads: " << n_threads << '\n'; umat boundaries(2, n_threads, arma_nozeros_indicator()); if(N > 0) { const uword chunk_size = N / n_threads; uword count = 0; for(uword t=0; t inline eT gmm_diag::internal_scalar_log_p(const eT* x) const { arma_debug_sigprint(); const eT* log_hefts_mem = log_hefts.mem; const uword N_gaus = means.n_cols; if(N_gaus > 0) { eT log_sum = internal_scalar_log_p(x, 0) + log_hefts_mem[0]; for(uword g=1; g < N_gaus; ++g) { const eT tmp = internal_scalar_log_p(x, g) + log_hefts_mem[g]; log_sum = priv::internal_log_add_exp(log_sum, tmp); } return log_sum; } else { return -Datum::inf; } } template inline eT gmm_diag::internal_scalar_log_p(const eT* x, const uword g) const { arma_debug_sigprint(); const eT* mean = means.colptr(g); const eT* inv_dcov = inv_dcovs.colptr(g); const uword N_dims = means.n_rows; eT val_i = eT(0); eT val_j = eT(0); uword i,j; for(i=0, j=1; j inline Row gmm_diag::internal_vec_log_p(const Mat& X) const { arma_debug_sigprint(); arma_conform_check( (X.n_rows != means.n_rows), "gmm_diag::log_p(): incompatible dimensions" ); const uword N = X.n_cols; Row out(N, arma_nozeros_indicator()); if(N > 0) { #if defined(ARMA_USE_OPENMP) { const umat boundaries = internal_gen_boundaries(N); const uword n_threads = boundaries.n_cols; #pragma omp parallel for schedule(static) for(uword t=0; t < n_threads; ++t) { const uword start_index = boundaries.at(0,t); const uword end_index = boundaries.at(1,t); eT* out_mem = out.memptr(); for(uword i=start_index; i <= end_index; ++i) { out_mem[i] = internal_scalar_log_p( X.colptr(i) ); } } } #else { eT* out_mem = out.memptr(); for(uword i=0; i < N; ++i) { out_mem[i] = internal_scalar_log_p( X.colptr(i) ); } } #endif } return out; } template inline Row gmm_diag::internal_vec_log_p(const Mat& X, const uword gaus_id) const { arma_debug_sigprint(); arma_conform_check( (X.n_rows != means.n_rows), "gmm_diag::log_p(): incompatible dimensions" ); arma_conform_check( (gaus_id >= means.n_cols), "gmm_diag::log_p(): specified gaussian is out of range" ); const uword N = X.n_cols; Row out(N, arma_nozeros_indicator()); if(N > 0) { #if defined(ARMA_USE_OPENMP) { const umat boundaries = internal_gen_boundaries(N); const uword n_threads = boundaries.n_cols; #pragma omp parallel for schedule(static) for(uword t=0; t < n_threads; ++t) { const uword start_index = boundaries.at(0,t); const uword end_index = boundaries.at(1,t); eT* out_mem = out.memptr(); for(uword i=start_index; i <= end_index; ++i) { out_mem[i] = internal_scalar_log_p( X.colptr(i), gaus_id ); } } } #else { eT* out_mem = out.memptr(); for(uword i=0; i < N; ++i) { out_mem[i] = internal_scalar_log_p( X.colptr(i), gaus_id ); } } #endif } return out; } template inline eT gmm_diag::internal_sum_log_p(const Mat& X) const { arma_debug_sigprint(); arma_conform_check( (X.n_rows != means.n_rows), "gmm_diag::sum_log_p(): incompatible dimensions" ); const uword N = X.n_cols; if(N == 0) { return (-Datum::inf); } #if defined(ARMA_USE_OPENMP) { const umat boundaries = internal_gen_boundaries(N); const uword n_threads = boundaries.n_cols; Col t_accs(n_threads, arma_zeros_indicator()); #pragma omp parallel for schedule(static) for(uword t=0; t < n_threads; ++t) { const uword start_index = boundaries.at(0,t); const uword end_index = boundaries.at(1,t); eT t_acc = eT(0); for(uword i=start_index; i <= end_index; ++i) { t_acc += internal_scalar_log_p( X.colptr(i) ); } t_accs[t] = t_acc; } return eT(accu(t_accs)); } #else { eT acc = eT(0); for(uword i=0; i inline eT gmm_diag::internal_sum_log_p(const Mat& X, const uword gaus_id) const { arma_debug_sigprint(); arma_conform_check( (X.n_rows != means.n_rows), "gmm_diag::sum_log_p(): incompatible dimensions" ); arma_conform_check( (gaus_id >= means.n_cols), "gmm_diag::sum_log_p(): specified gaussian is out of range" ); const uword N = X.n_cols; if(N == 0) { return (-Datum::inf); } #if defined(ARMA_USE_OPENMP) { const umat boundaries = internal_gen_boundaries(N); const uword n_threads = boundaries.n_cols; Col t_accs(n_threads, arma_zeros_indicator()); #pragma omp parallel for schedule(static) for(uword t=0; t < n_threads; ++t) { const uword start_index = boundaries.at(0,t); const uword end_index = boundaries.at(1,t); eT t_acc = eT(0); for(uword i=start_index; i <= end_index; ++i) { t_acc += internal_scalar_log_p( X.colptr(i), gaus_id ); } t_accs[t] = t_acc; } return eT(accu(t_accs)); } #else { eT acc = eT(0); for(uword i=0; i inline eT gmm_diag::internal_avg_log_p(const Mat& X) const { arma_debug_sigprint(); arma_conform_check( (X.n_rows != means.n_rows), "gmm_diag::avg_log_p(): incompatible dimensions" ); const uword N = X.n_cols; if(N == 0) { return (-Datum::inf); } #if defined(ARMA_USE_OPENMP) { const umat boundaries = internal_gen_boundaries(N); const uword n_threads = boundaries.n_cols; field< running_mean_scalar > t_running_means(n_threads); #pragma omp parallel for schedule(static) for(uword t=0; t < n_threads; ++t) { const uword start_index = boundaries.at(0,t); const uword end_index = boundaries.at(1,t); running_mean_scalar& current_running_mean = t_running_means[t]; for(uword i=start_index; i <= end_index; ++i) { current_running_mean( internal_scalar_log_p( X.colptr(i) ) ); } } eT avg = eT(0); for(uword t=0; t < n_threads; ++t) { running_mean_scalar& current_running_mean = t_running_means[t]; const eT w = eT(current_running_mean.count()) / eT(N); avg += w * current_running_mean.mean(); } return avg; } #else { running_mean_scalar running_mean; for(uword i=0; i inline eT gmm_diag::internal_avg_log_p(const Mat& X, const uword gaus_id) const { arma_debug_sigprint(); arma_conform_check( (X.n_rows != means.n_rows), "gmm_diag::avg_log_p(): incompatible dimensions" ); arma_conform_check( (gaus_id >= means.n_cols), "gmm_diag::avg_log_p(): specified gaussian is out of range" ); const uword N = X.n_cols; if(N == 0) { return (-Datum::inf); } #if defined(ARMA_USE_OPENMP) { const umat boundaries = internal_gen_boundaries(N); const uword n_threads = boundaries.n_cols; field< running_mean_scalar > t_running_means(n_threads); #pragma omp parallel for schedule(static) for(uword t=0; t < n_threads; ++t) { const uword start_index = boundaries.at(0,t); const uword end_index = boundaries.at(1,t); running_mean_scalar& current_running_mean = t_running_means[t]; for(uword i=start_index; i <= end_index; ++i) { current_running_mean( internal_scalar_log_p( X.colptr(i), gaus_id) ); } } eT avg = eT(0); for(uword t=0; t < n_threads; ++t) { running_mean_scalar& current_running_mean = t_running_means[t]; const eT w = eT(current_running_mean.count()) / eT(N); avg += w * current_running_mean.mean(); } return avg; } #else { running_mean_scalar running_mean; for(uword i=0; i inline uword gmm_diag::internal_scalar_assign(const Mat& X, const gmm_dist_mode& dist_mode) const { arma_debug_sigprint(); const uword N_dims = means.n_rows; const uword N_gaus = means.n_cols; arma_conform_check( (X.n_rows != N_dims), "gmm_diag::assign(): incompatible dimensions" ); arma_conform_check( (N_gaus == 0), "gmm_diag::assign(): model has no means" ); const eT* X_mem = X.colptr(0); if(dist_mode == eucl_dist) { eT best_dist = Datum::inf; uword best_g = 0; for(uword g=0; g < N_gaus; ++g) { const eT tmp_dist = distance::eval(N_dims, X_mem, means.colptr(g), X_mem); if(tmp_dist <= best_dist) { best_dist = tmp_dist; best_g = g; } } return best_g; } else if(dist_mode == prob_dist) { const eT* log_hefts_mem = log_hefts.memptr(); eT best_p = -Datum::inf; uword best_g = 0; for(uword g=0; g < N_gaus; ++g) { const eT tmp_p = internal_scalar_log_p(X_mem, g) + log_hefts_mem[g]; if(tmp_p >= best_p) { best_p = tmp_p; best_g = g; } } return best_g; } else { arma_conform_check(true, "gmm_diag::assign(): unsupported distance mode"); } return uword(0); } template inline void gmm_diag::internal_vec_assign(urowvec& out, const Mat& X, const gmm_dist_mode& dist_mode) const { arma_debug_sigprint(); const uword N_dims = means.n_rows; const uword N_gaus = means.n_cols; arma_conform_check( (X.n_rows != N_dims), "gmm_diag::assign(): incompatible dimensions" ); const uword X_n_cols = (N_gaus > 0) ? X.n_cols : 0; out.set_size(1,X_n_cols); uword* out_mem = out.memptr(); if(dist_mode == eucl_dist) { #if defined(ARMA_USE_OPENMP) { #pragma omp parallel for schedule(static) for(uword i=0; i::inf; uword best_g = 0; for(uword g=0; g::eval(N_dims, X_colptr, means.colptr(g), X_colptr); if(tmp_dist <= best_dist) { best_dist = tmp_dist; best_g = g; } } out_mem[i] = best_g; } } #else { for(uword i=0; i::inf; uword best_g = 0; for(uword g=0; g::eval(N_dims, X_colptr, means.colptr(g), X_colptr); if(tmp_dist <= best_dist) { best_dist = tmp_dist; best_g = g; } } out_mem[i] = best_g; } } #endif } else if(dist_mode == prob_dist) { #if defined(ARMA_USE_OPENMP) { const eT* log_hefts_mem = log_hefts.memptr(); #pragma omp parallel for schedule(static) for(uword i=0; i::inf; uword best_g = 0; for(uword g=0; g= best_p) { best_p = tmp_p; best_g = g; } } out_mem[i] = best_g; } } #else { const eT* log_hefts_mem = log_hefts.memptr(); for(uword i=0; i::inf; uword best_g = 0; for(uword g=0; g= best_p) { best_p = tmp_p; best_g = g; } } out_mem[i] = best_g; } } #endif } else { arma_conform_check(true, "gmm_diag::assign(): unsupported distance mode"); } } template inline void gmm_diag::internal_raw_hist(urowvec& hist, const Mat& X, const gmm_dist_mode& dist_mode) const { arma_debug_sigprint(); const uword N_dims = means.n_rows; const uword N_gaus = means.n_cols; const uword X_n_cols = X.n_cols; hist.zeros(N_gaus); if(N_gaus == 0) { return; } #if defined(ARMA_USE_OPENMP) { const umat boundaries = internal_gen_boundaries(X_n_cols); const uword n_threads = boundaries.n_cols; field thread_hist(n_threads); for(uword t=0; t < n_threads; ++t) { thread_hist(t).zeros(N_gaus); } if(dist_mode == eucl_dist) { #pragma omp parallel for schedule(static) for(uword t=0; t < n_threads; ++t) { uword* thread_hist_mem = thread_hist(t).memptr(); const uword start_index = boundaries.at(0,t); const uword end_index = boundaries.at(1,t); for(uword i=start_index; i <= end_index; ++i) { const eT* X_colptr = X.colptr(i); eT best_dist = Datum::inf; uword best_g = 0; for(uword g=0; g < N_gaus; ++g) { const eT tmp_dist = distance::eval(N_dims, X_colptr, means.colptr(g), X_colptr); if(tmp_dist <= best_dist) { best_dist = tmp_dist; best_g = g; } } thread_hist_mem[best_g]++; } } } else if(dist_mode == prob_dist) { const eT* log_hefts_mem = log_hefts.memptr(); #pragma omp parallel for schedule(static) for(uword t=0; t < n_threads; ++t) { uword* thread_hist_mem = thread_hist(t).memptr(); const uword start_index = boundaries.at(0,t); const uword end_index = boundaries.at(1,t); for(uword i=start_index; i <= end_index; ++i) { const eT* X_colptr = X.colptr(i); eT best_p = -Datum::inf; uword best_g = 0; for(uword g=0; g < N_gaus; ++g) { const eT tmp_p = internal_scalar_log_p(X_colptr, g) + log_hefts_mem[g]; if(tmp_p >= best_p) { best_p = tmp_p; best_g = g; } } thread_hist_mem[best_g]++; } } } // reduction hist = thread_hist(0); for(uword t=1; t < n_threads; ++t) { hist += thread_hist(t); } } #else { uword* hist_mem = hist.memptr(); if(dist_mode == eucl_dist) { for(uword i=0; i::inf; uword best_g = 0; for(uword g=0; g < N_gaus; ++g) { const eT tmp_dist = distance::eval(N_dims, X_colptr, means.colptr(g), X_colptr); if(tmp_dist <= best_dist) { best_dist = tmp_dist; best_g = g; } } hist_mem[best_g]++; } } else if(dist_mode == prob_dist) { const eT* log_hefts_mem = log_hefts.memptr(); for(uword i=0; i::inf; uword best_g = 0; for(uword g=0; g < N_gaus; ++g) { const eT tmp_p = internal_scalar_log_p(X_colptr, g) + log_hefts_mem[g]; if(tmp_p >= best_p) { best_p = tmp_p; best_g = g; } } hist_mem[best_g]++; } } } #endif } template template inline void gmm_diag::generate_initial_means(const Mat& X, const gmm_seed_mode& seed_mode) { arma_debug_sigprint(); const uword N_dims = means.n_rows; const uword N_gaus = means.n_cols; if( (seed_mode == static_subset) || (seed_mode == random_subset) ) { uvec initial_indices; if(seed_mode == static_subset) { initial_indices = linspace(0, X.n_cols-1, N_gaus); } else if(seed_mode == random_subset) { initial_indices = randperm(X.n_cols, N_gaus); } // initial_indices.print("initial_indices:"); access::rw(means) = X.cols(initial_indices); } else if( (seed_mode == static_spread) || (seed_mode == random_spread) ) { // going through all of the samples can be extremely time consuming; // instead, if there are enough samples, randomly choose samples with probability 0.1 const bool use_sampling = ((X.n_cols/uword(100)) > N_gaus); const uword step = (use_sampling) ? uword(10) : uword(1); uword start_index = 0; if(seed_mode == static_spread) { start_index = X.n_cols / 2; } else if(seed_mode == random_spread) { start_index = as_scalar(randi(1, distr_param(0,X.n_cols-1))); } access::rw(means).col(0) = X.unsafe_col(start_index); const eT* mah_aux_mem = mah_aux.memptr(); running_stat rs; for(uword g=1; g < N_gaus; ++g) { eT max_dist = eT(0); uword best_i = uword(0); uword start_i = uword(0); if(use_sampling) { uword start_i_proposed = uword(0); if(seed_mode == static_spread) { start_i_proposed = g % uword(10); } if(seed_mode == random_spread) { start_i_proposed = as_scalar(randi(1, distr_param(0,9))); } if(start_i_proposed < X.n_cols) { start_i = start_i_proposed; } } for(uword i=start_i; i < X.n_cols; i += step) { rs.reset(); const eT* X_colptr = X.colptr(i); bool ignore_i = false; // find the average distance between sample i and the means so far for(uword h = 0; h < g; ++h) { const eT dist = distance::eval(N_dims, X_colptr, means.colptr(h), mah_aux_mem); // ignore sample already selected as a mean if(dist == eT(0)) { ignore_i = true; break; } else { rs(dist); } } if( (rs.mean() >= max_dist) && (ignore_i == false)) { max_dist = eT(rs.mean()); best_i = i; } } // set the mean to the sample that is the furthest away from the means so far access::rw(means).col(g) = X.unsafe_col(best_i); } } // get_cout_stream() << "generate_initial_means():" << '\n'; // means.print(); } template template inline void gmm_diag::generate_initial_params(const Mat& X, const eT var_floor) { arma_debug_sigprint(); const uword N_dims = means.n_rows; const uword N_gaus = means.n_cols; const eT* mah_aux_mem = mah_aux.memptr(); const uword X_n_cols = X.n_cols; if(X_n_cols == 0) { return; } // as the covariances are calculated via accumulators, // the means also need to be calculated via accumulators to ensure numerical consistency Mat acc_means(N_dims, N_gaus, arma_zeros_indicator()); Mat acc_dcovs(N_dims, N_gaus, arma_zeros_indicator()); Row acc_hefts(N_gaus, arma_zeros_indicator()); uword* acc_hefts_mem = acc_hefts.memptr(); #if defined(ARMA_USE_OPENMP) { const umat boundaries = internal_gen_boundaries(X_n_cols); const uword n_threads = boundaries.n_cols; field< Mat > t_acc_means(n_threads); field< Mat > t_acc_dcovs(n_threads); field< Row > t_acc_hefts(n_threads); for(uword t=0; t < n_threads; ++t) { t_acc_means(t).zeros(N_dims, N_gaus); t_acc_dcovs(t).zeros(N_dims, N_gaus); t_acc_hefts(t).zeros(N_gaus); } #pragma omp parallel for schedule(static) for(uword t=0; t < n_threads; ++t) { uword* t_acc_hefts_mem = t_acc_hefts(t).memptr(); const uword start_index = boundaries.at(0,t); const uword end_index = boundaries.at(1,t); for(uword i=start_index; i <= end_index; ++i) { const eT* X_colptr = X.colptr(i); eT min_dist = Datum::inf; uword best_g = 0; for(uword g=0; g::eval(N_dims, X_colptr, means.colptr(g), mah_aux_mem); if(dist < min_dist) { min_dist = dist; best_g = g; } } eT* t_acc_mean = t_acc_means(t).colptr(best_g); eT* t_acc_dcov = t_acc_dcovs(t).colptr(best_g); for(uword d=0; d::inf; uword best_g = 0; for(uword g=0; g::eval(N_dims, X_colptr, means.colptr(g), mah_aux_mem); if(dist < min_dist) { min_dist = dist; best_g = g; } } eT* acc_mean = acc_means.colptr(best_g); eT* acc_dcov = acc_dcovs.colptr(best_g); for(uword d=0; d= 1) ? tmp : eT(0); dcov[d] = (acc_heft >= 2) ? eT((acc_dcov[d] / eT(acc_heft)) - (tmp*tmp)) : eT(var_floor); } hefts_mem[g] = eT(acc_heft) / eT(X_n_cols); } em_fix_params(var_floor); } //! multi-threaded implementation of k-means, inspired by MapReduce template template inline bool gmm_diag::km_iterate(const Mat& X, const uword max_iter, const bool verbose, const char* signature) { arma_debug_sigprint(); if(verbose) { get_cout_stream().unsetf(ios::showbase); get_cout_stream().unsetf(ios::uppercase); get_cout_stream().unsetf(ios::showpos); get_cout_stream().unsetf(ios::scientific); get_cout_stream().setf(ios::right); get_cout_stream().setf(ios::fixed); } const uword X_n_cols = X.n_cols; if(X_n_cols == 0) { return true; } const uword N_dims = means.n_rows; const uword N_gaus = means.n_cols; const eT* mah_aux_mem = mah_aux.memptr(); Mat acc_means(N_dims, N_gaus, arma_zeros_indicator()); Row acc_hefts( N_gaus, arma_zeros_indicator()); Row last_indx( N_gaus, arma_zeros_indicator()); Mat new_means = means; Mat old_means = means; running_mean_scalar rs_delta; #if defined(ARMA_USE_OPENMP) const umat boundaries = internal_gen_boundaries(X_n_cols); const uword n_threads = boundaries.n_cols; field< Mat > t_acc_means(n_threads); field< Row > t_acc_hefts(n_threads); field< Row > t_last_indx(n_threads); #else const uword n_threads = 1; #endif if(verbose) { get_cout_stream() << signature << ": n_threads: " << n_threads << '\n'; get_cout_stream().flush(); } for(uword iter=1; iter <= max_iter; ++iter) { #if defined(ARMA_USE_OPENMP) { for(uword t=0; t < n_threads; ++t) { t_acc_means(t).zeros(N_dims, N_gaus); t_acc_hefts(t).zeros(N_gaus); t_last_indx(t).zeros(N_gaus); } #pragma omp parallel for schedule(static) for(uword t=0; t < n_threads; ++t) { Mat& t_acc_means_t = t_acc_means(t); uword* t_acc_hefts_mem = t_acc_hefts(t).memptr(); uword* t_last_indx_mem = t_last_indx(t).memptr(); const uword start_index = boundaries.at(0,t); const uword end_index = boundaries.at(1,t); for(uword i=start_index; i <= end_index; ++i) { const eT* X_colptr = X.colptr(i); eT min_dist = Datum::inf; uword best_g = 0; for(uword g=0; g::eval(N_dims, X_colptr, old_means.colptr(g), mah_aux_mem); if(dist < min_dist) { min_dist = dist; best_g = g; } } eT* t_acc_mean = t_acc_means_t.colptr(best_g); for(uword d=0; d= 1 ) { last_indx(g) = t_last_indx(t)(g); } } } #else { acc_hefts.zeros(); acc_means.zeros(); last_indx.zeros(); uword* acc_hefts_mem = acc_hefts.memptr(); uword* last_indx_mem = last_indx.memptr(); for(uword i=0; i < X_n_cols; ++i) { const eT* X_colptr = X.colptr(i); eT min_dist = Datum::inf; uword best_g = 0; for(uword g=0; g::eval(N_dims, X_colptr, old_means.colptr(g), mah_aux_mem); if(dist < min_dist) { min_dist = dist; best_g = g; } } eT* acc_mean = acc_means.colptr(best_g); for(uword d=0; d= 1) ? (acc_mean[d] / eT(acc_heft)) : eT(0); } } // heuristics to resurrect dead means const uvec dead_gs = find(acc_hefts == uword(0)); if(dead_gs.n_elem > 0) { if(verbose) { get_cout_stream() << signature << ": recovering from dead means\n"; get_cout_stream().flush(); } uword* last_indx_mem = last_indx.memptr(); const uvec live_gs = sort( find(acc_hefts >= uword(2)), "descend" ); if(live_gs.n_elem == 0) { return false; } uword live_gs_count = 0; for(uword dead_gs_count = 0; dead_gs_count < dead_gs.n_elem; ++dead_gs_count) { const uword dead_g_id = dead_gs(dead_gs_count); uword proposed_i = 0; if(live_gs_count < live_gs.n_elem) { const uword live_g_id = live_gs(live_gs_count); ++live_gs_count; if(live_g_id == dead_g_id) { return false; } // recover by using a sample from a known good mean proposed_i = last_indx_mem[live_g_id]; } else { // recover by using a randomly selected sample (last resort) proposed_i = as_scalar(randi(1, distr_param(0,X_n_cols-1))); } if(proposed_i >= X_n_cols) { return false; } new_means.col(dead_g_id) = X.col(proposed_i); } } rs_delta.reset(); for(uword g=0; g < N_gaus; ++g) { rs_delta( distance::eval(N_dims, old_means.colptr(g), new_means.colptr(g), mah_aux_mem) ); } if(verbose) { get_cout_stream() << signature << ": iteration: "; get_cout_stream().unsetf(ios::scientific); get_cout_stream().setf(ios::fixed); get_cout_stream().width(std::streamsize(4)); get_cout_stream() << iter; get_cout_stream() << " delta: "; get_cout_stream().unsetf(ios::fixed); //get_cout_stream().setf(ios::scientific); get_cout_stream() << rs_delta.mean() << '\n'; get_cout_stream().flush(); } arma::swap(old_means, new_means); if(rs_delta.mean() <= Datum::eps) { break; } } access::rw(means) = old_means; if(means.internal_has_nonfinite()) { return false; } return true; } //! multi-threaded implementation of Expectation-Maximisation, inspired by MapReduce template inline bool gmm_diag::em_iterate(const Mat& X, const uword max_iter, const eT var_floor, const bool verbose) { arma_debug_sigprint(); if(X.n_cols == 0) { return true; } const uword N_dims = means.n_rows; const uword N_gaus = means.n_cols; if(verbose) { get_cout_stream().unsetf(ios::showbase); get_cout_stream().unsetf(ios::uppercase); get_cout_stream().unsetf(ios::showpos); get_cout_stream().unsetf(ios::scientific); get_cout_stream().setf(ios::right); get_cout_stream().setf(ios::fixed); } const umat boundaries = internal_gen_boundaries(X.n_cols); const uword n_threads = boundaries.n_cols; field< Mat > t_acc_means(n_threads); field< Mat > t_acc_dcovs(n_threads); field< Col > t_acc_norm_lhoods(n_threads); field< Col > t_gaus_log_lhoods(n_threads); Col t_progress_log_lhood(n_threads, arma_nozeros_indicator()); for(uword t=0; t::inf; for(uword iter=1; iter <= max_iter; ++iter) { init_constants(); em_update_params(X, boundaries, t_acc_means, t_acc_dcovs, t_acc_norm_lhoods, t_gaus_log_lhoods, t_progress_log_lhood); em_fix_params(var_floor); const eT new_avg_log_p = accu(t_progress_log_lhood) / eT(t_progress_log_lhood.n_elem); if(verbose) { get_cout_stream() << "gmm_diag::learn(): EM: iteration: "; get_cout_stream().unsetf(ios::scientific); get_cout_stream().setf(ios::fixed); get_cout_stream().width(std::streamsize(4)); get_cout_stream() << iter; get_cout_stream() << " avg_log_p: "; get_cout_stream().unsetf(ios::fixed); //get_cout_stream().setf(ios::scientific); get_cout_stream() << new_avg_log_p << '\n'; get_cout_stream().flush(); } if(arma_isnonfinite(new_avg_log_p)) { return false; } if(std::abs(old_avg_log_p - new_avg_log_p) <= Datum::eps) { break; } old_avg_log_p = new_avg_log_p; } if(any(vectorise(dcovs) <= eT(0))) { return false; } if(means.internal_has_nonfinite()) { return false; } if(dcovs.internal_has_nonfinite()) { return false; } if(hefts.internal_has_nonfinite()) { return false; } return true; } template inline void gmm_diag::em_update_params ( const Mat& X, const umat& boundaries, field< Mat >& t_acc_means, field< Mat >& t_acc_dcovs, field< Col >& t_acc_norm_lhoods, field< Col >& t_gaus_log_lhoods, Col& t_progress_log_lhood ) { arma_debug_sigprint(); const uword n_threads = boundaries.n_cols; // em_generate_acc() is the "map" operation, which produces partial accumulators for means, diagonal covariances and hefts #if defined(ARMA_USE_OPENMP) { #pragma omp parallel for schedule(static) for(uword t=0; t& acc_means = t_acc_means[t]; Mat& acc_dcovs = t_acc_dcovs[t]; Col& acc_norm_lhoods = t_acc_norm_lhoods[t]; Col& gaus_log_lhoods = t_gaus_log_lhoods[t]; eT& progress_log_lhood = t_progress_log_lhood[t]; em_generate_acc(X, boundaries.at(0,t), boundaries.at(1,t), acc_means, acc_dcovs, acc_norm_lhoods, gaus_log_lhoods, progress_log_lhood); } } #else { em_generate_acc(X, boundaries.at(0,0), boundaries.at(1,0), t_acc_means[0], t_acc_dcovs[0], t_acc_norm_lhoods[0], t_gaus_log_lhoods[0], t_progress_log_lhood[0]); } #endif const uword N_dims = means.n_rows; const uword N_gaus = means.n_cols; Mat& final_acc_means = t_acc_means[0]; Mat& final_acc_dcovs = t_acc_dcovs[0]; Col& final_acc_norm_lhoods = t_acc_norm_lhoods[0]; // the "reduce" operation, which combines the partial accumulators produced by the separate threads for(uword t=1; t::min() ); // // eT* mean_mem = access::rw(means).colptr(g); // eT* dcov_mem = access::rw(dcovs).colptr(g); // // eT* acc_mean_mem = final_acc_means.colptr(g); // eT* acc_dcov_mem = final_acc_dcovs.colptr(g); // // hefts_mem[g] = acc_norm_lhood / eT(X.n_cols); // // for(uword d=0; d < N_dims; ++d) // { // const eT tmp = acc_mean_mem[d] / acc_norm_lhood; // // mean_mem[d] = tmp; // dcov_mem[d] = acc_dcov_mem[d] / acc_norm_lhood - tmp*tmp; // } // } // conditionally update each component; if only a subset of the hefts was updated, em_fix_params() will sanitise them for(uword g=0; g < N_gaus; ++g) { const eT acc_norm_lhood = (std::max)( final_acc_norm_lhoods[g], std::numeric_limits::min() ); if(arma_isnonfinite(acc_norm_lhood)) { continue; } eT* acc_mean_mem = final_acc_means.colptr(g); eT* acc_dcov_mem = final_acc_dcovs.colptr(g); bool ok = true; for(uword d=0; d < N_dims; ++d) { const eT tmp1 = acc_mean_mem[d] / acc_norm_lhood; const eT tmp2 = acc_dcov_mem[d] / acc_norm_lhood - tmp1*tmp1; acc_mean_mem[d] = tmp1; acc_dcov_mem[d] = tmp2; if(arma_isnonfinite(tmp2)) { ok = false; } } if(ok) { hefts_mem[g] = acc_norm_lhood / eT(X.n_cols); eT* mean_mem = access::rw(means).colptr(g); eT* dcov_mem = access::rw(dcovs).colptr(g); for(uword d=0; d < N_dims; ++d) { mean_mem[d] = acc_mean_mem[d]; dcov_mem[d] = acc_dcov_mem[d]; } } } } template inline void gmm_diag::em_generate_acc ( const Mat& X, const uword start_index, const uword end_index, Mat& acc_means, Mat& acc_dcovs, Col& acc_norm_lhoods, Col& gaus_log_lhoods, eT& progress_log_lhood ) const { arma_debug_sigprint(); progress_log_lhood = eT(0); acc_means.zeros(); acc_dcovs.zeros(); acc_norm_lhoods.zeros(); gaus_log_lhoods.zeros(); const uword N_dims = means.n_rows; const uword N_gaus = means.n_cols; const eT* log_hefts_mem = log_hefts.memptr(); eT* gaus_log_lhoods_mem = gaus_log_lhoods.memptr(); for(uword i=start_index; i <= end_index; i++) { const eT* x = X.colptr(i); for(uword g=0; g < N_gaus; ++g) { gaus_log_lhoods_mem[g] = internal_scalar_log_p(x, g) + log_hefts_mem[g]; } eT log_lhood_sum = gaus_log_lhoods_mem[0]; for(uword g=1; g < N_gaus; ++g) { log_lhood_sum = priv::internal_log_add_exp(log_lhood_sum, gaus_log_lhoods_mem[g]); } progress_log_lhood += log_lhood_sum; for(uword g=0; g < N_gaus; ++g) { const eT norm_lhood = std::exp(gaus_log_lhoods_mem[g] - log_lhood_sum); acc_norm_lhoods[g] += norm_lhood; eT* acc_mean_mem = acc_means.colptr(g); eT* acc_dcov_mem = acc_dcovs.colptr(g); for(uword d=0; d < N_dims; ++d) { const eT x_d = x[d]; const eT y_d = x_d * norm_lhood; acc_mean_mem[d] += y_d; acc_dcov_mem[d] += y_d * x_d; // equivalent to x_d * x_d * norm_lhood } } } progress_log_lhood /= eT((end_index - start_index) + 1); } template inline void gmm_diag::em_fix_params(const eT var_floor) { arma_debug_sigprint(); const uword N_dims = means.n_rows; const uword N_gaus = means.n_cols; const eT var_ceiling = std::numeric_limits::max(); const uword dcovs_n_elem = dcovs.n_elem; eT* dcovs_mem = access::rw(dcovs).memptr(); for(uword i=0; i < dcovs_n_elem; ++i) { eT& var_val = dcovs_mem[i]; if(var_val < var_floor ) { var_val = var_floor; } else if(var_val > var_ceiling) { var_val = var_ceiling; } else if(arma_isnan(var_val) ) { var_val = eT(1); } } eT* hefts_mem = access::rw(hefts).memptr(); for(uword g1=0; g1 < N_gaus; ++g1) { if(hefts_mem[g1] > eT(0)) { const eT* means_colptr_g1 = means.colptr(g1); for(uword g2=(g1+1); g2 < N_gaus; ++g2) { if( (hefts_mem[g2] > eT(0)) && (std::abs(hefts_mem[g1] - hefts_mem[g2]) <= std::numeric_limits::epsilon()) ) { const eT dist = distance::eval(N_dims, means_colptr_g1, means.colptr(g2), means_colptr_g1); if(dist == eT(0)) { hefts_mem[g2] = eT(0); } } } } } const eT heft_floor = std::numeric_limits::min(); const eT heft_initial = eT(1) / eT(N_gaus); for(uword i=0; i < N_gaus; ++i) { eT& heft_val = hefts_mem[i]; if(heft_val < heft_floor) { heft_val = heft_floor; } else if(heft_val > eT(1) ) { heft_val = eT(1); } else if(arma_isnan(heft_val) ) { heft_val = heft_initial; } } const eT heft_sum = accu(hefts); if((heft_sum < (eT(1) - Datum::eps)) || (heft_sum > (eT(1) + Datum::eps))) { access::rw(hefts) /= heft_sum; } } } // namespace gmm_priv //! @} RcppArmadillo/inst/include/armadillo_bits/fn_approx_equal.hpp0000644000176200001440000003357014631567470024311 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_approx_equal //! @{ template arma_inline bool internal_approx_equal_abs_diff(const eT& x, const eT& y, const typename get_pod_type::result tol) { typedef typename get_pod_type::result T; if(x != y) { if(is_real::value) // also true for eT = std::complex or eT = std::complex { if( arma_isnan(x) || arma_isnan(y) || (eop_aux::arma_abs(x - y) > tol) ) { return false; } } else { if( eop_aux::arma_abs( ( cond_rel< is_cx::no >::gt(x, y) ) ? (x-y) : (y-x) ) > tol ) { return false; } } } return true; } template arma_inline bool internal_approx_equal_rel_diff(const eT& a, const eT& b, const typename get_pod_type::result tol) { typedef typename get_pod_type::result T; if(a != b) { if(is_real::value) // also true for eT = std::complex or eT = std::complex { if( arma_isnan(a) || arma_isnan(b) ) { return false; } const T abs_a = eop_aux::arma_abs(a); const T abs_b = eop_aux::arma_abs(b); const T max_c = (std::max)(abs_a,abs_b); const T abs_d = eop_aux::arma_abs(a - b); if(max_c >= T(1)) { if( abs_d > (tol * max_c) ) { return false; } } else { if( (abs_d / max_c) > tol ) { return false; } } } else { const T abs_a = eop_aux::arma_abs(a); const T abs_b = eop_aux::arma_abs(b); const T max_c = (std::max)(abs_a,abs_b); const T abs_d = eop_aux::arma_abs( ( cond_rel< is_cx::no >::gt(a, b) ) ? (a-b) : (b-a) ); if( abs_d > (tol * max_c) ) { return false; } } } return true; } template inline bool internal_approx_equal_worker ( const Base& A, const Base& B, const typename T1::pod_type abs_tol, const typename T1::pod_type rel_tol ) { arma_debug_sigprint(); typedef typename T1::elem_type eT; typedef typename T1::pod_type T; arma_conform_check( ((use_abs_diff == false) && (use_rel_diff == false)), "internal_approx_equal_worker(): both 'use_abs_diff' and 'use_rel_diff' are false" ); if(use_abs_diff) { arma_conform_check( cond_rel< is_signed::value >::lt(abs_tol, T(0)), "approx_equal(): argument 'abs_tol' must be >= 0" ); } if(use_rel_diff) { arma_conform_check( cond_rel< is_signed::value >::lt(rel_tol, T(0)), "approx_equal(): argument 'rel_tol' must be >= 0" ); } const Proxy PA(A.get_ref()); const Proxy PB(B.get_ref()); if( (PA.get_n_rows() != PB.get_n_rows()) || (PA.get_n_cols() != PB.get_n_cols()) ) { return false; } if( (Proxy::use_at == false) && (Proxy::use_at == false) ) { const uword N = PA.get_n_elem(); const typename Proxy::ea_type PA_ea = PA.get_ea(); const typename Proxy::ea_type PB_ea = PB.get_ea(); for(uword i=0; i inline bool internal_approx_equal_worker ( const BaseCube& A, const BaseCube& B, const typename T1::pod_type abs_tol, const typename T1::pod_type rel_tol ) { arma_debug_sigprint(); typedef typename T1::elem_type eT; typedef typename T1::pod_type T; arma_conform_check( ((use_abs_diff == false) && (use_rel_diff == false)), "internal_approx_equal_worker(): both 'use_abs_diff' and 'use_rel_diff' are false" ); if(use_abs_diff) { arma_conform_check( cond_rel< is_signed::value >::lt(abs_tol, T(0)), "approx_equal(): argument 'abs_tol' must be >= 0" ); } if(use_rel_diff) { arma_conform_check( cond_rel< is_signed::value >::lt(rel_tol, T(0)), "approx_equal(): argument 'rel_tol' must be >= 0" ); } const ProxyCube PA(A.get_ref()); const ProxyCube PB(B.get_ref()); if( (PA.get_n_rows() != PB.get_n_rows()) || (PA.get_n_cols() != PB.get_n_cols()) || (PA.get_n_slices() != PB.get_n_slices()) ) { return false; } if( (ProxyCube::use_at == false) && (ProxyCube::use_at == false) ) { const uword N = PA.get_n_elem(); const typename ProxyCube::ea_type PA_ea = PA.get_ea(); const typename ProxyCube::ea_type PB_ea = PB.get_ea(); for(uword i=0; i inline bool internal_approx_equal_handler(const T1& A, const T2& B, const char* method, const typename T1::pod_type abs_tol, const typename T1::pod_type rel_tol) { arma_debug_sigprint(); typedef typename T1::pod_type T; const char sig = (method != nullptr) ? method[0] : char(0); arma_conform_check( ((sig != 'a') && (sig != 'r') && (sig != 'b')), "approx_equal(): argument 'method' must be \"absdiff\" or \"reldiff\" or \"both\"" ); bool status = false; if(sig == 'a') { status = internal_approx_equal_worker(A, B, abs_tol, T(0)); } else if(sig == 'r') { status = internal_approx_equal_worker(A, B, T(0), rel_tol); } else if(sig == 'b') { status = internal_approx_equal_worker(A, B, abs_tol, rel_tol); } return status; } template inline bool internal_approx_equal_handler(const T1& A, const T2& B, const char* method, const typename T1::pod_type tol) { arma_debug_sigprint(); typedef typename T1::pod_type T; const char sig = (method != nullptr) ? method[0] : char(0); arma_conform_check( ((sig != 'a') && (sig != 'r') && (sig != 'b')), "approx_equal(): argument 'method' must be \"absdiff\" or \"reldiff\" or \"both\"" ); arma_conform_check( (sig == 'b'), "approx_equal(): argument 'method' is \"both\", but only one 'tol' argument has been given" ); bool status = false; if(sig == 'a') { status = internal_approx_equal_worker(A, B, tol, T(0)); } else if(sig == 'r') { status = internal_approx_equal_worker(A, B, T(0), tol); } return status; } template arma_warn_unused inline bool approx_equal(const Base& A, const Base& B, const char* method, const typename T1::pod_type tol) { arma_debug_sigprint(); return internal_approx_equal_handler(A.get_ref(), B.get_ref(), method, tol); } template arma_warn_unused inline bool approx_equal(const BaseCube& A, const BaseCube& B, const char* method, const typename T1::pod_type tol) { arma_debug_sigprint(); return internal_approx_equal_handler(A.get_ref(), B.get_ref(), method, tol); } template arma_warn_unused inline bool approx_equal(const Base& A, const Base& B, const char* method, const typename T1::pod_type abs_tol, const typename T1::pod_type rel_tol) { arma_debug_sigprint(); return internal_approx_equal_handler(A.get_ref(), B.get_ref(), method, abs_tol, rel_tol); } template arma_warn_unused inline bool approx_equal(const BaseCube& A, const BaseCube& B, const char* method, const typename T1::pod_type abs_tol, const typename T1::pod_type rel_tol) { arma_debug_sigprint(); return internal_approx_equal_handler(A.get_ref(), B.get_ref(), method, abs_tol, rel_tol); } template arma_warn_unused inline bool approx_equal(const SpBase& A, const SpBase& B, const char* method, const typename T1::pod_type tol) { arma_debug_sigprint(); typedef typename T1::elem_type eT; typedef typename T1::pod_type T; const char sig = (method != nullptr) ? method[0] : char(0); arma_conform_check( ((sig != 'a') && (sig != 'r') && (sig != 'b')), "approx_equal(): argument 'method' must be \"absdiff\" or \"reldiff\" or \"both\"" ); arma_conform_check( (sig == 'b'), "approx_equal(): argument 'method' is \"both\", but only one 'tol' argument has been given" ); arma_conform_check( (sig == 'r'), "approx_equal(): only the \"absdiff\" method is currently implemented for sparse matrices" ); arma_conform_check( cond_rel< is_signed::value >::lt(tol, T(0)), "approx_equal(): argument 'tol' must be >= 0" ); const unwrap_spmat UA(A.get_ref()); const unwrap_spmat UB(B.get_ref()); if( (UA.M.n_rows != UB.M.n_rows) || (UA.M.n_cols != UB.M.n_cols) ) { return false; } const SpMat C = UA.M - UB.M; typename SpMat::const_iterator it = C.begin(); typename SpMat::const_iterator it_end = C.end(); while(it != it_end) { const eT val = (*it); if( arma_isnan(val) || (eop_aux::arma_abs(val) > tol) ) { return false; } ++it; } return true; } template arma_warn_unused inline bool approx_equal(const SpBase& A, const SpBase& B, const char* method, const typename T1::pod_type abs_tol, const typename T1::pod_type rel_tol) { arma_debug_sigprint(); typedef typename T1::pod_type T; const char sig = (method != nullptr) ? method[0] : char(0); arma_conform_check( ((sig != 'a') && (sig != 'r') && (sig != 'b')), "approx_equal(): argument 'method' must be \"absdiff\" or \"reldiff\" or \"both\"" ); arma_conform_check( ((sig == 'r') || (sig == 'b')), "approx_equal(): only the \"absdiff\" method is currently implemented for sparse matrices" ); arma_conform_check( cond_rel< is_signed::value >::lt(abs_tol, T(0)), "approx_equal(): argument 'abs_tol' must be >= 0" ); arma_conform_check( cond_rel< is_signed::value >::lt(rel_tol, T(0)), "approx_equal(): argument 'rel_tol' must be >= 0" ); return approx_equal(A.get_ref(), B.get_ref(), "abs", abs_tol); } //! @} RcppArmadillo/inst/include/armadillo_bits/op_max_bones.hpp0000644000176200001440000000767014301267043023564 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_max //! @{ class op_max : public traits_op_xvec { public: // // dense matrices template inline static void apply(Mat& out, const Op& in); template inline static void apply_noalias(Mat& out, const Mat& X, const uword dim, const typename arma_not_cx::result* junk = nullptr); template inline static void apply_noalias(Mat& out, const Mat& X, const uword dim, const typename arma_cx_only::result* junk = nullptr); // // cubes template inline static void apply(Cube& out, const OpCube& in); template inline static void apply_noalias(Cube& out, const Cube& X, const uword dim, const typename arma_not_cx::result* junk = nullptr); template inline static void apply_noalias(Cube& out, const Cube& X, const uword dim, const typename arma_cx_only::result* junk = nullptr); // // for non-complex numbers template inline static eT direct_max(const eT* const X, const uword N); template inline static eT direct_max(const eT* const X, const uword N, uword& index_of_max_val); template inline static eT direct_max(const Mat& X, const uword row); template inline static eT max(const subview& X); template inline static typename arma_not_cx::result max(const Base& X); template inline static typename arma_not_cx::result max(const BaseCube& X); template inline static typename arma_not_cx::result max_with_index(const Proxy& P, uword& index_of_max_val); template inline static typename arma_not_cx::result max_with_index(const ProxyCube& P, uword& index_of_max_val); // // for complex numbers template inline static std::complex direct_max(const std::complex* const X, const uword n_elem); template inline static std::complex direct_max(const std::complex* const X, const uword n_elem, uword& index_of_max_val); template inline static std::complex direct_max(const Mat< std::complex >& X, const uword row); template inline static std::complex max(const subview< std::complex >& X); template inline static typename arma_cx_only::result max(const Base& X); template inline static typename arma_cx_only::result max(const BaseCube& X); template inline static typename arma_cx_only::result max_with_index(const Proxy& P, uword& index_of_max_val); template inline static typename arma_cx_only::result max_with_index(const ProxyCube& P, uword& index_of_max_val); }; //! @} RcppArmadillo/inst/include/armadillo_bits/fn_regspace.hpp0000644000176200001440000001305414631567470023375 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_regspace //! @{ template inline void internal_regspace_default_delta ( Mat& x, const typename Mat::pod_type start, const typename Mat::pod_type end ) { arma_debug_sigprint(); typedef typename Mat::pod_type T; const bool ascend = (start <= end); const uword N = uword(1) + uword((ascend) ? (end-start) : (start-end)); x.set_size(N); eT* x_mem = x.memptr(); if(ascend) { for(uword i=0; i < N; ++i) { x_mem[i] = eT(start + T(i)); } } else { for(uword i=0; i < N; ++i) { x_mem[i] = eT(start - T(i)); } } } template inline typename enable_if2< (is_signed::value == true), void >::result internal_regspace_var_delta ( Mat& x, const typename Mat::pod_type start, const sT delta, const typename Mat::pod_type end ) { arma_debug_sigprint(); arma_debug_print("internal_regspace_var_delta(): signed version"); typedef typename Mat::pod_type T; if( ((start < end) && (delta < sT(0))) || ((start > end) && (delta > sT(0))) || (delta == sT(0)) ) { return; } const bool ascend = (start <= end); const T inc = (delta < sT(0)) ? T(-delta) : T(delta); const T M = ((ascend) ? T(end-start) : T(start-end)) / T(inc); const uword N = uword(1) + ( (is_non_integral::value) ? uword(std::floor(double(M))) : uword(M) ); x.set_size(N); eT* x_mem = x.memptr(); if(ascend) { for(uword i=0; i < N; ++i) { x_mem[i] = eT( start + T(i*inc) ); } } else { for(uword i=0; i < N; ++i) { x_mem[i] = eT( start - T(i*inc) ); } } } template inline typename enable_if2< (is_signed::value == false), void >::result internal_regspace_var_delta ( Mat& x, const typename Mat::pod_type start, const uT delta, const typename Mat::pod_type end ) { arma_debug_sigprint(); arma_debug_print("internal_regspace_var_delta(): unsigned version"); typedef typename Mat::pod_type T; if( ((start > end) && (delta > uT(0))) || (delta == uT(0)) ) { return; } const bool ascend = (start <= end); const T inc = T(delta); const T M = ((ascend) ? T(end-start) : T(start-end)) / T(inc); const uword N = uword(1) + ( (is_non_integral::value) ? uword(std::floor(double(M))) : uword(M) ); x.set_size(N); eT* x_mem = x.memptr(); if(ascend) { for(uword i=0; i < N; ++i) { x_mem[i] = eT( start + T(i*inc) ); } } else { for(uword i=0; i < N; ++i) { x_mem[i] = eT( start - T(i*inc) ); } } } template inline typename enable_if2< is_Mat::value && (is_signed::value == true), vec_type >::result regspace ( const typename vec_type::pod_type start, const sT delta, const typename vec_type::pod_type end ) { arma_debug_sigprint(); arma_debug_print("regspace(): signed version"); vec_type x; if( ((delta == sT(+1)) && (start <= end)) || ((delta == sT(-1)) && (start > end)) ) { internal_regspace_default_delta(x, start, end); } else { internal_regspace_var_delta(x, start, delta, end); } if(x.n_elem == 0) { if(is_Mat_only::value) { x.set_size(1,0); } } return x; } template inline typename enable_if2< is_Mat::value && (is_signed::value == false), vec_type >::result regspace ( const typename vec_type::pod_type start, const uT delta, const typename vec_type::pod_type end ) { arma_debug_sigprint(); arma_debug_print("regspace(): unsigned version"); vec_type x; if( (delta == uT(+1)) && (start <= end) ) { internal_regspace_default_delta(x, start, end); } else { internal_regspace_var_delta(x, start, delta, end); } if(x.n_elem == 0) { if(is_Mat_only::value) { x.set_size(1,0); } } return x; } template arma_warn_unused inline typename enable_if2 < is_Mat::value, vec_type >::result regspace ( const typename vec_type::pod_type start, const typename vec_type::pod_type end ) { arma_debug_sigprint(); vec_type x; internal_regspace_default_delta(x, start, end); if(x.n_elem == 0) { if(is_Mat_only::value) { x.set_size(1,0); } } return x; } arma_warn_unused inline vec regspace(const double start, const double delta, const double end) { arma_debug_sigprint(); return regspace(start, delta, end); } arma_warn_unused inline vec regspace(const double start, const double end) { arma_debug_sigprint(); return regspace(start, end); } //! @} RcppArmadillo/inst/include/armadillo_bits/op_roots_bones.hpp0000644000176200001440000000253414301267043024137 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_roots //! @{ class op_roots : public traits_op_col { public: template inline static void apply(Mat< std::complex >& out, const mtOp, T1, op_roots>& expr); template inline static bool apply_direct(Mat< std::complex >& out, const Base& X); template inline static bool apply_noalias(Mat< std::complex::result> >& out, const Mat& X); }; //! @} RcppArmadillo/inst/include/armadillo_bits/spop_shift_meat.hpp0000644000176200001440000000530314631567470024303 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup spop_shift //! @{ template inline void spop_shift::apply_noalias(SpMat& out, const SpMat& X, const uword len, const uword neg, const uword dim) { arma_debug_sigprint(); arma_conform_check_bounds( ((dim == 0) && (len >= X.n_rows)), "shift(): shift amount out of bounds" ); arma_conform_check_bounds( ((dim == 1) && (len >= X.n_cols)), "shift(): shift amount out of bounds" ); if(X.n_nonzero == 0) { out.zeros(X.n_rows, X.n_cols); return; } if(len == 0) { out = X; return; } typename SpMat::const_iterator it = X.begin(); typename SpMat::const_iterator it_end = X.end(); Mat locs(2, X.n_nonzero, arma_nozeros_indicator()); uword* locs_mem = locs.memptr(); if(dim == 0) { const uword X_row_threshold = X.n_rows - len; for(; it != it_end; ++it) { const uword X_row = it.row(); uword Y_row = 0; if(neg == 0) { Y_row = (X_row < X_row_threshold) ? (X_row + len) : (X_row - X_row_threshold); } else if(neg == 1) { Y_row = (X_row >= len ) ? (X_row - len) : (X_row + X_row_threshold); } locs_mem[0] = Y_row; locs_mem[1] = it.col(); locs_mem += 2; } } else if(dim == 1) { const uword X_col_threshold = X.n_cols - len; for(; it != it_end; ++it) { const uword X_col = it.col(); uword Y_col = 0; if(neg == 0) { Y_col = (X_col < X_col_threshold) ? (X_col + len) : (X_col - X_col_threshold); } else if(neg == 1) { Y_col = (X_col >= len ) ? (X_col - len) : (X_col + X_col_threshold); } locs_mem[0] = it.row(); locs_mem[1] = Y_col; locs_mem += 2; } } const Col vals(const_cast(X.values), X.n_nonzero, false); SpMat Y(locs, vals, X.n_rows, X.n_cols, true, false); out.steal_mem(Y); } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_randperm.hpp0000644000176200001440000000647515030507611023406 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_randperm //! @{ template inline void internal_randperm_helper(obj_type& x, const uword N, const uword N_keep) { arma_debug_sigprint(); typedef typename obj_type::elem_type eT; // see op_sort_index_bones.hpp for the definition of arma_sort_index_packet // and the associated comparison functor typedef arma_sort_index_packet packet; std::vector packet_vec(N); podarray tmp(N); int* tmp_mem = tmp.memptr(); const int a = 0; const int b = arma_rng::randi::max_val(); arma_rng::randi::fill(tmp_mem, N, a, b); for(uword i=0; i < N; ++i) { packet_vec[i].val = tmp_mem[i]; packet_vec[i].index = i; } arma_sort_index_helper_ascend comparator; if(N >= 2) { if(N_keep < N) { typename std::vector::iterator first = packet_vec.begin(); typename std::vector::iterator nth = first + N_keep; typename std::vector::iterator pastlast = packet_vec.end(); std::partial_sort(first, nth, pastlast, comparator); } else { std::sort( packet_vec.begin(), packet_vec.end(), comparator ); } } if(is_Row::value) { x.set_size(1,N_keep); } else { x.set_size(N_keep,1); } eT* x_mem = x.memptr(); for(uword i=0; i < N_keep; ++i) { x_mem[i] = eT( packet_vec[i].index ); } } template arma_warn_unused inline typename enable_if2< is_Mat::value, obj_type >::result randperm(const uword N) { arma_debug_sigprint(); obj_type x; if(N > 0) { internal_randperm_helper(x, N, N); } return x; } arma_warn_unused inline uvec randperm(const uword N) { arma_debug_sigprint(); uvec x; if(N > 0) { internal_randperm_helper(x, N, N); } return x; } template arma_warn_unused inline typename enable_if2< is_Mat::value, obj_type >::result randperm(const uword N, const uword M) { arma_debug_sigprint(); arma_conform_check( (M > N), "randperm(): 'M' must be less than or equal to 'N'" ); obj_type x; if( (N > 0) && (M > 0) ) { internal_randperm_helper(x, N, M); } return x; } arma_warn_unused inline uvec randperm(const uword N, const uword M) { arma_debug_sigprint(); arma_conform_check( (M > N), "randperm(): 'M' must be less than or equal to 'N'" ); uvec x; if( (N > 0) && (M > 0) ) { internal_randperm_helper(x, N, M); } return x; } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_conv_to.hpp0000644000176200001440000005764314753015675023267 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_conv_to //! @{ //! conversion from Armadillo Base and BaseCube objects to scalars //! NOTE: use as_scalar() instead; this functionality is kept only for compatibility with old user code template class conv_to { public: template arma_frown("use as_scalar() instead") inline static out_eT from(const in_eT& in, const typename arma_scalar_only::result* junk = nullptr); template arma_frown("use as_scalar() instead") inline static out_eT from(const Base& in, const typename arma_not_cx::result* junk = nullptr); template arma_frown("use as_scalar() instead") inline static out_eT from(const Base& in, const typename arma_cx_only::result* junk = nullptr); template arma_frown("use as_scalar() instead") inline static out_eT from(const BaseCube& in, const typename arma_not_cx::result* junk = nullptr); template arma_frown("use as_scalar() instead") inline static out_eT from(const BaseCube& in, const typename arma_cx_only::result* junk = nullptr); }; template template arma_warn_unused inline out_eT conv_to::from(const in_eT& in, const typename arma_scalar_only::result* junk) { arma_debug_sigprint(); arma_ignore(junk); arma_type_check(( is_supported_elem_type::value == false )); // NOTE: this is meant only as a workaround for old user code; // NOTE: it doesn't handle conversions from complex to real return out_eT(in); } template template arma_warn_unused inline out_eT conv_to::from(const Base& in, const typename arma_not_cx::result* junk) { arma_debug_sigprint(); arma_ignore(junk); arma_type_check(( is_supported_elem_type::value == false )); const Proxy P(in.get_ref()); arma_conform_check( (P.get_n_elem() != 1), "conv_to(): expected 1x1 matrix" ); return out_eT(Proxy::use_at ? P.at(0,0) : P[0]); } template template arma_warn_unused inline out_eT conv_to::from(const Base& in, const typename arma_cx_only::result* junk) { arma_debug_sigprint(); arma_ignore(junk); arma_type_check(( is_supported_elem_type::value == false )); const Proxy P(in.get_ref()); arma_conform_check( (P.get_n_elem() != 1), "conv_to(): expected 1x1 matrix" ); out_eT out; arrayops::convert_cx_scalar(out, (Proxy::use_at ? P.at(0,0) : P[0])); return out; } template template arma_warn_unused inline out_eT conv_to::from(const BaseCube& in, const typename arma_not_cx::result* junk) { arma_debug_sigprint(); arma_ignore(junk); arma_type_check(( is_supported_elem_type::value == false )); const ProxyCube P(in.get_ref()); arma_conform_check( (P.get_n_elem() != 1), "conv_to(): expected 1x1x1 cube" ); return out_eT(ProxyCube::use_at ? P.at(0,0,0) : P[0]); } template template arma_warn_unused inline out_eT conv_to::from(const BaseCube& in, const typename arma_cx_only::result* junk) { arma_debug_sigprint(); arma_ignore(junk); arma_type_check(( is_supported_elem_type::value == false )); const ProxyCube P(in.get_ref()); arma_conform_check( (P.get_n_elem() != 1), "conv_to(): expected 1x1x1 cube" ); out_eT out; arrayops::convert_cx_scalar(out, (ProxyCube::use_at ? P.at(0,0,0) : P[0])); return out; } //! conversion to Armadillo matrices from Armadillo Base objects, as well as from std::vector template class conv_to< Mat > { public: template inline static Mat from(const Base& in, const typename arma_not_cx::result* junk = nullptr); template inline static Mat from(const Base& in, const typename arma_cx_only::result* junk = nullptr); // template inline static Mat from(const SpBase& in, const typename arma_not_cx::result* junk = nullptr); template inline static Mat from(const SpBase& in, const typename arma_cx_only::result* junk = nullptr); // template inline static Mat from(const std::vector& in, const typename arma_not_cx::result* junk = nullptr); template inline static Mat from(const std::vector& in, const typename arma_cx_only::result* junk = nullptr); }; template template arma_warn_unused inline Mat conv_to< Mat >::from(const Base& in, const typename arma_not_cx::result* junk) { arma_debug_sigprint(); arma_ignore(junk); const quasi_unwrap tmp(in.get_ref()); const Mat& X = tmp.M; Mat out(X.n_rows, X.n_cols, arma_nozeros_indicator()); arrayops::convert( out.memptr(), X.memptr(), X.n_elem ); return out; } template template arma_warn_unused inline Mat conv_to< Mat >::from(const Base& in, const typename arma_cx_only::result* junk) { arma_debug_sigprint(); arma_ignore(junk); const quasi_unwrap tmp(in.get_ref()); const Mat& X = tmp.M; Mat out(X.n_rows, X.n_cols, arma_nozeros_indicator()); arrayops::convert_cx( out.memptr(), X.memptr(), X.n_elem ); return out; } template template arma_warn_unused inline Mat conv_to< Mat >::from(const SpBase& in, const typename arma_not_cx::result* junk) { arma_debug_sigprint(); arma_ignore(junk); const unwrap_spmat U(in.get_ref()); const SpMat& X = U.M; Mat out(X.n_rows, X.n_cols, arma_zeros_indicator()); podarray tmp(X.n_nonzero); arrayops::convert( tmp.memptr(), X.values, X.n_nonzero ); typename SpMat::const_iterator it = X.begin(); typename SpMat::const_iterator it_end = X.end(); for(uword count=0; it != it_end; ++it, ++count) { out.at(it.row(), it.col()) = tmp[count]; } return out; } template template arma_warn_unused inline Mat conv_to< Mat >::from(const SpBase& in, const typename arma_cx_only::result* junk) { arma_debug_sigprint(); arma_ignore(junk); const unwrap_spmat U(in.get_ref()); const SpMat& X = U.M; Mat out(X.n_rows, X.n_cols, arma_zeros_indicator()); podarray tmp(X.n_nonzero); arrayops::convert_cx( tmp.memptr(), X.values, X.n_nonzero ); typename SpMat::const_iterator it = X.begin(); typename SpMat::const_iterator it_end = X.end(); for(uword count=0; it != it_end; ++it, ++count) { out.at(it.row(), it.col()) = tmp[count]; } return out; } template template arma_warn_unused inline Mat conv_to< Mat >::from(const std::vector& in, const typename arma_not_cx::result* junk) { arma_debug_sigprint(); arma_ignore(junk); const uword N = uword( in.size() ); Mat out(N, 1, arma_nozeros_indicator()); if(N > 0) { arrayops::convert( out.memptr(), &(in[0]), N ); } return out; } template template arma_warn_unused inline Mat conv_to< Mat >::from(const std::vector& in, const typename arma_cx_only::result* junk) { arma_debug_sigprint(); arma_ignore(junk); const uword N = uword( in.size() ); Mat out(N, 1, arma_nozeros_indicator()); if(N > 0) { arrayops::convert_cx( out.memptr(), &(in[0]), N ); } return out; } //! conversion to Armadillo row vectors from Armadillo Base objects, as well as from std::vector template class conv_to< Row > { public: template inline static Row from(const Base& in, const typename arma_not_cx::result* junk = nullptr); template inline static Row from(const Base& in, const typename arma_cx_only::result* junk = nullptr); // template inline static Row from(const std::vector& in, const typename arma_not_cx::result* junk = nullptr); template inline static Row from(const std::vector& in, const typename arma_cx_only::result* junk = nullptr); }; template template arma_warn_unused inline Row conv_to< Row >::from(const Base& in, const typename arma_not_cx::result* junk) { arma_debug_sigprint(); arma_ignore(junk); const quasi_unwrap tmp(in.get_ref()); const Mat& X = tmp.M; arma_conform_check( ( (X.is_vec() == false) && (X.is_empty() == false) ), "conv_to(): given object cannot be interpreted as a vector" ); Row out(X.n_elem, arma_nozeros_indicator()); arrayops::convert( out.memptr(), X.memptr(), X.n_elem ); return out; } template template arma_warn_unused inline Row conv_to< Row >::from(const Base& in, const typename arma_cx_only::result* junk) { arma_debug_sigprint(); arma_ignore(junk); const quasi_unwrap tmp(in.get_ref()); const Mat& X = tmp.M; arma_conform_check( ( (X.is_vec() == false) && (X.is_empty() == false) ), "conv_to(): given object cannot be interpreted as a vector" ); Row out(X.n_rows, X.n_cols, arma_nozeros_indicator()); arrayops::convert_cx( out.memptr(), X.memptr(), X.n_elem ); return out; } template template arma_warn_unused inline Row conv_to< Row >::from(const std::vector& in, const typename arma_not_cx::result* junk) { arma_debug_sigprint(); arma_ignore(junk); const uword N = uword( in.size() ); Row out(N, arma_nozeros_indicator()); if(N > 0) { arrayops::convert( out.memptr(), &(in[0]), N ); } return out; } template template arma_warn_unused inline Row conv_to< Row >::from(const std::vector& in, const typename arma_cx_only::result* junk) { arma_debug_sigprint(); arma_ignore(junk); const uword N = uword( in.size() ); Row out(N, arma_nozeros_indicator()); if(N > 0) { arrayops::convert_cx( out.memptr(), &(in[0]), N ); } return out; } //! conversion to Armadillo column vectors from Armadillo Base objects, as well as from std::vector template class conv_to< Col > { public: template inline static Col from(const Base& in, const typename arma_not_cx::result* junk = nullptr); template inline static Col from(const Base& in, const typename arma_cx_only::result* junk = nullptr); // template inline static Col from(const std::vector& in, const typename arma_not_cx::result* junk = nullptr); template inline static Col from(const std::vector& in, const typename arma_cx_only::result* junk = nullptr); }; template template arma_warn_unused inline Col conv_to< Col >::from(const Base& in, const typename arma_not_cx::result* junk) { arma_debug_sigprint(); arma_ignore(junk); const quasi_unwrap tmp(in.get_ref()); const Mat& X = tmp.M; arma_conform_check( ( (X.is_vec() == false) && (X.is_empty() == false) ), "conv_to(): given object cannot be interpreted as a vector" ); Col out(X.n_elem, arma_nozeros_indicator()); arrayops::convert( out.memptr(), X.memptr(), X.n_elem ); return out; } template template arma_warn_unused inline Col conv_to< Col >::from(const Base& in, const typename arma_cx_only::result* junk) { arma_debug_sigprint(); arma_ignore(junk); const quasi_unwrap tmp(in.get_ref()); const Mat& X = tmp.M; arma_conform_check( ( (X.is_vec() == false) && (X.is_empty() == false) ), "conv_to(): given object cannot be interpreted as a vector" ); Col out(X.n_rows, X.n_cols, arma_nozeros_indicator()); arrayops::convert_cx( out.memptr(), X.memptr(), X.n_elem ); return out; } template template arma_warn_unused inline Col conv_to< Col >::from(const std::vector& in, const typename arma_not_cx::result* junk) { arma_debug_sigprint(); arma_ignore(junk); const uword N = uword( in.size() ); Col out(N, arma_nozeros_indicator()); if(N > 0) { arrayops::convert( out.memptr(), &(in[0]), N ); } return out; } template template arma_warn_unused inline Col conv_to< Col >::from(const std::vector& in, const typename arma_cx_only::result* junk) { arma_debug_sigprint(); arma_ignore(junk); const uword N = uword( in.size() ); Col out(N, arma_nozeros_indicator()); if(N > 0) { arrayops::convert_cx( out.memptr(), &(in[0]), N ); } return out; } //! convert between SpMat types template class conv_to< SpMat > { public: template inline static SpMat from(const SpBase& in, const typename arma_not_cx::result* junk = nullptr); template inline static SpMat from(const SpBase& in, const typename arma_cx_only::result* junk = nullptr); // template inline static SpMat from(const Base& in, const typename arma_not_cx::result* junk = nullptr); template inline static SpMat from(const Base& in, const typename arma_cx_only::result* junk = nullptr); }; template template arma_warn_unused inline SpMat conv_to< SpMat >::from(const SpBase& in, const typename arma_not_cx::result* junk) { arma_debug_sigprint(); arma_ignore(junk); const unwrap_spmat tmp(in.get_ref()); const SpMat& X = tmp.M; SpMat out(arma_layout_indicator(), X); arrayops::convert( access::rwp(out.values), X.values, X.n_nonzero ); out.remove_zeros(); return out; } template template arma_warn_unused inline SpMat conv_to< SpMat >::from(const SpBase& in, const typename arma_cx_only::result* junk) { arma_debug_sigprint(); arma_ignore(junk); const unwrap_spmat tmp(in.get_ref()); const SpMat& X = tmp.M; SpMat out(arma_layout_indicator(), X); arrayops::convert_cx( access::rwp(out.values), X.values, X.n_nonzero ); out.remove_zeros(); return out; } template template arma_warn_unused inline SpMat conv_to< SpMat >::from(const Base& in, const typename arma_not_cx::result* junk) { arma_debug_sigprint(); arma_ignore(junk); SpMat out; const quasi_unwrap U(in.get_ref()); const Mat& X = U.M; if(is_same_type::yes) { const Mat& Y = reinterpret_cast&>(X); SpMat tmp(Y); out.steal_mem(tmp); } else { const uword X_n_rows = X.n_rows; const uword X_n_cols = X.n_cols; const uword X_n_elem = X.n_elem; const in_eT* X_mem = X.memptr(); uword X_nnz = 0; for(uword i=0; i < X_n_elem; ++i) { X_nnz += (X_mem[i] != in_eT(0)) ? uword(1) : uword(0); } podarray< in_eT> X_nonzeros(X_nnz); podarray Y_nonzeros(X_nnz); for(uword i=0,count=0; i < X_n_elem; ++i) { const in_eT X_val = X_mem[i]; if(X_val != in_eT(0)) { X_nonzeros[count] = X_val; ++count; } } arrayops::convert( Y_nonzeros.memptr(), X_nonzeros.memptr(), X_nnz ); if(X_nnz == 0) { out.set_size(X_n_rows, X.n_cols); } else { SpMat tmp(arma_reserve_indicator(), X_n_rows, X_n_cols, X_nnz); uword count = 0; for(uword c=0; c < X_n_cols; ++c) for(uword r=0; r < X_n_rows; ++r) { const in_eT X_val = (*X_mem); ++X_mem; if(X_val != in_eT(0)) { access::rw(tmp.values[count]) = Y_nonzeros[count]; access::rw(tmp.row_indices[count]) = r; access::rw(tmp.col_ptrs[c + 1])++; ++count; } } // Sum column counts to be column pointers. for(uword c=1; c <= tmp.n_cols; ++c) { access::rw(tmp.col_ptrs[c]) += tmp.col_ptrs[c - 1]; } tmp.remove_zeros(); // in case conversion resulted in an element equal to zero out.steal_mem(tmp); } } return out; } template template arma_warn_unused inline SpMat conv_to< SpMat >::from(const Base& in, const typename arma_cx_only::result* junk) { arma_debug_sigprint(); arma_ignore(junk); SpMat out; const quasi_unwrap U(in.get_ref()); const Mat& X = U.M; if(is_same_type::yes) { const Mat& Y = reinterpret_cast&>(X); SpMat tmp(Y); out.steal_mem(tmp); } else { const uword X_n_rows = X.n_rows; const uword X_n_cols = X.n_cols; const uword X_n_elem = X.n_elem; const in_eT* X_mem = X.memptr(); uword X_nnz = 0; for(uword i=0; i < X_n_elem; ++i) { X_nnz += (X_mem[i] != in_eT(0)) ? uword(1) : uword(0); } podarray< in_eT> X_nonzeros(X_nnz); podarray Y_nonzeros(X_nnz); for(uword i=0,count=0; i < X_n_elem; ++i) { const in_eT X_val = X_mem[i]; if(X_val != in_eT(0)) { X_nonzeros[count] = X_val; ++count; } } arrayops::convert_cx( Y_nonzeros.memptr(), X_nonzeros.memptr(), X_nnz ); if(X_nnz == 0) { out.set_size(X_n_rows, X.n_cols); } else { SpMat tmp(arma_reserve_indicator(), X_n_rows, X_n_cols, X_nnz); uword count = 0; for(uword c=0; c < X_n_cols; ++c) for(uword r=0; r < X_n_rows; ++r) { const in_eT X_val = (*X_mem); ++X_mem; if(X_val != in_eT(0)) { access::rw(tmp.values[count]) = Y_nonzeros[count]; access::rw(tmp.row_indices[count]) = r; access::rw(tmp.col_ptrs[c + 1])++; ++count; } } // Sum column counts to be column pointers. for(uword c=1; c <= tmp.n_cols; ++c) { access::rw(tmp.col_ptrs[c]) += tmp.col_ptrs[c - 1]; } tmp.remove_zeros(); // in case conversion resulted in an element equal to zero out.steal_mem(tmp); } } return out; } //! conversion to Armadillo cubes from Armadillo BaseCube objects template class conv_to< Cube > { public: template inline static Cube from(const BaseCube& in, const typename arma_not_cx::result* junk = nullptr); template inline static Cube from(const BaseCube& in, const typename arma_cx_only::result* junk = nullptr); }; template template arma_warn_unused inline Cube conv_to< Cube >::from(const BaseCube& in, const typename arma_not_cx::result* junk) { arma_debug_sigprint(); arma_ignore(junk); const unwrap_cube tmp( in.get_ref() ); const Cube& X = tmp.M; Cube out(X.n_rows, X.n_cols, X.n_slices, arma_nozeros_indicator()); arrayops::convert( out.memptr(), X.memptr(), X.n_elem ); return out; } template template arma_warn_unused inline Cube conv_to< Cube >::from(const BaseCube& in, const typename arma_cx_only::result* junk) { arma_debug_sigprint(); arma_ignore(junk); const unwrap_cube tmp( in.get_ref() ); const Cube& X = tmp.M; Cube out(X.n_rows, X.n_cols, X.n_slices, arma_nozeros_indicator()); arrayops::convert_cx( out.memptr(), X.memptr(), X.n_elem ); return out; } //! conversion to std::vector from Armadillo Base objects template class conv_to< std::vector > { public: template inline static std::vector from(const Base& in, const typename arma_not_cx::result* junk = nullptr); template inline static std::vector from(const Base& in, const typename arma_cx_only::result* junk = nullptr); }; template template arma_warn_unused inline std::vector conv_to< std::vector >::from(const Base& in, const typename arma_not_cx::result* junk) { arma_debug_sigprint(); arma_ignore(junk); const quasi_unwrap tmp(in.get_ref()); const Mat& X = tmp.M; arma_conform_check( ( (X.is_vec() == false) && (X.is_empty() == false) ), "conv_to(): given object cannot be interpreted as a vector" ); const uword N = X.n_elem; std::vector out(N); if(N > 0) { arrayops::convert( &(out[0]), X.memptr(), N ); } return out; } template template arma_warn_unused inline std::vector conv_to< std::vector >::from(const Base& in, const typename arma_cx_only::result* junk) { arma_debug_sigprint(); arma_ignore(junk); const quasi_unwrap tmp(in.get_ref()); const Mat& X = tmp.M; arma_conform_check( ( (X.is_vec() == false) && (X.is_empty() == false) ), "conv_to(): given object cannot be interpreted as a vector" ); const uword N = X.n_elem; std::vector out(N); if(N > 0) { arrayops::convert_cx( &(out[0]), X.memptr(), N ); } return out; } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_normpdf.hpp0000644000176200001440000001251014631567470023245 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_normpdf //! @{ template inline typename enable_if2< (is_real::value), void >::result normpdf_helper(Mat& out, const Base& X_expr, const Base& M_expr, const Base& S_expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; if(Proxy::use_at || Proxy::use_at || Proxy::use_at) { const quasi_unwrap UX(X_expr.get_ref()); const quasi_unwrap UM(M_expr.get_ref()); const quasi_unwrap US(S_expr.get_ref()); normpdf_helper(out, UX.M, UM.M, US.M); return; } const Proxy PX(X_expr.get_ref()); const Proxy PM(M_expr.get_ref()); const Proxy PS(S_expr.get_ref()); arma_conform_check( ( (PX.get_n_rows() != PM.get_n_rows()) || (PX.get_n_cols() != PM.get_n_cols()) || (PM.get_n_rows() != PS.get_n_rows()) || (PM.get_n_cols() != PS.get_n_cols()) ), "normpdf(): size mismatch" ); out.set_size(PX.get_n_rows(), PX.get_n_cols()); eT* out_mem = out.memptr(); const uword N = PX.get_n_elem(); typename Proxy::ea_type X_ea = PX.get_ea(); typename Proxy::ea_type M_ea = PM.get_ea(); typename Proxy::ea_type S_ea = PS.get_ea(); const bool use_mp = arma_config::openmp && mp_gate::eval(N); if(use_mp) { #if defined(ARMA_USE_OPENMP) { const int n_threads = mp_thread_limit::get(); #pragma omp parallel for schedule(static) num_threads(n_threads) for(uword i=0; i::sqrt2pi); } } #endif } else { for(uword i=0; i::sqrt2pi); } } } template arma_warn_unused inline typename enable_if2< (is_real::value), eT >::result normpdf(const eT x) { const eT out = std::exp(eT(-0.5) * (x*x)) / Datum::sqrt2pi; return out; } template arma_warn_unused inline typename enable_if2< (is_real::value), eT >::result normpdf(const eT x, const eT mu, const eT sigma) { const eT tmp = (x - mu) / sigma; const eT out = std::exp(eT(-0.5) * (tmp*tmp)) / (sigma * Datum::sqrt2pi); return out; } template arma_warn_unused inline typename enable_if2< (is_real::value), Mat >::result normpdf(const eT x, const Base& M_expr, const Base& S_expr) { arma_debug_sigprint(); const quasi_unwrap UM(M_expr.get_ref()); const Mat& M = UM.M; Mat out; normpdf_helper(out, x*ones< Mat >(arma::size(M)), M, S_expr.get_ref()); return out; } template arma_warn_unused inline typename enable_if2< (is_real::value), Mat >::result normpdf(const Base& X_expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const quasi_unwrap UX(X_expr.get_ref()); const Mat& X = UX.M; Mat out; normpdf_helper(out, X, zeros< Mat >(arma::size(X)), ones< Mat >(arma::size(X))); return out; } template arma_warn_unused inline typename enable_if2< (is_real::value), Mat >::result normpdf(const Base& X_expr, const typename T1::elem_type mu, const typename T1::elem_type sigma) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const quasi_unwrap UX(X_expr.get_ref()); const Mat& X = UX.M; Mat out; normpdf_helper(out, X, mu*ones< Mat >(arma::size(X)), sigma*ones< Mat >(arma::size(X))); return out; } template arma_warn_unused inline typename enable_if2< (is_real::value), Mat >::result normpdf(const Base& X_expr, const Base& M_expr, const Base& S_expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; Mat out; normpdf_helper(out, X_expr.get_ref(), M_expr.get_ref(), S_expr.get_ref()); return out; } //! @} RcppArmadillo/inst/include/armadillo_bits/running_stat_vec_bones.hpp0000644000176200001440000001311014413016473025636 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup running_stat_vec //! @{ template struct rsv_get_elem_type_worker { }; template struct rsv_get_elem_type_worker { typedef obj_type result; }; template struct rsv_get_elem_type_worker { typedef typename obj_type::elem_type result; }; template struct rsv_get_elem_type { typedef typename rsv_get_elem_type_worker::value>::result elem_type; }; template struct rsv_get_return_type1_worker { }; template struct rsv_get_return_type1_worker { typedef Mat result; }; template struct rsv_get_return_type1_worker { typedef obj_type result; }; template struct rsv_get_return_type1 { typedef typename rsv_get_return_type1_worker::value>::result return_type1; }; template struct rsv_get_return_type2 { }; template struct rsv_get_return_type2< Mat > { typedef Mat::result> return_type2; }; template struct rsv_get_return_type2< Row > { typedef Row::result> return_type2; }; template struct rsv_get_return_type2< Col > { typedef Col::result> return_type2; }; //! Class for keeping statistics of a continuously sampled process / signal. //! Useful if the storage of individual samples is not necessary or desired. //! Also useful if the number of samples is not known beforehand or exceeds //! available memory. template class running_stat_vec { public: // voodoo for compatibility with old user code typedef typename rsv_get_elem_type::elem_type eT; typedef typename get_pod_type::result T; typedef typename rsv_get_return_type1::return_type1 return_type1; typedef typename rsv_get_return_type2::return_type2 return_type2; inline ~running_stat_vec(); inline running_stat_vec(const bool in_calc_cov = false); // TODO: investigate char* overload, eg. "calc_cov", "no_calc_cov" inline running_stat_vec(const running_stat_vec& in_rsv); inline running_stat_vec& operator=(const running_stat_vec& in_rsv); template inline void operator() (const Base< T, T1>& X); template inline void operator() (const Base, T1>& X); inline void reset(); inline const return_type1& mean() const; inline const return_type2& var (const uword norm_type = 0); inline return_type2 stddev(const uword norm_type = 0) const; inline const Mat& cov (const uword norm_type = 0); inline const return_type1& min() const; inline const return_type1& max() const; inline return_type1 range() const; inline T count() const; // // private: const bool calc_cov; arma_aligned arma_counter counter; arma_aligned return_type1 r_mean; arma_aligned return_type2 r_var; arma_aligned Mat r_cov; arma_aligned return_type1 min_val; arma_aligned return_type1 max_val; arma_aligned Mat< T> min_val_norm; arma_aligned Mat< T> max_val_norm; arma_aligned return_type2 r_var_dummy; arma_aligned Mat r_cov_dummy; arma_aligned Mat tmp1; arma_aligned Mat tmp2; friend class running_stat_vec_aux; }; class running_stat_vec_aux { public: template inline static void update_stats ( running_stat_vec& x, const Mat::eT>& sample, const typename arma_not_cx::eT>::result* junk = nullptr ); template inline static void update_stats ( running_stat_vec& x, const Mat::T > >& sample, const typename arma_not_cx::eT>::result* junk = nullptr ); template inline static void update_stats ( running_stat_vec& x, const Mat< typename running_stat_vec::T >& sample, const typename arma_cx_only::eT>::result* junk = nullptr ); template inline static void update_stats ( running_stat_vec& x, const Mat::eT>& sample, const typename arma_cx_only::eT>::result* junk = nullptr ); }; //! @} RcppArmadillo/inst/include/armadillo_bits/SpToDOp_bones.hpp0000644000176200001440000000402414752446051023567 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup SpToDOp //! @{ // NOTE: SpToDOp is dedicated for unary operations on sparse matrices that result in dense matrices. template class SpToDOp : public Base< typename T1::elem_type, SpToDOp > { public: typedef typename T1::elem_type elem_type; typedef typename get_pod_type::result pod_type; static constexpr bool is_row = op_type::template traits::is_row; static constexpr bool is_col = op_type::template traits::is_col; static constexpr bool is_xvec = op_type::template traits::is_xvec; inline explicit SpToDOp(const T1& in_m); inline SpToDOp(const T1& in_m, const elem_type in_aux); inline SpToDOp(const T1& in_m, const uword in_aux_uword_a, const uword in_aux_uword_b); inline ~SpToDOp(); template constexpr bool is_alias(const Mat&) const { return false; } const T1& m; //!< the operand; must be derived from SpBase elem_type aux; //!< auxiliary data, using the element type as used by T1 uword aux_uword_a; //!< auxiliary data, uword format uword aux_uword_b; //!< auxiliary data, uword format }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_princomp_meat.hpp0000644000176200001440000001773114631567470024462 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_princomp //! @{ //! \brief //! principal component analysis -- 4 arguments version //! computation is done via singular value decomposition //! coeff_out -> principal component coefficients //! score_out -> projected samples //! latent_out -> eigenvalues of principal vectors //! tsquared_out -> Hotelling's T^2 statistic template inline bool op_princomp::direct_princomp ( Mat& coeff_out, Mat& score_out, Col& latent_out, Col& tsquared_out, const Base& X ) { arma_debug_sigprint(); typedef typename T1::elem_type eT; typedef typename T1::pod_type T; const unwrap_check Y( X.get_ref(), score_out ); const Mat& in = Y.M; const uword n_rows = in.n_rows; const uword n_cols = in.n_cols; if(n_rows > 1) // more than one sample { // subtract the mean - use score_out as temporary matrix score_out = in; score_out.each_row() -= mean(in); // singular value decomposition Mat U; Col< T> s; const bool svd_ok = (n_rows >= n_cols) ? svd_econ(U, s, coeff_out, score_out) : svd(U, s, coeff_out, score_out); if(svd_ok == false) { return false; } // normalize the eigenvalues s /= std::sqrt( double(n_rows - 1) ); // project the samples to the principals score_out *= coeff_out; if(n_rows <= n_cols) // number of samples is less than their dimensionality { score_out.cols(n_rows-1,n_cols-1).zeros(); Col s_tmp(n_cols, arma_zeros_indicator()); s_tmp.rows(0,n_rows-2) = s.rows(0,n_rows-2); s = s_tmp; // compute the Hotelling's T-squared s_tmp.rows(0,n_rows-2) = T(1) / s_tmp.rows(0,n_rows-2); const Mat S = score_out * diagmat(Col(s_tmp)); tsquared_out = sum(S%S,1); } else { // compute the Hotelling's T-squared // TODO: replace with more robust approach const Mat S = score_out * diagmat(Col( T(1) / s)); tsquared_out = sum(S%S,1); } // compute the eigenvalues of the principal vectors latent_out = s%s; } else // 0 or 1 samples { coeff_out.eye(n_cols, n_cols); score_out.copy_size(in); score_out.zeros(); latent_out.set_size(n_cols); latent_out.zeros(); tsquared_out.set_size(n_rows); tsquared_out.zeros(); } return true; } //! \brief //! principal component analysis -- 3 arguments version //! computation is done via singular value decomposition //! coeff_out -> principal component coefficients //! score_out -> projected samples //! latent_out -> eigenvalues of principal vectors template inline bool op_princomp::direct_princomp ( Mat& coeff_out, Mat& score_out, Col& latent_out, const Base& X ) { arma_debug_sigprint(); typedef typename T1::elem_type eT; typedef typename T1::pod_type T; const unwrap_check Y( X.get_ref(), score_out ); const Mat& in = Y.M; const uword n_rows = in.n_rows; const uword n_cols = in.n_cols; if(n_rows > 1) // more than one sample { // subtract the mean - use score_out as temporary matrix score_out = in; score_out.each_row() -= mean(in); // singular value decomposition Mat U; Col< T> s; const bool svd_ok = (n_rows >= n_cols) ? svd_econ(U, s, coeff_out, score_out) : svd(U, s, coeff_out, score_out); if(svd_ok == false) { return false; } // normalize the eigenvalues s /= std::sqrt( double(n_rows - 1) ); // project the samples to the principals score_out *= coeff_out; if(n_rows <= n_cols) // number of samples is less than their dimensionality { score_out.cols(n_rows-1,n_cols-1).zeros(); Col s_tmp(n_cols, arma_zeros_indicator()); s_tmp.rows(0,n_rows-2) = s.rows(0,n_rows-2); s = s_tmp; } // compute the eigenvalues of the principal vectors latent_out = s%s; } else // 0 or 1 samples { coeff_out.eye(n_cols, n_cols); score_out.copy_size(in); score_out.zeros(); latent_out.set_size(n_cols); latent_out.zeros(); } return true; } //! \brief //! principal component analysis -- 2 arguments version //! computation is done via singular value decomposition //! coeff_out -> principal component coefficients //! score_out -> projected samples template inline bool op_princomp::direct_princomp ( Mat& coeff_out, Mat& score_out, const Base& X ) { arma_debug_sigprint(); typedef typename T1::elem_type eT; typedef typename T1::pod_type T; const unwrap_check Y( X.get_ref(), score_out ); const Mat& in = Y.M; const uword n_rows = in.n_rows; const uword n_cols = in.n_cols; if(n_rows > 1) // more than one sample { // subtract the mean - use score_out as temporary matrix score_out = in; score_out.each_row() -= mean(in); // singular value decomposition Mat U; Col< T> s; const bool svd_ok = (n_rows >= n_cols) ? svd_econ(U, s, coeff_out, score_out) : svd(U, s, coeff_out, score_out); if(svd_ok == false) { return false; } // project the samples to the principals score_out *= coeff_out; if(n_rows <= n_cols) // number of samples is less than their dimensionality { score_out.cols(n_rows-1,n_cols-1).zeros(); } } else // 0 or 1 samples { coeff_out.eye(n_cols, n_cols); score_out.copy_size(in); score_out.zeros(); } return true; } //! \brief //! principal component analysis -- 1 argument version //! computation is done via singular value decomposition //! coeff_out -> principal component coefficients template inline bool op_princomp::direct_princomp ( Mat& coeff_out, const Base& X ) { arma_debug_sigprint(); typedef typename T1::elem_type eT; typedef typename T1::pod_type T; const unwrap Y( X.get_ref() ); const Mat& in = Y.M; if(in.n_elem != 0) { Mat tmp = in; tmp.each_row() -= mean(in); // singular value decomposition Mat U; Col< T> s; const bool svd_ok = (in.n_rows >= in.n_cols) ? svd_econ(U, s, coeff_out, tmp) : svd(U, s, coeff_out, tmp); if(svd_ok == false) { return false; } } else { coeff_out.eye(in.n_cols, in.n_cols); } return true; } template inline void op_princomp::apply ( Mat& out, const Op& in ) { arma_debug_sigprint(); const bool status = op_princomp::direct_princomp(out, in.m); if(status == false) { out.soft_reset(); arma_stop_runtime_error("princomp(): decomposition failed"); } } //! @} RcppArmadillo/inst/include/armadillo_bits/eglue_core_meat.hpp0000644000176200001440000013343714770765377024262 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup eglue_core //! @{ #undef arma_applier_1u #undef arma_applier_1a #undef arma_applier_2 #undef arma_applier_3 #undef operatorA #undef operatorB #undef arma_applier_1_mp #undef arma_applier_2_mp #undef arma_applier_3_mp #if defined(ARMA_SIMPLE_LOOPS) #define arma_applier_1u(operatorA, operatorB) \ {\ for(uword i=0; i template inline void eglue_core::apply(outT& out, const eGlue& x) { arma_debug_sigprint(); typedef typename T1::elem_type eT; constexpr bool use_at = (Proxy::use_at || Proxy::use_at); constexpr bool use_mp = (Proxy::use_mp || Proxy::use_mp) && (arma_config::openmp); // NOTE: we're assuming that the matrix has already been set to the correct size and there is no aliasing; // size setting and alias checking is done by either the Mat constructor or operator=() eT* out_mem = out.memptr(); if(use_at == false) { const uword n_elem = x.get_n_elem(); if(use_mp && mp_gate::use_mp && Proxy::use_mp)>::eval(n_elem)) { typename Proxy::ea_type P1 = x.P1.get_ea(); typename Proxy::ea_type P2 = x.P2.get_ea(); if(is_same_type::yes) { arma_applier_1_mp(=, +); } else if(is_same_type::yes) { arma_applier_1_mp(=, -); } else if(is_same_type::yes) { arma_applier_1_mp(=, /); } else if(is_same_type::yes) { arma_applier_1_mp(=, *); } } else { if(memory::is_aligned(out_mem)) { memory::mark_as_aligned(out_mem); if(x.P1.is_aligned() && x.P2.is_aligned()) { typename Proxy::aligned_ea_type P1 = x.P1.get_aligned_ea(); typename Proxy::aligned_ea_type P2 = x.P2.get_aligned_ea(); if(is_same_type::yes) { arma_applier_1a(=, +); } else if(is_same_type::yes) { arma_applier_1a(=, -); } else if(is_same_type::yes) { arma_applier_1a(=, /); } else if(is_same_type::yes) { arma_applier_1a(=, *); } } else { typename Proxy::ea_type P1 = x.P1.get_ea(); typename Proxy::ea_type P2 = x.P2.get_ea(); if(is_same_type::yes) { arma_applier_1u(=, +); } else if(is_same_type::yes) { arma_applier_1u(=, -); } else if(is_same_type::yes) { arma_applier_1u(=, /); } else if(is_same_type::yes) { arma_applier_1u(=, *); } } } else { typename Proxy::ea_type P1 = x.P1.get_ea(); typename Proxy::ea_type P2 = x.P2.get_ea(); if(is_same_type::yes) { arma_applier_1u(=, +); } else if(is_same_type::yes) { arma_applier_1u(=, -); } else if(is_same_type::yes) { arma_applier_1u(=, /); } else if(is_same_type::yes) { arma_applier_1u(=, *); } } } } else { const uword n_rows = x.get_n_rows(); const uword n_cols = x.get_n_cols(); const Proxy& P1 = x.P1; const Proxy& P2 = x.P2; if(use_mp && mp_gate::use_mp && Proxy::use_mp)>::eval(x.get_n_elem())) { if(is_same_type::yes) { arma_applier_2_mp(=, +); } else if(is_same_type::yes) { arma_applier_2_mp(=, -); } else if(is_same_type::yes) { arma_applier_2_mp(=, /); } else if(is_same_type::yes) { arma_applier_2_mp(=, *); } } else { if(is_same_type::yes) { arma_applier_2(=, +); } else if(is_same_type::yes) { arma_applier_2(=, -); } else if(is_same_type::yes) { arma_applier_2(=, /); } else if(is_same_type::yes) { arma_applier_2(=, *); } } } } template template inline void eglue_core::apply_inplace_plus(Mat& out, const eGlue& x) { arma_debug_sigprint(); const uword n_rows = x.get_n_rows(); const uword n_cols = x.get_n_cols(); arma_conform_assert_same_size(out.n_rows, out.n_cols, n_rows, n_cols, "addition"); typedef typename T1::elem_type eT; eT* out_mem = out.memptr(); constexpr bool use_at = (Proxy::use_at || Proxy::use_at); constexpr bool use_mp = (Proxy::use_mp || Proxy::use_mp) && (arma_config::openmp); if(use_at == false) { const uword n_elem = x.get_n_elem(); if(use_mp && mp_gate::use_mp && Proxy::use_mp)>::eval(n_elem)) { typename Proxy::ea_type P1 = x.P1.get_ea(); typename Proxy::ea_type P2 = x.P2.get_ea(); if(is_same_type::yes) { arma_applier_1_mp(+=, +); } else if(is_same_type::yes) { arma_applier_1_mp(+=, -); } else if(is_same_type::yes) { arma_applier_1_mp(+=, /); } else if(is_same_type::yes) { arma_applier_1_mp(+=, *); } } else { if(memory::is_aligned(out_mem)) { memory::mark_as_aligned(out_mem); if(x.P1.is_aligned() && x.P2.is_aligned()) { typename Proxy::aligned_ea_type P1 = x.P1.get_aligned_ea(); typename Proxy::aligned_ea_type P2 = x.P2.get_aligned_ea(); if(is_same_type::yes) { arma_applier_1a(+=, +); } else if(is_same_type::yes) { arma_applier_1a(+=, -); } else if(is_same_type::yes) { arma_applier_1a(+=, /); } else if(is_same_type::yes) { arma_applier_1a(+=, *); } } else { typename Proxy::ea_type P1 = x.P1.get_ea(); typename Proxy::ea_type P2 = x.P2.get_ea(); if(is_same_type::yes) { arma_applier_1u(+=, +); } else if(is_same_type::yes) { arma_applier_1u(+=, -); } else if(is_same_type::yes) { arma_applier_1u(+=, /); } else if(is_same_type::yes) { arma_applier_1u(+=, *); } } } else { typename Proxy::ea_type P1 = x.P1.get_ea(); typename Proxy::ea_type P2 = x.P2.get_ea(); if(is_same_type::yes) { arma_applier_1u(+=, +); } else if(is_same_type::yes) { arma_applier_1u(+=, -); } else if(is_same_type::yes) { arma_applier_1u(+=, /); } else if(is_same_type::yes) { arma_applier_1u(+=, *); } } } } else { const Proxy& P1 = x.P1; const Proxy& P2 = x.P2; if(use_mp && mp_gate::use_mp && Proxy::use_mp)>::eval(x.get_n_elem())) { if(is_same_type::yes) { arma_applier_2_mp(+=, +); } else if(is_same_type::yes) { arma_applier_2_mp(+=, -); } else if(is_same_type::yes) { arma_applier_2_mp(+=, /); } else if(is_same_type::yes) { arma_applier_2_mp(+=, *); } } else { if(is_same_type::yes) { arma_applier_2(+=, +); } else if(is_same_type::yes) { arma_applier_2(+=, -); } else if(is_same_type::yes) { arma_applier_2(+=, /); } else if(is_same_type::yes) { arma_applier_2(+=, *); } } } } template template inline void eglue_core::apply_inplace_minus(Mat& out, const eGlue& x) { arma_debug_sigprint(); const uword n_rows = x.get_n_rows(); const uword n_cols = x.get_n_cols(); arma_conform_assert_same_size(out.n_rows, out.n_cols, n_rows, n_cols, "subtraction"); typedef typename T1::elem_type eT; eT* out_mem = out.memptr(); constexpr bool use_at = (Proxy::use_at || Proxy::use_at); constexpr bool use_mp = (Proxy::use_mp || Proxy::use_mp) && (arma_config::openmp); if(use_at == false) { const uword n_elem = x.get_n_elem(); if(use_mp && mp_gate::use_mp && Proxy::use_mp)>::eval(n_elem)) { typename Proxy::ea_type P1 = x.P1.get_ea(); typename Proxy::ea_type P2 = x.P2.get_ea(); if(is_same_type::yes) { arma_applier_1_mp(-=, +); } else if(is_same_type::yes) { arma_applier_1_mp(-=, -); } else if(is_same_type::yes) { arma_applier_1_mp(-=, /); } else if(is_same_type::yes) { arma_applier_1_mp(-=, *); } } else { if(memory::is_aligned(out_mem)) { memory::mark_as_aligned(out_mem); if(x.P1.is_aligned() && x.P2.is_aligned()) { typename Proxy::aligned_ea_type P1 = x.P1.get_aligned_ea(); typename Proxy::aligned_ea_type P2 = x.P2.get_aligned_ea(); if(is_same_type::yes) { arma_applier_1a(-=, +); } else if(is_same_type::yes) { arma_applier_1a(-=, -); } else if(is_same_type::yes) { arma_applier_1a(-=, /); } else if(is_same_type::yes) { arma_applier_1a(-=, *); } } else { typename Proxy::ea_type P1 = x.P1.get_ea(); typename Proxy::ea_type P2 = x.P2.get_ea(); if(is_same_type::yes) { arma_applier_1u(-=, +); } else if(is_same_type::yes) { arma_applier_1u(-=, -); } else if(is_same_type::yes) { arma_applier_1u(-=, /); } else if(is_same_type::yes) { arma_applier_1u(-=, *); } } } else { typename Proxy::ea_type P1 = x.P1.get_ea(); typename Proxy::ea_type P2 = x.P2.get_ea(); if(is_same_type::yes) { arma_applier_1u(-=, +); } else if(is_same_type::yes) { arma_applier_1u(-=, -); } else if(is_same_type::yes) { arma_applier_1u(-=, /); } else if(is_same_type::yes) { arma_applier_1u(-=, *); } } } } else { const Proxy& P1 = x.P1; const Proxy& P2 = x.P2; if(use_mp && mp_gate::use_mp && Proxy::use_mp)>::eval(x.get_n_elem())) { if(is_same_type::yes) { arma_applier_2_mp(-=, +); } else if(is_same_type::yes) { arma_applier_2_mp(-=, -); } else if(is_same_type::yes) { arma_applier_2_mp(-=, /); } else if(is_same_type::yes) { arma_applier_2_mp(-=, *); } } else { if(is_same_type::yes) { arma_applier_2(-=, +); } else if(is_same_type::yes) { arma_applier_2(-=, -); } else if(is_same_type::yes) { arma_applier_2(-=, /); } else if(is_same_type::yes) { arma_applier_2(-=, *); } } } } template template inline void eglue_core::apply_inplace_schur(Mat& out, const eGlue& x) { arma_debug_sigprint(); const uword n_rows = x.get_n_rows(); const uword n_cols = x.get_n_cols(); arma_conform_assert_same_size(out.n_rows, out.n_cols, n_rows, n_cols, "element-wise multiplication"); typedef typename T1::elem_type eT; eT* out_mem = out.memptr(); constexpr bool use_at = (Proxy::use_at || Proxy::use_at); constexpr bool use_mp = (Proxy::use_mp || Proxy::use_mp) && (arma_config::openmp); if(use_at == false) { const uword n_elem = x.get_n_elem(); if(use_mp && mp_gate::use_mp && Proxy::use_mp)>::eval(n_elem)) { typename Proxy::ea_type P1 = x.P1.get_ea(); typename Proxy::ea_type P2 = x.P2.get_ea(); if(is_same_type::yes) { arma_applier_1_mp(*=, +); } else if(is_same_type::yes) { arma_applier_1_mp(*=, -); } else if(is_same_type::yes) { arma_applier_1_mp(*=, /); } else if(is_same_type::yes) { arma_applier_1_mp(*=, *); } } else { if(memory::is_aligned(out_mem)) { memory::mark_as_aligned(out_mem); if(x.P1.is_aligned() && x.P2.is_aligned()) { typename Proxy::aligned_ea_type P1 = x.P1.get_aligned_ea(); typename Proxy::aligned_ea_type P2 = x.P2.get_aligned_ea(); if(is_same_type::yes) { arma_applier_1a(*=, +); } else if(is_same_type::yes) { arma_applier_1a(*=, -); } else if(is_same_type::yes) { arma_applier_1a(*=, /); } else if(is_same_type::yes) { arma_applier_1a(*=, *); } } else { typename Proxy::ea_type P1 = x.P1.get_ea(); typename Proxy::ea_type P2 = x.P2.get_ea(); if(is_same_type::yes) { arma_applier_1u(*=, +); } else if(is_same_type::yes) { arma_applier_1u(*=, -); } else if(is_same_type::yes) { arma_applier_1u(*=, /); } else if(is_same_type::yes) { arma_applier_1u(*=, *); } } } else { typename Proxy::ea_type P1 = x.P1.get_ea(); typename Proxy::ea_type P2 = x.P2.get_ea(); if(is_same_type::yes) { arma_applier_1u(*=, +); } else if(is_same_type::yes) { arma_applier_1u(*=, -); } else if(is_same_type::yes) { arma_applier_1u(*=, /); } else if(is_same_type::yes) { arma_applier_1u(*=, *); } } } } else { const Proxy& P1 = x.P1; const Proxy& P2 = x.P2; if(use_mp && mp_gate::use_mp && Proxy::use_mp)>::eval(x.get_n_elem())) { if(is_same_type::yes) { arma_applier_2_mp(*=, +); } else if(is_same_type::yes) { arma_applier_2_mp(*=, -); } else if(is_same_type::yes) { arma_applier_2_mp(*=, /); } else if(is_same_type::yes) { arma_applier_2_mp(*=, *); } } else { if(is_same_type::yes) { arma_applier_2(*=, +); } else if(is_same_type::yes) { arma_applier_2(*=, -); } else if(is_same_type::yes) { arma_applier_2(*=, /); } else if(is_same_type::yes) { arma_applier_2(*=, *); } } } } template template inline void eglue_core::apply_inplace_div(Mat& out, const eGlue& x) { arma_debug_sigprint(); const uword n_rows = x.get_n_rows(); const uword n_cols = x.get_n_cols(); arma_conform_assert_same_size(out.n_rows, out.n_cols, n_rows, n_cols, "element-wise division"); typedef typename T1::elem_type eT; eT* out_mem = out.memptr(); constexpr bool use_at = (Proxy::use_at || Proxy::use_at); constexpr bool use_mp = (Proxy::use_mp || Proxy::use_mp) && (arma_config::openmp); if(use_at == false) { const uword n_elem = x.get_n_elem(); if(use_mp && mp_gate::use_mp && Proxy::use_mp)>::eval(n_elem)) { typename Proxy::ea_type P1 = x.P1.get_ea(); typename Proxy::ea_type P2 = x.P2.get_ea(); if(is_same_type::yes) { arma_applier_1_mp(/=, +); } else if(is_same_type::yes) { arma_applier_1_mp(/=, -); } else if(is_same_type::yes) { arma_applier_1_mp(/=, /); } else if(is_same_type::yes) { arma_applier_1_mp(/=, *); } } else { if(memory::is_aligned(out_mem)) { memory::mark_as_aligned(out_mem); if(x.P1.is_aligned() && x.P2.is_aligned()) { typename Proxy::aligned_ea_type P1 = x.P1.get_aligned_ea(); typename Proxy::aligned_ea_type P2 = x.P2.get_aligned_ea(); if(is_same_type::yes) { arma_applier_1a(/=, +); } else if(is_same_type::yes) { arma_applier_1a(/=, -); } else if(is_same_type::yes) { arma_applier_1a(/=, /); } else if(is_same_type::yes) { arma_applier_1a(/=, *); } } else { typename Proxy::ea_type P1 = x.P1.get_ea(); typename Proxy::ea_type P2 = x.P2.get_ea(); if(is_same_type::yes) { arma_applier_1u(/=, +); } else if(is_same_type::yes) { arma_applier_1u(/=, -); } else if(is_same_type::yes) { arma_applier_1u(/=, /); } else if(is_same_type::yes) { arma_applier_1u(/=, *); } } } else { typename Proxy::ea_type P1 = x.P1.get_ea(); typename Proxy::ea_type P2 = x.P2.get_ea(); if(is_same_type::yes) { arma_applier_1u(/=, +); } else if(is_same_type::yes) { arma_applier_1u(/=, -); } else if(is_same_type::yes) { arma_applier_1u(/=, /); } else if(is_same_type::yes) { arma_applier_1u(/=, *); } } } } else { const Proxy& P1 = x.P1; const Proxy& P2 = x.P2; if(use_mp && mp_gate::use_mp && Proxy::use_mp)>::eval(x.get_n_elem())) { if(is_same_type::yes) { arma_applier_2_mp(/=, +); } else if(is_same_type::yes) { arma_applier_2_mp(/=, -); } else if(is_same_type::yes) { arma_applier_2_mp(/=, /); } else if(is_same_type::yes) { arma_applier_2_mp(/=, *); } } else { if(is_same_type::yes) { arma_applier_2(/=, +); } else if(is_same_type::yes) { arma_applier_2(/=, -); } else if(is_same_type::yes) { arma_applier_2(/=, /); } else if(is_same_type::yes) { arma_applier_2(/=, *); } } } } // // cubes template template inline void eglue_core::apply(Cube& out, const eGlueCube& x) { arma_debug_sigprint(); typedef typename T1::elem_type eT; constexpr bool use_at = (ProxyCube::use_at || ProxyCube::use_at); constexpr bool use_mp = (ProxyCube::use_mp || ProxyCube::use_mp) && (arma_config::openmp); // NOTE: we're assuming that the cube has already been set to the correct size and there is no aliasing; // size setting and alias checking is done by either the Cube constructor or operator=() eT* out_mem = out.memptr(); if(use_at == false) { const uword n_elem = out.n_elem; if(use_mp && mp_gate::use_mp && ProxyCube::use_mp)>::eval(n_elem)) { typename ProxyCube::ea_type P1 = x.P1.get_ea(); typename ProxyCube::ea_type P2 = x.P2.get_ea(); if(is_same_type::yes) { arma_applier_1_mp(=, +); } else if(is_same_type::yes) { arma_applier_1_mp(=, -); } else if(is_same_type::yes) { arma_applier_1_mp(=, /); } else if(is_same_type::yes) { arma_applier_1_mp(=, *); } } else { if(memory::is_aligned(out_mem)) { memory::mark_as_aligned(out_mem); if(x.P1.is_aligned() && x.P2.is_aligned()) { typename ProxyCube::aligned_ea_type P1 = x.P1.get_aligned_ea(); typename ProxyCube::aligned_ea_type P2 = x.P2.get_aligned_ea(); if(is_same_type::yes) { arma_applier_1a(=, +); } else if(is_same_type::yes) { arma_applier_1a(=, -); } else if(is_same_type::yes) { arma_applier_1a(=, /); } else if(is_same_type::yes) { arma_applier_1a(=, *); } } else { typename ProxyCube::ea_type P1 = x.P1.get_ea(); typename ProxyCube::ea_type P2 = x.P2.get_ea(); if(is_same_type::yes) { arma_applier_1u(=, +); } else if(is_same_type::yes) { arma_applier_1u(=, -); } else if(is_same_type::yes) { arma_applier_1u(=, /); } else if(is_same_type::yes) { arma_applier_1u(=, *); } } } else { typename ProxyCube::ea_type P1 = x.P1.get_ea(); typename ProxyCube::ea_type P2 = x.P2.get_ea(); if(is_same_type::yes) { arma_applier_1u(=, +); } else if(is_same_type::yes) { arma_applier_1u(=, -); } else if(is_same_type::yes) { arma_applier_1u(=, /); } else if(is_same_type::yes) { arma_applier_1u(=, *); } } } } else { const uword n_rows = x.get_n_rows(); const uword n_cols = x.get_n_cols(); const uword n_slices = x.get_n_slices(); const ProxyCube& P1 = x.P1; const ProxyCube& P2 = x.P2; if(use_mp && mp_gate::use_mp && ProxyCube::use_mp)>::eval(x.get_n_elem())) { if(is_same_type::yes) { arma_applier_3_mp(=, +); } else if(is_same_type::yes) { arma_applier_3_mp(=, -); } else if(is_same_type::yes) { arma_applier_3_mp(=, /); } else if(is_same_type::yes) { arma_applier_3_mp(=, *); } } else { if(is_same_type::yes) { arma_applier_3(=, +); } else if(is_same_type::yes) { arma_applier_3(=, -); } else if(is_same_type::yes) { arma_applier_3(=, /); } else if(is_same_type::yes) { arma_applier_3(=, *); } } } } template template inline void eglue_core::apply_inplace_plus(Cube& out, const eGlueCube& x) { arma_debug_sigprint(); const uword n_rows = x.get_n_rows(); const uword n_cols = x.get_n_cols(); const uword n_slices = x.get_n_slices(); arma_conform_assert_same_size(out.n_rows, out.n_cols, out.n_slices, n_rows, n_cols, n_slices, "addition"); typedef typename T1::elem_type eT; eT* out_mem = out.memptr(); constexpr bool use_at = (ProxyCube::use_at || ProxyCube::use_at); constexpr bool use_mp = (ProxyCube::use_mp || ProxyCube::use_mp) && (arma_config::openmp); if(use_at == false) { const uword n_elem = out.n_elem; if(use_mp && mp_gate::use_mp && ProxyCube::use_mp)>::eval(n_elem)) { typename ProxyCube::ea_type P1 = x.P1.get_ea(); typename ProxyCube::ea_type P2 = x.P2.get_ea(); if(is_same_type::yes) { arma_applier_1_mp(+=, +); } else if(is_same_type::yes) { arma_applier_1_mp(+=, -); } else if(is_same_type::yes) { arma_applier_1_mp(+=, /); } else if(is_same_type::yes) { arma_applier_1_mp(+=, *); } } else { if(memory::is_aligned(out_mem)) { memory::mark_as_aligned(out_mem); if(x.P1.is_aligned() && x.P2.is_aligned()) { typename ProxyCube::aligned_ea_type P1 = x.P1.get_aligned_ea(); typename ProxyCube::aligned_ea_type P2 = x.P2.get_aligned_ea(); if(is_same_type::yes) { arma_applier_1a(+=, +); } else if(is_same_type::yes) { arma_applier_1a(+=, -); } else if(is_same_type::yes) { arma_applier_1a(+=, /); } else if(is_same_type::yes) { arma_applier_1a(+=, *); } } else { typename ProxyCube::ea_type P1 = x.P1.get_ea(); typename ProxyCube::ea_type P2 = x.P2.get_ea(); if(is_same_type::yes) { arma_applier_1u(+=, +); } else if(is_same_type::yes) { arma_applier_1u(+=, -); } else if(is_same_type::yes) { arma_applier_1u(+=, /); } else if(is_same_type::yes) { arma_applier_1u(+=, *); } } } else { typename ProxyCube::ea_type P1 = x.P1.get_ea(); typename ProxyCube::ea_type P2 = x.P2.get_ea(); if(is_same_type::yes) { arma_applier_1u(+=, +); } else if(is_same_type::yes) { arma_applier_1u(+=, -); } else if(is_same_type::yes) { arma_applier_1u(+=, /); } else if(is_same_type::yes) { arma_applier_1u(+=, *); } } } } else { const ProxyCube& P1 = x.P1; const ProxyCube& P2 = x.P2; if(use_mp && mp_gate::use_mp && ProxyCube::use_mp)>::eval(x.get_n_elem())) { if(is_same_type::yes) { arma_applier_3_mp(+=, +); } else if(is_same_type::yes) { arma_applier_3_mp(+=, -); } else if(is_same_type::yes) { arma_applier_3_mp(+=, /); } else if(is_same_type::yes) { arma_applier_3_mp(+=, *); } } else { if(is_same_type::yes) { arma_applier_3(+=, +); } else if(is_same_type::yes) { arma_applier_3(+=, -); } else if(is_same_type::yes) { arma_applier_3(+=, /); } else if(is_same_type::yes) { arma_applier_3(+=, *); } } } } template template inline void eglue_core::apply_inplace_minus(Cube& out, const eGlueCube& x) { arma_debug_sigprint(); const uword n_rows = x.get_n_rows(); const uword n_cols = x.get_n_cols(); const uword n_slices = x.get_n_slices(); arma_conform_assert_same_size(out.n_rows, out.n_cols, out.n_slices, n_rows, n_cols, n_slices, "subtraction"); typedef typename T1::elem_type eT; eT* out_mem = out.memptr(); constexpr bool use_at = (ProxyCube::use_at || ProxyCube::use_at); constexpr bool use_mp = (ProxyCube::use_mp || ProxyCube::use_mp) && (arma_config::openmp); if(use_at == false) { const uword n_elem = out.n_elem; if(use_mp && mp_gate::use_mp && ProxyCube::use_mp)>::eval(n_elem)) { typename ProxyCube::ea_type P1 = x.P1.get_ea(); typename ProxyCube::ea_type P2 = x.P2.get_ea(); if(is_same_type::yes) { arma_applier_1_mp(-=, +); } else if(is_same_type::yes) { arma_applier_1_mp(-=, -); } else if(is_same_type::yes) { arma_applier_1_mp(-=, /); } else if(is_same_type::yes) { arma_applier_1_mp(-=, *); } } else { if(memory::is_aligned(out_mem)) { memory::mark_as_aligned(out_mem); if(x.P1.is_aligned() && x.P2.is_aligned()) { typename ProxyCube::aligned_ea_type P1 = x.P1.get_aligned_ea(); typename ProxyCube::aligned_ea_type P2 = x.P2.get_aligned_ea(); if(is_same_type::yes) { arma_applier_1a(-=, +); } else if(is_same_type::yes) { arma_applier_1a(-=, -); } else if(is_same_type::yes) { arma_applier_1a(-=, /); } else if(is_same_type::yes) { arma_applier_1a(-=, *); } } else { typename ProxyCube::ea_type P1 = x.P1.get_ea(); typename ProxyCube::ea_type P2 = x.P2.get_ea(); if(is_same_type::yes) { arma_applier_1u(-=, +); } else if(is_same_type::yes) { arma_applier_1u(-=, -); } else if(is_same_type::yes) { arma_applier_1u(-=, /); } else if(is_same_type::yes) { arma_applier_1u(-=, *); } } } else { typename ProxyCube::ea_type P1 = x.P1.get_ea(); typename ProxyCube::ea_type P2 = x.P2.get_ea(); if(is_same_type::yes) { arma_applier_1u(-=, +); } else if(is_same_type::yes) { arma_applier_1u(-=, -); } else if(is_same_type::yes) { arma_applier_1u(-=, /); } else if(is_same_type::yes) { arma_applier_1u(-=, *); } } } } else { const ProxyCube& P1 = x.P1; const ProxyCube& P2 = x.P2; if(use_mp && mp_gate::use_mp && ProxyCube::use_mp)>::eval(x.get_n_elem())) { if(is_same_type::yes) { arma_applier_3_mp(-=, +); } else if(is_same_type::yes) { arma_applier_3_mp(-=, -); } else if(is_same_type::yes) { arma_applier_3_mp(-=, /); } else if(is_same_type::yes) { arma_applier_3_mp(-=, *); } } else { if(is_same_type::yes) { arma_applier_3(-=, +); } else if(is_same_type::yes) { arma_applier_3(-=, -); } else if(is_same_type::yes) { arma_applier_3(-=, /); } else if(is_same_type::yes) { arma_applier_3(-=, *); } } } } template template inline void eglue_core::apply_inplace_schur(Cube& out, const eGlueCube& x) { arma_debug_sigprint(); const uword n_rows = x.get_n_rows(); const uword n_cols = x.get_n_cols(); const uword n_slices = x.get_n_slices(); arma_conform_assert_same_size(out.n_rows, out.n_cols, out.n_slices, n_rows, n_cols, n_slices, "element-wise multiplication"); typedef typename T1::elem_type eT; eT* out_mem = out.memptr(); constexpr bool use_at = (ProxyCube::use_at || ProxyCube::use_at); constexpr bool use_mp = (ProxyCube::use_mp || ProxyCube::use_mp) && (arma_config::openmp); if(use_at == false) { const uword n_elem = out.n_elem; if(use_mp && mp_gate::use_mp && ProxyCube::use_mp)>::eval(n_elem)) { typename ProxyCube::ea_type P1 = x.P1.get_ea(); typename ProxyCube::ea_type P2 = x.P2.get_ea(); if(is_same_type::yes) { arma_applier_1_mp(*=, +); } else if(is_same_type::yes) { arma_applier_1_mp(*=, -); } else if(is_same_type::yes) { arma_applier_1_mp(*=, /); } else if(is_same_type::yes) { arma_applier_1_mp(*=, *); } } else { if(memory::is_aligned(out_mem)) { memory::mark_as_aligned(out_mem); if(x.P1.is_aligned() && x.P2.is_aligned()) { typename ProxyCube::aligned_ea_type P1 = x.P1.get_aligned_ea(); typename ProxyCube::aligned_ea_type P2 = x.P2.get_aligned_ea(); if(is_same_type::yes) { arma_applier_1a(*=, +); } else if(is_same_type::yes) { arma_applier_1a(*=, -); } else if(is_same_type::yes) { arma_applier_1a(*=, /); } else if(is_same_type::yes) { arma_applier_1a(*=, *); } } else { typename ProxyCube::ea_type P1 = x.P1.get_ea(); typename ProxyCube::ea_type P2 = x.P2.get_ea(); if(is_same_type::yes) { arma_applier_1u(*=, +); } else if(is_same_type::yes) { arma_applier_1u(*=, -); } else if(is_same_type::yes) { arma_applier_1u(*=, /); } else if(is_same_type::yes) { arma_applier_1u(*=, *); } } } else { typename ProxyCube::ea_type P1 = x.P1.get_ea(); typename ProxyCube::ea_type P2 = x.P2.get_ea(); if(is_same_type::yes) { arma_applier_1u(*=, +); } else if(is_same_type::yes) { arma_applier_1u(*=, -); } else if(is_same_type::yes) { arma_applier_1u(*=, /); } else if(is_same_type::yes) { arma_applier_1u(*=, *); } } } } else { const ProxyCube& P1 = x.P1; const ProxyCube& P2 = x.P2; if(use_mp && mp_gate::use_mp && ProxyCube::use_mp)>::eval(x.get_n_elem())) { if(is_same_type::yes) { arma_applier_3_mp(*=, +); } else if(is_same_type::yes) { arma_applier_3_mp(*=, -); } else if(is_same_type::yes) { arma_applier_3_mp(*=, /); } else if(is_same_type::yes) { arma_applier_3_mp(*=, *); } } else { if(is_same_type::yes) { arma_applier_3(*=, +); } else if(is_same_type::yes) { arma_applier_3(*=, -); } else if(is_same_type::yes) { arma_applier_3(*=, /); } else if(is_same_type::yes) { arma_applier_3(*=, *); } } } } template template inline void eglue_core::apply_inplace_div(Cube& out, const eGlueCube& x) { arma_debug_sigprint(); const uword n_rows = x.get_n_rows(); const uword n_cols = x.get_n_cols(); const uword n_slices = x.get_n_slices(); arma_conform_assert_same_size(out.n_rows, out.n_cols, out.n_slices, n_rows, n_cols, n_slices, "element-wise division"); typedef typename T1::elem_type eT; eT* out_mem = out.memptr(); constexpr bool use_at = (ProxyCube::use_at || ProxyCube::use_at); constexpr bool use_mp = (ProxyCube::use_mp || ProxyCube::use_mp) && (arma_config::openmp); if(use_at == false) { const uword n_elem = out.n_elem; if(use_mp && mp_gate::use_mp && ProxyCube::use_mp)>::eval(n_elem)) { typename ProxyCube::ea_type P1 = x.P1.get_ea(); typename ProxyCube::ea_type P2 = x.P2.get_ea(); if(is_same_type::yes) { arma_applier_1_mp(/=, +); } else if(is_same_type::yes) { arma_applier_1_mp(/=, -); } else if(is_same_type::yes) { arma_applier_1_mp(/=, /); } else if(is_same_type::yes) { arma_applier_1_mp(/=, *); } } else { if(memory::is_aligned(out_mem)) { memory::mark_as_aligned(out_mem); if(x.P1.is_aligned() && x.P2.is_aligned()) { typename ProxyCube::aligned_ea_type P1 = x.P1.get_aligned_ea(); typename ProxyCube::aligned_ea_type P2 = x.P2.get_aligned_ea(); if(is_same_type::yes) { arma_applier_1a(/=, +); } else if(is_same_type::yes) { arma_applier_1a(/=, -); } else if(is_same_type::yes) { arma_applier_1a(/=, /); } else if(is_same_type::yes) { arma_applier_1a(/=, *); } } else { typename ProxyCube::ea_type P1 = x.P1.get_ea(); typename ProxyCube::ea_type P2 = x.P2.get_ea(); if(is_same_type::yes) { arma_applier_1u(/=, +); } else if(is_same_type::yes) { arma_applier_1u(/=, -); } else if(is_same_type::yes) { arma_applier_1u(/=, /); } else if(is_same_type::yes) { arma_applier_1u(/=, *); } } } else { typename ProxyCube::ea_type P1 = x.P1.get_ea(); typename ProxyCube::ea_type P2 = x.P2.get_ea(); if(is_same_type::yes) { arma_applier_1u(/=, +); } else if(is_same_type::yes) { arma_applier_1u(/=, -); } else if(is_same_type::yes) { arma_applier_1u(/=, /); } else if(is_same_type::yes) { arma_applier_1u(/=, *); } } } } else { const ProxyCube& P1 = x.P1; const ProxyCube& P2 = x.P2; if(use_mp && mp_gate::use_mp && ProxyCube::use_mp)>::eval(x.get_n_elem())) { if(is_same_type::yes) { arma_applier_3_mp(/=, +); } else if(is_same_type::yes) { arma_applier_3_mp(/=, -); } else if(is_same_type::yes) { arma_applier_3_mp(/=, /); } else if(is_same_type::yes) { arma_applier_3_mp(/=, *); } } else { if(is_same_type::yes) { arma_applier_3(/=, +); } else if(is_same_type::yes) { arma_applier_3(/=, -); } else if(is_same_type::yes) { arma_applier_3(/=, /); } else if(is_same_type::yes) { arma_applier_3(/=, *); } } } } #undef arma_applier_1u #undef arma_applier_1a #undef arma_applier_2 #undef arma_applier_3 #undef arma_applier_1_mp #undef arma_applier_2_mp #undef arma_applier_3_mp //! @} RcppArmadillo/inst/include/armadillo_bits/spglue_join_bones.hpp0000644000176200001440000000521614301267044024612 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup spglue_join //! @{ class spglue_join_cols { public: template struct traits { static constexpr bool is_row = false; static constexpr bool is_col = (T1::is_col && T2::is_col); static constexpr bool is_xvec = false; }; template inline static void apply(SpMat& out, const SpGlue& X); template inline static void apply_noalias(SpMat& out, const SpMat& A, const SpMat& B); template inline static void apply(SpMat& out, const SpBase& A, const SpBase& B, const SpBase& C); template inline static void apply(SpMat& out, const SpBase& A, const SpBase& B, const SpBase& C, const SpBase& D); }; class spglue_join_rows { public: template struct traits { static constexpr bool is_row = (T1::is_row && T2::is_row); static constexpr bool is_col = false; static constexpr bool is_xvec = false; }; template inline static void apply(SpMat& out, const SpGlue& X); template inline static void apply_noalias(SpMat& out, const SpMat& A, const SpMat& B); template inline static void apply(SpMat& out, const SpBase& A, const SpBase& B, const SpBase& C); template inline static void apply(SpMat& out, const SpBase& A, const SpBase& B, const SpBase& C, const SpBase& D); }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_sp_vecnorm_meat.hpp0000644000176200001440000001123514634016465024773 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_sp_vecnorm //! @{ template inline void op_sp_vecnorm::apply(Mat& out, const mtSpReduceOp& expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; typedef typename T1::pod_type T; const uword k = expr.aux_uword_a; const uword dim = expr.aux_uword_b; arma_conform_check( (k == 0), "vecnorm(): unsupported vector norm type" ); arma_conform_check( (dim > 1), "vecnorm(): parameter 'dim' must be 0 or 1" ); const unwrap_spmat U(expr.m); const SpMat& X = U.M; X.sync(); if(dim == 0) { op_sp_vecnorm::apply_direct(out, X, k); } else if(dim == 1) { Mat< T> tmp; SpMat Xt; spop_strans::apply_noalias(Xt, X); op_sp_vecnorm::apply_direct(tmp, Xt, k); out = tmp.t(); } } template inline void op_sp_vecnorm::apply_direct(Mat< typename get_pod_type::result >& out, const SpMat& X, const uword k) { arma_debug_sigprint(); typedef typename get_pod_type::result T; out.zeros(1, X.n_cols); T* out_mem = out.memptr(); for(uword col=0; col < X.n_cols; ++col) { const uword col_offset = X.col_ptrs[col ]; const uword next_col_offset = X.col_ptrs[col + 1]; const eT* start_ptr = &X.values[ col_offset]; const eT* end_ptr = &X.values[next_col_offset]; const uword n_elem = end_ptr - start_ptr; T out_val = T(0); if(n_elem > 0) { const Col tmp(const_cast(start_ptr), n_elem, false, false); const Proxy< Col > P(tmp); if(k == uword(1)) { out_val = op_norm::vec_norm_1(P); } if(k == uword(2)) { out_val = op_norm::vec_norm_2(P); } } out_mem[col] = out_val; } } // template inline void op_sp_vecnorm_ext::apply(Mat& out, const mtSpReduceOp& expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; typedef typename T1::pod_type T; const uword method_id = expr.aux_uword_a; const uword dim = expr.aux_uword_b; arma_conform_check( (method_id == 0), "vecnorm(): unsupported vector norm type" ); arma_conform_check( (dim > 1), "vecnorm(): parameter 'dim' must be 0 or 1" ); const unwrap_spmat U(expr.m); const SpMat& X = U.M; X.sync(); if(dim == 0) { op_sp_vecnorm_ext::apply_direct(out, X, method_id); } else if(dim == 1) { Mat< T> tmp; SpMat Xt; spop_strans::apply_noalias(Xt, X); op_sp_vecnorm_ext::apply_direct(tmp, Xt, method_id); out = tmp.t(); } } template inline void op_sp_vecnorm_ext::apply_direct(Mat< typename get_pod_type::result >& out, const SpMat& X, const uword method_id) { arma_debug_sigprint(); typedef typename get_pod_type::result T; out.zeros(1, X.n_cols); T* out_mem = out.memptr(); for(uword col=0; col < X.n_cols; ++col) { const uword col_offset = X.col_ptrs[col ]; const uword next_col_offset = X.col_ptrs[col + 1]; const eT* start_ptr = &X.values[ col_offset]; const eT* end_ptr = &X.values[next_col_offset]; const uword n_elem = end_ptr - start_ptr; T out_val = T(0); if(n_elem > 0) { const Col tmp(const_cast(start_ptr), n_elem, false, false); const Proxy< Col > P(tmp); if(method_id == uword(1)) { out_val = op_norm::vec_norm_max(P); } else if(method_id == uword(2)) { const T tmp_val = op_norm::vec_norm_min(P); out_val = (n_elem < X.n_rows) ? T((std::min)(T(0), tmp_val)) : T(tmp_val); } } out_mem[col] = out_val; } } //! @} RcppArmadillo/inst/include/armadillo_bits/op_norm_bones.hpp0000644000176200001440000000542314301267043023744 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_norm //! @{ class op_norm : public traits_op_default { public: template arma_hot inline static typename T1::pod_type vec_norm_1(const Proxy& P, const typename arma_not_cx::result* junk = nullptr); template arma_hot inline static typename T1::pod_type vec_norm_1(const Proxy& P, const typename arma_cx_only::result* junk = nullptr); template arma_hot inline static eT vec_norm_1_direct_std(const Mat& X); template arma_hot inline static eT vec_norm_1_direct_mem(const uword N, const eT* A); template arma_hot inline static typename T1::pod_type vec_norm_2(const Proxy& P, const typename arma_not_cx::result* junk = nullptr); template arma_hot inline static typename T1::pod_type vec_norm_2(const Proxy& P, const typename arma_cx_only::result* junk = nullptr); template arma_hot inline static eT vec_norm_2_direct_std(const Mat& X); template arma_hot inline static eT vec_norm_2_direct_mem(const uword N, const eT* A); template arma_hot inline static eT vec_norm_2_direct_robust(const Mat& X); template arma_hot inline static typename T1::pod_type vec_norm_k(const Proxy& P, const int k); template arma_hot inline static typename T1::pod_type vec_norm_max(const Proxy& P); template arma_hot inline static typename T1::pod_type vec_norm_min(const Proxy& P); template inline static typename get_pod_type::result mat_norm_1(const Mat& X); template inline static typename get_pod_type::result mat_norm_2(const Mat& X); template inline static typename get_pod_type::result mat_norm_inf(const Mat& X); }; //! @} RcppArmadillo/inst/include/armadillo_bits/Mat_meat.hpp0000644000176200001440000063733615030507611022650 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup Mat //! @{ template inline Mat::~Mat() { arma_debug_sigprint_this(this); if(n_alloc > 0) { arma_debug_print("Mat::destructor: releasing memory"); memory::release( access::rw(mem) ); } // try to expose buggy user code that accesses deleted objects access::rw(mem) = nullptr; arma_type_check(( is_supported_elem_type::value == false )); } template inline Mat::Mat() : n_rows(0) , n_cols(0) , n_elem(0) , n_alloc(0) , vec_state(0) , mem_state(0) , mem() { arma_debug_sigprint_this(this); } //! construct the matrix to have user specified dimensions template inline Mat::Mat(const uword in_n_rows, const uword in_n_cols) : n_rows(in_n_rows) , n_cols(in_n_cols) , n_elem(in_n_rows*in_n_cols) , n_alloc() , vec_state(0) , mem_state(0) , mem() { arma_debug_sigprint_this(this); init_cold(); arma_debug_print("Mat::constructor: zeroing memory"); arrayops::fill_zeros(memptr(), n_elem); } template inline Mat::Mat(const SizeMat& s) : n_rows(s.n_rows) , n_cols(s.n_cols) , n_elem(s.n_rows*s.n_cols) , n_alloc() , vec_state(0) , mem_state(0) , mem() { arma_debug_sigprint_this(this); init_cold(); arma_debug_print("Mat::constructor: zeroing memory"); arrayops::fill_zeros(memptr(), n_elem); } //! internal use only template template inline Mat::Mat(const uword in_n_rows, const uword in_n_cols, const arma_initmode_indicator&) : n_rows(in_n_rows) , n_cols(in_n_cols) , n_elem(in_n_rows*in_n_cols) , n_alloc() , vec_state(0) , mem_state(0) , mem() { arma_debug_sigprint_this(this); init_cold(); if(do_zeros) { arma_debug_print("Mat::constructor: zeroing memory"); arrayops::fill_zeros(memptr(), n_elem); } else { arma_debug_print("Mat::constructor: not zeroing memory"); } } //! internal use only template template inline Mat::Mat(const SizeMat& s, const arma_initmode_indicator&) : n_rows(s.n_rows) , n_cols(s.n_cols) , n_elem(s.n_rows*s.n_cols) , n_alloc() , vec_state(0) , mem_state(0) , mem() { arma_debug_sigprint_this(this); init_cold(); if(do_zeros) { arma_debug_print("Mat::constructor: zeroing memory"); arrayops::fill_zeros(memptr(), n_elem); } else { arma_debug_print("Mat::constructor: not zeroing memory"); } } //! construct the matrix to have user specified dimensions and fill with specified pattern template template inline Mat::Mat(const uword in_n_rows, const uword in_n_cols, const fill::fill_class& f) : n_rows(in_n_rows) , n_cols(in_n_cols) , n_elem(in_n_rows*in_n_cols) , n_alloc() , vec_state(0) , mem_state(0) , mem() { arma_debug_sigprint_this(this); init_cold(); (*this).fill(f); } template template inline Mat::Mat(const SizeMat& s, const fill::fill_class& f) : n_rows(s.n_rows) , n_cols(s.n_cols) , n_elem(s.n_rows*s.n_cols) , n_alloc() , vec_state(0) , mem_state(0) , mem() { arma_debug_sigprint_this(this); init_cold(); (*this).fill(f); } //! construct the matrix to have user specified dimensions and fill with specified value template inline Mat::Mat(const uword in_n_rows, const uword in_n_cols, const fill::scalar_holder f) : n_rows(in_n_rows) , n_cols(in_n_cols) , n_elem(in_n_rows*in_n_cols) , n_alloc() , vec_state(0) , mem_state(0) , mem() { arma_debug_sigprint_this(this); init_cold(); (*this).fill(f.scalar); } template inline Mat::Mat(const SizeMat& s, const fill::scalar_holder f) : n_rows(s.n_rows) , n_cols(s.n_cols) , n_elem(s.n_rows*s.n_cols) , n_alloc() , vec_state(0) , mem_state(0) , mem() { arma_debug_sigprint_this(this); init_cold(); (*this).fill(f.scalar); } //! constructor used by Row and Col classes template inline Mat::Mat(const arma_vec_indicator&, const uhword in_vec_state) : n_rows( (in_vec_state == 2) ? 1 : 0 ) , n_cols( (in_vec_state == 1) ? 1 : 0 ) , n_elem(0) , n_alloc(0) , vec_state(in_vec_state) , mem_state(0) , mem() { arma_debug_sigprint_this(this); } //! constructor used by Row and Col classes template inline Mat::Mat(const arma_vec_indicator&, const uword in_n_rows, const uword in_n_cols, const uhword in_vec_state) : n_rows(in_n_rows) , n_cols(in_n_cols) , n_elem(in_n_rows*in_n_cols) , n_alloc() , vec_state(in_vec_state) , mem_state(0) , mem() { arma_debug_sigprint_this(this); init_cold(); } template inline Mat::Mat(const arma_fixed_indicator&, const uword in_n_rows, const uword in_n_cols, const uhword in_vec_state, const eT* in_mem) : n_rows (in_n_rows) , n_cols (in_n_cols) , n_elem (in_n_rows*in_n_cols) , n_alloc (0) , vec_state (in_vec_state) , mem_state (3) , mem (in_mem) { arma_debug_sigprint_this(this); } template inline void Mat::init_cold() { arma_debug_sigprint( arma_str::format("n_rows: %u; n_cols: %u") % n_rows % n_cols ); // ensure that n_elem can hold the result of (n_rows * n_cols) #if defined(ARMA_64BIT_WORD) const char* error_message = "Mat::init(): requested size is too large"; #else const char* error_message = "Mat::init(): requested size is too large; suggest to enable ARMA_64BIT_WORD"; #endif arma_conform_check ( ( ( (n_rows > ARMA_MAX_UHWORD) || (n_cols > ARMA_MAX_UHWORD) ) ? ( (double(n_rows) * double(n_cols)) > double(ARMA_MAX_UWORD) ) : false ), error_message ); if(n_elem <= arma_config::mat_prealloc) { if(n_elem > 0) { arma_debug_print("Mat::init(): using local memory"); } access::rw(mem) = (n_elem == 0) ? nullptr : mem_local; access::rw(n_alloc) = 0; } else { arma_debug_print("Mat::init(): acquiring memory"); access::rw(mem) = memory::acquire(n_elem); access::rw(n_alloc) = n_elem; } } template inline void Mat::init_warm(uword in_n_rows, uword in_n_cols) { arma_debug_sigprint( arma_str::format("in_n_rows: %u; in_n_cols: %u") % in_n_rows % in_n_cols ); if( (n_rows == in_n_rows) && (n_cols == in_n_cols) ) { return; } bool err_state = false; char* err_msg = nullptr; const uhword t_vec_state = vec_state; const uhword t_mem_state = mem_state; const char* error_message_1 = "Mat::init(): size is fixed and hence cannot be changed"; const char* error_message_2 = "Mat::init(): requested size is not compatible with column vector layout"; const char* error_message_3 = "Mat::init(): requested size is not compatible with row vector layout"; arma_conform_set_error( err_state, err_msg, (t_mem_state == 3), error_message_1 ); if(t_vec_state > 0) { if( (in_n_rows == 0) && (in_n_cols == 0) ) { if(t_vec_state == 1) { in_n_cols = 1; } if(t_vec_state == 2) { in_n_rows = 1; } } else { if(t_vec_state == 1) { arma_conform_set_error( err_state, err_msg, (in_n_cols != 1), error_message_2 ); } // TODO: (in_n_cols > 1) ? if(t_vec_state == 2) { arma_conform_set_error( err_state, err_msg, (in_n_rows != 1), error_message_3 ); } // TODO: (in_n_rows > 1) ? } } // ensure that n_elem can hold the result of (n_rows * n_cols) #if defined(ARMA_64BIT_WORD) const char* error_message_4 = "Mat::init(): requested size is too large"; #else const char* error_message_4 = "Mat::init(): requested size is too large; suggest to enable ARMA_64BIT_WORD"; #endif arma_conform_set_error ( err_state, err_msg, ( ( (in_n_rows > ARMA_MAX_UHWORD) || (in_n_cols > ARMA_MAX_UHWORD) ) ? ( (double(in_n_rows) * double(in_n_cols)) > double(ARMA_MAX_UWORD) ) : false ), error_message_4 ); arma_conform_check(err_state, err_msg); const uword old_n_elem = n_elem; const uword new_n_elem = in_n_rows * in_n_cols; if(old_n_elem == new_n_elem) { arma_debug_print("Mat::init(): reusing memory"); access::rw(n_rows) = in_n_rows; access::rw(n_cols) = in_n_cols; return; } arma_conform_check( (t_mem_state == 2), "Mat::init(): mismatch between size of auxiliary memory and requested size" ); if(new_n_elem <= arma_config::mat_prealloc) { if(n_alloc > 0) { arma_debug_print("Mat::init(): releasing memory"); memory::release( access::rw(mem) ); } if(new_n_elem > 0) { arma_debug_print("Mat::init(): using local memory"); } access::rw(mem) = (new_n_elem == 0) ? nullptr : mem_local; access::rw(n_alloc) = 0; } else // condition: new_n_elem > arma_config::mat_prealloc { if(new_n_elem > n_alloc) { if(n_alloc > 0) { arma_debug_print("Mat::init(): releasing memory"); memory::release( access::rw(mem) ); // in case memory::acquire() throws an exception access::rw(mem) = nullptr; access::rw(n_rows) = 0; access::rw(n_cols) = 0; access::rw(n_elem) = 0; access::rw(n_alloc) = 0; } arma_debug_print("Mat::init(): acquiring memory"); access::rw(mem) = memory::acquire(new_n_elem); access::rw(n_alloc) = new_n_elem; } else // condition: new_n_elem <= n_alloc { arma_debug_print("Mat::init(): reusing memory"); } } access::rw(n_rows) = in_n_rows; access::rw(n_cols) = in_n_cols; access::rw(n_elem) = new_n_elem; access::rw(mem_state) = 0; } //! create the matrix from a textual description template inline Mat::Mat(const char* text) : n_rows(0) , n_cols(0) , n_elem(0) , n_alloc(0) , vec_state(0) , mem_state(0) , mem() { arma_debug_sigprint_this(this); init( std::string(text) ); } //! create the matrix from a textual description template inline Mat& Mat::operator=(const char* text) { arma_debug_sigprint(); init( std::string(text) ); return *this; } //! create the matrix from a textual description template inline Mat::Mat(const std::string& text) : n_rows(0) , n_cols(0) , n_elem(0) , n_alloc(0) , vec_state(0) , mem_state(0) , mem() { arma_debug_sigprint_this(this); init(text); } //! create the matrix from a textual description template inline Mat& Mat::operator=(const std::string& text) { arma_debug_sigprint(); init(text); return *this; } //! internal function to create the matrix from a textual description template inline void Mat::init(const std::string& text_orig) { arma_debug_sigprint(); const bool replace_commas = (is_cx::yes) ? false : ( text_orig.find(',') != std::string::npos ); std::string text_mod; if(replace_commas) { text_mod = text_orig; std::replace(text_mod.begin(), text_mod.end(), ',', ' '); } const std::string& text = (replace_commas) ? text_mod : text_orig; // // work out the size uword t_n_rows = 0; uword t_n_cols = 0; bool has_semicolon = false; bool has_token = false; std::string token; std::string::size_type line_start = 0; std::string::size_type line_end = 0; std::string::size_type line_len = 0; std::stringstream line_stream; while( line_start < text.length() ) { line_end = text.find(';', line_start); if(line_end == std::string::npos) { has_semicolon = false; line_end = text.length()-1; line_len = line_end - line_start + 1; } else { has_semicolon = true; line_len = line_end - line_start; // omit the ';' character } line_stream.clear(); line_stream.str( text.substr(line_start,line_len) ); has_token = false; uword line_n_cols = 0; while(line_stream >> token) { has_token = true; ++line_n_cols; } if(t_n_rows == 0) { t_n_cols = line_n_cols; } else { if(has_semicolon || has_token) { arma_check( (line_n_cols != t_n_cols), "Mat::init(): inconsistent number of columns in given string"); } } ++t_n_rows; line_start = line_end+1; } // if the last line was empty, ignore it if( (has_semicolon == false) && (has_token == false) && (t_n_rows >= 1) ) { --t_n_rows; } Mat& x = (*this); x.set_size(t_n_rows, t_n_cols); if(x.is_empty()) { return; } line_start = 0; line_end = 0; line_len = 0; uword urow = 0; while( line_start < text.length() ) { line_end = text.find(';', line_start); if(line_end == std::string::npos) { line_end = text.length()-1; line_len = line_end - line_start + 1; } else { line_len = line_end - line_start; // omit the ';' character } line_stream.clear(); line_stream.str( text.substr(line_start,line_len) ); uword ucol = 0; while(line_stream >> token) { diskio::convert_token( x.at(urow,ucol), token ); ++ucol; } ++urow; line_start = line_end+1; } } //! create the matrix from std::vector template inline Mat::Mat(const std::vector& x) : n_rows(uword(x.size())) , n_cols(1) , n_elem(uword(x.size())) , n_alloc() , vec_state(0) , mem_state(0) , mem() { arma_debug_sigprint_this(this); init_cold(); if(n_elem > 0) { arrayops::copy( memptr(), &(x[0]), n_elem ); } } //! create the matrix from std::vector template inline Mat& Mat::operator=(const std::vector& x) { arma_debug_sigprint(); init_warm(uword(x.size()), 1); if(x.size() > 0) { arrayops::copy( memptr(), &(x[0]), uword(x.size()) ); } return *this; } template inline Mat::Mat(const std::initializer_list& list) : n_rows(0) , n_cols(0) , n_elem(0) , n_alloc(0) , vec_state(0) , mem_state(0) , mem() { arma_debug_sigprint_this(this); init(list); } template inline Mat& Mat::operator=(const std::initializer_list& list) { arma_debug_sigprint(); init(list); return *this; } template inline Mat::Mat(const std::initializer_list< std::initializer_list >& list) : n_rows(0) , n_cols(0) , n_elem(0) , n_alloc(0) , vec_state(0) , mem_state(0) , mem() { arma_debug_sigprint_this(this); init(list); } template inline Mat& Mat::operator=(const std::initializer_list< std::initializer_list >& list) { arma_debug_sigprint(); init(list); return *this; } template inline Mat::Mat(Mat&& X) : n_rows (X.n_rows ) , n_cols (X.n_cols ) , n_elem (X.n_elem ) , n_alloc (X.n_alloc) , vec_state(0 ) , mem_state(0 ) , mem ( ) { arma_debug_sigprint(arma_str::format("this: %x; X: %x") % this % &X); if( (X.n_alloc > arma_config::mat_prealloc) || (X.mem_state == 1) || (X.mem_state == 2) ) { access::rw(mem_state) = X.mem_state; access::rw(mem) = X.mem; access::rw(X.n_rows) = 0; access::rw(X.n_cols) = 0; access::rw(X.n_elem) = 0; access::rw(X.n_alloc) = 0; access::rw(X.mem_state) = 0; access::rw(X.mem) = nullptr; } else // condition: (X.n_alloc <= arma_config::mat_prealloc) || (X.mem_state == 0) || (X.mem_state == 3) { init_cold(); arrayops::copy( memptr(), X.mem, X.n_elem ); if( (X.mem_state == 0) && (X.n_alloc <= arma_config::mat_prealloc) ) { access::rw(X.n_rows) = 0; access::rw(X.n_cols) = 0; access::rw(X.n_elem) = 0; access::rw(X.mem) = nullptr; } } } template inline Mat& Mat::operator=(Mat&& X) { arma_debug_sigprint(arma_str::format("this: %x; X: %x") % this % &X); (*this).steal_mem(X, true); return *this; } //! Set the matrix to be equal to the specified scalar. //! NOTE: the size of the matrix will be 1x1 template inline Mat& Mat::operator=(const eT val) { arma_debug_sigprint(); init_warm(1,1); access::rw(mem[0]) = val; return *this; } //! In-place addition of a scalar to all elements of the matrix template inline Mat& Mat::operator+=(const eT val) { arma_debug_sigprint(); arrayops::inplace_plus( memptr(), val, n_elem ); return *this; } //! In-place subtraction of a scalar from all elements of the matrix template inline Mat& Mat::operator-=(const eT val) { arma_debug_sigprint(); arrayops::inplace_minus( memptr(), val, n_elem ); return *this; } //! In-place multiplication of all elements of the matrix with a scalar template inline Mat& Mat::operator*=(const eT val) { arma_debug_sigprint(); arrayops::inplace_mul( memptr(), val, n_elem ); return *this; } //! In-place division of all elements of the matrix with a scalar template inline Mat& Mat::operator/=(const eT val) { arma_debug_sigprint(); arrayops::inplace_div( memptr(), val, n_elem ); return *this; } //! construct a matrix from a given matrix template inline Mat::Mat(const Mat& in_mat) : n_rows(in_mat.n_rows) , n_cols(in_mat.n_cols) , n_elem(in_mat.n_elem) , n_alloc() , vec_state(0) , mem_state(0) , mem() { arma_debug_sigprint(arma_str::format("this: %x; in_mat: %x") % this % &in_mat); init_cold(); arrayops::copy( memptr(), in_mat.mem, in_mat.n_elem ); } //! construct a matrix from a given matrix template inline Mat& Mat::operator=(const Mat& in_mat) { arma_debug_sigprint(arma_str::format("this: %x; in_mat: %x") % this % &in_mat); if(this != &in_mat) { init_warm(in_mat.n_rows, in_mat.n_cols); arrayops::copy( memptr(), in_mat.mem, in_mat.n_elem ); } else { arma_debug_print("Mat::operator=(): copy omitted"); } return *this; } template inline void Mat::init(const std::initializer_list& list) { arma_debug_sigprint(); const uword N = uword(list.size()); set_size(1, N); if(N > 0) { arrayops::copy( memptr(), list.begin(), N ); } } template inline void Mat::init(const std::initializer_list< std::initializer_list >& list) { arma_debug_sigprint(); uword x_n_rows = uword(list.size()); uword x_n_cols = 0; uword x_n_elem = 0; auto it = list.begin(); auto it_end = list.end(); for(; it != it_end; ++it) { const uword x_n_cols_new = uword((*it).size()); x_n_elem += x_n_cols_new; x_n_cols = (std::max)(x_n_cols, x_n_cols_new); } Mat& t = (*this); if(t.mem_state == 3) { arma_conform_check( ((x_n_rows != t.n_rows) || (x_n_cols != t.n_cols)), "Mat::init(): size mismatch between fixed size matrix and initialiser list" ); } else { t.set_size(x_n_rows, x_n_cols); } // if the inner lists have varying number of elements, treat missing elements as zeros if(t.n_elem != x_n_elem) { t.zeros(); } uword row_num = 0; auto row_it = list.begin(); auto row_it_end = list.end(); for(; row_it != row_it_end; ++row_it) { uword col_num = 0; auto col_it = (*row_it).begin(); auto col_it_end = (*row_it).end(); for(; col_it != col_it_end; ++col_it) { t.at(row_num, col_num) = (*col_it); ++col_num; } ++row_num; } } //! for constructing a complex matrix out of two non-complex matrices template template inline void Mat::init ( const Base::pod_type, T1>& X, const Base::pod_type, T2>& Y ) { arma_debug_sigprint(); typedef typename T1::elem_type T; arma_type_check(( is_cx::no )); //!< compile-time abort if eT is not std::complex arma_type_check(( is_cx< T>::yes )); //!< compile-time abort if T is std::complex arma_type_check(( is_same_type< std::complex, eT >::no )); //!< compile-time abort if types are not compatible const Proxy PX(X.get_ref()); const Proxy PY(Y.get_ref()); arma_conform_assert_same_size(PX, PY, "Mat()"); const uword local_n_rows = PX.get_n_rows(); const uword local_n_cols = PX.get_n_cols(); init_warm(local_n_rows, local_n_cols); eT* out_mem = (*this).memptr(); constexpr bool use_at = ( Proxy::use_at || Proxy::use_at ); if(use_at == false) { typedef typename Proxy::ea_type ea_type1; typedef typename Proxy::ea_type ea_type2; const uword N = n_elem; ea_type1 A = PX.get_ea(); ea_type2 B = PY.get_ea(); for(uword ii=0; ii < N; ++ii) { out_mem[ii] = std::complex(A[ii], B[ii]); } } else { for(uword ucol=0; ucol < local_n_cols; ++ucol) for(uword urow=0; urow < local_n_rows; ++urow) { *out_mem = std::complex(PX.at(urow,ucol), PY.at(urow,ucol)); out_mem++; } } } //! swap the contents of this matrix, denoted as matrix A, with given matrix B template inline void Mat::swap(Mat& B) { Mat& A = (*this); arma_debug_sigprint(arma_str::format("A: %x; B: %x") % &A % &B); bool layout_ok = false; if(A.vec_state == B.vec_state) { layout_ok = true; } else { const uhword A_vec_state = A.vec_state; const uhword B_vec_state = B.vec_state; const bool A_absorbs_B = (A_vec_state == 0) || ( (A_vec_state == 1) && (B.n_cols == 1) ) || ( (A_vec_state == 2) && (B.n_rows == 1) ); const bool B_absorbs_A = (B_vec_state == 0) || ( (B_vec_state == 1) && (A.n_cols == 1) ) || ( (B_vec_state == 2) && (A.n_rows == 1) ); layout_ok = A_absorbs_B && B_absorbs_A; } const uhword A_mem_state = A.mem_state; const uhword B_mem_state = B.mem_state; if( (A_mem_state == 0) && (B_mem_state == 0) && layout_ok ) { const uword A_n_elem = A.n_elem; const uword B_n_elem = B.n_elem; const bool A_use_local_mem = (A.n_alloc <= arma_config::mat_prealloc); const bool B_use_local_mem = (B.n_alloc <= arma_config::mat_prealloc); if( (A_use_local_mem == false) && (B_use_local_mem == false) ) { std::swap( access::rw(A.mem), access::rw(B.mem) ); } else if( (A_use_local_mem == true) && (B_use_local_mem == true) ) { eT* A_mem_local = &(A.mem_local[0]); eT* B_mem_local = &(B.mem_local[0]); access::rw(A.mem) = A_mem_local; access::rw(B.mem) = B_mem_local; const uword N = (std::max)(A_n_elem, B_n_elem); for(uword ii=0; ii < N; ++ii) { std::swap( A_mem_local[ii], B_mem_local[ii] ); } } else if( (A_use_local_mem == true) && (B_use_local_mem == false) ) { eT* A_mem_local = &(A.mem_local[0]); eT* B_mem_local = &(B.mem_local[0]); arrayops::copy(B_mem_local, A_mem_local, A_n_elem); access::rw(A.mem) = B.mem; access::rw(B.mem) = B_mem_local; } else if( (A_use_local_mem == false) && (B_use_local_mem == true) ) { eT* A_mem_local = &(A.mem_local[0]); eT* B_mem_local = &(B.mem_local[0]); arrayops::copy(A_mem_local, B_mem_local, B_n_elem); access::rw(B.mem) = A.mem; access::rw(A.mem) = A_mem_local; } std::swap( access::rw(A.n_rows), access::rw(B.n_rows) ); std::swap( access::rw(A.n_cols), access::rw(B.n_cols) ); std::swap( access::rw(A.n_elem), access::rw(B.n_elem) ); std::swap( access::rw(A.n_alloc), access::rw(B.n_alloc) ); } else if( (A_mem_state <= 2) && (B_mem_state <= 2) && (A.n_elem == B.n_elem) && layout_ok ) { std::swap( access::rw(A.n_rows), access::rw(B.n_rows) ); std::swap( access::rw(A.n_cols), access::rw(B.n_cols) ); const uword N = A.n_elem; eT* A_mem = A.memptr(); eT* B_mem = B.memptr(); for(uword ii=0; ii < N; ++ii) { std::swap(A_mem[ii], B_mem[ii]); } } else if( (A.n_rows == B.n_rows) && (A.n_cols == B.n_cols) ) { const uword N = A.n_elem; eT* A_mem = A.memptr(); eT* B_mem = B.memptr(); for(uword ii=0; ii < N; ++ii) { std::swap(A_mem[ii], B_mem[ii]); } } else { // generic swap to handle remaining cases if(A.n_elem <= B.n_elem) { Mat C = A; A.steal_mem(B); B.steal_mem(C); } else { Mat C = B; B.steal_mem(A); A.steal_mem(C); } } } //! try to steal the memory from a given matrix; //! if memory can't be stolen, copy the given matrix template inline void Mat::steal_mem(Mat& x) { arma_debug_sigprint(); (*this).steal_mem(x, false); } template inline void Mat::steal_mem(Mat& x, const bool is_move) { arma_debug_sigprint(); if(this == &x) { return; } const uword x_n_rows = x.n_rows; const uword x_n_cols = x.n_cols; const uword x_n_elem = x.n_elem; const uword x_n_alloc = x.n_alloc; const uhword x_vec_state = x.vec_state; const uhword x_mem_state = x.mem_state; const uhword t_vec_state = vec_state; const uhword t_mem_state = mem_state; const bool layout_ok = (t_vec_state == x_vec_state) || ((t_vec_state == 1) && (x_n_cols == 1)) || ((t_vec_state == 2) && (x_n_rows == 1)); if( layout_ok && (t_mem_state <= 1) && ( (x_n_alloc > arma_config::mat_prealloc) || (x_mem_state == 1) || (is_move && (x_mem_state == 2)) ) ) { arma_debug_print("Mat::steal_mem(): stealing memory"); reset(); access::rw(n_rows) = x_n_rows; access::rw(n_cols) = x_n_cols; access::rw(n_elem) = x_n_elem; access::rw(n_alloc) = x_n_alloc; access::rw(mem_state) = x_mem_state; access::rw(mem) = x.mem; access::rw(x.n_rows) = (x_vec_state == 2) ? 1 : 0; access::rw(x.n_cols) = (x_vec_state == 1) ? 1 : 0; access::rw(x.n_elem) = 0; access::rw(x.n_alloc) = 0; access::rw(x.mem_state) = 0; access::rw(x.mem) = nullptr; } else { arma_debug_print("Mat::steal_mem(): copying memory"); (*this).operator=(x); if( (is_move) && (x_mem_state == 0) && (x_n_alloc <= arma_config::mat_prealloc) ) { access::rw(x.n_rows) = (x_vec_state == 2) ? 1 : 0; access::rw(x.n_cols) = (x_vec_state == 1) ? 1 : 0; access::rw(x.n_elem) = 0; access::rw(x.mem) = nullptr; } } } template inline void Mat::steal_mem_col(Mat& x, const uword max_n_rows) { arma_debug_sigprint(); const uword x_n_elem = x.n_elem; const uword x_n_alloc = x.n_alloc; const uhword x_mem_state = x.mem_state; const uhword t_vec_state = vec_state; const uhword t_mem_state = mem_state; const uword alt_n_rows = (std::min)(x.n_rows, max_n_rows); if((x_n_elem == 0) || (alt_n_rows == 0)) { (*this).set_size(0,1); return; } if( (this != &x) && (t_vec_state <= 1) && (t_mem_state <= 1) && (x_mem_state <= 1) ) { if( (x_mem_state == 0) && ((x_n_alloc <= arma_config::mat_prealloc) || (alt_n_rows <= arma_config::mat_prealloc)) ) { (*this).set_size(alt_n_rows, uword(1)); arrayops::copy( (*this).memptr(), x.memptr(), alt_n_rows ); } else { reset(); access::rw(n_rows) = alt_n_rows; access::rw(n_cols) = 1; access::rw(n_elem) = alt_n_rows; access::rw(n_alloc) = x_n_alloc; access::rw(mem_state) = x_mem_state; access::rw(mem) = x.mem; access::rw(x.n_rows) = 0; access::rw(x.n_cols) = 0; access::rw(x.n_elem) = 0; access::rw(x.n_alloc) = 0; access::rw(x.mem_state) = 0; access::rw(x.mem) = nullptr; } } else { Mat tmp(alt_n_rows, 1, arma_nozeros_indicator()); arrayops::copy( tmp.memptr(), x.memptr(), alt_n_rows ); steal_mem(tmp); } } template template arma_inline bool Mat::is_alias(const Mat& X) const { arma_debug_sigprint(); return (is_same_type::yes) && (void_ptr(this) == void_ptr(&X)); } //! construct a matrix from a given auxiliary array of eTs. //! if copy_aux_mem is true, new memory is allocated and the array is copied. //! if copy_aux_mem is false, the auxiliary array is used directly (without allocating memory and copying). //! the default is to copy the array. template inline Mat::Mat(eT* aux_mem, const uword aux_n_rows, const uword aux_n_cols, const bool copy_aux_mem, const bool strict) : n_rows ( aux_n_rows ) , n_cols ( aux_n_cols ) , n_elem ( aux_n_rows*aux_n_cols ) , n_alloc ( 0 ) , vec_state( 0 ) , mem_state( copy_aux_mem ? 0 : ( strict ? 2 : 1 ) ) , mem ( copy_aux_mem ? nullptr : aux_mem ) { arma_debug_sigprint_this(this); if(copy_aux_mem) { init_cold(); arrayops::copy( memptr(), aux_mem, n_elem ); } } //! construct a matrix from a given auxiliary read-only array of eTs. //! the array is copied. template inline Mat::Mat(const eT* aux_mem, const uword aux_n_rows, const uword aux_n_cols) : n_rows(aux_n_rows) , n_cols(aux_n_cols) , n_elem(aux_n_rows*aux_n_cols) , n_alloc() , vec_state(0) , mem_state(0) , mem() { arma_debug_sigprint_this(this); init_cold(); arrayops::copy( memptr(), aux_mem, n_elem ); } //! DANGEROUS! Construct a temporary matrix, using auxiliary memory. //! This constructor is NOT intended for usage by user code. //! Its sole purpose is to be used by the Cube class. template inline Mat::Mat(const char junk, const eT* aux_mem, const uword aux_n_rows, const uword aux_n_cols) : n_rows (aux_n_rows ) , n_cols (aux_n_cols ) , n_elem (aux_n_rows*aux_n_cols) , n_alloc (0 ) , vec_state(0 ) , mem_state(3 ) , mem (aux_mem ) { arma_debug_sigprint_this(this); arma_ignore(junk); } //! in-place matrix addition template inline Mat& Mat::operator+=(const Mat& m) { arma_debug_sigprint(); arma_conform_assert_same_size(*this, m, "addition"); arrayops::inplace_plus( memptr(), m.memptr(), n_elem ); return *this; } //! in-place matrix subtraction template inline Mat& Mat::operator-=(const Mat& m) { arma_debug_sigprint(); arma_conform_assert_same_size(*this, m, "subtraction"); arrayops::inplace_minus( memptr(), m.memptr(), n_elem ); return *this; } //! in-place matrix multiplication template inline Mat& Mat::operator*=(const Mat& m) { arma_debug_sigprint(); glue_times::apply_inplace(*this, m); return *this; } //! in-place element-wise matrix multiplication template inline Mat& Mat::operator%=(const Mat& m) { arma_debug_sigprint(); arma_conform_assert_same_size(*this, m, "element-wise multiplication"); arrayops::inplace_mul( memptr(), m.memptr(), n_elem ); return *this; } //! in-place element-wise matrix division template inline Mat& Mat::operator/=(const Mat& m) { arma_debug_sigprint(); arma_conform_assert_same_size(*this, m, "element-wise division"); arrayops::inplace_div( memptr(), m.memptr(), n_elem ); return *this; } template template inline Mat::Mat(const BaseCube& X) : n_rows(0) , n_cols(0) , n_elem(0) , n_alloc(0) , vec_state(0) , mem_state(0) , mem() { arma_debug_sigprint_this(this); (*this).operator=(X); } template template inline Mat& Mat::operator=(const BaseCube& X) { arma_debug_sigprint(); Mat& out = *this; const unwrap_cube tmp(X.get_ref()); const Cube& in = tmp.M; arma_conform_assert_cube_as_mat(out, in, "copy into matrix", false); const uword in_n_rows = in.n_rows; const uword in_n_cols = in.n_cols; const uword in_n_slices = in.n_slices; const uword out_vec_state = out.vec_state; if(in_n_slices == 1) { out.set_size(in_n_rows, in_n_cols); for(uword ucol=0; ucol < in_n_cols; ++ucol) { arrayops::copy( out.colptr(ucol), in.slice_colptr(0, ucol), in_n_rows ); } } else { if(out_vec_state == 0) { if(in_n_cols == 1) { out.set_size(in_n_rows, in_n_slices); for(uword i=0; i < in_n_slices; ++i) { arrayops::copy( out.colptr(i), in.slice_colptr(i, 0), in_n_rows ); } } else if(in_n_rows == 1) { out.set_size(in_n_cols, in_n_slices); for(uword slice=0; slice < in_n_slices; ++slice) { eT* out_colptr = out.colptr(slice); uword i,j; for(i=0, j=1; j < in_n_cols; i+=2, j+=2) { const eT tmp_i = in.at(0, i, slice); const eT tmp_j = in.at(0, j, slice); out_colptr[i] = tmp_i; out_colptr[j] = tmp_j; } if(i < in_n_cols) { out_colptr[i] = in.at(0, i, slice); } } } } else { out.set_size(in_n_slices); eT* out_mem = out.memptr(); for(uword i=0; i template inline Mat& Mat::operator+=(const BaseCube& X) { arma_debug_sigprint(); Mat& out = *this; const unwrap_cube tmp(X.get_ref()); const Cube& in = tmp.M; arma_conform_assert_cube_as_mat(out, in, "addition", true); const uword in_n_rows = in.n_rows; const uword in_n_cols = in.n_cols; const uword in_n_slices = in.n_slices; const uword out_n_rows = out.n_rows; const uword out_n_cols = out.n_cols; const uword out_vec_state = out.vec_state; if(in_n_slices == 1) { for(uword ucol=0; ucol < in_n_cols; ++ucol) { arrayops::inplace_plus( out.colptr(ucol), in.slice_colptr(0, ucol), in_n_rows ); } } else { if(out_vec_state == 0) { if( (in_n_rows == out_n_rows) && (in_n_cols == 1) && (in_n_slices == out_n_cols) ) { for(uword i=0; i < in_n_slices; ++i) { arrayops::inplace_plus( out.colptr(i), in.slice_colptr(i, 0), in_n_rows ); } } else if( (in_n_rows == 1) && (in_n_cols == out_n_rows) && (in_n_slices == out_n_cols) ) { for(uword slice=0; slice < in_n_slices; ++slice) { eT* out_colptr = out.colptr(slice); uword i,j; for(i=0, j=1; j < in_n_cols; i+=2, j+=2) { const eT tmp_i = in.at(0, i, slice); const eT tmp_j = in.at(0, j, slice); out_colptr[i] += tmp_i; out_colptr[j] += tmp_j; } if(i < in_n_cols) { out_colptr[i] += in.at(0, i, slice); } } } } else { eT* out_mem = out.memptr(); for(uword i=0; i template inline Mat& Mat::operator-=(const BaseCube& X) { arma_debug_sigprint(); Mat& out = *this; const unwrap_cube tmp(X.get_ref()); const Cube& in = tmp.M; arma_conform_assert_cube_as_mat(out, in, "subtraction", true); const uword in_n_rows = in.n_rows; const uword in_n_cols = in.n_cols; const uword in_n_slices = in.n_slices; const uword out_n_rows = out.n_rows; const uword out_n_cols = out.n_cols; const uword out_vec_state = out.vec_state; if(in_n_slices == 1) { for(uword ucol=0; ucol < in_n_cols; ++ucol) { arrayops::inplace_minus( out.colptr(ucol), in.slice_colptr(0, ucol), in_n_rows ); } } else { if(out_vec_state == 0) { if( (in_n_rows == out_n_rows) && (in_n_cols == 1) && (in_n_slices == out_n_cols) ) { for(uword i=0; i < in_n_slices; ++i) { arrayops::inplace_minus( out.colptr(i), in.slice_colptr(i, 0), in_n_rows ); } } else if( (in_n_rows == 1) && (in_n_cols == out_n_rows) && (in_n_slices == out_n_cols) ) { for(uword slice=0; slice < in_n_slices; ++slice) { eT* out_colptr = out.colptr(slice); uword i,j; for(i=0, j=1; j < in_n_cols; i+=2, j+=2) { const eT tmp_i = in.at(0, i, slice); const eT tmp_j = in.at(0, j, slice); out_colptr[i] -= tmp_i; out_colptr[j] -= tmp_j; } if(i < in_n_cols) { out_colptr[i] -= in.at(0, i, slice); } } } } else { eT* out_mem = out.memptr(); for(uword i=0; i template inline Mat& Mat::operator*=(const BaseCube& X) { arma_debug_sigprint(); const Mat B(X); (*this).operator*=(B); return *this; } template template inline Mat& Mat::operator%=(const BaseCube& X) { arma_debug_sigprint(); Mat& out = *this; const unwrap_cube tmp(X.get_ref()); const Cube& in = tmp.M; arma_conform_assert_cube_as_mat(out, in, "element-wise multiplication", true); const uword in_n_rows = in.n_rows; const uword in_n_cols = in.n_cols; const uword in_n_slices = in.n_slices; const uword out_n_rows = out.n_rows; const uword out_n_cols = out.n_cols; const uword out_vec_state = out.vec_state; if(in_n_slices == 1) { for(uword ucol=0; ucol < in_n_cols; ++ucol) { arrayops::inplace_mul( out.colptr(ucol), in.slice_colptr(0, ucol), in_n_rows ); } } else { if(out_vec_state == 0) { if( (in_n_rows == out_n_rows) && (in_n_cols == 1) && (in_n_slices == out_n_cols) ) { for(uword i=0; i < in_n_slices; ++i) { arrayops::inplace_mul( out.colptr(i), in.slice_colptr(i, 0), in_n_rows ); } } else if( (in_n_rows == 1) && (in_n_cols == out_n_rows) && (in_n_slices == out_n_cols) ) { for(uword slice=0; slice < in_n_slices; ++slice) { eT* out_colptr = out.colptr(slice); uword i,j; for(i=0, j=1; j < in_n_cols; i+=2, j+=2) { const eT tmp_i = in.at(0, i, slice); const eT tmp_j = in.at(0, j, slice); out_colptr[i] *= tmp_i; out_colptr[j] *= tmp_j; } if(i < in_n_cols) { out_colptr[i] *= in.at(0, i, slice); } } } } else { eT* out_mem = out.memptr(); for(uword i=0; i template inline Mat& Mat::operator/=(const BaseCube& X) { arma_debug_sigprint(); Mat& out = *this; const unwrap_cube tmp(X.get_ref()); const Cube& in = tmp.M; arma_conform_assert_cube_as_mat(out, in, "element-wise division", true); const uword in_n_rows = in.n_rows; const uword in_n_cols = in.n_cols; const uword in_n_slices = in.n_slices; const uword out_n_rows = out.n_rows; const uword out_n_cols = out.n_cols; const uword out_vec_state = out.vec_state; if(in_n_slices == 1) { for(uword ucol=0; ucol < in_n_cols; ++ucol) { arrayops::inplace_div( out.colptr(ucol), in.slice_colptr(0, ucol), in_n_rows ); } } else { if(out_vec_state == 0) { if( (in_n_rows == out_n_rows) && (in_n_cols == 1) && (in_n_slices == out_n_cols) ) { for(uword i=0; i < in_n_slices; ++i) { arrayops::inplace_div( out.colptr(i), in.slice_colptr(i, 0), in_n_rows ); } } else if( (in_n_rows == 1) && (in_n_cols == out_n_rows) && (in_n_slices == out_n_cols) ) { for(uword slice=0; slice < in_n_slices; ++slice) { eT* out_colptr = out.colptr(slice); uword i,j; for(i=0, j=1; j < in_n_cols; i+=2, j+=2) { const eT tmp_i = in.at(0, i, slice); const eT tmp_j = in.at(0, j, slice); out_colptr[i] /= tmp_i; out_colptr[j] /= tmp_j; } if(i < in_n_cols) { out_colptr[i] /= in.at(0, i, slice); } } } } else { eT* out_mem = out.memptr(); for(uword i=0; i template inline Mat::Mat ( const Base::pod_type,T1>& A, const Base::pod_type,T2>& B ) : n_rows(0) , n_cols(0) , n_elem(0) , n_alloc(0) , vec_state(0) , mem_state(0) , mem() { arma_debug_sigprint_this(this); init(A,B); } template inline Mat::Mat(const subview& X, const bool use_colmem) : n_rows(X.n_rows) , n_cols(X.n_cols) , n_elem(X.n_elem) , n_alloc(0) , vec_state(0) , mem_state(use_colmem ? 3 : 0) , mem (use_colmem ? X.colptr(0) : nullptr) { arma_debug_sigprint_this(this); if(use_colmem) { arma_debug_print("Mat::Mat(): using existing memory in a submatrix"); } else { init_cold(); subview::extract(*this, X); } } //! construct a matrix from subview (eg. construct a matrix from a delayed submatrix operation) template inline Mat::Mat(const subview& X) : n_rows(X.n_rows) , n_cols(X.n_cols) , n_elem(X.n_elem) , n_alloc() , vec_state(0) , mem_state(0) , mem() { arma_debug_sigprint_this(this); init_cold(); subview::extract(*this, X); } //! construct a matrix from subview (eg. construct a matrix from a delayed submatrix operation) template inline Mat& Mat::operator=(const subview& X) { arma_debug_sigprint(); const bool alias = (this == &(X.m)); if(alias == false) { init_warm(X.n_rows, X.n_cols); subview::extract(*this, X); } else { Mat tmp(X); steal_mem(tmp); } return *this; } //! in-place matrix addition (using a submatrix on the right-hand-side) template inline Mat& Mat::operator+=(const subview& X) { arma_debug_sigprint(); subview::plus_inplace(*this, X); return *this; } //! in-place matrix subtraction (using a submatrix on the right-hand-side) template inline Mat& Mat::operator-=(const subview& X) { arma_debug_sigprint(); subview::minus_inplace(*this, X); return *this; } //! in-place matrix multiplication (using a submatrix on the right-hand-side) template inline Mat& Mat::operator*=(const subview& X) { arma_debug_sigprint(); glue_times::apply_inplace(*this, X); return *this; } //! in-place element-wise matrix multiplication (using a submatrix on the right-hand-side) template inline Mat& Mat::operator%=(const subview& X) { arma_debug_sigprint(); subview::schur_inplace(*this, X); return *this; } //! in-place element-wise matrix division (using a submatrix on the right-hand-side) template inline Mat& Mat::operator/=(const subview& X) { arma_debug_sigprint(); subview::div_inplace(*this, X); return *this; } template inline Mat::Mat(const subview_row_strans& X) : n_rows(X.n_rows) , n_cols(X.n_cols) , n_elem(X.n_elem) , n_alloc() , vec_state(0) , mem_state(0) , mem() { arma_debug_sigprint_this(this); init_cold(); X.extract(*this); } template inline Mat::Mat(const subview_row_htrans& X) : n_rows(X.n_rows) , n_cols(X.n_cols) , n_elem(X.n_elem) , n_alloc() , vec_state(0) , mem_state(0) , mem() { arma_debug_sigprint_this(this); init_cold(); X.extract(*this); } template inline Mat::Mat(const xvec_htrans& X) : n_rows(X.n_rows) , n_cols(X.n_cols) , n_elem(X.n_elem) , n_alloc() , vec_state(0) , mem_state(0) , mem() { arma_debug_sigprint_this(this); init_cold(); X.extract(*this); } template template inline Mat::Mat(const xtrans_mat& X) : n_rows(X.n_rows) , n_cols(X.n_cols) , n_elem(X.n_elem) , n_alloc() , vec_state(0) , mem_state(0) , mem() { arma_debug_sigprint_this(this); init_cold(); X.extract(*this); } //! construct a matrix from a subview_cube instance template inline Mat::Mat(const subview_cube& x) : n_rows(0) , n_cols(0) , n_elem(0) , n_alloc(0) , vec_state(0) , mem_state(0) , mem() { arma_debug_sigprint_this(this); this->operator=(x); } //! construct a matrix from a subview_cube instance template inline Mat& Mat::operator=(const subview_cube& X) { arma_debug_sigprint(); subview_cube::extract(*this, X); return *this; } //! in-place matrix addition (using a single-slice subcube on the right-hand-side) template inline Mat& Mat::operator+=(const subview_cube& X) { arma_debug_sigprint(); subview_cube::plus_inplace(*this, X); return *this; } //! in-place matrix subtraction (using a single-slice subcube on the right-hand-side) template inline Mat& Mat::operator-=(const subview_cube& X) { arma_debug_sigprint(); subview_cube::minus_inplace(*this, X); return *this; } //! in-place matrix multiplication (using a single-slice subcube on the right-hand-side) template inline Mat& Mat::operator*=(const subview_cube& X) { arma_debug_sigprint(); const Mat tmp(X); glue_times::apply_inplace(*this, tmp); return *this; } //! in-place element-wise matrix multiplication (using a single-slice subcube on the right-hand-side) template inline Mat& Mat::operator%=(const subview_cube& X) { arma_debug_sigprint(); subview_cube::schur_inplace(*this, X); return *this; } //! in-place element-wise matrix division (using a single-slice subcube on the right-hand-side) template inline Mat& Mat::operator/=(const subview_cube& X) { arma_debug_sigprint(); subview_cube::div_inplace(*this, X); return *this; } //! construct a matrix from diagview (eg. construct a matrix from a delayed diag operation) template inline Mat::Mat(const diagview& X) : n_rows(X.n_rows) , n_cols(X.n_cols) , n_elem(X.n_elem) , n_alloc() , vec_state(0) , mem_state(0) , mem() { arma_debug_sigprint_this(this); init_cold(); diagview::extract(*this, X); } //! construct a matrix from diagview (eg. construct a matrix from a delayed diag operation) template inline Mat& Mat::operator=(const diagview& X) { arma_debug_sigprint(); const bool alias = (this == &(X.m)); if(alias == false) { init_warm(X.n_rows, X.n_cols); diagview::extract(*this, X); } else { Mat tmp(X); steal_mem(tmp); } return *this; } //! in-place matrix addition (using a diagview on the right-hand-side) template inline Mat& Mat::operator+=(const diagview& X) { arma_debug_sigprint(); diagview::plus_inplace(*this, X); return *this; } //! in-place matrix subtraction (using a diagview on the right-hand-side) template inline Mat& Mat::operator-=(const diagview& X) { arma_debug_sigprint(); diagview::minus_inplace(*this, X); return *this; } //! in-place matrix multiplication (using a diagview on the right-hand-side) template inline Mat& Mat::operator*=(const diagview& X) { arma_debug_sigprint(); glue_times::apply_inplace(*this, X); return *this; } //! in-place element-wise matrix multiplication (using a diagview on the right-hand-side) template inline Mat& Mat::operator%=(const diagview& X) { arma_debug_sigprint(); diagview::schur_inplace(*this, X); return *this; } //! in-place element-wise matrix division (using a diagview on the right-hand-side) template inline Mat& Mat::operator/=(const diagview& X) { arma_debug_sigprint(); diagview::div_inplace(*this, X); return *this; } template template inline Mat::Mat(const subview_elem1& X) : n_rows(0) , n_cols(0) , n_elem(0) , n_alloc(0) , vec_state(0) , mem_state(0) , mem() { arma_debug_sigprint_this(this); this->operator=(X); } template template inline Mat& Mat::operator=(const subview_elem1& X) { arma_debug_sigprint(); subview_elem1::extract(*this, X); return *this; } template template inline Mat& Mat::operator+=(const subview_elem1& X) { arma_debug_sigprint(); subview_elem1::plus_inplace(*this, X); return *this; } template template inline Mat& Mat::operator-=(const subview_elem1& X) { arma_debug_sigprint(); subview_elem1::minus_inplace(*this, X); return *this; } template template inline Mat& Mat::operator*=(const subview_elem1& X) { arma_debug_sigprint(); glue_times::apply_inplace(*this, X); return *this; } template template inline Mat& Mat::operator%=(const subview_elem1& X) { arma_debug_sigprint(); subview_elem1::schur_inplace(*this, X); return *this; } template template inline Mat& Mat::operator/=(const subview_elem1& X) { arma_debug_sigprint(); subview_elem1::div_inplace(*this, X); return *this; } template template inline Mat::Mat(const subview_elem2& X) : n_rows(0) , n_cols(0) , n_elem(0) , n_alloc(0) , vec_state(0) , mem_state(0) , mem() { arma_debug_sigprint_this(this); this->operator=(X); } template template inline Mat& Mat::operator=(const subview_elem2& X) { arma_debug_sigprint(); subview_elem2::extract(*this, X); return *this; } template template inline Mat& Mat::operator+=(const subview_elem2& X) { arma_debug_sigprint(); subview_elem2::plus_inplace(*this, X); return *this; } template template inline Mat& Mat::operator-=(const subview_elem2& X) { arma_debug_sigprint(); subview_elem2::minus_inplace(*this, X); return *this; } template template inline Mat& Mat::operator*=(const subview_elem2& X) { arma_debug_sigprint(); glue_times::apply_inplace(*this, X); return *this; } template template inline Mat& Mat::operator%=(const subview_elem2& X) { arma_debug_sigprint(); subview_elem2::schur_inplace(*this, X); return *this; } template template inline Mat& Mat::operator/=(const subview_elem2& X) { arma_debug_sigprint(); subview_elem2::div_inplace(*this, X); return *this; } template template inline Mat::Mat(const SpBase& m) : n_rows(0) , n_cols(0) , n_elem(0) , n_alloc(0) , vec_state(0) , mem_state(0) , mem() { arma_debug_sigprint_this(this); (*this).operator=(m); } template template inline Mat& Mat::operator=(const SpBase& m) { arma_debug_sigprint(); const unwrap_spmat U(m.get_ref()); const SpMat& x = U.M; const uword x_n_cols = x.n_cols; (*this).zeros(x.n_rows, x_n_cols); if(x.n_nonzero == 0) { return *this; } const eT* x_values = x.values; const uword* x_row_indices = x.row_indices; const uword* x_col_ptrs = x.col_ptrs; for(uword x_col = 0; x_col < x_n_cols; ++x_col) { const uword start = x_col_ptrs[x_col ]; const uword end = x_col_ptrs[x_col + 1]; for(uword i = start; i < end; ++i) { const uword x_row = x_row_indices[i]; const eT x_val = x_values[i]; at(x_row, x_col) = x_val; } } return *this; } template template inline Mat& Mat::operator+=(const SpBase& m) { arma_debug_sigprint(); const SpProxy p(m.get_ref()); arma_conform_assert_same_size(n_rows, n_cols, p.get_n_rows(), p.get_n_cols(), "addition"); typename SpProxy::const_iterator_type it = p.begin(); typename SpProxy::const_iterator_type it_end = p.end(); for(; it != it_end; ++it) { at(it.row(), it.col()) += (*it); } return *this; } template template inline Mat& Mat::operator-=(const SpBase& m) { arma_debug_sigprint(); const SpProxy p(m.get_ref()); arma_conform_assert_same_size(n_rows, n_cols, p.get_n_rows(), p.get_n_cols(), "subtraction"); typename SpProxy::const_iterator_type it = p.begin(); typename SpProxy::const_iterator_type it_end = p.end(); for(; it != it_end; ++it) { at(it.row(), it.col()) -= (*it); } return *this; } template template inline Mat& Mat::operator*=(const SpBase& m) { arma_debug_sigprint(); Mat z = (*this) * m.get_ref(); steal_mem(z); return *this; } template template inline Mat& Mat::operator%=(const SpBase& m) { arma_debug_sigprint(); const SpProxy p(m.get_ref()); arma_conform_assert_same_size(n_rows, n_cols, p.get_n_rows(), p.get_n_cols(), "element-wise multiplication"); if(p.get_n_nonzero() == 0) { return (*this).zeros(); } typename SpProxy::const_iterator_type it = p.begin(); typename SpProxy::const_iterator_type it_end = p.end(); // We have to zero everything that isn't being used. arrayops::fill_zeros(memptr(), (it.col() * n_rows) + it.row()); while(it != it_end) { const uword cur_loc = (it.col() * n_rows) + it.row(); access::rw(mem[cur_loc]) *= (*it); ++it; const uword next_loc = (it == it_end) ? (p.get_n_cols() * n_rows) : (it.col() * n_rows) + it.row(); arrayops::fill_zeros(memptr() + cur_loc + 1, (next_loc - cur_loc - 1)); } return *this; } template template inline Mat& Mat::operator/=(const SpBase& m) { arma_debug_sigprint(); // NOTE: use of this function is not advised; it is implemented only for completeness const SpProxy p(m.get_ref()); arma_conform_assert_same_size(n_rows, n_cols, p.get_n_rows(), p.get_n_cols(), "element-wise division"); for(uword c = 0; c < n_cols; ++c) for(uword r = 0; r < n_rows; ++r) { at(r, c) /= p.at(r, c); } return *this; } template inline Mat::Mat(const SpSubview& X) : n_rows(0) , n_cols(0) , n_elem(0) , n_alloc(0) , vec_state(0) , mem_state(0) , mem() { arma_debug_sigprint_this(this); (*this).operator=(X); } template inline Mat& Mat::operator=(const SpSubview& X) { arma_debug_sigprint(); (*this).zeros(X.n_rows, X.n_cols); if(X.n_nonzero == 0) { return *this; } if(X.n_rows == X.m.n_rows) { arma_debug_print("access via arrays"); X.m.sync(); const uword sv_col_start = X.aux_col1; const uword sv_col_end = X.aux_col1 + X.n_cols - 1; const eT* m_values = X.m.values; const uword* m_row_indices = X.m.row_indices; const uword* m_col_ptrs = X.m.col_ptrs; for(uword m_col = sv_col_start; m_col <= sv_col_end; ++m_col) { const uword m_col_adjusted = m_col - sv_col_start; const uword start = m_col_ptrs[m_col ]; const uword end = m_col_ptrs[m_col + 1]; for(uword ii = start; ii < end; ++ii) { const uword m_row = m_row_indices[ii]; const eT m_val = m_values[ii]; at(m_row, m_col_adjusted) = m_val; } } } else { arma_debug_print("access via iterators"); typename SpSubview::const_iterator it = X.begin(); typename SpSubview::const_iterator it_end = X.end(); for(; it != it_end; ++it) { at(it.row(), it.col()) = (*it); } } return *this; } template inline Mat& Mat::operator+=(const SpSubview& X) { arma_debug_sigprint(); arma_conform_assert_same_size(n_rows, n_cols, X.n_rows, X.n_cols, "addition"); if(X.n_nonzero == 0) { return *this; } if(X.n_rows == X.m.n_rows) { arma_debug_print("access via arrays"); X.m.sync(); const uword sv_col_start = X.aux_col1; const uword sv_col_end = X.aux_col1 + X.n_cols - 1; const eT* m_values = X.m.values; const uword* m_row_indices = X.m.row_indices; const uword* m_col_ptrs = X.m.col_ptrs; for(uword m_col = sv_col_start; m_col <= sv_col_end; ++m_col) { const uword m_col_adjusted = m_col - sv_col_start; const uword start = m_col_ptrs[m_col ]; const uword end = m_col_ptrs[m_col + 1]; for(uword ii = start; ii < end; ++ii) { const uword m_row = m_row_indices[ii]; const eT m_val = m_values[ii]; at(m_row, m_col_adjusted) += m_val; } } } else { arma_debug_print("access via iterators"); typename SpSubview::const_iterator it = X.begin(); typename SpSubview::const_iterator it_end = X.end(); for(; it != it_end; ++it) { at(it.row(), it.col()) += (*it); } } return *this; } template inline Mat& Mat::operator-=(const SpSubview& X) { arma_debug_sigprint(); arma_conform_assert_same_size(n_rows, n_cols, X.n_rows, X.n_cols, "subtraction"); if(X.n_nonzero == 0) { return *this; } if(X.n_rows == X.m.n_rows) { arma_debug_print("access via arrays"); X.m.sync(); const uword sv_col_start = X.aux_col1; const uword sv_col_end = X.aux_col1 + X.n_cols - 1; const eT* m_values = X.m.values; const uword* m_row_indices = X.m.row_indices; const uword* m_col_ptrs = X.m.col_ptrs; for(uword m_col = sv_col_start; m_col <= sv_col_end; ++m_col) { const uword m_col_adjusted = m_col - sv_col_start; const uword start = m_col_ptrs[m_col ]; const uword end = m_col_ptrs[m_col + 1]; for(uword ii = start; ii < end; ++ii) { const uword m_row = m_row_indices[ii]; const eT m_val = m_values[ii]; at(m_row, m_col_adjusted) -= m_val; } } } else { arma_debug_print("access via iterators"); typename SpSubview::const_iterator it = X.begin(); typename SpSubview::const_iterator it_end = X.end(); for(; it != it_end; ++it) { at(it.row(), it.col()) -= (*it); } } return *this; } template inline Mat::Mat(const spdiagview& X) : n_rows(X.n_rows) , n_cols(X.n_cols) , n_elem(X.n_elem) , n_alloc(0) , vec_state(0) , mem_state(0) , mem() { arma_debug_sigprint_this(this); init_cold(); spdiagview::extract(*this, X); } template inline Mat& Mat::operator=(const spdiagview& X) { arma_debug_sigprint(); init_warm(X.n_rows, X.n_cols); spdiagview::extract(*this, X); return *this; } template inline Mat& Mat::operator+=(const spdiagview& X) { arma_debug_sigprint(); const Mat tmp(X); return (*this).operator+=(tmp); } template inline Mat& Mat::operator-=(const spdiagview& X) { arma_debug_sigprint(); const Mat tmp(X); return (*this).operator-=(tmp); } template inline Mat& Mat::operator*=(const spdiagview& X) { arma_debug_sigprint(); const Mat tmp(X); return (*this).operator*=(tmp); } template inline Mat& Mat::operator%=(const spdiagview& X) { arma_debug_sigprint(); const Mat tmp(X); return (*this).operator%=(tmp); } template inline Mat& Mat::operator/=(const spdiagview& X) { arma_debug_sigprint(); const Mat tmp(X); return (*this).operator/=(tmp); } template inline mat_injector< Mat > Mat::operator<<(const eT val) { return mat_injector< Mat >(*this, val); } template inline mat_injector< Mat > Mat::operator<<(const injector_end_of_row<>& x) { return mat_injector< Mat >(*this, x); } //! creation of subview (row vector) template arma_inline subview_row Mat::row(const uword row_num) { arma_debug_sigprint(); arma_conform_check_bounds( row_num >= n_rows, "Mat::row(): index out of bounds" ); return subview_row(*this, row_num); } //! creation of subview (row vector) template arma_inline const subview_row Mat::row(const uword row_num) const { arma_debug_sigprint(); arma_conform_check_bounds( row_num >= n_rows, "Mat::row(): index out of bounds" ); return subview_row(*this, row_num); } template inline subview_row Mat::operator()(const uword row_num, const span& col_span) { arma_debug_sigprint(); const bool col_all = col_span.whole; const uword local_n_cols = n_cols; const uword in_col1 = col_all ? 0 : col_span.a; const uword in_col2 = col_span.b; const uword submat_n_cols = col_all ? local_n_cols : in_col2 - in_col1 + 1; arma_conform_check_bounds ( (row_num >= n_rows) || ( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= local_n_cols)) ) , "Mat::operator(): indices out of bounds or incorrectly used" ); return subview_row(*this, row_num, in_col1, submat_n_cols); } template inline const subview_row Mat::operator()(const uword row_num, const span& col_span) const { arma_debug_sigprint(); const bool col_all = col_span.whole; const uword local_n_cols = n_cols; const uword in_col1 = col_all ? 0 : col_span.a; const uword in_col2 = col_span.b; const uword submat_n_cols = col_all ? local_n_cols : in_col2 - in_col1 + 1; arma_conform_check_bounds ( (row_num >= n_rows) || ( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= local_n_cols)) ) , "Mat::operator(): indices out of bounds or incorrectly used" ); return subview_row(*this, row_num, in_col1, submat_n_cols); } //! creation of subview (column vector) template arma_inline subview_col Mat::col(const uword col_num) { arma_debug_sigprint(); arma_conform_check_bounds( col_num >= n_cols, "Mat::col(): index out of bounds" ); return subview_col(*this, col_num); } //! creation of subview (column vector) template arma_inline const subview_col Mat::col(const uword col_num) const { arma_debug_sigprint(); arma_conform_check_bounds( col_num >= n_cols, "Mat::col(): index out of bounds" ); return subview_col(*this, col_num); } template inline subview_col Mat::operator()(const span& row_span, const uword col_num) { arma_debug_sigprint(); const bool row_all = row_span.whole; const uword local_n_rows = n_rows; const uword in_row1 = row_all ? 0 : row_span.a; const uword in_row2 = row_span.b; const uword submat_n_rows = row_all ? local_n_rows : in_row2 - in_row1 + 1; arma_conform_check_bounds ( (col_num >= n_cols) || ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows)) ) , "Mat::operator(): indices out of bounds or incorrectly used" ); return subview_col(*this, col_num, in_row1, submat_n_rows); } template inline const subview_col Mat::operator()(const span& row_span, const uword col_num) const { arma_debug_sigprint(); const bool row_all = row_span.whole; const uword local_n_rows = n_rows; const uword in_row1 = row_all ? 0 : row_span.a; const uword in_row2 = row_span.b; const uword submat_n_rows = row_all ? local_n_rows : in_row2 - in_row1 + 1; arma_conform_check_bounds ( (col_num >= n_cols) || ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows)) ) , "Mat::operator(): indices out of bounds or incorrectly used" ); return subview_col(*this, col_num, in_row1, submat_n_rows); } //! create a Col object which uses memory from an existing matrix object. //! this approach is currently not alias safe //! and does not take into account that the parent matrix object could be deleted. //! if deleted memory is accessed by the created Col object, //! it will cause memory corruption and/or a crash template inline Col Mat::unsafe_col(const uword col_num) { arma_debug_sigprint(); arma_conform_check_bounds( col_num >= n_cols, "Mat::unsafe_col(): index out of bounds" ); return Col(colptr(col_num), n_rows, false, true); } //! create a Col object which uses memory from an existing matrix object. //! this approach is currently not alias safe //! and does not take into account that the parent matrix object could be deleted. //! if deleted memory is accessed by the created Col object, //! it will cause memory corruption and/or a crash template inline const Col Mat::unsafe_col(const uword col_num) const { arma_debug_sigprint(); arma_conform_check_bounds( col_num >= n_cols, "Mat::unsafe_col(): index out of bounds" ); typedef const Col out_type; return out_type(const_cast(colptr(col_num)), n_rows, false, true); } //! creation of subview (submatrix comprised of specified row vectors) template arma_inline subview Mat::rows(const uword in_row1, const uword in_row2) { arma_debug_sigprint(); arma_conform_check_bounds ( (in_row1 > in_row2) || (in_row2 >= n_rows), "Mat::rows(): indices out of bounds or incorrectly used" ); const uword subview_n_rows = in_row2 - in_row1 + 1; return subview(*this, in_row1, 0, subview_n_rows, n_cols ); } //! creation of subview (submatrix comprised of specified row vectors) template arma_inline const subview Mat::rows(const uword in_row1, const uword in_row2) const { arma_debug_sigprint(); arma_conform_check_bounds ( (in_row1 > in_row2) || (in_row2 >= n_rows), "Mat::rows(): indices out of bounds or incorrectly used" ); const uword subview_n_rows = in_row2 - in_row1 + 1; return subview(*this, in_row1, 0, subview_n_rows, n_cols ); } //! creation of subview (submatrix comprised of specified column vectors) template arma_inline subview_cols Mat::cols(const uword in_col1, const uword in_col2) { arma_debug_sigprint(); arma_conform_check_bounds ( (in_col1 > in_col2) || (in_col2 >= n_cols), "Mat::cols(): indices out of bounds or incorrectly used" ); const uword subview_n_cols = in_col2 - in_col1 + 1; return subview_cols(*this, in_col1, subview_n_cols); } //! creation of subview (submatrix comprised of specified column vectors) template arma_inline const subview_cols Mat::cols(const uword in_col1, const uword in_col2) const { arma_debug_sigprint(); arma_conform_check_bounds ( (in_col1 > in_col2) || (in_col2 >= n_cols), "Mat::cols(): indices out of bounds or incorrectly used" ); const uword subview_n_cols = in_col2 - in_col1 + 1; return subview_cols(*this, in_col1, subview_n_cols); } //! creation of subview (submatrix comprised of specified row vectors) template inline subview Mat::rows(const span& row_span) { arma_debug_sigprint(); const bool row_all = row_span.whole; const uword local_n_rows = n_rows; const uword in_row1 = row_all ? 0 : row_span.a; const uword in_row2 = row_span.b; const uword submat_n_rows = row_all ? local_n_rows : in_row2 - in_row1 + 1; arma_conform_check_bounds ( ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows)) ) , "Mat::rows(): indices out of bounds or incorrectly used" ); return subview(*this, in_row1, 0, submat_n_rows, n_cols); } //! creation of subview (submatrix comprised of specified row vectors) template inline const subview Mat::rows(const span& row_span) const { arma_debug_sigprint(); const bool row_all = row_span.whole; const uword local_n_rows = n_rows; const uword in_row1 = row_all ? 0 : row_span.a; const uword in_row2 = row_span.b; const uword submat_n_rows = row_all ? local_n_rows : in_row2 - in_row1 + 1; arma_conform_check_bounds ( ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows)) ) , "Mat::rows(): indices out of bounds or incorrectly used" ); return subview(*this, in_row1, 0, submat_n_rows, n_cols); } //! creation of subview (submatrix comprised of specified column vectors) template arma_inline subview_cols Mat::cols(const span& col_span) { arma_debug_sigprint(); const bool col_all = col_span.whole; const uword local_n_cols = n_cols; const uword in_col1 = col_all ? 0 : col_span.a; const uword in_col2 = col_span.b; const uword submat_n_cols = col_all ? local_n_cols : in_col2 - in_col1 + 1; arma_conform_check_bounds ( ( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= local_n_cols)) ) , "Mat::cols(): indices out of bounds or incorrectly used" ); return subview_cols(*this, in_col1, submat_n_cols); } //! creation of subview (submatrix comprised of specified column vectors) template arma_inline const subview_cols Mat::cols(const span& col_span) const { arma_debug_sigprint(); const bool col_all = col_span.whole; const uword local_n_cols = n_cols; const uword in_col1 = col_all ? 0 : col_span.a; const uword in_col2 = col_span.b; const uword submat_n_cols = col_all ? local_n_cols : in_col2 - in_col1 + 1; arma_conform_check_bounds ( ( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= local_n_cols)) ) , "Mat::cols(): indices out of bounds or incorrectly used" ); return subview_cols(*this, in_col1, submat_n_cols); } //! creation of subview (submatrix) template arma_inline subview Mat::submat(const uword in_row1, const uword in_col1, const uword in_row2, const uword in_col2) { arma_debug_sigprint(); arma_conform_check_bounds ( (in_row1 > in_row2) || (in_col1 > in_col2) || (in_row2 >= n_rows) || (in_col2 >= n_cols), "Mat::submat(): indices out of bounds or incorrectly used" ); const uword subview_n_rows = in_row2 - in_row1 + 1; const uword subview_n_cols = in_col2 - in_col1 + 1; return subview(*this, in_row1, in_col1, subview_n_rows, subview_n_cols); } //! creation of subview (generic submatrix) template arma_inline const subview Mat::submat(const uword in_row1, const uword in_col1, const uword in_row2, const uword in_col2) const { arma_debug_sigprint(); arma_conform_check_bounds ( (in_row1 > in_row2) || (in_col1 > in_col2) || (in_row2 >= n_rows) || (in_col2 >= n_cols), "Mat::submat(): indices out of bounds or incorrectly used" ); const uword subview_n_rows = in_row2 - in_row1 + 1; const uword subview_n_cols = in_col2 - in_col1 + 1; return subview(*this, in_row1, in_col1, subview_n_rows, subview_n_cols); } //! creation of subview (submatrix) template arma_inline subview Mat::submat(const uword in_row1, const uword in_col1, const SizeMat& s) { arma_debug_sigprint(); const uword l_n_rows = n_rows; const uword l_n_cols = n_cols; const uword s_n_rows = s.n_rows; const uword s_n_cols = s.n_cols; arma_conform_check_bounds ( ((in_row1 >= l_n_rows) || (in_col1 >= l_n_cols) || ((in_row1 + s_n_rows) > l_n_rows) || ((in_col1 + s_n_cols) > l_n_cols)), "Mat::submat(): indices or size out of bounds" ); return subview(*this, in_row1, in_col1, s_n_rows, s_n_cols); } //! creation of subview (submatrix) template arma_inline const subview Mat::submat(const uword in_row1, const uword in_col1, const SizeMat& s) const { arma_debug_sigprint(); const uword l_n_rows = n_rows; const uword l_n_cols = n_cols; const uword s_n_rows = s.n_rows; const uword s_n_cols = s.n_cols; arma_conform_check_bounds ( ((in_row1 >= l_n_rows) || (in_col1 >= l_n_cols) || ((in_row1 + s_n_rows) > l_n_rows) || ((in_col1 + s_n_cols) > l_n_cols)), "Mat::submat(): indices or size out of bounds" ); return subview(*this, in_row1, in_col1, s_n_rows, s_n_cols); } //! creation of subview (submatrix) template inline subview Mat::submat(const span& row_span, const span& col_span) { arma_debug_sigprint(); const bool row_all = row_span.whole; const bool col_all = col_span.whole; const uword local_n_rows = n_rows; const uword local_n_cols = n_cols; const uword in_row1 = row_all ? 0 : row_span.a; const uword in_row2 = row_span.b; const uword submat_n_rows = row_all ? local_n_rows : in_row2 - in_row1 + 1; const uword in_col1 = col_all ? 0 : col_span.a; const uword in_col2 = col_span.b; const uword submat_n_cols = col_all ? local_n_cols : in_col2 - in_col1 + 1; arma_conform_check_bounds ( ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows)) ) || ( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= local_n_cols)) ) , "Mat::submat(): indices out of bounds or incorrectly used" ); return subview(*this, in_row1, in_col1, submat_n_rows, submat_n_cols); } //! creation of subview (generic submatrix) template inline const subview Mat::submat(const span& row_span, const span& col_span) const { arma_debug_sigprint(); const bool row_all = row_span.whole; const bool col_all = col_span.whole; const uword local_n_rows = n_rows; const uword local_n_cols = n_cols; const uword in_row1 = row_all ? 0 : row_span.a; const uword in_row2 = row_span.b; const uword submat_n_rows = row_all ? local_n_rows : in_row2 - in_row1 + 1; const uword in_col1 = col_all ? 0 : col_span.a; const uword in_col2 = col_span.b; const uword submat_n_cols = col_all ? local_n_cols : in_col2 - in_col1 + 1; arma_conform_check_bounds ( ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows)) ) || ( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= local_n_cols)) ) , "Mat::submat(): indices out of bounds or incorrectly used" ); return subview(*this, in_row1, in_col1, submat_n_rows, submat_n_cols); } template inline subview Mat::operator()(const span& row_span, const span& col_span) { arma_debug_sigprint(); return (*this).submat(row_span, col_span); } template inline const subview Mat::operator()(const span& row_span, const span& col_span) const { arma_debug_sigprint(); return (*this).submat(row_span, col_span); } template inline subview Mat::operator()(const uword in_row1, const uword in_col1, const SizeMat& s) { arma_debug_sigprint(); return (*this).submat(in_row1, in_col1, s); } template inline const subview Mat::operator()(const uword in_row1, const uword in_col1, const SizeMat& s) const { arma_debug_sigprint(); return (*this).submat(in_row1, in_col1, s); } template inline subview Mat::head_rows(const uword N) { arma_debug_sigprint(); arma_conform_check_bounds( (N > n_rows), "Mat::head_rows(): size out of bounds" ); return subview(*this, 0, 0, N, n_cols); } template inline const subview Mat::head_rows(const uword N) const { arma_debug_sigprint(); arma_conform_check_bounds( (N > n_rows), "Mat::head_rows(): size out of bounds" ); return subview(*this, 0, 0, N, n_cols); } template inline subview Mat::tail_rows(const uword N) { arma_debug_sigprint(); arma_conform_check_bounds( (N > n_rows), "Mat::tail_rows(): size out of bounds" ); const uword start_row = n_rows - N; return subview(*this, start_row, 0, N, n_cols); } template inline const subview Mat::tail_rows(const uword N) const { arma_debug_sigprint(); arma_conform_check_bounds( (N > n_rows), "Mat::tail_rows(): size out of bounds" ); const uword start_row = n_rows - N; return subview(*this, start_row, 0, N, n_cols); } template inline subview_cols Mat::head_cols(const uword N) { arma_debug_sigprint(); arma_conform_check_bounds( (N > n_cols), "Mat::head_cols(): size out of bounds" ); return subview_cols(*this, 0, N); } template inline const subview_cols Mat::head_cols(const uword N) const { arma_debug_sigprint(); arma_conform_check_bounds( (N > n_cols), "Mat::head_cols(): size out of bounds" ); return subview_cols(*this, 0, N); } template inline subview_cols Mat::tail_cols(const uword N) { arma_debug_sigprint(); arma_conform_check_bounds( (N > n_cols), "Mat::tail_cols(): size out of bounds" ); const uword start_col = n_cols - N; return subview_cols(*this, start_col, N); } template inline const subview_cols Mat::tail_cols(const uword N) const { arma_debug_sigprint(); arma_conform_check_bounds( (N > n_cols), "Mat::tail_cols(): size out of bounds" ); const uword start_col = n_cols - N; return subview_cols(*this, start_col, N); } template template arma_inline subview_elem1 Mat::elem(const Base& a) { arma_debug_sigprint(); return subview_elem1(*this, a); } template template arma_inline const subview_elem1 Mat::elem(const Base& a) const { arma_debug_sigprint(); return subview_elem1(*this, a); } template template arma_inline subview_elem1 Mat::operator()(const Base& a) { arma_debug_sigprint(); return subview_elem1(*this, a); } template template arma_inline const subview_elem1 Mat::operator()(const Base& a) const { arma_debug_sigprint(); return subview_elem1(*this, a); } template template arma_inline subview_elem2 Mat::elem(const Base& ri, const Base& ci) { arma_debug_sigprint(); return subview_elem2(*this, ri, ci, false, false); } template template arma_inline const subview_elem2 Mat::elem(const Base& ri, const Base& ci) const { arma_debug_sigprint(); return subview_elem2(*this, ri, ci, false, false); } template template arma_inline subview_elem2 Mat::submat(const Base& ri, const Base& ci) { arma_debug_sigprint(); return subview_elem2(*this, ri, ci, false, false); } template template arma_inline const subview_elem2 Mat::submat(const Base& ri, const Base& ci) const { arma_debug_sigprint(); return subview_elem2(*this, ri, ci, false, false); } template template arma_inline subview_elem2 Mat::operator()(const Base& ri, const Base& ci) { arma_debug_sigprint(); return subview_elem2(*this, ri, ci, false, false); } template template arma_inline const subview_elem2 Mat::operator()(const Base& ri, const Base& ci) const { arma_debug_sigprint(); return subview_elem2(*this, ri, ci, false, false); } template template arma_inline subview_elem2 Mat::rows(const Base& ri) { arma_debug_sigprint(); return subview_elem2(*this, ri, ri, false, true); } template template arma_inline const subview_elem2 Mat::rows(const Base& ri) const { arma_debug_sigprint(); return subview_elem2(*this, ri, ri, false, true); } template template arma_inline subview_elem2 Mat::cols(const Base& ci) { arma_debug_sigprint(); return subview_elem2(*this, ci, ci, true, false); } template template arma_inline const subview_elem2 Mat::cols(const Base& ci) const { arma_debug_sigprint(); return subview_elem2(*this, ci, ci, true, false); } template arma_inline subview_each1< Mat, 0 > Mat::each_col() { arma_debug_sigprint(); return subview_each1< Mat, 0>(*this); } template arma_inline subview_each1< Mat, 1 > Mat::each_row() { arma_debug_sigprint(); return subview_each1< Mat, 1>(*this); } template arma_inline const subview_each1< Mat, 0 > Mat::each_col() const { arma_debug_sigprint(); return subview_each1< Mat, 0>(*this); } template arma_inline const subview_each1< Mat, 1 > Mat::each_row() const { arma_debug_sigprint(); return subview_each1< Mat, 1>(*this); } template template inline subview_each2< Mat, 0, T1 > Mat::each_col(const Base& indices) { arma_debug_sigprint(); return subview_each2< Mat, 0, T1 >(*this, indices); } template template inline subview_each2< Mat, 1, T1 > Mat::each_row(const Base& indices) { arma_debug_sigprint(); return subview_each2< Mat, 1, T1 >(*this, indices); } template template inline const subview_each2< Mat, 0, T1 > Mat::each_col(const Base& indices) const { arma_debug_sigprint(); return subview_each2< Mat, 0, T1 >(*this, indices); } template template inline const subview_each2< Mat, 1, T1 > Mat::each_row(const Base& indices) const { arma_debug_sigprint(); return subview_each2< Mat, 1, T1 >(*this, indices); } //! apply a lambda function to each column, where each column is interpreted as a column vector template inline Mat& Mat::each_col(const std::function< void(Col&) >& F) { arma_debug_sigprint(); for(uword ii=0; ii < n_cols; ++ii) { Col tmp(colptr(ii), n_rows, false, true); F(tmp); } return *this; } template inline const Mat& Mat::each_col(const std::function< void(const Col&) >& F) const { arma_debug_sigprint(); for(uword ii=0; ii < n_cols; ++ii) { const Col tmp(const_cast(colptr(ii)), n_rows, false, true); F(tmp); } return *this; } //! apply a lambda function to each row, where each row is interpreted as a row vector template inline Mat& Mat::each_row(const std::function< void(Row&) >& F) { arma_debug_sigprint(); podarray array1(n_cols); podarray array2(n_cols); Row tmp1( array1.memptr(), n_cols, false, true ); Row tmp2( array2.memptr(), n_cols, false, true ); eT* tmp1_mem = tmp1.memptr(); eT* tmp2_mem = tmp2.memptr(); uword ii, jj; for(ii=0, jj=1; jj < n_rows; ii+=2, jj+=2) { for(uword col_id = 0; col_id < n_cols; ++col_id) { const eT* col_mem = colptr(col_id); tmp1_mem[col_id] = col_mem[ii]; tmp2_mem[col_id] = col_mem[jj]; } F(tmp1); F(tmp2); for(uword col_id = 0; col_id < n_cols; ++col_id) { eT* col_mem = colptr(col_id); col_mem[ii] = tmp1_mem[col_id]; col_mem[jj] = tmp2_mem[col_id]; } } if(ii < n_rows) { tmp1 = (*this).row(ii); F(tmp1); (*this).row(ii) = tmp1; } return *this; } template inline const Mat& Mat::each_row(const std::function< void(const Row&) >& F) const { arma_debug_sigprint(); podarray array1(n_cols); podarray array2(n_cols); Row tmp1( array1.memptr(), n_cols, false, true ); Row tmp2( array2.memptr(), n_cols, false, true ); eT* tmp1_mem = tmp1.memptr(); eT* tmp2_mem = tmp2.memptr(); uword ii, jj; for(ii=0, jj=1; jj < n_rows; ii+=2, jj+=2) { for(uword col_id = 0; col_id < n_cols; ++col_id) { const eT* col_mem = colptr(col_id); tmp1_mem[col_id] = col_mem[ii]; tmp2_mem[col_id] = col_mem[jj]; } F(tmp1); F(tmp2); } if(ii < n_rows) { tmp1 = (*this).row(ii); F(tmp1); } return *this; } //! creation of diagview (diagonal) template arma_inline diagview Mat::diag(const sword in_id) { arma_debug_sigprint(); const uword row_offset = (in_id < 0) ? uword(-in_id) : 0; const uword col_offset = (in_id > 0) ? uword( in_id) : 0; arma_conform_check_bounds ( ((row_offset > 0) && (row_offset >= n_rows)) || ((col_offset > 0) && (col_offset >= n_cols)), "Mat::diag(): requested diagonal out of bounds" ); const uword len = (std::min)(n_rows - row_offset, n_cols - col_offset); return diagview(*this, row_offset, col_offset, len); } //! creation of diagview (diagonal) template arma_inline const diagview Mat::diag(const sword in_id) const { arma_debug_sigprint(); const uword row_offset = uword( (in_id < 0) ? -in_id : 0 ); const uword col_offset = uword( (in_id > 0) ? in_id : 0 ); arma_conform_check_bounds ( ((row_offset > 0) && (row_offset >= n_rows)) || ((col_offset > 0) && (col_offset >= n_cols)), "Mat::diag(): requested diagonal out of bounds" ); const uword len = (std::min)(n_rows - row_offset, n_cols - col_offset); return diagview(*this, row_offset, col_offset, len); } template inline void Mat::swap_rows(const uword in_row1, const uword in_row2) { arma_debug_sigprint(); const uword local_n_rows = n_rows; const uword local_n_cols = n_cols; arma_conform_check_bounds ( (in_row1 >= local_n_rows) || (in_row2 >= local_n_rows), "Mat::swap_rows(): index out of bounds" ); if(n_elem > 0) { for(uword ucol=0; ucol < local_n_cols; ++ucol) { const uword offset = ucol * local_n_rows; const uword pos1 = in_row1 + offset; const uword pos2 = in_row2 + offset; std::swap( access::rw(mem[pos1]), access::rw(mem[pos2]) ); } } } template inline void Mat::swap_cols(const uword in_colA, const uword in_colB) { arma_debug_sigprint(); const uword local_n_rows = n_rows; const uword local_n_cols = n_cols; arma_conform_check_bounds ( (in_colA >= local_n_cols) || (in_colB >= local_n_cols), "Mat::swap_cols(): index out of bounds" ); if(n_elem > 0) { eT* ptrA = colptr(in_colA); eT* ptrB = colptr(in_colB); eT tmp_i; eT tmp_j; uword iq,jq; for(iq=0, jq=1; jq < local_n_rows; iq+=2, jq+=2) { tmp_i = ptrA[iq]; tmp_j = ptrA[jq]; ptrA[iq] = ptrB[iq]; ptrA[jq] = ptrB[jq]; ptrB[iq] = tmp_i; ptrB[jq] = tmp_j; } if(iq < local_n_rows) { std::swap( ptrA[iq], ptrB[iq] ); } } } //! remove specified row template inline void Mat::shed_row(const uword row_num) { arma_debug_sigprint(); arma_conform_check_bounds( row_num >= n_rows, "Mat::shed_row(): index out of bounds" ); shed_rows(row_num, row_num); } //! remove specified column template inline void Mat::shed_col(const uword col_num) { arma_debug_sigprint(); arma_conform_check_bounds( col_num >= n_cols, "Mat::shed_col(): index out of bounds" ); shed_cols(col_num, col_num); } //! remove specified rows template inline void Mat::shed_rows(const uword in_row1, const uword in_row2) { arma_debug_sigprint(); arma_conform_check_bounds ( (in_row1 > in_row2) || (in_row2 >= n_rows), "Mat::shed_rows(): indices out of bounds or incorrectly used" ); const uword n_keep_front = in_row1; const uword n_keep_back = n_rows - (in_row2 + 1); Mat X(n_keep_front + n_keep_back, n_cols, arma_nozeros_indicator()); if(n_keep_front > 0) { X.rows( 0, (n_keep_front-1) ) = rows( 0, (in_row1-1) ); } if(n_keep_back > 0) { X.rows( n_keep_front, (n_keep_front+n_keep_back-1) ) = rows( (in_row2+1), (n_rows-1) ); } steal_mem(X); } //! remove specified columns template inline void Mat::shed_cols(const uword in_col1, const uword in_col2) { arma_debug_sigprint(); arma_conform_check_bounds ( (in_col1 > in_col2) || (in_col2 >= n_cols), "Mat::shed_cols(): indices out of bounds or incorrectly used" ); const uword n_keep_front = in_col1; const uword n_keep_back = n_cols - (in_col2 + 1); Mat X(n_rows, n_keep_front + n_keep_back, arma_nozeros_indicator()); if(n_keep_front > 0) { X.cols( 0, (n_keep_front-1) ) = cols( 0, (in_col1-1) ); } if(n_keep_back > 0) { X.cols( n_keep_front, (n_keep_front+n_keep_back-1) ) = cols( (in_col2+1), (n_cols-1) ); } steal_mem(X); } //! remove specified rows template template inline void Mat::shed_rows(const Base& indices) { arma_debug_sigprint(); const unwrap_check_mixed U(indices.get_ref(), *this); const Mat& tmp1 = U.M; arma_conform_check( ((tmp1.is_vec() == false) && (tmp1.is_empty() == false)), "Mat::shed_rows(): list of indices must be a vector" ); if(tmp1.is_empty()) { return; } const Col tmp2(const_cast(tmp1.memptr()), tmp1.n_elem, false, false); const Col& rows_to_shed = (tmp2.is_sorted("strictascend") == false) ? Col(unique(tmp2)) : Col(const_cast(tmp2.memptr()), tmp2.n_elem, false, false); const uword* rows_to_shed_mem = rows_to_shed.memptr(); const uword N = rows_to_shed.n_elem; if(arma_config::check_conform) { for(uword i=0; i= n_rows), "Mat::shed_rows(): indices out of bounds" ); } } Col tmp3(n_rows, arma_nozeros_indicator()); uword* tmp3_mem = tmp3.memptr(); uword i = 0; uword count = 0; for(uword j=0; j < n_rows; ++j) { if(i < N) { if( j != rows_to_shed_mem[i] ) { tmp3_mem[count] = j; ++count; } else { ++i; } } else { tmp3_mem[count] = j; ++count; } } const Col rows_to_keep(tmp3.memptr(), count, false, false); Mat X = (*this).rows(rows_to_keep); steal_mem(X); } //! remove specified columns template template inline void Mat::shed_cols(const Base& indices) { arma_debug_sigprint(); const unwrap_check_mixed U(indices.get_ref(), *this); const Mat& tmp1 = U.M; arma_conform_check( ((tmp1.is_vec() == false) && (tmp1.is_empty() == false)), "Mat::shed_cols(): list of indices must be a vector" ); if(tmp1.is_empty()) { return; } const Col tmp2(const_cast(tmp1.memptr()), tmp1.n_elem, false, false); const Col& cols_to_shed = (tmp2.is_sorted("strictascend") == false) ? Col(unique(tmp2)) : Col(const_cast(tmp2.memptr()), tmp2.n_elem, false, false); const uword* cols_to_shed_mem = cols_to_shed.memptr(); const uword N = cols_to_shed.n_elem; if(arma_config::check_conform) { for(uword i=0; i= n_cols), "Mat::shed_cols(): indices out of bounds" ); } } Col tmp3(n_cols, arma_nozeros_indicator()); uword* tmp3_mem = tmp3.memptr(); uword i = 0; uword count = 0; for(uword j=0; j < n_cols; ++j) { if(i < N) { if( j != cols_to_shed_mem[i] ) { tmp3_mem[count] = j; ++count; } else { ++i; } } else { tmp3_mem[count] = j; ++count; } } const Col cols_to_keep(tmp3.memptr(), count, false, false); Mat X = (*this).cols(cols_to_keep); steal_mem(X); } template inline void Mat::insert_rows(const uword row_num, const uword N, const bool set_to_zero) { arma_debug_sigprint(); arma_ignore(set_to_zero); (*this).insert_rows(row_num, N); } template inline void Mat::insert_rows(const uword row_num, const uword N) { arma_debug_sigprint(); const uword t_n_rows = n_rows; const uword t_n_cols = n_cols; const uword A_n_rows = row_num; const uword B_n_rows = t_n_rows - row_num; // insertion at row_num == n_rows is in effect an append operation arma_conform_check_bounds( (row_num > t_n_rows), "Mat::insert_rows(): index out of bounds" ); if(N == 0) { return; } Mat out(t_n_rows + N, t_n_cols, arma_nozeros_indicator()); if(A_n_rows > 0) { out.rows(0, A_n_rows-1) = rows(0, A_n_rows-1); } if(B_n_rows > 0) { out.rows(row_num + N, t_n_rows + N - 1) = rows(row_num, t_n_rows-1); } out.rows(row_num, row_num + N - 1).zeros(); steal_mem(out); } template inline void Mat::insert_cols(const uword col_num, const uword N, const bool set_to_zero) { arma_debug_sigprint(); arma_ignore(set_to_zero); (*this).insert_cols(col_num, N); } template inline void Mat::insert_cols(const uword col_num, const uword N) { arma_debug_sigprint(); const uword t_n_rows = n_rows; const uword t_n_cols = n_cols; const uword A_n_cols = col_num; const uword B_n_cols = t_n_cols - col_num; // insertion at col_num == n_cols is in effect an append operation arma_conform_check_bounds( (col_num > t_n_cols), "Mat::insert_cols(): index out of bounds" ); if(N == 0) { return; } Mat out(t_n_rows, t_n_cols + N, arma_nozeros_indicator()); if(A_n_cols > 0) { out.cols(0, A_n_cols-1) = cols(0, A_n_cols-1); } if(B_n_cols > 0) { out.cols(col_num + N, t_n_cols + N - 1) = cols(col_num, t_n_cols-1); } out.cols(col_num, col_num + N - 1).zeros(); steal_mem(out); } //! insert the given object at the specified row position; //! the given object must have the same number of columns as the matrix template template inline void Mat::insert_rows(const uword row_num, const Base& X) { arma_debug_sigprint(); const unwrap tmp(X.get_ref()); const Mat& C = tmp.M; const uword C_n_rows = C.n_rows; const uword C_n_cols = C.n_cols; const uword t_n_rows = n_rows; const uword t_n_cols = n_cols; const uword A_n_rows = row_num; const uword B_n_rows = t_n_rows - row_num; bool err_state = false; char* err_msg = nullptr; const char* error_message_1 = "Mat::insert_rows(): index out of bounds"; const char* error_message_2 = "Mat::insert_rows(): given object has an incompatible number of columns"; // insertion at row_num == n_rows is in effect an append operation arma_conform_set_error ( err_state, err_msg, (row_num > t_n_rows), error_message_1 ); arma_conform_set_error ( err_state, err_msg, ( (C_n_cols != t_n_cols) && ( (t_n_rows > 0) || (t_n_cols > 0) ) && ( (C_n_rows > 0) || (C_n_cols > 0) ) ), error_message_2 ); arma_conform_check_bounds(err_state, err_msg); if(C_n_rows > 0) { Mat out( t_n_rows + C_n_rows, (std::max)(t_n_cols, C_n_cols), arma_nozeros_indicator() ); if(t_n_cols > 0) { if(A_n_rows > 0) { out.rows(0, A_n_rows-1) = rows(0, A_n_rows-1); } if( (t_n_cols > 0) && (B_n_rows > 0) ) { out.rows(row_num + C_n_rows, t_n_rows + C_n_rows - 1) = rows(row_num, t_n_rows - 1); } } if(C_n_cols > 0) { out.rows(row_num, row_num + C_n_rows - 1) = C; } steal_mem(out); } } //! insert the given object at the specified column position; //! the given object must have the same number of rows as the matrix template template inline void Mat::insert_cols(const uword col_num, const Base& X) { arma_debug_sigprint(); const unwrap tmp(X.get_ref()); const Mat& C = tmp.M; const uword C_n_rows = C.n_rows; const uword C_n_cols = C.n_cols; const uword t_n_rows = n_rows; const uword t_n_cols = n_cols; const uword A_n_cols = col_num; const uword B_n_cols = t_n_cols - col_num; bool err_state = false; char* err_msg = nullptr; const char* error_message_1 = "Mat::insert_cols(): index out of bounds"; const char* error_message_2 = "Mat::insert_cols(): given object has an incompatible number of rows"; // insertion at col_num == n_cols is in effect an append operation arma_conform_set_error ( err_state, err_msg, (col_num > t_n_cols), error_message_1 ); arma_conform_set_error ( err_state, err_msg, ( (C_n_rows != t_n_rows) && ( (t_n_rows > 0) || (t_n_cols > 0) ) && ( (C_n_rows > 0) || (C_n_cols > 0) ) ), error_message_2 ); arma_conform_check_bounds(err_state, err_msg); if(C_n_cols > 0) { Mat out( (std::max)(t_n_rows, C_n_rows), t_n_cols + C_n_cols, arma_nozeros_indicator() ); if(t_n_rows > 0) { if(A_n_cols > 0) { out.cols(0, A_n_cols-1) = cols(0, A_n_cols-1); } if(B_n_cols > 0) { out.cols(col_num + C_n_cols, t_n_cols + C_n_cols - 1) = cols(col_num, t_n_cols - 1); } } if(C_n_rows > 0) { out.cols(col_num, col_num + C_n_cols - 1) = C; } steal_mem(out); } } template template inline Mat::Mat(const Gen& X) : n_rows(X.n_rows) , n_cols(X.n_cols) , n_elem(n_rows*n_cols) , n_alloc() , vec_state(0) , mem_state(0) , mem() { arma_debug_sigprint_this(this); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); init_cold(); X.apply(*this); } template template inline Mat& Mat::operator=(const Gen& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); init_warm(X.n_rows, X.n_cols); X.apply(*this); return *this; } template template inline Mat& Mat::operator+=(const Gen& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); X.apply_inplace_plus(*this); return *this; } template template inline Mat& Mat::operator-=(const Gen& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); X.apply_inplace_minus(*this); return *this; } template template inline Mat& Mat::operator*=(const Gen& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); const Mat tmp(X); return (*this).operator*=(tmp); } template template inline Mat& Mat::operator%=(const Gen& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); X.apply_inplace_schur(*this); return *this; } template template inline Mat& Mat::operator/=(const Gen& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); X.apply_inplace_div(*this); return *this; } //! create a matrix from Op, ie. run the previously delayed unary operations template template inline Mat::Mat(const Op& X) : n_rows(0) , n_cols(0) , n_elem(0) , n_alloc(0) , vec_state(0) , mem_state(0) , mem() { arma_debug_sigprint_this(this); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); op_type::apply(*this, X); } //! create a matrix from Op, ie. run the previously delayed unary operations template template inline Mat& Mat::operator=(const Op& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); op_type::apply(*this, X); return *this; } //! in-place matrix addition, with the right-hand-side operand having delayed operations template template inline Mat& Mat::operator+=(const Op& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); const Mat m(X); return (*this).operator+=(m); } //! in-place matrix subtraction, with the right-hand-side operand having delayed operations template template inline Mat& Mat::operator-=(const Op& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); const Mat m(X); return (*this).operator-=(m); } //! in-place matrix multiplication, with the right-hand-side operand having delayed operations template template inline Mat& Mat::operator*=(const Op& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); glue_times::apply_inplace(*this, X); return *this; } //! in-place matrix element-wise multiplication, with the right-hand-side operand having delayed operations template template inline Mat& Mat::operator%=(const Op& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); const Mat m(X); return (*this).operator%=(m); } //! in-place matrix element-wise division, with the right-hand-side operand having delayed operations template template inline Mat& Mat::operator/=(const Op& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); const Mat m(X); return (*this).operator/=(m); } //! create a matrix from eOp, ie. run the previously delayed unary operations template template inline Mat::Mat(const eOp& X) : n_rows(X.get_n_rows()) , n_cols(X.get_n_cols()) , n_elem(X.get_n_elem()) , n_alloc() , vec_state(0) , mem_state(0) , mem() { arma_debug_sigprint_this(this); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); init_cold(); if(is_same_type::value) { constexpr bool eT_non_int = is_non_integral::value; if( X.aux == eT(2) ) { eop_square::apply(*this, reinterpret_cast< const eOp& >(X)); return; } if(eT_non_int && (X.aux == eT(0.5))) { eop_sqrt::apply(*this, reinterpret_cast< const eOp& >(X)); return; } } eop_type::apply(*this, X); } //! create a matrix from eOp, ie. run the previously delayed unary operations template template inline Mat& Mat::operator=(const eOp& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); const bool bad_alias = (eOp::proxy_type::has_subview && X.P.is_alias(*this)); if(bad_alias) { Mat tmp(X); steal_mem(tmp); return *this; } init_warm(X.get_n_rows(), X.get_n_cols()); if(is_same_type::value) { constexpr bool eT_non_int = is_non_integral::value; if( X.aux == eT(2) ) { eop_square::apply(*this, reinterpret_cast< const eOp& >(X)); return *this; } if(eT_non_int && (X.aux == eT(0.5))) { eop_sqrt::apply(*this, reinterpret_cast< const eOp& >(X)); return *this; } } eop_type::apply(*this, X); return *this; } template template inline Mat& Mat::operator+=(const eOp& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); const bool bad_alias = (eOp::proxy_type::has_subview && X.P.is_alias(*this)); if(bad_alias) { const Mat tmp(X); return (*this).operator+=(tmp); } if(is_same_type::value) { constexpr bool eT_non_int = is_non_integral::value; if( X.aux == eT(2) ) { eop_square::apply_inplace_plus(*this, reinterpret_cast< const eOp& >(X)); return *this; } if(eT_non_int && (X.aux == eT(0.5))) { eop_sqrt::apply_inplace_plus(*this, reinterpret_cast< const eOp& >(X)); return *this; } } eop_type::apply_inplace_plus(*this, X); return *this; } template template inline Mat& Mat::operator-=(const eOp& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); const bool bad_alias = (eOp::proxy_type::has_subview && X.P.is_alias(*this)); if(bad_alias) { const Mat tmp(X); return (*this).operator-=(tmp); } if(is_same_type::value) { constexpr bool eT_non_int = is_non_integral::value; if( X.aux == eT(2) ) { eop_square::apply_inplace_minus(*this, reinterpret_cast< const eOp& >(X)); return *this; } if(eT_non_int && (X.aux == eT(0.5))) { eop_sqrt::apply_inplace_minus(*this, reinterpret_cast< const eOp& >(X)); return *this; } } eop_type::apply_inplace_minus(*this, X); return *this; } template template inline Mat& Mat::operator*=(const eOp& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); glue_times::apply_inplace(*this, X); return *this; } template template inline Mat& Mat::operator%=(const eOp& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); const bool bad_alias = (eOp::proxy_type::has_subview && X.P.is_alias(*this)); if(bad_alias) { const Mat tmp(X); return (*this).operator%=(tmp); } if(is_same_type::value) { constexpr bool eT_non_int = is_non_integral::value; if( X.aux == eT(2) ) { eop_square::apply_inplace_schur(*this, reinterpret_cast< const eOp& >(X)); return *this; } if(eT_non_int && (X.aux == eT(0.5))) { eop_sqrt::apply_inplace_schur(*this, reinterpret_cast< const eOp& >(X)); return *this; } } eop_type::apply_inplace_schur(*this, X); return *this; } template template inline Mat& Mat::operator/=(const eOp& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); const bool bad_alias = (eOp::proxy_type::has_subview && X.P.is_alias(*this)); if(bad_alias) { const Mat tmp(X); return (*this).operator/=(tmp); } if(is_same_type::value) { constexpr bool eT_non_int = is_non_integral::value; if( X.aux == eT(2) ) { eop_square::apply_inplace_div(*this, reinterpret_cast< const eOp& >(X)); return *this; } if(eT_non_int && (X.aux == eT(0.5))) { eop_sqrt::apply_inplace_div(*this, reinterpret_cast< const eOp& >(X)); return *this; } } eop_type::apply_inplace_div(*this, X); return *this; } template template inline Mat::Mat(const mtOp& X) : n_rows(0) , n_cols(0) , n_elem(0) , n_alloc(0) , vec_state(0) , mem_state(0) , mem() { arma_debug_sigprint_this(this); op_type::apply(*this, X); } template template inline Mat& Mat::operator=(const mtOp& X) { arma_debug_sigprint(); op_type::apply(*this, X); return *this; } template template inline Mat& Mat::operator+=(const mtOp& X) { arma_debug_sigprint(); const Mat m(X); return (*this).operator+=(m); } template template inline Mat& Mat::operator-=(const mtOp& X) { arma_debug_sigprint(); const Mat m(X); return (*this).operator-=(m); } template template inline Mat& Mat::operator*=(const mtOp& X) { arma_debug_sigprint(); const Mat m(X); return (*this).operator*=(m); } template template inline Mat& Mat::operator%=(const mtOp& X) { arma_debug_sigprint(); const Mat m(X); return (*this).operator%=(m); } template template inline Mat& Mat::operator/=(const mtOp& X) { arma_debug_sigprint(); const Mat m(X); return (*this).operator/=(m); } template template inline Mat::Mat(const CubeToMatOp& X) : n_rows(0) , n_cols(0) , n_elem(0) , n_alloc(0) , vec_state(0) , mem_state(0) , mem() { arma_debug_sigprint_this(this); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); op_type::apply(*this, X); } template template inline Mat& Mat::operator=(const CubeToMatOp& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); op_type::apply(*this, X); return *this; } template template inline Mat& Mat::operator+=(const CubeToMatOp& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); (*this) = (*this) + X; return (*this); } template template inline Mat& Mat::operator-=(const CubeToMatOp& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); (*this) = (*this) - X; return (*this); } template template inline Mat& Mat::operator*=(const CubeToMatOp& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); glue_times::apply_inplace(*this, X); return *this; } template template inline Mat& Mat::operator%=(const CubeToMatOp& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); (*this) = (*this) % X; return (*this); } template template inline Mat& Mat::operator/=(const CubeToMatOp& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); (*this) = (*this) / X; return (*this); } template template inline Mat::Mat(const SpToDOp& X) : n_rows(0) , n_cols(0) , n_elem(0) , n_alloc(0) , vec_state(0) , mem_state(0) , mem() { arma_debug_sigprint_this(this); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); op_type::apply(*this, X); } //! create a matrix from an SpToDOp, ie. run the previously delayed unary operations template template inline Mat& Mat::operator=(const SpToDOp& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); op_type::apply(*this, X); return *this; } //! in-place matrix addition, with the right-hand-side operand having delayed operations template template inline Mat& Mat::operator+=(const SpToDOp& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); const Mat m(X); return (*this).operator+=(m); } //! in-place matrix subtraction, with the right-hand-side operand having delayed operations template template inline Mat& Mat::operator-=(const SpToDOp& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); const Mat m(X); return (*this).operator-=(m); } //! in-place matrix multiplication, with the right-hand-side operand having delayed operations template template inline Mat& Mat::operator*=(const SpToDOp& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); glue_times::apply_inplace(*this, X); return *this; } //! in-place matrix element-wise multiplication, with the right-hand-side operand having delayed operations template template inline Mat& Mat::operator%=(const SpToDOp& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); const Mat m(X); return (*this).operator%=(m); } //! in-place matrix element-wise division, with the right-hand-side operand having delayed operations template template inline Mat& Mat::operator/=(const SpToDOp& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); const Mat m(X); return (*this).operator/=(m); } template template inline Mat::Mat(const mtSpReduceOp& X) : n_rows(0) , n_cols(0) , n_elem(0) , n_alloc(0) , vec_state(0) , mem_state(0) , mem() { arma_debug_sigprint_this(this); op_type::apply(*this, X); } template template inline Mat& Mat::operator=(const mtSpReduceOp& X) { arma_debug_sigprint(); op_type::apply(*this, X); return *this; } template template inline Mat& Mat::operator+=(const mtSpReduceOp& X) { arma_debug_sigprint(); const Mat m(X); return (*this).operator+=(m); } template template inline Mat& Mat::operator-=(const mtSpReduceOp& X) { arma_debug_sigprint(); const Mat m(X); return (*this).operator-=(m); } template template inline Mat& Mat::operator*=(const mtSpReduceOp& X) { arma_debug_sigprint(); glue_times::apply_inplace(*this, X); return *this; } template template inline Mat& Mat::operator%=(const mtSpReduceOp& X) { arma_debug_sigprint(); const Mat m(X); return (*this).operator%=(m); } template template inline Mat& Mat::operator/=(const mtSpReduceOp& X) { arma_debug_sigprint(); const Mat m(X); return (*this).operator/=(m); } //! create a matrix from Glue, ie. run the previously delayed binary operations template template inline Mat::Mat(const Glue& X) : n_rows(0) , n_cols(0) , n_elem(0) , n_alloc(0) , vec_state(0) , mem_state(0) , mem() { arma_debug_sigprint_this(this); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); arma_type_check(( is_same_type< eT, typename T2::elem_type >::no )); glue_type::apply(*this, X); } //! create a matrix from Glue, ie. run the previously delayed binary operations template template inline Mat& Mat::operator=(const Glue& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); arma_type_check(( is_same_type< eT, typename T2::elem_type >::no )); glue_type::apply(*this, X); return *this; } //! in-place matrix addition, with the right-hand-side operands having delayed operations template template inline Mat& Mat::operator+=(const Glue& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); arma_type_check(( is_same_type< eT, typename T2::elem_type >::no )); const Mat m(X); return (*this).operator+=(m); } //! in-place matrix subtraction, with the right-hand-side operands having delayed operations template template inline Mat& Mat::operator-=(const Glue& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); arma_type_check(( is_same_type< eT, typename T2::elem_type >::no )); const Mat m(X); return (*this).operator-=(m); } //! in-place matrix multiplications, with the right-hand-side operands having delayed operations template template inline Mat& Mat::operator*=(const Glue& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); arma_type_check(( is_same_type< eT, typename T2::elem_type >::no )); glue_times::apply_inplace(*this, X); return *this; } //! in-place matrix element-wise multiplication, with the right-hand-side operands having delayed operations template template inline Mat& Mat::operator%=(const Glue& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); arma_type_check(( is_same_type< eT, typename T2::elem_type >::no )); const Mat m(X); return (*this).operator%=(m); } //! in-place matrix element-wise division, with the right-hand-side operands having delayed operations template template inline Mat& Mat::operator/=(const Glue& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); arma_type_check(( is_same_type< eT, typename T2::elem_type >::no )); const Mat m(X); return (*this).operator/=(m); } template template inline Mat& Mat::operator+=(const Glue& X) { arma_debug_sigprint(); glue_times::apply_inplace_plus(*this, X, sword(+1)); return *this; } template template inline Mat& Mat::operator-=(const Glue& X) { arma_debug_sigprint(); glue_times::apply_inplace_plus(*this, X, sword(-1)); return *this; } //! create a matrix from eGlue, ie. run the previously delayed binary operations template template inline Mat::Mat(const eGlue& X) : n_rows(X.get_n_rows()) , n_cols(X.get_n_cols()) , n_elem(X.get_n_elem()) , n_alloc() , vec_state(0) , mem_state(0) , mem() { arma_debug_sigprint_this(this); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); arma_type_check(( is_same_type< eT, typename T2::elem_type >::no )); init_cold(); eglue_type::apply(*this, X); } //! create a matrix from eGlue, ie. run the previously delayed binary operations template template inline Mat& Mat::operator=(const eGlue& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); arma_type_check(( is_same_type< eT, typename T2::elem_type >::no )); const bool bad_alias = ( (eGlue::proxy1_type::has_subview && X.P1.is_alias(*this)) || (eGlue::proxy2_type::has_subview && X.P2.is_alias(*this)) ); if(bad_alias) { Mat tmp(X); steal_mem(tmp); return *this; } init_warm(X.get_n_rows(), X.get_n_cols()); eglue_type::apply(*this, X); return *this; } //! in-place matrix addition, with the right-hand-side operands having delayed operations template template inline Mat& Mat::operator+=(const eGlue& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); arma_type_check(( is_same_type< eT, typename T2::elem_type >::no )); const bool bad_alias = ( (eGlue::proxy1_type::has_subview && X.P1.is_alias(*this)) || (eGlue::proxy2_type::has_subview && X.P2.is_alias(*this)) ); if(bad_alias) { const Mat tmp(X); return (*this).operator+=(tmp); } eglue_type::apply_inplace_plus(*this, X); return *this; } //! in-place matrix subtraction, with the right-hand-side operands having delayed operations template template inline Mat& Mat::operator-=(const eGlue& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); arma_type_check(( is_same_type< eT, typename T2::elem_type >::no )); const bool bad_alias = ( (eGlue::proxy1_type::has_subview && X.P1.is_alias(*this)) || (eGlue::proxy2_type::has_subview && X.P2.is_alias(*this)) ); if(bad_alias) { const Mat tmp(X); return (*this).operator-=(tmp); } eglue_type::apply_inplace_minus(*this, X); return *this; } template template inline Mat& Mat::operator*=(const eGlue& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); arma_type_check(( is_same_type< eT, typename T2::elem_type >::no )); glue_times::apply_inplace(*this, X); return *this; } template template inline Mat& Mat::operator%=(const eGlue& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); arma_type_check(( is_same_type< eT, typename T2::elem_type >::no )); const bool bad_alias = ( (eGlue::proxy1_type::has_subview && X.P1.is_alias(*this)) || (eGlue::proxy2_type::has_subview && X.P2.is_alias(*this)) ); if(bad_alias) { const Mat tmp(X); return (*this).operator%=(tmp); } eglue_type::apply_inplace_schur(*this, X); return *this; } template template inline Mat& Mat::operator/=(const eGlue& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); arma_type_check(( is_same_type< eT, typename T2::elem_type >::no )); const bool bad_alias = ( (eGlue::proxy1_type::has_subview && X.P1.is_alias(*this)) || (eGlue::proxy2_type::has_subview && X.P2.is_alias(*this)) ); if(bad_alias) { const Mat tmp(X); return (*this).operator/=(tmp); } eglue_type::apply_inplace_div(*this, X); return *this; } template template inline Mat::Mat(const mtGlue& X) : n_rows(0) , n_cols(0) , n_elem(0) , n_alloc(0) , vec_state(0) , mem_state(0) , mem() { arma_debug_sigprint_this(this); glue_type::apply(*this, X); } template template inline Mat& Mat::operator=(const mtGlue& X) { arma_debug_sigprint(); glue_type::apply(*this, X); return *this; } template template inline Mat& Mat::operator+=(const mtGlue& X) { arma_debug_sigprint(); const Mat m(X); return (*this).operator+=(m); } template template inline Mat& Mat::operator-=(const mtGlue& X) { arma_debug_sigprint(); const Mat m(X); return (*this).operator-=(m); } template template inline Mat& Mat::operator*=(const mtGlue& X) { arma_debug_sigprint(); const Mat m(X); glue_times::apply_inplace(*this, m); return *this; } template template inline Mat& Mat::operator%=(const mtGlue& X) { arma_debug_sigprint(); const Mat m(X); return (*this).operator%=(m); } template template inline Mat& Mat::operator/=(const mtGlue& X) { arma_debug_sigprint(); const Mat m(X); return (*this).operator/=(m); } template template inline Mat::Mat(const SpToDGlue& X) : n_rows(0) , n_cols(0) , n_elem(0) , n_alloc(0) , vec_state(0) , mem_state(0) , mem() { arma_debug_sigprint_this(this); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); arma_type_check(( is_same_type< eT, typename T2::elem_type >::no )); glue_type::apply(*this, X); } template template inline Mat& Mat::operator=(const SpToDGlue& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); arma_type_check(( is_same_type< eT, typename T2::elem_type >::no )); glue_type::apply(*this, X); return *this; } template template inline Mat& Mat::operator+=(const SpToDGlue& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); arma_type_check(( is_same_type< eT, typename T2::elem_type >::no )); const Mat m(X); return (*this).operator+=(m); } template template inline Mat& Mat::operator-=(const SpToDGlue& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); arma_type_check(( is_same_type< eT, typename T2::elem_type >::no )); const Mat m(X); return (*this).operator-=(m); } template template inline Mat& Mat::operator*=(const SpToDGlue& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); arma_type_check(( is_same_type< eT, typename T2::elem_type >::no )); glue_times::apply_inplace(*this, X); return *this; } template template inline Mat& Mat::operator%=(const SpToDGlue& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); arma_type_check(( is_same_type< eT, typename T2::elem_type >::no )); const Mat m(X); return (*this).operator%=(m); } template template inline Mat& Mat::operator/=(const SpToDGlue& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); arma_type_check(( is_same_type< eT, typename T2::elem_type >::no )); const Mat m(X); return (*this).operator/=(m); } //! linear element accessor (treats the matrix as a vector); no bounds check; assumes memory is aligned template arma_inline const eT& Mat::at_alt(const uword ii) const { const eT* mem_aligned = mem; memory::mark_as_aligned(mem_aligned); return mem_aligned[ii]; } //! linear element accessor (treats the matrix as a vector); bounds checking not done when ARMA_DONT_CHECK_CONFORMANCE is defined template arma_inline eT& Mat::operator() (const uword ii) { arma_conform_check_bounds( (ii >= n_elem), "Mat::operator(): index out of bounds" ); return access::rw(mem[ii]); } //! linear element accessor (treats the matrix as a vector); bounds checking not done when ARMA_DONT_CHECK_CONFORMANCE is defined template arma_inline const eT& Mat::operator() (const uword ii) const { arma_conform_check_bounds( (ii >= n_elem), "Mat::operator(): index out of bounds" ); return mem[ii]; } //! linear element accessor (treats the matrix as a vector); no bounds check. template arma_inline eT& Mat::operator[] (const uword ii) { return access::rw(mem[ii]); } //! linear element accessor (treats the matrix as a vector); no bounds check template arma_inline const eT& Mat::operator[] (const uword ii) const { return mem[ii]; } //! linear element accessor (treats the matrix as a vector); no bounds check. template arma_inline eT& Mat::at(const uword ii) { return access::rw(mem[ii]); } //! linear element accessor (treats the matrix as a vector); no bounds check template arma_inline const eT& Mat::at(const uword ii) const { return mem[ii]; } //! element accessor; bounds checking not done when ARMA_DONT_CHECK_CONFORMANCE is defined template arma_inline eT& Mat::operator() (const uword in_row, const uword in_col) { arma_conform_check_bounds( ((in_row >= n_rows) || (in_col >= n_cols)), "Mat::operator(): index out of bounds" ); return access::rw(mem[in_row + in_col*n_rows]); } //! element accessor; bounds checking not done when ARMA_DONT_CHECK_CONFORMANCE is defined template arma_inline const eT& Mat::operator() (const uword in_row, const uword in_col) const { arma_conform_check_bounds( ((in_row >= n_rows) || (in_col >= n_cols)), "Mat::operator(): index out of bounds" ); return mem[in_row + in_col*n_rows]; } //! element accessor; no bounds check template arma_inline eT& Mat::at(const uword in_row, const uword in_col) { return access::rw( mem[in_row + in_col*n_rows] ); } //! element accessor; no bounds check template arma_inline const eT& Mat::at(const uword in_row, const uword in_col) const { return mem[in_row + in_col*n_rows]; } #if defined(__cpp_multidimensional_subscript) //! element accessor; no bounds check template arma_inline eT& Mat::operator[] (const uword in_row, const uword in_col) { return access::rw( mem[in_row + in_col*n_rows] ); } //! element accessor; no bounds check template arma_inline const eT& Mat::operator[] (const uword in_row, const uword in_col) const { return mem[in_row + in_col*n_rows]; } #endif //! prefix ++ template arma_inline const Mat& Mat::operator++() { Mat_aux::prefix_pp(*this); return *this; } //! postfix ++ (must not return the object by reference) template arma_inline void Mat::operator++(int) { Mat_aux::postfix_pp(*this); } //! prefix -- template arma_inline const Mat& Mat::operator--() { Mat_aux::prefix_mm(*this); return *this; } //! postfix -- (must not return the object by reference) template arma_inline void Mat::operator--(int) { Mat_aux::postfix_mm(*this); } //! returns true if the matrix has no elements template arma_inline bool Mat::is_empty() const { return (n_elem == 0); } //! returns true if the object can be interpreted as a column or row vector template arma_inline bool Mat::is_vec() const { return ( (n_rows == 1) || (n_cols == 1) ); } //! returns true if the object can be interpreted as a row vector template arma_inline bool Mat::is_rowvec() const { return (n_rows == 1); } //! returns true if the object can be interpreted as a column vector template arma_inline bool Mat::is_colvec() const { return (n_cols == 1); } //! returns true if the object has the same number of non-zero rows and columns template arma_inline bool Mat::is_square() const { return (n_rows == n_cols); } template inline bool Mat::internal_is_finite() const { arma_debug_sigprint(); return arrayops::is_finite(memptr(), n_elem); } template inline bool Mat::internal_has_inf() const { arma_debug_sigprint(); return arrayops::has_inf(memptr(), n_elem); } template inline bool Mat::internal_has_nan() const { arma_debug_sigprint(); return arrayops::has_nan(memptr(), n_elem); } template inline bool Mat::internal_has_nonfinite() const { arma_debug_sigprint(); return (arrayops::is_finite(memptr(), n_elem) == false); } template inline bool Mat::is_sorted(const char* direction) const { arma_debug_sigprint(); return (*this).is_sorted(direction, (((vec_state == 2) || (n_rows == 1)) ? uword(1) : uword(0))); } template inline bool Mat::is_sorted(const char* direction, const uword dim) const { arma_debug_sigprint(); const char sig1 = (direction != nullptr) ? direction[0] : char(0); // direction is one of: // "ascend" // "descend" // "strictascend" // "strictdescend" arma_conform_check( ((sig1 != 'a') && (sig1 != 'd') && (sig1 != 's')), "Mat::is_sorted(): unknown sort direction" ); // "strictascend" // "strictdescend" // 0123456 const char sig2 = (sig1 == 's') ? direction[6] : char(0); if(sig1 == 's') { arma_conform_check( ((sig2 != 'a') && (sig2 != 'd')), "Mat::is_sorted(): unknown sort direction" ); } arma_conform_check( (dim > 1), "Mat::is_sorted(): parameter 'dim' must be 0 or 1" ); if(sig1 == 'a') { // case: ascend // deliberately using the opposite direction comparator, // as we need to handle the case of two elements being equal arma_gt_comparator comparator; return (*this).is_sorted_helper(comparator, dim); } else if(sig1 == 'd') { // case: descend // deliberately using the opposite direction comparator, // as we need to handle the case of two elements being equal arma_lt_comparator comparator; return (*this).is_sorted_helper(comparator, dim); } else if((sig1 == 's') && (sig2 == 'a')) { // case: strict ascend arma_geq_comparator comparator; return (*this).is_sorted_helper(comparator, dim); } else if((sig1 == 's') && (sig2 == 'd')) { // case: strict descend arma_leq_comparator comparator; return (*this).is_sorted_helper(comparator, dim); } return true; } template template inline bool Mat::is_sorted_helper(const comparator& comp, const uword dim) const { arma_debug_sigprint(); if(n_elem <= 1) { return true; } const uword local_n_cols = n_cols; const uword local_n_rows = n_rows; if(dim == 0) { if(local_n_rows <= 1u) { return true; } const uword local_n_rows_m1 = local_n_rows - 1; for(uword c=0; c < local_n_cols; ++c) { const eT* coldata = colptr(c); for(uword r=0; r < local_n_rows_m1; ++r) { const eT val1 = (*coldata); coldata++; const eT val2 = (*coldata); if(comp(val1,val2)) { return false; } } } } else if(dim == 1) { if(local_n_cols <= 1u) { return true; } const uword local_n_cols_m1 = local_n_cols - 1; if(local_n_rows == 1) { const eT* rowdata = memptr(); for(uword c=0; c < local_n_cols_m1; ++c) { const eT val1 = (*rowdata); rowdata++; const eT val2 = (*rowdata); if(comp(val1,val2)) { return false; } } } else { for(uword r=0; r < local_n_rows; ++r) for(uword c=0; c < local_n_cols_m1; ++c) { const eT val1 = at(r,c ); const eT val2 = at(r,c+1); if(comp(val1,val2)) { return false; } } } } return true; } //! returns true if the given index is currently in range template arma_inline bool Mat::in_range(const uword ii) const { return (ii < n_elem); } //! returns true if the given start and end indices are currently in range template arma_inline bool Mat::in_range(const span& x) const { arma_debug_sigprint(); if(x.whole) { return true; } else { const uword a = x.a; const uword b = x.b; return ( (a <= b) && (b < n_elem) ); } } //! returns true if the given location is currently in range template arma_inline bool Mat::in_range(const uword in_row, const uword in_col) const { return ( (in_row < n_rows) && (in_col < n_cols) ); } template arma_inline bool Mat::in_range(const span& row_span, const uword in_col) const { arma_debug_sigprint(); if(row_span.whole) { return (in_col < n_cols); } else { const uword in_row1 = row_span.a; const uword in_row2 = row_span.b; return ( (in_row1 <= in_row2) && (in_row2 < n_rows) && (in_col < n_cols) ); } } template arma_inline bool Mat::in_range(const uword in_row, const span& col_span) const { arma_debug_sigprint(); if(col_span.whole) { return (in_row < n_rows); } else { const uword in_col1 = col_span.a; const uword in_col2 = col_span.b; return ( (in_row < n_rows) && (in_col1 <= in_col2) && (in_col2 < n_cols) ); } } template arma_inline bool Mat::in_range(const span& row_span, const span& col_span) const { arma_debug_sigprint(); const uword in_row1 = row_span.a; const uword in_row2 = row_span.b; const uword in_col1 = col_span.a; const uword in_col2 = col_span.b; const bool rows_ok = row_span.whole ? true : ( (in_row1 <= in_row2) && (in_row2 < n_rows) ); const bool cols_ok = col_span.whole ? true : ( (in_col1 <= in_col2) && (in_col2 < n_cols) ); return ( rows_ok && cols_ok ); } template arma_inline bool Mat::in_range(const uword in_row, const uword in_col, const SizeMat& s) const { const uword l_n_rows = n_rows; const uword l_n_cols = n_cols; if( (in_row >= l_n_rows) || (in_col >= l_n_cols) || ((in_row + s.n_rows) > l_n_rows) || ((in_col + s.n_cols) > l_n_cols) ) { return false; } else { return true; } } //! returns a pointer to array of eTs for a specified column; no bounds check template arma_inline eT* Mat::colptr(const uword in_col) { return & access::rw(mem[in_col*n_rows]); } //! returns a pointer to array of eTs for a specified column; no bounds check template arma_inline const eT* Mat::colptr(const uword in_col) const { return & mem[in_col*n_rows]; } //! returns a pointer to array of eTs used by the matrix template arma_inline eT* Mat::memptr() { return const_cast(mem); } //! returns a pointer to array of eTs used by the matrix template arma_inline const eT* Mat::memptr() const { return mem; } //! change the matrix to have user specified dimensions (data is not preserved) template inline Mat& Mat::set_size(const uword new_n_elem) { arma_debug_sigprint(); const uword new_n_rows = (vec_state == 2) ? uword(1 ) : uword(new_n_elem); const uword new_n_cols = (vec_state == 2) ? uword(new_n_elem) : uword(1 ); init_warm(new_n_rows, new_n_cols); return *this; } //! change the matrix to have user specified dimensions (data is not preserved) template inline Mat& Mat::set_size(const uword new_n_rows, const uword new_n_cols) { arma_debug_sigprint(); init_warm(new_n_rows, new_n_cols); return *this; } template inline Mat& Mat::set_size(const SizeMat& s) { arma_debug_sigprint(); init_warm(s.n_rows, s.n_cols); return *this; } //! change the matrix to have user specified dimensions (data is preserved) template inline Mat& Mat::resize(const uword new_n_elem) { arma_debug_sigprint(); const uword new_n_rows = (vec_state == 2) ? uword(1 ) : uword(new_n_elem); const uword new_n_cols = (vec_state == 2) ? uword(new_n_elem) : uword(1 ); return (*this).resize(new_n_rows, new_n_cols); } //! change the matrix to have user specified dimensions (data is preserved) template inline Mat& Mat::resize(const uword new_n_rows, const uword new_n_cols) { arma_debug_sigprint(); op_resize::apply_mat_inplace((*this), new_n_rows, new_n_cols); return *this; } template inline Mat& Mat::resize(const SizeMat& s) { arma_debug_sigprint(); op_resize::apply_mat_inplace((*this), s.n_rows, s.n_cols); return *this; } //! change the matrix to have user specified dimensions (data is preserved) template inline Mat& Mat::reshape(const uword new_n_rows, const uword new_n_cols) { arma_debug_sigprint(); op_reshape::apply_mat_inplace((*this), new_n_rows, new_n_cols); return *this; } template inline Mat& Mat::reshape(const SizeMat& s) { arma_debug_sigprint(); op_reshape::apply_mat_inplace((*this), s.n_rows, s.n_cols); return *this; } //! NOTE: don't use this form; it's deprecated and will be removed template inline void Mat::reshape(const uword new_n_rows, const uword new_n_cols, const uword dim) { arma_debug_sigprint(); arma_conform_check( (dim > 1), "reshape(): parameter 'dim' must be 0 or 1" ); if(dim == 0) { op_reshape::apply_mat_inplace((*this), new_n_rows, new_n_cols); } else if(dim == 1) { Mat tmp; op_strans::apply_mat_noalias(tmp, (*this)); op_reshape::apply_mat_noalias((*this), tmp, new_n_rows, new_n_cols); } } //! change the matrix (without preserving data) to have the same dimensions as the given expression template template inline Mat& Mat::copy_size(const Base& X) { arma_debug_sigprint(); const Proxy P(X.get_ref()); const uword X_n_rows = P.get_n_rows(); const uword X_n_cols = P.get_n_cols(); init_warm(X_n_rows, X_n_cols); return *this; } //! apply a functor to each element template template inline Mat& Mat::for_each(functor F) { arma_debug_sigprint(); eT* data = memptr(); const uword N = n_elem; uword ii, jj; for(ii=0, jj=1; jj < N; ii+=2, jj+=2) { F(data[ii]); F(data[jj]); } if(ii < N) { F(data[ii]); } return *this; } template template inline const Mat& Mat::for_each(functor F) const { arma_debug_sigprint(); const eT* data = memptr(); const uword N = n_elem; uword ii, jj; for(ii=0, jj=1; jj < N; ii+=2, jj+=2) { F(data[ii]); F(data[jj]); } if(ii < N) { F(data[ii]); } return *this; } //! transform each element in the matrix using a functor template template inline Mat& Mat::transform(functor F) { arma_debug_sigprint(); eT* out_mem = memptr(); const uword N = n_elem; uword ii, jj; for(ii=0, jj=1; jj < N; ii+=2, jj+=2) { eT tmp_ii = out_mem[ii]; eT tmp_jj = out_mem[jj]; tmp_ii = eT( F(tmp_ii) ); tmp_jj = eT( F(tmp_jj) ); out_mem[ii] = tmp_ii; out_mem[jj] = tmp_jj; } if(ii < N) { out_mem[ii] = eT( F(out_mem[ii]) ); } return *this; } //! imbue (fill) the matrix with values provided by a functor template template inline Mat& Mat::imbue(functor F) { arma_debug_sigprint(); eT* out_mem = memptr(); const uword N = n_elem; uword ii, jj; for(ii=0, jj=1; jj < N; ii+=2, jj+=2) { const eT tmp_ii = eT( F() ); const eT tmp_jj = eT( F() ); out_mem[ii] = tmp_ii; out_mem[jj] = tmp_jj; } if(ii < N) { out_mem[ii] = eT( F() ); } return *this; } template inline Mat& Mat::replace(const eT old_val, const eT new_val) { arma_debug_sigprint(); arrayops::replace(memptr(), n_elem, old_val, new_val); return *this; } template inline Mat& Mat::clean(const typename get_pod_type::result threshold) { arma_debug_sigprint(); arrayops::clean(memptr(), n_elem, threshold); return *this; } template inline Mat& Mat::clamp(const eT min_val, const eT max_val) { arma_debug_sigprint(); if(is_cx::no) { arma_conform_check( (access::tmp_real(min_val) > access::tmp_real(max_val)), "Mat::clamp(): min_val must be less than max_val" ); } else { arma_conform_check( (access::tmp_real(min_val) > access::tmp_real(max_val)), "Mat::clamp(): real(min_val) must be less than real(max_val)" ); arma_conform_check( (access::tmp_imag(min_val) > access::tmp_imag(max_val)), "Mat::clamp(): imag(min_val) must be less than imag(max_val)" ); } arrayops::clamp(memptr(), n_elem, min_val, max_val); return *this; } //! fill the matrix with the specified value template inline Mat& Mat::fill(const eT val) { arma_debug_sigprint(); arrayops::inplace_set( memptr(), val, n_elem ); return *this; } //! fill the matrix with the specified pattern template template inline Mat& Mat::fill(const fill::fill_class&) { arma_debug_sigprint(); if(is_same_type::yes) { (*this).zeros(); } if(is_same_type::yes) { (*this).ones(); } if(is_same_type::yes) { (*this).eye(); } if(is_same_type::yes) { (*this).randu(); } if(is_same_type::yes) { (*this).randn(); } return *this; } template inline Mat& Mat::zeros() { arma_debug_sigprint(); arrayops::fill_zeros(memptr(), n_elem); return *this; } template inline Mat& Mat::zeros(const uword new_n_elem) { arma_debug_sigprint(); set_size(new_n_elem); return (*this).zeros(); } template inline Mat& Mat::zeros(const uword new_n_rows, const uword new_n_cols) { arma_debug_sigprint(); set_size(new_n_rows, new_n_cols); return (*this).zeros(); } template inline Mat& Mat::zeros(const SizeMat& s) { arma_debug_sigprint(); return (*this).zeros(s.n_rows, s.n_cols); } template inline Mat& Mat::ones() { arma_debug_sigprint(); return fill(eT(1)); } template inline Mat& Mat::ones(const uword new_n_elem) { arma_debug_sigprint(); set_size(new_n_elem); return fill(eT(1)); } template inline Mat& Mat::ones(const uword new_n_rows, const uword new_n_cols) { arma_debug_sigprint(); set_size(new_n_rows, new_n_cols); return fill(eT(1)); } template inline Mat& Mat::ones(const SizeMat& s) { arma_debug_sigprint(); return (*this).ones(s.n_rows, s.n_cols); } template inline Mat& Mat::randu() { arma_debug_sigprint(); arma_rng::randu::fill( memptr(), n_elem ); return *this; } template inline Mat& Mat::randu(const uword new_n_elem) { arma_debug_sigprint(); set_size(new_n_elem); return (*this).randu(); } template inline Mat& Mat::randu(const uword new_n_rows, const uword new_n_cols) { arma_debug_sigprint(); set_size(new_n_rows, new_n_cols); return (*this).randu(); } template inline Mat& Mat::randu(const SizeMat& s) { arma_debug_sigprint(); return (*this).randu(s.n_rows, s.n_cols); } template inline Mat& Mat::randn() { arma_debug_sigprint(); arma_rng::randn::fill( memptr(), n_elem ); return *this; } template inline Mat& Mat::randn(const uword new_n_elem) { arma_debug_sigprint(); set_size(new_n_elem); return (*this).randn(); } template inline Mat& Mat::randn(const uword new_n_rows, const uword new_n_cols) { arma_debug_sigprint(); set_size(new_n_rows, new_n_cols); return (*this).randn(); } template inline Mat& Mat::randn(const SizeMat& s) { arma_debug_sigprint(); return (*this).randn(s.n_rows, s.n_cols); } template inline Mat& Mat::eye() { arma_debug_sigprint(); (*this).zeros(); const uword N = (std::min)(n_rows, n_cols); for(uword ii=0; ii inline Mat& Mat::eye(const uword new_n_rows, const uword new_n_cols) { arma_debug_sigprint(); set_size(new_n_rows, new_n_cols); return (*this).eye(); } template inline Mat& Mat::eye(const SizeMat& s) { arma_debug_sigprint(); return (*this).eye(s.n_rows, s.n_cols); } template inline void Mat::reset() { arma_debug_sigprint(); const uword new_n_rows = (vec_state == 2) ? 1 : 0; const uword new_n_cols = (vec_state == 1) ? 1 : 0; init_warm(new_n_rows, new_n_cols); } template inline void Mat::soft_reset() { arma_debug_sigprint(); // don't change the size if the matrix has a fixed size or is a cube slice if(mem_state <= 1) { reset(); } else { zeros(); } } template template inline void Mat::set_real(const Base::pod_type,T1>& X) { arma_debug_sigprint(); Mat_aux::set_real(*this, X); } template template inline void Mat::set_imag(const Base::pod_type,T1>& X) { arma_debug_sigprint(); Mat_aux::set_imag(*this, X); } template inline eT Mat::min() const { arma_debug_sigprint(); if(n_elem == 0) { arma_conform_check(true, "Mat::min(): object has no elements"); return Datum::nan; } return op_min::direct_min(memptr(), n_elem); } template inline eT Mat::max() const { arma_debug_sigprint(); if(n_elem == 0) { arma_conform_check(true, "Mat::max(): object has no elements"); return Datum::nan; } return op_max::direct_max(memptr(), n_elem); } template inline eT Mat::min(uword& index_of_min_val) const { arma_debug_sigprint(); if(n_elem == 0) { arma_conform_check(true, "Mat::min(): object has no elements"); index_of_min_val = uword(0); return Datum::nan; } return op_min::direct_min(memptr(), n_elem, index_of_min_val); } template inline eT Mat::max(uword& index_of_max_val) const { arma_debug_sigprint(); if(n_elem == 0) { arma_conform_check(true, "Mat::max(): object has no elements"); index_of_max_val = uword(0); return Datum::nan; } return op_max::direct_max(memptr(), n_elem, index_of_max_val); } template inline eT Mat::min(uword& row_of_min_val, uword& col_of_min_val) const { arma_debug_sigprint(); if(n_elem == 0) { arma_conform_check(true, "Mat::min(): object has no elements"); row_of_min_val = uword(0); col_of_min_val = uword(0); return Datum::nan; } uword iq; eT val = op_min::direct_min(memptr(), n_elem, iq); row_of_min_val = iq % n_rows; col_of_min_val = iq / n_rows; return val; } template inline eT Mat::max(uword& row_of_max_val, uword& col_of_max_val) const { arma_debug_sigprint(); if(n_elem == 0) { arma_conform_check(true, "Mat::max(): object has no elements"); row_of_max_val = uword(0); col_of_max_val = uword(0); return Datum::nan; } uword iq; eT val = op_max::direct_max(memptr(), n_elem, iq); row_of_max_val = iq % n_rows; col_of_max_val = iq / n_rows; return val; } //! save the matrix to a file template inline bool Mat::save(const std::string name, const file_type type) const { arma_debug_sigprint(); bool save_okay = false; switch(type) { case raw_ascii: save_okay = diskio::save_raw_ascii(*this, name); break; case arma_ascii: save_okay = diskio::save_arma_ascii(*this, name); break; case csv_ascii: return (*this).save(csv_name(name), type); break; case ssv_ascii: return (*this).save(csv_name(name), type); break; case coord_ascii: save_okay = diskio::save_coord_ascii(*this, name); break; case raw_binary: save_okay = diskio::save_raw_binary(*this, name); break; case arma_binary: save_okay = diskio::save_arma_binary(*this, name); break; case pgm_binary: save_okay = diskio::save_pgm_binary(*this, name); break; case hdf5_binary: return (*this).save(hdf5_name(name)); break; case hdf5_binary_trans: // kept for compatibility with earlier versions of Armadillo return (*this).save(hdf5_name(name, std::string(), hdf5_opts::trans)); break; default: arma_warn(1, "Mat::save(): unsupported file type"); save_okay = false; } if(save_okay == false) { arma_warn(3, "Mat::save(): write failed; file: ", name); } return save_okay; } template inline bool Mat::save(const hdf5_name& spec, const file_type type) const { arma_debug_sigprint(); // handling of hdf5_binary_trans kept for compatibility with earlier versions of Armadillo if( (type != hdf5_binary) && (type != hdf5_binary_trans) ) { arma_stop_runtime_error("Mat::save(): unsupported file type for hdf5_name()"); return false; } const bool do_trans = bool(spec.opts.flags & hdf5_opts::flag_trans ) || (type == hdf5_binary_trans); const bool append = bool(spec.opts.flags & hdf5_opts::flag_append ); const bool replace = bool(spec.opts.flags & hdf5_opts::flag_replace); if(append && replace) { arma_stop_runtime_error("Mat::save(): only one of 'append' or 'replace' options can be used"); return false; } bool save_okay = false; std::string err_msg; if(do_trans) { Mat tmp; op_strans::apply_mat_noalias(tmp, *this); save_okay = diskio::save_hdf5_binary(tmp, spec, err_msg); } else { save_okay = diskio::save_hdf5_binary(*this, spec, err_msg); } if(save_okay == false) { if(err_msg.length() > 0) { arma_warn(3, "Mat::save(): ", err_msg, "; file: ", spec.filename); } else { arma_warn(3, "Mat::save(): write failed; file: ", spec.filename); } } return save_okay; } template inline bool Mat::save(const csv_name& spec, const file_type type) const { arma_debug_sigprint(); if( (type != csv_ascii) && (type != ssv_ascii) ) { arma_stop_runtime_error("Mat::save(): unsupported file type for csv_name()"); return false; } const bool do_trans = bool(spec.opts.flags & csv_opts::flag_trans ); const bool no_header = bool(spec.opts.flags & csv_opts::flag_no_header ); const bool with_header = bool(spec.opts.flags & csv_opts::flag_with_header) && (no_header == false); const bool use_semicolon = bool(spec.opts.flags & csv_opts::flag_semicolon ) || (type == ssv_ascii); arma_debug_print("Mat::save(csv_name): enabled flags:"); if(do_trans ) { arma_debug_print("trans"); } if(no_header ) { arma_debug_print("no_header"); } if(with_header ) { arma_debug_print("with_header"); } if(use_semicolon) { arma_debug_print("semicolon"); } const char separator = (use_semicolon) ? char(';') : char(','); if(with_header) { if( (spec.header_ro.n_cols != 1) && (spec.header_ro.n_rows != 1) ) { arma_warn(1, "Mat::save(): given header must have a vector layout"); return false; } for(uword i=0; i < spec.header_ro.n_elem; ++i) { const std::string& token = spec.header_ro.at(i); if(token.find(separator) != std::string::npos) { arma_warn(1, "Mat::save(): token within the header contains the separator character: '", token, "'"); return false; } } const uword save_n_cols = (do_trans) ? (*this).n_rows : (*this).n_cols; if(spec.header_ro.n_elem != save_n_cols) { arma_warn(1, "Mat::save(): size mismatch between header and matrix"); return false; } } bool save_okay = false; if(do_trans) { const Mat tmp = (*this).st(); save_okay = diskio::save_csv_ascii(tmp, spec.filename, spec.header_ro, with_header, separator); } else { save_okay = diskio::save_csv_ascii(*this, spec.filename, spec.header_ro, with_header, separator); } if(save_okay == false) { arma_warn(3, "Mat::save(): write failed; file: ", spec.filename); } return save_okay; } //! save the matrix to a stream template inline bool Mat::save(std::ostream& os, const file_type type) const { arma_debug_sigprint(); bool save_okay = false; switch(type) { case raw_ascii: save_okay = diskio::save_raw_ascii(*this, os); break; case arma_ascii: save_okay = diskio::save_arma_ascii(*this, os); break; case csv_ascii: save_okay = diskio::save_csv_ascii(*this, os, char(',')); break; case ssv_ascii: save_okay = diskio::save_csv_ascii(*this, os, char(';')); break; case coord_ascii: save_okay = diskio::save_coord_ascii(*this, os); break; case raw_binary: save_okay = diskio::save_raw_binary(*this, os); break; case arma_binary: save_okay = diskio::save_arma_binary(*this, os); break; case pgm_binary: save_okay = diskio::save_pgm_binary(*this, os); break; default: arma_warn(1, "Mat::save(): unsupported file type"); save_okay = false; } if(save_okay == false) { arma_warn(3, "Mat::save(): stream write failed"); } return save_okay; } //! load a matrix from a file template inline bool Mat::load(const std::string name, const file_type type) { arma_debug_sigprint(); bool load_okay = false; std::string err_msg; switch(type) { case auto_detect: load_okay = diskio::load_auto_detect(*this, name, err_msg); break; case raw_ascii: load_okay = diskio::load_raw_ascii(*this, name, err_msg); break; case arma_ascii: load_okay = diskio::load_arma_ascii(*this, name, err_msg); break; case csv_ascii: return (*this).load(csv_name(name), type); break; case ssv_ascii: return (*this).load(csv_name(name), type); break; case coord_ascii: load_okay = diskio::load_coord_ascii(*this, name, err_msg); break; case raw_binary: load_okay = diskio::load_raw_binary(*this, name, err_msg); break; case arma_binary: load_okay = diskio::load_arma_binary(*this, name, err_msg); break; case pgm_binary: load_okay = diskio::load_pgm_binary(*this, name, err_msg); break; case hdf5_binary: return (*this).load(hdf5_name(name)); break; case hdf5_binary_trans: // kept for compatibility with earlier versions of Armadillo return (*this).load(hdf5_name(name, std::string(), hdf5_opts::trans)); break; default: arma_warn(1, "Mat::load(): unsupported file type"); load_okay = false; } if(load_okay == false) { if(err_msg.length() > 0) { arma_warn(3, "Mat::load(): ", err_msg, "; file: ", name); } else { arma_warn(3, "Mat::load(): read failed; file: ", name); } } if(load_okay == false) { (*this).soft_reset(); } return load_okay; } template inline bool Mat::load(const hdf5_name& spec, const file_type type) { arma_debug_sigprint(); if( (type != hdf5_binary) && (type != hdf5_binary_trans) ) { arma_stop_runtime_error("Mat::load(): unsupported file type for hdf5_name()"); return false; } bool load_okay = false; std::string err_msg; const bool do_trans = bool(spec.opts.flags & hdf5_opts::flag_trans) || (type == hdf5_binary_trans); if(do_trans) { Mat tmp; load_okay = diskio::load_hdf5_binary(tmp, spec, err_msg); if(load_okay) { op_strans::apply_mat_noalias(*this, tmp); } } else { load_okay = diskio::load_hdf5_binary(*this, spec, err_msg); } if(load_okay == false) { if(err_msg.length() > 0) { arma_warn(3, "Mat::load(): ", err_msg, "; file: ", spec.filename); } else { arma_warn(3, "Mat::load(): read failed; file: ", spec.filename); } } if(load_okay == false) { (*this).soft_reset(); } return load_okay; } template inline bool Mat::load(const csv_name& spec, const file_type type) { arma_debug_sigprint(); if( (type != csv_ascii) && (type != ssv_ascii) ) { arma_stop_runtime_error("Mat::load(): unsupported file type for csv_name()"); return false; } const bool do_trans = bool(spec.opts.flags & csv_opts::flag_trans ); const bool no_header = bool(spec.opts.flags & csv_opts::flag_no_header ); const bool with_header = bool(spec.opts.flags & csv_opts::flag_with_header) && (no_header == false); const bool use_semicolon = bool(spec.opts.flags & csv_opts::flag_semicolon ) || (type == ssv_ascii); const bool strict = bool(spec.opts.flags & csv_opts::flag_strict ); arma_debug_print("Mat::load(csv_name): enabled flags:"); if(do_trans ) { arma_debug_print("trans"); } if(no_header ) { arma_debug_print("no_header"); } if(with_header ) { arma_debug_print("with_header"); } if(use_semicolon) { arma_debug_print("semicolon"); } if(strict ) { arma_debug_print("strict"); } const char separator = (use_semicolon) ? char(';') : char(','); bool load_okay = false; std::string err_msg; if(do_trans) { Mat tmp_mat; load_okay = diskio::load_csv_ascii(tmp_mat, spec.filename, err_msg, spec.header_rw, with_header, separator, strict); if(load_okay) { (*this) = tmp_mat.st(); if(with_header) { // field::set_size() preserves data if the number of elements hasn't changed spec.header_rw.set_size(spec.header_rw.n_elem, 1); } } } else { load_okay = diskio::load_csv_ascii(*this, spec.filename, err_msg, spec.header_rw, with_header, separator, strict); } if(load_okay == false) { if(err_msg.length() > 0) { arma_warn(3, "Mat::load(): ", err_msg, "; file: ", spec.filename); } else { arma_warn(3, "Mat::load(): read failed; file: ", spec.filename); } } else { const uword load_n_cols = (do_trans) ? (*this).n_rows : (*this).n_cols; if(with_header && (spec.header_rw.n_elem != load_n_cols)) { arma_warn(3, "Mat::load(): size mismatch between header and matrix"); } } if(load_okay == false) { (*this).soft_reset(); if(with_header) { spec.header_rw.reset(); } } return load_okay; } //! load a matrix from a stream template inline bool Mat::load(std::istream& is, const file_type type) { arma_debug_sigprint(); bool load_okay = false; std::string err_msg; switch(type) { case auto_detect: load_okay = diskio::load_auto_detect(*this, is, err_msg); break; case raw_ascii: load_okay = diskio::load_raw_ascii(*this, is, err_msg); break; case arma_ascii: load_okay = diskio::load_arma_ascii(*this, is, err_msg); break; case csv_ascii: load_okay = diskio::load_csv_ascii(*this, is, err_msg, char(','), false); break; case ssv_ascii: load_okay = diskio::load_csv_ascii(*this, is, err_msg, char(';'), false); break; case coord_ascii: load_okay = diskio::load_coord_ascii(*this, is, err_msg); break; case raw_binary: load_okay = diskio::load_raw_binary(*this, is, err_msg); break; case arma_binary: load_okay = diskio::load_arma_binary(*this, is, err_msg); break; case pgm_binary: load_okay = diskio::load_pgm_binary(*this, is, err_msg); break; default: arma_warn(1, "Mat::load(): unsupported file type"); load_okay = false; } if(load_okay == false) { if(err_msg.length() > 0) { arma_warn(3, "Mat::load(): ", err_msg); } else { arma_warn(3, "Mat::load(): stream read failed"); } } if(load_okay == false) { (*this).soft_reset(); } return load_okay; } template inline bool Mat::quiet_save(const std::string name, const file_type type) const { arma_debug_sigprint(); return (*this).save(name, type); } template inline bool Mat::quiet_save(const hdf5_name& spec, const file_type type) const { arma_debug_sigprint(); return (*this).save(spec, type); } template inline bool Mat::quiet_save(const csv_name& spec, const file_type type) const { arma_debug_sigprint(); return (*this).save(spec, type); } template inline bool Mat::quiet_save(std::ostream& os, const file_type type) const { arma_debug_sigprint(); return (*this).save(os, type); } template inline bool Mat::quiet_load(const std::string name, const file_type type) { arma_debug_sigprint(); return (*this).load(name, type); } template inline bool Mat::quiet_load(const hdf5_name& spec, const file_type type) { arma_debug_sigprint(); return (*this).load(spec, type); } template inline bool Mat::quiet_load(const csv_name& spec, const file_type type) { arma_debug_sigprint(); return (*this).load(spec, type); } template inline bool Mat::quiet_load(std::istream& is, const file_type type) { arma_debug_sigprint(); return (*this).load(is, type); } template inline Mat::row_iterator::row_iterator() : M (nullptr) , current_row(0 ) , current_col(0 ) { arma_debug_sigprint(); // NOTE: this instance of row_iterator is invalid (it does not point to a valid element) } template inline Mat::row_iterator::row_iterator(const row_iterator& X) : M (X.M ) , current_row(X.current_row) , current_col(X.current_col) { arma_debug_sigprint(); } template inline Mat::row_iterator::row_iterator(Mat& in_M, const uword in_row, const uword in_col) : M (&in_M ) , current_row(in_row) , current_col(in_col) { arma_debug_sigprint(); } template inline eT& Mat::row_iterator::operator*() { return M->at(current_row,current_col); } template inline typename Mat::row_iterator& Mat::row_iterator::operator++() { current_col++; if(current_col == M->n_cols) { current_col = 0; current_row++; } return *this; } template inline typename Mat::row_iterator Mat::row_iterator::operator++(int) { typename Mat::row_iterator temp(*this); ++(*this); return temp; } template inline typename Mat::row_iterator& Mat::row_iterator::operator--() { if(current_col > 0) { current_col--; } else { if(current_row > 0) { current_col = M->n_cols - 1; current_row--; } } return *this; } template inline typename Mat::row_iterator Mat::row_iterator::operator--(int) { typename Mat::row_iterator temp(*this); --(*this); return temp; } template inline bool Mat::row_iterator::operator!=(const typename Mat::row_iterator& X) const { return ( (current_row != X.current_row) || (current_col != X.current_col) ); } template inline bool Mat::row_iterator::operator==(const typename Mat::row_iterator& X) const { return ( (current_row == X.current_row) && (current_col == X.current_col) ); } template inline bool Mat::row_iterator::operator!=(const typename Mat::const_row_iterator& X) const { return ( (current_row != X.current_row) || (current_col != X.current_col) ); } template inline bool Mat::row_iterator::operator==(const typename Mat::const_row_iterator& X) const { return ( (current_row == X.current_row) && (current_col == X.current_col) ); } template inline Mat::const_row_iterator::const_row_iterator() : M (nullptr) , current_row(0 ) , current_col(0 ) { arma_debug_sigprint(); // NOTE: this instance of const_row_iterator is invalid (it does not point to a valid element) } template inline Mat::const_row_iterator::const_row_iterator(const typename Mat::row_iterator& X) : M (X.M ) , current_row(X.current_row) , current_col(X.current_col) { arma_debug_sigprint(); } template inline Mat::const_row_iterator::const_row_iterator(const typename Mat::const_row_iterator& X) : M (X.M ) , current_row(X.current_row) , current_col(X.current_col) { arma_debug_sigprint(); } template inline Mat::const_row_iterator::const_row_iterator(const Mat& in_M, const uword in_row, const uword in_col) : M (&in_M ) , current_row(in_row) , current_col(in_col) { arma_debug_sigprint(); } template inline const eT& Mat::const_row_iterator::operator*() const { return M->at(current_row,current_col); } template inline typename Mat::const_row_iterator& Mat::const_row_iterator::operator++() { current_col++; if(current_col == M->n_cols) { current_col = 0; current_row++; } return *this; } template inline typename Mat::const_row_iterator Mat::const_row_iterator::operator++(int) { typename Mat::const_row_iterator temp(*this); ++(*this); return temp; } template inline typename Mat::const_row_iterator& Mat::const_row_iterator::operator--() { if(current_col > 0) { current_col--; } else { if(current_row > 0) { current_col = M->n_cols - 1; current_row--; } } return *this; } template inline typename Mat::const_row_iterator Mat::const_row_iterator::operator--(int) { typename Mat::const_row_iterator temp(*this); --(*this); return temp; } template inline bool Mat::const_row_iterator::operator!=(const typename Mat::row_iterator& X) const { return ( (current_row != X.current_row) || (current_col != X.current_col) ); } template inline bool Mat::const_row_iterator::operator==(const typename Mat::row_iterator& X) const { return ( (current_row == X.current_row) && (current_col == X.current_col) ); } template inline bool Mat::const_row_iterator::operator!=(const typename Mat::const_row_iterator& X) const { return ( (current_row != X.current_row) || (current_col != X.current_col) ); } template inline bool Mat::const_row_iterator::operator==(const typename Mat::const_row_iterator& X) const { return ( (current_row == X.current_row) && (current_col == X.current_col) ); } template inline Mat::row_col_iterator::row_col_iterator() : M (nullptr) , current_ptr(nullptr) , current_col(0 ) , current_row(0 ) { arma_debug_sigprint(); // Technically this iterator is invalid (it does not point to a valid element) } template inline Mat::row_col_iterator::row_col_iterator(const row_col_iterator& in_it) : M (in_it.M ) , current_ptr(in_it.current_ptr) , current_col(in_it.current_col) , current_row(in_it.current_row) { arma_debug_sigprint(); } template inline Mat::row_col_iterator::row_col_iterator(Mat& in_M, const uword in_row, const uword in_col) : M (&in_M ) , current_ptr(&in_M.at(in_row,in_col)) , current_col(in_col ) , current_row(in_row ) { arma_debug_sigprint(); } template inline eT& Mat::row_col_iterator::operator*() { return *current_ptr; } template inline typename Mat::row_col_iterator& Mat::row_col_iterator::operator++() { if(current_col < M->n_cols) { current_ptr++; current_row++; // Check to see if we moved a column. if(current_row == M->n_rows) { current_col++; current_row = 0; } } return *this; } template inline typename Mat::row_col_iterator Mat::row_col_iterator::operator++(int) { typename Mat::row_col_iterator temp(*this); ++(*this); return temp; } template inline typename Mat::row_col_iterator& Mat::row_col_iterator::operator--() { if(current_row > 0) { current_ptr--; current_row--; } else if(current_col > 0) { current_ptr--; current_col--; current_row = M->n_rows - 1; } return *this; } template inline typename Mat::row_col_iterator Mat::row_col_iterator::operator--(int) { typename Mat::row_col_iterator temp(*this); --(*this); return temp; } template inline uword Mat::row_col_iterator::row() const { return current_row; } template inline uword Mat::row_col_iterator::col() const { return current_col; } template inline bool Mat::row_col_iterator::operator==(const row_col_iterator& rhs) const { return (current_ptr == rhs.current_ptr); } template inline bool Mat::row_col_iterator::operator!=(const row_col_iterator& rhs) const { return (current_ptr != rhs.current_ptr); } template inline bool Mat::row_col_iterator::operator==(const const_row_col_iterator& rhs) const { return (current_ptr == rhs.current_ptr); } template inline bool Mat::row_col_iterator::operator!=(const const_row_col_iterator& rhs) const { return (current_ptr != rhs.current_ptr); } template inline Mat::const_row_col_iterator::const_row_col_iterator() : M (nullptr) , current_ptr(nullptr) , current_col(0 ) , current_row(0 ) { arma_debug_sigprint(); // Technically this iterator is invalid (it does not point to a valid element) } template inline Mat::const_row_col_iterator::const_row_col_iterator(const row_col_iterator& in_it) : M (in_it.M ) , current_ptr(in_it.current_ptr) , current_col(in_it.col() ) , current_row(in_it.row() ) { arma_debug_sigprint(); } template inline Mat::const_row_col_iterator::const_row_col_iterator(const const_row_col_iterator& in_it) : M (in_it.M ) , current_ptr(in_it.current_ptr) , current_col(in_it.col() ) , current_row(in_it.row() ) { arma_debug_sigprint(); } template inline Mat::const_row_col_iterator::const_row_col_iterator(const Mat& in_M, const uword in_row, const uword in_col) : M (&in_M ) , current_ptr(&in_M.at(in_row,in_col)) , current_col(in_col ) , current_row(in_row ) { arma_debug_sigprint(); } template inline const eT& Mat::const_row_col_iterator::operator*() const { return *current_ptr; } template inline typename Mat::const_row_col_iterator& Mat::const_row_col_iterator::operator++() { if(current_col < M->n_cols) { current_ptr++; current_row++; // Check to see if we moved a column. if(current_row == M->n_rows) { current_col++; current_row = 0; } } return *this; } template inline typename Mat::const_row_col_iterator Mat::const_row_col_iterator::operator++(int) { typename Mat::const_row_col_iterator temp(*this); ++(*this); return temp; } template inline typename Mat::const_row_col_iterator& Mat::const_row_col_iterator::operator--() { if(current_row > 0) { current_ptr--; current_row--; } else if(current_col > 0) { current_ptr--; current_col--; current_row = M->n_rows - 1; } return *this; } template inline typename Mat::const_row_col_iterator Mat::const_row_col_iterator::operator--(int) { typename Mat::const_row_col_iterator temp(*this); --(*this); return temp; } template inline uword Mat::const_row_col_iterator::row() const { return current_row; } template inline uword Mat::const_row_col_iterator::col() const { return current_col; } template inline bool Mat::const_row_col_iterator::operator==(const const_row_col_iterator& rhs) const { return (current_ptr == rhs.current_ptr); } template inline bool Mat::const_row_col_iterator::operator!=(const const_row_col_iterator& rhs) const { return (current_ptr != rhs.current_ptr); } template inline bool Mat::const_row_col_iterator::operator==(const row_col_iterator& rhs) const { return (current_ptr == rhs.current_ptr); } template inline bool Mat::const_row_col_iterator::operator!=(const row_col_iterator& rhs) const { return (current_ptr != rhs.current_ptr); } template inline typename Mat::iterator Mat::begin() { arma_debug_sigprint(); return memptr(); } template inline typename Mat::const_iterator Mat::begin() const { arma_debug_sigprint(); return memptr(); } template inline typename Mat::const_iterator Mat::cbegin() const { arma_debug_sigprint(); return memptr(); } template inline typename Mat::iterator Mat::end() { arma_debug_sigprint(); return memptr() + n_elem; } template inline typename Mat::const_iterator Mat::end() const { arma_debug_sigprint(); return memptr() + n_elem; } template inline typename Mat::const_iterator Mat::cend() const { arma_debug_sigprint(); return memptr() + n_elem; } template inline typename Mat::col_iterator Mat::begin_col(const uword col_num) { arma_debug_sigprint(); arma_conform_check_bounds( (col_num >= n_cols), "Mat::begin_col(): index out of bounds" ); return colptr(col_num); } template inline typename Mat::const_col_iterator Mat::begin_col(const uword col_num) const { arma_debug_sigprint(); arma_conform_check_bounds( (col_num >= n_cols), "Mat::begin_col(): index out of bounds" ); return colptr(col_num); } template inline typename Mat::col_iterator Mat::end_col(const uword col_num) { arma_debug_sigprint(); arma_conform_check_bounds( (col_num >= n_cols), "Mat::end_col(): index out of bounds" ); return colptr(col_num) + n_rows; } template inline typename Mat::const_col_iterator Mat::end_col(const uword col_num) const { arma_debug_sigprint(); arma_conform_check_bounds( (col_num >= n_cols), "Mat::end_col(): index out of bounds" ); return colptr(col_num) + n_rows; } template inline typename Mat::row_iterator Mat::begin_row(const uword row_num) { arma_debug_sigprint(); arma_conform_check_bounds( (row_num >= n_rows), "Mat::begin_row(): index out of bounds" ); return typename Mat::row_iterator(*this, row_num, uword(0)); } template inline typename Mat::const_row_iterator Mat::begin_row(const uword row_num) const { arma_debug_sigprint(); arma_conform_check_bounds( (row_num >= n_rows), "Mat::begin_row(): index out of bounds" ); return typename Mat::const_row_iterator(*this, row_num, uword(0)); } template inline typename Mat::row_iterator Mat::end_row(const uword row_num) { arma_debug_sigprint(); arma_conform_check_bounds( (row_num >= n_rows), "Mat::end_row(): index out of bounds" ); return typename Mat::row_iterator(*this, (row_num + uword(1)), 0); } template inline typename Mat::const_row_iterator Mat::end_row(const uword row_num) const { arma_debug_sigprint(); arma_conform_check_bounds( (row_num >= n_rows), "Mat::end_row(): index out of bounds" ); return typename Mat::const_row_iterator(*this, (row_num + uword(1)), 0); } template inline typename Mat::row_col_iterator Mat::begin_row_col() { return row_col_iterator(*this); } template inline typename Mat::const_row_col_iterator Mat::begin_row_col() const { return const_row_col_iterator(*this); } template inline typename Mat::row_col_iterator Mat::end_row_col() { return row_col_iterator(*this, 0, n_cols); } template inline typename Mat::const_row_col_iterator Mat::end_row_col() const { return const_row_col_iterator(*this, 0, n_cols); } //! resets this matrix to an empty matrix template inline void Mat::clear() { reset(); } //! returns true if the matrix has no elements template inline bool Mat::empty() const { return (n_elem == 0); } //! returns the number of elements in this matrix template inline uword Mat::size() const { return n_elem; } template inline eT& Mat::front() { arma_conform_check( (n_elem == 0), "Mat::front(): matrix is empty" ); return access::rw(mem[0]); } template inline const eT& Mat::front() const { arma_conform_check( (n_elem == 0), "Mat::front(): matrix is empty" ); return mem[0]; } template inline eT& Mat::back() { arma_conform_check( (n_elem == 0), "Mat::back(): matrix is empty" ); return access::rw(mem[n_elem-1]); } template inline const eT& Mat::back() const { arma_conform_check( (n_elem == 0), "Mat::back(): matrix is empty" ); return mem[n_elem-1]; } template template arma_inline Mat::fixed::fixed() : Mat( arma_fixed_indicator(), fixed_n_rows, fixed_n_cols, 0, ((use_extra) ? mem_local_extra : Mat::mem_local) ) { arma_debug_sigprint_this(this); arma_debug_print("Mat::fixed::constructor: zeroing memory"); eT* mem_use = (use_extra) ? &(mem_local_extra[0]) : &(mem_local[0]); arrayops::inplace_set_fixed( mem_use, eT(0) ); } template template arma_inline Mat::fixed::fixed(const fixed& X) : Mat( arma_fixed_indicator(), fixed_n_rows, fixed_n_cols, 0, ((use_extra) ? mem_local_extra : Mat::mem_local) ) { arma_debug_sigprint_this(this); eT* dest = (use_extra) ? mem_local_extra : mem_local; const eT* src = (use_extra) ? X.mem_local_extra : X.mem_local; arrayops::copy( dest, src, fixed_n_elem ); } template template inline Mat::fixed::fixed(const fill::scalar_holder f) : Mat( arma_fixed_indicator(), fixed_n_rows, fixed_n_cols, 0, ((use_extra) ? mem_local_extra : Mat::mem_local) ) { arma_debug_sigprint_this(this); (*this).fill(f.scalar); } template template template inline Mat::fixed::fixed(const fill::fill_class&) : Mat( arma_fixed_indicator(), fixed_n_rows, fixed_n_cols, 0, ((use_extra) ? mem_local_extra : Mat::mem_local) ) { arma_debug_sigprint_this(this); if(is_same_type::yes) { (*this).zeros(); } if(is_same_type::yes) { (*this).ones(); } if(is_same_type::yes) { Mat::eye(); } if(is_same_type::yes) { Mat::randu(); } if(is_same_type::yes) { Mat::randn(); } } template template template inline Mat::fixed::fixed(const Base& A) : Mat( arma_fixed_indicator(), fixed_n_rows, fixed_n_cols, 0, ((use_extra) ? mem_local_extra : Mat::mem_local) ) { arma_debug_sigprint_this(this); Mat::operator=(A.get_ref()); } template template template inline Mat::fixed::fixed(const Base& A, const Base& B) : Mat( arma_fixed_indicator(), fixed_n_rows, fixed_n_cols, 0, ((use_extra) ? mem_local_extra : Mat::mem_local) ) { arma_debug_sigprint_this(this); Mat::init(A,B); } template template inline Mat::fixed::fixed(const eT* aux_mem) : Mat( arma_fixed_indicator(), fixed_n_rows, fixed_n_cols, 0, ((use_extra) ? mem_local_extra : Mat::mem_local) ) { arma_debug_sigprint_this(this); eT* dest = (use_extra) ? mem_local_extra : mem_local; arrayops::copy( dest, aux_mem, fixed_n_elem ); } template template inline Mat::fixed::fixed(const char* text) : Mat( arma_fixed_indicator(), fixed_n_rows, fixed_n_cols, 0, ((use_extra) ? mem_local_extra : Mat::mem_local) ) { arma_debug_sigprint_this(this); Mat::operator=(text); } template template inline Mat::fixed::fixed(const std::string& text) : Mat( arma_fixed_indicator(), fixed_n_rows, fixed_n_cols, 0, ((use_extra) ? mem_local_extra : Mat::mem_local) ) { arma_debug_sigprint_this(this); Mat::operator=(text); } template template inline Mat::fixed::fixed(const std::initializer_list& list) : Mat( arma_fixed_indicator(), fixed_n_rows, fixed_n_cols, 0, ((use_extra) ? mem_local_extra : Mat::mem_local) ) { arma_debug_sigprint_this(this); (*this).operator=(list); } template template inline Mat& Mat::fixed::operator=(const std::initializer_list& list) { arma_debug_sigprint(); const uword N = uword(list.size()); arma_conform_check( (N > fixed_n_elem), "Mat::fixed: initialiser list is too long" ); eT* this_mem = (*this).memptr(); arrayops::copy( this_mem, list.begin(), N ); for(uword iq=N; iq < fixed_n_elem; ++iq) { this_mem[iq] = eT(0); } return *this; } template template inline Mat::fixed::fixed(const std::initializer_list< std::initializer_list >& list) : Mat( arma_fixed_indicator(), fixed_n_rows, fixed_n_cols, 0, ((use_extra) ? mem_local_extra : Mat::mem_local) ) { arma_debug_sigprint_this(this); Mat::init(list); } template template inline Mat& Mat::fixed::operator=(const std::initializer_list< std::initializer_list >& list) { arma_debug_sigprint(); Mat::init(list); return *this; } template template arma_inline Mat& Mat::fixed::operator=(const fixed& X) { arma_debug_sigprint(); if(this != &X) { eT* dest = (use_extra) ? mem_local_extra : mem_local; const eT* src = (use_extra) ? X.mem_local_extra : X.mem_local; arrayops::copy( dest, src, fixed_n_elem ); } return *this; } #if defined(ARMA_GOOD_COMPILER) template template template inline Mat& Mat::fixed::operator=(const eOp& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); const bool bad_alias = (eOp::proxy_type::has_subview && X.P.is_alias(*this)); if(bad_alias) { const Mat tmp(X); (*this) = tmp; return *this; } arma_conform_assert_same_size(fixed_n_rows, fixed_n_cols, X.get_n_rows(), X.get_n_cols(), "Mat::fixed::operator="); eop_type::apply(*this, X); return *this; } template template template inline Mat& Mat::fixed::operator=(const eGlue& X) { arma_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); arma_type_check(( is_same_type< eT, typename T2::elem_type >::no )); const bool bad_alias = ( (eGlue::proxy1_type::has_subview && X.P1.is_alias(*this)) || (eGlue::proxy2_type::has_subview && X.P2.is_alias(*this)) ); if(bad_alias) { const Mat tmp(X); (*this) = tmp; return *this; } arma_conform_assert_same_size(fixed_n_rows, fixed_n_cols, X.get_n_rows(), X.get_n_cols(), "Mat::fixed::operator="); eglue_type::apply(*this, X); return *this; } #endif template template arma_inline const Op< typename Mat::template fixed::Mat_fixed_type, op_htrans > Mat::fixed::t() const { return Op< typename Mat::template fixed::Mat_fixed_type, op_htrans >(*this); } template template arma_inline const Op< typename Mat::template fixed::Mat_fixed_type, op_htrans > Mat::fixed::ht() const { return Op< typename Mat::template fixed::Mat_fixed_type, op_htrans >(*this); } template template arma_inline const Op< typename Mat::template fixed::Mat_fixed_type, op_strans > Mat::fixed::st() const { return Op< typename Mat::template fixed::Mat_fixed_type, op_strans >(*this); } template template arma_inline const eT& Mat::fixed::at_alt(const uword ii) const { #if defined(ARMA_HAVE_ALIGNED_ATTRIBUTE) return (use_extra) ? mem_local_extra[ii] : mem_local[ii]; #else const eT* mem_aligned = (use_extra) ? mem_local_extra : mem_local; memory::mark_as_aligned(mem_aligned); return mem_aligned[ii]; #endif } template template arma_inline eT& Mat::fixed::operator[] (const uword ii) { return (use_extra) ? mem_local_extra[ii] : mem_local[ii]; } template template arma_inline const eT& Mat::fixed::operator[] (const uword ii) const { return (use_extra) ? mem_local_extra[ii] : mem_local[ii]; } template template arma_inline eT& Mat::fixed::at(const uword ii) { return (use_extra) ? mem_local_extra[ii] : mem_local[ii]; } template template arma_inline const eT& Mat::fixed::at(const uword ii) const { return (use_extra) ? mem_local_extra[ii] : mem_local[ii]; } template template arma_inline eT& Mat::fixed::operator() (const uword ii) { arma_conform_check_bounds( (ii >= fixed_n_elem), "Mat::operator(): index out of bounds" ); return (use_extra) ? mem_local_extra[ii] : mem_local[ii]; } template template arma_inline const eT& Mat::fixed::operator() (const uword ii) const { arma_conform_check_bounds( (ii >= fixed_n_elem), "Mat::operator(): index out of bounds" ); return (use_extra) ? mem_local_extra[ii] : mem_local[ii]; } #if defined(__cpp_multidimensional_subscript) template template arma_inline eT& Mat::fixed::operator[] (const uword in_row, const uword in_col) { const uword iq = in_row + in_col*fixed_n_rows; return (use_extra) ? mem_local_extra[iq] : mem_local[iq]; } template template arma_inline const eT& Mat::fixed::operator[] (const uword in_row, const uword in_col) const { const uword iq = in_row + in_col*fixed_n_rows; return (use_extra) ? mem_local_extra[iq] : mem_local[iq]; } #endif template template arma_inline eT& Mat::fixed::at(const uword in_row, const uword in_col) { const uword iq = in_row + in_col*fixed_n_rows; return (use_extra) ? mem_local_extra[iq] : mem_local[iq]; } template template arma_inline const eT& Mat::fixed::at(const uword in_row, const uword in_col) const { const uword iq = in_row + in_col*fixed_n_rows; return (use_extra) ? mem_local_extra[iq] : mem_local[iq]; } template template arma_inline eT& Mat::fixed::operator() (const uword in_row, const uword in_col) { arma_conform_check_bounds( ((in_row >= fixed_n_rows) || (in_col >= fixed_n_cols)), "Mat::operator(): index out of bounds" ); const uword iq = in_row + in_col*fixed_n_rows; return (use_extra) ? mem_local_extra[iq] : mem_local[iq]; } template template arma_inline const eT& Mat::fixed::operator() (const uword in_row, const uword in_col) const { arma_conform_check_bounds( ((in_row >= fixed_n_rows) || (in_col >= fixed_n_cols)), "Mat::operator(): index out of bounds" ); const uword iq = in_row + in_col*fixed_n_rows; return (use_extra) ? mem_local_extra[iq] : mem_local[iq]; } template template arma_inline eT* Mat::fixed::colptr(const uword in_col) { eT* mem_actual = (use_extra) ? mem_local_extra : mem_local; return & access::rw(mem_actual[in_col*fixed_n_rows]); } template template arma_inline const eT* Mat::fixed::colptr(const uword in_col) const { const eT* mem_actual = (use_extra) ? mem_local_extra : mem_local; return & mem_actual[in_col*fixed_n_rows]; } template template arma_inline eT* Mat::fixed::memptr() { return (use_extra) ? mem_local_extra : mem_local; } template template arma_inline const eT* Mat::fixed::memptr() const { return (use_extra) ? mem_local_extra : mem_local; } template template arma_inline bool Mat::fixed::is_vec() const { return ( (fixed_n_rows == 1) || (fixed_n_cols == 1) ); } template template inline const Mat& Mat::fixed::fill(const eT val) { arma_debug_sigprint(); eT* mem_use = (use_extra) ? &(mem_local_extra[0]) : &(mem_local[0]); arrayops::inplace_set_fixed( mem_use, val ); return *this; } template template inline const Mat& Mat::fixed::zeros() { arma_debug_sigprint(); eT* mem_use = (use_extra) ? &(mem_local_extra[0]) : &(mem_local[0]); arrayops::inplace_set_fixed( mem_use, eT(0) ); return *this; } template template inline const Mat& Mat::fixed::ones() { arma_debug_sigprint(); eT* mem_use = (use_extra) ? &(mem_local_extra[0]) : &(mem_local[0]); arrayops::inplace_set_fixed( mem_use, eT(1) ); return *this; } //! prefix ++ template inline void Mat_aux::prefix_pp(Mat& x) { eT* memptr = x.memptr(); const uword n_elem = x.n_elem; uword i,j; for(i=0, j=1; j inline void Mat_aux::prefix_pp(Mat< std::complex >& x) { x += T(1); } //! postfix ++ template inline void Mat_aux::postfix_pp(Mat& x) { eT* memptr = x.memptr(); const uword n_elem = x.n_elem; uword i,j; for(i=0, j=1; j inline void Mat_aux::postfix_pp(Mat< std::complex >& x) { x += T(1); } //! prefix -- template inline void Mat_aux::prefix_mm(Mat& x) { eT* memptr = x.memptr(); const uword n_elem = x.n_elem; uword i,j; for(i=0, j=1; j inline void Mat_aux::prefix_mm(Mat< std::complex >& x) { x -= T(1); } //! postfix -- template inline void Mat_aux::postfix_mm(Mat& x) { eT* memptr = x.memptr(); const uword n_elem = x.n_elem; uword i,j; for(i=0, j=1; j inline void Mat_aux::postfix_mm(Mat< std::complex >& x) { x -= T(1); } template inline void Mat_aux::set_real(Mat& out, const Base& X) { arma_debug_sigprint(); const unwrap tmp(X.get_ref()); const Mat& A = tmp.M; arma_conform_assert_same_size( out, A, "Mat::set_real()" ); out = A; } template inline void Mat_aux::set_imag(Mat&, const Base&) { arma_debug_sigprint(); } template inline void Mat_aux::set_real(Mat< std::complex >& out, const Base& X) { arma_debug_sigprint(); typedef typename std::complex eT; const Proxy P(X.get_ref()); const uword local_n_rows = P.get_n_rows(); const uword local_n_cols = P.get_n_cols(); arma_conform_assert_same_size( out.n_rows, out.n_cols, local_n_rows, local_n_cols, "Mat::set_real()" ); eT* out_mem = out.memptr(); if(Proxy::use_at == false) { typedef typename Proxy::ea_type ea_type; ea_type A = P.get_ea(); const uword N = out.n_elem; for(uword i=0; i inline void Mat_aux::set_imag(Mat< std::complex >& out, const Base& X) { arma_debug_sigprint(); typedef typename std::complex eT; const Proxy P(X.get_ref()); const uword local_n_rows = P.get_n_rows(); const uword local_n_cols = P.get_n_cols(); arma_conform_assert_same_size( out.n_rows, out.n_cols, local_n_rows, local_n_cols, "Mat::set_imag()" ); eT* out_mem = out.memptr(); if(Proxy::use_at == false) { typedef typename Proxy::ea_type ea_type; ea_type A = P.get_ea(); const uword N = out.n_elem; for(uword i=0; i inline void glue_histc::apply_noalias(Mat& C, const Mat& A, const Mat& B, const uword dim) { arma_debug_sigprint(); arma_conform_check( ((B.is_vec() == false) && (B.is_empty() == false)), "histc(): parameter 'edges' must be a vector" ); const uword A_n_rows = A.n_rows; const uword A_n_cols = A.n_cols; const uword B_n_elem = B.n_elem; if( B_n_elem == uword(0) ) { C.reset(); return; } arma_conform_check ( ((Col(const_cast(B.memptr()), B_n_elem, false, false)).is_sorted("strictascend") == false), "hist(): given 'edges' vector does not contain monotonically increasing values" ); const eT* B_mem = B.memptr(); const uword B_n_elem_m1 = B_n_elem - 1; if(dim == uword(0)) { C.zeros(B_n_elem, A_n_cols); for(uword col=0; col < A_n_cols; ++col) { const eT* A_coldata = A.colptr(col); uword* C_coldata = C.colptr(col); for(uword row=0; row < A_n_rows; ++row) { const eT x = A_coldata[row]; for(uword i=0; i < B_n_elem_m1; ++i) { if( (B_mem[i] <= x) && (x < B_mem[i+1]) ) { C_coldata[i]++; break; } else if( B_mem[B_n_elem_m1] == x ) { C_coldata[B_n_elem_m1]++; break; } // for compatibility with Matlab } } } } else if(dim == uword(1)) { C.zeros(A_n_rows, B_n_elem); if(A.n_rows == 1) { const uword A_n_elem = A.n_elem; const eT* A_mem = A.memptr(); uword* C_mem = C.memptr(); for(uword j=0; j < A_n_elem; ++j) { const eT x = A_mem[j]; for(uword i=0; i < B_n_elem_m1; ++i) { if( (B_mem[i] <= x) && (x < B_mem[i+1]) ) { C_mem[i]++; break; } else if( B_mem[B_n_elem_m1] == x ) { C_mem[B_n_elem_m1]++; break; } // for compatibility with Matlab } } } else { for(uword row=0; row < A_n_rows; ++row) for(uword col=0; col < A_n_cols; ++col) { const eT x = A.at(row,col); for(uword i=0; i < B_n_elem_m1; ++i) { if( (B_mem[i] <= x) && (x < B_mem[i+1]) ) { C.at(row,i)++; break; } else if( B_mem[B_n_elem_m1] == x ) { C.at(row,B_n_elem_m1)++; break; } // for compatibility with Matlab } } } } } template inline void glue_histc::apply(Mat& C, const mtGlue& expr) { arma_debug_sigprint(); const uword dim = expr.aux_uword; arma_conform_check( (dim > 1), "histc(): parameter 'dim' must be 0 or 1" ); const quasi_unwrap UA(expr.A); const quasi_unwrap UB(expr.B); if(UA.is_alias(C) || UB.is_alias(C)) { Mat tmp; glue_histc::apply_noalias(tmp, UA.M, UB.M, dim); C.steal_mem(tmp); } else { glue_histc::apply_noalias(C, UA.M, UB.M, dim); } } template inline void glue_histc_default::apply(Mat& C, const mtGlue& expr) { arma_debug_sigprint(); const quasi_unwrap UA(expr.A); const quasi_unwrap UB(expr.B); const uword dim = (T1::is_xvec) ? uword(UA.M.is_rowvec() ? 1 : 0) : uword((T1::is_row) ? 1 : 0); if(UA.is_alias(C) || UB.is_alias(C)) { Mat tmp; glue_histc::apply_noalias(tmp, UA.M, UB.M, dim); C.steal_mem(tmp); } else { glue_histc::apply_noalias(C, UA.M, UB.M, dim); } } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_numel.hpp0000644000176200001440000000340114631567470022717 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_numel //! @{ template arma_warn_unused inline typename enable_if2< is_arma_type::value, uword >::result numel(const T1& X) { arma_debug_sigprint(); const Proxy P(X); return P.get_n_elem(); } template arma_warn_unused inline typename enable_if2< is_arma_cube_type::value, uword >::result numel(const T1& X) { arma_debug_sigprint(); const ProxyCube P(X); return P.get_n_elem(); } template arma_warn_unused inline typename enable_if2< is_arma_sparse_type::value, uword >::result numel(const T1& X) { arma_debug_sigprint(); const SpProxy P(X); return P.get_n_elem(); } template arma_warn_unused inline uword numel(const field& X) { arma_debug_sigprint(); return X.n_elem; } template arma_warn_unused inline uword numel(const subview_field& X) { arma_debug_sigprint(); return X.n_elem; } //! @} RcppArmadillo/inst/include/armadillo_bits/op_normalise_meat.hpp0000644000176200001440000000653614631567470024625 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_normalise //! @{ template inline void op_normalise_vec::apply(Mat& out, const Op& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; typedef typename T1::pod_type T; const uword p = in.aux_uword_a; arma_conform_check( (p == 0), "normalise(): unsupported vector norm type" ); const quasi_unwrap U(in.m); const T norm_val_a = norm(U.M, p); const T norm_val_b = (norm_val_a != T(0)) ? norm_val_a : T(1); if(quasi_unwrap::has_subview && U.is_alias(out)) { Mat tmp = U.M / norm_val_b; out.steal_mem(tmp); } else { out = U.M / norm_val_b; } } template inline void op_normalise_mat::apply(Mat& out, const Op& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword p = in.aux_uword_a; const uword dim = in.aux_uword_b; arma_conform_check( (p == 0), "normalise(): unsupported vector norm type" ); arma_conform_check( (dim > 1), "normalise(): parameter 'dim' must be 0 or 1" ); const quasi_unwrap U(in.m); if(quasi_unwrap::has_subview && U.is_alias(out)) { Mat out2; op_normalise_mat::apply(out2, U.M, p, dim); out.steal_mem(out2); } else { op_normalise_mat::apply(out, U.M, p, dim); } } template inline void op_normalise_mat::apply(Mat& out, const Mat& A, const uword p, const uword dim) { arma_debug_sigprint(); typedef typename get_pod_type::result T; out.copy_size(A); if(A.n_elem == 0) { return; } if(dim == 0) { const uword n_cols = A.n_cols; for(uword i=0; i norm_vals(n_rows); T* norm_vals_mem = norm_vals.memptr(); for(uword i=0; i inline void gssv(superlu_options_t* options, SuperMatrix* A, int* perm_c, int* perm_r, SuperMatrix* L, SuperMatrix* U, SuperMatrix* B, SuperLUStat_t* stat, superlu::int_t* info) { arma_type_check(( is_supported_blas_type::value == false )); if(is_float::value) { arma_wrapper(sgssv)(options, A, perm_c, perm_r, L, U, B, stat, info); } else if(is_double::value) { arma_wrapper(dgssv)(options, A, perm_c, perm_r, L, U, B, stat, info); } else if(is_cx_float::value) { arma_wrapper(cgssv)(options, A, perm_c, perm_r, L, U, B, stat, info); } else if(is_cx_double::value) { arma_wrapper(zgssv)(options, A, perm_c, perm_r, L, U, B, stat, info); } } template inline void gssvx( superlu_options_t* opts, SuperMatrix* A, int* perm_c, int* perm_r, int* etree, char* equed, typename get_pod_type::result* R, typename get_pod_type::result* C, SuperMatrix* L, SuperMatrix* U, void* work, superlu::int_t lwork, SuperMatrix* B, SuperMatrix* X, typename get_pod_type::result* rpg, typename get_pod_type::result* rcond, typename get_pod_type::result* ferr, typename get_pod_type::result* berr, GlobalLU_t* glu, mem_usage_t* mu, SuperLUStat_t* stat, superlu::int_t* info ) { arma_type_check(( is_supported_blas_type::value == false )); if(is_float::value) { typedef float T; arma_wrapper(sgssvx)(opts, A, perm_c, perm_r, etree, equed, (T*)R, (T*)C, L, U, work, lwork, B, X, (T*)rpg, (T*)rcond, (T*)ferr, (T*)berr, glu, mu, stat, info); } else if(is_double::value) { typedef double T; arma_wrapper(dgssvx)(opts, A, perm_c, perm_r, etree, equed, (T*)R, (T*)C, L, U, work, lwork, B, X, (T*)rpg, (T*)rcond, (T*)ferr, (T*)berr, glu, mu, stat, info); } else if(is_cx_float::value) { typedef float T; arma_wrapper(cgssvx)(opts, A, perm_c, perm_r, etree, equed, (T*)R, (T*)C, L, U, work, lwork, B, X, (T*)rpg, (T*)rcond, (T*)ferr, (T*)berr, glu, mu, stat, info); } else if(is_cx_double::value) { typedef double T; arma_wrapper(zgssvx)(opts, A, perm_c, perm_r, etree, equed, (T*)R, (T*)C, L, U, work, lwork, B, X, (T*)rpg, (T*)rcond, (T*)ferr, (T*)berr, glu, mu, stat, info); } } template inline void gstrf(superlu_options_t* options, SuperMatrix* A, int relax, int panel_size, int* etree, void* work, superlu::int_t lwork, int* perm_c, int* perm_r, SuperMatrix* L, SuperMatrix* U, GlobalLU_t* Glu, SuperLUStat_t* stat, superlu::int_t* info ) { arma_type_check(( is_supported_blas_type::value == false )); if(is_float::value) { arma_wrapper(sgstrf)(options, A, relax, panel_size, etree, work, lwork, perm_c, perm_r, L, U, Glu, stat, info); } else if(is_double::value) { arma_wrapper(dgstrf)(options, A, relax, panel_size, etree, work, lwork, perm_c, perm_r, L, U, Glu, stat, info); } else if(is_cx_float::value) { arma_wrapper(cgstrf)(options, A, relax, panel_size, etree, work, lwork, perm_c, perm_r, L, U, Glu, stat, info); } else if(is_cx_double::value) { arma_wrapper(zgstrf)(options, A, relax, panel_size, etree, work, lwork, perm_c, perm_r, L, U, Glu, stat, info); } } template inline void gstrs(trans_t trans, SuperMatrix* L, SuperMatrix* U, int* perm_c, int* perm_r, SuperMatrix* B, SuperLUStat_t* stat, int* info ) { arma_type_check(( is_supported_blas_type::value == false )); if(is_float::value) { arma_wrapper(sgstrs)(trans, L, U, perm_c, perm_r, B, stat, info); } else if(is_double::value) { arma_wrapper(dgstrs)(trans, L, U, perm_c, perm_r, B, stat, info); } else if(is_cx_float::value) { arma_wrapper(cgstrs)(trans, L, U, perm_c, perm_r, B, stat, info); } else if(is_cx_double::value) { arma_wrapper(zgstrs)(trans, L, U, perm_c, perm_r, B, stat, info); } } template inline typename get_pod_type::result langs(char* norm, superlu::SuperMatrix* A) { arma_type_check(( is_supported_blas_type::value == false )); typedef typename get_pod_type::result T; if(is_float::value) { return arma_wrapper(slangs)(norm, A); } else if(is_double::value) { return arma_wrapper(dlangs)(norm, A); } else if(is_cx_float::value) { return arma_wrapper(clangs)(norm, A); } else if(is_cx_double::value) { return arma_wrapper(zlangs)(norm, A); } return T(0); // to avoid false warnings from the compiler } template inline void gscon(char* norm, superlu::SuperMatrix* L, superlu::SuperMatrix* U, typename get_pod_type::result anorm, typename get_pod_type::result* rcond, superlu::SuperLUStat_t* stat, int* info) { arma_type_check(( is_supported_blas_type::value == false )); if(is_float::value) { typedef float T; arma_wrapper(sgscon)(norm, L, U, (T)anorm, (T*)rcond, stat, info); } else if(is_double::value) { typedef double T; arma_wrapper(dgscon)(norm, L, U, (T)anorm, (T*)rcond, stat, info); } else if(is_cx_float::value) { typedef float T; arma_wrapper(cgscon)(norm, L, U, (T)anorm, (T*)rcond, stat, info); } else if(is_cx_double::value) { typedef double T; arma_wrapper(zgscon)(norm, L, U, (T)anorm, (T*)rcond, stat, info); } } inline void init_stat(SuperLUStat_t* stat) { arma_wrapper(StatInit)(stat); } inline void free_stat(SuperLUStat_t* stat) { arma_wrapper(StatFree)(stat); } inline void set_default_opts(superlu_options_t* opts) { arma_wrapper(set_default_options)(opts); } inline void get_permutation_c(int ispec, SuperMatrix* A, int* perm_c) { arma_wrapper(get_perm_c)(ispec, A, perm_c); } inline void sp_preorder_mat(superlu_options_t* opts, SuperMatrix* A, int* perm_c, int* etree, SuperMatrix* AC) { arma_wrapper(sp_preorder)(opts, A, perm_c, etree, AC); } inline int sp_ispec_environ(int ispec) { return arma_wrapper(sp_ienv)(ispec); } inline void destroy_supernode_mat(SuperMatrix* a) { arma_wrapper(Destroy_SuperNode_Matrix)(a); } inline void destroy_compcol_mat(SuperMatrix* a) { arma_wrapper(Destroy_CompCol_Matrix)(a); } inline void destroy_compcolperm_mat(SuperMatrix* a) { arma_wrapper(Destroy_CompCol_Permuted)(a); } inline void destroy_dense_mat(SuperMatrix* a) { arma_wrapper(Destroy_SuperMatrix_Store)(a); } inline void* malloc(size_t N) { return arma_wrapper(superlu_malloc)(N); } inline void free(void* mem) { arma_wrapper(superlu_free)(mem); } } // namespace superlu #endif RcppArmadillo/inst/include/armadillo_bits/spop_vectorise_bones.hpp0000644000176200001440000000321314301267044025333 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup spop_vectorise //! @{ class spop_vectorise_col : public traits_op_col { public: template inline static void apply(SpMat& out, const SpOp& in); template inline static void apply_direct(SpMat& out, const T1& expr); }; class spop_vectorise_row : public traits_op_row { public: template inline static void apply(SpMat& out, const SpOp& in); template inline static void apply_direct(SpMat& out, const T1& expr); }; class spop_vectorise_all : public traits_op_xvec { public: template inline static void apply(SpMat& out, const SpOp& in); }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_find_unique_bones.hpp0000644000176200001440000000355714301267043025305 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_find_unique //! @{ class op_find_unique : public traits_op_col { public: template static inline bool apply_helper(Mat& out, const Proxy& P, const bool ascending_indices); template static inline void apply(Mat& out, const mtOp& in); }; template struct arma_find_unique_packet { eT val; uword index; }; template struct arma_find_unique_comparator { arma_inline bool operator() (const arma_find_unique_packet& A, const arma_find_unique_packet& B) const { return (A.val < B.val); } }; template struct arma_find_unique_comparator< std::complex > { arma_inline bool operator() (const arma_find_unique_packet< std::complex >& A, const arma_find_unique_packet< std::complex >& B) const { const T A_real = A.val.real(); const T B_real = B.val.real(); return ( (A_real < B_real) ? true : ((A_real == B_real) ? (A.val.imag() < B.val.imag()) : false) ); } }; //! @} RcppArmadillo/inst/include/armadillo_bits/newarp_SymEigsShiftSolver_bones.hpp0000644000176200001440000000257014301267043027420 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ namespace newarp { //! This class implements the eigen solver for real symmetric matrices in the shift-and-invert mode. template class SymEigsShiftSolver : public SymEigsSolver { private: const eT sigma; // Sort the first nev Ritz pairs in ascending algebraic order // This is used to return the final results void sort_ritzpair(); public: //! Constructor to create a solver object. inline SymEigsShiftSolver(const OpType& op_, uword nev_, uword ncv_, const eT sigma_); }; } // namespace newarp RcppArmadillo/inst/include/armadillo_bits/SpToDGlue_bones.hpp0000644000176200001440000000325114715372502024104 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup SpToDGlue //! @{ template class SpToDGlue : public Base< typename T1::elem_type, SpToDGlue > { public: typedef typename T1::elem_type elem_type; typedef typename get_pod_type::result pod_type; static constexpr bool is_row = glue_type::template traits::is_row; static constexpr bool is_col = glue_type::template traits::is_col; static constexpr bool is_xvec = glue_type::template traits::is_xvec; inline explicit SpToDGlue(const T1& in_A, const T2& in_B); inline ~SpToDGlue(); template constexpr bool is_alias(const Mat&) const { return false; } const T1& A; //!< first operand; must be derived from Base or SpBase const T2& B; //!< second operand; must be derived from Base or SpBase }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_misc_bones.hpp0000644000176200001440000000475415030507611023730 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_misc //! @{ class op_real : public traits_op_passthru { public: template inline static void apply( Mat& out, const mtOp& X); template inline static void apply( Cube& out, const mtOpCube& X); }; class op_imag : public traits_op_passthru { public: template inline static void apply( Mat& out, const mtOp& X); template inline static void apply( Cube& out, const mtOpCube& X); }; class op_abs : public traits_op_passthru { public: template inline static void apply( Mat& out, const mtOp& X); template inline static void apply( Cube& out, const mtOpCube& X); }; class op_arg : public traits_op_passthru { public: template inline static void apply( Mat& out, const mtOp& X); template inline static void apply( Cube& out, const mtOpCube& X); }; class op_replace : public traits_op_passthru { public: template inline static void apply(Mat& out, const mtOp& in); template inline static void apply(Cube& out, const mtOpCube& in); }; //! @} RcppArmadillo/inst/include/armadillo_bits/typedef_mat_fixed.hpp0000644000176200001440000002340614301267044024567 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup typedef_mat_fixed //! @{ typedef umat::fixed<2,2> umat22; typedef umat::fixed<3,3> umat33; typedef umat::fixed<4,4> umat44; typedef umat::fixed<5,5> umat55; typedef umat::fixed<6,6> umat66; typedef umat::fixed<7,7> umat77; typedef umat::fixed<8,8> umat88; typedef umat::fixed<9,9> umat99; typedef imat::fixed<2,2> imat22; typedef imat::fixed<3,3> imat33; typedef imat::fixed<4,4> imat44; typedef imat::fixed<5,5> imat55; typedef imat::fixed<6,6> imat66; typedef imat::fixed<7,7> imat77; typedef imat::fixed<8,8> imat88; typedef imat::fixed<9,9> imat99; typedef fmat::fixed<2,2> fmat22; typedef fmat::fixed<3,3> fmat33; typedef fmat::fixed<4,4> fmat44; typedef fmat::fixed<5,5> fmat55; typedef fmat::fixed<6,6> fmat66; typedef fmat::fixed<7,7> fmat77; typedef fmat::fixed<8,8> fmat88; typedef fmat::fixed<9,9> fmat99; typedef dmat::fixed<2,2> dmat22; typedef dmat::fixed<3,3> dmat33; typedef dmat::fixed<4,4> dmat44; typedef dmat::fixed<5,5> dmat55; typedef dmat::fixed<6,6> dmat66; typedef dmat::fixed<7,7> dmat77; typedef dmat::fixed<8,8> dmat88; typedef dmat::fixed<9,9> dmat99; typedef mat::fixed<2,2> mat22; typedef mat::fixed<3,3> mat33; typedef mat::fixed<4,4> mat44; typedef mat::fixed<5,5> mat55; typedef mat::fixed<6,6> mat66; typedef mat::fixed<7,7> mat77; typedef mat::fixed<8,8> mat88; typedef mat::fixed<9,9> mat99; typedef cx_fmat::fixed<2,2> cx_fmat22; typedef cx_fmat::fixed<3,3> cx_fmat33; typedef cx_fmat::fixed<4,4> cx_fmat44; typedef cx_fmat::fixed<5,5> cx_fmat55; typedef cx_fmat::fixed<6,6> cx_fmat66; typedef cx_fmat::fixed<7,7> cx_fmat77; typedef cx_fmat::fixed<8,8> cx_fmat88; typedef cx_fmat::fixed<9,9> cx_fmat99; typedef cx_dmat::fixed<2,2> cx_dmat22; typedef cx_dmat::fixed<3,3> cx_dmat33; typedef cx_dmat::fixed<4,4> cx_dmat44; typedef cx_dmat::fixed<5,5> cx_dmat55; typedef cx_dmat::fixed<6,6> cx_dmat66; typedef cx_dmat::fixed<7,7> cx_dmat77; typedef cx_dmat::fixed<8,8> cx_dmat88; typedef cx_dmat::fixed<9,9> cx_dmat99; typedef cx_mat::fixed<2,2> cx_mat22; typedef cx_mat::fixed<3,3> cx_mat33; typedef cx_mat::fixed<4,4> cx_mat44; typedef cx_mat::fixed<5,5> cx_mat55; typedef cx_mat::fixed<6,6> cx_mat66; typedef cx_mat::fixed<7,7> cx_mat77; typedef cx_mat::fixed<8,8> cx_mat88; typedef cx_mat::fixed<9,9> cx_mat99; // typedef uvec::fixed<2> uvec2; typedef uvec::fixed<3> uvec3; typedef uvec::fixed<4> uvec4; typedef uvec::fixed<5> uvec5; typedef uvec::fixed<6> uvec6; typedef uvec::fixed<7> uvec7; typedef uvec::fixed<8> uvec8; typedef uvec::fixed<9> uvec9; typedef ivec::fixed<2> ivec2; typedef ivec::fixed<3> ivec3; typedef ivec::fixed<4> ivec4; typedef ivec::fixed<5> ivec5; typedef ivec::fixed<6> ivec6; typedef ivec::fixed<7> ivec7; typedef ivec::fixed<8> ivec8; typedef ivec::fixed<9> ivec9; typedef fvec::fixed<2> fvec2; typedef fvec::fixed<3> fvec3; typedef fvec::fixed<4> fvec4; typedef fvec::fixed<5> fvec5; typedef fvec::fixed<6> fvec6; typedef fvec::fixed<7> fvec7; typedef fvec::fixed<8> fvec8; typedef fvec::fixed<9> fvec9; typedef dvec::fixed<2> dvec2; typedef dvec::fixed<3> dvec3; typedef dvec::fixed<4> dvec4; typedef dvec::fixed<5> dvec5; typedef dvec::fixed<6> dvec6; typedef dvec::fixed<7> dvec7; typedef dvec::fixed<8> dvec8; typedef dvec::fixed<9> dvec9; typedef vec::fixed<2> vec2; typedef vec::fixed<3> vec3; typedef vec::fixed<4> vec4; typedef vec::fixed<5> vec5; typedef vec::fixed<6> vec6; typedef vec::fixed<7> vec7; typedef vec::fixed<8> vec8; typedef vec::fixed<9> vec9; typedef cx_fvec::fixed<2> cx_fvec2; typedef cx_fvec::fixed<3> cx_fvec3; typedef cx_fvec::fixed<4> cx_fvec4; typedef cx_fvec::fixed<5> cx_fvec5; typedef cx_fvec::fixed<6> cx_fvec6; typedef cx_fvec::fixed<7> cx_fvec7; typedef cx_fvec::fixed<8> cx_fvec8; typedef cx_fvec::fixed<9> cx_fvec9; typedef cx_dvec::fixed<2> cx_dvec2; typedef cx_dvec::fixed<3> cx_dvec3; typedef cx_dvec::fixed<4> cx_dvec4; typedef cx_dvec::fixed<5> cx_dvec5; typedef cx_dvec::fixed<6> cx_dvec6; typedef cx_dvec::fixed<7> cx_dvec7; typedef cx_dvec::fixed<8> cx_dvec8; typedef cx_dvec::fixed<9> cx_dvec9; typedef cx_vec::fixed<2> cx_vec2; typedef cx_vec::fixed<3> cx_vec3; typedef cx_vec::fixed<4> cx_vec4; typedef cx_vec::fixed<5> cx_vec5; typedef cx_vec::fixed<6> cx_vec6; typedef cx_vec::fixed<7> cx_vec7; typedef cx_vec::fixed<8> cx_vec8; typedef cx_vec::fixed<9> cx_vec9; // typedef ucolvec::fixed<2> ucolvec2; typedef ucolvec::fixed<3> ucolvec3; typedef ucolvec::fixed<4> ucolvec4; typedef ucolvec::fixed<5> ucolvec5; typedef ucolvec::fixed<6> ucolvec6; typedef ucolvec::fixed<7> ucolvec7; typedef ucolvec::fixed<8> ucolvec8; typedef ucolvec::fixed<9> ucolvec9; typedef icolvec::fixed<2> icolvec2; typedef icolvec::fixed<3> icolvec3; typedef icolvec::fixed<4> icolvec4; typedef icolvec::fixed<5> icolvec5; typedef icolvec::fixed<6> icolvec6; typedef icolvec::fixed<7> icolvec7; typedef icolvec::fixed<8> icolvec8; typedef icolvec::fixed<9> icolvec9; typedef fcolvec::fixed<2> fcolvec2; typedef fcolvec::fixed<3> fcolvec3; typedef fcolvec::fixed<4> fcolvec4; typedef fcolvec::fixed<5> fcolvec5; typedef fcolvec::fixed<6> fcolvec6; typedef fcolvec::fixed<7> fcolvec7; typedef fcolvec::fixed<8> fcolvec8; typedef fcolvec::fixed<9> fcolvec9; typedef dcolvec::fixed<2> dcolvec2; typedef dcolvec::fixed<3> dcolvec3; typedef dcolvec::fixed<4> dcolvec4; typedef dcolvec::fixed<5> dcolvec5; typedef dcolvec::fixed<6> dcolvec6; typedef dcolvec::fixed<7> dcolvec7; typedef dcolvec::fixed<8> dcolvec8; typedef dcolvec::fixed<9> dcolvec9; typedef colvec::fixed<2> colvec2; typedef colvec::fixed<3> colvec3; typedef colvec::fixed<4> colvec4; typedef colvec::fixed<5> colvec5; typedef colvec::fixed<6> colvec6; typedef colvec::fixed<7> colvec7; typedef colvec::fixed<8> colvec8; typedef colvec::fixed<9> colvec9; typedef cx_fcolvec::fixed<2> cx_fcolvec2; typedef cx_fcolvec::fixed<3> cx_fcolvec3; typedef cx_fcolvec::fixed<4> cx_fcolvec4; typedef cx_fcolvec::fixed<5> cx_fcolvec5; typedef cx_fcolvec::fixed<6> cx_fcolvec6; typedef cx_fcolvec::fixed<7> cx_fcolvec7; typedef cx_fcolvec::fixed<8> cx_fcolvec8; typedef cx_fcolvec::fixed<9> cx_fcolvec9; typedef cx_dcolvec::fixed<2> cx_dcolvec2; typedef cx_dcolvec::fixed<3> cx_dcolvec3; typedef cx_dcolvec::fixed<4> cx_dcolvec4; typedef cx_dcolvec::fixed<5> cx_dcolvec5; typedef cx_dcolvec::fixed<6> cx_dcolvec6; typedef cx_dcolvec::fixed<7> cx_dcolvec7; typedef cx_dcolvec::fixed<8> cx_dcolvec8; typedef cx_dcolvec::fixed<9> cx_dcolvec9; typedef cx_colvec::fixed<2> cx_colvec2; typedef cx_colvec::fixed<3> cx_colvec3; typedef cx_colvec::fixed<4> cx_colvec4; typedef cx_colvec::fixed<5> cx_colvec5; typedef cx_colvec::fixed<6> cx_colvec6; typedef cx_colvec::fixed<7> cx_colvec7; typedef cx_colvec::fixed<8> cx_colvec8; typedef cx_colvec::fixed<9> cx_colvec9; // typedef urowvec::fixed<2> urowvec2; typedef urowvec::fixed<3> urowvec3; typedef urowvec::fixed<4> urowvec4; typedef urowvec::fixed<5> urowvec5; typedef urowvec::fixed<6> urowvec6; typedef urowvec::fixed<7> urowvec7; typedef urowvec::fixed<8> urowvec8; typedef urowvec::fixed<9> urowvec9; typedef irowvec::fixed<2> irowvec2; typedef irowvec::fixed<3> irowvec3; typedef irowvec::fixed<4> irowvec4; typedef irowvec::fixed<5> irowvec5; typedef irowvec::fixed<6> irowvec6; typedef irowvec::fixed<7> irowvec7; typedef irowvec::fixed<8> irowvec8; typedef irowvec::fixed<9> irowvec9; typedef frowvec::fixed<2> frowvec2; typedef frowvec::fixed<3> frowvec3; typedef frowvec::fixed<4> frowvec4; typedef frowvec::fixed<5> frowvec5; typedef frowvec::fixed<6> frowvec6; typedef frowvec::fixed<7> frowvec7; typedef frowvec::fixed<8> frowvec8; typedef frowvec::fixed<9> frowvec9; typedef drowvec::fixed<2> drowvec2; typedef drowvec::fixed<3> drowvec3; typedef drowvec::fixed<4> drowvec4; typedef drowvec::fixed<5> drowvec5; typedef drowvec::fixed<6> drowvec6; typedef drowvec::fixed<7> drowvec7; typedef drowvec::fixed<8> drowvec8; typedef drowvec::fixed<9> drowvec9; typedef rowvec::fixed<2> rowvec2; typedef rowvec::fixed<3> rowvec3; typedef rowvec::fixed<4> rowvec4; typedef rowvec::fixed<5> rowvec5; typedef rowvec::fixed<6> rowvec6; typedef rowvec::fixed<7> rowvec7; typedef rowvec::fixed<8> rowvec8; typedef rowvec::fixed<9> rowvec9; typedef cx_frowvec::fixed<2> cx_frowvec2; typedef cx_frowvec::fixed<3> cx_frowvec3; typedef cx_frowvec::fixed<4> cx_frowvec4; typedef cx_frowvec::fixed<5> cx_frowvec5; typedef cx_frowvec::fixed<6> cx_frowvec6; typedef cx_frowvec::fixed<7> cx_frowvec7; typedef cx_frowvec::fixed<8> cx_frowvec8; typedef cx_frowvec::fixed<9> cx_frowvec9; typedef cx_drowvec::fixed<2> cx_drowvec2; typedef cx_drowvec::fixed<3> cx_drowvec3; typedef cx_drowvec::fixed<4> cx_drowvec4; typedef cx_drowvec::fixed<5> cx_drowvec5; typedef cx_drowvec::fixed<6> cx_drowvec6; typedef cx_drowvec::fixed<7> cx_drowvec7; typedef cx_drowvec::fixed<8> cx_drowvec8; typedef cx_drowvec::fixed<9> cx_drowvec9; typedef cx_rowvec::fixed<2> cx_rowvec2; typedef cx_rowvec::fixed<3> cx_rowvec3; typedef cx_rowvec::fixed<4> cx_rowvec4; typedef cx_rowvec::fixed<5> cx_rowvec5; typedef cx_rowvec::fixed<6> cx_rowvec6; typedef cx_rowvec::fixed<7> cx_rowvec7; typedef cx_rowvec::fixed<8> cx_rowvec8; typedef cx_rowvec::fixed<9> cx_rowvec9; //! @} RcppArmadillo/inst/include/armadillo_bits/op_det_bones.hpp0000644000176200001440000000314614476055675023570 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_det //! @{ class op_det : public traits_op_default { public: template struct pos { static constexpr uword n2 = row + col*2; static constexpr uword n3 = row + col*3; }; template inline static bool apply_direct(typename T1::elem_type& out_val, const Base& expr); template inline static typename T1::elem_type apply_diagmat(const Base& expr); template inline static typename T1::elem_type apply_trimat(const Base& expr); template arma_cold inline static eT apply_tiny_2x2(const Mat& X); template arma_cold inline static eT apply_tiny_3x3(const Mat& X); }; //! @} RcppArmadillo/inst/include/armadillo_bits/ProxyCube.hpp0000644000176200001440000004674514752446051023051 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup ProxyCube //! @{ template struct ProxyCube { inline ProxyCube(const T1&) { arma_type_check(( is_arma_cube_type::value == false )); } }; // ea_type is the "element accessor" type, // which can provide access to elements via operator[] template struct ProxyCube< Cube > { typedef eT elem_type; typedef typename get_pod_type::result pod_type; typedef Cube stored_type; typedef const eT* ea_type; typedef const Cube& aligned_ea_type; static constexpr bool use_at = false; static constexpr bool use_mp = false; static constexpr bool has_subview = false; const Cube& Q; inline explicit ProxyCube(const Cube& A) : Q(A) { arma_debug_sigprint(); } arma_inline uword get_n_rows() const { return Q.n_rows; } arma_inline uword get_n_cols() const { return Q.n_cols; } arma_inline uword get_n_elem_slice() const { return Q.n_elem_slice; } arma_inline uword get_n_slices() const { return Q.n_slices; } arma_inline uword get_n_elem() const { return Q.n_elem; } arma_inline elem_type operator[] (const uword i) const { return Q[i]; } arma_inline elem_type at (const uword r, const uword c, const uword s) const { return Q.at(r, c, s); } arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); } arma_inline ea_type get_ea() const { return Q.memptr(); } arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template arma_inline bool is_alias(const Cube& X) const { return (void_ptr(&Q) == void_ptr(&X)); } template arma_inline bool has_overlap(const subview_cube& X) const { return is_alias(X.m); } arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); } }; template struct ProxyCube< GenCube > { typedef eT elem_type; typedef typename get_pod_type::result pod_type; typedef GenCube stored_type; typedef const GenCube& ea_type; typedef const GenCube& aligned_ea_type; static constexpr bool use_at = false; static constexpr bool use_mp = false; static constexpr bool has_subview = false; const GenCube& Q; inline explicit ProxyCube(const GenCube& A) : Q(A) { arma_debug_sigprint(); } arma_inline uword get_n_rows() const { return Q.n_rows; } arma_inline uword get_n_cols() const { return Q.n_cols; } arma_inline uword get_n_elem_slice() const { return Q.n_rows*Q.n_cols; } arma_inline uword get_n_slices() const { return Q.n_slices; } arma_inline uword get_n_elem() const { return Q.n_rows*Q.n_cols*Q.n_slices; } arma_inline elem_type operator[] (const uword i) const { return Q[i]; } arma_inline elem_type at (const uword r, const uword c, const uword s) const { return Q.at(r, c, s); } arma_inline elem_type at_alt (const uword i) const { return Q[i]; } arma_inline ea_type get_ea() const { return Q; } arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template constexpr bool is_alias(const Cube&) const { return false; } template constexpr bool has_overlap(const subview_cube&) const { return false; } constexpr bool is_aligned() const { return GenCube::is_simple; } }; template struct ProxyCube< OpCube > { typedef typename T1::elem_type elem_type; typedef typename get_pod_type::result pod_type; typedef Cube stored_type; typedef const elem_type* ea_type; typedef const Cube& aligned_ea_type; static constexpr bool use_at = false; static constexpr bool use_mp = false; static constexpr bool has_subview = false; const Cube Q; inline explicit ProxyCube(const OpCube& A) : Q(A) { arma_debug_sigprint(); } arma_inline uword get_n_rows() const { return Q.n_rows; } arma_inline uword get_n_cols() const { return Q.n_cols; } arma_inline uword get_n_elem_slice() const { return Q.n_elem_slice; } arma_inline uword get_n_slices() const { return Q.n_slices; } arma_inline uword get_n_elem() const { return Q.n_elem; } arma_inline elem_type operator[] (const uword i) const { return Q[i]; } arma_inline elem_type at (const uword r, const uword c, const uword s) const { return Q.at(r, c, s); } arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); } arma_inline ea_type get_ea() const { return Q.memptr(); } arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template constexpr bool is_alias(const Cube&) const { return false; } template constexpr bool has_overlap(const subview_cube&) const { return false; } arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); } }; template struct ProxyCube< GlueCube > { typedef typename T1::elem_type elem_type; typedef typename get_pod_type::result pod_type; typedef Cube stored_type; typedef const elem_type* ea_type; typedef const Cube& aligned_ea_type; static constexpr bool use_at = false; static constexpr bool use_mp = false; static constexpr bool has_subview = false; const Cube Q; inline explicit ProxyCube(const GlueCube& A) : Q(A) { arma_debug_sigprint(); } arma_inline uword get_n_rows() const { return Q.n_rows; } arma_inline uword get_n_cols() const { return Q.n_cols; } arma_inline uword get_n_elem_slice() const { return Q.n_elem_slice; } arma_inline uword get_n_slices() const { return Q.n_slices; } arma_inline uword get_n_elem() const { return Q.n_elem; } arma_inline elem_type operator[] (const uword i) const { return Q[i]; } arma_inline elem_type at (const uword r, const uword c, const uword s) const { return Q.at(r, c, s); } arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); } arma_inline ea_type get_ea() const { return Q.memptr(); } arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template constexpr bool is_alias(const Cube&) const { return false; } template constexpr bool has_overlap(const subview_cube&) const { return false; } arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); } }; template struct ProxyCube< subview_cube > { typedef eT elem_type; typedef typename get_pod_type::result pod_type; typedef subview_cube stored_type; typedef const subview_cube& ea_type; typedef const subview_cube& aligned_ea_type; static constexpr bool use_at = true; static constexpr bool use_mp = false; static constexpr bool has_subview = true; const subview_cube& Q; inline explicit ProxyCube(const subview_cube& A) : Q(A) { arma_debug_sigprint(); } arma_inline uword get_n_rows() const { return Q.n_rows; } arma_inline uword get_n_cols() const { return Q.n_cols; } arma_inline uword get_n_elem_slice() const { return Q.n_elem_slice; } arma_inline uword get_n_slices() const { return Q.n_slices; } arma_inline uword get_n_elem() const { return Q.n_elem; } arma_inline elem_type operator[] (const uword i) const { return Q[i]; } arma_inline elem_type at (const uword r, const uword c, const uword s) const { return Q.at(r, c, s); } arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); } arma_inline ea_type get_ea() const { return Q; } arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template arma_inline bool is_alias(const Cube& X) const { return (void_ptr(&(Q.m)) == void_ptr(&X)); } template arma_inline bool has_overlap(const subview_cube& X) const { return Q.check_overlap(X); } constexpr bool is_aligned() const { return false; } }; template struct ProxyCube< subview_cube_slices > { typedef eT elem_type; typedef typename get_pod_type::result pod_type; typedef Cube stored_type; typedef const eT* ea_type; typedef const Cube& aligned_ea_type; static constexpr bool use_at = false; static constexpr bool use_mp = false; static constexpr bool has_subview = false; const Cube Q; inline explicit ProxyCube(const subview_cube_slices& A) : Q(A) { arma_debug_sigprint(); } arma_inline uword get_n_rows() const { return Q.n_rows; } arma_inline uword get_n_cols() const { return Q.n_cols; } arma_inline uword get_n_elem_slice() const { return Q.n_elem_slice; } arma_inline uword get_n_slices() const { return Q.n_slices; } arma_inline uword get_n_elem() const { return Q.n_elem; } arma_inline elem_type operator[] (const uword i) const { return Q[i]; } arma_inline elem_type at (const uword r, const uword c, const uword s) const { return Q.at(r, c, s); } arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); } arma_inline ea_type get_ea() const { return Q.memptr(); } arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template constexpr bool is_alias(const Cube&) const { return false; } template constexpr bool has_overlap(const subview_cube&) const { return false; } arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); } }; template struct ProxyCube< eOpCube > { typedef typename T1::elem_type elem_type; typedef typename get_pod_type::result pod_type; typedef eOpCube stored_type; typedef const eOpCube& ea_type; typedef const eOpCube& aligned_ea_type; static constexpr bool use_at = eOpCube::use_at; static constexpr bool use_mp = eOpCube::use_mp; static constexpr bool has_subview = eOpCube::has_subview; const eOpCube& Q; inline explicit ProxyCube(const eOpCube& A) : Q(A) { arma_debug_sigprint(); } arma_inline uword get_n_rows() const { return Q.get_n_rows(); } arma_inline uword get_n_cols() const { return Q.get_n_cols(); } arma_inline uword get_n_elem_slice() const { return Q.get_n_elem_slice(); } arma_inline uword get_n_slices() const { return Q.get_n_slices(); } arma_inline uword get_n_elem() const { return Q.get_n_elem(); } arma_inline elem_type operator[] (const uword i) const { return Q[i]; } arma_inline elem_type at (const uword r, const uword c, const uword s) const { return Q.at(r, c, s); } arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); } arma_inline ea_type get_ea() const { return Q; } arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template arma_inline bool is_alias(const Cube& X) const { return Q.P.is_alias(X); } template arma_inline bool has_overlap(const subview_cube& X) const { return Q.P.has_overlap(X); } arma_inline bool is_aligned() const { return Q.P.is_aligned(); } }; template struct ProxyCube< eGlueCube > { typedef typename T1::elem_type elem_type; typedef typename get_pod_type::result pod_type; typedef eGlueCube stored_type; typedef const eGlueCube& ea_type; typedef const eGlueCube& aligned_ea_type; static constexpr bool use_at = eGlueCube::use_at; static constexpr bool use_mp = eGlueCube::use_mp; static constexpr bool has_subview = eGlueCube::has_subview; const eGlueCube& Q; inline explicit ProxyCube(const eGlueCube& A) : Q(A) { arma_debug_sigprint(); } arma_inline uword get_n_rows() const { return Q.get_n_rows(); } arma_inline uword get_n_cols() const { return Q.get_n_cols(); } arma_inline uword get_n_elem_slice() const { return Q.get_n_elem_slice(); } arma_inline uword get_n_slices() const { return Q.get_n_slices(); } arma_inline uword get_n_elem() const { return Q.get_n_elem(); } arma_inline elem_type operator[] (const uword i) const { return Q[i]; } arma_inline elem_type at (const uword r, const uword c, const uword s) const { return Q.at(r, c, s); } arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); } arma_inline ea_type get_ea() const { return Q; } arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template arma_inline bool is_alias(const Cube& X) const { return (Q.P1.is_alias(X) || Q.P2.is_alias(X)); } template arma_inline bool has_overlap(const subview_cube& X) const { return (Q.P1.has_overlap(X) || Q.P2.has_overlap(X)); } arma_inline bool is_aligned() const { return Q.P1.is_aligned() && Q.P2.is_aligned(); } }; template struct ProxyCube< mtOpCube > { typedef out_eT elem_type; typedef typename get_pod_type::result pod_type; typedef Cube stored_type; typedef const elem_type* ea_type; typedef const Cube& aligned_ea_type; static constexpr bool use_at = false; static constexpr bool use_mp = false; static constexpr bool has_subview = false; const Cube Q; inline explicit ProxyCube(const mtOpCube& A) : Q(A) { arma_debug_sigprint(); } arma_inline uword get_n_rows() const { return Q.n_rows; } arma_inline uword get_n_cols() const { return Q.n_cols; } arma_inline uword get_n_elem_slice() const { return Q.n_elem_slice; } arma_inline uword get_n_slices() const { return Q.n_slices; } arma_inline uword get_n_elem() const { return Q.n_elem; } arma_inline elem_type operator[] (const uword i) const { return Q[i]; } arma_inline elem_type at (const uword r, const uword c, const uword s) const { return Q.at(r, c, s); } arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); } arma_inline ea_type get_ea() const { return Q.memptr(); } arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template constexpr bool is_alias(const Cube&) const { return false; } template constexpr bool has_overlap(const subview_cube&) const { return false; } arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); } }; template struct ProxyCube< mtGlueCube > { typedef out_eT elem_type; typedef typename get_pod_type::result pod_type; typedef Cube stored_type; typedef const elem_type* ea_type; typedef const Cube& aligned_ea_type; static constexpr bool use_at = false; static constexpr bool use_mp = false; static constexpr bool has_subview = false; const Cube Q; inline explicit ProxyCube(const mtGlueCube& A) : Q(A) { arma_debug_sigprint(); } arma_inline uword get_n_rows() const { return Q.n_rows; } arma_inline uword get_n_cols() const { return Q.n_cols; } arma_inline uword get_n_elem_slice() const { return Q.n_elem_slice; } arma_inline uword get_n_slices() const { return Q.n_slices; } arma_inline uword get_n_elem() const { return Q.n_elem; } arma_inline elem_type operator[] (const uword i) const { return Q[i]; } arma_inline elem_type at (const uword r, const uword c, const uword s) const { return Q.at(r, c, s); } arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); } arma_inline ea_type get_ea() const { return Q.memptr(); } arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template constexpr bool is_alias(const Cube&) const { return false; } template constexpr bool has_overlap(const subview_cube&) const { return false; } arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); } }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_stddev_bones.hpp0000644000176200001440000000247415030507611024263 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_stddev //! @{ class op_stddev : public traits_op_xvec { public: template inline static void apply(Mat& out, const mtOp& in); template inline static void apply_noalias(Mat::result>& out, const Mat& X, const uword norm_type, const uword dim); template inline static typename T1::pod_type stddev_vec(const T1& X, const uword norm_type = 0); }; //! @} RcppArmadillo/inst/include/armadillo_bits/xtrans_mat_bones.hpp0000644000176200001440000000330514301267044024451 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup xtrans_mat //! @{ template class xtrans_mat : public Base< eT, xtrans_mat > { public: typedef eT elem_type; typedef typename get_pod_type::result pod_type; static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = false; static constexpr bool really_do_conj = (do_conj && is_cx::yes); arma_aligned const Mat& X; arma_aligned mutable Mat Y; arma_aligned const uword n_rows; arma_aligned const uword n_cols; arma_aligned const uword n_elem; inline explicit xtrans_mat(const Mat& in_X); inline void extract(Mat& out) const; inline eT operator[](const uword ii) const; inline eT at_alt (const uword ii) const; arma_inline eT at(const uword in_row, const uword in_col) const; }; //! @} RcppArmadillo/inst/include/armadillo_bits/spop_htrans_bones.hpp0000644000176200001440000000303314301267044024627 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup spop_htrans //! @{ //! hermitian transpose operation for sparse matrices class spop_htrans { public: template struct traits { static constexpr bool is_row = T1::is_col; // deliberately swapped static constexpr bool is_col = T1::is_row; static constexpr bool is_xvec = T1::is_xvec; }; template inline static void apply(SpMat& out, const SpOp& in, const typename arma_not_cx::result* junk = nullptr); template inline static void apply(SpMat& out, const SpOp& in, const typename arma_cx_only::result* junk = nullptr); }; //! @} RcppArmadillo/inst/include/armadillo_bits/glue_cor_meat.hpp0000644000176200001440000000421714631567470023727 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup glue_cor //! @{ template inline void glue_cor::apply(Mat& out, const Glue& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword norm_type = X.aux_uword; const unwrap UA(X.A); const unwrap UB(X.B); const Mat& A = UA.M; const Mat& B = UB.M; const Mat& AA = (A.n_rows == 1) ? Mat(const_cast(A.memptr()), A.n_cols, A.n_rows, false, false) : Mat(const_cast(A.memptr()), A.n_rows, A.n_cols, false, false); const Mat& BB = (B.n_rows == 1) ? Mat(const_cast(B.memptr()), B.n_cols, B.n_rows, false, false) : Mat(const_cast(B.memptr()), B.n_rows, B.n_cols, false, false); arma_conform_assert_mul_size(AA, BB, true, false, "cor()"); if( (AA.n_elem == 0) || (BB.n_elem == 0) ) { out.reset(); return; } const uword N = AA.n_rows; const eT norm_val = (norm_type == 0) ? ( (N > 1) ? eT(N-1) : eT(1) ) : eT(N); const Mat tmp1 = AA.each_row() - mean(AA,0); const Mat tmp2 = BB.each_row() - mean(BB,0); out = tmp1.t() * tmp2; out /= norm_val; out /= conv_to< Mat >::from( stddev(AA).t() * stddev(BB) ); // TODO: check for zeros? } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_norm.hpp0000644000176200001440000002067114631567470022562 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_norm //! @{ template arma_warn_unused inline typename enable_if2< is_arma_type::value, typename T1::pod_type >::result norm ( const T1& X, const uword k = uword(2), const typename arma_real_or_cx_only::result* junk = nullptr ) { arma_debug_sigprint(); arma_ignore(junk); typedef typename T1::pod_type T; const Proxy P(X); if(P.get_n_elem() == 0) { return T(0); } const bool is_vec = (T1::is_xvec) || (T1::is_row) || (T1::is_col) || (P.get_n_rows() == 1) || (P.get_n_cols() == 1); if(is_vec) { if(k == uword(1)) { return op_norm::vec_norm_1(P); } if(k == uword(2)) { return op_norm::vec_norm_2(P); } arma_conform_check( (k == 0), "norm(): unsupported vector norm type" ); return op_norm::vec_norm_k(P, int(k)); } else { const quasi_unwrap::stored_type> U(P.Q); if(k == uword(1)) { return op_norm::mat_norm_1(U.M); } if(k == uword(2)) { return op_norm::mat_norm_2(U.M); } arma_stop_logic_error("norm(): unsupported matrix norm type"); } return T(0); } template arma_warn_unused inline typename enable_if2< is_arma_type::value, typename T1::pod_type >::result norm ( const T1& X, const char* method, const typename arma_real_or_cx_only::result* junk = nullptr ) { arma_debug_sigprint(); arma_ignore(junk); typedef typename T1::pod_type T; const Proxy P(X); if(P.get_n_elem() == 0) { return T(0); } const char sig = (method != nullptr) ? method[0] : char(0); const bool is_vec = (T1::is_xvec) || (T1::is_row) || (T1::is_col) || (P.get_n_rows() == 1) || (P.get_n_cols() == 1); if(is_vec) { if( (sig == 'i') || (sig == 'I') || (sig == '+') ) { return op_norm::vec_norm_max(P); } if( (sig == '-') ) { return op_norm::vec_norm_min(P); } if( (sig == 'f') || (sig == 'F') ) { return op_norm::vec_norm_2(P); } arma_stop_logic_error("norm(): unsupported vector norm type"); } else { if( (sig == 'i') || (sig == 'I') || (sig == '+') ) // inf norm { const quasi_unwrap::stored_type> U(P.Q); return op_norm::mat_norm_inf(U.M); } else if( (sig == 'f') || (sig == 'F') ) { return op_norm::vec_norm_2(P); } arma_stop_logic_error("norm(): unsupported matrix norm type"); } return T(0); } template arma_warn_unused inline typename enable_if2< is_arma_type::value, double >::result norm ( const T1& X, const uword k = uword(2), const typename arma_integral_only::result* junk = nullptr ) { arma_debug_sigprint(); arma_ignore(junk); if(resolves_to_colvector::value) { return norm(conv_to< Col >::from(X), k); } if(resolves_to_rowvector::value) { return norm(conv_to< Row >::from(X), k); } return norm(conv_to< Mat >::from(X), k); } template arma_warn_unused inline typename enable_if2< is_arma_type::value, double >::result norm ( const T1& X, const char* method, const typename arma_integral_only::result* junk = nullptr ) { arma_debug_sigprint(); arma_ignore(junk); if(resolves_to_colvector::value) { return norm(conv_to< Col >::from(X), method); } if(resolves_to_rowvector::value) { return norm(conv_to< Row >::from(X), method); } return norm(conv_to< Mat >::from(X), method); } // // norms for sparse matrices template arma_warn_unused inline typename enable_if2< is_arma_sparse_type::value, typename T1::pod_type >::result norm ( const T1& expr, const uword k = uword(2), const typename arma_real_or_cx_only::result* junk = nullptr ) { arma_debug_sigprint(); arma_ignore(junk); typedef typename T1::elem_type eT; typedef typename T1::pod_type T; if(is_SpSubview_col::value) { const SpSubview_col& sv = reinterpret_cast< const SpSubview_col& >(expr); if(sv.n_rows == sv.m.n_rows) { const SpMat& m = sv.m; const uword col = sv.aux_col1; const eT* mem = &(m.values[ m.col_ptrs[col] ]); return spop_norm::vec_norm_k(mem, sv.n_nonzero, k); } } const unwrap_spmat U(expr); const SpMat& X = U.M; if(X.n_nonzero == 0) { return T(0); } const bool is_vec = (T1::is_xvec) || (T1::is_row) || (T1::is_col) || (X.n_rows == 1) || (X.n_cols == 1); if(is_vec) { return spop_norm::vec_norm_k(X.values, X.n_nonzero, k); } else { if(k == uword(1)) { return spop_norm::mat_norm_1(X); } if(k == uword(2)) { return spop_norm::mat_norm_2(X); } arma_stop_logic_error("norm(): unsupported or unimplemented norm type for sparse matrices"); } return T(0); } template arma_warn_unused inline typename enable_if2< is_arma_sparse_type::value, typename T1::pod_type >::result norm ( const T1& expr, const char* method, const typename arma_real_or_cx_only::result* junk = nullptr ) { arma_debug_sigprint(); arma_ignore(junk); typedef typename T1::elem_type eT; typedef typename T1::pod_type T; const unwrap_spmat U(expr); const SpMat& X = U.M; if(X.n_nonzero == 0) { return T(0); } // create a fake dense vector to allow reuse of code for dense vectors Col fake_vector( access::rwp(X.values), X.n_nonzero, false ); const Proxy< Col > P_fake_vector(fake_vector); const char sig = (method != nullptr) ? method[0] : char(0); const bool is_vec = (T1::is_xvec) || (T1::is_row) || (T1::is_col) || (X.n_rows == 1) || (X.n_cols == 1); if(is_vec) { if( (sig == 'i') || (sig == 'I') || (sig == '+') ) // max norm { return op_norm::vec_norm_max(P_fake_vector); } else if(sig == '-') // min norm { const T val = op_norm::vec_norm_min(P_fake_vector); return (X.n_nonzero < X.n_elem) ? T((std::min)(T(0), val)) : T(val); } else if( (sig == 'f') || (sig == 'F') ) { return op_norm::vec_norm_2(P_fake_vector); } arma_stop_logic_error("norm(): unsupported vector norm type"); } else { if( (sig == 'i') || (sig == 'I') || (sig == '+') ) // inf norm { return spop_norm::mat_norm_inf(X); } else if( (sig == 'f') || (sig == 'F') ) { return op_norm::vec_norm_2(P_fake_vector); } arma_stop_logic_error("norm(): unsupported matrix norm type"); } return T(0); } // // approximate norms template arma_warn_unused inline typename T1::pod_type norm2est ( const Base& X, const typename T1::pod_type tolerance = 0, const uword max_iter = 100, const typename arma_real_or_cx_only::result* junk = nullptr ) { arma_debug_sigprint(); arma_ignore(junk); return op_norm2est::norm2est(X.get_ref(), tolerance, max_iter); } template arma_warn_unused inline typename T1::pod_type norm2est ( const SpBase& X, const typename T1::pod_type tolerance = 0, const uword max_iter = 100, const typename arma_real_or_cx_only::result* junk = nullptr ) { arma_debug_sigprint(); arma_ignore(junk); return op_norm2est::norm2est(X.get_ref(), tolerance, max_iter); } //! @} RcppArmadillo/inst/include/armadillo_bits/auxlib_meat.hpp0000644000176200001440000066045215030507611023406 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup auxlib //! @{ template inline bool auxlib::inv(Mat& A) { arma_debug_sigprint(); // NOTE: given a matrix with NaN values, lapack::getrf() and lapack::getri() do not necessarily fail, // NOTE: and can produce matrices with NaN values. // NOTE: we're not checking for non-finite values to avoid breaking existing user code. if(A.is_empty()) { return true; } #if defined(ARMA_USE_LAPACK) { arma_conform_assert_blas_size(A); blas_int n = blas_int(A.n_rows); blas_int lda = blas_int(A.n_rows); blas_int lwork = (std::max)(blas_int(podarray_prealloc_n_elem::val), n); blas_int info = 0; podarray ipiv(A.n_rows); arma_debug_print("lapack::getrf()"); lapack::getrf(&n, &n, A.memptr(), &lda, ipiv.memptr(), &info); if(info != 0) { return false; } if(n > blas_int(podarray_prealloc_n_elem::val)) { eT work_query[2] = {}; blas_int lwork_query = -1; arma_debug_print("lapack::getri()"); lapack::getri(&n, A.memptr(), &lda, ipiv.memptr(), &work_query[0], &lwork_query, &info); if(info != 0) { return false; } blas_int lwork_proposed = static_cast( access::tmp_real(work_query[0]) ); lwork = (std::max)(lwork_proposed, lwork); } podarray work( static_cast(lwork) ); arma_debug_print("lapack::getri()"); lapack::getri(&n, A.memptr(), &lda, ipiv.memptr(), work.memptr(), &lwork, &info); return (info == 0); } #else { arma_ignore(A); arma_stop_logic_error("inv(): use of LAPACK must be enabled"); return false; } #endif } template inline bool auxlib::inv(Mat& out, const Mat& X) { arma_debug_sigprint(); out = X; return auxlib::inv(out); } template inline bool auxlib::inv_rcond(Mat& A, typename get_pod_type::result& out_rcond) { arma_debug_sigprint(); typedef typename get_pod_type::result T; out_rcond = T(0); if(A.is_empty()) { return true; } #if defined(ARMA_USE_LAPACK) { arma_conform_assert_blas_size(A); char norm_id = '1'; blas_int n = blas_int(A.n_rows); blas_int lda = blas_int(A.n_rows); blas_int lwork = (std::max)(blas_int(podarray_prealloc_n_elem::val), n); blas_int info = 0; T norm_val = T(0); podarray junk(1); podarray ipiv(A.n_rows); arma_debug_print("lapack::lange()"); norm_val = (has_blas_float_bug::value) ? auxlib::norm1_gen(A) : lapack::lange(&norm_id, &n, &n, A.memptr(), &lda, junk.memptr()); arma_debug_print("lapack::getrf()"); lapack::getrf(&n, &n, A.memptr(), &lda, ipiv.memptr(), &info); if(info != 0) { return false; } out_rcond = auxlib::lu_rcond(A, norm_val); if(n > blas_int(podarray_prealloc_n_elem::val)) { eT work_query[2] = {}; blas_int lwork_query = -1; arma_debug_print("lapack::getri()"); lapack::getri(&n, A.memptr(), &lda, ipiv.memptr(), &work_query[0], &lwork_query, &info); if(info != 0) { return false; } blas_int lwork_proposed = static_cast( access::tmp_real(work_query[0]) ); lwork = (std::max)(lwork_proposed, lwork); } podarray work( static_cast(lwork) ); arma_debug_print("lapack::getri()"); lapack::getri(&n, A.memptr(), &lda, ipiv.memptr(), work.memptr(), &lwork, &info); return (info == 0); } #else { arma_ignore(A); arma_stop_logic_error("inv_rcond(): use of LAPACK must be enabled"); return false; } #endif } template inline bool auxlib::inv_tr(Mat& A, const uword layout) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { if(A.is_empty()) { return true; } arma_conform_assert_blas_size(A); char uplo = (layout == 0) ? 'U' : 'L'; char diag = 'N'; blas_int n = blas_int(A.n_rows); blas_int info = 0; arma_debug_print("lapack::trtri()"); lapack::trtri(&uplo, &diag, &n, A.memptr(), &n, &info); if(info != 0) { return false; } return true; } #else { arma_ignore(A); arma_ignore(layout); arma_stop_logic_error("inv(): use of LAPACK must be enabled"); return false; } #endif } template inline bool auxlib::inv_tr_rcond(Mat& A, typename get_pod_type::result& out_rcond, const uword layout) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { typedef typename get_pod_type::result T; if(A.is_empty()) { return true; } out_rcond = auxlib::rcond_trimat(A, layout); arma_conform_assert_blas_size(A); char uplo = (layout == 0) ? 'U' : 'L'; char diag = 'N'; blas_int n = blas_int(A.n_rows); blas_int info = 0; arma_debug_print("lapack::trtri()"); lapack::trtri(&uplo, &diag, &n, A.memptr(), &n, &info); if(info != 0) { out_rcond = T(0); return false; } return true; } #else { arma_ignore(A); arma_ignore(out_rcond); arma_ignore(layout); arma_stop_logic_error("inv(): use of LAPACK must be enabled"); return false; } #endif } template inline bool auxlib::inv_sym(Mat& A) { arma_debug_sigprint(); if(A.is_empty()) { return true; } #if defined(ARMA_USE_LAPACK) { arma_conform_assert_blas_size(A); char uplo = 'L'; blas_int n = blas_int(A.n_rows); blas_int lda = blas_int(A.n_rows); blas_int lwork = (std::max)(blas_int(podarray_prealloc_n_elem::val), n); blas_int info = 0; podarray ipiv(A.n_rows); if(n > blas_int(podarray_prealloc_n_elem::val)) { eT work_query[2] = {}; blas_int lwork_query = -1; arma_debug_print("lapack::sytrf()"); lapack::sytrf(&uplo, &n, A.memptr(), &lda, ipiv.memptr(), &work_query[0], &lwork_query, &info); if(info != 0) { return false; } blas_int lwork_proposed = static_cast( access::tmp_real(work_query[0]) ); lwork = (std::max)(lwork_proposed, lwork); } podarray work( static_cast(lwork) ); arma_debug_print("lapack::sytrf()"); lapack::sytrf(&uplo, &n, A.memptr(), &lda, ipiv.memptr(), work.memptr(), &lwork, &info); if(info != 0) { return false; } arma_debug_print("lapack::sytri()"); lapack::sytri(&uplo, &n, A.memptr(), &lda, ipiv.memptr(), work.memptr(), &info); if(info != 0) { return false; } A = symmatl(A); return true; } #else { arma_ignore(A); arma_stop_logic_error("inv_sym(): use of LAPACK must be enabled"); return false; } #endif } template inline bool auxlib::inv_sym(Mat< std::complex >& A) { arma_debug_sigprint(); // NOTE: the function name is required for overloading, but is a misnomer: it processes complex hermitian matrices if(A.is_empty()) { return true; } #if defined(ARMA_CRIPPLED_LAPACK) { arma_debug_print("auxlib::inv_sym(): redirecting to auxlib::inv() due to crippled LAPACK"); return auxlib::inv(A); } #elif defined(ARMA_USE_LAPACK) { typedef typename std::complex eT; arma_conform_assert_blas_size(A); char uplo = 'L'; blas_int n = blas_int(A.n_rows); blas_int lda = blas_int(A.n_rows); blas_int lwork = (std::max)(blas_int(podarray_prealloc_n_elem::val), n); blas_int info = 0; podarray ipiv(A.n_rows); if(n > blas_int(podarray_prealloc_n_elem::val)) { eT work_query[2] = {}; blas_int lwork_query = -1; arma_debug_print("lapack::hetrf()"); lapack::hetrf(&uplo, &n, A.memptr(), &lda, ipiv.memptr(), &work_query[0], &lwork_query, &info); if(info != 0) { return false; } blas_int lwork_proposed = static_cast( access::tmp_real(work_query[0]) ); lwork = (std::max)(lwork_proposed, lwork); } podarray work( static_cast(lwork) ); arma_debug_print("lapack::hetrf()"); lapack::hetrf(&uplo, &n, A.memptr(), &lda, ipiv.memptr(), work.memptr(), &lwork, &info); if(info != 0) { return false; } arma_debug_print("lapack::hetri()"); lapack::hetri(&uplo, &n, A.memptr(), &lda, ipiv.memptr(), work.memptr(), &info); if(info != 0) { return false; } A = symmatl(A); return true; } #else { arma_ignore(A); arma_stop_logic_error("inv_sym(): use of LAPACK must be enabled"); return false; } #endif } template inline bool auxlib::inv_sym_rcond(Mat& A, eT& out_rcond) { arma_debug_sigprint(); out_rcond = eT(0); if(A.is_empty()) { return true; } #if defined(ARMA_USE_LAPACK) { arma_conform_assert_blas_size(A); char norm_id = '1'; char uplo = 'L'; blas_int n = blas_int(A.n_rows); blas_int lda = blas_int(A.n_rows); blas_int lwork = (std::max)(blas_int(podarray_prealloc_n_elem::val), 2*n); // 2*n due to lapack::sycon() requirements blas_int info = 0; eT norm_val = eT(0); eT tmp_rcond = eT(0); podarray ipiv(A.n_rows); podarray iwork(A.n_rows); if( (2*n) > blas_int(podarray_prealloc_n_elem::val) ) { eT work_query[2] = {}; blas_int lwork_query = -1; arma_debug_print("lapack::sytrf()"); lapack::sytrf(&uplo, &n, A.memptr(), &lda, ipiv.memptr(), &work_query[0], &lwork_query, &info); if(info != 0) { return false; } blas_int lwork_proposed = static_cast( access::tmp_real(work_query[0]) ); lwork = (std::max)(lwork_proposed, lwork); } podarray work( static_cast(lwork) ); arma_debug_print("lapack::lansy()"); norm_val = (has_blas_float_bug::value) ? auxlib::norm1_sym(A) : lapack::lansy(&norm_id, &uplo, &n, A.memptr(), &lda, work.memptr()); arma_debug_print("lapack::sytrf()"); lapack::sytrf(&uplo, &n, A.memptr(), &lda, ipiv.memptr(), work.memptr(), &lwork, &info); if(info != 0) { return false; } arma_debug_print("lapack::sycon()"); lapack::sycon(&uplo, &n, A.memptr(), &lda, ipiv.memptr(), &norm_val, &tmp_rcond, work.memptr(), iwork.memptr(), &info); if(info != 0) { return false; } out_rcond = tmp_rcond; if(arma_isnan(out_rcond)) { return false; } arma_debug_print("lapack::sytri()"); lapack::sytri(&uplo, &n, A.memptr(), &lda, ipiv.memptr(), work.memptr(), &info); if(info != 0) { return false; } A = symmatl(A); return true; } #else { arma_ignore(A); arma_ignore(out_rcond); arma_stop_logic_error("inv_sym_rcond(): use of LAPACK must be enabled"); return false; } #endif } template inline bool auxlib::inv_sym_rcond(Mat< std::complex >& A, T& out_rcond) { arma_debug_sigprint(); // NOTE: the function name is required for overloading, but is a misnomer: it processes complex hermitian matrices out_rcond = T(0); if(A.is_empty()) { return true; } #if defined(ARMA_CRIPPLED_LAPACK) { arma_debug_print("auxlib::inv_sym_rcond(): redirecting to auxlib::inv_rcond() due to crippled LAPACK"); return auxlib::inv_rcond(A, out_rcond); } #elif defined(ARMA_USE_LAPACK) { typedef typename std::complex eT; arma_conform_assert_blas_size(A); char norm_id = '1'; char uplo = 'L'; blas_int n = blas_int(A.n_rows); blas_int lda = blas_int(A.n_rows); blas_int lwork = (std::max)(blas_int(podarray_prealloc_n_elem::val), 2*n); // 2*n due to lapack::hecon() requirements blas_int info = 0; T norm_val = T(0); T tmp_rcond = T(0); podarray ipiv(A.n_rows); podarray lanhe_work(A.n_rows); if( (2*n) > blas_int(podarray_prealloc_n_elem::val) ) { eT work_query[2] = {}; blas_int lwork_query = -1; arma_debug_print("lapack::hetrf()"); lapack::hetrf(&uplo, &n, A.memptr(), &lda, ipiv.memptr(), &work_query[0], &lwork_query, &info); if(info != 0) { return false; } blas_int lwork_proposed = static_cast( access::tmp_real(work_query[0]) ); lwork = (std::max)(lwork_proposed, lwork); } podarray work( static_cast(lwork) ); arma_debug_print("lapack::lanhe()"); norm_val = (has_blas_float_bug::value) ? auxlib::norm1_sym(A) : lapack::lanhe(&norm_id, &uplo, &n, A.memptr(), &lda, lanhe_work.memptr()); arma_debug_print("lapack::hetrf()"); lapack::hetrf(&uplo, &n, A.memptr(), &lda, ipiv.memptr(), work.memptr(), &lwork, &info); if(info != 0) { return false; } arma_debug_print("lapack::hecon()"); lapack::hecon(&uplo, &n, A.memptr(), &lda, ipiv.memptr(), &norm_val, &tmp_rcond, work.memptr(), &info); if(info != 0) { return false; } out_rcond = tmp_rcond; if(arma_isnan(out_rcond)) { return false; } arma_debug_print("lapack::hetri()"); lapack::hetri(&uplo, &n, A.memptr(), &lda, ipiv.memptr(), work.memptr(), &info); if(info != 0) { return false; } A = symmatl(A); return true; } #else { arma_ignore(A); arma_ignore(out_rcond); arma_stop_logic_error("inv_sym_rcond(): use of LAPACK must be enabled"); return false; } #endif } template inline bool auxlib::inv_sympd(Mat& A, bool& out_sympd_state) { arma_debug_sigprint(); out_sympd_state = false; if(A.is_empty()) { return true; } #if defined(ARMA_USE_LAPACK) { arma_conform_assert_blas_size(A); char uplo = 'L'; blas_int n = blas_int(A.n_rows); blas_int info = 0; // NOTE: for complex matrices, zpotrf() assumes the matrix is hermitian (not simply symmetric) arma_debug_print("lapack::potrf()"); lapack::potrf(&uplo, &n, A.memptr(), &n, &info); if(info != 0) { return false; } out_sympd_state = true; arma_debug_print("lapack::potri()"); lapack::potri(&uplo, &n, A.memptr(), &n, &info); if(info != 0) { return false; } A = symmatl(A); return true; } #else { arma_ignore(A); arma_ignore(out_sympd_state); arma_stop_logic_error("inv_sympd(): use of LAPACK must be enabled"); return false; } #endif } template inline bool auxlib::inv_sympd(Mat& out, const Mat& X) { arma_debug_sigprint(); out = X; bool sympd_state_junk = false; return auxlib::inv_sympd(out, sympd_state_junk); } template inline bool auxlib::inv_sympd_rcond(Mat& A, eT& out_rcond) { arma_debug_sigprint(); if(A.is_empty()) { return true; } #if defined(ARMA_USE_LAPACK) { typedef typename get_pod_type::result T; arma_conform_assert_blas_size(A); char norm_id = '1'; char uplo = 'L'; blas_int n = blas_int(A.n_rows); blas_int info = 0; T norm_val = T(0); podarray work(A.n_rows); arma_debug_print("lapack::lansy()"); norm_val = (has_blas_float_bug::value) ? auxlib::norm1_sym(A) : lapack::lansy(&norm_id, &uplo, &n, A.memptr(), &n, work.memptr()); arma_debug_print("lapack::potrf()"); lapack::potrf(&uplo, &n, A.memptr(), &n, &info); if(info != 0) { out_rcond = eT(0); return false; } out_rcond = auxlib::lu_rcond_sympd(A, norm_val); if(arma_isnan(out_rcond)) { return false; } arma_debug_print("lapack::potri()"); lapack::potri(&uplo, &n, A.memptr(), &n, &info); if(info != 0) { return false; } A = symmatl(A); return true; } #else { arma_ignore(A); arma_ignore(out_rcond); arma_stop_logic_error("inv_sympd_rcond(): use LAPACK must be enabled"); return false; } #endif } template inline bool auxlib::inv_sympd_rcond(Mat< std::complex >& A, T& out_rcond) { arma_debug_sigprint(); if(A.is_empty()) { return true; } #if defined(ARMA_CRIPPLED_LAPACK) { arma_ignore(A); arma_ignore(out_rcond); return false; } #elif defined(ARMA_USE_LAPACK) { arma_conform_assert_blas_size(A); char norm_id = '1'; char uplo = 'L'; blas_int n = blas_int(A.n_rows); blas_int info = 0; T norm_val = T(0); podarray work(A.n_rows); arma_debug_print("lapack::lanhe()"); norm_val = (has_blas_float_bug::value) ? auxlib::norm1_sym(A) : lapack::lanhe(&norm_id, &uplo, &n, A.memptr(), &n, work.memptr()); arma_debug_print("lapack::potrf()"); lapack::potrf(&uplo, &n, A.memptr(), &n, &info); if(info != 0) { out_rcond = T(0); return false; } out_rcond = auxlib::lu_rcond_sympd(A, norm_val); if(arma_isnan(out_rcond)) { return false; } arma_debug_print("lapack::potri()"); lapack::potri(&uplo, &n, A.memptr(), &n, &info); if(info != 0) { return false; } A = symmatl(A); return true; } #else { arma_ignore(A); arma_ignore(out_rcond); arma_stop_logic_error("inv_sympd_rcond(): use LAPACK must be enabled"); return false; } #endif } //! determinant of a matrix template inline bool auxlib::det(eT& out_val, Mat& A) { arma_debug_sigprint(); if(A.is_empty()) { out_val = eT(1); return true; } #if defined(ARMA_USE_LAPACK) { arma_conform_assert_blas_size(A); podarray ipiv(A.n_rows); blas_int info = 0; blas_int n_rows = blas_int(A.n_rows); blas_int n_cols = blas_int(A.n_cols); arma_debug_print("lapack::getrf()"); lapack::getrf(&n_rows, &n_cols, A.memptr(), &n_rows, ipiv.memptr(), &info); if(info < 0) { return false; } // on output A appears to be L+U_alt, where U_alt is U with the main diagonal set to zero eT val = A.at(0,0); for(uword i=1; i < A.n_rows; ++i) { val *= A.at(i,i); } blas_int sign = +1; for(uword i=0; i < A.n_rows; ++i) { // NOTE: adjustment of -1 is required as Fortran counts from 1 if( blas_int(i) != (ipiv.mem[i] - 1) ) { sign *= -1; } } out_val = (sign < 0) ? eT(-val) : eT(val); return true; } #else { arma_ignore(out_val); arma_ignore(A); arma_stop_logic_error("det(): use of LAPACK must be enabled"); return false; } #endif } //! log determinant of a matrix template inline bool auxlib::log_det(eT& out_val, typename get_pod_type::result& out_sign, Mat& A) { arma_debug_sigprint(); typedef typename get_pod_type::result T; if(A.is_empty()) { out_val = eT(0); out_sign = T(1); return true; } #if defined(ARMA_USE_LAPACK) { arma_conform_assert_blas_size(A); podarray ipiv(A.n_rows); blas_int info = 0; blas_int n_rows = blas_int(A.n_rows); blas_int n_cols = blas_int(A.n_cols); arma_debug_print("lapack::getrf()"); lapack::getrf(&n_rows, &n_cols, A.memptr(), &n_rows, ipiv.memptr(), &info); if(info < 0) { return false; } // on output A appears to be L+U_alt, where U_alt is U with the main diagonal set to zero sword sign = (is_cx::no) ? ( (access::tmp_real( A.at(0,0) ) < T(0)) ? -1 : +1 ) : +1; eT val = (is_cx::no) ? std::log( (access::tmp_real( A.at(0,0) ) < T(0)) ? A.at(0,0)*T(-1) : A.at(0,0) ) : std::log( A.at(0,0) ); for(uword i=1; i < A.n_rows; ++i) { const eT x = A.at(i,i); sign *= (is_cx::no) ? ( (access::tmp_real(x) < T(0)) ? -1 : +1 ) : +1; val += (is_cx::no) ? std::log( (access::tmp_real(x) < T(0)) ? x*T(-1) : x ) : std::log(x); } for(uword i=0; i < A.n_rows; ++i) { if( blas_int(i) != (ipiv.mem[i] - 1) ) // NOTE: adjustment of -1 is required as Fortran counts from 1 { sign *= -1; } } out_val = val; out_sign = T(sign); return true; } #else { arma_ignore(A); arma_ignore(out_val); arma_ignore(out_sign); arma_stop_logic_error("log_det(): use of LAPACK must be enabled"); return false; } #endif } template inline bool auxlib::log_det_sympd(typename get_pod_type::result& out_val, Mat& A) { arma_debug_sigprint(); typedef typename get_pod_type::result T; if(A.is_empty()) { out_val = T(0); return true; } #if defined(ARMA_USE_LAPACK) { arma_conform_assert_blas_size(A); char uplo = 'L'; blas_int n = blas_int(A.n_rows); blas_int info = 0; arma_debug_print("lapack::potrf()"); lapack::potrf(&uplo, &n, A.memptr(), &n, &info); if(info != 0) { return false; } T val = T(0); for(uword i=0; i < A.n_rows; ++i) { val += std::log( access::tmp_real(A.at(i,i)) ); } out_val = T(2) * val; return true; } #else { arma_ignore(out_val); arma_ignore(A); arma_stop_logic_error("log_det_sympd(): use of LAPACK must be enabled"); return false; } #endif } //! LU decomposition of a matrix template inline bool auxlib::lu(Mat& L, Mat& U, podarray& ipiv, const Base& X) { arma_debug_sigprint(); U = X.get_ref(); const uword U_n_rows = U.n_rows; const uword U_n_cols = U.n_cols; if(U.is_empty()) { L.set_size(U_n_rows, 0); U.set_size(0, U_n_cols); ipiv.reset(); return true; } #if defined(ARMA_USE_LAPACK) { arma_conform_assert_blas_size(U); ipiv.set_size( (std::min)(U_n_rows, U_n_cols) ); blas_int info = 0; blas_int n_rows = blas_int(U_n_rows); blas_int n_cols = blas_int(U_n_cols); arma_debug_print("lapack::getrf()"); lapack::getrf(&n_rows, &n_cols, U.memptr(), &n_rows, ipiv.memptr(), &info); if(info < 0) { return false; } // take into account that Fortran counts from 1 arrayops::inplace_minus(ipiv.memptr(), blas_int(1), ipiv.n_elem); L.copy_size(U); for(uword col=0; col < U_n_cols; ++col) { for(uword row=0; (row < col) && (row < U_n_rows); ++row) { L.at(row,col) = eT(0); } if( L.in_range(col,col) ) { L.at(col,col) = eT(1); } for(uword row = (col+1); row < U_n_rows; ++row) { L.at(row,col) = U.at(row,col); U.at(row,col) = eT(0); } } return true; } #else { arma_stop_logic_error("lu(): use of LAPACK must be enabled"); return false; } #endif } template inline bool auxlib::lu(Mat& L, Mat& U, Mat& P, const Base& X) { arma_debug_sigprint(); podarray ipiv1; const bool status = auxlib::lu(L, U, ipiv1, X); if(status == false) { return false; } if(U.is_empty()) { // L and U have been already set to the correct empty matrices P.eye(L.n_rows, L.n_rows); return true; } const uword n = ipiv1.n_elem; const uword P_rows = U.n_rows; podarray ipiv2(P_rows); const blas_int* ipiv1_mem = ipiv1.memptr(); blas_int* ipiv2_mem = ipiv2.memptr(); for(uword i=0; i(ipiv1_mem[i]); if( ipiv2_mem[i] != ipiv2_mem[k] ) { std::swap( ipiv2_mem[i], ipiv2_mem[k] ); } } P.zeros(P_rows, P_rows); for(uword row=0; row(ipiv2_mem[row])) = eT(1); } if(L.n_cols > U.n_rows) { L.shed_cols(U.n_rows, L.n_cols-1); } if(U.n_rows > L.n_cols) { U.shed_rows(L.n_cols, U.n_rows-1); } return true; } template inline bool auxlib::lu(Mat& L, Mat& U, const Base& X) { arma_debug_sigprint(); podarray ipiv1; const bool status = auxlib::lu(L, U, ipiv1, X); if(status == false) { return false; } if(U.is_empty()) { // L and U have been already set to the correct empty matrices return true; } const uword n = ipiv1.n_elem; const uword P_rows = U.n_rows; podarray ipiv2(P_rows); const blas_int* ipiv1_mem = ipiv1.memptr(); blas_int* ipiv2_mem = ipiv2.memptr(); for(uword i=0; i(ipiv1_mem[i]); if( ipiv2_mem[i] != ipiv2_mem[k] ) { std::swap( ipiv2_mem[i], ipiv2_mem[k] ); L.swap_rows( static_cast(ipiv2_mem[i]), static_cast(ipiv2_mem[k]) ); } } if(L.n_cols > U.n_rows) { L.shed_cols(U.n_rows, L.n_cols-1); } if(U.n_rows > L.n_cols) { U.shed_rows(L.n_cols, U.n_rows-1); } return true; } //! eigen decomposition of general square matrix (real) template inline bool auxlib::eig_gen ( Mat< std::complex >& vals, Mat< std::complex >& vecs, const bool vecs_on, const Base& expr ) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { typedef typename T1::pod_type T; Mat X = expr.get_ref(); arma_conform_check( (X.is_square() == false), "eig_gen(): given matrix must be square sized" ); arma_conform_assert_blas_size(X); if(X.is_empty()) { vals.reset(); vecs.reset(); return true; } if(arma_config::check_nonfinite && X.internal_has_nonfinite()) { return false; } vals.set_size(X.n_rows, 1); Mat tmp(1, 1, arma_nozeros_indicator()); if(vecs_on) { vecs.set_size(X.n_rows, X.n_rows); tmp.set_size(X.n_rows, X.n_rows); } podarray junk(1); char jobvl = 'N'; char jobvr = (vecs_on) ? 'V' : 'N'; blas_int N = blas_int(X.n_rows); T* vl = junk.memptr(); T* vr = (vecs_on) ? tmp.memptr() : junk.memptr(); blas_int ldvl = blas_int(1); blas_int ldvr = (vecs_on) ? blas_int(tmp.n_rows) : blas_int(1); blas_int lwork = 64*N; // lwork_min = (vecs_on) ? (std::max)(blas_int(1), 4*N) : (std::max)(blas_int(1), 3*N) blas_int info = 0; podarray work( static_cast(lwork) ); podarray vals_real(X.n_rows); podarray vals_imag(X.n_rows); arma_debug_print("lapack::geev() -- START"); lapack::geev(&jobvl, &jobvr, &N, X.memptr(), &N, vals_real.memptr(), vals_imag.memptr(), vl, &ldvl, vr, &ldvr, work.memptr(), &lwork, &info); arma_debug_print("lapack::geev() -- END"); if(info != 0) { return false; } arma_debug_print("reformatting eigenvalues and eigenvectors"); std::complex* vals_mem = vals.memptr(); for(uword i=0; i < X.n_rows; ++i) { vals_mem[i] = std::complex(vals_real[i], vals_imag[i]); } if(vecs_on) { for(uword j=0; j < X.n_rows; ++j) { if( (j < (X.n_rows-1)) && (vals_mem[j] == std::conj(vals_mem[j+1])) ) { for(uword i=0; i < X.n_rows; ++i) { vecs.at(i,j) = std::complex( tmp.at(i,j), tmp.at(i,j+1) ); vecs.at(i,j+1) = std::complex( tmp.at(i,j), -tmp.at(i,j+1) ); } ++j; } else { for(uword i=0; i(tmp.at(i,j), T(0)); } } } } return true; } #else { arma_ignore(vals); arma_ignore(vecs); arma_ignore(vecs_on); arma_ignore(expr); arma_stop_logic_error("eig_gen(): use of LAPACK must be enabled"); return false; } #endif } //! eigen decomposition of general square matrix (complex) template inline bool auxlib::eig_gen ( Mat< std::complex >& vals, Mat< std::complex >& vecs, const bool vecs_on, const Base< std::complex, T1 >& expr ) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { typedef typename T1::pod_type T; typedef typename std::complex eT; Mat X = expr.get_ref(); arma_conform_check( (X.is_square() == false), "eig_gen(): given matrix must be square sized" ); arma_conform_assert_blas_size(X); if(X.is_empty()) { vals.reset(); vecs.reset(); return true; } if(arma_config::check_nonfinite && X.internal_has_nonfinite()) { return false; } vals.set_size(X.n_rows, 1); if(vecs_on) { vecs.set_size(X.n_rows, X.n_rows); } podarray junk(1); char jobvl = 'N'; char jobvr = (vecs_on) ? 'V' : 'N'; blas_int N = blas_int(X.n_rows); eT* vl = junk.memptr(); eT* vr = (vecs_on) ? vecs.memptr() : junk.memptr(); blas_int ldvl = blas_int(1); blas_int ldvr = (vecs_on) ? blas_int(vecs.n_rows) : blas_int(1); blas_int lwork = 64*N; // lwork_min = (std::max)(blas_int(1), 2*N) blas_int info = 0; podarray work( static_cast(lwork) ); podarray< T> rwork( static_cast(2*N) ); arma_debug_print("lapack::cx_geev() -- START"); lapack::cx_geev(&jobvl, &jobvr, &N, X.memptr(), &N, vals.memptr(), vl, &ldvl, vr, &ldvr, work.memptr(), &lwork, rwork.memptr(), &info); arma_debug_print("lapack::cx_geev() -- END"); return (info == 0); } #else { arma_ignore(vals); arma_ignore(vecs); arma_ignore(vecs_on); arma_ignore(expr); arma_stop_logic_error("eig_gen(): use of LAPACK must be enabled"); return false; } #endif } //! eigen decomposition of general square matrix (real, balance given matrix) template inline bool auxlib::eig_gen_balance ( Mat< std::complex >& vals, Mat< std::complex >& vecs, const bool vecs_on, const Base& expr ) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { typedef typename T1::pod_type T; Mat X = expr.get_ref(); arma_conform_check( (X.is_square() == false), "eig_gen(): given matrix must be square sized" ); arma_conform_assert_blas_size(X); if(X.is_empty()) { vals.reset(); vecs.reset(); return true; } if(arma_config::check_nonfinite && X.internal_has_nonfinite()) { return false; } vals.set_size(X.n_rows, 1); Mat tmp(1, 1, arma_nozeros_indicator()); if(vecs_on) { vecs.set_size(X.n_rows, X.n_rows); tmp.set_size(X.n_rows, X.n_rows); } podarray junk(1); char bal = 'B'; char jobvl = 'N'; char jobvr = (vecs_on) ? 'V' : 'N'; char sense = 'N'; blas_int N = blas_int(X.n_rows); T* vl = junk.memptr(); T* vr = (vecs_on) ? tmp.memptr() : junk.memptr(); blas_int ldvl = blas_int(1); blas_int ldvr = (vecs_on) ? blas_int(tmp.n_rows) : blas_int(1); blas_int ilo = blas_int(0); blas_int ihi = blas_int(0); T abnrm = T(0); blas_int lwork = 64*N; // lwork_min = (vecs_on) ? (std::max)(blas_int(1), 2*N) : (std::max)(blas_int(1), 3*N) blas_int info = blas_int(0); podarray scale(X.n_rows); podarray rconde(X.n_rows); podarray rcondv(X.n_rows); podarray work( static_cast(lwork) ); podarray iwork( uword(1) ); // iwork not used by lapack::geevx() as sense = 'N' podarray vals_real(X.n_rows); podarray vals_imag(X.n_rows); arma_debug_print("lapack::geevx() -- START"); lapack::geevx(&bal, &jobvl, &jobvr, &sense, &N, X.memptr(), &N, vals_real.memptr(), vals_imag.memptr(), vl, &ldvl, vr, &ldvr, &ilo, &ihi, scale.memptr(), &abnrm, rconde.memptr(), rcondv.memptr(), work.memptr(), &lwork, iwork.memptr(), &info); arma_debug_print("lapack::geevx() -- END"); if(info != 0) { return false; } arma_debug_print("reformatting eigenvalues and eigenvectors"); std::complex* vals_mem = vals.memptr(); for(uword i=0; i < X.n_rows; ++i) { vals_mem[i] = std::complex(vals_real[i], vals_imag[i]); } if(vecs_on) { for(uword j=0; j < X.n_rows; ++j) { if( (j < (X.n_rows-1)) && (vals_mem[j] == std::conj(vals_mem[j+1])) ) { for(uword i=0; i < X.n_rows; ++i) { vecs.at(i,j) = std::complex( tmp.at(i,j), tmp.at(i,j+1) ); vecs.at(i,j+1) = std::complex( tmp.at(i,j), -tmp.at(i,j+1) ); } ++j; } else { for(uword i=0; i(tmp.at(i,j), T(0)); } } } } return true; } #else { arma_ignore(vals); arma_ignore(vecs); arma_ignore(vecs_on); arma_ignore(expr); arma_stop_logic_error("eig_gen(): use of LAPACK must be enabled"); return false; } #endif } //! eigen decomposition of general square matrix (complex, balance given matrix) template inline bool auxlib::eig_gen_balance ( Mat< std::complex >& vals, Mat< std::complex >& vecs, const bool vecs_on, const Base< std::complex, T1 >& expr ) { arma_debug_sigprint(); #if defined(ARMA_CRIPPLED_LAPACK) { arma_debug_print("auxlib::eig_gen_balance(): redirecting to auxlib::eig_gen() due to crippled LAPACK"); return auxlib::eig_gen(vals, vecs, vecs_on, expr); } #elif defined(ARMA_USE_LAPACK) { typedef typename T1::pod_type T; typedef typename std::complex eT; Mat X = expr.get_ref(); arma_conform_check( (X.is_square() == false), "eig_gen(): given matrix must be square sized" ); arma_conform_assert_blas_size(X); if(X.is_empty()) { vals.reset(); vecs.reset(); return true; } if(arma_config::check_nonfinite && X.internal_has_nonfinite()) { return false; } vals.set_size(X.n_rows, 1); if(vecs_on) { vecs.set_size(X.n_rows, X.n_rows); } podarray junk(1); char bal = 'B'; char jobvl = 'N'; char jobvr = (vecs_on) ? 'V' : 'N'; char sense = 'N'; blas_int N = blas_int(X.n_rows); eT* vl = junk.memptr(); eT* vr = (vecs_on) ? vecs.memptr() : junk.memptr(); blas_int ldvl = blas_int(1); blas_int ldvr = (vecs_on) ? blas_int(vecs.n_rows) : blas_int(1); blas_int ilo = blas_int(0); blas_int ihi = blas_int(0); T abnrm = T(0); blas_int lwork = 64*N; // lwork_min = (std::max)(blas_int(1), blas_int(2*N)) blas_int info = blas_int(0); podarray scale(X.n_rows); podarray rconde(X.n_rows); podarray rcondv(X.n_rows); podarray work( static_cast(lwork) ); podarray< T> rwork( static_cast(2*N) ); arma_debug_print("lapack::cx_geevx() -- START"); lapack::cx_geevx(&bal, &jobvl, &jobvr, &sense, &N, X.memptr(), &N, vals.memptr(), vl, &ldvl, vr, &ldvr, &ilo, &ihi, scale.memptr(), &abnrm, rconde.memptr(), rcondv.memptr(), work.memptr(), &lwork, rwork.memptr(), &info); arma_debug_print("lapack::cx_geevx() -- END"); return (info == 0); } #else { arma_ignore(vals); arma_ignore(vecs); arma_ignore(vecs_on); arma_ignore(expr); arma_stop_logic_error("eig_gen(): use of LAPACK must be enabled"); return false; } #endif } //! two-sided eigen decomposition of general square matrix (real) template inline bool auxlib::eig_gen_twosided ( Mat< std::complex >& vals, Mat< std::complex >& lvecs, Mat< std::complex >& rvecs, const Base& expr ) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { typedef typename T1::pod_type T; Mat X = expr.get_ref(); arma_conform_check( (X.is_square() == false), "eig_gen(): given matrix must be square sized" ); arma_conform_assert_blas_size(X); if(X.is_empty()) { vals.reset(); lvecs.reset(); rvecs.reset(); return true; } if(arma_config::check_nonfinite && X.internal_has_nonfinite()) { return false; } vals.set_size(X.n_rows, 1); lvecs.set_size(X.n_rows, X.n_rows); rvecs.set_size(X.n_rows, X.n_rows); Mat ltmp(X.n_rows, X.n_rows, arma_nozeros_indicator()); Mat rtmp(X.n_rows, X.n_rows, arma_nozeros_indicator()); char jobvl = 'V'; char jobvr = 'V'; blas_int N = blas_int(X.n_rows); blas_int ldvl = blas_int(ltmp.n_rows); blas_int ldvr = blas_int(rtmp.n_rows); blas_int lwork = 64*N; // lwork_min = (std::max)(blas_int(1), 4*N) blas_int info = 0; podarray work( static_cast(lwork) ); podarray vals_real(X.n_rows); podarray vals_imag(X.n_rows); arma_debug_print("lapack::geev() -- START"); lapack::geev(&jobvl, &jobvr, &N, X.memptr(), &N, vals_real.memptr(), vals_imag.memptr(), ltmp.memptr(), &ldvl, rtmp.memptr(), &ldvr, work.memptr(), &lwork, &info); arma_debug_print("lapack::geev() -- END"); if(info != 0) { return false; } arma_debug_print("reformatting eigenvalues and eigenvectors"); std::complex* vals_mem = vals.memptr(); for(uword i=0; i < X.n_rows; ++i) { vals_mem[i] = std::complex(vals_real[i], vals_imag[i]); } for(uword j=0; j < X.n_rows; ++j) { if( (j < (X.n_rows-1)) && (vals_mem[j] == std::conj(vals_mem[j+1])) ) { for(uword i=0; i < X.n_rows; ++i) { lvecs.at(i,j) = std::complex( ltmp.at(i,j), ltmp.at(i,j+1) ); lvecs.at(i,j+1) = std::complex( ltmp.at(i,j), -ltmp.at(i,j+1) ); rvecs.at(i,j) = std::complex( rtmp.at(i,j), rtmp.at(i,j+1) ); rvecs.at(i,j+1) = std::complex( rtmp.at(i,j), -rtmp.at(i,j+1) ); } ++j; } else { for(uword i=0; i(ltmp.at(i,j), T(0)); rvecs.at(i,j) = std::complex(rtmp.at(i,j), T(0)); } } } return true; } #else { arma_ignore(vals); arma_ignore(lvecs); arma_ignore(rvecs); arma_ignore(expr); arma_stop_logic_error("eig_gen(): use of LAPACK must be enabled"); return false; } #endif } //! two-sided eigen decomposition of general square matrix (complex) template inline bool auxlib::eig_gen_twosided ( Mat< std::complex >& vals, Mat< std::complex >& lvecs, Mat< std::complex >& rvecs, const Base< std::complex, T1 >& expr ) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { typedef typename T1::pod_type T; typedef typename std::complex eT; Mat X = expr.get_ref(); arma_conform_check( (X.is_square() == false), "eig_gen(): given matrix must be square sized" ); arma_conform_assert_blas_size(X); if(X.is_empty()) { vals.reset(); lvecs.reset(); rvecs.reset(); return true; } if(arma_config::check_nonfinite && X.internal_has_nonfinite()) { return false; } vals.set_size(X.n_rows, 1); lvecs.set_size(X.n_rows, X.n_rows); rvecs.set_size(X.n_rows, X.n_rows); char jobvl = 'V'; char jobvr = 'V'; blas_int N = blas_int(X.n_rows); blas_int ldvl = blas_int(lvecs.n_rows); blas_int ldvr = blas_int(rvecs.n_rows); blas_int lwork = 64*N; // lwork_min = (std::max)(blas_int(1), 2*N) blas_int info = 0; podarray work( static_cast(lwork) ); podarray< T> rwork( static_cast(2*N) ); arma_debug_print("lapack::cx_geev() -- START"); lapack::cx_geev(&jobvl, &jobvr, &N, X.memptr(), &N, vals.memptr(), lvecs.memptr(), &ldvl, rvecs.memptr(), &ldvr, work.memptr(), &lwork, rwork.memptr(), &info); arma_debug_print("lapack::cx_geev() -- END"); return (info == 0); } #else { arma_ignore(vals); arma_ignore(lvecs); arma_ignore(rvecs); arma_ignore(expr); arma_stop_logic_error("eig_gen(): use of LAPACK must be enabled"); return false; } #endif } //! two-sided eigen decomposition of general square matrix (real, balance given matrix) template inline bool auxlib::eig_gen_twosided_balance ( Mat< std::complex >& vals, Mat< std::complex >& lvecs, Mat< std::complex >& rvecs, const Base& expr ) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { typedef typename T1::pod_type T; Mat X = expr.get_ref(); arma_conform_check( (X.is_square() == false), "eig_gen(): given matrix must be square sized" ); arma_conform_assert_blas_size(X); if(X.is_empty()) { vals.reset(); lvecs.reset(); rvecs.reset(); return true; } if(arma_config::check_nonfinite && X.internal_has_nonfinite()) { return false; } vals.set_size(X.n_rows, 1); lvecs.set_size(X.n_rows, X.n_rows); rvecs.set_size(X.n_rows, X.n_rows); Mat ltmp(X.n_rows, X.n_rows, arma_nozeros_indicator()); Mat rtmp(X.n_rows, X.n_rows, arma_nozeros_indicator()); char bal = 'B'; char jobvl = 'V'; char jobvr = 'V'; char sense = 'N'; blas_int N = blas_int(X.n_rows); blas_int ldvl = blas_int(ltmp.n_rows); blas_int ldvr = blas_int(rtmp.n_rows); blas_int ilo = blas_int(0); blas_int ihi = blas_int(0); T abnrm = T(0); blas_int lwork = 64*N; // lwork_min = (std::max)(blas_int(1), blas_int(3*N)) blas_int info = blas_int(0); podarray scale(X.n_rows); podarray rconde(X.n_rows); podarray rcondv(X.n_rows); podarray work( static_cast(lwork) ); podarray iwork( uword(1) ); // iwork not used by lapack::geevx() as sense = 'N' podarray vals_real(X.n_rows); podarray vals_imag(X.n_rows); arma_debug_print("lapack::geevx() -- START"); lapack::geevx(&bal, &jobvl, &jobvr, &sense, &N, X.memptr(), &N, vals_real.memptr(), vals_imag.memptr(), ltmp.memptr(), &ldvl, rtmp.memptr(), &ldvr, &ilo, &ihi, scale.memptr(), &abnrm, rconde.memptr(), rcondv.memptr(), work.memptr(), &lwork, iwork.memptr(), &info); arma_debug_print("lapack::geevx() -- END"); if(info != 0) { return false; } arma_debug_print("reformatting eigenvalues and eigenvectors"); std::complex* vals_mem = vals.memptr(); for(uword i=0; i < X.n_rows; ++i) { vals_mem[i] = std::complex(vals_real[i], vals_imag[i]); } for(uword j=0; j < X.n_rows; ++j) { if( (j < (X.n_rows-1)) && (vals_mem[j] == std::conj(vals_mem[j+1])) ) { for(uword i=0; i < X.n_rows; ++i) { lvecs.at(i,j) = std::complex( ltmp.at(i,j), ltmp.at(i,j+1) ); lvecs.at(i,j+1) = std::complex( ltmp.at(i,j), -ltmp.at(i,j+1) ); rvecs.at(i,j) = std::complex( rtmp.at(i,j), rtmp.at(i,j+1) ); rvecs.at(i,j+1) = std::complex( rtmp.at(i,j), -rtmp.at(i,j+1) ); } ++j; } else { for(uword i=0; i(ltmp.at(i,j), T(0)); rvecs.at(i,j) = std::complex(rtmp.at(i,j), T(0)); } } } return true; } #else { arma_ignore(vals); arma_ignore(lvecs); arma_ignore(rvecs); arma_ignore(expr); arma_stop_logic_error("eig_gen(): use of LAPACK must be enabled"); return false; } #endif } //! two-sided eigen decomposition of general square matrix (complex, balance given matrix) template inline bool auxlib::eig_gen_twosided_balance ( Mat< std::complex >& vals, Mat< std::complex >& lvecs, Mat< std::complex >& rvecs, const Base< std::complex, T1 >& expr ) { arma_debug_sigprint(); #if defined(ARMA_CRIPPLED_LAPACK) { arma_debug_print("auxlib::eig_gen_twosided_balance(): redirecting to auxlib::eig_gen() due to crippled LAPACK"); return auxlib::eig_gen(vals, lvecs, rvecs, expr); } #elif defined(ARMA_USE_LAPACK) { typedef typename T1::pod_type T; typedef typename std::complex eT; Mat X = expr.get_ref(); arma_conform_check( (X.is_square() == false), "eig_gen(): given matrix must be square sized" ); arma_conform_assert_blas_size(X); if(X.is_empty()) { vals.reset(); lvecs.reset(); rvecs.reset(); return true; } if(arma_config::check_nonfinite && X.internal_has_nonfinite()) { return false; } vals.set_size(X.n_rows, 1); lvecs.set_size(X.n_rows, X.n_rows); rvecs.set_size(X.n_rows, X.n_rows); char bal = 'B'; char jobvl = 'V'; char jobvr = 'V'; char sense = 'N'; blas_int N = blas_int(X.n_rows); blas_int ldvl = blas_int(lvecs.n_rows); blas_int ldvr = blas_int(rvecs.n_rows); blas_int ilo = blas_int(0); blas_int ihi = blas_int(0); T abnrm = T(0); blas_int lwork = 64*N; // lwork_min = (std::max)(blas_int(1), blas_int(2*N)) blas_int info = blas_int(0); podarray scale(X.n_rows); podarray rconde(X.n_rows); podarray rcondv(X.n_rows); podarray work( static_cast(lwork) ); podarray< T> rwork( static_cast(2*N) ); arma_debug_print("lapack::cx_geevx() -- START"); lapack::cx_geevx(&bal, &jobvl, &jobvr, &sense, &N, X.memptr(), &N, vals.memptr(), lvecs.memptr(), &ldvl, rvecs.memptr(), &ldvr, &ilo, &ihi, scale.memptr(), &abnrm, rconde.memptr(), rcondv.memptr(), work.memptr(), &lwork, rwork.memptr(), &info); arma_debug_print("lapack::cx_geevx() -- END"); return (info == 0); } #else { arma_ignore(vals); arma_ignore(lvecs); arma_ignore(rvecs); arma_ignore(expr); arma_stop_logic_error("eig_gen(): use of LAPACK must be enabled"); return false; } #endif } //! eigendecomposition of general square matrix pair (real) template inline bool auxlib::eig_pair ( Mat< std::complex >& vals, Mat< std::complex >& vecs, const bool vecs_on, const Base& A_expr, const Base& B_expr ) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { typedef typename T1::pod_type T; typedef std::complex eT; Mat A(A_expr.get_ref()); Mat B(B_expr.get_ref()); arma_conform_check( ((A.is_square() == false) || (B.is_square() == false)), "eig_pair(): given matrices must be square sized" ); arma_conform_check( (A.n_rows != B.n_rows), "eig_pair(): given matrices must have the same size" ); arma_conform_assert_blas_size(A); if(A.is_empty()) { vals.reset(); vecs.reset(); return true; } if(arma_config::check_nonfinite && A.internal_has_nonfinite()) { return false; } if(arma_config::check_nonfinite && B.internal_has_nonfinite()) { return false; } vals.set_size(A.n_rows, 1); Mat tmp(1, 1, arma_nozeros_indicator()); if(vecs_on) { vecs.set_size(A.n_rows, A.n_rows); tmp.set_size(A.n_rows, A.n_rows); } podarray junk(1); char jobvl = 'N'; char jobvr = (vecs_on) ? 'V' : 'N'; blas_int N = blas_int(A.n_rows); T* vl = junk.memptr(); T* vr = (vecs_on) ? tmp.memptr() : junk.memptr(); blas_int ldvl = blas_int(1); blas_int ldvr = (vecs_on) ? blas_int(tmp.n_rows) : blas_int(1); blas_int lwork = 64*N; // lwork_min = (std::max)(blas_int(1), 8*N) blas_int info = 0; podarray alphar(A.n_rows); podarray alphai(A.n_rows); podarray beta(A.n_rows); podarray work( static_cast(lwork) ); arma_debug_print("lapack::ggev()"); lapack::ggev(&jobvl, &jobvr, &N, A.memptr(), &N, B.memptr(), &N, alphar.memptr(), alphai.memptr(), beta.memptr(), vl, &ldvl, vr, &ldvr, work.memptr(), &lwork, &info); if(info != 0) { return false; } arma_debug_print("reformatting eigenvalues and eigenvectors"); eT* vals_mem = vals.memptr(); const T* alphar_mem = alphar.memptr(); const T* alphai_mem = alphai.memptr(); const T* beta_mem = beta.memptr(); bool beta_has_zero = false; for(uword j=0; j(re, im); if( (alphai_val > T(0)) && (j < (A.n_rows-1)) ) { ++j; vals_mem[j] = std::complex(re,-im); // force exact conjugate } } if(beta_has_zero) { arma_warn(1, "eig_pair(): given matrices appear ill-conditioned"); } if(vecs_on) { for(uword j=0; j( tmp.at(i,j), tmp.at(i,j+1) ); vecs.at(i,j+1) = std::complex( tmp.at(i,j), -tmp.at(i,j+1) ); } ++j; } else { for(uword i=0; i(tmp.at(i,j), T(0)); } } } } return true; } #else { arma_ignore(vals); arma_ignore(vecs); arma_ignore(vecs_on); arma_ignore(A_expr); arma_ignore(B_expr); arma_stop_logic_error("eig_pair(): use of LAPACK must be enabled"); return false; } #endif } //! eigendecomposition of general square matrix pair (complex) template inline bool auxlib::eig_pair ( Mat< std::complex >& vals, Mat< std::complex >& vecs, const bool vecs_on, const Base< std::complex, T1 >& A_expr, const Base< std::complex, T2 >& B_expr ) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { typedef typename T1::pod_type T; typedef typename std::complex eT; Mat A(A_expr.get_ref()); Mat B(B_expr.get_ref()); arma_conform_check( ((A.is_square() == false) || (B.is_square() == false)), "eig_pair(): given matrices must be square sized" ); arma_conform_check( (A.n_rows != B.n_rows), "eig_pair(): given matrices must have the same size" ); arma_conform_assert_blas_size(A); if(A.is_empty()) { vals.reset(); vecs.reset(); return true; } if(arma_config::check_nonfinite && A.internal_has_nonfinite()) { return false; } if(arma_config::check_nonfinite && B.internal_has_nonfinite()) { return false; } vals.set_size(A.n_rows, 1); if(vecs_on) { vecs.set_size(A.n_rows, A.n_rows); } podarray junk(1); char jobvl = 'N'; char jobvr = (vecs_on) ? 'V' : 'N'; blas_int N = blas_int(A.n_rows); eT* vl = junk.memptr(); eT* vr = (vecs_on) ? vecs.memptr() : junk.memptr(); blas_int ldvl = blas_int(1); blas_int ldvr = (vecs_on) ? blas_int(vecs.n_rows) : blas_int(1); blas_int lwork = 64*N; // lwork_min = (std::max)(blas_int(1),2*N) blas_int info = 0; podarray alpha(A.n_rows); podarray beta(A.n_rows); podarray work( static_cast(lwork) ); podarray rwork( static_cast(8*N) ); arma_debug_print("lapack::cx_ggev()"); lapack::cx_ggev(&jobvl, &jobvr, &N, A.memptr(), &N, B.memptr(), &N, alpha.memptr(), beta.memptr(), vl, &ldvl, vr, &ldvr, work.memptr(), &lwork, rwork.memptr(), &info); if(info != 0) { return false; } eT* vals_mem = vals.memptr(); const eT* alpha_mem = alpha.memptr(); const eT* beta_mem = beta.memptr(); const std::complex zero(T(0), T(0)); bool beta_has_zero = false; for(uword i=0; i inline bool auxlib::eig_pair_twosided ( Mat< std::complex >& vals, Mat< std::complex >& lvecs, Mat< std::complex >& rvecs, const Base& A_expr, const Base& B_expr ) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { typedef typename T1::pod_type T; typedef std::complex eT; Mat A(A_expr.get_ref()); Mat B(B_expr.get_ref()); arma_conform_check( ((A.is_square() == false) || (B.is_square() == false)), "eig_pair(): given matrices must be square sized" ); arma_conform_check( (A.n_rows != B.n_rows), "eig_pair(): given matrices must have the same size" ); arma_conform_assert_blas_size(A); if(A.is_empty()) { vals.reset(); lvecs.reset(); rvecs.reset(); return true; } if(arma_config::check_nonfinite && A.internal_has_nonfinite()) { return false; } if(arma_config::check_nonfinite && B.internal_has_nonfinite()) { return false; } vals.set_size(A.n_rows, 1); lvecs.set_size(A.n_rows, A.n_rows); rvecs.set_size(A.n_rows, A.n_rows); Mat ltmp(A.n_rows, A.n_rows, arma_nozeros_indicator()); Mat rtmp(A.n_rows, A.n_rows, arma_nozeros_indicator()); char jobvl = 'V'; char jobvr = 'V'; blas_int N = blas_int(A.n_rows); blas_int ldvl = blas_int(ltmp.n_rows); blas_int ldvr = blas_int(rtmp.n_rows); blas_int lwork = 64*N; // lwork_min = (std::max)(blas_int(1), 8*N) blas_int info = 0; podarray alphar(A.n_rows); podarray alphai(A.n_rows); podarray beta(A.n_rows); podarray work( static_cast(lwork) ); arma_debug_print("lapack::ggev()"); lapack::ggev(&jobvl, &jobvr, &N, A.memptr(), &N, B.memptr(), &N, alphar.memptr(), alphai.memptr(), beta.memptr(), ltmp.memptr(), &ldvl, rtmp.memptr(), &ldvr, work.memptr(), &lwork, &info); if(info != 0) { return false; } arma_debug_print("reformatting eigenvalues and eigenvectors"); eT* vals_mem = vals.memptr(); const T* alphar_mem = alphar.memptr(); const T* alphai_mem = alphai.memptr(); const T* beta_mem = beta.memptr(); bool beta_has_zero = false; for(uword j=0; j(re, im); if( (alphai_val > T(0)) && (j < (A.n_rows-1)) ) { ++j; vals_mem[j] = std::complex(re,-im); // force exact conjugate } } if(beta_has_zero) { arma_warn(1, "eig_pair(): given matrices appear ill-conditioned"); } for(uword j=0; j < A.n_rows; ++j) { if( (j < (A.n_rows-1)) && (vals_mem[j] == std::conj(vals_mem[j+1])) ) { for(uword i=0; i < A.n_rows; ++i) { lvecs.at(i,j) = std::complex( ltmp.at(i,j), ltmp.at(i,j+1) ); lvecs.at(i,j+1) = std::complex( ltmp.at(i,j), -ltmp.at(i,j+1) ); rvecs.at(i,j) = std::complex( rtmp.at(i,j), rtmp.at(i,j+1) ); rvecs.at(i,j+1) = std::complex( rtmp.at(i,j), -rtmp.at(i,j+1) ); } ++j; } else { for(uword i=0; i(ltmp.at(i,j), T(0)); rvecs.at(i,j) = std::complex(rtmp.at(i,j), T(0)); } } } return true; } #else { arma_ignore(vals); arma_ignore(lvecs); arma_ignore(rvecs); arma_ignore(A_expr); arma_ignore(B_expr); arma_stop_logic_error("eig_pair(): use of LAPACK must be enabled"); return false; } #endif } //! two-sided eigendecomposition of general square matrix pair (complex) template inline bool auxlib::eig_pair_twosided ( Mat< std::complex >& vals, Mat< std::complex >& lvecs, Mat< std::complex >& rvecs, const Base< std::complex, T1 >& A_expr, const Base< std::complex, T2 >& B_expr ) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { typedef typename T1::pod_type T; typedef typename std::complex eT; Mat A(A_expr.get_ref()); Mat B(B_expr.get_ref()); arma_conform_check( ((A.is_square() == false) || (B.is_square() == false)), "eig_pair(): given matrices must be square sized" ); arma_conform_check( (A.n_rows != B.n_rows), "eig_pair(): given matrices must have the same size" ); arma_conform_assert_blas_size(A); if(A.is_empty()) { vals.reset(); lvecs.reset(); rvecs.reset(); return true; } if(arma_config::check_nonfinite && A.internal_has_nonfinite()) { return false; } if(arma_config::check_nonfinite && B.internal_has_nonfinite()) { return false; } vals.set_size(A.n_rows, 1); lvecs.set_size(A.n_rows, A.n_rows); rvecs.set_size(A.n_rows, A.n_rows); char jobvl = 'V'; char jobvr = 'V'; blas_int N = blas_int(A.n_rows); blas_int ldvl = blas_int(lvecs.n_rows); blas_int ldvr = blas_int(rvecs.n_rows); blas_int lwork = 64*N; // lwork_min = (std::max)(blas_int(1),2*N) blas_int info = 0; podarray alpha(A.n_rows); podarray beta(A.n_rows); podarray work( static_cast(lwork) ); podarray rwork( static_cast(8*N) ); arma_debug_print("lapack::cx_ggev()"); lapack::cx_ggev(&jobvl, &jobvr, &N, A.memptr(), &N, B.memptr(), &N, alpha.memptr(), beta.memptr(), lvecs.memptr(), &ldvl, rvecs.memptr(), &ldvr, work.memptr(), &lwork, rwork.memptr(), &info); if(info != 0) { return false; } eT* vals_mem = vals.memptr(); const eT* alpha_mem = alpha.memptr(); const eT* beta_mem = beta.memptr(); const std::complex zero(T(0), T(0)); bool beta_has_zero = false; for(uword i=0; i inline bool auxlib::eig_sym(Col& eigval, Mat& A) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { arma_conform_check( (A.is_square() == false), "eig_sym(): given matrix must be square sized" ); if(A.is_empty()) { eigval.reset(); return true; } if((arma_config::check_conform) && (auxlib::rudimentary_sym_check(A) == false)) { arma_warn(1, "eig_sym(): given matrix is not symmetric"); } if(arma_config::check_nonfinite && trimat_helper::has_nonfinite_triu(A)) { return false; } arma_conform_assert_blas_size(A); eigval.set_size(A.n_rows); char jobz = 'N'; char uplo = 'U'; blas_int N = blas_int(A.n_rows); blas_int lwork = (64+2)*N; // lwork_min = (std::max)(blas_int(1), 3*N-1) blas_int info = 0; podarray work( static_cast(lwork) ); arma_debug_print("lapack::syev()"); lapack::syev(&jobz, &uplo, &N, A.memptr(), &N, eigval.memptr(), work.memptr(), &lwork, &info); return (info == 0); } #else { arma_ignore(eigval); arma_ignore(A); arma_stop_logic_error("eig_sym(): use of LAPACK must be enabled"); return false; } #endif } //! eigenvalues of a hermitian complex matrix template inline bool auxlib::eig_sym(Col& eigval, Mat< std::complex >& A) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { typedef typename std::complex eT; arma_conform_check( (A.is_square() == false), "eig_sym(): given matrix must be square sized" ); if(A.is_empty()) { eigval.reset(); return true; } if((arma_config::check_conform) && (auxlib::rudimentary_sym_check(A) == false)) { arma_warn(1, "eig_sym(): given matrix is not hermitian"); } if(arma_config::check_nonfinite && trimat_helper::has_nonfinite_triu(A)) { return false; } arma_conform_assert_blas_size(A); eigval.set_size(A.n_rows); char jobz = 'N'; char uplo = 'U'; blas_int N = blas_int(A.n_rows); blas_int lwork = (64+1)*N; // lwork_min = (std::max)(blas_int(1), 2*N-1) blas_int info = 0; podarray work( static_cast(lwork) ); podarray rwork( static_cast( (std::max)(blas_int(1), 3*N) ) ); arma_debug_print("lapack::heev()"); lapack::heev(&jobz, &uplo, &N, A.memptr(), &N, eigval.memptr(), work.memptr(), &lwork, rwork.memptr(), &info); return (info == 0); } #else { arma_ignore(eigval); arma_ignore(A); arma_stop_logic_error("eig_sym(): use of LAPACK must be enabled"); return false; } #endif } //! eigenvalues and eigenvectors of a symmetric real matrix template inline bool auxlib::eig_sym(Col& eigval, Mat& eigvec, const Mat& X) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { arma_conform_check( (X.is_square() == false), "eig_sym(): given matrix must be square sized" ); if(arma_config::check_nonfinite && trimat_helper::has_nonfinite_triu(X)) { return false; } eigvec = X; if(eigvec.is_empty()) { eigval.reset(); eigvec.reset(); return true; } arma_conform_assert_blas_size(eigvec); eigval.set_size(eigvec.n_rows); char jobz = 'V'; char uplo = 'U'; blas_int N = blas_int(eigvec.n_rows); blas_int lwork = (64+2)*N; // lwork_min = (std::max)(blas_int(1), 3*N-1) blas_int info = 0; podarray work( static_cast(lwork) ); arma_debug_print("lapack::syev()"); lapack::syev(&jobz, &uplo, &N, eigvec.memptr(), &N, eigval.memptr(), work.memptr(), &lwork, &info); return (info == 0); } #else { arma_ignore(eigval); arma_ignore(eigvec); arma_ignore(X); arma_stop_logic_error("eig_sym(): use of LAPACK must be enabled"); return false; } #endif } //! eigenvalues and eigenvectors of a hermitian complex matrix template inline bool auxlib::eig_sym(Col& eigval, Mat< std::complex >& eigvec, const Mat< std::complex >& X) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { typedef typename std::complex eT; arma_conform_check( (X.is_square() == false), "eig_sym(): given matrix must be square sized" ); if(arma_config::check_nonfinite && trimat_helper::has_nonfinite_triu(X)) { return false; } eigvec = X; if(eigvec.is_empty()) { eigval.reset(); eigvec.reset(); return true; } arma_conform_assert_blas_size(eigvec); eigval.set_size(eigvec.n_rows); char jobz = 'V'; char uplo = 'U'; blas_int N = blas_int(eigvec.n_rows); blas_int lwork = (64+1)*N; // lwork_min = (std::max)(blas_int(1), 2*N-1) blas_int info = 0; podarray work( static_cast(lwork) ); podarray rwork( static_cast((std::max)(blas_int(1), 3*N)) ); arma_debug_print("lapack::heev()"); lapack::heev(&jobz, &uplo, &N, eigvec.memptr(), &N, eigval.memptr(), work.memptr(), &lwork, rwork.memptr(), &info); return (info == 0); } #else { arma_ignore(eigval); arma_ignore(eigvec); arma_ignore(X); arma_stop_logic_error("eig_sym(): use of LAPACK must be enabled"); return false; } #endif } //! eigenvalues and eigenvectors of a symmetric real matrix (divide and conquer algorithm) template inline bool auxlib::eig_sym_dc(Col& eigval, Mat& eigvec, const Mat& X) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { arma_conform_check( (X.is_square() == false), "eig_sym(): given matrix must be square sized" ); if(arma_config::check_nonfinite && trimat_helper::has_nonfinite_triu(X)) { return false; } eigvec = X; if(eigvec.is_empty()) { eigval.reset(); eigvec.reset(); return true; } arma_conform_assert_blas_size(eigvec); eigval.set_size(eigvec.n_rows); char jobz = 'V'; char uplo = 'U'; blas_int N = blas_int(eigvec.n_rows); blas_int lwork_min = 1 + 6*N + 2*(N*N); blas_int liwork_min = 3 + 5*N; blas_int info = 0; blas_int lwork_proposed = 0; blas_int liwork_proposed = 0; if(N >= 32) { eT work_query[2] = {}; blas_int iwork_query[2] = {}; blas_int lwork_query = -1; blas_int liwork_query = -1; arma_debug_print("lapack::syevd()"); lapack::syevd(&jobz, &uplo, &N, eigvec.memptr(), &N, eigval.memptr(), &work_query[0], &lwork_query, &iwork_query[0], &liwork_query, &info); if(info != 0) { return false; } lwork_proposed = static_cast( work_query[0] ); liwork_proposed = iwork_query[0]; } blas_int lwork_final = (std::max)( lwork_proposed, lwork_min); blas_int liwork_final = (std::max)(liwork_proposed, liwork_min); podarray work( static_cast( lwork_final) ); podarray iwork( static_cast(liwork_final) ); arma_debug_print("lapack::syevd()"); lapack::syevd(&jobz, &uplo, &N, eigvec.memptr(), &N, eigval.memptr(), work.memptr(), &lwork_final, iwork.memptr(), &liwork_final, &info); return (info == 0); } #else { arma_ignore(eigval); arma_ignore(eigvec); arma_ignore(X); arma_stop_logic_error("eig_sym(): use of LAPACK must be enabled"); return false; } #endif } //! eigenvalues and eigenvectors of a hermitian complex matrix (divide and conquer algorithm) template inline bool auxlib::eig_sym_dc(Col& eigval, Mat< std::complex >& eigvec, const Mat< std::complex >& X) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { typedef typename std::complex eT; arma_conform_check( (X.is_square() == false), "eig_sym(): given matrix must be square sized" ); if(arma_config::check_nonfinite && trimat_helper::has_nonfinite_triu(X)) { return false; } eigvec = X; if(eigvec.is_empty()) { eigval.reset(); eigvec.reset(); return true; } arma_conform_assert_blas_size(eigvec); eigval.set_size(eigvec.n_rows); char jobz = 'V'; char uplo = 'U'; blas_int N = blas_int(eigvec.n_rows); blas_int lwork_min = 2*N + N*N; blas_int lrwork_min = 1 + 5*N + 2*(N*N); blas_int liwork_min = 3 + 5*N; blas_int info = 0; blas_int lwork_proposed = 0; blas_int lrwork_proposed = 0; blas_int liwork_proposed = 0; if(N >= 32) { eT work_query[2] = {}; T rwork_query[2] = {}; blas_int iwork_query[2] = {}; blas_int lwork_query = -1; blas_int lrwork_query = -1; blas_int liwork_query = -1; arma_debug_print("lapack::heevd()"); lapack::heevd(&jobz, &uplo, &N, eigvec.memptr(), &N, eigval.memptr(), &work_query[0], &lwork_query, &rwork_query[0], &lrwork_query, &iwork_query[0], &liwork_query, &info); if(info != 0) { return false; } lwork_proposed = static_cast( access::tmp_real(work_query[0]) ); lrwork_proposed = static_cast( rwork_query[0] ); liwork_proposed = iwork_query[0]; } blas_int lwork_final = (std::max)( lwork_proposed, lwork_min); blas_int lrwork_final = (std::max)(lrwork_proposed, lrwork_min); blas_int liwork_final = (std::max)(liwork_proposed, liwork_min); podarray work( static_cast( lwork_final) ); podarray< T> rwork( static_cast(lrwork_final) ); podarray iwork( static_cast(liwork_final) ); arma_debug_print("lapack::heevd()"); lapack::heevd(&jobz, &uplo, &N, eigvec.memptr(), &N, eigval.memptr(), work.memptr(), &lwork_final, rwork.memptr(), &lrwork_final, iwork.memptr(), &liwork_final, &info); return (info == 0); } #else { arma_ignore(eigval); arma_ignore(eigvec); arma_ignore(X); arma_stop_logic_error("eig_sym(): use of LAPACK must be enabled"); return false; } #endif } template inline bool auxlib::chol_simple(Mat& X) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { arma_conform_assert_blas_size(X); char uplo = 'U'; blas_int n = blas_int(X.n_rows); blas_int info = 0; arma_debug_print("lapack::potrf()"); lapack::potrf(&uplo, &n, X.memptr(), &n, &info); return (info == 0); } #else { arma_ignore(X); arma_stop_logic_error("chol(): use of LAPACK must be enabled"); return false; } #endif } template inline bool auxlib::chol(Mat& X, const uword layout) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { arma_conform_assert_blas_size(X); char uplo = (layout == 0) ? 'U' : 'L'; blas_int n = blas_int(X.n_rows); blas_int info = 0; arma_debug_print("lapack::potrf()"); lapack::potrf(&uplo, &n, X.memptr(), &n, &info); if(info != 0) { return false; } X = (layout == 0) ? trimatu(X) : trimatl(X); // trimatu() and trimatl() return the same type return true; } #else { arma_ignore(X); arma_ignore(layout); arma_stop_logic_error("chol(): use of LAPACK must be enabled"); return false; } #endif } template inline bool auxlib::chol_band(Mat& X, const uword KD, const uword layout) { arma_debug_sigprint(); return auxlib::chol_band_common(X, KD, layout); } template inline bool auxlib::chol_band(Mat< std::complex >& X, const uword KD, const uword layout) { arma_debug_sigprint(); #if defined(ARMA_CRIPPLED_LAPACK) { arma_debug_print("auxlib::chol_band(): redirecting to auxlib::chol() due to crippled LAPACK"); arma_ignore(KD); return auxlib::chol(X, layout); } #else { return auxlib::chol_band_common(X, KD, layout); } #endif } template inline bool auxlib::chol_band_common(Mat& X, const uword KD, const uword layout) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { const uword N = X.n_rows; const uword KL = (layout == 0) ? uword(0) : KD; const uword KU = (layout == 0) ? KD : uword(0); Mat AB; band_helper::compress(AB, X, KL, KU, false); arma_conform_assert_blas_size(AB); char uplo = (layout == 0) ? 'U' : 'L'; blas_int n = blas_int(N); blas_int kd = blas_int(KD); blas_int ldab = blas_int(AB.n_rows); blas_int info = 0; arma_debug_print("lapack::pbtrf()"); lapack::pbtrf(&uplo, &n, &kd, AB.memptr(), &ldab, &info); if(info != 0) { return false; } band_helper::uncompress(X, AB, KL, KU, false); return true; } #else { arma_ignore(X); arma_ignore(KD); arma_ignore(layout); arma_stop_logic_error("chol(): use of LAPACK must be enabled"); return false; } #endif } template inline bool auxlib::chol_pivot(Mat& X, Mat& P, const uword layout) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { typedef typename get_pod_type::result T; arma_conform_assert_blas_size(X); char uplo = (layout == 0) ? 'U' : 'L'; blas_int n = blas_int(X.n_rows); blas_int rank = 0; T tol = T(-1); blas_int info = 0; podarray ipiv( X.n_rows); podarray work(2*X.n_rows); ipiv.zeros(); arma_debug_print("lapack::pstrf()"); lapack::pstrf(&uplo, &n, X.memptr(), &n, ipiv.memptr(), &rank, &tol, work.memptr(), &info); if(info != 0) { return false; } X = (layout == 0) ? trimatu(X) : trimatl(X); // trimatu() and trimatl() return the same type P.set_size(X.n_rows, 1); for(uword i=0; i < X.n_rows; ++i) { P[i] = uword(ipiv[i] - 1); // take into account that Fortran counts from 1 } return true; } #else { arma_ignore(X); arma_ignore(P); arma_ignore(layout); arma_stop_logic_error("chol(): use of LAPACK must be enabled"); return false; } #endif } // // hessenberg decomposition template inline bool auxlib::hess(Mat& H, const Base& X, Col& tao) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { H = X.get_ref(); arma_conform_check( (H.is_square() == false), "hess(): given matrix must be square sized" ); if(H.is_empty()) { return true; } arma_conform_assert_blas_size(H); if(H.n_rows > 2) { tao.set_size(H.n_rows-1); blas_int n = blas_int(H.n_rows); blas_int ilo = 1; blas_int ihi = blas_int(H.n_rows); blas_int lda = blas_int(H.n_rows); blas_int lwork = blas_int(H.n_rows) * 64; blas_int info = 0; podarray work(static_cast(lwork)); arma_debug_print("lapack::gehrd()"); lapack::gehrd(&n, &ilo, &ihi, H.memptr(), &lda, tao.memptr(), work.memptr(), &lwork, &info); return (info == 0); } return true; } #else { arma_ignore(H); arma_ignore(X); arma_ignore(tao); arma_stop_logic_error("hess(): use of LAPACK must be enabled"); return false; } #endif } template inline bool auxlib::qr(Mat& Q, Mat& R, const Base& X) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { R = X.get_ref(); const uword R_n_rows = R.n_rows; const uword R_n_cols = R.n_cols; if(R.is_empty()) { Q.eye(R_n_rows, R_n_rows); return true; } arma_conform_assert_blas_size(R); blas_int m = static_cast(R_n_rows); blas_int n = static_cast(R_n_cols); blas_int lwork_min = (std::max)(blas_int(1), (std::max)(m,n)); // take into account requirements of geqrf() _and_ orgqr()/ungqr() blas_int k = (std::min)(m,n); blas_int info = 0; podarray tau( static_cast(k) ); eT work_query[2] = {}; blas_int lwork_query = -1; arma_debug_print("lapack::geqrf()"); lapack::geqrf(&m, &n, R.memptr(), &m, tau.memptr(), &work_query[0], &lwork_query, &info); if(info != 0) { return false; } blas_int lwork_proposed = static_cast( access::tmp_real(work_query[0]) ); blas_int lwork_final = (std::max)(lwork_proposed, lwork_min); podarray work( static_cast(lwork_final) ); arma_debug_print("lapack::geqrf()"); lapack::geqrf(&m, &n, R.memptr(), &m, tau.memptr(), work.memptr(), &lwork_final, &info); if(info != 0) { return false; } Q.set_size(R_n_rows, R_n_rows); arrayops::copy( Q.memptr(), R.memptr(), (std::min)(Q.n_elem, R.n_elem) ); // // construct R for(uword col=0; col < R_n_cols; ++col) { for(uword row=(col+1); row < R_n_rows; ++row) { R.at(row,col) = eT(0); } } if( (is_float::value) || (is_double::value) ) { arma_debug_print("lapack::orgqr()"); lapack::orgqr(&m, &m, &k, Q.memptr(), &m, tau.memptr(), work.memptr(), &lwork_final, &info); } else if( (is_cx_float::value) || (is_cx_double::value) ) { arma_debug_print("lapack::ungqr()"); lapack::ungqr(&m, &m, &k, Q.memptr(), &m, tau.memptr(), work.memptr(), &lwork_final, &info); } return (info == 0); } #else { arma_ignore(Q); arma_ignore(R); arma_ignore(X); arma_stop_logic_error("qr(): use of LAPACK must be enabled"); return false; } #endif } template inline bool auxlib::qr_econ(Mat& Q, Mat& R, const Base& X) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { if(is_Mat::value) { const unwrap tmp(X.get_ref()); const Mat& M = tmp.M; if(M.n_rows < M.n_cols) { return auxlib::qr(Q, R, X); } } Q = X.get_ref(); const uword Q_n_rows = Q.n_rows; const uword Q_n_cols = Q.n_cols; if( Q_n_rows <= Q_n_cols ) { return auxlib::qr(Q, R, Q); } if(Q.is_empty()) { Q.set_size(Q_n_rows, 0); R.set_size(0, Q_n_cols); return true; } arma_conform_assert_blas_size(Q); blas_int m = static_cast(Q_n_rows); blas_int n = static_cast(Q_n_cols); blas_int lwork_min = (std::max)(blas_int(1), (std::max)(m,n)); // take into account requirements of geqrf() _and_ orgqr()/ungqr() blas_int k = (std::min)(m,n); blas_int info = 0; podarray tau( static_cast(k) ); eT work_query[2] = {}; blas_int lwork_query = -1; arma_debug_print("lapack::geqrf()"); lapack::geqrf(&m, &n, Q.memptr(), &m, tau.memptr(), &work_query[0], &lwork_query, &info); if(info != 0) { return false; } blas_int lwork_proposed = static_cast( access::tmp_real(work_query[0]) ); blas_int lwork_final = (std::max)(lwork_proposed, lwork_min); podarray work( static_cast(lwork_final) ); arma_debug_print("lapack::geqrf()"); lapack::geqrf(&m, &n, Q.memptr(), &m, tau.memptr(), work.memptr(), &lwork_final, &info); if(info != 0) { return false; } R.zeros(Q_n_cols, Q_n_cols); // // construct R for(uword col=0; col < Q_n_cols; ++col) { for(uword row=0; row <= col; ++row) { R.at(row,col) = Q.at(row,col); } } if( (is_float::value) || (is_double::value) ) { arma_debug_print("lapack::orgqr()"); lapack::orgqr(&m, &n, &k, Q.memptr(), &m, tau.memptr(), work.memptr(), &lwork_final, &info); } else if( (is_cx_float::value) || (is_cx_double::value) ) { arma_debug_print("lapack::ungqr()"); lapack::ungqr(&m, &n, &k, Q.memptr(), &m, tau.memptr(), work.memptr(), &lwork_final, &info); } return (info == 0); } #else { arma_ignore(Q); arma_ignore(R); arma_ignore(X); arma_stop_logic_error("qr_econ(): use of LAPACK must be enabled"); return false; } #endif } template inline bool auxlib::qr_pivot(Mat& Q, Mat& R, Mat& P, const Base& X) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { R = X.get_ref(); const uword R_n_rows = R.n_rows; const uword R_n_cols = R.n_cols; if(R.is_empty()) { Q.eye(R_n_rows, R_n_rows); P.set_size(R_n_cols, 1); for(uword col=0; col < R_n_cols; ++col) { P.at(col) = col; } return true; } arma_conform_assert_blas_size(R); blas_int m = static_cast(R_n_rows); blas_int n = static_cast(R_n_cols); blas_int lwork_min = (std::max)(blas_int(3*n + 1), (std::max)(m,n)); // take into account requirements of geqp3() and orgqr() blas_int k = (std::min)(m,n); blas_int info = 0; podarray tau( static_cast(k) ); podarray jpvt( R_n_cols ); jpvt.zeros(); eT work_query[2] = {}; blas_int lwork_query = -1; arma_debug_print("lapack::geqp3()"); lapack::geqp3(&m, &n, R.memptr(), &m, jpvt.memptr(), tau.memptr(), &work_query[0], &lwork_query, &info); if(info != 0) { return false; } blas_int lwork_proposed = static_cast( access::tmp_real(work_query[0]) ); blas_int lwork_final = (std::max)(lwork_proposed, lwork_min); podarray work( static_cast(lwork_final) ); arma_debug_print("lapack::geqp3()"); lapack::geqp3(&m, &n, R.memptr(), &m, jpvt.memptr(), tau.memptr(), work.memptr(), &lwork_final, &info); if(info != 0) { return false; } Q.set_size(R_n_rows, R_n_rows); arrayops::copy( Q.memptr(), R.memptr(), (std::min)(Q.n_elem, R.n_elem) ); // // construct R and P P.set_size(R_n_cols, 1); for(uword col=0; col < R_n_cols; ++col) { for(uword row=(col+1); row < R_n_rows; ++row) { R.at(row,col) = eT(0); } P.at(col) = jpvt[col] - 1; // take into account that Fortran counts from 1 } arma_debug_print("lapack::orgqr()"); lapack::orgqr(&m, &m, &k, Q.memptr(), &m, tau.memptr(), work.memptr(), &lwork_final, &info); return (info == 0); } #else { arma_ignore(Q); arma_ignore(R); arma_ignore(P); arma_ignore(X); arma_stop_logic_error("qr(): use of LAPACK must be enabled"); return false; } #endif } template inline bool auxlib::qr_pivot(Mat< std::complex >& Q, Mat< std::complex >& R, Mat& P, const Base,T1>& X) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { typedef typename std::complex eT; R = X.get_ref(); const uword R_n_rows = R.n_rows; const uword R_n_cols = R.n_cols; if(R.is_empty()) { Q.eye(R_n_rows, R_n_rows); P.set_size(R_n_cols, 1); for(uword col=0; col < R_n_cols; ++col) { P.at(col) = col; } return true; } arma_conform_assert_blas_size(R); blas_int m = static_cast(R_n_rows); blas_int n = static_cast(R_n_cols); blas_int lwork_min = (std::max)(blas_int(3*n + 1), (std::max)(m,n)); // take into account requirements of geqp3() and ungqr() blas_int k = (std::min)(m,n); blas_int info = 0; podarray tau( static_cast(k) ); podarray< T> rwork( 2*R_n_cols ); podarray jpvt( R_n_cols ); jpvt.zeros(); eT work_query[2] = {}; blas_int lwork_query = -1; arma_debug_print("lapack::geqp3()"); lapack::cx_geqp3(&m, &n, R.memptr(), &m, jpvt.memptr(), tau.memptr(), &work_query[0], &lwork_query, rwork.memptr(), &info); if(info != 0) { return false; } blas_int lwork_proposed = static_cast( access::tmp_real(work_query[0]) ); blas_int lwork_final = (std::max)(lwork_proposed, lwork_min); podarray work( static_cast(lwork_final) ); arma_debug_print("lapack::geqp3()"); lapack::cx_geqp3(&m, &n, R.memptr(), &m, jpvt.memptr(), tau.memptr(), work.memptr(), &lwork_final, rwork.memptr(), &info); if(info != 0) { return false; } Q.set_size(R_n_rows, R_n_rows); arrayops::copy( Q.memptr(), R.memptr(), (std::min)(Q.n_elem, R.n_elem) ); // // construct R and P P.set_size(R_n_cols, 1); for(uword col=0; col < R_n_cols; ++col) { for(uword row=(col+1); row < R_n_rows; ++row) { R.at(row,col) = eT(0); } P.at(col) = jpvt[col] - 1; // take into account that Fortran counts from 1 } arma_debug_print("lapack::ungqr()"); lapack::ungqr(&m, &m, &k, Q.memptr(), &m, tau.memptr(), work.memptr(), &lwork_final, &info); return (info == 0); } #else { arma_ignore(Q); arma_ignore(R); arma_ignore(P); arma_ignore(X); arma_stop_logic_error("qr(): use of LAPACK must be enabled"); return false; } #endif } template inline bool auxlib::svd(Col& S, Mat& A) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { if(A.is_empty()) { S.reset(); return true; } if(arma_config::check_nonfinite && A.internal_has_nonfinite()) { return false; } arma_conform_assert_blas_size(A); Mat U(1, 1, arma_nozeros_indicator()); Mat V(1, A.n_cols, arma_nozeros_indicator()); char jobu = 'N'; char jobvt = 'N'; blas_int m = blas_int(A.n_rows); blas_int n = blas_int(A.n_cols); blas_int min_mn = (std::min)(m,n); blas_int lda = blas_int(A.n_rows); blas_int ldu = blas_int(U.n_rows); blas_int ldvt = blas_int(V.n_rows); blas_int lwork_min = (std::max)( blas_int(1), (std::max)( (3*min_mn + (std::max)(m,n)), 5*min_mn ) ); blas_int info = 0; S.set_size( static_cast(min_mn) ); blas_int lwork_proposed = 0; if(A.n_elem >= 1024) { eT work_query[2] = {}; blas_int lwork_query = -1; arma_debug_print("lapack::gesvd()"); lapack::gesvd(&jobu, &jobvt, &m, &n, A.memptr(), &lda, S.memptr(), U.memptr(), &ldu, V.memptr(), &ldvt, &work_query[0], &lwork_query, &info); if(info != 0) { return false; } lwork_proposed = static_cast( work_query[0] ); } blas_int lwork_final = (std::max)(lwork_proposed, lwork_min); podarray work( static_cast(lwork_final) ); arma_debug_print("lapack::gesvd()"); lapack::gesvd(&jobu, &jobvt, &m, &n, A.memptr(), &lda, S.memptr(), U.memptr(), &ldu, V.memptr(), &ldvt, work.memptr(), &lwork_final, &info); return (info == 0); } #else { arma_ignore(S); arma_ignore(A); arma_stop_logic_error("svd(): use of LAPACK must be enabled"); return false; } #endif } template inline bool auxlib::svd(Col& S, Mat< std::complex >& A) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { typedef std::complex eT; if(A.is_empty()) { S.reset(); return true; } if(arma_config::check_nonfinite && A.internal_has_nonfinite()) { return false; } arma_conform_assert_blas_size(A); Mat U(1, 1, arma_nozeros_indicator()); Mat V(1, A.n_cols, arma_nozeros_indicator()); char jobu = 'N'; char jobvt = 'N'; blas_int m = blas_int(A.n_rows); blas_int n = blas_int(A.n_cols); blas_int min_mn = (std::min)(m,n); blas_int lda = blas_int(A.n_rows); blas_int ldu = blas_int(U.n_rows); blas_int ldvt = blas_int(V.n_rows); blas_int lwork_min = (std::max)( blas_int(1), 2*min_mn+(std::max)(m,n) ); blas_int info = 0; S.set_size( static_cast(min_mn) ); podarray rwork( static_cast(5*min_mn) ); blas_int lwork_proposed = 0; if(A.n_elem >= 256) { eT work_query[2] = {}; blas_int lwork_query = -1; // query to find optimum size of workspace arma_debug_print("lapack::cx_gesvd()"); lapack::cx_gesvd(&jobu, &jobvt, &m, &n, A.memptr(), &lda, S.memptr(), U.memptr(), &ldu, V.memptr(), &ldvt, &work_query[0], &lwork_query, rwork.memptr(), &info); if(info != 0) { return false; } lwork_proposed = static_cast( access::tmp_real(work_query[0]) ); } blas_int lwork_final = (std::max)(lwork_proposed, lwork_min); podarray work( static_cast(lwork_final) ); arma_debug_print("lapack::cx_gesvd()"); lapack::cx_gesvd(&jobu, &jobvt, &m, &n, A.memptr(), &lda, S.memptr(), U.memptr(), &ldu, V.memptr(), &ldvt, work.memptr(), &lwork_final, rwork.memptr(), &info); return (info == 0); } #else { arma_ignore(S); arma_ignore(A); arma_stop_logic_error("svd(): use of LAPACK must be enabled"); return false; } #endif } template inline bool auxlib::svd(Mat& U, Col& S, Mat& V, Mat& A) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { if(A.is_empty()) { U.eye(A.n_rows, A.n_rows); S.reset(); V.eye(A.n_cols, A.n_cols); return true; } if(arma_config::check_nonfinite && A.internal_has_nonfinite()) { return false; } arma_conform_assert_blas_size(A); U.set_size(A.n_rows, A.n_rows); V.set_size(A.n_cols, A.n_cols); char jobu = 'A'; char jobvt = 'A'; blas_int m = blas_int(A.n_rows); blas_int n = blas_int(A.n_cols); blas_int min_mn = (std::min)(m,n); blas_int lda = blas_int(A.n_rows); blas_int ldu = blas_int(U.n_rows); blas_int ldvt = blas_int(V.n_rows); blas_int lwork_min = (std::max)( blas_int(1), (std::max)( (3*min_mn + (std::max)(m,n)), 5*min_mn ) ); blas_int info = 0; S.set_size( static_cast(min_mn) ); blas_int lwork_proposed = 0; if(A.n_elem >= 1024) { // query to find optimum size of workspace eT work_query[2] = {}; blas_int lwork_query = -1; arma_debug_print("lapack::gesvd()"); lapack::gesvd(&jobu, &jobvt, &m, &n, A.memptr(), &lda, S.memptr(), U.memptr(), &ldu, V.memptr(), &ldvt, &work_query[0], &lwork_query, &info); if(info != 0) { return false; } lwork_proposed = static_cast( work_query[0] ); } blas_int lwork_final = (std::max)(lwork_proposed, lwork_min); podarray work( static_cast(lwork_final) ); arma_debug_print("lapack::gesvd()"); lapack::gesvd(&jobu, &jobvt, &m, &n, A.memptr(), &lda, S.memptr(), U.memptr(), &ldu, V.memptr(), &ldvt, work.memptr(), &lwork_final, &info); if(info != 0) { return false; } op_strans::apply_mat_inplace(V); return true; } #else { arma_ignore(U); arma_ignore(S); arma_ignore(V); arma_ignore(A); arma_stop_logic_error("svd(): use of LAPACK must be enabled"); return false; } #endif } template inline bool auxlib::svd(Mat< std::complex >& U, Col& S, Mat< std::complex >& V, Mat< std::complex >& A) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { typedef std::complex eT; if(A.is_empty()) { U.eye(A.n_rows, A.n_rows); S.reset(); V.eye(A.n_cols, A.n_cols); return true; } if(arma_config::check_nonfinite && A.internal_has_nonfinite()) { return false; } arma_conform_assert_blas_size(A); U.set_size(A.n_rows, A.n_rows); V.set_size(A.n_cols, A.n_cols); char jobu = 'A'; char jobvt = 'A'; blas_int m = blas_int(A.n_rows); blas_int n = blas_int(A.n_cols); blas_int min_mn = (std::min)(m,n); blas_int lda = blas_int(A.n_rows); blas_int ldu = blas_int(U.n_rows); blas_int ldvt = blas_int(V.n_rows); blas_int lwork_min = (std::max)( blas_int(1), 2*min_mn + (std::max)(m,n) ); blas_int info = 0; S.set_size( static_cast(min_mn) ); podarray rwork( static_cast(5*min_mn) ); blas_int lwork_proposed = 0; if(A.n_elem >= 256) { eT work_query[2] = {}; blas_int lwork_query = -1; // query to find optimum size of workspace arma_debug_print("lapack::cx_gesvd()"); lapack::cx_gesvd(&jobu, &jobvt, &m, &n, A.memptr(), &lda, S.memptr(), U.memptr(), &ldu, V.memptr(), &ldvt, &work_query[0], &lwork_query, rwork.memptr(), &info); if(info != 0) { return false; } lwork_proposed = static_cast( access::tmp_real(work_query[0]) ); } blas_int lwork_final = (std::max)(lwork_proposed, lwork_min); podarray work( static_cast(lwork_final) ); arma_debug_print("lapack::cx_gesvd()"); lapack::cx_gesvd(&jobu, &jobvt, &m, &n, A.memptr(), &lda, S.memptr(), U.memptr(), &ldu, V.memptr(), &ldvt, work.memptr(), &lwork_final, rwork.memptr(), &info); if(info != 0) { return false; } op_htrans::apply_mat_inplace(V); return true; } #else { arma_ignore(U); arma_ignore(S); arma_ignore(V); arma_ignore(A); arma_stop_logic_error("svd(): use of LAPACK must be enabled"); return false; } #endif } template inline bool auxlib::svd_econ(Mat& U, Col& S, Mat& V, Mat& A, const char mode) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { if(A.is_empty()) { U.eye(); S.reset(); V.eye(); return true; } if(arma_config::check_nonfinite && A.internal_has_nonfinite()) { return false; } arma_conform_assert_blas_size(A); blas_int m = blas_int(A.n_rows); blas_int n = blas_int(A.n_cols); blas_int min_mn = (std::min)(m,n); blas_int lda = blas_int(A.n_rows); S.set_size( static_cast(min_mn) ); blas_int ldu = 0; blas_int ldvt = 0; char jobu = char(0); char jobvt = char(0); if(mode == 'l') { jobu = 'S'; jobvt = 'N'; ldu = m; ldvt = 1; U.set_size( static_cast(ldu), static_cast(min_mn) ); V.reset(); } if(mode == 'r') { jobu = 'N'; jobvt = 'S'; ldu = 1; ldvt = (std::min)(m,n); U.reset(); V.set_size( static_cast(ldvt), static_cast(n) ); } if(mode == 'b') { jobu = 'S'; jobvt = 'S'; ldu = m; ldvt = (std::min)(m,n); U.set_size( static_cast(ldu), static_cast(min_mn) ); V.set_size( static_cast(ldvt), static_cast(n ) ); } blas_int lwork_min = (std::max)( blas_int(1), (std::max)( (3*min_mn + (std::max)(m,n)), 5*min_mn ) ); blas_int info = 0; blas_int lwork_proposed = 0; if(A.n_elem >= 1024) { eT work_query[2] = {}; blas_int lwork_query = -1; // query to find optimum size of workspace arma_debug_print("lapack::gesvd()"); lapack::gesvd(&jobu, &jobvt, &m, &n, A.memptr(), &lda, S.memptr(), U.memptr(), &ldu, V.memptr(), &ldvt, &work_query[0], &lwork_query, &info); if(info != 0) { return false; } lwork_proposed = static_cast(work_query[0]); } blas_int lwork_final = (std::max)(lwork_proposed, lwork_min); podarray work( static_cast(lwork_final) ); arma_debug_print("lapack::gesvd()"); lapack::gesvd(&jobu, &jobvt, &m, &n, A.memptr(), &lda, S.memptr(), U.memptr(), &ldu, V.memptr(), &ldvt, work.memptr(), &lwork_final, &info); if(info != 0) { return false; } op_strans::apply_mat_inplace(V); return true; } #else { arma_ignore(U); arma_ignore(S); arma_ignore(V); arma_ignore(A); arma_ignore(mode); arma_stop_logic_error("svd(): use of LAPACK must be enabled"); return false; } #endif } template inline bool auxlib::svd_econ(Mat< std::complex >& U, Col& S, Mat< std::complex >& V, Mat< std::complex >& A, const char mode) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { typedef std::complex eT; if(A.is_empty()) { U.eye(); S.reset(); V.eye(); return true; } if(arma_config::check_nonfinite && A.internal_has_nonfinite()) { return false; } arma_conform_assert_blas_size(A); blas_int m = blas_int(A.n_rows); blas_int n = blas_int(A.n_cols); blas_int min_mn = (std::min)(m,n); blas_int lda = blas_int(A.n_rows); S.set_size( static_cast(min_mn) ); blas_int ldu = 0; blas_int ldvt = 0; char jobu = char(0); char jobvt = char(0); if(mode == 'l') { jobu = 'S'; jobvt = 'N'; ldu = m; ldvt = 1; U.set_size( static_cast(ldu), static_cast(min_mn) ); V.reset(); } if(mode == 'r') { jobu = 'N'; jobvt = 'S'; ldu = 1; ldvt = (std::min)(m,n); U.reset(); V.set_size( static_cast(ldvt), static_cast(n) ); } if(mode == 'b') { jobu = 'S'; jobvt = 'S'; ldu = m; ldvt = (std::min)(m,n); U.set_size( static_cast(ldu), static_cast(min_mn) ); V.set_size( static_cast(ldvt), static_cast(n) ); } blas_int lwork_min = (std::max)( blas_int(1), (std::max)( (3*min_mn + (std::max)(m,n)), 5*min_mn ) ); blas_int info = 0; podarray rwork( static_cast(5*min_mn) ); blas_int lwork_proposed = 0; if(A.n_elem >= 256) { eT work_query[2] = {}; blas_int lwork_query = -1; // query to find optimum size of workspace arma_debug_print("lapack::cx_gesvd()"); lapack::cx_gesvd(&jobu, &jobvt, &m, &n, A.memptr(), &lda, S.memptr(), U.memptr(), &ldu, V.memptr(), &ldvt, &work_query[0], &lwork_query, rwork.memptr(), &info); if(info != 0) { return false; } lwork_proposed = static_cast( access::tmp_real(work_query[0]) ); } blas_int lwork_final = (std::max)(lwork_proposed, lwork_min); podarray work( static_cast(lwork_final) ); arma_debug_print("lapack::cx_gesvd()"); lapack::cx_gesvd(&jobu, &jobvt, &m, &n, A.memptr(), &lda, S.memptr(), U.memptr(), &ldu, V.memptr(), &ldvt, work.memptr(), &lwork_final, rwork.memptr(), &info); if(info != 0) { return false; } op_htrans::apply_mat_inplace(V); return true; } #else { arma_ignore(U); arma_ignore(S); arma_ignore(V); arma_ignore(A); arma_ignore(mode); arma_stop_logic_error("svd(): use of LAPACK must be enabled"); return false; } #endif } template inline bool auxlib::svd_dc(Col& S, Mat& A) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { if(A.is_empty()) { S.reset(); return true; } if(arma_config::check_nonfinite && A.internal_has_nonfinite()) { return false; } arma_conform_assert_blas_size(A); Mat U(1, 1, arma_nozeros_indicator()); Mat V(1, 1, arma_nozeros_indicator()); char jobz = 'N'; blas_int m = blas_int(A.n_rows); blas_int n = blas_int(A.n_cols); blas_int min_mn = (std::min)(m,n); blas_int max_mn = (std::max)(m,n); blas_int lda = blas_int(A.n_rows); blas_int ldu = blas_int(U.n_rows); blas_int ldvt = blas_int(V.n_rows); blas_int lwork_min = 3*min_mn + (std::max)( max_mn, 7*min_mn ); blas_int info = 0; S.set_size( static_cast(min_mn) ); podarray iwork( static_cast(8*min_mn) ); blas_int lwork_proposed = 0; if(A.n_elem >= 1024) { eT work_query[2] = {}; blas_int lwork_query = blas_int(-1); arma_debug_print("lapack::gesdd()"); lapack::gesdd(&jobz, &m, &n, A.memptr(), &lda, S.memptr(), U.memptr(), &ldu, V.memptr(), &ldvt, &work_query[0], &lwork_query, iwork.memptr(), &info); if(info != 0) { return false; } lwork_proposed = static_cast( work_query[0] ); } blas_int lwork_final = (std::max)(lwork_proposed, lwork_min); podarray work( static_cast(lwork_final) ); arma_debug_print("lapack::gesdd()"); lapack::gesdd(&jobz, &m, &n, A.memptr(), &lda, S.memptr(), U.memptr(), &ldu, V.memptr(), &ldvt, work.memptr(), &lwork_final, iwork.memptr(), &info); return (info == 0); } #else { arma_ignore(S); arma_ignore(A); arma_stop_logic_error("svd(): use of LAPACK must be enabled"); return false; } #endif } template inline bool auxlib::svd_dc(Col& S, Mat< std::complex >& A) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { typedef std::complex eT; if(A.is_empty()) { S.reset(); return true; } if(arma_config::check_nonfinite && A.internal_has_nonfinite()) { return false; } arma_conform_assert_blas_size(A); Mat U(1, 1, arma_nozeros_indicator()); Mat V(1, 1, arma_nozeros_indicator()); char jobz = 'N'; blas_int m = blas_int(A.n_rows); blas_int n = blas_int(A.n_cols); blas_int min_mn = (std::min)(m,n); blas_int max_mn = (std::max)(m,n); blas_int lda = blas_int(A.n_rows); blas_int ldu = blas_int(U.n_rows); blas_int ldvt = blas_int(V.n_rows); blas_int lwork_min = 2*min_mn + max_mn; blas_int info = 0; S.set_size( static_cast(min_mn) ); podarray rwork( static_cast(7*min_mn) ); // from LAPACK 3.8 docs: LAPACK <= v3.6 needs 7*mn podarray iwork( static_cast(8*min_mn) ); blas_int lwork_proposed = 0; if(A.n_elem >= 256) { eT work_query[2] = {}; blas_int lwork_query = blas_int(-1); arma_debug_print("lapack::cx_gesdd()"); lapack::cx_gesdd(&jobz, &m, &n, A.memptr(), &lda, S.memptr(), U.memptr(), &ldu, V.memptr(), &ldvt, &work_query[0], &lwork_query, rwork.memptr(), iwork.memptr(), &info); if(info != 0) { return false; } lwork_proposed = static_cast( access::tmp_real(work_query[0]) ); } blas_int lwork_final = (std::max)(lwork_proposed, lwork_min); podarray work( static_cast(lwork_final) ); arma_debug_print("lapack::cx_gesdd()"); lapack::cx_gesdd(&jobz, &m, &n, A.memptr(), &lda, S.memptr(), U.memptr(), &ldu, V.memptr(), &ldvt, work.memptr(), &lwork_final, rwork.memptr(), iwork.memptr(), &info); return (info == 0); } #else { arma_ignore(S); arma_ignore(A); arma_stop_logic_error("svd(): use of LAPACK must be enabled"); return false; } #endif } template inline bool auxlib::svd_dc(Mat& U, Col& S, Mat& V, Mat& A) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { if(A.is_empty()) { U.eye(A.n_rows, A.n_rows); S.reset(); V.eye(A.n_cols, A.n_cols); return true; } if(arma_config::check_nonfinite && A.internal_has_nonfinite()) { return false; } arma_conform_assert_blas_size(A); U.set_size(A.n_rows, A.n_rows); V.set_size(A.n_cols, A.n_cols); char jobz = 'A'; blas_int m = blas_int(A.n_rows); blas_int n = blas_int(A.n_cols); blas_int min_mn = (std::min)(m,n); blas_int max_mn = (std::max)(m,n); blas_int lda = blas_int(A.n_rows); blas_int ldu = blas_int(U.n_rows); blas_int ldvt = blas_int(V.n_rows); blas_int lwork1 = 3*min_mn*min_mn + (std::max)(max_mn, 4*min_mn*min_mn + 4*min_mn); // as per LAPACK 3.2 docs blas_int lwork2 = 4*min_mn*min_mn + 6*min_mn + max_mn; // as per LAPACK 3.8 docs; consistent with LAPACK 3.4 docs blas_int lwork_min = (std::max)(lwork1, lwork2); // due to differences between LAPACK 3.2 and 3.8 blas_int info = 0; S.set_size( static_cast(min_mn) ); podarray iwork( static_cast(8*min_mn) ); blas_int lwork_proposed = 0; if(A.n_elem >= 1024) { eT work_query[2] = {}; blas_int lwork_query = blas_int(-1); arma_debug_print("lapack::gesdd()"); lapack::gesdd(&jobz, &m, &n, A.memptr(), &lda, S.memptr(), U.memptr(), &ldu, V.memptr(), &ldvt, &work_query[0], &lwork_query, iwork.memptr(), &info); if(info != 0) { return false; } lwork_proposed = static_cast(work_query[0]); } blas_int lwork_final = (std::max)(lwork_proposed, lwork_min); podarray work( static_cast(lwork_final) ); arma_debug_print("lapack::gesdd()"); lapack::gesdd(&jobz, &m, &n, A.memptr(), &lda, S.memptr(), U.memptr(), &ldu, V.memptr(), &ldvt, work.memptr(), &lwork_final, iwork.memptr(), &info); if(info != 0) { return false; } op_strans::apply_mat_inplace(V); return true; } #else { arma_ignore(U); arma_ignore(S); arma_ignore(V); arma_ignore(A); arma_stop_logic_error("svd(): use of LAPACK must be enabled"); return false; } #endif } template inline bool auxlib::svd_dc(Mat< std::complex >& U, Col& S, Mat< std::complex >& V, Mat< std::complex >& A) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { typedef std::complex eT; if(A.is_empty()) { U.eye(A.n_rows, A.n_rows); S.reset(); V.eye(A.n_cols, A.n_cols); return true; } if(arma_config::check_nonfinite && A.internal_has_nonfinite()) { return false; } arma_conform_assert_blas_size(A); U.set_size(A.n_rows, A.n_rows); V.set_size(A.n_cols, A.n_cols); char jobz = 'A'; blas_int m = blas_int(A.n_rows); blas_int n = blas_int(A.n_cols); blas_int min_mn = (std::min)(m,n); blas_int max_mn = (std::max)(m,n); blas_int lda = blas_int(A.n_rows); blas_int ldu = blas_int(U.n_rows); blas_int ldvt = blas_int(V.n_rows); blas_int lwork_min = min_mn*min_mn + 2*min_mn + max_mn; // as per LAPACK 3.2, 3.4, 3.8 docs blas_int lrwork = min_mn * ((std::max)(5*min_mn+7, 2*max_mn + 2*min_mn+1)); // as per LAPACK 3.4 docs; LAPACK 3.8 uses 5*min_mn+5 instead of 5*min_mn+7 blas_int info = 0; S.set_size( static_cast(min_mn) ); podarray rwork( static_cast(lrwork ) ); podarray iwork( static_cast(8*min_mn) ); blas_int lwork_proposed = 0; if(A.n_elem >= 256) { eT work_query[2] = {}; blas_int lwork_query = blas_int(-1); arma_debug_print("lapack::cx_gesdd()"); lapack::cx_gesdd(&jobz, &m, &n, A.memptr(), &lda, S.memptr(), U.memptr(), &ldu, V.memptr(), &ldvt, &work_query[0], &lwork_query, rwork.memptr(), iwork.memptr(), &info); if(info != 0) { return false; } lwork_proposed = static_cast( access::tmp_real(work_query[0]) ); } blas_int lwork_final = (std::max)(lwork_proposed, lwork_min); podarray work( static_cast(lwork_final) ); arma_debug_print("lapack::cx_gesdd()"); lapack::cx_gesdd(&jobz, &m, &n, A.memptr(), &lda, S.memptr(), U.memptr(), &ldu, V.memptr(), &ldvt, work.memptr(), &lwork_final, rwork.memptr(), iwork.memptr(), &info); if(info != 0) { return false; } op_htrans::apply_mat_inplace(V); return true; } #else { arma_ignore(U); arma_ignore(S); arma_ignore(V); arma_ignore(A); arma_stop_logic_error("svd(): use of LAPACK must be enabled"); return false; } #endif } template inline bool auxlib::svd_dc_econ(Mat& U, Col& S, Mat& V, Mat& A) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { if(arma_config::check_nonfinite && A.internal_has_nonfinite()) { return false; } arma_conform_assert_blas_size(A); char jobz = 'S'; blas_int m = blas_int(A.n_rows); blas_int n = blas_int(A.n_cols); blas_int min_mn = (std::min)(m,n); blas_int max_mn = (std::max)(m,n); blas_int lda = blas_int(A.n_rows); blas_int ldu = m; blas_int ldvt = min_mn; blas_int lwork1 = 3*min_mn*min_mn + (std::max)( max_mn, 4*min_mn*min_mn + 4*min_mn ); // as per LAPACK 3.2 docs blas_int lwork2 = 4*min_mn*min_mn + 6*min_mn + max_mn; // as per LAPACK 3.4 docs; LAPACK 3.8 requires 4*min_mn*min_mn + 7*min_mn blas_int lwork_min = (std::max)(lwork1, lwork2); // due to differences between LAPACK 3.2 and 3.4 blas_int info = 0; if(A.is_empty()) { U.eye(); S.reset(); V.eye( static_cast(n), static_cast(min_mn) ); return true; } S.set_size( static_cast(min_mn) ); U.set_size( static_cast(m), static_cast(min_mn) ); V.set_size( static_cast(min_mn), static_cast(n) ); podarray iwork( static_cast(8*min_mn) ); blas_int lwork_proposed = 0; if(A.n_elem >= 1024) { eT work_query[2] = {}; blas_int lwork_query = blas_int(-1); arma_debug_print("lapack::gesdd()"); lapack::gesdd(&jobz, &m, &n, A.memptr(), &lda, S.memptr(), U.memptr(), &ldu, V.memptr(), &ldvt, &work_query[0], &lwork_query, iwork.memptr(), &info); if(info != 0) { return false; } lwork_proposed = static_cast(work_query[0]); } blas_int lwork_final = (std::max)(lwork_proposed, lwork_min); podarray work( static_cast(lwork_final) ); arma_debug_print("lapack::gesdd()"); lapack::gesdd(&jobz, &m, &n, A.memptr(), &lda, S.memptr(), U.memptr(), &ldu, V.memptr(), &ldvt, work.memptr(), &lwork_final, iwork.memptr(), &info); if(info != 0) { return false; } op_strans::apply_mat_inplace(V); return true; } #else { arma_ignore(U); arma_ignore(S); arma_ignore(V); arma_ignore(A); arma_stop_logic_error("svd(): use of LAPACK must be enabled"); return false; } #endif } template inline bool auxlib::svd_dc_econ(Mat< std::complex >& U, Col& S, Mat< std::complex >& V, Mat< std::complex >& A) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { typedef std::complex eT; if(arma_config::check_nonfinite && A.internal_has_nonfinite()) { return false; } arma_conform_assert_blas_size(A); char jobz = 'S'; blas_int m = blas_int(A.n_rows); blas_int n = blas_int(A.n_cols); blas_int min_mn = (std::min)(m,n); blas_int max_mn = (std::max)(m,n); blas_int lda = blas_int(A.n_rows); blas_int ldu = m; blas_int ldvt = min_mn; blas_int lwork_min = min_mn*min_mn + 2*min_mn + max_mn; // as per LAPACK 3.2 docs blas_int lrwork = min_mn * ((std::max)(5*min_mn+7, 2*max_mn + 2*min_mn+1)); // LAPACK 3.8 uses 5*min_mn+5 instead of 5*min_mn+7 blas_int info = 0; if(A.is_empty()) { U.eye(); S.reset(); V.eye( static_cast(n), static_cast(min_mn) ); return true; } S.set_size( static_cast(min_mn) ); U.set_size( static_cast(m), static_cast(min_mn) ); V.set_size( static_cast(min_mn), static_cast(n) ); podarray rwork( static_cast(lrwork ) ); podarray iwork( static_cast(8*min_mn) ); blas_int lwork_proposed = 0; if(A.n_elem >= 256) { eT work_query[2] = {}; blas_int lwork_query = blas_int(-1); arma_debug_print("lapack::cx_gesdd()"); lapack::cx_gesdd(&jobz, &m, &n, A.memptr(), &lda, S.memptr(), U.memptr(), &ldu, V.memptr(), &ldvt, &work_query[0], &lwork_query, rwork.memptr(), iwork.memptr(), &info); if(info != 0) { return false; } lwork_proposed = static_cast( access::tmp_real(work_query[0]) ); } blas_int lwork_final = (std::max)(lwork_proposed, lwork_min); podarray work( static_cast(lwork_final) ); arma_debug_print("lapack::cx_gesdd()"); lapack::cx_gesdd(&jobz, &m, &n, A.memptr(), &lda, S.memptr(), U.memptr(), &ldu, V.memptr(), &ldvt, work.memptr(), &lwork_final, rwork.memptr(), iwork.memptr(), &info); if(info != 0) { return false; } op_htrans::apply_mat_inplace(V); return true; } #else { arma_ignore(U); arma_ignore(S); arma_ignore(V); arma_ignore(A); arma_stop_logic_error("svd(): use of LAPACK must be enabled"); return false; } #endif } //! solve a system of linear equations via LU decomposition template inline bool auxlib::solve_square_fast(Mat& out, Mat& A, const Base& B_expr) { arma_debug_sigprint(); out = B_expr.get_ref(); const uword B_n_rows = out.n_rows; const uword B_n_cols = out.n_cols; arma_conform_check( (A.n_rows != B_n_rows), "solve(): number of rows in given matrices must be the same", [&](){ out.soft_reset(); } ); if(A.is_empty() || out.is_empty()) { out.zeros(A.n_cols, B_n_cols); return true; } #if defined(ARMA_USE_LAPACK) { typedef typename T1::elem_type eT; arma_conform_assert_blas_size(A); blas_int n = blas_int(A.n_rows); // assuming A is square blas_int lda = blas_int(A.n_rows); blas_int ldb = blas_int(B_n_rows); blas_int nrhs = blas_int(B_n_cols); blas_int info = blas_int(0); podarray ipiv(A.n_rows + 2); // +2 for paranoia: some versions of Lapack might be trashing memory arma_debug_print("lapack::gesv()"); lapack::gesv(&n, &nrhs, A.memptr(), &lda, ipiv.memptr(), out.memptr(), &ldb, &info); return (info == 0); } #else { arma_stop_logic_error("solve(): use of LAPACK must be enabled"); return false; } #endif } //! solve a system of linear equations via LU decomposition with rcond estimate template inline bool auxlib::solve_square_rcond(Mat& out, typename T1::pod_type& out_rcond, Mat& A, const Base& B_expr) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { typedef typename T1::elem_type eT; typedef typename T1::pod_type T; out_rcond = T(0); out = B_expr.get_ref(); const uword B_n_rows = out.n_rows; const uword B_n_cols = out.n_cols; arma_conform_check( (A.n_rows != B_n_rows), "solve(): number of rows in given matrices must be the same", [&](){ out.soft_reset(); } ); if(A.is_empty() || out.is_empty()) { out.zeros(A.n_cols, B_n_cols); return true; } arma_conform_assert_blas_size(A); char norm_id = '1'; char trans = 'N'; blas_int n = blas_int(A.n_rows); // assuming A is square blas_int lda = blas_int(A.n_rows); blas_int ldb = blas_int(B_n_rows); blas_int nrhs = blas_int(B_n_cols); blas_int info = blas_int(0); T norm_val = T(0); podarray junk(1); podarray ipiv(A.n_rows + 2); // +2 for paranoia arma_debug_print("lapack::lange()"); norm_val = (has_blas_float_bug::value) ? auxlib::norm1_gen(A) : lapack::lange(&norm_id, &n, &n, A.memptr(), &lda, junk.memptr()); arma_debug_print("lapack::getrf()"); lapack::getrf(&n, &n, A.memptr(), &n, ipiv.memptr(), &info); if(info != blas_int(0)) { return false; } arma_debug_print("lapack::getrs()"); lapack::getrs(&trans, &n, &nrhs, A.memptr(), &lda, ipiv.memptr(), out.memptr(), &ldb, &info); if(info != blas_int(0)) { return false; } out_rcond = auxlib::lu_rcond(A, norm_val); return true; } #else { arma_ignore(out); arma_ignore(out_rcond); arma_ignore(A); arma_ignore(B_expr); arma_stop_logic_error("solve(): use of LAPACK must be enabled"); return false; } #endif } //! solve a system of linear equations via LU decomposition with refinement (real matrices) template inline bool auxlib::solve_square_refine(Mat& out, typename T1::pod_type& out_rcond, Mat& A, const Base& B_expr, const bool equilibrate) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { typedef typename T1::pod_type eT; // Mat B = B_expr.get_ref(); // B is overwritten by lapack::gesvx() if equilibrate is enabled quasi_unwrap UB(B_expr.get_ref()); // deliberately not declaring as const const Mat& UB_M_as_Mat = UB.M; // so we don't confuse the ?: operator below const bool use_copy = ((equilibrate && UB.is_const) || UB.is_alias(out)); Mat B_tmp; if(use_copy) { B_tmp = UB_M_as_Mat; } const Mat& B = (use_copy) ? B_tmp : UB_M_as_Mat; arma_conform_check( (A.n_rows != B.n_rows), "solve(): number of rows in given matrices must be the same" ); if(A.is_empty() || B.is_empty()) { out.zeros(A.n_rows, B.n_cols); return true; } arma_conform_assert_blas_size(A,B); out.set_size(A.n_rows, B.n_cols); char fact = (equilibrate) ? 'E' : 'N'; char trans = 'N'; char equed = char(0); blas_int n = blas_int(A.n_rows); blas_int nrhs = blas_int(B.n_cols); blas_int lda = blas_int(A.n_rows); blas_int ldaf = blas_int(A.n_rows); blas_int ldb = blas_int(A.n_rows); blas_int ldx = blas_int(A.n_rows); blas_int info = blas_int(0); eT rcond = eT(0); Mat AF(A.n_rows, A.n_rows, arma_nozeros_indicator()); podarray IPIV( A.n_rows); podarray R( A.n_rows); podarray C( A.n_rows); podarray FERR( B.n_cols); podarray BERR( B.n_cols); podarray WORK(4*A.n_rows); podarray IWORK( A.n_rows); arma_debug_print("lapack::gesvx()"); lapack::gesvx ( &fact, &trans, &n, &nrhs, A.memptr(), &lda, AF.memptr(), &ldaf, IPIV.memptr(), &equed, R.memptr(), C.memptr(), const_cast(B.memptr()), &ldb, out.memptr(), &ldx, &rcond, FERR.memptr(), BERR.memptr(), WORK.memptr(), IWORK.memptr(), &info ); // NOTE: using const_cast(B.memptr()) to allow B to be overwritten for equilibration; // NOTE: B is created as a copy of B_expr if equilibration is enabled; otherwise B is a reference to B_expr out_rcond = rcond; return ((info == 0) || (info == (n+1))); } #else { arma_ignore(out); arma_ignore(out_rcond); arma_ignore(A); arma_ignore(B_expr); arma_ignore(equilibrate); arma_stop_logic_error("solve(): use of LAPACK must be enabled"); return false; } #endif } //! solve a system of linear equations via LU decomposition with refinement (complex matrices) template inline bool auxlib::solve_square_refine(Mat< std::complex >& out, typename T1::pod_type& out_rcond, Mat< std::complex >& A, const Base,T1>& B_expr, const bool equilibrate) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { typedef typename T1::pod_type T; typedef typename std::complex eT; // Mat B = B_expr.get_ref(); // B is overwritten by lapack::cx_gesvx() if equilibrate is enabled quasi_unwrap UB(B_expr.get_ref()); // deliberately not declaring as const const Mat& UB_M_as_Mat = UB.M; // so we don't confuse the ?: operator below const bool use_copy = ((equilibrate && UB.is_const) || UB.is_alias(out)); Mat B_tmp; if(use_copy) { B_tmp = UB_M_as_Mat; } const Mat& B = (use_copy) ? B_tmp : UB_M_as_Mat; arma_conform_check( (A.n_rows != B.n_rows), "solve(): number of rows in given matrices must be the same" ); if(A.is_empty() || B.is_empty()) { out.zeros(A.n_rows, B.n_cols); return true; } arma_conform_assert_blas_size(A,B); out.set_size(A.n_rows, B.n_cols); char fact = (equilibrate) ? 'E' : 'N'; char trans = 'N'; char equed = char(0); blas_int n = blas_int(A.n_rows); blas_int nrhs = blas_int(B.n_cols); blas_int lda = blas_int(A.n_rows); blas_int ldaf = blas_int(A.n_rows); blas_int ldb = blas_int(A.n_rows); blas_int ldx = blas_int(A.n_rows); blas_int info = blas_int(0); T rcond = T(0); Mat AF(A.n_rows, A.n_rows, arma_nozeros_indicator()); podarray IPIV( A.n_rows); podarray< T> R( A.n_rows); podarray< T> C( A.n_rows); podarray< T> FERR( B.n_cols); podarray< T> BERR( B.n_cols); podarray WORK(2*A.n_rows); podarray< T> RWORK(2*A.n_rows); arma_debug_print("lapack::cx_gesvx()"); lapack::cx_gesvx ( &fact, &trans, &n, &nrhs, A.memptr(), &lda, AF.memptr(), &ldaf, IPIV.memptr(), &equed, R.memptr(), C.memptr(), const_cast(B.memptr()), &ldb, out.memptr(), &ldx, &rcond, FERR.memptr(), BERR.memptr(), WORK.memptr(), RWORK.memptr(), &info ); // NOTE: using const_cast(B.memptr()) to allow B to be overwritten for equilibration; // NOTE: B is created as a copy of B_expr if equilibration is enabled; otherwise B is a reference to B_expr out_rcond = rcond; return ((info == 0) || (info == (n+1))); } #else { arma_ignore(out); arma_ignore(out_rcond); arma_ignore(A); arma_ignore(B_expr); arma_ignore(equilibrate); arma_stop_logic_error("solve(): use of LAPACK must be enabled"); return false; } #endif } template inline bool auxlib::solve_sym_fast(Mat& out, Mat& A, const Base& B_expr) { arma_debug_sigprint(); out = B_expr.get_ref(); const uword B_n_rows = out.n_rows; const uword B_n_cols = out.n_cols; arma_conform_check( (A.n_rows != B_n_rows), "solve(): number of rows in given matrices must be the same", [&](){ out.soft_reset(); } ); if(A.is_empty() || out.is_empty()) { out.zeros(A.n_cols, B_n_cols); return true; } #if defined(ARMA_USE_LAPACK) { typedef typename T1::pod_type eT; arma_conform_assert_blas_size(A,out); char uplo = 'L'; blas_int n = blas_int(A.n_rows); blas_int lda = blas_int(A.n_rows); blas_int ldb = blas_int(out.n_rows); blas_int nrhs = blas_int(out.n_cols); blas_int lwork = (std::max)(blas_int(podarray_prealloc_n_elem::val), n); blas_int info = 0; podarray ipiv(A.n_rows); if(n > blas_int(podarray_prealloc_n_elem::val)) { eT work_query[2] = {}; blas_int lwork_query = -1; arma_debug_print("lapack::sytrf()"); lapack::sytrf(&uplo, &n, A.memptr(), &lda, ipiv.memptr(), &work_query[0], &lwork_query, &info); if(info != 0) { return false; } blas_int lwork_proposed = static_cast( access::tmp_real(work_query[0]) ); lwork = (std::max)(lwork_proposed, lwork); } podarray work( static_cast(lwork) ); arma_debug_print("lapack::sytrf()"); lapack::sytrf(&uplo, &n, A.memptr(), &lda, ipiv.memptr(), work.memptr(), &lwork, &info); if(info != 0) { return false; } arma_debug_print("lapack::sytrs()"); lapack::sytrs(&uplo, &n, &nrhs, A.memptr(), &lda, ipiv.memptr(), out.memptr(), &ldb, &info); return (info == 0); } #else { arma_stop_logic_error("solve(): use of LAPACK must be enabled"); return false; } #endif } template inline bool auxlib::solve_sym_fast(Mat< std::complex >& out, Mat< std::complex >& A, const Base< std::complex, T1 >& B_expr) { arma_debug_sigprint(); out = B_expr.get_ref(); const uword B_n_rows = out.n_rows; const uword B_n_cols = out.n_cols; arma_conform_check( (A.n_rows != B_n_rows), "solve(): number of rows in given matrices must be the same", [&](){ out.soft_reset(); } ); if(A.is_empty() || out.is_empty()) { out.zeros(A.n_cols, B_n_cols); return true; } #if defined(ARMA_CRIPPLED_LAPACK) { arma_debug_print("auxlib::solve_sym_fast(): redirecting to auxlib::solve_square_fast() due to crippled LAPACK"); return auxlib::solve_square_fast(out, A, B_expr); } #elif defined(ARMA_USE_LAPACK) { typedef typename T1::pod_type T; typedef std::complex eT; arma_conform_assert_blas_size(A,out); char uplo = 'L'; blas_int n = blas_int(A.n_rows); blas_int lda = blas_int(A.n_rows); blas_int ldb = blas_int(out.n_rows); blas_int nrhs = blas_int(out.n_cols); blas_int lwork = (std::max)(blas_int(podarray_prealloc_n_elem::val), n); blas_int info = 0; podarray ipiv(A.n_rows); if(n > blas_int(podarray_prealloc_n_elem::val)) { eT work_query[2] = {}; blas_int lwork_query = -1; arma_debug_print("lapack::hetrf()"); lapack::hetrf(&uplo, &n, A.memptr(), &lda, ipiv.memptr(), &work_query[0], &lwork_query, &info); if(info != 0) { return false; } blas_int lwork_proposed = static_cast( access::tmp_real(work_query[0]) ); lwork = (std::max)(lwork_proposed, lwork); } podarray work( static_cast(lwork) ); arma_debug_print("lapack::hetrf()"); lapack::hetrf(&uplo, &n, A.memptr(), &lda, ipiv.memptr(), work.memptr(), &lwork, &info); if(info != 0) { return false; } arma_debug_print("lapack::hetrs()"); lapack::hetrs(&uplo, &n, &nrhs, A.memptr(), &lda, ipiv.memptr(), out.memptr(), &ldb, &info); return (info == 0); } #else { arma_stop_logic_error("solve(): use of LAPACK must be enabled"); return false; } #endif } template inline bool auxlib::solve_sym_rcond(Mat& out, typename T1::pod_type& out_rcond, Mat& A, const Base& B_expr) { arma_debug_sigprint(); out = B_expr.get_ref(); const uword B_n_rows = out.n_rows; const uword B_n_cols = out.n_cols; arma_conform_check( (A.n_rows != B_n_rows), "solve(): number of rows in given matrices must be the same", [&](){ out.soft_reset(); } ); if(A.is_empty() || out.is_empty()) { out.zeros(A.n_cols, B_n_cols); return true; } #if defined(ARMA_CRIPPLED_LAPACK) { arma_debug_print("auxlib::solve_sym_rcond(): redirecting to auxlib::solve_square_rcond() due to crippled LAPACK"); return auxlib::solve_square_rcond(out, out_rcond, A, B_expr); } #elif defined(ARMA_USE_LAPACK) { typedef typename T1::pod_type eT; out_rcond = eT(0); arma_conform_assert_blas_size(A,out); char norm_id = '1'; char uplo = 'L'; blas_int n = blas_int(A.n_rows); blas_int lda = blas_int(A.n_rows); blas_int ldb = blas_int(out.n_rows); blas_int nrhs = blas_int(out.n_cols); blas_int lwork = (std::max)(blas_int(podarray_prealloc_n_elem::val), 2*n); // 2*n due to lapack::sycon() requirements blas_int info = 0; eT norm_val = eT(0); eT tmp_rcond = eT(0); podarray ipiv(A.n_rows); podarray iwork(A.n_rows); if( (2*n) > blas_int(podarray_prealloc_n_elem::val) ) { eT work_query[2] = {}; blas_int lwork_query = -1; arma_debug_print("lapack::sytrf()"); lapack::sytrf(&uplo, &n, A.memptr(), &lda, ipiv.memptr(), &work_query[0], &lwork_query, &info); if(info != 0) { return false; } blas_int lwork_proposed = static_cast( access::tmp_real(work_query[0]) ); lwork = (std::max)(lwork_proposed, lwork); } podarray work( static_cast(lwork) ); arma_debug_print("lapack::lansy()"); norm_val = (has_blas_float_bug::value) ? auxlib::norm1_sym(A) : lapack::lansy(&norm_id, &uplo, &n, A.memptr(), &n, work.memptr()); arma_debug_print("lapack::sytrf()"); lapack::sytrf(&uplo, &n, A.memptr(), &lda, ipiv.memptr(), work.memptr(), &lwork, &info); if(info != 0) { return false; } arma_debug_print("lapack::sytrs()"); lapack::sytrs(&uplo, &n, &nrhs, A.memptr(), &lda, ipiv.memptr(), out.memptr(), &ldb, &info); if(info != 0) { return false; } arma_debug_print("lapack::sycon()"); lapack::sycon(&uplo, &n, A.memptr(), &lda, ipiv.memptr(), &norm_val, &tmp_rcond, work.memptr(), iwork.memptr(), &info); out_rcond = tmp_rcond; return (info == 0); } #else { arma_stop_logic_error("solve(): use of LAPACK must be enabled"); return false; } #endif } template inline bool auxlib::solve_sym_rcond(Mat< std::complex >& out, typename T1::pod_type& out_rcond, Mat< std::complex >& A, const Base< std::complex,T1>& B_expr) { arma_debug_sigprint(); out = B_expr.get_ref(); const uword B_n_rows = out.n_rows; const uword B_n_cols = out.n_cols; arma_conform_check( (A.n_rows != B_n_rows), "solve(): number of rows in given matrices must be the same", [&](){ out.soft_reset(); } ); if(A.is_empty() || out.is_empty()) { out.zeros(A.n_cols, B_n_cols); return true; } #if defined(ARMA_USE_LAPACK) { typedef typename T1::pod_type T; typedef typename std::complex eT; out_rcond = T(0); arma_conform_assert_blas_size(A,out); char norm_id = '1'; char uplo = 'L'; blas_int n = blas_int(A.n_rows); blas_int lda = blas_int(A.n_rows); blas_int ldb = blas_int(out.n_rows); blas_int nrhs = blas_int(out.n_cols); blas_int lwork = (std::max)(blas_int(podarray_prealloc_n_elem::val), 2*n); // 2*n due to lapack::hecon() requirements blas_int info = 0; T norm_val = T(0); T tmp_rcond = T(0); podarray ipiv(A.n_rows); podarray lanhe_work(A.n_rows); if( (2*n) > blas_int(podarray_prealloc_n_elem::val) ) { eT work_query[2] = {}; blas_int lwork_query = -1; arma_debug_print("lapack::hetrf()"); lapack::hetrf(&uplo, &n, A.memptr(), &lda, ipiv.memptr(), &work_query[0], &lwork_query, &info); if(info != 0) { return false; } blas_int lwork_proposed = static_cast( access::tmp_real(work_query[0]) ); lwork = (std::max)(lwork_proposed, lwork); } podarray work( static_cast(lwork) ); arma_debug_print("lapack::lanhe()"); norm_val = (has_blas_float_bug::value) ? auxlib::norm1_sym(A) : lapack::lanhe(&norm_id, &uplo, &n, A.memptr(), &lda, lanhe_work.memptr()); arma_debug_print("lapack::hetrf()"); lapack::hetrf(&uplo, &n, A.memptr(), &lda, ipiv.memptr(), work.memptr(), &lwork, &info); if(info != 0) { return false; } arma_debug_print("lapack::hetrs()"); lapack::hetrs(&uplo, &n, &nrhs, A.memptr(), &lda, ipiv.memptr(), out.memptr(), &ldb, &info); if(info != 0) { return false; } arma_debug_print("lapack::hecon()"); lapack::hecon(&uplo, &n, A.memptr(), &lda, ipiv.memptr(), &norm_val, &tmp_rcond, work.memptr(), &info); out_rcond = tmp_rcond; return (info == 0); } #else { arma_stop_logic_error("solve(): use of LAPACK must be enabled"); return false; } #endif } template inline bool auxlib::solve_sympd_fast(Mat& out, Mat& A, const Base& B_expr) { arma_debug_sigprint(); #if defined(ARMA_CRIPPLED_LAPACK) { arma_debug_print("auxlib::solve_sympd_fast(): redirecting to auxlib::solve_square_fast() due to crippled LAPACK"); return auxlib::solve_square_fast(out, A, B_expr); } #else { return auxlib::solve_sympd_fast_common(out, A, B_expr); } #endif } template inline bool auxlib::solve_sympd_fast_common(Mat& out, Mat& A, const Base& B_expr) { arma_debug_sigprint(); out = B_expr.get_ref(); const uword B_n_rows = out.n_rows; const uword B_n_cols = out.n_cols; arma_conform_check( (A.n_rows != B_n_rows), "solve(): number of rows in given matrices must be the same", [&](){ out.soft_reset(); } ); if(A.is_empty() || out.is_empty()) { out.zeros(A.n_cols, B_n_cols); return true; } #if defined(ARMA_USE_LAPACK) { typedef typename T1::elem_type eT; arma_conform_assert_blas_size(A, out); char uplo = 'L'; blas_int n = blas_int(A.n_rows); // assuming A is square blas_int nrhs = blas_int(B_n_cols); blas_int lda = blas_int(A.n_rows); blas_int ldb = blas_int(B_n_rows); blas_int info = blas_int(0); arma_debug_print("lapack::posv()"); lapack::posv(&uplo, &n, &nrhs, A.memptr(), &lda, out.memptr(), &ldb, &info); return (info == 0); } #else { arma_ignore(out); arma_ignore(A); arma_ignore(B_expr); arma_stop_logic_error("solve(): use of LAPACK must be enabled"); return false; } #endif } //! solve a system of linear equations via Cholesky decomposition with rcond estimate (real matrices) template inline bool auxlib::solve_sympd_rcond(Mat& out, bool& out_sympd_state, typename T1::pod_type& out_rcond, Mat& A, const Base& B_expr) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { typedef typename T1::elem_type eT; typedef typename T1::pod_type T; out_sympd_state = false; out_rcond = T(0); out = B_expr.get_ref(); const uword B_n_rows = out.n_rows; const uword B_n_cols = out.n_cols; arma_conform_check( (A.n_rows != B_n_rows), "solve(): number of rows in given matrices must be the same", [&](){ out.soft_reset(); } ); if(A.is_empty() || out.is_empty()) { out.zeros(A.n_cols, B_n_cols); return true; } arma_conform_assert_blas_size(A, out); char norm_id = '1'; char uplo = 'L'; blas_int n = blas_int(A.n_rows); // assuming A is square blas_int nrhs = blas_int(B_n_cols); blas_int info = blas_int(0); T norm_val = T(0); podarray work(A.n_rows); arma_debug_print("lapack::lansy()"); norm_val = (has_blas_float_bug::value) ? auxlib::norm1_sym(A) : lapack::lansy(&norm_id, &uplo, &n, A.memptr(), &n, work.memptr()); arma_debug_print("lapack::potrf()"); lapack::potrf(&uplo, &n, A.memptr(), &n, &info); if(info != 0) { return false; } out_sympd_state = true; arma_debug_print("lapack::potrs()"); lapack::potrs(&uplo, &n, &nrhs, A.memptr(), &n, out.memptr(), &n, &info); if(info != 0) { return false; } out_rcond = auxlib::lu_rcond_sympd(A, norm_val); return true; } #else { arma_ignore(out); arma_ignore(out_sympd_state); arma_ignore(out_rcond); arma_ignore(A); arma_ignore(B_expr); arma_stop_logic_error("solve(): use of LAPACK must be enabled"); return false; } #endif } //! solve a system of linear equations via Cholesky decomposition with rcond estimate (complex matrices) template inline bool auxlib::solve_sympd_rcond(Mat< std::complex >& out, bool& out_sympd_state, typename T1::pod_type& out_rcond, Mat< std::complex >& A, const Base< std::complex,T1>& B_expr) { arma_debug_sigprint(); #if defined(ARMA_CRIPPLED_LAPACK) { arma_debug_print("auxlib::solve_sympd_rcond(): redirecting to auxlib::solve_square_rcond() due to crippled LAPACK"); out_sympd_state = false; return auxlib::solve_square_rcond(out, out_rcond, A, B_expr); } #elif defined(ARMA_USE_LAPACK) { typedef typename T1::pod_type T; typedef typename std::complex eT; out_sympd_state = false; out_rcond = T(0); out = B_expr.get_ref(); const uword B_n_rows = out.n_rows; const uword B_n_cols = out.n_cols; arma_conform_check( (A.n_rows != B_n_rows), "solve(): number of rows in given matrices must be the same", [&](){ out.soft_reset(); } ); if(A.is_empty() || out.is_empty()) { out.zeros(A.n_cols, B_n_cols); return true; } arma_conform_assert_blas_size(A, out); char norm_id = '1'; char uplo = 'L'; blas_int n = blas_int(A.n_rows); // assuming A is square blas_int nrhs = blas_int(B_n_cols); blas_int info = blas_int(0); T norm_val = T(0); podarray work(A.n_rows); arma_debug_print("lapack::lanhe()"); norm_val = (has_blas_float_bug::value) ? auxlib::norm1_sym(A) : lapack::lanhe(&norm_id, &uplo, &n, A.memptr(), &n, work.memptr()); arma_debug_print("lapack::potrf()"); lapack::potrf(&uplo, &n, A.memptr(), &n, &info); if(info != 0) { return false; } out_sympd_state = true; arma_debug_print("lapack::potrs()"); lapack::potrs(&uplo, &n, &nrhs, A.memptr(), &n, out.memptr(), &n, &info); if(info != 0) { return false; } out_rcond = auxlib::lu_rcond_sympd(A, norm_val); return true; } #else { arma_ignore(out); arma_ignore(out_sympd_state); arma_ignore(out_rcond); arma_ignore(A); arma_ignore(B_expr); arma_stop_logic_error("solve(): use of LAPACK must be enabled"); return false; } #endif } //! solve a system of linear equations via Cholesky decomposition with refinement (real matrices) template inline bool auxlib::solve_sympd_refine(Mat& out, typename T1::pod_type& out_rcond, Mat& A, const Base& B_expr, const bool equilibrate) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { typedef typename T1::pod_type eT; // Mat B = B_expr.get_ref(); // B is overwritten by lapack::posvx() if equilibrate is enabled quasi_unwrap UB(B_expr.get_ref()); // deliberately not declaring as const const Mat& UB_M_as_Mat = UB.M; // so we don't confuse the ?: operator below const bool use_copy = ((equilibrate && UB.is_const) || UB.is_alias(out)); Mat B_tmp; if(use_copy) { B_tmp = UB_M_as_Mat; } const Mat& B = (use_copy) ? B_tmp : UB_M_as_Mat; arma_conform_check( (A.n_rows != B.n_rows), "solve(): number of rows in given matrices must be the same" ); if(A.is_empty() || B.is_empty()) { out.zeros(A.n_rows, B.n_cols); return true; } arma_conform_assert_blas_size(A,B); out.set_size(A.n_rows, B.n_cols); char fact = (equilibrate) ? 'E' : 'N'; char uplo = 'L'; char equed = char(0); blas_int n = blas_int(A.n_rows); blas_int nrhs = blas_int(B.n_cols); blas_int lda = blas_int(A.n_rows); blas_int ldaf = blas_int(A.n_rows); blas_int ldb = blas_int(A.n_rows); blas_int ldx = blas_int(A.n_rows); blas_int info = blas_int(0); eT rcond = eT(0); Mat AF(A.n_rows, A.n_rows, arma_nozeros_indicator()); podarray S( A.n_rows); podarray FERR( B.n_cols); podarray BERR( B.n_cols); podarray WORK(3*A.n_rows); podarray IWORK( A.n_rows); arma_debug_print("lapack::posvx()"); lapack::posvx(&fact, &uplo, &n, &nrhs, A.memptr(), &lda, AF.memptr(), &ldaf, &equed, S.memptr(), const_cast(B.memptr()), &ldb, out.memptr(), &ldx, &rcond, FERR.memptr(), BERR.memptr(), WORK.memptr(), IWORK.memptr(), &info); // NOTE: using const_cast(B.memptr()) to allow B to be overwritten for equilibration; // NOTE: B is created as a copy of B_expr if equilibration is enabled; otherwise B is a reference to B_expr // NOTE: lapack::posvx() sets rcond to zero if A is not sympd out_rcond = rcond; return ((info == 0) || (info == (n+1))); } #else { arma_ignore(out); arma_ignore(out_rcond); arma_ignore(A); arma_ignore(B_expr); arma_ignore(equilibrate); arma_stop_logic_error("solve(): use of LAPACK must be enabled"); return false; } #endif } //! solve a system of linear equations via Cholesky decomposition with refinement (complex matrices) template inline bool auxlib::solve_sympd_refine(Mat< std::complex >& out, typename T1::pod_type& out_rcond, Mat< std::complex >& A, const Base,T1>& B_expr, const bool equilibrate) { arma_debug_sigprint(); #if defined(ARMA_CRIPPLED_LAPACK) { arma_debug_print("auxlib::solve_sympd_refine(): redirecting to auxlib::solve_square_refine() due to crippled LAPACK"); return auxlib::solve_square_refine(out, out_rcond, A, B_expr, equilibrate); } #elif defined(ARMA_USE_LAPACK) { typedef typename T1::pod_type T; typedef typename std::complex eT; // Mat B = B_expr.get_ref(); // B is overwritten by lapack::cx_posvx() if equilibrate is enabled quasi_unwrap UB(B_expr.get_ref()); // deliberately not declaring as const const Mat& UB_M_as_Mat = UB.M; // so we don't confuse the ?: operator below const bool use_copy = ((equilibrate && UB.is_const) || UB.is_alias(out)); Mat B_tmp; if(use_copy) { B_tmp = UB_M_as_Mat; } const Mat& B = (use_copy) ? B_tmp : UB_M_as_Mat; arma_conform_check( (A.n_rows != B.n_rows), "solve(): number of rows in given matrices must be the same" ); if(A.is_empty() || B.is_empty()) { out.zeros(A.n_rows, B.n_cols); return true; } arma_conform_assert_blas_size(A,B); out.set_size(A.n_rows, B.n_cols); char fact = (equilibrate) ? 'E' : 'N'; char uplo = 'L'; char equed = char(0); blas_int n = blas_int(A.n_rows); blas_int nrhs = blas_int(B.n_cols); blas_int lda = blas_int(A.n_rows); blas_int ldaf = blas_int(A.n_rows); blas_int ldb = blas_int(A.n_rows); blas_int ldx = blas_int(A.n_rows); blas_int info = blas_int(0); T rcond = T(0); Mat AF(A.n_rows, A.n_rows, arma_nozeros_indicator()); podarray< T> S( A.n_rows); podarray< T> FERR( B.n_cols); podarray< T> BERR( B.n_cols); podarray WORK(2*A.n_rows); podarray< T> RWORK( A.n_rows); arma_debug_print("lapack::cx_posvx()"); lapack::cx_posvx(&fact, &uplo, &n, &nrhs, A.memptr(), &lda, AF.memptr(), &ldaf, &equed, S.memptr(), const_cast(B.memptr()), &ldb, out.memptr(), &ldx, &rcond, FERR.memptr(), BERR.memptr(), WORK.memptr(), RWORK.memptr(), &info); // NOTE: using const_cast(B.memptr()) to allow B to be overwritten for equilibration; // NOTE: B is created as a copy of B_expr if equilibration is enabled; otherwise B is a reference to B_expr // NOTE: lapack::cx_posvx() sets rcond to zero if A is not sympd out_rcond = rcond; return ((info == 0) || (info == (n+1))); } #else { arma_ignore(out); arma_ignore(out_rcond); arma_ignore(A); arma_ignore(B_expr); arma_ignore(equilibrate); arma_stop_logic_error("solve(): use of LAPACK must be enabled"); return false; } #endif } //! solve a non-square full-rank system via QR or LQ decomposition template inline bool auxlib::solve_rect_fast(Mat& out, Mat& A, const Base& B_expr) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { typedef typename T1::elem_type eT; const unwrap U(B_expr.get_ref()); const Mat& B = U.M; arma_conform_check( (A.n_rows != B.n_rows), "solve(): number of rows in given matrices must be the same" ); if(A.is_empty() || B.is_empty()) { out.zeros(A.n_cols, B.n_cols); return true; } arma_conform_assert_blas_size(A,B); Mat tmp( (std::max)(A.n_rows, A.n_cols), B.n_cols, arma_nozeros_indicator() ); if(arma::size(tmp) == arma::size(B)) { tmp = B; } else { tmp.zeros(); tmp(0,0, arma::size(B)) = B; } char trans = 'N'; blas_int m = blas_int(A.n_rows); blas_int n = blas_int(A.n_cols); blas_int lda = blas_int(A.n_rows); blas_int ldb = blas_int(tmp.n_rows); blas_int nrhs = blas_int(B.n_cols); blas_int min_mn = (std::min)(m,n); blas_int lwork_min = (std::max)(blas_int(1), min_mn + (std::max)(min_mn, nrhs)); blas_int info = 0; blas_int lwork_proposed = 0; if(A.n_elem >= ((is_cx::yes) ? uword(256) : uword(1024))) { eT work_query[2] = {}; blas_int lwork_query = -1; arma_debug_print("lapack::gels()"); lapack::gels( &trans, &m, &n, &nrhs, A.memptr(), &lda, tmp.memptr(), &ldb, &work_query[0], &lwork_query, &info ); if(info != 0) { return false; } lwork_proposed = static_cast( access::tmp_real(work_query[0]) ); } blas_int lwork_final = (std::max)(lwork_proposed, lwork_min); podarray work( static_cast(lwork_final) ); arma_debug_print("lapack::gels()"); lapack::gels( &trans, &m, &n, &nrhs, A.memptr(), &lda, tmp.memptr(), &ldb, work.memptr(), &lwork_final, &info ); if(info != 0) { return false; } if(tmp.n_rows == A.n_cols) { out.steal_mem(tmp); } else { out = tmp.head_rows(A.n_cols); } return true; } #else { arma_ignore(out); arma_ignore(A); arma_ignore(B_expr); arma_stop_logic_error("solve(): use of LAPACK must be enabled"); return false; } #endif } //! solve a non-square full-rank system via QR or LQ decomposition with rcond estimate (experimental) template inline bool auxlib::solve_rect_rcond(Mat& out, typename T1::pod_type& out_rcond, Mat& A, const Base& B_expr) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { typedef typename T1::elem_type eT; typedef typename T1::pod_type T; out_rcond = T(0); const unwrap U(B_expr.get_ref()); const Mat& B = U.M; arma_conform_check( (A.n_rows != B.n_rows), "solve(): number of rows in given matrices must be the same" ); if(A.is_empty() || B.is_empty()) { out.zeros(A.n_cols, B.n_cols); return true; } arma_conform_assert_blas_size(A,B); Mat tmp( (std::max)(A.n_rows, A.n_cols), B.n_cols, arma_nozeros_indicator() ); if(arma::size(tmp) == arma::size(B)) { tmp = B; } else { tmp.zeros(); tmp(0,0, arma::size(B)) = B; } char trans = 'N'; blas_int m = blas_int(A.n_rows); blas_int n = blas_int(A.n_cols); blas_int lda = blas_int(A.n_rows); blas_int ldb = blas_int(tmp.n_rows); blas_int nrhs = blas_int(B.n_cols); blas_int min_mn = (std::min)(m,n); blas_int lwork_min = (std::max)(blas_int(1), min_mn + (std::max)(min_mn, nrhs)); blas_int info = 0; blas_int lwork_proposed = 0; if(A.n_elem >= ((is_cx::yes) ? uword(256) : uword(1024))) { eT work_query[2] = {}; blas_int lwork_query = -1; arma_debug_print("lapack::gels()"); lapack::gels( &trans, &m, &n, &nrhs, A.memptr(), &lda, tmp.memptr(), &ldb, &work_query[0], &lwork_query, &info ); if(info != 0) { return false; } lwork_proposed = static_cast( access::tmp_real(work_query[0]) ); } blas_int lwork_final = (std::max)(lwork_proposed, lwork_min); podarray work( static_cast(lwork_final) ); arma_debug_print("lapack::gels()"); lapack::gels( &trans, &m, &n, &nrhs, A.memptr(), &lda, tmp.memptr(), &ldb, work.memptr(), &lwork_final, &info ); if(info != 0) { return false; } if(A.n_rows >= A.n_cols) { arma_debug_print("estimating rcond via R"); // xGELS docs: for M >= N, A contains details of its QR decomposition as returned by xGEQRF // xGEQRF docs: elements on and above the diagonal contain the min(M,N)-by-N upper trapezoidal matrix R Mat R(A.n_cols, A.n_cols, arma_zeros_indicator()); for(uword col=0; col < A.n_cols; ++col) { for(uword row=0; row <= col; ++row) { R.at(row,col) = A.at(row,col); } } // determine quality of solution out_rcond = auxlib::rcond_trimat(R, 0); // 0: upper triangular; 1: lower triangular } else if(A.n_rows < A.n_cols) { arma_debug_print("estimating rcond via L"); // xGELS docs: for M < N, A contains details of its LQ decomposition as returned by xGELQF // xGELQF docs: elements on and below the diagonal contain the M-by-min(M,N) lower trapezoidal matrix L Mat L(A.n_rows, A.n_rows, arma_zeros_indicator()); for(uword col=0; col < A.n_rows; ++col) { for(uword row=col; row < A.n_rows; ++row) { L.at(row,col) = A.at(row,col); } } // determine quality of solution out_rcond = auxlib::rcond_trimat(L, 1); // 0: upper triangular; 1: lower triangular } if(tmp.n_rows == A.n_cols) { out.steal_mem(tmp); } else { out = tmp.head_rows(A.n_cols); } return true; } #else { arma_ignore(out); arma_ignore(out_rcond); arma_ignore(A); arma_ignore(B_expr); arma_stop_logic_error("solve(): use of LAPACK must be enabled"); return false; } #endif } template inline bool auxlib::solve_approx_svd(Mat& out, Mat& A, const Base& B_expr) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { typedef typename T1::pod_type eT; const unwrap U(B_expr.get_ref()); const Mat& B = U.M; arma_conform_check( (A.n_rows != B.n_rows), "solve(): number of rows in given matrices must be the same" ); if(A.is_empty() || B.is_empty()) { out.zeros(A.n_cols, B.n_cols); return true; } if(arma_config::check_nonfinite && A.internal_has_nonfinite()) { return false; } if(arma_config::check_nonfinite && B.internal_has_nonfinite()) { return false; } arma_conform_assert_blas_size(A,B); Mat tmp( (std::max)(A.n_rows, A.n_cols), B.n_cols, arma_nozeros_indicator() ); if(arma::size(tmp) == arma::size(B)) { tmp = B; } else { tmp.zeros(); tmp(0,0, arma::size(B)) = B; } blas_int m = blas_int(A.n_rows); blas_int n = blas_int(A.n_cols); blas_int min_mn = (std::min)(m, n); blas_int nrhs = blas_int(B.n_cols); blas_int lda = blas_int(A.n_rows); blas_int ldb = blas_int(tmp.n_rows); //eT rcond = eT(-1); // -1 means "use machine precision" eT rcond = (std::max)(A.n_rows, A.n_cols) * std::numeric_limits::epsilon(); blas_int rank = blas_int(0); blas_int info = blas_int(0); podarray S( static_cast(min_mn) ); // NOTE: assuming LAPACK 3.8+, where the workspace query also obtains liwork in addition to lwork blas_int ispec = blas_int(9); const char* const_name = (is_float::value) ? "SGELSD" : "DGELSD"; const char* const_opts = " "; char* name = const_cast(const_name); char* opts = const_cast(const_opts); blas_int n1 = m; blas_int n2 = n; blas_int n3 = nrhs; blas_int n4 = lda; blas_int laenv_result = (arma_config::hidden_args) ? blas_int(lapack::laenv(&ispec, name, opts, &n1, &n2, &n3, &n4, 6, 1)) : blas_int(0); blas_int smlsiz = (std::max)( blas_int(25), laenv_result ); blas_int smlsiz_p1 = blas_int(1) + smlsiz; blas_int nlvl = (std::max)( blas_int(0), blas_int(1) + blas_int( std::log2( double(min_mn)/double(smlsiz_p1) ) ) ); blas_int lwork_min = blas_int(12)*min_mn + blas_int(2)*min_mn*smlsiz + blas_int(8)*min_mn*nlvl + min_mn*nrhs + smlsiz_p1*smlsiz_p1; blas_int liwork_min = (std::max)( blas_int(1), (blas_int(3)*min_mn*nlvl + blas_int(11)*min_mn) ); eT work_query[2] = {}; blas_int iwork_query[2] = {}; blas_int lwork_query = blas_int(-1); arma_debug_print("lapack::gelsd()"); lapack::gelsd(&m, &n, &nrhs, A.memptr(), &lda, tmp.memptr(), &ldb, S.memptr(), &rcond, &rank, &work_query[0], &lwork_query, &iwork_query[0], &info); if(info != 0) { return false; } blas_int lwork_proposed = static_cast( access::tmp_real(work_query[0]) ); blas_int liwork_proposed = iwork_query[0]; blas_int lwork_final = (std::max)( lwork_proposed, lwork_min); blas_int liwork_final = (std::max)(liwork_proposed, liwork_min); podarray work( static_cast( lwork_final) ); podarray iwork( static_cast(liwork_final) ); arma_debug_print("lapack::gelsd()"); lapack::gelsd(&m, &n, &nrhs, A.memptr(), &lda, tmp.memptr(), &ldb, S.memptr(), &rcond, &rank, work.memptr(), &lwork_final, iwork.memptr(), &info); if(info != 0) { return false; } if(tmp.n_rows == A.n_cols) { out.steal_mem(tmp); } else { out = tmp.head_rows(A.n_cols); } return true; } #else { arma_ignore(out); arma_ignore(A); arma_ignore(B_expr); arma_stop_logic_error("solve(): use of LAPACK must be enabled"); return false; } #endif } template inline bool auxlib::solve_approx_svd(Mat< std::complex >& out, Mat< std::complex >& A, const Base,T1>& B_expr) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { typedef typename T1::pod_type T; typedef typename std::complex eT; const unwrap U(B_expr.get_ref()); const Mat& B = U.M; arma_conform_check( (A.n_rows != B.n_rows), "solve(): number of rows in given matrices must be the same" ); if(A.is_empty() || B.is_empty()) { out.zeros(A.n_cols, B.n_cols); return true; } if(arma_config::check_nonfinite && A.internal_has_nonfinite()) { return false; } if(arma_config::check_nonfinite && B.internal_has_nonfinite()) { return false; } arma_conform_assert_blas_size(A,B); Mat tmp( (std::max)(A.n_rows, A.n_cols), B.n_cols, arma_nozeros_indicator() ); if(arma::size(tmp) == arma::size(B)) { tmp = B; } else { tmp.zeros(); tmp(0,0, arma::size(B)) = B; } blas_int m = blas_int(A.n_rows); blas_int n = blas_int(A.n_cols); blas_int min_mn = (std::min)(m, n); blas_int nrhs = blas_int(B.n_cols); blas_int lda = blas_int(A.n_rows); blas_int ldb = blas_int(tmp.n_rows); //T rcond = T(-1); // -1 means "use machine precision" T rcond = (std::max)(A.n_rows, A.n_cols) * std::numeric_limits::epsilon(); blas_int rank = blas_int(0); blas_int info = blas_int(0); podarray S( static_cast(min_mn) ); // NOTE: assuming LAPACK 3.8+, where the workspace query also obtains lrwork and liwork in addition to lwork blas_int ispec = blas_int(9); const char* const_name = (is_float::value) ? "CGELSD" : "ZGELSD"; const char* const_opts = " "; char* name = const_cast(const_name); char* opts = const_cast(const_opts); blas_int n1 = m; blas_int n2 = n; blas_int n3 = nrhs; blas_int n4 = lda; blas_int laenv_result = (arma_config::hidden_args) ? blas_int(lapack::laenv(&ispec, name, opts, &n1, &n2, &n3, &n4, 6, 1)) : blas_int(0); blas_int smlsiz = (std::max)( blas_int(25), laenv_result ); blas_int smlsiz_p1 = blas_int(1) + smlsiz; blas_int nlvl = (std::max)( blas_int(0), blas_int(1) + blas_int( std::log2( double(min_mn)/double(smlsiz_p1) ) ) ); blas_int lwork_min = 2*min_mn + min_mn*nrhs; blas_int lrwork_min = (m >= n) ? blas_int(10)*n + blas_int(2)*n*smlsiz + blas_int(8)*n*nlvl + blas_int(3)*smlsiz*nrhs + (std::max)( (smlsiz_p1)*(smlsiz_p1), n*(blas_int(1)+nrhs) + blas_int(2)*nrhs ) : blas_int(10)*m + blas_int(2)*m*smlsiz + blas_int(8)*m*nlvl + blas_int(3)*smlsiz*nrhs + (std::max)( (smlsiz_p1)*(smlsiz_p1), n*(blas_int(1)+nrhs) + blas_int(2)*nrhs ); blas_int liwork_min = (std::max)( blas_int(1), (blas_int(3)*blas_int(min_mn)*nlvl + blas_int(11)*blas_int(min_mn)) ); eT work_query[2] = {}; T rwork_query[2] = {}; blas_int iwork_query[2] = {}; blas_int lwork_query = blas_int(-1); arma_debug_print("lapack::cx_gelsd()"); lapack::cx_gelsd(&m, &n, &nrhs, A.memptr(), &lda, tmp.memptr(), &ldb, S.memptr(), &rcond, &rank, &work_query[0], &lwork_query, &rwork_query[0], &iwork_query[0], &info); if(info != 0) { return false; } blas_int lwork_proposed = static_cast( access::tmp_real(work_query[0]) ); blas_int lrwork_proposed = static_cast( rwork_query[0] ); blas_int liwork_proposed = iwork_query[0]; blas_int lwork_final = (std::max)( lwork_proposed, lwork_min); blas_int lrwork_final = (std::max)(lrwork_proposed, lrwork_min); blas_int liwork_final = (std::max)(liwork_proposed, liwork_min); podarray work( static_cast( lwork_final) ); podarray rwork( static_cast(lrwork_final) ); podarray iwork( static_cast(liwork_final) ); arma_debug_print("lapack::cx_gelsd()"); lapack::cx_gelsd(&m, &n, &nrhs, A.memptr(), &lda, tmp.memptr(), &ldb, S.memptr(), &rcond, &rank, work.memptr(), &lwork_final, rwork.memptr(), iwork.memptr(), &info); if(info != 0) { return false; } if(tmp.n_rows == A.n_cols) { out.steal_mem(tmp); } else { out = tmp.head_rows(A.n_cols); } return true; } #else { arma_ignore(out); arma_ignore(A); arma_ignore(B_expr); arma_stop_logic_error("solve(): use of LAPACK must be enabled"); return false; } #endif } template inline bool auxlib::solve_trimat_fast(Mat& out, const Mat& A, const Base& B_expr, const uword layout) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { out = B_expr.get_ref(); const uword B_n_rows = out.n_rows; const uword B_n_cols = out.n_cols; arma_conform_check( (A.n_rows != B_n_rows), "solve(): number of rows in given matrices must be the same", [&](){ out.soft_reset(); } ); if(A.is_empty() || out.is_empty()) { out.zeros(A.n_cols, B_n_cols); return true; } arma_conform_assert_blas_size(A,out); char uplo = (layout == 0) ? 'U' : 'L'; char trans = 'N'; char diag = 'N'; blas_int n = blas_int(A.n_rows); blas_int nrhs = blas_int(B_n_cols); blas_int info = 0; arma_debug_print("lapack::trtrs()"); lapack::trtrs(&uplo, &trans, &diag, &n, &nrhs, A.memptr(), &n, out.memptr(), &n, &info); return (info == 0); } #else { arma_ignore(out); arma_ignore(A); arma_ignore(B_expr); arma_ignore(layout); arma_stop_logic_error("solve(): use of LAPACK must be enabled"); return false; } #endif } template inline bool auxlib::solve_trimat_rcond(Mat& out, typename T1::pod_type& out_rcond, const Mat& A, const Base& B_expr, const uword layout) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { typedef typename T1::pod_type T; out_rcond = T(0); out = B_expr.get_ref(); const uword B_n_rows = out.n_rows; const uword B_n_cols = out.n_cols; arma_conform_check( (A.n_rows != B_n_rows), "solve(): number of rows in given matrices must be the same", [&](){ out.soft_reset(); } ); if(A.is_empty() || out.is_empty()) { out.zeros(A.n_cols, B_n_cols); return true; } arma_conform_assert_blas_size(A,out); char uplo = (layout == 0) ? 'U' : 'L'; char trans = 'N'; char diag = 'N'; blas_int n = blas_int(A.n_rows); blas_int nrhs = blas_int(B_n_cols); blas_int info = 0; arma_debug_print("lapack::trtrs()"); lapack::trtrs(&uplo, &trans, &diag, &n, &nrhs, A.memptr(), &n, out.memptr(), &n, &info); if(info != 0) { return false; } // determine quality of solution out_rcond = auxlib::rcond_trimat(A, layout); return true; } #else { arma_ignore(out); arma_ignore(out_rcond); arma_ignore(A); arma_ignore(B_expr); arma_ignore(layout); arma_stop_logic_error("solve(): use of LAPACK must be enabled"); return false; } #endif } //! solve a system of linear equations via LU decomposition (real band matrix) template inline bool auxlib::solve_band_fast(Mat& out, Mat& A, const uword KL, const uword KU, const Base& B_expr) { arma_debug_sigprint(); return auxlib::solve_band_fast_common(out, A, KL, KU, B_expr); } //! solve a system of linear equations via LU decomposition (complex band matrix) template inline bool auxlib::solve_band_fast(Mat< std::complex >& out, Mat< std::complex >& A, const uword KL, const uword KU, const Base< std::complex,T1>& B_expr) { arma_debug_sigprint(); #if defined(ARMA_CRIPPLED_LAPACK) { arma_debug_print("auxlib::solve_band_fast(): redirecting to auxlib::solve_square_fast() due to crippled LAPACK"); arma_ignore(KL); arma_ignore(KU); return auxlib::solve_square_fast(out, A, B_expr); } #else { return auxlib::solve_band_fast_common(out, A, KL, KU, B_expr); } #endif } //! solve a system of linear equations via LU decomposition (band matrix) template inline bool auxlib::solve_band_fast_common(Mat& out, const Mat& A, const uword KL, const uword KU, const Base& B_expr) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { typedef typename T1::elem_type eT; out = B_expr.get_ref(); const uword B_n_rows = out.n_rows; const uword B_n_cols = out.n_cols; arma_conform_check( (A.n_rows != B_n_rows), "solve(): number of rows in given matrices must be the same", [&](){ out.soft_reset(); } ); if(A.is_empty() || out.is_empty()) { out.zeros(A.n_rows, B_n_cols); return true; } // for gbsv, matrix AB size: 2*KL+KU+1 x N; band representation of A stored in rows KL+1 to 2*KL+KU+1 (note: fortran counts from 1) Mat AB; band_helper::compress(AB, A, KL, KU, true); const uword N = AB.n_cols; // order of the original square matrix A arma_conform_assert_blas_size(AB,out); blas_int n = blas_int(N); blas_int kl = blas_int(KL); blas_int ku = blas_int(KU); blas_int nrhs = blas_int(B_n_cols); blas_int ldab = blas_int(AB.n_rows); blas_int ldb = blas_int(B_n_rows); blas_int info = blas_int(0); podarray ipiv(N + 2); // +2 for paranoia // NOTE: AB is overwritten arma_debug_print("lapack::gbsv()"); lapack::gbsv(&n, &kl, &ku, &nrhs, AB.memptr(), &ldab, ipiv.memptr(), out.memptr(), &ldb, &info); return (info == 0); } #else { arma_ignore(out); arma_ignore(A); arma_ignore(KL); arma_ignore(KU); arma_ignore(B_expr); arma_stop_logic_error("solve(): use of LAPACK must be enabled"); return false; } #endif } //! solve a system of linear equations via LU decomposition (real band matrix) template inline bool auxlib::solve_band_rcond(Mat& out, typename T1::pod_type& out_rcond, Mat& A, const uword KL, const uword KU, const Base& B_expr) { arma_debug_sigprint(); return auxlib::solve_band_rcond_common(out, out_rcond, A, KL, KU, B_expr); } //! solve a system of linear equations via LU decomposition (complex band matrix) template inline bool auxlib::solve_band_rcond(Mat< std::complex >& out, typename T1::pod_type& out_rcond, Mat< std::complex >& A, const uword KL, const uword KU, const Base< std::complex,T1>& B_expr) { arma_debug_sigprint(); #if defined(ARMA_CRIPPLED_LAPACK) { arma_debug_print("auxlib::solve_band_rcond(): redirecting to auxlib::solve_square_rcond() due to crippled LAPACK"); arma_ignore(KL); arma_ignore(KU); return auxlib::solve_square_rcond(out, out_rcond, A, B_expr); } #else { return auxlib::solve_band_rcond_common(out, out_rcond, A, KL, KU, B_expr); } #endif } //! solve a system of linear equations via LU decomposition (band matrix) template inline bool auxlib::solve_band_rcond_common(Mat& out, typename T1::pod_type& out_rcond, const Mat& A, const uword KL, const uword KU, const Base& B_expr) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { typedef typename T1::elem_type eT; typedef typename T1::pod_type T; out_rcond = T(0); out = B_expr.get_ref(); const uword B_n_rows = out.n_rows; const uword B_n_cols = out.n_cols; arma_conform_check( (A.n_rows != B_n_rows), "solve(): number of rows in given matrices must be the same", [&](){ out.soft_reset(); } ); if(A.is_empty() || out.is_empty()) { out.zeros(A.n_rows, B_n_cols); return true; } // for gbtrf, matrix AB size: 2*KL+KU+1 x N; band representation of A stored in rows KL+1 to 2*KL+KU+1 (note: fortran counts from 1) Mat AB; band_helper::compress(AB, A, KL, KU, true); const uword N = AB.n_cols; // order of the original square matrix A arma_conform_assert_blas_size(AB,out); //char norm_id = '1'; char trans = 'N'; blas_int n = blas_int(N); // assuming square matrix blas_int kl = blas_int(KL); blas_int ku = blas_int(KU); blas_int nrhs = blas_int(B_n_cols); blas_int ldab = blas_int(AB.n_rows); blas_int ldb = blas_int(B_n_rows); blas_int info = blas_int(0); T norm_val = T(0); //podarray junk(1); podarray ipiv(N + 2); // +2 for paranoia // // NOTE: lapack::langb() and lapack::gbtrf() use incompatible storage formats for the band matrix // arma_debug_print("lapack::langb()"); // norm_val = lapack::langb(&norm_id, &n, &kl, &ku, AB.memptr(), &ldab, junk.memptr()); norm_val = auxlib::norm1_band(A,KL,KU); arma_debug_print("lapack::gbtrf()"); lapack::gbtrf(&n, &n, &kl, &ku, AB.memptr(), &ldab, ipiv.memptr(), &info); if(info != 0) { return false; } arma_debug_print("lapack::gbtrs()"); lapack::gbtrs(&trans, &n, &kl, &ku, &nrhs, AB.memptr(), &ldab, ipiv.memptr(), out.memptr(), &ldb, &info); if(info != 0) { return false; } out_rcond = auxlib::lu_rcond_band(AB, KL, KU, ipiv, norm_val); return true; } #else { arma_ignore(out); arma_ignore(out_rcond); arma_ignore(A); arma_ignore(KL); arma_ignore(KU); arma_ignore(B_expr); arma_stop_logic_error("solve(): use of LAPACK must be enabled"); return false; } #endif } //! solve a system of linear equations via LU decomposition with refinement (real band matrices) template inline bool auxlib::solve_band_refine(Mat& out, typename T1::pod_type& out_rcond, Mat& A, const uword KL, const uword KU, const Base& B_expr, const bool equilibrate) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { typedef typename T1::pod_type eT; Mat B = B_expr.get_ref(); // B is overwritten arma_conform_check( (A.n_rows != B.n_rows), "solve(): number of rows in given matrices must be the same" ); if(A.is_empty() || B.is_empty()) { out.zeros(A.n_rows, B.n_cols); return true; } // for gbsvx, matrix AB size: KL+KU+1 x N; band representation of A stored in rows 1 to KL+KU+1 (note: fortran counts from 1) Mat AB; band_helper::compress(AB, A, KL, KU, false); const uword N = AB.n_cols; arma_conform_assert_blas_size(AB,B); out.set_size(N, B.n_cols); Mat AFB(2*KL+KU+1, N, arma_nozeros_indicator()); char fact = (equilibrate) ? 'E' : 'N'; char trans = 'N'; char equed = char(0); blas_int n = blas_int(N); blas_int kl = blas_int(KL); blas_int ku = blas_int(KU); blas_int nrhs = blas_int(B.n_cols); blas_int ldab = blas_int(AB.n_rows); blas_int ldafb = blas_int(AFB.n_rows); blas_int ldb = blas_int(B.n_rows); blas_int ldx = blas_int(N); blas_int info = blas_int(0); eT rcond = eT(0); podarray IPIV( N); podarray R( N); podarray C( N); podarray FERR( B.n_cols); podarray BERR( B.n_cols); podarray WORK(3*N); podarray IWORK( N); arma_debug_print("lapack::gbsvx()"); lapack::gbsvx ( &fact, &trans, &n, &kl, &ku, &nrhs, AB.memptr(), &ldab, AFB.memptr(), &ldafb, IPIV.memptr(), &equed, R.memptr(), C.memptr(), B.memptr(), &ldb, out.memptr(), &ldx, &rcond, FERR.memptr(), BERR.memptr(), WORK.memptr(), IWORK.memptr(), &info ); out_rcond = rcond; return ((info == 0) || (info == (n+1))); } #else { arma_ignore(out); arma_ignore(out_rcond); arma_ignore(A); arma_ignore(KL); arma_ignore(KU); arma_ignore(B_expr); arma_ignore(equilibrate); arma_stop_logic_error("solve(): use of LAPACK must be enabled"); return false; } #endif } //! solve a system of linear equations via LU decomposition with refinement (complex band matrices) template inline bool auxlib::solve_band_refine(Mat< std::complex >& out, typename T1::pod_type& out_rcond, Mat< std::complex >& A, const uword KL, const uword KU, const Base,T1>& B_expr, const bool equilibrate) { arma_debug_sigprint(); #if defined(ARMA_CRIPPLED_LAPACK) { arma_debug_print("auxlib::solve_band_refine(): redirecting to auxlib::solve_square_refine() due to crippled LAPACK"); arma_ignore(KL); arma_ignore(KU); return auxlib::solve_square_refine(out, out_rcond, A, B_expr, equilibrate); } #elif defined(ARMA_USE_LAPACK) { typedef typename T1::pod_type T; typedef typename std::complex eT; Mat B = B_expr.get_ref(); // B is overwritten arma_conform_check( (A.n_rows != B.n_rows), "solve(): number of rows in given matrices must be the same" ); if(A.is_empty() || B.is_empty()) { out.zeros(A.n_rows, B.n_cols); return true; } // for gbsvx, matrix AB size: KL+KU+1 x N; band representation of A stored in rows 1 to KL+KU+1 (note: fortran counts from 1) Mat AB; band_helper::compress(AB, A, KL, KU, false); const uword N = AB.n_cols; arma_conform_assert_blas_size(AB,B); out.set_size(N, B.n_cols); Mat AFB(2*KL+KU+1, N, arma_nozeros_indicator()); char fact = (equilibrate) ? 'E' : 'N'; char trans = 'N'; char equed = char(0); blas_int n = blas_int(N); blas_int kl = blas_int(KL); blas_int ku = blas_int(KU); blas_int nrhs = blas_int(B.n_cols); blas_int ldab = blas_int(AB.n_rows); blas_int ldafb = blas_int(AFB.n_rows); blas_int ldb = blas_int(B.n_rows); blas_int ldx = blas_int(N); blas_int info = blas_int(0); T rcond = T(0); podarray IPIV( N); podarray< T> R( N); podarray< T> C( N); podarray< T> FERR( B.n_cols); podarray< T> BERR( B.n_cols); podarray WORK(2*N); podarray< T> RWORK( N); // NOTE: according to lapack 3.6.1 docs, the size of RWORK in zgbsvx is different to RWORK in dgesvx arma_debug_print("lapack::cx_gbsvx()"); lapack::cx_gbsvx ( &fact, &trans, &n, &kl, &ku, &nrhs, AB.memptr(), &ldab, AFB.memptr(), &ldafb, IPIV.memptr(), &equed, R.memptr(), C.memptr(), B.memptr(), &ldb, out.memptr(), &ldx, &rcond, FERR.memptr(), BERR.memptr(), WORK.memptr(), RWORK.memptr(), &info ); out_rcond = rcond; return ((info == 0) || (info == (n+1))); } #else { arma_ignore(out); arma_ignore(out_rcond); arma_ignore(A); arma_ignore(KL); arma_ignore(KU); arma_ignore(B_expr); arma_ignore(equilibrate); arma_stop_logic_error("solve(): use of LAPACK must be enabled"); return false; } #endif } //! solve a system of linear equations via Gaussian elimination with partial pivoting (real tridiagonal band matrix) template inline bool auxlib::solve_tridiag_fast(Mat& out, Mat& A, const Base& B_expr) { arma_debug_sigprint(); return auxlib::solve_tridiag_fast_common(out, A, B_expr); } //! solve a system of linear equations via Gaussian elimination with partial pivoting (complex tridiagonal band matrix) template inline bool auxlib::solve_tridiag_fast(Mat< std::complex >& out, Mat< std::complex >& A, const Base< std::complex,T1>& B_expr) { arma_debug_sigprint(); #if defined(ARMA_CRIPPLED_LAPACK) { arma_debug_print("auxlib::solve_tridiag_fast(): redirecting to auxlib::solve_square_fast() due to crippled LAPACK"); return auxlib::solve_square_fast(out, A, B_expr); } #else { return auxlib::solve_tridiag_fast_common(out, A, B_expr); } #endif } //! solve a system of linear equations via Gaussian elimination with partial pivoting (tridiagonal band matrix) template inline bool auxlib::solve_tridiag_fast_common(Mat& out, const Mat& A, const Base& B_expr) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { typedef typename T1::elem_type eT; out = B_expr.get_ref(); const uword B_n_rows = out.n_rows; const uword B_n_cols = out.n_cols; arma_conform_check( (A.n_rows != B_n_rows), "solve(): number of rows in given matrices must be the same", [&](){ out.soft_reset(); } ); if(A.is_empty() || out.is_empty()) { out.zeros(A.n_rows, B_n_cols); return true; } Mat tridiag; band_helper::extract_tridiag(tridiag, A); arma_conform_assert_blas_size(tridiag, out); blas_int n = blas_int(A.n_rows); blas_int nrhs = blas_int(B_n_cols); blas_int ldb = blas_int(B_n_rows); blas_int info = blas_int(0); arma_debug_print("lapack::gtsv()"); lapack::gtsv(&n, &nrhs, tridiag.colptr(0), tridiag.colptr(1), tridiag.colptr(2), out.memptr(), &ldb, &info); return (info == 0); } #else { arma_ignore(out); arma_ignore(A); arma_ignore(B_expr); arma_stop_logic_error("solve(): use of LAPACK must be enabled"); return false; } #endif } // // Schur decomposition template inline bool auxlib::schur(Mat& U, Mat& S, const Base& X, const bool calc_U) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { S = X.get_ref(); arma_conform_check( (S.is_square() == false), "schur(): given matrix must be square sized" ); if(S.is_empty()) { U.reset(); S.reset(); return true; } arma_conform_assert_blas_size(S); const uword S_n_rows = S.n_rows; if(calc_U) { U.set_size(S_n_rows, S_n_rows); } else { U.set_size(1,1); } char jobvs = calc_U ? 'V' : 'N'; char sort = 'N'; void* select = 0; blas_int n = blas_int(S_n_rows); blas_int sdim = 0; blas_int ldvs = calc_U ? n : blas_int(1); blas_int lwork = 64*n; // lwork_min = (std::max)(blas_int(1), 3*n) blas_int info = 0; podarray wr(S_n_rows); podarray wi(S_n_rows); podarray work( static_cast(lwork) ); podarray bwork(S_n_rows); arma_debug_print("lapack::gees()"); lapack::gees(&jobvs, &sort, select, &n, S.memptr(), &n, &sdim, wr.memptr(), wi.memptr(), U.memptr(), &ldvs, work.memptr(), &lwork, bwork.memptr(), &info); return (info == 0); } #else { arma_ignore(U); arma_ignore(S); arma_ignore(X); arma_ignore(calc_U); arma_stop_logic_error("schur(): use of LAPACK must be enabled"); return false; } #endif } template inline bool auxlib::schur(Mat< std::complex >& U, Mat< std::complex >& S, const Base,T1>& X, const bool calc_U) { arma_debug_sigprint(); S = X.get_ref(); arma_conform_check( (S.is_square() == false), "schur(): given matrix must be square sized" ); return auxlib::schur(U,S,calc_U); } template inline bool auxlib::schur(Mat< std::complex >& U, Mat< std::complex >& S, const bool calc_U) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { typedef std::complex eT; if(S.is_empty()) { U.reset(); S.reset(); return true; } arma_conform_assert_blas_size(S); const uword S_n_rows = S.n_rows; if(calc_U) { U.set_size(S_n_rows, S_n_rows); } else { U.set_size(1,1); } char jobvs = calc_U ? 'V' : 'N'; char sort = 'N'; void* select = 0; blas_int n = blas_int(S_n_rows); blas_int sdim = 0; blas_int ldvs = calc_U ? n : blas_int(1); blas_int lwork = 64*n; // lwork_min = (std::max)(blas_int(1), 2*n) blas_int info = 0; podarray w(S_n_rows); podarray work( static_cast(lwork) ); podarray< T> rwork(S_n_rows); podarray bwork(S_n_rows); arma_debug_print("lapack::cx_gees()"); lapack::cx_gees(&jobvs, &sort, select, &n, S.memptr(), &n, &sdim, w.memptr(), U.memptr(), &ldvs, work.memptr(), &lwork, rwork.memptr(), bwork.memptr(), &info); return (info == 0); } #else { arma_ignore(U); arma_ignore(S); arma_ignore(calc_U); arma_stop_logic_error("schur(): use of LAPACK must be enabled"); return false; } #endif } // // solve the Sylvester equation AX + XB = C template inline bool auxlib::sylvester(Mat& X, const Mat& A, const Mat& B, const Mat& C) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { arma_conform_check( (A.is_square() == false) || (B.is_square() == false), "sylvester(): given matrices must be square sized" ); arma_conform_check( (C.n_rows != A.n_rows) || (C.n_cols != B.n_cols), "sylvester(): matrices are not conformant" ); if(A.is_empty() || B.is_empty() || C.is_empty()) { X.reset(); return true; } Mat Z1, Z2, T1, T2; const bool status_sd1 = auxlib::schur(Z1, T1, A); const bool status_sd2 = auxlib::schur(Z2, T2, B); if( (status_sd1 == false) || (status_sd2 == false) ) { return false; } char trana = 'N'; char tranb = 'N'; blas_int isgn = +1; blas_int m = blas_int(T1.n_rows); blas_int n = blas_int(T2.n_cols); eT scale = eT(0); blas_int info = 0; Mat Y = trans(Z1) * C * Z2; arma_debug_print("lapack::trsyl()"); lapack::trsyl(&trana, &tranb, &isgn, &m, &n, T1.memptr(), &m, T2.memptr(), &n, Y.memptr(), &m, &scale, &info); if(info < 0) { return false; } //Y /= scale; Y /= (-scale); X = Z1 * Y * trans(Z2); return true; } #else { arma_ignore(X); arma_ignore(A); arma_ignore(B); arma_ignore(C); arma_stop_logic_error("sylvester(): use of LAPACK must be enabled"); return false; } #endif } // // QZ decomposition of general square real matrix pair template inline bool auxlib::qz(Mat& A, Mat& B, Mat& vsl, Mat& vsr, const Base& X_expr, const Base& Y_expr, const char mode) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { A = X_expr.get_ref(); B = Y_expr.get_ref(); arma_conform_check( ((A.is_square() == false) || (B.is_square() == false)), "qz(): given matrices must be square sized", [&](){ A.soft_reset(); B.soft_reset(); } ); arma_conform_check( (A.n_rows != B.n_rows), "qz(): given matrices must have the same size" ); if(A.is_empty()) { A.reset(); B.reset(); vsl.reset(); vsr.reset(); return true; } if(arma_config::check_nonfinite && A.internal_has_nonfinite()) { return false; } if(arma_config::check_nonfinite && B.internal_has_nonfinite()) { return false; } arma_conform_assert_blas_size(A); vsl.set_size(A.n_rows, A.n_rows); vsr.set_size(A.n_rows, A.n_rows); char jobvsl = 'V'; char jobvsr = 'V'; char eigsort = 'N'; void* selctg = 0; blas_int N = blas_int(A.n_rows); blas_int sdim = 0; blas_int lwork = 64*N+16; // lwork_min = (std::max)(blas_int(1),8*N+16) blas_int info = 0; if(mode == 'l') { eigsort = 'S'; selctg = qz_helper::ptr_cast(&(qz_helper::select_lhp)); } else if(mode == 'r') { eigsort = 'S'; selctg = qz_helper::ptr_cast(&(qz_helper::select_rhp)); } else if(mode == 'i') { eigsort = 'S'; selctg = qz_helper::ptr_cast(&(qz_helper::select_iuc)); } else if(mode == 'o') { eigsort = 'S'; selctg = qz_helper::ptr_cast(&(qz_helper::select_ouc)); } podarray alphar(A.n_rows); podarray alphai(A.n_rows); podarray beta(A.n_rows); podarray work( static_cast(lwork) ); podarray bwork( static_cast(N) ); arma_debug_print("lapack::gges()"); lapack::gges ( &jobvsl, &jobvsr, &eigsort, selctg, &N, A.memptr(), &N, B.memptr(), &N, &sdim, alphar.memptr(), alphai.memptr(), beta.memptr(), vsl.memptr(), &N, vsr.memptr(), &N, work.memptr(), &lwork, bwork.memptr(), &info ); if(info != 0) { return false; } op_strans::apply_mat_inplace(vsl); return true; } #else { arma_ignore(A); arma_ignore(B); arma_ignore(vsl); arma_ignore(vsr); arma_ignore(X_expr); arma_ignore(Y_expr); arma_ignore(mode); arma_stop_logic_error("qz(): use of LAPACK must be enabled"); return false; } #endif } // // QZ decomposition of general square complex matrix pair template inline bool auxlib::qz(Mat< std::complex >& A, Mat< std::complex >& B, Mat< std::complex >& vsl, Mat< std::complex >& vsr, const Base< std::complex, T1 >& X_expr, const Base< std::complex, T2 >& Y_expr, const char mode) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { typedef typename std::complex eT; A = X_expr.get_ref(); B = Y_expr.get_ref(); arma_conform_check( ((A.is_square() == false) || (B.is_square() == false)), "qz(): given matrices must be square sized", [&](){ A.soft_reset(); B.soft_reset(); } ); arma_conform_check( (A.n_rows != B.n_rows), "qz(): given matrices must have the same size" ); if(A.is_empty()) { A.reset(); B.reset(); vsl.reset(); vsr.reset(); return true; } if(arma_config::check_nonfinite && A.internal_has_nonfinite()) { return false; } if(arma_config::check_nonfinite && B.internal_has_nonfinite()) { return false; } arma_conform_assert_blas_size(A); vsl.set_size(A.n_rows, A.n_rows); vsr.set_size(A.n_rows, A.n_rows); char jobvsl = 'V'; char jobvsr = 'V'; char eigsort = 'N'; void* selctg = 0; blas_int N = blas_int(A.n_rows); blas_int sdim = 0; blas_int lwork = 64*N; // lwork_min = (std::max)(blas_int(1),2*N) blas_int info = 0; if(mode == 'l') { eigsort = 'S'; selctg = qz_helper::ptr_cast(&(qz_helper::cx_select_lhp)); } else if(mode == 'r') { eigsort = 'S'; selctg = qz_helper::ptr_cast(&(qz_helper::cx_select_rhp)); } else if(mode == 'i') { eigsort = 'S'; selctg = qz_helper::ptr_cast(&(qz_helper::cx_select_iuc)); } else if(mode == 'o') { eigsort = 'S'; selctg = qz_helper::ptr_cast(&(qz_helper::cx_select_ouc)); } podarray alpha(A.n_rows); podarray beta(A.n_rows); podarray work( static_cast(lwork) ); podarray< T> rwork( static_cast(8*N) ); podarray bwork( static_cast(N) ); arma_debug_print("lapack::cx_gges()"); lapack::cx_gges ( &jobvsl, &jobvsr, &eigsort, selctg, &N, A.memptr(), &N, B.memptr(), &N, &sdim, alpha.memptr(), beta.memptr(), vsl.memptr(), &N, vsr.memptr(), &N, work.memptr(), &lwork, rwork.memptr(), bwork.memptr(), &info ); if(info != 0) { return false; } op_htrans::apply_mat_inplace(vsl); return true; } #else { arma_ignore(A); arma_ignore(B); arma_ignore(vsl); arma_ignore(vsr); arma_ignore(X_expr); arma_ignore(Y_expr); arma_ignore(mode); arma_stop_logic_error("qz(): use of LAPACK must be enabled"); return false; } #endif } template inline bool auxlib::balance(Col::result>& S, Col& P, Mat& A, const bool calc_SP, const bool do_scal, const bool do_perm) { arma_debug_sigprint(); #if defined(ARMA_USE_LAPACK) { typedef typename get_pod_type::result T; // assuming given matrix is square-sized if(A.n_elem == 0) { S.reset(); P.reset(); return true; } const char job = (do_scal && do_perm) ? 'B' : ((do_scal) ? 'S' : ((do_perm) ? 'P' : 'N')); blas_int n = blas_int(A.n_rows); blas_int lda = blas_int(A.n_rows); blas_int ilo = blas_int(0); blas_int ihi = blas_int(0); blas_int info = blas_int(0); podarray scale(A.n_rows); scale.zeros(); arma_debug_print("lapack::gebal()"); lapack::gebal(&job, &n, A.memptr(), &lda, &ilo, &ihi, scale.memptr(), &info); if(info != blas_int(0)) { return false; } if(calc_SP == false) { return true; } const uword N = A.n_rows; // sanity check if( (ilo < 1) || (uword(ihi) > N) ) { arma_debug_print("ilo and/or ihi out of bounds"); return false; } S.zeros(N); P.zeros(N); T* S_mem = S.memptr(); uword* P_mem = P.memptr(); const T* scale_mem = scale.memptr(); for(uword i = 0; i < uword(ilo)-1; ++i) { S_mem[i] = T(1); } for(uword i = uword(ilo)-1; i < uword(ihi); ++i) { S_mem[i] = scale_mem[i]; } for(uword i = uword(ihi); i < N; ++i) { S_mem[i] = T(1); } for(uword i=0; i < N; ++i) { P_mem[i] = i; } for(uword i=N-1; i >= uword(ihi) ; --i) { const uword j = uword(scale_mem[i]) - 1; std::swap(P_mem[i], P_mem[j]); } for(uword i=0; i < uword(ilo)-1; ++i) { const uword j = uword(scale_mem[i]) - 1; std::swap(P_mem[i], P_mem[j]); } return true; } #else { arma_ignore(S); arma_ignore(P); arma_ignore(A); arma_ignore(do_scal); arma_ignore(do_perm); return false; } #endif } template inline eT auxlib::rcond(Mat& A) { #if defined(ARMA_USE_LAPACK) { arma_conform_assert_blas_size(A); char norm_id = '1'; blas_int m = blas_int(A.n_rows); blas_int n = blas_int(A.n_rows); // assuming square matrix blas_int lda = blas_int(A.n_rows); eT norm_val = eT(0); eT rcond = eT(0); blas_int info = blas_int(0); podarray work(4*A.n_rows); podarray iwork( A.n_rows); podarray ipiv( (std::min)(A.n_rows, A.n_cols) ); arma_debug_print("lapack::lange()"); norm_val = (has_blas_float_bug::value) ? auxlib::norm1_gen(A) : lapack::lange(&norm_id, &m, &n, A.memptr(), &lda, work.memptr()); arma_debug_print("lapack::getrf()"); lapack::getrf(&m, &n, A.memptr(), &lda, ipiv.memptr(), &info); if(info != blas_int(0)) { return eT(0); } arma_debug_print("lapack::gecon()"); lapack::gecon(&norm_id, &n, A.memptr(), &lda, &norm_val, &rcond, work.memptr(), iwork.memptr(), &info); if(info != blas_int(0)) { return eT(0); } return rcond; } #else { arma_ignore(A); arma_stop_logic_error("rcond(): use of LAPACK must be enabled"); return eT(0); } #endif } template inline T auxlib::rcond(Mat< std::complex >& A) { #if defined(ARMA_USE_LAPACK) { typedef typename std::complex eT; arma_conform_assert_blas_size(A); char norm_id = '1'; blas_int m = blas_int(A.n_rows); blas_int n = blas_int(A.n_rows); // assuming square matrix blas_int lda = blas_int(A.n_rows); T norm_val = T(0); T rcond = T(0); blas_int info = blas_int(0); podarray< T> junk(1); podarray work(2*A.n_rows); podarray< T> rwork(2*A.n_rows); podarray ipiv( (std::min)(A.n_rows, A.n_cols) ); arma_debug_print("lapack::lange()"); norm_val = (has_blas_float_bug::value) ? auxlib::norm1_gen(A) : lapack::lange(&norm_id, &m, &n, A.memptr(), &lda, junk.memptr()); arma_debug_print("lapack::getrf()"); lapack::getrf(&m, &n, A.memptr(), &lda, ipiv.memptr(), &info); if(info != blas_int(0)) { return T(0); } arma_debug_print("lapack::cx_gecon()"); lapack::cx_gecon(&norm_id, &n, A.memptr(), &lda, &norm_val, &rcond, work.memptr(), rwork.memptr(), &info); if(info != blas_int(0)) { return T(0); } return rcond; } #else { arma_ignore(A); arma_stop_logic_error("rcond(): use of LAPACK must be enabled"); return T(0); } #endif } template inline eT auxlib::rcond_sym(Mat& A) { #if defined(ARMA_USE_LAPACK) { arma_conform_assert_blas_size(A); char norm_id = '1'; char uplo = 'L'; blas_int n = blas_int(A.n_rows); blas_int lda = blas_int(A.n_rows); blas_int lwork = (std::max)(blas_int(podarray_prealloc_n_elem::val), 2*n); // 2*n due to lapack::sycon() requirements blas_int info = 0; eT norm_val = eT(0); eT out_rcond = eT(0); podarray ipiv(A.n_rows); podarray iwork(A.n_rows); if( (2*n) > blas_int(podarray_prealloc_n_elem::val) ) { eT work_query[2] = {}; blas_int lwork_query = -1; arma_debug_print("lapack::sytrf()"); lapack::sytrf(&uplo, &n, A.memptr(), &lda, ipiv.memptr(), &work_query[0], &lwork_query, &info); if(info != 0) { return eT(0); } blas_int lwork_proposed = static_cast( access::tmp_real(work_query[0]) ); lwork = (std::max)(lwork_proposed, lwork); } podarray work( static_cast(lwork) ); arma_debug_print("lapack::lansy()"); norm_val = (has_blas_float_bug::value) ? auxlib::norm1_sym(A) : lapack::lansy(&norm_id, &uplo, &n, A.memptr(), &lda, work.memptr()); arma_debug_print("lapack::sytrf()"); lapack::sytrf(&uplo, &n, A.memptr(), &lda, ipiv.memptr(), work.memptr(), &lwork, &info); if(info != 0) { return eT(0); } arma_debug_print("lapack::sycon()"); lapack::sycon(&uplo, &n, A.memptr(), &lda, ipiv.memptr(), &norm_val, &out_rcond, work.memptr(), iwork.memptr(), &info); if(info != 0) { return eT(0); } return out_rcond; } #else { arma_ignore(A); arma_stop_logic_error("rcond_sym(): use of LAPACK must be enabled"); return eT(0); } #endif } template inline T auxlib::rcond_sym(Mat< std::complex >& A) { // NOTE: the function name is required for overloading, but is a misnomer: it processes complex hermitian matrices #if defined(ARMA_CRIPPLED_LAPACK) { arma_debug_print("auxlib::rcond_sym(): redirecting to auxlib::rcond() due to crippled LAPACK"); return auxlib::rcond(A); } #elif defined(ARMA_USE_LAPACK) { typedef typename std::complex eT; arma_conform_assert_blas_size(A); char norm_id = '1'; char uplo = 'L'; blas_int n = blas_int(A.n_rows); blas_int lda = blas_int(A.n_rows); blas_int lwork = (std::max)(blas_int(podarray_prealloc_n_elem::val), 2*n); // 2*n due to lapack::hecon() requirements blas_int info = 0; T norm_val = T(0); T out_rcond = T(0); podarray ipiv(A.n_rows); podarray lanhe_work(A.n_rows); if( (2*n) > blas_int(podarray_prealloc_n_elem::val) ) { eT work_query[2] = {}; blas_int lwork_query = -1; arma_debug_print("lapack::hetrf()"); lapack::hetrf(&uplo, &n, A.memptr(), &lda, ipiv.memptr(), &work_query[0], &lwork_query, &info); if(info != 0) { return T(0); } blas_int lwork_proposed = static_cast( access::tmp_real(work_query[0]) ); lwork = (std::max)(lwork_proposed, lwork); } podarray work( static_cast(lwork) ); arma_debug_print("lapack::lanhe()"); norm_val = (has_blas_float_bug::value) ? auxlib::norm1_sym(A) : lapack::lanhe(&norm_id, &uplo, &n, A.memptr(), &lda, lanhe_work.memptr()); arma_debug_print("lapack::hetrf()"); lapack::hetrf(&uplo, &n, A.memptr(), &lda, ipiv.memptr(), work.memptr(), &lwork, &info); if(info != 0) { return T(0); } arma_debug_print("lapack::hecon()"); lapack::hecon(&uplo, &n, A.memptr(), &lda, ipiv.memptr(), &norm_val, &out_rcond, work.memptr(), &info); if(info != 0) { return T(0); } return out_rcond; } #else { arma_ignore(A); arma_stop_logic_error("rcond_sym(): use of LAPACK must be enabled"); return T(0); } #endif } template inline eT auxlib::rcond_trimat(const Mat& A, const uword layout) { #if defined(ARMA_USE_LAPACK) { arma_conform_assert_blas_size(A); char norm_id = '1'; char uplo = (layout == 0) ? 'U' : 'L'; char diag = 'N'; blas_int n = blas_int(A.n_rows); // assuming square matrix eT rcond = eT(0); blas_int info = blas_int(0); podarray work(3*A.n_rows); podarray iwork( A.n_rows); arma_debug_print("lapack::trcon()"); lapack::trcon(&norm_id, &uplo, &diag, &n, A.memptr(), &n, &rcond, work.memptr(), iwork.memptr(), &info); if(info != blas_int(0)) { return eT(0); } return rcond; } #else { arma_ignore(A); arma_ignore(layout); arma_stop_logic_error("rcond(): use of LAPACK must be enabled"); return eT(0); } #endif } template inline T auxlib::rcond_trimat(const Mat< std::complex >& A, const uword layout) { #if defined(ARMA_USE_LAPACK) { typedef typename std::complex eT; arma_conform_assert_blas_size(A); char norm_id = '1'; char uplo = (layout == 0) ? 'U' : 'L'; char diag = 'N'; blas_int n = blas_int(A.n_rows); // assuming square matrix T rcond = T(0); blas_int info = blas_int(0); podarray work(2*A.n_rows); podarray< T> rwork( A.n_rows); arma_debug_print("lapack::cx_trcon()"); lapack::cx_trcon(&norm_id, &uplo, &diag, &n, A.memptr(), &n, &rcond, work.memptr(), rwork.memptr(), &info); if(info != blas_int(0)) { return T(0); } return rcond; } #else { arma_ignore(A); arma_ignore(layout); arma_stop_logic_error("rcond(): use of LAPACK must be enabled"); return T(0); } #endif } template inline eT auxlib::lu_rcond(const Mat& A, const eT norm_val) { #if defined(ARMA_USE_LAPACK) { char norm_id = '1'; blas_int n = blas_int(A.n_rows); // assuming square matrix blas_int lda = blas_int(A.n_rows); eT rcond = eT(0); blas_int info = blas_int(0); podarray work(4*A.n_rows); podarray iwork( A.n_rows); arma_debug_print("lapack::gecon()"); lapack::gecon(&norm_id, &n, A.memptr(), &lda, &norm_val, &rcond, work.memptr(), iwork.memptr(), &info); if(info != blas_int(0)) { return eT(0); } return rcond; } #else { arma_ignore(A); arma_ignore(norm_val); return eT(0); } #endif } template inline T auxlib::lu_rcond(const Mat< std::complex >& A, const T norm_val) { #if defined(ARMA_USE_LAPACK) { typedef typename std::complex eT; char norm_id = '1'; blas_int n = blas_int(A.n_rows); // assuming square matrix blas_int lda = blas_int(A.n_rows); T rcond = T(0); blas_int info = blas_int(0); podarray work(2*A.n_rows); podarray< T> rwork(2*A.n_rows); arma_debug_print("lapack::cx_gecon()"); lapack::cx_gecon(&norm_id, &n, A.memptr(), &lda, &norm_val, &rcond, work.memptr(), rwork.memptr(), &info); if(info != blas_int(0)) { return T(0); } return rcond; } #else { arma_ignore(A); arma_ignore(norm_val); return T(0); } #endif } template inline eT auxlib::lu_rcond_sympd(const Mat& A, const eT norm_val) { #if defined(ARMA_USE_LAPACK) { char uplo = 'L'; blas_int n = blas_int(A.n_rows); // assuming square matrix eT rcond = eT(0); blas_int info = blas_int(0); podarray work(3*A.n_rows); podarray iwork( A.n_rows); arma_debug_print("lapack::pocon()"); lapack::pocon(&uplo, &n, A.memptr(), &n, &norm_val, &rcond, work.memptr(), iwork.memptr(), &info); if(info != blas_int(0)) { return eT(0); } return rcond; } #else { arma_ignore(A); arma_ignore(norm_val); return eT(0); } #endif } template inline T auxlib::lu_rcond_sympd(const Mat< std::complex >& A, const T norm_val) { #if defined(ARMA_CRIPPLED_LAPACK) { arma_ignore(A); arma_ignore(norm_val); return T(0); } #elif defined(ARMA_USE_LAPACK) { typedef typename std::complex eT; char uplo = 'L'; blas_int n = blas_int(A.n_rows); // assuming square matrix T rcond = T(0); blas_int info = blas_int(0); podarray work(2*A.n_rows); podarray< T> rwork( A.n_rows); arma_debug_print("lapack::cx_pocon()"); lapack::cx_pocon(&uplo, &n, A.memptr(), &n, &norm_val, &rcond, work.memptr(), rwork.memptr(), &info); if(info != blas_int(0)) { return T(0); } return rcond; } #else { arma_ignore(A); arma_ignore(norm_val); return T(0); } #endif } template inline eT auxlib::lu_rcond_band(const Mat& AB, const uword KL, const uword KU, const podarray& ipiv, const eT norm_val) { #if defined(ARMA_USE_LAPACK) { const uword N = AB.n_cols; // order of the original square matrix A char norm_id = '1'; blas_int n = blas_int(N); blas_int kl = blas_int(KL); blas_int ku = blas_int(KU); blas_int ldab = blas_int(AB.n_rows); eT rcond = eT(0); blas_int info = blas_int(0); podarray work(3*N); podarray iwork( N); arma_debug_print("lapack::gbcon()"); lapack::gbcon(&norm_id, &n, &kl, &ku, AB.memptr(), &ldab, ipiv.memptr(), &norm_val, &rcond, work.memptr(), iwork.memptr(), &info); if(info != blas_int(0)) { return eT(0); } return rcond; } #else { arma_ignore(AB); arma_ignore(KL); arma_ignore(KU); arma_ignore(ipiv); arma_ignore(norm_val); return eT(0); } #endif } template inline T auxlib::lu_rcond_band(const Mat< std::complex >& AB, const uword KL, const uword KU, const podarray& ipiv, const T norm_val) { #if defined(ARMA_CRIPPLED_LAPACK) { arma_ignore(AB); arma_ignore(KL); arma_ignore(KU); arma_ignore(ipiv); arma_ignore(norm_val); return T(0); } #elif defined(ARMA_USE_LAPACK) { typedef typename std::complex eT; const uword N = AB.n_cols; // order of the original square matrix A char norm_id = '1'; blas_int n = blas_int(N); blas_int kl = blas_int(KL); blas_int ku = blas_int(KU); blas_int ldab = blas_int(AB.n_rows); T rcond = T(0); blas_int info = blas_int(0); podarray work(2*N); podarray< T> rwork( N); arma_debug_print("lapack::cx_gbcon()"); lapack::cx_gbcon(&norm_id, &n, &kl, &ku, AB.memptr(), &ldab, ipiv.memptr(), &norm_val, &rcond, work.memptr(), rwork.memptr(), &info); if(info != blas_int(0)) { return T(0); } return rcond; } #else { arma_ignore(AB); arma_ignore(KL); arma_ignore(KU); arma_ignore(ipiv); arma_ignore(norm_val); return T(0); } #endif } template inline bool auxlib::crippled_lapack(const Base&) { #if defined(ARMA_CRIPPLED_LAPACK) { arma_debug_print("auxlib::crippled_lapack(): true"); return (is_cx::yes); } #else { return false; } #endif } template inline bool auxlib::rudimentary_sym_check(const Mat& X) { arma_debug_sigprint(); const uword N = X.n_rows; const uword Nm2 = N-2; if(N != X.n_cols) { return false; } if(N <= uword(1)) { return true; } const eT* X_mem = X.memptr(); const eT* X_offsetA = &(X_mem[Nm2 ]); const eT* X_offsetB = &(X_mem[Nm2*N]); const eT A1 = *(X_offsetA ); const eT A2 = *(X_offsetA+1); // bottom-left corner (ie. last value in first column) const eT B1 = *(X_offsetB ); const eT B2 = *(X_offsetB+N); // top-right corner (ie. first value in last column) const eT C1 = (std::max)(std::abs(A1), std::abs(B1)); const eT C2 = (std::max)(std::abs(A2), std::abs(B2)); const eT delta1 = std::abs(A1 - B1); const eT delta2 = std::abs(A2 - B2); const eT tol = eT(10000)*std::numeric_limits::epsilon(); // allow some leeway const bool okay1 = ( (delta1 <= tol) || (delta1 <= (C1 * tol)) ); const bool okay2 = ( (delta2 <= tol) || (delta2 <= (C2 * tol)) ); return (okay1 && okay2); } template inline bool auxlib::rudimentary_sym_check(const Mat< std::complex >& X) { arma_debug_sigprint(); // NOTE: the function name is a misnomer, as it checks for hermitian complex matrices; // NOTE: for simplicity of use, the function name is the same as for real matrices typedef typename std::complex eT; const uword N = X.n_rows; const uword Nm1 = N-1; if(N != X.n_cols) { return false; } if(N == uword(0)) { return true; } const eT* X_mem = X.memptr(); const T tol = T(10000)*std::numeric_limits::epsilon(); // allow some leeway if(std::abs(X_mem[0 ].imag()) > tol) { return false; } // check top-left if(std::abs(X_mem[X.n_elem-1].imag()) > tol) { return false; } // check bottom-right const eT& A = X_mem[Nm1 ]; // bottom-left corner (ie. last value in first column) const eT& B = X_mem[Nm1*N]; // top-right corner (ie. first value in last column) const T C_real = (std::max)(std::abs(A.real()), std::abs(B.real())); const T C_imag = (std::max)(std::abs(A.imag()), std::abs(B.imag())); const T delta_real = std::abs(A.real() - B.real()); const T delta_imag = std::abs(A.imag() + B.imag()); // take into account the conjugate const bool okay_real = ( (delta_real <= tol) || (delta_real <= (C_real * tol)) ); const bool okay_imag = ( (delta_imag <= tol) || (delta_imag <= (C_imag * tol)) ); return (okay_real && okay_imag); } template inline typename get_pod_type::result auxlib::norm1_gen(const Mat& A) { arma_debug_sigprint(); typedef typename get_pod_type::result T; if(A.n_elem == 0) { return T(0); } const uword n_rows = A.n_rows; const uword n_cols = A.n_cols; T max_val = T(0); for(uword c=0; c < n_cols; ++c) { const eT* colmem = A.colptr(c); T acc_val = T(0); for(uword r=0; r < n_rows; ++r) { acc_val += std::abs(colmem[r]); } max_val = (acc_val > max_val) ? acc_val : max_val; } return max_val; } template inline typename get_pod_type::result auxlib::norm1_sym(const Mat& A) { arma_debug_sigprint(); typedef typename get_pod_type::result T; if(A.n_elem == 0) { return T(0); } const uword N = (std::min)(A.n_rows, A.n_cols); T max_val = T(0); for(uword col=0; col < N; ++col) { const eT* colmem = A.colptr(col); T acc_val = T(0); for(uword c=0; c < col; ++c) { acc_val += std::abs(A.at(col,c)); } for(uword r=col; r < N; ++r) { acc_val += std::abs(colmem[r]); } max_val = (acc_val > max_val) ? acc_val : max_val; } return max_val; } template inline typename get_pod_type::result auxlib::norm1_band(const Mat& A, const uword KL, const uword KU) { arma_debug_sigprint(); typedef typename get_pod_type::result T; if(A.n_elem == 0) { return T(0); } const uword n_rows = A.n_rows; const uword n_cols = A.n_cols; T max_val = T(0); for(uword c=0; c < n_cols; ++c) { const eT* colmem = A.colptr(c); T acc_val = T(0); // use values only from main diagonal + KU upper diagonals + KL lower diagonals const uword start = ( c > KU ) ? (c - KU) : 0; const uword end = ((c + KL) < n_rows) ? (c + KL) : (n_rows-1); for(uword r=start; r <= end; ++r) { acc_val += std::abs(colmem[r]); } max_val = (acc_val > max_val) ? acc_val : max_val; } return max_val; } // namespace qz_helper { // sgges() and dgges() require an external function with three arguments: // select(alpha_real, alpha_imag, beta) // where the eigenvalue is defined as complex(alpha_real, alpha_imag) / beta template inline blas_int select_lhp(const T* x_ptr, const T* y_ptr, const T* z_ptr) { arma_debug_sigprint(); // cout << "select_lhp(): (*x_ptr) = " << (*x_ptr) << endl; // cout << "select_lhp(): (*y_ptr) = " << (*y_ptr) << endl; // cout << "select_lhp(): (*z_ptr) = " << (*z_ptr) << endl; arma_ignore(y_ptr); // ignore imaginary part const T x = (*x_ptr); const T z = (*z_ptr); if(z == T(0)) { return blas_int(0); } // consider an infinite eig value not to lie in either lhp or rhp return ((x/z) < T(0)) ? blas_int(1) : blas_int(0); } template inline blas_int select_rhp(const T* x_ptr, const T* y_ptr, const T* z_ptr) { arma_debug_sigprint(); // cout << "select_rhp(): (*x_ptr) = " << (*x_ptr) << endl; // cout << "select_rhp(): (*y_ptr) = " << (*y_ptr) << endl; // cout << "select_rhp(): (*z_ptr) = " << (*z_ptr) << endl; arma_ignore(y_ptr); // ignore imaginary part const T x = (*x_ptr); const T z = (*z_ptr); if(z == T(0)) { return blas_int(0); } // consider an infinite eig value not to lie in either lhp or rhp return ((x/z) > T(0)) ? blas_int(1) : blas_int(0); } template inline blas_int select_iuc(const T* x_ptr, const T* y_ptr, const T* z_ptr) { arma_debug_sigprint(); // cout << "select_iuc(): (*x_ptr) = " << (*x_ptr) << endl; // cout << "select_iuc(): (*y_ptr) = " << (*y_ptr) << endl; // cout << "select_iuc(): (*z_ptr) = " << (*z_ptr) << endl; const T x = (*x_ptr); const T y = (*y_ptr); const T z = (*z_ptr); if(z == T(0)) { return blas_int(0); } // consider an infinite eig value to be outside of the unit circle //return (std::abs(std::complex(x,y) / z) < T(1)) ? blas_int(1) : blas_int(0); return (std::sqrt(x*x + y*y) < std::abs(z)) ? blas_int(1) : blas_int(0); } template inline blas_int select_ouc(const T* x_ptr, const T* y_ptr, const T* z_ptr) { arma_debug_sigprint(); // cout << "select_ouc(): (*x_ptr) = " << (*x_ptr) << endl; // cout << "select_ouc(): (*y_ptr) = " << (*y_ptr) << endl; // cout << "select_ouc(): (*z_ptr) = " << (*z_ptr) << endl; const T x = (*x_ptr); const T y = (*y_ptr); const T z = (*z_ptr); if(z == T(0)) { return (x == T(0)) ? blas_int(0) : blas_int(1); // consider an infinite eig value to be outside of the unit circle } //return (std::abs(std::complex(x,y) / z) > T(1)) ? blas_int(1) : blas_int(0); return (std::sqrt(x*x + y*y) > std::abs(z)) ? blas_int(1) : blas_int(0); } // cgges() and zgges() require an external function with two arguments: // select(alpha, beta) // where the complex eigenvalue is defined as (alpha / beta) template inline blas_int cx_select_lhp(const std::complex* x_ptr, const std::complex* y_ptr) { arma_debug_sigprint(); // cout << "cx_select_lhp(): (*x_ptr) = " << (*x_ptr) << endl; // cout << "cx_select_lhp(): (*y_ptr) = " << (*y_ptr) << endl; const std::complex& x = (*x_ptr); const std::complex& y = (*y_ptr); if( (y.real() == T(0)) && (y.imag() == T(0)) ) { return blas_int(0); } // consider an infinite eig value not to lie in either lhp or rhp return (std::real(x / y) < T(0)) ? blas_int(1) : blas_int(0); } template inline blas_int cx_select_rhp(const std::complex* x_ptr, const std::complex* y_ptr) { arma_debug_sigprint(); // cout << "cx_select_rhp(): (*x_ptr) = " << (*x_ptr) << endl; // cout << "cx_select_rhp(): (*y_ptr) = " << (*y_ptr) << endl; const std::complex& x = (*x_ptr); const std::complex& y = (*y_ptr); if( (y.real() == T(0)) && (y.imag() == T(0)) ) { return blas_int(0); } // consider an infinite eig value not to lie in either lhp or rhp return (std::real(x / y) > T(0)) ? blas_int(1) : blas_int(0); } template inline blas_int cx_select_iuc(const std::complex* x_ptr, const std::complex* y_ptr) { arma_debug_sigprint(); // cout << "cx_select_iuc(): (*x_ptr) = " << (*x_ptr) << endl; // cout << "cx_select_iuc(): (*y_ptr) = " << (*y_ptr) << endl; const std::complex& x = (*x_ptr); const std::complex& y = (*y_ptr); if( (y.real() == T(0)) && (y.imag() == T(0)) ) { return blas_int(0); } // consider an infinite eig value to be outside of the unit circle return (std::abs(x / y) < T(1)) ? blas_int(1) : blas_int(0); } template inline blas_int cx_select_ouc(const std::complex* x_ptr, const std::complex* y_ptr) { arma_debug_sigprint(); // cout << "cx_select_ouc(): (*x_ptr) = " << (*x_ptr) << endl; // cout << "cx_select_ouc(): (*y_ptr) = " << (*y_ptr) << endl; const std::complex& x = (*x_ptr); const std::complex& y = (*y_ptr); if( (y.real() == T(0)) && (y.imag() == T(0)) ) { return ((x.real() == T(0)) && (x.imag() == T(0))) ? blas_int(0) : blas_int(1); // consider an infinite eig value to be outside of the unit circle } return (std::abs(x / y) > T(1)) ? blas_int(1) : blas_int(0); } // need to do shenanigans with pointers due to: // - we're using LAPACK ?gges() defined to expect pointer-to-function to be passed as pointer-to-object // - explicit casting between pointer-to-function and pointer-to-object is a non-standard extension in C // - the extension is essentially mandatory on POSIX systems // - some compilers will complain about the extension in pedantic mode template inline void_ptr ptr_cast(blas_int (*function)(const T*, const T*, const T*)) { // TODO: investigate replacement of union-based conversion union converter { blas_int (*fn)(const T*, const T*, const T*); void_ptr obj; }; converter tmp; tmp.obj = 0; tmp.fn = function; return tmp.obj; } template inline void_ptr ptr_cast(blas_int (*function)(const std::complex*, const std::complex*)) { // TODO: investigate replacement of union-based conversion union converter { blas_int (*fn)(const std::complex*, const std::complex*); void_ptr obj; }; converter tmp; tmp.obj = 0; tmp.fn = function; return tmp.obj; } } // end of namespace qz_helper //! @} RcppArmadillo/inst/include/armadillo_bits/fn_eye.hpp0000644000176200001440000000530514631567470022366 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_eye //! @{ arma_warn_unused arma_inline const Gen eye(const uword n_rows, const uword n_cols) { arma_debug_sigprint(); return Gen(n_rows, n_cols); } arma_warn_unused arma_inline const Gen eye(const SizeMat& s) { arma_debug_sigprint(); return Gen(s.n_rows, s.n_cols); } template arma_warn_unused arma_inline const Gen eye(const uword n_rows, const uword n_cols, const typename arma_Mat_Col_Row_only::result* junk = nullptr) { arma_debug_sigprint(); arma_ignore(junk); if(is_Col::value) { arma_conform_check( (n_cols != 1), "eye(): incompatible size" ); } if(is_Row::value) { arma_conform_check( (n_rows != 1), "eye(): incompatible size" ); } return Gen(n_rows, n_cols); } template arma_warn_unused arma_inline const Gen eye(const SizeMat& s, const typename arma_Mat_Col_Row_only::result* junk = nullptr) { arma_debug_sigprint(); arma_ignore(junk); return eye(s.n_rows, s.n_cols); } template arma_warn_unused inline obj_type eye(const uword n_rows, const uword n_cols, const typename arma_SpMat_SpCol_SpRow_only::result* junk = nullptr) { arma_debug_sigprint(); arma_ignore(junk); if(is_SpCol::value) { arma_conform_check( (n_cols != 1), "eye(): incompatible size" ); } if(is_SpRow::value) { arma_conform_check( (n_rows != 1), "eye(): incompatible size" ); } obj_type out; out.eye(n_rows, n_cols); return out; } template arma_warn_unused inline obj_type eye(const SizeMat& s, const typename arma_SpMat_SpCol_SpRow_only::result* junk = nullptr) { arma_debug_sigprint(); arma_ignore(junk); return eye(s.n_rows, s.n_cols); } //! @} RcppArmadillo/inst/include/armadillo_bits/SpRow_bones.hpp0000644000176200001440000000614614634016465023361 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup SpRow //! @{ //! Class for sparse row vectors (sparse matrices with only one row) template class SpRow : public SpMat { public: typedef eT elem_type; typedef typename get_pod_type::result pod_type; static constexpr bool is_row = true; static constexpr bool is_col = false; static constexpr bool is_xvec = false; inline SpRow(); inline explicit SpRow(const uword N); inline explicit SpRow(const uword in_rows, const uword in_cols); inline explicit SpRow(const SizeMat& s); inline SpRow(const char* text); inline SpRow& operator=(const char* text); inline SpRow(const std::string& text); inline SpRow& operator=(const std::string& text); inline SpRow& operator=(const eT val); inline SpRow(const Row& X); // for backwards compatibility template inline explicit SpRow(const Base& X); template inline SpRow& operator=(const Base& X); template inline SpRow(const SpBase& X); template inline SpRow& operator=(const SpBase& X); template inline explicit SpRow(const SpBase& A, const SpBase& B); arma_warn_unused inline const SpOp,spop_htrans> t() const; arma_warn_unused inline const SpOp,spop_htrans> ht() const; arma_warn_unused inline const SpOp,spop_strans> st() const; arma_warn_unused inline const SpToDOp,op_sp_as_dense> as_dense() const; inline void shed_col (const uword col_num); inline void shed_cols(const uword in_col1, const uword in_col2); // inline void insert_cols(const uword col_num, const uword N, const bool set_to_zero = true); typedef typename SpMat::iterator row_iterator; typedef typename SpMat::const_iterator const_row_iterator; inline row_iterator begin_row(const uword row_num = 0); inline const_row_iterator begin_row(const uword row_num = 0) const; inline row_iterator end_row(const uword row_num = 0); inline const_row_iterator end_row(const uword row_num = 0) const; #if defined(ARMA_EXTRA_SPROW_PROTO) #include ARMA_INCFILE_WRAP(ARMA_EXTRA_SPROW_PROTO) #endif }; //! @} RcppArmadillo/inst/include/armadillo_bits/diskio_meat.hpp0000644000176200001440000040665314770765377023436 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup diskio //! @{ //! Generate the first line of the header used for saving matrices in text format. //! Format: "ARMA_MAT_TXT_ABXYZ". //! A is one of: I (for integral types) or F (for floating point types). //! B is one of: U (for unsigned types), S (for signed types), N (for not applicable) or C (for complex types). //! XYZ specifies the width of each element in terms of bytes, eg. "008" indicates eight bytes. template inline std::string diskio::gen_txt_header(const Mat&) { arma_type_check(( is_supported_elem_type::value == false )); const char* ARMA_MAT_TXT_IU001 = "ARMA_MAT_TXT_IU001"; const char* ARMA_MAT_TXT_IS001 = "ARMA_MAT_TXT_IS001"; const char* ARMA_MAT_TXT_IU002 = "ARMA_MAT_TXT_IU002"; const char* ARMA_MAT_TXT_IS002 = "ARMA_MAT_TXT_IS002"; const char* ARMA_MAT_TXT_IU004 = "ARMA_MAT_TXT_IU004"; const char* ARMA_MAT_TXT_IS004 = "ARMA_MAT_TXT_IS004"; const char* ARMA_MAT_TXT_IU008 = "ARMA_MAT_TXT_IU008"; const char* ARMA_MAT_TXT_IS008 = "ARMA_MAT_TXT_IS008"; const char* ARMA_MAT_TXT_FN004 = "ARMA_MAT_TXT_FN004"; const char* ARMA_MAT_TXT_FN008 = "ARMA_MAT_TXT_FN008"; const char* ARMA_MAT_TXT_FC008 = "ARMA_MAT_TXT_FC008"; const char* ARMA_MAT_TXT_FC016 = "ARMA_MAT_TXT_FC016"; char* header = nullptr; if( is_u8::value) { header = const_cast(ARMA_MAT_TXT_IU001); } else if( is_s8::value) { header = const_cast(ARMA_MAT_TXT_IS001); } else if( is_u16::value) { header = const_cast(ARMA_MAT_TXT_IU002); } else if( is_s16::value) { header = const_cast(ARMA_MAT_TXT_IS002); } else if( is_u32::value) { header = const_cast(ARMA_MAT_TXT_IU004); } else if( is_s32::value) { header = const_cast(ARMA_MAT_TXT_IS004); } else if( is_u64::value) { header = const_cast(ARMA_MAT_TXT_IU008); } else if( is_s64::value) { header = const_cast(ARMA_MAT_TXT_IS008); } else if(is_ulng_t_32::value) { header = const_cast(ARMA_MAT_TXT_IU004); } else if(is_slng_t_32::value) { header = const_cast(ARMA_MAT_TXT_IS004); } else if(is_ulng_t_64::value) { header = const_cast(ARMA_MAT_TXT_IU008); } else if(is_slng_t_64::value) { header = const_cast(ARMA_MAT_TXT_IS008); } else if( is_float::value) { header = const_cast(ARMA_MAT_TXT_FN004); } else if( is_double::value) { header = const_cast(ARMA_MAT_TXT_FN008); } else if( is_cx_float::value) { header = const_cast(ARMA_MAT_TXT_FC008); } else if(is_cx_double::value) { header = const_cast(ARMA_MAT_TXT_FC016); } return std::string(header); } //! Generate the first line of the header used for saving matrices in binary format. //! Format: "ARMA_MAT_BIN_ABXYZ". //! A is one of: I (for integral types) or F (for floating point types). //! B is one of: U (for unsigned types), S (for signed types), N (for not applicable) or C (for complex types). //! XYZ specifies the width of each element in terms of bytes, eg. "008" indicates eight bytes. template inline std::string diskio::gen_bin_header(const Mat&) { arma_type_check(( is_supported_elem_type::value == false )); const char* ARMA_MAT_BIN_IU001 = "ARMA_MAT_BIN_IU001"; const char* ARMA_MAT_BIN_IS001 = "ARMA_MAT_BIN_IS001"; const char* ARMA_MAT_BIN_IU002 = "ARMA_MAT_BIN_IU002"; const char* ARMA_MAT_BIN_IS002 = "ARMA_MAT_BIN_IS002"; const char* ARMA_MAT_BIN_IU004 = "ARMA_MAT_BIN_IU004"; const char* ARMA_MAT_BIN_IS004 = "ARMA_MAT_BIN_IS004"; const char* ARMA_MAT_BIN_IU008 = "ARMA_MAT_BIN_IU008"; const char* ARMA_MAT_BIN_IS008 = "ARMA_MAT_BIN_IS008"; const char* ARMA_MAT_BIN_FN004 = "ARMA_MAT_BIN_FN004"; const char* ARMA_MAT_BIN_FN008 = "ARMA_MAT_BIN_FN008"; const char* ARMA_MAT_BIN_FC008 = "ARMA_MAT_BIN_FC008"; const char* ARMA_MAT_BIN_FC016 = "ARMA_MAT_BIN_FC016"; char* header = nullptr; if( is_u8::value) { header = const_cast(ARMA_MAT_BIN_IU001); } else if( is_s8::value) { header = const_cast(ARMA_MAT_BIN_IS001); } else if( is_u16::value) { header = const_cast(ARMA_MAT_BIN_IU002); } else if( is_s16::value) { header = const_cast(ARMA_MAT_BIN_IS002); } else if( is_u32::value) { header = const_cast(ARMA_MAT_BIN_IU004); } else if( is_s32::value) { header = const_cast(ARMA_MAT_BIN_IS004); } else if( is_u64::value) { header = const_cast(ARMA_MAT_BIN_IU008); } else if( is_s64::value) { header = const_cast(ARMA_MAT_BIN_IS008); } else if(is_ulng_t_32::value) { header = const_cast(ARMA_MAT_BIN_IU004); } else if(is_slng_t_32::value) { header = const_cast(ARMA_MAT_BIN_IS004); } else if(is_ulng_t_64::value) { header = const_cast(ARMA_MAT_BIN_IU008); } else if(is_slng_t_64::value) { header = const_cast(ARMA_MAT_BIN_IS008); } else if( is_float::value) { header = const_cast(ARMA_MAT_BIN_FN004); } else if( is_double::value) { header = const_cast(ARMA_MAT_BIN_FN008); } else if( is_cx_float::value) { header = const_cast(ARMA_MAT_BIN_FC008); } else if(is_cx_double::value) { header = const_cast(ARMA_MAT_BIN_FC016); } return std::string(header); } //! Generate the first line of the header used for saving matrices in binary format. //! Format: "ARMA_SPM_BIN_ABXYZ". //! A is one of: I (for integral types) or F (for floating point types). //! B is one of: U (for unsigned types), S (for signed types), N (for not applicable) or C (for complex types). //! XYZ specifies the width of each element in terms of bytes, eg. "008" indicates eight bytes. template inline std::string diskio::gen_bin_header(const SpMat&) { arma_type_check(( is_supported_elem_type::value == false )); const char* ARMA_SPM_BIN_IU001 = "ARMA_SPM_BIN_IU001"; const char* ARMA_SPM_BIN_IS001 = "ARMA_SPM_BIN_IS001"; const char* ARMA_SPM_BIN_IU002 = "ARMA_SPM_BIN_IU002"; const char* ARMA_SPM_BIN_IS002 = "ARMA_SPM_BIN_IS002"; const char* ARMA_SPM_BIN_IU004 = "ARMA_SPM_BIN_IU004"; const char* ARMA_SPM_BIN_IS004 = "ARMA_SPM_BIN_IS004"; const char* ARMA_SPM_BIN_IU008 = "ARMA_SPM_BIN_IU008"; const char* ARMA_SPM_BIN_IS008 = "ARMA_SPM_BIN_IS008"; const char* ARMA_SPM_BIN_FN004 = "ARMA_SPM_BIN_FN004"; const char* ARMA_SPM_BIN_FN008 = "ARMA_SPM_BIN_FN008"; const char* ARMA_SPM_BIN_FC008 = "ARMA_SPM_BIN_FC008"; const char* ARMA_SPM_BIN_FC016 = "ARMA_SPM_BIN_FC016"; char* header = nullptr; if( is_u8::value) { header = const_cast(ARMA_SPM_BIN_IU001); } else if( is_s8::value) { header = const_cast(ARMA_SPM_BIN_IS001); } else if( is_u16::value) { header = const_cast(ARMA_SPM_BIN_IU002); } else if( is_s16::value) { header = const_cast(ARMA_SPM_BIN_IS002); } else if( is_u32::value) { header = const_cast(ARMA_SPM_BIN_IU004); } else if( is_s32::value) { header = const_cast(ARMA_SPM_BIN_IS004); } else if( is_u64::value) { header = const_cast(ARMA_SPM_BIN_IU008); } else if( is_s64::value) { header = const_cast(ARMA_SPM_BIN_IS008); } else if(is_ulng_t_32::value) { header = const_cast(ARMA_SPM_BIN_IU004); } else if(is_slng_t_32::value) { header = const_cast(ARMA_SPM_BIN_IS004); } else if(is_ulng_t_64::value) { header = const_cast(ARMA_SPM_BIN_IU008); } else if(is_slng_t_64::value) { header = const_cast(ARMA_SPM_BIN_IS008); } else if( is_float::value) { header = const_cast(ARMA_SPM_BIN_FN004); } else if( is_double::value) { header = const_cast(ARMA_SPM_BIN_FN008); } else if( is_cx_float::value) { header = const_cast(ARMA_SPM_BIN_FC008); } else if(is_cx_double::value) { header = const_cast(ARMA_SPM_BIN_FC016); } return std::string(header); } //! Generate the first line of the header used for saving cubes in text format. //! Format: "ARMA_CUB_TXT_ABXYZ". //! A is one of: I (for integral types) or F (for floating point types). //! B is one of: U (for unsigned types), S (for signed types), N (for not applicable) or C (for complex types). //! XYZ specifies the width of each element in terms of bytes, eg. "008" indicates eight bytes. template inline std::string diskio::gen_txt_header(const Cube&) { arma_type_check(( is_supported_elem_type::value == false )); const char* ARMA_CUB_TXT_IU001 = "ARMA_CUB_TXT_IU001"; const char* ARMA_CUB_TXT_IS001 = "ARMA_CUB_TXT_IS001"; const char* ARMA_CUB_TXT_IU002 = "ARMA_CUB_TXT_IU002"; const char* ARMA_CUB_TXT_IS002 = "ARMA_CUB_TXT_IS002"; const char* ARMA_CUB_TXT_IU004 = "ARMA_CUB_TXT_IU004"; const char* ARMA_CUB_TXT_IS004 = "ARMA_CUB_TXT_IS004"; const char* ARMA_CUB_TXT_IU008 = "ARMA_CUB_TXT_IU008"; const char* ARMA_CUB_TXT_IS008 = "ARMA_CUB_TXT_IS008"; const char* ARMA_CUB_TXT_FN004 = "ARMA_CUB_TXT_FN004"; const char* ARMA_CUB_TXT_FN008 = "ARMA_CUB_TXT_FN008"; const char* ARMA_CUB_TXT_FC008 = "ARMA_CUB_TXT_FC008"; const char* ARMA_CUB_TXT_FC016 = "ARMA_CUB_TXT_FC016"; char* header = nullptr; if( is_u8::value) { header = const_cast(ARMA_CUB_TXT_IU001); } else if( is_s8::value) { header = const_cast(ARMA_CUB_TXT_IS001); } else if( is_u16::value) { header = const_cast(ARMA_CUB_TXT_IU002); } else if( is_s16::value) { header = const_cast(ARMA_CUB_TXT_IS002); } else if( is_u32::value) { header = const_cast(ARMA_CUB_TXT_IU004); } else if( is_s32::value) { header = const_cast(ARMA_CUB_TXT_IS004); } else if( is_u64::value) { header = const_cast(ARMA_CUB_TXT_IU008); } else if( is_s64::value) { header = const_cast(ARMA_CUB_TXT_IS008); } else if(is_ulng_t_32::value) { header = const_cast(ARMA_CUB_TXT_IU004); } else if(is_slng_t_32::value) { header = const_cast(ARMA_CUB_TXT_IS004); } else if(is_ulng_t_64::value) { header = const_cast(ARMA_CUB_TXT_IU008); } else if(is_slng_t_64::value) { header = const_cast(ARMA_CUB_TXT_IS008); } else if( is_float::value) { header = const_cast(ARMA_CUB_TXT_FN004); } else if( is_double::value) { header = const_cast(ARMA_CUB_TXT_FN008); } else if( is_cx_float::value) { header = const_cast(ARMA_CUB_TXT_FC008); } else if(is_cx_double::value) { header = const_cast(ARMA_CUB_TXT_FC016); } return std::string(header); } //! Generate the first line of the header used for saving cubes in binary format. //! Format: "ARMA_CUB_BIN_ABXYZ". //! A is one of: I (for integral types) or F (for floating point types). //! B is one of: U (for unsigned types), S (for signed types), N (for not applicable) or C (for complex types). //! XYZ specifies the width of each element in terms of bytes, eg. "008" indicates eight bytes. template inline std::string diskio::gen_bin_header(const Cube&) { arma_type_check(( is_supported_elem_type::value == false )); const char* ARMA_CUB_BIN_IU001 = "ARMA_CUB_BIN_IU001"; const char* ARMA_CUB_BIN_IS001 = "ARMA_CUB_BIN_IS001"; const char* ARMA_CUB_BIN_IU002 = "ARMA_CUB_BIN_IU002"; const char* ARMA_CUB_BIN_IS002 = "ARMA_CUB_BIN_IS002"; const char* ARMA_CUB_BIN_IU004 = "ARMA_CUB_BIN_IU004"; const char* ARMA_CUB_BIN_IS004 = "ARMA_CUB_BIN_IS004"; const char* ARMA_CUB_BIN_IU008 = "ARMA_CUB_BIN_IU008"; const char* ARMA_CUB_BIN_IS008 = "ARMA_CUB_BIN_IS008"; const char* ARMA_CUB_BIN_FN004 = "ARMA_CUB_BIN_FN004"; const char* ARMA_CUB_BIN_FN008 = "ARMA_CUB_BIN_FN008"; const char* ARMA_CUB_BIN_FC008 = "ARMA_CUB_BIN_FC008"; const char* ARMA_CUB_BIN_FC016 = "ARMA_CUB_BIN_FC016"; char* header = nullptr; if( is_u8::value) { header = const_cast(ARMA_CUB_BIN_IU001); } else if( is_s8::value) { header = const_cast(ARMA_CUB_BIN_IS001); } else if( is_u16::value) { header = const_cast(ARMA_CUB_BIN_IU002); } else if( is_s16::value) { header = const_cast(ARMA_CUB_BIN_IS002); } else if( is_u32::value) { header = const_cast(ARMA_CUB_BIN_IU004); } else if( is_s32::value) { header = const_cast(ARMA_CUB_BIN_IS004); } else if( is_u64::value) { header = const_cast(ARMA_CUB_BIN_IU008); } else if( is_s64::value) { header = const_cast(ARMA_CUB_BIN_IS008); } else if(is_ulng_t_32::value) { header = const_cast(ARMA_CUB_BIN_IU004); } else if(is_slng_t_32::value) { header = const_cast(ARMA_CUB_BIN_IS004); } else if(is_ulng_t_64::value) { header = const_cast(ARMA_CUB_BIN_IU008); } else if(is_slng_t_64::value) { header = const_cast(ARMA_CUB_BIN_IS008); } else if( is_float::value) { header = const_cast(ARMA_CUB_BIN_FN004); } else if( is_double::value) { header = const_cast(ARMA_CUB_BIN_FN008); } else if( is_cx_float::value) { header = const_cast(ARMA_CUB_BIN_FC008); } else if(is_cx_double::value) { header = const_cast(ARMA_CUB_BIN_FC016); } return std::string(header); } inline file_type diskio::guess_file_type(std::istream& f) { arma_debug_sigprint(); return diskio::guess_file_type_internal(f); } inline file_type diskio::guess_file_type_internal(std::istream& f) { arma_debug_sigprint(); f.clear(); const std::fstream::pos_type pos1 = f.tellg(); f.clear(); f.seekg(0, ios::end); f.clear(); const std::fstream::pos_type pos2 = f.tellg(); const uword N_max = ( (pos1 >= 0) && (pos2 >= 0) && (pos2 > pos1) ) ? uword(pos2 - pos1) : uword(0); f.clear(); f.seekg(pos1); if(N_max == 0) { return file_type_unknown; } const uword N_use = (std::min)(N_max, uword(4096)); podarray data(N_use); data.zeros(); unsigned char* data_mem = data.memptr(); f.clear(); f.read( reinterpret_cast(data_mem), std::streamsize(N_use) ); const bool load_okay = f.good(); f.clear(); f.seekg(pos1); if(load_okay == false) { return file_type_unknown; } bool has_binary = false; bool has_bracket = false; bool has_comma = false; bool has_semicolon = false; for(uword i=0; i= 123) ) { has_binary = true; break; } // the range checking can be made more elaborate if( (val == '(') || (val == ')') ) { has_bracket = true; } if( (val == ';') ) { has_semicolon = true; } if( (val == ',') ) { has_comma = true; } } if(has_binary) { return raw_binary; } // ssv_ascii has to be before csv_ascii; // if the data has semicolons, it suggests a CSV file with semicolon as the separating character; // the semicolon may be used to allow the comma character to represent the decimal separator (eg. 1,2345 vs 1.2345) if(has_semicolon && (has_bracket == false)) { return ssv_ascii; } if(has_comma && (has_bracket == false)) { return csv_ascii; } return raw_ascii; } //! Append a quasi-random string to the given filename. //! Avoiding use of rand() to preserve its state. inline std::string diskio::gen_tmp_name(const std::string& x) { union { uword val; void* ptr; } u; u.val = uword(0); u.ptr = const_cast(&x); const u16 a = u16( (u.val >> 8) & 0xFFFF ); const u16 b = u16( (std::clock()) & 0xFFFF ); std::ostringstream ss; ss << x << ".tmp_"; ss.setf(std::ios_base::hex, std::ios_base::basefield); ss.width(4); ss.fill('0'); ss << a; ss.width(4); ss.fill('0'); ss << b; return ss.str(); } //! Safely rename a file. //! Before renaming, test if we can write to the final file. //! This should prevent: //! (i) overwriting files that are write protected, //! (ii) overwriting directories. inline bool diskio::safe_rename(const std::string& old_name, const std::string& new_name) { const char* new_name_c_str = new_name.c_str(); std::fstream f(new_name_c_str, std::fstream::out | std::fstream::app); f.put(' '); if(f.good()) { f.close(); } else { return false; } if(std::remove( new_name_c_str) != 0) { return false; } if(std::rename(old_name.c_str(), new_name_c_str) != 0) { return false; } return true; } inline bool diskio::is_readable(const std::string& name) { std::ifstream f; f.open(name, std::fstream::binary); // std::ifstream destructor will close the file return (f.is_open()); } inline void diskio::sanitise_token(std::string& token) { // remove spaces, tabs, carriage returns if(token.length() == 0) { return; } const char c_front = token.front(); const char c_back = token.back(); if( (c_front == ' ') || (c_front == '\t') || (c_front == '\r') || (c_back == ' ') || (c_back == '\t') || (c_back == '\r') ) { token.erase(std::remove_if(token.begin(), token.end(), [](char c) { return ((c == ' ') || (c == '\t') || (c == '\r')); }), token.end()); } } template inline bool diskio::convert_token(eT& val, const std::string& token) { const size_t N = size_t(token.length()); const char* str = token.c_str(); if( (N == 0) || ((N == 1) && (str[0] == '0')) ) { val = eT(0); return true; } if( (N == 3) || (N == 4) ) { const bool neg = (str[0] == '-'); const bool pos = (str[0] == '+'); const size_t offset = ( (neg || pos) && (N == 4) ) ? 1 : 0; const char sig_a = str[offset ]; const char sig_b = str[offset+1]; const char sig_c = str[offset+2]; if( ((sig_a == 'i') || (sig_a == 'I')) && ((sig_b == 'n') || (sig_b == 'N')) && ((sig_c == 'f') || (sig_c == 'F')) ) { val = neg ? cond_rel< is_signed::value >::make_neg(Datum::inf) : Datum::inf; return true; } else if( ((sig_a == 'n') || (sig_a == 'N')) && ((sig_b == 'a') || (sig_b == 'A')) && ((sig_c == 'n') || (sig_c == 'N')) ) { val = Datum::nan; return true; } } // #if (defined(ARMA_HAVE_CXX17) && (__cpp_lib_to_chars >= 201611L)) // { // // std::from_chars() doesn't handle leading whitespace // // std::from_chars() doesn't handle leading + sign // // std::from_chars() handles only the decimal point (.) as the decimal separator // // const char str0 = str[0]; // const bool start_ok = ((str0 != ' ') && (str0 != '\t') && (str0 != '+')); // // bool has_comma = false; // for(uword i=0; i::value) { val = eT( std::strtod(str, &endptr) ); } else { if(is_signed::value) { // signed integer val = eT( std::strtoll(str, &endptr, 10) ); } else { // unsigned integer if((str[0] == '-') && (N >= 2)) { val = eT(0); if((str[1] == '-') || (str[1] == '+')) { return false; } const char* str_offset1 = &(str[1]); std::strtoull(str_offset1, &endptr, 10); if(str_offset1 == endptr) { return false; } return true; } val = eT( std::strtoull(str, &endptr, 10) ); } } if(str == endptr) { return false; } return true; } template inline bool diskio::convert_token(std::complex& val, const std::string& token) { const size_t N = size_t(token.length()); const size_t Nm1 = N-1; if(N == 0) { val = std::complex(0); return true; } const char* str = token.c_str(); // valid complex number formats: // (real,imag) // (real) // () if( (token[0] != '(') || (token[Nm1] != ')') ) { // no brackets, so treat the token as a non-complex number T val_real; const bool state = diskio::convert_token(val_real, token); // use the non-complex version of this function val = std::complex(val_real); return state; } // does the token contain only the () brackets? if(N <= 2) { val = std::complex(0); return true; } size_t comma_loc = 0; bool comma_found = false; for(size_t i=0; i(val_real); } else { const std::string token_real( &(str[1]), (comma_loc - 1 ) ); const std::string token_imag( &(str[comma_loc+1]), (Nm1 - 1 - comma_loc) ); T val_real; T val_imag; const bool state_real = diskio::convert_token(val_real, token_real); const bool state_imag = diskio::convert_token(val_imag, token_imag); state = (state_real && state_imag); val = std::complex(val_real, val_imag); } return state; } template inline bool diskio::convert_token_strict(eT& val, const std::string& token) { const size_t N = size_t(token.length()); const bool status = (N > 0) ? diskio::convert_token(val, token) : false; if(status == false) { val = Datum::nan; } return status; } template inline std::streamsize diskio::prepare_stream(std::ostream& f) { std::streamsize cell_width = f.width(); if(is_real::value) { f.unsetf(ios::fixed); f.setf(ios::scientific); f.fill(' '); f.precision(16); cell_width = 24; // NOTE: for 'float' the optimum settings are f.precision(8) and cell_width = 15 // NOTE: however, to avoid introducing errors in case single precision data is loaded as double precision, // NOTE: the same settings must be used for both 'float' and 'double' } else if(is_cx::value) { f.unsetf(ios::fixed); f.setf(ios::scientific); f.precision(16); } return cell_width; } //! Save a matrix as raw text (no header, human readable). //! Matrices can be loaded in Matlab and Octave, as long as they don't have complex elements. template inline bool diskio::save_raw_ascii(const Mat& x, const std::string& final_name) { arma_debug_sigprint(); const std::string tmp_name = diskio::gen_tmp_name(final_name); std::ofstream f; (arma_config::text_as_binary) ? f.open(tmp_name, std::fstream::binary) : f.open(tmp_name); bool save_okay = f.is_open(); if(save_okay) { save_okay = diskio::save_raw_ascii(x, f); f.flush(); f.close(); if(save_okay) { save_okay = diskio::safe_rename(tmp_name, final_name); } } return save_okay; } //! Save a matrix as raw text (no header, human readable). //! Matrices can be loaded in Matlab and Octave, as long as they don't have complex elements. template inline bool diskio::save_raw_ascii(const Mat& x, std::ostream& f) { arma_debug_sigprint(); const arma_ostream_state stream_state(f); const std::streamsize cell_width = diskio::prepare_stream(f); for(uword row=0; row < x.n_rows; ++row) { for(uword col=0; col < x.n_cols; ++col) { f.put(' '); if(is_real::value) { f.width(cell_width); } arma_ostream::raw_print_elem(f, x.at(row,col)); } f.put('\n'); } const bool save_okay = f.good(); stream_state.restore(f); return save_okay; } //! Save a matrix as raw binary (no header) template inline bool diskio::save_raw_binary(const Mat& x, const std::string& final_name) { arma_debug_sigprint(); const std::string tmp_name = diskio::gen_tmp_name(final_name); std::ofstream f(tmp_name, std::fstream::binary); bool save_okay = f.is_open(); if(save_okay) { save_okay = diskio::save_raw_binary(x, f); f.flush(); f.close(); if(save_okay) { save_okay = diskio::safe_rename(tmp_name, final_name); } } return save_okay; } template inline bool diskio::save_raw_binary(const Mat& x, std::ostream& f) { arma_debug_sigprint(); f.write( reinterpret_cast(x.mem), std::streamsize(x.n_elem*sizeof(eT)) ); return f.good(); } //! Save a matrix in text format (human readable), //! with a header that indicates the matrix type as well as its dimensions template inline bool diskio::save_arma_ascii(const Mat& x, const std::string& final_name) { arma_debug_sigprint(); const std::string tmp_name = diskio::gen_tmp_name(final_name); std::ofstream f; (arma_config::text_as_binary) ? f.open(tmp_name, std::fstream::binary) : f.open(tmp_name); bool save_okay = f.is_open(); if(save_okay) { save_okay = diskio::save_arma_ascii(x, f); f.flush(); f.close(); if(save_okay) { save_okay = diskio::safe_rename(tmp_name, final_name); } } return save_okay; } //! Save a matrix in text format (human readable), //! with a header that indicates the matrix type as well as its dimensions template inline bool diskio::save_arma_ascii(const Mat& x, std::ostream& f) { arma_debug_sigprint(); const arma_ostream_state stream_state(f); f << diskio::gen_txt_header(x) << '\n'; f << x.n_rows << ' ' << x.n_cols << '\n'; const std::streamsize cell_width = diskio::prepare_stream(f); for(uword row=0; row < x.n_rows; ++row) { for(uword col=0; col < x.n_cols; ++col) { f.put(' '); if(is_real::value) { f.width(cell_width); } arma_ostream::raw_print_elem(f, x.at(row,col)); } f.put('\n'); } const bool save_okay = f.good(); stream_state.restore(f); return save_okay; } //! Save a matrix in CSV text format (human readable) template inline bool diskio::save_csv_ascii(const Mat& x, const std::string& final_name, const field& header, const bool with_header, const char separator) { arma_debug_sigprint(); const std::string tmp_name = diskio::gen_tmp_name(final_name); std::ofstream f; (arma_config::text_as_binary) ? f.open(tmp_name, std::fstream::binary) : f.open(tmp_name); bool save_okay = f.is_open(); if(save_okay == false) { return false; } if(with_header) { arma_debug_print("diskio::save_csv_ascii(): writing header"); for(uword i=0; i < header.n_elem; ++i) { f << header.at(i); if(i != (header.n_elem-1)) { f.put(separator); } } f.put('\n'); save_okay = f.good(); } if(save_okay) { save_okay = diskio::save_csv_ascii(x, f, separator); } f.flush(); f.close(); if(save_okay) { save_okay = diskio::safe_rename(tmp_name, final_name); } return save_okay; } //! Save a matrix in CSV text format (human readable) template inline bool diskio::save_csv_ascii(const Mat& x, std::ostream& f, const char separator) { arma_debug_sigprint(); const arma_ostream_state stream_state(f); diskio::prepare_stream(f); uword x_n_rows = x.n_rows; uword x_n_cols = x.n_cols; const eT eT_int_lowest = eT(std::numeric_limits::lowest()); const eT eT_int_max = eT(std::numeric_limits::max()); for(uword row=0; row < x_n_rows; ++row) { for(uword col=0; col < x_n_cols; ++col) { const eT val = x.at(row,col); const bool is_real_int = (is_real::yes) && arma_isfinite(val) && (val > eT_int_lowest) && (val < eT_int_max) && (eT(int(val)) == val); (is_real_int) ? arma_ostream::raw_print_elem(f, int(val)) : arma_ostream::raw_print_elem(f, val); if( col < (x_n_cols-1) ) { f.put(separator); } } f.put('\n'); } const bool save_okay = f.good(); stream_state.restore(f); return save_okay; } //! Save a matrix in CSV text format (human readable); complex numbers stored in "a+bi" format template inline bool diskio::save_csv_ascii(const Mat< std::complex >& x, std::ostream& f, const char separator) { arma_debug_sigprint(); typedef typename std::complex eT; const arma_ostream_state stream_state(f); diskio::prepare_stream(f); const T T_int_lowest = T(std::numeric_limits::lowest()); const T T_int_max = T(std::numeric_limits::max()); uword x_n_rows = x.n_rows; uword x_n_cols = x.n_cols; for(uword row=0; row < x_n_rows; ++row) { for(uword col=0; col < x_n_cols; ++col) { const eT& val = x.at(row,col); const T val_r = std::real(val); const T val_i = std::imag(val); const T abs_i = (val_i < T(0)) ? T(-val_i) : T(val_i); const char sgn_i = (val_i < T(0)) ? char('-') : char('+'); const bool val_r_is_real_int = (is_real::yes) && arma_isfinite(val_r) && (val_r > T_int_lowest) && (val_r < T_int_max) && (T(int(val_r)) == val_r); const bool abs_i_is_real_int = (is_real::yes) && arma_isfinite(abs_i) && (abs_i < T_int_max) && (T(int(abs_i)) == abs_i); (val_r_is_real_int) ? arma_ostream::raw_print_elem(f, int(val_r)) : arma_ostream::raw_print_elem(f, val_r); f.put(sgn_i); (abs_i_is_real_int) ? arma_ostream::raw_print_elem(f, int(abs_i)) : arma_ostream::raw_print_elem(f, abs_i); f.put('i'); if( col < (x_n_cols-1) ) { f.put(separator); } } f.put('\n'); } const bool save_okay = f.good(); stream_state.restore(f); return save_okay; } template inline bool diskio::save_coord_ascii(const Mat& x, const std::string& final_name) { arma_debug_sigprint(); const std::string tmp_name = diskio::gen_tmp_name(final_name); std::ofstream f; (arma_config::text_as_binary) ? f.open(tmp_name, std::fstream::binary) : f.open(tmp_name); bool save_okay = f.is_open(); if(save_okay) { save_okay = diskio::save_coord_ascii(x, f); f.flush(); f.close(); if(save_okay) { save_okay = diskio::safe_rename(tmp_name, final_name); } } return save_okay; } template inline bool diskio::save_coord_ascii(const Mat& x, std::ostream& f) { arma_debug_sigprint(); const arma_ostream_state stream_state(f); diskio::prepare_stream(f); const eT eT_zero = eT(0); const eT eT_int_lowest = eT(std::numeric_limits::lowest()); const eT eT_int_max = eT(std::numeric_limits::max()); for(uword col=0; col < x.n_cols; ++col) for(uword row=0; row < x.n_rows; ++row) { const eT val = x.at(row,col); if(val == eT_zero) { continue; } f << row; f.put(' '); f << col; f.put(' '); const bool is_real_int = (is_real::yes) && arma_isfinite(val) && (val > eT_int_lowest) && (val < eT_int_max) && (eT(int(val)) == val); (is_real_int) ? arma_ostream::raw_print_elem(f, int(val)) : arma_ostream::raw_print_elem(f, val); f.put('\n'); } // make sure it's possible to determine the matrix size if( (x.n_rows > 0) && (x.n_cols > 0) ) { const uword max_row = (x.n_rows > 0) ? x.n_rows-1 : 0; const uword max_col = (x.n_cols > 0) ? x.n_cols-1 : 0; if( x.at(max_row, max_col) == eT(0) ) { f << max_row << ' ' << max_col << " 0\n"; } } const bool save_okay = f.good(); stream_state.restore(f); return save_okay; } template inline bool diskio::save_coord_ascii(const Mat< std::complex >& x, std::ostream& f) { arma_debug_sigprint(); typedef typename std::complex eT; const arma_ostream_state stream_state(f); diskio::prepare_stream(f); const eT eT_zero = eT(0); const T T_int_lowest = T(std::numeric_limits::lowest()); const T T_int_max = T(std::numeric_limits::max()); for(uword col=0; col < x.n_cols; ++col) for(uword row=0; row < x.n_rows; ++row) { const eT& val = x.at(row,col); if(val == eT_zero) { continue; } f << row; f.put(' '); f << col; f.put(' '); const T val_r = std::real(val); const T val_i = std::imag(val); const bool val_r_is_real_int = (is_real::yes) && arma_isfinite(val_r) && (val_r > T_int_lowest) && (val_r < T_int_max) && (T(int(val_r)) == val_r); const bool val_i_is_real_int = (is_real::yes) && arma_isfinite(val_i) && (val_i > T_int_lowest) && (val_i < T_int_max) && (T(int(val_i)) == val_i); (val_r_is_real_int) ? arma_ostream::raw_print_elem(f, int(val_r)) : arma_ostream::raw_print_elem(f, val_r); f.put(' '); (val_i_is_real_int) ? arma_ostream::raw_print_elem(f, int(val_i)) : arma_ostream::raw_print_elem(f, val_i); f.put('\n'); } // make sure it's possible to determine the matrix size if( (x.n_rows > 0) && (x.n_cols > 0) ) { const uword max_row = (x.n_rows > 0) ? x.n_rows-1 : 0; const uword max_col = (x.n_cols > 0) ? x.n_cols-1 : 0; if( x.at(max_row, max_col) == eT_zero ) { f << max_row << ' ' << max_col << " 0 0\n"; } } const bool save_okay = f.good(); stream_state.restore(f); return save_okay; } //! Save a matrix in binary format, //! with a header that stores the matrix type as well as its dimensions template inline bool diskio::save_arma_binary(const Mat& x, const std::string& final_name) { arma_debug_sigprint(); const std::string tmp_name = diskio::gen_tmp_name(final_name); std::ofstream f(tmp_name, std::fstream::binary); bool save_okay = f.is_open(); if(save_okay) { save_okay = diskio::save_arma_binary(x, f); f.flush(); f.close(); if(save_okay) { save_okay = diskio::safe_rename(tmp_name, final_name); } } return save_okay; } //! Save a matrix in binary format, //! with a header that stores the matrix type as well as its dimensions template inline bool diskio::save_arma_binary(const Mat& x, std::ostream& f) { arma_debug_sigprint(); f << diskio::gen_bin_header(x) << '\n'; f << x.n_rows << ' ' << x.n_cols << '\n'; f.write( reinterpret_cast(x.mem), std::streamsize(x.n_elem*sizeof(eT)) ); return f.good(); } //! Save a matrix as a PGM greyscale image template inline bool diskio::save_pgm_binary(const Mat& x, const std::string& final_name) { arma_debug_sigprint(); const std::string tmp_name = diskio::gen_tmp_name(final_name); std::fstream f(tmp_name, std::fstream::out | std::fstream::binary); bool save_okay = f.is_open(); if(save_okay) { save_okay = diskio::save_pgm_binary(x, f); f.flush(); f.close(); if(save_okay) { save_okay = diskio::safe_rename(tmp_name, final_name); } } return save_okay; } //! Save a matrix as a PGM greyscale image template inline bool diskio::save_pgm_binary(const Mat& x, std::ostream& f) { arma_debug_sigprint(); f << "P5" << '\n'; f << x.n_cols << ' ' << x.n_rows << '\n'; f << 255 << '\n'; const uword n_elem = x.n_rows * x.n_cols; podarray tmp(n_elem); uword i = 0; for(uword row=0; row < x.n_rows; ++row) for(uword col=0; col < x.n_cols; ++col) { tmp[i] = u8( x.at(row,col) ); // TODO: add round() ? ++i; } f.write(reinterpret_cast(tmp.mem), std::streamsize(n_elem) ); return f.good(); } //! Save a matrix as a PGM greyscale image template inline bool diskio::save_pgm_binary(const Mat< std::complex >& x, const std::string& final_name) { arma_debug_sigprint(); const uchar_mat tmp = conv_to::from(x); return diskio::save_pgm_binary(tmp, final_name); } //! Save a matrix as a PGM greyscale image template inline bool diskio::save_pgm_binary(const Mat< std::complex >& x, std::ostream& f) { arma_debug_sigprint(); const uchar_mat tmp = conv_to::from(x); return diskio::save_pgm_binary(tmp, f); } //! Save a matrix as part of a HDF5 file template inline bool diskio::save_hdf5_binary(const Mat& x, const hdf5_name& spec, std::string& err_msg) { arma_debug_sigprint(); #if defined(ARMA_USE_HDF5) { hdf5_misc::hdf5_suspend_printing_errors hdf5_print_suspender; bool save_okay = false; const bool append = bool(spec.opts.flags & hdf5_opts::flag_append); const bool replace = bool(spec.opts.flags & hdf5_opts::flag_replace); const bool use_existing_file = ((append || replace) && (H5Fis_hdf5(spec.filename.c_str()) > 0)); const std::string tmp_name = (use_existing_file) ? std::string() : diskio::gen_tmp_name(spec.filename); // Set up the file according to HDF5's preferences hid_t file = (use_existing_file) ? H5Fopen(spec.filename.c_str(), H5F_ACC_RDWR, H5P_DEFAULT) : H5Fcreate(tmp_name.c_str(), H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if(file < 0) { return false; } // We need to create a dataset, datatype, and dataspace hsize_t dims[2]; dims[1] = x.n_rows; dims[0] = x.n_cols; hid_t dataspace = H5Screate_simple(2, dims, NULL); // treat the matrix as a 2d array dataspace hid_t datatype = hdf5_misc::get_hdf5_type(); // fail if we can't handle the datatype if(datatype == -1) { err_msg = "unknown datatype for HDF5"; return false; } // MATLAB forces the users to specify a name at save time for HDF5; // Octave will use the default of 'dataset' unless otherwise specified. // If the user hasn't specified a dataset name, we will use 'dataset' // We may have to split out the group name from the dataset name. std::vector groups; std::string full_name = spec.dsname; size_t loc; while((loc = full_name.find("/")) != std::string::npos) { // Create another group... if(loc != 0) // Ignore the first /, if there is a leading /. { hid_t gid = H5Gcreate((groups.size() == 0) ? file : groups[groups.size() - 1], full_name.substr(0, loc).c_str(), H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if((gid < 0) && use_existing_file) { gid = H5Gopen((groups.size() == 0) ? file : groups[groups.size() - 1], full_name.substr(0, loc).c_str(), H5P_DEFAULT); } groups.push_back(gid); } full_name = full_name.substr(loc + 1); } const std::string dataset_name = full_name.empty() ? std::string("dataset") : full_name; const hid_t last_group = (groups.size() == 0) ? file : groups[groups.size() - 1]; if(use_existing_file && replace) { H5Ldelete(last_group, dataset_name.c_str(), H5P_DEFAULT); // NOTE: H5Ldelete() in HDF5 v1.8 doesn't reclaim the deleted space; use h5repack to reclaim space: h5repack oldfile.h5 newfile.h5 // NOTE: has this behaviour changed in HDF5 1.10 ? // NOTE: https://lists.hdfgroup.org/pipermail/hdf-forum_lists.hdfgroup.org/2017-August/010482.html // NOTE: https://lists.hdfgroup.org/pipermail/hdf-forum_lists.hdfgroup.org/2017-August/010486.html } hid_t dataset = H5Dcreate(last_group, dataset_name.c_str(), datatype, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if(dataset < 0) { save_okay = false; err_msg = "failed to create dataset"; } else { save_okay = (H5Dwrite(dataset, datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, x.mem) >= 0); H5Dclose(dataset); } H5Tclose(datatype); H5Sclose(dataspace); for(size_t i = 0; i < groups.size(); ++i) { H5Gclose(groups[i]); } H5Fclose(file); if((use_existing_file == false) && (save_okay == true)) { save_okay = diskio::safe_rename(tmp_name, spec.filename); } return save_okay; } #else { arma_ignore(x); arma_ignore(spec); arma_ignore(err_msg); arma_stop_logic_error("Mat::save(): use of HDF5 must be enabled"); return false; } #endif } //! Load a matrix as raw text (no header, human readable). //! Can read matrices saved as text in Matlab and Octave. //! NOTE: this is much slower than reading a file with a header. template inline bool diskio::load_raw_ascii(Mat& x, const std::string& name, std::string& err_msg) { arma_debug_sigprint(); std::ifstream f; (arma_config::text_as_binary) ? f.open(name, std::fstream::binary) : f.open(name); bool load_okay = f.is_open(); if(load_okay) { load_okay = diskio::load_raw_ascii(x, f, err_msg); f.close(); } return load_okay; } //! Load a matrix as raw text (no header, human readable). //! Can read matrices saved as text in Matlab and Octave. //! NOTE: this is much slower than reading a file with a header. template inline bool diskio::load_raw_ascii(Mat& x, std::istream& f, std::string& err_msg) { arma_debug_sigprint(); bool load_okay = f.good(); f.clear(); const std::fstream::pos_type pos1 = f.tellg(); // // work out the size uword f_n_rows = 0; uword f_n_cols = 0; bool f_n_cols_found = false; std::string line_string; std::stringstream line_stream; std::string token; while( f.good() && load_okay ) { std::getline(f, line_string); // TODO: does it make sense to stop processing the file if an empty line is found ? if(line_string.size() == 0) { break; } line_stream.clear(); line_stream.str(line_string); uword line_n_cols = 0; while(line_stream >> token) { ++line_n_cols; } if(f_n_cols_found == false) { f_n_cols = line_n_cols; f_n_cols_found = true; } else { if(line_n_cols != f_n_cols) { load_okay = false; err_msg = "inconsistent number of columns"; } } ++f_n_rows; } if(load_okay) { f.clear(); f.seekg(pos1); if(f.fail() || (f.tellg() != pos1)) { err_msg = "seek failure"; return false; } try { x.set_size(f_n_rows, f_n_cols); } catch(...) { err_msg = "not enough memory"; return false; } for(uword row=0; ((row < x.n_rows) && load_okay); ++row) for(uword col=0; ((col < x.n_cols) && load_okay); ++col) { f >> token; if(diskio::convert_token(x.at(row,col), token) == false) { load_okay = false; err_msg = "data interpretation failure"; } } } // an empty file indicates an empty matrix if( (f_n_cols_found == false) && (load_okay == true) ) { x.reset(); } return load_okay; } //! Load a matrix in binary format (no header); //! the matrix is assumed to have one column template inline bool diskio::load_raw_binary(Mat& x, const std::string& name, std::string& err_msg) { arma_debug_sigprint(); std::ifstream f; f.open(name, std::fstream::binary); bool load_okay = f.is_open(); if(load_okay) { load_okay = diskio::load_raw_binary(x, f, err_msg); f.close(); } return load_okay; } template inline bool diskio::load_raw_binary(Mat& x, std::istream& f, std::string& err_msg) { arma_debug_sigprint(); f.clear(); const std::streampos pos1 = f.tellg(); f.clear(); f.seekg(0, ios::end); f.clear(); const std::streampos pos2 = f.tellg(); const uword N = ( (pos1 >= 0) && (pos2 >= 0) ) ? uword(pos2 - pos1) : 0; f.clear(); //f.seekg(0, ios::beg); f.seekg(pos1); if(f.fail() || (f.tellg() != pos1)) { err_msg = "seek failure"; return false; } try { x.set_size(N / uword(sizeof(eT)), 1); } catch(...) { err_msg = "not enough memory"; return false; } f.clear(); f.read( reinterpret_cast(x.memptr()), std::streamsize(x.n_elem * uword(sizeof(eT))) ); return f.good(); } //! Load a matrix in text format (human readable), //! with a header that indicates the matrix type as well as its dimensions template inline bool diskio::load_arma_ascii(Mat& x, const std::string& name, std::string& err_msg) { arma_debug_sigprint(); std::ifstream f; (arma_config::text_as_binary) ? f.open(name, std::fstream::binary) : f.open(name); bool load_okay = f.is_open(); if(load_okay) { load_okay = diskio::load_arma_ascii(x, f, err_msg); f.close(); } return load_okay; } //! Load a matrix in text format (human readable), //! with a header that indicates the matrix type as well as its dimensions template inline bool diskio::load_arma_ascii(Mat& x, std::istream& f, std::string& err_msg) { arma_debug_sigprint(); std::streampos pos = f.tellg(); bool load_okay = true; std::string f_header; uword f_n_rows; uword f_n_cols; f >> f_header; f >> f_n_rows; f >> f_n_cols; if(f_header == diskio::gen_txt_header(x)) { try { x.zeros(f_n_rows, f_n_cols); } catch(...) { err_msg = "not enough memory"; return false; } std::string token; for(uword row=0; row < x.n_rows; ++row) for(uword col=0; col < x.n_cols; ++col) { f >> token; diskio::convert_token( x.at(row,col), token ); } load_okay = f.good(); } else { load_okay = false; err_msg = "incorrect header"; } // allow automatic conversion of u32/s32 matrices into u64/s64 matrices if(load_okay == false) { if( (sizeof(eT) == 8) && is_same_type::yes ) { Mat tmp; std::string junk; f.clear(); f.seekg(pos); load_okay = diskio::load_arma_ascii(tmp, f, junk); if(load_okay) { x = conv_to< Mat >::from(tmp); } } else if( (sizeof(eT) == 8) && is_same_type::yes ) { Mat tmp; std::string junk; f.clear(); f.seekg(pos); load_okay = diskio::load_arma_ascii(tmp, f, junk); if(load_okay) { x = conv_to< Mat >::from(tmp); } } } return load_okay; } //! Load a matrix in CSV text format (human readable) template inline bool diskio::load_csv_ascii(Mat& x, const std::string& name, std::string& err_msg, field& header, const bool with_header, const char separator, const bool strict) { arma_debug_sigprint(); std::ifstream f; (arma_config::text_as_binary) ? f.open(name, std::fstream::binary) : f.open(name); bool load_okay = f.is_open(); if(load_okay == false) { return false; } if(with_header) { arma_debug_print("diskio::load_csv_ascii(): reading header"); std::string header_line; std::stringstream header_stream; std::vector header_tokens; std::getline(f, header_line); load_okay = f.good(); if(load_okay) { std::string token; header_stream.clear(); header_stream.str(header_line); uword header_n_tokens = 0; while(header_stream.good()) { std::getline(header_stream, token, separator); diskio::sanitise_token(token); ++header_n_tokens; header_tokens.push_back(token); } if(header_n_tokens == uword(0)) { header.reset(); } else { header.set_size(1,header_n_tokens); for(uword i=0; i < header_n_tokens; ++i) { header.at(i) = header_tokens[i]; } } } } if(load_okay) { load_okay = diskio::load_csv_ascii(x, f, err_msg, separator, strict); } f.close(); return load_okay; } //! Load a matrix in CSV text format (human readable) template inline bool diskio::load_csv_ascii(Mat& x, std::istream& f, std::string& err_msg, const char separator, const bool strict) { arma_debug_sigprint(); // TODO: replace with more efficient implementation if(f.good() == false) { return false; } f.clear(); const std::fstream::pos_type pos1 = f.tellg(); // // work out the size uword f_n_rows = 0; uword f_n_cols = 0; std::string line_string; std::stringstream line_stream; std::string token; while(f.good()) { std::getline(f, line_string); if(line_string.size() == 0) { break; } line_stream.clear(); line_stream.str(line_string); uword line_n_cols = 0; while(line_stream.good()) { std::getline(line_stream, token, separator); ++line_n_cols; } if(f_n_cols < line_n_cols) { f_n_cols = line_n_cols; } ++f_n_rows; } f.clear(); f.seekg(pos1); if(f.fail() || (f.tellg() != pos1)) { err_msg = "seek failure"; return false; } try { x.zeros(f_n_rows, f_n_cols); } catch(...) { err_msg = "not enough memory"; return false; } if(strict) { x.fill(Datum::nan); } // take into account that each row may have a unique number of columns const bool use_mp = (arma_config::openmp) && (f_n_rows >= 2) && (f_n_cols >= 64); field token_array; bool token_array_ok = false; if(use_mp) { try { token_array.set_size(f_n_cols); for(uword i=0; i < f_n_cols; ++i) { token_array(i).reserve(32); } token_array_ok = true; } catch(...) { token_array.reset(); } } if(use_mp && token_array_ok) { #if defined(ARMA_USE_OPENMP) { uword row = 0; while(f.good()) { std::getline(f, line_string); if(line_string.size() == 0) { break; } line_stream.clear(); line_stream.str(line_string); for(uword i=0; i < f_n_cols; ++i) { token_array(i).clear(); } uword line_stream_col = 0; while(line_stream.good()) { std::getline(line_stream, token_array(line_stream_col), separator); ++line_stream_col; } const int n_threads = mp_thread_limit::get(); #pragma omp parallel for schedule(static) num_threads(n_threads) for(uword col=0; col < line_stream_col; ++col) { eT& out_val = x.at(row,col); (strict) ? diskio::convert_token_strict( out_val, token_array(col) ) : diskio::convert_token( out_val, token_array(col) ); } ++row; } } #endif } else // serial implementation { uword row = 0; while(f.good()) { std::getline(f, line_string); if(line_string.size() == 0) { break; } line_stream.clear(); line_stream.str(line_string); uword col = 0; while(line_stream.good()) { std::getline(line_stream, token, separator); eT& out_val = x.at(row,col); (strict) ? diskio::convert_token_strict( out_val, token ) : diskio::convert_token( out_val, token ); ++col; } ++row; } } return true; } //! Load a matrix in CSV text format (human readable); complex numbers stored in "a+bi" format template inline bool diskio::load_csv_ascii(Mat< std::complex >& x, std::istream& f, std::string& err_msg, const char separator, const bool strict) { arma_debug_sigprint(); // TODO: replace with more efficient implementation if(f.good() == false) { return false; } f.clear(); const std::fstream::pos_type pos1 = f.tellg(); // // work out the size uword f_n_rows = 0; uword f_n_cols = 0; std::string line_string; std::stringstream line_stream; std::string token; while(f.good()) { std::getline(f, line_string); if(line_string.size() == 0) { break; } line_stream.clear(); line_stream.str(line_string); uword line_n_cols = 0; while(line_stream.good()) { std::getline(line_stream, token, separator); ++line_n_cols; } if(f_n_cols < line_n_cols) { f_n_cols = line_n_cols; } ++f_n_rows; } f.clear(); f.seekg(pos1); if(f.fail() || (f.tellg() != pos1)) { err_msg = "seek failure"; return false; } try { x.zeros(f_n_rows, f_n_cols); } catch(...) { err_msg = "not enough memory"; return false; } if(strict) { x.fill(Datum< std::complex >::nan); } // take into account that each row may have a unique number of columns uword row = 0; std::string str_real; std::string str_imag; while(f.good()) { std::getline(f, line_string); if(line_string.size() == 0) { break; } line_stream.clear(); line_stream.str(line_string); uword col = 0; while(line_stream.good()) { std::getline(line_stream, token, separator); diskio::sanitise_token(token); const size_t token_len = size_t( token.length() ); if(token_len == 0) { col++; continue; } // handle special cases: inf and nan, without the imaginary part if( (token_len == 3) || (token_len == 4) ) { const char* str = token.c_str(); const bool neg = (str[0] == '-'); const bool pos = (str[0] == '+'); const size_t offset = ( (neg || pos) && (token_len == 4) ) ? 1 : 0; const char sig_a = str[offset ]; const char sig_b = str[offset+1]; const char sig_c = str[offset+2]; bool found_val_real = false; T val_real = T(0); if( ((sig_a == 'i') || (sig_a == 'I')) && ((sig_b == 'n') || (sig_b == 'N')) && ((sig_c == 'f') || (sig_c == 'F')) ) { val_real = (neg) ? -(Datum::inf) : Datum::inf; found_val_real = true; } else if( ((sig_a == 'n') || (sig_a == 'N')) && ((sig_b == 'a') || (sig_b == 'A')) && ((sig_c == 'n') || (sig_c == 'N')) ) { val_real = Datum::nan; found_val_real = true; } if(found_val_real) { const T val_imag = (strict) ? T(Datum::nan) : T(0); x.at(row,col) = std::complex(val_real, val_imag); col++; continue; // get next token } } bool found_x = false; std::string::size_type loc_x = 0; // location of the separator (+ or -) between the real and imaginary part std::string::size_type loc_i = token.find_last_of('i'); // location of the imaginary part indicator if(loc_i == std::string::npos) { str_real = token; str_imag.clear(); } else { bool found_plus = false; bool found_minus = false; std::string::size_type loc_plus = token.find_last_of('+'); if(loc_plus != std::string::npos) { if(loc_plus >= 1) { const char prev_char = token.at(loc_plus-1); // make sure we're not looking at the sign of the exponent if( (prev_char != 'e') && (prev_char != 'E') ) { found_plus = true; } else { // search again, omitting the exponent loc_plus = token.find_last_of('+', loc_plus-1); if(loc_plus != std::string::npos) { found_plus = true; } } } else { // loc_plus == 0, meaning we're at the start of the string found_plus = true; } } std::string::size_type loc_minus = token.find_last_of('-'); if(loc_minus != std::string::npos) { if(loc_minus >= 1) { const char prev_char = token.at(loc_minus-1); // make sure we're not looking at the sign of the exponent if( (prev_char != 'e') && (prev_char != 'E') ) { found_minus = true; } else { // search again, omitting the exponent loc_minus = token.find_last_of('-', loc_minus-1); if(loc_minus != std::string::npos) { found_minus = true; } } } else { // loc_minus == 0, meaning we're at the start of the string found_minus = true; } } if(found_plus && found_minus) { if( (loc_i > loc_plus) && (loc_i > loc_minus) ) { // choose the sign closest to the "i" to be the separator between the real and imaginary part loc_x = ( (loc_i - loc_plus) < (loc_i - loc_minus) ) ? loc_plus : loc_minus; found_x = true; } } else if(found_plus ) { loc_x = loc_plus; found_x = true; } else if(found_minus) { loc_x = loc_minus; found_x = true; } if(found_x) { if( loc_x > 0 ) { str_real = token.substr(0,loc_x); } else { str_real.clear(); } if((loc_x+1) < token.size()) { str_imag = token.substr(loc_x, token.size()-loc_x-1); } else { str_imag.clear(); } } else { str_real.clear(); str_imag.clear(); } } T val_real = T(0); T val_imag = T(0); (strict) ? diskio::convert_token_strict(val_real, str_real) : diskio::convert_token(val_real, str_real); (strict) ? diskio::convert_token_strict(val_imag, str_imag) : diskio::convert_token(val_imag, str_imag); x.at(row,col) = std::complex(val_real, val_imag); ++col; } ++row; } return true; } template inline bool diskio::load_coord_ascii(Mat& x, const std::string& name, std::string& err_msg) { arma_debug_sigprint(); std::ifstream f; (arma_config::text_as_binary) ? f.open(name, std::fstream::binary) : f.open(name); bool load_okay = f.is_open(); if(load_okay == false) { return false; } if(load_okay) { load_okay = diskio::load_coord_ascii(x, f, err_msg); } f.close(); return load_okay; } //! Load a matrix in CSV text format (human readable) template inline bool diskio::load_coord_ascii(Mat& x, std::istream& f, std::string& err_msg) { arma_debug_sigprint(); if(f.good() == false) { return false; } f.clear(); const std::fstream::pos_type pos1 = f.tellg(); // work out the size uword f_n_rows = 0; uword f_n_cols = 0; bool size_found = false; std::string line_string; std::stringstream line_stream; std::string token; while(f.good()) { std::getline(f, line_string); if(line_string.size() == 0) { break; } line_stream.clear(); line_stream.str(line_string); uword line_row = 0; uword line_col = 0; // a valid line in co-ord format has at least 2 entries line_stream >> line_row; if(line_stream.good() == false) { err_msg = "incorrect format"; return false; } line_stream >> line_col; size_found = true; if(f_n_rows < line_row) { f_n_rows = line_row; } if(f_n_cols < line_col) { f_n_cols = line_col; } } // take into account that indices start at 0 if(size_found) { ++f_n_rows; ++f_n_cols; } f.clear(); f.seekg(pos1); if(f.fail() || (f.tellg() != pos1)) { err_msg = "seek failure"; return false; } try { Mat tmp(f_n_rows, f_n_cols, arma_zeros_indicator()); while(f.good()) { std::getline(f, line_string); if(line_string.size() == 0) { break; } line_stream.clear(); line_stream.str(line_string); uword line_row = 0; uword line_col = 0; line_stream >> line_row; line_stream >> line_col; eT val = eT(0); line_stream >> token; if(line_stream.fail() == false) { diskio::convert_token( val, token ); } if(val != eT(0)) { tmp(line_row,line_col) = val; } } x.steal_mem(tmp); } catch(...) { err_msg = "not enough memory"; return false; } return true; } template inline bool diskio::load_coord_ascii(Mat< std::complex >& x, std::istream& f, std::string& err_msg) { arma_debug_sigprint(); if(f.good() == false) { return false; } f.clear(); const std::fstream::pos_type pos1 = f.tellg(); // work out the size uword f_n_rows = 0; uword f_n_cols = 0; bool size_found = false; std::string line_string; std::stringstream line_stream; std::string token_real; std::string token_imag; while(f.good()) { std::getline(f, line_string); if(line_string.size() == 0) { break; } line_stream.clear(); line_stream.str(line_string); uword line_row = 0; uword line_col = 0; // a valid line in co-ord format has at least 2 entries line_stream >> line_row; if(line_stream.good() == false) { err_msg = "incorrect format"; return false; } line_stream >> line_col; size_found = true; if(f_n_rows < line_row) f_n_rows = line_row; if(f_n_cols < line_col) f_n_cols = line_col; } // take into account that indices start at 0 if(size_found) { ++f_n_rows; ++f_n_cols; } f.clear(); f.seekg(pos1); if(f.fail() || (f.tellg() != pos1)) { err_msg = "seek failure"; return false; } try { Mat< std::complex > tmp(f_n_rows, f_n_cols, arma_zeros_indicator()); while(f.good()) { std::getline(f, line_string); if(line_string.size() == 0) { break; } line_stream.clear(); line_stream.str(line_string); uword line_row = 0; uword line_col = 0; line_stream >> line_row; line_stream >> line_col; T val_real = T(0); T val_imag = T(0); line_stream >> token_real; if(line_stream.fail() == false) { diskio::convert_token( val_real, token_real ); } line_stream >> token_imag; if(line_stream.fail() == false) { diskio::convert_token( val_imag, token_imag ); } if( (val_real != T(0)) || (val_imag != T(0)) ) { tmp(line_row,line_col) = std::complex(val_real, val_imag); } } x.steal_mem(tmp); } catch(...) { err_msg = "not enough memory"; return false; } return true; } //! Load a matrix in binary format, //! with a header that indicates the matrix type as well as its dimensions template inline bool diskio::load_arma_binary(Mat& x, const std::string& name, std::string& err_msg) { arma_debug_sigprint(); std::ifstream f; f.open(name, std::fstream::binary); bool load_okay = f.is_open(); if(load_okay) { load_okay = diskio::load_arma_binary(x, f, err_msg); f.close(); } return load_okay; } template inline bool diskio::load_arma_binary(Mat& x, std::istream& f, std::string& err_msg) { arma_debug_sigprint(); std::streampos pos = f.tellg(); bool load_okay = true; std::string f_header; uword f_n_rows; uword f_n_cols; f >> f_header; f >> f_n_rows; f >> f_n_cols; if(f_header == diskio::gen_bin_header(x)) { //f.seekg(1, ios::cur); // NOTE: this may not be portable, as on a Windows machine a newline could be two characters f.get(); try { x.set_size(f_n_rows,f_n_cols); } catch(...) { err_msg = "not enough memory"; return false; } f.read( reinterpret_cast(x.memptr()), std::streamsize(x.n_elem*sizeof(eT)) ); load_okay = f.good(); } else { load_okay = false; err_msg = "incorrect header"; } // allow automatic conversion of u32/s32 matrices into u64/s64 matrices if(load_okay == false) { if( (sizeof(eT) == 8) && is_same_type::yes ) { Mat tmp; std::string junk; f.clear(); f.seekg(pos); load_okay = diskio::load_arma_binary(tmp, f, junk); if(load_okay) { x = conv_to< Mat >::from(tmp); } } else if( (sizeof(eT) == 8) && is_same_type::yes ) { Mat tmp; std::string junk; f.clear(); f.seekg(pos); load_okay = diskio::load_arma_binary(tmp, f, junk); if(load_okay) { x = conv_to< Mat >::from(tmp); } } } return load_okay; } inline void diskio::pnm_skip_comments(std::istream& f) { while( isspace(f.peek()) ) { while( isspace(f.peek()) ) { f.get(); } if(f.peek() == '#') { while( (f.peek() != '\r') && (f.peek() != '\n') ) { f.get(); } } } } //! Load a PGM greyscale image as a matrix template inline bool diskio::load_pgm_binary(Mat& x, const std::string& name, std::string& err_msg) { arma_debug_sigprint(); std::fstream f; f.open(name, std::fstream::in | std::fstream::binary); bool load_okay = f.is_open(); if(load_okay) { load_okay = diskio::load_pgm_binary(x, f, err_msg); f.close(); } return load_okay; } //! Load a PGM greyscale image as a matrix template inline bool diskio::load_pgm_binary(Mat& x, std::istream& f, std::string& err_msg) { bool load_okay = true; std::string f_header; f >> f_header; if(f_header == "P5") { uword f_n_rows = 0; uword f_n_cols = 0; int f_maxval = 0; diskio::pnm_skip_comments(f); f >> f_n_cols; diskio::pnm_skip_comments(f); f >> f_n_rows; diskio::pnm_skip_comments(f); f >> f_maxval; f.get(); if( (f_maxval > 0) && (f_maxval <= 65535) ) { try { x.set_size(f_n_rows,f_n_cols); } catch(...) { err_msg = "not enough memory"; return false; } if(f_maxval <= 255) { const uword n_elem = f_n_cols*f_n_rows; podarray tmp(n_elem); f.read( reinterpret_cast(tmp.memptr()), std::streamsize(n_elem) ); uword i = 0; //cout << "f_n_cols = " << f_n_cols << endl; //cout << "f_n_rows = " << f_n_rows << endl; for(uword row=0; row < f_n_rows; ++row) for(uword col=0; col < f_n_cols; ++col) { x.at(row,col) = eT(tmp[i]); ++i; } } else { const uword n_elem = f_n_cols*f_n_rows; podarray tmp(n_elem); f.read( reinterpret_cast(tmp.memptr()), std::streamsize(n_elem*2) ); uword i = 0; for(uword row=0; row < f_n_rows; ++row) for(uword col=0; col < f_n_cols; ++col) { x.at(row,col) = eT(tmp[i]); ++i; } } } else { load_okay = false; err_msg = "functionality unimplemented"; } if(f.good() == false) { load_okay = false; } } else { load_okay = false; err_msg = "unsupported header"; } return load_okay; } //! Load a PGM greyscale image as a matrix template inline bool diskio::load_pgm_binary(Mat< std::complex >& x, const std::string& name, std::string& err_msg) { arma_debug_sigprint(); uchar_mat tmp; const bool load_okay = diskio::load_pgm_binary(tmp, name, err_msg); x = conv_to< Mat< std::complex > >::from(tmp); return load_okay; } //! Load a PGM greyscale image as a matrix template inline bool diskio::load_pgm_binary(Mat< std::complex >& x, std::istream& is, std::string& err_msg) { arma_debug_sigprint(); uchar_mat tmp; const bool load_okay = diskio::load_pgm_binary(tmp, is, err_msg); x = conv_to< Mat< std::complex > >::from(tmp); return load_okay; } //! Load a HDF5 file as a matrix template inline bool diskio::load_hdf5_binary(Mat& x, const hdf5_name& spec, std::string& err_msg) { arma_debug_sigprint(); #if defined(ARMA_USE_HDF5) { if(diskio::is_readable(spec.filename) == false) { return false; } hdf5_misc::hdf5_suspend_printing_errors hdf5_print_suspender; bool load_okay = false; hid_t fid = H5Fopen(spec.filename.c_str(), H5F_ACC_RDONLY, H5P_DEFAULT); if(fid >= 0) { // MATLAB HDF5 dataset names are user-specified; // Octave tends to store the datasets in a group, with the actual dataset being referred to as "value". // If the user hasn't specified a dataset, we will search for "dataset" and "value", // and if those are not found we will take the first dataset we do find. std::vector searchNames; const bool exact = (spec.dsname.empty() == false); if(exact) { searchNames.push_back(spec.dsname); } else { searchNames.push_back("dataset"); searchNames.push_back("value" ); } hid_t dataset = hdf5_misc::search_hdf5_file(searchNames, fid, 2, exact); if(dataset >= 0) { hid_t filespace = H5Dget_space(dataset); // This must be <= 2 due to our search rules. const int ndims = H5Sget_simple_extent_ndims(filespace); hsize_t dims[2]; const herr_t query_status = H5Sget_simple_extent_dims(filespace, dims, NULL); // arma_check(query_status < 0, "Mat::load(): cannot get size of HDF5 dataset"); if(query_status < 0) { err_msg = "cannot get size of HDF5 dataset"; H5Sclose(filespace); H5Dclose(dataset); H5Fclose(fid); return false; } if(ndims == 1) { dims[1] = 1; } // Vector case; fake second dimension (one column). try { x.set_size(dims[1], dims[0]); } catch(...) { err_msg = "not enough memory"; return false; } // Now we have to see what type is stored to figure out how to load it. hid_t datatype = H5Dget_type(dataset); hid_t mat_type = hdf5_misc::get_hdf5_type(); // If these are the same type, it is simple. if(H5Tequal(datatype, mat_type) > 0) { // Load directly; H5S_ALL used so that we load the entire dataset. hid_t read_status = H5Dread(dataset, datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, void_ptr(x.memptr())); if(read_status >= 0) { load_okay = true; } } else { // Load into another array and convert its type accordingly. hid_t read_status = hdf5_misc::load_and_convert_hdf5(x.memptr(), dataset, datatype, x.n_elem); if(read_status >= 0) { load_okay = true; } } // Now clean up. H5Tclose(datatype); H5Tclose(mat_type); H5Sclose(filespace); } H5Dclose(dataset); H5Fclose(fid); if(load_okay == false) { err_msg = "unsupported or missing HDF5 data"; } } else { err_msg = "cannot open"; } return load_okay; } #else { arma_ignore(x); arma_ignore(spec); arma_ignore(err_msg); arma_stop_logic_error("Mat::load(): use of HDF5 must be enabled"); return false; } #endif } //! Try to load a matrix by automatically determining its type template inline bool diskio::load_auto_detect(Mat& x, const std::string& name, std::string& err_msg) { arma_debug_sigprint(); if(diskio::is_readable(name) == false) { return false; } #if defined(ARMA_USE_HDF5) // We're currently using the C bindings for the HDF5 library, which don't support C++ streams if( H5Fis_hdf5(name.c_str()) ) { return load_hdf5_binary(x, name, err_msg); } #endif std::fstream f; f.open(name, std::fstream::in | std::fstream::binary); bool load_okay = f.is_open(); if(load_okay) { load_okay = diskio::load_auto_detect(x, f, err_msg); f.close(); } return load_okay; } //! Try to load a matrix by automatically determining its type template inline bool diskio::load_auto_detect(Mat& x, std::istream& f, std::string& err_msg) { arma_debug_sigprint(); const char* ARMA_MAT_TXT_str = "ARMA_MAT_TXT"; const char* ARMA_MAT_BIN_str = "ARMA_MAT_BIN"; const char* P5_str = "P5"; const uword ARMA_MAT_TXT_len = uword(12); const uword ARMA_MAT_BIN_len = uword(12); const uword P5_len = uword(2); podarray header(ARMA_MAT_TXT_len + 1); char* header_mem = header.memptr(); std::streampos pos = f.tellg(); f.read( header_mem, std::streamsize(ARMA_MAT_TXT_len) ); f.clear(); f.seekg(pos); header_mem[ARMA_MAT_TXT_len] = '\0'; if( std::strncmp(ARMA_MAT_TXT_str, header_mem, size_t(ARMA_MAT_TXT_len)) == 0 ) { return load_arma_ascii(x, f, err_msg); } else if( std::strncmp(ARMA_MAT_BIN_str, header_mem, size_t(ARMA_MAT_BIN_len)) == 0 ) { return load_arma_binary(x, f, err_msg); } else if( std::strncmp(P5_str, header_mem, size_t(P5_len)) == 0 ) { return load_pgm_binary(x, f, err_msg); } else { const file_type ft = guess_file_type_internal(f); switch(ft) { case csv_ascii: return load_csv_ascii(x, f, err_msg, char(','), false); break; case ssv_ascii: return load_csv_ascii(x, f, err_msg, char(';'), false); break; case raw_binary: return load_raw_binary(x, f, err_msg); break; case raw_ascii: return load_raw_ascii(x, f, err_msg); break; default: err_msg = "unknown data"; return false; } } return false; } // // sparse matrices // //! Save a sparse matrix in CSV format template inline bool diskio::save_csv_ascii(const SpMat& x, const std::string& final_name, const field& header, const bool with_header, const char separator) { arma_debug_sigprint(); const std::string tmp_name = diskio::gen_tmp_name(final_name); std::ofstream f; (arma_config::text_as_binary) ? f.open(tmp_name, std::fstream::binary) : f.open(tmp_name); bool save_okay = f.is_open(); if(save_okay == false) { return false; } if(with_header) { arma_debug_print("diskio::save_csv_ascii(): writing header"); for(uword i=0; i < header.n_elem; ++i) { f << header(i); if(i != (header.n_elem-1)) { f.put(separator); } } f.put('\n'); save_okay = f.good(); } if(save_okay) { save_okay = diskio::save_csv_ascii(x, f, separator); } f.flush(); f.close(); if(save_okay) { save_okay = diskio::safe_rename(tmp_name, final_name); } return save_okay; } //! Save a sparse matrix in CSV format template inline bool diskio::save_csv_ascii(const SpMat& x, std::ostream& f, const char separator) { arma_debug_sigprint(); const arma_ostream_state stream_state(f); diskio::prepare_stream(f); x.sync(); uword x_n_rows = x.n_rows; uword x_n_cols = x.n_cols; const eT eT_zero = eT(0); const eT eT_int_lowest = eT(std::numeric_limits::lowest()); const eT eT_int_max = eT(std::numeric_limits::max()); for(uword row=0; row < x_n_rows; ++row) { for(uword col=0; col < x_n_cols; ++col) { const eT val = x.at(row,col); if(val == eT_zero) { f.put('0'); } else { const bool is_real_int = (is_real::yes) && arma_isfinite(val) && (val > eT_int_lowest) && (val < eT_int_max) && (eT(int(val)) == val); (is_real_int) ? arma_ostream::raw_print_elem(f, int(val)) : arma_ostream::raw_print_elem(f, val); } if( col < (x_n_cols-1) ) { f.put(separator); } } f.put('\n'); } const bool save_okay = f.good(); stream_state.restore(f); return save_okay; } //! Save a sparse matrix in CSV format (complex numbers) template inline bool diskio::save_csv_ascii(const SpMat< std::complex >& x, std::ostream& f, const char separator) { arma_debug_sigprint(); arma_ignore(x); arma_ignore(f); arma_ignore(separator); arma_warn(1, "saving complex sparse matrices as csv_ascii not yet implemented"); return false; } //! Save a matrix in ASCII coord format template inline bool diskio::save_coord_ascii(const SpMat& x, const std::string& final_name) { arma_debug_sigprint(); const std::string tmp_name = diskio::gen_tmp_name(final_name); std::ofstream f; (arma_config::text_as_binary) ? f.open(tmp_name, std::fstream::binary) : f.open(tmp_name); bool save_okay = f.is_open(); if(save_okay) { save_okay = diskio::save_coord_ascii(x, f); f.flush(); f.close(); if(save_okay) { save_okay = diskio::safe_rename(tmp_name, final_name); } } return save_okay; } //! Save a matrix in ASCII coord format template inline bool diskio::save_coord_ascii(const SpMat& x, std::ostream& f) { arma_debug_sigprint(); const arma_ostream_state stream_state(f); diskio::prepare_stream(f); const eT eT_int_lowest = eT(std::numeric_limits::lowest()); const eT eT_int_max = eT(std::numeric_limits::max()); typename SpMat::const_iterator iter = x.begin(); typename SpMat::const_iterator iter_end = x.end(); for(; iter != iter_end; ++iter) { f << iter.row(); f.put(' '); f << iter.col(); f.put(' '); const eT val = (*iter); const bool is_real_int = (is_real::yes) && arma_isfinite(val) && (val > eT_int_lowest) && (val < eT_int_max) && (eT(int(val)) == val); (is_real_int) ? arma_ostream::raw_print_elem(f, int(val)) : arma_ostream::raw_print_elem(f, val); f.put('\n'); } // make sure it's possible to determine the matrix size if( (x.n_rows > 0) && (x.n_cols > 0) ) { const uword max_row = (x.n_rows > 0) ? x.n_rows-1 : 0; const uword max_col = (x.n_cols > 0) ? x.n_cols-1 : 0; if( x.at(max_row, max_col) == eT(0) ) { f << max_row << ' ' << max_col << " 0\n"; } } const bool save_okay = f.good(); stream_state.restore(f); return save_okay; } //! Save a matrix in ASCII coord format (complex numbers) template inline bool diskio::save_coord_ascii(const SpMat< std::complex >& x, std::ostream& f) { arma_debug_sigprint(); typedef typename std::complex eT; const arma_ostream_state stream_state(f); diskio::prepare_stream(f); const T T_int_lowest = T(std::numeric_limits::lowest()); const T T_int_max = T(std::numeric_limits::max()); typename SpMat::const_iterator iter = x.begin(); typename SpMat::const_iterator iter_end = x.end(); for(; iter != iter_end; ++iter) { f << iter.row(); f.put(' '); f << iter.col(); f.put(' '); const eT val = (*iter); const T val_r = std::real(val); const T val_i = std::imag(val); const bool val_r_is_real_int = (is_real::yes) && arma_isfinite(val_r) && (val_r > T_int_lowest) && (val_r < T_int_max) && (T(int(val_r)) == val_r); const bool val_i_is_real_int = (is_real::yes) && arma_isfinite(val_i) && (val_i > T_int_lowest) && (val_i < T_int_max) && (T(int(val_i)) == val_i); (val_r_is_real_int) ? arma_ostream::raw_print_elem(f, int(val_r)) : arma_ostream::raw_print_elem(f, val_r); f.put(' '); (val_i_is_real_int) ? arma_ostream::raw_print_elem(f, int(val_i)) : arma_ostream::raw_print_elem(f, val_i); f.put('\n'); } // make sure it's possible to determine the matrix size if( (x.n_rows > 0) && (x.n_cols > 0) ) { const uword max_row = (x.n_rows > 0) ? x.n_rows-1 : 0; const uword max_col = (x.n_cols > 0) ? x.n_cols-1 : 0; if( x.at(max_row, max_col) == eT(0) ) { f << max_row << ' ' << max_col << " 0 0\n"; } } const bool save_okay = f.good(); stream_state.restore(f); return save_okay; } //! Save a matrix in binary format, //! with a header that stores the matrix type as well as its dimensions template inline bool diskio::save_arma_binary(const SpMat& x, const std::string& final_name) { arma_debug_sigprint(); const std::string tmp_name = diskio::gen_tmp_name(final_name); std::ofstream f(tmp_name, std::fstream::binary); bool save_okay = f.is_open(); if(save_okay) { save_okay = diskio::save_arma_binary(x, f); f.flush(); f.close(); if(save_okay) { save_okay = diskio::safe_rename(tmp_name, final_name); } } return save_okay; } //! Save a matrix in binary format, //! with a header that stores the matrix type as well as its dimensions template inline bool diskio::save_arma_binary(const SpMat& x, std::ostream& f) { arma_debug_sigprint(); f << diskio::gen_bin_header(x) << '\n'; f << x.n_rows << ' ' << x.n_cols << ' ' << x.n_nonzero << '\n'; f.write( reinterpret_cast(x.values), std::streamsize(x.n_nonzero*sizeof(eT)) ); f.write( reinterpret_cast(x.row_indices), std::streamsize(x.n_nonzero*sizeof(uword)) ); f.write( reinterpret_cast(x.col_ptrs), std::streamsize((x.n_cols+1)*sizeof(uword)) ); return f.good(); } template inline bool diskio::load_csv_ascii(SpMat& x, const std::string& name, std::string& err_msg, field& header, const bool with_header, const char separator) { arma_debug_sigprint(); std::ifstream f; (arma_config::text_as_binary) ? f.open(name, std::fstream::binary) : f.open(name); bool load_okay = f.is_open(); if(load_okay == false) { return false; } if(with_header) { arma_debug_print("diskio::load_csv_ascii(): reading header"); std::string header_line; std::stringstream header_stream; std::vector header_tokens; std::getline(f, header_line); load_okay = f.good(); if(load_okay) { std::string token; header_stream.clear(); header_stream.str(header_line); uword header_n_tokens = 0; while(header_stream.good()) { std::getline(header_stream, token, separator); diskio::sanitise_token(token); ++header_n_tokens; header_tokens.push_back(token); } if(header_n_tokens == uword(0)) { header.reset(); } else { header.set_size(1,header_n_tokens); for(uword i=0; i < header_n_tokens; ++i) { header.at(i) = header_tokens[i]; } } } } if(load_okay) { load_okay = diskio::load_csv_ascii(x, f, err_msg, separator); } f.close(); return load_okay; } template inline bool diskio::load_csv_ascii(SpMat& x, std::istream& f, std::string& err_msg, const char separator) { arma_debug_sigprint(); // TODO: replace with more efficient implementation if(f.good() == false) { return false; } f.clear(); const std::fstream::pos_type pos1 = f.tellg(); // // work out the size uword f_n_rows = 0; uword f_n_cols = 0; std::string line_string; std::stringstream line_stream; std::string token; while(f.good()) { std::getline(f, line_string); if(line_string.size() == 0) { break; } line_stream.clear(); line_stream.str(line_string); uword line_n_cols = 0; while(line_stream.good()) { std::getline(line_stream, token, separator); ++line_n_cols; } if(f_n_cols < line_n_cols) { f_n_cols = line_n_cols; } ++f_n_rows; } f.clear(); f.seekg(pos1); if(f.fail() || (f.tellg() != pos1)) { err_msg = "seek failure"; return false; } try { MapMat tmp(f_n_rows, f_n_cols); uword row = 0; while(f.good()) { std::getline(f, line_string); if(line_string.size() == 0) { break; } line_stream.clear(); line_stream.str(line_string); uword col = 0; while(line_stream.good()) { std::getline(line_stream, token, separator); eT val = eT(0); diskio::convert_token( val, token ); if(val != eT(0)) { tmp(row,col) = val; } ++col; } ++row; } x = tmp; } catch(...) { err_msg = "not enough memory"; return false; } return true; } template inline bool diskio::load_csv_ascii(SpMat< std::complex >& x, std::istream& f, std::string& err_msg, const char separator) { arma_debug_sigprint(); arma_ignore(x); arma_ignore(f); arma_ignore(err_msg); arma_ignore(separator); arma_warn(1, "loading complex sparse matrices as csv_ascii not yet implemented"); return false; } template inline bool diskio::load_coord_ascii(SpMat& x, const std::string& name, std::string& err_msg) { arma_debug_sigprint(); std::ifstream f; (arma_config::text_as_binary) ? f.open(name, std::fstream::binary) : f.open(name); bool load_okay = f.is_open(); if(load_okay) { load_okay = diskio::load_coord_ascii(x, f, err_msg); f.close(); } return load_okay; } template inline bool diskio::load_coord_ascii(SpMat& x, std::istream& f, std::string& err_msg) { arma_debug_sigprint(); if(f.good() == false) { return false; } f.clear(); const std::fstream::pos_type pos1 = f.tellg(); // work out the size uword f_n_rows = 0; uword f_n_cols = 0; bool size_found = false; std::string line_string; std::stringstream line_stream; std::string token; while(f.good()) { std::getline(f, line_string); if(line_string.size() == 0) { break; } line_stream.clear(); line_stream.str(line_string); uword line_row = 0; uword line_col = 0; // a valid line in co-ord format has at least 2 entries line_stream >> line_row; if(line_stream.good() == false) { err_msg = "incorrect format"; return false; } line_stream >> line_col; size_found = true; if(f_n_rows < line_row) { f_n_rows = line_row; } if(f_n_cols < line_col) { f_n_cols = line_col; } } // take into account that indices start at 0 if(size_found) { ++f_n_rows; ++f_n_cols; } f.clear(); f.seekg(pos1); if(f.fail() || (f.tellg() != pos1)) { err_msg = "seek failure"; return false; } try { MapMat tmp(f_n_rows, f_n_cols); while(f.good()) { std::getline(f, line_string); if(line_string.size() == 0) { break; } line_stream.clear(); line_stream.str(line_string); uword line_row = 0; uword line_col = 0; line_stream >> line_row; line_stream >> line_col; eT val = eT(0); line_stream >> token; if(line_stream.fail() == false) { diskio::convert_token( val, token ); } if(val != eT(0)) { tmp(line_row,line_col) = val; } } x = tmp; } catch(...) { err_msg = "not enough memory"; return false; } return true; } template inline bool diskio::load_coord_ascii(SpMat< std::complex >& x, std::istream& f, std::string& err_msg) { arma_debug_sigprint(); if(f.good() == false) { return false; } f.clear(); const std::fstream::pos_type pos1 = f.tellg(); // work out the size uword f_n_rows = 0; uword f_n_cols = 0; bool size_found = false; std::string line_string; std::stringstream line_stream; std::string token_real; std::string token_imag; while(f.good()) { std::getline(f, line_string); if(line_string.size() == 0) { break; } line_stream.clear(); line_stream.str(line_string); uword line_row = 0; uword line_col = 0; // a valid line in co-ord format has at least 2 entries line_stream >> line_row; if(line_stream.good() == false) { err_msg = "incorrect format"; return false; } line_stream >> line_col; size_found = true; if(f_n_rows < line_row) f_n_rows = line_row; if(f_n_cols < line_col) f_n_cols = line_col; } // take into account that indices start at 0 if(size_found) { ++f_n_rows; ++f_n_cols; } f.clear(); f.seekg(pos1); if(f.fail() || (f.tellg() != pos1)) { err_msg = "seek failure"; return false; } try { MapMat< std::complex > tmp(f_n_rows, f_n_cols); while(f.good()) { std::getline(f, line_string); if(line_string.size() == 0) { break; } line_stream.clear(); line_stream.str(line_string); uword line_row = 0; uword line_col = 0; line_stream >> line_row; line_stream >> line_col; T val_real = T(0); T val_imag = T(0); line_stream >> token_real; if(line_stream.fail() == false) { diskio::convert_token( val_real, token_real ); } line_stream >> token_imag; if(line_stream.fail() == false) { diskio::convert_token( val_imag, token_imag ); } if( (val_real != T(0)) || (val_imag != T(0)) ) { tmp(line_row,line_col) = std::complex(val_real, val_imag); } } x = tmp; } catch(...) { err_msg = "not enough memory"; return false; } return true; } //! Load a matrix in binary format, //! with a header that indicates the matrix type as well as its dimensions template inline bool diskio::load_arma_binary(SpMat& x, const std::string& name, std::string& err_msg) { arma_debug_sigprint(); std::ifstream f; f.open(name, std::fstream::binary); bool load_okay = f.is_open(); if(load_okay) { load_okay = diskio::load_arma_binary(x, f, err_msg); f.close(); } return load_okay; } template inline bool diskio::load_arma_binary(SpMat& x, std::istream& f, std::string& err_msg) { arma_debug_sigprint(); bool load_okay = true; std::string f_header; f >> f_header; if(f_header == diskio::gen_bin_header(x)) { uword f_n_rows; uword f_n_cols; uword f_n_nz; f >> f_n_rows; f >> f_n_cols; f >> f_n_nz; //f.seekg(1, ios::cur); // NOTE: this may not be portable, as on a Windows machine a newline could be two characters f.get(); try { x.reserve(f_n_rows, f_n_cols, f_n_nz); } catch(...) { err_msg = "not enough memory"; return false; } f.read( reinterpret_cast(access::rwp(x.values)), std::streamsize(x.n_nonzero*sizeof(eT)) ); std::streampos pos = f.tellg(); f.read( reinterpret_cast(access::rwp(x.row_indices)), std::streamsize(x.n_nonzero*sizeof(uword)) ); f.read( reinterpret_cast(access::rwp(x.col_ptrs)), std::streamsize((x.n_cols+1)*sizeof(uword)) ); bool check1 = true; for(uword i=0; i < x.n_nonzero; ++i) { if(x.values[i] == eT(0)) { check1 = false; break; } } bool check2 = true; for(uword i=0; i < x.n_cols; ++i) { if(x.col_ptrs[i+1] < x.col_ptrs[i]) { check2 = false; break; } } bool check3 = (x.col_ptrs[x.n_cols] == x.n_nonzero); if((check1 == true) && ((check2 == false) || (check3 == false))) { if(sizeof(uword) == 8) { arma_debug_print("detected inconsistent data while loading; re-reading integer parts as u32"); // inconsistency could be due to a different uword size used during saving, // so try loading the row_indices and col_ptrs under the assumption of 32 bit unsigned integers f.clear(); f.seekg(pos); podarray tmp_a(x.n_nonzero ); tmp_a.zeros(); podarray tmp_b(x.n_cols + 1); tmp_b.zeros(); f.read( reinterpret_cast(tmp_a.memptr()), std::streamsize( x.n_nonzero * sizeof(u32)) ); f.read( reinterpret_cast(tmp_b.memptr()), std::streamsize((x.n_cols + 1) * sizeof(u32)) ); check2 = true; for(uword i=0; i < x.n_cols; ++i) { if(tmp_b[i+1] < tmp_b[i]) { check2 = false; break; } } check3 = (tmp_b[x.n_cols] == x.n_nonzero); load_okay = f.good(); if( load_okay && (check2 == true) && (check3 == true) ) { arma_debug_print("reading integer parts as u32 succeeded"); arrayops::convert(access::rwp(x.row_indices), tmp_a.memptr(), x.n_nonzero ); arrayops::convert(access::rwp(x.col_ptrs), tmp_b.memptr(), x.n_cols + 1); } else { arma_debug_print("reading integer parts as u32 failed"); } } } if((check1 == false) || (check2 == false) || (check3 == false)) { load_okay = false; err_msg = "inconsistent data"; } else { load_okay = f.good(); } } else { load_okay = false; err_msg = "incorrect header"; } return load_okay; } // cubes //! Save a cube as raw text (no header, human readable). template inline bool diskio::save_raw_ascii(const Cube& x, const std::string& final_name) { arma_debug_sigprint(); const std::string tmp_name = diskio::gen_tmp_name(final_name); std::ofstream f; (arma_config::text_as_binary) ? f.open(tmp_name, std::fstream::binary) : f.open(tmp_name); bool save_okay = f.is_open(); if(save_okay) { save_okay = save_raw_ascii(x, f); f.flush(); f.close(); if(save_okay) { save_okay = diskio::safe_rename(tmp_name, final_name); } } return save_okay; } //! Save a cube as raw text (no header, human readable). template inline bool diskio::save_raw_ascii(const Cube& x, std::ostream& f) { arma_debug_sigprint(); const arma_ostream_state stream_state(f); const std::streamsize cell_width = diskio::prepare_stream(f); for(uword slice=0; slice < x.n_slices; ++slice) { for(uword row=0; row < x.n_rows; ++row) { for(uword col=0; col < x.n_cols; ++col) { f.put(' '); if(is_real::value) { f.width(cell_width); } arma_ostream::raw_print_elem(f, x.at(row,col,slice)); } f.put('\n'); } } const bool save_okay = f.good(); stream_state.restore(f); return save_okay; } //! Save a cube as raw binary (no header) template inline bool diskio::save_raw_binary(const Cube& x, const std::string& final_name) { arma_debug_sigprint(); const std::string tmp_name = diskio::gen_tmp_name(final_name); std::ofstream f(tmp_name, std::fstream::binary); bool save_okay = f.is_open(); if(save_okay) { save_okay = diskio::save_raw_binary(x, f); f.flush(); f.close(); if(save_okay) { save_okay = diskio::safe_rename(tmp_name, final_name); } } return save_okay; } template inline bool diskio::save_raw_binary(const Cube& x, std::ostream& f) { arma_debug_sigprint(); f.write( reinterpret_cast(x.mem), std::streamsize(x.n_elem*sizeof(eT)) ); return f.good(); } //! Save a cube in text format (human readable), //! with a header that indicates the cube type as well as its dimensions template inline bool diskio::save_arma_ascii(const Cube& x, const std::string& final_name) { arma_debug_sigprint(); const std::string tmp_name = diskio::gen_tmp_name(final_name); std::ofstream f; (arma_config::text_as_binary) ? f.open(tmp_name, std::fstream::binary) : f.open(tmp_name); bool save_okay = f.is_open(); if(save_okay) { save_okay = diskio::save_arma_ascii(x, f); f.flush(); f.close(); if(save_okay) { save_okay = diskio::safe_rename(tmp_name, final_name); } } return save_okay; } //! Save a cube in text format (human readable), //! with a header that indicates the cube type as well as its dimensions template inline bool diskio::save_arma_ascii(const Cube& x, std::ostream& f) { arma_debug_sigprint(); const arma_ostream_state stream_state(f); f << diskio::gen_txt_header(x) << '\n'; f << x.n_rows << ' ' << x.n_cols << ' ' << x.n_slices << '\n'; const std::streamsize cell_width = diskio::prepare_stream(f); for(uword slice=0; slice < x.n_slices; ++slice) { for(uword row=0; row < x.n_rows; ++row) { for(uword col=0; col < x.n_cols; ++col) { f.put(' '); if(is_real::value) { f.width(cell_width); } arma_ostream::raw_print_elem(f, x.at(row,col,slice)); } f.put('\n'); } } const bool save_okay = f.good(); stream_state.restore(f); return save_okay; } //! Save a cube in binary format, //! with a header that stores the cube type as well as its dimensions template inline bool diskio::save_arma_binary(const Cube& x, const std::string& final_name) { arma_debug_sigprint(); const std::string tmp_name = diskio::gen_tmp_name(final_name); std::ofstream f(tmp_name, std::fstream::binary); bool save_okay = f.is_open(); if(save_okay) { save_okay = diskio::save_arma_binary(x, f); f.flush(); f.close(); if(save_okay) { save_okay = diskio::safe_rename(tmp_name, final_name); } } return save_okay; } //! Save a cube in binary format, //! with a header that stores the cube type as well as its dimensions template inline bool diskio::save_arma_binary(const Cube& x, std::ostream& f) { arma_debug_sigprint(); f << diskio::gen_bin_header(x) << '\n'; f << x.n_rows << ' ' << x.n_cols << ' ' << x.n_slices << '\n'; f.write( reinterpret_cast(x.mem), std::streamsize(x.n_elem*sizeof(eT)) ); return f.good(); } //! Save a cube as part of a HDF5 file template inline bool diskio::save_hdf5_binary(const Cube& x, const hdf5_name& spec, std::string& err_msg) { arma_debug_sigprint(); #if defined(ARMA_USE_HDF5) { hdf5_misc::hdf5_suspend_printing_errors hdf5_print_suspender; bool save_okay = false; const bool append = bool(spec.opts.flags & hdf5_opts::flag_append); const bool replace = bool(spec.opts.flags & hdf5_opts::flag_replace); const bool use_existing_file = ((append || replace) && (H5Fis_hdf5(spec.filename.c_str()) > 0)); const std::string tmp_name = (use_existing_file) ? std::string() : diskio::gen_tmp_name(spec.filename); // Set up the file according to HDF5's preferences hid_t file = (use_existing_file) ? H5Fopen(spec.filename.c_str(), H5F_ACC_RDWR, H5P_DEFAULT) : H5Fcreate(tmp_name.c_str(), H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if(file < 0) { return false; } // We need to create a dataset, datatype, and dataspace hsize_t dims[3]; dims[2] = x.n_rows; dims[1] = x.n_cols; dims[0] = x.n_slices; hid_t dataspace = H5Screate_simple(3, dims, NULL); // treat the cube as a 3d array dataspace hid_t datatype = hdf5_misc::get_hdf5_type(); // fail if we can't handle the datatype if(datatype == -1) { err_msg = "unknown datatype for HDF5"; return false; } // MATLAB forces the users to specify a name at save time for HDF5; // Octave will use the default of 'dataset' unless otherwise specified. // If the user hasn't specified a dataset name, we will use 'dataset' // We may have to split out the group name from the dataset name. std::vector groups; std::string full_name = spec.dsname; size_t loc; while((loc = full_name.find("/")) != std::string::npos) { // Create another group... if(loc != 0) // Ignore the first /, if there is a leading /. { hid_t gid = H5Gcreate((groups.size() == 0) ? file : groups[groups.size() - 1], full_name.substr(0, loc).c_str(), H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if((gid < 0) && use_existing_file) { gid = H5Gopen((groups.size() == 0) ? file : groups[groups.size() - 1], full_name.substr(0, loc).c_str(), H5P_DEFAULT); } groups.push_back(gid); } full_name = full_name.substr(loc + 1); } const std::string dataset_name = full_name.empty() ? std::string("dataset") : full_name; const hid_t last_group = (groups.size() == 0) ? file : groups[groups.size() - 1]; if(use_existing_file && replace) { H5Ldelete(last_group, dataset_name.c_str(), H5P_DEFAULT); // NOTE: H5Ldelete() in HDF5 v1.8 doesn't reclaim the deleted space; use h5repack to reclaim space: h5repack oldfile.h5 newfile.h5 // NOTE: has this behaviour changed in HDF5 1.10 ? // NOTE: https://lists.hdfgroup.org/pipermail/hdf-forum_lists.hdfgroup.org/2017-August/010482.html // NOTE: https://lists.hdfgroup.org/pipermail/hdf-forum_lists.hdfgroup.org/2017-August/010486.html } hid_t dataset = H5Dcreate(last_group, dataset_name.c_str(), datatype, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if(dataset < 0) { save_okay = false; err_msg = "failed to create dataset"; } else { save_okay = (H5Dwrite(dataset, datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, x.mem) >= 0); H5Dclose(dataset); } H5Tclose(datatype); H5Sclose(dataspace); for(size_t i = 0; i < groups.size(); ++i) { H5Gclose(groups[i]); } H5Fclose(file); if((use_existing_file == false) && (save_okay == true)) { save_okay = diskio::safe_rename(tmp_name, spec.filename); } return save_okay; } #else { arma_ignore(x); arma_ignore(spec); arma_ignore(err_msg); arma_stop_logic_error("Cube::save(): use of HDF5 must be enabled"); return false; } #endif } //! Load a cube as raw text (no header, human readable). //! NOTE: this is much slower than reading a file with a header. template inline bool diskio::load_raw_ascii(Cube& x, const std::string& name, std::string& err_msg) { arma_debug_sigprint(); Mat tmp; const bool load_okay = diskio::load_raw_ascii(tmp, name, err_msg); if(load_okay) { if(tmp.is_empty() == false) { try { x.set_size(tmp.n_rows, tmp.n_cols, 1); } catch(...) { err_msg = "not enough memory"; return false; } x.slice(0) = tmp; } else { x.reset(); } } return load_okay; } //! Load a cube as raw text (no header, human readable). //! NOTE: this is much slower than reading a file with a header. template inline bool diskio::load_raw_ascii(Cube& x, std::istream& f, std::string& err_msg) { arma_debug_sigprint(); Mat tmp; const bool load_okay = diskio::load_raw_ascii(tmp, f, err_msg); if(load_okay) { if(tmp.is_empty() == false) { try { x.set_size(tmp.n_rows, tmp.n_cols, 1); } catch(...) { err_msg = "not enough memory"; return false; } x.slice(0) = tmp; } else { x.reset(); } } return load_okay; } //! Load a cube in binary format (no header); //! the cube is assumed to have one slice with one column template inline bool diskio::load_raw_binary(Cube& x, const std::string& name, std::string& err_msg) { arma_debug_sigprint(); std::ifstream f; f.open(name, std::fstream::binary); bool load_okay = f.is_open(); if(load_okay) { load_okay = diskio::load_raw_binary(x, f, err_msg); f.close(); } return load_okay; } template inline bool diskio::load_raw_binary(Cube& x, std::istream& f, std::string& err_msg) { arma_debug_sigprint(); f.clear(); const std::streampos pos1 = f.tellg(); f.clear(); f.seekg(0, ios::end); f.clear(); const std::streampos pos2 = f.tellg(); const uword N = ( (pos1 >= 0) && (pos2 >= 0) ) ? uword(pos2 - pos1) : 0; f.clear(); //f.seekg(0, ios::beg); f.seekg(pos1); try { x.set_size(N / uword(sizeof(eT)), 1, 1); } catch(...) { err_msg = "not enough memory"; return false; } f.clear(); f.read( reinterpret_cast(x.memptr()), std::streamsize(x.n_elem * uword(sizeof(eT))) ); return f.good(); } //! Load a cube in text format (human readable), //! with a header that indicates the cube type as well as its dimensions template inline bool diskio::load_arma_ascii(Cube& x, const std::string& name, std::string& err_msg) { arma_debug_sigprint(); std::ifstream f; (arma_config::text_as_binary) ? f.open(name, std::fstream::binary) : f.open(name); bool load_okay = f.is_open(); if(load_okay) { load_okay = diskio::load_arma_ascii(x, f, err_msg); f.close(); } return load_okay; } //! Load a cube in text format (human readable), //! with a header that indicates the cube type as well as its dimensions template inline bool diskio::load_arma_ascii(Cube& x, std::istream& f, std::string& err_msg) { arma_debug_sigprint(); std::streampos pos = f.tellg(); bool load_okay = true; std::string f_header; uword f_n_rows; uword f_n_cols; uword f_n_slices; f >> f_header; f >> f_n_rows; f >> f_n_cols; f >> f_n_slices; if(f_header == diskio::gen_txt_header(x)) { try { x.set_size(f_n_rows, f_n_cols, f_n_slices); } catch(...) { err_msg = "not enough memory"; return false; } for(uword slice = 0; slice < x.n_slices; ++slice) for(uword row = 0; row < x.n_rows; ++row ) for(uword col = 0; col < x.n_cols; ++col ) { f >> x.at(row,col,slice); } load_okay = f.good(); } else { load_okay = false; err_msg = "incorrect header"; } // allow automatic conversion of u32/s32 cubes into u64/s64 cubes if(load_okay == false) { if( (sizeof(eT) == 8) && is_same_type::yes ) { Cube tmp; std::string junk; f.clear(); f.seekg(pos); load_okay = diskio::load_arma_ascii(tmp, f, junk); if(load_okay) { x = conv_to< Cube >::from(tmp); } } else if( (sizeof(eT) == 8) && is_same_type::yes ) { Cube tmp; std::string junk; f.clear(); f.seekg(pos); load_okay = diskio::load_arma_ascii(tmp, f, junk); if(load_okay) { x = conv_to< Cube >::from(tmp); } } } return load_okay; } //! Load a cube in binary format, //! with a header that indicates the cube type as well as its dimensions template inline bool diskio::load_arma_binary(Cube& x, const std::string& name, std::string& err_msg) { arma_debug_sigprint(); std::ifstream f; f.open(name, std::fstream::binary); bool load_okay = f.is_open(); if(load_okay) { load_okay = diskio::load_arma_binary(x, f, err_msg); f.close(); } return load_okay; } template inline bool diskio::load_arma_binary(Cube& x, std::istream& f, std::string& err_msg) { arma_debug_sigprint(); std::streampos pos = f.tellg(); bool load_okay = true; std::string f_header; uword f_n_rows; uword f_n_cols; uword f_n_slices; f >> f_header; f >> f_n_rows; f >> f_n_cols; f >> f_n_slices; if(f_header == diskio::gen_bin_header(x)) { //f.seekg(1, ios::cur); // NOTE: this may not be portable, as on a Windows machine a newline could be two characters f.get(); try { x.set_size(f_n_rows, f_n_cols, f_n_slices); } catch(...) { err_msg = "not enough memory"; return false; } f.read( reinterpret_cast(x.memptr()), std::streamsize(x.n_elem*sizeof(eT)) ); load_okay = f.good(); } else { load_okay = false; err_msg = "incorrect header"; } // allow automatic conversion of u32/s32 cubes into u64/s64 cubes if(load_okay == false) { if( (sizeof(eT) == 8) && is_same_type::yes ) { Cube tmp; std::string junk; f.clear(); f.seekg(pos); load_okay = diskio::load_arma_binary(tmp, f, junk); if(load_okay) { x = conv_to< Cube >::from(tmp); } } else if( (sizeof(eT) == 8) && is_same_type::yes ) { Cube tmp; std::string junk; f.clear(); f.seekg(pos); load_okay = diskio::load_arma_binary(tmp, f, junk); if(load_okay) { x = conv_to< Cube >::from(tmp); } } } return load_okay; } //! Load a HDF5 file as a cube template inline bool diskio::load_hdf5_binary(Cube& x, const hdf5_name& spec, std::string& err_msg) { arma_debug_sigprint(); #if defined(ARMA_USE_HDF5) { if(diskio::is_readable(spec.filename) == false) { return false; } hdf5_misc::hdf5_suspend_printing_errors hdf5_print_suspender; bool load_okay = false; hid_t fid = H5Fopen(spec.filename.c_str(), H5F_ACC_RDONLY, H5P_DEFAULT); if(fid >= 0) { // MATLAB HDF5 dataset names are user-specified; // Octave tends to store the datasets in a group, with the actual dataset being referred to as "value". // If the user hasn't specified a dataset, we will search for "dataset" and "value", // and if those are not found we will take the first dataset we do find. std::vector searchNames; const bool exact = (spec.dsname.empty() == false); if(exact) { searchNames.push_back(spec.dsname); } else { searchNames.push_back("dataset"); searchNames.push_back("value" ); } hid_t dataset = hdf5_misc::search_hdf5_file(searchNames, fid, 3, exact); if(dataset >= 0) { hid_t filespace = H5Dget_space(dataset); // This must be <= 3 due to our search rules. const int ndims = H5Sget_simple_extent_ndims(filespace); hsize_t dims[3]; const herr_t query_status = H5Sget_simple_extent_dims(filespace, dims, NULL); // arma_check(query_status < 0, "Cube::load(): cannot get size of HDF5 dataset"); if(query_status < 0) { err_msg = "cannot get size of HDF5 dataset"; H5Sclose(filespace); H5Dclose(dataset); H5Fclose(fid); return false; } if(ndims == 1) { dims[1] = 1; dims[2] = 1; } // Vector case; one row/column, several slices if(ndims == 2) { dims[2] = 1; } // Matrix case; one column, several rows/slices try { x.set_size(dims[2], dims[1], dims[0]); } catch(...) { err_msg = "not enough memory"; return false; } // Now we have to see what type is stored to figure out how to load it. hid_t datatype = H5Dget_type(dataset); hid_t mat_type = hdf5_misc::get_hdf5_type(); // If these are the same type, it is simple. if(H5Tequal(datatype, mat_type) > 0) { // Load directly; H5S_ALL used so that we load the entire dataset. hid_t read_status = H5Dread(dataset, datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, void_ptr(x.memptr())); if(read_status >= 0) { load_okay = true; } } else { // Load into another array and convert its type accordingly. hid_t read_status = hdf5_misc::load_and_convert_hdf5(x.memptr(), dataset, datatype, x.n_elem); if(read_status >= 0) { load_okay = true; } } // Now clean up. H5Tclose(datatype); H5Tclose(mat_type); H5Sclose(filespace); } H5Dclose(dataset); H5Fclose(fid); if(load_okay == false) { err_msg = "unsupported or missing HDF5 data"; } } else { err_msg = "cannot open"; } return load_okay; } #else { arma_ignore(x); arma_ignore(spec); arma_ignore(err_msg); arma_stop_logic_error("Cube::load(): use of HDF5 must be enabled"); return false; } #endif } //! Try to load a cube by automatically determining its type template inline bool diskio::load_auto_detect(Cube& x, const std::string& name, std::string& err_msg) { arma_debug_sigprint(); if(diskio::is_readable(name) == false) { return false; } #if defined(ARMA_USE_HDF5) // We're currently using the C bindings for the HDF5 library, which don't support C++ streams if( H5Fis_hdf5(name.c_str()) ) { return load_hdf5_binary(x, name, err_msg); } #endif std::fstream f; f.open(name, std::fstream::in | std::fstream::binary); bool load_okay = f.is_open(); if(load_okay) { load_okay = diskio::load_auto_detect(x, f, err_msg); f.close(); } return load_okay; } //! Try to load a cube by automatically determining its type template inline bool diskio::load_auto_detect(Cube& x, std::istream& f, std::string& err_msg) { arma_debug_sigprint(); const char* ARMA_CUB_TXT_str = "ARMA_CUB_TXT"; const char* ARMA_CUB_BIN_str = "ARMA_CUB_BIN"; const char* P6_str = "P6"; const uword ARMA_CUB_TXT_len = uword(12); const uword ARMA_CUB_BIN_len = uword(12); const uword P6_len = uword(2); podarray header(ARMA_CUB_TXT_len + 1); char* header_mem = header.memptr(); std::streampos pos = f.tellg(); f.read( header_mem, std::streamsize(ARMA_CUB_TXT_len) ); f.clear(); f.seekg(pos); header_mem[ARMA_CUB_TXT_len] = '\0'; if( std::strncmp(ARMA_CUB_TXT_str, header_mem, size_t(ARMA_CUB_TXT_len)) == 0 ) { return load_arma_ascii(x, f, err_msg); } else if( std::strncmp(ARMA_CUB_BIN_str, header_mem, size_t(ARMA_CUB_BIN_len)) == 0 ) { return load_arma_binary(x, f, err_msg); } else if( std::strncmp(P6_str, header_mem, size_t(P6_len)) == 0 ) { return load_ppm_binary(x, f, err_msg); } else { const file_type ft = guess_file_type_internal(f); switch(ft) { // case csv_ascii: // return load_csv_ascii(x, f, err_msg); // break; case raw_binary: return load_raw_binary(x, f, err_msg); break; case raw_ascii: return load_raw_ascii(x, f, err_msg); break; default: err_msg = "unknown data"; return false; } } return false; } // fields template inline bool diskio::save_arma_binary(const field& x, const std::string& final_name) { arma_debug_sigprint(); const std::string tmp_name = diskio::gen_tmp_name(final_name); std::ofstream f( tmp_name, std::fstream::binary ); bool save_okay = f.is_open(); if(save_okay) { save_okay = diskio::save_arma_binary(x, f); f.flush(); f.close(); if(save_okay) { save_okay = diskio::safe_rename(tmp_name, final_name); } } return save_okay; } template inline bool diskio::save_arma_binary(const field& x, std::ostream& f) { arma_debug_sigprint(); arma_type_check(( (is_Mat::value == false) && (is_Cube::value == false) )); if(x.n_slices <= 1) { f << "ARMA_FLD_BIN" << '\n'; f << x.n_rows << '\n'; f << x.n_cols << '\n'; } else { f << "ARMA_FL3_BIN" << '\n'; f << x.n_rows << '\n'; f << x.n_cols << '\n'; f << x.n_slices << '\n'; } bool save_okay = true; for(uword i=0; i inline bool diskio::load_arma_binary(field& x, const std::string& name, std::string& err_msg) { arma_debug_sigprint(); std::ifstream f( name, std::fstream::binary ); bool load_okay = f.is_open(); if(load_okay) { load_okay = diskio::load_arma_binary(x, f, err_msg); f.close(); } return load_okay; } template inline bool diskio::load_arma_binary(field& x, std::istream& f, std::string& err_msg) { arma_debug_sigprint(); arma_type_check(( (is_Mat::value == false) && (is_Cube::value == false) )); bool load_okay = true; std::string f_type; f >> f_type; if(f_type == "ARMA_FLD_BIN") { uword f_n_rows; uword f_n_cols; f >> f_n_rows; f >> f_n_cols; try { x.set_size(f_n_rows, f_n_cols); } catch(...) { err_msg = "not enough memory"; return false; } f.get(); for(uword i=0; i> f_n_rows; f >> f_n_cols; f >> f_n_slices; try { x.set_size(f_n_rows, f_n_cols, f_n_slices); } catch(...) { err_msg = "not enough memory"; return false; } f.get(); for(uword i=0; i& x, const std::string& final_name) { arma_debug_sigprint(); const std::string tmp_name = diskio::gen_tmp_name(final_name); std::ofstream f( tmp_name, std::fstream::binary ); bool save_okay = f.is_open(); if(save_okay) { save_okay = diskio::save_std_string(x, f); f.flush(); f.close(); if(save_okay) { save_okay = diskio::safe_rename(tmp_name, final_name); } } return save_okay; } inline bool diskio::save_std_string(const field& x, std::ostream& f) { arma_debug_sigprint(); for(uword row=0; row& x, const std::string& name, std::string& err_msg) { arma_debug_sigprint(); std::ifstream f(name); bool load_okay = f.is_open(); if(load_okay) { load_okay = diskio::load_std_string(x, f, err_msg); f.close(); } return load_okay; } inline bool diskio::load_std_string(field& x, std::istream& f, std::string& err_msg) { arma_debug_sigprint(); bool load_okay = true; // // work out the size uword f_n_rows = 0; uword f_n_cols = 0; bool f_n_cols_found = false; std::string line_string; std::string token; while( f.good() && load_okay ) { std::getline(f, line_string); if(line_string.size() == 0) { break; } std::stringstream line_stream(line_string); uword line_n_cols = 0; while(line_stream >> token) { line_n_cols++; } if(f_n_cols_found == false) { f_n_cols = line_n_cols; f_n_cols_found = true; } else { if(line_n_cols != f_n_cols) { load_okay = false; err_msg = "inconsistent number of columns"; } } ++f_n_rows; } if(load_okay) { f.clear(); f.seekg(0, ios::beg); //f.seekg(start); try { x.set_size(f_n_rows, f_n_cols); } catch(...) { err_msg = "not enough memory"; return false; } for(uword row=0; row < x.n_rows; ++row) for(uword col=0; col < x.n_cols; ++col) { f >> x.at(row,col); } } if(f.good() == false) { load_okay = false; } return load_okay; } //! Try to load a field by automatically determining its type template inline bool diskio::load_auto_detect(field& x, const std::string& name, std::string& err_msg) { arma_debug_sigprint(); std::fstream f; f.open(name, std::fstream::in | std::fstream::binary); bool load_okay = f.is_open(); if(load_okay) { load_okay = diskio::load_auto_detect(x, f, err_msg); f.close(); } return load_okay; } //! Try to load a field by automatically determining its type template inline bool diskio::load_auto_detect(field& x, std::istream& f, std::string& err_msg) { arma_debug_sigprint(); arma_type_check(( is_Mat::value == false )); static const std::string ARMA_FLD_BIN = "ARMA_FLD_BIN"; static const std::string ARMA_FL3_BIN = "ARMA_FL3_BIN"; static const std::string P6 = "P6"; podarray raw_header(uword(ARMA_FLD_BIN.length()) + 1); std::streampos pos = f.tellg(); f.read( raw_header.memptr(), std::streamsize(ARMA_FLD_BIN.length()) ); f.clear(); f.seekg(pos); raw_header[uword(ARMA_FLD_BIN.length())] = '\0'; const std::string header = raw_header.mem; if(ARMA_FLD_BIN == header.substr(0, ARMA_FLD_BIN.length())) { return load_arma_binary(x, f, err_msg); } else if(ARMA_FL3_BIN == header.substr(0, ARMA_FL3_BIN.length())) { return load_arma_binary(x, f, err_msg); } else if(P6 == header.substr(0, P6.length())) { return load_ppm_binary(x, f, err_msg); } else { err_msg = "unsupported header"; return false; } } // // handling of PPM images by cubes template inline bool diskio::load_ppm_binary(Cube& x, const std::string& name, std::string& err_msg) { arma_debug_sigprint(); std::fstream f; f.open(name, std::fstream::in | std::fstream::binary); bool load_okay = f.is_open(); if(load_okay) { load_okay = diskio::load_ppm_binary(x, f, err_msg); f.close(); } return load_okay; } template inline bool diskio::load_ppm_binary(Cube& x, std::istream& f, std::string& err_msg) { arma_debug_sigprint(); bool load_okay = true; std::string f_header; f >> f_header; if(f_header == "P6") { uword f_n_rows = 0; uword f_n_cols = 0; int f_maxval = 0; diskio::pnm_skip_comments(f); f >> f_n_cols; diskio::pnm_skip_comments(f); f >> f_n_rows; diskio::pnm_skip_comments(f); f >> f_maxval; f.get(); if( (f_maxval > 0) && (f_maxval <= 65535) ) { try { x.set_size(f_n_rows, f_n_cols, 3); } catch(...) { err_msg = "not enough memory"; return false; } if(f_maxval <= 255) { const uword n_elem = 3*f_n_cols*f_n_rows; podarray tmp(n_elem); f.read( reinterpret_cast(tmp.memptr()), std::streamsize(n_elem) ); uword i = 0; //cout << "f_n_cols = " << f_n_cols << endl; //cout << "f_n_rows = " << f_n_rows << endl; for(uword row=0; row < f_n_rows; ++row) for(uword col=0; col < f_n_cols; ++col) { x.at(row,col,0) = eT(tmp[i+0]); x.at(row,col,1) = eT(tmp[i+1]); x.at(row,col,2) = eT(tmp[i+2]); i+=3; } } else { const uword n_elem = 3*f_n_cols*f_n_rows; podarray tmp(n_elem); f.read( reinterpret_cast(tmp.memptr()), std::streamsize(2*n_elem) ); uword i = 0; for(uword row=0; row < f_n_rows; ++row) for(uword col=0; col < f_n_cols; ++col) { x.at(row,col,0) = eT(tmp[i+0]); x.at(row,col,1) = eT(tmp[i+1]); x.at(row,col,2) = eT(tmp[i+2]); i+=3; } } } else { load_okay = false; err_msg = "functionality unimplemented"; } if(f.good() == false) { load_okay = false; } } else { load_okay = false; err_msg = "unsupported header"; } return load_okay; } template inline bool diskio::save_ppm_binary(const Cube& x, const std::string& final_name) { arma_debug_sigprint(); const std::string tmp_name = diskio::gen_tmp_name(final_name); std::ofstream f( tmp_name, std::fstream::binary ); bool save_okay = f.is_open(); if(save_okay) { save_okay = diskio::save_ppm_binary(x, f); f.flush(); f.close(); if(save_okay) { save_okay = diskio::safe_rename(tmp_name, final_name); } } return save_okay; } template inline bool diskio::save_ppm_binary(const Cube& x, std::ostream& f) { arma_debug_sigprint(); arma_conform_check( (x.n_slices != 3), "diskio::save_ppm_binary(): given cube must have exactly 3 slices" ); const uword n_elem = 3 * x.n_rows * x.n_cols; podarray tmp(n_elem); uword i = 0; for(uword row=0; row < x.n_rows; ++row) { for(uword col=0; col < x.n_cols; ++col) { tmp[i+0] = u8( access::tmp_real( x.at(row,col,0) ) ); tmp[i+1] = u8( access::tmp_real( x.at(row,col,1) ) ); tmp[i+2] = u8( access::tmp_real( x.at(row,col,2) ) ); i+=3; } } f << "P6" << '\n'; f << x.n_cols << '\n'; f << x.n_rows << '\n'; f << 255 << '\n'; f.write( reinterpret_cast(tmp.mem), std::streamsize(n_elem) ); return f.good(); } // // handling of PPM images by fields template inline bool diskio::load_ppm_binary(field& x, const std::string& name, std::string& err_msg) { arma_debug_sigprint(); std::fstream f; f.open(name, std::fstream::in | std::fstream::binary); bool load_okay = f.is_open(); if(load_okay) { load_okay = diskio::load_ppm_binary(x, f, err_msg); f.close(); } return load_okay; } template inline bool diskio::load_ppm_binary(field& x, std::istream& f, std::string& err_msg) { arma_debug_sigprint(); arma_type_check(( is_Mat::value == false )); typedef typename T1::elem_type eT; bool load_okay = true; std::string f_header; f >> f_header; if(f_header == "P6") { uword f_n_rows = 0; uword f_n_cols = 0; int f_maxval = 0; diskio::pnm_skip_comments(f); f >> f_n_cols; diskio::pnm_skip_comments(f); f >> f_n_rows; diskio::pnm_skip_comments(f); f >> f_maxval; f.get(); if( (f_maxval > 0) && (f_maxval <= 65535) ) { x.set_size(3); Mat& R = x(0); Mat& G = x(1); Mat& B = x(2); try { R.set_size(f_n_rows,f_n_cols); } catch(...) { err_msg = "not enough memory"; return false; } try { G.set_size(f_n_rows,f_n_cols); } catch(...) { err_msg = "not enough memory"; return false; } try { B.set_size(f_n_rows,f_n_cols); } catch(...) { err_msg = "not enough memory"; return false; } if(f_maxval <= 255) { const uword n_elem = 3*f_n_cols*f_n_rows; podarray tmp(n_elem); f.read( reinterpret_cast(tmp.memptr()), std::streamsize(n_elem) ); uword i = 0; //cout << "f_n_cols = " << f_n_cols << endl; //cout << "f_n_rows = " << f_n_rows << endl; for(uword row=0; row < f_n_rows; ++row) { for(uword col=0; col < f_n_cols; ++col) { R.at(row,col) = eT(tmp[i+0]); G.at(row,col) = eT(tmp[i+1]); B.at(row,col) = eT(tmp[i+2]); i+=3; } } } else { const uword n_elem = 3*f_n_cols*f_n_rows; podarray tmp(n_elem); f.read( reinterpret_cast(tmp.memptr()), std::streamsize(2*n_elem) ); uword i = 0; for(uword row=0; row < f_n_rows; ++row) for(uword col=0; col < f_n_cols; ++col) { R.at(row,col) = eT(tmp[i+0]); G.at(row,col) = eT(tmp[i+1]); B.at(row,col) = eT(tmp[i+2]); i+=3; } } } else { load_okay = false; err_msg = "functionality unimplemented"; } if(f.good() == false) { load_okay = false; } } else { load_okay = false; err_msg = "unsupported header"; } return load_okay; } template inline bool diskio::save_ppm_binary(const field& x, const std::string& final_name) { arma_debug_sigprint(); const std::string tmp_name = diskio::gen_tmp_name(final_name); std::ofstream f( tmp_name, std::fstream::binary ); bool save_okay = f.is_open(); if(save_okay) { save_okay = diskio::save_ppm_binary(x, f); f.flush(); f.close(); if(save_okay) { save_okay = diskio::safe_rename(tmp_name, final_name); } } return save_okay; } template inline bool diskio::save_ppm_binary(const field& x, std::ostream& f) { arma_debug_sigprint(); arma_type_check(( is_Mat::value == false )); typedef typename T1::elem_type eT; arma_conform_check( (x.n_elem != 3), "diskio::save_ppm_binary(): given field must have exactly 3 matrices of equal size" ); bool same_size = true; for(uword i=1; i<3; ++i) { if( (x(0).n_rows != x(i).n_rows) || (x(0).n_cols != x(i).n_cols) ) { same_size = false; break; } } arma_conform_check( (same_size != true), "diskio::save_ppm_binary(): given field must have exactly 3 matrices of equal size" ); const Mat& R = x(0); const Mat& G = x(1); const Mat& B = x(2); f << "P6" << '\n'; f << R.n_cols << '\n'; f << R.n_rows << '\n'; f << 255 << '\n'; const uword n_elem = 3 * R.n_rows * R.n_cols; podarray tmp(n_elem); uword i = 0; for(uword row=0; row < R.n_rows; ++row) for(uword col=0; col < R.n_cols; ++col) { tmp[i+0] = u8( access::tmp_real( R.at(row,col) ) ); tmp[i+1] = u8( access::tmp_real( G.at(row,col) ) ); tmp[i+2] = u8( access::tmp_real( B.at(row,col) ) ); i+=3; } f.write( reinterpret_cast(tmp.mem), std::streamsize(n_elem) ); return f.good(); } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_find_unique.hpp0000644000176200001440000000311414631567470024106 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_find_unique //! @{ template arma_warn_unused inline typename enable_if2 < is_arma_type::value, const mtOp >::result find_unique ( const T1& X, const bool ascending_indices = true ) { arma_debug_sigprint(); return mtOp(X, ((ascending_indices) ? uword(1) : uword(0)), uword(0)); } template arma_warn_unused inline uvec find_unique ( const BaseCube& X, const bool ascending_indices = true ) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const unwrap_cube tmp(X.get_ref()); const Mat R( const_cast< eT* >(tmp.M.memptr()), tmp.M.n_elem, 1, false ); return find_unique(R,ascending_indices); } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_median.hpp0000644000176200001440000000327314631567470023043 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_median //! @{ template arma_warn_unused inline typename enable_if2< is_arma_type::value && resolves_to_vector::yes, typename T1::elem_type >::result median(const T1& X) { arma_debug_sigprint(); return op_median::median_vec(X); } template arma_warn_unused arma_inline typename enable_if2< is_arma_type::value && resolves_to_vector::no, const Op >::result median(const T1& X) { arma_debug_sigprint(); return Op(X, 0, 0); } template arma_warn_unused arma_inline typename enable_if2< is_arma_type::value, const Op >::result median(const T1& X, const uword dim) { arma_debug_sigprint(); return Op(X, dim, 0); } template arma_warn_unused arma_inline typename arma_scalar_only::result median(const T& x) { return x; } //! @} RcppArmadillo/inst/include/armadillo_bits/spglue_times_bones.hpp0000644000176200001440000000366014456557177025021 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup spglue_times //! @{ class spglue_times { public: template struct traits { static constexpr bool is_row = T1::is_row; static constexpr bool is_col = T2::is_col; static constexpr bool is_xvec = false; }; template inline static void apply(SpMat& out, const SpGlue& X); template inline static void apply(SpMat& out, const SpGlue,T2,spglue_times>& X); template inline static void apply_noalias(SpMat& c, const SpMat& x, const SpMat& y); }; class spglue_times_mixed { public: template struct traits { static constexpr bool is_row = T1::is_row; static constexpr bool is_col = T2::is_col; static constexpr bool is_xvec = false; }; template inline static void apply(SpMat::eT>& out, const mtSpGlue::eT, T1, T2, spglue_times_mixed>& expr); }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_min_bones.hpp0000644000176200001440000000767214301267043023564 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_min //! @{ class op_min : public traits_op_xvec { public: // // dense matrices template inline static void apply(Mat& out, const Op& in); template inline static void apply_noalias(Mat& out, const Mat& X, const uword dim, const typename arma_not_cx::result* junk = nullptr); template inline static void apply_noalias(Mat& out, const Mat& X, const uword dim, const typename arma_cx_only::result* junk = nullptr); // // cubes template inline static void apply(Cube& out, const OpCube& in); template inline static void apply_noalias(Cube& out, const Cube& X, const uword dim, const typename arma_not_cx::result* junk = nullptr); template inline static void apply_noalias(Cube& out, const Cube& X, const uword dim, const typename arma_cx_only::result* junk = nullptr); // // for non-complex numbers template inline static eT direct_min(const eT* const X, const uword N); template inline static eT direct_min(const eT* const X, const uword N, uword& index_of_min_val); template inline static eT direct_min(const Mat& X, const uword row); template inline static eT min(const subview& X); template inline static typename arma_not_cx::result min(const Base& X); template inline static typename arma_not_cx::result min(const BaseCube& X); template inline static typename arma_not_cx::result min_with_index(const Proxy& P, uword& index_of_min_val); template inline static typename arma_not_cx::result min_with_index(const ProxyCube& P, uword& index_of_min_val); // // for complex numbers template inline static std::complex direct_min(const std::complex* const X, const uword n_elem); template inline static std::complex direct_min(const std::complex* const X, const uword n_elem, uword& index_of_min_val); template inline static std::complex direct_min(const Mat< std::complex >& X, const uword row); template inline static std::complex min(const subview< std::complex >& X); template inline static typename arma_cx_only::result min(const Base& X); template inline static typename arma_cx_only::result min(const BaseCube& X); template inline static typename arma_cx_only::result min_with_index(const Proxy& P, uword& index_of_min_val); template inline static typename arma_cx_only::result min_with_index(const ProxyCube& P, uword& index_of_min_val); }; //! @} RcppArmadillo/inst/include/armadillo_bits/spglue_schur_bones.hpp0000644000176200001440000000372714413016473025006 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup spglue_schur //! @{ class spglue_schur : public traits_glue_or { public: template inline static void apply(SpMat& out, const SpGlue& X); template inline static void apply_noalias(SpMat& out, const SpProxy& pa, const SpProxy& pb); template inline static void apply_noalias(SpMat& out, const SpMat& A, const SpMat& B); }; class spglue_schur_misc : public traits_glue_or { public: template inline static void dense_schur_sparse(SpMat& out, const T1& x, const T2& y); }; class spglue_schur_mixed : public traits_glue_or { public: template inline static void apply(SpMat::eT>& out, const mtSpGlue::eT, T1, T2, spglue_schur_mixed>& expr); template inline static void dense_schur_sparse(SpMat< typename promote_type::result>& out, const T1& X, const T2& Y); }; //! @} RcppArmadillo/inst/include/armadillo_bits/op_clamp_meat.hpp0000644000176200001440000003366014631567470023726 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_clamp //! @{ template inline void op_clamp::apply(Mat& out, const mtOp& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const eT min_val = in.aux; const eT max_val = in.aux_out_eT; arma_conform_check( (min_val > max_val), "clamp(): min_val must be less than max_val" ); if(is_Mat::value) { const unwrap U(in.m); op_clamp::apply_direct(out, U.M, min_val, max_val); } else { const Proxy P(in.m); if(P.is_alias(out)) { Mat tmp; op_clamp::apply_proxy_noalias(tmp, P, min_val, max_val); out.steal_mem(tmp); } else { op_clamp::apply_proxy_noalias(out, P, min_val, max_val); } } } template inline void op_clamp::apply_direct(Mat& out, const Mat& X, const eT min_val, const eT max_val) { arma_debug_sigprint(); if(&out != &X) { out.set_size(X.n_rows, X.n_cols); const uword N = out.n_elem; const eT* X_mem = X.memptr(); eT* out_mem = out.memptr(); for(uword i=0; i max_val) ? max_val : val); } } else { arma_debug_print("op_clamp::apply_direct(): inplace operation"); arrayops::clamp(out.memptr(), out.n_elem, min_val, max_val); } } template inline void op_clamp::apply_proxy_noalias(Mat& out, const Proxy& P, const typename T1::elem_type min_val, const typename T1::elem_type max_val) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword n_rows = P.get_n_rows(); const uword n_cols = P.get_n_cols(); out.set_size(n_rows, n_cols); eT* out_mem = out.memptr(); if(Proxy::use_at == false) { const uword N = P.get_n_elem(); typename Proxy::ea_type A = P.get_ea(); for(uword i=0; i max_val) ? max_val : val); } } else { for(uword col=0; col < n_cols; ++col) for(uword row=0; row < n_rows; ++row) { const eT val = P.at(row,col); (*out_mem) = (val < min_val) ? min_val : ((val > max_val) ? max_val : val); out_mem++; } } } // template inline void op_clamp::apply(Cube& out, const mtOpCube& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const eT min_val = in.aux; const eT max_val = in.aux_out_eT; arma_conform_check( (min_val > max_val), "clamp(): min_val must be less than max_val" ); if(is_Cube::value) { const unwrap_cube U(in.m); op_clamp::apply_direct(out, U.M, min_val, max_val); } else { const ProxyCube P(in.m); if(P.is_alias(out)) { Cube tmp; op_clamp::apply_proxy_noalias(tmp, P, min_val, max_val); out.steal_mem(tmp); } else { op_clamp::apply_proxy_noalias(out, P, min_val, max_val); } } } template inline void op_clamp::apply_direct(Cube& out, const Cube& X, const eT min_val, const eT max_val) { arma_debug_sigprint(); if(&out != &X) { out.set_size(X.n_rows, X.n_cols, X.n_slices); const uword N = out.n_elem; const eT* X_mem = X.memptr(); eT* out_mem = out.memptr(); for(uword i=0; i max_val) ? max_val : val); } } else { arma_debug_print("op_clamp::apply_direct(): inplace operation"); arrayops::clamp(out.memptr(), out.n_elem, min_val, max_val); } } template inline void op_clamp::apply_proxy_noalias(Cube& out, const ProxyCube& P, const typename T1::elem_type min_val, const typename T1::elem_type max_val) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const uword n_rows = P.get_n_rows(); const uword n_cols = P.get_n_cols(); const uword n_slices = P.get_n_slices(); out.set_size(n_rows, n_cols, n_slices); eT* out_mem = out.memptr(); if(ProxyCube::use_at == false) { const uword N = P.get_n_elem(); typename ProxyCube::ea_type A = P.get_ea(); for(uword i=0; i max_val) ? max_val : val); } } else { for(uword s=0; s < n_slices; ++s) for(uword c=0; c < n_cols; ++c) for(uword r=0; r < n_rows; ++r) { const eT val = P.at(r,c,s); (*out_mem) = (val < min_val) ? min_val : ((val > max_val) ? max_val : val); out_mem++; } } } // template inline void op_clamp_cx::apply(Mat& out, const mtOp& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; if(is_Mat::value) { const unwrap U(in.m); op_clamp_cx::apply_direct(out, U.M, in.aux, in.aux_out_eT); } else { const Proxy P(in.m); if(P.is_alias(out)) { Mat tmp; op_clamp_cx::apply_proxy_noalias(tmp, P, in.aux, in.aux_out_eT); out.steal_mem(tmp); } else { op_clamp_cx::apply_proxy_noalias(out, P, in.aux, in.aux_out_eT); } } } template inline void op_clamp_cx::apply_direct(Mat& out, const Mat& X, const eT min_val, const eT max_val) { arma_debug_sigprint(); typedef typename get_pod_type::result T; const T min_val_real = std::real(min_val); const T min_val_imag = std::imag(min_val); const T max_val_real = std::real(max_val); const T max_val_imag = std::imag(max_val); arma_conform_check( (min_val_real > max_val_real), "clamp(): real(min_val) must be less than real(max_val)" ); arma_conform_check( (min_val_imag > max_val_imag), "clamp(): imag(min_val) must be less than imag(max_val)" ); if(&out != &X) { out.set_size(X.n_rows, X.n_cols); const uword N = out.n_elem; const eT* X_mem = X.memptr(); eT* out_mem = out.memptr(); for(uword i=0; i max_val_real) ? max_val_real : val_real); val_imag = (val_imag < min_val_imag) ? min_val_imag : ((val_imag > max_val_imag) ? max_val_imag : val_imag); out_mem[i] = std::complex(val_real,val_imag); } } else { arma_debug_print("op_clamp_cx::apply_direct(): inplace operation"); arrayops::clamp(out.memptr(), out.n_elem, min_val, max_val); } } template inline void op_clamp_cx::apply_proxy_noalias(Mat& out, const Proxy& P, const typename T1::elem_type min_val, const typename T1::elem_type max_val) { arma_debug_sigprint(); typedef typename T1::elem_type eT; typedef typename T1::pod_type T; const T min_val_real = std::real(min_val); const T min_val_imag = std::imag(min_val); const T max_val_real = std::real(max_val); const T max_val_imag = std::imag(max_val); arma_conform_check( (min_val_real > max_val_real), "clamp(): real(min_val) must be less than real(max_val)" ); arma_conform_check( (min_val_imag > max_val_imag), "clamp(): imag(min_val) must be less than imag(max_val)" ); const uword n_rows = P.get_n_rows(); const uword n_cols = P.get_n_cols(); out.set_size(n_rows, n_cols); eT* out_mem = out.memptr(); if(Proxy::use_at == false) { const uword N = P.get_n_elem(); typename Proxy::ea_type A = P.get_ea(); for(uword i=0; i max_val_real) ? max_val_real : val_real); val_imag = (val_imag < min_val_imag) ? min_val_imag : ((val_imag > max_val_imag) ? max_val_imag : val_imag); out_mem[i] = std::complex(val_real,val_imag); } } else { for(uword col=0; col < n_cols; ++col) for(uword row=0; row < n_rows; ++row) { const eT val = P.at(row,col); T val_real = std::real(val); T val_imag = std::imag(val); val_real = (val_real < min_val_real) ? min_val_real : ((val_real > max_val_real) ? max_val_real : val_real); val_imag = (val_imag < min_val_imag) ? min_val_imag : ((val_imag > max_val_imag) ? max_val_imag : val_imag); (*out_mem) = std::complex(val_real,val_imag); out_mem++; } } } // template inline void op_clamp_cx::apply(Cube& out, const mtOpCube& in) { arma_debug_sigprint(); typedef typename T1::elem_type eT; if(is_Cube::value) { const unwrap_cube U(in.m); op_clamp_cx::apply_direct(out, U.M, in.aux, in.aux_out_eT); } else { const ProxyCube P(in.m); if(P.is_alias(out)) { Cube tmp; op_clamp_cx::apply_proxy_noalias(tmp, P, in.aux, in.aux_out_eT); out.steal_mem(tmp); } else { op_clamp_cx::apply_proxy_noalias(out, P, in.aux, in.aux_out_eT); } } } template inline void op_clamp_cx::apply_direct(Cube& out, const Cube& X, const eT min_val, const eT max_val) { arma_debug_sigprint(); typedef typename get_pod_type::result T; const T min_val_real = std::real(min_val); const T min_val_imag = std::imag(min_val); const T max_val_real = std::real(max_val); const T max_val_imag = std::imag(max_val); arma_conform_check( (min_val_real > max_val_real), "clamp(): real(min_val) must be less than real(max_val)" ); arma_conform_check( (min_val_imag > max_val_imag), "clamp(): imag(min_val) must be less than imag(max_val)" ); if(&out != &X) { out.set_size(X.n_rows, X.n_cols, X.n_slices); const uword N = out.n_elem; const eT* X_mem = X.memptr(); eT* out_mem = out.memptr(); for(uword i=0; i max_val_real) ? max_val_real : val_real); val_imag = (val_imag < min_val_imag) ? min_val_imag : ((val_imag > max_val_imag) ? max_val_imag : val_imag); out_mem[i] = std::complex(val_real,val_imag); } } else { arma_debug_print("op_clamp_cx::apply_direct(): inplace operation"); arrayops::clamp(out.memptr(), out.n_elem, min_val, max_val); } } template inline void op_clamp_cx::apply_proxy_noalias(Cube& out, const ProxyCube& P, const typename T1::elem_type min_val, const typename T1::elem_type max_val) { arma_debug_sigprint(); typedef typename T1::elem_type eT; typedef typename T1::pod_type T; const T min_val_real = std::real(min_val); const T min_val_imag = std::imag(min_val); const T max_val_real = std::real(max_val); const T max_val_imag = std::imag(max_val); arma_conform_check( (min_val_real > max_val_real), "clamp(): real(min_val) must be less than real(max_val)" ); arma_conform_check( (min_val_imag > max_val_imag), "clamp(): imag(min_val) must be less than imag(max_val)" ); const uword n_rows = P.get_n_rows(); const uword n_cols = P.get_n_cols(); const uword n_slices = P.get_n_slices(); out.set_size(n_rows, n_cols, n_slices); eT* out_mem = out.memptr(); if(ProxyCube::use_at == false) { const uword N = P.get_n_elem(); typename ProxyCube::ea_type A = P.get_ea(); for(uword i=0; i max_val_real) ? max_val_real : val_real); val_imag = (val_imag < min_val_imag) ? min_val_imag : ((val_imag > max_val_imag) ? max_val_imag : val_imag); out_mem[i] = std::complex(val_real,val_imag); } } else { for(uword s=0; s < n_slices; ++s) for(uword c=0; c < n_cols; ++c) for(uword r=0; r < n_rows; ++r) { const eT val = P.at(r,c,s); T val_real = std::real(val); T val_imag = std::imag(val); val_real = (val_real < min_val_real) ? min_val_real : ((val_real > max_val_real) ? max_val_real : val_real); val_imag = (val_imag < min_val_imag) ? min_val_imag : ((val_imag > max_val_imag) ? max_val_imag : val_imag); (*out_mem) = std::complex(val_real,val_imag); out_mem++; } } } //! @} RcppArmadillo/inst/include/armadillo_bits/glue_conv_meat.hpp0000644000176200001440000002434614631567470024116 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup glue_conv //! @{ // TODO: this implementation of conv() is rudimentary; replace with faster version template inline void glue_conv::apply(Mat& out, const Mat& A, const Mat& B, const bool A_is_col) { arma_debug_sigprint(); const Mat& h = (A.n_elem <= B.n_elem) ? A : B; const Mat& x = (A.n_elem <= B.n_elem) ? B : A; const uword h_n_elem = h.n_elem; const uword h_n_elem_m1 = h_n_elem - 1; const uword x_n_elem = x.n_elem; const uword out_n_elem = ((h_n_elem + x_n_elem) > 0) ? (h_n_elem + x_n_elem - 1) : uword(0); if( (h_n_elem == 0) || (x_n_elem == 0) ) { out.zeros(); return; } Col hh(h_n_elem, arma_nozeros_indicator()); // flipped version of h const eT* h_mem = h.memptr(); eT* hh_mem = hh.memptr(); for(uword i=0; i < h_n_elem; ++i) { hh_mem[h_n_elem_m1-i] = h_mem[i]; } Col xx( (x_n_elem + 2*h_n_elem_m1), arma_zeros_indicator() ); // zero padded version of x const eT* x_mem = x.memptr(); eT* xx_mem = xx.memptr(); arrayops::copy( &(xx_mem[h_n_elem_m1]), x_mem, x_n_elem ); (A_is_col) ? out.set_size(out_n_elem, 1) : out.set_size(1, out_n_elem); eT* out_mem = out.memptr(); if( (arma_config::openmp) && (x_n_elem >= 128) && (h_n_elem >= 64) && (mp_thread_limit::in_parallel() == false) ) { #if defined(ARMA_USE_OPENMP) { const int n_threads = mp_thread_limit::get(); #pragma omp parallel for schedule(static) num_threads(n_threads) for(uword i=0; i < out_n_elem; ++i) { out_mem[i] = op_dot::direct_dot( h_n_elem, hh_mem, &(xx_mem[i]) ); } } #endif } else { for(uword i=0; i < out_n_elem; ++i) { // out_mem[i] = dot( hh, xx.subvec(i, (i + h_n_elem_m1)) ); out_mem[i] = op_dot::direct_dot( h_n_elem, hh_mem, &(xx_mem[i]) ); } } } // // alternative implementation of 1d convolution // template // inline // void // glue_conv::apply(Mat& out, const Mat& A, const Mat& B, const bool A_is_col) // { // arma_debug_sigprint(); // // const Mat& h = (A.n_elem <= B.n_elem) ? A : B; // const Mat& x = (A.n_elem <= B.n_elem) ? B : A; // // const uword h_n_elem = h.n_elem; // const uword h_n_elem_m1 = h_n_elem - 1; // const uword x_n_elem = x.n_elem; // const uword out_n_elem = ((h_n_elem + x_n_elem) > 0) ? (h_n_elem + x_n_elem - 1) : uword(0); // // if( (h_n_elem == 0) || (x_n_elem == 0) ) { out.zeros(); return; } // // // Col hh(h_n_elem, arma_nozeros_indicator()); // flipped version of h // // const eT* h_mem = h.memptr(); // eT* hh_mem = hh.memptr(); // // for(uword i=0; i < h_n_elem; ++i) // { // hh_mem[h_n_elem_m1-i] = h_mem[i]; // } // // // construct HH matrix, with the column containing shifted versions of hh; // // upper limit for number of zeros is about 50%; may not be optimal // const uword N_copies = (std::min)(uword(10), h_n_elem); // // const uword HH_n_rows = h_n_elem + (N_copies-1); // // Mat HH(HH_n_rows, N_copies, arma_zeros_indicator()); // // for(uword i=0; i xx( (x_n_elem + 2*h_n_elem_m1), arma_zeros_indicator() ); // zero padded version of x // // const eT* x_mem = x.memptr(); // eT* xx_mem = xx.memptr(); // // arrayops::copy( &(xx_mem[h_n_elem_m1]), x_mem, x_n_elem ); // // // (A_is_col) ? out.set_size(out_n_elem, 1) : out.set_size(1, out_n_elem); // // eT* out_mem = out.memptr(); // // uword last_i = 0; // bool last_i_done = false; // // for(uword i=0; i < xx.n_elem; i += N_copies) // { // if( ((i + HH_n_rows) <= xx.n_elem) && ((i + N_copies) <= out_n_elem) ) // { // const Row xx_sub(xx_mem + i, HH_n_rows, false, true); // // Row out_sub(out_mem + i, N_copies, false, true); // // out_sub = xx_sub * HH; // // last_i_done = true; // } // else // { // last_i = i; // last_i_done = false; // break; // } // } // // if(last_i_done == false) // { // for(uword i=last_i; i < out_n_elem; ++i) // { // // out_mem[i] = dot( hh, xx.subvec(i, (i + h_n_elem_m1)) ); // // out_mem[i] = op_dot::direct_dot( h_n_elem, hh_mem, &(xx_mem[i]) ); // } // } // } template inline void glue_conv::apply(Mat& out, const Glue& expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const quasi_unwrap UA(expr.A); const quasi_unwrap UB(expr.B); const Mat& A = UA.M; const Mat& B = UB.M; arma_conform_check ( ( ((A.is_vec() == false) && (A.is_empty() == false)) || ((B.is_vec() == false) && (B.is_empty() == false)) ), "conv(): given object must be a vector" ); const bool A_is_col = ((T1::is_col) || (A.n_cols == 1)); const uword mode = expr.aux_uword; if(mode == 0) // full convolution { glue_conv::apply(out, A, B, A_is_col); } else if(mode == 1) // same size as A { Mat tmp; glue_conv::apply(tmp, A, B, A_is_col); if( (tmp.is_empty() == false) && (A.is_empty() == false) && (B.is_empty() == false) ) { const uword start = uword( std::floor( double(B.n_elem) / double(2) ) ); out = (A_is_col) ? tmp(start, 0, arma::size(A)) : tmp(0, start, arma::size(A)); } else { out.zeros( arma::size(A) ); } } } /// // TODO: this implementation of conv2() is rudimentary; replace with faster version template inline void glue_conv2::apply(Mat& out, const Mat& A, const Mat& B) { arma_debug_sigprint(); const Mat& G = (A.n_elem <= B.n_elem) ? A : B; // unflipped filter coefficients const Mat& W = (A.n_elem <= B.n_elem) ? B : A; // original 2D image const uword out_n_rows = ((W.n_rows + G.n_rows) > 0) ? (W.n_rows + G.n_rows - 1) : uword(0); const uword out_n_cols = ((W.n_cols + G.n_cols) > 0) ? (W.n_cols + G.n_cols - 1) : uword(0); if(G.is_empty() || W.is_empty()) { out.zeros(); return; } Mat H(G.n_rows, G.n_cols, arma_nozeros_indicator()); // flipped filter coefficients const uword H_n_rows = H.n_rows; const uword H_n_cols = H.n_cols; const uword H_n_rows_m1 = H_n_rows - 1; const uword H_n_cols_m1 = H_n_cols - 1; for(uword col=0; col < H_n_cols; ++col) { eT* H_colptr = H.colptr(H_n_cols_m1 - col); const eT* G_colptr = G.colptr(col); for(uword row=0; row < H_n_rows; ++row) { H_colptr[H_n_rows_m1 - row] = G_colptr[row]; } } Mat X( (W.n_rows + 2*H_n_rows_m1), (W.n_cols + 2*H_n_cols_m1), arma_zeros_indicator() ); X( H_n_rows_m1, H_n_cols_m1, arma::size(W) ) = W; // zero padded version of 2D image out.set_size( out_n_rows, out_n_cols ); if( (arma_config::openmp) && (out_n_cols >= 2) && (mp_thread_limit::in_parallel() == false) ) { #if defined(ARMA_USE_OPENMP) { const int n_threads = mp_thread_limit::get(); #pragma omp parallel for schedule(static) num_threads(n_threads) for(uword col=0; col < out_n_cols; ++col) { eT* out_colptr = out.colptr(col); for(uword row=0; row < out_n_rows; ++row) { // out.at(row, col) = accu( H % X(row, col, size(H)) ); eT acc = eT(0); for(uword H_col = 0; H_col < H_n_cols; ++H_col) { const eT* X_colptr = X.colptr(col + H_col); acc += op_dot::direct_dot( H_n_rows, H.colptr(H_col), &(X_colptr[row]) ); } out_colptr[row] = acc; } } } #endif } else { for(uword col=0; col < out_n_cols; ++col) { eT* out_colptr = out.colptr(col); for(uword row=0; row < out_n_rows; ++row) { // out.at(row, col) = accu( H % X(row, col, size(H)) ); eT acc = eT(0); for(uword H_col = 0; H_col < H_n_cols; ++H_col) { const eT* X_colptr = X.colptr(col + H_col); acc += op_dot::direct_dot( H_n_rows, H.colptr(H_col), &(X_colptr[row]) ); } out_colptr[row] = acc; } } } } template inline void glue_conv2::apply(Mat& out, const Glue& expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const quasi_unwrap UA(expr.A); const quasi_unwrap UB(expr.B); const Mat& A = UA.M; const Mat& B = UB.M; const uword mode = expr.aux_uword; if(mode == 0) // full convolution { glue_conv2::apply(out, A, B); } else if(mode == 1) // same size as A { Mat tmp; glue_conv2::apply(tmp, A, B); if( (tmp.is_empty() == false) && (A.is_empty() == false) && (B.is_empty() == false) ) { const uword start_row = uword( std::floor( double(B.n_rows) / double(2) ) ); const uword start_col = uword( std::floor( double(B.n_cols) / double(2) ) ); out = tmp(start_row, start_col, arma::size(A)); } else { out.zeros( arma::size(A) ); } } } //! @} RcppArmadillo/inst/include/armadillo_bits/newarp_SymEigsSolver_bones.hpp0000644000176200001440000000761114301267043026423 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ namespace newarp { //! This class implements the eigen solver for real symmetric matrices. template class SymEigsSolver { protected: const OpType& op; // object to conduct matrix operation, eg. matrix-vector product const uword nev; // number of eigenvalues requested Col ritz_val; // ritz values // Sort the first nev Ritz pairs in ascending algebraic order // This is used to return the final results virtual void sort_ritzpair(); private: const uword dim_n; // dimension of matrix A const uword ncv; // number of ritz values uword nmatop; // number of matrix operations called uword niter; // number of restarting iterations Mat fac_V; // V matrix in the Arnoldi factorisation Mat fac_H; // H matrix in the Arnoldi factorisation Col fac_f; // residual in the Arnoldi factorisation Mat ritz_vec; // ritz vectors Col ritz_est; // last row of ritz_vec std::vector ritz_conv; // indicator of the convergence of ritz values const eT eps; // the machine precision // eg. ~= 1e-16 for double type const eT eps23; // eps^(2/3), used in convergence test // tol*eps23 is the absolute tolerance const eT near0; // a very small value, but 1/near0 does not overflow std::mt19937_64 local_rng; // local random number generator inline void fill_rand(eT* dest, const uword N, const uword seed_val); // Arnoldi factorisation starting from step-k inline void factorise_from(uword from_k, uword to_m, const Col& fk); // Implicitly restarted Arnoldi factorisation inline void restart(uword k); // Calculate the number of converged Ritz values inline uword num_converged(eT tol); // Return the adjusted nev for restarting inline uword nev_adjusted(uword nconv); // Retrieve and sort ritz values and ritz vectors inline void retrieve_ritzpair(); public: //! Constructor to create a solver object. inline SymEigsSolver(const OpType& op_, uword nev_, uword ncv_); //! Providing the initial residual vector for the algorithm. inline void init(eT* init_resid); //! Providing a random initial residual vector. inline void init(); //! Conducting the major computation procedure. inline uword compute(uword maxit = 1000, eT tol = 1e-10); //! Returning the number of iterations used in the computation. inline uword num_iterations() { return niter; } //! Returning the number of matrix operations used in the computation. inline uword num_operations() { return nmatop; } //! Returning the converged eigenvalues. inline Col eigenvalues(); //! Returning the eigenvectors associated with the converged eigenvalues. inline Mat eigenvectors(uword nvec); //! Returning all converged eigenvectors. inline Mat eigenvectors() { return eigenvectors(nev); } }; } // namespace newarp RcppArmadillo/inst/include/armadillo_bits/Op_meat.hpp0000644000176200001440000000372614715372502022503 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup Op //! @{ template inline Op::Op(const T1& in_m) : m(in_m) { arma_debug_sigprint(); } template inline Op::Op(const T1& in_m, const typename T1::elem_type in_aux) : m(in_m) , aux(in_aux) { arma_debug_sigprint(); } template inline Op::Op(const T1& in_m, const typename T1::elem_type in_aux, const uword in_aux_uword_a, const uword in_aux_uword_b) : m(in_m) , aux(in_aux) , aux_uword_a(in_aux_uword_a) , aux_uword_b(in_aux_uword_b) { arma_debug_sigprint(); } template inline Op::Op(const T1& in_m, const uword in_aux_uword_a, const uword in_aux_uword_b) : m(in_m) , aux_uword_a(in_aux_uword_a) , aux_uword_b(in_aux_uword_b) { arma_debug_sigprint(); } template inline Op::~Op() { arma_debug_sigprint(); } template template inline bool Op::is_alias(const Mat& X) const { arma_debug_sigprint(); return m.is_alias(X); } //! @} RcppArmadillo/inst/include/armadillo_bits/glue_min_bones.hpp0000644000176200001440000000272414301267043024073 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup glue_min //! @{ class glue_min : public traits_glue_or { public: // dense matrices template inline static void apply(Mat& out, const Glue& X); template inline static void apply(Mat& out, const Proxy& PA, const Proxy& PB); // cubes template inline static void apply(Cube& out, const GlueCube& X); template inline static void apply(Cube& out, const ProxyCube& PA, const ProxyCube& PB); }; //! @} RcppArmadillo/inst/include/armadillo_bits/podarray_bones.hpp0000644000176200001440000000454614374704744024137 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup podarray //! @{ struct podarray_prealloc_n_elem { static constexpr uword val = 16; }; //! A lightweight array for POD types. For internal use only! template class podarray { public: arma_aligned const uword n_elem; //!< number of elements held arma_aligned eT* mem; //!< pointer to memory used by the object protected: //! internal memory, to avoid calling the 'new' operator for small amounts of memory. arma_align_mem eT mem_local[ podarray_prealloc_n_elem::val ]; public: inline ~podarray(); inline podarray(); inline podarray (const podarray& x); inline const podarray& operator=(const podarray& x); arma_inline explicit podarray(const uword new_N); template inline explicit podarray(const uword new_N, const arma_initmode_indicator&); arma_inline eT& operator[] (const uword i); arma_inline eT operator[] (const uword i) const; arma_inline eT& operator() (const uword i); arma_inline eT operator() (const uword i) const; inline void set_min_size(const uword min_n_elem); inline void set_size(const uword new_n_elem); inline void reset(); inline void fill(const eT val); inline void zeros(); inline void zeros(const uword new_n_elem); arma_inline eT* memptr(); arma_inline const eT* memptr() const; inline void copy_row(const Mat& A, const uword row); protected: inline void init_cold(const uword new_n_elem); inline void init_warm(const uword new_n_elem); }; //! @} RcppArmadillo/inst/include/armadillo_bits/glue_toeplitz_bones.hpp0000644000176200001440000000204314301267043025154 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup glue_toeplitz //! @{ class glue_toeplitz : public traits_glue_default { public: template inline static void apply(Mat& out, const Glue& in); }; //! @} RcppArmadillo/inst/include/armadillo_bits/def_blas.hpp0000644000176200001440000002535014301267043022645 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ #if defined(ARMA_USE_BLAS) #if defined(dgemm) || defined(DGEMM) #pragma message ("WARNING: detected possible interference with definitions of BLAS functions;") #pragma message ("WARNING: include the armadillo header before any other header as a workaround") #endif #if defined(ARMA_BLAS_NOEXCEPT) #undef ARMA_NOEXCEPT #define ARMA_NOEXCEPT noexcept #else #undef ARMA_NOEXCEPT #define ARMA_NOEXCEPT #endif #if !defined(ARMA_BLAS_CAPITALS) #define arma_sasum sasum #define arma_dasum dasum #define arma_snrm2 snrm2 #define arma_dnrm2 dnrm2 #define arma_sdot sdot #define arma_ddot ddot #define arma_sgemv sgemv #define arma_dgemv dgemv #define arma_cgemv cgemv #define arma_zgemv zgemv #define arma_sgemm sgemm #define arma_dgemm dgemm #define arma_cgemm cgemm #define arma_zgemm zgemm #define arma_ssyrk ssyrk #define arma_dsyrk dsyrk #define arma_cherk cherk #define arma_zherk zherk #else #define arma_sasum SASUM #define arma_dasum DASUM #define arma_snrm2 SNRM2 #define arma_dnrm2 DNRM2 #define arma_sdot SDOT #define arma_ddot DDOT #define arma_sgemv SGEMV #define arma_dgemv DGEMV #define arma_cgemv CGEMV #define arma_zgemv ZGEMV #define arma_sgemm SGEMM #define arma_dgemm DGEMM #define arma_cgemm CGEMM #define arma_zgemm ZGEMM #define arma_ssyrk SSYRK #define arma_dsyrk DSYRK #define arma_cherk CHERK #define arma_zherk ZHERK #endif // NOTE: "For arguments of CHARACTER type, the character length is passed as a hidden argument at the end of the argument list." // NOTE: https://gcc.gnu.org/onlinedocs/gfortran/Argument-passing-conventions.html extern "C" { #if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS) float arma_fortran(arma_sasum)(const blas_int* n, const float* x, const blas_int* incx) ARMA_NOEXCEPT; double arma_fortran(arma_dasum)(const blas_int* n, const double* x, const blas_int* incx) ARMA_NOEXCEPT; float arma_fortran(arma_snrm2)(const blas_int* n, const float* x, const blas_int* incx) ARMA_NOEXCEPT; double arma_fortran(arma_dnrm2)(const blas_int* n, const double* x, const blas_int* incx) ARMA_NOEXCEPT; float arma_fortran(arma_sdot)(const blas_int* n, const float* x, const blas_int* incx, const float* y, const blas_int* incy) ARMA_NOEXCEPT; double arma_fortran(arma_ddot)(const blas_int* n, const double* x, const blas_int* incx, const double* y, const blas_int* incy) ARMA_NOEXCEPT; void arma_fortran(arma_sgemv)(const char* transA, const blas_int* m, const blas_int* n, const float* alpha, const float* A, const blas_int* ldA, const float* x, const blas_int* incx, const float* beta, float* y, const blas_int* incy, blas_len transA_len) ARMA_NOEXCEPT; void arma_fortran(arma_dgemv)(const char* transA, const blas_int* m, const blas_int* n, const double* alpha, const double* A, const blas_int* ldA, const double* x, const blas_int* incx, const double* beta, double* y, const blas_int* incy, blas_len transA_len) ARMA_NOEXCEPT; void arma_fortran(arma_cgemv)(const char* transA, const blas_int* m, const blas_int* n, const blas_cxf* alpha, const blas_cxf* A, const blas_int* ldA, const blas_cxf* x, const blas_int* incx, const blas_cxf* beta, blas_cxf* y, const blas_int* incy, blas_len transA_len) ARMA_NOEXCEPT; void arma_fortran(arma_zgemv)(const char* transA, const blas_int* m, const blas_int* n, const blas_cxd* alpha, const blas_cxd* A, const blas_int* ldA, const blas_cxd* x, const blas_int* incx, const blas_cxd* beta, blas_cxd* y, const blas_int* incy, blas_len transA_len) ARMA_NOEXCEPT; void arma_fortran(arma_sgemm)(const char* transA, const char* transB, const blas_int* m, const blas_int* n, const blas_int* k, const float* alpha, const float* A, const blas_int* ldA, const float* B, const blas_int* ldB, const float* beta, float* C, const blas_int* ldC, blas_len transA_len, blas_len transB_len) ARMA_NOEXCEPT; void arma_fortran(arma_dgemm)(const char* transA, const char* transB, const blas_int* m, const blas_int* n, const blas_int* k, const double* alpha, const double* A, const blas_int* ldA, const double* B, const blas_int* ldB, const double* beta, double* C, const blas_int* ldC, blas_len transA_len, blas_len transB_len) ARMA_NOEXCEPT; void arma_fortran(arma_cgemm)(const char* transA, const char* transB, const blas_int* m, const blas_int* n, const blas_int* k, const blas_cxf* alpha, const blas_cxf* A, const blas_int* ldA, const blas_cxf* B, const blas_int* ldB, const blas_cxf* beta, blas_cxf* C, const blas_int* ldC, blas_len transA_len, blas_len transB_len) ARMA_NOEXCEPT; void arma_fortran(arma_zgemm)(const char* transA, const char* transB, const blas_int* m, const blas_int* n, const blas_int* k, const blas_cxd* alpha, const blas_cxd* A, const blas_int* ldA, const blas_cxd* B, const blas_int* ldB, const blas_cxd* beta, blas_cxd* C, const blas_int* ldC, blas_len transA_len, blas_len transB_len) ARMA_NOEXCEPT; void arma_fortran(arma_ssyrk)(const char* uplo, const char* transA, const blas_int* n, const blas_int* k, const float* alpha, const float* A, const blas_int* ldA, const float* beta, float* C, const blas_int* ldC, blas_len uplo_len, blas_len transA_len) ARMA_NOEXCEPT; void arma_fortran(arma_dsyrk)(const char* uplo, const char* transA, const blas_int* n, const blas_int* k, const double* alpha, const double* A, const blas_int* ldA, const double* beta, double* C, const blas_int* ldC, blas_len uplo_len, blas_len transA_len) ARMA_NOEXCEPT; void arma_fortran(arma_cherk)(const char* uplo, const char* transA, const blas_int* n, const blas_int* k, const float* alpha, const blas_cxf* A, const blas_int* ldA, const float* beta, blas_cxf* C, const blas_int* ldC, blas_len uplo_len, blas_len transA_len) ARMA_NOEXCEPT; void arma_fortran(arma_zherk)(const char* uplo, const char* transA, const blas_int* n, const blas_int* k, const double* alpha, const blas_cxd* A, const blas_int* ldA, const double* beta, blas_cxd* C, const blas_int* ldC, blas_len uplo_len, blas_len transA_len) ARMA_NOEXCEPT; #else // prototypes without hidden arguments float arma_fortran(arma_sasum)(const blas_int* n, const float* x, const blas_int* incx) ARMA_NOEXCEPT; double arma_fortran(arma_dasum)(const blas_int* n, const double* x, const blas_int* incx) ARMA_NOEXCEPT; float arma_fortran(arma_snrm2)(const blas_int* n, const float* x, const blas_int* incx) ARMA_NOEXCEPT; double arma_fortran(arma_dnrm2)(const blas_int* n, const double* x, const blas_int* incx) ARMA_NOEXCEPT; float arma_fortran(arma_sdot)(const blas_int* n, const float* x, const blas_int* incx, const float* y, const blas_int* incy) ARMA_NOEXCEPT; double arma_fortran(arma_ddot)(const blas_int* n, const double* x, const blas_int* incx, const double* y, const blas_int* incy) ARMA_NOEXCEPT; void arma_fortran(arma_sgemv)(const char* transA, const blas_int* m, const blas_int* n, const float* alpha, const float* A, const blas_int* ldA, const float* x, const blas_int* incx, const float* beta, float* y, const blas_int* incy) ARMA_NOEXCEPT; void arma_fortran(arma_dgemv)(const char* transA, const blas_int* m, const blas_int* n, const double* alpha, const double* A, const blas_int* ldA, const double* x, const blas_int* incx, const double* beta, double* y, const blas_int* incy) ARMA_NOEXCEPT; void arma_fortran(arma_cgemv)(const char* transA, const blas_int* m, const blas_int* n, const blas_cxf* alpha, const blas_cxf* A, const blas_int* ldA, const blas_cxf* x, const blas_int* incx, const blas_cxf* beta, blas_cxf* y, const blas_int* incy) ARMA_NOEXCEPT; void arma_fortran(arma_zgemv)(const char* transA, const blas_int* m, const blas_int* n, const blas_cxd* alpha, const blas_cxd* A, const blas_int* ldA, const blas_cxd* x, const blas_int* incx, const blas_cxd* beta, blas_cxd* y, const blas_int* incy) ARMA_NOEXCEPT; void arma_fortran(arma_sgemm)(const char* transA, const char* transB, const blas_int* m, const blas_int* n, const blas_int* k, const float* alpha, const float* A, const blas_int* ldA, const float* B, const blas_int* ldB, const float* beta, float* C, const blas_int* ldC) ARMA_NOEXCEPT; void arma_fortran(arma_dgemm)(const char* transA, const char* transB, const blas_int* m, const blas_int* n, const blas_int* k, const double* alpha, const double* A, const blas_int* ldA, const double* B, const blas_int* ldB, const double* beta, double* C, const blas_int* ldC) ARMA_NOEXCEPT; void arma_fortran(arma_cgemm)(const char* transA, const char* transB, const blas_int* m, const blas_int* n, const blas_int* k, const blas_cxf* alpha, const blas_cxf* A, const blas_int* ldA, const blas_cxf* B, const blas_int* ldB, const blas_cxf* beta, blas_cxf* C, const blas_int* ldC) ARMA_NOEXCEPT; void arma_fortran(arma_zgemm)(const char* transA, const char* transB, const blas_int* m, const blas_int* n, const blas_int* k, const blas_cxd* alpha, const blas_cxd* A, const blas_int* ldA, const blas_cxd* B, const blas_int* ldB, const blas_cxd* beta, blas_cxd* C, const blas_int* ldC) ARMA_NOEXCEPT; void arma_fortran(arma_ssyrk)(const char* uplo, const char* transA, const blas_int* n, const blas_int* k, const float* alpha, const float* A, const blas_int* ldA, const float* beta, float* C, const blas_int* ldC) ARMA_NOEXCEPT; void arma_fortran(arma_dsyrk)(const char* uplo, const char* transA, const blas_int* n, const blas_int* k, const double* alpha, const double* A, const blas_int* ldA, const double* beta, double* C, const blas_int* ldC) ARMA_NOEXCEPT; void arma_fortran(arma_cherk)(const char* uplo, const char* transA, const blas_int* n, const blas_int* k, const float* alpha, const blas_cxf* A, const blas_int* ldA, const float* beta, blas_cxf* C, const blas_int* ldC) ARMA_NOEXCEPT; void arma_fortran(arma_zherk)(const char* uplo, const char* transA, const blas_int* n, const blas_int* k, const double* alpha, const blas_cxd* A, const blas_int* ldA, const double* beta, blas_cxd* C, const blas_int* ldC) ARMA_NOEXCEPT; #endif } #undef ARMA_NOEXCEPT #endif RcppArmadillo/inst/include/armadillo_bits/spdiagview_bones.hpp0000644000176200001440000000726514752446051024453 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup spdiagview //! @{ //! Class for storing data required to extract and set the diagonals of a sparse matrix template class spdiagview : public SpBase< eT, spdiagview > { public: typedef eT elem_type; typedef typename get_pod_type::result pod_type; const SpMat& m; static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; const uword row_offset; const uword col_offset; const uword n_rows; // equal to n_elem const uword n_elem; static constexpr uword n_cols = 1; protected: arma_inline spdiagview(const SpMat& in_m, const uword in_row_offset, const uword in_col_offset, const uword len); public: inline ~spdiagview(); inline spdiagview() = delete; inline void operator=(const spdiagview& x); inline void operator+=(const eT val); inline void operator-=(const eT val); inline void operator*=(const eT val); inline void operator/=(const eT val); template inline void operator= (const Base& x); template inline void operator+=(const Base& x); template inline void operator-=(const Base& x); template inline void operator%=(const Base& x); template inline void operator/=(const Base& x); template inline void operator= (const SpBase& x); template inline void operator+=(const SpBase& x); template inline void operator-=(const SpBase& x); template inline void operator%=(const SpBase& x); template inline void operator/=(const SpBase& x); inline SpMat_MapMat_val operator[](const uword ii); inline eT operator[](const uword ii) const; inline SpMat_MapMat_val at(const uword ii); inline eT at(const uword ii) const; inline SpMat_MapMat_val operator()(const uword ii); inline eT operator()(const uword ii) const; inline SpMat_MapMat_val at(const uword in_n_row, const uword); inline eT at(const uword in_n_row, const uword) const; inline SpMat_MapMat_val operator()(const uword in_n_row, const uword in_n_col); inline eT operator()(const uword in_n_row, const uword in_n_col) const; inline void replace(const eT old_val, const eT new_val); inline void clean(const pod_type threshold); inline void clamp(const eT min_val, const eT max_val); inline void fill(const eT val); inline void zeros(); inline void ones(); inline void randu(); inline void randn(); inline static void extract(SpMat& out, const spdiagview& in); inline static void extract( Mat& out, const spdiagview& in); friend class SpMat; }; //! @} RcppArmadillo/inst/include/armadillo_bits/glue_cross_meat.hpp0000644000176200001440000000442414631567470024275 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup glue_cross //! @{ template inline void glue_cross::apply(Mat& out, const Glue& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const Proxy PA(X.A); const Proxy PB(X.B); arma_conform_check( ((PA.get_n_elem() != 3) || (PB.get_n_elem() != 3)), "cross(): each vector must have 3 elements" ); out.set_size(PA.get_n_rows(), PA.get_n_cols()); eT* out_mem = out.memptr(); if( (Proxy::use_at == false) && (Proxy::use_at == false) ) { typename Proxy::ea_type A = PA.get_ea(); typename Proxy::ea_type B = PB.get_ea(); const eT ax = A[0]; const eT ay = A[1]; const eT az = A[2]; const eT bx = B[0]; const eT by = B[1]; const eT bz = B[2]; out_mem[0] = ay*bz - az*by; out_mem[1] = az*bx - ax*bz; out_mem[2] = ax*by - ay*bx; } else { const bool PA_is_col = Proxy::is_col ? true : (PA.get_n_cols() == 1); const bool PB_is_col = Proxy::is_col ? true : (PB.get_n_cols() == 1); const eT ax = PA.at(0,0); const eT ay = PA_is_col ? PA.at(1,0) : PA.at(0,1); const eT az = PA_is_col ? PA.at(2,0) : PA.at(0,2); const eT bx = PB.at(0,0); const eT by = PB_is_col ? PB.at(1,0) : PB.at(0,1); const eT bz = PB_is_col ? PB.at(2,0) : PB.at(0,2); out_mem[0] = ay*bz - az*by; out_mem[1] = az*bx - ax*bz; out_mem[2] = ax*by - ay*bx; } } //! @} RcppArmadillo/inst/include/armadillo_bits/glue_mvnrnd_bones.hpp0000644000176200001440000000335514301267043024615 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup glue_mvnrnd //! @{ class glue_mvnrnd_vec { public: template struct traits { static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; }; template inline static void apply(Mat& out, const Glue& expr); }; class glue_mvnrnd : public traits_glue_default { public: template inline static void apply(Mat& out, const Glue& expr); template inline static bool apply_direct(Mat& out, const Base& M, const Base& C, const uword N); template inline static bool apply_noalias(Mat& out, const Mat& M, const Mat& C, const uword N); }; //! @} RcppArmadillo/inst/include/armadillo_bits/spop_repmat_meat.hpp0000644000176200001440000001116514631567470024461 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup spop_repmat //! @{ template inline void spop_repmat::apply(SpMat& out, const SpOp& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const unwrap_spmat U(X.m); if(U.is_alias(out)) { SpMat tmp; spop_repmat::apply_noalias(tmp, X.aux_uword_a, X.aux_uword_b, U.M); out.steal_mem(tmp); } else { spop_repmat::apply_noalias(out, X.aux_uword_a, X.aux_uword_b, U.M); } } template inline void spop_repmat::apply_noalias(SpMat& out, const uword A_n_rows, const uword A_n_cols, const SpMat& B) { arma_debug_sigprint(); const uword B_n_rows = B.n_rows; const uword B_n_cols = B.n_cols; const uword out_n_nonzero = A_n_rows * A_n_cols * B.n_nonzero; out.reserve(A_n_rows * B_n_rows, A_n_cols * B_n_cols, out_n_nonzero); if(out_n_nonzero == 0) { return; } access::rw(out.col_ptrs[0]) = 0; uword count = 0; for(uword A_col=0; A_col < A_n_cols; ++A_col) for(uword B_col=0; B_col < B_n_cols; ++B_col) { for(uword A_row=0; A_row < A_n_rows; ++A_row) { const uword out_row = A_row * B_n_rows; for(uword B_i = B.col_ptrs[B_col]; B_i < B.col_ptrs[B_col+1]; ++B_i) { access::rw(out.values[count]) = B.values[B_i]; access::rw(out.row_indices[count]) = out_row + B.row_indices[B_i]; count++; } } access::rw(out.col_ptrs[A_col * B_n_cols + B_col + 1]) = count; } } // template // inline // void // spop_repmat::apply(SpMat& out, const SpOp& in) // { // arma_debug_sigprint(); // // typedef typename T1::elem_type eT; // // const unwrap_spmat U(in.m); // const SpMat& X = U.M; // // const uword X_n_rows = X.n_rows; // const uword X_n_cols = X.n_cols; // // const uword copies_per_row = in.aux_uword_a; // const uword copies_per_col = in.aux_uword_b; // // // out.set_size(X_n_rows * copies_per_row, X_n_cols * copies_per_col); // // // // const uword out_n_rows = out.n_rows; // // const uword out_n_cols = out.n_cols; // // // // if( (out_n_rows > 0) && (out_n_cols > 0) ) // // { // // for(uword col = 0; col < out_n_cols; col += X_n_cols) // // for(uword row = 0; row < out_n_rows; row += X_n_rows) // // { // // out.submat(row, col, row+X_n_rows-1, col+X_n_cols-1) = X; // // } // // } // // const uword out_n_rows = X_n_rows * copies_per_row; // const uword out_n_cols = X_n_cols * copies_per_col; // const uword out_nnz = X.n_nonzero * copies_per_row * copies_per_col; // // if( (out_n_rows > 0) && (out_n_cols > 0) && (out_nnz > 0) ) // { // umat locs(2, out_nnz, arma_nozeros_indicator()); // Col vals( out_nnz, arma_nozeros_indicator()); // // uword* locs_mem = locs.memptr(); // eT* vals_mem = vals.memptr(); // // typename SpMat::const_iterator X_begin = X.begin(); // typename SpMat::const_iterator X_end = X.end(); // typename SpMat::const_iterator X_it; // // for(uword col_offset = 0; col_offset < out_n_cols; col_offset += X_n_cols) // for(uword row_offset = 0; row_offset < out_n_rows; row_offset += X_n_rows) // { // for(X_it = X_begin; X_it != X_end; ++X_it) // { // const uword out_row = row_offset + X_it.row(); // const uword out_col = col_offset + X_it.col(); // // (*locs_mem) = out_row; ++locs_mem; // (*locs_mem) = out_col; ++locs_mem; // // (*vals_mem) = (*X_it); ++vals_mem; // } // } // // out = SpMat(locs, vals, out_n_rows, out_n_cols); // } // else // { // out.zeros(out_n_rows, out_n_cols); // } // } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_lu.hpp0000644000176200001440000000441014635324415022212 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_lu //! @{ //! immediate lower upper decomposition, permutation info is embedded into L (similar to Matlab/Octave) template inline bool lu ( Mat& L, Mat& U, const Base& X, const typename arma_blas_type_only::result* junk = nullptr ) { arma_debug_sigprint(); arma_ignore(junk); arma_conform_check( (&L == &U), "lu(): L and U are the same object" ); const bool status = auxlib::lu(L, U, X); if(status == false) { L.soft_reset(); U.soft_reset(); arma_warn(3, "lu(): decomposition failed"); } return status; } //! immediate lower upper decomposition, also providing the permutation matrix template inline bool lu ( Mat& L, Mat& U, Mat& P, const Base& X, const typename arma_blas_type_only::result* junk = nullptr ) { arma_debug_sigprint(); arma_ignore(junk); arma_conform_check( ( (&L == &U) || (&L == &P) || (&U == &P) ), "lu(): two or more output objects are the same object" ); const bool status = auxlib::lu(L, U, P, X); if(status == false) { L.soft_reset(); U.soft_reset(); P.soft_reset(); arma_warn(3, "lu(): decomposition failed"); } return status; } //! @} RcppArmadillo/inst/include/armadillo_bits/fn_schur.hpp0000644000176200001440000000475314635324415022730 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_schur //! @{ template inline bool schur ( Mat& S, const Base& X, const typename arma_blas_type_only::result* junk = nullptr ) { arma_debug_sigprint(); arma_ignore(junk); typedef typename T1::elem_type eT; Mat U; const bool status = auxlib::schur(U, S, X.get_ref(), false); if(status == false) { S.soft_reset(); arma_warn(3, "schur(): decomposition failed"); } return status; } template arma_warn_unused inline Mat schur ( const Base& X, const typename arma_blas_type_only::result* junk = nullptr ) { arma_debug_sigprint(); arma_ignore(junk); typedef typename T1::elem_type eT; Mat S; Mat U; const bool status = auxlib::schur(U, S, X.get_ref(), false); if(status == false) { S.soft_reset(); arma_stop_runtime_error("schur(): decomposition failed"); } return S; } template inline bool schur ( Mat& U, Mat& S, const Base& X, const typename arma_blas_type_only::result* junk = nullptr ) { arma_debug_sigprint(); arma_ignore(junk); arma_conform_check( void_ptr(&U) == void_ptr(&S), "schur(): 'U' is an alias of 'S'" ); const bool status = auxlib::schur(U, S, X.get_ref(), true); if(status == false) { U.soft_reset(); S.soft_reset(); arma_warn(3, "schur(): decomposition failed"); } return status; } //! @} RcppArmadillo/inst/include/armadillo_bits/op_logmat_bones.hpp0000644000176200001440000000504614301267043024255 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup op_logmat //! @{ class op_logmat : public traits_op_default { public: template inline static void apply(Mat< std::complex >& out, const mtOp,T1,op_logmat>& in); template inline static bool apply_direct(Mat< std::complex >& out, const Op& expr, const uword); template inline static bool apply_direct(Mat< std::complex >& out, const Base& expr, const uword n_iters); }; class op_logmat_cx : public traits_op_default { public: template inline static void apply(Mat& out, const Op& in); template inline static bool apply_direct(Mat& out, const Op& expr, const uword); template inline static bool apply_direct_noalias(Mat& out, const diagmat_proxy& P); template inline static bool apply_direct(Mat& out, const Base& expr, const uword n_iters); template inline static bool apply_common(Mat< std::complex >& out, Mat< std::complex >& S, const uword n_iters); template inline static bool helper(Mat& S, const uword m); }; class op_logmat_sympd : public traits_op_default { public: template inline static void apply(Mat& out, const Op& in); template inline static bool apply_direct(Mat& out, const Base& expr); }; //! @} RcppArmadillo/inst/include/armadillo_bits/subview_elem1_meat.hpp0000644000176200001440000005517715030507611024673 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup subview_elem1 //! @{ template inline subview_elem1::~subview_elem1() { arma_debug_sigprint(); } template arma_inline subview_elem1::subview_elem1(const Mat& in_m, const Base& in_a) : m(in_m) , a(in_a) { arma_debug_sigprint(); } template arma_inline subview_elem1::subview_elem1(const Cube& in_q, const Base& in_a) : fake_m( const_cast< eT* >(in_q.memptr()), in_q.n_elem, 1, false ) , m( fake_m ) , a( in_a ) { arma_debug_sigprint(); } template template inline void subview_elem1::inplace_op(const eT val) { arma_debug_sigprint(); Mat& m_local = const_cast< Mat& >(m); eT* m_mem = m_local.memptr(); const uword m_n_elem = m_local.n_elem; const unwrap_check_mixed tmp(a.get_ref(), m_local); const umat& aa = tmp.M; if(resolves_to_vector::no) { arma_conform_check( ( (aa.is_vec() == false) && (aa.is_empty() == false) ), "Mat::elem(): given object must be a vector" ); } const uword* aa_mem = aa.memptr(); const uword aa_n_elem = aa.n_elem; uword iq,jq; for(iq=0, jq=1; jq < aa_n_elem; iq+=2, jq+=2) { const uword ii = aa_mem[iq]; const uword jj = aa_mem[jq]; arma_conform_check_bounds( ( (ii >= m_n_elem) || (jj >= m_n_elem) ), "Mat::elem(): index out of bounds" ); if(is_same_type::yes) { m_mem[ii] = val; m_mem[jj] = val; } if(is_same_type::yes) { m_mem[ii] += val; m_mem[jj] += val; } if(is_same_type::yes) { m_mem[ii] -= val; m_mem[jj] -= val; } if(is_same_type::yes) { m_mem[ii] *= val; m_mem[jj] *= val; } if(is_same_type::yes) { m_mem[ii] /= val; m_mem[jj] /= val; } } if(iq < aa_n_elem) { const uword ii = aa_mem[iq]; arma_conform_check_bounds( (ii >= m_n_elem) , "Mat::elem(): index out of bounds" ); if(is_same_type::yes) { m_mem[ii] = val; } if(is_same_type::yes) { m_mem[ii] += val; } if(is_same_type::yes) { m_mem[ii] -= val; } if(is_same_type::yes) { m_mem[ii] *= val; } if(is_same_type::yes) { m_mem[ii] /= val; } } } template template inline void subview_elem1::inplace_op(const subview_elem1& x) { arma_debug_sigprint(); subview_elem1& s = *this; if(&(s.m) == &(x.m)) { arma_debug_print("subview_elem1::inplace_op(): aliasing detected"); const Mat tmp(x); if(is_same_type::yes) { s.operator= (tmp); } if(is_same_type::yes) { s.operator+=(tmp); } if(is_same_type::yes) { s.operator-=(tmp); } if(is_same_type::yes) { s.operator%=(tmp); } if(is_same_type::yes) { s.operator/=(tmp); } } else { Mat& s_m_local = const_cast< Mat& >(s.m); const Mat& x_m_local = x.m; const unwrap_check_mixed s_tmp(s.a.get_ref(), s_m_local); const unwrap_check_mixed x_tmp(x.a.get_ref(), s_m_local); const umat& s_aa = s_tmp.M; const umat& x_aa = x_tmp.M; arma_conform_check ( ( ((s_aa.is_vec() == false) && (s_aa.is_empty() == false)) || ((x_aa.is_vec() == false) && (x_aa.is_empty() == false)) ), "Mat::elem(): given object must be a vector" ); const uword* s_aa_mem = s_aa.memptr(); const uword* x_aa_mem = x_aa.memptr(); const uword s_aa_n_elem = s_aa.n_elem; arma_conform_check( (s_aa_n_elem != x_aa.n_elem), "Mat::elem(): size mismatch" ); eT* s_m_mem = s_m_local.memptr(); const uword s_m_n_elem = s_m_local.n_elem; const eT* x_m_mem = x_m_local.memptr(); const uword x_m_n_elem = x_m_local.n_elem; uword iq,jq; for(iq=0, jq=1; jq < s_aa_n_elem; iq+=2, jq+=2) { const uword s_ii = s_aa_mem[iq]; const uword s_jj = s_aa_mem[jq]; const uword x_ii = x_aa_mem[iq]; const uword x_jj = x_aa_mem[jq]; arma_conform_check_bounds ( (s_ii >= s_m_n_elem) || (s_jj >= s_m_n_elem) || (x_ii >= x_m_n_elem) || (x_jj >= x_m_n_elem), "Mat::elem(): index out of bounds" ); if(is_same_type::yes) { s_m_mem[s_ii] = x_m_mem[x_ii]; s_m_mem[s_jj] = x_m_mem[x_jj]; } if(is_same_type::yes) { s_m_mem[s_ii] += x_m_mem[x_ii]; s_m_mem[s_jj] += x_m_mem[x_jj]; } if(is_same_type::yes) { s_m_mem[s_ii] -= x_m_mem[x_ii]; s_m_mem[s_jj] -= x_m_mem[x_jj]; } if(is_same_type::yes) { s_m_mem[s_ii] *= x_m_mem[x_ii]; s_m_mem[s_jj] *= x_m_mem[x_jj]; } if(is_same_type::yes) { s_m_mem[s_ii] /= x_m_mem[x_ii]; s_m_mem[s_jj] /= x_m_mem[x_jj]; } } if(iq < s_aa_n_elem) { const uword s_ii = s_aa_mem[iq]; const uword x_ii = x_aa_mem[iq]; arma_conform_check_bounds ( ( (s_ii >= s_m_n_elem) || (x_ii >= x_m_n_elem) ), "Mat::elem(): index out of bounds" ); if(is_same_type::yes) { s_m_mem[s_ii] = x_m_mem[x_ii]; } if(is_same_type::yes) { s_m_mem[s_ii] += x_m_mem[x_ii]; } if(is_same_type::yes) { s_m_mem[s_ii] -= x_m_mem[x_ii]; } if(is_same_type::yes) { s_m_mem[s_ii] *= x_m_mem[x_ii]; } if(is_same_type::yes) { s_m_mem[s_ii] /= x_m_mem[x_ii]; } } } } template template inline void subview_elem1::inplace_op(const Base& x) { arma_debug_sigprint(); Mat& m_local = const_cast< Mat& >(m); eT* m_mem = m_local.memptr(); const uword m_n_elem = m_local.n_elem; const unwrap_check_mixed aa_tmp(a.get_ref(), m_local); const umat& aa = aa_tmp.M; if(resolves_to_vector::no) { arma_conform_check( ( (aa.is_vec() == false) && (aa.is_empty() == false) ), "Mat::elem(): given object must be a vector" ); } const uword* aa_mem = aa.memptr(); const uword aa_n_elem = aa.n_elem; const Proxy P(x.get_ref()); arma_conform_check( (aa_n_elem != P.get_n_elem()), "Mat::elem(): size mismatch" ); const bool have_alias = P.is_alias(m); if( (have_alias == false) && (Proxy::use_at == false) ) { typename Proxy::ea_type X = P.get_ea(); uword iq,jq; for(iq=0, jq=1; jq < aa_n_elem; iq+=2, jq+=2) { const uword ii = aa_mem[iq]; const uword jj = aa_mem[jq]; arma_conform_check_bounds( ( (ii >= m_n_elem) || (jj >= m_n_elem) ), "Mat::elem(): index out of bounds" ); if(is_same_type::yes) { m_mem[ii] = X[iq]; m_mem[jj] = X[jq]; } if(is_same_type::yes) { m_mem[ii] += X[iq]; m_mem[jj] += X[jq]; } if(is_same_type::yes) { m_mem[ii] -= X[iq]; m_mem[jj] -= X[jq]; } if(is_same_type::yes) { m_mem[ii] *= X[iq]; m_mem[jj] *= X[jq]; } if(is_same_type::yes) { m_mem[ii] /= X[iq]; m_mem[jj] /= X[jq]; } } if(iq < aa_n_elem) { const uword ii = aa_mem[iq]; arma_conform_check_bounds( (ii >= m_n_elem) , "Mat::elem(): index out of bounds" ); if(is_same_type::yes) { m_mem[ii] = X[iq]; } if(is_same_type::yes) { m_mem[ii] += X[iq]; } if(is_same_type::yes) { m_mem[ii] -= X[iq]; } if(is_same_type::yes) { m_mem[ii] *= X[iq]; } if(is_same_type::yes) { m_mem[ii] /= X[iq]; } } } else { arma_debug_print("subview_elem1::inplace_op(): aliasing or use_at detected"); const unwrap_check::stored_type> tmp(P.Q, have_alias); const Mat& M = tmp.M; const eT* X = M.memptr(); uword iq,jq; for(iq=0, jq=1; jq < aa_n_elem; iq+=2, jq+=2) { const uword ii = aa_mem[iq]; const uword jj = aa_mem[jq]; arma_conform_check_bounds( ( (ii >= m_n_elem) || (jj >= m_n_elem) ), "Mat::elem(): index out of bounds" ); if(is_same_type::yes) { m_mem[ii] = X[iq]; m_mem[jj] = X[jq]; } if(is_same_type::yes) { m_mem[ii] += X[iq]; m_mem[jj] += X[jq]; } if(is_same_type::yes) { m_mem[ii] -= X[iq]; m_mem[jj] -= X[jq]; } if(is_same_type::yes) { m_mem[ii] *= X[iq]; m_mem[jj] *= X[jq]; } if(is_same_type::yes) { m_mem[ii] /= X[iq]; m_mem[jj] /= X[jq]; } } if(iq < aa_n_elem) { const uword ii = aa_mem[iq]; arma_conform_check_bounds( (ii >= m_n_elem) , "Mat::elem(): index out of bounds" ); if(is_same_type::yes) { m_mem[ii] = X[iq]; } if(is_same_type::yes) { m_mem[ii] += X[iq]; } if(is_same_type::yes) { m_mem[ii] -= X[iq]; } if(is_same_type::yes) { m_mem[ii] *= X[iq]; } if(is_same_type::yes) { m_mem[ii] /= X[iq]; } } } } // // template arma_inline const Op,op_htrans> subview_elem1::t() const { return Op,op_htrans>(*this); } template arma_inline const Op,op_htrans> subview_elem1::ht() const { return Op,op_htrans>(*this); } template arma_inline const Op,op_strans> subview_elem1::st() const { return Op,op_strans>(*this); } template inline void subview_elem1::replace(const eT old_val, const eT new_val) { arma_debug_sigprint(); Mat& m_local = const_cast< Mat& >(m); eT* m_mem = m_local.memptr(); const uword m_n_elem = m_local.n_elem; const unwrap_check_mixed tmp(a.get_ref(), m_local); const umat& aa = tmp.M; if(resolves_to_vector::no) { arma_conform_check( ( (aa.is_vec() == false) && (aa.is_empty() == false) ), "Mat::elem(): given object must be a vector" ); } const uword* aa_mem = aa.memptr(); const uword aa_n_elem = aa.n_elem; if(arma_isnan(old_val)) { for(uword iq=0; iq < aa_n_elem; ++iq) { const uword ii = aa_mem[iq]; arma_conform_check_bounds( (ii >= m_n_elem), "Mat::elem(): index out of bounds" ); eT& val = m_mem[ii]; val = (arma_isnan(val)) ? new_val : val; } } else { for(uword iq=0; iq < aa_n_elem; ++iq) { const uword ii = aa_mem[iq]; arma_conform_check_bounds( (ii >= m_n_elem), "Mat::elem(): index out of bounds" ); eT& val = m_mem[ii]; val = (val == old_val) ? new_val : val; } } } template inline void subview_elem1::clean(const pod_type threshold) { arma_debug_sigprint(); Mat tmp(*this); tmp.clean(threshold); (*this).operator=(tmp); } template inline void subview_elem1::clamp(const eT min_val, const eT max_val) { arma_debug_sigprint(); Mat tmp(*this); tmp.clamp(min_val, max_val); (*this).operator=(tmp); } template inline void subview_elem1::fill(const eT val) { arma_debug_sigprint(); inplace_op(val); } template inline void subview_elem1::zeros() { arma_debug_sigprint(); inplace_op(eT(0)); } template inline void subview_elem1::ones() { arma_debug_sigprint(); inplace_op(eT(1)); } template inline void subview_elem1::randu() { arma_debug_sigprint(); Mat& m_local = const_cast< Mat& >(m); eT* m_mem = m_local.memptr(); const uword m_n_elem = m_local.n_elem; const unwrap_check_mixed U(a.get_ref(), m_local); const umat& aa = U.M; if(resolves_to_vector::no) { arma_conform_check( ( (aa.is_vec() == false) && (aa.is_empty() == false) ), "Mat::elem(): given object must be a vector" ); } const uword* aa_mem = aa.memptr(); const uword aa_n_elem = aa.n_elem; podarray tmp(aa_n_elem); eT* tmp_mem = tmp.memptr(); arma_rng::randu::fill(tmp_mem, aa_n_elem); for(uword iq=0; iq < aa_n_elem; ++iq) { const uword ii = aa_mem[iq]; arma_conform_check_bounds( (ii >= m_n_elem), "Mat::elem(): index out of bounds" ); m_mem[ii] = tmp_mem[iq]; } } template inline void subview_elem1::randn() { arma_debug_sigprint(); Mat& m_local = const_cast< Mat& >(m); eT* m_mem = m_local.memptr(); const uword m_n_elem = m_local.n_elem; const unwrap_check_mixed U(a.get_ref(), m_local); const umat& aa = U.M; if(resolves_to_vector::no) { arma_conform_check( ( (aa.is_vec() == false) && (aa.is_empty() == false) ), "Mat::elem(): given object must be a vector" ); } const uword* aa_mem = aa.memptr(); const uword aa_n_elem = aa.n_elem; podarray tmp(aa_n_elem); eT* tmp_mem = tmp.memptr(); arma_rng::randn::fill(tmp_mem, aa_n_elem); for(uword iq=0; iq < aa_n_elem; ++iq) { const uword ii = aa_mem[iq]; arma_conform_check_bounds( (ii >= m_n_elem), "Mat::elem(): index out of bounds" ); m_mem[ii] = tmp_mem[iq]; } } template inline void subview_elem1::operator+= (const eT val) { arma_debug_sigprint(); inplace_op(val); } template inline void subview_elem1::operator-= (const eT val) { arma_debug_sigprint(); inplace_op(val); } template inline void subview_elem1::operator*= (const eT val) { arma_debug_sigprint(); inplace_op(val); } template inline void subview_elem1::operator/= (const eT val) { arma_debug_sigprint(); inplace_op(val); } // // template template inline void subview_elem1::operator_equ(const subview_elem1& x) { arma_debug_sigprint(); inplace_op(x); } template template inline void subview_elem1::operator= (const subview_elem1& x) { arma_debug_sigprint(); (*this).operator_equ(x); } //! work around compiler bugs template inline void subview_elem1::operator= (const subview_elem1& x) { arma_debug_sigprint(); (*this).operator_equ(x); } template template inline void subview_elem1::operator+= (const subview_elem1& x) { arma_debug_sigprint(); inplace_op(x); } template template inline void subview_elem1::operator-= (const subview_elem1& x) { arma_debug_sigprint(); inplace_op(x); } template template inline void subview_elem1::operator%= (const subview_elem1& x) { arma_debug_sigprint(); inplace_op(x); } template template inline void subview_elem1::operator/= (const subview_elem1& x) { arma_debug_sigprint(); inplace_op(x); } template template inline void subview_elem1::operator= (const Base& x) { arma_debug_sigprint(); inplace_op(x); } template template inline void subview_elem1::operator+= (const Base& x) { arma_debug_sigprint(); inplace_op(x); } template template inline void subview_elem1::operator-= (const Base& x) { arma_debug_sigprint(); inplace_op(x); } template template inline void subview_elem1::operator%= (const Base& x) { arma_debug_sigprint(); inplace_op(x); } template template inline void subview_elem1::operator/= (const Base& x) { arma_debug_sigprint(); inplace_op(x); } // // template inline void subview_elem1::extract(Mat& actual_out, const subview_elem1& in) { arma_debug_sigprint(); const unwrap_check_mixed tmp1(in.a.get_ref(), actual_out); const umat& aa = tmp1.M; if(resolves_to_vector::no) { arma_conform_check( ( (aa.is_vec() == false) && (aa.is_empty() == false) ), "Mat::elem(): given object must be a vector" ); } const uword* aa_mem = aa.memptr(); const uword aa_n_elem = aa.n_elem; const Mat& m_local = in.m; const eT* m_mem = m_local.memptr(); const uword m_n_elem = m_local.n_elem; const bool alias = (&actual_out == &m_local); if(alias) { arma_debug_print("subview_elem1::extract(): aliasing detected"); } Mat* tmp_out = alias ? new Mat() : nullptr; Mat& out = alias ? *tmp_out : actual_out; out.set_size(aa_n_elem, 1); eT* out_mem = out.memptr(); uword i,j; for(i=0, j=1; j= m_n_elem) || (jj >= m_n_elem) ), "Mat::elem(): index out of bounds" ); out_mem[i] = m_mem[ii]; out_mem[j] = m_mem[jj]; } if(i < aa_n_elem) { const uword ii = aa_mem[i]; arma_conform_check_bounds( (ii >= m_n_elem) , "Mat::elem(): index out of bounds" ); out_mem[i] = m_mem[ii]; } if(alias) { actual_out.steal_mem(out); delete tmp_out; } } template template inline void subview_elem1::mat_inplace_op(Mat& out, const subview_elem1& in) { arma_debug_sigprint(); const unwrap tmp1(in.a.get_ref()); const umat& aa = tmp1.M; if(resolves_to_vector::no) { arma_conform_check( ( (aa.is_vec() == false) && (aa.is_empty() == false) ), "Mat::elem(): given object must be a vector" ); } const uword* aa_mem = aa.memptr(); const uword aa_n_elem = aa.n_elem; const unwrap_check< Mat > tmp2(in.m, out); const Mat& m_local = tmp2.M; const eT* m_mem = m_local.memptr(); const uword m_n_elem = m_local.n_elem; arma_conform_check( (out.n_elem != aa_n_elem), "Mat::elem(): size mismatch" ); eT* out_mem = out.memptr(); uword i,j; for(i=0, j=1; j= m_n_elem) || (jj >= m_n_elem) ), "Mat::elem(): index out of bounds" ); if(is_same_type::yes) { out_mem[i] += m_mem[ii]; out_mem[j] += m_mem[jj]; } if(is_same_type::yes) { out_mem[i] -= m_mem[ii]; out_mem[j] -= m_mem[jj]; } if(is_same_type::yes) { out_mem[i] *= m_mem[ii]; out_mem[j] *= m_mem[jj]; } if(is_same_type::yes) { out_mem[i] /= m_mem[ii]; out_mem[j] /= m_mem[jj]; } } if(i < aa_n_elem) { const uword ii = aa_mem[i]; arma_conform_check_bounds( (ii >= m_n_elem) , "Mat::elem(): index out of bounds" ); if(is_same_type::yes) { out_mem[i] += m_mem[ii]; } if(is_same_type::yes) { out_mem[i] -= m_mem[ii]; } if(is_same_type::yes) { out_mem[i] *= m_mem[ii]; } if(is_same_type::yes) { out_mem[i] /= m_mem[ii]; } } } template inline void subview_elem1::plus_inplace(Mat& out, const subview_elem1& in) { arma_debug_sigprint(); mat_inplace_op(out, in); } template inline void subview_elem1::minus_inplace(Mat& out, const subview_elem1& in) { arma_debug_sigprint(); mat_inplace_op(out, in); } template inline void subview_elem1::schur_inplace(Mat& out, const subview_elem1& in) { arma_debug_sigprint(); mat_inplace_op(out, in); } template inline void subview_elem1::div_inplace(Mat& out, const subview_elem1& in) { arma_debug_sigprint(); mat_inplace_op(out, in); } template template inline bool subview_elem1::is_alias(const Mat& X) const { arma_debug_sigprint(); return (m.is_alias(X) || a.get_ref().is_alias(X)); } //! @} RcppArmadillo/inst/include/armadillo_bits/subview_cube_slices_meat.hpp0000644000176200001440000002667614631567470026171 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup subview_cube_slices //! @{ template inline subview_cube_slices::~subview_cube_slices() { arma_debug_sigprint(); } template arma_inline subview_cube_slices::subview_cube_slices ( const Cube& in_m, const Base& in_si ) : m (in_m ) , base_si(in_si) { arma_debug_sigprint(); } template inline void subview_cube_slices::inplace_rand(const uword rand_mode) { arma_debug_sigprint(); Cube& m_local = const_cast< Cube& >(m); const uword m_n_slices = m_local.n_slices; const uword m_n_elem_slice = m_local.n_elem_slice; const quasi_unwrap U(base_si.get_ref()); const umat& si = U.M; arma_conform_check ( ( (si.is_vec() == false) && (si.is_empty() == false) ), "Cube::slices(): given object must be a vector" ); const uword* si_mem = si.memptr(); const uword si_n_elem = si.n_elem; for(uword si_count=0; si_count < si_n_elem; ++si_count) { const uword i = si_mem[si_count]; arma_conform_check_bounds( (i >= m_n_slices), "Cube::slices(): index out of bounds" ); eT* m_slice_ptr = m_local.slice_memptr(i); if(rand_mode == 0) { arma_rng::randu::fill(m_slice_ptr, m_n_elem_slice); } if(rand_mode == 1) { arma_rng::randn::fill(m_slice_ptr, m_n_elem_slice); } } } template template inline void subview_cube_slices::inplace_op(const eT val) { arma_debug_sigprint(); Cube& m_local = const_cast< Cube& >(m); const uword m_n_slices = m_local.n_slices; const uword m_n_elem_slice = m_local.n_elem_slice; const quasi_unwrap U(base_si.get_ref()); const umat& si = U.M; arma_conform_check ( ( (si.is_vec() == false) && (si.is_empty() == false) ), "Cube::slices(): given object must be a vector" ); const uword* si_mem = si.memptr(); const uword si_n_elem = si.n_elem; for(uword si_count=0; si_count < si_n_elem; ++si_count) { const uword i = si_mem[si_count]; arma_conform_check_bounds( (i >= m_n_slices), "Cube::slices(): index out of bounds" ); eT* m_slice_ptr = m_local.slice_memptr(i); if(is_same_type::yes) { arrayops::inplace_set (m_slice_ptr, val, m_n_elem_slice); } if(is_same_type::yes) { arrayops::inplace_plus (m_slice_ptr, val, m_n_elem_slice); } if(is_same_type::yes) { arrayops::inplace_minus(m_slice_ptr, val, m_n_elem_slice); } if(is_same_type::yes) { arrayops::inplace_mul (m_slice_ptr, val, m_n_elem_slice); } if(is_same_type::yes) { arrayops::inplace_div (m_slice_ptr, val, m_n_elem_slice); } } } template template inline void subview_cube_slices::inplace_op(const BaseCube& x) { arma_debug_sigprint(); Cube& m_local = const_cast< Cube& >(m); const uword m_n_slices = m_local.n_slices; const uword m_n_elem_slice = m_local.n_elem_slice; const quasi_unwrap U(base_si.get_ref()); const umat& si = U.M; arma_conform_check ( ( (si.is_vec() == false) && (si.is_empty() == false) ), "Cube::slices(): given object must be a vector" ); const uword* si_mem = si.memptr(); const uword si_n_elem = si.n_elem; const unwrap_cube_check tmp(x.get_ref(), m_local); const Cube& X = tmp.M; arma_conform_assert_same_size( m_local.n_rows, m_local.n_cols, si_n_elem, X.n_rows, X.n_cols, X.n_slices, "Cube::slices()" ); for(uword si_count=0; si_count < si_n_elem; ++si_count) { const uword i = si_mem[si_count]; arma_conform_check_bounds( (i >= m_n_slices), "Cube::slices(): index out of bounds" ); eT* m_slice_ptr = m_local.slice_memptr(i); const eT* X_slice_ptr = X.slice_memptr(si_count); if(is_same_type::yes) { arrayops::copy (m_slice_ptr, X_slice_ptr, m_n_elem_slice); } if(is_same_type::yes) { arrayops::inplace_plus (m_slice_ptr, X_slice_ptr, m_n_elem_slice); } if(is_same_type::yes) { arrayops::inplace_minus(m_slice_ptr, X_slice_ptr, m_n_elem_slice); } if(is_same_type::yes) { arrayops::inplace_mul (m_slice_ptr, X_slice_ptr, m_n_elem_slice); } if(is_same_type::yes) { arrayops::inplace_div (m_slice_ptr, X_slice_ptr, m_n_elem_slice); } } } // // template inline void subview_cube_slices::fill(const eT val) { arma_debug_sigprint(); inplace_op(val); } template inline void subview_cube_slices::zeros() { arma_debug_sigprint(); inplace_op(eT(0)); } template inline void subview_cube_slices::ones() { arma_debug_sigprint(); inplace_op(eT(1)); } template inline void subview_cube_slices::randu() { arma_debug_sigprint(); inplace_rand(0); } template inline void subview_cube_slices::randn() { arma_debug_sigprint(); inplace_rand(1); } template inline void subview_cube_slices::operator+= (const eT val) { arma_debug_sigprint(); inplace_op(val); } template inline void subview_cube_slices::operator-= (const eT val) { arma_debug_sigprint(); inplace_op(val); } template inline void subview_cube_slices::operator*= (const eT val) { arma_debug_sigprint(); inplace_op(val); } template inline void subview_cube_slices::operator/= (const eT val) { arma_debug_sigprint(); inplace_op(val); } // // template template inline void subview_cube_slices::operator_equ(const subview_cube_slices& x) { arma_debug_sigprint(); inplace_op(x); } template template inline void subview_cube_slices::operator= (const subview_cube_slices& x) { arma_debug_sigprint(); (*this).operator_equ(x); } //! work around compiler bugs template inline void subview_cube_slices::operator= (const subview_cube_slices& x) { arma_debug_sigprint(); (*this).operator_equ(x); } template template inline void subview_cube_slices::operator+= (const subview_cube_slices& x) { arma_debug_sigprint(); inplace_op(x); } template template inline void subview_cube_slices::operator-= (const subview_cube_slices& x) { arma_debug_sigprint(); inplace_op(x); } template template inline void subview_cube_slices::operator%= (const subview_cube_slices& x) { arma_debug_sigprint(); inplace_op(x); } template template inline void subview_cube_slices::operator/= (const subview_cube_slices& x) { arma_debug_sigprint(); inplace_op(x); } template template inline void subview_cube_slices::operator= (const BaseCube& x) { arma_debug_sigprint(); inplace_op(x); } template template inline void subview_cube_slices::operator+= (const BaseCube& x) { arma_debug_sigprint(); inplace_op(x); } template template inline void subview_cube_slices::operator-= (const BaseCube& x) { arma_debug_sigprint(); inplace_op(x); } template template inline void subview_cube_slices::operator%= (const BaseCube& x) { arma_debug_sigprint(); inplace_op(x); } template template inline void subview_cube_slices::operator/= (const BaseCube& x) { arma_debug_sigprint(); inplace_op(x); } // // template inline void subview_cube_slices::extract(Cube& out, const subview_cube_slices& in) { arma_debug_sigprint(); const Cube& m_local = in.m; const uword m_n_slices = m_local.n_slices; const uword m_n_elem_slice = m_local.n_elem_slice; const quasi_unwrap U(in.base_si.get_ref()); const umat& si = U.M; arma_conform_check ( ( (si.is_vec() == false) && (si.is_empty() == false) ), "Cube::slices(): given object must be a vector" ); const uword* si_mem = si.memptr(); const uword si_n_elem = si.n_elem; out.set_size(m_local.n_rows, m_local.n_cols, si_n_elem); for(uword si_count=0; si_count < si_n_elem; ++si_count) { const uword i = si_mem[si_count]; arma_conform_check_bounds( (i >= m_n_slices), "Cube::slices(): index out of bounds" ); eT* out_slice_ptr = out.slice_memptr(si_count); const eT* m_slice_ptr = m_local.slice_memptr(i); arrayops::copy(out_slice_ptr, m_slice_ptr, m_n_elem_slice); } } // TODO: implement a dedicated function instead of creating a temporary template inline void subview_cube_slices::plus_inplace(Cube& out, const subview_cube_slices& in) { arma_debug_sigprint(); const Cube tmp(in); out += tmp; } template inline void subview_cube_slices::minus_inplace(Cube& out, const subview_cube_slices& in) { arma_debug_sigprint(); const Cube tmp(in); out -= tmp; } template inline void subview_cube_slices::schur_inplace(Cube& out, const subview_cube_slices& in) { arma_debug_sigprint(); const Cube tmp(in); out %= tmp; } template inline void subview_cube_slices::div_inplace(Cube& out, const subview_cube_slices& in) { arma_debug_sigprint(); const Cube tmp(in); out /= tmp; } //! @} RcppArmadillo/inst/include/armadillo_bits/spglue_times_meat.hpp0000644000176200001440000002400314631567470024623 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup spglue_times //! @{ template inline void spglue_times::apply(SpMat& out, const SpGlue& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const unwrap_spmat UA(X.A); const unwrap_spmat UB(X.B); const bool is_alias = (UA.is_alias(out) || UB.is_alias(out)); if(is_alias == false) { spglue_times::apply_noalias(out, UA.M, UB.M); } else { SpMat tmp; spglue_times::apply_noalias(tmp, UA.M, UB.M); out.steal_mem(tmp); } } template inline void spglue_times::apply(SpMat& out, const SpGlue,T2,spglue_times>& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; const unwrap_spmat UA(X.A.m); const unwrap_spmat UB(X.B); const bool is_alias = (UA.is_alias(out) || UB.is_alias(out)); if(is_alias == false) { spglue_times::apply_noalias(out, UA.M, UB.M); } else { SpMat tmp; spglue_times::apply_noalias(tmp, UA.M, UB.M); out.steal_mem(tmp); } out *= X.A.aux; } template inline void spglue_times::apply_noalias(SpMat& c, const SpMat& x, const SpMat& y) { arma_debug_sigprint(); const uword x_n_rows = x.n_rows; const uword x_n_cols = x.n_cols; const uword y_n_rows = y.n_rows; const uword y_n_cols = y.n_cols; arma_conform_assert_mul_size(x_n_rows, x_n_cols, y_n_rows, y_n_cols, "matrix multiplication"); // First we must determine the structure of the new matrix (column pointers). // This follows the algorithm described in 'Sparse Matrix Multiplication // Package (SMMP)' (R.E. Bank and C.C. Douglas, 2001). Their description of // "SYMBMM" does not include anything about memory allocation. In addition it // does not consider that there may be elements which space may be allocated // for but which evaluate to zero anyway. So we have to modify the algorithm // to work that way. For the "SYMBMM" implementation we will not determine // the row indices but instead just the column pointers. //SpMat c(x_n_rows, y_n_cols); // Initializes col_ptrs to 0. c.zeros(x_n_rows, y_n_cols); //if( (x.n_elem == 0) || (y.n_elem == 0) ) { return; } if( (x.n_nonzero == 0) || (y.n_nonzero == 0) ) { return; } // Auxiliary storage which denotes when items have been found. podarray index(x_n_rows); index.fill(x_n_rows); // Fill with invalid links. typename SpMat::const_iterator y_it = y.begin(); typename SpMat::const_iterator y_end = y.end(); // SYMBMM: calculate column pointers for resultant matrix to obtain a good // upper bound on the number of nonzero elements. uword cur_col_length = 0; uword last_ind = x_n_rows + 1; do { const uword y_it_row = y_it.row(); // Look through the column that this point (*y_it) could affect. typename SpMat::const_iterator x_it = x.begin_col_no_sync(y_it_row); while(x_it.col() == y_it_row) { const uword x_it_row = x_it.row(); // A point at x(i, j) and y(j, k) implies a point at c(i, k). if(index[x_it_row] == x_n_rows) { index[x_it_row] = last_ind; last_ind = x_it_row; ++cur_col_length; } ++x_it; } const uword old_col = y_it.col(); ++y_it; // See if column incremented. if(old_col != y_it.col()) { // Set column pointer (this is not a cumulative count; that is done later). access::rw(c.col_ptrs[old_col + 1]) = cur_col_length; cur_col_length = 0; // Return index markers to zero. Use last_ind for traversal. while(last_ind != x_n_rows + 1) { const uword tmp = index[last_ind]; index[last_ind] = x_n_rows; last_ind = tmp; } } } while(y_it != y_end); // Accumulate column pointers. for(uword i = 0; i < c.n_cols; ++i) { access::rw(c.col_ptrs[i + 1]) += c.col_ptrs[i]; } // Now that we know a decent bound on the number of nonzero elements, // allocate the memory and fill it. const uword max_n_nonzero = c.col_ptrs[c.n_cols]; c.mem_resize(max_n_nonzero); // Now the implementation of the NUMBMM algorithm. uword cur_pos = 0; // Current position in c matrix. podarray sums(x_n_rows); // Partial sums. sums.zeros(); podarray sorted_indices(x_n_rows); // upper bound // last_ind is already set to x_n_rows, and cur_col_length is already set to 0. // We will loop through all columns as necessary. uword cur_col = 0; while(cur_col < c.n_cols) { // Skip to next column with elements in it. while((cur_col < c.n_cols) && (c.col_ptrs[cur_col] == c.col_ptrs[cur_col + 1])) { // Update current column pointer to actual number of nonzero elements up // to this point. access::rw(c.col_ptrs[cur_col]) = cur_pos; ++cur_col; } if(cur_col == c.n_cols) { break; } // Update current column pointer. access::rw(c.col_ptrs[cur_col]) = cur_pos; // Check all elements in this column. typename SpMat::const_iterator y_col_it = y.begin_col_no_sync(cur_col); while(y_col_it.col() == cur_col) { const uword y_col_it_row = y_col_it.row(); // Check all elements in the column of the other matrix corresponding to // the row of this column. typename SpMat::const_iterator x_col_it = x.begin_col_no_sync(y_col_it_row); const eT y_value = (*y_col_it); while(x_col_it.col() == y_col_it_row) { const uword x_col_it_row = x_col_it.row(); // A point at x(i, j) and y(j, k) implies a point at c(i, k). // Add to partial sum. const eT x_value = (*x_col_it); sums[x_col_it_row] += (x_value * y_value); // Add point if it hasn't already been marked. if(index[x_col_it_row] == x_n_rows) { index[x_col_it_row] = last_ind; last_ind = x_col_it_row; } ++x_col_it; } ++y_col_it; } // Now sort the indices that were used in this column. uword cur_index = 0; while(last_ind != x_n_rows + 1) { const uword tmp = last_ind; // Check that it wasn't a "fake" nonzero element. if(sums[tmp] != eT(0)) { // Assign to next open position. sorted_indices[cur_index] = tmp; ++cur_index; } last_ind = index[tmp]; index[tmp] = x_n_rows; } // Now sort the indices. if(cur_index != 0) { op_sort::direct_sort_ascending(sorted_indices.memptr(), cur_index); for(uword k = 0; k < cur_index; ++k) { const uword row = sorted_indices[k]; access::rw(c.row_indices[cur_pos]) = row; access::rw(c.values[cur_pos]) = sums[row]; sums[row] = eT(0); ++cur_pos; } } // Move to next column. ++cur_col; } // Update last column pointer and resize to actual memory size. // access::rw(c.col_ptrs[c.n_cols]) = cur_pos; // c.mem_resize(cur_pos); access::rw(c.col_ptrs[c.n_cols]) = cur_pos; if(cur_pos < max_n_nonzero) { c.mem_resize(cur_pos); } } // // // template inline void spglue_times_mixed::apply(SpMat::eT>& out, const mtSpGlue::eT, T1, T2, spglue_times_mixed>& expr) { arma_debug_sigprint(); typedef typename T1::elem_type eT1; typedef typename T2::elem_type eT2; typedef typename eT_promoter::eT out_eT; if( (is_same_type::no) && (is_same_type::yes) ) { // upgrade T1 const unwrap_spmat UA(expr.A); const unwrap_spmat UB(expr.B); const SpMat& A = UA.M; const SpMat& B = UB.M; SpMat AA(arma_layout_indicator(), A); for(uword i=0; i < A.n_nonzero; ++i) { access::rw(AA.values[i]) = out_eT(A.values[i]); } const SpMat& BB = reinterpret_cast< const SpMat& >(B); out = AA * BB; } else if( (is_same_type::yes) && (is_same_type::no) ) { // upgrade T2 const unwrap_spmat UA(expr.A); const unwrap_spmat UB(expr.B); const SpMat& A = UA.M; const SpMat& B = UB.M; const SpMat& AA = reinterpret_cast< const SpMat& >(A); SpMat BB(arma_layout_indicator(), B); for(uword i=0; i < B.n_nonzero; ++i) { access::rw(BB.values[i]) = out_eT(B.values[i]); } out = AA * BB; } else { // upgrade T1 and T2 const unwrap_spmat UA(expr.A); const unwrap_spmat UB(expr.B); const SpMat& A = UA.M; const SpMat& B = UB.M; SpMat AA(arma_layout_indicator(), A); SpMat BB(arma_layout_indicator(), B); for(uword i=0; i < A.n_nonzero; ++i) { access::rw(AA.values[i]) = out_eT(A.values[i]); } for(uword i=0; i < B.n_nonzero; ++i) { access::rw(BB.values[i]) = out_eT(B.values[i]); } out = AA * BB; } } //! @} RcppArmadillo/inst/include/armadillo_bits/arma_version.hpp0000644000176200001440000000276615031226014023573 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup arma_version //! @{ #define ARMA_VERSION_MAJOR 14 #define ARMA_VERSION_MINOR 6 #define ARMA_VERSION_PATCH 0 #define ARMA_VERSION_NAME "Caffe Mocha" struct arma_version { static constexpr unsigned int major = ARMA_VERSION_MAJOR; static constexpr unsigned int minor = ARMA_VERSION_MINOR; static constexpr unsigned int patch = ARMA_VERSION_PATCH; static inline std::string as_string() { const char* nickname = ARMA_VERSION_NAME; std::ostringstream ss; ss << arma_version::major << '.' << arma_version::minor << '.' << arma_version::patch << " (" << nickname << ')'; return ss.str(); } }; //! @} RcppArmadillo/inst/include/armadillo_bits/SpCol_meat.hpp0000644000176200001440000002142114634016465023140 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup SpCol //! @{ template inline SpCol::SpCol() : SpMat(arma_vec_indicator(), 1) { arma_debug_sigprint(); } template inline SpCol::SpCol(const uword in_n_elem) : SpMat(arma_vec_indicator(), in_n_elem, 1, 1) { arma_debug_sigprint(); } template inline SpCol::SpCol(const uword in_n_rows, const uword in_n_cols) : SpMat(arma_vec_indicator(), in_n_rows, in_n_cols, 1) { arma_debug_sigprint(); } template inline SpCol::SpCol(const SizeMat& s) : SpMat(arma_vec_indicator(), 0, 0, 1) { arma_debug_sigprint(); SpMat::init(s.n_rows, s.n_cols); } template inline SpCol::SpCol(const char* text) : SpMat(arma_vec_indicator(), 1) { arma_debug_sigprint(); SpMat::init(std::string(text)); } template inline SpCol& SpCol::operator=(const char* text) { arma_debug_sigprint(); SpMat::init(std::string(text)); return *this; } template inline SpCol::SpCol(const std::string& text) : SpMat(arma_vec_indicator(), 1) { arma_debug_sigprint(); SpMat::init(text); } template inline SpCol& SpCol::operator=(const std::string& text) { arma_debug_sigprint(); SpMat::init(text); return *this; } template inline SpCol& SpCol::operator=(const eT val) { arma_debug_sigprint(); SpMat::operator=(val); return *this; } template template inline SpCol::SpCol(const Base& X) : SpMat(arma_vec_indicator(), 1) { arma_debug_sigprint(); SpMat::operator=(X.get_ref()); } template inline SpCol::SpCol(const Col& X) : SpMat(arma_vec_indicator(), 1) { arma_debug_sigprint(); SpMat::operator=(X); } template template inline SpCol& SpCol::operator=(const Base& X) { arma_debug_sigprint(); SpMat::operator=(X.get_ref()); return *this; } template template inline SpCol::SpCol(const SpBase& X) : SpMat(arma_vec_indicator(), 1) { arma_debug_sigprint(); SpMat::operator=(X.get_ref()); } template template inline SpCol& SpCol::operator=(const SpBase& X) { arma_debug_sigprint(); SpMat::operator=(X.get_ref()); return *this; } template template inline SpCol::SpCol ( const SpBase::pod_type, T1>& A, const SpBase::pod_type, T2>& B ) : SpMat(arma_vec_indicator(), 1) { arma_debug_sigprint(); SpMat::init(A,B); } template inline const SpOp,spop_htrans> SpCol::t() const { return SpOp,spop_htrans>(*this); } template inline const SpOp,spop_htrans> SpCol::ht() const { return SpOp,spop_htrans>(*this); } template inline const SpOp,spop_strans> SpCol::st() const { return SpOp,spop_strans>(*this); } template inline const SpToDOp,op_sp_as_dense> SpCol::as_dense() const { return SpToDOp,op_sp_as_dense>(*this); } //! remove specified row template inline void SpCol::shed_row(const uword row_num) { arma_debug_sigprint(); arma_conform_check_bounds( row_num >= SpMat::n_rows, "SpCol::shed_row(): out of bounds" ); shed_rows(row_num, row_num); } //! remove specified rows template inline void SpCol::shed_rows(const uword in_row1, const uword in_row2) { arma_debug_sigprint(); arma_conform_check_bounds ( (in_row1 > in_row2) || (in_row2 >= SpMat::n_rows), "SpCol::shed_rows(): indices out of bounds or incorrectly used" ); SpMat::sync_csc(); const uword diff = (in_row2 - in_row1 + 1); // This is easy because everything is in one column. uword start = 0, end = 0; bool start_found = false, end_found = false; for(uword i = 0; i < SpMat::n_nonzero; ++i) { // Start position found? if(SpMat::row_indices[i] >= in_row1 && !start_found) { start = i; start_found = true; } // End position found? if(SpMat::row_indices[i] > in_row2) { end = i; end_found = true; break; } } if(!end_found) { end = SpMat::n_nonzero; } // Now we can make the copy. if(start != end) { const uword elem_diff = end - start; eT* new_values = memory::acquire (SpMat::n_nonzero - elem_diff); uword* new_row_indices = memory::acquire(SpMat::n_nonzero - elem_diff); // Copy before the section we are dropping (if it exists). if(start > 0) { arrayops::copy(new_values, SpMat::values, start); arrayops::copy(new_row_indices, SpMat::row_indices, start); } // Copy after the section we are dropping (if it exists). if(end != SpMat::n_nonzero) { arrayops::copy(new_values + start, SpMat::values + end, (SpMat::n_nonzero - end)); arrayops::copy(new_row_indices + start, SpMat::row_indices + end, (SpMat::n_nonzero - end)); arrayops::inplace_minus(new_row_indices + start, diff, (SpMat::n_nonzero - end)); } memory::release(SpMat::values); memory::release(SpMat::row_indices); access::rw(SpMat::values) = new_values; access::rw(SpMat::row_indices) = new_row_indices; access::rw(SpMat::n_nonzero) -= elem_diff; access::rw(SpMat::col_ptrs[1]) -= elem_diff; } access::rw(SpMat::n_rows) -= diff; access::rw(SpMat::n_elem) -= diff; SpMat::invalidate_cache(); } // //! insert N rows at the specified row position, // //! optionally setting the elements of the inserted rows to zero // template // inline // void // SpCol::insert_rows(const uword row_num, const uword N, const bool set_to_zero) // { // arma_debug_sigprint(); // // arma_conform_check(set_to_zero == false, "SpCol::insert_rows(): cannot set nonzero values"); // // arma_conform_check_bounds((row_num > SpMat::n_rows), "SpCol::insert_rows(): out of bounds"); // // for(uword row = 0; row < SpMat::n_rows; ++row) // { // if(SpMat::row_indices[row] >= row_num) // { // access::rw(SpMat::row_indices[row]) += N; // } // } // // access::rw(SpMat::n_rows) += N; // access::rw(SpMat::n_elem) += N; // } template inline typename SpCol::row_iterator SpCol::begin_row(const uword row_num) { arma_debug_sigprint(); arma_conform_check_bounds( (row_num >= SpMat::n_rows), "SpCol::begin_row(): index out of bounds" ); SpMat::sync_csc(); return row_iterator(*this, row_num, 0); } template inline typename SpCol::const_row_iterator SpCol::begin_row(const uword row_num) const { arma_debug_sigprint(); arma_conform_check_bounds( (row_num >= SpMat::n_rows), "SpCol::begin_row(): index out of bounds" ); SpMat::sync_csc(); return const_row_iterator(*this, row_num, 0); } template inline typename SpCol::row_iterator SpCol::end_row(const uword row_num) { arma_debug_sigprint(); arma_conform_check_bounds( (row_num >= SpMat::n_rows), "SpCol::end_row(): index out of bounds" ); SpMat::sync_csc(); return row_iterator(*this, row_num + 1, 0); } template inline typename SpCol::const_row_iterator SpCol::end_row(const uword row_num) const { arma_debug_sigprint(); arma_conform_check_bounds( (row_num >= SpMat::n_rows), "SpCol::end_row(): index out of bounds" ); SpMat::sync_csc(); return const_row_iterator(*this, row_num + 1, 0); } #if defined(ARMA_EXTRA_SPCOL_MEAT) #include ARMA_INCFILE_WRAP(ARMA_EXTRA_SPCOL_MEAT) #endif //! @} RcppArmadillo/inst/include/RcppArmadillo.h0000644000176200001440000000273114334755115020320 0ustar liggesusers // RcppArmadillo.h: Rcpp/Armadillo glue // // Copyright (C) 2010 - 2021 Dirk Eddelbuettel, Romain Francois and Douglas Bates // // This file is part of RcppArmadillo. // // RcppArmadillo is free software: you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 2 of the License, or // (at your option) any later version. // // RcppArmadillo is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with RcppArmadillo. If not, see . #ifndef RcppArmadillo__RcppArmadillo__h #define RcppArmadillo__RcppArmadillo__h #if defined(Rcpp_hpp) && !defined(COMPILING_RCPPARMADILLO) #error "The file 'Rcpp.h' should not be included. Please correct to include only 'RcppArmadillo.h'." #endif // Set up actual #include after first #include and more config #include // Now automatically include Rcpp as well #include // Remaining RcppArmadillo code #include #include #include #endif RcppArmadillo/inst/include/armadillo0000644000176200001440000010235415030514741017277 0ustar liggesusers// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ #ifndef ARMA_INCLUDES #define ARMA_INCLUDES // WARNING: the documentation (docs.html) describes the public API (functions, classes, constants); // WARNING: any functionality which is _not explicitly_ described in the documentation // WARNING: is considered as internal implementation detail, and may be changed or removed without notice. #include "armadillo_bits/config.hpp" #include "armadillo_bits/compiler_check.hpp" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #if defined(ARMA_USE_STD_MUTEX) #include #endif // #if defined(ARMA_HAVE_CXX17) // #include // #include // #endif #if ( defined(__unix__) || defined(__unix) || defined(_POSIX_C_SOURCE) || (defined(__APPLE__) && defined(__MACH__)) ) && !defined(_WIN32) #include #endif #if defined(ARMA_USE_TBB_ALLOC) #if defined(__has_include) #if __has_include() #include #else #undef ARMA_USE_TBB_ALLOC #pragma message ("WARNING: use of TBB alloc disabled; tbb/scalable_allocator.h header not found") #endif #else #include #endif #endif #if defined(ARMA_USE_MKL_ALLOC) #if defined(__has_include) #if __has_include() #include #else #undef ARMA_USE_MKL_ALLOC #pragma message ("WARNING: use of MKL alloc disabled; mkl_service.h header not found") #endif #else #include #endif #endif #include "armadillo_bits/compiler_setup.hpp" #if defined(ARMA_USE_OPENMP) #if defined(__has_include) #if __has_include() #include #else #undef ARMA_USE_OPENMP #pragma message ("WARNING: use of OpenMP disabled; omp.h header not found") #endif #else #include #endif #endif #include "armadillo_bits/include_hdf5.hpp" #include "armadillo_bits/include_superlu.hpp" //! \namespace arma namespace for Armadillo classes and functions namespace arma { // preliminaries #include "armadillo_bits/arma_forward.hpp" #include "armadillo_bits/arma_static_check.hpp" #include "armadillo_bits/typedef_elem.hpp" #include "armadillo_bits/typedef_elem_check.hpp" #include "armadillo_bits/typedef_mat.hpp" #include "armadillo_bits/arma_str.hpp" #include "armadillo_bits/arma_version.hpp" #include "armadillo_bits/arma_config.hpp" #include "armadillo_bits/traits.hpp" #include "armadillo_bits/promote_type.hpp" #include "armadillo_bits/upgrade_val.hpp" #include "armadillo_bits/restrictors.hpp" #include "armadillo_bits/access.hpp" #include "armadillo_bits/span.hpp" #include "armadillo_bits/distr_param.hpp" #include "armadillo_bits/constants.hpp" #include "armadillo_bits/constants_old.hpp" #include "armadillo_bits/mp_misc.hpp" #include "armadillo_bits/arma_rel_comparators.hpp" #include "armadillo_bits/fill.hpp" #if defined(ARMA_RNG_ALT) #include ARMA_INCFILE_WRAP(ARMA_RNG_ALT) #else #include "armadillo_bits/arma_rng_cxx03.hpp" #endif #include "armadillo_bits/arma_rng.hpp" // // class prototypes #include "armadillo_bits/Base_bones.hpp" #include "armadillo_bits/BaseCube_bones.hpp" #include "armadillo_bits/SpBase_bones.hpp" #include "armadillo_bits/def_blas.hpp" #include "armadillo_bits/def_atlas.hpp" #include "armadillo_bits/def_lapack.hpp" #include "armadillo_bits/def_arpack.hpp" #include "armadillo_bits/def_superlu.hpp" #include "armadillo_bits/def_fftw3.hpp" #include "armadillo_bits/translate_blas.hpp" #include "armadillo_bits/translate_atlas.hpp" #include "armadillo_bits/translate_lapack.hpp" #include "armadillo_bits/translate_arpack.hpp" #include "armadillo_bits/translate_superlu.hpp" #include "armadillo_bits/translate_fftw3.hpp" #include "armadillo_bits/cond_rel_bones.hpp" #include "armadillo_bits/arrayops_bones.hpp" #include "armadillo_bits/podarray_bones.hpp" #include "armadillo_bits/auxlib_bones.hpp" #include "armadillo_bits/sp_auxlib_bones.hpp" #include "armadillo_bits/injector_bones.hpp" #include "armadillo_bits/Mat_bones.hpp" #include "armadillo_bits/Col_bones.hpp" #include "armadillo_bits/Row_bones.hpp" #include "armadillo_bits/Cube_bones.hpp" #include "armadillo_bits/xvec_htrans_bones.hpp" #include "armadillo_bits/xtrans_mat_bones.hpp" #include "armadillo_bits/SizeMat_bones.hpp" #include "armadillo_bits/SizeCube_bones.hpp" #include "armadillo_bits/SpValProxy_bones.hpp" #include "armadillo_bits/SpMat_bones.hpp" #include "armadillo_bits/SpCol_bones.hpp" #include "armadillo_bits/SpRow_bones.hpp" #include "armadillo_bits/SpSubview_bones.hpp" #include "armadillo_bits/SpSubview_col_list_bones.hpp" #include "armadillo_bits/spdiagview_bones.hpp" #include "armadillo_bits/MapMat_bones.hpp" #include "armadillo_bits/typedef_mat_fixed.hpp" #include "armadillo_bits/field_bones.hpp" #include "armadillo_bits/subview_bones.hpp" #include "armadillo_bits/subview_elem1_bones.hpp" #include "armadillo_bits/subview_elem2_bones.hpp" #include "armadillo_bits/subview_field_bones.hpp" #include "armadillo_bits/subview_cube_bones.hpp" #include "armadillo_bits/diagview_bones.hpp" #include "armadillo_bits/subview_each_bones.hpp" #include "armadillo_bits/subview_cube_each_bones.hpp" #include "armadillo_bits/subview_cube_slices_bones.hpp" #include "armadillo_bits/hdf5_name.hpp" #include "armadillo_bits/csv_name.hpp" #include "armadillo_bits/diskio_bones.hpp" #include "armadillo_bits/wall_clock_bones.hpp" #include "armadillo_bits/running_stat_bones.hpp" #include "armadillo_bits/running_stat_vec_bones.hpp" #include "armadillo_bits/Op_bones.hpp" #include "armadillo_bits/CubeToMatOp_bones.hpp" #include "armadillo_bits/OpCube_bones.hpp" #include "armadillo_bits/SpOp_bones.hpp" #include "armadillo_bits/SpToDOp_bones.hpp" #include "armadillo_bits/mtSpReduceOp_bones.hpp" #include "armadillo_bits/eOp_bones.hpp" #include "armadillo_bits/eOpCube_bones.hpp" #include "armadillo_bits/mtOp_bones.hpp" #include "armadillo_bits/mtOpCube_bones.hpp" #include "armadillo_bits/mtSpOp_bones.hpp" #include "armadillo_bits/Glue_bones.hpp" #include "armadillo_bits/eGlue_bones.hpp" #include "armadillo_bits/mtGlue_bones.hpp" #include "armadillo_bits/SpGlue_bones.hpp" #include "armadillo_bits/mtSpGlue_bones.hpp" #include "armadillo_bits/SpToDGlue_bones.hpp" #include "armadillo_bits/GlueCube_bones.hpp" #include "armadillo_bits/eGlueCube_bones.hpp" #include "armadillo_bits/mtGlueCube_bones.hpp" #include "armadillo_bits/eop_core_bones.hpp" #include "armadillo_bits/eglue_core_bones.hpp" #include "armadillo_bits/Gen_bones.hpp" #include "armadillo_bits/GenCube_bones.hpp" #include "armadillo_bits/op_diagmat_bones.hpp" #include "armadillo_bits/op_diagvec_bones.hpp" #include "armadillo_bits/op_dot_bones.hpp" #include "armadillo_bits/op_det_bones.hpp" #include "armadillo_bits/op_log_det_bones.hpp" #include "armadillo_bits/op_inv_gen_bones.hpp" #include "armadillo_bits/op_inv_spd_bones.hpp" #include "armadillo_bits/op_htrans_bones.hpp" #include "armadillo_bits/op_max_bones.hpp" #include "armadillo_bits/op_min_bones.hpp" #include "armadillo_bits/op_index_max_bones.hpp" #include "armadillo_bits/op_index_min_bones.hpp" #include "armadillo_bits/op_mean_bones.hpp" #include "armadillo_bits/op_median_bones.hpp" #include "armadillo_bits/op_sort_bones.hpp" #include "armadillo_bits/op_sort_index_bones.hpp" #include "armadillo_bits/op_sum_bones.hpp" #include "armadillo_bits/op_stddev_bones.hpp" #include "armadillo_bits/op_strans_bones.hpp" #include "armadillo_bits/op_var_bones.hpp" #include "armadillo_bits/op_repmat_bones.hpp" #include "armadillo_bits/op_repelem_bones.hpp" #include "armadillo_bits/op_reshape_bones.hpp" #include "armadillo_bits/op_vectorise_bones.hpp" #include "armadillo_bits/op_resize_bones.hpp" #include "armadillo_bits/op_cov_bones.hpp" #include "armadillo_bits/op_cor_bones.hpp" #include "armadillo_bits/op_shift_bones.hpp" #include "armadillo_bits/op_shuffle_bones.hpp" #include "armadillo_bits/op_prod_bones.hpp" #include "armadillo_bits/op_pinv_bones.hpp" #include "armadillo_bits/op_dotext_bones.hpp" #include "armadillo_bits/op_flip_bones.hpp" #include "armadillo_bits/op_reverse_bones.hpp" #include "armadillo_bits/op_princomp_bones.hpp" #include "armadillo_bits/op_misc_bones.hpp" #include "armadillo_bits/op_orth_null_bones.hpp" #include "armadillo_bits/op_relational_bones.hpp" #include "armadillo_bits/op_find_bones.hpp" #include "armadillo_bits/op_find_unique_bones.hpp" #include "armadillo_bits/op_chol_bones.hpp" #include "armadillo_bits/op_cx_scalar_bones.hpp" #include "armadillo_bits/op_trimat_bones.hpp" #include "armadillo_bits/op_cumsum_bones.hpp" #include "armadillo_bits/op_cumprod_bones.hpp" #include "armadillo_bits/op_symmat_bones.hpp" #include "armadillo_bits/op_hist_bones.hpp" #include "armadillo_bits/op_unique_bones.hpp" #include "armadillo_bits/op_toeplitz_bones.hpp" #include "armadillo_bits/op_fft_bones.hpp" #include "armadillo_bits/op_any_bones.hpp" #include "armadillo_bits/op_all_bones.hpp" #include "armadillo_bits/op_normalise_bones.hpp" #include "armadillo_bits/op_clamp_bones.hpp" #include "armadillo_bits/op_expmat_bones.hpp" #include "armadillo_bits/op_nonzeros_bones.hpp" #include "armadillo_bits/op_omit_bones.hpp" #include "armadillo_bits/op_diff_bones.hpp" #include "armadillo_bits/op_norm_bones.hpp" #include "armadillo_bits/op_vecnorm_bones.hpp" #include "armadillo_bits/op_norm2est_bones.hpp" #include "armadillo_bits/op_sqrtmat_bones.hpp" #include "armadillo_bits/op_logmat_bones.hpp" #include "armadillo_bits/op_range_bones.hpp" #include "armadillo_bits/op_chi2rnd_bones.hpp" #include "armadillo_bits/op_wishrnd_bones.hpp" #include "armadillo_bits/op_roots_bones.hpp" #include "armadillo_bits/op_cond_bones.hpp" #include "armadillo_bits/op_rcond_bones.hpp" #include "armadillo_bits/op_powmat_bones.hpp" #include "armadillo_bits/op_rank_bones.hpp" #include "armadillo_bits/op_row_as_mat_bones.hpp" #include "armadillo_bits/op_col_as_mat_bones.hpp" #include "armadillo_bits/op_sp_plus_bones.hpp" #include "armadillo_bits/op_sp_minus_bones.hpp" #include "armadillo_bits/op_sp_sum_bones.hpp" #include "armadillo_bits/op_sp_max_bones.hpp" #include "armadillo_bits/op_sp_min_bones.hpp" #include "armadillo_bits/op_sp_mean_bones.hpp" #include "armadillo_bits/op_sp_var_bones.hpp" #include "armadillo_bits/op_sp_stddev_bones.hpp" #include "armadillo_bits/op_sp_vecnorm_bones.hpp" #include "armadillo_bits/op_sp_diagvec_bones.hpp" #include "armadillo_bits/op_sp_nonzeros_bones.hpp" #include "armadillo_bits/op_sp_as_dense_bones.hpp" #include "armadillo_bits/glue_times_bones.hpp" #include "armadillo_bits/glue_times_misc_bones.hpp" #include "armadillo_bits/glue_mixed_bones.hpp" #include "armadillo_bits/glue_cov_bones.hpp" #include "armadillo_bits/glue_cor_bones.hpp" #include "armadillo_bits/glue_kron_bones.hpp" #include "armadillo_bits/glue_cross_bones.hpp" #include "armadillo_bits/glue_join_bones.hpp" #include "armadillo_bits/glue_relational_bones.hpp" #include "armadillo_bits/glue_solve_bones.hpp" #include "armadillo_bits/glue_conv_bones.hpp" #include "armadillo_bits/glue_toeplitz_bones.hpp" #include "armadillo_bits/glue_hist_bones.hpp" #include "armadillo_bits/glue_histc_bones.hpp" #include "armadillo_bits/glue_max_bones.hpp" #include "armadillo_bits/glue_min_bones.hpp" #include "armadillo_bits/glue_trapz_bones.hpp" #include "armadillo_bits/glue_atan2_bones.hpp" #include "armadillo_bits/glue_hypot_bones.hpp" #include "armadillo_bits/glue_polyfit_bones.hpp" #include "armadillo_bits/glue_polyval_bones.hpp" #include "armadillo_bits/glue_intersect_bones.hpp" #include "armadillo_bits/glue_affmul_bones.hpp" #include "armadillo_bits/glue_mvnrnd_bones.hpp" #include "armadillo_bits/glue_quantile_bones.hpp" #include "armadillo_bits/glue_powext_bones.hpp" #include "armadillo_bits/gmm_misc_bones.hpp" #include "armadillo_bits/gmm_diag_bones.hpp" #include "armadillo_bits/gmm_full_bones.hpp" #include "armadillo_bits/spop_strans_bones.hpp" #include "armadillo_bits/spop_htrans_bones.hpp" #include "armadillo_bits/spop_misc_bones.hpp" #include "armadillo_bits/spop_diagmat_bones.hpp" #include "armadillo_bits/spop_trimat_bones.hpp" #include "armadillo_bits/spop_symmat_bones.hpp" #include "armadillo_bits/spop_normalise_bones.hpp" #include "armadillo_bits/spop_reverse_bones.hpp" #include "armadillo_bits/spop_repmat_bones.hpp" #include "armadillo_bits/spop_vectorise_bones.hpp" #include "armadillo_bits/spop_norm_bones.hpp" #include "armadillo_bits/spop_shift_bones.hpp" #include "armadillo_bits/spop_relational_bones.hpp" #include "armadillo_bits/spop_omit_bones.hpp" #include "armadillo_bits/spglue_plus_bones.hpp" #include "armadillo_bits/spglue_minus_bones.hpp" #include "armadillo_bits/spglue_schur_bones.hpp" #include "armadillo_bits/spglue_times_bones.hpp" #include "armadillo_bits/spglue_join_bones.hpp" #include "armadillo_bits/spglue_kron_bones.hpp" #include "armadillo_bits/spglue_min_bones.hpp" #include "armadillo_bits/spglue_max_bones.hpp" #include "armadillo_bits/spglue_merge_bones.hpp" #include "armadillo_bits/spglue_relational_bones.hpp" #include "armadillo_bits/spsolve_factoriser_bones.hpp" #if defined(ARMA_USE_NEWARP) #include "armadillo_bits/newarp_EigsSelect.hpp" #include "armadillo_bits/newarp_DenseGenMatProd_bones.hpp" #include "armadillo_bits/newarp_SparseGenMatProd_bones.hpp" #include "armadillo_bits/newarp_SparseGenRealShiftSolve_bones.hpp" #include "armadillo_bits/newarp_DoubleShiftQR_bones.hpp" #include "armadillo_bits/newarp_GenEigsSolver_bones.hpp" #include "armadillo_bits/newarp_SymEigsSolver_bones.hpp" #include "armadillo_bits/newarp_SymEigsShiftSolver_bones.hpp" #include "armadillo_bits/newarp_TridiagEigen_bones.hpp" #include "armadillo_bits/newarp_UpperHessenbergEigen_bones.hpp" #include "armadillo_bits/newarp_UpperHessenbergQR_bones.hpp" #endif // // low-level debugging and memory handling functions #include "armadillo_bits/debug.hpp" #include "armadillo_bits/memory.hpp" // // wrappers for various cmath functions #include "armadillo_bits/arma_cmath.hpp" // // classes that underlay metaprogramming #include "armadillo_bits/unwrap.hpp" #include "armadillo_bits/unwrap_cube.hpp" #include "armadillo_bits/unwrap_spmat.hpp" #include "armadillo_bits/Proxy.hpp" #include "armadillo_bits/ProxyCube.hpp" #include "armadillo_bits/SpProxy.hpp" #include "armadillo_bits/diagmat_proxy.hpp" #include "armadillo_bits/strip.hpp" #include "armadillo_bits/eop_aux.hpp" // // ostream #include "armadillo_bits/arma_ostream_bones.hpp" #include "armadillo_bits/arma_ostream_meat.hpp" // // n_unique, which is used by some sparse operators #include "armadillo_bits/fn_n_unique.hpp" // // operators #include "armadillo_bits/operator_plus.hpp" #include "armadillo_bits/operator_minus.hpp" #include "armadillo_bits/operator_times.hpp" #include "armadillo_bits/operator_schur.hpp" #include "armadillo_bits/operator_div.hpp" #include "armadillo_bits/operator_relational.hpp" #include "armadillo_bits/operator_cube_plus.hpp" #include "armadillo_bits/operator_cube_minus.hpp" #include "armadillo_bits/operator_cube_times.hpp" #include "armadillo_bits/operator_cube_schur.hpp" #include "armadillo_bits/operator_cube_div.hpp" #include "armadillo_bits/operator_cube_relational.hpp" #include "armadillo_bits/operator_ostream.hpp" // // user accessible functions // the order of the fn_*.hpp include files matters, // as some files require functionality given in preceding files #include "armadillo_bits/fn_conv_to.hpp" #include "armadillo_bits/fn_max.hpp" #include "armadillo_bits/fn_min.hpp" #include "armadillo_bits/fn_index_max.hpp" #include "armadillo_bits/fn_index_min.hpp" #include "armadillo_bits/fn_accu.hpp" #include "armadillo_bits/fn_sum.hpp" #include "armadillo_bits/fn_diagmat.hpp" #include "armadillo_bits/fn_diagvec.hpp" #include "armadillo_bits/fn_inv.hpp" #include "armadillo_bits/fn_inv_sympd.hpp" #include "armadillo_bits/fn_trace.hpp" #include "armadillo_bits/fn_trans.hpp" #include "armadillo_bits/fn_det.hpp" #include "armadillo_bits/fn_log_det.hpp" #include "armadillo_bits/fn_eig_gen.hpp" #include "armadillo_bits/fn_eig_sym.hpp" #include "armadillo_bits/fn_eig_pair.hpp" #include "armadillo_bits/fn_lu.hpp" #include "armadillo_bits/fn_zeros.hpp" #include "armadillo_bits/fn_ones.hpp" #include "armadillo_bits/fn_eye.hpp" #include "armadillo_bits/fn_misc.hpp" #include "armadillo_bits/fn_orth_null.hpp" #include "armadillo_bits/fn_regspace.hpp" #include "armadillo_bits/fn_find.hpp" #include "armadillo_bits/fn_find_unique.hpp" #include "armadillo_bits/fn_elem.hpp" #include "armadillo_bits/fn_approx_equal.hpp" #include "armadillo_bits/fn_norm.hpp" #include "armadillo_bits/fn_vecnorm.hpp" #include "armadillo_bits/fn_dot.hpp" #include "armadillo_bits/fn_randu.hpp" #include "armadillo_bits/fn_randn.hpp" #include "armadillo_bits/fn_trig.hpp" #include "armadillo_bits/fn_mean.hpp" #include "armadillo_bits/fn_median.hpp" #include "armadillo_bits/fn_stddev.hpp" #include "armadillo_bits/fn_var.hpp" #include "armadillo_bits/fn_sort.hpp" #include "armadillo_bits/fn_sort_index.hpp" #include "armadillo_bits/fn_strans.hpp" #include "armadillo_bits/fn_chol.hpp" #include "armadillo_bits/fn_qr.hpp" #include "armadillo_bits/fn_svd.hpp" #include "armadillo_bits/fn_solve.hpp" #include "armadillo_bits/fn_repmat.hpp" #include "armadillo_bits/fn_repelem.hpp" #include "armadillo_bits/fn_reshape.hpp" #include "armadillo_bits/fn_vectorise.hpp" #include "armadillo_bits/fn_resize.hpp" #include "armadillo_bits/fn_cov.hpp" #include "armadillo_bits/fn_cor.hpp" #include "armadillo_bits/fn_shift.hpp" #include "armadillo_bits/fn_shuffle.hpp" #include "armadillo_bits/fn_prod.hpp" #include "armadillo_bits/fn_eps.hpp" #include "armadillo_bits/fn_pinv.hpp" #include "armadillo_bits/fn_rank.hpp" #include "armadillo_bits/fn_kron.hpp" #include "armadillo_bits/fn_flip.hpp" #include "armadillo_bits/fn_reverse.hpp" #include "armadillo_bits/fn_as_scalar.hpp" #include "armadillo_bits/fn_princomp.hpp" #include "armadillo_bits/fn_cross.hpp" #include "armadillo_bits/fn_join.hpp" #include "armadillo_bits/fn_conv.hpp" #include "armadillo_bits/fn_trunc_exp.hpp" #include "armadillo_bits/fn_trunc_log.hpp" #include "armadillo_bits/fn_toeplitz.hpp" #include "armadillo_bits/fn_trimat.hpp" #include "armadillo_bits/fn_trimat_ind.hpp" #include "armadillo_bits/fn_cumsum.hpp" #include "armadillo_bits/fn_cumprod.hpp" #include "armadillo_bits/fn_symmat.hpp" #include "armadillo_bits/fn_sylvester.hpp" #include "armadillo_bits/fn_hist.hpp" #include "armadillo_bits/fn_histc.hpp" #include "armadillo_bits/fn_unique.hpp" #include "armadillo_bits/fn_fft.hpp" #include "armadillo_bits/fn_fft2.hpp" #include "armadillo_bits/fn_any.hpp" #include "armadillo_bits/fn_all.hpp" #include "armadillo_bits/fn_size.hpp" #include "armadillo_bits/fn_numel.hpp" #include "armadillo_bits/fn_inplace_strans.hpp" #include "armadillo_bits/fn_inplace_trans.hpp" #include "armadillo_bits/fn_randi.hpp" #include "armadillo_bits/fn_randg.hpp" #include "armadillo_bits/fn_cond_rcond.hpp" #include "armadillo_bits/fn_normalise.hpp" #include "armadillo_bits/fn_clamp.hpp" #include "armadillo_bits/fn_expmat.hpp" #include "armadillo_bits/fn_nonzeros.hpp" #include "armadillo_bits/fn_omit.hpp" #include "armadillo_bits/fn_interp1.hpp" #include "armadillo_bits/fn_interp2.hpp" #include "armadillo_bits/fn_qz.hpp" #include "armadillo_bits/fn_diff.hpp" #include "armadillo_bits/fn_hess.hpp" #include "armadillo_bits/fn_schur.hpp" #include "armadillo_bits/fn_kmeans.hpp" #include "armadillo_bits/fn_sqrtmat.hpp" #include "armadillo_bits/fn_logmat.hpp" #include "armadillo_bits/fn_trapz.hpp" #include "armadillo_bits/fn_range.hpp" #include "armadillo_bits/fn_polyfit.hpp" #include "armadillo_bits/fn_polyval.hpp" #include "armadillo_bits/fn_intersect.hpp" #include "armadillo_bits/fn_normpdf.hpp" #include "armadillo_bits/fn_log_normpdf.hpp" #include "armadillo_bits/fn_normcdf.hpp" #include "armadillo_bits/fn_mvnrnd.hpp" #include "armadillo_bits/fn_chi2rnd.hpp" #include "armadillo_bits/fn_wishrnd.hpp" #include "armadillo_bits/fn_roots.hpp" #include "armadillo_bits/fn_randperm.hpp" #include "armadillo_bits/fn_quantile.hpp" #include "armadillo_bits/fn_powmat.hpp" #include "armadillo_bits/fn_powext.hpp" #include "armadillo_bits/fn_diags_spdiags.hpp" #include "armadillo_bits/fn_balance.hpp" #include "armadillo_bits/fn_speye.hpp" #include "armadillo_bits/fn_spones.hpp" #include "armadillo_bits/fn_sprandn.hpp" #include "armadillo_bits/fn_sprandu.hpp" #include "armadillo_bits/fn_eigs_sym.hpp" #include "armadillo_bits/fn_eigs_gen.hpp" #include "armadillo_bits/fn_spsolve.hpp" #include "armadillo_bits/fn_svds.hpp" // // misc stuff #include "armadillo_bits/hdf5_misc.hpp" #include "armadillo_bits/fft_engine_kissfft.hpp" #include "armadillo_bits/fft_engine_fftw3.hpp" #include "armadillo_bits/band_helper.hpp" #include "armadillo_bits/sym_helper.hpp" #include "armadillo_bits/trimat_helper.hpp" // // classes implementing various forms of dense matrix multiplication #include "armadillo_bits/mul_gemv.hpp" #include "armadillo_bits/mul_gemm.hpp" #include "armadillo_bits/mul_gemm_mixed.hpp" #include "armadillo_bits/mul_syrk.hpp" #include "armadillo_bits/mul_herk.hpp" // // class meat #include "armadillo_bits/Op_meat.hpp" #include "armadillo_bits/CubeToMatOp_meat.hpp" #include "armadillo_bits/OpCube_meat.hpp" #include "armadillo_bits/SpOp_meat.hpp" #include "armadillo_bits/SpToDOp_meat.hpp" #include "armadillo_bits/mtOp_meat.hpp" #include "armadillo_bits/mtOpCube_meat.hpp" #include "armadillo_bits/mtSpOp_meat.hpp" #include "armadillo_bits/mtSpReduceOp_meat.hpp" #include "armadillo_bits/Glue_meat.hpp" #include "armadillo_bits/GlueCube_meat.hpp" #include "armadillo_bits/SpGlue_meat.hpp" #include "armadillo_bits/mtSpGlue_meat.hpp" #include "armadillo_bits/SpToDGlue_meat.hpp" #include "armadillo_bits/eOp_meat.hpp" #include "armadillo_bits/eOpCube_meat.hpp" #include "armadillo_bits/eGlue_meat.hpp" #include "armadillo_bits/eGlueCube_meat.hpp" #include "armadillo_bits/mtGlue_meat.hpp" #include "armadillo_bits/mtGlueCube_meat.hpp" #include "armadillo_bits/Base_meat.hpp" #include "armadillo_bits/BaseCube_meat.hpp" #include "armadillo_bits/SpBase_meat.hpp" #include "armadillo_bits/Gen_meat.hpp" #include "armadillo_bits/GenCube_meat.hpp" #include "armadillo_bits/eop_core_meat.hpp" #include "armadillo_bits/eglue_core_meat.hpp" #include "armadillo_bits/cond_rel_meat.hpp" #include "armadillo_bits/arrayops_meat.hpp" #include "armadillo_bits/podarray_meat.hpp" #include "armadillo_bits/auxlib_meat.hpp" #include "armadillo_bits/sp_auxlib_meat.hpp" #include "armadillo_bits/injector_meat.hpp" #include "armadillo_bits/Mat_meat.hpp" #include "armadillo_bits/Col_meat.hpp" #include "armadillo_bits/Row_meat.hpp" #include "armadillo_bits/Cube_meat.hpp" #include "armadillo_bits/xvec_htrans_meat.hpp" #include "armadillo_bits/xtrans_mat_meat.hpp" #include "armadillo_bits/SizeMat_meat.hpp" #include "armadillo_bits/SizeCube_meat.hpp" #include "armadillo_bits/field_meat.hpp" #include "armadillo_bits/subview_meat.hpp" #include "armadillo_bits/subview_elem1_meat.hpp" #include "armadillo_bits/subview_elem2_meat.hpp" #include "armadillo_bits/subview_field_meat.hpp" #include "armadillo_bits/subview_cube_meat.hpp" #include "armadillo_bits/diagview_meat.hpp" #include "armadillo_bits/subview_each_meat.hpp" #include "armadillo_bits/subview_cube_each_meat.hpp" #include "armadillo_bits/subview_cube_slices_meat.hpp" #include "armadillo_bits/SpValProxy_meat.hpp" #include "armadillo_bits/SpMat_meat.hpp" #include "armadillo_bits/SpMat_iterators_meat.hpp" #include "armadillo_bits/SpCol_meat.hpp" #include "armadillo_bits/SpRow_meat.hpp" #include "armadillo_bits/SpSubview_meat.hpp" #include "armadillo_bits/SpSubview_iterators_meat.hpp" #include "armadillo_bits/SpSubview_col_list_meat.hpp" #include "armadillo_bits/spdiagview_meat.hpp" #include "armadillo_bits/MapMat_meat.hpp" #include "armadillo_bits/diskio_meat.hpp" #include "armadillo_bits/wall_clock_meat.hpp" #include "armadillo_bits/running_stat_meat.hpp" #include "armadillo_bits/running_stat_vec_meat.hpp" #include "armadillo_bits/op_diagmat_meat.hpp" #include "armadillo_bits/op_diagvec_meat.hpp" #include "armadillo_bits/op_dot_meat.hpp" #include "armadillo_bits/op_det_meat.hpp" #include "armadillo_bits/op_log_det_meat.hpp" #include "armadillo_bits/op_inv_gen_meat.hpp" #include "armadillo_bits/op_inv_spd_meat.hpp" #include "armadillo_bits/op_htrans_meat.hpp" #include "armadillo_bits/op_max_meat.hpp" #include "armadillo_bits/op_index_max_meat.hpp" #include "armadillo_bits/op_index_min_meat.hpp" #include "armadillo_bits/op_min_meat.hpp" #include "armadillo_bits/op_mean_meat.hpp" #include "armadillo_bits/op_median_meat.hpp" #include "armadillo_bits/op_sort_meat.hpp" #include "armadillo_bits/op_sort_index_meat.hpp" #include "armadillo_bits/op_sum_meat.hpp" #include "armadillo_bits/op_stddev_meat.hpp" #include "armadillo_bits/op_strans_meat.hpp" #include "armadillo_bits/op_var_meat.hpp" #include "armadillo_bits/op_repmat_meat.hpp" #include "armadillo_bits/op_repelem_meat.hpp" #include "armadillo_bits/op_reshape_meat.hpp" #include "armadillo_bits/op_vectorise_meat.hpp" #include "armadillo_bits/op_resize_meat.hpp" #include "armadillo_bits/op_cov_meat.hpp" #include "armadillo_bits/op_cor_meat.hpp" #include "armadillo_bits/op_shift_meat.hpp" #include "armadillo_bits/op_shuffle_meat.hpp" #include "armadillo_bits/op_prod_meat.hpp" #include "armadillo_bits/op_pinv_meat.hpp" #include "armadillo_bits/op_dotext_meat.hpp" #include "armadillo_bits/op_flip_meat.hpp" #include "armadillo_bits/op_reverse_meat.hpp" #include "armadillo_bits/op_princomp_meat.hpp" #include "armadillo_bits/op_misc_meat.hpp" #include "armadillo_bits/op_orth_null_meat.hpp" #include "armadillo_bits/op_relational_meat.hpp" #include "armadillo_bits/op_find_meat.hpp" #include "armadillo_bits/op_find_unique_meat.hpp" #include "armadillo_bits/op_chol_meat.hpp" #include "armadillo_bits/op_cx_scalar_meat.hpp" #include "armadillo_bits/op_trimat_meat.hpp" #include "armadillo_bits/op_cumsum_meat.hpp" #include "armadillo_bits/op_cumprod_meat.hpp" #include "armadillo_bits/op_symmat_meat.hpp" #include "armadillo_bits/op_hist_meat.hpp" #include "armadillo_bits/op_unique_meat.hpp" #include "armadillo_bits/op_toeplitz_meat.hpp" #include "armadillo_bits/op_fft_meat.hpp" #include "armadillo_bits/op_any_meat.hpp" #include "armadillo_bits/op_all_meat.hpp" #include "armadillo_bits/op_normalise_meat.hpp" #include "armadillo_bits/op_clamp_meat.hpp" #include "armadillo_bits/op_expmat_meat.hpp" #include "armadillo_bits/op_nonzeros_meat.hpp" #include "armadillo_bits/op_omit_meat.hpp" #include "armadillo_bits/op_diff_meat.hpp" #include "armadillo_bits/op_norm_meat.hpp" #include "armadillo_bits/op_vecnorm_meat.hpp" #include "armadillo_bits/op_norm2est_meat.hpp" #include "armadillo_bits/op_sqrtmat_meat.hpp" #include "armadillo_bits/op_logmat_meat.hpp" #include "armadillo_bits/op_range_meat.hpp" #include "armadillo_bits/op_chi2rnd_meat.hpp" #include "armadillo_bits/op_wishrnd_meat.hpp" #include "armadillo_bits/op_roots_meat.hpp" #include "armadillo_bits/op_cond_meat.hpp" #include "armadillo_bits/op_rcond_meat.hpp" #include "armadillo_bits/op_powmat_meat.hpp" #include "armadillo_bits/op_rank_meat.hpp" #include "armadillo_bits/op_row_as_mat_meat.hpp" #include "armadillo_bits/op_col_as_mat_meat.hpp" #include "armadillo_bits/op_sp_plus_meat.hpp" #include "armadillo_bits/op_sp_minus_meat.hpp" #include "armadillo_bits/op_sp_sum_meat.hpp" #include "armadillo_bits/op_sp_max_meat.hpp" #include "armadillo_bits/op_sp_min_meat.hpp" #include "armadillo_bits/op_sp_mean_meat.hpp" #include "armadillo_bits/op_sp_var_meat.hpp" #include "armadillo_bits/op_sp_stddev_meat.hpp" #include "armadillo_bits/op_sp_vecnorm_meat.hpp" #include "armadillo_bits/op_sp_diagvec_meat.hpp" #include "armadillo_bits/op_sp_nonzeros_meat.hpp" #include "armadillo_bits/op_sp_as_dense_meat.hpp" #include "armadillo_bits/glue_times_meat.hpp" #include "armadillo_bits/glue_times_misc_meat.hpp" #include "armadillo_bits/glue_mixed_meat.hpp" #include "armadillo_bits/glue_cov_meat.hpp" #include "armadillo_bits/glue_cor_meat.hpp" #include "armadillo_bits/glue_kron_meat.hpp" #include "armadillo_bits/glue_cross_meat.hpp" #include "armadillo_bits/glue_join_meat.hpp" #include "armadillo_bits/glue_relational_meat.hpp" #include "armadillo_bits/glue_solve_meat.hpp" #include "armadillo_bits/glue_conv_meat.hpp" #include "armadillo_bits/glue_toeplitz_meat.hpp" #include "armadillo_bits/glue_hist_meat.hpp" #include "armadillo_bits/glue_histc_meat.hpp" #include "armadillo_bits/glue_max_meat.hpp" #include "armadillo_bits/glue_min_meat.hpp" #include "armadillo_bits/glue_trapz_meat.hpp" #include "armadillo_bits/glue_atan2_meat.hpp" #include "armadillo_bits/glue_hypot_meat.hpp" #include "armadillo_bits/glue_polyfit_meat.hpp" #include "armadillo_bits/glue_polyval_meat.hpp" #include "armadillo_bits/glue_intersect_meat.hpp" #include "armadillo_bits/glue_affmul_meat.hpp" #include "armadillo_bits/glue_mvnrnd_meat.hpp" #include "armadillo_bits/glue_quantile_meat.hpp" #include "armadillo_bits/glue_powext_meat.hpp" #include "armadillo_bits/gmm_misc_meat.hpp" #include "armadillo_bits/gmm_diag_meat.hpp" #include "armadillo_bits/gmm_full_meat.hpp" #include "armadillo_bits/spop_strans_meat.hpp" #include "armadillo_bits/spop_htrans_meat.hpp" #include "armadillo_bits/spop_misc_meat.hpp" #include "armadillo_bits/spop_diagmat_meat.hpp" #include "armadillo_bits/spop_trimat_meat.hpp" #include "armadillo_bits/spop_symmat_meat.hpp" #include "armadillo_bits/spop_normalise_meat.hpp" #include "armadillo_bits/spop_reverse_meat.hpp" #include "armadillo_bits/spop_repmat_meat.hpp" #include "armadillo_bits/spop_vectorise_meat.hpp" #include "armadillo_bits/spop_norm_meat.hpp" #include "armadillo_bits/spop_shift_meat.hpp" #include "armadillo_bits/spop_relational_meat.hpp" #include "armadillo_bits/spop_omit_meat.hpp" #include "armadillo_bits/spglue_plus_meat.hpp" #include "armadillo_bits/spglue_minus_meat.hpp" #include "armadillo_bits/spglue_schur_meat.hpp" #include "armadillo_bits/spglue_times_meat.hpp" #include "armadillo_bits/spglue_join_meat.hpp" #include "armadillo_bits/spglue_kron_meat.hpp" #include "armadillo_bits/spglue_min_meat.hpp" #include "armadillo_bits/spglue_max_meat.hpp" #include "armadillo_bits/spglue_merge_meat.hpp" #include "armadillo_bits/spglue_relational_meat.hpp" #include "armadillo_bits/spsolve_factoriser_meat.hpp" #if defined(ARMA_USE_NEWARP) #include "armadillo_bits/newarp_cx_attrib.hpp" #include "armadillo_bits/newarp_SortEigenvalue.hpp" #include "armadillo_bits/newarp_DenseGenMatProd_meat.hpp" #include "armadillo_bits/newarp_SparseGenMatProd_meat.hpp" #include "armadillo_bits/newarp_SparseGenRealShiftSolve_meat.hpp" #include "armadillo_bits/newarp_DoubleShiftQR_meat.hpp" #include "armadillo_bits/newarp_GenEigsSolver_meat.hpp" #include "armadillo_bits/newarp_SymEigsSolver_meat.hpp" #include "armadillo_bits/newarp_SymEigsShiftSolver_meat.hpp" #include "armadillo_bits/newarp_TridiagEigen_meat.hpp" #include "armadillo_bits/newarp_UpperHessenbergEigen_meat.hpp" #include "armadillo_bits/newarp_UpperHessenbergQR_meat.hpp" #endif } #include "armadillo_bits/compiler_setup_post.hpp" #endif RcppArmadillo/inst/include/RcppArmadilloExtensions/0000755000176200001440000000000013563233500022214 5ustar liggesusersRcppArmadillo/inst/include/RcppArmadilloExtensions/sample.h0000644000176200001440000002241013563233500023645 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- /* :tabSize=4:indentSize=4:noTabs=false:folding=explicit:collapseFolds=1: */ // // sample.h: Rcpp/Armadillo equivalent to R's sample(). // This is intended for use in C++ functions, and should *not* be called from R. // It should yield identical results to R in most cases, // and stop with errors when results are expected to differ. // // Copyright (C) 2012 - 2014 Christian Gunning // Copyright (C) 2013 Romain Francois // // This file is part of RcppArmadillo. // // RcppArmadillo is free software: you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 2 of the License, or // (at your option) any later version. // // RcppArmadillo is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with RcppArmadillo. If not, see . #ifndef RCPPARMADILLO__EXTENSIONS__SAMPLE_H #define RCPPARMADILLO__EXTENSIONS__SAMPLE_H #include namespace Rcpp{ namespace RcppArmadillo{ template T sample_main(const T &x, const int size, const bool replace, const arma::vec &prob_); void SampleNoReplace(arma::uvec &index, int nOrig, int size); void SampleReplace(arma::uvec &index, int nOrig, int size); void ProbSampleNoReplace(arma::uvec &index, int nOrig, int size, arma::vec &prob); void ProbSampleReplace(arma::uvec &index, int nOrig, int size, arma::vec &prob); void WalkerProbSampleReplace(arma::uvec &index, int nOrig, int size, arma::vec &prob); // Setup default function calls for pre-exisiting dependencies that use NumericVector // No probabilities passed in template T sample(const T &x, const int size, const bool replace){ // Creates a zero-size vector in arma (cannot directly call arma::vec(0)) const arma::vec prob = arma::zeros(0); return sample_main(x, size, replace, prob); } // Convert from NumericVector to arma vector template T sample(const T &x, const int size, const bool replace, NumericVector prob_){ const arma::vec prob(prob_.begin(), prob_.size(), false); return sample_main(x, size, replace, prob); } // Enables supplying an arma probability template T sample(const T &x, const int size, const bool replace, const arma::vec &prob_){ return sample_main(x, size, replace, prob_); } // ------ Main sampling logic // Supply any class template T sample_main(const T &x, const int size, const bool replace, const arma::vec &prob) { // Templated sample -- should work on any Rcpp Vector int ii, jj; int nOrig = x.size(); int probsize = prob.n_elem; // Create return object T ret(size); if ( size > nOrig && !replace) throw std::range_error( "Tried to sample more elements than in x without replacement" ) ; if ( !replace && (probsize==0) && nOrig > 1e+07 && size <= nOrig/2) { throw std::range_error( "R uses .Internal(sample2(n, size) for this case, which is not implemented." ) ; } // Store the sample ids here, modify in-place arma::uvec index(size); if (probsize == 0) { // No probabilities given if (replace) { SampleReplace(index, nOrig, size); } else { SampleNoReplace(index, nOrig, size); } } else { if (probsize != nOrig) throw std::range_error( "Number of probabilities must equal input vector length" ) ; // copy prob // fprob will be modified in-place // (and possibly clobbered by workers) arma::vec fprob = prob; FixProb(fprob, size, replace); // Reuse the values if (replace) { // check for walker alias conditions int walker_test = sum( (fprob * nOrig) > 0.1); if (walker_test > 200) { WalkerProbSampleReplace(index, nOrig, size, fprob); } else { ProbSampleReplace(index, nOrig, size, fprob); } } else { ProbSampleNoReplace(index, nOrig, size, fprob); } } // copy the results into the return vector for (ii=0; ii0.1 void WalkerProbSampleReplace(arma::uvec &index, int nOrig, int size, arma::vec &prob){ double rU; int ii, jj, kk; // indices, ii for loops // index tables, fill with zeros arma::vec HL_dat(nOrig); arma::vec alias_tab(nOrig); arma::vec::iterator H, L, H0, L0; //HL0 = HL_dat.begin(); H0 = H = HL_dat.begin(); L0 = L = HL_dat.end(); //prob *= nOrig; // scale probability table // fill HL_dat from beginning (small prob) and end (large prob) with indices for (ii = 0; ii < nOrig; ii++) { prob[ii] *= nOrig; if( prob[ii] < 1.0) { *(H++) = ii; } else { *(--L) = ii; } } // some of both large and small if ( (H > H0) && (L < L0) ) { for (kk = 0; kk < nOrig; kk++) { ii = HL_dat[kk]; jj = *L; alias_tab[ii] = jj; prob[jj] += (prob[ii] - 1); if (prob[jj] < 1.) L++; if(L == L0) break; // now all prob >= 1 } } for (ii = 0; ii < nOrig; ii++) prob[ii] += ii; /* generate sample */ for (ii = 0; ii < size; ii++) { rU = unif_rand() * nOrig; kk = (int) rU; index[ii] = (rU < prob[kk]) ? kk : alias_tab[kk]; } } // Unequal probability sampling without replacement void ProbSampleNoReplace(arma::uvec &index, int nOrig, int size, arma::vec &prob){ int ii, jj, kk; int nOrig_1 = nOrig - 1; double rT, mass, totalmass = 1.0; arma::uvec perm = arma::sort_index(prob, "descend"); //descending sort of index prob = arma::sort(prob, "descend"); // descending sort of prob // compute the sample for (ii = 0; ii < size; ii++, nOrig_1--) { rT = totalmass * unif_rand(); mass = 0; for (jj = 0; jj < nOrig_1; jj++) { mass += prob[jj]; if (rT <= mass) break; } index[ii] = perm[jj]; totalmass -= prob[jj]; for ( kk = jj; kk < nOrig_1; kk++) { prob[kk] = prob[kk+1]; perm[kk] = perm[kk+1]; } } } } } #endif RcppArmadillo/inst/include/RcppArmadilloExtensions/fixprob.h0000644000176200001440000000420213115077005024033 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- /* :tabSize=4:indentSize=4:noTabs=false:folding=explicit:collapseFolds=1: */ // // fixprob.h: helper function for Rcpp/Armadillo random number draws, including sample(). // Copyright (C) 2012 - 2014 Christian Gunning // Copyright (C) 2013 Romain Francois // // This file is part of RcppArmadillo. // // RcppArmadillo is free software: you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 2 of the License, or // (at your option) any later version. // // RcppArmadillo is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with RcppArmadillo. If not, see . #ifndef RCPPARMADILLO__EXTENSIONS__FIXPROB_H #define RCPPARMADILLO__EXTENSIONS__FIXPROB_H #include namespace Rcpp{ namespace RcppArmadillo{ void FixProb(arma::vec &prob, const int size, const bool replace) { // prob is modified in-place. double sum = 0.0; int ii, nPos = 0; int nn = prob.size(); for (ii = 0; ii < nn; ii++) { // pop stack double prob_value = prob(ii); if (!arma::is_finite(prob_value)) //does this work?? throw std::range_error( "NAs not allowed in probability" ) ; if (prob_value < 0.0) throw std::range_error( "Negative probabilities not allowed" ) ; if (prob_value > 0.0) { nPos++; sum += prob_value; } } if (nPos == 0 || (!replace && size > nPos)) { throw std::range_error("Not enough positive probabilities"); } prob = prob / sum; //sugar } } } #endif RcppArmadillo/inst/include/RcppArmadilloExtensions/rmultinom.h0000644000176200001440000000547413115077005024424 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- /* :tabSize=4:indentSize=4:noTabs=false:folding=explicit:collapseFolds=1: */ // // rmultinom.h: Rcpp/Armadillo equivalent to R's stats::rmultinom(). // This is intended for use in C++ functions, and should *not* be called from R. // It should yield identical results to R. // // Copyright (C) 2014 Christian Gunning // // This file is part of RcppArmadillo. // // RcppArmadillo is free software: you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 2 of the License, or // (at your option) any later version. // // RcppArmadillo is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with RcppArmadillo. If not, see . #ifndef RCPPARMADILLO__EXTENSIONS__MULTINOM_H #define RCPPARMADILLO__EXTENSIONS__MULTINOM_H #include namespace Rcpp{ namespace RcppArmadillo{ IntegerVector rmultinom(int size, NumericVector prob) { // meaning of n, size, prob as in ?rmultinom // opposite of sample() - n=number of draws double pp; int ii; int probsize = prob.size(); // Return object IntegerVector draws(probsize); if (size < 0 || size == NA_INTEGER) throw std::range_error( "Invalid size"); long double p_tot = 0.; p_tot = std::accumulate(prob.begin(), prob.end(), p_tot); if (fabs((double)(p_tot - 1.)) > 1e-7) { throw std::range_error("Probabilities don't sum to 1, please use FixProb"); } // do as rbinom if (size == 0 ) { return draws; } //rmultinom(size, REAL(prob), k, &INTEGER(ans)[ik]); // for each slot for (ii = 0; ii < probsize-1; ii++) { /* (p_tot, n) are for "remaining binomial" */ if (prob[ii]) { pp = prob[ii] / p_tot; // >= 1; > 1 happens because of rounding draws[ii] = ((pp < 1.) ? (int) Rf_rbinom((double) size, pp) : size); size -= draws[ii]; } // else { ret[ii] = 0; } // all done if (size <= 0) return draws; // i.e. p_tot = sum(prob[(k+1):K]) p_tot -= prob[ii]; } // the rest go here draws[probsize-1] = size; return draws; } } } #endif RcppArmadillo/inst/include/RcppArmadillo/0000755000176200001440000000000015031311036020125 5ustar liggesusersRcppArmadillo/inst/include/RcppArmadillo/Light0000644000176200001440000000337714334755121021145 0ustar liggesusers// Emacs, please make this -*- mode: C++; -*- // RcppArmadillo: Rcpp/Armadillo glue // // Copyright (C) 2010 - 2022 Dirk Eddelbuettel, Romain Francois and Douglas Bates // // This file is part of RcppArmadillo. // // RcppArmadillo is free software: you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 2 of the License, or // (at your option) any later version. // // RcppArmadillo is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with RcppArmadillo. If not, see . #ifndef RcppArmadillo__RcppArmadillo #define RcppArmadillo__RcppArmadillo #if defined(Rcpp_hpp) && !defined(COMPILING_RCPPARMADILLO) #error "The file 'Rcpp.h' should not be included. Please correct to include only 'RcppArmadillo.h'." #endif // We are undoing a design decision from early on by allowing vectors be returned // as standard 'one-dimension' objects -- as opposed to the matrix form we imposed #define RCPP_ARMADILLO_RETURN_ANYVEC_AS_VECTOR // Set up actual #include after first #include and more config #include // Automatically include Rcpp as well -- but only the 'light' mode sans modules #include // Remaining RcppArmadillo code #include #include #include #endif RcppArmadillo/inst/include/RcppArmadillo/Lighter0000644000176200001440000000341414334755125021470 0ustar liggesusers// Emacs, please make this -*- mode: C++; -*- // RcppArmadillo: Rcpp/Armadillo glue // // Copyright (C) 2010 - 2022 Dirk Eddelbuettel, Romain Francois and Douglas Bates // // This file is part of RcppArmadillo. // // RcppArmadillo is free software: you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 2 of the License, or // (at your option) any later version. // // RcppArmadillo is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with RcppArmadillo. If not, see . #ifndef RcppArmadillo__RcppArmadillo #define RcppArmadillo__RcppArmadillo #if defined(Rcpp_hpp) && !defined(COMPILING_RCPPARMADILLO) #error "The file 'Rcpp.h' should not be included. Please correct to include only 'RcppArmadillo.h'." #endif // We are undoing a design decision from early on by allowing vectors be returned // as standard 'one-dimension' objects -- as opposed to the matrix form we imposed #define RCPP_ARMADILLO_RETURN_ANYVEC_AS_VECTOR // Set up actual #include after first #include and more config #include // Automatically include Rcpp as well -- but only the 'lighter' mode sans modules and rtti #include // Remaining RcppArmadillo code #include #include #include #endif RcppArmadillo/inst/include/RcppArmadillo/rng/0000755000176200001440000000000014324552140020722 5ustar liggesusersRcppArmadillo/inst/include/RcppArmadillo/rng/Alt_R_RNG.h0000644000176200001440000001236214324552140022606 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- // // Copyright (C) 2013-2014 Conrad Sanderson // Copyright (C) 2013-2014 NICTA (www.nicta.com.au) // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. // // This file is based on Conrad's default generators and as such licensed under both // the MPL 2.0 for his as well as the GNU GPL 2.0 or later for my modification to it. // Copyright (C) 2014 Dirk Eddelbuettel // // This file is part of RcppArmadillo. // // RcppArmadillo is free software: you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 2 of the License, or // (at your option) any later version. // // RcppArmadillo is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with RcppArmadillo. If not, see . // NB This files use R's uniform generator and can be compiled only when the R // headers are available as is the case for RcppArmadillo. // // Also note that you MUST set / reset the R RNG state. When using RcppArmadillo // via Rcpp Atttributes or the inline package, the RNGScope object is added which // ensure this automatically. Should you build by hand, and omit both RNGScope as // as manual calls to GetRNGState() and PutRNGState() you may get unstable results. // // See http://cran.r-project.org/doc/manuals/r-devel/R-exts.html#Random-numbers class arma_rng_alt { public: typedef unsigned int seed_type; inline static void set_seed(const seed_type val); arma_inline static int randi_val(); arma_inline static double randu_val(); inline static double randn_val(); template inline static void randn_dual_val(eT& out1, eT& out2); template inline static void randi_fill(eT* mem, const uword N, const int a, const int b); inline static int randi_max_val(); }; inline void arma_rng_alt::set_seed(const arma_rng_alt::seed_type val) { // null-op, cannot set seed in R from C level code // see http://cran.r-project.org/doc/manuals/r-devel/R-exts.html#Random-numbers // // std::srand(val); (void) val; // to suppress a -Wunused warning // static int havewarned = 0; if (havewarned++ == 0) { ::Rf_warning("When called from R, the RNG seed has to be set at the R level via set.seed()"); } } arma_inline int arma_rng_alt::randi_val() { return ::Rf_runif(0, RAND_MAX); //std::rand(); } arma_inline double arma_rng_alt::randu_val() { return double(::Rf_runif(0, 1)); //return double( double(std::rand()) * ( double(1) / double(RAND_MAX) ) ); } inline double arma_rng_alt::randn_val() { // polar form of the Box-Muller transformation: // http://en.wikipedia.org/wiki/Box-Muller_transformation // http://en.wikipedia.org/wiki/Marsaglia_polar_method double tmp1; double tmp2; double w; do { tmp1 = double(2) * double(::Rf_runif(0, 1)) - double(1); tmp2 = double(2) * double(::Rf_runif(0, 1)) - double(1); //tmp1 = double(2) * double(std::rand()) * (double(1) / double(RAND_MAX)) - double(1); //tmp2 = double(2) * double(std::rand()) * (double(1) / double(RAND_MAX)) - double(1); w = tmp1*tmp1 + tmp2*tmp2; } while ( w >= double(1) ); return double( tmp1 * std::sqrt( (double(-2) * std::log(w)) / w) ); } template inline void arma_rng_alt::randn_dual_val(eT& out1, eT& out2) { // make sure we are internally using at least floats typedef typename promote_type::result eTp; eTp tmp1; eTp tmp2; eTp w; do { tmp1 = eTp(2) * eTp(::Rf_runif(0, RAND_MAX)) * (eTp(1) / eTp(RAND_MAX)) - eTp(1); tmp2 = eTp(2) * eTp(::Rf_runif(0, RAND_MAX)) * (eTp(1) / eTp(RAND_MAX)) - eTp(1); //tmp1 = eTp(2) * eTp(std::rand()) * (eTp(1) / eTp(RAND_MAX)) - eTp(1); //tmp2 = eTp(2) * eTp(std::rand()) * (eTp(1) / eTp(RAND_MAX)) - eTp(1); w = tmp1*tmp1 + tmp2*tmp2; } while ( w >= eTp(1) ); const eTp k = std::sqrt( (eTp(-2) * std::log(w)) / w); out1 = eT(tmp1*k); out2 = eT(tmp2*k); } template inline void arma_rng_alt::randi_fill(eT* mem, const uword N, const int a, const int b) { if( (a == 0) && (b == RAND_MAX) ) { for(uword i=0; i. #ifndef RcppArmadillo__RcppArmadilloConfigGenerated__h #define RcppArmadillo__RcppArmadilloConfigGenerated__h #ifndef ARMA_CRIPPLED_LAPACK // value on next line may be changed between #undef and #define by the configure script @ARMA_LAPACK@ #endif #ifndef ARMA_USE_OPENMP // from configure test for OpenMP based on how R is configured, and whether g++ new enough @ARMA_HAVE_OPENMP@ #endif #endif RcppArmadillo/inst/include/RcppArmadillo/config/RcppArmadilloConfig.h0000644000176200001440000001246214700746733025451 0ustar liggesusers // RcppArmadilloConfig.h: Rcpp/Armadillo glue // // Copyright (C) 2010 - 2022 Dirk Eddelbuettel, Romain Francois and Douglas Bates // Copyright (C) 2016 - 2022 George G. Vega Yon // Copyright (C) 2017 - 2022 Serguei Sokol // // This file is part of RcppArmadillo. // // RcppArmadillo is free software: you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 2 of the License, or // (at your option) any later version. // // RcppArmadillo is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with RcppArmadillo. If not, see . #ifndef RcppArmadillo__RcppArmadilloConfig__h #define RcppArmadillo__RcppArmadilloConfig__h #if !defined(ARMA_USE_LAPACK) #define ARMA_USE_LAPACK #endif #if !defined(ARMA_USE_BLAS) #define ARMA_USE_BLAS #endif #define ARMA_HAVE_STD_ISFINITE #define ARMA_HAVE_STD_ISINF #define ARMA_HAVE_STD_ISNAN #define ARMA_HAVE_STD_SNPRINTF /* TODO: we might need to undef this on other platforms as well */ #if defined(__GNUC__) && defined(_WIN64) || defined(__FreeBSD__) #undef ARMA_HAVE_STD_SNPRINTF #endif /* suncc does not have std::isfinite (which is not standard) so we tell armadillo not to use it, and comment out a few others while we are at it */ #if defined(__SUNPRO_CC) #undef ARMA_HAVE_STD_ISFINITE #undef ARMA_HAVE_STD_SNPRINTF #undef ARMA_HAVE_LOG1P #undef ARMA_HAVE_STD_ISINF #undef ARMA_HAVE_STD_ISNAN #endif // Let's be careful for now and undef this as not all compilers support this //#if defined(ARMA_USE_CXX11) //#undef ARMA_USE_CXX11 //#endif // If C++11 has been selected at the R package level, use it for Armadillo too // This is actually not needed, if the proper switch is set via -std=... then // Armadillo will know (cf compilation with -DARMA_EXTRA_DEBUG set) // #if defined(USE_CXX1X) // #define ARMA_USE_CXX11 // #endif // We can use R as the RNG provider, see RcppArmadilloForward.h which // enables inclusion of the appropriate headers. Alternatively, the // C++11 RNG can be used by commenting out the current default and // selecting the C++11 RNG instead. Lastly, one could (but should not) // fall back to the C++98 RNG (often from the C library) by defining neither. // Rcpp has its own stream object which cooperates more nicely with R's i/o // And as of Armadillo 2.4.3, we can use this stream object as well // // As of Armadillo 8.100.1, this has been renamed to ARMA_COUT_STREAM and // ARMA_CERR_STREAM was added // #if !defined(ARMA_COUT_STREAM) #define ARMA_COUT_STREAM Rcpp::Rcout #endif #if !defined(ARMA_CERR_STREAM) #define ARMA_CERR_STREAM Rcpp::Rcerr #endif // R now defines NDEBUG which suppresses a number of useful Armadillo tests // Users can still defined it later, and/or define ARMA_NO_DEBUG // Updated 2022-Nov to only undefined if opt-in define has been set #if defined(RCPPARMADILLO_UNDEFINE_NDEBUG) && defined(NDEBUG) #undef NDEBUG #endif // On Windows do not read autoconf-updated header #if defined(WIN32) || defined(_WIN32) // R can be built with its own Rlapack library, or use an external // one. Only the latter has zgesdd, a complex-valued SVD using divide-and-conquer // on Windows we do not assume ZGESDD #define ARMA_CRIPPLED_LAPACK 1 // on Windows we can now assume OpenMP with Rtools / gcc 4.9.3 // note that performance is said to still be poor // cf https://cran.r-project.org/doc/manuals/r-devel/R-admin.html#The-MinGW_002dw64-toolchain #define ARMA_USE_OPENMP #else // on the other OSs we test via LAPACK_LIBS (in configure) which // updates this include file #include #endif // Many client packages do not set the OpenMP compiler flag in their src/Makevars // (ie add $(SHLIB_OPENMP_CXXFLAGS) to the PKG_CXXFLAGS line as we do) so to tone // down the line noise we ask Armadillo not to print the warning #if defined(ARMA_USE_OPENMP) //#if !defined(_OPENMP) // #pragma message("NOTE: To enable OpenMP-based speedups, add -fopenmp to the compiler flags. See Writing R Extension (Sec 1.2.1) and R Inst. + Admin. (Sec 6.3.3) for details.") //#endif #define ARMA_DONT_PRINT_OPENMP_WARNING 1 #endif // Under C++11 and C++14, Armadillo now defaults to using int64_t for // integers. This prevents us from passing integer vectors to R as // only used int32_t -- so we select the shorter representation here. // Unless int64_t is explicitly required during compilation. #if !defined(ARMA_64BIT_WORD) #define ARMA_32BIT_WORD 1 #endif // To return arma::vec or arma::rowvec as R vector (i.e. dimensionless), // one of the following macro can be defined before including // RcppArmadillo.h. "ANYVEC" applys for both col- and row-vec. //#define RCPP_ARMADILLO_RETURN_COLVEC_AS_VECTOR //#define RCPP_ARMADILLO_RETURN_ROWVEC_AS_VECTOR //#define RCPP_ARMADILLO_RETURN_ANYVEC_AS_VECTOR // To preserve all dims of arma::field when passing objects to or from R // the following macro can be defined before including RcppArmadillo.h. // see https://github.com/RcppCore/RcppArmadillo/pull/352 // #define RCPP_ARMADILLO_FIX_Field #endif RcppArmadillo/inst/include/RcppArmadillo/internal/0000755000176200001440000000000014324552140021750 5ustar liggesusersRcppArmadillo/inst/include/RcppArmadillo/internal/Row_meat.h0000644000176200001440000000320614323776717023720 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- /* :tabSize=4:indentSize=4:noTabs=false:folding=explicit:collapseFolds=1: */ // // Row_meat.h: Rcpp/Armadillo glue // // Copyright (C) 2011 - 2013 Dirk Eddelbuettel, Romain Francois and Douglas Bates // // This file is part of RcppArmadillo. // // RcppArmadillo is free software: you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 2 of the License, or // (at your option) any later version. // // RcppArmadillo is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with RcppArmadillo. If not, see . #ifndef RCPPARMADILLO_ROW_MEAT_H #define RCPPARMADILLO_ROW_MEAT_H template template inline Row::Row( const Rcpp::VectorBase& X ) : Mat( X ) { arma_extra_debug_sigprint(this); std::swap( access::rw(Mat::n_rows), access::rw(Mat::n_cols) ); access::rw(Mat::vec_state) = 2; } template template inline Row::Row( const Rcpp::MatrixBase& X ) : Mat( X ) { arma_extra_debug_sigprint(this); arma_debug_check( (Mat::n_rows > 1), "Row(): incompatible dimensions" ); access::rw(Mat::vec_state) = 2; } #endif RcppArmadillo/inst/include/RcppArmadillo/internal/Col_meat.h0000644000176200001440000000312114323776717023662 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- /* :tabSize=4:indentSize=4:noTabs=false:folding=explicit:collapseFolds=1: */ // // Col_meat.h: Rcpp/Armadillo glue // // Copyright (C) 2011 - 2013 Dirk Eddelbuettel, Romain Francois and Douglas Bates // // This file is part of RcppArmadillo. // // RcppArmadillo is free software: you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 2 of the License, or // (at your option) any later version. // // RcppArmadillo is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with RcppArmadillo. If not, see . #ifndef RCPPARMADILLO_COL_MEAT_H #define RCPPARMADILLO_COL_MEAT_H template template inline Col::Col( const Rcpp::VectorBase& X ) : Mat( X ) { arma_extra_debug_sigprint(this); access::rw(Mat::vec_state) = 1; } template template inline Col::Col( const Rcpp::MatrixBase& X ) : Mat( X ) { arma_extra_debug_sigprint(this); arma_debug_check( (Mat::n_cols > 1), "Col(): incompatible dimensions" ); access::rw(Mat::vec_state) = 1; } #endif RcppArmadillo/inst/include/RcppArmadillo/internal/Mat_meat.h0000644000176200001440000001077414323776717023702 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- /* :tabSize=4:indentSize=4:noTabs=false:folding=explicit:collapseFolds=1: */ // // Mat_meat.h: Rcpp/Armadillo glue // // Copyright (C) 2010 - 2013 Dirk Eddelbuettel, Romain Francois and Douglas Bates // // This file is part of RcppArmadillo. // // RcppArmadillo is free software: you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 2 of the License, or // (at your option) any later version. // // RcppArmadillo is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with RcppArmadillo. If not, see . #ifndef RCPPARMADILLO_MAT_MEAT_H #define RCPPARMADILLO_MAT_MEAT_H namespace RcppArmadillo{ template inline void check(){ #if !defined(ARMA_USE_CXX11) arma_type_check_cxx1998< is_same_type< eT, rcpp_type >::value == false >::apply(); #else static_assert( is_same_type< eT, rcpp_type >::value , "error: incorrect or unsupported type" ); #endif } template <> inline void check< std::complex, Rcomplex >(){} template inline void fill_ptr__impl( eT* ptr, const Rcpp::VectorBase& X, u32 n_elem, ::Rcpp::traits::true_type ){ for( u32 i=0; i::type, eT>( X[i] ) ; } } template inline void fill_ptr__impl( eT* ptr, const Rcpp::VectorBase& X, u32 n_elem, ::Rcpp::traits::false_type ){ for( u32 i=0; i inline void fill_ptr( eT* ptr, const Rcpp::VectorBase& X, u32 n_elem ){ return fill_ptr__impl( ptr, X, n_elem, typename ::Rcpp::traits::r_sexptype_needscast() ) ; } template inline void fill_ptr_matrix__impl( eT* ptr, const Rcpp::MatrixBase& X, u32 nr, u32 nc, ::Rcpp::traits::true_type ){ u32 k, i_col, i_row ; for( i_col=0, k=0 ; i_col < nc; ++i_col){ for( i_row = 0; i_row < nr ; ++i_row, ++k ){ ptr[k] = Rcpp::internal::caster< typename Rcpp::traits::storage_type::type, eT>( X(i_row,i_col)) ; } } } template inline void fill_ptr_matrix__impl( eT* ptr, const Rcpp::MatrixBase& X, u32 nr, u32 nc, ::Rcpp::traits::false_type ){ u32 k, i_col, i_row ; for( i_col=0, k=0 ; i_col < nc; ++i_col){ for( i_row = 0; i_row < nr ; ++i_row, ++k ){ ptr[k] = X(i_row,i_col) ; } } } template inline void fill_ptr_matrix( eT* ptr, const Rcpp::MatrixBase& X, u32 nr, u32 nc){ return fill_ptr_matrix__impl( ptr, X, nr, nc, typename ::Rcpp::traits::r_sexptype_needscast() ) ; } } template template inline Mat::Mat( const Rcpp::VectorBase& X ) : n_rows(0) , n_cols(0) , n_elem(0) , n_alloc(0) , vec_state(0) , mem_state(0) , mem(0) { arma_extra_debug_sigprint_this(this); RcppArmadillo::check::type >() ; set_size(X.size(), 1); RcppArmadillo::fill_ptr( memptr(), X, n_elem ) ; } template template inline Mat::Mat( const Rcpp::MatrixBase& X ) : n_rows(0) , n_cols(0) , n_elem(0) , n_alloc(0) , vec_state(0) , mem_state(0) , mem(0) { arma_extra_debug_sigprint_this(this); RcppArmadillo::check::type >() ; u32 nr = X.nrow(), nc = X.ncol() ; set_size( nr, nc ) ; RcppArmadillo::fill_ptr_matrix( memptr(), X, nr, nc ); } #endif RcppArmadillo/inst/include/RcppArmadillo/internal/Mat_proto.h0000644000176200001440000000237014323776717024110 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- /* :tabSize=4:indentSize=4:noTabs=false:folding=explicit:collapseFolds=1: */ // // Mat_proto.h: Rcpp/Armadillo glue // // Copyright (C) 2010 - 2013 Dirk Eddelbuettel, Romain Francois and Douglas Bates // // This file is part of RcppArmadillo. // // RcppArmadillo is free software: you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 2 of the License, or // (at your option) any later version. // // RcppArmadillo is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with RcppArmadillo. If not, see . #ifndef RCPPARMADILLO_MAT_PROTO_H #define RCPPARMADILLO_MAT_PROTO_H template inline Mat( const Rcpp::VectorBase& X ) ; template inline Mat( const Rcpp::MatrixBase& X ) ; #endif RcppArmadillo/inst/include/RcppArmadillo/internal/Col_proto.h0000644000176200001440000000237014323776717024104 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- /* :tabSize=4:indentSize=4:noTabs=false:folding=explicit:collapseFolds=1: */ // // Col_proto.h: Rcpp/Armadillo glue // // Copyright (C) 2010 - 2013 Dirk Eddelbuettel, Romain Francois and Douglas Bates // // This file is part of RcppArmadillo. // // RcppArmadillo is free software: you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 2 of the License, or // (at your option) any later version. // // RcppArmadillo is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with RcppArmadillo. If not, see . #ifndef RCPPARMADILLO_COL_PROTO_H #define RCPPARMADILLO_COL_PROTO_H template inline Col( const Rcpp::VectorBase& X ) ; template inline Col( const Rcpp::MatrixBase& X ) ; #endif RcppArmadillo/inst/include/RcppArmadillo/internal/Row_proto.h0000644000176200001440000000237014323776717024136 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- /* :tabSize=4:indentSize=4:noTabs=false:folding=explicit:collapseFolds=1: */ // // Row_proto.h: Rcpp/Armadillo glue // // Copyright (C) 2010 - 2013 Dirk Eddelbuettel, Romain Francois and Douglas Bates // // This file is part of RcppArmadillo. // // RcppArmadillo is free software: you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 2 of the License, or // (at your option) any later version. // // RcppArmadillo is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with RcppArmadillo. If not, see . #ifndef RCPPARMADILLO_ROW_PROTO_H #define RCPPARMADILLO_ROW_PROTO_H template inline Row( const Rcpp::VectorBase& X ) ; template inline Row( const Rcpp::MatrixBase& X ) ; #endif RcppArmadillo/inst/include/RcppArmadillo/Alt_R_RNG.h0000644000176200001440000000016714324552140022020 0ustar liggesusers // This file support the legacy location and includes from the new location #include "RcppArmadillo/rng/Alt_R_RNG.h" RcppArmadillo/inst/include/RcppArmadillo/Lightest0000644000176200001440000000342214334755136021656 0ustar liggesusers// Emacs, please make this -*- mode: C++; -*- // RcppArmadillo: Rcpp/Armadillo glue // // Copyright (C) 2010 - 2022 Dirk Eddelbuettel, Romain Francois and Douglas Bates // // This file is part of RcppArmadillo. // // RcppArmadillo is free software: you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 2 of the License, or // (at your option) any later version. // // RcppArmadillo is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with RcppArmadillo. If not, see . #ifndef RcppArmadillo__RcppArmadillo #define RcppArmadillo__RcppArmadillo #if defined(Rcpp_hpp) && !defined(COMPILING_RCPPARMADILLO) #error "The file 'Rcpp.h' should not be included. Please correct to include only 'RcppArmadillo.h'." #endif // We are undoing a design decision from early on by allowing vectors be returned // as standard 'one-dimension' objects -- as opposed to the matrix form we imposed #define RCPP_ARMADILLO_RETURN_ANYVEC_AS_VECTOR // Set up actual #include after first #include and more config #include // Automatically include Rcpp as well -- but only the 'lightest' mode sans modules, rtti, sugar #include // Remaining RcppArmadillo code #include #include #include #endif RcppArmadillo/inst/include/RcppArmadillo/interface/0000755000176200001440000000000014701771373022106 5ustar liggesusersRcppArmadillo/inst/include/RcppArmadillo/interface/RcppArmadilloForward.h0000644000176200001440000001271314641716521026336 0ustar liggesusers// // RcppArmadilloForward.h: Rcpp/Armadillo glue // // Copyright (C) 2010 - 2023 Dirk Eddelbuettel, Romain Francois and Douglas Bates // Copyright (C) 2019 - 2023 Conrad Sanderson // // This file is part of RcppArmadillo. // // RcppArmadillo is free software: you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 2 of the License, or // (at your option) any later version. // // RcppArmadillo is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with RcppArmadillo. If not, see . #ifndef RcppArmadillo__RcppArmadilloForward__h #define RcppArmadillo__RcppArmadilloForward__h #include #include #include #define ARMA_EXTRA_MAT_PROTO RcppArmadillo/internal/Mat_proto.h #define ARMA_EXTRA_MAT_MEAT RcppArmadillo/internal/Mat_meat.h #define ARMA_EXTRA_COL_PROTO RcppArmadillo/internal/Col_proto.h #define ARMA_EXTRA_COL_MEAT RcppArmadillo/internal/Col_meat.h #define ARMA_EXTRA_ROW_PROTO RcppArmadillo/internal/Row_proto.h #define ARMA_EXTRA_ROW_MEAT RcppArmadillo/internal/Row_meat.h // Using this define makes the R RNG have precedent over both the // C++11-based RNG provided by Armadillo, as well as the C++98-based // fallback. // // One can use the C++11-based on by commenting out the following // #define and also selecting C++11 (eg via src/Makevars* or the // DESCRIPTION file) and/or defining #define-ing ARMA_USE_CXX11_RNG #define ARMA_RNG_ALT RcppArmadillo/rng/Alt_R_RNG.h // Workaround to mitigate possible interference from a system-level // installation of Armadillo #define ARMA_DONT_USE_WRAPPER // Armadillo has deprecation warnings (which RcppArmadillo suppressed at time to // minimise issies at CRAN). Should your package display any, and you decide // _not_ to fix the root causes (see RcppArmadillo GitHub Issues #391 and #402 // for details) then defining the following macro will help. You can add a // #define in your source code before including the RcppArmadillo header, or add // a -DARMA_IGNORE_DEPRECATED_MARKER to the PKG_CPPFLAGS in src/Makevars. // Renabling globally for 14.0.0 release #define ARMA_IGNORE_DEPRECATED_MARKER #include "armadillo" /* forward declarations */ namespace Rcpp { /* support for wrap */ template SEXP wrap ( const arma::Mat& ) ; template SEXP wrap ( const arma::Row& ) ; template SEXP wrap ( const arma::Col& ) ; template SEXP wrap ( const arma::field& ) ; template SEXP wrap ( const arma::Cube& ) ; template SEXP wrap ( const arma::subview& ) ; template SEXP wrap ( const arma::subview_cols& ) ; template SEXP wrap ( const arma::SpMat& ) ; template SEXP wrap(const arma::Glue& X ) ; template SEXP wrap(const arma::Op& X ) ; template SEXP wrap(const arma::eGlue& X ) ; template SEXP wrap(const arma::eOp& X ) ; template SEXP wrap(const arma::OpCube& X ) ; template SEXP wrap(const arma::GlueCube& X ) ; template SEXP wrap(const arma::eOpCube& X ) ; template SEXP wrap(const arma::eGlueCube& X ) ; template SEXP wrap( const arma::mtOp& X ) ; template SEXP wrap( const arma::mtGlue& X ); template SEXP wrap( const arma::Gen& X) ; template SEXP wrap( const arma::GenCube& X) ; namespace traits { /* support for as */ template class Exporter< arma::Mat > ; template class Exporter< arma::Row > ; template class Exporter< arma::Col > ; template class Exporter< arma::SpMat > ; template class Exporter< arma::field > ; // template class Exporter< arma::Cube > ; } // namespace traits template class ConstReferenceInputParameter< arma::Mat > ; template class ReferenceInputParameter< arma::Mat > ; template class ConstInputParameter< arma::Mat > ; template class ConstReferenceInputParameter< arma::Col > ; template class ReferenceInputParameter< arma::Col > ; template class ConstInputParameter< arma::Col > ; template class ConstReferenceInputParameter< arma::Row > ; template class ReferenceInputParameter< arma::Row > ; template class ConstInputParameter< arma::Row > ; } #endif RcppArmadillo/inst/include/RcppArmadillo/interface/RcppArmadilloAs.h0000644000176200001440000005504414701771373025304 0ustar liggesusers // RcppArmadilloAs.h: Rcpp/Armadillo glue, support for as // // Copyright (C) 2013 - 2021 Dirk Eddelbuettel and Romain Francois // Copyright (C) 2017 - 2021 Serguei Sokol // // This file is part of RcppArmadillo. // // RcppArmadillo is free software: you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 2 of the License, or // (at your option) any later version. // // RcppArmadillo is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with RcppArmadillo. If not, see . #ifndef RcppArmadillo__RcppArmadilloAs__h #define RcppArmadillo__RcppArmadilloAs__h namespace Rcpp{ namespace traits { template class Exporter< arma::field > { public: Exporter(SEXP x) : data(x){} inline arma::field get() { size_t n = data.size(); arma::field out(n); # if defined(RCPP_ARMADILLO_FIX_Field) if (!Rf_isNull(data.attr("dim"))) { arma::ivec dims = data.attr("dim"); if (dims.n_elem == 1) { out.set_size(n); } else if (dims.n_elem == 2) { out.set_size(dims(0), dims(1)); } else if (dims.n_elem == 3) { out.set_size(dims(0), dims(1), dims(2)); } } # endif for (size_t i = 0; i < n; i++) { out(i) = as(data[i]); } return out ; } private: List data ; }; template class Exporter< arma::Col > : public IndexingExporter< arma::Col, T > { public: Exporter(SEXP x) : IndexingExporter< arma::Col, T >(x){} }; template class Exporter< arma::Row > : public IndexingExporter< arma::Row, T > { public: Exporter(SEXP x) : IndexingExporter< arma::Row, T >(x){} }; template class Exporter< arma::Mat > : public MatrixExporter< arma::Mat, T > { public: Exporter(SEXP x) : MatrixExporter< arma::Mat, T >(x){} }; template class Exporter< const arma::Mat& > { public: typedef typename Rcpp::Matrix< Rcpp::traits::r_sexptype_traits::rtype > MATRIX ; Exporter(SEXP x) : mat(x) {} inline arma::Mat* get(){ return new arma::Mat( mat.begin(), mat.nrow(), mat.ncol(), false ) ; } private: MATRIX mat ; }; // 14 June 2017 // Add support for sparse matrices other than dgCMatrix template class Exporter< arma::SpMat > { public: Exporter( SEXP x ) { is_stm=Rf_inherits(x, "simple_triplet_matrix"); if (is_stm) { li = x; } else { mat = x; } } arma::SpMat get(){ const int RTYPE = Rcpp::traits::r_sexptype_traits::rtype; if (is_stm) { arma::urowvec ti = as(li["i"]); arma::urowvec tj = as(li["j"]); arma::Col tx = li["v"]; arma::SpMat res = arma::sp_mat(true, arma::join_cols(ti, tj)-1, tx, li["nrow"], li["ncol"], true, false); return res; } IntegerVector dims = mat.slot("Dim"); int nrow = dims[0]; int ncol = dims[1]; // Creating an empty SpMat arma::SpMat res(static_cast(nrow), static_cast(ncol)); // Get the type of sparse matrix std::string type = Rcpp::as(mat.slot("class")); if (type == "dgCMatrix" || mat.is("dgCMatrix")) { IntegerVector i = mat.slot("i"); IntegerVector p = mat.slot("p"); Vector x = mat.slot("x"); #define DO_RESULT \ do { \ /* Allocate: */ \ res.mem_resize(static_cast(x.size())); \ \ /* To access arrays internal to SpMat class: */ \ res.sync(); \ \ /* Copy: */ \ std::copy(i.begin(), i.end(), \ arma::access::rwp(res.row_indices)); \ std::copy(p.begin(), p.end(), \ arma::access::rwp(res.col_ptrs)); \ std::copy(x.begin(), x.end(), \ arma::access::rwp(res.values)); \ } while (0) DO_RESULT; } else if (type == "dtCMatrix" || mat.is("dtCMatrix")) { IntegerVector i = mat.slot("i"); IntegerVector p = mat.slot("p"); Vector x = mat.slot("x"); std::string diag = Rcpp::as(mat.slot("diag")); DO_RESULT; if (diag == "U") { res.diag().ones(); } } else if (type == "dsCMatrix" || mat.is("dsCMatrix")) { IntegerVector i = mat.slot("i"); IntegerVector p = mat.slot("p"); Vector x = mat.slot("x"); std::string uplo = Rcpp::as(mat.slot("uplo")); DO_RESULT; if (uplo == "U") { res = symmatu(res); } else { res = symmatl(res); } } else if (type == "dgTMatrix" || mat.is("dgTMatrix")) { arma::urowvec ti = mat.slot("i"); arma::urowvec tj = mat.slot("j"); arma::Col tx = mat.slot("x"); res = arma::sp_mat(true, arma::join_cols(ti, tj), tx, nrow, ncol, true, false); } else if (type == "dtTMatrix" || mat.is("dtTMatrix")) { arma::urowvec ti = mat.slot("i"); arma::urowvec tj = mat.slot("j"); arma::Col tx = mat.slot("x"); res = arma::sp_mat(true, arma::join_cols(ti, tj), tx, nrow, ncol, true, false); if (Rcpp::as(mat.slot("diag")) == "U") { res.diag().ones(); } } else if (type == "dsTMatrix" || mat.is("dsTMatrix")) { arma::urowvec ti = mat.slot("i"); arma::urowvec tj = mat.slot("j"); arma::Col tx = mat.slot("x"); res = arma::sp_mat(true, arma::join_cols(ti, tj), tx, nrow, ncol, true, false); res = Rcpp::as(mat.slot("uplo")) == "U" ? symmatu(res) : symmatl(res); } else if (type == "dgRMatrix" || mat.is("dgRMatrix")) { IntegerVector rj = mat.slot("j"); IntegerVector rp = mat.slot("p"); Vector rx = mat.slot("x"); int nnz = rx.size(); IntegerVector i = IntegerVector(nnz); IntegerVector p = IntegerVector(ncol + 1); Vector x = Vector(nnz); // Count the nnz in each column for(int n = 0; n < nnz; n++){ p[rj[n] + 1]++; } // Cumsum p for(int col = 0, cumsum = 0; col < ncol + 1; col++){ cumsum += p[col]; p[col] = cumsum; } // https://github.com/scipy/scipy/blob/master/scipy/sparse/sparsetools/csr.h#L436 // Calculate i&x for(int row = 0; row < nrow; row++){ for(int tmp = rp[row]; tmp < rp[row + 1]; tmp++){ int col = rj[tmp]; int dest = p[col]; i[dest] = row; x[dest] = rx[tmp]; p[col]++; } } // Fix the p for(int col = 0, last = 0; col <= ncol; col++){ int tmp = p[col]; p[col] = last; last = tmp; } DO_RESULT; } else if (type == "dtRMatrix" || mat.is("dtRMatrix")) { IntegerVector rj = mat.slot("j"); IntegerVector rp = mat.slot("p"); Vector rx = mat.slot("x"); std::string diag = Rcpp::as(mat.slot("diag")); int nnz = rx.size(); IntegerVector i = IntegerVector(nnz); IntegerVector p = IntegerVector(ncol + 1); Vector x = Vector(nnz); // Count the nnz in each column for(int n = 0; n < nnz; n++){ p[rj[n] + 1]++; } // Cumsum p for(int col = 0, cumsum = 0; col < ncol + 1; col++){ cumsum += p[col]; p[col] = cumsum; } // https://github.com/scipy/scipy/blob/master/scipy/sparse/sparsetools/csr.h#L436 // Calculate i&x for(int row = 0; row < nrow; row++){ for(int tmp = rp[row]; tmp < rp[row + 1]; tmp++){ int col = rj[tmp]; int dest = p[col]; i[dest] = row; x[dest] = rx[tmp]; p[col]++; } } // Fix the p for(int col = 0, last = 0; col <= ncol; col++){ int tmp = p[col]; p[col] = last; last = tmp; } DO_RESULT; if (diag == "U"){ res.diag().ones(); } } else if (type == "dsRMatrix" || mat.is("dsRMatrix")) { IntegerVector rj = mat.slot("j"); IntegerVector rp = mat.slot("p"); Vector rx = mat.slot("x"); std::string uplo = Rcpp::as(mat.slot("uplo")); int nnz = rx.size(); IntegerVector i = IntegerVector(nnz); IntegerVector p = IntegerVector(ncol + 1); Vector x = Vector(nnz); // Count the nnz in each column for(int n = 0; n < nnz; n++){ p[rj[n] + 1]++; } // Cumsum p for(int col = 0, cumsum = 0; col < ncol + 1; col++){ cumsum += p[col]; p[col] = cumsum; } // https://github.com/scipy/scipy/blob/master/scipy/sparse/sparsetools/csr.h#L436 // Calculate i&x for(int row = 0; row < nrow; row++){ for(int tmp = rp[row]; tmp < rp[row + 1]; tmp++){ int col = rj[tmp]; int dest = p[col]; i[dest] = row; x[dest] = rx[tmp]; p[col]++; } } // Fix the p for(int col = 0, last = 0; col <= ncol; col++){ int tmp = p[col]; p[col] = last; last = tmp; } DO_RESULT; if (uplo == "U") { res = symmatu(res); } else { res = symmatl(res); } } else if (type == "indMatrix" || mat.is("indMatrix")) { IntegerVector perm = mat.slot("perm"); IntegerVector p(ncol + 1); IntegerVector i(perm.size()); IntegerVector x(perm.size()); if (!mat.hasSlot("margin") || as(mat.slot("margin"))[0] == 1) { int *work = reinterpret_cast( R_alloc((std::size_t) ncol, sizeof(int))); std::memset(work, 0, ncol * sizeof(int)); for (int ii = 0; ii < nrow; ++ii) work[perm[ii] - 1]++; for (int jj = 0; jj < ncol; ++jj) { p[jj + 1] = p[jj] + work[jj]; work[jj] = p[jj]; } for (int ii = 0; ii < nrow; ++ii) { i[work[perm[ii] - 1]++] = ii; x[ii] = 1; } } else { for (int jj = 0; jj < ncol; ++jj) { p[jj] = jj; i[jj] = perm[jj] - 1; x[jj] = 1; } p[ncol] = ncol; } DO_RESULT; } else if (type == "pMatrix" || mat.is("pMatrix")) { IntegerVector perm = mat.slot("perm"); IntegerVector p(ncol + 1); IntegerVector i(ncol); IntegerVector x(ncol); if (!mat.hasSlot("margin") || as(mat.slot("margin"))[0] == 1) { for (int jj = 0; jj < ncol; ++jj) { p[jj] = jj; i[perm[jj] - 1] = jj; x[jj] = 1; } } else { for (int jj = 0; jj < ncol; ++jj) { p[jj] = jj; i[jj] = perm[jj] - 1; x[jj] = 1; } } p[ncol] = ncol; DO_RESULT; } else if (type == "ddiMatrix" || mat.is("ddiMatrix")) { std::vector i; std::vector p; std::vector x; std::string diag = Rcpp::as(mat.slot("diag")); if (diag == "U") { for(int idx = 0; idx < ncol; idx++){ i.push_back(idx); p.push_back(idx); x.push_back(1); } p.push_back(ncol); } else { Vector tmpx = mat.slot("x"); int tmpp = 0; for(int idx = 0; idx < ncol; idx++){ p.push_back(tmpp); if (tmpx[idx] != 0) { i.push_back(idx); x.push_back(tmpx[idx]); tmpp++; } } p.push_back(tmpp); } DO_RESULT; #undef DO_RESULT } else { Rcpp::stop(type + " is not supported."); } // In order to access the internal arrays of the SpMat class res.sync(); // Setting the sentinel arma::access::rw(res.col_ptrs[static_cast(ncol + 1)]) = std::numeric_limits::max(); return res; } private: S4 mat ; List li; bool is_stm; } ; // 30 November 2015 // default Exporter-Cube specialization: // handles cube, icube, and cx_cube // fails on fcube, ucube, and cx_fcube template class Exporter< arma::Cube > { public: typedef arma::Cube cube_t; enum { RTYPE = Rcpp::traits::r_sexptype_traits::rtype }; typedef typename Rcpp::traits::storage_type::type value_t; Exporter(SEXP x) : vec(x) {} cube_t get() { Rcpp::Vector dims = vec.attr("dim"); if (dims.size() != 3) { std::string msg = "Error converting object to arma::Cube:\n" "Input array must have exactly 3 dimensions.\n"; Rcpp::stop(msg); } cube_t result( reinterpret_cast(vec.begin()), dims[0], dims[1], dims[2], false); return result; } private: Rcpp::Vector vec; }; // specializations for 3 (or 4, see below) cube typedefs that // fail above first use viable conversion SEXP -> Cube // then use conv_to::from(other_t other) #ifdef ARMA_64BIT_WORD // if we use ARMA_64BIT_WORD we cannot pass int through and // need a fourth specialization similar to the other three template <> class Exporter { public: typedef arma::icube cube_t; Exporter(SEXP x) : tmp(Exporter(x).get()) {} cube_t get() { cube_t result = arma::conv_to::from(tmp); return result; } private: typedef arma::cube other_t; other_t tmp; }; #endif template <> class Exporter { public: typedef arma::fcube cube_t; Exporter(SEXP x) : tmp(Exporter(x).get()) {} cube_t get() { cube_t result = arma::conv_to::from(tmp); return result; } private: typedef arma::cube other_t; other_t tmp; }; template <> class Exporter { public: typedef arma::ucube cube_t; Exporter(SEXP x) : tmp(Exporter(x).get()) {} cube_t get() { cube_t result = arma::conv_to::from(tmp); return result; } private: typedef arma::icube other_t; other_t tmp; }; template <> class Exporter { public: typedef arma::cx_fcube cube_t; Exporter(SEXP x) : tmp(Exporter(x).get()) {} cube_t get() { cube_t result = arma::conv_to::from(tmp); return result; } private: typedef arma::cx_cube other_t; other_t tmp; }; } // end traits /* Begin Armadillo vector as support classes */ template ::type> class ArmaMat_InputParameter; template class ArmaMat_InputParameter { public: ArmaMat_InputParameter(SEXP x_) : m(x_), mat(reinterpret_cast(m.begin()), m.nrow(), m.ncol(), false) {} inline operator REF(){ return mat ; } private: Rcpp::Matrix< Rcpp::traits::r_sexptype_traits::rtype > m ; MAT mat ; } ; template class ArmaMat_InputParameter { public: ArmaMat_InputParameter( SEXP x_ ): m(x_), mat( as(m) ) {} inline operator REF(){ return mat ; } private: Rcpp::Matrix< Rcpp::traits::r_sexptype_traits::rtype > m ; MAT mat ; } ; /* End Armadillo vector as support classes */ /* Begin Armadillo vector as support classes */ template ::type> class ArmaVec_InputParameter; template class ArmaVec_InputParameter { public: ArmaVec_InputParameter( SEXP x_ ) : v(x_), vec( reinterpret_cast( v.begin() ), v.size(), false ){} inline operator REF(){ return vec ; } private: Rcpp::Vector< Rcpp::traits::r_sexptype_traits::rtype > v ; VEC vec ; } ; template class ArmaVec_InputParameter { public: ArmaVec_InputParameter( SEXP x_ ): v(x_), vec( as(v) ) {} inline operator REF(){ return vec ; } private: Rcpp::Vector< Rcpp::traits::r_sexptype_traits::rtype > v ; VEC vec ; } ; /* End Armadillo vector as support classes */ #define MAKE_INPUT_PARAMETER(INPUT_TYPE,TYPE,REF) \ template \ class INPUT_TYPE : public ArmaVec_InputParameter{ \ public: \ INPUT_TYPE( SEXP x) : ArmaVec_InputParameter(x){} \ } ; MAKE_INPUT_PARAMETER(ConstReferenceInputParameter, arma::Col, const arma::Col& ) MAKE_INPUT_PARAMETER(ReferenceInputParameter , arma::Col, arma::Col& ) MAKE_INPUT_PARAMETER(ConstInputParameter , arma::Col, const arma::Col ) MAKE_INPUT_PARAMETER(ConstReferenceInputParameter, arma::Row, const arma::Row& ) MAKE_INPUT_PARAMETER(ReferenceInputParameter , arma::Row, arma::Row& ) MAKE_INPUT_PARAMETER(ConstInputParameter , arma::Row, const arma::Row ) #undef MAKE_INPUT_PARAMETER #define MAKE_INPUT_PARAMETER(INPUT_TYPE,TYPE,REF) \ template \ class INPUT_TYPE : public ArmaMat_InputParameter{ \ public: \ INPUT_TYPE( SEXP x) : ArmaMat_InputParameter(x){} \ } ; MAKE_INPUT_PARAMETER(ConstReferenceInputParameter, arma::Mat, const arma::Mat& ) MAKE_INPUT_PARAMETER(ReferenceInputParameter , arma::Mat, arma::Mat& ) MAKE_INPUT_PARAMETER(ConstInputParameter , arma::Mat, const arma::Mat ) #undef MAKE_INPUT_PARAMETER } #endif RcppArmadillo/inst/include/RcppArmadillo/interface/RcppArmadilloSugar.h0000644000176200001440000000376014324552140026006 0ustar liggesusers // RcppArmadilloSugar.h: Rcpp/Armadillo glue // // Copyright (C) 2010 - 2021 Dirk Eddelbuettel, Romain Francois and Douglas Bates // Copyright (C) 2017 - 2021 Serguei Sokol // // This file is part of RcppArmadillo. // // RcppArmadillo is free software: you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 2 of the License, or // (at your option) any later version. // // RcppArmadillo is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with RcppArmadillo. If not, see . #ifndef RcppArmadillo__RcppArmadilloSugar__h #define RcppArmadillo__RcppArmadilloSugar__h namespace Rcpp{ // forward is not needed anymore, but we just leave this // for backwards compatibility template inline const T& forward(const T& x) { return x; } template List simple_triplet_matrix ( const arma::SpMat& sm ){ const int RTYPE = Rcpp::traits::r_sexptype_traits::rtype; sm.sync(); // important: update internal state of SpMat object // copy the data into R objects Vector x(sm.values, sm.values + sm.n_nonzero); IntegerVector i(sm.row_indices, sm.row_indices + sm.n_nonzero); i=i+1; IntegerVector p(sm.col_ptrs, sm.col_ptrs + sm.n_cols + 1); IntegerVector j(i.size()); for (size_t cp=1, ie=0; ie < sm.n_nonzero; ie++) { for (; static_cast(p[cp]) <= ie && cp < sm.n_cols; cp++) ; j[ie] = cp; } List s; s("i") = i; s("j") = j; s("v") = x; s("nrow") = sm.n_rows; s("ncol") = sm.n_cols; s("dimnames") = R_NilValue; s.attr("class") = "simple_triplet_matrix"; return s; } } // Rcpp #endif RcppArmadillo/inst/include/RcppArmadillo/interface/RcppArmadilloWrap.h0000644000176200001440000002743214324552140025640 0ustar liggesusers// // RcppArmadilloWrap.h: Rcpp/Armadillo glue // // Copyright (C) 2010 - 2021 Dirk Eddelbuettel, Romain Francois and Douglas Bates // Copyright (C) 2017 - 2021 Binxiang Ni and Serguei Sokol // Copyright (C) 2021 Conrad Sanderson // // This file is part of RcppArmadillo. // // RcppArmadillo is free software: you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 2 of the License, or // (at your option) any later version. // // RcppArmadillo is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with RcppArmadillo. If not, see . #ifndef RcppArmadillo__RcppArmadilloWrap__h #define RcppArmadillo__RcppArmadilloWrap__h namespace Rcpp{ namespace RcppArmadillo{ template SEXP arma_wrap( const T& object, const ::Rcpp::Dimension& dim){ ::Rcpp::RObject x = ::Rcpp::wrap( object.memptr() , object.memptr() + object.n_elem ) ; x.attr( "dim" ) = dim ; return x; } // DE 03-Aug-2013 // here is an alternate form which would not set dimension which we could do // for row and column vectors -- but the current form of return row and col // as matrix types with one col (or row, respectively) is now entrenched template SEXP arma_wrap(const T& object) { return ::Rcpp::wrap(object.memptr() , object.memptr() + object.n_elem); } template SEXP arma_subview_wrap( const arma::subview& data, int nrows, int ncols ){ const int RTYPE = Rcpp::traits::r_sexptype_traits::rtype ; Rcpp::Matrix mat( nrows, ncols ) ; for( int j=0, k=0; j SEXP arma_subview_wrap( const arma::subview_cols& data, int nrows, int ncols ){ const int RTYPE = Rcpp::traits::r_sexptype_traits::rtype ; Rcpp::Matrix mat( nrows, ncols ) ; const int nelem = nrows*ncols; const T* svcmem = data.colptr(0); for( int i=0; i SEXP wrap ( const arma::Mat& data ){ return RcppArmadillo::arma_wrap( data, Dimension( data.n_rows, data.n_cols ) ) ; } template SEXP wrap( const arma::Col& data ){ #if defined(RCPP_ARMADILLO_RETURN_COLVEC_AS_VECTOR) || defined(RCPP_ARMADILLO_RETURN_ANYVEC_AS_VECTOR) return RcppArmadillo::arma_wrap( data ) ; #else return RcppArmadillo::arma_wrap( data, Dimension( data.n_elem, 1) ) ; #endif } template SEXP wrap( const arma::Row& data ){ #if defined(RCPP_ARMADILLO_RETURN_ROWVEC_AS_VECTOR) || defined(RCPP_ARMADILLO_RETURN_ANYVEC_AS_VECTOR) return RcppArmadillo::arma_wrap( data ) ; #else return RcppArmadillo::arma_wrap(data, Dimension( 1, data.n_elem ) ) ; #endif } template SEXP wrap( const arma::Cube& data ){ return RcppArmadillo::arma_wrap(data, Dimension( data.n_rows, data.n_cols, data.n_slices ) ) ; } template SEXP wrap( const arma::subview& data ){ return RcppArmadillo::arma_subview_wrap( data, data.n_rows, data.n_cols ) ; } template SEXP wrap( const arma::subview_cols& data ){ return RcppArmadillo::arma_subview_wrap( data, data.n_rows, data.n_cols ) ; } template SEXP wrap ( const arma::SpMat& sm ){ const int RTYPE = Rcpp::traits::r_sexptype_traits::rtype; sm.sync(); // important: update internal state of SpMat object IntegerVector dim = IntegerVector::create(sm.n_rows, sm.n_cols); // copy the data into R objects Vector x(sm.values, sm.values + sm.n_nonzero ) ; IntegerVector i(sm.row_indices, sm.row_indices + sm.n_nonzero); IntegerVector p(sm.col_ptrs, sm.col_ptrs + sm.n_cols+1 ) ; std::string klass = "dgCMatrix"; // Since logical sparse matrix is not supported for now, the conditional statement is not currently used. // switch( RTYPE ){ // case REALSXP: klass = "dgCMatrix" ; break ; // // case INTSXP : klass = "igCMatrix" ; break ; class not exported // case LGLSXP : klass = "lgCMatrix" ; break ; // default: // throw std::invalid_argument( "RTYPE not matched in conversion to sparse matrix" ) ; // } S4 s(klass); s.slot("i") = i; s.slot("p") = p; s.slot("x") = x; s.slot("Dim") = dim; return s; } namespace RcppArmadillo { /* Importer class for field */ template class FieldImporter { public: typedef T r_import_type ; FieldImporter( const arma::field& data_ ) : data(data_){} inline int size() const { return data.n_elem ; } inline T get(int i) const { return data[i] ; } inline SEXP wrap( int i) const { return ::Rcpp::wrap( data[i] ) ; } private: const arma::field& data ; } ; } // namespace RcppArmadillo template SEXP wrap( const arma::field& data){ RObject x = wrap( RcppArmadillo::FieldImporter( data ) ) ; #if defined(RCPP_ARMADILLO_FIX_Field) //#if !defined(RCPP_ARMADILLO_OLD_Field_BEHAVIOR) x.attr("dim") = Dimension(data.n_rows , data.n_cols , data.n_slices); #else x.attr("dim") = Dimension(data.n_rows, data.n_cols); #endif return x ; } /* TODO: maybe we could use the advanced constructor to avoid creating the temporary Mat */ template SEXP wrap(const arma::Glue& X ){ return wrap( arma::Mat(X) ) ; } template SEXP wrap(const arma::Op& X ){ return wrap( arma::Mat(X) ) ; } template SEXP wrap(const arma::OpCube& X ){ return wrap( arma::Cube(X) ) ; } template SEXP wrap(const arma::GlueCube& X ){ return wrap( arma::Cube(X) ) ; } template SEXP wrap(const arma::GenCube& X){ return wrap( arma::Cube( X ) ) ; } namespace RcppArmadillo{ /* we can intercept and directly build the resulting matrix using memory allocated by R */ template SEXP wrap_eglue( const arma::eGlue& X, ::Rcpp::traits::false_type ){ int n_rows = X.P1.get_n_rows() ; int n_cols = X.P1.get_n_cols() ; typedef typename ::Rcpp::Vector< ::Rcpp::traits::r_sexptype_traits< typename T1::elem_type>::rtype > VECTOR ; VECTOR res(::Rcpp::Dimension( n_rows , n_cols )) ; ::arma::Mat result( res.begin(), n_rows, n_cols, false ) ; result = X ; return res ; } template SEXP wrap_eglue( const arma::eGlue& X, ::Rcpp::traits::true_type ){ return ::Rcpp::wrap( arma::Mat(X) ) ; } template SEXP wrap_eop( const arma::eOp& X, ::Rcpp::traits::false_type ){ int n_rows = X.get_n_rows(); int n_cols = X.get_n_cols(); typedef typename ::Rcpp::Vector< ::Rcpp::traits::r_sexptype_traits< typename T1::elem_type>::rtype > VECTOR ; VECTOR res(::Rcpp::Dimension( n_rows , n_cols )) ; ::arma::Mat result( res.begin(), n_rows, n_cols, false ) ; result = X ; return res ; } template SEXP wrap_eop( const arma::eOp& X, ::Rcpp::traits::true_type ){ return ::Rcpp::wrap( arma::Mat(X) ) ; } // template // SEXP wrap_mtop( const arma::mtOp& X, ::Rcpp::traits::false_type ){ // // int n_rows = X.P.n_rows ; // // int n_cols = X.P.n_cols ; // // typedef typename ::Rcpp::Vector< ::Rcpp::traits::r_sexptype_traits< typename T1::elem_type>::rtype > VECTOR ; // // VECTOR res(::Rcpp::Dimension( n_rows , n_cols )) ; // // ::arma::Mat result( res.begin(), n_rows, n_cols, false ) ; // // result = X ; // // return res ; // return ::Rcpp::wrap( arma::Mat(X) ) ; // } // // template // SEXP wrap_mtop( const arma::mtOp& X, ::Rcpp::traits::true_type ){ // return ::Rcpp::wrap( arma::Mat(X) ) ; // } // // template // SEXP wrap_mtglue( const arma::mtGlue& X, ::Rcpp::traits::false_type ){ // // int n_rows = X.P1.n_rows ; // // int n_cols = X.P1.n_cols ; // // typedef typename ::Rcpp::Vector< ::Rcpp::traits::r_sexptype_traits< typename T1::elem_type>::rtype > VECTOR ; // // VECTOR res(::Rcpp::Dimension( n_rows , n_cols )) ; // // ::arma::Mat result( res.begin(), n_rows, n_cols, false ) ; // // result = X ; // // return res ; // return ::Rcpp::wrap( arma::Mat(X) ) ; // } // // template // SEXP wrap_mtglue( const arma::mtGlue& X , ::Rcpp::traits::true_type ){ // return ::Rcpp::wrap( arma::Mat(X) ) ; // } } // namespace RcppArmadillo template SEXP wrap(const arma::eGlue& X ){ return RcppArmadillo::wrap_eglue( X, typename traits::r_sexptype_needscast::type() ) ; } template SEXP wrap(const arma::eOp& X ){ return RcppArmadillo::wrap_eop( X, typename traits::r_sexptype_needscast::type() ) ; } template SEXP wrap(const arma::eOpCube& X ){ return wrap( arma::Cube(X) ) ; } template SEXP wrap(const arma::eGlueCube& X ){ return wrap( arma::Cube(X) ) ; } template SEXP wrap( const arma::mtOp& X ){ // return RcppArmadillo::wrap_mtop( X, typename traits::r_sexptype_needscast::type() ) ; return wrap( arma::Mat( X ) ) ; } template SEXP wrap( const arma::mtGlue& X ){ // return RcppArmadillo::wrap_mtglue( X, typename traits::r_sexptype_needscast::type() ) ; return wrap( arma::Mat( X ) ) ; } template SEXP wrap( const arma::Gen& X){ return wrap( eT(X) ) ; } } #endif RcppArmadillo/inst/include/RcppArmadillo/RcppArmadillo0000644000176200001440000000334414334755142022624 0ustar liggesusers// Emacs, please make this -*- mode: C++; -*- // RcppArmadillo: Rcpp/Armadillo glue // // Copyright (C) 2010 - 2022 Dirk Eddelbuettel, Romain Francois and Douglas Bates // // This file is part of RcppArmadillo. // // RcppArmadillo is free software: you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 2 of the License, or // (at your option) any later version. // // RcppArmadillo is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with RcppArmadillo. If not, see . #ifndef RcppArmadillo__RcppArmadillo #define RcppArmadillo__RcppArmadillo #if defined(Rcpp_hpp) && !defined(COMPILING_RCPPARMADILLO) #error "The file 'Rcpp.h' should not be included. Please correct to include only 'RcppArmadillo.h'." #endif // We are undoing a design decision from early on by allowing vectors be returned // as standard 'one-dimension' objects -- as opposed to the matrix form we imposed #define RCPP_ARMADILLO_RETURN_ANYVEC_AS_VECTOR // Set up actual #include after first #include and more config #include // Automatically include Rcpp as well -- full version #include // Remaining RcppArmadillo code #include #include #include #endif RcppArmadillo/inst/CITATION0000644000176200001440000000132214652777737015144 0ustar liggesusersbibentry("Article", title = "RcppArmadillo: Accelerating R with high-performance C++ linear algebra", author = c(person("Dirk", "Eddelbuettel", email = "edd@debian.org", comment = c(ORCID = "0000-0001-6419-907X")), person("Conrad", "Sanderson", comment = c(ORCID = "0000-0002-0049-4501"))), journal = "Computational Statistics and Data Analysis", year = "2014", volume = "71", month = "March", pages = "1054--1063", doi = "10.1016/j.csda.2013.02.005" ) bibentry("Manual", other = unlist(citation(auto = meta), recursive = FALSE)) RcppArmadillo/inst/examples/0000755000176200001440000000000013507103315015574 5ustar liggesusersRcppArmadillo/inst/examples/kalman/0000755000176200001440000000000012253723621017044 5ustar liggesusersRcppArmadillo/inst/examples/kalman/kalmanfilter.m0000644000176200001440000000173012253723621021674 0ustar liggesusers% Copyright 2010 The MathWorks, Inc. function y = kalmanfilter(z) dt=1; % Initialize state transition matrix A=[ 1 0 dt 0 0 0; 0 1 0 dt 0 0;... % [x ], [y ] 0 0 1 0 dt 0; 0 0 0 1 0 dt;... % [Vx], [Vy] 0 0 0 0 1 0 ; 0 0 0 0 0 1 ]; % [Ax], [Ay] H = [ 1 0 0 0 0 0; 0 1 0 0 0 0 ]; % Init. measuremnt mat Q = eye(6); R = 1000 * eye(2); persistent x_est p_est % Init. state cond. if isempty(x_est) x_est = zeros(6, 1); % x_est=[x,y,Vx,Vy,Ax,Ay]' p_est = zeros(6, 6); end x_prd = A * x_est; % Predicted state and covariance p_prd = A * p_est * A' + Q; S = H * p_prd' * H' + R; % Estimation B = H * p_prd'; klm_gain = (S \ B)'; % Estimated state and covariance x_est = x_prd + klm_gain * (z - H * x_prd); p_est = p_prd - klm_gain * H * p_prd; y = H * x_est; % Compute the estimated measurements end % of the function RcppArmadillo/inst/examples/kalman/firstExample.R0000644000176200001440000000045712253723621021640 0ustar liggesusers library(RcppArmadillo) cppFunction(code=' Rcpp::List g(arma::colvec v) { arma::mat op = v * v.t(); double ip = arma::as_scalar(v.t() * v); return Rcpp::List::create(Rcpp::Named("outer")=op, Rcpp::Named("inner")=ip); } ', depends="RcppArmadillo") g(7:11) RcppArmadillo/inst/examples/kalman/kalmanM.m0000644000176200001440000000177012253723621020607 0ustar liggesusersfunction Y = kalmanM(pos) dt=1; %% Initialize state transition matrix A=[ 1 0 dt 0 0 0;... % [x ] 0 1 0 dt 0 0;... % [y ] 0 0 1 0 dt 0;... % [Vx] 0 0 0 1 0 dt;... % [Vy] 0 0 0 0 1 0 ;... % [Ax] 0 0 0 0 0 1 ]; % [Ay] H = [ 1 0 0 0 0 0; 0 1 0 0 0 0 ]; % Initialize measurement matrix Q = eye(6); R = 1000 * eye(2); x_est = zeros(6, 1); % x_est=[x,y,Vx,Vy,Ax,Ay]' p_est = zeros(6, 6); numPts = size(pos,1); Y = zeros(numPts, 2); for idx = 1:numPts z = pos(idx, :)'; %% Predicted state and covariance x_prd = A * x_est; p_prd = A * p_est * A' + Q; %% Estimation S = H * p_prd' * H' + R; B = H * p_prd'; klm_gain = (S \ B)'; %% Estimated state and covariance x_est = x_prd + klm_gain * (z - H * x_prd); p_est = p_prd - klm_gain * H * p_prd; %% Compute the estimated measurements Y(idx, :) = H * x_est; end % of the function end % of the function RcppArmadillo/inst/examples/kalman/benchmark.R0000644000176200001440000000225712541062071021122 0ustar liggesusers suppressMessages(library(utils)) suppressMessages(library(RcppArmadillo)) suppressMessages(library(rbenchmark)) suppressMessages(library(compiler)) source("FirstKalmanR.R") source("KalmanR.R") source("KalmanRimp.R") Rcpp::sourceCpp("Kalman.cpp") FirstKalmanRC <- cmpfun(FirstKalmanR) KalmanRC <- cmpfun(KalmanR) KalmanRimpC <- cmpfun(KalmanRimp) ## Read data, ensure identical results pos <- as.matrix(read.table("pos.txt", header=FALSE, col.names=c("x","y"))) stopifnot(all.equal(KalmanR(pos), KalmanRC(pos)), all.equal(KalmanRC(pos), KalmanCpp(pos)), all.equal(KalmanCpp(pos), FirstKalmanRC(pos)), all.equal(KalmanCpp(pos), FirstKalmanR(pos)), all.equal(KalmanCpp(pos), KalmanRimp(pos)), all.equal(KalmanCpp(pos), KalmanRimpC(pos))) res <- benchmark(KalmanR(pos), KalmanRC(pos), KalmanRimp(pos), KalmanRimpC(pos), FirstKalmanR(pos), FirstKalmanRC(pos), KalmanCpp(pos), columns = c("test", "replications", "elapsed", "relative"), order="relative", replications=500) print(res[,1:4]) RcppArmadillo/inst/examples/kalman/pos.txt0000644000176200001440000002327212253723621020414 0ustar liggesusers -4.76074274e-01 8.27344982e-01 -4.66073333e-01 8.25346801e-01 -4.56071632e-01 8.21349631e-01 -4.46068539e-01 8.15353570e-01 -4.36063422e-01 8.07358714e-01 -4.26055649e-01 7.97365162e-01 -4.16044587e-01 7.85373011e-01 -4.06029604e-01 7.71382359e-01 -3.96010067e-01 7.55393303e-01 -3.85985344e-01 7.37405941e-01 -3.75954804e-01 7.17420370e-01 -3.65917812e-01 6.95436687e-01 -3.55873738e-01 6.71454991e-01 -3.45821948e-01 6.45475379e-01 -3.35761811e-01 6.17497948e-01 -3.25692694e-01 5.87522796e-01 -3.15613964e-01 5.55550021e-01 -3.05524990e-01 5.21579720e-01 -2.95425138e-01 4.85611990e-01 -2.85313778e-01 4.47646929e-01 -2.75190275e-01 4.07684635e-01 -2.65053998e-01 3.65725205e-01 -2.54904315e-01 3.21768737e-01 -2.44740592e-01 2.75815328e-01 -2.34562199e-01 2.27865076e-01 -2.24368501e-01 1.77918079e-01 -2.14158868e-01 1.25974433e-01 -2.03932667e-01 7.20342366e-02 -1.93689265e-01 1.60975872e-02 -1.83428030e-01 -4.18354177e-02 -1.73148329e-01 -1.01764681e-01 -1.62849531e-01 -1.63690104e-01 -1.52531002e-01 -2.27611590e-01 -1.42192111e-01 -2.93529041e-01 -1.31832225e-01 -3.61442361e-01 -1.21450712e-01 -4.31351450e-01 -1.11046940e-01 -5.03256212e-01 -1.00620275e-01 -5.77156550e-01 -9.01700865e-02 -6.53052365e-01 -7.96957410e-02 -7.30943560e-01 -6.91966066e-02 -8.10830038e-01 -5.86720509e-02 -8.92711700e-01 -4.81214414e-02 -9.68723398e-01 -3.75441458e-02 -8.82849846e-01 -2.69395318e-02 -7.98971187e-01 -1.63069671e-02 -7.17087322e-01 -5.64581912e-03 -6.37198155e-01 5.04454433e-03 -5.59303588e-01 1.57647557e-02 -4.83403523e-01 2.65154472e-02 -4.09497862e-01 3.72972513e-02 -3.37586509e-01 4.81108004e-02 -2.67669365e-01 5.89567268e-02 -1.99746334e-01 6.98356629e-02 -1.33817317e-01 8.07482410e-02 -6.98822165e-02 9.16950935e-02 -7.94093586e-03 1.02676853e-01 5.20066229e-02 1.13694151e-01 1.09960557e-01 1.24747621e-01 1.65920965e-01 1.35837894e-01 2.19887943e-01 1.46965604e-01 2.71861590e-01 1.58131383e-01 3.21842002e-01 1.69335862e-01 3.69829278e-01 1.80579674e-01 4.15823514e-01 1.91863452e-01 4.59824809e-01 2.03187829e-01 5.01833260e-01 2.14553435e-01 5.41848965e-01 2.25960904e-01 5.79872020e-01 2.37410868e-01 6.15902524e-01 2.48903960e-01 6.49940575e-01 2.60440811e-01 6.81986269e-01 2.72022055e-01 7.12039704e-01 2.83648323e-01 7.40100978e-01 2.95320248e-01 7.66170188e-01 3.07038462e-01 7.90247432e-01 3.18803597e-01 8.12332807e-01 3.30616287e-01 8.32426411e-01 3.42477163e-01 8.50528342e-01 3.54386857e-01 8.66638696e-01 3.66346003e-01 8.80757573e-01 3.78355232e-01 8.92885068e-01 3.90415176e-01 9.03021280e-01 4.02526469e-01 9.11166306e-01 4.14689742e-01 9.17320243e-01 4.26905628e-01 9.21483190e-01 4.39174759e-01 9.23655244e-01 4.51497768e-01 9.23836502e-01 4.63875286e-01 9.22027062e-01 4.76307947e-01 9.18227021e-01 4.88796383e-01 9.12436477e-01 5.01341225e-01 9.04655528e-01 5.13943106e-01 8.94884271e-01 5.26602660e-01 8.83122803e-01 5.39320517e-01 8.69371222e-01 5.52097311e-01 8.53629626e-01 5.64933673e-01 8.35898112e-01 5.77830237e-01 8.16176778e-01 5.90787634e-01 7.94465721e-01 6.03806497e-01 7.70765039e-01 6.16887458e-01 7.45074829e-01 6.16887458e-01 7.45074829e-01 2.43647025e-01 3.48142367e-01 -1.29593408e-01 -4.87900946e-02 -5.02833841e-01 -4.45722556e-01 -8.76074274e-01 -8.42655018e-01 -8.76074274e-01 -8.42655018e-01 -8.66073333e-01 -8.14653199e-01 -8.56071632e-01 -7.88650369e-01 -8.46068539e-01 -7.64646430e-01 -8.36063422e-01 -7.42641286e-01 -8.26055649e-01 -7.22634838e-01 -8.16044587e-01 -7.04626989e-01 -8.06029604e-01 -6.88617641e-01 -7.96010067e-01 -6.74606697e-01 -7.85985344e-01 -6.62594059e-01 -7.75954804e-01 -6.52579630e-01 -7.65917812e-01 -6.44563313e-01 -7.55873738e-01 -6.38545009e-01 -7.45821948e-01 -6.34524621e-01 -7.35761811e-01 -6.32502052e-01 -7.25692694e-01 -6.32477204e-01 -7.15613964e-01 -6.34449979e-01 -7.05524990e-01 -6.38420280e-01 -6.95425138e-01 -6.44388010e-01 -6.85313778e-01 -6.52353071e-01 -6.75190275e-01 -6.62315365e-01 -6.65053998e-01 -6.74274795e-01 -6.54904315e-01 -6.88231263e-01 -6.44740592e-01 -7.04184672e-01 -6.34562199e-01 -7.22134924e-01 -6.24368501e-01 -7.42081921e-01 -6.14158868e-01 -7.64025567e-01 -6.03932667e-01 -7.87965763e-01 -5.93689265e-01 -8.13902413e-01 -5.83428030e-01 -8.41835418e-01 -5.73148329e-01 -8.71764681e-01 -5.62849531e-01 -9.03690104e-01 -5.52531002e-01 -9.37611590e-01 -5.42192111e-01 -9.71782807e-01 -5.31832225e-01 -9.33867676e-01 -5.21450712e-01 -8.97948315e-01 -5.11046940e-01 -8.64024627e-01 -5.00620275e-01 -8.32096515e-01 -4.90170086e-01 -8.02163879e-01 -4.79695741e-01 -7.74226624e-01 -4.69196607e-01 -7.48284652e-01 -4.58672051e-01 -7.24337865e-01 -4.48121441e-01 -7.02386165e-01 -4.37544146e-01 -6.82429455e-01 -4.26939532e-01 -6.64467637e-01 -4.16306967e-01 -6.48500614e-01 -4.05645819e-01 -6.34528289e-01 -3.94955456e-01 -6.22550563e-01 -3.84235244e-01 -6.12567339e-01 -3.73484553e-01 -6.04578520e-01 -3.62702749e-01 -5.98584009e-01 -3.51889200e-01 -5.94583707e-01 -3.41043273e-01 -5.92577517e-01 -3.30164337e-01 -5.92565341e-01 -3.19251759e-01 -5.94547083e-01 -3.08304907e-01 -5.98522644e-01 -2.97323147e-01 -6.04491926e-01 -2.86305849e-01 -6.12454834e-01 -2.75252379e-01 -6.22411268e-01 -2.64162106e-01 -6.34361131e-01 -2.53034396e-01 -6.48304326e-01 -2.41868617e-01 -6.64240755e-01 -2.30664138e-01 -6.82170321e-01 -2.19420326e-01 -7.02092926e-01 -2.08136548e-01 -7.24008473e-01 -1.96812171e-01 -7.47916863e-01 -1.85446565e-01 -7.73818000e-01 -1.74039096e-01 -8.01711787e-01 -1.62589132e-01 -8.31598124e-01 -1.51096040e-01 -8.63476915e-01 -1.39559189e-01 -8.97348063e-01 -1.27977945e-01 -9.33211470e-01 -1.16351677e-01 -9.71067037e-01 -1.04679752e-01 -9.34397179e-01 -9.29615383e-02 -8.92555770e-01 -8.11964026e-02 -8.52706229e-01 -6.93837130e-02 -8.14848460e-01 -5.75228372e-02 -7.78982364e-01 -4.56131427e-02 -7.45107844e-01 -3.36539972e-02 -7.13224802e-01 -2.16447683e-02 -6.83333142e-01 -9.58482365e-03 -6.55432765e-01 2.52646905e-03 -6.29523574e-01 1.46897422e-02 -6.05605471e-01 2.69056281e-02 -5.83678358e-01 3.91747593e-02 -5.63742139e-01 5.14977679e-02 -5.45796716e-01 6.38752864e-02 -5.29841991e-01 7.63079472e-02 -5.15877866e-01 8.87963825e-02 -5.03904245e-01 1.01341225e-01 -4.93921029e-01 1.13943106e-01 -4.85928121e-01 1.26602660e-01 -4.79925423e-01 1.39320517e-01 -4.75912839e-01 1.52097311e-01 -4.73890270e-01 1.64933673e-01 -4.73857618e-01 1.77830237e-01 -4.75814787e-01 1.90787634e-01 -4.79761679e-01 2.03806497e-01 -4.85698196e-01 2.16887458e-01 -4.93624240e-01 2.16887458e-01 -4.93624240e-01 4.01147025e-01 -1.33381935e-01 5.85406592e-01 2.26860371e-01 7.69666159e-01 5.87102676e-01 9.53925726e-01 9.47344982e-01 9.53925726e-01 9.47344982e-01 9.43926667e-01 9.15346801e-01 9.33928368e-01 8.81349631e-01 9.23931461e-01 8.45353570e-01 9.13936578e-01 8.07358714e-01 9.03944351e-01 7.67365162e-01 8.93955413e-01 7.25373011e-01 8.83970396e-01 6.81382359e-01 8.73989933e-01 6.35393303e-01 8.64014656e-01 5.87405941e-01 8.54045196e-01 5.37420370e-01 8.44082188e-01 4.85436687e-01 8.34126262e-01 4.31454991e-01 8.24178052e-01 3.75475379e-01 8.14238189e-01 3.17497948e-01 8.04307306e-01 2.57522796e-01 7.94386036e-01 1.95550021e-01 7.84475010e-01 1.31579720e-01 7.74574862e-01 6.56119899e-02 7.64686222e-01 -2.35307073e-03 7.54809725e-01 -7.23153647e-02 7.44946002e-01 -1.44274795e-01 7.35095685e-01 -2.18231263e-01 7.25259408e-01 -2.94184672e-01 7.15437801e-01 -3.72134924e-01 7.05631499e-01 -4.52081921e-01 6.95841132e-01 -5.34025567e-01 6.86067333e-01 -6.17965763e-01 6.76310735e-01 -7.03902413e-01 6.66571970e-01 -7.91835418e-01 6.56851671e-01 -8.81764681e-01 6.47150469e-01 -9.71621744e-01 6.37468998e-01 -8.77698446e-01 6.27807889e-01 -7.85771114e-01 6.18167775e-01 -6.95839649e-01 6.08549288e-01 -6.07903955e-01 5.98953060e-01 -5.21963934e-01 5.89379725e-01 -4.38019487e-01 5.79829914e-01 -3.56070518e-01 5.70304259e-01 -2.76116929e-01 5.60803393e-01 -1.98158623e-01 5.51327949e-01 -1.22195502e-01 5.41878559e-01 -4.82274683e-02 5.32455854e-01 2.37455755e-02 5.23060468e-01 9.37237269e-02 5.13693033e-01 1.61707083e-01 5.04354181e-01 2.27695743e-01 4.95044544e-01 2.91689802e-01 4.85764756e-01 3.53689360e-01 4.76515447e-01 4.13694512e-01 4.67297251e-01 4.71705358e-01 4.58110800e-01 5.27721993e-01 4.48956727e-01 5.81744517e-01 4.39835663e-01 6.33773026e-01 4.30748241e-01 6.83807619e-01 4.21695093e-01 7.31848392e-01 4.12676853e-01 7.77895442e-01 4.03694151e-01 8.21948869e-01 3.94747621e-01 8.64008769e-01 3.85837894e-01 9.04075239e-01 3.76965604e-01 9.42148378e-01 3.68131383e-01 9.78228282e-01 3.59335862e-01 1.01231505e+00 3.50579674e-01 1.01027937e+00 3.41863452e-01 9.80180397e-01 3.33187829e-01 9.48088578e-01 3.24553435e-01 9.14004012e-01 3.15960904e-01 8.77926796e-01 3.07410868e-01 8.39857030e-01 2.98903960e-01 7.99794810e-01 2.90440811e-01 7.57740233e-01 2.82022055e-01 7.13693397e-01 2.73648323e-01 6.67654401e-01 2.65320248e-01 6.19623340e-01 2.57038462e-01 5.69600313e-01 2.48803597e-01 5.17585418e-01 2.40616287e-01 4.63578752e-01 2.32477163e-01 4.07580412e-01 2.24386857e-01 3.49590496e-01 2.16346003e-01 2.89609102e-01 2.08355232e-01 2.27636326e-01 2.00415176e-01 1.63672267e-01 1.92526469e-01 9.77170229e-02 1.84689742e-01 2.97706900e-02 1.76905628e-01 -4.01666337e-02 1.69174759e-01 -1.12094851e-01 1.61497768e-01 -1.86013863e-01 1.53875286e-01 -2.61923574e-01 1.46307947e-01 -3.39823885e-01 1.38796383e-01 -4.19714700e-01 1.31341225e-01 -5.01595920e-01 1.23943106e-01 -5.85467448e-01 1.16602660e-01 -6.71329186e-01 1.09320517e-01 -7.59181037e-01 1.02097311e-01 -8.49022904e-01 9.49336734e-02 -9.40854688e-01 8.78302370e-02 -9.10635555e-01 8.07876341e-02 -8.14822416e-01 7.38064970e-02 -7.20998902e-01 6.68874582e-02 -6.29164916e-01 RcppArmadillo/inst/examples/kalman/Kalman.cpp0000644000176200001440000000255212253723621020757 0ustar liggesusers // [[Rcpp::depends(RcppArmadillo)]] #include using namespace arma; class Kalman { private: mat A, H, Q, R, xest, pest; double dt; public: // constructor, sets up data structures Kalman() : dt(1.0) { A.eye(6,6); A(0,2) = A(1,3) = A(2,4) = A(3,5) = dt; H.zeros(2,6); H(0,0) = H(1,1) = 1.0; Q.eye(6,6); R = 1000 * eye(2,2); xest.zeros(6,1); pest.zeros(6,6); } // sole member function: estimate model mat estimate(const mat & Z) { unsigned int n = Z.n_rows, k = Z.n_cols; mat Y = zeros(n, k); mat xprd, pprd, S, B, kalmangain; colvec z, y; for (unsigned int i = 0; i. library(Rcpp) library(RcppArmadillo) library(rbenchmark) ## start from SEXP, most conversions, longest code src <- ' Rcpp::List fLmSEXP(SEXP Xs, SEXP ys) { Rcpp::NumericMatrix Xr(Xs); Rcpp::NumericVector yr(ys); int n = Xr.nrow(), k = Xr.ncol(); arma::mat X(Xr.begin(), n, k, false); arma::colvec y(yr.begin(), yr.size(), false); int df = n - k; // fit model y ~ X, extract residuals arma::colvec coef = arma::solve(X, y); arma::colvec res = y - X*coef; double s2 = std::inner_product(res.begin(), res.end(), res.begin(), 0.0)/df; // std.errors of coefficients arma::colvec sderr = arma::sqrt(s2 * arma::diagvec(arma::pinv(arma::trans(X)*X))); return Rcpp::List::create(Rcpp::Named("coefficients")=coef, Rcpp::Named("stderr") =sderr, Rcpp::Named("df") =df); } ' cppFunction(code=src, depends="RcppArmadillo") ## start from Rcpp types are early RcppArmadillo examples did src <- ' Rcpp::List fLmTwoCasts(Rcpp::NumericMatrix Xr, Rcpp::NumericVector yr) { int n = Xr.nrow(), k = Xr.ncol(); arma::mat X(Xr.begin(), n, k, false); arma::colvec y(yr.begin(), yr.size(), false); int df = n - k; // fit model y ~ X, extract residuals arma::colvec coef = arma::solve(X, y); arma::colvec res = y - X*coef; double s2 = std::inner_product(res.begin(), res.end(), res.begin(), 0.0)/df; // std.errors of coefficients arma::colvec sderr = arma::sqrt(s2 * arma::diagvec(arma::pinv(arma::trans(X)*X))); return Rcpp::List::create(Rcpp::Named("coefficients")=coef, Rcpp::Named("stderr") =sderr, Rcpp::Named("df") =df); } ' cppFunction(code=src, depends="RcppArmadillo") ## start from Armadillo types src <- ' Rcpp::List fLmOneCast(arma::mat X, arma::colvec y) { int df = X.n_rows - X.n_cols; // fit model y ~ X, extract residuals arma::colvec coef = arma::solve(X, y); arma::colvec res = y - X*coef; double s2 = std::inner_product(res.begin(), res.end(), res.begin(), 0.0)/df; // std.errors of coefficients arma::colvec sderr = arma::sqrt(s2 * arma::diagvec(arma::pinv(arma::trans(X)*X))); return Rcpp::List::create(Rcpp::Named("coefficients")=coef, Rcpp::Named("stderr") =sderr, Rcpp::Named("df") =df); } ' cppFunction(code=src, depends="RcppArmadillo") ## start from Armadillo types passed as constant references src <- ' Rcpp::List fLmConstRef(const arma::mat & X, const arma::colvec & y) { int df = X.n_rows - X.n_cols; // fit model y ~ X, extract residuals arma::colvec coef = arma::solve(X, y); arma::colvec res = y - X*coef; double s2 = std::inner_product(res.begin(), res.end(), res.begin(), 0.0)/df; // std.errors of coefficients arma::colvec sderr = arma::sqrt(s2 * arma::diagvec(arma::pinv(arma::trans(X)*X))); return Rcpp::List::create(Rcpp::Named("coefficients")=coef, Rcpp::Named("stderr") =sderr, Rcpp::Named("df") =df); } ' cppFunction(code=src, depends="RcppArmadillo") fastLmPureDotCall <- function(X, y) { .Call("_RcppArmadillo_fastLm_impl", X, y, PACKAGE = "RcppArmadillo") } y <- log(trees$Volume) X <- cbind(1, log(trees$Girth)) frm <- formula(log(Volume) ~ log(Girth)) res <- benchmark(fLmOneCast(X, y), # inline'd above fLmTwoCasts(X, y), # inline'd above fLmConstRef(X, y), # inline'd above fLmSEXP(X, y), # inline'd above fastLmPure(X, y), # similar, but with 2 error checks fastLmPureDotCall(X, y), # now without the 2 error checks fastLm(frm, data=trees), # using model matrix lm.fit(X, y), # R's fast function, no stderr lm(frm, data=trees), # R's standard function columns = c("test", "replications", "relative", "elapsed", "user.self", "sys.self"), order="relative", replications=5000) print(res[,1:4]) ## second run without formulae approach but larger N res <- benchmark(fLmOneCast(X, y), # inline'd above fLmTwoCasts(X, y), # inline'd above fLmSEXP(X, y), # inline'd above fLmConstRef(X, y), # inline'd above fastLmPure(X, y), # similar, but with 2 error checks fastLmPureDotCall(X, y), # now without the 2 error checks lm.fit(X, y), # R's fast function, no stderr columns = c("test", "replications", "relative", "elapsed", "user.self", "sys.self"), order="relative", replications=50000) print(res[,1:4]) RcppArmadillo/inst/examples/varSimulation.r0000644000176200001440000000511012560372470020621 0ustar liggesusers#!/usr/bin/r ## ## varSimulation.r: Simulation of first-order vector autoregression data ## ## Copyright (C) 2011 - 2015 Lance Bachmeier and Dirk Eddelbuettel ## ## This file is part of RcppArmadillo. ## ## RcppArmadillo is free software: you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by ## the Free Software Foundation, either version 2 of the License, or ## (at your option) any later version. ## ## RcppArmadillo is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with RcppArmadillo. If not, see . ## load Rcpp to be able to use cppFunction() below suppressMessages(library(Rcpp)) ## parameter and error terms used throughout a <- matrix(c(0.5,0.1,0.1,0.5),nrow=2) e <- matrix(rnorm(10000),ncol=2) ## Let's start with the R version rSim <- function(coeff, errors) { simdata <- matrix(0, nrow(errors), ncol(errors)) for (row in 2:nrow(errors)) { simdata[row,] = coeff %*% simdata[(row-1),] + errors[row,] } return(simdata) } rData <- rSim(a, e) # generated by R ## Now let's load the R compiler (requires R 2.13 or later) suppressMessages(require(compiler)) compRsim <- cmpfun(rSim) compRData <- compRsim(a,e) # generated by R 'compiled' stopifnot(all.equal(rData, compRData)) # checking results ## C++ variant: code passed as a text variable ... code <- ' arma::mat rcppSim(const arma::mat& coeff, const arma::mat& errors) { int m = errors.n_rows; int n = errors.n_cols; arma::mat simdata(m,n); simdata.row(0) = arma::zeros(1,n); for (int row=1; row> stream xœ½kSÜ8òûý }ÛÝJe%ëi_m¥ŠG†!I[ù0¾fÈØdÉþúë–,eyf É]G²$K­~wKœ0"ˆJˆ$I "xB4‘:#†È,#)I'I¡IÂH¢%¾žHxç„Ë$%‰ \kCIxÊ¡æaJÀ`"¤‚ñ†ˆÃP™H(3"¥H gPœŒÈÚ9P4L(ý’(“2ÂQök¢X‡¢µ†÷”˜ã­à#FADBÒ„e°’j‹ (”J¥"i “ÖÒÌp]Y¢áû”dÂ@{F2ÀHF2£ [g Ø™€W ›c ~% Ž¥ * *™„1°ÿ$]IƒÀ!4úlQ'áU1¬¤)b6 ’á#ܨÀ ü*˜9Éz á Чã " f朙ýñ¡‡y5¹œT¢R æ˜ÐãÉu^AíËé÷»œÐèŸÎ¯É‹ö“E>©ŠùlwRåä×ÝsÆ3Œ³°`ž3õ c¿üV›/ȯ§ù¼Î/7}q¼˜_Þ_äðÉÞñÙ»™—Uy±(î*@ÎïLýÎ~k`˜ßÏ*äú¦¸,ÉŸÀ{°p…t{ô`,…a®¨ßÜÔ IÝ~Sc‹ÌLweâÞ?{|85̪|V•0L;¤æ—Åd{þPá‡po2ŽŸO0Ô#wœ—óûÅL…ó¼|¨öN*DpÒÌŒLçȲ˜_œäÌIwGIþPÁ”/^´ò0½=>$‰ïXN\÷nOÊÜÎMwŽ?Œ>=Û9Œôåìb~YÌ® ýX̶fe±l‹²Ú¹™,u-`»¹£ зfœƒI=øŽÐ“û/•]h`qË~,.«$šÑˆ~ÁµETß7Iðn,> 3‡h?Ä{øªYÝŸL3b…¸Æ—Ü œk÷kc™&õ˜º¥5¿¢ÏÁ[å’Ù {îLî^åÅõ!¥[t‡¾¢ô˜Žé„~¡ôb>Ïè%Í齦7ôæûÝM>£Ò[:£szGï¦÷%]Њþ Ò‚$Àužs¦µÓÉu‰:Ë"yÛóŸí4™°Ëv£bš[=±ä³£ÉmÞå‡}úâbkv=Ía =,ʘÁT´œTùí˜'m“·Åô¬Þºý1ßñëÓ7öìb¬Å|ÊsÃr@Öî̵D¶xôÚ0žSh¨@)â“ZQò‡û]ò$¤Ô>@yc\‹¶Ä‘C^Ûâo…¼† öc@qià/ Ø3 ¡°O€Ä(0˜¸ª}†Ç}ƒï©“m÷fgPnFÐd¦g+ ¸h¤Àù¬oÓn·†ïÜŠ(³è«û±]d <Ò"Ä·áòXâƒsFÂ`¡CáØñØ¥/éˆî˜ìÓ×ô Ë!=¢o­ÈœÐSúž~ ṘßÞN¬ÙiA®ð¿ öÿHÖ”^Ò åë?ô¯ZÆfÅ,A›Ã/jëi~U¹ÚÂÎx—/Šù¥įôëý¼Ê/¿Lí(ÿâÚ·e»k\Ð’–ùmá -óo°~Y<Ðr:)o@¬«›EžÓêï9½§ßèßô~§ÿÐòÅ䢡jmú&G^Å<{tþþà嫳‡ó¬ŠyVD<;Ô}ʬä$ÁVç“×A¯ãň7mfIjWÃ’Õ¿~-ŽÙ„Â]Íí˜ú LMC4/€¸JhûÖè¶Êt…V]¼^¼5iœB¶«jFûþ¨QŠâkSÙe´é‡2ßœ#’=9¢ýíÑöc=”Ͳ˜ÍT‡ÍÔÐ\fÛOD1Z>Ä VY zèÝx#ùZ)F4NÁ);$Q]’H¸­²fqŽxûÝË÷8{;PPŠuY:n"ùŽyˆÌ³§y=<Ã3a ´m(`©D2øÁñø´ô¼ÌÇi$`˘æÒàÖcZ ûDê°L`ù2|0; á0ibw…_›¬ß×k`ÌЮñ¦xœU·Ûýà»võ4U¶Ý÷c»×FâQ`Á·áºXÚ~ß‚,“r.%׆¬NÆ%ýyY¸ÿwª Ô¹‹sÀŠõÄ9º+¥ N­'OJ­ìnž[o`ht¯ãsžuÅ ÜÀ ǯeܱ&Vë¦×Š &j0½­tBðˆÕš^Éš2aàíÚ\9þ.®À2K0¡ol‰ýÀ$àuûÚâõ]ko](Ý6±‹¶vE>.¶²Ø™¡ð³¤Ë,ÑALHÀÁÞÜ€ƒ˜oîltöúøMúi â= 7<"âl¬ˆÃŽÁ1by´×Vºl°zf­9ºmáL,X©¯ÖÁrTߺ1%?òl¿EÀÈšG')î˜Ñ)i<39³júËäâ/§ ¿, šWVƒÖu§C{4ù×ûÉ´\êQßÒܵ0ù³“5|…]æ‹òb¾Èשñe2A…j\¹NáIû—„²ÒÌ&‘€$ Å[j×k³N_¦®ð$Ÿ­Ì"ŒÁKô‰ü1H§¨“cƒmÍ;â‡%˜ü÷uEáë/ÞÔu{éÆÕAž}ªz .‡Ï¯ŒÑ­òOÞà!ìöh<‹W‚Z -¯Mx3ó£×&dËäâí™Ç_›XªÄOÇï>Œ?=[T‹§ß‹]÷WnµØÁ2;ª«0îl)÷Ú('½({-áX:8=qf`¤&” OÖ¥d([g±Ö CV¥q#ŠlAØy~þ¬z(¿·m”O:ć¢ëƈGQñ–Y„iøÊîu™õ,Q‹•ÝNªz[Ì@ÛÝÞO«ân„媅{¾²ôÀ©GŸ‡wK%Ñì FþªÃ»ùã·G/ÏÇÏŽŠÛ/÷åx~{4Ïžóë{\j¨ƒçdì< –•ë~×Ò·ÛøÌê;eýWÇ_|wm‘ËÜõHWô-{ðzCß‡î ¯NãhêÈšåSk”?Ñs°±XÎ ÍX˜¾Ñ«Î[ŒrÝx´óŠ(¾–ë˜ÇCþ @ö¤„ΫÃñÑ^ÏêO?„”Ý,"(…IDÚEç Pûzβ%Nüè0ñø\Öýés~lF¼–®{’³6„ý6Ž1ºKß(¼ÃikV9(5Gg{ߌPçßm­ì㙆l*Ée冞 !¨\ÅDÁûš-¢¸×†(·uîg€{™¬UÂØŸdÊN×Á}” ñ1TóU¢ä½·žÝ*OMâµ1_çDxï Õ–ΓlƧxï¦×W«ï×þ¸¯Öº}‚×™ï«=Åõ 4Àe × +FÊOº÷«Zº¸§ e "PjרØÝâê*(¬?m2÷ê `ã«)Ö ýWÜгjÅkö\ˆ#™&ËÜÜòút³èS ©±îżGEwë'-ÔBAwŸÿƒmu–ø9“¢Öu 8õ×?ïápaendstream endobj 58 0 obj << /Subtype /XML /Type /Metadata /Length 1438 >> stream 2025-07-02T08:16:07-05:00 2025-07-02T08:16:07-05:00 2025-07-02T08:16:07-05:00 TeX Untitled endstream endobj 59 0 obj << /Type /ObjStm /Length 3626 /Filter /FlateDecode /N 56 /First 473 >> stream xœÍ›]oÛF†ï÷WÌå.ŠîpÎ~Elj“´q“Øi›¶è…b3¶ZYr%ÙMö×ïyIñ%%ʶâ¸ÛE ‹EêpøÌsæ+Yâ—%¸L\Qd.SWæ©Ë¢ AÔe© š”.Ë\Hm'Ë$j_+œdÁŽ—öžªË'¹&.Nмp¹8)“Ìåê4Ir—G§!M]ZSûÅm åhwj[V’ÁN±-Û ¥àŒÜ”qRØVjÏ XaØV‰óÛÊìŽB°ßB±%ØÊ±eW’2Å÷"ž‘ÚyO+HüÇW_9ÿh´¨fÓ¥óûû¯_?}ùÅþá›7vMÿdz2;OÏœÿq<Ý›.ÆÝãùb¹>šÛS±=;ûqµ8™/—³9@IÜ‘ó/F«ïXœÎ_½[~¼¬œcCóÖœŠëŸ.Ïî—Ú7oz%«¿›ÿ¶7¹q¿;kÛgýßèŸ9ü{Wœ·¿ùÓþù¿º¯¿®ÒÞ⤲’Êìyû½ë³ºÀêoøýÑå³j|vn­zøqµtÿô{þ‘ß÷þ©ÿÖúïü‘?öoýÈÛS©æãÅïþ7T“êý²Ùšã2õæïÕ’ÛvsàÄŸÌ&³©ý½¸ùS_ùê«ÑÄ¿÷gþl^ì²þüãåy5õcÿ»ŸøIµXø ?õ3é/GójZ_´Þj.yi¿9;õ—“«…Ÿû…_TãæG–þÊ_MO«ùâd6¯üµÿà?úÿTóÙ¿œk(/Å*‡?˜ŒÎΪX Ó£G³Ò—±9šZ]D¡ýÚ=O*«VCjBñÑw£‹j€þóåh2>Ù›žM*û¦?}è•øáx±°ZÐûäxY]ü7õ¨îUÿvõ„b”öY]-›(ŽÄ$˜´ÛÑÙn³mu˺ڧE»QíšíÌüÒl¯.¼o¿m…³°»\}ÿ°:šbi<.¦OA‘¼Â“°°Vת³«ùIµp¸Î“˧ÇK{¨p8K "¯w^Íg'àìÛ||`7^}XÖ¸¶eðjtVµ1uŠùöÑá«o­œÒ]S “n&ÍwôKfùb—× Þ™Iû5­ÞeM«?ôïÇוo%è§ãiågöZT×Vã~y>¯*¿üs¶…áá,M³bâ¤>œiZÿâÃå&Ãke»Ið³–”VÌZÛÎìàÉ=ÙûáñwGu ){ù¥‰ƒOÌÒâà‰åŸ•nîC¿†Éc˜‚nþdóJÛ®µK¹=]|ú=Ý#¤ÃtòÄÊ3K(/,¡¼®SÊÿ½ÿÉÿŒÄra:_Œ¦§—bNg“ÉhŽLSnóMWÕz™ç†ÜÓTƺ:Þœ„PkÉèÿÇÕlY¾›4Í7×STW»“ÑâÜRVWË7’ןMúÚRù‹¶ö§ëù+k¦æýaþjíßÕýõÚy¯ôU„OI_Ömþ² ¯mβvp?ݘæÐ/¤0ÛÎÑ¥Xm×݉­©-†‡Imy襶\î‘Úîsó»äõh¶¬Ó…5,y BÉú…’V¾ÿéõOŸ>2._lt*ÐÙL逽|3ÕäËOLýžÃm­ôaßbóÌí×Ûµ·0¼Î°'òi)ாÄç÷! üçÖxe²ãð?šèoÕ÷°op¾Rrmã«‹w¦ÅñÙ´sò6ý®;w¹rêõe? _ר$ÍÑÌØÛâѶíBx½—J­;þ»½úЪ%sÒVé¾Wí:z»Wý‘I?7è$>Nz UŒ×Üñ÷) Ü…ô^ÉæöBI¦P éŠþ å>7œ=Ð §ýÎþn vlfätóýtqŸôgßü m¯íC ÷#å†ʾ/0lz[iù·/ßýV,ëÖ&¬mÅ·÷üؽMéÙsÉ¿ »?ÿòÕ¡³ÆÃñ^{¨9¯‹ÄŸŒVßÝz™°ýŒ0l½ýæõ›Ï¿xVM®«åؾÓoµ£ñ6ƒÊ8h…]›AEt’ãÙ¤iV¿VÍný½ÿ0×f3%¯["l˜äë “ºx1žZ[¡nE4m‡­c„]¬ !±ÆíæK@7+Ö¿°Ñ< ± ämã,(ö;W©\•Às·œ_a@gõ~lçÎGÓEÝg=ùØ^éé|vuy+áwÝ!zôÍË'{o·"zÛè\VY-îÍjVÝü/«Û<7pTóœ&ël ÄW¨&–fµwLmßnêFÇâÃròÏák¬Ý[Y÷7káÎVíÕ7 ¨²Þ>µ#õá<“úÒë¦É&€ÃÇ´#€ènÝE –]I Ì­IRb"lµcMÏ’MLf¢.ÿD‹›gb¦)íNÅì rù)r¯p˜øk÷JÌ#¶{–ºBšsÏRaZpOl)Ïêp` V¥BÆX¬}2Æb)0dŒE,&¼`2dŒ3pL€ÁšÔ!c,j±dŒÅÊ"d]ÝbÉ‹UÈ‹uuCÎXÔbÉ æïrÆ¢KÎX0{—3KÝ!g,ÑbÉ‹õ/BÎX¬§ Æb¶ c±| Æb ¾P0k…‚±XŠc1=†‚±«¡`,F@(‹ Æb„’±`f²#Íj˜-‹JÆb„’±T‚€P2– M'Æ‚¹Ó’±’0#@ÆbHÂXŒIK=¿ÍX0Ë0Ìu'Œ3Þ cÁ¼wÂX0ûtÍ5‹%0#@ØÅ‹ ±‹ lö ŒÅÀXŒ¨§Ý³XØÂÂ#a,F€pŽ ˆ0#@Ø"ŒÅ6¿6òn7Õõ[?qª®^>Üñék#b›>w>´õv5Ÿi‹;‡ØãûßüüÅþ᣷åŽc¹Æ´Bk§ncp; B6l®ÿ+jïu½¿aø‹áÌ×ïQVGšöUó^bå<ŽZýÏÒf°3´xζŸIÜ2_¿>Co—è @>¯çåGþ?©§ÝÇ«‰v,¹]Ô«h¯ûC‘è>oŠLšƒ¥1Ž_\ˆŒm3¢·`ví9í¸ÚÃPwÍ‹[½®"9~ól«›Žve"f[˜,B4OìÆDÓûJ­*o¾†ŸÙÈW,dyï³:'÷ö^¹‰©y/0µ“7ÖLÁâh—åp@;Yã©Ù%OX1þ­15jWµb•] ¶^¶3.ÍŠ8®r½eëäaxÁl7\¢Ñ‡aWðäÎÑo¤mkºnê!ô ‹ÚÖŒ^ÿÿf Œý²½tóz®ØÊþ³EÞ¦ŸFäm³ê¯Ÿî'¾~1Ý™{¸¥¶?¿_aF¬Bµ6KoÙJg•kÚïÿß\ó»õÔåöëý£p¿endstream endobj 116 0 obj << /Filter /FlateDecode /Length 6166 >> stream xœ½\YsGr~GøGLìÓÀ$Fuë÷ðÚ^…W¢°öƒä‡fb`°AŠÿÞyTweötƒà*¡5 5U™Yy|™uü}e6veð¿öÿËÛ“oÞæÕÕã‰Y]üýÄÒWí—·«ßC‡º²a㣫«ów'üC»r¦l|ª«3ü­¬ÎoO~\¿=5›`Kv}yzf6ÎÄbëúþþÍüÅÖjl\ßnñOÉšÝzw}ssÀ_9CXÿöô,x¿©5®ßðÖ%çÔh{ñ}³‡ßcm²ëloß[hö5yWÖpæ\’ñë뻫Ó3ïâ&V´þïùžÀtoSXÙ¼©Á¸Õùù„c5z¯y„œÜ÷üûZÓú߯¯:ÝïÏð¾ãêú»S—6¹D¯HE ´ÏwÜ\±C'ô¡ªDtwÙyÜãü (‹ëß _!%Æ[ïà“z ‡ßv™_ßIR¶rRb(—°~ssE³šR#΄“º’Üú¢I–þ±%±}óÖÚUÝÔ”]A­p9nR²«ˆlùŒB\ÛÓó¿œ96Ù§Õ™kmfùþIƒ¥Í°(De¬1ð fk<ðñ3æÌ×$rƒy½c sˆ ¾QÙl4Mξ„A%úxøÃì¼uë'ñCd þ”’r˜j’+Q}ëÇ~•65gCç²q0ôÊÃ2eÔàx‹OE6!åšA½çë×Ì^N…V&ƒÔwÄT Æ*ilwÜ?¹´þ¡sµ½c¶\$ÙÌʃô.øÒú›Ûè0Ó[%n P¾RÄ^¼æñ, ¦Ø~aµAáƒÅßÙX6¥¸Õ™ñÇ”@ò Œ+ûY ÖD˜í V·ºFxc Y Ù[,V5ÏV°ÂTPÉÒ²²rö^À¥Íª EJæv‰@H-ëÏMü ¯BïÞõE!}.Ùæ53 áT:¯÷ýG’ÎÃüòpaòJ8ÙÏÌ5Œ¸þiMí%”¨UMÈã\šÛO§‚G¡Kž2Å«$ұ V]ÓÀ™vò %°ßb[£ö5SëÂ×Û*¤  ¢wDêdæm¥Mba0¶ À"Í*ªE”ÇF°) Fgl"ƒÄ&6=zÏoÞ‚#È·Ø’WŸÀŸþéÔ:Ár¯¢÷@LZÝž9^Ç–›“½.˜“@!ƒ×…17 ÇHo\‹IoH[LBgtÁVb2«lp¡æÀjÚ0ÊÁ± «¸Þ.6KNÐg¬F§ýíÉù?ÿÈ ãPwRÓW@Q¨Ï ¸œ> (æ“‹SàlËÿˆÑåÀÍÁÉR0/ÈxïÁîop&0(«ñÞÝ©Ë@x‰ôÃ0uÓDExÍç »¾¥1,@Žt<žÏŒ&íߊî˜cð¼ÊWOçm¯ö<hý{k·­Ù…“Ü•$$vdÉѧ”œ‚ RêbLAý½@¦$¤ É\Ö¥Xˆ ,ÇâéEr]àw8^ Ï¥ ˜¥lœ¯¬jÞŒƒùŠeiâGÑÝuš®>tÝ~ß›9F;³€’‰<è;êgM‰¹R‚<§JºC—É”›äÈZ ~LjlÄ%º$9ƒú‰†víúˆêâ ,âžçÃ$lï³>+ÕR}ç2 ÃýWê§O¤àׇwúØí‡0þŠ.Ò)BqPsa˜>ÆŠ¾„L¡M“jñÔ™–-=’pBÍ Ce[*E’Ôûž' 1K%Ж2;É—­ý+K>H-ÝŽìzJ߇.Ú¥´´T’¹ÊD昪¨qÐ*UP4?ðÜ µ„«t; `šQeÑÁåapqÂÉï[€’> ° 8Wæ’LÎ f%=¦c=ªDm`\¬èP <‚¨KVQùVárTZ¬6zºŠàÊiÁSkä ~¢9ƒ„© fêÒPHËc&‰­ŸA.eR©¹ì«°çy‚áy2ÂÖª•NDxäÝ}Äh­Ÿù¹ñbÂ/UÎv`‰²ŠHÍ‘ázÁ“ÚˆÉéRÙ›ÍÒ5.à%)ÀËÓÙ2œX¥‘3Ñ92ZGe)&È隈…‹Aƒ5™w©ã’ ß#E€Ë’|*WŸýo›dâÅ:] as¬ÏG1RR©óu ŸÚã:@Ž”lZcÏ=ÐKŽJŽö;©ºd­`&mÍ}Å$ûF²Ê™Ȇ@´*~ŠùoÀÁ‚—â»è-ZmÈŸàA*${²ªúÝéX@þ놻 NÉ€t7L¯ƒÐ¡ùâR” Þêù{„XÕ­°7YÁ¢)j_±úBîg=k/4a)½55]«¬k:cè>æêétÔ[ʼ+› µ„@ 4úšÛ Ró[!Áæêk#ö©GM¡;7óúÌ»!‹*SÍ…¡“Ïc"ZØ ´§…ÞÏEašÓ)‡³½— ÕE•â­kø‚ÝŠféÙD6õš§Çª¡ÊÕD_ÂÁà¾quÈdHœvñw³@sûЈò$Zv–¦›48Ë«}ç@*Ô{AÈè yí ÷"å–®fŒÖ‚j䇹°Šê ]Â-ék.¹·¯ÏTfQébq@ŽÝä†çA”1ëÎMô‹jñ‚¤ä_@|ˆ‹“WÎ =mEHö‰ökZÎ÷$!1ª› @uR)5‹üGž@âë"u—ã®T‡‰Û: ŒÀ@Z»äG‰4}½…bIo¹oʉµ+Ò'¢ÚÕCL­  ˜óê½0ù³Acy䦱mó·>Ü ÊË4¹ïx¨‚+Õ@°ï6ãUaá²ê„ž8`¾]ZŒMd’_cIóe1vìA!É Z­·< åh² m4Âà¸%B¾Uô Ód!Ù•Í ™Û‚³Tµ'L n˜,DúNŤ ¿ãØŸ˜$·”£Édç}YJ6Ì”Á½ìÁܺR®»±ï” 5¡[™(ôÁ…$©~ÐVÁµô¤*ód]l¿Óá]¦2 z)\)ò+mþÙDI_Û¬Ê&ž j4Í#ÌQÊD3,Üú„öˆ1cÈ`?óß‹)K šäí£ Gq›”&pz<É88¡ƒ"£*Èü澓©ty!K™ö݉>Œ"ÐÕå)ɲ¥ŸOcÜàvã0$zI†Ÿ9šèß:Ò¯ êDZþa é)Ö=ËT}ÌFÄ:wNgèzmºníñO¼ù¦…ËàŒvx;áæ¥,câpxJÁRÆü€éæ+Q¡zÅ¢k“žAÁBdÄŒ¿ðØÀ슚 eÔû|Š»P&ÐŽy†$(„ôÂ@&HÛ8î¯lw}U¥ù2Â<´Qb­ÓY¯ÕÍ-Çià/}YÊ}uçYh!¤ª¶ÑÜln“2É$°¿s4Èèm±åAGÛÊùèÒ\üäXÕêžüÃIÞ-dû‘·ƒ=•^T7àÄ«=4m@!œ)•öN0ìáÑ ,™ÊÈ} õeaÜϯÜB=qǃ§¯×Aëú ëZÂcZJ½w ™Ë‚щ”’4Úë›Y"În|-Ð9Ê®rE³gBT’ü¹.óD¥ÒgBDæ©‹1<+•AÐTK•j*Õi¾è+ øûQ#mëžÚ¸èC(~ÄŒ»®8ˆÖN‰EHV:y&úÜ Ê~'cð y1(ØÉé/½. GŒª]Å`Œ&VY„øb{:¢ œ?÷¥Dli+cK,”þõäf6êL Åzo}.üƒ˜=XÇVîŽÒaM0[•Á.e…—} ëºmæk2µ¾â1ðè'AføN>/U¿”ÿÐv˜Å€äu@bp7ÀÏ žË ~ƒ”Ü[CJ•Î6˜ñ`!+8¹Cµi‰h!ñ!°U.ïp.×aF×LH<²™‡ú®GÇð1¹L„n¢æ%·)®Lvf]4Á²ÈLj ¬8NÁX:ª®JÔ%@€è­¶4Çv»(Ñj]¦åth®€¤Îï†-Ç{‘ËTUYêh¯ôF(¤põ’õû-!˜õs3RÑÿàÑ’3ÿ€g_–<žö—Ï`KW±Ä V­“5lÆåäŽß±%¶ä:ì»ÎJçzß9Ý9¥æü\üýKÕ ÂñjS¦Á©ZöóÕ ^1]wñ´×H´:ÅüˉJ#ø‡©ÆYQ𘂺èj +•f°¼w:ÖwFÝ[€šb^^†SÚå½ÝÀ’ÏaÌáäGë¡SqòC:8ÜB xÂÔ-ü4Çx[Aí[YŸN;½êÔ¿âs.æ÷—¶ì&¨ ¼%!Ö¥r…®…5^½ŸEÄKÛ˜=øËœGx0úTò«Wç xߨµé9ãÑÇûR,Å@ájv‡Q*ƒt2lŠQ´îH¡ÇS13£Å(NÊ,ÞzhÛ87¼ÓÚ´·“…žã5¤áÅV¶ÌKt˜»è½ñ3Ÿ ÆyÞõÁo‡…ª†49]a©ÄÏÏ`Èìk{ñEǨï´à)ÞžHÓ©KÄ“v‚'G’>Ž•€…X¯C/K h®´böx‡ê1WXžBÁœ`#jÊ•ìÅìÏ’ÿ—l–÷l‡Q¡+‘Óàâ$ÖÚŽó/Ø$ú™ÉÏõk*CÃìe>½A`oV5únÏîQÀñ¾å£[fRñlP1¢žÕèy!~í ÍN5B™„¥œ,o -œ$Z¸ÅôÜ‘7äq‚2N,-çHÙSÝgùˆGOY¥G?Ú#;œåu²‘“˜ Ϙ+R¦X‰{¤ÉV¶ŒyÇÇ\§è} |<Á!PÁ°}Ó:èí›…<{þ æsûÆJÖÑF='x®mÀ'ÈøÿsgTz+åjîÚ/×ÿÔ×paÿ|ý=—2SŒ4îݽ(´2—¦,M´›Õw¥Øú0X”¨žËB†#Q¢r¶†´Eˆ}A~]¾íèøP–M1¥~ἦ´óI¶jWH$Ò彪·¯H¸m¸…}§Üè¨Ø›vîÞuîž‚dÎÝÿ™†L9:Ë÷À`L:J‡µ:çc¤pJ7*ߘã[t‘ÎÅ¡•«‡fº²Ágg~;{ð˯=Gü¡³qhym4&ó16S—@æt÷’n„µã#š]Ïø)®]ªh8[-›&GôKW¿>9ïy 7:\Àºn7:†–üF^´…µá—غ(Še<5e×!¨/<õ„BÛ} ´ ]X²5T¶6>µBå¢nïýiþÂGØTø3]­¾ùäoI»‹ Å©=H¡Æ$á:pt œ£Ð¡yy@dr%`Ánr<ñDjÿ»ªÀ E[Xö…˳*ÝaPìÌóæ9—ü9?‚«á%@@úQQ,]Æ,¸ÉUcjF@0½92¤[­ˆ—R]@/¸2p¨oØ\·x•k„‡w]ör¼³¾¥žRœàƒžõlûÑ X¹è"ÁR™‰‰½Š¥M¨ðäìæØ¯Ñ¼øãÖÿ ]XÔGnE-ç©óôبÂW$”XÜÕìÃü‚?°tHÂäXðì醗mPÎÝ(z.ÈS*÷õNùÏ&,mY]É:î^`otõ]Öð¿¦tƒíê¹s› æßž¸Œh'ð?ŸuäiîB4¸Z¼'?wXk¤ Ñ–/ÂgÕèÅ…èÚÔš*/À­©|*CÛTËšˆ§±ÖQÈíó…U|Á©tÔåløäCƒ~Í¡ 7!ùŒQ}ïylg¹¶™‹¡÷ xÞYOxI­l¬¸™Î±ö^Ѓ×>3 Ü%õ’¿‡LVé™Ëì”Ûâû†×&Øa•‚•z/ºÊIv’Ó¯eâ,¢)ÍdŸþîWKÑ£¢¯'ø½PßC—â-›1ÐT• ŸúÂËÕÞ =‘í襪 ‰·ÁgUIþô†•ÖèÑ£ ¼ m¡ÞÕ–Ír•ÎÄá¹|w¡gåÅX<Ò¹0A³' ";îâ+ÿAì¯)äêŒE$˜VguRñ‰¾‡`Sdäs$4ÿá>wgÑØî±Kßò+TÎâõ?ë6ìHUep…œŽTi*è·q÷>çY‡B ò~@°Ê]iöÎn¸º¤ÙÓ 4,Æ’`8Ñ õ`Õ¤yîºUK“<"cª——¢óTq+œŽ÷h¿Í.eÕü^ym¤ÎÙ$=Z¹¨Ñg+I¾æ™¦^U:¥óDjñ3ñ%ŒÑ¥™Þ4¼çrù½oìB„†^ñ]¨#¿Ú©~luQd?§Ú…[¹kÃÕ¬<Ì–)Ó‰.Ò‰\°æm)¶‰1YÝ Ó}࡬ vŽ[tøZpágõ•Æ“nA¶ Uùˆ$ÙB»ðlä`7tv¼Ïc4ÎBIU™ªý¡<%¸•j­O]]„ŠìŽâ(_š‚€Ñî”)áß”Iþí·Šð(ß¡"&—vÐ…¨ü¸Žó&z˜èYãEQ„•€€Ï XWzÀ¥°@A|U6£Ù3Ù'¥Ì&]8IöF9¾ˆOh ×{þuå•÷ÎŒEý Þ—†!¤7*uUyÖåb NwÌÖ/p€ŒÛ‹Ÿœ¤Î.”1»ô]Oˆ›up»\‹æéʵ.üIkÿø~+¾/ö’Nnü~Ó£öƒ›·â[öh¾ß7½Ëh>ˆï߈ïŸN‡Ž}&nà òkbp 4 ÝŒøŽâ¿t³-»µø–K‹ì¹í#yG2Fí—b¸0HtÁÂÜn0HGû‹E8±Ä¹2 Çx~’gH¥|dpû}ö.×Þ¤W“¤Ëq߇¦'Nb„‰ç½¥ªg “ +ò ù¿=ú½(.ÍH>Øi`jr7‚žÍطζ–>B懰½sol/âXP¦šæœŽ^§ÈOäf¦Þ©¯úⳄ¨—Ë$òOëø>4O¹ulL͵bH)€É²úÙ…°µOâÛ‰Cú|æÁq×Ôö.FLÿz€×,0޼Ããd®«·é6¥ZÇÏ¡|?yðÊ¡mÏæ´—ÊŠ¥'‡—íÄSS|žÉ<;D'*øU³öÞ‰/ L‹êU¬',`·×Çn©dRœ½6àŒàLJ«èÉþU{4+Yõ°Õ¡µšªßg/S‘ .ÎÄZ±’šŸhÆénPïA1! ø2ÐGO*‰å Xú1&äÜ›0yŒm$Vt¯-¼V%(»ˆW¹™ùÚ’ÆòúKcâÄn·L?îý¿¡“ŒÎ¹e^ɤq×"”Á¤Ñ3p]§O’IþÎ|ÊnC†åp!JU»èŸí3ƒeú'š\IÔíã‹bL©ó$ÛO…-<¡§šÅ«Y>à«YߟüLdÓendstream endobj 117 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 2569 >> stream xœµV pUîa’é`dÁvƒàtX\,Î@9DP"Cg4&Éä€Ìd2™œdH†\3ó3¹ïdÎ@Ò r’A.@JAXÅU£¢²þ=û(k;‰®¬+åÖÖnuM×¼®÷¿ÿ½ïûþïýÊc%‘Hd+×úÏø7I'Æ—Q¸÷»Ã=a¤Fz”Žhêhìüîx#FQR‰$#«0 A“®‹‰Õù†Í|jf¤øò÷õŸ?î4ßY3gÎ÷}^¥ÔÆE*Ô¾+ºX¥J¡ñ¾ë"㔺ôÁ…±:fŸ_jjê …*iF‚6fÑÀ*Ó|Sãt±¾k•IJmŠ2ÊwY‚Zç¢P)}7:cð Ò$ë”Zß• QJ­š¢¨ÇžW'h´ºå©ŠˆàÈ(eôê˜Øµqñª©ÓPÔ¨UÔjê j µŽ ¥&S¨%T5zZJ-£)j9õ"5› ¢VR!ÔHÊ›GÑ¡<(“ä!‰Fò—aÑÃÎI–vyh<îzÆx–‘Yd·é5ôkŒÓk²×ß®±pDÁˆú£·[ ÛSM¿S–û Gèðl“챜Sðpâ§­È‚^Cè»ïž:s¦fCˆœd=pîFЂ¹™ñô§0Ë.i¾„Í—¤ÂfÜÊ";ù[‘Ó&Ñ䑯§¢ ‡÷‰£åd+ g£!¼Nݧé5¿ ÝЧ[z›öÔµBt§7Fµl‚`ˆ†XX™–ðê¦4%0Þî—Sx·/9qSHÚ#uûºŸe­PlÈ3› yòW†Ÿ l €±d™%>[H$Î!3ñEœw'â°J(É6˜ós¹d6a–Nf)Y׽ث{.Þý|™bç,Y`¬¦ 휈*y‰G?»0Ý)ùîÖ]’¢‰Ìg‡ÀYB[µ]Qoƒô~dqÌô/‰dvXp‘;Onå÷Jr7s÷¶>¹ÅB 6ØUY×ÜÛgk惷f2"p΢xuµ-•Ó¹2íÐ$;jˆÜïÎ~EŠÏ žíïüìr™ÌEòœ‚íy aÔ®ì:»½º±YÓ´åiµ_ZžÜŒRyìW¸n²œ„fh„ ? *•^bª< v”Hßc<γK¾=‡ãR\(LbqO&`p²Ì<=fêL#“úi¡‰ô}Ýñ³ûÎ\”¿ž¼žP+¢áf½|¨ÎñØÆKpüUMŒ>Sqw~µQ4¶±lòA bDðPÄkPQP¹ G“¿ûeæVB9×}í>_“öâíÅÆr[ …¥E•ƒ%fÇ ÛîkoÙ%=0âÜ%§Txí¬¨©Îͱ{Ãk63?84HmÓ»êëºb “su±vsèM¥?I“MÆÅsa³ðsíé?õv±É‹ÂZbãx£æÏÜ©äuôÚ¤½Ž×ʃúØÉK¶ny%âÀôÁEU,r±( vÁÏŽq¢ Ñ*ÖÄ3î vHðƒR»wÛI•5-*uETþkHׇiqœ%”+X*ëôð}À4ßÍ"ë—I1\j|düF…ØÖŒÆ(‚zñؼÛsPTRá<–³É2Ó;ÈÌÙfSé>NØO°TÝ7ó2µi¶è*˜õ  f Á‰üµNIë% ¿.Å› Iõ .[ ~é‘ÄkÆÄãúb2z¢O3Ž,/ÏãN³1ËÈ%¿ª &dÁqœ† >ê:Ú~23ÊÅݸ²õ¬»³?Ua"Âoi †0ON&1·'ã°K=Gm5Ü2'Txòt`Ni'üº÷>+Z½QŸœ¡ÞL"¡*ð¥‹UÎ}œ½¥³å(œÖðŠíU¢šÒ™¡#il0hÁ9g¤ÂÌd°Ý ½E"²ÙOQÄç›)(ŽH9Jò‹òrLùù&.qîrŤ&|ž³Ñ»llúbm‚ï¡„LØÇxã1у¼x,ïÉÙÏDznÀQØÍpšîcÀÛ}êþžo€[·âÜÎŪíQúË¡Îàÿk ø_I²ÈmØ%žà‡6©0·³ÈËj¬`µeˆ—áF`MOƒŒL9á OëÓ!=­j9G2=¤[mP_+÷Æ+¸æ„¤«¥Ø€kؤ:tÛ~4ôKnôK1XÃ6êZuªN«Úæjt:šää†Ç¿}ó–÷˜kéEQÿ~èb$endstream endobj 118 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 7479 >> stream xœµ™tSWÒÇŸÖ{4V^°<™’Ð{ „Þ;¦cÜîM¸Ûr‘-i$¹÷"Ë– ²±M1Å›ZH€ Ú&$$rŸs½ÙïJ²Iö|ÙM¾=ûÁ9:Hè¾{gæ?3¿¹PÝ»Q@´`ÕúIMÿz‡$àwãߺcí/òö$+è-„ÞݳkÃ/îû"·~”P ˆNÐ. Ž Ýéínï8qÚDwò2É~ÒÌ™3ÆÚOž8q¦ý¼ÏÐî®ö«\Ã}<\ÃÉ{‡ ÷žáQæ%³|ÂÃߛ0!""b¼k@Øø PïLOk±3ÜÇ~½g˜gè.OûÅAáö«]<íÍo~], ÷ µ_äáHQÔŠyóƒ/ Yº8lIøRé²]Ë#\WDº­Œr_í±Ús×ZoŸõ;|7ømôß°yÔ˜ÞcûŒ?Áeâ¤ÉS¦N:}Æ»3ß{„ãÈ^Ö5”ZC £ÖRéuÔÛÔzêÊAm FR©QÔ&j4µ™Cm¡æSc©­ÔjµZH§¶S‹¨ Ôbj"µ„šD-¥–QS¨åÔTj5ZIM§VQ3¨ÕÔ»TOª7@õ¡)kª/ÕšGõ§l(1õÅRoRÔÊ–²£Rƒ¨ÁCí¤zz zQ+IÀ¨î”Z0PP$øµ[Œ°P*ä»t¿gµÖê"½è ­¦¿cæ2‡z èñYÏÐ^#{ý­wXïû¸÷¹`íiÝÚweßÏûÍï—Ûïýým6ÛÜ‹_½ÑÀögåoŽxÓðæý[m‡Ú~e÷ž|à„ƒØA£-”8è“ÁËç¾Õó­:Ί;(™#ùÔ~ª}ë‡!Ê!O‡NÚ6là°¯†ßåÖíI`D[ü2 ®}žÚ¾’M-PfÅ@ (ä©qؽãÛ¨-î±UŒ?]¡>¨i#´)ëTÇz3Ò[C UZu®Z#9‚X!ÇãÔi9¤Ù8@0çO7j¯À^8GTÍJÓ’(z ÄeÉê¬çsYd…oYa©Èšo#oÕ,ÕÛ n—‘çåâèzÆârÚIKɃÔ­šj¨"{ï±ì½T‡%h%ýÓÕS/äm\Ïá¸ùÝÍ ªÝ r á>ýãJ|uë`>8º­bÄ7_ÒxˆÌÊŸ¾’²Mbݾ…xå’í3Ú É]tæÙüçÄ< å»±HE×k²Z8ÔOô¬aú¦Ûf`¡äqû¬ìòE¸Î<˜p¿Éutó¯ÝÔȼ%•´ø¥·RöæÏ!»Gÿö`æ ,Ì—¬Â·YÜ_ä¨Ìª— *´–þ¾yüÒ…›g—Xó ™Ÿ¨ÔÜE»ï y?äË¢7F¼Â}pÿÑX€ûcö§1¨êóÃwHÌáìȺ€syð‘ÐCpaœ¨ØEÏSæ5JÐx’&?ÏÒ€JÃ)T •ÇêK ùuuþµ.œøæ|ð^çB"jOÌl1¢#37Ð0ƒ¿Ý>‹í8ò:=Ë»B+jÐÞ"‰sC£yC_z,4Hê>ýmn—Á3}ÇpÓPf§Á½Eh4Š1G ¶æ9™žŸ^fSoýEÂ? ~ˆ<Ð&VŸv'0[|ÜgÏð>ýU$§(P¥')QlKGCJ^†Z]VÆi4 )-;äzXUNäLùä³ã»ò%¾uٮ٤R9ä--83°¡êÀ}Ô-c’¿†S'倘È(“ü`N»T%$ÄsдĤ4…gÄ’èY{.uð)ª–JÄëBjäŸÅÿ¤Æ$ 5òo›«Àô‡> ıü£ lt¿{09]$Aóé}ésFÚKµAî0¼µÄCþuô#­ÌK²‚·àîXœ´ok@­¤.l­?ûóãIxÄ¿- ~uOŒ;¼OÇ“±+vESñ´^"޽_TíùˆäŠ­Ì€FèP½«üt $*ÇgÑ0#†V†ŠT3ìG¥1Ò¯p-û>Mh¼Zsõ"w:tM`Æk)<.á,-î¼í1šuÐöPÈ·ó?²š¼›\¥Q䣘GJ£'̳UIãqЧÿä[¿•¢Ÿë¤Ñí…Ð`ÖOýY°E¨ ýÙ·HA”é¥Í$A^÷¿H~Ðmv†çYéEÉYGIz Dã¯Ó/¦§n_2FZK‡¾êüŸ[ ˜,Á£éÙ0åÄ‘§àPMíyÆý½³¾ ~(DR“ýÚ¼Û\•ɲYÄ.˜ÕiY}[Ûi™B6‹ 1ù69ñ>¸Ýyæz–Â|æJY9?Ð((ãã„üTtŸÍ©(9xIÍépe *Â`‡&Zmz&Ý¤Ê ‡HHR¦¥ÉÞÆÙ¶¸;ª“ájìªöA)W€ÊAÁà®И—\€ty?Ž‘mfœ&µ ='=—¨"Wª?ƒºó»Œ‚¨;u_ˆN¢‘ì„­›äKàŒ7×–¿»ª1H$Ýç<ïꚇ?^»r#O¢Î&ÛíaøµôB¸@vtVzªÁ¦€§ÙðFú;ˆ÷!åÑËbV©‰‡þ²¥ÇŒ &³¤Ä,)‚“&ÒbV£JEÞËA™?çØŽDuiù* dØUïÙ#PµEØeU+sã3äyY‘ÓpªíX¤KÍ'KïZañClR{[Vƒ|E¾²Á?ÛfÄi“M~Ðdfþ€mÄMé2ÓGv µøF!ÓG‘Ÿ¾êѤ'Gô6Í7·?A3._#í=à8ºÿ9›î^íÚLù¹Â/%§Bèu¡r™oÚá 9ÒÐ û¼›<öm-ÞÌÌÅŽËtÑU5¥ºªüÔújIuÃѼ:`Žžö˜,ñ¢ÅoQ,R¬ ˜»3t383ï= ½À‘M.Á‘ýe-L z—A]°Ói›[ñ“ÍwÑÌL’Š¥¿‰ÎÏ`ÑR4/;ûxë—j;#¢ð#ð†õ°Óz¿*3’ &119_Âm¶èê!!Ј!l¹ —g&åÄC‚]€D˜ ÑLª °·“Té°+=à©e›Z—QÏ«…h?J`wïÝ{´²ÊØx ¨Å$‹e€*„y“&Þ"‹rev<áç˜ÄøTùªÙ¶³HÊ%!럛¢y…j™2v£:Øä+ Vµ¬ù³¶ãp¯íëÖ*w?]¥1ª« š••jS  ôµõç>û|„m¶¬ †ˆ/))6ØDç»Õ§4z‚ ûT»» ˆÒ„×2æâB4=L¼š»`+–ÀV]é¤-sAéxj ÕêìÂêF|4¼¨yëõA]H5ê{,"•y6¸8ÆD¤*f‘ e Î+Þwêdv%†ÆJÏ*7ízp/åš@§]þž¾Á ¼+Úei¡”ô+R‹ÝuÀ©ÙûØ…§OWrÖüZÒÁêŸ4L¤·ùIœÁ4Fô@,šq§ùxΕwç¦@<RQS¥+Ùýéœ}àþ0…ûqâ—øïG¹¬C½ssAA*¨\ÉŽ_žàŒ˜ß4å š&±þedg^Ù×ð•_ ‘¼}›¤WÃ1xökÖQÐÁà8Ü<ÕÔC=íâËáÐR-áÕ4’ÿ½[F|Ñ«]h³Ó󪽭ºãª¨+«š´Ÿ’V°>¦ßg_Ù•™x¶(@•…ƒ:ÎÚ€C/h6 ó$Úù·ÙœI2PBª]\ º+*Ak&áž»œ1CŒê)êê˜vfQwrt,ßï$»ŒF#~ë™GùŸ~/qìO6ºTm4=cè(Ìbñw#‘IÙáðCƒÊ»cWšˆE)‹Øî$u1 ¸*loÈÅi‡M𳵇Ë{ëOBÑktÊ‹&çŒbÌa©l5üÌ!ŠmŸÌ&å«Ô‘d£ükEE S©*jD2e‰:#U­J—óc;žÙæ$¨UYÀBV™„?JWCË ¢PÕ6¥/øÂ6EÔ/À1XÒ1‡¶h. Í×Ûù1éR¨YtÝQ›‰FÝ3ìæE.ä!ÁI»XT'Òk¡üûÏHö1†ãþ¢¹/G“Áú0–å&kR“”òd%ç3|$ÂVpßÞð!\‚Fbu©´ª}F•€Ð£ó a»'zÂ"<†ŒËñ<OÅnëÆã‰h1ZŽÆ )ȉÃ_á¯Ù1xàרå£w>½û [ˆsp)~kƉ5:c.¶hê½l½u¿ôä-à°ˆ¡¿þðÃCÚ"H)âÒ¢â!” /ލ®-ÒU6yÕoZ4}ÓÓ³üoã›6CÜ@"#mƒöV¡ ¦¡ï!jy!Dè2‹f‹PoD}ùü»‘_ã·$øÕïFù?i- T¢ ËøP„¦ÀmŽ@yŠi¢Çnhý™{*ljÚ"n ù7ÚœÏ ÿ,C¡h.;žWT«ëŠ ’ìüŠšýÀ<€áÁ*¿ØPIrBx;ãÁB:T”èöP”óôòå›M1M¡’Æ=¥$«2@«’¥¥Ê ‰.H(Î-˪(I¨óˆp–»¹r®õ®Z)0ã/þÀYïiØ%‰òFÜN§1bM´Ÿ ¸3 ¾ß€¬QÏŸZo5ĵn©á6Õ¬ƒÕ¤^º@ŠÚ/}—Hš Ç—Ùw·?²·éVò‘è>êÓ6.Ü:Jb¹Ê1§¥À²BÔísöÿïg8¯‰ödЋßç¹u{¸TOâ{\ÚŒ6d¨G*d5çÅ·UÄ¿ pôŠEù4T@¾^›«©0P÷4üöâ°÷ðHÉóxöYå­sp‹ù‹îáþäDШ½j®„W;Æ.¾ÈD4-þ{1¡©†{½Á–Ârp?àyÀû¤|70·JîÔdB^¼ ’RTùBŸ¨PØÉ­qOã¿°º¸­~C¡õÝæiõyesãÕ¢KÄOÑ"~5‹íM~œ#'…Lßå¦:õ M%)G ]nZ––±O"þ!ßËÖ…–ùKƒC‚õ!ÆCyéHmRcûÄ›SU!ѧ7‡\C?ò¶,~øªÈ㜱»râÜ-ô¾¿ë”É©å Ïë/Ñóü–¢R%¤p>ëjÝL&ó›pÆ”!ïŸ+X’—Öšp%š?­NÙRãU’K*³pë‚s2ŽnâÖP\T5ªr“AÑ5ü:š‡ß,µ&/‹µV[ܸó¢÷CÒz|ñê&_ƒçËîÌЗœ!¾øk>Ìì÷'m/—_2ÓËä—±&¿ÜÌ11Œ=í”4mEj8„pEéºB¨fª¢tAAQ!›O¾qþâcÒWÛÇw¯ « ¬ «­­¬¬%xêE¼>³Ík4PöC”m¶oŸÉv Q$–’.Uˆ¦Õ£1PJd™«,O„3D;!n(çî/: ýŽ¿/à€YîôP(ÜcêŽDc…¥éyDÐe@Pä[ˆ§™/ ,p‰Bš¯. _½N”zR»ja7ìWíWþ–(/è‹'oiv€(»Èè´Hò½õGšrˆµªZË÷¼@ žÇ±-±UiR3 w¥_=››}¡µYSnbÏ@E<Ê^¥‰³4Ž2U® â!".Pölmˇÿs&%Å °[»Ñl1,:úý±Ž¸§­çøþ å}h<1˜<Ñž"Q §ÕAìgÐ5º›ú™·j»r'øÀv÷ïú™9Ú¤’/ Ñ¢öåìïqµ„~í¬ãHmú]U1¼¼}!ÂöíÂv‡-lª®ýÔ䥻Ù×iB,»µ©ÊC.%+äJ9^ѱË;ðy¡yB­= Ó ‹‰iÛÁ¥ë„›˜ÐÅvüb›™¡(€Ðdd’¶xýŸ/³ÍóüÑÿæ}ö«jÆ=˜—çôúüË×÷àG-¡ÿ%ßâÀÒ_„¿ !,=}0wŸ‰©”þ*2ÖŠ.~¢Òù’ _®H&Ýáf‹§òñªte&†wŸ*³—˜Õá¢q³¬9 åï­_d‹%óð4^¦ÒÒÑþËï߀ôÔ|/äØÑn«MÒ&‰OVzšÉgØ¢÷:2-ÚY>5]amù/:Š9#DÍHËÂ-ê³Y­A}§}œŒ<-M®eY”仑§ñÀž€çxá…¸¶‰O d§`äéi™¹>Eâ¸VÔ- ញ{Þ-G‡÷£#:oµ_ÈCÑ&”*,.â$¸Õ‹ ¡,""ã8\ëé¸Hˆˆ z‘ òN‘:”r?|ý"úa£ér­|b*lÇÐ]~8{$+ÞM‚+þ½Îy!m’bTä؉杖Jˆ„{"+Ñ÷÷÷Ÿßݘ®ãÜ”ò ˆa|«âË**Šw´¡yÞxÜk pXôOÌôÇ[ ›4IE¼±|jRnsõêMTé¬f/†p÷‰  ) n,ÎÏÌÎå4+µZ·"hµ³£D.'§JcR2Ò2òoßFôk‹QšNf¶×›XûŒkÿìü¯´·ÜJüe¨Ôi¿B7R~™¡Xà0LòW­@ÞFû×<ýüÈõœjHªá’Òb!¢²cKä¤ÍÜGkÎòP©Õ¢5ì\ºÎd:¼Ü%D޳ÿ»m¶³èì?@È/owd3 HÙÕ0yI9²¸´ÄD‡ÿöëüÔxÒö”v²œ¤¼ÂôÜ\-GËs¯† ¶Ígz)êmòèÞ­Š®öŽˆK”Ë9•ÒTF …éuYŸ]8/É7]i™¬ÔôTÙ»spÏ5•NJ««L§êÛmõ‚}wQö]!ï‚®±ðEê>×w|;³ØÖÀü·ñ~‹SgÃû07}Ò9ß»qNÀç凾©»œq n3Ø_c=`­!ê[ÙYxÁE¸”}¢ õº‘c cÊ¥¨²‘¹0V’¿D¶"vìú'Ó Ò&ã!’jÁ×…¨¥ý ¶4áܪSÀZGÕVÅt‘¤N˜Äù™ú!óýð ¡ýèIм&(ÃMôòåF›c/‘ócËð"¾É¾z&"îì xn‡D“¾ÀÖØjÞ„ÉÇ@[Ò *ªÊ'Y *Wññ‰¦3À<>øÞÌ÷·ÎÚ°J‚7`_™iš ³¿äiQ šOFÉÔ€çÄØ”äe¤[šÎ/­¹JÆìá¨çç 6ͨûôÑûOæ¼ Æ:ˆ^²wªÏ\!º3åÔ˜w欙㫬5êôµÇ!–3½TÐÌ“ÒI Êu!Î’€í;¡ªdU˜2’U)*HdÄ2Y”p‡Dwš–ŒÂƒ:»Ì-ùÈGÒjÔÃ^¦1Xæç<ñé2$@ÖÿÈ‘­áÎÊ[ÃÊ-F¼+ñpËMâa4“j"ÑyÜ.u´Úl†ãÔÑ9çÞÚLëäõ)uÍú^y\©ÈHQ‘™*‰HÚ±ÜaG–cy²VI<Í$BrŒ¥£ ¹0K£ÍLçòŠ›N| m`Ø‘Uì¥ñ€­ŒøÒîׄ¹†yx…ì =hýñè´¤ܬ/1TVF|ã|RvL»<u—ˆFÌß"±I ¼Ä\†^ÙÔ£ÞRýuÓËñ¯hŸ=vØ¥«é s3 ÀjÔj50ˆKóKY°r•$ÁR×M)ïîç¨'‡6½ùŸ,3{ŽZq÷ñ~"˜GÈãÉòGÄÈ}ÉVÒd èרZÙ,ß©çbÝÁÉ¿2V_¼;gßYçßÅoàA˜Å!ñ/X‡˜…O‘𛿑uâÉßb!'îX^["¶3¨¾Á®„€³ò¢¨øJ™[uÏUF®Ô ¶©a;löX³ƒÐ®YÄåüÇ7§ ß<òÁü+6ÇT,Êœ&ÂÖ ,H+cBE¾Øp¬¶8çBA~Væ-( ñtÉbfaÔwä‹%ð6  Ó‘#p8—k¥á¤ödö‰ôŠÂû‡Î[2}r•›…BU‡Â™~¹Áï`wìNÛ%̹›¯^»¸yÁzík|8},ûYÓÑ6¸Ä<™|zâˆ÷æÒ85;ry M¡2+¼X8ÍaäÀ!?.}‰¬¾¹ûs£ì°g3Y“»b?3•E}g×D¶Àj»ys7Ïœ¶àüÝ3u¿j±¸¿ñɽ ~¸ÉýËŸ G&Ù ÑUÖÆñÃv¬‹Þ¨ÙÌÊ®-1†Ic’<–žpû ±d¸Œüˆ÷‘ÓŸNÞ°-ÊÉ…ss w…¹ îÿõ(Ôÿ|4Wœap¿ØØþ¢šà˜êeKySõ±½ óëw–8åû¥¯„Ì»;GOáÌuö Þú7 |ëæsgEsM+m$jþáW‹ŸFvY‚ï³WÌKIþMŸ}˜Zåõ]ÎЀZÍe©ó4ÙY¦aòuÆÜ·$ ÜþÃd1¥_WÏBcMM뺥sýŠ ÿaç"ù÷Ÿ5¼.¼ûžÐÝ=œÂšznt îlüÐ:@ãÍߋ棾¨AçCÒ´òÄIK°x-·wKÀBBÁ³ópŸ“Øê,î{y.0™éÚ,Rc¾° J†ž eÈëÒÓB~ƒéwGÚH¸Š=ü°åðÞD5úìqXëì™–Ê69d33›1õWñyýéåAËW,²¢ŸÝiþøhM$¨9­Œ0Ítruhu™î’ Á4Ý9†˜ÑòI}'juÒe«Œÿéÿ€—Šmiɰ=ÍN|ú«x9e½{lÞàªÛ Ì8܃°æ_vƒ÷_ ¹e ÷üÁ¾*Rƒª9eRD€4?¦4•±æzvŸ¡ë݃¢þ*]9Œendstream endobj 119 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 998 >> stream xœRLu¿ëw¨8h&Q{·ljœecVؘn,d›‚Çø1ÛRJ¡åºr¥cZF©@»GGV -W¡0£Ž2tBÆbö#a j¶ƒ —°ßÃÃÄb^òÉ{|>ïóÉ{8&ÂpÏÈÊ‘o4ÏòOáüÓ"þ„|þ×µWÃ!Š€¨0×?'6¡š'æqTƒ8^kiÉ` µF­¦œcŠd»dª$3É©©òf‡L–ÊìÓ«Z•¢ŠÉRpåj½‚ :æmV¥UsµÿSö”sœ!-)Él6'*ôÕ‰¬Q³wC%1k¹r&G]­6Ö¨K™L¶Šc²z5³a3q2X½ÁÄ©L[ª6VaF*”ª„;S0l?–À¢±X,“`T( †91ÏÇÏáÿŠÎŠþäíbþG«½¾`ŸŸ¼N.Î|òHà2Œ(‡ »Ž•pP“]ÙsªÀíè¶y Òþ¾àPS³erZGæ:Ù÷’+Ø\(¡vÝ7Þü%pñ‚GÚªPå\ezR›GZ¡°¬ Ò=ã’冒£…C—&ÇF]RñZ¤ÕËÓ^¤ à(æ ,¨pí°DØ^®!¯¹lôúÝ!rxv´`²æ2Ä£'Qøß(‰·­ ›ßÌ­ÖhèÖb‰wì{ß LÁ—•n½»ª½¯)‹T%Ǫ`7¨æê=”˜oµúÐ…¥N>¶„¸e‚ç·JjmÖ÷ÀL>5{<ݾ?Xa{¢@†jÓ£çÑfôÂ0Šlo¯ƒæº3vK“Ô”•¯Ë*3ù[´ Å^¹ì‡÷ý´ý$ä{Ð>Dâ踗@Ç»$À‚<ý@s³ÝMT£«ÁÕqwEÏp—ŠÊM]uWÅW}--ÒÐ1àZyôãs‘m…àè°Da7YÔYm{Á”ðFăà°w&0?}ý ,S(z˼'ÄÈS’Ž~ÝôñgƒÝþO>~Gzþ浞P÷¾KOKÉʬÔÐB£Ð`m°ñ¼,"´Ëì»´Å‹ÈÕÉAüÎ*b¨ý.Y˜Êc„˜Œ²·T;Û¦tÀÙöx(_u¯ŽeO)_ºŸ¢ýWðÞÂë ‚¨Wú`tôÌR‹²iˆ—óvk{N~~ÞÝë4{tNéð7×ÛF€º8gJQXŠOèè 5ë(°h:C9lŽzËGÐMo„÷£8?Ì£àÁ÷£W$~!ôŒ¤\¦ÓÍ`±J…Ûëï†kP •ÔÂé4©A1á¼êôÃ\uL8&¢¶ú d´Ñ¿‘éüs’u‘ÐMŠ¥‘arwÔcöªÚ˃endstream endobj 120 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 625 >> stream xœcd`ab`dddsö ñ4±T~H3þaú!ËÜÝø“ñ§7k7s7ˤ¿…¾ç~Oåÿž ÀÀÌÈXUßçœ_PY”™žQ¢c`j $  --ÍuŒ ,sS‹2“ó|K2RsK€œ…àüäÌÔ’J°›Œ’’+}ýòòr½ÄÜb½ü¢t;): å™% A©Å©Ee©) nùy% ~‰¹© `gêIçü܂ҒÔ"ßü”Ô¢<æÄ¤d'g°·Xf1Ê36ÿèàûñ¾qùùåŒßE¯3ÿØþƒ]´Vwow?ÇÂêÉ5Y™]rE[Òf¥wsüæû-ü[ñ·šÂù «§ìZ0_~Fô®òõÝ«º—ÎZ¸~ñ¦™Ç»û8fÔu7WvuµÊÕ†W¤usä·¯œ3§»wâ"y¢Í9¥Å%¥Ié9m5ݱ%Ûöo]òiùAùÕÇv¯ÛÜÍq~†IcGW{g‹<ß-`W}OÚÍø]úì÷ŽëÌßïþÔíéïÔÝß=«º«¡ë7C“D]W]WwGíŒî»»[šZ»;Ûkå´þˆ5¥w—t×I*ž ¹üÿ»Ðwåïªï}NÙ„&fU–ÈÍøÃ!š˜»þÌ ß¥&N•_¹ûÀž½Ý»ÄFÇæÿf)Š‘Os,Ìîæ;âûÊÛ#vë{ãCæ•?xEóš‹»«8ª§U-™³fÚî3® C~+ü–B%ÝS¶ß™¿›^9críì¦¶ŽŽæ9?'“ŠÈnŽÈØwv-üºó¨üæ}»mëžÓ½­mNŸ‹ù|N£æ ¥endstream endobj 121 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 5655 >> stream xœ­XtSW¶}BX<qD…ä=‡j¨ % $ôÀTScl#cÜä*[V±Õ¥w$YÅM–-7‘ÁƒqL™z CI¨!2¤ò“L®<׳ֿ² ?™Ïÿ“™5ËK.ËÒ»÷î³ÏÞû\Õ½Åãñ³¯\0%øÛ+¼À‹Ý/ñã°íol»&zó¡wwç‹/õì‹~|¹žAÑ}(>—“k›%I‘¥mÝ—¶aÜëãbÈ·ñaã§N<:l¸qSÃf$‰Ó¶ÆD%‡-ŽÊˆ'Ee?ÃVHb¶Š3dy+.##å±c³²²ÆD%¥‘¤m™|Êè°¬­qaËÅéâ4©xsØ\IrFØ’¨$qXçFÇt~Ÿ%IJȨ́…-–l§%S5vFòLɬ”ÙisÓ32H£eG¿+‹Ù¼D¼46|˲¸å[Wį\•˜4bô¸ñ^›4y8E ¢–Rƒ©pjµŒJ­ †Q+©UÔjj$AͤFSk©YÔ«Ô:j65‡KÍ¥ÆQó¨ñÔ|jµ€šH-¤^£Q¯S“¨ÅÔªõ4õ,Õ—êG ©þÔª'5Ž€Ku§*x¼‡Ýfv;É×òq÷Ì!§Ówz,ïqšŽè¹ºWï^…O…=u¬÷°ÞžÖ<}?tzèÕgÄÏü­Ïžg#ûÎì{²Ÿñ9ú¹³B©ðÞó÷ŸØ?µÿõ«DÏˆŽ½°ä…¯Î ˜BÛÁÖù3+xhê%Ü4k³:Á”Ë©9È¡Õ.£ƒqÓvÎB•ɇz¶—¶’\‹ž•Zå.¨Oõ^OÝ¡;CPŠÇZ³¸Ì%œH‘ ÙF›º„Ý{lpœ¦¢Î»a›;ä븂j3»´göšì2)AkÊ“Ñ8±c†­CŸîÄŸ†„¾Wû¬}¶ð<mC•B»§þDýöúºî]@ï)–ˆ—EaAöZV'ÓËAFoôÇþzbÝ%J0È9cŽ‘-Š_½ èl“»¼ÊUé¬`+þÔŒ(8Nß ÷®œ´ayF6£omX[!=;+N¶U± ´ª‹­ÚÁ”ž(?Ò´â4J³Ü¨dgâf g“H^’[¶ÓQÝTÀ8k ›íöJ°í£CÛ ÒS>Ôàçµ÷¾ÏGK?j¶ê5K€Î̃le1xXô­ CÏ ÁW—|8±ý±â‡áKúƬ¸ƒ¯ rr;ßXVç…ÌdÙRlžB\Á.'Ôƒ½(@”u\î“FâPoÀ÷…PƒÆj)›­äÏhç´L€xöaŠác_ÅÝÙÐÀ.0Q‘ïc~ Õšsn<âñ@< wû8ü‘/ ap9v Åjo¨üjçQvÿåU„¶¦-s#£ç± +WÅ®rÔ©¿}˜Ÿ‡Æ}Îoÿºý ¡Åfu¶j£ò4Ì·7 ÷¾ "œ„Óp Vài¨ç`4õ@¼+_ž`w´î;]B6¯#G03x~qñk@}½rº ¿ƒ(ö£»~ôχ^’j̬PI>TØr4¼ÚFuq%î ÿ;üŒP¯7ˆÎSZÕÅlØm—á”™\y¨‚\‰Üvg]¾‡Ý†zÅ;eMÛô, C£µàÈ‚•ëc$©ln[tÅ–?À…YÇØ“ï óË,VwÅÍå> wÔ§Ï[–Å&,Ø ôBõçN›Õn±³¡í‡Àø;!JÖ§|´ø D¹, ý°E#)zeüϘeñõ'°ã¦UØÅ õ<¼µ÷[žŠG¼;–]ùÆ„UÃÆ¡‚ßòƒ ¬QW^!xÍüŒ*QÐæ~=û€Û¦HÈ5§‚––xõ%ÛêÝÍÇgm]•+a4MñõëÿÍVñVyò™ÐöpÒ-~´7ÝBׄ_ >*P¦¨ŒR“Š5æfZé[±ÝBjûJ²ä[/r+À(ç r#“õvvÖ _œA΂Ý]í0€p½NòN®9…Ëe9½YE6&/g™ÅYfe*Ð,‹;„Ô[ÁtH‚èÉ…°­¾ä:³Ö¬c±¨cGð¢ ðZ‡¾`[• *ØS‚û°ßdÚADÏ­«¨ Ç¢²dØ nÈk~)As¡Úwèu¹™4Ø„Óè¥ÓüÀÐ@aœ’Èydîܲü½pôDxÝr<0óÄ©E’ÊÆ›]d>¡òÿ”kè¤Ôwp7i¸­UÊpAi¢mJ·4%-+jÅÑèÏÑøfÔ«íþÄòx'Y°Õ Í´¯æøõ y‰ÅL( æîãGAïK¤²:0HøAYq—ز“»ÑüR°‚]T•e×$h“4ff32^ r©JÙ;‚9ØoÈ=¨Eá-ñ>ŽÂÜÅJ0*8“ÊÀDÝ•tšÑëuB¡­˜(Ê•GŠ2å‘“@?a¾›¬@¶­*ÌIÐ&’æaŸ!+jÚ|…é²k.î¼Çº*ò ¡‚>í‹ÃTèSžÏ”Ÿömº<_%ËÐJ5¬dºd&¬¤ÇK>VuÀvüSº¶5¯vCµ·¬¾roÉq°ÒA¡ÏSšžÉž.OZ;‹Ýà¸®Þ ü$t5Ø >º²¶Y¹ben¼™0e‘`¤Ùt@ëˆN(É¿jý 0šÕœ‘Å;5±zÝ\É™™§Æj!ùœ ˜k0íì23Y¢<B7YRý“©PÄWü@y »ðLR¡B*É’(:‡ž©:%B‹#° ‡Ì‹¥ûK4Üg\ÕE¾?KÒÔ´ù„/#®¤œBoE73ÿ#î!WøW §Ðb·Uõ¨Šs”™‰‘îJ®Œ":Ð ?‡ãÁ£Ž-úøÄÁ–êJ¶ ÖŸØö‡1]ºO¨[ðf8Ї÷¾¿õªie÷^i© 2w¦h’š5)CBÛÏ>½60^ˆVeö^=vÆ)rYŠ,PF;Œ. '1މl…-¶ õ ÈV¹9+[Ê9  ¹Ln4éõÌÇiu=qË€ë輫ÁQpD^R'»± 7'ÓÌÉXü”@ëlfòå?ª"~¡£áúÚÞbµ¸Ø“‚ÏÀGâ íè*aNb:xì¯ÍÍ6á‡BQ¼Ë‘ f0ˆ =ØÅ+ádÁ'° ÐhÛwÀ`* ZI~0)-F6Á¢°)v1Ш}ž›(ò¦ÇÇ;v}D–C/ 5ñÒIïB&äèí®ÒrðÒÛÓíyÉ™iIëK[ø}»ª™²Ø¦Ô6 :‰úì(&Ч2šÔ&6aÈâÌd ¥Þfoq[A[ØR´¿h¿çtÃî&¨…2••Ó˜RåüX±.qÇGo͈Iar«“öCŽû¦tz¦ÍVhcë¿;I¨Nû·¥Æf¤y›3‰ðPïÓH~…ζ¿*ìR_(•syÜ`Í%ùArÙÝzÁ”Çé™/p&M,l9²ècD“\3è´Ïâ”t ãè …²µí)Ú_û-묯¬®òúw4>ÁCÛ_{ÄžAï…ŽÂ[@»å¤è…º| » 6š"aÈmÚ úÿ´è.X)¨ ñ‚kH<À^Bd!‰ÃªQr&©–Ù:aàÉ@þG“,Ç›|M·[/s6·ÅùD åÿi™kið––1šÍª5⵩ñâ¤HH…´¢¼ZŸ½¬Šð¥\Uš!Ë[»fÿ–“¨û×?QÅtÖ í¸½»+Ù¥ÜãÖžnÒ@,˜hyQNMMmÅÞCvÏÁÏ“˜G‚ÞÐóó¿ACn}ãv©JtzάÖ0«¼•¶èÕqM¬ú‚ttëÓ P ûÍå[é_Õ¥“A¹õy±gwÉŽèß—ýaÙi|¥JW„e>dõ[‹,ÓƒKÍèAfšoâè‚Ä1tIŽ­ç|zˆQfÌïX>‹•ÚrÎ’IöÝóqÖrí}eÐüêhyâl“Hÿ«ì€]¶z¸E¦ÂÇz ²Øh‹¬¶ƒËVb±¡¾ë¤ì¸í[Ì•%¿38«ëCãIùžºŠœ-|T†²…{ÑR@}E6ÎÃý*ž3öÈÄ¿þ¾h죢͕_¢ž‡Æ<XîòÛ¯æ Ñ”°Ÿð`œŒã‰ eáá1Æ¢-H‚Ršéx£ã-á„·. A”"á%ÄgÏ|ÿíq¾¿¼1Ÿh~Wâ6Ý&ÝQr+A²÷­/í.º~—ö‘ìqOPVò(0M”Þ0iË®¶¶5‚ Œ¥*¹^–étrµ¡h»·º¾å½ª÷¥ã¾b#ż9]˜3É9Á<ü÷ÜEfuÎR‘>C±"Ž$cE1°Û~«Ÿé‰Û¤{~nF3PO/É— $_îÜN&Lÿ‚n sB4M€XÄü‚BnϺˆŸbñùßgh“†ÓSàNuŒN¿D Õ?u 8òKY$ 4ÿš¼\9™1+I>96†]³jŽa ±Û—¤Ä&4Û[ôûsVŽ"ËÀäUH"ÈhÒ(/ãAÃN-»ÜØXæob¥“ó¢ôéÉ ¢¨ÈH‚(BŠ«Êm­%S¡tg¦¥Iã#ÎéO£~—®œó02#ÔlY8´Ê¦ì–Ö–Ú¿z[Ùú3O—¼™käÌfMxõW7êQˆ/°-È{?üx—hpQø Äòo ýDž¸ý–’VÆ”bЇ,zµ{Õ%Ô»-*ré:µIcäÉÔeÙÉ †ìmº{4^Q&ÜZ:»Ð@‰‰+ ps~ùõ2 Î~…ÑÎ9ºèeW­SY V{A%ÌK€¦†]ÍÍMåÒ ŽÓ›XŽ‹•GÂï¥è—Î[?jRxhÇ'œÑ¬£HY¨¨ô”¹íŒÍ^ócù%»×QI^Õ çtsa™vpHöšëZa©wՌȨ´tÂÄ*©OçGm>ô¾¿oàÈMÿƒþýVô@ˆ„ ·oÁ úÓ×.àþ ®{ÂD÷„ìR^iµ”³¨— „«7—<‰ŽgQaH¿ƒèiÁõí‘‘ Ä eµÉêR¨ÉWÒ?¸·ë¿Jƒc”‚3* ŒjSr4ñÛDƒ×_j­ÉßÁZË]'ÁM÷SÀÁÔ}K«éaeB,œEÅî® î(™3sõfvyÔ BFšh@W=^ø”‡žm<ÃG_´ó…5²ÂœÌ”,IzY^¹·®ÂǬź¼qôï±ôHý¹¶GލËVűsð£Z'™¨ùfôrño_õyG™g‰.߉¹ƒ‡¢Î#Õy~ûÈßßCè8.Oü·"æxxá&¢éϳïE^!Ò5l½¦^»S{PéK„eô¸I¯Žž2½é‡R[u¾› &òŒb2L*M\¶Y‡×šTœ™Ì³y.³Ãeµ8™ÖcûVŸ–ŸΠ$ùQŸ}Ê=©ÛÙŸÌ>¡Êh]_¬µF•¤ï†úÖ§wü°}îôøàŨÈtêk¹éÒÀÝNãî"Éy~ gÅìB¹$3EšS,«®©®ªapäß' U‘3—€Ôv“¥ªØ^ ®NHÉÈHŠmÊoЪÎÔhU—6í±ÁöŠ`/ì3íy ˆþåácTÇs: ¨‰ñ³|‡^"ôèÿK-)wÚ×Þûï»E½úthÍæKZ[+ëm5Lùn÷qDµ†ÜÈ(#rlùmn ý¯k0l»S,ƒ=øñÂn@7¹Ó¢µDY’Øwq>GÖ!³Î“¯4=çØ êN·ì)/õW4ÿ'rN„8BÌh//+߯ÃúåÙÿ©KØàe ¶UþmE}ÿ!?0,ð®.©ÎÊÞO¹°þ”hÁ¨5X¸|=[px6à‘€'ÌÆ±/•+¹Nvw2WKÊ\„˜ûè‡Ì7hZ5z¾ ^]I’ŸLI¨'m*¦›¿"5So4™Èžu­«õCO¡gšs¼ ›ÒÄÉYÅ黼N»ÃœÓ¥¾ö^$„^D·H›ß(„; ůLšñòRfõ«ÑxL¥£íø4èÛ—î½Ï|ðmznÓøtG¦p}lùû‘±p[²·™È è}-’¹ÓÞÁ¶,`7M[•×i“¤¡ãýˆWÁ ¤·÷Z–|¢d6s‘Rk6åj™ˆ¹Ëijuº ÕrèÜ"³³a¯Û·ŸÁtÇfX¯ž"µ ‡„ ΢òXNØÀÉ¢A‚*®Ö\õ›NT ÌdQZÒlÆ`':­.«3¸¶ô*ÚíCµä˜o6¢Põ ½uKxèÆõæÆr´òû/ÂO4âM;;‹—ÏNtǶÜjC=öU©T:­Ng´é­FÆjvU¡“7_¢ÐW^¸M`ºõˆd9|Áã¦DâWÈT…Pà¶ZKò«ÃóAøÁ—³;³ZÑ Ý4êuM­(&¼TšMyF6sîÚ˜ÕÑ)öx§Ø•éRGwÞ#W¢ñþrà*î]´^H”ÐN‚–7Û™—`ÈZ¦`ðóoúd2ÓÄ Zö^¹pñƒÅ~ô:ÐWkºd‰Ù€çͳp_Ò¡¯„Ÿ ƒh¢ÕͰMáH4˜¶€–Î*Qy}Õ­ÇÖW/ëÕ CÞdp7<؈—œž²}aíK„SƒÐÖ$Ô‡®]›¾d³ &Œ×^­s|óþ5¶®¥íÀq oÂy[SñS)kYuÖÆÓ:I'­ Túö\å¡BƒšãHCäËa'ó4c%-*?òÕÝÎCBYº'Í-«/‘ÜŽ•“6-Ø0æ-<1Sd§R²²¹`wi>sÅÝAQ¨/šçñvÞ/çVE<]Ë$Fm _Ù`(ÒïÒíÑù¢HY׿­Xïò”Ôa ¾QÉ™•:æ7š0ñC>jÃ!äs]Aä)Éu@ÝM¼Œ"Zâ)±X,V²U){ΦËÃÌüÎHfž–Žß„10»dQù†ºùmK<¤œ¶6”éÕ}rEïžõß%…sendstream endobj 122 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 1809 >> stream xœµUkP×ÝEo‰1žíÇÙ•;±ÓÚ ÆiÜÄnR·ÆñÄnqŒ1.q)X€@B€„ÐkÑ #ô@W$$xI!0v\ðHj+N°ë&“þˆãÖ3I›¶3ù‘Þe®Óé hwšŸÙÇý¾ïœósqŒŸ‚á8Nää>qbwvòýûìc8»%…}œ~9mùˆÀ†ƒ4Hãû¶Ö Ø¿šÖCy:ÆÃq£Õ—£P2*Y¥T-*ÊÞ“]ÆÝv‹vïÝûÜS¢g²³÷Š~Z#QÉÊĵ¢\±Z*©«¹jQ¾¢L&Q3+¿¼ U«•ûvíÒétYâšú,…ªòÇÉ*O‰t2µTt\R/Qi%å¢CŠZµè¨¸F"Z›6k홣¨QjÔ•(WQ.QÕb–^«PªÔ:qi¹¤R*ËÚµÃ^ÁŽayX>V€b°ì%ìö2v;‚­Çұǰ žÀÏàÿH©à=Á‹òÓùA¦ ,|V8/üdݦuùìÀ£ì€-À 8ûì’—H‡ ´¡ šC±ö¾+ÝTÿ‡CwÇnDÎMÌÍ"ÜÝTU,F©F1mcìF %ŠFe3Ÿ…›ƒm®!™Òabì”é”¶R›Óëø£¾0Ý18 3À›Ä»’óGKÊ˜Š Ê8]ÑU¤ NËTªMù ‰°¶éF_kíŽù¨ÖÞ`"ˆnwƒÕâr´Xéä øû7.AÛ"õÀ(ùåá…Ÿ ‡Q*ڊ謅—î@>7Ãí² Y¨¾<ùŸBüƒ«ýÇO#<ñ÷'ë UîZ©ÅYâÝC{ÈJ¡¹T)b @ÃÂÞ(ˆÇ”ÀL /Ã_¸[Æ$ó b_ÂPô§¢÷•+T Z=Wì11P)Luz¹é$h\ßÓë ¼ƒ·"Un•ÝÙ ?FÃdIób îÀ‡¯Ÿí).FëžCÄ++¸"ð+nç<¸Ÿ#ßÈ‘ïüùQˆ ߎÍÌŒMÍ‚8×ÖØì+Põý†¾x÷ìâÁøæ8È+ Ì¯WE‹±S…¶;VÉ xéγ]31@t† hq×È\LÀ}a–ßäÁ¿³Bò³Uà ø‹Â8ÜÜÖ< 5³ßØÃÔ6+›Z¨ ´Cõ5S _Fã‚Â7JÞ…)·à£±¤øõŽ3Œ•Ò•ˆKaÔzc^àië]ë÷Ï0þù›ú^ƒ¿$íºj”~¹`6ôº/âë£}aÿHg´kÔcÄ'?÷X«]r—Ó­‰:©—ßjÎÑx¦¶©Þª±é­z‹ œ&¶}¨¹09YÕ¦¶¢ˆÞ9—÷þÂÅ_ûýt»e°ô-0 ßèôÇ{®‚"I“Âi©±R½1_kÐÛáá.:ùíK’œr&…[¡šóéUöén÷x—HjF}C™áóèŽUtÀœ¹-‘w‹³…>é?Ÿøí‹² S}åG% ¿™‚‚{ó܈ä>ƒR=Ø) wâ¿Úì•km¦…ôô*òÌÿ/òÍ ˜ÁÍC-Áfyæ‘7Á;S¡?Œûn€q­pæÚ€H´mË —F먙_Í€)0æÜÓ=Áö›Ü^!}¿¡±ÙætP:¦JR¸ö{g-·»Ÿv%ȉ~wyムu¿kÙ³’úüQÒ&8||‰Ç?(¼ƒÃ^j ~ï < …€˜ðjꋊÑzKm3ØM@OœŠK/}~~'¼Üf½2žTʹපtº€§{”î¾Ið6q»h"· TejøîÞáy)ÊQSÀ.’#ú^R£Rë{4±H´o”Be÷ H»ÙÙ tÄÉié›_,ÀÔ±µÂâ Ž•Ék¸0ú¾žÉ΀#þhWtèú¦ày_ˆ˜?=Y°í8z¨*dÃíþÞvjèƒéP}ÝgšM.g’7àP7òà_n‘C̨D^®8]c¢çâ“ÉYŸ,«ÃøEöcÞ2¶œFúüí^ÐE„L}Z¦¹Ñf§î{¿:Údv:Ac&ÓÛvú;}ÔjaxøßÅÙ²cªš ©¬¢v@ŸOQûѵÿÑ’Jå3Š´‡0ì_œ±öendstream endobj 123 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 4062 >> stream xœW X×–®¶¡«4‚J§EŒ©Â £¢â–ÄÄ#â¾€Ú*k‘}WdèîÓÍŽ€ ;Š ´,²”¸¡1¢‰ãÂKt’—7n‰}¾˜Säòfæ6Ääe¾Ì7óõGWwsªÎýÏýÏþ+cÌ12™Œ]ºÊÑ}¦ƒé£ô–L3Hz[dû/ö®5‡¡rj–;Æê/VØ3aúgä2ÙÞäì¥!¡qá~þ‘¶j‡¹Þôm¦íÌyóÞ³·åà0ÏvIox€·g°í*ÏHß ÏHúe·í†ïßȸþ[æûGF†~0cFLLÌtÏ ˆé!á~ MO±· ˆô·]ïáíëcëi»Ú3È×v`¥Ó.KC‚B£"}ÃmW…øø†3 3aIpÈÒP§pçˆÈ¨èÏ•±^Þ>¾küÖlÜ4}æ¬Ùsæ¾»ˆaÆ1k˜µÌfcÇl`&1™MÌfÆqg{f ³”YÆ81ÎŒó3›qaæ0®Ì*f53Œ±b”Ì›ŒŠÉX3¶ÌDZ>ÆŒ‰gžËVÈ® Z9è¨|¨|—Ù›fîf¢¹­y—b­â{€³à‚¸ïo|aHÑKß(ºbè7J Ñâß-'X›?,køÌ៌X.i,{{AD;Qr)•µô•KÁ½sTIÕ‰°B #uÑ÷ý8*-^“º¸hµ¢QÚP MpNjÎ /²Ú9P¤Ï,Ðë…3haŽeŠO‰¹= Ì| ­Ð  ¡?p KžH*TZs«°ìµ¢y_tù­PA_¨°V¶Ó’Št;«ÙcúO 4Ïeí1évgôeQv¯ój}Yô"žTüiH!ûÓ¦¦IS7¯wã•waÉâTs5«lïÎÁRºÖ,)²:|sñM¹Ô„Á*=ãy¼ï0‘Øá&á‡8ÿþ Æ“<âª"J@æ~;œ=\/”œ¿©ÆW¶;÷–HWβ×f©±üW3D|›bÕ;_Õ÷÷×Ë¡¬~mÐ (ƒ¶þä-¬8Ã~Ÿÿ¨T j –£­ TŃd0e)mI3JoÕY5žò¼…‰ôÍšòÓEÕǹ.@äºCÉÁ³y}¼>½ ¸JÈ®¾bM$ÊÐB¬VäŸã \™ÄÚ»4´tÐìߘvg§|hLû"aíèÅ3 jlXOk"Ÿ^œû€‹€´HÈØXH9’k€ƒe¼Êf:ÏA)pµ8Ю5¦Áÿ˜ ¼ãS˜³ ˆ³”6¤5㉸¨Tö’iˆ()U‘£¬íý¨[_¶_êáÏ«ÝÙå!ëàZ5T<ˆnP³ºI[ßyGÃùQ2X¥ýÎÓîþ—ÞŽ•\n«°è”c.²«öC“ l—h‡®ü}7°óÜ7;.ÔT]àñÉþ³µý:êG^[ ·¡ã.]åËŒ2i¸(«–ÎÊ¥Li¨*§8+÷p"® Ö…C8ì0Dëé©Ù’MªN§ÍHG2‰«Í/ˆŠ]Ú™:•¸¯þ°k,.íZ^E`s 2 Ê('n d©ê-“÷FÑ,ÙEYy—MY"µAºµ!j K~§.I£IÓi„q$Ÿ(ð„ùEQ¨sÓ'xööG]f˶€taŠœO6އL^Z/솆€_qZßÜ=YÉU`SY¹‡_aá¨W¤ð¿Ñ:\L3‰¸æ8N3ZÕáà…8ç˜Ê- ¹£Ú ÛÿÁŸV”BeE$«õ]‡ìÃeŸ‘Éë‰eÆì ±GkëÊN=¬1ðÇrêô…À}Ñà¹H`•â2 ÉM!GOÅáq7xeôW ¶”ŸâöàL•=;uFB¸»wC28«øL&où‹ ˆÒC±¿äRœ4O…ûQ]~ä§EÞšõ¾°ü2û«VDyX•~(#QŸ¯éSîQ؃ŒÈúj&ƒ}Mßþ8Ú}i÷±™?Ð™Ò ?@ã@ó1ø1ûüô"•Ùi ÍL³‰KàÔlKæ#h§ãçÆ¯s*˜Ý š¬ÄC&êÐF)ÊÊ¥Oåø#êT8Gçä~6"ë¯uÓ¥Súl1„ ll1j ÷gÐÇgd¼7mÔddÍ›EE˜ÎU”>»úÃn±è@\‰5™´'Ö¶ •"Ã9}6TÁ'ÚÒ~‘dãb³sô ÏÍž¡ ‘‘æ>jEµþŠáÔA»öDÔ²î *“Þ6⺮ßÅ<wIUØñ»û}ÏD¶ó¢¹²35¯sÓ÷pòË~ñžö„L”ñް%8"†Ë!]*Ìb6œ®é¢o ÄÂI Ã|„`¯íIà>’ÒºäÑé8¬YÖH§£#ŽcŸ4U·W )Ük’Ü#\Î:²| ai/Ù<±Çéøîqär‹÷ArœN›Î‡¹n‹u§Z/Nê¸8U ‡5š"a–(Éûa™’d›x/½ÛªÚÊâÊßdAúé_!7VÙÙ´Å-g×[ÄnÜl2–ŒúÎß¡ð®ÀéÊÚ*¯š‘L6!Îk#5(ÄÐâæi¸PÝ$Ôœ já4–St•TÖ\Oàã?õ©\ò¢Ó¿¼ŽÖ¦õl9#|lÜ|Ä™>aΜ dý| ÎÅY­¯‰…ô=Úô½iBô¶õ.4b¬mÎ 'Ì MúSe'ª›› kƒXëý©fü#©¥WÑÒo–à4yo3~§ÂÝd"Ž#á$Žäò1ñF[2cpò8=ù>3rEµy}¹«;õ܃k™ÿÑöo-W®W]¦ÃìFHóŠÆ•Y a98eÌòtÞáèµ (ªÛd»í¿¿eÄÈ«º'N(Çe(‡N÷¬•?'a®W͆ëíípýÁøhÇøh¶@,“UgµU” ºîÞÃOÄŽ*3ÐkÓµ)Æ…Ž«®>\RY±§a{¼Zã¿“+ô,[BÁOظÀɫԫŽƒ^&Ä?mWôhˆÏÚÚ˜ qŒWνk1ªÑéîå›ÇS¯~TÏo8¶¦Bl‡týÎܤF8Ysò¸n²‰vž¢Ía•ŸÏ&2’ ÝÚÑñéU(¦Ty™d ±Öˆµ¢“1˜‚SlqÚ·g¬•{шÿTa-aq®aÁê ð>™'àÔhrÇÏ~Ÿs/È ¿‘µ|ßð׺¡0RÝ ¾ê†ñµnÔ²Ê34}1æµuþ ް¶Þ h‹êΠFèç¢G‡Ê)«£uÉ :!]k åVú)íÔºì}77ÖzP5ÁÛý6ö!:XÝ¥0kåcŒ”6«ˆ£‰Ä—³&µúNƒIÏjý¾ŠU¾(®«Úüê==üý=<ü[OëÛ¨›´¢nò?[­®µïx†7ž-l·VöHvÒ,™Xë¿¡®Ø´ë~þÕ‹2¦‚ÏŠíkÀ+ûwÉIüŽë:\ò©û¥SǹœØ^%tn­ß²NùøÕûòèƒñUto¸maÎãûRœœÊëŽ@vÔkóàÒoò †Ü<¾£ãó­ÓZÀçu£ù AÙ(ÿàk‡’ß4ݺdÔ¢Éq&«¤íª3´'õ¢Á'áô¯%pF%[S‘—SZü‚XÊO<.%x5{ÜpŸÊ§êuõZSìÖƒ xÂ!²ýFáÈÅòs¯›;TNù .†ÈÅ®€LM^êÀÖH»dÈ™–Ùë¢úŸë©£‡Ó<éÐÖ¿ö±¿¬ÿñÄsàÏZÙùMîwv×—Ç,üߎ&ÿBö¥{Ë·-ÛÃø˜Ç32}a¬ßèÊQ#ÿÛQ¦sà(C±¡ƒìktcò]U«ƒÇk µ64´òT(ö4±­T†‰ø†î•«Ê¡ ,I ûSø…ë'@4p1êRÅ!èÒ_.áúЉ fÛ2_QoÛ ¯^›[[Öô$ê).áØFQv ' 3òr©é³×Ĥ¬Ü·?)m1ì¥Ê0I!6km?Š¿]á)‡ìø¿P¹¶˜¶jæÚÓñ•uÍågÎyŠÏâk*»×±|±³ïr§eÙN<©1ቓ–˜R&µÖá44oºo76Y¦§% :Øx|›^§Y+iÿþ„?©n”õ\‚{ÜEÝ4Ï V~èQÚØ^Uwò“M2ô|ñ¶¼Zà¾É\¹+AG¬Ç§ ^Z­.]—¬Ó&SSö%ÅÀ¾MAÍüdw5Læ–u|›p"¿ª Z¸öÀÚžþ¡î3Ÿ­A.ïyþ-OCWð=Ú†\…Q&JN´Ä=t\JëÐAõLœ"ÍSÕf‡Dëtñ‰<ù{ß s5¶13Ù—oûÄ÷?+èMxÕ¼÷*vŒp¸Õ%ýþyÚI㨒ӂoW!;ÿ1y'x³&PÍã(öXúm=•p»ïм*W{ QC}e’°>jsš,‚Í%aù)™:½¸}´W í,m¬ò"CV^.ßÔq¡€ŠÜC˜ý¡ üÅ&‘¡®Ù— W9Tgø˜k\Wn;¹·ª®¶¼Eô(Òêùê’–Âà¾Óû¨w¦î‰V¹„,Η‚ôŠJȩ䕯.ç?i6~ˆÙ{¥C3Ìc> stream xœ­VkTSW¾1€×G ½ãdhï¥Öåh‹T:­–jÖ¡-"õX ˆIˆ‘BBB$Ù!äI DÞ•—<PÚÚbÛiíh[igÚÕ:3m§Õ9¡·³Ö\D—Îj8Yw­{îý±ÏÙgïïûöÇ‚æa,kþ¦ø/Ƭ™ý\ˆ`î¸ 4wæ›™ÍÁ°˜ ‹ƒ÷ÞõBj½ÿ ñ–`lK¡±m‰ %üì}ÒÈ”5­Éd^1‘1±±ë¢"Y³&6rcOÂÏä #ã¹Ò}¼<®”ùÉÜ.Êäó¤…×C6ì“JÅO<ü°L&‹ææíI²ŸšÝ%*RÆ—î‹|™·Ÿ')àeE>'J#·róx‘s™FÏ-›DyâRž$2^”Å“1 #„"±d¿ô@Œ»¥03‹—ÍÏÍ[ý†%`Û°Dl;¶Û‰íÂ’°ÝسX¶û‡=‡½€mÆâ±­X(ýš©„õ³³NÏ{jÞû1ötPrð}Á'CæóçŸÃuøß”/\¶°r‘yÑ©ÅÁch`Bí ¬ö±Pö$ŠŸd£"´‰°ùì 6ŸçX¶U7~pðòÔ‚ø4z‘2“Rñ¥P€§µfy­²UiA§Sq©‹W%^`®©nªjv6Rõc}(Æñwøöľ’ W‘º~{:dƒLªÈ“gª¶ ×TÍc±øldÝ;Þ?àÍ T+Œò2õ =fÒ› `ä¨Åõƒ 8od<ïä~‡°#?qeÛùGé%4A/£W,#þ´húIÛéz"k¯ÿ½ÑfÄî8EuM·÷>Òš¶-ýÀrA%ܱ;uàÌ®ô.?Šº¾s ámöçô=„6WkÌ2ã¥% ×Ù ªÚ¬­Ð‡~]ü€Ý^·”»Á^ew4WÔRGÑ GQSÆIà Z„V¢UÿLIØ“žÍR%ã©nÉÜ\ ˆšÎï_< ø`ÕË®˜^$ÜB•HÒãvž¨™vZ-Ör'ˆU7 ók˜œW]f#ê#,ÖAD| 6h…zå>µQ\U)o®óW÷œÜìÊy.;ù€‚Teys~aÚmÎr¦QjßÙK(zjÔvaZw…MùãÒð db@3¨¸@¼~ùDÛ yÂÇ ÷ª<RQQêÖñìwуÝ(tè³'ë2*Éðk"{¶³ÿ· S—Zº4Y.RP¦ƒWÛ‹6»û‡2z^¤d<”D†ÿOS¶êñP4Í ãG›ê™j¿ÆFžÀrb:ä ‹iK)(¨õ!]heE5”ƒÓPdÓH4 H³è߯ )Rƒ¼¤j©K!›è^sY™”œäÎ̓ߞ¸é0jÉÂW2Ÿyp14Õ: ÖÑÊ”¼óüžD1“ì@U ‚(·[l`Å]ÚYžN¨5‘ÏÒƒ†B0•ª8r‘0/ ðÔÒÎÉÎÏ›¦(gƒ­¼øhŽ?=z½R?Wöòê Òéo¹2¸ËeÌ߯+³¨ü¸ü„?:.<5v¸½½‘¬ÛÙ¯÷B44ÕøëºÝãLA¯§j6ГÊíò—ø€çCKõÍTÓo¤ºf²ú Ša4ÅÄ‘¿P*‘JU]G6æ[ ›E)t=§z´s¼ã³–÷H[­½æ³Ì]+K€|͛ ´aý«™ ‰ºqpÌ$ŠžDæä%h¡™ @‰«sßï{N5¿ïÿ˜txmwzR2}/äƒøN~óþÑ ñ CÆ#žö5{{Åðëk·}ªEÃþsׄLÁ²¢ŒI‚ŒWOVô«´4º¨chƒÝWÕ œÙ ub¦ƒs2Qoò…!l ==¹4üCô µ§«àÈ·` 5Ý@Žo0“áƒýrA­ ‚fÓ é(zÅÚ¡¸¨ðÂ@Cï~ 9ˆ:Q+ˆbpR´í£~´ îÕ494ÚÇqS×d6˜ôTèL%øgX~Öë3Ýì€1ð^B«y§Î¾eç8-U8ˆ;Êl:²$F)ìž•?+[zÈÕ•fUmv@ …EÅ }•úÍEôž³Ãé|8 •PçÒ•ë(d³ 2¬Y7cKœàõ·@‘LeJŠŽø±WË×kŸŽb–S.°RÝÐgí^è3öÌ9ÜPçÑ,œ•vg‡­Ž:‚–# Íÿžî°ƒ‰‘ϬbW¨v˜äQè±vA;tÛfÃ+5 ŸK©lK‰£ÄÏHu!Í­»4ä ,¯Wû¾žNÖœY~ Í4<:vcZ2à¯(»m‹Åa¡ü6w Ôâ WaI–~{Rÿô÷_|÷uù÷i±—3¼åÜÎÛãÁáê2¶Eü¯”e4mü~ˆ¨ûâàÜÐâN³Ïî"’õÁè®Â¥8ÔÒèëIïÚrs†­œxñÏèžO¾©±i]Ú2³Y£%7®~¤¬ð’Áñ±–«ÍÃÔÑs£GÁƒ¦š üæTD{±æðÊœš‰!fÇÑJ½UkÔ˜ÍFr¥¶Ä¬6ƒœ£®‚êárÆhT™L¤UÅ~q 8·Ãòè@ÃH/u篱7RÛ™¹¹uýÀ^'2׉ªUBƒÑ\fÒß(؇Ö3µ 9 Ýl¤E ¢Þ¶{/vÀ9pàC{{¶,£XAÇÅ ¯½òóuÙ¬~·§»jÐÑBÙ}D?zü;kཇÄüûéXÈ™ÕBšësø•/êc8=vY<µ4ü*úbŒ(XW’¬/ñ9™)™P *ȱ«Þén`øã)õææ*³2» /_½ðÖ/‰XÍ5 ¥+®SºDª–‘áWÚ”âÖô:ˆžO¯¤ï_{üy†ÒWO@ŸÛŸCÕD*½Y+Øú$Cé¦ ®áv´ á8Õtj`1#¯U®ÓR¡hΈ!ÎGaèž3ÇOs?^@—ÑÄmK(~ˆ1XZ¥¥¥ÙÓéé¢ÞDOWµ1örNóšö®æÓ« ·ÀYÙÙüåup¤ûÕBœÊ{\•SÂ<%¯L 2<«1ãäWèÁ 2ü/†€”h’9•b™HR¯­®oõ¶‘¡ˆAÕ qŒõ3]Ïüp¢ïþ‘é¯AÅœ]G÷w×·4yȃGªßd¦äìu z0I¤(NÎçzBgÆoùÑ­“h×ZÒ(w7´öŸ|v‹uBS)µ™öüÄ&ö¢Gçb8? úå>örb}J\rZZ©=ŸäM…Ø“ÃõÿàiÑ J8ÃúÙÙè,J ¼Œ}³ºËívTà³^†¤“BdŒR–©Lzƒ|ÖÑ9¡Ž ›€kHt- #ÍB»hf]þ-’¼Aø "AN^N~]Qóag;>ùúqHQ/âç r¥µ²ÖÃþ?J. ZW¿x†ýFðŒendstream endobj 125 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 669 >> stream xœmHSaÇŸ»»í^kh¾ìƒ½Ü]h–/›•söi/ˆ¨¤BZŽíæ&»ÛØ®Ž•:'‰ºÇ’¤,0IÓfSiD‚…J#ˆòC&…úÁ‚ŒçÊ#Ô&þœóáüÏÿü •‚ dÅe•ùñF-î!Ľq ›ÄùM *H¨ömªS5“Pí.@„§¥§Øîð8-õf­ÑÕc¢eµz½.‹ÍÓhôì)žsZŒÌobƒ•­²-œàÙ^9nGan®ÛíÎ1ð®»³þdÜ%‹u[3[ɹ8ggbÏÚm[nà96ž2'.ÅvÞÑ(pN¶Ìnâœ6€T›wø) ¤%ÅÞRPfˆóĨؕ("‘É‚ßH„7“”¡NÈ3%¥°Ò&*ßÁ¹zë&Õ[ÕLI>Ó»gcµg:_(öGê(5¼VÅ­¾£Ÿ¬Dˆ »¿IqU(¯Ê»[|%Ím7: a ¤q…¥ý^‰Ž†ÒC¡gÓð’±lïÆJm~võóŽþG'¶>¹Â MÏ?}éÙ…§kŠÎ”ª°ó>Ÿß­éâ9yìdÓÄ[D!U¯ÂÄÚ_äE$‰¦Ð²rùue–”\*r¨o¿¹¬Šôá0=æjpð× ™HR…RQæúÚúBÕ'¼3Ä|F£ð ½”=‡8!.ì ‡ÇG½ÌÔË𤧣®‚ ÖC;T¿£»úüm~ØL_m˜(9"V|%ÅyT Œà±œ‚}NOw—·Á¿¶je&=ãéÕ16“<гzkNÂÕ®€?ÎÓFé཰j‰*(ñ?> stream xœ­YtWÖ!ÐL€ ™`22½„ž@hÁ˜Þm0¸{ï[î–teY6î½ËE6¦ƒM/-@%@€%KH€Êç9ÿþO2$ÙÝìæßsþó|dûœyonùîw¿û$aºwc$IyËVO3þ1B|G"ê&¾+õ ÚŸ't$ö€ÞRèÝ=kÕÑ~â{æXÝú2R‰$*V3/ 0*ØËÃ3ÔjÓÄ)·ÐIV“¦Oÿp¬Õ䉧[Íñs öÚââoµÌ%ÔÓÍÏ%”þãkµ&`‹—[h”iË,ÏÐÐÀ&DDDŒwñ ì1ÛxÊX«¯PO«Õn!nÁán®V üC­–»ø¹Yíoü˜àêlµ,ÀÕ-ØŸa˜ysüçÌ ü$h~ð‚…¡6a‹Â#\–Dn^µeY´«›ûJUž«½Öx¯õYçë7ú½Þcǟ೘ù€YÂLa–2S™eÌr¦'Ó›ñcÞd̘>L_fcÎôcú3o1<ó63€±`,™Ì;Ì †cÞôd>¡Yaº3j‰T#¹Ûmu·«Ò¤»ºížÖýERÙ Y;”dÏqÖÜoõÙóQ/ç^»zÏí]öæGof›™™š]ë3¿oÿ¾íæóúuïgߟéïÐÿÜ[o=àó×Þžüvì€AìøÐ 85àï1í–Ó,ì7pï;‹Þi4ePë gïÚ¼›üîu¡DTšul®7ˆŸ”IÄ™6|j¾2;¢@™”KB:ïY$†;OΛmÔ…h„z8¨<Ô{¨uÒ•AdAº.¯Í-°Zv‚ŒÒ) T–~v x³wµépNЧL›¢Ù¥­häÈ1Ç>äËdfâ}0ˆ}õ|ãú]“ŠÑx‚ÿÊíØQŽóB‚ú;ßÛ½¸-Ù^NŠXG,¡‡ïÕîƒZjÁØÛeÑì—ã"öù—OŸ.t^*¨ÿü¬YG2uÿ´› }¿z,më°æ½+ØëéñîòÎÖ]?[óÇÊPxò×oo;IÌ ä(©<û\äŒü’ ˆ-¹Àc2Û”žu@@¹ìéþÙ+®˜Mdr"!xUV“ËЉ}|ò£Y3læ—›‰ú„q°^Rÿ÷?ŠJôâÑ|2Ä‚X # 1'æ/Gã[È¿x‚æQµü:p© kÞ­<‡`|Ú°·¦yOY+½Á•žµ.šu°Tk\·8F9gÖ±-ÜÐ1Ò i&f5I;ì:fðE—¬VÇ% ëçxì\tð=°$d™B?q&™‚N8 »¡%šå@vL¼25A-O"ãIßyƒ›JVÁ¬@›O¿}„œ ù¸F®IÒ$W Y¥Ô­ûÄÖ€ïéÅA ”^ÆR,"Sø®ÄLg[×Njûc·'Ô;óß“7]W%Ø­—ŸaÉhcŠÿ¢Kq‘wºý›´Y‹U|å®C-g»~~*.;oÚ O‡ÂC>rE1h ”:}„BéšÎ‘ÄÉ?Hüq:ûÊЇã\†ëÈœ@ÊÉ_„®\‰¯RÉÊnÀyŸ}ÎYƒØÃz½tŽçæ%®“ipÅ“¿¹Úü)jCÄe|€Ìý–ÒÀš“ncỎ}.ØU_%'Ÿüg<ÎÅ\b ekûrÛ­^ÀÍ\ú”]½uóVÛŒµ¯î¯' X¿]‚â{ƒ´Ãóy_Y>›ØGF˺Wô˜}Zà÷¼Ë|eÄúÆ`¼¬Ë±!2œå+JÈ@®Aæ=:ï{WȺ‚Tøk~ …9™F“ÙG“y¥4™K1’‡/ù.=%-! B9ߪزªò¢ºf½Ób'û5á‚ú¹Œ ùƒrÝ©=UÐépÞär;W•»ú´ˆú´Ï€{»|rjŠï˜Åw^þW“dF>¹­pö›ÎðaÇAA³S¿aŸäùNérvªÂg´0Ó_9k)áti1@5?LЋ#«%ÍÇ0ù˜Eqš©(R•#¨Ô‰‰JPƒ R2brýsi<­|­7nhñ×*å»ü*Ó.(Z¯ÇÂBÎ5ÈaÂÿGã„´|5%=.’"å¤/ ù™Mi‰ Óåæëtû7·ªjŒ˜ßwå³6ÿÏI¯ yRúšœ4ðÍÚT»¸úŠ=ßbwÝô€tA“”¥Ì®ÈTKWà cå¦ÞðPÚ±íù]ºÏ»^«Áf€«–ÆÁ»™ýV«p—/a!6ÛúoXÔ¤áÄæ –c.9õð{ì>—L¯–k4)¯ëìï ÁùÀ¢=“(n7‘L„°§‘ièzý^eû.yI@“wpy[Hë|¥¯7 8­L‚Ý®á ).‡ð8Ú@FãR_™zâæ±ã•\Àפ†%o|uà®O¿Nø®cøº»ÙÀ½"¡«ó´°Á`JûUê  >å[Òs¯ ÙT¥ VÐ¥‚©&_Õ0‰&W1šý“§~«tb>¥+îšÆÎVå¶È1¯’Ü?{ŠEKŸ}¯Þçò¯=—b·ôã)i{ x‡%c¿ÊÉr2†ãñƒGÛ/gëÍ ŽÎéa`&e”ãsÖLì÷Š¢†?”bõy‡6ç¦PeͤÞ̧K3MÞT±7µ nFoÜ” ³„oÙ—ÔÎÏéJ‡/Mv†°³”9;¨'Êʼn¸oñU'šò[4œõ¤çm†Dؾ¦óØfUvDC‚*5-‘vé‰U)ù é–ÕÛ¡˜"ËY¹ "!6‚OמӠK)ôÂ1ä©EÖÖLÊõµM—gl/]ïì…wøìÊâ}íÆwzÓw:ƒ¾Þ¿O•D…B™¢JKÒ-†aMj>h!ò¦QSEß誴…£–ú½~czj©í£0O‘–KŸ­Ý%&ë©uQ”Šý»ž=9i¹8<·ÈܪM,‚bÈÈÕå¿À&‹¤I—_ –E‘“‘Ë»®ƒk kô’}·ÑÿÚÊ5Óð0ÿdì¡‰Óæø,ò+ªÑ—–ÕVm-Ó -ÕǨºáNœp.÷eW)m”óýßw‹^ÞÜ”‚.]Ù¿{W… s«qÛ\ÎÝŒ¿Éû®e7o w‡¹‚õa~Ìô -vNÍmŸ¹ˆuòŸý–xÑZü€Çõ8ç³ö£šJ¥1*°£ž)aQ—oeê’DZÏIʸÈhò9`Ÿý?&‹<ÊÐŽ”åÄe&‚Â2À¢^IµC´'€æ®Žä^à¿ËØé¨ÕjõiŒãõÍuMõCssÍYc¶6;B*¬|°RU†â .U¡ˆ]:ÇbÖ#EQ!ZBVfaµqÇåˆ7eðU¶/‚F}dùOÄÜb¢Up€ûfk•¥7ۢ͢­1NCc—1qéñYTE–ähuÕõµõ5u·G[”…Rÿ“!)96DÍ{ê~(¥†ú®MË AÔÀuU±\n]¬ÉØÈ:ó]ŠÃTÌk`·Ÿ©òju»–¯åI¿aO‰Ù,{ç¨h¹v ON/,©ki-ßO5×Nß2¿âÀO˜ ¡ð‰Ç&ÇMqÞ´h¶TíT”¾’"ïý.Ý7µiÅЭ¤YÜø®.-V±ÍPðHh4È•si¡ÚüûŒŠ{eFÕá¬ÿb”ß“ÒZ¿ÃWŸlÉ1¼®u*½m_WFª †Ú–¢NNUX‘T Âaar!i†eUƒ¦‚“£Ò™–ÝïJý¨ŠÝp2ùÙÂq°ßüùÀÇä<+½2ê8}xaXDhœ¯Ó^÷cÚ^ædf¢oBîøºÔ$<IÅîâ`> 1-\`i„¾¦¼¤þÌÂúqD>ŽHI/ÒÿÙ(쇃›±g^^(“SÕ J!9<`ÖHà–MnÃQ8ìê±+ÙG!ªYnö³ó«ðiÞ–bVÇ(>©L­  MyÖ¯Ú ‰ ‚#(~÷k[¡†®ÖWÒ€m5rQÏj4¨ë$™” À2tyº<ÜÖ!µÐ¨{tžùµ\njh£Ô7_.bÉë’#ÉA¥LŽ"[;ÏYPסA䨂KÅ÷E+>+;=¶qE ˆÈ72™Ù£A–ù¬¢»Óî/“‘½Ý’U*H´ŒÎ¥T‹Ïd%¸®‡¯,p‘¤õª—ì÷P¥!mº"ÅÛFûªåx°ž;6•ÙÑG͉Ԩ-û|?ûµÔ7äKYûk›d­;/ð´ÎÒ¶FlqÙ°¥*¤%pgêA¢SÙ»+›«ZöëC´…ÔÛq]¹ÜRƒÓLSIÖE©8‰Š½ŠL¨|`ÿ‚ &}Ç #} ÌHšÂþ‡^Vf(sââUÉ)*¹Ç˜)Ê(Êå~üÀ9¨ç45|6ZÝ­j|2È`M(g†×MD‚*:èõ¼òÝ×R\c ½ ¤öÝ?¸_Qvš:CˆJL†8.¨4²¦¶¤´f¯KíÇ“×Y ¤ûtïÛäÊŸêI£Fn¬ÇÓ¦!¯=“bžçq± û`¯›ÏŸ ~@†É;¥¿BèO9S‰<–u Ïdh Dâ褱6NrÄ¥mÎß¨Ãø:I};&Ýlj—âœK¼¯6¸¶CUfvVöžà©UÀ=½réÆŽèÆyAž¡ü &M™š 1\T~\IA1m¡qMNÑÓ\„à×âMÀš»à£M5žåò°à$Íe¾Ñv±›]Á›÷Ó´@sìvøæ1Ÿ=ÞÅÂÊ{ \ÖK~<|WÑ¢«),“WêójûÞ sO ÚJ ðIŽ®•|Ì×☹n¶Ã¨‘ÖŽ•µß¦±»@lŸ]jÀz‘uû8]çŠ­Ûø‡ÍØ9@ÈûTÚ’ d™Nå¢#~@&£mc“.»A(^2õàžÕà['³¡ V¡ŽOVËS–Û»R‚ ªò¹Êï"~ðîù/gq˜‚ƒ¿A)²(¼G‰¹+a&¬\ņãÏ7W‡È¬˜Œd9ÎÐñ^[ýÒ‚³KÚ›¯¯¬Ûq°Êc•Q‹vݘÈýŸ®ÞwXã%¨ñ‘ì÷TŸÿÿyP®O6`›[ ýŒh;ýìûúýãDü†¿QöÝI¸Ç=%ýo‘ѹùowÊ„álÒÀö?ŒýdWÁàž•TçC5ÏBX Î{Ü÷ºŸH­îNÙíúLȉcpS—z†À:H9…ý¹þqÉ'.‘nMa‹(E`¦ j4¹UÚlM#”÷5ZI¤3=†ÈͰÍ4àao”‹RŠvb'_ZëíêãY^Ó\^W#1d9%¡sÙ)”„Š+ÀPù´^^)†Åiºr‘¡ ÷~¸¡cL½¤ý,>9+ÅXq ¿¤pÓa8Í]8uö>Ω$SÝtBz¼&9ÿÕ¸ƒëM£H’JŸ,x®Ùp|IáZ:ŠôzÒpë½.¥‘òí†$d‚ïE* ž9ñÕ^`Ï-°;ŽV¡ì(ÊS5='öõfgöiÒs²„ŒÌŒlýž³k®Æ}J‰Øü«§/ï¯~0¼Šú~ÝØL?ïrÞãÑwÔûê}Cpµ¯_pˆ¯Wm˜ÞPY«(ÊÞ‘mD%˜6bÁÖ° ]œ™^žz®6², 8,Úwý‰€3_ž?÷HcXªŽi`_î’àׯɭcÿ‹ ‹ ´'àG•Õ8Žê‰ئ*MÓ$@0×YÌzBìPÁÍ[Ö¢EöÒEµ˜ëÆ5N¹b1 •Wž‘^GwÓ#*ƒ ÈG¦©Ö¨Ñ~1É)ÃjþîÅÏŽìÑUueˆ2–jk{ˆÕ8¥wi4uF¤@xDtR F8 1ýÃÙ©=Fõt™QîüôÙ‹Ç´PãYiY^QQQ[¹èH¥BèRaŰƒn{… ˆÊðh¥rh;E?“ûŒÓÞ¾Ú~0)G:0øƒ8v)‘`cœŠ±x™‡—ñç½Ï9ýuFÅZ ýÀa\l€Ç\Õ(:–.ÒŽh›y`ÎÕÈ£T0Þ+<ô´å²öœçH(9Ï{Á‚¢ðçñ'᥊KðyîñòoäTC\Š.›˜·>¦ík%LR¬ ² ÖÛx{ª§Ùo4ì£ UÜ”â…s¾V¥ 6o± kü¶¡–æäT-יú+cOoÙní=ØO×}ØmÊ•';V™g¼¢ÑÃmüþùƒäès ýVŠÍèÌî1œ9Ù~þÆa¯‘ש`î=kâdûÉå …;Žl…PwåBõAªÚf}8t®5éIÞ”“~ämE<å•`KQ.«Ã…TŸ+#’6("S’¬!†r̸ú+4æ;~:U#¹ú#n¦ 3ïó7­BÌ?q·]ûqÙQOùöêJCch¥O`@ô–±?.£3·å7¿¿³èÚð ùM}ûEø’ûrÒÉ¡V3VY»WÇÔ4”UÔµø„i„=ǯkK€«¹–4l¾¿KlŒÜÏ7Tµ<-R¤¦²86›¦âƒèH#xù ©(t¼Ã—Á¶pZ½± ¹Ü¹¥‡76O£Ñ£B#´Khœ¤ëµÐeg+©Ð¸óÂ0˜ýXìÁwö Y¬É³çOqù»ye’—T«?”¢•ØÎç§íJØclŸ×þZ˜›¬M¥sLj¢Üu«ƒbͬ}¡o^‚Njàâ >JN°Q (Ú¦ÍØ¦ò w¾ ' Ö!;²Ø#Ý\Á]½.À)Òo‹¯-,†%»CÏkÕ™tfæô% -þùQ> ΓnL¤¢ÐüÅc£ìüð'Òsæ/7¹ÉFÑRëá®ɾǘñHŠ~Åì+ÛO×:¼û,-èÊJOGUšÄs~•ÑU%u¹;>u<8‰Èé cA|Iö³yÜv$ï~a×Φ=pŸÃ£鉧Iñ.þŸ¨½xnpߎ96~ð”¹ãÜó½ªý…âð ÕWÒwmà\XÑn(]Šìóô΋³^{bŠ…è"µfÊ1ŽLxÄû‡ÔA3wöÒ®¿Ü8g;•£ýJÁzŸ¡BÙüâø¢Ä#>°‚›=cãôÉÖ§oq¢ýR£‰5êßÖ‹ƒ¨-P÷T„m> stream xœ­T{T÷žq3ÜøÈP+2³ˆhRÀˆÑ’€ Ap}+¬<ayc!qw/l1ŠEy(‚ˆ¼_R`QbHm“&=­µ$ž6íÉ ‰['wàÇ]“´9Íý£çwÎïÌ̹óÝ{¿ûݦä (š¦•áû6Ûž^iqåÑEdï\æìn8ÊÀQ^³’Í_Š¿\‚9ÏcübJFÓÅ–@}F~¦.)Ù >ä½É;AºÖ©×ùùù¾¬^ïíí§~-M›©KˆKW‡Ç’µiqé%U¥OÐi ùö_¶& [¼¼rss=ãÒ²<õ™I?³¡¼¬ÎÕ’Õ{´YÚÌm¢:XŸnPGÄ¥iÕöB=íw >-#Û ÍT‡ëµ™éE-}-]Ÿ±=3Ë—¨=ªKMó§¨UÔ.*’ÚM¹SQT4Cí¥¨íTLí Â¨p*‚RSË$(9u‚š¡7Ð]ôÜ‚ý žÈ|drVž%¿¯R´)ž*×(ßcBD£jά(XŰZ¬šõåJZŠ ²¡JŽ“ºùGËËŠÌæ,ãq£ Àfi”ã–6¸· ¦cŽ®V&R ½¶ªnù8² ìS¾G…§FÙmù  >€;ö¸5 !â1‘k R®TÍn•ÏШ’N:ªdâ'8ɡʿe=YóJv1oþ§’–*4Ì»5(‰P sÓÒ)AöÂu¸i Åà Ê ÿ¦³¹`OÎÿP£Ųqá}ñ :ËÄ»˜ÎáÒõ(#¯“ˆœ,!Ïýý'¸#>ýxr™sÄžüí>ü]ÐÜ·l7â"HU“½Vt#4ʥʛ%<œ «¸PÜ¡´jGOv‹›Ÿ~)¥Z²þ Ù´'ª(å 0Â0['áœ5Ö¡òØù“ÿ]n¨ØÁÕ7ŽõÿØé‰¢$+¶Ç9Ø4zLPÍm«8m¥Ñ ]ÅMè)C¯Y7?M(x€AôýÔbY‡ËI²0¿_£Ä·æ§9q72xÈÁ—ÖÙCj•h‘È7ãOm=°(Ãå2ÌÃcL·£âÌ…… gÚŽww·]é½um·O|¶ˆ7W(¾fȶïÏä¶å LÁ;’ îÙ ÷“Ï-—uÓý÷Ð|O&z‰[¹‹p6»Ô:>®þ«#¾@ViI¿œ'ôéË~[2VúÇbˆfƒ6˜RÝÓß)äËëM•ÙÀê¡Ô ¸1yPÜT[ çù–ú±´ h„·£ ÇPîUC£Û¯9­­ö>] C컡åU1úJ¾²°Î{¥¢æ’ÔwFÙ>µ¢6å9NʰP\É¡·•xcT”Òì±oõj÷)ibÜ>ÉøëŸ&ǧùñ¨L°¶Ð°ÛímíC~Byñ<´´‰p8Ó,••s'ŽpJs¨ýWÍ ¢“…W‰ýÒ~ÈGè~I´;mûQ w¡ŠóŒ_ÆëCC~‘,Yè:8e‘ª[Q3i:e6›ŒF¡´øTœ`Ú3ºz®¶ |EÜ!žDûG¢ ‹?[…Ãc§/÷óçÇ šµ“': àëSölͶ6f¾£oÓ­©>*eÛæ±špäG×à†?Œµ5´’Ä#¿£L|ÌÕüÇÜ¡ÐÈ7uR´àâ©;€ËÐõÆHÞ×¥Qß–Fýj/ú<Ûû³db &sç mðÍ÷÷ Q“ël–F‚}ˆŒ8§ÇnŒÛ{ªk̲‚S¦‚R!%ȧLÄÊ‘5M²½òо·¤þKÙ Š<_‘ȪDip3VL‘¬l ²_Øvé¤MR*+yá‘òVó¯ïK b2ƒÙdâKŠË ¡íÌn¿ÚÕ4t#á†ï‹da> stream xœ¥X TSW·¾1psUªU¼*í½´Z­³R­C€ª­Š¢­hUD†0“@Â< 'ažd‘ DÇ*Z­UKêP5ÚÁm«­mÿ·ãèúß ’¾¶k½·ÞZ,ÈᜳÏÙ{ûûö‰€²B ÚÝãÝwš?M5½ 0MbzQ˜…cMÏÖØ«ÈAˆìŠ&8¥Ž6Mº‘ ~ž ñ)yîÒÈ8YHP°ÂyÇœùsüɯ¹Îs-Z0ÃÙeΜEήbYˆ¿¯ÄÙÃW,ŽðUA¸ó;Rÿ±"®oË’`…"rñìÙ111³|#䳤² ef+3œcBÁΛÄr±L)p^%•(œ×ûFˆûî:«ï·»4"2Z!–9{HÄ2 EQK\%[ݤ‘Q2¹â­heŒo¬ßº8ÿøq gÐÆàM!m÷Š˜º}úŽÞ3gùÌž3×åµy¯¿¼ø¥S^]NQ/S¨EÔDÊ“ÚHm¢Þ¡Þ¥6SS)/j µ•r£Þ£Ü©™Ô6êMj;µ’ZE­¦æRoQ.ÔÛÔkÔjµ–ZG½NyP ¨õÔ0j å@-¥ž£–Q#¨‘Ô êyj5šr¤ÆP,5ŽR/P(Žb¨¡”3µ”¤²£äÔ}Xpc;dϧBOá=»¥vçí§ÚgÑãèbÑ8Q¬èÁ\:yháЇy;8<Èaœƒú¹ùÏå˜7¢a䬑y#¯=ïòüÕQN£6ÒŽº3zÌè ££KGýØq‘cŽãoc²Æ[æ ¿ZOˆ±Ü¤ð2zŒ 0 &`×êzårzpˆú£ž»·ß¹ä^Å_Òž8ƒ®0·×}‡pØW°à#E_j<$>Až‹ø—p R+úy¯KÔÎÏy<9,ËÝÁFÐ’ðJ!œ…3Æ ffNÆ#ð¨GÓñèŒâp žÍº{Üxðí•+7n\Y7oŽÇ›îfXf€éYR…Œe¬Mè·ÑÍíñÇÂ'?€#<çò¶Ûá/ â;¢‘òì­±ÍàPSûáÅ÷/]¿¸zþœÕkWºÞ;ÍYO¼l6B-¹øÓ‹¬éÄb-å¤ ~u^ˆÁ“§áçñˆGSþâÔ™ü|ûí ¦ [þ“^¿°¼Ü–»®½úMÏ§ÝÆÛÇVxp–\t4L3‚ûC!(a- ‚»wsê€ÆŒ*ÄÔkkšêãŽ,½ÙK&ãõ¢ƒi%¡X3dÄ]ËmòUfÛKô`ôo Ì 4­49³•¨1T‘•’™ÍùÕø#ñbYô‚àY¿%ÜOâÏ¥ßIAÛ˜ qÄ<íGJ.«jO¹1b$‹ã]D‰HÚRZ“§/å΄žGµ$ÜËöýpX—qHÜÄûë W–¯.[_Š1µº–'=yaq*NVÊÓ†tš~,\0üR+€Fâ±bMæÑ•äÊR”ÈãyŸÓ–(Ëâ¸7Zbi÷W8–Æ”1äzáʧ%(=*5M–ËåøEŠãŠ>¨ãmqýµHÒ6š:Yí@YëÃ,5ÔD j±¯¿›í•+­#f]¥$øÀÒ¿›¥œäÓx¶/g`‘@z‰[¢xjjâ`ŸèÏójzöÉWgÛ*5õ\D‡*së°H–žõ&…ù Û`DÆjªŽžˆ/M„KöuÖíd~4h°Ã_WˆuH‹œ´H‡*Ú˜AãU¦,¡ÉŸ¯k쇱9F[OÒÞ¸Í>—ήOìJ;x.«*‰ÑžøÄ­²ù9iÙ L.½ÚíOÚ\¬?Â¨Ž¿ˆï‰59:ätå—Wž­ÿVU®Ö^V¥…jÝö¾—ŸØ‰jP*jïçèé?4ÎAI¢ê­ì½5·ð‹;&¡e‘šh½¦¡üšCÅ*U…ºLUÊóåÑÀwyg¼E†Gº^[ûóç§õ%¼6¼3ûbö÷])Iœž—ŸÆ/¿Î"%RÄÇä&#ÆÓ¯õðY¢FÅ[+ôÈÌ|=Ñþ°EVúâÑÊTË¿5wu}µM‹²žˆŸÃsì­," n¤(šÿ è/1m¯ŒÐ Æz†¸S— $Àå¦î?ê7—ŽC²6Rl5Üß"c÷W„g¥ÿ2B ±¾–ÔM—MeÌ·Þº¥Wj™ž£[J‹[ùïDZ´ÏÌJîmœ"2hŒÁTg%ÉZETP¡º,¿´Õ0Äh<‡…t<1“­Š­Îà‹²ëQ5J U¼™àèýv¦Œ '{ofPaÊøJ3òJòJKQõ¶g©c4™|aN#ÙÎø·ñyªl”ƒ²£ÞH‹‰Rf—hÆçˆ®”#&2&.Âÿ€O×g]w>©³JÓ§F},4…Åî‹/Q&%!E:ç㟄˜…+¯~{æÀ¿À±©:'·€ÏËUå¢tµD_½f_ÉȯòÄÜëØáÑd/xTmÍi#4“øf+÷¢bTÁ–¡8O‡'gò;D±HnΗ†ÓAª‚O$&¡ ”ìXj8øÝÝEN”ÇrÁ¸Dd ‡ƒ}p ðpÀÓhïC¾‘„â…¯Î$r=âÁTr¶SרÄKQìQƱ›¼—¬xk½áþwÃÍ‹g¶¾ËYŽrìRzŸAÅ]¡i9x²j‡Õß“dä´)DŇ?™àÅc÷ëÍŒOËNãcvnK CnÈíTÂgŒª›­¼~ñ´õ º•…ï1‚ᤲÖÈ•›•`¸ W ?A_9UÚÉå…íOªAŒvÕ „e }gòÛ¦[•á1îšf£uÖ™Ößê¸ £¯p2Ì…»YIÃð›ß?üqÅ<”ÇJkÌzå‘6ÝÁXk€"i“Üî)ý¸cå6/ß·fð¯˜ãØnXØ}ªÞíta£±ùŠ^Ž­NkIê@Ìã[·¾mMnNÑðµe„•Ô…òšT bt®YÖ¸5rWFT0Ÿ^(®ÛŠ˜i®®óÂÊ‚µQ|FrJ$’"I¹´<ÑW.ÙFù5 62vê£ûß.ïrÎç"T®9’|ÆT•ç© øž#ì{>çÎë<Ýut—×_/^W±÷Á-ös÷2ùÍ£퇎œíã4Ìk2˜öŒPM´óìÞZ¤ÍGê¤z>ya’ïmUûêÊ~,ìBt’NeÞ€×GGâ#¸S ZÕHUÁU†U‡U‡kBT¹h³` ; %6§weœD·ÐqtÝ(9Y~^[Ûƒ¾GµÑeë‹w W´ù q¶wæâؤ´ÝŒïí’”ÔšŒŠ\•1It’)Ó«"U9|YÊ©ìÑûùïÏm:¬ù³†öÊÿÿzÚå-ð7€Ÿa4é(ÜŒGŒã“ÁØã ‡Ï ˜o–ÞÃÃ8¼ê×9øÓŽgnÓZTôQu±¤÷òG«QpCp]xK&ÅÇ —Œ@–ËïÎ J’¡§® ¢Œ}œcrš.aŸ²ŠÁ£[ÙUàwîéÜäíí»iî ÙÜJ» į™>`õr]D„\¡“ëõ:žÃØ‘µjwá¡6ZtÒZ6“á6ÝMsú rö´Þš¼L·ûºÇøäÝÁ„ +v5-#,]沩% $?âÛ”y+¾#müÅäòl]tuB%y³1^»6¯ðÅÂ’Ÿ2¹\MnmP7‰ûÚÉòê¼¶Rîd¸!í}"VÃ>ýî»Î„c¡­¼¸=¼èõÚÀbIQ¦J\æ€ðÔÉ×@´×%¼€+ˆ¬C¥Ö®Ò¢5fÿO=‚ÙÃÿ2ÞˆÀ¨ÞÉ4J@⨠¨MX—hg逊RË“ª•(1Ñ‘ !Kž¢#ðr'зxÓrÑ@\,ÜEî\ÂûÏæªÁìì[lÚ¬™Vü5Òx~É[,¬µFþx¯|§MfØ<nÒw?{üŠ}ÔÀƒ†ZÍKhK~’Hwo„Dâµ7Qí›óÇÚðî¡§¬Ûâåµ®ë = ¢¿YõÆc¾öäÉÃoµvCPu~@b° mE9e3þÌzòó µ¦fƒ@cJš¶‘û5ï﯆I–Ɖ”ÿ&>œ¼Y¹ k—S.Õ©¼—ÜåGÆëëû•`’Åü~ÔL¹·¢4`é%œÐ>TÚ>¨#‚3—6ÿMb8ÇÖ!°›ê—ÅÅ’VHH{š™Ù¨@‰ˆ ³œ­CxÜ% “÷—ÿ}‹úÈQî¢{GOthK[9/J›ÿ§%är µÏä¹ÓJøoø…bìÿU¤Å'¥¦•drm².qçÒfÏÊ·Ð:4=¿ˆÇωKÎÈB LRi|] åPdNÅBÃ3'’ )Iô¦g kÊuthZF0ÿûjQHiz ëlDtú3'sîjaÉXJ.sG –Ž.kGmíb”Âcxº µ‹8…Ã<æE©äc@*çŒèTÐF—sƒ]4Í Ïf±YeÕ2ÄÄÅ$ʳÔ©<|ù»[Aj1éœjj+u9ÅYe‚3 ^À6 [«Ùd±\œž›‰¢™øªøšƒÿúD—ünß% « >^š§RظnîL?~Æ÷£põ%ÓwÂÓmÆë,}Ù µwLó„¦7ˆÓV¯Ñƒšd¹× Bøæ¶#¬1Ø_ì@ÚÚÑx Õ|WŒ¼ú·6,q1ù?ÎU©*ft1•q²ŒøÔ,ñ»Ûî„\„2œäµ‰5õÅÕeVv=e4Ãä4ÃÃc"ŒÃö˜ž„ðìñ+ö@ÿN°†ÃXÍ.] L‚—¯>¾yóêtò¨˜´3Ë,`^}BRœEÂt£Ÿª•™ÉiYœÏ,ï=á9I¹‰)(†I)TêOu6•Up½Ó]l¾¬(²V®Kÿ·T„ZÎ>†|£ðÓn695Ó J³ª±Ä·¡¿/UȉŽÒ7/~¹¥éB×ùnô¡ò)wñ(> stream xœ½][\Çq7Úðoà[f#Îèt÷雃@Œq` 1³Xyr©¥$r—â’¢è_ïªê[UŸîÙYJ ô áÙ>}­®ËW—óÃãå /ø_þÿó×>ê_ß=Z_?úá‘¢?>Îÿ{þúñW—Ð@©Çñ×áñå7Ò›ê±2æà‚ì¬? zý读ûå`‚1fÝ}{ÃDíº»~¿Ý¯˜ÝÍ…vÞýxaíA³;¾‚?ëe VïÞcnqÚ(ìm5‡Ýçég q‡}ÙèÖÍðâªB° ÇððÛDFSA•׬^âîyšåjmܽƒÇK„ñ‚ÝݾM£x-šÜ¾†6^-ÆèÝ›4=¿ZSÅ•]Œèå˜þa­öb†·7é]m­ßÝ¥‘VXåñ-®Þ¯ÆXZñJËØ}kÀM)›Jsù˜Þ ÐV̇Cô»×ÔX©Å»Ý‘öÁøèø{¼»»´in]”èM[t˜Ú˜Å‡~eØ»SÇ„æÞk¥vWù±Öø¸-žŸ÷þâÿ.ÿã‘R@`‹}|ù§G—ÿüW˜-öVØÙö‹žŒ8¹SGö"gü:Î&›¶2F½û€-ôb=HN«lüçÈ,ñü±AÚìuÊ gLþ †Ê¯$r œ"²è7™l5K#Û}•=·™’¢29&¾œJªÞ&ì‰Ýæ»B·©óL·1ñ’.±w ‡ JÎ=ŒŽô^ø 1OÎvÙ[•q³_y.R:**Ñ ¬2øD'0œ×(¼Óè–>!;ÎïïRo+ÊèÊ+²}>Oþ–^&($ÈÚÏušTŒ‘¯` ׉ÒÉ‹6b€†ÓÌpUÏLè¹òä÷‡+/£ÝkbÒ6 jcµã¬,ë[kVuBP>*b—y‡$×C´Jw,í?Û}“‚Ø£FŽ•;2Ižµù2…€— ÛÂsÁæò*íŒfîY%©#B,´U’ÄŽÈ:ºÝÆçxÞÿ—‡ò ·Î$ô ZlëÌ‘Ó"nh„9JZ¬{tÍÅ Ñ"–×Ý¢ð),k÷4ýT ¾}½#jøü©Ö\é7‹>,:1¥Ý—ßmÌ‹:„×…o}}Áˆ ªUΠwÄ™©EX^’Ó{£‘’ å)¿eJxl ­øÙFà5=g¿I]‡iGGo’ðk9tŠsQ•n‘[Ôû*"ôÛFƒ¤ìPµ yNt·ß2õމÛ: Ú?蘱P½ˆà”Y=¬ŒMŸ%ysRÆY®ïÈCÅN€{E;4þ¦=fŒòã{B®s•±ôÁ˜×Òæ×‡5oT‘vP›e±y‰_±%L‰q9ÄÕÞGÚΈѪ§ìwi[;Ñ ^ñ­HÔº82w%ŸÄ”Ò=áâcdm\t›Fxš=¿oòûþ6õíâÜŠ›¨óœ—ð#cä]'N§J¿#pFÒÇVNÔá»u~èK‰f2çüª’\V £¼Ä.àD;5–žJ‚Àöžn l¶éT‘¶2¶9cY S"(Äã…‰… yÊb¥`BÏÜ6fÇ$[ ½<á%y’nA·L}•X3ñ„Dn›²³@÷—¿Èµºbß8þÞ1kÙ«^é"è¨ÿž2%pÔSfä¶lâÒà³:¥ àdlœ*ëÊ9ÄWl:fº94°;iëLѹ¡u[P§îÃÖߦ¦x@=]U»üÛÉ=ßÒmï]êr˧— í"U0#ç–›üÌ­Á/æõæ‰|o™âmØ<èËtôÆ&®üu¢'¶æ?áü#¬Ýõf$>viÌ`Ÿž¥÷AÒ´å¦3C ©²qµ Uä»ÔÛª{@œé4 „…¹Ð »Ç§ó¼ömVë;=•ÛKMñgGö¢ Òi´Ìeu´Ci üz6á­3q_oÑ>pL[jqôØMÝŽ»àHOÝã'é½ÓN±©keøžóTÉìêF÷tu}0]ÞKt vš*dÌió˜UÒ(Iö)2€Ù@ž,÷/Ó•qÉE„¤}²Gáô… 7LÆ£øØ}ÆðÁÏ’õ”zbKð (׿Þœ½r´&MµÞÙ¦¿á2¾?ëû ŒÁL9e(ËPê(I+‰ÉÎ&–pMVb~Ïn˜Ðò+ob@Íï/önQdöL¹gÙ•yåã0ÞJ6#³cvµý)7ͶAž¦<œTÌ ¢§Ü‡2Æ!ùþìÓAI`ï±rnsê"ÞÆÌz±0†oÅAuXŽ Ú '»ãNÕφڧðõ­1}—öo5Ây›ïĹvháHÇ8¢¯S`Ð$î‹}ÏÀr‰42ÏÉŸí¾.!$B2?3@¾~­ mƒûæ6F$gÍ·¸sVŠ2àÆ”¼PB‰UȤ‘²@?†@Ò“dIà–ò; ÜÕF‰¼Mj˜‡­pAã‰sÛ]zos‡‚Ï1$BxM¹“±›ašW©gàÂ_‚›‚f©Nƒž]¿Ö¿:x’·ú l½‘vRE¡%r jF‰¯:y`É»ãË&/?æð›ò¢ä­t?—@Û,¦µÇLcäǤˆdpuBd’:4þ£;ŸP7³€†ïbwãpF’ñ»/@ÞôâÒ³’¶›/….8Êï•Ñ2þ §äÁðýú­8³ÚÛ0Î’™ØÝš_5X ª £c Ø4¾A‚›r,‚‹é! mR¦Ü€båèƒv^yê-¾óö ;ÂE³èÕ"íH,ê$˜‡²äRnL”.¶q ¥ôŠgYábùüÇ %z…·CÄX—WìÒßâ`Á/»âÿØg5¯C‚d»ˆDÇ ¢Z`´ë¼]d/œGTkÙ‰cuWFL¡gk"à³4= G1É(AU) þÆ¢+š2ìN0_ñŽÍ%=SÓrpsbJ2oÜL7'M&ÙA<ÂX¸&j×Ŭ7úÉ¡ãôܪªŸQȈ©Ûl"téf`O´ú eïfþéQ—ÝN•Õš¯*ÞÄ}M€9¦”wú6Ñ·K΄Õ…7YÅ=VTNÎæ’é­çüôØÈä.‡©aÒbÕ6!¿ ™Õd)Ù7¥ ŒÜ²öã ³Îú3]Br3?;©Oñ¬5–éŒ8;ëtr08 `;Ä'Öä9¦@#†SŽSLN (Û€/POäÖÀ‹Ÿˆˆn]¿!˜öR™•„Ê]u˜Ý±NÌ´Ûò`9s—7%Ètì›ôØI«ç7Ë , S¨gì$´Â”ù} dð‡ÅØNJŸ½€»£S23‘‡äù “”Ø.ô+f8gŠØ ”¤™ÌØÄ`VÂ¥é­m8¯¾ŠUߘ|'ò‰ÈL¿QæÍ,—å*¯Ý„MP‹Æ´D˹%÷Hòl"V6Ö®Ìé‘ç"ž 23xµû® ?Itx—^Œ*f¥Ž¡Tð Ö_ê=Á~ ¥Ù–n ŽwÁßç5­ZæNÙ:±Ñ±£IHM`5ŸðÞS Œ•B|=ÛûU¶T&«Duàí¨Ë [ÞíÏ ^-‰:gÝžÚâT¥/é®Pµ7¾¶#œè6“Îx[0Š<3[DtÊ"&ÎG;'ï$ ƒR&>íãDíô1„'¼IâoŒì;ëG}ܲ’YÚR§rkT¹ ¦•G^–™‡Ø ‹ˆ‹ªQ™Ä¹Æ)N$ä Ë„QI,ñ©ÌÉ(h{1Ô9÷Uìmˆ‡.9z=^ž”h†¿Qá™y'§¾žŲp(tå<ÐsÈ#ÛïR/+KÅ<ægèzX Zè$ô*ïND=²Ü¦eÃ,ˆra÷‹Ò3Ô›wò·¦²t*¥ö _Øt’õ"³ý¶ÅܫЉˆ¥»0S85ÞzÿÉuÀžÃèvíu©AN†-½Ìc^â6Å«–ÌŒ‘â<»J‚ë²`‘bÎsÇ ^+É(ʬ®¦Ù¬èªD!räÖÄ›Ö;‚Ùc%åÊ-XàHÆY‰\¡BÉÛÚ¹ÅcêÖ•äóW¤6FÔHÇ^IIzmþŽ1C¼‹h—_¼/éÇaü=J‘Ä7­P“¢TU¡¸3äEê ëÊꈵg‘6Uò¹ÃDŸZ•ªC½˜*Ó´Š©âÑúf¥™¶«pÜÕúCô¡×bVÁÜp²gÞ..±ò• {Ê.ňvu²ïK*9¤Ac†L˜ô;Lá&?d‚n%ã>ƒÔŠ68ƒÒkÛA¨CÇ1ÝÅN0ëh‚õƒ:9.ÎqTO§TÅá|kR½ÒÇɺˆîÙh³vEË0o'¬‡*ë§k«‚§¹IÉ®‡†ìeÐG¤²šÿžøˆ·VÔ^h£påh˜!÷$Ûu]peŽéf,éyÁ'Rß7i6v¿ç8˜XâüZõMQ’:o²…qøÝÙ¤8žbäÂ|®qH¾é™vsW¤C­“…IÊó¸¶ÙÔÄ*øDÈ9©"`º\üb3vFÔÏäïÿ‚Ýœ—u9tŽ ‹yô‘õÉ–ƒXÇÔ‘Wki§j(†²gîßµ.6ZºéPù6“>¥(¹ÖV¸„A:r—ÌuŒó/©tPÌ.‚@‘ë“:ê“ÒVÊf¿Ë¡@1ù_ðãnFR ½Ls"g,M–-ÄN°êgrˆàï³TÔ{ëNÖùŸò®àÖÙóJÓH{"OzÒšöÍJᥘ«Môhîø)þ}=).J¤Ö$tfö%3Ýb£Ê5Ràdƒþ¼ö—O±¡RÁ·¼T"!ÆéÞ ƒi@ÚÓL¡›‡Võ©ÅåÎ@å¹/¢Œ|]X“!L++¥Ö®c_ÿ=ô{9˜U+ôõX ¨véM3š±[Ôn–.ˆ¸?hm0ØÏŒþ*[s^ °2­“1“ì¾Lf“CG£Ðï¯îU „N‚u„N',}Q£)¨ÞRƒsøÒ m´|u3(òÈ¡æ°åž6 ’ó‡…¤öPåbµuø{xGÕ‡lˆiC¼Ý&Þ_q\©™kuÅš À þ»Ý„‰òÙ× ÊKJ1•îàüÆåQv@`ŠÃÍØbŠDáS¬ûOуždã ¢bü¬9%ª2×ûê3Þ¥¦æÁé$·lŸú„I—í>f¢ár¡WvR1wª»2’éÜÐÚ§Ò©3s}üÊÁ`8ü†Å 7Y%#FËzþ!­š|S¢¾ Piýj›N”'"¶KìÿÖÃMz!}Τޠ߱OAå¡ÎÁ¬™\eR¥B*èÿs é0,É1ØQX©_(¶% ÈCcʬ²`¹a“׆#Í“Y•&ûÜ R·lvSSU<Žœ~B2‡ÆX=ùщÛô¸¯7ÌÁC|¾KíC”Á*÷»w»d ìEK‹^ì‹sz›fiÑ«ø=Ë_._{ÄH~?Xü}“¶ÅA—Ÿâ̺'òÊѽäüÓ4ŠRs;Þ…ïbL쑉ÃëIáøÛV"y³àî‹:´@ÏÑg V‹ÿ*š2,®?Tñ)N¾ÉÒÉ^7'‚lô”‡GчƱCø»Ë4Á1‚ :š¥Ñl«¡l0ˆò¦êü©…dɤx2ßÓ:?þÞd'gÉB\äCS˜V‘ÄO*ܮ۷$'›w8ÖøsBzéÑö3¾{ÐI…“îÛÏgã÷Xê1{º-«|ò[º§R©ˆÛXŽ|Ÿð;,ßÜy]ö\½ù´œƒ»ÊÅJ¾¼Ëû£ ;0¼Ò½ö6ü@_› ˜~º®ëC-Å´s8–ëF [Gü¼RKcù·ËG#Ô¬øõæ??ú;~‘endstream endobj 130 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 206 >> stream xœcd`ab`ddd-*©(1H3þaú!ÃÜÝýãÒɬÝ<ÌÝ<,Û¿[=¼ËS€‰‘QP4,µ¨83?OÁXÏ@GÁ=À¬IÛ–‡AŽ™‘‘EÓýW ßOîùßç3~ßv˜ùǥ‡W|/ þ]ö»"ø{ÅïÊÃß+ÙŠ¾ þÌTqOôðŸ)Áì?¦üއ°øäL²ÿç’k]ìùŸ[Ž‹]D#Ÿ‡,&'¶²ý?XFNd™Ä^­N\endstream endobj 131 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 373 >> stream xœcd`ab`ddd-©(®1H3þaú!ÃÜÝöãÆ9¬Ý<ÌÝ<,Û¿_ú$øšÿ™3#£ ¨bXjQqf~ž‚±žŽ‚{€HbqIjQfqvnbI33Ã2†Œ ,ŒŒ,¢ÎWÕðýø^y˜ñǥ‡ÿL f ü¸±Nôwñ÷¢ïÅß‹“7ÿ.ú]üÈNNþfý.Úœ –òXù~dÿàü]Áø}±óÝïDçÔέ,±´¬Ê“ë>¼üp÷Z޵3ÊÊëkËS‡u‡Êeϳ½_ÖÍQY]U™ñ«xS©|b±m}y]cKsSwGåÌ깋îÜ™³R®;$?¸;ƒ£|VíüùÓgÍÛR²¿û€ÜªÊ[æó»9æÎž3wFӔƉò…sܦ%,ÙµütÿŠ9Ó&NšÒ=ƒƒO.hiò.¹ …Šÿ¹å¸˜•"äy8åÌ5ý—[ÔøŸ‡,#g°hÚ^s4ŸÅendstream endobj 132 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 2603 >> stream xœUktSU¾¡ôæ*P„HÔi®òyºP 8R©²Ê£´ÅBy ¤MZbÓ$ä&Íã¦Íã&i’“¤Í£Mš¤M)}Z <„ò¨¼YvP‡qT„…££긖 –‹™s3§?æ†ÎÒYkþÍ¿sï>ç|{ß>ßæa“'a<ov±¼®RG•©êŠUù›–”ÉjtEZ‰"ZÈ>ÍcŸ™Äþ&k-ªLצ_Ëfó¦b`j˜:¹û™)›f¦çÍHOšÎÞbâ.?ï(ïÒ$lAyÙö-Z¼N¥6jä5ûµäòüü|²ÒHþ'BÊ(y’œÏ-êe •ºN¦Ô.%·Êd¤v¿Œ¬–+däº-%;ŠŠ×“ Ö—“ëeJ™F¢ Kt• y¹I^%SR²Èj•†TL|U*¥T®•«”ÔR²€"%$¥–UɹC2C•L ,&Õ2Mœ¢¸5)§ÈD©•II­Š”+«:ižû_­RjIµFÅÅë¸wU‰ŠÒRU¹ZKrˆ%…oNä¨Ý/Ñfp)9&UÕÜN©ªJ—©æ—˜V"WR¤VfÐfp*e¤TN©#‡Ë]¥ÖÈ¥ £äÊš_Ñ“YD#UȨG÷fXùµ>ò¿ª–¨Õ 㣳ªG»~Á—k)™¢z鄸$§®DIr“›ÈŒÂ ‰†Ì¨,¯úß ¿Êöÿ ‰aØŒ‚Š×w¬SïÔŒÒâÒ2ù[Û0ì9,›ƒ­Âæb¥Øj¬ÛíÄÞÀ–a/b/a°Ø+ØL®‡°ÉX5öO^Ǥ¼Iެ%Y†¬¿Me/̾¿‚ÿOñ"^'Â0ÃB‚•Ãì¬KÊZœáÆO—°7„ptzܽ‰lÖ*FDÃ- ~E Óz@g ’»Ï5Ø7: zùã"À…06‚bÙØtŠ—ž“~V€¤4>êŒ:€4:- 4š‡V KàóÖÞ¦$ˆ‰@O"r%D$P’æ_wÅm{þÂjÉÛÒF‰ÑJ•f›•ƒx;ÁßeŠôÄÃÉX\ ÁµDù!c3 Ì" ´¹Š\ÜžÞÿ°=¨ylÂWá¶‹×»O·‹2ù ²÷g20^†Øö³s0³àQ.‡Ø_àãÇ,GuÅún}tûÁ?'¢CýDîý‡âGN>õcáE$ÈCm4þWœ*`nÒ8(4}¼Xh,u8·ÚˆÜ?A/¼)øœjJ1ïšzö‚raE(G¢‹÷E£ç»ïæÅλcˆÜ±[0)ŒOâî1yAµw%–ëw9–"‡½4AÛwé‚«LÀ|ë6:(,FûMå:º¨‰SäT‚Oû|NŸÔßÐÊéÒ\ ×À—îì=W¸aWíªRñÀý@¯Ïëy|Ù¹+}^òro{¼h©.&ê§=@)(R®Ø·YR²K±*}üà‘a8{à3qßÍë£ï¹é1ÌÞæ±?smˆ¦ c1z½‡®ßãH.aó9#šu2+ÎÎÄ!_¸âš³hmrÃ!ô׺´“6•úVK½ÎÂ4'p¬asÔÚb„ÎdÒi>€³9Ú 1ñM8½ÿ0J jzê´´Yg[SyÖ4€ªêW_FÏê!!4»æ›Ñ„{½M  ؽ5Îm6—·ÑÝàÉticÊxž}253þ Üüùì\[ÅñY¾Ùj7ÂÆDÚÚ‡`Îa8IÜ÷}×Ý p·«E¸ÍZãä ÑĿ⠹A=hô:*ö¢•Bæ”1!åÚaz• ……'÷}xsdèþM±µÂcZ"7¦N{N]|÷Ó‹y¹h%üX0è‰@ ÏAk—É©¾_¾‰>Îë8ÖÙÏå—^fN¥ Îck3»‹Æ¯¹b6P,‹Cïusyç?!DR¶)­ ñsM]R4e|…P†žd,e ÷œvrßlhý H» ήBÓø¹ìÎeÁ1(hÞà 4]6ÞL[óÞÈ<Ì‚C´àvËñÖ«ïÀ_>€/ø"Ÿ^ô­^^¹nuÞü%%hà´Ë\YÒ[Ð6bûíj;ó»òV³ðx×ñÖ œ#–1ÓeÛ1p|Ü{á䡎X{ï°¹M¸µ´Ò°õͯulíŽ8½M^€ÐàБÞ&¸;ZºøÙÝèùËÄo­Ù,}«v=üq¾0öøêcÇ?ÍxifÝä±ú‡Yì ÁÞ€>i¸¸z„·“‡Û‡‡tœgˆ . §òÆO9[¼­Ž°+háÞŸÅE9Ô&_™¼£Êà‡-à0h Ä"G¯B™ðCœŽngÃ8Š²ß ‚]±Ð ¾|WV°`cšA[}Í”8óôϱ‚,OñFoeA ÄT­ƒ±YM&³Í† ‡ZñP§!˜ðó}þoá-·¾Aï–ºE4ÿ’·Õ 8vÓNý.ô†.u*€ž¨NèÏüêZ^={^ Ökëj;ëz»»û´½jñÄ<ùñ(/=-ã_¸-íhº±¡$\⡹ã=ô6Š.rqƒåt‚oò™ýNP°DÀ ×ÑÈ(f]Â+ø'Cš­^³Ç$Nz2³Ý˜JOáú®0ÓwÅ4~ÆÕa`0ì{» U"VXÄnñ¶€f#í­72³ÝIó¯:üî.4ã¯ãIa'Î>Æ¢d_"ÚíåèSla îIáÝß™ÒÙ ¶4S§bØ¿A§Yëendstream endobj 133 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 997 >> stream xœ’mLEÇg¹ƒ[ê ôRZ[Sµ ˆPZ Zµ-PÚôrÂ"!•ìÝÍÝ­ìí.»{å¥J!Ž•—–Bi h”Vy©¦–^Ä—Èü`LMÅFM=­¦Z 1Qg/c¢{пùmfþ3ÿßó<ÿa€90 “ì஠ꔩÀþù‚Ñãõ{}cŒ¾É„i±.GòcõT+ÀV¶šÏn47$é‘D}ánýÆšeŸ£Ì(3ÍDÒ+U™™Y…’ܤð>¿s  « ÞV`RyŸ0 HäµlXŽÔüzyÁ§J«÷;J`z‰£– )œKƒ.wC;ïF¢Š2 WR °¼nIôð/‰j6Ü­Bª2róÆ#ÔèFrTÈ‚2R¼ªkȫЧp¢†ŽÙÛ©…ŒQ„ŒQì® Ô{móoYuòdÆ÷¿[3ü ®ïTÊcŸJãò—êg/ÌãEü{ÿ·#s£sc_̲ ÏêO’ŠÁ¸±UßÝ5v¬«·§ßj½ÖÓÝ×Ým] À?Ã5åãendstream endobj 134 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 243 >> stream xœcd`ab`ddd+*©ÈͱH3þaú!ÃÜý[ñ{øGÖnæn–m߃„žÞç¿-ÀÀÄÈ((–ZTœ™Ÿ§`¬g¨£ààÑÏÀÀdmÅÀÀËÀÏÀÌÈÈbÿ«†ï{ßÇß ŒßÃS˜¿‡O½8£¤(«&!y}ãÒIzzúäú{úzz»9&Mjkª¨ŽóL”ŸR±rêݳݗ$Z¾33^üÎÌüÝs›èªÂ¥¹¹EEÙ©k«,X7gƒŸœÅÊÌÿ\r­ËJÿsËq™™™ýçá”ÓX*ñ_N`Ià¹âE­ÿå„Ïçáe`OlVendstream endobj 135 0 obj << /Filter /FlateDecode /Length 6919 >> stream xœí]ko7’ý®Ý¡WˆÕn¾šäÁÂÙ f6$Žg ׺²ä‰¤«Hvlϯß*>»ÙzØ^dẊ´)6Ÿ§N*²ïüz8âpäÿ¥ÿž\<}nÏnÆÃ³ƒ_DøãaúÏÉåá×/¨‚‡~ð“•îðÅ«ƒø¦8Ú “r‡“±ƒ2ô§Ëƒ7߃²Ê(»9=:¦g§”Ò›x~CU„ôNøÍk~ôƽÙ_ýüâ/|qðÝAlÿæÑrrðNâ€6òèÅ?r£nσµ¶àuà OÊ aÌ´ÙɉZpbó[˜“Ó£Âéí¸î4ZMuO©˜ åè7·GÇ’F­¼Þl¯â³qMcÒr]^MmŒ§ŽÇAN^«i¥7¬ü.6+œÚì_å.äæYhÄNÖéÍe¨.Äh§ÍvGåZLzÔ"OÐ)'ô梶û'Ô¢—TÉo^ñÊLÞMr³ç*ÄBëÎA4úq’Tj\•ÞpÎ CƒŒko'Z峸Z)³ÙÆ:nšæ ¤¦Å0ñ*òŒŒ5¢Fmú<ø˜À2:o… ¹ŽæðÅŽ`ƒã=X˜¤<}EK¡…Ø<çb!œõ–ì…‡9i2—k¨}kS×i"¡Æû¸MBM j\A·\‘„Õ£LÕ–øbuÈ8ñ”š5䯔%g­ÈÓ?yÖãàBFß°Ñ6ÐÑ«Æ5ÀaÍЖ£¿èžWKP U” ^{&j›±L`ûe™EÛhÙfiå…cû"¶áF}¿ ‚ýGûÚC‡·±CM¾²¨_@œæ}·}ø"êÏkŒZꄌGŠAÛ)ãô ÆHs¤±ØÞˆk\;(ž[\ªÛ`_h¢CX§Ï¥ÄÑxô‚þKT#£ÑÈ#r=B‰KLöð,´E £ÛPÞÓ~GK’žbiv´Æ«È%ä¦À²áMò-íó>h¶>zðFß#öäã^D3Ѽ‚ëO¦G( !ñX2÷s,€Ö½Ý«D¬Plo¤…^÷j\Ã’„÷ á—3ןDÅý!·aQë¡N€ø£ë9w}C¸ kZÿ¾É6–Î<1˜¡ámž°÷Sd÷®õ¡ñch-+W{Ïý"·pÑ\ÎÐYq&L $~Gï랺ȉ¬¦iÉÊܯì‘è%Oý§ Ô9a=—3È¡Ê(O†Ðô¶‘eÇÑ“(²í³#ññ•Ô«£=Û#ß÷ƒé«¤’ÑdB,Ö—Á‘iEJ³³Óh¼v’HÁñÐö˜Ñxô様Ç>lG-§åPÂü`(°ˆû×ÝW <Šã‘j+™ænC[Eñî#9FŽÃG¥d£ØZõ º;4Í3¨1"nÉeð€j4kž¢ïy~:Šƒsäp··ñ™¨¦ïPû¯±‡×¶ñq$ãEm@ÛC!zXÌWûÝžT’Fô5²£¡’è³-ƒ1›`ꟸÎ5bkùѧ7[>~¼$j×à÷²ŠÌFN.UP"h\ÒÃ4Ùê§«#ÈA š)ëôö¨—xÊ©Q-õ"cÈq¸4عŸ|bnc‹š¤ßvyÎïšÏ¬W¡˜s.Š_Õ¤õK<:iypdúø€ÂZiXVuO‹‡ÒÏšvŠ˜tyª‚ÉëÚÄŠðÖ²¼LmDt ›Â´Ý]{¥IûM概 †œ` &E.Îs†‘†D㟦ŠËŒGõYl½uU3¿Q„j¡"¤påÛ“¸êÎ%= =ŸÄyI[èE’±ý.·ïƒLUŠ”NPzÔ —ëÃÉl_Vs[Ñ¡·yTr–GA¬r å ÝÕ-ºå/¸Þà†ob‹<´L£ïÛö<ÌJ”‡oæ!+žDˆJ7L“Ì yZjØšY’ …:±rË”ïúÁv£äØÉ Ïyøcièy&%Ù9Ÿ|›ÕåµYºzžòµ¢2Oc„±·Sï“DhlÓ‹\kÇq› ¯O#¹ŽAFÁ†c“¹#±Pk„h2ñœržœóJî{Lšo šb Òñ+Ò€Sa==Ÿ7ú\ÓByõÛÌ-.ù ò€þ„ _0°¤×ƒ”„guI. 5ܵ³·õy›cß°@É©ç&[©‰§o+%6ø$fâã™ 9óM‹ñ׺£ Ù¢Û}«“XˆÄРh-†XÌY“GŽ8r~ εa¡O>o›õlµ#ãñh@|B6RZò¬ ›û±­‹´vsõ*¬®äÀ™—Âû&¥;;çºñ$¥Ô~?ƒ^W|.m9Íœô¤fQž>6ÏW‡Þó46þ,}]ýLDñù®R“M9×c!9Û1‡îWâõ ­™ŽÈ!FIFÈÿ‡M¨F2j‘å‹å®YÔ¤þG1ºyÒB‘Ú>àë®1`¸ÏaŽòv.Z¹8dr`³¼UÜý‹kuiY³]ìÓ8× ŠfŒ¹ÎÎë¢"áâ%ŠÆégD’‰^ŸšJ|ËÑyÎ0ûˆàœI€é.zV5wz;.N…g7+¸ Í aŠGl+Q¬ìć~dѦ7¹C6êGÇC«Ð Ä(×HGÆbZÛy°@’ËØ¹´j=·Â;Hâe—w ³»@t+ù¢•ÿ$¹w7h'Jt‡ê¤\= ¨ ¯d#šØ-9ÿØáG8>óæó¦ LJÑbó5ïŽ4£t›ož}ËùlbîæÃ«žê|Ë]Pž…@—Õ;šþgl³k G²D9êûŽÔïZÂÑøÂnî#4çÙ€·Še”37qB“µsµÊƒ'h7¤¶§Ñ£UÁWÓ{¼Æí!t&¦æ\í¡ ëÚÆE³öh‰Û QÙ4‹ˆg!MÈÜ7›ïäÍVW„[9<ÁÉÏÜCtÍšZ*©"V>³[6˜ü3ÿeò5äݱvsý+Þ$;At¨°V i;jÜß•B ‹/”a©µ<:$£·ÝmmùVMªÞ¬yÌÆì+õ®¤ýÚk™a.c{Ð.[Q—“˜_"È3_f€Â‹s‡° „ÁìdìÆÎæ^Š·uîíYK Gk8‘UèqE^Ï»*—LÍÊÐá(ÆÆ¬bÊ/åÞ[®„ÉöØ1ß2šH±`Ô¿rVqk2«ßŽh4r¬$®Ú,è¶^=›G –£]µ†nNw†‹O 5Gï‘'ÞCÎmí4¨ï~g¹ƒf·Ã¬ô‚©Ëqu¤§ñ½xÿ©›blÞ» mâŒ4G\Xtñïxy03s‚1­$$1þªöÓäâ/c+2X\”—D¶‡á@žîor.)ÖisI+±ÊÊQXÝÂ㣒Æ\˜÷DHã¹–ó6ó;-¶Yò%Dz9ìãùöZ6#§æòuÒ‡£°FN4y¡í/ñ¦FbpÉ÷]U3‰zx“üˆom*¤K‹éŠ9?OKÁŽ™ôÜÐyÿ-&Èî‰Õ!Å{Ì:è͸÷4ÏÆcÏ7N§>iMNjªÀš%©ÙB>Â/UiiïAÄê?Zù›cRU…Jpå)·¡ÜšÀÓ,OÇûO”­\xq nðZÌ™{ýbÓcî´Ò F °CÐñÖ‚4ÉU¹Ým}k%VCb)øùн{´‹10°¸¢ÌÌÝynö­=ˆéÆûm’Š1ûœ‡2§‚4ÝYš€_¤%k.wõƒÐÓ¼znÕß„«Y,­Öâ-ާ(úç@ŒdyØfµvs0:¿òȶè}ΠܦÄáRÏMeyè3-—GsÒL¶ /ž²fë‹J«ÑÀ”ÖRõÎÏ>qíKÛ²=9bà?Ø e»w"î®VP†›ÅGMaÖ£½“OÓ ¯úf2·ƒ°.fvãµLh=ÃP¦‘QáÛÐÙ}ŽÐ {­a…cÅæµOš'[³ø .k––äþß?“/½ªÓI\-Tøp!sõÌi¥–1Àã755N$+øË8K7É‘ÃwãáŸ(–VÓàì¡2|µÜ^ð‡0Ã(JÉÅÁ÷«Ùo5†æœi>4#ƒ˜&w¨4ù+écúûYô‚Šó™<ÚÉ…ïpÓ´çL7ÛÚIMËÆ+NK¿ŽûDÚ$RI¡ÝÔ<ïÓÙ£71Wª„'ðEÞsÆÆûD¥Á°;–¯Û¾‰K5Êô•FêfŠ9ÝÊ7}Ž 7‘þ#”:ï\ ø(ì–2&2Ýèˆ1¢­ÑH¤HŤgYM_Ã8x'òË6ÅEe2Ü G¸gÍÑ‘Tš¶­l…9NزTrç–É;·LÉx%nÙaÖŽéœÙŽr"ˆŠZü¤>ÊZÜ(A»°ùª<©ìé]Ó¿„„Û=c’™ Û[@ñè5ß…nÿñ:š‹p÷d|"F“ŠþÅ.VA°vªWhÑ^z¥–—ÊÅP—/rÞ*½",nVðKS %R GÀEŒÐ½ÔSN¯¥âˈ'R7¾)'£õƒ•á˜:ö8† ·ŒйigÍ4ųOÏçá YU~ÑäÏeˆ|µ‚eÙÃßS-É2Âƺj<)ïI( DÍë!uÓÞ«XlsàÌl6PXAëžâ/`t¬?DÉ×b•ˆÑäRý '"ˆ™Z°Qç.\¯O…_”§¯‰Àe——1ºI˜pg®ÝÁš›WÚ·) ›´Ÿ' „ÇmwIŒ¤H/Œ–¤<ù,¯MòÛÆX#x#Lún±âÓ`µÎ"ûëîŠKŽÈ⊳îÉ+¼Ö\¥¬z,½®ÛJ WíkùYÔ ÔÊG áä-^öæ 6ŹÇðU륱ÿYwZ1{SK÷õñ¼!`½_ù]­|[ØêÇèUÒòÍûa·.êî—dn!Ô(MÈl7éÅúüº6rŧð|[«ü<³üÇŒåOQKqº 1uÕC]³í`á ë!}Kn“Ô4‚8nAZÚ»É0¶yÛ ŽËo’Áäz’»_÷]ñÊwÞæMÇîq°oÁF8Oï¸~ñ ADwÍB§ùhV¯RŠèòŸP;À—ƒ69§ªj<Ù'ÍL#ïcôF•kq—W̧h])¹fø^æû¹A+9©mA f / "Ú  ºµ¤ÃR¥µ‡úüs­òÿöðÀ ô ÚÃFb¤ìâØ?tM õ=ض¸ïHž%ýÛôíUu š€»¿†´¼ÔV(¸‡}5û ƒ•p#yÝf!l·W5M§(šíÇþ"a¸ùZøl¿¸w}˜ïŽ%»Q#‘„³wF’/¸™¹4†¬Ç¾+|/›­/5æüäîõcñ~v!%`¡pÕ‘DÞV¬D ‡Rû´ŸÁâ5Ë‹vÝ#5xgë==´[Ä@+IôðÀøVÕÇÀànNIZ|<(Ò(ª£W¯T€yÚ™Ó-ŒrÓ],OdhïF˜â_}fÆ(€¥~¶í—{ö¿ L¥Æ,Щ;dõK¢Ÿ  r»d0’óÈ—ÖØÀøÁ3c0ö×÷fFý+ìº-@»_ÕÇñÞ6䣵Èi÷/{3±ü¹ÛT>Ò¼„j~šs­?4¹Ö¬µv+*í²Öþ ŠÇû“sÃĿ•†ùÇš CKGŒ|\b§…ëkÏpÈÉ—.A'åDóÛí¬ðJÌC–r¾Ô2JÄr†Òž´ùW"§Æø¹~RB/j黎¸X%5ÁpßÑÉaT÷ª6SV:'–>uN½Fo=sÈáñ˜êUW5ñ]_÷q¼ùºŽýŠ¿‚gÑņd®cþÅPÿt‰Z™«5Ðe³ok)˜îJÎ÷~šU~0 ÛcŸ½%ŠÃÖâ4¡ƒa¡(—¹2ÏŸQç¼ø§ É€o%ü:Çι<¡¶9T¸"_‰± ÛÛ”@ßÀzȶ|!f±ÆÚdûJ„/f“£sÄáçyWã]|&Mn¼dŸÚcEXLˆŽ>TiÓJ÷"Ñטfæêy±øw…ÚÝ9îÕÇsjÁŸ/-ªëù}乯‹÷ý/ Kdé˵™fTÜ@´–\è¼’$ ·sˆù¶•€Þt¦ì M yŸÇQþX—&î6’´TEÒ t”›¥"´¥#'(bÍÜäØzè‘Ó±Ó¯zmѰȶï9ô’jóéz,¯‘ê pûXh“æQDg½½›è^÷Dzf[|MÈèß5^Æ8—φ½XKÑ7ý5n˜¯'z%ê)x®†ÖsB?’í« àý=ìù˜™¾Bž±¯œ[L~|”ó»@ã¦ù>ùGñ“ÈÛÈ¢@70#fÅôi0ë*XFHøçs!„d˜Î?¶Š9þ̬¹–þöm_Š}S!çü·Yipôßöb¯Gc鯒ÒÖ†^b”ªñ€aí<®uºÅ&C=Vàüø$iuå¦É‚ˆëÚù*à«x‚礹oR­[q†3iÛ-A6¦UñlåËÚ xÞªuðÜcßw zâ!çí¸€ÆßÖ3DBù7ð\@’1RK­‘‘oÌ•k0Ö¿v çw]p>ïóÑ2´­HðÉÐ"Û®ùDñWP8ì9¶•ã¹ýC°w^{Áú>M\ËáØòÿw} iœ“nv»n~(°«ºq…èÎ*ÔλGy‰µUü#$ÎÎYy; ´œÒ _t_ì§ ùs9k\+_a²Ìèg2±{ N£ûÇÕà²ÛƒòRãYþ_?–†¿o¼eçNðo½ã Æ~¨áSS>ËlB©›ùŠ~Æ?ä3ŒÄR´€©~{£^ÒZçH[“öf2Ç_¯Ü¥¡ÍËŸIH§­Ö3+ì ¶AðGTwºãðA‡›1Þí=€Íß=$sRª|Y~pka‚ƒç'õVÐÊiðuó–?@åÇcù±Ed3–h¸DƒF 3µ ƒbïã²’k'w­ XËô?*üï)Š–¼køB³ Jþ1ó”á‰úiKþF‚ÖÌ ýúD.¹ë‰Ù†–o$m¬ßJ¸ôÿŸôâÈ‘òg­pöòr¹fŠ¿á"È Rá­ç?ñOlÒ†ˆ,à‘ûéµû[§õÔ—:Tx¯}õüÞ®‹Ú‹ÎÓ>tÁ;—~¦È›Q6™hôËkc^ÃEa&£{ÚM³†»+¾ôUšÊ\Ã0þýðý5ô­´} n¿Óˆ¿ùâë&—TÈ©£Ä%Þ£ñPÛ«~N»"ø8÷ÕºlHZ¾é^D€ˆûµÂÓZ y{Ù­¹ ðWÝ ßã š7$O¡O•EલýÏçµ fÎñ´ë¢O÷áÓow¯s=v†$†l/I®ªàÓTß=Šnº&ÍdJj{–E¨7j  CzÐÇM¥—íl»îKþb\+¼#KŸ2.îÛ„èRLc‹þ›`œ£]^¿ ÓUí!|kœUsϙ螫}éé"ZßUïÛaÖàÒŒ3¦)ßÏŒ¡ pÒmç€ôA œÎjívG9³ œ+`±¤W‚·Û|ÏW7I¬-|Þ¹¥¬0Òý\7ûâ©ÅO/óß¿„Tasð©V›lë_@‚±®Ûn¾óŽ}ÖJi=(Ñ”m…$Ç›ùQŒG¡„#8z-Ëÿ‰ÌìG$ùwö(H UŽ‚ÈQEä½kþŽ÷»ƒÿ¶WFÞendstream endobj 136 0 obj << /Filter /FlateDecode /Length 6192 >> stream xœÍ]ëo·•ßÏFпAØ/½‚}'Ã7Ù$-œ (vh`` ÔE÷Z²ewm]År²6û¿ï9$‡<‡CŽ®¢$ØäƒÆ#‡çñ;Rߟ͓8›ñÿüóâݣϿsgW·æ³«Gß?ñ—gùÇÅ»³¯ŸA!ά“þìÙ«GéKq&”š¬wgÖ¸IøÕ»GÛ}8Ÿ§9ÌVz³;žï•SSr÷â|?O^+±{M¤õRˆÝðMŒrð!´ð>v/áµ V+½Ûãk%œÜ½‚—ZÌÒùÝñ=¾u³µÆï.jã—8 ž´Ä'øÌ+o<7f^íoqäyöFæ‘a:rwHs6F:½{{öÊ ½;^ÇFgz‹ïµ°z»'0ŒW“ fw™Öå´±yÖFÎa÷–ôr8—ˆçÅîÓ¹tq|Úô2ÍÙÎz™´6&œ2éH/-µ€IÃ~è0Î9ÝÀx¤¿ÃugwS;I;´²°WË,LsÊÚñeý¬™1"v"•ºí¿ÄÆïÏÿþìßÉ ¦Ù`­g—ÀH‡µ·HN/Õ<›2¸ð°’=LÚ„yá‡üxCÌJ%žÉããbVÊSá€ûeĽ°ôÙ¤ß%ŽƒÑR­,ã‚°Nb–ð/GID¿¼i^Ì’‘¹2CíøÝ9òµó^2n¸ÆÆEƒÊ×-ÎBMÀb·y>ÎîþGp ¬¬ƒ·u–oS[#§&œLx~HvŒpÝvÞ:ömaÏ21Äì˜dÐ×qK”PFZ<+ãT™ºÅ/­R°œÃÕËÄT0[¹›Î÷°•“š>Ã×r6ΈÝë¸_ÂÌ*íPgv¶k‰Ò©^S%ë"o³ŒS‚"G)a')ÌÂÂqµ64Ò9qùpƒ/p^vMùš°éëºêRÊQDÛµ H’©¹ÛôZb=\$; [rQw혦2{+]T ™ÆTÏ‘©à®ÙYS&Û*H ¨¶ð/Ï9úu_7eŽˆ^½NÓE…I?¥K™ŒÍ¶î7Õù/Ód4lä€ké@‡l’"Û’Þ©Þ9^%m$ìÀ8Û»J¥«´¾àÜîù.²ÇçßII ° všµ^Øìø1FsþCþ ±Ø¨=µ\>x~ŽËñ^¸™Iƒêà‚ÔÓÔDI$Îíä­_87¤øžVv…®À~O¨ ¿IƒYPÚ»ÇÕÄ=N-\ðLá#Ý€ÐÆ2ÕJhHv—òÂûÔ!—»[|`çÌZ‚âš©]ÿ¡î1×{”›±;˜S‹pèôH»’~ól-ZîÔ‹@ãM›Ì_ìà‡Ü! ʨŒ™7lOÖÏðÂÛºtÆcs¯} A¸…‚¢´RÞߦUˆ3ÌŒ¯)+ [>¾87ÀtÞFJWŽFVÞ @6ôËw\½Þ¤Œ“!M*«Ú·iNo“ Ð (58hûYIÚ:æ@f‘h…OyD?×€á2FƒÒÔ»ÿˆ6æõ$’J:9ÔÞø@#©(ð9f"Göìùሠ¢Ò{á{¢›yi¯,ˆ è‰oˆžà¢‹ÄNN0Lr«!,û>õçí.áØ¸ÌÝÕ˸ÞYÀî\÷Ùž*åVç/Ëa¢q@ÀJXÑ€M]ú(€÷é7'gV˜yŽ˜ùѾdÌóû…_³ —؆+/à  cc—ÞÔ­ ÛÌ|%âX]¦^¬È ˆèbc ÕäãÂ|ÈÈé3AÉü‘ø ›j!rÛ=õÂé"ôÌJ†Ÿ+kÌ*jM:{¢²S±xDب#´?¾Z:lÅ‚mk™(”H¤…²¨õ'ô¢öÁÙ¿ôGÈû¡TI“þ¸·ÐêbØ]Þ$Ý£$Œt}N4wsg5Õ@m|H³íG±nqKîíŽD»6j$‡ b¤š¡ŽàGB×SFÔ>;0sjQЄ#ͨýóï4³N`fä¤Gñ»¿ž?û'6iÓ0Í‘. ¹û*7Ѽ‰2nγÚ=ÍM[9›Ùç&ÿÒëÁ‚Z,æîëÞ\<ªòÒËã~/ 6›0Pÿ± ·rà3ÄBDD•BM.:¤° pbè P%ý²KZÖÎɉÁ'Ø}/¿³ ð·:N Þ È4aö=†AýÐø)9X‚íÌ&³A+éqäÀLÊ :Wý’8¡´~ÀÒ¤±v[¾­”¥IW¾¡ ¾ÍÒ Á[Øï3ª «Ü­÷!­]TÎÿðZ€1äm‰»“‘†Ñ8ûJØ2Ð0 WÉE-PíKø“šKœ*¸L!âÉúú: =©ô8Kwb´ "kÂØº´O™>b ×Å·”ÿ(a /~ì2‚dcæEq=ëë6à#e© áA°aÕmì«Ð6‡•üËZ˜^¦Ï"“ÐÏ zòàûoŠ':ðKFÞdôg¡„Š5(9–3lkœÛ½ QÝ®ÊP2Ϭµih§ISwZ4O x{@sÏÂ$d½ã´,gßÂ&È:aŒa{¨XS…ê'BîOipN”eéÈ cNQwŸ´œŠ-]pPËØF%Œ­UŒU5ŒÝMáR©ÏÕ?Üa`äÉÕ˜„úµÀPëV ›À(=¥BùÑéZo¢prõñSêÎmDu¨ @dT+tÂVZö<Ú¢÷€-q®Òw³@*`DÀ-ãúkÂAT«ÄMË[e:jÉ=Öê@o˜×€Cb®"z¬6rI+o^I sâv©‘PQTDA!ûŸFë›×:­ÑjyéÆr¿´àþá’íZ/ÄIØæüÐ)Ÿmb_…xþànHù1õâ¼Ù±Tf×õÊlFU0§…Ûš8†ÜØ•bŒoH@ Q?x:Ð2ÉÎÛ4"šHÂ,,Dÿ.5m’"™€÷u»ÉÒ+‘€Õ§JU .H°†Ò,N)CöÑÚ,‹|³Ú Íkb<‰!ò¬o'Ô·ûèÛš6ÅùŒÄÞIà1“'Ù©Ž)‹vK%bDs9Α/ÜG¥þ™>cü~Tþ* ¼ôçÚ{šSù¥Bá8¬ ²‡Ú%±™%®Ù“dè0´ò4)G‹Ïlf—çLE¯³4+~¬”9pòÇT&e7”¼M4Ôs%3ìß–„lÌ^ŸßÀÞŠZ£`¨´­ñÙlø Z;˜Æøv7˜úºÔ&}Jcz!†¬4DôåË%EOºcÎVa‘[fIRc3Ï*xûÇ^ÍÍÀ&4R›W’“Ô”¸ŽÿX»»i ®F‰åAÝ}wéF¿É* “%7Ò”9dv<Öùš>ãì˜G5Â¥à©UÆÊ’u‡@&¥ªC¥JåˆÌ4ÝBøê1‹¶ásŠÂð+œw '$l¹;ŠYæŸÎ 'Pÿ-O?”§~IšÉÛêŽÁ6wd÷Ï´7!pëEUXcŒiˆ×hÔlj¦c:S#`êëDRLÁ³H=÷0°‰s¾awæcÐ@nÌ0QJŒø@ïžçÎUo Âjðzm–†I\˜rŧNpÿ/ª°°$iÒ°àÔÚÖi€¼6>VLd“fšA¼‘ŨœJíío«I¸M}«àG=%©Óu¨HïK߆) x?M*$¹5чÚJ|· + z²µ7н ×m3zÏw„ï›\MuZGÂkkŒ“‹àzzbðò!zh¿ôÁuoGyëÕ˜´œ££¢ÚN•)ùæ’aB˜ÿìU(r¦\{ ÙB ´íî*LàOÇuDwÛ„%õlELÞ¶ÎZî…%ÈÚ<ùšÃxÑVWÜ.sçJ¥gqªÛ›ªŽ×뽿‹.¨H;>ÕÆ$µü2-QgW?³óVÕFO`dNHó <ã’’²‡á‘´ië ­ôöÀ* ~ s¢jCa(Ï‹R†x5Ò±ÕÌ÷1ñeêyÁ/ë¬ .[È0, Y<0k&§[È{Eüº~A1 '(QãÕŬЫ²í€÷“®QÎK¦¬yF<cWª´§ÇVõœJú©áЇ•sâ\T!o”sr7'3×V9g`à}¡áyCwð[Òe›,è¦6‚Õ·$@ÂÞdDâi’CŽ÷ ^ ,üJn˜Àlæ"ÌW¹8ċْ KÁf?,}Ç™r+jnÌÒü¬ØM·¢øÏ“?­(CËí¤íÿ³¢ŒYÒ–AåЅˆìÖ\± Ç%ÍQ؉FêAlÀ3·¿†’FæÁ¹ÿ»·©;½˜ÎAQQdWæ¹Ë+–a!sj.°? yãr&ý>¬ãgŒ°ÅŠCʤ¢IV Œ s Njøö¨›B"TKç2ÁLì»I†µ¤„&z)®]Ÿ`!”uº‰ZƒÑW] ƒPI…@5Ê—tÎ)ÁŒxR%ѾFÝ F‘R¸h+Í\Ù5‘~»4š kOa̱/e5t?THœ‹מ–÷÷êºaÐyÖ…Æ´ÒQ0€] 5Ýœ1+å`§„¹TK!Åï’Bäüs·>×~ RÂ`}â‹øôCyzYž¾DÜ_¥w±Òòôeyú¶<ÊÓ‡ò„‘8©NktuâØÿ(OïÊÓ›òtÝùö¶<ýþWšÙÍæt>Ýh„†mtÖ.ûi–²®Ê|§Ö÷T‡Œ7¸t‹,OÓæS=Àà@Fßñ€©à]R³sJ˜ƒ›½T^<€é‡¾"µjz˜»ˆ.kÐ…‘)œ ê£D£0ú8µp­¯0Jý°s ®Œ$t¨›âEêZ XD0å'Ï"çLOã´ƒÀ€íë4Šqy¶D¹¢u‘KøØ‚,%‹^NÎûÑÂÎ1æ_3õל_'ÇÄ‚òŸ]¾ÐàØ°äœ¿ìPÀ5ð_Qî¿M]:·®SÙ ~‰Æy¤ßßo$²o,–Ò N i‡O$<̳¡ß97È`ÈÝS”kOÖÇb§Q9 …£¼4¿;ƒAÉçiên%.êqõy ´ Ǫ¿“ó`k:m>h©Rñž,2º)¼:QËÿ£<Ýl~q{—¾oÌÙ^ÄÕ¢µñPî0iÛ7ùÙ=PUxïÙƒy€CØxOë5–54[ Ë[èÞlšKÍ丆ʚtärÑCÑ9%õ$]Tà›ÚjâùÑÐÝˬýjGbÜל"(ÄÌãR¤ /$AÃìæ·khgW…Çô:ðL‹4´þñÔB ‡¡  nÇ+æö*ÒÞ¦¦.höÙ¡Néùä»*» =ÌÔ{>ž¬ì«M©¡¸‡ µÓêĆP·ÑmE¤Lû~èbôÊ$²¨‘¸^-¾ÞÒ® þVQߎ[žåéCyzR=»þZ.X×ËU!"½{Ä#šÌ´²*†bø±«ÂÖ¯úJ~Ðz,|Èx+O{9U‘â£ãüëûE¯§±”§Y¬’”éŒÂÝaŵ¹j«ÌY=TÒÁy»šÂ00:äòéÆ&)Éõ‘N«dçå˜:mÒÁÐ>„5š°Þn*äÂ\†0èíìþ-iÒ­×i9h;iÍnS‹‰M°}\„†-piý­ñÆï@<Ú]üé€Ub5˜|Xü0zô‰Ä\Dgm8À¦¡!k³ÁK-^õ`ºN™Éwf÷ñpW·€ª5³îé–Q.ªW±ûYߢÜ.7†C®2™£¤Ñ!×D{"RII3àRJV]må ­kæÎm¦¹DL©xp±ÕWyp2{žÚü¸”¥›d‚o‚{: “ŒeœTਉÔÕ¦ú‚U¤Æ½¢¡Õ­e=wÏ߇ÍJrdaƒëà¸ruyHÔoƒí¡Š‘¤ýš Ú²3ºmÎ\ªzÊéÌcÑ-^Á º<­B{ß+²kNµÀ0!𣊷Yë©­ã+ÔÚ.³:Ð$:©ÌÉ7åôÜ”®‰äù¶ÚäS&KhRFËYR\þ_©ò@)ª.«Må&Þ—ã÷>ÔJ~ð ç™Af´j0àVñÆÌîùó¾ZhXÏ3½›±¤Å> (OóÀ‘,~˜¯\iï]êyǤôïÁb«î¶œ÷¹»|±=»ãâŽäÚÄ%3ø!Í$ÌŒî}ÝK¹†eà˜óŽ:ÇççéS¿yÀ¸ô½o.—ÜŽÇÑÂ’ýro¹î…G㪠ÂGdáÃrÑn\átv" —·ßXN$.nôH]×·I·»öÖ¬ý\¯;)Á`V€CÒÊ—]igΗk~rLIŠÙ< ¦E©vÏWÑ<ì& –I'Ò6®8ÊÇÊXíæðÊŸ$ØÙïI™”bŽ§æ«¦> ”c,²ô»¾/í`êKª,Gƒ^ÏöXžÞ—'øåñMyº&nqñš«SûUyšËÓÉk®jH÷ÏãF;O(öØêÒ¿–_ü­ã_ÿ=5ú*ýH‹‰¿xzÊgûôãë;Ú¶3{œ~|sâgyÕÿÛÏobôXùgÉo6×`î*,Ùò?w/.AT:‡AtZà}£Ûg¤¡‰–äÅ`ïð-Ê#ǨìÚøÞÚtÖ/>ÏrWJý¤“©q!MR§{ž:â®KhBIpô/¡±°-ºÜS3¸±C”» NºƒÆƒKnX æ »Í@XðãÃi· r± wÜ%R³0ÏFt¬M «ú7Îù7qt¡:çzVÙ”f³tVªßô(+Š5á’‹I½–¦)xv{ •ÛUíXô…è1¨Éæ ©„ÐP‹ {«Òú•wߦäK$ã>™°õt¹;sæ'»ØíÀ­–—øs¼4û@Nõ3øDÁNm×Êa¬—öðÏMÔ‡-ñÜÿŒO4Œ>ê¦6­œf§’ð:uñs•Ô 03ÁÎñë°#­ÝêÞ×A¼3ªè96À¾Ñý!·ß ª–‹¶1ª–1¡òù ùJÆ9Ž—Í~\ܹ)~äÒ˜Fâ=mƽPô’Ü"´Ü‰äÜî”C;Ãki—NrvÊ>#´(°uwÀ¥ìœã1õ=ϧ&šâzÚ[3~¦k‘¶Yw^Ê÷M™b ±|XÐ}öV(ºO—nã…¶ãUqçžÊ(]<©%a›Ç/1eðòº9F-<îiñ2½Ö> stream xœ…W TS×Ö¾rs!Þ ê»—JZQqj•ZëlQ±VqV Cˆ„@€f„äAæ!@Qœ‡*V«­‡gPê_ÿj_µØúÚ¾ª¯öß±‡÷¯wB€àªo½µɹçÜ}öÙß·¿½€²D Ñb_ßéž–Ÿo›ÇÌc™ÿb—cÍú—+„º¡4Ô µÏûÆ1g³À ÊA2‚²TÉûËöÆÊƒƒ$ ·mž³=È¿énÓçÎ}ÏÃm†§ç\·…Ò@yp€¸›¿B(õWA˜Û:Y@p "¶ç•y…b¯×´iJ¥rª¿4rªL4ßbÅÃM¬¸­ Œ ”Gîv[& W¸­ö—ºYjýZ,“îRÊÝ|d»åáEÍX¾i‘lñ^ù²È动hÿ•1»b|v¯Ü´6x]h˜ôíw¶NöØ>eêO•ÚëýyÌŸDQ㨩¹”;µ†z‹ú„ZGM¤|©IÔzjµ‘ZDyP›©ÅÔj 5•ZJM£–QË©¨™Ô jµŠò¡VSC(j5”Fͧ†SŽÔʉÚFùQc¨±Ô_(Žâ©ÁÔLkÊžŠ¥~¨/½7È`7Ú.ÉVè( > çÑ×DŸˆî1˙ۃ'n2ÈaÆA:Ô{è³a>ÃÌÆ_t q<3bˈÂÜüœR NWG:WˆÝÄ[ÄGGR#ŽÌù¹z¸¹3‚é¾à 9ÄLæûlÊQµ. …#J Äúõ.j¤@隤ôôd”ÀHëP9÷œ®¨EMJÄ×ü&„wéwa…IkQÿœ.¯CÅû$îçÓ³£PrXÍþýÊÏ0ŒÓE–+ ˆ©®*;X•xrΦ•±«|yñׇDMé‚9<ÈJ Z‚Ð}ÜîeA‰Ø®w—ËGðÜcMgLvð!Ô³0–Þ…T­‡Pu%÷DT‰ªƒ%Hµ‹Ãc!²7Ð1(ê%8\§uÃn§¾s”ò-ÝêÛ¦Ò¥†>ªøtöÎwŒh 3Ž?ƒÏ ŸUä(³åûÃs–¡cL]sÓOß–H#²9]\V\S/ &‘áÈ uš†Û¡ßb¶ï+æM{÷£š?iKý&aÃè={B<·­+¼'çöUdF F‚¢•ü;"’7”éŽqmA5õžÍßžãÅÏÐo˜Õ‡îgz(3pšä¥ ê1×C [kÉ»ž`9Ø‚x’NÄö[¶m@Œ×‡@ÁD˜òÍ?ïµ^S`ªœÏŠËM¬ëuøŸ£÷%Çs’Æ€RâóзðìWý†]Áá‹“5U|RZ#m Ï-ã?«Ðg0äfš…9¶â9h+ÑJnî,«æX’û{œIO¾ÔùÕýS]H/ ÑFÇqZŸµÉ ÄÌG Ö¼óµpªOòbàfVªGˆé¤Ë =GUó~ð€îAõ &j7Ý+1tjiæ FôçôdSd''Ž9N8Ro iƸkÔš÷Ú™‘ƒ48Ç`[<ëi,Àw±î ë_YÑ/j4ˆð“¢à*¤G®•¨¶0}ç™n|jt¾dÚÙ>äLÑæAÍluØ9íQÄÔW[EÓ?yv*a¢Ûëÿ†ßÚ9-’êUµ¥õGtÊ×骲JtŨ1ÿs!l />‹—fbÇÍ“G/»¶â9'Ž>‚ÚóÎ61I$ùÞ‘:½;6(Î¥"ÆgסcmÀø¾_Ô».ÛAüÁ‚ø ë‰{ILgZdÛZp®Beµ¨´/Û'Z5Ý¢§ÕÝê(Ûè)Ý¿& \é'0Üp¶°_}ïZ牒ñšœŒ\mÓ'¤”ÛÁq³@Ã$áqºä`_Ö÷¾äNøð™°®7J=3}N§až„GàÙÂÛSl…'…ñÁ± ; e}Å…Ìõï`Mt_=€„ýšOJ¬ +þÌî\Z‰¢IT8q›ÿ ¢ c(/ŽßŠübƒÃ¼Ù¾Sô'ÕµHtŒÑ|È(8õè¿0m1NØ“›檥÷U¦èÓ*§Bš‹áõ´k¢a~™“Œ4HëŠ4ò¹ òpß M¼éöç£bÆ[!ßá( íép)Ìáú«[§ "»ìÌ{@ÀÖ‡£tU²F™Æ¥'Äl[ˆ˜wwüp®D0F ¥ð:I¥º1µúò†Nwä‡|ŒÇÎÄCÿ>œ?ôr+¹ÀÝFAÇe0Š2 ÙÄ ”ðôpFK'Ÿ EšÜäZ9R#fõ¼zÔÌw«E¡Ñ½‡yЇ](oŽÐ‰ ·_Ǿ9 ùŠâÀýi¹©EiE¨•äç—dç~¹E]wýÚ—Õ¢f}/eÖ‘*‘¡N‰èOÆ[=xîÃûólR窋9÷5ê2ƒ·5„ì*Û9 &{`1ñøß ì—ÑɃõ „Ú/­ó›3ÉÇ·»~î¸Ñq½m/ןsO.C4‰ÉZó6±%>{/b–Û07t«å¶Ñï6¤åf™Ž†UݙŒ2mrm,Ê>Ê›s ¢þoÚ¨`è–i{Ëר«0Ò(¸d‚ZR$æÁ:V_‰Ž½òø ì0y"vÄßM\Î>6X MÍŒIã£6­O‘¡hÁyÕCFw•-é¼r©‘®J^ðVÚ‚“Q«L¿<²ƒ\‹ðÀËágé{E\FÁîÖªš²ú«ï#Õûó·Ïâ6L´Ug¸}‚­C„Z[µŸ`ñÇ^……_\º Û¯:7|c)ǾüäÎ(ñÿ%–°ëýÏ^üâôé ŸŸÜ¶aíŽùé6[sTц˜;ït5¦4ÄÕóú¢Úœb]îÞš´ˆ)¯)j¨‰iZŸ´E¼WJ*·#fÊ’ïî,)áŘJR¥DIG#I‰¼ q¡ZŽ’˜Ù/VÃHù¢ý»#±ç7äòü«§#f)ŠPjVªZ&‹Š’ɪ£êë««ë¹¾®Øù (»xÃb¼ ²õéß*Ñ,fãÎ5ód[rpþ3Nj+´åÚŠÐÞ »ôtHÕ¹%ÍÜq©QutHÌï»®L,æwß›÷A#~æUá_؊κ~Övî6 )–ËeG¦Wõu<.Ö.m_œ4•ÛÕº¾ÈtŒî׈!Öyó_{q˜1 )£[Ùã2ò]úÅËà`ùX®óxVÓ¨D±ˆ µbªG‡yÜ. Šî­¤ß[ýˆ&·WX.·u8{¢¦$n‡Õ¢˜¾käÝWý×%ûDUèÒ] »e\ü!YEbÄ÷C‘Te‰ø\ýËHÒX&g}WXÛKÎoè\p91òtej|aÚþLæ`A)žM¨=qæñÏøäÔ}(žIÍU`'¸@…jõÑæÅøÉ5p¼v»Êù–Ù+oŽÿ?œ\Ö¼§ªÃÿ * å#¦ª¸¢´<±@£ãååË["J€ºâR”Wœ‡*™ÔÀዳêt7Qƒkj A!)á:ï¬S×Ô”†\• ±ñ1…éÅi<Ö`jMbZB:Rºf ð㌸£‰Ðz£p×ÒÒ‚Z ´75uç_ºlåD¥?~9ŒµáæM‡¤¥„òÿZ) ËM>Ä÷L=^º[P½¯‡:`> —²ƒPjYGµ¢ÖV Jäñ8p§‹P«D‚$‰vÇãD‰ä§¤ñ¤cp§‘¤•,.êéLx}4”c'½3lƒ +¯[nÙ­Ùl¼Ï6UbFrfì>¤dâKãÊ›ŸƒŒ»íPHCä-¹yº¬¼Qà.½|³—¤ÞHïñ/wì1`ìM·ä4[Dj;—Ížvæ¹ä6ÿoÓýþZ( N⛓ÜkgHëBåaa{#ššš,xôñø6¬÷ñó&8FÂ_²°z<ŒÂƒ°ýÄžë÷êçx¹ÕÛ?…Ñ@(,Áùì+`L‚ ¦_¿êìxOÄ“Và!ð=†ó–O_b–³È€ŽgçWý>«1¹U¹µ­Ø¥X03Ž×¦£ÍHÆL¡ ¤ Šß¬%wžtez¤´V{€¯Ó‚ 3k=ƒ½DHŠü.„ŸT\J;‡˜ŠZÔÔ ×¥ðxl6:Œš˜-B†Ì¾' ¥-:óGHÖÔ£3¶Ö­Ê‘ &ޤaDe‘NC6a01PzJ±.T³ e0x™…£ <^ÓãiÚËýTu¿”×å¢ó¨žy,";—.;\zNWk=Xc¤.™ÔáAYšËŒð¶d¶ÿ3BøŠýëP#Ä#îyÛB=§5W,×í×Z?YÓmÏ&¬Œ‰OMÏT§!U%«þìoJ›ƒ"dÁ²rI›Åìe½yG••kÌ*¶0¯8Ÿ¤rML‘*%S›¢æð’žŠb\QB~Ò4xˆ]JR²µä†UVYTSIžæñø8x - ÝØñ CpÔìkgö§lQ á×Ò'â_iõ¯KN½ÀlÉ2baÞtb™9BôïUÖB[kñ§&çá‡è¢.ÈÔ¥ F“¨ˆ!O‰ˆ'÷oò—”Ö㤢2±¬ [WPÂÙ4r!!±÷z•¦åÄáÛ®ìÑÓ£ÀÃèÊ órP)“¿¯*"ïÄ.¸;|:½u3wqÑÝuƺýUùüpnˆ}¬lè`Šú7Bß·endstream endobj 138 0 obj << /Filter /FlateDecode /Length 5609 >> stream xœÍ\[o\9r~ò#ƒÛšqŸåý2»›Åd‘  6XÇA<‹¤-ÉíXj­.žñ¿OU‘<,²yZj[L±y­ëGž*þ}%&¹ø/ÿv}òÛ×~uy"V—'?‘ôã*ÿwv½úç7Ð@ÊUœ¢ó*¬Þ¼?I=åJš09VÎúI[øéúäíúÏ»‡S\Hgåúât£}œtôk¬Q8ìú'(k¯­öëíCjbXŸ×êG**-U#4cìRµª7b !Jih#¥šwܾ£ñ¼’r}…Ë‹6Z³þP‹W8†:Hã)óèõ'!LAÂtïÓhÖÇÁVòBÿúæßXN4IJ7{säùþTNB†è`òRzœKeˆ–ÞÊLÎ _†Ø½;ÝX¨Þ¬ÿ†Ëv"Âj ³˜`/ (r†Õ:k‰:´‰`öèàOåùvH%D° Ø‘vÔúk]4g©C¿ÇŽ.§J5¸iŒKòΆõMZ©7ÖÁòæjÖï¾ðK¦…† =”£wiZø‹®ã±iî†LØÈè&«V)¡RXÆ ”O¼ Òã\Zà…¼ò/‚ 2¯Èm /´Ö-î±ÞH+½_¿‚Qð(ZÇØÞnLˆ“ ¸À*ž»›*Ì—i”,>µÉÝfr+k=2ëa×´)…wëòIKm1ÕD\¥kDgw M¼Z«õ-£w£7s‘÷ܦZ«€0L0ÏÓD™ #‚ž7x&<Û¬×F™FkùþïÓx@€vú›¼e ó»#ÓM¥ÇeÚŸÙ·`¸ ­ÇE¡ZÁœ¥ñ:‘ ÅK+9I=[œó4€u¡±’­9$±,³XÆÔŸ›em‘6ntT“!q)Jðz½ÑlvÚJIî)‰aEœŸRôß,+`õCªžù6/5fÝØ“ì†ãWÕ¹}hV=K.b#ÀaPš2!—ìdšAüÑÊ2×°Î)øÔK=Ï L£Õl”í93ö ‰3ÝI#·Ž6õý%“WG¡RÐ3(W„qA$Ãçi ލõäÉ£*Å=ª†nÊf€´þã雿íN99)unöÚ€hÑûô_NÁ zÜ'sÁÜd@Y£áÀ ¤aÅæà‚,#]4¥&í(a óúà¶Ð*D]ˆÉT&Ó•üÅw|$&Óº©Vðµs“¾MÛײ$5ÜŽ³êœNG“€#ÌßÞV—û@ uâ´V´ de`& @ç»dqï¬x#ãc'ÍŠ»ºûÆ:§)å³@óm\ˆ• Y@2kêIb¶ö£5ó½o˜9OvNSàçŠÝ–~O:`´ï/[‚¹ szë™ ±¾#¬6 úØà#ÞàJ8 Q>m*¯<é^° 9:íFÊà£ç´½eNó¶vü.;4£Àá2Gw¼ÄÃô(t\ˆ­’ëUvýó)T”)ß^ÒbôÐúÇõkRƒýñ)#¨J“·ëOO7N€\Æø,Ç–^ ܧd§%h¹)ZbuÀqN&¹É$ß®T&9MÎIq›´1d]"ÕFÁÑ0€ YÀѺÐÇ¢š/Ó×6oþ4¿Ñs]y(XnRÚËžrQìŸ|gž¡ý.Ÿ@´Ð°±ØùÂ%QÅDRO : `çAyÞUS³ÐU?mSZÓ1>Çn?¤éqÛÅ®ÎèI\ŰãöŒ‹/ÒÐx µ¹IJpôçˆ<^÷´§^¾Iƒq|h'Qˆ#NÕÀõŸ’¥#×ßTèùMÝ*Zr,ãÝÏò-ާñÄÞ\6Œ®^Îj1Ec&XÛóAƒ!·éÈ!à&ç;+0ÔŽ˜aý_ ¯ ç„Y<ödL#´9`" K²zÀ$[÷â‘8yXíAS»ËtUÄ¡ C8þ¶¬¹¡`Ng5Ô0 ã.𮣰-˶s¿Ldä{#Dý„RÅ cº‘ jÝ̽w—õ°ÆWpDÀ°  ¬= ¥ LÉì&ÝŸÐvtµý {›ìºKç>¼Ñ°QD.kç•: ®r¤4¾4äòœE/[õgÑü”‹28ilJãö¼t¥ûE§¹»I\Ñr?1,GÝàó¶`;»ë˜<• ¡Ð_ò€¤¯½Ø,‘ÌîÝQgºû—7'9Wå Òs¿pw ®Qà گ¬ø]`¥­Ô+À ÎVw'ïÑŸJüê ÁãRZýr"Vß³®&Nʬ®OŒ÷°ò8×|8ùϹ•‰Âƒ'œ'htŒLúœá /Ì«i>g€´hiaX3 ‡_3Ö2áW6(œL';¼-¦F*/º:Ý»a`º¯…0€-‚Ÿp|\Q•Jñ®·mmî’- Q!”a|"ÞÚ{tE¥ˆÓá]~T .ê€6Žd$ ò0 ÿtnè6Ó µ•Ÿ"¢KŸ2»>ý`Á^\€—ƒIôÑ‚€›ã z – ˜°þ=pÃ`aƒUJí [Œ=~…"žXë°âûÚà±ÖÞÔÚ³ZûP‹WµÁ®é&'ùL"°;oC‰¼Gý€)Z\x©½©Åm->Ôâc-ÞÕ"ÉL Þ‚¦ËÄùˆh‚Žæ÷µòP–>ò|Uÿ¦jÆc-^×âEÕ¦PLãÎê`8®@Éó¸ËÌ¯Ž–6ëd¼¤6H2,á¿ü õZ^ò¦LÅKñ±jûe­m¿h{OXXAˆ(«¿;8Â¥x;,~W‹wµx]Åj[kÏkñª? ‹»ºœ¯8;6e4ð@ !ÓÇʤ;çµ $pDHM›Ìýs4;‹“´/n<,A2vl<ÀóÖk}`¹V´5¤gÙã]Ù÷u­ƒŸ¥Õ¤@ßΪômUmÐ/P!æ,Å34:ø9BQƒlþ€µ@CEW0e†³Z¼- ¸ÅYNØnÖLwX•E‰KRZ°o°•ßW}î®Ã Ê¢Õ Ó)í ”… ªwÄñÚÜÜ‹Œ†ã¶·ccCêŸMÁmãd?tTèFÎêÿB²p]`[‹ˆSPÇðr¹ô{8œ¢Dà¸4\N¾®Å•vSµ-ŒºëÊ fg'´Ä>uVLð~™Ó?[1ñw2>ÙÂîª ~¬µï†ˆŒ´0’\µä†mÇÀ•°cw.^Îo[%ŒØÝ&-ÁÒ%ξ¸ÿOõ÷uUgu­Ûá²YíCëÊô^R±…¼J”…²ã±8%µLC/-Ò€Áý xP-ñ#WK’„»YŠ=4.š¯4@@.‘æ8sË8k(-¯jïûZ|X2 ¯!î÷¸ÿp:xT MÕó›êç75ÏojYÓcb~vzIÙÒù,' Œ!†¼—'«˜½âÛS¯0lϱVÖݹZéæJ]+ý\)F•þhâh¯&ÿ‚çî,­ €Öé=iµKvIGᘴæí¨'ˆùÝ̈DªV†1ke8š˜Êá—È—4Ãôr¦Ÿ ÍÒ3¤‚¬•qDšÈd÷XÒ |1½ÿr«(1÷ÁíÉ™?NÎÌÄjÝPzºIüˆ%ë‰_4Eð²è„xƒ¦í±FOA½¸ð ?9/{ñ³Ï¦˜«ÖP¨ö(&Ÿ¢˜âm¤˜ŠÂKÛ>~+ܓɣuFe&ÛƒÛ/E*ØÉ½Š®*(ZFýŸ Š”Ç(®§´7“÷1mE=ý9&HÜ¥D›0øÝ½s0Ò®ýü Û¢­³Fš}e¥?ñë!Ò¨°ò0Ÿ¶!U“õÀeA´3i~H¤Q9*R pÍ2}U@¥ )ìEI¬mݤhû¨Ò·( Vû$5÷x ‡Ó}¢âü~Õ†c…¯ÂnhÆâ\¦ ÔJ%¢ÞÑñuþ!÷Å=Ò—ö²—HÛ5  pDé,†m4#^§¯çZküH‚ßñ¥46äQòŽL‘‰]iW;m¨øó½c°q²ÒÇ}£4!-•B’ŸÃâ( ‰b+¼’tµeñ<') “ ³S"¦?øfÍ©±¤o H&©œb;Ùn…†Ž?‡xM±#ѤK©yÍ·)ÜïJÂ|n¼eC|GS”­#ˆî¤÷OÖ¦¥¡¨;çµ ±H‡MÁ˜«%€B?Ÿ¢´ÇtQ?ÿ~yšã9]aƒVÏá±m,àFu´Êå(Ó£ò'dJ$sfMÍÞ l8 ˜&1ˆ¦`€²”­úœÅ6èŤ” ìÁÆ~:€“ÆÐ-É"‹~eÁœÛ§Éæ…¨.³‚ª²ë(æ%HeýbâÄ¡ ´d;ÉXݛꪕÂÕ•J¶tŽ Éc?œÇÐb6EÙ6Zºõ÷)ÄÓváBã`2F¡m*ƨφa>MNÍ+Äì¥Àlºô¢>Å2Bgˆ{9ç´þ¸®ÅÓq8lœz¦Ü•åŸ<²i?›0ÇõÕÆ¥ç8ÄTès â¸ø†«FñdŒ›Z‘sh3)@CˆÁLîx˜"†ZŒ»_κHM (è‹ñPÐ6Ÿ‡ÄO6}L M¤äÿ¦á^;ž¡ü &¾xŽÄkÒÛ̈l–C'YVÀ&`J8çÿÆLE˜Y¥Su³¶-[ú@Vé9Þ,Oö·˜‡ð£Hð9³3. ‡¤_Š×ZNALôÙ”¯Bû* ªu…cjTU²™†¹MX'E ¦ @­ðPª› Z&ëOgqÉœã·ï‡úî< à9øélÖñ_¥÷ƒT÷›¹Tû>Ì¥«¹´ôxÚ¤x9Ivá¼ KôøÐ Sœrâ˜K™*å¡/ä·^¤nºËŠÜ¥ŽøIâ9 FãNn®_¥}\H´b2ýsn|ž„Âìé]îÓe‘6¹dH€h=`jМ0`›o’äÒ©í,l@;Lr&oá¯ØIù0R–ÒX,†4ü”ú¹'ܧj#ÛÔSžÚÝr3_ 9åá45ÖÆÁ²G¯UzâAi MͲön ºçséÓÒ š%„lY øå#³ô,¸…£ôSó Z»KTA_ˆ…çñ÷lE™LñÀKs –”Á”iá1ˆä÷¢DÀÝçËK©;}jy¿ä¹$ì• šó$º„ÊûY ¤Òøy´Í’Ëy)Ý“$<¿—¬Ð'§TL(æìï|g¨â’=Àq‘&×Þô1ïu)Ñ$:Ò×{¯t6®Äh²ÙÛÒºýúÇÂîàÈíç¤Õ³dß±ìרÛý¦rÅÓ 1ñëÿÐÍ/½ÎÒ:rlŒ `ÿPk?R:â ¶/2¥–’C„¶K‘V:åÑrh< |~>ƒ=sÂÓg‘ðªMt`c/z´MÐ4çÆ ½Az…®¿3½mÂëlLQq¬ƒf{`ÚŽE™ ²÷Æ‚ÅtC”>EE{(k—)+—S,†û9~PÙ}`>‡AO>O^Š{α§Bkza»}Nšõ¤˜ž 'Zª­ÏËòÆ*¥ŒÿQäÇ1‚T ÜUU#&,ÄO-UÃõv}ôÜâ²Òû v÷9г¼s5èOöÙºq{Ü<OGa\¾RðCvotßÔ±7_sÌwÁÀ¢QÖƒ¶Ø|¼”"øB.—®žgx½ôbÏþù²çdÀh9³iËŒãó±+Z[_Œb´Iý¼N[RAuÙ¯UîØu ;è¤ã pþ›F—¨Q:(â_Y€OãN.æ÷iExš]¸Kú5µðÑô(•¸³‡²ç¡9ãÙSUÞ^aâ€w»Ñž4Fo6gí¥Ü~Z©Ò +]Щ}ÒÔÇ36øõÁØþ6bñ݇læ"ÛäØnŒ0S€íãk X¶¡?C·÷ï.Ž·³Ø¾`ÂŽDÎîZˆhwËPò±30’C‹ÝM”ÀW  Dþ”—‚ÏÂÝ2lÍ”…_ð&ãÌÊÅ黤ò¤×tbÄý?kÚÞhUàp;lÎó‰õŒ²x·6Ç£Z¶÷é2"×§“Œo+„­oq÷ *¿ÐùŸQêžÙk„[ãíË£÷©…޶©æ&qÛ> 6ÊIÝñ!3%hñ‹˜*Ï;PÒ6KÃîÐ!­¤M æ¯èÍ-¿°Ñ°Ÿ”ɽÔ—ÎwüTBMV—÷j¾Á0{`{f¿´Ë í¡¡}{­Êtᥠ¶ã‰Y&'\Ÿ{;ˆ[1úXaëŒ#:‰½—Á°ÚoÖËÛ Ø$=&‰ÀY ŒåL³’¨Ý>¾vŸIҵŸéðµ~Ö§ñ 鲦¸¹RÛÝÕì#óòå"MÑ -õ¶ôV ÊüübRÿ´`{ôz*Y¼Ø?ÀÇoNçÛ¾þ±¤Qæô©V0FSG° ËBÝ!½o?í‡Cÿy6'>ùÒ;”̆oSQÈÅW9Ù–í8> stream xœ%R PSWýŸ@òÙÜjj­ö'HtÔ²Ô¥J]ª‚,¢q…¾$(0€ `’ ‹¡(›l¢E*‚ AÅeÄbE­U)Õº´ƒÕÚŠ÷3O;ýèÜ™;÷¾yïÞsÎ;4emEÑ4mãç<{¸˜ÌO ù‰Vüg"H9äc"p°Þ?ÑæÖÜ5£Fâ¦Q”ˆ¦“Órý´±ÉñšHµN¾Á}¶»JHr¯irOwwù‚h.^£RÆÈý•:5­Ô Í6yˆV¥átÉïŸÌQët±¾3f$%%MWFoŸ®œ7¦ÆQŸPã©O){)eMER'iºÍj´•Y 2YûX÷ð9#†æ$²:Jß{‰w^Šø¿ð–´°Ž‰HßB UhD#`Õ-V8¼*Ý^âÿNë4Ü„>¸ 7¾»x¸ÿnù)¡´p‹Œ ð†@X¾©+ã¦~™ªFX&¾Ädª ñÒ3?ih”´1¢Ø¯—$“V.®†îü®ÃÌÛÉ6Èpb׆‰Ïï{ ]B<†óÙgœMk%NPrD6"ûE2“Ÿ*%ÿ‘öT¡5Î=Šv4N3á‰A*øÓRKz”@œ­¨5Ö”öœ‚*¦,#/G¯‡½,—îŸö êâÕ3öéALìÚ)#I ¤*ÉÍ+)b[L–ªa}“ƘX­)ØëA™±icpN,ƒ…õÛ.Ì76B5Ó´½fk‚&}ã”o‡SpÄK…6S_Ù ÅΨpö=NÞþXÏëºú>ÒØ%  ÀÒ\sî½æî†Îî À!hÓ7nß™— fkMbCysQ{'w™8’¯ˆ'q"*²m]ÐåEûñúcì5ËKp®$Yc;±±nÁ2­ÒAÁôd: ïɻ矼>×”®:"kÜ’«„á ·U¥R'‡¼·yB%o(l^8(²áŸK‹Š /·€©'{%q@\ö%çë ÅúbF)æH‚ÍIq^YIwyIaÁŸ¹eÀ`–X¹.44b±'ÓRÉçÀ¬ú~ÏA œ+e+$€‹[ÐêòuæûAù |sUÄ/ÀwÒNµÀEæ_"9Mh2jò"×÷6wIJN›W‚Cp|ŽA9:ÞA;¤Ï-md‰â•4¼*½V°ëµ¾†û÷û#æÏ$â̓ ²Ø™_IqÆœæçb!t¼¯‹ÚÓÝ¥íé ¤ÌMÆúW½¹qŒwP bÒ"> oJaEö|M`TP`¸/d@hjï/;µÂVƤDfm bt…:œƒ®èŒ*ÜKìëºN­Q±þŠôU €àrEç†v¥9î7h…^cÇ#†x-•ª€ÛÙ}ÜÐ — 7¿±åDYycC¯ ™+ŸpïÀÙ.²¬µW…ƒ-Eý‡Ïfendstream endobj 140 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 6255 >> stream xœ¥X TSW·¾1äæ:‹zÔÞk[µÎužë<"( ŽÌs€„ SH8 ó<%Ì£ ¢ˆŠNX³k«¶mµ¶¿µ¯=qºþwBпö­÷Ö#ÅYçÜsÎÞûÛßþöåfý‡C®±Ù±c±á¿)ú±ý¸~ú¸±(DôO9ˆqÁ ³ÔqSÃõëÍaãPè:Œàr8a‘‰kü¡žîÂñN³æÏrÆfŸ½xñÂéãçÌšµxü*_×@Oçƒ~ãm =\} ñÀgüvgOWah÷#Ë<„BÁ’Ï?‹Å3úÍôt_nØeúx±§Ðcü6× ×À`W—ñëýý„ã·ôuß}×™Ý×øû DB×Àñ6þ.®~AX­ò[í¿{`OÀºÀõA¢`ñÁÍ!‡¬CÃ\¶¸º¹oõØæ¹}‡·½ï”©ŽÓ¦ï1sÿç³$³ç„Ï7ÁÂEŸ,^2aéÄe“¾ølùd‚ø„°%>%ìˆ%Äb+±”ØFL"¶Ÿ;{b ±“ØE8«‰éÄnb 1ƒØC¬%‰uÄçÄzb±‘˜Cl"æVÄaM, lˆ-Äb ±ŒD &–Cˆ¡ÄJbaN8ÉÄ>b$A£ˆÑ„aIp‰1ÄX‚GŒ#Hâ#‚O0E°Db3aF„?söp ú íÒïw#÷¨Ù4³x3=OÉ{E Èü¹üKÔRêtÿý5ýß HðóÀÍ›-”<èÁÍC¶ ¹:T0ôê0Á0­ù6ó£æÿ5î‚ SÙÏP# p,ÿqÅÚýŽnÛ²ø°8-¼©å\ÐÁBlœ'ô¡á°¿ â͘Œ†¡a¯¦B3höê5Æ g4‹^m{ÿyçõ/oß¹f3g¶íêÕl÷}õ"-Šð[ôÍ´šÌ©Äæøcs>6^µ hX?îL)Hy“-4÷»JiÊ@mqU¯/Ô$ü]à¡ A|IÀûH 1E*n0x(J«ZN“žêàêCôé\Pî-Šô”0ÂÂ}åv€B£CÑFØ}- ¯óÛWG :Î(X9ü‰" P³ÿ'À)ß¾ý®è© +d“KA @q¡Á4¨…Ó߇_©ãBH÷‰©Yí{4ô  ÷õ+8œÿ™9 óó`ë#’ýþ.u_h ЇÒW®´^½}eü9VW¯uùæÓëÌv,ÃîtÓ7ѹ dP B fÐÒS&÷`WðC€°ÁpI¦ >êè Œ–‚XméV Ô |CÖ¦§aâ‚b77 aV£|¾ÉžëZN£àvéÚ¸HìÃxW¹hvaß‘§cø þa2$ï:ž“Ã"Ç>x]n °#¹ ¾¥wìùbéšÍ·ž½¸«}ÐѼÜÖhô×ÂÝÝŽ®kÇ®[h8œt!Æ›¿ê¹]ˆ++Ü eöd¯UùµòtO¦«¿ ë•]"?ÓHÏMüÑdâ:”Í7܆Ñ8Ÿ(„Öô››ßA‚It«ˆÉT±&¿¢0²eÑ6ë {G¶Úx23mû5j[Ú'½ L–"nOjº¾œéà(]#>c5,£á¨[5 ºÀ¸X5Œ”0¸ άéy›Fp¶é@²7;ïia†–«_¥ÿ¸è¸ȘxƵpÃÁZ#忳)(KÎ ®ˆ{+);ü(ì¦|ü<¦mqÖ\31êÙþ€Â>³³øR ¨ÉÍI­HcÎx\jŒÜ%%?mõ©ÊeK“gäLÙ” ¨²šŠ/=EJFå_Þ7'â ùðVÍÓtÝ^éûÑp®‰ÃÐÜoÈž ˆ™¥‹øÝÖ0ÿIÉOïyÜýîv»®.DIÄ ïFáè,Â,¾ ´•°}É喙`€ZcF)1BöC r@.Ð᯳½ô_Ò% êS þB"è‚Aä‡)†|oc/åë-éîÀý…èÝÈ…Ë#=—ƒÊjñÿ>ŸDθð°®)¹ª™IòUƒ@uüÑÇià[-§D/àêWb'V’¹ÆilÈ'–‘vÔòÊú q@ŸÄ 1Å=Ë™¯–… dÕS½›ç飸z'¼yE fÛîð 6m}†Ü‹ŽóÈÃå’‹ò*éùÃynÀ–J¶F¹E8¤ÈÝð8ïLŸƒ}Z*ØËè»T×"Œ!Ëf˜‘ß^üR­ÌÁ¥3Ñ?ß&E”o›q ›]R)£OgkÐrÎëºKÅrXOeû¿wXéWZ’Wrš©H,é€ztÒk ‹–*…˜B­¸mó:«mcJ<Û@- zŒ‘HƒAj»ê6 „ ØYì¶”ݡڦÖ7Gà0¥©:=kçÂ*øŽ†SáV^ƒ¦Ç³ ^ôò®,ÚÒy0]ÃïÁD“‹5]¢`ÓèWSœ‚áHò9äÁq(–å×3ÿÐ&!ðeM|tÒ'ðšúÀuà{g–²g®ÿ‘WÒ¤&è6‘‡& h6Ϲd¾?Å}©ÇˆâýÇœá ç8_×Â~½Ul™þÆßÝH±‘©ÔÌ?V54Â쟫Öï:w߈SöB,/6ÙRß%r7ôƒŒ$þæÌÌA!ÌzÑ]§ÄZ}©–Ó¬3fF>¨Éª4UN*(¢°fcI†á›G¤„çf“Øí`šjá??Ê3NŒaS)>pDz¹8#RTÙÉ©™ —ÂÎ 5<+Á± É’¥Çãg+1FáGè7 ¥")$€á2©ŸÈÙ/*P‘Zh¡¨ Ì”hˆÀ¹úÀ¹;m_~WiÒMwuÐçG\§!‡ÖHÓEá@$cb¤a×jÁúÛÏÎVÿGæç$€$V­P&(e‰žåÑy€*W«ËLNhÕ4v.òód8~ZýK® 1­:XÍß ÿ¤s²qNdöH€N£p4I€2ÅGZÔd ªG¼3ºöª©>º¢t~_,éÆf·`M'E…ÎÅ;q}áN›†ÌÑÐçS!ÑÒœ__Ïú€°ãÌ_¨lEÛï[²r½Ý­gÚ›÷ÛÏì²7¡âE; ÄÙ·K‡o "@­ýG–&úð°ÞSIæìËwÌw‚4Ò[ä¸j@ ö\ò«W–ðMYDôÝÎ3 o ;vª‡rèëp0术`–ŠKàVZ]!eõ¢ÑéqZ ûm2 Ç´`oà€«Dkéç9¯;0iÊêcÍ 5ÇÎ&u«gVóG·R¿¨ƒùj‹KçMŠ"QpŽõºÚ¢ÎoLë°Li7ÁI ®@6È&X€šÑqÚäk€2›I839)6-*`#ÐLhOOGd—bN—ÀÝôÓY—J ŸNPœ¹-ݬMеñ Ü÷Ì"&3*œ Á‡âälö}S×C‰ïëàæ¿Wô.Ñÿ¿µ‹ÒÚ÷(ÈáX߬Ö׃ésµUgÁê»åOPmøßérÄÙd (I¨ (Â|-À«À»Ð»RR¨/˯5ñ2X¯6Vá. §Z¯ƒY 3""¢Ö¯øp"…†ÕÑë¡Ëmò‡&»}û]lgöRУ_9P†á­Õ_¦+„ÅþþB¡¿±°¢¢¸¸‚A¶h”©-Ū ‹/“{ÚLPþ>$»ÙÛ¸»kïpõ[ß7n²ßƾÉ.1˜³bÙ|ûJ·ŒHöØþª˜añ·%‰àº¸ÐxR»l_uÈ9=OÀì­8|,¡0!/AíÑ£mÝ-n‹Ò³«R™“ÞÚ¨³¸€Q÷¾^#kò9ʺœrÊtO N^‘´/Ó½œ ZOºù¹3“°BËOÈ3i\#s•é ¹áË…çpIƒæò£?Йw‰ú``íhz#wð1w˜ÃT„f¼º>º`–IlÔ’h:ú”1¸ÉD§»DŽ}ÈcVŸ®ìùð>Édž·AT‚2mïÓÓBGáÎB¥üؼ¾êÓÂÔ’T¢çäë];wZŸ{ËÀç•üXõ’Dæ³Þ¼é|ÍMÜoPzØy=-èäQ]"4ªÏøYûGõú‰s¶’†/W¿^ ‹4›ívbI!'í1ä½ä~‡+Åi/ãvE ŽEmüÞW=ÏMïàZþÓc'›ÔÙá6 ãËüzðz÷ÿ´_n‘æÝ–ËXƒÍû^¦ÁÍðW›^í¹÷E{Ö q"¹$#&=–…óŽ!| V[‰ö9¯ØsÈÉG d”,%¸¼øéåg™óOò;Á]CUy®ÑÁ}•øžÂe_UªÔ‚r* Ôyx¹@i¥ d&\HU¨dÀR,•„D&GD³¿oÿx›07ƒq–!¹uzrbb2‰ëŠÀ+ °”º:P—Vž U”2…Q'åa%R•Af«só Õái±‰¬({ù±èäß/Yga)•BJóIJ¸øø8C,ißűô3¼àyןÆ~0¼¸ g‘é%“{²nâ{¥ÉŽ0Њ4ÍM}7Öů5pé¸ ›%zÀ…硆† ™ÙÝ@$‹È’™ Ñ͸E2ˆE,? ÿëÚ²XˆGdpmÀ‹³c9àt„“¹°FEljB]Âdñ¡±@DIsC kÞž‡f—Ýš\}½ÜÊ ©©J¥ª ìðÊ»ñ=p´êCXSÿ‹¦ö[õ~jp.êgqõ ñåM7¿IöÞÔVã½Fpá£ktƒO¹·›ÀÇÛ­ZPÓP^]c¸ÀÔ÷›LýÇ=0¦„jÎeýt®~ß»AtZP‚Tª8$74HÇ ¯þ\-—`…c),””¤d&›Hõ´Öâ 0á–‰p42C¼Ih ²B[~E£¡ä½c ƒ¼Pý… öä8ñÖO÷îÝšŠ»‹‰6¨ÿݗІoOêBg‚ÖíUkÀiPHÁy|¬§áh•eL×ÐÀŠ€ÝìV_°„PÏýÈRAE |¼ËÒY8&Ýsª½×|[D7XÊ”Új¥œEcT #ÝH¤öWŒ–|úÍž&—EÄ2>ëœÎñÒ‘øRâÌÈ’¦£u1Óõùœ>ï “M,2ÇH"š;÷#LÑqo~IËcbb°°10+¿7†¸²G" $"ÏŸ„f¥Å õ÷n‚_(8pòWhê¿téçšè\uY~•Fž—ÌäŸ8Q†ëË׺½ó×ÙÛ:{}Èuûi,XO@K•Q®¬®(eØÒDp”v»±LqÒºj_Ñ&U B±> iØW Ü º}ö\ôÝî {ü\Ñhi¤Ì‚Ò›ª²3ìå*ЊãÒ xX wi9÷ìö^u¿7ŠW©÷7lݽsÆŽlëÜL¸ÄÍ=B"ðŠvÔ²Ók\lª¯)gޏõmÔ­ò»-¸Tø+±¬Â;\<€çшüÚËê¶ÄT m…ãhÉÜL§SçK*‹ëÀª?‰ïî­Œõ§³§ªýÄ~þî€rºPÛ”VÔr¢;‰w> stream xœÅ]Y9rü(Ïè7Wc¶r“79 c!³>kxµ‚× Ë0JêžÖÌH]šni¤þ÷ŽàÁ$««×zP*‹É#Ç©Ÿ.ÖE\¬ø'ÿýæý³_¿p7÷ÏÖ‹›g?=ñÇ‹ü×›÷ÿðq–`ô/¿{–¾B©Åzwa[”ŸÞ?û¯ÝçËýºÈÕgwo/×E é¤Û]ãkå•Rzw¯¥õR| ¯àl±.&X o.¥]Œ×º€r±jw|}¹7z±«Ó»°7»zëýîMDvÓ‡A¨Ý÷ÐBŒÞݧ·z»CnÂîçKé`Ϋ/ÓŒ=ðÞ  ¼»ã]úÐI|  %åî!Žáõªv.÷ðÖ®ÐñuÎï^í ÅV+½aÃÐÁq%F®aw›èbDdößbèݱ<Ã,ÞaoÎ+/t×ÇÉeìî&.@i'IÅîx ¯•sy+êœ^]’Éþ*¯×zØ\ØŒ@Wö–ŒsÀŬ«SiYH‘ÖÔF2®Þ `ìFÿëËÿ~ù¯ÏÔê³`­—WÀH_Úº?ÄYJ%dZ«—j] ¥Ì›¸lg§o?ÆÆADª¯âpû2Þ^àmxˆÃ¾!Œ äEháý–EzN&üö)Ä„á`bV›À6ò–´¸‰³ùõ »R³b‘"ˆBŒÃ¥XV¹ÂîÝã“ðÁîþ§>µwoêÓ¡>½¼»«OÀ—õñ2O…‹»ær«*SùHXƒìááפ…0 ¸j»Jc]õMáê ¹—·m{«>@г¯vÜ:$½‘…´‘× ÎæDEt‡\•Üâ¦9­ã ÃëÔuœ4a2J’9œ‘|ÐYò3ŸîQo…µ°t¿«ÂÙe5uW¯*éõéS}z=ØÁëá)±(år·»åòåÀÝB/ZÚŽ»‡“õ+ÒaÂŽ”ÚLf¼‚×ZEuüâAù&¶>fÞ,*(Ú㩉L2ÙœSx _ª,çQ½%Ù ZY¦ºiRÆÀ³îó¤ÀÔnÓ³=õ"=vúòðzqb…­g\•ýdÚy- YãÔPTv-õ2Îá‡ïÛ2}OÌy}“º^¥ŽªS‡juÉ äEm‰Šºí>ég_¸Ê¼T -¨Š§ÄX²Ò•@k© [†Ô×sh ÌŠÌB«¡.š…ªu“vQÎK¦jÙ$R°|ZìÐB&m‚É/Vû8Žu4H´º¤éÞ/ƒ§ï~;ÐÛëÓ÷ípû½í€õ|™ˆ­ÖŒ·¤æRVÙüs¢òàwØÂo‘ص1•°Éà‚ÅURø8Žh¥íd%nºdPë´\G†½nÖþŠLd¹Ü; @%èÝ¿àk±Jïlb ´0&ô²•Yv"[IöÂÚEXÙ)U¤'تàçØÊlßáê]XЇјÕ×T޽N£hÓ¹+ƒÏmjúÐsG !ÙtÊwtŽQ‰„à È=Èj¨÷ÖîÃ÷ñ@Xtdpnw©ÖÅ™XçÛü¼º3ÖûêŽ,øßk˜šVB‡Ѽ´æìA3³Œµ»LqFì¾nÜôujáeewä’cR­€*‚T ~“ÚÌ ã —Ú%"*£ã¥#rv@fû¹Bå+fª+ƒá‚˜Ðã©‘îC–óJ2Ýñéþôÿ¤ûú7MùˆŸ— V&yP(`H?"Ñ„·Åúì>µE8ÊÝ $0ú;•Ô® BÑÏ_bgZ¦ËÈp…ÈÔnÛ.ê >ä‰5NúC‘Œ ¿öEz 6LÑ×G:=¢ïÒw‰˜µ¤ô êU§%?5f͸À· €‚׫Üíãkád’Ϭ<金ÌÊ‹Þý]¡'®tÿâúÐú#™š±FOŠªPH‡€9 -‚"”¨£Ó=T•lo‡ƒö èšÂÈ7O ËVXÐ jX‰ß½ÄÙ•…c¾ûu¢–²î,lKI4ÆL‘V¶Š­¤nslMhß„VM•}&Zõ>Ï€õ¬-þŽ~;W×t±cjCoFš½è¨äiDu ì!µkžÑ˜‰¨m<µæñßÕ§÷õé0h"+cß6F?dÛek‚¥?P/ðM|/ M×|¯´Žžõ£Ñ}Ñè[QÕA·õ……/£‰6N;¼AÌ´ )ÀbÐîõØý¹ùÔ¨Þ;„8N‰N8e¹opĨ·Dœâû´V}R©Fjlyíw%Äù"Ë&X ì %QÖtÑ¿aÌŠá¼NJ’³Ö,›wèàå¾UaÑÚw®Ü7•G¿™j%˜`áÑcv‚½ÝX‚Œ£ÙþÅà+wÇÃ÷é­ršÅ/2(Êz¹ª÷Ã1Åø©X<ÝÌEªÄÎô»‘¹íp—ú°Þl˜fr”W†{w¼É›·ôNÑ X€sZìÒ\„XݘŽ<ź|ËÔd ¿ÇpË1Í0Åüv¢‹¯S8qÖ©·Ød÷oÏÿ€S÷Äî[œHÀñŸHëLj‘B¿äyUÌ›ÁBæ‡ÌE’"਺(¥'â%MìÒÏ Ý ’w],ÅÛãNÁ“}„,§!HL‘ áºacßæ@RÙ7 0g押«A±O!šÂÙ‰áËiF¢@Ž›0313DìÊMêoE©šyl¼Ÿù‹†o‰h•O§B¥ºSî¸ã ª³úÇšžøœHѻ͜Ýc§Â$¥&i}Ü6ìÓI.…Õ‚”ðóWAÀ° "áähíÐ.DCGV‘?X¬d,ãqüÐJŽÔ˜×ÔÛPüzYµì¼Z”°u†1 ïØÞ÷Zâ¢'Bøë½¸b"-Î9¢„,¿\Ë’Z i¾eˆ¥A|Ñ•ÿçk¢ˆJŽcŠ˜6h†¼d챕êqKþ’g–·:2Ñt®Ñ¬¤Lô­¿j¬Íº+ÑMòŒO"Õ™˜IX-ôhxœ¨eÝæ‘¹¡r¼ÍyİCä…Ð+úè€GjBº zïKoS|BUÖÍ&|XÔ¤ *Æài,ô‚ ›€Êֺܹƒå5ÌYÝ8ST}oò¯Ss-ô/¦œªåù;½â0@Ç#AÝ4ü¡CÜ:̯¿ùõx—>sÂðcãVn]|j@cÆP¤˜ /ËPˆ,ç;Z»«Xì_ñÃ8KÕâvCzÕÆ8”É Ógõ%q!„ Ž¥-jož&ÈA8«ŸÔY ï¢ë&nááuæ]Öœ05% —³wÍ2Úu7Ášœ,ɲ2|IdÞ­Èê"vÁ-ôNN`V2U‰DÏýÀó Ã}¯è 4'G鯀¢iíf¬‚) Þ‹ÔT`ÄU;Uõ}F}Ò}êOKC‘Z)|mœìð^¡_W *L9õ[ÈjÉ—[\SbšˆË1éaºF­NF¾‘W 0¥ø€V=à`O¸pvˆ¤Ö!%Ö BÍ`Õ@)àHçŒÄt)ó–Nª-Ç*L†¶àQAãçi@뢿Xá~ˆ¦âdXûÖòÄ^Õº¹!j¦¡›7iNÞAz¦EÛÕÍ‚ª‚èû¬Z)xg‘±ÚÛ²zq»"(«{H/c^à÷kÞ?Âãt:$vT4rƒkä>ý ž™w~ë¢gf=¦Ú€à}K+z¨ºBÔ)±Žà>}ÜÒ·mN66BÏ\ÿ¾²¯$Zˆy&‘ÙGýŒ¸Ò \ªú€¡­P‰°L¼d|ÐÓ5ÛäB×ôࣶƒP´+xˆ3gÅ6Ô¼y;D£T I<¾ÕiÒ(=åPÌÑ;5$Q­?g`êÓø–ü~[¨jsB-Ù² GÓwÜß µ•¡ÞTDÐÄYQ½à#ÀÈk7Laÿˆ¿‡Ù:1ð û5qÈsÇ–{œ!=Ï‹¢æ4vަMlÞ¯ûØLžÊ/VV‘†‰ÞN$±§œ*lÌûꮽn…à’Z-c}ÅŸ†ÓÈ⤌<­ÜZ ©_*4Èc‰Tb" îãÌnJéDìëÇ.²»ZŒºR_‡T ÿXû71‹UêzãgÊõ8·¼=°”QÝrë+Ö^Ùs\ñ#I,O-+‚&<4A£We¹aã(æ×ĘҴSn“¤lZ»?ÅAØ01ÄÓm}R€‰-¼<¤¼ñfcáKflᬼÊêQ,FÈz¼ÊC„'Ä@KoœA“ÍÞÇ0(ñ>Ԕī]þJɪ‚a,p%Ê<›0Qàüv-Æ…¶ì7;° ‡ØkøDYu±Ç5ÖuÆ/uŒKKP_ ŒÓ‹‰ù}Z†CW; GÆ7qweÚ‹\˜‹ÁK•QK¯9ùº]”›Ÿ‘œ`ÁäšËH@€À…LúÛŠàrÙì‚Íi‹\@kbåî[l˜§I!­Û8’õ«w­¯qvMÅÈuON»Ç$*ýû&f ¢¥ÄHŒUGʬ1rHC¶4Ír ûöµ—it|ÝôiüSa´ñ$ OÀdžA†k8ª;Ę›ÂŒôCúÐyžô¤±µI$Ž,}@ÜV¾W†¤ªi›‹:œª)Ò×ËNkÚ[ ¹ÒèPžÁ€|Î>X9/ʆÏL¬ÀzØDÆ÷XÂíTQ6R¤Ni–åU:k¿91NH„XŽÙ[ážö'Ÿ1 t$ùpº©“˜ÅÄ&Þ§!•3• Ú.«LÐ’±ìË8V~ˆ¶í”ä^+뽞§U£Õx¼~sxú*`ƒéÉ]¦yÄ«Šn—ûŠkÎÇWàÙ„ 1ã3HÝBéq/§AFT޽©Íw*Þj‘q;ÖiS„1émR gðå8—$€¥¹!¥ÜE(·eœ”ËÉч•ê$üÑ/„ÒØMAÐ žó:¤G¬,ŸÄ§ÿ–a’|š„SŽ¥oïb¹L—85Áq­Éd7O¨Å¼š¨ŸEQh¶PEååfÒ­iúǤMš™°Y…¦Rç ­€&ã”hÝMQÊÉ™)»O-ô4Ô•(#ëóˆsSôdëâ„0>39Ñ8¶‡ìjK¡£YàÌNŠ\4ÑMp:NFh;uxK£ ‚霉K°¹TùÕ˜—P‹œ¾ jãý–'µR—xzÅ{5­o§¤Ã]v&±™gÂÓóÄùä")bMènŽŽ½ÐòòÜDK-v]¹Dˆ¥ŒEñ?¤=QûÍ¥¬@Hë ¿²S¹ I$¤úT„ækçI84ÕlOhDANÕH ³ã(œqg°(W¶£[wXV Sc§¿Jap,ÈNO¹>0Iâ‘/Â,Ä”$–„ŠtRG¶«èË_ñ5Ø ;:’Û$Jñ1}é;y<¦×Á2Ä{$ˆ—×Öá;„…k4^lAÞEãÌB ¬3'8J*4î(4! ?ÎÓŒK™ç¥9.òc1n±$¡QþrTùºrî‘ïLáò}9€˜s¤®ÿ#½c­‚Œ…ô'T(âvÍO›iôT {G¨1ÓÈJ¯¼r>ó>OvSQ[ÞN YHš1× *ËM¿‚!4žQäIÆ«²>Ë;üôpW;’ö£çþÜ ?QKïõ‘ºµ„‹¹—VBz-q.ÛÑØ‡ÔÖ·ØUódÇv‡Òû¾L]ó¼$«ç§÷8ÄË!e,Û^€Æ‹#$c7ÊíçÑâ‡ô©ËÇýS—³Lp,ŽÄp­š™Ême>ÖåJr”ê¬Ê…al»N¯« ÃLêîvLŒ2QW¨¡œ°»?§˜uÈEÿ*úùWÃí§Ê‘œ˜ºÂô‚Ü’:Ý~qHæøaŽb‚»¤MUšŒHWEU¦&9Ÿ£NzTŒ#Y ÷ES ãu³Ö´¿SAæ?‹6-'ÊÞÒ Š_¹2ÒQÇ=¸«ËQèkV}Oös·­2)M€‹ ½ ôª˜#©ýž™ÚM8; evìטY>Ð÷˜îLj·ót?=»]¦Õ;íkRçƒÃöÌFúÅXíìt-/ò!1Aç ŒaØ\j±— Øl㑺ÚE¸èЧ&]“HJwŒ¶î¢7‰>†ÝjèTGÃ~1T#À4Íy—F±ü|¿ž…Àh–LÅö*¸­!ŒŠŒ°:£âàê˜zÞƒs·8XfîÿÈ*E_X>›ÃêC?‡¡(zh‰%løEËÆ‘äv®\¼½’,sÛüÜ0ù²\E9ØâN^-¶Ñ$*’´šžÙõL,žA­S­Û"%Ö­vY]3^3¿ókùN’evÀ‰”Ó‚»INc"´ÊôTÖ>_FÀoðzÄÌH:¸ÚÙç3¹o9ñ¬q§ÄFyçÃEkw¦ÔØ&3 R“g0½æ·ŠÌ _ &5"ç¾Ô€;(ù2Æ·ãÐHi¹­õ(È©´ zôHø'ZŠVZÿz¬˜§G0 «B€72ï› åö¿Ô›|©£í.›{ü²¼.jÕAffÈU‰ûi>­çP'ÐÃÚðk­4T4¿k‘<¿ÌË_y™5QÆiÉ`ߞݽæFb‡÷TI¥©‘Ø}=°²QåNŹy¬bÞ™GÞ™YVëUgš®™?Žoh°‹vJŸW•Ž· p¼ÚÓušÞbõ}'ŒÜx®Cø3© Lõ Q{°ÇuušTR[û¬ªRæ7#e¹—ˆ¿V0R”^œ:Dõ¸®GO b s‡? bжE{lÎÒx4Õ2Sy¹êkl$Úæ h)`¯…ýιî„ÆKö^i{êLöèB݉Î=RH@‚2Nc7ñÔ—©À'‡ëªR-—Ù\côqBx €F¥uÖß 5Ä^J5kƒ5L'˜Sò¦a`Ï Ä—±+o‚¦b®WJñ Ê+i¨ãí[’ +WRbÐç2Q7y´‰v$äÔcÏÄk¬¶3Ÿš‚ùγò ‘‹h ì#ÎÝDxmÆ“ý¶µçíïã¾\Qá•òíŒiü£» ŽÊc»[ŒÏc»«êõ538½¡ÕÔôpZ=Ùò|3¶<:$8Î,ÏŸc R©uZ”‚×µâ kJuåö*ºæY²ûj¯u B‹DWºÐ@1Í™lÊý6~ߨÛB-a-øð“¨žö«xRXO‰PÑ‹qXOYX^é³ÿÀÂ,ŠY•J«5Ññ&—Eð4ÌèTKhF«w@„©å¡Ù[2›yéÌ0üGæãjxÝë‰ +q Á6h\n\Ø\L…>óŨ~Ye ¯ªÏ,ËÕ>6¥#¿jêtùPNÉÇ 3ÄèB³ÍÁªIÉOw`žgìÞ®“#¤ +ÐÆ1‚¸O}aæ!-wúü"áTUÖ»ÚÙ E߯•,gù eá³l?Á—›..«¯½ 8¹3zS´Œ5VW¹½Iã¡êåðÉj<£ð¸†îs©DJýòhÈäJU~Mêè/»ƒªå¸ù‡ïb–‹]²t"!OËè'giªt¢À;"üF˜ÓLòm2X’efEôŸS á]— ™™›M\ŽêBn)°c¬¨˜±Ë´L¦ ðåÏšèî¿ óF%Ì_Ò—˜AêlzZˬÎc’¶'Þu*9íãˆZˆ§âŒÐÒuŃeåó«ùh$;1Û‚Á²/ÓDb«a7É$‘RóˆÔëù†Iˆá:9ŸtÌê00Ð DÜ?µb-‰oùðo_>û#€4ðÕnîáéÎ/PŒendstream endobj 142 0 obj << /Filter /FlateDecode /Length 5036 >> stream xœå\ko\GrýNäG °vè¯úýXï" Þxc/ËŠóA2_bDÎpÉ‘eyÿ|Nu÷íê;s‡ÃKM«Ð¬ÛªSÕUÕÝó÷™èäLÐåßÓ›ƒç/üìòþ@Ì.þ~ ÓgåŸÓ›ÙW/Á å,vÑyf//ò—r&µî\ð3g}§-þtsðjþz~(:…SÁΗ·‡G¢sBYëç+üAªdœ_m´f~CZ*-äüäíJˆ`Õüõáá‘‘Uºù·Üܲ >]€]ÑXq~yr•˜¬·r¾©½ÛüXŒêzü@ŸŽ·à0RZ¡Ûy*×9éþž&‚VüŸù ƒ4óû< Q:­¬_ò[ï<Í/kã|‘;qÚÎßg™xc:uZ;?à>+‹Á0mßËÜ,„B'uÈXyZ8}W[Oò‡Ö*o¨oúPGµ6WžIÃB“jtÖs—µ€Lzîûy+)7> Aú(³ÔÔ$,t k´ÞÖ4ùÓË;Ð:tÚíåÙöò¿Žú¶#)FaéO¯ ©4­µ„ µè‚œÿ|hm'†¹#0x-e«^ÂKì)i!:£“¤ÐºóCxµÒLº´â¦Ç_ `Ô¥HÓE+ÕÚl3€µ†¯1TG2Z^dÚÉu‘FµÕ iYÒÚ‡„2úPG’ÿAÙÌ¸í¤…Ö-Cä>i”i×± êh"Dˆ¿’­Í—ÕqkYÍ—­8¯¹³Ä⺫,â”»uq’QIˆD åÙ|J¶¥naÝØb»Ø¦‹Ûqî•“æ­Â ƒ9µ†Nk£™Ø(‡°9Ëë·XÐP~©ÔE~‰ÖF2x¢Ñn ®ä±´•Æ eÙ8ˆg U*¢O™ÍâU/Tm„úŽ•4˜OÂeêád'œìsW#ŽÁ᫤åh:#<9_²d¤póË%-EK?m vo¨ nGRq0LIž£ ¿‘ÊÇÌêÑAãOZ§¹e¸“7ãò(ùM™Kë¾tõ5¾¯u°íYçÝôÐDkIÎeŒ–¡Û]~ø ÄÆG“öû·ÕI~  yÄ–$ƒ¼ñ“QöîÝ âÊî+3dï%}æ+ÝØÞ&Ófþ¦qcÙ‘ÛÇ##;Çyêÿë—ßä÷îˆXÏ GïÅ0"v0«fNÈNzMñ\QèR:a{„":Î`rè×ä»5ð³®8ÙF­÷^’ …ðz`ò¤B­ &µîfRgrþ]jR•-h$l¥¸±Ç­YÒšŸ¿rùz,}ÈÝ÷aö«ù?Áˆ:¡ÃüO‡G0Š@TI$2ްçÜzÇä“—L¾eruxÉu@*t&æ"ý_¢9v‚.42nÄà/Aš¾‡BÓŸ5X¼ËQD,ƒ`f~Â$Fˆ4–ÓôUßúŸÜºäÖ;&ß1ü¨2„ƒHI#©†$ò—:…E¥|À‹t®DýS@ Ó¿ÓugýQ 7HÇiJй—R1; J+à¨"Œô=yeH5¦l´o=erÅ Wܺd2ïøÏ_hÕBÈX„„Æö,¼±Àýd@ʆT‡„›(—4E¤IQ9ŒRùmõ­ Ã‚É æ½öPÈ3œs+AÓJБJ@¡ÃÔâüW&_NVœTe(ÎÃÊ>ÕXì¼MŠ›ël¬CIKH ¡—4œ¿‡ßÕ‚*e•! =v Á ÙTO~9y†‚þჷ»×8ô/uÆ`v¢S˜ÌàLÞÆÁ’“mIA†˜ŒkàLrëŠÉ¦õ„ÉëQ†_™$¿¿-DŠ“°!K¨Áþäœ0¹b†ú™.sÈÞN•±ótS2Mÿä¡{Îê ³ MÌl,¦88ÒÖ¬òÀí×+&bò—ÉŠÔpØPʾwª¤©¤È¹+\”õ¬Ç€2ð]BhÁí+@½‚û•ì7·1Þ·Š^HI9˜ÜÑŠp'hæ5yCùrþ,3œñg«agðû: FNŒrÞ/Ó&¥bªñÔÖ™=äšÀÊèv“5ò¬_"'%:}ëOÔŠ 0ê´ýÚ_ onýØòNÆEOÀÚzkÈk(ÜF·U­Î†½¦ŸBn×p#þ*ómªdý­®+˜[‹*{ ɘý$ò¢Kà1j›T+¥‡ä¨.êœÚ¢JÌüG´XЏi”Z¶k³°Ó¶íS­,³OU¨’È4õÞ \QŒ›s?fà{T®ŸÎ@†"¿ÕéR²Òj´U‘2n×äñ4MïA“RÚ”]L+¶˜&D¬Ð•†ê0Ù4¿†g…|µÕJ“š6< 6²/‡­ã¶¹“|´7+Âj³þKòÖ1z—öÝ’]\q+y“wã®ER­’¶êóÁ._¶÷÷uC¿pÝ b”âP6˜Ê‚%S8©Ôj2.ðU'ìÞ-\à&áb±…ßB'«b˜‰(ªØš PË J¥Ze!ÏG“I™±®y(…ê}èê 8 KéªÃ²T§§Ç³&R!ÖímÛ+¶e¨ ê}¶­CÛò´‘¤À&m)§P‚öœdDÜ8&Kà}WXqxä¤OþfŠX¡é`7„ê<¥ÞI¨Ö²PÅÒ´„“Ú_*÷ª¨[Gž7‹UR%Ukk<ÈÑU“C½ý:oS´¬¢I1Ê u,átj½gòjØZxWà ¹`’"•à ”% _WŸKG©%N˜ÿm̺€xÕX×9+çž•“"Rj¦‚ò¨ÍÑ)c {h̹B 2î÷Ÿ2¨©‰W®°ôÝ/G=£‘¨+§—`Œ§ÚFØ[ ^A xï:ä]¾Wé|^È訆á’Á&QõÅ–{&Ï™¼aòv´FóqÔ,u/dkó¹Ð¶ UÁ™^Q1ÎP]`;\q#‚ßô"zTrT¡Ä/YkN¹ ƣ߲rÖ­Ëʪ*«ì_²UÛ-;)@"¯iƯT™Ç2‹÷§‡tpÞ·.™¼ß¶ KÀÂ!aÃTi•*tTÓOÅNÄ]Ö¥p­Ä]iƒP:ahK „¹a¹ÄÒ㘣«A®anØe:µ-æJôtßÄQHæàTÞnK¬Þ¤É%lÆîåcméÓn$`ÖR@GÌ.¦²ò3î‚þœÎ¤Gþv¼åÓaîP“úÝo'[@Ûí/t±H´E¯t¾›+8·ÿÏÑîBûM Xí±ØVü¬ ÎuÑÙñ®´:²A¾`òlòÒèHÍèÒ*R¶Îš½¯_Q½Ýl¬ßo µéµÿ€#wn´oÚw í³Ú5ø?èéøµ÷y_Œæ[4îž8ݹœn“[wë-.ΪƕÍÁ Ÿÿ{›§Ã@YòàÔxV)®~ŸVjU©Á”Er)>ÜŒ×âÃBžçÓ%¡Õüwaž2Ã’ÉŸG;£žŠ8 §GŽÒèbïù¤ŒWvŸNùó#÷“&.ý㕵ˆ"B)}ª»uŽÊêš ×‰€ ¹Vž~Çä÷|D8}™€Û{ZœÖà6ü`œ:?!Y³ÿjˆ +!å&ø£•Æo¶EÊ*½bý1óvˆ…zgx Ät¤ª6ÛF ,™†£#J“Ê.ó•Pmcƒ…# ÎPþfØ^¬ƒmÝG×yQû«'§~þuS d[O"oeÌáßê¡äTô ƒž÷½ËëH!XAzDчwùWó¯&£m—þö…6΋¶¢-†¤ùß¶5ô©:ñ‘îâíÓ¢ moAR1©äo$×¼‘ÜlËðüΪTš`‘Í%DOj•ôŠ\PmôÛ–7~`kzýšé¯7=Rƨ!Y[º\§ž"kGUß½ÃßÑ›è×ÓgG^xú쾸¡%6ª¹¸‘¯‰}Í·5îùnØŠ[› a7Lž .„õä9“5(tSƒÂ ]ºäÁ.|]ëŒOfN>ðçê>O—<®Æîzœög?S5cÝâØ;pdcÔrìçËŽ‘øW›/ iÛa=vטMrG\ëÓöêéí«®Ëù꺬Ý⺌%¿±Ëu5µ©Þu)]]—¶Õw¡u1E˜tÍu×&d릿v­?!=I'zÂnÛî,ù¹Ç´¯Úç- ýŽ…~6¨?=ÄÖª~‚1=¢;ì3WŪqŒòìÓ8Ò±•I¨IwñÂÿeã0åþ?¢*:Úˆý[‚Çô²§Äu'ð§ƒ]Kª°ï;Ÿ¤§V˜ãuµ‹¾û¸·º ÷èQÕ†éí(~Qä¡·¼Ê¹çŸørÉG7Üz;zîyÎqËýhÜrÅ 7mU*¥y1º’Çut%=EI&Ý ?áÖ{n}Ï­wÜzέ7£­ n]µýNŪ"t=å¶Ê–kíäá˜)ëÖ¥öñPM{C™È^¢&1½§îOi.8¡^mys@« é:i=_¨ïËŸ &O™aÅ­WL.™azæ-©âéÆß¡0¥‚¶yqҷЋ“‡4€žF¶F¥bº ."=6Ì ø.9 ô_žS8åᜀ;•&AF/©³†e‘_ÈE…Ôá’βóA‹JÌ>8Èú÷‡Gð·]§ý*}'Ôéå8¤f‡ãpßô”ÁšŽÞF~›žð¡ÑêöÃëÊ{“ßøi­c˰È]¨çÿÔÌ”¿kWE/Í|ô ê.'‚®µïì¯é·”ñ)ó©K¥÷TÞ Ghÿþ¦™Ãä µŠ"trç‡PÁfL¨l Ò·´“Rù¶Z(gä§!yý³Gv¶ÞúPLr£õS&Ù·NEJí6A¸Þ¨Ð£ K» ¢/%û ]C±åâÔQÊÒb¾­”ʯ¡Üù›2ki½WÙ·KúɧìüݘKNTž‚93„,›~6!á ¤l뉜Һ>ɇF[ŸdÖ©ª)ÏÙ±_! E·Ž~îˆXfý#Ïú—¡h©Xü±:åɨ”ÐÖz_nW9òªèÕÒÏqÕ'hŸÁKõvù?³ÇÌWÒHï Š>¦ß¿•ôàÞ­ïƒOȶ9)Ñ þ5åEó³z˳ý@"àÒ~Ç»àwü ðóô$ØîÛ)Ò¯u˜˜ïî„Q§Ô{WË„nTån¨r¬Q¨ôS&TJBÝ!LÙ2ÕjÓ %v'ùG.¼mw­ª|ò?RÎn”—T"®-TCØZjr3 t„Ùx@á}˜Qâk‚ãär½6ÿbáïgGª ÑHÎò•£Z/¡êLÐRùI¿ë³í‘35b©Ölÿëos¡&Ç TAR.¿{é[o™ü=3<çÖ†üÐ’µõ¡©u }Ã,ÃrÓoÇ{Y6ô³¼kšï· zÊìËÁ\˜~Î,·ƒÚ T–³¦ùýø@«-ójjÇß&Œëqy½ih8GÇa>l[h;Ýóq1>ßÊ>:ÝeþE?é:øÍ~W¸gÞn Ïµ²áfw×™¶ôƒ]ÿÒÐ‰Ý ÐËÅÉÒܲŸ3Ë›æç }Ë,wMó²¡Ï˜å}Ó|ÚÐ+f¹ ”~Ú‹R,úõ¦#ºœHg}ößÛÆ9ÛÑ ·.™¼5´{&«½bÞÆToGÜzÙpe8ݘNAAUÕ3-–wÚØ,ÝífÂé¿Û~k×»ml1ÞãEÓ|5Þãj0ÝQcšŒþÆËO=âЈ¤ÅÎ%c's ‘#lýGÅŽ4ÅcÊcã‰ô«biãÉ¿†Æbè·À¾?øoá’l$endstream endobj 143 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 4073 >> stream xœ•X XS×¶>1äxPО Õ{B‹­RD{ŸÚ:£u¨³VQYH!@ D dØ™ÂLÂ( T´Vï}ÕV¾Þ*jk[§Þ^[Ÿ}lk÷ñÛöûÞN¢$÷~Þ{¿KH>’½³öZÿú×Zÿ†Gø x<žÿòõ[ÖmÝ:+Êõæn2›2‚û?åq¿=Z+0ð@ø•M¡M€aý8(Oðy<¥ºb¹8#O’šœ" Ù5'*¿Ì ™µ`Á¼ˆÙQQ B– %©ñq¢õqÒ”Daœ¿IÙ"ŽOM”湿²(E*ÍX8sfnnndœ0+R,I^â²’›*M Ùœ˜•(ÉILY%IC6Ä CžºùôåbaF¶4Q²^œ(±T$^ž±R’%Í^“'Ë‹_/OHLz+9esêÖ´ôí»gDÄDFÍšöÒâiJl$Þ"^$6áÄb+±ØNL'vˈ]ÄÛÄ "’ØM¬$V«‰YD4±†xXKÌ!Öë‰yÄb>±ˆ ÆKˆqD 1˜Hø$Áñ*Æ¿Éã xky§F,ñ%)ÿ¶ß&¿Û‚JÁ#2$1rEPiÔwþküOŽš<êæèŒ€´ǘÆ|:vÁ؇㮎~|öø#ã>88aú„o&*'þy"äšÇrÍÀù‹“ÓÄãfq·hCkKT)Y àJzìÊ"™à€¸T³ÉšvÐÓ™ÄìÑ_pY&È! MÔjðr­êÈé,zI×ô× –·S†4€"(ÙòÜ[öŽÁ ƒ?ÛÓ³zǾqŒÆ2`¡\;˜e®³=® ;ÑÁÛ>–fûZjƒ¯YÛÚ[Ož>îÔ±r™¨D_ W³Øµ~æä}=»/ñ9¬ ¡ß’«¯¢@€Æ#Q7¢¿ãàX8†1¨ÅÐÑûœ×~»sûæÇ'¶®xuIØ,—•“+wò¾Äñ|Î}F̆2`¤jÖäÊK‹U%L©Z%×”¤öÄÖïŠDSÑ´1Ÿ!›ý+ç´©ëDE2 U³ˆ?Cž¨¹;ï>€‹ð±pÄÀÅì0#[hÈ>d¯²:Ì >Iœp¦ƽ—ùpÙIºYÒ-:(8@8ú½q-jsL¦,“m5 Ök;0Xù’g‚Ã`: dªzEsI;hÆšŸÊjï8ð .ݱ³fÏe=‰ÌvÂ}N<hø<©/ÕæRJb×TwXªMLýc%0cp…¶1-]§Œ-aÐód/Ü'€ZR›]’4TVcim—±ºÅÌØ.›ê€ ïvç÷±¿×Å6rác¥ Å›`Ž%ûÁRqÊXmVÊ… P§”2ª•Ôø„f°kóœô\/Ka‹¦žX§’–îºïM¶æ¯oÜy ñšJ@9펳‹AáŒèuJ%k¬1·<åá=þ:9Ìè„N>ÍÍ¥›·Îñ¼¸Å;|ÿ]>{¬ä£ƒ –ÒÿBá1»ª®¨]W+B +.Ú®+(\J(¹­°¡Ád=ÔÄœH8ì8‹¯þî½#¹íÂ&6­YlYlÛU±¹ôP-Ç!yÇ®00úÒ¢„c mÖ~s[ù{ÀDU–4H¥jE‰–ñ8wÉùs¾ùq˜#i¸È9z¬¹å“¡._¡eòg ¢¼4¹E& •Vt 0xáEñÅŸ¯|rÙ…rÎAµDÃ(ßX¡)Ô:p¨Ö Œ¦zöé‘§ÄÕ̽GC§se¸"?â%ÕÏnR!OÛðbô¢ËŠÆb+*Œ_/YÛŽû›²ÈßÛ[H4}º~*èñzàÙà±é Ï¢{Ö”FЂ›@¨ë¦}ßÎx©—ÈÒ ÖjK5e ? ä^êÝ| X{“S ê½´Ûéž¾Jñ<´(HºG´I™BéIí™XX®)+j”ƒ|@m|š¨fÖEàg›ýœ ¤)½r]ùnÛëÖTs¦õ€)§·×6Pë¦àTsm«¬,mTk.ÈgÐ÷¤kÔéú¢¢]¸™‹:µËX~®‚Fò1…>,7»H·ÊšÅéR±$ÓžãèlkëdЫ4šàƒÆ)/]§‘ïÃkì=ª…úOâ'õ¤+ '“ønÔɪÕAn) õl5Õbµ‰µÐ!c-ƒÜÀmñQ}K½ fXÂѸdoÃrËå‘‚£^lQ¤w²ôh#šñ!üÖ7ˆµÞ`»ÏÚîsV¤÷¬XÒh35—¿wï“ ûh¦ïm Žòb”áƒÂä *šíå*®q·`yÁê›>óp¼ËN±ëÅvŽ`4íG@UÖè“‹ôZÜ,ãMð¬ýUת¯Ú®• +¨£p[~cËþxUSøNZ•H@êÁ ©¦=Û%­Ó<±·€ÖÕ$s¼Õr÷ßï…ç0<õOÓ½ÈkÄN¾ŒnÇ£0z€̆NPù§€0pDë,ýL{^_•ŒKL òŠU QBÁN<œ åÖ_L_¿0ß0|ª@¹ÁFuy³²Èípv½ºVÏæ‰ºD}¢>ì×%èöêÝm ØGÉ@^_E°W3–Šo ¢ê0eÈ#A¾i«!Ù˜dr=w úA/°6Yê(”wŒ6Œ˜&®=vûˆ£›ï|†£›úh £¼ÙGÑ®¢Ñ—¦#ê÷7ƒ´ù86gŠÂhþ„»øsÓÁ%M¼»ÜV>ü?ØJÃi¤­ôõ¥¸”ﲆ,¸»ƒë• 9ÂRÑA#A3hY˜RRú€…SÈ,ŠÇµè‚å5yö.Kg¥Ñ}qeíp äÁ$ʇ‡ ´xÃn¥\­ÖËÔ —*¬ÊµŸ€~Ÿ?xW<°7639-Ù‘Ó]nãnæ£Ú`5XðÛS"Ñ>eN"ÞïaåS#Ñ$–*Àâá®çì |x÷Ý%mOIM& ›3ú{{»Ž0ÃwùûWà_âsÜs4¤ß„¼—ÐüØŒâPÐ_¦þÿ'ípƒjÑWôš„;?Ãu?ﮞ3 MDëÃ=½“ë|ÐÄã"\ÿð8\ST›#/Q©5ŒB³t¹Z¡ÏÑ!¥²Ê‡š»˜Uç "|JÞäèsŸ´ <öáį¡mˆÏ†ûhHÝ9s|I}ûúU,bB!¿ ’&ys»½¥­RmÓX˜–£§Ž\Ôǧ½1 ùÏ•ãL7 í Ui1P{Xp¬ ÀÚj¬´åT«Ì¢Pfƒ=:ºµÃÐ!>C›x—¸>ÇÀyôM/+Þ"a¸à}ïéd÷oF«± ”7(ês3ÕÙ…& ='ÿg ¼ä9OÆ¡pÁ6ï=dZˆ®D§ÅÁÙ õmeö*3' ~zÖ ø#ý“Û„›Ïó/ÀÐ P{†]àÁ |üA~ò¹þGãèòP†¯Íùu²œbEa ó8ø÷ÕÅJP´Áyµò¦ºª*[…!´S8»mÇ’9+û>wòö fj8]\Ôà8}èx]9Mµ-mo;›ãè £q›Þ^8Uoê‘s'oÝb¦¾D7¶}Ø;X[m)¶§Åä¹Èw Ýâ]çD|Έ®êÅÈ%ºŠð2ßw·+ù7P]çÂ4ݵ‚HU*^9‚W\ÎØ¡å³p Ÿ#¸ Z½1eÛªDµ¶ äSÕ²†N8é+8ù‹·ËåIyéÒôöÜ+3–å—'ð'ˆÿ)évdendstream endobj 144 0 obj << /Filter /FlateDecode /Length 5036 >> stream xœÍ\]sc7r}Wmå7°jËʶ®ñý‘dÆ©u6±ã*Ï*O^W…#jdÅ9KrÆ3Iå¿§»\4.ï¥HJ›rùA0„Ûº§O7 ùëLtr&ð¿üóæñâ«×~v·½]ôƉ8Ûolî.¤Ö® ~欟i£CçõLŠØ9#g›Û‹·bvwñ× IâgùÇÍãìëk˜Âù™ébÐÎÌ®ß^¤¹åL*ÙE…R}§m˜]?^ü8——¢3Z[ãçâò§ëïã,Àb„“ôµ²´$\/a¼º¼’ÂtBøù——W^CSº¹Ã^ ½‘z]è„2ó7—WÁcËÍ?Õæ¦6×µù+HÐ8­™ÿ›äêù5 €Ôü544t;ÿÚücù—KZý¯/~8V¹FËNØ3´Ûê§h×ÇN«b]§£IÚý•aqÿTvr]UeæËº“ûÚ\”‘w°;&svþ—9|J•" ®KóŒMkpØäK»”¶àErÏ¥Ô¨Kÿ¡ŠG½>¨#Y#Ú&ýÇŸ÷­eùå@©¹IjU VߨU=K­JÊÎOœÔ~ª“úÅu/ugACÝ›)Ý»`cQþǪ—wEm›ÚªôÑÁÜÉ8¹Í£`¨1óWˆØmæŸU ø¼‚Ägh8¢Jò¹nks[¦ÝåõÙ/8NVöðó{çm£ÆõFøP[+.MA²Ö_zïkó¦6wíg¹‰îÖBÓÚ2>íj} w¤%ï½EU™|ÀàJÑ…0_ázÑ×Ð-Ot*£êL<Ý_,þñs5sà…VgøgÚX׿‡VµYŸL‰‹Ú\ªööä͆ º`^á`€eg}FãwÿÎþî)g/hõYýüó*ô³[wuâUi¿ªƒ¯úÑ_Ô5þp² ¼×zi|²Atn?4¸“Wç{éxmŠqi}E ÂEŒó?U5°ZRþŽ™g^iÊÀssS&[6„fr¶êmÜGØlyÄŸ˜ë }$5_‚®à5HèÂÁˆ&ã$À/ciî†HK½µ¹Ž¥æý|¨wu²cX«»øâqÕÚ¡r?®†#8Í׿)?:UŸÆ˜Nw¦š—Äzø™ãÎ/£¾ñPbÜyVµy7:ྠL´6„òd‚=µ¦Ôƒ|–›<Ôæ‡&à—ÏPDé!Š’'H_·'‘!÷©ÆÑ Ñ“µvvîmŽ“j˜ž²>ù¢8#Á˜ -¥Aªiy¿¯ºdt1¸í(Å»:×Éì*Õ9•î÷îÑAÊ,Vµ¹¬nF½îÃè,{¾¯<” XÕæM³¥͆^éÁêÁÓgxO{«Í( S•{ïj“v ]`Ç?c„ÓµÆ^MIÛ‡ÑÄ«G§m 80{ôgÀ¾”¶ÓgðqOSp$• ÖtA¹Êó¦U+›Ú{Ûh¥ ØU&I~ûWšÿÃÉ›°<ÿòÜ }pjïØOæí¹ã-3méÛU+K iôŽåøƒ$t$˜å`úE%"ƒ2ä/«:Û4ÝÏøÎY×ãÎÒÁC#dþ¡,ùÅ#» à•"¼t’e O 1ì%YÏóЧ)NDá!û­yÅ)vr»§ÚÚCp0ç$ÔÃø©÷‰‚9y}´8tEû\ž`<Î5Î IˆT£€h®¡s]›µ‰e%Mì÷µwW›„èó‚KΜýçÚD·`ãɤ$ÓÅèØ)ƒ€‹ÐgÈ€Lš-7µ‰£¿:Cʽ›ö³<`\تØq¹§ZÜ:ßÉsøÃé ê »ç‘îˆ<íÓóó´ôù“±ðT]X¨='Þ#µz§Ë€ICŘùÿ^^ÿ×IKÒÀ…s‚Çaó4áýžùÆÓlm; ö8‚ŒWôœ¤úX9ã»ÚÜŒra˜VZô‘t3ƒ—4À¢ð2B* ŽH¶±#én¬Þ˜Ytï5 q>#Ž+Pšz¹b©Å,!€X8ŸÏã¿QÕºg©VªÐ½ã>CåH|ÜËåDÎtÀrsoG=eƒZ˜G7:¸¯ûâ•z€Ð$ûÎ¨Êø~üæäNÖ†C»½8ÃÖ^u*ê=œ¼ÏmùLÄ›B‘Ô€ˆÞ¢#d…üÔ$b €§×¿TÖÇØäCm>¶t3]ÕÞ·µy_0 »Qº¹AÄŸ¹­‡÷`8žD–"ê‰`¡£@Öòr?óZ7‰Yù‡ªÓojîU뻦$\šøb£-äª?ñƒØ¯ëŒC‰lúåÊõ9$h-̨ΡŠÓ0?,R?šá¨kg÷NÆ8ÓGª]ÿr ½¹é¾¯ù×ör,A{S›¬¢€××4ÞÊNâ&EåËs^錛ó.ðWsž=50CUC­Ö€­h=_½†hy·½Ðˆå0øWXá¿ðOc/ Vêmì{.þ|p/@H=¬EÛìo“Q®Ò³¹rù]òEõd‚up·Ø€(€&ˆfµÁÚfÐ ÛZD`ÔXû‹v b§¦á¨§ÄÐa“¥ køR:ppÀ<ðq!ÁøíLYº‘Xkÿbæßb§Nºrè?|èÇ>ÒКŽ|À*‰PþŽ­´~—÷…jW„ï‚ðV"záw"x¶& ] ß9‘8E/b“vâ£wti_Æ(¤,‡1ÁxcšîfüÆD ÉœoÆ,ë´|µëªíÓö6féóC¨{•ÃüMÚT´‘ž¨€æ”µÁÁÇ‹[X2ƒoQ¥F"Ýå­<â®DPsö{ò´·±¿o}VíÎòb¾qW°+Ë—³Hï~~q¥¼ƒ úÙ•BI•¾„p¡ñºLdg÷ÄqÂ)2ˆvAI9_Цጡ'Þý| gÒ oñáoqXÕ9_Ó·Ah¹XÇ7o Ö»Ló;z@M©0VgÕšä•ZJá?\ ´B'{ÒÓÁX%b3šu¯pnâ}]é"ýµ°>åzUEcÁ‹Üo½B$‘t4ìÕQcêÖ´Éÿñ¬€Cy.›ÏÏÛ·lž~PÕ6µ ¥°ÉR¦YÔ[w¶ )¨_•Ló„ }”Ù˜Ñh‡Û)Þ£aó—’»"»Ç÷ð.YB´Ëe% |ŸÇ9®Jüý•Öø…œ]I|MŠ >\ƒ¯T´j]èç4C>s›†ˆbÿ^WÓ˜Ž©`ñ¦HÄÛK°¸jäžÀöÏ÷ŒKVÚJ“¬³ÃqöóDà•àñžùo^o.Ž[¡ ~e޽ɋ‹­¬±ïaã˜HÍL¥Û¢‰;„ (RÁ—ÍrÌ‹–íœàp¡Þñ÷&ýæ’J½WRZ›¾µí[»¾õmßZô­‡¾õ8òÛUßz=Š`NuΛ>ÑèÒ W˜ÿkŠ/*x*ˆ£2ÓR¬”F δ†ÍËU¼FûFD-~гÿ‚èNëì¾ÀL†~Ž • 1ð“ï¨;(TžJû ËÞ3ðJ‡ÂÞoW’FLc3MMZÕpj‚‰2pÕÄœueZ¨Î”´âm˜A(t}éíúÜ<ZŸ6®‘V@–" MmÏÉ»(w·Ï–þ(`¦,‚OóÇç„ Ø–¼yüãœn/Ô:@}Ëå xe´§ÂÔ£ # g]ï™û¯*,ócÖ…!cò¡¸‘«xÙ˳ ØâDÃn`Sa~µ‡(Ѳ•~Ó,Jð2±;J'‘ :,CBN˜Óâ)nÚ/市cCR$öÑðøÁr.b½Iß>5iKz’r…¾gÄðÀLd]”QÁxÕ»^¯¢4Lù¸„Û$3®G*Ÿ8ÜQ£eÇÙò>â—`ÃE",í*QqhÇ@ä ò9 ˆC$ÜéñÛäsœiLäÇãiGäð:EMnl$pGHɘRã>e“G&x8ÜɳŠädGp—X`¾/øp7Þ+Ђ˜FØ]J³S6œ%·éÄÕ*µR%ÕDé ÿR0Lxe£—þôí³rÐmfTöÂW>`¢®Àiäг0)ƒýþgS(îyRÞ=…^O–qþ>-#¨À#B†v’í©¸ÑæÔýÜà²V«kv<¯\%q6â_ |l5]Ü”¹ðo6Í Z½ iì ¯‰bF$„fáÊH/ÊpB ·eš¶hÈ 8UÄ vPn¬‘i2-Jˆ8~ì>Ôì…-š§¼xv$Î*¼ó’=óAÊA:Ð-hõ˜ ã _Í@w“=7OÓ’æ\ïCMœQyˆD<ÄŸÆu€ïj 8£Â“‹¾õзG~»ê[GqÆ/y%€‘?Œ`§Ð–…~ Å*ΓD¿¤JíM_A’¯lÇO·h•%Œxà·õ¼ñ³×xã*‘ 'íüw•õ0u\Ï Õâ(;•¯ØŲ'+‹Ÿ_%SÆt°«™„P ÓÛˆ¹}FUIYˆ#Òsy?¦” is¶Wàñªb*àƒNÕ¬_Šçl Æ„¶@¶©0+¶C¶ ³GßÞP±ì@Ñ«JºfFkËHÏÞð+üSÊñ›‹65ž81$ zþÏŒ7|QÝø‹B%2<°,¹Ü¦ÑFE^ÏY¯ÚëŸRšà‡ê¸W&ŸÁMÌ‹oŸ¤›¿až—–ßöAà&ÆŠÿMk ¸¾ãI K_¦ˆ"P˜ ÿ1ºÏx-oÐôÀÓ¶× Ml¢±!©·ÿŽÅÛ² ‡Á®®|Y‰ÒDl*Ì.ʬ<´‰ ¦‡¤ Þ@ð[n- ÞÕ>ër¢©°ô#ü3š¤-(5É©D¼oô±Cû6‚¢œLéúJo“O'S`È&§Ä÷ÛËôÏÛô^Aÿx’¾7¹LRF§‘6îÄŸã`LsÚ:E㳩A¸DÉø–sÜ'ý Fët Ó랆`òÀ–ꇻ}p{yy¾|dåÓ7Õ×[Û$SÜEߘ~ô€EîÞ3¯¡µd"°ÏkÖ¸Ðbº©N°›^äI¤y1LWÛ”–ÛptVíY޾¯é{‡\ V%^‘5wÏÕ}Ûªöݱ%j#Qá^ÐuSß?@‡^Š‹‹øOß×ä«Ìóx÷! _yAÕ|fÁé;ºœ`Æì\O½ÃZ¦ñ^™w¬Üq“4‚M˜ UÄ·M-8±³+M/¢©Ê2}^ñÕkmðûÿÚ:Þendstream endobj 145 0 obj << /Filter /FlateDecode /Length 3026 >> stream xœí[YÇ~ç¯  esÜ÷Ä+@±‘´Þ0d=¬÷ÒFÚûÔáùïùªg†Õ=3äî”à¶Ô¬¾ª¾ºº{~ŠJNýkþž\M¾9ôÓ‹û‰˜^L~Èôã´ùsr5}v)§±ŠÎ«0=:ŸÔ=åTj]¹à§ÎúJ[üt5y5û8W®òÑšÙÙ|¡­´³ëùBTN8¥%šEe£3:qˆJ­AŸÖÜN¨Ù›aî;jöRZëòæj¾0AaÊÙw5ƒ¥~—`ÑÒ:>Ì•¯”¡ÏX›–Tϧg÷sšNYëgï멽Á'ÔÏFïhAÚ¸Ê)5;®I!ñ3-Á*gïÒÄAifÇ4šuA9‹Ñn¤3`ÿš:,ÓÏ–àû ¶Ýkš°X¹ÐluyÇËlÎ+´{áCÀújk•7ÏM³a–ÎÃgí¿ÌPžØÒY½OÁq’V ¤({viÖΛ&59킉µ~kž£U{hIA§¢R.íf7Wó×G™h)+瀯£S é°wÔPãJ£™rYÇ©û¢é¿ÀŸè„­‡iÖd¥÷8Í®­ö³›4½Gˆv¡µª¢ÔI"+‘ŸÖí6ÊbZÒV>‰A*5ÜΉCyå‰ÕI–0B±ß÷Ù4¤5©b1ßÜ5 *ãQp%ÓĶ€Æ´~ÝFØÅ@½7ùÖ³ö\§oxQ7dëÑ «ƒÖ[™, Ó[¯Ê½¤Ñló‡Ô¤²%ZJxç=Wk½HJ~~4y9©}ÐÝX§¥C¬”™:2´èÉgÍÜüè혣‡‹¦RJãU<^½q"Nûÿé*òŸÚB¤jª†ƒÐS¦¦wg“sL¬$¹g]`þˆE~—u…ëÃÕÄxOF¼jy7ù‘¹”ýj)b…×lÚ3úÌ«)ü¾Â^¥Å°ä÷ë=KÚ3:ÄiÀ…“Ô!B…Q©Ö˜ÿ:_DY -<™mKÂyFRi2¥†k&á‚ÀŠ¢™ý ¤©-ó…w d€cYD NxÐ÷<ê5·ž0¹d†Kn½aÝ`Þ´ûÙÏ3Ðk&¾ð¡JÎð†É{føyŽf¨PÀéþ+ƒëã FÑMÉZS+&¡$À6Ì´ƒ:…­ŒŠIzHXZPÀx£Î·•%]Ĥ-xä¤Î¦õªdhÈkæ=çÖK&ß1Ã’[ϘD"$\\¡€D ‘p` ç¬Ú÷…>s4 Kn} ?$þ“H̆PY+œèÆ+EVÞŽ×e¹jVºôž$bXSR3¥dàeƒ$?Od0 BhKž1yÊä%“'Lf²+»I¦@‰Õ"xhÄPðY‘ǃ­Ácˆè1´vuÍ$+¡£lÖ€M褩†üÀä1“wÝ]t®™ÌÆ=­HZœTû6J xÛd’vÈ$-¢Oô+“üÄæpÛúÇ;n;%ô'v G¹Ì»®' 𧌟'ddH·”Ìç:cò¾v9Z€6iÂŒë,ÞtŠ4¤²ÚÕ–pûåsû|Zwõ„»?åAŸ°SY2C]ÐW¼Æ—£u`‘<³w;Ié`‚±™Yã5Òˆ½;HK9ev.egì î™\2™ù“+ö2ÇñÞä¾g¬‚´ƒ?Ø"\<  ]'„¤ ¸ÆÏ¬¡õ3?®À[¤aŠÜsœ}Ï`Ü€í¢Ë Ä)Ë¢ZNw µ!ïÚÉN™3‡~w6¶ÉÜ’²ÙŽï3ëZRMŽV”²ÈØå>½Y‚­ •kNZžý®”0V>”T©nI²Qî+ÖW^6Þ^R5®5<ȱëžë&â)™ÖêÖe…C¶§êõ½ÌGÞ±+¹z(a¹dȲµkJšb/šÕé©nò¬í†ÉwL~(²¶¶ Ñ6Ã?$ÄtîÕâðYifYð©a`ßà1(0|=ðèÑë ~u‹0º9fØ]P“ú,¿/õ~&ß‹YÿOê{ŠôÀèÞe4¡ï£lZ]ÖWF¬ŽPºZ7ItǬ³û’ìŸp\”qÃpÆ­) –ɤ¡I1ÜF:ë‡0Éügr<î™Ó:l%úZåqU@)_ò ŽW±Î›Ö3&¯™aɹùÙ ”>ŒV®Åxbín,8ŒC õvФV@mÛ’e-¼HÖE8·6ýüéÁXÜä_qûâK×ä®y¶õQãþ;Ç'8 •6)I±s–MåçÞ“c‚ƒUîÝî-þjÕ3|ß~'åöÈôll-ÿv_Hz8«kJÈhoHƒ“·;ÚÓýææZ£œ¯d7ØáÀ½¦SOÓPÜ"r :‰)66Gë7LfÇð·åQjÓºd2ExĈàjÖ¾ø “V!“yMNš€t<ÈÛIN !ºÈŽœ³ãìôùž—ß'Êy·†ax°ìüz™;GúÙ¦ßX {mòÛîõaÝýÁ 6vëÂxJ€öí^ ç›À«ºµ_ï2¹´ ¦6Ù¿GžJ鈥«5§½+¦€jÝvË”½€Fp’&ôö©×í3zkZ7pºJÉʈÑÃÇèŠY{‰·9;F´…›…°4*t½ÛƒaH;™ýU‘Y¶är0ɼdòÝðÈT¤PŠÒZÅIY·g%’›³ÒV° e­6%9.ÖG,6¤êkLŒ¬hò÷JèJnìðÛ®ŸFëÿ¯öžÿ ¹R2ö€k+áʬXå?ÃBéjc“X»Úðé±+á̓ É]÷Ö Éý·Ñr7ˆ¥nÏ8hC °6ÃYB†­¿]½½>°?RMðw.DÇcY'óß;˜ªT”=0'óó#ðW³(4CþMÄø[ë`<®U §b{ǵ–Èzüx\ñ»¥¤QT">†]À|° ˜¥‹{³‚zÚçª_X|f0?"àÑ13EyRG“À¤3d)½ÙEãÁŒÑ«îÍÎÖ7J™ÊÐY6†iàÅáJÑ‘‚¢'› ]-)ßoÏ]ïð?òaý·| 9!=å\–w‰ó»#Kv¶¶õæ Ë1¹Å¦­¤[ƒ½CÊ€$ö 5\quåáF!I–Œ(ÉÄ)VŸ®¨ÓöÇŽT2ÉUÑëB®j'¹*Š÷VP­Àdèy}®_l”ÓuyèÜ7-çÇÌTÒ¼HeÓc^…ŠXtוï|¥èQ?—A„ýôBqëÿ^pyzP–§Ð1bÈß,4‰¢ÊCÆX‰Ë ×>SX1 o¶z+ð€Z$ê¥{zÎèµ­$âÅ´ÿŒtÝ]Óð3IÖ\«£Rs-yÇ ÍY:}´E¶DqœÞ{DWgK–î#ºIr£.Éyýx}ÉèÌV·ýk|…ЀQcåmì=@ý/“¬ÛI²¼a÷¶cgß#}P×8³Ãk/I{7û{­gI‡t+ã«öèú|Уߑj¡/© guÉr/ßP4Ád¯õbø=ðèO¤ƒ;ð{õ"Fw®§¬áô¶¼¼ü‰!ùŠsÓ˼þoòº¼ÖÈM(¤Bì-ßße÷‚ë?[ix¯¹µóÙJÿ×µŸ­HÒMh®ëîëîÇ~gÔ‡®ò´*¹Óyÿæû¦¸o9¿e™þ™Ë„žë‡â•_K>çsÅ×e‘Õ¬k Ÿa•«ä6—S7 OEý}ì­ò W™½gééû"z–±&KG¬FíÑšFùس%?”—êÙ‹°þUû/Lf/:èe§¡ÌÈhÍ,q •jáúŸl_ÚÁÃ!i¡ÏÐ1k´÷­&á¥òröVËtãWºÿæé×Å=¨ÿîê× endstream endobj 146 0 obj << /Filter /FlateDecode /Length 3123 >> stream xœíÉŽÇõNä#x šR¦TûbÇ "عh4%ŒÉšL<›Émÿ=ïUWóU5‹ä4Ù‚} cžŠ¯¶·/Õ¿L9SŽÿ¥¿7“§nz¹špœ¶h¡ ÎSF3B·œÍ ünÜÏ4÷ÙºËö .8k›»™Rr)›3é™ðÊ6 ˜çw£ Î^ƹÂÑ’­¢&­Á®¼/§)A‘.Ši ;piD+“[xÀ@&.Tóí`qø«Ì„uS VYY]Vb ,· ,¶‘³³ÿ 9’ Ò‚-›×&€Ù–ÕÄÉkωիRð6Á¡ÕôF‹<e—AÆÒèM$¬=Ë4ÿÊãAD¹íÃË’Zj€?þô©ШIÙ”VwÅJ`‚n  TàpÖ£ç>â fý8x½¡D@ó¬åha,ž–EU“­HëœâQÝ:.ààÔÀFpÐ'B  šhþ£¤ÉûæuuôMuô´5²ù4;±>ŠÖb ­Öl.Ð0€^#¾5¨ì÷dXÑØÃ¶À˜àÀam  ŽF¶±5YS‚9ëÖ²6'%º#%z¤ÑxM äZˆ7Ÿ$L$Ní!†Òur¬‘ˆÊèæÃX¡bÚø-êé¥ÎÕ³£È#Q¤¤S^Âê$PÇùtR‰}ß0¥“ìšQNµŽ:ùÎÇAÂÁ|¼ ŠÆÔSZòÑ·®| {/iô‘À‹ws]˜&n¬3%\U”ðÆV(Šs[%Q¼§Á9¡žW¦ã$Y°ðÁ”Šæ7^øÐGˆ+dÓ®s]˜À¤OÞAú$. « Ñr]´—Ñ®á)HíÙ Ãæi]|°WÆË ?0ê·C-C^‰ Æ]ß8' ´)œ2qb'ŠrãÊ( ”¸Ìb›ëêæS2À²Mh×þ%©C7‚ñ­iíjë ?ˆîl$‚Ð ö, ^1´.V°G;$‚N…áY<Øb‘—> nOzµ!}²*}ÀzÍ×–÷%]'§G:„µ«O£²¤ƒ‹Räšïpè.ì¶åD•¬ª¿œÅñ','«§Ó´ò°åTu9³ý²™N例ó|ˆEÚ©t²ôV&^÷îêLó…T{Aà’ÌÀ]‘D ´¦¥\¢³üºêâ$dþ‡¸èÝêçTÆl¨‹~‚º¼¢.|¯ºlY®®.b»ºXäXœ×ù`F ï\ôpX¬ôó–§$o»eÓj¦Bò–o~÷FÛpÁÔˆYE’B¸ˆ–nC í¤ð”$è»uL':6ó’õvbò Aˆ"„ÜEgɰ̶ßìÊÒìNg‰XeÏZ¡¦ZK¦mrŽŸžœ|öìd²ˆ=;™Àv2—Рʉ±$TzÉø!ÅÅÝ º¨»6B&¡~›„ZoBžÑý~(=š-¤étygÒ¨ÁÏ=RóëÀj£Åc¾_m<¢À–˜Ë—l´ìg4Χ:1^àŸH¦‚g–ÛjžÌ\&nw^wÒëÓ2JJ–`-Š´«R‰ÈP0¬`UóžJàTT¼- ã | „+½#3;y38§ã!„°¢h4[ì†Îˈ·<æ€7Õ€o^ ¯sßkÅL?ã9Z:Èj¹!õŒòm¿v¦ik¥Ôsëœ=JïdÛ çU®,ˆ™h§:SwQ5j·Õ >q±øïwy“?ÿ#E'¥ˆábœ¹+‡}¯ñZWX´6`¯œeÖQë*þŽŠ«ªl_Võ+ãÙœ8yEDº­Òë¶Œ¤6I‡Þ‰cx¢Z¦ÑŸ(ß[®“À»5ô‘Š-è¦ð¸"ù£vƒŸ{Û¢mÒí¶í^Œöº¥ÑŸÈk^l5nTÃÊÅu»9e¥frĪpÒZT±óÛ×Ú-‰Ò—:8{Eÿ]/(n UC“ܤžyaì¶l{$fýLl‰!EâÖpZ¡!PO½ μÛñΈ}½!‡ Z›õqî×Ð’„x^ q*Ü“*©CoRê!½íu–lLÛ^•£óHâ²3k¾×Þ˜!d íË*ÂU+4žÁÀ9 <nt-é¼ÛÐ’-‰!Fþz]K¾¨öž²Zò‡"’É)Ÿ·p… #$28·WŸI؇“I‚ïR[òº5˜,fGOaüõÆoÐrK SZœ÷¤*w.ÉâDŽï:¼Þõõf«¢«ÂoÖnÔÄî»Ü8{¥5_ËFJ>[ÿþ)Ϭ) ãe‡tÚ11zÛV¢p¹!þõ4ÄßJµ~ y?Ýî÷Ò-/Üf­¬.£Ç—6ÑN¥O î¼!ðžêV³-_N8,3ø¶“•Lì¿‹ç&]¹k¨£ÈZo›¸=G!±XÕvìÐ+év·žˆ£lضª—F—å´„P_ì–ÀÂüXY`O÷D=ùëöVÊ*>ˆ\{&>KU»à‡«‚szÐãŸÝÚa“²bC¶&ø™6¼©RHQ^¥å—Ö¿n´_ÞöFhk›ÉzXÆ8¦‚;è劈ŒFOš±ŸlÞàù–.cÙ?YVÛ#ÙWÙg<ËYí ¹wGdª"ö+F{n™žÊe˜>EŠÑ_à ©™áfƒEõŽ ·‹~ÍZéûb1÷bDĈÖ œÑô®-½ö8«|}ó§Jã7ùo&ÿ>Ìôendstream endobj 147 0 obj << /Filter /FlateDecode /Length 5902 >> stream xœÍ\[o\Gr~'Œü†÷!g`ó¸ï—xÀÖ DÎC$íÍÈCR\Ï…’²øïSUÝçtõ¹Œ4 ü r³§/U_]»O¿_ˆV.þ—ÿ½Øž}÷Ê/®ïÎD½q".ÆÄáúLjíÚàÎêØú…6:´^/´nCp~q¸<»‚”Ä‘tƒ„¾œ‰Å_Ù/l]XlÏŒ÷¶µ±oÙœ½†ž×gïÏ$-m‘ÿ¹Ø.þý Ž–¢ƒ]¼¹:Kë– L«à×ÎØVh¿x³=û­ùy)Z£µ2ÍÍòö(¬Ó²¹CZD¥ Í=þ’6X[uÚ!­ET:4×Ësmu«Bh,u÷Á)ÙüËòÜx?pÍ©ì¤y‰=Œ0Òêfó{!¥±Í&md³¥Ày‡{ˆ±ùŠÍ]~—WŠo.ñwAx+›Cú¾¹ ¾1 Éç[±%ßÁïB0ÁÒïzæÉñº:åSÍ7´ž <ŒÀéoóQ7ØÛ «|ÍÞjè)†þˆÍA£a'¸8éCð¨¬û–ÑJËFÞLPû¼f¹ ¶VÉÐ-XØÝòÞüÇ™ +kXoÖ£Ë4‚Ô¡tn©ó_Þœý×窋r  ºÖÀ3éKém4׌܂šÑ÷’$§~()bëŒLCS–&œ¬ÔGƒ…‚a28©Ï«å¹T²Q6ÿº<ÇÅDõïËó5á»'7…áE $šuØòu!…9á` ßüHhUÍ9L VA(×üóÉÌÆ€ˆŸÀ!¿0`³´3‡”mµ´0¬o=`8Ԩ囿XÚ`¬–x@a¤ŽwŒñ¡Rc:ôÚ;ø»Tͯ@¢ ¤k~@¸( öµLj>i=HJ"¤[Æ ÆuÐ4û:¤§q³4HÏEà,XŽ¿5¸\®Áé\ †¿.’þÛh¿ƒé¾ gmÐã;lEŒé=Îç›[T„5x3w$¬’6’]ëei]£¨Mw$n–v(ä¾²Ìá.Œ'ÊßF»Èß~‰†H£ºÖG™ekLÑì3NtÝ”Öíd‡òä8:ò^¢Ó?7ÖÁ+¶A9ºyf¬ÿ2‰õ—|-2—GÐÉå®0XT@*ΠkXŸÜá¾´^–qIòt¿ö×*pª(òPÁ®SÀ?&pÕ)à-ŠÔAcÇ­Ä¢_æ¸ÕÛ‘“íµu`ýÅS<Úq ƒË 1†Ý4†]𽯟öy/¿Øç½(ämENú<6^‘KŒ¸›ô#X‹&2·^•Ö‡Òº+äEép_ZoJë¾ú™4ZCTF¢6} i\^îM!¯ë]Ž÷~_ȇIOzSCJÓe®ÿZ|óJ?¼}¿£¤‚f†è@ ÂyGn‹Ú_–ÖC!o yQûºÀ˜ gþödpæ)qÇQ`A]µ)ÀK-š·µËÌ亃ÒcQ^d Æ¼IaХʤæ™Ü]•CJÞaWÈ×…<”¾ÀK¥Ð¢{Ì ¼W%Æì]ÌEiÝL q]ÈË"£N††Õ…aðta@Ðm ­ÅT5æ$Ù0DMÜÊäÀó;ì ù¢þë[ª®õ™É{ŽL«•Ï%h”HqøÌ(Ð ªÏãÇMå³:Gu]Zo I– á5² ‘töUmÑÀ:CvwLþXÈC!·…\•ÁÖ¥õ¦›Ir_–óuå,O`_ùã9#t²N³œ±kyb5fq8.Ä2:ºg¯¦à–À­º”ÚcfƒÅ†$(*¦@ú>.¦(ç]—ÆÓйT`‚•S ÊÓÂ6_•ÚÄ\5¥Tir+ü0Z°s¼¾Á÷Âk |ÄVˆ˜ZÒ –:¼uÎV¥ŽÛÉÂ+öðÎ|Õ»%Øç!–žÛ×:íK+;(÷äÆUZœòˆ}Ø+XºªÈòq‰ÃJåT5Å[ñ!!ÁGïÎMR–è™RMpYŒÀU²$mEÒÑ*8·ú‘Ùâ_$D€éêëRÖƒ1ü&u1àõ.ˆ_:@’JŒÁ*Žã9™Bå¾ ƒE,P©b·êÂë<œa0´R:\w C,u%¬wÕ$¸íónßç±5.FÕ…™° %0¶Ìò&˜ œþ‘¸oP÷*.'QéLW&C]Z³_r-Ü@oh”JW„µ2¸ÔÕœLß.– l¸ÀÐÁFX«®«Š×Œ¾LƒIï2[ e Sr‹°µÎ[ d€ÔRèj½FŽÖ… ­u¥ó÷mœ5³µÂ¼¸·£ý+7ZüTÛ#õRÚ•±HÀÔ*øj¥—©·ŒŽbâI5Ë%JÀ¬é”©h¶S×e[\cß•jBèw¯ $`>Ö£ïÆ~‰|È&˜xk†œ…ø®Ð\× †s±ö*ZT„îF¼`ÚWd½pƒ‚l•WË~ò û$vk-ŽIé0à¿LR:ˆ[ÒÄÏæÀŠ 'oy8Ù½:ƒ½\¤L!å¦#§<èéã9XœçãýFI ÕÀÁßüQÀÉwÅwûnÆhìR­^ËH†´1fK>©³±qåím9)ySVòn|Z†Àø•˜¸>Lût¦ó£“‡t.Àm›s?cØ*È1Û°M#Áý;\xE˜Güb]ÔÇ9¥ûУVv'ŸÓðMï˹J}ê3©çÂvëj=—],Žªf¼1sz.Z0¹X@ ‡,À «h§ý·“¦<¦´R¥I”-H¹€@Ùyè ]ÎÁnBpäç &‘˜sàúÞК„^ 3ú‘+7ÆhŸƒ1 8‚è""}B 7$¢pª‹ˆr—ÜÃnp @B³¿B:D›ŸB¢›£k²º %Ë(sÂëN²õæ;Vî« PF`!fÆs²Õ¦ï7¾ú»ÄáØ*oVZ¡éÀÐ e­O覸Ê4× )¾”O šßuâž ºbàP á{DдK qt]¡úAä‰n”ϲz[fÙ”µvnˉj§gÓÇ—¿/%C"êjGmzj;ñ×]O½˜øEéwǨ¬WËÓVc2—òG­Eå~GûÁŒó¢+ðVJPøˆR†£ûGµ› ä~×¹5Jƒ[ƒ½F‡)7ÎÀX3Æ£ÃÊ ˆH9œÚf‚º¨J> 2(P­"ø#0)©Ê« øóSÉè.5å“AÍ3®pë‚r¶RžXð§NÆ!X­Bت™ñn¶ ±2n&{1!؇žZ÷ÔeOý0)bÌâÀ$wSqü^?$.ÊlÉMøP˜MÏ–G×ûF')c pïl]ÆL±+µÂ¢HA—ÈèfÎÐB\4£"@UtDHâ‚@¼2XkÎв86ð,û3š4Ÿ/ºú¾LòÀ¼Ò(Øêw0ê–Ò<8Åýh Þ5ªH%¤CÖ4b]pËáÌ5‰O£íK[¶ó`Æ+P@rK6€%Ø1 ã’½ §Ø'Ë)íÉB~—îräæÝ²·«lìÚŸÍÚ3‹ØP-»8ÀF?àeZ )NÖŽŽƒ÷‡´V/s”ç©lÆ,$plòމ )Ì{$ÅC ;U·"¾­]Ç1ùÔUÜ£úH­ØV…§±ÎÓðLÚmInæ‚ k'ñä¡6•S„Ðhb;Õ>æ 3˜'œ!’ë²Ñ{nË'×y7ord^L)Jþ‡¨MOm'þºë©×=uè©‹is†7 \o9±"¢A0>[Ò£¤±´±- ŽÌ“ÜÁ–Y V1ÈQšsµ0èó–`iã¡eÀÇÔÙ?aÉtÉ”Œî+SÖï•Bt/¤•\í×yk 0µÆòñã´ß‚̸>ß.>êãu5á·¦üÛ}O?¸Ÿø„=¹œg<ŸæÕ¡!2žK×ü´ Â7¯*ì·içZ¦¢ŽGQ€’À I ýT‹ÈO90Ý5Lxƒ¼uF›.ž°¹’§!Š4²gªh±4'ìÐ×Ìf˜FôÍwihíÆ&ÛÁgM-6ÛÿôSß‘ÂÕ°îÉ ·™Ü‚PmÙ’Êõ=®ù +/Æ&­±šGá7¶  Æ/½1£j3¸Eá+—¶ëÍ—ûí$¸ñ&(ÕÿWpƒ}6ÆÖ•©d½§#›ƒ1 \î’x4F]¤â‡ü-o:Êf¦õíTÄ;7ÊQÐJ[Ié8É<ÌÙ6¥Á5à•äw'ç»Ï“DS™º*Á*‡äÍH•F1l?Ü ›|Cu,ÕCÓ®te«Yt|Ë”§ÚJº‹ƒu€¢ÕÊ8ˆãjÿ€kqÀŠf–Ç{è˜N¢‚ XÃZmÊÞøºVlð¯ŠÚñ0‡G @‡$3S©Î{ƒ§èuè¸Ò‚/ ^Y昶¢YP”Wo”ãÈ^õÉd«¶¿«‹„;ïTçpÉèr±’‚2´®³t-lS,J½¢ø °mjÂ4E^Áx*p´”%Ë›~†è IÛbAèî„9dæ ëþÆp ®)¢µèešý[fC™™åÓ3³PÊÙkeäÀj÷¦´+S¹þa¨È®¿ùuªæ°¨!‹ÍT,}BІ0ÒaûÿŒ¢U…^®3õ0xop¼–îò¢ º yG GÒiW ñ8{˜åajÖ¦B@b†žÁêqEð€3%?£¿6—zš_¦å§¥Ž<ÁW´ •áªg œuÎO':^K0ØlêÀt3I>°*%ÓÆÆ÷rbXrêZÂV0í¢Réë:E­‡p¿;*ý¢z)ž ·ÐxhÓUù%õÒA.Þº(ãý6oš¥&‚ÚråT1Íì˜ÁùL}O…„˜)¤^¿Kñn¬ bçÉlxŽäžEûY°×%Ðá׺²ÖUÖɤC£HmU’±-å)ý,,ߢvx¿‚§al}|BªîÂB$ÈXò ¡!ðä±D¯ü•e¡®xnÆv$×Ok¾eKb5=nÕŽ¥B‚§ù:â^ǧºOÄ£òÎÏv›Ħ3õÕ)ØŒë¹Æ™“ß4]ÎtšõmŸˆbe‚ƒQðÔGU|á€þ½`>«–År âÚÕW3µ›uZºf.¡a?ä=ÆÕƒ\€ì ô¥*Ü[¶V>SœøpGaÅ ,N›ªë…ÂZ=}u—PŒß’”ƒ‰„ùÞî`D¨eÀT××/¹5î 68xmv«!EÒÚ±zSóa=]Û¡›^hdW7st}¾S4]¢.x üŸÅÔV‘ù»>Sdecæ[‘ó&Àä²*¦R³XÕ™ÆYÚ€¨uëc™±’ÔmAÎ ¿Oçÿ>š óÐàZö¼[Ås«Ô/¼š÷Î ¨—Óê1S˜¬¯÷¢…H|Ÿ³Y‡©Ck=]Z½³.ɽaFÁ=ä9»þ3Jmyd5糓£ôu§4mÄ 5èÿkŸ ï ^ærgˆUDAõN û•w™ƒ/Uã;/ç:‘¼^}œrá}zä™âßjÇ¢!êuí=ö©Yˆ*òè˜PaG“’h²HZ;_1†ÅSsgvU†š·ºb)9+Ñ3 a' »Œ/Ü­í{±™Êަ•FiCä¾?]NÓ|’ê?8bÒÉvpØßÛY5.ŒÓ} Ô\ý<æFó”?®ÊÀ¬„Äì!d‡a¶.RWk&ËÜyF=(Îý_q-töª£5çÄËu¬6,ÖbË]íRw,П_õŒkñË'݈¦ÉCu>¼Ó”ó£ÕL.w—Å*º‹*†ìÜe¸`b.žùhšº"Yª› L`Öý¯(ûµÁ¼'œkc×—É~SÌJ—E2¾Nsà§G–týw0ó ’Öû«½!GÙ§ÝòI&GîðEõÎïÛtþ„§\+-¶²]µ!ïÈ5o&朩v®/$Î8÷0«ÎýáïÚWETnÓ)V øíyïý'c†Ç´¬æ-—áe‚ñ-—dûSD›—PŸÒð,,ßaTUH·âó\Òû·©ªHÚú–c=È9xe\\àåYlV'K'V ¸€YqèÁ…÷>¿@ó–îýd‡C.i§¤ü³ên0çfBAº§éS'(:þ{]†¥ÔŸpI/ŒDF¿»xŠ×659Mø]„°æw„´léò™¡ÂKº’/Ð(©«5ÝQ£“XèGØú…”Ò΀\§_¡)ð‚ÿBªká¯j(…QµyîW5ÄÞ™éW5Òg’‡ÉVßO~ySÕZ~Ö}&É?ß=”o}ßò²ì#eöµð»Bn ¹*$û’÷wöáðÉß·)üø)¯4ý&Qç ÇÞè8öÍ÷?L"éÕ‹ò½ô¾tf_ßò¦tØTOtä½fp:ïA|­qÏwH¿‚¶p?q}¬XÔs°ŠÏ¢@¦uìY‹cðHO¦ü4ù-(û„ô®|7z_Z_Ö–Ž¿ÝNvØ’}ÜŠãµgˆHþ\>ÿ¦$}õ}Q¾¤eï°¯n¯J‡‡Á÷µxm®{ ]Øþ©~A€m9·¶œÉÁ–së¦ÓÛ²W ^•5œrÖñlø¹AŽŽEá§mº!òeQÞUÑX¦ÇÓo•°÷^e-ö,ëd°^‹¶ª¿ÕgöjܽÈðŠY¿Ó…loíSñqÍ÷é:ÒS9uøRг¿Ï…_ŽE?õ>WŠTƒ¬~í!þrývþT¾Cÿâßm d³CÓåÄ0k|½)ÕèÞ‹ZõÔ}y®c…N)ŒâÒûéY#ö,Í®~Ñ`üµýšM€@»3¯Y ÖÕó!Ϭ°WGØc%õó-EÑ4:Aà¯Mtä]AûÃr꽊{Þ÷T|˜à!‹yîÀGZ”€;öÃß–ßfº-/6í ìðQÒËa ”Ÿh+¨¸+öžl‹¤Ùãì±"öB{íáãÀBåMB¨- t=[z–ªÅšN†oëZm÷rÉÛÒº)äeùú_sH/^Ìó©ë@3 rÐ÷¥ÃÇêA¬®ï×üÍ™sŸ¦‹]<1ö­'; Ïð‰ *i’GˆUª ù3JHàëÒ I§ >ý¡ Éë†qÛ—>½†–½A¸-Õ7&¤°H!=y·«åŸÉm%ôwEþ왑 öLйùcÝZdÚÍÁÞy,?«_ ™|^ë ~T9LÌžÏÂf k 9ø‘Kú¬Ú߈îp-GüÚÙ†›“ŸØº›4âûeõlËŠrëÕ¤ØWƒUÏLeL¬*¤Ì&IŸaâ}‘âÃ$”6kÃpŠ…‚cW2NåŸñpª)få“&¨~Ë ìŠ'X½¬CO›ŽóQÖ¡^‹MkŸ²¶çxsKJ¬8>kÝ ŽŒ­Tº78ޡÑǰ“6>ÀN†Æ;ì…-Žæp>Š<ût(Îtàtì¤Óâù×ðX^3îð9¯áM©ê`™žŠ¨c1sYÁhtÅâ^¼|‰G—BÑÍ›F–»‚ß½]ßõ¿kºendstream endobj 148 0 obj << /Filter /FlateDecode /Length 10264 >> stream xœÅ}[“¹‘Þ{‡~ĉyñé°û@âê°a¯wÞÑ‹FŒðƒÖ-’á¶›‘]þ½óKT²êœÄâ( kªÈë— œ?ÜÅŸþ·üûòùî?ç]=½ùx÷§»à²¿ÄrŠTë¥Bðî’ëöï‡×§ÿszwG—J¥•Ó_îüé_ùÿ¼ã¿&G?y©®¦ñPsñíôÝÿº ©ÔK §L>rÃSˆ—ä}Ùþýðúîwܨ6ŒÁÂ%Y²Ã‡¹‘«—˜w\©k#þ‚kh.!o<|)Ð%ÄS-^YÃQ¼ÄÄ* n7Šé’37*þBæœR¾ÔÂú¿Æœr½84ŠîBÍúRi—À$àM¹ToÍ©¹KD#ç/Á"fá?&ïÛc4bb6^OdWø?ƒçF!_Ú2ñ”(aϲkõâ£õ¥˜/…¸Q.—`Î) “ɰ·‰Y2Ó©Rkíâ³õ¥Ê¬Ëm2sŒÙ¦ù ³vj!àßÛª#Ì7ÕêmN©Ìÿ‰¸Õ ™BºTžwitq™X±¯©€÷’Á)5V0fÊ-_Ô_Ê<—rdÙ´ä 2k3;¥Ä¤0éTk‰'Þg{u,n,$)–r)Þà”æ¤_œE§VYOÄSlуÆ—X’Ò)ÖœLž#Ǫ›G‹¥ ¹ŒFAF‰Å ù½nD¬ý)²z¿F#fHb’˜¦ÞlÄòN1²±É_’cñuGhåäyJÍÐäKÖ –Y%϶—e(Eg(T‚-ƒo`m[ð,Ý$ÊÀhÇëO¬‹¡Nx*,CP'E”¦Ñˆ¹Ãe ¦#¶õ0a)³4óK,•µË·nØÕƱ"ÅÝ|0aƒÜÄ>J„)ˆÁÔ¨D^(ÍN35*ñò.™)Þ`9­ÕÕnçØŠ[J€Xy9vÀ\€ßg´aÝUØùp©]ÈŒY)¡›³ 3¼ bé6šDöÌN³o6yÞnÓ’­%"KÁŠ ”цw”àÄ1,a}Õ=^™ƒ±O?…9TœØ7Ú° dݘ±s¦Hòä`”2¥t4%ªï'öŒXYZ³Np’˜FT'"ÂöX\Abeiš’Äú.sdEà-Ɔ¸òʹQA$a4bÂ2£÷˜ÿíFî»4"[ßdÑ„FÑ&o™D ‘Ui°”RŽ=˯Gç[5bËUdu»c4bo _"ø:æœjº  +nsJ…5‰ÃÖ•`º°Tx弯Ì(Ŷ݅å$/YL[¢8¸VÀT7ð½!MìØLP˜5 nbþ4|3*ìâ€ÃkN•y ûx ‹%½ŸÕˆ8†cÕ•*ËŒå°'ìÄž§33¤(ÄLΉ<Ünõçá¿°Ë\¬ìóñ¶ð„Ùïr¦ßž!pÏ,ȱîV7üEQ·ð—Š­ ‚gCÏ33÷6˯ölœ*ÖÑÉ`ºàÙ= hÄÈŒÀ‚kˆ caKn©ð‚8L±°§k1]´8±Z˜ál`)çpGÜáj‘€wžN,œ 3ÏÁB‚öf…϶̜Ûq+³© N2¥ÊŠ'™ØèPø™FìÆ‚1e¸d8Í_óŽÁÙ«¸øÔ)`©§À–z‚iY-¯"À|±&M©Ö¦°Æ„û)ÛÍÑØ¿‰ØÞäMï;À÷ó‚åÌhö+€›ØvX1J€­h‡ÝËý ‘ÿ“C8(ËÜ3Ç%Di™µ†E…ླˆsœmÆ‘ge6¸R`<_ø¸¶Ú dB¬^6.±U°¬AˆM<Ôˆ­(5q؆ÃÔLÌ.y‘"þP±%<1¬ÞJ¶X QƒAåÅ™îÇ8°I„÷`c¹Ç„ì‚ñk«{2`¸Ì-Ÿ0$6b̹”µqìš#þ`~³)É5|fÜ|6U#fð$l° aM"'¬ÇMMÌ’0%æ¥åK7àH„éåg´WÌ5èÍð#dæ·ålÏ9dæ3ù•ÍkºÆ]‚²5J˜yûKÅ‹ëÌŠ9„ÂsIò¥f[zƒÅïÝÙôBx1œåì° N&n*¦RÕ˜j pÄXj'¦iÄc@£bWš…IW¿Z°<þ‚¸•Â)öpÑmºqƒÇ‘þÏfÞðVë’ᜤ’“9‰›Ì/”jC©IÉF%Qµ]kjLJ¶¹ ¦ím`Z$wh¢‘ºÆ—<ÛU+& æ%A–À0¦"lN)¶fÇiTÙçB°!÷h© xqQ‚²çT³`9Ï×½¢±ùÎÂ@/ëCð¸_ÉŽ°©b”ÒÃYsFüŸ@kR²Ã+ª^ªØq¶YŽE´Õ¡ø ÀÔ|ª»{ðѱÍVTDf©µlÇᆤ”$’âØ5´ðH*,´<•„´¢™P((q@N{cÉS ¥Ûæ]+ž%DsÈM"W`&°‘¸–´cµñHB„ƒøÄ7õ/¤Œ¸ÇFø»&”/Z,—Yu³JJÅ%Öþf@ ¨´å¤‚«™8©±´¬8‚P²!5Ç‚‰G-¦…zPfÖõ¨­É6¸MY Ï>£I!€TÈÀJÛ9.ö>Qî4)„ Öì°m9d;p&à9HK³l{:RX–);Iqù’z±[ ûØ=!» ±,"5áyÆ’Š«ØÑIða–/\ùz 1eA#2JG˜“Ë ‰µ” O¼Ù>:룞QsÑJÖµâT|=K”TE*X”’MëH3ÚÔå'¥1r–}+vþE¨S‹m­Â»Ñ†C^Þ¡ŒÀÏöÙCï%5V–aM¨@K6W²€L ئYRPü¢üÑè¨F]ϰPÙÉ$‰ Њު+"ûRÆ7%JoH®š–‰C0)÷m–ƒo ‹xаuf ƒ«â2Fß&UNÀ•Ĭg[ùФì(…Ü&_•ôfòF2©JðèÍ8A¨Ø]v½¥B*=vŒd×VæZ©?ükΉãoɧåjVh„î3Æ\Êdq@N$`ƒhô¼uA’nBp'«11cšÆYª‹~ò­v𠂉Åð„« Òá6µ+%Ï­—<{ ³Àxª2XS‘Z¨õ_»æù„Êf¶J­®õÒÏwäŽß_<ÝýîºÍxÁ†ˆ5íSdžHrRk£ñB5Êl/á o¶£ÑazJ£‘;½ÁÒ¥ü´üóòùô?^€2üßHØppzñý]/çýGs(J’x^/žï~~p—tÿPðΧ³»8þßÛ¹ÿeùV^÷ÿ÷Å¿Þýó ¦ýVcŽºfççí˜AŽ…j7Zñ&ÂÍ_ÞìZ5†M·ZÞèV)‰áG«õÍ®U«¢T«ånµÎu´Ò³ÿLÚ‚® °Ø,À¬¨ycÍÛ© ²=d¶k ¡3È™óBhD¾•BóTl|+Î\_d¶OðŸÔÚŽo;!ÛgÞš‡Ù²®á•ÿzÿâjíàá,%ÁÜ¢I‹¿¡…¬ã·< yï»ÈÝáBY?„zùwQÌ!žþçûµÔÎpÉ(Lú¤Ñ;¸pêŽ{ÆãºGÞz)l˜RÊu7J*U÷)£[WþOŽBŠ„¥í>uíZ’úåT$—ÈÁy¸öµ×Ú}üèãR÷˜c/–0—ÃÎÂÚþzÀÇšcÙP£>ì¹À-‹ìÖÙ††¨Æ‘”y†Ûë¬O}$¯’áMUšìhȃ$Iöa{ÕŸî£{”ÑÆE0À*¦ÜžØà‚Â%œ±H¿oÌy˜ÖàI#”CuÁl)48`4bû‘i0ÀH r¾M6“Tò‚!àôåYŸÁ€p*ü[OGY;Ìm0@Eù ‹M‘ŠI—±ÿ5wl²PGÝì>Yõ©‚ù¡f*ÍDš TV¿ N…éîTÕ§‰ŠŠér”¨ˆ³¶¹¢Ú~˜èTÉsÀÜ+™ãDÅý ëÎðÛ}4'U:s‡ùöÄÁÂe¨BÏñ(9‡õ .hAʃ“ÛoÏaœÁ¨¹Æi–@Yb {nƒ }2–둇¹¥Ù%Í“\“¢…É8Ê0ëà‘ tÔQ‡>ƒ{Å(5lS=˜4ž Š;òÚ~-iã9k"K4`ŠA £ÿþZaMXg@þ²Ê¹*9o®‡Màè“êrˆŒfÊ#¸ÁR‚NÌ©tÞbÕg°A^¾= [ƒp¾ólœÁ\ §ö0µ©“ÊÆxIoÊi‘™&H*C¾ƒcà‚Õ’JÆD)ŠŽ2\žìhRɘûÉ’çÎÓáø±kÊÞÔÃz¤’;¢˜²z¶Ç\Ž‘sÙ­JÍ=Î`v¸gy¼²JÊaýpì é YåäÂrç GÔS»3P¸~×uOœNú 6ÈQN?Bí–½´§Àá\{9íLó¼l »L®Ÿœ›¥—BV ¹*ˆ" ˆTÃÙƒ¨”ê?P\ã§xRÈ*#ç–C}é*%y˜šJÊùŠÔªô™JNQI9vSìs«35= ¸€Ëp Ggéß0@¸Pä4`LS{`p¡äå€htS % .ÀtÂ1D­uš€3ŸWÙ4V£r^ΞU7¡CQù¸~ 5–+ëÐEåãP½BËñ\3yªÊÆ¥Øoðâà)Ϩ\U6.ËZ •#yè¢R²¥õKØxÎQ¡ª”l“KÑXÎtYU™¸åž-ÔFÇ™>¯*çK¿Ú‚5F1ß¡ª<I ÛÀ¸B(Æ(*õ‚ã™~nª.ÊëWc·*—ërÞ²Í禒p°¯­›óit:€· å¦8oŸò xs®ö3úÕÍyLo8Ÿ#1eØ0´[T"“œ³×¯’p( B¢¯®Ó2–¢rp¹ß©0«ƒÂÜ\éžV¡0Mö…¹9Ü&¶Ül‘f¬ÜtÎ÷ÀƧUùß´eät..ÇËë´V†æ†KèD—óº&z‰Ü> 'gô[Zí…1ŒNÂ%‰íšßr0Æ8: ‡»8RMsÞê 2pýޞب_jb± 9‚“zÉBúI I s Þ/ÇNÃêg‹Q98^…ŒÃªyV(A sC> Æ\.œõQ˜[HR¸ßO»N R˜€&ð ÔN˜öQY8Ü&§jÛZ,rCÕ’‚ÜXòÄœ‹r›±š‚Üx–¢ p’}fiIAn¸ /É8´jc5* ‡;(ûæ´ JG^eáØÖ92ë֤Ŝ y•ƒËË ê(õ"“ŨL–³!Éû ¸=³  wœ9D}¯G18ô,€{fY*Runª¢h”æEWú%`»N`1¥y19:|–™ŠH¡©£xÈëCQ‡ Èq9k¯aÛ“ˆ“irßtÌS̉Råp~¿BìQì—0ºèjGÜ} &}üèƒ[€~…ÕœxfDjK€èÈ‘²æøŒ>cK\ßòTs¼rOösrÙjé§L\X‘Wcœ!—¸u2˵™uÍ"ÝÞúÖq’[4%pžu)ª‹Ü*À¡ýUšó0µ!™Pb8Ò /&è9 °Ž ’P‰€Óaf XGPÊNj€Ã1@×:c@u„Ô§™?Ý$¤ÕɉaÔ@#Í9í2ts[î&_'£D)YI!–#¾½ï¢ Ç¦É?gΨ·cJÍ›?&ú}àÆw9¾ZçziàtTWãŠí} f&ñéÊÐÊàŒ>¨£ÚïÓ““¼3²©R9¾òçå„°›yªT .eæœu¤Jå䮑ÛË“Ú*RÕr€sú1è+Gý0·Á(Ê…Ç™¼›fºIUËAÏ$ÉÕ©—ªŠåhg¹Ì¹Nc(RÅrr::÷+UĘ̂j9––ìµ® …[nªª•“ur]³?*ÏýÌT±\‰rŸY’ëkgN*–ÃÁj” #5;=@ªXNnÿ”³siÅin)U*”J]·4· Y'ÇŸHÀ_§Ò¦jå2;ê¡õC„qÚgð@Æ­=(œž…ö¤*å2JÅlM‹wHUÊå,'»¥TlVõFªR.§~]³ ŽÓ>º:Bd9á^…©)Pµr¹—¿&¹×Å,,"U,'W¶ÃëÀ…WH€ŠNŒ‹Ù̸õcꩨb9˜ZÜ‚bÓ:„HË%\C…s ×ðÖ~wŠ®‘éwõW¦°©b9Öëf' ©b¹ÔËe·³Ú"RÅr8§’QSëZWbôQµR‘z½Gó­oõP•R8ð/Wä„c2eO5U+—P.¾IŸúwªVW´;9¡ž×Rs£ª”êàkÆx3ˆ›t±\“SJã…™*Ôår¸‘ ÇÙkšV .—+©W=ŸžpºIi¬É ½°h¦qt¹€‘Ôëwfç¨HÕËÁŒrˆ¨\&P)Ô.’\ìŸqžwæ{+Ð.†Òk,K›f†¨ézÉÚýL¸®p;¼¡Ë•Ãa¥C¬#3&WÔÓeJe¬ã˜ª_ÃÅÏ\(Ú¡‚¿›´ÌÂ<ÚQ?'™p7a›ˆMtºb–ÄÃG2&V:*Ð؃§]EóÍõD…Úá »—“ú“‰ ²ã™É%?€ì¢Ô¨;ÜÞ¥f|«å6FQh sL‘ýWЇ>ºhÚõ׸¥d:Žâ'&ê'ã'dV˜]ëàK(4u9¢ÆìP[p@¼LTzÔs~‘»¢Ü®hs€ìPÏíp-øŒÓ4d×Ë ™ÒùgÆQ ’D߉zŠ ´ÃÝÈwÀ3ž9*Q×ÉQ¿î§Ýº ´ÃdØÉ›„RÑkàV’¼×GÌô@ôúð„[¢¸ÂÐÆ8Š ®`˜0ßÚ_2.‹*ušˆŠ ´ó¼òûÅÓa¶9+h‡c¿ôýý6ßO²ä´éq—º‡ïRÄ”äRÔ =~@úòï6ñå꬀¶¬×1|Þ f÷D¸Ó¬usœ¾¿— Á&#¿Ï#Gì_Ü vGþüá^Êr8?þñõËOï?Ü?à$Oüü79U+rQoüâ7wçþøéíóã§×÷ÿa=¤>›P¨'ÐðÔ|¿èב}­ç÷½[ÍÁŸ¿ïƒ—v¯ÿpÿ ±>žÿˆ×ÌèLgþî5f‡ÁŸ_ö)5Ç£|ZVå 1=Pr¿òÇþÅÐÊg~qûŒž×nÞÈ•RxËePîËß)y² DÛ(ÿj™Vk»ïý0È£ˆ¢G?¾·[Ãq+·ûPCZ™ü)³©$ý¡ýÄÀ­@ïQìN/^1_½Ý¶êݘà›e ¹ž¿•æ¿'Ò ;¬Y`O‘N…tþUŸ«¨¢ú}BÛœb ëš8j%,ý\-»×ËR}åç…ªßD5ýç{üF ™§l]J©íc×+[lçÏ—qom‘¢ãë‡oî<Ü"Ž,䎰x"ÜÃÁá3k%,àÝ}?qèxöÄ h¨%ÀW%e#ÉŒpõÊ9Èì¸s;áµP.άb–/;÷ïJ–<Œ{Q½« °z”3—Ìnÿvæg\ïWt®bÆý×GÞ¹†ßˆË»µ¾ý4¿ ÇÛ§ñø<GÛwãíwc2”² ùq¬ùýxü8üÛ=?ƒäÍŸÿÈÆ¯=É:–AÞŽG{ËÛÃ:–ǧñø|³Á~ëÛÂ’šÌì¸$œx,A–´<î—ô¥{Ýמ…ýg°ðž W†”²Õ丙½¿ÔyxOè/ ü´HøÅ&Ø[Ïì|ÈüþÈ ntòÂ4¼s$vc{|`ÜÒH7x7¿û:æGJ2™_ ñòøq48±’Q%ÄŠù¯¼ ®„¸“ûs8þA®áa¿£?ó>2]þIA~ãËm®Ìq•+m-mÎþÇf‡¿›ôß¾x=Ëó¿ à8Ž·å7™ËbvóÛ˜èÃà¸×;擺ÌÏÿ•¿íÀкA^ÄÏ“»²ÙVs7üš ±òn¼}9Ïãñq<~ÿÖB"#Îdo‘²ƒì] ç?@öpíîÛ±èÇñø4æö|³Á»Ñà»ñV,ˆ°å×ÌíKYÎ9)¿ÿ¥E?²êÚ•åÏtˆø;¼HÛ?ùÕ¦ìúmÿä‹T~²6ÐÕVôW*šw™Ýp[E+ÿD­ãïôOn®ÃôOÆ’pPëvÚúÖ’¾»ä· Sú…=÷bÚ<0Kj]+•'Së\+«?î=nתùáþQbðS$íèB}u˜‚½¥^Ieý© ¢Óíõþ¦ôÓMgHiaØÔ 1Óýša¦|Æw7Wà<\„o@Ò,~þ§a„^Gþ<Á€?¯-¿ÙË¡$Å«¼]ÄZ)‘×CH~¼Î(™}ySâ>íÛ. ÞïEr¨¬uß| ƒà~òð÷¸>SÉ*@ò¬–yc¾FóõÍ W¶öDZáÇ[ÕíÕøØd“ºíÿ0>¦Ü‹§½M]|oߎÇ?ï¾°~÷›Óù›€:ˆü÷øks)EI }ÂS÷Ùbêšh¥5”ù0_Ç×#ìù0b_Ú|éN,ŸFÛÃN,¯‡£óU"Ó/¯¿_Z× J•rÐËãAW\Û÷—7݃®Xºb¸ž‰ÿë±g~<º±}n¼ýò *àj>ï7J*7Cí”A­È#à.dÕéžïú§¶¾ø¹{‡ ˜\~”NHqãºA!þo:ÛdP0òPº ‚©¦=®¡Ò7ŸµœË@»À{û]o};@¸¢ß+à‘Å¥P4Þû=`ôKŒ€yC=5f¼G7SΑ¿¦ÛÃŒ;dûr€Ûz «ÜOc Ícœù.çÄôËãm¸ÿ…èñøÆ’…àåþJ-R£ÇƒJ ÌWt|{s #IÑqæÚUê>ýûT9Þ}wZûH{\y7¯‰”1÷êïï®AíË¢¤Y¢š8Ó¼þ$ãŸOˆÐ'÷›·<ˆ¯¬uBÿÓßÃØ®¹„uì< °O…ÉY˜K†”‹}˜Ýö­g²I]EnœEö£Gj,"ëÌóÛÃo~¿í ã5¾÷û.RT™ú,&Ls\ Sën}X`pŽ ^§ivìÛgÐ#âŽ,v»uóT“×K“×"v² ÊÆì•PŒUdèXAd—2;ôáŒ$ ¾ÁÞÔîHá¸0-‰šåõcŸJbe¯wFÆyÓÇqþ[—ÝÍÑyéPuEWXßœl {_VÓþƒ¬+5×9™ÿÌtÞÑì%(Œ‹}wdÀeÙüþ #O)äó¿QvK=ßtâ8W*ï%ƒ8f·¾U{9Þªk`þ™res×åå!áÄ”cùð¸müùß]ôX gÉfT·EQŒ¸ô\ÕWÇóuA”Ny°¶yÈf>§ºKÚÄW"o9:p϶ÝzÇ?¨ÆèQÌD물Y´Ö2©¥ ä…yûvÈõãÓxÞqã»þÁTa¶¨t’56ò+Ól¨Ú Žp•\uûaž„­ÈÁ}ÝŒÅÄÛwçªí”µÖêKóú= û°Ž±pî¢Úÿ"¦Âeã[½ž+U–áÁí0àG ™­_÷&ÑK G³X'í˜xѵlIÿ,_®Ñ‘¤K‡gw<ìøï‹˜äÂê5£çß)~ÿñ¦–ÒºUMãW·e¿‘‹ÕŽç¿Ý³Ñ Žm2ïzˆÁÄ”ÆMl:YÂ%êÿ:–ÿ¸¨ Ö¢•°–Ö•²aft–oÕÌ”»­^C`¢¥Å±™wJ¼Àq¤XV1ýس®»BJå I–ÑiŸ`Sâ¿Ü#kZs}ú°=}Üž>mOßnOÛÓÓöô|ã¯ï¶§ïnûC„¤.á ïµôÃðvÞc‹[®~'V”ˆ‹ŽÒƒëBûrïjØ×»W÷†p˜sŠ8ê÷Š¾Â½ÂÑeŸôç~/B ? +Î?–ÝZµ\e©_vjÔšzù†Ç% Vî-І]×W+¡ýÏGÃÑ18³á7‚Ý–;ûåùŒÛŽëzvÊj]ñWB òn,ûƒÑÊ_>¤²ûðœ¿Çêkù+âþá?œãW°~r ?Ä`ò—,;ðüÓÞ•˜cvþ«â‡AZa¨â6”Iu‰±,Ú ø¾[WÌ&¦­¼.ÞÒ&Õ×Ìö™ä¥O°·f2²bE° žòW‹¯ÌY¾Kk‘Å«¡á~:X÷ÆiiÇJïûkä!d7 ;l@•õ~¿ØiÖvOï—qÄp|\ÆéhøfZ”ñÔ.¨zm´~Ý'Åûü~L\ÙÆ÷Ÿú˜ÝÐ|‘,nî-¸׫ðˆÝ~Rì· r´ ·< åjê/¼Ã!.°®G… {ÑvŽâÞ)î„éÊò–µ0¥Š@ ¿º _æñDF}€¦7çW¡£+ ‡bÂu^ϸqJ..^ßÌ~Ä ¿ÇLäâÿŒ¸Þ«vÔ·ÁïGÐZW&?žYl‹·û¢ÃCÞµp¬ÄMùmQ ë~8†ÛµÆ­J×÷h•³À/YÚU±¢6?`n4o÷±î¥áœ]•#dÁzêOÞ„œ4Ö¥ÄCy'&ËÒ°{­*q5Æ·ÇLÁ±5ð&4õòSŸsðtž”ÍÞ¬ ýŒ‚Ó]“m#Ó¬Xv!à36$ûœvuÌ·!¿·Ýç(ÆüµXizA\ocÐPÍæ6ÞªñÌw}ûŽé +xæÛãÌ üamLÇ×ì÷zq9(h É풤ξ/æ¥Â ?Èlc@D¯^Ü=oM~ÜõϺë«e {!•˜´°÷ù€#·¼ƒ}* ³Ö;£·ñ¥’±Ž€†ÚÚNz—á‹k»ž·qOü60+ÉÓáçl¢LäìÃfIq0§~{÷ÿ0ý…òendstream endobj 149 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 587 >> stream xœQHSaÅ¿ow÷îbkæèšÚÊKb¤›¦VE©`‰¥«©{p²Íá6WÛÌA+ò%á3"J.éh›–ŠDY„Ao=D½ŒiŠTKðaÿïòhBÐ{oçpøÃÁH«Aã‚§wØòô÷m¹*ºS“†š8ÂütQuót=GôÚiúÛá"p‚}â0>zfô@—õR•Ùli D®zÜ!¹¡®þ°ìˆÈ¹Éô¸ýòþ¼vz‡>§?tÞãs„ƒrgŸ?øü¿*„n$RS[W!êF³¨!#*FbþÒ¢ãèº#—á0,è‰Ó‘8†×0#AÜãkfdVf+o ‘M°6ç3”‚v1;¿!ä)æ_QwÆ1-¡ ‰Uæ,¬ŒZøšsӃǢ®Ht€”FÉÍ;‘»âi]l4v;IfÉüƒäÔ“G“É©—U %º ¶Ï˜.B\Ê7ÓqÁ $‹W³tf¥ŠŠl~é}è+ýžÂ¯ÖáÙ:sª[:K.ø\ÝöÖ™°2‘¥™¨^ FAÿìý´×õ®}¾…ˆ'µ™¥jv™9ìæªÚÞM螥Ly¾”ä+k(T‘rÊšêîÐywí:3EÄVÝÖj VSppÓë ¨6)§.æŠùeañíÓØ"f>žÛWÙÞf>Õû<=\~HP:&†W^t}ñ¦‰›Y¨¹ö3ÙúoøåsÐÍÃÁš¦‰I°*ƒ…å‚ÛHJ¯'ßôÛÿÒ¸endstream endobj 150 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 1144 >> stream xœ’}LSWÆÏåÖÞWîZÑmEGq2?ÆI´ HFdNW´Ö -­ZTT@GÆDü( ŒaËÐecu6? jÙÖ˜,°˜Œ·÷6§&»ufûÉùã¼çãyßçÉB"?DQÔÌ$m~‰Ö¤ß®ñUQ|0Ňøñ!´™=§<†|¨a %¢æÑP9 ¯ÂÖDST¬ª,"+#;rÑ¢è· ÍEzÝ.“ri̛˕¹fåËe‚¶X¯3*Ã…M‰6¿ Ð 5šÒô†Ü½ÅÊMcñÿŸBÈ¿ ±¨Ø¤1o×êwgJGáhÊDYH…rPZ‡RÐz´¥!N°ŒD(íA—©9ÔjÌ/ÂÏäwÇošŽ ×Ñ-ÐÉñý&í ºÆ¡œ†¾KF"–…‘’øëˆ„ˆÇÏ` ¤¬xJ¢Õñ²©›ñd Ø¿ä HAú­cRÁy–`'œr‚ÅIMLÒ°Feü|§w>Xø§×úÜÀÛœ^•˜ƒ1lã÷ÛÊmƒŽxwt`o”yÝÐÂTC`ßM`*ÙQFcµ«>œ…sóÞ]ÍJÓg8¾òŸ1¿‡²qšOá9YÕSõ-âY½•µ²g#ûoYšKðÎy›sv«¶jë›Jä¥ 'Ê»Ùeââoß¡˜…¹î»Ó#Û®.hQ¬º¨>glÂÝóz¯vØïw3­r:MÃ|”uÑP+Ì·Æ‘… ê¼JqV—ñnÓëé6ùs¸òHÕÌêŽÖu+€Œ1¾(‡ùÕ3õ.š¿Ü++;YË1k<ØÐª€fRý5‘ŧíÝ¡“5œÌfÝâÚ;Ÿ¶`öÑç›{™*¹T]Ff2W䕦íÉ«Ùè{þ¼×ß|ý¶üƒ¬VÓu|dm«eI8¨e¸àØ"“>?÷`fS´ý7ºÚ&êÏœ¯i«g…ÔˆÑé™m£ø¹‚òº7š¼ÆGÏX*†Dos^œe§Ù² ϳàÃVs »†9_v¾¢ ŒÛ?l:×z±¡é\X<ÜÜÃï’σiYÅ7G>Ù×®ëMmW ñ‡ÅQ‘ÕJƒY?=„ÙuŠX±%ö}Mf—d>„º>òÛе\Uâod‡åНƒRþùÄW‡>ӭꋴš¬%k' $.;ˆ-Óº-º$üÞz©àÚ¾ŽãU}¬Õ.«}rû{7fGo'/VpPô‚¬?žÞsǹ‚¤“%8Žó6ºÄÒiAæð+"ÆaO¨ðŠrÑC>öž0ÙdŸ¨ÄÕGä LÝÉÓUõ˜êíþQáñg@#Š s‰9°ÍÃ8)8+Àý—'XÇœÞÁ•püyð¤˜ó<Zg ï² PC¡oI¯ ½DÛÉHï?º1`ÿîŠ6INžû|å@׎d_ɇ2SY}‘‰š’ôyþMÍ%5f¥1‰xËžm©ì†35ó q&ï¬ø—™“¯à‰»$þwóB¦endstream endobj 151 0 obj << /BBox [ 3111.61 5463.05 3133.87 5485.31 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 180 >> stream xœÝA! E÷=EOP) '0qç¸ðÄDDžן¢aÄpAà7ÿ¿–nfÁéwf¦ÄCr½'ŸX×{>áoàˆ½wŠŽ‚ºêC]tšqž*C(ch Ë\ûJ!Ñ´Rʦ³ӯ׏êÑ^)s禒:ª_=j¢UR!füR ¢]·®‰6Es´)áû#œA(‹š÷ Œ;;—«¶¼Šìan~endstream endobj 152 0 obj << /BBox [ 3110.03 5465.61 3132.29 5487.87 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 178 >> stream xœÝ=Â0 …÷œÂ'0þiìäHl” ¨„eàú$*MË¢ä=ù}v¼é™†gxe&$…ØYDcA1övg8Â=²9vN¹«§Hž`*ƒ1ÇÂpCW¸­œÄ˜ HCÊUÆj+ #[Ó§CÑU…ª/€YNj 9Œæ°Ì1êªÅ¤kbb®hSß¿8…KPLêÙávå\,¢ßþí"aÞ ¥mwendstream endobj 153 0 obj << /BBox [ 3105.02 5473.94 3127.27 5496.2 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 182 >> stream xœÝ1Â0 E÷œÂ'0¶ÇÉ Ø(¨ H”ë“´¤”…0$Ê·üŸ¼é˜= wwžI‘4˜Ç@E§;²Áx‚#Ü!‹a0Ê¡>Œ”,Á8TBÄì !R‚몒‹SÁ33{Ñ%W‘âûâFáU‡(z]šžgLŽV¡šÿC0ÅW3f]-EëXr¿ ßÿèÝÙyLÞ²ÁÓ1ìʹüXE·ýãUÜÞ½ KmŽendstream endobj 154 0 obj << /BBox [ 3088.74 5501.28 3111 5523.54 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝM1…÷œ‚ Ðè LÜ9.<ÀD'1ÑD]x};Íh ࢡå=(«A$àt‡+v'‹˜ ©£*ik1™ãí€{¼“¨²!S4.q¾'ž ¦êQ˜r®¢ÏŸ« ¬É+ªPÖ yç‚p¤{…p!önйµhŠ%ÃF!bwà@Ÿ-Žðáõ¼ ¸¨¿¾0Ây°bøÁM=§[Öÿ¹…lá cŒl endstream endobj 155 0 obj << /BBox [ 3044.17 5577.11 3066.43 5599.37 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 177 >> stream xœÝ1Â0 EwŸÂ'0v×É Ø(@P $`àú$”´eá Qò­ÿŸ¯zÅá7PŽ‘ÄÑÌD0 æiºïGÜã˜$vdŠÎ9Ö‡³q5 •ÑçÂH©¤ð²¨d%Ô⥠U;E«Úh–‡è˜Ô†.’ÉÐôØâh%I8<ëÜb”5Ðfh†iêàû8RRÏŽOÜ”sþ±ˆ~ý·‹ØÁ^E`m—endstream endobj 156 0 obj << /BBox [ 2952.21 5735.5 2974.47 5757.76 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 178 >> stream xœÝÁ Â0 ÿžÂ˜ØŽãt$~” ¨„åÁú$*MˇxDÉYöÙñ¦gVžðéLHÍÕÈP $övg<â±Hp =t±>•‚”)ò*Ã…ÌÁŒS‡ZÐ"L–p¨S”U‹‰kÅ<ĜѦþ¾q‚ (eõÎñŒ»r®?ÑoÿvØÃ™xn2endstream endobj 157 0 obj << /BBox [ 2820.65 5964.49 2842.91 5986.75 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 181 >> stream xœÝA! E÷œ¢'¨m)N`âÎqá&:‰‰&Ž ¯/dÄpAà7ý¯ŸnfÓÃÝ$!Œ !GEÍ ‚ÙÚ=Ÿà7GÈ"d@¨FYëÃ(%˜§Ê V0z¸v•Tè…š$¢qÕŠÉíÍš‹ÃGLÚu(aNaÕËŒêhÂàCˆ•»‹®Ž5ÅÚÑr¿ ßÿÝÙùƲÁÓ1ìʹüXŰýãUÜÞ½N o©endstream endobj 158 0 obj << /BBox [ 2693.13 6189.35 2715.39 6211.61 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 181 >> stream xœÝ=Â0 …wŸÂ'0¶óãøHl”TP $ÊÀõIQ›"À%ß‹óžãM'pxÀ4{  YŠSH¨JšÅÚ>žðˆ7`U6dŠÆ§ƒqb+8“G"Ž˜•ë}Áë§’(U×ìNâ;eG5ޤ©qU©ùòQ!b^V~gL/fEjVlâBjkÆÌ=´.–Š¥ËÅáë=œ!P æ†OÜÕuù1ŠnûÇ£8À^™nxendstream endobj 159 0 obj << /BBox [ 2605.56 6346.14 2627.83 6368.4 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 177 >> stream xœÝPÁ Â0 ü{ O`l'±Ó øQ € HÀƒõI(iˇxDÉîίz‘€Ãn Æ‰’£…h$UI“çé¾qW`UvdŠÎ]¬çÄU0Ô §˜KFrRÇË‚1¥PRM„,Tl•/ØÈ'x(r[4Q'‹€†ÇoGcJUÁ9!fb›GŒ°Z‡&˜Z¾q€ÊÁ;Ç'nÊ9ÿXD¿þÛEì` /‡­mÍendstream endobj 160 0 obj << /BBox [ 2562.63 6425.05 2584.9 6447.31 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 178 >> stream xœÝ1Â0 EwŸÂ'0±Çé Ø(@P $`àúÄj›–…0Dɳ¾ÿw¼é™#/x€hÊ s¥ (B¢VÚý<ãïˆE‚a d¡Kþ° Áƒ{$R­1¼­*‰«V.dŽJ±«h‘,7>gQ‘•¢u¶2˜yŒðŽVabÆÅA²×—Œ‘½cb´©'ƒï_œà‘J´ª}㮞ëEôÛ¿]Äöðãn]endstream endobj 161 0 obj << /BBox [ 2553.78 6442.81 2576.04 6465.07 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 180 >> stream xœÝ½ 1 …{Oá Lœ8q<GÁNB‰£`}PŽ£aŠÈy–ßçŸÕÀœp¼Ã bΉ´b‰Tc¤XXç8qWÄ1Å@¢Á¤}4äàÆilŒLÅœá,ËxYfŒ‚S³Ç*®K"ή‹ñ¬î(FV*ÞsA˜õ«GsôŒTªŠ‚iZôxëæèSôŠ>e'|ïq€$ªIMñŒç§Ö|Šlá Ù«oMendstream endobj 162 0 obj << /BBox [ 2568.41 6417.48 2590.67 6439.74 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝA! E÷œ¢'¨´ZN`âÎqá&:‰‰&êÂë £Œ¸ñ.Hù¥ÿµt5˜îîê8&C!HBŠbÀŒœH—x;À.Î#1{¢>K½¨^ nSa¨Ç ƒ Á¹Ë„€©Ð¢J¥­h\uÆ(‹‹Ãwf¨©#4ýê1;Z&TÖ‡@¥k1ËZßfhïmè·ýû£;º€4+<Á¦œÓ= ëÝÃÎmÝüÔmÄendstream endobj 163 0 obj << /BBox [ 2598.3 6362.83 2620.56 6385.09 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 181 >> stream xœÝPÁ Â0 ü{ O`;±“ øQ PA%$€ë“–¶ àaÅgÝÛt!(O¸ƒ¤’IÑÔ„²¢‰ŸÞä'<â ˜‚;2EçÇÆ9ñH@Œ™$TW*†×vRˆ+ޤVqVÝ E]q_!Rj!“ÅÆ`ÅÓŠI0O,SθX$͆Ë +c¾q1øþEgЉÇÜÕºü¢ÛþmØÃðÈm‰endstream endobj 164 0 obj << /BBox [ 2637.04 6289.86 2659.3 6312.11 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 183 >> stream xœÝA! E÷œ¢'¨mN`âÎqá&:‰‰&Ž ¯/ÃŒ8n<€ ¯ô>Ýt̆‡»;QoHTRƤ ‚¢lu0žà7GÈ"d@Œr˜F‘,Á8L ³‚z"Ì ®ëŠ"E ¹ ÊD Yߨ—öèQÂç>ú´R7®þU0W$GÌU1Hf,¡Ú OŠ9AkX6ƒï/ôîì<&oÙàéve]~L¡Ûþçnï^)lVendstream endobj 165 0 obj << /BBox [ 2679.15 6208.08 2701.41 6230.34 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝMÂ@…÷œ‚ 0? '0qg]x€F›˜hb]x}§­ãƸ˜0x°éD¸ƒfs’„Y¹T%ÍbkOxÄ0‰*2EcÓÇ8±‡Ê(Bµ˜Uœ¯MB#i…æ’HeÒ…¢VíLê«î«Ã…Ôv8Eo‹žĞ%I"~ ¿Š©w?×Öe߯¯å{8C Ì Ÿ ¸«ïòãünûgç`/Ú–i°endstream endobj 166 0 obj << /BBox [ 2720.2 6125.23 2742.45 6147.49 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 178 >> stream xœÝ=Â0 …wŸÂ'0þIâæHl”TP $`àúMTZÂÂåYï}v¼éE Ç'ÜA]™“h$5T%óí>NxÄ0‰*;2çêÃ9r5Œ $R–È^›J …éš*µèHÑ‹6!ÓU%Q³¹q¦h aÑsšX+BšñCP'‰MY×Ä2ÅâXç~¾ÿ1ÀŒ:óìøÁ]9—«è·¼Šìaù¾mendstream endobj 167 0 obj << /BBox [ 2757.09 6046.93 2779.35 6069.19 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 177 >> stream xœÝPK! Ý÷=A--P8‰;Ç…˜è$&š¨ ¯/ÌÈ„¸ð.Hyå}J7ƒsŠÓî Œ8cd)+ŠDgs –ðqÂ#ހɉ°!“7ξ^ŒWÂT=2±+!Q!]»NT*Qbµ†ŠÄ*N$²â±(LIrÇ0#¯CÃKƬhùù#÷‰Rè\ém„ÆX‡VüþÁgPJjÙðwå\~,aØþå°‡7)¢lXendstream endobj 168 0 obj << /BBox [ 2788.2 5976.21 2810.46 5998.47 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝM! …÷=EOP¡À´œÀÄãÂLtM^ßâ0.<€ ïÑ~ýٌޜpUbLYbÌă—v/'<â yf'è(ŠË±<Ä%'ŠËlˆ\þ¡B!âõÃÉLѨ’£ñŠ(¥¢s‰¬zV©&•R쀦×ï„êX«‚ J6[¯°ê z-¢v½¾¦˜à 4H|‚ÇËEŒÛ¿]Äöðã¶nuendstream endobj 169 0 obj << /BBox [ 2813.02 5914.19 2835.28 5936.45 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝP» 1 í=…'0þ$—x$:Ž‚œ„P°>‰Ž ¡aŠ(yÖûÅ«QÄpzÀ 4‹+F—@â¨JSn÷ýˆ{¼“¨rB¦ØC}$Ž\ SõäV<4’)^º‰1YqÍâÄ^q hkI‹ ŠBT;†ÙÐ9,xΨŠ6áÒ?2H—1ãªXZ,ŒÖûíðýœÀ([ò„OÜ”sþ±ŠqýÇ«ØÁ^?n‘endstream endobj 170 0 obj << /BBox [ 2831.95 5860.35 2854.21 5882.61 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 177 >> stream xœÝP± 1 ì=…'0ŽÇÉHt< x $ `}PþŸ†("ç.¾;Ç«!„ˆãn %ªŠZ2SÌ(B¢V¦z?â¯ÀDØ)×Ô.ÆÊ­al‘й‡J/K&“*:.Ä⸸ÐaŠÄµÃƒ÷§BAçwõøºOøÐÉ™’àl_&|pSôzG±;|â'p"Z5|BÀŸó= ëÝöð{¼nBendstream endobj 171 0 obj << /BBox [ 2845.83 5813.28 2868.09 5835.54 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 181 >> stream xœÝPIÂ0 ¼û~‰ÅÎ ¸Q< ‚JH Q|Ÿ¤¶\x+Ë3ã̦cö8<àb!’yŒÆžÄP„$±ÎïxÂ#ÞÀ‹8EGA]µQŽCÕPÒP4$P`¼®'¹0P,2™ì=%©8QŽ3î # 9Ym¤DÅQ˜ñä11>Îä. ‰óÊã+£]Ñ6Ú•Máû=œÁ—p4+>qWêò#ŠnûÇQ`/âvoCendstream endobj 172 0 obj << /BBox [ 2855.8 5771.26 2878.06 5793.52 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝKÂ0 D÷9…O`bç3Î ØQA%$( ®OZšªl8‹|Æy3±7H þéN-%6J€°fR­»`9‡3éî<‹ªyŽð%Žøäa4ôcZ3L9Òm]ÇjYØPuždæš> >> /Subtype /Form /Type /XObject /Length 178 >> stream xœÝ;Â0 †÷œÂ'0ñ#µs$6ÊÀ*¨„eàú$ˆ´eá y|Žÿߎ7=‘Àø÷ÀÞ1f‚dÂÈ\öŽ–s:Án!"1Gƒˆj1k½XLѦ±z(ºT¸®^PØ1{áÄØQaSŒ:óP–‘h•ႜV3×UÐâ( ‹(òªÂk~káóÞ:lò¯/ á],<Á®¬Ë!ôÛ¿Â!ìà ¡ÖlÔendstream endobj 174 0 obj << /BBox [ 2868.34 5694.51 2890.6 5716.77 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 177 >> stream xœÝP» 1 í=…'0Nâ8ÎHtœà$$€‚õ/¹? PDÉ{zǻƹ€ÝžàM‚`Ô,zO>&[î×Ïø&ç='d’ÄYê#qä*èJFbòбP¤ïÆ!($ Y¬0“è‚Û¢·Ò¾U˜‘ÚêŸáX0f†)Š1@³’„µbÂÕ1ΰ æ™§€ï?´p…@RNø‡‡rn?ÖÐìÿt '8BŽàmÍendstream endobj 175 0 obj << /BBox [ 2872.95 5656.23 2895.21 5678.49 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 181 >> stream xœÝ1Â0 EwŸÂ'0‰ÇÎ Ø(¨ HÀÀõ›´´„…0DÎwüŸo:ïO¸›2eAI’ˆ2'¯S5|œðˆ7p䙢£¨.ÇzQ'® •ÉRa$¥ðÚd =ªi®"‘´Y¤ÂZt_Ê-“MEű/znPk†küÄÈKÓcÖÕ1°<¯¿íß?èá ,hV|Ç]9—Kè¶¹„ìa[|mendstream endobj 176 0 obj << /BBox [ 2877.6 5616.16 2899.86 5638.42 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝ1Â0 EwŸÂ'0±ÝÄÎ Ø(¨ HÀÀõI()eá Qòÿ—¯zfÅñW7£„1q"N(B’ØæývÀ=^ ‹Ã@…ÜÕƒ…Ìñ6VD¦(…!F’ñ¼¨¨ª»Rª¯h¢X¥“i“CéÏJþ¹ÎF¹[¸›žø¯þV)9g?;_ð'] -@ë˜#¿ß_à…¨– À¸)ëôc ýú?§°ƒ-<gŠmcendstream endobj 177 0 obj << /BBox [ 2882.82 5573.28 2905.09 5595.54 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 180 >> stream xœÝP;Â0 Ýs ŸÀÄNRÛ'@b£  ‚JH ×Ç)J[À9ÏzÛ›ž(Áø ÷ÀªŒÊPŠ$dfäŽdªE'8Â-D$æ(1K´\?K¬„±zd”ä^3ÁuÝ1W€cEUÇ–°cÇ^­Ìxp…FZR·8,xÊpÅÜÔaq‚d«Œ®mŠÆhS6‡ï=†p 5‰ ¼ÁÎßåÇ)úíŸâöá Y‚o´endstream endobj 178 0 obj << /BBox [ 2888.96 5526.87 2911.22 5549.13 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 180 >> stream xœÝ1Â0 EwŸÂ'0¶ÓÔö Ø(¨ HÀÀõI)4`ˆ’÷å|{Õ‰$îpuwŠsÖ–ÜP•´•zß¸Ç 0‰*25ÆÑŒãÌæxŠG0¹dç…Ò$⌅3qÙH5˜‰c抒IÚeEP’ê0óÔãõã£(…buP§¬ö˜¸‡šâ]QsO_sôp„Dž,  ¸)çôcÝúW±ƒ-<Æno&endstream endobj 179 0 obj << /BBox [ 2896.17 5476.55 2918.43 5498.81 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 180 >> stream xœÝ1Â0 EwŸÂ'0¶ÓÄñ Ø(¨ H”ë“P¢V €!Jž“ÿýãM/p|À4{"1Œ%ŠUISá¶O'<â ˜D• ™:cïêÁ8²eœÆê‘‰½xd£äx]U\ɪsñ‹•yE£ P¥—{)at%o<7x ZE)\ ,S—Wf®Šáób =;|}b€3ÊÁÜð ‚»².?æÐoÿuØÃ ¦Ènuendstream endobj 180 0 obj << /BBox [ 2904.63 5422.26 2926.89 5444.52 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝ» 1 †ûLá Œ_yM€DÇQ0À NB (XŸä Gh€"‰ËÿgÇ«Yaº»«“L†AÁ›J€ù渼·ìáâY„"Z¤l5ˆä)&¸M•Ð[a¨¢f8÷™„V¨™ C.ÚWí1úEÅ!„‰» 1Ì¡#,zî1;ÞI¨ BÉsêz¼tu´)ZE›²¾ÿ1º£SLs„‡cØ”sú±Šaýǫع­{2Fnendstream endobj 181 0 obj << /BBox [ 2914.14 5364.08 2936.4 5386.34 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝOÁ Â0 üg O`llj“ øQ € HÀƒõqJ[ʇxD—³ÏgߪcŽÐ?Â-HeEVH1+R”Ì6`²÷#ìáY„ Õ¨jû%j‚¾yd¤ì–P.‹J!w­âب¢J£.´™| F](¢cYLü½b˜˜*Ô|r^,pÒ´ãú¡5;Î}§±D«ÏÀ°ñwþ‘¿[ÿ[þ]؆Œëiýendstream endobj 182 0 obj << /BBox [ 2924.63 5302.21 2946.9 5324.47 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 183 >> stream xœÝIÂ0 E÷>…O`lj“ ±£,8@•@¢,¸>n¡À"÷üŸ‡MBÄîw*JY1E’€âw²2¾9ö'<â ˜‚2©qÕácœØûn`dJÉ!RT¼®#…Ô©52åêÚ¹wÈò¬[w(S‘U†*U[f=ÖŸÃ…ÀJ>ÞRã­ÇÔÅ”1u9¾çhá ‘J4¯ò„€;?—«h¶¼ŠìáSnhendstream endobj 183 0 obj << /BBox [ 2935.89 5236.91 2958.15 5259.17 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 180 >> stream xœÝ1Â0 E÷œÂ'0Ž]×ñ Ø(¨ H”ë“PÒ–…0DÉ·þv¼ébáØE19(K‹¹6ßã Žp „‘™ #oÊÃHÉŒCa¦Œh’Âu)¨`ÌLo"ºmÈZ´!ñ¬ûPFò•C[dYªžZ¼µÂè ‚$L²ê1é’¨STGúøúDÎA²ÍÜà"ìò¹üXC·ýÓ5Â>¼ëžm8endstream endobj 184 0 obj << /BBox [ 2947.76 5168.55 2970.02 5190.81 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 177 >> stream xœÝP91 ìý ¿Àärì¼‰Ž¥à+X $ àûÄYKÃ("g¬™ñØ«ÁûˆÓ®JFöY‰C ½´Ê¢x;à/àȇà%qUR?âØa2BY«‡´z^t4™{(I£a%-†[íx¬Š©ð‚Qó¸²pèxžÑ½“({ü8ˆ¥\̘±)zŠÎxç~9|ï1ÂL Eð7õ~œbXÿñ)v°…'à°p&endstream endobj 185 0 obj << /BBox [ 2959.99 5097.42 2982.25 5119.68 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 180 >> stream xœÝ½ 1 …ûLá ŒÇq<GÁNB‰£`}q„£aŠÈy–ßçŸÕÀ,0ÞÃ-DWGwPrÃÄ#ÆÌÖãt„=\!ÇH„ÉÈSû)Yi¬ŒÌè ÊTP.‹ æJõœ‘´iCÓª+±ëCuXFöEE!YÞúÕ£9zF0èrGIŸ³nŽyŠ^Ñçž ß{Â)17x†M}ç§Ö|Š]؆'B»n™endstream endobj 186 0 obj << /BBox [ 2972.53 5023.83 2994.79 5046.09 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 180 >> stream xœÝM 1 …÷9ENÓô'É wŽ 0耠 .¼¾S†Žuã\”ö…¼/éÛ !DœžpqÊ3K$‹(BR‚®÷ã„G¼SaE¦¤ì©>”3«ácªŒD)ÏŒ˜È ^»Jbâ™êj”½êD•î©”U³ÃŒ4v.dÚš^fTG«ˆ“9~’Is7cÑÕѶhmËFøþÇg¨¡¨+¾ àn>—Q Û?Žâ{x¿šo=endstream endobj 187 0 obj << /BBox [ 2985.11 4948 3007.37 4970.26 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 178 >> stream xœÝ;Â0 @wŸÂ'0vâ||$6ÊÀ*¨„eàú$­šV €!ržå<;Þu"‡<ÁY$‚jšÑ9rQR‹ãÏø&qŽ2ibÓzI8e‡*HÄZÁJÞ7™¨$Åj&5Îäµr$÷à™…¼´Lá@šaå¹ÇôbÉ(qÄÕ Fæ6=fîab©hsO†ïôpOÙ'KøÁC9·«èö¼Šáa¼n{endstream endobj 188 0 obj << /BBox [ 2997.7 4870.16 3019.96 4892.42 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝPIÂ0 ¼û~ñ’ÄÉ ¸Q< ‚JH ¾OÓÒEx‡È™±g¼lÃî wÐRœCv&I¨JšÄ‡=ãã„G¼AŸSeG¦à\Bý8G®]µ(”´÷ÈBZðºfYBc6òÚ¥0Å 3å0ÁŒÅ¨,iÉÄq¥žñà?ÔO¤Š³Þ•8¯üG\Ó#³ 8|¯ÐÂŒ²yq|à®—Wh¶ÿy…ìá Ý lÌendstream endobj 189 0 obj << /BBox [ 3010.25 4790.43 3032.51 4812.69 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝ½ 1 …ûLá Œ’ø2GÁNB (X…ÜÑ0E”|Öó{ŽW#³Âô· Ä„’ Z!Œ "N6ôû~„=\!‹kŒJ¬£DU0UAÎbL.ËJƬàœQÙÙÓÌœ…Q­óÁ;$×üY¡„©,:¿3jG«Xɘ XÔ4G4® mˆ®hC~ ¾q§ 8¨ƒg`Øø9ÿXĸþÛEìÂ6¼•Zlöendstream endobj 190 0 obj << /BBox [ 3022.62 4708.86 3044.88 4731.12 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 178 >> stream xœÝM1…÷='@ RN`âÎqá&:‰‰&Ž ¯/Íüºñ.úQÞƒ²kcè_ᄘ13$¥‚%ƒç¨K.p†G ŒÌ¤@è…–êE©!-0ôÕ#a“Ü#šÁ}“á)ƒsA­hÈN"¨yÆÎËÅ›óúžM7ê™Gÿ*X2 M`5ˆ>˜m:Œ\ÓsÁ2òdðý….\ƒ`õ&ïáàçöc íþ?·p Çð¶ l†endstream endobj 191 0 obj << /BBox [ 3034.91 4625.5 3057.17 4647.75 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝP;Â0 Ýs ŸÀر·'@b£  ‚JH Q®OÒ6UY8Cä<ë}lï:fážAH[MÑÐ FŒ‰}ªãÎð„#9ªS«åãdä ŒC1HØH6È5 Ü7etRÂÖ 4l´à„¤+î³À™7 ³¿T8'L‚Úa´‰±DG•MÄŒ‹¢QëÔ‹Ã÷}¸É Ïšw`8äwûqˆnÿ·‡8…cøŠ%l¡endstream endobj 192 0 obj << /BBox [ 3047.03 4540.34 3069.29 4562.6 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝPAÂ@¼ó ^€°°Ëö&Þ¬ÐhMÔƒßw[»m½øv€6­ˆbÿ„;(›+Z4&5 BŸãã„G¼“„ÀŽLæÜØðqŽìý ‘©‰E# YÆë:“(*G%‘‚S!0SŸ`Wú“RÐ¥žœ4¯è3Œ„)c‰,à"`ÅøzÂŒj¡vT‹Uá{‰Π”ÕÇîÊ»ü¸C»ý×;`o,pm endstream endobj 193 0 obj << /BBox [ 3059.06 4457.25 3081.32 4479.51 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 180 >> stream xœÝPKB1Üs N€´”òzw>ÀèKL4Q^_úþn<€‹†f6m‚Ý  ¬…8cJjc¤˜ƒõU­Áçx¦#2%ã’êÇX¹:×ÈL¥qÜÞVJ +¹¥c#-ŽÍËŒO>aZýWŒBi%0ÂÁ¡ç ! ¸Œû:1p˜"LŒ9ô¨ð½Ä . ÔˆÃ7Üù»þ¸C»ý×;`¸@m€endstream endobj 194 0 obj << /BBox [ 3070.98 4454.99 3093.24 4477.25 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 182 >> stream xœÝ=Â0 …÷œÂ'0¶óãøHl”TP $ÊÀõI(iË¢䳞ßs¼é˜= wwž”Ð2„šJÔü¾+Œ'8ÂͲ)% õ¡©Ç¡z”Š®«Š2²AaEŠ•#z_8KU6îKGVä¼R£—•Cã)£vÌFJ°8ÄT³—Œ‰kG›¢)æ¹?ßÿèÝÙyÌ^Máévå\~¬¢Ûþñ*nï^»bn endstream endobj 195 0 obj << /BBox [ 3082.86 4509.08 3105.12 4531.34 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝO;Â0 Ý} ŸÀØNÒØ'@b£  ‚JH Q®OZ)iY8Cd?ç}ì]/p|Á›’u;±¡*i'¹Õé‚g|“¨rF¦˜ÙãÜdNœ §qöˆTÚ˜”IïÛI"5,ØÈuÆNQ ö@n Eá%¿[Ât5hpI(ü:Dq•‹lÜe¡¶ðå¯nV…ß»p…@²g|ƒà¡¼ÛóûýŸ‚#|{»iKendstream endobj 196 0 obj << /BBox [ 3094.62 4599.4 3116.89 4621.66 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 180 >> stream xœÝ1Â0 EwŸÂ'0vìÄÍ Ø(¨ HÀÀõIJ `ˆ’oýÿìxÕ‹(Žw¸‚r6JŠs&Ã($ñvß¸Ç 0IìÈd^õáÙ;¼‘(F´$LÑð¼¬DJ¨ÂL)W™É­êH›@¥D»°pˆQN@“S‡)0W Ê&Ç `! ‹/]ï!fG›q&|ýb€#(uêÙñ‚›rN?ѯÿv;ØÂ~løendstream endobj 197 0 obj << /BBox [ 3106.45 4709.83 3128.71 4732.09 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝP;Â0 Ý} ŸÀØq''@b£ A%$€ëã”¶”…0Dñ³ÞÇöªQìpÎFãJ%b²Øð'+x?â¯À$!°!S#ÆV'n„¾yÒì©^–L¬¨"’8Vw²†’Íøà OÌqÁp¥Õ…ÃŒ‡ŒA1v$QÅYZD¼qLCLŒiÈÑà{‹œ@©¨yýÁ¿óCtë¿=Ķðê~mCendstream endobj 198 0 obj << /BBox [ 3118.27 4828.2 3140.53 4850.46 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 177 >> stream xœÝPIÂ0 ¼û~‰—ÖÉ ¸PA%$€ßÇ¥¤-À!rÆÏL¼Ú1+ö¸2gGËEHZö©ÞxÀ+$b‘ä˜È<.žšäï}HH¼—ÐB*xYtÌÈ0 ‘ê35o\¢]a| ^» h¦–çù Gƒ÷@íXÅY@Øg‡5ÂD¨™?ßèàJY½8>qçüc »õŸ®a[xª¸lendstream endobj 199 0 obj << /BBox [ 3130.09 4945.84 3152.35 4968.1 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 178 >> stream xœÝPÁ Â0 üg O`ìĉ“ øQ PA%$(ÖÇQiàÏòÝ9Þ Ì¦‡»»À H‘ˆYÀ{ô‰µá|‚#Ü!{O „¢T¤J‘4Ã> >> /Subtype /Form /Type /XObject /Length 181 >> stream xœÝ=Â0 …÷œÂ'0þ‰ëäHl”TP $`àú$”†²p†(ù,¿ç¯zf…ñ®A9 ’€‘9²JÇþºÍܰ‡K dr ŒN9Ö‡“Qm«‡bÖâÑ%‡ó¢âŠ¡pBJ•c.lŠEaE»hèµ[Ì<¨‚VQ†f`KÐÏ„‰«`Î0w´Ôoƒï_ á“zvx†M9§‹è×»ˆ]؆'ì+mEendstream endobj 201 0 obj << /BBox [ 3153.93 5158.82 3176.19 5181.08 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 181 >> stream xœÝPÁ Â0 üg O`ì8Ž“ øQ PA%$(Ö'ii à9wñÝ9ÞtÌÃÃݰ feM˜> >> /Subtype /Form /Type /XObject /Length 180 >> stream xœÝ» 1 †{Oá Œí<œL€DÇQ0À NB (XŸä Gh€"r~ËÿçÇjq8Ýá Nb 1¨Ïd‚ª¤Ql‰·îñL¢Ê†LÞ8ûú1l oSe¥T‘)y<÷™BtbJ¬E‡ª8/z,ޤ$±«H‘œt„EÏ=fÇ;™á‡„¢ëz¼tu´)ZE›²¾÷᎒³løÁMy§§Ö|Šlá î»nPendstream endobj 203 0 obj << /BBox [ 3177.98 5329.79 3200.24 5352.06 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 181 >> stream xœÝ1Â0 E÷œÂ'0vœÔö Ø(¨ HÀÀõI )eá Qò­ÿŸ¯zfñ®AXÝ Kt4ˆcÇ:ÝY nØÃ%rŒ¤@˜”<Õ‡R¦j+Âѹ ¡G8/+ÝAØR.:RªÚ qÖCIxB¶…à E„YO=¦Ä»"­ƒA•=^º&ÚÍѦl„ï áMÔaSÎéÇ*úõ¯b¶á ¿ùnJendstream endobj 204 0 obj << /BBox [ 3190.11 5400.21 3212.37 5422.47 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝP9Â@ ìý ¿ÀøØ]'/@¢#< ‚HH ßÇ(xÅÊ;£ñŒíU'b8Üá &-“æÄL*¨JZÄçz;à/UvdJÎm?Ι½ÁÛ0z(±…‡YÂó’)”’&°2匦,¤yÆ=SÈd¡È*Õ¡âWÆØña¢S«+Åz5ã{¨SLŠyÊÉákŽ`Ô˜·ŽÜÄ;ý8E·þãSì` Oˆllùendstream endobj 205 0 obj << /BBox [ 3202.3 5462.44 3224.56 5484.7 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 182 >> stream xœÝPIÂ0 ¼ç~‰—Äé ¸Q< ‚JH Q|·¶\x+kf<ñ¦%èá„#£@Ǫ̀ ÌÈÉÊôf2Np„[ˆHÌÑ ¢Zltl,¦èÄ¡-™ÜÃS†ëzR0+8.(Ùqat‘0 *ϸsÔfÅð®\f<íu’ &X ²¢¤ÕŠ75DeÔƒï_tá‹Xcð ;¯ËC´Û¿=Ä!ìà ¤˜m;endstream endobj 206 0 obj << /BBox [ 3214.57 5518.26 3236.83 5540.52 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 177 >> stream xœÝPIÂ0 ¼ç~‰c'N^€ÄràTB‰ràû8…´åÂ8d{f¼l:"†ááîŽ F…)cH‚ݤó;žà7ç‘Bð E}‘úQ½f‡ê‘PŠy„‚×U€%›“Tœq‚•ìÏæ§KÞd%¬ä Oþ¿™aÑ[Ê«o\­ƒÆ˜[þ8|л³c̬Eáévv.?–Ðmÿr ·w/”zk¿endstream endobj 207 0 obj << /BBox [ 3226.86 5569.34 3249.12 5591.6 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝPA1¼ó ^€-”Ò¾ÀÄ›ëÁltMԃ߷ínÍzñH¦›Á{Áé wæH)¢jÌ$™‰£·öª%|œðˆ7p䙡£`.‡š˜SW SÕHTRÕTú¯ëŠ’¦ÌgŠ©b£œ?x,AÈ銌x%Ðaû¡ñç‚)µö2m¾ø_éϸò»ƒÎèïF8ƒPˆ/ð¸+qùq…aûŸW8ÀÞiïmendstream endobj 208 0 obj << /BBox [ 3239.19 5617.23 3261.45 5639.49 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝ=Â0 …÷œÂ'0±ãäHl”TP $ÊÀõq[R……0Dñg=?ÿl:"áAX RÝ’! 0#{¸þãNp‰9DLKš‹-Ã8¸G"$rÎ(·&#‚IÀY‘ubCÍÎQxåÞ+TQJ«(¨Ò8T^zÌ5#8 >ä iÓbá© QëØ‹Á÷}¸Á,V ^`ïïúãÝîoq ‡ðm[endstream endobj 209 0 obj << /BBox [ 3251.57 5663.14 3273.83 5685.39 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 180 >> stream xœÝ1Â0 E÷œÂ'0‰ä7'@b£  ‚JH Q®KI[À%ïëûÛñ¦ A©¸»SI(å¬"‰°$4ÓMÉŽtsžƒˆyŽð%ŽøäÍ6ôc‚r,–€Èº®•ªd ÎѸ1ÆY3vVÁÀÊ€ÀEV3¿[ŒUÉ……–€œØ§¥Ã„£¿ŽP uÄOý÷:wvÊ¢€ž.ÐÎÎåÇÚퟮáàöîRìmendstream endobj 210 0 obj << /BBox [ 3264 5707.96 3286.26 5730.22 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 178 >> stream xœÝ=Â0 …÷œÂ'0þIbçHl”TP $`àú4-²p†(ùœ÷ž¯:f…á®A%GHF†%ƒJf›öd·ìáY„ £Q‰õ`”¨ †°è˜Á΋‚Dä *FH^ÙQ+&䨰õN(Ÿk¨yán<ÅOòVˆH“a¶SA÷EüÌÕÐú7ÅûÁ¯€¯ôá]­<Ãf\§#èÖ8‚]؆' jÑendstream endobj 211 0 obj << /BBox [ 3276.44 5752.38 3298.7 5774.64 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 181 >> stream xœÝP;Â0 Ý} ŸÀ$v''@b£  ‚JH Q®ORÚÀ9Ï~ïù³é¼pa‹ª)“$d&V{Çè ÇñŽ<³3tÌåP?æÔâ8TD‹GR×6“H '®5c2®ØHmÅ}Qd¦FŽd¹qXñÔcRÌM?Hš¬üe†¹¾Œ¸È¿—èá BI,>Á㮼Ë;tÛ½Ãöðs£n:endstream endobj 212 0 obj << /BBox [ 3288.99 5796.59 3311.25 5818.85 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝM1…÷œ‚ …¡”˜¸s\x€‰Nb¢‰ºðúÖŸéèÆ¸hÚ÷B¿,ú”Ç+œA¥Š‚æ‘ÉEHròv_v¸Å0%vdꜣ{<œ½àe¬Œ` ´ÂN®xœ$äU±=t¦PTåÊKMP£šöQ¤2š~E<LŽPÎØ…L挷 u1U´®_€ï!؃RQÇ$\Õsø±†~ù§kØÀîèmendstream endobj 213 0 obj << /BBox [ 3301.52 5840.71 3323.78 5862.97 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 178 >> stream xœÝ½ 1 …{Oá Œíü8™‰Ž£`'!¬ÊÝÑ0E”<ëù{ŽWƒHÀñ7…’b*‘ÉUI“•é¾qW`U6dŠÆ5¶‡qâf#P ÎHB%âeYÉTÑ¥Qª.³G×¢”Ó¤Þ Öâg‡:*Ï€I¾ZC¯ÄLf8¢£Ã"â£[G¢;úŒðý‹œ P V Ÿ ¸ñsþ±ˆaý·‹ØÁ^L¦m±endstream endobj 214 0 obj << /BBox [ 3314.11 5884.62 3336.37 5906.88 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝ± 1 E{Oá Œc;q2GÁNB (XŸË)ä aŠ(yÖÿߎWCŠãn ŒBÀ˜³Q!‰žû}?â¯ÀDؑɜ‹Õ‡sä*kF"Ö)£DrÃËR)Ì”QU¦¯hTRåH¢“A™ôC FÃÖ`Ö¿+LiVÌþœE[4®†6BWô™[À÷p¥¬^Ÿp3ó5 ë?]öðŸúlöendstream endobj 215 0 obj << /BBox [ 3326.74 5928.06 3349 5950.32 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 178 >> stream xœÝP91 ìó ¿À$ŽÛ/@¢c)xÀ VB (ø> {…†PXöŒ<ãcÓ…axº»‹‘2 C2Rô ˆr%?Np„›óˆ¼€Go\ ñÉ‹Âc¨Š9h ® ÃŒ” µBÅh êŠû"`B㦃½63G|3ÃX®YÈд™1⪘–˜–­'ƒï+zwv5Š ¼\€]‰ËGtÛ¿}ÄÁíÝ\–nÂendstream endobj 216 0 obj << /BBox [ 3339.39 5970.79 3361.65 5993.05 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 181 >> stream xœÝP;Â0 Ýs ŸÀØq\Ç'@b£  ‚JH ×'-¤„…0Xñ³ÞÇñªgïáDÄQÔÐbĨ–ç·cƒÛöp „#&#OSc¤Tˆ·±x$Fáâ‘áÜN:ô +&-ØK´ˆj\ðPª¨Þ2M‡Ï³â=±³ÂÇÁ"7/<)ê•Q·¬ßÿÂ1f17x†M©ÓSôë?>Å.lÃÓ?o'endstream endobj 217 0 obj << /BBox [ 3352.13 6012.45 3374.39 6034.71 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝ½ 1 …ûLá Œ’8™‰Ž£`'!ÄQ°>(ÇÑ0E”|–ßó‹W³Âx· š2±`L ‚’Ùæ{:®EÈ€0ÕØF‰¬À46ˆ”ÜC“ÁeY)˜œ ruVA«ÎYÝæƒ+rA•E‡yž¼p˜ù5£)z… &†GÔ¼˜ñæ¦è)zGOÙ¾ÿq§ XÔªÁ#0lüœ¬bXÿñ*važ•Ämÿendstream endobj 218 0 obj << /BBox [ 3364.87 6052.71 3387.13 6074.98 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝPA1¼ó ^€PÚÒ¾ÀÄ›ëÁltMԃ߷]íZ/>À!Ì0°D§;\A5zJ†‘ƒ#tŽ\[òí€{¼“8džLÞ8ûZ¶„·©jD²\4¢R xî;‰² ª1e-Ø”8T‰eÁca$!¶n"rÒ),xÞ13Þ¨ù(OÑw;^¸2š‹6Ñ\6…ï;F8B)Ô²á7%N?^1¬ÿø;ØÂ8…n¦endstream endobj 219 0 obj << /BBox [ 3377.67 6091.3 3399.93 6113.56 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 180 >> stream xœÝPIÂ0 ¼û~±ã4Ž_€ÄràTB 8ðý&¥ åÂ8DÎŒfÆË¦QŸpU3J†‰]H1 Il®e|œðˆ7`’Ø){¬㎫`¬N]Æ$(*^׌QtTÍJ¦‹PŠg2ox(WÊi¥ðL,«„†ç³ãͰ©aKàRƒ|z,¸:–)šb™²%|ï1ÀJda _ ¸+ïòãýöOq€=Lë6nˆendstream endobj 220 0 obj << /BBox [ 3390.56 6127.99 3412.82 6150.25 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 181 >> stream xœÝ=Â0 …wŸÂ'0vœÄõ Ø(¨ HÀÀõI(%`ˆ’÷ôòùgÕ‹(Žw¸‚ª3¥ŒY‚‘;†@!‹½îdÞ¸Ç 0IlÈ=Ö‡qâ+#Pì C ø¼pb$q,:SÖª;RE,”ý£(N&K‹„0yÌrªP󳉶ïÁÉeQ`Ò´Þ‰ÖôDøb€#(ujnøÁM9§{è×ÿº‡lá wm6endstream endobj 221 0 obj << /BBox [ 3403.46 6162.59 3425.72 6184.85 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 180 >> stream xœÝA! E÷=EOPi N`âÎqá&:‰‰&êÂë[&C7ÀWþÿ-lfÅé wДbÆÌY(U!IVæ=³áã„G¼A  †¢…ÛÁB .|L-#‘šg˜’1^וBVѹRç"TÕ™cëÖytWÊi¥¥² è8whú¥K³}ìÙƒWù36y`¹ïóuû÷ F8ƒÇ«UÃ0î|]~|°ýËO8ÀÞxlIendstream endobj 222 0 obj << /BBox [ 3416.4 6194.98 3438.66 6217.24 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 180 >> stream xœÝ=Â0 …÷œÂ'0þIíäHl”TP $`àú$І²p†(yO~Ÿ¯zf…ñ®A#jã1'A1övß°‡K dr ŒN9Ö‡SGžà6VFB0!Cf8/f,…WREwÕ/Ú±Ó¦‡’PA[¨¡w À¬ß-^Ùa¤3€³aÊŸ“®i†VѦžß¿Â1(&õìð ›rN?ѯÿv»° OÅ6mendstream endobj 223 0 obj << /BBox [ 3429.4 6225.12 3451.66 6247.38 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝPIÂ0 ¼ç~‰—Äí ¸Q<A%$€ßÇIIÕ^x‡h<Žg¼l"ñA”{TÈÌ ‰9“ULÖÁó G¸‡è "ªÅ^K`1ÅR0º… ¹‡dWÁm‘ÑŠÎj.¼¢¨FL2ó“+> >> /Subtype /Form /Type /XObject /Length 180 >> stream xœÝA! E÷œ¢'¨PZ '0qç¸ðÄDÇ…×·8aÄpAà—ÿ_ ›!„ÓÃÝ]d&dDBX!‰æe‡ùG¸9È+xdõ…ëA½x³ÍS%0F5Bbô ×¾R00Q‚i•Y"Š®z´„dLÜ9¡–ްêwšhK…Asìz,º&ÚÍѦl„ïwŒîì¢Õîž.ÀÎÖåÇW Û?þŠƒÛ»tnfendstream endobj 225 0 obj << /BBox [ 3455.54 6278.34 3477.8 6300.6 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 178 >> stream xœÝPIÂ0 ¼û~I'v^€Ärà*!D9ð}ê–TåÂ8D“±fÆË¦‹1aÿ„$É™²`a5J‚ÌÄ%ê‚Ãx‡@‘9( Uü£!5zÏP’2fXu¼­*U<=I‰TعQ1çűñÓèÐH*+…f²ºJh|î19ZEh|,çU‹™»¡ ÑËØsÀ÷'¸@"KZ_q7¾ëCtÛ¿=Äöðh.n°endstream endobj 226 0 obj << /BBox [ 3468.7 6301.52 3490.96 6323.78 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 181 >> stream xœÝA! E÷œ¢'¨m)N`âÎqá&:‰‰&êÂë ã ÁpAà5ÿÿ–nfÓÓÝטРzb "(‘m¾ƒ%xœà7GÈ"d@¨FYëÃ(PL%£” Œ®}ÅÐ +Z,,Œ)VΘ´ñXI1w‚”‘´ h<·˜ K… C†@U»®†u†¦Xf\¾1º³ó˜¼eƒ—cØ•sù±ˆaû·‹8¸½{ïm§endstream endobj 227 0 obj << /BBox [ 3481.91 6322.4 3504.17 6344.66 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 178 >> stream xœÝPÁ Â0 üg O`Û­“ øQ PA%$(ÖÇ%-à‘ÄwòÝ9Þ 1 Lp¢)bŽÐ 3*øÅ}´öÎ'8Â-Ff2 T£¬¥0êÈÌS±Lâ"Ø \×LÂfs¨Œ¦Ž³ Iã rBÊKGG>@× øNpAc8¡–ˆjÀŠW\"êµ£ÎX¾1†s(„¹æ"ìü\~,bØþí"a^òm‡endstream endobj 228 0 obj << /BBox [ 3495.2 6341.08 3517.46 6363.34 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 177 >> stream xœÝP;Â0 Ý} ŸÀÄ¿¸=eà*! \Ÿ¤*%bà ‘ýœ÷±¼˜ÇÜ@­wÌjL©C’Ì1UïGÜã±H Ld‘z«M$O•0V‹ â—Õ‹ŠñÒN‚$P=1IWpf2©8“Ú‚ Î¥ã†ÁNî§ŒI1O¬d~L›€*÷_ÿ–åfá×ú8R§Ñ>qSÞùdžõÿ]`[x};j;endstream endobj 229 0 obj << /BBox [ 3508.51 6357.56 3530.77 6379.82 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 180 >> stream xœÝPÁ Â0 üg O`â8¶“ øQ PA%$(Ö'¡¤-à9wñ/ÞtD ÃÃÝ‹O(Êb( !`P²¹Ž'8ÂÍy¤¼Çh>Çz1/ÞŒCñ ÂsñЄšàºbŒÑ Ž(©bÃ\aF ö¥?D4ZÞC¤+yÃÓ€· 1Œ`1\"®&L¸*Z„¹£…þ8|¢wgǘزÁÓìʹüØC·ý×=ÜÞ½–mêendstream endobj 230 0 obj << /BBox [ 3521.87 6371.93 3544.13 6394.19 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝO;Â0 Ý} ŸÀØq''@b£  ‚JH Q®SˆZÀ9Ï~{Ó‹(ޏƒÆ ” “šPQ B´<×$†Ó x& ™:ãÒÕqd'NcõP²âY‰^×LåØª{Òâ¾æX08]s.ãÎëJÝàl_ùŸ†ç/ZSʱY¿A¥¶ä6n›ÍÚïÅ8ƒ³ÔŠáwþ.?nï·ÿtûöð·Úhùendstream endobj 231 0 obj << /BBox [ 3535.33 6384.21 3557.59 6406.47 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 181 >> stream xœÝ» 1 †ûLá Œq|™‰Ž£`€œ„GÁú$(h€"r~ËÿçÇjdV˜oáÔÔP’…A%±÷¸`—@È"ä@r¬'#`™+ÃQbaäÂ28¿3‘ŠƒA-2j®:¢¥ªÆÔõTÆhòQa†É?M·OÇ+C(:A‡„e½Þ£éêhSôŠ>w#|ï1…cPÔ³Ã=0lÊ;ý8ŸþãSìÂ6<nˆendstream endobj 232 0 obj << /BBox [ 3548.79 6394.4 3571.05 6416.66 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 184 >> stream xœÝ½ 1 …ûLá LÇq<GÁ'8 $ `}|ÇýÑ0E”|Öóó‹7 C÷ ÷À’+ªAaËÈ)a­Ã]Háq‚#ÜBDJ)*DÌ-÷]øèÜC JŽ‚Âp]U(¢8g¬ÒsF•ž fn½£d´ºRC¹8Lü™1tLOU`v`+Èi™1rß1¦XSîÑáûm8ÆÊj ¯@°ósù±ŠfûÇ«8„}xw3n¾endstream endobj 233 0 obj << /BBox [ 3562.34 6402.59 3584.6 6424.85 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝA! E÷œ¢'¨¥ZN`âÎqá&:‰‰&Ž ¯/¨Œ¸ñ.¼æÿßÒÕà}€éæ®.ÄÄ’cÌÀŒœ¼.÷|€=\¡g&BQÊRJ‘Ô`žj† kÉðÕù¯j†Â†Â…Kn…5 ØÂcq¨a”NaŒ}@Ãg‡ªÈ0EøØI0ú®Á‹«¡ÐmÄ–ðý‰Ñ]@ šîÎæœÓ= ëÝÃÎmÝÊ–m•endstream endobj 234 0 obj << /BBox [ 3575.96 6408.72 3598.22 6430.98 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝK1†÷='@JÀ LÜ9.<ÀD'1ÑÄqáõm‡uã\ò“Ÿʦó>Àðpw’$´ 9’¢00#g/ë;žà7Gè™I€0 Y¬‰P"Q‡ÊT- o¨®M…#CHÊH\µaÁ-H¶ê¾t£ÏÃ2†0ËiÂÛ?"*|º=aŽ ÒÕ¿l°8Ö'À÷zwv5ˆ <‡]‰Ë+tÛÿ¼ÂÁíÝ €¯m2endstream endobj 235 0 obj << /BBox [ 3589.63 6412.87 3611.89 6435.13 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝ;1 D{ŸÂ'0±ŸO€DÇRp€¬„Pp} »Ú¤âQòœ™Ñx30+NO¸ƒ¦j”sd¡ZQ„$•ùÎ\ðqÂ#Þ ‹„‚b ?Rpácò cJÑ3$âµG#÷8'Êæ¬J¨9¸;­<‚OUéFVZBã8ËäJ±Ù9Ríò¿8B+0ÿ¯ý{_„3(U-žÿÆŸËõ‡íŸ­€=¼7°jendstream endobj 236 0 obj << /BBox [ 3603.33 6415.02 3625.59 6437.29 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 178 >> stream xœÝ;Â0 @÷œÂ'0þÄqs$6ÊÀTB‰2p}µ eá Qò,ûÙñ¦gVžá4‘¢*¤È†$ ‚’ØÛ=žá÷@È"ä@r¬'#ï`ªÃP¬8$!ÜVe†ÂcECM9QãS)àŒ¦« QL¾,<µ¨-ÂH>N˜mÕcâZ1±$´©gÁ÷/Ná;õìð »r®?Ñoÿv‡°omtendstream endobj 237 0 obj << /BBox [ 3617.15 6415.13 3639.41 6437.39 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 178 >> stream xœÝPIÂ0 ¼û~‰í8n^€ÄràTB‰ràû$t¡\x‡(™ÉÌxÙ´ÌŠýî ‰Ø0E6*¤I¡–{8áoˆE‚c è!Çúð`Áúš‘©|¦(‰Äðºb”I5‰’pÅF1UÜäwÅ¡Jj+…:Ù*`‚c…·~"˜8ãÇ^Æ ¶*0âj˜[˜KÓSÂ÷œA©QÏŽO`Ü•sù±‡vû¯{8À^5 m endstream endobj 238 0 obj << /BBox [ 3630.97 6413.22 3653.23 6435.48 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝ=Â0 …÷œÂ'0þKÜœ‰2p€ *!D¸> RÀ%ŸõÞ³ãUϬ0ÞÂ5hRœ +Š€JbŸïé{¸B!BsÊVN‘¼ƒi¬‚].b¨ ÎËJFS(ìHVX£6Ažq(sä´DF•EÀÌÏÕÑ*œ± ZGdûtxaÕ·š øöÿaÇ Ø©g‡{`Ø”sú±†~ý§kØ…mxülÃendstream endobj 239 0 obj << /BBox [ 3644.89 6409.29 3667.15 6431.55 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 181 >> stream xœÝP91 ìó ¿ÀøHœäHt,@°H,ß'‰v—ÐðŠÈ{f|lf…ñéNÍ{LÌSFÉ ‚bjÑ8Ât†#Ü!‹PB)ûú‰¨§±z&.Rê·>Ð'P „Ù*ÎhZ±!ÉŠOEaŒ”:†íVÜz4Åœá€jðq`FéZ4XùË s}q‘/qr§˜4æ/ǰ+ïúãÃö_ïpp{÷†¿m*endstream endobj 240 0 obj << /BBox [ 3658.86 6403.3 3681.12 6425.56 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 180 >> stream xœÝ=Â0 …÷œÂ'0ŽØñ Ø(¨ HÀÀõI[úìø³Þ{r¼ibèžáDsÁ¢ ‰˜‘5Úðf+ð8Án02“a2òÔ7F™zAW#´b©1a¸®'Ž*&t®È‚šzvô2s[ –‘t¥0G^ü ùƒ|£(,nÊȼʹ7LÌŠÏ‚SÂ÷Úp‚EÌ ^!®ÖåÇší^áöá Ë¢lºendstream endobj 241 0 obj << /BBox [ 3672.88 6395.33 3695.14 6417.58 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 182 >> stream xœÝ» 1 †ûLá ŒIO€DÇQ0À @â(XŸŽ PDÎgùÿýX Ì ‡k¸Í&X dõ„* ‚’Ù1©Ã´ƒ-œ!‹a4òØ>F‰¬Àth«E¤Œ1Áé`ÆÄP± §Æ s®\"w« 8’T¸¢è‡Ã‹Ÿ-š¢gµ@wP7”øî1sSÌSôŠ×Ô³Á×cØÅ¢æ·À°ªïøã ÃòOϰ ëp#²mgendstream endobj 242 0 obj << /BBox [ 3687 6385.29 3709.26 6407.55 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 178 >> stream xœÝA! E÷=EOPK N`âÎqáŒNb¢‰ºðú‚¸ð.üæÿ×ÒÕäœâü€hL†QS É(B,õû~Ä=^ɉ°!“7ξ>ŒWÃ\‰²FŽä/£âّϨ1+•xÑ¢VÈù® ÆJ2 ÆFê é¥Å;Ð*Ž4bh27:,ºÚ Ýѧþ¾~q€(%µlø‡›rÎ?1­ÿv;ØÂ ©-m£endstream endobj 243 0 obj << /BBox [ 3701.13 6373.17 3723.39 6395.43 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 177 >> stream xœÝ=Â0 …wŸÂ'0þiêæHl”TP $ÊÀõq@iË¢ä³ýžozÃñw0g¡€ÖÜHZT%mÅç{:áoÀ$ªìÈÔ8ç¦<œ{‡ÓX<Œ8…G×f¼®#™,a°“äàlTPÂ>U¢^œÌ–¼J4ZÉg~7(‚ñLj¸x"Ϋ.Š:B­¨#V‡ïO p£.²ŽOÜŹüØC¿ý×=`/‰×mkendstream endobj 244 0 obj << /BBox [ 3715.36 6359.04 3737.62 6381.3 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝ1Â0 E÷œÂ'0±Çé Ø(¨ H”ë“´¤„…0DÉ·¾Ÿ¼é‰Ƈ»;1R”Q´C€9’­÷t‚#ÜœGböƒù.”‡yõ–` Ã-3,û\ÛŠ"cÂÀEw(©èˆ!­zÈB¨Ú8D±T9O˜ýK!*|º£Ç.6üEMP5áðý…Á`Êa žŽ`—ÏåÇúínáàöî#JlÞendstream endobj 245 0 obj << /BBox [ 3729.68 6342.82 3751.94 6365.08 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 180 >> stream xœÝ½ 1 …ûLá Œÿ' Ñq €à$$8 Ö'å8 ˆ’Ïò{Ïñj`VïáÔ¥`ÊÔ³€JbŸïé{¸B!Bs*ÖN‘<Ã4VeL\=¢b‰pYV Cåˆ+'EN•ZZçCUXÄœ‘dá0ó+£)zÅrS~ÌÐu‘ñæ¦èSôŽ>ewøþÇ!œ‚bV/À°©çücÃúW± ÛðA nªendstream endobj 246 0 obj << /BBox [ 3744.01 6324.54 3766.27 6346.8 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 183 >> stream xœÝ=Â0 …÷œÂ'0ŽâôHl”TP $ÊÀõIZZÊ¢äYï}v¼icèáÄU‘"$aES`F6Ïã¢Ãp‚#Üad&Buj´>œŒŠqè+ð‘ÂÔẪh1ˆa‰­˜›ª £.º+‰DÈqåHŠb+¬§cb®&†jZõ˜tMÌSÌŽeî7áû]8Á,Þ8> >> /Subtype /Form /Type /XObject /Length 178 >> stream xœÝPK1Ýs N€PÚÒ9‰;Ç…0:‰‰&êÂëKgR­ࢡ¼°E§Ü@-Š ³r¤ …,6×dïGÜã˜$6dŠÆC¬ãÄ•0¹GfRsI¤/]'¸BÑq¤${µŠ‡Z>¸Â"eíVȆΡá%cV´ŽgáÇ€3Iê"\mˆ7£½|oq€(µÁð ‚ç‡×{ˆlᬎmôendstream endobj 248 0 obj << /BBox [ 3772.92 6281.82 3795.18 6304.08 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 181 >> stream xœÝP;Â0 Ýs ŸÀØN;'@b£  ‚JH ×Ç©ÚPÀ%Ïz¿xÓ3GŸá¢ª`ÈbŒ& ‚’Y§»SƒÇ Žp „,B „I©¤úPê¨Æê‘Ð’{÷êພƒcÃb# rvl ©kxp…ÏX1Jô&+‡†§ŒªX&¦hšƒXDŸŒWÅÜ¢1––‹Ã÷?†p̓^aççòcýöWqûð$o…endstream endobj 249 0 obj << /BBox [ 3787.51 6257.41 3809.77 6279.67 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 182 >> stream xœÝPÁ Â0 ü{ O`â8‰ øQ PA%$(Ö'iÕ´âÁ<¢ø¬»óÙ»ŽYpxÁDM)2&•£÷T*›þÄŠãÏøGì½StÔåP uÑâ8TLAŠG2Š %FÑ,µb%¥ÐpbNHye˜S²¸:4<ϘKGJ*\b&‘ÍŒEK±0ZîÙák® dE¦øÆCy·§èö|Šá:o”endstream endobj 250 0 obj << /BBox [ 3802.15 6230.9 3824.41 6253.16 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 181 >> stream xœÝ=Â0 …÷œÂ'0þKœœ‰2p•@¢ \Ÿ´(mY8C”|Öóó‹7³Bÿ  ™9B%, ‚=Owb‡á G¸B!Bs*6>œ"UáІ”ª… ’Ám]qd¨˜Q¸bd«ÌŠâ3ŸjgT[)j+‹ÁŒÓ„±¡U4aI°¨`–Õˆ-DS´ŒÍáû§p ŠY½8¼îžëEtÛ¿]Ä!ìÃe mendstream endobj 251 0 obj << /BBox [ 3809.87 6215.85 3832.13 6238.11 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝ=Â0 …wŸÂ'0þiâäHl” ¨„eàú$jÓ¢øÙ~Ÿ-ozÃá °Ä™’cT ”ª’FñåÏxÄ;0‰*;2uι«s`O8…!Bž C#匷Œ)qÀ¢e«:’©ÒâSi.6öµhLS}ö6=Ñ«aÉH¥®qroøIÔö6¼•—ugû÷ú'¸€Q2ÏŽ/Ü•wýq~û8ÀÞZ×jôendstream endobj 252 0 obj << /BBox [ 3615.36 6015.62 3637.62 6037.88 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝP91 ìý ¿ÀÄNbg_€DÇRð€¬„Pð}ö¤áÑd¬™ñ±i™#öO¸CTÎ58ª ‰²Íø8áoˆE‚a d¡Iõc!+øèk†‘Ï%Kx]U"SŒ*LI*ÏÔhåJy¦\˜u%p´•¤Cƒ~,0iÁÅî}sZòZõÓ“`y ø^¡ƒ3D*ÑÃ0îü]~\¡Ýþç°‡7ÁlDendstream endobj 253 0 obj << /BBox [ 3278.13 5684.47 3300.39 5706.73 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 183 >> stream xœÝ=Â0 …÷œÂ'0ŽócçHl”TP $ÊÀõqJÚ¢䳞Ÿ_¼é¼0<ÜÝEƒ”5b`FN¢Ó½Àx‚#Ü¡g&2 •XB‰L8æ¡„”Ì£$Ì®kEˆ0 G䊕+dY¸·†1„EÑg5hÜFLs…0EX²f eѸv¼C¬‚9u3øþEïÎ. )OçagçòcÝöoqp{÷ÆDn&endstream endobj 254 0 obj << /BBox [ 2847.46 5267.16 2869.72 5289.42 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 177 >> stream xœÝM! …÷œ¢'¨ÐB[N`âÎqá&:‰‰&Ž ¯/Ì¿à‚ÀWÞ{”—{:²¨‰b B’ ËÞ_à ç1yQ}Žõ >y5軚‘‘­d¨!e¸o*ÆÈ Èc¢ÊЦ‰auKFo›ø‘«a~V,O ß?hÝÕ1kVx»‡²n?†Ðìÿr'wtï€m*endstream endobj 255 0 obj << /BBox [ 2362.49 4799.44 2384.75 4821.7 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 177 >> stream xœÝP» 1 í=…'0ŽcÇÉHt 8 $ `} ÇÑ0E”¼§÷q¼Bˆ8Þà“T/…TQ„Ä> >> /Subtype /Form /Type /XObject /Length 172 >> stream xœÝ½ 1 …{Oá Œrq2GÁ'8 $Ž‚õI9R1E”|‘ß{¶7£ˆáü€;(GÁ0°¢(ªárÂ#Þ€ITÙ‘)8çPÎ{Âe.šAI‹J¬\׎©cÁH6V¥ X#(èÊS RWáLÑ:‡•kB´N$¿l”sñæªhM´ŠOÍ a‚3%óìøÁ]9—;·ÿ¸ƒìáüglendstream endobj 257 0 obj << /BBox [ 1879.47 4351.27 1901.73 4373.53 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << >> /Subtype /Form /Type /XObject /Length 8 >> stream xœendstream endobj 258 0 obj << /BBox [ 1814.37 4307.81 1836.63 4330.08 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << >> /Subtype /Form /Type /XObject /Length 8 >> stream xœendstream endobj 259 0 obj << /BBox [ 1823.39 4337.5 1845.65 4359.76 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << >> /Subtype /Form /Type /XObject /Length 8 >> stream xœendstream endobj 260 0 obj << /BBox [ 1879.62 4411.85 1901.88 4434.11 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << >> /Subtype /Form /Type /XObject /Length 8 >> stream xœendstream endobj 261 0 obj << /BBox [ 1961.35 4508.11 1983.6 4530.37 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << >> /Subtype /Form /Type /XObject /Length 8 >> stream xœendstream endobj 262 0 obj << /BBox [ 2051.97 4609.28 2074.24 4631.54 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 172 >> stream xœÝ» 1 †ûLá Œí<œL€DÇQ0À NB‰£`}œ9BÑòýöï×f`ö0=ÜÝ %†¨ó Žps„,B „A©„úQФæÉ<Ñc.f‹3\{%šŒ3R¨\0‰qòÈ+޵mFÖ.A½tV^ZTGS8¢ð©ÀŒ]‡…jz›àn6÷÷ £;;¼…§cØÙ»ü¸Â°ýÏ+ÜÞ½5h„endstream endobj 263 0 obj << /BBox [ 2139.74 4703.64 2162 4725.9 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 180 >> stream xœÝP;Â0 Ý} ŸÀØq''@b£  ‚JH ×Ç…¶„…0Xö³Þ{þ¬:ÅáW¢•L1+åˆ!PÈbK¾p`’ØÉ‰5Ž…qb+xÜ# åìÉ Ïm§RqW‰‰ŠÃ T‹ÃÄTlÁ½ R¢ª #3±5 ~s‡ýüp¢”›o< ¦f¼â¤ÿ¾¡‡#(µjøÁÇéǺõŸ¾a[x›Ïlãendstream endobj 264 0 obj << /BBox [ 2217.06 4783.68 2239.32 4805.94 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 178 >> stream xœÝP;Â0 Ýs ŸÀ8¶;'@b£ A%$€ë“´¤”…0DγßÇòªQ`x„[`ކ”@Í“3rŠ6ÖÎîGØÃ5Ff2 T£¬õcÔQ% ÕÃ1{ñÈŠ—e#£WS,‰ê¤H\±cÌ3>…H \0ÄP Ö€‘>aÏh ³Ú¼Ãô±Ÿ`¥¿óÛ¼­×ä_ûÂ)ºX6x†›òÎ?.Яÿï»° /´†kVendstream endobj 265 0 obj << /BBox [ 2279.84 4845.85 2302.1 4868.11 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 183 >> stream xœÝ;1 DûœÂ'0Žó±}$:–‚¬`%$X ®O²@%ãŒß8Ù5Þè^îé˜ÅP#D 53röìú œáá=3 F!‹õ ”¨û®0Ô£äÂHMᾩdFªTMh¾êŒ\¤Q5N²-~ËÕ7ß*¶¶/z ( kÅ£ Ä E6 £®ó³cz"|?¢uWPƒ˜ÀÛy8”uûñÍþ_ÿáäŽîSmîendstream endobj 266 0 obj << /BBox [ 2326.72 4889.1 2348.98 4911.35 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 181 >> stream xœÝ;Â0 †÷œÂ'0¶ó°}$6ÊÀ*¨„eàú4¥ eá ‘óYþ?6s„áîA¢TdæÈ ‚RXç˜a<ÁnEH0)yª¥Lj0ÕÀ°$HN„"p]g2ŠƒÄ(¨^Ù1ÅÊŠV÷“" º¬*’"••Cã¹Ç¬xgÌ3r†æ`ÎHüé±pU,S´ŠeÊæð½GÎ!¢Eu…g`ØMïòãÝöOqûðªœmÃendstream endobj 267 0 obj << /BBox [ 2358.5 4914.63 2380.76 4936.89 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 181 >> stream xœÝPK! Ý÷=A-P(œÀÄãÂÄDÇ…×·ÌÈ7À÷ò>¥›Á¹€ãàCÌQŠJ½'5ÏwrŠÓx&ç=+2‰r‘úPŽlÂi´ˆd¼· I#Þ:&0eK I(¦Š…ŠV\j[Ã's¨vÍ”¥ hx©˜ aJ×—(J×°àjh3¬Š6õ'àû'¸@°nµq^àpgçúcÃöoq€=¼wênendstream endobj 268 0 obj << /BBox [ 2377.03 4924.75 2399.29 4947.02 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝ=Â0 …÷œÂ'0þIêøHl”TP $`àú4””°p†ÈyŽßgÇ«žYa¼‡k5CRˆ.-JǶÄÛöp „,B„ÑÈc¹%² ·±02zšš0;œ›L¤E³"yÑ ™‹ÎÈiÑÃäpEѦ ÕBÕs—£f³Â‡ v¹é1ëâ¨SÔŠeî7áûC8Ì a3ÓUôë?^Å.lÃö"okendstream endobj 269 0 obj << /BBox [ 2385.06 4922.4 2407.32 4944.66 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 181 >> stream xœÝP¹ A Ì]…+0^ÛûU€DÆPÀ NB hßˉ€öïÌxÖ›&Åî w-‘8¡U2ôMb.ÙBÆÇ x¦ ™,sµþ’9²]o‘¨·P¥hx]W %­¼¡UʱljB]p b¼á‡a=ͬ_Ðà?ÐÇ‚²á}R‹‘ÊÊÄ.XÌŒ9àäðõ…ΠT4׌/¸óuù1…fûŸS8ÀÞ§¯l¡endstream endobj 270 0 obj << /BBox [ 2385.57 4910.84 2407.83 4933.1 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 182 >> stream xœÝ;Â0 †wŸÂ'0¶ópr$6ÊÀ*¨„0p}’–6`ˆâßúýù±éDO¸ƒº(ú,LÉ£*iÿ` '<â ˜D• ™¼qö50\ Ceù\*” ¯ëŒªËBÑí„$UÉdÑ=¨g!³æð(K#4=ö+>‰”±DÉâªÅ¤KÁ2Ä옇œ_[ôpGÉY‰_ ¸+ïòãÝöoq€=¼ʯn$endstream endobj 271 0 obj << /BBox [ 2381.32 4892.93 2403.58 4915.19 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 183 >> stream xœÝ1Â0 E÷œÂ'0±ãÔñ Ø(¨ H”ëãV%…0Dɳ¾ÿw¼é‰Œpœ abbŒ–€9kYá"sTˆ(Mæ‡Æ]8³GB‹‚.º~V =ÊY1™3y]=MråÁ;L1sSH$ì´94^2¼ã])VÐ ªC1Á’[ÆÊsÆ:EU¬SV‡ï á–¤¦ð ;?—«è·¼ŠC؇qoendstream endobj 272 0 obj << /BBox [ 2374.93 4871.34 2397.19 4893.6 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 180 >> stream xœÝ½ 1 …{Oá Ll'q2GÁ'8 $ `}’ƒ¡aŠ(þ,¿çŸÕÀ¬8Ýá ¢æ)+údLêQ„$²-ÿí€{¼€#q†Ž¼¹ìk`.8Kx›ªG¤ŠGòÏ}Æ((Š&G9ÎL1UŽäâÂcQ”ˆµ«ÈÄ:‡…ç³â1#Íøq0% ]WE›¢U´)›Ã÷#A)©eÃ0nÊ;ý8ŰþãSì` Ooƒendstream endobj 273 0 obj << /BBox [ 2368.37 4848 2390.63 4870.26 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝ1Â0 E÷œÂ'0ŽãÔÎ Ø(@P $`àú8”´eá Qò­ï÷¯ú p œ:Ãd &ÌÈYçû~„=\ad&BQ*RJ™ªap€rq@.èÔË¢Ò 2¸”\¥'IÕsœôÁL0ëÂa†Ê3 É1áÝÐ*‚ÔÁ ‚…£®mˆÉѦþ¾q§Ðœ£ð 6~Î?ѯÿv»° /×mØendstream endobj 274 0 obj << /BBox [ 2363.16 4824.46 2385.42 4846.72 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝ1Â0 E÷œÂ'0Ží8É Ø(¨ H”듨M[À%ßùÿ9ñ®ó^`x¹§c1Ao ‰Õ€Ù|\öñgx8BÏL5RÖzˆ(&‡ÊH©0$`ÈpßT”Ð U,#sÕŠ©È¨È¹É¾øcF±õ> †Mz–¾Ú[00¬i6”-~Ò5Ðú7Çòâ™ðýƒÞ]`*ÜoçáPÖíǺý_áäŽî@Êlendstream endobj 275 0 obj << /BBox [ 2360.24 4801.59 2382.5 4823.85 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 180 >> stream xœÝ» 1 †ûLá ŒIœL€DÇQ0À NB‰£`} Gh€"r~ËÿçÇj`V˜nîêD#¡xð‰C”ȶÄù{¸8B!Bo”}ý²óT‚ ƒáÜg ­P5FÔ"…1k‘ƨiÑc1XDﻊDRXô³Eu´ Æ)îz¼tu¼‡hmÆøÞbtG§˜Ô²ÁÝ1lÊ;ý8İþÛCìÜÖ=2_mˆendstream endobj 276 0 obj << /BBox [ 2360.24 4779.84 2382.5 4802.1 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 180 >> stream xœÝ=Â0 …wŸÂ'0v’ÚÎ Ø(¨ HÀÀõI  eá ‘ó,¿Ï?«^$âx‡+„¨L!a2Ëä C  b-Þ¸Ç 0IlÈ”ŒsªãŽÍñ6VF ÑÂÈLYñ¼Ì(q¡FUŠ˜œ È‹4¡èMÅ`J)-*œ©ó éW‹ê˜3ÞQÆ02ý´˜t5¼ghóˆ“ÿ{‡ŽÉ£eÃnÊ;ý8C¿þÓ3ì` O×çm4endstream endobj 277 0 obj << /BBox [ 2363.21 4759.27 2385.47 4781.53 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 177 >> stream xœÝ=Â0 …÷œÂ'0ñOâæHl”TP $ÊÀõq@iË¢ø9~Ÿoz"ñî% 2Z*ÈÌÈ™–{:Án!"1Gƒˆj±h ,¦hLce$t šù;\׉„šÁõîº`&צ(:ëÁ)­*:Á”V„Y×ÕÐÞJ@&¤²jñÑÕцhmÈFøúÅÎA°s¬Á3ìü\~ì¡ßþëa^¾±m‰endstream endobj 278 0 obj << /BBox [ 2369.04 4739.67 2391.3 4761.93 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 180 >> stream xœÝ=Â0 …÷œÂ'0vœÄÎ Ø(¨ HÀÀõq¶aá ‘ó,¿Ï?«ŽY`¸‡kˆR*R‚¤R±(Ĉ±ðoØÃ%rŒ¤@˜”j?J™Ôà68C kqF&48·‰Œæ0ь̮ !±ks Íºw‡eŒ©­¨(Öf=¶x>‰”Q@b̵iñÖ£cbª˜†œ_[ôáM´*<ÃÆßéǺõ¿Þa¶á ¸:mŒendstream endobj 279 0 obj << /BBox [ 2377.39 4720.58 2399.65 4742.84 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝPIÂ0 ¼û~ñ’ÄÉ ¸Q<A%$(¾ORµ¥\x‡È™‰g<ñ¦1ìŸð5w²‚Á•)fT%MâKÎxÄ;0‰*;2çÚÅ9²gúæQȤz˜ãmM$ª=jÙ(ÄŠSц3EYð©*ŠQôUGqr[9,¸¡‰RÀAMWFØúçÓûœp–}á0Ê•t|ஞë%tÛ¿\ÂöðC'lmendstream endobj 280 0 obj << /BBox [ 2387.82 4701.54 2410.08 4723.8 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 182 >> stream xœÝ=Â0 …wŸÂ'0¶“ÆÎ Ø(¨ HÀÀõI[ÚT €!r>ëùùgÓŠìŸp näŠÑX¨‰¨JÚ˜1‰áã„G¼“¨²!Sæ8|Œ.ÂG?xd²X> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝO;Â0 Ý} ŸÀØN''@b£  ‚JH Q®SµÀÙÏy{Ó‹p ¥PƘ²P‰¨JšÄZNxÄ0‰*2EãkcܱeœFÐÈB¦îQ9éú9É$î¹£œÐÅî› SцWÈç·r•½å Ï•¾Nòì–jjD³^på.á±.7k¿wà Î V Ÿ ¸ówùq~¿ý³ó°‡2iUendstream endobj 282 0 obj << /BBox [ 2412.84 4661.27 2435.1 4683.53 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 178 >> stream xœÝA 1 E÷9EN›46í wŽ 0耠à¸ðú¦HgêÆ¸(íûäÿ¤Ù ̧'<@”…²¢¦Ä$†"$‰×{>ã ïˆE‚a µP´>,lƒeœ§š¡dæ&¤xës:g*윙;K¤’Ý!…‚v1ç.aáÚ¢šŒ¢â\/]‹WG¢U´![Â×/F¸@¤­¾€qïçúcÃî_÷p„¼‘šmkendstream endobj 283 0 obj << /BBox [ 2426.56 4639.11 2448.82 4661.37 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 181 >> stream xœÝPÁ Â0 üg O`Û±“ øQ PA%$(Ö'iàaÅgÝ/Þ !0Lww$¤D9c@„--¯ƒùG¸9ÈxóYjc>úBœ§ê‘PRñˆ¾¨áÚO"rq&T®8£hņšßx, !4í¢˜;ƒ— HÄó#—€ž»+®‚¡1ZÄæðý‰ÑcbËO`WêòãÃö_ïpp{÷Fm[endstream endobj 284 0 obj << /BBox [ 2440.48 4615.11 2462.74 4637.37 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 178 >> stream xœÝP;Â0 Ýs ŸÀØŽí´'@b£  ‚JH Q®O¢’PÀ%Ïz¿x30G˜áD•P;PgCfAqNížOp„[ dJ¹‰z-DF©ƒy*‚š-ÄQ ®ŸAdŒÙSÕѬ`CµŒÑ¹á1 ÌÑ»à »¸r¨x‰(Š6a,}›'¤¸ÊXpQÔ•Q[¿ ¾>1†sˆ9 õ ža—ÏådžퟮáöálJendstream endobj 285 0 obj << /BBox [ 2454.45 4588.86 2476.71 4611.12 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝPA1¼÷¼)-¥¼ÀÄ›ëÁltM\~ßÖt»zñÊ ›ÁûÓÃÝG‰¢äŒ93ròÚã|‚#Ü¡g&¨d±&JBšažªF‹†šÁu­$$. WlÈ J^àXú•0Éú¯Õ>è ·oÂR‰hº€Xq–× WF³Ð;ºé¦ð½ÄèÎ.`j OçaWÞådží¿ÞáàöîBn)endstream endobj 286 0 obj << /BBox [ 2468.11 4560.3 2490.37 4582.56 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 181 >> stream xœÝ½ 1 …ûLá Œ8vn$:Ž‚NpH@ÁúøÂýÑ0E”<ëùó‹7-s‚þî!ŠdÉJ˜ FŒÊVïl'8Â-rŒd@(F £Lƒ¡w„Rr„1ŠÀu]QÌàRС’ ¡VÝ8~Ö7ÁÄ+G)(ºfY'Ô†±¢ŠÉ`¨'O«=tL!fǘq"|ÿ¢ ç°$k ^aççòcíöoqûðÚZmnendstream endobj 287 0 obj << /BBox [ 2481.47 4529.24 2503.73 4551.5 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝ½ 1 …ûLá Œÿ' Ñq €à$$8 Ö'å ˆ’÷ä÷Ùñj`VïáÄ2£%°(Å@%±Ï÷t„=\!‹¡9k§HžaCQKe¡f¸|:­R-;Fmº`ÌUÁ4ËC Ç´8‰1/ùY¾ÔúnhDeXâÊÈiá¿eã÷zA°¾¿p§ ˜Õ‹Ã#0lê9ÿØÂ°þÏ-ìÂ6<ñ*lŸendstream endobj 288 0 obj << /BBox [ 2494.46 4495.62 2516.72 4517.88 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 181 >> stream xœÝM1…÷œ‚ P í LÜ© `ÔÄDuáõÎN\xMû‘Ç{”ÅF$áé7P«FæhV3yBUR—èïïÜá˜D•™,¸Z{gn‚SópJ-³S8^f*Šš™)[ãLÕwio܃faò˜ ĨÈÌ`â!¢ï˜*B^ñí`5ZÔ1bkg˜Ÿ©ƒ¯_ìá‰JŠøÁUwÎ?±Yþí"¶°†ytmÌendstream endobj 289 0 obj << /BBox [ 2507.01 4460.37 2529.27 4482.63 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 181 >> stream xœÝ½ 1 …ûLá Œíü8™‰Ž£`€œ„P°>ÎA¸Ð0E”<Ëßó‹W³‡éî®N")C‰Ð+ˆ $^îÛöpq„,B „A©„úP24Ãmª‹˜‡2†ç¾’0&È !ÈUg´MFˆGá®C}ì>zž1ïJJ<,ɲ—nÆKW¢¥h-esøþÇèŽÎcöZŽacçôcÃúW±s[÷ɲn=endstream endobj 290 0 obj << /BBox [ 2519.18 4459.4 2541.44 4481.66 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 180 >> stream xœÝ;1 DûœÂ'0þÄqr$:–‚ X $ àú$ û¡áQ2Ö̳ãUǬÐ?Â-ˆqAΣŒ ‚’؇Û<Ãý{¸B!ÂèTb{85C_ÂÈ\Nh—eÅÐ2Tm•×tAת•PeÒ‡šPCÍKGi¬™0é¡ÇøT’aL0£ò¢Ç[·Ä8Åè§ ßÿ8„SPÌêÅá6õœ¬¢[ÿñ*va^KïmÎendstream endobj 291 0 obj << /BBox [ 2531.06 4481.96 2553.32 4504.22 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 180 >> stream xœÝ1Â0 E÷œÂ'0¶ãÔÎ Ø(¨ H”ë“ ¦……0DÉwþN¼é™#Œp’"#u êŒ¹”ŽmÙ§áY„ Õ(k=%2‡i¬ Áì…‘#R†ëgÅ‘ 5E+ÐD‚±Hdor(~µÒo½OŒú‘nò¯ö¹àŽ$°¤Õ#º¯øY×ÀÜq´÷5Â÷†pÅ-<î¬Ë!ôÛ¿Â!ìà Ól!endstream endobj 292 0 obj << /BBox [ 2542.73 4519.16 2564.99 4541.42 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 181 >> stream xœÝP;Â0 Ýs ŸÀØN×'@b£  ‚JH Q®ORZÀ9ÏyÇ›ž9Âø÷ š-BRvä "(jÝ\3L'8Â-²&#Oõb¤TˆÓX=æT<"¡8\×ÅX\5uh^±£¨;mp(|íÐeyÏKÚ"ÿà9  ZG%Âb Œä«„7®Š6Bc´›Ã÷'†pÅ"š<îœË=ôÛÝÃ!ìà ”ÞmWendstream endobj 293 0 obj << /BBox [ 2554.19 4564.04 2576.45 4586.3 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝ=Â0 …÷œÂ'0vbÇÉ Ø(¨ H”ë“PÒ–…0Dγü>ÿl:æÃÃÝWä ¢Q¼GÙæ8žà7GÈÞ“¡e©#%K0•‘ ‹åº$¡/L%jÕ‚!W­ü¬ûb0ÂV&¨aEhzjñv´L™a!vŽ«“®Ž6E«hS_Kôîì¦`Ùàévå]~œ¡Ûþénï^¨ lõendstream endobj 294 0 obj << /BBox [ 2565.55 4611.22 2587.81 4633.48 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 180 >> stream xœÝP91 ìó ¿ÀÄN'/@¢c)xÀ VB (ø>ÎB–ÐðŠÈ™ÑÌøX D¦»»:–$(1!30#'Ò¹Šf¸`瑘½‚Ǩ¾ÄúQ/¾ ¦š¡Æ[†¹‚À¹g¬°(ÂD†¡hÅ S^ðhŽL¨±SdÁ\º„Ï=fÇ›!E.ðI €»/\mЦhS¶„ï=FwtsТðp{§§Ö|ŠÛº'vÙnØendstream endobj 295 0 obj << /BBox [ 2576.91 4656.92 2599.17 4679.18 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 177 >> stream xœÝ½ 1 …{Oá LâüØ™‰Ž£`'!ÄQ°>Î9…†("çYï}v²¼8>áœ$Sñs²ÊÈLœ½¬u:ãïàÈ3;AGQ\‰õ".9QœÆÊPR6FVro]G‚%‘“2©ZŒ[õìlúd‰bÎÎP¬¦Ðô2b´Ž¡W@²É±›°èh;4ǺõðýŠ\ ±Ì <îì\|İýÛ8ÀÞGünªendstream endobj 296 0 obj << /BBox [ 2588.27 4698.73 2610.53 4720.99 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 182 >> stream xœÝ1Â0 EwŸÂ'0NâØñ Ø(¨ HÀÀõI[µA €!J¾ýýìxÓ…pxÂb.…¢¡¨²„1RÔ`Ó­àã„G¼Sˆ‘ ™ÄØe|g CexÍ;Ž)*Š×HòJÍ.”Ò¨*¦j'YeQYH´” ih€UÏ-¦Š%"dŽÀLš[‹YöÐfX ËÔ3àë=œ!QIæ†/¸«çòcÝöoq€=¼Õ nendstream endobj 297 0 obj << /BBox [ 2599.68 4735.22 2621.94 4757.48 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 183 >> stream xœÝ1Â0 EwŸÂ'0¶Çé Ø(¨ H”ë“RÒ–…0DÉ·þv¼iEö¸ƒZÓPÊ=© *©y~ßI‡ñL¢ÊŽLѹ‰ãÃÙ¸‡4±P*ˆ˜(D¼.Š…™ØÈmÔFfE S–Yw% F9¯Êĺ"T=µsEH3.„à$qÕcÒc¢NQuêàëœ!PÞ8>ApWÎåÇÚퟮá{xIul{endstream endobj 298 0 obj << /BBox [ 2611.2 4765.82 2633.46 4788.08 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 182 >> stream xœÝ=Â0 …wŸÂ'0±óãäHl”TP $ÊÀõëPZ¢äYï}v¼é˜=¸ƒ$f š"eA’¨ùu'VOxÄ8b§è(¨+¡>ÔEgÆq¨OÌÆÐD%⵩d!gTC¯êDœLß˪{Kˆ’/Ã3ÅÐ=÷¨‰µÂ”3~IICÓcÖ5±L±8ֹ߄ïôpOÙkQ|ãÎÎåÇ*ºí¯â{˜Çin|endstream endobj 299 0 obj << /BBox [ 2622.75 4790.63 2645.01 4812.89 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 183 >> stream xœÝ;1 DûœÂ'0¶ó±s$:–‚¬`%$€‚ëãý²4€"JÆ?O¼i˜#tÏpRDP3$­„%‚+ÉjÃ]Xáq‚#Ü!‹aRª©(erã£ë ‹A2bT…ëºRМZÄÐÄ5Vu#Z]tëѰ–•#Eä`–ÄÞ?´xc·VÁœ?üI÷þ)Áâ˜΀ï/´áœÕ£¼ÃÎÏåÇšínáöá b²m-endstream endobj 300 0 obj << /BBox [ 2634.43 4810.03 2656.69 4832.29 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 183 >> stream xœÝ1Â0 E÷œÂ'0vÛÍ Ø(¨ HÀÀõI )aá Qò­ÿŸ¯zfñ®!š$L©cBˆ£z7߯·ìá9Fr LN9M'¥b¼ÃP´0"#œÛŠa,TK%™‹BñI+ª.z( %4išÐ½!,zî1'Þ6¤ 3fmz¼ô”¨STG²¾ÿ1„cìijÃ#0lÊ9ýXE¿þãUìÂ6<Ón‚endstream endobj 301 0 obj << /BBox [ 2646.19 4824.77 2668.45 4847.03 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 177 >> stream xœÝPA! ¼÷}A-Zx‰7׃Øè&&š¨¿/¸²âÅx e†™iéjpÎãt‡+ˆ%Á$ŠDKK½p`r"lÈŒs¨ãÈU0ÕˆDΕ )e> >> /Subtype /Form /Type /XObject /Length 181 >> stream xœÝ1Â0 E÷œÂ'0±“Øñ Ø(¨ H”ë“PÒ–…0DÉ·¾ßw¼éˆ ww,)£Wˆ9$fd!ïñG¸9Ä\l£z‹õ¡>yÍ0•ahVQP\W•D˜ U$b‰,:¡IÕ†<˾4hDÖ•A3FZšž"Þ­B( !(¦¸DL²6´šažúøþEïÎ.`1›ÂÓìʹüXD·ýÛEÜÞ½“nñendstream endobj 303 0 obj << /BBox [ 2670 4843.19 2692.26 4865.45 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 178 >> stream xœÝ½ 1 …ûLá Œÿ' Ñq p‚“@ Ö'å8 ˆ’g½÷Ùñj`V˜îá$9eSä"(Ñó|ß°‡K dr 4§bíᩦ`,\ÑPÎËJA­´ä )U£U¹g=ÖDNÈyá(„j ¬_=Z¢W¬ $ø,"ó¢Ç[·DŸ¢;ú”ðý1ƒbV/À°©çôcÃúW± ÛðD nJendstream endobj 304 0 obj << /BBox [ 2682.02 4848.31 2704.28 4870.57 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 180 >> stream xœÝA1E÷='@ m¡'0qç¸ðÄDÇ…×·Í8­n<€‹†~ï›Á{éá1C°`(˜‘“×çáæ=3)¥êG)’ÌSef)Œ˜1\?2)`,Ôd†dU¦Xtô¡é±tdCæ^¡Ä(©š^> >> /Subtype /Form /Type /XObject /Length 180 >> stream xœÝ1Â0 EwŸÂ'0¶Çí Ø(¨ H”ë“´¥„…0DÎs¾¿o:‘€Ãî ©$ ª’šÏ1‰ãxÂ#Þ€ITÙ‘):·±\œ³pŠE"Öì‘” ¯uÂÉÕ9¤Ì.äZØHuåÔ…IÛJ!‘b¬V.-¦‚%aNÑðc`BÕa¢0¿¯.åß_èá šà­ãwù\~,¡Ûþå°‡‹kíendstream endobj 306 0 obj << /BBox [ 2706.17 4852.81 2728.43 4875.07 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 181 >> stream xœÝ1Â0 E÷œÂ'0¶“ÔÎ Ø(¨ HÀÀõq ¡eá Qò­ï÷¯zæã=\ƒ(uÈ É² 1ˆ t®ëÕàv€=\!‹aR*©>”2UÃX†TœÑE,ÎËJArª²ó¢kȹjÅYÞàQé0óðÑSÄÔñ®dC3˜ 9¡Æ9â%kC›¡ÚŒ ðý‹!CD‹Zaãçôcýúo± Ûðºn!endstream endobj 307 0 obj << /BBox [ 2718.35 4852.96 2740.61 4875.22 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 181 >> stream xœÝ½ 1 …ûLá Lì8±3GÁ'8 $ `}¸ ¡aŠÈy–ßçŸÕ@`º»«c%ÃA,2æÌȉ´ÅÛöpq‰Ù+xõYêG}ôjp› ƒ=²F$8÷‰ŒT Ê‚BEkÀ@Ugkz,Ž cW SîM×/܈½Àͺo]Ë­br!|m1º£ hA³ÂÃlÊ;ý¸Ã°þ×;ìÜÖ=Fmàendstream endobj 308 0 obj << /BBox [ 2730.53 4851.84 2752.79 4874.1 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 183 >> stream xœÝ1Â0 E÷œÂ'0¶“ØÉ Ø(¨ H”ë“”–†…0DÉ·þv¼é˜= wwbž0)2¦"(ÑÒt+Œ'8ÂͲ£êÃ(R1ŽCe†X*˜®m%!ªyE-Ò¹À-0êªûŠæG$L©|ôÔ¢&–J4̰¢GÓ¦Å[×À<ÃbXFœóßèÝÙyLÞ²ÁÓ1ìʹüXC·ýÓ5ÜÞ½h0m¿endstream endobj 309 0 obj << /BBox [ 2742.76 4849.49 2765.02 4871.75 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 178 >> stream xœÝA! E÷œ¢'¨´PZN`âÎqáŒNb¢‰ãÂë “aÄpAÊ+ý¿¥›(ÀøtÇ5A´˜1f`FN¤kœÎp„»óHÌ^ÁcTŸc½¨¯ÓX="&+Éc"¸õ©±°¡qåŒ K@Ë+ŸŠB sê*R@ê Îjý’AøÈ…0vþ3Öò6ÀòÞækòïœÜŃ Yáåvå\,aØþånïÞ m,endstream endobj 310 0 obj << /BBox [ 2754.99 4845.9 2777.26 4868.16 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 180 >> stream xœÝ=Â0 …÷œÂ'0¶óãôHl”TP $ÊÀõqZRÂÂ"ç9~ŸozfãÃÝhŒrˆØJÔ<ÇÄ Ó Žps„,B „A© å¢É §±øvlˆ¨H®M& ’Q51R*:¿èdÄUæPFÎM…Fô¡!T½ô˜5ÃØ)|A1KÓcÑÅQ§¨ëÜoÂ÷?wv³W{{:†ËUôÛ?^ÅÁíÝ neendstream endobj 311 0 obj << /BBox [ 2767.27 4840.99 2789.53 4863.25 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 180 >> stream xœÝ=Â0 …÷œÂ'0þkœœ‰2p€ *! \Ÿ´À%Ïzï³ãUϬ0ÞÃ5ˆGGq°d„9Jd_îÛöp „,B„æ”mz8uä nãÄÈȹ0:)>8·G.TwEÕ¢#£Ú¤/z(‰¤…Ý8’c䆰è¹ÇœxWÌ‘"|&˜¹éñÒS¢NQuÊJøþÇŽA1©g‡G`Ø”sú±Š~ýǫ؅mxÜÁo4endstream endobj 312 0 obj << /BBox [ 2779.61 4834.59 2801.87 4856.85 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 181 >> stream xœÝA! E÷œ¢'¨”RJO`âÎqá&:‰‰&êÂë 32ÁpAàÿü¾–n"†ééî.¨&‚˜9¢„€!‘ηh†Ç Žps)¯à1ª·XêÅ×ÀT™P¸0¢ ¸vŽ”`¡jLZuD㢭ø¼ê±T˜`î†& é¥Å\Ð)Á à„B]‡Eׂ6CK¬Sß¿ÝÙ1fVSx9‚]9—‹¶»ˆƒÛ»7©nëendstream endobj 313 0 obj << /BBox [ 2791.94 4826.51 2814.19 4848.77 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝP;Â0 Ý} ŸÀÄÎÇÉ Ø(¨ H”ëãÐÒT €!QÞKÞ'ÞṫÜA´0•€!K¢È(Bß{bÅñ„G¼#qŠŽ‚ºêA]tšqªƒ§ÍÁ+%ׄÔ<µä R%%;OæõÁ=“Éú´lñÚä žªba„¢bsLÁ¯2&ÜÃ\a¾n'ù×z8ƒ^‹âw¶.?†ÐmÿrØÃ ¸îliendstream endobj 314 0 obj << /BBox [ 2804.27 4816.73 2826.53 4838.99 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 181 >> stream xœÝ1Â0 E÷œÂ'0¶“Úé Ø(¨ H”ëã´J[À%ßú~þñ®cŽ0¼Â3H¦„b2+Z”Æòt+Œ8Ã#²&£6•‡QCn‡ÂPäÖb˜î›Jlš™0Æ¢ ãºÁ´ÈÞÄѺ1HBå  êyÄÔQ+‚VgT]'̲øk„jXBÏýßèÃ5Dô4­Á;0üÜ~¬¡ÛÿéNá>æ0m0endstream endobj 315 0 obj << /BBox [ 2816.7 4805.02 2838.96 4827.28 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 178 >> stream xœÝA! E÷=EOPÛÂP8‰;Ç…˜è$&š8.¼¾àÁpAà7ýï—nF‡óî Qúȱ¢*ik÷rÂ#Þ€ITÙÉ'_Æ[Äe.ˆHÁeFF‰ÇkWQ!Ô˜yVRt Š6оé);œRêœûPõñ6ÔŠGl”|—°êb¨3ÔŽ6õðý‹ Îà(§$Ã'îò¹üXĸýÛE`/ü€mŸendstream endobj 316 0 obj << /BBox [ 2829.14 4791.3 2851.4 4813.56 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝ;Â0 †÷œÂ'0~¥NN€ÄF8@•@¢ \Ÿô¡´,€!r>ÇÿoÇ»–Y¡…g$ÙÀ<3*ˆ 4ì58Ã#²9šS¶ñâÉ }±PFjÀ šÁ}›qŒP0¢bÆÆ ¡xå®Ô[DµmEFK«¾âÔ`ÌÏŽêP <+Ь-ó µ`™°|ÿ¡ × ˜´<Ã;0ʹýXC»ÿÓ5œÂ1|7DlÈendstream endobj 317 0 obj << /BBox [ 2841.63 4775.54 2863.89 4797.79 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 180 >> stream xœÝKÂ0 D÷>…O`ò³'9;Ê‚TP $Ê‚ë“Pµ” `%ÏòŒ'ÞtÞGt§“‹œUA‚y¼oåñÄG¾‘‚;Ip%µœ:d‡æ›2!›øºª/ˆ\b¥±JΕ5lá¾*’êü[9Ì<ÍhŠ¥RóóÇd«7ÁbîXbOß¿èéLQrD?Éó®žËEtÛ¿]Äöôý´nÖendstream endobj 318 0 obj << /BBox [ 2854.16 4757.68 2876.42 4779.94 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝP;Â0 Ý} ŸÀ8?Û=eàTB‰2p}’š²p+~ÎûXÞôÎpo)’Œš”ÄÐ{òâty§ñLÎ{VdŠÊ],rb5œÆâ!Ä–=ÄÈ^W dÙՄɇ‚8œ¨Á! ”)ÈŠ ‘ÒJ_á;`æ×A Øä©#iö3*ìO|ý^ö­êïý8CŽ Ú)>Áá.×åÇ úížà{x]l9endstream endobj 319 0 obj << /BBox [ 2866.7 4737.62 2888.96 4759.88 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 180 >> stream xœÝP;Â0 Ýs ŸÀ$Îç9'@b£  ‚JH Q®OÒ’RÀ`ÅÏzÇ›Î9OÃÃÜhJ ðà$$¡ӛh<Ñ‘nƲ± Ë6‡ÚÀF[ˆãP-´j‚2"]W“èY‹«B5%‚sª¬~Á}Q¨°æCÁ6®ž3&E›xNJŸ9†UÆŒ«¢mÑËÞo‡ïôælJ¸G=£]©ËStÛ?>ÅÁìÍ Nóoèendstream endobj 320 0 obj << /BBox [ 2879.34 4715.41 2901.6 4737.67 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 180 >> stream xœÝ;Â0 †wŸÂ'0±ó°s$6ÊÀ*¨„eàú¤-)aá ‘ó[þ??6³ÇáwÓL>`PŽEHëÇñŽXÄ): êr˜>ê¢SÃq( c’X’(¼6Ï” Õl¦ISÑy"­º/Ž'oS‘)YC¨zé1;j†)~¬ä}ÓcÑ“£NQ+ֹ߄ï=z8ƒ'óšŸÀ¸+ïòãÝöOq€=¼äÝoCendstream endobj 321 0 obj << /BBox [ 2891.98 4691 2914.24 4713.27 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 181 >> stream xœÝPIÂ0 ¼û~±4Ž_€ÄràTB‰ràû$U7.<€C”Ìd<{׊ì_ðÍ.äcrAUÒÆòx'1.xÆ0‰*2EcõaÜp}5äX~”Šé}C‰c™8,B!¢:Yp…É$y£¥ «ÃŠÇµbb’•`‹Cr¥:ÇÜcÂ,)fÅr6ø¢ƒ+ÊÁÜ𠂇rn?ÖÐîÿt '8ÂsLliendstream endobj 322 0 obj << /BBox [ 2904.68 4664.44 2926.94 4686.7 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝ1Â0 EwŸÂ'0ŽãØÉ Ø(@P $ÊÀõI©Ò–…0DÉ·þv¼éBˆØ?áRXÉ2ª™’*ŠXðùÎxÄ;0vdRç¢ãÃ9±gú‘a”Jex¢äx[U2“Uj 5 £Vª¡ªåYžj@˜²­ ’ˆehzjñI´ SÂ`FÑ–“ým„f˜‡žòß8Á"åèÅñwõ\¬¡Ûþé°‡7Tœm—endstream endobj 323 0 obj << /BBox [ 2917.47 4635.73 2939.72 4657.99 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 178 >> stream xœÝ1Â0 EwŸÂ'0‰ØÉ Ø(¨ HÀÀõIš¶”…0$Ê·Þÿv¼é¼žpÎÞ(•H&ÈLÛm '<â yfgè ér¨sÑU`¨ ™$•„ ”¯«Jô”rf¡ÈU+¹Tu"]d_ "¤ºÄhíŸdk0òSÁÓHOîRÕø‰o²âsÿX&nþïôp¡$– _àqWÎåǺí?îà{xUl;endstream endobj 324 0 obj << /BBox [ 2930.26 4604.87 2952.52 4627.13 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 178 >> stream xœÝ1Â0 EwŸÂ'0¶ã:É Ø(¨ HÀÀõI -aá Qòœÿ¯z‘€ã® 90©£9¥„ª…$.ûí€{¼“¨rD&‹œ­"wÞÆš¡$©dˆ ž›Š [a§ •;R-lB!/<‡9™7ŠŽÉ›€ ß/Tý\`ʆ;;¥&ÿ…U>70Ý/Oöï p„@)Äñ‚›²N?†Ð¯ÿr;ØÂ™MkÐendstream endobj 325 0 obj << /BBox [ 2943.1 4571.92 2965.36 4594.18 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 178 >> stream xœÝA 1 E÷=ENÓ4LN ¸s\x€AÇ…×7UZêÆ¸(íÿ¿¤ÙL1&XáØ$aÉј‘‡¨í^Op„[ ŒÌ¤@(J&å¡”IGX—‚ÈHìŒ1!e¸ö•Ñ“àÚÐi’­p]gA–¦gOdÃÔ†„" éw‹¨U4ƒЄ£t>ºê ÕQg¬€ï_ÌáܘÔž!ÂÎÏåÇ"¦íß.âöáfKnendstream endobj 326 0 obj << /BBox [ 2956 4536.92 2978.26 4559.17 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝP91 ìý ¿À8ÎáøHt,@°H,ß'Ù%«Ðð +ž‘gÆñfpÎãø„ˆÅ„!úD&(B’œÎoÄéŒG¼“aE¦ l¡6Ê‘5ã4V¹’¹â2qÄ[ÇD_”(–„¸f^RÅJ%½áSQhÉë4‘AÃKÄ,hŒe\ |¦º„WAÛ¡M¬[ ¾q‚ xÊ^Mñw¥®?1lÿöØÃÆëmZendstream endobj 327 0 obj << /BBox [ 2968.95 4499.81 2991.21 4522.08 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 181 >> stream xœÝ» 1 †ûLá Œí<O€DÇQ0À NB (XŸä Gh€"r~ë÷çÇj`ö0ÝÝÕ‰¥Œ!3Ì"(‰uŽQ3ܰ‡‹#dR JêG)R5L…¡„Y!D¦Ê:÷™„ÄPt¬1D)¤Tt&$]ôX*rD½ÃP¬#,zî1W¼31|Ĩ¾ëñÒµ¢MÑmÊFøÞctGç1{5…‡cØ”wúqŠaýǧع­{{ªnÉendstream endobj 328 0 obj << /BBox [ 2981.99 4460.62 3004.25 4482.88 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 182 >> stream xœÝ1Â0 EwŸÂ'0¶“Úñ Ø€TP $ÊÀõIA)eá Qò¾’ÿ¼Ú‰$îp"9“)ª’šø¼G<à˜D•™²säéàܱ‡É#QHõp!ïð²TŒŠ`åBÜU.La•#Q­Ð¸¯/¢Ä¬$f¥”f‡¿2zø(fdSêò"ãÍSFkÑn´–Íáû=œ QIŽÜÔuþ1ŠÝúG±‡-<·Õoendstream endobj 329 0 obj << /BBox [ 2995.04 4456.78 3017.3 4479.05 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 181 >> stream xœÝPK B1 Üç9ALúKsÁÏ…xèAÁçÂëÛVŠÅ…pš&3i6“ˆÇåwpf‘8`1‘:G.jnoÅõ„G¼“8ÇŠLAÙBm”#áºTD–ŠGR2ÁëÀ¨#SôÌB"+•è‚÷Žgð,R’…Dò68tüÎhq”#~b&"¬ú¾C#†¥Ûø÷'f8ƒ§ìµ„?ApWêòãÓö_ïp€=¼Â]m„endstream endobj 330 0 obj << /BBox [ 3008.14 4480.68 3030.4 4502.94 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 180 >> stream xœÝAÂ@E÷œ‚ 0t '0qg]x€F›˜h¢.¼¾ÓZǺñ.&3ø†U'’p¸ÃsšST%Íâõ¾p`Uvd2çÖÆ‡sÃxЇ0•¤Y+‚çe$S6RAkXˆÓÈ-©Wî‹B’-*4ÈbáPyê1)æHdò«ƒ…Rþ´xáX?ÏPóóˆoù÷'z8B¢HÞ:>@pSÎéǺõ¿îa[xœØlzendstream endobj 331 0 obj << /BBox [ 3021.3 4522.39 3043.55 4544.65 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝ;Â0 †wŸÂ'0ñ#ur$6ÊÀ*¨„eàú$E)eá ±òYþ?6=³âø€;h&E‹"¤K”8ÇŽ§ñX$82ÙêÇC žp«’pqP¥(x]gÅ„…´+lB®…UÈtá¡(ÔÉòªÂ˜:]9,<÷¨Š–‘Dñã FÊ«o®Š6E«hS6‡ï=8ƒRRÏŽO`Ü•wùqŠ~ûǧ8À^°ülÕendstream endobj 332 0 obj << /BBox [ 3034.5 4573.76 3056.76 4596.02 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝ± 1 E{Oá Œ;q2P0À NB (Xç p4 @%ßþÿÉñb‚àxƒ ‹RBM&dc¤˜ƒMw²‚×=îð L!F6dRãªíaœ¸ƆȤÑE©T<Í+•jFaeJÙuU M&ÊÒåàþäÀO;9Ggé·žø“ÿU±JEð7ç–ÿ©[ Ð}ÀøþÂoX5¼CÀ•Ÿã-l–ÿ¹…-¬á›l§endstream endobj 333 0 obj << /BBox [ 3047.8 4628.68 3070.06 4650.94 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝ1Â0 EwŸÂ'0ŽãÄÉ Ø(¨ H”ë“´MUÀ%ßyÿÛò®sÎãð‚'xV£„%QL(Bl¾£3/xÆ096dRã¬õa¸€ãP#2™” ŸKÔ}SP¥”Ðsð”¬êL,U'Ê~Õ}qDÝ|ÇDN7ö¦§ü‰n%S\Üž)äMø¬+ÞÚ7bw±Íßà ï-¾Áá¡œÛ tûÿÛÀ ŽðAFkendstream endobj 334 0 obj << /BBox [ 3061.11 4682.71 3083.37 4704.97 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 180 >> stream xœÝ=Â0 …wŸÂ'0vœÄé Ø(¨ H”ëã 6”…0Dñ³ü>ÿlzÅñwPÎB"s d‚!PÈbíŸNxÄ0IlÈ»XãÄVp+C‰ÕRIx]g u‚®œæfÏ'׿|mzp‡©¬*ŠPL+BÓïÕ±dJ!3l„\"eýô˜uuÌS´ŠeÊ…ð½Çgð@­3|‚àÎßåÇ)úíŸâ{x×ón^endstream endobj 335 0 obj << /BBox [ 3074.47 4732.91 3096.73 4755.17 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝ1Â0 E÷œÂ'0NìÄñ Ø(¨ H”ë“´J[À%ÿëÿ'Ç»Î{†á垎I%(4!`H^—{¼ÀŽÐ‡@ „¢dRJ‘4Ã8TFB¶ÂA¸oCL™0r‘‘1Ī#F[t_ F˜Ò&a‚yí75ñ§ølpF˰¶¹Øaßu-´ Z¢ Øß_èÝÕ1fVSx;‡rn?¶Ðíÿs 'wt÷$lÊendstream endobj 336 0 obj << /BBox [ 3087.92 4777.54 3110.18 4799.8 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝPÁ Â0 ü{ O`œ8 øQ PA%$(Ö'iÕ¤âÁ<,û,ûîì]ïœàø‚'›RòT•º€Þ“Nkž.xÆ09ïY‘)(§P åŽÕp G" ™ÃŒbÄû¦“„TP8çd+™œˆcňã5Ú„cËCŋƼ±v„"6MâFbÁy¡šX'ªí™à늮 d’ árÜ~<¢ßÿí#Np„nãendstream endobj 337 0 obj << /BBox [ 3101.38 4815.96 3123.64 4838.22 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝ=Â0 …wŸÂ'0þIêäHl”TP $`àúM€´8Cä|Î{/–7½ˆáø„;˜°% I"åUI£§¹>NxÄ0‰*;2çêÅ9rŒ5ÃÈJ„: ^6%é° Sˆ•»Ò6¥( ‡"§èË» ùÚÞø_õsC‰.þRS^}ðáêh4Eø°ž€3%óìøÁ]9— è··€ìaΫiÏendstream endobj 338 0 obj << /BBox [ 3114.94 4848.05 3137.2 4870.31 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝ1Â0 EwŸÂ'0vìÔÉ Ø(¨ HÀÀõI()eá Qò­ïç¯zÅñWP£Ñ’%âˆ!PˆžæûvÀ=^€IB`G&sÎVΑ«a¬ŒŽ’FÌ$ Ï‹Jg…ƒ*Aˆ¥êDš«îˆ}ÖCéP!±…C#…¼ 4=Íxu´Š•tø!X¦ì‹“®-Es̹߄ï p¥¤^¼Ü”sú±Š~ýÇ«ØÁžp²nÐendstream endobj 339 0 obj << /BBox [ 3128.55 4874.3 3150.81 4896.56 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 177 >> stream xœÝ½ 1 …{Oá Œã8q2GÁ'8 $Ž‚õ/á~i€"r>ë½'Û»Æ9Ý žà$ 5™’G’èl©ýÏø&'†Ljœµ~Œ[¾+¾öKD ¤Š÷M'3,¨]ÅRµr¦˜n‹A•,lš(¯þ‰Æü|j0ùˆ«Û"‰lòG®†y‚E1<%|¯ÐÂ<%oÙð åÝ~\¡ÙÿçNp„§-l¤endstream endobj 340 0 obj << /BBox [ 3142.22 4895.49 3164.48 4917.75 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝM1…÷œ‚`¡ÐŸ˜¸s\x€‰Nb¢‰ºðú¶™™Z7ÀEC?ú€W6³Çé wð¬B"¨)iF)d1µø8áoàˆE\DG]Öz‰Î\Lµ‡+jv‚àµË0SÈX8‘¤ÊFÉ6O^¥Â)wŠ d¡ë°ò<£V´ “¶)GÒψ«~ñ°¾7ÓKù÷'F8ƒ/NbŽøÆ]9—{¶ÿº‡ìá ~±mCendstream endobj 341 0 obj << /BBox [ 3155.93 4912.38 3178.19 4934.64 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 178 >> stream xœÝ1Â0 EwŸÂ'0±ÄÉ Ø(¨ H”ë7)´„…0DÉsü¿¿¼é˜‡ÜA9ÊŠ>³&!‰lë=žðˆ7pÄ"ÎБ7—}}˜ ÎŽCõ0J¾xˆRÀk[H*G) B&Œ\\¹/í&ÄÚtX$±F¾rõŸï'ò?ìIr3âÅU1'X¾—x‹ü+gPJjÙ𠌻r.?6ÐmÿoØÃŠqk!endstream endobj 342 0 obj << /BBox [ 3169.7 4925.79 3191.95 4948.05 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 181 >> stream xœÝ½ 1 …ûLá Œíü8ž‰Ž£`€œ„GÁú$…†(åY~ßs¼˜=Lwwž“¡B0‰¨"(ñ}'V˜Op„›#dR JêC)’f˜§PÆ$…àõ«FËPta§ª–\Ï™0KÓcqäˆÖ5!…°ê%¢Z…1GhQTî] ë kG›úøþÅèÎÎcöj Oǰ+çòcÃöoqp{÷EúmOendstream endobj 343 0 obj << /BBox [ 3183.57 4936.53 3205.83 4958.79 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 182 >> stream xœÝ1Â0 EwŸÂ'0‰Çñ Ø(¨ HÀÀõI(maá Qò¬ïÿ¯º‡;\AbRÃä’I™‰s´×­VðvÀ=^ Pd†’OíaAC ÍC)yõHF9ãù£¢L&XÙ)KãLÅ*{¢ì3÷µÃÌ!‹ÃÌcFíX*Lê¸8H¡¤#·ŒiŠI1ÏývøþGG*bnø€ˆ›zN?VÑ­ÿx;ØÂ\Þo½endstream endobj 344 0 obj << /BBox [ 3197.48 4945.17 3219.74 4967.43 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 177 >> stream xœÝÉ Â@ Eï®ÂoÏT€Äp ‘@´O†… pyžõý½¬ZÃî70)AžÑ‹'’Œª¤)æx?â¯À$ªÈäÁÅë'8qtÕ£÷©!¼Ì‰FÈMÙ(¥Ê‰’VÎÔèÄ0£&/”uá0òÐâ]1f„Ôqvð .‹׊qŠbšz0ø^â'0Ê%ð ‚›þœ¡]ÿév°…—m7endstream endobj 345 0 obj << /BBox [ 3211.45 4952.19 3233.71 4974.45 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝ½ 1 …ûLá LlÇçd$:Ž‚œ„GÁú8 ¡aŠÈù,¿çŸÕH$0ÝÃ-aRHE©3ò@¶Äù{¸†ˆÄ "&‹%ÕE–ažª‡ ˜{ .}&£p6Tv6Fg÷ײðÁl8hW!„V:‡…_=ª¢e4#+|4!Q×ãÍUѦhmÊæð½Ç!œ‚`+@°ñwþqŠqýǧ؅mx%^nˆendstream endobj 346 0 obj << /BBox [ 3225.48 4957.87 3247.74 4980.13 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 173 >> stream xœÝM 1 …÷=EN›Ÿ6í wŽ 0耠à¸ðú¶£µ³ò.BòÁ{—Í@$0=ÜÝ s@M 9&fäH}Ï'8ÂÍy$foàQÍg­‡ùà-Á<Õ C-1õ“)‡°†…2UŽ¿8½Æ´hÀÄ«€Æ%~‘7ÌÝ2Zîùo¬†V  ZÛ¿—ÝÙ &±lðt»2—¿Ûúýàöîî«iBendstream endobj 347 0 obj << /BBox [ 3239.54 4962.47 3261.8 4984.73 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 181 >> stream xœÝ=Â0 …÷œÂ'0‰“ØÎ Ø(¨ H”ëãÒ†…0DÎg=?ÿlº" ww‘bÁœ &LDHÖ8žà7ç1yo_ÒôŸ½(Œƒy¤€‰ÍC"r€k›QdãŒLÆJ¨Á8{d]¸·ŠœQR«(¨¥qXxî1W|2¬Ó«'Œ¥éñæ©¢NQuÊêð½GïÎ.¢F)O`gïòãÝöOqp{÷ú™obendstream endobj 348 0 obj << /BBox [ 3253.72 4965.9 3275.98 4988.16 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 180 >> stream xœÝM1…÷='@ -”˜¸s\x£“˜h¢.¼¾­ãü¸ñ.úQÞƒ²ê˜#ôp QrDH®AEÙÞ1[ûöp „,B„ÉÈS»ej}óȨ©z˜!E¸,2E¡¢£yCEI•5aщU Ž.‹ KH:Œ8th‚)Ãè³Y´¸)Æ!ÆŠiêÃ÷/á"–hõí6õœ,¢[ÿí"va^>Œn¢endstream endobj 349 0 obj << /BBox [ 3267.95 4968.21 3290.21 4990.47 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 180 >> stream xœÝPIÂ0 ¼ç~±§Ž_€ÄràTB 8ð}’–.\x‡Èkf<ö¦eŽÐ?Ã=Di =z“QDP¶¡&Ëð8ÁnEÈ€P\ëÇ(Q%ôÕÃ1[ñ0Ǩp]u²¢BS$®0cJ;RžqW…Ⱥb”*¾Lpœ0¦Ž¢,V²ÆÕˆWÅbbÌ©?ß[tá"æhnð »ò.?Ñnÿö‡°oŠènÌendstream endobj 350 0 obj << /BBox [ 3282.23 4969.28 3304.48 4991.54 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝA1E÷œ‚` íPN`âÎqá&:‰‰&êÂëKGgªà¢Mð?”U£àx‡+&LÖqAvʯ[ Þ¸Ç ŠÌA1PÒ`©>4äP Æê(&w(žxþŒdW s!¶ÊF8›t ®°B‰[…¦Ü5‡ÆSW,Í$›ƒFâÖó ïü<â,ÿþÄG*¢¦ø€ˆ?§{è×ÿº‡lá :æmoendstream endobj 351 0 obj << /BBox [ 3296.61 4968.93 3318.87 4991.19 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝA1E÷œ‚ …¶”˜¸s\x€‰Nb¢‰ãÂë;Çfâ¸ åøŸ²éBPpÏ”FÏ…\Q„$kïxÂ#Þ€)ˆ°!S4öXãÄVpªF¡$“Faâ„×u%Ñd¥ÊBÙ*;‰U62m܃j*«†ÉÓJ ñl1,‹äŽMÀ˜J\9¼¹|vX:ÚŽ‹À×/z8ƒRQsÃ'ÜMqùqˆnû·‡8À^(`n|endstream endobj 352 0 obj << /BBox [ 3311.04 4967.02 3333.3 4989.28 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 177 >> stream xœÝ9Â@ E{ŸÂ'0^’ñÌ è@ $BÁõñ(d¡á#Ï·üŸ—M'bØ?áf"Ä 6%9±¢*iŸãpÆ#ÞITÙ‘©q.Mý8·ì‡¾2”J †g’„·U&©bh'©ÒÉrÈÀ|Ò§0¨“ڪ¤Æ0é±EuÌ ôH™J»j1êjøÌ0ÌCþïNp£l^_ ¸‹wýq†nû§g8ÀÞñmRendstream endobj 353 0 obj << /BBox [ 3325.51 4963.39 3347.77 4985.65 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 180 >> stream xœÝPIÂ0 ¼ç~‰ã-y7ÊTP $àÀ÷i )åÂ8XöX3ãeÕ1 ÷p ÌIQ ¤#H “‘OY=Ãí{¸„ˆ”Rtˆ(‹Ô£ÆJª‡£ðèá‚Êp^v jf¦š¥dFçŠ MgÜ !tZ0D1ÛÂaÆÓŒIñîXA1ø8˜"ÓbÆ WEÛ¢1Ú–ÍáûŽ>cf/@°ãôãÝú_± Ûðà7o;endstream endobj 354 0 obj << /BBox [ 3340.1 4957.97 3362.36 4980.23 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 180 >> stream xœÝPÁ Â0 üg O`b;‰“ øQ PA%$(ÖÇ¡4 à9gïìÛ DÓÃÝHðHJT, ÌÈQó»&R˜Op„›3 ³WðÔ—P?ê£7â> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝP» B1 ì3…'0NÛÉHt< x‚'!¬Oò~„†("û¬óÝÅ›Î{†áéîŽY"Z„˜…PBÀ –¦ áæ}d@r¬‘P¡=†ª ¨ZÔ£&¸¶E`VÂT •’+L¶â¾,”.sÃ0AJÀŠG‹qcžT+ %dã1áº1‡XKÆEàû½;;ÆÄ– ^Îî¼ËCtÛ¿=ÄÁí݈LnVendstream endobj 356 0 obj << /BBox [ 3362.46 4945.9 3384.72 4968.16 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝÁ Â0 ÿ™ÂÇNmg$~” ¨„åÁú$*MˇxDÉYöÙñ¦Q`x†GQƤrêÐ30#k´vg8Â=Ff2 LF9Õ‡QGæ0Õ‘P¼8:Cb¸­"ÅN ;v©²"KaÔ†§R`Žª«gô¸Ì<µ¨-1+,†dè¼´˜°Ì3Ì mêàû§p ‚.– ^!®œëEôÛ¿]Ä!ìÃ.nuendstream endobj 357 0 obj << /BBox [ 3462.77 5119.27 3485.03 5141.53 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 181 >> stream xœÝA1E÷='Àm)'0qç¸ðF'1ÑÄqáõ¥šŽãƸhè£üe5 Œ÷p ’ £*d"CV`FÎZ_±Ât„=\CDbŽ “FKí¢1G/œÆæ‘°˜{ˆ¿Ãe™È˜ 8W¬Òذ³ V›ùà ­heQQ‰3·MМQ| ˜lÑâÍMчè}Èîðõ‹C8w5…G Øø9ÿØÃ°þ×=ìÂ6<’mLendstream endobj 358 0 obj << /BBox [ 3628.77 5418.53 3651.03 5440.79 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 180 >> stream xœÝ1Â0 EwŸÂ'0‰ãÄñ Ø(¨ H”ë“PÒ–…0Dɳìÿ¼é¼8<à!q&UŒâ3Å€ÌÄÉë|'<â yf§èHÔ™Ô‡ºè4ã8à(YÑ`£ñºª!e,,”¥r¦¬•lƾ ˆ¥UƒX±\ 4ž,Þ­" .!ãb1ah憖ú#ðý‹Î(5Å'xÜ•sù±ˆnû·‹8À^ûenCendstream endobj 359 0 obj << /BBox [ 3838.06 5800.54 3860.32 5822.8 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 178 >> stream xœÝPK1Ý÷œRJO`âÎqá&:‰‰&êÂëÛççÆ¸ å‘÷¡læÝ3ÜCôèHɉ0)ˆ çù}œà·@È"”P3í›L‰²Ã£ë= ¯Ìh×õÄ0Gˆ®Š¬ ¡{ Ê Û*HZW„䨼2˜ñ1(Æ ,$¨¶$|`ÏŸV˜ÓŠ£þûm8‡ˆsÉð »Z—gh¶z†C؇7sm¼endstream endobj 360 0 obj << /BBox [ 4072.9 6230.95 4095.16 6253.21 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 182 >> stream xœÝ1Â0 EwŸÂ'0¶“ÔÎ Ø(¨ H”ë“¥”…0Dɳþÿv¼éEޏCdSÊ‚¦œP•4™Ïw'†Ó x&QeC¦hœc}'.Âi¬‘\KFTbÇëºb$ ;e+œ„4öHŠÃ3q^)r «„…çÕÑ*Áˆ? AÉmÕãÍÕѦhŠ6eKøþÇgäÁŠç ‚»r.?VÑoÿxØÃ ù+nZendstream endobj 361 0 obj << /BBox [ 4222.17 6507.75 4244.43 6530.01 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 177 >> stream xœÝPÁ Â0 üg O`;© øQ PA%$€ëã¨4-à9w¹;;Þô1 ŒÏp‰™1t™5ƒ#Îj­>Np„[ ŒÌ¤@˜”Jª%·¸`¬ ©xF44ƒëŠaÁ’Á±!§Š­ò‰EPÜ †¢+Ab̼ ˜ñÔ¢:#h–*ØuK‹ VÃ<Ã,hS¾1„sðÑ¢ð v~.?Ñoÿv‡°o…mÑendstream endobj 362 0 obj << /BBox [ 4299.49 6648.26 4321.75 6670.52 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << >> /Subtype /Form /Type /XObject /Length 8 >> stream xœendstream endobj 363 0 obj << /BBox [ 4310.96 6652.21 4333.22 6674.47 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << >> /Subtype /Form /Type /XObject /Length 8 >> stream xœendstream endobj 364 0 obj << /BBox [ 4275.39 6571.25 4297.65 6593.51 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << >> /Subtype /Form /Type /XObject /Length 8 >> stream xœendstream endobj 365 0 obj << /BBox [ 4227.8 6464.05 4250.06 6486.31 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 177 >> stream xœÝA! E÷=EOPK)N`âÎqáŒNb¢‰ãÂë Î0ÁpAÊ/ÿµ¥›Á9ã "F £F%(B­q:ãïÀäDØI³Ö‹q`K8µD&“RÃæÖe“xTñž’U­äsÕ‰²_õ©ªÝ³&r¡Ã›ž|ì-SFs¸à1P¶®ú¬«½õoŽuâÿþÁ .PoÅû‡»r®?–0lÿr ØÃàÈl\endstream endobj 366 0 obj << /BBox [ 4176.52 6346.34 4198.78 6368.6 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝ½ 1 …ûLá Lâ8¶3GÁ'8 $ `}Ž¡aŠÈù,¿çŸÕB„éƒ &‰,ˆ$èoØÃÅy D^Á#«Ï\?ê“WƒÛT= 9¤Èç.#„‰ƒ•˜+ ŠUVYx,ŠL¨ÔUdAÓΡñÜã¥hBðq`CÒ®ÇÌUѦhËÜo‡ï=Fwt-jVx¸›òN?N1¬ÿø;·uOfocendstream endobj 367 0 obj << /BBox [ 4127.4 6229.27 4149.66 6251.53 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 177 >> stream xœÝP91 ìó ¿ÀÄGâäHt,XÁJH ß'Ù%«Ðð Ëkf|l"ééîN‰ "sF6`FŽ´ä` '8ÂÍy$foàQÍg­…ùà+aª…‹‡z” ×¾P#(‰Ô\pÆH' ¼â±(T°'¨¡ig°âyÄ,øt$ ¬BH©›°à*h;4FÛ±|_1º³LbÙàåv%.?1lÿö·wo’‰mendstream endobj 368 0 obj << /BBox [ 4084.01 6120.01 4106.27 6142.27 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 178 >> stream xœÝP;Â0 Ý} ŸÀØŽ“4'@b£ A%$€ë—¦E €!ržõ>¶W½HÀá70îŒX0‰²WUÒ$y¬1wx?â¯À$ªœ‘É2óOæÈNÜ#R Õ#‰á峓HѸTó\¡1…è8:±á˜0WâL6¯M¿À1`äOMî<ëU> >> /Subtype /Form /Type /XObject /Length 180 >> stream xœÝP;Â0 Ýs ŸÀ8¶§'@b£  ‚JH ×Ç)¥„…0äóœ÷q¼êcïá”´ dbFað“•éÌÑàv€=\ad&B5ê´^Œ9ñ6ºGò÷ä"¨ Îm¥`bp¬XC”1ç ;[ðà‚¬¨-#»°4 ž"&Å\á‚RàãÀЬMÆ WÅÜÄB˜{||ÿbÇ XÄ:ƒGˆ°ñuú1ˆ~ý·ƒØ…mx£/lüendstream endobj 370 0 obj << /BBox [ 4020.55 5937.52 4042.81 5959.78 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 182 >> stream xœÝ1Â0 EwŸÂ'0ŽÇÉ Ø(¨ HÀÀõI(-eá Qò¾¾¿¯º‡;\!²0™¡u2AóüºSp¼p` "ìÈKlgãj¼ -Cª^3b¦”ð¼PLÉ+'J¡±SöÊ(å™ûZ¡‰ÜŽÈ”Ë"aâ±G«˜%+øIÐB1.zŒÜ*¦)&Ç<÷;áû=A)«ÇÜÔsú±ŠnýÇ«ØÁžÉo3endstream endobj 371 0 obj << /BBox [ 4000.54 5864.92 4022.8 5887.18 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 180 >> stream xœÝM1…÷œ‚ t(tN`âÎqá&:‰‰&êÂëÛΟuã\4ô£eÓ‰48<áÊÌc2¥6`L|ŒÑ>NxÄ0IìȤέ–‹sä"ŠG µìáF¬x­2IH3³}F²´rŸ ÄȵR¦”*ƒ…§¥bÍ0µŽ3JMÕcâR1±Ö©gƒï_ôp†& =¿½@p—ÏåÇ"ºíß.â{xV$m¿endstream endobj 372 0 obj << /BBox [ 3987.03 5802.64 4009.29 5824.9 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 182 >> stream xœÝA1E÷œ‚ ”v '0qç¸ðÄDuáõíT§N\x¤¼øPV½ˆâx‡+hv#Ž˜œuC ÌëÛ‰áí€{¼“„À†LÑ8Ç)1N\ oãäá”Sñ%ëð¼Tœ< æ¬$‹mö ¤k<@dV Ú”ÂFêÍ`ÁuDíx+ìdø1àH)-F¼x€¶Ã\0¯Xû¿ÿ0À”\->@pSâôã ýúOϰƒ-<ŸmÞendstream endobj 373 0 obj << /BBox [ 3978.69 5748.13 4000.95 5770.39 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 178 >> stream xœÝ± 1 EûLá Œã8g{$:Ž‚œ„P°> §¡aŠ(y_ßߎWcŒ ¦G¸…äj88dÃ"2#gµå¾a×@™IP”\êC)S5L%ÇX2²#+\:eL j®l(VÙÑxáC©pAóÎ᎔º„ÆswES>™r×bæZІXmì9àû‡p -©+> >> /Subtype /Form /Type /XObject /Length 178 >> stream xœÝPIÂ0 ¼û~q¶Ú~7ÊTP $àÀ÷q(iáÂ8DÎ83cgV} Ç;\!™$RÅÒ™’`Œ‹è\oÜã˜BŒ,È”…-׋páJ«E!wðÒ„ç¥2©¡C#+qv¬…8Ìxp1¹ý°L1}84> >> /Subtype /Form /Type /XObject /Length 180 >> stream xœÝ± 1 E{Oá LìÄq2GÁNB‰£`}PŽ£aŠ(y–ýÿWsÄñ7ˆÕ˜„Q³2© If›ïéˆ{¼B  †’…šÚÂ+8M#'×ÈBYñ²¬£³‘Tgw+Ù¹EùàÅ(ñ¢£z[(Ìüòh½¢FZñ£ ‘RZx¼¹Mô½£§ì ßÿ8À "•hÕðŒ?ç«Ö¼Šlá 7o¥endstream endobj 376 0 obj << /BBox [ 3969.48 5604.33 3991.74 5626.59 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 178 >> stream xœÝPÁ Â0 ü{ O`ì$Ž“ øQ € HÀƒõq)iˇxDÎ9wç‹WHÄþ7ˆ5WJ5s¢˜0 jeª÷#îñ L2%㚆‹±ò@èÝÄ’[ˆú3^æF`Òˆ•Tœ(Ç…)Ë„.(JÙ–ŒJ%,G¼­ã™gΞ|1că¢¥hŒ–úcðõ‰œ R‰V Ÿ ¸ñsþ±†ný§kØÁ^u’mŸendstream endobj 377 0 obj << /BBox [ 3967.63 5555.26 3989.9 5577.52 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 175 >> stream xœÝPKB! Ü÷=Á(œÀÄÏ…xÑ—˜h¢.¼¾€ïçÆHB`Ú™égÓY+<<éN’£"zåÀEv.hšßlj|#ëœQ6ðj²¯5ÁTÂP=2B(1ÂóuP Y² ´Â€†t†}¡'A’%ŸYWê 7ûÆŸâxÑ…M«\canx4ø §3UC-5^dyWîåÇ ºí®à@{zÙlñendstream endobj 378 0 obj << /BBox [ 3965.03 5502.82 3987.29 5525.07 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 180 >> stream xœÝ=Â0 …÷œÂ'0þIâäHl”TP $ÊÀõIZRÊ¢ä³Þ{v¼é˜†‡»;Í1 y“€J°4ß0žà7GÈ"d@貯£@E65!b%³‡ëº’A³1R. Šì+Gä¸p_ä‰Qd¥H55ûSú$W(a2øØÉ£éªÁÌÕÑFhŠ6_KøþAïÎN1©eƒ§cØ•sù±„nû—K8¸½{ËlŠendstream endobj 379 0 obj << /BBox [ 3961.08 5446.06 3983.34 5468.32 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 172 >> stream xœÝ1Â0 E÷œÂ'0¶“ÚÉ Ø(@P $ÊÀõqT¥ÍÄ¢äýøÛ»‘9Âô¯‹2R†!%ERAQ¶õž¯p†g d2 LF%Õ‡Ñ@–ažjFô€Á3<jM—µ²br4—¥áÅ‹ÍPÊöŸSoo¼¤Wêˆ[@2,¹ë°pu´Z…övíÓo!bŽV >áàçþc÷qÿO»ŸÂ1|iZendstream endobj 380 0 obj << /BBox [ 3955.61 5384.6 3977.87 5406.86 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝ½ 1 …ûLá ŒÇv2GÁNB‰£`}.(ä aŠÈù,¿çŸÕÀ,0ÞÃ-HQEcPÉ bÄhì=NGØÃ5rŒä@˜œJª'%Ï0ÕÂQe¶(Š.pY2‰3H1FóŠ KªlèÚù0 œ1óG…+] ¶/Á;ChÝ@²¡Æ¥EãªhCôŠ>usøÞâNA0‹‡G`ØÌïüãÃúo± Ûðæon‡endstream endobj 381 0 obj << /BBox [ 3948.66 5318.23 3970.91 5340.49 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 178 >> stream xœÝ1Â0 EwŸÂ'0‰íÄÎ Ø(@P $`àú$--eá ‰ò¢ÿ¿¿¼êbìp)ê”3&‰N,ÈLœÆÛïGÜãEæ`H-m )4A_R ä5 IÆËâG”T°²’qc§d ™Ï|¨Ž¬äy¡Èea`L´*qÁ‘kÉ´ˆ¹É§á³bªûNø®€¹X1|BÄM=çèÖÿ·láX‰kUendstream endobj 382 0 obj << /BBox [ 3940.21 5247.1 3962.47 5269.36 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝA1E÷='@ P¦'0qç¸ðF'1ÑD]x}[ÇiêÆ¸hè£üe52G˜ábVBa0QG”ÄþŽæܰ‡k dr T§¬õâdT ¦j!å½XØ€áÒeRDÉP8¡xeGÕÂÆµñ¡(,¡v‰Ð¬3XxnQ-‘4ÍHÒu˜¹ ––Š6õÇàû‡p ‡èÙá6åœ,b\ÿí"va^åÜmtendstream endobj 383 0 obj << /BBox [ 3930.54 5171.52 3952.8 5193.78 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 181 >> stream xœÝ½ 1 …{Oá Œíü8™‰Ž£`€œ„P°>ÉA¸Ð0E”|Ö{ÏŽWƒˆÃéWpÙ1AL((ª’KóÅðvÀ=^€ITÙÉg_Æ‹ð6Õ %KFRŠÏ}ÅÈ Gª˜…R,è…âÂc1øHæ:E`J© øðÜ¢:ZÅŒBÂ%Áy×õxqu¼‡h‚6c øþÅGp”œeÃnÊ9ýXİþÛEì` OÿnYendstream endobj 384 0 obj << /BBox [ 3919.89 5091.99 3942.15 5114.25 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 180 >> stream xœÝKÂ0 D÷9…O0øÓ4ñ ØQ ‚JH Q\ŸE¡l8‹Èy–güÙ "FÓ#܃¹8²Sd¸“*´—Ôâ|¢#ÝCT9£KìÝòI9eš§â¡‚,… ÅøºÎdˆSáï ‹Â¬° ØEa=ØWCmåÐøÝcQÔ {Gjì—OÊ‹¢NÑ*ê”Íá{1œƒ![òDÏ ´+ïòãÃöOqûð§úmþendstream endobj 385 0 obj << /BBox [ 3908.49 5008.94 3930.75 5031.21 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 178 >> stream xœÝPË Â0 ½g O`lçë ¸Q PA%$(ÖÇMi à9ÏzÛ›ŽÙÃðpwç• …HV5‚JÌ¥ÖÄÆáæY„2†L¦O¦HFó`ë›…çÚ4"ZÁ€±bEÑ +&^qo ˜JÂÅ7+®UñîpDbø8XtIMÆŒ'Å2Åʘ‡\ ¾–èÝÙy Èšáévö.?ÎÐmÿô ·w/> >> /Subtype /Form /Type /XObject /Length 178 >> stream xœÝ=Â0 …wŸÂ'0±Æñ Ø(¨ H”ë“ÐR2q†8þ¤ççŸMϬ8>àš=QbŒ.B9a‰ÒY~ÿ‰ §ñX$Š<ÖÄBŠp«G¦N‹‡F¼¶èª¡” G%áÊFW@KsnœÈ»Æaå8Ë”L®ø-—HæMƒ™kÅg„E±Ž¸8´ p¥¬æ†O`Ü•wùq~û8À^o±lendstream endobj 387 0 obj << /BBox [ 3884.49 4834.13 3906.74 4856.39 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 182 >> stream xœÝPÁ Â0 ü{ O`œØIœ øQ PA%$(Ö'iÕ´âÁ<¬øN¾;Ç»Î9ÁáO3%5T¥BzO>HžÞèŽ<㘜÷œIg­MâÀÉpªG$uÅCCQá}Ã&ËL!T\ÒRÅ¢k¸ÉÌmȬd~uhxΘ Ãäq5H63.‚¶Ä2ÑÖž ¾~ÑÄLRNø‡‡R·‡èö{ˆáè,n-endstream endobj 388 0 obj << /BBox [ 3872.25 4743.1 3894.51 4765.36 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 180 >> stream xœÝ½ 1 …ûLá Lü“s<GÁNB (XŸäPŽÐ0E”|Ö{ÏŽW#‘Àô· Ù9š pl¾“e¸aב˜£ADµèZS¬‚©F(ZRdK_qd‡Â… ‚ª…³ øÂ‡âÈ5u gLÞ%,<÷¨ŽVQGà“  #u=Þ\mЦhS¶„ïÂ)f17x‚M9ç«×¼Š]؆£¸o:endstream endobj 389 0 obj << /BBox [ 3860.12 4650.07 3882.38 4672.33 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 178 >> stream xœÝ» 1 †ûLá Lì$v2GÁ'8 $Ž‚õq@¹ PDÎïÇçÇf 0=ÜÝ…,MDI½3²Ðjçáæ,‡Ù£úëG}òšaž*ƒÑ'c!¸öAV0-5E@¦•Œ¿èÑ*T0p—‘ÍJGXô»G­hž$uƒ•Kéz|t­hS´Œ6e#|ï1º³ ˜ƒ…§#ØÙ»ü8ŰýãSÜÞ½k}nåendstream endobj 390 0 obj << /BBox [ 3848.15 4555.24 3870.41 4577.5 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 181 >> stream xœÝA! E÷œ¢'¨´´N`âÎqá&:‰‰&êÂë 3aÄpAÊ+ý¿¥›(Àôtw’$$QUdfäH6Gµáæ<³7ð(æ³Ô‹yõµ`*ê±<ŠÆˆÁàÚeŒP 2UVÔT9#ç•Ç¢ˆ‚A»Š˜PrçÐxé1+Z†0ÀÇ@ )v-®‚6ÄZÑÆ^ ¾1º³ ˜‚eƒ—#Ø•sù±ˆaû·‹8¸½{!Înlendstream endobj 391 0 obj << /BBox [ 3836.38 4459.65 3858.64 4481.91 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 180 >> stream xœÝP91 ìý ¿ÀÄN;/@¢c)x‚•@ ¾O²°  ˆœÍŒUDZÀ ¢ÇLÑ1%-”EH2ÛPÕïGÜã±H0 ”,”Ô>44Aß2œ¤Ô «´ãeÉ(yÂèI(iÃ…Š7l¤<áCu¨ÚB¡™L z Ž“•ŒqNÈÜêÜã›cœbTŒSŽ ß{à‘Ŷða o¦endstream endobj 392 0 obj << /BBox [ 3824.87 4453.76 3847.13 4476.02 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 178 >> stream xœÝP± 1 ì3…'0vìÄñHt<¼à%$€‚õI€ÀÓ0E”Üùîb{10 L×pR¢b1PM‚–!FŒ™í}_v°…S äÉ€P\ÛÃ(‘¸L-#£yÍÈŠÇ9á褡KÅ¦È &tïp¬ze$ûÔ5aä™ý[þCÿ"’cøøSÂ\fHåÍ naUÏádžå_.aÖáÂ+mendstream endobj 393 0 obj << /BBox [ 3813.55 4510.72 3835.81 4532.98 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝA! E÷œ¢'¨´JO`âÎqá&:‰‰&Ž ¯/¨Œ¸ñ.¼ŸßßÒÕ@$0ÝÜÕI&Á!Dò¨ Ìȉt¹çìáâ<³WðÔ[¨õÑk†yª±è%ƒ s„s¯$4†Â†I ¡O…9`²…ÇRÁ†;‡ZÐðÙ¡úß%TƒO91¦Ð5xq-h#4G±%|btG'˜EMáî6åœ~ìaXÿëvnë·Ümšendstream endobj 394 0 obj << /BBox [ 3802.51 4608.31 3824.77 4630.57 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 178 >> stream xœÝ=Â0 …÷œÂ'0þKœž‰2p€ *!D¸>‰JCY8C”|–ß{Ž7=³Âø÷ ™#ƒ%ʨ ‚’ØÛ=à·@È"ä@hNÕ‡S$Ï0ÕÂФXp‡fp]UÄ0BÁŒ1U̘¬0+&m<gôUCÉÏñ£_p¨ý­b¨MÏ„¢«€™«`aéh3¿ ¾ÿ0„sPÌêÃ30ìʹüXC¿ýÓ5Â>¼l–endstream endobj 395 0 obj << /BBox [ 3791.65 4728.82 3813.91 4751.08 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 180 >> stream xœÝPÁ Â0 ü{ O`l'©ã øQ PA%$€ë7¡¨©x0+¾Óù|ñ¦ 8>áÁ\¨KM3eEUÒNìý&Ëø8áoÀ$ªlÈ=ÖÆ8qŒÕ#P²âœ<áuÅÄD,X°‘IÅNÒaȬd¾à c”ÓJ!BîÍaÁóŽ:±0‘²cs%\\í˜ñ-ÅGÑrÏ_ÿà rÃîJ]~œ¢ßþñ)°‡ Kñoªendstream endobj 396 0 obj << /BBox [ 3780.96 4858.74 3803.22 4881 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 177 >> stream xœÝPÁ Â0 üg O`l'í øQ PA%$(Ö'QI à]Î:ßÙÞôÌÆG¸‡¨Fè’u†š@%³.8à·@È"¤@˜”<ÕRGj0ÕCЬxd¯xý¨hBOP¸"IåŽä…»Tl|(®ÈyU1ÆÕ Ñ9¡è—BBcXÛ3aÎ3¯m„¦X†~;|/1„sˆhÕžaWÞåÇúí¿Þáöáú£n½endstream endobj 397 0 obj << /BBox [ 3770.37 4988.46 3792.62 5010.73 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 180 >> stream xœÝ=Â0 …wŸÂ'0ί ±QPA%$(×Ç)M) `H”/z~Ïö¦s.àð€;¦ ‹*ŌޓOÓàxÂ#Þ€ÉyÏ‚LQ¸ÄúN,ŠãPL­æP e¼.‰9R4ÎCe%uÆê(-Ø[fJy%(°ªŸpö¯òÆ‘RÄVml“”fß°êßùÁÒðlð5@g¤–"ø‡;;—+趸‚ìá8vkéendstream endobj 398 0 obj << /BBox [ 3759.83 5111.64 3782.09 5133.9 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 177 >> stream xœÝP» 1 í=…'0v~N&@¢ã(à'!¬J PDÉ{zÇ«IÄãr‡+x…²Ç("”:G.jî÷í€{¼“8ÇŠLA¹„úPŽ\‹e$! –a.£Î#£”Ž”‹a/T²ae*±ãÙšˆÝ ÈÖ©CBǯŽêhŒ(©à'A<Å4t¼qu´)š¢MÙ¾ÿ1ü-G‹â7vN?V1­ÿx;ØÂy}nÅendstream endobj 399 0 obj << /BBox [ 3749.38 5224.69 3771.64 5246.95 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 181 >> stream xœÝ=Â0 …÷œÂ'0þ‰ãäHl” ¨„0p}Җвp†(ù¬çç¯:f…þnA=Ô &1AIìãmžá~„=\!‹at*qx8 ‚¾z£V 5Ì —¹ s†Š†1 lHZ9š|øP’¡å¥¢ Ë¡ñ4bìh•Å`v„‰3&:ZЦh©ß_Ÿ8„SPÌêÅá6õœ¬¡[ÿéva^°ùläendstream endobj 400 0 obj << /BBox [ 3738.95 5326.1 3761.21 5348.36 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝ=Â0 …÷œÂ'0þ‰ëäHl”TP $`àú$””²p†(ù¬÷ž¯zf…ñ®A]fSéDPÌÓ|ß°‡K dr ŒN9Ö‡“QŒ%#&/ê(΋JT†Â†Ä•;ŒVØÉgŠÃ 9.%/O=^ŽVäŸIH²è1qu´)šbžûðý!ƒbRÏÀ°)çôcýúW± ÛðÚngendstream endobj 401 0 obj << /BBox [ 3728.51 5415.98 3750.76 5438.24 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 178 >> stream xœÝ=Â0 …wŸÂ'0ñOêäHl”TP $`àú$-©ÊÂå{z~v¼é™Ç'ÜA]EÆh)'!‰óí '<â ±Hp d²Õ‡‡ªa, Zt) âÄx] *Ä6Š^¹#•Ê™:[x(f´6X¢d«€ÆS‡Éß¡ ¸Ô³SÊ«3ׂ6Ââh3¾þ0À”’zv|㮜Ë-ôÛÿÜÂöðïál%endstream endobj 402 0 obj << /BBox [ 3718.12 5495.34 3740.38 5517.6 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 180 >> stream xœÝ» 1 †ûLá Œ_‰“ è8 8ÁIH q¬OîEÑó9þ;Þ4Ì Ý#܃:gdh%¢ˆ $ö9ö'8Â-P­r 4§bÃÅ)’gè»ê!„d#¥ú×U†£BeCÎGLyà‚b3·U¡†*« Íhiå0ñ§Ç[1eav°â(¾ôyPŒS,ÓÜ£Ã÷?ÚpŠY½8<îžËU4Û?^Å!ìà ù> >> /Subtype /Form /Type /XObject /Length 182 >> stream xœÝPÁ Â0 üg O`l§Ž ø¨ HÀƒõIZBˇxDÎ9wç‹W;æÃ#ÜB42LªIш ¨ùXÜp€k d2 ìŒrW/FJ…xªGFÍÅÃf‡Ë¢ã‚¤#šVœP*ttn°/|‰è>¿‹#ÉBÞð4`´coƒdXRÍ&\-Bc|B¿¾?чS(–ѲÁ30lÊ9ÿØÃný¯{؇mx±nfendstream endobj 404 0 obj << /BBox [ 3697.29 5629.47 3719.55 5651.73 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 182 >> stream xœÝM1…÷œ‚`¶”˜¸s\x€‰Nb¢‰ºðúNÇù‹ ࢡå=(›†Y±{Â4»‘8¦,N1£I²2Ä̆ñX$Š<Ö‹…úÂGW=œ„{(9^×™D9£ZPÒTÙ©T,eÂÔX)–å²®ä3 Á˜ÑDIq1P&õU‡WÅ4ÂX18:|}¢…3(57|ã®?—{h¶ÿº‡ìá 6ímêendstream endobj 405 0 obj << /BBox [ 3686.85 5688 3709.11 5710.26 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝA1E÷œ‚ -'0qç¸ðÄDÇ…×·Õ™N⸠åøü²éCpÉ–É:ì²ÆH1mïtÂ#Þ€)ÄÈŠLIÙSM”;VÃi¬FªEÀBÂëZQNQ²GòPÑHRe%·Æˆ²wk‡²Rð&°à¼á=°TcM ›“˺bæ2±˜hÍõGáëœAÈD]ñ w%.?ÑoÿöØÃ Pýnkendstream endobj 406 0 obj << /BBox [ 3676.42 5743.12 3698.68 5765.38 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 181 >> stream xœÝPA1¼÷¼[ Ð¾ÀÄ›ëÁltMԃ߷]íZ/>À¡3e5„À0ÝÝÕ±š¢DÆ@@„¤Áæ-Áí{¸8_ÞÈxóYja>úJ˜ªGBæâ¥¨àÜw22k¢¢,XE+6Œ²à±(2¡†Ž‘M;‡Ï3fÅ»#C‚ƒDôÒÍxáªh[4FÛ²9|ÿctGǘزÁÃØ”8ý8ŰþãSìÜÖ= 4o€endstream endobj 407 0 obj << /BBox [ 3666.02 5796.23 3688.28 5818.49 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝP;Â0 Ý} ŸÀ8vc''@b£  ‚JH Q®OÓOTÀ`ÅÏzÇ»6ÅþOP3#ŒžDQ„Ä‚×w¸àÀDØ‘©qÎMiœ#{¡/N9bL줎÷Í$5Šj.Ĺ`£è;«¸iL” #©mV> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝIÂ0 E÷>…O`’xJN€Ä޲àTB‰²àú4t l8‹Èy–ÿ÷°ibdìp6U2AÍ’‰S¢dÑ—ØŸðˆ7S ŽÄC‘úñ Á3ö]õpR<´^WRF6‹ä3™W4r[¸)˪•J^Ì<¶x+æŒü8h ¤«#WÅ4Ä\°L=|oј2{q|BÄÝð.?ÑlÿöØÃ ç¼o6endstream endobj 409 0 obj << /BBox [ 3645.24 5900.06 3667.5 5922.32 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝ=Â0 …wŸÂ'0¶“Øé Ø(¨ HÀÀõI€´eá Qò¿Ï?«^$àx‡+‹‰4bꘉ UIM|ºoÜã˜D•™¢sëÃ9±g¼•á$V"¤x^¬`0X Z´@•F!79”|Šqþ·D)/ì“®üWþ'ÀFe’ÙÏB]^xëêh´ŒÖa#|0Àåàã7åœ~,¡_ÿåv°…'ýlDendstream endobj 410 0 obj << /BBox [ 3634.91 5951.81 3657.17 5974.06 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 178 >> stream xœÝP;Â0 Ý} ŸÀÄq''@b£  ‚JH ×'i›RÀ%ïé}o:fÁá w(2£feJŒÞ“WKÓñŽØ{gè(˜Ë¡>Ì©+²ÇP"%) ÑS¼®™„ƒ£l˜'ÖŠ#¹°à¾ÈK5óJ¡ZËgûÆôQ>3j” ?v2YL¸:ÚMÑæk ß?èá R+ž0îʹüXB·ýË%`oÚÈl˜endstream endobj 411 0 obj << /BBox [ 3624.62 6003.59 3646.88 6025.85 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 183 >> stream xœÝ1Â0 E÷œÂ'0ŽØõ Ø(¨ HÀÀõI )aá Qò­ÿŸ¯úÆ{¸QN¨J$˜˜‘³uó­Ñàv€=\ad&Âdäize*ÆÛ81s*Œ˜ÐÎmÅÑD…P½ht™tFË‹J"vÜ8RB׆°è¹ÇœxWÈQ>ʘcÓ㥧D¢:ꔕðý!ƒ`'æaSÎéÇ*úõ¯b¶á  nkendstream endobj 412 0 obj << /BBox [ 3614.34 6055.33 3636.6 6077.59 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 181 >> stream xœÝ½ 1 …ûLá LlÇöÝHtœà$$€‚õIîÐ0E”<ë½Ïv6‘Àð ÷ F %EUfdõf¼'8Â-D$æè1ylSyxÔ˜¡0,»3à “µª8¡2ˆqN©hV¤fЪûˆZ;$¡5`ÑS‹1±T¥…A=¯Põ˜tIÌC,†uêð½EÎA°o^`—ÏåÇGtÛ¿ýˆC؇7@mšendstream endobj 413 0 obj << /BBox [ 3604.1 6106.81 3626.36 6129.07 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝKÂ0 D÷>…O`üIâôHì( € H”×'iIU6€EäŒ5ó4ò¦1žðKH“p¢,¨J=O3‰ãxÆ#ÞITÙ‘)8w¡~œ#ã8TF"Ö§Îð¶Ú¨¡6TN«Ž¤aѧbW&[4Pˆ-ÝÄ ŸÜm£”3.iÎäºÂϺZæXú~ßýOp£lÞ9¾@pWÞõÇ úížà{xYÙjƒendstream endobj 414 0 obj << /BBox [ 3593.92 6157.67 3616.18 6179.93 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 181 >> stream xœÝPKÂ@Ýs N€Ì‡N`âκðš˜h¢.¼¾3­¶uã\L˜Gï=Xu!$<=àI<‘G,A”ŠaŒKСŠÞ¸Ç+0…Y‘)+{neáF85 !ËU£^ MdŠ;¹5lÄSa!– ÷Jh FÈ5Ȭ0áÁbø4iÆY@œÄ#îañfÌ©G…ï-z8BµNêŠO¸©ïüãÝú_ï°ƒ-¼*¶møendstream endobj 415 0 obj << /BBox [ 3583.78 6207.62 3606.04 6229.88 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 181 >> stream xœÝ=Â0 …wŸÂ'0ŽóãøHl”TP $ÊÀõqUšÂ¢ä³ì÷^¼éBˆ8<à1×HjX„•Š I Úîñ„G¼Sï@¦¤liz(gÖŠã0idÒà¡’&¼~T$Rt6ªeb%+ΖȤqïfduí(œÈC6…Ƴ‡O¬•H¥âªÀF9}xÌ> >> /Subtype /Form /Type /XObject /Length 183 >> stream xœÝ1Â0 EwŸÂ'0±ÇÉ Ø(¨ HÀÀõI(-eá Qò¬ïï¯:fÅáWPs%gLb‰DQ„Ä<¿îÄŽ·îñX$8ŠJlªð64£¤Õ#9©ãyQq¡¨X¹{ãDæ•s¤gîkG.Tx¡(‘‚-&g´Ž¹R³ü8X&¶ÅŒ‘[Ç”bR̹ßßÿèáJY½8>€qSÏéÇ*ºõ¯b[x¸odendstream endobj 417 0 obj << /BBox [ 3563.63 6303.21 3585.89 6325.47 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝPK1Ýs N€ÚRN`âÎqáŒNb¢‰ãÂëÛj:£à‚À{á=>«!Åñ7Д•²bVV’€"$9Øœ§#îñ LA„ ™¢±ÇV'¶‚ÓØ<¥T=B$xùdœ"V蔽BÑFk²H–g|¨s*òÑQ”> >> /Subtype /Form /Type /XObject /Length 180 >> stream xœÝA! E÷=EOPRJO`âÎqá&:‰‰&Ž ¯/ddÄpAàýôÿ–nï§ÜE˜’`â˜)†@!y]ïù„G¼#‚StÕY¬uâ4ã<Õ !Ñ’!F1àµSR¤hXØH}åL‰ ½˜Å‘Œ²tÊdÖ%4^zTǪD℟q|×cáêhS´ŠuîwÂ÷?F8Sf5Å'xÜ•sù±ŠaûÇ«8À^oeendstream endobj 419 0 obj << /BBox [ 3543.68 6391.32 3565.93 6413.58 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝKÂ0 D÷9…O`âOâøHì( € H”×')mU6€E¢¼hf<ÞtDý3<‚$̲8¡00#§ñÎd0œá÷‘˜£ADµèÚS´Cß&‡¬‘Q3ÜÖ?†‰¡²£Ie"ÌV9)–OÕK^ ²®ÜÛ¶¡¸¡Ââ—V{ž°‰§É‹`j6û¿«ŸÂ%17x‚]=×ÛwÛÿÚþöá •kixendstream endobj 420 0 obj << /BBox [ 3533.74 6432.16 3556 6454.42 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 177 >> stream xœÝA! E÷=EOP¡-´œÀÄãÂÄDuáõ…(3ãÆ¸ ðÊÿŸÒÕ£àø€H!SÌ*L1#3q2Ÿöû÷x…@‘9R EÛÁB M0¶ŒD9× ¼, N’±r!¯˜˜R%Urëx¨r-Tt¾OJÁî‰[|Ó÷‚8±àì—Z/‹ÞÜŸº ÷×¾>p€¹X1|BÄM]ç#Ö8‚lá™ük·endstream endobj 421 0 obj << /BBox [ 3523.87 6470.64 3546.13 6492.9 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 182 >> stream xœÝP91 ìó ¿ÀØÎáäHt,XÁJH ±|g!@93íY ̦›»:ÅcVHA S”¨y©‰æìáâY„MWBý(E2á*S7ã‰kGÛ¢)Ú–ÍáûŽÑ…ãµ(ÜÃÆÞéGÃú£Ø¹­{¥ooendstream endobj 422 0 obj << /BBox [ 3514.04 6506.83 3536.3 6529.09 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 182 >> stream xœÝ½ 1 …ûLá ŒcÇq2GÁ'8 $ `}’;¡aŠÈyÖóçŸÕà½ÀtwW'êR€¨1 0#«¥9Fop;À.ŽÐ3“a0Ê¡~Œ”Šñ6U†bŽ…á ³Â¹Ë° ˆr!øª µh­±é±T!‡Î!%u„¦—sEË0¦ %4íz,ºV´)šã=÷‹ð½ÇèŽNÊQ,<œ‡My§§Ö|ŠÛº'¦nendstream endobj 423 0 obj << /BBox [ 3504.27 6523.97 3526.53 6546.23 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝ=Â0 …wŸÂ'0þIâæHlÀÀ*¨„eàú$…”²p†(ùœ÷^¯v"†Ãn`‘©cŠj”ª’&ñyxÀ+0‰*;2çêÁ9²w85#‘ä’a‘/‹B(Æ„…ɬr «Érþ赧ϽJ²°7žò'}+0ñdxû5R—¼¸:ZM1·üNøúB'0ê̳ã7e a·þË!ìa Olk¦endstream endobj 424 0 obj << /BBox [ 3494.49 6514.29 3516.75 6536.55 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝP91 ìý ¿ÀøL6/@¢ €`%$€‚ï“°,»¢à‘3ÖxfìÅFİ¿ÃÌ‹“L!NZP•4I~ÕÈ޸à 0‰*gdòÌÅÛ'sp#ôM#‘KÕÐ 7<Ï:ÆhÁµDƒNÉJúÁ{°¦TfŒ§³I`„ƒÃk`ì0YÂI@©Ì,Ü&ÆoÆ”zPøÚbG°j‘KÆ®ê;ý8Äfù·‡ØÂžPm\endstream endobj 425 0 obj << /BBox [ 3484.82 6485.64 3507.08 6507.9 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 178 >> stream xœÝPK 1 Ýç9ALÛ´IO ¸s\x€AÇ…×·fZpá\„—^^>»Á¹€Ó žÄ„Ìc‹”½'Ÿœ6œ/xÆ09ïY‘I”³ÔD9²ÎSõH¤R> >> /Subtype /Form /Type /XObject /Length 180 >> stream xœÝA! E÷=EOP)-N`âÎqá&:‰‰&Ž ¯/HÇpá·ý¯¥›YpzÀD-ŒªJÐ{òíŽl8Ÿðˆ7pÄÞ;CGj.k}˜ ÎÎS%•dÔJ¯«HtE“窕b®:’O‹‹#3‰®*raå¡ëÖãíè‘2~ZÐqÕ¢éjèCôŠeìøþÅgJbÙ𠌻r.?1lÿvØÃ KmØendstream endobj 427 0 obj << /BBox [ 3465.53 6395.38 3487.79 6417.64 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝ=Â0 …wŸÂ'0qlÇÉ Ø(@P $ÊÀõiª6”…0DÎgù=ÿl:fÁþ MF&˜¤IÆ)&ö‡3ñ8ÆàH=­<ãÐW'5LÞV f²„¢>ÆRÙȹr¢dO£"3¹¬*²Qö•ÃÂS‹I°$˜T±HqŠåÓb檘‡hmêÙák‹\@(‹Ç0îÆwýq‡nû¯w8ÀÞü-mÒendstream endobj 428 0 obj << /BBox [ 3455.95 6342.35 3478.21 6364.61 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 178 >> stream xœÝ=Â0 …÷œÂ'0ŽâäHl” ¨„eàú¤­BËÂ"çsÞ{I¼ébèŸáDͰ$QF1`FNÑ?u8Ãî02“¡:7NFžaèÇ Çœk† j†Ûº“Ñ D#IåZ}DG* OUïŒÑ–sO(+wÃ)~’Ï Í¨ ‹[y?óhh÷7E{_KøþÁ)\‚`/¯aW×õǺí_áöá Q‚lˆendstream endobj 429 0 obj << /BBox [ 3446.44 6287.81 3468.7 6310.07 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝPÁ Â0 üg O`Û±“ øQ PA%$(Ö'mC àaÅgß]NÞt!0 ww,¢(JÉ0R´åÕ`0žà7ç1yb>ËÔ˜¾Ça²HÈZ,rÂ,p]'ìX"aœú„a††Ñî [ U>ªX¬«º‚j>Ó߯dÐä”2¯T<)–ÐòVƒïü½;»²`ËO`WêòãÝöOpp{÷‡¤kþendstream endobj 430 0 obj << /BBox [ 3436.98 6233.3 3459.24 6255.56 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 178 >> stream xœÝPIÂ0 ¼ç~IúJªE┋…*+è²ìdŽ  öZpw±âÄa‚‡"(U°!CGŒŠO™a4; ²È<â « íÐmÇfð}ÅÁ8Á²ÑÓÚ”8ÿxD¿þÛGìÜÖ½jmˆendstream endobj 431 0 obj << /BBox [ 3427.56 6179.62 3449.82 6201.88 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 180 >> stream xœÝA! E÷œ¢'¨@)¥'0qç¸ðÄDÇ…×·ÌÅpAàÿü¾–n†¦‡»;JQ3ä Š™ FŒ,e¹ÍƒùG¸9!F/à1‰×TâÙ[pž*CÍ7†šáÚ;Œ%%¢J7­¨¹ê‚Yßz´ŠD(Ü%’ v€&—K~5 WЧ¼d´Z¢ØߟÝÙxº;;—{¶ÿº‡ƒÛ»„rnGendstream endobj 432 0 obj << /BBox [ 3418.2 6127.02 3440.46 6149.28 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 178 >> stream xœÝ=Â0 …÷œÂ'0þkœž‰2p€ *! \Ÿ„’À9Ïñûìx50+L÷p jœP ²8’€Jd_âí{¸B!Bsê­\œ:ò·)#¤¼g†&äç&cŠ"µe^ÑŽ‹îQeÑcv¨¡¦¦"³:kUÏ=^ŽšQ¤‚$ì­é1ëâ¨S,uî7áûc8ŤÞ;<Ã&ŸÓU ë?^Å.lÃô m¨endstream endobj 433 0 obj << /BBox [ 3408.88 6075.24 3431.13 6097.5 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 180 >> stream xœÝKÂ0 D÷9…O0ØÎÇÉ ØQ ‚JH  ®OÚ(À"Qž53v¼êD< wwu>pFΔØ"Ô“*4Nw£Ûötq Qe#F0.a|G¶L·¡&c È >ÑùS(‚à©b@‰#GD«¬ –7÷Õ œ—ŠÕEBã¹ÅähÁ$x˜AÒ¢ÅÌ£¡ ÑmèÙÿõ…ÞGöVŒNhSÏéǺõ_.aç¶î  ÉkCendstream endobj 434 0 obj << /BBox [ 3399.62 6023.8 3421.88 6046.06 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 178 >> stream xœÝ1Â0 EwŸÂ'0¶ãÄÉ Ø(¨ HÀÀõI))eá Qò¬ÿ¿¯:‘€Ã®B)”k Œª¤I|¾oÜã˜D•™Ì¹ØøpŽìoc¡h5"Ãó¢bŒ"¥<‚‘Xe©n›¹¯r‰”u©(TR³7˜Ò_òwE å„»Fr]4˜xt´š¢Í×¾ÐÃê6‚Çnê9ýXB·þË%ì` OõJkoendstream endobj 435 0 obj << /BBox [ 3390.4 5972.17 3412.66 5994.43 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝPÁ Â0 ü{ O`b;‰“ øQ PA%$(ÖÇ¥-à9w:ßÙÞtÌŠÃî ZELÕ„ØP„$¯êxÂ#Þ ‹C—Z¨±},¤`Ç¡Y©¸GQR¼®‰BšÑq¦˜;Ÿ5¦g܃3™Öö€¸,¸%4ý‡°Bqî·H¡®Þ¸‡e„I18|ïÐÔŠZ5|ãÎßåǺí^á{x¸pl¼endstream endobj 436 0 obj << /BBox [ 3381.25 5919.77 3403.51 5942.03 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 180 >> stream xœÝ± 1 EûLá LlÇ8ž‰Ž£`€œ„P°>pwÐ0E”<'ÿÇ‹ŽH`¸¥K©„¬ NŽfÀŒ¼¤×®VẇœSFb΋e/í`Ys{04ÁШKF‡ÓgAÑ ‚ …‚KQ°3J¸…_”L¨>;ÌÜ"B0X±˜ ˜Ð>žØÆÞ÷c‡£üë }:$Á*Ñ÷D°Žuü1„nõ—CئMzFwltendstream endobj 437 0 obj << /BBox [ 3372.14 5865.94 3394.4 5888.2 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝ1Â0 E÷œÂ'0ŽÄÎ Ø(¨ H”ë“´´D €!ržõÿ·åMç½Àðpw'¢Œ>@´1`FŽjSM^a<ÁnŽÐ3“aPÊ¡~”"á8ÔŒ€K†*R‚kÓ±)½°!WLÈVÐYWî‹Á EEf Ö,<¨ŽµÃð±'EKÍ€™«ü½Á"XWføÞ¿wg'h¢Yáé<ìÊ»ü8A·ýÃÜÞ½ «lKendstream endobj 438 0 obj << /BBox [ 3363.08 5810.31 3385.34 5832.57 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝ½ 1 …{Oá Œ’Kn$:Ž‚NpH@Áú8‡R1Eä|Öóóóf1\žp³Áˆ3Æ,L&¨JSnõqÂ#Þ€IT9!SH<†òI¹–âÝ@…BÀkâ ÃHœÉûf)JãÙåi$Í"í¯ ÊDíÈ@–ñë žÚº.5EU¬ëx†3ewLøÁ¿Ëó§íŸ€=¼Ö›i½endstream endobj 439 0 obj << /BBox [ 3354.13 5752.38 3376.39 5774.64 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝ=Â0 …wŸÂ'0ŽÇé Ø(@P $ÊÀõIª¶„…0DÉçø=ÿlú‡'<@Õ"07!Í(B’‚¯÷xÆ#Þ)ˆ°#Stîb}8{Æq¨‰ØŠGR²€·6’É2ª¦âÐv!—ÊFb+ŸŠÂ™Tš Sã°òTcRÌË ?e"mJLXó—æÿ¥ÅEþ=Ä . ”Õ;ÇÜ•sý±‡~û¯{8ÀÞ´Emƒendstream endobj 440 0 obj << /BBox [ 3345.17 5692 3367.43 5714.26 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 180 >> stream xœÝ=Â0 …÷œÂ'0vœØÉ Ø(¨ H”ë“”6”…0DÎgù=ÿl:fááîN$Ddƒ¨Ùƒ÷èµÀÇáæÙ{2 F9ÔQ$K0ÕÀD#Áâz]gr‘Èè¥0{”PYñƒ}(£Øª@#F^4žZLŠwFsBRhšË"K‹«`ž¡Ì36ƒï-zwv‚I,<î¼ËCtÛ¿=ÄÁíÝ Ü¼lùendstream endobj 441 0 obj << /BBox [ 3336.27 5628.91 3358.53 5651.16 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 181 >> stream xœÝ1Â0 EwŸÂ'0ŽÄÉ Ø(¨ H”ë“´¤”…0DÎw¾Ÿo:ç‡ÜAU#‰aˆ’(;! –æˆã x&'†LÞ8ûz1\lãP ‰\*ÏÄŠ×u&gTõBªUçJ-ÚHó¢ûR„|\9B¤èV„EO=¦ŠwF=eÃA™’®z̺V´)š£MÙßÿèá ZŒVÞžàpWÎåÇ*ºí¯â{xBÝnendstream endobj 442 0 obj << /BBox [ 3327.46 5563.15 3349.72 5585.41 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 180 >> stream xœÝPÁ Â0 ü{ O`Û‰“ øQ PA%$(Ö'i•¶|€H‘sÖÝùâ]ç½àð‚'ˆ°‘F ! yEfâèm©ãÏøGžÙ:RsYëÃ\p–pªG&ÉÅÔØð¾í”ª(åP‚“¦Š…¼à¾(T(Æ CÒÆ ÁiÂÄŸ1{\å1Pɹ˜q´Ñ"6‡ïOôp¡$– ßàñPîíǺý¿îáGømëendstream endobj 443 0 obj << /BBox [ 3318.71 5494.62 3340.97 5516.88 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 182 >> stream xœÝPK1Ý÷œBiO`âÎqá&:‰‰&êÂëÛççÆ¸hÊ#ïlæÝ3ÜCŒœÑL‹bA1Ïߨáq‚#Ü!‹¡:í '£J|tÕCS32tƒëªÃ„Y bE÷+–Ôã‚YgÜVE¬¯± ¥•Ä?ƒbêÔ¬³ƒ–„¦Kƈ{Å8Řæ¾÷hÃ9DÌÑ‹Ã+0ìê»ü8E³ýãSÂ>¼¸nuendstream endobj 444 0 obj << /BBox [ 3310.02 5423.44 3332.28 5445.7 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝ=Â0 …÷œÂ'0þKÜœ‰2p€ *! \ŸH[À%ïÉï³ãUϬ0ÞÃ5¨2! DE3AIìÓ};À.EÈМ²Õ‡S$ïà6Vc¶ÂPÃèp^:“AÑ ©+ÚKHUÙ&=”„$^T(¡¦aÒ¯5ÑÉaH¬öÜâ­k  Ñ*ÚÀ÷/†p Šzvx†M9§‹è×»ˆ]؆'ËÁm1endstream endobj 445 0 obj << /BBox [ 3301.36 5349.65 3323.62 5371.92 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 174 >> stream xœÝOIÂ0 ¼ç~ñÇé ¸Q< ‚JH ¾OB•¶\x‡ÈžÉÌØÞôÌ ã3܃*1jÓØaJ ‚bžçú8ÁnEÈ0:u±6NFU0Ö EÉ%#:ÃuÍæ;F-Ø©´©Š”-µ/at^ùfüI®òƘպØÑ| Ÿ`5´ÑMÐVkßËá³zçð »ò.?îï·ÿvÿ!ìÃA!i±endstream endobj 446 0 obj << /BBox [ 3292.77 5273.46 3315.03 5295.72 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 181 >> stream xœÝ=Â0 …wŸÂ'0±Äñ Ø(¨ HÀÀõIKK`ˆ’Ï?/Ï^ůî âBf˜Ä”bF’deº3Þ¸Ç b‘`(Zð8>,¤P oè){Õ(‘’ãù3â”#V.T´²+T J¾P• yniVbnÝ'ý±a‰˜Sbl–H­}ðš¹àmpø¡‡#T+jnøÆM=§[èÖÿ¹…lá [ômendstream endobj 447 0 obj << /BBox [ 3284.22 5194.9 3306.48 5217.16 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 178 >> stream xœÝ;Â0 @wŸÂ'0þäç ±QPA%$€ëÓPš"À%ϲŸ¯:ÃáW0-T1ŠrT%M’Û};à/À$ªœ‘)döP™#ç‚·¡*IÀ¨œˆž?""$hêLê#i¨ÉbãÌxTë’a(¦&h8uxÌ&OØ≊.-Þ> >> /Subtype /Form /Type /XObject /Length 181 >> stream xœÝ=Â0 …wŸÂ'0þIêäHl”TP $`àú$”вp†(ù¬ç÷¯zÃñW0õHž0Š〉¤±p½;q¼p`Uvd Î9Ô‡sä"¼ÕÃÉ‹…FRÃó\0&CÓ$”BÅ@!Vî(ˇ‡¢ÏB9-¹+³AÃ)àÕÐ*e2ÇÙ@:b]DL\;ÚMÑf~|}a€#%óìøÁM9§Kè×¹„lá bäk€endstream endobj 449 0 obj << /BBox [ 3267.39 5031.15 3289.65 5053.41 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 181 >> stream xœÝPÁ Â0 üg O`b;®“ øQ PA%$€ëãBˇxDÎ9wç‹W=‘Àx× ÜJBH ˜‘ÕòT;2¸`—‘˜£AÄd±¤z±¨Ñ‰·±zräª çeÇÝ›`RÇJ¨fTjpp~Ô<¿gC“…üƒ§“àÝC&˜ DÐsÎ^¸*Z„Æh›Ã÷'†p ‚Y¬<ÁÆÏéÇúõ¿îa¶á þslÆendstream endobj 450 0 obj << /BBox [ 3259.04 4946.09 3281.3 4968.35 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 183 >> stream xœÝ=Â0 …÷œÂ'0ŽóãøHl”TP $ÊÀõq[R¢äYÏŸ_¼é¼0<ÜÝNŠ!jÌH ÌÈIÊ|g/0žà7Gè™I€0 iœB‰Ì8ÆÈ„š‘9Àµ©dã(˜Nèý¤3Æ`ZŒXVÝ[‡$äØ:ƒ6„ª—sG­0ZÒ!$nf,zê¨)ªcÍý&|ÿ£wg°Q§ó°³sù±ŠnûÇ«8¸½{’Pnçendstream endobj 451 0 obj << /BBox [ 3250.76 4859.05 3273.02 4881.31 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝ1Â0 E÷œÂ'0¶ÓØÎ Ø(¨ H”ë“)eá Qò¬ïï¯zæã-\C”Dh §Œ”@EÙæ{:À.EÈ€°3Ê]}%2‡i¬‚êÅÊÎἬ$”…]*gŒ¹°2ºÏ<”U̺P#/ >'Tý» ©DƒO»f_ xqmhš¢ElߟÂ1DôhÙà6åœ~ì¡_ÿëva&umöendstream endobj 452 0 obj << /BBox [ 3242.56 4770.06 3264.82 4792.32 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝ=Â0 …wŸÂ'0±“ÚÉ Ø(¨ H”ëã€Ò–…0DÉsü>ÿlzæˆãî% uŠÉ,PP!Q¶ùžNxÄb‘`(Y(©>,tÁ2Nce$JÙ™‰ ^×uºÎ¤Ñuq‚Ë.’55xz—ÉtùV¡Â+÷¬ßüjhSòQ€1•¼øÈjh ´„Ö`|0À"åhÅð Œ;?—[è·ÿ¹…ìá"±lúendstream endobj 453 0 obj << /BBox [ 3234.38 4679.03 3256.64 4701.29 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 181 >> stream xœÝ1Â0 EwŸÂ'0ŽÇÉ Ø(@P $`àú$¥-eá Qò­ÿŸ¯ºûÜ@E#iƘ¼+ФàÃmžñ~Ä=^)ˆ°#St.±=œ›¡oŒDZ¥Ú^#QT‰5gMRoÚÈdÖ‡0&Ë ‡ErYf=´c%qÁ!3[ôxë–˜¦˜ãàë8RV/ŽO¸©çüc ÝúO×°ƒ-¼ÊÄmendstream endobj 454 0 obj << /BBox [ 3226.3 4586.1 3248.56 4608.36 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 180 >> stream xœÝ½ 1 …ûLá Œc;v2GÁNB (XŸË)÷CÃQò¬÷>;Þt1 ô¯ðÂl( )F`F¶èã<Ãó G¸ÂÈL„êT´>œUC_ ™DqdÛR18„…Q¬jC•ª•g}ʘV54]šn-ÆÀTaŒ åŒÄK‡¦k Í0;æ©àû§p ‚Y¼8¼C„Ýp®?Ñmÿv‡°ülÚendstream endobj 455 0 obj << /BBox [ 3218.31 4491.17 3240.57 4513.43 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 178 >> stream xœÝ=Â0 …÷œÂ'0þKœ‰2p•@¢ \Ÿ„ViY8C–ýžíMϬ0<Ã#¨pBe0ËŒì ‚Ò­þñ G¸B!BsÊV§Hž`ІŠ‚ET¸­ŽêPØPSafŒ\9£YãSéP«ÑR¡ »¸Rh\-> S²W«&`Y‘òb1s혇X*¦!›Â×§p ŠI=;¼î¼ë;ôÛ½Ã!ìÆÖlhendstream endobj 456 0 obj << /BBox [ 3210.38 4454.78 3232.64 4477.04 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝP;Â0 Ýs ŸÀøÇÉ Ø(¨ HÀÀõI(maá Vü¬÷q¼ê˜†{¸&Ô 1ZD/ ‚’Ø_¯y†Ûöp „,B„Ñ©ÄÖ85ÂÐ<µZ$Ã"p^NX2T˜0Ɔ k°Š0Ú ûÊ—„–?ZýåÃ`ÂcBSÌÂl°8XBç%b„M0í0¦ßú¯/ôá³zqx†M­Ó#të¿<Â.lÃ[£kŠendstream endobj 457 0 obj << /BBox [ 3202.5 4492.14 3224.76 4514.4 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 182 >> stream xœÝA! E÷œ¢'¨m)PN`âÎqá&:‰‰&Ž ¯/LÇpAà5¿¿ŸnfÓÃÝ  šYA%$[îÈ æáæY„j¢¬õ‘(PÎSµPT äQ ®ëŠ¡W(lRaT+Ì£ï<–6Œy¥( LW—µ£U4 tÍŠ?#׆¢+ZÈ·Á÷/Fwvͧœàévå\~,bØþí"nï^Fblèendstream endobj 458 0 obj << /BBox [ 3194.67 4578.88 3216.93 4601.14 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 179 >> stream xœÝ1Â0 EwŸÂ'0¶“ÔÎ Ø(¨ H”ë“”ÒV €!r¾ãÿìxÓŠìp‡ 9Rc“9¹£*i#6Çá„G¼“¨²!S4α^Œ›ãÐWFC)FfbÁë:“ˆƒr1„ª3©VÈgÙAPar[Hª¨0ë±Åè˜2)'\^âÒaTµü3Áûypr}¡ƒ3ò`Ùð ‚»r.?¶Ðnÿs ØÃ Ĭlnendstream endobj 459 0 obj << /BBox [ 3186.94 4695.25 3209.2 4717.51 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 182 >> stream xœÝP;Â0 Ý} ŸÀØq;'@b£  ‚JH ×'¥4E €!rž?ï={Õ‰(w¸‚Šg*c.‰BÂ(d±oÜã˜$6dŠÆ%ŽãÄæxF'ÏXK™Ôñü‘¡˜P¥(±Œ8Q*#vªt3îA+I\:ª_ž4^sFHC.FÕyÓxã:1»hÍ÷ÄðµGGPrµbøÁM}§§èÖ|Šlá =n–endstream endobj 460 0 obj << /BBox [ 2101 6456.72 2121.42 6477.14 ] /Filter /FlateDecode /FormType 1 /Group 95 0 R /Matrix [ 1 0 0 1 0 0 ] /Resources << /ExtGState << /R113 96 0 R >> >> /Subtype /Form /Type /XObject /Length 176 >> stream xœÝP91 ìý ¿ÀØÎáäHt,XÁJH ±|Ÿ„=  ˆ’ÍáxÓ‰8pŒ>D2Eeò*y½ÇñL¢Ê†…5ξ>Œ[Âq¨JYKFŒ”=^Æ„|IŽCÅ´´ˆ©¬¸/ dÖ*2…&`†SÃ[?J.áÇEßL¸–Å:ôœðý‰Îà(9ˆOÜ•sù±‡nû¯{8À^Ãïlbendstream endobj 461 0 obj << /Filter /FlateDecode /Length 6514 >> stream xœÍ][sÇq~GùGàÍ‹ˆXÍý’<¤dU|“r1Œ<É©Ê!‚ŒÈs`Äüút÷ÌÎtïÙ9 ;åòƒ×ËÙžéû×=}à?Ÿ«YŸ+üOýïWïϾ¼rÖœß=œÅ9GýùOgêü7gÚi=;}Bȳ‰çïÏ\ˆj¶¹½ywöGXywöç3M$Ïë½zþ«k"kÏÐTAŸ_¿>+êsí⬠öaVÁ_¿?ûnúÝÅ¥šM6>¤é=>klJÓý…šƒ2Éøé<š¤¬ÑÓ-_r»¿°šMèu²QùiWž½ Þ«9é¬SžÞâëhàv:Àk«MŽyÚ_\:§ìì¦k\ RT)ãjXaluË]žn/.m¶sΑVÔSíñ­ ™éÞêœBtÓí+xVÁ[ ÿCîˆÒŒÖ¥é†¸t:øòR[kç4]!傟nß±CàBc×XçøIDyxƒösòµ‡ò:$3½„G3[Ÿít[í³7¸Yщ81JÛìëá•ñ©êÂ*g¦GÆÇ&ór àSäî/þëú÷gÿr}ö‡3ç#sk¦æUžU&S3jö¾½AS›™?ifÅè‹™}S¨rr$H•œ É?Þh z!=»äcN´D›˜Aìû¯‰ÏÂÅý=j)*5)FdF" uZd¯-¬5Ñ&M¯‹òhµ1Þf ‚BÑjΤpýíÙõ?<ë¨h9.{k\1wöé=,ÇóùhÃtÜ€ûàh2Œ¸ìЧ:ê@ï+u…ì“ÃØÉ‚5ü2‚¹ÊÛßž!ÿÿÈ0V{Hõ°åS7`Sm²™kiÀ¦êñ¾Ã‹%Þûõ¬8´XÞœŠ÷&©äE¸·˜Ðâ¹÷òU.áþú"ÅÙCæ'EeB ˜ò`/•!YYiåƒÕ”,uÄdÞˆhD›§`àí¬§ÿ¸¦"D\ˆjŠ|èB Ï#ˆõ5eEKŠ](ˆ%Ź´KAœiÏÎôªÏJû~&3!ŒˆIE¯â)è¨2dK2¸®è§.x[8óy(¯$áD):@ðtÜ`ŠØè5¾@?Àði,â* à1~´ 'ñØÏ÷€Ô¨:PHÑ#Б̩ɡ’šøâ[&³=** Ù’³¦"Âßó“6^ J3G æu}ÆôPä¡s$—]Õà*гÈzË…Ôá§ßñ›ðQtŒì»zv‡¹°Ã&X,¤è­ß8‡3*Ÿ#8þÏ{¶õ׌¡ñh}Bõ ˆ.]‚o@ÔETo™[¡Ø”ÿ•–³û‘é SïmY¤Dî pôó2n üù«‹&‹•—Á95nÑ;:â û’Ÿs_6.xÇä‚ê‹™VÞDaDÂ}¸ýÝn¬1̸ʉi4¦1GDEÀYÂѾš'‰”¤ û9¯ŠÓBùû/¶Ëªˆ‡"4€¥+‡lgb½*ò ÏEkÖ–~km¡Ú%"º\»ÏÎY‘GîÃ3#Òä–tºo:¯i 6þ‰Éu¿x„€H%uV™•ÔémÝ·˜v-;Ç’D€!÷‘ãÞ=±è Ýtîµ›­¥›É=±èà)ð0zßMÿ^—@÷6L¿&“&K¶Æùš âÊ.Piix4y’1_8YYš$ Þ•G¨CnºGõ•Ã,È÷CÙC'ýÔ€ÅÃ1orÉs'ýÌbºp Žú x¨¨Ò‰´IK̪1è4ܱ%o{IÇ™Y…’qŽÓ¿R{˸¸æl‰—œó{,èÕ,±çeçðï/†àÉŽcHÏè<ˆ4{fßçgçsMçÑÿ‘è͹WnNî}&ûÌ ’SæôjÙƒ°5N¿»À2Yë\z7iŒãeïÊ m¶`Ác•üØï_à¡öÎ ÏÁÀ4ªå@¸Kc‡ï:Þ òßUºÙNÿÝþ½vˆ¨ÞÿeY "W²‰qÉZ›€b ®Qbº4×ÊÖ/©Õ€öý‘!ºî®œÀ%='Єì¬ÊꦫnI…Õ%7]Ý?^xDVƧ–ÈATy‰¢WIŒ&{Ü]´´·TMþ{[V˜X)tp.²•1è‹é©É_‘©Šf…çY{¢Ÿà¨Co›©T¼q”AS‚­8|l=´‚:›ÌAO×½¶“åüek°Ë Øù§èYÜe×"Â%:£ËP¨´}²)¬Ú2H-ÊN!OLëZošLZ‚ð Ê´TC‰î5%Ÿq à§1(8.zN€}™k¶·ë7Ò [Æ*jXG*<¶>ížµÊݳ:”‰`“­x_aƒ†V—âè´?u P ë&o‘»[5ìû’›îÍT¼¨Ÿ™c]…T穱XŽ%$¼ªõÃ>?Oé'+ðEH²g·\3óÝÁo¯`¾À¹C÷8Wø6€õ]Ûz¥1xvÆ7AŸ Uiñƒ•ö¢¡Kæ–Læ& =p–¾Â SÑ !ðMYb¡N¯òúÆœƒÇnøG×Ý[÷Ösm“j}žç"”¥MŠË”ÆîÑ¿ž-=ÈPÃfïÊÆ6O;ºQ$TE7Џÿ ,à@ ü¤¥É)KiVeÌ‚+5² «c™ÀùôüT%cq çkÂI=î—ìõŸ.p9ßäzá`ñ"ÐvÌÒŽQ¹eR°˜Z‹v FO\/Q{»k£½½ÔÀjPµ0$Á‚óÆEö~‰fÆzígK„"àVª¢¾.ËF䶬 (õ #ΖÈpÚJË×o:‘OšÔŽ‚Dt©oËëµíHÏ©Üär¡é"ûÈêªÏɤÔrEfåaOþ–ØN¢è¥+s.¬’ÕkbTãÅÇ£v°8TÀSwKæ­3pÝwoÄÜ  €-aPö»-+°ÓÀ“ë©äFJ¾,0‡˜VKb´ªÃOg¬›rœ¥ùñ‚?$=®YFœ‰Žºâë¡U ’‡Æëþa“Ëc£pÌÈñty¨é#(‘>  ‚XØ'ФSÆÂwyºoO¯ÛÓc{Ú·'HPíñb„Î!0·‹`ð2oxY¤a„âCGaòoW\ÙyF¯¯Ùw‡w›‘{$= ÜÔÔ⼆f@]ZGß’Vàqå²J±lô¡,ÎJBŠC£Á¿c®ÀóÕc7L‰D‘Æ…QèØÑîžpíNȦ2ƒãP8†ÅÏgÛ.mn¸Û°Óu™l{'?ÁÉmadé^ÖÀ·ãî˨)5Çá_2‘¾c±H²Ø æ. ˆüÛ-£òó /Öú¢–ðÆ5«—Àè˜÷8í^­b: L+´:¬eD!]ŒÕè~É Ãä82ªW¨” Û èe‘¡6Ø"#¨Ïßc£Ó‚düÚó,`±ÅÏ=óÉ‚ÏÃ…µ¼BÎ7e»YÉ+ÐN©'dP6¦žBñCü¡á)ëÁC«´QʽÂ6˜‚‰FéKq@x2ÜžyvcVÄK"Fx×<å#C¹|B?IqsöxMSB•)Ú¿f µëÀzŠW€¨g»8E<––ã ÅØ)€^™#C»hÎ0WÁyS*Ú#Tä|>ÚõíõE‚*ËøÝË‹Ö9ùÙØ49H…ç˜e ¨"ljžƒ¦Sž]¶œ^¹¶ƒ›þ½‡áûm§`’¨¾©U\'Å­Ò’ÕlwE! }š5nnÊkÜÁQLIIÚ=š7W·^–­Ç1¯QA´¸8ù—á1‡]‡å3‘ä¼ ‰,©°ª-ytÔŽƒªŸ%qü‰‘B;4²ˆ¥%¸ˆèÏH“Ö­z¯X¸l_ÒÞºâÏ)Fu$»›®Ë…JŒC‹aMÇAfÞè`p|kªlt± +a§=ðÌwx_ê“ÂFªé²Š€óý®ó6hÛLæì@WåQÓo ¶¢é“4t{’Ò¬CÞJ߇®´‚´³Æa¿7]ܽZ/•ì]7¤œâ,z~èÃôx L¯‘äY+}Ì'Ù‹öƒ¦âňOYüéÃô+ ÏÙs㺪g˜í¾Ó]ዃÆîj›QœÀÅn™»þüpv#°·9$Œû#øŒÍ î”üËA\‘múÞSW(âàöýÂÌtEÑÃòpu^ëÁ(îWóf±µ$L õ@­ÅºïvoKQI­ñe*¼®‘õ§mœ!B]G™µcfW˜¨4=¬áùÀÀ'9xÕz”0›‡ÇÎ)ÏDãæïÒÇ“’¶k>´ E|æ§O+4—67u4©{Üë®ËÖ›Y^X{¬¥Ï²Z‡S–[éS}$R5ŸŒw¥-–ð¯QŒ¼\D¥v–·ì…õ—0·ØÉ‡U»ãöºîKÕ\³ÝÚâ{–»ÜJ[âb‰RœC¿ŠeL²6!¨îA[númÑ`ô^$ú>kqÚ":j h«ƒŽŸú/Y¿i-•]{z·Ñ£Ùmôc¾ÞèàÜoöeÐ|’eÎÀ˵}Ok<öŽCI3h¹|Pw¼I$2‰×cCà+à'~˜“¯Juq1Ëò·Õ¯Fqôæbë>ô³@ÚöeKºä‹ÙU¡ð}q³R­Ó³µyUæ{Òà¾{^þo]Ù»Ef­Ö"?,µôQ»J_пÙÊàgX6vËe;/0ÕãäÚ“›[½Ò¥ÀÓ²W±¹ö‘•\¢K³êU€um\¹Ð.ZLkȉ‰­¡Š§hB!¸;ºãÓ®˜qµ'+¦zìAµ6˜1¦¸®GKÆ_Zd¬ž!0¼Ü–à†bwò~gã2¬"ì%߈ÖäéeE x\3#DFºè–wá8œªtøÔ]¸I­š{QþvþŽ’+GÜâU L!s…ypäÕM<ÁÂh–¨Dö)l¨Y0ï F@P^É´¿WÖݤ}x ”±™w…Þ¢o·ÅEYºÖíî`$  \ÆUY¸ÆšÉÖH¹[¥¸%ŵ˜%d³t xì¬kßá*F<<|Kx¿zJEºŠ [ÔW÷6‹†Ç“UlÖx÷àUü›$-ß=2ØÝÝ^4r/–ŸèâjÙØõäĉ£‘îsý‹x”§â(ºò#œ™wŒjK=²|“iÀª^è}Q*Jº¦dSóö8 p:·É„áÞe^Åî V> ‹©;âcq=ÿ>g 7 GnÌS®°i…¤; –rŽ ´ÕÅ3ÔJov…Jgl³ ¥î‚Çiê︼[N"U‘©íÃÓYú¸‡-ñ¢ävLX¶¹Z°½¸Äñìo©ÔàÏ•2òÇÑz‘èûJ¨4ãÊôöí–{»Ækž d«¸Ù¾ fð#' `ÖxÙb„áäØhRç.‡ïr8™ƒ,uë ýÙ’”S¶ñÈz{!ˆ‹Aù+ïÛàdPd°òy¹ÉMø£\vŽ'Ø1L… üs§˜ðÉûTõ ÖÊÞ×°½nc«_ñò’uhÞù!«hÛ3Ò^H°îÜåÖ• ïÁÃgºì>1» +œæ€gÁI q ÆËcŸhž“²=›e°\Zâ 4EŽäD pWÖ(eÆ¡×ÞoÊêÓð½06Š"woØî¢P›¸áý\â$ Ul—ƒþÝ ƒ"pärÐÚ 1¹çuDísÛÑÜf$öB^‹™c—)DüÛºL_— 2*4$D¿«s1Ð_Òié™a¼{KóËö<ùÀ¶w½u‚Wp8¢ã1H$Â'j9Xà XÅßV„@d†ÈšÛ»…+›}™V­aóU9HB×"õÊ~î%¶æ&µLrËa¸Âç/#tìÚyXB7^ß‘kó›Î)çzu7BzXþ ÁY%þµêä·®þÄuL1¿ºXÆÅO£›AÉwüëþ[Ñ']"Ž‚—^N¦[Ã/©Ñ#8Ôp߯f¨IéË¿'q °]{š¿<¢Ìå§VØH ±rP®JJl^¿rz/.èÎ[èžÀ?W‘‘‹_¾^ä²B wûRPkÐŒaXQ6 ùàùmi_Ö-ô —u¥ï*ŒÍëæøïwõ§0u‚†ãÚ…}vív¤Ð“aRÎŒµŠŽÍÚ*Z½ÁÁ²2qé:ÆEè ðæ0«(R ºµƒ s`³QO˜;±K™¸óq'¹§Ý ãb›òi€`õSÁ¥²SÔQsÙû·…"*§xX{ òuºA]˜áI•ù{Ó|¨µ ¦xW^H€¼Ë­æÿ]Ùƒñ {%vôíµ2³ºg/¯eC»/`x0™AØK㟸‘éøÐ8UÕC]•GÐÓ“¦¼Êg^L9üP 3›þ·°©G‹^õqû‡r0µ¥–«Ë…Ü0w³¡ÏžSwËM‰^¦˜—ÒeëFXvÏ6šµŒDï ïÎ/BËrªI÷¿óå•uøÿò‡³ÿiÛîendstream endobj 462 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 1835 >> stream xœU PWív†éÉ€²-²ÉN¢¥¨T¥ÐøŒàhˆ#Œ€À %ÊwæÂ ˆŠñƒäç "Œ CbÊX»êZIÅÕIJŒÙl>»&·á‘­}IÖÊîV¥^õ«îªÛ÷{Þ9÷²Œ| ò¬"$bu\ ãí%éyVzaŠôÍc1£ëœÀU®òêxÓt<6 sÜp‡;#cÙ·÷XC y™)IÉFõ6ߥ¾ tóSûø¨_öõ T¿’®ËLIÐêÕZc².]k¤iêCBŠÎ˜7ñKP²Ñ˜±|ñb“É´H›žµÈ™ìÈâ£6¥“ÕѺ,]fŽ.QfÐÕ‘Útz袉=Äž‘mÔeª# ‰ºL=Ã0Óõ†Œ,cöš펄D]tʦ´t†‰b60™MÌëÌff>ˬfB˜PæU&ŒñgÖ2K™&’ñ ,0rÆÀ\b—²LynJ”³2¥Ì"ûN¾M~ÃÉßé®bŽ"Sqš “Ê•£Þ`Çm,º 3îDg™ô^pjHÓâ¦ñË/VYž*È+ENnä $ŠäZ¸†»c=6è†Cp·ü²ë{8j9”?¾8ÒU—³JENü¯N)=,é‘\mì9ôÂ#è%“†P/ çâ’`º„°d:q4Waøý§8UEÞ!k2ž~~¾AgÀÜ€¥0‹"M6ÛQ´IÎ=,²øašûˆ·ŽëïÅÁIàÑïÛ/éI3}ÿF,ß”R+ös$ÜQHƒÚò“åP9üxù£ —:„õ}¶›Àÿi(‚(‰ºeMÜö3Ý¢RÚYb“<:Øów°øŽLš% 'à°iïyªÔ£‰U»€O#þ@fÎFÏìöñ^ÁBˆæCBvÜÚÚÇzUéq‹5ø· $KœÅåAa]u%­W5ïK»uàu—¾4 oÍ{GŒïJÝT»õàúCÐË|õ(¯ÚQ©ª(8JÑòû(¦í%=8fÇ•uì÷”©2Ì’DØÉŒ‰SXn{Ñ»œO¸O9¢ø:ÿƒûß½­º·… MÊËÜ# *Êi‰ Éð3BxNŠ~¾õhnEì–àà²ú+*|‘ˆÿèa7GØÏL_µÜ„¿ ¨Vq~ÀÉÎEÁyÿEï<ìÒ;‹óÑ[†ý£Ót²+’Ë Zº ÉVJ¸Æš³ÝŠ \  YhŸq┣òÒS’›•ê$¡ú¨µú:ðvÎPž ÐC*è'rp§¡¦´¦ÌRæÒ"âJ*gOlt´+Ö˜M–&Ø0yÂçkrîk¯F8XSs’WJ·(š6œkcoã ü£ƒ‚\†|DE“ߙǷ崴µ4tŸyûx¹Uu¨²¡ªø[ÝIAb*G–“ íD6§åÞº;x®¯Y| ¶þ ²+N…ƆݰW\WA/¬'ÎCÂlÂCYœö\ï¹clÍ$ùÔ5ìг ;ôœ1ºV˜ìÓã_p}í©ö´?ƒú~÷ÏÏÿ‚Ì[±Ù!î1BckëûTøî@\×h!6'IÜYf‚HèÊi¥%ÖSRÏœ§¾xgȤBä…cùPhK^‘Ê´5Þ°x2ðÅÞ‘ tGÏê«–R‹¹Üb÷–í†~GKV[KÛ©Þ'D ‰dS55î#o\Þi?ÐtA5Ü~d¬ü³9N;ì`S>ºúA½Î½Ùº­v+=-Àgˆ×ô¹~¹¡©UÜÂaÄ/"’þÁçñ{BvòÖ„u4ÚÐõÆµŠž¦N±ÉÖ¤.CwvK"­í<õ@X.›l0æ¿Ë¤ LNÓõæ‡k¯ŠñQ5šaea¨:<¿ž‹Áxáûcu&(É3—”ˆÆØÈŒõÌ(ØÅyå¥ýÈ#è UDY™À+Ç\öØ vl¶a³}:µˆ½èçé‘/ÝÄǃ†{Wà>ÿ”¸|J6ªÆ½4ÈPU3E‡õÚ\ºá[è˜Ô4ƒÍœ‡ÝÝмïLúidÁk°¶$_̼^<üÇ?¯¯Ï¯,4Z öZÄRMšÉQP4²ç3Þ#¿ðNñÕy> stream xœ•– TWÇ'2£e±§¨ÛN¨ŠnµŠX A,>* `ÄðL„  “|D"‚È;ˆ‚¢¢¼‹Š°bé‘êÚâ«­eÛz‡^¶g'¸ÝµçìóÜ9÷$çÜùîý~ßÿûßáf£gîêéídú1ý#}wûð¦¡Þ¡æ`Á ³ìw-ü¬aŠ‹Þ&ø<^|Bº«<2^¢´Ùâ0ß!›æØÌqrr´³™ëààdã"“(BÅ6žbeˆD&Vr¤6ëå¡eüÈ+‹C”ÊÈE³gÇÆÆÚ‹eÑörEðRS;›ØPeˆ·$Z¢Ø)Ùaã&PÚ¬Ë$6¦sÚ›&W¹,2F)QØxÊwHAXG¸F*Ü¢•â5Þ¡R™½Ãœ¹ó>\à¸Ð‰ ¼ˆ©Ä'Äzb:±ØH,'ìˆy„;áI¬%Æã+BHŒ'hš˜@L$&8"„‘Á#x©¼Fùó|wþC³|ó-æ æ? Z÷H²ŒGÕŒæÎƨÞϪ-Ùn0²æÆ½2ëEA½Ö´¦þò³®Ëy¾^ ÞMnUÁjFJ6éŠÒ›¡ò´íšV‹)Fr3(@k¤ÐîC•¼Viäù€=lsKSZðÎ ۪̥äœ}¾"\üo­VA£ÈrhWŒqh–‘×1ȦUòÙAöW:Üè}qPx^ˆçc¼-ÂsÑ´è/è=4úä$$¾d­(Ûa —©@-À«ÛÑqt ¹·ßÿþ'g¼ \¤KLO˪2KD(‘< 9IûÔêäT†Ëo2";=ûŽq—ÁêU/*í·nA«Ñ#ºæÒ…âz ú®ÌÁ¬œ·È_RQ-J,Q+Í*¢j®…ÞB£ž#kdõÁKƒ™ƒ25ºì&Y Ð,Я/À eX²¨ô¬C)¯¦ %¶ñÑ vmbŸ¦¤DF£INNM“–J³B¹òN[¾9œ•ž^TÈddåæefÖooT빚Œ=ÛÓÝ[S& =œí’•¹<:¨ceõO‘½P¡cÒ“ •“D>dq˜¢2°B#ZXÌû¹M2ðQ;•6b[ä!'µŽ!Sg¨)Å\Eb³{ÊöîÚk·˜ùFÒE¼ 2¨š´d©ô±µ(X_õ¬Vou¶Ïo}ÔÛc°ú©Ð·=t¦¸*ø,Pú®#wEåHøCsƒ\Iè€ÿ3AÇýŽøå¸B¼FZ²«¢²¨¸âl@¦VTYÑœST[‡dž(ŒV5Îi«Â]Cb>…@ÊéEd7Ãíqê.ä¨ä/èβ€-5­×;n¢YYŒåÐi0ñŒ¦zsÅfÒ]—;Ó¦SF2Bí{A Aéþ:®ÀRÒ =’q¢NIÛ‡ûñÕ è ò¤.÷Sfø«×ÃVn¬ÿ¦Åeäk½”¾¡—‹œ^á"4ŒèEI.ÕpšCËHd‰Ì‘.:¨ÊÙª‰; žÓ蹭МÂÚFÖ“ÞˆÑ7,‡Ô1zµµéQ›Ñ M~€r_z~g´îBñè‘P¡Ë)ÊÈу ú‘ðó<ð»"ÄÛC[Ùwú¨ïñîáé îù‡¼ÿyÜ&n{S3róïŽ{€Ö A“d쯂=ð1¬‚€fISÐÈêë#ʳà0g;É)ZQš‡4Z á *N9š\š|#µ!¥3¹ók)KTgjëzd«¯árËZ8€<ص4žjêØk9©\Ç–üÖ± º’ôsPõÐòš†ûþÌS"áØ:º:º\&U*""ÊÆêòòjf$ö¯ž‡Ìoñ‘Ç;ýÚoF\`¸àM¿i„&8ªmù˾xÓðƒMµ°eÄóÑ×zåBáŽÿÉôG¢ wòZüÆ ñ a'w–Þ ®à+–oJºxÂ>ßOwn¥„÷´ß þŸË‚c€ÞCDðÑæótU´^&‹VDÈÊ£«_3bÅ臬ô¼Óý(¿ŸÏÊÐmºÕý!_<[Vþ xÁ²è€™áni‹`¸ëfœ]Ü´ ow#|½†ú§ÕÝY_Â] KñMZ®ùqÈ|ïeèçZõ|uøBñ£k…5P]±Eö¹` x€'8î]· \ö*€â6çŸäº.öu i½V§`<×Ì)PR²®Âù j8Ÿ R'Ù3áRÁ‰à 7É¿»­½šs[S »hðÇA#¯íGþ”ÏnG+h¹@“˜².qwj²Ärîé&øþZˆ&_m‡Á‰ˆ´»‹Çbr‰ƒƒÏÙ´œÒê‚Õ;K¥ijÐîgÊo];v¨ÁZ;7Û¥ ý>á5ØW¥ ('²B š+š\ƼìäŒ ñπˠµðWt ýDÔž» _Pw\™2eɺea¥qUU%%UµÑGB™Šú«Å-@Ý/X½E–꧈¤þ!šB£ „MÖ¦hU“ÂQ¦Ið n…¿2xsÜŒÌ^щ4ƒj¨ãŠ’…lxиǃŒðWxàÖ;³ä5S4ÉÈŠ‹yèj/¿ m¦¥¨b>‡PåÌÄH]nB6dBt Œ!M—^ÿ Ñ–õ%‹!;.I«MHfðñá +0#³"ýý§§¹lŸ Ù€ûká0š„¾¦a0·£ò³â3-—z¡÷—SA»ã"£ c †¢Âê‹í˜Æïc!Ž ÁåÈrÕ3Ä9€& áìçØœ{Á¶¹…ÞÆ}´7„5%UÅ5hïCÕmDÄó‚ð<ÆIÀü¸á$õØ9¢Ÿ˜¶ó.¯Ãøl€Ï&²¯èœ\îã„Â:¶užºˆ’ °ÄÜ È(;x1ïpvÖWÏÝ}A‚™Ø¿ƒW&aGðž¨ÿÆ&8—Ç´€¦—"ª½g$ºah,—ïù¨fdhŽ:o-¼ƒœY_ZV¤¬„“Ôç7O]¿Ó¹qÅ ¯­JF¿›n-¿Ý ÷¨g³.Ì™ìä<[’\ÁËÚ)ˆ>š'^·ÖiÒû?­â„C}÷gD¼piV0ªƒ…IÙ”í6Y-)ÛÓk'.þÈoñ‡Ë;ï÷´^¹yb¤G 'Ÿ~­gß7Áw@2þ+v,ºAÇXùÛ¼•›3ŽG1‚ƒšSá4U_,—ÇÅËV·o{ŒhnL@rFø *Ç×ç`ÒÖžK^øt&â࿺ §Û ÏR˜þ˜ÞÍ!ƒ–צ_RWÝv*ï×Í•n{óƒ2ÖÂ6jyØ”YŒ%3ÆÌ±Øb4Aü µö8endstream endobj 464 0 obj << /Filter /FlateDecode /Length 2393 >> stream xœ•YMs#7½ëWô±•Zõðûc«rp²©Ô¦vS•‰n©=È–,;c[Ž5“Ùüû<ì&ØV;“ÊaŠ €ÀÃÿÖ‰Av‚þ+ÿÞ<®Þ½÷Ýñ¼ÝqõÛJ¦»òÏÍc÷ͤìâW¡ÛÞ®ò—²“& N‡ÎY?h‹ŸW¿ôÛõF J¸è]·ƒ‘Ê+ßßc)£ÖôçõF‰Lƒ]Ѧ?=®•\´ý5IpÂ)-ùgOXj¯­öýî#Ö"Z«¼áGNOY´²Ķ>Õï>hœïI¡U"V3lÿ»!†Ñ7¤\cm쟓F˜¡°L6yc]õBûÒFo¡…ŽK)pÛÝ>]×ÑØý@G|ÐAÒºÚJêÅ£éwuySí;eÙ"8¸úq±`>p5Ó²qZµûXÕdÿÁÅÁ’!é6§‡|ÄÇ0B»N¹üaÒG‰èVÙ‡|„®¾#÷ 0Z[òñä’b·’²„29vÇTžn×ÿÛþ°ÚH3D+U·‘ ¶Ûî¬]‡'Ï "—/^´i hí¡"Â{!öÉ6—Œà'Îk§=À·ËU_†Ð)Óµ'òPdÉÑh—}:Æ~_oz¸Œ,)‰.Èþt“`„~é³cÖ°½…™)>Ÿê—<öo%}«¬õ9DÑðZƒw~!.ô®êbØÚ3k˜ƒf0£0Åޤ|f-d„`”‘-¡´Ç >ïÓi¥…°ð!K7(ëA^QYc²8Ñ;¾Ü‰“ž…tK`uÎÀüTÁ Ï£ }„ËkŽÛÑ|}Ù„†ÈV«8dxÚ‘uJ[iL³=¬7ÞÃ=8}uΡ(“&'C_žÔ,áþÈà•ÚÙ~“WÅ {%¤þ¹ˆ¼ÆÇ×™½‚ëOŸ˜õË­ W‹ñ†lœÌ‘Ró<Ù¥ ´ùõam-è\÷»ã!_ ðTý9‹0:Á7»Ôöß’YWö$.-¹võc>C?ì&›€Àcß0wÍR qlì¶ÿYm¿ú%k‘2ø8U“D&ϵ>×0£˜ …Q"”šåH÷nÏÕT“KËS2ä»íê§U.Í/oÔrÝÁ|¿­å‘ |윲@¡ZÞ›õö×Qèßí ”0ˆ„‡Ã]t]ëã‰'ÎÑ z uÈ'ü,¿/®”·tÄEP?Í9üi}‘ñG³F:LéFWp”† )ƒx÷ò7‘„Ǩæ“õ¸†9óMÌ »þM­Û ¹Á¥p¥Í—‰ Á8Þ 3’aÌdx½Vžú0J¨ r®´Â5–\:¡CJgZJ¥f}dboO-=%nÁ¢Å"tÏ÷‘¬QÈ <ðȬ~÷^)q…µnÌ÷«ä+d­ öM£Á’(O($¬“>ÈE4- ¯ð& …͇,(m‹„+”NÅ |w\K• í‰D‚o¶ŸH‰ˆŠªrÍ¡s¹Ë,]ÇVKÁn­r<~üw"Ê’Bß²†~»Fú¥ãÒÚâÛÐú0n6€ÖmH \þTãÇœÿšuSCPµÔk¹:&`@0dµ¸h;PœÐ°øª!Á© ½DN6)´VMe F•–DZäÒ÷ù¸¥†ó”€"À:¿ÓŠ>äösÉì¶mç4~"„‚ R°H[DåÝM~”8öÏ¿ôÉíÊåðí§É©:ÏÁØT¹¬YÓWµñ²#_`†ô@„4e|ªðW9ѹ±Â[éçÄ0½ßàèPxr³‡3j±Ü/µÑåE v¿åyÞ­6­òSEŸP´cB ýBÌÙ µ‘},úmPoÀ%»Ðô©6 pߢ›ÈÐn/PÝÜßÉ*¦…²6ûÄf‚>CB÷ÿgï †¸%¼Ì§³ÙëþD£iµz"¯gî»Ê§cŽbT4"àI?ŒO¾Hi1ër®ööè#ƒÒ«Áõÿ]³Ï±KõÕõ?Ô(­ä)ZêÅxwµÔ¢>e)N.‰Údÿ^ߌ JË…Ù»£üß]>Áû`漦iæOªéºÓ3úà7jXÒ9hPÓ k§s¾Žë/xÓ¾"‘·_² ´ç|¦ÃÀ»»m^¶Ä ^§˜º€Zh,ÖŠÍ[c¯/¨u3PßàÆÒíh06šÜãJ ²úL«@Sýìz4EäTœ-ð6æô©"óœ¥åf}éé´07;¼ÊèÂ¥åRþU•£}CSrÙz^µà€Ç"Ü B_²@@.@–%ÑrÊ;ÁäøvÌ=ø\i½a– °̬AKvjÿW½X”Žèl÷ŒºÓ6?rª_þʶl}S|lt^”Â…Ùú]=ÂmÙ5ŠêúC=¾[x¨G¾fÛï/›Î•òõÕeÓ§#{¶}ÏÖÍz:ÞŒ#—1Ö"yĘv oT?Ž1" ŒÏåŠG”¦Ä!i"-ý5ï4¹ˆo»2"@ ¢Q~;/ìød–1 9Z­Ìè›ûìÔôš|˨Œ³eœ.ð^·uRÔNW6xå8g²»:JÊÎ^Ö¹*òÌ¡ü´úaºD¼endstream endobj 465 0 obj << /Type /XRef /Length 553 /Filter /FlateDecode /DecodeParms << /Columns 5 /Predictor 12 >> /W [ 1 3 1 ] /Info 3 0 R /Root 2 0 R /Size 466 /ID [<566b6774bd619870587abc58f565feb6>] >> stream xœí•±NA†oƒ#'(A‚D&R:¨©R%JEt)‘HI(颔)xƒï¼{ö;ð„‚"Uü (¢€20s+ÝwŽŠ¿F³{ÿ?óïì:Mä—º$y©x•¤’pOøø?™ÿtzÏ]Š·ÿZOÞ>¦·ï~‰·Ý-qµóMpåP°õQpæLðõžà³ÁWïuç]½\>lï .. ö¾ºUÁôü]ç§Ä³4ÿYðí¦`w_pá@UÖ申û[ñB9¯Uw£Š_ôç¿ ó›¯¯m«–W•?Õj\(fšÉ5Ϋ¼³«¡bse> stream xœÕZYsÛ8~ß_·ÉTÊ nM¥ÊGì8>âÈŽ“ÉÔ<Ðls#‹ŽHeœýõÛ â-QŠw·R* @NDyDOà áðï) H C¢‰ÇSD(¢,}¢µ‚ú”ÔÓD‡X†$ôPh%T‘CŽ%'¡ÐôCB ãIIB…¥"¡/¡¾¥õX‚æBÐ(Ć—1†'ê5 î1å{D¡vuÀ‰‚©ð8Œ¤œ(èEùx‚Óô­4ž„ü¿ÿNè™É¢I”E J˜Í¡ÑIaFíÅÕ÷GCè><Ÿ&wäÕ+Ûdn¢,NfQfÈ‹ƒrÆ gÚóY°ÃÔ/Œýòk^/™“Wæ\ž%“u-.æÉd16Ðäèâ”Ý'i–Žçñco÷S¿±_—2$‹YÀ¢'ñ$%öP^î ˜8[äWÚ0 ¶po:ÆTŠÅ_Å›º—_Ž1ËÌ,K]NgfG{ÉŒ‡w|˜P#¶¾ˆæP³ÐÚȤÉb>†ž°›×OÙÑe†oÀ´Ï¡cD§Ó÷<_š ú¤‡ ˆyÊ ËW¯ª2"íE©±­é›ãƒ«ó“—§g—Ñ,õØÎ^2ÀX³q2‰gw„~Œg»³4.oÆó4Û¿æ8ÿV„ã” Sä´AO£¼ŠÜ¢—‹›ÌJ€rx…8nøñ$»GÅ æ[e¿@ˆÚuù ]ÖbÀQÏ멉?eçRjà:â{Y—+Yj况ÀÖâ$XÂâàî i˜Õ¦Ußn:Æi `eP?¾1ñÝ}q ¯Óð‚îÒ3:¢—4¢c:N¦ÉŒN¨¡1ÒšÐG:§)Íè‚>`Q…ØãŽJPÍ4ºK}VI{RìC ô—{xO ª Äyô`ú¦õøwgwS èYœ¦0§v`éÊÌÃ5,¤¼:K•ù¥Ÿòw•jcéztñþíÅËóøáf‘ÂÀ§› IÊÖhaMj(š¸ÅˆûW0ÃCŽ&r@@qø€g®W¼‹ë¼ÈÏàÜoÖíD$Œ…Ï«¥ŽK™ñLnñ~q qk-œä}ï0ô‡m[膕®Šn{¹D÷ݧô5=¤Çô~Nß[´_Þo,â"‹xÛœšÙ$Jïé-½¿z ë½2|±t˜ÑY<3ÀŠþ飙ÇÉÄ$5ßÌŒ¦ñP%»ŸC³¿ Í7úD¿Ó›yRe“^°GÖØ³º§–K|“:}x“>}H^I ˜¯‚@ÔÕR`[z½wùîêê%j93ó½«QòÍ*R:—tI·Æð¼&o`¬a¼QÜA/X2D€²7ã¶À£ì¼0°™à}Ázä‡èy¼Sû%ê}™÷:9B®;$Uèº@Ïk£{zÐ0 ̪ò¥]Ñ7BÇ=7¼«m ¥ÐC‚Úè|¡£'Ð>@O°.<k$Cµö°%*ì°2¸2–<ôÁ«Y™‚‰Ç¹½¹¢-oөɖƧIHdbŒ÷ôþûã=°­•è›LÍmæÎæ¶—œª_é×E’™ÉÍÔV(.\Çã‡ØÉÑÏè¿{8­ NûuJk÷0D?tT§tÅEr”îãÖPJÃ(ël"øp-J_œ¼ù°^]IFæn1Ô&²6¹E“܃"š aÝ*¥¥#©¶Äc˜‰,j»>rÚ¡Áƒ£ÏX¢ë„÷°‡Ò`úÖéªÖ/Îû ”=Xy^•šC[<ð9–8N]r|Wû´hÅÜè¶GæFáþf´­htcº[3¡oÁˆžZ3z‘“ø½v4Žæ½Ϊùºˆ¦ ÓZaó¿–|BåÇé"݆ÍéEÙ˜ÓM;íå¬À(· µl²º^CY Öe¡†úêý££Ï•ÅdG7l“ZmMj¥={l[µ´žºe¡ëo¥lÈ+´¯p,-°`¥Åô†Â„BˆI°ª"dn‹ŸS íçæöq)CWÔoÑ*ºÌÒÆ&®pÁ…a¯O}Îd+³¾$¼QÕ„hVV"Ô·´;áZ„‚RZ}{}½{]Õ7£~£­ØÃÝ ¢±ÿþÏÅúÌ"¯îÇò é•á²ÝFR=žµx>üL‹U2«"e‰OxvE©cD­mou¤øM¤ôÎÙÀÕ,k]Ýá¢_½=|yzv–ÌÙt < *¢·{­À\ëËW -ŽUWëŽfÛþÖí±»d©öR–ÝÿÃåÚæhBØëÁï ­·QxŸÜ0Wíô ½™Gcc ?ž}1YõÜù½þH‡#r‡Ù[3¯;$S:5iºmŒ±23°˜MÌ<'sSºm„÷­í;Ò=U"°Ê¬S6hR¶—;Smzm¢@Ê%e/wÉm4MMѤÌ·SqûoߌNJ¹6Zý…j‰Ãy‹Òƒ=”u­Ù}kùêzëêTéX¿®Ë²jaè'ÿ¦ô¡K¿ŽUešرx¸8Çw3›3îä‡eCî}7}ÎWø0o)¯æE–©Ì‡õÀi ÊÃõ±3Ð-Wå·à˜• ¸ƒ›xîœ Ìyåç 7ûòó7úòó7ùÜ9LÏb# t~†{Š•Ê-šÜtýè`¥ ‰ÈÇßr‹æýîÉõ»ýf2U?Ô›m>·wj¼Á‡Ì}ªa^ ÷‹,yý§+»<«Âÿœ£Ë\w™ù®J²>c^ö³MÀ¾_ÙÑ©’4)sÖ6zv!XžÂ‰`ÒŠxƒ ŽW¡ahÔ+ÖÇ]éé¯÷ cwšm¶[Ø‘Ëâm?Qm`TêËó*Ñ6;Ïõë79mcÓe”Ú„× ˆ½,CnÍäö£â“€å*gj^Éá€Õ¨mAZó¿"žÁ –aß-ˆ°¶¶!û3ÐnþzïHþ¨Ýè±øáGa-~aBV[Ž ïü‡-Gus_l³¹ÿÿV„x&EøUE?¡"ä3)"¬(B²ŸPêy!yUâ'T„ÿLŠPUEø?¡"‚gR„®*"ü ¡ŸGªŠµ "*Ÿ„½>úãóqsO¥o¨"Rf Úûª5eðÎx¡ýkF!å¶b5â(¶!ÙrÒ}¯ÃüÍκíG;Π­GÛ#ëÙÍXƒØíBLß½k|qS$níþ_5:±™³2[`óÍðd¹%×røì.;×íè¤b™òïÎV`gpt²6[й'÷æøÃñÕçÜ×Ôf±;6<”lwpÊKxkXí0wݽI¶ºeWmÖ±}¯þ¬«MÑ×ÚT—ß–Ïm«ÍÚ×_ÅÎtׇ_[ÊO™\ÝVï(÷TÁÑJqiÖBn|††*kCj ìùß?ÄO¼óÔ—ý¸»Ó!…Vä ¾½5`ƒÐèüiWùr5)¿x^ÖߦSüˆí6îîì?4´pàendstream endobj 59 0 obj << /Subtype /XML /Type /Metadata /Length 1438 >> stream 2025-07-02T08:16:07-05:00 2025-07-02T08:16:07-05:00 2025-07-02T08:16:07-05:00 TeX Untitled endstream endobj 60 0 obj << /Filter /FlateDecode /Length 3517 >> stream xœí\Ýo77úG¸ °h~¤w4iïÐ;ô€ÚÆõ!éÃZÚØÛHZeµªc Çý½7üØ]®#ÛŠ¼œBɃW\rf8Ãg†Kòãˆ`:"îü;]œL¬`Üp(äšIiáA)…U×'O¨o0Ц‹ÑëË“³s=b[fèèòýI FG’bÍ­ij±âbt¹8y‹ÎÇ‚5ÂZ4uÏ”rf$Zï?¢Ñwc'5J¢jìÛi­ÑµãJÍP6ëj¾Üp)%šûg+™P½çòÕx"Œu?ÑEh*•hxºÇlÌ,¶–GŽ–sÖž‚fV”'\Il G?…ÎcPV; œ KÓ†Q$ɘBŸ\C a)çÍ}!˜p*˜€ÆhŽÊ Ž`Cž—ZÛ_/ÿuòÃåÉÏ'Á˜ÈŽ4Xˆ¶ÍDÊ*L” &z],?ÙòdЦÑбctvN¡ Ö‚z"‚c©Á® ®8]ÎN_þvŸÇʺÇIRñ-:u䡨óûEQWÅ],0]äóâ÷1ƒÁH@³Ër #ÈjŠ~ß&†&XJmvƒ¨Å0èû¢úÐübè‡Ù˜‚T Y>¿òÂpJÑ&¯ë|¾MƒŠè¾:¦[å zý :<‹ªýœZ‚¡¹€ÑÀ(*7[… X("{BÌ‚PO`m—®â„I¹ £ Õ8ˆU3WµO#Ö*7%ŒxltQ>R0$‰¶½á%°R\”†€…ÑuS׫õ«³³ë¢¾Ù\…Ó+ãOËÅÙUyË0ÞvØÛY±°Ž¨iæDpÕŒ0™ôu¿(ÅBS³Øæ¥¡XhïÑ›rYçËz½·‘¥ãþYoå$ @0¨›Ž'œ„?.몜m¦µSónVÝΨ+b.Á LBh£CGXÛ‘‹UV­sgRæ]ÖO8÷OÏìRÊ xíÛº<ÄdBjè(,¢€ao€(4»~óE}ØÊ‚DlˆêqÁŠRãƒÿê£rÈRýÙ£õͱôáRÕ•ÚRê†Ls˜7š|¸ØoEµ¥Ð €‘úÄÁ! ;R4Ð` 4êA Žˆð>›Ãâ“?LÂÆ¶V‡† D¶õ‡˜'0Y “”Í&/»ôk† ?L௤¶‰H­Ëa’²9Âäe—~Í0‚‰t …m>"Ó kH˜¤lŽ0yÙ¥G˜|n°4²‰Jƒ®!a’²9Âäe—~Í0‘‚ ˜RÓÀD§A×ùp«[=6Gl¼ÀÒ—‚¤tçå-u l‹•¤ 6Li ‚èBR6Gò²K_ Löq!‚ Ð1ÚU`›FZÂ¤Çæ“—]ú5ÃD&†`MÛU`JÆ.…ÇI±œ ˆ“”Ï'/»ôˆ“Ïq¢fmÞNi“Õ á3Úãqp\Ñò§@Ë“ÙÈãh1B‹Ûtcx ÖÁe6+ô*)Ÿ#N^vé×ìURœ`7ŽížF |%q›¹­ßf7f}áV»hö˜n p1ÌBrOy³‡ÒmƒøÌ‰fåt³È—uV‡ý“ÆÉA‘ßei¨WKávÎü®I×Èjô¾t{"µÛ‰ê–šhZ.Ï—E¾œæM{ŽÊ÷±‚Öè|ºZ}W-²Y1Ÿ—‘†VhÝlÊsMw‹0cDº mÖyµŽÒ®²uÇÛª‘Ûíe½®²VuPÝÓ=3 #Ó óº=áÀ‚~®·«ÅúÜÏlóâªÊª»¡fÔNRFàGOÐf—b·±p²uhiztß¡6+¦l,7ªÇæuVçë¸yY§íøn[\æu£j‰²9ÞËe$’‹ ç=IN‡ï¯•ØÐ¾ZaâyÆâ0=I£ú£õÝ8Ž>€ˆ;†1øÈãBûݹi_:¸>¯CVa˜\=ú`‡‰~.@W0ŽŸÕ! ¦Rx8 ©0å÷‡äéÏ“ÝM´D÷¨~;¼ì@½··‰òãеíÐM¼¢ ÜŽ8iIhØã¾©êb/ƒE¢ÆykÙ£9”±ÊLê‹ –RÏÈa !CJòÝ;ЉšÇš8”JAj½zåÎþ1ãv¹gí3¸Kî²WæŽ@€“»[ÁL~Zéý™«fMç„ý;ðuÞ OCm D9x׿™zo9¼çÓࢀHÒ³A\'áŒSOc«lú!»z‚îdu£1†¦™ï©õ?®@ä³ñGP&C³¢Ê§õünìŽsæóÉÂ1¹×›†5!` 4в¼SªàѸcu\89!ˆ™‡HbÂÜ–%Fʱ„Á3†”Êz!¼Ñ¤ï‘3Ã"¾q‡±¼Ùý+‹Ö›Õª¬j/°{oD0 r§\l?{ÕœÖóa«¥¢w“)“* K!°âaXvÇš3I;2CûmOc›­Ì8SØ@ÝcVïÈLˆwÍ03è°>³õnÌ×î äîÌT$Χ÷Ôx¹3ˆ2 †™I°²÷Õ¸3Èm0Ó_À« ­9Ñ*jñ^îl—†|Þ‡}ÛiCPåNJÇ*Ý6€¨©&ˆ|˜š¦M•îÃéþÔÙÖOPû¢žv«ðÊ&Ÿ¢¦4‹UVÓ͸Ѹ3­n%çIɼÇò æ}—ŸŽóïMHÀì€Þ$åj8´í˜>+˜M)Sá’û~š|réæùSß»$µeþx—Úrþló5xL½™ŸÂ§›ª‚—ó»˜iÖuY…ä—ùŒ7[@q€,]$—tïÍxâ–LÈpñfÏu‰ŽuGÀY8IP¸P®µ÷¦›éM§‹ÅrÖd‡*IÄMlØýN5øqSÔy³@>›°ÇŒÄ%øu±(æþ´§^».à Ow t¹Yä 5/9Øm¾Y,'eU€Ú#¥Lt÷gCMgp >ß„ Ê×%2.9xŠbøõ„¶»Üß…Ðëî³ÂªŽ0ôIQÖ#üz8ofîøïcÎܼ&´×ô©˜¢å+@eL÷?îzÀî·'‚Šn´øÝ•¼×Øå0;xDj,XÎ~Q\A xݤé[ŸLD„ní—›ÜOÖG€Y|Lçv>´CÏ…Äûª\Ä·”ÅÁgÃÂc ¿¤@@óJõ41HHÏ]œÝ×R¾ …%th ­ï{}S•›ë›FoJ`øÝïlÉóY}v§sy_—qQÈ@jE·6ÚÆ‚ظX\I;s«‡ÂCðí['È«W³|•/gëwý(âÝø×_Ÿùm¬IÈanQ¦ù2|å×,)÷ßñgexvÁÔ²ô/„q/a.ðøu Zß”·±¶… Ç%qÂç·ý2öŸ~!Ë} Tå¹›.|\þi5/¦EHFѪʿùär(ažì2[äá†ißÒM¦õÍ£K—B·’ôÕ>¹à‚œ)m³ñ£+nÊM‹½˜ìIVR8·Aû ýçÒÏ.ƒ€ƒIj¬VU¹ªŠ¬Îñà÷¢ j̈+Hw´èß÷4­üÅsÜÇÁÕd<1ÎXåoù´Æeu}ò×aAº…\0ú·0taÒs7†QçÇB(üŒ»¡ÜA­i_–t¹5GÉ.H°…Fÿ-®—.¸_I9[¡?âØ±)·ÉlÊ?ò«Êßå{Í j.§˜ÜE»; î -a®·¤Yhû£¹s/åÙ¹i—éÿö5§ÝjMð5\§ªB¶eðóÉÿA/oendstream endobj 61 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 2131 >> stream xœU PSg¾!xsuY¬ÄHXñÞ¸µ¾P•ÖǬV]uKE@E”‡<ä%A”C 9—‚ÂC >”¢¢²øèÖÖê¸eÆÑu·»[vêhÛí¹öwêÞh×Ù™M&™ùïç<¾ï|ß‘Pîn”D"ñ|?(4&=;`þÜU©ñÎ'Ó…ÉÁ×M˜"þø;Ç€‡<Üû|Çöy¡~nëÞ ¤É–øÔ÷2öäe%'&å¨ÌŸ¿pî\ñÿUlžj•¿jCL\J†&;%Y“¯Úàä¯ú C#>LVÍÌHWÅîJŠIMPe$¨ÂvE¨6‡® Uý6dãæàÐYþ¯Õ4z (J¾2cOVvŽ:fo\Pü®äÐÔ´w)ê×T0µ‰ ¥Â¨ÍT8µŠŠ¤VSþÔj-µÚ@-¢‚¨¨ÉÔD±]Ê* ®HVHÌn³Ý»i®Tpß=ÆcL)íA—ÐOdfY?Ì4c›ç+·¿n¦šrÑoPØ®‘¼XÛª ”jH¢ðLYГ`ÒH‡‚$ñå3¥áÁÀì9 v¶ƒn€“`?s¥J˜hò+ onu¤µfs§RNë¯iúŠ`¯ßZs5Š5XJÍÅ c‘©Ø¸¿0tLÞl`¯äwC=0}èUŽ3½š-ÖV5€ÚôÖHá$©0¶Wf£µ¸ÉÐh¬(˜LÅÅÚƒ{Ô1ÀdÔßäPûXV݉PÈ-øÂ…Fª À™6; šk$ôôŽ·…º?°õ–à0ãâV{]˜£‘|,òºÌÉkéþ(ŽGïÒHâˆN¶>)duh±½ŸÅó£WÃ)H§LõQÚ·­ŸÃƒ^6S–bÝ×= ¾§àyvSÒ“p©3rº¹I† È>2*²$c›[d(-è+6ñùb‹Á*¢k?=ç.9>ærÝî`.I–DjdÆš«+µß±Ýîå4¯å!¾ÿRøÏÒ˜=]_#g=ƳžB©84ÑÉ!\LëP@eI¹þyÕø®µU‹”Z|(`wÒyPû † ‹òs#¥ÌoÒò9Àì ¨A­7—XrèGÖ‘dK±¾Ä}ÔQ˜=t”™mƒ8QùœL³kª¡ |ÎÒö&p8ÙüÇ#礉Šétö¾ý’ªJÎk³Ñ¦+1‚NÇæDžÌ›ðìÆ_,_>ÿ¬u_ZW­ý¯y;¤/Ï¯ÜæH³­†Ìò_CÞ#ïþýZ?æÛoqÇjyl"—Ò?}"jåÅ×ßpü6/¤ãxoyÄã.(„!kKè,È2æÇ%¹«ÌH˜w0‰1ÑE±OsûÉD¼­ÌïN<`iy“KPC.AÉ-­´üø0Þ‚—UEŸ#Ò#ÁÈ.eÃÎ#Ð.~@CNÄ[JÛ‘Ëèkmaø—vz˜¨Ö‘pMÛ€hI¨ÖxuºŒ„ø ·ü;¡äç*FÆN#‹î‰´¦ŠMï¶u;͸•“ßýzª{Î3 v]û¨Ãß» ȇ¢tMÖ¾c!0ÓáïwîÀWè~¼U—;ÌÇ«áÜsûÑwÀë$*L(ý¥Þò™B6Ö(P±qÌÛ$‹–9$ph)t]³´ÝäUV3Tƒµô¸©²ä¤‰/‚ѵºàˆú`äï“1Pø¸ôƒG鿣ü9ŽH­ y0‰§å©×ÍwN¾µ›ÌËjë»îÜ7ÄþE’¦NÃñÈyË缘zBAV`ϧµC]€oø`$Iƒh–èiùw¯qaÄÙêP*Ã@rÆž]ðù#ÝX'8â'$(‚÷o&ãY2 Õ8‰F¦iûz±}ê•™Öz Ìë2Î *'î×1üg¹˜7ùñ5•Ï· W‡]¯D¸¨Ù+K·ìíaûè+N8‰›B©Q"4#úô, RáT–UB˜¡ÒÄgÕ¬>l‰f™—K6®îÜ~XÃõméÕÝË»zÀaphlº¦\ØÅÌ]\º{ɪös‘laµQä¤ ¥¥‹”ƃ"?¥ûm¢Åx+÷²±E\;³¿º…ó~‚AÔˆkŸ„ÿçн†ó¨‰½’Æžt7õÖ°C.wý¤/zEØNȾÙÑýÖê°ÝëÙ}ÿ|Û{!¢w§æhRôŒé’Ë“_ßM£;1Söäz×Å U¹á,9öÿ^‰s`¦½1½%Ñ[Šéø½â®¬ÅÄg²+èL“)“[!ËäM-ì]º…ç[8rßý]{ªBt=&3óôÀ8ôý;Î=,Ãclÿአž7—ófÞÃãiuµxÏf‹Ùã—õoë½§ñendstream endobj 62 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 3754 >> stream xœWiXÇÖA@ãL«ˆ‚Š * x È"Џ`u€A˜!Ì €ânáE!¢ ˆ¢dqGp#²Ä sÕÜÜÄ-‰Ñ zš¯&÷¹Õ3Æxÿ~?ú™êª®:ïyÏ{ΩQ&F”H$¬L‰IׄF«Çy©“ã„9g~ˆˆÿ̈jœƒÕ}m}™b^jN!scdnRö™•ßÀ¾8«>qþîÃ!;DÅ¢oD¿›¿Èi̘±³Õ©™iÊ„D-7ÑÃËÉä>¬pÞ 2AÅ9’Á E²:5E¡Òºp¡ §MTpñÊd7{nÈÿ`97ZÆÉ*EZt2’“¬Œå•± •FáÄūӸdà «VÅ)µJµJãÂÍÒpÑœ&U«$›±ŠTaa,—ªHKQj4dÌ)5\BZ´J«ˆã´jN©ŠMNÌ“ùxµJË¥¦©Éz Y!G…¨5ZMlš2UË‹!Þ¾ŒÚÄh­`W£$Ëœ:ž|§ŽM¼ù¸¦Vª4œV‘¡ìÄ(¸8¥&59:“Ø%G¥¦)õÒ5JUÂßÖÇriŠ„è´¸d…F®ÀÊßþqŸxššœ©ß«ÖõѾR«Q$Ç»¢Ê‘°j¸@NìÿÌü¢ÿ_Ð(НòRÏNõöIóÕhÓýWDdÄdÆÅ+âæÍW†.Xžœ2v¿Ë„‰“\'O™êæîAQs©Tå@Í£FRŽT(5ŠZ@…Q )gjåE¥–P³©pÊ›r¡|¨ñ”/%§ü¨I”+5‡šLM¡© *˜² ÔTÊŠHYSƒ(–²¡l);j0eOM J¤LȦK"±(VÔ`daäi”itÔØÁ8Òøkã3ÆL¢MòMn‹G‰UâF±Ž£³é§N’Çôcr™*Ó‘¦~¦«LóLufNfÓÍæ›Ý1{×/¤_—¹©¹Âü߬E‰å (·äó.ÐOU<°8ˆÎÖú\ _ÅêªÈk·Äº»õ\]Góɤ)þ‘ÌüGýü;°Ä+Ø÷ ¦`¸÷€fAÀè÷x†,‹Ùî˾Ãù|>sqWOOC×A¯…ü$: ÎÆ}ÿàW°›[ÖÖ$׆ޛX‹EU „Gál¼¬ñ(Â?XôÂô<v¤s\BºOùKp…)ßý fWê3Ëd…+÷fäÅ1&Vƒ˜Âs0Ý P³¨á„`Ìý¹¼WÒ§æ^Tw l~Kpþ á²,¡ÁïÔ$GKUʹ ˜©Ùï.ø:8…ûúú,íxóæbg—Ì@;¯+Q7¡ü:ßmÕ4£®c—nÞè(ÿIòïó:Ãoú–b”¬;ëÞ°dÛ ˆ¯yâ)xr¨'“ãÆEÑ÷ä8È„vþ+üxð`¥;úg _G~e„ÿÁD7ö 3èÆÖºê£fj$Ö!kkØ·}k‘†K6änF[P Nñb¬'¼“èE>˜º'˜Ò ¦îSwÈ܈‰¼?SÀ™˜iÔ‚ô‚‘è"9záŽßÁ±Û€víÄ#‰CC§úbã„ýÉE+dEs®dÁôEv•ÙùÙ(IŠ[9'Aµ'?Sºzÿ¦ý›N¯é]ØìßAàŽî£ë…55G/£FÔ•xÎû0öi°‹Ë_¿aNV_jÿFž+µ„µïàÝ ÑƒÂޱ3`$æðH_—Nü/zê¹èçå¥;÷–J_IÖlÛ°}=bâsö_”Á…‡½DûñžÅú°G Ыmø*²ù™$`Y´|nJE›^cNg.ÁýnËAr÷Òñæi€ÄÊQqŸO±¨E FÙ—Âbç¿è ¬o-A óUb<šÆ" ›ò2a ótUb=g†Ô(#†çÂPcþðA6­dãTÆ@£Œ>¿†±ãÌ l•#…!ôžk%‡:Ót<3!3gÕê ²Œõùf‡®·ã2-@Î(¢@QšZ¾üBÆEÔŒ®»Ô€Ô;׬b`,g@ ;-6Âû UiMÝ‘âùÒ‹yU{¾ÚQ¸w° Q½B¼•½ÿ6àûb’Îø>ï g¡]Œ}h\ïŠá®ÁIÉßN”²à ‡ÅØ“žŒÝ\ÁM7>Œýp©<éçàù { #=Û¦ðŒ<“‹E7?$ÚMÂ9”»*9µðBšdì+ènwÓï%\‘Å7úŸòG~hiš2Œ| ˜áËlç%ŸQNá>¾Þ_tô¼Ò'߈Õ=}ŠE¼TH[ÝPÜ*Æ.4DènŠ·K¶J+â³7äîΔ—Þš¿ý ªDu{Žî;Sx°¤¤Òú¬í> Ë)A EðŒ]v®ßã!DÆSÆ ÃØ÷Ř ¶Ï[ Ãöt¦:5 1ÞQ­½ û.¬ž,/¬A×ÑñÔBoƲïžÞÛàLJ8¡8™ocÁV×&&Z–oëÚÀ¹/¯àAºnlÇw‹±öƒ’>¥ëĺx'àÈ÷Χ›¾(õ#ÈX'<»y™uz‘¬jÑmåmÔŽ.”V62ØŒ·0”¥¥rŸ¥¿¿¾Øe(KzP¤(' ø½6z κ4®ã7Þ|®>¹ßÃðÐÿ½ˆ? +ØÜ|´íAM.¯­Nx5ù¦¾úŽ‹M°?žõrŒ‹WïÊeXJgEÅ¥-F±hùÁ•'×o>º­Ùñ‚Í{\Y{‹P_‘U¬.XùÕŠñ I`¢¦É/~é=Rø6Ia÷Fº,ÿëcù…Û·åK{%_îHÌÍ@ŒË²È ²93]èü€ãýžHôÅûi¯&!h°óc‰Ü%Ñ­eAÞ 1Ø OÇž?aÜR]tóŠÌK2'|™ÏÂÄ#µÙR<’Î.TN©OlÎzBôçöò.XËø«ü¦Ø®+^£œûyùG´¿úãüw„¾"- âw“vTOHrZÒ¸öRsùkô ½Wôtvx|3@Iò_…"4aQµC«o‹üIR©l×ܨd~œöà‘‚]ìÌiÝ^ÚuI—£ÁØ|úB㸾 °ü~?7;,=Ò5Ò¶­`>©Èÿ$¡«ô”u,|N·•}¼ ­ß¾V¶=e¢l$ß•^”ÈÀ”ã´¶ çªØË·ìs©y\Q{ýŒn¬lL’kß‹sÄàNã%ð3B”»Ò+¼Á[¡Âë7Жÿgññ>Ö 2,#‡|nxl­+›?¹—µß>]Ó|áDj”ëô3ÿóΔôÜ”|)ù+$ý²!ìÉeë A(vEĦ]ßbÀQÔJ\jG;þ¸U‚䩉!ë˜PIíî²ýÇ×”]…20T¨ÈûVÄ7A+«kÁ·ÐŸl‡$a¿3vü«]›óûIJJœàܱ¾Dv&š³<*$fAÆ„‡"lupÒ7au~Š'¨µ”Ÿm®i*~ŽÀͪŸ”W£;|«ÜI$Å&§Ñ‰•ã¿NÙ;ƒ4!Ï Ó׫WE§hcQñ~ ¼› 1ë„èb/¡¼íG7]X{2-b‚"—û'TßÝ"şѹxø‹I@n20æ·ŸAú$¡iú™õ¿n×?×ff®÷ñÐirõ¢X©:qíRȬInõ΢=‡ Ê+Šjs­Bâ“à.[g" FßZÌ1vï‡=hœ¯óc3¨ÂI\&Þ“à$`XDC\3ÜÌá(÷“›Ù»¦o «ëOêdbH¨¬(ªGÌwõ‹§¸G.ö V–_ß*”áxÀK7ôcß¾%…eäÄרö‹ÄuÉ1²-†óHr‹s ²¨)$ UtŽÝx>§$óX|Ü“ÿ@®hv\”w´o–'Â,–fžž_ë/îrö°_ß |æö[΋ˊˆ”í¼ÐW' Zkª¯¡sèhæ¡eŒeÛêϘ± ( ²ñþóMm2ÃUâ[Á©RÁŸ-$gßÑQS1« wHsÉÀcÈñthï’ó„HæÞ5¿@0‰ãF†\À‚ü’pþÆãmØ£û÷ìßwâøÁztžã1°-¶3 ›ÈË¢Z•RëHe˜›=¶ïq'ÝóìP6yœ•Zÿ†í!½U¯XyæjS}u‹Ìºg>ÅvÖGÌ’G.“Ë£ÎuÝ9{¾]À¯!`ì€""Ø2B\5x°;±èùt°DÏPguݪ–#ïШ'ëñòÆe|j¦’Üî<&Y= ž>µ¯ðˆ¬ oo^É1Qøy†+×m•>åç±u ÝgD. ˆmxô¸æÊ-™¥¶„¯*†ÅKKh03ƒaýÞíÝ•gnÃö™[PÔF'o@endstream endobj 63 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 4618 >> stream xœuWXWÛu™±­²ë€b²‹½ kTH4¤$H‘&Xi‹Â""" ˆåbQ)¢Ò„é bÁ† ¶ˆ%XƒòEõ‹ygsÉ÷ÿw@ó™üùŸ}žÝË;wæž÷œóžQ:ý(‘H4t¡¿g¨Ú'tÁ2c‡`O•°6ž)â?éÇ"ŽÃªß§k7Óh ÒÉü„Ó‘Á¯º7¬†RýD"÷ …!ë"CüüÕ†SçÌ15ô 3ôT†«Ö…{„ùû¬1Œ 4ôŠ4\ S‡úxZ©¼M ¿ 2ì½.Ì0Ô'Ì'tƒÏÃ…!*߀5>*u€gÉ/xÿˆEÍþJµ dáºE뇆©Ã­6DxnôŠôþf¯Ÿ¿C€ã²À `—Iƒ¦›˜N¶úŒ™ûf}>{Î\³Ô‰5šZJ¡ì¨±”=5Žr ÆSŽÔ2ʉr¦&S.”+µ€r£RË©E” µ˜² –P–”5²¦fP3©¯©o([j65€ ¦SRj¥KÉ(9¥¦†Q¥GEPúÔpje@¤>¡¨þÔ/¥C.:&š)ŠýÐϾßañq°ø‚Ž™N¤Î5ZD›ÓH"’¬T2,³Œ©eDz ì÷ý3úã»Üè8pßÀ—ƒô•Òž9¸qðk©Žtœ4Xš+ÅCCò‡Üj< ýUw‚n±L*["Û/ûUnÅR­U‚oü'G§/ÖŒÃ[þØÇÐ^àZÉX'o˸Ž4l•ÜÄŽñÑß$õˆJfi:Ž×Jh·ÑÜ[\Dã•)•óòâÐVÙëNèÔ—×éAH¹Ä=yS O™ê³Útü7^Ø`Cxâž0¥”/­æ§U‹4ÝPÔ-†<>†Ã#'Ç“ðÄWãÀ ~~aâ¤7x¤rµÎƒæ/0‡õ쿜kf8Ð;ßñ@)ÕŠiâ7‰ªßòzçÄü£|¦92áX«Ú‚FàYA`ÉK `REyì&ò@d¦)}L$ ò­Òì‹×`%ù¬Áú­˜ýÍVY·¾9ºµ¡öôÖ|VÊ7`U9,©å‡_‘uwBÒS}ùƒ|¬â ¦\bÓ‹¹£Ù^¼³€œrâ«70 çtã~ÞÎJ¡…}-èéèkü˜@<Ϙãy¥éÇûä‚fð%æ“ÂB’ÓÖ’sY¡:þNˆ4è߯Št#oÉßúƒ˜_дk§~¸\ýÁ@|ñpÐÅÛ³Wp÷$`óÌ»`çiFØFiNhu´÷Mü‚ù°«S̯âC8ç4÷O‚Á|Ãqx}ßúWÕ¦:¥ÄÎ̦M_ï ÔÚRÎ8'EfÓüEíßshO;×ëéÏxo NP#ÖØ¾†‚^ë·¹;â‹Hgo¡:(­ƒ”:avõ‡ÎEÖ—ÿ^ªÇ§Ãç.’M㣣hœ ¥0[’±yÿBºÖyH¶-ˆŽ¦ñlH(²JË+3f‘ï ûÛ±¥¼ŒÈcè± ëDúòv¢íå’Žm¨`*Ê JQ.ÊŽ;Å–<–lØ·1)±rMŠEq»üT~þ~l÷YÈ5½ÂˆŒr6[ÅO¯–U5xߣ»6úòeð’à2×ì]E ’|í2ݲ&ð‘R^Ø\ébàá`¯ IÍ QÄ<¢Ý±ž¤lKMÜ)Bƒíç_h¢‹Â*×ñÉðÏfå˨r« j‹Ž4:}X‘ºˆn”HáÉÎS|ÿúÇ9¢§â§üßaåwVÔîͬWhu‚z'Áxñ–Ò;JȆ)õxÊ;_fµ‰•Šb¤|ë¶§r^¿8;Gö²Ï,a´ $ÖWÐ|)3¡ÁùqcS~õE…\íËäÈ,š·ðaÞ—Û|GZ»©„‡Œ:P%ÿ䄨.q™¤T ,Ï ù&;£%…>S¼™–?{b#@‹rxs(ß'NàÃ9_æÒv˜ÙcMŸ“ÀBÞòB*­Á‹}™3;R£ð0|÷‡ûéYMI´†‘jÓû.Ý¥Íïúpérée Œä‡Ààž!Â×1¼å¹v‡ï⼌¶•`ƒ™)Üý°ŸÆ£6—ÁØYÕSXM Ù Oš¹ö4Œ*—8 LJjæõªêÑX6ÏÅ6,5>_ÑþPr$íP2ðÍœµæÊ@{¸ŒÆ°òÒùÎ÷òÍ ¨)ïJ5ù}LÇMåµ±nÁ¥·®Q„ñix#(ß,þ®ï[Á€¨o,vrˆ£}Á^Ã8ìMHã^àI qžñd-@Ã,MÅ`- ‡…çö“ÃYú2 ÛS·˜âaŸƒ~òþº”Þ•£ZþÓ&°(ÎÊ=î„]?ŠA_«æðâ)wÿ˜ Ãpü¹ æÃ'fÏñ€U+cÔîJ(eþ°Ðá1¥û‹Rȱ~9ou±b©-ÖK؈ƒÈ#“q“¢íæ÷‹wÞ¼Ç"t‘Êmj„ÑñMQ±‘(bÄÚ#ꪫ g®W€¿©Yè‚Åû^êâ<Zþß!þ?æ„HÓ%濨âN3ž!^ÑD9c¬nÁ]êxœ•›©œÃdnËLÈD챼ܒf§FØ°ÏøŸM€OΜÉ.9K,ð·÷$á“ŸŠ‹õÀ¯Rb›yæ«ØØó;]-mZºç³-ÚJðøJæëä˜^¢¦g\ˆº6ˆÁ= ØŽßMÁþÞLëö„¶'˜ÈKãm/Ç^!ò1­Å\YùSH't©æåÚ©¶c‚ö'…ÝOeH¬Ñð¡1ˆÎ6äTžRÊ—»RêÈZ3"%)i#¯îèéà|Õ~1~ˆºôôÝë^*Ú¾íÁ;&ö<VÁ¨Z‘æ1l}&æ—½ã|Ü"Ü;Þò û%¡$%tHÓÐ~´Ÿ…!‹nc6˜<á ]aø•«9'.*¦Á^GIR?ׂØ6ͪ¹ h;JPJá61F®"ëE¿tŠ õ º\òðˆ<†õXy‹AóNWçt-~xoæAtˆ- ,XÌšˆçîD;Ð…Íf:°¥‡úà‡9XU+¯µW€oýÖ Ù‰ûöÁõqèm}¹.ÅÓ¼7'7¢úøîó‰Ì[2y~½]Ç&e OTZ¢’6§D³òg[—Äx»Û˜µ.æN{~u“¢¢$·iÐm—b<à;£Ìá»Óv§¢d”•”¹7#¥¯,ÙØïÛž•Ån,TB¿z ¹>¸•k>á1o¾·»½½wÃ÷'êš•äÞ=s¹—‘×·”lEN#—ºM›ãT×\S¬9›­ò—$#Zû´ó“`b%hGhXGß7{ÃS¯/þSºò TdötåAÒ•‹® ™Ø—ª€ŒZ2î„a½ùñ?&©ØJÆA°Pˆe¾KÌNÌD]¨bý‘9¹6IÖ žù¥±µ(|[”Âgv"á3¦‡_ˆ¬ß}6¤.¢4 wù 9‡^˜ŸÇ³¦+¸ ½è3f¢Ã ŸIì:î[F´4zš9¦'7û‚ØLQy4GÎ6Xìä6y¥Oj¦J±%;ÚŽ¤•n"ÿu¢¬³`ÝÖgÅYB29Ëd¼ÈȤÁ¤ç²$2ÚRÀ6£’±LŽ$ª¿ &LÆæ ú,‰vR>ƒ 1Ev}­ôfè¾.ÙÌÀHìL¯ÓãŒM2^‰ð)Œk¬ÍÁ—©Ý±7ãyôF>ÜGòW®H¡ •k ›þ»S|T„#‰ƒ°éŸ>ÐWjGJµ? ò+;a•0žùå¼9§®ñÉ_Ž<‘Ë«5ì?„ô^F~ÈûòƼMZéÈ‹G×.þ(ð|ÄÙÜã鄳—ßD~ÄÙ¾7‚ŸÝšÌ½Ô«æ+¤¿Ï óNˆÐïÓÅ¥×&¹| |ÑSC_“Àtþ¶ â›ÞÞL[LZ4Ü€gó%ôb žÙ“‹9Þ+5ãJ*)P{3W¢‰EÌÄ£«´ÙU"ØðH\¬õâ<ø4¬C8á[,Ãj–,.ÈyFö!80Œ°EÉÕ7úìJ÷íÎS²_:! ónju¹ÂôŒlTÀ¯Ïó5mžAÜ %(l¢è ?ÍÉBË×÷æØ»êôþÌÉQdÕz-c¿ŽÆ^·$èþÁ“y¬Ü¦ºsª|uaa~~áQu¾*8<\¥B1þŽŠÚA)®À_p¯Ó®Ý%"k .w  _™£h‘öHT¹Àwå‚hV 7Á»MTáâz8ÂYBx Mű }r1(aç¯ ñó+\WVvôhYyÈQ¥ ¦þe½¨²ŽÿK ÅÚycLZ×wc9Œ1Ý ‡õ°ÞdxŒÒCçùÉqx9^î6î³Ï\_Ãrp?õæ¹°ªÒŠrDä=D -Â.ÁÖ4xêQº§Œ‰Ù„™íôjxZÅ`*9&“ÖŠ!£{üÉS2^梁V_þFÝãÈÁ` ÈX Íï·«¡Ó-È /ËÊLÞŸ¡ø)Ê.Ü[„ØÎ“ŽS°>™õ"‚-”_3òdÞf¯”DÎ" x@ú?ªÄ0™g9³ëû÷¯¶Þ»oÝbnfmcFL¸ik=ÿ‚Ü}`—Õs}ùj¸ï¸WGOGìë/Ûð ¬;ÓÒ*0/¼$ë@Ò¾tE7S˜S¼¯ ±']Íç:¹ODñJ;æà·ß%f‘éüÓéæÓ¬,LƒIô^§ z´5i[b,®r½gÁ„ä!¥|5ê²¹ŒÅ©„lM¾9àw•Mp{Ó!æu´$iw÷Ì¢­á{ÕQ@_Å4?‹ù‹8|#´Ø:¸r¾¾+z}¶<¿¨“ÉK*Ü£!ö§l÷kbci®NJ Wz?Þ¶'.q;äÞ¾â-Ì~û’¼§JfÝÅ~ [×(Áï’}'ð¶pHT Ê+ ßæm¹–K%—Ðyö\`¹‡_Xh`LR̾-Š«’=q(Å!uËíYØ©÷q™úCYË_ËzYo.‚_³èä ¨!Al©v%‡wEá‰xÂûXlù ‹`$|úë¿É_ù´.<ÐÎnƒ·‹¢,Þtà ”Øûañ)ÜÎU5fžEì£ 6cG-7ÛØé!L?ˆr÷ä 4ôÍã»#»QïÁ¯Ö—ÛÝÐ1cäê%Y]4\’à{ ¢;ó$r;x¤5 OˆFæ_5Èj:ˆ&tØ?Ö—»Âmžæ°¨Â¹µ²­§O·ßjp3squ PTEr·+*/‘õ—óo– =ÔÂrçv•B^`ê¿ÂÎÜÓOÌ`,(Ÿ?{§»¢»Ë/—²ò<6œ·¶ dΚ;:Í4²½ð´­¨úZ¹ÀE—È<oëEÕÝPARØgp“[©öŒYƒØ)Η@ ý.\û¡ëÌWØ0pG@œ¿ïa8@ÝDÕ¶ÜX˜9ë_Ø0 +°ÞÃY0¸æäÃç«03y:6Y(¸qØJÜà'Á ¦“lí²ÎÏÿ¨ª¬¬°°¬\u„ìú?:þ!Ä!އ($¡n VDf‘\Dn÷ÿ\iü‡‚˜TÛÿ5©«3©÷<+Åa3}í ÎÆ6p)²g‹ýêËKÛ‘{@a#Ù•Šö¢TTw¤±é Óô>”•|\fýײÿZÿ»Gb^X?¶‡>@XöÁ‚–xA¾-ÈÄ ˆo†aðé!V•ҧÁ’ïêS%Õ:RÔÿ—pFèendstream endobj 64 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 4031 >> stream xœuW XçÒÞ²»‚’.¨ØÅ»Èzo An‚ED@@ ·Šµ¶ò¡¶V”ZkTDѪ µ ^ŠzP EJÀ€i£Ò£U{fóá?çÛàNû<çàI6³ÙofÞ™yçˆ26¢D"шeÉŠµ³ÂbÓf„&$nl“x?Öˆ_œÓt»uùd&FfÆh¬å8K^:>·€À”X$ \›¾8=#?391)Ûv•“»Sxè òæ<}ºýìγg϶]›ÿ×û¶^ Yɉi¶“ÈENBjz†"!-{([L–m€­Njlæ_ŒE-\˜¶(}q†—wæ’¬ì~9þ¹±KóÖäÇÆ/KXœ˜š¶~yJxj„bêtûûœ7¹¸º¹ïû`æ¬9s=¾œBQã© ÊŽ ¦&P!ÔDjFM¦–SáT5ZAM§>¤QöT$µ˜šAEQ^”åM9RK(Ê™ò¥ü(WÊŸr£–RîTõHͤ–Q&”5œ2§Ò) j5’²¤¢))õÅQVT.eM¢FS6ÔXJF%SèE}ʘšCˆLEÁ¢KFR££|£ïÔb_q‘øš¸] ÆnƉÆ:‰ƒ$^rIÒJ[Óqtý‚±b2™3Ìïl[;lÜ0¯aMÃMlLLJLŽ™Ü6`ºÒ´ÈTiZcÚdÚiúÚÌÇ,Él“Yïð•ÃK†ÿjngþ¥ùu O‹(‹šcà´¹Î)a¥ŠwRŠø4Hç:pºä ÷élFã²A…äït'¤KàK‡7Ñ`%æ|Rò¡íIJ˶NÏ^ØÝc-ý®?ÂIÏèôB #mÿÇͶ'÷kâdøŸ=¼-Óçs’G¤bQ´Lú†¼ªa6©-»´Ð¥]¦µ–ò]V ¦[ѵÃjXéÛªóÊë·Æ M\ƒC+åïŸ>×øp jÈ­M8›p.òkoÄâ:Z‹p° |™ë¨rûñ¼ŠÜ¯(ŦnÈÍÌKÛ¾‚|É?á`ä2WЩ-G³ÈÉG³¤$ŽAI§lÌÞ˜¥Ø²±$¡ìNÞ¾STÕ }b8ÎWqx²Ëxì…½4ãa*Lî ÀÏí ž./ñäžÝôÄVØ"ÄÃÑ!´¤`yK¥•›ëÖe«ùµèªV¬›Æ#. ÜUØ MEóRÃü'Ú!l‚°Yõ„V¯›!?eY_™Ÿž\°±ÞñµåµöKl¢Z#AÚÕ–2þ2#4ˆá|þš8ηÓÛOàí%éÉz{[ráHƒ=qóŒ~Å;þ¡w” eéÔ)ªéƒ²1ÿm·uç§hbÓ>:X!‡;ŒÖ§só6Æ'ɲ2Š;W°½ôÞ¿¯T!¶£&=R¾‘AI9›ü¶a“MùŸ¦l^–™º ù°ö÷ƒþ¸ßp¬ñÙYè*Ûub/‹'‡Ò·df'§®ý( ±þ §nTŸ|Z&×øfÏÉ2Ö@zt]$ýð%¦ä¯To"#7ð^Põúû§^"á%¤¡˜ÿ {Ê9ð‚/l-q(¶„P‰= ‹q)ÄJÉsFC4XãhÉ-$/L*x*E=p½OÜHàTt<`..kHk'½%ë'óµ<ÝßbÙâ3‚ãåPÉÀ$|„ÓMià§?(á^µŽQŠºIð Éa$:>RõBíqšZ÷)Î(Ò…x¢Þ!q¡Á[,eÖæuy…IhôǨpWþvshë¡O¢¨rßѯ+<úu êÌGý{rN“±IWܧ׶œÉ­L¬ ¨\Dfgœ#6Æ‹°G¿-Œ‡‘]ð^©|&]8sM¬b—wÀ°nTýÒvyí¢R‡îÐð{5b>É byèA£S`ŽÁIƒ8Ug!Á 4ÄéAògÌ*úà:é™m$ÏY¸œNj;)0ÿX,Âs±wÁ¸ŸêO4_‘/yÈà>–ë¿5—€6•xž4ƒ¤¿/øeL³ž ô³—¬JôEhuyúåÜSÛO_gwµp{~¸×‹Xõ=÷hgñN¹afyr¶M»HCÈb?)“›š>§üæüÞݨø°¬•ÉÛ³¥¤±žÑ1 ä.Þ>múU=üª>fhOרaŸZô‹žˆ -ßå Ÿ¾…®ºpîòÅõè ïÏéÄd¸Q @ÞÆöAó´aåܹ+]ä†ÕÑ# խ샺N1ïDB˜ÏÄÞý°Ò—d7Ú³ØÓý˜÷¥Hù…˜›n ûèû“µ÷Ù ym]““¶1uMþ‡(%—f“wpÛW;N³Ðû¦tƒR¡ÇÏÖ\¼zð> –÷gp^ ×ß0[ã‘áó]–6åMÕSùÿé¡Âm=D>ˆÛ SÑC¤ƒ NœØºI)+/(ÍDëØ!¡ ¸1qáêì¥Q285ÄBP+H‘VË4–QÛéžê8gy±?ZýeL™b4HŽÑIåÛ+vƒY^Õ¼³ê‹g®¡,çµb;~j€ÉÖ˜èƒDBœÚv,÷xNÙzúÇÄO!ÄžIÂ|õÖò~ï,¢pZak–þH-}¬SÏßK“ºÿJ%jÓò"­˜×ò¸b°›Úƒç8Ý¦ÌÆ£\jÃ^dÊÁoå¯Y5ëPèhŸ—º1-7zK0š‡Â'Õd|ûñ¹’+dá”ø–ÅTÆÕûô&‚õ¡•µUuN7£{¨?ìþ”xiÝ(×ò”“è&û°¹î7`›#ìK„(qZ»®ô-R,ˆ0ý³¢ àÃÏ*)y1¥;?/.C쳺ó?ÊuÈ5ž5¾‡6ìP£ÁW„Gþ¡³á`›Zß:¶Úh‡Öˆ0/·I—ކO(ÎúQ7xãjÉk¯‡DŸøIliœ‰3%í£“)Eµ¼ Á¡NX*û˜©^AxXxLÙñ$YâÉ‚jtƒå÷9;žò‡#,„ù`ô &Éø}ŒjÁaK¯ìÉÃ3t‡¬üX+ø‚HÒ)4^­ÄëùAÉdqj`˜?IÑ áßZzÉ FÏ ŠBÍH;~¾q§åî¹_ ÂÇ;Uñ~ÂGþ}æYøõ©Þ±9ÁQ²Ô›±å>ÈEoXÀJ/=$q=ÑEÎ_üH¬ÅIÜK°¾þœ¸€ÿd°f—ÓlWGÊM„v®x<iŠ”Ô&‚Ò61”Žƒ8o‡ã¼¼´ùH tðFÔ÷†³kÊgВ͹«v² LÛ¹+Oä`&¸†í?‰¾‡­b¨†fo] [z¬ümbÑß[Ìßû÷)b#'Ù½ ¹JCÔùH\4X$¹AC‘®èÝ*V©D—ú¡º_ 'u‘œ J[˜m°5‹·uc)ØÃ45™ÕBmüuÕßdëêƒOvð0~^;ì»èèSVýQûüùÐ0‹à€F ø]œ~—F¤bQî&<¶€ ‰” Ѽl¿$ñüï¦ÿY(HÔÇ׊Ý/æw÷qúaô¾ÛßV÷]{Ù8êï×ÚIûÿu#ö|ìùßø"gä›”™°%fçbVCï¾úEåcÇ.}_Ñ€Øî¦ÐùaëW$ÊWà)3×ønÃN£ùÔw«÷a§%/ï_Òo-} @Åí§«K$ÒÖú˜\–G8N_uõõ'r"õBK×J©òiK +yÒ³>ÓŸTÿA¥\úø~Å™úÇ€ùœvlƒíæ{àéŸÉ4tÉ¥=åû*/\.¿XUmô‚È|EüGò¬¢ÔO‹Y&0­KÝ–nðä°§<ßvç×^ìЇJ¸ÞÅáL2áÞÐ΃>8ö‰ø¹’ R½¡·’<¢¿«;{ˆ¸yÞä?~bpàtÏUºsHÐBJÓl¸þSj7 Úî嘶/ðØÈ¸Íеò“%«‚Úæ#ªÓ>ЊëÈ©vW™’ÂŒ¤¤×š>?ó=êf_1¬þ«y(¬;*%=óΓÀvÁ*v~+¦òNˆ ˆY’KZŸCØô›ù5çC寧„ /A£œµXê½> stream xœe”kTT×Çïårï¹U2"ã€1fø"ŠJ1mc@ÅÚ‚""¨#2#P†@DòP¯:€ "Q«‚2„á+*âL[­iª¶ÖÔÆj\+ûÇžae­~èºßÎÚûî½û¿ÿ,ãìİ,;aE|Œ9Uoذ ÀdÐ9žfáX<Õ ÌÉÄ4ò~$—]8ÙŹz*ªuƒê‰:´® DzÑ;óW˜’3Ì qñ©šEË–-ÔĤhbŒš4crÚvCBJ¼^§I7™5Û34 ©)©f}L’f1Ö[ão0hÆòR4f}ŠÞ¼K¯óÖ¬0w$èôÆÔ„ƒ÷ÿ~jQãhðÿ^†QMÉæ”Ô´51»cƒuú„°òE> ³Ž aÖ3aÌ&œ‰`æ2Ì&f%ãͬb™ß0KãÆ(™I”ãÌì`.²ÓÙ,ö•Ó"§ƒNœ7WÄ=rös®ã>œ¿Ç?<´)ð;Ù†®èŸ»½W…‡ÒvÞd› µdWñðWt¥¼¹ôŒ,ÞiLð—HÊÎÚVÌo…6aÉ¡u8mß'Ú°4ÝJõÍh¤|@<7ó±÷Éw44²˜W௠zðÌö2H jì¸XEÍœI¼É¼·³a.ø¼} ^°xβ@*ŽP µ¯$Ä]è¿jëx€ÊöpHRàÄÔŸ÷n‰{æöS=”OˆIµÂ¡ö KV%KÐ…âÆõ²¾ß¿‡% ñ{=-jSÚö©+RZÉ,Úۃћ´·ð"^ùB![ÏQSÅÙ²Y|ÚµNC\B§ï:\’J‹.“mðÆû´P<<”¬î`µ +-YtòtþÔécÕ²U®Ë­2‹Ý P§•§•¦Éî“ î;¸Ý›§³¼›-(/“Ù´òð••°Ü>ìù%ÛàÇa ›T‘'7Ý$‹dB@ÐÒuWâ¿Ú!=ÖõæÉá¢Ö` O2•UîTç•ç>ã×/áöž¾‚:¦êo‡C}®K!Ö„“ò5ñrcƒ½¡¾0¯N]‘{üs¾_PÀEàMÿûZöpå¾Á>*Ò†äÈC‰—R2 /È­r÷ñþz±¥í:"‹köœ’à0xõ/p BgøÇðz¤ÀÿÎö™ sWÏÕº½ rYã`b?ÇB§Eóº»ä"¨-ìUOwCëµ2u¬·¡!áÕ[™>3Œ”ö¼ß™ Íî¼øX‚;H?ÈvüÐ΂3LášÜ¡Û.üº$³šÇM¨ºò^ o'ÝQh°¨:›mB™™kŠ(ÀÖücm§!¼ ¦ô°-0–ÃD^ßPå!°Mˆ(É¡r¨@0i³hÈä¥!¡ÉÕyMê~+ÔXªWÉâ 5q…”„ˆ~ó|£L¸¼7üϽ½ ×ԭκôﲏÅdmì9 ãÎR-œ“Ûð´v¶Ÿä*q¦j ºQ‰¦?_’Ëk!¢ EÿÔ/È”â¼ø|^9m(♉0 >í+ãÛIuå/!ãKʯ”ò×(Ôä‚'ø;{ ¦rXgS ¡¨¤ÍYÛdÑ{í¸€pkøaÙуŽKÓPMΩB*íëVëÕ[Ážd.a4d>™ù¯Y0sàVÍ¥Iñ#¢$‡:Øï‡q:¸qgÜ!Ý.—eÕðø íè~X~Ï^Dy™ÁE|4ÙÑê’Ü1Øå•÷KùRcDä“Ñ­d!ÖòçHU4,¬ÈáGQvÆo÷Qô¯(úfìü%Ìoi¬¥‡=Œ àð‡#ñEqe†#ÉTÅó§iÈRâùõ\pîêl¸vC ƒu‘%»šù9UÃzèÑh¯*q¯iU_ä]ºÿñ7‡ÿVwº(ÏJ‰×å?†µ=ðq­1 "ÁƒÃ{ÁUµ~GxF„,zßtH¦ŸäR¹L.Á󳯩{xzN' ȼïf܇k¯ÞSw(W‘0áÈóÖÎ~YìkÞæW,ï—‹%ü: CysÜþ³‰äPõdð‰Wm7$nÓ^Hj¹Ö|ÞÖšÔ¼URþ½œì¦b§­ŽÝr¸Ã «l(Ìa x%]çÝÜ»øöûÜ!®ôf½êvÚ½Üzª~oŸÑñ{×_–B®DTNE4›šäv±ÏÖò¨¹¡(¿F]™}r? ¾BP}PE0e8Ã{)á¢NGµë¤¶_ìiIŠû}5„ ѱŸŒ%ÇLꜪLpá— ¼6¾de¼Ÿƒ«Î ñþ—´—Çr'¶tõÔ²pÜ9x<ò+1ð‘¦×ÛËæ¢½³ ùMðŸN´ÀâÐŒe½Ã•,þ™Ã­ýß©À ó@üA†I"ˆ¾OÈâ¹p•_Ì9S[m]iE½T¨öh­¥FÿôE¤™H‘8â'ýï†Ðµ(c1¯È¬Æ{*ayu·EèŠñ ó_N„œ(endstream endobj 66 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 667 >> stream xœeKLÓ`€[ºGbÜaA·0jÄEã€^HJѲÖÑ=h»áPQ– !?މ¢l ¼Â€1Ñ0AãH 0ƒhðbÔ` ñ‚'o—z‰¯_ò%߇"’$EÑô<Éò«;s 'Úð f ¨°3IØ…·p=ÁKA*R%ÁľíK‡¦4HnC0½ÀyòlvKטxâPNÎA‚äÒJ8¬vGCs&ÊHÔÛØZ¢ÊEèhžãYŠ´…Vƒ–8Æ0Äo#XŠ£X'eÔy6k5m¤¬•¸Û¨Œ–œ{ª.P•Z£Ëðð:”Àd;~B8ꞃùO ~í[W>`0 ÞWŽÀ­ñ·¯>2À3úüSbºGÓL+aÁÃoïÀ¾`˜ÐŸ/²ž­P—6gƒl\Äã…KK£ ‹êWòÒò2Û%€Ÿ4L¯t·uß hpØ=Ø1ÔÙ‹Ž/cДà•b–EZ'ÿÚ´ÿGãÍb¯ÜPUrÓá—ƒquXniâ¼ ¯¹ÚøB÷¢šïh»ÛÞßñL¥€áf˜‚Ál Ê”æ:»Ùª‹„†"{ȬQ4ôN?ÔwÅÚe[VSä' G%tendstream endobj 67 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 5604 >> stream xœXX×öŸeavT,0ŽÍ 1¶Øbl±°DPÐ ŠE:ÈÒËÒAà.é½7 FV,‹š¸51‰IŒ$jL4¾øþg’Ëû¾ÿÝ]ZÞËË÷`ÙåÎÜ=÷´ßïœ3J_’H$FíìüÞž7ÇÁÝ#Ä×U®¹8Mœ('鉯IáñÈï¶ÈPŠ õÏLš$7GAæX°GI%'€Õ#ä^žÁóçÍ[0gy_jáaa=×ÂÖuŸO@X—…«ÿ~ Û¹vs-ìÂÈE/‹þnîž®¾,X8ºo·Øºe­Ã‹÷6mݼå͹ÿ®ÖÀš¢¨UVþÛ­V\¸V¾.(8$4Ì5|cÄ>»Èýî<<¼¶x;nõõ{sæ®Ù{æÌu™õöü -~gÉä¥ËV¬\5ƒ¢&S›¨¥ÔÔfj õ>5•r ¦Q[¨é”#µ•ÚF9QÛ)kj5‡ÚI­¡æR»¨µÔ:ê=j=eC- l©…Ôjµ˜²£ì©‘Ô(j5šZE¡ÆR–”µ›2¦Xj<ÅQ(Ê”2£¤”95‘zâ)A½K¼NéS1”()×{MÏYï¦Ô^Ú ?^¿À@jLKiWúŽl¹ì.ãÌü>ÂvÄË‘ëFIFíõ¡•aÓèê1fc.:öæ8ÛqõFŒÑF£WÆ+Œo°#ÙÕl[Ï^aŸ_<þ"Çq9¦LÈ3aLRMš:›¶˜M1s6k4ûÉ|¾y´«‘ê7•øz˜¤6=ƒMR1¹™CE)‡c³“3CP4£ÅJÓ„£ ¥/òGQ(Áî«2U `”œ—œb¿zTÆ¿¤ËkQsKòj~3€ÅtÍaÈׯ• /é²zÔ,à•°Ã¦ô'ð©ödèQ9ªŒVƒ£Ú„=!æ7s-rÅ»@4ýëöW¬wö çYu+*ÙÇ[ÓQr"® 'pËÐ ÐÅDºæ›‚ ¬¥Ù¦wž=_°‰ÇaûeÚ} š}s´ûíÉ¢BeÜvØìœÀΊü7ìLØ;bÑ!EóÁ4~ÊÁ‚ ªé|rUxƒŽ–#?ßT#¬ÁÓVÁ4ƒÊÔÒ,×Ý $·êQ‰PCƒ!Áf¸Ì „f«¢‚ˆuä:›úYj…¡`á1l3`SŸcòžÒ¿ç7ía:%!TÎ*ãÕ­Þ¥õP(,çz×e׫ŸC=ÌûXÊãPZ¡9¼• }ŠƒÃœ“N³Á`pµ÷¾ð6trn>63ù)à F4ûÅwÕvÞBþÛ¹óB³ <Íê×lí¬9?Y_¨$—ÔP§–ŠàËÑÜçXëÏ0ûÓlнŸž1¿.—›kgieewïÉ7nÜþìºí<žˆS‰y*É15\!ÂaׄₑŸôæ² 7ÄÌ[ôO˜ o~ÿÏÞ«÷,+2#3¢šÓŽª*d¥¨Î/"%>)…O;„ÒbäÞ{*·#sD sl‹7ù„ À<ìýA£1–«à-ÜÔ%Õq5X§™ŠÑÝÇÎÿåõ]ξ^<û¼)­ØýOùÔ×ø_óÉîtý8¡1 ùù'`…uf­µ]»ÒóÑiþŽŒ5¾rùüµ»—­òY%y †rbo\à`á"˜‰Íxì6 ½D¨îS„ ­ˆx0y°ˆÆ#ÞÇcI4g‰Šg4t“b†™uWëË"ûväHEñ;Å tªöòD‘îüÁ&·zâý©³1‹Ç= z7OvÔT Øg§L›¶µ$=`9]R§Áâ|qç°séR+Û[?<¾¥þêÞ‰U6:+ D.ZXš¨O¨wþ!¦wr½2ÝQ¡aü:\ !`"sCQíGPuÿ¤ÿ^”MÀ…f;!mŽBŽhbI<Õ’|Ø‹ï1„‘æ>…ßDfõÚró[…a¼sÔ U£ïLØyb”8Š«ŒýhÉö ù#2ö ­D¬GZö5îY6´‚â!Ôb©&ß§<½ò FóÊ ²°:ÄTW–6ôæ­yI^ªa1W*ƈÉÜ€ÂFC*¶õ)¼‡n®Öš(Nà “è¿ôÅ$r+s˜#aõ™ ÊURÑŒ8ôæª|²ß+4õÏz¯}ÈÔ·¶üôM±_`&¯ŒÌˆléǃZ ‡ CФ4ޥʅ“P/^êñÖ«ÈÇ ¡+ñ«´9pÀ{Þî-÷å|Jù¡‚@ÄhÂ%Ì”E!ys~©²£ïò8ŸÖH²y~ë7§ûQ~S%Ѹz>±}+så¨ÊÓ;=4’O·sˆFÌ*t®N€X"´/y@&ÃÒ…:ŽÕ°×#œJϺéqçî×÷êŒuÔÓêaî:õ:˜kÂF‹ù-\s RðÎð€ÖºùOÔîE³]o/‹õYÚZy¨‘ýçŽ|z–:èNgçáÆžÝí£¬BåïÐ¥u¨EcPY¨8R%©…`‡TL§è ‚G åF#%ø–À=ƒÆ¡0’ƒLÝLƒ ?)ôªDUȬÕ ‚6ÁSÓfxÈ1‡>‡³*I)ìz »¤b¶8•kB<–ÑAÚ Q!tÑ;ðYƒtúP}ÌÉØÎˆk©ž(žÄ-.$5iæ…1é´œ5èÒ•Î`. |½Šr÷fgFCfÇPf~¹ªî‘²8³šQÒÙNxDVbad9*D(³4«ú*ôš6Wé õùm•ñ5D솋¥ÄߤB¹Ægg&òà+»½õ[‡…rKݲ!…åEGŸâÀÐJ4¤8 ‡«ìÁØE%îR×üþ¬ƒ&¬ùËÀÕØ+æ@rD’¯Y:R‘P•T1’Lëþ:[h˜ŒÏŠG©™!$'FΰIþŽiÑé ÊÎ/X˺ˆr9Ï~|02"ÐõȾ®'À´ K€·Ä]CY«#Ÿ;jꕊ@Â5ú£ä¨ø´°$>9&|·b¯¾õãéF’ì«>D ‚Ò³BQ‹˜Úª²¦;o gl¹ OZ€ ŸNcŽüRÖç¥*(U_êÞÛýU7L"&l˜EâŠ|xQ!kÕä&»HF~ ¡ÊCŠ„ÀõØÙ4Ö#Á?ÙŸà þÔ(Lˉ¯•#b¶h=%°M­|ŸB棉'›­qÿ@g û©Nx RV°ç:vÌŠÉ .rÏNÊI,L*DE¨8/¯83ç;È)<Ï(ûi]ÿ`ÐÚ•t©¡“¤A@'wy¨Æ¹ãjÜ€®ªJe&*3;‚Âyü„öNLôöȽ2døî KOE‘f^Õ¨‚ÇÒÕ9¨•0p¼©ƒ?±`Ì Š9Á‚óiï&·Ò½„ã%³H9ØL<ÿìþ¨¡©‘gí=âßÏyx.¼Ã±í[œ—¬Z³évï³[7n]ïÚ⨣_tõó«0^eÌ÷÷‡;"15<‰Ù¾5!Y"Ë3Q8KWU  7ü‚'àQ³¦ã±ÛÇü: 80=õC¿&s¸‚.¾såâ-DOyþfÀ`D ´Qýó÷RÑF¼À]]Ž¢–¯Ú³ß6}¨0üŠ{¦ ¨*ÎÓ Æ Kû1§èûŸ¢fþPþþöÊšÒF8â*X]ºxÞ½êwÕ¸ér¸ÚA ëÕ—©ß¿lÂŽ£ÄÑ”« oÙ·3ÝkÏŽ¤ ¢<+öLœ³ÆrñÞ2ï’p•PqQ !~æÈ³XžKà3Îʽg¾è•=Œ‡ñ¯z¾ãY+ Ôqf{CL®kõÛˆYK'¢”˜’Ql1ÃNŽ‹+N¯Fæ(+£8ëpfÚÑà.Ä<¾óY¯ÀηDÍ M‘U…µYEÊœƒ5I‡SVSØ$àõXÊ9¸¸8mu=užgod_:~üÜ…voã˜s±Ü;}ºåÇÇËó[[+ùºÒ|t1½`€õç§6u$ÚIú_&$°ÿÏ*Ù§ø›ét]‘ñ÷j°Q»ª+I!ùI¬xµ’ž4~é|bÚÈtòü5”—PÃÇ6W) öÕ'ªNó‡ï>À#y¼vˆÂêúò¡ŒЏ¼ï“n¢µ0ìÕ¡(ÄÕÙ"¿ Ÿ2¿Æ¨#ˆ¹VûÉQÒ¯Â?¸ÎïÏãWƒ÷g4Ûûøøæ]ƒ¾û¼^X- ÷——Éíž<,ó p=¬;­›·Øyx²XÍ5†T„„T‡46VW7Ž1ÆçnتO©AP»ß0a}E_XÆ¡ëŹ;˜»²|Y¹©k¡{;:Åœí:}F–ÌñÍá3C ’+ÆS]ÿ–é—È»µo-t&Ø–Z®X¼þ¤Í7AȰ%Éß„-4wÚ»yEÀά†}¼káÒËÓËÒË}ú[9lªíåªsŠ[óùc~ª¨ë¤—c>{ÔÛ_„Ha;¨ñÆé^0}±–øÃ[ÔwáÄuº!´2ˆH˜Ð7‡F‘È=Ðó »/)äþ(6#:ƒ]ÊeƒËBƒC"ýy6áÝ_P'Lý ¯óìx¥øì/¤+¨Ÿª“_©˜2¬…ž¨£Lë!Ê<f} §a#‰Õ°^ZT€éŸfâÿT•äžâˆä2ñ¾†6£yÌ ›%ðSÚÂÆÉi›í¹ÿãái³Œ„´¥Y[»ÿ´ë9Ç~ÿÖ‹ß?†±<‘Š»Á›Ce±ùiJyÙ{mÅ@]1-Ì-ÊELjÚÇãq«3ꕟ &³|Ôæí¼ü•6<¦®)òÓP2 ‹‰ˆ/H.J@²S›c“b’Q˜Ù!䌇qŸ¥¦Û ³äÝÖ†Úò›Ò?I«çU^*o¹6De <ÄT•—hìZ¢úý C9‰aضþÎþý ˜=¬¶ØÐÞI >¿6È|sâð`3=0’Àn˜&…çuœjÿ‡.û‚ý|Ü›äm9¹ÊŒ\>ÚnwTì¡øÔˆÆD—D–µ¾¼züб âÔ‹®Üïúf3lý¯7ðìak›Á®joIDO‹vOËãÛt¬'òôlG…ܦ ÛQû0ÕŒ¤p¿‡ëð«÷q—ûúhl=Z×Ò¢­ŽË5R°éßJÑ=Œ!3Á‡ÄAþp™û©`‚õ°þtí³û—dp×ý`¶üºϰÅ#W®´…‘0¦©Ÿß½sëM<]g2œÑ¼úãÄ5É• dÖÍD ÉP]j§cóGu%mÊ:†ªCÇ2óÊ>ÊhGLNeN-‰FÄZ,‰Y)¤'£(€y[†¹Ö}òúWæ`8íƒG®Xºø@c\YUMYcaJQB._ròTËEÄ<øbÏ‚µ;ß·qp ¶OHLNA 3ÍÓ:žÍ†Ç4Ë $Dœ 2®ÃN•ññÞM½E½0R½¨à/ƒ5‡nï¾bÓÜýAã%t¹ký)–aõ»Öy×)*5'NÍä[ZnkF¸›g<œý¢=†>ò44‡CÑù3šüãOÒìáçg׿o¿eã¼}« N ÙÙ¹¤]ejÃ+åÁ!Ñ>ó~Æ‚ÉwŸô?¢TâkÄÃw»{º¥b"ìÒ9y%¼¢Û’ò¼ø:¥¤Ç„ápü‡iB J#ñÎOjá!SvÊþú!(Úu¿ÿA”u ‡å4Èá¥Î-*X¤’×}úËû—v9 ÅøCnÍ–%<ë°Ä¦[­º|íÇÇ—6ÚkÙík8%ñ:—yÊ+/…#ÿ¸L—"ìbªŒÎ m$¬]®,cðØû÷;t†,í5ÔÞ_sÛ„}E‚sƒƒd,UÏÆÒiKˆÛéGóAïܹ²Î|<·rÆ,”€<”¡¥YÙÙ9¨Œ©¨ ”‡Eúù”¯!¿)Éq#ØÉ¯ü‚sÜê°dÙ¶Oï~»û³ƒÃ,™ÖýùákÌuô 6C,êÿ'ã+úÅˢ窈ɋËÅÇÀÆÈ[AnQª0« /ŒJHMOPðøÞ—“ˆÂÍÙy8 bwÓâ„Ìt‚âҊ­#n= )síÈÈHÅBñmŠÿƒ.l#gë·{kèÿ:Ö›ÜëÐt'Ïéâýk« *J,ˆÏÅÁÝT‘ŸªL@LTxlp8¹Jªï1lƒÉ_\’V™àŠØÒüLe~1`_~ŽVm*V$Em¶r¨$)+¢ûv˜!ÐG/Ž‚æ?–äf‘±7/¥2ÐïŦ8:ùvûþ¼õ½-µˆ©Ï®ÌÆÄˆ« `eAV­©ÅÔw 0q´4G©ùÉ®ÌÊ14l¯ÊÈÊUV(_h;l8š¢þYQù‰endstream endobj 68 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 2708 >> stream xœ­V{PSw¾r{yØ­°ÙÛÞKÅV+uë®Úîvm}WQ¬µ !/HȋȋòÂ+ (j·‹(e”j«hßÝNÛÎÖ™ÝNÛý]öÚ™½WÜúß&™LîÉÉù}ç;_¾s9Xô"ŒÃá<´k÷nq¹ø—kפJóŽ–DbÉô#úÑEôcQÀH樹\ˆ‚øè‰Gã?I@î%Hø3´ë!,ŠÃyEX¾E\!—”KÏ®]»nÍöý9A¾\°9E°3¯ T,«*-ä•ìLÙ"HËØ`‰àIq¹ ¿°8ï¨P  2 ²2¶íËìØ·'koÆS)ÿƒê?—†-}©\\!©’VçÕ)ÜWr´ì©×=“ôü“ö8¶Û‹¥cX&–…íÇ6c¯b[±mØvl¶Û¥a±Øo±ßaaÑØ#X Æg`?Ê9Iœ’EœEЍ¸¨úèäè0·˜{â_?ÐF$Ú˜gcÔ1Wb»/.!.+®…¤»aæ»z¹ŒC·„y¡J¨$[é^îˆ*ªj@¤ ç­þ:¨ƒ‰/ol’âxÉoq_Âl~5ñ­ÇÍIJ¨ƒ™¯6è5 "Äýàc³üASÌb”Åc–âè tÕÒÄeÕÏ ÷g8ô¯f£è ôÏÚÔ[RaTÉ ¤ê`MQ5z“ÝÕî :º(gÏJ€óÄ•ÂSi¹r¡TŽ Ûª *kä"ÅQUh U68Ðâ9ȯoÆ„ÛR§Ó4Í:j3dTŒ|™OíÙ:þè&;?ìýrèràäȹ ºÜZQN«Ì£ôrƒjˆìÁ’ñ›'Ð2y)JœEúkQt3 ò~H~‘‰cb™å •2½ísD ÅhJ&w4óÎZ&zÓé“(úÄù`ªsßáHF2ƒž¹]©mý‹íÚŠNð¾Ê~{kö±DLJÏå4«!$bUem©j?ÔÏ·Ôì9I{Oû…‹Ó"1˜ÌlSóà-%·W—ƒˆE;…Vã^–æP¨©ü ôŠÅHÏ"ÕÇDÁ VK˜dã<»íÝvªõDÛxˆÖ.£Xf£’ÚÁJ–]Ó=ìÖ÷^è\ÿøÐè´ÃIsWµÞ Ñ„¨êTtw„Ý÷ðúûôòL-G+xðUrG¶3Ã%tÀ´:ÂþAß(¸ÀCЭll4ÕCQ2`pu½§'³GžfV­Í“¶VkÈ Ìoº¡>¦¿Ø…P§*-‘Õæ›ÊA ™Phii÷ŸðizË”ÅÚWV£G›Â¡·,á)òLpàp†˜Çsm¥É8èÈõ(Z{G”UÆ¹Ž¬ÉÎÍËBYcÙ¡Ùꥮ 6îÍyÒÅ,é/àa´Ìêfháw*=òòÆ ­™2«¸) Sú™æ8{-º ÝCº{þb“Jª' 2åžZ T&Ÿ{þÄ«¨×êe°òûdNµ¸QÜh&3/é¥EÌŠ_¢ :OA1”{œÐNL C)ù ¯&2½µÝg%ý—zC¬V½FclÐ×Q…ËYpˆØ8Y4=<Ü>xŒl“õIGáô=}î)° ( Vÿ§î¢Ô”éHc­2C„¬©ÇîlfŸÔÛÈse ¿KÑ^'Ó(´&²ô¸ÈʶÂ`Ë™U µú\úÕé³g\.ʦéÉ¿ÐsÚÙÞöL“`6¢Çï+ÕyŸÞD£ß,°UiT« dmúk¥E@”Öö ···÷R¬ƒ-nïóZ}¬„ÚõV¥Z«S€â¶ ÛNµ\¾tèDfA¡L*!+Â"—ˆå;N~„® Õí±RË¡0áI©¾©Á¬§3[Ôû«äÀW‚Úiôtyš»ÁJt)º$U⺃‡†\ë?ã ‘aሾÄyER >6‹D,øþ÷yþÚNE}£Þd$er‘˜YÄ’¸þ‰8ÿþË¿Qå¦ :¨"*ºÔÁ@ßñ󯽾…á1 Ì# •(:Jž.˜„As–1Ïv•âÝQ!.{Vµ{5õ“ÓBÐ9[³ìüˆŒÉçqeűŽá…ÌšùÉñÿ“[6ƒXŸAä,jœ½ÏkK'ƯÃ[­£þO†—!@\<0¾™YÂvŸÈ¬HïÊV’ã‡Æaô¿{¹y[×üš,ÃG>~÷i †{ê*©Ûû ‰"¯zÙlçìö'~Oý-²êt*5TéH]¹ºZ„Ölót4·y&)×ë-mà…É¢AsóG'ν W‰÷L¯"™] ùqÖ…UÜR\YÉF‚ŽÃÛîB~‰¸Ÿão{Vªê”:TìVÜt¾¾L¼ùÞðŸÔv:Š·{[êÓäü<›ý.þé±Ü¼»jyÿ뤞 Î>œø­^X‘#Y·· ´Œu#¥£Ëá9î PCê½ä;ÅÎÑÏŸ<|&F‘qŸÍ嵑½Œù»€èp7ÔiÚ&µ‘É7¨M ãï+>ÿí4Š"¹ô:^­·º¢Z"­õT‡ÁŽÁùáÑ:vreìØªîÀ4*#©¯‘m;Ìnêƒ-Ã6°X=Âéƒ÷ʉùù‚ùýÜzɨèùÛnTL~{w½vл€²¦Ó¬»„yàÑºëš =@'ô:»}ãSÝ—a‚˜Íåe +KÊIƒ¿öL&@™¬Neê«mÑC5d¦úfýR0k+ªSË ñØCû”‡ìý뛨úK z¬òj‘t“QEI·Grt÷ËQçˆÖPuÙf)ȉMÁÚoëqEð¦ÕÌùÙ{¥–Ž4z .ªÞ)¾(9u©œUpƒJ¥¶½jêFzðyØÌòL“Á,RjµÖyT.U×:‹2Ñd¤ÖÆ™¹$–Ú#ôž(ú諼yÒVàhã\­[P“ŠW³›¬±œÙúcÆÒ&ƒYúÈ]X;‰RogQw‹ÙZhl?mËj¶[l¬Ï—M].zg6ü˜ÄeÖÝKŬK:#&²»f®CÆ9K5?·’çWuÔÈëõò–ýÇ4­Úd‚z¾Ü[×åkuµ:HÚ:·Ëá²Ù¡Ïþ6Pƒ6\GÉ×Ñzç ÚEGy#Å !3ñ)”̽€»G`„ ÔSbüä÷v/XX½t(ý²ªF™ÖH¾Êð¹+ï÷Å\SÅÅ#à¦ÞÄ3™dn&®)¾h£p­T˜¢Ú¯îèut¸­ä9Äçþã§ÃŸáìšaï¤P*/Rhåmp·@KP*Z’€JQâ”øpâ,½ž^Ì’t— ‹K„åÝ’ðèpx”ÜÄ\äõÊ ÉÄ@éñá¢;GÆFgŠãcƽ–ÈÃjisÚâãß´XmÍìe‹Åïˆ_Œaÿ†»P¹endstream endobj 69 0 obj << /Filter /FlateDecode /Length 2091 >> stream xœÕZÛn7}×W,ò´J,šÃ;Ý&@šzb«h'Tyã*•%e%'.Ú~Fû½r/"Ù•µTÑ–×â™û™!—ï3J £î§þ=¾êQB­`Üp|È5“Òâe¤:+/{ï{àdõ¯ñUöŰw|jñ‘ D6|Û«À “Š0&E¦'ÆêlxÕ;Ïé$E1`ó³Å¨ìƒ Ö*–/‹þ€iƒÿPùw£U9¹é¿~í±-Q¨ ÷ØøYJ™ ¿í :4@ì½èÑìv­9Í 1¶«­ M…S;?ûu6_,'KҾÅÎ^¡µö %QBÉlˆ¦ ®¸@CÿD;E½Lþe±—“Åj2Ÿô\ãS«óËbV”£ieµûÚx>½¾š æå¤˜­Š‹úVä³ë«¢œŒ›&_¢ã¡óò«ÀjàDº°ÕB5„±ù³ùl¹*¯Ç«yY»dh3h´´AT9ò¿jk}t-æ­Å|°Ê9Ë›9+>¾Ê´žpäÌv!Í !¯ú[… ŒA«ìŽÒ*!¯ò‡­Ö:£úÛäÝGélxúÃóu€u¨Å5Š ú–ŒpŒ ÃÕ˜{X§D‹¢c.ì¶³kFËÀ-˜Mž…š>ØÍ Šï/o­¬¸ÀR©©FYŠ0γG|"£[.\J#5PÉò „ß÷¤DËL |"x&)—D²LQ÷Xde‘ý˜Í»¬ŠZ¬ø\Ð{‹Àǧ ²Ë¥Àˆ«y\À‰¸@ Ÿ.°D£ùµg)×"ûˆ²‚ZȾÚAÖ™ã!¤GêXyùÏšÌq õŸî Vd½0 E¢A¡šèH£jf=>nj@äçç§ãÅâ䤸YÌËÕë×»ñáF¼7…QN80χ£òjär¤‚$ÓÚ„î2‰³mRlGSB)''k÷VI­²àrñ©2¥w«º8'ŒÆª.ß—«7i= ˆ‘*ó*ïàPšH£H°˜êT¦ $£@¬ŠÔ>o"Y'¼Í_žÂ &4—Œ…"¯µ­å·P 0d@721K‘ðƒd–Ù;G¦írq6dflHÊ;¯,V×å¬KÜñ31èâ^WE(¥SÜA¢0î! +³ÔUVE(¥[•i—11àËÄ:kK¨ØÐ¹ÿ™2l œÙ¸Ÿÿ±“=wÃBbgĆç+á´žÕ©Ø¡m3®Tµä;#ŠÝöö®}ë÷}Ó^7kÆ•AÛfßÙÉìÒ¬oqæEìÓ„jï ôOǃj ·§AŸtÈJ-‰¥®˜¼I•{ 'ÛE©­L$êóA禋㔔:B§ Å/ª{üijõþÊâ\F!ö6tQ·ZÄÊ¥Ò•i·ˆ°yª)=I¥°Û\ñ8¿Lç>³‘ ~[70X5’šf(=™¦«mæhK¥«íïÝk;•°¶Ô$µ९휥¨í/ymض‹®MYBצ¬lÕ9³šÚ@“ñÄŠ²16ÐNû3·áÛHÛŠˆ·!8–EC]:¢ iΦã¡ïæÀ<ˆÚä¡ýÛÐQ®;gbCèÃN´Q—v€—Žãš:À¡ûLPxš¬›:¿%d{×vèݪ-e¨Ï“Õ"·œˆú¥CŠZ ñž¶CQéf‚5<ÐN°C Ï±v&Gõénjß…Ç;ZYÉÁ½ãÔ¸7b÷7‡a¶¶!óf}œô¸Ë -n„ q°ošÎ¡5Qíy@ê–kKŒ0•9OjsX}ÚÁ¢*ú*ÄÇ=­lJÀÍž—0Ë;ï!ü±+·ï&‘®ÍÉxˆÝiΰ†¦XxþÉ[´ºÊÚ¿ço×oÆÓÑrGîðoŠ¥µî(ǿ޵ÆîQ'« bGo–:X݆œ[¦:—>O¢¶ì.ûý6ÖxçùÑëu¢Ü]4os!М%¤–,|ÿÜ0€´üpË'þEþÆGÌ}Ç‘ñSg¾oÅ“$â¶ä1Eõë¾ÏkcºÆÛŒévW¤õвû ØÖ³¤½}¶Æ;˜ÏÇÑYË à”ì2r# fNë/£ 8SD­Ï¨à eȤ+4ÀÛ; ‰F­Ul"‘†I­:XÚÌd‘¥;é¶¡-yLÑp[ñšLÒ.A‰&Šm„ÀT+°;ua%†;Ĉ,¾3œŒa´&>¾IN íðß%qÛx®ñÒrnªØ6QìÆM/ váÙš¾#ë·DÔ…š›¨Ôíæ§Kïh#ºÆû¿tÑЊC±‘&è¢!ìÖ.z € ‘t·àý£dªØ6A¼¤÷¾ÃKµ¤æêá o. ³ðÊð*å•a0¨“»2ŒŠŽf—×ÓQÙÜÖÿë[ë.·†åàÖðî:Ä׆×gƒ˜>Žÿ÷n¯U½×¥â{xéÓKÅ«O.ÛLa5Sm½(—Ën;ë@UHÕ6%ñð›N?Êt%)ÿ=¤v­;¸rD#”@»8-méPó ÇM†-ª"šŸW«Åòäøx\öQ6å˜Y£)ý|QÎßã™——NjѸÏü<Ë]ÝÝݧ®ÄÑ&  õb2Îw> stream xœU}XTU¿Ìõ¦É8 3wý@@…ÌÌh5ELD$™ L3ÓÌ…—¡0à0 ÒÀð ‰!‚(ÒZHV¦Vºiº)»ºm=<Ï>íÒcí{ÇC¹ç Ö¿û×ùxÏûñû½GB¹8Q‰dî6MæÞ,S¬J·uÅF½V½…WiÅûaDxÆIðqFXÿ`#W*(\)äêŒ\]Zž™9àáXK¤„0-^" §ÍÒ«t¾[l)± ^;´×·•Ww)ì?XJÞ,=ˆ¼ø¼š†ÃÖº ›ò3–þ•þ Îs¤”^†Ea°p¾ìªÐf“çÙŠêQª,«²V_‚OÙxE£µ¡ÎuçöòMû:ëÂ^‰^ŠÑãy ̧m£Çì—óAËÌlK–¹@i>ˆÐ¦‚…žIo¦Y´Y»¸×·¡íˆkäºMíÙïœF£?·~zž‘Mç¡Coy£kÑრi$ì™òÜà¤ä͈I2ÚŽ÷¿R«´£m#Z‡þ¨Ý‘L¸XÊà§ï­!cuöÄepU`mæRŒIˆ‰áúF êò.%ŽË±>ÒSÝXokëh@½¨{½¾*Ïzíc¦fs 1s<„*ÂOßvð' g`Pè ]¹iùÅ Ó•²‰œð·ÒÞðFùÖ‚ÊVÑ•jÕ £^¤Êk¬5Œl¼Ü÷¶{£“otÆÛF::lmíŒìŸýí—>"—ê7tîëI=º1“³§Y ¿ž“@ŒXXgQkQSÞÑÕûQÒçksÍoè´ù ˆqƒc¤RïÀ |==ã¦G’˜ñlÀsÄ£›#hzúzÜ¿dö‚?¦Àw¾ìºC%TÈ+»¬G‘*ð2^°Þ”£ˆIÌØ€BÑ‹çR`–é3éÔïs»Í»½#"R=üÂá²#eGØ—.6— ÚeO>ñúû)W³ÿ…À ÷~üÅàpçuô9ºµóÃ%v,iñ”]_Ñdxç¤÷徿;¬‹;TZXZ¨xB¬@øu*æ)HÐf?þçà'þs›~3v¯Â-òÏ]k:ýñ‚“í|F~iAÉAeþ÷´°á«¡S—W_³9=¿$¯Ø¢Ü„ǧ¿ÀÊn·Ñë›øá•›ãŒ1;–sI=¯ H´ÛÉÈžµÝ!Õ}§À/€«D‡!9Ž¢ûa‹Ï¢Õ˜,‘´»J!’œ"¥0‹ÈÈE‹XÀW%à+Çd€úŠ©tã[…>;¬³'µÒ KfÝ?rÔÕ•¢þ:óóHendstream endobj 71 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 1428 >> stream xœ}“{LSWÇoi¹½ £V$à½5f‘ùXÔe:*SP'*V ´ÅöÛB[y´½çò)ky¿_…nNp>†ÉL65Nª›‘½ÌtK¦1n;×Üv .,fÙÉÉI¾'¿ç'¿ø </(!1QKj oŮޮUg{ÿ"˜0îÃ,ã6Œ±¿Œ÷| ¸Ž® †EoÀô@¸7áóx©9yïkóÌ:•Bi¬]·z5÷n’dš%Ûc$»eYÇ´Fý1•DFfKvÇ$ÆHöjܧJ©%%™r¥L#ÑæHÊI’“vH’ì:°/yRTÌkUÍKA‘:C¾Ïù«ø{ø7 ‚ Á´ïr8¼ˆéèöìð?™‘Î(fÍ„ˆÜŒ}L<¦¥M¸’è‹” ›’² &=.Šï¦¬MÙaq¨IkS((!úÚź•œ¦ræt\ƒŠzÏ Ð®1’6J¸ ýåöèäÅF] Ϊ4BÉYRç…:8+b®‚jÜ[Œœë-eŠ?qGÉ亴O¤¦â-B‘ÄemÊÂ%¨è=3iS¢þœ>ª¿ËºãP3I)¼Š€õ¨Ó›YC›‰•EE‹ÁW†H &ŠÓwš{z:ƒ8—ð”Nxxpå $ò™T"n]²lJoÄ©äÃå‹“í̇ÑBg?cA°Ñß TwV&¥7àïoÎ2補ķl!yG~ïÞÉÇsÑwz‘ÛQ)Çóc»4t®€·P—¥)ç’³Ï.VŠŠ.mÞVJî¢úúpèÎvú/È.¶¼{üÞØxCÇ.’êëÛ¨Ö°»hk=F̵ã7 y£€¨xDI[óË+óËqãÑ#ˆñŸš§18‚vw€ PøÁS6„ ˆŠ`ƒØÀçoÂ%0üâ¯=Ä!fO¡Ž¯®N~ &ÁT~ãzŒ ½¿àe³‘{ò!¯‹ôO¤¼œ2½åš`j«®ÌÜ\~º’€±+β1 D+ØPV¼¾°Är ˜±²zÝ`?”q9¼` ¯€ÙÅEÓ=¸ÿ€Ïd@µ´´WÖ´¤ôh¯,={¦¥t`µÀug}öT¿ðµSãÙÙ”¼ ¯^±fªÈ^, T_”o64YâÉ¡5‡NXŠ-ÀZ —pèsö·Œ–»Ýô¸·½øNÚWX@h—£Ã9;jp¦Àµ|øÇø¦ìci†.W)ÊsÕTº/’æ””U–TX3µÛ†ÿœ‚¾ø¼ã2>üþ¶ø“Ü>¥,O¥Ê&GÏ÷ŽŒx 6{`¯÷òàñ>“û‘xTS]гA5T?èÇ`¬tW¹¥®î–!Ð…ÁBúêÓÒ!€é©àæ« Ž®£ŠÝ Ôद8TUœFq“h9nÕ(úmMDõ¬²:cß5}tJ}ÞpÍúÀÚ_ ÁkùábY]‚çÓµ¶ r^Ôdò`ZOB­`Fn uVpkl£5@ƒ±\ÙÍj—!-—Ê•»Mò(’]j›­ §Ÿj{ùî[ ·‚AÐ<Ð:Ò2IwÌ5ð -Üñ(1>¦~“r{Eð_èX´€Ùñÿžuìâ;ªá¬,­F®u(&+ðâLuÑI«¥²¨˜0“ÓØÞùl ñù™}—[íÄt1pZëŒ-ì‚Pþ¿ÁP¸ø'gs}pböŠî\’•±KØÖbíèaüóm÷vl¸®ÛN,*md66µ¨Çfî/8¨ ð»ØYK{O]kí退;Õ4]Ï©¶º!`!‚ü á÷ïendstream endobj 72 0 obj << /Filter /FlateDecode /Length 2874 >> stream xœÍ\mo¹þ®_±È§U.bøþâ6´¹´@›8Çm°ƒƒÏV–ì“䋃¶?£ý½î.WCÅöÙæÐ¨ýAky÷™ápÞHÎìÏ g¢áñwø<‚y¥™69©g09ެήŸ• "8¦}ŽüÁn+¸™YÅ}ÌÙ—ܳ 3‡íwg‹!*rվ æ£fWjÅv&÷¤$sÐqsûÔÆÛ’?~8¯`ònGä‰ü1iÁ-”b6"rJoKÄb-“úVe)“ äðî)dâÓŠP&>0awTeJlB ‡Êì˜ÐÕåùÅɺÙ¡çQÚ2½3¼goK<޲ BjU3ºKøŸ²ðëÁÝHo# $ãy1ñÛ‘9a!5S«‚/3^©<@Ÿœæ¬G¶*œö-ƒVÅëÔ:œJË„’dÓ/ã*¡Îô÷1WRMeëpÚ…AB¡ÆÐÇUV»èD'TÈÍ}¨Âiâ脪`¡çEVe`Ò):Va êr#%Ï RH4ày\¨Ç˜xV!&"$Aã‘GE Ϋ¤›ý>lN©$ÝLñãQ`Œ-ëHeˆÍTRéwŽëH%EgŒ­ë,M$gšJeþU¤2$[Ô‘J·´'”ÊgT‘J·àαU© 9™Tœ€ed%© ùM}¿Ò/î ¥2¤O5¤¢8Äsù~%¥VTRQB2îU©HÅŒ~ JY™TTÜ̬¤+Ý.Œz ]1’‰@(H ÃŽ–×Kn£ùß'·—5’Û-šäáÑ'·¼rr‹(‘$·<¹EØu˘ÜIeLn+HeLnv¥}÷”ÜRI%%·5¤’’[„íJ Ç<îQ1œrZ„6Ï2ÿ4=šv•2ž”›T( ºB²kcárÅÎ…;ºð±Hª MÇdôV[àtO7¯ûqLC:Ë7.ý•5=˜ã®¬Gø ׾dŽŽ×T2‡ðb¹Õñj=OåV¾íÏ«·_|Øžœ¯×u±zß#²±ÒŸ3“IÕïÝRiS2 „]²y;jÂ{ñžˆY/™Û­³EMCõdT¹€” r‚L²©ä¬ ¯)õDØ%‡M£Æ P_Ga·Ð’B_G¸Ã¨¯3àŽãz±BùB4ãQ¾[¦Ëô6éÖL’š!VK8MšµÃ)V'ìež\I¸ÿKôyÔ„GçÕº ¦2ð"‘'§†ðÈ´#¥7˜×"MNêVƒÙ¤{D‚M^MÃŒ™:aAk}ÝÂÕñj½¢!¦‹ôvpjŽL†½Ìi‘ÖšµËê®W3U¼švfÜæ¢Èü1¹WÃà%.xT6„GªalŠT­ ¯F0«wxÅ;oÉȯÖܯ¶ÝGû{s?†¤ï><ôô¾âÄã)M¼ÝÊK¦B3Ó(µmfR€[•bÔ¡~êæ«Pž;æÍ¤yó÷ÅñóîÛg#÷ÃD’Ëí+Š[¥iå69ƒ,Ç8CXÜÇСzH¬ä*Ä ¬ÍÔø;:jnb§£nt}W ê~Õò^5w©Öý*Áµ‰z×Y»û5î([݇„zí¯˜ Iÿ+¤m€ÅÈ ó€|U§"i­;•©–l*‡&X„÷t]°Ñ'lƒ•0.îû- ²6X Z¯ S!iƒÅ€ƒ¡sžì¢hƒÅxuÚ`3Žk·Á ð©"Þ>¬ \1Öí»!„–Is׫+n}b'hooÚ`E=Ô÷{eÅðìbüT!J¯9ŸDÑ1-nø&=u^Ð++¬cºÝt'”¢Wã!ý%ì”í]rytÊv;â2C-*véhŽGWì2´õbð¢ýn5Ç#+Aéö2rlE•PaPª²‚~o.gØǤMè‹ ¼aÁp_©ª@Å‚Vt¶ð>U¶mDŠÐ¶*‰m#> stream xœÝ[[o¹~ׯä‰ÊZ4ï·Y Éf ´i춨ÒÄUª[Fr’E»?cû{÷3£!µ’¢h8.ZøÁãñðžï\yH~Ȧq?Õïñ¼÷¡'•ÀZfŠX†Í$áK–Q&&,+òìÇlÑ#Øjßd÷_Ð{×û¡wù†Ñì~í0̤p€1ƒ‚`IÝã~W¶†k‘}^ ˆZšý©æ¥¹0Xñl¾Ë|/ÁLïySšõ®a>fþ¡G½øYõk<Ï^ a¦ÔÂl©`Ùð]¯Ä3XS%2Í6VfÃyÝô‡ï{¯†žžÃÑP"…Ί¯¥ R¡dD›´¿–ždµR!½tq×Hxa­@Ø=JÐÏ—Ÿ(Æ|åãÝðϽ¥Œ„eʱ” Ûá¤Ì€ çÖcÆS`ÖÐë 3‡N¨U˜ñhʈŠ0j1•1¦ØÑPE°€7¥*¦.T©¬ÆÚp϶µ*zçª2•¦„ÀJéHBF[ˆH•ÆÒèXÄ“ý’ c;uKefÌxIe ]6ô¸e*µ*ŠŒ&‡˜i£V ¤õŽ´ÇuÉ ÍÊÚ1á¡e‚”f^>•B™ ½´16•^µÅDDóD¼3B±Ý|2ÇLØŽ=SjL©öBéÊlèý¯$ÌѦЪfHp_„O:Q%Ø‹„*×±mv¶ªlè=F½˜H« ,FCØpÔ¥¾âÒM©Òn3×­êzÿ·¥¾¢ ‹2JÚ`&±%³-½ÿdåÜ1±‚q(àæš¹ü ÂÈ/Àd3 KYÍxdµÛÜÂÊBH"UZ n[w ŒJ¦g¡áüpëîðߺkZvð!DN޴쬒˜ŸÔ²;Â÷ã@‹>7ÀKIˆ5ð@(ñOGâ À#éÀÊUÅöåeßonÞŒW«««üójYlîîN †Çk´ˆ*+ÀQ15é©N{ š™àá˜Hœíãb(Ä{ r¹ºj‘-‡Ì£lHÐ…Š·Akœ š?Ì64óUaêÕU(Ì-J°jîVŒhçÛétP/ŽèÀ¢ç‰ÁgÊÑ¥¸h#„v5”ì{(`¸–é°çðÎð/`ÿ"1ö*'¥w˜B(ëIjÑ¿B†”AÆp…!³‚)dÖæ1P„Á¢#*‚€« Tpv'ÞŠnP¡ëÚ¨*àÜ‚w„ §˜ªÇÈÍÊ[c¢å­b¡" ,)`½nÒ¡Õ­¡ºÛ,´]ȹævÙÞüü,ôTÂ’Ó™IC;:ñzVR«o«DŸ¦šou)œoëéVý¸€æUªéV¹€t›Ûe.’>µ­UßM穬­<ˆQmµÇÜÕÓØ"Riq€’&ÓÞ¶ãÐ+Ï«¨Ö\wîV¥kèqx¨ŽO'ièô&÷÷ÁþVÊ–^½‰²KÐÒc  ±{hâŒK’UÀ ˆÞ:ljýUþN‡<~˜¸µéôÐ[ËIGê%ÂOЏ¥Po¹ãRÝž.m£àòL@ö¦ÔppæÚûBuÚº¼úªv®e¥S9ÑJªÛ¸ßnï‰T›Â-Ym®ar:+¨LYºBÇv|sÐrXQU·—Û\^®ï,…ôî͵>(Ò¶PŸÞ’þÊ Äê¶9ª+72¼r³ùº+76S°!ÚÆý 0oáÚngU4PàÑ‚a5ê¶þÿb õ¤Û»p %Œ8 -ß7 ¨Iæá$nÐ?6›Õúêòr\ô7áԢуþÀPgŸïóñ/‹ûËÕhÜg>.1ôÏÑ}þÌüx^ôÝÝ«©FóÑd:›-Oô’½ÊêÓñ ÿ6½p[”¸HtϦû>0X 3]ö)x(}ì·qiº(/Z¼šLòÙßûÔ©‘Hôo6ù¬ÞìÔ0vR‘•ý¥Ï½¶ Z>4üÐû ›1Ûendstream endobj 74 0 obj << /Filter /FlateDecode /Length 2071 >> stream xœµZÛnǾçS,|5LÄñœj uœmR Û  ƒ!בT–”c#éc´ÏÛoöÄYF¢)Î¼à’Øùχofþ_2FyÆÂ§þž-,»ü2àå¿Yý5[f^^I–9êç*¿TKx¦9µÒëÌ I·Ùx9 ןVëûÍbC‡ãŸ±s¢ÊZ[.ÔÔ(+³‘àÔx—çƒ ùïp¤£Þ9òM¾™‹ûíb½ºŽ¤Å¿Þ’m±˜®nî¦Åp$¬Ã›–¬–y±˜ÕxG6÷Ób“7¿ YN±ìcó›“ŪY,Áû»|þð”1GÞ¯‹%¾ÿmÀ%ÕZûlüÝ`üE)›rž¼^¯6Ûâa¶]å[ÐKÇz G…pz1ª¥A1ò¿Ú>¼é¹¥7Á€¥î«ü×òb¾_Šûâ"ØBA`B)½>ÊlÔеÂÉm¶žç¿U†ªøÝ/ZŽ*²ó«ñÕ?ßìd¹]|È_Wë^}ûõw×ov’uÜ;’°¯PvPT Ùú·²a^ÌàØÔWiº‰t@½Ø)Q›ôH+òÓYîÜ×òêæËHÃDGb¯ yýå—eLÂ4ó¹ ±¨©ñÍxðÒQsO³™òRS¦2Íð­ef£’ˬȳg«„µÊ0þüŠÁ{~y%xv»)YX² ,x2Z¥©d¼a”•Ve¿‚™Qϳ¿ÃìÌ@Ï0­,ÊÔŒ!ó¡+gåSñtÕAÅnhªŽ¢Br“éðàT¨:òòå.Ž'“«Ùýýåeþñ~]lß¾ÝÙóP‰Ûóù>3(d…+KÜ´XNCœT$©ãj:ááJR<ÆÅZÊ5.——;ÏÛ9j8·1Á Jä;TÅÆNŽÌÓÛwëU¾‰ Ô‡6Ü1*<ïhsC´áÎP&ÎìÁ›ª?ä³bü <ù±gÓ c¨P]ž(Jà‡ôäžü–’ ÝÛ øA \Ñщ~ì98U…:fAœÐ&VD/„}¿R£’Qfy‡Ë ìž"9²— Ó¥Yæj¿’#P¸û£äŠØp.'³Ó eZx¸÷lnm¡å^åX‘oŠUŠ¡˜¶C´ç¨äœ£©uå.-4Òh]öŸ£T9Œ§Qd•¾WneLƒ>AĶ˜s-á¸8áé%NØáVÛâ¼èÂïcðÁ&×%“Sz² ,ÁW‘ÙÙa?AÔS`<Û!úUJå©+YL@1 Ì“ Ñã̼¢R!–bf¥š¤ û˜*6,)¹ œo;cŠ12fDh—%{8æK›ªø„—Š*Ýe!õ%¼¥Êu)_D:XãµÄËÔHæ‚2ϾÂ"]_¥úSCÉc¢³€#9uæig†×šêû|Y¥E t‰Ëa•¤{¡|Ñ—¨ÊS¶i6ETб{ñu3ì;ÂPŸ¼í2Y¼êË"ÎS¾,9zQäÜ^D\ö$°€3Ýèà ”Ì ¨ŸµBH4eÇ»,~îËR„Fÿtòä?N˜8ÿÂ~Gv)T†*s^:ú½VøÍb™\ä%öÊzÏwÓ ]¬¶ùm^$ØD¡‚:{¸Ü?_\…âizkIJk*å™Z‚²½ P)Âb¯nýYZ’²›´EÅDèý–>å.H pZ½2¦Üõ‡È«. Ânè«ú,Cç–LPËÏ67²ù´\æÛÝ”ˆç1"mläø©‡zld“26rüÀÃ#ngàμˆã§Œœ>1bìéã­ÏÑ #›ç Œ(ûü§µN·7.†)jµ;pôôн‹ § ^¶A C-4?æ"蓳 Šp)QÏž7(rÒ­çaøÇa‚ ZyÔºÚ¦n›«í˜ì¶˜Îòwç¹üŒù¤MsÔ -&Øÿ8Gs³sIšç€±Ñ„bzœ¨é{œ£ºjêòlÇ9Dgšã ×ô ú¶õvM=ƒ×ë Æ˜Kš×›0Š–YÖ³ÜÕ_v¸¤å˜E1z}ÏDÔC^‘«¹‘€ Ç4NÙÇ`„¶Í^ñ3ƒ0 Ú å†Y_j,šÖ(4Ëj¤ñÅE bÃ]¹Îï†e“öšLWë!p'““CWÓn^G²¿™Ï󻟆ÈMŽFòí6¿kd ëçõ»†“¿eÐÎ’õÀVZRCB÷ù: 5‡›->ç‹»»uMCYò¯Åí*Ž8—”Èïµn>VMiTT×âo󟊇0,ÍÃù…täS#ˆ%ܵp"˜ÐÚ [ æBó-=÷{…q:,ðI¸«ÞЭoün²À¸endstream endobj 75 0 obj << /Filter /FlateDecode /Length 2587 >> stream xœ½\Yo#Ç~ç¯èih‹­¾%k Y/ $ŽK4b@Z 9ËpÃk‡”w'?Ãþ½®î9Ø=iJÝ#cÎWÕÕuWq?d‘ Û?õÏéjða $GJdRb„Éfð“fŠc$¸ÊÊ"ûg¶`d—Ødó?~aðnðíàꆒl¾s(¢‚ÛÂöûI/À{Œ482š)ž}Z@ ɾ:ƒÖ-ÐÂÀÕ‡qGËêÓUö×1pA 5 Ë4_?¬ 0ÒúcF·©Tõw™¯¼Wdóõ`ü™ãk“¿Þ¬wûòaºß”îSÀ¿ðù§¬ h³±M@~­O^»5iåθ.>ÞÛøVKýâ²Iðr„˜JM,ÖˆÛPŽ€´ÒŠñV\«E99¥ås²»Ï?k˜I_ÜTB¬Ù>p5(•?‹ˆ¨C*T½„p¡ÝHN*œ×ŸîîÄ2³7æ„Í=ínûfœ`°ݶ¦$¶õñ¾Ùñ\ßìÐ/ƒ‚múe€‚ÓçôËNи}~зp¢•ÆábXå®®äùÝÝÍt»½¾.>m7åþíÛ˜øÐ³= V§©åjâ9¾Ú£ÂÑ$œIsŒžr®>•ëëˆHPåì&Üm1†(YÝ}x˜”‡“Ê„(y‘ -¢'sný,—=_eÓ)Kv•M=àÞ5wÙVÙß{:žä®3Ó! .­J¼ˆÉö  ¾ÏF~j0ø›ÇRCÍÉÈÿ8]—Á€r1¨ÏuU——Åþ¡\ÇÜ{âù éï½µ JÔ½7]g°2´ÔvV›…G'ÎÎ4ø~~Ÿ˜g*†EÈóðOU!Ï”îÉÿ?ë<§³Df¬-T¦pSeeó3"63ëÃ0‰P däñˆ}ü…NĆ Ä›ØÎŸæçDì4nçDIÈäÁW%žnù )>¤kýv&|béZ>*¤æ1ÆêÜVˆè[ÊÖ„­XHÊ+)¢¦IUÌõ‘÷º›™’Oâý«è±Z=XòQ£Æj ÎHŽß¦ýXô¤Ê÷ÏÉNϰ|J_GÍĪVêýˆ“J=ó±i?R©§eɤ"mîxÔjâ¤ROß|lÒTê¹\2©hŠˆîIWê9ŸÍú‘J=L&cS¡Tz›'úD¶Ñ>–QÈÓh:Ë b*Ñ“eÌ ÞѾ~|,ãQ’NC eB†÷ãM¤à²£}ýøX‰5Ç ¥RÏ®{‘Š‚\_ªð& JDaJECÕB{’Ší¿ˆTŒ„B3T8¦PÃõ#Ž5‚,(Àæ½H…C¢l:¶%bÂ=Gž¶4¶–ŽÈ§èÈSí¨5&òT³Ý/Yä!’ -BÄì ©Ð!³©´¹i ûØ1sÓ¦Ö ¯®ÊÆðêZ_=ɵÞM%ת.ï(ljÛ¥v&B"_.Vñµ¹+BCܲØF¯;öd¿m5ç÷ãáÛÚΣU[¸ ®n«¹DÖ×VpF×»"”ÂýbÒÓ ŒMØ!ݘföµSwìÌü¦:W‚khûö7/DW9Ÿ½èâã}JÄk3‹MÅk3Šõðº[²ºùŽBû÷Í»Ã8{ºœìvþ¸-]K¶í?zg½˜Í_Ç·dÛÇIÎrêµ);ÅÚ”w™loJ!&;‚01êÔ <<”*þדÒT‚mVrÇëH‚QPÃÂ!]jý ¶Ô:Úé7úááÝYi-uvÜŸÍys¹>ç1¾§¹Ð€sÔÆŽŠïèç2Ôìwõøó/ã€×½ŒÃñûÍÙ.üILû]뤲*…SE;ïœ#'ÒÉÆˆýÓø­üô{ŸvŠeš«¥Hû{Ÿû”{Ÿö[h ë'ï}ò3?ÑÉzþ°œ”Íî§J¶ûiuöEw?÷§w?®9ÙÚ§$‹´>`O‹´>‰Ë‡S»|/µÃ©ÿéˆd,»ùA(‚ÄN i³šÑ¬+K‰ˆìßç­+›Ì¾Ší×|/‰´ávóÀZQEKÖY> ^€ÒS{Kñ~2„˜±­E[ÉqÉí>ñ ¡²Ç¸€”Z+æ3q—ÿ{¿ß®¦åhcÎo²Fåh8Ò$ß–›÷Åt6åüj;™©ËŠiþŸÉ¼xesØ¿Ø "¼" Š¡Ùb¹Üœ™Ì>Ê ·(;›õ9üfqiËTD~[,?Ý÷ºŒN7C¨1ã&ÿq¨mábh~YU3of³bù¯!±5*ùC±ßËfC\Á»³V˜üïCæJYoøvðkéendstream endobj 76 0 obj << /Filter /FlateDecode /Length 2401 >> stream xœÍZ[oÇ~ç¯Xèi™˜ã¹_Ô&@«$Ú¤@,¡ @C® ")“T,£É¯èå÷ö›½qv­e)î¬ÑøA$³û3ç~æœ÷ %,¡þ_ùw¾½)戵&1Ü2âD¢¨PDá¯&†Q—l³äïÉzD‰3RãûÛÞ½ý8zþ‚³äí.'aˆp /G¤Ä ’Å姦¢ ‰³ÂÈähi`:–üé@K‹_“Õ'ÔoG ÿÉû¥|ëvt †(x?b¹’òÏ|•üñ¬ šXb)c2¹y3*Ä19ã lr³MÓã 7–P*Ó«Í"Ã7Š/ЧdüêæÏ£oo@é Ue 'RÕ2bL ÂIµû\ªi*«qº–&´„Ÿ&Î#D®s"K‰9üB“¼!%I¸`:ÑÖÁ¹¤tó®E°í}¨?3 ЯЧâF$gª·Øl¥©’Î!¥Îâe4ÿôdæ$B”Bb¿Ÿô ƒ*Á¨ëìC¡0n‰—†ˆ/Ó@&P¢PÎy3õ2qκ3˜×$uü0Ûo—}á ‘¶‰ü,8ƒÑN ¶5)}ßG,Z.;¥ŸTcœù,R1†˜x2±‚HÑ2•qdoó¦=”þÃ\ÿ\ÕÒlՉȄða£éíª³(ŒƬ…ℹ&6ë›Ë„2ĵ2Ïe,†µ@ÅÓé‡O.ê,aùÀþa5Q¦•bîb:ˆ¤(¾]<‘L~¤xè¥C‰ªÚµtH‰¥’k¢[ÚíM¥@e͆qE‰v†ÉnË>Ï.PxX3Œ+JT!š6±E᢯C§*‰ÞHµ ûÝW½Å 4Ã"ºŸC‹+r?Ea¦ÓýΓ€¢š8:Œ¡)Æ¡ñî$õt8ëÅâíUÿ»žZãDî4–-Uq¦Fî“>jKªÑž½ŠÄ¨åÄZ&ÐStŽU8dõ§ð·Á±8G”j‘Ø}bM-ôÞÔ˽6yÒê¡Îæ¼¾ßÄ9Ø ÖGÝÄŠèÌî+™H¼ÖAÑÁ#: bvŸv¡¶ˆ/¾#À?‹+*XŸrÁ‡Ø12i€7°+†œÇpÅ/¶+vðЦ@r‘WþÂp•çbmÕÿ å´Øx^<6¸Tš^Ù&'ŽŒ'ÒA×V¦‹]9{!§åñ ©»þ¸ÞÜí–»\l…*‘ƘüEX†4"™ I_o K˜¦ÿö–Y›~“íæÛåÝ~¹Y_Ž'ÂàWgÒÝÇÕ*·óbúê,Jÿ͇Éf»ÌÖûláuð0ž®ïWÙá1Ôg»œÍ«›6ä½f·iD)eò.Ðú.°ÔïÕ—_æ8ed.åÅ–@1›ÖT£ì‘‘y÷­‘¹È_Õ#sÀÀ|íI#ó#D®ÏŸÃm„záG›º\§Óó»»ËËìán³Ý¿z#¯ òàÿ‰Ü…gÛÕ,LeÀÃÑ4΄ÇŽ„Vº³ÿá *—— pw÷îÝ{Î^NÅÈË·ë×q%ÂŒÒ4É4.ðÎëÝÙÀŠD$A §Çb|âM+=–æîÒŸÂ>5ÂÊY{ƒ&Z=lùGHïœë¸ÇÉæU]ãƒDq²Íö÷Ûuï‚…5@Ðzå•~j—>)5½“Ef»r‰€JOó÷Y ¼Ÿ"³lAu“ãñïòV†¼)xuÃZ&ôßN:ÍñêMáOuÆ~Zªë¬hѱc¹ºó…VªÆsèWMªñ.aZž”ª»iœ¿Ü&óUyÜå¶4Ær[ˆ‡RmØå¶X¼å¶5Îr[ˆ8ðr[H*¨•#,·…È-·$†Zn Oc¹­Kµþ±ÞËm!ø°Ëm!¥ËmÆÒO*årÛgJ¾ÜM&år[ÃTZnkxÐ Ëm±¨Zn;æ@çoµ…¨“HöWm¸…Ø}®†…Ôh­‡ñ•jc.Äî3Mª–况a£c­4ð.ª;”•"žK*pð²@µ-סØ hå]¬ˆW­Î aÙÕ²ÜgJ¹FM*åêÜ >T­§5|èÈçùz@‡Æ[:%ýuHK¹ÑËí·Žòáìí·¦:‹=$ɧõ’Š»‡c†>ÙC*îûl!¡„ ÈȾßBÚ½ˆ¾-Ã->èþ*¨f|!^ìm™X¼V—ÅÞÿݶLxÖ¸Û2\yq20 cìËàŠq1¸£ŸÌŠÏèÏ+ç:p«.­æÅ‘Q« ³ré,À޼övÅùk!j,ea =õ‹ŒJçǰá~ÆÓxªÆã â‹·L¦ÒåzqÏlmŒOÆ›gñà5{('îÌ~:P÷)·Ç@½5¨n2üÈ@ýŸµìþõ¬Ú0&iëO9´Ž6S/‹‹Sgê_Ô“t›^Ô\Ç¥ƒ ‘hÂ45.g—hã4 PM[ãDñ×e.(ã/tÒëìvùË8çÊ©t¶ÞŒaTp—þ2¶%xõ8’â·‹Evûó˜Á_ŒUé}¶ßg·ÕÈÀ¿¿(ŸÕ,ýËXø]hcsÙ*©Ñ©Ÿ\ÿa‹§üe°ŸÅòövSbH“þ µ”‡…Θ`@J-ç³ID\o5¥€¿Ë~ÞÞ϶ޙÁ¾°éÇŠ“2[Ÿ€¥œrõ¨°©õwã¹R-”Ú =ëJ’©©£Ò£ÿ½cd¹endstream endobj 77 0 obj << /Filter /FlateDecode /Length 2718 >> stream xœÍ\ÛnÉ}çW ô4ôš­¾_”x¯w YX[@$#`HZ¡#‰\’Z{‘ä3’ïMõpš¬æŠ´Ä©&b?˜sNU®îªî>ÖÏg¢âñwûçè®÷sÏXÍœ©¬Ó‚)_® 3²²<>öÕbRý¥ºïqœ¶ó|ç%¤¶–™‰«zºí!_áÝìQc+•eJçAŒº¢%ãnÿÈvZ ¥^÷Ò\ Æé¢÷X2°¦ìdÍ]h1Éý¹Ò•v—wV`sá$!+Í~²+^2áó\áeXñž²M´Õ…XiöÖ9+ª+Š&8+ëM|V8cOŠ„S dEÂ.pgF^÷‰«Ò6µ;UèeRÖ3¡èªr°ÝP²*¤\€¶$wV–Éo˜"\oaθqeæP°ÌùS°¢¹d†p½ÕÜ3è,а¢¡ ;ë­.ÊÌíôFXÉ­U!V`3'ì)j³†öÖBV ½µ²+ÚÃð$¬͸÷t¬@wë…+[…69®›µ=ùòŠêè%• pÁsðÇ"õ•ÇÖ1ãw<îì0ÔM%r‡ÉN·Ú›@Œm:_æP§Ô4¹“rßO晴n}'˜Ãë®C¸>0sE†P*`SÐ áæðá¥Ã=ç`¡-u¸g R¢U |Ûv²ò±;ð#Ž´×WY™‰ëxÒÿ²½lô>Bœy×|ô¨¤Û”9ãvw/Ï?±Œ7ˆÖfx_ˆ2(i0v— JÒ„¯v‡‹åd+mXõmÿ>û¸•‡Œn‡Ë%¾‰¥;yLG×8Ö³ñÍ›î'›‡ªeõúúñŠh„6Sa ŠlÚâ]Õ/?ôà¯Ùfî1ªéN«qŠw)4íauÁ®ã¼ùàÓ‚%š‹|P”ƒÆ-üæ*ëèAÙâíx¢Ì”üaºL[.󵚉[r_JÜš=¸Uzp^jZu+-$oÅ&(ô­¯À›(¬p•ÍÙº?BáêcK*ÃVLª!ïµØß(ìa§Q€ý;zÛ(Àaþ†§4 l¯p•81’VáŠA)¤noþ¶Ò­)û¹ïJ·¸ät¸¶3î^Dáf+›Å¨]®ËÓ Ç!/;ÈpÛ•w9»H*YŒGu—®0v—Ãk V_ÛË%ŒÝå .](ñµ½WÂØ”Í©ñÆ Û/¤mn/°­ÍÞ·“Rr-fÌcX_~x/Ý}XE{÷!aꃡ[í^qa36F'lƨ4ÂfŒXXØŒMÑ ›1r!a32QHØŒƒ 6ïÙNëãf-@àe…ÍØ…°yO®tc%íðË³Ò ›ÉXi…ÍEXi…Í»¬°™Œ•VØ\„•VØŒ±Ë ›©XIÂæ¬$aó Xi…Íd¬´Âæl¹-%lΪPa3UJÂæ"U( ›1xYa3Y¶´Âæ"s¨6—g% ›©XIÂæ¬$a3Æ.+l&c¥6a¥6—¯ÍIØLÆJ+l.ÂJ+l>+­°™Œ•VØ\´ ¥œðoºŒ®aÓÉš(µªûK%jF˜ÔšfM!iFp…ÍÈBA3B'Ó3½$g&½tâ€à3 Ú½ˆ®¼.)fÎL\×ó·‰R(£eŽ?ÆËÐù 8©ý0µ–cSh™Þÿ–ÇJ«e†]|pE´Ì›BËŒðN£eÆh™³2=écbæ2Š^!4ËÝ/7£²Å{–˜y'ö“¨™Ìrºÿ«ðž;Uš¶W²YT]Ò4- Эð¸#.±(`lŠƒñÈåœDPŽ÷ Êó™QLQÛ !ÓÄ•ð)ÊÇ}?x[§Ï—‡*þt(Åiø<6Í:ËEýÔºGó­öYe/p¦¹ŒÊ©8ûÿ…GöS±œÆ°µÕñ§Ýõ˜°'óNa'®ê¿¯VóåÅùùhѬD¨‡÷l1輨ç‹Ù§ÉhÅf‹›óùpÔ—ÍMª¬ÿ1¼™¼Š à׋þ iÇ„«ï†ãéííì‰mߣFé=‡]cæáŸ§/£&ËS¿ŸÜNé7Jð`ÀÓY_@Ò(ê_ú>*µ‚¬_®uÞ?ŒÇ“Û¿õak<7õÃdµšÜ&u—ƒwÇ-¬ õŸú*~MC_ó° à§Þÿ}Šqendstream endobj 78 0 obj << /Filter /FlateDecode /Length 3746 >> stream xœ½\[w·~ׯàñ‹ÁÄ„p¿¨MΑå¤'©í6’Ú>È>=r-Ñ¡H†¤ù4ýió{;ƒÅ.°¥ÈÞeìƒ vn˜ùfXúÇ£|Àðoüw|}À—?ð0;ˆÿŒ¯ÏÏO%8êçjpþî z„4§Vz=°BRçíàüú€œ}˜/–ëéšÏßÜ)ª¬µáAM²r0‚j¡Øäà‚üo8Ò‚QïyQ®Ç«ér3]̆#iaÖ[2¿¹.WÓñp$¬'“iq¹˜3üäàkG^›Õô–ßž{À%Õðgpþòàü³@Z9ONóõfu3Þ,VaÈ¥s¹„£B8rqª%ã(ù5jàq¥çJ 5Þ ‚èóò§7äÉd2­dxò UQ ¡”¾îd6ªiŒażˆš¿!Ÿé°¼½/#­¨¶Àmæt̘JÈ“Ï?Æ3LÊ!~ǘ¤2ØWçßÁ¶kî©sv  çTÈfRƒ)†)j¬ÊÁ?óÍ*Ã<¸Êo?qðHž >¸\–¢·hÃø < ÕðÔª†XÏI«?3D=üé1Ì΀Ð3L+ n-5cÞÁ€qF«û½æF¯½['n(®TÁ»/Èáa½ÃŠ\\œŽ—Ë££òv¹XmÞ¾Mö|(”¶vx‹™ö ¨Œ¡T¬® ÜæŠ$u¼VÍ€N0xH%)vq±–rÍE‹ËÑQâñÑb;GaGlNð‚¬—ÿ¼.6µ¹¾™m¦ËÙ‡Ì>}(Ã-x{ÛboH]¸cT¡ýn`’ ÎûÛÁ5î€'Ç=›^ˆ4@\‰g]t°€eß–êÎùþ,/™`ð›þyϦ—ZPB:†°Î“ç ¹€¬*èØ  Zx¦þh¾R·Øë­ÊÍÍjÞ%ä˜ÆìÕ"zÜï®:QaÚ,>ë"2Ô V´é=ïYd©¨Òm@#D()4V>”ÿy”6WpZ)ŠI7xÓiUZ1¦S1@‚6”¹&%ƒ2 > b¸ÿ‰P1¤J‚ž¾©`¡‡/U)<Àä,0ù¤ì –°±Ð=ÍÌÎÞæ{ˆz µmý²ƒg†*Å_N*ÓÌ7?©8ÚÍ ÐG*ð¥œÙG]MÂ9ÖߢEµ®z»Ä¬²¼E¶U*Àß:p?^f#)gm⪋°âTn ÊýÇT_Õ¤ôç… pRñþ¼0£7¹<ݳfÌzôÂŒ*4z}$Œbî€T‚tHÏÞ#X¢M töŸ |<2VO`bƒÚE o©rmÊYÑ}˜×වŒ9Tæã…ÐjyÕfñþ‹®û) ’kSw©V…¡\Þ¿›àò u¦MœeVþ”Šî>NÜ­Íée³(I¥¸×?ºYEyʶ¼ZìÇ*ë­ëÑ*Ø*ñ=YŘ@3§Í÷c•Р‰þ¬b-µLìÇ*NRµžr?VqžrÓ£U°Cõmzo†=c¬äêâ6“egŒ•ŠÕÆJ¨ôÅ–Ãõ†±Z¶å}ûÁX ‹•ý¡‰T†*³Ÿ¸ ' þ÷ÀX õ¸=ZJp£÷d-çV¸ìM¤Õ”ó­â@kµ'«8Cµý]¬â•¬?Œ•ÞQ&÷cÅd¸Èi«½XE1OUµ›âš ±çÌS·&ÊC¸:˜ÜvÎ<\i˜-ª]2לÕ–²¿Ã‚x‘—]„ ‡måûòæú "§Í»Èîkø~d w7m;ˆ.²¾1±'Y=§V÷h×З·uï=v«[¦6“Óëî½yhBÛtWå²K8±Ÿø­»¹œø~¾êíÚjt븪n]ws}E_ÕÁm{t<ذ­·'z;U$\V÷ _ÆK5±ëûãÃ4^DåÞà}ýΈsxP_éaWêK e°VS¦Ã w-z·=yPõbB²Öï%dôðj¶X­Ëô^Bu$š>/Þ¥w;Ƴb½ÎoRû;¡­#s]ŸL.OºŸÐ6;.¡:4勞v¨ Œv—¬ÕxSFïÙÛž„u‚:A–ïRfÕ÷ 9=ÚW9îÀEo†mpf[ÖÔŠ sQ 9{÷@LÏ\çÐøG¢wÒD(í '›ÍíIòfCsÉi“K*¹GÐehã}û*¿÷ÍàÐ_‡—òñý_|IY¢ÐœœÅê"H$)擤ŋr^} ô‡#h©¼Ž` žÒ’œ`ÝQ…1×&óªÜ\-&ëúµâ¶µµ¤Ò˜¨A+;áË4` tÈN=ä$Š1h$ºB~bkËx{û&Cès4gF“¡²e’LÓìQò4di-M³2 Ešì9•†‡àBA3KN1几ùþ8;NÃŒÛ2Íivœfعà2Í–;é¾ÚùØ&Í®Ò03Ôm3Û1Ì”TiÕÞ'À'éxˆ‡ÓäKËbÜÍÅe㹚ükÐÌ@쯧‹yõ^} ‹H¼LBß.M|)b{ÄC0‚ëxMþvú²„ã[ºÕ9Úí`{µÙ,ON_ÓÓÑp.L“¿®ïËñ†.V—‡–€/¨å)ô4·zŸbñ(ÞÕãyo&Ux(È6ð Kã~|5™”³ïƒX–{rSn6ål8ÂäÊX€A4£ƒa’sòõP!t8 „™Î™‹ùx1]‡5ä´^ËT «Õ£&ªÕ2§÷zÇÖ9.ð-†g<°ÿ°ý0Î^zR³ð¿¦ÌUÁ¾ ¼º.&ÓÙl± O5d«d†§ßÛ“š<ÅgŸ&–ßÌ7å%êî•R`Wmj¿©Wòn(¢°I«(9èµ¹*ãeÈÓcÌ!àá°m$Šö4®užœ1ùb°”עrRÓÑäåt^«š”$dzËòûjC CÈ7Ò¾œÂ|•BÑ!Jn<ù°¼…Ä߇èý€7ĬÁÒ@‚^x¬’7ô¾ïj8Mã4äiÈÒ¦¡LCÐ @`ïb·ò¼í0Íž¤Ù;àf_§Yšf—i¶H³ã4ûCš½Þa¶ÜI7“a¼“Û2Í£š3ö*M^o ’\–&3ÈŸ¥³­<†]`  Æ™öv‡€7_U /Ñ)mšk $€'R QÌÛ 'Ô‰í«µý£=–TªÛ–wÐãàs'Ú›*§}QáÈŠ5;îPD¢ÖU‹D˺ æ‡×½[ Ï`‘1-ØÇ—©ìC ûhXD®ÓÊ’˜I±úÎP8˜RÖIýmUÒò€ÂasqKiklj±PÅ ¢-9ËYY¡“”t~YË¡’pòÓts¿Pž\M/¯FËrõn° ¾_D eù@›P‹æšßœÁ“ŽÌ"lÖr lzi® C¿äoûoDÇv’PÚÞ$‰“Åõòf€¿ú Ô¦Ð4œáÔz3¯£P”ÇêÙ†ºæE±)âr°<ûa=½§––àæŒŸUi«-Þ8‚gW+,¿ÝkÑ€! •í"JàͯN°Qü_ö þœAËn]Î+‚…Y‹-tªf·+÷j–í„Í;¥}œÅ]Á˜ ñß§t'Ú®Óìd'ŠgŒÅ=ŒÛ=ÅnYÿ!¶èÞYi¬ûf<”koF‚æþ‘’røµPîiH'·t²˜Ø$àP)¾§ãõ¤ÀÛ<)ĸ~ÜÊnw–jk[¬ ô[@)pq¼iaž MðI¶PrV˜Ç"æ™ÐMÿRt̶ñN„âï¸&$%Y,ËðIc½KÖ‹›U-Qƒ–AÍóÚN{tÁ¾Bm² à^¬í i¨í"#_ס¼ªC+=Vñ¡€µ¤Xo"yŽ)l³Ø|XF6¡LЅŰhCÞìC¢ˆUñ|=­Z6ÈI$Sç«[@ë!ž¶y- 1¿.ç›õ?bb XÈ(»A/ã´ªAËbOÊñÕ|:.ê´=âª\¢†áâl³OQkfyMëY’ñõ7'HáÊiºÝk†º×êx’!ò‰ø¸ÛM!E/]Τ©5ŠèWX×^´r—*ýY…; %ùf^nº”ø&smeC¸àã·›IaðÖÜÜ—Ðæc¼¡ zVO‚Ý„ÎÃDÈùø 9)?„ð2UxyúÇ:¼ ŸºVxù›Çï4úˆ¨F±u=/ÖØ?UŒêªÀÉP"Ô-’wX lØË~ˆâlçPžÂ(ªW·aÕ*Ÿ…ªó؆¡kóá»];¼gËëÔüí_ÎÎv%ppJéYäï)”jÊ€U€ G»ÑóѺhÚ~æð>™Û¶Oôz4'Ò™ßÖA®gþ:}'ë‡ÙEf©~½ó0¥ÙíáÁ̧Ä^Z ãNm…VÐÐ÷—›[\=Ö©2çº;?o•.jKˆU„àPA¾_¬×’8ÄÈ Ý ” à›Œ¡—Ê ³×ãÕ¢å<üÇá÷_οžÖ‡‚–“³r6me8»Z9¥ðÐlºøÓæ ѵÉPR·äBvn {¬òÿ<”áˆÏ’Å @l#ô ¤é„B˦÷‹m‰%Ÿ^Α,¤H.IÈÏ.|®œíñ?‰Éëk€šDŸªruÖÇJ„»FŽ'd:eÃŒ àtÍ]ÃÏ5°d+TN¾>Có ^|wðºu›šendstream endobj 79 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 2936 >> stream xœUViTgž2ŒJikšJÔ/¡Ö϶îKÕŠV\Q”E$Ê!È"«²Üˆ¢€ì‘ H„Ú²±¸ƒ ›,BÕ.Ûº´}'ßà9ßhí™™yïÌͽϽÏs/‹ÐÕ!X,Ö'VÞþ¢ [7±ÅwÏÁn~Úóô=W‡þñÿ¾Ô„s@Ÿ úº0W_=5}Œ¤¢}lËÒ;tk€$üˆ·§W°‘óòÕËílðÏŠE‹¿?_±nÝ:#Qø¿íF¦îAÞžb£ø&ÔÝ/@âï.žŠÇdda¤ ÉÏ툑6,ïCÿ²ñÙfqÀV‰é‘ à;ÝÂDá‡,»ïöðô²ñ¶ÝëçoüAÌ#vÖÄ|bñ_–ØKØöÄBb±…ØOl%–Ž„)±”ØF˜ˉí„9±ƒXEì$¾&V–„1‡ ˆy(B—0&N¿³D¬69::oÙ¦l9»˜tËuâØp$œJréD6ë-ÕSéýN%SýÓB¦eM·˜.™ž8ƒšñåŒ]¨Ü@³ Èi€^®`Ñ…(€§d8¯É£ON¬zçÏù•D¢*à1RÙ¢'º´m·—b&12‹[…vÐ…<†=QÈyDÞFÕî}¤SÜÙ16G]åår,92Q*ÜÌ¼ÆÆ‡´~j–ü,dñûì¿1Ù!±wp«²Ú´.ƒûéÅý¬‡#¨g„MBWò–Â:·}›ìòat` ŰûMîxßåþÁ•»ˆ?CóÑ&/•wÅÜ=@É6òzkœŒ­#vJö ÝÍì<Í€2uU?¼žwO©Vu´TÝÊ@㜠)ñBTÜM/ng½|¦upZ+Ér4Ÿ³–ôcæsLÉ(sN¹a‚LŽM‰X¾£ÊÿGEyêÉlAn_Âqü§ü¨ÌÜTù)yšp€fsFImÛvÓN ÖÈS6}ôSĦ ±7 F̦ÛÖßΫ¬þŒ<ýD†pÖæÕ_Nz—ñ·_=¸^ÜrCmÃÁB³MÁB¯5þ¼%$³ 3ï©ÅrH#T°êÇÙ´[ÖDF´­Ì'ä?Hâá”gy]¦<3õ¬0ûg µ+1"9¢øp°ÐMP¢ŠmdÏzKÑ,Dѵ†S!¯ègµ 16ÝØÄ‹KN„D £Ó'!Už*lE×Ò”Áï0«›Ç×X3ì0Á#2½ôtvvvQQuN P·®H<S´°&…ljÂb¶$ð™ÙÑn±Ž~>þö°‡ZÍiìRõé¬JÁÅÌœŒ*©½D=Q鑆ÌTH;/8!OÃÅÈŒ'³\e¿ (ßâêŠ‚Š²|aqNÙ™ÆÓ/²ÎÈks0’&Û‘…Þ E¡ ÎB’YÏì]…ör–’h:“ÁÄ3 Î/$Ú‚œÇçIè¦mÄÊ–4ÂFîZø´°> ó²üÒ£r"ù%?DÖB;t•×Õ·wÕ"ÞPH×äÑ‚C¢Ãý1²?Ÿ¨ÔpŒQðz0 m"v‰„¢íZn?¨¼“ßQÚ ¼|¯ùÒ-Ðò†5z8Îá÷U¤IÌ fB[LF<¤ááx’µŒŠšXäB/⬠;&Î;Kܤ±À…¹$UºÉ0?þlrtA“ª¦—ÖÕþÍ+VߺŽÛ·½âÉsð• ©|¨ÿ>PéwQ”c+ÀØÝÞÌÙÊ›aÁ2pÎu,õR¬ k…a¸áʵ’²\Un µ–ô_·×u+f–kã@ka_Ö’›ê²Û@ݽìes Ó%Nh éêJÚóSô3ýšáM¼ÆM–iÇÃ,’ùõÞz‡áMeŠ-<úu?~çŸàc5×0kÉ݌ʷíP‰)ðcæ#f%ãÉLk7y[s%»ø{aY~VNv©ÔÄpˆdŒh¯·vÿk©•¿ƒð°¹£·P›ªŸ´äµ*›„ßÝo¸Ø:‰vp?2ïFËûY¦¦Æ-$ã¥æ¥7œª%ü› ñõZ‘ù~³…C‚1ØÛ{Ùã’w­ô: }xÓ[Ž „§™½§9P4>.”gœÌæwóJžõ¶ÕUç´)6%!Yб(˜šoÇé ˜*M8áÀB7ã5+—Ù3†Àpaµrã—§!ñcx•mj4m¬­´ú\ë7”bu6æu@k€ÊUé•íÖ°Ü÷+û­{ŒW¹,„`QêU+QE5 xVþ²¹çÆÃÑúZEÆAïhGs»Y4‰Ûg5™s?SŸWüÓÙÉ9÷ ÃOÆÈ¥°lH7‡­4ܦ´Nrá„ Vî—´ 牖Œ¸ñºéEý¬^ŒXvñmdElvH.?°À7Óÿ­»£¥ýwœÞ2Šau™¼¾{SÙ¬$†‰™¹vvŸû!e0MïÌZ½YJ<ƒDþÆÎýv×Ô Ô ÊÛJÄ}Nï2dâ,y­ÕN›,Ã78 }¬¬Ýwe•×z᪰²­¥êîm´ëÄ$UÃGÙ(äoªNnÅH§³ã)ð›TÞû¢ŽI„[˜ñìgùƒûê×nr µ¶\Gç8ÚY¨@õÃèäðLúæ+³qéø,î(:Úy(žä>o« tŒH ="ä¾ úÀw6DÊcRC)Ä!O“/€">œ=‘w²Ï¢¬Ž3WógC­¬Ð¹ürQnf~.Åý¾JÙ~gö{˜OÌèßjýˆ6â]C'9(‚l†’„‚Ь¨3Á‘®!bO·ˆ]Ú:Á¹¾yÃBÙùµä_sUK)ü2ßãl²ÓfŽ>KGWǟ᪱§ÏòÒJOdAÔ„^ñ¹ ª´Ïý惱ØÎVäæg ûÀ¢Ö¾= ™8rŸ? ®;Í¿0÷€@‘‡uØz<ô9ÕO³ä驯ɄÀd)„RŒþØV´è÷‘ ?Þ4ÕWö@ ”Ä•F‡\+œ³˜M†ÜžEAŠÚÙp)§ü‚²ª¢1÷~©:¦èhAD–/ˆ!.%!é(.!ÂJ¡7Ì¢c5x±ˆÓJÞD'±ŽƒŽ‘ŒàÝ­"kSŸœq·&“ý«Â“"3µLjNM.“;ßïh/“}¹wÚç4VˆbRdI2áFæÝ”-wàþ­nà×_;EÄy ·2/°ež–š™Z™|(‰.=z.¤X’Ⴙehm#m9¬ÜÛÁåè®ÝÔÔꉩõuá’ļá}®­Á[éâþºÇqÓ¯±ÕW³‡ÈX›ÐÏãñOÖ6ä þfh@ÿ‹G7‡endstream endobj 80 0 obj << /Filter /FlateDecode /Subtype /Type1C /Length 3262 >> stream xœ}W XSW~ayy¢ðšŠÛ{©k[+Eª­ÓVp@Pq--*KXCBû¾n@P6Ù"WÔëÚjaxãR4Z;N­ÕÚŽ:™óú]æ›yÚùf’|ù¾{ssÏ9ÿ9ÿÎf„H$š¾Þ×W©P®\ê/ —©Göñ³Eü3~®y>Nä[ñ¶D6æÈÆâÜœiOí¡ÓäÓÀg:a.m‹qWÆ&©#Ã#â¤ÎNNo-]*|ÿNœ$us”z…D+4Ñ‘Ò E¨ÔÛÑ×Qê§L6#¥¯*Ò`YD VIº”(+-¾ ®ÉÅä¢ÜD½ùð ,ºÿóC–~öºX½¦$¡$Å€¨c¨¥…¹âÔ¥-È O`vwî® FvÀæx.öÄ^`†çÂ, }û#k2‹Õ,áàsγÿ‹ŠÓ|îHSÿŠ-> NV†3ôЉx¤e\É”\ÚP-{r¸>xb%€VÛ6Ša  䡘ãɧæOšuyÙÉËÇÃ5ìþgÌu1ýÒWÎ~yãŠ× æEÊàüˆñ[Fd÷fЯòY<)iM:¹êÍ­ÛÔjF/¦¯Î*b°ˆL‹Ë‹Ÿw™XAå„}Úð L!At÷îSÚžS‹¨Ö¦úöE¦wƒ3Î~€ƒJnʇ€½µä‘u„èCË<ª¼*ý*Ъ±ÅðôQIt’Ž)ŽnE•cðöŽ¢—Ÿ‘÷1\‚âtWÇ¿áø÷”‡iìÅì;(€ —Å,÷ iºªeòk ªˆ’!uë,¦sS‘ÒPQ_¢¯`ÎE]FD«üxtÜ7! 0-ÁÞ0Ž 1ƒ¶ààeÉaÊVef©‹š. •ÍvE—šYÐÂrqM»¶¥²xù=²µÈFL1ï­§*lÚQ ûgœHbÂyƒ¡-q}_óãà*gßc­`)‘? °E‰ÒdÙ%{²‰ï{ßÂs?Z€VÇ6ÄëÚªŽ3hŸNW]\©«CUˆúÓ©°-¬oWãi,ézÝçÙ½ÏôåÕ ½FÞÔýqÏ춃#¼q3 Ò¢¸ÐDŠ®NŠ-JŸ½1¸ëè0Ó¥c'•€ˆ/<ˆAiŒŒÄÓÁ Ìa¾åQ7…]Sdªr´ÞÙu˼YÖ‡NMTÂ1hx>žŠ,ÃÈQ FëCLÖtŒžŽg¿òO˜´ÔƎᔉⓙü•¢†Ìù( $’˵ii(.›IÚ’ލ•×¾;×ù ;ê ‹JÙ’"]Ê.V4%·"Jßp íÎ|ˆ=7bæml3¸^‚yƒuãòó¸Nt½Ìz{ÍùJ!äX¤bxø`ÛX ›È¤F2ìá€PìïòäT™×™_›qô÷°Ó!»=§:Q›Lѵ¡ƒì°F¬z¡W÷L w²|¨N\ª.ɬˆ¹‰U%9åòNTŽJ+ʪ¿½®‚þí'‡P‹"Îþ°IRùÚQWS˜`¾ˆ¥ãd5À¯“G‚Jc6˜¿ºÓ,‹m¿fº[Ú;„šP¢ÄSÌ­Q– ¥ +%´Á?ðý5ëü¸‡ßsÜÀ•s;¶Œë¯áìè…µ½)½#:ˆøÛƒ¥2óM!wIk+"µ}¨8á2žÅ‹ÒNÄ¡xDyL>¡ÑN¬~6Á"ÜÂjù0Ù´6n¦èR˜5,ÞrD3éuíõºn–/jÿ  ûÁ†]øªïNÔDrVQ|“°3 +¹!·ž”¯)è!ZÐ1°ñz‚%xÚë‹í·~ºæÀÜÓ[ÙU°P‚«ÈšW>ãÐ#ÔìQöÁXûÀ‰ý°²¿§¶ôÛëû”FŸ>ð7êópi _ÅÛK©ÛwÄîÎQE0Ùe²æˆzÝÕuyteD“Š¥ç9é±ÊYHQ¥¬J¥è/3ƒ4Š€€Yo±háM\}øËyé&FçZ¨ØCÑó×ìB=¨ªdoq)[—eH;¨¡[·¾ëJ?”ÑÀ6V /.ÓÔg6 ª¥¡¡…žRÉö ]Ûº‚ø`W÷Å‹§»?;j÷6öŸ$ÁîA‹z]梵§N?rò‚޽D> ô.û¢­mæ¢Ñ‚ƒ`Îþ[ãmc³1À¸_ˆM*å[‡$‡cPNŽE ê–™™[ž¦FŸôô¡½9˜¬–”ÚZŠö\s¦í蹫³¬º­ìù›,ÓRbdƒ¬l2`5²5šCúÃÌÑÒÑBÈm² µ"½ª9QíŠ.Ù¼PD[D³Ü'Dú‡¶Þ3,~~’ù/chL®Ám!ð¼IŠ#Âçñ”IëOM*C;áWøF‰^Ó£ÑÄÄ´hôú–ýXíãŽo5Ó3Ó€xëP ï"6™pžt¥Ýð"¥ ™*\#”JBêÔ‚öfV¥ÕÅ#„¨øØ”È÷Ÿ£“0¯È[¬Ð[°ø¶G#’¨¼mª#¼‚Ä Á·¨lÀÂÒ0ÑhñÒ h'ñøK2¹é3áå™aÍÎI>¿a"âˆÎí ï~–x¡å¸ {T!&)„™J>†5¶{¡>¿ABƒí&­¿ž,f/Œs½@Ž|fÐgùzá> Šf CÜŒÀbYTpj¤ŠI<¢¬VÝ**OKÑß´çÅ¡ÔÙѦ¶Ó‚:Y|^­kÉÑÖ+\‚»˜>{ÿÔ''š*âv08Yœõ¢÷ÞüÕ¡ÿsä…«0[0ÛüQr"º="DÒ©ì:ÑÞÙ5–'_í/õ ">ú—ù’–„š$uNrf>ƒ¿ù—[nJB935©õ­ûê*Køæ·½µ:„öÍœ4bŠ„Žß%@ª…/$à;f`KL.À3±7öýÏK ÿ3Á›q©”à>˜Z½j=P°æ]¸¶ÏŸjslD/\·},CÎ|99:€æ¥gå3» ä…iE©(Ê(Óê{º;*«™á%Îâ‰líýu¶ø4ÎþÂЇFÐÕ‡W’´‰M“Mœ†Ár ÷^¯¡ãóó—ûÑ÷X-¾‹íZŠ­Þ]ý6KOß}8»†¡Ÿ4µÕªò÷gïc뎞l¿ˆ¨{ï¸úoôÛÁâp¼6=3/¥Ì4ÉÅ#ÒP±¯k\¯ ïøsö§‡Ö }8tÆxÜ(ø±„à“a­]Šéÿøi}×t•º»º“ØÚ}§›0ZÑÍIá\[SS[]AiAÛy°íCÔõ3²ÐÔ‚°9«P+ £ 7$!9E_É)¦›üùôÚ€[}ÒßAŸÊØâ’² T\\1“Þ›‰t%{Z›ª¸äHçÁm`s¾}òd©ç?G€ÿ¶@Ö!pd|KeÜà9y8»<’‘“j”W”®Å ˜wÈNG…HKÉKÓ1P¼päÑÝ{‚Ñž˜ª{$XN‚[ŽÃÒÀÁ2!3ÆÝFȉàUÂ3Ñó÷±•<¨ ~>91 Bw€¤û£²r"XÜ(NFª®Ú²=ååÌþÚC]ß êîÏõ®žVï¨;žÈîÙ³¯ÕP‡4õ†.S¥†¯xð{0úÙ÷`ÎÚòí‚ýVV,~ìÙƒÜQ4°UæÎ0¹|ÛGy¹L,þéw„¹º>¿2;?/?ePôIu}œ^ßÐÔq!ôÒذ.E’÷}üÝÝ7]ûéó/Ï \Ù´Šç$¬˜à%üû¿‰‰ÏZü7Y³*x÷ X]S¢#9+£5ce±Ei3åX›Nx—êKöÙØ«ªÒ•Tèt º ÞÌf*AüɈ&endstream endobj 81 0 obj << /Type /XRef /Length 110 /Filter /FlateDecode /DecodeParms << /Columns 5 /Predictor 12 >> /W [ 1 3 1 ] /Info 3 0 R /Root 2 0 R /Size 82 /ID [<007dd67149f492b1a72e3a5bdb21921c>] >> stream xœcb&F~0ù‰ $À8JRüÏÀÍ{Èfý [~6ɱÌf‘Â) R@D²w€Hæ/ RÌDr¿‘œ%`²D²ExšA$;Ø´°J°9œ«Àìç`ó_ƒU^’Œ¼ » ! endstream endobj startxref 65913 %%EOF RcppArmadillo/inst/skeleton/0000755000176200001440000000000014367750454015623 5ustar liggesusersRcppArmadillo/inst/skeleton/Makevars.win0000644000176200001440000000155514367750454020121 0ustar liggesusers ## With R 3.1.0 or later, you can uncomment the following line to tell R to ## enable compilation with C++11 (where available) ## ## Also, OpenMP support in Armadillo prefers C++11 support. However, for wider ## availability of the package we do not yet enforce this here. It is however ## recommended for client packages to set it. ## ## And with R 3.4.0, and RcppArmadillo 0.7.960.*, we turn C++11 on as OpenMP ## support within Armadillo prefers / requires it ## ## R 4.0.0 made C++11 the default, R 4.1.0 switched to C++14, R 4.3.0 to C++17 ## _In general_ we should no longer need to set a standard as any recent R ## installation will do the right thing. Should you need it, uncomment it and ## set the appropriate value, possibly CXX17. #CXX_STD = CXX11 PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS) PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) RcppArmadillo/inst/skeleton/rcpparma_hello_world.Rd0000644000176200001440000000251612401065421022271 0ustar liggesusers\name{RcppArmadillo-Functions} \alias{rcpparma_hello_world} \alias{rcpparma_innerproduct} \alias{rcpparma_outerproduct} \alias{rcpparma_bothproducts} \title{Set of functions in example RcppArmadillo package} \description{ These four functions are created when \code{RcppArmadillo.package.skeleton()} is invoked to create a skeleton packages. } \usage{ rcpparma_hello_world() rcpparma_outerproduct(x) rcpparma_innerproduct(x) rcpparma_bothproducts(x) } \arguments{ \item{x}{a numeric vector} } \value{ \code{rcpparma_hello_world()} does not return a value, but displays a message to the console. \code{rcpparma_outerproduct()} returns a numeric matrix computed as the outer (vector) product of \code{x}. \code{rcpparma_innerproduct()} returns a double computer as the inner (vector) product of \code{x}. \code{rcpparma_bothproducts()} returns a list with both the outer and inner products. } \details{ These are example functions which should be largely self-explanatory. Their main benefit is to demonstrate how to write a function using the Armadillo C++ classes, and to have to such a function accessible from R. } \references{ See the documentation for Armadillo, and RcppArmadillo, for more details. } \examples{ x <- sqrt(1:4) rcpparma_innerproduct(x) rcpparma_outerproduct(x) } \author{Dirk Eddelbuettel} RcppArmadillo/inst/skeleton/rcpparma_hello_world.cpp0000644000176200001440000000265512304377763022533 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- // we only include RcppArmadillo.h which pulls Rcpp.h in for us #include "RcppArmadillo.h" // via the depends attribute we tell Rcpp to create hooks for // RcppArmadillo so that the build process will know what to do // // [[Rcpp::depends(RcppArmadillo)]] // simple example of creating two matrices and // returning the result of an operatioon on them // // via the exports attribute we tell Rcpp to make this function // available from R // // [[Rcpp::export]] arma::mat rcpparma_hello_world() { arma::mat m1 = arma::eye(3, 3); arma::mat m2 = arma::eye(3, 3); return m1 + 3 * (m1 + m2); } // another simple example: outer product of a vector, // returning a matrix // // [[Rcpp::export]] arma::mat rcpparma_outerproduct(const arma::colvec & x) { arma::mat m = x * x.t(); return m; } // and the inner product returns a scalar // // [[Rcpp::export]] double rcpparma_innerproduct(const arma::colvec & x) { double v = arma::as_scalar(x.t() * x); return v; } // and we can use Rcpp::List to return both at the same time // // [[Rcpp::export]] Rcpp::List rcpparma_bothproducts(const arma::colvec & x) { arma::mat op = x * x.t(); double ip = arma::as_scalar(x.t() * x); return Rcpp::List::create(Rcpp::Named("outer")=op, Rcpp::Named("inner")=ip); } RcppArmadillo/inst/skeleton/Makevars0000644000176200001440000000155514367750426017324 0ustar liggesusers ## With R 3.1.0 or later, you can uncomment the following line to tell R to ## enable compilation with C++11 (where available) ## ## Also, OpenMP support in Armadillo prefers C++11 support. However, for wider ## availability of the package we do not yet enforce this here. It is however ## recommended for client packages to set it. ## ## And with R 3.4.0, and RcppArmadillo 0.7.960.*, we turn C++11 on as OpenMP ## support within Armadillo prefers / requires it ## ## R 4.0.0 made C++11 the default, R 4.1.0 switched to C++14, R 4.3.0 to C++17 ## _In general_ we should no longer need to set a standard as any recent R ## installation will do the right thing. Should you need it, uncomment it and ## set the appropriate value, possibly CXX17. #CXX_STD = CXX11 PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS) PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) RcppArmadillo/inst/tinytest/0000755000176200001440000000000014777174767015676 5ustar liggesusersRcppArmadillo/inst/tinytest/cpp/0000755000176200001440000000000014237001045016421 5ustar liggesusersRcppArmadillo/inst/tinytest/cpp/sample.cpp0000644000176200001440000000471013537314632020423 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- // // sample.cpp: RcppArmadillo unit test code for sample() function // // Copyright (C) 2012 - 2013 Christian Gunning and Dirk Eddelbuettel // // This file is part of RcppArmadillo. // // RcppArmadillo is free software: you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 2 of the License, or // (at your option) any later version. // // RcppArmadillo is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with RcppArmadillo. If not, see . // [[Rcpp::depends(RcppArmadillo)]] #include #include using namespace Rcpp; // function defns exported to R -- instantiate templated sample // functions are identical except for class of sampled vector and return val // [[Rcpp::export]] IntegerVector csample_integer( IntegerVector x, int size, bool replace, NumericVector prob = NumericVector::create()) { RNGScope scope; IntegerVector ret = RcppArmadillo::sample(x, size, replace, prob); return ret; } // [[Rcpp::export]] NumericVector csample_numeric( NumericVector x, int size, bool replace, NumericVector prob = NumericVector::create()) { RNGScope scope; NumericVector ret = RcppArmadillo::sample(x, size, replace, prob); return ret; } // [[Rcpp::export]] ComplexVector csample_complex( ComplexVector x, int size, bool replace, NumericVector prob = NumericVector::create()) { RNGScope scope; ComplexVector ret = RcppArmadillo::sample(x, size, replace, prob); return ret; } // [[Rcpp::export]] CharacterVector csample_character( CharacterVector x, int size, bool replace, NumericVector prob = NumericVector::create()) { RNGScope scope; CharacterVector ret = RcppArmadillo::sample(x, size, replace, prob); return ret; } // [[Rcpp::export]] LogicalVector csample_logical( LogicalVector x, int size, bool replace, NumericVector prob = NumericVector::create()) { RNGScope scope; LogicalVector ret = RcppArmadillo::sample(x, size, replace, prob); return ret; } RcppArmadillo/inst/tinytest/cpp/colrow_as_vec.cpp0000644000176200001440000000051613537314632021767 0ustar liggesusers// [[Rcpp::depends(RcppArmadillo)]] #define RCPP_ARMADILLO_RETURN_COLVEC_AS_VECTOR #define RCPP_ARMADILLO_RETURN_ROWVEC_AS_VECTOR #include using namespace Rcpp; // [[Rcpp::export]] arma::vec vecc_as_v_test(arma::vec v) { return(v); } // [[Rcpp::export]] arma::rowvec vecr_as_v_test(arma::rowvec v) { return(v); } RcppArmadillo/inst/tinytest/cpp/armadillo.cpp0000644000176200001440000002017314205475146021110 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- // // armadillo.cpp: RcppArmadillo unit test code // // Copyright (C) 2010 - 2019 Dirk Eddelbuettel, Romain Francois and Douglas Bates // Copyright (C) 2019 - 2022 Dirk Eddelbuettel // // This file is part of RcppArmadillo. // // RcppArmadillo is free software: you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 2 of the License, or // (at your option) any later version. // // RcppArmadillo is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with RcppArmadillo. If not, see . // [[Rcpp::depends(RcppArmadillo)]] #include using namespace Rcpp; // [[Rcpp::export]] bool has_old_field_behavior() { //#if defined(RCPP_ARMADILLO_OLD_Field_BEHAVIOR) #if !defined(RCPP_ARMADILLO_FIX_Field) return true; #else return false; #endif } // [[Rcpp::export]] List wrap_() { // using the Named(.) = . notation List cols = List::create(Named( "Col" ) = arma::zeros(5,1), Named( "Col" ) = arma::zeros(5,1)); // using the Named(., .) notation List rows = List::create(Named( "Row", arma::zeros(1,5) ), Named( "Row" , arma::zeros(1,5) )); // using the _[.] = . notation List matrices = List::create(_["Mat"] = arma::eye( 3,3 ), _["Mat"] = arma::eye( 3,3 ), _["Mat"] = arma::eye( 3, 3 ), _["Mat"] = arma::eye( 3, 3 )); // creating an empty list and grow it on demand List fields; arma::field f1( 2, 2 ); f1( 0, 0 ) = 0; f1( 1, 0 ) = 1; f1( 0, 1 ) = 2; f1( 1, 1 ) = 3; fields["field"] = f1; arma::field f2(2,2); f2( 0, 0 ) = "a"; f2( 1, 0 ) = "b"; f2( 0, 1 ) = "c"; f2( 1, 1 ) = "d"; fields["field"] = f2; arma::field f3(2,2); f3(0,0) = arma::zeros(5,1); f3(1,0) = arma::zeros(4,1); f3(0,1) = arma::zeros(3,1); f3(1,1) = arma::zeros(2,1); fields["field"] = f3; List output = List::create(_["matrices : Mat"] = matrices, _["rows : Row"] = rows, _["columns : Col"] = cols, _["fields : field"] = fields ); return output; } // [[Rcpp::export]] List wrapGlue_() { arma::mat m1 = arma::eye( 3, 3 ); arma::mat m2 = arma::eye( 3, 3 ); List res; res["mat+mat"] = m1 + m2; return res; } // [[Rcpp::export]] List wrapOp_() { arma::mat m1 = arma::eye( 3, 3 ); List res; res["- mat"] = - m1; return res; } // [[Rcpp::export]] List asMat_(List input) { arma::imat m1 = input[0]; /* implicit as */ arma::mat m2 = input[1]; /* implicit as */ arma::umat m3 = input[0]; /* implicit as */ arma::fmat m4 = input[1]; /* implicit as */ List res = List::create(arma::accu( m1 ), arma::accu( m2 ), arma::accu( m3 ), arma::accu( m4 ) ); return res; } // [[Rcpp::export]] List asCol_(List input) { arma::icolvec m1 = input[0]; /* implicit as */ arma::colvec m2 = input[1]; /* implicit as */ arma::ucolvec m3 = input[0]; /* implicit as */ arma::fcolvec m4 = input[1]; /* implicit as */ List res = List::create(arma::accu( m1 ), arma::accu( m2 ), arma::accu( m3 ), arma::accu( m4 ) ); return res; } // [[Rcpp::export]] List asRow_(List input) { arma::irowvec m1 = input[0]; /* implicit as */ arma::rowvec m2 = input[1]; /* implicit as */ arma::urowvec m3 = input[0]; /* implicit as */ arma::frowvec m4 = input[1]; /* implicit as */ List res = List::create(arma::accu( m1 ), arma::accu( m2 ), arma::accu( m3 ), arma::accu( m4 ) ); return res; } // [[Rcpp::export]] List cxMat_() { arma::cx_mat m1 = arma::eye ( 3, 3 ); arma::cx_fmat m2 = arma::eye( 3, 3 ); return List::create( _["double"] = m1, _["float"] = m2 ); } // [[Rcpp::export]] ComplexMatrix mtOp_() { std::complex x( 1.0, 2.0 ); arma::mat m1 = arma::eye ( 3, 3 ); return wrap( x * m1 ); } // [[Rcpp::export]] NumericMatrix mtGlue_() { arma::imat m2 = arma::eye ( 3, 3 ); arma::mat m1 = arma::eye ( 3, 3 ); return wrap( m1 + m2 ); } // [[Rcpp::export]] NumericMatrix sugar_(NumericVector xx) { arma::mat m = xx + xx; return wrap( m ); } // [[Rcpp::export]] ComplexMatrix sugarCplx_(ComplexVector xx) { arma::cx_mat m = exp( xx ); return wrap( m ); } // [[Rcpp::export]] List sugarCtor_(NumericVector xx) { arma::mat m = xx + xx; arma::colvec co = xx; arma::rowvec ro = xx; return List::create(_["mat"] = m + m, _["rowvec"] = ro, _["colvec"] = co); } double norm( double x, double y){ return ::sqrt( x*x + y*y ); } // [[Rcpp::export]] List sugarMatrixCtor_(NumericVector xx) { NumericVector yy = NumericVector::create( 1 ); arma::mat m = diag( xx ); arma::colvec co = outer( xx, yy, ::norm ); arma::rowvec ro = outer( yy, xx, ::norm ); return List::create(_["mat"] = m + m , _["rowvec"] = ro, _["colvec"] = co); } // test.armadillo.rtti.check <- function() { // inc <- ' // void blah(arma::mat& X) { // X.set_size(5,5); // } // ' // src <- ' // arma::vec V; // blah(V); // if blah() worked, we have a problem // ' // fun <- cxxfunction(signature(), body=src, inc=inc, plugin = "RcppArmadillo") // checkException(fun(), msg="RTTI check on matrix constructor exception") // } // [[Rcpp::export]] int mat_plain(arma::mat x) { return x.n_elem; } // [[Rcpp::export]] int mat_const(const arma::mat x) { return x.n_elem; } // [[Rcpp::export]] int mat_ref(arma::mat & x) { return x.n_elem; } // [[Rcpp::export]] int mat_const_ref(const arma::mat & x) { return x.n_elem; } // [[Rcpp::export]] int vec_plain(arma::vec x) { return x.n_elem; } // [[Rcpp::export]] int vec_const(const arma::vec x) { return x.n_elem; } // [[Rcpp::export]] int vec_ref(arma::vec & x) { return x.n_elem; } // [[Rcpp::export]] int vec_const_ref(const arma::vec & x) { return x.n_elem; } // [[Rcpp::export]] int cx_mat_plain(arma::cx_mat x) { return x.n_elem; } // [[Rcpp::export]] int cx_mat_const(const arma::cx_mat x) { return x.n_elem; } // [[Rcpp::export]] int cx_mat_ref(arma::cx_mat & x) { return x.n_elem; } // [[Rcpp::export]] int cx_mat_const_ref(const arma::cx_mat & x) { return x.n_elem; } // [[Rcpp::export]] arma::uvec uvec_test(arma::uvec v) { return(v); } // [[Rcpp::export]] arma::uvec c_uvec_test(const arma::uvec v) { return(v); } // [[Rcpp::export]] arma::uvec r_uvec_test(arma::uvec& v) { return(v); } // [[Rcpp::export]] arma::uvec cr_uvec_test(const arma::uvec& v) { return(v); } // [[Rcpp::export]] arma::umat umat_test(arma::umat v) { return(v); } // [[Rcpp::export]] arma::umat c_umat_test(const arma::umat v) { return(v); } // [[Rcpp::export]] arma::umat r_umat_test(arma::umat& v) { return(v); } // [[Rcpp::export]] arma::umat cr_umat_test(const arma::umat& v) { return(v); } // [[Rcpp::export]] arma::vec vecc_test(arma::vec v) { return(v); } // [[Rcpp::export]] arma::rowvec vecr_test(arma::rowvec v) { return(v); } RcppArmadillo/inst/tinytest/cpp/any_as_vec.cpp0000644000176200001440000000044613537314632021253 0ustar liggesusers// [[Rcpp::depends(RcppArmadillo)]] #define RCPP_ARMADILLO_RETURN_ANYVEC_AS_VECTOR #include using namespace Rcpp; // [[Rcpp::export]] arma::vec veccany_as_v_test(arma::vec v) { return(v); } // [[Rcpp::export]] arma::rowvec vecrany_as_v_test(arma::rowvec v) { return(v); } RcppArmadillo/inst/tinytest/cpp/complex.cpp0000644000176200001440000000436413537314632020616 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- // // complex.cpp: RcppArmadillo unit tests for complex vectors and matrices // // Copyright (C) 2013 - 2019 Baptiste Auguie and Dirk Eddelbuettel // Copyright (C) 2019 Dirk Eddelbuettel // // This file is part of RcppArmadillo. // // RcppArmadillo is free software: you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 2 of the License, or // (at your option) any later version. // // RcppArmadillo is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with RcppArmadillo. If not, see . #include using namespace Rcpp; using namespace arma; // [[Rcpp::depends(RcppArmadillo)]] // [[Rcpp::export]] List complexCppTests(const arma::mat& A, const arma::mat& B, const arma::cx_colvec& V, const arma::mat& S) { arma::cx_mat C(A, B); // create complex matrix arma::cx_mat Cst = strans(C), Ct = trans(C); // transpose arma::cx_mat conjC = conj(C); // conjugate arma::mat absC = abs(C); // modulus arma::cx_colvec CtV = C * V; // multiply matrix-vector arma::cx_mat CtS = C * S; // multiply matrix-matrix arma::cx_mat CC = C % C; // element-wise multiplication arma::cx_mat CdC = C / C; // division arma::cx_mat CpC = C + C; // addition arma::cx_mat CmC = C - C; // subtraction return List::create(_["C"] = C, _["Cst"] = Cst, _["Ct"] = Ct, _["conjC"] = conjC, _["absC"] = absC, _["CV"] = CtV, _["CS"] = CtS, _["CC"] = CC, _["CdC"] = CdC, _["CpC"] = CpC, _["CmC"] = CmC ); } RcppArmadillo/inst/tinytest/cpp/Rlapack.cpp0000644000176200001440000000653713537314632020530 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- // // Rlapack.cpp: RcppArmadillo unit tests for borked Lapack // // Copyright (C) 2018 Keith O'Hara and Dirk Eddelbuettel // // This file is part of RcppArmadillo. // // RcppArmadillo is free software: you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 2 of the License, or // (at your option) any later version. // // RcppArmadillo is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with RcppArmadillo. If not, see . // #define ARMA_EXTRA_DEBUG #include using namespace Rcpp; // [[Rcpp::depends(RcppArmadillo)]] // [[Rcpp::export]] arma::cx_mat cx_eig_pair_test(const int n) { arma::cx_mat A = arma::randu(n,n); arma::cx_mat B = arma::randu(n,n); arma::cx_vec eigval; arma::cx_mat eigvec; arma::eig_pair(eigval, eigvec, A, B); return A*eigvec - B*eigvec*arma::diagmat(eigval); } // [[Rcpp::export]] arma::cx_mat cx_qz_test(const int n) { // test qz in complex matrix case arma::cx_mat A = arma::randu(n,n); arma::cx_mat B = arma::randu(n,n); arma::cx_mat AA; arma::cx_mat BB; arma::cx_mat Q; arma::cx_mat Z; arma::qz(AA,BB,Q,Z,A,B); return A - Q.t()*AA*Z.t(); } // [[Rcpp::export]] int cx_rank_test(const int n) { // test svd_dc arma::cx_mat A = arma::randu(n,n+1); int rA = arma::rank(A); return rA; } // [[Rcpp::export]] arma::cx_mat cx_pinv_test(const int n) { // test svd_dc arma::cx_mat A = arma::randu(n,n+1); arma::cx_mat B = arma::pinv(A); return A*B; } // [[Rcpp::export]] arma::cx_mat cx_schur_test(const int n) { arma::cx_mat A = arma::randu(n,n); arma::cx_mat U; arma::cx_mat S; arma::schur(U,S,A); return A - U*S*U.t(); } // [[Rcpp::export]] arma::cx_mat cx_solve_test(const int n) { arma::cx_mat A = arma::randu(n,n); arma::cx_vec b = arma::randu(n); arma::cx_mat B = arma::randu(n,n); arma::cx_vec x1 = solve(A, b); arma::cx_vec x2; solve(x2, A, b); arma::cx_mat X1 = solve(A, B); arma::cx_mat X2 = solve(A, B, arma::solve_opts::fast); // enable fast mode // next for non-square matrices; to test solve_approx_svd arma::cx_mat C = arma::randu(n,n+1); arma::cx_vec x3 = solve(C, b); return C*x3 - b; } // [[Rcpp::export]] arma::cx_mat cx_solve_band_test(const int n) { // trigger solve_tridiag_refine int n_tri_rows = std::min(34,n); arma::cx_mat A_tri = arma::zeros(n_tri_rows,n_tri_rows); A_tri.diag() = arma::randu(n_tri_rows,1); A_tri.diag(1) = arma::randu(n_tri_rows-1,1); A_tri.diag(-1) = arma::randu(n_tri_rows-1,1); arma::cx_vec b_tri = arma::randu(n_tri_rows); arma::cx_vec x_tri = solve(A_tri, b_tri); return A_tri*x_tri - b_tri; } RcppArmadillo/inst/tinytest/cpp/fields_new.cpp0000644000176200001440000000631214145557252021264 0ustar liggesusers // fields_new.cpp: RcppArmadillo unit test code for field types // // Copyright (C) 2021 Dirk Eddelbuettel // // This file is part of RcppArmadillo. // // RcppArmadillo is free software: you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 2 of the License, or // (at your option) any later version. // // RcppArmadillo is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with RcppArmadillo. If not, see . #define RCPP_ARMADILLO_FIX_Field 1 // [[Rcpp::depends(RcppArmadillo)]] #include // [[Rcpp::export]] arma::field field1m22n() { arma::mat A = arma::randn(2,2); arma::field F(1); F(0) = A; return F; } // [[Rcpp::export]] arma::field field11m22n() { arma::mat A = arma::randn(2,2); arma::field F(1,1); F(0,0) = A; return F; } // [[Rcpp::export]] arma::field field12m22n() { arma::mat A = arma::randn(2,2); arma::mat B = arma::randn(2,2); arma::field F(1,2); F(0,0) = A; F(0,1) = B; //F.print("12m22xx"); return F; } // [[Rcpp::export]] arma::field field21m22n() { arma::mat A = arma::randn(2,2); arma::mat B = arma::randn(2,2); arma::field F(2,1); F(0,0) = A; F(1,0) = B; return F; } // [[Rcpp::export]] arma::field field22m2233n() { arma::mat A = arma::randn(2,2); arma::mat B = arma::randn(3,3); arma::field F(2,2); F(0,1) = A; F(1,0) = B; return F; } // [[Rcpp::export]] arma::field field222m223344n() { arma::mat A = arma::randn(2,2); arma::mat B = arma::randn(3,3); arma::mat C = arma::randn(4,4); arma::field F(2,2,2); F(0,1,0) = A; F(1,0,0) = B; F(0,0,1) = C; return F; } // [[Rcpp::export]] arma::ivec infield1m22n(arma::field F) { arma::uvec v = { F.n_rows, F.n_cols, F.n_slices }; return arma::conv_to::from(v); } // [[Rcpp::export]] arma::ivec infield11m22n(arma::field F) { arma::uvec v = { F.n_rows, F.n_cols, F.n_slices }; return arma::conv_to::from(v); } // [[Rcpp::export]] arma::ivec infield12m22n(arma::field F) { arma::uvec v = { F.n_rows, F.n_cols, F.n_slices }; return arma::conv_to::from(v); } // [[Rcpp::export]] arma::ivec infield21m22n(arma::field F) { arma::uvec v = { F.n_rows, F.n_cols, F.n_slices }; return arma::conv_to::from(v); } // [[Rcpp::export]] arma::ivec infield22m2233n(arma::field F) { arma::uvec v = { F.n_rows, F.n_cols, F.n_slices }; return arma::conv_to::from(v); } // [[Rcpp::export]] arma::ivec infield222m223344n(arma::field F) { arma::uvec v = { F.n_rows, F.n_cols, F.n_slices }; return arma::conv_to::from(v); } RcppArmadillo/inst/tinytest/cpp/fields.cpp0000644000176200001440000000651314205475160020410 0ustar liggesusers// fields.cpp: RcppArmadillo unit test code for field types // // Copyright (C) 2021 - 2022 Dirk Eddelbuettel // // This file is part of RcppArmadillo. // // RcppArmadillo is free software: you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 2 of the License, or // (at your option) any later version. // // RcppArmadillo is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with RcppArmadillo. If not, see . // [[Rcpp::depends(RcppArmadillo)]] #include // [[Rcpp::export]] bool has_old_field_behavior() { //#if defined(RCPP_ARMADILLO_OLD_Field_BEHAVIOR) #if !defined(RCPP_ARMADILLO_FIX_Field) return true; #else return false; #endif } // [[Rcpp::export]] arma::field field1m22() { arma::mat A = arma::randn(2,2); arma::field F(1); F(0) = A; return F; } // [[Rcpp::export]] arma::field field11m22() { arma::mat A = arma::randn(2,2); arma::field F(1,1); F(0,0) = A; return F; } // [[Rcpp::export]] arma::field field12m22() { arma::mat A = arma::randn(2,2); arma::mat B = arma::randn(2,2); arma::field F(1,2); F(0,0) = A; F(0,1) = B; return F; } // [[Rcpp::export]] arma::field field21m22() { arma::mat A = arma::randn(2,2); arma::mat B = arma::randn(2,2); arma::field F(2,1); F(0,0) = A; F(1,0) = B; return F; } // [[Rcpp::export]] arma::field field22m2233() { arma::mat A = arma::randn(2,2); arma::mat B = arma::randn(3,3); arma::field F(2,2); F(0,1) = A; F(1,0) = B; return F; } // [[Rcpp::export]] arma::field field222m223344() { arma::mat A = arma::randn(2,2); arma::mat B = arma::randn(3,3); arma::mat C = arma::randn(4,4); arma::field F(2,2,2); F(0,1,0) = A; F(1,0,0) = B; F(0,0,1) = B; return F; } // [[Rcpp::export]] arma::ivec infield1m22(arma::field F) { arma::uvec v = { F.n_rows, F.n_cols, F.n_slices }; return arma::conv_to::from(v); } // [[Rcpp::export]] arma::ivec infield11m22(arma::field F) { arma::uvec v = { F.n_rows, F.n_cols, F.n_slices }; return arma::conv_to::from(v); } // [[Rcpp::export]] arma::ivec infield12m22(arma::field F) { arma::uvec v = { F.n_rows, F.n_cols, F.n_slices }; return arma::conv_to::from(v); } // [[Rcpp::export]] arma::ivec infield21m22(arma::field F) { arma::uvec v = { F.n_rows, F.n_cols, F.n_slices }; return arma::conv_to::from(v); } // [[Rcpp::export]] arma::ivec infield22m2233(arma::field F) { arma::uvec v = { F.n_rows, F.n_cols, F.n_slices }; return arma::conv_to::from(v); } // [[Rcpp::export]] arma::ivec infield222m223344(arma::field F) { F.print("F"); arma::uvec v = { F.n_rows, F.n_cols, F.n_slices }; return arma::conv_to::from(v); } RcppArmadillo/inst/tinytest/cpp/rmultinom.cpp0000644000176200001440000000114713537314632021171 0ustar liggesusers// [[Rcpp::depends(RcppArmadillo)]] #include #include using namespace Rcpp; // [[Rcpp::export]] IntegerVector rmultinomC(int n, int size, NumericVector prob) { IntegerMatrix draws(prob.size(), n); // FixProb modifies in-place arma::colvec fixprob(prob.begin(), prob.size()); // forced copy RcppArmadillo::FixProb(fixprob, 1, true); NumericVector newprob(Rcpp::wrap(fixprob)); RNGScope scope; for (int ii=0; ii. // [[Rcpp::depends(RcppArmadillo)]] #include // [[Rcpp::export]] int setSeed(int val) { arma::arma_rng::set_seed(val); // should trigger warning return 0; } // [[Rcpp::export]] arma::vec randu(int n) { return arma::randu(n); } // [[Rcpp::export]] arma::ivec randi(int n) { return arma::randi(n); } // [[Rcpp::export]] arma::vec randn(int n) { return arma::randn(n); } RcppArmadillo/inst/tinytest/cpp/sparse.cpp0000644000176200001440000000464513537314632020446 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- // // sparse.cpp: RcppArmadillo unit test code for sparse matrices // // Copyright (C) 2014 Dirk Eddelbuettel // // This file is part of RcppArmadillo. // // RcppArmadillo is free software: you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 2 of the License, or // (at your option) any later version. // // RcppArmadillo is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with RcppArmadillo. If not, see . // [[Rcpp::depends(RcppArmadillo)]] #include // [[Rcpp::export]] arma::sp_mat asSpMat(SEXP S) { return Rcpp::as(S); } // [[Rcpp::export]] Rcpp::List asStm(SEXP S) { return Rcpp::simple_triplet_matrix(Rcpp::as(S)); } // [[Rcpp::export]] arma::sp_mat sparseAddition(arma::sp_mat SM) { return SM + SM; } // [[Rcpp::export]] arma::sp_mat sparseMultiplication(arma::sp_mat SM, int k) { return k * SM; } // [[Rcpp::export]] arma::sp_mat fromTriplet(arma::urowvec ri, arma::urowvec ci, arma::colvec values) { arma::umat loc = arma::join_vert(ri, ci);// form 2*N 'locations' matrix arma::sp_mat sp(loc, values); // create sparse from locations and values return sp; } // [[Rcpp::export]] arma::sp_mat sparseTranspose(arma::sp_mat SM) { return SM.t(); } // [[Rcpp::export]] arma::sp_mat sparseSqrt(arma::sp_mat SM) { return arma::sqrt(SM); } // [[Rcpp::export]] arma::sp_mat sparseSquare(arma::sp_mat SM) { return arma::square(SM); } // [[Rcpp::export]] arma::sp_mat sparseIterators(arma::sp_mat SM, double val) { arma::sp_mat::iterator begin = SM.begin(); arma::sp_mat::iterator end = SM.end(); for (arma::sp_mat::iterator it = begin; it != end; ++it) (*it) += val; return SM; } // [[Rcpp::export]] Rcpp::List sparseList(Rcpp::List l) { arma::sp_mat mat1 = l[0]; arma::sp_mat mat2 = l[0]; return Rcpp::List::create(mat1, mat2); } // [[Rcpp::export]] arma::sp_mat speye(int nrow, int ncol) { return arma::speye(nrow, ncol); } RcppArmadillo/inst/tinytest/cpp/cube.cpp0000644000176200001440000000467513537314632020072 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- // // cube.cpp: RcppArmadillo unit test code for cube types // // Copyright (C) 2015 - 2019 Dirk Eddelbuettel and Nathan Russell // Copyright (C) 2019 Dirk Eddelbuettel // // This file is part of RcppArmadillo. // // RcppArmadillo is free software: you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 2 of the License, or // (at your option) any later version. // // RcppArmadillo is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with RcppArmadillo. If not, see . // [[Rcpp::depends(RcppArmadillo)]] #include // [[Rcpp::export]] arma::cube cube_test(const arma::cube& x) { return arma::pow(x, 2); } // [[Rcpp::export]] arma::fcube fcube_test(const arma::fcube& x) { return arma::pow(x, 2); } // [[Rcpp::export]] arma::icube icube_test(const arma::icube& x) { return arma::pow(x, 2); } // [[Rcpp::export]] arma::ucube ucube_test(const arma::ucube& x) { return arma::pow(x, 2); } // [[Rcpp::export]] arma::cx_cube cx_cube_test(const arma::cx_cube& x) { return arma::pow(x, 2); } // [[Rcpp::export]] arma::cx_fcube cx_fcube_test(const arma::cx_fcube& x) { return arma::pow(x, 2); } // [[Rcpp::export]] arma::cube as_cube(Rcpp::NumericVector x) { arma::cube y = Rcpp::as(x); return arma::pow(y, 2); } // [[Rcpp::export]] arma::fcube as_fcube(Rcpp::NumericVector x) { arma::fcube y = Rcpp::as(x); return arma::pow(y, 2); } // [[Rcpp::export]] arma::icube as_icube(Rcpp::IntegerVector x) { arma::icube y = Rcpp::as(x); return arma::pow(y, 2); } // [[Rcpp::export]] arma::ucube as_ucube(Rcpp::IntegerVector x) { arma::ucube y = Rcpp::as(x); return arma::pow(y, 2); } // [[Rcpp::export]] arma::cx_cube as_cx_cube(Rcpp::ComplexVector x) { arma::cx_cube y = Rcpp::as(x); return arma::pow(y, 2); } // [[Rcpp::export]] arma::cx_fcube as_cx_fcube(Rcpp::ComplexVector x) { arma::cx_fcube y = Rcpp::as(x); return arma::pow(y, 2); } RcppArmadillo/inst/tinytest/test_fields.R0000644000176200001440000000551414205476437020314 0ustar liggesusers # Copyright (C) 2021 - 2022 Dirk Eddelbuettel # # This file is part of RcppArmadillo. # # RcppArmadillo is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. # # RcppArmadillo is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with RcppArmadillo. If not, see . library(RcppArmadillo) Rcpp::sourceCpp("cpp/fields.cpp") .onWindows <- .Platform$OS.type == "windows" f1m22 <- field1m22() expect_true(inherits(f1m22, "array")) expect_true(inherits(f1m22[[1]], "matrix")) if (!has_old_field_behavior()) expect_equal(dim(f1m22), c(1,1,1)) expect_equal(dim(f1m22[[1]]), c(2,2)) f11m22 <- field11m22() expect_true(inherits(f11m22, "array")) expect_true(inherits(f11m22[[1]], "matrix")) if (!has_old_field_behavior()) expect_equal(dim(f11m22), c(1,1,1)) expect_equal(dim(f11m22[[1]]), c(2,2)) f12m22 <- field12m22() expect_true(inherits(f12m22, "array")) expect_true(inherits(f12m22[[1]], "matrix")) if (!has_old_field_behavior()) expect_equal(dim(f12m22), c(1,2,1)) expect_equal(dim(f12m22[[1]]), c(2,2)) expect_equal(dim(f12m22[[2]]), c(2,2)) f21m22 <- field21m22() expect_true(inherits(f21m22, "array")) expect_true(inherits(f21m22[[1]], "matrix")) if (!has_old_field_behavior()) expect_equal(dim(f21m22), c(2,1,1)) expect_equal(dim(f21m22[[1]]), c(2,2)) expect_equal(dim(f21m22[[2]]), c(2,2)) f22m2233 <- field22m2233() expect_true(inherits(f22m2233, "array")) expect_true(inherits(f22m2233[[1]], "matrix")) if (!has_old_field_behavior()) expect_equal(dim(f22m2233), c(2,2,1)) expect_equal(dim(f22m2233[[2]]), c(3,3)) expect_equal(dim(f22m2233[[3]]), c(2,2)) if (!has_old_field_behavior()) { f222m223344 <- field222m223344() expect_true(inherits(f222m223344, "array")) expect_true(inherits(f222m223344[[1]], "matrix")) expect_equal(dim(f222m223344), c(2,2,2)) expect_equal(dim(f222m223344[[2]]), c(3,3)) expect_equal(dim(f222m223344[[3]]), c(2,2)) } v <- infield1m22( field1m22() ) expect_equal(v, matrix(c(1L, 1L, 1L),3,1)) v <- infield11m22( field11m22() ) expect_equal(v, matrix(c(1L, 1L, 1L),3,1)) v <- infield12m22( field12m22() ) expect_equal(v, matrix(c(2L, 1L, 1L),3,1)) # should be 1,2,1 ? v <- infield21m22( field21m22() ) expect_equal(v, matrix(c(2L, 1L, 1L),3,1)) v <- infield22m2233( field22m2233() ) expect_equal(v, matrix(c(4L, 1L, 1L),3,1)) # should 2,2,1 ? #v <- infield222m223344( field222m223344() ) #expect_equal(v, matrix(c(4L, 1L, 1L),3,1)) # should 2,2,1 ? #print(v) RcppArmadillo/inst/tinytest/test_fields_new.R0000644000176200001440000000516414145016772021161 0ustar liggesusers # Copyright (C) 2021 Dirk Eddelbuettel # # This file is part of RcppArmadillo. # # RcppArmadillo is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. # # RcppArmadillo is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with RcppArmadillo. If not, see . library(RcppArmadillo) Rcpp::sourceCpp("cpp/fields_new.cpp") .onWindows <- .Platform$OS.type == "windows" f1m22 <- field1m22n() expect_true(inherits(f1m22, "array")) expect_true(inherits(f1m22[[1]], "matrix")) expect_equal(dim(f1m22), c(1,1,1)) expect_equal(dim(f1m22[[1]]), c(2,2)) f11m22 <- field11m22n() expect_true(inherits(f11m22, "array")) expect_true(inherits(f11m22[[1]], "matrix")) expect_equal(dim(f11m22), c(1,1,1)) expect_equal(dim(f11m22[[1]]), c(2,2)) f12m22 <- field12m22n() expect_true(inherits(f12m22, "array")) expect_true(inherits(f12m22[[1]], "matrix")) expect_equal(dim(f12m22), c(1,2,1)) expect_equal(dim(f12m22[[1]]), c(2,2)) expect_equal(dim(f12m22[[2]]), c(2,2)) f21m22 <- field21m22n() expect_true(inherits(f21m22, "array")) expect_true(inherits(f21m22[[1]], "matrix")) expect_equal(dim(f21m22), c(2,1,1)) expect_equal(dim(f21m22[[1]]), c(2,2)) expect_equal(dim(f21m22[[2]]), c(2,2)) f22m2233 <- field22m2233n() expect_true(inherits(f22m2233, "array")) expect_true(inherits(f22m2233[[1]], "matrix")) expect_equal(dim(f22m2233), c(2,2,1)) expect_equal(dim(f22m2233[[2]]), c(3,3)) expect_equal(dim(f22m2233[[3]]), c(2,2)) f222m223344 <- field222m223344n() expect_true(inherits(f222m223344, "array")) expect_true(inherits(f222m223344[[1]], "matrix")) expect_equal(dim(f222m223344), c(2,2,2)) expect_equal(dim(f222m223344[[2]]), c(3,3)) expect_equal(dim(f222m223344[[3]]), c(2,2)) expect_equal(dim(f222m223344[[5]]), c(4,4)) v <- infield1m22n( field1m22n() ) expect_equal(v, matrix(c(1L, 1L, 1L),3,1)) v <- infield11m22n( field11m22n() ) expect_equal(v, matrix(c(1L, 1L, 1L),3,1)) v <- infield12m22n( field12m22n() ) expect_equal(v, matrix(c(1L, 2L, 1L),3,1)) v <- infield21m22n( field21m22n() ) expect_equal(v, matrix(c(2L, 1L, 1L),3,1)) v <- infield22m2233n( field22m2233n() ) expect_equal(v, matrix(c(2L, 2L, 1L),3,1)) v <- infield222m223344n( field222m223344n() ) expect_equal(v, matrix(c(2L, 2L, 2L),3,1)) RcppArmadillo/inst/tinytest/test_complex.R0000644000176200001440000000414313644067760020513 0ustar liggesusers#!/usr/bin/r -t # # Copyright (C) 2013 - 2019 Baptiste Auguie and Dirk Eddelbuettel # Copyright (C) 2019 - 2020 Dirk Eddelbuettel # # This file is part of RcppArmadillo. # # RcppArmadillo is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. # # RcppArmadillo is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with RcppArmadillo. If not, see . library(RcppArmadillo) ## It now (Apr 2020) appears to fail on 32-bit Windows .onWindows <- .Platform$OS.type == "windows" .is32bit <- .Platform$r_arch == "i386" if (.onWindows && .is32bit) exit_file("Do not bother on 32-bit Windows") Rcpp::sourceCpp("cpp/complex.cpp") set.seed(123) ## create variables A <- matrix(rnorm(9), 3) B <- matrix(rnorm(9), 3) C <- A + 1i * B V <- rnorm(3) + 1i * rnorm(3) S <- matrix(rnorm(5*3), nrow=3) ## Basic operations rl <- complexCppTests(A, B, V, S) # returns results list from C++ expect_equal(rl[["C"]], C)#, msg="complex matrix") expect_equal(rl[["Cst"]], t(C))#, msg="complex matrix transpose") expect_equal(rl[["Ct"]], Conj(t(C)))#, msg="complex matrix transpose conjugated") expect_equal(rl[["conjC"]], Conj(C))#, msg="complex matrix conjugated") expect_equal(rl[["absC"]], Mod(C))#, msg="complex matrix mod") expect_equal(rl[["CV"]], C %*% V)#, msg="complex matrix product") expect_equal(rl[["CS"]], C %*% S)#, msg="complex matrix times vector") expect_equal(rl[["CC"]], C * C)#, msg="complex matrix ops mult") expect_equal(rl[["CdC"]], C / C)#, msg="complex matrix ops div") expect_equal(rl[["CpC"]], C + C)#, msg="complex matrix ops plus") expect_equal(rl[["CmC"]], C - C)#, msg="complex matrix ops minus") RcppArmadillo/inst/tinytest/test_fastLm.R0000644000176200001440000001061514061151744020261 0ustar liggesusers#!/usr/bin/r -t ## ## Copyright (C) 2010 - 2019 Dirk Eddelbuettel, Romain Francois and Douglas Bates ## ## This file is part of RcppArmadillo. ## ## RcppArmadillo is free software: you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by ## the Free Software Foundation, either version 2 of the License, or ## (at your option) any later version. ## ## RcppArmadillo is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with RcppArmadillo. If not, see . library(RcppArmadillo) library(datasets) #test.fastLm <- function() { data(trees, package="datasets") flm <- fastLmPure(cbind(1, log(trees$Girth)), log(trees$Volume)) fit <- lm(log(Volume) ~ log(Girth), data=trees) expect_equal(as.numeric(flm$coefficients), as.numeric(coef(fit)))#,msg="fastLm.coef") expect_equal(as.numeric(flm$stderr), as.numeric(coef(summary(fit))[,2]))#,msg="fastLm.stderr") expect_equal(as.numeric(flm$df.residual), as.numeric(fit$df.residual))#,msg="fastLm.df.residual") #test.fastLm.default <- function() { data(trees, package="datasets") flm <- RcppArmadillo:::fastLm.default(cbind(1, log(trees$Girth)), log(trees$Volume)) fit <- lm(log(Volume) ~ log(Girth), data=trees) expect_equal(as.numeric(flm$coefficients), as.numeric(coef(fit)))#,msg="fastLm.default.coef") expect_equal(as.numeric(flm$stderr), as.numeric(coef(summary(fit))[,2]))#,msg="fastLm.default.stderr") expect_equal(as.numeric(flm$df.residual), as.numeric(fit$df.residual))#,msg="fastLm.default.df.residual") expect_equal(as.numeric(flm$residuals), as.numeric(fit$residuals))#,msg="fastLm.default.residuals") expect_equal(as.numeric(flm$fitted.values), as.numeric(fit$fitted.values))#,msg="fastLm.default.fitted.values") #test.summary.fastLm <- function() { data(trees, package="datasets") sflm <- summary(fastLm(log(Volume) ~ log(Girth), data=trees)) sfit <- summary(lm(log(Volume) ~ log(Girth), data=trees)) expect_equal(as.numeric(coef(sflm)), as.numeric(coef(sfit)))#,msg="summary.fastLm.coef") expect_equal(sflm$r.squared, sfit$r.squared)#,msg="summary.fastLm.r.squared") expect_equal(sflm$adj.r.squared, sfit$adj.r.squared)#,msg="summary.fastLm.r.squared") expect_equal(sflm$sigma, sfit$sigma)#,msg="summary.fastLm.sigma") ## no intercept case sflm <- summary(fastLm(log(Volume) ~ log(Girth) - 1, data=trees)) sfit <- summary(lm(log(Volume) ~ log(Girth) - 1, data=trees)) expect_equal(as.numeric(coef(sflm)), as.numeric(coef(sfit)))#,msg="summary.fastLm.coef.noint") expect_equal(sflm$r.squared, sfit$r.squared)#,msg="summary.fastLm.r.squared.noint") expect_equal(sflm$adj.r.squared, sfit$adj.r.squared)#,msg="summary.fastLm.r.squared.noint") expect_equal(sflm$sigma, sfit$sigma)#,msg="summary.fastLm.sigma.noint") ## non-formula use sflm <- summary(fastLm(log(trees$Girth), log(trees$Volume))) sfit <- summary(lm(log(Volume) ~ log(Girth) - 1, data=trees)) expect_equal(as.numeric(coef(sflm)), as.numeric(coef(sfit)))#,msg="summary.fastLm.coef.nonform") expect_equal(sflm$r.squared, sfit$r.squared)#,msg="summary.fastLm.r.squared.nonform") expect_equal(sflm$adj.r.squared, sfit$adj.r.squared)#,msg="summary.fastLm.r.squared.nonform") expect_equal(sflm$sigma, sfit$sigma)#,msg="summary.fastLm.sigma.nonform") #test.fastLm.formula <- function() { data(trees, package="datasets") flm <- fastLm(log(Volume) ~ log(Girth), data=trees) fit <- lm(log(Volume) ~ log(Girth), data=trees) expect_equal(flm$coefficients, coef(fit))#, msg="fastLm.formula.coef") expect_equal(as.numeric(flm$stderr), as.numeric(coef(summary(fit))[,2]))#,msg="fastLm.formula.stderr") expect_equal(as.numeric(flm$df.residual), as.numeric(fit$df.residual))#,msg="fastLm.formula.df.residual") expect_equal(as.numeric(flm$residuals), as.numeric(fit$residuals))#,msg="fastLm.formula.residuals") expect_equal(as.numeric(flm$fitted.values), as.numeric(fit$fitted.values))#,msg="fastLm.formula.fitted.values") ## also tickle print and predict methods expect_stdout(print(flm)) expect_stdout(print(summary(flm))) vec <- predict(flm, newdata=data.frame(Girth=c(1,2,3), Volume=c(2,3,4))) expect_equal(class(vec), "numeric") expect_equal(length(vec), 3L) vec <- predict(flm, newdata=NULL) expect_equal(vec, fitted(flm)) RcppArmadillo/inst/tinytest/test_Rlapack.R0000644000176200001440000000362314216402745020413 0ustar liggesusers#!/usr/bin/r -t # # Copyright (C) 2018 - 2022 Keith O'Hara and Dirk Eddelbuettel # Copyright (C) 2019 - 2022 Dirk Eddelbuettel # # This file is part of RcppArmadillo. # # RcppArmadillo is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. # # RcppArmadillo is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with RcppArmadillo. If not, see . library(RcppArmadillo) if (isFALSE(tryCatch({svd(matrix(complex(1, 1, 1),1,1)); TRUE}, error=function(e) FALSE))) exit_file("Skipping for lack of Fortran complex functions in this R build") Rcpp::sourceCpp("cpp/Rlapack.cpp") set.seed(123) ## create variables n <- 5 # size the of matrices generated in tests n_tri <- 50 # size the of matrices generated in tridiagonal tests ## Basic operations rl1 <- norm(cx_eig_pair_test(n),"2") rl2 <- norm(cx_qz_test(n),"2") rl3 <- cx_rank_test(n) # should equal n rl4 <- norm(cx_solve_test(n),"2") rl5 <- norm(cx_solve_band_test(n_tri),"2") rl6 <- norm(cx_pinv_test(n),"2") # should be (approx) an identity matrix rl7 <- norm(cx_schur_test(n),"2") expect_equal(rl1, 0)#, msg="eig_pair for complex matrices") expect_equal(rl2, 0)#, msg="qz for complex matrices") expect_equal(rl3, n)#, msg="rank complex matrices") expect_equal(rl4, 0)#, msg="solve for complex matrices") expect_equal(rl5, 0)#, msg="solve for band complex matrices") expect_equal(rl6, 1)#, msg="pinv for complex matrices") expect_equal(rl7, 0)#, msg="schur for complex matrices") RcppArmadillo/inst/tinytest/test_scipy2r.R0000644000176200001440000000527314605515647020444 0ustar liggesusers## py2r.R: Conversion of SciPy sparse matrix to R ## ## Copyright (C) 2017 - 2022 Binxiang Ni and Dirk Eddelbuettel ## ## This file is part of RcppArmadillo. ## ## RcppArmadillo is free software: you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by ## the Free Software Foundation, either version 2 of the License, or ## (at your option) any later version. ## ## RcppArmadillo is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with RcppArmadillo. If not, see . ## Reference: https://docs.scipy.org/doc/scipy-0.19.1/reference/sparse.html #exit_file("Skip this test for now.") ## It now (Apr 2020) appears to fail on 32-bit Windows .onWindows <- .Platform$OS.type == "windows" .is32bit <- .Platform$r_arch == "i386" #if (.onWindows && .is32bit) exit_file("Do not bother on 32-bit Windows") if (.onWindows) exit_file("Do not bother on Windows") if (!requireNamespace("Matrix", quietly=TRUE)) exit_file("Package Matrix missing") if (!requireNamespace("reticulate", quietly=TRUE)) exit_file("Package reticulate missing") if (!packageVersion("reticulate") >= package_version("1.14")) exit_file("SciPy not needed on newer reticulate") suppressMessages({ library(Matrix) library(reticulate) }) ## SciPy implies NumPy too if (! py_module_available("scipy")) exit_file("Module scipy missing") np <- import("numpy") mat <- np$array(list(list(1, 0, 4), list(0, 0, 5), list(2, 3, 6))) sp <- import("scipy.sparse") mtxt <- c("1 0 4", "0 0 5", "2 3 6") M <- as.matrix(read.table(text=mtxt)) dimnames(M) <- NULL ## Since 'reticulate' automatically converts CSC matrix to dgCMatrix, ## no need to convert it in RcppArmadillo #test.csc2dgc <- function() { csc <- sp$csc_matrix(mat) dgC <- methods::as(M, "CsparseMatrix") expect_equal(dgC, csc, info="csc2dgc") #test.coo2dgt <- function() { coo <- sp$coo_matrix(mat) dgT <- new("dgTMatrix", i = c(0L, 0L, 1L, 2L, 2L, 2L), j = c(0L, 2L, 2L, 0L, 1L, 2L), x = c(1, 4, 5, 2, 3, 6), Dim = c(3L, 3L)) expect_equal(dgT, coo, info="coo2dgt") #RcppArmadillo:::.SciPy2R(coo)) #test.csr2dgr <- function() { csr <- sp$csr_matrix(mat) dgR <- methods::as(M, "RsparseMatrix") expect_equal(dgR, csr, info="csr2dgr") #RcppArmadillo:::.SciPy2R(csr)) #test.other <- function() { #bsr <- sp$bsr_matrix(list(3, 4)) #expect_error(RcppArmadillo:::.SciPy2R(bsr)) #expect_error(sp$bsr_matrix(list(3, 4))) RcppArmadillo/inst/tinytest/test_sparse.R0000644000176200001440000000630614777174767020362 0ustar liggesusers#!/usr/bin/r -t ## ## Copyright (C) 2014 - 2025 Dirk Eddelbuettel ## ## This file is part of RcppArmadillo. ## ## RcppArmadillo is free software: you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by ## the Free Software Foundation, either version 2 of the License, or ## (at your option) any later version. ## ## RcppArmadillo is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with RcppArmadillo. If not, see . if (!requireNamespace("Matrix", quietly=TRUE)) exit_file("No Matrix package") suppressMessages(require(Matrix)) library(RcppArmadillo) Rcpp::sourceCpp("cpp/sparse.cpp") ## setting up an example matrix -- using the fact that the as ## converter prefers sparse matrix objects created by the Matrix package ## cf http://people.sc.fsu.edu/~jburkardt/data/st/st.html mtxt <- c("11 0 0 14 0 16", " 0 22 0 0 25 26", " 0 0 33 34 0 36", "41 0 43 44 0 46") M <- as.matrix(read.table(text=mtxt)) dimnames(M) <- NULL SM <- Matrix(M, sparse=TRUE) #test.as.sparse <- function() { expect_equal(SM, asSpMat(SM))#, msg="as") #test.sparse.addition <- function() { expect_equal(SM + SM, sparseAddition(SM))#, msg="addSparse") #test.sparse.multiplication <- function() { k <- 3 expect_equal(k*SM, sparseMultiplication(SM, k))#, msg="multSparse") #test.sparse.fromTriplet <- function() { mtxt <- c("0 0 1", "0 2 0", "3 0 0") M <- as.matrix(read.table(text=mtxt)) dimnames(M) <- NULL SM <- Matrix(M, sparse=TRUE) spM <- fromTriplet(0:2, # rows 2:0, # cols 1:3) # values expect_equal(SM, spM)#, msg="fromTriplet") #test.sparse.transpose <- function() { expect_equal(t(SM), sparseTranspose(SM))#, msg="transposeSparse") #test.sparse.sqrt <- function() { expect_equal(sqrt(SM), sparseSqrt(SM))#, msg="sqrtSparse") #test.sparse.square <- function() { expect_equal(SM^2, sparseSquare(SM))#, msg="squareSparse") if (utils::packageVersion("Matrix") < "1.4-2") exit_file("Remainder needs Matrix 1.4-2 or later") #test.sparse.iterators <- function() { SM <- matrix(0, 5, 5) diag(SM) <- 1:5 SM <- methods::as(methods::as(SM, "generalMatrix"), "CsparseMatrix") spM <- sparseIterators(SM, -1.5) diag(SM) <- diag(SM) - 1.5 expect_equal(SM, spM)#, msg="sparseIterators") #test.sparse.list <- function() { SM <- matrix(0, 5, 5) diag(SM) <- 1:5 SM <- methods::as(methods::as(SM, "generalMatrix"), "CsparseMatrix") l <- list(SM, SM) expect_equal(l, sparseList(l))#, msg="sparseList") #test.speye <- function() { SM <- speye(4, 4) SM2 <- sparseMatrix(i = c(1:4), j = c(1:4), x = 1) expect_equal(SM, SM2)#, msg="speye") SM <- speye(3, 5) SM2 <- sparseMatrix(i = c(1:3), j = c(1:3), x = 1, dims = c(3, 5)) expect_equal(SM, SM2)#, msg="speye") SM <- speye(5, 3) SM2 <- sparseMatrix(i = c(1:3), j = c(1:3), x = 1, dims = c(5, 3)) expect_equal(SM, SM2)#, msg="speye") RcppArmadillo/inst/tinytest/test_rcpparmadillo.R0000644000176200001440000001543414203031300021647 0ustar liggesusers#!/usr/bin/r -t # # Copyright (C) 2010 - 2019 Dirk Eddelbuettel, Romain Francois and Douglas Bates # Copyright (C) 2019 - 2022 Dirk Eddelbuettel # # This file is part of RcppArmadillo. # # RcppArmadillo is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. # # RcppArmadillo is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with RcppArmadillo. If not, see . library(RcppArmadillo) Rcpp::sourceCpp("cpp/armadillo.cpp") ## test.wrap.R fx <- wrap_ res <- fx() expect_equal( res[[1]][[1]], matrix(as.integer((diag(3))),nr=3))#, msg = "eye(3,3)" ) expect_equal( res[[1]][[2]], diag(3))#, msg = "eye(3,3)" ) expect_equal( res[[1]][[3]], diag(3))#, msg = "eye(3,3)" ) expect_equal( res[[1]][[4]], matrix(as.integer((diag(3))),nr=3))#, msg = "eye(3,3)" ) expect_equal( res[[2]][[1]], matrix(0, ncol = 5, nrow=1))#, msg = "zeros(5,1)" ) expect_equal( res[[2]][[2]], matrix(0, ncol = 5, nrow=1))#, msg = "zeros(5,1)" ) expect_equal( res[[3]][[1]], matrix(0, ncol = 1, nrow=5))#, msg = "zeros(1,5)" ) expect_equal( res[[3]][[2]], matrix(0, ncol = 1, nrow=5))#, msg = "zeros(1,5)" ) if (!has_old_field_behavior()) { expect_equal( res[[4]][[1]], array(0:3, dim=c(2,2,1)))#, msg = "field" ) expect_equal( res[[4]][[2]], array(letters[1:4], dim=c(2,2,1)))#, msg = "field" ) } # test.wrap.Glue <- function(){ fx <- wrapGlue_ res <- fx() expect_equal( res[[1]], 2*diag(3))#, msg = "wrap(Glue)" ) # test.wrap.Op <- function(){ fx <- wrapOp_ res <- fx() expect_equal( res[[1]], -1*diag(3))#, msg = "wrap(Op)" ) # test.as.Mat <- function(){ fx <- asMat_ integer_mat <- matrix( as.integer(diag(4)), ncol = 4, nrow = 4 ) numeric_mat <- diag(5) res <- fx( list( integer_mat, numeric_mat ) ) expect_equal( unlist( res), c(4L, 5L, 4L, 5L ))#, msg = "as" ) #} #test.as.Col <- function(){ fx <- asCol_ res <- fx( list( 1:10, as.numeric(1:10) ) ) expect_equal( unlist( res ), rep(55.0, 4 ))#, msg = "as" ) #} #test.as.Row <- function(){ fx <- asRow_ res <- fx( list( 1:10, as.numeric(1:10) ) ) expect_equal( unlist( res ), rep(55.0, 4 ))#, msg = "as" ) #test.cxmat <- function(){ fx <- cxMat_ expect_equal(fx(), list(double=(1+0i)*diag(3), float=(1+0i)*diag(3))) #,msg = "support for complex matrices" ) #test.mtOp <- function(){ fx <- mtOp_ expect_equal(fx(), (1+2i)*diag(3))#, msg = "support for mtOp" ) #test.mtGlue <- function(){ fx <- mtGlue_ expect_equal(fx(), 2.0 * diag(3))# , msg = "support for mtGlue" ) #test.sugar <- function(){ fx <- sugar_ expect_equal(fx(1:10), matrix( 2*(1:10), nrow = 10 ))# , msg = "RcppArmadillo and sugar" ) #test.sugar.cplx <- function(){ fx <- sugarCplx_ x <- 1:10*(1+1i) expect_equal(fx(x), matrix( exp(x), nrow = 10 ))# , msg = "RcppArmadillo and sugar (complex)" ) #test.armadillo.sugar.ctor <- function(){ fx <- sugarCtor_ expect_equal(fx(1:10), list(mat = matrix( 4*(1:10), nrow = 10 ), rowvec = matrix( 1:10, nrow = 1 ), colvec = matrix( 1:10, ncol = 1 ))) #,msg = "Mat( sugar expression )" ) #test.armadillo.sugar.matrix.ctor <- function(){ fx <- sugarMatrixCtor_ res <- fx(1:10) norm <- function(x, y) sqrt( x*x + y*y ) expect_equal(res, list(mat = diag(2*(1:10)), rowvec = outer( 1, 1:10, norm ), colvec = outer( 1:10, 1, norm ))) #msg = "Mat( sugar expression )" ) ## test.armadillo.rtti.check <- function() { ## inc <- ' ## void blah(arma::mat& X) { ## X.set_size(5,5); ## } ## ' ## src <- ' ## arma::vec V; ## blah(V); // if blah() worked, we have a problem ## ' ## fun <- cxxfunction(signature(), body=src, inc=inc, plugin = "RcppArmadillo") ## checkException(fun(), msg="RTTI check on matrix constructor exception") ## } #test.armadillo.mat.plain <- function() { fx <- mat_plain m <- matrix(1:9, 3, 3) expect_equal(fx(m), 9)#, msg = "Plain Matrix function signature" ) #test.armadillo.mat.const <- function() { fx <- mat_const m <- matrix(1:9, 3, 3) expect_equal(fx(m), 9)#, msg = "Const Matrix function signature" ) #test.armadillo.mat.ref <- function() { fx <- mat_ref m <- matrix(1:9, 3, 3) expect_equal(fx(m), 9)#, msg = "Reference Matrix function signature" ) #test.armadillo.mat.const.ref <- function() { fx <- mat_const_ref m <- matrix(1:9, 3, 3) expect_equal(fx(m), 9)#, msg = "Const Reference Matrix function signature" ) #test.armadillo.vec.plain <- function() { fx <- vec_plain m <- 1:9 expect_equal(fx(m), 9)#, msg = "Plain Vector function signature" ) #test.armadillo.vec.const <- function() { fx <- vec_const m <- 1:9 expect_equal(fx(m), 9)#, msg = "Const Vector function signature" ) #test.armadillo.vec.ref <- function() { fx <- vec_ref m <- 1:9 expect_equal(fx(m), 9)#, msg = "Reference Vector function signature" ) #test.armadillo.vec.const.ref <- function() { fx <- vec_const_ref m <- 1:9 expect_equal(fx(m), 9)#, msg = "Const Reference Vector function signature" ) #test.armadillo.mat.plain <- function() { fx <- cx_mat_plain m <- matrix(1:9, 3, 3) expect_equal(fx(m), 9)#, msg = "Plain Matrix function signature" ) #test.armadillo.mat.const <- function() { fx <- cx_mat_const m <- matrix(1:9, 3, 3) expect_equal(fx(m), 9)#, msg = "Const Matrix function signature" ) #test.armadillo.mat.ref <- function() { fx <- cx_mat_ref m <- matrix(1:9, 3, 3) expect_equal(fx(m), 9)#, msg = "Reference Matrix function signature" ) #test.armadillo.mat.const.ref <- function() { fx <- cx_mat_const_ref m <- matrix(1:9, 3, 3) expect_equal(fx(m), 9)#, msg = "Const Reference Matrix function signature" ) Rcpp::sourceCpp("cpp/colrow_as_vec.cpp") vec <- as.matrix(1:3) expect_equal(vec, uvec_test(vec)) expect_equal(vec, c_uvec_test(vec)) expect_equal(vec, r_uvec_test(vec)) expect_equal(vec, cr_uvec_test(vec)) mat <- matrix(1:4, nrow=2) expect_equal(mat, umat_test(mat)) expect_equal(mat, c_umat_test(mat)) expect_equal(mat, r_umat_test(mat)) expect_equal(mat, cr_umat_test(mat)) Rcpp::sourceCpp("cpp/any_as_vec.cpp") vec <- 1:3 vecc <- as.matrix(1:3) vecr <- t(vecc) expect_equal(vecc, vecc_test(vec))#, msg="legacy vec") expect_equal(vecr, vecr_test(vecr))#, msg="legacy rowvec") expect_equal(vec, vecc_as_v_test(vec))#, msg="vec as vector") expect_equal(vec, vecr_as_v_test(vec))#, msg="rowvec as vector") expect_equal(vec, veccany_as_v_test(vec))#, msg="vec (by any) as vector") expect_equal(vec, vecrany_as_v_test(vec))#, msg="rowvec (by any) as vector") RcppArmadillo/inst/tinytest/test_cube.R0000644000176200001440000000627714676354223017773 0ustar liggesusers#!/usr/bin/r -t # # Copyright (C) 2015 - 2021 Dirk Eddelbuettel and Nathan Russell # Copyright (C) 2019 Dirk Eddelbuettel # # This file is part of RcppArmadillo. # # RcppArmadillo is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. # # RcppArmadillo is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with RcppArmadillo. If not, see . library(RcppArmadillo) Rcpp::sourceCpp("cpp/cube.cpp") .onWindows <- .Platform$OS.type == "windows" critTol <- if (.onWindows) 1.0e-6 else 1.5e-7 ## test arrays dbl_cube <- array(1.5:27.5, rep(3, 3)) int_cube <- array(1L:27L, rep(3, 3)) cplx_cube <- array(1.5:27.5 + 2i, rep(3, 3)) ## check cube (Cube) and fcube (Cube) expect_equal(cube_test(dbl_cube), (dbl_cube ** 2)) #, "cube_test") expect_equal(fcube_test(dbl_cube), (dbl_cube ** 2)) #, "fcube_test") ## check icube (Cube) and ucube (Cube) expect_equal(icube_test(int_cube), (int_cube ** 2)) #, "icube_test") expect_equal(ucube_test(int_cube), (int_cube ** 2)) #, "ucube_test") ## check cx_cube (Cube) and cx_fcube (Cube) expect_equal(cx_cube_test(cplx_cube), (cplx_cube ** 2)) #, "cx_cube_test") expect_equivalent(cx_fcube_test(cplx_cube), (cplx_cube ** 2), #"cx_fcube_test", tolerance = critTol) ## test that exception is thrown with dims(x) != 3 dbl_cube <- array(1.5:16.5, rep(2, 4)) int_cube <- array(1L:16L, rep(2, 4)) cplx_cube <- array(1.5:16.5 + 2i, rep(2, 4)) ## cube_test and fcube_test should throw here expect_error(cube_test(dbl_cube)) #"cube_test bad dimensions") expect_error(fcube_test(dbl_cube)) #"fcube_test bad dimensions") ## icube_test and ucube_test should throw here expect_error(icube_test(int_cube)) #"icube_test bad dimensions") expect_error(ucube_test(int_cube)) #"ucube_test bad dimensions") ## cx_cube_test and cx_fcube_test should throw here expect_error(cx_cube_test(cplx_cube)) #"cx_cube_test bad dimensions") expect_error(cx_fcube_test(cplx_cube)) #"cx_fcube_test bad dimensions") ## sanity check for explicit calls to Rcpp::as< arma::Cube > dbl_cube <- array(1.5:27.5, rep(3, 3)) int_cube <- array(1L:27L, rep(3, 3)) cplx_cube <- array(1.5:27.5 + 2i, rep(3, 3)) ## check cube (Cube) and fcube (Cube) expect_equal(as_cube(dbl_cube), (dbl_cube ** 2))#, "as_cube") expect_equal(as_fcube(dbl_cube), (dbl_cube ** 2))#, "as_fcube") ## check icube (Cube) and ucube (Cube) expect_equal(as_icube(int_cube), (int_cube ** 2))#, "as_icube") expect_equal(as_ucube(int_cube), (int_cube ** 2))#, "as_ucube") ## check cx_cube (Cube) and cx_fcube (Cube) expect_equal(as_cx_cube(cplx_cube), (cplx_cube ** 2))#, "as_cx_cube") expect_equivalent(as_cx_fcube(cplx_cube), (cplx_cube ** 2), #"as_cx_fcube", tolerance = critTol) RcppArmadillo/inst/tinytest/test_rng.R0000644000176200001440000000335214701771373017630 0ustar liggesusers#!/usr/bin/r -t # # Copyright (C) 2014 - 2019 Dirk Eddelbuettel # # This file is part of RcppArmadillo. # # RcppArmadillo is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. # # RcppArmadillo is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with RcppArmadillo. If not, see . library(RcppArmadillo) Rcpp::sourceCpp("cpp/rng.cpp") #test.randu.seed <- function() { set.seed(123) a <- randu(10) set.seed(123) b <- randu(10) expect_equal(a, b)#, msg="randu seeding") #test.randi.seed <- function() { set.seed(123) a <- randi(10) set.seed(123) b <- randi(10) expect_equal(a, b)#, msg="randi seeding") #test.randn.seed <- function() { set.seed(123) a <- randn(10) set.seed(123) b <- randn(10) expect_equal(a, b)#, msg="randn seeding") #test.randu <- function() { set.seed(123) a <- randu(10) expect_true(min(a) > 0)#, msg="randu min") expect_true(max(a) < 1)#, msg="randu max") #test.randi <- function() { set.seed(123) a <- randi(10) expect_true(min(a) > 0)#, msg="randi min") ## under ARMA_64BIT_WORD we get 'double' expect_true(typeof(a) == "integer" || typeof(a) == "double")#, msg="randi type") #test.randn <- function() { set.seed(123) a <- randn(10) expect_true(min(a) > -4)#, msg="randn min") expect_true(max(a) < 4)#, msg="randn max") expect_true(typeof(a) == "double")#, msg="randi type") RcppArmadillo/inst/tinytest/test_sparseConversion.R0000644000176200001440000006226114323776731022414 0ustar liggesusers#!/usr/bin/r -t ## ## Copyright (C) 2017 - 2022 Binxiang Ni and Dirk Eddelbuettel ## ## This file is part of RcppArmadillo. It is based on the documentation ## of package Matrix, slam, SparseM, spam and SciPy, which are ## respectively created by developers of the packages: Douglas Bates, ## Martin Maechler; Kurt Hornik, David Meyer, Christian Buchta; Roger ## Koenker, Pin Ng; Reinhard Furrer, Florian Gerber, Daniel Gerber, ## Kaspar Moesinger, Youcef Saad, Esmond G. Ng, Barry W. Peyton, Joseph ## W.H. Liu, Alan D. George; the developers of SciPy. It is also ## modified by Binxiang Ni. ## ## RcppArmadillo is free software: you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by ## the Free Software Foundation, either version 2 of the License, or ## (at your option) any later version. ## ## RcppArmadillo is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with RcppArmadillo. If not, see . ## Reference: ## [Matrix]: https://cran.r-project.org/web/packages/Matrix/Matrix.pdf ## [slam]: https://cran.r-project.org/web/packages/slam/slam.pdf ## [SparseM]: https://cran.r-project.org/web/packages/SparseM/SparseM.pdf ## [spam]: https://cran.r-project.org/web/packages/spam/spam.pdf ## [SciPy]: https://docs.scipy.org/doc/scipy/reference/sparse.html if (!requireNamespace("Matrix", quietly=TRUE)) exit_file("No Matrix package") if (utils::packageVersion("Matrix") < "1.4-2") exit_file("Need Matrix 1.4-2 or later") ## It now (Nov 2020) appears to fail on Windows starting around line 115 .onWindows <- .Platform$OS.type == "windows" library(RcppArmadillo) Rcpp::sourceCpp("cpp/sparse.cpp") ## setting up an example matrix -- using the fact that the as ## converter prefers sparse matrix objects create by the Matrix package suppressMessages({ library(Matrix) library(stats) ## Per email with Martin Maechler, hard to suppress such messages on ## first (and only) use of particular dispatches. So simply running ## twice: once silent, and again to test and possibly fail visibly. kronecker(Diagonal(3), Matrix(0+0:5, 3, 2)) ## n1 <- 10 p <- 5 a <- rnorm(n1*p) a[abs(a)<0.5] <- 0 A <- matrix(a,n1,p) RA <- as(A, "RsparseMatrix") dgt <- RA %x% matrix(1:4,2,2) }) #test.as.dgc2dgc <- function() { ## [Matrix] p10 (dgCMatrix) set.seed(7) m <- matrix(0, 5, 5) m[sample(length(m), size = 14)] <- rep(1:9, length=14) mm <- as(m, "CsparseMatrix") expect_equal(mm, asSpMat(mm))#, msg="dgC2dgC_1") ## [Matrix] p36 (dgCMatrix) m <- Matrix(c(0,0,2:0), 3,5) expect_equal(m, asSpMat(m))#, msg="dgC2dgC_2") ## [Matrix] p74 (dgCMatrix) set.seed(27) IM1 <- as(sample(1:20, 100, replace=TRUE), "indMatrix") set.seed(27) IM2 <- as(sample(1:18, 100, replace=TRUE), "indMatrix") c12 <- as(crossprod(IM1,IM2), "CsparseMatrix") expect_equal(c12, asSpMat(c12))#, msg="dgC2dgC_3") ## [Matrix] p87 (dgCMatrix) m <- Matrix(c(0,0,2:0), 3,5, dimnames=list(LETTERS[1:3],NULL)) m <- unname(m) expect_equal(m, asSpMat(m))#, msg="dgC2dgC_4") ## [Matrix] p118 (dgCMatrix) f1 <- gl(5, 3, labels = LETTERS[1:5]) X <- as(f1, "sparseMatrix") X <- unname(X) expect_equal(X, asSpMat(X))#, msg="dgC2dgC_5") ## [Matrix] p142 (dgCMatrix) i <- c(1,3:8); j <- c(2,9,6:10); x <- 7 * (1:7) A <- sparseMatrix(i, j, x = x) expect_equal(A, asSpMat(A))#, msg="dgC2dgC_6") ## [slam] p4 (dgCMatrix) x <- matrix(c(1, 0, 0, 2, 1, 0), nrow = 3) SM <- Matrix(x, sparse = TRUE) expect_equal(SM, asSpMat(SM))#, msg="dgC2dgC_7") ## [slam] p9 (dgCMatrix) x <- matrix(c(1, 0, 0, 2, 1, NA), nrow = 2) SM <- Matrix(x, sparse = TRUE) expect_equal(SM, asSpMat(SM))#, msg="dgC2dgC_8") if (.onWindows) exit_file("Skipping remainder on Windows") ## [slam] p12 (dgCMatrix) if (utils::packageVersion("Matrix") >= "1.3.0") { x <- matrix(c(1, 0, 0, 2), nrow = 2) SM <- Matrix(x, sparse = TRUE, doDiag=FALSE) dgc <- as(SM, "generalMatrix") expect_equal(dgc, asSpMat(SM))#, msg="dgC2dgC_9") } ## [SparseM] p21 (dgCMatrix) set.seed(21) a <- rnorm(20*5) A <- matrix(a,20,5) A[row(A)>col(A)+4|row(A)col(A)+2|row(A)= "1.3.0") { set.seed(129) T2 <- rsparsematrix(40, 12, nnz = 99, repr="T") dgc <- as(T2, "CsparseMatrix") expect_equal(dgc, asSpMat(T2))#, msg="dgT2dgC_8") } ## [Matrix] p152 (dgTMatrix) A <- spMatrix(10,20, i = c(1,3:8), j = c(2,9,6:10), x = 7 * (1:7)) dgc <- as(A, "CsparseMatrix") expect_equal(dgc, asSpMat(A))#, msg="dgT2dgC_9") ## [SparseM] p21 (dgTMatrix) set.seed(21) a <- rnorm(20*5) A <- matrix(a,20,5) A[row(A)>col(A)+4|row(A)col(A)+2|row(A) 1) ## checkException(asSpMat(lm)) ## # [Matrix] p152 (lgTMatrix) ## L <- spMatrix(9, 30, i = rep(1:9, 3), 1:27, ## (1:27) %% 4 != 1) ## checkException(asSpMat(L)) ## ## [Matrix] p111 (ngCMatrix) ## m <- Matrix(c(0,0,2:0), 3,5, dimnames=list(LETTERS[1:3],NULL)) ## dimnames(m) <- NULL ## nm <- as(m, "nsparseMatrix") ## checkException(asSpMat(nm)) ## ## [Matrix] p74 (ngTMatrix) ## sm1 <- as(rep(c(2,3,1), e=3), "indMatrix") ## ngt <- as(sm1, "ngTMatrix") ## checkException(asSpMat(ngt)) ## ## [Matrix] p85 (ntTMatrix) ## lM <- Diagonal(x = c(TRUE,FALSE,FALSE)) ## nM <- as(lM, "nMatrix") ## checkException(asSpMat(nM)) ## ## [Matrix] p85 (nsCMatrix) ## nsc <- crossprod(nM) ## checkException(asSpMat(nsc)) ## ## [Matrix] p42 (ldiMatrix) ## ldi <- Diagonal(x = (1:4) >= 2) ## checkException(asSpMat(ldi)) ## } ## test.as.lgc2dgc <- function() { ## ## [Matrix] p87 (lgCMatrix) (To be continued) ## lm <- (m > 1) ## ## ## [Matrix] p111 (lgCMatrix) (To be continued) ## m <- Matrix(c(0,0,2:0), 3,5, dimnames=list(LETTERS[1:3],NULL)) ## dimnames(m) <- NULL ## nm <- as(m, "nsparseMatrix") ## nnm <- !nm # no longer sparse ## nnm <- as(nnm, "sparseMatrix") ## } ## ## test.as.lgt2dgc <- function() { ## ## [Matrix] p152 (lgTMatrix) (To be continued) ## L <- spMatrix(9, 30, i = rep(1:9, 3), 1:27, ## (1:27) %% 4 != 1) ## } ## ## test.as.ngc2dgc <- function() { ## ## [Matrix] p111 (ngCMatrix) (To be continued) ## m <- Matrix(c(0,0,2:0), 3,5, dimnames=list(LETTERS[1:3],NULL)) ## dimnames(m) <- NULL ## nm <- as(m, "nsparseMatrix") ## ## ## [Matrix] p129 (ngCMatrix) (To be continued) ## n7 <- rsparsematrix(5, 12, nnz = 10, rand.x = NULL) ## } ## ## test.as.ngt2dgc <- function() { ## # [Matrix] p74 (ngTMatrix) (To be continued) ## sm1 <- as(rep(c(2,3,1), e=3), "indMatrix") ## ngt <- as(sm1, "ngTMatrix") ## mtxt <- c("0 1 0", ## "0 1 0", ## "0 1 0", ## "0 0 1", ## "0 0 1", ## "0 0 1", ## "1 0 0", ## "1 0 0", ## "1 0 0") ## M <- as.matrix(read.table(text=mtxt)) ## dimnames(M) <- NULL ## dgc <- as(M, "dgCMatrix") ## expect_equal(dgc, asSpMat(ngt))#, msg="ngT2dgC") ## ## set.seed(27) ## s10 <- as(sample(10, 30, replace=TRUE),"indMatrix") ## ngt <- s10[1:7, 1:4] ## mtxt <- c("0 0 0 0", ## "1 0 0 0", ## "0 0 0 0", ## "0 0 0 1", ## "0 0 1 0", ## "0 0 0 0", ## "1 0 0 0") ## M <- as.matrix(read.table(text=mtxt)) ## dimnames(M) <- NULL ## dgc <- as(M, "dgCMatrix") ## expect_equal(dgc, asSpMat(ngt))#, msg="ngT2dgC") ## ## ## [Matrix] p116 (ngTMatrix) (To be continued) ## pm1 <- as(as.integer(c(2,3,1)), "pMatrix") ## as(pm1, "ngTMatrix") ## set.seed(11) ## p10 <- as(sample(10),"pMatrix") ## p10[1:7, 1:4] ## } ## ## test.as.ntt2dgc <- function() { ## ## [Matrix] p85 (ntTMatrix) (To be continued) ## lM <- Diagonal(x = c(TRUE,FALSE,FALSE)) ## nM <- as(lM, "nMatrix") ## expect_equal(dgc, asSpMat(nM))#, msg="ntT2dgC") ## } ## ## test.as.nsc2dgc <- function() { ## ## [Matrix] p85 (nsCMatrix) (To be continued) ## lM <- Diagonal(x = c(TRUE,FALSE,FALSE)) ## nM <- as(lM, "nMatrix") ## nsc <- crossprod(nM) ## expect_equal(dgc, asSpMat(nsc))#, msg="nsC2dgC") ## } ## ## test.as.ldi2dgc <- function() { ## ## [Matrix] p42 (ldiMatrix) (To be continued) ## Diagonal(x = (1:4) >= 2) ## ## ## [Matrix] p85 (ldiMatrix) (To be continued) ## lM <- Diagonal(x = c(TRUE,FALSE,FALSE)) ## } RcppArmadillo/inst/tinytest/test_rmultinom.R0000644000176200001440000000424613537314632021070 0ustar liggesusers#!/usr/bin/r -t ## ## Copyright (C) 2013 Romain Francois ## Copyright (C) 2014 - 2019 Christian Gunning and Dirk Eddelbuettel ## Copyright (C) 2019 Dirk Eddelbuettel ## ## This file is part of RcppArmadillo. ## ## RcppArmadillo is free software: you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by ## the Free Software Foundation, either version 2 of the License, or ## (at your option) any later version. ## ## RcppArmadillo is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with RcppArmadillo. If not, see . .runThisTest <- isTRUE(capabilities("long.double")) if (!.runThisTest) exit_file("No long double support") library(RcppArmadillo) Rcpp::sourceCpp("cpp/rmultinom.cpp") ## Seed needs to be reset to compare R to C++ .seed=39 ## test cases ## should be indentical between R and C++ tests <- list( vanilla=list( n=5, size=100, prob=rep(1/10,10)), big=list( n=5, size=1e6, prob=rep(1/1e3,1e3)), fixup.prob=list( n=10, size=1e5, prob=1:10), n0=list( n=0, size=5, prob=1:10), size0=list( n=10, size=0, prob=1:10) ) fail.tests <- list( na.prob=list( n=7, size=100, prob=c(1:10,NA)), prob0=list( n=10, size=100, prob=0) ) ## these give errors lapply(names(fail.tests), function(.name) { with(fail.tests[[.name]], { expect_error(rmultinom(n, size, prob)) #msg=sprintf("rmultinom.R.error.%s",.name) }) with(fail.tests[[.name]], { expect_error(rmultinomC(n, size, prob)) #msg=sprintf("rmultinom.cpp.error.%s",.name) }) }) ## for each test, check that results match lapply(names(tests), function(.name) { with(tests[[.name]], { set.seed(.seed) r.multinom <- rmultinom(n, size, prob) set.seed(.seed) c.multinom <- rmultinomC(n, size, prob) expect_equal(r.multinom, c.multinom)# , msg=sprintf("rmultinom.%s",.name)) }) }) RcppArmadillo/inst/tinytest/test_misc.R0000644000176200001440000000323614535105002017757 0ustar liggesusers#!/usr/bin/r -t # # Copyright (C) 2021-2023 Dirk Eddelbuettel # # This file is part of RcppArmadillo. # # RcppArmadillo is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. # # RcppArmadillo is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with RcppArmadillo. If not, see . library(RcppArmadillo) ## -- src/RcppArmadillo.cpp arma <- armadillo_version(FALSE) expect_equal(length(arma), 3) # major minor patch expect_equal(names(arma), c("major","minor","patch")) arma <- armadillo_version(TRUE) expect_equal(class(arma), "integer") expect_equal(length(arma), 1L) ## no tests as we have no (current) accessor as we prefer R RNGs expect_warning(armadillo_set_seed_random()) armadillo_set_seed(42L) # no test as we have no (current) accessor as we prefer R RNGs ## -- R/flags.R cxxflags <- RcppArmadillo:::RcppArmadilloCxxFlags() expect_true(is.character(cxxflags)) expect_stdout(RcppArmadillo:::CxxFlags()) ## 'set number of threads' helper -- adding simple test expect_true(is.integer(armadillo_get_number_of_omp_threads())) expect_silent(armadillo_set_number_of_omp_threads(2)) ## startup throttle/restore helpers expect_silent(armadillo_throttle_cores()) expect_silent(armadillo_reset_cores()) RcppArmadillo/inst/tinytest/test_sample.R0000644000176200001440000000756113537314632020326 0ustar liggesusers#!/usr/bin/r -t # ## Copyright (C) 2012 - 2019 Christian Gunning ## Copyright (C) 2013 - 2019 Romain Francois ## Copyright (C) 2019 Dirk Eddelbuettel ## ## ## This file is part of RcppArmadillo. ## ## RcppArmadillo is free software: you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by ## the Free Software Foundation, either version 2 of the License, or ## (at your option) any later version. ## ## RcppArmadillo is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with RcppArmadillo. If not, see . library(RcppArmadillo) Rcpp::sourceCpp("cpp/sample.cpp") #test.sample <- function() { ## set up S3 dispatching, ## simplifies lapply(tests, ...) below csample <- function(x, ...) UseMethod("csample") csample.numeric <- csample_numeric csample.integer <- csample_integer csample.complex <- csample_complex csample.character <- csample_character csample.logical <- csample_logical ## Seed needs to be reset to compare R to C++ seed <- 441 ## Input vectors to sample N <- 100 ## Number of samples ## works for size == N?! size <- N%/%2 ## all atomic vector classes except raw ## for each list element, check that sampling works ## with and without replacement, with and without prob tests <- list() tests <- within(tests, { int <- 1:N num <- (1:N)/10 cpx <- (1:N)/10 + 1i char <-rep(letters, 4)[1:N] bool <- rep(c(T,F), times=N/2) }) ## Un-normalized probs probs <- seq(from=0, to=1, length.out=N) ##probs <- probs/sum(probs) ## Needed for a change in R 3.6.0 reducing a bias in very large samples suppressWarnings(RNGversion("3.5.0")) ## Run the S3 generic function csample ## and associated R function on each data type ## ReplaceYN.ProbsYN lapply(tests, function(dat) { .class <- class(dat) set.seed(seed) ## R r.no.no <- sample(dat, size, replace=F) set.seed(seed) r.yes.no <- sample(dat, size, replace=T) set.seed(seed) r.no.yes <- sample(dat, size, replace=F, prob=probs) set.seed(seed) r.yes.yes <- sample(dat, size, replace=T, prob=probs) ## C set.seed(seed) c.no.no <- csample(dat, size, replace=F) set.seed(seed) c.yes.no <- csample(dat, size, replace=T) set.seed(seed) c.no.yes <- csample(dat, size, replace=F, prob=probs) set.seed(seed) c.yes.yes <- csample(dat, size, replace=T, prob=probs) ## comparisons expect_equal(r.no.no, c.no.no)#, msg=sprintf("sample.%s.no_replace.no_prob",.class)) expect_equal(r.yes.no, c.yes.no)#, msg=sprintf("sample.%s.replace.no_prob",.class)) ## the following don't pass expect_equal(r.no.yes, c.no.yes)#, msg=sprintf("sample.%s.no_replace.prob",.class)) expect_equal(r.yes.yes, c.yes.yes)#, msg=sprintf("sample.%s.replace.prob",.class)) }) ## Walker Alias method test ## With replacement, >200 "nonzero" probabilities ## Not implemented, see below walker.N <- 1e3 walker.sample <- (1:walker.N)/10 walker.probs <- rep(0.1, walker.N) ## uncomment following 5 lines if/when walker alias method is implemented set.seed(seed) r.walker <- sample( walker.sample, walker.N, replace=T, prob=walker.probs) set.seed(seed) c.walker <- csample( walker.sample, walker.N, replace=T, prob=walker.probs) expect_equal(r.walker, c.walker)#, msg=sprintf("Walker Alias method test")) ## Walker Alias method is not implemented. ## For this problem (replace, >200 non-zero probs) R is much faster ## So throw an error and refuse to proceed ##walker.error <- try( csample( walker.sample, walker.N, replace=T, prob=walker.probs), TRUE) ##expect_equal(inherits(walker.error, "try-error"), TRUE, msg=sprintf("Walker Alias method test")) RcppArmadillo/inst/announce/0000755000176200001440000000000012253723621015571 5ustar liggesusersRcppArmadillo/inst/announce/ANNOUNCE-0.2.0.txt0000644000176200001440000001170212253723621020174 0ustar liggesusers ===== Armadillo ===== Armadillo is a C++ linear algebra library aiming towards a good balance between speed and ease of use. Integer, floating point and complex numbers are supported, as well as a subset of trigonometric and statistics functions. Various matrix decompositions are provided through optional integration with LAPACK and ATLAS libraries. A delayed evaluation approach is employed (during compile time) to combine several operations into one and reduce (or eliminate) the need for temporaries. This is accomplished through recursive templates and template meta-programming. This library is useful if C++ has been decided as the language of choice (due to speed and/or integration capabilities), rather than another language like Matlab or Octave. It is distributed under a license that is useful in both open-source and commercial contexts. Armadillo is primarily developed by Conrad Sanderson at NICTA (Australia), with contributions from around the world. ===== RcppArmadillo ===== RcppArmadillo is an R package that facilitates using Armadillo classes in R packages through Rcpp. It achieves the integration by extending Rcpp's data interchange concepts to Armadillo classes. ===== Example ===== Here is a simple implementation of a fast linear regression (provided by RcppArmadillo via the fastLm() function): #include extern "C" SEXP fastLm(SEXP ys, SEXP Xs) { Rcpp::NumericVector yr(ys); // creates Rcpp vector from SEXP Rcpp::NumericMatrix Xr(Xs); // creates Rcpp matrix from SEXP int n = Xr.nrow(), k = Xr.ncol(); arma::mat X(Xr.begin(), n, k, false); // reuses memory and avoids extra copy arma::colvec y(yr.begin(), yr.size(), false); arma::colvec coef = arma::solve(X, y); // fit model y ~ X arma::colvec res = y - X*coef; // residuals double s2 = std::inner_product(res.begin(), res.end(), res.begin(), double())/(n - k); // std.errors of coefficients arma::colvec stderr = arma::sqrt(s2 * arma::diagvec( arma::inv(arma::trans(X)*X) )); return Rcpp::List::create(Rcpp::Named("coefficients") = coef, Rcpp::Named("stderr") = stderr, Rcpp::Named("df") = n - k ); } Note however that you may not want to compute a linear regression fit this way in order to protect from numerical inaccuracies on rank-deficient problems. The help page for fastLm() provides an example. ===== Using RcppArmadillo in other packages ===== RcppArmadillo is designed so that its classes can be used from other packages. Using RcppArmadillo requires: - Using the header files provided by Rcpp and RcppArmadillo. This is typically achieved by adding this line in the DESCRIPTION file of the client package: LinkingTo : Rcpp, RcppArmadillo and the following line in the package code: #include - Linking against Rcpp dynamic or shared library and librairies needed by Armadillo, which is achieved by adding this line in the src/Makevars file of the client package: PKG_LIBS = $(shell $(R_HOME)/bin/Rscript -e "Rcpp:::LdFlags()" ) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) and this line in the file src/Makevars.win: PKG_LIBS = $(shell Rscript.exe -e "Rcpp:::LdFlags()") $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) RcppArmadillo contains a function RcppArmadillo.package.skeleton, modelled after package.skeleton from the utils package in base r, that creates a skeleton of a package using RcppArmadillo, including example code. ===== Quality Assurance ===== RcppArmadillo uses the RUnit package by Matthias Burger et al to provide unit testing. RcppArmadillo currently has 19 unit tests (called from 8 unit test functions). Source code for unit test functions are stored in the unitTests directory of the installed package and the results are collected in the "RcppArmadillo-unitTests" vignette. We run unit tests before sending the package to CRAN on as many systems as possible, including Mac OSX (Snow Leopard), Debian, Ubuntu, Fedora 12 (64bit), Win 32 and Win64. Unit tests can also be run from the installed package by executing RcppArmadillo:::test() where an output directory can be provided as an optional first argument. ===== Links ===== Armadillo : http://arma.sourceforge.net/ RcppArmadillo main page: http://dirk.eddelbuettel.com/code/rcpp.armadillo.html R-forge Rcpp project page: http://r-forge.r-project.org/projects/rcpp/ Dirk's blog : http://dirk.eddelbuettel.com/blog/code/rcpp/ Romain's blog : http://romainfrancois.blog.free.fr/index.php?category/R-package/RcppArmadillo ===== Support ===== Questions about RcppArmadillo should be directed to the Rcpp-devel mailing list at https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel Questions about Armadillo itself should be directed to its forum http://sourceforge.net/apps/phpbb/arma/ -- Romain Francois, Montpellier, France Dirk Eddelbuettel, Chicago, IL, USA Doug Bates, Madison, WI, USA May 2010 RcppArmadillo/inst/NEWS.Rd0000644000176200001440000034753615031227347015051 0ustar liggesusers\name{NEWS} \title{News for Package \pkg{RcppArmadillo}} \newcommand{\ghpr}{\href{https://github.com/RcppCore/RcppArmadillo/pull/#1}{##1}} \newcommand{\ghit}{\href{https://github.com/RcppCore/RcppArmadillo/issues/#1}{##1}} \section{Changes in RcppArmadillo version 14.6.0-1 (2025-07-02)}{ \itemize{ \item Upgraded to Armadillo release 14.6.0 (Caffe Mocha) \itemize{ \item Added \code{balance()} to transform matrices so that column and row norms are roughly the same \item Added \code{omit_nan()} and \code{omit_nonfinite()} to extract elements while omitting NaN and non-finite values \item Added \code{find_nonnan()} for finding indices of non-NaN elements \item Added standalone \code{replace()} function } \item The \code{fastLm()} help page now mentions that options to \code{solve()} can control its behavior. } } \section{Changes in RcppArmadillo version 14.4.3-1 (2025-05-21)}{ \itemize{ \item Upgraded to Armadillo release 14.4.3 (Filtered Espresso) \itemize{ \item Fix for several corner cases involving handling of non-finite elements by sparse matrices } } } \section{Changes in RcppArmadillo version 14.4.2-1 (2025-04-25)}{ \itemize{ \item Upgraded to Armadillo release 14.4.2 (Filtered Espresso) \itemize{ \item Fix for \code{expmat()} \item Workaround for bugs in clang 20 compiler } \item Micro-cleanup in one test file } } \section{Changes in RcppArmadillo version 14.4.1-1 (2025-03-27)}{ \itemize{ \item Upgraded to Armadillo release 14.4.1 (Filtered Espresso) \itemize{ \item Fix for \code{fft()} and \code{ifft()} when using FFTW3 in multi-threaded contexts (such as OpenMP) } } } \section{Changes in RcppArmadillo version 14.4.0-1 (2025-03-17)}{ \itemize{ \item CRAN release having given a few packages time to catch-up to small upstream change as discussed and managed in \ghit{462} \item Updated bibliography, and small edits to sparse matrix vignette \item Switched continuous integration action to r-ci with implicit bootstrap } } \section{Changes in RcppArmadillo version 14.4.0-0 (2025-02-17) (GitHub Only)}{ \itemize{ \item Upgraded to Armadillo release 14.4.0 (Filtered Espresso) \itemize{ \item Faster handling of \code{pow()} and \code{square()} within \code{accu()} and \code{sum()} expressions \item Faster \code{sort()} and \code{sort_index()} for complex matrices \item Expanded the field class with \code{.reshape()} and \code{.resize()} member functions \item More efficient handling of compound expressions by \code{sum()}, \code{reshape()}, \code{trans() } \item Better detection of vector expressions by \code{pow()}, \code{imag()}, \code{conj()} } \item The package generator helper function now supports additional DESCRIPTIONs \item This release revealed a need for very minor changes for a handful reverse-dependency packages which will be organized via GitHub issue tracking } } \section{Changes in RcppArmadillo version 14.2.3-1 (2025-02-05)}{ \itemize{ \item Upgraded to Armadillo release 14.2.3 (Smooth Caffeine) \itemize{ \item Minor fix for declaration of \code{xSYCON} and \code{xHECON} functions in LAPACK \item Fix for rare corner-case in \code{reshape()} } } } \section{Changes in RcppArmadillo version 14.2.2-1 (2024-12-05)}{ \itemize{ \item Upgraded to Armadillo release 14.2.2 (Smooth Caffeine) \itemize{ \item Workarounds for regressions in pre-release versions of GCC 15 \item More selective detection of symmetric/hermitian matrices by various functions } } } \section{Changes in RcppArmadillo version 14.2.1-1 (2024-11-24) (GitHub Only)}{ \itemize{ \item Upgraded to Armadillo release 14.2.1 (Smooth Caffeine) \itemize{ \item Fix for \code{index_min()} and \code{index_max()} to ensure that the first index of equal extremum values is found } } } \section{Changes in RcppArmadillo version 14.2.0-1 (2024-11-16)}{ \itemize{ \item Upgraded to Armadillo release 14.2.0 (Smooth Caffeine) \itemize{ \item Faster handling of symmetric matrices by \code{inv()} and \code{rcond()} \item Faster handling of hermitian matrices by \code{inv()}, \code{rcond()}, \code{cond()}, \code{pinv()}, \code{rank()} \item Added \code{solve_opts::force_sym} option to \code{solve()} to force the use of the symmetric solver \item More efficient handling of compound expressions by \code{solve()} } \item Added exporter specialisation for \code{icube} for the \code{ARMA_64BIT_WORD} case } } \section{Changes in RcppArmadillo version 14.0.2-1 (2024-09-11)}{ \itemize{ \item Upgraded to Armadillo release 14.0.2 (Stochastic Parrot) \itemize{ \item Optionally use C++20 memory alignment \item Minor corrections for several corner-cases } \item The order of items displayed by \code{citation()} is reversed (Conrad in \ghpr{449}) \item The DESCRIPTION file now uses an Authors@R field with ORCID IDs } } \section{Changes in RcppArmadillo version 14.0.0-1 (2024-07-05)}{ \itemize{ \item Upgraded to Armadillo release 14.0.0 (Stochastic Parrot) \itemize{ \item C++14 is now the minimum recommended C++ standard \item Faster handling of compound expressions by \code{as_scalar()}, \code{accu()}, \code{dot()} \item Faster interactions between sparse and dense matrices \item Expanded \code{stddev()} to handle sparse matrices \item Expanded relational operators to handle expressions between sparse matrices and scalars \item Added \code{.as_dense()} to obtain dense vector/matrix representation of any sparse matrix expression \item Updated physical constants to NIST 2022 CODATA values } \item New package version numbering scheme following upstream versions \item Re-enabling \code{ARMA_IGNORE_DEPRECATED_MARKE} for silent CRAN builds } } \section{Changes in RcppArmadillo version 0.12.8.4.0 (2024-05-30)}{ \itemize{ \item Upgraded to Armadillo release 12.8.4 (Cortisol Injector) \itemize{ \item Faster handling of sparse submatrix views } \item Update versioned Depends on \pkg{Rcpp} to 1.0.8 or later to match use of Light/Lighter/Lightest headers. } } \section{Changes in RcppArmadillo version 0.12.8.3.0 (2024-05-07)}{ \itemize{ \item Upgraded to Armadillo release 12.8.3 (Cortisol Injector) \itemize{ \item Fix issue in \code{fft()} and \code{fft2()} in multi-threaded contexts with FFTW3 enabled } \item No longer set C++11 for the \pkg{Rcpp} plugin as this standard has been the default by R for very long time now. } } \section{Changes in RcppArmadillo version 0.12.8.2.1 (2024-04-15)}{ \itemize{ \item One-char bug fix release commenting out one test that upsets \pkg{reticulate} when accessing a \pkg{scipy} sparse matrix } } \section{Changes in RcppArmadillo version 0.12.8.2.0 (2024-04-02)}{ \itemize{ \item Upgraded to Armadillo release 12.8.2 (Cortisol Injector) \itemize{ \item Workaround for FFTW3 header clash \item Workaround in testing framework for issue under macOS \item Minor cleanups to reduce code bloat \item Improved documentation } } } \section{Changes in RcppArmadillo version 0.12.8.1.0 (2024-03-02)}{ \itemize{ \item Upgraded to Armadillo release 12.8.1 (Cortisol Injector) \itemize{ \item Workaround in \code{norm()} for yet another bug in macOS accelerate framework } \item Update README for RcppArmadillo usage counts \item Update examples to use '#include ' for faster compilation excluding unused Rcpp features } } \section{Changes in RcppArmadillo version 0.12.8.0.0 (2024-02-06)}{ \itemize{ \item Upgraded to Armadillo release 12.8.0 (Cortisol Injector) \itemize{ \item Faster detection of symmetric expressions by \code{pinv()} and \code{rank()} \item Expanded \code{shift()} to handle sparse matrices \item Expanded \code{conv_to} for more flexible conversions between sparse and dense matrices \item Added \code{cbrt()} \item More compact representation of integers when saving matrices in CSV format } \item Five non-user facing top-level include files have been removed (\ghpr{432} closing \ghit{400} and building on \ghpr{395} and \ghpr{396}) } } \section{Changes in RcppArmadillo version 0.12.6.7.0 (2023-12-18)}{ \itemize{ \item Upgraded to Armadillo release 12.6.7 (Cortisol Retox) \itemize{ \item Fix for saving sparse matrices as CSV files } \item Added unit tests for thread throttling } } \section{Changes in RcppArmadillo version 0.12.6.6.1 (2023-12-03)}{ \itemize{ \item Following the extendeded transition in \ghit{391} and \ghit{402}, this release no longer sets \code{ARMA_IGNORE_DEPRECATED_MARKER}. Maintainers of affected packages have received pull requests or patches and can set \code{-DARMA_IGNORE_DEPRECATED_MARKER} as \code{PKG_CPPFLAGS}. } } \section{Changes in RcppArmadillo version 0.12.6.6.0 (2023-10-31)}{ \itemize{ \item Upgraded to Armadillo release 12.6.6 (Cortisol Retox) \itemize{ \item Fix \code{eigs_sym()}, \code{eigs_gen()} and \code{svds()} to generate deterministic results in ARPACK mode } \item Add helper functions to set and get the number of OpenMP threads \item Store initial thread count at package load and use in thread-throttling helper (and resetter) suitable for CRAN constraints } } \section{Changes in RcppArmadillo version 0.12.6.5.0 (2023-10-14)}{ \itemize{ \item Upgraded to Armadillo release 12.6.5 (Cortisol Retox) \itemize{ \item Fix for corner-case bug in handling sparse matrices with no non-zero elements } } } \section{Changes in RcppArmadillo version 0.12.6.4.0 (2023-09-06)}{ \itemize{ \item Upgraded to Armadillo release 12.6.4 (Cortisol Retox) \itemize{ \item Workarounds for bugs in Apple accelerate framework \item Fix incorrect calculation of rcond for band matrices in \code{solve()} \item Remove expensive and seldom used optimisations, leading to faster compilation times } } } \section{Changes in RcppArmadillo version 0.12.6.3.0 (2023-08-28)}{ \itemize{ \item Upgraded to Armadillo release 12.6.3 (Cortisol Retox) \itemize{ \item Fix for corner-case in loading CSV files with headers \item For consistent file handling, all \code{.load()} functions now open text files in binary mode } } } \section{Changes in RcppArmadillo version 0.12.6.2.0 (2023-08-08)}{ \itemize{ \item Upgraded to Armadillo release 12.6.2 (Cortisol Retox) \itemize{ \item use thread-safe Mersenne Twister as the default RNG on all platforms \item use unique RNG seed for each thread within multi-threaded execution (such as OpenMP) \item explicitly document \code{arma_rng::set_seed()} and \code{arma_rng::set_seed_random() } } \item None of the changes above affect R use as \pkg{RcppArmadillo} connects the RNGs used by R to Armadillo } } \section{Changes in RcppArmadillo version 0.12.6.1.0 (2023-07-26)}{ \itemize{ \item Upgraded to Armadillo release 12.6.1 (Cortisol Retox) \itemize{ \item faster multiplication of dense vectors by sparse matrices (and vice versa) \item faster \code{eigs_sym()} and \code{eigs_gen()} \item faster \code{conv()} and \code{conv2()} when using OpenMP \item added \code{diags()} and \code{spdiags()} for generating band matrices from set of vectors } } } \section{Changes in RcppArmadillo version 0.12.4.1.0 (2023-06-17)}{ \itemize{ \item Upgraded to Armadillo release 12.4.1 (Cortisol Profusion Redux) \itemize{ \item fix bug in \code{SpMat::shed_cols()} \item functions such as \code{.is_finite()} and \code{find_nonfinite()} will now emit a runtime warning when compiled in fast math mode; such compilation mode disables detection of non-finite values } \item Accommodate upcoming change in package \pkg{Matrix} (Mikael Jagan in \ghpr{417} addressing \ghit{415}) } } \section{Changes in RcppArmadillo version 0.12.4.0.0 (2023-05-26)}{ \itemize{ \item Upgraded to Armadillo release 12.4.0 (Cortisol Profusion Redux) \itemize{ \item Added \code{norm2est()} for finding fast estimates of matrix 2-norm (spectral norm) \item Added \code{vecnorm()} for obtaining the vector norm of each row or column of a matrix } } } \section{Changes in RcppArmadillo version 0.12.2.0.0 (2023-04-04)}{ \itemize{ \item Upgraded to Armadillo release 12.2.0 (Cortisol Profusion Deluxe) \itemize{ \item more efficient use of FFTW3 by \code{fft()} and \code{ifft()} \item faster in-place element-wise multiplication of sparse matrices by dense matrices \item added spsolve_factoriser class to allow reuse of sparse matrix factorisation for solving systems of linear equations } } } \section{Changes in RcppArmadillo version 0.12.0.1.0 (2023-02-20)}{ \itemize{ \item Upgraded to Armadillo release 12.0.1 (Cortisol Profusion) \itemize{ \item faster \code{fft()} and \code{ifft()} via optional use of FFTW3 \item faster \code{min()} and \code{max()} \item faster \code{index_min()} and \code{index_max()} \item added \code{.col_as_mat()} and \code{.row_as_mat()} which return matrix representation of cube column and cube row \item added \code{csv_opts::strict} option to loading CSV files to interpret missing values as NaN \item added \code{check_for_zeros} option to form 4 of sparse matrix batch constructors \item \code{inv()} and \code{inv_sympd()} with options \code{inv_opts::no_ugly} or \code{inv_opts::allow_approx} now use a scaled threshold similar to \code{pinv()} \item \code{set_cout_stream()} and \code{set_cerr_stream()} are now no-ops; instead use the options \code{ARMA_WARN_LEVEL}, or \code{ARMA_COUT_STREAM}, or \code{ARMA_CERR_STREAM} \item fix regression (mis-compilation) in \code{shift()} function (reported by us in \ghit{409}) } \item The include directory order is now more robust (Kevin Ushey in \ghpr{407} addressing \ghit{406}) } } \section{Changes in RcppArmadillo version 0.11.4.4.0 (2023-02-09)}{ \itemize{ \item Upgraded to Armadillo release 11.4.4 (Ship of Theseus) \itemize{ \item extended \code{pow()} with various forms of element-wise power operations \item added \code{find_nan()} to find indices of NaN elements \item faster handling of compound expressions by \code{sum()} } \item The package no longer sets a compilation standard, or progagates on in the generated packages as R ensures C++11 on all non-ancient versions \item The CITATION file was updated to the current format } } \section{Changes in RcppArmadillo version 0.11.4.3.1 (2023-01-14)}{ \itemize{ \item The \code{#define ARMA_IGNORE_DEPRECATED_MARKER} remains active to suppress the (upstream) deprecation warnings, see \ghit{391} and \ghit{402} for details. } } \section{Changes in RcppArmadillo version 0.11.4.3.0 (2022-12-28) (GitHub Only)}{ \itemize{ \item Upgraded to Armadillo release 11.4.3 (Ship of Theseus) \itemize{ \item fix corner case in \code{pinv()} when processing symmetric matrices } \item Protect the undefine of \code{NDEBUG} behind additional opt-in define } } \section{Changes in RcppArmadillo version 0.11.4.2.1 (2022-11-08)}{ \itemize{ \item Upgraded to Armadillo release 11.4.2 (Ship of Theseus) \itemize{ \item more robust handling of corner cases in multi-threaded contexts } \item Internal header organisation with new sub-directories while providing full compatibility via existing paths (\ghpr{395} \ghpr{396}) } } \section{Changes in RcppArmadillo version 0.11.4.1.0 (2022-10-10) (GitHub Only)}{ \itemize{ \item Upgraded to Armadillo release 11.4.1 (Ship of Theseus) \itemize{ \item fix data race in \code{Cube::slice()} \item workarounds for false warnings emitted by GCC 12 when compiling with \code{FORTIFY_SOURCE} enabled (already in RcppArmadillo 0.11.4.0.1 too) } } } \section{Changes in RcppArmadillo version 0.11.4.0.1 (2022-10-01)}{ \itemize{ \item Upgraded to Armadillo release 11.4.0 (Ship of Theseus) \itemize{ \item faster handling of compound expressions by \code{sum()} \item extended \code{pow()} with various forms of element-wise power operations \item added \code{find_nan()} to find indices of NaN elements } \item Also applied fixes to avoid g++-12 warnings affecting just a handful of CRAN packages. } } \section{Changes in RcppArmadillo version 0.11.2.4.0 (2022-09-09)}{ \itemize{ \item Upgraded to Armadillo release 11.2.4 (Classic Roast) \itemize{ \item fix handling of \code{std::move()} involving matrices constructed with auxiliary memory } \item In the \code{fastLm()} examples, use \code{arma::dot()} to compute to the inner product (as proposed by Conrad), plus small edits \item Support optional \code{#define} named \code{RCPPARMADILLO_FORCE_DEPRECATE} to suppress use of \code{ARMA_IGNORE_DEPRECATED_MARKER} permitting use and development under deprecation } } \section{Changes in RcppArmadillo version 0.11.2.3.1 (2022-08-16)}{ \itemize{ \item Accomodate upcoming \pkg{Matrix} 1.4-2 deprecation for conversion (Dirk in \ghpr{387}) \item CRAN release with small upstream changes in Armadillo 11.2.(1,2,3) made since the last CRAN release 0.11.2.0.0 (Dirk in \ghpr{383}, \ghpr{384} and \ghpr{386}) \item Undefine \code{arma_deprecated} warning as it affects a number of CRAN packages which will likely need a small transition } } \section{Changes in RcppArmadillo version 0.11.2.3.0 (2022-07-12) (GitHub Only)}{ \itemize{ \item Upgraded to Armadillo release 11.2.3 (Classic Roast) \itemize{ \item fix \code{Cube::insert_slices()} to accept \code{Cube::slice()} as input } } } \section{Changes in RcppArmadillo version 0.11.2.2.0 (2022-07-04) (GitHub Only)}{ \itemize{ \item Upgraded to Armadillo release 11.2.2 (Classic Roast) \itemize{ \item fix incorrect and/or slow convergence in single-threaded versions of \code{kmeans()}, \code{gmm_diag::learn()}, \code{gmm_full::learn()} } } } \section{Changes in RcppArmadillo version 0.11.2.1.0 (2022-06-28) (GitHub Only)}{ \itemize{ \item Upgraded to Armadillo release 11.2.1 (Classic Roast) \itemize{ \item old style matrix initialisation via the \code{<<} operator will now emit a compile-time deprecation warning \item use of the old and inactive \code{ARMA_DONT_PRINT_ERRORS} option will now emit a compile-time deprecation warning \item the option \code{ARMA_WARN_LEVEL} can be used instead } } } \section{Changes in RcppArmadillo version 0.11.2.0.0 (2022-06-10)}{ \itemize{ \item Upgraded to Armadillo release 11.2 (Classic Roast) \itemize{ \item faster handling of sparse submatrix column views by \code{norm()}, \code{accu()}, \code{nonzeros() } \item extended \code{randu()} and \code{randn()} to allow specification of distribution parameters \item internal refactoring, leading to faster compilation times } } } \section{Changes in RcppArmadillo version 0.11.1.1.0 (2022-05-15)}{ \itemize{ \item Upgraded to Armadillo release 11.1.1 (Angry Kitchen Appliance) \itemize{ \item added \code{inv_opts::no_ugly} option to \code{inv()} and \code{inv_sympd()} to disallow inverses of poorly conditioned matrices \item more efficient handling of rank-deficient matrices via \code{inv_opts::allow_approx} option in \code{inv()} and \code{inv_sympd()} \item better detection of rank deficient matrices by \code{solve()} \item faster handling of symmetric and diagonal matrices by \code{cond()} } \item The \code{configure} script again propagates the'found' case again, thanks to Justin Silverman for the heads-up and suggested fix (Dirk and Justin in \ghpr{376} and \ghpr{377} fixing \ghit{375}). } } \section{Changes in RcppArmadillo version 0.11.0.1.0 (2022-04-14)}{ \itemize{ \item Upgraded to Armadillo release 11.0.1 (Creme Brulee) \itemize{ \item fix miscompilation of \code{inv()} and \code{inv_sympd()} functions when using \code{inv_opts::allow_approx} and \code{inv_opts::tiny} options } } } \section{Changes in RcppArmadillo version 0.11.0.0.0 (2022-04-04)}{ \itemize{ \item Upgraded to Armadillo release 11.0.0 (Creme Brulee) \itemize{ \item added variants of \code{inv()} and \code{inv_sympd()} that provide rcond (reciprocal condition number) \item expanded \code{inv()} and \code{inv_sympd()} with options \code{inv_opts::tiny} and \code{inv_opts::allow_approx} \item stricter handling of singular matrices by \code{inv()} and \code{inv_sympd()} \item stricter handling of non-sympd matrices by \code{inv()} and \code{inv_sympd()} \item stricter handling of non-finitie matrices by \code{pinv()} \item more robust handling of rank deficient matrices by \code{solve()} \item faster handling of diagonal matrices by \code{rcond()} \item changed \code{eigs_sym()} and \code{eigs_gen()} to use higher quality RNG \item \code{quantile()} and \code{median()} will now throw an exception if given matrices/vectors have NaN elements \item workaround for yet another bug in Intel MKL } \item Until May 2022, protect correction to Field behavior via define of \code{RCPP_ARMADILLO_FIX_Field} \item If a LAPACK installation with missing complex routines is found (as e.g. Ubuntu using 3.9.0) then the LAPACK unit test is skipped. } } \section{Changes in RcppArmadillo version 0.10.8.2.0 (2022-02-01)}{ \itemize{ \item Upgraded to Armadillo release 10.8.2 (Realm Raider) \itemize{ \item fix potential speed regression in \code{pinv()} and \code{rank()} } } } \section{Changes in RcppArmadillo version 0.10.8.1.0 (2022-01-23)}{ \itemize{ \item Upgraded to Armadillo release 10.8.1 (Realm Raider) \itemize{ \item fix interaction between OpenBLAS and LAPACK \item emit warning if \code{find()} is incorrectly used to locate NaN elements } } } \section{Changes in RcppArmadillo version 0.10.8.0.0 (2022-01-02)}{ \itemize{ \item Upgraded to Armadillo release 10.8 (Realm Raider) \itemize{ \item faster handling of symmetric matrices by \code{pinv()} and \code{rank()} \item faster handling of diagonal matrices by \code{inv_sympd()}, \code{pinv()}, \code{rank()} \item expanded \code{norm()} to handle integer vectors and matrices \item added \code{datum::tau} to replace \code{2Ï€} } } } \section{Changes in RcppArmadillo version 0.10.7.5.0 (2021-12-16)}{ \itemize{ \item Upgraded to Armadillo release 10.7.5 \itemize{ \item fix aliasing bug in \code{diagmat()} \item fix detection of 2x2 triangular matrices } } } \section{Changes in RcppArmadillo version 0.10.7.4.0 (2021-11-23)}{ \itemize{ \item Upgraded to Armadillo release 10.7.4 \itemize{ \item faster handling of diagonal matrices by \code{inv_sympd()}, \code{pinv()}, \code{rank()} \item more robust detection of incorrect data format by \code{.load()} } \item Correct dimensions setting in import/export of \code{arma::field} types, protected by \code{#define} (Jonathan Berrisch in \ghpr{352} fixing \ghit{351}) \item Add unit tests for \code{fields} both with and without new \code{#define} (Dirk) } } \section{Changes in RcppArmadillo version 0.10.7.3.0 (2021-11-04)}{ \itemize{ \item Upgraded to Armadillo release 10.7.3 \itemize{ \item fix regression in alias handling by \code{fliplr()}, \code{flipud()}, \code{reverse()} } } } \section{Changes in RcppArmadillo version 0.10.7.2.0 (2021-11-02)}{ \itemize{ \item Upgraded to Armadillo release 10.7.2 \itemize{ \item more robust handling of diagonal matrices by \code{pinv()} } } } \section{Changes in RcppArmadillo version 0.10.7.1.0 (2021-10-08)}{ \itemize{ \item Upgraded to Armadillo release 10.7.1 \itemize{ \item fix regression in interactions between dense matrix subviews and sparse matrices } } } \section{Changes in RcppArmadillo version 0.10.7.0.0 (2021-09-30)}{ \itemize{ \item Upgraded to Armadillo release 10.7.0 (Entropy Maximizer) \itemize{ \item faster handling of submatrix views accessed by \code{X.cols(first_col,last_col)} \item faster handling of element-wise \code{min()} and \code{max()} in compound expressions \item expanded \code{solve()} with \code{solve_opts::force_approx} option to force use of the approximate solver } } } \section{Changes in RcppArmadillo version 0.10.6.2.0 (2021-08-05)}{ \itemize{ \item Upgraded to Armadillo release 10.6.2 (Keep Calm) \itemize{ \item fix incorrect use of \code{constexpr} for handling fixed-size matrices and vectors \item improved documentation } \item GitHub- and drat-only release } } \section{Changes in RcppArmadillo version 0.10.6.0.0 (2021-07-16)}{ \itemize{ \item Upgraded to Armadillo release 10.6.0 (Keep Calm) \itemize{ \item expanded \code{chol()} to optionally use pivoted decomposition \item expanded vector, matrix and cube constructors to allow element initialisation via \code{fill::value(scalar)}, eg. \code{mat X(4,5,fill::value(123))} \item faster loading of CSV files when using OpenMP \item added \code{csv_opts::semicolon} option to allow saving/loading of CSV files with semicolon (;) instead of comma (,) as the separator } } } \section{Changes in RcppArmadillo version 0.10.5.3.0 (2021-07-01)}{ \itemize{ \item Upgraded to Armadillo release 10.5.3 (Antipodean Fortress) \item GitHub-only release \item Extended test coverage with several new tests, added a coverage badge. } } \section{Changes in RcppArmadillo version 0.10.5.0 (2021-05-21)}{ \itemize{ \item Upgraded to Armadillo release 10.5 (Antipodean Fortress) \itemize{ \item added \code{.clamp()} member function \item expanded the standalone \code{clamp()} function to handle complex values \item more efficient use of OpenMP \item vector, matrix and cube constructors now initialise elements to zero by default; use the \code{fill::none} specifier, eg. \code{mat X(4,5,fill::none)}, to disable element initialisation } \item Added \code{codecov.yml} to exclude Armadillo from coverage analysis } } \section{Changes in RcppArmadillo version 0.10.4.1.0 (2021-04-23)}{ \itemize{ \item Upgraded to Armadillo release 10.4.1 (Pressure Cooker) \item GitHub-only release } } \section{Changes in RcppArmadillo version 0.10.4.0.0 (2021-04-12)}{ \itemize{ \item Upgraded to Armadillo release 10.4.0 (Pressure Cooker) \itemize{ \item faster handling of triangular matrices by \code{log_det()} \item added \code{log_det_sympd()} for log determinant of symmetric positive matrices \item added ARMA_WARN_LEVEL configuration option, to control the degree of emitted warning messages \item reduced the default degree of warning messages, so that failed decompositions, failed saving/loading, etc, no longer emit warnings } \item Apply one upstream corrections for \code{arma::randn} draws when using alternative (here R) generator, and \code{arma::randg}. } } \section{Changes in RcppArmadillo version 0.10.3.0.0 (2021-03-10)}{ \itemize{ \item Upgraded to Armadillo release 10.3 (Sunrise Chaos) \itemize{ \item faster handling of symmetric positive definite matrices by \code{pinv()} \item expanded \code{.save()} / \code{.load()} for dense matrices to handle coord_ascii format \item for out of bounds access, element accessors now throw the more nuanced \code{std::out_of_range} exception, instead of only \code{std::logic_error} \item improved quality of random numbers } } } \section{Changes in RcppArmadillo version 0.10.2.2.0 (2021-03-09)}{ \itemize{ \item Upgraded to Armadillo release 10.2.2 (Cicada Swarm) \itemize{ \item faster handling of subcubes \item added \code{tgamma()} \item added \code{.brief_print()} for abridged printing of matrices & cubes \item expanded forms of \code{trimatu()} and \code{trimatl()} with diagonal specification to handle sparse matrices \item expanded \code{eigs_sym()} and \code{eigs_gen()} with optional shift-invert mode } \item Removed \code{debian/} directory from repository as packaging is on salsa.debian.org. \item Relaxed tolerance on two \code{cube} tests on Windows to accomodate new 'gcc10-UCRT' builder. } } \section{Changes in RcppArmadillo version 0.10.2.1.0 (2021-02-09)}{ \itemize{ \item Upgraded to Armadillo release 10.2.1 (Cicada Swarm) \itemize{ \item faster handling of subcubes \item added \code{tgamma()} \item added \code{.brief_print()} for abridged printing of matrices & cubes \item expanded forms of \code{trimatu()} and \code{trimatl()} with diagonal specification to handle sparse matrices \item expanded \code{eigs_sym()} and \code{eigs_gen()} with optional shift-invert mode } } } \section{Changes in RcppArmadillo version 0.10.1.2.2 (2021-01-08)}{ \itemize{ \item Correct one unit test for \pkg{Matrix} 1.3.0-caused changed (Binxiang in \ghpr{319} and Dirk in \ghpr{322}). \item Suppress one further warning from \pkg{Matrix} (Dirk) \item Apply an upstream \code{NaN} correction (Conrad in \ghpr{321}) \item Added GitHub Actions CI using \code{run.sh} from r-ci (Dirk) } } \section{Changes in RcppArmadillo version 0.10.1.2.0 (2020-11-15)}{ \itemize{ \item Upgraded to Armadillo release 10.1.2 (Orchid Ambush) \item Remove three unused int constants (\ghit{313}) \item Include main armadillo header using quotes instead of brackets \item Rewrite version number use in old-school mode because gcc 4.8.5 \item Skipping parts of sparse conversion on Windows as win-builder fails } } \section{Changes in RcppArmadillo version 0.10.1.0.0 (2020-10-09)}{ \itemize{ \item Upgraded to Armadillo release 10.1.0 (Orchid Ambush) \itemize{ \item C++11 is now the minimum required C++ standard \item faster handling of compound expressions by \code{trimatu()} and \code{trimatl()} \item faster sparse matrix addition, subtraction and element-wise multiplication \item expanded sparse submatrix views to handle the non-contiguous form of \code{X.cols(vector_of_column_indices)} \item expanded \code{eigs_sym()} and \code{eigs_gen()} with optional fine-grained parameters (subspace dimension, number of iterations, eigenvalues closest to specified value) \item deprecated form of \code{reshape()} removed from Cube and SpMat classes \item ignore and warn on use of the \code{ARMA_DONT_USE_CXX11} macro } \item Switch Travis CI testing to focal and BSPM } } \section{Changes in RcppArmadillo version 0.9.900.3.0 (2020-09-02)}{ \itemize{ \item Upgraded to Armadillo release 9.900.3 (Nocturnal Misbehaviour) \itemize{ \item More efficient code for initialising matrices with \code{fill::zeros} \item Fixes for various error messages } } } \section{Changes in RcppArmadillo version 0.9.900.2.0 (2020-07-17)}{ \itemize{ \item Upgraded to Armadillo release 9.900.2 (Nocturnal Misbehaviour) \itemize{ \item In \code{sort()}, fixes for inconsistencies between checks applied to matrix and vector expressions \item In \code{sort()}, remove unnecessary copying when applied in-place to vectors function when applied in-place to vectors } } } \section{Changes in RcppArmadillo version 0.9.900.1.0 (2020-06-08)}{ \itemize{ \item Upgraded to Armadillo release 9.900.1 (Nocturnal Misbehaviour) \itemize{ \item faster \code{solve()} for under/over-determined systems \item faster \code{eig_gen()} and \code{eig_pair()} for large matrices \item expanded \code{eig_gen()} and \code{eig_pair()} to optionally provide left and right eigenvectors } \item Switch Travis CI testing to R 4.0.0, use bionic as base distro and test R 3.6.3 and 4.0.0 in a matrix (Dirk in \ghpr{298}). \item Add two badges to README for indirect use and the CSDA paper. \item Adapt \code{RcppArmadillo.package.skeleton()} to a change in R 4.0.0 affecting what it exports in \code{NAMESPACE}. } } \section{Changes in RcppArmadillo version 0.9.880.1.0 (2020-05-15)}{ \itemize{ \item Upgraded to Armadillo release 9.880.1 (Roasted Mocha Detox) \itemize{ \item expanded \code{qr()} to optionally use pivoted decomposition \item updated physical constants to NIST 2018 CODATA values \item added \code{ARMA_DONT_USE_CXX11_MUTEX} confguration option to disable use of \code{std::mutex} } \item OpenMP capability is tested explicitly (Kevin Ushey and Dirk in \ghpr{294}, \ghpr{295}, and \ghpr{296} all fixing \ghit{290}). } } \section{Changes in RcppArmadillo version 0.9.870.2.0 (2020-04-24)}{ \itemize{ \item Upgraded to Armadillo release 9.870.2 (Roasted Mocha Retox) \itemize{ \item faster handling of matrix multiplication expressions by \code{diagvec()} and \code{diagmat()} \item added \code{trimatu_ind()} and \code{trimatl_ind()} \item more consistent detection of sparse vector expressions } } } \section{Changes in RcppArmadillo version 0.9.860.2.0 (2020-04-13)}{ \itemize{ \item Upgraded to Armadillo release 9.860.2 (Roasted Mocha Fix) \itemize{ \item added \code{powmat()} \item faster access to columns in sparse submatrix views \item faster handling of relational expressions by \code{accu()} \item faster handling of sympd matrices by \code{expmat()}, \code{logmat()}, \code{sqrtmat()} \item workaround for save/load issues with HDF5 v1.12 } \item Vignettes are now pre-made and include (\ghpr{285}) \item Two test files are now skipped on 32-bit Windows } } \section{Changes in RcppArmadillo version 0.9.850.1.0 (2020-02-09)}{ \itemize{ \item Upgraded to Armadillo release 9.850.1 (Pyrocumulus Wrath) \itemize{ \item faster handling of compound expressions by \code{diagmat()} \item expanded \code{.save()} and \code{.load()} to handle CSV files with headers via csv_name(filename,header) specification \item added \code{log_normpdf()} \item added \code{.is_zero()} \item added \code{quantile()} } \item The sparse matrix test using scipy, if available, is now simplified thanks to recently added \CRANpkg{reticulate} conversions. } } \section{Changes in RcppArmadillo version 0.9.800.4.0 (2020-01-24)}{ \itemize{ \item Upgraded to Armadillo release 9.800.4 (Horizon Scraper) \itemize{ \item fixes for incorrect type promotion in \code{normpdf()} } } } \section{Changes in RcppArmadillo version 0.9.800.3.0 (2019-12-04)}{ \itemize{ \item Upgraded to Armadillo release 9.800.3 (Horizon Scraper) \itemize{ \item fixes for matrix row iterators \item better detection of non-hermitian matrices by \code{eig_sym()}, \code{inv_sympd()}, \code{chol()}, \code{expmat_sym()} } \item The \code{sample} function passes the prob vector as const allowing subsequent calls (Christian Gunning in \ghpr{276} fixing \ghit{275}) } } \section{Changes in RcppArmadillo version 0.9.800.1.0 (2019-10-09)}{ \itemize{ \item Upgraded to Armadillo release 9.800 (Horizon Scraper) \itemize{ \item faster \code{solve()} in default operation; iterative refinement is no longer applied by default; use \code{solve_opts::refine} to explicitly enable refinement \item faster \code{expmat()} \item faster handling of triangular matrices by \code{rcond()} \item added \code{.front()} and \code{.back()} \item added \code{.is_trimatu()} and \code{.is_trimatl()} \item added \code{.is_diagmat()} } \item The package now uses \pkg{tinytest} for unit tests (Dirk in \ghpr{269}). \item The \code{configure.ac} script is now more careful about shell portability (Min Kim in \ghpr{270}). } } \section{Changes in RcppArmadillo version 0.9.700.2.0 (2019-09-01)}{ \itemize{ \item Upgraded to Armadillo release 9.700.2 (Gangster Democracy) \itemize{ \item faster handling of cubes by \code{vectorise()} \item faster faster handling of sparse matrices by \code{nonzeros()} \item faster row-wise \code{index_min()} and \code{index_max()} \item expanded \code{join_rows()} and \code{join_cols()} to handle joining up to 4 matrices \item expanded \code{.save()} and \code{.load()} to allow storing sparse matrices in CSV format \item added \code{randperm()} to generate a vector with random permutation of a sequence of integers } \item Expanded the list of known good \code{gcc} and \code{clang} versions in \code{configure.ac} } } \section{Changes in RcppArmadillo version 0.9.600.4.0 (2019-07-14)}{ \itemize{ \item Upgraded to Armadillo release 9.600.4 (Napa Invasion) \itemize{ \item faster handling of sparse submatrices \item faster handling of sparse diagonal views \item faster handling of sparse matrices by \code{symmatu()} and \code{symmatl()} \item faster handling of sparse matrices by \code{join_cols()} \item expanded \code{clamp()} to handle sparse matrices \item added \code{.clean()} to replace elements below a threshold with zeros } } } \section{Changes in RcppArmadillo version 0.9.500.2.0 (2019-06-11)}{ \itemize{ \item Upgraded to Armadillo release 9.500.2 (Riot Compact) \itemize{ \item Expanded \code{solve()} with \code{solve_opts::likely_sympd} to indicate that the given matrix is likely positive definite \item more robust automatic detection of positive definite matrices by \code{solve()} and \code{inv()} \item faster handling of sparse submatrices \item expanded \code{eigs_sym()} to print a warning if the given matrix is not symmetric \item extended LAPACK function prototypes to follow Fortran passing conventions for so-called "hidden arguments", in order to address GCC Bug 90329; to use previous LAPACK function prototypes without the "hidden arguments", \code{#define ARMA_DONT_USE_FORTRAN_HIDDEN_ARGS before #include } } } } \section{Changes in RcppArmadillo version 0.9.400.3.0 (2019-05-09)}{ \itemize{ \item Upgraded to Armadillo release 9.400.3 (Surrogate Miscreant) \itemize{ \item check for symmetric / hermitian matrices (used by decomposition functions) has been made more robust \item \code{linspace()} and \code{logspace()} now honour requests for generation of vectors with zero elements \item fix for vectorisation / flattening of complex sparse matrices } } } \section{Changes in RcppArmadillo version 0.9.400.2.0 (2019-04-28)}{ \itemize{ \item Upgraded to Armadillo release 9.400.2 (Surrogate Miscreant) \itemize{ \item faster \code{cov()} and \code{cor()} \item added \code{.as_col()} and \code{.as_row()} \item expanded \code{.shed_rows()} / \code{.shed_cols()} / \code{.shed_slices()} to remove rows/columns/slices specified in a vector \item expanded \code{vectorise()} to handle sparse matrices \item expanded element-wise versions of \code{max()} and \code{min()} to handle sparse matrices \item optimised handling of sparse matrix expressions: \code{sparse \% (sparse +- scalar)} and \code{sparse / (sparse +- scalar)} \item expanded \code{eig_sym()}, \code{chol()}, \code{expmat_sym()}, \code{logmat_sympd()}, \code{sqrtmat_sympd()}, \code{inv_sympd()} to print a warning if the given matrix is not symmetric \item more consistent detection of vector expressions } } } \section{Changes in RcppArmadillo version 0.9.300.2.0 (2019-03-21)}{ \itemize{ \item Upgraded to Armadillo release 9.300.2 (Fomo Spiral) \itemize{ \item Faster handling of compound complex matrix expressions by \code{trace()} \item More efficient handling of element access for inplace modifications in sparse matrices \item Added \code{.is_sympd()} to check whether a matrix is symmetric/hermitian positive definite \item Added \code{interp2()} for 2D data interpolation \item Added \code{expm1()} and \code{log1p()} \item Expanded \code{.is_sorted()} with options "strictascend" and "strictdescend" \item Expanded \code{eig_gen()} to optionally perform balancing prior to decomposition } } } \section{Changes in RcppArmadillo version 0.9.200.7.1 (2019-03-08)}{ \itemize{ \item Explicit setting of \code{RNGversion("3.5.0")} in one unit test to accomodate the change in \code{sample()} in R 3.6.0 \item Back-ported a fix to the Wishart RNG from upstream (Dirk in \ghpr{248} fixing \ghit{247}) } } \section{Changes in RcppArmadillo version 0.9.200.7.0 (2019-01-17)}{ \itemize{ \item Upgraded to Armadillo release 9.200.7 (Carpe Noctem) \item Fixes in 9.200.7 compared to 9.200.5: \itemize{ \item handling complex compound expressions by \code{trace()} \item handling \code{.rows()} and \code{.cols()} by the \code{Cube} class } } } \section{Changes in RcppArmadillo version 0.9.200.5.0 (2018-11-27)}{ \itemize{ \item Upgraded to Armadillo release 9.200.5 (Carpe Noctem) \item Changes in this release \itemize{ \item linking issue when using fixed size matrices and vectors \item faster handling of common cases by \code{princomp()} } } } \section{Changes in RcppArmadillo version 0.9.200.4.0 (2018-11-09)}{ \itemize{ \item Upgraded to Armadillo release 9.200.4 (Carpe Noctem) \itemize{ \item faster handling of symmetric positive definite matrices by \code{rcond()} \item faster transpose of matrices with size ≥ 512x512 \item faster handling of compound sparse matrix expressions by \code{accu()}, \code{diagmat()}, \code{trace()} \item faster handling of sparse matrices by \code{join_rows()} \item expanded \code{sign()} to handle scalar arguments \item expanded operators (\code{*}, \code{\%}, \code{+}, \code{−}) to handle sparse matrices with differing element types (eg. multiplication of complex matrix by real matrix) \item expanded \code{conv_to()} to allow conversion between sparse matrices with differing element types \item expanded \code{solve()} to optionally allow keeping solutions of systems singular to working precision \item workaround for \code{gcc} and \code{clang} bug in C++17 mode } \item Commented-out sparse matrix test consistently failing on the fedora-clang machine CRAN, and only there. No fix without access. \item The 'Unit test' vignette is no longer included. } } \section{Changes in RcppArmadillo version 0.9.100.5.0 (2018-08-16)}{ \itemize{ \item Upgraded to Armadillo release 9.100.4 (Armatus Ad Infinitum) \itemize{ \item faster handling of symmetric/hermitian positive definite matrices by \code{solve()} \item faster handling of \code{inv_sympd()} in compound expressions \item added \code{.is_symmetric()} \item added \code{.is_hermitian()} \item expanded \code{spsolve()} to optionally allow keeping solutions of systems singular to working precision \item new configuration options \code{ARMA_OPTIMISE_SOLVE_BAND} and \code{ARMA_OPTIMISE_SOLVE_SYMPD} smarter use of the element cache in sparse matrices \item smarter use of the element cache in sparse matrices } \item Aligned OpenMP flags in the RcppArmadillo.package.skeleton used Makevars(,.win) to not use one C and C++ flag. } } \section{Changes in RcppArmadillo version 0.8.600.0.0 (2018-06-28)}{ \itemize{ \item Upgraded to Armadillo release 8.600.0 (Sabretooth Rugrat) \itemize{ \item added \code{hess()} for Hessenberg decomposition \item added \code{.row()}, \code{.rows()}, \code{.col()}, \code{.cols()} to subcube views \item expanded \code{.shed_rows()} and \code{.shed_cols()} to handle cubes \item expanded \code{.insert_rows()} and \code{.insert_cols()} to handle cubes \item expanded subcube views to allow non-contiguous access to slices \item improved tuning of sparse matrix element access operators \item faster handling of tridiagonal matrices by \code{solve()} \item faster multiplication of matrices with differing element types when using OpenMP } } } \section{Changes in RcppArmadillo version 0.8.500.1.1 (2018-05-17) [GH only]}{ \itemize{ \item Upgraded to Armadillo release 8.500.1 (Caffeine Raider) \itemize{ \item bug fix for banded matricex } \item Added \code{slam} to Suggests: as it is used in two unit test functions [CRAN requests] \item The \code{RcppArmadillo.package.skeleton()} function now works with \code{example_code=FALSE} when \CRANpkg{pkgKitten} is present (Santiago Olivella in \ghpr{231} fixing \ghpr{229}) \item The LAPACK tests now cover band matrix solvers (Keith O'Hara in \ghpr{230}). } } \section{Changes in RcppArmadillo version 0.8.500.0 (2018-04-21)}{ \itemize{ \item Upgraded to Armadillo release 8.500 (Caffeine Raider) \itemize{ \item faster handling of sparse matrices by \code{kron()} and \code{repmat()} \item faster transpose of sparse matrices \item faster element access in sparse matrices \item faster row iterators for sparse matrices \item faster handling of compound expressions by \code{trace()} \item more efficient handling of aliasing in submatrix views \item expanded \code{normalise()} to handle sparse matrices \item expanded \code{.transform()} and \code{.for_each()} to handle sparse matrices \item added \code{reverse()} for reversing order of elements \item added \code{repelem()} for replicating elements \item added \code{roots()} for finding the roots of a polynomial } \item Fewer LAPACK compile-time guards are used, new unit tests for underlying features have been added (Keith O'Hara in \ghpr{211} addressing \ghit{207}). \item The configure check for LAPACK features has been updated accordingly (Keith O'Hara in \ghpr{214} addressing \ghit{213}). \item The compile-time check for \code{g++} is now more robust to minimal shell versions (\ghpr{217} addressing \ghit{216}). \item Compiler tests to were added for macOS (Keith O'Hara in \ghpr{219}). } } \section{Changes in RcppArmadillo version 0.8.400.0.0 (2018-02-19)}{ \itemize{ \item Upgraded to Armadillo release 8.400.0 (Entropy Bandit) \itemize{ \item faster handling of sparse matrices by \code{repmat()} \item faster loading of CSV files \item expanded \code{kron()} to handle sparse matrices \item expanded \code{index_min()} and \code{index_max()} to handle cubes \item expanded \code{randi()}, \code{randu()}, \code{randn()}, \code{randg()} to output single scalars \item added submatrix & subcube iterators \item added \code{normcdf()} \item added \code{mvnrnd()} \item added \code{chi2rnd()} \item added \code{wishrnd()} and \code{iwishrnd()} } \item The \code{configure} generated header settings for LAPACK and OpenMP can be overridden by the user. \item This release was preceded by two release candidates which were tested extensively. } } \section{Changes in RcppArmadillo version 0.8.300.1.0 (2017-12-04)}{ \itemize{ \item Upgraded to Armadillo release 8.300.1 (Tropical Shenanigans) \itemize{ \item faster handling of band matrices by \code{solve()} \item faster handling of band matrices by \code{chol()} \item faster \code{randg()} when using OpenMP \item added \code{normpdf()} \item expanded \code{.save()} to allow appending new datasets to existing HDF5 files } \item Includes changes made in several earlier GitHub-only releases (versions 0.8.300.0.0, 0.8.200.2.0 and 0.8.200.1.0). \item Conversion from \code{simple_triplet_matrix} is now supported (Serguei Sokol in \ghpr{192}). \item Updated configure code to check for g++ 5.4 or later to enable OpenMP. \item Updated the skeleton package to current packaging standards \item Suppress warnings from Armadillo about missing OpenMP support and \code{-fopenmp} flags by setting \code{ARMA_DONT_PRINT_OPENMP_WARNING} } } \section{Changes in RcppArmadillo version 0.8.100.1.0 (2017-10-10)}{ \itemize{ \item Upgraded to Armadillo release 8.100.1 (Feral Pursuits) \itemize{ \item faster incremental construction of sparse matrices via element access operators \item faster diagonal views in sparse matrices \item expanded \code{SpMat} to save/load sparse matrices in coord format \item expanded \code{.save()},\code{.load()} to allow specification of datasets within HDF5 files \item added \code{affmul()} to simplify application of affine transformations \item warnings and errors are now printed by default to the \code{std::cerr} stream \item added \code{set_cerr_stream()} and \code{get_cerr_stream()} to replace \code{set_stream_err1()}, \code{set_stream_err2()}, \code{get_stream_err1()}, \code{get_stream_err2()} \item new configuration options \code{ARMA_COUT_STREAM} and \code{ARMA_CERR_STREAM} } \item Constructors for sparse matrices of types \code{dgt}, \code{dtt} amd \code{dst} now use Armadillo code for improved performance (Serguei Sokol in \ghpr{175} addressing \ghit{173}) \item Sparse matrices call \code{.sync()} before accessing internal arrays (Binxiang Ni in \ghpr{171}) \item The sparse matrix vignette has been converted to Rmarkdown using the pinp package, and is now correctly indexed. (\ghpr{176}) } } \section{Changes in RcppArmadillo version 0.7.960.1.2 (2017-08-29)}{ \itemize{ \item On macOS, OpenMP support is now turned off (\ghpr{170}). \item The package is now compiling under the C++11 standard (\ghpr{170}). \item The vignette dependency are correctly set (James and Dirk in \ghpr{168} and \ghpr{169}) } } \section{Changes in RcppArmadillo version 0.7.960.1.1 (2017-08-20)}{ \itemize{ \item Added improved check for inherited S4 matrix classes (\ghpr{162} fixing \ghit{161}) \item Changed \code{fastLm} C++ function to \code{fastLm_impl} to not clash with R method (\ghpr{164} fixing \ghpr{163}) \item Added OpenMP check for \code{configure} (\ghpr{166} fixing \ghit{165}) } } \section{Changes in RcppArmadillo version 0.7.960.1.0 (2017-08-11)}{ \itemize{ \item Upgraded to Armadillo release 7.960.1 (Northern Banana Republic Deluxe) \itemize{ \item faster \code{randn()} when using OpenMP (NB: usually omitted when used fromR) \item faster \code{gmm_diag} class, for Gaussian mixture models with diagonal covariance matrices \item added \code{.sum_log_p()} to the \code{gmm_diag} class \item added \code{gmm_full} class, for Gaussian mixture models with full covariance matrices \item expanded \code{.each_slice()} to optionally use OpenMP for multi-threaded execution } \item Upgraded to Armadillo release 7.950.0 (Northern Banana Republic) \itemize{ \item expanded \code{accu()} and \code{sum()} to use OpenMP for processing expressions with computationally expensive element-wise functions \item expanded \code{trimatu()} and \code{trimatl()} to allow specification of the diagonal which delineates the boundary of the triangular part } \item Enhanced support for sparse matrices (Binxiang Ni as part of Google Summer of Code 2017) \itemize{ \item Add support for \code{dtCMatrix} and \code{dsCMatrix} (\ghpr{135}) \item Add conversion and unit tests for \code{dgT}, \code{dtT} and \code{dsTMatrix} (\ghpr{136}) \item Add conversion and unit tests for \code{dgR}, \code{dtR} and \code{dsRMatrix} (\ghpr{139}) \item Add conversion and unit tests for \code{pMatrix} and \code{ddiMatrix} (\ghpr{140}) \item Rewrite conversion for \code{dgT}, \code{dtT} and \code{dsTMatrix}, and add file-based tests (\ghpr{142}) \item Add conversion and unit tests for \code{indMatrix} (\ghpr{144}) \item Rewrite conversion for \code{ddiMatrix} (\ghpr{145}) \item Add a warning message for matrices that cannot be converted (\ghpr{147}) \item Add new vignette for sparse matrix support (\ghpr{152}; Dirk in \ghpr{153}) \item Add support for sparse matrix conversion from Python SciPy (\ghpr{158} addressing \ghit{141}) } \item Optional return of row or column vectors in collapsed form if appropriate \code{#define} is set (Serguei Sokol in \ghpr{151} and \ghpr{154}) \item Correct \code{speye()} for non-symmetric cases (Qiang Kou in \ghpr{150} closing \ghit{149}). \item Ensure tests using Scientific Python and reticulate are properly conditioned on the packages being present. \item Added \code{.aspell/} directory with small local directory now supported by R-devel. } } \section{Changes in RcppArmadillo version 0.7.900.2.0 (2017-06-02)}{ \itemize{ \item Upgraded to Armadillo release 7.900.2 (Evil Banana Republic) \itemize{ \item Expanded \code{clamp()} to handle cubes \item Computationally expensive element-wise functions (such as \code{exp()}, \code{log()}, \code{cos()}, etc) can now be automatically sped up via OpenMP; this requires a C++11/C++14 compiler with OpenMP 3.0+ support for GCC and clang compilers \item One caveat: when using GCC, use of \code{-march=native} in conjunction with \code{-fopenmp} may lead to speed regressions on recent processors } \item Added gcc 7 to support compiler check (James Balamuta in \ghpr{128} addressing \ghit{126}). \item A unit test helper function for \code{rmultinom} was corrected (\ghpr{133}). \item OpenMP support was added to the skeleton helper in \code{inline.R} } } \section{Changes in RcppArmadillo version 0.7.800.2.0 (2017-04-12)}{ \itemize{ \item Upgraded to Armadillo release 7.800.2 (Rogue State Redux) \itemize{ \item The Armadillo license changed to Apache License 2.0 } \item The \code{DESCRIPTION} file now mentions the Apache License 2.0, as well as the former MPL2 license used for earlier releases. \item A new file \code{init.c} was added with calls to \code{R_registerRoutines()} and \code{R_useDynamicSymbols()} \item Symbol registration is enabled in \code{useDynLib} \item The \code{fastLm} example was updated } } \section{Changes in RcppArmadillo version 0.7.700.0.0 (2017-02-07)}{ \itemize{ \item Upgraded to Armadillo release 7.700.0 (Rogue State) \itemize{ \item added \code{polyfit()} and \code{polyval()} \item added second form of \code{log_det()} to directly return the result as a complex number \item added \code{range()} to statistics functions \item expanded \code{trimatu()}/\code{trimatl()} and \code{symmatu()}/\code{symmatl()} to handle sparse matrice } } } \section{Changes in RcppArmadillo version 0.7.600.2.0 (2017-01-05)}{ \itemize{ \item Upgraded to Armadillo release 7.600.2 (Coup d'Etat Deluxe) \itemize{ \item Bug fix to memory allocation for \code{fields} } } } \section{Changes in RcppArmadillo version 0.7.600.1.0 (2016-12-16)}{ \itemize{ \item Upgraded to Armadillo release 7.600.1 (Coup d'Etat Deluxe) \itemize{ \item more accurate \code{eigs_sym()} and \code{eigs_gen()} \item expanded \code{floor()}, \code{ceil()}, \code{round()}, \code{trunc()}, \code{sign()} to handle sparse matrices \item added \code{arg()}, \code{atan2()}, \code{hypot()} } } } \section{Changes in RcppArmadillo version 0.7.500.1.0 (2016-11-11)}{ \itemize{ \item Upgraded to Armadillo release 7.500.1 \item Small improvement to return value treatment \item The \code{sample.h} extension was updated to the newer Armadillo interface. (Closes \ghit{111}) } } \section{Changes in RcppArmadillo version 0.7.500.0.0 (2016-10-20)}{ \itemize{ \item Upgraded to Armadillo release 7.500.0 (Coup d'Etat) \itemize{ \item Expanded \code{qz()} to optionally specify ordering of the Schur form \item Expanded \code{each_slice()} to support matrix multiplication } } } \section{Changes in RcppArmadillo version 0.7.400.2.0 (2016-08-24)}{ \itemize{ \item Upgraded to Armadillo release 7.400.2 (Feral Winter Deluxe) \itemize{ \item added \code{expmat_sym()}, \code{logmat_sympd()}, \code{sqrtmat_sympd()} \item added \code{.replace()} } } } \section{Changes in RcppArmadillo version 0.7.300.1.0 (2016-07-30)}{ \itemize{ \item Upgraded to Armadillo release 7.300.1 \itemize{ \item added \code{index_min()} and \code{index_max()} standalone functions \item expanded \code{.subvec()} to accept \code{size()} arguments \item more robust handling of non-square matrices by \code{lu()} } } } \section{Changes in RcppArmadillo version 0.7.200.2.0 (2016-07-22)}{ \itemize{ \item Upgraded to Armadillo release 7.200.2 \item The sampling extension was rewritten to use Armadillo vector types instead of Rcpp types (PR \ghpr{101} by James Balamuta) } } \section{Changes in RcppArmadillo version 0.7.200.1.0 (2016-06-06)}{ \itemize{ \item Upgraded to Armadillo release 7.200.1 \itemize{ \item added \code{.index_min()} and \code{.index_max()} \item expanded \code{ind2sub()} to handle vectors of indices \item expanded \code{sub2ind()} to handle matrix of subscripts \item expanded \code{expmat()}, \code{logmat()} and \code{sqrtmat()} to optionally return a bool indicating success \item faster handling of compound expressions by \code{vectorise()} } \item The \code{configure} code now (once again) sets the values for the LAPACK feature \code{#define} correctly. } } \section{Changes in RcppArmadillo version 0.7.100.3.0 (2016-05-25)}{ \itemize{ \item Upgraded to Armadillo test release 7.100.3 \itemize{ \item added \code{erf()}, \code{erfc()}, \code{lgamma()} \item added \code{.head_slices()} and \code{.tail_slices()} to subcube views \item \code{spsolve()} now requires SuperLU 5.2 \item \code{eigs_sym()}, \code{eigs_gen()} and \code{svds()} now use a built-in reimplementation of ARPACK for real (non-complex) matrices (code contributed by Yixuan Qiu) } \item The \code{configure} code now checks against old \code{g++} version which are no longer sufficient to build the package. } } \section{Changes in RcppArmadillo version 0.6.700.6.0 (2016-05-05)}{ \itemize{ \item Upgraded to Armadillo 6.700.6 (Catabolic Amalgamator Deluxe) \itemize{ \item fix for handling empty matrices by \code{kron()} \item fix for clang warning in advanced matrix constructors \item fix for false deprecated warning in \code{trunc_log()} and \code{trunc_exp()} \item fix for gcc-6.1 warning about misleading indentation \item corrected documentation for the \code{solve()} function } \item Added support for \code{int64_t} (\code{ARMA_64BIT_WORD}) when required during compilation time. (PR \ghpr{90} by George G. Vega Yon, fixing \ghpr{88}) \item Fixed bug in \code{SpMat} exporter (PR \ghpr{91} by George G. Vega Yon, fixing \ghit{89} and \ghit{72}) } } \section{Changes in RcppArmadillo version 0.6.700.3.0 (2016-04-05)}{ \itemize{ \item Upgraded to Armadillo 6.700.3 (Catabolic Amalgamator Deluxe) \itemize{ \item added \code{logmat()} for calcuating the matrix logarithm \item added \code{regspace()} for generating vectors with regularly spaced elements \item added \code{logspace()} for generating vectors with logarithmically spaced elements \item added \code{approx_equal()} for determining approximate equality \item added \code{trapz()} for numerical integration \item expanded \code{.save()} and \code{.load()} with hdf5_binary_trans file type, to save/load data with columns transposed to rows } } } \section{Changes in RcppArmadillo version 0.6.600.4.0 (2016-03-15)}{ \itemize{ \item Upgraded to Armadillo 6.600.4 (Catabolic Amalgamator) \itemize{ \item expanded \code{sum()}, \code{mean()}, \code{min()}, \code{max()} to handle cubes \item expanded \code{Cube} class to handle arbitrarily sized empty cubes (eg. 0x5x2) \item added \code{shift()} for circular shifts of elements \item added \code{sqrtmat()} for finding the square root of a matrix \item fix for \code{gmm_diag} when using Mahalanobis distance } \item The \code{configure} script now reflects the full LAPACK fallback offered by R 3.3.0 or later (PR \ghpr{81}) } } \section{Changes in RcppArmadillo version 0.6.500.4.0 (2016-01-26)}{ \itemize{ \item Upgraded to Armadillo 6.500.4 (Gourmet Electron Jumper) \itemize{ \item added \code{conv2()} for 2D convolution \item added stand-alone \code{kmeans()} function for clustering data \item added \code{trunc()} \item extended \code{conv()} to optionally provide central convolution \item faster handling of multiply-and-accumulate by \code{accu()} when using Intel MKL, ATLAS or OpenBLAS } \item The \code{configure} script now uses \code{#!/usr/bin/env bash} to cope with systems that do not have \code{#!/bin/bash} (PR \ghpr{75} fixing issue \ghpr{74}) \item RcppArmadillo now defines ARMA_32BIT_WORD to ensure we always use integer vectors that be passed to R } } \section{Changes in RcppArmadillo version 0.6.400.2.0 (2015-12-15)}{ \itemize{ \item Upgraded to Armadillo 6.400.2 ("Flying Spaghetti Monster Deluxe") \itemize{ \item expanded \code{each_col()}, \code{each_row()} and \code{each_slice()} to handle C++11 lambda functions \item added \code{ind2sub()} and \code{sub2ind()} \item fixes for corner cases in gmm_diag class } } } \section{Changes in RcppArmadillo version 0.6.300.2.2 (2015-12-12)}{ \itemize{ \item Upgraded to Armadillo 6.300.3-test ("Flying Spaghetti Monster") \itemize{ \item Additional test in \code{auxlib_meat.hpp} for limited LAPACK } \item Updated test and \code{#define} for limited LAPACK version R might be built with on Unix-alike systems } } \section{Changes in RcppArmadillo version 0.6.300.2.0 (2015-12-03)}{ \itemize{ \item Upgraded to Armadillo 6.300.2 ("Flying Spaghetti Monster") \itemize{ \item expanded \code{solve()} to find approximate solutions for rank-deficient systems \item faster handling of non-contiguous submatrix views in compound expressions \item added \code{.for_each()} to Mat, Row, Col, Cube and field classes \item added \code{rcond()} for estimating the reciprocal condition number \item fixes for \code{spsolve()}, \code{eigs_sym()}, \code{eigs_gen()}, \code{svds()} } \item Added support for \code{Cube} types via \code{as<>} converters (PR \ghpr{64} by Nathan Russell, fixing \ghit{63} and \ghit{42}) } } \section{Changes in RcppArmadillo version 0.6.200.2.0 (2015-10-31)}{ \itemize{ \item Upgraded to Armadillo 6.200.0 ("Midnight Blue Deluxe") \itemize{ \item expanded \code{diagmat()} to handle non-square matrices and arbitrary diagonals \item expanded \code{trace()} to handle non-square matrices } } } \section{Changes in RcppArmadillo version 0.6.100.0.0 (2015-10-03)}{ \itemize{ \item Upgraded to Armadillo 6.100.0 ("Midnight Blue") \itemize{ \item faster \code{norm()} and \code{normalise()} when using ATLAS or OpenBLAS \item added Schur decomposition: \code{schur()} \item stricter handling of matrix objects by \code{hist()} and \code{histc()} \item advanced constructors for using auxiliary memory by Mat, Col, Row and Cube now have the default of \emph{strict = false} \item Cube class now delays allocation of .slice() related structures until needed \item expanded \code{join_slices()} to handle joining cubes with matrices } } } \section{Changes in RcppArmadillo version 0.6.000.1.0 (2015-09-25)}{ \itemize{ \item Upgraded to Armadillo test / bug-fix release 0.6.000.1-test \item Non-CRAN release } } \section{Changes in RcppArmadillo version 0.5.600.2.0 (2015-09-19)}{ \itemize{ \item Upgraded to Armadillo 5.600.2 ("Molotov Cocktail Deluxe") \itemize{ \item expanded \code{.each_col()} and \code{.each_row()} to handle out-of-place operations \item added \code{.each_slice()} for repeated matrix operations on each slice of a cube \item faster handling of compound expressions by \code{join_rows()} and \code{join_cols()} } } } \section{Changes in RcppArmadillo version 0.5.500.2.0 (2015-09-03)}{ \itemize{ \item Upgraded to Armadillo 5.500.2 ("Molotov Cocktail") \itemize{ \item expanded object constructors and generators to handle \code{size()} based specification of dimensions \item faster handling of submatrix rows \item faster \code{clamp()} \item fixes for handling sparse matrices } } } \section{Changes in RcppArmadillo version 0.5.400.2.0 (2015-08-17)}{ \itemize{ \item Upgraded to Armadillo 5.400.2 ("Plutocracy Incorporated Deluxe") \itemize{ \item added \code{find_unique()} for finding indices of unique values \item added \code{diff()} for calculating differences between consecutive elements \item added \code{cumprod()} for calculating cumulative product \item added \code{null()} for finding the orthonormal basis of null space \item expanded \code{interp1()} to handle repeated locations \item expanded \code{unique()} to handle complex numbers \item faster \code{flupud()} \item faster row-wise \code{cumsum()} \item fix for k-means clustering in gmm_diag class } \item corrected use of \code{kitten()} thanks to Grant Brown } } \section{Changes in RcppArmadillo version 0.5.300.4 (2015-08-03)}{ \itemize{ \item Upgraded to Armadillo 5.300.4 ("Plutocrazy Incorporated") \itemize{ \item added generalised Schur decomposition: \code{qz()} \item added \code{.has_inf()} and \code{.has_nan()} \item expanded \code{interp1()} to handle out-of-domain locations \item expanded sparse matrix class with \code{.set_imag()} and \code{.set_real()} \item expanded \code{imag()}, \code{real()} and \code{conj()} to handle sparse matrices \item expanded \code{diagmat()}, \code{reshape()} and \code{resize()} to handle sparse matrices \item faster sparse \code{sum()} \item faster row-wise \code{sum()}, \code{mean()}, \code{min()}, \code{max()} \item updated physical constants to NIST 2014 CODATA values \item fixes for handling sparse submatrix views \item Armadillo can make use of GPUs by linking with NVIDIA NVBLAS (a GPU-accelerated implementation of BLAS), or by linking with AMD ACML (which can use GPUs via OpenCL) } \item Added \code{importFrom} statements for R functions not from base \item Added explicit \code{Rcpp::sourceCpp()} reference as well \item Updated one formatting detail in vignette to please TeXlive2015 } } \section{Changes in RcppArmadillo version 0.5.200.1.0 (2015-06-04)}{ \itemize{ \item Upgraded to Armadillo release 5.200.1 ("Boston Tea Smuggler") \itemize{ \item added \code{orth()} for finding the orthonormal basis of the range space of a matrix \item expanded element initialisation to handle nested initialiser lists (C++11) \item workarounds for bugs in GCC, Intel and MSVC C++ compilers } \item Added another example to \code{inst/examples/fastLm.r} } } \section{Changes in RcppArmadillo version 0.5.100.2.0 (2015-05-12)}{ \itemize{ \item Upgraded to Armadillo test / bug-fix release 5.100.2 \item Non-CRAN release } } \section{Changes in RcppArmadillo version 0.5.100.1.0 (2015-05-01)}{ \itemize{ \item Upgraded to Armadillo release 5.100.1 ("Ankle Biter Deluxe") \itemize{ \item added \code{interp1()} for 1D interpolation \item added \code{.is_sorted()} for checking whether a vector or matrix has sorted elements \item updated physical constants to NIST 2010 CODATA values } } } \section{Changes in RcppArmadillo version 0.5.000.0 (2015-04-12)}{ \itemize{ \item Upgraded to Armadillo release Version 5.000 ("Ankle Biter") \itemize{ \item added \code{spsolve()} for solving sparse systems of linear equations \item added \code{svds()} for singular value decomposition of sparse matrices \item added \code{nonzeros()} for extracting non-zero values from matrices \item added handling of diagonal views by sparse matrices \item expanded \code{repmat()} to handle sparse matrices \item expanded \code{join_rows()} and \code{join_cols()} to handle sparse matrices \item \code{sort_index()} and \code{stable_sort_index()} have been placed in the delayed operations framework for increased efficiency \item use of 64 bit integers is automatically enabled when using a C++11 compiler \item workaround for a bug in recent releases of Apple Xcode \item workaround for a bug in LAPACK 3.5 } } } \section{Changes in RcppArmadillo version 0.4.999.1.0 (2015-04-04)}{ \itemize{ \item Upgraded to Armadillo release preview 4.999.1 \item Non-CRAN test release } } \section{Changes in RcppArmadillo version 0.4.650.1.1 (2015-02-25)}{ \itemize{ \item Upgraded to Armadillo release Version 4.650.1 ("Intravenous Caffeine Injector") \itemize{ \item added \code{randg()} for generating random values from gamma distributions (C++11 only) \item added \code{.head_rows()} and \code{.tail_rows()} to submatrix views \item added \code{.head_cols()} and \code{.tail_cols()} to submatrix views \item expanded \code{eigs_sym()} to optionally calculate eigenvalues with smallest/largest algebraic values fixes for handling of sparse matrices } \item Applied small correction to main header file to set up C++11 RNG whether or not the alternate RNG (based on R, our default) is used } } \section{Changes in RcppArmadillo version 0.4.600.4.0 (2015-01-23)}{ \itemize{ \item Upgraded to Armadillo release Version 4.600.4 (still "Off The Reservation") \itemize{ \item Speedups in the transpose operation \item Small bug fixes } } } \section{Changes in RcppArmadillo version 0.4.600.0 (2014-12-27)}{ \itemize{ \item Upgraded to Armadillo release Version 4.600 ("Singapore Sling Deluxe") \itemize{ \item added \code{.head()} and \code{.tail()} to submatrix views \item faster matrix transposes within compound expressions \item faster \code{accu()} and \code{norm()} when compiling with -O3 -ffast-math -march=native (gcc and clang) \item workaround for a bug in GCC 4.4 } } } \section{Changes in RcppArmadillo version 0.4.550.2.0 (2014-12-02)}{ \itemize{ \item Upgraded to Armadillo release Version 4.550.2 ("Singapore Sling Deluxe") \itemize{ \item Bug fixes for implicit template initiation for \code{std::pow()} seen with the old g++ 4.4* series } } } \section{Changes in RcppArmadillo version 0.4.550.1.0 (2014-11-26)}{ \itemize{ \item Upgraded to Armadillo release Version 4.550.1 ("Singapore Sling Deluxe") \itemize{ \item added matrix exponential function: \code{expmat()} \item faster \code{.log_p()} and \code{.avg_log_p()} functions in the \code{gmm_diag} class when compiling with OpenMP enabled \item faster handling of in-place addition/subtraction of expressions with an outer product \item applied correction to \code{gmm_diag} relative to the 4.550 release } \item The Armadillo Field type is now converted in \code{as<>} conversions } } \section{Changes in RcppArmadillo version 0.4.500.0 (2014-10-30)}{ \itemize{ \item Upgraded to Armadillo release Version 4.500 ("Singapore Sling") \itemize{ \item faster handling of complex vectors by \code{norm()} \item expanded \code{chol()} to optionally specify output matrix as upper or lower triangular \item better handling of non-finite values when saving matrices as text files } \item The \code{sample} functionality has been extended to provide the Walker Alias method (including new unit tests) via a pull request by Christian Gunning } } \section{Changes in RcppArmadillo version 0.4.450.1.0 (2014-09-21)}{ \itemize{ \item Upgraded to Armadillo release Version 4.450.1 (Spring Hill Fort) \itemize{ \item faster handling of matrix transposes within compound expressions \item expanded \code{symmatu()}/\code{symmatl()} to optionally disable taking the complex conjugate of elements \item expanded \code{sort_index()} to handle complex vectors \item expanded the \code{gmm_diag} class with functions to generate random samples } \item A new random-number implementation for Armadillo uses the RNG from R as a fallback (when C++11 is not selected so the C++11-based RNG is unavailable) which avoids using the older C++98-based \code{std::rand} \item The \code{RcppArmadillo.package.skeleton()} function was updated to only set an "Imports:" for Rcpp, but not RcppArmadillo which (as a template library) needs only LinkingTo: \item The \code{RcppArmadillo.package.skeleton()} function will now prefer \code{pkgKitten::kitten()} over \code{package.skeleton()} in order to create a working package which passes \code{R CMD check}. \item The \CRANpkg{pkgKitten} package is now a \code{Suggests:} \item A manual page was added to provide documentation for the functions provided by the skeleton package. \item A small update was made to the package manual page. } } \section{Changes in RcppArmadillo version 0.4.400.0 (2014-08-19)}{ \itemize{ \item Upgraded to Armadillo release Version 4.400 (Winter Shark Alley) \itemize{ \item added \code{gmm_diag} class for statistical modelling using Gaussian Mixture Models; includes multi-threaded implementation of k-means and Expectation-Maximisation for parameter estimation \item added \code{clamp()} for clamping values to be between lower and upper limits \item expanded batch insertion constructors for sparse matrices to add values at repeated locations \item faster handling of subvectors by \code{dot()} \item faster handling of aliasing by submatrix views } \item Corrected a bug (found by the g++ Address Sanitizer) in sparse matrix initialization where space for a sentinel was allocated, but the sentinel was not set; with extra thanks to Ryan Curtin for help \item Added a few unit tests for sparse matrices } } \section{Changes in RcppArmadillo version 0.4.320.0 (2014-07-03)}{ \itemize{ \item Upgraded to Armadillo release Version 4.320 (Daintree Tea Raider) \itemize{ \item expanded \code{eigs_sym()} and \code{eigs_gen()} to use an optional tolerance parameter \item expanded \code{eig_sym()} to automatically fall back to standard decomposition method if divide-and-conquer fails \item automatic installer enables use of C++11 random number generator when using gcc 4.8.3+ in C++11 mode } } } \section{Changes in RcppArmadillo version 0.4.300.8.0 (2014-05-31)}{ \itemize{ \item Upgraded to Armadillo release Version 4.300.8 (Medieval Cornea Scraper) \itemize{ \item More robust \code{norm}-related functions \item Fixes between interactions between \code{cube} and \code{vector} types. } \item Adds a \code{#define ARMA_DONT_USE_CXX11} to provide an option to turn C++11 off for Armadillo (but client packages may still use it) \item More robust Windows detection by using \code{_WIN32} as well as \code{WIN32} as the latter gets diabled by MinGW with C++11 \item On Windows, C++11 is turned off as the Armadillo code base uses more features of C++11 than g++ 4.6.2 version in Rtools implements } } \section{Changes in RcppArmadillo version 0.4.300.5.0 (2014-05-19)}{ \itemize{ \item Upgraded to Armadillo release Version 4.300.5 (Medieval Cornea Scraper) \itemize{ \item Handle possible underflows and overflows in \code{norm()}, \code{normalise()}, \code{norm_dot()} \item Fix for handling of null vectors by \code{norm_dot()} } } } \section{Changes in RcppArmadillo version 0.4.300.2.0 (2014-05-13)}{ \itemize{ \item Upgraded to Armadillo release Version 4.300.2 (Medieval Cornea Scraper) \itemize{ \item faster \code{find()} } } } \section{Changes in RcppArmadillo version 0.4.300.0 (2014-05-04)}{ \itemize{ \item Upgraded to Armadillo release Version 4.300 (Medieval Cornea Scraper) \itemize{ \item faster \code{find()} \item added \code{find_finite()} and \code{find_nonfinite()} for finding indices of finite and non-finite elements \item expressions \code{X=inv(A)*B*C} and \code{X=A.i()*B*C} are automatically converted to X=solve(A,B*C) } \item Corrected conversion to \code{unsigned int} vectors and matrices \item Configure script now checks for R version 3.0.3 or newer to enable complex divide-and-conquer SVD in case of R-supplied LAPACK } } \section{Changes in RcppArmadillo version 0.4.200.0 (2014-04-07)}{ \itemize{ \item Upgraded to Armadillo release Version 4.200 (Flintlock Swoop) \itemize{ \item faster transpose of sparse matrices \item more efficient handling of aliasing during matrix multiplication \item faster inverse of matrices marked as diagonal } } } \section{Changes in RcppArmadillo version 0.4.100.2 (2014-03-07)}{ \itemize{ \item Upgraded to Armadillo release Version 4.100.2 \itemize{ \item fix for handling null vectors by \code{normalise()} \item fix for memory handling by sparse matrices } \item Correct use of \code{[[ depends()]]} in skeleton example file \item Prepare \code{src/Makevars} for C++11 support from R 3.1.0 by defining \code{USE_CXX11} which is currently commented out \item In the Armadillo configuration, turn on C++11 support if \code{USE_CXX11} is defined } } \section{Changes in RcppArmadillo version 0.4.100.0 (2014-02-28)}{ \itemize{ \item Upgraded to Armadillo release Version 4.100.0 (Dirt Cruiser) \itemize{ \item added \code{normalise()} for normalising vectors to unit p-norm \item extended the \code{field} class to handle 3D layout \item extended \code{eigs_sym()} and \code{eigs_gen()} to obtain eigenvalues of various forms (eg. largest or smallest magnitude) \item automatic SIMD vectorisation of elementary expressions (eg. matrix addition) when using Clang 3.4+ with -O3 optimisation \item faster handling of sparse submatrix views \item workaround for a bug in LAPACK 3.4 } } } \section{Changes in RcppArmadillo version 0.4.000.4 (2014-02-19)}{ \itemize{ \item Upgraded to Armadillo release Version 4.000.4 \itemize{ \item fix for \code{randi()} generating out-of-interval values \item fix for saving field objects \item workaround for a bug in the Intel compiler } \item Updated for \CRANpkg{Rcpp} (>= 0.11.0) by removing linking step from build process, added appropriate dependency on \CRANpkg{Rcpp} \item Updated \code{RcppArmadillo.package.skeleton} function accordingly to use proper \code{NAMESPACE} import \item Rewritten \code{rcpparma_hello_world} (which is used by the \code{RcppArmadillo.package.skeleton} function) to use Rcpp Attributes, and added more examples \item Added two functions to set Armadillo's RNGs (ie the system RNG) from a given value and to randomize it, as suggested by Gábor Csárdi. Note that these do not work within RStudio (which itself also uses the same system RNG). } } \section{Changes in RcppArmadillo version 0.4.000.2 (2014-01-21)}{ \itemize{ \item Upgraded to Armadillo release Version 4.000.2 \itemize{ \item fix for \code{randi()} generating out-of-interval values \item workaround for a bug in the Intel compiler } } } \section{Changes in RcppArmadillo version 0.4.000 (2014-01-05)}{ \itemize{ \item Upgraded to Armadillo release Version 4.000 (Feral Steamroller) \itemize{ \item added eigen decompositions of sparse matrices: \code{eigs_sym()} and \code{eigs_gen()} [ but this requires linking against ARPACK which \CRANpkg{RcppArmadillo} as a pure-template package does not do, and R is not linked against ARPACK either. ] \item added eigen decomposition for pair of matrices: \code{eig_pair()} \item added simpler forms of \code{eig_gen()} \item added condition number of matrices: \code{cond()} \item expanded \code{find()} to handle cubes \item expanded subcube views to access elements specified in a vector \item template argument for \code{running_stat_vec} expanded to accept vector types \item more robust fast inverse of 4x4 matrices \item faster divide-and-conquer decompositions are now used by default for \code{eig_sym()}, \code{pinv()}, \code{princomp()}, \code{rank()}, \code{svd()}, \code{svd_econ()} \item the form \code{inv(sympd(X))} no longer assumes that X is positive definite; use \code{inv_sympd()} instead \item added MEX connector for interfacing Octave/Matlab with Armadillo matrices (contributed by George Yammine) } } } \section{Changes in RcppArmadillo version 0.3.930.1 (2013-12-09)}{ \itemize{ \item Upgraded to Armadillo release Version 3.930.1 \itemize{ \item Armadillo falls back to standard complex svd if the more performant divide-and-conquer variant is unavailable } \item Added detection for Lapack library and distinguish between R's own version (withhout zgesdd) and system Lapack; a preprocessor define is set accordingly } } \section{Changes in RcppArmadillo version 0.3.930.0 (2013-12-06)}{ \itemize{ \item Upgraded to Armadillo release Version 3.930 ("Dragon's Back") \itemize{ \item added divide-and-conquer variant of \code{svd_econ()}, for faster SVD \item added divide-and-conquer variant of \code{pinv()}, for faster pseudo-inverse \item added element-wise variants of \code{min()} and \code{max()} \item added \code{size()} based specifications of submatrix view sizes \item added \code{randi()} for generating matrices with random integer values \item added more intuitive specification of sort direction in \code{sort()} and \code{sort_index()} \item added more intuitive specification of method in \code{det()}, \code{.i()}, \code{inv()} and \code{solve()} \item added more precise timer for the \code{wall_clock} class when using C++11 } \item New unit tests for complex matrices and vectors } } \section{Changes in RcppArmadillo version 0.3.920.3 (2013-11-20)}{ \itemize{ \item Upgraded to Armadillo release Version 3.920.3 \itemize{ \item fix for handling of tiny matrices by \code{.swap()} } } } \section{Changes in RcppArmadillo version 0.3.920.1 (2013-09-27)}{ \itemize{ \item Upgraded to Armadillo release Version 3.920.1 (Agencia Nacional Stasi) \itemize{ \item faster \code{.zeros()} \item faster \code{round()}, \code{exp2()} and \code{log2()} when using C++11 \item added signum function: \code{sign()} \item added move constructors when using C++11 \item added 2D fast Fourier transform: \code{fft2()} \item added \code{.tube()} for easier extraction of vectors and subcubes from cubes \item added specification of a fill type during construction of Mat, Col, Row and Cube classes, eg. \code{mat X(4, 5, fill::zeros)} } \item Initial implementation of \code{wrap} \item Improved implementation of \code{as<>()} and \code{wrap()} for sparse matrices \item Converted main vignette from \code{LaTeX} style \code{minted} to \code{lstlisting} which permits builds on CRAN; removed set \code{BuildVignettes: FALSE}. } } \section{Changes in RcppArmadillo version 0.3.910.0 (2013-08-12)}{ \itemize{ \item Upgraded to Armadillo release Version 3.910.0 (Pyrenees) \itemize{ \item faster multiplication of a matrix with a transpose of itself, ie. \code{X*X.t()} and \code{X.t()*X} \item added \code{vectorise()} for reshaping matrices into vectors \item added \code{all()} and \code{any()} for indicating presence of elements satisfying a relational condition } \item Added conversion support for sparse matrices (of type double) created by the \CRANpkg{Matrix} package as class \code{dgCMatrix} \item Moved vignette sources from \code{inst/doc} to \code{vignettes}; set \code{BuildVignettes: FALSE} as the \code{minted} mode for \code{LaTeX} upsets the CRAN builders. } } \section{Changes in RcppArmadillo version 0.3.900.7 (2013-08-02)}{ \itemize{ \item Upgraded to Armadillo release Version 3.900.7 (Bavarian Sunflower) \itemize{ \item minor fix for inplace \code{reshape()} \item minor corrections for compilation issues under GCC 4.8+ and MSVC } \item Corrected setting of \code{vec_stats} in intialization of row, vector and matrix objects \item The \pkg{inline} package is no longer used in the examples and unit tests which have all been converted to using Rcpp attributes } } \section{Changes in RcppArmadillo version 0.3.900 (2013-06-04)}{ \itemize{ \item Upgraded to Armadillo release Version 3.900.0 (Bavarian Sunflower) \itemize{ \item added automatic SSE2 vectorisation of elementary expressions (eg. matrix addition) when using GCC 4.7+ with -O3 optimisation \item added support for saving & loading of cubes in HDF5 format, contributed by Szabolcs Horvat \item faster \code{median()}, contributed by Ruslan Shestopalyuk \item faster handling of compound expressions with transposes of submatrix rows \item faster handling of compound expressions with transposes of complex vectors } \item Kalman filter example switched from inline to \code{sourceCpp}, which simplifies / streamlines the C++ side a little } } \section{Changes in RcppArmadillo version 0.3.820 (2013-05-12)}{ \itemize{ \item Upgraded to Armadillo release Version 3.820 (Mt Cootha) \itemize{ \item faster \code{as_scalar()} for compound expressions \item faster transpose of small vectors \item faster matrix-vector product for small vectors \item faster multiplication of small fixed size matrices } } } \section{Changes in RcppArmadillo version 0.3.810.2 (2013-04-30)}{ \itemize{ \item Upgraded to Armadillo release Version 3.810.2 \itemize{ \item minor fix for initialisation of sparse matrices } } } \section{Changes in RcppArmadillo version 0.3.810.0 (2013-04-19)}{ \itemize{ \item Upgraded to Armadillo release Version 3.810.0 (Newell Highway) \itemize{ \item added fast Fourier transform: \code{fft()} \item added handling of \code{.imbue()} and \code{.transform()} by submatrices and subcubes \item added batch insertion constructors for sparse matrices \item minor fix for multiplication of complex sparse matrices } \item Updated sample() function and test again contributed by Christian Gunning } } \section{Changes in RcppArmadillo version 0.3.800.1 (2013-03-12)}{ \itemize{ \item Upgraded to Armadillo release Version 3.800.1 (Miami Beach) \itemize{ \item workaround for a bug in ATLAS 3.8 on 64 bit systems \item faster matrix-vector multiply for small matrices } \item Added new sample() function and tests contributed by Christian Gunning \item Refactored unit testing code for faster unit test performance } } \section{Changes in RcppArmadillo version 0.3.800.0 (2013-03-01)}{ \itemize{ \item Upgraded to Armadillo release Version 3.800.0 (Miami Beach) \itemize{ \item Armadillo is now licensed using the Mozilla Public License 2.0 \item added \code{.imbue()} for filling a matrix/cube with values provided by a functor or lambda expression \item added \code{.swap()} for swapping contents with another matrix \item added \code{.transform()} for transforming a matrix/cube using a functor or lambda expression \item added \code{round()} for rounding matrix elements towards nearest integer \item faster \code{find()} \item fixes for handling non-square matrices by \code{qr()} and \code{qr_econ()} \item minor fixes for handling empty matrices \item reduction of pedantic compiler warnings } \item Updated vignette to paper now in press at CSDA \item Added CITATION file with reference to CSDA paper } } \section{Changes in RcppArmadillo version 0.3.6.3 (2013-02-20)}{ \itemize{ \item Upgraded to Armadillo release Version 3.6.3 \itemize{ \item faster \code{find()} \item minor fix for non-contiguous submatrix views to handle empty vectors of indices \item reduction of pedantic compiler warnings } } } \section{Changes in RcppArmadillo version 0.3.6.2 (2013-01-29)}{ \itemize{ \item Upgraded to Armadillo release Version 3.6.2 \itemize{ \item faster determinant for matrices marked as diagonal or triangular \item more fine-grained handling of 64 bit integers } \item Added a new example of a Kalman filter implementation in R, and C++ using Armadillo via RcppArmadillo, complete with timing comparison } } \section{Changes in RcppArmadillo version 0.3.6.1 (2012-12-17)}{ \itemize{ \item Upgraded to Armadillo release Version 3.6.1 (Piazza del Duomo) \itemize{ \item faster \code{trace()} \item fix for handling sparse matrices by \code{dot()} \item fixes for interactions between sparse and dense matrices } \item Now throws compiler error if \code{Rcpp.h} is included before \code{RcppArmadillo.h} (as the former is included automatically by the latter anyway, but template logic prefers this ordering). } } \section{Changes in RcppArmadillo version 0.3.4.3 (2012-10-04)}{ \itemize{ \item Upgraded to Armadillo release 3.4.3 \itemize{ \item fix for aliasing issue in \code{diagmat()} \item fix for \code{speye()} signature } } } \section{Changes in RcppArmadillo version 0.3.4.2 (2012-09-25)}{ \itemize{ \item Upgraded to Armadillo release 3.4.2 \itemize{ \item minor fixes for handling sparse submatrix views \item minor speedups for sparse matrices } } } \section{Changes in RcppArmadillo version 0.3.4.1 (2012-09-18)}{ \itemize{ \item Upgraded to Armadillo release 3.4.1 \itemize{ \item workaround for a bug in the Mac OS X accelerate framework \item fixes for handling empty sparse matrices \item added documentation for saving & loading matrices in HDF5 format \item faster dot() and cdot() for complex numbers } } } \section{Changes in RcppArmadillo version 0.3.4.0 (2012-09-06)}{ \itemize{ \item Upgraded to Armadillo release 3.4.0 (Ku De Ta) \itemize{ \item added economical QR decomposition: qr_econ() \item added .each_col() & .each_row() for vector operations repeated on each column or row \item added preliminary support for sparse matrices, contributed by Ryan Curtin et al. (Georgia Institute of Technology) \item faster singular value decomposition via divide-and-conquer algorithm \item faster .randn() } \item NEWS file converted to Rd format } } \section{Changes in RcppArmadillo version 0.3.3.91 (2012-08-30)}{ \itemize{ \item Upgraded to Armadillo release 3.3.91 \itemize{ \item faster singular value decomposition via "divide and conquer" algorithm \item added economical QR decomposition: qr_econ() \item added .each_col() & .each_row() for vector operations repeated on each column or row \item added preliminary support for sparse matrices, contributed by Ryan Curtin, James Cline and Matthew Amidon (Georgia Institute of Technology) } \item Corrected summary method to deal with the no intercept case when using a formula; also display residual summary() statistics \item Expanded unit tests for fastLm } } \section{Changes in RcppArmadillo version 0.3.2.4 (2012-07-11)}{ \itemize{ \item Upgraded to Armadillo release 3.2.4 \itemize{ \item workaround for a regression (bug) in GCC 4.7.0 and 4.7.1 } } } \section{Changes in RcppArmadillo version 0.3.2.3 (2012-07-01)}{ \itemize{ \item Upgraded to Armadillo release 3.2.3 \itemize{ \item minor correction for declaration of fixed size vectors and matrices \item Reverted three header files \{Mat,Row,Col\}_bones.hpp back to previous release due to compilation failures under g++-4.7 \item Added new vignette 'RcppArmadillo-intro' based on a just-submitted introductory paper (by Eddelbuettel and Sanderson) about RcppArmadillo \item Change from release 3.2.2 which we skipped as it did not really affect builds under R: \itemize{ \item minor fix for compiling without debugging enabled (aka release mode) \item better detection of ATLAS during installation on Fedora and Red Hat systems } \item Small enhancement to fastLm } } } \section{Changes in RcppArmadillo version 0.3.2.0 (2012-05-21)}{ \itemize{ \item Upgraded to Armadillo release 3.2.0 "Creamfields" \itemize{ \item faster eigen decomposition via "divide and conquer" algorithm \item faster transpose of vectors and compound expressions \item faster handling of diagonal views \item faster handling of tiny fixed size vectors (≤ 4 elements) \item added unique(), for finding unique elements of a matrix } } } \section{Changes in RcppArmadillo version 0.3.1.94 (2012-05-15)}{ \itemize{ \item Upgraded to Armadillo release 3.1.94 "v3.2 beta 2" \itemize{ \item added unique(), for finding unique elements of a matrix \item faster eigen decomposition via "divide and conquer" algorithm \item faster transpose of vectors and compound expressions \item faster handling of tiny fixed size vectors (≤ 4 elements) } } } \section{Changes in RcppArmadillo version 0.3.1.92 (2012-05-10)}{ \itemize{ \item Upgraded to Armadillo release 3.1.92 "v3.2 beta 2" \itemize{ \item added unique(), for finding unique elements of a matrix \item faster eigen decomposition via optional use of "divide and conquer" by eig_sym() \item faster transpose of vectors and compound expressions } } } \section{Changes in RcppArmadillo version 0.3.0.3 (2012-05-03)}{ \itemize{ \item Upgraded to Armadillo release 3.0.3 \itemize{ \item fixes for inplace transpose of complex number matrices \item fixes for complex number version of svd_econ() \item fixes for potential aliasing issues with submatrix views } \item New example script fastLm } } \section{Changes in RcppArmadillo version 0.3.0.2 (2012-04-19)}{ \itemize{ \item Upgraded to Armadillo release 3.0.2 \itemize{ \item fixes for handling diagonal matrices } \item Undefine NDEBUG if it has been set (as R does) as this prevents a number of useful debugging checks. Users can still define it or define ARMA_NO_DEBUG if they want a 'non-development' build } } \section{Changes in RcppArmadillo version 0.3.0.1 (2012-04-12)}{ \itemize{ \item Upgraded to Armadillo release 3.0.1 \itemize{ \item fixes for compilation errors \item fixes for potential aliasing issues } } } \section{Changes in RcppArmadillo version 0.3.0 (2012-04-10)}{ \itemize{ \item Upgraded to Armadillo release 3.0.0 "Antarctic Chilli Ranch" \itemize{ \item added non-contiguous submatrix views \item added shorthand for inverse: .i() \item added hist() and histc() \item faster repmat() \item faster handling of submatrix views with one row or column \item faster generation of random numbers \item faster element access in fixed size matrices \item better detection of vector expressions by sum(), cumsum(), prod(), min(), max(), mean(), median(), stddev(), var() \item expressions X=A.i()*B and X=inv(A)*B are automatically converted to X=solve(A,B) } } } \section{Changes in RcppArmadillo version 0.2.40 (2012-04-04)}{ \itemize{ \item Upgraded to Armadillo release 2.99.4 "Antarctic Chilli Ranch (Beta 4)" \itemize{ \item fixes for handling expressions with fixed size matrices } } } \section{Changes in RcppArmadillo version 0.2.39 (2012-04-02)}{ \itemize{ \item Upgraded to Armadillo release 2.99.3 "Antarctic Chilli Ranch (Beta 3)" \itemize{ \item faster repmat() \item workarounds for braindead compilers (eg. Visual Studio) } } } \section{Changes in RcppArmadillo version 0.2.38 (2012-03-28)}{ \itemize{ \item Upgraded to Armadillo release 2.99.2 "Antarctic Chilli Ranch (Beta 2)" \itemize{ \item added .i() \item much faster handling of .col() and .row() \item expressions X=A.i()*B and X=inv(A)*B are automatically converted to X=solve(A,B) } } } \section{Changes in RcppArmadillo version 0.2.37 (2012-03-19)}{ \itemize{ \item Upgraded to Armadillo release 2.99.1 "Antarctic Chilli Ranch (Beta 1)" \itemize{ \item added non-contiguous submatrix views \item added hist() and histc() \item faster handling of submatrix views \item faster generation of random numbers \item faster element access in fixed size matrices \item better detection of vector expressions by sum(), cumsum(), prod(), min(), max(), mean(), median(), stddev(), var() } } } \section{Changes in RcppArmadillo version 0.2.36 (2012-03-05)}{ \itemize{ \item Upgraded to Armadillo release 2.4.4 \itemize{ \item fixes for qr() and syl() \item more portable wall_clock class \item faster relational operators on submatrices } } } \section{Changes in RcppArmadillo version 0.2.35 (2012-02-17)}{ \itemize{ \item Upgraded to Armadillo release 2.4.3 \itemize{ \item Support for ARMA_DEFAULT_OSTREAM using Rcpp::Rcout added \item Minor bug fix release improving corner cases affecting builds: \itemize{ \item Missing semicolon added in Mat_meat (when in C++0x mode), with thanks to Teo Guo Ci \item Armadillo version vars now instantiated in RcppArmadillo.cpp which helps older g++ versions, with thanks to Gershon Bialer \item Thanks also to Martin Renner for testing these changes \item Unit tests output fallback directory changed per Brian Ripley's request to not ever use /tmp \item Minor update to version numbers in RcppArmadillo-package.Rd } } } } \section{Changes in RcppArmadillo version 0.2.34 (2011-12-12)}{ \itemize{ \item Upgraded to Armadillo release 2.4.2 \itemize{ \item clarified documentation for .reshape() \item fix for handling of empty matrices by .resize() } } } \section{Changes in RcppArmadillo version 0.2.33 (2011-12-07)}{ \itemize{ \item Upgraded to Armadillo release 2.4.1 \itemize{ \item added .resize() \item fix for vector initialisation } } } \section{Changes in RcppArmadillo version 0.2.32 (2011-12-04)}{ \itemize{ \item Upgraded to Armadillo test release 2.4.0 "Loco Lounge Lizard" \item Minimal changes relative to 0.2.31 based on 2.3.92, next section is relative to the previous stable release series 2.2.* of Armadillo \itemize{ \item added shorter forms of transposes: .t() and .st() \item added optional use of 64 bit indices, allowing matrices to have more than 4 billion elements \item added experimental support for C++11 initialiser lists \item faster pinv() \item faster inplace transpose \item faster handling of expressions with diagonal views \item fixes for handling expressions with aliasing and submatrices \item fixes for linking on Ubuntu and Debian systems \item fixes for inconsistencies in interactions between matrices and cubes \item refactored code to eliminate warnings when using the Clang C++ compiler \item .print_trans() and .raw_print_trans() are deprecated } } } \section{Changes in RcppArmadillo version 0.2.31 (2011-11-28)}{ \itemize{ \item Upgraded to Armadillo test release 2.3.92 "Loco Lounge Lizard (Beta 2)" \itemize{ \item fixes for linking on Ubuntu and Debian systems \item fixes for inconsistencies in interactions between matrices and cubes } } } \section{Changes in RcppArmadillo version 0.2.30 (2011-11-19)}{ \itemize{ \item Upgraded to Armadillo test release 2.3.91 "Loco Lounge Lizard (Beta 1)" \itemize{ \item added shorter forms of transposes: .t() and .st() \item added optional use of 64 bit indices, allowing matrices to have more than 4 billion elements \item added experimental support for C++11 initialiser lists \item faster pinv() \item faster inplace transpose \item bugfixes for handling expressions with aliasing and submatrices \item refactored code to eliminate warnings when using the Clang C++ compiler \item .print_trans() and .raw_print_trans() are deprecated } } } \section{Changes in RcppArmadillo version 0.2.29 (2011-09-01)}{ \itemize{ \item Upgraded to Armadillo release 2.2.3 \itemize{ \item Release fixes a speed issue in the as_scalar() function. } } } \section{Changes in RcppArmadillo version 0.2.28 (2011-08-02)}{ \itemize{ \item Upgraded to Armadillo release 2.2.1 "Blue Skies Debauchery" \itemize{ \item faster multiplication of small matrices \item faster trans() \item faster handling of submatrices by norm() \item added economical singular value decomposition: svd_thin() \item added circ_toeplitz() \item added .is_colvec() & .is_rowvec() \item fixes for handling of complex numbers by cov(), cor(), running_stat_vec } } } \section{Changes in RcppArmadillo version 0.2.27 (2011-07-22)}{ \itemize{ \item Upgraded to Armadillo release 2.1.91 "v2.2 beta 1" \itemize{ \item faster multiplication of small matrices \item faster trans() \item faster handling of submatrices by norm() \item added economical singular value decomposition: svd_thin() \item added circ_toeplitz() \item added .is_colvec() & .is_rowvec() } } } \section{Changes in RcppArmadillo version 0.2.26 (2011-07-17)}{ \itemize{ \item Upgraded to Armadillo release 2.0.2 \itemize{ \item fix for handling of conjugate transpose by as_scalar() \item fix for handling of aliasing by diagmat() \item fix for handling of empty matrices by symmatu()/symmatl() } } } \section{Changes in RcppArmadillo version 0.2.25 (2011-06-30)}{ \itemize{ \item Upgraded to Armadillo 2.0.1 which fixes two minor compilation issues } } \section{Changes in RcppArmadillo version 0.2.24 (2011-06-29)}{ \itemize{ \item Upgraded to Armadillo release 2.0.0 "Carnivorous Sugar Glider" \itemize{ \item faster multiplication of tiny matrices (≤ 4x4) \item faster compound expressions containing submatrices \item faster inverse of symmetric positive definite matrices \item faster element access for fixed size matrices \item added handling of arbitrarily sized empty matrices (eg. 5x0) \item added loading & saving of matrices as CSV text files \item added .count() member function to running_stat and running_stat_vec \item added syl(), strans(), symmatu()/symmatl() \item added submatrices of submatrices \item det(), inv() and solve() can be forced to use more precise \item algorithms for tiny matrices (≤ 4x4) \item htrans() has been deprecated; use trans() instead \item API change: trans() now takes the complex conjugate when transposing a complex matrix \item API change: .is_vec() now outputs true for empty vectors (eg. 0x1) \item API change: forms of chol(), eig_sym(), eig_gen(), inv(), lu(), pinv(), princomp(), qr(), solve(), svd(), syl() that do not return a bool indicating success now throw std::runtime_error exceptions when failures are detected \item API change: princomp_cov() has been removed; princomp() in conjunction with cov() can be used instead \item API change: set_log_stream() & get_log_stream() have been replaced by set_stream_err1() & get_stream_err1() } } } \section{Changes in RcppArmadillo version 0.2.23 (2011-06-23)}{ \itemize{ \item Upgraded to Armadillo release 1.99.5 "v2.0 beta 5" \itemize{ \item Forms of chol(), eig_sym(), eig_gen(), inv(), lu(), pinv(), princomp(), qr(), solve(), svd(), syl() that do not return a bool indicating success now throw std::runtime_error exceptions when failures are detected \item princomp_cov() has been removed; princomp() in conjunction with cov() can be used instead \item set_log_stream() & get_log_stream() have been replaced by set_stream_err1() & get_stream_err1() \item det(), inv() and solve() can be forced to use more precise algorithms for tiny matrices (≤ 4x4) \item Added loading & saving of matrices as CSV text files } \item fastLmPure() now uses same argument order as R's lm.fit() \item Export and document S3 methods in NAMESPACE and manual page as such } } \section{Changes in RcppArmadillo version 0.2.22 (2011-06-06)}{ \itemize{ \item Upgraded to Armadillo release 1.99.4 "v2.0 beta 4" \itemize{ \item fixes for handling of tiny matrices } } } \section{Changes in RcppArmadillo version 0.2.21 (2011-05-27)}{ \itemize{ \item Upgraded to Armadillo release 1.99.3 "v2.0 beta 3" \itemize{ \item stricter size checking for row and column vectors \item added .count() member function to running_stat and running_stat_vec } } } \section{Changes in RcppArmadillo version 0.2.20 (2011-05-25)}{ \itemize{ \item Upgraded to Armadillo release 1.99.2 "v2.0 beta 2" (and 1.99.1 before) \itemize{ \item faster inverse of symmetric matrices \item faster element access for fixed size matrices \item faster multiplication of tiny matrices (eg. 4x4) \item faster compund expressions containing submatrices \item added handling of arbitrarily sized empty matrices (eg. 5x0) \item added syl() \item added strans() \item added symmatu()/symmatl() \item added submatrices of submatrices \item htrans() has been deprecated; use trans() instead \item trans() now takes the complex conjugate when transposing a complex matrix \item .is_vec() now outputs true for empty matrices \item most functions with matrix inputs no longer throw exceptions when given empty matrices (eg. 5x0) } \item Added a new subdirectory examples/ seeded with a nice Vector Autoregression simulation simulation example by Lance Bachmeier \item Rewrote armadillo_version as to no longer require an instance of arma::arma_version, with tanks to Conrad for the suggestion } } \section{Changes in RcppArmadillo version 0.2.19 (2011-04-18)}{ \itemize{ \item Upgraded to Armadillo version 1.2.0 "Unscrupulous Carbon Emitter" \itemize{ \item Added ability to use Blas & Lapack libraries with capitalised function names \item Reduction of pedantic compiler warnings } } } \section{Changes in RcppArmadillo version 0.2.18 (2011-04-03)}{ \itemize{ \item Upgraded to Armadillo version 1.1.92 "Jurassic Barbecue" \itemize{ \item Bugfix in cor() \item Automatic installation now requires CMake >= 2.6 } } } \section{Changes in RcppArmadillo version 0.2.17 (2011-03-22)}{ \itemize{ \item Upgraded to Armadillo version 1.1.90 "Inside Job" \itemize{ \item Added .min() & .max(), which can provide the extremum's location \item More robust mean(), var(), stddev() } } } \section{Changes in RcppArmadillo version 0.2.16 (2011-03-10)}{ \itemize{ \item Upgraded to Armadillo version 1.1.8 "Kangaroo Steak" \itemize{ \item Added floor() and ceil() \item Added “not a numberâ€: math::nan() \item Added infinity: math::inf() \item Added standalone is_finite() \item Faster min(), max(), mean() \item Bugfix for a corner case with NaNs in min() and max() } } } \section{Changes in RcppArmadillo version 0.2.15 (2011-03-04)}{ \itemize{ \item Upgraded to Armadillo version 1.1.6 “Baby Carpet Shark†\itemize{ \item fixed size matrices and vectors can use auxiliary (external) memory \item .in_range() can use span() arguments \item subfields can use span() arguments } } } \section{Changes in RcppArmadillo version 0.2.14 (2011-03-02)}{ \itemize{ \item Support Run-Time Type Information (RTTI) on matrices by setting the state variable vec_state in Row and Col instantiation, with thanks to Conrad Sanderson for the hint \item fastLm code simplified further by instantiating the Armadillo matrix and vector directly from the SEXP coming from R \item inst/doc/Makefile now respects $R_HOME environment variable } } \section{Changes in RcppArmadillo version 0.2.13 (2011-02-18)}{ \itemize{ \item Upgraded to Armadillo version 1.1.4 “Manta Lodge†\itemize{ \item Faster sort() \item Updated installation to detect recent versions of Intel's MKL \item Added interpretation of arbitrary "flat" subcubes as matrices } } } \section{Changes in RcppArmadillo version 0.2.12 (2011-02-15)}{ \itemize{ \item Upgraded to Armadillo version 1.1.2 “Flood Kayak†\itemize{ \item Faster prod() \item Faster solve() for compound expressions \item Fix for compilation using GCC's C++0x mode \item Fix for matrix handling by subcubes } } } \section{Changes in RcppArmadillo version 0.2.11 (2011-01-06)}{ \itemize{ \item Upgraded to Armadillo version 1.1.0 “Climate Vandal†\itemize{ \item Extended submatrix views, including access to elements whose indices are specified in a separate vector \item Added handling of raw binary files by save/load functions \item Added cumsum() \item Added interpretation of matrices as triangular via trimatu()/trimatl() \item Faster solve(), inv() via explicit handling of triangular matrices \item The stream for logging of errors and warnings can now be changed } \item New unexported R function SHLIB, a small wrapper around R CMD SHLIB, which can be used as Rscript -e "RcppArmadillo:::SHLIB('foo.cpp')" } } \section{Changes in RcppArmadillo version 0.2.10 (2010-11-25)}{ \itemize{ \item Upgraded to Armadillo 1.0.0 "Antipodean Antileech" \itemize{ \item After 2 1/2 years of collaborative development, we are proud to release the 1.0 milestone version. \item Many thanks are extended to all contributors and bug reporters. } \item R/RcppArmadillo.package.skeleton.R: Updated to no longer rely on GNU make for builds of packages using RcppArmadillo \item summary() for fastLm() objects now returns r.squared and adj.r.squared } } \section{Changes in RcppArmadillo version 0.2.9 (2010-11-11)}{ \itemize{ \item Upgraded to Armadillo 0.9.92 "Wall Street Gangster": \itemize{ \item Fixes for compilation issues under the Intel C++ compiler \item Added matrix norms } } } \section{Changes in RcppArmadillo version 0.2.8 (2010-10-16)}{ \itemize{ \item Upgraded to Armadillo 0.9.90 "Water Dragon": \itemize{ \item Added unsafe_col() \item Speedups and bugfixes in lu() \item Minimisation of pedantic compiler warnings } \item Switched NEWS and ChangeLog between inst/ and the top-level directory so that NEWS (this file) gets installed with the package } } \section{Changes in RcppArmadillo version 0.2.7 (2010-09-25)}{ \itemize{ \item Upgraded to Armadillo 0.9.80 "Chihuahua Muncher": \itemize{ \item Added join_slices(), insert_slices(), shed_slices() \item Added in-place operations on diagonals \item Various speedups due to internal architecture improvements } } } \section{Changes in RcppArmadillo version 0.2.6 (2010-09-12)}{ \itemize{ \item Upgraded to Armadillo 0.9.70 "Subtropical Winter Safari" \item arma::Mat, arma::Row and arma::Col get constructor that take vector or matrix sugar expressions. See the unit test "test.armadillo.sugar.ctor" and "test.armadillo.sugar.matrix.ctor" for examples. } } \section{Changes in RcppArmadillo version 0.2.5 (2010-08-05)}{ \itemize{ \item Upgraded to Armadillo 0.9.60 "Killer Bush Turkey" } } \section{Changes in RcppArmadillo version 0.2.4 (2010-07-27)}{ \itemize{ \item Upgraded to Armadillo 0.9.52 'Monkey Wrench' \item src/fastLm.cpp: Switch from inv() to pinv() as inv() now tests for singular matrices and warns and returns an empty matrix which stops the example fastLm() implementation on the manual page -- and while this is generally reasonably it makes sense here to continue which the Moore-Penrose pseudo-inverse allows us to do this } } \section{Changes in RcppArmadillo version 0.2.3 (2010-06-14)}{ \itemize{ \item Better configuration to detect suncc (which does not have std::isfinite) } } \section{Changes in RcppArmadillo version 0.2.2 (2010-06-09)}{ \itemize{ \item Added RcppArmadillo:::CxxFlags for cases where RcppArmadillo is not used via a package \item Upgraded to Armadillo 0.9.10 'Chilli Espresso' \item Wrap support for mtOp, i.e. operations involving mixed types such as a complex and an arma::mat, which have been introduced in armadillo 0.9.10 \item Wrap support for mtGlue, i.e. operations involving matrices of mixed types such as an arma::mat and an arma::imat, which have been introduced in armadillo 0.9.10 \item Included an inline plugin to support the plugin system introduced in inline 0.3.5. The unit tests have moved from the src directory to the unit test directory (similar to Rcpp) using cxxfunction with the RcppArmadillo plugin. } } \section{Changes in RcppArmadillo version 0.2.1 (2010-05-19)}{ \itemize{ \item Bug-fix release permitting compilation on Windows } } \section{Changes in RcppArmadillo version 0.2.0 (2010-05-18)}{ \itemize{ \item fastLm() is now generic and has a formula interface as well as methods for print, summary, predict to behave like a standard model fitting function \item Armadillo sources (using release 0.9.8) are now included in the package using a standardized build suitable for our purposes (not assuming Boost or Atlas) -- see ?RcppArmadillo for details \item New R function RcppArmadillo.package.skeleton, similar to Rcpp::Rcpp.package.skeleton, but targetting use of RcppArmadillo } } \section{Changes in RcppArmadillo version 0.1.0 (2010-03-11)}{ \itemize{ \item the fastLm() implementation of a bare-bones lm() fit (using Armadillo's solve() function) provides an example of how efficient code can be written compactly using the combination of Rcpp, RcppAramadillo and Armadillo \item support for Rcpp implicit wrap of these types : Mat, Col, Row, Cube where T is one of : int, unsigned int, double, float \item support for Rcpp implicit as of these types : Mat, Col, Row where R is one of : int, unsigned int, double, float } } RcppArmadillo/inst/COPYRIGHTS0000644000176200001440000000114713122212566015401 0ustar liggesusers Overall license: ================ The (vast) majority of the files in this package are released under the Apache License, Version 2.0, January 2004 (http://www.apache.org/licenses/) The aggregation, integration and packaging work is released under the GNU GPL (>= 2). Details: ======== Files: * Copyright: 2010 - 2017 Dirk Eddelbuettel, Romain Francois and Doug Bates License: GPL (>= 2) Files: inst/include/armadillo: inst/include/armadillo_bits/*: Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) Copyright 2008-2016 National ICT Australia (NICTA) License: Apache-2.0 RcppArmadillo/README.md0000644000176200001440000001164314733633231014274 0ustar liggesusers ## RcppArmadillo: R and Armadillo via Rcpp [![CI](https://github.com/RcppCore/RcppArmadillo/workflows/ci/badge.svg)](https://github.com/RcppCore/RcppArmadillo/actions?query=workflow%3Aci) [![License](https://eddelbuettel.github.io/badges/GPL2+.svg)](https://www.gnu.org/licenses/gpl-2.0.html) [![CRAN](https://www.r-pkg.org/badges/version/RcppArmadillo)](https://cran.r-project.org/package=RcppArmadillo) [![Debian package](https://img.shields.io/debian/v/r-cran-rcpparmadillo/sid?color=brightgreen)](https://packages.debian.org/sid/r-cran-rcpparmadillo) [![r-universe](https://rcppcore.r-universe.dev/badges/RcppArmadillo)](https://rcppcore.r-universe.dev/RcppArmadillo) [![Dependencies](https://tinyverse.netlify.app/badge/RcppArmadillo)](https://cran.r-project.org/package=RcppArmadillo) [![Coverage Status](https://codecov.io/gh/RcppCore/RcppArmadillo/graph/badge.svg)](https://app.codecov.io/github/RcppCore/RcppArmadillo?branch=master) [![Last Commit](https://img.shields.io/github/last-commit/RcppCore/RcppArmadillo)](https://github.com/RcppCore/RcppArmadillo) [![Downloads (monthly)](https://cranlogs.r-pkg.org/badges/RcppArmadillo?color=brightgreen)](https://www.r-pkg.org/pkg/RcppArmadillo) [![Downloads (total)](https://cranlogs.r-pkg.org/badges/grand-total/RcppArmadillo?color=brightgreen)](https://www.r-pkg.org/pkg/RcppArmadillo) [![CRAN use](https://jangorecki.gitlab.io/rdeps/RcppArmadillo/CRAN_usage.svg?sanitize=true)](https://cran.r-project.org/package=RcppArmadillo) [![CRAN indirect](https://jangorecki.gitlab.io/rdeps/RcppArmadillo/indirect_usage.svg?sanitize=true)](https://cran.r-project.org/package=RcppArmadillo) [![BioConductor use](https://jangorecki.gitlab.io/rdeps/RcppArmadillo/BioC_usage.svg?sanitize=true)](https://cran.r-project.org/package=RcppArmadillo) [![CSDA](https://img.shields.io/badge/CSDA-10.1016%2Fj.csda.2013.02.005-brightgreen)](https://doi.org/10.1016/j.csda.2013.02.005) ### Synopsis RcppArmadillo provides an interface from R to and from [Armadillo][armadillo] by utilising the [Rcpp R/C++ interface library][rcpp]. ### What is Armadillo? [Armadillo][armadillo] is a high-quality linear algebra library for the C++ language, aiming towards a good balance between speed and ease of use. It provides high-level syntax and [functionality](https://arma.sourceforge.net/docs.html) deliberately similar to Matlab (TM). See [its website][armadillo] more information about Armadillo. ### So give me an example! Glad you asked. Here is a light-weight and fast implementation of linear regression: ```c++ #include // [[Rcpp::depends(RcppArmadillo)]] // [[Rcpp::export]] Rcpp::List fastLm(const arma::mat& X, const arma::colvec& y) { int n = X.n_rows, k = X.n_cols; arma::colvec coef = arma::solve(X, y); // fit model y ~ X arma::colvec res = y - X*coef; // residuals double s2 = arma::dot(res, res) / (n - k); // std.errors of coefficients arma::colvec std_err = arma::sqrt(s2 * arma::diagvec(arma::pinv(arma::trans(X)*X))); return Rcpp::List::create(Rcpp::Named("coefficients") = coef, Rcpp::Named("stderr") = std_err, Rcpp::Named("df.residual") = n - k); } ``` You can [`Rcpp::sourceCpp()`](https://cran.r-project.org/package=Rcpp/vignettes/Rcpp-attributes.pdf) the file above to compile the function. A version is also included in the package [as the `fastLm()`](https://github.com/RcppCore/RcppArmadillo/blob/master/R/fastLm.R) function. The `RcppArmadillo/Lighter` header includes [Rcpp][rcpp] via its `Rcpp/Lighter` header which precludes some more compile-time heavy features such as 'Rcpp Modules' which we may not need. See the [Rcpp][rcpp] docs more details about 'Light', 'Lighter' and 'Lightest'. In the example above, the switch saves about 15% of total compilation time. ### Status The package is mature yet under active development with releases to [CRAN][cran] about once every other month, and widely-used by other CRAN packages as can be seen from the [CRAN package page][cran pkg]. As of April 2024, there are 1135 CRAN packages using RcppArmadillo. ### Documentation The package contains a pdf vignette which is a pre-print of the [paper by Eddelbuettel and Sanderson](http://dx.doi.org/10.1016/j.csda.2013.02.005) in CSDA (2014), as well as an introductory vignette for the sparse matrix conversions. ### Installation RcppArmadillo is a [CRAN package][cran pkg], and lives otherwise in its own habitat on [GitHub](https://github.com/RcppCore/RcppArmadillo) within the [RcppCore](https://github.com/RcppCore) GitHub organization. Run ```r install.packages("RcppArmadillo") ``` to install from your nearest CRAN mirror. ### Authors Dirk Eddelbuettel, Romain Francois, Doug Bates, Binxiang Ni, and Conrad Sanderson ### License GPL (>= 2) [armadillo]: https://arma.sourceforge.net [rcpp]: https://www.rcpp.org [cran]: https://cran.r-project.org [cran pkg]: https://cran.r-project.org/package=RcppArmadillo RcppArmadillo/build/0000755000176200001440000000000015031230427014077 5ustar liggesusersRcppArmadillo/build/vignette.rds0000644000176200001440000000042715031230427016441 0ustar liggesusers‹­P=OÃ0uš¤%•Š: u@Ù+òU„„"Ö#v…c[¶Q`ã—78Í%Jª|ïžß=ûmI™‘(È,ôe¸öaîÏM‡“ÄçÛ¼ÐúÁT@¹êžKgT–ËÇwÓ±Õ`,{gø÷‘5Ûœ£_…ãJžgŒõ.1¦iy±–5#C&d}Ä»9å1#?ȱ·[,“a+ׂK&ñÁÞ ºúQLK.3ÿ¨Û=5­ðÓ¢Ös€ÃXBÅ,.›#í¹`=á•»¡ _vûSC‹ÓLR‹íÕû©•ñýtQbTõËVíÏýúÐ4ÍáÔQ!ÀöŽzpIÁAVßw‡?G`€Í©RcppArmadillo/build/partial.rdb0000644000176200001440000000007515031230414016222 0ustar liggesusers‹‹àb```b`aed`b1…À€… H02°0piÖ¼ÄÜÔb C"Éð ´¤7RcppArmadillo/configure0000755000176200001440000040725515031230430014716 0ustar liggesusers#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.72 for RcppArmadillo 14.6.0-1. # # Report bugs to . # # # Copyright (C) 1992-1996, 1998-2017, 2020-2023 Free Software Foundation, # Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case e in #( e) case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac ;; esac fi # Reset variables that may have inherited troublesome values from # the environment. # IFS needs to be set, to space, tab, and newline, in precisely that order. # (If _AS_PATH_WALK were called with IFS unset, it would have the # side effect of setting IFS to empty, thus disabling word splitting.) # Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl IFS=" "" $as_nl" PS1='$ ' PS2='> ' PS4='+ ' # Ensure predictable behavior from utilities with locale-dependent output. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # We cannot yet rely on "unset" to work, but we need these variables # to be unset--not just set to an empty or harmless value--now, to # avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct # also avoids known problems related to "unset" and subshell syntax # in other old shells (e.g. bash 2.01 and pdksh 5.2.14). for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH do eval test \${$as_var+y} \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done # Ensure that fds 0, 1, and 2 are open. if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. if ${PATH_SEPARATOR+false} :; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as 'sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed 'exec'. printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test \${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case e in #( e) case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ) then : else case e in #( e) exitcode=1; echo positional parameters were not saved. ;; esac fi test x\$exitcode = x0 || exit 1 blah=\$(echo \$(echo blah)) test x\"\$blah\" = xblah || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1" if (eval "$as_required") 2>/dev/null then : as_have_required=yes else case e in #( e) as_have_required=no ;; esac fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null then : else case e in #( e) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && as_run=a "$as_shell" -c "$as_bourne_compatible""$as_required" 2>/dev/null then : CONFIG_SHELL=$as_shell as_have_required=yes if as_run=a "$as_shell" -c "$as_bourne_compatible""$as_suggested" 2>/dev/null then : break 2 fi fi done;; esac as_found=false done IFS=$as_save_IFS if $as_found then : else case e in #( e) if { test -f "$SHELL" || test -f "$SHELL.exe"; } && as_run=a "$SHELL" -c "$as_bourne_compatible""$as_required" 2>/dev/null then : CONFIG_SHELL=$SHELL as_have_required=yes fi ;; esac fi if test "x$CONFIG_SHELL" != x then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed 'exec'. printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno then : printf "%s\n" "$0: This script requires a shell more modern than all" printf "%s\n" "$0: the shells that I found on your system." if test ${ZSH_VERSION+y} ; then printf "%s\n" "$0: In particular, zsh $ZSH_VERSION has bugs and should" printf "%s\n" "$0: be upgraded to zsh 4.3.4 or later." else printf "%s\n" "$0: Please tell bug-autoconf@gnu.org and edd@debian.org $0: about your system, including any error possibly output $0: before this message. Then install a modern shell, or $0: manually run the script under such a shell if you do $0: have one." fi exit 1 fi ;; esac fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null then : eval 'as_fn_append () { eval $1+=\$2 }' else case e in #( e) as_fn_append () { eval $1=\$$1\$2 } ;; esac fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null then : eval 'as_fn_arith () { as_val=$(( $* )) }' else case e in #( e) as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } ;; esac fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi printf "%s\n" "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' t clear :clear s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { printf "%s\n" "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } # Determine whether it's possible to make 'echo' print without a newline. # These variables are no longer used directly by Autoconf, but are AC_SUBSTed # for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac # For backward compatibility with old third-party macros, we provide # the shell variables $as_echo and $as_echo_n. New code should use # AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. as_echo='printf %s\n' as_echo_n='printf %s' rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both 'ln -s file dir' and 'ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; 'ln -s' creates a wrapper executable. # In both cases, we have to default to 'cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_sed_cpp="y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" as_tr_cpp="eval sed '$as_sed_cpp'" # deprecated # Sed expression to map a string onto a valid variable name. as_sed_sh="y%*+%pp%;s%[^_$as_cr_alnum]%_%g" as_tr_sh="eval sed '$as_sed_sh'" # deprecated test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='RcppArmadillo' PACKAGE_TARNAME='rcpparmadillo' PACKAGE_VERSION='14.6.0-1' PACKAGE_STRING='RcppArmadillo 14.6.0-1' PACKAGE_BUGREPORT='edd@debian.org' PACKAGE_URL='' ac_subst_vars='LTLIBOBJS LIBOBJS OPENMP_FLAG ARMA_HAVE_OPENMP ARMA_LAPACK CXXCPP OBJEXT EXEEXT ac_ct_CXX CPPFLAGS LDFLAGS CXXFLAGS CXX target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir runstatedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking ' ac_precious_vars='build_alias host_alias target_alias CXX CXXFLAGS LDFLAGS LIBS CPPFLAGS CCC CXXCPP' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: '$ac_useropt'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: '$ac_useropt'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -runstatedir | --runstatedir | --runstatedi | --runstated \ | --runstate | --runstat | --runsta | --runst | --runs \ | --run | --ru | --r) ac_prev=runstatedir ;; -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ | --run=* | --ru=* | --r=*) runstatedir=$ac_optarg ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: '$ac_useropt'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: '$ac_useropt'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: '$ac_option' Try '$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: '$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. printf "%s\n" "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && printf "%s\n" "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: '$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but 'cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF 'configure' configures RcppArmadillo 14.6.0-1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print 'checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for '--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or '..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, 'make install' will install all the files in '$ac_default_prefix/bin', '$ac_default_prefix/lib' etc. You can specify an installation prefix other than '$ac_default_prefix' using '--prefix', for instance '--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/rcpparmadillo] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of RcppArmadillo 14.6.0-1:";; esac cat <<\_ACEOF Some influential environment variables: CXX C++ compiler command CXXFLAGS C++ compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CXXCPP C++ preprocessor Use these variables to override the choices made by 'configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for configure.gnu first; this name is used for a wrapper for # Metaconfig's "Configure" on case-insensitive file systems. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF RcppArmadillo configure 14.6.0-1 generated by GNU Autoconf 2.72 Copyright (C) 2023 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_cxx_try_compile LINENO # ---------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest.beam if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext then : ac_retval=0 else case e in #( e) printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 ;; esac fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_compile # ac_fn_cxx_try_cpp LINENO # ------------------------ # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || test ! -s conftest.err } then : ac_retval=0 else case e in #( e) printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 ;; esac fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_cpp ac_configure_args_raw= for ac_arg do case $ac_arg in *\'*) ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append ac_configure_args_raw " '$ac_arg'" done case $ac_configure_args_raw in *$as_nl*) ac_safe_unquote= ;; *) ac_unsafe_z='|&;<>()$`\\"*?[ '' ' # This string ends in space, tab. ac_unsafe_a="$ac_unsafe_z#~" ac_safe_unquote="s/ '\\([^$ac_unsafe_a][^$ac_unsafe_z]*\\)'/ \\1/g" ac_configure_args_raw=` printf "%s\n" "$ac_configure_args_raw" | sed "$ac_safe_unquote"`;; esac cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by RcppArmadillo $as_me 14.6.0-1, which was generated by GNU Autoconf 2.72. Invocation command line was $ $0$ac_configure_args_raw _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac printf "%s\n" "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Sanitize IFS. IFS=" "" $as_nl" # Save into config.log some information that might help in debugging. { echo printf "%s\n" "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo printf "%s\n" "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac printf "%s\n" "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then printf "%s\n" "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac printf "%s\n" "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then printf "%s\n" "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && printf "%s\n" "$as_me: caught signal $ac_signal" printf "%s\n" "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h printf "%s\n" "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. printf "%s\n" "#define PACKAGE_NAME \"$PACKAGE_NAME\"" >>confdefs.h printf "%s\n" "#define PACKAGE_TARNAME \"$PACKAGE_TARNAME\"" >>confdefs.h printf "%s\n" "#define PACKAGE_VERSION \"$PACKAGE_VERSION\"" >>confdefs.h printf "%s\n" "#define PACKAGE_STRING \"$PACKAGE_STRING\"" >>confdefs.h printf "%s\n" "#define PACKAGE_BUGREPORT \"$PACKAGE_BUGREPORT\"" >>confdefs.h printf "%s\n" "#define PACKAGE_URL \"$PACKAGE_URL\"" >>confdefs.h # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. if test -n "$CONFIG_SITE"; then ac_site_files="$CONFIG_SITE" elif test "x$prefix" != xNONE; then ac_site_files="$prefix/share/config.site $prefix/etc/config.site" else ac_site_files="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi for ac_site_file in $ac_site_files do case $ac_site_file in #( */*) : ;; #( *) : ac_site_file=./$ac_site_file ;; esac if test -f "$ac_site_file" && test -r "$ac_site_file"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 printf "%s\n" "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See 'config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 printf "%s\n" "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 printf "%s\n" "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Test code for whether the C++ compiler supports C++98 (global declarations) ac_cxx_conftest_cxx98_globals=' // Does the compiler advertise C++98 conformance? #if !defined __cplusplus || __cplusplus < 199711L # error "Compiler does not advertise C++98 conformance" #endif // These inclusions are to reject old compilers that // lack the unsuffixed header files. #include #include // and are *not* freestanding headers in C++98. extern void assert (int); namespace std { extern int strcmp (const char *, const char *); } // Namespaces, exceptions, and templates were all added after "C++ 2.0". using std::exception; using std::strcmp; namespace { void test_exception_syntax() { try { throw "test"; } catch (const char *s) { // Extra parentheses suppress a warning when building autoconf itself, // due to lint rules shared with more typical C programs. assert (!(strcmp) (s, "test")); } } template struct test_template { T const val; explicit test_template(T t) : val(t) {} template T add(U u) { return static_cast(u) + val; } }; } // anonymous namespace ' # Test code for whether the C++ compiler supports C++98 (body of main) ac_cxx_conftest_cxx98_main=' assert (argc); assert (! argv[0]); { test_exception_syntax (); test_template tt (2.0); assert (tt.add (4) == 6.0); assert (true && !false); } ' # Test code for whether the C++ compiler supports C++11 (global declarations) ac_cxx_conftest_cxx11_globals=' // Does the compiler advertise C++ 2011 conformance? #if !defined __cplusplus || __cplusplus < 201103L # error "Compiler does not advertise C++11 conformance" #endif namespace cxx11test { constexpr int get_val() { return 20; } struct testinit { int i; double d; }; class delegate { public: delegate(int n) : n(n) {} delegate(): delegate(2354) {} virtual int getval() { return this->n; }; protected: int n; }; class overridden : public delegate { public: overridden(int n): delegate(n) {} virtual int getval() override final { return this->n * 2; } }; class nocopy { public: nocopy(int i): i(i) {} nocopy() = default; nocopy(const nocopy&) = delete; nocopy & operator=(const nocopy&) = delete; private: int i; }; // for testing lambda expressions template Ret eval(Fn f, Ret v) { return f(v); } // for testing variadic templates and trailing return types template auto sum(V first) -> V { return first; } template auto sum(V first, Args... rest) -> V { return first + sum(rest...); } } ' # Test code for whether the C++ compiler supports C++11 (body of main) ac_cxx_conftest_cxx11_main=' { // Test auto and decltype auto a1 = 6538; auto a2 = 48573953.4; auto a3 = "String literal"; int total = 0; for (auto i = a3; *i; ++i) { total += *i; } decltype(a2) a4 = 34895.034; } { // Test constexpr short sa[cxx11test::get_val()] = { 0 }; } { // Test initializer lists cxx11test::testinit il = { 4323, 435234.23544 }; } { // Test range-based for int array[] = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, 14, 19, 17, 8, 6, 20, 16, 2, 11, 1}; for (auto &x : array) { x += 23; } } { // Test lambda expressions using cxx11test::eval; assert (eval ([](int x) { return x*2; }, 21) == 42); double d = 2.0; assert (eval ([&](double x) { return d += x; }, 3.0) == 5.0); assert (d == 5.0); assert (eval ([=](double x) mutable { return d += x; }, 4.0) == 9.0); assert (d == 5.0); } { // Test use of variadic templates using cxx11test::sum; auto a = sum(1); auto b = sum(1, 2); auto c = sum(1.0, 2.0, 3.0); } { // Test constructor delegation cxx11test::delegate d1; cxx11test::delegate d2(); cxx11test::delegate d3(45); } { // Test override and final cxx11test::overridden o1(55464); } { // Test nullptr char *c = nullptr; } { // Test template brackets test_template<::test_template> v(test_template(12)); } { // Unicode literals char const *utf8 = u8"UTF-8 string \u2500"; char16_t const *utf16 = u"UTF-8 string \u2500"; char32_t const *utf32 = U"UTF-32 string \u2500"; } ' # Test code for whether the C compiler supports C++11 (complete). ac_cxx_conftest_cxx11_program="${ac_cxx_conftest_cxx98_globals} ${ac_cxx_conftest_cxx11_globals} int main (int argc, char **argv) { int ok = 0; ${ac_cxx_conftest_cxx98_main} ${ac_cxx_conftest_cxx11_main} return ok; } " # Test code for whether the C compiler supports C++98 (complete). ac_cxx_conftest_cxx98_program="${ac_cxx_conftest_cxx98_globals} int main (int argc, char **argv) { int ok = 0; ${ac_cxx_conftest_cxx98_main} return ok; } " # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: '$ac_var' was set to '$ac_old_val' in the previous run" >&5 printf "%s\n" "$as_me: error: '$ac_var' was set to '$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: '$ac_var' was not set in the previous run" >&5 printf "%s\n" "$as_me: error: '$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: '$ac_var' has changed since the previous run:" >&5 printf "%s\n" "$as_me: error: '$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in '$ac_var' since the previous run:" >&5 printf "%s\n" "$as_me: warning: ignoring whitespace changes in '$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: former value: '$ac_old_val'" >&5 printf "%s\n" "$as_me: former value: '$ac_old_val'" >&2;} { printf "%s\n" "$as_me:${as_lineno-$LINENO}: current value: '$ac_new_val'" >&5 printf "%s\n" "$as_me: current value: '$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`printf "%s\n" "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 printf "%s\n" "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run '${MAKE-make} distclean' and/or 'rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ## Set R_HOME, respecting an environment variable if one is set : ${R_HOME=$(R RHOME)} if test -z "${R_HOME}"; then as_fn_error $? "Could not determine R_HOME." "$LINENO" 5 fi ## Use R to set CXX and CXXFLAGS CXX=$(${R_HOME}/bin/R CMD config CXX) CXXFLAGS=$("${R_HOME}/bin/R" CMD config CXXFLAGS) ## We are using C++ ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -z "$CXX"; then if test -n "$CCC"; then CXX=$CCC else if test -n "$ac_tool_prefix"; then for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++ do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CXX+y} then : printf %s "(cached) " >&6 else case e in #( e) if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi ;; esac fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 printf "%s\n" "$CXX" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$CXX" && break done fi if test -z "$CXX"; then ac_ct_CXX=$CXX for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CXX+y} then : printf %s "(cached) " >&6 else case e in #( e) if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CXX="$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi ;; esac fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 printf "%s\n" "$ac_ct_CXX" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$ac_ct_CXX" && break done if test "x$ac_ct_CXX" = x; then CXX="g++" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CXX=$ac_ct_CXX fi fi fi fi # Provide some information about the compiler. printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C++ compiler works" >&5 printf %s "checking whether the C++ compiler works... " >&6; } ac_link_default=`printf "%s\n" "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then : # Autoconf-2.13 could set the ac_cv_exeext variable to 'no'. # So ignore a value of 'no', otherwise this would lead to 'EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test ${ac_cv_exeext+y} && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an '-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else case e in #( e) ac_file='' ;; esac fi if test -z "$ac_file" then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} as_fn_error 77 "C++ compiler cannot create executables See 'config.log' for more details" "$LINENO" 5; } else case e in #( e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C++ compiler default output file name" >&5 printf %s "checking for C++ compiler default output file name... " >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 printf "%s\n" "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 printf %s "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then : # If both 'conftest.exe' and 'conftest' are 'present' (well, observable) # catch 'conftest.exe'. For instance with Cygwin, 'ls conftest' will # work properly (i.e., refer to 'conftest.exe'), while it won't with # 'rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else case e in #( e) { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See 'config.log' for more details" "$LINENO" 5; } ;; esac fi rm -f conftest conftest$ac_cv_exeext { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 printf "%s\n" "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main (void) { FILE *f = fopen ("conftest.out", "w"); if (!f) return 1; return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 printf %s "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} as_fn_error 77 "cannot run C++ compiled programs. If you meant to cross compile, use '--host'. See 'config.log' for more details" "$LINENO" 5; } fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 printf "%s\n" "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext \ conftest.o conftest.obj conftest.out ac_clean_files=$ac_clean_files_save { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 printf %s "checking for suffix of object files... " >&6; } if test ${ac_cv_objext+y} then : printf %s "(cached) " >&6 else case e in #( e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else case e in #( e) printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See 'config.log' for more details" "$LINENO" 5; } ;; esac fi rm -f conftest.$ac_cv_objext conftest.$ac_ext ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 printf "%s\n" "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C++" >&5 printf %s "checking whether the compiler supports GNU C++... " >&6; } if test ${ac_cv_cxx_compiler_gnu+y} then : printf %s "(cached) " >&6 else case e in #( e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : ac_compiler_gnu=yes else case e in #( e) ac_compiler_gnu=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 printf "%s\n" "$ac_cv_cxx_compiler_gnu" >&6; } ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test $ac_compiler_gnu = yes; then GXX=yes else GXX= fi ac_test_CXXFLAGS=${CXXFLAGS+y} ac_save_CXXFLAGS=$CXXFLAGS { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 printf %s "checking whether $CXX accepts -g... " >&6; } if test ${ac_cv_prog_cxx_g+y} then : printf %s "(cached) " >&6 else case e in #( e) ac_save_cxx_werror_flag=$ac_cxx_werror_flag ac_cxx_werror_flag=yes ac_cv_prog_cxx_g=no CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : ac_cv_prog_cxx_g=yes else case e in #( e) CXXFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : else case e in #( e) ac_cxx_werror_flag=$ac_save_cxx_werror_flag CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : ac_cv_prog_cxx_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cxx_werror_flag=$ac_save_cxx_werror_flag ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 printf "%s\n" "$ac_cv_prog_cxx_g" >&6; } if test $ac_test_CXXFLAGS; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then CXXFLAGS="-g -O2" else CXXFLAGS="-g" fi else if test "$GXX" = yes; then CXXFLAGS="-O2" else CXXFLAGS= fi fi ac_prog_cxx_stdcxx=no if test x$ac_prog_cxx_stdcxx = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++11 features" >&5 printf %s "checking for $CXX option to enable C++11 features... " >&6; } if test ${ac_cv_prog_cxx_cxx11+y} then : printf %s "(cached) " >&6 else case e in #( e) ac_cv_prog_cxx_cxx11=no ac_save_CXX=$CXX cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_cxx_conftest_cxx11_program _ACEOF for ac_arg in '' -std=gnu++11 -std=gnu++0x -std=c++11 -std=c++0x -qlanglvl=extended0x -AA do CXX="$ac_save_CXX $ac_arg" if ac_fn_cxx_try_compile "$LINENO" then : ac_cv_prog_cxx_cxx11=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cxx_cxx11" != "xno" && break done rm -f conftest.$ac_ext CXX=$ac_save_CXX ;; esac fi if test "x$ac_cv_prog_cxx_cxx11" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else case e in #( e) if test "x$ac_cv_prog_cxx_cxx11" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else case e in #( e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx11" >&5 printf "%s\n" "$ac_cv_prog_cxx_cxx11" >&6; } CXX="$CXX $ac_cv_prog_cxx_cxx11" ;; esac fi ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx11 ac_prog_cxx_stdcxx=cxx11 ;; esac fi fi if test x$ac_prog_cxx_stdcxx = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++98 features" >&5 printf %s "checking for $CXX option to enable C++98 features... " >&6; } if test ${ac_cv_prog_cxx_cxx98+y} then : printf %s "(cached) " >&6 else case e in #( e) ac_cv_prog_cxx_cxx98=no ac_save_CXX=$CXX cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_cxx_conftest_cxx98_program _ACEOF for ac_arg in '' -std=gnu++98 -std=c++98 -qlanglvl=extended -AA do CXX="$ac_save_CXX $ac_arg" if ac_fn_cxx_try_compile "$LINENO" then : ac_cv_prog_cxx_cxx98=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cxx_cxx98" != "xno" && break done rm -f conftest.$ac_ext CXX=$ac_save_CXX ;; esac fi if test "x$ac_cv_prog_cxx_cxx98" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else case e in #( e) if test "x$ac_cv_prog_cxx_cxx98" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else case e in #( e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx98" >&5 printf "%s\n" "$ac_cv_prog_cxx_cxx98" >&6; } CXX="$CXX $ac_cv_prog_cxx_cxx98" ;; esac fi ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx98 ac_prog_cxx_stdcxx=cxx98 ;; esac fi fi ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5 printf %s "checking how to run the C++ preprocessor... " >&6; } if test -z "$CXXCPP"; then if test ${ac_cv_prog_CXXCPP+y} then : printf %s "(cached) " >&6 else case e in #( e) # Double quotes because $CXX needs to be expanded for CXXCPP in "$CXX -E" cpp /lib/cpp do ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include Syntax error _ACEOF if ac_fn_cxx_try_cpp "$LINENO" then : else case e in #( e) # Broken: fails on valid input. continue ;; esac fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_cxx_try_cpp "$LINENO" then : # Broken: success on invalid input. continue else case e in #( e) # Passes both tests. ac_preproc_ok=: break ;; esac fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of 'break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok then : break fi done ac_cv_prog_CXXCPP=$CXXCPP ;; esac fi CXXCPP=$ac_cv_prog_CXXCPP else ac_cv_prog_CXXCPP=$CXXCPP fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5 printf "%s\n" "$CXXCPP" >&6; } ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include Syntax error _ACEOF if ac_fn_cxx_try_cpp "$LINENO" then : else case e in #( e) # Broken: fails on valid input. continue ;; esac fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_cxx_try_cpp "$LINENO" then : # Broken: success on invalid input. continue else case e in #( e) # Passes both tests. ac_preproc_ok=: break ;; esac fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of 'break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok then : else case e in #( e) { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check See 'config.log' for more details" "$LINENO" 5; } ;; esac fi ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -z "$CXX"; then if test -n "$CCC"; then CXX=$CCC else if test -n "$ac_tool_prefix"; then for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++ do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CXX+y} then : printf %s "(cached) " >&6 else case e in #( e) if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi ;; esac fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 printf "%s\n" "$CXX" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$CXX" && break done fi if test -z "$CXX"; then ac_ct_CXX=$CXX for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CXX+y} then : printf %s "(cached) " >&6 else case e in #( e) if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CXX="$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi ;; esac fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 printf "%s\n" "$ac_ct_CXX" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$ac_ct_CXX" && break done if test "x$ac_ct_CXX" = x; then CXX="g++" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CXX=$ac_ct_CXX fi fi fi fi # Provide some information about the compiler. printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C++" >&5 printf %s "checking whether the compiler supports GNU C++... " >&6; } if test ${ac_cv_cxx_compiler_gnu+y} then : printf %s "(cached) " >&6 else case e in #( e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : ac_compiler_gnu=yes else case e in #( e) ac_compiler_gnu=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 printf "%s\n" "$ac_cv_cxx_compiler_gnu" >&6; } ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test $ac_compiler_gnu = yes; then GXX=yes else GXX= fi ac_test_CXXFLAGS=${CXXFLAGS+y} ac_save_CXXFLAGS=$CXXFLAGS { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 printf %s "checking whether $CXX accepts -g... " >&6; } if test ${ac_cv_prog_cxx_g+y} then : printf %s "(cached) " >&6 else case e in #( e) ac_save_cxx_werror_flag=$ac_cxx_werror_flag ac_cxx_werror_flag=yes ac_cv_prog_cxx_g=no CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : ac_cv_prog_cxx_g=yes else case e in #( e) CXXFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : else case e in #( e) ac_cxx_werror_flag=$ac_save_cxx_werror_flag CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : ac_cv_prog_cxx_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cxx_werror_flag=$ac_save_cxx_werror_flag ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 printf "%s\n" "$ac_cv_prog_cxx_g" >&6; } if test $ac_test_CXXFLAGS; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then CXXFLAGS="-g -O2" else CXXFLAGS="-g" fi else if test "$GXX" = yes; then CXXFLAGS="-O2" else CXXFLAGS= fi fi ac_prog_cxx_stdcxx=no if test x$ac_prog_cxx_stdcxx = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++11 features" >&5 printf %s "checking for $CXX option to enable C++11 features... " >&6; } if test ${ac_cv_prog_cxx_cxx11+y} then : printf %s "(cached) " >&6 else case e in #( e) ac_cv_prog_cxx_cxx11=no ac_save_CXX=$CXX cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_cxx_conftest_cxx11_program _ACEOF for ac_arg in '' -std=gnu++11 -std=gnu++0x -std=c++11 -std=c++0x -qlanglvl=extended0x -AA do CXX="$ac_save_CXX $ac_arg" if ac_fn_cxx_try_compile "$LINENO" then : ac_cv_prog_cxx_cxx11=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cxx_cxx11" != "xno" && break done rm -f conftest.$ac_ext CXX=$ac_save_CXX ;; esac fi if test "x$ac_cv_prog_cxx_cxx11" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else case e in #( e) if test "x$ac_cv_prog_cxx_cxx11" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else case e in #( e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx11" >&5 printf "%s\n" "$ac_cv_prog_cxx_cxx11" >&6; } CXX="$CXX $ac_cv_prog_cxx_cxx11" ;; esac fi ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx11 ac_prog_cxx_stdcxx=cxx11 ;; esac fi fi if test x$ac_prog_cxx_stdcxx = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++98 features" >&5 printf %s "checking for $CXX option to enable C++98 features... " >&6; } if test ${ac_cv_prog_cxx_cxx98+y} then : printf %s "(cached) " >&6 else case e in #( e) ac_cv_prog_cxx_cxx98=no ac_save_CXX=$CXX cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_cxx_conftest_cxx98_program _ACEOF for ac_arg in '' -std=gnu++98 -std=c++98 -qlanglvl=extended -AA do CXX="$ac_save_CXX $ac_arg" if ac_fn_cxx_try_compile "$LINENO" then : ac_cv_prog_cxx_cxx98=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cxx_cxx98" != "xno" && break done rm -f conftest.$ac_ext CXX=$ac_save_CXX ;; esac fi if test "x$ac_cv_prog_cxx_cxx98" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else case e in #( e) if test "x$ac_cv_prog_cxx_cxx98" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else case e in #( e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx98" >&5 printf "%s\n" "$ac_cv_prog_cxx_cxx98" >&6; } CXX="$CXX $ac_cv_prog_cxx_cxx98" ;; esac fi ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx98 ac_prog_cxx_stdcxx=cxx98 ;; esac fi fi ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu ## Is R already configured to compile things using OpenMP without ## any extra hand-holding? openmp_already_works="no" ## default to not even thinking about OpenMP as Armadillo wants a pragma ## variant available if and only if C++11 is used with g++ 5.4 or newer can_use_openmp="no" ## Ensure TMPDIR is set. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we have a suitable tempdir" >&5 printf %s "checking whether we have a suitable tempdir... " >&6; } TMPDIR=$("${R_HOME}/bin/R" --vanilla --slave -e "cat(dirname(tempdir()))") { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ${TMPDIR}" >&5 printf "%s\n" "${TMPDIR}" >&6; } ## Check if R is configured to compile programs using OpenMP out-of-the-box. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether R CMD SHLIB can already compile programs using OpenMP" >&5 printf %s "checking whether R CMD SHLIB can already compile programs using OpenMP... " >&6; } ## Create private directory in TMPDIR. BUILDDIR="${TMPDIR}/rcpparmadillo-$$-$RANDOM" mkdir -p "${BUILDDIR}" owd=$(pwd) cd "${BUILDDIR}" cat < test-omp.cpp #include int main() { return omp_get_num_threads(); } EOF ## Execute R CMD SHLIB. "${R_HOME}/bin/R" CMD SHLIB test-omp.cpp >/dev/null 2>&1 if test x"$?" = x"0"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } openmp_already_works="yes" else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi ## Go back home. cd "${owd}" rm -rf "${BUILDDIR}" ## If the above checks failed, then perform other heuristics ## based on the compiler version, etc. if test x"${openmp_already_works}" = x"no"; then ## Check the C++ compiler using the CXX value set ## If it is g++, we have GXX set so let's examine it if test "${GXX}" = yes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether g++ version is sufficient" >&5 printf %s "checking whether g++ version is sufficient... " >&6; } gxx_version=$(${CXX} -v 2>&1 | awk '/^.*g.. version/ {print $3}') case ${gxx_version} in 1.*|2.*|3.*|4.0.*|4.1.*|4.2.*|4.3.*|4.4.*|4.5.*|4.6.*|4.7.0|4.7.1) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Only g++ version 4.7.2 or greater can be used with RcppArmadillo." >&5 printf "%s\n" "$as_me: WARNING: Only g++ version 4.7.2 or greater can be used with RcppArmadillo." >&2;} as_fn_error $? "Please use a different compiler." "$LINENO" 5 ;; 4.7.*|4.8.*|4.9.*|5.0*|5.1*|5.2*|5.3*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes, but without OpenMP as version ${gxx_version} (Armadillo constraint)" >&5 printf "%s\n" "yes, but without OpenMP as version ${gxx_version} (Armadillo constraint)" >&6; } ## we know this one is bad can_use_openmp="no" ;; 5.4*|5.5*|5.6*|5.7*|5.8*|5.9*|6.*|7.*|8.*|9.*|10.*|11.*|12.*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes, with OpenMP as version ${gxx_version}" >&5 printf "%s\n" "yes, with OpenMP as version ${gxx_version}" >&6; } ## we know this one is good, yay can_use_openmp="yes" ;; *) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: almost" >&5 printf "%s\n" "almost" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Compiler self-identifies as being compliant with GNUC extensions but is not g++." >&5 printf "%s\n" "$as_me: WARNING: Compiler self-identifies as being compliant with GNUC extensions but is not g++." >&2;} ## we know nothing, so no can_use_openmp="no" ;; esac fi ## Check for Apple LLVM { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for macOS" >&5 printf %s "checking for macOS... " >&6; } RSysinfoName=$("${R_HOME}/bin/Rscript" --vanilla -e 'cat(Sys.info()["sysname"])') if test x"${RSysinfoName}" = x"Darwin"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: found" >&5 printf "%s\n" "found" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for macOS Apple compiler" >&5 printf %s "checking for macOS Apple compiler... " >&6; } apple_compiler=$($CXX --version 2>&1 | grep -i -c -e 'apple llvm') if test x"${apple_compiler}" = x"1"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: found" >&5 printf "%s\n" "found" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: OpenMP unavailable and turned off." >&5 printf "%s\n" "$as_me: WARNING: OpenMP unavailable and turned off." >&2;} can_use_openmp="no" else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5 printf "%s\n" "not found" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for clang compiler" >&5 printf %s "checking for clang compiler... " >&6; } clang_compiler=$($CXX --version 2>&1 | grep -i -c -e 'clang ') if test x"${clang_compiler}" = x"1"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: found" >&5 printf "%s\n" "found" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for OpenMP compatible version of clang" >&5 printf %s "checking for OpenMP compatible version of clang... " >&6; } clang_version=$(${CXX} -v 2>&1 | awk '/^.*clang version/ {print $3}') case ${clang_version} in 4.*|5.*|6.*|7.*|8.*|9.*|10.*|11.*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: found and suitable" >&5 printf "%s\n" "found and suitable" >&6; } can_use_openmp="yes" ;; *) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5 printf "%s\n" "not found" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: OpenMP unavailable and turned off." >&5 printf "%s\n" "$as_me: WARNING: OpenMP unavailable and turned off." >&2;} can_use_openmp="no" ;; esac else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5 printf "%s\n" "not found" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unsupported macOS build detected; if anything breaks, you keep the pieces." >&5 printf "%s\n" "$as_me: WARNING: unsupported macOS build detected; if anything breaks, you keep the pieces." >&2;} fi fi else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi # if test x"${openmp_already_works}" = x"no" ## Check for suitable LAPACK_LIBS { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking LAPACK_LIBS" >&5 printf %s "checking LAPACK_LIBS... " >&6; } ## external LAPACK has the required function lapack=$(${R_HOME}/bin/R CMD config LAPACK_LIBS) hasRlapack=$(echo ${lapack} | grep lRlapack) ## in what follows below we substitute both side of the define/undef ## while this may seem a little unusual we do it to fully reproduce the ## previous bash-based implementation if test x"${hasRlapack}" = x""; then ## We are using a full Lapack and can use zgbsv -- so #undef remains { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: system LAPACK found" >&5 printf "%s\n" "system LAPACK found" >&6; } arma_lapack="#undef ARMA_CRIPPLED_LAPACK" else ## We are using R's subset of Lapack and CANNOT use zgbsv etc, so we mark it { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: R-supplied partial LAPACK found" >&5 printf "%s\n" "R-supplied partial LAPACK found" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Some complex-valued LAPACK functions may not be available" >&5 printf "%s\n" "$as_me: WARNING: Some complex-valued LAPACK functions may not be available" >&2;} arma_lapack="#define ARMA_CRIPPLED_LAPACK 1" fi ## Default the OpenMP flag to the empty string. ## If and only if OpenMP is found, expand to $(SHLIB_OPENMP_CXXFLAGS) openmp_flag="" ## Set the fallback, by default it is nope arma_have_openmp="#define ARMA_DONT_USE_OPENMP 1" if test x"${openmp_already_works}" = x"yes"; then arma_have_openmp="#define ARMA_USE_OPENMP 1" openmp_flag='$(SHLIB_OPENMP_CXXFLAGS)' fi if test x"${can_use_openmp}" = x"yes"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for OpenMP" >&5 printf %s "checking for OpenMP... " >&6; } ## if R has -fopenmp we should be good allldflags=$(${R_HOME}/bin/R CMD config --ldflags) hasOpenMP=$(echo ${allldflags} | grep -- -fopenmp) if test x"${hasOpenMP}" = x""; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: missing" >&5 printf "%s\n" "missing" >&6; } arma_have_openmp="#define ARMA_DONT_USE_OPENMP 1" else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: found and suitable" >&5 printf "%s\n" "found and suitable" >&6; } arma_have_openmp="#define ARMA_USE_OPENMP 1" openmp_flag='$(SHLIB_OPENMP_CXXFLAGS)' fi fi ## now use all these ARMA_LAPACK="${arma_lapack}" ARMA_HAVE_OPENMP="${arma_have_openmp}" OPENMP_FLAG="${openmp_flag}" ac_config_files="$ac_config_files inst/include/RcppArmadillo/config/RcppArmadilloConfigGenerated.h src/Makevars" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # 'ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* 'ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # 'set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # 'set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 printf "%s\n" "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. # # If the first sed substitution is executed (which looks for macros that # take arguments), then branch to the quote section. Otherwise, # look for a macro that doesn't take arguments. ac_script=' :mline /\\$/{ N s,\\\n,, b mline } t clear :clear s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g t quote s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g t quote b any :quote s/[][ `~#$^&*(){}\\|;'\''"<>?]/\\&/g s/\$/$$/g H :any ${ g s/^\n// s/\n/ /g p } ' DEFS=`sed -n "$ac_script" confdefs.h` ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`printf "%s\n" "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case e in #( e) case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac ;; esac fi # Reset variables that may have inherited troublesome values from # the environment. # IFS needs to be set, to space, tab, and newline, in precisely that order. # (If _AS_PATH_WALK were called with IFS unset, it would have the # side effect of setting IFS to empty, thus disabling word splitting.) # Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl IFS=" "" $as_nl" PS1='$ ' PS2='> ' PS4='+ ' # Ensure predictable behavior from utilities with locale-dependent output. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # We cannot yet rely on "unset" to work, but we need these variables # to be unset--not just set to an empty or harmless value--now, to # avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct # also avoids known problems related to "unset" and subshell syntax # in other old shells (e.g. bash 2.01 and pdksh 5.2.14). for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH do eval test \${$as_var+y} \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done # Ensure that fds 0, 1, and 2 are open. if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. if ${PATH_SEPARATOR+false} :; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as 'sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi printf "%s\n" "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null then : eval 'as_fn_append () { eval $1+=\$2 }' else case e in #( e) as_fn_append () { eval $1=\$$1\$2 } ;; esac fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null then : eval 'as_fn_arith () { as_val=$(( $* )) }' else case e in #( e) as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } ;; esac fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # Determine whether it's possible to make 'echo' print without a newline. # These variables are no longer used directly by Autoconf, but are AC_SUBSTed # for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac # For backward compatibility with old third-party macros, we provide # the shell variables $as_echo and $as_echo_n. New code should use # AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. as_echo='printf %s\n' as_echo_n='printf %s' rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both 'ln -s file dir' and 'ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; 'ln -s' creates a wrapper executable. # In both cases, we have to default to 'cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_sed_cpp="y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" as_tr_cpp="eval sed '$as_sed_cpp'" # deprecated # Sed expression to map a string onto a valid variable name. as_sed_sh="y%*+%pp%;s%[^_$as_cr_alnum]%_%g" as_tr_sh="eval sed '$as_sed_sh'" # deprecated exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by RcppArmadillo $as_me 14.6.0-1, which was generated by GNU Autoconf 2.72. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ '$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE Configuration files: $config_files Report bugs to ." _ACEOF ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"` ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"` cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ RcppArmadillo config.status 14.6.0-1 configured by $0, generated by GNU Autoconf 2.72, with options \\"\$ac_cs_config\\" Copyright (C) 2023 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) printf "%s\n" "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) printf "%s\n" "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --he | --h | --help | --hel | -h ) printf "%s\n" "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: '$1' Try '$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX printf "%s\n" "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "inst/include/RcppArmadillo/config/RcppArmadilloConfigGenerated.h") CONFIG_FILES="$CONFIG_FILES inst/include/RcppArmadillo/config/RcppArmadilloConfigGenerated.h" ;; "src/Makevars") CONFIG_FILES="$CONFIG_FILES src/Makevars" ;; *) as_fn_error $? "invalid argument: '$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to '$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with './config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" eval set X " :F $CONFIG_FILES " shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag '$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain ':'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: '$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is 'configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 printf "%s\n" "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`printf "%s\n" "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when '$srcdir' = '.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable 'datarootdir' which seems to be undefined. Please make sure it is defined" >&5 printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable 'datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi RcppArmadillo/man/0000755000176200001440000000000015030514741013556 5ustar liggesusersRcppArmadillo/man/armadillo_throttle_cores.Rd0000644000176200001440000000106114520330720021123 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/init.R \name{armadillo_throttle_cores} \alias{armadillo_throttle_cores} \alias{armadillo_reset_cores} \title{Throttle (or Reset) (Rcpp)Armadillo to Two Cores} \usage{ armadillo_throttle_cores(n = 2) armadillo_reset_cores() } \arguments{ \item{n}{Integer value of desired cores, default is two} } \description{ Helper functions to throttle use of cores by RcppArmadillo-internal code on systems with OpenMP. On package load, the initial value is saved and used to reset the value. } RcppArmadillo/man/fastLm.Rd0000644000176200001440000001006115030514741015271 0ustar liggesusers\name{fastLm} \alias{fastLm} \alias{fastLmPure} \alias{fastLm.default} \alias{fastLm.formula} \concept{regression} \title{Bare-bones linear model fitting function} \description{ \code{fastLm} estimates the linear model using the \code{solve} function of \code{Armadillo} linear algebra library. } \usage{ fastLmPure(X, y) fastLm(X, \dots) \method{fastLm}{default}(X, y, \dots) \method{fastLm}{formula}(formula, data = list(), \dots) } \arguments{ \item{y}{a vector containing the explained variable.} \item{X}{a model matrix.} \item{formula}{a symbolic description of the model to be fit.} \item{data}{an optional data frame containing the variables in the model.} \item{\ldots}{not used} } \details{ Linear models should be estimated using the \code{\link{lm}} function. In some cases, \code{\link{lm.fit}} may be appropriate. The \code{fastLmPure} function provides a reference use case of the \code{Armadillo} library via the wrapper functions in the \pkg{RcppArmadillo} package. The \code{fastLm} function provides a more standard implementation of a linear model fit, offering both a default and a formula interface as well as \code{print}, \code{summary} and \code{predict} methods. Lastly, one must be be careful in timing comparisons of \code{\link{lm}} and friends versus this approach based on \code{Armadillo}. The reason that \code{Armadillo} can do something like \code{\link{lm.fit}} faster than the functions in the stats package is because \code{Armadillo} can use different solvers, including fast / approximative ones. Older versions of Armadillo could therefore either fail or, worse, produce completely incorrect answers on rank-deficient model matrices whereas the functions from the stats package will handle them properly due to the modified Linpack code. Newer Armadillo version pivot (with warning) to an approximate solutions. This behavior can be controlled with options to the \code{solve} function, see the Armadillo documentation. An example of the type of situation requiring extra care in checking for rank deficiency is a two-way layout with missing cells (see the examples section). These cases require a special pivoting scheme of \dQuote{pivot only on (apparent) rank deficiency} which is not part of conventional linear algebra software. } \value{ \code{fastLmPure} returns a list with three components: \item{coefficients}{a vector of coefficients} \item{stderr}{a vector of the (estimated) standard errors of the coefficient estimates} \item{df.residual}{a scalar denoting the degrees of freedom in the model} \code{fastLm} returns a richer object which also includes the residuals, fitted values and call argument similar to the \code{\link{lm}} or \code{\link[MASS]{rlm}} functions. } \seealso{\code{\link{lm}}, \code{\link{lm.fit}}} \references{Armadillo project: \url{https://arma.sourceforge.net/}} \author{ Armadillo is written by Conrad Sanderson. RcppArmadillo is written by Romain Francois, Dirk Eddelbuettel, Douglas Bates and Binxiang Ni. } \examples{ \dontshow{ ## as an illustration, the example is computationally inexpensive ## and does not require this per se armadillo_throttle_cores(2) } data(trees, package="datasets") ## bare-bones direct interface flm <- fastLmPure( cbind(1, log(trees$Girth)), log(trees$Volume) ) print(flm) ## standard R interface for formula or data returning object of class fastLm flmmod <- fastLm( log(Volume) ~ log(Girth), data=trees) summary(flmmod) ## case where fastLm breaks down dd <- data.frame(f1 = gl(4, 6, labels = LETTERS[1:4]), f2 = gl(3, 2, labels = letters[1:3]))[-(7:8), ] xtabs(~ f2 + f1, dd) # one missing cell mm <- model.matrix(~ f1 * f2, dd) kappa(mm) # large, indicating rank deficiency set.seed(1) dd$y <- mm \%*\% seq_len(ncol(mm)) + rnorm(nrow(mm), sd = 0.1) summary(lm(y ~ f1 * f2, dd)) # detects rank deficiency summary(fastLm(y ~ f1 * f2, dd)) # fits all coefficients via approx solution \dontshow{armadillo_reset_cores()} } \keyword{regression} RcppArmadillo/man/RcppArmadillo-package.Rd0000644000176200001440000000573614316105417020204 0ustar liggesusers\name{RcppArmadillo-package} \alias{RcppArmadillo-package} \alias{RcppArmadillo} \alias{RcppArmadilloExample} \docType{package} \title{ R and Armadillo Integration } \description{ The package brings the power of Armadillo to R. } \section{Armadillo}{ \code{Armadillo} is a C++ linear algebra library, aiming towards a good balance between speed and ease of use. It provides efficient classes for vectors, matrices and cubes, as well as many functions which operate on the classes (eg. contiguous and non-contiguous submatrix views). Various matrix decompositions are provided, and an automatic expression evaluator (via template meta-programming) combines several operations to increase efficiency. The syntax (API) is deliberately similar to Matlab. It is useful for algorithm development directly in C++, or quick conversion of research code into production environments. Armadillo has been primarily developed at NICTA (Australia) by Conrad Sanderson, with contributions from around the world. } \section{RcppArmadillo}{ \code{RcppArmadillo} acts as a bridge between \code{Rcpp} and \code{Armadillo}, allowing the programmer to write code using Armadillo classes that integrate seemlessly with \code{R} via \code{Rcpp}. } \section{Using RcppArmadillo}{ The simplest way to get started is to create a skeleton of a package using \code{RcppArmadillo}. This can be done conveniently by the \code{\link{RcppArmadillo.package.skeleton}} function. The important steps are \itemize{ \item Include the \code{RcppArmadillo.h} header file, which also includes \code{armadillo.h}. \item Import Rcpp, and LinkingTo Rcpp and RcppArmadillo by adding these lines to the DESCRIPTION file: \preformatted{ Imports: Rcpp (>= 0.11.0) LinkingTo: Rcpp, RcppArmadillo } \item Link against the BLAS and LAPACK libraries, by adding this line in the \code{Makevars} and \code{Makevars.win} files: \preformatted{PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) } } } \section{Support}{ Please use the Rcpp-devel mailing list on r-forge for questions about RcppArmadillo (subscribe first). \url{https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel} } \author{ For RcppArmadillo: Dirk Eddelbuettel, Romain Francois, Doug Bates and Binxiang Ni Maintainer: Dirk Eddelbuettel For Armadillo: Conrad Sanderson } \references{ Armadillo project: \url{https://arma.sourceforge.net/} Conrad Sanderson and Ryan Curtin. \href{https://arma.sourceforge.net/armadillo_joss_2016.pdf}{Armadillo: a template-based C++ library for linear algebra}. Journal of Open Source Software, Vol. 1, pp. 26, 2016. Dirk Eddelbuettel and Conrad Sanderson, "RcppArmadillo: Accelerating R with high-performance C++ linear algebra", Computational Statistics and Data Analysis, 2014, 71, March, pages 1054-1063, \doi{10.1016/j.csda.2013.02.005}. ) } \keyword{ package } \keyword{ programming } \keyword{ interface } RcppArmadillo/man/armadillo_get_number_of_omp_threads.Rd0000644000176200001440000000122714520330720023267 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/RcppExports.R \name{armadillo_get_number_of_omp_threads} \alias{armadillo_get_number_of_omp_threads} \alias{armadillo_set_number_of_omp_threads} \title{Report (or Set) Maximum Number of OpenMP Threads} \usage{ armadillo_get_number_of_omp_threads() armadillo_set_number_of_omp_threads(n) } \arguments{ \item{n}{Number of threads to be set} } \value{ For the getter, and on a system with OpenMP, the maximum number of threads that OpenMP may be using and on systems without it, one. The setter does not return a value. } \description{ Report (or Set) Maximum Number of OpenMP Threads } RcppArmadillo/man/armadillo_set_seed_random.Rd0000644000176200001440000000214113104576357021235 0ustar liggesusers\name{armadillo_set_seed_random} \alias{armadillo_set_seed_random} \title{Set the Armadillo Random Number Generator to a random value} \usage{ armadillo_set_seed_random() } \value{ The function is invoked for its side effect and has no return value. } \description{ Set the Armadillo Random Number Generator to a random value } \details{ Depending on whether RcppArmadillo was compiled for the C++98 standard (currently the default) or for C++11 (optional), two different RNGs may be used. This function resets either. For C++98, the R programming language's RNG is used. For C++11, the RNG included in the \code{} library is used only when \code{#define ARMA_USE_CXX11_RNG} is placed before \code{#include }. Otherwise, the R programming language's RNG will be used. } \note{ This has been found to not work as espected in \pkg{RStudio} as its code also uses the system RNG library. You may have to either not run within \pkg{RStudio} or change your code to use a different RNG such as the one from R. } \seealso{ The R documentation on its RNGs all of which are accessible via \pkg{Rcpp}. } RcppArmadillo/man/armadillo_set_seed.Rd0000644000176200001440000000226013104576357017677 0ustar liggesusers\name{armadillo_set_seed} \alias{armadillo_set_seed} \title{Set the Armadillo Random Number Generator to the given value} \usage{ armadillo_set_seed(val) } \arguments{ \item{val}{The seed used to initialize Armadillo's random number generator.} } \value{ The function is invoked for its side effect and has no return value. } \description{ Set the Armadillo Random Number Generator to the given value } \details{ Depending on whether RcppArmadillo was compiled for the C++98 standard (currently the default) or for C++11 (optional), two different RNGs may be used. This function resets either. For C++98, the R programming language's RNG is used. For C++11, the RNG included in the \code{} library is used only when \code{#define ARMA_USE_CXX11_RNG} is placed before \code{#include }. Otherwise, the R programming language's RNG will be used. } \note{ This has been found to not work as espected in \pkg{RStudio} as its code also uses the system RNG library. You may have to either not run within \pkg{RStudio} or change your code to use a different RNG such as the one from R. } \seealso{ The R documentation on its RNGs all of which are accessible via \pkg{Rcpp}. } RcppArmadillo/man/armadillo_version.Rd0000644000176200001440000000130112275520636017561 0ustar liggesusers\name{armadillo_version} \alias{armadillo_version} \title{Report the version of Armadillo} \usage{ armadillo_version(single) } \arguments{ \item{single}{A logical vector indicating whether a single return values is requested, or a named vector with three elements \code{major}, \code{minor} and \code{patch}.} } \value{ Depending on the value of \code{single}, either a single number describing the Armadillo version or a named vector with three elements \code{major}, \code{minor} and \code{patch}. } \description{ Report the version of Armadillo } \details{ The version is defined by Armadillo in the header \code{arma_version.hpp}. } \seealso{ Armadillo header file \code{arma_version.hpp}. } RcppArmadillo/man/RcppArmadillo.package.skeleton.Rd0000644000176200001440000000554514752723635022042 0ustar liggesusers\name{RcppArmadillo.package.skeleton} \alias{RcppArmadillo.package.skeleton} \title{ Create a skeleton for a new package that intends to use RcppArmadillo } \description{ \code{RcppArmadillo.package.skeleton} automates the creation of a new source package that intends to use features of RcppArmadilo. It is based on the \link[utils]{package.skeleton} function which it executes first. } \usage{ RcppArmadillo.package.skeleton(name = "anRpackage", list = character(), environment = .GlobalEnv, path = ".", force = FALSE, code_files = character(), example_code = TRUE, author = "Your Name", maintainer = if (missing(author)) "Your Name" else author, email = "your@email.com", githubuser = NA_character_, license = "GPL (>= 2)") } \arguments{ \item{name}{See \link[utils]{package.skeleton}} \item{list}{See \link[utils]{package.skeleton}} \item{environment}{See \link[utils]{package.skeleton}} \item{path}{See \link[utils]{package.skeleton}} \item{force}{See \link[utils]{package.skeleton}} \item{code_files}{See \link[utils]{package.skeleton}} \item{example_code}{If TRUE, example c++ code using RcppArmadillo is added to the package} \item{author}{Author of the package.} \item{maintainer}{Maintainer of the package.} \item{email}{Email of the package maintainer.} \item{githubuser}{GitHub username for URL and BugReports, if present.} \item{license}{License of the package.} } \details{ In addition to \link[utils]{package.skeleton} : The \samp{DESCRIPTION} file gains a Depends line requesting that the package depends on Rcpp and RcppArmadillo and a LinkingTo line so that the package finds Rcpp and RcppArmadillo header files. The \samp{NAMESPACE}, if any, gains a \code{useDynLib} directive. The \samp{src} directory is created if it does not exists and a \samp{Makevars} file is added setting the environment variable \samp{PKG_LIBS} to accomodate the necessary flags to link with the Rcpp library. If the \code{example_code} argument is set to \code{TRUE}, example files \samp{rcpparma_hello_world.h} and \samp{rcpparma_hello_world.cpp} are also created in the \samp{src}. An R file \samp{rcpparma_hello_world.R} is expanded in the \samp{R} directory, the \code{rcpparma_hello_world} function defined in this files makes use of the C++ function \samp{rcpparma_hello_world} defined in the C++ file. These files are given as an example and should eventually by removed from the generated package. } \value{ Nothing, used for its side effects } \seealso{ \link[utils]{package.skeleton} } \references{ Read the \emph{Writing R Extensions} manual for more details. Once you have created a \emph{source} package you need to install it: see the \emph{R Installation and Administration} manual, \code{\link{INSTALL}} and \code{\link{install.packages}}. } \examples{ \dontrun{ RcppArmadillo.package.skeleton( "foobar" ) } } \keyword{ programming } RcppArmadillo/DESCRIPTION0000644000176200001440000000467115031311036014512 0ustar liggesusersPackage: RcppArmadillo Type: Package Title: 'Rcpp' Integration for the 'Armadillo' Templated Linear Algebra Library Version: 14.6.0-1 Date: 2025-07-02 Authors@R: c(person("Dirk", "Eddelbuettel", role = c("aut", "cre"), email = "edd@debian.org", comment = c(ORCID = "0000-0001-6419-907X")), person("Romain", "Francois", role = "aut", comment = c(ORCID = "0000-0002-2444-4226")), person("Doug", "Bates", role = "aut", comment = c(ORCID = "0000-0001-8316-9503")), person("Binxiang", "Ni", role = "aut"), person("Conrad", "Sanderson", role = "aut", comment = c(ORCID = "0000-0002-0049-4501"))) Description: 'Armadillo' is a templated C++ linear algebra library (by Conrad Sanderson) that aims towards a good balance between speed and ease of use. Integer, floating point and complex numbers are supported, as well as a subset of trigonometric and statistics functions. Various matrix decompositions are provided through optional integration with LAPACK and ATLAS libraries. The 'RcppArmadillo' package includes the header files from the templated 'Armadillo' library. Thus users do not need to install 'Armadillo' itself in order to use 'RcppArmadillo'. From release 7.800.0 on, 'Armadillo' is licensed under Apache License 2; previous releases were under licensed as MPL 2.0 from version 3.800.0 onwards and LGPL-3 prior to that; 'RcppArmadillo' (the 'Rcpp' bindings/bridge to Armadillo) is licensed under the GNU GPL version 2 or later, as is the rest of 'Rcpp'. License: GPL (>= 2) LazyLoad: yes Depends: R (>= 3.3.0) LinkingTo: Rcpp Imports: Rcpp (>= 1.0.12), stats, utils, methods Suggests: tinytest, Matrix (>= 1.3.0), pkgKitten, reticulate, slam URL: https://github.com/RcppCore/RcppArmadillo, https://dirk.eddelbuettel.com/code/rcpp.armadillo.html BugReports: https://github.com/RcppCore/RcppArmadillo/issues RoxygenNote: 6.0.1 NeedsCompilation: yes Packaged: 2025-07-02 13:16:08 UTC; edd Author: Dirk Eddelbuettel [aut, cre] (ORCID: ), Romain Francois [aut] (ORCID: ), Doug Bates [aut] (ORCID: ), Binxiang Ni [aut], Conrad Sanderson [aut] (ORCID: ) Maintainer: Dirk Eddelbuettel Repository: CRAN Date/Publication: 2025-07-02 20:10:06 UTC