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


C# ILArray.S方法代码示例

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


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

示例1: Test_reference_full_transposed_from_reference_full_transposed

		public void Test_reference_full_transposed_from_reference_full_transposed() {
			int errorCode = 0;
			// success? 
			try {
				object[] data = new object[120];
				for (int i = 120; i-- > 0; )
					data[i] = (double)i;
				ILArray<object> B = new ILArray<object>(data, 5, 4, 3, 2, 1, 1);
				ILArray<object> C = B.S(1);
				ILArray<object> A = C.S(1);
				errorCode = 0;
				if (A.m_data != B.m_data)
					throw new Exception();
				errorCode = 1;
				if (A.Dimensions.NumberOfDimensions != 4)
					throw new Exception();
				errorCode = 2;
				if (A.Dimensions[0] != 3 | A.Dimensions[1] != 2 | A.Dimensions[2] != 5
					| A.Dimensions[3] != 4)
					throw new Exception();
				errorCode = 3;
				object[] mdata = (object[])A.m_data; 
				if (mdata.Length != 120 || A.Dimensions.NumberOfElements != 120)
					throw new Exception();
				errorCode = 4;
				ILIterator<object> It = A.CreateIterator(ILIteratorPositions.ILStart, 0);
				int count = 0;
				do {
					if (It.Value != data[count])
						throw new Exception();
					It.Increment();
					count += 20;
					if (count > 119) {
						count = (count % 119);
					}

				} while (!It.IsAtStart());
				Success("Test_reference_full_transposed_from_reference_full_transposed successful.");
			}
			catch (Exception e) {
				Error("Test_reference_full_transposed_from_reference_full_transposed failed at step: " + errorCode + " Msg: " + e.Message);
			}
		}
开发者ID:wdxa,项目名称:ILNumerics,代码行数:43,代码来源:TESTILStorage.cs

示例2: Test_reference_ranged_transposed_from_reference_full

		public void Test_reference_ranged_transposed_from_reference_full() {
			int errorCode = 0;
			// success? 
			try {
				object[] data = new object[120];
				for (int i = 120; i-- > 0; )
					data[i] = (double)i;
				ILArray<object> B = new ILArray<object>(data, 5, 4, 1, 3, 2, 1, 1);
				// simulate referencing by creating "full" range
				ILArray<object> C = B.S(0);
				ILArray<object> A = C[3,"0:2,4;1,3;0;2,1,0,1"];
				errorCode = 0;
				if (Object.Equals(A,null))
					throw new Exception();
				errorCode++;
				if (A.Dimensions.NumberOfDimensions != 3)
					throw new Exception();
				errorCode++;
				if (A.Dimensions[0] != 4
					| A.Dimensions[1] != 4
					| A.Dimensions[2] != 2)
					throw new Exception();
				errorCode++;
				object[] mdata = (object[])A.m_data;
				if (mdata.Length != 120 || A.Dimensions.NumberOfElements != 32)
					throw new Exception();
				errorCode++;
				// soll werte: 
				double[] results = new double[32]{45,25,5,25,46,26,6,26,47,27,7,27,49,29
									,9,29,55,35,15,35,56,36,16,36,57,37,17,37,59,39,19,39};
				ILIterator<object> I = A.CreateIterator(ILIteratorPositions.ILStart, 0);
				int count = 0;
				do {
					if (((Double)I.Value).CompareTo(results[count++]) != 0)
						throw new Exception();
					I.Increment();
				} while (!I.IsAtStart());
				Success("Test_reference_ranged_transposed_from_reference_full successful.");
			}
			catch (Exception e) {
				Error("Test_reference_ranged_transposed_from_reference_full failed at step: " + errorCode + " Msg: " + e.Message);
			}
		}
开发者ID:wdxa,项目名称:ILNumerics,代码行数:43,代码来源:TESTILStorage.cs

示例3: Test_reference_full

		// reference creation: non transposing, full
		public void Test_reference_full() {
			int errorCode = 0;
			// success? 
			try {
				object[] data = new object[120];
				for (int i = 120; i-- > 0; )
					data[i] = (double)i;
                ILArray<object> B = new ILArray<object>(data, 5, 4, 3, 2, 1, 1);
                ILArray<object> A = B.S(0);
				errorCode = 0;
                if (Object.Equals(A, null))
					throw new Exception();
				errorCode++;
				if (A.Dimensions.NumberOfDimensions != 4)
					throw new Exception();
				errorCode++;
				if (A.Dimensions[0] != 5 | A.Dimensions[1] != 4 | A.Dimensions[2] != 3
					| A.Dimensions[3] != 2)
					throw new Exception();
				errorCode++;
				object[] mdata = (object[])A.m_data; 
				if (mdata.Length != 120 || A.Dimensions.NumberOfElements != 120)
					throw new Exception();
				errorCode++;
				ILIterator<object> It = A.CreateIterator(ILIteratorPositions.ILStart, 0);
				int count = 0;
				do {
					if (It.Value != data[count++])
						throw new Exception();
					It.Increment();
				} while (!It.IsAtEnd());
				Success("Test_reference_full successful.");
			}
			catch (Exception e) {
				Error("Test_reference_full failed at step: " + errorCode  + " Msg: " + e.Message);
			}
		}
开发者ID:wdxa,项目名称:ILNumerics,代码行数:38,代码来源:TESTILStorage.cs


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