@@ -1338,54 +1338,6 @@ operator :(it: _iteratorRecord, type t: ndarray(?rank,?eltType)) do
13381338 return new ndarray(it);
13391339
13401340
1341- // Need help implementtion these.
1342- // operator =(ref lhs: ndarray(?rank,?eltType), rhs: _iteratorRecord) {
1343- // var arr = rhs;
1344- // lhs._domain = arr.domain;
1345- // lhs.data = arr;
1346- // }
1347- // operator :(val: _iteratorRecord, type t: ndarray(?rank,?eltType)) {
1348- // return new ndarray(val);
1349- // }
1350-
1351-
1352- // // This bunch is problematic.
1353- // proc remote.init(other: ndarray(?rank,?eltType)) {
1354- // this.init(ndarray(rank,eltType));
1355- // other.populateRemote(this);
1356- // }
1357-
1358- // proc remote.init=(ref other: ndarray(?rank,?eltType)) {
1359- // this.init(ndarray(rank,eltType));
1360- // other.populateRemote(this);
1361- // }
1362-
1363-
1364-
1365- // operator =(ref lhs: remote(ndarray(?rank,?eltType)), rhs: ndarray(rank,eltType)) {
1366- // rhs.populateRemote(lhs);
1367- // }
1368-
1369- // operator :(val: ndarray(?rank,?eltType), type t: remote(ndarray(rank,eltType))) {
1370- // return val.toRemote();
1371- // }
1372-
1373- // proc remote.init(ref other: remote(ndarray(?rank,?eltType))) {
1374- // this.eltType = ndarray(rank,eltType);
1375- // this.remoteResource = other.remoteResource;
1376- // }
1377-
1378- // proc remote.init=(ref other: remote(ndarray(?rank,?eltType))) {
1379- // this.eltType = ndarray(rank,eltType);
1380- // this.remoteResource = other.remoteResource;
1381- // }
1382-
1383- // operator =(ref lhs: remote(ndarray(?rank,?eltType)), rhs:remote( ndarray(rank,eltType))) {
1384- // lhs.remoteResource = rhs.remoteResource;
1385- // }
1386-
1387- // End problemetic bunch.
1388-
13891341proc zipArr(a: ndarray(?rank,?eltType),b: ndarray(rank,eltType),f): ndarray(rank,eltType) {
13901342 const dom = a.domain ;
13911343 var c: ndarray(rank,eltType) = new ndarray(a.domain ,eltType);
@@ -2443,14 +2395,6 @@ proc type ndarray.multiReader(path: string) throws {
24432395}
24442396
24452397proc type ndarray.loadFrom(filePath: string , param rank: int , type eltType = defaultEltType): ndarray(rank,eltType) throws {
2446- // var arr = new ndarray(rank,eltType);
2447- // var file = IO.open(filePath, IO.ioMode.r);
2448- // var fr = file.reader();
2449- // arr.read(fr);
2450- // return arr;
2451-
2452- // return ndarray.readInPlace(multiReader(filePath),rank,eltType);
2453-
24542398 var arr = new ndarray(rank,eltType);
24552399 var fr = ndarray.multiReader(filePath);
24562400 arr.read (fr);
@@ -2474,82 +2418,6 @@ class _tensor_resource {
24742418
24752419}
24762420
2477- // Some examples.
2478- // const dom = util.emptyDomain(2);
2479- // writeln(dom);
2480-
2481- // printType(ndarray(1));
2482- // var A: ndarray(1);
2483- // A._domain = {0..#3};
2484- // // A.data = [1.0,2.0,3.0];
2485- // A = [1.0,2.0,3.0];
2486- // writeln(A);
2487-
2488- // use GpuDiagnostics;
2489-
2490- // startGpuDiagnostics();
2491- // startVerboseGpu();
2492-
2493- // var device = here.gpus[0];
2494-
2495- // on device {
2496- // var arr = [1.0,2.0,3.0];
2497-
2498- // var A: ndarray(1) = arr;
2499- // writeln("A -> ",A);
2500-
2501- // var B: ndarray(1) = new ndarray(arr);
2502- // // B = [1.0,2.0,3.0];
2503-
2504- // writeln("B -> ",B.domain);
2505-
2506- // var dom = {0..#3,0..#5};
2507-
2508- // var C: ndarray(2) = new ndarray(dom);
2509- // writeln("C -> ",C);
2510- // }
2511-
2512- // var A: ndarray(1) = [1.0,2.0,3.0];
2513- // writeln(A);
2514-
2515- // var B: ndarray(1) = new ndarray([1.0,2.0,3.0]);
2516- // // B = [1.0,2.0,3.0];
2517-
2518- // writeln(B.domain);
2519-
2520- // var C: ndarray(2) = new ndarray({0..#3,0..#5});
2521- // var c = 0;
2522- // for i in C.domain {
2523- // C.data[i] = c;
2524- // c += 1;
2525- // }
2526- // writeln(C);
2527-
2528- // C = C.reshape({0..#5,0..#3});
2529- // writeln(C);
2530-
2531- // writeln(C[0,0]);
2532-
2533- // C[0,0] = 70.0;
2534-
2535- // var D = C[{0..1,0..1}];
2536-
2537- // C[{0..1,0..1}]=2.0;
2538-
2539-
2540- // writeln(D,D.type:string);
2541- // writeln(C,C.type:string);
2542-
2543- // var E = C.slice(1,..);
2544- // writeln(E);
2545-
2546-
2547- // type T = (int,real);
2548- // writeln(T:string,isTupleType(T));
2549-
2550- // end examples.
2551-
2552-
25532421
25542422proc type ndarray.fullOuter(a: ndarray(?rankA,?eltType), b: ndarray(?rankB, eltType)): ndarray(rankA + rankB, eltType) {
25552423 param rankC = rankA + rankB;
@@ -2638,19 +2506,13 @@ proc drop(param count: int, param s: string) param do
26382506
26392507
26402508proc type ndarray.einsum(param subscripts: string ,a: ndarray(?rankA,?eltType), b: ndarray(?rankB, eltType)) {
2641-
26422509 for param i in 0 ..< subscripts.size {
26432510 param c = subscripts[ i] ;
2644- // writeln(c);
26452511 }
26462512 param fst = subscripts.takeUntil(" ," );
26472513 param subscripts_1 = subscripts.drop(fst.size + 1 );
26482514 param snd = splitAt(subscripts_1," -" );
26492515 param subscripts_2 = subscripts_1.drop(snd.size + 2 );
2650- // param thd
2651- // param fth
2652- // param vth
2653- // Cool three letter names for 3,4,5
26542516
26552517 for param i in 0 ..< fst.size {
26562518 param ci = fst[ i] ;
@@ -2663,7 +2525,7 @@ proc type ndarray.einsum(param subscripts: string,a: ndarray(?rankA,?eltType), b
26632525 }
26642526 }
26652527 }
2666- // compilerError("Must sum across one axis!");
2528+
26672529 return a;
26682530}
26692531
0 commit comments