├── .Rbuildignore ├── .aspell ├── RcppArmadillo.rds └── defaults.R ├── .codecov.yml ├── .covrignore ├── .editorconfig ├── .gitattributes ├── .github └── workflows │ └── ci.yaml ├── .gitignore ├── ChangeLog ├── DESCRIPTION ├── NAMESPACE ├── R ├── RcppArmadillo.package.skeleton.R ├── RcppExports.R ├── SciPy2R.R ├── fastLm.R ├── flags.R ├── init.R └── inline.R ├── README.md ├── cleanup ├── configure ├── configure.ac ├── inst ├── AUTHORS ├── CITATION ├── COPYRIGHTS ├── NEWS.Rd ├── announce │ └── ANNOUNCE-0.2.0.txt ├── examples │ ├── fastLm.r │ ├── kalman │ │ ├── FirstKalmanR.R │ │ ├── Kalman.cpp │ │ ├── KalmanR.R │ │ ├── KalmanRimp.R │ │ ├── benchmark.R │ │ ├── firstExample.R │ │ ├── kalmanExample.m │ │ ├── kalmanM.m │ │ ├── kalmanfilter.m │ │ └── pos.txt │ └── varSimulation.r ├── include │ ├── README │ ├── RcppArmadillo.h │ ├── RcppArmadillo │ │ ├── Alt_R_RNG.h │ │ ├── Light │ │ ├── Lighter │ │ ├── Lightest │ │ ├── RcppArmadillo │ │ ├── config │ │ │ ├── RcppArmadilloConfig.h │ │ │ └── RcppArmadilloConfigGenerated.h.in │ │ ├── interface │ │ │ ├── RcppArmadilloAs.h │ │ │ ├── RcppArmadilloForward.h │ │ │ ├── RcppArmadilloSugar.h │ │ │ └── RcppArmadilloWrap.h │ │ ├── internal │ │ │ ├── Col_meat.h │ │ │ ├── Col_proto.h │ │ │ ├── Mat_meat.h │ │ │ ├── Mat_proto.h │ │ │ ├── Row_meat.h │ │ │ └── Row_proto.h │ │ └── rng │ │ │ └── Alt_R_RNG.h │ ├── RcppArmadilloExtensions │ │ ├── fixprob.h │ │ ├── rmultinom.h │ │ └── sample.h │ ├── armadillo │ └── armadillo_bits │ │ ├── BaseCube_bones.hpp │ │ ├── BaseCube_meat.hpp │ │ ├── Base_bones.hpp │ │ ├── Base_meat.hpp │ │ ├── Col_bones.hpp │ │ ├── Col_meat.hpp │ │ ├── CubeToMatOp_bones.hpp │ │ ├── CubeToMatOp_meat.hpp │ │ ├── Cube_bones.hpp │ │ ├── Cube_meat.hpp │ │ ├── GenCube_bones.hpp │ │ ├── GenCube_meat.hpp │ │ ├── Gen_bones.hpp │ │ ├── Gen_meat.hpp │ │ ├── GlueCube_bones.hpp │ │ ├── GlueCube_meat.hpp │ │ ├── Glue_bones.hpp │ │ ├── Glue_meat.hpp │ │ ├── MapMat_bones.hpp │ │ ├── MapMat_meat.hpp │ │ ├── Mat_bones.hpp │ │ ├── Mat_meat.hpp │ │ ├── OpCube_bones.hpp │ │ ├── OpCube_meat.hpp │ │ ├── Op_bones.hpp │ │ ├── Op_meat.hpp │ │ ├── Proxy.hpp │ │ ├── ProxyCube.hpp │ │ ├── Row_bones.hpp │ │ ├── Row_meat.hpp │ │ ├── SizeCube_bones.hpp │ │ ├── SizeCube_meat.hpp │ │ ├── SizeMat_bones.hpp │ │ ├── SizeMat_meat.hpp │ │ ├── SpBase_bones.hpp │ │ ├── SpBase_meat.hpp │ │ ├── SpCol_bones.hpp │ │ ├── SpCol_meat.hpp │ │ ├── SpGlue_bones.hpp │ │ ├── SpGlue_meat.hpp │ │ ├── SpMat_bones.hpp │ │ ├── SpMat_iterators_meat.hpp │ │ ├── SpMat_meat.hpp │ │ ├── SpOp_bones.hpp │ │ ├── SpOp_meat.hpp │ │ ├── SpProxy.hpp │ │ ├── SpRow_bones.hpp │ │ ├── SpRow_meat.hpp │ │ ├── SpSubview_bones.hpp │ │ ├── SpSubview_col_list_bones.hpp │ │ ├── SpSubview_col_list_meat.hpp │ │ ├── SpSubview_iterators_meat.hpp │ │ ├── SpSubview_meat.hpp │ │ ├── SpToDGlue_bones.hpp │ │ ├── SpToDGlue_meat.hpp │ │ ├── SpToDOp_bones.hpp │ │ ├── SpToDOp_meat.hpp │ │ ├── SpValProxy_bones.hpp │ │ ├── SpValProxy_meat.hpp │ │ ├── access.hpp │ │ ├── arma_cmath.hpp │ │ ├── arma_config.hpp │ │ ├── arma_forward.hpp │ │ ├── arma_ostream_bones.hpp │ │ ├── arma_ostream_meat.hpp │ │ ├── arma_rel_comparators.hpp │ │ ├── arma_rng.hpp │ │ ├── arma_rng_cxx03.hpp │ │ ├── arma_static_check.hpp │ │ ├── arma_str.hpp │ │ ├── arma_version.hpp │ │ ├── arrayops_bones.hpp │ │ ├── arrayops_meat.hpp │ │ ├── auxlib_bones.hpp │ │ ├── auxlib_meat.hpp │ │ ├── band_helper.hpp │ │ ├── compiler_check.hpp │ │ ├── compiler_setup.hpp │ │ ├── compiler_setup_post.hpp │ │ ├── cond_rel_bones.hpp │ │ ├── cond_rel_meat.hpp │ │ ├── config.hpp │ │ ├── constants.hpp │ │ ├── constants_old.hpp │ │ ├── csv_name.hpp │ │ ├── debug.hpp │ │ ├── def_arpack.hpp │ │ ├── def_atlas.hpp │ │ ├── def_blas.hpp │ │ ├── def_fftw3.hpp │ │ ├── def_lapack.hpp │ │ ├── def_superlu.hpp │ │ ├── diagmat_proxy.hpp │ │ ├── diagview_bones.hpp │ │ ├── diagview_meat.hpp │ │ ├── diskio_bones.hpp │ │ ├── diskio_meat.hpp │ │ ├── distr_param.hpp │ │ ├── eGlueCube_bones.hpp │ │ ├── eGlueCube_meat.hpp │ │ ├── eGlue_bones.hpp │ │ ├── eGlue_meat.hpp │ │ ├── eOpCube_bones.hpp │ │ ├── eOpCube_meat.hpp │ │ ├── eOp_bones.hpp │ │ ├── eOp_meat.hpp │ │ ├── eglue_core_bones.hpp │ │ ├── eglue_core_meat.hpp │ │ ├── eop_aux.hpp │ │ ├── eop_core_bones.hpp │ │ ├── eop_core_meat.hpp │ │ ├── fft_engine_fftw3.hpp │ │ ├── fft_engine_kissfft.hpp │ │ ├── field_bones.hpp │ │ ├── field_meat.hpp │ │ ├── fill.hpp │ │ ├── fn_accu.hpp │ │ ├── fn_all.hpp │ │ ├── fn_any.hpp │ │ ├── fn_approx_equal.hpp │ │ ├── fn_as_scalar.hpp │ │ ├── fn_chi2rnd.hpp │ │ ├── fn_chol.hpp │ │ ├── fn_clamp.hpp │ │ ├── fn_cond_rcond.hpp │ │ ├── fn_conv.hpp │ │ ├── fn_conv_to.hpp │ │ ├── fn_cor.hpp │ │ ├── fn_cov.hpp │ │ ├── fn_cross.hpp │ │ ├── fn_cumprod.hpp │ │ ├── fn_cumsum.hpp │ │ ├── fn_det.hpp │ │ ├── fn_diagmat.hpp │ │ ├── fn_diags_spdiags.hpp │ │ ├── fn_diagvec.hpp │ │ ├── fn_diff.hpp │ │ ├── fn_dot.hpp │ │ ├── fn_eig_gen.hpp │ │ ├── fn_eig_pair.hpp │ │ ├── fn_eig_sym.hpp │ │ ├── fn_eigs_gen.hpp │ │ ├── fn_eigs_sym.hpp │ │ ├── fn_elem.hpp │ │ ├── fn_eps.hpp │ │ ├── fn_expmat.hpp │ │ ├── fn_eye.hpp │ │ ├── fn_fft.hpp │ │ ├── fn_fft2.hpp │ │ ├── fn_find.hpp │ │ ├── fn_find_unique.hpp │ │ ├── fn_flip.hpp │ │ ├── fn_hess.hpp │ │ ├── fn_hist.hpp │ │ ├── fn_histc.hpp │ │ ├── fn_index_max.hpp │ │ ├── fn_index_min.hpp │ │ ├── fn_inplace_strans.hpp │ │ ├── fn_inplace_trans.hpp │ │ ├── fn_interp1.hpp │ │ ├── fn_interp2.hpp │ │ ├── fn_intersect.hpp │ │ ├── fn_inv.hpp │ │ ├── fn_inv_sympd.hpp │ │ ├── fn_join.hpp │ │ ├── fn_kmeans.hpp │ │ ├── fn_kron.hpp │ │ ├── fn_log_det.hpp │ │ ├── fn_log_normpdf.hpp │ │ ├── fn_logmat.hpp │ │ ├── fn_lu.hpp │ │ ├── fn_max.hpp │ │ ├── fn_mean.hpp │ │ ├── fn_median.hpp │ │ ├── fn_min.hpp │ │ ├── fn_misc.hpp │ │ ├── fn_mvnrnd.hpp │ │ ├── fn_n_unique.hpp │ │ ├── fn_nonzeros.hpp │ │ ├── fn_norm.hpp │ │ ├── fn_normalise.hpp │ │ ├── fn_normcdf.hpp │ │ ├── fn_normpdf.hpp │ │ ├── fn_numel.hpp │ │ ├── fn_ones.hpp │ │ ├── fn_orth_null.hpp │ │ ├── fn_pinv.hpp │ │ ├── fn_polyfit.hpp │ │ ├── fn_polyval.hpp │ │ ├── fn_powext.hpp │ │ ├── fn_powmat.hpp │ │ ├── fn_princomp.hpp │ │ ├── fn_prod.hpp │ │ ├── fn_qr.hpp │ │ ├── fn_quantile.hpp │ │ ├── fn_qz.hpp │ │ ├── fn_randg.hpp │ │ ├── fn_randi.hpp │ │ ├── fn_randn.hpp │ │ ├── fn_randperm.hpp │ │ ├── fn_randu.hpp │ │ ├── fn_range.hpp │ │ ├── fn_rank.hpp │ │ ├── fn_regspace.hpp │ │ ├── fn_repelem.hpp │ │ ├── fn_repmat.hpp │ │ ├── fn_reshape.hpp │ │ ├── fn_resize.hpp │ │ ├── fn_reverse.hpp │ │ ├── fn_roots.hpp │ │ ├── fn_schur.hpp │ │ ├── fn_shift.hpp │ │ ├── fn_shuffle.hpp │ │ ├── fn_size.hpp │ │ ├── fn_solve.hpp │ │ ├── fn_sort.hpp │ │ ├── fn_sort_index.hpp │ │ ├── fn_speye.hpp │ │ ├── fn_spones.hpp │ │ ├── fn_sprandn.hpp │ │ ├── fn_sprandu.hpp │ │ ├── fn_spsolve.hpp │ │ ├── fn_sqrtmat.hpp │ │ ├── fn_stddev.hpp │ │ ├── fn_strans.hpp │ │ ├── fn_sum.hpp │ │ ├── fn_svd.hpp │ │ ├── fn_svds.hpp │ │ ├── fn_sylvester.hpp │ │ ├── fn_symmat.hpp │ │ ├── fn_toeplitz.hpp │ │ ├── fn_trace.hpp │ │ ├── fn_trans.hpp │ │ ├── fn_trapz.hpp │ │ ├── fn_trig.hpp │ │ ├── fn_trimat.hpp │ │ ├── fn_trimat_ind.hpp │ │ ├── fn_trunc_exp.hpp │ │ ├── fn_trunc_log.hpp │ │ ├── fn_unique.hpp │ │ ├── fn_var.hpp │ │ ├── fn_vecnorm.hpp │ │ ├── fn_vectorise.hpp │ │ ├── fn_wishrnd.hpp │ │ ├── fn_zeros.hpp │ │ ├── glue_affmul_bones.hpp │ │ ├── glue_affmul_meat.hpp │ │ ├── glue_atan2_bones.hpp │ │ ├── glue_atan2_meat.hpp │ │ ├── glue_conv_bones.hpp │ │ ├── glue_conv_meat.hpp │ │ ├── glue_cor_bones.hpp │ │ ├── glue_cor_meat.hpp │ │ ├── glue_cov_bones.hpp │ │ ├── glue_cov_meat.hpp │ │ ├── glue_cross_bones.hpp │ │ ├── glue_cross_meat.hpp │ │ ├── glue_hist_bones.hpp │ │ ├── glue_hist_meat.hpp │ │ ├── glue_histc_bones.hpp │ │ ├── glue_histc_meat.hpp │ │ ├── glue_hypot_bones.hpp │ │ ├── glue_hypot_meat.hpp │ │ ├── glue_intersect_bones.hpp │ │ ├── glue_intersect_meat.hpp │ │ ├── glue_join_bones.hpp │ │ ├── glue_join_meat.hpp │ │ ├── glue_kron_bones.hpp │ │ ├── glue_kron_meat.hpp │ │ ├── glue_max_bones.hpp │ │ ├── glue_max_meat.hpp │ │ ├── glue_min_bones.hpp │ │ ├── glue_min_meat.hpp │ │ ├── glue_mixed_bones.hpp │ │ ├── glue_mixed_meat.hpp │ │ ├── glue_mvnrnd_bones.hpp │ │ ├── glue_mvnrnd_meat.hpp │ │ ├── glue_polyfit_bones.hpp │ │ ├── glue_polyfit_meat.hpp │ │ ├── glue_polyval_bones.hpp │ │ ├── glue_polyval_meat.hpp │ │ ├── glue_powext_bones.hpp │ │ ├── glue_powext_meat.hpp │ │ ├── glue_quantile_bones.hpp │ │ ├── glue_quantile_meat.hpp │ │ ├── glue_relational_bones.hpp │ │ ├── glue_relational_meat.hpp │ │ ├── glue_solve_bones.hpp │ │ ├── glue_solve_meat.hpp │ │ ├── glue_times_bones.hpp │ │ ├── glue_times_meat.hpp │ │ ├── glue_times_misc_bones.hpp │ │ ├── glue_times_misc_meat.hpp │ │ ├── glue_toeplitz_bones.hpp │ │ ├── glue_toeplitz_meat.hpp │ │ ├── glue_trapz_bones.hpp │ │ ├── glue_trapz_meat.hpp │ │ ├── gmm_diag_bones.hpp │ │ ├── gmm_diag_meat.hpp │ │ ├── gmm_full_bones.hpp │ │ ├── gmm_full_meat.hpp │ │ ├── gmm_misc_bones.hpp │ │ ├── gmm_misc_meat.hpp │ │ ├── hdf5_misc.hpp │ │ ├── hdf5_name.hpp │ │ ├── include_hdf5.hpp │ │ ├── include_superlu.hpp │ │ ├── injector_bones.hpp │ │ ├── injector_meat.hpp │ │ ├── memory.hpp │ │ ├── mp_misc.hpp │ │ ├── mtGlueCube_bones.hpp │ │ ├── mtGlueCube_meat.hpp │ │ ├── mtGlue_bones.hpp │ │ ├── mtGlue_meat.hpp │ │ ├── mtOpCube_bones.hpp │ │ ├── mtOpCube_meat.hpp │ │ ├── mtOp_bones.hpp │ │ ├── mtOp_meat.hpp │ │ ├── mtSpGlue_bones.hpp │ │ ├── mtSpGlue_meat.hpp │ │ ├── mtSpOp_bones.hpp │ │ ├── mtSpOp_meat.hpp │ │ ├── mtSpReduceOp_bones.hpp │ │ ├── mtSpReduceOp_meat.hpp │ │ ├── mul_gemm.hpp │ │ ├── mul_gemm_mixed.hpp │ │ ├── mul_gemv.hpp │ │ ├── mul_herk.hpp │ │ ├── mul_syrk.hpp │ │ ├── newarp_DenseGenMatProd_bones.hpp │ │ ├── newarp_DenseGenMatProd_meat.hpp │ │ ├── newarp_DoubleShiftQR_bones.hpp │ │ ├── newarp_DoubleShiftQR_meat.hpp │ │ ├── newarp_EigsSelect.hpp │ │ ├── newarp_GenEigsSolver_bones.hpp │ │ ├── newarp_GenEigsSolver_meat.hpp │ │ ├── newarp_SortEigenvalue.hpp │ │ ├── newarp_SparseGenMatProd_bones.hpp │ │ ├── newarp_SparseGenMatProd_meat.hpp │ │ ├── newarp_SparseGenRealShiftSolve_bones.hpp │ │ ├── newarp_SparseGenRealShiftSolve_meat.hpp │ │ ├── newarp_SymEigsShiftSolver_bones.hpp │ │ ├── newarp_SymEigsShiftSolver_meat.hpp │ │ ├── newarp_SymEigsSolver_bones.hpp │ │ ├── newarp_SymEigsSolver_meat.hpp │ │ ├── newarp_TridiagEigen_bones.hpp │ │ ├── newarp_TridiagEigen_meat.hpp │ │ ├── newarp_UpperHessenbergEigen_bones.hpp │ │ ├── newarp_UpperHessenbergEigen_meat.hpp │ │ ├── newarp_UpperHessenbergQR_bones.hpp │ │ ├── newarp_UpperHessenbergQR_meat.hpp │ │ ├── newarp_cx_attrib.hpp │ │ ├── op_all_bones.hpp │ │ ├── op_all_meat.hpp │ │ ├── op_any_bones.hpp │ │ ├── op_any_meat.hpp │ │ ├── op_chi2rnd_bones.hpp │ │ ├── op_chi2rnd_meat.hpp │ │ ├── op_chol_bones.hpp │ │ ├── op_chol_meat.hpp │ │ ├── op_clamp_bones.hpp │ │ ├── op_clamp_meat.hpp │ │ ├── op_col_as_mat_bones.hpp │ │ ├── op_col_as_mat_meat.hpp │ │ ├── op_cond_bones.hpp │ │ ├── op_cond_meat.hpp │ │ ├── op_cor_bones.hpp │ │ ├── op_cor_meat.hpp │ │ ├── op_cov_bones.hpp │ │ ├── op_cov_meat.hpp │ │ ├── op_cumprod_bones.hpp │ │ ├── op_cumprod_meat.hpp │ │ ├── op_cumsum_bones.hpp │ │ ├── op_cumsum_meat.hpp │ │ ├── op_cx_scalar_bones.hpp │ │ ├── op_cx_scalar_meat.hpp │ │ ├── op_det_bones.hpp │ │ ├── op_det_meat.hpp │ │ ├── op_diagmat_bones.hpp │ │ ├── op_diagmat_meat.hpp │ │ ├── op_diagvec_bones.hpp │ │ ├── op_diagvec_meat.hpp │ │ ├── op_diff_bones.hpp │ │ ├── op_diff_meat.hpp │ │ ├── op_dot_bones.hpp │ │ ├── op_dot_meat.hpp │ │ ├── op_dotext_bones.hpp │ │ ├── op_dotext_meat.hpp │ │ ├── op_expmat_bones.hpp │ │ ├── op_expmat_meat.hpp │ │ ├── op_fft_bones.hpp │ │ ├── op_fft_meat.hpp │ │ ├── op_find_bones.hpp │ │ ├── op_find_meat.hpp │ │ ├── op_find_unique_bones.hpp │ │ ├── op_find_unique_meat.hpp │ │ ├── op_flip_bones.hpp │ │ ├── op_flip_meat.hpp │ │ ├── op_hist_bones.hpp │ │ ├── op_hist_meat.hpp │ │ ├── op_htrans_bones.hpp │ │ ├── op_htrans_meat.hpp │ │ ├── op_index_max_bones.hpp │ │ ├── op_index_max_meat.hpp │ │ ├── op_index_min_bones.hpp │ │ ├── op_index_min_meat.hpp │ │ ├── op_inv_gen_bones.hpp │ │ ├── op_inv_gen_meat.hpp │ │ ├── op_inv_spd_bones.hpp │ │ ├── op_inv_spd_meat.hpp │ │ ├── op_log_det_bones.hpp │ │ ├── op_log_det_meat.hpp │ │ ├── op_logmat_bones.hpp │ │ ├── op_logmat_meat.hpp │ │ ├── op_max_bones.hpp │ │ ├── op_max_meat.hpp │ │ ├── op_mean_bones.hpp │ │ ├── op_mean_meat.hpp │ │ ├── op_median_bones.hpp │ │ ├── op_median_meat.hpp │ │ ├── op_min_bones.hpp │ │ ├── op_min_meat.hpp │ │ ├── op_misc_bones.hpp │ │ ├── op_misc_meat.hpp │ │ ├── op_nonzeros_bones.hpp │ │ ├── op_nonzeros_meat.hpp │ │ ├── op_norm2est_bones.hpp │ │ ├── op_norm2est_meat.hpp │ │ ├── op_norm_bones.hpp │ │ ├── op_norm_meat.hpp │ │ ├── op_normalise_bones.hpp │ │ ├── op_normalise_meat.hpp │ │ ├── op_orth_null_bones.hpp │ │ ├── op_orth_null_meat.hpp │ │ ├── op_pinv_bones.hpp │ │ ├── op_pinv_meat.hpp │ │ ├── op_powmat_bones.hpp │ │ ├── op_powmat_meat.hpp │ │ ├── op_princomp_bones.hpp │ │ ├── op_princomp_meat.hpp │ │ ├── op_prod_bones.hpp │ │ ├── op_prod_meat.hpp │ │ ├── op_range_bones.hpp │ │ ├── op_range_meat.hpp │ │ ├── op_rank_bones.hpp │ │ ├── op_rank_meat.hpp │ │ ├── op_rcond_bones.hpp │ │ ├── op_rcond_meat.hpp │ │ ├── op_relational_bones.hpp │ │ ├── op_relational_meat.hpp │ │ ├── op_repelem_bones.hpp │ │ ├── op_repelem_meat.hpp │ │ ├── op_repmat_bones.hpp │ │ ├── op_repmat_meat.hpp │ │ ├── op_reshape_bones.hpp │ │ ├── op_reshape_meat.hpp │ │ ├── op_resize_bones.hpp │ │ ├── op_resize_meat.hpp │ │ ├── op_reverse_bones.hpp │ │ ├── op_reverse_meat.hpp │ │ ├── op_roots_bones.hpp │ │ ├── op_roots_meat.hpp │ │ ├── op_row_as_mat_bones.hpp │ │ ├── op_row_as_mat_meat.hpp │ │ ├── op_shift_bones.hpp │ │ ├── op_shift_meat.hpp │ │ ├── op_shuffle_bones.hpp │ │ ├── op_shuffle_meat.hpp │ │ ├── op_sort_bones.hpp │ │ ├── op_sort_index_bones.hpp │ │ ├── op_sort_index_meat.hpp │ │ ├── op_sort_meat.hpp │ │ ├── op_sp_as_dense_bones.hpp │ │ ├── op_sp_as_dense_meat.hpp │ │ ├── op_sp_diagvec_bones.hpp │ │ ├── op_sp_diagvec_meat.hpp │ │ ├── op_sp_max_bones.hpp │ │ ├── op_sp_max_meat.hpp │ │ ├── op_sp_mean_bones.hpp │ │ ├── op_sp_mean_meat.hpp │ │ ├── op_sp_min_bones.hpp │ │ ├── op_sp_min_meat.hpp │ │ ├── op_sp_minus_bones.hpp │ │ ├── op_sp_minus_meat.hpp │ │ ├── op_sp_nonzeros_bones.hpp │ │ ├── op_sp_nonzeros_meat.hpp │ │ ├── op_sp_plus_bones.hpp │ │ ├── op_sp_plus_meat.hpp │ │ ├── op_sp_stddev_bones.hpp │ │ ├── op_sp_stddev_meat.hpp │ │ ├── op_sp_sum_bones.hpp │ │ ├── op_sp_sum_meat.hpp │ │ ├── op_sp_var_bones.hpp │ │ ├── op_sp_var_meat.hpp │ │ ├── op_sp_vecnorm_bones.hpp │ │ ├── op_sp_vecnorm_meat.hpp │ │ ├── op_sqrtmat_bones.hpp │ │ ├── op_sqrtmat_meat.hpp │ │ ├── op_stddev_bones.hpp │ │ ├── op_stddev_meat.hpp │ │ ├── op_strans_bones.hpp │ │ ├── op_strans_meat.hpp │ │ ├── op_sum_bones.hpp │ │ ├── op_sum_meat.hpp │ │ ├── op_symmat_bones.hpp │ │ ├── op_symmat_meat.hpp │ │ ├── op_toeplitz_bones.hpp │ │ ├── op_toeplitz_meat.hpp │ │ ├── op_trimat_bones.hpp │ │ ├── op_trimat_meat.hpp │ │ ├── op_unique_bones.hpp │ │ ├── op_unique_meat.hpp │ │ ├── op_var_bones.hpp │ │ ├── op_var_meat.hpp │ │ ├── op_vecnorm_bones.hpp │ │ ├── op_vecnorm_meat.hpp │ │ ├── op_vectorise_bones.hpp │ │ ├── op_vectorise_meat.hpp │ │ ├── op_wishrnd_bones.hpp │ │ ├── op_wishrnd_meat.hpp │ │ ├── operator_cube_div.hpp │ │ ├── operator_cube_minus.hpp │ │ ├── operator_cube_plus.hpp │ │ ├── operator_cube_relational.hpp │ │ ├── operator_cube_schur.hpp │ │ ├── operator_cube_times.hpp │ │ ├── operator_div.hpp │ │ ├── operator_minus.hpp │ │ ├── operator_ostream.hpp │ │ ├── operator_plus.hpp │ │ ├── operator_relational.hpp │ │ ├── operator_schur.hpp │ │ ├── operator_times.hpp │ │ ├── podarray_bones.hpp │ │ ├── podarray_meat.hpp │ │ ├── promote_type.hpp │ │ ├── restrictors.hpp │ │ ├── running_stat_bones.hpp │ │ ├── running_stat_meat.hpp │ │ ├── running_stat_vec_bones.hpp │ │ ├── running_stat_vec_meat.hpp │ │ ├── sp_auxlib_bones.hpp │ │ ├── sp_auxlib_meat.hpp │ │ ├── span.hpp │ │ ├── spdiagview_bones.hpp │ │ ├── spdiagview_meat.hpp │ │ ├── spglue_join_bones.hpp │ │ ├── spglue_join_meat.hpp │ │ ├── spglue_kron_bones.hpp │ │ ├── spglue_kron_meat.hpp │ │ ├── spglue_max_bones.hpp │ │ ├── spglue_max_meat.hpp │ │ ├── spglue_merge_bones.hpp │ │ ├── spglue_merge_meat.hpp │ │ ├── spglue_min_bones.hpp │ │ ├── spglue_min_meat.hpp │ │ ├── spglue_minus_bones.hpp │ │ ├── spglue_minus_meat.hpp │ │ ├── spglue_plus_bones.hpp │ │ ├── spglue_plus_meat.hpp │ │ ├── spglue_relational_bones.hpp │ │ ├── spglue_relational_meat.hpp │ │ ├── spglue_schur_bones.hpp │ │ ├── spglue_schur_meat.hpp │ │ ├── spglue_times_bones.hpp │ │ ├── spglue_times_meat.hpp │ │ ├── spop_diagmat_bones.hpp │ │ ├── spop_diagmat_meat.hpp │ │ ├── spop_htrans_bones.hpp │ │ ├── spop_htrans_meat.hpp │ │ ├── spop_misc_bones.hpp │ │ ├── spop_misc_meat.hpp │ │ ├── spop_norm_bones.hpp │ │ ├── spop_norm_meat.hpp │ │ ├── spop_normalise_bones.hpp │ │ ├── spop_normalise_meat.hpp │ │ ├── spop_relational_bones.hpp │ │ ├── spop_relational_meat.hpp │ │ ├── spop_repmat_bones.hpp │ │ ├── spop_repmat_meat.hpp │ │ ├── spop_reverse_bones.hpp │ │ ├── spop_reverse_meat.hpp │ │ ├── spop_shift_bones.hpp │ │ ├── spop_shift_meat.hpp │ │ ├── spop_strans_bones.hpp │ │ ├── spop_strans_meat.hpp │ │ ├── spop_symmat_bones.hpp │ │ ├── spop_symmat_meat.hpp │ │ ├── spop_trimat_bones.hpp │ │ ├── spop_trimat_meat.hpp │ │ ├── spop_vectorise_bones.hpp │ │ ├── spop_vectorise_meat.hpp │ │ ├── spsolve_factoriser_bones.hpp │ │ ├── spsolve_factoriser_meat.hpp │ │ ├── strip.hpp │ │ ├── subview_bones.hpp │ │ ├── subview_cube_bones.hpp │ │ ├── subview_cube_each_bones.hpp │ │ ├── subview_cube_each_meat.hpp │ │ ├── subview_cube_meat.hpp │ │ ├── subview_cube_slices_bones.hpp │ │ ├── subview_cube_slices_meat.hpp │ │ ├── subview_each_bones.hpp │ │ ├── subview_each_meat.hpp │ │ ├── subview_elem1_bones.hpp │ │ ├── subview_elem1_meat.hpp │ │ ├── subview_elem2_bones.hpp │ │ ├── subview_elem2_meat.hpp │ │ ├── subview_field_bones.hpp │ │ ├── subview_field_meat.hpp │ │ ├── subview_meat.hpp │ │ ├── sym_helper.hpp │ │ ├── traits.hpp │ │ ├── translate_arpack.hpp │ │ ├── translate_atlas.hpp │ │ ├── translate_blas.hpp │ │ ├── translate_fftw3.hpp │ │ ├── translate_lapack.hpp │ │ ├── translate_superlu.hpp │ │ ├── trimat_helper.hpp │ │ ├── typedef_elem.hpp │ │ ├── typedef_elem_check.hpp │ │ ├── typedef_mat.hpp │ │ ├── typedef_mat_fixed.hpp │ │ ├── unwrap.hpp │ │ ├── unwrap_cube.hpp │ │ ├── unwrap_spmat.hpp │ │ ├── upgrade_val.hpp │ │ ├── wall_clock_bones.hpp │ │ ├── wall_clock_meat.hpp │ │ ├── xtrans_mat_bones.hpp │ │ ├── xtrans_mat_meat.hpp │ │ ├── xvec_htrans_bones.hpp │ │ └── xvec_htrans_meat.hpp ├── skeleton │ ├── Makevars │ ├── Makevars.win │ ├── rcpparma_hello_world.Rd │ └── rcpparma_hello_world.cpp └── tinytest │ ├── cpp │ ├── Rlapack.cpp │ ├── any_as_vec.cpp │ ├── armadillo.cpp │ ├── colrow_as_vec.cpp │ ├── complex.cpp │ ├── cube.cpp │ ├── fields.cpp │ ├── fields_new.cpp │ ├── rmultinom.cpp │ ├── rng.cpp │ ├── sample.cpp │ └── sparse.cpp │ ├── test_Rlapack.R │ ├── test_complex.R │ ├── test_cube.R │ ├── test_fastLm.R │ ├── test_fields.R │ ├── test_fields_new.R │ ├── test_misc.R │ ├── test_rcpparmadillo.R │ ├── test_rmultinom.R │ ├── test_rng.R │ ├── test_sample.R │ ├── test_scipy2r.R │ ├── test_sparse.R │ └── test_sparseConversion.R ├── local ├── RcppArmadillo-unitTests.Rnw ├── armafield.cpp └── rcpparma375.cpp ├── man ├── RcppArmadillo-package.Rd ├── RcppArmadillo.package.skeleton.Rd ├── armadillo_get_number_of_omp_threads.Rd ├── armadillo_set_seed.Rd ├── armadillo_set_seed_random.Rd ├── armadillo_throttle_cores.Rd ├── armadillo_version.Rd └── fastLm.Rd ├── src ├── Makevars.in ├── Makevars.win ├── RcppArmadillo.cpp ├── RcppExports.cpp └── fastLm.cpp ├── tests └── tinytest.R └── vignettes ├── RcppArmadillo-intro.Rnw ├── RcppArmadillo-sparseMatrix.Rnw ├── pdf ├── RcppArmadillo-intro.pdf └── RcppArmadillo-sparseMatrix.pdf └── rmd ├── Makefile ├── RcppArmadillo-intro.Rnw ├── RcppArmadillo-sparseMatrix.Rmd ├── RcppArmadillo.bib ├── elsarticle-harv.bst ├── elsarticle.cls └── kalmanExample.pdf /.Rbuildignore: -------------------------------------------------------------------------------- 1 | debian 2 | \.travis\.yml 3 | \.git 4 | src/lapack 5 | ^.*\.Rproj$ 6 | ^\.Rproj\.user$ 7 | ^.*\.tar\.gz$ 8 | ^local 9 | ^vignettes/rmd 10 | ^.editorconfig 11 | ^\.github 12 | ^\.codecov.yml 13 | ^\.covrignore 14 | ^GPATH 15 | ^GRTAGS 16 | ^GTAGS 17 | ^inst/include/armadillo_bits/config.hpp.cmake 18 | -------------------------------------------------------------------------------- /.aspell/RcppArmadillo.rds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RcppCore/RcppArmadillo/66dcdb5e878b391cd44a8c2854898abd002272ed/.aspell/RcppArmadillo.rds -------------------------------------------------------------------------------- /.aspell/defaults.R: -------------------------------------------------------------------------------- 1 | Rd_files <- vignettes <- R_files <- description <- 2 | list(encoding = "UTF-8", 3 | language = "en", 4 | dictionaries = c("en_stats", "RcppArmadillo")) 5 | -------------------------------------------------------------------------------- /.codecov.yml: -------------------------------------------------------------------------------- 1 | coverage: 2 | precision: 1 3 | 4 | status: 5 | project: 6 | default: 7 | target: 70% # the (on purpose low) required coverage value 8 | threshold: 2% # the permitted delta in hitting the target 9 | patch: 10 | default: 11 | target: 0% # the (on purpose low) required coverage value 12 | 13 | comment: false 14 | 15 | ignore: 16 | - "inst/include/armadillo" 17 | - "inst/include/armadillo_bits" 18 | -------------------------------------------------------------------------------- /.covrignore: -------------------------------------------------------------------------------- 1 | inst/include/armadillo_bits/* 2 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome: http://EditorConfig.org 2 | 3 | # top-most EditorConfig file 4 | root = true 5 | 6 | # Unix-style newlines with a newline ending every file 7 | [*] 8 | end_of_line = lf 9 | insert_final_newline = true 10 | trim_trailing_whitespace = true 11 | 12 | # Matches multiple files with brace expansion notation 13 | # 4 space indentation 14 | [*.{c,cpp,h,hpp,R,r}] 15 | indent_style = space 16 | indent_size = 4 17 | 18 | # Tab indentation (no size specified) 19 | [Makefile] 20 | indent_style = tab 21 | 22 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | DESCRIPTION merge=union 2 | ChangeLog merge=union 3 | inst/NEWS.Rd merge=union 4 | -------------------------------------------------------------------------------- /.github/workflows/ci.yaml: -------------------------------------------------------------------------------- 1 | # Run CI for R using https://eddelbuettel.github.io/r-ci/ 2 | 3 | name: ci 4 | 5 | on: 6 | push: 7 | pull_request: 8 | 9 | env: 10 | _R_CHECK_FORCE_SUGGESTS_: "false" 11 | 12 | jobs: 13 | ci: 14 | strategy: 15 | matrix: 16 | include: 17 | #- {os: macOS-latest} 18 | - {os: ubuntu-latest} 19 | 20 | runs-on: ${{ matrix.os }} 21 | 22 | steps: 23 | - name: Checkout 24 | uses: actions/checkout@v4 25 | 26 | - name: Setup 27 | uses: eddelbuettel/github-actions/r-ci@master 28 | 29 | - name: Dependencies 30 | run: ./run.sh install_deps 31 | 32 | - name: Test 33 | run: ./run.sh run_tests 34 | 35 | - name: Coverage 36 | if: ${{ matrix.os == 'ubuntu-latest' }} 37 | run: ./run.sh coverage 38 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .Rproj.user 2 | .Rhistory 3 | .RData 4 | inst/include/RcppArmadilloConfigGenerated.h 5 | src/Makevars 6 | src/*.o 7 | src/*.so 8 | src/*.dll 9 | *tar.gz 10 | local/* 11 | GPATH 12 | GRTAGS 13 | GTAGS 14 | inst/include/armadillo_bits/config.hpp.cmake 15 | -------------------------------------------------------------------------------- /NAMESPACE: -------------------------------------------------------------------------------- 1 | useDynLib("RcppArmadillo", .registration=TRUE) 2 | 3 | importFrom("Rcpp", "evalCpp", "sourceCpp") 4 | importFrom("stats", "coef", "fitted", "model.frame", "model.matrix", "model.response", "printCoefmat", "pt") 5 | importFrom("utils", "packageDescription", "package.skeleton") 6 | importFrom("methods", "new") 7 | 8 | export("fastLmPure", 9 | "fastLm", 10 | "RcppArmadillo.package.skeleton", 11 | "armadillo_version", 12 | "armadillo_set_seed", 13 | "armadillo_set_seed_random", 14 | 15 | "armadillo_throttle_cores", 16 | "armadillo_reset_cores", 17 | "armadillo_get_number_of_omp_threads", 18 | "armadillo_set_number_of_omp_threads" 19 | ) 20 | S3method("fastLm", "default") 21 | S3method("fastLm", "formula") 22 | S3method("predict", "fastLm") 23 | S3method("print", "fastLm") 24 | S3method("summary", "fastLm") 25 | S3method("print", "summary.fastLm") 26 | -------------------------------------------------------------------------------- /R/flags.R: -------------------------------------------------------------------------------- 1 | ## Copyright (C) 2010 Dirk Eddelbuettel, Romain Francois and Douglas Bates 2 | ## 3 | ## This file is part of RcppArmadillo. 4 | ## 5 | ## RcppArmadillo is free software: you can redistribute it and/or modify it 6 | ## under the terms of the GNU General Public License as published by 7 | ## the Free Software Foundation, either version 2 of the License, or 8 | ## (at your option) any later version. 9 | ## 10 | ## RcppArmadillo is distributed in the hope that it will be useful, but 11 | ## WITHOUT ANY WARRANTY; without even the implied warranty of 12 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | ## GNU General Public License for more details. 14 | ## 15 | ## You should have received a copy of the GNU General Public License 16 | ## along with RcppArmadillo. If not, see . 17 | 18 | RcppArmadilloCxxFlags <- function(){ 19 | paste( '-I"', system.file( "include", package = "RcppArmadillo" ), '"', sep = "" ) 20 | } 21 | 22 | CxxFlags <- function(){ 23 | cat( RcppArmadilloCxxFlags() ) 24 | } 25 | -------------------------------------------------------------------------------- /R/init.R: -------------------------------------------------------------------------------- 1 | ## init.R: Startup 2 | ## 3 | ## Copyright (C) 2023 Dirk Eddelbuettel 4 | ## 5 | ## This file is part of RcppArmadillo. 6 | ## 7 | ## RcppArmadillo is free software: you can redistribute it and/or modify it 8 | ## under the terms of the GNU General Public License as published by 9 | ## the Free Software Foundation, either version 2 of the License, or 10 | ## (at your option) any later version. 11 | ## 12 | ## RcppArmadillo is distributed in the hope that it will be useful, but 13 | ## WITHOUT ANY WARRANTY; without even the implied warranty of 14 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | ## GNU General Public License for more details. 16 | ## 17 | ## You should have received a copy of the GNU General Public License 18 | ## along with RcppArmadillo. If not, see . 19 | 20 | .pkgenv <- new.env(parent=emptyenv()) 21 | 22 | .onLoad <- function(libname, pkgname) { 23 | .pkgenv[["omp_threads"]] <- armadillo_get_number_of_omp_threads() # #nocov 24 | } 25 | 26 | ##' Throttle (or Reset) (Rcpp)Armadillo to Two Cores 27 | ##' 28 | ##' Helper functions to throttle use of cores by RcppArmadillo-internal 29 | ##' code on systems with OpenMP. On package load, the initial value is 30 | ##' saved and used to reset the value. 31 | ##' @param n Integer value of desired cores, default is two 32 | armadillo_throttle_cores <- function(n = 2) { 33 | armadillo_set_number_of_omp_threads(n) 34 | } 35 | 36 | ##' @rdname armadillo_throttle_cores 37 | armadillo_reset_cores <- function() { 38 | n <- .pkgenv[["omp_threads"]] 39 | armadillo_set_number_of_omp_threads(n) 40 | } 41 | -------------------------------------------------------------------------------- /R/inline.R: -------------------------------------------------------------------------------- 1 | ## Copyright (C) 2010 - 2024 Dirk Eddelbuettel, Romain Francois and Douglas Bates 2 | ## 3 | ## This file is part of RcppArmadillo. 4 | ## 5 | ## RcppArmadillo is free software: you can redistribute it and/or modify it 6 | ## under the terms of the GNU General Public License as published by 7 | ## the Free Software Foundation, either version 2 of the License, or 8 | ## (at your option) any later version. 9 | ## 10 | ## RcppArmadillo is distributed in the hope that it will be useful, but 11 | ## WITHOUT ANY WARRANTY; without even the implied warranty of 12 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | ## GNU General Public License for more details. 14 | ## 15 | ## You should have received a copy of the GNU General Public License 16 | ## along with RcppArmadillo. If not, see . 17 | 18 | inlineCxxPlugin <- function(...) { 19 | ismacos <- Sys.info()[["sysname"]] == "Darwin" 20 | openmpflag <- if (ismacos) "" else "$(SHLIB_OPENMP_CFLAGS)" 21 | plugin <- Rcpp::Rcpp.plugin.maker(include.before = "#include ", 22 | libs = paste(openmpflag, "$(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)"), 23 | package = "RcppArmadillo") 24 | settings <- plugin() 25 | settings$env$PKG_CPPFLAGS <- paste("-I../inst/include", openmpflag) 26 | settings 27 | } 28 | -------------------------------------------------------------------------------- /cleanup: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | rm -f config.log config.status confdefs.h \ 4 | src/*.o src/*.so src/symbols.rds \ 5 | vignettes/RcppArmadillo-unitTests.out \ 6 | vignettes/RcppArmadillo-unitTests.aux \ 7 | vignettes/RcppArmadillo-unitTests.log \ 8 | vignettes/RcppArmadillo-intro.out \ 9 | vignettes/RcppArmadillo*.log \ 10 | vignettes/RcppArmadillo*.aux \ 11 | vignettes/RcppArmadillo*.out \ 12 | vignettes/RcppArmadillo*.tex \ 13 | vignettes/RcppArmadillo-*.pdf \ 14 | vignettes/*.blg \ 15 | vignettes/*.bbl \ 16 | vignettes/*.xwm \ 17 | vignettes/*~ \ 18 | */*~ *~ \ 19 | inst/include/RcppArmadilloLapack.h \ 20 | inst/include/RcppArmadillo/config/RcppArmadilloConfigGenerated.h \ 21 | src/Makevars \ 22 | vignettes/jss.bst vignettes/pinp.cls 23 | 24 | rm -rf autom4te.cache/ \ 25 | vignettes/auto/ 26 | -------------------------------------------------------------------------------- /inst/AUTHORS: -------------------------------------------------------------------------------- 1 | 2 | Armadillo itself carries the following in file NOTICE.TXT: 3 | 4 | Armadillo C++ Linear Algebra Library 5 | Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 6 | Copyright 2008-2016 National ICT Australia (NICTA) 7 | 8 | This product includes software developed by Conrad Sanderson (http://conradsanderson.id.au) 9 | This product includes software developed at National ICT Australia (NICTA) 10 | 11 | 12 | The RcppArmadillo package integrates Armadillo into R, provides wrappers, 13 | converters, a test framework, examples and more. It was written by Dirk 14 | Eddelbuettel, Romain Francois and Doug Bates with contributions by many 15 | others as detailed in the ChangeLog file. 16 | -------------------------------------------------------------------------------- /inst/CITATION: -------------------------------------------------------------------------------- 1 | bibentry("Article", 2 | title = "RcppArmadillo: Accelerating R with high-performance C++ linear algebra", 3 | author = c(person("Dirk", "Eddelbuettel", 4 | email = "edd@debian.org", 5 | comment = c(ORCID = "0000-0001-6419-907X")), 6 | person("Conrad", "Sanderson", 7 | comment = c(ORCID = "0000-0002-0049-4501"))), 8 | journal = "Computational Statistics and Data Analysis", 9 | year = "2014", 10 | volume = "71", 11 | month = "March", 12 | pages = "1054--1063", 13 | doi = "10.1016/j.csda.2013.02.005" 14 | ) 15 | 16 | bibentry("Manual", 17 | other = unlist(citation(auto = meta), recursive = FALSE)) 18 | -------------------------------------------------------------------------------- /inst/COPYRIGHTS: -------------------------------------------------------------------------------- 1 | 2 | Overall license: 3 | ================ 4 | 5 | The (vast) majority of the files in this package are released under the 6 | Apache License, Version 2.0, January 2004 (http://www.apache.org/licenses/) 7 | 8 | The aggregation, integration and packaging work is released under the 9 | GNU GPL (>= 2). 10 | 11 | Details: 12 | ======== 13 | 14 | Files: * 15 | Copyright: 2010 - 2017 Dirk Eddelbuettel, Romain Francois and Doug Bates 16 | License: GPL (>= 2) 17 | 18 | Files: inst/include/armadillo: 19 | inst/include/armadillo_bits/*: 20 | Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 21 | Copyright 2008-2016 National ICT Australia (NICTA) 22 | License: Apache-2.0 23 | -------------------------------------------------------------------------------- /inst/examples/kalman/FirstKalmanR.R: -------------------------------------------------------------------------------- 1 | FirstKalmanR <- function(pos) { 2 | 3 | kalmanfilter <- function(z) { 4 | dt <- 1 5 | A <- matrix(c( 1, 0, dt, 0, 0, 0, 0, 1, 0, dt, 0, 0, # x, y 6 | 0, 0, 1, 0, dt, 0, 0, 0, 0, 1, 0, dt, # Vx, Vy 7 | 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1), # Ax, Ay 8 | 6, 6, byrow=TRUE) 9 | H <- matrix( c(1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0), 10 | 2, 6, byrow=TRUE) 11 | Q <- diag(6) 12 | R <- 1000 * diag(2) 13 | 14 | xprd <- A %*% xest # predicted state and covriance 15 | pprd <- A %*% pest %*% t(A) + Q 16 | 17 | S <- H %*% t(pprd) %*% t(H) + R # estimation 18 | B <- H %*% t(pprd) 19 | kalmangain <- t(solve(S, B)) 20 | 21 | ## estimated state and covariance, assign to vars in parent env 22 | xest <<- xprd + kalmangain %*% (z - H %*% xprd) 23 | pest <<- pprd - kalmangain %*% H %*% pprd 24 | 25 | ## compute the estimated measurements 26 | y <- H %*% xest 27 | } 28 | xest <- matrix(0, 6, 1) 29 | pest <- matrix(0, 6, 6) 30 | 31 | N <- nrow(pos) 32 | y <- matrix(NA, N, 2) 33 | for (i in 1:N) { 34 | y[i,] <- kalmanfilter(t(pos[i,,drop=FALSE])) 35 | } 36 | invisible(y) 37 | } 38 | -------------------------------------------------------------------------------- /inst/examples/kalman/Kalman.cpp: -------------------------------------------------------------------------------- 1 | 2 | // [[Rcpp::depends(RcppArmadillo)]] 3 | 4 | #include 5 | 6 | using namespace arma; 7 | 8 | class Kalman { 9 | private: 10 | mat A, H, Q, R, xest, pest; 11 | double dt; 12 | 13 | public: 14 | // constructor, sets up data structures 15 | Kalman() : dt(1.0) { 16 | A.eye(6,6); 17 | A(0,2) = A(1,3) = A(2,4) = A(3,5) = dt; 18 | H.zeros(2,6); 19 | H(0,0) = H(1,1) = 1.0; 20 | Q.eye(6,6); 21 | R = 1000 * eye(2,2); 22 | xest.zeros(6,1); 23 | pest.zeros(6,6); 24 | } 25 | 26 | // sole member function: estimate model 27 | mat estimate(const mat & Z) { 28 | unsigned int n = Z.n_rows, k = Z.n_cols; 29 | mat Y = zeros(n, k); 30 | mat xprd, pprd, S, B, kalmangain; 31 | colvec z, y; 32 | 33 | for (unsigned int i = 0; i. 20 | 21 | #ifndef RcppArmadillo__RcppArmadillo__h 22 | #define RcppArmadillo__RcppArmadillo__h 23 | 24 | #if defined(Rcpp_hpp) && !defined(COMPILING_RCPPARMADILLO) 25 | #error "The file 'Rcpp.h' should not be included. Please correct to include only 'RcppArmadillo.h'." 26 | #endif 27 | 28 | // Set up actual #include after first #include and more config 29 | #include 30 | 31 | // Now automatically include Rcpp as well 32 | #include 33 | 34 | // Remaining RcppArmadillo code 35 | #include 36 | #include 37 | #include 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /inst/include/RcppArmadillo/Alt_R_RNG.h: -------------------------------------------------------------------------------- 1 | 2 | // This file support the legacy location and includes from the new location 3 | 4 | #include "RcppArmadillo/rng/Alt_R_RNG.h" 5 | -------------------------------------------------------------------------------- /inst/include/RcppArmadillo/config/RcppArmadilloConfigGenerated.h.in: -------------------------------------------------------------------------------- 1 | 2 | // RcppArmadilloGenerated.h: Autoconf-updated file for LAPACK and OpenMP choices 3 | // 4 | // Copyright (C) 2013 - 2021 Dirk Eddelbuettel 5 | // 6 | // This file is part of RcppArmadillo. 7 | // 8 | // RcppArmadillo is free software: you can redistribute it and/or modify it 9 | // under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation, either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // RcppArmadillo is distributed in the hope that it will be useful, but 14 | // WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with RcppArmadillo. If not, see . 20 | 21 | #ifndef RcppArmadillo__RcppArmadilloConfigGenerated__h 22 | #define RcppArmadillo__RcppArmadilloConfigGenerated__h 23 | 24 | #ifndef ARMA_CRIPPLED_LAPACK 25 | // value on next line may be changed between #undef and #define by the configure script 26 | @ARMA_LAPACK@ 27 | #endif 28 | 29 | #ifndef ARMA_USE_OPENMP 30 | // from configure test for OpenMP based on how R is configured, and whether g++ new enough 31 | @ARMA_HAVE_OPENMP@ 32 | #endif 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /inst/include/RcppArmadillo/internal/Col_meat.h: -------------------------------------------------------------------------------- 1 | // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- 2 | /* :tabSize=4:indentSize=4:noTabs=false:folding=explicit:collapseFolds=1: */ 3 | // 4 | // Col_meat.h: Rcpp/Armadillo glue 5 | // 6 | // Copyright (C) 2011 - 2013 Dirk Eddelbuettel, Romain Francois and Douglas Bates 7 | // 8 | // This file is part of RcppArmadillo. 9 | // 10 | // RcppArmadillo is free software: you can redistribute it and/or modify it 11 | // under the terms of the GNU General Public License as published by 12 | // the Free Software Foundation, either version 2 of the License, or 13 | // (at your option) any later version. 14 | // 15 | // RcppArmadillo is distributed in the hope that it will be useful, but 16 | // WITHOUT ANY WARRANTY; without even the implied warranty of 17 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | // GNU General Public License for more details. 19 | // 20 | // You should have received a copy of the GNU General Public License 21 | // along with RcppArmadillo. If not, see . 22 | 23 | #ifndef RCPPARMADILLO_COL_MEAT_H 24 | #define RCPPARMADILLO_COL_MEAT_H 25 | 26 | template 27 | template 28 | inline Col::Col( const Rcpp::VectorBase& X ) 29 | : Mat( X ) 30 | { 31 | arma_extra_debug_sigprint(this); 32 | access::rw(Mat::vec_state) = 1; 33 | } 34 | 35 | template 36 | template 37 | inline Col::Col( const Rcpp::MatrixBase& X ) 38 | : Mat( X ) 39 | { 40 | arma_extra_debug_sigprint(this); 41 | 42 | arma_debug_check( (Mat::n_cols > 1), "Col(): incompatible dimensions" ); 43 | 44 | access::rw(Mat::vec_state) = 1; 45 | } 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /inst/include/RcppArmadillo/internal/Col_proto.h: -------------------------------------------------------------------------------- 1 | // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- 2 | /* :tabSize=4:indentSize=4:noTabs=false:folding=explicit:collapseFolds=1: */ 3 | // 4 | // Col_proto.h: Rcpp/Armadillo glue 5 | // 6 | // Copyright (C) 2010 - 2013 Dirk Eddelbuettel, Romain Francois and Douglas Bates 7 | // 8 | // This file is part of RcppArmadillo. 9 | // 10 | // RcppArmadillo is free software: you can redistribute it and/or modify it 11 | // under the terms of the GNU General Public License as published by 12 | // the Free Software Foundation, either version 2 of the License, or 13 | // (at your option) any later version. 14 | // 15 | // RcppArmadillo is distributed in the hope that it will be useful, but 16 | // WITHOUT ANY WARRANTY; without even the implied warranty of 17 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | // GNU General Public License for more details. 19 | // 20 | // You should have received a copy of the GNU General Public License 21 | // along with RcppArmadillo. If not, see . 22 | 23 | 24 | #ifndef RCPPARMADILLO_COL_PROTO_H 25 | #define RCPPARMADILLO_COL_PROTO_H 26 | 27 | template 28 | inline Col( const Rcpp::VectorBase& X ) ; 29 | 30 | template 31 | inline Col( const Rcpp::MatrixBase& X ) ; 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /inst/include/RcppArmadillo/internal/Mat_proto.h: -------------------------------------------------------------------------------- 1 | // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- 2 | /* :tabSize=4:indentSize=4:noTabs=false:folding=explicit:collapseFolds=1: */ 3 | // 4 | // Mat_proto.h: Rcpp/Armadillo glue 5 | // 6 | // Copyright (C) 2010 - 2013 Dirk Eddelbuettel, Romain Francois and Douglas Bates 7 | // 8 | // This file is part of RcppArmadillo. 9 | // 10 | // RcppArmadillo is free software: you can redistribute it and/or modify it 11 | // under the terms of the GNU General Public License as published by 12 | // the Free Software Foundation, either version 2 of the License, or 13 | // (at your option) any later version. 14 | // 15 | // RcppArmadillo is distributed in the hope that it will be useful, but 16 | // WITHOUT ANY WARRANTY; without even the implied warranty of 17 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | // GNU General Public License for more details. 19 | // 20 | // You should have received a copy of the GNU General Public License 21 | // along with RcppArmadillo. If not, see . 22 | 23 | 24 | #ifndef RCPPARMADILLO_MAT_PROTO_H 25 | #define RCPPARMADILLO_MAT_PROTO_H 26 | 27 | template 28 | inline Mat( const Rcpp::VectorBase& X ) ; 29 | 30 | template 31 | inline Mat( const Rcpp::MatrixBase& X ) ; 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /inst/include/RcppArmadillo/internal/Row_meat.h: -------------------------------------------------------------------------------- 1 | // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- 2 | /* :tabSize=4:indentSize=4:noTabs=false:folding=explicit:collapseFolds=1: */ 3 | // 4 | // Row_meat.h: Rcpp/Armadillo glue 5 | // 6 | // Copyright (C) 2011 - 2013 Dirk Eddelbuettel, Romain Francois and Douglas Bates 7 | // 8 | // This file is part of RcppArmadillo. 9 | // 10 | // RcppArmadillo is free software: you can redistribute it and/or modify it 11 | // under the terms of the GNU General Public License as published by 12 | // the Free Software Foundation, either version 2 of the License, or 13 | // (at your option) any later version. 14 | // 15 | // RcppArmadillo is distributed in the hope that it will be useful, but 16 | // WITHOUT ANY WARRANTY; without even the implied warranty of 17 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | // GNU General Public License for more details. 19 | // 20 | // You should have received a copy of the GNU General Public License 21 | // along with RcppArmadillo. If not, see . 22 | 23 | #ifndef RCPPARMADILLO_ROW_MEAT_H 24 | #define RCPPARMADILLO_ROW_MEAT_H 25 | 26 | template 27 | template 28 | inline Row::Row( const Rcpp::VectorBase& X ) 29 | : Mat( X ) { 30 | arma_extra_debug_sigprint(this); 31 | std::swap( access::rw(Mat::n_rows), access::rw(Mat::n_cols) ); 32 | access::rw(Mat::vec_state) = 2; 33 | } 34 | 35 | template 36 | template 37 | inline Row::Row( const Rcpp::MatrixBase& X ) 38 | : Mat( X ) { 39 | 40 | arma_extra_debug_sigprint(this); 41 | 42 | arma_debug_check( (Mat::n_rows > 1), "Row(): incompatible dimensions" ); 43 | 44 | access::rw(Mat::vec_state) = 2; 45 | } 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /inst/include/RcppArmadillo/internal/Row_proto.h: -------------------------------------------------------------------------------- 1 | // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- 2 | /* :tabSize=4:indentSize=4:noTabs=false:folding=explicit:collapseFolds=1: */ 3 | // 4 | // Row_proto.h: Rcpp/Armadillo glue 5 | // 6 | // Copyright (C) 2010 - 2013 Dirk Eddelbuettel, Romain Francois and Douglas Bates 7 | // 8 | // This file is part of RcppArmadillo. 9 | // 10 | // RcppArmadillo is free software: you can redistribute it and/or modify it 11 | // under the terms of the GNU General Public License as published by 12 | // the Free Software Foundation, either version 2 of the License, or 13 | // (at your option) any later version. 14 | // 15 | // RcppArmadillo is distributed in the hope that it will be useful, but 16 | // WITHOUT ANY WARRANTY; without even the implied warranty of 17 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | // GNU General Public License for more details. 19 | // 20 | // You should have received a copy of the GNU General Public License 21 | // along with RcppArmadillo. If not, see . 22 | 23 | 24 | #ifndef RCPPARMADILLO_ROW_PROTO_H 25 | #define RCPPARMADILLO_ROW_PROTO_H 26 | 27 | template 28 | inline Row( const Rcpp::VectorBase& X ) ; 29 | 30 | template 31 | inline Row( const Rcpp::MatrixBase& X ) ; 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/CubeToMatOp_meat.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup CubeToMatOp 20 | //! @{ 21 | 22 | 23 | 24 | template 25 | inline 26 | CubeToMatOp::CubeToMatOp(const T1& in_m) 27 | : m(in_m) 28 | { 29 | arma_debug_sigprint(); 30 | } 31 | 32 | 33 | 34 | template 35 | inline 36 | CubeToMatOp::CubeToMatOp(const T1& in_m, const uword in_aux_uword) 37 | : m(in_m) 38 | , aux_uword(in_aux_uword) 39 | { 40 | arma_debug_sigprint(); 41 | } 42 | 43 | 44 | 45 | template 46 | inline 47 | CubeToMatOp::~CubeToMatOp() 48 | { 49 | arma_debug_sigprint(); 50 | } 51 | 52 | 53 | 54 | //! @} 55 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/GlueCube_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup GlueCube 20 | //! @{ 21 | 22 | 23 | 24 | //! analog of the Glue class, intended for Cube objects 25 | template 26 | class GlueCube : public BaseCube< typename T1::elem_type, GlueCube > 27 | { 28 | public: 29 | 30 | typedef typename T1::elem_type elem_type; 31 | typedef typename get_pod_type::result pod_type; 32 | 33 | inline GlueCube(const BaseCube& in_A, const BaseCube& in_B); 34 | inline ~GlueCube(); 35 | 36 | const T1& A; //!< first operand; must be derived from BaseCube 37 | const T2& B; //!< second operand; must be derived from BaseCube 38 | }; 39 | 40 | 41 | 42 | //! @} 43 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/GlueCube_meat.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup GlueCube 20 | //! @{ 21 | 22 | 23 | 24 | template 25 | inline 26 | GlueCube::GlueCube(const BaseCube& in_A, const BaseCube& in_B) 27 | : A(in_A.get_ref()) 28 | , B(in_B.get_ref()) 29 | { 30 | arma_debug_sigprint(); 31 | } 32 | 33 | 34 | 35 | template 36 | inline 37 | GlueCube::~GlueCube() 38 | { 39 | arma_debug_sigprint(); 40 | } 41 | 42 | 43 | 44 | //! @} 45 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/SizeCube_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup SizeCube 20 | //! @{ 21 | 22 | 23 | 24 | class SizeCube 25 | { 26 | public: 27 | 28 | const uword n_rows; 29 | const uword n_cols; 30 | const uword n_slices; 31 | 32 | inline explicit SizeCube(const uword in_n_rows, const uword in_n_cols, const uword in_n_slices); 33 | 34 | inline uword operator[](const uword dim) const; 35 | inline uword operator()(const uword dim) const; 36 | 37 | inline bool operator==(const SizeCube& s) const; 38 | inline bool operator!=(const SizeCube& s) const; 39 | 40 | inline SizeCube operator+(const SizeCube& s) const; 41 | inline SizeCube operator-(const SizeCube& s) const; 42 | 43 | inline SizeCube operator+(const uword val) const; 44 | inline SizeCube operator-(const uword val) const; 45 | 46 | inline SizeCube operator*(const uword val) const; 47 | inline SizeCube operator/(const uword val) const; 48 | }; 49 | 50 | 51 | 52 | //! @} 53 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/SizeMat_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup SizeMat 20 | //! @{ 21 | 22 | 23 | 24 | class SizeMat 25 | { 26 | public: 27 | 28 | const uword n_rows; 29 | const uword n_cols; 30 | 31 | inline explicit SizeMat(const uword in_n_rows, const uword in_n_cols); 32 | 33 | inline uword operator[](const uword dim) const; 34 | inline uword operator()(const uword dim) const; 35 | 36 | inline bool operator==(const SizeMat& s) const; 37 | inline bool operator!=(const SizeMat& s) const; 38 | 39 | inline SizeMat operator+(const SizeMat& s) const; 40 | inline SizeMat operator-(const SizeMat& s) const; 41 | 42 | inline SizeMat operator+(const uword val) const; 43 | inline SizeMat operator-(const uword val) const; 44 | 45 | inline SizeMat operator*(const uword val) const; 46 | inline SizeMat operator/(const uword val) const; 47 | }; 48 | 49 | 50 | 51 | //! @} 52 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/SpToDGlue_meat.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup SpToDGlue 20 | //! @{ 21 | 22 | 23 | 24 | template 25 | inline 26 | SpToDGlue::SpToDGlue(const T1& in_A, const T2& in_B) 27 | : A(in_A) 28 | , B(in_B) 29 | { 30 | arma_debug_sigprint(); 31 | } 32 | 33 | 34 | 35 | template 36 | inline 37 | SpToDGlue::~SpToDGlue() 38 | { 39 | arma_debug_sigprint(); 40 | } 41 | 42 | 43 | 44 | //! @} 45 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/SpToDOp_meat.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup SpToDOp 20 | //! @{ 21 | 22 | 23 | 24 | template 25 | inline 26 | SpToDOp::SpToDOp(const T1& in_m) 27 | : m(in_m) 28 | { 29 | arma_debug_sigprint(); 30 | } 31 | 32 | 33 | 34 | template 35 | inline 36 | SpToDOp::SpToDOp(const T1& in_m, const typename T1::elem_type in_aux) 37 | : m(in_m) 38 | , aux(in_aux) 39 | { 40 | arma_debug_sigprint(); 41 | } 42 | 43 | 44 | 45 | template 46 | inline 47 | SpToDOp::SpToDOp(const T1& in_m, const uword in_aux_uword_a, const uword in_aux_uword_b) 48 | : m(in_m) 49 | , aux_uword_a(in_aux_uword_a) 50 | , aux_uword_b(in_aux_uword_b) 51 | { 52 | arma_debug_sigprint(); 53 | } 54 | 55 | 56 | 57 | template 58 | inline 59 | SpToDOp::~SpToDOp() 60 | { 61 | arma_debug_sigprint(); 62 | } 63 | 64 | 65 | 66 | //! @} 67 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/arma_static_check.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup arma_static_check 20 | //! @{ 21 | 22 | 23 | #undef arma_static_check 24 | #define arma_static_check(condition, message) static_assert( !(condition), message ) 25 | 26 | #undef arma_type_check 27 | #define arma_type_check(condition) static_assert( !(condition), "error: type mismatch or unsupported type" ) 28 | 29 | 30 | //! @} 31 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/arma_version.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup arma_version 20 | //! @{ 21 | 22 | 23 | 24 | #define ARMA_VERSION_MAJOR 14 25 | #define ARMA_VERSION_MINOR 4 26 | #define ARMA_VERSION_PATCH 3 27 | #define ARMA_VERSION_NAME "Filtered Espresso" 28 | 29 | 30 | 31 | struct arma_version 32 | { 33 | static constexpr unsigned int major = ARMA_VERSION_MAJOR; 34 | static constexpr unsigned int minor = ARMA_VERSION_MINOR; 35 | static constexpr unsigned int patch = ARMA_VERSION_PATCH; 36 | 37 | static 38 | inline 39 | std::string 40 | as_string() 41 | { 42 | const char* nickname = ARMA_VERSION_NAME; 43 | 44 | std::ostringstream ss; 45 | 46 | ss << arma_version::major 47 | << '.' 48 | << arma_version::minor 49 | << '.' 50 | << arma_version::patch 51 | << " (" 52 | << nickname 53 | << ')'; 54 | 55 | return ss.str(); 56 | } 57 | }; 58 | 59 | 60 | 61 | //! @} 62 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/compiler_setup_post.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | 20 | #if defined(_MSC_VER) 21 | 22 | #pragma warning(pop) 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/cond_rel_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup cond_rel 20 | //! @{ 21 | 22 | 23 | // 24 | // for preventing pedantic compiler warnings 25 | 26 | template 27 | class cond_rel 28 | { 29 | public: 30 | 31 | template arma_inline static bool lt(const eT A, const eT B); 32 | template arma_inline static bool gt(const eT A, const eT B); 33 | 34 | template arma_inline static bool leq(const eT A, const eT B); 35 | template arma_inline static bool geq(const eT A, const eT B); 36 | 37 | template arma_inline static eT make_neg(const eT val); 38 | }; 39 | 40 | 41 | 42 | //! @} 43 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/def_fftw3.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | #if defined(ARMA_USE_FFTW3) && !defined(FFTW3_H) 20 | 21 | 22 | // prefix for single precision: fftwf_ 23 | // prefix for double precision: fftw_ 24 | 25 | 26 | typedef void fftwf_complex; 27 | typedef void fftw_complex; 28 | 29 | typedef void_ptr fftwf_plan; 30 | typedef void_ptr fftw_plan; 31 | 32 | 33 | extern "C" 34 | { 35 | // single precision (float) 36 | 37 | fftwf_plan fftwf_plan_dft_1d(int N, fftwf_complex* input, fftwf_complex* output, int fftw3_sign, unsigned int fftw3_flags); 38 | 39 | void fftwf_execute(fftwf_plan plan); 40 | void fftwf_destroy_plan(fftwf_plan plan); 41 | 42 | void fftwf_cleanup(); 43 | 44 | 45 | // double precision (double) 46 | 47 | fftw_plan fftw_plan_dft_1d(int N, fftw_complex* input, fftw_complex* output, int fftw3_sign, unsigned int fftw3_flags); 48 | 49 | void fftw_execute(fftw_plan plan); 50 | void fftw_destroy_plan(fftw_plan plan); 51 | 52 | void fftw_cleanup(); 53 | } 54 | 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/fn_cor.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup fn_cor 20 | //! @{ 21 | 22 | 23 | 24 | template 25 | arma_warn_unused 26 | inline 27 | const Op 28 | cor(const Base& X, const uword norm_type = 0) 29 | { 30 | arma_debug_sigprint(); 31 | 32 | arma_conform_check( (norm_type > 1), "cor(): parameter 'norm_type' must be 0 or 1" ); 33 | 34 | return Op(X.get_ref(), norm_type, 0); 35 | } 36 | 37 | 38 | 39 | template 40 | arma_warn_unused 41 | inline 42 | const Glue 43 | cor(const Base& A, const Base& B, const uword norm_type = 0) 44 | { 45 | arma_debug_sigprint(); 46 | 47 | arma_conform_check( (norm_type > 1), "cor(): parameter 'norm_type' must be 0 or 1" ); 48 | 49 | return Glue(A.get_ref(), B.get_ref(), norm_type); 50 | } 51 | 52 | 53 | 54 | //! @} 55 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/fn_cov.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup fn_cov 20 | //! @{ 21 | 22 | 23 | 24 | template 25 | arma_warn_unused 26 | inline 27 | const Op 28 | cov(const Base& X, const uword norm_type = 0) 29 | { 30 | arma_debug_sigprint(); 31 | 32 | arma_conform_check( (norm_type > 1), "cov(): parameter 'norm_type' must be 0 or 1" ); 33 | 34 | return Op(X.get_ref(), norm_type, 0); 35 | } 36 | 37 | 38 | 39 | template 40 | arma_warn_unused 41 | inline 42 | const Glue 43 | cov(const Base& A, const Base& B, const uword norm_type = 0) 44 | { 45 | arma_debug_sigprint(); 46 | 47 | arma_conform_check( (norm_type > 1), "cov(): parameter 'norm_type' must be 0 or 1" ); 48 | 49 | return Glue(A.get_ref(), B.get_ref(), norm_type); 50 | } 51 | 52 | 53 | 54 | //! @} 55 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/fn_cross.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup fn_cross 20 | //! @{ 21 | 22 | 23 | 24 | //! cross product (only valid for 3 dimensional vectors) 25 | template 26 | arma_warn_unused 27 | inline 28 | typename 29 | enable_if2 30 | < 31 | is_arma_type::value && is_arma_type::value && is_same_type::value, 32 | const Glue 33 | >::result 34 | cross(const T1& X, const T2& Y) 35 | { 36 | arma_debug_sigprint(); 37 | 38 | return Glue(X, Y); 39 | } 40 | 41 | 42 | 43 | //! @} 44 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/fn_kmeans.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup fn_kmeans 20 | //! @{ 21 | 22 | 23 | 24 | template 25 | inline 26 | typename enable_if2::value, bool>::result 27 | kmeans 28 | ( 29 | Mat& means, 30 | const Base& data, 31 | const uword k, 32 | const gmm_seed_mode& seed_mode, 33 | const uword n_iter, 34 | const bool print_mode 35 | ) 36 | { 37 | arma_debug_sigprint(); 38 | 39 | typedef typename T1::elem_type eT; 40 | 41 | gmm_priv::gmm_diag model; 42 | 43 | const bool status = model.kmeans_wrapper(means, data.get_ref(), k, seed_mode, n_iter, print_mode); 44 | 45 | if(status) 46 | { 47 | means = model.means; 48 | } 49 | else 50 | { 51 | means.soft_reset(); 52 | } 53 | 54 | return status; 55 | } 56 | 57 | 58 | 59 | //! @} 60 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/fn_nonzeros.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup fn_nonzeros 20 | //! @{ 21 | 22 | 23 | template 24 | arma_warn_unused 25 | inline 26 | const Op 27 | nonzeros(const Base& X) 28 | { 29 | arma_debug_sigprint(); 30 | 31 | return Op(X.get_ref()); 32 | } 33 | 34 | 35 | 36 | template 37 | arma_warn_unused 38 | inline 39 | const SpToDOp 40 | nonzeros(const SpBase& X) 41 | { 42 | arma_debug_sigprint(); 43 | 44 | return SpToDOp(X.get_ref()); 45 | } 46 | 47 | 48 | 49 | //! @} 50 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/fn_polyval.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup fn_polyval 20 | //! @{ 21 | 22 | 23 | 24 | template 25 | arma_warn_unused 26 | inline 27 | typename 28 | enable_if2 29 | < 30 | (is_supported_blas_type::value && is_arma_type::value && is_same_type::value), 31 | const Glue 32 | >::result 33 | polyval(const Base& P, const T2& X) 34 | { 35 | arma_debug_sigprint(); 36 | 37 | return Glue(P.get_ref(), X); 38 | } 39 | 40 | 41 | 42 | //! @} 43 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/fn_range.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup fn_range 20 | //! @{ 21 | 22 | 23 | template 24 | arma_warn_unused 25 | inline 26 | typename enable_if2< is_arma_type::value && resolves_to_vector::yes, typename T1::elem_type >::result 27 | range(const T1& X) 28 | { 29 | arma_debug_sigprint(); 30 | 31 | return op_range::vector_range(X); 32 | } 33 | 34 | 35 | 36 | template 37 | arma_warn_unused 38 | arma_inline 39 | typename enable_if2< is_arma_type::value && resolves_to_vector::no, const Op >::result 40 | range(const T1& X) 41 | { 42 | arma_debug_sigprint(); 43 | 44 | return Op(X, 0, 0); 45 | } 46 | 47 | 48 | 49 | template 50 | arma_warn_unused 51 | arma_inline 52 | typename enable_if2< is_arma_type::value, const Op >::result 53 | range(const T1& X, const uword dim) 54 | { 55 | arma_debug_sigprint(); 56 | 57 | return Op(X, dim, 0); 58 | } 59 | 60 | 61 | 62 | //! @} 63 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/fn_repelem.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | 20 | //! \addtogroup fn_repelem 21 | //! @{ 22 | 23 | 24 | template 25 | arma_warn_unused 26 | arma_inline 27 | typename 28 | enable_if2 29 | < 30 | is_arma_type::value, 31 | const Op 32 | >::result 33 | repelem(const T1& A, const uword r, const uword c) 34 | { 35 | arma_debug_sigprint(); 36 | 37 | return Op(A, r, c); 38 | } 39 | 40 | 41 | 42 | template 43 | arma_warn_unused 44 | arma_inline 45 | const SpOp 46 | repelem(const SpBase& A, const uword r, const uword c) 47 | { 48 | arma_debug_sigprint(); 49 | 50 | return SpOp(A.get_ref(), r, c); 51 | } 52 | 53 | 54 | 55 | //! @} 56 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/fn_repmat.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | 20 | //! \addtogroup fn_repmat 21 | //! @{ 22 | 23 | 24 | template 25 | arma_warn_unused 26 | arma_inline 27 | typename 28 | enable_if2 29 | < 30 | is_arma_type::value, 31 | const Op 32 | >::result 33 | repmat(const T1& A, const uword r, const uword c) 34 | { 35 | arma_debug_sigprint(); 36 | 37 | return Op(A, r, c); 38 | } 39 | 40 | 41 | 42 | template 43 | arma_warn_unused 44 | arma_inline 45 | const SpOp 46 | repmat(const SpBase& A, const uword r, const uword c) 47 | { 48 | arma_debug_sigprint(); 49 | 50 | return SpOp(A.get_ref(), r, c); 51 | } 52 | 53 | 54 | 55 | //! @} 56 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/fn_spones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup fn_spones 20 | //! @{ 21 | 22 | 23 | 24 | //! Generate a sparse matrix with the non-zero values in the same locations as in the given sparse matrix X, 25 | //! with the non-zero values set to one 26 | template 27 | arma_warn_unused 28 | inline 29 | SpMat 30 | spones(const SpBase& X) 31 | { 32 | arma_debug_sigprint(); 33 | 34 | typedef typename T1::elem_type eT; 35 | 36 | const unwrap_spmat U(X.get_ref()); 37 | 38 | SpMat out(arma_layout_indicator(), U.M); 39 | 40 | arrayops::inplace_set( access::rwp(out.values), eT(1), out.n_nonzero ); 41 | 42 | return out; 43 | } 44 | 45 | 46 | 47 | //! @} 48 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/fn_toeplitz.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup fn_toeplitz 20 | //! @{ 21 | 22 | 23 | 24 | template 25 | arma_warn_unused 26 | inline 27 | const Op 28 | toeplitz(const Base& X) 29 | { 30 | arma_debug_sigprint(); 31 | 32 | return Op( X.get_ref() ); 33 | } 34 | 35 | 36 | 37 | template 38 | arma_warn_unused 39 | inline 40 | const Op 41 | circ_toeplitz(const Base& X) 42 | { 43 | arma_debug_sigprint(); 44 | 45 | return Op( X.get_ref() ); 46 | } 47 | 48 | 49 | 50 | template 51 | arma_warn_unused 52 | inline 53 | const Glue 54 | toeplitz(const Base& X, const Base& Y) 55 | { 56 | arma_debug_sigprint(); 57 | 58 | return Glue( X.get_ref(), Y.get_ref() ); 59 | } 60 | 61 | 62 | 63 | //! @} 64 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/fn_trapz.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup fn_trapz 20 | //! @{ 21 | 22 | 23 | 24 | template 25 | arma_warn_unused 26 | inline 27 | const Glue 28 | trapz 29 | ( 30 | const Base& X, 31 | const Base& Y, 32 | const uword dim = 0 33 | ) 34 | { 35 | arma_debug_sigprint(); 36 | 37 | return Glue(X.get_ref(), Y.get_ref(), dim); 38 | } 39 | 40 | 41 | 42 | template 43 | arma_warn_unused 44 | inline 45 | const Op 46 | trapz 47 | ( 48 | const Base& Y, 49 | const uword dim = 0 50 | ) 51 | { 52 | arma_debug_sigprint(); 53 | 54 | return Op(Y.get_ref(), dim, uword(0)); 55 | } 56 | 57 | 58 | 59 | //! @} 60 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/fn_unique.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup fn_unique 20 | //! @{ 21 | 22 | 23 | template 24 | arma_warn_unused 25 | inline 26 | typename 27 | enable_if2 28 | < 29 | is_arma_type::value && resolves_to_vector::yes, 30 | const Op 31 | >::result 32 | unique(const T1& A) 33 | { 34 | arma_debug_sigprint(); 35 | 36 | return Op(A); 37 | } 38 | 39 | 40 | template 41 | arma_warn_unused 42 | inline 43 | typename 44 | enable_if2 45 | < 46 | is_arma_type::value && resolves_to_vector::no, 47 | const Op 48 | >::result 49 | unique(const T1& A) 50 | { 51 | arma_debug_sigprint(); 52 | 53 | return Op(A); 54 | } 55 | 56 | 57 | //! @} 58 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/glue_atan2_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | 20 | //! \addtogroup glue_atan2 21 | //! @{ 22 | 23 | 24 | 25 | class glue_atan2 26 | : public traits_glue_or 27 | { 28 | public: 29 | 30 | 31 | // matrices 32 | 33 | template inline static void apply(Mat& out, const Glue& expr); 34 | 35 | template inline static void apply_noalias(Mat& out, const Proxy& P1, const Proxy& P2); 36 | 37 | 38 | // cubes 39 | 40 | template inline static void apply(Cube& out, const GlueCube& expr); 41 | 42 | template inline static void apply_noalias(Cube& out, const ProxyCube& P1, const ProxyCube& P2); 43 | }; 44 | 45 | 46 | 47 | //! @} 48 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/glue_cor_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | 20 | //! \addtogroup glue_cor 21 | //! @{ 22 | 23 | 24 | 25 | class glue_cor 26 | { 27 | public: 28 | 29 | template 30 | struct traits 31 | { 32 | static constexpr bool is_row = false; // T1::is_col; // TODO: check 33 | static constexpr bool is_col = false; // T2::is_col; // TODO: check 34 | static constexpr bool is_xvec = false; 35 | }; 36 | 37 | template inline static void apply(Mat& out, const Glue& X); 38 | }; 39 | 40 | 41 | 42 | //! @} 43 | 44 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/glue_cov_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | 20 | //! \addtogroup glue_cov 21 | //! @{ 22 | 23 | 24 | 25 | class glue_cov 26 | { 27 | public: 28 | 29 | template 30 | struct traits 31 | { 32 | static constexpr bool is_row = false; // T1::is_col; // TODO: check 33 | static constexpr bool is_col = false; // T2::is_col; // TODO: check 34 | static constexpr bool is_xvec = false; 35 | }; 36 | 37 | template inline static void apply(Mat& out, const Glue& X); 38 | }; 39 | 40 | 41 | 42 | //! @} 43 | 44 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/glue_cross_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | 20 | //! \addtogroup glue_cross 21 | //! @{ 22 | 23 | 24 | 25 | class glue_cross 26 | { 27 | public: 28 | 29 | template 30 | struct traits 31 | { 32 | static constexpr bool is_row = T1::is_row; 33 | static constexpr bool is_col = T1::is_col; 34 | static constexpr bool is_xvec = true; 35 | }; 36 | 37 | template inline static void apply(Mat& out, const Glue& X); 38 | }; 39 | 40 | 41 | 42 | //! @} 43 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/glue_hist_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup glue_hist 20 | //! @{ 21 | 22 | 23 | class glue_hist 24 | : public traits_glue_default 25 | { 26 | public: 27 | 28 | template 29 | inline static void apply_noalias(Mat& out, const Mat& X, const Mat& C, const uword dim); 30 | 31 | template 32 | inline static void apply(Mat& out, const mtGlue& expr); 33 | }; 34 | 35 | 36 | 37 | class glue_hist_default 38 | { 39 | public: 40 | 41 | template 42 | struct traits 43 | { 44 | static constexpr bool is_row = T1::is_row; 45 | static constexpr bool is_col = T1::is_col; 46 | static constexpr bool is_xvec = T1::is_xvec; 47 | }; 48 | 49 | template 50 | inline static void apply(Mat& out, const mtGlue& expr); 51 | }; 52 | 53 | 54 | //! @} 55 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/glue_histc_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup glue_histc 20 | //! @{ 21 | 22 | 23 | class glue_histc 24 | : public traits_glue_default 25 | { 26 | public: 27 | 28 | template 29 | inline static void apply_noalias(Mat& C, const Mat& A, const Mat& B, const uword dim); 30 | 31 | template 32 | inline static void apply(Mat& C, const mtGlue& expr); 33 | }; 34 | 35 | 36 | 37 | class glue_histc_default 38 | { 39 | public: 40 | 41 | template 42 | struct traits 43 | { 44 | static constexpr bool is_row = T1::is_row; 45 | static constexpr bool is_col = T1::is_col; 46 | static constexpr bool is_xvec = T1::is_xvec; 47 | }; 48 | 49 | template 50 | inline static void apply(Mat& C, const mtGlue& expr); 51 | }; 52 | 53 | 54 | //! @} 55 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/glue_hypot_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | 20 | //! \addtogroup glue_hypot 21 | //! @{ 22 | 23 | 24 | 25 | class glue_hypot 26 | : public traits_glue_or 27 | { 28 | public: 29 | 30 | 31 | // matrices 32 | 33 | template inline static void apply(Mat& out, const Glue& expr); 34 | 35 | template inline static void apply_noalias(Mat& out, const Proxy& P1, const Proxy& P2); 36 | 37 | 38 | // cubes 39 | 40 | template inline static void apply(Cube& out, const GlueCube& expr); 41 | 42 | template inline static void apply_noalias(Cube& out, const ProxyCube& P1, const ProxyCube& P2); 43 | }; 44 | 45 | 46 | 47 | //! @} 48 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/glue_intersect_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup glue_intersect 20 | //! @{ 21 | 22 | 23 | 24 | class glue_intersect 25 | { 26 | public: 27 | 28 | template 29 | struct traits 30 | { 31 | static constexpr bool is_row = (T1::is_row && T2::is_row); 32 | static constexpr bool is_col = (T1::is_col || T2::is_col); 33 | static constexpr bool is_xvec = false; 34 | }; 35 | 36 | template 37 | inline static void apply(Mat& out, const Glue& X); 38 | 39 | template 40 | inline static void apply(Mat& out, uvec& iA, uvec& iB, const Base& A_expr, const Base& B_expr, const bool calc_indx); 41 | }; 42 | 43 | 44 | 45 | //! @} 46 | 47 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/glue_max_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | 20 | //! \addtogroup glue_max 21 | //! @{ 22 | 23 | 24 | 25 | class glue_max 26 | : public traits_glue_or 27 | { 28 | public: 29 | 30 | // dense matrices 31 | 32 | template inline static void apply(Mat& out, const Glue& X); 33 | 34 | template inline static void apply(Mat& out, const Proxy& PA, const Proxy& PB); 35 | 36 | 37 | // cubes 38 | 39 | template inline static void apply(Cube& out, const GlueCube& X); 40 | 41 | template inline static void apply(Cube& out, const ProxyCube& PA, const ProxyCube& PB); 42 | }; 43 | 44 | 45 | 46 | //! @} 47 | 48 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/glue_min_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | 20 | //! \addtogroup glue_min 21 | //! @{ 22 | 23 | 24 | 25 | class glue_min 26 | : public traits_glue_or 27 | { 28 | public: 29 | 30 | // dense matrices 31 | 32 | template inline static void apply(Mat& out, const Glue& X); 33 | 34 | template inline static void apply(Mat& out, const Proxy& PA, const Proxy& PB); 35 | 36 | 37 | // cubes 38 | 39 | template inline static void apply(Cube& out, const GlueCube& X); 40 | 41 | template inline static void apply(Cube& out, const ProxyCube& PA, const ProxyCube& PB); 42 | }; 43 | 44 | 45 | 46 | //! @} 47 | 48 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/glue_polyfit_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | 20 | //! \addtogroup glue_polyfit 21 | //! @{ 22 | 23 | 24 | 25 | class glue_polyfit 26 | { 27 | public: 28 | 29 | template 30 | struct traits 31 | { 32 | static constexpr bool is_row = false; 33 | static constexpr bool is_col = true; 34 | static constexpr bool is_xvec = false; 35 | }; 36 | 37 | template inline static bool apply_noalias(Mat& out, const Col& X, const Col& Y, const uword N); 38 | 39 | template inline static bool apply_direct(Mat& out, const Base& X_expr, const Base& Y_expr, const uword N); 40 | 41 | template inline static void apply(Mat& out, const Glue& expr); 42 | }; 43 | 44 | 45 | 46 | //! @} 47 | 48 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/glue_polyval_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | 20 | //! \addtogroup glue_polyval 21 | //! @{ 22 | 23 | 24 | 25 | class glue_polyval 26 | { 27 | public: 28 | 29 | template 30 | struct traits 31 | { 32 | static constexpr bool is_row = T2::is_row; 33 | static constexpr bool is_col = T2::is_col; 34 | static constexpr bool is_xvec = T2::is_xvec; 35 | }; 36 | 37 | template inline static void apply_noalias(Mat& out, const Mat& P, const Mat& X); 38 | 39 | template inline static void apply(Mat& out, const Glue& expr); 40 | }; 41 | 42 | 43 | 44 | //! @} 45 | 46 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/glue_toeplitz_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | 20 | //! \addtogroup glue_toeplitz 21 | //! @{ 22 | 23 | 24 | 25 | class glue_toeplitz 26 | : public traits_glue_default 27 | { 28 | public: 29 | 30 | template inline static void apply(Mat& out, const Glue& in); 31 | }; 32 | 33 | 34 | 35 | //! @} 36 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/include_hdf5.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | #if defined(ARMA_USE_HDF5) 20 | 21 | #undef H5_USE_110_API 22 | #define H5_USE_110_API 23 | 24 | #if defined(__has_include) 25 | #if __has_include() 26 | #include 27 | #else 28 | #undef ARMA_USE_HDF5 29 | #pragma message ("WARNING: use of HDF5 disabled; hdf5.h header not found") 30 | #endif 31 | #else 32 | #include 33 | #endif 34 | 35 | #if defined(H5_USE_16_API) || defined(H5_USE_16_API_DEFAULT) 36 | #pragma message ("WARNING: use of HDF5 disabled; incompatible configuration: H5_USE_16_API or H5_USE_16_API_DEFAULT") 37 | #undef ARMA_USE_HDF5 38 | #endif 39 | 40 | // // TODO 41 | // #if defined(H5_USE_18_API) || defined(H5_USE_18_API_DEFAULT) 42 | // #pragma message ("WARNING: detected possibly incompatible configuration of HDF5: H5_USE_18_API or H5_USE_18_API_DEFAULT") 43 | // #endif 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/mtGlueCube_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup mtGlueCube 20 | //! @{ 21 | 22 | 23 | 24 | template 25 | class mtGlueCube : public BaseCube< out_eT, mtGlueCube > 26 | { 27 | public: 28 | 29 | typedef out_eT elem_type; 30 | typedef typename get_pod_type::result pod_type; 31 | 32 | arma_inline mtGlueCube(const T1& in_A, const T2& in_B); 33 | arma_inline mtGlueCube(const T1& in_A, const T2& in_B, const uword in_aux_uword); 34 | arma_inline ~mtGlueCube(); 35 | 36 | const T1& A; //!< first operand; must be derived from BaseCube 37 | const T2& B; //!< second operand; must be derived from BaseCube 38 | uword aux_uword; //!< storage of auxiliary data, uword format 39 | }; 40 | 41 | 42 | 43 | //! @} 44 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/mtGlueCube_meat.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup mtGlueCube 20 | //! @{ 21 | 22 | 23 | 24 | template 25 | inline 26 | mtGlueCube::mtGlueCube(const T1& in_A, const T2& in_B) 27 | : A(in_A) 28 | , B(in_B) 29 | { 30 | arma_debug_sigprint(); 31 | } 32 | 33 | 34 | 35 | template 36 | inline 37 | mtGlueCube::mtGlueCube(const T1& in_A, const T2& in_B, const uword in_aux_uword) 38 | : A(in_A) 39 | , B(in_B) 40 | , aux_uword(in_aux_uword) 41 | { 42 | arma_debug_sigprint(); 43 | } 44 | 45 | 46 | 47 | template 48 | inline 49 | mtGlueCube::~mtGlueCube() 50 | { 51 | arma_debug_sigprint(); 52 | } 53 | 54 | 55 | 56 | //! @} 57 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/mtSpGlue_meat.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup mtSpGlue 20 | //! @{ 21 | 22 | 23 | 24 | template 25 | inline 26 | mtSpGlue::mtSpGlue(const T1& in_A, const T2& in_B) 27 | : A(in_A) 28 | , B(in_B) 29 | { 30 | arma_debug_sigprint(); 31 | } 32 | 33 | 34 | 35 | template 36 | inline 37 | mtSpGlue::~mtSpGlue() 38 | { 39 | arma_debug_sigprint(); 40 | } 41 | 42 | 43 | 44 | template 45 | template 46 | arma_inline 47 | bool 48 | mtSpGlue::is_alias(const SpMat& X) const 49 | { 50 | return (A.is_alias(X) || B.is_alias(X)); 51 | } 52 | 53 | 54 | 55 | //! @} 56 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/mtSpReduceOp_meat.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup mtSpReduceOp 20 | //! @{ 21 | 22 | 23 | 24 | template 25 | inline 26 | mtSpReduceOp::mtSpReduceOp(const T1& in_m) 27 | : m(in_m) 28 | { 29 | arma_debug_sigprint(); 30 | } 31 | 32 | 33 | 34 | template 35 | inline 36 | mtSpReduceOp::mtSpReduceOp(const T1& in_m, const uword in_aux_uword_a, const uword in_aux_uword_b) 37 | : m(in_m) 38 | , aux_uword_a(in_aux_uword_a) 39 | , aux_uword_b(in_aux_uword_b) 40 | { 41 | arma_debug_sigprint(); 42 | } 43 | 44 | 45 | 46 | template 47 | inline 48 | mtSpReduceOp::~mtSpReduceOp() 49 | { 50 | arma_debug_sigprint(); 51 | } 52 | 53 | 54 | 55 | //! @} 56 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/newarp_DenseGenMatProd_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | namespace newarp 20 | { 21 | 22 | 23 | //! Define matrix operations on existing matrix objects 24 | template 25 | class DenseGenMatProd 26 | { 27 | private: 28 | 29 | const Mat& op_mat; 30 | 31 | 32 | public: 33 | 34 | const uword n_rows; // number of rows of the underlying matrix 35 | const uword n_cols; // number of columns of the underlying matrix 36 | 37 | inline DenseGenMatProd(const Mat& mat_obj); 38 | 39 | inline void perform_op(eT* x_in, eT* y_out) const; 40 | }; 41 | 42 | 43 | } // namespace newarp 44 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/newarp_DenseGenMatProd_meat.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | namespace newarp 20 | { 21 | 22 | 23 | template 24 | inline 25 | DenseGenMatProd::DenseGenMatProd(const Mat& mat_obj) 26 | : op_mat(mat_obj) 27 | , n_rows(mat_obj.n_rows) 28 | , n_cols(mat_obj.n_cols) 29 | { 30 | arma_debug_sigprint(); 31 | } 32 | 33 | 34 | 35 | // Perform the matrix-vector multiplication operation \f$y=Ax\f$. 36 | // y_out = A * x_in 37 | template 38 | inline 39 | void 40 | DenseGenMatProd::perform_op(eT* x_in, eT* y_out) const 41 | { 42 | arma_debug_sigprint(); 43 | 44 | const Col x(x_in , n_cols, false, true); 45 | Col y(y_out, n_rows, false, true); 46 | 47 | y = op_mat * x; 48 | } 49 | 50 | 51 | } // namespace newarp 52 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/newarp_SparseGenMatProd_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | namespace newarp 20 | { 21 | 22 | 23 | //! Define matrix operations on existing matrix objects 24 | template 25 | class SparseGenMatProd 26 | { 27 | private: 28 | 29 | const SpMat& op_mat; 30 | SpMat op_mat_st; 31 | 32 | 33 | public: 34 | 35 | const uword n_rows; // number of rows of the underlying matrix 36 | const uword n_cols; // number of columns of the underlying matrix 37 | 38 | inline SparseGenMatProd(const SpMat& mat_obj); 39 | 40 | inline void perform_op(eT* x_in, eT* y_out) const; 41 | }; 42 | 43 | 44 | } // namespace newarp 45 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/newarp_SparseGenRealShiftSolve_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | namespace newarp 20 | { 21 | 22 | 23 | //! Define matrix operations on existing matrix objects 24 | template 25 | class SparseGenRealShiftSolve 26 | { 27 | private: 28 | 29 | #if defined(ARMA_USE_SUPERLU) 30 | // The following objects are read-only in perform_op() 31 | mutable superlu_supermatrix_wrangler l; 32 | mutable superlu_supermatrix_wrangler u; 33 | mutable superlu_array_wrangler perm_c; 34 | mutable superlu_array_wrangler perm_r; 35 | #endif 36 | 37 | 38 | public: 39 | 40 | bool valid = false; 41 | 42 | const uword n_rows; // number of rows of the underlying matrix 43 | const uword n_cols; // number of columns of the underlying matrix 44 | 45 | inline SparseGenRealShiftSolve(const SpMat& mat_obj, const eT shift); 46 | 47 | inline void perform_op(eT* x_in, eT* y_out) const; 48 | }; 49 | 50 | 51 | } // namespace newarp 52 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/newarp_SymEigsShiftSolver_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | namespace newarp 20 | { 21 | 22 | 23 | //! This class implements the eigen solver for real symmetric matrices in the shift-and-invert mode. 24 | template 25 | class SymEigsShiftSolver : public SymEigsSolver 26 | { 27 | private: 28 | 29 | const eT sigma; 30 | 31 | // Sort the first nev Ritz pairs in ascending algebraic order 32 | // This is used to return the final results 33 | void sort_ritzpair(); 34 | 35 | 36 | public: 37 | 38 | //! Constructor to create a solver object. 39 | inline SymEigsShiftSolver(const OpType& op_, uword nev_, uword ncv_, const eT sigma_); 40 | }; 41 | 42 | 43 | } // namespace newarp 44 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/newarp_SymEigsShiftSolver_meat.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | namespace newarp 20 | { 21 | 22 | 23 | template 24 | inline 25 | void 26 | SymEigsShiftSolver::sort_ritzpair() 27 | { 28 | arma_debug_sigprint(); 29 | 30 | // First transform back the Ritz values, and then sort 31 | for(uword i = 0; i < this->nev; i++) 32 | { 33 | this->ritz_val(i) = eT(1.0) / this->ritz_val(i) + sigma; 34 | } 35 | SymEigsSolver::sort_ritzpair(); 36 | } 37 | 38 | 39 | 40 | template 41 | inline 42 | SymEigsShiftSolver::SymEigsShiftSolver(const OpType& op_, uword nev_, uword ncv_, const eT sigma_) 43 | : SymEigsSolver::SymEigsSolver(op_, nev_, ncv_) 44 | , sigma(sigma_) 45 | { 46 | arma_debug_sigprint(); 47 | } 48 | 49 | 50 | } // namespace newarp 51 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/newarp_cx_attrib.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | namespace newarp 20 | { 21 | 22 | 23 | //! Tiny functions to check attributes of complex numbers 24 | struct cx_attrib 25 | { 26 | template 27 | arma_inline static bool is_real (const std::complex& v, const T eps) { return (std::abs(v.imag()) <= eps); } 28 | 29 | template 30 | arma_inline static bool is_complex(const std::complex& v, const T eps) { return (std::abs(v.imag()) > eps); } 31 | 32 | template 33 | 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); } 34 | }; 35 | 36 | 37 | } // namespace newarp 38 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/op_chi2rnd_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup op_chi2rnd 20 | //! @{ 21 | 22 | 23 | class op_chi2rnd 24 | : public traits_op_passthru 25 | { 26 | public: 27 | 28 | template 29 | inline static void apply(Mat& out, const Op& in); 30 | 31 | template 32 | inline static void apply_noalias(Mat& out, const Proxy& P); 33 | 34 | template 35 | inline static void fill_constant_df(Mat& out, const eT df); 36 | }; 37 | 38 | 39 | 40 | template 41 | class op_chi2rnd_varying_df 42 | { 43 | public: 44 | 45 | arma_aligned std::mt19937_64 motor; 46 | 47 | inline ~op_chi2rnd_varying_df(); 48 | inline op_chi2rnd_varying_df(); 49 | 50 | inline eT operator()(const eT df); 51 | }; 52 | 53 | 54 | //! @} 55 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/op_chol_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup op_chol 20 | //! @{ 21 | 22 | 23 | 24 | class op_chol 25 | : public traits_op_default 26 | { 27 | public: 28 | 29 | template 30 | inline static void apply(Mat& out, const Op& X); 31 | 32 | template 33 | inline static bool apply_direct(Mat& out, const Base& A_expr, const uword layout); 34 | }; 35 | 36 | 37 | 38 | //! @} 39 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/op_col_as_mat_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup op_col_as_mat 20 | //! @{ 21 | 22 | 23 | class op_col_as_mat 24 | : public traits_op_default 25 | { 26 | public: 27 | 28 | template inline static void apply(Mat& out, const CubeToMatOp& expr); 29 | }; 30 | 31 | 32 | 33 | //! @} 34 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/op_col_as_mat_meat.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup op_col_as_mat 20 | //! @{ 21 | 22 | 23 | 24 | template 25 | inline 26 | void 27 | op_col_as_mat::apply(Mat& out, const CubeToMatOp& expr) 28 | { 29 | arma_debug_sigprint(); 30 | 31 | typedef typename T1::elem_type eT; 32 | 33 | const unwrap_cube U(expr.m); 34 | const Cube& A = U.M; 35 | 36 | const uword in_col = expr.aux_uword; 37 | 38 | arma_conform_check_bounds( (in_col >= A.n_cols), "Cube::col_as_mat(): index out of bounds" ); 39 | 40 | const uword A_n_rows = A.n_rows; 41 | const uword A_n_slices = A.n_slices; 42 | 43 | out.set_size(A_n_rows, A_n_slices); 44 | 45 | for(uword s=0; s < A_n_slices; ++s) 46 | { 47 | arrayops::copy(out.colptr(s), A.slice_colptr(s, in_col), A_n_rows); 48 | } 49 | } 50 | 51 | 52 | 53 | //! @} 54 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/op_cond_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup op_cond 20 | //! @{ 21 | 22 | 23 | class op_cond 24 | : public traits_op_default 25 | { 26 | public: 27 | 28 | template static inline typename T1::pod_type apply(const Base& X); 29 | 30 | template static inline typename get_pod_type::result apply_diag(const Mat& A); 31 | template static inline typename get_pod_type::result apply_sym ( Mat& A); 32 | template static inline typename get_pod_type::result apply_gen ( Mat& A); 33 | }; 34 | 35 | 36 | //! @} 37 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/op_cor_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | 20 | //! \addtogroup op_cor 21 | //! @{ 22 | 23 | 24 | 25 | class op_cor 26 | : public traits_op_default 27 | { 28 | public: 29 | 30 | template inline static void apply(Mat& out, const Op< T1, op_cor>& in); 31 | template inline static void apply(Mat& out, const Op< Op, op_cor>& in); 32 | }; 33 | 34 | 35 | 36 | //! @} 37 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/op_cov_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | 20 | //! \addtogroup op_cov 21 | //! @{ 22 | 23 | 24 | 25 | class op_cov 26 | : public traits_op_default 27 | { 28 | public: 29 | 30 | template inline static void apply(Mat& out, const Op< T1, op_cov>& in); 31 | template inline static void apply(Mat& out, const Op< Op, op_cov>& in); 32 | }; 33 | 34 | 35 | 36 | //! @} 37 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/op_cumprod_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup op_cumprod 20 | //! @{ 21 | 22 | 23 | 24 | class op_cumprod 25 | : public traits_op_default 26 | { 27 | public: 28 | 29 | template 30 | inline static void apply_noalias(Mat& out, const Mat& X, const uword dim); 31 | 32 | template 33 | inline static void apply(Mat& out, const Op& in); 34 | }; 35 | 36 | 37 | 38 | class op_cumprod_vec 39 | : public traits_op_passthru 40 | { 41 | public: 42 | 43 | template 44 | inline static void apply(Mat& out, const Op& in); 45 | }; 46 | 47 | 48 | 49 | //! @} 50 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/op_cumsum_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup op_cumsum 20 | //! @{ 21 | 22 | 23 | 24 | class op_cumsum 25 | : public traits_op_default 26 | { 27 | public: 28 | 29 | template 30 | inline static void apply_noalias(Mat& out, const Mat& X, const uword dim); 31 | 32 | template 33 | inline static void apply(Mat& out, const Op& in); 34 | }; 35 | 36 | 37 | 38 | class op_cumsum_vec 39 | : public traits_op_passthru 40 | { 41 | public: 42 | 43 | template 44 | inline static void apply(Mat& out, const Op& in); 45 | }; 46 | 47 | 48 | 49 | //! @} 50 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/op_det_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup op_det 20 | //! @{ 21 | 22 | 23 | 24 | class op_det 25 | : public traits_op_default 26 | { 27 | public: 28 | 29 | template 30 | struct pos 31 | { 32 | static constexpr uword n2 = row + col*2; 33 | static constexpr uword n3 = row + col*3; 34 | }; 35 | 36 | template 37 | inline static bool apply_direct(typename T1::elem_type& out_val, const Base& expr); 38 | 39 | template 40 | inline static typename T1::elem_type apply_diagmat(const Base& expr); 41 | 42 | template 43 | inline static typename T1::elem_type apply_trimat(const Base& expr); 44 | 45 | template 46 | arma_cold inline static eT apply_tiny_2x2(const Mat& X); 47 | 48 | template 49 | arma_cold inline static eT apply_tiny_3x3(const Mat& X); 50 | }; 51 | 52 | 53 | 54 | //! @} 55 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/op_diff_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup op_diff 20 | //! @{ 21 | 22 | 23 | 24 | class op_diff 25 | : public traits_op_default 26 | { 27 | public: 28 | 29 | template 30 | inline static void apply_noalias(Mat& out, const Mat& X, const uword k, const uword dim); 31 | 32 | template 33 | inline static void apply(Mat& out, const Op& in); 34 | }; 35 | 36 | 37 | 38 | class op_diff_vec 39 | : public traits_op_passthru 40 | { 41 | public: 42 | 43 | template 44 | inline static void apply(Mat& out, const Op& in); 45 | }; 46 | 47 | 48 | 49 | //! @} 50 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/op_dotext_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup op_dotext 20 | //! @{ 21 | 22 | 23 | 24 | class op_dotext 25 | : public traits_op_default 26 | { 27 | public: 28 | 29 | 30 | template 31 | inline static eT direct_rowvec_mat_colvec (const eT* A_mem, const Mat& B, const eT* C_mem); 32 | 33 | template 34 | inline static eT direct_rowvec_transmat_colvec (const eT* A_mem, const Mat& B, const eT* C_mem); 35 | 36 | template 37 | inline static eT direct_rowvec_diagmat_colvec (const eT* A_mem, const Mat& B, const eT* C_mem); 38 | 39 | template 40 | inline static eT direct_rowvec_invdiagmat_colvec(const eT* A_mem, const Mat& B, const eT* C_mem); 41 | 42 | template 43 | inline static eT direct_rowvec_invdiagvec_colvec(const eT* A_mem, const Mat& B, const eT* C_mem); 44 | 45 | }; 46 | 47 | 48 | 49 | //! @} 50 | 51 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/op_expmat_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | 20 | //! \addtogroup op_expmat 21 | //! @{ 22 | 23 | 24 | 25 | class op_expmat 26 | : public traits_op_default 27 | { 28 | public: 29 | 30 | template 31 | inline static void apply(Mat& out, const Op& expr); 32 | 33 | template 34 | inline static bool apply_direct(Mat& out, const Base& X); 35 | }; 36 | 37 | 38 | 39 | class op_expmat_sym 40 | : public traits_op_default 41 | { 42 | public: 43 | 44 | template 45 | inline static void apply(Mat& out, const Op& in); 46 | 47 | template 48 | inline static bool apply_direct(Mat& out, const Base& expr); 49 | }; 50 | 51 | 52 | 53 | //! @} 54 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/op_hist_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | 20 | //! \addtogroup op_hist 21 | //! @{ 22 | 23 | 24 | 25 | class op_hist 26 | : public traits_op_passthru 27 | { 28 | public: 29 | 30 | template 31 | inline static void apply_noalias(Mat& out, const Mat& A, const uword n_bins, const uword dim); 32 | 33 | template 34 | inline static void apply(Mat& out, const mtOp& X); 35 | }; 36 | 37 | 38 | 39 | //! @} 40 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/op_nonzeros_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | 20 | //! \addtogroup op_nonzeros 21 | //! @{ 22 | 23 | 24 | 25 | class op_nonzeros 26 | : public traits_op_col 27 | { 28 | public: 29 | 30 | // for dense matrices 31 | 32 | template 33 | static inline void apply_noalias(Mat& out, const Proxy& P); 34 | 35 | template 36 | static inline void apply(Mat& out, const Op& X); 37 | }; 38 | 39 | 40 | 41 | //! @} 42 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/op_normalise_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | 20 | //! \addtogroup op_normalise 21 | //! @{ 22 | 23 | 24 | 25 | class op_normalise_vec 26 | : public traits_op_passthru 27 | { 28 | public: 29 | 30 | template inline static void apply(Mat& out, const Op& in); 31 | }; 32 | 33 | 34 | 35 | class op_normalise_mat 36 | : public traits_op_default 37 | { 38 | public: 39 | 40 | template inline static void apply(Mat& out, const Op& in); 41 | 42 | template inline static void apply(Mat& out, const Mat& A, const uword p, const uword dim); 43 | }; 44 | 45 | 46 | 47 | //! @} 48 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/op_orth_null_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | 20 | //! \addtogroup op_orth_null 21 | //! @{ 22 | 23 | 24 | 25 | class op_orth 26 | : public traits_op_default 27 | { 28 | public: 29 | 30 | template 31 | inline static void apply(Mat& out, const Op& expr); 32 | 33 | template 34 | inline static bool apply_direct(Mat& out, const Base& expr, typename T1::pod_type tol); 35 | }; 36 | 37 | 38 | 39 | class op_null 40 | : public traits_op_default 41 | { 42 | public: 43 | 44 | template 45 | inline static void apply(Mat& out, const Op& expr); 46 | 47 | template 48 | inline static bool apply_direct(Mat& out, const Base& expr, typename T1::pod_type tol); 49 | }; 50 | 51 | 52 | 53 | //! @} 54 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/op_prod_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup op_prod 20 | //! @{ 21 | 22 | 23 | class op_prod 24 | : public traits_op_xvec 25 | { 26 | public: 27 | 28 | template 29 | inline static void apply_noalias(Mat& out, const Mat& X, const uword dim); 30 | 31 | template 32 | inline static void apply(Mat& out, const Op& in); 33 | 34 | template 35 | inline static eT prod(const subview& S); 36 | 37 | template 38 | inline static typename T1::elem_type prod(const Base& X); 39 | }; 40 | 41 | 42 | //! @} 43 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/op_range_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup op_range 20 | //! @{ 21 | 22 | 23 | class op_range 24 | : public traits_op_xvec 25 | { 26 | public: 27 | 28 | template 29 | inline static void apply(Mat& out, const Op& in); 30 | 31 | template 32 | inline static void apply_noalias(Mat& out, const Mat& X, const uword dim); 33 | 34 | template 35 | inline static typename T1::elem_type vector_range(const T1& expr); 36 | }; 37 | 38 | 39 | 40 | //! @} 41 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/op_rank_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | 20 | //! \addtogroup op_rank 21 | //! @{ 22 | 23 | 24 | 25 | class op_rank 26 | : public traits_op_default 27 | { 28 | public: 29 | 30 | template inline static bool apply(uword& out, const Base& expr, const typename T1::pod_type tol); 31 | 32 | template inline static bool apply_gen(uword& out, Mat& A, typename get_pod_type::result tol); 33 | 34 | template inline static bool apply_sym(uword& out, Mat& A, typename get_pod_type::result tol); 35 | 36 | template inline static bool apply_diag(uword& out, Mat& A, typename get_pod_type::result tol); 37 | }; 38 | 39 | 40 | 41 | //! @} 42 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/op_rcond_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup op_rcond 20 | //! @{ 21 | 22 | 23 | class op_rcond 24 | : public traits_op_default 25 | { 26 | public: 27 | 28 | template static inline typename T1::pod_type apply(const Base& X); 29 | }; 30 | 31 | 32 | //! @} 33 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/op_repelem_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | 20 | //! \addtogroup op_repelem 21 | //! @{ 22 | 23 | 24 | 25 | class op_repelem 26 | : public traits_op_default 27 | { 28 | public: 29 | 30 | template inline static void apply_noalias(Mat& out, const obj& X, const uword copies_per_row, const uword copies_per_col); 31 | 32 | template inline static void apply(Mat& out, const Op& in); 33 | }; 34 | 35 | 36 | 37 | //! @} 38 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/op_repmat_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | 20 | //! \addtogroup op_repmat 21 | //! @{ 22 | 23 | 24 | 25 | class op_repmat 26 | : public traits_op_default 27 | { 28 | public: 29 | 30 | template inline static void apply_noalias(Mat& out, const obj& X, const uword copies_per_row, const uword copies_per_col); 31 | 32 | template inline static void apply(Mat& out, const Op& in); 33 | }; 34 | 35 | 36 | 37 | //! @} 38 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/op_reverse_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup op_reverse 20 | //! @{ 21 | 22 | 23 | 24 | class op_reverse 25 | : public traits_op_default 26 | { 27 | public: 28 | 29 | template 30 | inline static void apply(Mat& out, const Op& in); 31 | }; 32 | 33 | 34 | 35 | class op_reverse_vec 36 | : public traits_op_passthru 37 | { 38 | public: 39 | 40 | template 41 | inline static void apply(Mat& out, const Op& in); 42 | }; 43 | 44 | 45 | 46 | //! @} 47 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/op_roots_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup op_roots 20 | //! @{ 21 | 22 | 23 | 24 | class op_roots 25 | : public traits_op_col 26 | { 27 | public: 28 | 29 | template 30 | inline static void apply(Mat< std::complex >& out, const mtOp, T1, op_roots>& expr); 31 | 32 | template 33 | inline static bool apply_direct(Mat< std::complex >& out, const Base& X); 34 | 35 | template 36 | inline static bool apply_noalias(Mat< std::complex::result> >& out, const Mat& X); 37 | }; 38 | 39 | 40 | 41 | //! @} 42 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/op_row_as_mat_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup op_row_as_mat 20 | //! @{ 21 | 22 | 23 | class op_row_as_mat 24 | : public traits_op_default 25 | { 26 | public: 27 | 28 | template inline static void apply(Mat& out, const CubeToMatOp& expr); 29 | }; 30 | 31 | 32 | 33 | //! @} 34 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/op_shift_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | 20 | //! \addtogroup op_shift 21 | //! @{ 22 | 23 | 24 | 25 | class op_shift_vec 26 | : public traits_op_passthru 27 | { 28 | public: 29 | 30 | template inline static void apply(Mat& out, const Op& in); 31 | }; 32 | 33 | 34 | 35 | class op_shift 36 | : public traits_op_default 37 | { 38 | public: 39 | 40 | template inline static void apply_noalias(Mat& out, const Mat& X, const uword len, const uword neg, const uword dim); 41 | }; 42 | 43 | 44 | 45 | //! @} 46 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/op_shuffle_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | 20 | //! \addtogroup op_shuffle 21 | //! @{ 22 | 23 | 24 | 25 | class op_shuffle 26 | : public traits_op_default 27 | { 28 | public: 29 | 30 | template inline static void apply_direct(Mat& out, const Mat& X, const uword dim); 31 | 32 | template inline static void apply(Mat& out, const Op& in); 33 | }; 34 | 35 | 36 | 37 | class op_shuffle_vec 38 | : public traits_op_passthru 39 | { 40 | public: 41 | 42 | template inline static void apply(Mat& out, const Op& in); 43 | }; 44 | 45 | 46 | 47 | //! @} 48 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/op_sort_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup op_sort 20 | //! @{ 21 | 22 | 23 | 24 | class op_sort 25 | : public traits_op_default 26 | { 27 | public: 28 | 29 | template 30 | inline static void direct_sort(eT* X, const uword N, const uword sort_mode = 0); 31 | 32 | template 33 | inline static void direct_sort_ascending(eT* X, const uword N); 34 | 35 | template 36 | inline static void apply_noalias(Mat& out, const Mat& X, const uword sort_mode, const uword dim); 37 | 38 | template 39 | inline static void apply(Mat& out, const Op& in); 40 | }; 41 | 42 | 43 | 44 | class op_sort_vec 45 | : public traits_op_passthru 46 | { 47 | public: 48 | 49 | template 50 | inline static void apply(Mat& out, const Op& in); 51 | }; 52 | 53 | 54 | 55 | //! @} 56 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/op_sp_as_dense_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup op_sp_as_dense 20 | //! @{ 21 | 22 | 23 | class op_sp_as_dense 24 | : public traits_op_passthru 25 | { 26 | public: 27 | 28 | template 29 | inline static void apply(Mat& out, const SpToDOp& expr); 30 | }; 31 | 32 | 33 | //! @} 34 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/op_sp_as_dense_meat.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup op_sp_as_dense 20 | //! @{ 21 | 22 | 23 | 24 | template 25 | inline 26 | void 27 | op_sp_as_dense::apply(Mat& out, const SpToDOp& expr) 28 | { 29 | arma_debug_sigprint(); 30 | 31 | out = expr.m; 32 | } 33 | 34 | 35 | 36 | //! @} 37 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/op_sp_diagvec_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup op_sp_diagvec 20 | //! @{ 21 | 22 | 23 | 24 | class op_sp_diagvec 25 | : public traits_op_col 26 | { 27 | public: 28 | 29 | template 30 | inline static void apply(Mat& out, const mtSpReduceOp& in); 31 | }; 32 | 33 | 34 | 35 | //! @} 36 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/op_sp_nonzeros_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | 20 | //! \addtogroup op_sp_nonzeros 21 | //! @{ 22 | 23 | 24 | 25 | class op_sp_nonzeros 26 | : public traits_op_col 27 | { 28 | public: 29 | 30 | template 31 | static inline void apply(Mat& out, const SpToDOp& X); 32 | }; 33 | 34 | 35 | 36 | //! @} 37 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/op_sp_plus_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup op_sp_plus 20 | //! @{ 21 | 22 | 23 | 24 | // Add a scalar to a sparse matrix; this will return a dense matrix. 25 | class op_sp_plus 26 | : public traits_op_passthru 27 | { 28 | public: 29 | 30 | template 31 | inline static void apply(Mat& out, const SpToDOp& in); 32 | 33 | // used for the optimization of sparse % (sparse + scalar) 34 | template 35 | inline static void apply_inside_schur(SpMat& out, const T2& x, const SpToDOp& y); 36 | 37 | // used for the optimization of sparse / (sparse + scalar) 38 | template 39 | inline static void apply_inside_div(SpMat& out, const T2& x, const SpToDOp& y); 40 | }; 41 | 42 | 43 | 44 | //! @} 45 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/op_sp_stddev_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup op_sp_stddev 20 | //! @{ 21 | 22 | 23 | 24 | class op_sp_stddev 25 | : public traits_op_xvec 26 | { 27 | public: 28 | 29 | template 30 | inline static void apply(Mat& out, const mtSpReduceOp& in); 31 | 32 | template 33 | inline static void apply_slow(Mat& out, const SpProxy& p, const uword norm_type, const uword dim); 34 | 35 | template 36 | inline static typename T1::pod_type stddev_vec(const T1& X, const uword norm_type = 0); 37 | }; 38 | 39 | 40 | 41 | //! @} 42 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/op_sp_sum_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup op_sp_sum 20 | //! @{ 21 | 22 | 23 | class op_sp_sum 24 | : public traits_op_xvec 25 | { 26 | public: 27 | 28 | template 29 | inline static void apply(Mat& out, const mtSpReduceOp& in); 30 | 31 | template 32 | inline static void apply(Mat& out, const mtSpReduceOp, op_sp_sum>& in); 33 | }; 34 | 35 | 36 | //! @} 37 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/op_sp_vecnorm_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup op_sp_vecnorm 20 | //! @{ 21 | 22 | 23 | class op_sp_vecnorm 24 | : public traits_op_xvec 25 | { 26 | public: 27 | 28 | template 29 | inline static void apply(Mat& out, const mtSpReduceOp& expr); 30 | 31 | template 32 | inline static void apply_direct(Mat< typename get_pod_type::result >& out, const SpMat& X, const uword k); 33 | }; 34 | 35 | 36 | // 37 | 38 | 39 | class op_sp_vecnorm_ext 40 | : public traits_op_xvec 41 | { 42 | public: 43 | 44 | template 45 | inline static void apply(Mat& out, const mtSpReduceOp& expr); 46 | 47 | template 48 | inline static void apply_direct(Mat< typename get_pod_type::result >& out, const SpMat& X, const uword method_id); 49 | }; 50 | 51 | 52 | //! @} 53 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/op_toeplitz_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup op_toeplitz 20 | //! @{ 21 | 22 | 23 | 24 | class op_toeplitz 25 | : public traits_op_default 26 | { 27 | public: 28 | 29 | template 30 | inline static void apply(Mat& out, const Op& in); 31 | }; 32 | 33 | 34 | 35 | class op_toeplitz_c 36 | : public traits_op_default 37 | { 38 | public: 39 | 40 | template 41 | inline static void apply(Mat& out, const Op& in); 42 | }; 43 | 44 | 45 | 46 | //! @} 47 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/spglue_kron_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup spglue_kron 20 | //! @{ 21 | 22 | 23 | 24 | class spglue_kron 25 | { 26 | public: 27 | 28 | template 29 | struct traits 30 | { 31 | static constexpr bool is_row = (T1::is_row && T2::is_row); 32 | static constexpr bool is_col = (T1::is_col && T2::is_col); 33 | static constexpr bool is_xvec = false; 34 | }; 35 | 36 | template 37 | inline static void apply(SpMat& out, const SpGlue& X); 38 | 39 | template 40 | inline static void apply_noalias(SpMat& out, const SpMat& A, const SpMat& B); 41 | }; 42 | 43 | 44 | 45 | //! @} 46 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/spglue_merge_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup spglue_merge 20 | //! @{ 21 | 22 | 23 | 24 | class spglue_merge 25 | { 26 | public: 27 | 28 | template 29 | inline static void subview_merge(SpSubview& sv, const SpMat& B); 30 | 31 | template 32 | inline static void subview_merge(SpSubview& sv, const Mat& B); 33 | 34 | template 35 | inline static void symmat_merge(SpMat& out, const SpMat& A, const SpMat& B); 36 | 37 | template 38 | inline static void diagview_merge(SpMat& out, const SpMat& A, const SpMat& B); 39 | }; 40 | 41 | 42 | 43 | //! @} 44 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/spop_htrans_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup spop_htrans 20 | //! @{ 21 | 22 | 23 | //! hermitian transpose operation for sparse matrices 24 | 25 | class spop_htrans 26 | { 27 | public: 28 | 29 | template 30 | struct traits 31 | { 32 | static constexpr bool is_row = T1::is_col; // deliberately swapped 33 | static constexpr bool is_col = T1::is_row; 34 | static constexpr bool is_xvec = T1::is_xvec; 35 | }; 36 | 37 | template 38 | inline static void apply(SpMat& out, const SpOp& in, const typename arma_not_cx::result* junk = nullptr); 39 | 40 | template 41 | inline static void apply(SpMat& out, const SpOp& in, const typename arma_cx_only::result* junk = nullptr); 42 | }; 43 | 44 | 45 | 46 | //! @} 47 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/spop_norm_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup spop_norm 20 | //! @{ 21 | 22 | 23 | class spop_norm 24 | : public traits_op_default 25 | { 26 | public: 27 | 28 | template inline static typename get_pod_type::result mat_norm_1(const SpMat& X); 29 | 30 | template inline static typename get_pod_type::result mat_norm_2(const SpMat& X, const typename arma_real_only::result* junk = nullptr); 31 | template inline static typename get_pod_type::result mat_norm_2(const SpMat& X, const typename arma_cx_only::result* junk = nullptr); 32 | 33 | template inline static typename get_pod_type::result mat_norm_inf(const SpMat& X); 34 | 35 | template inline static typename get_pod_type::result vec_norm_k(const eT* mem, const uword N, const uword k); 36 | }; 37 | 38 | 39 | //! @} 40 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/spop_normalise_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup spop_normalise 20 | //! @{ 21 | 22 | 23 | class spop_normalise 24 | : public traits_op_passthru 25 | { 26 | public: 27 | 28 | template 29 | inline static void apply(SpMat& out, const SpOp& expr); 30 | 31 | template 32 | inline static void apply_direct(SpMat& out, const SpMat& X, const uword p); 33 | }; 34 | 35 | 36 | 37 | //! @} 38 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/spop_repmat_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup spop_repmat 20 | //! @{ 21 | 22 | 23 | 24 | class spop_repmat 25 | : public traits_op_default 26 | { 27 | public: 28 | 29 | template 30 | inline static void apply(SpMat& out, const SpOp& X); 31 | 32 | template 33 | inline static void apply_noalias(SpMat& out, const uword A_n_rows, const uword A_n_cols, const SpMat& B); 34 | }; 35 | 36 | 37 | 38 | //! @} 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/spop_reverse_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup spop_reverse 20 | //! @{ 21 | 22 | 23 | class spop_reverse 24 | : public traits_op_passthru 25 | { 26 | public: 27 | 28 | template 29 | inline static void apply_spmat(SpMat& out, const SpMat& X, const uword dim); 30 | 31 | template 32 | inline static void apply_proxy(SpMat& out, const T1& X, const uword dim); 33 | 34 | template 35 | inline static void apply(SpMat& out, const SpOp& in); 36 | }; 37 | 38 | 39 | 40 | //! @} 41 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/spop_shift_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | 20 | //! \addtogroup spop_shift 21 | //! @{ 22 | 23 | 24 | 25 | class spop_shift 26 | : public traits_op_default 27 | { 28 | public: 29 | 30 | template inline static void apply_noalias(SpMat& out, const SpMat& X, const uword len, const uword neg, const uword dim); 31 | }; 32 | 33 | 34 | 35 | //! @} 36 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/spop_strans_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup spop_strans 20 | //! @{ 21 | 22 | 23 | //! simple transpose operation (no complex conjugates) for sparse matrices 24 | 25 | class spop_strans 26 | { 27 | public: 28 | 29 | template 30 | struct traits 31 | { 32 | static constexpr bool is_row = T1::is_col; // deliberately swapped 33 | static constexpr bool is_col = T1::is_row; 34 | static constexpr bool is_xvec = T1::is_xvec; 35 | }; 36 | 37 | template 38 | inline static void apply_noalias(SpMat& B, const SpMat& A); 39 | 40 | template 41 | inline static void apply(SpMat& out, const SpOp& in); 42 | 43 | template 44 | inline static void apply(SpMat& out, const SpOp& in); 45 | }; 46 | 47 | 48 | 49 | //! @} 50 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/spop_symmat_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup spop_symmat 20 | //! @{ 21 | 22 | 23 | 24 | class spop_symmat 25 | : public traits_op_default 26 | { 27 | public: 28 | 29 | template 30 | inline static void apply(SpMat& out, const SpOp& in); 31 | }; 32 | 33 | 34 | 35 | class spop_symmat_cx 36 | : public traits_op_default 37 | { 38 | public: 39 | 40 | template 41 | inline static void apply(SpMat& out, const SpOp& in); 42 | }; 43 | 44 | 45 | 46 | //! @} 47 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/wall_clock_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup wall_clock 20 | //! @{ 21 | 22 | 23 | //! Class for measuring time intervals 24 | class wall_clock 25 | { 26 | public: 27 | 28 | inline wall_clock(); 29 | inline ~wall_clock(); 30 | 31 | inline void tic(); //!< start the timer 32 | arma_warn_unused inline double toc(); //!< return the number of seconds since the last call to tic() 33 | 34 | 35 | private: 36 | 37 | std::chrono::steady_clock::time_point chrono_time1; 38 | 39 | bool valid = false; 40 | }; 41 | 42 | 43 | //! @} 44 | -------------------------------------------------------------------------------- /inst/include/armadillo_bits/xvec_htrans_bones.hpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // 3 | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 | // Copyright 2008-2016 National ICT Australia (NICTA) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------ 17 | 18 | 19 | //! \addtogroup xvec_htrans 20 | //! @{ 21 | 22 | 23 | template 24 | class xvec_htrans : public Base< eT, xvec_htrans > 25 | { 26 | public: 27 | 28 | typedef eT elem_type; 29 | typedef typename get_pod_type::result pod_type; 30 | 31 | static constexpr bool is_row = false; 32 | static constexpr bool is_col = false; 33 | static constexpr bool is_xvec = true; 34 | 35 | arma_aligned const eT* const mem; 36 | 37 | const uword n_rows; 38 | const uword n_cols; 39 | const uword n_elem; 40 | 41 | 42 | inline explicit xvec_htrans(const eT* const in_mem, const uword in_n_rows, const uword in_n_cols); 43 | 44 | inline void extract(Mat& out) const; 45 | 46 | inline eT operator[](const uword ii) const; 47 | inline eT at_alt (const uword ii) const; 48 | 49 | inline eT at (const uword in_row, const uword in_col) const; 50 | }; 51 | 52 | 53 | 54 | //! @} 55 | -------------------------------------------------------------------------------- /inst/skeleton/Makevars: -------------------------------------------------------------------------------- 1 | 2 | ## With R 3.1.0 or later, you can uncomment the following line to tell R to 3 | ## enable compilation with C++11 (where available) 4 | ## 5 | ## Also, OpenMP support in Armadillo prefers C++11 support. However, for wider 6 | ## availability of the package we do not yet enforce this here. It is however 7 | ## recommended for client packages to set it. 8 | ## 9 | ## And with R 3.4.0, and RcppArmadillo 0.7.960.*, we turn C++11 on as OpenMP 10 | ## support within Armadillo prefers / requires it 11 | ## 12 | ## R 4.0.0 made C++11 the default, R 4.1.0 switched to C++14, R 4.3.0 to C++17 13 | ## _In general_ we should no longer need to set a standard as any recent R 14 | ## installation will do the right thing. Should you need it, uncomment it and 15 | ## set the appropriate value, possibly CXX17. 16 | #CXX_STD = CXX11 17 | 18 | PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS) 19 | PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) 20 | -------------------------------------------------------------------------------- /inst/skeleton/Makevars.win: -------------------------------------------------------------------------------- 1 | 2 | ## With R 3.1.0 or later, you can uncomment the following line to tell R to 3 | ## enable compilation with C++11 (where available) 4 | ## 5 | ## Also, OpenMP support in Armadillo prefers C++11 support. However, for wider 6 | ## availability of the package we do not yet enforce this here. It is however 7 | ## recommended for client packages to set it. 8 | ## 9 | ## And with R 3.4.0, and RcppArmadillo 0.7.960.*, we turn C++11 on as OpenMP 10 | ## support within Armadillo prefers / requires it 11 | ## 12 | ## R 4.0.0 made C++11 the default, R 4.1.0 switched to C++14, R 4.3.0 to C++17 13 | ## _In general_ we should no longer need to set a standard as any recent R 14 | ## installation will do the right thing. Should you need it, uncomment it and 15 | ## set the appropriate value, possibly CXX17. 16 | #CXX_STD = CXX11 17 | 18 | PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS) 19 | PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) 20 | -------------------------------------------------------------------------------- /inst/skeleton/rcpparma_hello_world.Rd: -------------------------------------------------------------------------------- 1 | \name{RcppArmadillo-Functions} 2 | \alias{rcpparma_hello_world} 3 | \alias{rcpparma_innerproduct} 4 | \alias{rcpparma_outerproduct} 5 | \alias{rcpparma_bothproducts} 6 | \title{Set of functions in example RcppArmadillo package} 7 | \description{ 8 | These four functions are created when 9 | \code{RcppArmadillo.package.skeleton()} is invoked to create a 10 | skeleton packages. 11 | } 12 | \usage{ 13 | rcpparma_hello_world() 14 | rcpparma_outerproduct(x) 15 | rcpparma_innerproduct(x) 16 | rcpparma_bothproducts(x) 17 | } 18 | \arguments{ 19 | \item{x}{a numeric vector} 20 | } 21 | \value{ 22 | \code{rcpparma_hello_world()} does not return a value, but displays a 23 | message to the console. 24 | 25 | \code{rcpparma_outerproduct()} returns a numeric matrix computed as the 26 | outer (vector) product of \code{x}. 27 | 28 | \code{rcpparma_innerproduct()} returns a double computer as the inner 29 | (vector) product of \code{x}. 30 | 31 | \code{rcpparma_bothproducts()} returns a list with both the outer and 32 | inner products. 33 | 34 | } 35 | \details{ 36 | These are example functions which should be largely 37 | self-explanatory. Their main benefit is to demonstrate how to write a 38 | function using the Armadillo C++ classes, and to have to such a 39 | function accessible from R. 40 | } 41 | \references{ 42 | See the documentation for Armadillo, and RcppArmadillo, for more details. 43 | } 44 | \examples{ 45 | x <- sqrt(1:4) 46 | rcpparma_innerproduct(x) 47 | rcpparma_outerproduct(x) 48 | } 49 | \author{Dirk Eddelbuettel} 50 | 51 | -------------------------------------------------------------------------------- /inst/skeleton/rcpparma_hello_world.cpp: -------------------------------------------------------------------------------- 1 | // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- 2 | 3 | // we only include RcppArmadillo.h which pulls Rcpp.h in for us 4 | #include "RcppArmadillo.h" 5 | 6 | // via the depends attribute we tell Rcpp to create hooks for 7 | // RcppArmadillo so that the build process will know what to do 8 | // 9 | // [[Rcpp::depends(RcppArmadillo)]] 10 | 11 | // simple example of creating two matrices and 12 | // returning the result of an operatioon on them 13 | // 14 | // via the exports attribute we tell Rcpp to make this function 15 | // available from R 16 | // 17 | // [[Rcpp::export]] 18 | arma::mat rcpparma_hello_world() { 19 | arma::mat m1 = arma::eye(3, 3); 20 | arma::mat m2 = arma::eye(3, 3); 21 | 22 | return m1 + 3 * (m1 + m2); 23 | } 24 | 25 | 26 | // another simple example: outer product of a vector, 27 | // returning a matrix 28 | // 29 | // [[Rcpp::export]] 30 | arma::mat rcpparma_outerproduct(const arma::colvec & x) { 31 | arma::mat m = x * x.t(); 32 | return m; 33 | } 34 | 35 | // and the inner product returns a scalar 36 | // 37 | // [[Rcpp::export]] 38 | double rcpparma_innerproduct(const arma::colvec & x) { 39 | double v = arma::as_scalar(x.t() * x); 40 | return v; 41 | } 42 | 43 | 44 | // and we can use Rcpp::List to return both at the same time 45 | // 46 | // [[Rcpp::export]] 47 | Rcpp::List rcpparma_bothproducts(const arma::colvec & x) { 48 | arma::mat op = x * x.t(); 49 | double ip = arma::as_scalar(x.t() * x); 50 | return Rcpp::List::create(Rcpp::Named("outer")=op, 51 | Rcpp::Named("inner")=ip); 52 | } 53 | -------------------------------------------------------------------------------- /inst/tinytest/cpp/any_as_vec.cpp: -------------------------------------------------------------------------------- 1 | // [[Rcpp::depends(RcppArmadillo)]] 2 | #define RCPP_ARMADILLO_RETURN_ANYVEC_AS_VECTOR 3 | 4 | #include 5 | 6 | using namespace Rcpp; 7 | 8 | // [[Rcpp::export]] 9 | arma::vec veccany_as_v_test(arma::vec v) { return(v); } 10 | 11 | // [[Rcpp::export]] 12 | arma::rowvec vecrany_as_v_test(arma::rowvec v) { return(v); } 13 | -------------------------------------------------------------------------------- /inst/tinytest/cpp/colrow_as_vec.cpp: -------------------------------------------------------------------------------- 1 | // [[Rcpp::depends(RcppArmadillo)]] 2 | #define RCPP_ARMADILLO_RETURN_COLVEC_AS_VECTOR 3 | #define RCPP_ARMADILLO_RETURN_ROWVEC_AS_VECTOR 4 | #include 5 | 6 | using namespace Rcpp; 7 | 8 | // [[Rcpp::export]] 9 | arma::vec vecc_as_v_test(arma::vec v) { return(v); } 10 | 11 | // [[Rcpp::export]] 12 | arma::rowvec vecr_as_v_test(arma::rowvec v) { return(v); } 13 | -------------------------------------------------------------------------------- /inst/tinytest/cpp/rmultinom.cpp: -------------------------------------------------------------------------------- 1 | // [[Rcpp::depends(RcppArmadillo)]] 2 | #include 3 | #include 4 | 5 | using namespace Rcpp; 6 | 7 | // [[Rcpp::export]] 8 | IntegerVector rmultinomC(int n, int size, NumericVector prob) { 9 | IntegerMatrix draws(prob.size(), n); 10 | // FixProb modifies in-place 11 | arma::colvec fixprob(prob.begin(), prob.size()); // forced copy 12 | RcppArmadillo::FixProb(fixprob, 1, true); 13 | NumericVector newprob(Rcpp::wrap(fixprob)); 14 | RNGScope scope; 15 | for (int ii=0; ii. 21 | 22 | // [[Rcpp::depends(RcppArmadillo)]] 23 | #include 24 | 25 | // [[Rcpp::export]] 26 | int setSeed(int val) { 27 | arma::arma_rng::set_seed(val); // should trigger warning 28 | return 0; 29 | } 30 | 31 | // [[Rcpp::export]] 32 | arma::vec randu(int n) { 33 | return arma::randu(n); 34 | } 35 | 36 | // [[Rcpp::export]] 37 | arma::ivec randi(int n) { 38 | return arma::randi(n); 39 | } 40 | 41 | // [[Rcpp::export]] 42 | arma::vec randn(int n) { 43 | return arma::randn(n); 44 | } 45 | -------------------------------------------------------------------------------- /inst/tinytest/test_misc.R: -------------------------------------------------------------------------------- 1 | #!/usr/bin/r -t 2 | # 3 | # Copyright (C) 2021-2023 Dirk Eddelbuettel 4 | # 5 | # This file is part of RcppArmadillo. 6 | # 7 | # RcppArmadillo is free software: you can redistribute it and/or modify it 8 | # under the terms of the GNU General Public License as published by 9 | # the Free Software Foundation, either version 2 of the License, or 10 | # (at your option) any later version. 11 | # 12 | # RcppArmadillo is distributed in the hope that it will be useful, but 13 | # WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | # GNU General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU General Public License 18 | # along with RcppArmadillo. If not, see . 19 | 20 | library(RcppArmadillo) 21 | 22 | ## -- src/RcppArmadillo.cpp 23 | arma <- armadillo_version(FALSE) 24 | expect_equal(length(arma), 3) # major minor patch 25 | expect_equal(names(arma), c("major","minor","patch")) 26 | arma <- armadillo_version(TRUE) 27 | expect_equal(class(arma), "integer") 28 | expect_equal(length(arma), 1L) 29 | 30 | ## no tests as we have no (current) accessor as we prefer R RNGs 31 | expect_warning(armadillo_set_seed_random()) 32 | armadillo_set_seed(42L) # no test as we have no (current) accessor as we prefer R RNGs 33 | 34 | 35 | ## -- R/flags.R 36 | cxxflags <- RcppArmadillo:::RcppArmadilloCxxFlags() 37 | expect_true(is.character(cxxflags)) 38 | expect_stdout(RcppArmadillo:::CxxFlags()) 39 | 40 | ## 'set number of threads' helper -- adding simple test 41 | expect_true(is.integer(armadillo_get_number_of_omp_threads())) 42 | expect_silent(armadillo_set_number_of_omp_threads(2)) 43 | ## startup throttle/restore helpers 44 | expect_silent(armadillo_throttle_cores()) 45 | expect_silent(armadillo_reset_cores()) 46 | -------------------------------------------------------------------------------- /local/armafield.cpp: -------------------------------------------------------------------------------- 1 | 2 | // [[Rcpp::depends(RcppArmadillo)]] 3 | 4 | #include 5 | 6 | using namespace arma; 7 | 8 | // [[Rcpp::export]] 9 | SEXP field2x2() { 10 | mat A = randn(2,3); 11 | mat B = randn(3,2); 12 | 13 | field F(2,2); 14 | F(0,1) = A; 15 | F(1,0) = B; 16 | 17 | F.print("F2x2:"); 18 | return Rcpp::wrap(F); 19 | } 20 | 21 | // [[Rcpp::export]] 22 | SEXP field2x3() { 23 | mat A = randn(2,3); 24 | mat B = randn(3,2); 25 | mat C = randn(2,4); 26 | 27 | field F(2,3); 28 | F(0,1) = A; 29 | F(1,0) = B; 30 | F(1,2) = C; 31 | 32 | F.print("F2x3:"); 33 | return Rcpp::wrap(F); 34 | } 35 | 36 | // [[Rcpp::export]] 37 | SEXP field2x3x2() { 38 | mat A = randn(2,3); 39 | mat B = randn(3,2); 40 | mat C = randn(2,4); 41 | 42 | field F(2,3,2); 43 | F(0,1,0) = A; 44 | F(1,0,1) = B; 45 | F(1,2,0) = C; 46 | 47 | F.print("F2x3x2:"); 48 | return Rcpp::wrap(F); 49 | } 50 | 51 | /*** R 52 | a1 <- field2x2(); 53 | print(a1[[3]]) 54 | a2 <- field2x3(); 55 | a3 <- field2x3x2(); 56 | */ 57 | -------------------------------------------------------------------------------- /local/rcpparma375.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | 5 | // [[Rcpp::export]] 6 | void rcpparma375(int nthreads) { 7 | omp_set_num_threads(nthreads); 8 | #pragma omp parallel for 9 | for (int i = 0; i < 5; i++){ 10 | int tid = omp_get_thread_num(); 11 | std::cout << tid << "\t tid" << std::endl; 12 | int nThreads = omp_get_num_threads(); 13 | std::cout << nThreads << "\t nThreads" << std::endl; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /man/armadillo_get_number_of_omp_threads.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/RcppExports.R 3 | \name{armadillo_get_number_of_omp_threads} 4 | \alias{armadillo_get_number_of_omp_threads} 5 | \alias{armadillo_set_number_of_omp_threads} 6 | \title{Report (or Set) Maximum Number of OpenMP Threads} 7 | \usage{ 8 | armadillo_get_number_of_omp_threads() 9 | 10 | armadillo_set_number_of_omp_threads(n) 11 | } 12 | \arguments{ 13 | \item{n}{Number of threads to be set} 14 | } 15 | \value{ 16 | For the getter, and on a system with OpenMP, the maximum 17 | number of threads that OpenMP may be using and on systems without it, 18 | one. The setter does not return a value. 19 | } 20 | \description{ 21 | Report (or Set) Maximum Number of OpenMP Threads 22 | } 23 | -------------------------------------------------------------------------------- /man/armadillo_set_seed.Rd: -------------------------------------------------------------------------------- 1 | \name{armadillo_set_seed} 2 | \alias{armadillo_set_seed} 3 | \title{Set the Armadillo Random Number Generator to the given value} 4 | \usage{ 5 | armadillo_set_seed(val) 6 | } 7 | \arguments{ 8 | \item{val}{The seed used to initialize Armadillo's random 9 | number generator.} 10 | } 11 | \value{ 12 | The function is invoked for its side effect and has no 13 | return value. 14 | } 15 | \description{ 16 | Set the Armadillo Random Number Generator to the given 17 | value 18 | } 19 | \details{ 20 | Depending on whether RcppArmadillo was compiled for the C++98 standard 21 | (currently the default) or for C++11 (optional), two different RNGs may be used. 22 | This function resets either. For C++98, the R programming language's RNG is used. 23 | For C++11, the RNG included in the \code{} library is used only when 24 | \code{#define ARMA_USE_CXX11_RNG} is placed before \code{#include }. 25 | Otherwise, the R programming language's RNG will be used. 26 | } 27 | \note{ 28 | This has been found to not work as espected in 29 | \pkg{RStudio} as its code also uses the system RNG library. 30 | You may have to either not run within \pkg{RStudio} or 31 | change your code to use a different RNG such as the one 32 | from R. 33 | } 34 | \seealso{ 35 | The R documentation on its RNGs all of which are accessible 36 | via \pkg{Rcpp}. 37 | } 38 | 39 | -------------------------------------------------------------------------------- /man/armadillo_set_seed_random.Rd: -------------------------------------------------------------------------------- 1 | \name{armadillo_set_seed_random} 2 | \alias{armadillo_set_seed_random} 3 | \title{Set the Armadillo Random Number Generator to a random value} 4 | \usage{ 5 | armadillo_set_seed_random() 6 | } 7 | \value{ 8 | The function is invoked for its side effect and has no 9 | return value. 10 | } 11 | \description{ 12 | Set the Armadillo Random Number Generator to a random value 13 | } 14 | \details{ 15 | Depending on whether RcppArmadillo was compiled for the C++98 standard 16 | (currently the default) or for C++11 (optional), two different RNGs may be used. 17 | This function resets either. For C++98, the R programming language's RNG is used. 18 | For C++11, the RNG included in the \code{} library is used only when 19 | \code{#define ARMA_USE_CXX11_RNG} is placed before \code{#include }. 20 | Otherwise, the R programming language's RNG will be used. 21 | } 22 | \note{ 23 | This has been found to not work as espected in 24 | \pkg{RStudio} as its code also uses the system RNG library. 25 | You may have to either not run within \pkg{RStudio} or 26 | change your code to use a different RNG such as the one 27 | from R. 28 | } 29 | \seealso{ 30 | The R documentation on its RNGs all of which are accessible 31 | via \pkg{Rcpp}. 32 | } 33 | 34 | -------------------------------------------------------------------------------- /man/armadillo_throttle_cores.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/init.R 3 | \name{armadillo_throttle_cores} 4 | \alias{armadillo_throttle_cores} 5 | \alias{armadillo_reset_cores} 6 | \title{Throttle (or Reset) (Rcpp)Armadillo to Two Cores} 7 | \usage{ 8 | armadillo_throttle_cores(n = 2) 9 | 10 | armadillo_reset_cores() 11 | } 12 | \arguments{ 13 | \item{n}{Integer value of desired cores, default is two} 14 | } 15 | \description{ 16 | Helper functions to throttle use of cores by RcppArmadillo-internal 17 | code on systems with OpenMP. On package load, the initial value is 18 | saved and used to reset the value. 19 | } 20 | -------------------------------------------------------------------------------- /man/armadillo_version.Rd: -------------------------------------------------------------------------------- 1 | \name{armadillo_version} 2 | \alias{armadillo_version} 3 | \title{Report the version of Armadillo} 4 | \usage{ 5 | armadillo_version(single) 6 | } 7 | \arguments{ 8 | \item{single}{A logical vector indicating whether a 9 | single return values is requested, or a named vector with 10 | three elements \code{major}, \code{minor} and 11 | \code{patch}.} 12 | } 13 | \value{ 14 | Depending on the value of \code{single}, either a single 15 | number describing the Armadillo version or a named vector 16 | with three elements \code{major}, \code{minor} and 17 | \code{patch}. 18 | } 19 | \description{ 20 | Report the version of Armadillo 21 | } 22 | \details{ 23 | The version is defined by Armadillo in the header 24 | \code{arma_version.hpp}. 25 | } 26 | \seealso{ 27 | Armadillo header file \code{arma_version.hpp}. 28 | } 29 | 30 | -------------------------------------------------------------------------------- /src/Makevars.in: -------------------------------------------------------------------------------- 1 | ## -*- mode: makefile; -*- 2 | 3 | PKG_CPPFLAGS = -I../inst/include 4 | PKG_CXXFLAGS = @OPENMP_FLAG@ 5 | PKG_LIBS= @OPENMP_FLAG@ $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) 6 | 7 | ## With R 3.1.0 or later, you can uncomment the following line to tell R to 8 | ## enable compilation with C++11 (where available) 9 | ## 10 | ## Also, OpenMP support in Armadillo prefers C++11 support. However, for wider 11 | ## availability of the package we do not yet enforce this here. It is however 12 | ## recommended for client packages to set it. 13 | ## 14 | ## And with R 3.4.0, and RcppArmadillo 0.7.960.*, we turn C++11 on as OpenMP 15 | ## support within Armadillo prefers / requires it 16 | ## 17 | ## R 4.0.0 made C++11 the default, R 4.1.0 switched to C++14, R 4.3.0 to C++17 18 | ## _In general_ we should no longer need to set a standard as any recent R 19 | ## installation will do the right thing. Should you need it, uncomment it and 20 | ## set the appropriate value, possibly CXX17. 21 | -------------------------------------------------------------------------------- /src/Makevars.win: -------------------------------------------------------------------------------- 1 | ## -*- mode: makefile; -*- 2 | 3 | PKG_CXXFLAGS = -I../inst/include -I. $(SHLIB_OPENMP_CXXFLAGS) 4 | PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) 5 | 6 | ## With R 3.1.0 or later, you can uncomment the following line to tell R to 7 | ## enable compilation with C++11 (where available) 8 | ## 9 | ## Also, OpenMP support in Armadillo prefers C++11 support. However, for wider 10 | ## availability of the package we do not yet enforce this here. It is however 11 | ## recommended for client packages to set it. 12 | ## 13 | ## And with R 3.4.0, and RcppArmadillo 0.7.960.*, we turn C++11 on as OpenMP 14 | ## support within Armadillo prefers / requires it 15 | ## 16 | ## R 4.0.0 made C++11 the default, R 4.1.0 switched to C++14, R 4.3.0 to C++17 17 | ## _In general_ we should no longer need to set a standard as any recent R 18 | ## installation will do the right thing. Should you need it, uncomment it and 19 | ## set the appropriate value, possibly CXX17. 20 | -------------------------------------------------------------------------------- /src/fastLm.cpp: -------------------------------------------------------------------------------- 1 | // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- 2 | // 3 | // fastLm.cpp: Rcpp/Armadillo glue example of a simple lm() alternative 4 | // 5 | // Copyright (C) 2010 - 2024 Dirk Eddelbuettel, Romain Francois and Douglas Bates 6 | // 7 | // This file is part of RcppArmadillo. 8 | // 9 | // RcppArmadillo is free software: you can redistribute it and/or modify it 10 | // under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 2 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // RcppArmadillo is distributed in the hope that it will be useful, but 15 | // WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with RcppArmadillo. If not, see . 21 | 22 | #include 23 | 24 | // [[Rcpp::export]] 25 | Rcpp::List fastLm_impl(const arma::mat& X, const arma::colvec& y) { 26 | int n = X.n_rows, k = X.n_cols; 27 | 28 | arma::colvec coef = arma::solve(X, y); // fit model y ~ X 29 | arma::colvec res = y - X*coef; // residuals 30 | double s2 = arma::dot(res, res) / (n - k); // std.errors of coefficients 31 | arma::colvec std_err = arma::sqrt(s2 * arma::diagvec(arma::pinv(arma::trans(X)*X))); 32 | 33 | return Rcpp::List::create(Rcpp::Named("coefficients") = coef, 34 | Rcpp::Named("stderr") = std_err, 35 | Rcpp::Named("df.residual") = n - k); 36 | } 37 | -------------------------------------------------------------------------------- /tests/tinytest.R: -------------------------------------------------------------------------------- 1 | 2 | if (requireNamespace("tinytest", quietly=TRUE)) { 3 | tinytest::test_package("RcppArmadillo") 4 | } 5 | -------------------------------------------------------------------------------- /vignettes/RcppArmadillo-intro.Rnw: -------------------------------------------------------------------------------- 1 | \documentclass{article} 2 | \usepackage{pdfpages} 3 | %\VignetteIndexEntry{RcppArmadillo-introduction} 4 | %\VignetteKeywords{R, C++, Armadillo, linear algebra, kalman filter} 5 | %\VignettePackage{RcppArmadillo} 6 | %\VignetteEncoding{UTF-8} 7 | 8 | \begin{document} 9 | \includepdf[pages=-, fitpaper=true]{pdf/RcppArmadillo-intro.pdf} 10 | \end{document} 11 | -------------------------------------------------------------------------------- /vignettes/RcppArmadillo-sparseMatrix.Rnw: -------------------------------------------------------------------------------- 1 | \documentclass{article} 2 | \usepackage{pdfpages} 3 | %\VignetteIndexEntry{RcppArmadillo-sparseMatrix} 4 | %\VignetteKeywords{R, C++, Armadillo, linear algebra, sparse matrix} 5 | %\VignettePackage{RcppArmadillo} 6 | %\VignetteEncoding{UTF-8} 7 | 8 | \begin{document} 9 | \includepdf[pages=-, fitpaper=true]{pdf/RcppArmadillo-sparseMatrix.pdf} 10 | \end{document} 11 | -------------------------------------------------------------------------------- /vignettes/pdf/RcppArmadillo-intro.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RcppCore/RcppArmadillo/66dcdb5e878b391cd44a8c2854898abd002272ed/vignettes/pdf/RcppArmadillo-intro.pdf -------------------------------------------------------------------------------- /vignettes/pdf/RcppArmadillo-sparseMatrix.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RcppCore/RcppArmadillo/66dcdb5e878b391cd44a8c2854898abd002272ed/vignettes/pdf/RcppArmadillo-sparseMatrix.pdf -------------------------------------------------------------------------------- /vignettes/rmd/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ## This Makefile is not included in the package sources so we can use GNUmake idioms. Yay. 3 | 4 | rmdsources := $(wildcard *.Rmd) 5 | rmdvignettes := $(rmdsources:.Rmd=.pdf) 6 | 7 | %.pdf: %.Rmd 8 | Rscript -e 'rmarkdown::render("$<")' 9 | Rscript -e 'tools::compactPDF("$@", gs_quality="ebook")' 10 | cp -vax $@ ../pdf 11 | 12 | all: ${rmdvignettes} RcppArmadillo-intro.pdf 13 | 14 | RcppArmadillo-intro.tex: RcppArmadillo-intro.Rnw 15 | Rscript -e 'Sweave("$<")' 16 | 17 | RcppArmadillo-intro.pdf: RcppArmadillo-intro.tex 18 | Rscript -e 'tools::texi2pdf("$<", texi2dvi="pdflatex")' 19 | Rscript -e 'tools::texi2pdf("$<", texi2dvi="pdflatex")' 20 | Rscript -e 'tools::compactPDF("$@", gs_quality="ebook")' 21 | cp -vax $@ ../pdf 22 | 23 | clean: 24 | @rm -rf *.aux *.log *.out *.tex *.spl Rcpp*.pdf \ 25 | RcppArmadillo*_cache pinp.cls jss.bst 26 | -------------------------------------------------------------------------------- /vignettes/rmd/kalmanExample.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RcppCore/RcppArmadillo/66dcdb5e878b391cd44a8c2854898abd002272ed/vignettes/rmd/kalmanExample.pdf --------------------------------------------------------------------------------