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
f9816fa6
Commit
f9816fa6
authored
15 years ago
by
Éric Béchet
Browse files
Options
Downloads
Patches
Plain Diff
Added functionality / fullVector
parent
02a7999a
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Numeric/fullMatrix.h
+20
-1
20 additions, 1 deletion
Numeric/fullMatrix.h
with
20 additions
and
1 deletion
Numeric/fullMatrix.h
+
20
−
1
View file @
f9816fa6
...
...
@@ -32,17 +32,32 @@ class fullVector
scalar
*
_data
;
friend
class
fullMatrix
<
scalar
>
;
public:
fullVector
(
int
r
)
:
_r
(
r
)
{
_data
=
new
scalar
[
_r
];
scale
(
0.
);
}
fullVector
(
void
)
:
_r
(
0
),
_data
(
0
)
{}
fullVector
(
const
fullVector
<
scalar
>
&
other
)
:
_r
(
other
.
_r
)
{
_data
=
new
scalar
[
_r
];
for
(
int
i
=
0
;
i
<
_r
;
++
i
)
_data
[
i
]
=
other
.
_data
[
i
];
}
~
fullVector
()
{
if
(
_data
)
delete
[]
_data
;
}
bool
resize
(
int
r
)
{
if
((
_r
<
r
))
{
if
(
_data
)
delete
[]
_data
;
_r
=
r
;
_data
=
new
scalar
[
_r
];
return
true
;
}
return
false
;
}
inline
scalar
operator
()
(
int
i
)
const
{
return
_data
[
i
];
...
...
@@ -177,7 +192,7 @@ class fullMatrix
bool
resize
(
int
r
,
int
c
)
// data will be owned (same as constructor)
{
if
((
r
!=
_r
||
c
!=
_c
)
||
(
!
_own_data
))
if
((
r
*
c
>
_r
*
_c
)
||
(
!
_own_data
))
{
_r
=
r
;
_c
=
c
;
if
((
_own_data
)
&&
(
_data
))
delete
[]
_data
;
...
...
@@ -185,6 +200,10 @@ class fullMatrix
_own_data
=
true
;
return
true
;
}
else
{
_r
=
r
;
_c
=
c
;
}
return
false
;
// no reallocation
}
...
...
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