Skip to main content

RealTensor

RealTensor constructor. A multidimensionnal array of Real, up to 5 dimensions.

Factories

delta_tensor(const List<integer> shape, as_real as_real) -> RealTensor

generate a delta-array of Real with the specified shape. The delta array is one if all indices have the same value, zero otherwise.

Parameters

  • shape: list of positive integers specifying the size along each dimensions of the array
  • as_real: desired scalar type

filled_tensor(const List<integer> shape, integer value, as_real as_real) -> RealTensor

generate an array of Real values filled with a constant value and the specified shape

Parameters

  • shape: list of positive integers specifying the size along each dimensions of the array
  • value: the constant value to fill the array with
  • as_real: desired scalar type

filled_tensor(const List<integer> shape, const real value, as_real as_real) -> RealTensor

generate an array of Real values filled with a constant value and the specified shape

Parameters

  • shape: list of positive integers specifying the size along each dimensions of the array
  • value: the constant value to fill the array with
  • as_real: desired scalar type

random_tensor(const List<integer> shape, as_real as_real) -> RealTensor

Generate a random array of Real values with the specified shape.

Parameters

  • shape: List of positive integers specifying the extent of each dimension of the array.
  • as_real: desired scalar type

uninitialized_tensor(const List<integer> shape, as_real as_real) -> RealTensor

generate an array of uninitialized Real values with the specified shape

Parameters

  • shape: list of positive integers specifying the size along each dimensions of the array
  • as_real: desired scalar type

zero_tensor(const List<integer> shape, as_real as_real) -> RealTensor

generate an array of Real values filled with zeros and the specified shape

Parameters

  • shape: list of positive integers specifying the size along each dimensions of the array
  • as_real: desired scalar type

Constructors

RealTensor(const RealTensor tensor) -> RealTensor

Constructs a multidimensionnal array of RealTensor by copying another one. Supports up to Real dimensions.

Parameters

  • tensor: The tensor to copy.

Symbols

NameDescription
*Element-wise multiplication of Real tensors or tensor-scalar multiplication.
+Element-wise addition of Real tensors or tensor-scalar addition.
-Element-wise subtraction of Real tensors or tensor-scalar subtraction.
/Element-wise division of Real tensors or tensor-scalar division.
=Assigns a RealTensor to another one.
[]Access the element of a zero-dimensionnal Real tensor.

Members

NameDescription
contractContract two tensors along specified dimensions.
contract_conjugate:::tip Convenience overload of conjugate contract for Real-valued tensors. So that algorithms written for the complex valued case work as-is when it can be optimized to use real values. :::...
factorizeFactorize the array into component arrays with the specified options
flattenFlatten a Real tensor into a 1D vector by reshaping all elements into a single dimension.
is_approxCheck if two Real tensors are approximately equal within a tolerance.
orderGet the number of dimensions of a Real tensor.
reshapedCreate a copy of a Real tensor with a new shape.
shapeGet the shape (size along each dimension) of a Real tensor.
squeezeSqueeze a Real tensor by removing all dimensions of size 1.
transposeTranspose a Real tensor by reordering its dimensions.