Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tnl-dev
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor 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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
TNL
tnl-dev
Commits
40db8e95
There was an error fetching the commit references. Please try again later.
Commit
40db8e95
authored
5 years ago
by
Tomáš Oberhuber
Committed by
Tomáš Oberhuber
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Implementing SparseMatrix::getNumberOfNonzeroMatrixElements.
parent
2ee53835
No related branches found
No related tags found
1 merge request
!48
Segments
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/TNL/Matrices/SparseMatrix.h
+1
-1
1 addition, 1 deletion
src/TNL/Matrices/SparseMatrix.h
src/TNL/Matrices/SparseMatrix.hpp
+8
-0
8 additions, 0 deletions
src/TNL/Matrices/SparseMatrix.hpp
with
9 additions
and
1 deletion
src/TNL/Matrices/SparseMatrix.h
+
1
−
1
View file @
40db8e95
...
@@ -17,7 +17,7 @@ namespace TNL {
...
@@ -17,7 +17,7 @@ namespace TNL {
namespace
Matrices
{
namespace
Matrices
{
template
<
typename
Real
,
template
<
typename
Real
,
template
<
typename
,
typename
>
class
Segments
,
template
<
typename
Device_
,
typename
Index_
>
class
Segments
,
typename
Device
=
Devices
::
Host
,
typename
Device
=
Devices
::
Host
,
typename
Index
=
int
,
typename
Index
=
int
,
typename
RealAllocator
=
typename
Allocators
::
Default
<
Device
>
::
template
Allocator
<
Real
>,
typename
RealAllocator
=
typename
Allocators
::
Default
<
Device
>
::
template
Allocator
<
Real
>,
...
...
This diff is collapsed.
Click to expand it.
src/TNL/Matrices/SparseMatrix.hpp
+
8
−
0
View file @
40db8e95
...
@@ -10,7 +10,9 @@
...
@@ -10,7 +10,9 @@
#pragma once
#pragma once
#include
<functional>
#include
<TNL/Matrices/SparseMatrix.h>
#include
<TNL/Matrices/SparseMatrix.h>
#include
<TNL/Algorithms/Reduction.h>
namespace
TNL
{
namespace
TNL
{
namespace
Matrices
{
namespace
Matrices
{
...
@@ -192,6 +194,12 @@ Index
...
@@ -192,6 +194,12 @@ Index
SparseMatrix
<
Real
,
Segments
,
Device
,
Index
,
RealAllocator
,
IndexAllocator
>::
SparseMatrix
<
Real
,
Segments
,
Device
,
Index
,
RealAllocator
,
IndexAllocator
>::
getNumberOfNonzeroMatrixElements
()
const
getNumberOfNonzeroMatrixElements
()
const
{
{
const
auto
columns_view
=
this
->
columnIndexes
.
getConstView
();
const
IndexType
paddingIndex
=
this
->
getPaddingIndex
();
auto
fetch
=
[
=
]
__cuda_callable__
(
const
IndexType
i
)
->
IndexType
{
return
(
columns_view
[
i
]
!=
paddingIndex
);
};
return
Algorithms
::
Reduction
<
DeviceType
>::
reduce
(
this
->
columnIndexes
.
getSize
(),
std
::
plus
<>
{},
fetch
,
0
);
}
}
template
<
typename
Real
,
template
<
typename
Real
,
...
...
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