Skip to content

Commit 4e6eded

Browse files
committed
Suggest signed integer index type
1 parent 43d1d43 commit 4e6eded

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

source/pbat/math/linalg/mini/Matrix.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "pbat/common/ConstexprFor.h"
88

99
#include <array>
10+
#include <cstdint>
1011
#include <initializer_list>
1112
#include <string.h>
1213
#include <utility>
@@ -234,7 +235,7 @@ PBAT_HOST_DEVICE auto Unit(auto i)
234235
return Identity<TScalar, M, M>().Col(i);
235236
}
236237

237-
template <int M, int N, class TScalar, class IndexType>
238+
template <int M, int N, class TScalar, class IndexType = std::int64_t>
238239
PBAT_HOST_DEVICE auto FromFlatBuffer(TScalar* buf, IndexType bi)
239240
{
240241
return SMatrixView<TScalar, M, N>(buf + M * N * bi);
@@ -254,7 +255,7 @@ PBAT_HOST_DEVICE auto FromFlatBuffer(TScalar* buf, TIndexMatrix const& inds)
254255
return A;
255256
}
256257

257-
template <CMatrix TMatrix, class IndexType>
258+
template <CMatrix TMatrix, class IndexType = std::int64_t>
258259
PBAT_HOST_DEVICE void
259260
ToFlatBuffer(TMatrix const& A, typename TMatrix::ScalarType* buf, IndexType bi)
260261
{
@@ -289,7 +290,7 @@ ToFlatBuffer(TMatrix const& A, TIndexMatrix const& inds, typename TMatrix::Scala
289290
}
290291
}
291292

292-
template <int M, int N, class TScalar, class IndexType>
293+
template <int M, int N, class TScalar, class IndexType = std::int64_t>
293294
PBAT_HOST_DEVICE auto FromBuffers(std::array<TScalar*, M> buf, IndexType bi)
294295
{
295296
using ScalarType = std::remove_const_t<TScalar>;
@@ -314,7 +315,7 @@ PBAT_HOST_DEVICE auto FromBuffers(std::array<TScalar*, K> buf, TIndexMatrix cons
314315
return A;
315316
}
316317

317-
template <CMatrix TMatrix, int M, class IndexType>
318+
template <CMatrix TMatrix, int M, class IndexType = std::int64_t>
318319
PBAT_HOST_DEVICE void
319320
ToBuffers(TMatrix const& A, std::array<typename TMatrix::ScalarType*, M> buf, IndexType bi)
320321
{

0 commit comments

Comments
 (0)