楼主: tulipsliu
1249 30

[程序分享] 近期即将分享的一些代码待续…… [推广有奖]

11
tulipsliu 在职认证  发表于 2020-12-4 17:33:23
stan_files/forecastCCC.cc:25:89:   required from here
   D:/softApp/R/library/RcppEigen/include/Eigen/src/Core/DenseCoeffsBase.h:55:30: warning: ignoring attributes on template argument 'Eigen::internal::packet_traits<double>::type' {aka '__vector(2) double'} [-Wignored-attributes]
   In file included from D:/softApp/R/library/RcppEigen/include/Eigen/Core:494,
                    from D:/softApp/R/library/RcppEigen/include/Eigen/Dense:1,
                    from D:/softApp/R/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13,
                    from D:/softApp/R/library/rstan/include/rstan/rstaninc.hpp:3,
                    from stan_files/forecastCCC.hpp:18,
                    from stan_files/forecastCCC.cc:3:
   D:/softApp/R/library/RcppEigen/include/Eigen/src/Core/products/GeneralMatrixVector.h: In instantiation of 'struct Eigen::internal::general_matrix_vector_product<long long int, double, Eigen::internal::const_blas_data_mapper<double, long long int, 0>, 0, false, double, Eigen::internal::const_blas_data_mapper<double, long long int, 1>, false, 1>':
   D:/softApp/R/library/RcppEigen/include/Eigen/src/Core/products/TriangularMatrixVector.h:74:123:   required from 'static void Eigen::internal::triangular_matrix_vector_product<Index, Mode, LhsScalar, ConjLhs, RhsScalar, ConjRhs, 0, Version>::run(Index, Index, const LhsScalar*, Index, const RhsScalar*, Index, Eigen::internal::triangular_matrix_vector_product<Index, Mode, LhsScalar, ConjLhs, RhsScalar, ConjRhs, 0, Version>::ResScalar*, Index, const RhsScalar&) [with Index = long long int; int Mode = 1; LhsScalar = double; bool ConjLhs = false; RhsScalar = double; bool ConjRhs = false; int Version = 0; Eigen::internal::triangular_matrix_vector_product<Index, Mode, LhsScalar, ConjLhs, RhsScalar, ConjRhs, 0, Version>::ResScalar = double]'
D:   D:/softApp/R/library/RcppEigen/include/Eigen/src/Core/products/TriangularMatrixVector.h:266:12:   required from 'static void Eigen::internal::trmv_selector<Mode, 0>::run(const Lhs&, const Rhs&, Dest&, const typename Dest::Scalar&) [with Lhs = Eigen::Matrix<double, -1, -1>; Rhs = Eigen::Matrix<double, -1, 1>; Dest = Eigen::Matrix<double, -1, 1>; int Mode = 1; typename Dest::Scalar = double]'
   D:/softApp/R/library/RcppEigen/include/Eigen/src/Core/products/TriangularMatrixVector.h:180:109:   required from 'static void Eigen::internal::triangular_product_impl<Mode, true, Lhs, false, Rhs, true>::run(Dest&, const Lhs&, const Rhs&, const typename Dest::Scalar&) [with Dest = Eigen::Matrix<double, -1, 1>; int Mode = 1; Lhs = const Eigen::Matrix<double, -1, -1>; Rhs = Eigen::Matrix<double, -1, 1>; typename Dest::Scalar = double]'

12
tulipsliu 在职认证  发表于 2020-12-4 17:33:41
, Eigen::Matrix<double, -1, 1>, 0>]'
   D:/softApp/R/library/RcppEigen/include/Eigen/src/Core/Product.h:132:22:   required from 'Eigen::internal::dense_product_base<Lhs, Rhs, Option, 6>::operator const Scalar() const [with Lhs = Eigen::Product<Eigen::CwiseBinaryOp<Eigen::internal::scalar_product_op<double, double>, const Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>, const Eigen::Matrix<double, 1, -1> >, const Eigen::Transpose<Eigen::Matrix<double, -1, 1> > >, Eigen::Matrix<double, -1, -1>, 0>; Rhs = Eigen::Matrix<double, -1, 1>; int Option = 0; Eigen::internal::dense_product_base<Lhs, Rhs, Option, 6>::Scalar = double]'
   D:/softApp/R/library/StanHeaders/include/src/stan/mcmc/hmc/hamiltonians/dense_e_metric.hpp:23:56:   required from 'double stan::mcmc::dense_e_metric<Model, BaseRNG>::T(stan::mcmc::dense_e_point&) [with Model = model_forecastCCC_namespace::model_forecastCCC; BaseRNG = boost::random::additive_combine_engine<boost::random::linear_congruential_engine<unsigned int, 40014, 0, 2147483563>, boost::random::linear_congruential_engine<unsigned int, 40692, 0, 2147483399> >]'
   D:/softApp/R/library/StanHeaders/include/src/stan/mcmc/hmc/hamiltonians/dense_e_metric.hpp:22:10:   required from here
   D:/softApp/R/library/RcppEigen/include/Eigen/src/Core/DenseCoeffsBase.h:55:30: warning: ignoring attributes on template argument 'Eigen::internal::packet_traits<double>::type' {aka '__vector(2) double'} [-Wignored-attributes]
   In file included from D:/softApp/R/library/StanHeaders/include/stan/math/rev/core.hpp:46,
                    from D:/softApp/R/library/StanHeaders/include/stan/math/rev/mat.hpp:6,
                    from D:/softApp/R/library/StanHeaders/include/src/stan/model/log_prob_grad.hpp:4,
                      from D:/softApp/R/library/StanHeaders/include/src/stan/model/test_gradients.hpp:7,
                    from D:/softApp/R/library/StanHeaders/include/src/stan/services/diagnose/diagnose.hpp:10,
                    from D:/softApp/R/library/rstan/include/rstan/stan_fit.hpp:35,
                    from D:/softApp/R/library/rstan/include/rstan/rstaninc.hpp:4,
                    from stan_files/forecastCCC.hpp:18,
                    from stan_files/forecastCCC.cc:3:
   D:/softApp/R/library/StanHeaders/include/stan/math/rev/core/set_zero_all_adjoints.hpp: At global scope:
   D:/softApp/R/library/StanHeaders/include/stan/math/rev/core/set_zero_all_adjoints.hpp:14:13: warning: 'void stan::math::set_zero_all_adjoints()' defined but not used [-Wunused-function]
    static void set_zero_all_adjoints() {
                ^~~~~~~~~~~~~~~~~~~~~
   
   
   "C:/rtools40/mingw64/bin/"g++  -std=gnu++14 -I"D:/softApp/R/include" -DNDEBUG -I"../inst/include" -I"D:/softApp/R/library/StanHeaders/include/src" -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG -I'D:/softApp/R/library/BH/include' -I'D:/softApp/R/library/Rcpp/include' -I'D:/softApp/R/library/RcppEigen/include' -I'D:/softApp/R/library/rstan/include' -I'D:/softApp/R/library/StanHeaders/include'        -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign -c init.cpp -o init.o

13
tulipsliu 在职认证  发表于 2020-12-4 17:34:05
C:/rtools40/mingw64/bin/g++ -shared -s -static-libgcc -o bmgarch.dll tmp.def stan_files/forecastBEKK.o stan_files/pdBEKKMGARCH.o stan_files/forecastDCC.o stan_files/CCCMGARCH.o stan_files/DCCMGARCH.o stan_files/BEKKMGARCH.o stan_files/forecastCCC.o init.o -LD:/softApp/R/bin/x64 -lR
rm   rm stan_files/BEKKMGARCH.cc stan_files/pdBEKKMGARCH.cc stan_files/CCCMGARCH.cc stan_files/forecastBEKK.cc stan_files/DCCMGARCH.cc stan_files/forecastDCC.cc stan_files/forecastCCC.cc
   installing to C:/Users/ADMINI~1/AppData/Local/Temp/RtmpQ1mR0n/devtools_install_4a78c177a65/00LOCK-bmgarch/00new/bmgarch/libs/x64
-  DONE (bmgarch) (338ms)
Loading required package: Rcpp
Registered S3 method overwritten by 'quantmod':
  method            from
  as.zoo.data.frame zoo
DIAGNOSTIC(S) FROM PARSER:
Info:
Left-hand side of sampling statement (~) may contain a non-linear transform of a parameter or local variable.
If it does, you need to include a target += statement with the log absolute determinant of the Jacobian of the transform.
Left-hand-side of sampling statement:
    ULs[k] ~ uniform(...)

DIAGNOSTIC(S) FROM PARSER:
Info:
Left-hand side of sampling statement (~) may contain a non-linear transform of a parameter or local variable.
If it does, you need to include a target += statement with the log absolute determinant of the Jacobian of the transform.
Left-hand-side of sampling statement:
    ULs[k] ~ uniform(...)

DIAGNOSTIC(S) FROM PARSER:
Info: integer division implicitly rounds to integer. Found int division: nt * nt - nt / 2
Positive values rounded down, negative values rounded up or down in platform-dependent way.

Writing NAMESPACE
Writing NAMESPACE
-- Running 42 example files ------------------------------------------------------------- bmgarch --
Loading bmgarch
DIAGNOSTIC(S) FROM PARSER:
Info:
Left-hand side of sampling statement (~) may contain a non-linear transform of a parameter or local variable.
If it does, you need to include a target += statement with the log absolute determinant of the Jacobian of the transform.
Left-hand-side of sampling statement:
    ULs[k] ~ uniform(...)

14
tulipsliu 在职认证  发表于 2020-12-4 17:34:34

DIAGNOSTIC(S) FROM PARSER:
Info:
Left-hand side of sampling statement (~) may contain a non-linear transform of a parameter or local variable.
If it does, you need to include a target += statement with the log absolute determinant of the Jacobian of the transform.
Left-hand-side of sampling statement:
    ULs[k] ~ uniform(...)

DIAGNOSTIC(S) FROM PARSER:
Info: integer division implicitly rounds to integer. Found int division: nt * nt - nt / 2
Positive values rounded down, negative values rounded up or down in platform-dependent way.

15
tulipsliu 在职认证  发表于 2020-12-4 17:34:58
Click the Refresh button to see progress of the chains
starting worker pid=18628 on localhost:11956 at 17:35:05.797
starting worker pid=17396 on localhost:11956 at 17:35:06.037
Registered S3 method overwritten by 'quantmod':
  method            from
  as.zoo.data.frame zoo
Registered S3 method overwritten by 'quantmod':
  method            from
  as.zoo.data.frame zoo

CHECKING DATA AND PREPROCESSING FOR MODEL 'CCCMGARCH' NOW.

COMPILING MODEL 'CCCMGARCH' NOW.

STARTING SAMPLER FOR MODEL 'CCCMGARCH' NOW.

SAMPLING FOR MODEL 'CCCMGARCH' NOW (CHAIN 1).
Chain 1:
Chain 1: Gradient evaluation took 0.001 seconds
Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 10 seconds.
Chain 1: Adjust your expectations accordingly!
Chain 1:
Chain 1:
Chain 1: WARNING: No variance estimation is
Chain 1:          performed for num_warmup < 20
Chain 1:
Chain 1: Iteration: 1 / 10 [ 10%]  (Warmup)
Chain 1: Iteration: 2 / 10 [ 20%]  (Warmup)
Chain 1: Iteration: 3 / 10 [ 30%]  (Warmup)
Chain 1: Iteration: 4 / 10 [ 40%]  (Warmup)
Chain 1: Iteration: 5 / 10 [ 50%]  (Warmup)

CHECKING DATA AND PREPROCESSING FOR MODEL 'CCCMGARCH' NOW.

COMPILING MODEL 'CCCMGARCH' NOW.

STARTING SAMPLER FOR MODEL 'CCCMGARCH' NOW.

SAMPLING FOR MODEL 'CCCMGARCH' NOW (CHAIN 2).
Chain 2:
Chain 2: Gradient evaluation took 0.001 seconds
Chain 2: 1000 transitions using 10 leapfrog steps per transition would take 10 seconds.
Chain 2: Adjust your expectations accordingly!
Chain 2:
Chain 2:
Chain 2: WARNING: No variance estimation is
Chain 2:          performed for num_warmup < 20
Chain 2:
Chain 2: Iteration: 1 / 10 [ 10%]  (Warmup)
Chain 2: Iteration: 2 / 10 [ 20%]  (Warmup)
Chain 2: Iteration: 3 / 10 [ 30%]  (Warmup)
Chain 2: Iteration: 4 / 10 [ 40%]  (Warmup)
Chain 1: Iteration: 6 / 10 [ 60%]  (Sampling)
Chain 2: Iteration: 5 / 10 [ 50%]  (Warmup)

16
tulipsliu 在职认证  发表于 2020-12-4 17:35:28
Loading bmgarch
DIAGNOSTIC(S) FROM PARSER:
Info:
Left-hand side of sampling statement (~) may contain a non-linear transform of a parameter or local variable.
If it does, you need to include a target += statement with the log absolute determinant of the Jacobian of the transform.
Left-hand-side of sampling statement:
    ULs[k] ~ uniform(...)

DIAGNOSTIC(S) FROM PARSER:
Info:
Left-hand side of sampling statement (~) may contain a non-linear transform of a parameter or local variable.
If it does, you need to include a target += statement with the log absolute determinant of the Jacobian of the transform.
Left-hand-side of sampling statement:
    ULs[k] ~ uniform(...)

DIAGNOSTIC(S) FROM PARSER:
Info: integer division implicitly rounds to integer. Found int division: nt * nt - nt / 2
Positive values rounded down, negative values rounded up or down in platform-dependent way.

Testing bmgarch
√ |  OK F W S | Context
/ |   0       | models                                                                              
CHECKING DATA AND PREPROCESSING FOR MODEL 'CCCMGARCH' NOW.

COMPILING MODEL 'CCCMGARCH' NOW.

STARTING SAMPLER FOR MODEL 'CCCMGARCH' NOW.

CHECKING DATA AND PREPROCESSING FOR MODEL 'CCCMGARCH' NOW.

COMPILING MODEL 'CCCMGARCH' NOW.

STARTING SAMPLER FOR MODEL 'CCCMGARCH' NOW.
\ |   2       | models                                                                              
CHECKING DATA AND PREPROCESSING FOR MODEL 'CCCMGARCH' NOW.

COMPILING MODEL 'CCCMGARCH' NOW.

STARTING SAMPLER FOR MODEL 'CCCMGARCH' NOW.
Using threshold  0.6 , model was refit  1  times, at observations 99
| |   3       | models                                                                              
CHECKING DATA AND PREPROCESSING FOR MODEL 'CCCMGARCH' NOW.

COMPILING MODEL 'CCCMGARCH' NOW.

STARTING SAMPLER FOR MODEL 'CCCMGARCH' NOW.

17
tulipsliu 在职认证  发表于 2020-12-4 17:42:39
Click the Refresh button to see progress of the chains
starting worker pid=11332 on localhost:11956 at 17:42:00.507
starting worker pid=19716 on localhost:11956 at 17:42:00.719
Registered S3 method overwritten by 'quantmod':
  method            from
  as.zoo.data.frame zoo
Registered S3 method overwritten by 'quantmod':
  method            from
  as.zoo.data.frame zoo

CHECKING DATA AND PREPROCESSING FOR MODEL 'pdBEKKMGARCH' NOW.

COMPILING MODEL 'pdBEKKMGARCH' NOW.

STARTING SAMPLER FOR MODEL 'pdBEKKMGARCH' NOW.

SAMPLING FOR MODEL 'pdBEKKMGARCH' NOW (CHAIN 1).
Chain 1:
Chain 1: Gradient evaluation took 0.001 seconds
Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 10 seconds.
Chain 1: Adjust your expectations accordingly!
Chain 1:
Chain 1:
Chain 1: WARNING: No variance estimation is
Chain 1:          performed for num_warmup < 20
Chain 1:
Chain 1: Iteration: 1 / 10 [ 10%]  (Warmup)
Chain 1: Iteration: 2 / 10 [ 20%]  (Warmup)
Chain 1: Iteration: 3 / 10 [ 30%]  (Warmup)
Chain 1: Iteration: 4 / 10 [ 40%]  (Warmup)
Chain 1: Iteration: 5 / 10 [ 50%]  (Warmup)

CHECKING DATA AND PREPROCESSING FOR MODEL 'pdBEKKMGARCH' NOW.

COMPILING MODEL 'pdBEKKMGARCH' NOW.

STARTING SAMPLER FOR MODEL 'pdBEKKMGARCH' NOW.

SAMPLING FOR MODEL 'pdBEKKMGARCH' NOW (CHAIN 2).
Chain 2:
Chain 2: Gradient evaluation took 0.001 seconds
Chain 2: 1000 transitions using 10 leapfrog steps per transition would take 10 seconds.
Chain 2: Adjust your expectations accordingly!
Chain 2:
Chain 2:
Chain 2: WARNING: No variance estimation is
Chain 2:          performed for num_warmup < 20
Chain 2:
Chain 2: Iteration: 1 / 10 [ 10%]  (Warmup)
Chain 2: Iteration: 2 / 10 [ 20%]  (Warmup)
Chain 2: Iteration: 3 / 10 [ 30%]  (Warmup)
Chain 2: Iteration: 4 / 10 [ 40%]  (Warmup)
Chain 2: Iteration: 5 / 10 [ 50%]  (Warmup)
Chain 1: Iteration: 6 / 10 [ 60%]  (Sampling)
Chain 2: Iteration: 6 / 10 [ 60%]  (Sampling)
Chain 1: Iteration: 7 / 10 [ 70%]  (Sampling)
Chain 2: Iteration: 7 / 10 [ 70%]  (Sampling)
Chain 2: Iteration: 8 / 10 [ 80%]  (Sampling)
Chain 1: Iteration: 8 / 10 [ 80%]  (Sampling)
Chain 2: Iteration: 9 / 10 [ 90%]  (Sampling)
Chain 2: Iteration: 10 / 10 [100%]  (Sampling)
Chain 1: Iteration: 9 / 10 [ 90%]  (Sampling)
Chain 2:
Chain 2:  Elapsed Time: 1.332 seconds (Warm-up)
Chain 2:                1.566 seconds (Sampling)
Chain 2:                2.898 seconds (Total)
Chain 2:
Chain 1: Iteration: 10 / 10 [100%]  (Sampling)

CHECKING DATA AND PREPROCESSING FOR MODEL 'pdBEKKMGARCH' NOW.

COMPILING MODEL 'pdBEKKMGARCH' NOW.

STARTING SAMPLER FOR MODEL 'pdBEKKMGARCH' NOW.

SAMPLING FOR MODEL 'pdBEKKMGARCH' NOW (CHAIN 3).
Chain 3:
Chain 3: Gradient evaluation took 0.002 seconds
Chain 3: 1000 transitions using 10 leapfrog steps per transition would take 20 seconds.
Chain 3: Adjust your expectations accordingly!
Chain 3:
Chain 3:
Chain 3: WARNING: No variance estimation is
Chain 3:          performed for num_warmup < 20
Chain 3:
Chain 3: Iteration: 1 / 10 [ 10%]  (Warmup)
Chain 3: Iteration: 2 / 10 [ 20%]  (Warmup)
Chain 3: Iteration: 3 / 10 [ 30%]  (Warmup)
Chain 1:
Chain 1:  Elapsed Time: 1.638 seconds (Warm-up)
Chain 1:                3.258 seconds (Sampling)
Chain 1:                4.896 seconds (Total)
Chain 1:
Chain 3: Iteration: 4 / 10 [ 40%]  (Warmup)
Chain 3: Iteration: 5 / 10 [ 50%]  (Warmup)
Chain 3: Iteration: 6 / 10 [ 60%]  (Sampling)
Chain 3: Iteration: 7 / 10 [ 70%]  (Sampling)

CHECKING DATA AND PREPROCESSING FOR MODEL 'pdBEKKMGARCH' NOW.

COMPILING MODEL 'pdBEKKMGARCH' NOW.

STARTING SAMPLER FOR MODEL 'pdBEKKMGARCH' NOW.
Chain 3: Iteration: 8 / 10 [ 80%]  (Sampling)

SAMPLING FOR MODEL 'pdBEKKMGARCH' NOW (CHAIN 4).
Chain 4:
Chain 4: Gradient evaluation took 0.001 seconds
Chain 4: 1000 transitions using 10 leapfrog steps per transition would take 10 seconds.
Chain 4: Adjust your expectations accordingly!
Chain 4:
Chain 4:
Chain 4: WARNING: No variance estimation is
Chain 4:          performed for num_warmup < 20
Chain 4:
Chain 3: Iteration: 9 / 10 [ 90%]  (Sampling)
Chain 4: Iteration: 1 / 10 [ 10%]  (Warmup)
Chain 4: Iteration: 2 / 10 [ 20%]  (Warmup)
Chain 4: Iteration: 3 / 10 [ 30%]  (Warmup)
Chain 3: Iteration: 10 / 10 [100%]  (Sampling)
Chain 4: Iteration: 4 / 10 [ 40%]  (Warmup)
Chain 3:
Chain 3:  Elapsed Time: 0.443 seconds (Warm-up)
Chain 3:                0.153 seconds (Sampling)
Chain 3:                0.596 seconds (Total)
Chain 3:
Chain 4: Iteration: 5 / 10 [ 50%]  (Warmup)
Chain 4: Iteration: 6 / 10 [ 60%]  (Sampling)
Chain 4: Iteration: 7 / 10 [ 70%]  (Sampling)
Chain 4: Iteration: 8 / 10 [ 80%]  (Sampling)
Chain 4: Iteration: 9 / 10 [ 90%]  (Sampling)
Chain 4: Iteration: 10 / 10 [100%]  (Sampling)
Chain 4:
Chain 4:  Elapsed Time: 0.276 seconds (Warm-up)
Chain 4:                0.065 seconds (Sampling)
Chain 4:                0.341 seconds (Total)
Chain 4:

18
tulipsliu 在职认证  发表于 2020-12-4 17:48:08
$$
\left[ \sum_{0\leq k<n} k = \frac{n(n-1)}{2} \right]
$$

19
tulipsliu 在职认证  发表于 2020-12-4 18:20:49
Equantion 9:
$$
t[u_1, \dots, u_n] = \sum_{k=1}^n
\binom{n-1}{k-1} (1-t)^{n-k}t^{k-1}u_k
$$

20
tulipsliu 在职认证  发表于 2020-12-4 18:21:21
$$
\sin \frac{\alpha}{2} =
\pm \sqrt{\frac{1-\cos\alpha}{2}}
$$

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2026-1-16 04:08