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
4e60e974
Commit
4e60e974
authored
15 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
pp
parent
a4e96a8e
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Numeric/fullMatrix.h
+10
-15
10 additions, 15 deletions
Numeric/fullMatrix.h
with
10 additions
and
15 deletions
Numeric/fullMatrix.h
+
10
−
15
View file @
4e60e974
...
@@ -54,14 +54,13 @@ class fullVector
...
@@ -54,14 +54,13 @@ 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
scalar
operator
*
(
const
fullVector
<
scalar
>
&
other
)
inline
scalar
operator
*
(
const
fullVector
<
scalar
>
&
other
)
{
{
scalar
s
=
0.
0
;
scalar
s
=
0.
;
for
(
int
i
=
0
;
i
<
_r
;
++
i
)
s
+=
_data
[
i
]
*
other
.
_data
[
i
];
for
(
int
i
=
0
;
i
<
_r
;
++
i
)
s
+=
_data
[
i
]
*
other
.
_data
[
i
];
return
s
;
return
s
;
}
}
void
print
(
const
char
*
name
=
""
)
const
void
print
(
const
char
*
name
=
""
)
const
{
{
printf
(
"Printing vector %s:
\n
"
,
name
);
printf
(
"Printing vector %s:
\n
"
,
name
);
printf
(
" "
);
printf
(
" "
);
...
@@ -87,7 +86,7 @@ class fullMatrix
...
@@ -87,7 +86,7 @@ class fullMatrix
fullMatrix
(
const
fullMatrix
<
scalar
>
&
other
)
:
_r
(
other
.
_r
),
_c
(
other
.
_c
)
fullMatrix
(
const
fullMatrix
<
scalar
>
&
other
)
:
_r
(
other
.
_r
),
_c
(
other
.
_c
)
{
{
_data
=
new
scalar
[
_r
*
_c
];
_data
=
new
scalar
[
_r
*
_c
];
gM_memcpy
(
other
)
;
for
(
int
i
=
0
;
i
<
_r
*
_c
;
++
i
)
_data
[
i
]
=
other
.
_data
[
i
]
;
}
}
fullMatrix
()
:
_r
(
0
),
_c
(
0
),
_data
(
0
)
{}
fullMatrix
()
:
_r
(
0
),
_c
(
0
),
_data
(
0
)
{}
~
fullMatrix
()
{
if
(
_data
)
delete
[]
_data
;
}
~
fullMatrix
()
{
if
(
_data
)
delete
[]
_data
;
}
...
@@ -99,14 +98,10 @@ class fullMatrix
...
@@ -99,14 +98,10 @@ class fullMatrix
_r
=
other
.
_r
;
_r
=
other
.
_r
;
_c
=
other
.
_c
;
_c
=
other
.
_c
;
_data
=
new
scalar
[
_r
*
_c
];
_data
=
new
scalar
[
_r
*
_c
];
gM_memcpy
(
other
)
;
for
(
int
i
=
0
;
i
<
_r
*
_c
;
++
i
)
_data
[
i
]
=
other
.
_data
[
i
]
;
}
}
return
*
this
;
return
*
this
;
}
}
void
gM_memcpy
(
const
fullMatrix
<
scalar
>
&
other
)
{
for
(
int
i
=
0
;
i
<
_r
*
_c
;
++
i
)
_data
[
i
]
=
other
.
_data
[
i
];
}
inline
scalar
operator
()
(
int
i
,
int
j
)
const
inline
scalar
operator
()
(
int
i
,
int
j
)
const
{
{
return
_data
[
i
+
_r
*
j
];
return
_data
[
i
+
_r
*
j
];
...
@@ -186,8 +181,8 @@ class fullMatrix
...
@@ -186,8 +181,8 @@ class fullMatrix
}
}
inline
void
transposeInPlace
()
inline
void
transposeInPlace
()
{
{
if
(
size1
()
!=
size2
()
)
{
if
(
size1
()
!=
size2
()
)
{
Msg
::
Error
(
"Not a square matrix (size1: %d, size2: %d)"
,
size1
(),
size2
());
Msg
::
Error
(
"Not a square matrix (size1: %d, size2: %d)"
,
size1
(),
size2
());
}
}
scalar
t
;
scalar
t
;
for
(
int
i
=
0
;
i
<
size1
();
i
++
)
for
(
int
i
=
0
;
i
<
size1
();
i
++
)
...
@@ -262,9 +257,9 @@ class fullMatrix
...
@@ -262,9 +257,9 @@ class fullMatrix
}
}
#endif
#endif
;
;
void
print
(
const
char
*
name
=
""
)
const
void
print
(
const
char
*
name
=
""
)
const
{
{
printf
(
"Printing matrix %s:
\n
"
,
name
);
printf
(
"Printing matrix %s:
\n
"
,
name
);
int
ni
=
size1
();
int
ni
=
size1
();
int
nj
=
size2
();
int
nj
=
size2
();
for
(
int
I
=
0
;
I
<
ni
;
I
++
){
for
(
int
I
=
0
;
I
<
ni
;
I
++
){
...
...
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