Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] View of /branches/vis15/src/compiler/fields/tensor-shape.sml
ViewVC logotype

View of /branches/vis15/src/compiler/fields/tensor-shape.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3797 - (download) (annotate)
Mon May 2 21:10:12 2016 UTC (3 years, 6 months ago) by jhr
File size: 552 byte(s)
  Working on merge: clean up tensor slicing/indexing.
(* tensor-shape.sml
 *
 * This code is part of the Diderot Project (http://diderot-language.cs.uchicago.edu)
 *
 * COPYRIGHT (c) 2016 The University of Chicago
 * All rights reserved.
 *)

structure TensorShape =
  struct

    type t = int list

    fun same (shp1 : t, shp2) = ListPair.allEq (op =) (shp1, shp2)

    fun hash shp =
	  List.foldl (fn (i, w) => Word.xorb(Word.<<(w, 0w1), Word.fromInt i))
            (Word.fromInt(List.length shp)) shp

    fun toString shp = String.concat ["[", String.concatWithMap "," Int.toString shp, "]"]

  end

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0