mirror of
https://github.com/TREX-CoE/Sherman-Morrison.git
synced 2024-12-25 13:53:56 +01:00
Added some initial data likle Makefiles and .gitignore.
This commit is contained in:
parent
3704856b10
commit
d286e0d45e
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
*.o
|
||||
SM-MaponiA3
|
6
.vscode/settings.json
vendored
Normal file
6
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"files.associations": {
|
||||
"ostream": "cpp",
|
||||
"new": "cpp"
|
||||
}
|
||||
}
|
12
Makefile
Normal file
12
Makefile
Normal file
@ -0,0 +1,12 @@
|
||||
CC=icc
|
||||
CXX=icpc
|
||||
CFLAGS=
|
||||
|
||||
DEPS = SM-MaponiA3.cpp
|
||||
OBJ = SM-MaponiA3.o
|
||||
|
||||
%.o: %.c $(DEPS)
|
||||
$(CXX) -c -o $@ $< $(CFLAGS)
|
||||
|
||||
SM-MaponiA3: $(OBJ)
|
||||
$(CXX) -o $@ $^ $(CFLAGS)
|
39
SM-MaponiA3.cpp
Normal file
39
SM-MaponiA3.cpp
Normal file
@ -0,0 +1,39 @@
|
||||
// Algorithm 3 from P. Maponi,
|
||||
// p. 283, doi:10.1016/j.laa.2006.07.007
|
||||
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
int M=3;
|
||||
int N=3;
|
||||
|
||||
int main() {
|
||||
|
||||
int** A = new int*[N];
|
||||
for (int i = 0; i < N; i++) {
|
||||
A[i] = new int[M];
|
||||
}
|
||||
A[0][0] = 1;
|
||||
A[0][1] = 1;
|
||||
A[0][2] = -1;
|
||||
A[1][0] = 1;
|
||||
A[1][1] = 1;
|
||||
A[1][2] = 0;
|
||||
A[2][0] = -1;
|
||||
A[2][1] = 0;
|
||||
A[2][2] = -1;
|
||||
|
||||
for (int i = 0; i < M; i++) {
|
||||
for (int j = 0; j < N; j++) {
|
||||
cout << "A["<<i<<"]["<<j<<"] = " << A[i][j] << " ";
|
||||
}
|
||||
cout << endl;
|
||||
}
|
||||
|
||||
for (int i = 0; i < N; i++) {
|
||||
delete [] A[i];
|
||||
}
|
||||
delete [] A;
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user