Libraryless. Click here for Pure Java version (3882L/22K).
// add constant to each element static double[] doubleAdd(double[] l, double a) { if (a == 0) ret l; int n = l(l); double[] x = new[n]; for i to n: x[i] = l[i]+a; ret x; } // add element-wise static double[] doubleAdd(double[] a, double[] b) { if (a == null) ret b; if (b == null) ret a; int n = l(a); assertEquals(l(b), n); double[] x = new[n]; for i to n: x[i] = a[i]+b[i]; ret x; }
Began life as a copy of #1033042
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1033054 |
Snippet name: | doubleAdd |
Eternal ID of this version: | #1033054/4 |
Text MD5: | 587d13c33a46df81f2609a254ab37b2c |
Transpilation MD5: | 07bd45c3b492bb0fd1385252e846eaf5 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-10-18 02:31:25 |
Source code size: | 437 bytes / 21 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 203 / 297 |
Version history: | 3 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |