List of all items
Structs
Enums
Traits
- Cholesky_
- Eig_
- Eigh_
- Lapack
- LeastSquaresSvdDivideConquer_
- OperatorNorm_
- QR_
- Rcond_
- SVDDC_
- SVD_
- Solve_
- Solveh_
- Triangular_
- Tridiagonal_
- error::AsLapackResult
Redirecting to ../../lax/trait.Cholesky_.html...
+ + + \ No newline at end of file diff --git a/lax/eig/trait.Eig_.html b/lax/eig/trait.Eig_.html new file mode 100644 index 00000000..218d77c9 --- /dev/null +++ b/lax/eig/trait.Eig_.html @@ -0,0 +1,11 @@ + + + + +Redirecting to ../../lax/trait.Eig_.html...
+ + + \ No newline at end of file diff --git a/lax/eigh/trait.Eigh_.html b/lax/eigh/trait.Eigh_.html new file mode 100644 index 00000000..44c09209 --- /dev/null +++ b/lax/eigh/trait.Eigh_.html @@ -0,0 +1,11 @@ + + + + +Redirecting to ../../lax/trait.Eigh_.html...
+ + + \ No newline at end of file diff --git a/lax/enum.Diag.html b/lax/enum.Diag.html new file mode 100644 index 00000000..09c52d2c --- /dev/null +++ b/lax/enum.Diag.html @@ -0,0 +1,47 @@ +#[repr(u8)]
+pub enum Diag {
+ Unit,
+ NonUnit,
+}UnitNonUnitMutably borrows from an owned value. Read more
+#[repr(u8)]
+pub enum EigenVectorFlag {
+ Calc,
+ Not,
+}Flag for calculating eigenvectors or not
+CalcNotReturns a copy of the value. Read more
+Performs copy-assignment from source. Read more
Mutably borrows from an owned value. Read more
+#[repr(u8)]
+pub enum NormType {
+ One,
+ Infinity,
+ Frobenius,
+}OneInfinityFrobeniusMutably borrows from an owned value. Read more
+#[repr(u8)]
+pub enum Transpose {
+ No,
+ Transpose,
+ Hermite,
+}NoTransposeHermiteMutably borrows from an owned value. Read more
+#[repr(u8)]
+pub enum UPLO {
+ Upper,
+ Lower,
+}Upper/Lower specification for seveal usages
+UpperLowerMutably borrows from an owned value. Read more
+#[repr(u8)]
+pub enum UVTFlag {
+ Full,
+ Some,
+ None,
+}Specifies how many of the columns of U and rows of Vᵀ are computed and returned.
+For an input array of shape m×n, the following are computed:
+FullAll m columns of U and all n rows of Vᵀ.
+SomeThe first min(m,n) columns of U and the first min(m,n) rows of Vᵀ.
+NoneNo columns of U or rows of Vᵀ.
+Mutably borrows from an owned value. Read more
+pub enum Error {
+ LapackInvalidValue {
+ return_code: i32,
+ },
+ LapackComputationalFailure {
+ return_code: i32,
+ },
+ InvalidShape,
+}LapackInvalidValuereturn_code: i32LapackComputationalFailurereturn_code: i32InvalidShapeStrides of the array is not supported
+The lower-level source of this error, if any. Read more
+backtrace)Returns a stack backtrace, if available, of where this error occurred. Read more
+use the Display impl or to_string()
+Mutably borrows from an owned value. Read more
+pub trait AsLapackResult {
+ fn as_lapack_result(self) -> Result<()>;
+}ndarray-free safe Rust wrapper for LAPACK FFI
+As the property of $A$, several types of triangular factorization are used:
+| matrix type | Triangler factorization (TRF) | Solve (TRS) | Inverse matrix (TRI) | Reciprocal condition number (CON) |
|---|---|---|---|---|
| General (GE) | lu | solve | inv | rcond |
| Symmetric (SY) / Hermitian (HE) | bk | solveh | invh | - |
Solve eigenvalue problem for a matrix $A$
+$$ Av_i = \lambda_i v_i $$
+or generalized eigenvalue problem
+$$ Av_i = \lambda_i B v_i $$
+| matrix type | Eigenvalue (EV) | Generalized Eigenvalue Problem (EG) |
|---|---|---|
| General (GE) | eig | - |
| Symmetric (SY) / Hermitian (HE) | eigh | eigh_generalized |
| matrix type | Singular Value Decomposition (SVD) | SVD with divided-and-conquer (SDD) | Least square problem (LSD) |
|---|---|---|---|
| General (GE) | svd | svddc | least_squares |
Represents the LU factorization of a tridiagonal matrix A as A = P*L*U.
Result of LeastSquares
+Result of SVD
+Represents a tridiagonal matrix as 3 one-dimensional vectors.
+Flag for calculating eigenvectors or not
+Upper/Lower specification for seveal usages
+Specifies how many of the columns of U and rows of Vᵀ are computed and returned.
+Wraps *geev for general matrices
Trait for primitive types which implements LAPACK subroutines
+Wraps *gelsd
Wraps *gesvd
Wraps *trtri and *trtrs
Wraps *gttrf, *gtcon and *gttrs
CFTranspose without changing memory representation
+C-contigious row=2, lda=3
+[[1, 2, 3]
+ [4, 5, 6]]and F-contigious col=2, lda=3
+[[1, 4]
+ [2, 5]
+ [3, 6]]have same memory representation [1, 2, 3, 4, 5, 6], and this toggles them.
let layout = MatrixLayout::C { row: 2, lda: 3 };
+assert_eq!(layout.t(), MatrixLayout::F { col: 2, lda: 3 });Returns a copy of the value. Read more
+Performs copy-assignment from source. Read more
This method tests for self and other values to be equal, and is used
+by ==. Read more
This method tests for !=.
Mutably borrows from an owned value. Read more
+pub fn square_transpose<T: Copy>(layout: MatrixLayout, a: &mut [T])In-place transpose of a square matrix by keeping F/C layout
+Transpose for C-continuous array
+ +let layout = MatrixLayout::C { row: 2, lda: 2 };
+let mut a = vec![1., 2., 3., 4.];
+square_transpose(layout, &mut a);
+assert_eq!(a, &[1., 3., 2., 4.]);Transpose for F-continuous array
+ +let layout = MatrixLayout::F { col: 2, lda: 2 };
+let mut a = vec![1., 3., 2., 4.];
+square_transpose(layout, &mut a);
+assert_eq!(a, &[1., 2., 3., 4.]);a and layout size mismatchpub fn transpose<T: Copy>(
layout: MatrixLayout,
input: &[T]
) -> (MatrixLayout, Vec<T>)Out-place transpose for general matrix
+let layout = MatrixLayout::C { row: 2, lda: 3 };
+let a = vec![1., 2., 3., 4., 5., 6.];
+let (l, b) = transpose(layout, &a);
+assert_eq!(l, MatrixLayout::F { col: 3, lda: 2 });
+assert_eq!(b, &[1., 4., 2., 5., 3., 6.]);let layout = MatrixLayout::F { col: 2, lda: 3 };
+let a = vec![1., 2., 3., 4., 5., 6.];
+let (l, b) = transpose(layout, &a);
+assert_eq!(l, MatrixLayout::C { row: 3, lda: 2 });
+assert_eq!(b, &[1., 4., 2., 5., 3., 6.]);layout size mismatchpub fn transpose_over<T: Copy>(
layout: MatrixLayout,
from: &[T],
to: &mut [T]
) -> MatrixLayoutOut-place transpose for general matrix
+let layout = MatrixLayout::C { row: 2, lda: 3 };
+let a = vec![1., 2., 3., 4., 5., 6.];
+let mut b = vec![0.0; a.len()];
+let l = transpose_over(layout, &a, &mut b);
+assert_eq!(l, MatrixLayout::F { col: 3, lda: 2 });
+assert_eq!(b, &[1., 4., 2., 5., 3., 6.]);let layout = MatrixLayout::F { col: 2, lda: 3 };
+let a = vec![1., 2., 3., 4., 5., 6.];
+let mut b = vec![0.0; a.len()];
+let l = transpose_over(layout, &a, &mut b);
+assert_eq!(l, MatrixLayout::C { row: 3, lda: 2 });
+assert_eq!(b, &[1., 4., 2., 5., 3., 6.]);layout size mismatchMemory layout of matrices
+Different from ndarray format which consists of shape and strides, +matrix format in LAPACK consists of row or column size and leading dimension.
+Let us consider 3-dimensional array for explaining ndarray structure.
+The address of (x,y,z)-element in ndarray satisfies following relation:
shape = [Nx, Ny, Nz]
+ where Nx > 0, Ny > 0, Nz > 0
+stride = [Sx, Sy, Sz]
+
+&data[(x, y, z)] = &data[(0, 0, 0)] + Sx*x + Sy*y + Sz*z
+ for x < Nx, y < Ny, z < NzThe array is called
+[Sx, Sy, Sz] = [Nz*Ny, Nz, 1][Sx, Sy, Sz] = [1, Nx, Nx*Ny]Strides of ndarray [Sx, Sy, Sz] take arbitrary value,
+e.g. it can be non-ordered Sy > Sx > Sz, or can be negative Sx < 0.
+If the minimum of [Sx, Sy, Sz] equals to 1,
+the value of elements fills data memory region and called “continuous”.
+Non-continuous ndarray is useful to get sub-array without copying data.
LAPACK interface focuses on the linear algebra operations for F-continuous 2-dimensional array.
+Under this restriction, stride becomes far simpler; we only have to consider the case [1, S]
+This S for a matrix A is called “leading dimension of the array A” in LAPACK document, and denoted by lda.
In-place transpose of a square matrix by keeping F/C layout
+Out-place transpose for general matrix
+Out-place transpose for general matrix
+Redirecting to ../../lax/struct.LeastSquaresOutput.html...
+ + + \ No newline at end of file diff --git a/lax/least_squares/trait.LeastSquaresSvdDivideConquer_.html b/lax/least_squares/trait.LeastSquaresSvdDivideConquer_.html new file mode 100644 index 00000000..f22e21b4 --- /dev/null +++ b/lax/least_squares/trait.LeastSquaresSvdDivideConquer_.html @@ -0,0 +1,11 @@ + + + + +Redirecting to ../../lax/trait.LeastSquaresSvdDivideConquer_.html...
+ + + \ No newline at end of file diff --git a/lax/opnorm/trait.OperatorNorm_.html b/lax/opnorm/trait.OperatorNorm_.html new file mode 100644 index 00000000..67e3c9e1 --- /dev/null +++ b/lax/opnorm/trait.OperatorNorm_.html @@ -0,0 +1,11 @@ + + + + +Redirecting to ../../lax/trait.OperatorNorm_.html...
+ + + \ No newline at end of file diff --git a/lax/qr/trait.QR_.html b/lax/qr/trait.QR_.html new file mode 100644 index 00000000..3816fd9e --- /dev/null +++ b/lax/qr/trait.QR_.html @@ -0,0 +1,11 @@ + + + + +Redirecting to ../../lax/trait.QR_.html...
+ + + \ No newline at end of file diff --git a/lax/rcond/trait.Rcond_.html b/lax/rcond/trait.Rcond_.html new file mode 100644 index 00000000..ffaf0032 --- /dev/null +++ b/lax/rcond/trait.Rcond_.html @@ -0,0 +1,11 @@ + + + + +Redirecting to ../../lax/trait.Rcond_.html...
+ + + \ No newline at end of file diff --git a/lax/sidebar-items.js b/lax/sidebar-items.js new file mode 100644 index 00000000..2df28d13 --- /dev/null +++ b/lax/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"enum":[["Diag",""],["EigenVectorFlag","Flag for calculating eigenvectors or not"],["NormType",""],["Transpose",""],["UPLO","Upper/Lower specification for seveal usages"],["UVTFlag","Specifies how many of the columns of U and rows of Vᵀ are computed and returned."]],"mod":[["error",""],["layout","Memory layout of matrices"]],"struct":[["LUFactorizedTridiagonal","Represents the LU factorization of a tridiagonal matrix `A` as `A = P*L*U`."],["LeastSquaresOutput","Result of LeastSquares"],["SVDOutput","Result of SVD"],["Tridiagonal","Represents a tridiagonal matrix as 3 one-dimensional vectors."]],"trait":[["Cholesky_",""],["Eig_","Wraps `*geev` for general matrices"],["Eigh_",""],["Lapack","Trait for primitive types which implements LAPACK subroutines"],["LeastSquaresSvdDivideConquer_","Wraps `*gelsd`"],["OperatorNorm_",""],["QR_",""],["Rcond_",""],["SVDDC_",""],["SVD_","Wraps `*gesvd`"],["Solve_",""],["Solveh_",""],["Triangular_","Wraps `*trtri` and `*trtrs`"],["Tridiagonal_","Wraps `*gttrf`, `*gtcon` and `*gttrs`"]],"type":[["Pivot",""]]}; \ No newline at end of file diff --git a/lax/solve/trait.Solve_.html b/lax/solve/trait.Solve_.html new file mode 100644 index 00000000..ebecf200 --- /dev/null +++ b/lax/solve/trait.Solve_.html @@ -0,0 +1,11 @@ + + + + +Redirecting to ../../lax/trait.Solve_.html...
+ + + \ No newline at end of file diff --git a/lax/solveh/trait.Solveh_.html b/lax/solveh/trait.Solveh_.html new file mode 100644 index 00000000..ce928e41 --- /dev/null +++ b/lax/solveh/trait.Solveh_.html @@ -0,0 +1,11 @@ + + + + +Redirecting to ../../lax/trait.Solveh_.html...
+ + + \ No newline at end of file diff --git a/lax/src/alloc.rs b/lax/src/alloc.rs deleted file mode 100644 index 63458818..00000000 --- a/lax/src/alloc.rs +++ /dev/null @@ -1,78 +0,0 @@ -use cauchy::*; -use std::mem::MaybeUninit; - -/// Helper for getting pointer of slice -pub(crate) trait AsPtr: Sized { - type Elem; - fn as_ptr(vec: &[Self]) -> *const Self::Elem; - fn as_mut_ptr(vec: &mut [Self]) -> *mut Self::Elem; -} - -macro_rules! impl_as_ptr { - ($target:ty, $elem:ty) => { - impl AsPtr for $target { - type Elem = $elem; - fn as_ptr(vec: &[Self]) -> *const Self::Elem { - vec.as_ptr() as *const _ - } - fn as_mut_ptr(vec: &mut [Self]) -> *mut Self::Elem { - vec.as_mut_ptr() as *mut _ - } - } - }; -} -impl_as_ptr!(i32, i32); -impl_as_ptr!(f32, f32); -impl_as_ptr!(f64, f64); -impl_as_ptr!(c32, lapack_sys::__BindgenComplex