public virtual void specify <T, W>(params SimpleBase <T, W>[] inputs) where T : SimpleBase <T, W> where W : Matrix { bool dense = false; bool real = true; int bits = 32; foreach (SimpleBase <T, W> s in inputs) { MatrixType t = s.mat.Type; if (t.isDense()) { dense = true; } if (!t.isReal()) { real = false; } if (t.getBits() == 64) { bits = 64; } } // commonType = MatrixType.lookup(dense, real, bits); }
public virtual T convert <T, W>(SimpleBase <T, W> matrix) where T : SimpleBase <T, W> where W : Matrix { if (matrix.getType == commonType) { return((T)matrix); } if (!matrix.getType.isDense() && commonType.isDense()) { Console.Error.WriteLine("\n***** WARNING *****\n"); Console.Error.WriteLine("Converting a sparse to dense matrix automatically."); Console.Error.WriteLine("Current auto convert code isn't that smart and this might have been available"); } Matrix m = ConvertMatrixType.convert(matrix.mat, commonType); if (m == null) { throw new System.ArgumentException("Conversion from " + matrix.getType + " to " + commonType + " not possible"); } return((T)matrix.wrapMatrix(m)); }