| 765 | } |
| 766 | |
| 767 | inline void allocate(const int size, bool as_byte = false) { |
| 768 | if (this->vals == nullptr) { |
| 769 | if (as_byte) { |
| 770 | this->size = (size + sizeof(double) - 1) / sizeof(double); |
| 771 | } else { |
| 772 | this->size = size; |
| 773 | } |
| 774 | this->vals = (double*) malloc(sizeof(double) * this->size); |
| 775 | } |
| 776 | return; |
| 777 | } |
| 778 | inline double get_norm() { |
| 779 | return cblas_dnrm2(this->size, this->vals, 1); |
| 780 | } |