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
f6b5250c
Commit
f6b5250c
authored
19 years ago
by
Mark Woolrich
Browse files
Options
Downloads
Patches
Plain Diff
*** empty log message ***
parent
fd078afb
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
sparse_matrix.cc
+24
-1
24 additions, 1 deletion
sparse_matrix.cc
sparse_matrix.h
+1
-0
1 addition, 0 deletions
sparse_matrix.h
with
25 additions
and
1 deletion
sparse_matrix.cc
+
24
−
1
View file @
f6b5250c
...
...
@@ -6,7 +6,6 @@
/* CCOPYRIGHT */
#include
<iostream>
#include
<iomanip>
#include
<strstream>
...
...
@@ -222,6 +221,30 @@ namespace MISCMATHS {
}
}
void
multiply
(
const
DiagonalMatrix
&
lm
,
const
SparseMatrix
&
rm
,
SparseMatrix
&
ret
)
{
Tracer_Plus
tr
(
"SparseMatrix::multiply"
);
int
nrows
=
lm
.
Nrows
();
int
ncols
=
rm
.
Ncols
();
if
(
lm
.
Ncols
()
!=
rm
.
Nrows
())
throw
Exception
(
"Rows and cols don't match in SparseMatrix::multiply"
);
ret
.
ReSize
(
nrows
,
ncols
);
for
(
int
j
=
1
;
j
<=
nrows
;
j
++
)
{
const
SparseMatrix
::
Row
&
row
=
rm
.
row
(
j
);
for
(
SparseMatrix
::
Row
::
const_iterator
it
=
row
.
begin
();
it
!=
row
.
end
();
it
++
)
{
int
c
=
(
*
it
).
first
+
1
;
double
val
=
(
*
it
).
second
;
ret
.
insert
(
j
,
c
,
val
*
lm
(
j
,
j
));
}
}
}
void
multiply
(
const
SparseMatrix
&
lm
,
const
SparseMatrix
::
Row
&
rm
,
ColumnVector
&
ret
)
{
Tracer_Plus
tr
(
"SparseMatrix::multiply3"
);
...
...
This diff is collapsed.
Click to expand it.
sparse_matrix.h
+
1
−
0
View file @
f6b5250c
...
...
@@ -128,6 +128,7 @@ namespace MISCMATHS {
};
void
multiply
(
const
SparseMatrix
&
lm
,
const
SparseMatrix
&
rm
,
SparseMatrix
&
ret
);
void
multiply
(
const
DiagonalMatrix
&
lm
,
const
SparseMatrix
&
rm
,
SparseMatrix
&
ret
);
void
multiply
(
const
SparseMatrix
&
lm
,
const
ColumnVector
&
rm
,
ColumnVector
&
ret
);
...
...
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