• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Norm类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Norm的典型用法代码示例。如果您正苦于以下问题:C# Norm类的具体用法?C# Norm怎么用?C# Norm使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Norm类属于命名空间,在下文中一共展示了Norm类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: MatrixNorm

        public override double MatrixNorm(Norm norm, int rows, int columns, double[] matrix)
        {
            if (matrix == null)
            {
                throw new ArgumentNullException("matrix");
            }

            if (rows <= 0)
            {
                throw new ArgumentException(Resources.ArgumentMustBePositive, "rows");
            }

            if (columns <= 0)
            {
                throw new ArgumentException(Resources.ArgumentMustBePositive, "columns");
            }

            if (matrix.Length < rows * columns)
            {
                throw new ArgumentException(string.Format(Resources.ArrayTooSmall, rows * columns), "matrix");
            }

            var work = new double[rows];
            return SafeNativeMethods.d_matrix_norm((byte)norm, rows, columns, matrix, work);
        }
开发者ID:MattHeffron,项目名称:mathnet-numerics,代码行数:25,代码来源:MklLinearAlgebraProvider.Double.cs


示例2: MatrixNorm

        public override float MatrixNorm(Norm norm, int rows, int columns, float[] matrix)
        {
            if (matrix == null)
            {
                throw new ArgumentNullException("matrix");
            }

            if (rows <= 0)
            {
                throw new ArgumentException(Resources.ArgumentMustBePositive, "rows");
            }

            if (columns <= 0)
            {
                throw new ArgumentException(Resources.ArgumentMustBePositive, "columns");
            }

            if (matrix.Length < rows * columns)
            {
                throw new ArgumentException(string.Format(Resources.ArrayTooSmall, rows * columns), "matrix");
            }

            var work = new float[rows];
            return MatrixNorm(norm, rows, columns, matrix, work);
        }
开发者ID:nrolland,项目名称:mathnet-numerics,代码行数:25,代码来源:MklLinearAlgebraProvider.Common.cs


示例3: Edit

 //
 // GET: /Games/Edit/5
 public ActionResult Edit(Norm.ObjectId id)
 {
     Game game = context.Games.GetAll().Single(x => x.Id == id);
     return View(game);
 }
开发者ID:park9140,项目名称:GARDIS,代码行数:7,代码来源:GamesController.cs


示例4: MatrixNorm

 /// <summary>
 /// Computes the requested <see cref="Norm"/> of the matrix.
 /// </summary>
 /// <param name="norm">The type of norm to compute.</param>
 /// <param name="matrix">The matrix to compute the norm from.</param>
 /// <returns>
 /// The requested <see cref="Norm"/> of the matrix.
 /// </returns>
 public Complex MatrixNorm(Norm norm, Complex[] matrix)
 {
     throw new NotImplementedException();
 }
开发者ID:hany-abdelrahman,项目名称:mathnet-numerics,代码行数:12,代码来源:AtlasLinearAlgebraProvider.cs


示例5: MatrixNorm

 /// <summary>
 /// Computes the requested <see cref="Norm"/> of the matrix.
 /// </summary>
 /// <param name="norm">The type of norm to compute.</param>
 /// <param name="rows">The number of rows.</param>
 /// <param name="columns">The number of columns.</param>
 /// <param name="matrix">The matrix to compute the norm from.</param>
 /// <param name="work">The work array. Not used in the managed provider.</param>
 /// <returns>
 /// The requested <see cref="Norm"/> of the matrix.
 /// </returns>
 public virtual double MatrixNorm(Norm norm, int rows, int columns, double[] matrix, double[] work)
 {
     return MatrixNorm(norm, rows, columns, matrix);
 }
开发者ID:rherbrich,项目名称:mathnet-numerics,代码行数:15,代码来源:ManagedLinearAlgebraProvider.Double.cs


示例6: MatrixNorm

 /// <summary>
 /// Computes the requested <see cref="Norm"/> of the matrix.
 /// </summary>
 /// <param name="norm">The type of norm to compute.</param>
 /// <param name="rows">The number of rows.</param>
 /// <param name="columns">The number of columns.</param>
 /// <param name="matrix">The matrix to compute the norm from.</param>
 /// <returns>
 /// The requested <see cref="Norm"/> of the matrix.
 /// </returns>
 public Complex32 MatrixNorm(Norm norm, int rows, int columns, Complex32[] matrix)
 {
     throw new NotImplementedException();
 }
开发者ID:rafaortega,项目名称:mathnet-numerics,代码行数:14,代码来源:MklLinearAlgebraProvider.cs


示例7: Edit

 //
 // GET: /Users/Edit/5
 public ActionResult Edit(Norm.ObjectId id)
 {
     User user = context.Users.GetAll().Single(x => x.Id == id);
     return View(user);
 }
开发者ID:park9140,项目名称:GARDIS,代码行数:7,代码来源:UsersController.cs


示例8: Details

 //
 // GET: /Users/Details/5
 public ViewResult Details(Norm.ObjectId id)
 {
     User user = context.Users.GetAll().Single(x => x.Id == id);
     return View(user);
 }
开发者ID:park9140,项目名称:GARDIS,代码行数:7,代码来源:UsersController.cs


示例9: DeleteConfirmed

 public ActionResult DeleteConfirmed(Norm.ObjectId id)
 {
     User user = context.Users.GetAll().Single(x => x.Id == id);
     context.Users.Delete(user);
     return RedirectToAction("Index");
 }
开发者ID:park9140,项目名称:GARDIS,代码行数:6,代码来源:UsersController.cs


示例10: CanComputeMatrixNorm

 public void CanComputeMatrixNorm(Norm norm, double[] matrix, double[] work)
 {
 }
开发者ID:joeynelson,项目名称:mathnet-numerics,代码行数:3,代码来源:LinearAlgebraProviderTests.cs


示例11: Edit

 //
 // GET: /HashTags/Edit/5
 public ActionResult Edit(Norm.ObjectId id)
 {
     HashTag hashtag = _repository.Linq().Single(x => x.Id == id);
     return View(hashtag);
 }
开发者ID:richardkundl,项目名称:HashMasher,代码行数:7,代码来源:HashTagsController.cs


示例12: Details

 //
 // GET: /HashTags/Details/5
 public ViewResult Details(Norm.ObjectId id)
 {
     HashTag hashtag = _repository.Linq().Single(x => x.Id == id);
     return View(hashtag);
 }
开发者ID:richardkundl,项目名称:HashMasher,代码行数:7,代码来源:HashTagsController.cs


示例13: DeleteConfirmed

 public ActionResult DeleteConfirmed(Norm.ObjectId id)
 {
     _repository.Remove(id);
     return RedirectToAction("Index");
 }
开发者ID:richardkundl,项目名称:HashMasher,代码行数:5,代码来源:HashTagsController.cs


示例14: Bytes

			// Load & cache full bytes array.  Returns bytes.
			public byte[] Bytes()
			{
				lock (this)
				{
					System.Diagnostics.Debug.Assert(refCount > 0 &&(origNorm == null || origNorm.refCount > 0));
					if (bytes == null)
					{
						// value not yet read
						System.Diagnostics.Debug.Assert(bytesRef == null);
						if (origNorm != null)
						{
							// Ask origNorm to load so that for a series of
							// reopened readers we share a single read-only
							// byte[]
							bytes = origNorm.Bytes();
							bytesRef = origNorm.bytesRef;
							bytesRef.IncRef();
							
							// Once we've loaded the bytes we no longer need
							// origNorm:
							origNorm.DecRef();
							origNorm = null;
						}
						else
						{
							// We are the origNorm, so load the bytes for real
							// ourself:
							int count = Enclosing_Instance.MaxDoc();
							bytes = new byte[count];
							
							// Since we are orig, in must not be null
							System.Diagnostics.Debug.Assert(in_Renamed != null);
							
							// Read from disk.
							lock (in_Renamed)
							{
								in_Renamed.Seek(normSeek);
								in_Renamed.ReadBytes(bytes, 0, count, false);
							}
							
							bytesRef = new Ref();
							CloseInput();
						}
					}
					
					return bytes;
				}
			}
开发者ID:nzdunic,项目名称:ravendb,代码行数:49,代码来源:SegmentReader.cs


示例15: MatrixNorm

        /// <summary>
        /// Computes the requested <see cref="Norm"/> of the matrix.
        /// </summary>
        /// <param name="norm">The type of norm to compute.</param>
        /// <param name="rows">The number of rows.</param>
        /// <param name="columns">The number of columns.</param>
        /// <param name="matrix">The matrix to compute the norm from.</param>
        /// <returns>
        /// The requested <see cref="Norm"/> of the matrix.
        /// </returns>
        public double MatrixNorm(Norm norm, int rows, int columns, double[] matrix)
        {
            var ret = 0.0;
            switch (norm)
            {
                case Norm.OneNorm:
                    break;
                case Norm.LargestAbsoluteValue:
                    break;
                case Norm.InfinityNorm:
                    break;
                case Norm.FrobeniusNorm:
                    break;
            }

            return ret;
        }
开发者ID:xmap2008,项目名称:mathnet-numerics,代码行数:27,代码来源:ManagedLinearAlgebraProvider.cs


示例16: SimpleNormForTypesTests

 public SimpleNormForTypesTests()
 {
     norm = new Norm(new SimpleAssert(message => new AssertException(message)));
 }
开发者ID:kkozmic,项目名称:Norman,代码行数:4,代码来源:SimpleNormForTypesTests.cs


示例17: CanComputeMatrixNorm

 public void CanComputeMatrixNorm(Norm norm, float[] matrix, float[] work)
 {
 }
开发者ID:xmap2008,项目名称:mathnet-numerics,代码行数:3,代码来源:LinearAlgebraProviderTests.cs


示例18: MatrixNorm

 /// <summary>
 /// Computes the requested <see cref="Norm"/> of the matrix.
 /// </summary>
 /// <param name="norm">The type of norm to compute.</param>
 /// <param name="rows">The number of rows.</param>
 /// <param name="columns">The number of columns.</param>
 /// <param name="matrix">The matrix to compute the norm from.</param>
 /// <param name="work">The work array. Only used when <see cref="Norm.InfinityNorm"/>
 /// and needs to be have a length of at least M (number of rows of <paramref name="matrix"/>.</param>
 /// <returns>
 /// The requested <see cref="Norm"/> of the matrix.
 /// </returns>
 public virtual float MatrixNorm(Norm norm, int rows, int columns, float[] matrix, float[] work)
 {
     return MatrixNorm(norm, rows, columns, matrix);
 }
开发者ID:koponk,项目名称:mathnet-numerics,代码行数:16,代码来源:ManagedLinearAlgebraProvider.Single.cs


示例19: MatrixNorm

 /// <summary>
 /// Computes the requested <see cref="Norm"/> of the matrix.
 /// </summary>
 /// <param name="norm">The type of norm to compute.</param>
 /// <param name="rows">The number of rows.</param>
 /// <param name="columns">The number of columns.</param>
 /// <param name="matrix">The matrix to compute the norm from.</param>
 /// <returns>
 /// The requested <see cref="Norm"/> of the matrix.
 /// </returns>
 public virtual double MatrixNorm(Norm norm, int rows, int columns, float[] matrix)
 {
     switch (norm)
     {
         case Norm.OneNorm:
             var norm1 = 0d;
             for (var j = 0; j < columns; j++)
             {
                 var s = 0d;
                 for (var i = 0; i < rows; i++)
                 {
                     s += Math.Abs(matrix[(j*rows) + i]);
                 }
                 norm1 = Math.Max(norm1, s);
             }
             return norm1;
         case Norm.LargestAbsoluteValue:
             var normMax = 0d;
             for (var j = 0; j < columns; j++)
             {
                 for (var i = 0; i < rows; i++)
                 {
                     normMax = Math.Max(Math.Abs(matrix[(j * rows) + i]), normMax);
                 }
             }
             return normMax;
         case Norm.InfinityNorm:
             var r = new double[rows];
             for (var j = 0; j < columns; j++)
             {
                 for (var i = 0; i < rows; i++)
                 {
                     r[i] += Math.Abs(matrix[(j * rows) + i]);
                 }
             }
             // TODO: reuse
             var max = r[0];
             for (int i = 0; i < r.Length; i++)
             {
                 if (r[i] > max)
                 {
                     max = r[i];
                 }
             }
             return max;
         case Norm.FrobeniusNorm:
             var aat = new float[rows*rows];
             MatrixMultiplyWithUpdate(Transpose.DontTranspose, Transpose.Transpose, 1.0f, matrix, rows, columns, matrix, rows, columns, 0.0f, aat);
             var normF = 0d;
             for (var i = 0; i < rows; i++)
             {
                 normF += Math.Abs(aat[(i * rows) + i]);
             }
             return Math.Sqrt(normF);
         default:
             throw new NotSupportedException();
     }
 }
开发者ID:larzw,项目名称:mathnet-numerics,代码行数:68,代码来源:ManagedLinearAlgebraProvider.Single.cs


示例20: MatrixNorm

        /// <summary>
        /// Computes the requested <see cref="Norm"/> of the matrix.
        /// </summary>
        /// <param name="norm">The type of norm to compute.</param>
        /// <param name="rows">The number of rows.</param>
        /// <param name="columns">The number of columns.</param>
        /// <param name="matrix">The matrix to compute the norm from.</param>
        /// <returns>
        /// The requested <see cref="Norm"/> of the matrix.
        /// </returns>
        public virtual Complex32 MatrixNorm(Norm norm, int rows, int columns, Complex32[] matrix)
        {
            var ret = 0.0;
            switch (norm)
            {
                case Norm.OneNorm:
                    for (var j = 0; j < columns; j++)
                    {
                        var s = 0.0;
                        for (var i = 0; i < rows; i++)
                        {
                            s += matrix[(j * rows) + i].Magnitude;
                        }

                        ret = Math.Max(ret, s);
                    }

                    break;
                case Norm.LargestAbsoluteValue:

                    for (var i = 0; i < rows; i++)
                    {
                        for (var j = 0; j < columns; j++)
                        {
                            ret = Math.Max(matrix[(j * rows) + i].Magnitude, ret);
                        }
                    }

                    break;
                case Norm.InfinityNorm:
                    for (var i = 0; i < rows; i++)
                    {
                        var s = 0.0;
                        for (var j = 0; j < columns; j++)
                        {
                            s += matrix[(j * rows) + i].Magnitude;
                        }

                        ret = Math.Max(ret, s);
                    }

                    break;
                case Norm.FrobeniusNorm:
                    var aat = new Complex32[rows * rows];
                    MatrixMultiplyWithUpdate(Transpose.DontTranspose, Transpose.Transpose, 1.0f, matrix, rows, columns, matrix, rows, columns, 0.0f, aat);

                    for (var i = 0; i < rows; i++)
                    {
                        ret += aat[(i * rows) + i].Magnitude;
                    }

                    ret = Math.Sqrt(ret);
                    break;
            }

            return Convert.ToSingle(ret);
        }
开发者ID:Amichai,项目名称:PhysicsPad,代码行数:67,代码来源:ManagedLinearAlgebraProvider.Complex32.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Normal类代码示例发布时间:2022-05-24
下一篇:
C# NopNullCache类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap