Skip to content

Commit

Permalink
Update imports and function signatures in lapack and blas modules
Browse files Browse the repository at this point in the history
  • Loading branch information
ulises-jeremias committed Jan 7, 2024
1 parent d667c95 commit 10eea19
Show file tree
Hide file tree
Showing 6 changed files with 153 additions and 132 deletions.
5 changes: 5 additions & 0 deletions blas/blas64/conversions.v
Original file line number Diff line number Diff line change
@@ -1,27 +1,32 @@
module blas64

// MemoryLayout is used to specify the memory layout of a matrix.
pub enum MemoryLayout {
row_major = 101
col_major = 102
}

// Transpose is used to specify the transposition of a matrix.
pub enum Transpose {
no_trans = 111
trans = 112
conj_trans = 113
conj_no_trans = 114
}

// Uplo is used to specify whether the upper or lower triangle of a matrix is
pub enum Uplo {
upper = 121
lower = 122
}

// Diagonal is used to specify whether the diagonal of a matrix is unit or non-unit.
pub enum Diagonal {
non_unit = 131
unit = 132
}

// Side is used to specify whether a matrix is on the left or right side in a matrix-matrix multiplication.
pub enum Side {
left = 141
right = 142
Expand Down
23 changes: 21 additions & 2 deletions blas/conversions.v
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,37 @@ import math.complex
import vsl.errors
import vsl.blas.blas64

pub fn c_trans(trans bool) blas64.Transpose {
// MemoryLayout is used to specify the memory layout of a matrix.
pub type MemoryLayout = blas64.MemoryLayout

// Transpose is used to specify the transposition of a matrix.
pub type Transpose = blas64.Transpose

// Uplo is used to specify whether the upper or lower triangle of a matrix is
pub type Uplo = blas64.Uplo

// Diagonal is used to specify whether the diagonal of a matrix is unit or non-unit.
pub type Diagonal = blas64.Diagonal

// Side is used to specify whether a matrix is on the left or right side in a matrix-matrix multiplication.
pub type Side = blas64.Side

// c_trans is a helper function to convert bool to Transpose
pub fn c_trans(trans bool) Transpose {
return if trans { .trans } else { .no_trans }
}

pub fn c_uplo(up bool) blas64.Uplo {
// c_uplo is a helper function to convert bool to Uplo
pub fn c_uplo(up bool) Uplo {
return if up { .upper } else { .lower }
}

// l_uplo is a helper function to convert bool to Uplo
fn l_uplo(up bool) u8 {
return if up { `U` } else { `L` }
}

// job_vlr is a helper function to convert bool to char
fn job_vlr(do_calc bool) rune {
return if do_calc { `V` } else { `N` }
}
Expand Down
Loading

0 comments on commit 10eea19

Please sign in to comment.