Re: [eigen] Tiny matrix in Eigen2 |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Tiny matrix in Eigen2
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Thu, 17 Sep 2009 09:20:37 -0400
- 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 :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=U9Lx8526TQW8de6uumwqMQQq9Cev3d/qA58Rhh13Aqg=; b=dU0q9LU2zC5M3jWbq/zJwRNWYMasLRwUXD7p3216/QeX4SuDYAvgmfTOK9rW5M8F+M HU/pwhKGlt1JlEPVxHJFFGk9uUeHNO5NoED8UBC6pqOEBP+JxRBBu0PjfLPuXT6opoxB aR5JkE8cwpz9MVe3rExnHzY69Rtwrcw855+d0=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=kblUPPSbREFQpPmC5zn6yN3pwn/4uXj3Id30Xau9Ha5CuJjevlrCKajXXVIPlDS+Zz fU87BBpbwK6OXteK5wO8OwCaAGkZp7RseG2G9Yo6Sl6/YA2PRxx3rWkGwl8BwCT6Powx YvMzwvu1iDqxpO0GHIjNFyWZIjj8QbaDQCTVI=
2009/9/17 Rohit Garg <rpg.314@xxxxxxxxx>:
> On Thu, Sep 17, 2009 at 2:03 PM, WANG Xuewen <xuewen.wang@xxxxxxxxx> wrote:
>> Hi,
>>
>> We are trying to replace our home made matrix vector library with Eigen2
>> which provides an unified interface between tiny matrix and medium size
>> matrix and sounds promising on performance. Surprisingly, it is 10%
>> slower for tiny matrix (with 2.0.5, not sure about the devel branch
>> since same code doesn't compile using it), so I wonder if there is
>> something wrong that I've made and anything that can help improving it.
>>
>> Our tiny matrix whose dimension limits to 7 but the exact dimension is
>> not known at compile time. The most costly computation on the matrix is
>> to compute the exponential of a real or complex matrix. We use the
>> method similar to MatrixExponential in unsupported.
>>
>> I've used something like
>>
>> typedef Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic,
>> Eigen::RowMajor | Eigen::DontAlign,
>> NMaxTinyMatrixDimension, NMaxTinyMatrixDimension>
>> TinyRMatrix;
>>
>> typedef Eigen::Matrix<std::complex<double>, Eigen::Dynamic, Eigen::Dynamic,
>> Eigen::RowMajor | Eigen::DontAlign,
>> NMaxTinyMatrixDimension, NMaxTinyMatrixDimension>
>> TinyCMatrix;
>>
>> typedef Eigen::Matrix<double, Eigen::Dynamic, 1,
>> Eigen::RowMajor | Eigen::DontAlign,
>> NMaxTinyMatrixDimension, 1>
>> TinyRVector;
>>
>> typedef Eigen::Matrix<std::complex<double>,
>> Eigen::Dynamic, 1,
>> Eigen::RowMajor | Eigen::DontAlign,
>> NMaxTinyMatrixDimension, 1>
>> TinyCVector;
>>
>> Where NMaxTinyMatrixDimension is 7.
>>
>> My questions are:
>>
>> 1. Is the chosen storage the right choice for my problem? Should I just
>> use Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic> etc?
> Then your matrix would be stored in column major order. See if that
> affects you. If not I'd just go with this declaration.
>>
>> 2. Even if the storage is in the stack, but the dimension is not known
>> at compile time. Will the loop get unrolled for most operations?
> AFAIK, if the dimensions are not known at compile time, then it wont
> be stored on stack.
It will, because the max-dimensions are known at compile time, that's
what matters for storage.
> I am not sure but I think it wont unroll.
Indeed, there's no way that it could unroll, without knowning at
compile time the exact dims.
Benoit