-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…unary (#943) * [skip ci] add test * fix linalg (hopefully don't harm performance) * better fix * [skip ci] fix typo * fix asin dom err * enhanced pow * [skip ci] reduce pow optimization from 100 to 50 * [skip ci] balance test load pressure * share common_ops between Expr and Matrix * [skip ci] add comments about the l-value problem * [skip ci] fix opengl pow test by adding fast_pow for rhs is int * [skip ci] add comment * [skip ci] nit comment * delete * add comment * [skip ci] Apply suggestions from code review Co-authored-by: Yuanming Hu <[email protected]> * nit comment * fix abs(power) Co-authored-by: Yuanming Hu <[email protected]>
- Loading branch information
1 parent
e0dfdd7
commit 3b79511
Showing
8 changed files
with
279 additions
and
212 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
class TaichiOperations: | ||
def __neg__(self): | ||
import taichi as ti | ||
return ti.neg(self) | ||
|
||
def __abs__(self): | ||
import taichi as ti | ||
return ti.abs(self) | ||
|
||
def __add__(self, other): | ||
import taichi as ti | ||
return ti.add(self, other) | ||
|
||
def __radd__(self, other): | ||
import taichi as ti | ||
return ti.add(other, self) | ||
|
||
def __sub__(self, other): | ||
import taichi as ti | ||
return ti.sub(self, other) | ||
|
||
def __rsub__(self, other): | ||
import taichi as ti | ||
return ti.sub(other, self) | ||
|
||
def __mul__(self, other): | ||
import taichi as ti | ||
return ti.mul(self, other) | ||
|
||
def __rmul__(self, other): | ||
import taichi as ti | ||
return ti.mul(other, self) | ||
|
||
def __truediv__(self, other): | ||
import taichi as ti | ||
return ti.truediv(self, other) | ||
|
||
def __rtruediv__(self, other): | ||
import taichi as ti | ||
return ti.truediv(other, self) | ||
|
||
def __floordiv__(self, other): | ||
import taichi as ti | ||
return ti.floordiv(self, other) | ||
|
||
def __rfloordiv__(self, other): | ||
import taichi as ti | ||
return ti.floordiv(other, self) | ||
|
||
def __mod__(self, other): | ||
import taichi as ti | ||
return ti.mod(self, other) | ||
|
||
def __pow__(self, other, modulo=None): | ||
import taichi as ti | ||
return ti.pow(self, other) | ||
|
||
def __rpow__(self, other, modulo=None): | ||
import taichi as ti | ||
return ti.pow(other, self) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.