Re: [eclipse-users] List --> Row

From: Kish Shen <kish_at_...2...>
Date: Mon, 03 Dec 2007 23:11:41 +0000
Marco Gavanelli wrote:
> To insert a column, you can first transpose the matrix, and then insert 
> a row.
>
>   
If it is not convienent to transpose the matrix, then if you are using 
the structure of structure representation Marco mentioned, you can 
directly set the column elements by accessing each row and setting the 
appropriate column element, e.g.

set_col(Col, N, M) :-   % set the column N of matrix M to the values in Col
    (foreacharg(Row, M), foreacharg(E, Col), param(N) do
       arg(N, Row, E)
    ).

[eclipse 16]: dim(M, [3,4]), set_col([](1,2,3),2,M).

M = []([](_270, 1, _272, _273), [](_265, 2, _267, _268), [](_260, 3, 
_262, _263))
Yes (0.00s cpu)
[eclipse 17]:

Cheers,

Kish
Received on Mon Dec 03 2007 - 23:12:05 CET

This archive was generated by hypermail 2.3.0 : Tue Apr 16 2024 - 09:13:20 CEST