CfKu/tensor-algebra

Sub/Functions missing

Closed this issue · 1 comments

With some 'little' help of IA I have translated your repository to VBA, but although I get all running as a charm, I still miss two procedures that are referred on "inv_6x6_sym" subroutine (comMath.f module). The procedures missing are:
subroutine dsytrf(uplo, n, a, lda, ipiv, work, info)
subroutine dsytri(uplo, n, a, lda, ipiv, work, info)

Trusting the IA 'research'...(sic) -supposing it's not allucinating-, it seems that both have high chances to come from LAPACK library, which, by the way, it's not referred in the modules. Asking the IA if it could generate them from the naming of the parameters, and interpret them, it did a nice work on the task asked and, as far as I know, they seem correct and matches the definition of the subroutines. I do not attach them as they are IA generated and have not put too much effort on finding bugs on them, aside they are in VBA; and also because it's trivial asking for them again.

DSYTRF subroutine seems to perform the LU factorization of the input matrix A. DSYTRI subroutine inverts the matrix A.

Function inv_6x6_sym <-- ByRef afMat()
' returns the inversion of a 6x6 (symmetric) matrix by using the MKL
' res = inv(A) [sym]

' uplo: This is an input parameter indicating whether the upper or lower triangular part of the matrix A is being provided.
' It is a character variable that can take the value 'U' or 'L'. If 'U' is specified, it means that the upper triangular part of A is provided.
' If 'L' is specified, it means that the lower triangular part of A is provided.
'
' n: This is an input parameter indicating the order (dimension) of the matrix A. It specifies the number of rows and columns in the square matrix A.
'
' a: This is the input/output array representing the square matrix A. It is a two-dimensional array with dimensions (lda, n).
' The elements of the matrix A are stored in column-major order.
' The lda parameter specifies the leading dimension of the array a, which is the stride between consecutive columns in memory.
' The size of the array a should be at least lda * n.
'
' lda: This is an input parameter indicating the leading dimension of the array a.
' It specifies the stride between consecutive columns of the matrix A stored in memory. The value of lda should be at least max(1, n).
'
' ipiv: This is an output array of integers representing the pivot indices. It is a one-dimensional array of size n.
' The pivot indices indicate the row interchanges performed during the LU factorization.
' The value of ipiv(j) represents the row index that was interchanged with row j.
' The pivot indices are used to track the permutations and can be used later for various operations such as solving linear systems.
'
' work: This is a workspace array used by the subroutine. It is a one-dimensional array of size (n-1)*n/2.
' The size of the workspace depends on the size of the matrix A and is used for intermediate computations during the LU factorization.
'
' info: This is an output parameter indicating the exit status of the subroutine. It is an integer variable.
' A value of 0 indicates successful execution, while a non-zero value indicates an error or failure.
' The specific meaning of each error code can be found in the documentation of the LAPACK library.

Do please, take a look, and comment about the LACKP library if missing reference

CfKu commented

Hi @audeser,

Thank you for the investigation. To be honest, I coded these functions a couple of years ago. I agree that dependencies may be missing. Off the top of my head, in addition to this code, I used BLAS and LAPACK in a larger project that is not part of this repo. I only open sourced a small part (basically the libraries that could be easily reused) and did not test it separately. So feel free to improve and contribute using the GitHub Flow.