| 560 | |
| 561 | /** \internal \returns \a a with the first coefficient replaced by the scalar b */ |
| 562 | template<typename Packet> EIGEN_DEVICE_FUNC inline Packet |
| 563 | pinsertfirst(const Packet& a, typename unpacket_traits<Packet>::type b) |
| 564 | { |
| 565 | // Default implementation based on pblend. |
| 566 | // It must be specialized for higher performance. |
| 567 | Selector<unpacket_traits<Packet>::size> mask; |
| 568 | mask.select[0] = true; |
| 569 | // This for loop should be optimized away by the compiler. |
| 570 | for(Index i=1; i<unpacket_traits<Packet>::size; ++i) |
| 571 | mask.select[i] = false; |
| 572 | return pblend(mask, pset1<Packet>(b), a); |
| 573 | } |
| 574 | |
| 575 | /** \internal \returns \a a with the last coefficient replaced by the scalar b */ |
| 576 | template<typename Packet> EIGEN_DEVICE_FUNC inline Packet |