Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
miscmaths
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FSL
miscmaths
Commits
224bca9d
Commit
224bca9d
authored
11 years ago
by
Matthew Webster
Browse files
Options
Downloads
Patches
Plain Diff
working version
parent
0d95c88c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
miscmaths.cc
+2
-21
2 additions, 21 deletions
miscmaths.cc
with
2 additions
and
21 deletions
miscmaths.cc
+
2
−
21
View file @
224bca9d
...
...
@@ -2127,9 +2127,7 @@ ReturnMatrix cov_r(const Matrix& data, const Matrix& weights2, int econ)
SymmetricMatrix
res
;
res
<<
zeros
(
data
.
Nrows
(),
data
.
Nrows
());
Matrix
meanM
(
mean
(
data
,
weights
,
2
));
int
N
=
1
-
weights
.
SumSquare
();
//As weights.Sum() is equal to 1
double
N
=
(
1
-
weights
.
SumSquare
());
//As weights.Sum() is equal to 1
if
(
econ
<
1
)
econ
=
data
.
Ncols
();
for
(
int
startCol
=
1
;
startCol
<=
data
.
Ncols
();
startCol
+=
econ
)
{
...
...
@@ -2140,24 +2138,7 @@ ReturnMatrix cov_r(const Matrix& data, const Matrix& weights2, int econ)
}
res
<<
res
+
suba
*
suba
.
t
()
/
N
;
}
write_ascii_matrix
(
"data.mat"
,
data
);
write_ascii_matrix
(
"weights.mat"
,
weights
);
write_ascii_matrix
(
"nonorm"
,
cov_r
(
data
,
false
));
write_ascii_matrix
(
"old.mat"
,
res
);
//res.Release();
Matrix
Data2
=
data
;
for
(
int
ctr
=
1
;
ctr
<=
data
.
Ncols
();
ctr
++
)
Data2
.
Column
(
ctr
)
*=
weights
(
ctr
);
Matrix
res2
=
oldcov
(
Data2
.
t
(),
1
);
res
<<
res2
;
write_ascii_matrix
(
"new.mat"
,
res
);
exit
(
1
);
res
.
Release
();
return
res
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment