comparison liboctave/boolNDArray.h @ 5602:dfa2da0563e5

[project @ 2006-01-31 03:43:40 by jwe]
author jwe
date Tue, 31 Jan 2006 03:43:41 +0000
parents 451ad352b288
children ace8d8d26933
comparison
equal deleted inserted replaced
5601:c8ed37d87923 5602:dfa2da0563e5
91 static bool resize_fill_value (void) { return false; } 91 static bool resize_fill_value (void) { return false; }
92 92
93 // bool all_elements_are_real (void) const; 93 // bool all_elements_are_real (void) const;
94 // bool all_integers (double& max_val, double& min_val) const; 94 // bool all_integers (double& max_val, double& min_val) const;
95 95
96 octave_idx_type nnz (void) const
97 {
98 octave_idx_type retval = 0;
99
100 const bool *d = this->data ();
101
102 octave_idx_type nel = this->numel ();
103
104 for (octave_idx_type i = 0; i < nel; i++)
105 {
106 if (d[i])
107 retval++;
108 }
109
110 return retval;
111 }
112
96 private: 113 private:
97 114
98 boolNDArray (bool *d, dim_vector& dv) : ArrayN<bool> (d, dv) { } 115 boolNDArray (bool *d, dim_vector& dv) : ArrayN<bool> (d, dv) { }
99 }; 116 };
100 117