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.
- Ensure you have the VSL installed. You can do it following the installation guide!
- Navigate to this directory.
- Run the example using the following command:
v run main.vddot: Dot product of two vectorsdnrm2: Euclidean norm of a vectordasum: Sum of absolute valuesidamax: Index of maximum absolute valuedscal: Vector scalingdaxpy: Vector addition (y = alpha*x + y)
dgemv: General matrix-vector multiplicationdger: Rank-1 update (A += alphaxy^T)
dgemm: General matrix-matrix multiplicationdsyrk: 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! 😊