G+Smo  25.01.0
Geometry + Simulation Modules
 
Loading...
Searching...
No Matches
gsALMHelper.h
1
14#pragma once
15
16#include <typeinfo>
17
18using namespace gismo;
19
20// Miscelaneous functions
22template <class T>
23index_t sign(T val)
24{
25 return (T(0) < val) - (val < T(0));
26}
27
29template <class T>
30index_t countNegatives(gsVector<T> vec)
31{
32 index_t count = 0;
33 index_t N = vec.cols();
34 index_t M = vec.rows();
35 for(index_t i = 0; i < M; i++)
36 for(index_t j = 0; j < N; j++)
37 {
38 if( vec(i,j) < 0 )
39 count += 1;
40 }
41 return count;
42}
A vector with arbitrary coefficient type and fixed or dynamic size.
Definition gsVector.h:37
#define index_t
Definition gsConfig.h:32
The G+Smo namespace, containing all definitions for the library.