Re: [eigen] malloc in Scalar x Matrix Matrix |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] malloc in Scalar x Matrix Matrix
- From: Henrik Larsson <larsson@xxxxxxxxxxxxxxxx>
- Date: Thu, 11 Jul 2019 16:36:53 +0200
- Autocrypt: addr=larsson@xxxxxxxxxxxxxxxx; prefer-encrypt=mutual; keydata= mQINBFI943gBEADCZv+Qzg2ZwUBydEZ/lV2ClXZ4McX/IyfqzkmBgzP5xRpDjYwFGbTT84Hu ICsHVDhSeauVCQZ55k+Nm7Osi72Ite4PWDjzPT0g6n0/epmnhZqa94La8MtR07e91A9wSKtd W+8YRqHZoXvHDfjlu4xRM/hR2LTiSBxRrjUuEQgY97tuqG0Y+OTa2+SaW7oMLW3CFIdIQmCV xwcDGngFaGaEy+DmT3X0dbB15j6MgVMqjGfeEHe0M79D1YfaHEqbw5xL8yUc6rfLEYnjB1bF glq+ii4Y254q/6RoYQDbeppdI70staBM4GXV2amPDToF9KA10LPNIa+RY6JB4+IHrSsf6lfz QHnpdP2wXRnpSkVD4vjPMtyKjtcbOGPoAASFKV1IXH12T6g6QQWxY9I5ajcLtW7L2fvdBDJg fSfAzwmcH5wJIiyEabnQSj1Dy9pCxKbD4Std68NKkZhYIbwVhqnYg2nMjB0vc2zo9HKsYnCt 2vqdVyJ3h70HwoZfIK55fOLpKk/l0hUSlLMlrEAc+iyfvhpImUjtg4ldot9cs98WL9e/AzCB nmOW7etLhivWI7rpsYxtWYa7fnrrNUIzYOORX6vOJ3LZ8hBNUafbRf6f5fEJa1iT9xfKmSSo 2f5MVt7KMN5/EnUqtHH/v/UY0FMwysdZxQVm+wU8Ec78HRZybQARAQABtCxIZW5yaWsgUi4g TGFyc3NvbiA8bGFyc3NvbkBwY3RjLnVuaS1raWVsLmRlPokCOQQTAQIAIwUCUj3jeAIbAwcL CQgHAwIBBhUIAgkKCwQWAgMBAh4BAheAAA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=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=uni-kiel.de ; s=20180612; h=Content-Transfer-Encoding:Content-Type:In-Reply-To: MIME-Version:Date:Message-ID:References:To:From:Subject:Sender:Reply-To:Cc: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=D2hyo8BfISDnVH8Eqe/+PIeopt9e2/N0ol6Jhd4IkIc=; i=@pctc.uni-kiel.de; b=i9+qT OBFhaGhj5DIqm8qN90LK1U0ii8RlzHaReSDF8RyMB88yeCX5ZRcAn1vezY3ajquw3HpJX3BESPpR3 /4uBz2R5m3JQ6Q6R1Eo+ibBVj6WNV2X8QqBAF8IkToTJr09qeHivs/5k09D0ZJOe0f6+6MSv4fmnA slYC5ZdMugws=;
- Openpgp: preference=signencrypt
Hi,
thanks a lot! This was the problem. I never thought that the matrix
sizes matter so my minimal working example I tried had different matrix
sizes (10x10 and not 10x2; in production, it is more 20000x200) such
that I could not detect it.
Btw, set_is_malloc_allowed should also work in an OMP parallel
environment, right?
Best,
Henrik
PS: Sorry for posting twice. I somehow did not get the mail and just saw
the mails on the online archive.
>
>
> Looks like this:
> https://stackoverflow.com/questions/51043842/call-eigen-gemm-over-externally-allocated-data
>
> It has been fixed a year ago on the devel-branch, but apparently not backported to 3.3:
>
> http://eigen.tuxfamily.org/bz/show_bug.cgi?id=1562
>
>
> If you know the sizes of your matrices at compile time, you should write
>
> const Map<const Matrix<double, 2, 10> > A( _A.data());
> const Map<const Matrix<double, 10, 2> > B( _B.data());
> Map<Matrix2d> C( _C.data());
> double v = 2.0;
> C.noalias() = v * A * B;
>
> If you know can't upgrade to the devel branch, but know that your matrices are small (but with unknown size at compile time), you can write this as a workaround:
>
>
> C.noalias() = v * A.lazyProduct(B);
>
>
> Generally, if you fail to produce a minimal example from scratch, you can start with (a copy of) your code and remove everything which does not let the error disappear, hopefully leaving just a few lines.
>
>
> Cheers,
> Christoph