This example demonstrates basic BLAS operations at all three levels:
- Level 1: Vector operations (dot product, norms, scaling, addition) - Level 2: Matrix-vector operations (matrix-vector multiply, rank-1 update) - Level 3: Matrix-matrix operations (matrix multiply, symmetric rank-k update)
- Ensure you have the V compiler installed. You can download it from here. 2. Ensure you have the VSL installed. You can do it following the installation guide! 3. Navigate to this directory. 4. Run the example using the following command:
v run vsl/examples/blas_basic_operations/main.vddot: Dot product of two vectors -dnrm2: Euclidean norm of a vector -dasum: Sum of absolute values -idamax: Index of maximum absolute value -dscal: Vector scaling -daxpy: Vector addition (y = alpha*x + y)
dgemv: General matrix-vector multiplication -dger: Rank-1 update (A += alphaxy^T)
dgemm: General matrix-matrix multiplication -dsyrk: Symmetric rank-k update
This example uses the pure V BLAS backend by default (zero dependencies).
To use the OpenBLAS C backend for comparison:
v -d vsl_blas_cblas run main.v- Pure V backend provides excellent performance with zero dependencies - C backend (
-d vsl_blas_cblas) may offer slightly better performance for very large problems - For most use cases, pure V backend is recommended for simplicity
Enjoy exploring the capabilities of VSL BLAS! 😊