Computes the dot product of two vectors: $$ \sum^n_{i=1} \boldsymbol{x}_i * \boldsymbol{y}_i $$ # Panics Panics if the buffers are not long enough for the length requested. # Example ``` # fn main() -> Result<(), Box > { # let _a = cust::quick_init()?; # use blastoff::CublasContext; # use cust::prelude::*; # use cust::memory::DeviceBox; # use cust::util::SliceExt; # let
(
&mut self,
stream: &Stream,
n: usize,
x: &impl GpuBuffer<T>,
y: &impl GpuBuffer<T>,
result: &mut impl GpuBox<T>,
)
| 358 | /// # } |
| 359 | /// ``` |
| 360 | pub fn dot<T: FloatLevel1>( |
| 361 | &mut self, |
| 362 | stream: &Stream, |
| 363 | n: usize, |
| 364 | x: &impl GpuBuffer<T>, |
| 365 | y: &impl GpuBuffer<T>, |
| 366 | result: &mut impl GpuBox<T>, |
| 367 | ) -> Result { |
| 368 | self.dot_strided(stream, n, x, None, y, None, result) |
| 369 | } |
| 370 | |
| 371 | /// Same as [`CublasContext::dotu`] but with an explicit stride. |
| 372 | /// |