Om
1.0.0
A universal framework for multimedia simulation
|
A class that stores a generalized mathematical value of arbitrary dimension and type. More...
#include <omTensor.h>
Public Member Functions | |
Tensor () | |
Create a default tensor with no value set. More... | |
Tensor (const TensorType &newType) | |
Create a tensor with the specified type and an undefined value. More... | |
Tensor (const TensorType &newType, const UByte *valueData) | |
Create a tensor with the specified type and a value from the specified opaque data source. More... | |
template<typename T > | |
Tensor (const T &newValue) | |
Create a tensor with the type and value of the specified parameter. More... | |
Tensor (const Tensor &other) | |
Create a copy of the specified tensor and its value. More... | |
~Tensor () | |
Destroy a Tensor object and deallocate the internal storage. More... | |
Tensor & | operator= (const Tensor &other) |
Assign the value and type of another tensor to this tensor. More... | |
const TensorType & | getType () const |
Return the type of value that this tensor stores. More... | |
void | setType (const TensorType &newType) |
Set the type of value that this tensor stores. More... | |
void | set (const TensorType &newType, const UByte *valueData) |
Set this tensor to have the specified type and value from an opaque data source. More... | |
template<typename T > | |
void | set (const T &newValue) |
Set the value of this tensor to be a copy of the specified object. More... | |
template<typename T > | |
Bool | get (T &outputValue) const |
Get the value of this tensor as the type of the template output parameter. More... | |
Bool | zero () |
Set the entire contents of this tensor to zero. More... | |
Size | getScalarCount () const |
Return the number of components that are in this attribute value. More... | |
template<typename T > | |
Bool | getScalars (T *output) const |
Get the components of the AttributeValue in the output pointer. More... | |
template<typename T > | |
T * | getScalars () |
Return a pointer to the components of this Shader attribute, stored in column-major order. More... | |
template<typename T > | |
const T * | getScalars () const |
Return a pointer to the components of this tensor. More... | |
UByte * | getPointer () |
Return a raw pointer to the underlying data storage for this tensor's value. More... | |
const UByte * | getPointer () const |
Return a raw pointer to the underlying data storage for this tensor's value. More... | |
Bool | isNull () const |
Return whether or not the tensor's value is not set. More... | |
Bool | isSet () const |
Return whether or not the tensor has a value set. More... | |
data::String | toString () const |
Return a string representation of the tensor's value. More... | |
operator data::String () const | |
Convert this tensor's value into a string representation. More... | |
Tensor | operator+ (const Tensor &other) const |
Add another tensor to this one and return the result. More... | |
Tensor | operator- (const Tensor &other) const |
Add another tensor to this one and return the result. More... | |
Tensor | operator* (const Tensor &other) const |
Multiply this tensor and another one and return the result. More... | |
Tensor | operator/ (const Tensor &other) const |
Divide this tensor by another one and return the result. More... | |
Tensor & | operator+= (const Tensor &other) |
Add another tensor to this one, modifying this tensor. More... | |
Tensor & | operator-= (const Tensor &other) |
Subtract another tensor from this one, modifying this tensor. More... | |
Tensor & | operator*= (const Tensor &other) |
Multiply this tensor by another one, modifying this tensor. More... | |
Tensor & | operator/= (const Tensor &other) |
Divide this tensor by another one, modifying this tensor. More... | |
A class that stores a generalized mathematical value of arbitrary dimension and type.
A tensor is a generalized matrix. This class supports tensors up to dimension 3.
|
inline |
Create a default tensor with no value set.
om::math::Tensor::Tensor | ( | const TensorType & | newType | ) |
Create a tensor with the specified type and an undefined value.
om::math::Tensor::Tensor | ( | const TensorType & | newType, |
const UByte * | valueData | ||
) |
Create a tensor with the specified type and a value from the specified opaque data source.
|
inlineexplicit |
Create a tensor with the type and value of the specified parameter.
If the new tensor value's type is undefined, the tensor is constructed with no value stored.
om::math::Tensor::Tensor | ( | const Tensor & | other | ) |
Create a copy of the specified tensor and its value.
|
inline |
Destroy a Tensor object and deallocate the internal storage.
Assign the value and type of another tensor to this tensor.
|
inline |
Return the type of value that this tensor stores.
void om::math::Tensor::setType | ( | const TensorType & | newType | ) |
Set the type of value that this tensor stores.
The internal memory for the tensor is enlarged if necessary to contain the specified type. The contents of the value are undefined after this method is called.
void om::math::Tensor::set | ( | const TensorType & | newType, |
const UByte * | valueData | ||
) |
Set this tensor to have the specified type and value from an opaque data source.
If the value data is NULL, the type of the tensor is changed but it is uninitialized.
|
inline |
Set the value of this tensor to be a copy of the specified object.
This method is for tensor types that have a size that is known at compile time.
|
inline |
Get the value of this tensor as the type of the template output parameter.
This method is for tensor types that have a size that is known at compile time. The method returns whether or not the tensor's type was able to be converted to the template type.
|
inline |
Set the entire contents of this tensor to zero.
|
inline |
Return the number of components that are in this attribute value.
|
inline |
Get the components of the AttributeValue in the output pointer.
If the templated type of the output pointer matches the type of the shader attribute's component type, TRUE is returned and the attribute is placed in the location specified by the output pointer. Otherwise FALSE is returned and no value is retrieved.
|
inline |
Return a pointer to the components of this Shader attribute, stored in column-major order.
If the templated type of the function matches the type of the shader attribute's component type, the function is successful and the component pointer is returned. Otherwise, NULL is returned indicating failure.
|
inline |
Return a pointer to the components of this tensor.
If the templated type of the function matches the type of the tensor's scalar type, the function is successful and the component pointer is returned. Otherwise, NULL is returned indicating failure.
|
inline |
Return a raw pointer to the underlying data storage for this tensor's value.
|
inline |
Return a raw pointer to the underlying data storage for this tensor's value.
|
inline |
Return whether or not the tensor's value is not set.
|
inline |
Return whether or not the tensor has a value set.
data::String om::math::Tensor::toString | ( | ) | const |
Return a string representation of the tensor's value.
|
inline |
Convert this tensor's value into a string representation.
Add another tensor to this one and return the result.
Add another tensor to this one and return the result.
Multiply this tensor and another one and return the result.
Divide this tensor by another one and return the result.
Add another tensor to this one, modifying this tensor.
Subtract another tensor from this one, modifying this tensor.
Multiply this tensor by another one, modifying this tensor.
Divide this tensor by another one, modifying this tensor.