本文整理汇总了C#中DoubleVector类的典型用法代码示例。如果您正苦于以下问题:C# DoubleVector类的具体用法?C# DoubleVector怎么用?C# DoubleVector使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DoubleVector类属于命名空间,在下文中一共展示了DoubleVector类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Stats_c
/// <summary>
/// Creates statistics for the c-chart
/// </summary>
/// <param name="defects">Count of defect / nonconformity per-sample period</param>
/// <param name="Stds">Number of standard deviations, either 1, 2, or 3 to use for control limits</param>
/// <param name="ChartTitle">Title of chart.</param>
/// <param name="TimeStart">The start time of the data.</param>
/// <param name="TimeInterval">Time interval between each sample group.</param>
/// <param name="TimeAxisLabel">Horizontal axis label.</param>
/// <param name="StatisticsLabel">Vertical axis label.</param>
public Stats_c(DoubleVector Defects, int Stds, String ChartTitle, Double TimeStart, Double TimeInterval, String TimeAxisLabel, String StatisticsLabel)
{
if (Stds == 1 || Stds == 2 || Stds == 3)
{
this.CenterLine = StatsFunctions.Mean(Defects);
this.ConstControlLimits = true;
this.UCL = new DoubleVector(Defects.Length, this.CenterLine + Stds * Math.Sqrt(this.CenterLine));
if(this.CenterLine - Stds * Math.Sqrt(this.CenterLine) > 0)
this.LCL = new DoubleVector(Defects.Length, this.CenterLine - Stds * Math.Sqrt(this.CenterLine));
else
this.LCL = new DoubleVector(Defects.Length, 0);
this.Statistic = Defects;
this.TimeStart = TimeStart;
this.TimeSampleInterval = TimeInterval;
this.TimeLabel = TimeAxisLabel;
this.DefectLabel = StatisticsLabel;
this.ChartTitle = ChartTitle;
}
else
{
throw new ArgumentException("In stats_c, the number of standard deviations must be either 1, 2, or 3");
}
}
示例2: method
public override void method(ref double[] vpre, DoubleVector vpost)
{
Assert(vpre[0], 1.0);
vpre[0] = 2.0;
Assert(vpost.Count, 2);
vpost.Add(1.0);
}
示例3: Stats_np
/// <summary>
/// Creates statistics for the np-chart.
/// </summary>
/// <param name="DefectCountInSample">Count of failed samples per-sample.</param>
/// <param name="SampleSize">Size of each sample</param>
/// <param name="Stds">Number of standard deviations, either 1, 2, or 3 to use for control limits</param>
/// <param name="ChartTitle">Title of chart.</param>
/// <param name="TimeStart">The start time of the data.</param>
/// <param name="TimeInterval">Time interval between each sample group.</param>
/// <param name="TimeAxisLabel">Horizontal axis label.</param>
/// <param name="StatisticsLabel">Vertical axis label.</param>
public Stats_np(DoubleVector DefectCountInSample, int SampleSize, Double Stds, String ChartTitle, Double TimeStart, Double TimeInterval, String TimeAxisLabel, String StatisticsLabel)
{
double pbar;
if (Stds == 1 || Stds == 2 || Stds == 3)
{
pbar = StatsFunctions.Sum(DefectCountInSample) / (SampleSize * DefectCountInSample.Length);
this.CenterLine = pbar * SampleSize;
this.ConstControlLimits = true;
this.UCL = new DoubleVector(DefectCountInSample.Length, this.CenterLine + Stds * StatsFunctions.Sqrt( SampleSize * pbar * (1 - pbar) ));
this.LCL = new DoubleVector(DefectCountInSample.Length, this.CenterLine - Stds * StatsFunctions.Sqrt( SampleSize * pbar * (1 - pbar) ));
for (int i = 0; i < this.LCL.Length; i++)
{
if (this.LCL[i] < 0)
this.LCL[i] = 0;
}
this.Statistic = DefectCountInSample;
this.TimeStart = TimeStart;
this.TimeSampleInterval = TimeInterval;
this.TimeLabel = TimeAxisLabel;
this.DefectLabel = StatisticsLabel;
this.ChartTitle = ChartTitle;
}
else
{
throw new ArgumentException("In Stats_np, the number of standard deviations must be either 1, 2, or 3");
}
}
示例4: AddStepLineSeries
/// <summary>
/// Adds a step line series to the chart
/// </summary>
/// <param name="chart"></param>
/// <param name="name"></param>
/// <param name="vector"></param>
/// <param name="xstart"></param>
/// <param name="xincrement"></param>
void AddStepLineSeries(NChart chart, string name, DoubleVector vector, double xstart, double xincrement)
{
NStepLineSeries stepline = new NStepLineSeries();
chart.Series.Add(stepline);
// Name the line
stepline.Name = name;
// Tell the series to regard the X values
stepline.UseXValues = true;
// No data labels
stepline.DataLabelStyle.Visible = false;
// Set the line color
stepline.BorderStyle = new NStrokeStyle(1.0f, Color.Gray, LinePattern.Dash);
// Fill X values
for (int i = 0; i < vector.Length; i++)
{
stepline.XValues.Add(xstart + xincrement * i);
}
// Fill Y values
stepline.Values.AddRange(vector.DataBlock.Data);
}
示例5: Expand_BandStructure
/// <summary>
/// returns a DoubleMatrix with the given band structure planarised in the transverse direction
/// </summary>
public static Band_Data Expand_BandStructure(DoubleVector structure, int ny)
{
DoubleMatrix result = new DoubleMatrix(ny, structure.Length);
for (int i = 0; i < ny; i++)
for (int j = 0; j < structure.Length; j++)
result[i, j] = structure[j];
return new Band_Data(result);
}
示例6: Main
static void Main(string[] args)
{
Console.Write("**************** INFORMATION ***************" + "\n");
Console.Write("This example was auto-generated by the language-agnostic dev/scripts/example_generator.py script written by Ian Bell" + "\n");
Console.Write("CoolProp version:" + " " + CoolProp.get_global_param_string("version") + "\n");
Console.Write("CoolProp gitrevision:" + " " + CoolProp.get_global_param_string("gitrevision") + "\n");
Console.Write("CoolProp Fluids:" + " " + CoolProp.get_global_param_string("FluidsList") + "\n");
// See http://www.coolprop.org/coolprop/HighLevelAPI.html#table-of-string-inputs-to-propssi-function for a list of inputs to high-level interface;
Console.Write("*********** HIGH LEVEL INTERFACE *****************" + "\n");
Console.Write("Critical temperature of water:" + " " + CoolProp.Props1SI("Water", "Tcrit") + " " + "K" + "\n");
Console.Write("Boiling temperature of water at 101325 Pa:" + " " + CoolProp.PropsSI("T", "P", 101325, "Q", 0, "Water") + " " + "K" + "\n");
Console.Write("Phase of water at 101325 Pa and 300 K:" + " " + CoolProp.PhaseSI("P", 101325, "Q", 0, "Water") + "\n");
Console.Write("c_p of water at 101325 Pa and 300 K:" + " " + CoolProp.PropsSI("C", "P", 101325, "T", 300, "Water") + " " + "J/kg/K" + "\n");
Console.Write("c_p of water (using derivatives) at 101325 Pa and 300 K:" + " " + CoolProp.PropsSI("d(H)/d(T)|P", "P", 101325, "T", 300, "Water") + " " + "J/kg/K" + "\n");
Console.Write("*********** HUMID AIR PROPERTIES *****************" + "\n");
Console.Write("Humidity ratio of 50% rel. hum. air at 300 K, 101325 Pa:" + " " + CoolProp.HAPropsSI("W", "T", 300, "P", 101325, "R", 0.5) + " " + "kg_w/kg_da" + "\n");
Console.Write("Relative humidity from last calculation:" + " " + CoolProp.HAPropsSI("R", "T", 300, "P", 101325, "W", CoolProp.HAPropsSI("W", "T", 300, "P", 101325, "R", 0.5)) + " " + "(fractional)" + "\n");
Console.Write("*********** INCOMPRESSIBLE FLUID AND BRINES *****************" + "\n");
Console.Write("Density of 50% (mass) ethylene glycol/water at 300 K, 101325 Pa:" + " " + CoolProp.PropsSI("D", "T", 300, "P", 101325, "INCOMP::MEG-50%") + " " + "kg/m^3" + "\n");
Console.Write("Viscosity of Therminol D12 at 350 K, 101325 Pa:" + " " + CoolProp.PropsSI("V", "T", 350, "P", 101325, "INCOMP::TD12") + " " + "Pa-s" + "\n");
// If you don't have REFPROP installed, disable the following lines;
Console.Write("*********** REFPROP *****************" + "\n");
Console.Write("Critical temperature of water:" + " " + CoolProp.Props1SI("REFPROP::Water", "Tcrit") + " " + "K" + "\n");
Console.Write("Boiling temperature of water at 101325 Pa:" + " " + CoolProp.PropsSI("T", "P", 101325, "Q", 0, "REFPROP::Water") + " " + "K" + "\n");
Console.Write("c_p of water at 101325 Pa and 300 K:" + " " + CoolProp.PropsSI("C", "P", 101325, "T", 300, "REFPROP::Water") + " " + "J/kg/K" + "\n");
Console.Write("*********** TABULAR BACKENDS *****************" + "\n");
AbstractState TAB = AbstractState.factory("BICUBIC&HEOS", "R245fa");
TAB.update(input_pairs.PT_INPUTS, 101325, 300);
Console.Write("Mass density of refrigerant R245fa at 300 K, 101325 Pa:" + " " + TAB.rhomass() + " " + "kg/m^3" + "\n");
Console.Write("*********** SATURATION DERIVATIVES (LOW-LEVEL INTERFACE) ***************" + "\n");
AbstractState AS_SAT = AbstractState.factory("HEOS", "R245fa");
AS_SAT.update(input_pairs.PQ_INPUTS, 101325, 0);
Console.Write("First saturation derivative:" + " " + AS_SAT.first_saturation_deriv(parameters.iP, parameters.iT) + " " + "Pa/K" + "\n");
Console.Write("*********** LOW-LEVEL INTERFACE *****************" + "\n");
AbstractState AS = AbstractState.factory("HEOS", "Water&Ethanol");
DoubleVector z = new DoubleVector(new double[]{0.5, 0.5});
AS.set_mole_fractions(z);
AS.update(input_pairs.PQ_INPUTS, 101325, 1);
Console.Write("Normal boiling point temperature of water and ethanol:" + " " + AS.T() + " " + "K" + "\n");
// If you don't have REFPROP installed, disable the following block;
Console.Write("*********** LOW-LEVEL INTERFACE (REFPROP) *****************" + "\n");
AbstractState AS2 = AbstractState.factory("REFPROP", "Methane&Ethane");
DoubleVector z2 = new DoubleVector(new double[]{0.2, 0.8});
AS2.set_mole_fractions(z2);
AS2.update(input_pairs.QT_INPUTS, 1, 120);
Console.Write("Vapor molar density:" + " " + AS2.keyed_output(parameters.iDmolar) + " " + "mol/m^3" + "\n");
}
示例7: nButtonCChart_Click
/// <summary>
/// Example c-Chart
/// </summary>
private void nButtonCChart_Click(object sender, EventArgs e)
{
// c-Chart sample data
// This data-set was copied from the 'pcmanufact' data set packaged with the R qcc package by Luca Scrucca
//
// Example Data Description
// A personal computer manufacturer counts the number of nonconformities per unit on the final
// assembly line. He collects data on 20 samples of 5 computers each.
DoubleVector defects = new DoubleVector(10, 12, 8, 14, 10, 16, 11, 7, 10, 15, 9, 5, 7, 11, 12, 6, 8, 10, 7, 5);
IAttributeChartStats stats_c = new Stats_c(defects, 3, "c-Chart pcmanufact dataset");
// build the Nevron c-Chart visualization
this.nQualityControlChart.AutoRefresh = true;
this.nQualityControlChart.Clear();
AttributeChart cChart = new AttributeChart(stats_c, this.nQualityControlChart);
// Update description in UI
this.nRichDescription.Text = "The c-Chart, or Count Chart, is an attribute control chart for monitoring the total number of nonconformities per subgroup over time. The size of each measured subgroup must be constant.";
}
示例8: Stats_p
/// <summary>
/// Creates statistics for the p-chart.
/// </summary>
/// <param name="DefectCountInSample">Count of failed samples per-sample.</param>
/// <param name="SampleSizes">Size of each sample</param>
/// <param name="Stds">Number of standard deviations, either 1, 2, or 3 to use for control limits</param>
/// <param name="ChartTitle">Title of chart.</param>
/// <param name="TimeStart">The start time of the data.</param>
/// <param name="TimeInterval">Time interval between each sample group.</param>
/// <param name="TimeAxisLabel">Horizontal axis label.</param>
/// <param name="StatisticsLabel">Vertical axis label.</param>
public Stats_p(DoubleVector DefectCountInSample, DoubleVector SampleSizes, Double Stds, String ChartTitle, Double TimeStart, Double TimeInterval, String TimeAxisLabel, String StatisticsLabel)
{
if (Stds == 1 || Stds == 2 || Stds == 3)
{
if (DefectCountInSample.Length == SampleSizes.Length)
{
this.CenterLine = StatsFunctions.Sum(DefectCountInSample) / StatsFunctions.Sum(SampleSizes);
this.ConstControlLimits = false;
this.UCL = this.CenterLine + Stds * StatsFunctions.Sqrt( (new DoubleVector(SampleSizes.Length, this.CenterLine)) * (new DoubleVector(SampleSizes.Length, 1.0 - this.CenterLine)) ) / StatsFunctions.Sqrt(SampleSizes);
this.LCL = this.CenterLine - Stds * StatsFunctions.Sqrt( (new DoubleVector(SampleSizes.Length, this.CenterLine)) * (new DoubleVector(SampleSizes.Length, 1.0 - this.CenterLine)) ) / StatsFunctions.Sqrt(SampleSizes);
for (int i = 0; i < this.LCL.Length; i++)
{
if (this.LCL[i] < 0)
this.LCL[i] = 0;
}
this.Statistic = DefectCountInSample / SampleSizes;
this.TimeStart = TimeStart;
this.TimeSampleInterval = TimeInterval;
this.TimeLabel = TimeAxisLabel;
this.DefectLabel = StatisticsLabel;
this.ChartTitle = ChartTitle;
}
else
{
throw new ArgumentException("In Stats_p, the defect count and sample size vectors much have the same length");
}
}
else
{
throw new ArgumentException("In Stats_p, the number of standard deviations must be either 1, 2, or 3");
}
}
示例9: SimpleNeuralNetwork
/// <summary>
/// Create a new neural network.
/// </summary>
/// <param name="inputs">The number of inputs that this network will accept.</param>
/// <param name="hiddenNeurons">The number of hidden neurons in this network.</param>
/// <param name="outputNeurons">The number of outputs to expect from this network.</param>
/// <param name="learningRate">The rate to train this network.</param>
public SimpleNeuralNetwork(int inputs, int hiddenNeurons, int outputNeurons, double learningRate)
{
random = new Random();
inputsCount = inputs;
hiddenCount = hiddenNeurons;
outputCount = outputNeurons;
// The weights
weights_IH = new double[inputsCount, hiddenCount];
weights_HO = new double[hiddenCount, outputCount];
InitializeWeightsRandomly();
// The neuron activations
neurons_H = new double[hiddenCount];
neurons_O = new DoubleVector(outputCount);
// The error arrays
error_H = new double[hiddenCount];
error_O = new double[outputCount];
this.learningRate = learningRate;
}
示例10: Division
public Polynomial Division(Polynomial DividedPolynome, Polynomial DividerPolynome)
{
Polynomial FractionPolynome = new Polynomial();
string coefs = "";
List<double> DividedPolynomeCoeffs = DividedPolynome.Coeff.ToList();
List<double> DividerPolynomeCoeffs = DividerPolynome.Coeff.ToList();
int FractionPolynomeDegree = DividedPolynome.Degree - DividerPolynome.Degree;
Polynomial NewDividerPolynome = new Polynomial();
Polynomial RestPolynome = new Polynomial();
int j = 0;
List<double> FractionPolynomeCoeffs = new List<double>();
do
{
for (int k = 0; k < FractionPolynomeDegree; k++)
{
coefs += "0 ";
}
FractionPolynomeCoeffs.Insert(0, DividedPolynomeCoeffs[DividedPolynomeCoeffs.Count - 1] / DividerPolynomeCoeffs[DividerPolynomeCoeffs.Count - 1]);
coefs += (DividedPolynomeCoeffs[DividedPolynomeCoeffs.Count - 1] / DividerPolynomeCoeffs[DividerPolynomeCoeffs.Count - 1]).ToString() + " ";
FractionPolynome = new Polynomial(new DoubleVector(coefs));
NewDividerPolynome = Polynomial.Multiply(FractionPolynome, DividerPolynome);
RestPolynome = Polynomial.Subtract(DividedPolynome, NewDividerPolynome);
DividedPolynome = RestPolynome;
DividedPolynomeCoeffs = DividedPolynome.Coeff.ToList();
FractionPolynomeDegree--;
coefs = String.Empty;
j++;
} while ((RestPolynome.Degree != 0));
FractionPolynomeCoeffs.Insert(0, DividedPolynomeCoeffs[DividedPolynomeCoeffs.Count - 1] / DividerPolynomeCoeffs[DividerPolynomeCoeffs.Count - 1]);
string FractionPolynomeCoefficients = String.Empty;
foreach (var coef in FractionPolynomeCoeffs)
{
FractionPolynomeCoefficients += Convert.ToString(coef) + " ";
}
DoubleVector FractionPolynomeVector = new DoubleVector(FractionPolynomeCoefficients);
FractionPolynome = new Polynomial(FractionPolynomeVector);
return FractionPolynome;
}
示例11: forwards
public DoubleVector forwards() {
DoubleVector ret = new DoubleVector(NQuantLibcPINVOKE.ForwardCurve_forwards(swigCPtr), false);
if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
示例12: Band_Data
public Band_Data(int nz, double val)
{
this.vec = new DoubleVector(nz, val);
dim = 1;
}
示例13: Min
public double Min()
{
if (dim == 1)
return vec.Min();
else if (dim == 2)
return mat.Min();
else if (dim == 3)
{
DoubleVector mat_min = new DoubleVector(vol.Length);
for (int i = 0; i < vol.Length; i++)
mat_min[i] = vol[i].Min();
return mat_min.Min();
}
else
throw new NotImplementedException();
}
示例14: DeepenThisCopy
public Band_Data DeepenThisCopy()
{
Band_Data tmp_result = null;
if (dim == 1)
{
DoubleVector result = new DoubleVector(Length);
for (int i = 0; i < Length; i++)
result[i] = this[i];
tmp_result = new Band_Data(result);
}
else if (dim == 2)
{
DoubleMatrix result = new DoubleMatrix(mat.Rows, mat.Cols);
for (int i = 0; i < mat.Rows; i++)
for (int j = 0; j < mat.Cols; j++)
result[i, j] = mat[i, j];
tmp_result = new Band_Data(result);
}
else if (dim == 3)
{
int nx = vol[0].Rows;
int ny = vol[0].Cols;
int nz = vol.Length;
Band_Data result = new Band_Data(nx, ny, nz, 0.0);
for (int k = 0; k < nz; k++)
for (int i = 0; i < nx; i++)
for (int j = 0; j < ny; j++)
result.vol[k][i, j] = this.vol[k][i, j];
tmp_result = result;
}
else
throw new NotImplementedException();
if (this.Laplacian != null)
tmp_result.Laplacian = this.Laplacian.DeepenThisCopy();
return tmp_result;
}
示例15: DiscountCurve
public DiscountCurve(DateVector dates, DoubleVector discounts, DayCounter dayCounter) : this(NQuantLibcPINVOKE.new_DiscountCurve__SWIG_2(DateVector.getCPtr(dates), DoubleVector.getCPtr(discounts), DayCounter.getCPtr(dayCounter)), true) {
if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
}