ztcl::tensor pow
Raises to a power two tensors, element by element.
ztcl::tensor pow A B
Description
Raises to a power the elements of A and B. The shapes broadcast: they align at the right, and a dimension of size 1 repeats. A plain number for one operand is a scalar of the dtype of the other operand, and the operands need one dtype.
Returns
A tensor.
Examples
Each example of this page runs after package require ztcl::tensor.
% ztcl::tensor pow [ztcl::tensor of {2 3} -dtype f64] 2
tensor f64 2 {4.0 9.0}
Errors
% ztcl::tensor pow [ztcl::tensor of {1 2 3}] [ztcl::tensor of {1 2}]
tensor: the shapes {3} and {2} do not broadcast
-errorcode ZTCL TENSOR
% ztcl::tensor pow 1 2
tensor pow: one operand must be a tensor
-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.