[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-detail-83893-en":3,"doc-seo-83893-105":29,"detail-sidebar-cat-0-en-105":91},{"code":4,"msg":5,"data":6},0,"success",{"doc_id":7,"user_id":8,"nickname":9,"user_avatar":10,"doc_module":4,"category_id":11,"category_name":12,"doc_title":13,"doc_description":14,"doc_content":15,"file_id":16,"file_url":17,"file_type":18,"file_size":19,"view_count":20,"is_deleted":4,"is_public":20,"is_downloadable":20,"audit_status":20,"page_count":21,"language":22,"language_code":23,"site_id":24,"html_lang":23,"table_of_contents":25,"faqs":26,"seo_title":13,"seo_description":14,"update_tm":27,"read_time":28},83893,8796095461610,"Oliver","https://ap-avatar.wpscdn.com/davatar_276721f389ce27ea32af1340a28f341c",8,"Research & Report","Computing Monetary Risk Measures in Linear Time","Monetary risk measures quantify decision-makers’ risk aversion, with Value-at-Risk (VaR) and Conditional-Value-at-Risk (CVaR) used widely. This paper introduces efficient expected linear-time algorithms for computing these measures for discrete random variables with complexity linear in the domain size. It presents QuickVaR for VaR via a Quickselect-inspired approach, and QuickDivergence for a class of φ-divergence risk measures, including CVaR. Experiments demonstrate order-of-magnitude speedups on large domains, with an open-source Julia implementation available.","arXiv :2607 .05078v 1 [ cs .LG] 6 Jul 2026  \nComputing Monetary Risk Measures in Linear Time  \nPalash Agrawal∗, Gersi Doko∗, Maeve Burwell, Marek Petrik∗  \nAbstract  \nMonetary risk measures have gained popularity for expressing decision-makers’ risk aversion. Value-at-Risk (VaR) and Conditional-Value-at-Risk (CVaR), in particular, are used commonly for this purpose. This paper proposes new efficient algorithms to compute these risk measures for a discrete random variable in expected linear time with respect to the size of its domain. First, we propose a QuickVaR algorithm that computes the VaR of a discrete random variable. Then, we leverage QuickVaR to propose QuickDivergence, an algorithm for computing a class of φ-divergence risk measures, including the popular CVaR risk measure. The QuickVaR algorithm adapts the well-known Quickselect algorithm, while QuickDivergence builds on polymatroid optimization algorithms. Numerical results show that our new algorithms offer an order-of-magnitude speedup for large domains, and a library implementation of the algorithms is available at [https://github.com/RiskAverseRL/RiskMeasures.jl](https://github.com/RiskAverseRL/RiskMeasures.jl).  \n1 Introduction  \nMonetary measures of risk generalize the expectation operator to be able to represent the risk aversion of decision-makers in domains that range from robotics (Akella et al. , 2024 ; Benrabah et al. , 2024 ; Majumdar and Pavone, 2020) to finance (Follmer and Schied, 2016) to infrastructure maintenance (Inzunza et al. , 2016) to disaster response (Barahona et al. , 2013) . Value-at-Risk (VaR) and Conditional-Value-at-Risk (CVaR) are the most popular risk measures and have made inroads in reinforcement learning, machine learning, and decision making (Petrik et al. , 2024) . Machine learning and reinforcement learning algorithms typically must compute the risk measures quickly for large discrete random variables. For example, in risk-averse reinforcement learning, one must evaluate the risk measure in every iteration of the algorithm, which can represent a significant computational bottleneck (Hau et al. , 2023 ; 2025 ; Ho et al. , 2018 ; 2021 ; 2022) .  \nIn this paper, we propose linear-time algorithms for computing risk measures of discrete random variables. First, we develop Quick VaR, an algorithm that computes VaR in linear time and generalizes the well-known quickselect algorithm. Second, we develop QuickDivergence, an algorithm that computes, in linear time,φ-divergence risk measures (Ahmadi-Javid, 2012) that satisfy a specific piecewise linearity property. This algorithm reduces φ-divergence risk measures to linear minimization problems over polymatroids (Follmer and Schied, 2016) . We illustrate this algorithm for the well-known CVaR risk measure and a related TVaR risk measure. Both of these risk measures are in the φ-divergence family and satisfy the required linearity property.  \nOur algorithms’ time complexity improves on the state of the art by a logarithmic factor. Virtually all implementations of VaR and CVaR algorithms require sorting the input arrays. Unbounded sorting requires Ω(nlog n) operations where n is the size of the probability space (Follmer and Schied, 2016) . Our numerical results show that the logarithmic acceleration can lead to an order-of-magnitude speedup for realistic large problems without incurring any penalty for small problems. In addition, our linear-time algorithms have simple implementations that add minimal complexity over standard algorithms.  \nLinear-time algorithms similar to our QuickVaR and QuickDivergence have been studied in many domains, and we summarize some of the most relevant. Some examples of such structured optimization problems are the projection onto the simplex (Adam and Mácha, 2019 ; Wang and Carreira-Perpiñán, 2013), projection onto  \n∗ Equal contribution.  \nthe k-capped simplex (Ang et al. , 2021 ; Lim and Wright, 2016), linear optimization on the intersection of Lp or φ-dive","cbCailsTlrPdPTQq","https://ap.wps.com/l/cbCailsTlrPdPTQq","pdf",636205,1,19,"English","en",105,"# Introduction\n## Risk measures and motivation\n## Proposed linear-time algorithms\n# Preliminaries\n## Notation and problem setup\n# Quick VaR\n# QuickDivergence\n# Numerical evaluation","[{\"question\":\"What problem does the paper address in computing monetary risk measures?\",\"answer\":\"The paper addresses the computational bottleneck of calculating risk measures such as VaR and CVaR for large discrete random variables. It targets faster algorithms whose runtime scales linearly with the domain size rather than requiring sorting-based steps.\"},{\"question\":\"How does QuickVaR compute Value-at-Risk (VaR)?\",\"answer\":\"QuickVaR computes VaR using an expected linear-time method inspired by the well-known Quickselect algorithm. This avoids the typical need to sort inputs.\"},{\"question\":\"What is QuickDivergence and which risk measures does it compute?\",\"answer\":\"QuickDivergence computes a class of φ-divergence risk measures in linear time. It leverages QuickVaR and reduces the computation to polymatroid optimization; the paper specifically illustrates it for CVaR and a related TVaR risk measure.\"}]",1784191274,48,{"code":4,"msg":30,"data":31},"ok",{"site_id":24,"language":23,"slug":32,"title":13,"keywords":33,"description":14,"schema_data":34,"social_meta":86,"head_meta":88,"extra_data":90,"updated_unix":27},"computing-monetary-risk-measures-in-linear-time","",{"@graph":35,"@context":85},[36,53,68],{"@type":37,"itemListElement":38},"BreadcrumbList",[39,43,47,50],{"item":40,"name":41,"@type":42,"position":20},"https://docshare.wps.com","Home","ListItem",{"item":44,"name":45,"@type":42,"position":46},"https://docshare.wps.com/document/","Document",2,{"item":48,"name":12,"@type":42,"position":49},"https://docshare.wps.com/document/research-report/",3,{"item":51,"name":13,"@type":42,"position":52},"https://docshare.wps.com/document/computing-monetary-risk-measures-in-linear-time/83893/",4,{"url":51,"name":13,"@type":54,"author":55,"headline":13,"publisher":57,"fileFormat":60,"inLanguage":23,"description":14,"dateModified":61,"datePublished":62,"encodingFormat":60,"isAccessibleForFree":63,"interactionStatistic":64},"DigitalDocument",{"name":9,"@type":56},"Person",{"url":40,"name":58,"@type":59},"DocShare","Organization","application/pdf","2026-07-17","2026-07-16",true,{"@type":65,"interactionType":66,"userInteractionCount":20},"InteractionCounter",{"@type":67},"ViewAction",{"@type":69,"mainEntity":70},"FAQPage",[71,77,81],{"name":72,"@type":73,"acceptedAnswer":74},"What problem does the paper address in computing monetary risk measures?","Question",{"text":75,"@type":76},"The paper addresses the computational bottleneck of calculating risk measures such as VaR and CVaR for large discrete random variables. It targets faster algorithms whose runtime scales linearly with the domain size rather than requiring sorting-based steps.","Answer",{"name":78,"@type":73,"acceptedAnswer":79},"How does QuickVaR compute Value-at-Risk (VaR)?",{"text":80,"@type":76},"QuickVaR computes VaR using an expected linear-time method inspired by the well-known Quickselect algorithm. This avoids the typical need to sort inputs.",{"name":82,"@type":73,"acceptedAnswer":83},"What is QuickDivergence and which risk measures does it compute?",{"text":84,"@type":76},"QuickDivergence computes a class of φ-divergence risk measures in linear time. It leverages QuickVaR and reduces the computation to polymatroid optimization; the paper specifically illustrates it for CVaR and a related TVaR risk measure.","https://schema.org",{"og:url":51,"og:type":87,"og:title":13,"og:site_name":58,"og:description":14},"article",{"robots":89,"canonical":51},"index,follow",{"doc_id":7,"site_id":24},{"code":4,"msg":5,"data":92},[93,97,101,105,110,115,120,123,128,131,135],{"id":20,"doc_module":4,"doc_module_name":45,"category_name":94,"show_sort_weight":95,"slug":96},"Story & Novel",90,"story-novel",{"id":46,"doc_module":4,"doc_module_name":45,"category_name":98,"show_sort_weight":99,"slug":100},"Literature",80,"literature",{"id":52,"doc_module":4,"doc_module_name":45,"category_name":102,"show_sort_weight":103,"slug":104},"Exam",70,"exam",{"id":106,"doc_module":4,"doc_module_name":45,"category_name":107,"show_sort_weight":108,"slug":109},5,"Comic",60,"comic",{"id":111,"doc_module":4,"doc_module_name":45,"category_name":112,"show_sort_weight":113,"slug":114},6,"Technology",50,"technology",{"id":116,"doc_module":4,"doc_module_name":45,"category_name":117,"show_sort_weight":118,"slug":119},7,"Healthcare",40,"healthcare",{"id":11,"doc_module":4,"doc_module_name":45,"category_name":12,"show_sort_weight":121,"slug":122},30,"research-report",{"id":124,"doc_module":4,"doc_module_name":45,"category_name":125,"show_sort_weight":126,"slug":127},9,"Religion & Spirituality",20,"religion-spirituality",{"id":126,"doc_module":4,"doc_module_name":45,"category_name":129,"show_sort_weight":126,"slug":130},"World Cup","world-cup",{"id":132,"doc_module":4,"doc_module_name":45,"category_name":133,"show_sort_weight":132,"slug":134},10,"Lifestyle","lifestyle",{"id":21,"doc_module":4,"doc_module_name":45,"category_name":136,"show_sort_weight":106,"slug":137},"General","general"]