help-octave
[Top][All Lists]

## Re: How can I tell if a function (rot2q.m) can be vectorized

 From: RT Subject: Re: How can I tell if a function (rot2q.m) can be vectorized Date: Fri, 15 Feb 2019 07:13:49 -0500

Attached rot2q.m file in question

On Fri, Feb 15, 2019 at 7:12 AM RT <address@hidden> wrote:
How can I tell if a function (rot2q.m) can be vectorized?

This is my logic:
1) Convert multiple xyz points in array to quaternions using the function rot2q
2) Do calculations on multiple points from array in quaternions using the function quaternion
3) Convert quaternion array data back to xyz points using the function q2rot
4) Plot new xyz points using the function scatter3

The error I get is

"error: rot2q: first argument 'axis' must be a length three vector
error: called from
rot2q at line 74 column 5
test_quaternion_array_coversion at line 10 column 21"

Does the quaternion functions not allow vectorization?  And if not how can I change the functions to support this?

Some test code is below I've also attached the rot2q.m file :
I'm testing using Octave 5.0.91 on Ubuntu 18.04 64bit

clear all
xyz_angle=[0  1  0  1.570796326794897;0.5  1  0  1.570796326794897]
pt_xyz_angle_to_quat=rot2q ([xyz_angle(:,1),xyz_angle(:,2),xyz_angle(:,3)], xyz_angle(:,4))

--

--
--
|======================================================|
|https://stillpointx.wordpress.com/research/modulated-plasma/
|======================================================|
"Knowledge may be the Key"
"But wisdom unlocks the door"
"Absolute Power demands absolutely nothing"

As the old maxim has it, you need find only one white crow to disprove the rule that all crows are black

"The bourgeois today burns as heretics and hangs as criminals those to whom he erects monuments tomorrow" ('Steppenwolf')

"There are two modes of being those in bliss and those seeking bliss,
may each step you take and each thought you make be made in a mindful and blissful state."
|======================================================|

rot2q.m
Description: Text Data