示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#3
0
        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);
        }
示例#4
0
 public IMatrix LoadMatrix(StreamReader str)
 {
     return(RawMatrix.Read(str));
 }