/// <summary> /// Initializes the values of the square from a triangle. /// </summary> /// <param name="triangle">Triangle the square is to be initialized from.</param> public void InitFromTriangle(IReadOnlyTriangle triangle) { if (triangle.Periods != Periods) { throw new DimensionMismatchException(Periods, triangle.Periods); } for (int i = 0; i < triangle.Periods; i++) { int col = 0; foreach (decimal val in triangle.GetRow(i)) { _claims[i, col] = val; col++; } } }
/// <summary> /// Constructor given a run-off triangle. /// </summary> /// <param name="triangle">Run-off triangle to be developed by this method.</param> protected FactorBasedMethod(ITriangle triangle) { Triangle = triangle.AsReadOnly(); _projection = new Lazy <IReadOnlySquare>(CalculateProjection); }