@@ -96,11 +96,13 @@ Real SimpleCSRInternalLinearAlgebra::norm0(const CSRVector& vx ALIEN_UNUSED_PARA
96
96
97
97
/* ---------------------------------------------------------------------------*/
98
98
99
- Real SimpleCSRInternalLinearAlgebra::norm1 (const CSRVector& vx ALIEN_UNUSED_PARAM ) const
99
+ Real SimpleCSRInternalLinearAlgebra::norm1 (const CSRVector& vx) const
100
100
{
101
- // return CBLASMPIKernel::nrm1(x.space().structInfo(),vx);
102
- throw NotImplementedException (
103
- A_FUNCINFO, " SimpleCSRLinearAlgebra::norm1 not implemented" );
101
+ #ifdef ALIEN_USE_PERF_TIMER
102
+ SentryType s (m_timer, " CSR-NORM1" );
103
+ #endif
104
+
105
+ return CBLASMPIKernel::nrm1 (vx.distribution (), vx);
104
106
}
105
107
106
108
/* ---------------------------------------------------------------------------*/
@@ -290,6 +292,15 @@ Real SimpleCSRInternalLinearAlgebraExpr::norm2(const CSRVector& vx) const
290
292
291
293
/* ---------------------------------------------------------------------------*/
292
294
295
+ Real SimpleCSRInternalLinearAlgebraExpr::norm2 (const CSRMatrix& mx) const
296
+ {
297
+ #ifdef ALIEN_USE_PERF_TIMER
298
+ SentryType s (m_timer, " MATRIX-CSR-NORM2" );
299
+ #endif
300
+ return CBLASMPIKernel::matrix_nrm2 (mx.distribution (), mx);
301
+ }
302
+ /* ---------------------------------------------------------------------------*/
303
+
293
304
void SimpleCSRInternalLinearAlgebraExpr::mult (
294
305
const CSRMatrix& ma, const CSRVector& vx, CSRVector& vr) const
295
306
{
@@ -342,6 +353,32 @@ void SimpleCSRInternalLinearAlgebraExpr::copy(const CSRVector& vx, CSRVector& vr
342
353
CBLASMPIKernel::copy (vx.distribution (), vx, vr);
343
354
}
344
355
356
+ void SimpleCSRInternalLinearAlgebraExpr::copy (const CSRMatrix& ma, CSRMatrix& mr) const
357
+ {
358
+ #ifdef ALIEN_USE_PERF_TIMER
359
+ SentryType s (m_timer, " MATRIX-CSR-COPY" );
360
+ #endif
361
+ mr.copy (ma);
362
+ }
363
+
364
+ void SimpleCSRInternalLinearAlgebraExpr::add (const CSRMatrix& ma, CSRMatrix& mr) const
365
+ {
366
+ #ifdef ALIEN_USE_PERF_TIMER
367
+ SentryType s (m_timer, " MATRIX-CSR-ADD" );
368
+ #endif
369
+
370
+ cblas::axpy (mr.getProfile ().getNnz (), 1 , (CSRMatrix::ValueType*)ma.data (), 1 , mr.data (), 1 );
371
+ }
372
+
373
+ void SimpleCSRInternalLinearAlgebraExpr::scal (Real alpha, CSRMatrix& mr) const
374
+ {
375
+ #ifdef ALIEN_USE_PERF_TIMER
376
+ SentryType s (m_timer, " MATRIX-CSR-SCAL" );
377
+ #endif
378
+
379
+ cblas::scal (mr.getProfile ().getNnz (), alpha, mr.data (), 1 );
380
+ }
381
+
345
382
/* ---------------------------------------------------------------------------*/
346
383
347
384
Real SimpleCSRInternalLinearAlgebraExpr::dot (
0 commit comments