mirror of
https://github.com/ivabus/pantry
synced 2024-11-10 02:25:18 +03:00
581ac5005b
* new file: projects/people.engr.tamu.edu/davis/suitesparse/package.yml new file: projects/people.engr.tamu.edu/davis/suitesparse/test.c * let's ty to fix linux * needs openblas, i believe * looks like, from the warnings, that it wants the actual library paths * needs libfortran on darwin too. --------- Co-authored-by: Jacob Heider <jacob@pkgx.dev>
24 lines
746 B
C
24 lines
746 B
C
#include <stdio.h>
|
|
#include "klu.h"
|
|
|
|
int n = 5 ;
|
|
int Ap [ ] = {0, 2, 5, 9, 10, 12} ;
|
|
int Ai [ ] = { 0, 1, 0, 2, 4, 1, 2, 3, 4, 2, 1, 4} ;
|
|
double Ax [ ] = {2., 3., 3., -1., 4., 4., -3., 1., 2., 2., 6., 1.} ;
|
|
double b [ ] = {8., 45., -3., 3., 19.} ;
|
|
|
|
int main (void)
|
|
{
|
|
klu_symbolic *Symbolic ;
|
|
klu_numeric *Numeric ;
|
|
klu_common Common ;
|
|
int i ;
|
|
klu_defaults (&Common) ;
|
|
Symbolic = klu_analyze (n, Ap, Ai, &Common) ;
|
|
Numeric = klu_factor (Ap, Ai, Ax, Symbolic, &Common) ;
|
|
klu_solve (Symbolic, Numeric, 5, 1, b, &Common) ;
|
|
klu_free_symbolic (&Symbolic, &Common) ;
|
|
klu_free_numeric (&Numeric, &Common) ;
|
|
for (i = 0 ; i < n ; i++) printf ("x [%d] = %g\n", i, b [i]) ;
|
|
return (0) ;
|
|
} |