本文整理汇总了TypeScript中core/util/data_structures.Set.push方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Set.push方法的具体用法?TypeScript Set.push怎么用?TypeScript Set.push使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core/util/data_structures.Set
的用法示例。
在下文中一共展示了Set.push方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
export const patch_to_column = function(col, patch, shapes) {
const patched = new Set()
let patched_range = false
for (let [ind, value] of patch) {
// make the single index case look like the length-3 multi-index case
let item, shape
if (!isArray(ind)) {
if (isNumber(ind)) {
value = [value]
patched.push(ind)
} else {
patched_range = true
}
ind = [0, 0, ind]
shape = [1, col.length]
item = col
} else {
patched.push(ind[0])
shape = shapes[ind[0]]
item = col[ind[0]]
}
// this is basically like NumPy's "newaxis", inserting an empty dimension
// makes length 2 and 3 multi-index cases uniform, so that the same code
// can handle both
if (ind.length === 2) {
shape = [1, shape[0]]
ind = [ind[0], 0, ind[1]]
}
// now this one nested loop handles all cases
let flat_index = 0
const [istart, istop, istep] = slice(ind[1], shape[0])
const [jstart, jstop, jstep] = slice(ind[2], shape[1])
for (let i = istart; i < istop; i += istep) {
for (let j = jstart; j < jstop; j += jstep) {
if (patched_range) {
patched.push(j)
}
item[(i*shape[1]) + j] = value[flat_index]
flat_index++
}
}
}
return patched
}