File: lapack_xblas.cc

package info (click to toggle)
lapackpp 2024.10.26-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,500 kB
  • sloc: cpp: 80,181; ansic: 27,660; python: 4,838; xml: 182; perl: 99; makefile: 53; sh: 23
file content (62 lines) | stat: -rw-r--r-- 2,042 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Copyright (c) 2017-2023, University of Tennessee. All rights reserved.
// SPDX-License-Identifier: BSD-3-Clause
// This program is free software: you can redistribute it and/or modify it under
// the terms of the BSD 3-Clause license. See the accompanying LICENSE file.

#include <stdio.h>

#include "config.h"

#define LAPACK_dposvxx FORTRAN_NAME(dposvxx, DPOSVXX)

#ifdef __cplusplus
extern "C"
#endif
void LAPACK_dposvxx(
    char const* fact, char const* uplo,
    lapack_int const* n, lapack_int const* nrhs,
    double* a, lapack_int const* lda,
    double* af, lapack_int const* ldaf,
    char* equed, double* s,
    double* b, lapack_int const* ldb,
    double* x, lapack_int const* ldx,
    double* rcond, double* rpvgrw, double* berr,
    lapack_int const* n_err_bnds, double* err_bnds_norm, double* err_bnds_comp,
    lapack_int const* nparams, double* params,
    double* work, lapack_int* iwork,
    lapack_int* info );

int main()
{
    const lapack_int n = 5, nrhs = 1, n_err_bnds = 3, nparams = 3;
    // symmetric positive definite
    double A[ n*n ] = {
        4, 1, 0, 0, 0,
        1, 4, 1, 0, 0,
        0, 1, 4, 1, 0,
        0, 0, 1, 4, 1,
        0, 0, 0, 1, 4
    };
    double AF[ n*n ];
    double B[ n*nrhs ] = { 1, 2, 3, 4, 5 };
    double X[ n*nrhs ] = { 1, 2, 3, 4, 5 };
    double S[ n ], rcond, rpivotgrowth, berr[ nrhs ];
    double err_bnds_norm[ nrhs*n_err_bnds ], err_bnds_comp[ nrhs*n_err_bnds ];
    double params[ nparams ] = { -1, -1, -1 };
    double work[ 4*n ];
    char equed = 'n';
    lapack_int iwork[ n ];
    lapack_int info = -1234;
    LAPACK_dposvxx( "n", "lower", &n, &nrhs,
                    A, &n, AF, &n,
                    &equed, S,
                    B, &n, X, &n,
                    &rcond, &rpivotgrowth, berr,
                    &n_err_bnds, err_bnds_norm, err_bnds_comp,
                    &nparams, params,
                    work, iwork,
                    &info );
    bool okay = (info == 0);
    printf( "%s\n", okay ? "ok" : "failed" );
    return ! okay;
}