Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F64523627
main.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, May 27, 12:37
Size
1 KB
Mime Type
text/x-c
Expires
Wed, May 29, 12:37 (2 d)
Engine
blob
Format
Raw Data
Handle
17916455
Attached To
R7934 PCSC_project
main.cpp
View Options
#include <iostream>
#include <cassert>
#include <cmath>
#include "Functions.hpp"
#include "Cholesky.hpp"
int
main
(
int
argc
,
char
*
argv
[]){
int
size
=
3
;
double
**
A
=
AllocateMemory
(
size
,
size
);
double
*
b
=
AllocateMemory
(
size
);
A
[
0
][
0
]
=
25
;
A
[
0
][
1
]
=
15
;
A
[
0
][
2
]
=-
5
;
A
[
1
][
0
]
=
15
;
A
[
1
][
1
]
=
18
;
A
[
1
][
2
]
=
0
;
A
[
2
][
0
]
=-
5
;
A
[
2
][
1
]
=
0
;
A
[
2
][
2
]
=
11
;
b
[
0
]
=
1
;
b
[
1
]
=
6
;
b
[
2
]
=
4
;
std
::
cout
<<
"Matrix A:"
<<
std
::
endl
;
TerminalPrint
(
A
,
size
,
size
);
Cholesky
linsys
(
A
,
b
,
size
);
std
::
cout
<<
"Matrix L:"
<<
std
::
endl
;
TerminalPrint
(
linsys
.
get_L
(),
size
,
size
);
std
::
cout
<<
"Matrix L_T:"
<<
std
::
endl
;
TerminalPrint
(
linsys
.
get_L_T
(),
size
,
size
);
double
**
A_back
=
Multiply
(
linsys
.
get_L
(),
linsys
.
get_L_T
(),
size
,
size
,
size
,
size
);
std
::
cout
<<
"Matrix L * Matrix L_T:"
<<
std
::
endl
;
TerminalPrint
(
A_back
,
size
,
size
);
std
::
cout
<<
"Vector b:"
<<
std
::
endl
;
TerminalPrint
(
b
,
size
);
std
::
cout
<<
"Vector z:"
<<
std
::
endl
;
TerminalPrint
(
linsys
.
get_b_star
(),
size
);
std
::
cout
<<
"Solution of system Ax=b:"
<<
std
::
endl
;
TerminalPrint
(
linsys
.
Solve
(),
size
);
return
0
;
}
Event Timeline
Log In to Comment