Please select the report that you wish to read.
- Portfolio Optimization using the NAG Library
- Adjoint Algorithmic Differentiation Tool Support for Typical Numerical Patterns in Computational Finance
- Adjoint Algorithmic Differentiation of a GPU Accelerated Application
- Generating Realisations of Stationary Gaussian Random Fields by Circulant Embedding
- Local Volatility FX Basket Option on CPU and GPU
- Variable Selection in a Cox Proportional Hazards Model
- A high-performance Brownian bridge for GPUs: Lessons for bandwidth bound applications
- Solving partial differential equations using the NAG Library
- Calling the NAG Pseudo and Quasi Random Number Generators From a Multi-Threaded Environment
- Nonlinear Optimization Made Easier: A Tutorial for using the AMPL modelling language with NAG routines
- Reverse Communication Interface
- Solving an Optimization Problem using the NAG Library for .NET from F#
- Exact First- and Second-Order Greeks by Algorithmic Differentiation
- Flexible delivery of visualization software and services
- Calling the NAG Fortran Library for Windows x64 DLLs from VB.NET
- Using the NAG Library to calculate financial option prices in Excel
- Using the NAG Libraries with Excel and VSTO
- Calling NAG Library Routines from Scilab
- Calling NAG Library Routines from Octave
- Fitting a Seasonal ARIMA Model using the NAG C Library
- Calling NAG Library Routines from Java
Further technical reports and associated information can be found in our archive.
TRn/nn - NAG Technical Report series number
Portfolio Optimization using the NAG Library
John Morrissey (NAG) and Brian Spector (NAG)
An introduction into the notation and techniques used in portfolio optimization. We discuss some sample problems and present help in choosing an appropriate optimizer. Finally, there is a section on handling transaction cost for the portfolio optimization.
Adjoint Algorithmic Differentiation Tool Support for Typical Numerical Patterns in Computational Finance
Uwe Naumann (Aachen University) and Jacques du Toit (NAG)
We demonstrate the flexibility and ease of use of C++ algorithmic differentiation (AD) tools based on overloading to numerical patterns (kernels) arising in computational finance. While adjoint methods and AD have been known in the finance literature for some time, there are few tools capable of handling and integrating with the C++ codes found in production. Adjoint methods are also known to be very powerful but to potentially have infeasible memory requirements. We present several techniques for dealing with this problem and demonstrate them on numerical kernels which occur frequently in finance. We build the discussion around our own AD tool dco/c++ which is designed to handle arbitrary C++ codes and to be highly flexible, however the sketched concepts can certainly be transferred to other AD solutions including in-house tools. An archive of the source code for the numerical kernels as well as all the AD solutions discussed can be downloaded from our website. This includes documentation for the code and dco/c++. Trial licences for dco/c++ are available from NAG.
Adjoint Algorithmic Differentiation of a GPU Accelerated Application
Jacques du Toit (NAG), Johannes Lotz (Aachen University) and Uwe Naumann (Aachen University)
We consider a GPU accelerated program using Monte Carlo simulation to price a basket call option on 10 FX rates driven by a 10 factor local volatility model. We develop an adjoint version of this program using algorithmic differentiation. The code uses mixed precision. For our test problem of 10,000 sample paths with 360 Euler time steps, we obtain a runtime of 522ms to compute the gradient of the price with respect to the 438 input parameters, the vast majority of which are the market observed implied volatilities (the equivalent single threaded tangent-linear code on a CPU takes 2hrs).
Generating Realisations of Stationary Gaussian Random Fields by Circulant Embedding
Catherine E. Powell, School of Mathematics, University of Manchester, UK
Random fields are families of random variables, indexed by a d-dimensional parameter x with d > 1.They are important in many applications and are used, for example, to model properties of biological tissue, velocity fields in turbulent flows and permeability coefficients of rocks. Mark 24 of the NAG Fortran Library includes new routines for generating realisations of stationary Gaussian random fields using the method of circulant embedding. This short note illustrates the main ideas behind circulant embedding and how to use the routines g05zr and g05zs in the NAG Toolbox for MATLAB. The routines g05zm, g05zn and g05zp can also be used to generate realisations of stationary Gaussian stochastic processes (the d = 1 case).1
Local Volatility FX Basket Option on CPU and GPU
Jacques du Toit, (NAG) and Isabel Ehrlich, (Imperial College, London)
We present high performance implementations on a CPU and an NVIDIA GPU of a Monte Carlo pricer for a simple FX basket option driven by a multi-factor local volatility model. Basket options such as these are typically considered too complicated to tackle analytically in a market-consistent manner, and are too high dimensional for PDE methods. Consequently these products are valued using Monte Carlo methods. This results in a compute intensive, massively parallel problem which is ideally suited to modern CPUs and GPUs. We develop fully parallelized, fully vectorized code and study the effects of mixed precision on accuracy and performance. We also investigate using texture memory on the GPU.
Variable Selection in a Cox Proportional Hazards Model
In this article, and the associated example programs, we show how to use existing NAG library routines to perform automatic variable selection for a Cox proportional hazards model, a commonly type of model commonly used in the analysis of censored data. The three approaches described are; forward, backward and stepwise selection.
A high-performance Brownian bridge for GPUs: Lessons for bandwidth bound applications
Jacques Du Toit, (NAG)
We present a very flexible Brownian bridge generator together with a GPU implementation which achieves close to peak performance on an NVIDIA C2050. The performance is compared with an OpenMP implementation run on several high performance x86-64 systems. The GPU shows a performance gain of at least 10x. Full comparative results are given in Section 8: in particular, we observe that the Brownian bridge algorithm does not scale well on multicore CPUs since it is memory bandwidth bound. The evolution of the GPU algorithm is discussed. Achieving peak performance required challenging the "conventional wisdom" regarding GPU programming, in particular the importance of occupancy, the speed of shared memory and the impact of branching.
Solving partial differential equations using the NAG Library
Jeremy Walton, (NAG)
We describe the characteristics of partial differential equations (PDEs), including their uses, classification, subsidiary conditions and some of the ways in which they may be solved. In this context, we demonstrate how routines from the NAG Library can be used in their numerical solution. These routines come not only from the Library’s PDE chapter, but also from the chapters which deal with mesh generation and the solution of large linear systems. The combination of mesh generators and large linear solvers is applicable in the implementation of the so-called finite element method, which may be used in cases where the complexity of the geometry of the domain over which the PDE is to be solved prevents the application of the comparatively simple finite differencing method (as used, for example, in the Library’s PDE chapter). We illustrate the use of the NAG routines using a variety of example problems; the solutions are generated using the NAG Toolbox for MATLAB ® and plotted using tools in that environment.
Calling the NAG Pseudo and Quasi Random Number Generators From a Multi-Threaded Environment
Martyn Byng, (NAG)
In this article, and the associated example programs, we will show how to call the NAG random number generators within a multi-threaded enviroment. The examples are written making use of OpenMP, however the basic structure of the NAG calls will be the same irrespective of the threading mechanism used. Some OpenMP commands and pragmas are briefly described in this document, however additional information is available on the OpenMP website, alternatively NAG offer training courses in OpenMP, details of which can be obtained from email@example.com.
- Accompanying materials:
Nonlinear Optimization Made Easier: A Tutorial for using the AMPL modelling language with NAG routines.
Jan Fiala, (NAG)
Optimization, or Operational Research in general, nowadays plays an important role in our lives. No matter if you are a respected finance house or a student of mathematics, you have probably used some sort of optimization routines. The field itself has changed rapidly since linear programming was introduced in the mid 1940s. More powerful computers allowed us to consider much more realistic and complex models using sophisticated algorithms. Whereas the input for linear programming problems is relatively simple, it is a much more delicate task in the case of general nonlinear programming. One way to tackle it is to introduce a specialised language for the problem description. In this tutorial we will focus on a particular one called AMPL which we have equipped with two of our NAG solvers, namely E04UFF and E04UGF.
Reverse Communication Interface
Marcin Krzysztofik, (NAG)
Reverse communication is a means of avoiding procedure arguments in the parameter list of a procedure. Most numerical routines use the alternative, forward (or direct) communication approach, i.e. they are called only once to compute results; they completely specify the problem by including user-provided procedures in the argument list.
Solving an Optimization Problem using the NAG Library for .NET from F#
Sorin Serban, (NAG)
NAG has just released their latest numerical library; the NAG Library for .NET. This is the first release of the library and includes over 400 methods for key mathematical and statistical areas, including Wavelet Transforms, Integration, Interpolation and Approximation, Random Number Generators, Time Series Analysis, and Optimization. The Optimization chapter contains methods for solving LP-, QP-, LS- and NLP-problems without constraints or with constraints. A global optimizer is also included, solving problems without constraints but with bounds on the variables.
Exact First- and Second-Order Greeks by Algorithmic Differentiation
The Numerical Algorithms Group (NAG) work very closely with Uwe Naumann to help users take advantage of Algorithmic Differentiation methods.
Algorithmic (also known as Automatic) differentiation (AD) is a method for computing sensitivities of outputs of numerical programs with respect to its inputs both accurately (to machine precision) and efficiently. The two basic modes of AD ' forward and reverse ' and combinations thereof yield products of a vector with the Jacobian, its transpose, or the Hessian, respectively.
Flexible delivery of visualization software and services
Jason Wood, Jungwook Seo, David Duke Ken Brodlie (University of Leeds) and Jeremy Walton (NAG)
An important issue in the design of visualization systems is the allowance of flexibility in providing a range of interfaces to a single body of algorithmic software. In this paper we describe how the ADVISE architecture provides exactly this flexibility. The architecture is cleanly separated into three layers (user interface, web service middleware and visualization components) which gives us the flexibility to provide a range of different delivery options, but all making use of the same basic set of visualization components. These delivery options comprise a range of user interfaces (visual pipeline editor, tailored application, web page), coupled with installation choice between a stand-alone desktop application, or a distributed client-server application. This work was carried out within the ADVISE project.
Calling the NAG Fortran Library for Windows x64 DLLs from VB.NET
Ludovic Henno, NAG
Users who have Microsoft Visual Studio 2005 or 2008 may use the DLLs provided with the NAG Fortran Library for Windows XP/Vista/7 x64 (FLW6I22DC_nag.dll and FLW6I22DC_mkl.dll) in conjunction with VB.NET.
In this report, we will see the rules one has to follow to use the NAG routines from VB.NET and then we will illustrate those rules with examples.
Using the NAG Library to calculate financial option prices in Excel
Marcin Krzysztofik, Jeremy Walton, NAG
In finance, an option is a contract that conveys the right, but not the obligation, to buy or sell a specific asset. Options are widely traded on financial markets, and so some method of determining their value (or price) is required. Several option pricing models have been developed, which have then been implemented using a range of mathematical methods; some of these implementations have been made available in the latest release of the NAG Library. We have used these routines to calculate option prices in Microsoft Excel, and present some examples (which may be downloaded from the NAG website) that illustrate the way in which NAG routines can be called from within an Excel spreadsheet.
Using the NAG Libraries with Excel and VSTO
Sorin Serban, Shah Datardina, NAG
The following example which includes interpolating and approximating data points, uses the Excel Workbook template to call the NAG Fortran Library and NAG C Library (soon also the NAG Library for .NET) from inside an Excel workbook. There are other ways to integrate Excel with an external library by creating Add-Ins. The difference is that the workbook model described here is called a “document-level project” while an add-in is an “application-level project”. At the document level, all customization is unique to one or more sheets contained in a single workbook, but at the application level, custom Excel functions would be available to all workbooks.
Nathaniel Fenton, NAG Ltd, Oxford
This report gives detailed instructions on how to call routines in the NAG C and Fortran Libraries from the Scilab programming environment.
Calling NAG Library Routines from Octave
Anna Kwiczala, NAG Ltd, Oxford
This report gives detailed instructions on how to call routines in the NAG C and Fortran Libraries from the Octave programming environment.
Fitting a Seasonal ARIMA Model using the NAG C Library
Martyn Byng, NAG Ltd, Oxford
This article gives a brief description of how to fit a seasonal ARIMA (autoregressive integrated moving average) model using the NAG C Library routine g13bec (/numeric/CL/manual/xhtml/G13/g13bec.xml), and how to forecast from such a model using the NAG C Library routine g13bjc /numeric/CL/manual/xhtml/G13/g13bjc.xml . The article should be read in conjunction with the documentation for these two routines. A full set of example source code, data and expected results is available in the accompanying materials linked below.
- Accompanying materials:
Calling NAG Library Routines from Java
Mick Pont, Anna Kwiczala, NAG Ltd, Oxford
This report gives detailed instructions on how to call routines in the NAG C and Fortran Libraries from the Java programming language. We show examples using Java running on both UNIX and Microsoft Windows platforms. It has been extended to show how to call option pricing routines and global optimization routines available in the latest versions of the NAG C and Fortran Libraries.
- This report supersedes NAG Technical Report TR1/04 (NP3658)
A Web Services Architecture for Visualization
Jason Wood, Ken Brodlie, Jungwook Seo, David Duke (University of Leeds) and Jeremy Walton (NAG Ltd, Oxford)
Service-oriented architectures are increasingly being used in the creation of large distributed applications. This paper examines the provision of visualization as a service which can be made available for application designers to combine with other services. It describes a three-layer architecture which exploits the strengths of web service technologies in providing standardized access, and which also enables the efficient and flexible construction of visualization applications. A realization of the architecture is illustrated by re-visiting an early example of web-based visualization. This work was carried out within the ADVISE project.