Nek5000
SEM for Incompressible NS
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Modules
Pages
jl
tests
spchol_test.c
Go to the documentation of this file.
1
#include <stddef.h>
2
#include <stdlib.h>
3
#include <stdio.h>
4
#include <string.h>
5
#include "
c99.h
"
6
#include "
name.h
"
7
#include "
fail.h
"
8
#include "
types.h
"
9
#include "
mem.h
"
10
#include "
sparse_cholesky.h
"
11
12
int
main
()
13
{
14
#define x -1
15
16
uint
i
,
n
=7;
17
uint
Aj
[] = {0,2, 1,2,6, 0,1,2, 3,5,6, 4,5, 3,4,5, 1,3,6};
18
double
A
[] = {2,
x
, 2,
x
,
x
,
x
,
x
,2, 2,
x
,
x
, 2,
x
,
x
,
x
,2,
x
,
x
,2};
19
#undef x
20
uint
Arp[] = {0,2,5,8,11,13,16,19};
21
double
x
[7], b[7] = {0,0,0,0, 0,0,0};
22
uint
o[7] = {0,2,1,6,3,5,4};
23
/*
24
uint i,n=10;
25
uint Aj [] = {0,2,7, 1,4,9, 0,2,6, 3,8,9, 1,4,8,9, 5,6,7, 2,5,6, 0,5,7,8,9, 3,4,7,8, 1,3,4,7,9};
26
real A [] = {3,x,x, 2,x,x, x,2,x, 2,x,x, x,3,x,x, 2,x,x, x,x,2, x,x,4,x,x, x,x,x,3, x,x,x,x,4};
27
#undef x
28
uint Arp[] = {0, 3, 6, 9, 12, 16, 19, 22, 27, 31, 36};
29
real b[] = {1,2,3,4,5, 6,7,8,9,10};
30
*/
31
struct
sparse_cholesky
data;
32
buffer
buf;
33
buffer_init
(&buf,4);
34
sparse_cholesky_factor
(n,Arp,Aj,A,&data,&buf);
35
36
for
(i=0;i<
n
;++
i
) {
uint
j;
37
b[o[
i
]]=1;
38
sparse_cholesky_solve
(x,&data,b);
39
for
(j=0;j<
n
;++j) printf(
"\t%g"
,(
double
)x[o[j]]);
40
printf(
"\n"
);
41
b[o[
i
]]=0;
42
}
43
sparse_cholesky_free
(&data);
44
buffer_free
(&buf);
45
/*
46
sparse_cholesky_solve(b,&data,b);
47
sparse_cholesky_free(&data);
48
for(i=0;i<n;++i) printf("%g\n", b[i]);
49
*/
50
51
return
0;
52
}
53
54
uint
#define uint
Definition:
types.h:70
main
int main()
Definition:
spchol_test.c:12
buffer_free
#define buffer_free(b)
Definition:
mem.h:158
types.h
mem.h
c99.h
n
n
Definition:
xxt_test.m:73
x
#define x
A
ulong A[NUM][SI]
Definition:
sort_test.c:17
fail.h
array
Definition:
mem.h:111
sparse_cholesky_solve
#define sparse_cholesky_solve
Definition:
sparse_cholesky.c:13
i
for i
Definition:
xxt_test.m:74
Aj
const uint Aj[3][32]
Definition:
xxt_test.c:85
sparse_cholesky_free
#define sparse_cholesky_free
Definition:
sparse_cholesky.c:14
buffer_init
#define buffer_init(b, max)
Definition:
mem.h:155
sparse_cholesky.h
sparse_cholesky_factor
#define sparse_cholesky_factor
Definition:
sparse_cholesky.c:12
name.h
establishes some macros to establish naming conventions
sparse_cholesky
Definition:
sparse_cholesky.c:28
Generated on Tue Jul 14 2015 10:52:58 for Nek5000 by
1.8.8