public Indexers3() { var rnd = new RandomSystem(1); indices.SetByIndex(i => rnd.UniformV2i(3)); vectors.SetByIndex(i => new Vector(rnd.CreateUniformDoubleArray(3))); matrices.SetByIndex(i => new Matrix(rnd.CreateUniformDoubleArray(9))); }
public __type__() { var rnd = new RandomSystem(1); indices.SetByIndex(i => rnd.UniformV2i(__n__)); vectors.SetByIndex(i => new __vtype__(rnd.CreateUniformDoubleArray(__n__))); matrices.SetByIndex(i => new __nmtype__(rnd.CreateUniformDoubleArray(__nm__))); }
private static void GetRandomComplex(RandomSystem rnd, out Num.Complex c1, out ComplexD c2, bool withInf = true) { var type = rnd.UniformDouble(); if (type < 0.1) { var v = rnd.UniformV2i(2); c1 = new Num.Complex(v.X, v.Y); c2 = new ComplexD(v.X, v.Y); } else if (type < 0.2 && withInf) { var i = rnd.UniformV2i(3); var v = new V2d( (i.X == 0) ? 0 : ((i.X == 1) ? double.NegativeInfinity : double.PositiveInfinity), (i.Y == 0) ? 0 : ((i.Y == 1) ? double.NegativeInfinity : double.PositiveInfinity) ); c1 = new Num.Complex(v.X, v.Y); c2 = new ComplexD(v.X, v.Y); } else { var v = (rnd.UniformV2d() - 0.5) * 100; if (type < 0.4) { c1 = new Num.Complex(v.X, 0); c2 = new ComplexD(v.X, 0); } else if (type < 0.5) { c1 = new Num.Complex(0, v.Y); c2 = new ComplexD(0, v.Y); } else { c1 = new Num.Complex(v.X, v.Y); c2 = new ComplexD(v.X, v.Y); } } }