Changeset 152
- Timestamp:
- 05/06/08 06:11:58 (5 months ago)
- Files:
-
- trunk/QLNet/QLNet/Math/Vector.cs (modified) (1 diff)
- trunk/QLNet/QLNet/Methods/Finitedifferences/cranknicolson.cs (modified) (2 diffs)
- trunk/QLNet/QLNet/grid.cs (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/QLNet/QLNet/Math/Vector.cs
r145 r152 43 43 /*! \brief creates the array and fills it according to \f$ a_{0} = value, a_{i}=a_{i-1}+increment \f$ */ 44 44 public Vector(int size, double value, double increment) : this(size) { 45 for (int i = 0; i < this.Count; i++ )46 this[i] = value += increment;45 for (int i = 0; i < this.Count; i++, value += increment) 46 this[i] = value; 47 47 } 48 48 trunk/QLNet/QLNet/Methods/Finitedifferences/cranknicolson.cs
r131 r152 28 28 Also, it must implement at least the following interface: 29 29 30 \code31 typedef ... array_type;32 33 // copy constructor/assignment34 // (these will be provided by the compiler if none is defined)35 Operator(const Operator&);36 Operator& operator=(const Operator&);37 38 // inspectors39 Size size();40 41 // modifiers42 void setTime(Time t);43 44 // operator interface45 array_type applyTo(const array_type&);46 array_type solveFor(const array_type&);47 static Operator identity(Size size);48 49 // operator algebra50 Operator operator*(Real, const Operator&);51 Operator operator+(const Operator&, const Operator&);52 Operator operator+(const Operator&, const Operator&);53 \endcode54 55 30 \warning The differential operator must be linear for 56 31 this evolver to work. … … 58 33 \ingroup findiff 59 34 */ 60 class CrankNicolson<Operator> : MixedScheme<Operator>, ISchemeFactory where Operator : IOperator, new(){35 public class CrankNicolson<Operator> : MixedScheme<Operator>, ISchemeFactory where Operator : IOperator { 61 36 // constructors 62 37 public CrankNicolson() { } // required for generics trunk/QLNet/QLNet/grid.cs
r110 r152 33 33 34 34 public static Vector BoundedGrid(double xMin, double xMax, int steps) { 35 Vector result = new Vector(steps + 1); 36 double x = xMin, dx = (xMax - xMin) / steps; 37 for (int i = 0; i < steps + 1; i++, x += dx) 38 result[i] = x; 39 return result; 35 return new Vector(steps + 1, xMin, (xMax - xMin) / steps); 40 36 } 41 37