Browse Source

add sign to core.math in mol-script

Alexander Rose 1 year ago
parent
commit
5b82641018

+ 3 - 1
CHANGELOG.md

@@ -23,7 +23,9 @@ Note that since we don't clearly distinguish between a public and private interf
 - Support `ignoreHydrogens` in interactions representation
 - Add hydroxyproline (HYP) commonly present in collagen molecules to the list of amino acids
 - Fix assemblies for Archive PDB files (do not generate unique `label_asym_id` if `REMARK 350` is present)
-- Add `cantorPairing`, `sortedCantorPairing`, `invertCantorPairing`, `trunc` to `core.math` in `mol-script`
+- Add additional functions to `core.math` in `mol-script`
+    - `cantorPairing`, `sortedCantorPairing`, `invertCantorPairing`,
+    - `trunc`, `sign`
 
 ## [v3.34.0] - 2023-04-16
 

+ 1 - 0
src/mol-script/language/symbol-table/core.ts

@@ -121,6 +121,7 @@ const math = {
     roundInt: unaryOp(Type.Num),
     trunc: unaryOp(Type.Num),
     abs: unaryOp(Type.Num),
+    sign: unaryOp(Type.Num),
     sqrt: unaryOp(Type.Num),
     cbrt: unaryOp(Type.Num),
     sin: unaryOp(Type.Num),

+ 1 - 0
src/mol-script/runtime/query/table.ts

@@ -127,6 +127,7 @@ const symbols = [
     C(MolScript.core.math.roundInt, (ctx, v) => Math.round(v[0](ctx))),
     C(MolScript.core.math.trunc, (ctx, v) => Math.trunc(v[0](ctx))),
     C(MolScript.core.math.abs, (ctx, v) => Math.abs(v[0](ctx))),
+    C(MolScript.core.math.sign, (ctx, v) => Math.sign(v[0](ctx))),
     C(MolScript.core.math.sqrt, (ctx, v) => Math.sqrt(v[0](ctx))),
     C(MolScript.core.math.cbrt, (ctx, v) => Math.cbrt(v[0](ctx))),
     C(MolScript.core.math.sin, (ctx, v) => Math.sin(v[0](ctx))),

+ 1 - 0
src/mol-script/script/mol-script/symbols.ts

@@ -62,6 +62,7 @@ export const SymbolTable = [
         Alias(MolScript.core.math.roundInt, 'round'),
         Alias(MolScript.core.math.trunc, 'trunc'),
         Alias(MolScript.core.math.abs, 'abs'),
+        Alias(MolScript.core.math.sign, 'sign'),
         Alias(MolScript.core.math.sqrt, 'sqrt'),
         Alias(MolScript.core.math.cbrt, 'cbrt'),
         Alias(MolScript.core.math.sin, 'sin'),