* @brief This function returns a random normalized unit vector of specified size * @param args[0] The dimension * @return The unit-norm vector **/
| 78 | * @return The unit-norm vector |
| 79 | **/ |
| 80 | AnyType svd_unit_vector::run(AnyType & args) |
| 81 | { |
| 82 | int32_t dim = args[0].getAs<int32_t>(); |
| 83 | |
| 84 | if(dim < 1){ |
| 85 | throw std::invalid_argument( |
| 86 | "invalid argument - Positive integer expected for dimension"); |
| 87 | } |
| 88 | |
| 89 | MutableNativeColumnVector vectorEigen; |
| 90 | Allocator& allocator = defaultAllocator(); |
| 91 | vectorEigen.rebind(allocator.allocateArray<double>(dim)); |
| 92 | vectorEigen.setRandom(); |
| 93 | vectorEigen = vectorEigen.normalized(); |
| 94 | |
| 95 | // AnyType tuple; |
| 96 | // tuple << vectorEigen; |
| 97 | // return tuple; |
| 98 | |
| 99 | return vectorEigen; |
| 100 | } |
| 101 | |
| 102 | /** |
| 103 | * @brief This function is the transition function of the aggregator computing the Lanczos vectors |