Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gmsh
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
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
fb97a606
Commit
fb97a606
authored
14 years ago
by
Tuomas Karna
Browse files
Options
Downloads
Patches
Plain Diff
fullMatrix constructor uses setAll(0.) instead of scale(0.), thus NaNs and Infs are eliminated.
parent
cc426f76
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
Numeric/fullMatrix.h
+13
-6
13 additions, 6 deletions
Numeric/fullMatrix.h
with
13 additions
and
6 deletions
Numeric/fullMatrix.h
+
13
−
6
View file @
fb97a606
...
@@ -28,7 +28,7 @@ class fullVector
...
@@ -28,7 +28,7 @@ class fullVector
fullVector
(
int
r
)
:
_r
(
r
)
fullVector
(
int
r
)
:
_r
(
r
)
{
{
_data
=
new
scalar
[
_r
];
_data
=
new
scalar
[
_r
];
s
cale
(
0.
);
s
etAll
(
0.
);
}
}
fullVector
(
void
)
:
_r
(
0
),
_data
(
0
)
{}
fullVector
(
void
)
:
_r
(
0
),
_data
(
0
)
{}
fullVector
(
const
fullVector
<
scalar
>
&
other
)
:
_r
(
other
.
_r
)
fullVector
(
const
fullVector
<
scalar
>
&
other
)
:
_r
(
other
.
_r
)
...
@@ -78,6 +78,14 @@ class fullVector
...
@@ -78,6 +78,14 @@ class fullVector
else
else
for
(
int
i
=
0
;
i
<
_r
;
++
i
)
_data
[
i
]
*=
s
;
for
(
int
i
=
0
;
i
<
_r
;
++
i
)
_data
[
i
]
*=
s
;
}
}
inline
void
setAll
(
const
scalar
&
m
)
{
for
(
int
i
=
0
;
i
<
_r
;
i
++
)
_data
[
i
]
=
m
;
}
inline
void
setAll
(
const
fullVector
<
scalar
>
&
m
)
{
for
(
int
i
=
0
;
i
<
_r
;
i
++
)
_data
[
i
]
=
m
.
_data
[
i
];
}
inline
scalar
operator
*
(
const
fullVector
<
scalar
>
&
other
)
inline
scalar
operator
*
(
const
fullVector
<
scalar
>
&
other
)
{
{
scalar
s
=
0.
;
scalar
s
=
0.
;
...
@@ -160,12 +168,12 @@ class fullMatrix
...
@@ -160,12 +168,12 @@ class fullMatrix
{
{
_data
=
new
scalar
[
_r
*
_c
];
_data
=
new
scalar
[
_r
*
_c
];
_own_data
=
true
;
_own_data
=
true
;
s
cale
(
0.
);
s
etAll
(
0.
);
}
}
fullMatrix
(
int
r
,
int
c
,
double
*
data
)
fullMatrix
(
int
r
,
int
c
,
double
*
data
)
:
_r
(
r
),
_c
(
c
),
_data
(
data
),
_own_data
(
false
)
:
_r
(
r
),
_c
(
c
),
_data
(
data
),
_own_data
(
false
)
{
{
s
cale
(
0.
);
s
etAll
(
0.
);
}
}
fullMatrix
(
const
fullMatrix
<
scalar
>
&
other
)
:
_r
(
other
.
_r
),
_c
(
other
.
_c
)
fullMatrix
(
const
fullMatrix
<
scalar
>
&
other
)
:
_r
(
other
.
_r
),
_c
(
other
.
_c
)
{
{
...
@@ -329,9 +337,8 @@ class fullMatrix
...
@@ -329,9 +337,8 @@ class fullMatrix
}
}
void
scale
(
const
double
s
)
void
scale
(
const
double
s
)
#if !defined(HAVE_BLAS)
#if !defined(HAVE_BLAS)
{
{
if
(
s
==
0.
)
// this is not really correct nan*0 (or inf*0) is expected to give nan
if
(
s
==
0.
)
for
(
int
i
=
0
;
i
<
_r
*
_c
;
++
i
)
_data
[
i
]
=
0.
;
for
(
int
i
=
0
;
i
<
_r
*
_c
;
++
i
)
_data
[
i
]
=
0.
;
else
else
for
(
int
i
=
0
;
i
<
_r
*
_c
;
++
i
)
_data
[
i
]
*=
s
;
for
(
int
i
=
0
;
i
<
_r
*
_c
;
++
i
)
_data
[
i
]
*=
s
;
...
...
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