You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: box/genfrom.cc
+23-5Lines changed: 23 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -8,12 +8,11 @@
8
8
// later version.
9
9
10
10
// Atm view(i ...) only beats i of rank ≤1 and only when all i are beatable. This is a sandbox for a version that beats any combination of scalar or view<Seq> of any rank, and only returns an expr for the unbeatable subscripts.
11
-
// There is an additional issue that eg A2(i1) (indicating ranks) returns a nested expression, that is, a rank-1 expr where each element is a rank-1 view. We'd prefer if the result was rank 2 and not nested, iow, the value type of the result should always be the same as that of A.
11
+
// There is an additional issue that eg A2(unbeatable-i1) (indicating ranks) returns a nested expression, that is, a rank-1 expr where each element is a rank-1 view. It should instead be rank 2 and not nested, iow, the value type of the result should always be the same as that of A.
12
+
// 1) Need to split the static and the dynamic parts so some/most of the routine can be used for Small or Big
13
+
// 2) Need to find a way to use len like in Ptr-based iota.
12
14
13
15
#include"ra/test.hh"
14
-
#include<iomanip>
15
-
#include<chrono>
16
-
#include<span>
17
16
18
17
using std::cout, std::endl, std::flush;
19
18
@@ -25,6 +24,25 @@ constexpr auto ii(dim_t (&&s)[rank])
Copy file name to clipboardExpand all lines: docs/ra-ra.texi
+11-11Lines changed: 11 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -314,7 +314,7 @@ The following @code{#define}s affect the behavior of @code{ra::}.
314
314
315
315
@itemize
316
316
@c FIXME The flag should only apply to dynamic checks.
317
-
@item@code{RA_DO_CHECK} (default 1)
317
+
@item@code{RA_CHECK} (default 1)
318
318
319
319
If 1, check shape agreement (e.g. @code{Big<int, 1>@{2, 3@}+Big<int, 1>@{1, 2, 3@}}) and random array accesses (e.g. @code{Small<int, 2>a=0;inti=10;a[i]=0;}). See @ref{Errorhandling}.
320
320
@@ -1761,26 +1761,26 @@ Runtime error handling in @code{ra::} is controlled by two macros.
1761
1761
@itemize
1762
1762
@item@code{RA_ASSERT(cond, ...)} ---
1763
1763
check that @code{cond} evaluates to true in the @code{ra::} namespace. The other arguments are informative.
1764
-
@item@code{RA_DO_CHECK} ---
1764
+
@item@code{RA_CHECK} ---
1765
1765
must have one of the values 0, 1, or 2.
1766
1766
@end itemize
1767
1767
1768
1768
They work as follows:
1769
1769
1770
1770
@itemize
1771
-
@item If @code{RA_DO_CHECK} is 0, runtime checks are skipped.
1772
-
@item If @code{RA_DO_CHECK} is not 0, runtime checks are done.
1771
+
@item If @code{RA_CHECK} is 0, runtime checks are skipped.
1772
+
@item If @code{RA_CHECK} is not 0, runtime checks are done.
1773
1773
@itemize
1774
1774
@item If @code{RA_ASSERT} is defined, using @code{RA_ASSERT}.
1775
-
@item If @code{RA_ASSERT} isn't defined, the method depends on the value of @code{RA_DO_CHECK}. The two options are 1 (plain @code{assert}) and 2 (prints the informative arguments and aborts). Other values are an error.
1775
+
@item If @code{RA_ASSERT} isn't defined, the method depends on the value of @code{RA_CHECK}. The two options are 1 (plain @code{assert}) and 2 (prints the informative arguments and aborts). Other values are an error.
1776
1776
@end itemize
1777
1777
@end itemize
1778
1778
1779
-
@code{ra::} contains uses of @code{assert} for checking invariants or for sanity checks that are separate from uses of @code{RA_ASSERT}. Those can be disabled in the usual way with @option{-DNDEBUG}, but note that @option{-DNDEBUG} will also disable any @code{assert}s that are a result of @code{RA_DO_CHECK=1}.
1779
+
@code{ra::} contains uses of @code{assert} for checking invariants or for sanity checks that are separate from uses of @code{RA_ASSERT}. Those can be disabled in the usual way with @option{-DNDEBUG}, but note that @option{-DNDEBUG} will also disable any @code{assert}s that are a result of @code{RA_CHECK=1}.
1780
1780
1781
-
The performance cost of the runtime checks depends on the program. Without custom @code{RA_ASSERT}, @code{RA_DO_CHECK=1} usually has an acceptable cost, but @code{RA_DO_CHECK=2} is usually more expensive, because having the arguments around to print can prevent optimization. The default is @code{RA_DO_CHECK=1}.
1781
+
The performance cost of the runtime checks depends on the program. Without custom @code{RA_ASSERT}, @code{RA_CHECK=1} usually has an acceptable cost, but @code{RA_CHECK=2} is usually more expensive, because having the arguments around to print can prevent optimization. The default is @code{RA_CHECK=1}.
1782
1782
1783
-
The following example shows how errors might be reported depending on @code{RA_DO_CHECK}.
1783
+
The following example shows how errors might be reported depending on @code{RA_CHECK}.
1784
1784
1785
1785
@cartouche
1786
1786
@verbatim
@@ -1792,11 +1792,11 @@ cout << (a+b) << endl;
1792
1792
1793
1793
@c FIXME we'd get 'Bad shapes (-1922222222 3)' on sum(a+b) bc of the check only at top strategy. Improve that.
1794
1794
@itemize
1795
-
@item@code{RA_DO_CHECK=2}
1795
+
@item@code{RA_CHECK=2}
1796
1796
@verbatim
1797
1797
*** ra::./ra/expr.hh:436,13 (check()) Bad shapes (10 3)(40 3). ***
0 commit comments