beetlebug▾
/

ztcl::tensor unpick

Makes a zero matrix with one value of G in each row.

ztcl::tensor unpick G INDEX SHAPE

Description

Gives a zero matrix of SHAPE with G[r] at the column INDEX[r] of each row r. It is the adjoint of pick.

Returns

A tensor.

Examples

Each example of this page runs after package require ztcl::tensor.

% ztcl::tensor unpick [ztcl::tensor of {7 8}] {2 0} {2 3}
tensor f32 {2 3} {0.0 0.0 7.0 8.0 0.0 0.0}

Errors

% ztcl::tensor unpick [ztcl::tensor of {7 8}] {2 3} {2 3}
tensor unpick: index out of range
-errorcode ZTCL TENSOR

Facts

Capability
None.
Tcl release
Tcl 9.1 and 8.6.
Since
ztcl 1.0.0-beta.4
Compute cost
A cost for each element operation by its kind (a copy, an add, a division, a math function, a multiply-add of a matmul), set so that one compute unit takes about the time of one unit of plain Tcl. docs/modules/tensor.md has the table.