From ced0984f98c24b08ee474c9d03c81147db691c0f Mon Sep 17 00:00:00 2001 From: Michael Parrott Date: Wed, 20 Jan 2016 22:06:57 -0800 Subject: [PATCH] Add icol function with Array[Int] as argument --- src/main/scala/BIDMat/MatFunctions.scala | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/scala/BIDMat/MatFunctions.scala b/src/main/scala/BIDMat/MatFunctions.scala index 940ba1fc..003e9586 100755 --- a/src/main/scala/BIDMat/MatFunctions.scala +++ b/src/main/scala/BIDMat/MatFunctions.scala @@ -1169,6 +1169,13 @@ object MatFunctions { /** Make an integer column vector from a tuple to support 0->5 syntax for ranges. */ def icol(x:Tuple2[Int,Int]):IMat = icol(x._1 until x._2) + /** Make an integer column vector from an array of Ints. */ + def icol(x:Array[Int]):IMat = { + val ahash = if (Mat.useCache) x.## else 0 + val mat = IMat.newOrCheckIMat(x.length, 1, null, ahash, "icol_array".##) + System.arraycopy(x, 0, mat.data, 0, x.length) + mat + } /** Make an integer column vector from a List. */ def icol(x:List[Int]):IMat = {