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
6ca6f3d2
There was an error fetching the commit references. Please try again later.
Commit
6ca6f3d2
authored
5 years ago
by
Tomáš Oberhuber
Browse files
Options
Downloads
Patches
Plain Diff
Writing documentation for dense matrix.
parent
5fede9ab
No related branches found
No related tags found
1 merge request
!58
To/matrices
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/TNL/Matrices/DenseMatrix.h
+82
-15
82 additions, 15 deletions
src/TNL/Matrices/DenseMatrix.h
with
82 additions
and
15 deletions
src/TNL/Matrices/DenseMatrix.h
+
82
−
15
View file @
6ca6f3d2
...
...
@@ -20,9 +20,19 @@
namespace
TNL
{
namespace
Matrices
{
template
<
typename
Device
>
class
DenseDeviceDependentCode
;
//template< typename Device >
//class DenseDeviceDependentCode;
/**
* \brief Implementation of dense matrix, i.e. matrix storing explicitly all of its elements including zeros.
*
* \tparam Real is a type of matrix elements.
* \tparam Device is a device where the matrix is allocated.
* \tparam Index is a type for indexing of the matrix elements.
* \tparam RowMajorOrder tells the ordering of matrix elements. If it is \e true the matrix elements
* are stored in row major order. If it is \e false, the matrix elements are stored in column major order.
* \tparam RealAllocator is allocator for the matrix elements.
*/
template
<
typename
Real
=
double
,
typename
Device
=
Devices
::
Host
,
typename
Index
=
int
,
...
...
@@ -30,33 +40,90 @@ template< typename Real = double,
typename
RealAllocator
=
typename
Allocators
::
Default
<
Device
>::
template
Allocator
<
Real
>
>
class
DenseMatrix
:
public
Matrix
<
Real
,
Device
,
Index
>
{
protected:
using
BaseType
=
Matrix
<
Real
,
Device
,
Index
,
RealAllocator
>
;
using
ValuesVectorType
=
typename
BaseType
::
ValuesVectorType
;
using
ValuesViewType
=
typename
ValuesVectorType
::
ViewType
;
using
SegmentsType
=
Containers
::
Segments
::
Ellpack
<
Device
,
Index
,
typename
Allocators
::
Default
<
Device
>::
template
Allocator
<
Index
>,
RowMajorOrder
,
1
>
;
using
SegmentViewType
=
typename
SegmentsType
::
SegmentViewType
;
public:
/**
* \brief The type of matrix elements.
*/
using
RealType
=
Real
;
/**
* \brief The device where the matrix is allocated.
*/
using
DeviceType
=
Device
;
/**
* \brief The type used for matrix elements indexing.
*/
using
IndexType
=
Index
;
/**
* \brief The allocator for matrix elements.
*/
using
RealAllocatorType
=
RealAllocator
;
using
BaseType
=
Matrix
<
Real
,
Device
,
Index
,
RealAllocator
>
;
using
ValuesVectorType
=
typename
BaseType
::
ValuesVectorType
;
using
ValuesViewType
=
typename
ValuesVectorType
::
ViewType
;
using
SegmentsType
=
Containers
::
Segments
::
Ellpack
<
DeviceType
,
IndexType
,
typename
Allocators
::
Default
<
Device
>::
template
Allocator
<
IndexType
>,
RowMajorOrder
,
1
>
;
using
SegmentViewType
=
typename
SegmentsType
::
SegmentViewType
;
/**
* \brief Type of related matrix view.
*
* See \ref DenseMatrixView.
*/
using
ViewType
=
DenseMatrixView
<
Real
,
Device
,
Index
,
RowMajorOrder
>
;
/**
* \brief Matrix view type for constant instances.
*
* See \ref DenseMatrixView.
*/
using
ConstViewType
=
DenseMatrixView
<
typename
std
::
add_const
<
Real
>::
type
,
Device
,
Index
,
RowMajorOrder
>
;
/**
* \brief Type for accessing matrix row.
*/
using
RowView
=
DenseMatrixRowView
<
SegmentViewType
,
ValuesViewType
>
;
/**
* \brief Helper type for getting self type or its variations.
*/
template
<
typename
_Real
=
Real
,
typename
_Device
=
Device
,
typename
_Index
=
Index
,
bool
RowMajorOrder_
=
RowMajorOrder
,
typename
RealAllocator_
=
RealAllocator
>
using
Self
=
DenseMatrix
<
_Real
,
_Device
,
_Index
,
RowMajorOrder_
,
RealAllocator_
>
;
// TODO: remove this
using
CompressedRowLengthsVector
=
typename
Matrix
<
Real
,
Device
,
Index
>::
CompressedRowLengthsVector
;
using
ConstCompressedRowLengthsVectorView
=
typename
Matrix
<
Real
Type
,
Device
Type
,
Index
Type
>::
ConstCompressedRowLengthsVectorView
;
using
ConstCompressedRowLengthsVectorView
=
typename
Matrix
<
Real
,
Device
,
Index
>::
ConstCompressedRowLengthsVectorView
;
template
<
typename
_Real
=
Real
,
typename
_Device
=
Device
,
typename
_Index
=
Index
>
using
Self
=
DenseMatrix
<
_Real
,
_Device
,
_Index
>
;
/**
* \brief Constrictor without parameters.
*/
DenseMatrix
();
/**
* \brief Constructor with matrix dimensions.
*
* \param rows is number of matrix rows.
* \param columns is number of matrix columns.
*/
DenseMatrix
(
const
IndexType
rows
,
const
IndexType
columns
);
/**
* \brief Constructor with initializer list.
*
* \param data is a initializer list of initializer lists. The inner
* initializer list represents matrix rows.
*/
DenseMatrix
(
std
::
initializer_list
<
std
::
initializer_list
<
RealType
>
>
data
);
ViewType
getView
();
...
...
@@ -226,8 +293,8 @@ class DenseMatrix : public Matrix< Real, Device, Index >
IndexType
getElementIndex
(
const
IndexType
row
,
const
IndexType
column
)
const
;
typedef
DenseDeviceDependentCode
<
DeviceType
>
DeviceDependentCode
;
friend
class
DenseDeviceDependentCode
<
DeviceType
>
;
//
typedef DenseDeviceDependentCode< DeviceType > DeviceDependentCode;
//
friend class DenseDeviceDependentCode< DeviceType >;
SegmentsType
segments
;
...
...
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