def from_array(data)
      n = data.length
      if data.reject{|l| Numeric === l}.size == 0
        a = self.new(n, 1)
        (0...data.length).each do |i|
          a[i, 0] = data[i]
        end
        return a
      else
        begin
          lengths = data.collect{|v| v.length}
        rescue
          raise "All columns must be arrays"
        end
        raise "All columns must have equal length!" if lengths.min < lengths.max
        a = self.new(n, lengths.max)
        for i in 0...n
          for j in 0...lengths.max
            a[i,j] = data[i][j]
          end
        end
        return a
      end
    end
def from_array(data)
      n = data.length
      if data.reject{|l| Numeric === l}.size == 0
        a = self.new(n, 1)
        (0...data.length).each do |i|
          a[i, 0] = data[i]
        end
        return a
      else
        begin
          lengths = data.collect{|v| v.length}
        rescue
          raise "All columns must be arrays"
        end
        raise "All columns must have equal length!" if lengths.min < lengths.max
        a = self.new(n, lengths.max)
        for i in 0...n
          for j in 0...lengths.max
            a[i,j] = data[i][j]
          end
        end
        return a
      end
    end
Create a new matrix. There are two ways to use this function

 <b>pass an array</b>::
   Constructs a column vector. For example: DoubleMatrix.from_array 1, 2, 3
 <b>pass an array of arrays</b>::
   Constructs a matrix, inner arrays are rows. For
   example: DoubleMatrix.from_array [[1,2,3],[4,5,6]]

 See also [], JBLAS#mat