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
8a76bcac
Commit
8a76bcac
authored
21 years ago
by
Mark Jenkinson
Browse files
Options
Downloads
Patches
Plain Diff
Changed read_ascii_matrix to make it _much_ quicker for large matrices of unknown size
parent
dc82b7a9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
miscmaths.cc
+7
-17
7 additions, 17 deletions
miscmaths.cc
with
7 additions
and
17 deletions
miscmaths.cc
+
7
−
17
View file @
8a76bcac
...
...
@@ -141,8 +141,6 @@ namespace MISCMATHS {
ReturnMatrix
read_ascii_matrix
(
ifstream
&
fs
)
{
Matrix
mat
;
int
rcount
=
0
,
cmax
=
0
;
double
val
;
string
cline
;
...
...
@@ -159,9 +157,8 @@ namespace MISCMATHS {
}
}
cmax
--
;
RowVector
newrow
(
cmax
);
do
{
do
{
getline
(
fs
,
cline
);
cline
+=
" "
;
// force extra entry in parsing
istrstream
ss
(
cline
.
c_str
());
...
...
@@ -169,20 +166,13 @@ namespace MISCMATHS {
ss
>>
cc
;
if
(
!
isnum
(
cc
))
break
;
// stop processing when non-numeric line found
rcount
++
;
// add new row to matrix
newrow
=
0.0
;
int
ccount
=
1
;
do
{
val
=
atof
(
cc
.
c_str
());
if
(
ccount
<=
cmax
)
newrow
(
ccount
++
)
=
val
;
ss
>>
cc
;
}
while
(
!
ss
.
eof
());
if
(
rcount
>
1
)
mat
=
mat
&
newrow
;
else
mat
=
newrow
;
}
while
(
!
fs
.
eof
());
}
while
(
!
fs
.
eof
());
mat
.
Release
();
return
mat
;
// now know the size of matrix
fs
.
clear
();
fs
.
seekg
(
0
,
ios
::
beg
);
return
read_ascii_matrix
(
fs
,
rcount
,
cmax
);
}
#define BINFLAG 42
...
...
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