当前位置: 首页>>代码示例>>C#>>正文


C# DoubleMatrix.Iterate方法代码示例

本文整理汇总了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;
        }
开发者ID:array-cwhite,项目名称:shape-matching,代码行数:32,代码来源:Utils.cs

示例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);
        }
开发者ID:array-cwhite,项目名称:shape-matching,代码行数:10,代码来源:Utils.cs

示例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;
        }
开发者ID:array-cwhite,项目名称:shape-matching,代码行数:15,代码来源:Utils.cs

示例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;
        }
开发者ID:array-cwhite,项目名称:shape-matching,代码行数:18,代码来源:TPS.cs


注:本文中的DoubleMatrix.Iterate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。