Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/arraybasics.mac
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ inline typ[o:oshp,i:ishp] modarray(typ[o:oshp,i:ishp] arr, \
}

#define MODARRAY_AxVxS(typ, _postfix, _fmt, _zval, _oval) \
inline typ[d:shp] modarray(typ[d:shp] arr, int[d] idx, typ val) \
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we have to exclude the scalar case?

I think we have [*] [.] [*] , [*] [.] [], and [.,*] [] [*]. which should be ok to coexist, no?!

inline typ[d>0:shp] modarray(typ[d>0:shp] arr, int[d] idx, typ val) \
| _all_V_(_le_SxV_(0, idx)), _all_V_(_lt_VxV_(idx, shp)) \
{ \
return _modarray_AxVxS_(arr, idx, val); \
Expand Down
6 changes: 3 additions & 3 deletions src/structures/ArrayTransform.xsac
Original file line number Diff line number Diff line change
Expand Up @@ -56,23 +56,23 @@ BUILT_IN(TRANSPOSE)

#define WHERE_AxA(typ, _postfix, _fmt, _zval, _oval) \
inline \
typ[d:shp] where(bool[d:shp] p, typ[d:shp] A, typ[d:shp] B) \
typ[d>0:shp] where(bool[d>0:shp] p, typ[d>0:shp] A, typ[d>0:shp] B) \
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should add a 4th implementation that caters for the "all scalar" case. we could implement that by a normal conditional....

{ \
return { iv -> _sel_VxA_(iv, p) ? _sel_VxA_(iv, A) : _sel_VxA_(iv, B); \
iv -> _zval | iv < shp }; \
}

#define WHERE_AxS(typ, _postfix, _fmt, _zval, _oval) \
inline \
typ[d:shp] where(bool[d:shp] p, typ[d:shp] A, typ B) \
typ[d>0:shp] where(bool[d>0:shp] p, typ[d>0:shp] A, typ B) \
{ \
return { iv -> _sel_VxA_(iv, p) ? _sel_VxA_(iv, A) : B; \
iv -> _zval | iv < shp }; \
}

#define WHERE_SxA(typ, _postfix, _fmt, _zval, _oval) \
inline \
typ[d:shp] where(bool[d:shp] p, typ A, typ[d:shp] B) \
typ[d>0:shp] where(bool[d>0:shp] p, typ A, typ[d>0:shp] B) \
{ \
return { iv -> _sel_VxA_(iv, p) ? A : _sel_VxA_(iv, B); \
iv -> _zval | iv < shp }; \
Expand Down
8 changes: 4 additions & 4 deletions src/structures/ComplexArrayArith.xsac
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,23 @@ export all;

#define MAP_BIN_AxA(name, op, a, b, adef, bdef) \
inline \
b[d:shp] name(a[d:shp] A, a[d:shp] B) \
b[d>0:shp] name(a[d>0:shp] A, a[d>0:shp] B) \
{ \
return { iv -> name(A[iv], B[iv]) | iv < shp; \
iv -> bdef | iv < shp }; \
}

#define MAP_BIN_AxS(name, op, a, b, adef, bdef) \
inline \
b[d:shp] name(a[d:shp] A, a B) \
b[d>0:shp] name(a[d>0:shp] A, a B) \
{ \
return { iv -> name(A[iv], B) | iv < shp; \
iv -> bdef | iv < shp }; \
}

#define MAP_BIN_SxA(name, op, a, b, adef, bdef) \
inline \
b[d:shp] name(a A, a[d:shp] B) \
b[d>0:shp] name(a A, a[d>0:shp] B) \
{ \
return { iv -> name(A, B[iv]) | iv < shp; \
iv -> bdef | iv < shp }; \
Expand All @@ -54,7 +54,7 @@ b[d:shp] name(a A, a[d:shp] B) \

#define MAP_MON_AxA(name, op, a, b, adef, bdef) \
inline \
b[d:shp] name(a[d:shp] A) \
b[d>0:shp] name(a[d>0:shp] A) \
{ \
return { iv -> name(A[iv]) | iv < shp; \
iv -> bdef | iv < shp }; \
Expand Down
12 changes: 6 additions & 6 deletions src/structures/Quaternion.xsac
Original file line number Diff line number Diff line change
Expand Up @@ -83,20 +83,20 @@ inline struct Quaternion *(struct Quaternion a, struct Quaternion b)
};
}

inline struct Quaternion[d:shp] *(struct Quaternion a,
struct Quaternion[d:shp] b)
inline struct Quaternion[d>0:shp] *(struct Quaternion a,
struct Quaternion[d>0:shp] b)
{
return { iv -> a * b[iv] | iv < shp };
}

inline struct Quaternion[d:shp] *(struct Quaternion[d:shp] a,
struct Quaternion b)
inline struct Quaternion[d>0:shp] *(struct Quaternion[d>0:shp] a,
struct Quaternion b)
{
return { iv -> a[iv] * b | iv < shp };
}

inline struct Quaternion[d:shp] *(struct Quaternion[d:shp] a,
struct Quaternion[d:shp] b)
inline struct Quaternion[d>0:shp] *(struct Quaternion[d>0:shp] a,
struct Quaternion[d>0:shp] b)
{
return { iv -> a[iv] * b[iv] | iv < shp };
}