public static RawMatrix Read(StreamReader str) { var mtx = new RawMatrix() { Scale = Double.Parse(str.ReadLine()), m = DelimitedReader.Read <double>(str), BlockSize = ulong.Parse(str.ReadLine()) }; return(mtx); }
public static RawMatrix Read(StreamReader str) { var mtx = new RawMatrix() { Scale = Double.Parse(str.ReadLine()), m = DelimitedReader.Read <double>(str), BlockSize = ulong.Parse(str.ReadLine()) }; Max = Math.Max(Max, mtx.m.Enumerate().Max(x => (x < 0) ? -x : x)); return(mtx); }
public IMatrix ElementWiseMultiply(IMatrix m, IComputationEnvironment env) { if (m.Format != Format) { throw new Exception("Format mismatch"); } if (m.RowCount != RowCount) { throw new Exception("row-count mismatch"); } if (m.ColumnCount != ColumnCount) { throw new Exception("column count mismatch"); } var mr = m as RawMatrix; var res = new RawMatrix(this.m.PointwiseMultiply(mr.m), 1, Format, m.BlockSize) { Scale = Scale * m.Scale }; return(res); }
public IMatrix LoadMatrix(StreamReader str) { return(RawMatrix.Read(str)); }