コード例 #1
0
        /// <summary>
        /// Build up the matrix of capfloor volatilities (expiry x strike)
        /// </summary>
        /// <param name="column">The volaility to extract.</param>
        /// <param name="instrument">The type of the volatility surface at each expiry</param>
        /// <param name="volatility">A 2d array of the volatilities</param>
        private decimal[] GenerateVolatilityMatrix(string[] instrument, int column, decimal[,] volatility)
        {
            if (column > volatility.GetLongLength(1))
            {
                return(null);
            }
            var maxRows = Math.Min(instrument.Length, volatility.GetLongLength(0));
            var result  = new List <decimal>();

            for (var row = 0; row < maxRows; row++)
            {
                result.Add(volatility[row, column]);
            }
            return(result.ToArray());
        }