use crate::rocblas::Handle;
use crate::rocblas::ffi as rocblas_ffi;
use crate::rocsolver::bindings;
use crate::rocsolver::error::{Error, Result};
use crate::rocsolver::types::{Complex32, Complex64, Fill};
type RocblasHandle = rocblas_ffi::rocblas_handle;
type RocblasStatus = rocblas_ffi::rocblas_status;
#[inline]
fn cast_handle(handle: RocblasHandle) -> bindings::rocblas_handle {
handle as bindings::rocblas_handle
}
type BindingsComplex32 = bindings::rocblas_float_complex;
type BindingsComplex64 = bindings::rocblas_double_complex;
pub trait GeqrfType: Sized + Copy {
unsafe fn geqrf(
handle: RocblasHandle,
m: i32,
n: i32,
A: *mut Self,
lda: i32,
ipiv: *mut Self,
) -> RocblasStatus;
unsafe fn geqrf_batched(
handle: RocblasHandle,
m: i32,
n: i32,
A: *const *mut Self,
lda: i32,
ipiv: *mut Self,
stride_p: i64,
batch_count: i32,
) -> RocblasStatus;
unsafe fn geqrf_strided_batched(
handle: RocblasHandle,
m: i32,
n: i32,
A: *mut Self,
lda: i32,
stride_a: i64,
ipiv: *mut Self,
stride_p: i64,
batch_count: i32,
) -> RocblasStatus;
}
pub trait GetrfType: Sized + Copy {
unsafe fn getrf(
handle: RocblasHandle,
m: i32,
n: i32,
A: *mut Self,
lda: i32,
ipiv: *mut i32,
info: *mut i32,
) -> RocblasStatus;
unsafe fn getrf_batched(
handle: RocblasHandle,
m: i32,
n: i32,
A: *const *mut Self,
lda: i32,
ipiv: *mut i32,
stride_p: i64,
info: *mut i32,
batch_count: i32,
) -> RocblasStatus;
unsafe fn getrf_strided_batched(
handle: RocblasHandle,
m: i32,
n: i32,
A: *mut Self,
lda: i32,
stride_a: i64,
ipiv: *mut i32,
stride_p: i64,
info: *mut i32,
batch_count: i32,
) -> RocblasStatus;
unsafe fn getrf_npvt(
handle: RocblasHandle,
m: i32,
n: i32,
A: *mut Self,
lda: i32,
info: *mut i32,
) -> RocblasStatus;
unsafe fn getrf_npvt_batched(
handle: RocblasHandle,
m: i32,
n: i32,
A: *const *mut Self,
lda: i32,
info: *mut i32,
batch_count: i32,
) -> RocblasStatus;
unsafe fn getrf_npvt_strided_batched(
handle: RocblasHandle,
m: i32,
n: i32,
A: *mut Self,
lda: i32,
stride_a: i64,
info: *mut i32,
batch_count: i32,
) -> RocblasStatus;
}
pub trait PotrfType: Sized + Copy {
unsafe fn potrf(
handle: RocblasHandle,
uplo: rocblas_ffi::rocblas_fill,
n: i32,
A: *mut Self,
lda: i32,
info: *mut i32,
) -> RocblasStatus;
unsafe fn potrf_batched(
handle: RocblasHandle,
uplo: rocblas_ffi::rocblas_fill,
n: i32,
A: *const *mut Self,
lda: i32,
info: *mut i32,
batch_count: i32,
) -> RocblasStatus;
unsafe fn potrf_strided_batched(
handle: RocblasHandle,
uplo: rocblas_ffi::rocblas_fill,
n: i32,
A: *mut Self,
lda: i32,
stride_a: i64,
info: *mut i32,
batch_count: i32,
) -> RocblasStatus;
}
pub trait GebrdType: Sized + Copy {
type RealType: Copy;
unsafe fn gebrd(
handle: RocblasHandle,
m: i32,
n: i32,
A: *mut Self,
lda: i32,
D: *mut Self::RealType,
E: *mut Self::RealType,
tauq: *mut Self,
taup: *mut Self,
) -> RocblasStatus;
unsafe fn gebrd_batched(
handle: RocblasHandle,
m: i32,
n: i32,
A: *const *mut Self,
lda: i32,
D: *mut Self::RealType,
stride_d: i64,
E: *mut Self::RealType,
stride_e: i64,
tauq: *mut Self,
stride_tauq: i64,
taup: *mut Self,
stride_taup: i64,
batch_count: i32,
) -> RocblasStatus;
unsafe fn gebrd_strided_batched(
handle: RocblasHandle,
m: i32,
n: i32,
A: *mut Self,
lda: i32,
stride_a: i64,
D: *mut Self::RealType,
stride_d: i64,
E: *mut Self::RealType,
stride_e: i64,
tauq: *mut Self,
stride_tauq: i64,
taup: *mut Self,
stride_taup: i64,
batch_count: i32,
) -> RocblasStatus;
}
impl GeqrfType for f32 {
unsafe fn geqrf(
handle: RocblasHandle,
m: i32,
n: i32,
A: *mut Self,
lda: i32,
ipiv: *mut Self,
) -> RocblasStatus {
bindings::rocsolver_sgeqrf(cast_handle(handle), m, n, A, lda, ipiv)
}
unsafe fn geqrf_batched(
handle: RocblasHandle,
m: i32,
n: i32,
A: *const *mut Self,
lda: i32,
ipiv: *mut Self,
stride_p: i64,
batch_count: i32,
) -> RocblasStatus {
bindings::rocsolver_sgeqrf_batched(
cast_handle(handle),
m,
n,
A,
lda,
ipiv,
stride_p,
batch_count,
)
}
unsafe fn geqrf_strided_batched(
handle: RocblasHandle,
m: i32,
n: i32,
A: *mut Self,
lda: i32,
stride_a: i64,
ipiv: *mut Self,
stride_p: i64,
batch_count: i32,
) -> RocblasStatus {
bindings::rocsolver_sgeqrf_strided_batched(
cast_handle(handle),
m,
n,
A,
lda,
stride_a,
ipiv,
stride_p,
batch_count,
)
}
}
impl GetrfType for f32 {
unsafe fn getrf(
handle: RocblasHandle,
m: i32,
n: i32,
A: *mut Self,
lda: i32,
ipiv: *mut i32,
info: *mut i32,
) -> RocblasStatus {
bindings::rocsolver_sgetrf(cast_handle(handle), m, n, A, lda, ipiv, info)
}
unsafe fn getrf_batched(
handle: RocblasHandle,
m: i32,
n: i32,
A: *const *mut Self,
lda: i32,
ipiv: *mut i32,
stride_p: i64,
info: *mut i32,
batch_count: i32,
) -> RocblasStatus {
bindings::rocsolver_sgetrf_batched(
cast_handle(handle),
m,
n,
A,
lda,
ipiv,
stride_p,
info,
batch_count,
)
}
unsafe fn getrf_strided_batched(
handle: RocblasHandle,
m: i32,
n: i32,
A: *mut Self,
lda: i32,
stride_a: i64,
ipiv: *mut i32,
stride_p: i64,
info: *mut i32,
batch_count: i32,
) -> RocblasStatus {
bindings::rocsolver_sgetrf_strided_batched(
cast_handle(handle),
m,
n,
A,
lda,
stride_a,
ipiv,
stride_p,
info,
batch_count,
)
}
unsafe fn getrf_npvt(
handle: RocblasHandle,
m: i32,
n: i32,
A: *mut Self,
lda: i32,
info: *mut i32,
) -> RocblasStatus {
bindings::rocsolver_sgetrf_npvt(cast_handle(handle), m, n, A, lda, info)
}
unsafe fn getrf_npvt_batched(
handle: RocblasHandle,
m: i32,
n: i32,
A: *const *mut Self,
lda: i32,
info: *mut i32,
batch_count: i32,
) -> RocblasStatus {
bindings::rocsolver_sgetrf_npvt_batched(
cast_handle(handle),
m,
n,
A,
lda,
info,
batch_count,
)
}
unsafe fn getrf_npvt_strided_batched(
handle: RocblasHandle,
m: i32,
n: i32,
A: *mut Self,
lda: i32,
stride_a: i64,
info: *mut i32,
batch_count: i32,
) -> RocblasStatus {
bindings::rocsolver_sgetrf_npvt_strided_batched(
cast_handle(handle),
m,
n,
A,
lda,
stride_a,
info,
batch_count,
)
}
}
impl PotrfType for f32 {
unsafe fn potrf(
handle: RocblasHandle,
uplo: rocblas_ffi::rocblas_fill,
n: i32,
A: *mut Self,
lda: i32,
info: *mut i32,
) -> RocblasStatus {
bindings::rocsolver_spotrf(cast_handle(handle), uplo, n, A, lda, info)
}
unsafe fn potrf_batched(
handle: RocblasHandle,
uplo: rocblas_ffi::rocblas_fill,
n: i32,
A: *const *mut Self,
lda: i32,
info: *mut i32,
batch_count: i32,
) -> RocblasStatus {
bindings::rocsolver_spotrf_batched(cast_handle(handle), uplo, n, A, lda, info, batch_count)
}
unsafe fn potrf_strided_batched(
handle: RocblasHandle,
uplo: rocblas_ffi::rocblas_fill,
n: i32,
A: *mut Self,
lda: i32,
stride_a: i64,
info: *mut i32,
batch_count: i32,
) -> RocblasStatus {
bindings::rocsolver_spotrf_strided_batched(
cast_handle(handle),
uplo,
n,
A,
lda,
stride_a,
info,
batch_count,
)
}
}
impl GebrdType for f32 {
type RealType = f32;
unsafe fn gebrd(
handle: RocblasHandle,
m: i32,
n: i32,
A: *mut Self,
lda: i32,
D: *mut Self::RealType,
E: *mut Self::RealType,
tauq: *mut Self,
taup: *mut Self,
) -> RocblasStatus {
bindings::rocsolver_sgebrd(cast_handle(handle), m, n, A, lda, D, E, tauq, taup)
}
unsafe fn gebrd_batched(
handle: RocblasHandle,
m: i32,
n: i32,
A: *const *mut Self,
lda: i32,
D: *mut Self::RealType,
stride_d: i64,
E: *mut Self::RealType,
stride_e: i64,
tauq: *mut Self,
stride_tauq: i64,
taup: *mut Self,
stride_taup: i64,
batch_count: i32,
) -> RocblasStatus {
bindings::rocsolver_sgebrd_batched(
cast_handle(handle),
m,
n,
A,
lda,
D,
stride_d,
E,
stride_e,
tauq,
stride_tauq,
taup,
stride_taup,
batch_count,
)
}
unsafe fn gebrd_strided_batched(
handle: RocblasHandle,
m: i32,
n: i32,
A: *mut Self,
lda: i32,
stride_a: i64,
D: *mut Self::RealType,
stride_d: i64,
E: *mut Self::RealType,
stride_e: i64,
tauq: *mut Self,
stride_tauq: i64,
taup: *mut Self,
stride_taup: i64,
batch_count: i32,
) -> RocblasStatus {
bindings::rocsolver_sgebrd_strided_batched(
cast_handle(handle),
m,
n,
A,
lda,
stride_a,
D,
stride_d,
E,
stride_e,
tauq,
stride_tauq,
taup,
stride_taup,
batch_count,
)
}
}
impl GeqrfType for f64 {
unsafe fn geqrf(
handle: RocblasHandle,
m: i32,
n: i32,
A: *mut Self,
lda: i32,
ipiv: *mut Self,
) -> RocblasStatus {
bindings::rocsolver_dgeqrf(cast_handle(handle), m, n, A, lda, ipiv)
}
unsafe fn geqrf_batched(
handle: RocblasHandle,
m: i32,
n: i32,
A: *const *mut Self,
lda: i32,
ipiv: *mut Self,
stride_p: i64,
batch_count: i32,
) -> RocblasStatus {
bindings::rocsolver_dgeqrf_batched(
cast_handle(handle),
m,
n,
A,
lda,
ipiv,
stride_p,
batch_count,
)
}
unsafe fn geqrf_strided_batched(
handle: RocblasHandle,
m: i32,
n: i32,
A: *mut Self,
lda: i32,
stride_a: i64,
ipiv: *mut Self,
stride_p: i64,
batch_count: i32,
) -> RocblasStatus {
bindings::rocsolver_dgeqrf_strided_batched(
cast_handle(handle),
m,
n,
A,
lda,
stride_a,
ipiv,
stride_p,
batch_count,
)
}
}
impl GetrfType for f64 {
unsafe fn getrf(
handle: RocblasHandle,
m: i32,
n: i32,
A: *mut Self,
lda: i32,
ipiv: *mut i32,
info: *mut i32,
) -> RocblasStatus {
bindings::rocsolver_dgetrf(cast_handle(handle), m, n, A, lda, ipiv, info)
}
unsafe fn getrf_batched(
handle: RocblasHandle,
m: i32,
n: i32,
A: *const *mut Self,
lda: i32,
ipiv: *mut i32,
stride_p: i64,
info: *mut i32,
batch_count: i32,
) -> RocblasStatus {
bindings::rocsolver_dgetrf_batched(
cast_handle(handle),
m,
n,
A,
lda,
ipiv,
stride_p,
info,
batch_count,
)
}
unsafe fn getrf_strided_batched(
handle: RocblasHandle,
m: i32,
n: i32,
A: *mut Self,
lda: i32,
stride_a: i64,
ipiv: *mut i32,
stride_p: i64,
info: *mut i32,
batch_count: i32,
) -> RocblasStatus {
bindings::rocsolver_dgetrf_strided_batched(
cast_handle(handle),
m,
n,
A,
lda,
stride_a,
ipiv,
stride_p,
info,
batch_count,
)
}
unsafe fn getrf_npvt(
handle: RocblasHandle,
m: i32,
n: i32,
A: *mut Self,
lda: i32,
info: *mut i32,
) -> RocblasStatus {
bindings::rocsolver_dgetrf_npvt(cast_handle(handle), m, n, A, lda, info)
}
unsafe fn getrf_npvt_batched(
handle: RocblasHandle,
m: i32,
n: i32,
A: *const *mut Self,
lda: i32,
info: *mut i32,
batch_count: i32,
) -> RocblasStatus {
bindings::rocsolver_dgetrf_npvt_batched(
cast_handle(handle),
m,
n,
A,
lda,
info,
batch_count,
)
}
unsafe fn getrf_npvt_strided_batched(
handle: RocblasHandle,
m: i32,
n: i32,
A: *mut Self,
lda: i32,
stride_a: i64,
info: *mut i32,
batch_count: i32,
) -> RocblasStatus {
bindings::rocsolver_dgetrf_npvt_strided_batched(
cast_handle(handle),
m,
n,
A,
lda,
stride_a,
info,
batch_count,
)
}
}
impl PotrfType for f64 {
unsafe fn potrf(
handle: RocblasHandle,
uplo: rocblas_ffi::rocblas_fill,
n: i32,
A: *mut Self,
lda: i32,
info: *mut i32,
) -> RocblasStatus {
bindings::rocsolver_dpotrf(cast_handle(handle), uplo, n, A, lda, info)
}
unsafe fn potrf_batched(
handle: RocblasHandle,
uplo: rocblas_ffi::rocblas_fill,
n: i32,
A: *const *mut Self,
lda: i32,
info: *mut i32,
batch_count: i32,
) -> RocblasStatus {
bindings::rocsolver_dpotrf_batched(cast_handle(handle), uplo, n, A, lda, info, batch_count)
}
unsafe fn potrf_strided_batched(
handle: RocblasHandle,
uplo: rocblas_ffi::rocblas_fill,
n: i32,
A: *mut Self,
lda: i32,
stride_a: i64,
info: *mut i32,
batch_count: i32,
) -> RocblasStatus {
bindings::rocsolver_dpotrf_strided_batched(
cast_handle(handle),
uplo,
n,
A,
lda,
stride_a,
info,
batch_count,
)
}
}
impl GebrdType for f64 {
type RealType = f64;
unsafe fn gebrd(
handle: RocblasHandle,
m: i32,
n: i32,
A: *mut Self,
lda: i32,
D: *mut Self::RealType,
E: *mut Self::RealType,
tauq: *mut Self,
taup: *mut Self,
) -> RocblasStatus {
bindings::rocsolver_dgebrd(cast_handle(handle), m, n, A, lda, D, E, tauq, taup)
}
unsafe fn gebrd_batched(
handle: RocblasHandle,
m: i32,
n: i32,
A: *const *mut Self,
lda: i32,
D: *mut Self::RealType,
stride_d: i64,
E: *mut Self::RealType,
stride_e: i64,
tauq: *mut Self,
stride_tauq: i64,
taup: *mut Self,
stride_taup: i64,
batch_count: i32,
) -> RocblasStatus {
bindings::rocsolver_dgebrd_batched(
cast_handle(handle),
m,
n,
A,
lda,
D,
stride_d,
E,
stride_e,
tauq,
stride_tauq,
taup,
stride_taup,
batch_count,
)
}
unsafe fn gebrd_strided_batched(
handle: RocblasHandle,
m: i32,
n: i32,
A: *mut Self,
lda: i32,
stride_a: i64,
D: *mut Self::RealType,
stride_d: i64,
E: *mut Self::RealType,
stride_e: i64,
tauq: *mut Self,
stride_tauq: i64,
taup: *mut Self,
stride_taup: i64,
batch_count: i32,
) -> RocblasStatus {
bindings::rocsolver_dgebrd_strided_batched(
cast_handle(handle),
m,
n,
A,
lda,
stride_a,
D,
stride_d,
E,
stride_e,
tauq,
stride_tauq,
taup,
stride_taup,
batch_count,
)
}
}
impl GeqrfType for Complex32 {
unsafe fn geqrf(
handle: RocblasHandle,
m: i32,
n: i32,
A: *mut Self,
lda: i32,
ipiv: *mut Self,
) -> RocblasStatus {
bindings::rocsolver_cgeqrf(cast_handle(handle), m, n, A, lda, ipiv)
}
unsafe fn geqrf_batched(
handle: RocblasHandle,
m: i32,
n: i32,
A: *const *mut Self,
lda: i32,
ipiv: *mut Self,
stride_p: i64,
batch_count: i32,
) -> RocblasStatus {
bindings::rocsolver_cgeqrf_batched(
cast_handle(handle),
m,
n,
A,
lda,
ipiv,
stride_p,
batch_count,
)
}
unsafe fn geqrf_strided_batched(
handle: RocblasHandle,
m: i32,
n: i32,
A: *mut Self,
lda: i32,
stride_a: i64,
ipiv: *mut Self,
stride_p: i64,
batch_count: i32,
) -> RocblasStatus {
bindings::rocsolver_cgeqrf_strided_batched(
cast_handle(handle),
m,
n,
A,
lda,
stride_a,
ipiv,
stride_p,
batch_count,
)
}
}
impl GetrfType for Complex32 {
unsafe fn getrf(
handle: RocblasHandle,
m: i32,
n: i32,
A: *mut Self,
lda: i32,
ipiv: *mut i32,
info: *mut i32,
) -> RocblasStatus {
bindings::rocsolver_cgetrf(cast_handle(handle), m, n, A, lda, ipiv, info)
}
unsafe fn getrf_batched(
handle: RocblasHandle,
m: i32,
n: i32,
A: *const *mut Self,
lda: i32,
ipiv: *mut i32,
stride_p: i64,
info: *mut i32,
batch_count: i32,
) -> RocblasStatus {
bindings::rocsolver_cgetrf_batched(
cast_handle(handle),
m,
n,
A,
lda,
ipiv,
stride_p,
info,
batch_count,
)
}
unsafe fn getrf_strided_batched(
handle: RocblasHandle,
m: i32,
n: i32,
A: *mut Self,
lda: i32,
stride_a: i64,
ipiv: *mut i32,
stride_p: i64,
info: *mut i32,
batch_count: i32,
) -> RocblasStatus {
bindings::rocsolver_cgetrf_strided_batched(
cast_handle(handle),
m,
n,
A,
lda,
stride_a,
ipiv,
stride_p,
info,
batch_count,
)
}
unsafe fn getrf_npvt(
handle: RocblasHandle,
m: i32,
n: i32,
A: *mut Self,
lda: i32,
info: *mut i32,
) -> RocblasStatus {
bindings::rocsolver_cgetrf_npvt(cast_handle(handle), m, n, A, lda, info)
}
unsafe fn getrf_npvt_batched(
handle: RocblasHandle,
m: i32,
n: i32,
A: *const *mut Self,
lda: i32,
info: *mut i32,
batch_count: i32,
) -> RocblasStatus {
bindings::rocsolver_cgetrf_npvt_batched(
cast_handle(handle),
m,
n,
A,
lda,
info,
batch_count,
)
}
unsafe fn getrf_npvt_strided_batched(
handle: RocblasHandle,
m: i32,
n: i32,
A: *mut Self,
lda: i32,
stride_a: i64,
info: *mut i32,
batch_count: i32,
) -> RocblasStatus {
bindings::rocsolver_cgetrf_npvt_strided_batched(
cast_handle(handle),
m,
n,
A,
lda,
stride_a,
info,
batch_count,
)
}
}
impl PotrfType for Complex32 {
unsafe fn potrf(
handle: RocblasHandle,
uplo: rocblas_ffi::rocblas_fill,
n: i32,
A: *mut Self,
lda: i32,
info: *mut i32,
) -> RocblasStatus {
bindings::rocsolver_cpotrf(cast_handle(handle), uplo, n, A, lda, info)
}
unsafe fn potrf_batched(
handle: RocblasHandle,
uplo: rocblas_ffi::rocblas_fill,
n: i32,
A: *const *mut Self,
lda: i32,
info: *mut i32,
batch_count: i32,
) -> RocblasStatus {
bindings::rocsolver_cpotrf_batched(cast_handle(handle), uplo, n, A, lda, info, batch_count)
}
unsafe fn potrf_strided_batched(
handle: RocblasHandle,
uplo: rocblas_ffi::rocblas_fill,
n: i32,
A: *mut Self,
lda: i32,
stride_a: i64,
info: *mut i32,
batch_count: i32,
) -> RocblasStatus {
bindings::rocsolver_cpotrf_strided_batched(
cast_handle(handle),
uplo,
n,
A,
lda,
stride_a,
info,
batch_count,
)
}
}
impl GebrdType for Complex32 {
type RealType = f32;
unsafe fn gebrd(
handle: RocblasHandle,
m: i32,
n: i32,
A: *mut Self,
lda: i32,
D: *mut Self::RealType,
E: *mut Self::RealType,
tauq: *mut Self,
taup: *mut Self,
) -> RocblasStatus {
bindings::rocsolver_cgebrd(cast_handle(handle), m, n, A, lda, D, E, tauq, taup)
}
unsafe fn gebrd_batched(
handle: RocblasHandle,
m: i32,
n: i32,
A: *const *mut Self,
lda: i32,
D: *mut Self::RealType,
stride_d: i64,
E: *mut Self::RealType,
stride_e: i64,
tauq: *mut Self,
stride_tauq: i64,
taup: *mut Self,
stride_taup: i64,
batch_count: i32,
) -> RocblasStatus {
bindings::rocsolver_cgebrd_batched(
cast_handle(handle),
m,
n,
A,
lda,
D,
stride_d,
E,
stride_e,
tauq,
stride_tauq,
taup,
stride_taup,
batch_count,
)
}
unsafe fn gebrd_strided_batched(
handle: RocblasHandle,
m: i32,
n: i32,
A: *mut Self,
lda: i32,
stride_a: i64,
D: *mut Self::RealType,
stride_d: i64,
E: *mut Self::RealType,
stride_e: i64,
tauq: *mut Self,
stride_tauq: i64,
taup: *mut Self,
stride_taup: i64,
batch_count: i32,
) -> RocblasStatus {
bindings::rocsolver_cgebrd_strided_batched(
cast_handle(handle),
m,
n,
A,
lda,
stride_a,
D,
stride_d,
E,
stride_e,
tauq,
stride_tauq,
taup,
stride_taup,
batch_count,
)
}
}
impl GeqrfType for Complex64 {
unsafe fn geqrf(
handle: RocblasHandle,
m: i32,
n: i32,
A: *mut Self,
lda: i32,
ipiv: *mut Self,
) -> RocblasStatus {
bindings::rocsolver_zgeqrf(cast_handle(handle), m, n, A, lda, ipiv)
}
unsafe fn geqrf_batched(
handle: RocblasHandle,
m: i32,
n: i32,
A: *const *mut Self,
lda: i32,
ipiv: *mut Self,
stride_p: i64,
batch_count: i32,
) -> RocblasStatus {
bindings::rocsolver_zgeqrf_batched(
cast_handle(handle),
m,
n,
A,
lda,
ipiv,
stride_p,
batch_count,
)
}
unsafe fn geqrf_strided_batched(
handle: RocblasHandle,
m: i32,
n: i32,
A: *mut Self,
lda: i32,
stride_a: i64,
ipiv: *mut Self,
stride_p: i64,
batch_count: i32,
) -> RocblasStatus {
bindings::rocsolver_zgeqrf_strided_batched(
cast_handle(handle),
m,
n,
A,
lda,
stride_a,
ipiv,
stride_p,
batch_count,
)
}
}
impl GetrfType for Complex64 {
unsafe fn getrf(
handle: RocblasHandle,
m: i32,
n: i32,
A: *mut Self,
lda: i32,
ipiv: *mut i32,
info: *mut i32,
) -> RocblasStatus {
bindings::rocsolver_zgetrf(cast_handle(handle), m, n, A, lda, ipiv, info)
}
unsafe fn getrf_batched(
handle: RocblasHandle,
m: i32,
n: i32,
A: *const *mut Self,
lda: i32,
ipiv: *mut i32,
stride_p: i64,
info: *mut i32,
batch_count: i32,
) -> RocblasStatus {
bindings::rocsolver_zgetrf_batched(
cast_handle(handle),
m,
n,
A,
lda,
ipiv,
stride_p,
info,
batch_count,
)
}
unsafe fn getrf_strided_batched(
handle: RocblasHandle,
m: i32,
n: i32,
A: *mut Self,
lda: i32,
stride_a: i64,
ipiv: *mut i32,
stride_p: i64,
info: *mut i32,
batch_count: i32,
) -> RocblasStatus {
bindings::rocsolver_zgetrf_strided_batched(
cast_handle(handle),
m,
n,
A,
lda,
stride_a,
ipiv,
stride_p,
info,
batch_count,
)
}
unsafe fn getrf_npvt(
handle: RocblasHandle,
m: i32,
n: i32,
A: *mut Self,
lda: i32,
info: *mut i32,
) -> RocblasStatus {
bindings::rocsolver_zgetrf_npvt(cast_handle(handle), m, n, A, lda, info)
}
unsafe fn getrf_npvt_batched(
handle: RocblasHandle,
m: i32,
n: i32,
A: *const *mut Self,
lda: i32,
info: *mut i32,
batch_count: i32,
) -> RocblasStatus {
bindings::rocsolver_zgetrf_npvt_batched(
cast_handle(handle),
m,
n,
A,
lda,
info,
batch_count,
)
}
unsafe fn getrf_npvt_strided_batched(
handle: RocblasHandle,
m: i32,
n: i32,
A: *mut Self,
lda: i32,
stride_a: i64,
info: *mut i32,
batch_count: i32,
) -> RocblasStatus {
bindings::rocsolver_zgetrf_npvt_strided_batched(
cast_handle(handle),
m,
n,
A,
lda,
stride_a,
info,
batch_count,
)
}
}
impl PotrfType for Complex64 {
unsafe fn potrf(
handle: RocblasHandle,
uplo: rocblas_ffi::rocblas_fill,
n: i32,
A: *mut Self,
lda: i32,
info: *mut i32,
) -> RocblasStatus {
bindings::rocsolver_zpotrf(cast_handle(handle), uplo, n, A, lda, info)
}
unsafe fn potrf_batched(
handle: RocblasHandle,
uplo: rocblas_ffi::rocblas_fill,
n: i32,
A: *const *mut Self,
lda: i32,
info: *mut i32,
batch_count: i32,
) -> RocblasStatus {
bindings::rocsolver_zpotrf_batched(cast_handle(handle), uplo, n, A, lda, info, batch_count)
}
unsafe fn potrf_strided_batched(
handle: RocblasHandle,
uplo: rocblas_ffi::rocblas_fill,
n: i32,
A: *mut Self,
lda: i32,
stride_a: i64,
info: *mut i32,
batch_count: i32,
) -> RocblasStatus {
bindings::rocsolver_zpotrf_strided_batched(
cast_handle(handle),
uplo,
n,
A,
lda,
stride_a,
info,
batch_count,
)
}
}
impl GebrdType for Complex64 {
type RealType = f64;
unsafe fn gebrd(
handle: RocblasHandle,
m: i32,
n: i32,
A: *mut Self,
lda: i32,
D: *mut Self::RealType,
E: *mut Self::RealType,
tauq: *mut Self,
taup: *mut Self,
) -> RocblasStatus {
bindings::rocsolver_zgebrd(cast_handle(handle), m, n, A, lda, D, E, tauq, taup)
}
unsafe fn gebrd_batched(
handle: RocblasHandle,
m: i32,
n: i32,
A: *const *mut Self,
lda: i32,
D: *mut Self::RealType,
stride_d: i64,
E: *mut Self::RealType,
stride_e: i64,
tauq: *mut Self,
stride_tauq: i64,
taup: *mut Self,
stride_taup: i64,
batch_count: i32,
) -> RocblasStatus {
bindings::rocsolver_zgebrd_batched(
cast_handle(handle),
m,
n,
A,
lda,
D,
stride_d,
E,
stride_e,
tauq,
stride_tauq,
taup,
stride_taup,
batch_count,
)
}
unsafe fn gebrd_strided_batched(
handle: RocblasHandle,
m: i32,
n: i32,
A: *mut Self,
lda: i32,
stride_a: i64,
D: *mut Self::RealType,
stride_d: i64,
E: *mut Self::RealType,
stride_e: i64,
tauq: *mut Self,
stride_tauq: i64,
taup: *mut Self,
stride_taup: i64,
batch_count: i32,
) -> RocblasStatus {
bindings::rocsolver_zgebrd_strided_batched(
cast_handle(handle),
m,
n,
A,
lda,
stride_a,
D,
stride_d,
E,
stride_e,
tauq,
stride_tauq,
taup,
stride_taup,
batch_count,
)
}
}
#[inline]
pub fn geqrf<T: GeqrfType>(
handle: &Handle,
m: i32,
n: i32,
A: *mut T,
lda: i32,
ipiv: *mut T,
) -> Result<()> {
let status = unsafe { T::geqrf(handle.as_raw(), m, n, A, lda, ipiv) };
Error::from_status(status)
}
#[inline]
pub fn geqrf_batched<T: GeqrfType>(
handle: &Handle,
m: i32,
n: i32,
A: *const *mut T,
lda: i32,
ipiv: *mut T,
stride_p: i64,
batch_count: i32,
) -> Result<()> {
let status =
unsafe { T::geqrf_batched(handle.as_raw(), m, n, A, lda, ipiv, stride_p, batch_count) };
Error::from_status(status)
}
#[inline]
pub fn geqrf_strided_batched<T: GeqrfType>(
handle: &Handle,
m: i32,
n: i32,
A: *mut T,
lda: i32,
stride_a: i64,
ipiv: *mut T,
stride_p: i64,
batch_count: i32,
) -> Result<()> {
let status = unsafe {
T::geqrf_strided_batched(
handle.as_raw(),
m,
n,
A,
lda,
stride_a,
ipiv,
stride_p,
batch_count,
)
};
Error::from_status(status)
}
#[inline]
pub fn getrf<T: GetrfType>(
handle: &Handle,
m: i32,
n: i32,
A: *mut T,
lda: i32,
ipiv: *mut i32,
info: *mut i32,
) -> Result<()> {
let status = unsafe { T::getrf(handle.as_raw(), m, n, A, lda, ipiv, info) };
Error::from_status(status)
}
#[inline]
pub fn getrf_batched<T: GetrfType>(
handle: &Handle,
m: i32,
n: i32,
A: *const *mut T,
lda: i32,
ipiv: *mut i32,
stride_p: i64,
info: *mut i32,
batch_count: i32,
) -> Result<()> {
let status = unsafe {
T::getrf_batched(
handle.as_raw(),
m,
n,
A,
lda,
ipiv,
stride_p,
info,
batch_count,
)
};
Error::from_status(status)
}
#[inline]
pub fn getrf_strided_batched<T: GetrfType>(
handle: &Handle,
m: i32,
n: i32,
A: *mut T,
lda: i32,
stride_a: i64,
ipiv: *mut i32,
stride_p: i64,
info: *mut i32,
batch_count: i32,
) -> Result<()> {
let status = unsafe {
T::getrf_strided_batched(
handle.as_raw(),
m,
n,
A,
lda,
stride_a,
ipiv,
stride_p,
info,
batch_count,
)
};
Error::from_status(status)
}
#[inline]
pub fn getrf_npvt<T: GetrfType>(
handle: &Handle,
m: i32,
n: i32,
A: *mut T,
lda: i32,
info: *mut i32,
) -> Result<()> {
let status = unsafe { T::getrf_npvt(handle.as_raw(), m, n, A, lda, info) };
Error::from_status(status)
}
#[inline]
pub fn getrf_npvt_batched<T: GetrfType>(
handle: &Handle,
m: i32,
n: i32,
A: *const *mut T,
lda: i32,
info: *mut i32,
batch_count: i32,
) -> Result<()> {
let status = unsafe { T::getrf_npvt_batched(handle.as_raw(), m, n, A, lda, info, batch_count) };
Error::from_status(status)
}
#[inline]
pub fn getrf_npvt_strided_batched<T: GetrfType>(
handle: &Handle,
m: i32,
n: i32,
A: *mut T,
lda: i32,
stride_a: i64,
info: *mut i32,
batch_count: i32,
) -> Result<()> {
let status = unsafe {
T::getrf_npvt_strided_batched(handle.as_raw(), m, n, A, lda, stride_a, info, batch_count)
};
Error::from_status(status)
}
#[inline]
pub fn potrf<T: PotrfType>(
handle: &Handle,
uplo: Fill,
n: i32,
A: *mut T,
lda: i32,
info: *mut i32,
) -> Result<()> {
let status = unsafe { T::potrf(handle.as_raw(), uplo.into(), n, A, lda, info) };
Error::from_status(status)
}
#[inline]
pub fn potrf_batched<T: PotrfType>(
handle: &Handle,
uplo: Fill,
n: i32,
A: *const *mut T,
lda: i32,
info: *mut i32,
batch_count: i32,
) -> Result<()> {
let status =
unsafe { T::potrf_batched(handle.as_raw(), uplo.into(), n, A, lda, info, batch_count) };
Error::from_status(status)
}
#[inline]
pub fn potrf_strided_batched<T: PotrfType>(
handle: &Handle,
uplo: Fill,
n: i32,
A: *mut T,
lda: i32,
stride_a: i64,
info: *mut i32,
batch_count: i32,
) -> Result<()> {
let status = unsafe {
T::potrf_strided_batched(
handle.as_raw(),
uplo.into(),
n,
A,
lda,
stride_a,
info,
batch_count,
)
};
Error::from_status(status)
}
#[inline]
pub fn gebrd<T: GebrdType>(
handle: &Handle,
m: i32,
n: i32,
A: *mut T,
lda: i32,
D: *mut T::RealType,
E: *mut T::RealType,
tauq: *mut T,
taup: *mut T,
) -> Result<()> {
let status = unsafe { T::gebrd(handle.as_raw(), m, n, A, lda, D, E, tauq, taup) };
Error::from_status(status)
}
#[inline]
pub fn gebrd_batched<T: GebrdType>(
handle: &Handle,
m: i32,
n: i32,
A: *const *mut T,
lda: i32,
D: *mut T::RealType,
stride_d: i64,
E: *mut T::RealType,
stride_e: i64,
tauq: *mut T,
stride_tauq: i64,
taup: *mut T,
stride_taup: i64,
batch_count: i32,
) -> Result<()> {
let status = unsafe {
T::gebrd_batched(
handle.as_raw(),
m,
n,
A,
lda,
D,
stride_d,
E,
stride_e,
tauq,
stride_tauq,
taup,
stride_taup,
batch_count,
)
};
Error::from_status(status)
}
#[inline]
pub fn gebrd_strided_batched<T: GebrdType>(
handle: &Handle,
m: i32,
n: i32,
A: *mut T,
lda: i32,
stride_a: i64,
D: *mut T::RealType,
stride_d: i64,
E: *mut T::RealType,
stride_e: i64,
tauq: *mut T,
stride_tauq: i64,
taup: *mut T,
stride_taup: i64,
batch_count: i32,
) -> Result<()> {
let status = unsafe {
T::gebrd_strided_batched(
handle.as_raw(),
m,
n,
A,
lda,
stride_a,
D,
stride_d,
E,
stride_e,
tauq,
stride_tauq,
taup,
stride_taup,
batch_count,
)
};
Error::from_status(status)
}