From 667cabe3aa54d53d6c542950f6d3876c7f0ba58f Mon Sep 17 00:00:00 2001 From: Rasmus Munk Larsen <4643818-rmlarsen1@users.noreply.gitlab.com> Date: Sun, 22 Feb 2026 22:04:23 -0800 Subject: [PATCH] Clean up comments in unsupported module libeigen/eigen!2198 Co-authored-by: Rasmus Munk Larsen --- unsupported/Eigen/AlignedVector3 | 2 +- .../Eigen/CXX11/src/Tensor/TensorArgMax.h | 8 +-- .../Eigen/CXX11/src/Tensor/TensorAssign.h | 2 +- .../Eigen/CXX11/src/Tensor/TensorBase.h | 2 +- .../Eigen/CXX11/src/Tensor/TensorBlock.h | 14 ++-- .../CXX11/src/Tensor/TensorBroadcasting.h | 4 +- .../CXX11/src/Tensor/TensorConcatenation.h | 5 +- .../CXX11/src/Tensor/TensorContraction.h | 4 +- .../CXX11/src/Tensor/TensorContractionGpu.h | 6 +- .../src/Tensor/TensorContractionThreadPool.h | 12 ++-- .../CXX11/src/Tensor/TensorConvolution.h | 15 +--- .../CXX11/src/Tensor/TensorConvolutionSycl.h | 6 +- .../Eigen/CXX11/src/Tensor/TensorCostModel.h | 2 +- .../Eigen/CXX11/src/Tensor/TensorDevice.h | 2 +- .../CXX11/src/Tensor/TensorDeviceDefault.h | 4 +- .../Eigen/CXX11/src/Tensor/TensorDeviceGpu.h | 4 +- .../CXX11/src/Tensor/TensorDeviceThreadPool.h | 2 +- .../Eigen/CXX11/src/Tensor/TensorDimensions.h | 4 +- .../Eigen/CXX11/src/Tensor/TensorEvalTo.h | 1 - .../Eigen/CXX11/src/Tensor/TensorEvaluator.h | 4 +- .../Eigen/CXX11/src/Tensor/TensorExecutor.h | 4 +- .../Eigen/CXX11/src/Tensor/TensorExpr.h | 2 +- .../Eigen/CXX11/src/Tensor/TensorFFT.h | 22 +----- .../Eigen/CXX11/src/Tensor/TensorFixedSize.h | 4 -- .../Eigen/CXX11/src/Tensor/TensorForcedEval.h | 3 +- .../Eigen/CXX11/src/Tensor/TensorImagePatch.h | 6 +- .../Eigen/CXX11/src/Tensor/TensorIndexList.h | 4 +- .../CXX11/src/Tensor/TensorInitializer.h | 2 +- .../Eigen/CXX11/src/Tensor/TensorIntDiv.h | 1 - .../Eigen/CXX11/src/Tensor/TensorMap.h | 4 +- .../Eigen/CXX11/src/Tensor/TensorMorphing.h | 4 +- .../Eigen/CXX11/src/Tensor/TensorPadding.h | 2 +- .../Eigen/CXX11/src/Tensor/TensorRandom.h | 40 +++-------- .../Eigen/CXX11/src/Tensor/TensorReduction.h | 16 ++--- .../CXX11/src/Tensor/TensorReductionGpu.h | 10 +-- .../CXX11/src/Tensor/TensorReductionSycl.h | 12 ++-- .../Eigen/CXX11/src/Tensor/TensorRef.h | 1 - .../Eigen/CXX11/src/Tensor/TensorReverse.h | 6 +- .../Eigen/CXX11/src/Tensor/TensorScan.h | 6 +- .../Eigen/CXX11/src/Tensor/TensorScanSycl.h | 2 +- .../Eigen/CXX11/src/Tensor/TensorStriding.h | 6 +- .../Eigen/CXX11/src/Tensor/TensorTraits.h | 2 +- .../CXX11/src/Tensor/TensorVolumePatch.h | 5 +- .../Eigen/src/AutoDiff/AutoDiffScalar.h | 68 ------------------- .../Eigen/src/AutoDiff/AutoDiffVector.h | 24 +------ .../ArpackSelfAdjointEigenSolver.h | 11 --- .../Eigen/src/IterativeSolvers/DGMRES.h | 10 ++- .../Eigen/src/IterativeSolvers/Scaling.h | 4 +- .../KroneckerProduct/KroneckerTensorProduct.h | 2 +- .../Eigen/src/LevenbergMarquardt/LMpar.h | 5 +- .../LevenbergMarquardt/LevenbergMarquardt.h | 4 +- .../src/MatrixFunctions/MatrixLogarithm.h | 4 +- .../Eigen/src/MatrixFunctions/MatrixPower.h | 2 +- .../LevenbergMarquardt.h | 4 +- .../Eigen/src/NonLinearOptimization/lmpar.h | 1 - .../Eigen/src/NumericalDiff/NumericalDiff.h | 2 +- unsupported/Eigen/src/Polynomials/Companion.h | 1 - .../Eigen/src/SparseExtra/BlockSparseMatrix.h | 57 ++-------------- .../src/SparseExtra/MatrixMarketIterator.h | 5 +- .../SpecialFunctions/SpecialFunctionsImpl.h | 2 - unsupported/Eigen/src/Splines/Spline.h | 2 +- 61 files changed, 122 insertions(+), 353 deletions(-) diff --git a/unsupported/Eigen/AlignedVector3 b/unsupported/Eigen/AlignedVector3 index 8301ef072..f2d6416cb 100644 --- a/unsupported/Eigen/AlignedVector3 +++ b/unsupported/Eigen/AlignedVector3 @@ -35,7 +35,7 @@ namespace Eigen { * This class makes this process simpler. * */ -// TODO specialize Cwise +// TODO: Specialize Cwise. template class AlignedVector3; diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorArgMax.h b/unsupported/Eigen/CXX11/src/Tensor/TensorArgMax.h index 3f9866aca..5d49fa90b 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorArgMax.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorArgMax.h @@ -78,8 +78,8 @@ struct TensorEvaluator, Device> { typedef typename Storage::Type EvaluatorPointerType; enum { - IsAligned = /*TensorEvaluator::IsAligned*/ false, - PacketAccess = /*TensorEvaluator::PacketAccess*/ false, + IsAligned = false, + PacketAccess = false, BlockAccess = false, PreferBlockAccess = TensorEvaluator::PreferBlockAccess, CoordAccess = false, // to be implemented @@ -195,8 +195,8 @@ struct TensorEvaluator, Devic typedef StorageMemory PairStorageMem; enum { - IsAligned = /*TensorEvaluator::IsAligned*/ false, - PacketAccess = /*TensorEvaluator::PacketAccess*/ false, + IsAligned = false, + PacketAccess = false, BlockAccess = false, PreferBlockAccess = TensorEvaluator::PreferBlockAccess, CoordAccess = false, // to be implemented diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorAssign.h b/unsupported/Eigen/CXX11/src/Tensor/TensorAssign.h index 37d914e27..330eae796 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorAssign.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorAssign.h @@ -48,7 +48,7 @@ struct nested, 1, typename eval diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorBase.h b/unsupported/Eigen/CXX11/src/Tensor/TensorBase.h index fc3f3b78a..f6812d4fb 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorBase.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorBase.h @@ -26,7 +26,7 @@ namespace Eigen { * making it possible to use either class interchangeably in expressions. */ #ifndef EIGEN_PARSED_BY_DOXYGEN -// FIXME Doxygen does not like the inheritance with different template parameters +// FIXME: Doxygen does not like the inheritance with different template parameters // Since there is no doxygen documentation inside, we disable it for now template class TensorBase diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorBlock.h b/unsupported/Eigen/CXX11/src/Tensor/TensorBlock.h index 0b068a7c9..00bec1326 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorBlock.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorBlock.h @@ -23,7 +23,7 @@ class TensorBlockIO; // Helper function to compute strides for densely stored buffer of given // dimensions. -// TODO(ezhulenev): We compute strides 1000 times in different evaluators, use +// TODO(ezhulenev): We compute strides many times in different evaluators, use // this function instead everywhere. template EIGEN_ALWAYS_INLINE DSizes strides(const DSizes& dimensions) { @@ -176,7 +176,7 @@ class TensorBlockDescriptor { // a memory buffer, then we might do performance optimization, and evaluate // the root expression directly into the final output memory. Some time it's // possible to reuse it for materializing subexpressions inside an expression - // tree, to to avoid dynamic memory allocation. + // tree, to avoid dynamic memory allocation. // // The pointer type of the underlying storage is erased, because passing // Scalar type through all the expression evaluation layers is way too many @@ -409,7 +409,7 @@ class TensorBlockMapper { std::pow(static_cast(target_block_size), 1.0f / static_cast(m_block_dimensions.rank()))); for (int i = 0; i < NumDims; ++i) { - // TODO(andydavis) Adjust the inner most 'block_dim_size' to make it + // TODO(andydavis): Adjust the inner most 'block_dim_size' to make it // a multiple of the packet size. Note that reducing // 'block_dim_size' in this manner can increase the number of // blocks, and so will amplify any per-block overhead. @@ -486,7 +486,7 @@ class TensorBlockScratchAllocator { // TODO(ezhulenev): Remove when replaced with inlined vector. if (m_allocations.capacity() == 0) m_allocations.reserve(8); - // Check if we already have an existing allocation att current index. + // Check if we already have an existing allocation at current index. const int num_allocations = static_cast(m_allocations.size()); const bool has_allocation = m_allocation_index < num_allocations; @@ -504,7 +504,7 @@ class TensorBlockScratchAllocator { m_allocations[m_allocation_index].size = size; } - // Make a new allocation if we don't have and existing one. + // Make a new allocation if we don't have an existing one. if (!has_allocation) { Allocation allocation; allocation.ptr = m_device.allocate(size); @@ -560,7 +560,7 @@ enum TensorBlockKind { }; // -------------------------------------------------------------------------- // -// TensorBlockNotImplemented should be used to defined TensorBlock typedef in +// TensorBlockNotImplemented should be used to define TensorBlock typedef in // TensorEvaluators that do not support block evaluation. class TensorBlockNotImplemented { @@ -789,7 +789,7 @@ class TensorCwiseUnaryBlock { }; // -------------------------------------------------------------------------- // -// TensorCwiseUnaryBlock is a lazy tensor expression block that applies BinaryOp +// TensorCwiseBinaryBlock is a lazy tensor expression block that applies BinaryOp // functor to the blocks produced by the underlying Tensor expression. template diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorBroadcasting.h b/unsupported/Eigen/CXX11/src/Tensor/TensorBroadcasting.h index aad1647c2..799e513a7 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorBroadcasting.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorBroadcasting.h @@ -486,7 +486,7 @@ struct TensorEvaluator, Device> { } inputIndex += innermostLoc; - // Todo: this could be extended to the second dimension if we're not + // TODO: This could be extended to the second dimension if we're not // broadcasting alongside the first dimension, and so on. if (innermostLoc + PacketSize <= m_impl.dimensions()[0]) { return m_impl.template packet(inputIndex); @@ -542,7 +542,7 @@ struct TensorEvaluator, Device> { } inputIndex += innermostLoc; - // Todo: this could be extended to the second dimension if we're not + // TODO: This could be extended to the second dimension if we're not // broadcasting alongside the first dimension, and so on. if (innermostLoc + PacketSize <= m_impl.dimensions()[NumDims - 1]) { return m_impl.template packet(inputIndex); diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorConcatenation.h b/unsupported/Eigen/CXX11/src/Tensor/TensorConcatenation.h index 0203f01e3..29607a706 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorConcatenation.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorConcatenation.h @@ -169,7 +169,7 @@ struct TensorEvaluator subs; diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorContraction.h b/unsupported/Eigen/CXX11/src/Tensor/TensorContraction.h index 97e7da3bd..c58a1c6d0 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorContraction.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorContraction.h @@ -141,12 +141,12 @@ struct TensorContractionBlockMemAllocator { // blocks of Lhs and Rhs tensor expressions, and how we invoke matrix // multiplication for these blocks. Default tensor contraction uses // gemm_pack_rhs, gemm_pack_lhs and gebp_kernel from Eigen Core (see -// GeneralBlocPanelKernel.h for details). +// GeneralBlockPanelKernel.h for details). // // By specializing contraction kernels we can use other low level libraries to // perform matrix multiplication, and still rely on Eigen contraction evaluator. // This also includes full support in TensorContractionThreadPool, assuming that -// underlying gemm do not use it's own threading. +// underlying gemm does not use its own threading. // // - ResScalar/LhsScalar/RhsScalar - scalar type for the result of // multiplication, lhs tensor and rhs tensor respectively. diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorContractionGpu.h b/unsupported/Eigen/CXX11/src/Tensor/TensorContractionGpu.h index 780e8961e..62ad942bd 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorContractionGpu.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorContractionGpu.h @@ -285,7 +285,7 @@ __device__ EIGEN_STRONG_INLINE void EigenContractionKernelInternal(const LhsMapp for (Index base_k = 0; base_k < k_size; base_k += 64) { // wait for previous iteration to finish with shmem. Despite common sense, - // the code is a bit faster with this here then at bottom of loop + // the code is a bit faster with this here than at bottom of loop __syncthreads(); prefetchIntoRegisters(base_k); @@ -471,7 +471,7 @@ __device__ EIGEN_STRONG_INLINE void EigenContractionKernelInternal(const LhsMapp if (threadIdx.x < max_i_write) { if (max_j_write == 8) { - // TODO: can i trade bank conflicts for coalesced writes? + // TODO: Can we trade bank conflicts for coalesced writes? Scalar val0 = lhs_shmem[threadIdx.x + 8 * threadIdx.y + 64 * threadIdx.z + 512 * 0]; Scalar val1 = lhs_shmem[threadIdx.x + 8 * threadIdx.y + 64 * threadIdx.z + 512 * 1]; Scalar val2 = lhs_shmem[threadIdx.x + 8 * threadIdx.y + 64 * threadIdx.z + 512 * 2]; @@ -609,7 +609,7 @@ __device__ __forceinline__ void EigenFloatContractionKernelInternal16x16(const L } } float x1, x2; - // the following can be a bitwise operation..... some day. + // TODO: The following can be a bitwise operation. if ((threadIdx.x % 8) < 4) { x1 = rhs_pf0.y; x2 = rhs_pf0.w; diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorContractionThreadPool.h b/unsupported/Eigen/CXX11/src/Tensor/TensorContractionThreadPool.h index 16c084ff9..4ca98fd06 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorContractionThreadPool.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorContractionThreadPool.h @@ -258,7 +258,7 @@ struct TensorEvaluator packed_rhs_[P - 1]; // If we choose to parallelize only by the sharding dimension, each thread - // will have it's own "thead local" (not a c++ thread local storage) memory + // will have its own "thread local" (not a C++ thread local storage) memory // for packed_lhs or packed_rhs (shard_by_col = false of true). This memory // can't be passed to a kernel that might execute on a different thread. // @@ -763,7 +763,7 @@ struct TensorEvaluator(grain_index)); // FIXME better make ThreadLocalBlocks use Eigen::Index? + internal::convert_index(grain_index)); // FIXME: Consider making ThreadLocalBlocks use Eigen::Index. } else { return packed_lhs_[k % (P - 1)][m1]; } @@ -776,7 +776,7 @@ struct TensorEvaluator(grain_index)); // FIXME better make ThreadLocalBlocks use Eigen::Index? + internal::convert_index(grain_index)); // FIXME: Consider making ThreadLocalBlocks use Eigen::Index. } else { return packed_rhs_[k % (P - 1)][n1]; } @@ -1335,7 +1335,7 @@ struct TensorEvaluator(num_y_blocks, ceil(numP, block_size.y))); - // cout << "launching 1D kernel with block_size.x: " << block_size.x << " block_size.y: " << block_size.y << " - // num_blocks.x: " << num_blocks.x << " num_blocks.y: " << num_blocks.y << " maxX: " << maxX << " shared_mem: " - // << shared_mem << " in stream " << m_device.stream() << endl; - const array indices{m_indices[0]}; const array kernel_dims{m_kernelImpl.dimensions()[0]}; internal::IndexMapper indexMapper(m_inputImpl.dimensions(), kernel_dims, indices); @@ -956,11 +952,6 @@ struct TensorEvaluator(num_z_blocks, ceil(numP, block_size.z))); - // cout << "launching 2D kernel with block_size.x: " << block_size.x << " block_size.y: " << block_size.y << " - // block_size.z: " << block_size.z << " num_blocks.x: " << num_blocks.x << " num_blocks.y: " << num_blocks.y << - // " num_blocks.z: " << num_blocks.z << " maxX: " << maxX << " maxY: " << maxY << " maxP: " << maxP << " - // shared_mem: " << shared_mem << " in stream " << m_device.stream() << endl; - const array indices{m_indices[idxX], m_indices[idxY]}; const array kernel_dims{m_kernelImpl.dimensions()[idxX], m_kernelImpl.dimensions()[idxY]}; internal::IndexMapper indexMapper(m_inputImpl.dimensions(), kernel_dims, indices); @@ -1051,10 +1042,6 @@ struct TensorEvaluator indices{m_indices[idxX], m_indices[idxY], m_indices[idxZ]}; const array kernel_dims{m_kernelImpl.dimensions()[idxX], m_kernelImpl.dimensions()[idxY], m_kernelImpl.dimensions()[idxZ]}; @@ -1087,7 +1074,7 @@ struct TensorEvaluator itemID) const { auto buffer_ptr = buffer_acc; auto kernel_ptr = kernel_filter; - // the required row to be calculated for the for each plane in shered memory + // the required row to be calculated for each plane in shared memory const size_t num_input = (itemID.get_local_range()[0] + kernelSize - 1); const size_t plane_kernel_offset = itemID.get_local_id(1) * num_input; const size_t input_offset = itemID.get_group(0) * itemID.get_local_range()[0]; @@ -123,7 +123,7 @@ struct EigenConvolutionKernel itemID) const { auto buffer_ptr = buffer_acc; auto kernel_ptr = kernel_filter; - // the required row to be calculated for the for each plane in shered memory + // the required row to be calculated for each plane in shared memory const auto num_input = cl::sycl::range<2>{ (cl::sycl::range<2>(itemID.get_local_range()[0], itemID.get_local_range()[1]) + kernel_size - 1)}; @@ -506,7 +506,7 @@ struct TensorEvaluator class TensorDevice { diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceDefault.h b/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceDefault.h index eaaf33215..1f955f00e 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceDefault.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceDefault.h @@ -68,7 +68,7 @@ struct DefaultDevice { return l1CacheSize(); #elif defined(EIGEN_HIP_DEVICE_COMPILE) // Running on a HIP device - return 48 * 1024; // FIXME : update this number for HIP + return 48 * 1024; // FIXME: Update this number for HIP. #else // Running on a CUDA device, return the amount of shared memory available. return 48 * 1024; @@ -81,7 +81,7 @@ struct DefaultDevice { return l3CacheSize(); #elif defined(EIGEN_HIP_DEVICE_COMPILE) // Running on a HIP device - return firstLevelCacheSize(); // FIXME : update this number for HIP + return firstLevelCacheSize(); // FIXME: Update this number for HIP. #else // Running on a CUDA device return firstLevelCacheSize(); diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceGpu.h b/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceGpu.h index 71788cd1e..25656e0e9 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceGpu.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceGpu.h @@ -273,12 +273,12 @@ struct GpuDevice { } EIGEN_STRONG_INLINE size_t numThreads() const { - // FIXME + // FIXME: Return a more accurate thread count. return 32; } EIGEN_STRONG_INLINE size_t firstLevelCacheSize() const { - // FIXME + // FIXME: Return a more accurate cache size. return 48 * 1024; } diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h b/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h index 3320990af..85c1dc81a 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h @@ -92,7 +92,7 @@ struct ThreadPoolDevice { EIGEN_STRONG_INLINE int numThreads() const { return num_threads_; } - // Number of theads available in the underlying thread pool. This number can + // Number of threads available in the underlying thread pool. This number can // be different from the value returned by numThreads(). EIGEN_STRONG_INLINE int numThreadsInPool() const { return pool_->NumThreads(); } diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorDimensions.h b/unsupported/Eigen/CXX11/src/Tensor/TensorDimensions.h index e20052c92..8aca0f3d6 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorDimensions.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorDimensions.h @@ -90,12 +90,12 @@ struct Sizes { EIGEN_DEVICE_FUNC Sizes() {} template explicit EIGEN_DEVICE_FUNC Sizes(const array& /*indices*/) { - // todo: add assertion + // TODO: Add assertion. } template EIGEN_DEVICE_FUNC Sizes(DenseIndex...) {} explicit EIGEN_DEVICE_FUNC Sizes(std::initializer_list /*l*/) { - // todo: add assertion + // TODO: Add assertion. } template diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorEvalTo.h b/unsupported/Eigen/CXX11/src/Tensor/TensorEvalTo.h index 9bc0eac98..9c83fadaf 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorEvalTo.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorEvalTo.h @@ -18,7 +18,6 @@ namespace Eigen { namespace internal { template class MakePointer_> struct traits > { - // Type promotion to handle the case where the types of the lhs and the rhs are different. typedef typename XprType::Scalar Scalar; typedef traits XprTraits; typedef typename XprTraits::StorageKind StorageKind; diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorEvaluator.h b/unsupported/Eigen/CXX11/src/Tensor/TensorEvaluator.h index bd9a7d807..7a19d7af5 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorEvaluator.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorEvaluator.h @@ -78,7 +78,7 @@ struct TensorEvaluator { #ifdef EIGEN_USE_THREADS template EIGEN_STRONG_INLINE void evalSubExprsIfNeededAsync(EvaluatorPointerType dest, EvalSubExprsCallback done) { - // TODO(ezhulenev): ThreadPoolDevice memcpy is blockign operation. + // TODO(ezhulenev): ThreadPoolDevice memcpy is a blocking operation. done(evalSubExprsIfNeeded(dest)); } #endif // EIGEN_USE_THREADS @@ -245,7 +245,7 @@ struct TensorEvaluator { #ifdef EIGEN_USE_THREADS template EIGEN_STRONG_INLINE void evalSubExprsIfNeededAsync(EvaluatorPointerType dest, EvalSubExprsCallback done) { - // TODO(ezhulenev): ThreadPoolDevice memcpy is a blockign operation. + // TODO(ezhulenev): ThreadPoolDevice memcpy is a blocking operation. done(evalSubExprsIfNeeded(dest)); } #endif // EIGEN_USE_THREADS diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorExecutor.h b/unsupported/Eigen/CXX11/src/Tensor/TensorExecutor.h index da3321073..4a175fdec 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorExecutor.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorExecutor.h @@ -61,7 +61,7 @@ struct ExpressionHasTensorBroadcastingOp::highest()) / block_size); const StorageIndex size = array_prod(evaluator.dimensions()); - // Create a least one block to ensure we won't crash when tensorflow calls with tensors of size 0. + // Create at least one block to ensure we don't crash with tensors of size 0. const int num_blocks = numext::maxi( numext::mini(max_blocks, static_cast(numext::div_ceil(size, block_size))), 1); diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorExpr.h b/unsupported/Eigen/CXX11/src/Tensor/TensorExpr.h index a0e558bac..108bc92f2 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorExpr.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorExpr.h @@ -35,7 +35,7 @@ struct traits > : traits { * * \brief Tensor nullary expression. * - * The TensorCwiseNullaryOp class applies a nullary operators to an expression. + * The TensorCwiseNullaryOp class applies a nullary operator to an expression. * This is typically used to generate constants. */ template diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorFFT.h b/unsupported/Eigen/CXX11/src/Tensor/TensorFFT.h index b9d6f376b..141b41672 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorFFT.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorFFT.h @@ -57,7 +57,7 @@ struct PartOf { namespace internal { template -struct traits > : public traits { +struct traits> : public traits { typedef traits XprTraits; typedef typename XprTraits::Scalar Scalar; typedef typename NumTraits::Real RealScalar; @@ -81,7 +81,7 @@ struct eval, Eigen::Dense template struct nested, 1, - typename eval >::type> { + typename eval>::type> { typedef TensorFFTOp type; }; @@ -248,23 +248,7 @@ struct TensorEvaluator, D // The recurrence is correct in exact arithmetic, but causes // numerical issues for large transforms, especially in - // single-precision floating point. - // - // pos_j_base_powered[0] = ComplexScalar(1, 0); - // if (line_len > 1) { - // const ComplexScalar pos_j_base = ComplexScalar( - // numext::cos(EIGEN_PI / line_len), numext::sin(EIGEN_PI / line_len)); - // pos_j_base_powered[1] = pos_j_base; - // if (line_len > 2) { - // const ComplexScalar pos_j_base_sq = pos_j_base * pos_j_base; - // for (int i = 2; i < line_len + 1; ++i) { - // pos_j_base_powered[i] = pos_j_base_powered[i - 1] * - // pos_j_base_powered[i - 1] / - // pos_j_base_powered[i - 2] * - // pos_j_base_sq; - // } - // } - // } + // single-precision floating point. Use direct computation instead. // TODO(rmlarsen): Find a way to use Eigen's vectorized sin // and cosine functions here. for (int j = 0; j < line_len + 1; ++j) { diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorFixedSize.h b/unsupported/Eigen/CXX11/src/Tensor/TensorFixedSize.h index 753a25a82..faa7af86d 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorFixedSize.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorFixedSize.h @@ -205,10 +205,6 @@ class TensorFixedSize : public TensorBase= 0 - /* array_apply_and_reduce(indices) && - // check whether the indices fit in the dimensions - array_zip_and_reduce(indices, m_storage.dimensions());*/ } EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index linearizedIndex(const array& indices) const { diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorForcedEval.h b/unsupported/Eigen/CXX11/src/Tensor/TensorForcedEval.h index dadccb324..40f5296da 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorForcedEval.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorForcedEval.h @@ -20,7 +20,6 @@ namespace Eigen { namespace internal { template struct traits> { - // Type promotion to handle the case where the types of the lhs and the rhs are different. typedef typename XprType::Scalar Scalar; typedef traits XprTraits; typedef typename traits::StorageKind StorageKind; @@ -49,7 +48,7 @@ struct nested, 1, typename eval class TensorForcedEvalOp : public TensorBase, ReadOnlyAccessors> { diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorImagePatch.h b/unsupported/Eigen/CXX11/src/Tensor/TensorImagePatch.h index 8bd1c43d1..2f94ce57d 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorImagePatch.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorImagePatch.h @@ -316,8 +316,8 @@ struct TensorEvaluator, Device> { break; default: eigen_assert(false && "unexpected padding"); - m_outputCols = 0; // silence the uninitialised warning; - m_outputRows = 0; //// silence the uninitialised warning; + m_outputCols = 0; // Silence the uninitialized warning. + m_outputRows = 0; // Silence the uninitialized warning. } } eigen_assert(m_outputRows > 0); @@ -482,7 +482,7 @@ struct TensorEvaluator, Device> { const Index rowOffsets[2] = {patchOffsets[0] - colOffsets[0] * m_colStride, patchOffsets[1] - colOffsets[1] * m_colStride}; eigen_assert(rowOffsets[0] <= rowOffsets[1]); - // Calculate col indices in the original input tensor. + // Calculate row indices in the original input tensor. const Index inputRows[2] = {rowIndex * m_row_strides + rowOffsets[0] - m_rowPaddingTop, rowIndex * m_row_strides + rowOffsets[1] - m_rowPaddingTop}; diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorIndexList.h b/unsupported/Eigen/CXX11/src/Tensor/TensorIndexList.h index 394c150ed..1071cf323 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorIndexList.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorIndexList.h @@ -185,7 +185,6 @@ template struct tuple_coeff { template EIGEN_DEVICE_FUNC static constexpr ValueT get(const Index i, const IndexTuple& t) { - // return array_get(t) * (i == Idx) + tuple_coeff::get(i, t) * (i != Idx); return (i == Idx ? array_get(t) : tuple_coeff::get(i, t)); } template @@ -222,8 +221,7 @@ template struct tuple_coeff<0, ValueT> { template EIGEN_DEVICE_FUNC static constexpr ValueT get(const Index /*i*/, const IndexTuple& t) { - // eigen_assert (i == 0); // gcc fails to compile assertions in constexpr - return array_get<0>(t) /* * (i == 0)*/; + return array_get<0>(t); } template EIGEN_DEVICE_FUNC static void set(const Index i, IndexTuple& t, const ValueT value) { diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorInitializer.h b/unsupported/Eigen/CXX11/src/Tensor/TensorInitializer.h index 26cd50f70..579caac34 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorInitializer.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorInitializer.h @@ -47,7 +47,7 @@ struct Initializer { Eigen::array::Index, traits::NumDimensions>* indices, const InitList& vals) { int i = 0; - // There is likely a faster way to do that than iterating. + // TODO: Consider a faster approach than iterating. for (const auto& v : vals) { (*indices)[traits::NumDimensions - 1] = i++; tensor.coeffRef(*indices) = v; diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorIntDiv.h b/unsupported/Eigen/CXX11/src/Tensor/TensorIntDiv.h index cd0468077..ed256461f 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorIntDiv.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorIntDiv.h @@ -168,7 +168,6 @@ struct TensorIntDivisor { // type numerator should also be less than 2^32-1. EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T divide(const T numerator) const { eigen_assert(static_cast::type>(numerator) < NumTraits::highest() / 2); - // eigen_assert(numerator >= 0); // this is implicitly asserted by the line above UnsignedType t1 = muluh(multiplier, numerator); UnsignedType t = (static_cast(numerator) - t1) >> shift1; diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorMap.h b/unsupported/Eigen/CXX11/src/Tensor/TensorMap.h index 9abfddb4c..548edfe04 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorMap.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorMap.h @@ -15,7 +15,7 @@ namespace Eigen { -// FIXME use proper doxygen documentation (e.g. \tparam MakePointer_) +// FIXME: Use proper doxygen documentation (e.g. \tparam MakePointer_). /** * \ingroup CXX11_Tensor_Module @@ -104,7 +104,6 @@ class TensorMap : public TensorBase& indices) const { - // eigen_assert(checkIndexRange(indices)); if (PlainObjectType::Options & RowMajor) { const Index index = m_dimensions.IndexOfRowMajor(indices); return m_data[index]; @@ -141,7 +140,6 @@ class TensorMap : public TensorBase& indices) { - // eigen_assert(checkIndexRange(indices)); if (PlainObjectType::Options & RowMajor) { const Index index = m_dimensions.IndexOfRowMajor(indices); return m_data[index]; diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorMorphing.h b/unsupported/Eigen/CXX11/src/Tensor/TensorMorphing.h index 3a697d3a3..a111eb2c6 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorMorphing.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorMorphing.h @@ -160,8 +160,6 @@ struct TensorEvaluator, Device> return internal::TensorBlockResourceRequirements::any(); } - // required in block(OutputTensorBlock* output_block) const - // For C++03 compatibility this must be defined outside the method struct BlockIteratorState { Index stride; Index span; @@ -312,7 +310,7 @@ class TensorSlicingOp : public TensorBase struct MemcpyTriggerForSlicing { EIGEN_DEVICE_FUNC MemcpyTriggerForSlicing(const Device& device) : threshold_(2 * device.numThreads()) {} diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorPadding.h b/unsupported/Eigen/CXX11/src/Tensor/TensorPadding.h index 7b2db491e..815759688 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorPadding.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorPadding.h @@ -260,7 +260,7 @@ struct TensorEvaluator, Device Index output_offset = 0; const DSizes output_strides = internal::strides(desc.dimensions()); - // NOTE(ezhulenev): We initialize bock iteration state for `NumDims - 1` + // NOTE(ezhulenev): We initialize block iteration state for `NumDims - 1` // dimensions, skipping innermost dimension. In theory it should be possible // to squeeze matching innermost dimensions, however in practice that did // not show any improvements in benchmarks. Also in practice first outer diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorRandom.h b/unsupported/Eigen/CXX11/src/Tensor/TensorRandom.h index d71b39506..ffda20ae6 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorRandom.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorRandom.h @@ -61,7 +61,6 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Eigen::half RandomToTypeUniform(rnd & 0x3ffu) | (static_cast(15) << 10); Eigen::half result = Eigen::numext::bit_cast(half_bits); - // Return the final result return result - Eigen::half(1.0f); } @@ -72,7 +71,6 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Eigen::bfloat16 RandomToTypeUniform(rnd & 0x7fu) | (static_cast(127) << 7); Eigen::bfloat16 result = Eigen::numext::bit_cast(half_bits); - // Return the final result return result - Eigen::bfloat16(1.0f); } @@ -83,12 +81,11 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE float RandomToTypeUniform(uint64_t* float fp; } internal; internal result; - // Generate 23 random bits for the mantissa mantissa + // Generate 23 random bits for the mantissa. const unsigned rnd = PCG_XSH_RS_generator(state, stream); result.raw = rnd & 0x7fffffu; - // Set the exponent + // Set the exponent. result.raw |= (static_cast(127) << 23); - // Return the final result return result.fp - 1.0f; } @@ -103,7 +100,7 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double RandomToTypeUniform(uint64_ // Generate 52 random bits for the mantissa // First generate the upper 20 bits unsigned rnd1 = PCG_XSH_RS_generator(state, stream) & 0xfffffu; - // The generate the lower 32 bits + // Then generate the lower 32 bits. unsigned rnd2 = PCG_XSH_RS_generator(state, stream); result.raw = (static_cast(rnd1) << 32) | rnd2; // Set the exponent @@ -132,19 +129,10 @@ class UniformRandomGenerator { EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE UniformRandomGenerator(uint64_t seed = 0) { m_state = PCG_XSH_RS_state(seed); #ifdef EIGEN_USE_SYCL - // In SYCL it is not possible to build PCG_XSH_RS_state in one step. - // Therefore, we need two steps to initialize the m_state. - // IN SYCL, the constructor of the functor is s called on the CPU - // and we get the clock seed here from the CPU. However, This seed is - // the same for all the thread. As unlike CUDA, the thread.ID, BlockID, etc is not a global function. - // and only available on the Operator() function (which is called on the GPU). - // Thus for CUDA (((CLOCK + global_thread_id)* 6364136223846793005ULL) + 0xda3e39cb94b95bdbULL) is passed to each - // thread but for SYCL ((CLOCK * 6364136223846793005ULL) + 0xda3e39cb94b95bdbULL) is passed to each thread and each - // thread adds the (global_thread_id* 6364136223846793005ULL) for itself only once, in order to complete the - // construction similar to CUDA Therefore, the thread Id injection is not available at this stage. - // However when the operator() is called the thread ID will be available. So inside the operator, - // we add the thrreadID, BlockId,... (which is equivalent of i) - // to the seed and construct the unique m_state per thead similar to cuda. + // In SYCL, the constructor runs on the CPU where thread IDs are unavailable. + // We initialize m_state here with just the clock seed; the per-thread + // component (i * 6364136223846793005ULL) is added in operator() when + // the thread ID becomes available, completing the PCG state setup. m_exec_once = false; #endif } @@ -240,16 +228,10 @@ class NormalRandomGenerator { EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE NormalRandomGenerator(uint64_t seed = 0) { m_state = PCG_XSH_RS_state(seed); #ifdef EIGEN_USE_SYCL - // In SYCL it is not possible to build PCG_XSH_RS_state in one step. - // Therefore, we need two steps to initialize the m_state. - // IN SYCL, the constructor of the functor is s called on the CPU - // and we get the clock seed here from the CPU. However, This seed is - // the same for all the thread. As unlike CUDA, the thread.ID, BlockID, etc is not a global function. - // and only available on the Operator() function (which is called on the GPU). - // Therefore, the thread Id injection is not available at this stage. However when the operator() - // is called the thread ID will be available. So inside the operator, - // we add the thrreadID, BlockId,... (which is equivalent of i) - // to the seed and construct the unique m_state per thead similar to cuda. + // In SYCL, the constructor runs on the CPU where thread IDs are unavailable. + // We initialize m_state here with just the clock seed; the per-thread + // component (i * 6364136223846793005ULL) is added in operator() when + // the thread ID becomes available, completing the PCG state setup. m_exec_once = false; #endif } diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorReduction.h b/unsupported/Eigen/CXX11/src/Tensor/TensorReduction.h index 5c4951be2..157f0cfd6 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorReduction.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorReduction.h @@ -706,7 +706,7 @@ struct TensorReductionEvaluatorBase::run(*this, reducer, m_device, data, num_values_to_reduce, num_coeffs_to_preserve)) { if (m_result) { @@ -742,7 +742,7 @@ struct TensorReductionEvaluatorBase::run(*this, reducer, m_device, data, num_values_to_reduce, num_coeffs_to_preserve)) { if (m_result) { @@ -903,7 +903,7 @@ struct TensorReductionEvaluatorBase friend class TensorSycl::internal::GenericNondeterministicReducer; - // SYCL need the Generic reducer for the case the reduction algorithm is neither inner, outer, and full reducer + // SYCL needs the generic reducer when the reduction is neither inner, outer, nor full. template friend struct internal::GenericReducer; #endif @@ -1005,15 +1005,13 @@ struct TensorEvaluator, Base; EIGEN_STRONG_INLINE TensorEvaluator(const typename Base::XprType& op, const Eigen::SyclDevice& device) : Base(op, device) {} - // The coeff function in the base the recursive method which is not an standard layout and cannot be used in the SYCL - // kernel - // Therefore the coeff function should be overridden by for SYCL kernel + // The base coeff function uses a recursive method that is not standard layout and cannot be used in + // SYCL kernels, so it must be overridden. EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename Base::CoeffReturnType coeff(typename Base::Index index) const { return *(this->data() + index); } - // The packet function in the base the recursive method which is not an standard layout and cannot be used in the SYCL - // kernel - // Therefore the packet function should be overridden by for SYCL kernel + // The base packet function uses a recursive method that is not standard layout and cannot be used in + // SYCL kernels, so it must be overridden. template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename Base::PacketReturnType packet(typename Base::Index index) const { return internal::pload(this->data() + index); diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorReductionGpu.h b/unsupported/Eigen/CXX11/src/Tensor/TensorReductionGpu.h index c5273e9b8..117cbcbbb 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorReductionGpu.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorReductionGpu.h @@ -181,7 +181,7 @@ __global__ EIGEN_HIP_LAUNCH_BOUNDS_1024 void FullReductionKernel(Reducer reducer for (int offset = warpSize / 2; offset > 0; offset /= 2) { #if defined(EIGEN_HIPCC) // use std::is_floating_point to determine the type of reduced_val - // This is needed because when Type == double, hipcc will give a "call to __shfl_down is ambguous" error + // This is needed because when Type == double, hipcc will give a "call to __shfl_down is ambiguous" error // and list the float and int versions of __shfl_down as the candidate functions. if (std::is_floating_point::value) { reducer.reduce(__shfl_down(static_cast(accum), offset, warpSize), &accum); @@ -429,7 +429,7 @@ struct FullReductionLauncher { half* scratch = static_cast(device.scratchpad()); if (num_blocks > 1) { - // We initialize the output and the scrathpad outside the reduction kernel when we can't be sure that there + // We initialize the output and the scratchpad outside the reduction kernel when we can't be sure that there // won't be a race conditions between multiple thread blocks. LAUNCH_GPU_KERNEL((ReductionInitFullReduxKernelHalfFloat), 1, 1, 0, device, reducer, self, num_coeffs, scratch); @@ -536,7 +536,7 @@ __global__ EIGEN_HIP_LAUNCH_BOUNDS_1024 void InnerReductionKernel(Reducer reduce for (int offset = warpSize / 2; offset > 0; offset /= 2) { #if defined(EIGEN_HIPCC) // use std::is_floating_point to determine the type of reduced_val - // This is needed because when Type == double, hipcc will give a "call to __shfl_down is ambguous" error + // This is needed because when Type == double, hipcc will give a "call to __shfl_down is ambiguous" error // and list the float and int versions of __shfl_down as the candidate functions. if (std::is_floating_point::value) { reducer.reduce(__shfl_down(static_cast(reduced_val), offset), &reduced_val); @@ -802,8 +802,8 @@ struct InnerReductionLauncher { } const Index num_coeffs = num_coeffs_to_reduce * num_preserved_vals; - const int block_size = /*256*/ 128; - const int num_per_thread = /*128*/ 64; + const int block_size = 128; + const int num_per_thread = 64; const int dyn_blocks = numext::div_ceil(num_coeffs, block_size * num_per_thread); const int max_blocks = device.getNumGpuMultiProcessors() * device.maxGpuThreadsPerMultiProcessor() / block_size; const int num_blocks = numext::mini(max_blocks, dyn_blocks); diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorReductionSycl.h b/unsupported/Eigen/CXX11/src/Tensor/TensorReductionSycl.h index b4749b41f..2b5b73410 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorReductionSycl.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorReductionSycl.h @@ -253,7 +253,7 @@ class GenericNondeterministicReducer { }; enum class reduction_dim { inner_most, outer_most }; -// default is preserver +// Default partial reduction (preserve dimensions). template struct PartialReductionKernel { typedef typename Evaluator::CoeffReturnType CoeffReturnType; @@ -398,7 +398,7 @@ struct SecondStepPartialReduction { } output_accessor[globalId] = op.finalize(accumulator); } -}; // namespace internal +}; template struct ReductionPannel { @@ -497,13 +497,9 @@ struct FullReducer { // Our empirical research shows that if each thread reduces at least 512 // elements individually, we get better performance. const Index reductionPerThread = 2048; - // const Index num_work_group = Index reductionGroup = dev.getPowerOfTwo( (inputSize + (reductionPerThread * local_range - 1)) / (reductionPerThread * local_range), true); const Index num_work_group = std::min(reductionGroup, local_range); - // 1 - // ? local_range - // : 1); const Index global_range = num_work_group * local_range; auto thread_range = cl::sycl::nd_range<1>(cl::sycl::range<1>(global_range), cl::sycl::range<1>(local_range)); @@ -561,8 +557,8 @@ struct InnerReducer { } }; -// ArmgMax uses this kernel for partial reduction// -// TODO(@mehdi.goli) come up with a better kernel +// ArgMax uses this kernel for partial reduction. +// TODO(@mehdi.goli): Come up with a better kernel. // generic partial reduction template struct GenericReducer { diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorRef.h b/unsupported/Eigen/CXX11/src/Tensor/TensorRef.h index 98223fe79..d0df44318 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorRef.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorRef.h @@ -45,7 +45,6 @@ template class TensorLazyEvaluatorReadOnly : public TensorLazyBaseEvaluator::Scalar> { public: - // typedef typename TensorEvaluator::Dimensions Dimensions; typedef typename TensorEvaluator::Scalar Scalar; typedef StorageMemory Storage; typedef typename Storage::Type EvaluatorPointerType; diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorReverse.h b/unsupported/Eigen/CXX11/src/Tensor/TensorReverse.h index 4f167e7cf..ece85ca1b 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorReverse.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorReverse.h @@ -214,10 +214,6 @@ struct TensorEvaluator, Device // TODO(ezhulenev): If underlying tensor expression supports and prefers // block evaluation we must use it. Currently we use coeff and packet // access into the underlying tensor expression. - // static const bool useBlockAccessForArgType = - // TensorEvaluator::BlockAccess && - // TensorEvaluator::PreferBlockAccess; - static const bool isColMajor = static_cast(Layout) == static_cast(ColMajor); static const Index inner_dim_idx = isColMajor ? 0 : NumDims - 1; @@ -395,7 +391,7 @@ struct TensorEvaluator, Device> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void writePacket(Index index, const PacketReturnType& x) const { eigen_assert(index + PacketSize - 1 < dimensions().TotalSize()); - // This code is pilfered from TensorMorphing.h + // This code is adapted from TensorMorphing.h EIGEN_ALIGN_MAX CoeffReturnType values[PacketSize]; internal::pstore(values, x); EIGEN_UNROLL_LOOP diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorScan.h b/unsupported/Eigen/CXX11/src/Tensor/TensorScan.h index 6de08679a..39d3558b8 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorScan.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorScan.h @@ -304,7 +304,7 @@ struct ScanLauncher { #if defined(EIGEN_USE_GPU) && (defined(EIGEN_GPUCC)) // GPU implementation of scan -// TODO(ibab) This placeholder implementation performs multiple scans in +// TODO(ibab): This placeholder implementation performs multiple scans in // parallel, but it would be better to use a parallel scan algorithm and // optimize memory access. template @@ -396,8 +396,8 @@ struct TensorEvaluator, Device> { } } else { // dims can only be indexed through unsigned integers, - // so let's use an unsigned type to let the compiler knows. - // This prevents stupid warnings: ""'*((void*)(& evaluator)+64)[18446744073709551615]' may be used uninitialized + // so use an unsigned type to let the compiler know. + // This prevents spurious warnings: "'*((void*)(& evaluator)+64)[18446744073709551615]' may be used uninitialized // in this function" unsigned int axis = internal::convert_index(op.axis()); for (unsigned int i = NumDims - 1; i > axis; --i) { diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorScanSycl.h b/unsupported/Eigen/CXX11/src/Tensor/TensorScanSycl.h index 3636788cc..f08b83a9a 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorScanSycl.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorScanSycl.h @@ -268,7 +268,7 @@ struct ScanKernelFunctor { } }); next_elements = 0; - // right the first set of private param + // Write the first set of private params. EIGEN_UNROLL_LOOP for (Index i = 0; i < ScanParameters::ScanPerThread; i++) { Index global_id = global_offset + next_elements; diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorStriding.h b/unsupported/Eigen/CXX11/src/Tensor/TensorStriding.h index 04ade37b5..eee7c9b1f 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorStriding.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorStriding.h @@ -87,7 +87,7 @@ struct TensorEvaluator, Device> { static constexpr int Layout = TensorEvaluator::Layout; enum { - IsAligned = /*TensorEvaluator::IsAligned*/ false, + IsAligned = false, PacketAccess = TensorEvaluator::PacketAccess, BlockAccess = false, PreferBlockAccess = TensorEvaluator::PreferBlockAccess, @@ -237,13 +237,11 @@ struct TensorEvaluator, Device> : public TensorEvaluator, Device> { typedef TensorStridingOp XprType; typedef TensorEvaluator Base; - // typedef typename XprType::Index Index; static constexpr int NumDims = internal::array_size::Dimensions>::value; - // typedef DSizes Dimensions; static constexpr int Layout = TensorEvaluator::Layout; enum { - IsAligned = /*TensorEvaluator::IsAligned*/ false, + IsAligned = false, PacketAccess = TensorEvaluator::PacketAccess, PreferBlockAccess = false, CoordAccess = false, // to be implemented diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h b/unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h index f5954d6f3..5c97d5210 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h @@ -148,7 +148,7 @@ struct eval, Eigen::Dense> { typedef const TensorRef EIGEN_DEVICE_REF type; }; -// TODO nested<> does not exist anymore in Eigen/Core, and it thus has to be removed in favor of ref_selector. +// TODO: nested<> does not exist anymore in Eigen/Core, and should be removed in favor of ref_selector. template struct nested { typedef typename ref_selector::type type; diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorVolumePatch.h b/unsupported/Eigen/CXX11/src/Tensor/TensorVolumePatch.h index cf69fef6e..61e8b0446 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorVolumePatch.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorVolumePatch.h @@ -449,8 +449,7 @@ struct TensorEvaluator, D // Find the offset of the element wrt the location of the first element. Index first_entry = (indices[0] - patchIndex * m_patchStride) / m_fastOutputDepth; - Index second_entry = PacketSize == 1 ? first_entry : - (indices[1] - patchIndex * m_patchStride) / m_fastOutputDepth; + Index second_entry = PacketSize == 1 ? first_entry : (indices[1] - patchIndex * m_patchStride) / m_fastOutputDepth; const Index patchOffsets[2] = {first_entry, second_entry}; @@ -476,7 +475,7 @@ struct TensorEvaluator, D const Index rowOffsets[2] = {(patchOffsets[0] - colOffsets[0] * m_colStride) / m_fastRowStride, (patchOffsets[1] - colOffsets[1] * m_colStride) / m_fastRowStride}; eigen_assert(rowOffsets[0] <= rowOffsets[1]); - // Calculate col indices in the original input tensor. + // Calculate row indices in the original input tensor. const Index inputRows[2] = {rowIndex * m_row_strides + rowOffsets[0] - m_rowPaddingTop, rowIndex * m_row_strides + rowOffsets[1] - m_rowPaddingTop}; diff --git a/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h b/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h index 785cd4a56..ea481fcc1 100644 --- a/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h +++ b/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h @@ -222,16 +222,6 @@ class AutoDiffScalar return AutoDiffScalar(a + b.value(), b.derivatives()); } - // inline const AutoDiffScalar operator+(const Real& other) const - // { - // return AutoDiffScalar(m_value + other, m_derivatives); - // } - - // friend inline const AutoDiffScalar operator+(const Real& a, const AutoDiffScalar& b) - // { - // return AutoDiffScalar(a + b.value(), b.derivatives()); - // } - inline AutoDiffScalar& operator+=(const Scalar& other) { value() += other; return *this; @@ -290,22 +280,6 @@ class AutoDiffScalar return MakeAutoDiffScalar(a.value() * other, a.derivatives() * other); } - // inline const AutoDiffScalar, DerType>::Type > - // operator*(const Real& other) const - // { - // return AutoDiffScalar, DerType>::Type >( - // m_value * other, - // (m_derivatives * other)); - // } - // - // friend inline const AutoDiffScalar, DerType>::Type > - // operator*(const Real& other, const AutoDiffScalar& a) - // { - // return AutoDiffScalar, DerType>::Type >( - // a.value() * other, - // a.derivatives() * other); - // } - inline auto operator/(const Scalar& other) const { return MakeAutoDiffScalar(m_value / other, (m_derivatives * (Scalar(1) / other))); } @@ -314,22 +288,6 @@ class AutoDiffScalar return MakeAutoDiffScalar(other / a.value(), a.derivatives() * (Scalar(-other) / (a.value() * a.value()))); } - // inline const AutoDiffScalar, DerType>::Type > - // operator/(const Real& other) const - // { - // return AutoDiffScalar, DerType>::Type >( - // m_value / other, - // (m_derivatives * (Real(1)/other))); - // } - // - // friend inline const AutoDiffScalar, DerType>::Type > - // operator/(const Real& other, const AutoDiffScalar& a) - // { - // return AutoDiffScalar, DerType>::Type >( - // other / a.value(), - // a.derivatives() * (-Real(1)/other)); - // } - template inline auto operator/(const AutoDiffScalar& other) const { return MakeAutoDiffScalar(m_value / other.value(), @@ -383,16 +341,6 @@ struct auto_diff_special_op typedef typename traits::Scalar Scalar; typedef typename NumTraits::Real Real; - // typedef auto_diff_scalar_op::Real, - // is_same::Real>::value> Base; - - // using Base::operator+; - // using Base::operator+=; - // using Base::operator-; - // using Base::operator-=; - // using Base::operator*; - // using Base::operator*=; - const AutoDiffScalar& derived() const { return *static_cast*>(this); } @@ -448,22 +396,6 @@ struct ScalarBinaryOpTraits, B typedef AutoDiffScalar ReturnType; }; -// The following is an attempt to let Eigen's known about expression template, but that's more tricky! - -// template -// struct ScalarBinaryOpTraits,AutoDiffScalar, BinOp> -// { -// enum { Defined = 1 }; -// typedef AutoDiffScalar ReturnType; -// }; -// -// template -// struct ScalarBinaryOpTraits,AutoDiffScalar, BinOp> -// { -// enum { Defined = 1 };//internal::is_same::value }; -// typedef AutoDiffScalar ReturnType; -// }; - #define EIGEN_AUTODIFF_DECLARE_GLOBAL_UNARY(FUNC, CODE) \ template \ inline auto FUNC(const Eigen::AutoDiffScalar& x) { \ diff --git a/unsupported/Eigen/src/AutoDiff/AutoDiffVector.h b/unsupported/Eigen/src/AutoDiff/AutoDiffVector.h index 623145670..892980ee4 100644 --- a/unsupported/Eigen/src/AutoDiff/AutoDiffVector.h +++ b/unsupported/Eigen/src/AutoDiff/AutoDiffVector.h @@ -35,7 +35,6 @@ namespace Eigen { template class AutoDiffVector { public: - // typedef typename internal::traits::Scalar Scalar; typedef typename internal::traits::Scalar BaseScalar; typedef AutoDiffScalar > ActiveScalar; typedef ActiveScalar Scalar; @@ -57,10 +56,8 @@ class AutoDiffVector { Index size() const { return m_values.size(); } - // FIXME here we could return an expression of the sum - Scalar sum() const { /*std::cerr << "sum \n\n";*/ /*std::cerr << m_jacobian.rowwise().sum() << "\n\n";*/ - return Scalar(m_values.sum(), m_jacobian.rowwise().sum()); - } + // FIXME: Here we could return an expression of the sum. + Scalar sum() const { return Scalar(m_values.sum(), m_jacobian.rowwise().sum()); } inline AutoDiffVector(const ValueType& values, const JacobianType& jac) : m_values(values), m_jacobian(jac) {} @@ -150,23 +147,6 @@ class AutoDiffVector { v.values() * other, v.jacobian() * other); } - // template - // inline const AutoDiffVector< - // CwiseBinaryOp, ValueType, OtherValueType> - // CwiseBinaryOp, - // CwiseUnaryOp, JacobianType>, - // CwiseUnaryOp, OtherJacobianType> > > - // operator*(const AutoDiffVector& other) const - // { - // return AutoDiffVector< - // CwiseBinaryOp, ValueType, OtherValueType> - // CwiseBinaryOp, - // CwiseUnaryOp, JacobianType>, - // CwiseUnaryOp, OtherJacobianType> > >( - // m_values.cwise() * other.values(), - // (m_jacobian * other.values()) + (m_values * other.jacobian())); - // } - inline AutoDiffVector& operator*=(const Scalar& other) { m_values *= other; m_jacobian *= other; diff --git a/unsupported/Eigen/src/Eigenvalues/ArpackSelfAdjointEigenSolver.h b/unsupported/Eigen/src/Eigenvalues/ArpackSelfAdjointEigenSolver.h index fdc6f2aa6..b110aeed6 100644 --- a/unsupported/Eigen/src/Eigenvalues/ArpackSelfAdjointEigenSolver.h +++ b/unsupported/Eigen/src/Eigenvalues/ArpackSelfAdjointEigenSolver.h @@ -27,8 +27,6 @@ struct OP; template , bool BisSPD = false> class ArpackGeneralizedSelfAdjointEigenSolver { public: - // typedef typename MatrixSolver::MatrixType MatrixType; - /** \brief Scalar type for matrices of type \p MatrixType. */ typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::Index Index; @@ -423,15 +421,6 @@ ArpackGeneralizedSelfAdjointEigenSolver::compu int info = 0; Scalar scale = 1.0; - // if (!isBempty) - //{ - // Scalar scale = B.norm() / std::sqrt(n); - // scale = std::pow(2, std::floor(std::log(scale+1))); - ////M /= scale; - // for (size_t i=0; i<(size_t)B.outerSize(); i++) - // for (typename MatrixType::InnerIterator it(B, i); it; ++it) - // it.valueRef() /= scale; - // } MatrixSolver OP; if (mode == 1 || mode == 2) { diff --git a/unsupported/Eigen/src/IterativeSolvers/DGMRES.h b/unsupported/Eigen/src/IterativeSolvers/DGMRES.h index 6f6df3edd..74edd740b 100644 --- a/unsupported/Eigen/src/IterativeSolvers/DGMRES.h +++ b/unsupported/Eigen/src/IterativeSolvers/DGMRES.h @@ -34,7 +34,7 @@ struct traits > { * \param ncut Put the ncut smallest elements at the end of the vector * WARNING This is an expensive sort, so should be used only * for small size vectors - * TODO Use modified QuickSplit or std::nth_element to get the smallest values + * TODO: Use modified QuickSplit or std::nth_element to get the smallest values */ template void sortWithPermutation(VectorType& vec, IndexType& perm, typename IndexType::Scalar& ncut) { @@ -321,7 +321,7 @@ Index DGMRES::dgmresCycle(const MatrixType& mat, c m_H(it + 1, it) = coef; // m_Hes(it+1,it) = coef; - // FIXME Check for happy breakdown + // FIXME: Check for happy breakdown. // Update Hessenberg matrix with Givens rotations for (Index i = 1; i <= it; ++i) { @@ -335,7 +335,6 @@ Index DGMRES::dgmresCycle(const MatrixType& mat, c beta = std::abs(g(it + 1)); m_error = beta / normRhs; - // std::cerr << nbIts << " Relative Residual Norm " << m_error << std::endl; it++; nbIts++; @@ -347,8 +346,7 @@ Index DGMRES::dgmresCycle(const MatrixType& mat, c } // Compute the new coefficients by solving the least square problem - // it++; - // FIXME Check first if the matrix is singular ... zero diagonal + // FIXME: Check first if the matrix is singular (zero diagonal). DenseVector nrs(m_restart); nrs = m_H.topLeftCorner(it, it).template triangularView().solve(g.head(it)); @@ -476,7 +474,7 @@ Index DGMRES::dgmresComputeDeflationData(const Mat // Factorize m_T into m_luT m_luT.compute(m_T.topLeftCorner(m_r, m_r)); - // FIXME CHeck if the factorization was correctly done (nonsingular matrix) + // FIXME: Check if the factorization was correctly done (nonsingular matrix). m_isDeflInitialized = true; return 0; } diff --git a/unsupported/Eigen/src/IterativeSolvers/Scaling.h b/unsupported/Eigen/src/IterativeSolvers/Scaling.h index 248c7b800..045c24a5c 100644 --- a/unsupported/Eigen/src/IterativeSolvers/Scaling.h +++ b/unsupported/Eigen/src/IterativeSolvers/Scaling.h @@ -67,7 +67,7 @@ class IterScaling { /** * Compute the left and right diagonal matrices to scale the input matrix @p mat * - * FIXME This algorithm will be modified such that the diagonal elements are permuted on the diagonal. + * FIXME: This algorithm will be modified such that the diagonal elements are permuted on the diagonal. * * \sa LeftScaling() RightScaling() */ @@ -164,7 +164,7 @@ class IterScaling { mutable ComputationInfo m_info; bool m_isInitialized; VectorXd m_left; // Left scaling vector - VectorXd m_right; // m_right scaling vector + VectorXd m_right; // Right scaling vector double m_tol; int m_maxits; // Maximum number of iterations allowed }; diff --git a/unsupported/Eigen/src/KroneckerProduct/KroneckerTensorProduct.h b/unsupported/Eigen/src/KroneckerProduct/KroneckerTensorProduct.h index aa03c04a6..038bf421d 100644 --- a/unsupported/Eigen/src/KroneckerProduct/KroneckerTensorProduct.h +++ b/unsupported/Eigen/src/KroneckerProduct/KroneckerTensorProduct.h @@ -153,7 +153,7 @@ void KroneckerProductSparse::evalTo(Dest& dst) const { // compute number of non-zeros per innervectors of dst { - // TODO VectorXi is not necessarily big enough! + // TODO: VectorXi is not necessarily big enough! VectorXi nnzA = VectorXi::Zero(Dest::IsRowMajor ? m_A.rows() : m_A.cols()); for (Index kA = 0; kA < m_A.outerSize(); ++kA) for (LhsInnerIterator itA(lhs1, kA); itA; ++itA) nnzA(Dest::IsRowMajor ? itA.row() : itA.col())++; diff --git a/unsupported/Eigen/src/LevenbergMarquardt/LMpar.h b/unsupported/Eigen/src/LevenbergMarquardt/LMpar.h index 01fcfdc25..75ca4e869 100644 --- a/unsupported/Eigen/src/LevenbergMarquardt/LMpar.h +++ b/unsupported/Eigen/src/LevenbergMarquardt/LMpar.h @@ -28,8 +28,6 @@ void lmpar2(const QRSolver &qr, const VectorType &diag, const VectorType &qtb, t using std::sqrt; typedef typename QRSolver::MatrixType MatrixType; typedef typename QRSolver::Scalar Scalar; - // typedef typename QRSolver::StorageIndex StorageIndex; - /* Local variables */ Index j; Scalar fp; @@ -55,11 +53,10 @@ void lmpar2(const QRSolver &qr, const VectorType &diag, const VectorType &qtb, t /* compute and store in x the gauss-newton direction. if the */ /* jacobian is rank-deficient, obtain a least squares solution. */ - // const Index rank = qr.nonzeroPivots(); // exactly double(0.) const Index rank = qr.rank(); // use a threshold wa1 = qtb; wa1.tail(n - rank).setZero(); - // FIXME There is no solve in place for sparse triangularView + // FIXME: There is no solve-in-place for sparse triangularView. wa1.head(rank) = s.topLeftCorner(rank, rank).template triangularView().solve(qtb.head(rank)); x = qr.colsPermutation() * wa1; diff --git a/unsupported/Eigen/src/LevenbergMarquardt/LevenbergMarquardt.h b/unsupported/Eigen/src/LevenbergMarquardt/LevenbergMarquardt.h index b8a6ddae9..c14ad63be 100644 --- a/unsupported/Eigen/src/LevenbergMarquardt/LevenbergMarquardt.h +++ b/unsupported/Eigen/src/LevenbergMarquardt/LevenbergMarquardt.h @@ -265,7 +265,6 @@ LevenbergMarquardtSpace::Status LevenbergMarquardt::minimize(FVecto return status; } do { - // std::cout << " uv " << x.transpose() << "\n"; status = minimizeOneStep(x); } while (status == LevenbergMarquardtSpace::Running); m_isInitialized = true; @@ -282,9 +281,8 @@ LevenbergMarquardtSpace::Status LevenbergMarquardt::minimizeInit(FV m_wa3.resize(n); m_wa4.resize(m); m_fvec.resize(m); - // FIXME Sparse Case : Allocate space for the jacobian + // FIXME: Sparse case: allocate space for the Jacobian. m_fjac.resize(m, n); - // m_fjac.reserve(VectorXi::Constant(n,5)); // FIXME Find a better alternative if (!m_useExternalScaling) m_diag.resize(n); eigen_assert((!m_useExternalScaling || m_diag.size() == n) && "When m_useExternalScaling is set, the caller must provide a valid 'm_diag'"); diff --git a/unsupported/Eigen/src/MatrixFunctions/MatrixLogarithm.h b/unsupported/Eigen/src/MatrixFunctions/MatrixLogarithm.h index 398971ebb..40e1b1d72 100644 --- a/unsupported/Eigen/src/MatrixFunctions/MatrixLogarithm.h +++ b/unsupported/Eigen/src/MatrixFunctions/MatrixLogarithm.h @@ -135,7 +135,7 @@ void matrix_log_compute_pade(MatrixType& result, const MatrixType& T, int degree const int minPadeDegree = 3; const int maxPadeDegree = 11; eigen_assert(degree >= minPadeDegree && degree <= maxPadeDegree); - // FIXME this creates float-conversion-warnings if these are enabled. + // FIXME: This creates float-conversion warnings if these are enabled. // Either manually convert each value, or disable the warning locally const RealScalar nodes[][maxPadeDegree] = { {0.1127016653792583114820734600217600L, 0.5000000000000000000000000000000000L, // degree 3 @@ -257,7 +257,7 @@ void matrix_log_compute_big(const MatrixType& A, MatrixType& result) { } matrix_log_compute_pade(result, T, degree); - result *= pow(RealScalar(2), RealScalar(numberOfSquareRoots)); // TODO replace by bitshift if possible + result *= pow(RealScalar(2), RealScalar(numberOfSquareRoots)); // TODO: Replace by bitshift if possible. } /** \ingroup MatrixFunctions_Module diff --git a/unsupported/Eigen/src/MatrixFunctions/MatrixPower.h b/unsupported/Eigen/src/MatrixFunctions/MatrixPower.h index a420ee709..8e0a2f175 100644 --- a/unsupported/Eigen/src/MatrixFunctions/MatrixPower.h +++ b/unsupported/Eigen/src/MatrixFunctions/MatrixPower.h @@ -31,7 +31,7 @@ class MatrixPower; * MatrixPower::operator() and related functions and most of the * time this is the only way it is used. */ -/* TODO This class is only used by MatrixPower, so it should be nested +/* TODO: This class is only used by MatrixPower, so it should be nested * into MatrixPower, like MatrixPower::ReturnValue. However, my * compiler complained about unused template parameter in the * following declaration in namespace internal. diff --git a/unsupported/Eigen/src/NonLinearOptimization/LevenbergMarquardt.h b/unsupported/Eigen/src/NonLinearOptimization/LevenbergMarquardt.h index 19ec8ea33..5f156ac85 100644 --- a/unsupported/Eigen/src/NonLinearOptimization/LevenbergMarquardt.h +++ b/unsupported/Eigen/src/NonLinearOptimization/LevenbergMarquardt.h @@ -421,14 +421,14 @@ LevenbergMarquardtSpace::Status LevenbergMarquardt::minimiz permutation.setIdentity(n); if (sing) { wa2 = fjac.colwise().blueNorm(); - // TODO We have no unit test covering this code path, do not modify + // TODO: We have no unit test covering this code path, do not modify // until it is carefully tested ColPivHouseholderQR qrfac(fjac); fjac = qrfac.matrixQR(); wa1 = fjac.diagonal(); fjac.diagonal() = qrfac.hCoeffs(); permutation = qrfac.colsPermutation(); - // TODO : avoid this: + // TODO: Avoid this: for (Index ii = 0; ii < fjac.cols(); ii++) fjac.col(ii).segment(ii + 1, fjac.rows() - ii - 1) *= fjac(ii, ii); // rescale vectors diff --git a/unsupported/Eigen/src/NonLinearOptimization/lmpar.h b/unsupported/Eigen/src/NonLinearOptimization/lmpar.h index 343260895..cbff829ed 100644 --- a/unsupported/Eigen/src/NonLinearOptimization/lmpar.h +++ b/unsupported/Eigen/src/NonLinearOptimization/lmpar.h @@ -169,7 +169,6 @@ void lmpar2(const ColPivHouseholderQR > &qr, co /* compute and store in x the gauss-newton direction. if the */ /* jacobian is rank-deficient, obtain a least squares solution. */ - // const Index rank = qr.nonzeroPivots(); // exactly double(0.) const Index rank = qr.rank(); // use a threshold wa1 = qtb; wa1.tail(n - rank).setZero(); diff --git a/unsupported/Eigen/src/NumericalDiff/NumericalDiff.h b/unsupported/Eigen/src/NumericalDiff/NumericalDiff.h index 1f5526365..0f4f92904 100644 --- a/unsupported/Eigen/src/NumericalDiff/NumericalDiff.h +++ b/unsupported/Eigen/src/NumericalDiff/NumericalDiff.h @@ -66,7 +66,7 @@ class NumericalDiff : public Functor_ { const Scalar eps = sqrt(((std::max)(epsfcn, NumTraits::epsilon()))); ValueType val1, val2; InputType x = _x; - // TODO : we should do this only if the size is not already known + // TODO: We should do this only if the size is not already known. val1.resize(Functor::values()); val2.resize(Functor::values()); diff --git a/unsupported/Eigen/src/Polynomials/Companion.h b/unsupported/Eigen/src/Polynomials/Companion.h index 1b7f6e101..3000b4ca1 100644 --- a/unsupported/Eigen/src/Polynomials/Companion.h +++ b/unsupported/Eigen/src/Polynomials/Companion.h @@ -40,7 +40,6 @@ class companion { typedef Scalar_ Scalar; typedef typename NumTraits::Real RealScalar; typedef Matrix RightColumn; - // typedef DiagonalMatrix< Scalar, Deg_1, Deg_1 > BottomLeftDiagonal; typedef Matrix BottomLeftDiagonal; typedef Matrix DenseCompanionMatrixType; diff --git a/unsupported/Eigen/src/SparseExtra/BlockSparseMatrix.h b/unsupported/Eigen/src/SparseExtra/BlockSparseMatrix.h index 7b6a01244..a7958af70 100644 --- a/unsupported/Eigen/src/SparseExtra/BlockSparseMatrix.h +++ b/unsupported/Eigen/src/SparseExtra/BlockSparseMatrix.h @@ -551,7 +551,7 @@ class BlockSparseMatrix eigen_assert((m_innerBSize != 0 && m_outerBSize != 0) && "TRYING TO RESERVE ZERO-SIZE MATRICES, CALL resize() first"); - // FIXME Should free if already allocated + // FIXME: Should free if already allocated. m_outerIndex = new StorageIndex[m_outerBSize + 1]; m_nonzerosblocks = nonzerosblocks; @@ -574,14 +574,14 @@ class BlockSparseMatrix * * \note For fixed-size blocks, call setBlockSize() before this function. * - * FIXME Do not accept duplicates + * FIXME: Do not accept duplicates. */ template void setFromTriplets(const InputIterator& begin, const InputIterator& end) { eigen_assert((m_innerBSize != 0 && m_outerBSize != 0) && "ZERO BLOCKS, PLEASE CALL resize() before"); /* First, sort the triplet list - * FIXME This can be unnecessarily expensive since only the inner indices have to be sorted + * FIXME: This can be unnecessarily expensive since only the inner indices have to be sorted. * The best approach is like in SparseMatrix::setFromTriplets() */ internal::TripletComp tripletcomp; @@ -646,49 +646,17 @@ class BlockSparseMatrix } block_id(outer)++; } - - // An alternative when the outer indices are sorted...no need to use an array of markers - // for(Index bcol = 0; bcol < m_outerBSize; ++bcol) - // { - // Index id = 0, id_nz = 0, id_nzblock = 0; - // for(InputIterator it(begin); it!=end; ++it) - // { - // while (idvalue().rows()*it->value().cols(); - // m_blockPtr[id_nzblock+1] = m_blockPtr[id_nzblock] + block_size; - // id_nzblock++; - // memcpy(&(m_values[id_nz]),it->value().data(), block_size*sizeof(Scalar)); - // id_nz += block_size; - // } - // while(id < m_outerBSize-1) // Empty columns at the end - // { - // id++; - // m_outerIndex[id+1]=m_outerIndex[id]; - // } - // } } /** * \returns the number of rows */ - inline Index rows() const { - // return blockRows(); - return (IsColMajor ? innerSize() : outerSize()); - } + inline Index rows() const { return (IsColMajor ? innerSize() : outerSize()); } /** * \returns the number of cols */ - inline Index cols() const { - // return blockCols(); - return (IsColMajor ? outerSize() : innerSize()); - } + inline Index cols() const { return (IsColMajor ? outerSize() : innerSize()); } inline Index innerSize() const { if (m_blockSize == Dynamic) @@ -748,7 +716,7 @@ class BlockSparseMatrix if (m_indices[offset] == inner) { return Map(&(m_values[blockPtr(offset)]), rsize, csize); } else { - // FIXME the block does not exist, Insert it !!!!!!!!! + // FIXME: The block does not exist; insert it. eigen_assert("DYNAMIC INSERTION IS NOT YET SUPPORTED"); } } @@ -769,7 +737,6 @@ class BlockSparseMatrix if (m_indices[offset] == inner) { return Map(&(m_values[blockPtr(offset)]), rsize, csize); } else - // return BlockScalar::Zero(rsize, csize); eigen_assert("NOT YET SUPPORTED"); } @@ -848,19 +815,9 @@ class BlockSparseMatrix return m_blockPtr[id]; else return id * m_blockSize * m_blockSize; - // return blockDynIdx(id, std::conditional_t<(BlockSize==Dynamic), internal::true_type, internal::false_type>()); } protected: - // inline Index blockDynIdx(Index id, internal::true_type) const - // { - // return m_blockPtr[id]; - // } - // inline Index blockDynIdx(Index id, internal::false_type) const - // { - // return id * BlockSize * BlockSize; - // } - // To be implemented // Insert a block at a particular location... need to make a room for that Map insert(Index brow, Index bcol); @@ -905,7 +862,7 @@ class BlockSparseMatrix:: inline Index row() const { return index(); } // block column index inline Index col() const { return outer(); } - // FIXME Number of rows in the current block + // FIXME: Number of rows in the current block. inline Index rows() const { return (m_mat.m_blockSize == Dynamic) ? (m_mat.m_innerOffset[index() + 1] - m_mat.m_innerOffset[index()]) : m_mat.m_blockSize; diff --git a/unsupported/Eigen/src/SparseExtra/MatrixMarketIterator.h b/unsupported/Eigen/src/SparseExtra/MatrixMarketIterator.h index 15d7fb2de..f718d78ab 100644 --- a/unsupported/Eigen/src/SparseExtra/MatrixMarketIterator.h +++ b/unsupported/Eigen/src/SparseExtra/MatrixMarketIterator.h @@ -171,10 +171,7 @@ class MatrixMarketIterator { std::string curfile; curfile = m_folder + "/" + m_curs_id->d_name; // Discard if it is a folder - if (m_curs_id->d_type == DT_DIR) continue; // FIXME This may not be available on non BSD systems - // struct stat st_buf; - // stat (curfile.c_str(), &st_buf); - // if (S_ISDIR(st_buf.st_mode)) continue; + if (m_curs_id->d_type == DT_DIR) continue; // FIXME: This may not be available on non-BSD systems. // Determine from the header if it is a matrix or a right hand side bool isvector, iscomplex = false; diff --git a/unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsImpl.h b/unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsImpl.h index 49c74d526..5553bbccf 100644 --- a/unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsImpl.h +++ b/unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsImpl.h @@ -1910,8 +1910,6 @@ struct betainc_impl { EIGEN_DEVICE_FUNC static double run(double aa, double bb, double xx) { const double nan = NumTraits::quiet_NaN(); const double machep = cephes_helper::machep(); - // const double maxgam = 171.624376956302725; - double a, b, t, x, xc, w, y; bool reversed_a_b = false; diff --git a/unsupported/Eigen/src/Splines/Spline.h b/unsupported/Eigen/src/Splines/Spline.h index 6ff1eea6a..77b352253 100644 --- a/unsupported/Eigen/src/Splines/Spline.h +++ b/unsupported/Eigen/src/Splines/Spline.h @@ -367,7 +367,7 @@ void Spline::BasisFunctionDerivativesImpl( Matrix ndu(p + 1, p + 1); - Scalar saved, temp; // FIXME These were double instead of Scalar. Was there a reason for that? + Scalar saved, temp; // FIXME: These were double instead of Scalar. Was there a reason for that? ndu(0, 0) = 1.0;