ztcl::tensor equal
Tests that two tensors have the same dtype, shape, and bits.
ztcl::tensor equal A B
Description
Gives 1 when A and B have one dtype, one shape, and the same bits in each element, and 0 when they differ. A NaN equals a NaN with the same bits, and 0.0 differs from -0.0.
Returns
1 or 0.
Examples
Each example of this page runs after package require ztcl::tensor.
% set a [ztcl::tensor of {{1 2 3} {4 5 6}}]; ztcl::tensor equal $a [ztcl::tensor of {1 2 3 4 5 6} -shape {2 3}]
1
% ztcl::tensor equal [ztcl::tensor of 0.0] [ztcl::tensor of -0.0]
0
Errors
% ztcl::tensor equal x y
not 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.