138{
139 bool doing_fraction = false;
140 int threshold = 0;
141
142 int nrows =
static_cast<int>(M->
n_rows());
143 int ncols =
static_cast<int>(M->
n_cols());
145
146 if (density != 1.0)
147 {
148 doing_fraction = true;
149 threshold = static_cast<int>(density * 10000);
150 }
151
152 if (special_type == 0)
153 {
154 for (int i = 0; i < ncols; i++)
155 for (int j = 0; j < nrows; j++)
156 {
157 if (doing_fraction)
158 {
160 if (u > threshold) continue;
161 }
164 }
165 }
166 else if (special_type == 1)
167 {
168 for (int i = 0; i < ncols; i++)
169 {
170 int top = (i >= nrows ? nrows : i);
171 for (int j = 0; j < top; j++)
172 {
173 if (doing_fraction)
174 {
176 if (u > threshold) continue;
177 }
180 }
181 }
182 }
183}
virtual size_t n_rows() const =0
virtual size_t n_cols() const =0
virtual const Ring * get_ring() const =0
virtual bool set_entry(size_t r, size_t c, const ring_elem a)=0
virtual bool is_zero(const ring_elem f) const =0
virtual ring_elem random() const
int32_t rawRandomInt(int32_t max)