tatami
C++ API for different matrix representations
Loading...
Searching...
No Matches
substitute_helpers.hpp
Go to the documentation of this file.
1#ifndef TATAMI_ISOMETRIC_UNARY_SUBSTITUTE_HELPERS_H
2#define TATAMI_ISOMETRIC_UNARY_SUBSTITUTE_HELPERS_H
3
7
8#include <vector>
9#include <limits>
10
17namespace tatami {
18
22template<CompareOperation op_, typename InputValue_, typename Scalar_, typename OutputValue_>
23bool delayed_substitute_is_sparse(Scalar_ compared, OutputValue_ substitute) {
24 return !delayed_compare<op_, InputValue_>(0, compared) || substitute == 0;
25}
26
27template<CompareOperation op_, typename InputValue_, typename Scalar_, typename OutputValue_>
28OutputValue_ delayed_substitute_run(InputValue_ val, Scalar_ compared, OutputValue_ substitute) {
29 if (delayed_compare<op_>(val, compared)) {
30 return substitute;
31 } else {
32 return val;
33 }
34}
35
36template<CompareOperation op_, typename InputValue_, typename Index_, typename Scalar_, typename OutputValue_>
37void delayed_substitute_run_simple(const InputValue_* input, Index_ length, Scalar_ compared, OutputValue_* output, OutputValue_ substitute) {
38 if constexpr(std::is_same<InputValue_, OutputValue_>::value) {
39 input = output; // basically an assertion to the compiler to skip aliasing protection.
40 }
41 for (Index_ i = 0; i < length; ++i) {
42 output[i] = delayed_substitute_run<op_>(input[i], compared, substitute);
43 }
44}
61template<CompareOperation op_, typename OutputValue_, typename InputValue_, typename Index_, typename Scalar_>
62class DelayedUnaryIsometricSubstituteScalarHelper final : public DelayedUnaryIsometricOperationHelper<OutputValue_, InputValue_, Index_> {
63public:
69 DelayedUnaryIsometricSubstituteScalarHelper(Scalar_ compared, OutputValue_ substitute) : my_compared(compared), my_substitute(substitute) {
70 my_sparse = delayed_substitute_is_sparse<op_, InputValue_>(my_compared, my_substitute);
71 }
72
73private:
74 Scalar_ my_compared;
75 OutputValue_ my_substitute;
76 bool my_sparse;
77
78public:
79 std::optional<Index_> nrow() const {
80 return std::nullopt;
81 }
82
83 std::optional<Index_> ncol() const {
84 return std::nullopt;
85 }
86
87public:
88 bool zero_depends_on_row() const {
89 return false;
90 }
91
93 return false;
94 }
95
97 return false;
98 }
99
101 return false;
102 }
103
104public:
105 void dense(bool, Index_, Index_, Index_ length, const InputValue_* input, OutputValue_* output) const {
106 delayed_substitute_run_simple<op_>(input, length, my_compared, output, my_substitute);
107 }
108
109 void dense(bool, Index_, const std::vector<Index_>& indices, const InputValue_* input, OutputValue_* output) const {
110 delayed_substitute_run_simple<op_>(input, static_cast<Index_>(indices.size()), my_compared, output, my_substitute);
111 }
112
113public:
114 bool is_sparse() const {
115 return my_sparse;
116 }
117
118 void sparse(bool, Index_, Index_ number, const InputValue_* input_value, const Index_*, OutputValue_* output_value) const {
119 delayed_substitute_run_simple<op_>(input_value, number, my_compared, output_value, my_substitute);
120 }
121
122 OutputValue_ fill(bool, Index_) const {
123 if (my_sparse) {
124 return 0;
125 } else {
126 return my_substitute;
127 }
128 }
129};
130
139template<typename OutputValue_, typename InputValue_, typename Index_, typename Scalar_>
141
150template<typename OutputValue_, typename InputValue_, typename Index_, typename Scalar_>
152
161template<typename OutputValue_, typename InputValue_, typename Index_, typename Scalar_>
163
172template<typename OutputValue_, typename InputValue_, typename Index_, typename Scalar_>
174
183template<typename OutputValue_, typename InputValue_, typename Index_, typename Scalar_>
185
194template<typename OutputValue_, typename InputValue_, typename Index_, typename Scalar_>
196
205template<typename OutputValue_, typename InputValue_, typename Index_, typename Scalar_>
207
211// Back-compatibility only.
212template<typename OutputValue_ = double, typename InputValue_ = double, typename Index_ = int, typename Scalar_>
213std::shared_ptr<DelayedUnaryIsometricOperationHelper<OutputValue_, InputValue_, Index_> > make_DelayedUnaryIsometricSubstituteEqualScalar(Scalar_ compared, OutputValue_ substitute) {
214 return std::make_shared<DelayedUnaryIsometricSubstituteEqualScalarHelper<OutputValue_, InputValue_, Index_, Scalar_> >(compared, substitute);
215}
216
217template<typename OutputValue_ = double, typename InputValue_ = double, typename Index_ = int, typename Scalar_>
218std::shared_ptr<DelayedUnaryIsometricOperationHelper<OutputValue_, InputValue_, Index_> > make_DelayedUnaryIsometricSubstituteGreaterThanScalar(Scalar_ compared, OutputValue_ substitute) {
219 return std::make_shared<DelayedUnaryIsometricSubstituteGreaterThanScalarHelper<OutputValue_, InputValue_, Index_, Scalar_> >(compared, substitute);
220}
221
222template<typename OutputValue_ = double, typename InputValue_ = double, typename Index_ = int, typename Scalar_>
223std::shared_ptr<DelayedUnaryIsometricOperationHelper<OutputValue_, InputValue_, Index_> > make_DelayedUnaryIsometricSubstituteLessThanScalar(Scalar_ compared, OutputValue_ substitute) {
224 return std::make_shared<DelayedUnaryIsometricSubstituteLessThanScalarHelper<OutputValue_, InputValue_, Index_, Scalar_> >(compared, substitute);
225}
226
227template<typename OutputValue_ = double, typename InputValue_ = double, typename Index_ = int, typename Scalar_>
228std::shared_ptr<DelayedUnaryIsometricOperationHelper<OutputValue_, InputValue_, Index_> > make_DelayedUnaryIsometricSubstituteGreaterThanOrEqualScalar(Scalar_ compared, OutputValue_ substitute) {
229 return std::make_shared<DelayedUnaryIsometricSubstituteGreaterThanOrEqualScalarHelper<OutputValue_, InputValue_, Index_, Scalar_> >(compared, substitute);
230}
231
232template<typename OutputValue_ = double, typename InputValue_ = double, typename Index_ = int, typename Scalar_>
233std::shared_ptr<DelayedUnaryIsometricOperationHelper<OutputValue_, InputValue_, Index_> > make_DelayedUnaryIsometricSubstituteLessThanOrEqualScalar(Scalar_ compared, OutputValue_ substitute) {
234 return std::make_shared<DelayedUnaryIsometricSubstituteLessThanOrEqualScalarHelper<OutputValue_, InputValue_, Index_, Scalar_> >(compared, substitute);
235}
236
237template<typename OutputValue_ = double, typename InputValue_ = double, typename Index_ = int, typename Scalar_>
238std::shared_ptr<DelayedUnaryIsometricOperationHelper<OutputValue_, InputValue_, Index_> > make_DelayedUnaryIsometricSubstituteNotEqualScalar(Scalar_ compared, OutputValue_ substitute) {
239 return std::make_shared<DelayedUnaryIsometricSubstituteNotEqualScalarHelper<OutputValue_, InputValue_, Index_, Scalar_> >(compared, substitute);
240}
261template<CompareOperation op_, typename OutputValue_, typename InputValue_, typename Index_, typename ComparedVector_, typename SubstituteVector_>
262class DelayedUnaryIsometricSubstituteVectorHelper final : public DelayedUnaryIsometricOperationHelper<OutputValue_, InputValue_, Index_> {
263public:
274 DelayedUnaryIsometricSubstituteVectorHelper(ComparedVector_ compared, SubstituteVector_ substitute, bool by_row) :
275 my_compared(std::move(compared)),
276 my_substitute(std::move(substitute)),
277 my_by_row(by_row)
278 {
279 auto ncompared = my_compared.size();
280 if (!safe_non_negative_equal(ncompared, my_substitute.size())) {
281 throw std::runtime_error("'compared' and 'substitute' should have the same length");
282 }
283 for (decltype(ncompared) i = 0; i < ncompared; ++i) {
284 if (!delayed_substitute_is_sparse<op_, InputValue_>(my_compared[i], my_substitute[i])) {
285 my_sparse = false;
286 break;
287 }
288 }
289 }
290
291private:
292 ComparedVector_ my_compared;
293 SubstituteVector_ my_substitute;
294 bool my_by_row;
295 bool my_sparse = true;
296
297public:
298 std::optional<Index_> nrow() const {
299 if (my_by_row) {
300 return my_compared.size();
301 } else {
302 return std::nullopt;
303 }
304 }
305
306 std::optional<Index_> ncol() const {
307 if (my_by_row) {
308 return std::nullopt;
309 } else {
310 return my_compared.size();
311 }
312 }
313
314public:
315 bool zero_depends_on_row() const {
316 return my_by_row;
317 }
318
320 return !my_by_row;
321 }
322
324 return my_by_row;
325 }
326
328 return !my_by_row;
329 }
330
331public:
332 void dense(bool row, Index_ idx, Index_ start, Index_ length, const InputValue_* input, OutputValue_* output) const {
333 if (row == my_by_row) {
334 delayed_substitute_run_simple<op_>(input, length, my_compared[idx], output, my_substitute[idx]);
335 } else {
336 if constexpr(std::is_same<InputValue_, OutputValue_>::value) {
337 input = output; // basically an assertion to the compiler to skip aliasing protection.
338 }
339 for (Index_ i = 0; i < length; ++i) {
340 Index_ is = i + start;
341 output[i] = delayed_substitute_run<op_>(input[i], my_compared[is], my_substitute[is]);
342 }
343 }
344 }
345
346 void dense(bool row, Index_ idx, const std::vector<Index_>& indices, const InputValue_* input, OutputValue_* output) const {
347 if (row == my_by_row) {
348 delayed_substitute_run_simple<op_>(input, static_cast<Index_>(indices.size()), my_compared[idx], output, my_substitute[idx]);
349 } else {
350 if constexpr(std::is_same<InputValue_, OutputValue_>::value) {
351 input = output; // basically an assertion to the compiler to skip aliasing protection.
352 }
353 Index_ length = indices.size();
354 for (Index_ i = 0; i < length; ++i) {
355 auto ii = indices[i];
356 output[i] = delayed_substitute_run<op_>(input[i], my_compared[ii], my_substitute[ii]);
357 }
358 }
359 }
360
361public:
362 bool is_sparse() const {
363 return my_sparse;
364 }
365
366 void sparse(bool row, Index_ idx, Index_ number, const InputValue_* input_value, const Index_* indices, OutputValue_* output_value) const {
367 if (row == my_by_row) {
368 delayed_substitute_run_simple<op_>(input_value, number, my_compared[idx], output_value, my_substitute[idx]);
369 } else {
370 if constexpr(std::is_same<InputValue_, OutputValue_>::value) {
371 input_value = output_value; // basically an assertion to the compiler to skip aliasing protection.
372 }
373 for (Index_ i = 0; i < number; ++i) {
374 auto ii = indices[i];
375 output_value[i] = delayed_substitute_run<op_>(input_value[i], my_compared[ii], my_substitute[ii]);
376 }
377 }
378 }
379
380 OutputValue_ fill(bool row, Index_ idx) const {
381 if (row == my_by_row) {
382 auto sub = my_substitute[idx];
383 if (!delayed_compare<op_, InputValue_>(0, my_compared[idx])) {
384 return 0;
385 } else {
386 return sub;
387 }
388 } else {
389 // We should only get to this point if it's sparse, otherwise no
390 // single fill value would work across the length of my_compared.
391 return 0;
392 }
393 }
394};
395
405template<typename OutputValue_, typename InputValue_, typename Index_, typename ComparedVector_, typename SubstituteVector_>
407
417template<typename OutputValue_, typename InputValue_, typename Index_, typename ComparedVector_, typename SubstituteVector_>
419
429template<typename OutputValue_, typename InputValue_, typename Index_, typename ComparedVector_, typename SubstituteVector_>
431
441template<typename OutputValue_, typename InputValue_, typename Index_, typename ComparedVector_, typename SubstituteVector_>
443
453template<typename OutputValue_, typename InputValue_, typename Index_, typename ComparedVector_, typename SubstituteVector_>
455
465template<typename OutputValue_, typename InputValue_, typename Index_, typename ComparedVector_, typename SubstituteVector_>
467
477template<typename OutputValue_, typename InputValue_, typename Index_, typename ComparedVector_, typename SubstituteVector_>
479
483// Back-compatibility only.
484template<typename OutputValue_ = double, typename InputValue_ = double, typename Index_ = int, typename ComparedVector_, typename SubstituteVector_>
485std::shared_ptr<DelayedUnaryIsometricOperationHelper<OutputValue_, InputValue_, Index_> > make_DelayedUnaryIsometricSubstituteEqualVector(ComparedVector_ compared, SubstituteVector_ substitute, bool by_row) {
486 return std::make_shared<DelayedUnaryIsometricSubstituteEqualVectorHelper<OutputValue_, InputValue_, Index_, ComparedVector_, SubstituteVector_> >(std::move(compared), std::move(substitute), by_row);
487}
488
489template<typename OutputValue_ = double, typename InputValue_ = double, typename Index_ = int, typename ComparedVector_, typename SubstituteVector_>
490std::shared_ptr<DelayedUnaryIsometricOperationHelper<OutputValue_, InputValue_, Index_> > make_DelayedUnaryIsometricSubstituteGreaterThanVector(ComparedVector_ compared, SubstituteVector_ substitute, bool by_row) {
491 return std::make_shared<DelayedUnaryIsometricSubstituteGreaterThanVectorHelper<OutputValue_, InputValue_, Index_, ComparedVector_, SubstituteVector_> >(std::move(compared), std::move(substitute), by_row);
492}
493
494template<typename OutputValue_ = double, typename InputValue_ = double, typename Index_ = int, typename ComparedVector_, typename SubstituteVector_>
495std::shared_ptr<DelayedUnaryIsometricOperationHelper<OutputValue_, InputValue_, Index_> > make_DelayedUnaryIsometricSubstituteLessThanVector(ComparedVector_ compared, SubstituteVector_ substitute, bool by_row) {
496 return std::make_shared<DelayedUnaryIsometricSubstituteLessThanVectorHelper<OutputValue_, InputValue_, Index_, ComparedVector_, SubstituteVector_> >(std::move(compared), std::move(substitute), by_row);
497}
498
499template<typename OutputValue_ = double, typename InputValue_ = double, typename Index_ = int, typename ComparedVector_, typename SubstituteVector_>
500std::shared_ptr<DelayedUnaryIsometricOperationHelper<OutputValue_, InputValue_, Index_> > make_DelayedUnaryIsometricSubstituteGreaterThanOrEqualVector(ComparedVector_ compared, SubstituteVector_ substitute, bool by_row) {
501 return std::make_shared<DelayedUnaryIsometricSubstituteGreaterThanOrEqualVectorHelper<OutputValue_, InputValue_, Index_, ComparedVector_, SubstituteVector_> >(std::move(compared), std::move(substitute), by_row);
502}
503
504template<typename OutputValue_ = double, typename InputValue_ = double, typename Index_ = int, typename ComparedVector_, typename SubstituteVector_>
505std::shared_ptr<DelayedUnaryIsometricOperationHelper<OutputValue_, InputValue_, Index_> > make_DelayedUnaryIsometricLessSubstituteThanOrEqualVector(ComparedVector_ compared, SubstituteVector_ substitute, bool by_row) {
506 return std::make_shared<DelayedUnaryIsometricSubstituteLessThanOrEqualVectorHelper<OutputValue_, InputValue_, Index_, ComparedVector_, SubstituteVector_> >(std::move(compared), std::move(substitute), by_row);
507}
508
509template<typename OutputValue_ = double, typename InputValue_ = double, typename Index_ = int, typename ComparedVector_, typename SubstituteVector_>
510std::shared_ptr<DelayedUnaryIsometricOperationHelper<OutputValue_, InputValue_, Index_> > make_DelayedUnaryIsometricSubstituteNotEqualVector(ComparedVector_ compared, SubstituteVector_ substitute, bool by_row) {
511 return std::make_shared<DelayedUnaryIsometricSubstituteNotEqualVectorHelper<OutputValue_, InputValue_, Index_, ComparedVector_, SubstituteVector_> >(std::move(compared), std::move(substitute), by_row);
512}
520template<SpecialCompareOperation op_, bool pass_, typename InputValue_, typename OutputValue_>
521bool delayed_special_substitute_is_sparse(OutputValue_ substitute) {
522 return !delayed_special_compare<op_, pass_, InputValue_>(0) || substitute == 0;
523}
524
525template<SpecialCompareOperation op_, bool pass_, typename InputValue_, typename OutputValue_>
526OutputValue_ delayed_special_substitute_run(InputValue_ val, OutputValue_ substitute) {
527 if (delayed_special_compare<op_, pass_>(val)) {
528 return substitute;
529 } else {
530 return val;
531 }
532}
533
534template<SpecialCompareOperation op_, bool pass_, typename InputValue_, typename Index_, typename OutputValue_>
535void delayed_special_substitute_run_simple(const InputValue_* input, Index_ length, OutputValue_ substitute, OutputValue_* output) {
536 if constexpr(std::is_same<InputValue_, OutputValue_>::value) {
537 input = output; // basically an assertion to the compiler to skip aliasing protection.
538 }
539 for (Index_ i = 0; i < length; ++i) {
540 output[i] = delayed_special_substitute_run<op_, pass_>(input[i], substitute);
541 }
542}
560template<SpecialCompareOperation op_, bool pass_, typename OutputValue_, typename InputValue_, typename Index_>
561class DelayedUnaryIsometricSpecialSubstituteHelper final : public DelayedUnaryIsometricOperationHelper<OutputValue_, InputValue_, Index_> {
562public:
566 DelayedUnaryIsometricSpecialSubstituteHelper(OutputValue_ substitute) : my_substitute(substitute) {
567 my_sparse = delayed_special_substitute_is_sparse<op_, pass_, InputValue_>(my_substitute);
568 }
569
570private:
571 OutputValue_ my_substitute;
572 bool my_sparse;
573
574public:
575 std::optional<Index_> nrow() const {
576 return std::nullopt;
577 }
578
579 std::optional<Index_> ncol() const {
580 return std::nullopt;
581 }
582
583public:
584 bool zero_depends_on_row() const {
585 return false;
586 }
587
589 return false;
590 }
591
593 return false;
594 }
595
597 return false;
598 }
599
600public:
601 void dense(bool, Index_, Index_, Index_ length, const InputValue_* input, OutputValue_* output) const {
602 delayed_special_substitute_run_simple<op_, pass_>(input, length, my_substitute, output);
603 }
604
605 void dense(bool, Index_, const std::vector<Index_>& indices, const InputValue_* input, OutputValue_* output) const {
606 delayed_special_substitute_run_simple<op_, pass_>(input, static_cast<Index_>(indices.size()), my_substitute, output);
607 }
608
609public:
610 bool is_sparse() const {
611 return my_sparse;
612 }
613
614 void sparse(bool, Index_, Index_ number, const InputValue_* input_value, const Index_*, OutputValue_* output_value) const {
615 delayed_special_substitute_run_simple<op_, pass_>(input_value, number, my_substitute, output_value);
616 }
617
618 OutputValue_ fill(bool, Index_) const {
619 if (my_sparse) {
620 return 0;
621 } else {
622 return my_substitute;
623 }
624 }
625};
626
635template<bool pass_, typename OutputValue_, typename InputValue_, typename Index_>
637
646template<bool pass_, typename OutputValue_, typename InputValue_, typename Index_>
648
657template<bool pass_, typename OutputValue_, typename InputValue_, typename Index_>
659
663// Back-compatibility only.
664template<bool pass_ = true, typename OutputValue_ = double, typename InputValue_ = double, typename Index_ = int>
665std::shared_ptr<DelayedUnaryIsometricOperationHelper<OutputValue_, InputValue_, Index_> > make_DelayedUnaryIsometricSubstituteIsnan(OutputValue_ substitute) {
666 return std::make_shared<DelayedUnaryIsometricSubstituteIsnanHelper<pass_, OutputValue_, InputValue_, Index_> >(substitute);
667}
668
669template<bool pass_ = true, typename OutputValue_ = double, typename InputValue_ = double, typename Index_ = int>
670std::shared_ptr<DelayedUnaryIsometricOperationHelper<OutputValue_, InputValue_, Index_> > make_DelayedUnaryIsometricSubstituteIsinf(OutputValue_ substitute) {
671 return std::make_shared<DelayedUnaryIsometricSubstituteIsinfHelper<pass_, OutputValue_, InputValue_, Index_> >(substitute);
672}
673
674template<bool pass_ = true, typename OutputValue_ = double, typename InputValue_ = double, typename Index_ = int>
675std::shared_ptr<DelayedUnaryIsometricOperationHelper<OutputValue_, InputValue_, Index_> > make_DelayedUnaryIsometricSubstituteIsfinite(OutputValue_ substitute) {
676 return std::make_shared<DelayedUnaryIsometricSubstituteIsfiniteHelper<pass_, OutputValue_, InputValue_, Index_> >(substitute);
677}
682}
683
684#endif
Helper operation interface for DelayedUnaryIsometricOperation.
Definition helper_interface.hpp:27
Delayed special value substitution.
Definition substitute_helpers.hpp:561
std::optional< Index_ > ncol() const
Definition substitute_helpers.hpp:579
void dense(bool, Index_, Index_, Index_ length, const InputValue_ *input, OutputValue_ *output) const
Definition substitute_helpers.hpp:601
bool zero_depends_on_column() const
Definition substitute_helpers.hpp:588
bool zero_depends_on_row() const
Definition substitute_helpers.hpp:584
DelayedUnaryIsometricSpecialSubstituteHelper(OutputValue_ substitute)
Definition substitute_helpers.hpp:566
bool non_zero_depends_on_column() const
Definition substitute_helpers.hpp:596
std::optional< Index_ > nrow() const
Definition substitute_helpers.hpp:575
void sparse(bool, Index_, Index_ number, const InputValue_ *input_value, const Index_ *, OutputValue_ *output_value) const
Definition substitute_helpers.hpp:614
bool is_sparse() const
Definition substitute_helpers.hpp:610
void dense(bool, Index_, const std::vector< Index_ > &indices, const InputValue_ *input, OutputValue_ *output) const
Definition substitute_helpers.hpp:605
bool non_zero_depends_on_row() const
Definition substitute_helpers.hpp:592
OutputValue_ fill(bool, Index_) const
Definition substitute_helpers.hpp:618
Helper for delayed scalar substitution.
Definition substitute_helpers.hpp:62
bool non_zero_depends_on_column() const
Definition substitute_helpers.hpp:100
bool is_sparse() const
Definition substitute_helpers.hpp:114
DelayedUnaryIsometricSubstituteScalarHelper(Scalar_ compared, OutputValue_ substitute)
Definition substitute_helpers.hpp:69
std::optional< Index_ > nrow() const
Definition substitute_helpers.hpp:79
void sparse(bool, Index_, Index_ number, const InputValue_ *input_value, const Index_ *, OutputValue_ *output_value) const
Definition substitute_helpers.hpp:118
void dense(bool, Index_, const std::vector< Index_ > &indices, const InputValue_ *input, OutputValue_ *output) const
Definition substitute_helpers.hpp:109
OutputValue_ fill(bool, Index_) const
Definition substitute_helpers.hpp:122
bool non_zero_depends_on_row() const
Definition substitute_helpers.hpp:96
bool zero_depends_on_column() const
Definition substitute_helpers.hpp:92
void dense(bool, Index_, Index_, Index_ length, const InputValue_ *input, OutputValue_ *output) const
Definition substitute_helpers.hpp:105
std::optional< Index_ > ncol() const
Definition substitute_helpers.hpp:83
bool zero_depends_on_row() const
Definition substitute_helpers.hpp:88
Delayed vector comparisons.
Definition substitute_helpers.hpp:262
std::optional< Index_ > nrow() const
Definition substitute_helpers.hpp:298
bool is_sparse() const
Definition substitute_helpers.hpp:362
bool zero_depends_on_row() const
Definition substitute_helpers.hpp:315
DelayedUnaryIsometricSubstituteVectorHelper(ComparedVector_ compared, SubstituteVector_ substitute, bool by_row)
Definition substitute_helpers.hpp:274
void dense(bool row, Index_ idx, const std::vector< Index_ > &indices, const InputValue_ *input, OutputValue_ *output) const
Definition substitute_helpers.hpp:346
std::optional< Index_ > ncol() const
Definition substitute_helpers.hpp:306
void dense(bool row, Index_ idx, Index_ start, Index_ length, const InputValue_ *input, OutputValue_ *output) const
Definition substitute_helpers.hpp:332
OutputValue_ fill(bool row, Index_ idx) const
Definition substitute_helpers.hpp:380
void sparse(bool row, Index_ idx, Index_ number, const InputValue_ *input_value, const Index_ *indices, OutputValue_ *output_value) const
Definition substitute_helpers.hpp:366
bool non_zero_depends_on_row() const
Definition substitute_helpers.hpp:323
bool zero_depends_on_column() const
Definition substitute_helpers.hpp:319
bool non_zero_depends_on_column() const
Definition substitute_helpers.hpp:327
Utilities for delayed comparison operations.
Sign-aware integer comparisons.
Flexible representations for matrix data.
Definition Extractor.hpp:15
bool safe_non_negative_equal(Left_ l, Right_ r)
Definition integer_comparisons.hpp:23
Interface for tatami::DelayedUnaryIsometricOperation helpers.