Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
otsall
/
iax0583
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
327044a5
authored
Oct 01, 2018
by
otsall
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
formating
parent
a85ae63b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
0 deletions
Lab4/formating.c
Lab4/formating.c
0 → 100644
View file @
327044a5
#include <stdio.h>
#include <string.h>
int
main
(){
float
orthogonalMatrix
[
6
][
6
];
float
initialVector
[
6
]
=
{
0
.
3
,
0
.
4
,
-
2
,
-
4
.
4
,
2
.
2
,
3
};
float
sumOfSquares
;
memcpy
(
orthogonalMatrix
[
0
],
initialVector
,
6
*
sizeof
(
float
));
for
(
int
i
=
1
;
i
<
6
;
i
++
){
sumOfSquares
=
0
;
if
(
initialVector
[
i
]
==
0
){
orthogonalMatrix
[
i
][
i
-
1
]
=
1
;
}
for
(
int
j
=
i
;
j
<
6
;
j
++
){
sumOfSquares
+=
initialVector
[
j
]
*
initialVector
[
j
];
}
if
(
sumOfSquares
==
0
){
for
(
int
j
=
i
;
j
<
6
;
j
++
){
orthogonalMatrix
[
j
][
j
]
=
1
;
}
}
initialVector
[
i
-
1
]
=
-
1
*
sumOfSquares
/
initialVector
[
i
-
1
];
memcpy
(
orthogonalMatrix
[
i
],
initialVector
,
6
*
sizeof
(
float
));
initialVector
[
i
-
1
]
=
0
;
}
for
(
int
i
=
0
;
i
<
6
;
i
++
){
for
(
int
j
=
0
;
j
<
6
;
j
++
){
printf
(
"%f,"
,
orthogonalMatrix
[
i
][
j
]);
}
printf
(
"
\n
"
);
}
return
0
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment