Skip to content
Snippets Groups Projects
Commit a9b95034 authored by Lukáš Matthew Čejka's avatar Lukáš Matthew Čejka Committed by Tomáš Oberhuber
Browse files

Tried using std::vector to avoid having to implement DeviceType into...

Tried using std::vector to avoid having to implement DeviceType into SparseRow. Commiting for backup purposes.
parent e0b5dfaf
No related branches found
No related tags found
1 merge request!16Matrices
......@@ -13,6 +13,10 @@
#include <TNL/Matrices/SparseRow.h>
#include <TNL/ParallelFor.h>
// Following includes are here to enable usage of std::vector and std::cout. To avoid having to include Device type (HOW would this be done anyway)
#include <iostream>
#include <vector>
namespace TNL {
namespace Matrices {
......@@ -115,6 +119,7 @@ SparseRow< Real, Index >::
getNonZeroElementsCount() const
{
using NonConstIndex = typename std::remove_const< Index >::type;
// using DeviceType = typename TNL::Matrices::Matrix::DeviceType;
NonConstIndex elementCount ( 0 );
......@@ -126,9 +131,14 @@ getNonZeroElementsCount() const
// ParallelFor< Device >::exec( ( NonConstIndex ) 0, length, computeNonzeros );
// The ParallelFor::exec() function needs a < DeviceType >, how to get this into SparseRow?
/*
*/
// std::vector< Real > vls = values; // Size of values should be something like: (sizeof(this->values)/sizeof(*this->values)) from https://stackoverflow.com/questions/4108313/how-do-i-find-the-length-of-an-array
for( NonConstIndex i = 0; i < length; i++ )
if( getElementValue( i ) != 0 ) // This returns the same amount of elements in a row as does getRowLength(). WHY?
for( NonConstIndex i = 0; i < length; i++ ) // this->values doesn't have anything similar to getSize().
if( this->values[ i * step ] != 0.0 ) // This returns the same amount of elements in a row as does getRowLength(). WHY?
elementCount++;
return elementCount;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment