# # spec file for package perl-Math-Vector-Real # # Copyright (c) 2024 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed # upon. The license for this file, and modifications and additions to the # file, is the same license as for the pristine package itself (unless the # license for the pristine package is not an Open Source License, in which # case the license is the MIT License). An "Open Source License" is a # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. # Please submit bugfixes or comments via https://bugs.opensuse.org/ # %define cpan_name Math-Vector-Real Name: perl-Math-Vector-Real Version: 0.180.0 Release: 0 # 0.18 -> normalize -> 0.180.0 %define cpan_version 0.18 License: Artistic-1.0 OR GPL-1.0-or-later Summary: Real vector arithmetic in Perl URL: https://metacpan.org/release/%{cpan_name} Source0: https://cpan.metacpan.org/authors/id/S/SA/SALVA/%{cpan_name}-%{cpan_version}.tar.gz Source1: cpanspec.yml Source100: README.md BuildArch: noarch BuildRequires: perl BuildRequires: perl-macros Provides: perl(Math::Vector::Real) = %{version} Provides: perl(Math::Vector::Real::Test) %undefine __perllib_provides %{perl_requires} %description A simple pure perl module to manipulate vectors of any dimension. The function 'V', always exported by the module, allows one to create new vectors: my $v = V(0, 1, 3, -1); Vectors are represented as blessed array references. It is allowed to manipulate the arrays directly as far as only real numbers are inserted (well, actually, integers are also allowed because from a mathematical point of view, integers are a subset of the real numbers). Example: my $v = V(0.0, 1.0); # extending the 2D vector to 3D: push @$v, 0.0; # setting some component value: $v->[0] = 23; Vectors can be used in mathematical expressions: my $u = V(3, 3, 0); $p = $u * $v; # dot product $f = 1.4 * $u + $v; # scalar product and vector addition $c = $u x $v; # cross product, only defined for 3D vectors # etc. The currently supported operations are: + * / - (both unary and binary) x (cross product for 3D vectors) += -= *= /= x= == != "" (stringfication) abs (returns the norm) atan2 (returns the angle between two vectors) That, AFAIK, are all the operations that can be applied to vectors. When an array reference is used in an operation involving a vector, it is automatically upgraded to a vector. For instance: my $v = V(1, 2); $v += [0, 2]; %prep %autosetup -n %{cpan_name}-%{cpan_version} %build perl Makefile.PL INSTALLDIRS=vendor %make_build %check make test %install %perl_make_install %perl_process_packlist %perl_gen_filelist %files -f %{name}.files %doc Changes examples README %changelog