コード例 #1
0
ファイル: LAController.cs プロジェクト: yshin1209/EaaS
        public async Task <double[]> Blas2([FromBody] MatVecMulClass input)
        {
            int     id        = input.Id;
            ActorId actorId   = new ActorId(id);
            var     actor     = ActorProxy.Create <ILA>(actorId, new Uri("fabric:/Application/LAActorService"));
            string  jsonInput = JsonConvert.SerializeObject(input);

            double[] output = await actor.MatVecMultiply(jsonInput);

            return(output);
        }
コード例 #2
0
ファイル: LA.cs プロジェクト: yshin1209/EaaS
        Task <double[]> ILA.MatVecMultiply(string jsonInput)
        {
            MatVecMulClass inputObject = JsonConvert.DeserializeObject <MatVecMulClass>(jsonInput);

            double[,] matrix = inputObject.Matrix;
            double[] vector = inputObject.Vector;
            var      m      = matrix.GetLength(0);
            var      n      = matrix.GetLength(1);

            double[] product = new double[m];
            for (int i = 0; i < m; i++)
            {
                for (int j = 0; j < n; j++)
                {
                    product[i] = product[i] + matrix[i, j] * vector[j];
                }
            }
            return(Task.FromResult <double[]>(product));
        }