本文整理汇总了C#中DoubleMatrix.Init方法的典型用法代码示例。如果您正苦于以下问题:C# DoubleMatrix.Init方法的具体用法?C# DoubleMatrix.Init怎么用?C# DoubleMatrix.Init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DoubleMatrix
的用法示例。
在下文中一共展示了DoubleMatrix.Init方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: translate
private DoubleMatrix translate(DoubleMatrix i_CenteredMatrix, double i_Angle, double i_XScale, double i_YSale)
{
DoubleMatrix retResult = new DoubleMatrix((Matrix<double>)i_CenteredMatrix.Clone());
DoubleMatrix rotateMatrix = new DoubleMatrix(2, 2);
rotateMatrix[0, 0] = Math.Cos(i_Angle);
rotateMatrix[0, 1] = -1 * Math.Sin(i_Angle);
rotateMatrix[1, 0] = Math.Sin(i_Angle);
rotateMatrix[1, 1] = Math.Cos(i_Angle);
DoubleMatrix scaleMatrix = new DoubleMatrix(2, 2);
scaleMatrix.Init(0);
scaleMatrix[0, 0] = i_XScale;
scaleMatrix[1, 1] = i_YSale;
DoubleMatrix transform = scaleMatrix * rotateMatrix;
return transform * retResult;
}