<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Matrix : create, read, write in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/matrix-create-read-write/m-p/5893729#M137068</link>
    <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm a full beginner in AutoLISP,&amp;nbsp;having a big issue with matrix. Impossible to find clear help, so I require your advices.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I succeded to create a matrix of 3 dimenssions, (almost) succeeded to read an element... but impossible to write one element.&lt;/P&gt;&lt;P&gt;Have you succeedded or found something about this issue ? If not, how to skirt the problem ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below are my code to create a matric l x c x p containing the element a :&lt;/P&gt;&lt;PRE&gt;(defun ctab3 (a l c p / lin col pro)
 (repeat l (setq lin (cons a lin)))
 (repeat c (setq col (cons lin col)))
 (repeat p (setq pro (cons col pro)))
)&lt;/PRE&gt;&lt;P&gt;And there to search an element in lst (matrix l x c x p) at the rank l-c-p (but the transfer of the list doesn't work) :&lt;/P&gt;&lt;PRE&gt;(defun stab3 (lst p c l)
 (nth l-1 (nth c-1 (nth p-1 lst)))
)&amp;nbsp;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 05 Nov 2015 09:38:05 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2015-11-05T09:38:05Z</dc:date>
    <item>
      <title>Matrix : create, read, write</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/matrix-create-read-write/m-p/5893729#M137068</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm a full beginner in AutoLISP,&amp;nbsp;having a big issue with matrix. Impossible to find clear help, so I require your advices.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I succeded to create a matrix of 3 dimenssions, (almost) succeeded to read an element... but impossible to write one element.&lt;/P&gt;&lt;P&gt;Have you succeedded or found something about this issue ? If not, how to skirt the problem ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below are my code to create a matric l x c x p containing the element a :&lt;/P&gt;&lt;PRE&gt;(defun ctab3 (a l c p / lin col pro)
 (repeat l (setq lin (cons a lin)))
 (repeat c (setq col (cons lin col)))
 (repeat p (setq pro (cons col pro)))
)&lt;/PRE&gt;&lt;P&gt;And there to search an element in lst (matrix l x c x p) at the rank l-c-p (but the transfer of the list doesn't work) :&lt;/P&gt;&lt;PRE&gt;(defun stab3 (lst p c l)
 (nth l-1 (nth c-1 (nth p-1 lst)))
)&amp;nbsp;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Nov 2015 09:38:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/matrix-create-read-write/m-p/5893729#M137068</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-11-05T09:38:05Z</dc:date>
    </item>
    <item>
      <title>Re: Matrix : create, read, write</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/matrix-create-read-write/m-p/5894610#M137069</link>
      <description>Perhaps you should show a few examples of your arrays with their elements in columnar form.</description>
      <pubDate>Thu, 05 Nov 2015 17:04:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/matrix-create-read-write/m-p/5894610#M137069</guid>
      <dc:creator>stevor</dc:creator>
      <dc:date>2015-11-05T17:04:00Z</dc:date>
    </item>
    <item>
      <title>Re: Matrix : create, read, write</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/matrix-create-read-write/m-p/5895465#M137070</link>
      <description>What you are showing in the first code quote panel are three LISTs.&lt;BR /&gt;In other words, three one-dimensional arrays.&lt;BR /&gt;To make it into a two dimensional array (matrix) is to&lt;BR /&gt;bundle these three lists into a single list:&lt;BR /&gt;&lt;BR /&gt;(list&lt;BR /&gt; (repeat l...&lt;BR /&gt; (repeat c...&lt;BR /&gt; (repeat p...&lt;BR /&gt;);list&lt;BR /&gt;&lt;BR /&gt;A pseudo 3-dimensional list can be described as follows:&lt;BR /&gt;(list&lt;BR /&gt; (cons a (list b c d))&lt;BR /&gt; (cons e (list f g h))&lt;BR /&gt;);list&lt;BR /&gt;This works well when reading a INI-structured external file&lt;BR /&gt;where a (and e) is the [Header] inside the INI file.&lt;BR /&gt;&lt;BR /&gt;First Dimension: Left and Right.&lt;BR /&gt;Second Dimension: Up and Down.&lt;BR /&gt;Third dimension: Towards and Away.&lt;BR /&gt;Fourth Dimension: Array or List inside any one of these nuggets.&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;???&lt;BR /&gt;</description>
      <pubDate>Fri, 06 Nov 2015 00:09:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/matrix-create-read-write/m-p/5895465#M137070</guid>
      <dc:creator>scot-65</dc:creator>
      <dc:date>2015-11-06T00:09:03Z</dc:date>
    </item>
    <item>
      <title>Re: Matrix : create, read, write</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/matrix-create-read-write/m-p/5902414#M137071</link>
      <description>&lt;P&gt;(defun stab3 (lst p c l) (nth (- l 1) (nth (- c 1) (nth (- p 1) lst))) )&lt;/P&gt;</description>
      <pubDate>Wed, 11 Nov 2015 04:55:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/matrix-create-read-write/m-p/5902414#M137071</guid>
      <dc:creator>shoukat</dc:creator>
      <dc:date>2015-11-11T04:55:02Z</dc:date>
    </item>
    <item>
      <title>Re: Matrix : create, read, write</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/matrix-create-read-write/m-p/5902549#M137072</link>
      <description>&lt;P&gt;You have hit one of the weak points of AutoLISP: unlike most programming languages, it doesn't have a native array datatype, and rather poor tools for building your own.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I see three possible ways to do this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A) Building this on top of AutoLISP lists. This is made somewhat clumsy by the limitation that in AutoLISP (unlike other Lisp implementations) lists are essentially read-only once created: the only way to change one is to copy it, changing some items in the copying.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;B) Using ActiveX safearrays, see the vlax-make-safearray and vlax-safearray-... functions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;C) Doing this part of your program in some other language. For example I am maintaining a large AutoLISP program where any parts needing a more capable language are implemented in Common Lisp.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;--&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Nov 2015 08:58:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/matrix-create-read-write/m-p/5902549#M137072</guid>
      <dc:creator>martti.halminen</dc:creator>
      <dc:date>2015-11-11T08:58:12Z</dc:date>
    </item>
    <item>
      <title>Re: Matrix : create, read, write</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/matrix-create-read-write/m-p/5904082#M137073</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just a simplistic approach:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(setq matrix (list (list a11 a12 a13) (list a21 a22 a3) (list a31 a32 a33)))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(defun aij(m i j)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;(nth (- i 1) (nth (- j 1) m))&lt;/P&gt;
&lt;P&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(defun DotProduct (v1 v2)&lt;/P&gt;
&lt;P&gt;(apply '+ (mapcar '* v1 v2))&lt;/P&gt;
&lt;P&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And so on...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you need a really good start on matrix algebra with Autolisp, you can visit:&amp;nbsp;&lt;A href="http://www.lee-mac.com/mathematicalfunctions.html#matrixvector" target="_blank"&gt;http://www.lee-mac.com/mathematicalfunctions.html#matrixvector&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Gaston Nunez&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Nov 2015 01:53:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/matrix-create-read-write/m-p/5904082#M137073</guid>
      <dc:creator>hgasty1001</dc:creator>
      <dc:date>2015-11-12T01:53:20Z</dc:date>
    </item>
  </channel>
</rss>

