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


TypeScript ndarray.get函数代码示例

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


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

示例1: testBinary2D

	function testBinary2D(P: ndarray, Q: ndarray, testName: string) {
		for (let i = 0; i < X.shape[0]; ++i) {
			for (let j = 0; j < X.shape[1]; ++j) {
				X.set(i, j, -10000);
				Y.set(i, j, -256);
			}
		}
		t.equals(P.shape[0], Q.shape[0], testName + "; shape[0]");
		t.equals(P.shape[1], Q.shape[1], testName + "; shape[1]");
		for (let i = 0; i < P.shape[0]; ++i) {
			for (let j = 0; j < P.shape[1]; ++j) {
				Q.set(i, j, i * 1000 + j);
				P.set(i, j, 0);
			}
		}
		binary(P, Q, t, P.shape);
		for (let i = 0; i < P.shape[0]; ++i) {
			for (let j = 0; j < P.shape[1]; ++j) {
				if (!(P.get(i, j) === i * 1000 + j + 1001)) {
					t.fail(`${testName}; encountered ${P.get(i, j)} instead of ${(i * 1000 + j + 1001)} at (" + i + "," + j + ")`);
					return;
				}
			}
		}
		t.pass(testName);
	}
开发者ID:AbraaoAlves,项目名称:DefinitelyTyped,代码行数:26,代码来源:cwise-tests.ts

示例2: testUnary1D

	function testUnary1D(arr: ndarray, testName: string) {
		for (let i = 0; i < arr.shape[0]; ++i) {
			arr.set(i, i);
		}
		unary(arr);
		for (let i = 0; i < arr.shape[0]; ++i) {
			if (!(arr.get(i) === i + 1)) {
				t.fail(`${testName}; encountered ${arr.get(i)} instead of ${i + 1} at ${i}`);
				return;
			}
		}
		t.pass(testName);
	}
开发者ID:AbraaoAlves,项目名称:DefinitelyTyped,代码行数:13,代码来源:cwise-tests.ts

示例3: testUnary1D

	function testUnary1D(arr: ndarray, testName: string) {
		for (let i = 0; i < arr.shape[0]; ++i) {
			arr.set(i, i);
		}
		unary(arr);
		for (let i = 0; i < arr.shape[0]; ++i) {
			if (!(arr.get(i) === i + 1)) {
				t.fail(testName + "; encountered " + arr.get(i) + " instead of " + (i + 1) + " at " + i);
				return;
			}
		}
		t.pass(testName);
	}
开发者ID:Crevil,项目名称:DefinitelyTyped,代码行数:13,代码来源:cwise-tests.ts

示例4: testBinary1D

	function testBinary1D(P: ndarray, Q: ndarray, testName: string) {
		t.equals(P.shape[0], Q.shape[0], testName + "; shape");
		for (let i = 0; i < P.shape[0]; ++i) {
			Q.set(i, i);
			P.set(i, 0);
		}
		binary(P, Q, t);
		for (let i = 0; i < P.shape[0]; ++i) {
			if (!(P.get(i) === i + 1001)) {
				t.fail(`${testName}; encountered ${P.get(i)} instead of ${(i + 1001)} at ${i}`);
				return;
			}
		}
		t.pass(testName);
	}
开发者ID:AbraaoAlves,项目名称:DefinitelyTyped,代码行数:15,代码来源:cwise-tests.ts

示例5: testBinary1D

	function testBinary1D(P: ndarray, Q: ndarray, testName: string) {
		t.equals(P.shape[0], Q.shape[0], testName + "; shape");
		for (let i = 0; i < P.shape[0]; ++i) {
			Q.set(i, i);
			P.set(i, 0);
		}
		binary(P, Q, t);
		for (let i = 0; i < P.shape[0]; ++i) {
			if (!(P.get(i) === i + 1001)) {
				t.fail(testName + "; encountered " + P.get(i) + " instead of " + (i + 1001) + " at " + i);
				return;
			}
		}
		t.pass(testName);
	}
开发者ID:Crevil,项目名称:DefinitelyTyped,代码行数:15,代码来源:cwise-tests.ts

示例6: testUnary2D

	function testUnary2D(arr: ndarray, testName: string) {
		for (let i = 0; i < arr.shape[0]; ++i) {
			for (let j = 0; j < arr.shape[1]; ++j) {
				arr.set(i, j, i + j * arr.shape[0]);
			}
		}
		unary(arr);
		for (let i = 0; i < arr.shape[0]; ++i) {
			for (let j = 0; j < arr.shape[1]; ++j) {
				if (!(arr.get(i, j) === 1 + i + j * arr.shape[0])) {
					t.fail(`${testName}; encountered ${arr.get(i, j)} instead of ${1 + i + j * arr.shape[0]} at (${i},${j})`);
					return;
				}
			}
		}
		t.pass(testName);
	}
开发者ID:AbraaoAlves,项目名称:DefinitelyTyped,代码行数:17,代码来源:cwise-tests.ts

示例7: testUnary2D

	function testUnary2D(arr: ndarray, testName: string) {
		for (let i = 0; i < arr.shape[0]; ++i) {
			for (let j = 0; j < arr.shape[1]; ++j) {
				arr.set(i, j, i + j * arr.shape[0]);
			}
		}
		unary(arr);
		for (let i = 0; i < arr.shape[0]; ++i) {
			for (let j = 0; j < arr.shape[1]; ++j) {
				if (!(arr.get(i, j) === 1 + i + j * arr.shape[0])) {
					t.fail(testName + "; encountered " + arr.get(i, j) + " instead of " + (1 + i + j * arr.shape[0]) + " at (" + i + "," + j + ")");
					return;
				}
			}
		}
		t.pass(testName);
	}
开发者ID:Crevil,项目名称:DefinitelyTyped,代码行数:17,代码来源:cwise-tests.ts


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