Tensor<T> Class
Represents a multi-dimensional array of elements of the same type.
Definition
Namespace: Numerics.NET.Tensors
Assembly: Numerics.NET.Tensors (in Numerics.NET.Tensors.dll) Version: 9.0.3
C#
Assembly: Numerics.NET.Tensors (in Numerics.NET.Tensors.dll) Version: 9.0.3
public abstract class Tensor<T> : ITensor,
IEnumerable<T>, IEnumerable, IEquatable<Tensor<T>>, IStructuralComparable,
IStructuralEquatable, IFormattable
- Inheritance
- Object → Tensor<T>
- Implements
- ITensor, IEnumerable<T>, IEnumerable, IStructuralComparable, IStructuralEquatable, IEquatable<Tensor<T>>, IFormattable
Type Parameters
- T
- The type of the elements.
Constructors
Tensor<T>() | Constructs a new tensor. |
Tensor<T>(SerializationInfo, StreamingContext) | Constructs a new tensor from serialization data. |
Properties
Attributes | Gets attributes associated with the tensor. |
Back | Gets the set of operators for tensors of this element type. |
Compressed | Gets the axis or dimension along which elements are compressed. |
Element | Gets the type of the elements of the tensor. |
Flattened | Gets the total number of elements in the tensor. |
Has | Gets whether the tensor's element type supports basic linear algebra operations. |
IsCompressed | Gets whether the elements of the tensor are compressed along a dimension. |
IsContiguous | Gets whether the elements of the tensor are stored contiguously. |
IsC | Gets whether the elements of the tensor are stored in contiguous C-style order, with the last index changing fastest. |
IsFortran | Gets whether the elements of the tensor are stored in contiguous Fortran-style order, with the first index changing fastest. |
IsScalar | Gets whether the tensor represents a scalar. |
Item[AdvancedTensorIndex] | Gets or sets the elements of a tensor specified by an 'advanced' tensor index. |
Item[AdvancedTensorIndex[]] | Gets or sets the elements of a tensor specified by a set of tensor indices. |
Item[ReadOnlySpan<TensorIndex>] | Gets or sets the elements of a tensor specified by a set of tensor indices. |
Item[Tensor<Boolean>] | Gets or sets the elements whose corresponding value in a boolean tensor is true. |
Item[TensorIndex] | Gets or sets the elements of a tensor specified by a tensor index. |
Item[TensorIndex[]] | Gets or sets the elements of a tensor specified by a set of tensor indices. |
Item[AdvancedTensorIndex, AdvancedTensorIndex] | Gets or sets the elements of a tensor specified by two 'advanced' tensor indices. |
Item[TensorIndex, TensorIndex] | Gets or sets the elements of a tensor specified by two tensor indices. |
Item[AdvancedTensorIndex, AdvancedTensorIndex, AdvancedTensorIndex] | Gets or sets the elements of a tensor specified by three 'advanced' tensor indices. |
Item[TensorIndex, TensorIndex, TensorIndex] | Gets or sets the elements of a tensor specified by three tensor indices. |
Layout | Gets the layout of the tensor in memory. |
Precedence | Infrastructure. This property supports the Numerics.NET infrastructure and is not intended to be used directly from your code. |
Rank | Gets the number of dimensions of the tensor. |
Shape | Gets the shape (dimensions) of the tensor. |
Value | Gets the value of the first element in the tensor. |
Methods
Abs | Computes the absolute value of the elements of a tensor in place. |
Acosh | Computes the inverse hyperbolic cosine of the elements of a tensor in place. |
Acos | Computes the inverse cosine of the elements of a tensor in place. |
Add | Adds a tensor and a scalar in-place. |
Add | Adds two tensors in place. |
Add | Multiplies two tensors elementwise and multiplies the result by a third in place. |
All<TPredicate>(TPredicate, Tensor<Boolean>, Boolean) | Computes whether all elements of the tensor satisfy the specified predicate. |
All<TPredicate>(TPredicate, Axes, Tensor<Boolean>, Boolean, Tensor<Boolean>, Boolean, TensorElementOrder) | Computes whether all elements of the tensor along the specified axis satisfy the specified predicate. |
And | Computes the bitwise and of a tensor and a scalar in-place. |
And | Computes the bitwise and of two tensors in place. |
Any<TPredicate>(TPredicate, Tensor<Boolean>, Boolean) | Computes whether any elements of the tensor satisfy the specified predicate. |
Any<TPredicate>(TPredicate, Axes, Tensor<Boolean>, Boolean, Tensor<Boolean>, Boolean, TensorElementOrder) | Computes whether any elements of the tensor along the specified axis satisfy the specified predicate. |
As<U>() | Casts the tensor as a tensor of the specified type. |
As<U, TTransform>() | Casts the tensor as a tensor of the specified type. |
Asinh | Computes the inverse hyperbolic sine of the elements of a tensor in place. |
Asin | Computes the inverse sine of the elements of a tensor in place. |
AsMatrix | Returns the tensor as a matrix. |
AsVector | Returns the tensor as a vector. |
Atan2In | Computes the inverse tangent of the elements of a tensor and a scalar. in-place. |
Atan2In | Computes the inverse tangent of the elements of two tensors in place. |
Atanh | Computes the inverse hyperbolic tangent of the elements of a tensor in place. |
Atan | Computes the inverse tangent of the elements of a tensor in place. |
Broadcast | Broadcasts the current tensor into the specified shape |
Cbrt | Computes the cube root of the elements of a tensor in place. |
Ceiling | Computes the smallest integer that is not greater than the elements of a tensor in place. |
Clamp | Computes the values of a tensor clamped by the corresponding values of two other tensors in place. |
Clone | Returns a tensor of the same shape and order of elements as this tensor. |
Clone | Returns a tensor of the same shape and order of elements as this tensor. |
Copy | Returns a copy of the tensor. |
Copy | Copies the contents of this tensor to another tensor. |
Copy | Copies the contents of this tensor to another tensor. |
Cosh | Computes the hyperbolic cosine of the elements of a tensor in place. |
Cos | Computes the cosine of the elements of a tensor in place. |
Cumulative | Computes the cumulative product of the elements of a tensor in place. |
Cumulative | Computes the cumulative sum of the elements of a tensor in place. |
Divide | Divides a tensor by a scalar in-place. |
Divide | Divides one tensor by another in place. |
Equals( | Determines whether the specified object is equal to the current object. (Overrides Object.Equals(Object)) |
Equals( | Indicates whether the current object is equal to another object of the same type. |
Equals( | Determines whether an object is structurally equal to the current instance. |
Exp10In | Computes the exponential function (base 10) of the elements of a tensor in place. |
Exp2In | Computes the exponential function (base 2) of the elements of a tensor in place. |
Exp | Computes the exponential function of the elements of a tensor in place. |
Exp | Computes the exponential function of the elements of a tensor in place. |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object) |
Find() | Gets the linearized indexes of the elements of the tensor that are not zero. |
Find( | Gets the linearized indexes where the elements of the tensor satisfy the specified predicate. |
Floor | Computes the largest integer that is not less than the elements of a tensor in place. |
Get | Gets the elements on the diagonal of a 2-dimensional tensor. |
Get | Gets an enumerator for the tensor. |
Get |
Returns the hash code for this tensor.
(Overrides Object.GetHashCode()) |
Get | Gets the length of the tensor along the specified axis. |
Get | Gets the length of the tensor along the specified axis. |
Get | Gets a sequence of the matrices formed by the last two dimensions of the tensor. |
Get | Gets the Type of the current instance. (Inherited from Object) |
Get | Gets the value at the specified position in a 1D tensor. |
Get | Gets the element at the specified position. |
Get | Gets the value at the specified index in a 1D tensor. |
Get | Gets the element at the specified position. |
Get | Gets the element at the specified position. |
Get | Gets the element at the specified position. |
Get | Gets the value at the specified position in a 2D tensor. |
Get | Gets the value at the specified position in a 2D tensor. |
Get | Gets the value at the specified position in a 3D tensor. |
Get | Gets the value at the specified position in a 2D tensor. |
Get | Gets the value at the specified position in a 4D tensor. |
Get | Gets the value at the specified position in a 4D tensor. |
Get | Gets the element at the specified position. |
Hypot | Computes the square root of the sum of the squares of the elements of a tensor and a scalar. in-place. |
Hypot | Computes the square root of the sum of the squares of the elements of two tensors in place. |
Insert | Inserts a singleton dimension at the specified position. |
Insert | Inserts a singleton dimension at the specified position. |
Left | Shifts the elements of a tensor to the left. in-place. |
Left | Shifts the elements of a tensor to the left in place. |
Log10In | Computes the base 10 logarithm of the elements of a tensor in place. |
Log1p | Computes the logarithm of the elements of a tensor in place. |
Log2In | Computes the base 2 logarithm of the elements of a tensor in place. |
Log | Computes the logarithm of the elements of a tensor in place. |
Log | Computes the logarithm of the elements of a tensor to base a scalar. in-place. |
Log | Computes the logarithm of the elements of a tensor in the base specified by another tensor in place. |
Map<TResult> | Applies a function to the elements of the tensor and returns the result in a second tensor. |
Map | Applies a function to the elements of a tensor in-place. |
Max | Computes the maximum of the elements of a tensor and a scalar. in-place. |
Max | Computes the largest of corresponding elements of two tensors in place. |
Max | Computes the maximum of the elements of a tensor and a scalar. in-place. |
Max | Computes the largest of corresponding elements of two tensors without propagating NaN's (where applicable) in place. |
Memberwise | Creates a shallow copy of the current Object. (Inherited from Object) |
Min | Computes the minimum of the elements of a tensor and a scalar. in-place. |
Min | Computes the smallest of corresponding elements of two tensors in place. |
Min | Computes the minimum of the elements of a tensor and a scalar. in-place. |
Min | Computes the smallest of corresponding elements of two tensors without propagating NaN's (where applicable) in place. |
Modulus | Computes the remainder after dividing a tensor by a scalar in-place. |
Modulus | Returns the remainder after dividing one tensor by another in place. |
Move | Moves a set of axes to new positions in a tensor. |
Move | Moves a set of axes to new positions in a tensor. |
Move | Moves a set of axes to new positions in a tensor. |
Move | Moves a set of axes to new positions in a tensor. |
Move | Moves an axis to a new position in a tensor. |
Multiply | Multiplies a tensor and a scalar in-place. |
Multiply | Multiplies two tensors in place. |
Multiply | Adds two tensors and multiplies the result elementwise by a third in place. |
Negate | Negates a tensor in place. |
Not | Computes the bitwise complement of a tensor in place. |
OrIn | Computes the bitwise or of a tensor and a scalar in-place. |
OrIn | Computes the bitwise or of two tensors in place. |
Pow | Raises the elements of a tensor to an integer power. in-place. |
Pow | Raises the elements of a tensor to a power. in-place. |
Pow | Raises the elements of a tensor to a power in place. |
Pow | Raises the elements of a tensor to an integer power in place. |
Reciprocal | Computes the reciprocal of the elements of a tensor in place. |
Remove | Returns a tensor with the same values but with the specified unit dimension removed. |
Remove | Returns a tensor with the same values but with the specified unit dimension removed. |
Reshape(Int32[]) | Reshapes the tensor to have the specified dimensions. |
Reshape( | Reshapes the tensor to have the specified dimensions. |
Right | Shifts the elements of a tensor to the right. in-place. |
Right | Shifts the elements of a tensor to the right in place. |
Root | Computes the n-th root of a the elements of a tensor in-place. |
Root | Computes the n-th root of the elements of a tensor in place. |
Round | Rounds the elements of a tensor to the specified number of digits. in-place. |
Round | Rounds the elements of a tensor to the specified number of digits in place. |
Set | Sets all elements of the tensor to the specified value. |
Set | Sets the value at the specified index in a 1D tensor. |
Set | Sets the element at the specified position to the specified value. |
Set | Sets the value at the specified index in a 1D tensor. |
Set | Sets the element at the specified position to the specified value. |
Set | Sets the element at the specified position to the specified value. |
Set | Sets the element at the specified position to the specified value. |
Set | Sets the value at the specified position in a 2D tensor. |
Set | Sets the value at the specified position in a 2D tensor. |
Set | Sets the value at the specified position in a 3D tensor. |
Set | Sets the value at the specified position in a 3D tensor. |
Set | Sets the value at the specified position in a 4D tensor. |
Set | Sets the value at the specified position in a 4D tensor. |
Set | Sets the element at the specified linear position to the specified value. |
Sinh | Computes the hyperbolic sine of the elements of a tensor in place. |
Sin | Computes the sine of the elements of a tensor in place. |
Sort | Sorts the elements of a tensor in place. |
Sort | Sorts the elements of a tensor in place. |
Sqrt | Computes the square root of the elements of a tensor in place. |
Subtract | Subtracts a scalar from a scalar in-place. |
Subtract | Subtracts one tensor from another in place. |
Swap | Interchanges two axes of the tensor. |
Swap | Interchanges two axes of the tensor. |
Tanh | Computes the hyperbolic tangent of the elements of a tensor in place. |
Tan | Computes the tangent of the elements of a tensor in place. |
ToArray | Gets the elements of the tensor as an array in the specified order. |
ToString() | Returns a string that represents the current object. (Overrides Object.ToString()) |
ToString( | Converts the numeric value of this tensor instance to its equivalent string representation, using the specified format. |
ToString( | Returns a String representation of this tensor. |
Transform<TResult>(Func<T, TResult>) | Returns a tensor that lazily applies the specified operation to each element of the current tensor. |
Transform<TTransformation, TResult>(TTransformation) | Returns a tensor that lazily applies the specified operation to each element of the current tensor. |
Transpose | Swaps the last two dimensions of the tensor and returns the result. |
Truncate | Truncates the elements of a tensor to the nearest integer in place. |
Xor | Computes the bitwise xor of a tensor and a scalar in-place. |
Xor | Computes the bitwise xor of two tensors in place. |
Operators
Addition( | Adds a scalar and a tensor. |
Addition( | Adds a tensor and a scalar. |
Addition( | Adds two tensors. |
Addition | Adds a constant to a matrix in place. |
Addition | Adds another matrix to a matrix in place. |
Bitwise | Computes the bitwise and of a scalar and a tensor. |
Bitwise | Computes the bitwise and of a tensor and a scalar. |
Bitwise | Computes the bitwise and of two tensors. |
Bitwise | Computes the bitwise or of a scalar and a tensor. |
Bitwise | Computes the bitwise or of a tensor and a scalar. |
Bitwise | Computes the bitwise or of two tensors. |
Division( | Divides a scalar by a tensor. |
Division( | Divides a tensor by a scalar. |
Division( | Divides one tensor by another. |
Division | Divides a matrix by a constant in place. |
Equality( | Compares a scalar and a tensor for equality.. |
Equality( | Compares a tensor and a scalar for equality.. |
Equality( | Determines whether two tensors are equal. |
Exclusive | Computes the bitwise xor of a scalar and a tensor. |
Exclusive | Computes the bitwise xor of a tensor and a scalar. |
Exclusive | Computes the bitwise xor of two tensors. |
Explicit(T to Tensor<T>) | Implicitly converts a scalar value to a 0-dimensional scalar tensor. |
Explicit(T[] to Tensor<T>) | Implicitly converts an array to a 1-dimensional scalar tensor. |
Explicit(T[,,] to Tensor<T>) | Implicitly converts an array to a 3-dimensional scalar tensor. |
Explicit(T[,] to Tensor<T>) | Implicitly converts an array to a 2-dimensional scalar tensor. |
Explicit(Tensor<T> to T) | Converts a scalar (0-dimensional) tensor to the corresponding scalar value. |
Exponentiation( | Raises a scalar to a power. |
Exponentiation( | Raises a scalar to an integer power. |
Exponentiation( | Raises the elements of a tensor to a power. |
Exponentiation( | Raises the elements of a tensor to a power. |
Exponentiation( | Raises the elements of a tensor to an integer power. |
Exponentiation( | Raises the elements of a tensor to an integer power. |
Greater | Returns whether a scalar are greater than the elements of a tensor.. |
Greater | Returns whether the elements of a tensor are greater than a scalar.. |
Greater | Returns whether the elements of one tensor are greater than the corresponding elements of another tensor.. |
Greater | Returns whether a scalar are greater than or equal to the elements of a tensor.. |
Greater | Returns whether the elements of a tensor are greater than or equal to a scalar.. |
Greater | Returns whether the elements of one tensor are less than or equal to the corresponding elements of another tensor.. |
Inequality( | Compares a scalar and a tensor for inequality.. |
Inequality( | Compares a tensor and a scalar for inequality.. |
Inequality( | Determines whether two tensors are not equal. |
Left | Shifts the elements of a tensor to the left.. |
Less | Returns whether a scalar are less than the elements of a tensor.. |
Less | Returns whether the elements of a tensor are less than a scalar.. |
Less | Returns whether the elements of one tensor are less than the corresponding elements of another tensor.. |
Less | Returns whether a scalar are less than or equal to the elements of a tensor.. |
Less | Returns whether the elements of a tensor are less than or equal to a scalar.. |
Less | Returns whether the elements of one tensor are less than or equal to the corresponding elements of another tensor.. |
Modulus( | Computes the remainder after dividing a scalar by a tensor. |
Modulus( | Computes the remainder after dividing a tensor by a scalar. |
Modulus( | Returns the remainder after dividing one tensor by another. |
Multiply( | Multiplies a scalar and a tensor. |
Multiply( | Multiplies a tensor and a scalar. |
Multiply( | Multiplies two tensors. |
Multiply | Multiplies a matrix by a constant in place. |
Ones | Computes the bitwise complement of a tensor. |
Right | Shifts the elements of a tensor to the right.. |
Subtraction( | Subtracts a tensor from a tensor. |
Subtraction( | Subtracts a scalar from a scalar. |
Subtraction( | Subtracts one tensor from another. |
Subtraction | Subtracts a constant from a matrix in place. |
Subtraction | Subtracts another matrix from a matrix in place. |
Unary | Negates a tensor. |
Fields
Empty | Gets an empty (rank -1) tensor. |
NaN | A read-only scalar tensor that represents Not-a-Number. |
Negative | A read-only scalar tensor that represents negative infinity. |
One | A read-only scalar tensor that represents the number one. |
Positive | A read-only scalar tensor that represents positive infinity. |
Zero | A read-only scalar tensor that represents the number zero. |
Extension Methods
Absolute |
Computes the element with the largest absolute value of a tensor.
(Defined by Tensor) |
Absolute |
Computes the element with the largest absolute value of a tensor.
(Defined by Tensor) |
Absolute |
Computes the index of the elements of a tensor with the largest absolute value
along the specified axis.
(Defined by Tensor) |
Absolute |
Computes the element with the smallest absolute value of a tensor.
(Defined by Tensor) |
Absolute |
Computes the element with the smallest absolute value of a tensor.
(Defined by Tensor) |
Absolute |
Computes the index of the elements of a tensor with the smallest absolute value
along the specified axis.
(Defined by Tensor) |
Correlation<T> |
Computes the correlation of the corresponding elements of two tensors.
(Defined by Tensor) |
Cosine |
Computes the cosine similarity of the corresponding elements of two tensors.
(Defined by Tensor) |
Covariance<T> |
Computes the covariance of the corresponding elements of two tensors.
(Defined by Tensor) |
Dot |
Computes the dot product of the corresponding elements of two tensors.
(Defined by Tensor) |
Euclidean |
Computes the Euclidean distance of the corresponding elements of two tensors.
(Defined by Tensor) |
Group<T> |
Returns a grouping by the unique elements in a sequence.
(Defined by Grouping) |
Group<T> |
Returns a grouping by the unique elements in a sequence
using the specified comparer to determine equality.
(Defined by Grouping) |
Max<T> |
Computes the maxima of the elements of a tensor
along the specified axis.
(Defined by Tensor) |
Max |
Computes the index of the largest elements of a tensor
along the specified axis.
(Defined by Tensor) |
Max |
Computes the largest element of a tensor.
(Defined by Tensor) |
Max |
Computes the largest element of a tensor.
(Defined by Tensor) |
Mean<T> |
Computes the mean of the elements of a tensor.
(Defined by Tensor) |
Mean<T> |
Computes the mean of the elements of a tensor.
(Defined by Tensor) |
Median<T> |
Computes the mean of the elements of a tensor.
(Defined by Tensor) |
Median<T> |
Computes the mean of the elements of a tensor.
(Defined by Tensor) |
Min<T> |
Computes the minima of the elements of a tensor
along the specified axis.
(Defined by Tensor) |
Min |
Computes the index of the smallest elements of a tensor
along the specified axis.
(Defined by Tensor) |
Min |
Computes the smallest element of a tensor.
(Defined by Tensor) |
Min |
Computes the smallest element of a tensor.
(Defined by Tensor) |
Norm<T> |
Computes the two-norm of the elements of a tensor.
(Defined by Tensor) |
Norm<T> |
Computes the two-norm of the elements of a tensor.
(Defined by Tensor) |
One |
Computes the sum of the absolute values of the elements of a tensor.
(Defined by Tensor) |
One |
Computes the sum of the absolute values of the elements of a tensor.
(Defined by Tensor) |
Product<T> |
Computes the product of the elements of a tensor.
(Defined by Tensor) |
Product<T> |
Computes the product of the elements of a tensor.
(Defined by Tensor) |
Standard |
Returns the standard deviation of the elements of a sequence.
(Defined by Stats) |
Standard |
Computes the standard deviation of the elements of a tensor.
(Defined by Tensor) |
Standard |
Computes the standard deviation of the elements of a tensor.
(Defined by Tensor) |
Sum<T> |
Computes the sum of the sequence of values.
(Defined by ArrayMath) |
Sum<T> |
Computes the sum of the elements of a tensor.
(Defined by Tensor) |
Sum<T> |
Computes the sum of the elements of a tensor.
(Defined by Tensor) |
Sum<T, U> |
Computes the sum of the sequence of values that are obtained
by invoking a transform function on each element of the input sequence.
(Defined by ArrayMath) |
Sum<T, T2, U> |
Computes the sum of the sequence of values that are obtained
by invoking a transform function on each pair of elements of
the input sequences.
(Defined by ArrayMath) |
Variance<T> |
Computes the variance of the elements of a tensor.
(Defined by Tensor) |
Variance<T> |
Computes the variance of the elements of a tensor.
(Defined by Tensor) |