{"id":427343,"date":"2024-07-25T21:38:06","date_gmt":"2024-07-25T21:38:06","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=427343"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=427343","title":{"rendered":"<span>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 nalgebra \u0432 Rust<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p><em>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440!<\/em><\/p>\n<p>\u041b\u0438\u043d\u0435\u0439\u043d\u0430\u044f \u0430\u043b\u0433\u0435\u0431\u0440\u0430 \u0441\u0435\u0439\u0447\u0430\u0441 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0432\u0435\u0437\u0434\u0435. \u0412 \u0441\u0432\u044f\u0437\u0441 \u0441 \u044d\u0442\u0438\u043c \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043e\u0434\u043d\u0443 \u0438\u0437 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0434\u043b\u044f Rust \u2014 <strong>nalgebra<\/strong>.<\/p>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0446\u0435\u043b\u044c nalgebra \u2014 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0439 \u0430\u043b\u0433\u0435\u0431\u0440\u043e\u0439.<\/p>\n<h2>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438<\/h2>\n<h4>\u0412\u0435\u043a\u0442\u043e\u0440\u044b<\/h4>\n<p>\u0412\u0435\u043a\u0442\u043e\u0440\u044b \u0432 nalgebra \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043a\u0430\u043a \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438, \u0442\u0430\u043a \u0438 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u044b\u0434\u0435\u043b\u044f\u0435\u043c\u044b\u043c\u0438. \u0412\u0435\u043a\u0442\u043e\u0440\u044b \u0441\u043e \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u0430\u043c\u0438 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0438 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 \u0441\u0442\u0435\u043a\u0435, \u0442\u043e\u0433\u0434\u0430 \u043a\u0430\u043a \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0432\u0435\u043a\u0442\u043e\u0440\u044b \u0432\u044b\u0434\u0435\u043b\u044f\u044e\u0442\u0441\u044f \u0432 \u043a\u0443\u0447\u0435.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0432\u0435\u043a\u0442\u043e\u0440\u0430:<\/p>\n<pre><code class=\"rust\">use nalgebra::Vector3;  fn main() {     let v = Vector3::new(1.0, 2.0, 3.0);     println!(\"Vector: {:?}\", v); }<\/code><\/pre>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0432\u0435\u043a\u0442\u043e\u0440\u0430:<\/p>\n<pre><code class=\"rust\">use nalgebra::DVector;  fn main() {     let v = DVector::from_vec(vec![1.0, 2.0, 3.0, 4.0]);     println!(\"Dynamic Vector: {:?}\", v); }<\/code><\/pre>\n<h4>\u041c\u0430\u0442\u0440\u0438\u0446\u044b<\/h4>\n<p>\u041c\u0430\u0442\u0440\u0438\u0446\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u0438 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438. \u0421\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0438\u043c\u0435\u044e\u0442 \u0440\u0430\u0437\u043c\u0435\u0440\u044b, \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0435 \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438, \u0442\u043e\u0433\u0434\u0430 \u043a\u0430\u043a \u0440\u0430\u0437\u043c\u0435\u0440\u044b \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043c\u0430\u0442\u0440\u0438\u0446 \u043c\u043e\u0433\u0443\u0442 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f.<\/p>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0440 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u044b:<\/strong><\/p>\n<pre><code class=\"rust\">use nalgebra::Matrix3;  fn main() {     let m = Matrix3::new(1.0, 2.0, 3.0,                          4.0, 5.0, 6.0,                          7.0, 8.0, 9.0);     println!(\"Matrix:\\n{}\", m); }<\/code><\/pre>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0440 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u044b:<\/strong><\/p>\n<pre><code class=\"rust\">use nalgebra::DMatrix;  fn main() {     let m = DMatrix::from_row_slice(3, 3, &amp;[         1.0, 2.0, 3.0,         4.0, 5.0, 6.0,         7.0, 8.0, 9.0     ]);     println!(\"Dynamic Matrix:\\n{}\", m); }<\/code><\/pre>\n<p>\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441 \u0432\u0435\u043a\u0442\u043e\u0440\u0430\u043c\u0438 \u0438 \u043c\u0430\u0442\u0440\u0438\u0446\u0430\u043c\u0438 \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0442 \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435, \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u0438\u043d\u0432\u0435\u0440\u0441\u0438\u044e \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438.<\/p>\n<h4>\u0422\u043e\u0447\u043a\u0438 \u0438 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438<\/h4>\n<p><strong>\u0422\u043e\u0447\u043a\u0438<\/strong><\/p>\n<p>\u0422\u043e\u0447\u043a\u0438 \u0432 nalgebra \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0441\u043e\u0431\u043e\u0439 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0432 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435. \u0418\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0434\u043b\u044f \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u0432\u0435\u043a\u0442\u043e\u0440\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0442 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0438 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u044f.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"rust\">use nalgebra::{Point2, Point3};  fn main() {     let p2 = Point2::new(1.0, 2.0);     let p3 = Point3::new(1.0, 2.0, 3.0);          println!(\"Point2: {:?}\", p2);     println!(\"Point3: {:?}\", p3); }<\/code><\/pre>\n<p><strong>\u0422\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438<\/strong><\/p>\n<p>\u0422\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0442 \u0432 \u0441\u0435\u0431\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a <em>\u043f\u0435\u0440\u0435\u0432\u043e\u0434\u044b<\/em>, <em>\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f<\/em> \u0438 <em>\u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/em>.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"rust\">use nalgebra::{Translation3, Rotation3, Isometry3, Vector3};  fn main() {     let translation = Translation3::new(1.0, 2.0, 3.0);     let rotation = Rotation3::from_axis_angle(&amp;Vector3::z_axis(), 0.785398163); \/\/ 45 degrees in radians      let isometry = Isometry3::new(translation.vector, rotation.scaled_axis());          println!(\"Isometry:\\n{}\", isometry); }<\/code><\/pre>\n<h4>\u0421\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0434\u0430\u043d\u043d\u044b\u0445<\/h4>\n<p><strong>\u041a\u0432\u0430\u0442\u0435\u0440\u043d\u0438\u043e\u043d\u044b<\/strong><\/p>\n<p>\u041a\u0432\u0430\u0442\u0435\u0440\u043d\u0438\u043e\u043d\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f 3D \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0439. \u0418\u043d\u043e\u0433\u0434\u0430 \u044d\u0442\u043e \u043d\u0435\u043a\u0438\u0439 \u043c\u0430\u0441\u0442\u0445\u0435\u0432 \u0434\u043b\u044f \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0439 \u0438 \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0438\u0437-\u0437\u0430 \u0441\u0432\u043e\u0435\u0439 \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u043e\u0441\u0442\u0438 \u0438 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u044d\u0444\u0444\u0435\u043a\u0442\u0430 &#171;<em>\u0433\u0438\u043c\u0431\u0430\u043b\u043b\u043e\u043a<\/em>&#171;.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"rust\">use nalgebra::{Quaternion, UnitQuaternion};  fn main() {     let axis = Vector3::y_axis();     let angle = 1.57; \/\/ 90 degrees in radians      let quaternion = UnitQuaternion::from_axis_angle(&amp;axis, angle);          println!(\"Quaternion: {:?}\", quaternion); }<\/code><\/pre>\n<p><strong>\u0418\u0437\u043e\u043c\u0435\u0442\u0440\u0438\u0438<\/strong><\/p>\n<p>\u0418\u0437\u043e\u043c\u0435\u0442\u0440\u0438\u044f \u0441\u043e\u0447\u0435\u0442\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u0435 \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u0438 \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0435. \u042d\u0442\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043d\u0443\u0436\u043d\u0430 \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u0437\u0438\u0446\u0438\u0439 \u0438 \u043e\u0440\u0438\u0435\u043d\u0442\u0430\u0446\u0438\u0439 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"rust\">use nalgebra::{Isometry3, Vector3};  fn main() {     let translation = Vector3::new(1.0, 2.0, 3.0);     let rotation = Vector3::new(0.0, 1.0, 0.0); \/\/ Rotate around Y axis      let iso = Isometry3::new(translation, rotation);          println!(\"Isometry:\\n{}\", iso); }<\/code><\/pre>\n<p><strong>\u0413\u043e\u043c\u043e\u0433\u0435\u043d\u043d\u044b\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b<\/strong><\/p>\n<p>\u0413\u043e\u043c\u043e\u0433\u0435\u043d\u043d\u044b\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043e\u0431\u0449\u0438\u0445 \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0445 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0439: \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u044b, \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f, \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u0441\u0434\u0432\u0438\u0433\u0438.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"rust\">use nalgebra::Matrix4;  fn main() {     let mut m = Matrix4::identity();     m[(0, 3)] = 1.0; \/\/ Translation along X axis     m[(1, 1)] = 0.5; \/\/ Scaling along Y axis          println!(\"Homogeneous Matrix:\\n{}\", m); }<\/code><\/pre>\n<h2>\u041f\u0440\u043e\u0447\u0438\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438<\/h2>\n<h4>\u0424\u0430\u043a\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u0430\u0442\u0440\u0438\u0446<\/h4>\n<p>\u0424\u0430\u043a\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u043c\u0430\u0442\u0440\u0438\u0446 \u2014 \u044d\u0442\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0440\u0430\u0437\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u043d\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043c\u0430\u0442\u0440\u0438\u0446, \u0447\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0447\u0430\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0441\u0438\u0441\u0442\u0435\u043c \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0445 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439, \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043e\u0431\u0440\u0430\u0442\u043d\u044b\u0445 \u043c\u0430\u0442\u0440\u0438\u0446 \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u0435\u0439.<\/p>\n<p><strong>LU-\u0440\u0430\u0437\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/strong><\/p>\n<p>LU-\u0440\u0430\u0437\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0435\u0442 \u043c\u0430\u0442\u0440\u0438\u0446\u0443 \u043d\u0430 \u043d\u0438\u0436\u043d\u044e\u044e \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0443\u044e \u043c\u0430\u0442\u0440\u0438\u0446\u0443 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"L \" alt=\"L \" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/bf6\/e95\/ddd\/bf6e95ddd7948b47e654992f205ae372.svg\" width=\"13\" height=\"17\"\/> \u0438 \u0432\u0435\u0440\u0445\u043d\u044e\u044e \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0443\u044e \u043c\u0430\u0442\u0440\u0438\u0446\u0443 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"U\" alt=\"U\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a2f\/ea0\/798\/a2fea079805417eef37d73af7fd2a411.svg\" width=\"15\" height=\"17\"\/>.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u0434\u0430:<\/p>\n<pre><code class=\"rust\">use nalgebra::DMatrix;  fn main() {     let matrix = DMatrix::from_row_slice(3, 3, &amp;[2.0, 1.0, 1.0,                                                  4.0, -6.0, 0.0,                                                  -2.0, 7.0, 2.0]);     let lu = matrix.lu();     let l = lu.l();     let u = lu.u();     println!(\"L:\\n{}\", l);     println!(\"U:\\n{}\", u); } <\/code><\/pre>\n<p><strong>QR-\u0440\u0430\u0437\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/strong><\/p>\n<p>QR-\u0440\u0430\u0437\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u043b\u0430\u0433\u0430\u0435\u0442 \u043c\u0430\u0442\u0440\u0438\u0446\u0443 \u043d\u0430 \u043e\u0440\u0442\u043e\u0433\u043e\u043d\u0430\u043b\u044c\u043d\u0443\u044e \u043c\u0430\u0442\u0440\u0438\u0446\u0443 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"Q \" alt=\"Q \" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/dac\/ef2\/80c\/dacef280c761af4213583a394eee7143.svg\" width=\"15\" height=\"20\"\/>\u0438 \u0432\u0435\u0440\u0445\u043d\u044e\u044e \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0443\u044e \u043c\u0430\u0442\u0440\u0438\u0446\u0443 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"R\" alt=\"R\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/75f\/354\/393\/75f354393f4fb4b357edd23cac699997.svg\" width=\"15\" height=\"17\"\/>.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u0434\u0430:<\/p>\n<pre><code class=\"rust\">use nalgebra::DMatrix;  fn main() {     let matrix = DMatrix::from_row_slice(3, 3, &amp;[12.0, -51.0, 4.0,                                                  6.0, 167.0, -68.0,                                                 -4.0, 24.0, -41.0]);     let qr = matrix.qr();     let q = qr.q();     let r = qr.r();     println!(\"Q:\\n{}\", q);     println!(\"R:\\n{}\", r); }<\/code><\/pre>\n<p><strong>SVD-\u0440\u0430\u0437\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/strong><\/p>\n<p>SVD-\u0440\u0430\u0437\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043c\u0430\u0442\u0440\u0438\u0446\u0443 \u0432 \u0432\u0438\u0434\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0442\u0440\u0435\u0445 \u043c\u0430\u0442\u0440\u0438\u0446: <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"U\" alt=\"U\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b2a\/7da\/8e7\/b2a7da8e7fc6d6f6a9a53bf3756cdb08.svg\" width=\"15\" height=\"17\"\/>, <img decoding=\"async\" class=\"formula inline\" source=\"\u03a3\" alt=\"\u03a3\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/e\/e1\/e15\/e15c0eb40e61adefe95778c26e7840f6.svg\" width=\"auto\" height=\"auto\"\/> \u0434\u0438\u0430\u0433\u043e\u043d\u0430\u043b\u044c\u043d\u0430\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u0430 \u0441 \u0441\u0438\u043d\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u0438 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"V^*\" alt=\"V^*\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b19\/925\/c23\/b19925c234e88a883ac75b0f32e7e253.svg\" width=\"25\" height=\"18\"\/>.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0440\u0430\u0437\u043b\u043e\u0436\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"rust\">use nalgebra::DMatrix;  fn main() {     let matrix = DMatrix::from_row_slice(3, 2, &amp;[1.0, 0.0,                                                  0.0, 1.0,                                                  1.0, 1.0]);     let svd = matrix.svd(true, true);     let u = svd.u.unwrap();     let s = svd.singular_values;     let v_t = svd.v_t.unwrap();     println!(\"U:\\n{}\", u);     println!(\"\u03a3:\\n{}\", s);     println!(\"V^T:\\n{}\", v_t); }<\/code><\/pre>\n<h4>\u0421\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0432\u0438\u0434\u044b \u043c\u0430\u0442\u0440\u0438\u0446<\/h4>\n<p><strong>\u0420\u0430\u0437\u0440\u0435\u0436\u0435\u043d\u043d\u044b\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b<\/strong><\/p>\n<p>\u0420\u0430\u0437\u0440\u0435\u0436\u0435\u043d\u043d\u044b\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043d\u0443\u043b\u0435\u0432\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b, \u0447\u0442\u043e \u0447\u0430\u0441\u0442\u0435\u043d\u044c\u043a\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u044c \u043f\u0430\u043c\u044f\u0442\u044c. \u0412 nalgebra \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0444\u043e\u0440\u043c\u0430\u0442\u044b \u0440\u0430\u0437\u0440\u0435\u0436\u0435\u043d\u043d\u044b\u0445 \u043c\u0430\u0442\u0440\u0438\u0446, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a compressed sparse column \u0438 compressed sparse row.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0440\u0430\u0437\u0440\u0435\u0436\u0435\u043d\u043d\u043e\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u044b:<\/p>\n<pre><code class=\"rust\">use nalgebra_sparse::csr::CsrMatrix;  fn main() {     let num_rows = 4;     let num_cols = 4;     let row_offsets = vec![0, 2, 4, 7, 8];     let col_indices = vec![0, 1, 1, 2, 0, 2, 3, 3];     let values = vec![10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0];     let csr = CsrMatrix::try_from_csr_data(num_rows, num_cols, row_offsets, col_indices, values).unwrap();     println!(\"CSR Matrix:\\n{}\", csr); }<\/code><\/pre>\n<p><strong>\u041e\u0440\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0438 \u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0435 \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u0438<\/strong><\/p>\n<p>\u041e\u0440\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0438 \u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0435 \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0432 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043d\u043e\u0439 \u0433\u0440\u0430\u0444\u0438\u043a\u0435 \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0442\u0440\u0435\u0445\u043c\u0435\u0440\u043d\u044b\u0445 \u0441\u0446\u0435\u043d \u043d\u0430 \u0434\u0432\u0443\u043c\u0435\u0440\u043d\u044b\u0439 \u044d\u043a\u0440\u0430\u043d.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u043e\u0440\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u0438:<\/p>\n<pre><code class=\"rust\">use nalgebra::Orthographic3;  fn main() {     let orthographic = Orthographic3::new(-1.0, 1.0, -1.0, 1.0, 0.1, 100.0);     println!(\"Orthographic Projection:\\n{}\", orthographic.as_matrix()); }<\/code><\/pre>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u0438:<\/p>\n<pre><code class=\"rust\">use nalgebra::Perspective3;  fn main() {     let perspective = Perspective3::new(16.0 \/ 9.0, 3.14 \/ 4.0, 0.1, 100.0);     println!(\"Perspective Projection:\\n{}\", perspective.as_matrix()); }<\/code><\/pre>\n<h3>\u0412\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043d\u0430 GPU \u0438 \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u044b\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b<\/h3>\n<p>Nalgebra \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u044e \u0434\u043b\u044f WebAssembly \u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u044b\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0434\u043b\u044f WebAssembly:<\/p>\n<pre><code># \u0412 Cargo.toml \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 wasm [dependencies] nalgebra = \"0.27\" wasm-bindgen = \"0.2\"  # \u0412 main.rs use nalgebra::Vector3; use wasm_bindgen::prelude::*;  #[wasm_bindgen] pub fn add_vectors(a: &amp;Vector3&lt;f32&gt;, b: &amp;Vector3&lt;f32&gt;) -&gt; Vector3&lt;f32&gt; {     a + b }<\/code><\/pre>\n<p>\u0414\u043b\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0435\u0441\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0430:<\/p>\n<pre><code>wasm-pack build --target web<\/code><\/pre>\n<p>Nalgebra \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0441 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430\u043c\u0438 \u0434\u043b\u044f GPU \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439, \u0442\u0430\u043a\u0438\u043c\u0438 \u043a\u0430\u043a <a href=\"https:\/\/github.com\/gfx-rs\/wgpu\">wgpu <\/a>\u0438 <a href=\"https:\/\/github.com\/ash-rs\/ash\">ash<\/a>.<\/p>\n<p>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 nalgebra  \u2014 \u043c\u043e\u0449\u043d\u044b\u0439 \u0438 \u0433\u0438\u0431\u043a\u0438\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0439 \u0430\u043b\u0433\u0435\u0431\u0440\u043e\u0439 \u0432 Rust.<\/p>\n<p>\u2022\u200e  <a href=\"https:\/\/github.com\/dimforge\/nalgebra\">nalgebra \u043d\u0430 GitHub<\/a><\/p>\n<hr\/>\n<p>\u0427\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u043d\u0435\u043e\u043f\u044b\u0442\u043d\u0430\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430, \u0430 \u043d\u0430\u0434\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443? \u041c\u043e\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0437\u0430\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u0431 \u0443\u0432\u043e\u043b\u044c\u043d\u0435\u043d\u0438\u0438, \u0430 \u043f\u043e\u0442\u043e\u043c \u0441 \u0443\u0436\u0430\u0441\u043e\u043c \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435 \u043f\u0440\u043e \u043f\u0440\u043e\u0448\u043b\u044b\u0435 \u043c\u0435\u0441\u0442\u0430 \u0440\u0430\u0431\u043e\u0442\u044b. \u0410 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0432\u044b\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442. \u041d\u0430 \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u043c \u0443\u0440\u043e\u043a\u0435 \u043c\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u043e\u0431\u0441\u0443\u0436\u0434\u0430\u0442\u044c, \u043a\u0430\u043a\u0430\u044f \u0438\u0437 \u044d\u0442\u0438\u0445 \u0434\u0432\u0443\u0445 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0439 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0430\u044f, \u043d\u043e \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0430 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043c\u043e\u0447\u044c \u0432\u044b\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0440\u0435\u0448\u0438\u0442\u044c \u044d\u0442\u0443 \u0442\u0440\u0443\u0434\u043d\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443.<\/p>\n<p>\u0423\u0440\u043e\u043a \u043f\u0440\u043e\u0439\u0434\u0451\u0442 \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043a\u0443\u0440\u0441\u0430 \u00ab\u041c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0430 \u0434\u043b\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u0432\u00bb 26 \u0438\u044e\u043b\u044f. <a href=\"https:\/\/otus.pw\/cx83\/\">\u0417\u0430\u043f\u0438\u0441\u0430\u0442\u044c\u0441\u044f \u043c\u043e\u0436\u043d\u043e \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435.<\/a><\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/828316\/\"> https:\/\/habr.com\/ru\/articles\/828316\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p><em>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440!<\/em><\/p>\n<p>\u041b\u0438\u043d\u0435\u0439\u043d\u0430\u044f \u0430\u043b\u0433\u0435\u0431\u0440\u0430 \u0441\u0435\u0439\u0447\u0430\u0441 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0432\u0435\u0437\u0434\u0435. \u0412 \u0441\u0432\u044f\u0437\u0441 \u0441 \u044d\u0442\u0438\u043c \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043e\u0434\u043d\u0443 \u0438\u0437 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0434\u043b\u044f Rust \u2014 <strong>nalgebra<\/strong>.<\/p>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0446\u0435\u043b\u044c nalgebra \u2014 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0439 \u0430\u043b\u0433\u0435\u0431\u0440\u043e\u0439.<\/p>\n<h2>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438<\/h2>\n<h4>\u0412\u0435\u043a\u0442\u043e\u0440\u044b<\/h4>\n<p>\u0412\u0435\u043a\u0442\u043e\u0440\u044b \u0432 nalgebra \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043a\u0430\u043a \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438, \u0442\u0430\u043a \u0438 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u044b\u0434\u0435\u043b\u044f\u0435\u043c\u044b\u043c\u0438. \u0412\u0435\u043a\u0442\u043e\u0440\u044b \u0441\u043e \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u0430\u043c\u0438 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0438 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 \u0441\u0442\u0435\u043a\u0435, \u0442\u043e\u0433\u0434\u0430 \u043a\u0430\u043a \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0432\u0435\u043a\u0442\u043e\u0440\u044b \u0432\u044b\u0434\u0435\u043b\u044f\u044e\u0442\u0441\u044f \u0432 \u043a\u0443\u0447\u0435.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0432\u0435\u043a\u0442\u043e\u0440\u0430:<\/p>\n<pre><code class=\"rust\">use nalgebra::Vector3;  fn main() {     let v = Vector3::new(1.0, 2.0, 3.0);     println!(\"Vector: {:?}\", v); }<\/code><\/pre>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0432\u0435\u043a\u0442\u043e\u0440\u0430:<\/p>\n<pre><code class=\"rust\">use nalgebra::DVector;  fn main() {     let v = DVector::from_vec(vec![1.0, 2.0, 3.0, 4.0]);     println!(\"Dynamic Vector: {:?}\", v); }<\/code><\/pre>\n<h4>\u041c\u0430\u0442\u0440\u0438\u0446\u044b<\/h4>\n<p>\u041c\u0430\u0442\u0440\u0438\u0446\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u0438 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438. \u0421\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0438\u043c\u0435\u044e\u0442 \u0440\u0430\u0437\u043c\u0435\u0440\u044b, \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0435 \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438, \u0442\u043e\u0433\u0434\u0430 \u043a\u0430\u043a \u0440\u0430\u0437\u043c\u0435\u0440\u044b \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043c\u0430\u0442\u0440\u0438\u0446 \u043c\u043e\u0433\u0443\u0442 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f.<\/p>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0440 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u044b:<\/strong><\/p>\n<pre><code class=\"rust\">use nalgebra::Matrix3;  fn main() {     let m = Matrix3::new(1.0, 2.0, 3.0,                          4.0, 5.0, 6.0,                          7.0, 8.0, 9.0);     println!(\"Matrix:\\n{}\", m); }<\/code><\/pre>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0440 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u044b:<\/strong><\/p>\n<pre><code class=\"rust\">use nalgebra::DMatrix;  fn main() {     let m = DMatrix::from_row_slice(3, 3, &amp;[         1.0, 2.0, 3.0,         4.0, 5.0, 6.0,         7.0, 8.0, 9.0     ]);     println!(\"Dynamic Matrix:\\n{}\", m); }<\/code><\/pre>\n<p>\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441 \u0432\u0435\u043a\u0442\u043e\u0440\u0430\u043c\u0438 \u0438 \u043c\u0430\u0442\u0440\u0438\u0446\u0430\u043c\u0438 \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0442 \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435, \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u0438\u043d\u0432\u0435\u0440\u0441\u0438\u044e \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438.<\/p>\n<h4>\u0422\u043e\u0447\u043a\u0438 \u0438 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438<\/h4>\n<p><strong>\u0422\u043e\u0447\u043a\u0438<\/strong><\/p>\n<p>\u0422\u043e\u0447\u043a\u0438 \u0432 nalgebra \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0441\u043e\u0431\u043e\u0439 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0432 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435. \u0418\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0434\u043b\u044f \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u0432\u0435\u043a\u0442\u043e\u0440\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0442 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0438 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u044f.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"rust\">use nalgebra::{Point2, Point3};  fn main() {     let p2 = Point2::new(1.0, 2.0);     let p3 = Point3::new(1.0, 2.0, 3.0);          println!(\"Point2: {:?}\", p2);     println!(\"Point3: {:?}\", p3); }<\/code><\/pre>\n<p><strong>\u0422\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438<\/strong><\/p>\n<p>\u0422\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0442 \u0432 \u0441\u0435\u0431\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a <em>\u043f\u0435\u0440\u0435\u0432\u043e\u0434\u044b<\/em>, <em>\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f<\/em> \u0438 <em>\u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/em>.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"rust\">use nalgebra::{Translation3, Rotation3, Isometry3, Vector3};  fn main() {     let translation = Translation3::new(1.0, 2.0, 3.0);     let rotation = Rotation3::from_axis_angle(&amp;Vector3::z_axis(), 0.785398163); \/\/ 45 degrees in radians      let isometry = Isometry3::new(translation.vector, rotation.scaled_axis());          println!(\"Isometry:\\n{}\", isometry); }<\/code><\/pre>\n<h4>\u0421\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0434\u0430\u043d\u043d\u044b\u0445<\/h4>\n<p><strong>\u041a\u0432\u0430\u0442\u0435\u0440\u043d\u0438\u043e\u043d\u044b<\/strong><\/p>\n<p>\u041a\u0432\u0430\u0442\u0435\u0440\u043d\u0438\u043e\u043d\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f 3D \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0439. \u0418\u043d\u043e\u0433\u0434\u0430 \u044d\u0442\u043e \u043d\u0435\u043a\u0438\u0439 \u043c\u0430\u0441\u0442\u0445\u0435\u0432 \u0434\u043b\u044f \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0439 \u0438 \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0438\u0437-\u0437\u0430 \u0441\u0432\u043e\u0435\u0439 \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u043e\u0441\u0442\u0438 \u0438 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u044d\u0444\u0444\u0435\u043a\u0442\u0430 &#171;<em>\u0433\u0438\u043c\u0431\u0430\u043b\u043b\u043e\u043a<\/em>&#171;.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"rust\">use nalgebra::{Quaternion, UnitQuaternion};  fn main() {     let axis = Vector3::y_axis();     let angle = 1.57; \/\/ 90 degrees in radians      let quaternion = UnitQuaternion::from_axis_angle(&amp;axis, angle);          println!(\"Quaternion: {:?}\", quaternion); }<\/code><\/pre>\n<p><strong>\u0418\u0437\u043e\u043c\u0435\u0442\u0440\u0438\u0438<\/strong><\/p>\n<p>\u0418\u0437\u043e\u043c\u0435\u0442\u0440\u0438\u044f \u0441\u043e\u0447\u0435\u0442\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u0435 \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u0438 \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0435. \u042d\u0442\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043d\u0443\u0436\u043d\u0430 \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u0437\u0438\u0446\u0438\u0439 \u0438 \u043e\u0440\u0438\u0435\u043d\u0442\u0430\u0446\u0438\u0439 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"rust\">use nalgebra::{Isometry3, Vector3};  fn main() {     let translation = Vector3::new(1.0, 2.0, 3.0);     let rotation = Vector3::new(0.0, 1.0, 0.0); \/\/ Rotate around Y axis      let iso = Isometry3::new(translation, rotation);          println!(\"Isometry:\\n{}\", iso); }<\/code><\/pre>\n<p><strong>\u0413\u043e\u043c\u043e\u0433\u0435\u043d\u043d\u044b\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b<\/strong><\/p>\n<p>\u0413\u043e\u043c\u043e\u0433\u0435\u043d\u043d\u044b\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043e\u0431\u0449\u0438\u0445 \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0445 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0439: \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u044b, \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f, \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u0441\u0434\u0432\u0438\u0433\u0438.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"rust\">use nalgebra::Matrix4;  fn main() {     let mut m = Matrix4::identity();     m[(0, 3)] = 1.0; \/\/ Translation along X axis     m[(1, 1)] = 0.5; \/\/ Scaling along Y axis          println!(\"Homogeneous Matrix:\\n{}\", m); }<\/code><\/pre>\n<h2>\u041f\u0440\u043e\u0447\u0438\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438<\/h2>\n<h4>\u0424\u0430\u043a\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u0430\u0442\u0440\u0438\u0446<\/h4>\n<p>\u0424\u0430\u043a\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u043c\u0430\u0442\u0440\u0438\u0446 \u2014 \u044d\u0442\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0440\u0430\u0437\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u043d\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043c\u0430\u0442\u0440\u0438\u0446, \u0447\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0447\u0430\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0441\u0438\u0441\u0442\u0435\u043c \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0445 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439, \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043e\u0431\u0440\u0430\u0442\u043d\u044b\u0445 \u043c\u0430\u0442\u0440\u0438\u0446 \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u0435\u0439.<\/p>\n<p><strong>LU-\u0440\u0430\u0437\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/strong><\/p>\n<p>LU-\u0440\u0430\u0437\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0435\u0442 \u043c\u0430\u0442\u0440\u0438\u0446\u0443 \u043d\u0430 \u043d\u0438\u0436\u043d\u044e\u044e \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0443\u044e \u043c\u0430\u0442\u0440\u0438\u0446\u0443  \u0438 \u0432\u0435\u0440\u0445\u043d\u044e\u044e \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0443\u044e \u043c\u0430\u0442\u0440\u0438\u0446\u0443 .<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u0434\u0430:<\/p>\n<pre><code class=\"rust\">use nalgebra::DMatrix;  fn main() {     let matrix = DMatrix::from_row_slice(3, 3, &amp;[2.0, 1.0, 1.0,                                                  4.0, -6.0, 0.0,                                                  -2.0, 7.0, 2.0]);     let lu = matrix.lu();     let l = lu.l();     let u = lu.u();     println!(\"L:\\n{}\", l);     println!(\"U:\\n{}\", u); } <\/code><\/pre>\n<p><strong>QR-\u0440\u0430\u0437\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/strong><\/p>\n<p>QR-\u0440\u0430\u0437\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u043b\u0430\u0433\u0430\u0435\u0442 \u043c\u0430\u0442\u0440\u0438\u0446\u0443 \u043d\u0430 \u043e\u0440\u0442\u043e\u0433\u043e\u043d\u0430\u043b\u044c\u043d\u0443\u044e \u043c\u0430\u0442\u0440\u0438\u0446\u0443 \u0438 \u0432\u0435\u0440\u0445\u043d\u044e\u044e \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0443\u044e \u043c\u0430\u0442\u0440\u0438\u0446\u0443 .<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u0434\u0430:<\/p>\n<pre><code class=\"rust\">use nalgebra::DMatrix;  fn main() {     let matrix = DMatrix::from_row_slice(3, 3, &amp;[12.0, -51.0, 4.0,                                                  6.0, 167.0, -68.0,                                                 -4.0, 24.0, -41.0]);     let qr = matrix.qr();     let q = qr.q();     let r = qr.r();     println!(\"Q:\\n{}\", q);     println!(\"R:\\n{}\", r); }<\/code><\/pre>\n<p><strong>SVD-\u0440\u0430\u0437\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/strong><\/p>\n<p>SVD-\u0440\u0430\u0437\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043c\u0430\u0442\u0440\u0438\u0446\u0443 \u0432 \u0432\u0438\u0434\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0442\u0440\u0435\u0445 \u043c\u0430\u0442\u0440\u0438\u0446: ,  \u0434\u0438\u0430\u0433\u043e\u043d\u0430\u043b\u044c\u043d\u0430\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u0430 \u0441 \u0441\u0438\u043d\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u0438 .<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0440\u0430\u0437\u043b\u043e\u0436\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"rust\">use nalgebra::DMatrix;  fn main() {     let matrix = DMatrix::from_row_slice(3, 2, &amp;[1.0, 0.0,                                                  0.0, 1.0,                                                  1.0, 1.0]);     let svd = matrix.svd(true, true);     let u = svd.u.unwrap();     let s = svd.singular_values;     let v_t = svd.v_t.unwrap();     println!(\"U:\\n{}\", u);     println!(\"\u03a3:\\n{}\", s);     println!(\"V^T:\\n{}\", v_t); }<\/code><\/pre>\n<h4>\u0421\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0432\u0438\u0434\u044b \u043c\u0430\u0442\u0440\u0438\u0446<\/h4>\n<p><strong>\u0420\u0430\u0437\u0440\u0435\u0436\u0435\u043d\u043d\u044b\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b<\/strong><\/p>\n<p>\u0420\u0430\u0437\u0440\u0435\u0436\u0435\u043d\u043d\u044b\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043d\u0443\u043b\u0435\u0432\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b, \u0447\u0442\u043e \u0447\u0430\u0441\u0442\u0435\u043d\u044c\u043a\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u044c \u043f\u0430\u043c\u044f\u0442\u044c. \u0412 nalgebra \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0444\u043e\u0440\u043c\u0430\u0442\u044b \u0440\u0430\u0437\u0440\u0435\u0436\u0435\u043d\u043d\u044b\u0445 \u043c\u0430\u0442\u0440\u0438\u0446, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a compressed sparse column \u0438 compressed sparse row.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0440\u0430\u0437\u0440\u0435\u0436\u0435\u043d\u043d\u043e\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u044b:<\/p>\n<pre><code class=\"rust\">use nalgebra_sparse::csr::CsrMatrix;  fn main() {     let num_rows = 4;     let num_cols = 4;     let row_offsets = vec![0, 2, 4, 7, 8];     let col_indices = vec![0, 1, 1, 2, 0, 2, 3, 3];     let values = vec![10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0];     let csr = CsrMatrix::try_from_csr_data(num_rows, num_cols, row_offsets, col_indices, values).unwrap();     println!(\"CSR Matrix:\\n{}\", csr); }<\/code><\/pre>\n<p><strong>\u041e\u0440\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0438 \u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0435 \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u0438<\/strong><\/p>\n<p>\u041e\u0440\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0438 \u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0435 \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0432 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043d\u043e\u0439 \u0433\u0440\u0430\u0444\u0438\u043a\u0435 \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0442\u0440\u0435\u0445\u043c\u0435\u0440\u043d\u044b\u0445 \u0441\u0446\u0435\u043d \u043d\u0430 \u0434\u0432\u0443\u043c\u0435\u0440\u043d\u044b\u0439 \u044d\u043a\u0440\u0430\u043d.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u043e\u0440\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u0438:<\/p>\n<pre><code class=\"rust\">use nalgebra::Orthographic3;  fn main() {     let orthographic = Orthographic3::new(-1.0, 1.0, -1.0, 1.0, 0.1, 100.0);     println!(\"Orthographic Projection:\\n{}\", orthographic.as_matrix()); }<\/code><\/pre>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u0438:<\/p>\n<pre><code class=\"rust\">use nalgebra::Perspective3;  fn main() {     let perspective = Perspective3::new(16.0 \/ 9.0, 3.14 \/ 4.0, 0.1, 100.0);     println!(\"Perspective Projection:\\n{}\", perspective.as_matrix()); }<\/code><\/pre>\n<h3>\u0412\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043d\u0430 GPU \u0438 \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u044b\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b<\/h3>\n<p>Nalgebra \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u044e \u0434\u043b\u044f WebAssembly \u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u044b\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0434\u043b\u044f WebAssembly:<\/p>\n<pre><code># \u0412 Cargo.toml \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 wasm [dependencies] nalgebra = \"0.27\" wasm-bindgen = \"0.2\"  # \u0412 main.rs use nalgebra::Vector3; use wasm_bindgen::prelude::*;  #[wasm_bindgen] pub fn add_vectors(a: &amp;Vector3&lt;f32&gt;, b: &amp;Vector3&lt;f32&gt;) -&gt; Vector3&lt;f32&gt; {     a + b }<\/code><\/pre>\n<p>\u0414\u043b\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0435\u0441\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0430:<\/p>\n<pre><code>wasm-pack build --target web<\/code><\/pre>\n<p>Nalgebra \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0441 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430\u043c\u0438 \u0434\u043b\u044f GPU \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439, \u0442\u0430\u043a\u0438\u043c\u0438 \u043a\u0430\u043a <a href=\"https:\/\/github.com\/gfx-rs\/wgpu\">wgpu <\/a>\u0438 <a href=\"https:\/\/github.com\/ash-rs\/ash\">ash<\/a>.<\/p>\n<p>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 nalgebra  \u2014 \u043c\u043e\u0449\u043d\u044b\u0439 \u0438 \u0433\u0438\u0431\u043a\u0438\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0439 \u0430\u043b\u0433\u0435\u0431\u0440\u043e\u0439 \u0432 Rust.<\/p>\n<p>\u2022\u200e  <a href=\"https:\/\/github.com\/dimforge\/nalgebra\">nalgebra \u043d\u0430 GitHub<\/a><\/p>\n<hr\/>\n<p>\u0427\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u043d\u0435\u043e\u043f\u044b\u0442\u043d\u0430\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430, \u0430 \u043d\u0430\u0434\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443? \u041c\u043e\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0437\u0430\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u0431 \u0443\u0432\u043e\u043b\u044c\u043d\u0435\u043d\u0438\u0438, \u0430 \u043f\u043e\u0442\u043e\u043c \u0441 \u0443\u0436\u0430\u0441\u043e\u043c \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435 \u043f\u0440\u043e \u043f\u0440\u043e\u0448\u043b\u044b\u0435 \u043c\u0435\u0441\u0442\u0430 \u0440\u0430\u0431\u043e\u0442\u044b. \u0410 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0432\u044b\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442. \u041d\u0430 \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u043c \u0443\u0440\u043e\u043a\u0435 \u043c\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u043e\u0431\u0441\u0443\u0436\u0434\u0430\u0442\u044c, \u043a\u0430\u043a\u0430\u044f \u0438\u0437 \u044d\u0442\u0438\u0445 \u0434\u0432\u0443\u0445 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0439 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0430\u044f, \u043d\u043e \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0430 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043c\u043e\u0447\u044c \u0432\u044b\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0440\u0435\u0448\u0438\u0442\u044c \u044d\u0442\u0443 \u0442\u0440\u0443\u0434\u043d\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443.<\/p>\n<p>\u0423\u0440\u043e\u043a \u043f\u0440\u043e\u0439\u0434\u0451\u0442 \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043a\u0443\u0440\u0441\u0430 \u00ab\u041c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0430 \u0434\u043b\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u0432\u00bb 26 \u0438\u044e\u043b\u044f. <a href=\"https:\/\/otus.pw\/cx83\/\">\u0417\u0430\u043f\u0438\u0441\u0430\u0442\u044c\u0441\u044f \u043c\u043e\u0436\u043d\u043e \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435.<\/a><\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/828316\/\"> https:\/\/habr.com\/ru\/articles\/828316\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-427343","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/427343","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=427343"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/427343\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=427343"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=427343"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=427343"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}