/* MOD_V2.0 * Copyright (c) 2012 OpenDA Association * All rights reserved. * * This file is part of OpenDA. * * OpenDA is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation, either version 3 of * the License, or (at your option) any later version. * * OpenDA is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with OpenDA. If not, see . */ using System.Collections.Generic; namespace OpenDA.DotNet.Interfaces { /** * Matrix */ public interface IMatrix { /// /// Gets the number of rows of the Matrix. /// /// number of rows of matrix int NumberOfRows { get; } /// /// Gets the number of columns of the Matrix. /// /// number of columns of L int NumberOfColumns { get; } /// /// Perform matrix-vector multiplication x=alpha*x+beta*L*v, but then implicitly and often more efficiently /// /// scaling parameter for matrix multiplication /// vector used for multiplication (in most cases a "small" vector number of columns of L) /// scaling parameter for vector x /// updated vector in multiplication (in most cases a "large" vector of size of model state) void RightMultiply(double beta, IVector v, double alpha, IVector x); /// /// Perform matrix-vector multiplication v=alpha*v+beta*(x'*L)', but then implicitly and often more efficiently /// /// scaling parameter for matrix multiplication /// vector used for multiplication (in most cases a "large" vector of size of model state) /// scaling parameter for vector vupdated vector in multiplication (in most cases a "small" vector number of columns of L) /// void LeftMultiply(double beta, IVector x, double alpha, IVector v); /// /// Perform matrix-vector solve x=inv(L)*v, but then implicitly and often more efficiently. /// This is the (pseudo-)inverse of leftMultiply. /// /// vector used for linear solver /// result of linear solve void LeftSolve(IVector v, IVector x); /// /// Perform matrix-vector solve for v in v=L*x, but then implicitly and often more /// efficiently. This is the (pseudo-)inverse of rightMultiply. /// /// vector used for right solve /// result of linear solver void RightSolve(IVector x, IVector v); /// /// Return part of the SqrtCovariance as Matrix /// /// start row of selection /// end row of selection /// start column of selection /// end column of selection /// matrix representation of L IMatrix GetMatrixSelection(int rowmin, int rowmax, int colmin, int colmax); /// /// Return SqrtCovariance as an array of Vectors, where each tv represents one column of L /// /// tv[] representation of L List AsVectorArray(); /// /// Get/Set single value of the Matrix. /// /// /// double GetValue(int row, int column); void SetValue(int row, int column, double value); /// /// Matrix as a 2d array of doubles /// /// double[][] representation of matrix double[,] AsArray(); /// /// Clone (i.e. duplicate) a matrix. ///

/// Note: Duplication means that a new vector is created that is identical to /// the current vector. All data in the current vector is also copied. ///

/// A copy of the present vector. IMatrix Clone(); } }