|Re: [eigen] Efficient syntax for Ax=b where A is diagonal/Toeplitz|
[ Thread Index |
| More lists.tuxfamily.org/eigen Archives
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Efficient syntax for Ax=b where A is diagonal/Toeplitz
- From: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>
- Date: Tue, 6 Apr 2010 15:24:07 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:received:message-id:subject:to:content-type; bh=6PDNaDLfeYca/+Vkc3aL8DzmEhU3R4KHNL4oPEGo25k=; b=qnd3CT8E0X5qOsEaweWjz9KBpL7Q8CSDoahbJAKqH+zbKTKptVwli2FAQIDDS60wuy Exzx0vXnohBppa3yC1t2ZkIJPHI5bxmDgRe0+49TpERGWCU0N5dnir3fmf/v8i9Q6uk7 Vpe42EKLFhjUoMnCL+xgaPwIcgrlfmEtP6YHY=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; b=jq+iJUZ3bc6Dyh3FtUy/5iRRSfra3ih36Nig5Y7FLxj9ix8ve84R3nRXxJO3BJlkb5 bT8rqAqDe/wwCECwXLuhT40bgKT4RXC6+rDTEeZzAzcFeYYHlNfvKNLgqMuFojh0xCaz w2EknQk/hjMLQZ+AuuL7fHqzkUOvw9u8XsmiM=
On Tue, Apr 6, 2010 at 3:03 PM, Gael Guennebaud <gael.guennebaud@xxxxxxxxx>
On Fri, Apr 2, 2010 at 9:32 PM, Manoj Rajagopalan <rmanoj@xxxxxxxxx>
On Friday 02 April 2010 02:21:59 pm Gael Guennebaud wrote:
> On Fri, Apr 2, 2010 at 5:03 PM, Manoj Rajagopalan <rmanoj@xxxxxxxxx
> > Also, efficient storage, arithmetic and linear-system solutionAny hints on how to go about this? I could try my hand - I am experienced C++
> > (O(n^2)) algorithms are possible when A is (symmetric) Toeplitz (occur
> > frequently in signal-processing and Fourier-series solution of ODE/PDE).
> > Does the roadmap consider this case?
> I'd say contributions are welcome ;)
developer (yes, expr templates, CRTP/barton-nackman and all the related good
stuff also). Just that I just got to know of Eigen. What to inherit? How and
where to introduce specialized arithmetic functors into the existing
I would implement it in the same vein as DiagonalMatrix/DiagonalWrapper:
- add a ToeplitzBase class inheriting AnyMatrixBase.
oops AnyMatrixBase has been renamed EigenBase ...
In addition to the rows() and cols() functions, all classes inheriting
ToeplitzBase should provide a coeffs() function returning a CoeffType
reference to the dense
vector _expression_ representing the first row and first column. ToeplitzBase will implement the common API for all Toeplitz objects.
- add two classes ToeplitzMatrix & ToeplitzWrapper inheriting ToeplitzBase. The former would store a single dense vector + rows and cols with the appropriate functions allowing to manipulate the matrix. The later would simply store a reference to a dense _expression_ representing the first column and first row. Then, e.g., the addition of two Toeplitz objects would be implemented in ToeplitzBase by nesting the _expression_ of the addition of the two dense vectors into a ToeplitzWrapper:
ToeplitzWrapper<CwiseBinaryOp<ei_scalar_add_op<Scalar>, CoeffType, typename OtherDerived::CoeffType>
operator+(const ToeplitzBase<OtherDerived>& other)
return ToeplitzWrapper<CwiseBinaryOp<ei_scalar_add_op<Scalar>, CoeffType, typename OtherDerived::CoeffType>(this->coeffs() + rhs.coeffs());
Finaly, products and solving would idealy be implemented using the ReturnByValue stuff.
The same design is also used for quaternions. (Eigen/src/Geometry/Quaternion.h)
Hope that helps.
For a Toeplitz matrix, it is necessary to store only the first row and
first column. Therefore, many arithmetic ops become simple.