I need a structure like that, as a custom array 4x4 for 3D-calculations:

Matrix3D = zeros(Float64, 4, 4)

I tried to define it like that, but i stuck:

struct Matrix3D <: Abstract???
???
end

to use it:

myMatrix3D = Matrix3D ???

assigning values like that:

myMatrix3D[1, 4] = 3.0

or working like that:
myMatrix3D[2, 2] = cos(w); myMatrix3D[2, 3] = -sin(w)
myMatrix3D[3, 2] = sin(w); myMatrix3D[3, 3] = cos(w)

any help for me?

Check out StaticArrays.jl for fixed size arrays and maybe Rotations.jl for rotation matrices.

```
# Rotations.jl
*3D rotations made easy in Julia*
[![Build Status](https://travis-ci.org/FugroRoames/Rotations.jl.svg?branch=static_arrays)](https://travis-ci.org/FugroRoames/Rotations.jl)
This package implements various 3D rotation parameterizations and defines
conversions between them. At their heart, each rotation parameterization *is*
a 3×3 unitary (orthogonal) matrix (based on the [StaticArrays.jl package](https://github.com/andyferris/StaticArrays.jl)),
and acts to rotate a 3-vector about the origin through matrix-vector multiplication.
While the `RotMatrix` type is a dense representation of a `3×3` matrix, we also
have sparse (or computed, rather) representations such as quaternions,
angle-axis parameterizations, and Euler angles.
For composing rotations about the origin with other transformations, see also
the [CoordinateTransformations.jl](https://github.com/FugroRoames/CoordinateTransformations.jl)
or [AffineTransforms.jl](https://github.com/timholy/AffineTransforms.jl) packages.
### Example Usage
```

This file has been truncated. show original

tkoolen
October 20, 2018, 3:07pm
#3
Will you be using this type as a homogeneous transform (rotation + translation)?

Will you be using this type as a homogeneous transform (rotation + translation)?

yes, I do

Then try https://github.com/FugroRoames/CoordinateTransformations.jl

2 Likes

TY. It’s already known. For me its important to do I by my self (for learling purposes)

1 Like

I would start by learning the AbstractArray interface . Also make sure you’re up on Parametric types since you’ll probably want to encode array size as a parameter. Then try writing a simple custom type from scratch. You can find many examples of simple AbstractArray types at JuliaArrays .

StaticArrays does what you want and would be a good example, but if you haven’t already written a custom AbstractArray type it might be challenging learning: StaticArrays is very sophisticated and has to jump through hoops to handle immutability.

1 Like

I already tried that but i stucked.

A small working example for me would be very helpful

Take a look at MappedArrays and IndirectArrays ; they’re both relatively simple.