Commit 46666be2 authored by Dmitry I. Lyakh's avatar Dmitry I. Lyakh
Browse files

Implemented TensorOperation.getTensorOperandId().

parent b7085882
......@@ -46,6 +46,11 @@ unsigned int TensorOperation::getNumOperandsSet() const
return static_cast<unsigned int>(operands_.size());
}
std::size_t TensorOperation::getTensorOperandId(unsigned int op_num)
{
return reinterpret_cast<std::size_t>(this->getTensorOperand(op_num).get());
}
std::shared_ptr<Tensor> TensorOperation::getTensorOperand(unsigned int op_num)
{
if(op_num < operands_.size()) return operands_[op_num];
......
/** ExaTN::Numerics: Tensor operation
REVISION: 2019/06/03
REVISION: 2019/06/05
Copyright (C) 2018-2019 Dmitry I. Lyakh (Liakh)
Copyright (C) 2018-2019 Oak Ridge National Laboratory (UT-Battelle) **/
......@@ -50,6 +50,9 @@ public:
/** Returns the number of tensor operands set. **/
unsigned int getNumOperandsSet() const;
/** Returns a unique integer tensor operand identifier. **/
std::size_t getTensorOperandId(unsigned int op_num);
/** Returns a co-owned pointer to a specific tensor operand, or nullptr if not yet set. **/
std::shared_ptr<Tensor> getTensorOperand(unsigned int op_num);
......
/** ExaTN::Numerics: Tensor shape
REVISION: 2019/05/27
REVISION: 2019/06/05
Copyright (C) 2018-2018 Dmitry I. Lyakh (Liakh)
Copyright (C) 2018-2018 Oak Ridge National Laboratory (UT-Battelle) **/
......@@ -72,7 +72,7 @@ extents_(extents.size())
}
int i = 0;
for(const auto & extent: extents) extents_[i++] = DimExtent{extent};
for(const auto & extent: extents) extents_[i++] = static_cast<DimExtent>(extent);
}
template<typename T>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment