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
3ef18f1f
Commit
3ef18f1f
authored
21 years ago
by
Christian Beckmann
Browse files
Options
Downloads
Patches
Plain Diff
changed unifrnd and normrnd to use rand instead of drand
parent
7ef96bb3
No related branches found
Branches containing commit
Tags
fsl-3_1
fsl-3_1_1
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
miscprob.cc
+8
-8
8 additions, 8 deletions
miscprob.cc
with
8 additions
and
8 deletions
miscprob.cc
+
8
−
8
View file @
3ef18f1f
...
@@ -25,10 +25,10 @@ ReturnMatrix unifrnd(const int dim1, const int dim2, const float start, const fl
...
@@ -25,10 +25,10 @@ ReturnMatrix unifrnd(const int dim1, const int dim2, const float start, const fl
Matrix
res
(
dim1
,
tdim
);
Matrix
res
(
dim1
,
tdim
);
for
(
int
mc
=
1
;
mc
<=
res
.
Ncols
();
mc
++
)
{
for
(
int
mc
=
1
;
mc
<=
res
.
Ncols
();
mc
++
)
{
for
(
int
mr
=
1
;
mr
<=
res
.
Nrows
();
mr
++
)
{
for
(
int
mr
=
1
;
mr
<=
res
.
Nrows
();
mr
++
)
{
//
tmpD = (rand()+1)/double(RAND_MAX+2.0);
tmpD
=
(
rand
()
+
1
)
/
double
(
RAND_MAX
+
2.0
);
//
res(mr,mc)=(tmpD)*(end-start)+start;
res
(
mr
,
mc
)
=
(
tmpD
)
*
(
end
-
start
)
+
start
;
drand
(
&
tmpD
);
//
drand(&tmpD);
res
(
mr
,
mc
)
=
(
tmpD
-
1
)
*
(
end
-
start
)
+
start
;
//
res(mr,mc)=(tmpD-1)*(end-start)+start;
}
}
}
}
...
@@ -44,10 +44,10 @@ ReturnMatrix normrnd(const int dim1, const int dim2, const float mu, const float
...
@@ -44,10 +44,10 @@ ReturnMatrix normrnd(const int dim1, const int dim2, const float mu, const float
Matrix
res
(
dim1
,
tdim
);
Matrix
res
(
dim1
,
tdim
);
for
(
int
mc
=
1
;
mc
<=
res
.
Ncols
();
mc
++
)
{
for
(
int
mc
=
1
;
mc
<=
res
.
Ncols
();
mc
++
)
{
for
(
int
mr
=
1
;
mr
<=
res
.
Nrows
();
mr
++
)
{
for
(
int
mr
=
1
;
mr
<=
res
.
Nrows
();
mr
++
)
{
//
tmpD = (rand()+1)/double(RAND_MAX+2.0);
tmpD
=
(
rand
()
+
1
)
/
double
(
RAND_MAX
+
2.0
);
//
res(mr,mc)=ndtri(tmpD)*sigma+mu ;
res
(
mr
,
mc
)
=
ndtri
(
tmpD
)
*
sigma
+
mu
;
drand
(
&
tmpD
);
//
drand(&tmpD);
res
(
mr
,
mc
)
=
ndtri
(
tmpD
-
1
)
*
sigma
+
mu
;
//
res(mr,mc)=ndtri(tmpD-1)*sigma+mu ;
}
}
}
}
...
...
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