Linear Algebra using Kotlin and LAPACK (OpenBLAS)

Submitted by Dickens A S on Mon, 11/25/2019 - 16:37

Kotlin Linear Algebra using LAPACKE C APIs

Code snippet to call the library method

    print_matrix_colmajor( "Entry Matrix A", m, n, a, lda )
    print_matrix_colmajor( "Right Hand Side b", n, nrhs, b, ldb )
    println( "\nLAPACKE_dgels (col-major, high-level) Example Program Results" );
    LAPACKE_dgels(LAPACK_COL_MAJOR,'N'.toInt().toByte(),m,n,nrhs,a,lda,b,ldb)
    println()
    print_matrix_colmajor( "Solution", n, nrhs, b, ldb );

You need to use MSYS2 and install OpenBLAS to make this work, please refer other articles for MSYS2

If you run the application you will get the below output

Entry Matrix A
 1 1 1
 2 3 4
 3 5 2
 4 2 5
 5 4 3
Right Hand Side b
 -10 -3
 12 14
 14 12

LAPACKE_dgels (col-major, high-level) Example Program Results

Solution
 2 0
 0 1
 0 2

Source Code

End Of Article

Add new comment