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


C# ILArray.Dispose方法代码示例

本文整理汇总了C#中ILArray.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# ILArray.Dispose方法的具体用法?C# ILArray.Dispose怎么用?C# ILArray.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ILArray的用法示例。


在下文中一共展示了ILArray.Dispose方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Test_Sum


//.........这里部分代码省略.........
                Info("Sum(1000x1000x10) [phy ohne Zuweisung] needed: " + p.ToString());

				errorCode = 4;
				data = new double[1000 * 1000 * 10];
				A = new ILArray<double>(data, 1000000, 10);
                p.Tic();
                C = ILMath.sum(A);
                p.Toc();
                Info("Sum(1000000x10) [phy] needed: " + p.ToString());
                p.Tic();
                ILMath.sum(A);
                p.Toc();
                Info("Sum(1000000x10) [phy ohne Zuweisung] needed: " + p.ToString());

				errorCode = 5;
				data = new double[10 * 1000000];
				A = new ILArray<double>(data, 10, 1000000);
                p.Tic();
                C = ILMath.sum(A);
                p.Toc();
                Info("Sum(10 x 1000000) [Phy] needed: " + p.ToString());
                p.Tic();
                ILMath.sum(A);
                p.Toc();
                Info("Sum(10 x 1000000) [Phy ohne Zuweisung] needed: " + p.ToString());

                errorCode = 6;
				data = new double[1000 * 1000 * 10];
				data[1] = 1.0;
                A = (ILArray<double>)A.T;
                p.Tic();
                C = ILMath.sum(A);
                p.Toc();
                Info("Sum(1000000 x 10) [Ref] needed: " + p.ToString());
                p.Tic();
                ILMath.sum(A);
                p.Toc();
                Info("Sum(1000000 x 10) [Ref ohne Zuweisung] needed: " + p.ToString());


                errorCode = 7;
                data = new double[120];
                for (int i = 0; i < data.Length; i++)
                    data[i] = i + 1;
                A = new ILArray<double>(data, 6, 5, 4); 
                data = new double[24]{65,70,75,80,85,90,215,220,225,230,235,240,365
                                        ,370,375,380,385,390,515,520,525,530,535,540};
                Res = new ILArray<double>(data, 6, 1, 4);
                p.Tic();
                C = ILMath.sum(A,1);
                p.Toc();
                Info("Sum(6, 5, 4) [phy, dim 2] needed: " + p.ToString());
                p.Tic();
                ILMath.sum(A,1);
                p.Toc();
                Info("Sum(6, 5, 4) [phy ohne Zuweisung] needed: " + p.ToString());
                if (!Res.Equals(C))
					throw new Exception("Wrong values of Sum result! ");

				errorCode = 8;
                //data = new double[20000000];
                //for (int i = 0; i < data.Length; i++)
                //    data[i] = 2;
				A = ILMath.zeros(1,20000000) + 2.0; 
				Res = 4.0e+07;
				p.Tic();
				C = ILMath.sum(A);
				p.Toc();
				Info("Sum(20000000,1) [phy] needed: " + p.ToString());
				if (!Res.Equals(C))
					throw new Exception("Wrong values of Sum result! ");
				p.Tic();
				ILMath.sum(A);
				p.Toc();
				Info("Sum(20000000,1) [phy ohne Zuw.] needed: " + p.ToString());

				errorCode = 9;
                A.MinimumRefDimensions = 2;
				A.Dispose();
				A = new ILArray<double>(ILMemoryPool.Pool.New<double>(20000000),1,20000000).R; 
				p.Tic();
				C = ILMath.sum(A);
				p.Toc();
				Info("Sum(2,10000000) [ref 'vector'] needed: " + p.ToString());
				p.Tic();
				ILMath.sum(A);
				p.Toc();
				Info("Sum(1,20000000) [ref vector ohne Zuw.] needed: " + p.ToString());
				A = null;
				B = null;
				C = null;
				Res = null; 
                errorCode = 10; 
				Success("Test_Sum successfull");
            } catch (SerializationException e) {
				Error("Test_Sum failed at errorCode: "+errorCode +" Reason: " + e.Message);
            } catch (Exception e) {
				Error("Test_Sum failed at errorCode: " + errorCode + " Reason: " + e.Message);
            }
        }
开发者ID:wdxa,项目名称:ILNumerics,代码行数:101,代码来源:TESTILMath.cs


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