本文整理汇总了C#中DoubleMatrix.Iterate方法的典型用法代码示例。如果您正苦于以下问题:C# DoubleMatrix.Iterate方法的具体用法?C# DoubleMatrix.Iterate怎么用?C# DoubleMatrix.Iterate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DoubleMatrix
的用法示例。
在下文中一共展示了DoubleMatrix.Iterate方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShiftToPositives
public static DoubleMatrix ShiftToPositives(ref DoubleMatrix io_Coordinates,params DoubleMatrix[] io_AffectedAlso)
{
DoubleMatrix retMinMax = MinMaxByRow(io_Coordinates);
DoubleMatrix growByMatrix = new DoubleMatrix(retMinMax.RowsCount, 1);
growByMatrix.Init(0);
Func<int, int, double, double> prepareGrowingCell = (row, col, value) =>
{
if (retMinMax[row, sr_MinCol] < 0)
{
retMinMax[row, sr_MinCol] = Math.Abs(retMinMax[row, sr_MinCol]);
retMinMax[row, sr_MaxCol] += retMinMax[row, sr_MinCol];
return retMinMax[row, sr_MinCol];
}
else
{
retMinMax[row, sr_MinCol] = value;
return value;
}
};
growByMatrix.Iterate(prepareGrowingCell);
AddScalarsByDims(ref io_Coordinates, growByMatrix);
for (int i = 0; i < io_AffectedAlso.Length; ++i)
{
AddScalarsByDims(ref io_AffectedAlso[i], growByMatrix);
}
return retMinMax;
}
示例2: AddScalarsByDims
public static void AddScalarsByDims(ref DoubleMatrix io_leftHandMatrix, DoubleMatrix i_rightHandVector)
{
if ((i_rightHandVector.ColumnsCount > 1) || (io_leftHandMatrix.RowsCount != i_rightHandVector.RowsCount))
{
throw new PCAException("Dimension are not meet for substraction of a vector from matrix by rows");
}
Func<int, int, double, double> substractByDim = (row, col, Val) => (Val + (double)i_rightHandVector[row, 0]);
io_leftHandMatrix.Iterate(substractByDim);
}
示例3: MinMaxByRow
public static DoubleMatrix MinMaxByRow(DoubleMatrix i_matrix)
{
DoubleMatrix retMinMaxMatrix = new DoubleMatrix(i_matrix.RowsCount, 2);
Func<int, int, double, double> calcAVG = (rows, cols, value) =>
{
retMinMaxMatrix[rows, sr_MinCol] = Math.Min(retMinMaxMatrix[rows, 0], value);
retMinMaxMatrix[rows, sr_MaxCol] = Math.Max(retMinMaxMatrix[rows, 1], value);
return value;
};
i_matrix.Iterate(calcAVG);
return retMinMaxMatrix;
}
示例4: mapTargets
private static DoubleMatrix mapTargets(DoubleMatrix i_TargetMapping)
{
DoubleMatrix retNormalized = new DoubleMatrix(i_TargetMapping.RowsCount + 3, i_TargetMapping.ColumnsCount);
Func<int, int, double, double> transferCell = (row, col, value) =>
{
if (row >= i_TargetMapping.RowsCount)
{
return 0;
}
else
{
return i_TargetMapping[row, col];
}
};
retNormalized.Iterate(transferCell);
return retNormalized;
}