dataesr/scientific-paragraphs-categorization huggingface dataset:
Section 3 describes the mechanism of a systemic event by network analysis, risk decomposition and aggregation. We show the stochastic simulation of risk and the derivation of systemic risk indicator. Section 4 demonstrates the nonlinearity feature during a financial crisis and introduces the nonlinear PolyModel theory. Section 5 proposes our PolyModel-based systemic risk indicators with historical weekly data and shows their efficacy as early warning of financial crises. Section 6 introduces investment strategies on the S&P500 Index and its options, based on the indicators, as a validation of our results. Section 7 concludes the paper. Patro et al. (2013)  proposed systemic risk indicator by analyzing correlations among the equity of financial institutions. However, they calculated with the normal distribution and took no consideration for the skewness and kurtosis, the fat tailed problems.
Systemic Risk Aggregation From the above decomposition analysis, we already have two independent risk components of systemic risk and factor specific risk. In this section, we deduce both of these two components as well as the third one, residual risk, from the three sums of squares formula using nonlinear regression rather than linear. The underlying reason we apply nonlinear fitting will be discussed in more detail in Section 3. Assuming we now have a large log-return dataset of n risk factors F 1 , F 2 , F 3 ,. , F n and log-return dataset of financial market index Y, we denote n nonlinear single factor regressions of Y over F i as φ(F i ) and the corresponding explained sum of squares and unexplained sum of squares as SS reg and SS res , which are orthogonal components. Samples of Y are marked y 1 , y 2 , y 3 ,.
, y m , each has a predicted value ŷ1 , ŷ2 , ŷ3 ,. , ŷm. ȳ is the mean of Y and the residuals of prediction model are e i = ŷiy i. The equation of three sums of squares: SS tot = SS reg + SS res Suppose now we have n nonlinear single factor regressions with the same sample data Y and each of them has the same formula as above: SS tot = SS reg i + SS res i Here suppose: SS reg 1 ≥ SS reg 2 ≥ SS reg 3 ≥. ≥ SS reg n As we mentioned before, the systemic risk is measured as the weighted average of explained risks, so we add the weights w i based on the values of all the SS reg i and multiple corresponding equation with them as: w i SS tot = w i SS reg i + w i SS res i where ∑ n i w i = 1 and sum them up: SS tot = n ∑ i=1 w i SS reg i + n ∑ i=1 w i SS res i (1) Now, let: E = n ∑ i=1 w i SS reg i SS tot = E + n ∑ i=1 w i SS res i Next, let V i = (SS reg i -E) , which are actually the factor specific risk parts and it is obvious that V i changes from positive to negative as i goes from 1 to n.
For FX, of course, the exchange currency rate of different countries is another vital risk factor that can displays this country's overall economy situation. Derivative is the financial products based on the actual underlying assets mentioned above, we should also collect some special information from them. Finally, we choose nearly 200 risk factors within the groups mentioned above as the market representative financial networks and the S&P 500 Index as the dependent variable in our PolyModel fitting. In measuring systemic risk, the periodic choice of log-return data can greatly affect the result. Daily data is the popular choice for research on risk, but it is very obvious that we cannot perfectly match all the daily data of these nearly 200 risk factors. Many funds prefer monthly data to construct their risk parity portfolios, especially mutual funds because the transaction fee is a considerable cost for them.
Then, choosing the log-return of S&P 500 Index as Y, we regress it against each of our risk factors with nonlinear Hermite polynomials basis. In normal business time, the volatility in financial market is small and the linear model runs well in measuring risk. However, when the big downturns or financial crises come, the volatility grows up and the nonlinear feature appears. We choose two nonlinear single factor regression models to demonstrate this phenomenon. Figure  9  shows the comparison of linear and nonlinear fitting with the data during normal and crisis period, which is regressed with half a year weekly data sets respectively. In this figure, MXJP0FN Index is the MSCI Japan financial sector and MXCN0FN Index is the MSCI Chinese financial sector. The green square points are the data during normal time and you can observe that the linear and nonlinear fitting are almost the same, making no big difference, because all of the data points concentrate in the middle.
For put protective, we design two strategies that put protective only indicators ring and put protective all the time. For collar, we implement three strategies that collar only indicators ring, collar all the time and covered call all the time but put protective only indicators ring. In developing the SPX index investing with its options, we need to collect all the call and put options data with different maturities and moneynesses to calculate the implied volatility. We use the implied volatility data from SPX options with maturity of 1-month, 2-month, 3-month, 6-month and 12-month and moneynesses at 1. 20, 1. 10, 1. 05, 1. 025, 1, 0. 975, 0. 95, 0. 90 and 0. 80, and then interpolate the implied volatility through the smile curve when we need to buy or sell options which are then priced with Black Schole formula.
SL( * , - * ) can be decided in PSpace thanks to a small model property  [32]. A natural question is how to combine these extensions, and which separation logic fragment that allows Boolean connectives, magic wand and generalised recursive predicates can be decided with some adequate restrictions. As already advocated in  [7, 18, 24, 29, 31] , dealing with the separating implication - * is a desirable feature for program verification and several semi-automated or automated verification tools support it in some way, see e. g. [18, 24, 29, 31]. Our Contribution. In this paper, we address the question of combining magic wand and inductive predicates in the extremely limited case where the only inductive predicate is the gentle list segment predicate ls. So the starting point of this work is this puzzling question: what is the complexity/decidability status of propositional separation logic SL( * , - * ) enriched with the list segment predicate ls (herein called SL( * , - * , ls))? More precisely, we study the decidability/complexity status of extensions of propositional separation logic SL( * , - * ) by adding one of the reachability predicates among ls (precise predicate as usual in separation logic), reach (existence of a path, possibly empty) and reach + (existence of a non-empty path).
Given two formulae ϕ, ϕ (possibly from different logical languages), we write ϕ ≡ ϕ whenever for all (s, h), we have (s, h) |= ϕ iff (s, h) |= ϕ. When ϕ ≡ ϕ , the formulae ϕ and ϕ are said to be equivalent. Variants with Other Reachability Predicates. We use two additional reachability predicates reach(x, y) and reach + (x, y) and we write SL( * , - * , reach) (resp. SL( * , - * , reach + )) to denote the variant of SL( * , - * , ls) in which ls is replaced by reach (resp. by reach + ). The relation |= is extended as follows: (s, h) |= reach(x, y) holds when there is i ≥ 0 such that h i (s(x)) = s(y) (i functional composition(s) of h is denoted by h i ) and (s, h) |= reach + (x, y) holds when there is i ≥ 1 such that h i (s(x)) = s(y). As ls(x, y) ≡ reach(x, y)∧¬(¬emp * reach(x, y)) and reach(x, y) ≡ * ls(x, y), the logics SL( * , - * , reach) and SL( * , - * , ls) have identical decidability status.
They can be seen as a special case of while loop that does not involve an arbitrary, inductively defined termination condition. The ability to substitute their counter with a closed form-an affine induction variable-makes them amenable to a wider set of transformations than while loops. Dynamic counted loops are commonly found in sparse matrix computations, but not restricted to this class of algorithms. They are also found together with statically unpredictable, non-affine array subscripts. The polyhedral framework of compilation unifies a wide variety of loop and array transformations using affine (linear) transformations. The availability of a general-purpose method to generate imperative code after the application of such affine transformations  [3, 16, 20]  brought polyhedral compilers to the front scene, in the well-behaved case of static control loops.
While significant amount of work targeted the affine transformation and parallelization of while loops  [5, 8, 9, [12] [13] [14] [15] 17] , these techniques face a painful problem: the lack of a robust method to generate imperative code from the polyhedral representation. One representative approach to model while loops in a polyhedral framework, and in the code generator in particular, is the work of Benabderrahmane et al. [5]. This work uses over-approximations to translate a while loop into a static control loop iterating from 0 to infinity that can be represented and optimized in the polyhedral model. It introduces exit predicates and the associated data dependences to preserve the computation of the original termination condition, and to enforce the proper termination of the generated loops the first time this condition holds.
[28] , and it avoids the complexity and overhead of speculative execution. To extend the polyhedral framework to dynamic computed loops, our method relies on the computation of an affine upper bound for all dynamic trip counts that a given loop may reach, using a combination of additional static analysis and dynamic inspection. Revisiting the polyhedral compilation framework  [5]  of arbitrary while loops, we introduce exit predicates for dynamic counted loops, modeling the control dependence of the original loop through additional data dependences from the definition of these exit predicates to every statement in the loop body. We implement a schedule-tree-based algorithm  [16]  to enable the full automation of imperative code generation after the application of affine transformations, targetting both CPU and GPU architectures.
Our method goes beyond the state of the art  [5, 17, 24]  in fully automating the process, specializing the code generation algorithm to the case of dynamic counted loops, and avoiding the introduction of spurious loop-carried dependences or resorting to speculative execution. We conduct experiments on representative irregular computations, including dynamic programming, computer vision, finite element methods, and sparse matrix linear algebra. We validate that the method is applicable to general affine transformations for locality optimization, vectorization and parallelization. The paper is organized as follows. We introduce technical background and further motivate our approach to parallelize dynamic counted loops in the next section. Section 3 discusses the conversion of control dependences into datadependent predicates.
Such control dependences can be represented as data dependences between the definition statements of dynamic upper bounds and S 2. To establish such a dependence relation, an exit predicate may be introduced before each statement of the loop body, like in the framework of Benabderrahmane et al. [5]. The resulting dependence graph is shown in Figure  2. The solid arrows represent the original (output) dependences between definition statements of dynamic parameters, and the dashed arrows represent the data dependences converted from the exit conditions' control dependences. By capturing control dependences as affine relations from the definition of exit predicates to dominated statements in loop bodies, one may build a sound abstraction of the scheduling constraints for the loop nest. This technique is applicable to arbitrary while loops, in conjunction with a suitable code generation strategy to recover the exact control flow protected by the exit predicate, and by over-approximating the loop upper bound as +∞.
This representation can be used to compute a conservative approximation of the dependence relation for the whole schedule tree. Based on this dependence information, one may derive a correct schedule using the Pluto algorithm or one of its variants  [6, 26] , to optimize locality and extract parallelism. The resulting schedule tree may indeed be seen as a onedimensional external domain and schedule enclosing a twodimensional inner domain and schedule controlled by two additional parameters, u 1 and u 2 , as will be seen in Figure  5. The final step is to generate code from the schedule tree to a high level program. The generation of the abstract syntax tree (AST) follows the approach implemented in isl  [16] , traversing the schedule tree and specializing the code generation algorithm to integrate target-specific constraints, e.
g. , nested data parallelism and constant bounds. Before encountering a filter node associated with a dynamic counted loop, the exit predicate and its controlled loop body is seen as a single black-box statement by the AST generation algorithm. When passing the filter node constraining the dynamic upper bound, it is necessary to complement the standard code generation procedure with dedicated "dynamic counted loop control flow". This involves either (on GPU targets) the reconstruction of the exit predicate and the introduction of an early exit (goto) instruction guarded by the predicate or (on CPU targets) the replacing the over-approximated static upper bound with the dynamic condition and the removing of the introduced control flow. Our algorithm generates code in one single traversal of the schedule tree 1.
Preparation A dynamic counted loop with a dynamic counted upper bound and a static lower bound is referred to as the normalized format of dynamic counted loops, as shown in the example of Figure  1  is such a normalized format. Sparse matrix computations represent an important class of dynamic counted loops. They are a class of computations using compressed data layout stores nonzero elements only. Loops iterating on the compressed layout may have dynamic lower and upper bounds. However, these loops can be easily normalized by subtracting the lower bound from the upper bound. This transformation may introduce non-affine array subscripts since the lower bound may not be affine; we assume the dependence analysis will conservatively handle such subscripts, leveraging Pencil annotations to refine its precision  [1, 10] ; we may also symbolically eliminate identical non-affine expressions on the left and right-hand side.
Modeling Control Dependences To model control dependences on dynamic conditions, we introduce additional data dependences associated with exit predicates and their definition statements. An exit predicate definition and check is inserted at the beginning of each iteration of a dynamic counted loop. At code generation time, all statements in the body of the counted loop will have to be dominated by an early exit instruction conditioned by its predicate. This follows Benabderrahmane's method for while loops  [5] , but without the inductive computation and loop-carried dependence on the exit predicate. Of course, we delay the introduction of goto instructions/changing back to the dynamic conditions until code generation, to keep the control flow in a statically manageable form for a polyhedral compiler.
Generation of Imperative Code Once a new schedule is produced, additional transformations can be applied on band nodes, to implement loop tiling or additional permutations, strip-mining for vectorization, etc. Eventually, one needs to return to imperative code through a so-called code or AST generation algorithm. AST generation is a performance-critical step in any polyhedral framework. We extend the code generation scheme of Grosser et al. [16] , itself derived from the algorithm by Quilleré et al. [20]  and its CLooG enhancements and implementation  [3]. When the Grosser et al. algorithm traverses the band nodes in a schedule, it projects out the local schedule constraints from the domain node. As the dynamic upper bounds are not modeled in the iteration domain (the domain node in the schedule tree and subsequent filter nodes), the generated loops will iterate from 0 to u.
Extending the Schedule Tree The Grosser et al. algorithm is not able in its original form to generate semantically correct code for our extended schedule tree. However, it can be easily modified to handle the special case of exit predicates that are homogeneous over all statements in a sequence or set node of the schedule tree (e. g. , all statements in a band of permutable loops). This is facilitated through the syntactic annotation of dynamic counted loops using so-called mark nodes in the schedule tree. A mark node may attach any kind of information to a subtree; we used it here to specify which band nodes and which dimensions in those bands involve dynamic counted loops. To account for affine transformations combining static and dynamic counted loops (e. g. , loop skewing), mark nodes are inserted at every dimension.
Code Generation for a Single Loop The final step is converting the AST to a high level program. When a goto AST node of a dynamic counted loop is captured, a goto statement conditioned by its predicates is enforced after the loop body, as well as a label destination after the loop itself. The associated predicates are gathered in a conjunction and wrapped as one conditional, with loop iterators instantiated according to the loop level. A label is inserted after each dynamic loop as a target for a goto statement. Changing back to the dynamic condition for a dynamic counted loop is straightforward, but special cares have to be taken to handle cases with multiple associated predicates. One may construct a max operation comprising all the associated predicates as the upper bound of a dynamic counted loop, without removing these introduced control flow since they have to be there to preserve the semantic of the code.
This schedule-tree-based code generation algorithm enables all kinds of loop transformations, the most challenging one being loop fusion. When fusing two dynamic counted loops, the two sets of predicates are considered, and the early exit statements/max-operation-based dynamic upper bounds are guarded by/composed of their statementwise conjunction/them. A normal loop can be treated as a specific case of dynamic counted loop by reasoning on its static upper bound as a predicate. Unfortunately this scheme efficiently supports a single dynamic counted loop only, and does not deal with the expression of parallelism in these loops.
Flat and Nested Parallelisms As shown in Figure  5 , the canonically constructed schedule tree isolates two nested band nodes to represent different levels of the loop nest. This works fine when the target architecture is a shared memory multiprocessor. As an illustrative example, Figure  6  is the generated code for a shared memory multiprocessor after the application of loop tiling on the code in Figure  1  with the outermost i-loop being parallelized. However, when targeting GPU accelerators or producing fix-length vector code, we usually expect to combine nested bands to express parallelism at multiple levels, and a constant iteration count may also be required for data-parallel dimensions. We therefore consider two cases depending on the need to extract parallelism across more than one band.
Nested parallelism across bands Targeting GPU accelerators or producing fix-length vector code motivates the exploitation of data parallelism within dynamic counted loops, in combination with other nested loops. Since dynamic counted loops result in nested bands in the schedule tree, the combined exploitation of multiple levels of parallelism including one or more dynamic counted loops requires special treatment that is not directly modeled by affine sets and relations. The constraints on the grid of multi-level data parallelism require the collection of bound information across nested bands: when launching a kernel, the parameters of the grid must be known and may not evolve during the whole run of the kernel. Unfortunately, the statements between nested bands that occur in dynamic counted loops are used to initialize dynamic upper bounds.
Statements in the body of these dynamic counted loops depend on those definition statements, through the added dependences modeling the original dependence of the dynamic loop. Still, one can sink these definition statements inside, within the dynamic counted loops, as a preprocessing step. As a result, the nested bands can be combined again, with no intervening computation or control flow. Figure  7  shows an example after the application of loop tiling on the code in Figure  1. The inward movement of these definition statements is safe with the introduction of the upper bound u-parameter. Yet as a side-effect of this movement, each definition will be redundantly evaluated as many times as the number of iterations of the dynamic counted loop itself. This is the price to pay for a fixed upper bound on the iterations.
Experimental Evaluation Our framework takes a C program as input, and resorts to Pencil  [1]  extensions only when dealing with indirect accesses (subscripts of subscripts), implying that all arrays are declared through the C99 variable-length array syntax with the static const restrict qualifiers, allowing PPCG to derive the size of the arrays offloaded on the accelerator despite the presence of indirect accesses, and telling that these arrays do not alias. We use PPCG  [26]  to generate target codes, a polyhedral compiler that performs loop nest transformations, parallelization, data locality optimization, and generates OpenCL or CUDA code. The version ppcg-0. 05-197-ge774645-pencilcc is used in our work. In a follow-up auto-tuning step, we look for optimal parameter values for tile sizes, block sizes, grid sizes, etc.
for a given application and target architecture. The experiments are conducted on a 12-core, two-socket workstation with an NVIDIA Quadro K4000 GPU. Each CPU is a 6-core Intel Xeon E5-2630 (Ivy Bridge). Sequential and OpenMP code are compiled with the icc compiler from Intel Parallel Studio XE 2017, with the flags -Ofast -fstrict-aliasing (-qopenmp). CUDA code is compiled with the NVIDIA CUDA 7. 5 toolkit with the -O3 optimization flag. We run each benchmark 9 times and retain the median value.
Suppose N denominations are provided, each of which is d i (0 ≤ i < N ). As long as the given amount W > d i , the frequency of the i-th denomination will be incremented by 1. As a result, d i appears as a bound of the inner dynamic counted loop, enclosed by an outer loop iterating over the total number of denominations. Our technique successfully parallelizes the inner dynamic counted loop and generates the CUDA code in conjunction with a loop interchange optimization. We show the performance with different number of denominations N under different amount constraints W in Figure  8. It can be concluded from the figure that the performance improvement grows with the rise of the the number of denominations. Bucket sort is a generalization of counting sort, sorting by first scattering the N elements of a given array into a set of M buckets, sorting each bucket individually, and finally gathering the sorted elements in each bucket in order.
Due to the comparison operations, a sorting algorithm is inherently not the candidate for parallelization. However, it is possible to parallelize and optimize the gathering step of bucket sort. We consider a uniform random distribution of elements of the input array. The algorithm has to gather size[i] elements in the i-th bucket, whose static upper bound can be set as N. The dynamic counted loop controlled by the bucket size is captured by our method and parallelized in the form of CUDA code on GPUs. The performance with different array sizes N and different bucket numbers M is shown in Figure  9 , indicating the speedup rises along with the increase of the number of buckets involved. N Speedup M = 16K M = 32K M = 64K M = 128K Figure 9. Performance of the bucket sort on GPU.